neatkit 0.16.5 → 0.16.7

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.
Files changed (44) hide show
  1. package/dist/{Button-ZzJbnjNg.js → Button-Dsr1zrKT.js} +1 -1
  2. package/dist/{Button-CYFy6sTv.cjs → Button-DyO8fkk1.cjs} +1 -1
  3. package/dist/Button.cjs +1 -1
  4. package/dist/Button.js +1 -1
  5. package/dist/Checkbox.cjs +1 -1
  6. package/dist/Checkbox.js +1 -1
  7. package/dist/{Icon-BHNINDhB.js → Icon-B9-_-fzr.js} +25 -16
  8. package/dist/{Icon-De6sqmQ9.cjs → Icon-Yl22zVSN.cjs} +1 -1
  9. package/dist/Icon.cjs +1 -1
  10. package/dist/Icon.js +1 -1
  11. package/dist/Input.cjs +1 -1
  12. package/dist/Input.js +1 -1
  13. package/dist/Markdown.cjs +1 -1
  14. package/dist/Markdown.js +7 -2
  15. package/dist/Modal.cjs +1 -1
  16. package/dist/Modal.js +26 -26
  17. package/dist/Popover.cjs +1 -1
  18. package/dist/Popover.js +81 -82
  19. package/dist/Select.cjs +1 -1
  20. package/dist/Select.js +280 -283
  21. package/dist/Sidebar.cjs +1 -1
  22. package/dist/Sidebar.js +21 -21
  23. package/dist/{Table-WlCsBVHC.js → Table-CURYs469.js} +2 -2
  24. package/dist/{Table-DEjAMnG3.cjs → Table-DTxKbMgJ.cjs} +1 -1
  25. package/dist/Table.cjs +1 -1
  26. package/dist/Table.js +1 -1
  27. package/dist/{Tooltip-4RWCnb2Q.js → Tooltip-BuRMZ4p_.js} +35 -35
  28. package/dist/{Tooltip-B2rZmRCs.cjs → Tooltip-tzVg8Bky.cjs} +1 -1
  29. package/dist/Tooltip.cjs +1 -1
  30. package/dist/Tooltip.js +1 -1
  31. package/dist/components/Markdown/utils/security.d.ts +2 -2
  32. package/dist/components/Popover/Popover.d.ts +10 -8
  33. package/dist/components/Portal/hooks/useDismissableLayer.d.ts +7 -4
  34. package/dist/components/Select/components/CustomSelect.d.ts +5 -4
  35. package/dist/components/Select/components/SelectListbox.d.ts +2 -4
  36. package/dist/components/Sidebar/Sidebar.d.ts +1 -1
  37. package/dist/style.css +1 -1
  38. package/dist/{useFocusTrap-BxPazAL6.js → useFocusTrap-BL3fDmTs.js} +1 -1
  39. package/dist/{useFocusTrap-CrMcAu8s.cjs → useFocusTrap-C--8mnsI.cjs} +1 -1
  40. package/dist/usePresence-BYnWctTh.js +232 -0
  41. package/dist/usePresence-HVr855AK.cjs +1 -0
  42. package/package.json +1 -1
  43. package/dist/usePresence-BTRY1_l-.js +0 -212
  44. package/dist/usePresence-Dm0mls5p.cjs +0 -1
