neatkit 0.5.0 → 0.7.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 (140) hide show
  1. package/dist/Alert-DQ5CCE0N.js +29 -0
  2. package/dist/Alert-LJDkNUqH.cjs +1 -0
  3. package/dist/Alert.cjs +1 -0
  4. package/dist/Alert.js +4 -0
  5. package/dist/Avatar.cjs +1 -0
  6. package/dist/Avatar.js +55 -0
  7. package/dist/Badge.cjs +1 -0
  8. package/dist/Badge.js +25 -0
  9. package/dist/Button-BAsLfA0D.js +99 -0
  10. package/dist/Button-D7JUO6Fs.cjs +1 -0
  11. package/dist/Button.cjs +1 -0
  12. package/dist/Button.js +5 -0
  13. package/dist/Card-CPq6dsut.js +34 -0
  14. package/dist/Card-CQ-8_1tO.cjs +1 -0
  15. package/dist/Card.cjs +1 -0
  16. package/dist/Card.js +4 -0
  17. package/dist/Checkbox-BvXM9VyY.js +68 -0
  18. package/dist/Checkbox-VQifZrZZ.cjs +1 -0
  19. package/dist/Checkbox.cjs +1 -0
  20. package/dist/Checkbox.js +5 -0
  21. package/dist/CheckboxGroup.cjs +1 -0
  22. package/dist/CheckboxGroup.js +144 -0
  23. package/dist/{Code-D4qqPnTN.js → Code-BP2ZCmUf.js} +4 -3
  24. package/dist/Code-eispVOW3.cjs +6 -0
  25. package/dist/Code.cjs +1 -0
  26. package/dist/Code.js +5 -0
  27. package/dist/Content.cjs +1 -0
  28. package/dist/Content.js +144 -0
  29. package/dist/Divider-BE15WVDI.js +42 -0
  30. package/dist/Divider-CJYbFcSX.cjs +1 -0
  31. package/dist/Divider.cjs +1 -0
  32. package/dist/Divider.js +4 -0
  33. package/dist/Field.cjs +1 -0
  34. package/dist/Field.js +115 -0
  35. package/dist/Icon-D8IZceys.cjs +1 -0
  36. package/dist/Icon-uQmpr5P2.js +1139 -0
  37. package/dist/Icon.cjs +1 -0
  38. package/dist/Icon.js +37 -0
  39. package/dist/Input.cjs +1 -0
  40. package/dist/Input.js +146 -0
  41. package/dist/{markdown.cjs → Markdown.cjs} +19 -19
  42. package/dist/{markdown.js → Markdown.js} +10 -8
  43. package/dist/Modal.cjs +1 -0
  44. package/dist/Modal.js +171 -0
  45. package/dist/PinInput.cjs +1 -0
  46. package/dist/PinInput.js +248 -0
  47. package/dist/Popover.cjs +1 -0
  48. package/dist/Popover.js +238 -0
  49. package/dist/Radio.cjs +1 -0
  50. package/dist/Radio.js +65 -0
  51. package/dist/RadioGroup.cjs +1 -0
  52. package/dist/RadioGroup.js +51 -0
  53. package/dist/RadioGroupContext-BX9KnDek.cjs +1 -0
  54. package/dist/RadioGroupContext-DbKM4zPZ.js +5 -0
  55. package/dist/Select.cjs +1 -0
  56. package/dist/Select.js +473 -0
  57. package/dist/Skeleton.cjs +1 -0
  58. package/dist/Skeleton.js +27 -0
  59. package/dist/Spinner-BXgw60UC.cjs +1 -0
  60. package/dist/Spinner-CVYvk6YK.js +25 -0
  61. package/dist/Spinner.cjs +1 -0
  62. package/dist/Spinner.js +4 -0
  63. package/dist/Surface-BttJYSDt.cjs +1 -0
  64. package/dist/Surface-vEFsZC12.js +17 -0
  65. package/dist/Switch.cjs +1 -0
  66. package/dist/Switch.js +39 -0
  67. package/dist/Table-83unQQOi.cjs +1 -0
  68. package/dist/Table-Cw8u-pEW.js +403 -0
  69. package/dist/Table.cjs +1 -0
  70. package/dist/Table.js +5 -0
  71. package/dist/Text-DWYlIcPj.cjs +1 -0
  72. package/dist/Text-rN6iDo0V.js +24 -0
  73. package/dist/Text.cjs +1 -0
  74. package/dist/Text.js +4 -0
  75. package/dist/TextArea.cjs +1 -0
  76. package/dist/TextArea.js +43 -0
  77. package/dist/Tooltip-BB82wNOE.cjs +1 -0
  78. package/dist/Tooltip-CqWK_GRD.js +236 -0
  79. package/dist/Tooltip.cjs +1 -0
  80. package/dist/Tooltip.js +6 -0
  81. package/dist/aria-DHnOMyYp.js +10 -0
  82. package/dist/aria-DKxpE8cA.cjs +1 -0
  83. package/dist/components/Alert/index.d.ts +1 -1
  84. package/dist/components/Avatar/index.d.ts +1 -1
  85. package/dist/components/Badge/index.d.ts +1 -1
  86. package/dist/components/Button/index.d.ts +1 -1
  87. package/dist/components/Card/index.d.ts +1 -1
  88. package/dist/components/Checkbox/index.d.ts +1 -1
  89. package/dist/components/CheckboxGroup/index.d.ts +1 -1
  90. package/dist/components/Code/index.d.ts +1 -1
  91. package/dist/components/Content/Content.d.ts +8 -6
  92. package/dist/components/Content/hooks/useContentLayout.d.ts +2 -2
  93. package/dist/components/Content/index.d.ts +2 -2
  94. package/dist/components/Divider/index.d.ts +1 -1
  95. package/dist/components/Field/index.d.ts +1 -1
  96. package/dist/components/Icon/index.d.ts +1 -1
  97. package/dist/components/Input/index.d.ts +1 -1
  98. package/dist/components/Markdown/index.d.ts +1 -1
  99. package/dist/components/Modal/index.d.ts +1 -1
  100. package/dist/components/PinInput/index.d.ts +1 -1
  101. package/dist/components/Popover/index.d.ts +1 -1
  102. package/dist/components/Radio/index.d.ts +1 -1
  103. package/dist/components/RadioGroup/index.d.ts +1 -1
  104. package/dist/components/Select/index.d.ts +1 -1
  105. package/dist/components/Skeleton/index.d.ts +1 -1
  106. package/dist/components/Spinner/index.d.ts +1 -1
  107. package/dist/components/Switch/index.d.ts +1 -1
  108. package/dist/components/Table/index.d.ts +1 -1
  109. package/dist/components/Text/index.d.ts +1 -1
  110. package/dist/components/TextArea/index.d.ts +1 -1
  111. package/dist/components/Tooltip/index.d.ts +1 -1
  112. package/dist/field-control-NfLwcPj6.cjs +1 -0
  113. package/dist/field-control-XAn_FKks.js +16 -0
  114. package/dist/focus-restoration-70WcQRr5.cjs +1 -0
  115. package/dist/focus-restoration-BvNZzrQA.js +16 -0
  116. package/dist/index.cjs +1 -1
  117. package/dist/index.d.ts +4 -0
  118. package/dist/index.js +6 -2187
  119. package/dist/reference-C2guRuR0.cjs +1 -0
  120. package/dist/reference-CXMr27nM.js +12 -0
  121. package/dist/style.css +1 -1
  122. package/dist/units-BmjPCccF.js +90 -0
  123. package/dist/units-PzuiQNnw.cjs +1 -0
  124. package/dist/useFloatingPosition-CxzhAvy8.js +73 -0
  125. package/dist/useFloatingPosition-D1FqYy0l.cjs +1 -0
  126. package/dist/useFocusTrap--cgjy78G.cjs +1 -0
  127. package/dist/useFocusTrap-Da4nEash.js +134 -0
  128. package/dist/usePresence-DSPt6aKi.js +210 -0
  129. package/dist/usePresence-qe92UTvK.cjs +1 -0
  130. package/package.json +136 -11
  131. package/dist/Card-Ba5AcR4o.cjs +0 -1
  132. package/dist/Card-Cumb1Hon.js +0 -74
  133. package/dist/Code-CDHkXHVo.cjs +0 -6
  134. package/dist/Table-B5izJmMG.cjs +0 -1
  135. package/dist/Table-Gs5LkYRc.js +0 -2187
  136. package/dist/code.cjs +0 -1
  137. package/dist/code.js +0 -5
  138. package/dist/entries/code.d.ts +0 -1
  139. package/dist/entries/index.d.ts +0 -29
  140. package/dist/entries/markdown.d.ts +0 -1
