UNPKG

@styleless-ui/react

Version:

Completely unstyled, headless and accessible React UI components.

1 lines 1.23 kB
var t=this&&this.__assign||function(){return t=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},t.apply(this,arguments)},e=this&&this.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r};import{jsx as r}from"react/jsx-runtime";import*as n from"react";import{componentWithForwardedRef as o,useDeterministicId as s,useForkedRefs as i}from"../../utils";import l from"../Item/context";import a from"../Menu";import{SubRoot as u}from"../slots";var c=o((function(o,c){var p=o.children,f=o.className,m=o.id,b=e(o,["children","className","id"]),d=s(m,"styleless-ui__sub-menu"),h=n.useContext(l),y=n.useRef(null),O=i(c,y);return null==h||h.registerSubMenu(y,d),r(a,t({},b,{open:null==h?void 0:h.isSubMenuOpen(),id:d,ref:O,className:f,anchorElement:null==h?void 0:h.ref,"data-slot":u,"data-submenu":!0},{children:p}))}));export default c;