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