neatkit 0.9.0 → 0.11.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 (108) hide show
  1. package/dist/Boundary.cjs +1 -1
  2. package/dist/Boundary.js +191 -120
  3. package/dist/{Button-DU4j_IED.cjs → Button-DtrX4X-s.cjs} +1 -1
  4. package/dist/{Button-BV5OUXpc.js → Button-LmEHdRkW.js} +2 -2
  5. package/dist/Button.cjs +1 -1
  6. package/dist/Button.js +1 -1
  7. package/dist/Checkbox.cjs +1 -1
  8. package/dist/Checkbox.js +112 -111
  9. package/dist/Field.cjs +1 -1
  10. package/dist/Field.js +57 -62
  11. package/dist/Icon-CMSHMSDJ.cjs +1 -0
  12. package/dist/{Icon-CxK1wlGk.js → Icon-NT3kRJYz.js} +275 -94
  13. package/dist/Icon.cjs +1 -1
  14. package/dist/Icon.js +1 -1
  15. package/dist/Input.cjs +1 -1
  16. package/dist/Input.js +53 -52
  17. package/dist/Markdown.cjs +1 -1
  18. package/dist/Markdown.js +1 -1
  19. package/dist/Modal.cjs +1 -1
  20. package/dist/Modal.js +58 -57
  21. package/dist/PinInput.cjs +1 -1
  22. package/dist/PinInput.js +89 -88
  23. package/dist/Popover.cjs +1 -1
  24. package/dist/Popover.js +117 -119
  25. package/dist/Progress.cjs +1 -0
  26. package/dist/Progress.js +40 -0
  27. package/dist/Radio.cjs +1 -1
  28. package/dist/Radio.js +48 -47
  29. package/dist/Select.cjs +1 -1
  30. package/dist/Select.js +364 -359
  31. package/dist/Sidebar.cjs +1 -1
  32. package/dist/Sidebar.js +381 -332
  33. package/dist/Spinner-BE0F4y2S.cjs +1 -0
  34. package/dist/Spinner-CmxlDlOk.js +23 -0
  35. package/dist/Spinner.cjs +1 -1
  36. package/dist/Spinner.js +1 -1
  37. package/dist/Switch.cjs +1 -1
  38. package/dist/Switch.js +1 -1
  39. package/dist/{Table-qetwZpTC.cjs → Table-Bjw9lUKS.cjs} +1 -1
  40. package/dist/{Table-CADupJEU.js → Table-GeoE4h-u.js} +2 -2
  41. package/dist/Table.cjs +1 -1
  42. package/dist/Table.js +1 -1
  43. package/dist/TextArea.cjs +1 -1
  44. package/dist/TextArea.js +1 -1
  45. package/dist/Tooltip-CpyROf6x.js +225 -0
  46. package/dist/Tooltip-DDPh_YFO.cjs +1 -0
  47. package/dist/Tooltip.cjs +1 -1
  48. package/dist/Tooltip.js +1 -1
  49. package/dist/aria-Bv-xVREf.js +17 -0
  50. package/dist/aria-DM-xYEHQ.cjs +1 -0
  51. package/dist/components/Boundary/hooks/useDocumentBackground.d.ts +28 -0
  52. package/dist/components/Icon/icons/AppleIcon.d.ts +11 -0
  53. package/dist/components/Icon/icons/BingIcon.d.ts +11 -0
  54. package/dist/components/Icon/icons/FacebookIcon.d.ts +11 -0
  55. package/dist/components/Icon/icons/GoogleIcon.d.ts +11 -0
  56. package/dist/components/Icon/icons/InstagramIcon.d.ts +11 -0
  57. package/dist/components/Icon/icons/MicrosoftIcon.d.ts +11 -0
  58. package/dist/components/Icon/icons/TwitterIcon.d.ts +11 -0
  59. package/dist/components/Icon/utils/registry.d.ts +7 -0
  60. package/dist/components/PinInput/PinInput.d.ts +1 -1
  61. package/dist/components/Portal/hooks/useAnchoredPosition.d.ts +59 -0
  62. package/dist/components/Progress/Progress.d.ts +38 -0
  63. package/dist/components/Progress/index.d.ts +2 -0
  64. package/dist/components/Progress/utils/value.d.ts +25 -0
  65. package/dist/components/Radio/Radio.d.ts +1 -1
  66. package/dist/components/Select/Select.d.ts +6 -74
  67. package/dist/components/Select/components/CustomSelect.d.ts +59 -0
  68. package/dist/components/Select/components/NativeSelect.d.ts +26 -0
  69. package/dist/components/Select/components/SelectListbox.d.ts +50 -0
  70. package/dist/components/Select/hooks/useSelectFormReset.d.ts +27 -0
  71. package/dist/components/Select/hooks/useSelectPosition.d.ts +12 -0
  72. package/dist/components/Select/hooks/useTypeahead.d.ts +14 -0
  73. package/dist/components/Select/utils/options.d.ts +38 -0
  74. package/dist/components/Sidebar/Sidebar.d.ts +30 -24
  75. package/dist/components/Sidebar/components/SidebarFallbackTrigger.d.ts +32 -0
  76. package/dist/components/Sidebar/components/SidebarOverlay.d.ts +3 -4
  77. package/dist/components/Sidebar/components/SidebarPanel.d.ts +3 -3
  78. package/dist/components/Sidebar/components/SidebarTrigger.d.ts +4 -0
  79. package/dist/effects-D98vUn6N.cjs +1 -0
  80. package/dist/effects-DGbA6Q2O.js +18 -0
  81. package/dist/style.css +1 -1
  82. package/dist/useAnchoredPosition-C0VS7hm6.js +105 -0
  83. package/dist/useAnchoredPosition-D7GRFzoX.cjs +1 -0
  84. package/dist/useFloatingPosition-DQgw-w_Z.cjs +1 -0
  85. package/dist/useFloatingPosition-MGoyautY.js +57 -0
  86. package/dist/useFocusTrap-BxPazAL6.js +136 -0
  87. package/dist/useFocusTrap-CrMcAu8s.cjs +1 -0
  88. package/dist/{usePresence-CqegYqy4.js → usePresence-BTRY1_l-.js} +47 -56
  89. package/dist/usePresence-Dm0mls5p.cjs +1 -0
  90. package/dist/utils/aria.d.ts +4 -5
  91. package/dist/utils/trigger.d.ts +46 -0
  92. package/package.json +6 -1
  93. package/dist/Icon-BIBzgznI.cjs +0 -1
  94. package/dist/Spinner-BXgw60UC.cjs +0 -1
  95. package/dist/Spinner-CVYvk6YK.js +0 -25
  96. package/dist/Tooltip-B2d5ss7S.cjs +0 -1
  97. package/dist/Tooltip-BK64rkxV.js +0 -231
  98. package/dist/aria-Bntn6ad_.cjs +0 -1
  99. package/dist/aria-CeA9QfD1.js +0 -15
  100. package/dist/effects-D5CWf-Pl.js +0 -8
  101. package/dist/effects-D85L_7zM.cjs +0 -1
  102. package/dist/floating-position-DIjh2wnP.cjs +0 -1
  103. package/dist/floating-position-DvR6e334.js +0 -50
  104. package/dist/useFloatingPosition-B3ZC-v3v.js +0 -43
  105. package/dist/useFloatingPosition-GzkP9dCc.cjs +0 -1
  106. package/dist/useFocusTrap-BrFZdMqQ.cjs +0 -1
  107. package/dist/useFocusTrap-DhVnlboe.js +0 -136
  108. package/dist/usePresence-B5RYv4e1.cjs +0 -1