package/dist/Sidebar.cjs CHANGED
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),t=require("react"),R=require("./effects-D98vUn6N.cjs"),U=require("./reference-C2guRuR0.cjs"),T=require("./usePresence-Dm0mls5p.cjs"),z=require("./Button-CYFy6sTv.cjs"),G=require("./Text-DWYlIcPj.cjs"),ie=require("./useFocusTrap-CrMcAu8s.cjs"),oe=require("./useScrollLock-Dy8MZaSn.cjs"),le=require("./aria-DM-xYEHQ.cjs"),ce=require("./useFloatingPosition-DPVO2E8O.cjs"),de=require("./Avatar-Belo7qAY.cjs"),H=require("./Skeleton-CBS-MN5x.cjs"),ue=require("./Tooltip-B2rZmRCs.cjs"),fe=require("./units-CUnzOlBy.cjs");function be(s){const{label:n,onToggle:e,panelId:r,reference:b,side:d,sidebarOpen:l}=s;return o.jsx(z.Button,{ref:b,"aria-controls":r,"aria-expanded":l,"aria-haspopup":"dialog","aria-label":n,className:"nk-sidebar__fallback-trigger","data-side":d,icon:"burger",variant:"secondary",size:"large",onClick:e})}const q=new WeakMap;function W(s){const n=q.get(s);if(n)return n;const e={listeners:new Set,owner:null,state:void 0};return q.set(s,e),e}function pe(s,n,e){const r=W(s);return r.owner!==null&&r.owner!==n?!1:(r.owner=n,r.state=e,r.listeners.forEach(b=>b()),!0)}function he(s,n){const e=q.get(s);!e||e.owner!==n||(e.owner=null,e.state=void 0,e.listeners.forEach(r=>r()))}function ge(s){var n;return s?(n=q.get(s))==null?void 0:n.state:void 0}function me(s,n){if(!s)return()=>{};const e=W(s);return e.listeners.add(n),()=>{e.listeners.delete(n)}}const ve=()=>{};function F(s){const n=R.useBoundary(s).boundaryElement,e=t.useCallback(b=>me(n,b),[n]),r=t.useCallback(()=>ge(n),[n]);return t.useSyncExternalStore(e,r,ve)}function D(s,n){return s==="both"||s===(n==="overlay"?"overlay":"inline")}const ee=t.forwardRef(function(n,e){const{children:r,className:b,presentation:d="both",...l}=n,i=F("Sidebar.Footer");return D(d,i==null?void 0:i.presentation)?o.jsx("div",{...l,ref:e,className:["nk-sidebar__footer",b].filter(Boolean).join(" "),children:r}):null}),ye=t.forwardRef(function(n,e){const{"aria-label":r,"aria-labelledby":b,children:d,className:l,label:i,presentation:S="both",...p}=n,y=F("Sidebar.Group"),c=`${t.useId()}-label`,h=i!=null&&typeof i!="boolean"&&(typeof i!="string"||i.trim()!=="");if(!D(S,y==null?void 0:y.presentation))return null;const u=b??(r===void 0&&h?c:void 0),a=!!(r??u);return t.createElement(a?"nav":"div",{...p,ref:e,"aria-label":r,"aria-labelledby":u,className:["nk-sidebar__group",l].filter(Boolean).join(" ")},h?o.jsx(G.Text,{as:"h2",className:"nk-sidebar__group-label",id:c,size:"subtitle",weight:"medium",children:i}):null,o.jsx("ul",{className:"nk-sidebar__list",children:d}))}),Se=t.forwardRef(function(n,e){const{children:r,className:b,presentation:d="both",...l}=n,i=F("Sidebar.Header");return D(d,i==null?void 0:i.presentation)?o.jsx("div",{...l,ref:e,className:["nk-sidebar__header",b].filter(Boolean).join(" "),children:r}):null}),ke=t.forwardRef(function(n,e){const{active:r=!1,as:b,children:d,className:l,disabled:i=!1,icon:S,onClick:p,presentation:y="both",type:c,...h}=n,u=F("Sidebar.Item"),a=b??"button",f=a==="button",m=h,E=m.href!==void 0||m.to!==void 0;function v(k){if(i){k.preventDefault();return}p==null||p(k),u!=null&&u.open&&u.presentation==="overlay"&&!k.defaultPrevented&&u.requestOpenChange(!1,"item")}return D(y,u==null?void 0:u.presentation)?o.jsx("li",{className:"nk-sidebar__item-container",children:o.jsx(z.Button,{...h,ref:e,"aria-current":r?E?"page":"true":void 0,as:a,className:["nk-sidebar__item",l].filter(Boolean).join(" "),"data-active":r||void 0,disabled:i,fullWidth:!0,href:m.href,icon:S,onClick:v,shape:"rectangle",size:"small",textAlignment:"left",type:f?c??"button":c,variant:"ghost",children:o.jsx("span",{className:"nk-sidebar__item-label",children:d})})}):null}),xe=1;function Ee(s){return s==null?void 0:s.ResizeObserver}function _e(s){return s==null?void 0:s.MutationObserver}function Ce(){const[s,n]=t.useState(!1),e=t.useRef(null),r=t.useCallback(l=>{const i=l.scrollHeight-l.scrollTop-l.clientHeight;n(i>xe)},[]),b=t.useCallback(l=>{var m;if((m=e.current)==null||m.call(e),e.current=null,!l)return;const i=l;r(i);function S(){r(i)}const p=i.ownerDocument.defaultView;p==null||p.addEventListener("resize",S);const y=Ee(p),c=y?new y(S):void 0;function h(){c==null||c.disconnect(),c==null||c.observe(i);for(const E of i.children)c==null||c.observe(E)}h();function u(E){E.some(k=>k.type==="childList")&&h(),S()}const a=_e(p),f=a?new a(u):void 0;f==null||f.observe(i,{attributeFilter:["class","hidden","style"],characterData:!0,childList:!0,subtree:!0}),e.current=()=>{p==null||p.removeEventListener("resize",S),c==null||c.disconnect(),f==null||f.disconnect()}},[r]),d=t.useCallback(l=>{r(l.currentTarget)},[r]);return{containerReference:b,contentBelow:s,handleScroll:d}}function je(s,n){for(const e of t.Children.toArray(s)){if(t.isValidElement(e)&&e.type===t.Fragment){const r=ne(e.props.children);r.bodyChildren.length>0&&n.bodyChildren.push(t.cloneElement(e,void 0,...r.bodyChildren)),r.footerChildren.length>0&&n.footerChildren.push(t.cloneElement(e,void 0,...r.footerChildren));continue}t.isValidElement(e)&&e.type===ee?n.footerChildren.push(e):n.bodyChildren.push(e)}}function ne(s){const n={bodyChildren:[],footerChildren:[]};return je(s,n),n}function re(s){const{"aria-label":n,"aria-labelledby":e,children:r,className:b,height:d,open:l,panelId:i,panelReference:S,presentation:p,side:y,state:c,style:h,width:u,...a}=s,{containerReference:f,contentBelow:m,handleScroll:E}=Ce(),v=p==="overlay",{bodyChildren:k,footerChildren:I}=ne(r),B=n??(e===void 0?"Sidebar":void 0),P=v&&l;let j=h;return(u!==void 0||d!==void 0)&&(j={...h},d!==void 0&&(j["--nk-sidebar-height"]=d),u!==void 0&&(j["--nk-sidebar-width"]=u)),o.jsxs("aside",{...a,ref:S,"aria-hidden":v&&!l?!0:void 0,"aria-label":v&&!l?void 0:B,"aria-labelledby":v&&!l?void 0:e,"aria-modal":P?"true":void 0,className:["nk-sidebar",b].filter(Boolean).join(" "),"data-responsive":p==="pending"||void 0,"data-side":y,"data-state":c,"data-variant":v?"overlay":"inline",id:i,role:P?"dialog":void 0,style:j,tabIndex:v?-1:void 0,children:[o.jsx("div",{ref:f,className:"nk-sidebar__body","data-content-below":m||void 0,onScroll:E,children:k}),I]})}function Ne(s){const{boundaries:n,initialFocusReference:e,lockScroll:r,ownerDocument:b,panelReference:d,presenceState:l,restoreFocus:i,sidebar:S,side:p,...y}=s,{id:c,open:h,requestOpenChange:u}=S,a=t.useContext(T.FocusScopeContext),f=t.useRef(null),[m,E]=t.useState(null),v=R.useBoundary("Sidebar").boundaryElement,k=T.useOverlayLayer(!0,v),I=t.useCallback(L=>{f.current=L,d(L),E(L)},[d]);R.useIsomorphicLayoutEffect(()=>{m&&(m.inert=!h)},[h,m]);const B=t.useCallback(()=>{u(!1,"escape")},[u]),P=t.useCallback(()=>{u(!1,"outside")},[u]);T.useDismissableLayer({boundary:v,active:h,boundaries:n,dismissOnEscape:!0,dismissOnPointerDownOutside:!0,layerId:k.id,onEscapeDismiss:B,onPointerDownOutsideDismiss:P,ownerDocument:b});const j=ie.useFocusTrap({boundary:v,active:h,container:m,initialFocusReference:e??f,layerId:k.id,restoreFocus:i});return oe.useScrollLock(r&&h,b,v),o.jsx(T.FocusScopeContext.Provider,{value:h?j:a,children:o.jsx("div",{className:"nk-sidebar__overlay","data-side":p,"data-state":l,role:"presentation",style:{zIndex:k.zIndex},children:o.jsx(re,{...y,open:h,panelId:c,panelReference:I,presentation:"overlay",side:p,state:l})})})}function Re(s){const{children:n}=s;if(n.type===t.Fragment)throw new Error("Sidebar.Trigger requires a single non-Fragment child");const e=F("Sidebar.Trigger"),r=n.props,b=U.getElementReference(n),d=e==null?void 0:e.registerTrigger,l=e==null?void 0:e.unregisterTrigger,i=t.useRef(null),S=t.useCallback(f=>{const m=i.current;m&&m!==f&&(l==null||l(m)),i.current=f,f&&(d==null||d(f)),U.assignElementReference(b,f)},[b,d,l]),p=t.useCallback(f=>{f.defaultPrevented||!e||e.requestOpenChange(!e.open,"trigger")},[e]);if(!e)return null;const{id:y,open:c,presentation:h,variant:u}=e,a=c&&h==="overlay";return t.cloneElement(n,ce.resolveTriggerOverrides(r,{"aria-controls":a?le.mergeIdentifiers(r["aria-controls"],y):r["aria-controls"],"aria-expanded":c,"aria-haspopup":r["aria-haspopup"]??"dialog",className:"nk-sidebar__trigger","data-sidebar-variant":u,onClick:p,ref:S}))}const Te=t.forwardRef(function(n,e){const{actions:r,className:b,description:d,image:l,loading:i=!1,name:S,onClick:p,...y}=n,c=d!=null&&typeof d!="boolean";if(i)return o.jsx("div",{...y,ref:e,className:["nk-sidebar__user",b].filter(Boolean).join(" "),children:o.jsxs("div",{"aria-label":"Loading user",className:"nk-sidebar__user-details",role:"status",children:[o.jsx(H.Skeleton,{className:"nk-sidebar__user-avatar",height:"var(--nk-space-32)",shape:"ellipse",width:"var(--nk-space-32)"}),o.jsxs("div",{className:"nk-sidebar__user-text",style:{gap:"var(--nk-space-8)"},children:[o.jsx(H.Skeleton,{height:"var(--nk-space-16)",width:"70%"}),c?o.jsx(H.Skeleton,{height:"var(--nk-space-12)",width:"50%"}):null]})]})});const h=o.jsxs(o.Fragment,{children:[o.jsx(de.Avatar,{alt:S,"aria-hidden":!0,className:"nk-sidebar__user-avatar",image:l}),o.jsxs("span",{className:"nk-sidebar__user-text",children:[o.jsx(G.Text,{as:"span",className:"nk-sidebar__user-name",children:S}),c?o.jsx(G.Text,{as:"span",className:"nk-sidebar__user-description",size:"caption",tone:"muted",children:d}):null]})]});return o.jsxs("div",{...y,ref:e,className:["nk-sidebar__user",b].filter(Boolean).join(" "),children:[p?o.jsx("button",{className:"nk-sidebar__user-details",onClick:p,type:"button",children:h}):o.jsx("div",{className:"nk-sidebar__user-details",children:h}),r!=null&&r.length?o.jsx("div",{className:"nk-sidebar__user-actions",children:r.map(({"aria-label":u,icon:a,label:f,...m})=>o.jsx(ue.Tooltip2,{content:f,children:o.jsx(z.Button,{...m,"aria-label":u??f,className:"nk-sidebar__user-action",icon:a,shape:"rectangle",type:"button",variant:"ghost"})},f))}):null]})}),Pe=()=>()=>{},Z=()=>{};function Ie(s,n){const e=s==="responsive"?n:void 0,r=t.useSyncExternalStore((e==null?void 0:e.subscribe)??Pe,(e==null?void 0:e.read)??Z,Z);return s!=="responsive"?s:r===void 0?"pending":r>=fe.breakpoint("medium")?"inline":"overlay"}const Be=32,Le=t.forwardRef(function(n,e){var X;const{defaultOpen:r=!1,height:b,initialFocusReference:d,lockScroll:l=!0,onOpenChange:i,open:S,restoreFocus:p=!0,side:y="left",variant:c="responsive",width:h,...u}=n,a=R.useBoundary("Sidebar"),f=`${t.useId()}-sidebar`,m=t.useRef(Symbol("nk-sidebar")).current,E=t.useRef(null),v=Ie(c,a==null?void 0:a.width),k=S!==void 0,[I,B]=t.useState(r),[P,j]=t.useState(0),[L,te]=t.useState(!1),V=t.useRef(null),N=k?S:I,w=t.useRef(i);R.useIsomorphicLayoutEffect(()=>{w.current=i});const O=t.useCallback((g,x)=>{var _;N!==g&&(k||B(g),(_=w.current)==null||_.call(w,g,x))},[k,N]),$=t.useCallback(g=>{E.current=g,U.assignElementReference(e,g)},[e]),C=t.useMemo(()=>[E],[]),K=t.useCallback(g=>{C.push({current:g}),j(x=>x+1)},[C]),Y=t.useCallback(g=>{const x=C.findIndex(_=>_.current===g);x>0&&C.splice(x,1),j(_=>Math.max(_-1,0))},[C]),se=t.useCallback(g=>{const x=V.current;if(x&&x!==g){const _=C.findIndex(ae=>ae.current===x);_>0&&C.splice(_,1)}V.current=g,g&&C.push({current:g})},[C]),A=t.useMemo(()=>({id:f,open:N,presentation:v,registerTrigger:K,requestOpenChange:O,unregisterTrigger:Y,variant:c}),[N,f,v,K,O,Y,c]);R.useIsomorphicLayoutEffect(()=>{const g=a==null?void 0:a.boundaryElement;if(!g)return;if(pe(g,m,A)===!1)throw new Error("A Boundary supports one Sidebar. Neatkit resolves Trigger, Group, and Item interactions against the single Sidebar published to the nearest Boundary, so give each Sidebar a Boundary of its own.")},[a==null?void 0:a.boundaryElement,m,A]),R.useIsomorphicLayoutEffect(()=>{const g=a==null?void 0:a.boundaryElement;if(g)return()=>he(g,m)},[a==null?void 0:a.boundaryElement,m]),t.useEffect(()=>{v==="inline"&&O(!1,"variant")},[v,O]),t.useEffect(()=>{var _;const g=(_=a==null?void 0:a.boundaryElement)==null?void 0:_.ownerDocument.defaultView;if(!g)return;const x=g.setTimeout(()=>te(!0),Be);return()=>g.clearTimeout(x)},[a==null?void 0:a.boundaryElement]);const M=T.usePresence(N&&v==="overlay"),J=((X=a==null?void 0:a.boundaryElement)==null?void 0:X.ownerDocument)??(typeof document>"u"?null:document);if(v!=="overlay")return o.jsx(re,{...u,height:b,open:!1,panelId:f,panelReference:$,presentation:v,side:y,width:h});const Q=L&&P===0?o.jsx(T.Portal,{children:o.jsx(be,{label:`Open ${u["aria-label"]??"Sidebar"}`,onToggle:()=>O(!N,"trigger"),panelId:M.present?f:void 0,reference:se,side:y,sidebarOpen:N})}):null;return!M.present||!J?Q:o.jsxs(o.Fragment,{children:[Q,o.jsx(T.Portal,{children:o.jsx(Ne,{...u,boundaries:C,initialFocusReference:d,lockScroll:l,ownerDocument:J,panelReference:$,presenceState:M.state==="closing"?"closing":"open",restoreFocus:p,side:y,sidebar:A,width:h})})]})}),Oe=Object.assign(Le,{Footer:ee,Group:ye,Header:Se,Item:ke,Trigger:Re,User:Te});exports.default=Oe;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),t=require("react"),R=require("./effects-D98vUn6N.cjs"),U=require("./reference-C2guRuR0.cjs"),T=require("./usePresence-HVr855AK.cjs"),z=require("./Button-DyO8fkk1.cjs"),G=require("./Text-DWYlIcPj.cjs"),ie=require("./useFocusTrap-C--8mnsI.cjs"),oe=require("./useScrollLock-Dy8MZaSn.cjs"),le=require("./aria-DM-xYEHQ.cjs"),ce=require("./useFloatingPosition-DPVO2E8O.cjs"),de=require("./Avatar-Belo7qAY.cjs"),H=require("./Skeleton-CBS-MN5x.cjs"),ue=require("./Tooltip-tzVg8Bky.cjs"),fe=require("./units-CUnzOlBy.cjs");function be(s){const{label:n,onToggle:e,panelId:r,reference:b,side:d,sidebarOpen:l}=s;return o.jsx(z.Button,{ref:b,"aria-controls":r,"aria-expanded":l,"aria-haspopup":"dialog","aria-label":n,className:"nk-sidebar__fallback-trigger","data-side":d,icon:"burger",variant:"secondary",size:"large",onClick:e})}const q=new WeakMap;function W(s){const n=q.get(s);if(n)return n;const e={listeners:new Set,owner:null,state:void 0};return q.set(s,e),e}function pe(s,n,e){const r=W(s);return r.owner!==null&&r.owner!==n?!1:(r.owner=n,r.state=e,r.listeners.forEach(b=>b()),!0)}function he(s,n){const e=q.get(s);!e||e.owner!==n||(e.owner=null,e.state=void 0,e.listeners.forEach(r=>r()))}function ge(s){var n;return s?(n=q.get(s))==null?void 0:n.state:void 0}function me(s,n){if(!s)return()=>{};const e=W(s);return e.listeners.add(n),()=>{e.listeners.delete(n)}}const ve=()=>{};function F(s){const n=R.useBoundary(s).boundaryElement,e=t.useCallback(b=>me(n,b),[n]),r=t.useCallback(()=>ge(n),[n]);return t.useSyncExternalStore(e,r,ve)}function D(s,n){return s==="both"||s===(n==="overlay"?"overlay":"inline")}const ee=t.forwardRef(function(n,e){const{children:r,className:b,presentation:d="both",...l}=n,i=F("Sidebar.Footer");return D(d,i==null?void 0:i.presentation)?o.jsx("div",{...l,ref:e,className:["nk-sidebar__footer",b].filter(Boolean).join(" "),children:r}):null}),ye=t.forwardRef(function(n,e){const{"aria-label":r,"aria-labelledby":b,children:d,className:l,label:i,presentation:S="both",...p}=n,y=F("Sidebar.Group"),c=`${t.useId()}-label`,h=i!=null&&typeof i!="boolean"&&(typeof i!="string"||i.trim()!=="");if(!D(S,y==null?void 0:y.presentation))return null;const u=b??(r===void 0&&h?c:void 0),a=!!(r??u);return t.createElement(a?"nav":"div",{...p,ref:e,"aria-label":r,"aria-labelledby":u,className:["nk-sidebar__group",l].filter(Boolean).join(" ")},h?o.jsx(G.Text,{as:"h2",className:"nk-sidebar__group-label",id:c,size:"subtitle",weight:"medium",children:i}):null,o.jsx("ul",{className:"nk-sidebar__list",children:d}))}),Se=t.forwardRef(function(n,e){const{children:r,className:b,presentation:d="both",...l}=n,i=F("Sidebar.Header");return D(d,i==null?void 0:i.presentation)?o.jsx("div",{...l,ref:e,className:["nk-sidebar__header",b].filter(Boolean).join(" "),children:r}):null}),ke=t.forwardRef(function(n,e){const{active:r=!1,as:b,children:d,className:l,disabled:i=!1,icon:S,onClick:p,presentation:y="both",type:c,...h}=n,u=F("Sidebar.Item"),a=b??"button",f=a==="button",m=h,E=m.href!==void 0||m.to!==void 0;function v(k){if(i){k.preventDefault();return}p==null||p(k),u!=null&&u.open&&u.presentation==="overlay"&&!k.defaultPrevented&&u.requestOpenChange(!1,"item")}return D(y,u==null?void 0:u.presentation)?o.jsx("li",{className:"nk-sidebar__item-container",children:o.jsx(z.Button,{...h,ref:e,"aria-current":r?E?"page":"true":void 0,as:a,className:["nk-sidebar__item",l].filter(Boolean).join(" "),"data-active":r||void 0,disabled:i,fullWidth:!0,href:m.href,icon:S,onClick:v,shape:"rectangle",size:"small",textAlignment:"left",type:f?c??"button":c,variant:"ghost",children:o.jsx("span",{className:"nk-sidebar__item-label",children:d})})}):null}),xe=1;function Ee(s){return s==null?void 0:s.ResizeObserver}function _e(s){return s==null?void 0:s.MutationObserver}function Ce(){const[s,n]=t.useState(!1),e=t.useRef(null),r=t.useCallback(l=>{const i=l.scrollHeight-l.scrollTop-l.clientHeight;n(i>xe)},[]),b=t.useCallback(l=>{var m;if((m=e.current)==null||m.call(e),e.current=null,!l)return;const i=l;r(i);function S(){r(i)}const p=i.ownerDocument.defaultView;p==null||p.addEventListener("resize",S);const y=Ee(p),c=y?new y(S):void 0;function h(){c==null||c.disconnect(),c==null||c.observe(i);for(const E of i.children)c==null||c.observe(E)}h();function u(E){E.some(k=>k.type==="childList")&&h(),S()}const a=_e(p),f=a?new a(u):void 0;f==null||f.observe(i,{attributeFilter:["class","hidden","style"],characterData:!0,childList:!0,subtree:!0}),e.current=()=>{p==null||p.removeEventListener("resize",S),c==null||c.disconnect(),f==null||f.disconnect()}},[r]),d=t.useCallback(l=>{r(l.currentTarget)},[r]);return{containerReference:b,contentBelow:s,handleScroll:d}}function je(s,n){for(const e of t.Children.toArray(s)){if(t.isValidElement(e)&&e.type===t.Fragment){const r=ne(e.props.children);r.bodyChildren.length>0&&n.bodyChildren.push(t.cloneElement(e,void 0,...r.bodyChildren)),r.footerChildren.length>0&&n.footerChildren.push(t.cloneElement(e,void 0,...r.footerChildren));continue}t.isValidElement(e)&&e.type===ee?n.footerChildren.push(e):n.bodyChildren.push(e)}}function ne(s){const n={bodyChildren:[],footerChildren:[]};return je(s,n),n}function re(s){const{"aria-label":n,"aria-labelledby":e,children:r,className:b,height:d,open:l,panelId:i,panelReference:S,presentation:p,side:y,state:c,style:h,width:u,...a}=s,{containerReference:f,contentBelow:m,handleScroll:E}=Ce(),v=p==="overlay",{bodyChildren:k,footerChildren:P}=ne(r),B=n??(e===void 0?"Sidebar":void 0),I=v&&l;let j=h;return(u!==void 0||d!==void 0)&&(j={...h},d!==void 0&&(j["--nk-sidebar-height"]=d),u!==void 0&&(j["--nk-sidebar-width"]=u)),o.jsxs("aside",{...a,ref:S,"aria-hidden":v&&!l?!0:void 0,"aria-label":v&&!l?void 0:B,"aria-labelledby":v&&!l?void 0:e,"aria-modal":I?"true":void 0,className:["nk-sidebar",b].filter(Boolean).join(" "),"data-responsive":p==="pending"||void 0,"data-side":y,"data-state":c,"data-variant":v?"overlay":"inline",id:i,role:I?"dialog":void 0,style:j,tabIndex:v?-1:void 0,children:[o.jsx("div",{ref:f,className:"nk-sidebar__body","data-content-below":m||void 0,onScroll:E,children:k}),P]})}function Ne(s){const{boundaries:n,initialFocusReference:e,lockScroll:r,ownerDocument:b,panelReference:d,presenceState:l,restoreFocus:i,sidebar:S,side:p,...y}=s,{id:c,open:h,requestOpenChange:u}=S,a=t.useContext(T.FocusScopeContext),f=t.useRef(null),[m,E]=t.useState(null),v=R.useBoundary("Sidebar").boundaryElement,k=T.useOverlayLayer(!0,v),P=t.useCallback(L=>{f.current=L,d(L),E(L)},[d]);R.useIsomorphicLayoutEffect(()=>{m&&(m.inert=!h)},[h,m]);const B=t.useCallback(()=>{u(!1,"escape")},[u]),I=t.useCallback(()=>{u(!1,"outside")},[u]);T.useDismissableLayer({boundary:v,active:h,boundaries:n,dismissOnEscape:!0,dismissOnOutsideInteraction:"consume",layerId:k.id,onEscapeDismiss:B,onOutsideDismiss:I,ownerDocument:b});const j=ie.useFocusTrap({boundary:v,active:h,container:m,initialFocusReference:e??f,layerId:k.id,restoreFocus:i});return oe.useScrollLock(r&&h,b,v),o.jsx(T.FocusScopeContext.Provider,{value:h?j:a,children:o.jsx("div",{className:"nk-sidebar__overlay","data-side":p,"data-state":l,role:"presentation",style:{zIndex:k.zIndex},children:o.jsx(re,{...y,open:h,panelId:c,panelReference:P,presentation:"overlay",side:p,state:l})})})}function Re(s){const{children:n}=s;if(n.type===t.Fragment)throw new Error("Sidebar.Trigger requires a single non-Fragment child");const e=F("Sidebar.Trigger"),r=n.props,b=U.getElementReference(n),d=e==null?void 0:e.registerTrigger,l=e==null?void 0:e.unregisterTrigger,i=t.useRef(null),S=t.useCallback(f=>{const m=i.current;m&&m!==f&&(l==null||l(m)),i.current=f,f&&(d==null||d(f)),U.assignElementReference(b,f)},[b,d,l]),p=t.useCallback(f=>{f.defaultPrevented||!e||e.requestOpenChange(!e.open,"trigger")},[e]);if(!e)return null;const{id:y,open:c,presentation:h,variant:u}=e,a=c&&h==="overlay";return t.cloneElement(n,ce.resolveTriggerOverrides(r,{"aria-controls":a?le.mergeIdentifiers(r["aria-controls"],y):r["aria-controls"],"aria-expanded":c,"aria-haspopup":r["aria-haspopup"]??"dialog",className:"nk-sidebar__trigger","data-sidebar-variant":u,onClick:p,ref:S}))}const Te=t.forwardRef(function(n,e){const{actions:r,className:b,description:d,image:l,loading:i=!1,name:S,onClick:p,...y}=n,c=d!=null&&typeof d!="boolean";if(i)return o.jsx("div",{...y,ref:e,className:["nk-sidebar__user",b].filter(Boolean).join(" "),children:o.jsxs("div",{"aria-label":"Loading user",className:"nk-sidebar__user-details",role:"status",children:[o.jsx(H.Skeleton,{className:"nk-sidebar__user-avatar",height:"var(--nk-space-32)",shape:"ellipse",width:"var(--nk-space-32)"}),o.jsxs("div",{className:"nk-sidebar__user-text",style:{gap:"var(--nk-space-8)"},children:[o.jsx(H.Skeleton,{height:"var(--nk-space-16)",width:"70%"}),c?o.jsx(H.Skeleton,{height:"var(--nk-space-12)",width:"50%"}):null]})]})});const h=o.jsxs(o.Fragment,{children:[o.jsx(de.Avatar,{alt:S,"aria-hidden":!0,className:"nk-sidebar__user-avatar",image:l}),o.jsxs("span",{className:"nk-sidebar__user-text",children:[o.jsx(G.Text,{as:"span",className:"nk-sidebar__user-name",children:S}),c?o.jsx(G.Text,{as:"span",className:"nk-sidebar__user-description",size:"caption",tone:"muted",children:d}):null]})]});return o.jsxs("div",{...y,ref:e,className:["nk-sidebar__user",b].filter(Boolean).join(" "),children:[p?o.jsx("button",{className:"nk-sidebar__user-details",onClick:p,type:"button",children:h}):o.jsx("div",{className:"nk-sidebar__user-details",children:h}),r!=null&&r.length?o.jsx("div",{className:"nk-sidebar__user-actions",children:r.map(({"aria-label":u,icon:a,label:f,...m})=>o.jsx(ue.Tooltip2,{content:f,children:o.jsx(z.Button,{...m,"aria-label":u??f,className:"nk-sidebar__user-action",icon:a,shape:"rectangle",type:"button",variant:"ghost"})},f))}):null]})}),Ie=()=>()=>{},Z=()=>{};function Pe(s,n){const e=s==="responsive"?n:void 0,r=t.useSyncExternalStore((e==null?void 0:e.subscribe)??Ie,(e==null?void 0:e.read)??Z,Z);return s!=="responsive"?s:r===void 0?"pending":r>=fe.breakpoint("medium")?"inline":"overlay"}const Be=32,Le=t.forwardRef(function(n,e){var X;const{defaultOpen:r=!1,height:b,initialFocusReference:d,lockScroll:l=!0,onOpenChange:i,open:S,restoreFocus:p=!0,side:y="left",variant:c="responsive",width:h,...u}=n,a=R.useBoundary("Sidebar"),f=`${t.useId()}-sidebar`,m=t.useRef(Symbol("nk-sidebar")).current,E=t.useRef(null),v=Pe(c,a==null?void 0:a.width),k=S!==void 0,[P,B]=t.useState(r),[I,j]=t.useState(0),[L,te]=t.useState(!1),V=t.useRef(null),N=k?S:P,w=t.useRef(i);R.useIsomorphicLayoutEffect(()=>{w.current=i});const O=t.useCallback((g,x)=>{var _;N!==g&&(k||B(g),(_=w.current)==null||_.call(w,g,x))},[k,N]),$=t.useCallback(g=>{E.current=g,U.assignElementReference(e,g)},[e]),C=t.useMemo(()=>[E],[]),K=t.useCallback(g=>{C.push({current:g}),j(x=>x+1)},[C]),Y=t.useCallback(g=>{const x=C.findIndex(_=>_.current===g);x>0&&C.splice(x,1),j(_=>Math.max(_-1,0))},[C]),se=t.useCallback(g=>{const x=V.current;if(x&&x!==g){const _=C.findIndex(ae=>ae.current===x);_>0&&C.splice(_,1)}V.current=g,g&&C.push({current:g})},[C]),A=t.useMemo(()=>({id:f,open:N,presentation:v,registerTrigger:K,requestOpenChange:O,unregisterTrigger:Y,variant:c}),[N,f,v,K,O,Y,c]);R.useIsomorphicLayoutEffect(()=>{const g=a==null?void 0:a.boundaryElement;if(!g)return;if(pe(g,m,A)===!1)throw new Error("A Boundary supports one Sidebar. Neatkit resolves Trigger, Group, and Item interactions against the single Sidebar published to the nearest Boundary, so give each Sidebar a Boundary of its own.")},[a==null?void 0:a.boundaryElement,m,A]),R.useIsomorphicLayoutEffect(()=>{const g=a==null?void 0:a.boundaryElement;if(g)return()=>he(g,m)},[a==null?void 0:a.boundaryElement,m]),t.useEffect(()=>{v==="inline"&&O(!1,"variant")},[v,O]),t.useEffect(()=>{var _;const g=(_=a==null?void 0:a.boundaryElement)==null?void 0:_.ownerDocument.defaultView;if(!g)return;const x=g.setTimeout(()=>te(!0),Be);return()=>g.clearTimeout(x)},[a==null?void 0:a.boundaryElement]);const M=T.usePresence(N&&v==="overlay"),J=((X=a==null?void 0:a.boundaryElement)==null?void 0:X.ownerDocument)??(typeof document>"u"?null:document);if(v!=="overlay")return o.jsx(re,{...u,height:b,open:!1,panelId:f,panelReference:$,presentation:v,side:y,width:h});const Q=L&&I===0?o.jsx(T.Portal,{children:o.jsx(be,{label:`Open ${u["aria-label"]??"Sidebar"}`,onToggle:()=>O(!N,"trigger"),panelId:M.present?f:void 0,reference:se,side:y,sidebarOpen:N})}):null;return!M.present||!J?Q:o.jsxs(o.Fragment,{children:[Q,o.jsx(T.Portal,{children:o.jsx(Ne,{...u,boundaries:C,initialFocusReference:d,lockScroll:l,ownerDocument:J,panelReference:$,presenceState:M.state==="closing"?"closing":"open",restoreFocus:p,side:y,sidebar:A,width:h})})]})}),Oe=Object.assign(Le,{Footer:ee,Group:ye,Header:Se,Item:ke,Trigger:Re,User:Te});exports.default=Oe;
package/dist/Sidebar.js CHANGED
@@ -3,16 +3,16 @@ import { jsx as u, jsxs as I, Fragment as le } from "react/jsx-runtime";
3
3
  import { useCallback as _, useSyncExternalStore as ce, forwardRef as O, useId as de, createElement as Se, useState as w, useRef as L, Children as _e, isValidElement as re, Fragment as ue, cloneElement as $, useContext as ke, useMemo as te, useEffect as ae } from "react";