@@ -0,0 +1,238 @@
1
+ "use client";
2
+ import { jsxs as te, Fragment as Se, jsx as T } from "react/jsx-runtime";
3
+ import { forwardRef as Ce, Fragment as Le, useId as Ne, useContext as Be, useState as j, useRef as b, useReducer as _e, useMemo as je, useCallback as v, useEffect as K, cloneElement as Ke, useLayoutEffect as qe } from "react";
4
+ import { g as ze, a as ne } from "./reference-CXMr27nM.js";
5
+ import { F as re, a as Ae, b as Me, c as $e, P as He } from "./usePresence-DSPt6aKi.js";
6
+ import { u as Ve } from "./useFloatingPosition-CxzhAvy8.js";
7
+ import { u as Ue } from "./useFocusTrap-Da4nEash.js";
8
+ import { S as Ge } from "./Surface-vEFsZC12.js";
9
+ function Je(r) {
10
+ const { inert: s, panelElement: a } = r;
11
+ return qe(() => {
12
+ a && (a.inert = s);
13
+ }, [s, a]), null;
14
+ }
15
+ function Qe(r, s, a) {
16
+ s.current = r, ne(a, r);
17
+ }
18
+ function We(r, s, a) {
19
+ s.current = r, ne(a, r);
20
+ }
21
+ function Xe(r, s) {
22
+ const a = (r == null ? void 0 : r.split(/\s+/).filter(Boolean)) ?? [];
23
+ return a.includes(s) || a.push(s), a.join(" ");
24
+ }
25
+ function Ye(r) {
26
+ const s = r.tagName.toLowerCase();
27
+ return r.getAttribute("role") === "button" && s !== "button" ? !1 : ["button", "input", "select", "summary", "textarea"].includes(s) ? !0 : s === "a" && r.hasAttribute("href");
28
+ }
29
+ function Ze(r) {
30
+ return r === "grid" || r === "listbox" || r === "menu" || r === "tree" ? r : "dialog";
31
+ }
32
+ const ct = Ce(function(s, a) {
33
+ const {
34
+ "aria-label": q,
35
+ "aria-labelledby": oe,
36
+ autoFocus: F = !0,
37
+ children: se,
38
+ className: ae,
39
+ closeOnEscape: ie = !0,
40
+ closeOnOutsideInteraction: ce = !0,
41
+ defaultOpen: le = !1,
42
+ disabled: I = !1,
43
+ initialFocusReference: h,
44
+ onEscapeKeyDown: ue,
45
+ onOpenChange: R,
46
+ onPointerDownOutside: x,
47
+ open: z,
48
+ placement: A = "bottom",
49
+ portalContainer: k,
50
+ restoreFocus: S = !0,
51
+ role: M = "dialog",
52
+ style: $,
53
+ tabIndex: de,
54
+ trapFocus: p = !1,
55
+ trigger: l,
56
+ ...fe
57
+ } = s;
58
+ if (l.type === Le)
59
+ throw new Error("Popover requires a single non-Fragment trigger");
60
+ const H = Ne(), pe = Be(re), V = `${H}-popover`, o = l.props, U = ze(l), G = o.id ?? `${H}-trigger`, y = I || o.disabled === !0 || o["aria-disabled"] === !0 || o["aria-disabled"] === "true", P = z !== void 0, [ge, me] = j(le), t = P ? z : ge, O = Ae(t), J = b(null), Q = b(null), C = b("programmatic"), L = b(null), W = b(t), w = b(null), [be, ve] = _e(
61
+ (e) => e + 1,
62
+ 0
63
+ ), [c, he] = j(null), [u, ye] = j(null), i = (k == null ? void 0 : k.ownerDocument) ?? (c == null ? void 0 : c.ownerDocument) ?? (typeof document > "u" ? null : document), D = Me(O.present, i), Pe = je(
64
+ () => [J, Q],
65
+ []
66
+ ), d = Ve(
67
+ O.present,
68
+ A,
69
+ c,
70
+ u
71
+ ), Ee = v(
72
+ (e) => {
73
+ We(
74
+ e,
75
+ J,
76
+ U
77
+ ), he(e);
78
+ },
79
+ [U]
80
+ ), Te = v(
81
+ (e) => {
82
+ Qe(
83
+ e,
84
+ Q,
85
+ a
86
+ ), ye(e);
87
+ },
88
+ [a]
89
+ ), f = v((e, n) => {
90
+ t !== e && (P ? (L.current = {
91
+ open: e,
92
+ reason: n
93
+ }, ve()) : (C.current = n, me(e)), R == null || R(e, n));
94
+ }, [P, R, t]), Ie = v(() => {
95
+ f(!1, "escape");
96
+ }, [f]), Re = v(() => {
97
+ f(!1, "outside");
98
+ }, [f]), xe = v((e) => {
99
+ var E;
100
+ if (x == null || x(e), e.defaultPrevented) return;
101
+ const n = (E = i == null ? void 0 : i.defaultView) == null ? void 0 : E.HTMLElement;
102
+ w.current = n ? e.composedPath().find(
103
+ (m) => m instanceof n && m.tabIndex >= 0
104
+ ) ?? e.target : e.target;
105
+ }, [x, i]);
106
+ $e({
107
+ active: t,
108
+ boundaries: Pe,
109
+ dismissOnEscape: ie,
110
+ dismissOnPointerDownOutside: ce,
111
+ layerId: D.id,
112
+ onEscapeDismiss: Ie,
113
+ onEscapeKeyDown: ue,
114
+ onPointerDownOutside: xe,
115
+ onPointerDownOutsideDismiss: Re,
116
+ ownerDocument: i
117
+ });
118
+ const ke = Ue({
119
+ active: t && p,
120
+ autoFocus: F,
121
+ container: u,
122
+ initialFocusReference: h,
123
+ layerId: D.id,
124
+ restoreFocus: S
125
+ });
126
+ K(() => {
127
+ if (!t || p || !F || !u) return;
128
+ let e = !0;
129
+ return Promise.resolve().then(() => {
130
+ if (!e) return;
131
+ const n = h == null ? void 0 : h.current;
132
+ (n && u.contains(n) ? n : u).focus({ preventScroll: !0 });
133
+ }), () => {
134
+ e = !1;
135
+ };
136
+ }, [F, h, t, u, p]), K(() => {
137
+ var ee;
138
+ const e = W.current;
139
+ W.current = t;
140
+ const n = L.current, E = P ? e !== t && (n == null ? void 0 : n.open) === t ? n.reason : "programmatic" : C.current;
141
+ if (L.current = null, t) {
142
+ C.current = "programmatic", w.current = null;
143
+ return;
144
+ }
145
+ const m = i == null ? void 0 : i.activeElement, B = w.current, _ = (ee = i == null ? void 0 : i.defaultView) == null ? void 0 : ee.HTMLElement, Fe = E === "outside" && _ && B instanceof _ && m instanceof _ && (B === m || B.contains(m));
146
+ e && !p && S && !Fe && (c == null || c.focus({ preventScroll: !0 })), w.current = null;
147
+ }, [
148
+ be,
149
+ P,
150
+ t,
151
+ i,
152
+ S,
153
+ p,
154
+ c
155
+ ]), K(() => {
156
+ I && t && f(!1, "programmatic");
157
+ }, [I, t, f]);
158
+ function Oe(e) {
159
+ var n;
160
+ if (y) {
161
+ e.preventDefault(), e.stopPropagation();
162
+ return;
163
+ }
164
+ (n = o.onClick) == null || n.call(o, e), !e.defaultPrevented && f(!t, "trigger");
165
+ }
166
+ function we(e) {
167
+ var n;
168
+ (n = o.onKeyDown) == null || n.call(o, e), !(e.defaultPrevented || y || Ye(e.currentTarget) || e.key !== "Enter" && e.key !== " ") && (e.preventDefault(), e.currentTarget.click());
169
+ }
170
+ if (I) return l;
171
+ const N = typeof l.type == "string", g = N ? l.type : null, X = g === "a" && typeof o.href == "string", Y = N && !(g === "button" || g === "input" || g === "select" || g === "summary" || g === "textarea" || X), Z = X && y, De = Ke(
172
+ l,
173
+ {
174
+ "aria-controls": t ? Xe(o["aria-controls"], V) : o["aria-controls"],
175
+ "aria-expanded": t,
176
+ "aria-haspopup": o["aria-haspopup"] ?? Ze(M),
177
+ "aria-disabled": y ? !0 : o["aria-disabled"],
178
+ className: [o.className, "nk-popover__trigger"].filter(Boolean).join(" "),
179
+ href: Z ? void 0 : o.href,
180
+ id: G,
181
+ onClick: Oe,
182
+ onKeyDown: N ? we : o.onKeyDown,
183
+ ref: Ee,
184
+ role: o.role ?? (Z ? "link" : Y ? "button" : void 0),
185
+ tabIndex: y ? -1 : o.tabIndex ?? (Y ? 0 : void 0)
186
+ }
187
+ );
188
+ return /* @__PURE__ */ te(Se, { children: [
189
+ De,
190
+ /* @__PURE__ */ T(
191
+ re.Provider,
192
+ {
193
+ value: t && p ? ke : pe,
194
+ children: O.present && i ? /* @__PURE__ */ T(He, { container: k, inheritFrom: c, children: /* @__PURE__ */ te(
195
+ Ge,
196
+ {
197
+ ...fe,
198
+ ref: Te,
199
+ "aria-hidden": t ? void 0 : !0,
200
+ "aria-label": t ? q : void 0,
201
+ "aria-labelledby": t ? oe ?? (q === void 0 ? G : void 0) : void 0,
202
+ className: ["nk-popover", ae].filter(Boolean).join(" "),
203
+ "data-placement": (d == null ? void 0 : d.placement) ?? A,
204
+ "data-state": O.state === "closing" ? "closing" : "open",
205
+ id: V,
206
+ role: t ? M : void 0,
207
+ style: d ? {
208
+ ...$,
209
+ "--nk-popover-arrow-offset": `${d.arrowOffset}px`,
210
+ left: d.left,
211
+ top: d.top,
212
+ zIndex: D.zIndex
213
+ } : {
214
+ ...$,
215
+ visibility: "hidden",
216
+ zIndex: D.zIndex
217
+ },
218
+ tabIndex: de ?? -1,
219
+ children: [
220
+ /* @__PURE__ */ T(
221
+ Je,
222
+ {
223
+ inert: !t,
224
+ panelElement: u
225
+ }
226
+ ),
227
+ /* @__PURE__ */ T("span", { "aria-hidden": "true", className: "nk-popover__arrow" }),
228
+ /* @__PURE__ */ T("div", { className: "nk-popover__content", children: se })
229
+ ]
230
+ }
231
+ ) }) : null
232
+ }
233
+ )
234
+ ] });
235
+ });
236
+ export {
237
+ ct as default
238
+ };
package/dist/Radio.cjs ADDED
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),i=require("react"),v=require("./RadioGroupContext-BX9KnDek.cjs"),R=require("./Text-DWYlIcPj.cjs");function C(){const e=i.useContext(v.RadioGroupContext);if(!e)throw new Error("Radio must be rendered within RadioGroup");return e}function m(e,r,t){r.current=e,typeof t=="function"?t(e):t&&(t.current=e)}const _=i.forwardRef(function(r,t){const{children:d,className:f,disabled:p=!1,style:b,value:l,...h}=r,n=C(),c=i.useRef(null),a=n.disabled||p,s=n.value!==void 0,x=n.value===l,k=i.useCallback(o=>m(o,c,t),[t]);return i.useEffect(()=>{var o;!s&&a&&((o=c.current)!=null&&o.checked)&&(c.current.checked=!1)},[s,a]),u.jsxs("label",{className:["nk-radio",f].filter(Boolean).join(" "),"data-disabled":a||void 0,style:b,children:[u.jsx("input",{...h,ref:k,checked:s?!a&&x:void 0,className:"nk-radio__control",defaultChecked:s?void 0:!a&&n.defaultValue===l,disabled:a,name:n.name,onChange:n.onChange,required:n.required,type:"radio",value:l}),u.jsx("span",{"aria-hidden":"true",className:"nk-radio__visual"}),u.jsx(R.Text,{as:"span",className:"nk-radio__label",children:d})]})});exports.default=_;
package/dist/Radio.js ADDED
@@ -0,0 +1,65 @@
1
+ "use client";
2
+ import { jsxs as k, jsx as u } from "react/jsx-runtime";
3
+ import { useContext as R, forwardRef as v, useRef as C, useCallback as x, useEffect as _ } from "react";
4
+ import { R as N } from "./RadioGroupContext-DbKM4zPZ.js";
5
+ import { T as g } from "./Text-rN6iDo0V.js";
6
+ function j() {
7
+ const e = R(N);
8
+ if (!e)
9
+ throw new Error("Radio must be rendered within RadioGroup");
10
+ return e;
11
+ }
12
+ function y(e, t, a) {
13
+ t.current = e, typeof a == "function" ? a(e) : a && (a.current = e);
14
+ }
15
+ const V = v(function(t, a) {
16
+ const {
17
+ children: c,
18
+ className: d,
19
+ disabled: f = !1,
20
+ style: p,
21
+ value: r,
22
+ ...m
23
+ } = t, o = j(), l = C(null), i = o.disabled || f, n = o.value !== void 0, h = o.value === r, b = x(
24
+ (s) => y(
25
+ s,
26
+ l,
27
+ a
28
+ ),
29
+ [a]
30
+ );
31
+ return _(() => {
32
+ var s;
33
+ !n && i && ((s = l.current) != null && s.checked) && (l.current.checked = !1);
34
+ }, [n, i]), /* @__PURE__ */ k(
35
+ "label",
36
+ {
37
+ className: ["nk-radio", d].filter(Boolean).join(" "),
38
+ "data-disabled": i || void 0,
39
+ style: p,
40
+ children: [
41
+ /* @__PURE__ */ u(
42
+ "input",
43
+ {
44
+ ...m,
45
+ ref: b,
46
+ checked: n ? !i && h : void 0,
47
+ className: "nk-radio__control",
48
+ defaultChecked: n ? void 0 : !i && o.defaultValue === r,
49
+ disabled: i,
50
+ name: o.name,
51
+ onChange: o.onChange,
52
+ required: o.required,
53
+ type: "radio",
54
+ value: r
55
+ }
56
+ ),
57
+ /* @__PURE__ */ u("span", { "aria-hidden": "true", className: "nk-radio__visual" }),
58
+ /* @__PURE__ */ u(g, { as: "span", className: "nk-radio__label", children: c })
59
+ ]
60
+ }
61
+ );
62
+ });
63
+ export {
64
+ V as default
65
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),R=require("react"),t=require("./aria-DKxpE8cA.cjs"),b=require("./field-control-NfLwcPj6.cjs"),j=require("./RadioGroupContext-BX9KnDek.cjs"),n=R.forwardRef(function(d,l){const{"aria-invalid":a,children:s,className:u,defaultValue:c,disabled:e=!1,invalid:i=!1,name:v,onChange:f,orientation:p="vertical",required:r=!1,value:m,...q}=d,g=i||t.hasInvalidState(a),x={defaultValue:c,disabled:e,name:v,onChange:f,required:r,value:m};return o.jsx(j.RadioGroupContext.Provider,{value:x,children:o.jsx("div",{...q,ref:l,"aria-disabled":e||void 0,"aria-invalid":t.resolveAriaInvalid(i,a),"aria-required":r||void 0,className:["nk-radio-group",u].filter(Boolean).join(" "),"data-disabled":e||void 0,"data-invalid":g||void 0,"data-orientation":p,role:"radiogroup",children:s})})});b.markFieldGroupControl(n,"group");exports.default=n;
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ import { jsx as e } from "react/jsx-runtime";
3
+ import { forwardRef as R } from "react";
4
+ import { r as g, h as x } from "./aria-DHnOMyYp.js";
5
+ import { m as G } from "./field-control-XAn_FKks.js";
6
+ import { R as I } from "./RadioGroupContext-DbKM4zPZ.js";
7
+ const b = R(
8
+ function(d, l) {
9
+ const {
10
+ "aria-invalid": i,
11
+ children: n,
12
+ className: t,
13
+ defaultValue: s,
14
+ disabled: a = !1,
15
+ invalid: o = !1,
16
+ name: u,
17
+ onChange: v,
18
+ orientation: m = "vertical",
19
+ required: r = !1,
20
+ value: f,
21
+ ...p
22
+ } = d, c = o || x(i), h = {
23
+ defaultValue: s,
24
+ disabled: a,
25
+ name: u,
26
+ onChange: v,
27
+ required: r,
28
+ value: f
29
+ };
30
+ return /* @__PURE__ */ e(I.Provider, { value: h, children: /* @__PURE__ */ e(
31
+ "div",
32
+ {
33
+ ...p,
34
+ ref: l,
35
+ "aria-disabled": a || void 0,
36
+ "aria-invalid": g(o, i),
37
+ "aria-required": r || void 0,
38
+ className: ["nk-radio-group", t].filter(Boolean).join(" "),
39
+ "data-disabled": a || void 0,
40
+ "data-invalid": c || void 0,
41
+ "data-orientation": m,
42
+ role: "radiogroup",
43
+ children: n
44
+ }
45
+ ) });
46
+ }
47
+ );
48
+ G(b, "group");
49
+ export {
50
+ b as default
51
+ };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("react"),o=t.createContext(void 0);exports.RadioGroupContext=o;
@@ -0,0 +1,5 @@
1
+ import { createContext as o } from "react";
2
+ const e = o(void 0);
3
+ export {
4
+ e as R
5
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),i=require("react"),G=require("./aria-DKxpE8cA.cjs"),K=require("./Icon-D8IZceys.cjs"),J=require("./usePresence-qe92UTvK.cjs");function ee(a,n,s){if(a.length===0)return-1;for(let c=1;c<=a.length;c+=1){const v=(n+s*c+a.length)%a.length;if(!a[v].disabled)return v}return-1}function xe(a,n,s){for(let c=1;c<=a.length;c+=1){const v=(s+c+a.length)%a.length,d=a[v];if(!d.disabled&&d.label.toLocaleLowerCase().startsWith(n))return v}return-1}function we(a){const n=new Set;a.forEach(s=>{if(n.has(s.value))throw new Error("Select option values must be unique");n.add(s.value)})}function Ie(a,n,s){n.current=a,typeof s=="function"?s(a):s&&(s.current=a)}function ke(a){const{"aria-invalid":n,children:s,className:c,defaultValue:v,disabled:d=!1,forwardedReference:o,invalid:p=!1,placeholder:x,style:f,value:h,...b}=a,k=G.resolveAriaInvalid(p,n),w=p||G.hasInvalidState(n);return l.jsxs("span",{className:["nk-select",c].filter(Boolean).join(" "),"data-disabled":d||void 0,"data-invalid":w||void 0,"data-mode":"native",style:f,children:[l.jsxs("select",{...b,ref:o,"aria-invalid":k,className:"nk-select__control",defaultValue:h===void 0?v??(x!==void 0?"":void 0):void 0,disabled:d,value:h,children:[x!==void 0?l.jsx("option",{disabled:!0,value:"",children:x}):null,s]}),l.jsx(K.Icon,{className:"nk-select__icon",type:"chevron-down"})]})}function De(a,n,s){const[c,v]=i.useState(null);return i.useEffect(()=>{if(!a||!n){v(null);return}const d=n.ownerDocument.defaultView;if(!d)return;const o=d;function p(){const h=n==null?void 0:n.getBoundingClientRect();if(!h)return;const b=8,k=4,w=o.innerHeight-h.bottom-k-b,E=h.top-k-b,j=w<160&&E>w,D=Math.max(72,j?E:w),y=s==null?void 0:s.getBoundingClientRect(),L=Math.max(h.width,(y==null?void 0:y.width)??h.width),r=Math.min(Math.max(b,h.left),Math.max(b,o.innerWidth-b-L)),R=j?Math.max(b,h.top-k-Math.min((y==null?void 0:y.height)??D,D)):h.bottom+k;v({left:r,maxHeight:D,minWidth:h.width,top:R})}p(),o.addEventListener("resize",p),o.addEventListener("scroll",p,!0);const x=o.ResizeObserver,f=x?new x(p):null;return f==null||f.observe(n),s&&(f==null||f.observe(s)),()=>{o.removeEventListener("resize",p),o.removeEventListener("scroll",p,!0),f==null||f.disconnect()}},[a,s,n]),c}function je(a){const{active:n,closeOnEscape:s,closeOnOutsideInteraction:c,highlightedIndex:v,id:d,listboxReference:o,onEscapeDismiss:p,onEscapeKeyDown:x,onHighlight:f,onOutsideDismiss:h,onPointerDownOutside:b,onSelect:k,options:w,ownerDocument:E,position:j,selectedValue:D,state:y,triggerReference:L}=a,r=i.useRef(null),R=J.useOverlayLayer(!0,E),N=i.useMemo(()=>[L,r],[L]),T=i.useCallback(u=>{r.current=u,o(u)},[o]);return J.useDismissableLayer({active:n,boundaries:N,dismissOnEscape:s,dismissOnPointerDownOutside:c,layerId:R.id,onEscapeDismiss:p,onEscapeKeyDown:x,onPointerDownOutside:b,onPointerDownOutsideDismiss:h,ownerDocument:E}),l.jsx("div",{"aria-hidden":n?void 0:!0,"aria-labelledby":d,className:"nk-select__listbox","data-state":y,id:`${d}-listbox`,ref:T,role:"listbox",style:j?{left:j.left,maxHeight:j.maxHeight,minWidth:j.minWidth,top:j.top,zIndex:R.zIndex}:{visibility:"hidden",zIndex:R.zIndex},children:w.map((u,P)=>l.jsxs("div",{"aria-disabled":u.disabled||void 0,"aria-selected":u.value===D,className:"nk-select__option","data-highlighted":P===v||void 0,"data-selected":u.value===D||void 0,id:`${d}-option-${P}`,onPointerDown:B=>{B.preventDefault(),u.disabled||k(u)},onPointerMove:()=>{u.disabled||f(P)},role:"option",children:[u.icon?l.jsx(K.Icon,{type:u.icon}):null,l.jsx("span",{className:"nk-select__option-label",children:u.label}),u.value===D?l.jsx(K.Icon,{className:"nk-select__check",type:"checkmark"}):null]},u.value))})}function _e(a){var ae;const{"aria-invalid":n,className:s,closeOnEscape:c=!0,closeOnOutsideInteraction:v=!0,defaultValue:d="",disabled:o=!1,displayOverride:p,form:x,forwardedReference:f,id:h,invalid:b=!1,name:k,onChange:w,onClick:E,onEscapeKeyDown:j,onKeyDown:D,onOpenChange:y,onPointerDownOutside:L,options:r,placeholder:R,portalContainer:N,required:T=!1,style:u,value:P,width:B,...ie}=a;we(r);const le=i.useId(),M=h??le,_=i.useRef(null),te=i.useRef(null),V=i.useRef(null),z=i.useRef(""),[W,oe]=i.useState(null),[m,re]=i.useState(!1),[O,q]=i.useState(-1),[ce,ne]=i.useState(d),A=P!==void 0,C=A?P:ce,de=r.find(e=>e.value===C),ue=b||G.hasInvalidState(n),fe=G.resolveAriaInvalid(b,n),X=J.usePresence(m),$=(N==null?void 0:N.ownerDocument)??((ae=_.current)==null?void 0:ae.ownerDocument)??(typeof document>"u"?null:document),he=De(X.present,_.current,W),me=B===void 0?u:{...u,width:B},F=p??de,ve=i.useCallback(e=>{Ie(e,_,f)},[f]),g=i.useCallback(e=>{m!==e&&(re(e),y==null||y(e))},[y,m]),Q=i.useCallback((e=1)=>{const t=r.findIndex(S=>S.value===C&&!S.disabled),I=e===1?-1:r.length;q(t>=0?t:ee(r,I,e)),g(!0)},[r,C,g]),se=i.useCallback(e=>{var t;e.disabled||(A||ne(e.value),g(!1),(t=_.current)==null||t.focus(),w==null||w(e.value))},[A,w,g]),pe=i.useCallback(()=>{var e;g(!1),(e=_.current)==null||e.focus()},[g]),be=i.useCallback(()=>{g(!1)},[g]);function ye(e){E==null||E(e),!(e.defaultPrevented||o)&&(m?g(!1):Q())}function ge(e){if(D==null||D(e),!(e.defaultPrevented||o)){if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const t=e.key==="ArrowDown"?1:-1;m?q(I=>ee(r,I,t)):Q(t);return}if(e.key==="Home"||e.key==="End"){if(e.preventDefault(),!m)Q(e.key==="Home"?1:-1);else{const t=e.key==="Home"?1:-1,I=t===1?-1:r.length;q(ee(r,I,t))}return}if(e.key==="Enter"||e.key===" "){e.preventDefault();const t=r[O];m&&t?se(t):m||Q();return}if(e.key==="Tab"){g(!1);return}if(e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey){const t=e.currentTarget.ownerDocument.defaultView;if(!t)return;const I=e.key.toLocaleLowerCase(),S=z.current+I,Y=Array.from(S).every(Z=>Z===I);z.current=Y?I:S,V.current!==null&&t.clearTimeout(V.current),V.current=t.setTimeout(()=>{z.current="",V.current=null},500);const H=xe(r,z.current,O);H>=0&&(e.preventDefault(),m||g(!0),q(H))}}}return i.useEffect(()=>{var e;if(m&&O>=0){const t=$==null?void 0:$.getElementById(`${M}-option-${O}`);t&&(W!=null&&W.contains(t))&&((e=t.scrollIntoView)==null||e.call(t,{block:"nearest"}))}},[O,M,W,m]),i.useEffect(()=>{var I;const e=(I=_.current)==null?void 0:I.form;if(!e)return;function t(){const S=te.current,Y=A?C:d;if(S){const H=Array.from(S.options),Z=H.find(U=>U.value===Y)??H[0];H.forEach(U=>{U.defaultSelected=U===Z})}A||ne(d),g(!1)}return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)},[d,x,A,C,g]),i.useEffect(()=>()=>{var t;const e=(t=_.current)==null?void 0:t.ownerDocument.defaultView;e&&V.current!==null&&e.clearTimeout(V.current)},[]),l.jsxs("span",{className:["nk-select",s].filter(Boolean).join(" "),"data-disabled":o||void 0,"data-invalid":ue||void 0,"data-mode":"custom","data-open":m||void 0,style:me,children:[l.jsxs("button",{...ie,ref:ve,"aria-activedescendant":m&&O>=0?`${M}-option-${O}`:void 0,"aria-controls":`${M}-listbox`,"aria-expanded":m,"aria-haspopup":"listbox","aria-invalid":fe,"aria-required":T||void 0,"aria-autocomplete":"none",className:"nk-select__trigger",disabled:o,form:x,id:M,onClick:ye,onKeyDown:ge,role:"combobox",type:"button",children:[F?l.jsxs("span",{className:"nk-select__value",children:[F.icon?l.jsx(K.Icon,{type:F.icon}):null,l.jsx("span",{className:"nk-select__value-label",children:F.label})]}):l.jsx("span",{className:"nk-select__placeholder",children:R}),l.jsx(K.Icon,{className:"nk-select__icon",type:"chevron-down"})]}),k||T?l.jsxs("select",{ref:te,"aria-hidden":"true",className:"nk-select__form-control",disabled:o,form:x,name:k,onChange:()=>{},onInvalid:e=>{var t;e.preventDefault(),(t=_.current)==null||t.focus()},required:T,tabIndex:-1,value:C,children:[l.jsx("option",{value:""}),r.map(e=>l.jsx("option",{disabled:e.disabled,value:e.value,children:e.label},e.value))]}):null,X.present&&$?l.jsx(J.Portal,{container:N,inheritFrom:_.current,children:l.jsx(je,{active:m,closeOnEscape:c,closeOnOutsideInteraction:v,highlightedIndex:O,id:M,listboxReference:oe,onEscapeDismiss:pe,onEscapeKeyDown:j,onHighlight:q,onOutsideDismiss:be,onPointerDownOutside:L,onSelect:se,options:r,ownerDocument:$,position:he,selectedValue:C,state:X.state==="closing"?"closing":"open",triggerReference:_})}):null]})}const Ee=i.forwardRef(function(n,s){const{options:c}=n;return c!==void 0?l.jsx(_e,{...n,forwardedReference:s}):l.jsx(ke,{...n,forwardedReference:s})});exports.default=Ee;