@styleless-ui/react
Version:
Completely unstyled, headless and accessible React UI components.
1 lines • 1.39 kB
JavaScript
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 n in r=arguments[e])Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n]);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 n=0;for(o=Object.getOwnPropertySymbols(t);n<o.length;n++)r.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(e[o[n]]=t[o[n]])}return e};import{jsx as e}from"react/jsx-runtime";import*as o from"react";import n from"../../FocusTrap";import{componentWithForwardedRef as a,setRef as i,useDeterministicId as s}from"../../utils";import l from"../context";import{ContentRoot as c,ActionRoot as f}from"../slots";var p=a((function(a,p){var u=a.className,m=a.children,d=a.id,y=r(a,["className","children","id"]),h=o.useContext(l),v=s(d,"styleless-ui__snackbar-content"),O=o.useState(!1),b=O[0],j=O[1];return e(n,t({enabled:(null==h?void 0:h.open)&&b},{children:e("div",t({},y,{id:v,ref:function(t){if(i(p,t),t){if(!t.querySelector('[data-slot="'.concat(f,'"]')))return j(!1);j(!0)}},className:u,role:null==h?void 0:h.role,"data-slot":c,"aria-atomic":"true","aria-live":h?"alert"===h.role?"assertive":"polite":"off"},{children:m}))}))}));export default p;