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 n}from"../../utils";import{ContentRoot as i,DescriptionRoot as c}from"../slots";var l=s((function(s,l){var p=s.className,f=s.children,u=s.id,y=s.as,d=void 0===y?"span":y,b=r(s,["className","children","id","as"]),m=a(u,"styleless-ui__snackbar-description"),h=o.useRef(null),O=n(l,h);return e(d,t({},b,{id:m,ref:function(t){if(O(t),t&&m){var r=t.closest("[data-slot='".concat(i,"']"));r?r.setAttribute("aria-describedby",m):console.error("[StylelessUI][Snackbar]: You should always wrap your content with `<Snackbar.Content>` to provide accessibility features.")}},"data-slot":c,className:p},{children:f}))}));export default l;