@net-advantage/nabs-ui-dropdownmenu 0.29.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nabs-ui-dropdownmenu.cjs +1 -10
- package/dist/nabs-ui-dropdownmenu.js +52 -492
- package/package.json +3 -1
|
@@ -1,10 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});
|
|
2
|
-
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
3
|
-
2. You might be breaking the Rules of Hooks
|
|
4
|
-
3. You might have more than one copy of React in the same app
|
|
5
|
-
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),e}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==`function`&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var c=require("react"),l={d:{f:t,r:function(){throw Error(`Invalid form element. requestFormReset must be passed a form that was rendered by React.`)},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},u=Symbol.for(`react.portal`),d=c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;typeof Map==`function`&&Map.prototype!=null&&typeof Map.prototype.forEach==`function`&&typeof Set==`function`&&Set.prototype!=null&&typeof Set.prototype.clear==`function`&&typeof Set.prototype.forEach==`function`||console.error(`React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills`),e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(`Target container is not a DOM element.`);return r(e,t,null,n)},e.flushSync=function(e){var t=d.T,n=l.p;try{if(d.T=null,l.p=2,e)return e()}finally{d.T=t,l.p=n,l.d.f()&&console.error(`flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.`)}},e.preconnect=function(e,t){typeof e==`string`&&e?t!=null&&typeof t!=`object`?console.error("ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.",o(t)):t!=null&&typeof t.crossOrigin!=`string`&&console.error("ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.",a(t.crossOrigin)):console.error("ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",a(e)),typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,l.d.C(e,t))},e.prefetchDNS=function(e){if(typeof e!=`string`||!e)console.error("ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",a(e));else if(1<arguments.length){var t=arguments[1];typeof t==`object`&&t.hasOwnProperty(`crossOrigin`)?console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",o(t)):console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",o(t))}typeof e==`string`&&l.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&e?typeof t!=`object`||!t?console.error("ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.",o(t)):t.as!==`style`&&t.as!==`script`&&console.error('ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are "style" and "script".',o(t.as)):console.error("ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",a(e)),typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=i(n,t.crossOrigin),s=typeof t.integrity==`string`?t.integrity:void 0,c=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?l.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:s,fetchPriority:c}):n===`script`&&l.d.X(e,{crossOrigin:r,integrity:s,fetchPriority:c,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){var n=``;if(typeof e==`string`&&e||(n+=" The `href` argument encountered was "+a(e)+`.`),t!==void 0&&typeof t!=`object`?n+=" The `options` argument encountered was "+a(t)+`.`:t&&`as`in t&&t.as!==`script`&&(n+=" The `as` option encountered was "+o(t.as)+`.`),n)console.error("ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s",n);else switch(n=t&&typeof t.as==`string`?t.as:`script`,n){case`script`:break;default:n=o(n),console.error('ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script" but received "%s" instead. This warning was generated for `href` "%s". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)',n,e)}typeof e==`string`&&(typeof t==`object`&&t?(t.as==null||t.as===`script`)&&(n=i(t.as,t.crossOrigin),l.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})):t??l.d.M(e))},e.preload=function(e,t){var n=``;if(typeof e==`string`&&e||(n+=" The `href` argument encountered was "+a(e)+`.`),typeof t!=`object`||!t?n+=" The `options` argument encountered was "+a(t)+`.`:typeof t.as==`string`&&t.as||(n+=" The `as` option encountered was "+a(t.as)+`.`),n&&console.error('ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel="preload" as="..." />` tag.%s',n),typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){n=t.as;var r=i(n,t.crossOrigin);l.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){var n=``;typeof e==`string`&&e||(n+=" The `href` argument encountered was "+a(e)+`.`),t!==void 0&&typeof t!=`object`?n+=" The `options` argument encountered was "+a(t)+`.`:t&&`as`in t&&typeof t.as!=`string`&&(n+=" The `as` option encountered was "+a(t.as)+`.`),n&&console.error('ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel="modulepreload" as="..." />` tag.%s',n),typeof e==`string`&&(t?(n=i(t.as,t.crossOrigin),l.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})):l.d.m(e))},e.requestFormReset=function(e){l.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s().useFormState(e,t,n)},e.useFormStatus=function(){return s().useHostTransitionStatus()},e.version=`19.2.7`,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==`function`&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()})),i=e(((e,t)=>{function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`)){if(process.env.NODE_ENV!==`production`)throw Error(`^_^`);try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(e){console.error(e)}}}process.env.NODE_ENV===`production`?(i(),t.exports=n()):t.exports=r()}))();function a(e){return!!(e&&`type`in e&&e.type===`divider`)}function o(e){return e.label??e.children??`Menu item`}function s(e,t){return e.value??e.label??`item-${t}`}var c=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),l=e((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===O?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(typeof e.tag==`number`&&console.error(`Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.`),e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=k.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(A.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){N||(N=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function l(){var e=t(this.type);return P[e]||(P[e]=!0,console.error(`Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.`)),e=this.props.ref,e===void 0?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,"ref",{enumerable:!1,value:null}):Object.defineProperty(e,"ref",{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(j(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}else console.error(`React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.`);else f(p);if(A.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,L[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
6
|
-
let props = %s;
|
|
7
|
-
<%s {...props} />
|
|
8
|
-
React keys must be passed directly to JSX without using spread:
|
|
9
|
-
let props = %s;
|
|
10
|
-
<%s key={someKey} {...props} />`,o,p,m,p),L[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require("react"),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),I=M(i(o)),L={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)}})()})),u=e(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=c():t.exports=l()}))();function d({label:e=`Menu`,triggerContent:n,triggerAriaLabel:r,menuAlign:c=`start`,items:l=[],className:d=``,triggerClassName:f=``,menuClassName:p=``,itemClassName:m=``,dividerClassName:h=``,id:g,onItemSelect:_,...v}){let[y,b]=(0,t.useState)(!1),x=(0,t.useRef)(null),S=(0,t.useRef)(null),C=(0,t.useRef)(null),w=(0,t.useId)(),T=g??`nabs-ui-dropdownmenu-${w.replace(/:/g,``)}`,E=[`nabs-ui-dropdownmenu`,d].filter(Boolean).join(` `),D=[`nabs-ui-dropdownmenu__trigger`,f].filter(Boolean).join(` `),O=[`nabs-ui-dropdownmenu__menu`,p].filter(Boolean).join(` `),k=[`nabs-ui-dropdownmenu__item`,m].filter(Boolean).join(` `),A=[`nabs-ui-dropdownmenu__divider`,h].filter(Boolean).join(` `);(0,t.useEffect)(()=>{let e=e=>{e.target instanceof Node&&x.current&&!x.current.contains(e.target)&&C.current&&!C.current.contains(e.target)&&b(!1)},t=e=>{e.key===`Escape`&&b(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[]),(0,t.useLayoutEffect)(()=>{if(!y||!S.current)return;let e=()=>{let e=S.current?.getBoundingClientRect(),t=C.current?.getBoundingClientRect(),n=C.current;if(!e||!t||!n)return;let r=Math.max(e.width,t.width),i=window.innerWidth-r-8,a=c===`end`?e.right-r:e.left,o=Math.max(8,Math.min(a,i)),s=Math.max(8,e.bottom+10);n.style.position=`fixed`,n.style.top=`${s}px`,n.style.left=`${o}px`,n.style.right=`auto`,n.style.minWidth=`${r}px`,n.style.visibility=`visible`};return C.current&&(C.current.style.visibility=`hidden`),e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[c,y]);let j=(e,t)=>{if(b(!1),e.disabled){t.preventDefault();return}_?.(e,t),e.onSelect?.(e,t)};return(0,u.jsxs)(`div`,{ref:x,className:E,...v,children:[(0,u.jsx)(`button`,{ref:S,type:`button`,className:D,"aria-haspopup":`menu`,"aria-controls":T,"aria-label":r??e,onClick:()=>b(e=>!e),children:n??(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{className:`nabs-ui-dropdownmenu__triggerLabel`,children:e}),(0,u.jsx)(`span`,{className:`nabs-ui-dropdownmenu__triggerChevron`,"aria-hidden":`true`,children:`▾`})]})}),y&&typeof document<`u`?(0,i.createPortal)((0,u.jsx)(`div`,{ref:C,id:T,className:O,"aria-label":e,children:l.map((e,t)=>{if(a(e))return(0,u.jsx)(`div`,{className:A,role:`separator`,"aria-hidden":`true`},`divider-${t}`);let n=o(e),r=[k,e.disabled?`nabs-ui-dropdownmenu__item--disabled`:``,e.danger?`nabs-ui-dropdownmenu__item--danger`:``].filter(Boolean).join(` `),i={className:r,"aria-disabled":e.disabled||void 0};return e.href?(0,u.jsxs)(`a`,{...i,href:e.disabled?void 0:e.href,onClick:t=>j(e,t),children:[(0,u.jsx)(`span`,{className:`nabs-ui-dropdownmenu__itemLabel`,children:n}),e.description?(0,u.jsx)(`span`,{className:`nabs-ui-dropdownmenu__itemDescription`,children:e.description}):null]},s(e,t)):(0,u.jsxs)(`button`,{type:`button`,className:r,disabled:e.disabled,onClick:t=>j(e,t),children:[(0,u.jsx)(`span`,{className:`nabs-ui-dropdownmenu__itemLabel`,children:n}),e.description?(0,u.jsx)(`span`,{className:`nabs-ui-dropdownmenu__itemDescription`,children:e.description}):null]},s(e,t))})}),document.body):null]})}exports.DropdownMenu=d;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("react-dom"),n=require("react/jsx-runtime");function r(e){return!!(e&&`type`in e&&e.type===`divider`)}function i(e){return e.label??e.children??`Menu item`}function a(e,t){return e.value??e.label??`item-${t}`}function o({label:o=`Menu`,triggerContent:s,triggerAriaLabel:c,menuAlign:l=`start`,items:u=[],className:d=``,triggerClassName:f=``,menuClassName:p=``,itemClassName:m=``,dividerClassName:h=``,id:g,onItemSelect:_,...v}){let[y,b]=(0,e.useState)(!1),x=(0,e.useRef)(null),S=(0,e.useRef)(null),C=(0,e.useRef)(null),w=(0,e.useId)(),T=g??`nabs-ui-dropdownmenu-${w.replace(/:/g,``)}`,E=[`nabs-ui-dropdownmenu`,d].filter(Boolean).join(` `),D=[`nabs-ui-dropdownmenu__trigger`,f].filter(Boolean).join(` `),O=[`nabs-ui-dropdownmenu__menu`,p].filter(Boolean).join(` `),k=[`nabs-ui-dropdownmenu__item`,m].filter(Boolean).join(` `),A=[`nabs-ui-dropdownmenu__divider`,h].filter(Boolean).join(` `);(0,e.useEffect)(()=>{let e=e=>{e.target instanceof Node&&x.current&&!x.current.contains(e.target)&&C.current&&!C.current.contains(e.target)&&b(!1)},t=e=>{e.key===`Escape`&&b(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[]),(0,e.useLayoutEffect)(()=>{if(!y||!S.current)return;let e=()=>{let e=S.current?.getBoundingClientRect(),t=C.current?.getBoundingClientRect(),n=C.current;if(!e||!t||!n)return;let r=Math.max(e.width,t.width),i=window.innerWidth-r-8,a=l===`end`?e.right-r:e.left,o=Math.max(8,Math.min(a,i)),s=Math.max(8,e.bottom+10);n.style.position=`fixed`,n.style.top=`${s}px`,n.style.left=`${o}px`,n.style.right=`auto`,n.style.minWidth=`${r}px`,n.style.visibility=`visible`};return C.current&&(C.current.style.visibility=`hidden`),e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[l,y]);let j=(e,t)=>{if(b(!1),e.disabled){t.preventDefault();return}_?.(e,t),e.onSelect?.(e,t)};return(0,n.jsxs)(`div`,{ref:x,className:E,...v,children:[(0,n.jsx)(`button`,{ref:S,type:`button`,className:D,"aria-haspopup":`menu`,"aria-controls":T,"aria-label":c??o,onClick:()=>b(e=>!e),children:s??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`span`,{className:`nabs-ui-dropdownmenu__triggerLabel`,children:o}),(0,n.jsx)(`span`,{className:`nabs-ui-dropdownmenu__triggerChevron`,"aria-hidden":`true`,children:`▾`})]})}),y&&typeof document<`u`?(0,t.createPortal)((0,n.jsx)(`div`,{ref:C,id:T,className:O,"aria-label":o,children:u.map((e,t)=>{if(r(e))return(0,n.jsx)(`div`,{className:A,role:`separator`,"aria-hidden":`true`},`divider-${t}`);let o=i(e),s=[k,e.disabled?`nabs-ui-dropdownmenu__item--disabled`:``,e.danger?`nabs-ui-dropdownmenu__item--danger`:``].filter(Boolean).join(` `),c={className:s,"aria-disabled":e.disabled||void 0};return e.href?(0,n.jsxs)(`a`,{...c,href:e.disabled?void 0:e.href,onClick:t=>j(e,t),children:[(0,n.jsx)(`span`,{className:`nabs-ui-dropdownmenu__itemLabel`,children:o}),e.description?(0,n.jsx)(`span`,{className:`nabs-ui-dropdownmenu__itemDescription`,children:e.description}):null]},a(e,t)):(0,n.jsxs)(`button`,{type:`button`,className:s,disabled:e.disabled,onClick:t=>j(e,t),children:[(0,n.jsx)(`span`,{className:`nabs-ui-dropdownmenu__itemLabel`,children:o}),e.description?(0,n.jsx)(`span`,{className:`nabs-ui-dropdownmenu__itemDescription`,children:e.description}):null]},a(e,t))})}),document.body):null]})}exports.DropdownMenu=o;
|
|
@@ -1,554 +1,114 @@
|
|
|
1
1
|
import { useEffect as e, useId as t, useLayoutEffect as n, useRef as r, useState as i } from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}), s = /* @__PURE__ */ a(((e) => {
|
|
7
|
-
var t = o("react");
|
|
8
|
-
function n(e) {
|
|
9
|
-
var t = "https://react.dev/errors/" + e;
|
|
10
|
-
if (1 < arguments.length) {
|
|
11
|
-
t += "?args[]=" + encodeURIComponent(arguments[1]);
|
|
12
|
-
for (var n = 2; n < arguments.length; n++) t += "&args[]=" + encodeURIComponent(arguments[n]);
|
|
13
|
-
}
|
|
14
|
-
return "Minified React error #" + e + "; visit " + t + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
|
|
15
|
-
}
|
|
16
|
-
function r() {}
|
|
17
|
-
var i = {
|
|
18
|
-
d: {
|
|
19
|
-
f: r,
|
|
20
|
-
r: function() {
|
|
21
|
-
throw Error(n(522));
|
|
22
|
-
},
|
|
23
|
-
D: r,
|
|
24
|
-
C: r,
|
|
25
|
-
L: r,
|
|
26
|
-
m: r,
|
|
27
|
-
X: r,
|
|
28
|
-
S: r,
|
|
29
|
-
M: r
|
|
30
|
-
},
|
|
31
|
-
p: 0,
|
|
32
|
-
findDOMNode: null
|
|
33
|
-
}, a = Symbol.for("react.portal");
|
|
34
|
-
function s(e, t, n) {
|
|
35
|
-
var r = 3 < arguments.length && arguments[3] !== void 0 ? arguments[3] : null;
|
|
36
|
-
return {
|
|
37
|
-
$$typeof: a,
|
|
38
|
-
key: r == null ? null : "" + r,
|
|
39
|
-
children: e,
|
|
40
|
-
containerInfo: t,
|
|
41
|
-
implementation: n
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
var c = t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
45
|
-
function l(e, t) {
|
|
46
|
-
if (e === "font") return "";
|
|
47
|
-
if (typeof t == "string") return t === "use-credentials" ? t : "";
|
|
48
|
-
}
|
|
49
|
-
e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = i, e.createPortal = function(e, t) {
|
|
50
|
-
var r = 2 < arguments.length && arguments[2] !== void 0 ? arguments[2] : null;
|
|
51
|
-
if (!t || t.nodeType !== 1 && t.nodeType !== 9 && t.nodeType !== 11) throw Error(n(299));
|
|
52
|
-
return s(e, t, null, r);
|
|
53
|
-
}, e.flushSync = function(e) {
|
|
54
|
-
var t = c.T, n = i.p;
|
|
55
|
-
try {
|
|
56
|
-
if (c.T = null, i.p = 2, e) return e();
|
|
57
|
-
} finally {
|
|
58
|
-
c.T = t, i.p = n, i.d.f();
|
|
59
|
-
}
|
|
60
|
-
}, e.preconnect = function(e, t) {
|
|
61
|
-
typeof e == "string" && (t ? (t = t.crossOrigin, t = typeof t == "string" ? t === "use-credentials" ? t : "" : void 0) : t = null, i.d.C(e, t));
|
|
62
|
-
}, e.prefetchDNS = function(e) {
|
|
63
|
-
typeof e == "string" && i.d.D(e);
|
|
64
|
-
}, e.preinit = function(e, t) {
|
|
65
|
-
if (typeof e == "string" && t && typeof t.as == "string") {
|
|
66
|
-
var n = t.as, r = l(n, t.crossOrigin), a = typeof t.integrity == "string" ? t.integrity : void 0, o = typeof t.fetchPriority == "string" ? t.fetchPriority : void 0;
|
|
67
|
-
n === "style" ? i.d.S(e, typeof t.precedence == "string" ? t.precedence : void 0, {
|
|
68
|
-
crossOrigin: r,
|
|
69
|
-
integrity: a,
|
|
70
|
-
fetchPriority: o
|
|
71
|
-
}) : n === "script" && i.d.X(e, {
|
|
72
|
-
crossOrigin: r,
|
|
73
|
-
integrity: a,
|
|
74
|
-
fetchPriority: o,
|
|
75
|
-
nonce: typeof t.nonce == "string" ? t.nonce : void 0
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}, e.preinitModule = function(e, t) {
|
|
79
|
-
if (typeof e == "string") if (typeof t == "object" && t) {
|
|
80
|
-
if (t.as == null || t.as === "script") {
|
|
81
|
-
var n = l(t.as, t.crossOrigin);
|
|
82
|
-
i.d.M(e, {
|
|
83
|
-
crossOrigin: n,
|
|
84
|
-
integrity: typeof t.integrity == "string" ? t.integrity : void 0,
|
|
85
|
-
nonce: typeof t.nonce == "string" ? t.nonce : void 0
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
} else t ?? i.d.M(e);
|
|
89
|
-
}, e.preload = function(e, t) {
|
|
90
|
-
if (typeof e == "string" && typeof t == "object" && t && typeof t.as == "string") {
|
|
91
|
-
var n = t.as, r = l(n, t.crossOrigin);
|
|
92
|
-
i.d.L(e, n, {
|
|
93
|
-
crossOrigin: r,
|
|
94
|
-
integrity: typeof t.integrity == "string" ? t.integrity : void 0,
|
|
95
|
-
nonce: typeof t.nonce == "string" ? t.nonce : void 0,
|
|
96
|
-
type: typeof t.type == "string" ? t.type : void 0,
|
|
97
|
-
fetchPriority: typeof t.fetchPriority == "string" ? t.fetchPriority : void 0,
|
|
98
|
-
referrerPolicy: typeof t.referrerPolicy == "string" ? t.referrerPolicy : void 0,
|
|
99
|
-
imageSrcSet: typeof t.imageSrcSet == "string" ? t.imageSrcSet : void 0,
|
|
100
|
-
imageSizes: typeof t.imageSizes == "string" ? t.imageSizes : void 0,
|
|
101
|
-
media: typeof t.media == "string" ? t.media : void 0
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}, e.preloadModule = function(e, t) {
|
|
105
|
-
if (typeof e == "string") if (t) {
|
|
106
|
-
var n = l(t.as, t.crossOrigin);
|
|
107
|
-
i.d.m(e, {
|
|
108
|
-
as: typeof t.as == "string" && t.as !== "script" ? t.as : void 0,
|
|
109
|
-
crossOrigin: n,
|
|
110
|
-
integrity: typeof t.integrity == "string" ? t.integrity : void 0
|
|
111
|
-
});
|
|
112
|
-
} else i.d.m(e);
|
|
113
|
-
}, e.requestFormReset = function(e) {
|
|
114
|
-
i.d.r(e);
|
|
115
|
-
}, e.unstable_batchedUpdates = function(e, t) {
|
|
116
|
-
return e(t);
|
|
117
|
-
}, e.useFormState = function(e, t, n) {
|
|
118
|
-
return c.H.useFormState(e, t, n);
|
|
119
|
-
}, e.useFormStatus = function() {
|
|
120
|
-
return c.H.useHostTransitionStatus();
|
|
121
|
-
}, e.version = "19.2.7";
|
|
122
|
-
})), c = /* @__PURE__ */ a(((e) => {
|
|
123
|
-
process.env.NODE_ENV !== "production" && (function() {
|
|
124
|
-
function t() {}
|
|
125
|
-
function n(e) {
|
|
126
|
-
return "" + e;
|
|
127
|
-
}
|
|
128
|
-
function r(e, t, r) {
|
|
129
|
-
var i = 3 < arguments.length && arguments[3] !== void 0 ? arguments[3] : null;
|
|
130
|
-
try {
|
|
131
|
-
n(i);
|
|
132
|
-
var a = !1;
|
|
133
|
-
} catch {
|
|
134
|
-
a = !0;
|
|
135
|
-
}
|
|
136
|
-
return a && (console.error("The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", typeof Symbol == "function" && Symbol.toStringTag && i[Symbol.toStringTag] || i.constructor.name || "Object"), n(i)), {
|
|
137
|
-
$$typeof: d,
|
|
138
|
-
key: i == null ? null : "" + i,
|
|
139
|
-
children: e,
|
|
140
|
-
containerInfo: t,
|
|
141
|
-
implementation: r
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
function i(e, t) {
|
|
145
|
-
if (e === "font") return "";
|
|
146
|
-
if (typeof t == "string") return t === "use-credentials" ? t : "";
|
|
147
|
-
}
|
|
148
|
-
function a(e) {
|
|
149
|
-
return e === null ? "`null`" : e === void 0 ? "`undefined`" : e === "" ? "an empty string" : "something with type \"" + typeof e + "\"";
|
|
150
|
-
}
|
|
151
|
-
function s(e) {
|
|
152
|
-
return e === null ? "`null`" : e === void 0 ? "`undefined`" : e === "" ? "an empty string" : typeof e == "string" ? JSON.stringify(e) : typeof e == "number" ? "`" + e + "`" : "something with type \"" + typeof e + "\"";
|
|
153
|
-
}
|
|
154
|
-
function c() {
|
|
155
|
-
var e = f.H;
|
|
156
|
-
return e === null && console.error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."), e;
|
|
157
|
-
}
|
|
158
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
159
|
-
var l = o("react"), u = {
|
|
160
|
-
d: {
|
|
161
|
-
f: t,
|
|
162
|
-
r: function() {
|
|
163
|
-
throw Error("Invalid form element. requestFormReset must be passed a form that was rendered by React.");
|
|
164
|
-
},
|
|
165
|
-
D: t,
|
|
166
|
-
C: t,
|
|
167
|
-
L: t,
|
|
168
|
-
m: t,
|
|
169
|
-
X: t,
|
|
170
|
-
S: t,
|
|
171
|
-
M: t
|
|
172
|
-
},
|
|
173
|
-
p: 0,
|
|
174
|
-
findDOMNode: null
|
|
175
|
-
}, d = Symbol.for("react.portal"), f = l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
176
|
-
typeof Map == "function" && Map.prototype != null && typeof Map.prototype.forEach == "function" && typeof Set == "function" && Set.prototype != null && typeof Set.prototype.clear == "function" && typeof Set.prototype.forEach == "function" || console.error("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"), e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = u, e.createPortal = function(e, t) {
|
|
177
|
-
var n = 2 < arguments.length && arguments[2] !== void 0 ? arguments[2] : null;
|
|
178
|
-
if (!t || t.nodeType !== 1 && t.nodeType !== 9 && t.nodeType !== 11) throw Error("Target container is not a DOM element.");
|
|
179
|
-
return r(e, t, null, n);
|
|
180
|
-
}, e.flushSync = function(e) {
|
|
181
|
-
var t = f.T, n = u.p;
|
|
182
|
-
try {
|
|
183
|
-
if (f.T = null, u.p = 2, e) return e();
|
|
184
|
-
} finally {
|
|
185
|
-
f.T = t, u.p = n, u.d.f() && console.error("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.");
|
|
186
|
-
}
|
|
187
|
-
}, e.preconnect = function(e, t) {
|
|
188
|
-
typeof e == "string" && e ? t != null && typeof t != "object" ? console.error("ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.", s(t)) : t != null && typeof t.crossOrigin != "string" && console.error("ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.", a(t.crossOrigin)) : console.error("ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.", a(e)), typeof e == "string" && (t ? (t = t.crossOrigin, t = typeof t == "string" ? t === "use-credentials" ? t : "" : void 0) : t = null, u.d.C(e, t));
|
|
189
|
-
}, e.prefetchDNS = function(e) {
|
|
190
|
-
if (typeof e != "string" || !e) console.error("ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.", a(e));
|
|
191
|
-
else if (1 < arguments.length) {
|
|
192
|
-
var t = arguments[1];
|
|
193
|
-
typeof t == "object" && t.hasOwnProperty("crossOrigin") ? console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.", s(t)) : console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.", s(t));
|
|
194
|
-
}
|
|
195
|
-
typeof e == "string" && u.d.D(e);
|
|
196
|
-
}, e.preinit = function(e, t) {
|
|
197
|
-
if (typeof e == "string" && e ? typeof t != "object" || !t ? console.error("ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.", s(t)) : t.as !== "style" && t.as !== "script" && console.error("ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are \"style\" and \"script\".", s(t.as)) : console.error("ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.", a(e)), typeof e == "string" && t && typeof t.as == "string") {
|
|
198
|
-
var n = t.as, r = i(n, t.crossOrigin), o = typeof t.integrity == "string" ? t.integrity : void 0, c = typeof t.fetchPriority == "string" ? t.fetchPriority : void 0;
|
|
199
|
-
n === "style" ? u.d.S(e, typeof t.precedence == "string" ? t.precedence : void 0, {
|
|
200
|
-
crossOrigin: r,
|
|
201
|
-
integrity: o,
|
|
202
|
-
fetchPriority: c
|
|
203
|
-
}) : n === "script" && u.d.X(e, {
|
|
204
|
-
crossOrigin: r,
|
|
205
|
-
integrity: o,
|
|
206
|
-
fetchPriority: c,
|
|
207
|
-
nonce: typeof t.nonce == "string" ? t.nonce : void 0
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
}, e.preinitModule = function(e, t) {
|
|
211
|
-
var n = "";
|
|
212
|
-
if (typeof e == "string" && e || (n += " The `href` argument encountered was " + a(e) + "."), t !== void 0 && typeof t != "object" ? n += " The `options` argument encountered was " + a(t) + "." : t && "as" in t && t.as !== "script" && (n += " The `as` option encountered was " + s(t.as) + "."), n) console.error("ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s", n);
|
|
213
|
-
else switch (n = t && typeof t.as == "string" ? t.as : "script", n) {
|
|
214
|
-
case "script": break;
|
|
215
|
-
default: n = s(n), console.error("ReactDOM.preinitModule(): Currently the only supported \"as\" type for this function is \"script\" but received \"%s\" instead. This warning was generated for `href` \"%s\". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)", n, e);
|
|
216
|
-
}
|
|
217
|
-
typeof e == "string" && (typeof t == "object" && t ? (t.as == null || t.as === "script") && (n = i(t.as, t.crossOrigin), u.d.M(e, {
|
|
218
|
-
crossOrigin: n,
|
|
219
|
-
integrity: typeof t.integrity == "string" ? t.integrity : void 0,
|
|
220
|
-
nonce: typeof t.nonce == "string" ? t.nonce : void 0
|
|
221
|
-
})) : t ?? u.d.M(e));
|
|
222
|
-
}, e.preload = function(e, t) {
|
|
223
|
-
var n = "";
|
|
224
|
-
if (typeof e == "string" && e || (n += " The `href` argument encountered was " + a(e) + "."), typeof t != "object" || !t ? n += " The `options` argument encountered was " + a(t) + "." : typeof t.as == "string" && t.as || (n += " The `as` option encountered was " + a(t.as) + "."), n && console.error("ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel=\"preload\" as=\"...\" />` tag.%s", n), typeof e == "string" && typeof t == "object" && t && typeof t.as == "string") {
|
|
225
|
-
n = t.as;
|
|
226
|
-
var r = i(n, t.crossOrigin);
|
|
227
|
-
u.d.L(e, n, {
|
|
228
|
-
crossOrigin: r,
|
|
229
|
-
integrity: typeof t.integrity == "string" ? t.integrity : void 0,
|
|
230
|
-
nonce: typeof t.nonce == "string" ? t.nonce : void 0,
|
|
231
|
-
type: typeof t.type == "string" ? t.type : void 0,
|
|
232
|
-
fetchPriority: typeof t.fetchPriority == "string" ? t.fetchPriority : void 0,
|
|
233
|
-
referrerPolicy: typeof t.referrerPolicy == "string" ? t.referrerPolicy : void 0,
|
|
234
|
-
imageSrcSet: typeof t.imageSrcSet == "string" ? t.imageSrcSet : void 0,
|
|
235
|
-
imageSizes: typeof t.imageSizes == "string" ? t.imageSizes : void 0,
|
|
236
|
-
media: typeof t.media == "string" ? t.media : void 0
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
}, e.preloadModule = function(e, t) {
|
|
240
|
-
var n = "";
|
|
241
|
-
typeof e == "string" && e || (n += " The `href` argument encountered was " + a(e) + "."), t !== void 0 && typeof t != "object" ? n += " The `options` argument encountered was " + a(t) + "." : t && "as" in t && typeof t.as != "string" && (n += " The `as` option encountered was " + a(t.as) + "."), n && console.error("ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel=\"modulepreload\" as=\"...\" />` tag.%s", n), typeof e == "string" && (t ? (n = i(t.as, t.crossOrigin), u.d.m(e, {
|
|
242
|
-
as: typeof t.as == "string" && t.as !== "script" ? t.as : void 0,
|
|
243
|
-
crossOrigin: n,
|
|
244
|
-
integrity: typeof t.integrity == "string" ? t.integrity : void 0
|
|
245
|
-
})) : u.d.m(e));
|
|
246
|
-
}, e.requestFormReset = function(e) {
|
|
247
|
-
u.d.r(e);
|
|
248
|
-
}, e.unstable_batchedUpdates = function(e, t) {
|
|
249
|
-
return e(t);
|
|
250
|
-
}, e.useFormState = function(e, t, n) {
|
|
251
|
-
return c().useFormState(e, t, n);
|
|
252
|
-
}, e.useFormStatus = function() {
|
|
253
|
-
return c().useHostTransitionStatus();
|
|
254
|
-
}, e.version = "19.2.7", typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
255
|
-
})();
|
|
256
|
-
})), l = (/* @__PURE__ */ a(((e, t) => {
|
|
257
|
-
function n() {
|
|
258
|
-
if (!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ > "u" || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE != "function")) {
|
|
259
|
-
if (process.env.NODE_ENV !== "production") throw Error("^_^");
|
|
260
|
-
try {
|
|
261
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n);
|
|
262
|
-
} catch (e) {
|
|
263
|
-
console.error(e);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
process.env.NODE_ENV === "production" ? (n(), t.exports = s()) : t.exports = c();
|
|
268
|
-
})))();
|
|
269
|
-
function u(e) {
|
|
2
|
+
import { createPortal as a } from "react-dom";
|
|
3
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
4
|
+
//#region src/dropdownmenu.utils.ts
|
|
5
|
+
function l(e) {
|
|
270
6
|
return !!(e && "type" in e && e.type === "divider");
|
|
271
7
|
}
|
|
272
|
-
function
|
|
8
|
+
function u(e) {
|
|
273
9
|
return e.label ?? e.children ?? "Menu item";
|
|
274
10
|
}
|
|
275
|
-
function
|
|
11
|
+
function d(e, t) {
|
|
276
12
|
return e.value ?? e.label ?? `item-${t}`;
|
|
277
13
|
}
|
|
278
14
|
//#endregion
|
|
279
|
-
//#region
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
function r(e, n, r) {
|
|
283
|
-
var i = null;
|
|
284
|
-
if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
|
|
285
|
-
else r = n;
|
|
286
|
-
return n = r.ref, {
|
|
287
|
-
$$typeof: t,
|
|
288
|
-
type: e,
|
|
289
|
-
key: i,
|
|
290
|
-
ref: n === void 0 ? null : n,
|
|
291
|
-
props: r
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
295
|
-
})), m = /* @__PURE__ */ a(((e) => {
|
|
296
|
-
process.env.NODE_ENV !== "production" && (function() {
|
|
297
|
-
function t(e) {
|
|
298
|
-
if (e == null) return null;
|
|
299
|
-
if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
|
|
300
|
-
if (typeof e == "string") return e;
|
|
301
|
-
switch (e) {
|
|
302
|
-
case v: return "Fragment";
|
|
303
|
-
case b: return "Profiler";
|
|
304
|
-
case y: return "StrictMode";
|
|
305
|
-
case w: return "Suspense";
|
|
306
|
-
case T: return "SuspenseList";
|
|
307
|
-
case O: return "Activity";
|
|
308
|
-
}
|
|
309
|
-
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
310
|
-
case _: return "Portal";
|
|
311
|
-
case S: return e.displayName || "Context";
|
|
312
|
-
case x: return (e._context.displayName || "Context") + ".Consumer";
|
|
313
|
-
case C:
|
|
314
|
-
var n = e.render;
|
|
315
|
-
return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
316
|
-
case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
|
|
317
|
-
case D:
|
|
318
|
-
n = e._payload, e = e._init;
|
|
319
|
-
try {
|
|
320
|
-
return t(e(n));
|
|
321
|
-
} catch {}
|
|
322
|
-
}
|
|
323
|
-
return null;
|
|
324
|
-
}
|
|
325
|
-
function n(e) {
|
|
326
|
-
return "" + e;
|
|
327
|
-
}
|
|
328
|
-
function r(e) {
|
|
329
|
-
try {
|
|
330
|
-
n(e);
|
|
331
|
-
var t = !1;
|
|
332
|
-
} catch {
|
|
333
|
-
t = !0;
|
|
334
|
-
}
|
|
335
|
-
if (t) {
|
|
336
|
-
t = console;
|
|
337
|
-
var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
338
|
-
return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
function i(e) {
|
|
342
|
-
if (e === v) return "<>";
|
|
343
|
-
if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
|
|
344
|
-
try {
|
|
345
|
-
var n = t(e);
|
|
346
|
-
return n ? "<" + n + ">" : "<...>";
|
|
347
|
-
} catch {
|
|
348
|
-
return "<...>";
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
function a() {
|
|
352
|
-
var e = A.A;
|
|
353
|
-
return e === null ? null : e.getOwner();
|
|
354
|
-
}
|
|
355
|
-
function s() {
|
|
356
|
-
return Error("react-stack-top-frame");
|
|
357
|
-
}
|
|
358
|
-
function c(e) {
|
|
359
|
-
if (j.call(e, "key")) {
|
|
360
|
-
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
361
|
-
if (t && t.isReactWarning) return !1;
|
|
362
|
-
}
|
|
363
|
-
return e.key !== void 0;
|
|
364
|
-
}
|
|
365
|
-
function l(e, t) {
|
|
366
|
-
function n() {
|
|
367
|
-
P || (P = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
368
|
-
}
|
|
369
|
-
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
370
|
-
get: n,
|
|
371
|
-
configurable: !0
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
function u() {
|
|
375
|
-
var e = t(this.type);
|
|
376
|
-
return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
377
|
-
}
|
|
378
|
-
function d(e, t, n, r, i, a) {
|
|
379
|
-
var o = n.ref;
|
|
380
|
-
return e = {
|
|
381
|
-
$$typeof: g,
|
|
382
|
-
type: e,
|
|
383
|
-
key: t,
|
|
384
|
-
props: n,
|
|
385
|
-
_owner: r
|
|
386
|
-
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
387
|
-
enumerable: !1,
|
|
388
|
-
value: null
|
|
389
|
-
}) : Object.defineProperty(e, "ref", {
|
|
390
|
-
enumerable: !1,
|
|
391
|
-
get: u
|
|
392
|
-
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
393
|
-
configurable: !1,
|
|
394
|
-
enumerable: !1,
|
|
395
|
-
writable: !0,
|
|
396
|
-
value: 0
|
|
397
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
|
398
|
-
configurable: !1,
|
|
399
|
-
enumerable: !1,
|
|
400
|
-
writable: !0,
|
|
401
|
-
value: null
|
|
402
|
-
}), Object.defineProperty(e, "_debugStack", {
|
|
403
|
-
configurable: !1,
|
|
404
|
-
enumerable: !1,
|
|
405
|
-
writable: !0,
|
|
406
|
-
value: i
|
|
407
|
-
}), Object.defineProperty(e, "_debugTask", {
|
|
408
|
-
configurable: !1,
|
|
409
|
-
enumerable: !1,
|
|
410
|
-
writable: !0,
|
|
411
|
-
value: a
|
|
412
|
-
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
413
|
-
}
|
|
414
|
-
function f(e, n, i, o, s, u) {
|
|
415
|
-
var f = n.children;
|
|
416
|
-
if (f !== void 0) if (o) if (M(f)) {
|
|
417
|
-
for (o = 0; o < f.length; o++) p(f[o]);
|
|
418
|
-
Object.freeze && Object.freeze(f);
|
|
419
|
-
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
420
|
-
else p(f);
|
|
421
|
-
if (j.call(n, "key")) {
|
|
422
|
-
f = t(e);
|
|
423
|
-
var m = Object.keys(n).filter(function(e) {
|
|
424
|
-
return e !== "key";
|
|
425
|
-
});
|
|
426
|
-
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[f + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, f, m, f), R[f + o] = !0);
|
|
427
|
-
}
|
|
428
|
-
if (f = null, i !== void 0 && (r(i), f = "" + i), c(n) && (r(n.key), f = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
|
|
429
|
-
else i = n;
|
|
430
|
-
return f && l(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, i, a(), s, u);
|
|
431
|
-
}
|
|
432
|
-
function p(e) {
|
|
433
|
-
m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
434
|
-
}
|
|
435
|
-
function m(e) {
|
|
436
|
-
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
437
|
-
}
|
|
438
|
-
var h = o("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
439
|
-
return null;
|
|
440
|
-
};
|
|
441
|
-
h = { react_stack_bottom_frame: function(e) {
|
|
442
|
-
return e();
|
|
443
|
-
} };
|
|
444
|
-
var P, F = {}, I = h.react_stack_bottom_frame.bind(h, s)(), L = N(i(s)), R = {};
|
|
445
|
-
e.Fragment = v, e.jsx = function(e, t, n) {
|
|
446
|
-
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
447
|
-
return f(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
|
|
448
|
-
}, e.jsxs = function(e, t, n) {
|
|
449
|
-
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
450
|
-
return f(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
|
|
451
|
-
};
|
|
452
|
-
})();
|
|
453
|
-
})), h = (/* @__PURE__ */ a(((e, t) => {
|
|
454
|
-
process.env.NODE_ENV === "production" ? t.exports = p() : t.exports = m();
|
|
455
|
-
})))();
|
|
456
|
-
function g({ label: a = "Menu", triggerContent: o, triggerAriaLabel: s, menuAlign: c = "start", items: p = [], className: m = "", triggerClassName: g = "", menuClassName: _ = "", itemClassName: v = "", dividerClassName: y = "", id: b, onItemSelect: x, ...S }) {
|
|
457
|
-
let [C, w] = i(!1), T = r(null), E = r(null), D = r(null), O = t(), k = b ?? `nabs-ui-dropdownmenu-${O.replace(/:/g, "")}`, A = ["nabs-ui-dropdownmenu", m].filter(Boolean).join(" "), j = ["nabs-ui-dropdownmenu__trigger", g].filter(Boolean).join(" "), M = ["nabs-ui-dropdownmenu__menu", _].filter(Boolean).join(" "), N = ["nabs-ui-dropdownmenu__item", v].filter(Boolean).join(" "), P = ["nabs-ui-dropdownmenu__divider", y].filter(Boolean).join(" ");
|
|
15
|
+
//#region src/DropdownMenu.tsx
|
|
16
|
+
function f({ label: f = "Menu", triggerContent: p, triggerAriaLabel: m, menuAlign: h = "start", items: g = [], className: _ = "", triggerClassName: v = "", menuClassName: y = "", itemClassName: b = "", dividerClassName: x = "", id: S, onItemSelect: C, ...w }) {
|
|
17
|
+
let [T, E] = i(!1), D = r(null), O = r(null), k = r(null), A = t(), j = S ?? `nabs-ui-dropdownmenu-${A.replace(/:/g, "")}`, M = ["nabs-ui-dropdownmenu", _].filter(Boolean).join(" "), N = ["nabs-ui-dropdownmenu__trigger", v].filter(Boolean).join(" "), P = ["nabs-ui-dropdownmenu__menu", y].filter(Boolean).join(" "), F = ["nabs-ui-dropdownmenu__item", b].filter(Boolean).join(" "), I = ["nabs-ui-dropdownmenu__divider", x].filter(Boolean).join(" ");
|
|
458
18
|
e(() => {
|
|
459
19
|
let e = (e) => {
|
|
460
|
-
e.target instanceof Node &&
|
|
20
|
+
e.target instanceof Node && D.current && !D.current.contains(e.target) && k.current && !k.current.contains(e.target) && E(!1);
|
|
461
21
|
}, t = (e) => {
|
|
462
|
-
e.key === "Escape" &&
|
|
22
|
+
e.key === "Escape" && E(!1);
|
|
463
23
|
};
|
|
464
24
|
return document.addEventListener("pointerdown", e), document.addEventListener("keydown", t), () => {
|
|
465
25
|
document.removeEventListener("pointerdown", e), document.removeEventListener("keydown", t);
|
|
466
26
|
};
|
|
467
27
|
}, []), n(() => {
|
|
468
|
-
if (!
|
|
28
|
+
if (!T || !O.current) return;
|
|
469
29
|
let e = () => {
|
|
470
|
-
let e =
|
|
30
|
+
let e = O.current?.getBoundingClientRect(), t = k.current?.getBoundingClientRect(), n = k.current;
|
|
471
31
|
if (!e || !t || !n) return;
|
|
472
|
-
let r = Math.max(e.width, t.width), i = window.innerWidth - r - 8, a =
|
|
32
|
+
let r = Math.max(e.width, t.width), i = window.innerWidth - r - 8, a = h === "end" ? e.right - r : e.left, o = Math.max(8, Math.min(a, i)), s = Math.max(8, e.bottom + 10);
|
|
473
33
|
n.style.position = "fixed", n.style.top = `${s}px`, n.style.left = `${o}px`, n.style.right = "auto", n.style.minWidth = `${r}px`, n.style.visibility = "visible";
|
|
474
34
|
};
|
|
475
|
-
return
|
|
35
|
+
return k.current && (k.current.style.visibility = "hidden"), e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
476
36
|
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
477
37
|
};
|
|
478
|
-
}, [
|
|
479
|
-
let
|
|
480
|
-
if (
|
|
38
|
+
}, [h, T]);
|
|
39
|
+
let L = (e, t) => {
|
|
40
|
+
if (E(!1), e.disabled) {
|
|
481
41
|
t.preventDefault();
|
|
482
42
|
return;
|
|
483
43
|
}
|
|
484
|
-
|
|
44
|
+
C?.(e, t), e.onSelect?.(e, t);
|
|
485
45
|
};
|
|
486
|
-
return /* @__PURE__ */ (
|
|
487
|
-
ref:
|
|
488
|
-
className:
|
|
489
|
-
...
|
|
490
|
-
children: [/* @__PURE__ */ (
|
|
491
|
-
ref:
|
|
46
|
+
return /* @__PURE__ */ c("div", {
|
|
47
|
+
ref: D,
|
|
48
|
+
className: M,
|
|
49
|
+
...w,
|
|
50
|
+
children: [/* @__PURE__ */ s("button", {
|
|
51
|
+
ref: O,
|
|
492
52
|
type: "button",
|
|
493
|
-
className:
|
|
53
|
+
className: N,
|
|
494
54
|
"aria-haspopup": "menu",
|
|
495
|
-
"aria-controls":
|
|
496
|
-
"aria-label":
|
|
497
|
-
onClick: () =>
|
|
498
|
-
children:
|
|
55
|
+
"aria-controls": j,
|
|
56
|
+
"aria-label": m ?? f,
|
|
57
|
+
onClick: () => E((e) => !e),
|
|
58
|
+
children: p ?? /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("span", {
|
|
499
59
|
className: "nabs-ui-dropdownmenu__triggerLabel",
|
|
500
|
-
children:
|
|
501
|
-
}), /* @__PURE__ */ (
|
|
60
|
+
children: f
|
|
61
|
+
}), /* @__PURE__ */ s("span", {
|
|
502
62
|
className: "nabs-ui-dropdownmenu__triggerChevron",
|
|
503
63
|
"aria-hidden": "true",
|
|
504
64
|
children: "▾"
|
|
505
65
|
})] })
|
|
506
|
-
}),
|
|
507
|
-
ref:
|
|
508
|
-
id:
|
|
509
|
-
className:
|
|
510
|
-
"aria-label":
|
|
511
|
-
children:
|
|
512
|
-
if (
|
|
513
|
-
className:
|
|
66
|
+
}), T && typeof document < "u" ? a(/* @__PURE__ */ s("div", {
|
|
67
|
+
ref: k,
|
|
68
|
+
id: j,
|
|
69
|
+
className: P,
|
|
70
|
+
"aria-label": f,
|
|
71
|
+
children: g.map((e, t) => {
|
|
72
|
+
if (l(e)) return /* @__PURE__ */ s("div", {
|
|
73
|
+
className: I,
|
|
514
74
|
role: "separator",
|
|
515
75
|
"aria-hidden": "true"
|
|
516
76
|
}, `divider-${t}`);
|
|
517
|
-
let n =
|
|
518
|
-
|
|
77
|
+
let n = u(e), r = [
|
|
78
|
+
F,
|
|
519
79
|
e.disabled ? "nabs-ui-dropdownmenu__item--disabled" : "",
|
|
520
80
|
e.danger ? "nabs-ui-dropdownmenu__item--danger" : ""
|
|
521
81
|
].filter(Boolean).join(" "), i = {
|
|
522
82
|
className: r,
|
|
523
83
|
"aria-disabled": e.disabled || void 0
|
|
524
84
|
};
|
|
525
|
-
return e.href ? /* @__PURE__ */ (
|
|
85
|
+
return e.href ? /* @__PURE__ */ c("a", {
|
|
526
86
|
...i,
|
|
527
87
|
href: e.disabled ? void 0 : e.href,
|
|
528
|
-
onClick: (t) =>
|
|
529
|
-
children: [/* @__PURE__ */ (
|
|
88
|
+
onClick: (t) => L(e, t),
|
|
89
|
+
children: [/* @__PURE__ */ s("span", {
|
|
530
90
|
className: "nabs-ui-dropdownmenu__itemLabel",
|
|
531
91
|
children: n
|
|
532
|
-
}), e.description ? /* @__PURE__ */ (
|
|
92
|
+
}), e.description ? /* @__PURE__ */ s("span", {
|
|
533
93
|
className: "nabs-ui-dropdownmenu__itemDescription",
|
|
534
94
|
children: e.description
|
|
535
95
|
}) : null]
|
|
536
|
-
},
|
|
96
|
+
}, d(e, t)) : /* @__PURE__ */ c("button", {
|
|
537
97
|
type: "button",
|
|
538
98
|
className: r,
|
|
539
99
|
disabled: e.disabled,
|
|
540
|
-
onClick: (t) =>
|
|
541
|
-
children: [/* @__PURE__ */ (
|
|
100
|
+
onClick: (t) => L(e, t),
|
|
101
|
+
children: [/* @__PURE__ */ s("span", {
|
|
542
102
|
className: "nabs-ui-dropdownmenu__itemLabel",
|
|
543
103
|
children: n
|
|
544
|
-
}), e.description ? /* @__PURE__ */ (
|
|
104
|
+
}), e.description ? /* @__PURE__ */ s("span", {
|
|
545
105
|
className: "nabs-ui-dropdownmenu__itemDescription",
|
|
546
106
|
children: e.description
|
|
547
107
|
}) : null]
|
|
548
|
-
},
|
|
108
|
+
}, d(e, t));
|
|
549
109
|
})
|
|
550
110
|
}), document.body) : null]
|
|
551
111
|
});
|
|
552
112
|
}
|
|
553
113
|
//#endregion
|
|
554
|
-
export {
|
|
114
|
+
export { f as DropdownMenu };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@net-advantage/nabs-ui-dropdownmenu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "Reusable dropdown menu control for the Nabs UI library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/nabs-ui-dropdownmenu.cjs",
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
"react": "^19.0.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
+
"@types/react": "^19.0.0",
|
|
24
|
+
"@types/react-dom": "^19.0.0",
|
|
23
25
|
"@vitejs/plugin-react": "^6.0.1",
|
|
24
26
|
"react-dom": "^19.2.6",
|
|
25
27
|
"vite": "^8.0.12"
|