4
4
  import { u as K, a as M } from "./effects-DGbA6Q2O.js";
5
5
  import { g as Ee, a as fe } from "./reference-CXMr27nM.js";
6
- import { F as se, c as Ce, d as Ne, b as Pe, P as ie } from "./usePresence-BTRY1_l-.js";
7
- import { B as Y } from "./Button-ZzJbnjNg.js";
6
+ import { F as se, c as Ce, d as Ne, b as Te, P as ie } from "./usePresence-BYnWctTh.js";
7
+ import { B as Y } from "./Button-Dsr1zrKT.js";
8
8
  import { T as V } from "./Text-rN6iDo0V.js";
9
- import { u as Te } from "./useFocusTrap-BxPazAL6.js";
9
+ import { u as Pe } from "./useFocusTrap-BL3fDmTs.js";
10
10
  import { u as Ie } from "./useScrollLock-Drd7OZRC.js";
11
11
  import { m as Le } from "./aria-Bv-xVREf.js";
12
12
  import { r as Be } from "./useFloatingPosition-DktY7k-t.js";
13
13
  import { A as Oe } from "./Avatar-DjDCFqNG.js";
14
14
  import { S as z } from "./Skeleton-CEWiIR1S.js";
15
- import { T as Re } from "./Tooltip-4RWCnb2Q.js";
15
+ import { T as Re } from "./Tooltip-BuRMZ4p_.js";
16
16
  import { b as Fe } from "./units-nWP5zzIH.js";
