neatkit 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Button-DU4j_IED.cjs → Button-CVe9T_Zw.cjs} +1 -1
- package/dist/{Button-BV5OUXpc.js → Button-D6rXvcqq.js} +1 -1
- package/dist/Button.cjs +1 -1
- package/dist/Button.js +1 -1
- package/dist/Checkbox.cjs +1 -1
- package/dist/Checkbox.js +111 -110
- package/dist/Input.cjs +1 -1
- package/dist/Input.js +52 -51
- package/dist/Markdown.cjs +1 -1
- package/dist/Markdown.js +1 -1
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.js +57 -56
- package/dist/PinInput.cjs +1 -1
- package/dist/PinInput.js +88 -87
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.js +2 -2
- package/dist/Progress.cjs +1 -0
- package/dist/Progress.js +40 -0
- package/dist/Radio.cjs +1 -1
- package/dist/Radio.js +48 -47
- package/dist/Select.cjs +1 -1
- package/dist/Select.js +363 -359
- package/dist/Sidebar.cjs +1 -1
- package/dist/Sidebar.js +44 -44
- package/dist/Spinner-BE0F4y2S.cjs +1 -0
- package/dist/Spinner-CmxlDlOk.js +23 -0
- package/dist/Spinner.cjs +1 -1
- package/dist/Spinner.js +1 -1
- package/dist/{Table-qetwZpTC.cjs → Table-BqWBgMTU.cjs} +1 -1
- package/dist/{Table-CADupJEU.js → Table-DutHfiXR.js} +2 -2
- package/dist/Table.cjs +1 -1
- package/dist/Table.js +1 -1
- package/dist/{Tooltip-B2d5ss7S.cjs → Tooltip-CCuE-hfp.cjs} +1 -1
- package/dist/{Tooltip-BK64rkxV.js → Tooltip-CeyRKNv4.js} +1 -1
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/components/Portal/hooks/useAnchoredPosition.d.ts +59 -0
- package/dist/components/Progress/Progress.d.ts +38 -0
- package/dist/components/Progress/index.d.ts +2 -0
- package/dist/components/Progress/utils/value.d.ts +25 -0
- package/dist/components/Select/Select.d.ts +6 -74
- package/dist/components/Select/components/CustomSelect.d.ts +59 -0
- package/dist/components/Select/components/NativeSelect.d.ts +26 -0
- package/dist/components/Select/components/SelectListbox.d.ts +50 -0
- package/dist/components/Select/hooks/useSelectFormReset.d.ts +27 -0
- package/dist/components/Select/hooks/useSelectPosition.d.ts +12 -0
- package/dist/components/Select/hooks/useTypeahead.d.ts +14 -0
- package/dist/components/Select/utils/options.d.ts +38 -0
- package/dist/components/Sidebar/Sidebar.d.ts +30 -24
- package/dist/components/Sidebar/components/SidebarOverlay.d.ts +3 -4
- package/dist/components/Sidebar/components/SidebarPanel.d.ts +2 -2
- package/dist/style.css +1 -1
- package/dist/useAnchoredPosition-C0VS7hm6.js +105 -0
- package/dist/useAnchoredPosition-D7GRFzoX.cjs +1 -0
- package/dist/useFloatingPosition-Dq8xpr3E.js +27 -0
- package/dist/useFloatingPosition-g5kXywoB.cjs +1 -0
- package/dist/useFocusTrap-C0IcCdNf.js +136 -0
- package/dist/useFocusTrap-gAK_402D.cjs +1 -0
- package/package.json +6 -1
- package/dist/Spinner-BXgw60UC.cjs +0 -1
- package/dist/Spinner-CVYvk6YK.js +0 -25
- package/dist/floating-position-DIjh2wnP.cjs +0 -1
- package/dist/floating-position-DvR6e334.js +0 -50
- package/dist/useFloatingPosition-B3ZC-v3v.js +0 -43
- package/dist/useFloatingPosition-GzkP9dCc.cjs +0 -1
- package/dist/useFocusTrap-BrFZdMqQ.cjs +0 -1
- package/dist/useFocusTrap-DhVnlboe.js +0 -136
package/dist/Sidebar.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),t=require("react"),C=require("./effects-D85L_7zM.cjs"),L=require("./reference-C2guRuR0.cjs"),x=require("./usePresence-B5RYv4e1.cjs"),D=require("./Text-DWYlIcPj.cjs"),J=require("./Button-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),t=require("react"),C=require("./effects-D85L_7zM.cjs"),L=require("./reference-C2guRuR0.cjs"),x=require("./usePresence-B5RYv4e1.cjs"),D=require("./Text-DWYlIcPj.cjs"),J=require("./Button-CVe9T_Zw.cjs"),V=require("./useFocusTrap-gAK_402D.cjs"),W=require("./useScrollLock-Dy8MZaSn.cjs"),X=require("./aria-Bntn6ad_.cjs"),Y=require("./Avatar-Belo7qAY.cjs"),Z=require("./Spinner-BE0F4y2S.cjs"),ee=require("./Tooltip-CCuE-hfp.cjs"),ne=require("./units-PzuiQNnw.cjs"),B=new WeakMap;function K(s){const n=B.get(s);if(n)return n;const e={listeners:new Set,owner:null,state:void 0};return B.set(s,e),e}function re(s,n,e){const r=K(s);return r.owner!==null&&r.owner!==n?!1:(r.owner=n,r.state=e,r.listeners.forEach(p=>p()),!0)}function te(s,n){const e=B.get(s);!e||e.owner!==n||(e.owner=null,e.state=void 0,e.listeners.forEach(r=>r()))}function se(s){var n;return s?(n=B.get(s))==null?void 0:n.state:void 0}function ae(s,n){if(!s)return()=>{};const e=K(s);return e.listeners.add(n),()=>{e.listeners.delete(n)}}const ie=()=>{};function P(s){const n=x.useBoundary(s).boundaryElement,e=t.useCallback(p=>ae(n,p),[n]),r=t.useCallback(()=>se(n),[n]);return t.useSyncExternalStore(e,r,ie)}function O(s,n){return s==="both"||s===(n==="overlay"?"overlay":"inline")}const oe=t.forwardRef(function(n,e){const{children:r,className:p,presentation:c="both",...b}=n,o=P("Sidebar.Footer");return O(c,o==null?void 0:o.presentation)?i.jsx("div",{...b,ref:e,className:["nk-sidebar__footer",p].filter(Boolean).join(" "),children:r}):null}),le=t.forwardRef(function(n,e){const{"aria-label":r,"aria-labelledby":p,children:c,className:b,label:o,presentation:S="both",...v}=n,g=P("Sidebar.Group"),h=`${t.useId()}-label`,f=o!=null&&typeof o!="boolean"&&(typeof o!="string"||o.trim()!=="");if(!O(S,g==null?void 0:g.presentation))return null;const l=p??(r===void 0&&f?h:void 0),a=!!(r??l);return t.createElement(a?"nav":"div",{...v,ref:e,"aria-label":r,"aria-labelledby":l,className:["nk-sidebar__group",b].filter(Boolean).join(" ")},f?i.jsx(D.Text,{as:"h2",className:"nk-sidebar__group-label",id:h,size:"subtitle",weight:"medium",children:o}):null,i.jsx("ul",{className:"nk-sidebar__list",children:c}))}),ce=t.forwardRef(function(n,e){const{children:r,className:p,presentation:c="both",...b}=n,o=P("Sidebar.Header");return O(c,o==null?void 0:o.presentation)?i.jsx("div",{...b,ref:e,className:["nk-sidebar__header",p].filter(Boolean).join(" "),children:r}):null}),ue=t.forwardRef(function(n,e){const{active:r=!1,as:p,children:c,className:b,disabled:o=!1,icon:S,onClick:v,presentation:g="both",type:h,...f}=n,l=P("Sidebar.Item"),a=p??"button",u=a==="button",d=f,k=d.href!==void 0||d.to!==void 0;function m(_){if(o){_.preventDefault();return}v==null||v(_),l!=null&&l.open&&l.presentation==="overlay"&&!_.defaultPrevented&&l.requestOpenChange(!1,"item")}return O(g,l==null?void 0:l.presentation)?i.jsx("li",{className:"nk-sidebar__item-container",children:i.jsx(J.Button,{...f,ref:e,"aria-current":r?k?"page":"true":void 0,as:a,className:["nk-sidebar__item",b].filter(Boolean).join(" "),"data-active":r||void 0,disabled:o,fullWidth:!0,href:d.href,icon:S,onClick:m,shape:"rectangle",textAlignment:"left",type:u?h??"button":h,variant:"ghost",children:i.jsx("span",{className:"nk-sidebar__item-label",children:c})})}):null});function Q(s){const{"aria-label":n,"aria-labelledby":e,children:r,className:p,height:c,open:b,panelId:o,panelReference:S,presentation:v,side:g,state:h,style:f,width:l,...a}=s,u=v==="overlay",d=n??(e===void 0?"Sidebar":void 0),k=u&&b;let m=f;return(l!==void 0||c!==void 0)&&(m={...f},c!==void 0&&(m["--nk-sidebar-height"]=c),l!==void 0&&(m["--nk-sidebar-width"]=l)),i.jsx("aside",{...a,ref:S,"aria-hidden":u&&!b?!0:void 0,"aria-label":u&&!b?void 0:d,"aria-labelledby":u&&!b?void 0:e,"aria-modal":k?"true":void 0,className:["nk-sidebar",p].filter(Boolean).join(" "),"data-responsive":v==="pending"||void 0,"data-side":g,"data-state":h,"data-variant":u?"overlay":"inline",id:o,role:k?"dialog":void 0,style:m,tabIndex:u?-1:void 0,children:i.jsx("div",{className:"nk-sidebar__body",children:r})})}function de(s){const{boundaries:n,initialFocusReference:e,lockScroll:r,ownerDocument:p,panelReference:c,presenceState:b,restoreFocus:o,sidebar:S,side:v,...g}=s,{id:h,open:f,requestOpenChange:l}=S,a=t.useContext(x.FocusScopeContext),u=t.useRef(null),[d,k]=t.useState(null),m=x.useBoundary("Sidebar").boundaryElement,_=x.useOverlayLayer(!0,m),T=t.useCallback(E=>{u.current=E,c(E),k(E)},[c]);C.useIsomorphicLayoutEffect(()=>{d&&(d.inert=!f)},[f,d]);const q=t.useCallback(()=>{l(!1,"escape")},[l]),j=t.useCallback(()=>{l(!1,"outside")},[l]);x.useDismissableLayer({boundary:m,active:f,boundaries:n,dismissOnEscape:!0,dismissOnPointerDownOutside:!0,layerId:_.id,onEscapeDismiss:q,onPointerDownOutsideDismiss:j,ownerDocument:p});const N=V.useFocusTrap({boundary:m,active:f,container:d,initialFocusReference:e??u,layerId:_.id,restoreFocus:o});return W.useScrollLock(r&&f,p,m),i.jsx(x.FocusScopeContext.Provider,{value:f?N:a,children:i.jsx("div",{className:"nk-sidebar__overlay","data-side":v,"data-state":b,role:"presentation",style:{zIndex:_.zIndex},children:i.jsx(Q,{...g,open:f,panelId:h,panelReference:T,presentation:"overlay",side:v,state:b})})})}function be(s){const{children:n}=s;if(n.type===t.Fragment)throw new Error("Sidebar.Trigger requires a single non-Fragment child");const e=P("Sidebar.Trigger"),r=n.props,p=L.getElementReference(n),c=e==null?void 0:e.registerTrigger,b=e==null?void 0:e.unregisterTrigger,o=t.useRef(null),S=t.useCallback(u=>{const d=o.current;d&&d!==u&&(b==null||b(d)),o.current=u,u&&(c==null||c(u)),L.assignElementReference(p,u)},[p,c,b]),v=t.useCallback(u=>{var d;(d=r.onClick)==null||d.call(r,u),!(u.defaultPrevented||!e)&&e.requestOpenChange(!e.open,"trigger")},[r,e]);if(!e)return null;const{id:g,open:h,presentation:f,variant:l}=e,a=h&&f==="overlay";return t.cloneElement(n,{"aria-controls":a?X.mergeIdentifiers(r["aria-controls"],g):r["aria-controls"],"aria-expanded":h,"aria-haspopup":r["aria-haspopup"]??"dialog",className:[r.className,"nk-sidebar__trigger"].filter(Boolean).join(" "),"data-sidebar-variant":l,onClick:v,ref:S})}const fe=t.forwardRef(function(n,e){const{actions:r,className:p,description:c,image:b,loading:o=!1,name:S,onClick:v,...g}=n,h=c!=null&&typeof c!="boolean",f=i.jsxs(i.Fragment,{children:[i.jsx(Y.Avatar,{alt:S,"aria-hidden":!0,className:"nk-sidebar__user-avatar",image:b}),i.jsxs("span",{className:"nk-sidebar__user-text",children:[i.jsx(D.Text,{as:"span",className:"nk-sidebar__user-name",children:S}),h?i.jsx(D.Text,{as:"span",className:"nk-sidebar__user-description",size:"caption",tone:"muted",children:c}):null]})]});return i.jsx("div",{...g,ref:e,className:["nk-sidebar__user",p].filter(Boolean).join(" "),children:o?i.jsx(Z.Spinner,{className:"nk-sidebar__user-spinner",size:16}):i.jsxs(i.Fragment,{children:[v?i.jsx("button",{className:"nk-sidebar__user-details",onClick:v,type:"button",children:f}):i.jsx("div",{className:"nk-sidebar__user-details",children:f}),r!==void 0&&r.length>0?i.jsx("div",{className:"nk-sidebar__user-actions",children:r.map(l=>{const{"aria-label":a,icon:u,label:d,...k}=l;return i.jsx(ee.Tooltip2,{content:d,children:i.jsx(J.Button,{...k,"aria-label":a??d,className:"nk-sidebar__user-action",icon:u,shape:"rectangle",type:"button",variant:"ghost"})},d)})}):null]})})}),pe=()=>()=>{},$=()=>{};function me(s,n){const e=s==="responsive"?n:void 0,r=t.useSyncExternalStore((e==null?void 0:e.subscribe)??pe,(e==null?void 0:e.read)??$,$);return s!=="responsive"?s:r===void 0?"pending":r>=ne.breakpoint("md")?"inline":"overlay"}const ve=t.forwardRef(function(n,e){var H;const{defaultOpen:r=!1,height:p,initialFocusReference:c,lockScroll:b=!0,onOpenChange:o,open:S,restoreFocus:v=!0,side:g="start",variant:h="responsive",width:f,...l}=n,a=x.useBoundary("Sidebar"),u=`${t.useId()}-sidebar`,d=t.useRef(Symbol("nk-sidebar")).current,k=t.useRef(null),m=me(h,a==null?void 0:a.width),_=S!==void 0,[T,q]=t.useState(r),j=_?S:T,N=t.useRef(o);C.useIsomorphicLayoutEffect(()=>{N.current=o});const E=t.useCallback((y,R)=>{var I;j!==y&&(_||q(y),(I=N.current)==null||I.call(N,y,R))},[_,j]),A=t.useCallback(y=>{k.current=y,L.assignElementReference(e,y)},[e]),w=t.useMemo(()=>[k],[]),M=t.useCallback(y=>{w.push({current:y})},[w]),U=t.useCallback(y=>{const R=w.findIndex(I=>I.current===y);R>0&&w.splice(R,1)},[w]),F=t.useMemo(()=>({id:u,open:j,presentation:m,registerTrigger:M,requestOpenChange:E,unregisterTrigger:U,variant:h}),[j,u,m,M,E,U,h]);C.useIsomorphicLayoutEffect(()=>{const y=a==null?void 0:a.boundaryElement;if(!y)return;if(re(y,d,F)===!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,d,F]),C.useIsomorphicLayoutEffect(()=>{const y=a==null?void 0:a.boundaryElement;if(y)return()=>te(y,d)},[a==null?void 0:a.boundaryElement,d]),t.useEffect(()=>{m==="inline"&&E(!1,"variant")},[m,E]);const z=x.usePresence(j&&m==="overlay"),G=((H=a==null?void 0:a.boundaryElement)==null?void 0:H.ownerDocument)??(typeof document>"u"?null:document);return m!=="overlay"?i.jsx(Q,{...l,height:p,open:!1,panelId:u,panelReference:A,presentation:m,side:g,width:f}):!z.present||!G?null:i.jsx(x.Portal,{children:i.jsx(de,{...l,boundaries:w,initialFocusReference:c,lockScroll:b,ownerDocument:G,panelReference:A,presenceState:z.state==="closing"?"closing":"open",restoreFocus:v,side:g,sidebar:F,width:f})})}),he=Object.assign(ve,{Footer:oe,Group:le,Header:ce,Item:ue,Trigger:be,User:fe});exports.default=he;
|
package/dist/Sidebar.js
CHANGED
|
@@ -5,13 +5,13 @@ import { u as R } from "./effects-D5CWf-Pl.js";
|
|
|
5
5
|
import { g as ce, a as ee } from "./reference-CXMr27nM.js";
|
|
6
6
|
import { b as z, F as V, d as de, e as ue, c as pe, P as be } from "./usePresence-CqegYqy4.js";
|
|
7
7
|
import { T as U } from "./Text-rN6iDo0V.js";
|
|
8
|
-
import { B as ne } from "./Button-
|
|
9
|
-
import { u as fe } from "./useFocusTrap-
|
|
8
|
+
import { B as ne } from "./Button-D6rXvcqq.js";
|
|
9
|
+
import { u as fe } from "./useFocusTrap-C0IcCdNf.js";
|
|
10
10
|
import { u as me } from "./useScrollLock-Drd7OZRC.js";
|
|
11
11
|
import { m as ve } from "./aria-CeA9QfD1.js";
|
|
12
|
-
import { A as
|
|
13
|
-
import { S as
|
|
14
|
-
import { T as ye } from "./Tooltip-
|
|
12
|
+
import { A as he } from "./Avatar-DjDCFqNG.js";
|
|
13
|
+
import { S as ge } from "./Spinner-CmxlDlOk.js";
|
|
14
|
+
import { T as ye } from "./Tooltip-CeyRKNv4.js";
|
|
15
15
|
import { b as Se } from "./units-BmjPCccF.js";
|
|
16
16
|
const L = /* @__PURE__ */ new WeakMap();
|
|
17
17
|
function re(t) {
|
|
@@ -79,8 +79,8 @@ const we = I(
|
|
|
79
79
|
label: a,
|
|
80
80
|
presentation: y = "both",
|
|
81
81
|
...m
|
|
82
|
-
} = n,
|
|
83
|
-
if (!x(y,
|
|
82
|
+
} = n, h = T("Sidebar.Group"), v = `${Y()}-label`, p = a != null && typeof a != "boolean" && (typeof a != "string" || a.trim() !== "");
|
|
83
|
+
if (!x(y, h == null ? void 0 : h.presentation))
|
|
84
84
|
return null;
|
|
85
85
|
const i = b ?? (r === void 0 && p ? v : void 0);
|
|
86
86
|
return ae(
|
|
@@ -129,7 +129,7 @@ const we = I(
|
|
|
129
129
|
disabled: a = !1,
|
|
130
130
|
icon: y,
|
|
131
131
|
onClick: m,
|
|
132
|
-
presentation:
|
|
132
|
+
presentation: h = "both",
|
|
133
133
|
type: v,
|
|
134
134
|
...p
|
|
135
135
|
} = n, i = T("Sidebar.Item"), s = b ?? "button", l = s === "button", c = p, S = c.href !== void 0 || c.to !== void 0;
|
|
@@ -140,7 +140,7 @@ const we = I(
|
|
|
140
140
|
}
|
|
141
141
|
m == null || m(_), i != null && i.open && i.presentation === "overlay" && !_.defaultPrevented && i.requestOpenChange(!1, "item");
|
|
142
142
|
}
|
|
143
|
-
return x(
|
|
143
|
+
return x(h, i == null ? void 0 : i.presentation) ? /* @__PURE__ */ d("li", { className: "nk-sidebar__item-container", children: /* @__PURE__ */ d(
|
|
144
144
|
ne,
|
|
145
145
|
{
|
|
146
146
|
...p,
|
|
@@ -169,19 +169,19 @@ function te(t) {
|
|
|
169
169
|
"aria-labelledby": e,
|
|
170
170
|
children: r,
|
|
171
171
|
className: b,
|
|
172
|
-
|
|
172
|
+
height: o,
|
|
173
173
|
open: u,
|
|
174
174
|
panelId: a,
|
|
175
175
|
panelReference: y,
|
|
176
176
|
presentation: m,
|
|
177
|
-
side:
|
|
177
|
+
side: h,
|
|
178
178
|
state: v,
|
|
179
179
|
style: p,
|
|
180
180
|
width: i,
|
|
181
181
|
...s
|
|
182
182
|
} = t, l = m === "overlay", c = n ?? (e === void 0 ? "Sidebar" : void 0), S = l && u;
|
|
183
183
|
let f = p;
|
|
184
|
-
return (i !== void 0 || o !== void 0) && (f = { ...p }, o !== void 0 && (f["--nk-sidebar-
|
|
184
|
+
return (i !== void 0 || o !== void 0) && (f = { ...p }, o !== void 0 && (f["--nk-sidebar-height"] = o), i !== void 0 && (f["--nk-sidebar-width"] = i)), /* @__PURE__ */ d(
|
|
185
185
|
"aside",
|
|
186
186
|
{
|
|
187
187
|
...s,
|
|
@@ -192,7 +192,7 @@ function te(t) {
|
|
|
192
192
|
"aria-modal": S ? "true" : void 0,
|
|
193
193
|
className: ["nk-sidebar", b].filter(Boolean).join(" "),
|
|
194
194
|
"data-responsive": m === "pending" || void 0,
|
|
195
|
-
"data-side":
|
|
195
|
+
"data-side": h,
|
|
196
196
|
"data-state": v,
|
|
197
197
|
"data-variant": l ? "overlay" : "inline",
|
|
198
198
|
id: a,
|
|
@@ -214,7 +214,7 @@ function Te(t) {
|
|
|
214
214
|
restoreFocus: a,
|
|
215
215
|
sidebar: y,
|
|
216
216
|
side: m,
|
|
217
|
-
...
|
|
217
|
+
...h
|
|
218
218
|
} = t, { id: v, open: p, requestOpenChange: i } = y, s = se(V), l = B(null), [c, S] = Z(null), f = z("Sidebar").boundaryElement, _ = de(!0, f), C = k((E) => {
|
|
219
219
|
l.current = E, o(E), S(E);
|
|
220
220
|
}, [o]);
|
|
@@ -260,7 +260,7 @@ function Te(t) {
|
|
|
260
260
|
children: /* @__PURE__ */ d(
|
|
261
261
|
te,
|
|
262
262
|
{
|
|
263
|
-
...
|
|
263
|
+
...h,
|
|
264
264
|
open: p,
|
|
265
265
|
panelId: v,
|
|
266
266
|
panelReference: C,
|
|
@@ -286,11 +286,11 @@ function Fe(t) {
|
|
|
286
286
|
(c = r.onClick) == null || c.call(r, l), !(l.defaultPrevented || !e) && e.requestOpenChange(!e.open, "trigger");
|
|
287
287
|
}, [r, e]);
|
|
288
288
|
if (!e) return null;
|
|
289
|
-
const { id:
|
|
289
|
+
const { id: h, open: v, presentation: p, variant: i } = e;
|
|
290
290
|
return oe(
|
|
291
291
|
n,
|
|
292
292
|
{
|
|
293
|
-
"aria-controls": v && p === "overlay" ? ve(r["aria-controls"],
|
|
293
|
+
"aria-controls": v && p === "overlay" ? ve(r["aria-controls"], h) : r["aria-controls"],
|
|
294
294
|
"aria-expanded": v,
|
|
295
295
|
"aria-haspopup": r["aria-haspopup"] ?? "dialog",
|
|
296
296
|
className: [r.className, "nk-sidebar__trigger"].filter(Boolean).join(" "),
|
|
@@ -310,10 +310,10 @@ const Re = I(
|
|
|
310
310
|
loading: a = !1,
|
|
311
311
|
name: y,
|
|
312
312
|
onClick: m,
|
|
313
|
-
...
|
|
313
|
+
...h
|
|
314
314
|
} = n, v = o != null && typeof o != "boolean", p = /* @__PURE__ */ A(K, { children: [
|
|
315
315
|
/* @__PURE__ */ d(
|
|
316
|
-
|
|
316
|
+
he,
|
|
317
317
|
{
|
|
318
318
|
alt: y,
|
|
319
319
|
"aria-hidden": !0,
|
|
@@ -338,10 +338,10 @@ const Re = I(
|
|
|
338
338
|
return /* @__PURE__ */ d(
|
|
339
339
|
"div",
|
|
340
340
|
{
|
|
341
|
-
...
|
|
341
|
+
...h,
|
|
342
342
|
ref: e,
|
|
343
343
|
className: ["nk-sidebar__user", b].filter(Boolean).join(" "),
|
|
344
|
-
children: a ? /* @__PURE__ */ d(
|
|
344
|
+
children: a ? /* @__PURE__ */ d(ge, { className: "nk-sidebar__user-spinner", size: 16 }) : /* @__PURE__ */ A(K, { children: [
|
|
345
345
|
m ? /* @__PURE__ */ d(
|
|
346
346
|
"button",
|
|
347
347
|
{
|
|
@@ -390,13 +390,13 @@ const Ce = I(function(n, e) {
|
|
|
390
390
|
var J;
|
|
391
391
|
const {
|
|
392
392
|
defaultOpen: r = !1,
|
|
393
|
-
|
|
394
|
-
|
|
393
|
+
height: b,
|
|
394
|
+
initialFocusReference: o,
|
|
395
395
|
lockScroll: u = !0,
|
|
396
396
|
onOpenChange: a,
|
|
397
397
|
open: y,
|
|
398
398
|
restoreFocus: m = !0,
|
|
399
|
-
side:
|
|
399
|
+
side: h = "start",
|
|
400
400
|
variant: v = "responsive",
|
|
401
401
|
width: p,
|
|
402
402
|
...i
|
|
@@ -404,18 +404,18 @@ const Ce = I(function(n, e) {
|
|
|
404
404
|
R(() => {
|
|
405
405
|
P.current = a;
|
|
406
406
|
});
|
|
407
|
-
const E = k((
|
|
407
|
+
const E = k((g, O) => {
|
|
408
408
|
var F;
|
|
409
|
-
N !==
|
|
410
|
-
}, [_, N]), G = k((
|
|
411
|
-
S.current =
|
|
409
|
+
N !== g && (_ || D(g), (F = P.current) == null || F.call(P, g, O));
|
|
410
|
+
}, [_, N]), G = k((g) => {
|
|
411
|
+
S.current = g, ee(e, g);
|
|
412
412
|
}, [e]), w = Q(
|
|
413
413
|
() => [S],
|
|
414
414
|
[]
|
|
415
|
-
), q = k((
|
|
416
|
-
w.push({ current:
|
|
417
|
-
}, [w]), H = k((
|
|
418
|
-
const O = w.findIndex((F) => F.current ===
|
|
415
|
+
), q = k((g) => {
|
|
416
|
+
w.push({ current: g });
|
|
417
|
+
}, [w]), H = k((g) => {
|
|
418
|
+
const O = w.findIndex((F) => F.current === g);
|
|
419
419
|
O > 0 && w.splice(O, 1);
|
|
420
420
|
}, [w]), j = Q(() => ({
|
|
421
421
|
id: l,
|
|
@@ -435,16 +435,16 @@ const Ce = I(function(n, e) {
|
|
|
435
435
|
v
|
|
436
436
|
]);
|
|
437
437
|
R(() => {
|
|
438
|
-
const
|
|
439
|
-
if (!
|
|
440
|
-
if (_e(
|
|
438
|
+
const g = s == null ? void 0 : s.boundaryElement;
|
|
439
|
+
if (!g) return;
|
|
440
|
+
if (_e(g, c, j) === !1)
|
|
441
441
|
throw new Error(
|
|
442
442
|
"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."
|
|
443
443
|
);
|
|
444
444
|
}, [s == null ? void 0 : s.boundaryElement, c, j]), R(() => {
|
|
445
|
-
const
|
|
446
|
-
if (
|
|
447
|
-
return () => ke(
|
|
445
|
+
const g = s == null ? void 0 : s.boundaryElement;
|
|
446
|
+
if (g)
|
|
447
|
+
return () => ke(g, c);
|
|
448
448
|
}, [s == null ? void 0 : s.boundaryElement, c]), le(() => {
|
|
449
449
|
f === "inline" && E(!1, "variant");
|
|
450
450
|
}, [f, E]);
|
|
@@ -453,27 +453,27 @@ const Ce = I(function(n, e) {
|
|
|
453
453
|
te,
|
|
454
454
|
{
|
|
455
455
|
...i,
|
|
456
|
-
|
|
456
|
+
height: b,
|
|
457
457
|
open: !1,
|
|
458
458
|
panelId: l,
|
|
459
459
|
panelReference: G,
|
|
460
460
|
presentation: f,
|
|
461
|
-
side:
|
|
461
|
+
side: h,
|
|
462
462
|
width: p
|
|
463
463
|
}
|
|
464
464
|
) : !M.present || !$ ? null : /* @__PURE__ */ d(be, { children: /* @__PURE__ */ d(
|
|
465
465
|
Te,
|
|
466
466
|
{
|
|
467
467
|
...i,
|
|
468
|
-
|
|
468
|
+
boundaries: w,
|
|
469
|
+
initialFocusReference: o,
|
|
469
470
|
lockScroll: u,
|
|
470
471
|
ownerDocument: $,
|
|
471
|
-
presenceState: M.state === "closing" ? "closing" : "open",
|
|
472
|
-
boundaries: w,
|
|
473
472
|
panelReference: G,
|
|
473
|
+
presenceState: M.state === "closing" ? "closing" : "open",
|
|
474
474
|
restoreFocus: m,
|
|
475
|
+
side: h,
|
|
475
476
|
sidebar: j,
|
|
476
|
-
side: g,
|
|
477
477
|
width: p
|
|
478
478
|
}
|
|
479
479
|
) });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const l=require("react/jsx-runtime"),p=require("react"),u=p.forwardRef(function(r,i){const{className:o="",color:n,size:e,style:t,...a}=r,s=typeof e=="number"?`${e}px`:e,c={...t,...s===void 0?void 0:{"--nk-spinner-size":s},...n?{color:n}:void 0};return l.jsx("div",{ref:i,className:["nk-spinner",o].filter(Boolean).join(" "),style:c,role:"status","aria-label":"Loading",...a})});exports.Spinner=u;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c } from "react";
|
|
3
|
+
const S = c(function(r, s) {
|
|
4
|
+
const { className: i = "", color: n, size: e, style: t, ...a } = r, o = typeof e == "number" ? `${e}px` : e, l = {
|
|
5
|
+
...t,
|
|
6
|
+
...o === void 0 ? void 0 : { "--nk-spinner-size": o },
|
|
7
|
+
...n ? { color: n } : void 0
|
|
8
|
+
};
|
|
9
|
+
return /* @__PURE__ */ p(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
ref: s,
|
|
13
|
+
className: ["nk-spinner", i].filter(Boolean).join(" "),
|
|
14
|
+
style: l,
|
|
15
|
+
role: "status",
|
|
16
|
+
"aria-label": "Loading",
|
|
17
|
+
...a
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
S
|
|
23
|
+
};
|
package/dist/Spinner.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Spinner-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Spinner-BE0F4y2S.cjs");exports.default=e.Spinner;
|
package/dist/Spinner.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const a=require("react/jsx-runtime"),o=require("react"),A=require("./reference-C2guRuR0.cjs"),I=require("./Button-
|
|
1
|
+
"use client";"use strict";const a=require("react/jsx-runtime"),o=require("react"),A=require("./reference-C2guRuR0.cjs"),I=require("./Button-CVe9T_Zw.cjs"),H=require("./Tooltip-CCuE-hfp.cjs"),v=o.createContext("body"),R=o.forwardRef(function(r,e){const{align:t="left",children:s,className:i,scope:c="col",sticky:b=!1,...d}=r;return a.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 w(n){for(const r of o.Children.toArray(n)){if(o.isValidElement(r)&&r.type===o.Fragment){if(w(r.props.children))return!0;continue}return!0}return!1}const D=o.forwardRef(function(r,e){const{children:t,className:s,emptyColumnCount:i=1,emptyMessage:c,...b}=r,d=!w(t),m=Number.isFinite(i)?Math.max(1,Math.floor(i)):1;return a.jsx("tbody",{...b,ref:e,className:["nk-table__body",s].filter(Boolean).join(" "),children:d&&c!==void 0?a.jsx("tr",{className:"nk-table__row",children:a.jsx("td",{className:"nk-table__cell nk-table__empty-cell",colSpan:m,children:a.jsx("div",{className:"nk-table__empty-content",children:c})})}):a.jsx(v.Provider,{value:"body",children:t})})});function K(n,r,e){return n===void 0?r: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 O(n){if(typeof n=="number"||typeof n=="string")return String(n)}const S=o.forwardRef(function(r,e){const{align:t="left",children:s,className:i,format:c,title:b,truncate:d,value:m,...p}=r,{rowTrigger:l,...u}=p,k=K(m,s,c),f=d===void 0?void 0:{maxWidth:d},g=b??(d===void 0?void 0:O(k));return a.jsxs("td",{...u,ref:e,className:["nk-table__cell",i].filter(Boolean).join(" "),"data-align":t,title:g,children:[(l==null?void 0:l.kind)==="link"&&l.linkProperties?a.jsx("a",{ref:l.reference,"aria-label":l.ariaLabel,className:"nk-table__row-trigger",download:l.linkProperties.download,href:l.linkProperties.href,hrefLang:l.linkProperties.hrefLang,onClick:l.linkProperties.onNavigate,rel:l.linkProperties.rel,target:l.linkProperties.target}):null,(l==null?void 0:l.kind)==="button"?a.jsx("button",{ref:l.reference,"aria-label":l.ariaLabel,className:"nk-table__row-trigger",onClick:l.onClick,type:"button"}):null,d!==void 0?a.jsx("span",{className:"nk-table__truncated-content",style:f,children:k}):k]})}),F=o.forwardRef(function(r,e){const{children:t,className:s,...i}=r;return a.jsx("tfoot",{...i,ref:e,className:["nk-table__foot",s].filter(Boolean).join(" "),children:a.jsx(v.Provider,{value:"foot",children:t})})}),q=o.forwardRef(function(r,e){const{children:t,className:s,...i}=r;return a.jsx("thead",{...i,ref:e,className:["nk-table__head",s].filter(Boolean).join(" "),children:a.jsx(v.Provider,{value:"head",children:t})})}),z=["a[href]","audio[controls]","button","iframe","input","label","select","summary","textarea","video[controls]","[contenteditable]:not([contenteditable='false'])"].join(","),V=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 M(n,r){var t;let e=n;for(;e&&e!==r;){if(e.matches(z)||(((t=e.getAttribute("role"))==null?void 0:t.split(/\s+/))??[]).some(i=>V.has(i)))return!0;e=e.parentElement}return!1}function Y(n,r){let e=!1;function t(i){return o.Children.map(i,c=>o.isValidElement(c)?c.type===o.Fragment?o.cloneElement(c,void 0,t(c.props.children)):!e&&c.type===S?(e=!0,o.cloneElement(c,{rowTrigger:r})):c:c)}const s=t(n);return{attached:e,content:s}}function X(n){const{"aria-label":r,icon:e,label:t,...s}=n;return a.jsx(H.Tooltip2,{content:t,children:a.jsx(I.Button,{...s,"aria-label":r??t,className:"nk-table__action",icon:e,shape:"rectangle",type:"button",variant:"ghost"})})}function $(n){const{actions:r}=n;function e(t){t.stopPropagation()}return a.jsx("td",{className:"nk-table__cell nk-table__action-cell","data-align":"right",onClick:e,children:r.length>0?a.jsx("span",{className:"nk-table__action-list",children:r.map(t=>o.createElement(X,{...t,key:t.label}))}):null})}const G=o.forwardRef(function(r,e){const{children:t,className:s,...i}=r;return a.jsx(R,{...i,ref:e,align:"right",className:["nk-table__action-header-cell",s].filter(Boolean).join(" "),children:t??a.jsx("span",{className:"nk-table__visually-hidden",children:"Row actions"})})}),J=o.forwardRef(function(r,e){const{"aria-label":t,actions:s,children:i,className:c,download:b,href:d,hrefLang:m,onClick:p,onNavigate:l,rel:u,target:k,...f}=r,g=o.useRef(null),P=o.useContext(v),x=d!==void 0||p!==void 0,T=(t==null?void 0:t.trim())||(d!==void 0?"Open row":"Activate row");function N(h){g.current=h}let C;d!==void 0?C={ariaLabel:T,kind:"link",linkProperties:{download:b,href:d,hrefLang:m,onNavigate:l,rel:u,target:k},reference:N}:p!==void 0&&(C={ariaLabel:T,kind:"button",onClick:p,reference:N});const E=C?Y(i,C):{content:i};function B(h){if(h.defaultPrevented)return;const j=h.target;if(!(j instanceof Element)||M(j,h.currentTarget))return;const _=g.current;if(!_)return;const y=_.ownerDocument.defaultView;if(!y){_.click();return}_.dispatchEvent(new y.MouseEvent("click",{altKey:h.altKey,bubbles:!0,button:h.button,buttons:h.buttons,cancelable:!0,clientX:h.clientX,clientY:h.clientY,ctrlKey:h.ctrlKey,metaKey:h.metaKey,shiftKey:h.shiftKey}))}const L=P==="head"?a.jsx(G,{}):a.jsx($,{actions:s??[]});return a.jsxs("tr",{...f,ref:e,"aria-label":x?void 0:t,className:["nk-table__row",c].filter(Boolean).join(" "),"data-interactive":x||void 0,onClick:x?B:void 0,children:[E.content,L]})});function Q(){const n=o.useRef(null),r=o.useRef(null),[e,t]=o.useState(!1),[s,i]=o.useState(!1);o.useEffect(()=>{const b=n.current,d=r.current;if(!b||!d)return;const m=b,p=d;function l(){const g=m.scrollWidth>m.clientWidth;t(g),g||i(!1)}l();const u=m.ownerDocument.defaultView;u==null||u.addEventListener("resize",l);const k=u==null?void 0:u.ResizeObserver,f=k?new k(l):void 0;return f==null||f.observe(m),f==null||f.observe(p),()=>{u==null||u.removeEventListener("resize",l),f==null||f.disconnect()}},[]);function c(b){i(e&&b.currentTarget.scrollLeft>1)}return{containerReference:n,contentReference:r,isScrollable:e,isScrolled:s,handleScroll:c}}const U=o.forwardRef(function(r,e){const{"aria-label":t,children:s,className:i,containerClassName:c,...b}=r,{containerReference:d,contentReference:m,isScrollable:p,isScrolled:l,handleScroll:u}=Q(),k=t?`${t} scroll area`:"Scrollable table",f=o.useCallback(g=>{m.current=g,A.assignElementReference(e,g)},[m,e]);return a.jsx("div",{ref:d,"aria-label":p?k:void 0,className:["nk-table",c].filter(Boolean).join(" "),"data-scrolled":l||void 0,onScroll:u,role:p?"region":void 0,tabIndex:p?0:void 0,children:a.jsx("table",{...b,ref:f,"aria-label":t,className:["nk-table__element",i].filter(Boolean).join(" "),children:s})})}),W=Object.assign(U,{Body:D,Cell:S,Foot:F,HeaderCell:R,Head:q,Row:J});exports.Table=W;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as a, jsxs as E } from "react/jsx-runtime";
|
|
3
3
|
import { createContext as z, forwardRef as g, Children as B, isValidElement as L, Fragment as j, cloneElement as w, createElement as M, useRef as N, useContext as V, useState as x, useEffect as Y, useCallback as X } from "react";
|
|
4
4
|
import { a as $ } from "./reference-CXMr27nM.js";
|
|
5
|
-
import { B as q } from "./Button-
|
|
6
|
-
import { T as G } from "./Tooltip-
|
|
5
|
+
import { B as q } from "./Button-D6rXvcqq.js";
|
|
6
|
+
import { T as G } from "./Tooltip-CeyRKNv4.js";
|
|
7
7
|
const v = z("body"), A = g(function(l, e) {
|
|
8
8
|
const {
|
|
9
9
|
align: t = "left",
|
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-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Table-BqWBgMTU.cjs");exports.default=e.Table;
|
package/dist/Table.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const T=require("react/jsx-runtime"),n=require("react"),S=require("./reference-C2guRuR0.cjs"),h=require("./usePresence-B5RYv4e1.cjs"),we=require("./useFloatingPosition-
|
|
1
|
+
"use client";"use strict";const T=require("react/jsx-runtime"),n=require("react"),S=require("./reference-C2guRuR0.cjs"),h=require("./usePresence-B5RYv4e1.cjs"),we=require("./useFloatingPosition-g5kXywoB.cjs"),Ee=require("./focus-restoration-70WcQRr5.cjs"),be=require("./Surface-BttJYSDt.cjs"),ye=500,G=n.createContext(null);function De(o){const{children:a,delay:c=ye}=o,l=n.useMemo(()=>({delay:c}),[c]);return T.jsx(G.Provider,{value:l,children:a})}const J=500,$=100;function ge(o,a,c,l){a.current=o,S.assignElementReference(c,o),S.assignElementReference(l,o)}function Ie(o){return Number.isFinite(o)?Math.max(0,o):J}function he(o,a){const c=(o==null?void 0:o.split(/\s+/).filter(Boolean))??[];return c.includes(a)||c.push(a),c.join(" ")}const Le=n.forwardRef(function(a,c){const{children:l,className:K,content:m,contentClassName:Q,contentStyle:V,delay:X,disabled:R=!1,onOpenChange:L,placement:A="top",style:Z}=a;if(m==null||typeof m=="boolean"||typeof m=="string"&&!m.trim())throw new Error("Tooltip content must not be empty");if(l.type===n.Fragment)throw new Error("Tooltip requires a single non-Fragment trigger");const z=`${n.useId()}-tooltip`,_=n.useContext(G),r=l.props,B=S.getElementReference(l),w=n.useRef(null),x=n.useRef(null),Y=n.useRef(R),j=n.useRef(!1),v=n.useRef(null),F=n.useRef(null),k=n.useRef(null),C=n.useRef(!1),E=n.useRef(!1),b=n.useRef(!1),f=n.useRef(!1),[M,ee]=n.useState(null),[ne,te]=n.useState(null),[O,re]=n.useState(!1);Y.current=R;const P=Ie(X??(_==null?void 0:_.delay)??J),y=h.usePresence(O),H=(M==null?void 0:M.ownerDocument)??(typeof document>"u"?null:document),q=h.useBoundary("Tooltip").boundaryElement,N=h.useOverlayLayer(y.present,q),d=we.useFloatingPosition(y.present,A,M,ne,q),oe=n.useMemo(()=>[w,x],[]),se=he(r["aria-describedby"],z),ce=O&&y.present?se:r["aria-describedby"],U=n.useCallback(e=>{ge(e,w,B,c),ee(e)},[c,B]),ue=n.useCallback(e=>{x.current=e,e||(f.current=!1),te(e)},[]),u=n.useCallback(()=>{const e=v.current;e&&e.ownerWindow.clearTimeout(e.timerId),v.current=null},[]),i=n.useCallback(()=>{const e=F.current;e&&e.ownerWindow.clearTimeout(e.timerId),F.current=null},[]),D=n.useCallback(()=>{const e=k.current;e&&e.ownerWindow.clearTimeout(e.timerId),k.current=null},[]),s=n.useCallback(e=>{j.current!==e&&(e||(f.current=!1),j.current=e,re(e),L==null||L(e))},[L]),W=n.useCallback(e=>{var g,I;if(i(),E.current||b.current||f.current)return;if(e===0){s(!1);return}const t=((g=w.current)==null?void 0:g.ownerDocument.defaultView)??((I=x.current)==null?void 0:I.ownerDocument.defaultView);if(!t){s(!1);return}const p=t.setTimeout(()=>{F.current=null,!E.current&&!b.current&&!f.current&&s(!1)},e);F.current={ownerWindow:t,timerId:p}},[i,s]),ie=n.useCallback(()=>{var p;if(u(),i(),P===0){s(!0);return}const e=(p=w.current)==null?void 0:p.ownerDocument.defaultView;if(!e)return;const t=e.setTimeout(()=>{v.current=null,Y.current||s(!0)},P);v.current={ownerWindow:e,timerId:t}},[i,u,P,s]);function le(e){var t;if((t=r.onFocus)==null||t.call(r,e),E.current=!0,i(),C.current||Ee.isElementFocusRestoration(e.currentTarget)){u();return}u(),s(!0)}function ae(e){var t;(t=r.onBlur)==null||t.call(r,e),!e.currentTarget.contains(e.relatedTarget)&&(E.current=!1,u(),W(0))}function fe(e){var t;(t=r.onMouseEnter)==null||t.call(r,e),b.current=!0,ie()}function de(e){var t;(t=r.onMouseLeave)==null||t.call(r,e),b.current=!1,u(),W($)}function me(){f.current=!0,i()}function pe(){f.current=!1,W($)}function Te(e){var g,I;(g=r.onPointerDown)==null||g.call(r,e),u(),i(),s(!1);const t=(I=w.current)==null?void 0:I.ownerDocument.defaultView;if(!t)return;C.current=!0,D();const p=t.setTimeout(()=>{C.current=!1,k.current=null},0);k.current={ownerWindow:t,timerId:p}}if(h.useDismissableLayer({boundary:q,active:O,boundaries:oe,dismissOnPointerDownOutside:!0,layerId:N.id,onEscapeDismiss:()=>s(!1),onPointerDownOutsideDismiss:()=>s(!1),ownerDocument:H}),n.useEffect(()=>{R&&(u(),i(),D(),C.current=!1,E.current=!1,b.current=!1,f.current=!1,j.current&&s(!1))},[i,u,D,R,s]),n.useEffect(()=>()=>{u(),i(),D()},[i,u,D]),R)return n.cloneElement(l,{ref:U});const Re=n.cloneElement(l,{"aria-describedby":ce,className:[r.className,"nk-tooltip__trigger",K].filter(Boolean).join(" "),onBlur:ae,onFocus:le,onMouseEnter:fe,onMouseLeave:de,onPointerDown:Te,ref:U,style:{...r.style,...Z}});return T.jsxs(T.Fragment,{children:[Re,y.present&&H?T.jsx(h.Portal,{children:T.jsxs(be.Surface,{ref:ue,"aria-hidden":O?void 0:!0,className:["nk-tooltip",Q].filter(Boolean).join(" "),"data-placement":(d==null?void 0:d.placement)??A,"data-state":y.state==="closing"?"closing":"open",id:z,onMouseEnter:me,onMouseLeave:pe,role:"tooltip",style:d?{...V,"--nk-tooltip-arrow-offset":`${d.arrowOffset}px`,left:d.left,top:d.top,zIndex:N.zIndex}:{...V,visibility:"hidden",zIndex:N.zIndex},children:[T.jsx("span",{"aria-hidden":"true",className:"nk-tooltip__arrow"}),m]})}):null]})}),ve=Object.assign(Le,{Provider:De});exports.Tooltip2=ve;
|
|
@@ -3,7 +3,7 @@ import { jsx as C, jsxs as q, Fragment as Ie } from "react/jsx-runtime";
|
|
|
3
3
|
import { useMemo as X, createContext as be, forwardRef as he, Fragment as Le, useId as ve, useContext as Fe, useRef as u, useState as A, useCallback as f, useEffect as G, cloneElement as J } from "react";
|
|
4
4
|
import { g as Oe, a as K } from "./reference-CXMr27nM.js";
|
|
5
5
|
import { c as Me, b as _e, d as Pe, e as xe, P as Ne } from "./usePresence-CqegYqy4.js";
|
|
6
|
-
import { u as We } from "./useFloatingPosition-
|
|
6
|
+
import { u as We } from "./useFloatingPosition-Dq8xpr3E.js";
|
|
7
7
|
import { i as ke } from "./focus-restoration-BvNZzrQA.js";
|
|
8
8
|
import { S as Ve } from "./Surface-vEFsZC12.js";
|
|
9
9
|
const je = 500, Z = be(null);
|
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-
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Tooltip-CCuE-hfp.cjs");exports.default=e.Tooltip2;
|
package/dist/Tooltip.js
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type EdgeBounds } from "../utils/floating-position";
|
|
2
|
+
/** A type representing the coordinates every fitted position carries. */
|
|
3
|
+
type PositionCoordinates = {
|
|
4
|
+
/** The horizontal position, in the coordinate space of its producer. */
|
|
5
|
+
left: number;
|
|
6
|
+
/** The vertical position, in the coordinate space of its producer. */
|
|
7
|
+
top: number;
|
|
8
|
+
};
|
|
9
|
+
/** A type representing the measurements one repositioning pass receives. */
|
|
10
|
+
export type AnchoredMeasurement = {
|
|
11
|
+
/** The bounds of the element the content is anchored to. */
|
|
12
|
+
triggerBounds: DOMRect;
|
|
13
|
+
/** The bounds of the positioned content, once it is mounted. */
|
|
14
|
+
panelBounds: DOMRect | undefined;
|
|
15
|
+
/** The visible bounds of the boundary the content stays inside. */
|
|
16
|
+
visibleBounds: EdgeBounds;
|
|
17
|
+
/**
|
|
18
|
+
* Reads the shared spacing token resolved from the anchoring element.
|
|
19
|
+
*
|
|
20
|
+
* Resolution is deferred until a fit asks for it, so only fits that space
|
|
21
|
+
* content away from their anchor pay for the style read.
|
|
22
|
+
*/
|
|
23
|
+
readSpacing: () => number;
|
|
24
|
+
};
|
|
25
|
+
/** A type representing options accepted by the anchored position hook. */
|
|
26
|
+
export type AnchoredPositionOptions<Position extends PositionCoordinates> = {
|
|
27
|
+
/** Whether positioning observers should remain active. */
|
|
28
|
+
active: boolean;
|
|
29
|
+
/** The boundary the content is positioned within. */
|
|
30
|
+
boundary: HTMLElement | null;
|
|
31
|
+
/**
|
|
32
|
+
* Fits the content against the measurements of one repositioning pass.
|
|
33
|
+
*
|
|
34
|
+
* Returning null withholds a position, which suits content that cannot be
|
|
35
|
+
* placed until it has been measured itself.
|
|
36
|
+
*
|
|
37
|
+
* @note Identity must stay stable across renders. Every change reattaches
|
|
38
|
+
* the observers, so callers pass a memoized fit rather than an inline one.
|
|
39
|
+
*/
|
|
40
|
+
fit: (measurement: AnchoredMeasurement) => Position | null;
|
|
41
|
+
/** The mounted content being positioned. */
|
|
42
|
+
panel: HTMLElement | null;
|
|
43
|
+
/** The element anchoring the content. */
|
|
44
|
+
trigger: HTMLElement | null;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Keeps anchored content aligned to its trigger and inside its boundary.
|
|
48
|
+
*
|
|
49
|
+
* The hook owns the measurement lifecycle every anchored layer shares, while
|
|
50
|
+
* the supplied fit decides where the content actually belongs. Coordinates
|
|
51
|
+
* are returned relative to the boundary's padding box, which is what absolute
|
|
52
|
+
* positioning inside the boundary resolves against.
|
|
53
|
+
*
|
|
54
|
+
* @param options - The positioned elements and the fit placing them.
|
|
55
|
+
*
|
|
56
|
+
* @returns The boundary-relative position, or null while none is resolved.
|
|
57
|
+
*/
|
|
58
|
+
export declare function useAnchoredPosition<Position extends PositionCoordinates>(options: AnchoredPositionOptions<Position>): Position | null;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type HTMLAttributes } from "react";
|
|
2
|
+
import "./styles/progress.css";
|
|
3
|
+
/** A type representing the semantic color treatment applied to a Progress. */
|
|
4
|
+
export type ProgressTone = "accent" | "info" | "success" | "warning" | "danger";
|
|
5
|
+
/** A type representing properties for the Progress component. */
|
|
6
|
+
export type ProgressProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
7
|
+
/** The completed value, or omitted while the completion is unknown. */
|
|
8
|
+
value?: number;
|
|
9
|
+
/** The maximum the completed value is measured against. */
|
|
10
|
+
max?: number;
|
|
11
|
+
/** The semantic color treatment applied to the completed portion. */
|
|
12
|
+
tone?: ProgressTone;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Renders a determinate or indeterminate progress indicator.
|
|
16
|
+
*
|
|
17
|
+
* Omitting `value` reports an indeterminate task, which animates instead of
|
|
18
|
+
* publishing a completion the consumer cannot yet calculate.
|
|
19
|
+
*
|
|
20
|
+
* Progress carries no accessible name of its own, because only the consumer
|
|
21
|
+
* knows which task is being measured. Name it with `aria-label` or
|
|
22
|
+
* `aria-labelledby` so the task is announced alongside its completion, and
|
|
23
|
+
* describe an unconventional scale with `aria-valuetext`.
|
|
24
|
+
*
|
|
25
|
+
* @param props - The properties that configure the Progress.
|
|
26
|
+
* @param forwardedReference - The reference assigned to the rendered element.
|
|
27
|
+
*
|
|
28
|
+
* @returns The rendered Progress indicator.
|
|
29
|
+
*/
|
|
30
|
+
declare const Progress: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
31
|
+
/** The completed value, or omitted while the completion is unknown. */
|
|
32
|
+
value?: number;
|
|
33
|
+
/** The maximum the completed value is measured against. */
|
|
34
|
+
max?: number;
|
|
35
|
+
/** The semantic color treatment applied to the completed portion. */
|
|
36
|
+
tone?: ProgressTone;
|
|
37
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
38
|
+
export default Progress;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** The maximum a Progress value is measured against when none is given. */
|
|
2
|
+
export declare const DEFAULT_PROGRESS_MAX = 100;
|
|
3
|
+
/** A type representing the completion reported by a determinate Progress. */
|
|
4
|
+
export type ProgressMeasurement = {
|
|
5
|
+
/** The maximum the completed value is measured against. */
|
|
6
|
+
max: number;
|
|
7
|
+
/** The completed value, clamped to the resolved range. */
|
|
8
|
+
value: number;
|
|
9
|
+
/** The completed portion of the range, as a percentage. */
|
|
10
|
+
percentage: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Resolves the completion a determinate Progress reports.
|
|
14
|
+
*
|
|
15
|
+
* Values outside the range are clamped rather than rejected, because progress
|
|
16
|
+
* computed from live totals overshoots on rounding often enough that failing
|
|
17
|
+
* would cost consumers a guard on every update.
|
|
18
|
+
*
|
|
19
|
+
* @param value - The completed value, or undefined while it is unknown.
|
|
20
|
+
* @param max - The maximum the completed value is measured against.
|
|
21
|
+
*
|
|
22
|
+
* @returns The resolved completion, or undefined when Progress is
|
|
23
|
+
* indeterminate.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveProgressMeasurement(value: number | undefined, max: number): ProgressMeasurement | undefined;
|