neatkit 0.7.0 → 0.8.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 (154) hide show
  1. package/dist/Avatar-Belo7qAY.cjs +1 -0
  2. package/dist/Avatar-DjDCFqNG.js +55 -0
  3. package/dist/Avatar.cjs +1 -1
  4. package/dist/Avatar.js +2 -52
  5. package/dist/Boundary.cjs +1 -0
  6. package/dist/Boundary.js +176 -0
  7. package/dist/{Button-BAsLfA0D.js → Button-Chv4O66e.js} +35 -35
  8. package/dist/Button-DCKtFvSo.cjs +1 -0
  9. package/dist/Button.cjs +1 -1
  10. package/dist/Button.js +1 -1
  11. package/dist/Checkbox.cjs +1 -1
  12. package/dist/Checkbox.js +213 -2
  13. package/dist/Code-ClkozPlv.js +227 -0
  14. package/dist/Code-JDb4VFl7.cjs +4 -0
  15. package/dist/Code.cjs +1 -1
  16. package/dist/Code.js +1 -1
  17. package/dist/{Icon-uQmpr5P2.js → Icon-BoEUoOk7.js} +144 -177
  18. package/dist/Icon-DJ4BigRz.cjs +1 -0
  19. package/dist/Icon.cjs +1 -1
  20. package/dist/Icon.js +2 -35
  21. package/dist/Input.cjs +1 -1
  22. package/dist/Input.js +70 -79
  23. package/dist/Markdown.cjs +1 -31
  24. package/dist/Markdown.js +461 -18062
  25. package/dist/Modal.cjs +1 -1
  26. package/dist/Modal.js +100 -122
  27. package/dist/PinInput.cjs +1 -1
  28. package/dist/PinInput.js +1 -1
  29. package/dist/Popover.cjs +1 -1
  30. package/dist/Popover.js +106 -106
  31. package/dist/Radio.cjs +1 -1
  32. package/dist/Radio.js +86 -41
  33. package/dist/Select.cjs +1 -1
  34. package/dist/Select.js +326 -315
  35. package/dist/Sidebar.cjs +1 -0
  36. package/dist/Sidebar.js +475 -0
  37. package/dist/Skeleton.cjs +1 -1
  38. package/dist/Skeleton.js +20 -16
  39. package/dist/Switch.cjs +1 -1
  40. package/dist/Switch.js +1 -1
  41. package/dist/Table-B30TBckZ.js +402 -0
  42. package/dist/Table-DceR12X9.cjs +1 -0
  43. package/dist/Table.cjs +1 -1
  44. package/dist/Table.js +1 -1
  45. package/dist/TextArea.cjs +1 -1
  46. package/dist/TextArea.js +1 -1
  47. package/dist/Tooltip-B4bajPtk.cjs +1 -0
  48. package/dist/Tooltip-BVqdnKK_.js +231 -0
  49. package/dist/Tooltip.cjs +1 -1
  50. package/dist/Tooltip.js +2 -3
  51. package/dist/aria-Bntn6ad_.cjs +1 -0
  52. package/dist/aria-CeA9QfD1.js +15 -0
  53. package/dist/components/Boundary/Boundary.d.ts +65 -0
  54. package/dist/components/Boundary/contexts/BoundaryContext.d.ts +28 -0
  55. package/dist/components/Boundary/hooks/useBoundary.d.ts +19 -0
  56. package/dist/components/Boundary/hooks/useBoundaryWidth.d.ts +23 -0
  57. package/dist/components/Boundary/index.d.ts +2 -0
  58. package/dist/components/Boundary/utils/width.d.ts +11 -0
  59. package/dist/components/Checkbox/Checkbox.d.ts +9 -1
  60. package/dist/components/{CheckboxGroup → Checkbox/components}/CheckboxGroup.d.ts +2 -2
  61. package/dist/components/Checkbox/index.d.ts +1 -0
  62. package/dist/components/Checkbox/utils/checkbox-option.d.ts +17 -0
  63. package/dist/components/Icon/Icon.d.ts +1 -0
  64. package/dist/components/Icon/index.d.ts +0 -33
  65. package/dist/components/Input/Input.d.ts +1 -9
  66. package/dist/components/Modal/Modal.d.ts +0 -4
  67. package/dist/components/PinInput/PinInput.d.ts +1 -1
  68. package/dist/components/Popover/Popover.d.ts +2 -6
  69. package/dist/components/Portal/Portal.d.ts +11 -8
  70. package/dist/components/Portal/hooks/useDismissableLayer.d.ts +2 -0
  71. package/dist/components/Portal/hooks/useFloatingPosition.d.ts +4 -3
  72. package/dist/components/Portal/hooks/useFocusTrap.d.ts +2 -0
  73. package/dist/components/Portal/hooks/useScrollLock.d.ts +9 -3
  74. package/dist/components/Portal/utils/boundary-focus.d.ts +23 -0
  75. package/dist/components/Portal/utils/floating-position.d.ts +43 -9
  76. package/dist/components/Portal/utils/overlay-stack.d.ts +22 -10
  77. package/dist/components/Portal/utils/scroll-container.d.ts +13 -0
  78. package/dist/components/Radio/Radio.d.ts +9 -1
  79. package/dist/components/{RadioGroup → Radio/components}/RadioGroup.d.ts +9 -2
  80. package/dist/components/Radio/index.d.ts +1 -0
  81. package/dist/components/Select/Select.d.ts +0 -2
  82. package/dist/components/Select/utils/listbox-position.d.ts +28 -0
  83. package/dist/components/Sidebar/Sidebar.d.ts +108 -0
  84. package/dist/components/Sidebar/components/SidebarFooter.d.ts +19 -0
  85. package/dist/components/Sidebar/components/SidebarGroup.d.ts +42 -0
  86. package/dist/components/Sidebar/components/SidebarItem.d.ts +43 -0
  87. package/dist/components/Sidebar/components/SidebarOverlay.d.ts +38 -0
  88. package/dist/components/Sidebar/components/SidebarPanel.d.ts +47 -0
  89. package/dist/components/Sidebar/components/SidebarTrigger.d.ts +47 -0
  90. package/dist/components/Sidebar/components/SidebarUser.d.ts +59 -0
  91. package/dist/components/Sidebar/hooks/usePresentation.d.ts +14 -0
  92. package/dist/components/Sidebar/hooks/useSidebar.d.ts +9 -0
  93. package/dist/components/Sidebar/index.d.ts +2 -0
  94. package/dist/components/Sidebar/utils/state.d.ts +62 -0
  95. package/dist/components/Skeleton/Skeleton.d.ts +21 -5
  96. package/dist/components/Table/Table.d.ts +9 -49
  97. package/dist/components/Table/contexts/TableContext.d.ts +4 -0
  98. package/dist/components/Table/index.d.ts +1 -1
  99. package/dist/components/Tooltip/Tooltip.d.ts +10 -4
  100. package/dist/components/Tooltip/TooltipProvider.d.ts +1 -1
  101. package/dist/components/Tooltip/index.d.ts +0 -1
  102. package/dist/effects-D5CWf-Pl.js +8 -0
  103. package/dist/effects-D85L_7zM.cjs +1 -0
  104. package/dist/floating-position-5wJ5G5IT.js +48 -0
  105. package/dist/floating-position-Cy9xxdH4.cjs +1 -0
  106. package/dist/style.css +1 -1
  107. package/dist/tokens.d.ts +1 -0
  108. package/dist/useFloatingPosition-BBEUHPqy.cjs +1 -0
  109. package/dist/useFloatingPosition-CMirP2-2.js +43 -0
  110. package/dist/useFocusTrap-BrFZdMqQ.cjs +1 -0
  111. package/dist/useFocusTrap-DhVnlboe.js +136 -0
  112. package/dist/usePresence-B5RYv4e1.cjs +1 -0
  113. package/dist/usePresence-CqegYqy4.js +221 -0
  114. package/dist/useScrollLock-Drd7OZRC.js +62 -0
  115. package/dist/useScrollLock-Dy8MZaSn.cjs +1 -0
  116. package/dist/utils/aria.d.ts +9 -0
  117. package/dist/utils/effects.d.ts +12 -0
  118. package/package.json +11 -16
  119. package/dist/Button-D7JUO6Fs.cjs +0 -1
  120. package/dist/Checkbox-BvXM9VyY.js +0 -68
  121. package/dist/Checkbox-VQifZrZZ.cjs +0 -1
  122. package/dist/CheckboxGroup.cjs +0 -1
  123. package/dist/CheckboxGroup.js +0 -144
  124. package/dist/Code-BP2ZCmUf.js +0 -7446
  125. package/dist/Code-eispVOW3.cjs +0 -6
  126. package/dist/Content.cjs +0 -1
  127. package/dist/Content.js +0 -144
  128. package/dist/Icon-D8IZceys.cjs +0 -1
  129. package/dist/RadioGroup.cjs +0 -1
  130. package/dist/RadioGroup.js +0 -51
  131. package/dist/RadioGroupContext-BX9KnDek.cjs +0 -1
  132. package/dist/RadioGroupContext-DbKM4zPZ.js +0 -5
  133. package/dist/Table-83unQQOi.cjs +0 -1
  134. package/dist/Table-Cw8u-pEW.js +0 -403
  135. package/dist/Tooltip-BB82wNOE.cjs +0 -1
  136. package/dist/Tooltip-CqWK_GRD.js +0 -236
  137. package/dist/aria-DHnOMyYp.js +0 -10
  138. package/dist/aria-DKxpE8cA.cjs +0 -1
  139. package/dist/components/CheckboxGroup/index.d.ts +0 -2
  140. package/dist/components/Content/Content.d.ts +0 -60
  141. package/dist/components/Content/hooks/useContentLayout.d.ts +0 -18
  142. package/dist/components/Content/index.d.ts +0 -2
  143. package/dist/components/Content/utils/layout.d.ts +0 -11
  144. package/dist/components/RadioGroup/index.d.ts +0 -2
  145. package/dist/useFloatingPosition-CxzhAvy8.js +0 -73
  146. package/dist/useFloatingPosition-D1FqYy0l.cjs +0 -1
  147. package/dist/useFocusTrap--cgjy78G.cjs +0 -1
  148. package/dist/useFocusTrap-Da4nEash.js +0 -134
  149. package/dist/usePresence-DSPt6aKi.js +0 -210
  150. package/dist/usePresence-qe92UTvK.cjs +0 -1
  151. /package/dist/components/{CheckboxGroup → Checkbox}/contexts/CheckboxGroupContext.d.ts +0 -0
  152. /package/dist/components/{CheckboxGroup → Checkbox}/hooks/useCheckboxGroup.d.ts +0 -0
  153. /package/dist/components/{RadioGroup → Radio}/contexts/RadioGroupContext.d.ts +0 -0
  154. /package/dist/components/{RadioGroup → Radio}/hooks/useRadioGroup.d.ts +0 -0
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),s=require("react"),I=require("./effects-D85L_7zM.cjs"),q=require("./reference-C2guRuR0.cjs"),_=require("./usePresence-B5RYv4e1.cjs"),L=require("./Text-DWYlIcPj.cjs"),H=require("./Button-DCKtFvSo.cjs"),Q=require("./useFocusTrap-BrFZdMqQ.cjs"),V=require("./useScrollLock-Dy8MZaSn.cjs"),W=require("./aria-Bntn6ad_.cjs"),X=require("./Avatar-Belo7qAY.cjs"),Y=require("./Spinner-BXgw60UC.cjs"),Z=require("./Tooltip-B4bajPtk.cjs"),ee=require("./units-PzuiQNnw.cjs"),ne=s.forwardRef(function(r,e){const{children:n,className:u,...c}=r;return o.jsx("div",{...c,ref:e,className:["nk-sidebar__footer",u].filter(Boolean).join(" "),children:n})}),P=new WeakMap;function J(i){const r=P.get(i);if(r)return r;const e={listeners:new Set,owner:null,state:void 0};return P.set(i,e),e}function re(i,r,e){const n=J(i);return n.owner!==null&&n.owner!==r?!1:(n.owner=r,n.state=e,n.listeners.forEach(u=>u()),!0)}function se(i,r){const e=P.get(i);!e||e.owner!==r||(e.owner=null,e.state=void 0,e.listeners.forEach(n=>n()))}function te(i){var r;return i?(r=P.get(i))==null?void 0:r.state:void 0}function ae(i,r){if(!i)return()=>{};const e=J(i);return e.listeners.add(r),()=>{e.listeners.delete(r)}}const ie=()=>{};function F(i){const r=_.useBoundary(i).boundaryElement,e=s.useCallback(u=>ae(r,u),[r]),n=s.useCallback(()=>te(r),[r]);return s.useSyncExternalStore(e,n,ie)}const oe=s.forwardRef(function(r,e){const{"aria-label":n,"aria-labelledby":u,children:c,className:f,label:b,presentation:h="both",...m}=r,g=F("Sidebar.Group"),v=`${s.useId()}-label`,l=(g==null?void 0:g.presentation)==="overlay"?"overlay":"inline",p=b!=null&&typeof b!="boolean"&&(typeof b!="string"||b.trim()!=="");if(h!=="both"&&h!==l)return null;const t=u??(n===void 0&&p?v:void 0),a=!!(n??t);return s.createElement(a?"nav":"div",{...m,ref:e,"aria-label":n,"aria-labelledby":t,className:["nk-sidebar__group",f].filter(Boolean).join(" ")},p?o.jsx(L.Text,{as:"h2",className:"nk-sidebar__group-label",id:v,size:"subtitle",weight:"medium",children:b}):null,o.jsx("ul",{className:"nk-sidebar__list",children:c}))}),le=s.forwardRef(function(r,e){const{active:n=!1,as:u,children:c,className:f,disabled:b=!1,icon:h,onClick:m,type:g,...v}=r,l=F("Sidebar.Item"),p=u??"button",t=p==="button",a=v,d=a.href!==void 0||a.to!==void 0;function k(y){if(b){y.preventDefault();return}m==null||m(y),l!=null&&l.open&&l.presentation==="overlay"&&!y.defaultPrevented&&l.requestOpenChange(!1,"item")}return o.jsx("li",{className:"nk-sidebar__item-container",children:o.jsx(H.Button,{...v,ref:e,"aria-current":n?d?"page":"true":void 0,as:p,className:["nk-sidebar__item",f].filter(Boolean).join(" "),"data-active":n||void 0,disabled:b,fullWidth:!0,href:a.href,icon:h,onClick:k,shape:"rectangle",textAlignment:"left",type:t?g??"button":g,variant:"ghost",children:o.jsx("span",{className:"nk-sidebar__item-label",children:c})})})});function K(i){const{"aria-label":r,"aria-labelledby":e,children:n,className:u,top:c,open:f,panelId:b,panelReference:h,presentation:m,side:g,state:v,style:l,width:p,...t}=i,a=m==="overlay",d=r??(e===void 0?"Sidebar":void 0),k=a&&f,y=p===void 0&&c===void 0?l:{...l,...c===void 0?void 0:{"--nk-sidebar-top-offset":c},...p===void 0?void 0:{"--nk-sidebar-width":p}};return o.jsx("aside",{...t,ref:h,"aria-hidden":a&&!f?!0:void 0,"aria-label":a&&!f?void 0:d,"aria-labelledby":a&&!f?void 0:e,"aria-modal":k?"true":void 0,className:["nk-sidebar",u].filter(Boolean).join(" "),"data-responsive":m==="pending"||void 0,"data-side":g,"data-state":v,"data-variant":a?"overlay":"inline",id:b,role:k?"dialog":void 0,style:y,tabIndex:a?-1:void 0,children:o.jsx("div",{className:"nk-sidebar__body",children:n})})}function ce(i){const{boundaries:r,initialFocusReference:e,lockScroll:n,ownerDocument:u,panelReference:c,presenceState:f,restoreFocus:b,sidebar:h,side:m,...g}=i,{id:v,open:l,requestOpenChange:p}=h,t=s.useContext(_.FocusScopeContext),a=s.useRef(null),[d,k]=s.useState(null),y=_.useBoundary("Sidebar").boundaryElement,E=_.useOverlayLayer(!0,y),O=s.useCallback(x=>{a.current=x,c(x),k(x)},[c]);I.useIsomorphicLayoutEffect(()=>{d&&(d.inert=!l)},[l,d]);const T=s.useCallback(()=>{p(!1,"escape")},[p]),j=s.useCallback(()=>{p(!1,"outside")},[p]);_.useDismissableLayer({boundary:y,active:l,boundaries:r,dismissOnEscape:!0,dismissOnPointerDownOutside:!0,layerId:E.id,onEscapeDismiss:T,onPointerDownOutsideDismiss:j,ownerDocument:u});const N=Q.useFocusTrap({boundary:y,active:l,container:d,initialFocusReference:e??a,layerId:E.id,restoreFocus:b});return V.useScrollLock(n&&l,u,y),o.jsx(_.FocusScopeContext.Provider,{value:l?N:t,children:o.jsx("div",{className:"nk-sidebar__overlay","data-side":m,"data-state":f,role:"presentation",style:{zIndex:E.zIndex},children:o.jsx(K,{...g,open:l,panelId:v,panelReference:O,presentation:"overlay",side:m,state:f})})})}function de(i){const{children:r}=i;if(r.type===s.Fragment)throw new Error("Sidebar.Trigger requires a single non-Fragment child");const e=F("Sidebar.Trigger"),n=r.props,u=q.getElementReference(r),c=e==null?void 0:e.registerTrigger,f=e==null?void 0:e.unregisterTrigger,b=s.useRef(null),h=s.useCallback(a=>{const d=b.current;d&&d!==a&&(f==null||f(d)),b.current=a,a&&(c==null||c(a)),q.assignElementReference(u,a)},[u,c,f]),m=s.useCallback(a=>{var d;(d=n.onClick)==null||d.call(n,a),!(a.defaultPrevented||!e)&&e.requestOpenChange(!e.open,"trigger")},[n,e]);if(!e)return null;const{id:g,open:v,presentation:l,variant:p}=e,t=v&&l==="overlay";return s.cloneElement(r,{"aria-controls":t?W.mergeIdentifiers(n["aria-controls"],g):n["aria-controls"],"aria-expanded":v,"aria-haspopup":n["aria-haspopup"]??"dialog",className:[n.className,"nk-sidebar__trigger"].filter(Boolean).join(" "),"data-sidebar-variant":p,onClick:m,ref:h})}const ue=s.forwardRef(function(r,e){const{actions:n,className:u,description:c,image:f,loading:b=!1,name:h,onClick:m,...g}=r,v=c!=null&&typeof c!="boolean",l=o.jsxs(o.Fragment,{children:[o.jsx(X.Avatar,{alt:h,"aria-hidden":!0,className:"nk-sidebar__user-avatar",image:f}),o.jsxs("span",{className:"nk-sidebar__user-text",children:[o.jsx(L.Text,{as:"span",className:"nk-sidebar__user-name",children:h}),v?o.jsx(L.Text,{as:"span",className:"nk-sidebar__user-description",size:"caption",tone:"muted",children:c}):null]})]});return o.jsx("div",{...g,ref:e,className:["nk-sidebar__user",u].filter(Boolean).join(" "),children:b?o.jsx(Y.Spinner,{className:"nk-sidebar__user-spinner",size:16}):o.jsxs(o.Fragment,{children:[m?o.jsx("button",{className:"nk-sidebar__user-details",onClick:m,type:"button",children:l}):o.jsx("div",{className:"nk-sidebar__user-details",children:l}),n!==void 0&&n.length>0?o.jsx("div",{className:"nk-sidebar__user-actions",children:n.map(p=>{const{"aria-label":t,icon:a,label:d,...k}=p;return o.jsx(Z.Tooltip2,{content:d,children:o.jsx(H.Button,{...k,"aria-label":t??d,className:"nk-sidebar__user-action",icon:a,shape:"rectangle",type:"button",variant:"ghost"})},d)})}):null]})})}),be=()=>()=>{},$=()=>{};function pe(i,r){const e=i==="responsive"?r:void 0,n=s.useSyncExternalStore((e==null?void 0:e.subscribe)??be,(e==null?void 0:e.read)??$,$);return i!=="responsive"?i:n===void 0?"pending":n>=ee.breakpoint("md")?"inline":"overlay"}const fe=s.forwardRef(function(r,e){var G;const{defaultOpen:n=!1,initialFocusReference:u,top:c,lockScroll:f=!0,onOpenChange:b,open:h,restoreFocus:m=!0,side:g="start",variant:v="responsive",width:l,...p}=r,t=_.useBoundary("Sidebar"),a=`${s.useId()}-sidebar`,d=s.useRef(Symbol("nk-sidebar")).current,k=s.useRef(null),y=pe(v,t==null?void 0:t.width),E=h!==void 0,[O,T]=s.useState(n),j=E?h:O,N=s.useRef(b);I.useIsomorphicLayoutEffect(()=>{N.current=b});const x=s.useCallback((S,R)=>{var C;j!==S&&(E||T(S),(C=N.current)==null||C.call(N,S,R))},[E,j]),D=s.useCallback(S=>{k.current=S,q.assignElementReference(e??void 0,S)},[e]),w=s.useMemo(()=>[k],[]),A=s.useCallback(S=>{w.push({current:S})},[w]),M=s.useCallback(S=>{const R=w.findIndex(C=>C.current===S);R>0&&w.splice(R,1)},[w]),B=s.useMemo(()=>({id:a,open:j,presentation:y,registerTrigger:A,requestOpenChange:x,unregisterTrigger:M,variant:v}),[j,a,y,A,x,M,v]);I.useIsomorphicLayoutEffect(()=>{const S=t==null?void 0:t.boundaryElement;if(!S)return;if(re(S,d,B)===!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.")},[t==null?void 0:t.boundaryElement,d,B]),I.useIsomorphicLayoutEffect(()=>{const S=t==null?void 0:t.boundaryElement;if(S)return()=>se(S,d)},[t==null?void 0:t.boundaryElement,d]),s.useEffect(()=>{y==="inline"&&x(!1,"variant")},[y,x]);const U=_.usePresence(j&&y==="overlay"),z=((G=t==null?void 0:t.boundaryElement)==null?void 0:G.ownerDocument)??(typeof document>"u"?null:document);return y!=="overlay"?o.jsx(K,{...p,top:c,open:!1,panelId:a,panelReference:D,presentation:y,side:g,width:l}):!U.present||!z?null:o.jsx(_.Portal,{children:o.jsx(ce,{...p,initialFocusReference:u,lockScroll:f,ownerDocument:z,presenceState:U.state==="closing"?"closing":"open",boundaries:w,panelReference:D,restoreFocus:m,sidebar:B,side:g,width:l})})}),me=Object.assign(fe,{Footer:ne,Group:oe,Item:le,Trigger:de,User:ue});exports.default=me;
@@ -0,0 +1,475 @@
1
+ "use client";
2
+ import { jsx as c, jsxs as D, Fragment as J } from "react/jsx-runtime";
3
+ import { forwardRef as B, useCallback as _, useSyncExternalStore as W, useId as X, createElement as ae, useContext as te, useRef as O, useState as Y, Fragment as se, cloneElement as ie, useMemo as K, useEffect as oe } from "react";
4
+ import { u as R } from "./effects-D5CWf-Pl.js";
5
+ import { g as le, a as Z } from "./reference-CXMr27nM.js";
6
+ import { b as A, F as Q, d as ce, e as de, c as ue, P as pe } from "./usePresence-CqegYqy4.js";
7
+ import { T as j } from "./Text-rN6iDo0V.js";
8
+ import { B as ee } from "./Button-Chv4O66e.js";
9
+ import { u as be } from "./useFocusTrap-DhVnlboe.js";
10
+ import { u as fe } from "./useScrollLock-Drd7OZRC.js";
11
+ import { m as me } from "./aria-CeA9QfD1.js";
12
+ import { A as ve } from "./Avatar-DjDCFqNG.js";
13
+ import { S as ge } from "./Spinner-CVYvk6YK.js";
14
+ import { T as ye } from "./Tooltip-BVqdnKK_.js";
15
+ import { b as he } from "./units-BmjPCccF.js";
16
+ const Se = B(
17
+ function(r, e) {
18
+ const { children: n, className: d, ...o } = r;
19
+ return /* @__PURE__ */ c(
20
+ "div",
21
+ {
22
+ ...o,
23
+ ref: e,
24
+ className: ["nk-sidebar__footer", d].filter(Boolean).join(" "),
25
+ children: n
26
+ }
27
+ );
28
+ }
29
+ ), F = /* @__PURE__ */ new WeakMap();
30
+ function ne(t) {
31
+ const r = F.get(t);
32
+ if (r) return r;
33
+ const e = {
34
+ listeners: /* @__PURE__ */ new Set(),
35
+ owner: null,
36
+ state: void 0
37
+ };
38
+ return F.set(t, e), e;
39
+ }
40
+ function _e(t, r, e) {
41
+ const n = ne(t);
42
+ return n.owner !== null && n.owner !== r ? !1 : (n.owner = r, n.state = e, n.listeners.forEach((d) => d()), !0);
43
+ }
44
+ function ke(t, r) {
45
+ const e = F.get(t);
46
+ !e || e.owner !== r || (e.owner = null, e.state = void 0, e.listeners.forEach((n) => n()));
47
+ }
48
+ function Ee(t) {
49
+ var r;
50
+ return t ? (r = F.get(t)) == null ? void 0 : r.state : void 0;
51
+ }
52
+ function Ne(t, r) {
53
+ if (!t) return () => {
54
+ };
55
+ const e = ne(t);
56
+ return e.listeners.add(r), () => {
57
+ e.listeners.delete(r);
58
+ };
59
+ }
60
+ const Pe = () => {
61
+ };
62
+ function U(t) {
63
+ const r = A(t).boundaryElement, e = _(
64
+ (d) => Ne(r, d),
65
+ [r]
66
+ ), n = _(() => Ee(r), [r]);
67
+ return W(e, n, Pe);
68
+ }
69
+ const we = B(
70
+ function(r, e) {
71
+ const {
72
+ "aria-label": n,
73
+ "aria-labelledby": d,
74
+ children: o,
75
+ className: b,
76
+ label: u,
77
+ presentation: y = "both",
78
+ ...f
79
+ } = r, g = U("Sidebar.Group"), m = `${X()}-label`, i = (g == null ? void 0 : g.presentation) === "overlay" ? "overlay" : "inline", p = u != null && typeof u != "boolean" && (typeof u != "string" || u.trim() !== "");
80
+ if (y !== "both" && y !== i)
81
+ return null;
82
+ const a = d ?? (n === void 0 && p ? m : void 0);
83
+ return ae(
84
+ !!(n ?? a) ? "nav" : "div",
85
+ {
86
+ ...f,
87
+ ref: e,
88
+ "aria-label": n,
89
+ "aria-labelledby": a,
90
+ className: ["nk-sidebar__group", b].filter(Boolean).join(" ")
91
+ },
92
+ p ? /* @__PURE__ */ c(
93
+ j,
94
+ {
95
+ as: "h2",
96
+ className: "nk-sidebar__group-label",
97
+ id: m,
98
+ size: "subtitle",
99
+ weight: "medium",
100
+ children: u
101
+ }
102
+ ) : null,
103
+ /* @__PURE__ */ c("ul", { className: "nk-sidebar__list", children: o })
104
+ );
105
+ }
106
+ ), Ie = B(
107
+ function(r, e) {
108
+ const {
109
+ active: n = !1,
110
+ as: d,
111
+ children: o,
112
+ className: b,
113
+ disabled: u = !1,
114
+ icon: y,
115
+ onClick: f,
116
+ type: g,
117
+ ...m
118
+ } = r, i = U("Sidebar.Item"), p = d ?? "button", a = p === "button", s = m, l = s.href !== void 0 || s.to !== void 0;
119
+ function S(v) {
120
+ if (u) {
121
+ v.preventDefault();
122
+ return;
123
+ }
124
+ f == null || f(v), i != null && i.open && i.presentation === "overlay" && !v.defaultPrevented && i.requestOpenChange(!1, "item");
125
+ }
126
+ return /* @__PURE__ */ c("li", { className: "nk-sidebar__item-container", children: /* @__PURE__ */ c(
127
+ ee,
128
+ {
129
+ ...m,
130
+ ref: e,
131
+ "aria-current": n ? l ? "page" : "true" : void 0,
132
+ as: p,
133
+ className: ["nk-sidebar__item", b].filter(Boolean).join(" "),
134
+ "data-active": n || void 0,
135
+ disabled: u,
136
+ fullWidth: !0,
137
+ href: s.href,
138
+ icon: y,
139
+ onClick: S,
140
+ shape: "rectangle",
141
+ textAlignment: "left",
142
+ type: a ? g ?? "button" : g,
143
+ variant: "ghost",
144
+ children: /* @__PURE__ */ c("span", { className: "nk-sidebar__item-label", children: o })
145
+ }
146
+ ) });
147
+ }
148
+ );
149
+ function re(t) {
150
+ const {
151
+ "aria-label": r,
152
+ "aria-labelledby": e,
153
+ children: n,
154
+ className: d,
155
+ top: o,
156
+ open: b,
157
+ panelId: u,
158
+ panelReference: y,
159
+ presentation: f,
160
+ side: g,
161
+ state: m,
162
+ style: i,
163
+ width: p,
164
+ ...a
165
+ } = t, s = f === "overlay", l = r ?? (e === void 0 ? "Sidebar" : void 0), S = s && b, v = p === void 0 && o === void 0 ? i : {
166
+ ...i,
167
+ ...o === void 0 ? void 0 : { "--nk-sidebar-top-offset": o },
168
+ ...p === void 0 ? void 0 : { "--nk-sidebar-width": p }
169
+ };
170
+ return /* @__PURE__ */ c(
171
+ "aside",
172
+ {
173
+ ...a,
174
+ ref: y,
175
+ "aria-hidden": s && !b ? !0 : void 0,
176
+ "aria-label": s && !b ? void 0 : l,
177
+ "aria-labelledby": s && !b ? void 0 : e,
178
+ "aria-modal": S ? "true" : void 0,
179
+ className: ["nk-sidebar", d].filter(Boolean).join(" "),
180
+ "data-responsive": f === "pending" || void 0,
181
+ "data-side": g,
182
+ "data-state": m,
183
+ "data-variant": s ? "overlay" : "inline",
184
+ id: u,
185
+ role: S ? "dialog" : void 0,
186
+ style: v,
187
+ tabIndex: s ? -1 : void 0,
188
+ children: /* @__PURE__ */ c("div", { className: "nk-sidebar__body", children: n })
189
+ }
190
+ );
191
+ }
192
+ function Oe(t) {
193
+ const {
194
+ boundaries: r,
195
+ initialFocusReference: e,
196
+ lockScroll: n,
197
+ ownerDocument: d,
198
+ panelReference: o,
199
+ presenceState: b,
200
+ restoreFocus: u,
201
+ sidebar: y,
202
+ side: f,
203
+ ...g
204
+ } = t, { id: m, open: i, requestOpenChange: p } = y, a = te(Q), s = O(null), [l, S] = Y(null), v = A("Sidebar").boundaryElement, E = ce(!0, v), L = _((k) => {
205
+ s.current = k, o(k), S(k);
206
+ }, [o]);
207
+ R(() => {
208
+ l && (l.inert = !i);
209
+ }, [i, l]);
210
+ const x = _(() => {
211
+ p(!1, "escape");
212
+ }, [p]), N = _(() => {
213
+ p(!1, "outside");
214
+ }, [p]);
215
+ de({
216
+ boundary: v,
217
+ active: i,
218
+ boundaries: r,
219
+ dismissOnEscape: !0,
220
+ dismissOnPointerDownOutside: !0,
221
+ layerId: E.id,
222
+ onEscapeDismiss: x,
223
+ onPointerDownOutsideDismiss: N,
224
+ ownerDocument: d
225
+ });
226
+ const P = be({
227
+ boundary: v,
228
+ active: i,
229
+ container: l,
230
+ initialFocusReference: e ?? s,
231
+ layerId: E.id,
232
+ restoreFocus: u
233
+ });
234
+ return fe(n && i, d, v), /* @__PURE__ */ c(
235
+ Q.Provider,
236
+ {
237
+ value: i ? P : a,
238
+ children: /* @__PURE__ */ c(
239
+ "div",
240
+ {
241
+ className: "nk-sidebar__overlay",
242
+ "data-side": f,
243
+ "data-state": b,
244
+ role: "presentation",
245
+ style: { zIndex: E.zIndex },
246
+ children: /* @__PURE__ */ c(
247
+ re,
248
+ {
249
+ ...g,
250
+ open: i,
251
+ panelId: m,
252
+ panelReference: L,
253
+ presentation: "overlay",
254
+ side: f,
255
+ state: b
256
+ }
257
+ )
258
+ }
259
+ )
260
+ }
261
+ );
262
+ }
263
+ function Be(t) {
264
+ const { children: r } = t;
265
+ if (r.type === se)
266
+ throw new Error("Sidebar.Trigger requires a single non-Fragment child");
267
+ const e = U("Sidebar.Trigger"), n = r.props, d = le(r), o = e == null ? void 0 : e.registerTrigger, b = e == null ? void 0 : e.unregisterTrigger, u = O(null), y = _((s) => {
268
+ const l = u.current;
269
+ l && l !== s && (b == null || b(l)), u.current = s, s && (o == null || o(s)), Z(d, s);
270
+ }, [d, o, b]), f = _((s) => {
271
+ var l;
272
+ (l = n.onClick) == null || l.call(n, s), !(s.defaultPrevented || !e) && e.requestOpenChange(!e.open, "trigger");
273
+ }, [n, e]);
274
+ if (!e) return null;
275
+ const { id: g, open: m, presentation: i, variant: p } = e;
276
+ return ie(
277
+ r,
278
+ {
279
+ "aria-controls": m && i === "overlay" ? me(n["aria-controls"], g) : n["aria-controls"],
280
+ "aria-expanded": m,
281
+ "aria-haspopup": n["aria-haspopup"] ?? "dialog",
282
+ className: [n.className, "nk-sidebar__trigger"].filter(Boolean).join(" "),
283
+ "data-sidebar-variant": p,
284
+ onClick: f,
285
+ ref: y
286
+ }
287
+ );
288
+ }
289
+ const Te = B(
290
+ function(r, e) {
291
+ const {
292
+ actions: n,
293
+ className: d,
294
+ description: o,
295
+ image: b,
296
+ loading: u = !1,
297
+ name: y,
298
+ onClick: f,
299
+ ...g
300
+ } = r, m = o != null && typeof o != "boolean", i = /* @__PURE__ */ D(J, { children: [
301
+ /* @__PURE__ */ c(
302
+ ve,
303
+ {
304
+ alt: y,
305
+ "aria-hidden": !0,
306
+ className: "nk-sidebar__user-avatar",
307
+ image: b
308
+ }
309
+ ),
310
+ /* @__PURE__ */ D("span", { className: "nk-sidebar__user-text", children: [
311
+ /* @__PURE__ */ c(j, { as: "span", className: "nk-sidebar__user-name", children: y }),
312
+ m ? /* @__PURE__ */ c(
313
+ j,
314
+ {
315
+ as: "span",
316
+ className: "nk-sidebar__user-description",
317
+ size: "caption",
318
+ tone: "muted",
319
+ children: o
320
+ }
321
+ ) : null
322
+ ] })
323
+ ] });
324
+ return /* @__PURE__ */ c(
325
+ "div",
326
+ {
327
+ ...g,
328
+ ref: e,
329
+ className: ["nk-sidebar__user", d].filter(Boolean).join(" "),
330
+ children: u ? /* @__PURE__ */ c(ge, { className: "nk-sidebar__user-spinner", size: 16 }) : /* @__PURE__ */ D(J, { children: [
331
+ f ? /* @__PURE__ */ c(
332
+ "button",
333
+ {
334
+ className: "nk-sidebar__user-details",
335
+ onClick: f,
336
+ type: "button",
337
+ children: i
338
+ }
339
+ ) : /* @__PURE__ */ c("div", { className: "nk-sidebar__user-details", children: i }),
340
+ n !== void 0 && n.length > 0 ? /* @__PURE__ */ c("div", { className: "nk-sidebar__user-actions", children: n.map((p) => {
341
+ const {
342
+ "aria-label": a,
343
+ icon: s,
344
+ label: l,
345
+ ...S
346
+ } = p;
347
+ return /* @__PURE__ */ c(ye, { content: l, children: /* @__PURE__ */ c(
348
+ ee,
349
+ {
350
+ ...S,
351
+ "aria-label": a ?? l,
352
+ className: "nk-sidebar__user-action",
353
+ icon: s,
354
+ shape: "rectangle",
355
+ type: "button",
356
+ variant: "ghost"
357
+ }
358
+ ) }, l);
359
+ }) }) : null
360
+ ] })
361
+ }
362
+ );
363
+ }
364
+ ), Re = () => () => {
365
+ }, V = () => {
366
+ };
367
+ function Fe(t, r) {
368
+ const e = t === "responsive" ? r : void 0, n = W(
369
+ (e == null ? void 0 : e.subscribe) ?? Re,
370
+ (e == null ? void 0 : e.read) ?? V,
371
+ V
372
+ );
373
+ return t !== "responsive" ? t : n === void 0 ? "pending" : n >= he("md") ? "inline" : "overlay";
374
+ }
375
+ const Le = B(function(r, e) {
376
+ var H;
377
+ const {
378
+ defaultOpen: n = !1,
379
+ initialFocusReference: d,
380
+ top: o,
381
+ lockScroll: b = !0,
382
+ onOpenChange: u,
383
+ open: y,
384
+ restoreFocus: f = !0,
385
+ side: g = "start",
386
+ variant: m = "responsive",
387
+ width: i,
388
+ ...p
389
+ } = r, a = A("Sidebar"), s = `${X()}-sidebar`, l = O(Symbol("nk-sidebar")).current, S = O(null), v = Fe(m, a == null ? void 0 : a.width), E = y !== void 0, [L, x] = Y(n), N = E ? y : L, P = O(u);
390
+ R(() => {
391
+ P.current = u;
392
+ });
393
+ const k = _((h, I) => {
394
+ var T;
395
+ N !== h && (E || x(h), (T = P.current) == null || T.call(P, h, I));
396
+ }, [E, N]), q = _((h) => {
397
+ S.current = h, Z(e ?? void 0, h);
398
+ }, [e]), w = K(
399
+ () => [S],
400
+ []
401
+ ), z = _((h) => {
402
+ w.push({ current: h });
403
+ }, [w]), G = _((h) => {
404
+ const I = w.findIndex((T) => T.current === h);
405
+ I > 0 && w.splice(I, 1);
406
+ }, [w]), C = K(() => ({
407
+ id: s,
408
+ open: N,
409
+ presentation: v,
410
+ registerTrigger: z,
411
+ requestOpenChange: k,
412
+ unregisterTrigger: G,
413
+ variant: m
414
+ }), [
415
+ N,
416
+ s,
417
+ v,
418
+ z,
419
+ k,
420
+ G,
421
+ m
422
+ ]);
423
+ R(() => {
424
+ const h = a == null ? void 0 : a.boundaryElement;
425
+ if (!h) return;
426
+ if (_e(h, l, C) === !1)
427
+ throw new Error(
428
+ "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."
429
+ );
430
+ }, [a == null ? void 0 : a.boundaryElement, l, C]), R(() => {
431
+ const h = a == null ? void 0 : a.boundaryElement;
432
+ if (h)
433
+ return () => ke(h, l);
434
+ }, [a == null ? void 0 : a.boundaryElement, l]), oe(() => {
435
+ v === "inline" && k(!1, "variant");
436
+ }, [v, k]);
437
+ const M = ue(N && v === "overlay"), $ = ((H = a == null ? void 0 : a.boundaryElement) == null ? void 0 : H.ownerDocument) ?? (typeof document > "u" ? null : document);
438
+ return v !== "overlay" ? /* @__PURE__ */ c(
439
+ re,
440
+ {
441
+ ...p,
442
+ top: o,
443
+ open: !1,
444
+ panelId: s,
445
+ panelReference: q,
446
+ presentation: v,
447
+ side: g,
448
+ width: i
449
+ }
450
+ ) : !M.present || !$ ? null : /* @__PURE__ */ c(pe, { children: /* @__PURE__ */ c(
451
+ Oe,
452
+ {
453
+ ...p,
454
+ initialFocusReference: d,
455
+ lockScroll: b,
456
+ ownerDocument: $,
457
+ presenceState: M.state === "closing" ? "closing" : "open",
458
+ boundaries: w,
459
+ panelReference: q,
460
+ restoreFocus: f,
461
+ sidebar: C,
462
+ side: g,
463
+ width: i
464
+ }
465
+ ) });
466
+ }), Qe = Object.assign(Le, {
467
+ Footer: Se,
468
+ Group: we,
469
+ Item: Ie,
470
+ Trigger: Be,
471
+ User: Te
472
+ });
473
+ export {
474
+ Qe as default
475
+ };
package/dist/Skeleton.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react/jsx-runtime"),c=require("react"),u=c.forwardRef(function(t,r){const{"aria-hidden":a=!0,className:n,height:i="1em",shape:e="rectangle",style:s,width:l=e==="circle"?"1em":"100%",...o}=t;return d.jsx("div",{...o,ref:r,"aria-hidden":a,className:["nk-skeleton",n].filter(Boolean).join(" "),"data-shape":e,style:{...s,width:l,height:i}})});exports.default=u;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),u=require("react"),c=u.forwardRef(function(i,a){const{"aria-hidden":o=!0,className:r,height:e,shape:n="rectangle",style:s,width:t,...d}=i;return l.jsx("div",{...d,ref:a,"aria-hidden":o,className:["nk-skeleton",r].filter(Boolean).join(" "),"data-shape":n,style:{...e===void 0?void 0:{height:e},...t===void 0?void 0:{width:t},...s}})});exports.default=c;
package/dist/Skeleton.js CHANGED
@@ -1,24 +1,28 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import { forwardRef as m } from "react";
3
- const p = m(function(t, a) {
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { forwardRef as f } from "react";
3
+ const p = f(function(t, a) {
4
4
  const {
5
- "aria-hidden": r = !0,
6
- className: n,
7
- height: o = "1em",
8
- shape: e = "rectangle",
9
- style: i,
10
- width: s = e === "circle" ? "1em" : "100%",
11
- ...l
5
+ "aria-hidden": i = !0,
6
+ className: r,
7
+ height: e,
8
+ shape: n = "rectangle",
9
+ style: d,
10
+ width: o,
11
+ ...s
12
12
  } = t;
13
- return /* @__PURE__ */ d(
13
+ return /* @__PURE__ */ l(
14
14
  "div",
15
15
  {
16
- ...l,
16
+ ...s,
17
17
  ref: a,
18
- "aria-hidden": r,
19
- className: ["nk-skeleton", n].filter(Boolean).join(" "),
20
- "data-shape": e,
21
- style: { ...i, width: s, height: o }
18
+ "aria-hidden": i,
19
+ className: ["nk-skeleton", r].filter(Boolean).join(" "),
20
+ "data-shape": n,
21
+ style: {
22
+ ...e === void 0 ? void 0 : { height: e },
23
+ ...o === void 0 ? void 0 : { width: o },
24
+ ...d
25
+ }
22
26
  }
23
27
  );
24
28
  });
package/dist/Switch.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),l=require("react"),d=require("./aria-DKxpE8cA.cjs"),o=l.forwardRef(function(s,t){const{"aria-invalid":e,className:n,disabled:i=!1,style:r,...c}=s;return a.jsxs("span",{className:["nk-switch",n].filter(Boolean).join(" "),"data-disabled":i||void 0,"data-invalid":d.hasInvalidState(e)||void 0,style:r,children:[a.jsx("input",{...c,ref:t,"aria-invalid":e,className:"nk-switch__control",disabled:i,role:"switch",type:"checkbox"}),a.jsx("span",{"aria-hidden":"true",className:"nk-switch__track",children:a.jsx("span",{className:"nk-switch__thumb"})})]})});exports.default=o;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),l=require("react"),d=require("./aria-Bntn6ad_.cjs"),o=l.forwardRef(function(s,t){const{"aria-invalid":e,className:n,disabled:i=!1,style:r,...c}=s;return a.jsxs("span",{className:["nk-switch",n].filter(Boolean).join(" "),"data-disabled":i||void 0,"data-invalid":d.hasInvalidState(e)||void 0,style:r,children:[a.jsx("input",{...c,ref:t,"aria-invalid":e,className:"nk-switch__control",disabled:i,role:"switch",type:"checkbox"}),a.jsx("span",{"aria-hidden":"true",className:"nk-switch__track",children:a.jsx("span",{className:"nk-switch__thumb"})})]})});exports.default=o;
package/dist/Switch.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsxs as l, jsx as a } from "react/jsx-runtime";
2
2
  import { forwardRef as o } from "react";
3
- import { h as d } from "./aria-DHnOMyYp.js";
3
+ import { h as d } from "./aria-CeA9QfD1.js";
4
4
  const w = o(function(t, n) {
5
5
  const {
6
6
  "aria-invalid": i,