package/dist/Popover.js CHANGED
@@ -1,230 +1,228 @@
1
1
  "use client";
2
- import { jsxs as ne, Fragment as Le, jsx as I } from "react/jsx-runtime";
3
- import { forwardRef as Ne, Fragment as Be, useId as _e, useContext as Ke, useState as q, useRef as v, useReducer as je, useMemo as qe, useCallback as y, useEffect as z, cloneElement as ze } from "react";
4
- import { m as Ae } from "./aria-CeA9QfD1.js";
5
- import { u as Me } from "./effects-D5CWf-Pl.js";
6
- import { g as $e, a as se } from "./reference-CXMr27nM.js";
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";
10
- import { S as Xe } from "./Surface-vEFsZC12.js";
11
- function Ye(o) {
12
- const { inert: a, panelElement: i } = o;
13
- return Me(() => {
2
+ import { jsxs as ne, Fragment as Ne, jsx as I } from "react/jsx-runtime";
3
+ import { forwardRef as _e, Fragment as Be, useId as qe, useContext as ze, useState as A, useRef as y, useReducer as Ae, useMemo as Me, useCallback as h, useEffect as M, cloneElement as $e } from "react";
4
+ import { m as je } from "./aria-Bv-xVREf.js";
5
+ import { u as He, a as Ke } from "./effects-DGbA6Q2O.js";
6
+ import { g as Ve, a as se } from "./reference-CXMr27nM.js";
7
+ import { u as Ue, r as Ge } from "./useFloatingPosition-MGoyautY.js";
8
+ import { F as oe, b as Je, c as Qe, d as We, P as Xe } from "./usePresence-BTRY1_l-.js";
9
+ import { u as Ye } from "./useFocusTrap-BxPazAL6.js";
10
+ import { S as Ze } from "./Surface-vEFsZC12.js";
11
+ function er(t) {
12
+ const { inert: a, panelElement: i } = t;
13
+ return Ke(() => {
14
14
  i && (i.inert = a);
15
15
  }, [a, i]), null;
16
16
  }
17
- function Ze(o, a, i) {
18
- a.current = o, se(i, o);
17
+ function rr(t, a, i) {
18
+ a.current = t, se(i, t);
19
19
  }
20
- function er(o, a, i) {
21
- a.current = o, se(i, o);
20
+ function tr(t, a, i) {
21
+ a.current = t, se(i, t);
22
22
  }
23
- function rr(o) {
24
- const a = o.tagName.toLowerCase();
25
- return o.getAttribute("role") === "button" && a !== "button" ? !1 : ["button", "input", "select", "summary", "textarea"].includes(a) ? !0 : a === "a" && o.hasAttribute("href");
23
+ function nr(t) {
24
+ const a = t.tagName.toLowerCase();
25
+ return t.getAttribute("role") === "button" && a !== "button" ? !1 : ["button", "input", "select", "summary", "textarea"].includes(a) ? !0 : a === "a" && t.hasAttribute("href");
26
26
  }
27
- function tr(o) {
28
- return o === "grid" || o === "listbox" || o === "menu" || o === "tree" ? o : "dialog";
27
+ function or(t) {
28
+ return t === "grid" || t === "listbox" || t === "menu" || t === "tree" ? t : "dialog";
29
29
  }
30
- const pr = Ne(function(a, i) {
30
+ const mr = _e(function(a, i) {
31
31
  const {
32
- "aria-label": A,
32
+ "aria-label": $,
33
33
  "aria-labelledby": ae,
34
- autoFocus: F = !0,
34
+ autoFocus: D = !0,
35
35
  children: ie,
36
36
  className: ce,
37
37
  closeOnEscape: le = !0,
38
38
  closeOnOutsideInteraction: ue = !0,
39
39
  defaultOpen: de = !1,
40
40
  disabled: R = !1,
41
- initialFocusReference: h,
41
+ initialFocusReference: P,
42
42
  onEscapeKeyDown: fe,
43
43
  onOpenChange: x,
44
- onPointerDownOutside: k,
45
- open: M,
46
- placement: $ = "bottom",
44
+ onPointerDownOutside: O,
45
+ open: j,
46
+ placement: H = "bottom",
47
47
  restoreFocus: L = !0,
48
- role: H = "dialog",
48
+ role: K = "dialog",
49
49
  style: V,
50
50
  tabIndex: pe,
51
- trapFocus: m = !1,
51
+ trapFocus: g = !1,
52
52
  trigger: l,
53
- ...me
53
+ ...ge
54
54
  } = a;
55
55
  if (l.type === Be)
56
56
  throw new Error("Popover requires a single non-Fragment trigger");
57
- const U = _e(), ge = Ke(oe), G = `${U}-popover`, n = l.props, J = $e(l), Q = n.id ?? `${U}-trigger`, P = R || n.disabled === !0 || n["aria-disabled"] === !0 || n["aria-disabled"] === "true", E = M !== void 0, [be, ve] = q(de), r = E ? M : be, O = He(r), W = v(null), X = v(null), N = v("programmatic"), B = v(null), Y = v(r), T = v(null), [ye, he] = je(
57
+ const U = qe(), me = ze(oe), G = `${U}-popover`, o = l.props, J = Ve(l), Q = o.id ?? `${U}-trigger`, m = R || o.disabled === !0 || o["aria-disabled"] === !0 || o["aria-disabled"] === "true", T = j !== void 0, [be, ve] = A(de), r = T ? j : be, k = Je(r), W = y(null), X = y(null), N = y("programmatic"), _ = y(null), Y = y(r), E = y(null), [ye, he] = Ae(
58
58
  (e) => e + 1,
59
59
  0
60
- ), [c, Pe] = q(null), [u, Ee] = q(null), s = (c == null ? void 0 : c.ownerDocument) ?? (typeof document > "u" ? null : document), w = Ve("Popover").boundaryElement, C = Ue(O.present, w), Te = qe(
60
+ ), [c, Pe] = A(null), [u, Te] = A(null), s = (c == null ? void 0 : c.ownerDocument) ?? (typeof document > "u" ? null : document), C = He("Popover").boundaryElement, S = Qe(k.present, C), Ee = Me(
61
61
  () => [W, X],
62
62
  []
63
- ), d = Qe(
64
- O.present,
65
- $,
63
+ ), d = Ue(
64
+ k.present,
65
+ H,
66
66
  c,
67
67
  u,
68
- w
69
- ), Ie = y(
68
+ C
69
+ ), Ie = h(
70
70
  (e) => {
71
- er(
71
+ tr(
72
72
  e,
73
73
  W,
74
74
  J
75
75
  ), Pe(e);
76
76
  },
77
77
  [J]
78
- ), Re = y(
78
+ ), Re = h(
79
79
  (e) => {
80
- Ze(
80
+ rr(
81
81
  e,
82
82
  X,
83
83
  i
84
- ), Ee(e);
84
+ ), Te(e);
85
85
  },
86
86
  [i]
87
- ), f = y((e, t) => {
88
- r !== e && (E ? (B.current = {
87
+ ), f = h((e, n) => {
88
+ r !== e && (T ? (_.current = {
89
89
  open: e,
90
- reason: t
91
- }, he()) : (N.current = t, ve(e)), x == null || x(e, t));
92
- }, [E, x, r]), xe = y(() => {
90
+ reason: n
91
+ }, he()) : (N.current = n, ve(e)), x == null || x(e, n));
92
+ }, [T, x, r]), xe = h(() => {
93
93
  f(!1, "escape");
94
- }, [f]), ke = y(() => {
94
+ }, [f]), Oe = h(() => {
95
95
  f(!1, "outside");
96
- }, [f]), Oe = y((e) => {
96
+ }, [f]), ke = h((e) => {
97
97
  var p;
98
- if (k == null || k(e), e.defaultPrevented) return;
99
- const t = (p = s == null ? void 0 : s.defaultView) == null ? void 0 : p.HTMLElement;
100
- t ? T.current = e.composedPath().find(
101
- (b) => b instanceof t && b.tabIndex >= 0
102
- ) ?? e.target : T.current = e.target;
103
- }, [k, s]);
104
- Ge({
105
- boundary: w,
98
+ if (O == null || O(e), e.defaultPrevented) return;
99
+ const n = (p = s == null ? void 0 : s.defaultView) == null ? void 0 : p.HTMLElement;
100
+ n ? E.current = e.composedPath().find(
101
+ (v) => v instanceof n && v.tabIndex >= 0
102
+ ) ?? e.target : E.current = e.target;
103
+ }, [O, s]);
104
+ We({
105
+ boundary: C,
106
106
  active: r,
107
- boundaries: Te,
107
+ boundaries: Ee,
108
108
  dismissOnEscape: le,
109
109
  dismissOnPointerDownOutside: ue,
110
- layerId: C.id,
110
+ layerId: S.id,
111
111
  onEscapeDismiss: xe,
112
112
  onEscapeKeyDown: fe,
113
- onPointerDownOutside: Oe,
114
- onPointerDownOutsideDismiss: ke,
113
+ onPointerDownOutside: ke,
114
+ onPointerDownOutsideDismiss: Oe,
115
115
  ownerDocument: s
116
116
  });
117
- const we = We({
118
- boundary: w,
119
- active: r && m,
120
- autoFocus: F,
117
+ const Ce = Ye({
118
+ boundary: C,
119
+ active: r && g,
120
+ autoFocus: D,
121
121
  container: u,
122
- initialFocusReference: h,
123
- layerId: C.id,
122
+ initialFocusReference: P,
123
+ layerId: S.id,
124
124
  restoreFocus: L
125
125
  });
126
- z(() => {
127
- if (!r || m || !F || !u) return;
126
+ M(() => {
127
+ if (!r || g || !D || !u) return;
128
128
  let e = !0;
129
129
  return Promise.resolve().then(() => {
130
130
  if (!e) return;
131
- const t = h == null ? void 0 : h.current;
132
- (t && u.contains(t) ? t : u).focus({ preventScroll: !0 });
131
+ const n = P == null ? void 0 : P.current;
132
+ (n && u.contains(n) ? n : u).focus({ preventScroll: !0 });
133
133
  }), () => {
134
134
  e = !1;
135
135
  };
136
- }, [F, h, r, u, m]), z(() => {
136
+ }, [D, P, r, u, g]), M(() => {
137
137
  var te;
138
138
  const e = Y.current;
139
139
  Y.current = r;
140
- const t = B.current;
140
+ const n = _.current;
141
141
  let p = N.current;
142
- if (E && (p = "programmatic", e !== r && (t == null ? void 0 : t.open) === r && (p = t.reason)), B.current = null, r) {
143
- N.current = "programmatic", T.current = null;
142
+ if (T && (p = "programmatic", e !== r && (n == null ? void 0 : n.open) === r && (p = n.reason)), _.current = null, r) {
143
+ N.current = "programmatic", E.current = null;
144
144
  return;
145
145
  }
146
- const b = s == null ? void 0 : s.activeElement, K = T.current, j = (te = s == null ? void 0 : s.defaultView) == null ? void 0 : te.HTMLElement, Fe = p === "outside" && j && K instanceof j && b instanceof j && (K === b || K.contains(b));
147
- e && !m && L && !Fe && (c == null || c.focus({ preventScroll: !0 })), T.current = null;
146
+ const v = s == null ? void 0 : s.activeElement, q = E.current, z = (te = s == null ? void 0 : s.defaultView) == null ? void 0 : te.HTMLElement, Le = p === "outside" && z && q instanceof z && v instanceof z && (q === v || q.contains(v));
147
+ e && !g && L && !Le && (c == null || c.focus({ preventScroll: !0 })), E.current = null;
148
148
  }, [
149
149
  ye,
150
- E,
150
+ T,
151
151
  r,
152
152
  s,
153
153
  L,
154
- m,
154
+ g,
155
155
  c
156
- ]), z(() => {
156
+ ]), M(() => {
157
157
  R && r && f(!1, "programmatic");
158
158
  }, [R, r, f]);
159
- function Ce(e) {
160
- var t;
161
- if (P) {
159
+ function Se(e) {
160
+ if (m) {
162
161
  e.preventDefault(), e.stopPropagation();
163
162
  return;
164
163
  }
165
- (t = n.onClick) == null || t.call(n, e), !e.defaultPrevented && f(!r, "trigger");
164
+ e.defaultPrevented || f(!r, "trigger");
166
165
  }
167
- function De(e) {
168
- var t;
169
- (t = n.onKeyDown) == null || t.call(n, e), !(e.defaultPrevented || P || rr(e.currentTarget) || e.key !== "Enter" && e.key !== " ") && (e.preventDefault(), e.currentTarget.click());
166
+ function we(e) {
167
+ e.defaultPrevented || m || nr(e.currentTarget) || e.key !== "Enter" && e.key !== " " || (e.preventDefault(), e.currentTarget.click());
170
168
  }
171
169
  if (R) return l;
172
- const _ = typeof l.type == "string", g = _ ? l.type : null, Z = g === "a" && typeof n.href == "string", ee = _ && !(g === "button" || g === "input" || g === "select" || g === "summary" || g === "textarea" || Z), re = Z && P;
173
- let D = n.role;
174
- D === void 0 && (re ? D = "link" : ee && (D = "button"));
175
- let S = n.tabIndex;
176
- S === void 0 && ee && (S = 0), P && (S = -1);
177
- const Se = ze(
170
+ const B = typeof l.type == "string", b = B ? l.type : null, Z = b === "a" && typeof o.href == "string", ee = B && !(b === "button" || b === "input" || b === "select" || b === "summary" || b === "textarea" || Z), re = Z && m;
171
+ let w = o.role;
172
+ w === void 0 && (re ? w = "link" : ee && (w = "button"));
173
+ let F = o.tabIndex;
174
+ F === void 0 && ee && (F = 0), m && (F = -1);
175
+ const Fe = m ? { ...o, onClick: void 0 } : o, De = $e(
178
176
  l,
179
- {
180
- "aria-controls": r ? Ae(n["aria-controls"], G) : n["aria-controls"],
177
+ Ge(Fe, {
178
+ "aria-controls": r ? je(o["aria-controls"], G) : o["aria-controls"],
181
179
  "aria-expanded": r,
182
- "aria-haspopup": n["aria-haspopup"] ?? tr(H),
183
- "aria-disabled": P ? !0 : n["aria-disabled"],
184
- className: [n.className, "nk-popover__trigger"].filter(Boolean).join(" "),
185
- href: re ? void 0 : n.href,
180
+ "aria-haspopup": o["aria-haspopup"] ?? or(K),
181
+ "aria-disabled": m ? !0 : o["aria-disabled"],
182
+ className: "nk-popover__trigger",
183
+ href: re ? void 0 : o.href,
186
184
  id: Q,
187
- onClick: Ce,
188
- onKeyDown: _ ? De : n.onKeyDown,
185
+ onClick: Se,
186
+ onKeyDown: B ? we : void 0,
189
187
  ref: Ie,
190
- role: D,
191
- tabIndex: S
192
- }
188
+ role: w,
189
+ tabIndex: F
190
+ })
193
191
  );
194
- return /* @__PURE__ */ ne(Le, { children: [
195
- Se,
192
+ return /* @__PURE__ */ ne(Ne, { children: [
193
+ De,
196
194
  /* @__PURE__ */ I(
197
195
  oe.Provider,
198
196
  {
199
- value: r && m ? we : ge,
200
- children: O.present && s ? /* @__PURE__ */ I(Je, { children: /* @__PURE__ */ ne(
201
- Xe,
197
+ value: r && g ? Ce : me,
198
+ children: k.present && s ? /* @__PURE__ */ I(Xe, { children: /* @__PURE__ */ ne(
199
+ Ze,
202
200
  {
203
- ...me,
201
+ ...ge,
204
202
  ref: Re,
205
203
  "aria-hidden": r ? void 0 : !0,
206
- "aria-label": r ? A : void 0,
207
- "aria-labelledby": r ? ae ?? (A === void 0 ? Q : void 0) : void 0,
204
+ "aria-label": r ? $ : void 0,
205
+ "aria-labelledby": r ? ae ?? ($ === void 0 ? Q : void 0) : void 0,
208
206
  className: ["nk-popover", ce].filter(Boolean).join(" "),
209
- "data-placement": (d == null ? void 0 : d.placement) ?? $,
210
- "data-state": O.state === "closing" ? "closing" : "open",
207
+ "data-placement": (d == null ? void 0 : d.placement) ?? H,
208
+ "data-state": k.state === "closing" ? "closing" : "open",
211
209
  id: G,
212
- role: r ? H : void 0,
210
+ role: r ? K : void 0,
213
211
  style: d ? {
214
212
  ...V,
215
213
  "--nk-popover-arrow-offset": `${d.arrowOffset}px`,
216
214
  left: d.left,
217
215
  top: d.top,
218
- zIndex: C.zIndex
216
+ zIndex: S.zIndex
219
217
  } : {
220
218
  ...V,
221
219
  visibility: "hidden",
222
- zIndex: C.zIndex
220
+ zIndex: S.zIndex
223
221
  },
224
222
  tabIndex: pe ?? -1,
225
223
  children: [
226
224
  /* @__PURE__ */ I(
227
- Ye,
225
+ er,
228
226
  {
229
227
  inert: !r,
230
228
  panelElement: u
@@ -240,5 +238,5 @@ const pr = Ne(function(a, i) {
240
238
  ] });
241
239
  });
242
240
  export {
243
- pr as default
241
+ mr as default
244
242
  };
@@ -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-DM-xYEHQ.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-Bv-xVREf.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
  };