UNPKG

@styleless-ui/react

Version:

Completely unstyled, headless and accessible React UI components.

1 lines 1.35 kB
var t=this&&this.__assign||function(){return t=Object.assign||function(t){for(var r,e=1,o=arguments.length;e<o;e++)for(var s in r=arguments[e])Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s]);return t},t.apply(this,arguments)},r=this&&this.__rest||function(t,r){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&r.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(o=Object.getOwnPropertySymbols(t);s<o.length;s++)r.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(t,o[s])&&(e[o[s]]=t[o[s]])}return e};import{jsx as e}from"react/jsx-runtime";import*as o from"react";import{componentWithForwardedRef as s,useDeterministicId as a,useForkedRefs as i}from"../../utils";import{ContentRoot as n,DescriptionRoot as l}from"../slots";var c=s((function(s,c){var p=s.className,f=s.children,u=s.id,d=s.as,y=void 0===d?"span":d,m=r(s,["className","children","id","as"]),h=a(u,"styleless-ui__dialog-description"),b=o.useRef(null),O=i(c,b);return e(y,t({},m,{id:h,ref:function(t){if(O(t),t&&h){var r=t.closest("[data-slot='".concat(n,"']"));r?r.setAttribute("aria-describedby",h):console.error("[StylelessUI][Dialog]: You should always wrap your content with `<Dialog.Content>` to provide accessibility features.")}},className:p,"data-slot":l},{children:f}))}));export default c;