neatkit 0.14.1 → 0.15.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.
Files changed (48) hide show
  1. package/dist/Boundary.cjs +1 -1
  2. package/dist/Boundary.js +1 -1
  3. package/dist/Markdown.cjs +1 -1
  4. package/dist/Markdown.js +1 -1
  5. package/dist/Popover.cjs +1 -1
  6. package/dist/Popover.js +104 -101
  7. package/dist/Select.cjs +1 -1
  8. package/dist/Select.js +321 -310
  9. package/dist/Sidebar.cjs +1 -1
  10. package/dist/Sidebar.js +3 -3
  11. package/dist/{Table-BiRwd6PX.js → Table-Dvi-4XA7.js} +1 -1
  12. package/dist/{Table-DYO-bPlD.cjs → Table-GlG5aITK.cjs} +1 -1
  13. package/dist/Table.cjs +1 -1
  14. package/dist/Table.js +1 -1
  15. package/dist/Tooltip-CDOwCTig.js +229 -0
  16. package/dist/Tooltip-DrAZSmEv.cjs +1 -0
  17. package/dist/Tooltip.cjs +1 -1
  18. package/dist/Tooltip.js +1 -1
  19. package/dist/components/Popover/Popover.d.ts +17 -0
  20. package/dist/components/Popover/index.d.ts +1 -1
  21. package/dist/components/Portal/hooks/useFloatingPosition.d.ts +3 -1
  22. package/dist/components/Portal/utils/floating-alignment.d.ts +18 -0
  23. package/dist/components/Portal/utils/floating-position.d.ts +3 -1
  24. package/dist/components/Select/Select.d.ts +1 -1
  25. package/dist/components/Select/components/CustomSelect.d.ts +9 -0
  26. package/dist/components/Select/components/SelectListbox.d.ts +3 -0
  27. package/dist/components/Select/hooks/useSelectPosition.d.ts +3 -1
  28. package/dist/components/Select/index.d.ts +1 -1
  29. package/dist/components/Select/utils/listbox-position.d.ts +3 -1
  30. package/dist/components/Tooltip/Tooltip.d.ts +10 -0
  31. package/dist/components/Tooltip/index.d.ts +1 -1
  32. package/dist/index.cjs +1 -1
  33. package/dist/index.js +1 -1
  34. package/dist/style.css +1 -1
  35. package/dist/tokens.d.ts +2 -8
  36. package/dist/{units-CpnLv2H4.cjs → units-BEMW4BNr.cjs} +1 -1
  37. package/dist/{units-Bx_CBIy8.js → units-D4Waz9EO.js} +1 -5
  38. package/dist/useAnchoredPosition-BEzN03Oi.cjs +1 -0
  39. package/dist/useAnchoredPosition-BIXEDNSo.js +119 -0
  40. package/dist/useFloatingPosition-8_GSpDjw.cjs +1 -0
  41. package/dist/useFloatingPosition-Cizey9UN.js +58 -0
  42. package/package.json +1 -1
  43. package/dist/Tooltip-CxcO3Vu-.cjs +0 -1
  44. package/dist/Tooltip-WwAWQ_Kq.js +0 -226
  45. package/dist/useAnchoredPosition-C0VS7hm6.js +0 -105
  46. package/dist/useAnchoredPosition-D7GRFzoX.cjs +0 -1
  47. package/dist/useFloatingPosition-DQgw-w_Z.cjs +0 -1
  48. package/dist/useFloatingPosition-MGoyautY.js +0 -57
