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.
Files changed (67) hide show
  1. package/dist/{Button-DU4j_IED.cjs → Button-CVe9T_Zw.cjs} +1 -1
  2. package/dist/{Button-BV5OUXpc.js → Button-D6rXvcqq.js} +1 -1
  3. package/dist/Button.cjs +1 -1
  4. package/dist/Button.js +1 -1
  5. package/dist/Checkbox.cjs +1 -1
  6. package/dist/Checkbox.js +111 -110
  7. package/dist/Input.cjs +1 -1
  8. package/dist/Input.js +52 -51
  9. package/dist/Markdown.cjs +1 -1
  10. package/dist/Markdown.js +1 -1
  11. package/dist/Modal.cjs +1 -1
  12. package/dist/Modal.js +57 -56
  13. package/dist/PinInput.cjs +1 -1
  14. package/dist/PinInput.js +88 -87
  15. package/dist/Popover.cjs +1 -1
  16. package/dist/Popover.js +2 -2
  17. package/dist/Progress.cjs +1 -0
  18. package/dist/Progress.js +40 -0
  19. package/dist/Radio.cjs +1 -1
  20. package/dist/Radio.js +48 -47
  21. package/dist/Select.cjs +1 -1
  22. package/dist/Select.js +363 -359
  23. package/dist/Sidebar.cjs +1 -1
  24. package/dist/Sidebar.js +44 -44
  25. package/dist/Spinner-BE0F4y2S.cjs +1 -0
  26. package/dist/Spinner-CmxlDlOk.js +23 -0
  27. package/dist/Spinner.cjs +1 -1
  28. package/dist/Spinner.js +1 -1
  29. package/dist/{Table-qetwZpTC.cjs → Table-BqWBgMTU.cjs} +1 -1
  30. package/dist/{Table-CADupJEU.js → Table-DutHfiXR.js} +2 -2
  31. package/dist/Table.cjs +1 -1
  32. package/dist/Table.js +1 -1
  33. package/dist/{Tooltip-B2d5ss7S.cjs → Tooltip-CCuE-hfp.cjs} +1 -1
  34. package/dist/{Tooltip-BK64rkxV.js → Tooltip-CeyRKNv4.js} +1 -1
  35. package/dist/Tooltip.cjs +1 -1
  36. package/dist/Tooltip.js +1 -1
  37. package/dist/components/Portal/hooks/useAnchoredPosition.d.ts +59 -0
  38. package/dist/components/Progress/Progress.d.ts +38 -0
  39. package/dist/components/Progress/index.d.ts +2 -0
  40. package/dist/components/Progress/utils/value.d.ts +25 -0
  41. package/dist/components/Select/Select.d.ts +6 -74
  42. package/dist/components/Select/components/CustomSelect.d.ts +59 -0
  43. package/dist/components/Select/components/NativeSelect.d.ts +26 -0
  44. package/dist/components/Select/components/SelectListbox.d.ts +50 -0
  45. package/dist/components/Select/hooks/useSelectFormReset.d.ts +27 -0
  46. package/dist/components/Select/hooks/useSelectPosition.d.ts +12 -0
  47. package/dist/components/Select/hooks/useTypeahead.d.ts +14 -0
  48. package/dist/components/Select/utils/options.d.ts +38 -0
  49. package/dist/components/Sidebar/Sidebar.d.ts +30 -24
  50. package/dist/components/Sidebar/components/SidebarOverlay.d.ts +3 -4
  51. package/dist/components/Sidebar/components/SidebarPanel.d.ts +2 -2
  52. package/dist/style.css +1 -1
  53. package/dist/useAnchoredPosition-C0VS7hm6.js +105 -0
  54. package/dist/useAnchoredPosition-D7GRFzoX.cjs +1 -0
  55. package/dist/useFloatingPosition-Dq8xpr3E.js +27 -0
  56. package/dist/useFloatingPosition-g5kXywoB.cjs +1 -0
  57. package/dist/useFocusTrap-C0IcCdNf.js +136 -0
  58. package/dist/useFocusTrap-gAK_402D.cjs +1 -0
  59. package/package.json +6 -1
  60. package/dist/Spinner-BXgw60UC.cjs +0 -1
  61. package/dist/Spinner-CVYvk6YK.js +0 -25
  62. package/dist/floating-position-DIjh2wnP.cjs +0 -1
  63. package/dist/floating-position-DvR6e334.js +0 -50
  64. package/dist/useFloatingPosition-B3ZC-v3v.js +0 -43
  65. package/dist/useFloatingPosition-GzkP9dCc.cjs +0 -1
  66. package/dist/useFocusTrap-BrFZdMqQ.cjs +0 -1
  67. package/dist/useFocusTrap-DhVnlboe.js +0 -136
package/dist/PinInput.js CHANGED
@@ -1,36 +1,37 @@
1
1
  "use client";
2
- import { jsxs as G, jsx as b } from "react/jsx-runtime";
2
+ import { jsxs as G, jsx as V } from "react/jsx-runtime";
3
3
  import { useRef as B, useState as H, useCallback as X, useEffect as K, forwardRef as Z } from "react";
4
4
  import { r as J, h as Q } from "./aria-CeA9QfD1.js";
