UNPKG

@styleless-ui/react

Version:

Completely unstyled, headless and accessible React UI components.

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