package/dist/Sidebar.cjs CHANGED
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),t=require("react"),R=require("./effects-D98vUn6N.cjs"),H=require("./reference-C2guRuR0.cjs"),P=require("./usePresence-Dm0mls5p.cjs"),z=require("./Button-pinr6Woy.cjs"),U=require("./Text-DWYlIcPj.cjs"),ae=require("./useFocusTrap-CrMcAu8s.cjs"),oe=require("./useScrollLock-Dy8MZaSn.cjs"),ie=require("./aria-DM-xYEHQ.cjs"),le=require("./useFloatingPosition-DQgw-w_Z.cjs"),ce=require("./Avatar-Belo7qAY.cjs"),ue=require("./Spinner-BE0F4y2S.cjs"),de=require("./Tooltip-CxcO3Vu-.cjs"),fe=require("./units-CpnLv2H4.cjs");function be(s){const{label:n,onToggle:e,panelId:r,reference:b,side:u,sidebarOpen:i}=s;return l.jsx(z.Button,{ref:b,"aria-controls":r,"aria-expanded":i,"aria-haspopup":"dialog","aria-label":n,className:"nk-sidebar__fallback-trigger","data-side":u,icon:"burger",variant:"secondary",size:"large",onClick:e})}const q=new WeakMap;function Z(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=Z(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 me(s){var n;return s?(n=q.get(s))==null?void 0:n.state:void 0}function ge(s,n){if(!s)return()=>{};const e=Z(s);return e.listeners.add(n),()=>{e.listeners.delete(n)}}const ve=()=>{};function O(s){const n=R.useBoundary(s).boundaryElement,e=t.useCallback(b=>ge(n,b),[n]),r=t.useCallback(()=>me(n),[n]);return t.useSyncExternalStore(e,r,ve)}function D(s,n){return s==="both"||s===(n==="overlay"?"overlay":"inline")}const W=t.forwardRef(function(n,e){const{children:r,className:b,presentation:u="both",...i}=n,o=O("Sidebar.Footer");return D(u,o==null?void 0:o.presentation)?l.jsx("div",{...i,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:u,className:i,label:o,presentation:y="both",...p}=n,S=O("Sidebar.Group"),c=`${t.useId()}-label`,h=o!=null&&typeof o!="boolean"&&(typeof o!="string"||o.trim()!=="");if(!D(y,S==null?void 0:S.presentation))return null;const d=b??(r===void 0&&h?c:void 0),a=!!(r??d);return t.createElement(a?"nav":"div",{...p,ref:e,"aria-label":r,"aria-labelledby":d,className:["nk-sidebar__group",i].filter(Boolean).join(" ")},h?l.jsx(U.Text,{as:"h2",className:"nk-sidebar__group-label",id:c,size:"subtitle",weight:"medium",children:o}):null,l.jsx("ul",{className:"nk-sidebar__list",children:u}))}),Se=t.forwardRef(function(n,e){const{children:r,className:b,presentation:u="both",...i}=n,o=O("Sidebar.Header");return D(u,o==null?void 0:o.presentation)?l.jsx("div",{...i,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:u,className:i,disabled:o=!1,icon:y,onClick:p,presentation:S="both",type:c,...h}=n,d=O("Sidebar.Item"),a=b??"button",f=a==="button",m=h,E=m.href!==void 0||m.to!==void 0;function v(k){if(o){k.preventDefault();return}p==null||p(k),d!=null&&d.open&&d.presentation==="overlay"&&!k.defaultPrevented&&d.requestOpenChange(!1,"item")}return D(S,d==null?void 0:d.presentation)?l.jsx("li",{className:"nk-sidebar__item-container",children:l.jsx(z.Button,{...h,ref:e,"aria-current":r?E?"page":"true":void 0,as:a,className:["nk-sidebar__item",i].filter(Boolean).join(" "),"data-active":r||void 0,disabled:o,fullWidth:!0,href:m.href,icon:y,onClick:v,shape:"rectangle",size:"small",textAlignment:"left",type:f?c??"button":c,variant:"ghost",children:l.jsx("span",{className:"nk-sidebar__item-label",children:u})})}):null}),Ee=1;function Ce(s){return s==null?void 0:s.ResizeObserver}function xe(s){return s==null?void 0:s.MutationObserver}function _e(){const[s,n]=t.useState(!1),e=t.useRef(null),r=t.useCallback(i=>{const o=i.scrollHeight-i.scrollTop-i.clientHeight;n(o>Ee)},[]),b=t.useCallback(i=>{var m;if((m=e.current)==null||m.call(e),e.current=null,!i)return;const o=i;r(o);function y(){r(o)}const p=o.ownerDocument.defaultView;p==null||p.addEventListener("resize",y);const S=Ce(p),c=S?new S(y):void 0;function h(){c==null||c.disconnect(),c==null||c.observe(o);for(const E of o.children)c==null||c.observe(E)}h();function d(E){E.some(k=>k.type==="childList")&&h(),y()}const a=xe(p),f=a?new a(d):void 0;f==null||f.observe(o,{attributeFilter:["class","hidden","style"],characterData:!0,childList:!0,subtree:!0}),e.current=()=>{p==null||p.removeEventListener("resize",y),c==null||c.disconnect(),f==null||f.disconnect()}},[r]),u=t.useCallback(i=>{r(i.currentTarget)},[r]);return{containerReference:b,contentBelow:s,handleScroll:u}}function je(s,n){for(const e of t.Children.toArray(s)){if(t.isValidElement(e)&&e.type===t.Fragment){const r=ee(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===W?n.footerChildren.push(e):n.bodyChildren.push(e)}}function ee(s){const n={bodyChildren:[],footerChildren:[]};return je(s,n),n}function ne(s){const{"aria-label":n,"aria-labelledby":e,children:r,className:b,height:u,open:i,panelId:o,panelReference:y,presentation:p,side:S,state:c,style:h,width:d,...a}=s,{containerReference:f,contentBelow:m,handleScroll:E}=_e(),v=p==="overlay",{bodyChildren:k,footerChildren:I}=ee(r),L=n??(e===void 0?"Sidebar":void 0),T=v&&i;let j=h;return(d!==void 0||u!==void 0)&&(j={...h},u!==void 0&&(j["--nk-sidebar-height"]=u),d!==void 0&&(j["--nk-sidebar-width"]=d)),l.jsxs("aside",{...a,ref:y,"aria-hidden":v&&!i?!0:void 0,"aria-label":v&&!i?void 0:L,"aria-labelledby":v&&!i?void 0:e,"aria-modal":T?"true":void 0,className:["nk-sidebar",b].filter(Boolean).join(" "),"data-responsive":p==="pending"||void 0,"data-side":S,"data-state":c,"data-variant":v?"overlay":"inline",id:o,role:T?"dialog":void 0,style:j,tabIndex:v?-1:void 0,children:[l.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:u,presenceState:i,restoreFocus:o,sidebar:y,side:p,...S}=s,{id:c,open:h,requestOpenChange:d}=y,a=t.useContext(P.FocusScopeContext),f=t.useRef(null),[m,E]=t.useState(null),v=R.useBoundary("Sidebar").boundaryElement,k=P.useOverlayLayer(!0,v),I=t.useCallback(B=>{f.current=B,u(B),E(B)},[u]);R.useIsomorphicLayoutEffect(()=>{m&&(m.inert=!h)},[h,m]);const L=t.useCallback(()=>{d(!1,"escape")},[d]),T=t.useCallback(()=>{d(!1,"outside")},[d]);P.useDismissableLayer({boundary:v,active:h,boundaries:n,dismissOnEscape:!0,dismissOnPointerDownOutside:!0,layerId:k.id,onEscapeDismiss:L,onPointerDownOutsideDismiss:T,ownerDocument:b});const j=ae.useFocusTrap({boundary:v,active:h,container:m,initialFocusReference:e??f,layerId:k.id,restoreFocus:o});return oe.useScrollLock(r&&h,b,v),l.jsx(P.FocusScopeContext.Provider,{value:h?j:a,children:l.jsx("div",{className:"nk-sidebar__overlay","data-side":p,"data-state":i,role:"presentation",style:{zIndex:k.zIndex},children:l.jsx(ne,{...S,open:h,panelId:c,panelReference:I,presentation:"overlay",side:p,state:i})})})}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=O("Sidebar.Trigger"),r=n.props,b=H.getElementReference(n),u=e==null?void 0:e.registerTrigger,i=e==null?void 0:e.unregisterTrigger,o=t.useRef(null),y=t.useCallback(f=>{const m=o.current;m&&m!==f&&(i==null||i(m)),o.current=f,f&&(u==null||u(f)),H.assignElementReference(b,f)},[b,u,i]),p=t.useCallback(f=>{f.defaultPrevented||!e||e.requestOpenChange(!e.open,"trigger")},[e]);if(!e)return null;const{id:S,open:c,presentation:h,variant:d}=e,a=c&&h==="overlay";return t.cloneElement(n,le.resolveTriggerOverrides(r,{"aria-controls":a?ie.mergeIdentifiers(r["aria-controls"],S):r["aria-controls"],"aria-expanded":c,"aria-haspopup":r["aria-haspopup"]??"dialog",className:"nk-sidebar__trigger","data-sidebar-variant":d,onClick:p,ref:y}))}const Pe=t.forwardRef(function(n,e){const{actions:r,className:b,description:u,image:i,loading:o=!1,name:y,onClick:p,...S}=n,c=u!=null&&typeof u!="boolean",h=l.jsxs(l.Fragment,{children:[l.jsx(ce.Avatar,{alt:y,"aria-hidden":!0,className:"nk-sidebar__user-avatar",image:i}),l.jsxs("span",{className:"nk-sidebar__user-text",children:[l.jsx(U.Text,{as:"span",className:"nk-sidebar__user-name",children:y}),c?l.jsx(U.Text,{as:"span",className:"nk-sidebar__user-description",size:"caption",tone:"muted",children:u}):null]})]});return l.jsx("div",{...S,ref:e,className:["nk-sidebar__user",b].filter(Boolean).join(" "),children:o?l.jsx(ue.Spinner,{className:"nk-sidebar__user-spinner",size:16}):l.jsxs(l.Fragment,{children:[p?l.jsx("button",{className:"nk-sidebar__user-details",onClick:p,type:"button",children:h}):l.jsx("div",{className:"nk-sidebar__user-details",children:h}),r!==void 0&&r.length>0?l.jsx("div",{className:"nk-sidebar__user-actions",children:r.map(d=>{const{"aria-label":a,icon:f,label:m,...E}=d;return l.jsx(de.Tooltip2,{content:m,children:l.jsx(z.Button,{...E,"aria-label":a??m,className:"nk-sidebar__user-action",icon:f,shape:"rectangle",type:"button",variant:"ghost"})},m)})}):null]})})}),Te=()=>()=>{},X=()=>{};function Ie(s,n){const e=s==="responsive"?n:void 0,r=t.useSyncExternalStore((e==null?void 0:e.subscribe)??Te,(e==null?void 0:e.read)??X,X);return s!=="responsive"?s:r===void 0?"pending":r>=fe.breakpoint("medium")?"inline":"overlay"}const Le=32,Be=t.forwardRef(function(n,e){var Q;const{defaultOpen:r=!1,height:b,initialFocusReference:u,lockScroll:i=!0,onOpenChange:o,open:y,restoreFocus:p=!0,side:S="left",variant:c="responsive",width:h,...d}=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=y!==void 0,[I,L]=t.useState(r),[T,j]=t.useState(0),[B,re]=t.useState(!1),G=t.useRef(null),N=k?y:I,w=t.useRef(o);R.useIsomorphicLayoutEffect(()=>{w.current=o});const F=t.useCallback((g,C)=>{var x;N!==g&&(k||L(g),(x=w.current)==null||x.call(w,g,C))},[k,N]),V=t.useCallback(g=>{E.current=g,H.assignElementReference(e,g)},[e]),_=t.useMemo(()=>[E],[]),$=t.useCallback(g=>{_.push({current:g}),j(C=>C+1)},[_]),K=t.useCallback(g=>{const C=_.findIndex(x=>x.current===g);C>0&&_.splice(C,1),j(x=>Math.max(x-1,0))},[_]),te=t.useCallback(g=>{const C=G.current;if(C&&C!==g){const x=_.findIndex(se=>se.current===C);x>0&&_.splice(x,1)}G.current=g,g&&_.push({current:g})},[_]),A=t.useMemo(()=>({id:f,open:N,presentation:v,registerTrigger:$,requestOpenChange:F,unregisterTrigger:K,variant:c}),[N,f,v,$,F,K,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"&&F(!1,"variant")},[v,F]),t.useEffect(()=>{var x;const g=(x=a==null?void 0:a.boundaryElement)==null?void 0:x.ownerDocument.defaultView;if(!g)return;const C=g.setTimeout(()=>re(!0),Le);return()=>g.clearTimeout(C)},[a==null?void 0:a.boundaryElement]);const M=P.usePresence(N&&v==="overlay"),Y=((Q=a==null?void 0:a.boundaryElement)==null?void 0:Q.ownerDocument)??(typeof document>"u"?null:document);if(v!=="overlay")return l.jsx(ne,{...d,height:b,open:!1,panelId:f,panelReference:V,presentation:v,side:S,width:h});const J=B&&T===0?l.jsx(P.Portal,{children:l.jsx(be,{label:`Open ${d["aria-label"]??"Sidebar"}`,onToggle:()=>F(!N,"trigger"),panelId:M.present?f:void 0,reference:te,side:S,sidebarOpen:N})}):null;return!M.present||!Y?J:l.jsxs(l.Fragment,{children:[J,l.jsx(P.Portal,{children:l.jsx(Ne,{...d,boundaries:_,initialFocusReference:u,lockScroll:i,ownerDocument:Y,panelReference:V,presenceState:M.state==="closing"?"closing":"open",restoreFocus:p,side:S,sidebar:A,width:h})})]})}),Fe=Object.assign(Be,{Footer:W,Group:ye,Header:Se,Item:ke,Trigger:Re,User:Pe});exports.default=Fe;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),t=require("react"),R=require("./effects-D98vUn6N.cjs"),H=require("./reference-C2guRuR0.cjs"),P=require("./usePresence-Dm0mls5p.cjs"),z=require("./Button-pinr6Woy.cjs"),U=require("./Text-DWYlIcPj.cjs"),ae=require("./useFocusTrap-CrMcAu8s.cjs"),oe=require("./useScrollLock-Dy8MZaSn.cjs"),ie=require("./aria-DM-xYEHQ.cjs"),le=require("./useFloatingPosition-8_GSpDjw.cjs"),ce=require("./Avatar-Belo7qAY.cjs"),ue=require("./Spinner-BE0F4y2S.cjs"),de=require("./Tooltip-DrAZSmEv.cjs"),fe=require("./units-BEMW4BNr.cjs");function be(s){const{label:n,onToggle:e,panelId:r,reference:b,side:u,sidebarOpen:i}=s;return l.jsx(z.Button,{ref:b,"aria-controls":r,"aria-expanded":i,"aria-haspopup":"dialog","aria-label":n,className:"nk-sidebar__fallback-trigger","data-side":u,icon:"burger",variant:"secondary",size:"large",onClick:e})}const q=new WeakMap;function Z(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=Z(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 me(s){var n;return s?(n=q.get(s))==null?void 0:n.state:void 0}function ge(s,n){if(!s)return()=>{};const e=Z(s);return e.listeners.add(n),()=>{e.listeners.delete(n)}}const ve=()=>{};function O(s){const n=R.useBoundary(s).boundaryElement,e=t.useCallback(b=>ge(n,b),[n]),r=t.useCallback(()=>me(n),[n]);return t.useSyncExternalStore(e,r,ve)}function D(s,n){return s==="both"||s===(n==="overlay"?"overlay":"inline")}const W=t.forwardRef(function(n,e){const{children:r,className:b,presentation:u="both",...i}=n,o=O("Sidebar.Footer");return D(u,o==null?void 0:o.presentation)?l.jsx("div",{...i,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:u,className:i,label:o,presentation:y="both",...p}=n,S=O("Sidebar.Group"),c=`${t.useId()}-label`,h=o!=null&&typeof o!="boolean"&&(typeof o!="string"||o.trim()!=="");if(!D(y,S==null?void 0:S.presentation))return null;const d=b??(r===void 0&&h?c:void 0),a=!!(r??d);return t.createElement(a?"nav":"div",{...p,ref:e,"aria-label":r,"aria-labelledby":d,className:["nk-sidebar__group",i].filter(Boolean).join(" ")},h?l.jsx(U.Text,{as:"h2",className:"nk-sidebar__group-label",id:c,size:"subtitle",weight:"medium",children:o}):null,l.jsx("ul",{className:"nk-sidebar__list",children:u}))}),Se=t.forwardRef(function(n,e){const{children:r,className:b,presentation:u="both",...i}=n,o=O("Sidebar.Header");return D(u,o==null?void 0:o.presentation)?l.jsx("div",{...i,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:u,className:i,disabled:o=!1,icon:y,onClick:p,presentation:S="both",type:c,...h}=n,d=O("Sidebar.Item"),a=b??"button",f=a==="button",m=h,E=m.href!==void 0||m.to!==void 0;function v(k){if(o){k.preventDefault();return}p==null||p(k),d!=null&&d.open&&d.presentation==="overlay"&&!k.defaultPrevented&&d.requestOpenChange(!1,"item")}return D(S,d==null?void 0:d.presentation)?l.jsx("li",{className:"nk-sidebar__item-container",children:l.jsx(z.Button,{...h,ref:e,"aria-current":r?E?"page":"true":void 0,as:a,className:["nk-sidebar__item",i].filter(Boolean).join(" "),"data-active":r||void 0,disabled:o,fullWidth:!0,href:m.href,icon:y,onClick:v,shape:"rectangle",size:"small",textAlignment:"left",type:f?c??"button":c,variant:"ghost",children:l.jsx("span",{className:"nk-sidebar__item-label",children:u})})}):null}),Ee=1;function Ce(s){return s==null?void 0:s.ResizeObserver}function xe(s){return s==null?void 0:s.MutationObserver}function _e(){const[s,n]=t.useState(!1),e=t.useRef(null),r=t.useCallback(i=>{const o=i.scrollHeight-i.scrollTop-i.clientHeight;n(o>Ee)},[]),b=t.useCallback(i=>{var m;if((m=e.current)==null||m.call(e),e.current=null,!i)return;const o=i;r(o);function y(){r(o)}const p=o.ownerDocument.defaultView;p==null||p.addEventListener("resize",y);const S=Ce(p),c=S?new S(y):void 0;function h(){c==null||c.disconnect(),c==null||c.observe(o);for(const E of o.children)c==null||c.observe(E)}h();function d(E){E.some(k=>k.type==="childList")&&h(),y()}const a=xe(p),f=a?new a(d):void 0;f==null||f.observe(o,{attributeFilter:["class","hidden","style"],characterData:!0,childList:!0,subtree:!0}),e.current=()=>{p==null||p.removeEventListener("resize",y),c==null||c.disconnect(),f==null||f.disconnect()}},[r]),u=t.useCallback(i=>{r(i.currentTarget)},[r]);return{containerReference:b,contentBelow:s,handleScroll:u}}function je(s,n){for(const e of t.Children.toArray(s)){if(t.isValidElement(e)&&e.type===t.Fragment){const r=ee(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===W?n.footerChildren.push(e):n.bodyChildren.push(e)}}function ee(s){const n={bodyChildren:[],footerChildren:[]};return je(s,n),n}function ne(s){const{"aria-label":n,"aria-labelledby":e,children:r,className:b,height:u,open:i,panelId:o,panelReference:y,presentation:p,side:S,state:c,style:h,width:d,...a}=s,{containerReference:f,contentBelow:m,handleScroll:E}=_e(),v=p==="overlay",{bodyChildren:k,footerChildren:I}=ee(r),L=n??(e===void 0?"Sidebar":void 0),T=v&&i;let j=h;return(d!==void 0||u!==void 0)&&(j={...h},u!==void 0&&(j["--nk-sidebar-height"]=u),d!==void 0&&(j["--nk-sidebar-width"]=d)),l.jsxs("aside",{...a,ref:y,"aria-hidden":v&&!i?!0:void 0,"aria-label":v&&!i?void 0:L,"aria-labelledby":v&&!i?void 0:e,"aria-modal":T?"true":void 0,className:["nk-sidebar",b].filter(Boolean).join(" "),"data-responsive":p==="pending"||void 0,"data-side":S,"data-state":c,"data-variant":v?"overlay":"inline",id:o,role:T?"dialog":void 0,style:j,tabIndex:v?-1:void 0,children:[l.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:u,presenceState:i,restoreFocus:o,sidebar:y,side:p,...S}=s,{id:c,open:h,requestOpenChange:d}=y,a=t.useContext(P.FocusScopeContext),f=t.useRef(null),[m,E]=t.useState(null),v=R.useBoundary("Sidebar").boundaryElement,k=P.useOverlayLayer(!0,v),I=t.useCallback(B=>{f.current=B,u(B),E(B)},[u]);R.useIsomorphicLayoutEffect(()=>{m&&(m.inert=!h)},[h,m]);const L=t.useCallback(()=>{d(!1,"escape")},[d]),T=t.useCallback(()=>{d(!1,"outside")},[d]);P.useDismissableLayer({boundary:v,active:h,boundaries:n,dismissOnEscape:!0,dismissOnPointerDownOutside:!0,layerId:k.id,onEscapeDismiss:L,onPointerDownOutsideDismiss:T,ownerDocument:b});const j=ae.useFocusTrap({boundary:v,active:h,container:m,initialFocusReference:e??f,layerId:k.id,restoreFocus:o});return oe.useScrollLock(r&&h,b,v),l.jsx(P.FocusScopeContext.Provider,{value:h?j:a,children:l.jsx("div",{className:"nk-sidebar__overlay","data-side":p,"data-state":i,role:"presentation",style:{zIndex:k.zIndex},children:l.jsx(ne,{...S,open:h,panelId:c,panelReference:I,presentation:"overlay",side:p,state:i})})})}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=O("Sidebar.Trigger"),r=n.props,b=H.getElementReference(n),u=e==null?void 0:e.registerTrigger,i=e==null?void 0:e.unregisterTrigger,o=t.useRef(null),y=t.useCallback(f=>{const m=o.current;m&&m!==f&&(i==null||i(m)),o.current=f,f&&(u==null||u(f)),H.assignElementReference(b,f)},[b,u,i]),p=t.useCallback(f=>{f.defaultPrevented||!e||e.requestOpenChange(!e.open,"trigger")},[e]);if(!e)return null;const{id:S,open:c,presentation:h,variant:d}=e,a=c&&h==="overlay";return t.cloneElement(n,le.resolveTriggerOverrides(r,{"aria-controls":a?ie.mergeIdentifiers(r["aria-controls"],S):r["aria-controls"],"aria-expanded":c,"aria-haspopup":r["aria-haspopup"]??"dialog",className:"nk-sidebar__trigger","data-sidebar-variant":d,onClick:p,ref:y}))}const Pe=t.forwardRef(function(n,e){const{actions:r,className:b,description:u,image:i,loading:o=!1,name:y,onClick:p,...S}=n,c=u!=null&&typeof u!="boolean",h=l.jsxs(l.Fragment,{children:[l.jsx(ce.Avatar,{alt:y,"aria-hidden":!0,className:"nk-sidebar__user-avatar",image:i}),l.jsxs("span",{className:"nk-sidebar__user-text",children:[l.jsx(U.Text,{as:"span",className:"nk-sidebar__user-name",children:y}),c?l.jsx(U.Text,{as:"span",className:"nk-sidebar__user-description",size:"caption",tone:"muted",children:u}):null]})]});return l.jsx("div",{...S,ref:e,className:["nk-sidebar__user",b].filter(Boolean).join(" "),children:o?l.jsx(ue.Spinner,{className:"nk-sidebar__user-spinner",size:16}):l.jsxs(l.Fragment,{children:[p?l.jsx("button",{className:"nk-sidebar__user-details",onClick:p,type:"button",children:h}):l.jsx("div",{className:"nk-sidebar__user-details",children:h}),r!==void 0&&r.length>0?l.jsx("div",{className:"nk-sidebar__user-actions",children:r.map(d=>{const{"aria-label":a,icon:f,label:m,...E}=d;return l.jsx(de.Tooltip2,{content:m,children:l.jsx(z.Button,{...E,"aria-label":a??m,className:"nk-sidebar__user-action",icon:f,shape:"rectangle",type:"button",variant:"ghost"})},m)})}):null]})})}),Te=()=>()=>{},X=()=>{};function Ie(s,n){const e=s==="responsive"?n:void 0,r=t.useSyncExternalStore((e==null?void 0:e.subscribe)??Te,(e==null?void 0:e.read)??X,X);return s!=="responsive"?s:r===void 0?"pending":r>=fe.breakpoint("medium")?"inline":"overlay"}const Le=32,Be=t.forwardRef(function(n,e){var Q;const{defaultOpen:r=!1,height:b,initialFocusReference:u,lockScroll:i=!0,onOpenChange:o,open:y,restoreFocus:p=!0,side:S="left",variant:c="responsive",width:h,...d}=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=y!==void 0,[I,L]=t.useState(r),[T,j]=t.useState(0),[B,re]=t.useState(!1),G=t.useRef(null),N=k?y:I,w=t.useRef(o);R.useIsomorphicLayoutEffect(()=>{w.current=o});const F=t.useCallback((g,C)=>{var x;N!==g&&(k||L(g),(x=w.current)==null||x.call(w,g,C))},[k,N]),V=t.useCallback(g=>{E.current=g,H.assignElementReference(e,g)},[e]),_=t.useMemo(()=>[E],[]),$=t.useCallback(g=>{_.push({current:g}),j(C=>C+1)},[_]),K=t.useCallback(g=>{const C=_.findIndex(x=>x.current===g);C>0&&_.splice(C,1),j(x=>Math.max(x-1,0))},[_]),te=t.useCallback(g=>{const C=G.current;if(C&&C!==g){const x=_.findIndex(se=>se.current===C);x>0&&_.splice(x,1)}G.current=g,g&&_.push({current:g})},[_]),A=t.useMemo(()=>({id:f,open:N,presentation:v,registerTrigger:$,requestOpenChange:F,unregisterTrigger:K,variant:c}),[N,f,v,$,F,K,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"&&F(!1,"variant")},[v,F]),t.useEffect(()=>{var x;const g=(x=a==null?void 0:a.boundaryElement)==null?void 0:x.ownerDocument.defaultView;if(!g)return;const C=g.setTimeout(()=>re(!0),Le);return()=>g.clearTimeout(C)},[a==null?void 0:a.boundaryElement]);const M=P.usePresence(N&&v==="overlay"),Y=((Q=a==null?void 0:a.boundaryElement)==null?void 0:Q.ownerDocument)??(typeof document>"u"?null:document);if(v!=="overlay")return l.jsx(ne,{...d,height:b,open:!1,panelId:f,panelReference:V,presentation:v,side:S,width:h});const J=B&&T===0?l.jsx(P.Portal,{children:l.jsx(be,{label:`Open ${d["aria-label"]??"Sidebar"}`,onToggle:()=>F(!N,"trigger"),panelId:M.present?f:void 0,reference:te,side:S,sidebarOpen:N})}):null;return!M.present||!Y?J:l.jsxs(l.Fragment,{children:[J,l.jsx(P.Portal,{children:l.jsx(Ne,{...d,boundaries:_,initialFocusReference:u,lockScroll:i,ownerDocument:Y,panelReference:V,presenceState:M.state==="closing"?"closing":"open",restoreFocus:p,side:S,sidebar:A,width:h})})]})}),Fe=Object.assign(Be,{Footer:W,Group:ye,Header:Se,Item:ke,Trigger:Re,User:Pe});exports.default=Fe;
package/dist/Sidebar.js CHANGED
@@ -9,11 +9,11 @@ import { T as V } from "./Text-rN6iDo0V.js";
9
9
  import { u as Pe } from "./useFocusTrap-BxPazAL6.js";
10
10
  import { u as Te } from "./useScrollLock-Drd7OZRC.js";
11
11
  import { m as Ie } from "./aria-Bv-xVREf.js";
12
- import { r as Le } from "./useFloatingPosition-MGoyautY.js";
12
+ import { r as Le } from "./useFloatingPosition-Cizey9UN.js";
13
13
  import { A as Re } from "./Avatar-DjDCFqNG.js";
14
14
  import { S as Be } from "./Spinner-CmxlDlOk.js";
15
- import { T as Oe } from "./Tooltip-WwAWQ_Kq.js";
16
- import { b as Fe } from "./units-Bx_CBIy8.js";
15
+ import { T as Oe } from "./Tooltip-CDOwCTig.js";
16
+ import { b as Fe } from "./units-D4Waz9EO.js";
17
17
  function xe(t) {
18
18
  const { label: n, onToggle: e, panelId: r, reference: u, side: l, sidebarOpen: o } = t;
19
19
  return /* @__PURE__ */ p(
@@ -4,7 +4,7 @@ import { createContext as V, forwardRef as _, Children as L, isValidElement as j
4
4
  import { a as G } from "./reference-CXMr27nM.js";
5
5
  import { S as J } from "./Surface-vEFsZC12.js";
6
6
  import { B as Q } from "./Button-DdxB1ps7.js";
7
- import { T as U } from "./Tooltip-WwAWQ_Kq.js";
7
+ import { T as U } from "./Tooltip-CDOwCTig.js";
8
8
  const N = V("body"), I = _(function(l, e) {
9
9
  const {
10
10
  align: t = "left",
@@ -1 +1 @@
1
- "use client";"use strict";const o=require("react/jsx-runtime"),a=require("react"),H=require("./reference-C2guRuR0.cjs"),D=require("./Surface-BttJYSDt.cjs"),K=require("./Button-pinr6Woy.cjs"),O=require("./Tooltip-CxcO3Vu-.cjs"),v=a.createContext("body"),w=a.forwardRef(function(l,e){const{align:t="left",children:s,className:i,scope:c="col",sticky:b=!1,...d}=l;return o.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 a.Children.toArray(n)){if(a.isValidElement(l)&&l.type===a.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 o.jsx(O.Tooltip2,{content:t,children:o.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 o.jsx("td",{className:"nk-table__cell nk-table__action-cell","data-align":"right",onClick:e,children:l.length>0?o.jsx("span",{className:"nk-table__action-list",children:l.map(t=>a.createElement(F,{...t,key:t.label}))}):null})}const q=a.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 o.jsx("tbody",{...b,ref:e,className:["nk-table__body",s].filter(Boolean).join(" "),children:d&&c!==void 0?o.jsxs("tr",{className:"nk-table__row",children:[o.jsx("td",{"aria-hidden":"true",className:"nk-table__cell nk-table__overscroll-start-cell"}),o.jsx("td",{className:"nk-table__cell nk-table__empty-cell",colSpan:h,children:o.jsx("div",{className:"nk-table__empty-content",children:c})}),o.jsx(P,{actions:[]})]}):o.jsx(v.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=a.forwardRef(function(l,e){const{align:t="left",children:s,className:i,format:c,title:b,truncate:d,value:h,...k}=l,{rowTrigger:r,...u}=k,p=z(h,s,c),f=d===void 0?void 0:{maxWidth:d},_=b??(d===void 0?void 0:V(p));return o.jsxs("td",{...u,ref:e,className:["nk-table__cell",i].filter(Boolean).join(" "),"data-align":t,title:_,children:[(r==null?void 0:r.kind)==="link"&&r.linkProperties?o.jsx("a",{ref:r.reference,"aria-label":r.ariaLabel,className:"nk-table__row-trigger",download:r.linkProperties.download,href:r.linkProperties.href,hrefLang:r.linkProperties.hrefLang,onClick:r.linkProperties.onNavigate,rel:r.linkProperties.rel,target:r.linkProperties.target}):null,(r==null?void 0:r.kind)==="button"?o.jsx("button",{ref:r.reference,"aria-label":r.ariaLabel,className:"nk-table__row-trigger",onClick:r.onClick,type:"button"}):null,d!==void 0?o.jsx("span",{className:"nk-table__truncated-content",style:f,children:p}):p]})}),M=a.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return o.jsx("tfoot",{...i,ref:e,className:["nk-table__foot",s].filter(Boolean).join(" "),children:o.jsx(v.Provider,{value:"foot",children:t})})}),Y=a.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return o.jsx("thead",{...i,ref:e,className:["nk-table__head",s].filter(Boolean).join(" "),children:o.jsx(v.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 a.Children.map(i,c=>a.isValidElement(c)?c.type===a.Fragment?a.cloneElement(c,void 0,t(c.props.children)):!e&&c.type===E?(e=!0,a.cloneElement(c,{rowTrigger:l})):c:c)}const s=t(n);return{attached:e,content:s}}const Q=a.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return o.jsx(w,{...i,ref:e,align:"right",className:["nk-table__action-header-cell",s].filter(Boolean).join(" "),children:t??o.jsx("span",{className:"nk-table__visually-hidden",children:"Row actions"})})}),U=a.forwardRef(function(l,e){const{"aria-label":t,actions:s,children:i,className:c,download:b,href:d,hrefLang:h,onClick:k,onNavigate:r,rel:u,target:p,...f}=l,_=a.useRef(null),g=a.useContext(v),j=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 x;d!==void 0?x={ariaLabel:N,kind:"link",linkProperties:{download:b,href:d,hrefLang:h,onNavigate:r,rel:u,target:p},reference:T}:k!==void 0&&(x={ariaLabel:N,kind:"button",onClick:k,reference:T});const B=x?J(i,x):{content:i};function L(m){if(m.defaultPrevented)return;const y=m.target;if(!(y instanceof Element)||G(y,m.currentTarget))return;const C=_.current;if(!C)return;const R=C.ownerDocument.defaultView;if(!R){C.click();return}C.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=g==="head"?o.jsx(Q,{}):o.jsx(P,{actions:s??[]}),I=g==="head"?o.jsx("th",{"aria-hidden":"true",className:"nk-table__header-cell nk-table__overscroll-start-cell"}):o.jsx("td",{"aria-hidden":"true",className:"nk-table__cell nk-table__overscroll-start-cell"});return o.jsxs("tr",{...f,ref:e,"aria-label":j?void 0:t,className:["nk-table__row",c].filter(Boolean).join(" "),"data-interactive":j||void 0,onClick:j?L:void 0,children:[I,B.content,A]})});function W(){const n=a.useRef(null),l=a.useRef(null),[e,t]=a.useState(!1),[s,i]=a.useState(!1);a.useEffect(()=>{const b=n.current,d=l.current;if(!b||!d)return;const h=b,k=d;function r(){const _=h.scrollWidth>h.clientWidth;t(_),_||i(!1)}r();const u=h.ownerDocument.defaultView;u==null||u.addEventListener("resize",r);const p=u==null?void 0:u.ResizeObserver,f=p?new p(r):void 0;return f==null||f.observe(h),f==null||f.observe(k),()=>{u==null||u.removeEventListener("resize",r),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=a.forwardRef(function(l,e){const{"aria-label":t,children:s,className:i,containerClassName:c,frame:b="outline",...d}=l,{containerReference:h,contentReference:k,isScrollable:r,isScrolled:u,handleScroll:p}=W(),f=t?`${t} scroll area`:"Scrollable table",_=a.useCallback(g=>{k.current=g,H.assignElementReference(e,g)},[k,e]);return o.jsx(D.Surface,{ref:h,"aria-label":r?f:void 0,className:["nk-table",c].filter(Boolean).join(" "),"data-frame":b,"data-scrolled":u||void 0,onScroll:p,role:r?"region":void 0,tabIndex:r?0:void 0,children:o.jsx("table",{...d,ref:_,"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 o=require("react/jsx-runtime"),a=require("react"),H=require("./reference-C2guRuR0.cjs"),D=require("./Surface-BttJYSDt.cjs"),K=require("./Button-pinr6Woy.cjs"),O=require("./Tooltip-DrAZSmEv.cjs"),v=a.createContext("body"),w=a.forwardRef(function(l,e){const{align:t="left",children:s,className:i,scope:c="col",sticky:b=!1,...d}=l;return o.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 a.Children.toArray(n)){if(a.isValidElement(l)&&l.type===a.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 o.jsx(O.Tooltip2,{content:t,children:o.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 o.jsx("td",{className:"nk-table__cell nk-table__action-cell","data-align":"right",onClick:e,children:l.length>0?o.jsx("span",{className:"nk-table__action-list",children:l.map(t=>a.createElement(F,{...t,key:t.label}))}):null})}const q=a.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 o.jsx("tbody",{...b,ref:e,className:["nk-table__body",s].filter(Boolean).join(" "),children:d&&c!==void 0?o.jsxs("tr",{className:"nk-table__row",children:[o.jsx("td",{"aria-hidden":"true",className:"nk-table__cell nk-table__overscroll-start-cell"}),o.jsx("td",{className:"nk-table__cell nk-table__empty-cell",colSpan:h,children:o.jsx("div",{className:"nk-table__empty-content",children:c})}),o.jsx(P,{actions:[]})]}):o.jsx(v.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=a.forwardRef(function(l,e){const{align:t="left",children:s,className:i,format:c,title:b,truncate:d,value:h,...k}=l,{rowTrigger:r,...u}=k,p=z(h,s,c),f=d===void 0?void 0:{maxWidth:d},_=b??(d===void 0?void 0:V(p));return o.jsxs("td",{...u,ref:e,className:["nk-table__cell",i].filter(Boolean).join(" "),"data-align":t,title:_,children:[(r==null?void 0:r.kind)==="link"&&r.linkProperties?o.jsx("a",{ref:r.reference,"aria-label":r.ariaLabel,className:"nk-table__row-trigger",download:r.linkProperties.download,href:r.linkProperties.href,hrefLang:r.linkProperties.hrefLang,onClick:r.linkProperties.onNavigate,rel:r.linkProperties.rel,target:r.linkProperties.target}):null,(r==null?void 0:r.kind)==="button"?o.jsx("button",{ref:r.reference,"aria-label":r.ariaLabel,className:"nk-table__row-trigger",onClick:r.onClick,type:"button"}):null,d!==void 0?o.jsx("span",{className:"nk-table__truncated-content",style:f,children:p}):p]})}),M=a.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return o.jsx("tfoot",{...i,ref:e,className:["nk-table__foot",s].filter(Boolean).join(" "),children:o.jsx(v.Provider,{value:"foot",children:t})})}),Y=a.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return o.jsx("thead",{...i,ref:e,className:["nk-table__head",s].filter(Boolean).join(" "),children:o.jsx(v.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 a.Children.map(i,c=>a.isValidElement(c)?c.type===a.Fragment?a.cloneElement(c,void 0,t(c.props.children)):!e&&c.type===E?(e=!0,a.cloneElement(c,{rowTrigger:l})):c:c)}const s=t(n);return{attached:e,content:s}}const Q=a.forwardRef(function(l,e){const{children:t,className:s,...i}=l;return o.jsx(w,{...i,ref:e,align:"right",className:["nk-table__action-header-cell",s].filter(Boolean).join(" "),children:t??o.jsx("span",{className:"nk-table__visually-hidden",children:"Row actions"})})}),U=a.forwardRef(function(l,e){const{"aria-label":t,actions:s,children:i,className:c,download:b,href:d,hrefLang:h,onClick:k,onNavigate:r,rel:u,target:p,...f}=l,_=a.useRef(null),g=a.useContext(v),j=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 x;d!==void 0?x={ariaLabel:N,kind:"link",linkProperties:{download:b,href:d,hrefLang:h,onNavigate:r,rel:u,target:p},reference:T}:k!==void 0&&(x={ariaLabel:N,kind:"button",onClick:k,reference:T});const B=x?J(i,x):{content:i};function L(m){if(m.defaultPrevented)return;const y=m.target;if(!(y instanceof Element)||G(y,m.currentTarget))return;const C=_.current;if(!C)return;const R=C.ownerDocument.defaultView;if(!R){C.click();return}C.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=g==="head"?o.jsx(Q,{}):o.jsx(P,{actions:s??[]}),I=g==="head"?o.jsx("th",{"aria-hidden":"true",className:"nk-table__header-cell nk-table__overscroll-start-cell"}):o.jsx("td",{"aria-hidden":"true",className:"nk-table__cell nk-table__overscroll-start-cell"});return o.jsxs("tr",{...f,ref:e,"aria-label":j?void 0:t,className:["nk-table__row",c].filter(Boolean).join(" "),"data-interactive":j||void 0,onClick:j?L:void 0,children:[I,B.content,A]})});function W(){const n=a.useRef(null),l=a.useRef(null),[e,t]=a.useState(!1),[s,i]=a.useState(!1);a.useEffect(()=>{const b=n.current,d=l.current;if(!b||!d)return;const h=b,k=d;function r(){const _=h.scrollWidth>h.clientWidth;t(_),_||i(!1)}r();const u=h.ownerDocument.defaultView;u==null||u.addEventListener("resize",r);const p=u==null?void 0:u.ResizeObserver,f=p?new p(r):void 0;return f==null||f.observe(h),f==null||f.observe(k),()=>{u==null||u.removeEventListener("resize",r),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=a.forwardRef(function(l,e){const{"aria-label":t,children:s,className:i,containerClassName:c,frame:b="outline",...d}=l,{containerReference:h,contentReference:k,isScrollable:r,isScrolled:u,handleScroll:p}=W(),f=t?`${t} scroll area`:"Scrollable table",_=a.useCallback(g=>{k.current=g,H.assignElementReference(e,g)},[k,e]);return o.jsx(D.Surface,{ref:h,"aria-label":r?f:void 0,className:["nk-table",c].filter(Boolean).join(" "),"data-frame":b,"data-scrolled":u||void 0,onScroll:p,role:r?"region":void 0,tabIndex:r?0:void 0,children:o.jsx("table",{...d,ref:_,"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-DYO-bPlD.cjs");exports.default=e.Table;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Table-GlG5aITK.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-BiRwd6PX.js";
2
+ import { T as a } from "./Table-Dvi-4XA7.js";
3
3
  export {
4
4
  a as default
5
5
  };
@@ -0,0 +1,229 @@
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";
4
+ import { m as Oe } from "./aria-Bv-xVREf.js";
5
+ import { g as _e, a as Q } from "./reference-CXMr27nM.js";
6
+ import { u as Me, r as xe } from "./useFloatingPosition-Cizey9UN.js";
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";
9
+ import { i as Ae } from "./focus-restoration-BvNZzrQA.js";
10
+ import { S as Ce } from "./Surface-vEFsZC12.js";
11
+ const je = 500, ee = he(null);
12
+ function ze(s) {
13
+ const { children: p, delay: u = je } = s, i = Z(() => ({
14
+ delay: u
15
+ }), [u]);
16
+ return /* @__PURE__ */ A(ee.Provider, { value: i, children: p });
17
+ }
18
+ const re = 500, X = 100;
19
+ function Se(s, p, u, i) {
20
+ p.current = s, Q(u, s), Q(i, s);
21
+ }
22
+ function Ye(s) {
23
+ return Number.isFinite(s) ? Math.max(0, s) : re;
24
+ }
25
+ const $e = ve(function(p, u) {
26
+ const {
27
+ children: i,
28
+ align: C = "center",
29
+ className: ne,
30
+ content: m,
31
+ contentClassName: te,
32
+ contentStyle: j,
33
+ delay: oe,
34
+ disabled: g = !1,
35
+ onOpenChange: D,
36
+ placement: z = "top",
37
+ style: se
38
+ } = p;
39
+ if (m == null || typeof m == "boolean" || typeof m == "string" && !m.trim())
40
+ throw new Error("Tooltip content must not be empty");
41
+ if (i.type === Pe)
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);
44
+ $.current = g;
45
+ const x = Ye(
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(
48
+ E.present,
49
+ z,
50
+ b,
51
+ ce,
52
+ W,
53
+ C
54
+ ), ae = Z(
55
+ () => [T, _],
56
+ []
57
+ ), fe = Oe(
58
+ O["aria-describedby"],
59
+ S
60
+ ), de = L && E.present ? fe : O["aria-describedby"], U = c(
61
+ (e) => {
62
+ Se(
63
+ e,
64
+ T,
65
+ Y,
66
+ u
67
+ ), ie(e);
68
+ },
69
+ [u, Y]
70
+ ), me = c(
71
+ (e) => {
72
+ _.current = e, e || (l.current = !1), ue(e);
73
+ },
74
+ []
75
+ ), n = c(() => {
76
+ const e = I.current;
77
+ e && e.ownerWindow.clearTimeout(e.timerId), I.current = null;
78
+ }, []), t = c(() => {
79
+ const e = h.current;
80
+ e && e.ownerWindow.clearTimeout(e.timerId), h.current = null;
81
+ }, []), R = c(() => {
82
+ const e = v.current;
83
+ e && e.ownerWindow.clearTimeout(e.timerId), v.current = null;
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) => {
87
+ var q, G;
88
+ if (t(), w.current || y.current || l.current)
89
+ return;
90
+ if (e === 0) {
91
+ r(!1);
92
+ return;
93
+ }
94
+ const f = ((q = T.current) == null ? void 0 : q.ownerDocument.defaultView) ?? ((G = _.current) == null ? void 0 : G.ownerDocument.defaultView);
95
+ if (!f) {
96
+ r(!1);
97
+ return;
98
+ }
99
+ const d = f.setTimeout(() => {
100
+ h.current = null, !w.current && !y.current && !l.current && r(!1);
101
+ }, e);
102
+ h.current = {
103
+ ownerWindow: f,
104
+ timerId: d
105
+ };
106
+ }, [t, r]), pe = c(() => {
107
+ var d;
108
+ if (n(), t(), x === 0) {
109
+ r(!0);
110
+ return;
111
+ }
112
+ const e = (d = T.current) == null ? void 0 : d.ownerDocument.defaultView;
113
+ if (!e) return;
114
+ const f = e.setTimeout(() => {
115
+ I.current = null, $.current || r(!0);
116
+ }, x);
117
+ I.current = { ownerWindow: e, timerId: f };
118
+ }, [t, n, x, r]);
119
+ function ge(e) {
120
+ if (w.current = !0, t(), P.current || Ae(e.currentTarget)) {
121
+ n();
122
+ return;
123
+ }
124
+ n(), r(!0);
125
+ }
126
+ function Te(e) {
127
+ e.currentTarget.contains(e.relatedTarget) || (w.current = !1, n(), B(0));
128
+ }
129
+ function we() {
130
+ y.current = !0, pe();
131
+ }
132
+ function ye() {
133
+ y.current = !1, n(), B(X);
134
+ }
135
+ function be() {
136
+ l.current = !0, t();
137
+ }
138
+ function Ee() {
139
+ l.current = !1, B(X);
140
+ }
141
+ function Re() {
142
+ var d;
143
+ n(), t(), r(!1);
144
+ const e = (d = T.current) == null ? void 0 : d.ownerDocument.defaultView;
145
+ if (!e) return;
146
+ P.current = !0, R();
147
+ const f = e.setTimeout(() => {
148
+ P.current = !1, v.current = null;
149
+ }, 0);
150
+ v.current = { ownerWindow: e, timerId: f };
151
+ }
152
+ if (Ne({
153
+ boundary: W,
154
+ active: L,
155
+ boundaries: ae,
156
+ dismissOnPointerDownOutside: !0,
157
+ layerId: k.id,
158
+ onEscapeDismiss: () => r(!1),
159
+ onPointerDownOutsideDismiss: () => r(!1),
160
+ ownerDocument: H
161
+ }), V(() => {
162
+ g && (n(), t(), R(), P.current = !1, w.current = !1, y.current = !1, l.current = !1, M.current && r(!1));
163
+ }, [
164
+ t,
165
+ n,
166
+ R,
167
+ g,
168
+ r
169
+ ]), V(() => {
170
+ }, [b]), V(() => () => {
171
+ n(), t(), R();
172
+ }, [t, n, R]), g)
173
+ return K(
174
+ i,
175
+ { ref: U }
176
+ );
177
+ const De = K(
178
+ i,
179
+ xe(O, {
180
+ "aria-describedby": de,
181
+ className: ["nk-tooltip__trigger", ne].filter(Boolean).join(" "),
182
+ onBlur: Te,
183
+ onFocus: ge,
184
+ onMouseEnter: we,
185
+ onMouseLeave: ye,
186
+ onPointerDown: Re,
187
+ ref: U,
188
+ style: se
189
+ })
190
+ );
191
+ return /* @__PURE__ */ J(Ie, { children: [
192
+ De,
193
+ E.present && H ? /* @__PURE__ */ A(Ve, { children: /* @__PURE__ */ J(
194
+ Ce,
195
+ {
196
+ ref: me,
197
+ "aria-hidden": L ? void 0 : !0,
198
+ className: ["nk-tooltip", te].filter(Boolean).join(" "),
199
+ "data-placement": (a == null ? void 0 : a.placement) ?? z,
200
+ "data-align": C,
201
+ "data-state": E.state === "closing" ? "closing" : "open",
202
+ id: S,
203
+ onMouseEnter: be,
204
+ onMouseLeave: Ee,
205
+ role: "tooltip",
206
+ style: a ? {
207
+ ...j,
208
+ "--nk-tooltip-arrow-offset": `${a.arrowOffset}px`,
209
+ left: a.left,
210
+ top: a.top,
211
+ zIndex: k.zIndex
212
+ } : {
213
+ ...j,
214
+ visibility: "hidden",
215
+ zIndex: k.zIndex
216
+ },
217
+ children: [
218
+ /* @__PURE__ */ A("span", { "aria-hidden": "true", className: "nk-tooltip__arrow" }),
219
+ m
220
+ ]
221
+ }
222
+ ) }) : null
223
+ ] });
224
+ }), rr = Object.assign($e, {
225
+ Provider: ze
226
+ });
227
+ export {
228
+ rr as T
229
+ };
@@ -0,0 +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-8_GSpDjw.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;
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-CxcO3Vu-.cjs");exports.default=e.Tooltip2;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Tooltip-DrAZSmEv.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-WwAWQ_Kq.js";
2
+ import { T as a } from "./Tooltip-CDOwCTig.js";
3
3
  export {
4
4
  a as default
5
5
  };
@@ -1,6 +1,9 @@
1
1
  import { type HTMLAttributes, type ReactElement, type ReactNode, type RefObject } from "react";
2
+ import type { FloatingAlignment } from "../Portal/utils/floating-alignment";
2
3
  import type { FloatingPlacement } from "../Portal/utils/floating-position";
3
4
  import "./styles/popover.css";
5
+ /** A type representing the preferred cross-axis alignment of a Popover. */
6
+ export type PopoverAlignment = FloatingAlignment;
4
7
  /** A type representing the preferred placement of a Popover. */
5
8
  export type PopoverPlacement = FloatingPlacement;
6
9
  /** A type representing an interaction that requests a Popover state change. */
@@ -32,6 +35,13 @@ export type PopoverProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "de
32
35
  onPointerDownOutside?: (event: PointerEvent) => void;
33
36
  /** The controlled open state of the Popover. */
34
37
  open?: boolean;
38
+ /**
39
+ * The cross-axis alignment before boundary clamping. Defaults to center.
40
+ * Start/end align left/right on top/bottom, or top/bottom on left/right.
41
+ * This positions the panel without changing its content order.
42
+ * The panel exposes the requested mode as `data-align` for consumer styles.
43
+ */
44
+ align?: PopoverAlignment;
35
45
  /** The preferred placement before collision handling. */
36
46
  placement?: PopoverPlacement;
37
47
  /** Whether focus returns to the trigger after non-outside closure. */
@@ -83,6 +93,13 @@ declare const Popover: import("react").ForwardRefExoticComponent<Omit<HTMLAttrib
83
93
  onPointerDownOutside?: (event: PointerEvent) => void;
84
94
  /** The controlled open state of the Popover. */
85
95
  open?: boolean;
96
+ /**
97
+ * The cross-axis alignment before boundary clamping. Defaults to center.
98
+ * Start/end align left/right on top/bottom, or top/bottom on left/right.
99
+ * This positions the panel without changing its content order.
100
+ * The panel exposes the requested mode as `data-align` for consumer styles.
101
+ */
102
+ align?: PopoverAlignment;
86
103
  /** The preferred placement before collision handling. */
87
104
  placement?: PopoverPlacement;
88
105
  /** Whether focus returns to the trigger after non-outside closure. */
@@ -1,2 +1,2 @@
1
1
  export { default } from "./Popover";
2
- export type { PopoverOpenChangeReason, PopoverPlacement, PopoverProps, } from "./Popover";
2
+ export type { PopoverAlignment, PopoverOpenChangeReason, PopoverPlacement, PopoverProps, } from "./Popover";
@@ -1,3 +1,4 @@
1
+ import type { FloatingAlignment } from "../utils/floating-alignment";
1
2
  import { type FloatingPlacement, type FloatingPosition } from "../utils/floating-position";
2
3
  /**
3
4
  * Keeps anchored floating content aligned and inside its boundary.
@@ -7,7 +8,8 @@ import { type FloatingPlacement, type FloatingPosition } from "../utils/floating
7
8
  * @param trigger - The element anchoring the floating panel.
8
9
  * @param panel - The mounted floating panel.
9
10
  * @param boundary - The boundary the panel is positioned within.
11
+ * @param align - The preferred cross-axis alignment before clamping.
10
12
  *
11
13
  * @returns The boundary-relative coordinates and resolved placement.
12
14
  */
13
- export declare function useFloatingPosition(active: boolean, placement: FloatingPlacement, trigger: HTMLElement | null, panel: HTMLElement | null, boundary: HTMLElement | null): FloatingPosition | null;
15
+ export declare function useFloatingPosition(active: boolean, placement: FloatingPlacement, trigger: HTMLElement | null, panel: HTMLElement | null, boundary: HTMLElement | null, align?: FloatingAlignment): FloatingPosition | null;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * A type representing panel alignment across its placement axis.
3
+ *
4
+ * Start and end mean left and right for top/bottom placements, or top and
5
+ * bottom for left/right placements. Alignment never changes content order.
6
+ */
7
+ export type FloatingAlignment = "start" | "center" | "end";
8
+ /**
9
+ * Aligns a panel with its trigger along one axis before collision handling.
10
+ *
11
+ * @param align - The preferred alignment relative to the trigger.
12
+ * @param triggerStart - The trigger's starting coordinate on this axis.
13
+ * @param triggerSize - The trigger's size along this axis.
14
+ * @param panelSize - The panel's size along this axis.
15
+ *
16
+ * @returns The panel's starting coordinate for the requested alignment.
17
+ */
18
+ export declare function calculateAlignedPosition(align: FloatingAlignment, triggerStart: number, triggerSize: number, panelSize: number): number;
@@ -1,3 +1,4 @@
1
+ import { type FloatingAlignment } from "./floating-alignment";
1
2
  /** A type representing a side available to anchored floating content. */
2
3
  export type FloatingPlacement = "bottom" | "left" | "right" | "top";
3
4
  /** A type representing the measured position of anchored floating content. */
@@ -54,7 +55,8 @@ export declare function getVisibleBounds(boundaryBounds: EdgeBounds, viewportWid
54
55
  * @param triggerBounds - The bounds of the anchoring trigger.
55
56
  * @param panelBounds - The measured bounds of the floating panel.
56
57
  * @param boundaryBounds - The bounds the panel must remain inside.
58
+ * @param align - The preferred cross-axis alignment before clamping.
57
59
  *
58
60
  * @returns The fitted coordinates and resolved floating placement.
59
61
  */
60
- export declare function calculateFloatingPosition(placement: FloatingPlacement, spacing: number, triggerBounds: DOMRect, panelBounds: DOMRect, boundaryBounds: EdgeBounds): FloatingPosition;
62
+ export declare function calculateFloatingPosition(placement: FloatingPlacement, spacing: number, triggerBounds: DOMRect, panelBounds: DOMRect, boundaryBounds: EdgeBounds, align?: FloatingAlignment): FloatingPosition;
@@ -2,7 +2,7 @@ import { type ReactElement, type RefAttributes } from "react";
2
2
  import { type CustomSelectProps } from "./components/CustomSelect";
3
3
  import { type NativeSelectProps } from "./components/NativeSelect";
4
4
  import "./styles/select.css";
5
- export type { CustomSelectProps, SelectDisplayOverride, } from "./components/CustomSelect";
5
+ export type { CustomSelectProps, SelectAlignment, SelectDisplayOverride, } from "./components/CustomSelect";
6
6
  export type { NativeSelectProps } from "./components/NativeSelect";
7
7
  export type { SelectOption } from "./utils/options";
8
8
  /** A type representing properties accepted by either Select mode. */
@@ -1,6 +1,9 @@
1
1
  import { type ButtonHTMLAttributes, type CSSProperties, type ForwardedRef } from "react";
2
2
  import { type IconType } from "../../Icon";
3
+ import type { FloatingAlignment } from "../../Portal/utils/floating-alignment";
3
4
  import { type SelectOption } from "../utils/options";
5
+ /** A type representing the preferred alignment of a Select listbox. */
6
+ export type SelectAlignment = FloatingAlignment;
4
7
  /** A type representing custom trigger content independent of selection. */
5
8
  export type SelectDisplayOverride = {
6
9
  /** The optional icon displayed beside the trigger label. */
@@ -10,6 +13,12 @@ export type SelectDisplayOverride = {
10
13
  };
11
14
  /** A type representing the portal-backed custom Select mode properties. */
12
15
  export type CustomSelectProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "className" | "defaultValue" | "onChange" | "style" | "value"> & {
16
+ /**
17
+ * The listbox's horizontal alignment before boundary clamping.
18
+ * Defaults to start (left); end aligns right without changing item order.
19
+ * The listbox exposes the requested mode as `data-align` for consumer styles.
20
+ */
21
+ align?: SelectAlignment;
13
22
  /** Whether an outside pointer interaction closes the listbox. */
14
23
  closeOnOutsideInteraction?: boolean;
15
24
  /** Whether the Escape key closes the listbox. */
@@ -1,10 +1,13 @@
1
1
  import { type RefObject } from "react";
2
+ import type { FloatingAlignment } from "../../Portal/utils/floating-alignment";
2
3
  import type { ListboxPosition } from "../utils/listbox-position";
3
4
  import type { SelectOption } from "../utils/options";
4
5
  /** A type representing properties used by a mounted custom listbox. */
5
6
  export type SelectListboxProps = {
6
7
  /** Whether the listbox remains interactively open. */
7
8
  active: boolean;
9
+ /** The preferred horizontal alignment exposed to consumer styles. */
10
+ align: FloatingAlignment;
8
11
  /** Whether Escape closes the listbox. */
9
12
  closeOnEscape: boolean;
10
13
  /** Whether outside pointer interaction closes the listbox. */
@@ -1,3 +1,4 @@
1
+ import type { FloatingAlignment } from "../../Portal/utils/floating-alignment";
1
2
  import { type ListboxPosition } from "../utils/listbox-position";
2
3
  /**
3
4
  * Keeps a custom listbox aligned to its trigger and inside its boundary.
@@ -6,7 +7,8 @@ import { type ListboxPosition } from "../utils/listbox-position";
6
7
  * @param trigger - The trigger anchoring the listbox.
7
8
  * @param listbox - The mounted listbox being positioned.
8
9
  * @param boundary - The Boundary that constrains the listbox position.
10
+ * @param align - The preferred horizontal alignment before clamping.
9
11
  *
10
12
  * @returns The boundary-relative coordinates and size constraints.
11
13
  */
12
- export declare function useSelectPosition(active: boolean, trigger: HTMLButtonElement | null, listbox: HTMLDivElement | null, boundary: HTMLElement | null): ListboxPosition | null;
14
+ export declare function useSelectPosition(active: boolean, trigger: HTMLButtonElement | null, listbox: HTMLDivElement | null, boundary: HTMLElement | null, align?: FloatingAlignment): ListboxPosition | null;
@@ -1,2 +1,2 @@
1
1
  export { default } from "./Select";
2
- export type { CustomSelectProps, NativeSelectProps, SelectDisplayOverride, SelectOption, SelectProps, } from "./Select";
2
+ export type { CustomSelectProps, NativeSelectProps, SelectAlignment, SelectDisplayOverride, SelectOption, SelectProps, } from "./Select";
@@ -1,3 +1,4 @@
1
+ import { type FloatingAlignment } from "../../Portal/utils/floating-alignment";
1
2
  import type { EdgeBounds } from "../../Portal/utils/floating-position";
2
3
  /** A type representing the fitted position of a Select listbox. */
3
4
  export type ListboxPosition = {
@@ -22,7 +23,8 @@ export type ListboxPosition = {
22
23
  * @param triggerBounds - The bounds of the trigger anchoring the listbox.
23
24
  * @param listboxBounds - The measured listbox bounds, when it is mounted.
24
25
  * @param boundaryBounds - The bounds the listbox must remain inside.
26
+ * @param align - The preferred horizontal alignment before clamping.
25
27
  *
26
28
  * @returns The fitted listbox coordinates and size constraints.
27
29
  */
28
- export declare function calculateListboxPosition(triggerBounds: DOMRect, listboxBounds: DOMRect | undefined, boundaryBounds: EdgeBounds): ListboxPosition;
30
+ export declare function calculateListboxPosition(triggerBounds: DOMRect, listboxBounds: DOMRect | undefined, boundaryBounds: EdgeBounds, align?: FloatingAlignment): ListboxPosition;
@@ -1,11 +1,21 @@
1
1
  import { type CSSProperties, type ReactElement, type ReactNode } from "react";
2
+ import type { FloatingAlignment } from "../Portal/utils/floating-alignment";
2
3
  import type { FloatingPlacement } from "../Portal/utils/floating-position";
3
4
  import TooltipProvider from "./TooltipProvider";
4
5
  import "./styles/tooltip.css";
6
+ /** A type representing the preferred cross-axis alignment of a Tooltip. */
7
+ export type TooltipAlignment = FloatingAlignment;
5
8
  /** A type representing the preferred placement of a Tooltip. */
6
9
  export type TooltipPlacement = FloatingPlacement;
7
10
  /** A type representing properties for the Tooltip component. */
8
11
  export type TooltipProps = {
12
+ /**
13
+ * The cross-axis alignment before boundary clamping. Defaults to center.
14
+ * Start/end align left/right on top/bottom, or top/bottom on left/right.
15
+ * This positions the panel without changing its content order.
16
+ * The panel exposes the requested mode as `data-align` for consumer styles.
17
+ */
18
+ align?: TooltipAlignment;
9
19
  /**
10
20
  * The single interface element described by the Tooltip.
11
21
  *
@@ -1,3 +1,3 @@
1
1
  export { default } from "./Tooltip";
2
- export type { TooltipPlacement, TooltipProps } from "./Tooltip";
2
+ export type { TooltipAlignment, TooltipPlacement, TooltipProps, } from "./Tooltip";
3
3
  export type { TooltipProviderProps } from "./TooltipProvider";
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./units-CpnLv2H4.cjs");exports.breakpoint=e.breakpoint;exports.cell=e.cell;exports.px=e.px;exports.space=e.space;exports.tokens=e.tokens;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./units-BEMW4BNr.cjs");exports.breakpoint=e.breakpoint;exports.cell=e.cell;exports.px=e.px;exports.space=e.space;exports.tokens=e.tokens;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b as e, c as p, p as o, s as t, t as c } from "./units-Bx_CBIy8.js";
1
+ import { b as e, c as p, p as o, s as t, t as c } from "./units-D4Waz9EO.js";
2
2
  export {
3
3
  e as breakpoint,
4
4
  p as cell,