5
- const W = 3, Y = 10, q = 4;
6
- function ee(a) {
7
- return Number.isFinite(a) ? Math.min(
8
- Y,
9
- Math.max(W, Math.trunc(a))
5
+ import { a as W } from "./reference-CXMr27nM.js";
6
+ const Y = 3, ee = 10, q = 4;
7
+ function te(r) {
8
+ return Number.isFinite(r) ? Math.min(
9
+ ee,
10
+ Math.max(Y, Math.trunc(r))
10
11
  ) : q;
11
12
  }
12
- function S(a, s, r) {
13
- return (s === "numeric" ? a.replace(/[^0-9]/g, "") : a.replace(/[^0-9a-z]/gi, "").toUpperCase()).slice(0, r);
13
+ function S(r, s, l) {
14
+ return (s === "numeric" ? r.replace(/[^0-9]/g, "") : r.replace(/[^0-9a-z]/gi, "").toUpperCase()).slice(0, l);
14
15
  }
15
- function te(a, s, r) {
16
- s.current = a, typeof r == "function" ? r(a) : r && (r.current = a);
16
+ function ne(r, s, l) {
17
+ s.current = r, W(l, r);
17
18
  }
18
- function ne(a, s) {
19
+ function ae(r, s) {
19
20
  var c;
20
- const r = (c = Object.getOwnPropertyDescriptor(
21
- Object.getPrototypeOf(a),
21
+ const l = (c = Object.getOwnPropertyDescriptor(
22
+ Object.getPrototypeOf(r),
22
23
  "value"
23
24
  )) == null ? void 0 : c.set;
24
- r ? r.call(a, s) : a.value = s;
25
+ l ? l.call(r, s) : r.value = s;
25
26
  }
26
- function U(a, s, r) {
27
- const c = Math.min(r - 1, Math.max(0, s)), x = Math.min(c + 1, a.value.length);
28
- a.focus(), a.setSelectionRange(c, x);
27
+ function U(r, s, l) {
28
+ const c = Math.min(l - 1, Math.max(0, s)), x = Math.min(c + 1, r.value.length);
29
+ r.focus(), r.setSelectionRange(c, x);
29
30
  }
30
- function ae(a) {
31
+ function re(r) {
31
32
  const {
32
33
  defaultValue: s,
33
- disabled: r,
34
+ disabled: l,
34
35
  forwardedReference: c,
35
36
  length: x,
36
37
  mode: u,
@@ -41,78 +42,78 @@ function ae(a) {
41
42
  onPaste: g,
42
43
  onSelect: N,
43
44
  readOnly: v,
44
- value: L
45
- } = a, n = ee(x), y = S(
45
+ value: b
46
+ } = r, n = te(x), w = S(
46
47
  s,
47
48
  u,
48
49
  n
49
- ), k = B(null), [w, D] = H(
50
- y
51
- ), [V, d] = H(0), f = L !== void 0, i = S(
52
- f ? L : w,
50
+ ), y = B(null), [k, R] = H(
51
+ w
52
+ ), [D, d] = H(0), f = b !== void 0, i = S(
53
+ f ? b : k,
53
54
  u,
54
55
  n
55
- ), R = X(
56
- (t) => te(
56
+ ), C = X(
57
+ (t) => ne(
57
58
  t,
58
- k,
59
+ y,
59
60
  c
60
61
  ),
61
62
  [c]
62
63
  );
63
64
  K(() => {
64
- !f && w !== i && D(i);
65
- }, [f, i, w]), K(() => {
66
- var l;
65
+ !f && k !== i && R(i);
66
+ }, [f, i, k]), K(() => {
67
+ var o;
67
68
  if (f) return;
68
- const t = (l = k.current) == null ? void 0 : l.form;
69
+ const t = (o = y.current) == null ? void 0 : o.form;
69
70
  if (!t) return;
70
71
  const e = t.getRootNode();
71
- function o(h) {
72
- h.target !== t || h.defaultPrevented || (D(y), d(0));
72
+ function a(h) {
73
+ h.target !== t || h.defaultPrevented || (R(w), d(0));
73
74
  }
74
- return e.addEventListener("reset", o), () => e.removeEventListener("reset", o);
75
- }, [f, y]);
76
- function C(t) {
75
+ return e.addEventListener("reset", a), () => e.removeEventListener("reset", a);
76
+ }, [f, w]);
77
+ function E(t) {
77
78
  const e = t.selectionStart ?? i.length;
78
79
  return Math.min(n - 1, Math.max(0, e));
79
80
  }
80
81
  function T(t) {
81
- const e = t.currentTarget, o = e.selectionStart ?? e.value.length, l = S(e.value, u, n), h = S(
82
- e.value.slice(0, o),
82
+ const e = t.currentTarget, a = e.selectionStart ?? e.value.length, o = S(e.value, u, n), h = S(
83
+ e.value.slice(0, a),
83
84
  u,
84
85
  n
85
86
  ).length;
86
- e.value = l, f || D(l), M == null || M(t), l.length === n && l !== i && (P == null || P(l));
87
+ e.value = o, f || R(o), M == null || M(t), o.length === n && o !== i && (P == null || P(o));
87
88
  const m = Math.min(n - 1, h);
88
89
  d(m), e.setSelectionRange(
89
90
  m,
90
- Math.min(m + 1, l.length)
91
+ Math.min(m + 1, o.length)
91
92
  );
92
93
  }
93
94
  function A(t) {
94
- if (g == null || g(t), t.defaultPrevented || r || v) return;
95
+ if (g == null || g(t), t.defaultPrevented || l || v) return;
95
96
  const e = S(
96
97
  t.clipboardData.getData("text"),
97
98
  u,
98
99
  n
99
100
  );
100
101
  if (t.preventDefault(), e.length === 0) return;
101
- const o = t.currentTarget, l = o.selectionStart ?? i.length, h = o.selectionEnd ?? l, m = e.length === n ? e : S(
102
- i.slice(0, l) + e + i.slice(h),
102
+ const a = t.currentTarget, o = a.selectionStart ?? i.length, h = a.selectionEnd ?? o, m = e.length === n ? e : S(
103
+ i.slice(0, o) + e + i.slice(h),
103
104
  u,
104
105
  n
105
- ), E = e.length === n ? n : Math.min(n, l + e.length);
106
- ne(o, m), o.setSelectionRange(E, E), o.dispatchEvent(new Event("input", { bubbles: !0 }));
106
+ ), L = e.length === n ? n : Math.min(n, o + e.length);
107
+ ae(a, m), a.setSelectionRange(L, L), a.dispatchEvent(new Event("input", { bubbles: !0 }));
107
108
  }
108
109
  function z(t) {
109
110
  if (p == null || p(t), t.defaultPrevented || t.key !== "ArrowLeft" && t.key !== "ArrowRight") return;
110
111
  t.preventDefault();
111
- const e = t.key === "ArrowLeft" ? -1 : 1, o = Math.min(
112
+ const e = t.key === "ArrowLeft" ? -1 : 1, a = Math.min(
112
113
  n - 1,
113
- Math.max(0, C(t.currentTarget) + e)
114
+ Math.max(0, E(t.currentTarget) + e)
114
115
  );
115
- d(o), U(t.currentTarget, o, n);
116
+ d(a), U(t.currentTarget, a, n);
116
117
  }
117
118
  function F(t) {
118
119
  _ == null || _(t);
@@ -120,27 +121,27 @@ function ae(a) {
120
121
  d(e), U(t.currentTarget, e, n);
121
122
  }
122
123
  function O(t) {
123
- N == null || N(t), d(C(t.currentTarget));
124
+ N == null || N(t), d(E(t.currentTarget));
124
125
  }
125
126
  function j(t, e) {
126
- if (t.preventDefault(), r) return;
127
- const o = k.current;
128
- o && (d(e), U(o, e, n));
127
+ if (t.preventDefault(), l) return;
128
+ const a = y.current;
129
+ a && (d(e), U(a, e, n));
129
130
  }
130
131
  return {
131
- activeIndex: V,
132
+ activeIndex: D,
132
133
  handleChange: T,
133
134
  handleFocus: F,
134
135
  handleKeyDown: z,
135
136
  handlePaste: A,
136
137
  handleSelect: O,
137
138
  handleSlotPointerDown: j,
138
- inputCallbackReference: R,
139
+ inputCallbackReference: C,
139
140
  length: n,
140
141
  renderedValue: i
141
142
  };
142
143
  }
143
- const se = Z(function(s, r) {
144
+ const ue = Z(function(s, l) {
144
145
  const {
145
146
  "aria-invalid": c,
146
147
  autoCapitalize: x,
@@ -152,19 +153,19 @@ const se = Z(function(s, r) {
152
153
  invalid: g = !1,
153
154
  length: N = q,
154
155
  mode: v = "numeric",
155
- onChange: L,
156
+ onChange: b,
156
157
  onComplete: n,
157
- onFocus: y,
158
- onKeyDown: k,
159
- onPaste: w,
160
- onSelect: D,
161
- readOnly: V = !1,
158
+ onFocus: w,
159
+ onKeyDown: y,
160
+ onPaste: k,
161
+ onSelect: R,
162
+ readOnly: D = !1,
162
163
  style: d,
163
164
  value: f,
164
165
  wrap: i = !1,
165
- ...R
166
+ ...C
166
167
  } = s, {
167
- activeIndex: C,
168
+ activeIndex: E,
168
169
  handleChange: T,
169
170
  handleFocus: A,
170
171
  handleKeyDown: z,
@@ -173,22 +174,22 @@ const se = Z(function(s, r) {
173
174
  handleSlotPointerDown: j,
174
175
  inputCallbackReference: t,
175
176
  length: e,
176
- renderedValue: o
177
- } = ae({
177
+ renderedValue: a
178
+ } = re({
178
179
  defaultValue: _,
179
180
  disabled: p,
180
- forwardedReference: r,
181
+ forwardedReference: l,
181
182
  length: N,
182
183
  mode: v,
183
- onChange: L,
184
+ onChange: b,
184
185
  onComplete: n,
185
- onFocus: y,
186
- onKeyDown: k,
187
- onPaste: w,
188
- onSelect: D,
189
- readOnly: V,
186
+ onFocus: w,
187
+ onKeyDown: y,
188
+ onPaste: k,
189
+ onSelect: R,
190
+ readOnly: D,
190
191
  value: f
191
- }), l = g || Q(c), h = !i && e >= 6 && e % 2 === 0, m = e / 2, E = {
192
+ }), o = g || Q(c), h = !i && e >= 6 && e % 2 === 0, m = e / 2, L = {
192
193
  ...d,
193
194
  "--nk-pin-input-columns": Math.ceil(e / 2)
194
195
  };
@@ -197,15 +198,15 @@ const se = Z(function(s, r) {
197
198
  {
198
199
  className: ["nk-pin-input", M].filter(Boolean).join(" "),
199
200
  "data-disabled": p || void 0,
200
- "data-invalid": l || void 0,
201
- "data-read-only": V || void 0,
201
+ "data-invalid": o || void 0,
202
+ "data-read-only": D || void 0,
202
203
  "data-wrap": i || void 0,
203
- style: E,
204
+ style: L,
204
205
  children: [
205
- /* @__PURE__ */ b(
206
+ /* @__PURE__ */ V(
206
207
  "input",
207
208
  {
208
- ...R,
209
+ ...C,
209
210
  ref: t,
210
211
  "aria-invalid": J(g, c),
211
212
  autoCapitalize: x ?? (v === "alphanumeric" ? "characters" : "off"),
@@ -221,21 +222,21 @@ const se = Z(function(s, r) {
221
222
  onPaste: F,
222
223
  onSelect: O,
223
224
  pattern: v === "numeric" ? `[0-9]{${e}}` : `[0-9A-Za-z]{${e}}`,
224
- readOnly: V,
225
+ readOnly: D,
225
226
  spellCheck: !1,
226
227
  type: "text",
227
- value: o
228
+ value: a
228
229
  }
229
230
  ),
230
- /* @__PURE__ */ b("span", { "aria-hidden": "true", className: "nk-pin-input__slots", children: Array.from({ length: e }, (oe, I) => /* @__PURE__ */ G("span", { className: "nk-pin-input__slot-group", children: [
231
- h && I === m ? /* @__PURE__ */ b("span", { className: "nk-pin-input__separator", children: "-" }) : null,
232
- /* @__PURE__ */ b(
231
+ /* @__PURE__ */ V("span", { "aria-hidden": "true", className: "nk-pin-input__slots", children: Array.from({ length: e }, (oe, I) => /* @__PURE__ */ G("span", { className: "nk-pin-input__slot-group", children: [
232
+ h && I === m ? /* @__PURE__ */ V("span", { className: "nk-pin-input__separator", children: "-" }) : null,
233
+ /* @__PURE__ */ V(
233
234
  "span",
234
235
  {
235
236
  className: "nk-pin-input__slot",
236
- "data-active": C === I || void 0,
237
+ "data-active": E === I || void 0,
237
238
  onPointerDown: ($) => j($, I),
238
- children: P && o[I] ? /* @__PURE__ */ b("span", { className: "nk-pin-input__censor" }) : o[I] ?? ""
239
+ children: P && a[I] ? /* @__PURE__ */ V("span", { className: "nk-pin-input__censor" }) : a[I] ?? ""
239
240
  }
240
241
  )
241
242
  ] }, I)) })
@@ -244,5 +245,5 @@ const se = Z(function(s, r) {
244
245
  );
245
246
  });
246
247
  export {
247
- se as default
248
+ ue as default
248
249
  };
package/dist/Popover.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"),Oe=require("./aria-Bntn6ad_.cjs"),qe=require("./effects-D85L_7zM.cjs"),M=require("./reference-C2guRuR0.cjs"),b=require("./usePresence-B5RYv4e1.cjs"),we=require("./useFloatingPosition-GzkP9dCc.cjs"),De=require("./useFocusTrap-BrFZdMqQ.cjs"),Fe=require("./Surface-BttJYSDt.cjs");function je(o){const{inert:i,panelElement:c}=o;return qe.useIsomorphicLayoutEffect(()=>{c&&(c.inert=i)},[i,c]),null}function Le(o,i,c){i.current=o,M.assignElementReference(c,o)}function Ne(o,i,c){i.current=o,M.assignElementReference(c,o)}function _e(o){const i=o.tagName.toLowerCase();return o.getAttribute("role")==="button"&&i!=="button"?!1:["button","input","select","summary","textarea"].includes(i)?!0:i==="a"&&o.hasAttribute("href")}function Be(o){return o==="grid"||o==="listbox"||o==="menu"||o==="tree"?o:"dialog"}const Me=t.forwardRef(function(i,c){const{"aria-label":K,"aria-labelledby":re,autoFocus:D=!0,children:ne,className:se,closeOnEscape:oe=!0,closeOnOutsideInteraction:ae=!0,defaultOpen:ie=!1,disabled:x=!1,initialFocusReference:E,onEscapeKeyDown:ce,onOpenChange:k,onPointerDownOutside:I,open:z,placement:A="bottom",restoreFocus:F=!0,role:H="dialog",style:V,tabIndex:ue,trapFocus:v=!1,trigger:d,...le}=i;if(d.type===t.Fragment)throw new Error("Popover requires a single non-Fragment trigger");const $=t.useId(),de=t.useContext(b.FocusScopeContext),U=`${$}-popover`,s=d.props,G=M.getElementReference(d),J=s.id??`${$}-trigger`,P=x||s.disabled===!0||s["aria-disabled"]===!0||s["aria-disabled"]==="true",R=z!==void 0,[fe,pe]=t.useState(ie),r=R?z:fe,C=b.usePresence(r),Q=t.useRef(null),W=t.useRef(null),j=t.useRef("programmatic"),L=t.useRef(null),X=t.useRef(r),T=t.useRef(null),[ge,me]=t.useReducer(e=>e+1,0),[u,be]=t.useState(null),[f,ve]=t.useState(null),a=(u==null?void 0:u.ownerDocument)??(typeof document>"u"?null:document),S=b.useBoundary("Popover").boundaryElement,O=b.useOverlayLayer(C.present,S),ye=t.useMemo(()=>[Q,W],[]),p=we.useFloatingPosition(C.present,A,u,f,S),he=t.useCallback(e=>{Ne(e,Q,G),be(e)},[G]),Ee=t.useCallback(e=>{Le(e,W,c),ve(e)},[c]),g=t.useCallback((e,n)=>{r!==e&&(R?(L.current={open:e,reason:n},me()):(j.current=n,pe(e)),k==null||k(e,n))},[R,k,r]),Pe=t.useCallback(()=>{g(!1,"escape")},[g]),Re=t.useCallback(()=>{g(!1,"outside")},[g]),Te=t.useCallback(e=>{var m;if(I==null||I(e),e.defaultPrevented)return;const n=(m=a==null?void 0:a.defaultView)==null?void 0:m.HTMLElement;n?T.current=e.composedPath().find(h=>h instanceof n&&h.tabIndex>=0)??e.target:T.current=e.target},[I,a]);b.useDismissableLayer({boundary:S,active:r,boundaries:ye,dismissOnEscape:oe,dismissOnPointerDownOutside:ae,layerId:O.id,onEscapeDismiss:Pe,onEscapeKeyDown:ce,onPointerDownOutside:Te,onPointerDownOutsideDismiss:Re,ownerDocument:a});const xe=De.useFocusTrap({boundary:S,active:r&&v,autoFocus:D,container:f,initialFocusReference:E,layerId:O.id,restoreFocus:F});t.useEffect(()=>{if(!r||v||!D||!f)return;let e=!0;return Promise.resolve().then(()=>{if(!e)return;const n=E==null?void 0:E.current;(n&&f.contains(n)?n:f).focus({preventScroll:!0})}),()=>{e=!1}},[D,E,r,f,v]),t.useEffect(()=>{var te;const e=X.current;X.current=r;const n=L.current;let m=j.current;if(R&&(m="programmatic",e!==r&&(n==null?void 0:n.open)===r&&(m=n.reason)),L.current=null,r){j.current="programmatic",T.current=null;return}const h=a==null?void 0:a.activeElement,_=T.current,B=(te=a==null?void 0:a.defaultView)==null?void 0:te.HTMLElement,Se=m==="outside"&&B&&_ instanceof B&&h instanceof B&&(_===h||_.contains(h));e&&!v&&F&&!Se&&(u==null||u.focus({preventScroll:!0})),T.current=null},[ge,R,r,a,F,v,u]),t.useEffect(()=>{x&&r&&g(!1,"programmatic")},[x,r,g]);function ke(e){var n;if(P){e.preventDefault(),e.stopPropagation();return}(n=s.onClick)==null||n.call(s,e),!e.defaultPrevented&&g(!r,"trigger")}function Ie(e){var n;(n=s.onKeyDown)==null||n.call(s,e),!(e.defaultPrevented||P||_e(e.currentTarget)||e.key!=="Enter"&&e.key!==" ")&&(e.preventDefault(),e.currentTarget.click())}if(x)return d;const N=typeof d.type=="string",y=N?d.type:null,Y=y==="a"&&typeof s.href=="string",Z=N&&!(y==="button"||y==="input"||y==="select"||y==="summary"||y==="textarea"||Y),ee=Y&&P;let q=s.role;q===void 0&&(ee?q="link":Z&&(q="button"));let w=s.tabIndex;w===void 0&&Z&&(w=0),P&&(w=-1);const Ce=t.cloneElement(d,{"aria-controls":r?Oe.mergeIdentifiers(s["aria-controls"],U):s["aria-controls"],"aria-expanded":r,"aria-haspopup":s["aria-haspopup"]??Be(H),"aria-disabled":P?!0:s["aria-disabled"],className:[s.className,"nk-popover__trigger"].filter(Boolean).join(" "),href:ee?void 0:s.href,id:J,onClick:ke,onKeyDown:N?Ie:s.onKeyDown,ref:he,role:q,tabIndex:w});return l.jsxs(l.Fragment,{children:[Ce,l.jsx(b.FocusScopeContext.Provider,{value:r&&v?xe:de,children:C.present&&a?l.jsx(b.Portal,{children:l.jsxs(Fe.Surface,{...le,ref:Ee,"aria-hidden":r?void 0:!0,"aria-label":r?K:void 0,"aria-labelledby":r?re??(K===void 0?J:void 0):void 0,className:["nk-popover",se].filter(Boolean).join(" "),"data-placement":(p==null?void 0:p.placement)??A,"data-state":C.state==="closing"?"closing":"open",id:U,role:r?H:void 0,style:p?{...V,"--nk-popover-arrow-offset":`${p.arrowOffset}px`,left:p.left,top:p.top,zIndex:O.zIndex}:{...V,visibility:"hidden",zIndex:O.zIndex},tabIndex:ue??-1,children:[l.jsx(je,{inert:!r,panelElement:f}),l.jsx("span",{"aria-hidden":"true",className:"nk-popover__arrow"}),l.jsx("div",{className:"nk-popover__content",children:ne})]})}):null})]})});exports.default=Me;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),t=require("react"),Oe=require("./aria-Bntn6ad_.cjs"),qe=require("./effects-D85L_7zM.cjs"),M=require("./reference-C2guRuR0.cjs"),b=require("./usePresence-B5RYv4e1.cjs"),we=require("./useFloatingPosition-g5kXywoB.cjs"),De=require("./useFocusTrap-gAK_402D.cjs"),Fe=require("./Surface-BttJYSDt.cjs");function je(o){const{inert:i,panelElement:c}=o;return qe.useIsomorphicLayoutEffect(()=>{c&&(c.inert=i)},[i,c]),null}function Le(o,i,c){i.current=o,M.assignElementReference(c,o)}function Ne(o,i,c){i.current=o,M.assignElementReference(c,o)}function _e(o){const i=o.tagName.toLowerCase();return o.getAttribute("role")==="button"&&i!=="button"?!1:["button","input","select","summary","textarea"].includes(i)?!0:i==="a"&&o.hasAttribute("href")}function Be(o){return o==="grid"||o==="listbox"||o==="menu"||o==="tree"?o:"dialog"}const Me=t.forwardRef(function(i,c){const{"aria-label":K,"aria-labelledby":re,autoFocus:D=!0,children:ne,className:se,closeOnEscape:oe=!0,closeOnOutsideInteraction:ae=!0,defaultOpen:ie=!1,disabled:x=!1,initialFocusReference:E,onEscapeKeyDown:ce,onOpenChange:k,onPointerDownOutside:I,open:z,placement:A="bottom",restoreFocus:F=!0,role:H="dialog",style:V,tabIndex:ue,trapFocus:v=!1,trigger:d,...le}=i;if(d.type===t.Fragment)throw new Error("Popover requires a single non-Fragment trigger");const $=t.useId(),de=t.useContext(b.FocusScopeContext),U=`${$}-popover`,s=d.props,G=M.getElementReference(d),J=s.id??`${$}-trigger`,P=x||s.disabled===!0||s["aria-disabled"]===!0||s["aria-disabled"]==="true",R=z!==void 0,[fe,pe]=t.useState(ie),r=R?z:fe,C=b.usePresence(r),Q=t.useRef(null),W=t.useRef(null),j=t.useRef("programmatic"),L=t.useRef(null),X=t.useRef(r),T=t.useRef(null),[ge,me]=t.useReducer(e=>e+1,0),[u,be]=t.useState(null),[f,ve]=t.useState(null),a=(u==null?void 0:u.ownerDocument)??(typeof document>"u"?null:document),S=b.useBoundary("Popover").boundaryElement,O=b.useOverlayLayer(C.present,S),ye=t.useMemo(()=>[Q,W],[]),p=we.useFloatingPosition(C.present,A,u,f,S),he=t.useCallback(e=>{Ne(e,Q,G),be(e)},[G]),Ee=t.useCallback(e=>{Le(e,W,c),ve(e)},[c]),g=t.useCallback((e,n)=>{r!==e&&(R?(L.current={open:e,reason:n},me()):(j.current=n,pe(e)),k==null||k(e,n))},[R,k,r]),Pe=t.useCallback(()=>{g(!1,"escape")},[g]),Re=t.useCallback(()=>{g(!1,"outside")},[g]),Te=t.useCallback(e=>{var m;if(I==null||I(e),e.defaultPrevented)return;const n=(m=a==null?void 0:a.defaultView)==null?void 0:m.HTMLElement;n?T.current=e.composedPath().find(h=>h instanceof n&&h.tabIndex>=0)??e.target:T.current=e.target},[I,a]);b.useDismissableLayer({boundary:S,active:r,boundaries:ye,dismissOnEscape:oe,dismissOnPointerDownOutside:ae,layerId:O.id,onEscapeDismiss:Pe,onEscapeKeyDown:ce,onPointerDownOutside:Te,onPointerDownOutsideDismiss:Re,ownerDocument:a});const xe=De.useFocusTrap({boundary:S,active:r&&v,autoFocus:D,container:f,initialFocusReference:E,layerId:O.id,restoreFocus:F});t.useEffect(()=>{if(!r||v||!D||!f)return;let e=!0;return Promise.resolve().then(()=>{if(!e)return;const n=E==null?void 0:E.current;(n&&f.contains(n)?n:f).focus({preventScroll:!0})}),()=>{e=!1}},[D,E,r,f,v]),t.useEffect(()=>{var te;const e=X.current;X.current=r;const n=L.current;let m=j.current;if(R&&(m="programmatic",e!==r&&(n==null?void 0:n.open)===r&&(m=n.reason)),L.current=null,r){j.current="programmatic",T.current=null;return}const h=a==null?void 0:a.activeElement,_=T.current,B=(te=a==null?void 0:a.defaultView)==null?void 0:te.HTMLElement,Se=m==="outside"&&B&&_ instanceof B&&h instanceof B&&(_===h||_.contains(h));e&&!v&&F&&!Se&&(u==null||u.focus({preventScroll:!0})),T.current=null},[ge,R,r,a,F,v,u]),t.useEffect(()=>{x&&r&&g(!1,"programmatic")},[x,r,g]);function ke(e){var n;if(P){e.preventDefault(),e.stopPropagation();return}(n=s.onClick)==null||n.call(s,e),!e.defaultPrevented&&g(!r,"trigger")}function Ie(e){var n;(n=s.onKeyDown)==null||n.call(s,e),!(e.defaultPrevented||P||_e(e.currentTarget)||e.key!=="Enter"&&e.key!==" ")&&(e.preventDefault(),e.currentTarget.click())}if(x)return d;const N=typeof d.type=="string",y=N?d.type:null,Y=y==="a"&&typeof s.href=="string",Z=N&&!(y==="button"||y==="input"||y==="select"||y==="summary"||y==="textarea"||Y),ee=Y&&P;let q=s.role;q===void 0&&(ee?q="link":Z&&(q="button"));let w=s.tabIndex;w===void 0&&Z&&(w=0),P&&(w=-1);const Ce=t.cloneElement(d,{"aria-controls":r?Oe.mergeIdentifiers(s["aria-controls"],U):s["aria-controls"],"aria-expanded":r,"aria-haspopup":s["aria-haspopup"]??Be(H),"aria-disabled":P?!0:s["aria-disabled"],className:[s.className,"nk-popover__trigger"].filter(Boolean).join(" "),href:ee?void 0:s.href,id:J,onClick:ke,onKeyDown:N?Ie:s.onKeyDown,ref:he,role:q,tabIndex:w});return l.jsxs(l.Fragment,{children:[Ce,l.jsx(b.FocusScopeContext.Provider,{value:r&&v?xe:de,children:C.present&&a?l.jsx(b.Portal,{children:l.jsxs(Fe.Surface,{...le,ref:Ee,"aria-hidden":r?void 0:!0,"aria-label":r?K:void 0,"aria-labelledby":r?re??(K===void 0?J:void 0):void 0,className:["nk-popover",se].filter(Boolean).join(" "),"data-placement":(p==null?void 0:p.placement)??A,"data-state":C.state==="closing"?"closing":"open",id:U,role:r?H:void 0,style:p?{...V,"--nk-popover-arrow-offset":`${p.arrowOffset}px`,left:p.left,top:p.top,zIndex:O.zIndex}:{...V,visibility:"hidden",zIndex:O.zIndex},tabIndex:ue??-1,children:[l.jsx(je,{inert:!r,panelElement:f}),l.jsx("span",{"aria-hidden":"true",className:"nk-popover__arrow"}),l.jsx("div",{className:"nk-popover__content",children:ne})]})}):null})]})});exports.default=Me;
package/dist/Popover.js CHANGED
@@ -5,8 +5,8 @@ import { m as Ae } from "./aria-CeA9QfD1.js";
5
5
  import { u as Me } from "./effects-D5CWf-Pl.js";
6
6
  import { g as $e, a as se } from "./reference-CXMr27nM.js";
7
7
  import { F as oe, c as He, b as Ve, d as Ue, e as Ge, P as Je } from "./usePresence-CqegYqy4.js";
8
- import { u as Qe } from "./useFloatingPosition-B3ZC-v3v.js";
9
- import { u as We } from "./useFocusTrap-DhVnlboe.js";
8
+ import { u as Qe } from "./useFloatingPosition-Dq8xpr3E.js";
9
+ import { u as We } from "./useFocusTrap-C0IcCdNf.js";
10
10
  import { S as Xe } from "./Surface-vEFsZC12.js";
11
11
  function Ye(o) {
12
12
  const { inert: a, panelElement: i } = o;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),p=require("react"),c=100;function g(s,r){if(typeof s!="number"||!Number.isFinite(s))return;const t=Number.isFinite(r)&&r>0?r:c,o=Math.min(Math.max(s,0),t),n=o/t*100;return{max:t,value:o,percentage:n}}const f=p.forwardRef(function(r,t){const{className:o,max:n=c,style:l,tone:u="accent",value:d,...v}=r,e=g(d,n),a=e===void 0,m={...l,...e?{"--nk-progress-completion":`${e.percentage}%`}:void 0};return i.jsx("div",{...v,ref:t,"aria-valuemax":e==null?void 0:e.max,"aria-valuemin":a?void 0:0,"aria-valuenow":e==null?void 0:e.value,className:["nk-progress",o].filter(Boolean).join(" "),"data-indeterminate":a||void 0,"data-tone":u,role:"progressbar",style:m,children:i.jsx("span",{"aria-hidden":"true",className:"nk-progress__indicator"})})});exports.default=f;
@@ -0,0 +1,40 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as v } from "react";
3
+ const c = 100;
4
+ function f(a, r) {
5
+ if (typeof a != "number" || !Number.isFinite(a)) return;
6
+ const o = Number.isFinite(r) && r > 0 ? r : c, n = Math.min(Math.max(a, 0), o), s = n / o * 100;
7
+ return { max: o, value: n, percentage: s };
8
+ }
9
+ const M = v(function(r, o) {
10
+ const {
11
+ className: n,
12
+ max: s = c,
13
+ style: l,
14
+ tone: d = "accent",
15
+ value: m,
16
+ ...p
17
+ } = r, e = f(m, s), t = e === void 0, u = {
18
+ ...l,
19
+ ...e ? { "--nk-progress-completion": `${e.percentage}%` } : void 0
20
+ };
21
+ return /* @__PURE__ */ i(
22
+ "div",
23
+ {
24
+ ...p,
25
+ ref: o,
26
+ "aria-valuemax": e == null ? void 0 : e.max,
27
+ "aria-valuemin": t ? void 0 : 0,
28
+ "aria-valuenow": e == null ? void 0 : e.value,
29
+ className: ["nk-progress", n].filter(Boolean).join(" "),
30
+ "data-indeterminate": t || void 0,
31
+ "data-tone": d,
32
+ role: "progressbar",
33
+ style: u,
34
+ children: /* @__PURE__ */ i("span", { "aria-hidden": "true", className: "nk-progress__indicator" })
35
+ }
36
+ );
37
+ });
38
+ export {
39
+ M as default
40
+ };
package/dist/Radio.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"),r=require("react"),R=require("./aria-Bntn6ad_.cjs"),g=require("./field-control-NfLwcPj6.cjs"),j=require("./Text-DWYlIcPj.cjs"),m=r.createContext(void 0),k=r.forwardRef(function(d,e){const{"aria-invalid":c,children:f,className:p,defaultValue:b,disabled:n=!1,invalid:v=!1,name:a,onChange:u,orientation:o="vertical",required:t=!1,value:h,...x}=d,s=v||R.hasInvalidState(c),C={defaultValue:b,disabled:n,name:a,onChange:u,required:t,value:h};return l.jsx(m.Provider,{value:C,children:l.jsx("div",{...x,ref:e,"aria-disabled":n||void 0,"aria-invalid":R.resolveAriaInvalid(v,c),"aria-required":t||void 0,className:["nk-radio-group",p].filter(Boolean).join(" "),"data-disabled":n||void 0,"data-invalid":s||void 0,"data-orientation":o,role:"radiogroup",children:f})})});g.markFieldGroupControl(k,"group");function q(){const i=r.useContext(m);if(!i)throw new Error("Radio must be rendered within RadioGroup");return i}function _(i,d,e){d.current=i,typeof e=="function"?e(i):e&&(e.current=i)}const G=r.forwardRef(function(d,e){const{children:c,className:f,disabled:p=!1,style:b,value:n,...v}=d,a=q(),u=r.useRef(null),o=a.disabled||p,t=a.value!==void 0,h=a.value===n,x=r.useCallback(s=>_(s,u,e),[e]);return r.useEffect(()=>{var s;!t&&o&&((s=u.current)!=null&&s.checked)&&(u.current.checked=!1)},[t,o]),l.jsxs("label",{className:["nk-radio",f].filter(Boolean).join(" "),"data-disabled":o||void 0,style:b,children:[l.jsx("input",{...v,ref:x,checked:t?!o&&h:void 0,className:"nk-radio__control",defaultChecked:t?void 0:!o&&a.defaultValue===n,disabled:o,name:a.name,onChange:a.onChange,required:a.required,type:"radio",value:n}),l.jsx("span",{"aria-hidden":"true",className:"nk-radio__visual"}),l.jsx(j.Text,{as:"span",className:"nk-radio__label",children:c})]})}),N=Object.assign(G,{Group:k});exports.default=N;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react/jsx-runtime"),r=require("react"),C=require("./reference-C2guRuR0.cjs"),m=require("./aria-Bntn6ad_.cjs"),j=require("./field-control-NfLwcPj6.cjs"),q=require("./Text-DWYlIcPj.cjs"),x=r.createContext(void 0),g=r.forwardRef(function(l,t){const{"aria-invalid":c,children:v,className:p,defaultValue:R,disabled:o=!1,invalid:f=!1,name:e,onChange:u,orientation:a="vertical",required:n=!1,value:b,...h}=l,s=f||m.hasInvalidState(c),k={defaultValue:R,disabled:o,name:e,onChange:u,required:n,value:b};return d.jsx(x.Provider,{value:k,children:d.jsx("div",{...h,ref:t,"aria-disabled":o||void 0,"aria-invalid":m.resolveAriaInvalid(f,c),"aria-required":n||void 0,className:["nk-radio-group",p].filter(Boolean).join(" "),"data-disabled":o||void 0,"data-invalid":s||void 0,"data-orientation":a,role:"radiogroup",children:v})})});j.markFieldGroupControl(g,"group");function _(){const i=r.useContext(x);if(!i)throw new Error("Radio must be rendered within RadioGroup");return i}function G(i,l,t){l.current=i,C.assignElementReference(t,i)}const N=r.forwardRef(function(l,t){const{children:c,className:v,disabled:p=!1,style:R,value:o,...f}=l,e=_(),u=r.useRef(null),a=e.disabled||p,n=e.value!==void 0,b=e.value===o,h=r.useCallback(s=>G(s,u,t),[t]);return r.useEffect(()=>{var s;!n&&a&&((s=u.current)!=null&&s.checked)&&(u.current.checked=!1)},[n,a]),d.jsxs("label",{className:["nk-radio",v].filter(Boolean).join(" "),"data-disabled":a||void 0,style:R,children:[d.jsx("input",{...f,ref:h,checked:n?!a&&b:void 0,className:"nk-radio__control",defaultChecked:n?void 0:!a&&e.defaultValue===o,disabled:a,name:e.name,onChange:e.onChange,required:e.required,type:"radio",value:o}),d.jsx("span",{"aria-hidden":"true",className:"nk-radio__visual"}),d.jsx(q.Text,{as:"span",className:"nk-radio__label",children:c})]})}),w=Object.assign(N,{Group:g});exports.default=w;
package/dist/Radio.js CHANGED
@@ -1,110 +1,111 @@
1
1
  "use client";
2
2
  import { jsx as l, jsxs as g } from "react/jsx-runtime";
3
- import { createContext as x, forwardRef as b, useContext as G, useRef as N, useCallback as _, useEffect as j } from "react";
4
- import { r as q, h as I } from "./aria-CeA9QfD1.js";
5
- import { m as V } from "./field-control-XAn_FKks.js";
6
- import { T as y } from "./Text-rN6iDo0V.js";
7
- const k = x(void 0), R = b(
8
- function(s, a) {
3
+ import { createContext as x, forwardRef as R, useContext as G, useRef as N, useCallback as _, useEffect as j } from "react";
4
+ import { a as q } from "./reference-CXMr27nM.js";
5
+ import { r as I, h as V } from "./aria-CeA9QfD1.js";
6
+ import { m as w } from "./field-control-XAn_FKks.js";
7
+ import { T as E } from "./Text-rN6iDo0V.js";
8
+ const b = x(void 0), k = R(
9
+ function(d, n) {
9
10
  const {
10
- "aria-invalid": u,
11
+ "aria-invalid": c,
11
12
  children: f,
12
13
  className: p,
13
14
  defaultValue: v,
14
- disabled: n = !1,
15
- invalid: c = !1,
15
+ disabled: i = !1,
16
+ invalid: u = !1,
16
17
  name: e,
17
- onChange: d,
18
- orientation: o = "vertical",
18
+ onChange: s,
19
+ orientation: a = "vertical",
19
20
  required: r = !1,
20
21
  value: m,
21
22
  ...h
22
- } = s, t = c || I(u), C = {
23
+ } = d, t = u || V(c), C = {
23
24
  defaultValue: v,
24
- disabled: n,
25
+ disabled: i,
25
26
  name: e,
26
- onChange: d,
27
+ onChange: s,
27
28
  required: r,
28
29
  value: m
29
30
  };
30
- return /* @__PURE__ */ l(k.Provider, { value: C, children: /* @__PURE__ */ l(
31
+ return /* @__PURE__ */ l(b.Provider, { value: C, children: /* @__PURE__ */ l(
31
32
  "div",
32
33
  {
33
34
  ...h,
34
- ref: a,
35
- "aria-disabled": n || void 0,
36
- "aria-invalid": q(c, u),
35
+ ref: n,
36
+ "aria-disabled": i || void 0,
37
+ "aria-invalid": I(u, c),
37
38
  "aria-required": r || void 0,
38
39
  className: ["nk-radio-group", p].filter(Boolean).join(" "),
39
- "data-disabled": n || void 0,
40
+ "data-disabled": i || void 0,
40
41
  "data-invalid": t || void 0,
41
- "data-orientation": o,
42
+ "data-orientation": a,
42
43
  role: "radiogroup",
43
44
  children: f
44
45
  }
45
46
  ) });
46
47
  }
47
48
  );
48
- V(R, "group");
49
+ w(k, "group");
49
50
  function P() {
50
- const i = G(k);
51
- if (!i)
51
+ const o = G(b);
52
+ if (!o)
52
53
  throw new Error("Radio must be rendered within RadioGroup");
53
- return i;
54
+ return o;
54
55
  }
55
- function B(i, s, a) {
56
- s.current = i, typeof a == "function" ? a(i) : a && (a.current = i);
56
+ function y(o, d, n) {
57
+ d.current = o, q(n, o);
57
58
  }
58
- const E = b(function(s, a) {
59
+ const B = R(function(d, n) {
59
60
  const {
60
- children: u,
61
+ children: c,
61
62
  className: f,
62
63
  disabled: p = !1,
63
64
  style: v,
64
- value: n,
65
- ...c
66
- } = s, e = P(), d = N(null), o = e.disabled || p, r = e.value !== void 0, m = e.value === n, h = _(
67
- (t) => B(
65
+ value: i,
66
+ ...u
67
+ } = d, e = P(), s = N(null), a = e.disabled || p, r = e.value !== void 0, m = e.value === i, h = _(
68
+ (t) => y(
68
69
  t,
69
- d,
70
- a
70
+ s,
71
+ n
71
72
  ),
72
- [a]
73
+ [n]
73
74
  );
74
75
  return j(() => {
75
76
  var t;
76
- !r && o && ((t = d.current) != null && t.checked) && (d.current.checked = !1);
77
- }, [r, o]), /* @__PURE__ */ g(
77
+ !r && a && ((t = s.current) != null && t.checked) && (s.current.checked = !1);
78
+ }, [r, a]), /* @__PURE__ */ g(
78
79
  "label",
79
80
  {
80
81
  className: ["nk-radio", f].filter(Boolean).join(" "),
81
- "data-disabled": o || void 0,
82
+ "data-disabled": a || void 0,
82
83
  style: v,
83
84
  children: [
84
85
  /* @__PURE__ */ l(
85
86
  "input",
86
87
  {
87
- ...c,
88
+ ...u,
88
89
  ref: h,
89
- checked: r ? !o && m : void 0,
90
+ checked: r ? !a && m : void 0,
90
91
  className: "nk-radio__control",
91
- defaultChecked: r ? void 0 : !o && e.defaultValue === n,
92
- disabled: o,
92
+ defaultChecked: r ? void 0 : !a && e.defaultValue === i,
93
+ disabled: a,
93
94
  name: e.name,
94
95
  onChange: e.onChange,
95
96
  required: e.required,
96
97
  type: "radio",
97
- value: n
98
+ value: i
98
99
  }
99
100
  ),
100
101
  /* @__PURE__ */ l("span", { "aria-hidden": "true", className: "nk-radio__visual" }),
101
- /* @__PURE__ */ l(y, { as: "span", className: "nk-radio__label", children: u })
102
+ /* @__PURE__ */ l(E, { as: "span", className: "nk-radio__label", children: c })
102
103
  ]
103
104
  }
104
105
  );
105
- }), O = Object.assign(E, {
106
- Group: R
106
+ }), z = Object.assign(B, {
107
+ Group: k
107
108
  });
108
109
  export {
109
- O as default
110
+ z as default
110
111
  };