@nice2dev/ui 1.0.8 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NiceErrorBoundary-B5nF-OVn.cjs +1 -0
- package/dist/NiceErrorBoundary-BZEHCXNM.cjs +1 -0
- package/dist/NiceErrorBoundary-D6jw6wwD.js +762 -0
- package/dist/NiceErrorBoundary-D75yr_WE.js +762 -0
- package/dist/NiceForm-BgR-m8T9.cjs +382 -0
- package/dist/NiceForm-CKoJA6NG.js +5131 -0
- package/dist/NiceForm-D7xnpnRJ.cjs +382 -0
- package/dist/NiceForm-DYKciCeR.js +5131 -0
- package/dist/NiceForm.css +1 -0
- package/dist/NiceModal-1QX7NhyH.js +95 -0
- package/dist/NiceModal-Br3J9jOV.cjs +1 -0
- package/dist/NiceModal-CAwsKVQ2.cjs +1 -0
- package/dist/NiceModal-DVAsBzHP.js +95 -0
- package/dist/NiceModuleLifecyclePanel-C9xMSjOF.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-CMrPbSw9.js +5249 -0
- package/dist/NiceModuleLifecyclePanel-D3azLDdj.js +5249 -0
- package/dist/NiceModuleLifecyclePanel-DEfAIhFf.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -0
- package/dist/NicePagination-CbB5P1N_.js +171 -0
- package/dist/NicePagination-DbE-uOkl.js +171 -0
- package/dist/NicePagination-DlealakT.cjs +1 -0
- package/dist/NicePagination-UGjzvRUS.cjs +1 -0
- package/dist/NicePinCodeInput-B8cI8zu8.js +11830 -0
- package/dist/NicePinCodeInput-BmRO9HSQ.js +11830 -0
- package/dist/NicePinCodeInput-D91uvVsF.cjs +419 -0
- package/dist/NicePinCodeInput-SGQaHvpE.cjs +419 -0
- package/dist/NicePinCodeInput.css +1 -1
- package/dist/NiceSavedQueryPanel-7nZe46t8.cjs +596 -0
- package/dist/NiceSavedQueryPanel-BSGzs7Oc.js +6449 -0
- package/dist/NiceSavedQueryPanel-CZ5bYOe_.js +6449 -0
- package/dist/NiceSavedQueryPanel-Ce2s060j.cjs +596 -0
- package/dist/NiceTabs-BeaxZzAO.js +1636 -0
- package/dist/NiceTabs-DcbYFIWR.cjs +1 -0
- package/dist/NiceTabs-DvOmxKyQ.cjs +1 -0
- package/dist/NiceTabs-DzLHzwuA.js +1636 -0
- package/dist/NiceWindow-Bga9fOkg.js +1409 -0
- package/dist/NiceWindow-CVgkxcCz.cjs +1 -0
- package/dist/NiceWindow-CxWTj5xH.cjs +1 -0
- package/dist/NiceWindow-DeC83yfE.js +1409 -0
- package/dist/charts-BAS21jkC.js +4621 -0
- package/dist/charts-BcvKWYUl.cjs +759 -0
- package/dist/charts-DShUbWrP.cjs +759 -0
- package/dist/charts-DZvmvfhM.js +4621 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.d.ts +42 -45
- package/dist/charts.mjs +1 -1
- package/dist/core-B4b1BmHt.js +22177 -0
- package/dist/core-C2ZmWe_u.cjs +96 -0
- package/dist/core-CjmLbclt.cjs +96 -0
- package/dist/core-Da43q-pO.js +22094 -0
- package/dist/data-branching-CJlrg8qf.cjs +1 -0
- package/dist/data-branching-DCUwI53s.js +6121 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.d.ts +1 -38
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +206 -192
- package/dist/data.mjs +1 -1
- package/dist/devops-CXynFG3X.cjs +17 -0
- package/dist/devops-D0TfzV5B.js +7660 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.d.ts +1 -38
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +311 -393
- package/dist/editors.mjs +61 -64
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.d.ts +3 -44
- package/dist/feedback.mjs +11 -10
- package/dist/index-B8wxZ8Ps.cjs +5192 -0
- package/dist/index-DlHlXz8e.js +57319 -0
- package/dist/index-Dx726U90.cjs +5192 -0
- package/dist/index-pAuGTbuB.js +57319 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2249 -11141
- package/dist/index.mjs +880 -1018
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +7 -39
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +151 -216
- package/dist/navigation.mjs +52 -46
- package/dist/no-code-B5bzduNP.cjs +332 -0
- package/dist/no-code-D8RJ7lx0.js +7064 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.d.ts +1 -38
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +13 -45
- package/dist/overlays.mjs +243 -233
- package/package.json +5 -3
|
@@ -0,0 +1,1636 @@
|
|
|
1
|
+
import { jsxs as v, jsx as e, Fragment as Ee } from "react/jsx-runtime";
|
|
2
|
+
import { N as we, W as Fe, c as Re, U as Ie, G as ye, b as qe, X as Ve, H as Ae, Z as Ke, e as Be, F as Ge, a as Xe } from "./core-B4b1BmHt.js";
|
|
3
|
+
import je, { forwardRef as xe, useCallback as ee, useMemo as oe, useState as de, useRef as Se, useLayoutEffect as Te, useEffect as Ze } from "react";
|
|
4
|
+
import Qe from "react-dom";
|
|
5
|
+
const Ye = xe(
|
|
6
|
+
({
|
|
7
|
+
label: l,
|
|
8
|
+
helperText: h,
|
|
9
|
+
error: t,
|
|
10
|
+
required: d,
|
|
11
|
+
disabled: i,
|
|
12
|
+
readOnly: n,
|
|
13
|
+
size: a = "md",
|
|
14
|
+
name: y,
|
|
15
|
+
id: u,
|
|
16
|
+
className: o,
|
|
17
|
+
style: f,
|
|
18
|
+
accessMode: D,
|
|
19
|
+
displayStyle: Q,
|
|
20
|
+
variant: m,
|
|
21
|
+
value: w,
|
|
22
|
+
defaultValue: F,
|
|
23
|
+
onChange: p,
|
|
24
|
+
onBlur: Y,
|
|
25
|
+
onKeyDown: E,
|
|
26
|
+
placeholder: $,
|
|
27
|
+
type: S = "text",
|
|
28
|
+
maxLength: b,
|
|
29
|
+
prefix: R,
|
|
30
|
+
suffix: U,
|
|
31
|
+
clearable: x,
|
|
32
|
+
autoFocus: M,
|
|
33
|
+
submitOnEnter: T,
|
|
34
|
+
onSubmit: V,
|
|
35
|
+
showKeyboardHints: I,
|
|
36
|
+
labelPlacement: j,
|
|
37
|
+
errorPlacement: ae,
|
|
38
|
+
loading: ue,
|
|
39
|
+
labelWidth: ne,
|
|
40
|
+
controlWidth: X,
|
|
41
|
+
displayMode: P,
|
|
42
|
+
...k
|
|
43
|
+
}, _) => {
|
|
44
|
+
const q = we(D, u);
|
|
45
|
+
if (q === "hidden")
|
|
46
|
+
return null;
|
|
47
|
+
q === "disabled" && (i = !0), q === "readOnly" && (n = !0);
|
|
48
|
+
const { t: L } = Fe(), A = Re(u), G = Ie("input", Q), se = ye("input", Q), ve = m === "filled" ? "filled" : m === "underlined" ? "underlined" : "", O = ee(() => p?.(""), [p]), Z = qe({ enabled: P, readOnly: n, disabled: i }), re = Ve({
|
|
49
|
+
enabled: T,
|
|
50
|
+
onSubmit: V
|
|
51
|
+
}), ie = ee(
|
|
52
|
+
(g) => {
|
|
53
|
+
re(g), E?.(g);
|
|
54
|
+
},
|
|
55
|
+
[re, E]
|
|
56
|
+
), r = oe(() => {
|
|
57
|
+
const g = [];
|
|
58
|
+
return T && g.push({ key: "Enter", description: L("shortcuts.submit", "Submit") }), x && g.push({ key: "Escape", description: L("shortcuts.clear", "Clear") }), g;
|
|
59
|
+
}, [T, x, L]);
|
|
60
|
+
return /* @__PURE__ */ v(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
className: `nice-field nice-field--${a} ${j === "left" ? "nice-field--label-left" : ""} ${j === "inside" ? "nice-field--label-inside" : ""} ${ue ? "nice-field--loading" : ""} ${o || ""}`,
|
|
64
|
+
style: {
|
|
65
|
+
...f,
|
|
66
|
+
...ne != null && {
|
|
67
|
+
"--nice-field-label-width": typeof ne == "number" ? `${ne}px` : ne
|
|
68
|
+
},
|
|
69
|
+
...X != null && {
|
|
70
|
+
"--nice-field-control-width": typeof X == "number" ? `${X}px` : X
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"aria-busy": ue || void 0,
|
|
74
|
+
"data-floating": j === "inside" && w ? "true" : void 0,
|
|
75
|
+
children: [
|
|
76
|
+
l && j !== "inside" && /* @__PURE__ */ v(
|
|
77
|
+
"label",
|
|
78
|
+
{
|
|
79
|
+
htmlFor: A,
|
|
80
|
+
className: `nice-field__label ${d ? "nice-field__label--required" : ""}`,
|
|
81
|
+
children: [
|
|
82
|
+
l,
|
|
83
|
+
I && r.length > 0 && /* @__PURE__ */ e(Ae, { shortcuts: r, size: "sm" })
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ v("div", { className: "nice-field__control", children: [
|
|
88
|
+
Z.isDisplay ? /* @__PURE__ */ e(
|
|
89
|
+
Ke,
|
|
90
|
+
{
|
|
91
|
+
value: w ?? F ?? "",
|
|
92
|
+
placeholder: $,
|
|
93
|
+
disabled: i,
|
|
94
|
+
readOnly: n,
|
|
95
|
+
onActivate: Z.enterEdit,
|
|
96
|
+
ariaLabel: l
|
|
97
|
+
}
|
|
98
|
+
) : /* @__PURE__ */ v(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
className: `nice-input nice-input--${a} nice-input--ds-${ve || se} ${t ? "nice-input--error" : ""} ${i ? "nice-input--disabled" : ""} ${n ? "nice-input--readonly" : ""}`,
|
|
102
|
+
style: m ? void 0 : G,
|
|
103
|
+
children: [
|
|
104
|
+
R && /* @__PURE__ */ e("span", { className: "nice-input__icon", children: R }),
|
|
105
|
+
/* @__PURE__ */ e(
|
|
106
|
+
"input",
|
|
107
|
+
{
|
|
108
|
+
ref: (g) => {
|
|
109
|
+
typeof _ == "function" ? _(g) : _ && (_.current = g), Z.autoFocusRef(g);
|
|
110
|
+
},
|
|
111
|
+
id: A,
|
|
112
|
+
className: "nice-input__native",
|
|
113
|
+
type: S,
|
|
114
|
+
name: y,
|
|
115
|
+
value: w,
|
|
116
|
+
defaultValue: F,
|
|
117
|
+
placeholder: $,
|
|
118
|
+
disabled: i || ue,
|
|
119
|
+
readOnly: n,
|
|
120
|
+
maxLength: b,
|
|
121
|
+
autoFocus: M,
|
|
122
|
+
"aria-invalid": !!t,
|
|
123
|
+
"aria-describedby": t ? `${A}-error` : h ? `${A}-helper` : void 0,
|
|
124
|
+
onChange: (g) => p?.(g.target.value),
|
|
125
|
+
onBlur: (g) => {
|
|
126
|
+
P && Z.exitEdit(), Y?.(g);
|
|
127
|
+
},
|
|
128
|
+
onKeyDown: ie,
|
|
129
|
+
...k
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
x && w && /* @__PURE__ */ e(
|
|
133
|
+
"button",
|
|
134
|
+
{
|
|
135
|
+
type: "button",
|
|
136
|
+
className: "nice-input__clear",
|
|
137
|
+
onClick: O,
|
|
138
|
+
"aria-label": L("controls.clear", "Clear"),
|
|
139
|
+
children: "✕"
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
U && /* @__PURE__ */ e("span", { className: "nice-input__icon", children: U }),
|
|
143
|
+
l && j === "inside" && /* @__PURE__ */ e(
|
|
144
|
+
"label",
|
|
145
|
+
{
|
|
146
|
+
htmlFor: A,
|
|
147
|
+
className: `nice-input__floating-label ${d ? "nice-input__floating-label--required" : ""}`,
|
|
148
|
+
children: l
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
ue && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
155
|
+
ae === "right" && t && /* @__PURE__ */ e("div", { id: `${A}-error`, className: "nice-field__error", role: "alert", children: t }),
|
|
156
|
+
ae === "right" && !t && h && /* @__PURE__ */ e("div", { id: `${A}-helper`, className: "nice-field__helper", children: h })
|
|
157
|
+
] }),
|
|
158
|
+
ae !== "right" && t && /* @__PURE__ */ e("div", { id: `${A}-error`, className: "nice-field__error", role: "alert", children: t }),
|
|
159
|
+
ae !== "right" && !t && h && /* @__PURE__ */ e("div", { id: `${A}-helper`, className: "nice-field__helper", children: h })
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
Ye.displayName = "NiceTextInput";
|
|
166
|
+
const ze = xe(
|
|
167
|
+
({
|
|
168
|
+
label: l,
|
|
169
|
+
helperText: h,
|
|
170
|
+
error: t,
|
|
171
|
+
required: d,
|
|
172
|
+
disabled: i,
|
|
173
|
+
readOnly: n,
|
|
174
|
+
size: a = "md",
|
|
175
|
+
name: y,
|
|
176
|
+
id: u,
|
|
177
|
+
className: o,
|
|
178
|
+
style: f,
|
|
179
|
+
accessMode: D,
|
|
180
|
+
displayStyle: Q,
|
|
181
|
+
value: m,
|
|
182
|
+
onChange: w,
|
|
183
|
+
onBlur: F,
|
|
184
|
+
onKeyDown: p,
|
|
185
|
+
placeholder: Y,
|
|
186
|
+
min: E,
|
|
187
|
+
max: $,
|
|
188
|
+
step: S = 1,
|
|
189
|
+
precision: b,
|
|
190
|
+
prefix: R,
|
|
191
|
+
prefixType: U = "label",
|
|
192
|
+
prefixOptions: x,
|
|
193
|
+
prefixValue: M,
|
|
194
|
+
onPrefixChange: T,
|
|
195
|
+
suffix: V,
|
|
196
|
+
showStepper: I = !0,
|
|
197
|
+
submitOnEnter: j,
|
|
198
|
+
onSubmit: ae,
|
|
199
|
+
showKeyboardHints: ue,
|
|
200
|
+
labelPlacement: ne,
|
|
201
|
+
errorPlacement: X,
|
|
202
|
+
loading: P,
|
|
203
|
+
labelWidth: k,
|
|
204
|
+
controlWidth: _,
|
|
205
|
+
formatPreset: q,
|
|
206
|
+
format: L,
|
|
207
|
+
suffixType: A = "label",
|
|
208
|
+
suffixOptions: G,
|
|
209
|
+
suffixValue: se,
|
|
210
|
+
onSuffixChange: ve,
|
|
211
|
+
displayMode: O
|
|
212
|
+
}, Z) => {
|
|
213
|
+
const re = we(D, u);
|
|
214
|
+
if (re === "hidden")
|
|
215
|
+
return null;
|
|
216
|
+
re === "disabled" && (i = !0), re === "readOnly" && (n = !0);
|
|
217
|
+
const { t: ie } = Fe(), r = Re(u), g = Ie("input", Q), K = ye("input", Q), [C, z] = de(!1), [J, ge] = de(null), be = qe({ enabled: O, readOnly: n, disabled: i }), pe = oe(() => {
|
|
218
|
+
let c = 3;
|
|
219
|
+
return $ != null && (c = String(Math.abs(Math.floor($))).length), E != null && E < 0 && (c += 1), b && (c += b + 1), Math.max(3, c) + 1;
|
|
220
|
+
}, [$, E, b]), Me = ee(
|
|
221
|
+
(c) => {
|
|
222
|
+
if (L)
|
|
223
|
+
return L(c);
|
|
224
|
+
if (!q)
|
|
225
|
+
return b != null ? c.toFixed(b) : String(c);
|
|
226
|
+
switch (q) {
|
|
227
|
+
case "integer":
|
|
228
|
+
return Math.round(c).toLocaleString();
|
|
229
|
+
case "decimal":
|
|
230
|
+
return c.toLocaleString(void 0, {
|
|
231
|
+
minimumFractionDigits: b ?? 2,
|
|
232
|
+
maximumFractionDigits: b ?? 2
|
|
233
|
+
});
|
|
234
|
+
case "money":
|
|
235
|
+
return c.toLocaleString(void 0, {
|
|
236
|
+
minimumFractionDigits: b ?? 2,
|
|
237
|
+
maximumFractionDigits: b ?? 2,
|
|
238
|
+
useGrouping: !0
|
|
239
|
+
});
|
|
240
|
+
case "percent":
|
|
241
|
+
return (c * 100).toLocaleString(void 0, {
|
|
242
|
+
minimumFractionDigits: b ?? 0,
|
|
243
|
+
maximumFractionDigits: b ?? 2
|
|
244
|
+
}) + "%";
|
|
245
|
+
default:
|
|
246
|
+
return String(c);
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
[L, q, b]
|
|
250
|
+
), Ce = oe(() => C && J !== null ? J : m == null ? "" : C ? b != null ? m.toFixed(b) : String(m) : Me(m), [m, C, J, Me, b]), he = m != null && m < 0, te = !!(R || U === "select" && x && x.length > 0), W = he && te && !C, He = W ? Ce.replace(/^[-−]/, "") : Ce, fe = ee(
|
|
251
|
+
(c) => {
|
|
252
|
+
let N = c;
|
|
253
|
+
return E !== void 0 && (N = Math.max(E, N)), $ !== void 0 && (N = Math.min($, N)), b !== void 0 && (N = parseFloat(N.toFixed(b))), N;
|
|
254
|
+
},
|
|
255
|
+
[E, $, b]
|
|
256
|
+
), Ue = ee(
|
|
257
|
+
(c) => {
|
|
258
|
+
const N = c.target.value;
|
|
259
|
+
if (ge(N), N === "" || N === "-" || N === "." || N === "-.") {
|
|
260
|
+
N === "" && w?.(null);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
const le = parseFloat(N);
|
|
264
|
+
if (!isNaN(le)) {
|
|
265
|
+
let _e = le;
|
|
266
|
+
E !== void 0 && (_e = Math.max(E, _e)), $ !== void 0 && (_e = Math.min($, _e)), w?.(_e);
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
[w, E, $]
|
|
270
|
+
), Ne = ee(() => {
|
|
271
|
+
const c = $e.current, N = fe((c ?? 0) + S);
|
|
272
|
+
$e.current = N, w?.(N);
|
|
273
|
+
}, [S, w, fe]), De = ee(() => {
|
|
274
|
+
const c = $e.current, N = fe((c ?? 0) - S);
|
|
275
|
+
$e.current = N, w?.(N);
|
|
276
|
+
}, [S, w, fe]), $e = Se(m);
|
|
277
|
+
$e.current = m;
|
|
278
|
+
const s = Se(null), H = ee(() => {
|
|
279
|
+
s.current && (clearTimeout(s.current), s.current = null);
|
|
280
|
+
}, []), B = ee(
|
|
281
|
+
(c) => {
|
|
282
|
+
H();
|
|
283
|
+
let N = 300;
|
|
284
|
+
const le = () => {
|
|
285
|
+
c(), N = Math.max(30, N * 0.82), s.current = setTimeout(le, N);
|
|
286
|
+
};
|
|
287
|
+
s.current = setTimeout(le, 400);
|
|
288
|
+
},
|
|
289
|
+
[H]
|
|
290
|
+
), me = Ve({
|
|
291
|
+
enabled: j,
|
|
292
|
+
onSubmit: ae
|
|
293
|
+
}), Le = ee(
|
|
294
|
+
(c) => {
|
|
295
|
+
me(c), c.key === "ArrowUp" ? (c.preventDefault(), Ne()) : c.key === "ArrowDown" && (c.preventDefault(), De()), p?.(c);
|
|
296
|
+
},
|
|
297
|
+
[me, p, Ne, De]
|
|
298
|
+
), ce = oe(() => {
|
|
299
|
+
const c = [];
|
|
300
|
+
return j && c.push(Be.submit), I && (c.push({ key: "ArrowUp", description: ie("shortcuts.increment", "Increase value") }), c.push({ key: "ArrowDown", description: ie("shortcuts.decrement", "Decrease value") })), c;
|
|
301
|
+
}, [j, I, ie]);
|
|
302
|
+
return /* @__PURE__ */ v(
|
|
303
|
+
"div",
|
|
304
|
+
{
|
|
305
|
+
className: `nice-field nice-field--${a} ${ne === "left" ? "nice-field--label-left" : ""} ${P ? "nice-field--loading" : ""} ${o || ""}`,
|
|
306
|
+
style: {
|
|
307
|
+
...f,
|
|
308
|
+
...k != null && {
|
|
309
|
+
"--nice-field-label-width": typeof k == "number" ? `${k}px` : k
|
|
310
|
+
},
|
|
311
|
+
..._ != null && {
|
|
312
|
+
"--nice-field-control-width": typeof _ == "number" ? `${_}px` : _
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
"aria-busy": P || void 0,
|
|
316
|
+
children: [
|
|
317
|
+
l && /* @__PURE__ */ v(
|
|
318
|
+
"label",
|
|
319
|
+
{
|
|
320
|
+
htmlFor: r,
|
|
321
|
+
className: `nice-field__label ${d ? "nice-field__label--required" : ""}`,
|
|
322
|
+
children: [
|
|
323
|
+
l,
|
|
324
|
+
ue && ce.length > 0 && /* @__PURE__ */ e(Ae, { shortcuts: ce, size: "sm" })
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
),
|
|
328
|
+
/* @__PURE__ */ v("div", { className: "nice-field__control", children: [
|
|
329
|
+
be.isDisplay ? /* @__PURE__ */ e(
|
|
330
|
+
Ke,
|
|
331
|
+
{
|
|
332
|
+
value: m == null ? "" : R ? /* @__PURE__ */ v(Ee, { children: [
|
|
333
|
+
R,
|
|
334
|
+
Ce
|
|
335
|
+
] }) : Ce,
|
|
336
|
+
placeholder: Y,
|
|
337
|
+
disabled: i,
|
|
338
|
+
readOnly: n,
|
|
339
|
+
onActivate: be.enterEdit,
|
|
340
|
+
ariaLabel: l
|
|
341
|
+
}
|
|
342
|
+
) : /* @__PURE__ */ e(Ee, { children: /* @__PURE__ */ v(
|
|
343
|
+
"div",
|
|
344
|
+
{
|
|
345
|
+
className: `nice-input nice-input--number nice-input--${a} nice-input--ds-${K} ${t ? "nice-input--error" : ""} ${i ? "nice-input--disabled" : ""} ${n ? "nice-input--readonly" : ""}`,
|
|
346
|
+
style: g,
|
|
347
|
+
children: [
|
|
348
|
+
I && !n && /* @__PURE__ */ e(
|
|
349
|
+
"button",
|
|
350
|
+
{
|
|
351
|
+
type: "button",
|
|
352
|
+
className: "nice-input__clear nice-input__minus",
|
|
353
|
+
onClick: De,
|
|
354
|
+
onMouseDown: () => B(De),
|
|
355
|
+
onMouseUp: H,
|
|
356
|
+
onMouseLeave: H,
|
|
357
|
+
disabled: i,
|
|
358
|
+
"aria-label": ie("controls.decrement", "Decrement"),
|
|
359
|
+
children: "−"
|
|
360
|
+
}
|
|
361
|
+
),
|
|
362
|
+
U === "select" && x && x.length > 0 ? /* @__PURE__ */ v(Ee, { children: [
|
|
363
|
+
W && /* @__PURE__ */ e("span", { className: "nice-input__sign", children: "−" }),
|
|
364
|
+
/* @__PURE__ */ e(
|
|
365
|
+
"select",
|
|
366
|
+
{
|
|
367
|
+
className: "nice-input__suffix-select nice-input__icon--prefix",
|
|
368
|
+
value: M ?? x[0]?.value,
|
|
369
|
+
disabled: i,
|
|
370
|
+
onChange: (c) => {
|
|
371
|
+
const N = c.target.value, le = x.find(
|
|
372
|
+
(ke) => ke.value === (M ?? x[0]?.value)
|
|
373
|
+
), _e = x.find((ke) => ke.value === N);
|
|
374
|
+
T?.(N, le?.weight, _e?.weight);
|
|
375
|
+
},
|
|
376
|
+
children: x.map((c) => /* @__PURE__ */ e("option", { value: c.value, children: c.label }, c.value))
|
|
377
|
+
}
|
|
378
|
+
)
|
|
379
|
+
] }) : R ? /* @__PURE__ */ v("span", { className: "nice-input__icon nice-input__icon--prefix", children: [
|
|
380
|
+
W && /* @__PURE__ */ e("span", { className: "nice-input__sign", children: "−" }),
|
|
381
|
+
R
|
|
382
|
+
] }) : null,
|
|
383
|
+
/* @__PURE__ */ e(
|
|
384
|
+
"input",
|
|
385
|
+
{
|
|
386
|
+
ref: (c) => {
|
|
387
|
+
typeof Z == "function" ? Z(c) : Z && (Z.current = c), be.autoFocusRef(c);
|
|
388
|
+
},
|
|
389
|
+
id: r,
|
|
390
|
+
className: "nice-input__native",
|
|
391
|
+
type: !C && (L || q) ? "text" : "number",
|
|
392
|
+
name: y,
|
|
393
|
+
value: He,
|
|
394
|
+
placeholder: Y,
|
|
395
|
+
min: E,
|
|
396
|
+
max: $,
|
|
397
|
+
step: S,
|
|
398
|
+
disabled: i || P,
|
|
399
|
+
readOnly: n,
|
|
400
|
+
"aria-invalid": !!t,
|
|
401
|
+
onChange: Ue,
|
|
402
|
+
onFocus: (c) => {
|
|
403
|
+
z(!0), ge(null), c.target.select();
|
|
404
|
+
},
|
|
405
|
+
onBlur: (c) => {
|
|
406
|
+
if (z(!1), ge(null), m != null && b !== void 0) {
|
|
407
|
+
const N = parseFloat(m.toFixed(b));
|
|
408
|
+
N !== m && w?.(N);
|
|
409
|
+
}
|
|
410
|
+
O && be.exitEdit(), F?.(c);
|
|
411
|
+
},
|
|
412
|
+
onKeyDown: Le,
|
|
413
|
+
style: { width: `${pe}ch` }
|
|
414
|
+
}
|
|
415
|
+
),
|
|
416
|
+
A === "select" && G && G.length > 0 ? /* @__PURE__ */ e(
|
|
417
|
+
"select",
|
|
418
|
+
{
|
|
419
|
+
className: "nice-input__suffix-select nice-input__icon--suffix",
|
|
420
|
+
value: se ?? G[0]?.value,
|
|
421
|
+
disabled: i,
|
|
422
|
+
onChange: (c) => {
|
|
423
|
+
const N = c.target.value, le = G.find(
|
|
424
|
+
(ke) => ke.value === (se ?? G[0]?.value)
|
|
425
|
+
), _e = G.find((ke) => ke.value === N);
|
|
426
|
+
ve?.(N, le?.weight, _e?.weight);
|
|
427
|
+
},
|
|
428
|
+
children: G.map((c) => /* @__PURE__ */ e("option", { value: c.value, children: c.label }, c.value))
|
|
429
|
+
}
|
|
430
|
+
) : V ? /* @__PURE__ */ e("span", { className: "nice-input__icon nice-input__icon--suffix", children: V }) : null,
|
|
431
|
+
I && !n && /* @__PURE__ */ e(
|
|
432
|
+
"button",
|
|
433
|
+
{
|
|
434
|
+
type: "button",
|
|
435
|
+
className: "nice-input__clear nice-input__plus",
|
|
436
|
+
onClick: Ne,
|
|
437
|
+
onMouseDown: () => B(Ne),
|
|
438
|
+
onMouseUp: H,
|
|
439
|
+
onMouseLeave: H,
|
|
440
|
+
disabled: i,
|
|
441
|
+
"aria-label": ie("controls.increment", "Increment"),
|
|
442
|
+
children: "+"
|
|
443
|
+
}
|
|
444
|
+
)
|
|
445
|
+
]
|
|
446
|
+
}
|
|
447
|
+
) }),
|
|
448
|
+
P && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
449
|
+
X === "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
|
|
450
|
+
X === "right" && !t && h && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: h })
|
|
451
|
+
] }),
|
|
452
|
+
X !== "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
|
|
453
|
+
X !== "right" && !t && h && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: h })
|
|
454
|
+
]
|
|
455
|
+
}
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
);
|
|
459
|
+
ze.displayName = "NiceNumberInput";
|
|
460
|
+
const Je = xe(
|
|
461
|
+
({
|
|
462
|
+
label: l,
|
|
463
|
+
helperText: h,
|
|
464
|
+
error: t,
|
|
465
|
+
required: d,
|
|
466
|
+
disabled: i,
|
|
467
|
+
size: n = "md",
|
|
468
|
+
name: a,
|
|
469
|
+
id: y,
|
|
470
|
+
className: u,
|
|
471
|
+
style: o,
|
|
472
|
+
accessMode: f,
|
|
473
|
+
displayStyle: D,
|
|
474
|
+
options: Q,
|
|
475
|
+
value: m,
|
|
476
|
+
onChange: w,
|
|
477
|
+
placeholder: F,
|
|
478
|
+
multiple: p = !1,
|
|
479
|
+
searchable: Y = !1,
|
|
480
|
+
clearable: E = !1,
|
|
481
|
+
emptyText: $,
|
|
482
|
+
maxHeight: S = 240,
|
|
483
|
+
optionsSource: b,
|
|
484
|
+
valueField: R,
|
|
485
|
+
labelField: U,
|
|
486
|
+
virtualScroll: x,
|
|
487
|
+
optionHeight: M = 36,
|
|
488
|
+
onSearch: T,
|
|
489
|
+
loading: V,
|
|
490
|
+
renderOption: I,
|
|
491
|
+
multipleAutosize: j = !1,
|
|
492
|
+
showKeyboardHints: ae,
|
|
493
|
+
labelPlacement: ue,
|
|
494
|
+
errorPlacement: ne,
|
|
495
|
+
labelWidth: X,
|
|
496
|
+
controlWidth: P,
|
|
497
|
+
displayMode: k
|
|
498
|
+
}, _) => {
|
|
499
|
+
const q = we(f, y);
|
|
500
|
+
if (q === "hidden")
|
|
501
|
+
return null;
|
|
502
|
+
(q === "disabled" || q === "readOnly") && (i = !0);
|
|
503
|
+
const { t: L } = Fe(), A = Ie("input", D), G = ye("input", D), se = Re(y), ve = qe({ enabled: k, disabled: i }), [O, Z] = de(!1), [re, ie] = de(""), [r, g] = de(-1), [K, C] = de(0), z = Se(null), J = Se(null), [ge, be] = de(null);
|
|
504
|
+
Te(() => {
|
|
505
|
+
!V && J.current && be(J.current.offsetWidth);
|
|
506
|
+
}, [V, m, D]);
|
|
507
|
+
const [pe, Me] = de(null);
|
|
508
|
+
Te(() => {
|
|
509
|
+
p && !j && J.current && pe == null && Me(J.current.offsetWidth);
|
|
510
|
+
}, [p, j, pe]);
|
|
511
|
+
const Ce = Ge(
|
|
512
|
+
b ?? null,
|
|
513
|
+
R ?? b?.keyField ?? "id",
|
|
514
|
+
U ?? "name"
|
|
515
|
+
), he = b ? Ce.options : (Q ?? []).map(
|
|
516
|
+
(s) => typeof s == "string" ? { value: s, label: s } : s
|
|
517
|
+
);
|
|
518
|
+
Xe(z, () => {
|
|
519
|
+
Z(!1), ie("");
|
|
520
|
+
});
|
|
521
|
+
const te = oe(() => m ? Array.isArray(m) ? m : [m] : [], [m]), W = oe(() => {
|
|
522
|
+
if (!re && !T || T)
|
|
523
|
+
return he;
|
|
524
|
+
const s = re.toLowerCase();
|
|
525
|
+
return he.filter(
|
|
526
|
+
(H) => H.label.toLowerCase().includes(s) || String(H.value).toLowerCase().includes(s)
|
|
527
|
+
);
|
|
528
|
+
}, [he, re, T]), He = oe(() => {
|
|
529
|
+
const s = /* @__PURE__ */ new Map();
|
|
530
|
+
for (const H of W) {
|
|
531
|
+
const B = H.group || "";
|
|
532
|
+
s.has(B) || s.set(B, []), s.get(B).push(H);
|
|
533
|
+
}
|
|
534
|
+
return s;
|
|
535
|
+
}, [W]), fe = ee(
|
|
536
|
+
(s) => {
|
|
537
|
+
if (p) {
|
|
538
|
+
const H = te.includes(s) ? te.filter((B) => B !== s) : [...te, s];
|
|
539
|
+
w?.(H);
|
|
540
|
+
} else
|
|
541
|
+
w?.(s), Z(!1), ie("");
|
|
542
|
+
},
|
|
543
|
+
[p, te, w]
|
|
544
|
+
), Ue = ee(
|
|
545
|
+
(s) => {
|
|
546
|
+
if (s.key === "Escape") {
|
|
547
|
+
Z(!1), ie("");
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
if (s.key === "Enter" || s.key === " ") {
|
|
551
|
+
if (!O) {
|
|
552
|
+
Z(!0), s.preventDefault();
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
r >= 0 && W[r] && (fe(W[r].value), s.preventDefault());
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
s.key === "ArrowDown" && (s.preventDefault(), g((H) => Math.min(H + 1, W.length - 1))), s.key === "ArrowUp" && (s.preventDefault(), g((H) => Math.max(H - 1, 0)));
|
|
559
|
+
},
|
|
560
|
+
[O, r, W, fe]
|
|
561
|
+
), Ne = oe(() => te.length === 0 ? null : p ? te.map((s) => he.find((H) => H.value === s)?.label || s).join(", ") : he.find((s) => s.value === te[0])?.label || te[0], [te, he, p]), De = ee(
|
|
562
|
+
(s) => {
|
|
563
|
+
s.stopPropagation(), w?.(p ? [] : "");
|
|
564
|
+
},
|
|
565
|
+
[w, p]
|
|
566
|
+
), $e = oe(
|
|
567
|
+
() => [
|
|
568
|
+
{ key: "Enter", description: L("shortcuts.select", "Select") },
|
|
569
|
+
{ key: "Space", description: L("shortcuts.openDropdown", "Open dropdown") },
|
|
570
|
+
Be.moveUp,
|
|
571
|
+
Be.moveDown,
|
|
572
|
+
Be.cancel
|
|
573
|
+
],
|
|
574
|
+
[L]
|
|
575
|
+
);
|
|
576
|
+
return /* @__PURE__ */ v(
|
|
577
|
+
"div",
|
|
578
|
+
{
|
|
579
|
+
className: `nice-field ${P == null ? "nice-field--select-auto" : ""} nice-field--${n} ${ue === "left" ? "nice-field--label-left" : ""} ${V ? "nice-field--loading" : ""} ${u || ""}`,
|
|
580
|
+
style: {
|
|
581
|
+
...o,
|
|
582
|
+
...X != null && {
|
|
583
|
+
"--nice-field-label-width": typeof X == "number" ? `${X}px` : X
|
|
584
|
+
},
|
|
585
|
+
...P != null && {
|
|
586
|
+
"--nice-field-control-width": typeof P == "number" ? `${P}px` : P
|
|
587
|
+
},
|
|
588
|
+
...V && ge != null && { "--nice-select-locked-width": `${ge}px` }
|
|
589
|
+
},
|
|
590
|
+
"aria-busy": V || void 0,
|
|
591
|
+
children: [
|
|
592
|
+
l && /* @__PURE__ */ v(
|
|
593
|
+
"label",
|
|
594
|
+
{
|
|
595
|
+
htmlFor: se,
|
|
596
|
+
className: `nice-field__label ${d ? "nice-field__label--required" : ""}`,
|
|
597
|
+
children: [
|
|
598
|
+
l,
|
|
599
|
+
ae && /* @__PURE__ */ e(Ae, { shortcuts: $e, size: "sm" })
|
|
600
|
+
]
|
|
601
|
+
}
|
|
602
|
+
),
|
|
603
|
+
/* @__PURE__ */ v("div", { className: "nice-field__control", children: [
|
|
604
|
+
ve.isDisplay ? /* @__PURE__ */ e(
|
|
605
|
+
Ke,
|
|
606
|
+
{
|
|
607
|
+
value: Ne,
|
|
608
|
+
placeholder: F || L("controls.select", "Select..."),
|
|
609
|
+
disabled: i,
|
|
610
|
+
onActivate: () => {
|
|
611
|
+
ve.enterEdit(), Z(!0);
|
|
612
|
+
},
|
|
613
|
+
ariaLabel: l
|
|
614
|
+
}
|
|
615
|
+
) : /* @__PURE__ */ v("div", { className: "nice-select", ref: z, children: [
|
|
616
|
+
/* @__PURE__ */ v(
|
|
617
|
+
"button",
|
|
618
|
+
{
|
|
619
|
+
ref: (s) => {
|
|
620
|
+
J.current = s, typeof _ == "function" ? _(s) : _ && (_.current = s);
|
|
621
|
+
},
|
|
622
|
+
type: "button",
|
|
623
|
+
id: se,
|
|
624
|
+
role: "combobox",
|
|
625
|
+
"aria-expanded": O,
|
|
626
|
+
"aria-haspopup": "listbox",
|
|
627
|
+
"aria-invalid": !!t,
|
|
628
|
+
className: `nice-select__trigger nice-select__trigger--${n} nice-select--ds-${G} ${O ? "nice-select__trigger--open" : ""} ${t ? "nice-select__trigger--error" : ""} ${i ? "nice-select__trigger--disabled" : ""}`,
|
|
629
|
+
style: {
|
|
630
|
+
...A,
|
|
631
|
+
...p && !j && pe != null ? {
|
|
632
|
+
width: pe,
|
|
633
|
+
maxWidth: pe,
|
|
634
|
+
overflow: "hidden"
|
|
635
|
+
} : {}
|
|
636
|
+
},
|
|
637
|
+
disabled: i,
|
|
638
|
+
onClick: () => Z(!O),
|
|
639
|
+
onKeyDown: Ue,
|
|
640
|
+
children: [
|
|
641
|
+
Ne ? /* @__PURE__ */ e(
|
|
642
|
+
"span",
|
|
643
|
+
{
|
|
644
|
+
style: p && !j ? {
|
|
645
|
+
flex: 1,
|
|
646
|
+
minWidth: 0,
|
|
647
|
+
overflow: "hidden",
|
|
648
|
+
textOverflow: "ellipsis",
|
|
649
|
+
whiteSpace: "nowrap"
|
|
650
|
+
} : void 0,
|
|
651
|
+
children: Ne
|
|
652
|
+
}
|
|
653
|
+
) : /* @__PURE__ */ e("span", { className: "nice-select__placeholder", children: F || L("controls.select", "Select...") }),
|
|
654
|
+
/* @__PURE__ */ v("span", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
655
|
+
E && te.length > 0 && /* @__PURE__ */ e(
|
|
656
|
+
"span",
|
|
657
|
+
{
|
|
658
|
+
className: "nice-input__clear",
|
|
659
|
+
onClick: De,
|
|
660
|
+
role: "button",
|
|
661
|
+
"aria-label": L("controls.clear", "Clear"),
|
|
662
|
+
children: "✕"
|
|
663
|
+
}
|
|
664
|
+
),
|
|
665
|
+
/* @__PURE__ */ e(
|
|
666
|
+
"svg",
|
|
667
|
+
{
|
|
668
|
+
className: `nice-select__chevron ${O ? "nice-select__chevron--open" : ""}`,
|
|
669
|
+
viewBox: "0 0 20 20",
|
|
670
|
+
fill: "currentColor",
|
|
671
|
+
children: /* @__PURE__ */ e(
|
|
672
|
+
"path",
|
|
673
|
+
{
|
|
674
|
+
fillRule: "evenodd",
|
|
675
|
+
d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",
|
|
676
|
+
clipRule: "evenodd"
|
|
677
|
+
}
|
|
678
|
+
)
|
|
679
|
+
}
|
|
680
|
+
)
|
|
681
|
+
] })
|
|
682
|
+
]
|
|
683
|
+
}
|
|
684
|
+
),
|
|
685
|
+
O && /* @__PURE__ */ v(
|
|
686
|
+
"div",
|
|
687
|
+
{
|
|
688
|
+
className: "nice-select__dropdown",
|
|
689
|
+
role: "listbox",
|
|
690
|
+
style: { maxHeight: S },
|
|
691
|
+
onScroll: x ? (s) => C(s.currentTarget.scrollTop) : void 0,
|
|
692
|
+
children: [
|
|
693
|
+
(Y || T) && /* @__PURE__ */ e("div", { className: "nice-select__search", children: /* @__PURE__ */ e(
|
|
694
|
+
"input",
|
|
695
|
+
{
|
|
696
|
+
type: "text",
|
|
697
|
+
value: re,
|
|
698
|
+
onChange: (s) => {
|
|
699
|
+
ie(s.target.value), g(0), T?.(s.target.value);
|
|
700
|
+
},
|
|
701
|
+
placeholder: L("controls.search", "Search..."),
|
|
702
|
+
autoFocus: !0
|
|
703
|
+
}
|
|
704
|
+
) }),
|
|
705
|
+
V && /* @__PURE__ */ e("div", { className: "nice-select__loading", children: /* @__PURE__ */ e(
|
|
706
|
+
"div",
|
|
707
|
+
{
|
|
708
|
+
className: "nice-spinner nice-spinner--sm",
|
|
709
|
+
style: { margin: "8px auto" }
|
|
710
|
+
}
|
|
711
|
+
) }),
|
|
712
|
+
!V && W.length === 0 ? /* @__PURE__ */ e("div", { className: "nice-select__empty", children: $ || L("controls.noResults", "No results found") }) : x && !Array.from(He.keys()).some((s) => s !== "") ? (() => {
|
|
713
|
+
const H = W.length * M, B = Math.max(
|
|
714
|
+
0,
|
|
715
|
+
Math.floor(K / M) - 3
|
|
716
|
+
), me = Math.min(
|
|
717
|
+
W.length,
|
|
718
|
+
Math.ceil((K + S) / M) + 3
|
|
719
|
+
), Le = W.slice(B, me);
|
|
720
|
+
return /* @__PURE__ */ e("div", { style: { height: H, position: "relative" }, children: Le.map((ce, c) => {
|
|
721
|
+
const N = B + c, le = te.includes(ce.value);
|
|
722
|
+
return /* @__PURE__ */ e(
|
|
723
|
+
"div",
|
|
724
|
+
{
|
|
725
|
+
role: "option",
|
|
726
|
+
"aria-selected": le,
|
|
727
|
+
className: `nice-select__option ${le ? "nice-select__option--selected" : ""} ${N === r ? "nice-select__option--highlighted" : ""} ${ce.disabled ? "nice-select__option--disabled" : ""}`,
|
|
728
|
+
style: {
|
|
729
|
+
position: "absolute",
|
|
730
|
+
top: N * M,
|
|
731
|
+
left: 0,
|
|
732
|
+
right: 0,
|
|
733
|
+
height: M,
|
|
734
|
+
display: "flex",
|
|
735
|
+
alignItems: "center",
|
|
736
|
+
padding: "0 12px"
|
|
737
|
+
},
|
|
738
|
+
onClick: () => !ce.disabled && fe(String(ce.value)),
|
|
739
|
+
onMouseEnter: () => g(N),
|
|
740
|
+
children: I ? I(ce, le) : /* @__PURE__ */ v(Ee, { children: [
|
|
741
|
+
ce.icon && /* @__PURE__ */ e("span", { children: ce.icon }),
|
|
742
|
+
/* @__PURE__ */ v("div", { style: { flex: 1 }, children: [
|
|
743
|
+
/* @__PURE__ */ e("div", { children: ce.label }),
|
|
744
|
+
ce.description && /* @__PURE__ */ e("div", { className: "nice-select__option-desc", children: ce.description })
|
|
745
|
+
] }),
|
|
746
|
+
le && /* @__PURE__ */ e(
|
|
747
|
+
"svg",
|
|
748
|
+
{
|
|
749
|
+
className: "nice-select__option-check",
|
|
750
|
+
viewBox: "0 0 20 20",
|
|
751
|
+
fill: "currentColor",
|
|
752
|
+
children: /* @__PURE__ */ e(
|
|
753
|
+
"path",
|
|
754
|
+
{
|
|
755
|
+
fillRule: "evenodd",
|
|
756
|
+
d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",
|
|
757
|
+
clipRule: "evenodd"
|
|
758
|
+
}
|
|
759
|
+
)
|
|
760
|
+
}
|
|
761
|
+
)
|
|
762
|
+
] })
|
|
763
|
+
},
|
|
764
|
+
ce.value
|
|
765
|
+
);
|
|
766
|
+
}) });
|
|
767
|
+
})() : Array.from(He.entries()).map(([s, H]) => /* @__PURE__ */ v(je.Fragment, { children: [
|
|
768
|
+
s && /* @__PURE__ */ e("div", { className: "nice-select__group-label", children: s }),
|
|
769
|
+
H.map((B) => {
|
|
770
|
+
const me = te.includes(B.value), Le = W.indexOf(B);
|
|
771
|
+
return /* @__PURE__ */ e(
|
|
772
|
+
"div",
|
|
773
|
+
{
|
|
774
|
+
role: "option",
|
|
775
|
+
"aria-selected": me,
|
|
776
|
+
className: `nice-select__option ${me ? "nice-select__option--selected" : ""} ${Le === r ? "nice-select__option--highlighted" : ""} ${B.disabled ? "nice-select__option--disabled" : ""}`,
|
|
777
|
+
onClick: () => !B.disabled && fe(String(B.value)),
|
|
778
|
+
onMouseEnter: () => g(Le),
|
|
779
|
+
children: I ? I(B, me) : /* @__PURE__ */ v(Ee, { children: [
|
|
780
|
+
B.icon && /* @__PURE__ */ e("span", { children: B.icon }),
|
|
781
|
+
/* @__PURE__ */ v("div", { style: { flex: 1 }, children: [
|
|
782
|
+
/* @__PURE__ */ e("div", { children: B.label }),
|
|
783
|
+
B.description && /* @__PURE__ */ e("div", { className: "nice-select__option-desc", children: B.description })
|
|
784
|
+
] }),
|
|
785
|
+
me && /* @__PURE__ */ e(
|
|
786
|
+
"svg",
|
|
787
|
+
{
|
|
788
|
+
className: "nice-select__option-check",
|
|
789
|
+
viewBox: "0 0 20 20",
|
|
790
|
+
fill: "currentColor",
|
|
791
|
+
children: /* @__PURE__ */ e(
|
|
792
|
+
"path",
|
|
793
|
+
{
|
|
794
|
+
fillRule: "evenodd",
|
|
795
|
+
d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",
|
|
796
|
+
clipRule: "evenodd"
|
|
797
|
+
}
|
|
798
|
+
)
|
|
799
|
+
}
|
|
800
|
+
)
|
|
801
|
+
] })
|
|
802
|
+
},
|
|
803
|
+
B.value
|
|
804
|
+
);
|
|
805
|
+
})
|
|
806
|
+
] }, s))
|
|
807
|
+
]
|
|
808
|
+
}
|
|
809
|
+
)
|
|
810
|
+
] }),
|
|
811
|
+
V && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
812
|
+
ne === "right" && t && /* @__PURE__ */ e("div", { id: `${se}-error`, className: "nice-field__error", role: "alert", children: t }),
|
|
813
|
+
ne === "right" && !t && h && /* @__PURE__ */ e("div", { id: `${se}-helper`, className: "nice-field__helper", children: h })
|
|
814
|
+
] }),
|
|
815
|
+
ne !== "right" && t && /* @__PURE__ */ e("div", { id: `${se}-error`, className: "nice-field__error", role: "alert", children: t }),
|
|
816
|
+
ne !== "right" && !t && h && /* @__PURE__ */ e("div", { id: `${se}-helper`, className: "nice-field__helper", children: h })
|
|
817
|
+
]
|
|
818
|
+
}
|
|
819
|
+
);
|
|
820
|
+
}
|
|
821
|
+
);
|
|
822
|
+
Je.displayName = "NiceSelect";
|
|
823
|
+
const Pe = xe(
|
|
824
|
+
({
|
|
825
|
+
label: l,
|
|
826
|
+
checked: h = !1,
|
|
827
|
+
indeterminate: t = !1,
|
|
828
|
+
onChange: d,
|
|
829
|
+
disabled: i,
|
|
830
|
+
readOnly: n,
|
|
831
|
+
loading: a,
|
|
832
|
+
required: y,
|
|
833
|
+
size: u = "md",
|
|
834
|
+
name: o,
|
|
835
|
+
id: f,
|
|
836
|
+
className: D,
|
|
837
|
+
style: Q,
|
|
838
|
+
error: m,
|
|
839
|
+
helperText: w,
|
|
840
|
+
accessMode: F,
|
|
841
|
+
displayStyle: p,
|
|
842
|
+
showKeyboardHints: Y,
|
|
843
|
+
labelPlacement: E,
|
|
844
|
+
errorPlacement: $,
|
|
845
|
+
labelWidth: S,
|
|
846
|
+
controlWidth: b
|
|
847
|
+
}, R) => {
|
|
848
|
+
const U = we(F, f);
|
|
849
|
+
if (U === "hidden")
|
|
850
|
+
return null;
|
|
851
|
+
(U === "disabled" || U === "readOnly") && (i = !0);
|
|
852
|
+
const { t: x } = Fe(), M = Re(f);
|
|
853
|
+
ye("toggle", p);
|
|
854
|
+
const T = oe(
|
|
855
|
+
() => [{ key: "Space", description: x("shortcuts.toggle", "Toggle") }],
|
|
856
|
+
[x]
|
|
857
|
+
), V = je.useCallback(
|
|
858
|
+
(I) => {
|
|
859
|
+
I && (I.indeterminate = t), typeof R == "function" ? R(I) : R && (R.current = I);
|
|
860
|
+
},
|
|
861
|
+
[t, R]
|
|
862
|
+
);
|
|
863
|
+
return /* @__PURE__ */ v(
|
|
864
|
+
"div",
|
|
865
|
+
{
|
|
866
|
+
className: `nice-field nice-field--inline nice-field--${u} ${E === "left" ? "nice-field--label-left" : ""} ${$ === "right" ? "nice-field--error-right" : ""} ${a ? "nice-field--loading" : ""} ${D || ""}`,
|
|
867
|
+
style: {
|
|
868
|
+
...Q,
|
|
869
|
+
...S != null && {
|
|
870
|
+
"--nice-field-label-width": typeof S == "number" ? `${S}px` : S
|
|
871
|
+
},
|
|
872
|
+
...b != null && {
|
|
873
|
+
"--nice-field-control-width": typeof b == "number" ? `${b}px` : b
|
|
874
|
+
}
|
|
875
|
+
},
|
|
876
|
+
"aria-busy": a || void 0,
|
|
877
|
+
children: [
|
|
878
|
+
E === "left" && l && /* @__PURE__ */ e("span", { className: `nice-field__label ${y ? "nice-field__label--required" : ""}`, children: l }),
|
|
879
|
+
/* @__PURE__ */ v("div", { className: "nice-field__control", children: [
|
|
880
|
+
/* @__PURE__ */ v(
|
|
881
|
+
"label",
|
|
882
|
+
{
|
|
883
|
+
className: `nice-checkbox ${u !== "md" ? `nice-checkbox--${u}` : ""} ${i || a ? "nice-checkbox--disabled" : ""}`,
|
|
884
|
+
htmlFor: M,
|
|
885
|
+
children: [
|
|
886
|
+
/* @__PURE__ */ e(
|
|
887
|
+
"input",
|
|
888
|
+
{
|
|
889
|
+
ref: V,
|
|
890
|
+
id: M,
|
|
891
|
+
type: "checkbox",
|
|
892
|
+
className: "nice-checkbox__input",
|
|
893
|
+
name: o,
|
|
894
|
+
checked: h,
|
|
895
|
+
disabled: i || a,
|
|
896
|
+
readOnly: n,
|
|
897
|
+
"aria-invalid": !!m,
|
|
898
|
+
onChange: (I) => {
|
|
899
|
+
n || a || d?.(I.target.checked);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
),
|
|
903
|
+
/* @__PURE__ */ e("span", { className: "nice-checkbox__box", children: /* @__PURE__ */ e(
|
|
904
|
+
"svg",
|
|
905
|
+
{
|
|
906
|
+
viewBox: "0 0 12 12",
|
|
907
|
+
fill: "none",
|
|
908
|
+
stroke: "currentColor",
|
|
909
|
+
strokeWidth: "2",
|
|
910
|
+
strokeLinecap: "round",
|
|
911
|
+
strokeLinejoin: "round",
|
|
912
|
+
children: t ? /* @__PURE__ */ e("line", { x1: "2", y1: "6", x2: "10", y2: "6" }) : /* @__PURE__ */ e("polyline", { points: "2 6 5 9 10 3" })
|
|
913
|
+
}
|
|
914
|
+
) }),
|
|
915
|
+
E !== "left" && l && /* @__PURE__ */ e("span", { children: l }),
|
|
916
|
+
Y && /* @__PURE__ */ e(Ae, { shortcuts: T, size: "sm" })
|
|
917
|
+
]
|
|
918
|
+
}
|
|
919
|
+
),
|
|
920
|
+
a && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
921
|
+
$ === "right" && m && /* @__PURE__ */ e("div", { id: `${M}-error`, className: "nice-field__error", role: "alert", children: m }),
|
|
922
|
+
$ === "right" && !m && w && /* @__PURE__ */ e("div", { id: `${M}-helper`, className: "nice-field__helper", children: w })
|
|
923
|
+
] }),
|
|
924
|
+
$ !== "right" && m && /* @__PURE__ */ e("div", { id: `${M}-error`, className: "nice-field__error", role: "alert", children: m }),
|
|
925
|
+
$ !== "right" && !m && w && /* @__PURE__ */ e("div", { id: `${M}-helper`, className: "nice-field__helper", children: w })
|
|
926
|
+
]
|
|
927
|
+
}
|
|
928
|
+
);
|
|
929
|
+
}
|
|
930
|
+
);
|
|
931
|
+
Pe.displayName = "NiceCheckbox";
|
|
932
|
+
const Oe = xe(
|
|
933
|
+
({
|
|
934
|
+
label: l,
|
|
935
|
+
checked: h = !1,
|
|
936
|
+
onChange: t,
|
|
937
|
+
disabled: d,
|
|
938
|
+
readOnly: i,
|
|
939
|
+
loading: n,
|
|
940
|
+
required: a,
|
|
941
|
+
size: y = "md",
|
|
942
|
+
name: u,
|
|
943
|
+
id: o,
|
|
944
|
+
className: f,
|
|
945
|
+
style: D,
|
|
946
|
+
accessMode: Q,
|
|
947
|
+
displayStyle: m,
|
|
948
|
+
showKeyboardHints: w,
|
|
949
|
+
error: F,
|
|
950
|
+
helperText: p,
|
|
951
|
+
labelPlacement: Y,
|
|
952
|
+
errorPlacement: E,
|
|
953
|
+
labelWidth: $,
|
|
954
|
+
controlWidth: S
|
|
955
|
+
}, b) => {
|
|
956
|
+
const R = we(Q, o);
|
|
957
|
+
if (R === "hidden")
|
|
958
|
+
return null;
|
|
959
|
+
(R === "disabled" || R === "readOnly") && (d = !0);
|
|
960
|
+
const { t: U } = Fe(), x = Re(o);
|
|
961
|
+
Ie("toggle", m);
|
|
962
|
+
const M = ye("toggle", m), T = oe(
|
|
963
|
+
() => [{ key: "Space", description: U("shortcuts.toggle", "Toggle on/off") }],
|
|
964
|
+
[U]
|
|
965
|
+
);
|
|
966
|
+
return /* @__PURE__ */ v(
|
|
967
|
+
"div",
|
|
968
|
+
{
|
|
969
|
+
className: `nice-field nice-field--inline nice-field--${y} ${Y === "left" ? "nice-field--label-left" : ""} ${n ? "nice-field--loading" : ""} ${f || ""}`,
|
|
970
|
+
style: {
|
|
971
|
+
...D,
|
|
972
|
+
...$ != null && {
|
|
973
|
+
"--nice-field-label-width": typeof $ == "number" ? `${$}px` : $
|
|
974
|
+
},
|
|
975
|
+
...S != null && {
|
|
976
|
+
"--nice-field-control-width": typeof S == "number" ? `${S}px` : S
|
|
977
|
+
}
|
|
978
|
+
},
|
|
979
|
+
"aria-busy": n || void 0,
|
|
980
|
+
children: [
|
|
981
|
+
Y === "left" && l && /* @__PURE__ */ e("span", { className: `nice-field__label ${a ? "nice-field__label--required" : ""}`, children: l }),
|
|
982
|
+
/* @__PURE__ */ v("div", { className: "nice-field__control", children: [
|
|
983
|
+
/* @__PURE__ */ v(
|
|
984
|
+
"label",
|
|
985
|
+
{
|
|
986
|
+
className: `nice-toggle nice-toggle--ds-${M} ${y !== "md" ? `nice-toggle--${y}` : ""} ${d || n ? "nice-toggle--disabled" : ""}`,
|
|
987
|
+
htmlFor: x,
|
|
988
|
+
children: [
|
|
989
|
+
/* @__PURE__ */ e(
|
|
990
|
+
"input",
|
|
991
|
+
{
|
|
992
|
+
ref: b,
|
|
993
|
+
id: x,
|
|
994
|
+
type: "checkbox",
|
|
995
|
+
className: "nice-toggle__input",
|
|
996
|
+
name: u,
|
|
997
|
+
checked: h,
|
|
998
|
+
disabled: d || n,
|
|
999
|
+
readOnly: i,
|
|
1000
|
+
role: "switch",
|
|
1001
|
+
"aria-checked": h,
|
|
1002
|
+
"aria-invalid": !!F,
|
|
1003
|
+
onChange: (V) => {
|
|
1004
|
+
i || n || t?.(V.target.checked);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
),
|
|
1008
|
+
/* @__PURE__ */ e("span", { className: "nice-toggle__track", children: /* @__PURE__ */ e("span", { className: "nice-toggle__thumb" }) }),
|
|
1009
|
+
Y !== "left" && l && /* @__PURE__ */ e("span", { children: l }),
|
|
1010
|
+
w && /* @__PURE__ */ e(Ae, { shortcuts: T, size: "sm" })
|
|
1011
|
+
]
|
|
1012
|
+
}
|
|
1013
|
+
),
|
|
1014
|
+
n && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
1015
|
+
E === "right" && F && /* @__PURE__ */ e("div", { id: `${x}-error`, className: "nice-field__error", role: "alert", children: F }),
|
|
1016
|
+
E === "right" && !F && p && /* @__PURE__ */ e("div", { id: `${x}-helper`, className: "nice-field__helper", children: p })
|
|
1017
|
+
] }),
|
|
1018
|
+
E !== "right" && F && /* @__PURE__ */ e("div", { id: `${x}-error`, className: "nice-field__error", role: "alert", children: F }),
|
|
1019
|
+
E !== "right" && !F && p && /* @__PURE__ */ e("div", { id: `${x}-helper`, className: "nice-field__helper", children: p })
|
|
1020
|
+
]
|
|
1021
|
+
}
|
|
1022
|
+
);
|
|
1023
|
+
}
|
|
1024
|
+
);
|
|
1025
|
+
Oe.displayName = "NiceToggle";
|
|
1026
|
+
const We = [
|
|
1027
|
+
"#ef4444",
|
|
1028
|
+
"#f97316",
|
|
1029
|
+
"#f59e0b",
|
|
1030
|
+
"#84cc16",
|
|
1031
|
+
"#10b981",
|
|
1032
|
+
"#06b6d4",
|
|
1033
|
+
"#3b82f6",
|
|
1034
|
+
"#6366f1",
|
|
1035
|
+
"#8b5cf6",
|
|
1036
|
+
"#ec4899",
|
|
1037
|
+
"#64748b",
|
|
1038
|
+
"#1e293b"
|
|
1039
|
+
];
|
|
1040
|
+
function en() {
|
|
1041
|
+
return "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
|
|
1042
|
+
}
|
|
1043
|
+
function nn(l, h, t) {
|
|
1044
|
+
const d = l / 255, i = h / 255, n = t / 255, a = Math.max(d, i, n), y = Math.min(d, i, n), u = (a + y) / 2;
|
|
1045
|
+
let o = 0, f = 0;
|
|
1046
|
+
if (a !== y) {
|
|
1047
|
+
const D = a - y;
|
|
1048
|
+
switch (f = u > 0.5 ? D / (2 - a - y) : D / (a + y), a) {
|
|
1049
|
+
case d:
|
|
1050
|
+
o = (i - n) / D + (i < n ? 6 : 0);
|
|
1051
|
+
break;
|
|
1052
|
+
case i:
|
|
1053
|
+
o = (n - d) / D + 2;
|
|
1054
|
+
break;
|
|
1055
|
+
case n:
|
|
1056
|
+
o = (d - i) / D + 4;
|
|
1057
|
+
break;
|
|
1058
|
+
}
|
|
1059
|
+
o *= 60;
|
|
1060
|
+
}
|
|
1061
|
+
return { h: Math.round(o), s: Math.round(f * 100), l: Math.round(u * 100) };
|
|
1062
|
+
}
|
|
1063
|
+
function tn(l, h, t) {
|
|
1064
|
+
const d = h / 100, i = t / 100, n = (1 - Math.abs(2 * i - 1)) * d, a = n * (1 - Math.abs(l / 60 % 2 - 1)), y = i - n / 2;
|
|
1065
|
+
let u = 0, o = 0, f = 0;
|
|
1066
|
+
return l < 60 ? [u, o, f] = [n, a, 0] : l < 120 ? [u, o, f] = [a, n, 0] : l < 180 ? [u, o, f] = [0, n, a] : l < 240 ? [u, o, f] = [0, a, n] : l < 300 ? [u, o, f] = [a, 0, n] : [u, o, f] = [n, 0, a], {
|
|
1067
|
+
r: Math.round((u + y) * 255),
|
|
1068
|
+
g: Math.round((o + y) * 255),
|
|
1069
|
+
b: Math.round((f + y) * 255)
|
|
1070
|
+
};
|
|
1071
|
+
}
|
|
1072
|
+
function cn(l, h, t) {
|
|
1073
|
+
const d = l / 255, i = h / 255, n = t / 255, a = Math.max(d, i, n), y = Math.min(d, i, n), u = a - y;
|
|
1074
|
+
let o = 0;
|
|
1075
|
+
u !== 0 && (a === d ? o = (i - n) / u % 6 : a === i ? o = (n - d) / u + 2 : o = (d - i) / u + 4, o *= 60, o < 0 && (o += 360));
|
|
1076
|
+
const f = a === 0 ? 0 : u / a;
|
|
1077
|
+
return { h: Math.round(o), s: Math.round(f * 100), v: Math.round(a * 100) };
|
|
1078
|
+
}
|
|
1079
|
+
function ln(l, h, t) {
|
|
1080
|
+
const d = h / 100, i = t / 100, n = i * d, a = n * (1 - Math.abs(l / 60 % 2 - 1)), y = i - n;
|
|
1081
|
+
let u = 0, o = 0, f = 0;
|
|
1082
|
+
return l < 60 ? [u, o, f] = [n, a, 0] : l < 120 ? [u, o, f] = [a, n, 0] : l < 180 ? [u, o, f] = [0, n, a] : l < 240 ? [u, o, f] = [0, a, n] : l < 300 ? [u, o, f] = [a, 0, n] : [u, o, f] = [n, 0, a], {
|
|
1083
|
+
r: Math.round((u + y) * 255),
|
|
1084
|
+
g: Math.round((o + y) * 255),
|
|
1085
|
+
b: Math.round((f + y) * 255)
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1088
|
+
function sn(l) {
|
|
1089
|
+
const h = /^#?([0-9a-f]{6})$/i.exec(l.trim()), t = /^#?([0-9a-f]{8})$/i.exec(l.trim());
|
|
1090
|
+
if (t) {
|
|
1091
|
+
const d = t[1];
|
|
1092
|
+
return {
|
|
1093
|
+
r: parseInt(d.slice(0, 2), 16),
|
|
1094
|
+
g: parseInt(d.slice(2, 4), 16),
|
|
1095
|
+
b: parseInt(d.slice(4, 6), 16),
|
|
1096
|
+
a: parseInt(d.slice(6, 8), 16) / 255
|
|
1097
|
+
};
|
|
1098
|
+
}
|
|
1099
|
+
if (h) {
|
|
1100
|
+
const d = parseInt(h[1], 16);
|
|
1101
|
+
return { r: d >> 16 & 255, g: d >> 8 & 255, b: d & 255, a: 1 };
|
|
1102
|
+
}
|
|
1103
|
+
return { r: 0, g: 0, b: 0, a: 1 };
|
|
1104
|
+
}
|
|
1105
|
+
function rn(l, h, t, d, i) {
|
|
1106
|
+
const n = (y) => Math.max(0, Math.min(255, Math.round(y))).toString(16).padStart(2, "0"), a = `#${n(l)}${n(h)}${n(t)}`;
|
|
1107
|
+
return i ? `${a}${n(d * 255)}` : a;
|
|
1108
|
+
}
|
|
1109
|
+
const an = xe(
|
|
1110
|
+
({
|
|
1111
|
+
label: l,
|
|
1112
|
+
helperText: h,
|
|
1113
|
+
error: t,
|
|
1114
|
+
required: d,
|
|
1115
|
+
disabled: i,
|
|
1116
|
+
id: n,
|
|
1117
|
+
className: a,
|
|
1118
|
+
style: y,
|
|
1119
|
+
accessMode: u,
|
|
1120
|
+
displayStyle: o,
|
|
1121
|
+
value: f = "#3b82f6",
|
|
1122
|
+
onChange: D,
|
|
1123
|
+
presets: Q = We,
|
|
1124
|
+
showInput: m = !0,
|
|
1125
|
+
showRandom: w = !0,
|
|
1126
|
+
withAlpha: F = !1,
|
|
1127
|
+
showKeyboardHints: p,
|
|
1128
|
+
size: Y = "md",
|
|
1129
|
+
labelPlacement: E,
|
|
1130
|
+
errorPlacement: $,
|
|
1131
|
+
labelWidth: S,
|
|
1132
|
+
controlWidth: b,
|
|
1133
|
+
loading: R
|
|
1134
|
+
}, U) => {
|
|
1135
|
+
const x = we(u, n);
|
|
1136
|
+
if (x === "hidden")
|
|
1137
|
+
return null;
|
|
1138
|
+
(x === "disabled" || x === "readOnly") && (i = !0);
|
|
1139
|
+
const { t: M } = Fe(), T = Re(n);
|
|
1140
|
+
ye("input", o);
|
|
1141
|
+
const V = ee(() => {
|
|
1142
|
+
i || D?.(en());
|
|
1143
|
+
}, [i, D]), [I, j] = de(!1), [ae, ue] = de(null), ne = Se(null), X = Se(null);
|
|
1144
|
+
Te(() => {
|
|
1145
|
+
if (!I || !X.current)
|
|
1146
|
+
return;
|
|
1147
|
+
const k = () => {
|
|
1148
|
+
const _ = X.current?.getBoundingClientRect();
|
|
1149
|
+
if (!_)
|
|
1150
|
+
return;
|
|
1151
|
+
const q = 280, L = 360;
|
|
1152
|
+
let A = _.left, G = _.bottom + 6;
|
|
1153
|
+
A + q > window.innerWidth - 8 && (A = Math.max(8, window.innerWidth - q - 8)), G + L > window.innerHeight - 8 && (G = Math.max(8, _.top - L - 6)), ue({ left: A, top: G });
|
|
1154
|
+
};
|
|
1155
|
+
return k(), window.addEventListener("scroll", k, !0), window.addEventListener("resize", k), () => {
|
|
1156
|
+
window.removeEventListener("scroll", k, !0), window.removeEventListener("resize", k);
|
|
1157
|
+
};
|
|
1158
|
+
}, [I]), Ze(() => {
|
|
1159
|
+
if (!I)
|
|
1160
|
+
return;
|
|
1161
|
+
const k = (q) => {
|
|
1162
|
+
const L = q.target;
|
|
1163
|
+
ne.current?.contains(L) || X.current?.contains(L) || j(!1);
|
|
1164
|
+
}, _ = (q) => {
|
|
1165
|
+
q.key === "Escape" && j(!1);
|
|
1166
|
+
};
|
|
1167
|
+
return document.addEventListener("mousedown", k), document.addEventListener("keydown", _), () => {
|
|
1168
|
+
document.removeEventListener("mousedown", k), document.removeEventListener("keydown", _);
|
|
1169
|
+
};
|
|
1170
|
+
}, [I]);
|
|
1171
|
+
const P = oe(
|
|
1172
|
+
() => [
|
|
1173
|
+
{ key: "Enter", description: M("shortcuts.openPicker", "Open color picker") },
|
|
1174
|
+
{ key: "Arrow keys", description: M("shortcuts.navigatePresets", "Navigate presets") }
|
|
1175
|
+
],
|
|
1176
|
+
[M]
|
|
1177
|
+
);
|
|
1178
|
+
return /* @__PURE__ */ v(
|
|
1179
|
+
"div",
|
|
1180
|
+
{
|
|
1181
|
+
className: `nice-field nice-field--${Y} ${E === "left" ? "nice-field--label-left" : ""} ${R ? "nice-field--loading" : ""} ${a || ""}`,
|
|
1182
|
+
style: {
|
|
1183
|
+
...y,
|
|
1184
|
+
...S != null && {
|
|
1185
|
+
"--nice-field-label-width": typeof S == "number" ? `${S}px` : S
|
|
1186
|
+
},
|
|
1187
|
+
...b != null && {
|
|
1188
|
+
"--nice-field-control-width": typeof b == "number" ? `${b}px` : b
|
|
1189
|
+
}
|
|
1190
|
+
},
|
|
1191
|
+
"aria-busy": R || void 0,
|
|
1192
|
+
children: [
|
|
1193
|
+
l && /* @__PURE__ */ v(
|
|
1194
|
+
"label",
|
|
1195
|
+
{
|
|
1196
|
+
htmlFor: T,
|
|
1197
|
+
className: `nice-field__label ${d ? "nice-field__label--required" : ""}`,
|
|
1198
|
+
children: [
|
|
1199
|
+
l,
|
|
1200
|
+
p && /* @__PURE__ */ e(Ae, { shortcuts: P, size: "sm" })
|
|
1201
|
+
]
|
|
1202
|
+
}
|
|
1203
|
+
),
|
|
1204
|
+
/* @__PURE__ */ e("div", { className: "nice-field__control", children: /* @__PURE__ */ v("div", { className: "nice-color-picker", children: [
|
|
1205
|
+
/* @__PURE__ */ v("div", { className: "nice-color-picker__preview-row", children: [
|
|
1206
|
+
/* @__PURE__ */ e(
|
|
1207
|
+
"div",
|
|
1208
|
+
{
|
|
1209
|
+
ref: X,
|
|
1210
|
+
className: "nice-color-picker__swatch",
|
|
1211
|
+
id: T,
|
|
1212
|
+
style: { background: f },
|
|
1213
|
+
onClick: (k) => {
|
|
1214
|
+
k.stopPropagation(), i || j((_) => !_);
|
|
1215
|
+
},
|
|
1216
|
+
onKeyDown: (k) => {
|
|
1217
|
+
!i && (k.key === "Enter" || k.key === " ") && (k.preventDefault(), j((_) => !_));
|
|
1218
|
+
},
|
|
1219
|
+
role: "button",
|
|
1220
|
+
tabIndex: 0,
|
|
1221
|
+
"aria-label": M("colorPicker.openPalette", "Open color palette"),
|
|
1222
|
+
"aria-haspopup": "dialog",
|
|
1223
|
+
"aria-expanded": I,
|
|
1224
|
+
children: /* @__PURE__ */ e(
|
|
1225
|
+
"input",
|
|
1226
|
+
{
|
|
1227
|
+
ref: (k) => {
|
|
1228
|
+
typeof U == "function" ? U(k) : U && (U.current = k);
|
|
1229
|
+
},
|
|
1230
|
+
type: "hidden",
|
|
1231
|
+
value: f,
|
|
1232
|
+
disabled: i,
|
|
1233
|
+
readOnly: !0
|
|
1234
|
+
}
|
|
1235
|
+
)
|
|
1236
|
+
}
|
|
1237
|
+
),
|
|
1238
|
+
m && /* @__PURE__ */ e("div", { className: "nice-input nice-input--sm", style: { width: 100 }, children: /* @__PURE__ */ e(
|
|
1239
|
+
"input",
|
|
1240
|
+
{
|
|
1241
|
+
className: "nice-input__native",
|
|
1242
|
+
type: "text",
|
|
1243
|
+
value: f,
|
|
1244
|
+
disabled: i,
|
|
1245
|
+
onChange: (k) => D?.(k.target.value),
|
|
1246
|
+
maxLength: 7
|
|
1247
|
+
}
|
|
1248
|
+
) }),
|
|
1249
|
+
w && /* @__PURE__ */ e(
|
|
1250
|
+
"button",
|
|
1251
|
+
{
|
|
1252
|
+
type: "button",
|
|
1253
|
+
className: "nice-btn nice-btn--outline nice-btn--sm nice-color-picker__random",
|
|
1254
|
+
onClick: V,
|
|
1255
|
+
disabled: i,
|
|
1256
|
+
title: M("colorPicker.random", "Random"),
|
|
1257
|
+
"aria-label": M("colorPicker.random", "Random"),
|
|
1258
|
+
style: {
|
|
1259
|
+
fontSize: "0.65rem",
|
|
1260
|
+
textTransform: "uppercase",
|
|
1261
|
+
letterSpacing: "0.05em"
|
|
1262
|
+
},
|
|
1263
|
+
children: M("colorPicker.random", "Random")
|
|
1264
|
+
}
|
|
1265
|
+
),
|
|
1266
|
+
R && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
1267
|
+
$ === "right" && t && /* @__PURE__ */ e("div", { id: `${T}-error`, className: "nice-field__error", role: "alert", children: t }),
|
|
1268
|
+
$ === "right" && !t && h && /* @__PURE__ */ e("div", { id: `${T}-helper`, className: "nice-field__helper", children: h })
|
|
1269
|
+
] }),
|
|
1270
|
+
I && ae && typeof document < "u" && Qe.createPortal(
|
|
1271
|
+
/* @__PURE__ */ e(
|
|
1272
|
+
"div",
|
|
1273
|
+
{
|
|
1274
|
+
ref: ne,
|
|
1275
|
+
className: "nice-color-picker__popup nice-color-picker__popup--portal",
|
|
1276
|
+
role: "dialog",
|
|
1277
|
+
"aria-label": M("colorPicker.palette", "Color palette"),
|
|
1278
|
+
style: { position: "fixed", left: ae.left, top: ae.top },
|
|
1279
|
+
onClick: (k) => k.stopPropagation(),
|
|
1280
|
+
children: (() => {
|
|
1281
|
+
const k = sn(f), _ = { r: k.r, g: k.g, b: k.b }, q = F ? k.a : 1, L = nn(_.r, _.g, _.b), A = cn(_.r, _.g, _.b), G = (r, g, K, C = q) => D?.(rn(r, g, K, C, F)), se = (r, g, K) => G(r, g, K), ve = (r, g, K) => {
|
|
1282
|
+
const C = tn(r, g, K);
|
|
1283
|
+
G(C.r, C.g, C.b);
|
|
1284
|
+
}, O = (r, g, K) => {
|
|
1285
|
+
const C = ln(r, g, K);
|
|
1286
|
+
G(C.r, C.g, C.b);
|
|
1287
|
+
}, Z = (r) => G(_.r, _.g, _.b, r), re = (r) => {
|
|
1288
|
+
if (i)
|
|
1289
|
+
return;
|
|
1290
|
+
const g = r.currentTarget, K = (z) => {
|
|
1291
|
+
const J = g.getBoundingClientRect(), ge = Math.max(0, Math.min(J.width, z.clientX - J.left)), be = Math.max(0, Math.min(J.height, z.clientY - J.top)), pe = Math.round(ge / J.width * 100), Me = 100 - Math.round(be / J.height * 100);
|
|
1292
|
+
O(A.h, pe, Me);
|
|
1293
|
+
};
|
|
1294
|
+
K(r);
|
|
1295
|
+
const C = () => {
|
|
1296
|
+
document.removeEventListener("pointermove", K), document.removeEventListener("pointerup", C);
|
|
1297
|
+
};
|
|
1298
|
+
document.addEventListener("pointermove", K), document.addEventListener("pointerup", C);
|
|
1299
|
+
}, ie = `hsl(${A.h}, 100%, 50%)`;
|
|
1300
|
+
return /* @__PURE__ */ v(Ee, { children: [
|
|
1301
|
+
/* @__PURE__ */ e("div", { className: "nice-color-picker__popup-header", children: /* @__PURE__ */ e(
|
|
1302
|
+
"input",
|
|
1303
|
+
{
|
|
1304
|
+
type: "text",
|
|
1305
|
+
className: "nice-input__native nice-color-picker__popup-hex",
|
|
1306
|
+
value: f,
|
|
1307
|
+
disabled: i,
|
|
1308
|
+
onChange: (r) => D?.(r.target.value),
|
|
1309
|
+
maxLength: F ? 9 : 7,
|
|
1310
|
+
"aria-label": M("colorPicker.hexValue", "Hex value")
|
|
1311
|
+
}
|
|
1312
|
+
) }),
|
|
1313
|
+
/* @__PURE__ */ e(
|
|
1314
|
+
"input",
|
|
1315
|
+
{
|
|
1316
|
+
type: "range",
|
|
1317
|
+
min: 0,
|
|
1318
|
+
max: 360,
|
|
1319
|
+
value: A.h,
|
|
1320
|
+
disabled: i,
|
|
1321
|
+
onChange: (r) => O(Number(r.target.value), A.s, A.v),
|
|
1322
|
+
className: "nice-color-picker__hue-slider",
|
|
1323
|
+
"aria-label": M("colorPicker.hue", "Hue")
|
|
1324
|
+
}
|
|
1325
|
+
),
|
|
1326
|
+
/* @__PURE__ */ e(
|
|
1327
|
+
"div",
|
|
1328
|
+
{
|
|
1329
|
+
className: "nice-color-picker__sv",
|
|
1330
|
+
style: {
|
|
1331
|
+
background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${ie})`
|
|
1332
|
+
},
|
|
1333
|
+
onPointerDown: re,
|
|
1334
|
+
role: "application",
|
|
1335
|
+
"aria-label": M("colorPicker.svPalette", "Saturation/value palette"),
|
|
1336
|
+
children: /* @__PURE__ */ e(
|
|
1337
|
+
"span",
|
|
1338
|
+
{
|
|
1339
|
+
className: "nice-color-picker__sv-marker",
|
|
1340
|
+
style: { left: `${A.s}%`, top: `${100 - A.v}%` }
|
|
1341
|
+
}
|
|
1342
|
+
)
|
|
1343
|
+
}
|
|
1344
|
+
),
|
|
1345
|
+
/* @__PURE__ */ v("div", { className: "nice-color-picker__sliders", children: [
|
|
1346
|
+
/* @__PURE__ */ e("div", { className: "nice-color-picker__slider-col", children: ["h", "s", "l"].map((r) => {
|
|
1347
|
+
const g = r === "h" ? 360 : 100, K = L[r], C = (z) => ve(
|
|
1348
|
+
r === "h" ? z : L.h,
|
|
1349
|
+
r === "s" ? z : L.s,
|
|
1350
|
+
r === "l" ? z : L.l
|
|
1351
|
+
);
|
|
1352
|
+
return /* @__PURE__ */ v("div", { className: "nice-color-picker__slider-row", children: [
|
|
1353
|
+
/* @__PURE__ */ e("label", { className: "nice-color-picker__slider-label", children: r.toUpperCase() }),
|
|
1354
|
+
/* @__PURE__ */ e(
|
|
1355
|
+
"input",
|
|
1356
|
+
{
|
|
1357
|
+
type: "range",
|
|
1358
|
+
min: 0,
|
|
1359
|
+
max: g,
|
|
1360
|
+
value: K,
|
|
1361
|
+
disabled: i,
|
|
1362
|
+
onChange: (z) => C(Number(z.target.value))
|
|
1363
|
+
}
|
|
1364
|
+
),
|
|
1365
|
+
/* @__PURE__ */ e(
|
|
1366
|
+
"input",
|
|
1367
|
+
{
|
|
1368
|
+
type: "number",
|
|
1369
|
+
min: 0,
|
|
1370
|
+
max: g,
|
|
1371
|
+
value: K,
|
|
1372
|
+
disabled: i,
|
|
1373
|
+
onChange: (z) => C(Number(z.target.value) || 0),
|
|
1374
|
+
className: "nice-input__native nice-color-picker__slider-num"
|
|
1375
|
+
}
|
|
1376
|
+
)
|
|
1377
|
+
] }, r);
|
|
1378
|
+
}) }),
|
|
1379
|
+
/* @__PURE__ */ e("div", { className: "nice-color-picker__slider-col", children: ["r", "g", "b"].map((r) => {
|
|
1380
|
+
const g = _[r], K = (C) => se(
|
|
1381
|
+
r === "r" ? C : _.r,
|
|
1382
|
+
r === "g" ? C : _.g,
|
|
1383
|
+
r === "b" ? C : _.b
|
|
1384
|
+
);
|
|
1385
|
+
return /* @__PURE__ */ v("div", { className: "nice-color-picker__slider-row", children: [
|
|
1386
|
+
/* @__PURE__ */ e("label", { className: "nice-color-picker__slider-label", children: r.toUpperCase() }),
|
|
1387
|
+
/* @__PURE__ */ e(
|
|
1388
|
+
"input",
|
|
1389
|
+
{
|
|
1390
|
+
type: "range",
|
|
1391
|
+
min: 0,
|
|
1392
|
+
max: 255,
|
|
1393
|
+
value: g,
|
|
1394
|
+
disabled: i,
|
|
1395
|
+
onChange: (C) => K(Number(C.target.value))
|
|
1396
|
+
}
|
|
1397
|
+
),
|
|
1398
|
+
/* @__PURE__ */ e(
|
|
1399
|
+
"input",
|
|
1400
|
+
{
|
|
1401
|
+
type: "number",
|
|
1402
|
+
min: 0,
|
|
1403
|
+
max: 255,
|
|
1404
|
+
value: g,
|
|
1405
|
+
disabled: i,
|
|
1406
|
+
onChange: (C) => K(Number(C.target.value) || 0),
|
|
1407
|
+
className: "nice-input__native nice-color-picker__slider-num"
|
|
1408
|
+
}
|
|
1409
|
+
)
|
|
1410
|
+
] }, r);
|
|
1411
|
+
}) })
|
|
1412
|
+
] }),
|
|
1413
|
+
F && /* @__PURE__ */ v("div", { className: "nice-color-picker__alpha-row", children: [
|
|
1414
|
+
/* @__PURE__ */ e("label", { className: "nice-color-picker__slider-label", children: "A" }),
|
|
1415
|
+
/* @__PURE__ */ e(
|
|
1416
|
+
"input",
|
|
1417
|
+
{
|
|
1418
|
+
type: "range",
|
|
1419
|
+
min: 0,
|
|
1420
|
+
max: 100,
|
|
1421
|
+
value: Math.round(q * 100),
|
|
1422
|
+
disabled: i,
|
|
1423
|
+
onChange: (r) => Z(Number(r.target.value) / 100),
|
|
1424
|
+
className: "nice-color-picker__alpha-slider",
|
|
1425
|
+
style: {
|
|
1426
|
+
background: `linear-gradient(to right, transparent, rgb(${_.r},${_.g},${_.b}))`
|
|
1427
|
+
},
|
|
1428
|
+
"aria-label": M("colorPicker.alpha", "Alpha")
|
|
1429
|
+
}
|
|
1430
|
+
),
|
|
1431
|
+
/* @__PURE__ */ e(
|
|
1432
|
+
"input",
|
|
1433
|
+
{
|
|
1434
|
+
type: "number",
|
|
1435
|
+
min: 0,
|
|
1436
|
+
max: 100,
|
|
1437
|
+
value: Math.round(q * 100),
|
|
1438
|
+
disabled: i,
|
|
1439
|
+
onChange: (r) => Z((Number(r.target.value) || 0) / 100),
|
|
1440
|
+
className: "nice-input__native nice-color-picker__slider-num"
|
|
1441
|
+
}
|
|
1442
|
+
)
|
|
1443
|
+
] }),
|
|
1444
|
+
Q.length > 0 && /* @__PURE__ */ e("div", { className: "nice-color-picker__popup-presets", children: Q.map((r) => /* @__PURE__ */ e(
|
|
1445
|
+
"div",
|
|
1446
|
+
{
|
|
1447
|
+
className: `nice-color-picker__preset ${f === r ? "nice-color-picker__preset--active" : ""}`,
|
|
1448
|
+
style: { background: r },
|
|
1449
|
+
onClick: () => {
|
|
1450
|
+
D?.(r), j(!1);
|
|
1451
|
+
},
|
|
1452
|
+
role: "button",
|
|
1453
|
+
tabIndex: 0,
|
|
1454
|
+
"aria-label": r,
|
|
1455
|
+
onKeyDown: (g) => {
|
|
1456
|
+
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), D?.(r), j(!1));
|
|
1457
|
+
}
|
|
1458
|
+
},
|
|
1459
|
+
r
|
|
1460
|
+
)) })
|
|
1461
|
+
] });
|
|
1462
|
+
})()
|
|
1463
|
+
}
|
|
1464
|
+
),
|
|
1465
|
+
document.body
|
|
1466
|
+
)
|
|
1467
|
+
] }) }),
|
|
1468
|
+
$ !== "right" && t && /* @__PURE__ */ e("div", { id: `${T}-error`, className: "nice-field__error", role: "alert", children: t }),
|
|
1469
|
+
$ !== "right" && !t && h && /* @__PURE__ */ e("div", { id: `${T}-helper`, className: "nice-field__helper", children: h })
|
|
1470
|
+
]
|
|
1471
|
+
}
|
|
1472
|
+
);
|
|
1473
|
+
}
|
|
1474
|
+
);
|
|
1475
|
+
an.displayName = "NiceColorPicker";
|
|
1476
|
+
const on = xe(
|
|
1477
|
+
({
|
|
1478
|
+
children: l,
|
|
1479
|
+
variant: h = "primary",
|
|
1480
|
+
size: t = "md",
|
|
1481
|
+
type: d = "button",
|
|
1482
|
+
disabled: i,
|
|
1483
|
+
loading: n,
|
|
1484
|
+
fullWidth: a,
|
|
1485
|
+
onClick: y,
|
|
1486
|
+
leftIcon: u,
|
|
1487
|
+
rightIcon: o,
|
|
1488
|
+
error: f,
|
|
1489
|
+
errorPlacement: D = "bottom",
|
|
1490
|
+
className: Q,
|
|
1491
|
+
style: m,
|
|
1492
|
+
id: w,
|
|
1493
|
+
accessMode: F,
|
|
1494
|
+
displayStyle: p,
|
|
1495
|
+
...Y
|
|
1496
|
+
}, E) => {
|
|
1497
|
+
const $ = we(F, w);
|
|
1498
|
+
if ($ === "hidden")
|
|
1499
|
+
return null;
|
|
1500
|
+
($ === "disabled" || $ === "readOnly") && (i = !0);
|
|
1501
|
+
const S = Ie("button", p), b = ye("button", p), R = h !== "primary" ? (({ background: M, color: T, ...V }) => V)(
|
|
1502
|
+
S
|
|
1503
|
+
) : S, U = /* @__PURE__ */ v(
|
|
1504
|
+
"button",
|
|
1505
|
+
{
|
|
1506
|
+
ref: E,
|
|
1507
|
+
type: d,
|
|
1508
|
+
id: w,
|
|
1509
|
+
className: `nice-btn nice-btn--${h} nice-btn--${t} nice-btn--ds-${b} ${a ? "nice-btn--full-width" : ""} ${n ? "nice-btn--loading" : ""} ${f && !D ? "nice-btn--has-error" : ""} ${Q || ""}`,
|
|
1510
|
+
style: { ...R, ...m },
|
|
1511
|
+
disabled: i || n,
|
|
1512
|
+
"aria-busy": n || void 0,
|
|
1513
|
+
"aria-disabled": i || n || void 0,
|
|
1514
|
+
onClick: y,
|
|
1515
|
+
...Y,
|
|
1516
|
+
children: [
|
|
1517
|
+
n && /* @__PURE__ */ e(
|
|
1518
|
+
"svg",
|
|
1519
|
+
{
|
|
1520
|
+
className: "nice-btn__spinner",
|
|
1521
|
+
viewBox: "0 0 24 24",
|
|
1522
|
+
fill: "none",
|
|
1523
|
+
stroke: "currentColor",
|
|
1524
|
+
strokeWidth: "3",
|
|
1525
|
+
"aria-hidden": "true",
|
|
1526
|
+
children: /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10", strokeDasharray: "31.4 31.4", strokeLinecap: "round" })
|
|
1527
|
+
}
|
|
1528
|
+
),
|
|
1529
|
+
!n && u && /* @__PURE__ */ e("span", { "aria-hidden": "true", children: u }),
|
|
1530
|
+
!n && /* @__PURE__ */ e("span", { children: l }),
|
|
1531
|
+
n && /* @__PURE__ */ e("span", { style: { visibility: "hidden" }, "aria-hidden": "true", children: l }),
|
|
1532
|
+
!n && o && /* @__PURE__ */ e("span", { "aria-hidden": "true", children: o })
|
|
1533
|
+
]
|
|
1534
|
+
}
|
|
1535
|
+
);
|
|
1536
|
+
if (!f)
|
|
1537
|
+
return U;
|
|
1538
|
+
const x = /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: f });
|
|
1539
|
+
return D === "right" ? /* @__PURE__ */ v(
|
|
1540
|
+
"span",
|
|
1541
|
+
{
|
|
1542
|
+
className: `nice-btn-field nice-btn-field--right nice-field--${t}`,
|
|
1543
|
+
style: {
|
|
1544
|
+
display: "inline-flex",
|
|
1545
|
+
flexDirection: "row",
|
|
1546
|
+
alignItems: "center",
|
|
1547
|
+
gap: "8px",
|
|
1548
|
+
width: "fit-content"
|
|
1549
|
+
},
|
|
1550
|
+
children: [
|
|
1551
|
+
U,
|
|
1552
|
+
x
|
|
1553
|
+
]
|
|
1554
|
+
}
|
|
1555
|
+
) : /* @__PURE__ */ v(
|
|
1556
|
+
"span",
|
|
1557
|
+
{
|
|
1558
|
+
className: `nice-btn-field nice-btn-field--bottom nice-field--${t}`,
|
|
1559
|
+
style: {
|
|
1560
|
+
display: "inline-flex",
|
|
1561
|
+
flexDirection: "column",
|
|
1562
|
+
alignItems: "flex-start",
|
|
1563
|
+
gap: "4px",
|
|
1564
|
+
width: "fit-content"
|
|
1565
|
+
},
|
|
1566
|
+
children: [
|
|
1567
|
+
U,
|
|
1568
|
+
x
|
|
1569
|
+
]
|
|
1570
|
+
}
|
|
1571
|
+
);
|
|
1572
|
+
}
|
|
1573
|
+
);
|
|
1574
|
+
on.displayName = "NiceButton";
|
|
1575
|
+
const fn = ({
|
|
1576
|
+
tabs: l,
|
|
1577
|
+
activeTab: h,
|
|
1578
|
+
onChange: t,
|
|
1579
|
+
variant: d = "default",
|
|
1580
|
+
vertical: i,
|
|
1581
|
+
size: n = "md",
|
|
1582
|
+
className: a,
|
|
1583
|
+
style: y,
|
|
1584
|
+
displayStyle: u
|
|
1585
|
+
}) => {
|
|
1586
|
+
const o = Ie("tab", u), f = ye("tab", u), [D, Q] = de(h || l[0]?.id), m = h ?? D, w = ee(
|
|
1587
|
+
(p) => {
|
|
1588
|
+
Q(p), t?.(p);
|
|
1589
|
+
},
|
|
1590
|
+
[t]
|
|
1591
|
+
), F = l.find((p) => p.id === m)?.content;
|
|
1592
|
+
return /* @__PURE__ */ v(
|
|
1593
|
+
"div",
|
|
1594
|
+
{
|
|
1595
|
+
className: `nice-tabs nice-tabs--${n} nice-tabs--ds-${f} ${a || ""}`,
|
|
1596
|
+
style: { ...o, ...y, ...i ? { display: "flex", gap: 16 } : {} },
|
|
1597
|
+
children: [
|
|
1598
|
+
/* @__PURE__ */ e(
|
|
1599
|
+
"div",
|
|
1600
|
+
{
|
|
1601
|
+
className: `nice-tabs__list ${d !== "default" ? `nice-tabs__list--${d}` : ""} ${i ? "nice-tabs__list--vertical" : ""}`,
|
|
1602
|
+
role: "tablist",
|
|
1603
|
+
children: l.map((p) => /* @__PURE__ */ v(
|
|
1604
|
+
"button",
|
|
1605
|
+
{
|
|
1606
|
+
type: "button",
|
|
1607
|
+
role: "tab",
|
|
1608
|
+
"aria-selected": m === p.id,
|
|
1609
|
+
className: `nice-tabs__tab ${m === p.id ? "nice-tabs__tab--active" : ""} ${p.disabled ? "nice-tabs__tab--disabled" : ""}`,
|
|
1610
|
+
disabled: p.disabled,
|
|
1611
|
+
onClick: () => w(p.id),
|
|
1612
|
+
children: [
|
|
1613
|
+
p.icon,
|
|
1614
|
+
/* @__PURE__ */ e("span", { children: p.label }),
|
|
1615
|
+
p.badge !== void 0 && /* @__PURE__ */ e("span", { className: "nice-tabs__badge", children: p.badge })
|
|
1616
|
+
]
|
|
1617
|
+
},
|
|
1618
|
+
p.id
|
|
1619
|
+
))
|
|
1620
|
+
}
|
|
1621
|
+
),
|
|
1622
|
+
F && /* @__PURE__ */ e("div", { className: "nice-tabs__panel", role: "tabpanel", children: F })
|
|
1623
|
+
]
|
|
1624
|
+
}
|
|
1625
|
+
);
|
|
1626
|
+
};
|
|
1627
|
+
export {
|
|
1628
|
+
Pe as N,
|
|
1629
|
+
an as a,
|
|
1630
|
+
ze as b,
|
|
1631
|
+
Je as c,
|
|
1632
|
+
Ye as d,
|
|
1633
|
+
Oe as e,
|
|
1634
|
+
fn as f,
|
|
1635
|
+
on as g
|
|
1636
|
+
};
|