17
17
  function xe(t) {
18
18
  const { label: n, onToggle: e, panelId: r, reference: f, side: l, sidebarOpen: i } = t;
@@ -272,8 +272,8 @@ function me(t) {
272
272
  width: c,
273
273
  ...s
274
274
  } = t, { containerReference: d, contentBelow: m, handleScroll: E } = Ve(), g = b === "overlay", { bodyChildren: S, footerChildren: R } = he(r), F = n ?? (e === void 0 ? "Sidebar" : void 0), B = g && i;
275
- let P = p;
276
- return (c !== void 0 || l !== void 0) && (P = { ...p }, l !== void 0 && (P["--nk-sidebar-height"] = l), c !== void 0 && (P["--nk-sidebar-width"] = c)), /* @__PURE__ */ I(
275
+ let T = p;
276
+ return (c !== void 0 || l !== void 0) && (T = { ...p }, l !== void 0 && (T["--nk-sidebar-height"] = l), c !== void 0 && (T["--nk-sidebar-width"] = c)), /* @__PURE__ */ I(
277
277
  "aside",
278
278
  {
279
279
  ...s,
@@ -289,7 +289,7 @@ function me(t) {
289
289
  "data-variant": g ? "overlay" : "inline",
290
290
  id: a,
291
291
  role: B ? "dialog" : void 0,
292
- style: P,
292
+ style: T,
293
293
  tabIndex: g ? -1 : void 0,
294
294
  children: [
295
295
  /* @__PURE__ */ u(
@@ -335,13 +335,13 @@ function Ye(t) {
335
335
  active: p,
336
336
  boundaries: n,
337
337
  dismissOnEscape: !0,
338
- dismissOnPointerDownOutside: !0,
338
+ dismissOnOutsideInteraction: "consume",
339
339
  layerId: S.id,
340
340
  onEscapeDismiss: F,
341
- onPointerDownOutsideDismiss: B,
341
+ onOutsideDismiss: B,
342
342
  ownerDocument: f
343
343
  });
344
- const P = Te({
344
+ const T = Pe({
345
345
  boundary: g,
346
346
  active: p,
347
347
  container: m,
@@ -352,7 +352,7 @@ function Ye(t) {
352
352
  return Ie(r && p, f, g), /* @__PURE__ */ u(
353
353
  se.Provider,
354
354
  {
355
- value: p ? P : s,
355
+ value: p ? T : s,
356
356
  children: /* @__PURE__ */ u(
357
357
  "div",
358
358
  {
@@ -535,23 +535,23 @@ const We = 32, en = O(function(n, e) {
535
535
  variant: o = "responsive",
536
536
  width: p,
537
537
  ...c
538
- } = n, s = K("Sidebar"), d = `${de()}-sidebar`, m = L(Symbol("nk-sidebar")).current, E = L(null), g = Ze(o, s == null ? void 0 : s.width), S = y !== void 0, [R, F] = w(r), [B, P] = w(0), [x, ge] = w(!1), J = L(null), T = S ? y : R, j = L(a);
538
+ } = n, s = K("Sidebar"), d = `${de()}-sidebar`, m = L(Symbol("nk-sidebar")).current, E = L(null), g = Ze(o, s == null ? void 0 : s.width), S = y !== void 0, [R, F] = w(r), [B, T] = w(0), [x, ge] = w(!1), J = L(null), P = S ? y : R, j = L(a);
539
539
  M(() => {
540
540
  j.current = a;
541
541
  });
542
542
  const D = _((h, k) => {
543
543
  var C;
544
- T !== h && (S || F(h), (C = j.current) == null || C.call(j, h, k));
545
- }, [S, T]), Q = _((h) => {
544
+ P !== h && (S || F(h), (C = j.current) == null || C.call(j, h, k));
545
+ }, [S, P]), Q = _((h) => {
546
546
  E.current = h, fe(e, h);
547
547
  }, [e]), N = te(
548
548
  () => [E],
549
549
  []
550
550
  ), X = _((h) => {
551
- N.push({ current: h }), P((k) => k + 1);
551
+ N.push({ current: h }), T((k) => k + 1);
552
552
  }, [N]), Z = _((h) => {
553
553
  const k = N.findIndex((C) => C.current === h);
554
- k > 0 && N.splice(k, 1), P((C) => Math.max(C - 1, 0));
554
+ k > 0 && N.splice(k, 1), T((C) => Math.max(C - 1, 0));
555
555
  }, [N]), ve = _((h) => {
556
556
  const k = J.current;
557
557
  if (k && k !== h) {
@@ -561,14 +561,14 @@ const We = 32, en = O(function(n, e) {
561
561
  J.current = h, h && N.push({ current: h });
562
562
  }, [N]), G = te(() => ({
563
563
  id: d,
564
- open: T,
564
+ open: P,
565
565
  presentation: g,
566
566
  registerTrigger: X,
567
567
  requestOpenChange: D,
568
568
  unregisterTrigger: Z,
569
569
  variant: o
570
570
  }), [
571
- T,
571
+ P,
572
572
  d,
573
573
  g,
574
574
  X,
@@ -599,7 +599,7 @@ const We = 32, en = O(function(n, e) {
599
599
  );
600
600
  return () => h.clearTimeout(k);
601
601
  }, [s == null ? void 0 : s.boundaryElement]);
602
- const q = Pe(T && g === "overlay"), W = ((ne = s == null ? void 0 : s.boundaryElement) == null ? void 0 : ne.ownerDocument) ?? (typeof document > "u" ? null : document);
602
+ const q = Te(P && g === "overlay"), W = ((ne = s == null ? void 0 : s.boundaryElement) == null ? void 0 : ne.ownerDocument) ?? (typeof document > "u" ? null : document);
603
603
  if (g !== "overlay")
604
604
  return /* @__PURE__ */ u(
605
605
  me,
@@ -618,11 +618,11 @@ const We = 32, en = O(function(n, e) {
618
618
  xe,
619
619
  {
620
620
  label: `Open ${c["aria-label"] ?? "Sidebar"}`,
621
- onToggle: () => D(!T, "trigger"),
621
+ onToggle: () => D(!P, "trigger"),
622
622
  panelId: q.present ? d : void 0,
623
623
  reference: ve,
624
624
  side: v,
625
- sidebarOpen: T
625
+ sidebarOpen: P
626
626
  }
627
627
  ) }) : null;
628
628
  return !q.present || !W ? ee : /* @__PURE__ */ I(le, { children: [
@@ -3,8 +3,8 @@ import { jsx as a, jsxs as R } from "react/jsx-runtime";
3
3
  import { createContext as V, forwardRef as _, Children as L, isValidElement as j, Fragment as A, createElement as Y, cloneElement as E, useRef as y, useContext as X, useState as B, useEffect as $, useCallback as q } from "react";
4
4
  import { a as G } from "./reference-CXMr27nM.js";
5
5
  import { S as J } from "./Surface-vEFsZC12.js";
6
- import { B as Q } from "./Button-ZzJbnjNg.js";
7
- import { T as U } from "./Tooltip-4RWCnb2Q.js";
6
+ import { B as Q } from "./Button-Dsr1zrKT.js";
7
+ import { T as U } from "./Tooltip-BuRMZ4p_.js";
8
8
  const T = V("body"), I = _(function(l, e) {
9
9
  const {
10
10
  align: t = "left",
@@ -1 +1 @@
1
- "use client";"use strict";const r=require("react/jsx-runtime"),o=require("react"),H=require("./reference-C2guRuR0.cjs"),D=require("./Surface-BttJYSDt.cjs"),K=require("./Button-CYFy6sTv.cjs"),O=require("./Tooltip-B2rZmRCs.cjs"),j=o.createContext("body"),w=o.forwardRef(function(l,e){const{align:t="left",children:s,className:i,scope:c="col",sticky:b=!1,...d}=l;return r.jsx("th",{...d,ref:e,className:["nk-table__header-cell",i].filter(Boolean).join(" "),"data-align":t,"data-sticky":b||void 0,scope:c,children:s})});function S(n){for(const l of o.Children.toArray(n)){if(o.isValidElement(l)&&l.type===o.Fragment){if(S(l.props.children))return!0;continue}return!0}return!1}function F(n){const{"aria-label":l,icon:e,label:t,...s}=n;return r.jsx(O.Tooltip2,{content:t,children:r.jsx(K.Button,{...s,"aria-label":l??t,icon:e,shape:"rectangle",size:"small",type:"button",variant:"ghost"})})}function P(n){const{actions:l}=n;function e(t){t.stopPropagation()}return r.jsx("td",{className:"nk-table__cell nk-table__action-cell","data-align":"right",onClick:e,children:l.length>0?r.jsx("span",{className:"nk-table__action-list",children:l.map(t=>o.createElement(F,{...t,key:t.label}))}):null})}const q=o.forwardRef(function(l,e){const{children:t,className:s,emptyColumnCount:i=1,emptyMessage:c,...b}=l,d=!S(t),h=Number.isFinite(i)?Math.max(1,Math.floor(i)):1;return r.jsx("tbody",{...b,ref:e,className:["nk-table__body",s].filter(Boolean).join(" "),children:d&&c!==void 0?r.jsxs("tr",{className:"nk-table__row",children:[r.jsx("td",{"aria-hidden":"true",className:"nk-table__cell nk-table__overscroll-start-cell"}),r.jsx("td",{className:"nk-table__cell nk-table__empty-cell",colSpan:h,children:r.jsx("div",{className:"nk-table__empty-content",children:c})}),r.jsx(P,{actions:[]})]}):r.jsx(j.Provider,{value:"body",children:t})})});function z(n,l,e){return n===void 0?l:e?e(n):n instanceof Date?Number.isNaN(n.getTime())?"Invalid Date":n.toISOString().slice(0,10):typeof n=="boolean"?n?"Yes":"No":n}function V(n){if(typeof n=="number"||typeof n=="string")return String(n)}const E=o.forwardRef(function(l,e){const{align:t="left",children:s,className:i,format:c,title:b,truncate:d,value:h,...k}=l,{rowTrigger:a,...u}=k,p=z(h,s,c),f=d===void 0?void 0:{maxWidth:d},_=b??(d===void 0?void 0:V(p));return r.jsxs("td",{...u,ref:e,className:["nk-table__cell",i].filter(Boolean).join(" "),"data-align":t,title:_,children:[(a==null?void 0:a.kind)==="link"&&a.linkProperties?r.jsx("a",{ref:a.reference,"aria-label":a.ariaLabel,className:"nk-table__row-trigger",download:a.linkProperties.download,href:a.linkProperties.href,hrefLang:a.linkProperties.hrefLang,onClick:a.linkProperties.onNavigate,rel:a.linkProperties.rel,target:a.linkProperties.target}):null,(a==null?void 0:a.kind)==="button"?r.jsx("button",{ref:a.reference,"aria-label":a.ariaLabel,className:"nk-table__row-trigger",onClick:a.onClick,type:"button"}):null,d!==void 0?r.jsx("span",{className:"nk-table__truncated-content",style:f,children:p}):p]})}),M=o.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return r.jsx("tfoot",{...i,ref:e,className:["nk-table__foot",s].filter(Boolean).join(" "),children:r.jsx(j.Provider,{value:"foot",children:t})})}),Y=o.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return r.jsx("thead",{...i,ref:e,className:["nk-table__head",s].filter(Boolean).join(" "),children:r.jsx(j.Provider,{value:"head",children:t})})}),X=["a[href]","audio[controls]","button","iframe","input","label","select","summary","textarea","video[controls]","[contenteditable]:not([contenteditable='false'])"].join(","),$=new Set(["button","checkbox","combobox","grid","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","radiogroup","scrollbar","searchbox","slider","spinbutton","switch","tab","tablist","textbox","tree","treegrid","treeitem"]);function G(n,l){var t;let e=n;for(;e&&e!==l;){if(e.matches(X)||(((t=e.getAttribute("role"))==null?void 0:t.split(/\s+/))??[]).some(i=>$.has(i)))return!0;e=e.parentElement}return!1}function J(n,l){let e=!1;function t(i){return o.Children.map(i,c=>o.isValidElement(c)?c.type===o.Fragment?o.cloneElement(c,void 0,t(c.props.children)):!e&&c.type===E?(e=!0,o.cloneElement(c,{rowTrigger:l})):c:c)}const s=t(n);return{attached:e,content:s}}const Q=o.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return r.jsx(w,{...i,ref:e,align:"right",className:["nk-table__action-header-cell",s].filter(Boolean).join(" "),children:t??r.jsx("span",{className:"nk-table__visually-hidden",children:"Row actions"})})}),U=o.forwardRef(function(l,e){const{"aria-label":t,actions:s,children:i,className:c,download:b,href:d,hrefLang:h,onClick:k,onNavigate:a,rel:u,target:p,...f}=l,_=o.useRef(null),x=o.useContext(j),g=d!==void 0||k!==void 0,N=(t==null?void 0:t.trim())||(d!==void 0?"Open row":"Activate row");function T(m){_.current=m}let C;d!==void 0?C={ariaLabel:N,kind:"link",linkProperties:{download:b,href:d,hrefLang:h,onNavigate:a,rel:u,target:p},reference:T}:k!==void 0&&(C={ariaLabel:N,kind:"button",onClick:k,reference:T});const B=C?J(i,C):{content:i};function L(m){if(m.defaultPrevented)return;const y=m.target;if(!(y instanceof Element)||G(y,m.currentTarget))return;const v=_.current;if(!v)return;const R=v.ownerDocument.defaultView;if(!R){v.click();return}v.dispatchEvent(new R.MouseEvent("click",{altKey:m.altKey,bubbles:!0,button:m.button,buttons:m.buttons,cancelable:!0,clientX:m.clientX,clientY:m.clientY,ctrlKey:m.ctrlKey,metaKey:m.metaKey,shiftKey:m.shiftKey}))}const A=x==="head"?r.jsx(Q,{}):r.jsx(P,{actions:s??[]}),I=x==="head"?r.jsx("th",{"aria-hidden":"true",className:"nk-table__header-cell nk-table__overscroll-start-cell"}):r.jsx("td",{"aria-hidden":"true",className:"nk-table__cell nk-table__overscroll-start-cell"});return r.jsxs("tr",{...f,ref:e,"aria-label":g?void 0:t,className:["nk-table__row",c].filter(Boolean).join(" "),"data-interactive":g||void 0,onClick:g?L:void 0,children:[I,B.content,A]})});function W(){const n=o.useRef(null),l=o.useRef(null),[e,t]=o.useState(!1),[s,i]=o.useState(!1);o.useEffect(()=>{const b=n.current,d=l.current;if(!b||!d)return;const h=b,k=d;function a(){const _=h.scrollWidth>h.clientWidth;t(_),_||i(!1)}a();const u=h.ownerDocument.defaultView;u==null||u.addEventListener("resize",a);const p=u==null?void 0:u.ResizeObserver,f=p?new p(a):void 0;return f==null||f.observe(h),f==null||f.observe(k),()=>{u==null||u.removeEventListener("resize",a),f==null||f.disconnect()}},[]);function c(b){i(e&&b.currentTarget.scrollLeft>1)}return{containerReference:n,contentReference:l,isScrollable:e,isScrolled:s,handleScroll:c}}const Z=o.forwardRef(function(l,e){const{"aria-label":t,children:s,className:i,containerClassName:c,frame:b="outline",spacing:d="standard",...h}=l,{containerReference:k,contentReference:a,isScrollable:u,isScrolled:p,handleScroll:f}=W(),_=t?`${t} scroll area`:"Scrollable table",x=o.useCallback(g=>{a.current=g,H.assignElementReference(e,g)},[a,e]);return r.jsx(D.Surface,{ref:k,"aria-label":u?_:void 0,className:["nk-table",c].filter(Boolean).join(" "),"data-frame":b,"data-scrolled":p||void 0,"data-spacing":d,onScroll:f,role:u?"region":void 0,tabIndex:u?0:void 0,children:r.jsx("table",{...h,ref:x,"aria-label":t,className:["nk-table__element",i].filter(Boolean).join(" "),children:s})})}),ee=Object.assign(Z,{Body:q,Cell:E,Foot:M,HeaderCell:w,Head:Y,Row:U});exports.Table=ee;
1
+ "use client";"use strict";const r=require("react/jsx-runtime"),o=require("react"),H=require("./reference-C2guRuR0.cjs"),D=require("./Surface-BttJYSDt.cjs"),K=require("./Button-DyO8fkk1.cjs"),O=require("./Tooltip-tzVg8Bky.cjs"),j=o.createContext("body"),w=o.forwardRef(function(l,e){const{align:t="left",children:s,className:i,scope:c="col",sticky:b=!1,...d}=l;return r.jsx("th",{...d,ref:e,className:["nk-table__header-cell",i].filter(Boolean).join(" "),"data-align":t,"data-sticky":b||void 0,scope:c,children:s})});function S(n){for(const l of o.Children.toArray(n)){if(o.isValidElement(l)&&l.type===o.Fragment){if(S(l.props.children))return!0;continue}return!0}return!1}function F(n){const{"aria-label":l,icon:e,label:t,...s}=n;return r.jsx(O.Tooltip2,{content:t,children:r.jsx(K.Button,{...s,"aria-label":l??t,icon:e,shape:"rectangle",size:"small",type:"button",variant:"ghost"})})}function P(n){const{actions:l}=n;function e(t){t.stopPropagation()}return r.jsx("td",{className:"nk-table__cell nk-table__action-cell","data-align":"right",onClick:e,children:l.length>0?r.jsx("span",{className:"nk-table__action-list",children:l.map(t=>o.createElement(F,{...t,key:t.label}))}):null})}const q=o.forwardRef(function(l,e){const{children:t,className:s,emptyColumnCount:i=1,emptyMessage:c,...b}=l,d=!S(t),h=Number.isFinite(i)?Math.max(1,Math.floor(i)):1;return r.jsx("tbody",{...b,ref:e,className:["nk-table__body",s].filter(Boolean).join(" "),children:d&&c!==void 0?r.jsxs("tr",{className:"nk-table__row",children:[r.jsx("td",{"aria-hidden":"true",className:"nk-table__cell nk-table__overscroll-start-cell"}),r.jsx("td",{className:"nk-table__cell nk-table__empty-cell",colSpan:h,children:r.jsx("div",{className:"nk-table__empty-content",children:c})}),r.jsx(P,{actions:[]})]}):r.jsx(j.Provider,{value:"body",children:t})})});function z(n,l,e){return n===void 0?l:e?e(n):n instanceof Date?Number.isNaN(n.getTime())?"Invalid Date":n.toISOString().slice(0,10):typeof n=="boolean"?n?"Yes":"No":n}function V(n){if(typeof n=="number"||typeof n=="string")return String(n)}const E=o.forwardRef(function(l,e){const{align:t="left",children:s,className:i,format:c,title:b,truncate:d,value:h,...k}=l,{rowTrigger:a,...u}=k,p=z(h,s,c),f=d===void 0?void 0:{maxWidth:d},_=b??(d===void 0?void 0:V(p));return r.jsxs("td",{...u,ref:e,className:["nk-table__cell",i].filter(Boolean).join(" "),"data-align":t,title:_,children:[(a==null?void 0:a.kind)==="link"&&a.linkProperties?r.jsx("a",{ref:a.reference,"aria-label":a.ariaLabel,className:"nk-table__row-trigger",download:a.linkProperties.download,href:a.linkProperties.href,hrefLang:a.linkProperties.hrefLang,onClick:a.linkProperties.onNavigate,rel:a.linkProperties.rel,target:a.linkProperties.target}):null,(a==null?void 0:a.kind)==="button"?r.jsx("button",{ref:a.reference,"aria-label":a.ariaLabel,className:"nk-table__row-trigger",onClick:a.onClick,type:"button"}):null,d!==void 0?r.jsx("span",{className:"nk-table__truncated-content",style:f,children:p}):p]})}),M=o.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return r.jsx("tfoot",{...i,ref:e,className:["nk-table__foot",s].filter(Boolean).join(" "),children:r.jsx(j.Provider,{value:"foot",children:t})})}),Y=o.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return r.jsx("thead",{...i,ref:e,className:["nk-table__head",s].filter(Boolean).join(" "),children:r.jsx(j.Provider,{value:"head",children:t})})}),X=["a[href]","audio[controls]","button","iframe","input","label","select","summary","textarea","video[controls]","[contenteditable]:not([contenteditable='false'])"].join(","),$=new Set(["button","checkbox","combobox","grid","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","radiogroup","scrollbar","searchbox","slider","spinbutton","switch","tab","tablist","textbox","tree","treegrid","treeitem"]);function G(n,l){var t;let e=n;for(;e&&e!==l;){if(e.matches(X)||(((t=e.getAttribute("role"))==null?void 0:t.split(/\s+/))??[]).some(i=>$.has(i)))return!0;e=e.parentElement}return!1}function J(n,l){let e=!1;function t(i){return o.Children.map(i,c=>o.isValidElement(c)?c.type===o.Fragment?o.cloneElement(c,void 0,t(c.props.children)):!e&&c.type===E?(e=!0,o.cloneElement(c,{rowTrigger:l})):c:c)}const s=t(n);return{attached:e,content:s}}const Q=o.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return r.jsx(w,{...i,ref:e,align:"right",className:["nk-table__action-header-cell",s].filter(Boolean).join(" "),children:t??r.jsx("span",{className:"nk-table__visually-hidden",children:"Row actions"})})}),U=o.forwardRef(function(l,e){const{"aria-label":t,actions:s,children:i,className:c,download:b,href:d,hrefLang:h,onClick:k,onNavigate:a,rel:u,target:p,...f}=l,_=o.useRef(null),x=o.useContext(j),g=d!==void 0||k!==void 0,N=(t==null?void 0:t.trim())||(d!==void 0?"Open row":"Activate row");function T(m){_.current=m}let C;d!==void 0?C={ariaLabel:N,kind:"link",linkProperties:{download:b,href:d,hrefLang:h,onNavigate:a,rel:u,target:p},reference:T}:k!==void 0&&(C={ariaLabel:N,kind:"button",onClick:k,reference:T});const B=C?J(i,C):{content:i};function L(m){if(m.defaultPrevented)return;const y=m.target;if(!(y instanceof Element)||G(y,m.currentTarget))return;const v=_.current;if(!v)return;const R=v.ownerDocument.defaultView;if(!R){v.click();return}v.dispatchEvent(new R.MouseEvent("click",{altKey:m.altKey,bubbles:!0,button:m.button,buttons:m.buttons,cancelable:!0,clientX:m.clientX,clientY:m.clientY,ctrlKey:m.ctrlKey,metaKey:m.metaKey,shiftKey:m.shiftKey}))}const A=x==="head"?r.jsx(Q,{}):r.jsx(P,{actions:s??[]}),I=x==="head"?r.jsx("th",{"aria-hidden":"true",className:"nk-table__header-cell nk-table__overscroll-start-cell"}):r.jsx("td",{"aria-hidden":"true",className:"nk-table__cell nk-table__overscroll-start-cell"});return r.jsxs("tr",{...f,ref:e,"aria-label":g?void 0:t,className:["nk-table__row",c].filter(Boolean).join(" "),"data-interactive":g||void 0,onClick:g?L:void 0,children:[I,B.content,A]})});function W(){const n=o.useRef(null),l=o.useRef(null),[e,t]=o.useState(!1),[s,i]=o.useState(!1);o.useEffect(()=>{const b=n.current,d=l.current;if(!b||!d)return;const h=b,k=d;function a(){const _=h.scrollWidth>h.clientWidth;t(_),_||i(!1)}a();const u=h.ownerDocument.defaultView;u==null||u.addEventListener("resize",a);const p=u==null?void 0:u.ResizeObserver,f=p?new p(a):void 0;return f==null||f.observe(h),f==null||f.observe(k),()=>{u==null||u.removeEventListener("resize",a),f==null||f.disconnect()}},[]);function c(b){i(e&&b.currentTarget.scrollLeft>1)}return{containerReference:n,contentReference:l,isScrollable:e,isScrolled:s,handleScroll:c}}const Z=o.forwardRef(function(l,e){const{"aria-label":t,children:s,className:i,containerClassName:c,frame:b="outline",spacing:d="standard",...h}=l,{containerReference:k,contentReference:a,isScrollable:u,isScrolled:p,handleScroll:f}=W(),_=t?`${t} scroll area`:"Scrollable table",x=o.useCallback(g=>{a.current=g,H.assignElementReference(e,g)},[a,e]);return r.jsx(D.Surface,{ref:k,"aria-label":u?_:void 0,className:["nk-table",c].filter(Boolean).join(" "),"data-frame":b,"data-scrolled":p||void 0,"data-spacing":d,onScroll:f,role:u?"region":void 0,tabIndex:u?0:void 0,children:r.jsx("table",{...h,ref:x,"aria-label":t,className:["nk-table__element",i].filter(Boolean).join(" "),children:s})})}),ee=Object.assign(Z,{Body:q,Cell:E,Foot:M,HeaderCell:w,Head:Y,Row:U});exports.Table=ee;
package/dist/Table.cjs CHANGED
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Table-DEjAMnG3.cjs");exports.default=e.Table;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Table-DTxKbMgJ.cjs");exports.default=e.Table;
package/dist/Table.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { T as a } from "./Table-WlCsBVHC.js";
2
+ import { T as a } from "./Table-CURYs469.js";
3
3
  export {
4
4
  a as default
5
5
  };
@@ -1,14 +1,14 @@
1
1
  "use client";
2
- import { jsx as A, jsxs as J, Fragment as Ie } from "react/jsx-runtime";
3
- import { useMemo as Z, createContext as he, forwardRef as ve, Fragment as Pe, useId as Le, useContext as Fe, useRef as o, useState as N, useCallback as c, useEffect as V, cloneElement as K } from "react";
2
+ import { jsx as A, jsxs as J, Fragment as he } from "react/jsx-runtime";
3
+ import { useMemo as Z, createContext as De, forwardRef as ve, Fragment as Le, useId as Pe, useContext as Fe, useRef as o, useState as N, useCallback as c, useEffect as V, cloneElement as K } from "react";
4
4
  import { m as Oe } from "./aria-Bv-xVREf.js";
5
5
  import { g as _e, a as Q } from "./reference-CXMr27nM.js";
6
6
  import { u as Me, r as xe } from "./useFloatingPosition-DktY7k-t.js";
7
7
  import { u as We } from "./effects-DGbA6Q2O.js";
8
- import { b as ke, c as Be, d as Ne, P as Ve } from "./usePresence-BTRY1_l-.js";
8
+ import { b as ke, c as Be, d as Ne, P as Ve } from "./usePresence-BYnWctTh.js";
9
9
  import { i as Ae } from "./focus-restoration-BvNZzrQA.js";
10
10
  import { S as Ce } from "./Surface-vEFsZC12.js";
11
- const je = 500, ee = he(null);
11
+ const je = 500, ee = De(null);
12
12
  function ze(s) {
13
13
  const { children: p, delay: u = je } = s, i = Z(() => ({
14
14
  delay: u
@@ -32,19 +32,19 @@ const $e = ve(function(p, u) {
32
32
  contentStyle: j,
33
33
  delay: oe,
34
34
  disabled: g = !1,
35
- onOpenChange: D,
35
+ onOpenChange: R,
36
36
  placement: z = "top",
37
37
  style: se
38
38
  } = p;
39
39
  if (m == null || typeof m == "boolean" || typeof m == "string" && !m.trim())
40
40
  throw new Error("Tooltip content must not be empty");
41
- if (i.type === Pe)
41
+ if (i.type === Le)
42
42
  throw new Error("Tooltip requires a single non-Fragment trigger");
43
- const S = `${Le()}-tooltip`, F = Fe(ee), O = i.props, Y = _e(i), T = o(null), _ = o(null), $ = o(g), M = o(!1), I = o(null), h = o(null), v = o(null), P = o(!1), w = o(!1), y = o(!1), l = o(!1), [b, ie] = N(null), [ce, ue] = N(null), [L, le] = N(!1);
43
+ const S = `${Pe()}-tooltip`, F = Fe(ee), O = i.props, Y = _e(i), T = o(null), _ = o(null), $ = o(g), M = o(!1), h = o(null), D = o(null), v = o(null), L = o(!1), w = o(!1), y = o(!1), l = o(!1), [b, ie] = N(null), [ce, ue] = N(null), [P, le] = N(!1);
44
44
  $.current = g;
45
45
  const x = Ye(
46
46
  oe ?? (F == null ? void 0 : F.delay) ?? re
47
- ), E = ke(L), H = (b == null ? void 0 : b.ownerDocument) ?? (typeof document > "u" ? null : document), W = We("Tooltip").boundaryElement, k = Be(E.present, W), a = Me(
47
+ ), E = ke(P), H = (b == null ? void 0 : b.ownerDocument) ?? (typeof document > "u" ? null : document), W = We("Tooltip").boundaryElement, k = Be(E.present, W), a = Me(
48
48
  E.present,
49
49
  z,
50
50
  b,
@@ -57,7 +57,7 @@ const $e = ve(function(p, u) {
57
57
  ), fe = Oe(
58
58
  O["aria-describedby"],
59
59
  S
60
- ), de = L && E.present ? fe : O["aria-describedby"], U = c(
60
+ ), de = P && E.present ? fe : O["aria-describedby"], U = c(
61
61
  (e) => {
62
62
  Se(
63
63
  e,
@@ -73,17 +73,17 @@ const $e = ve(function(p, u) {
73
73
  },
74
74
  []
75
75
  ), n = c(() => {
76
- const e = I.current;
77
- e && e.ownerWindow.clearTimeout(e.timerId), I.current = null;
78
- }, []), t = c(() => {
79
76
  const e = h.current;
80
77
  e && e.ownerWindow.clearTimeout(e.timerId), h.current = null;
81
- }, []), R = c(() => {
78
+ }, []), t = c(() => {
79
+ const e = D.current;
80
+ e && e.ownerWindow.clearTimeout(e.timerId), D.current = null;
81
+ }, []), I = c(() => {
82
82
  const e = v.current;
83
83
  e && e.ownerWindow.clearTimeout(e.timerId), v.current = null;
84
84
  }, []), r = c((e) => {
85
- M.current !== e && (e || (l.current = !1), M.current = e, le(e), D == null || D(e));
86
- }, [D]), B = c((e) => {
85
+ M.current !== e && (e || (l.current = !1), M.current = e, le(e), R == null || R(e));
86
+ }, [R]), B = c((e) => {
87
87
  var q, G;
88
88
  if (t(), w.current || y.current || l.current)
89
89
  return;
@@ -97,9 +97,9 @@ const $e = ve(function(p, u) {
97
97
  return;
98
98
  }
99
99
  const d = f.setTimeout(() => {
100
- h.current = null, !w.current && !y.current && !l.current && r(!1);
100
+ D.current = null, !w.current && !y.current && !l.current && r(!1);
101
101
  }, e);
102
- h.current = {
102
+ D.current = {
103
103
  ownerWindow: f,
104
104
  timerId: d
105
105
  };
@@ -112,12 +112,12 @@ const $e = ve(function(p, u) {
112
112
  const e = (d = T.current) == null ? void 0 : d.ownerDocument.defaultView;
113
113
  if (!e) return;
114
114
  const f = e.setTimeout(() => {
115
- I.current = null, $.current || r(!0);
115
+ h.current = null, $.current || r(!0);
116
116
  }, x);
117
- I.current = { ownerWindow: e, timerId: f };
117
+ h.current = { ownerWindow: e, timerId: f };
118
118
  }, [t, n, x, r]);
119
119
  function ge(e) {
120
- if (w.current = !0, t(), P.current || Ae(e.currentTarget)) {
120
+ if (w.current = !0, t(), L.current || Ae(e.currentTarget)) {
121
121
  n();
122
122
  return;
123
123
  }
@@ -138,43 +138,43 @@ const $e = ve(function(p, u) {
138
138
  function Ee() {
139
139
  l.current = !1, B(X);
140
140
  }
141
- function Re() {
141
+ function Ie() {
142
142
  var d;
143
143
  n(), t(), r(!1);
144
144
  const e = (d = T.current) == null ? void 0 : d.ownerDocument.defaultView;
145
145
  if (!e) return;
146
- P.current = !0, R();
146
+ L.current = !0, I();
147
147
  const f = e.setTimeout(() => {
148
- P.current = !1, v.current = null;
148
+ L.current = !1, v.current = null;
149
149
  }, 0);
150
150
  v.current = { ownerWindow: e, timerId: f };
151
151
  }
152
152
  if (Ne({
153
153
  boundary: W,
154
- active: L,
154
+ active: P,
155
155
  boundaries: ae,
156
- dismissOnPointerDownOutside: !0,
156
+ dismissOnOutsideInteraction: "pass-through",
157
157
  layerId: k.id,
158
158
  onEscapeDismiss: () => r(!1),
159
- onPointerDownOutsideDismiss: () => r(!1),
159
+ onOutsideDismiss: () => r(!1),
160
160
  ownerDocument: H
161
161
  }), V(() => {
162
- g && (n(), t(), R(), P.current = !1, w.current = !1, y.current = !1, l.current = !1, M.current && r(!1));
162
+ g && (n(), t(), I(), L.current = !1, w.current = !1, y.current = !1, l.current = !1, M.current && r(!1));
163
163
  }, [
164
164
  t,
165
165
  n,
166
- R,
166
+ I,
167
167
  g,
168
168
  r
169
169
  ]), V(() => {
170
170
  }, [b]), V(() => () => {
171
- n(), t(), R();
172
- }, [t, n, R]), g)
171
+ n(), t(), I();
172
+ }, [t, n, I]), g)
173
173
  return K(
174
174
  i,
175
175
  { ref: U }
176
176
  );
177
- const De = K(
177
+ const Re = K(
178
178
  i,
179
179
  xe(O, {
180
180
  "aria-describedby": de,
@@ -183,18 +183,18 @@ const $e = ve(function(p, u) {
183
183
  onFocus: ge,
184
184
  onMouseEnter: we,
185
185
  onMouseLeave: ye,
186
- onPointerDown: Re,
186
+ onPointerDown: Ie,
187
187
  ref: U,
188
188
  style: se
189
189
  })
190
190
  );
191
- return /* @__PURE__ */ J(Ie, { children: [
192
- De,
191
+ return /* @__PURE__ */ J(he, { children: [
192
+ Re,
193
193
  E.present && H ? /* @__PURE__ */ A(Ve, { children: /* @__PURE__ */ J(
194
194
  Ce,
195
195
  {
196
196
  ref: me,
197
- "aria-hidden": L ? void 0 : !0,
197
+ "aria-hidden": P ? void 0 : !0,
198
198
  className: ["nk-tooltip", te].filter(Boolean).join(" "),
199
199
  "data-placement": (a == null ? void 0 : a.placement) ?? z,
200
200
  "data-align": C,
@@ -1 +1 @@
1
- "use client";"use strict";const m=require("react/jsx-runtime"),n=require("react"),be=require("./aria-DM-xYEHQ.cjs"),W=require("./reference-C2guRuR0.cjs"),G=require("./useFloatingPosition-DPVO2E8O.cjs"),Ee=require("./effects-D98vUn6N.cjs"),F=require("./usePresence-Dm0mls5p.cjs"),ye=require("./focus-restoration-70WcQRr5.cjs"),De=require("./Surface-BttJYSDt.cjs"),Ie=500,K=n.createContext(null);function he(s){const{children:p,delay:i=Ie}=s,c=n.useMemo(()=>({delay:i}),[i]);return m.jsx(K.Provider,{value:c,children:p})}const Q=500,J=100;function ve(s,p,i,c){p.current=s,W.assignElementReference(i,s),W.assignElementReference(c,s)}function Pe(s){return Number.isFinite(s)?Math.max(0,s):Q}const Le=n.forwardRef(function(p,i){const{children:c,align:B="center",className:X,content:d,contentClassName:Z,contentStyle:N,delay:ee,disabled:g=!1,onOpenChange:D,placement:S="top",style:ne}=p;if(d==null||typeof d=="boolean"||typeof d=="string"&&!d.trim())throw new Error("Tooltip content must not be empty");if(c.type===n.Fragment)throw new Error("Tooltip requires a single non-Fragment trigger");const V=`${n.useId()}-tooltip`,k=n.useContext(K),O=c.props,A=W.getElementReference(c),T=n.useRef(null),C=n.useRef(null),z=n.useRef(g),_=n.useRef(!1),I=n.useRef(null),h=n.useRef(null),v=n.useRef(null),P=n.useRef(!1),R=n.useRef(!1),w=n.useRef(!1),u=n.useRef(!1),[b,re]=n.useState(null),[te,oe]=n.useState(null),[L,se]=n.useState(!1);z.current=g;const x=Pe(ee??(k==null?void 0:k.delay)??Q),E=F.usePresence(L),Y=(b==null?void 0:b.ownerDocument)??(typeof document>"u"?null:document),M=Ee.useBoundary("Tooltip").boundaryElement,q=F.useOverlayLayer(E.present,M),l=G.useFloatingPosition(E.present,S,b,te,M,B),ce=n.useMemo(()=>[T,C],[]),ie=be.mergeIdentifiers(O["aria-describedby"],V),ue=L&&E.present?ie:O["aria-describedby"],H=n.useCallback(e=>{ve(e,T,A,i),re(e)},[i,A]),le=n.useCallback(e=>{C.current=e,e||(u.current=!1),oe(e)},[]),t=n.useCallback(()=>{const e=I.current;e&&e.ownerWindow.clearTimeout(e.timerId),I.current=null},[]),o=n.useCallback(()=>{const e=h.current;e&&e.ownerWindow.clearTimeout(e.timerId),h.current=null},[]),y=n.useCallback(()=>{const e=v.current;e&&e.ownerWindow.clearTimeout(e.timerId),v.current=null},[]),r=n.useCallback(e=>{_.current!==e&&(e||(u.current=!1),_.current=e,se(e),D==null||D(e))},[D]),j=n.useCallback(e=>{var U,$;if(o(),R.current||w.current||u.current)return;if(e===0){r(!1);return}const a=((U=T.current)==null?void 0:U.ownerDocument.defaultView)??(($=C.current)==null?void 0:$.ownerDocument.defaultView);if(!a){r(!1);return}const f=a.setTimeout(()=>{h.current=null,!R.current&&!w.current&&!u.current&&r(!1)},e);h.current={ownerWindow:a,timerId:f}},[o,r]),ae=n.useCallback(()=>{var f;if(t(),o(),x===0){r(!0);return}const e=(f=T.current)==null?void 0:f.ownerDocument.defaultView;if(!e)return;const a=e.setTimeout(()=>{I.current=null,z.current||r(!0)},x);I.current={ownerWindow:e,timerId:a}},[o,t,x,r]);function fe(e){if(R.current=!0,o(),P.current||ye.isElementFocusRestoration(e.currentTarget)){t();return}t(),r(!0)}function de(e){e.currentTarget.contains(e.relatedTarget)||(R.current=!1,t(),j(0))}function me(){w.current=!0,ae()}function pe(){w.current=!1,t(),j(J)}function ge(){u.current=!0,o()}function Te(){u.current=!1,j(J)}function Re(){var f;t(),o(),r(!1);const e=(f=T.current)==null?void 0:f.ownerDocument.defaultView;if(!e)return;P.current=!0,y();const a=e.setTimeout(()=>{P.current=!1,v.current=null},0);v.current={ownerWindow:e,timerId:a}}if(F.useDismissableLayer({boundary:M,active:L,boundaries:ce,dismissOnPointerDownOutside:!0,layerId:q.id,onEscapeDismiss:()=>r(!1),onPointerDownOutsideDismiss:()=>r(!1),ownerDocument:Y}),n.useEffect(()=>{g&&(t(),o(),y(),P.current=!1,R.current=!1,w.current=!1,u.current=!1,_.current&&r(!1))},[o,t,y,g,r]),n.useEffect(()=>{},[b]),n.useEffect(()=>()=>{t(),o(),y()},[o,t,y]),g)return n.cloneElement(c,{ref:H});const we=n.cloneElement(c,G.resolveTriggerOverrides(O,{"aria-describedby":ue,className:["nk-tooltip__trigger",X].filter(Boolean).join(" "),onBlur:de,onFocus:fe,onMouseEnter:me,onMouseLeave:pe,onPointerDown:Re,ref:H,style:ne}));return m.jsxs(m.Fragment,{children:[we,E.present&&Y?m.jsx(F.Portal,{children:m.jsxs(De.Surface,{ref:le,"aria-hidden":L?void 0:!0,className:["nk-tooltip",Z].filter(Boolean).join(" "),"data-placement":(l==null?void 0:l.placement)??S,"data-align":B,"data-state":E.state==="closing"?"closing":"open",id:V,onMouseEnter:ge,onMouseLeave:Te,role:"tooltip",style:l?{...N,"--nk-tooltip-arrow-offset":`${l.arrowOffset}px`,left:l.left,top:l.top,zIndex:q.zIndex}:{...N,visibility:"hidden",zIndex:q.zIndex},children:[m.jsx("span",{"aria-hidden":"true",className:"nk-tooltip__arrow"}),d]})}):null]})}),Fe=Object.assign(Le,{Provider:he});exports.Tooltip2=Fe;
1
+ "use client";"use strict";const m=require("react/jsx-runtime"),n=require("react"),be=require("./aria-DM-xYEHQ.cjs"),W=require("./reference-C2guRuR0.cjs"),G=require("./useFloatingPosition-DPVO2E8O.cjs"),Ee=require("./effects-D98vUn6N.cjs"),F=require("./usePresence-HVr855AK.cjs"),ye=require("./focus-restoration-70WcQRr5.cjs"),Ie=require("./Surface-BttJYSDt.cjs"),he=500,K=n.createContext(null);function De(s){const{children:p,delay:i=he}=s,c=n.useMemo(()=>({delay:i}),[i]);return m.jsx(K.Provider,{value:c,children:p})}const Q=500,J=100;function ve(s,p,i,c){p.current=s,W.assignElementReference(i,s),W.assignElementReference(c,s)}function Pe(s){return Number.isFinite(s)?Math.max(0,s):Q}const Le=n.forwardRef(function(p,i){const{children:c,align:B="center",className:X,content:d,contentClassName:Z,contentStyle:N,delay:ee,disabled:g=!1,onOpenChange:I,placement:S="top",style:ne}=p;if(d==null||typeof d=="boolean"||typeof d=="string"&&!d.trim())throw new Error("Tooltip content must not be empty");if(c.type===n.Fragment)throw new Error("Tooltip requires a single non-Fragment trigger");const V=`${n.useId()}-tooltip`,k=n.useContext(K),O=c.props,A=W.getElementReference(c),T=n.useRef(null),C=n.useRef(null),z=n.useRef(g),_=n.useRef(!1),h=n.useRef(null),D=n.useRef(null),v=n.useRef(null),P=n.useRef(!1),R=n.useRef(!1),w=n.useRef(!1),u=n.useRef(!1),[b,re]=n.useState(null),[te,oe]=n.useState(null),[L,se]=n.useState(!1);z.current=g;const x=Pe(ee??(k==null?void 0:k.delay)??Q),E=F.usePresence(L),Y=(b==null?void 0:b.ownerDocument)??(typeof document>"u"?null:document),M=Ee.useBoundary("Tooltip").boundaryElement,q=F.useOverlayLayer(E.present,M),l=G.useFloatingPosition(E.present,S,b,te,M,B),ce=n.useMemo(()=>[T,C],[]),ie=be.mergeIdentifiers(O["aria-describedby"],V),ue=L&&E.present?ie:O["aria-describedby"],H=n.useCallback(e=>{ve(e,T,A,i),re(e)},[i,A]),le=n.useCallback(e=>{C.current=e,e||(u.current=!1),oe(e)},[]),t=n.useCallback(()=>{const e=h.current;e&&e.ownerWindow.clearTimeout(e.timerId),h.current=null},[]),o=n.useCallback(()=>{const e=D.current;e&&e.ownerWindow.clearTimeout(e.timerId),D.current=null},[]),y=n.useCallback(()=>{const e=v.current;e&&e.ownerWindow.clearTimeout(e.timerId),v.current=null},[]),r=n.useCallback(e=>{_.current!==e&&(e||(u.current=!1),_.current=e,se(e),I==null||I(e))},[I]),j=n.useCallback(e=>{var U,$;if(o(),R.current||w.current||u.current)return;if(e===0){r(!1);return}const a=((U=T.current)==null?void 0:U.ownerDocument.defaultView)??(($=C.current)==null?void 0:$.ownerDocument.defaultView);if(!a){r(!1);return}const f=a.setTimeout(()=>{D.current=null,!R.current&&!w.current&&!u.current&&r(!1)},e);D.current={ownerWindow:a,timerId:f}},[o,r]),ae=n.useCallback(()=>{var f;if(t(),o(),x===0){r(!0);return}const e=(f=T.current)==null?void 0:f.ownerDocument.defaultView;if(!e)return;const a=e.setTimeout(()=>{h.current=null,z.current||r(!0)},x);h.current={ownerWindow:e,timerId:a}},[o,t,x,r]);function fe(e){if(R.current=!0,o(),P.current||ye.isElementFocusRestoration(e.currentTarget)){t();return}t(),r(!0)}function de(e){e.currentTarget.contains(e.relatedTarget)||(R.current=!1,t(),j(0))}function me(){w.current=!0,ae()}function pe(){w.current=!1,t(),j(J)}function ge(){u.current=!0,o()}function Te(){u.current=!1,j(J)}function Re(){var f;t(),o(),r(!1);const e=(f=T.current)==null?void 0:f.ownerDocument.defaultView;if(!e)return;P.current=!0,y();const a=e.setTimeout(()=>{P.current=!1,v.current=null},0);v.current={ownerWindow:e,timerId:a}}if(F.useDismissableLayer({boundary:M,active:L,boundaries:ce,dismissOnOutsideInteraction:"pass-through",layerId:q.id,onEscapeDismiss:()=>r(!1),onOutsideDismiss:()=>r(!1),ownerDocument:Y}),n.useEffect(()=>{g&&(t(),o(),y(),P.current=!1,R.current=!1,w.current=!1,u.current=!1,_.current&&r(!1))},[o,t,y,g,r]),n.useEffect(()=>{},[b]),n.useEffect(()=>()=>{t(),o(),y()},[o,t,y]),g)return n.cloneElement(c,{ref:H});const we=n.cloneElement(c,G.resolveTriggerOverrides(O,{"aria-describedby":ue,className:["nk-tooltip__trigger",X].filter(Boolean).join(" "),onBlur:de,onFocus:fe,onMouseEnter:me,onMouseLeave:pe,onPointerDown:Re,ref:H,style:ne}));return m.jsxs(m.Fragment,{children:[we,E.present&&Y?m.jsx(F.Portal,{children:m.jsxs(Ie.Surface,{ref:le,"aria-hidden":L?void 0:!0,className:["nk-tooltip",Z].filter(Boolean).join(" "),"data-placement":(l==null?void 0:l.placement)??S,"data-align":B,"data-state":E.state==="closing"?"closing":"open",id:V,onMouseEnter:ge,onMouseLeave:Te,role:"tooltip",style:l?{...N,"--nk-tooltip-arrow-offset":`${l.arrowOffset}px`,left:l.left,top:l.top,zIndex:q.zIndex}:{...N,visibility:"hidden",zIndex:q.zIndex},children:[m.jsx("span",{"aria-hidden":"true",className:"nk-tooltip__arrow"}),d]})}):null]})}),Fe=Object.assign(Le,{Provider:De});exports.Tooltip2=Fe;
package/dist/Tooltip.cjs CHANGED
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Tooltip-B2rZmRCs.cjs");exports.default=e.Tooltip2;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Tooltip-tzVg8Bky.cjs");exports.default=e.Tooltip2;
package/dist/Tooltip.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { T as a } from "./Tooltip-4RWCnb2Q.js";
2
+ import { T as a } from "./Tooltip-BuRMZ4p_.js";
3
3
  export {
4
4
  a as default
5
5
  };
@@ -11,8 +11,8 @@ type MarkdownIdentifierOptions = {
11
11
  export declare const MARKDOWN_CLOBBER_PREFIX = "md-";
12
12
  /** Sources a Markdown document may load as images. */
13
13
  export type MarkdownImageSourceAllowlist = "*" | RegExp | readonly RegExp[];
14
- /** The elements produced by the supported CommonMark and GFM syntax. */
15
- export declare const ALLOWED_MARKDOWN_ELEMENTS: readonly ["a", "blockquote", "br", "code", "del", "em", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "img", "input", "li", "ol", "p", "picture", "pre", "section", "source", "strong", "sup", "table", "tbody", "td", "th", "thead", "tr", "ul"];
14
+ /** The elements permitted in Markdown output and sanitized raw HTML. */
15
+ export declare const ALLOWED_MARKDOWN_ELEMENTS: readonly ["a", "b", "blockquote", "br", "code", "del", "details", "em", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "img", "input", "li", "ol", "p", "picture", "pre", "section", "source", "strong", "summary", "sup", "table", "tbody", "td", "th", "thead", "tr", "ul"];
16
16
  /** The final sanitizer schema applied after all Markdown transformations. */
17
17
  export declare const MARKDOWN_SANITIZE_SCHEMA: SanitizeSchema;
18
18
  /**
@@ -14,10 +14,6 @@ export type PopoverProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "de
14
14
  autoFocus?: boolean;
15
15
  /** The interactive content displayed inside the Popover panel. */
16
16
  children: ReactNode;
17
- /** Whether an outside pointer interaction closes the Popover. */
18
- closeOnOutsideInteraction?: boolean;
19
- /** Whether the Escape key closes the Popover. */
20
- closeOnEscape?: boolean;
21
17
  /** Whether an uncontrolled Popover is initially open. */
22
18
  defaultOpen?: boolean;
23
19
  /**
@@ -44,6 +40,11 @@ export type PopoverProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "de
44
40
  align?: PopoverAlignment;
45
41
  /** The preferred placement before collision handling. */
46
42
  placement?: PopoverPlacement;
43
+ /**
44
+ * Whether outside interactions leave the Popover open.
45
+ * Escape and the trigger still close it.
46
+ */
47
+ persistent?: boolean;
47
48
  /** Whether focus returns to the trigger after non-outside closure. */
48
49
  restoreFocus?: boolean;
49
50
  /** Whether keyboard and programmatic focus remain inside the Popover. */
@@ -72,10 +73,6 @@ declare const Popover: import("react").ForwardRefExoticComponent<Omit<HTMLAttrib
72
73
  autoFocus?: boolean;
73
74
  /** The interactive content displayed inside the Popover panel. */
74
75
  children: ReactNode;
75
- /** Whether an outside pointer interaction closes the Popover. */
76
- closeOnOutsideInteraction?: boolean;
77
- /** Whether the Escape key closes the Popover. */
78
- closeOnEscape?: boolean;
79
76
  /** Whether an uncontrolled Popover is initially open. */
80
77
  defaultOpen?: boolean;
81
78
  /**
@@ -102,6 +99,11 @@ declare const Popover: import("react").ForwardRefExoticComponent<Omit<HTMLAttrib
102
99
  align?: PopoverAlignment;
103
100
  /** The preferred placement before collision handling. */
104
101
  placement?: PopoverPlacement;
102
+ /**
103
+ * Whether outside interactions leave the Popover open.
104
+ * Escape and the trigger still close it.
105
+ */
106
+ persistent?: boolean;
105
107
  /** Whether focus returns to the trigger after non-outside closure. */
106
108
  restoreFocus?: boolean;
107
109
  /** Whether keyboard and programmatic focus remain inside the Popover. */
@@ -5,8 +5,11 @@ type DismissableLayerOptions = {
5
5
  active: boolean;
6
6
  /** Whether Escape requests dismissal. */
7
7
  dismissOnEscape?: boolean;
8
- /** Whether a pointer press outside every boundary requests dismissal. */
9
- dismissOnPointerDownOutside?: boolean;
8
+ /**
9
+ * The outside dismissal behavior for the layer.
10
+ * Pass-through dismisses on pointerdown; consume dismisses on click.
11
+ */
12
+ dismissOnOutsideInteraction: "none" | "pass-through" | "consume";
10
13
  /** The boundaries considered part of the layer. */
11
14
  boundaries: readonly RefObject<HTMLElement | null>[];
12
15
  /** The boundary owning the layer's overlay stack. */
@@ -22,10 +25,10 @@ type DismissableLayerOptions = {
22
25
  /** The callback invoked after an allowed Escape interaction. */
23
26
  onEscapeDismiss?: () => void;
24
27
  /** The callback invoked after an allowed outside interaction. */
25
- onPointerDownOutsideDismiss?: () => void;
28
+ onOutsideDismiss?: () => void;
26
29
  };
27
30
  /**
28
- * Adds top-layer Escape and outside-pointer dismissal behavior.
31
+ * Adds top-layer Escape and outside-interaction dismissal behavior.
29
32
  *
30
33
  * @param options - The layer state, boundaries, and dismissal callbacks.
31
34
  */
@@ -19,10 +19,6 @@ export type CustomSelectProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "c
19
19
  * The listbox exposes the requested mode as `data-align` for consumer styles.
20
20
  */
21
21
  align?: SelectAlignment;
22
- /** Whether an outside pointer interaction closes the listbox. */
23
- closeOnOutsideInteraction?: boolean;
24
- /** Whether the Escape key closes the listbox. */
25
- closeOnEscape?: boolean;
26
22
  /** The additional class name applied to the composite Select root. */
27
23
  className?: string;
28
24
  /** The initially selected value for uncontrolled usage. */
@@ -45,6 +41,11 @@ export type CustomSelectProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "c
45
41
  options: readonly SelectOption[];
46
42
  /** The guidance displayed when no option is selected. */
47
43
  placeholder?: string;
44
+ /**
45
+ * Whether outside interactions leave the listbox open.
46
+ * Escape and selection still close it.
47
+ */
48
+ persistent?: boolean;
48
49
  /** The inline styles applied to the composite Select root. */
49
50
  style?: CSSProperties;
50
51
  /** Whether the custom Select communicates that a value is required. */
@@ -8,10 +8,6 @@ export type SelectListboxProps = {
8
8
  active: boolean;
9
9
  /** The preferred horizontal alignment exposed to consumer styles. */
10
10
  align: FloatingAlignment;
11
- /** Whether Escape closes the listbox. */
12
- closeOnEscape: boolean;
13
- /** Whether outside pointer interaction closes the listbox. */
14
- closeOnOutsideInteraction: boolean;
15
11
  /** The highlighted option index. */
16
12
  highlightedIndex: number;
17
13
  /** The identifier assigned to the listbox. */
@@ -34,6 +30,8 @@ export type SelectListboxProps = {
34
30
  options: readonly SelectOption[];
35
31
  /** The document owning the listbox layer. */
36
32
  ownerDocument: Document;
33
+ /** Whether outside interactions leave the listbox open. */
34
+ persistent: boolean;
37
35
  /** The boundary-relative position fitted for the listbox. */
38
36
  position: ListboxPosition | null;
39
37
  /** The selected option value. */