@nice2dev/ui 1.0.26 → 1.0.28
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 +11 -0
- package/dist/NiceConfirmDialog-BIppqGad.cjs +1 -0
- package/dist/NiceConfirmDialog-CtU3paTe.js +81 -0
- package/dist/NiceErrorBoundary-C9ZPRC1v.js +695 -0
- package/dist/NiceErrorBoundary-CNsxmX4m.cjs +1 -0
- package/dist/NiceForm-B-T7vnE3.cjs +382 -0
- package/dist/NiceForm-D3g3RUzs.js +5000 -0
- package/dist/NiceModal-Cg7Eo9Ig.cjs +1 -0
- package/dist/NiceModal-IHk7nfRN.js +95 -0
- package/dist/NiceModuleLifecyclePanel-BY3zmDOy.js +7582 -0
- package/dist/NiceModuleLifecyclePanel-Dmbqjb8W.cjs +1 -0
- package/dist/NicePagination-BAxcfqnE.js +171 -0
- package/dist/NicePagination-BONcK9M_.cjs +1 -0
- package/dist/NicePinCodeInput-BDR2PSoo.cjs +696 -0
- package/dist/NicePinCodeInput-xJwHHpeS.js +13102 -0
- package/dist/NiceSavedQueryPanel-CbE-wQLO.js +6893 -0
- package/dist/NiceSavedQueryPanel-DuE2wgV_.cjs +596 -0
- package/dist/NiceWindow--TIJTyxg.cjs +1 -0
- package/dist/NiceWindow-vqhh0tb_.js +1592 -0
- package/dist/charts-C877HM7d.js +4657 -0
- package/dist/charts-CjHdhW3E.cjs +761 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.mjs +1 -1
- package/dist/core-BbGBF3q0.js +25364 -0
- package/dist/core-DwOyxP1F.cjs +122 -0
- package/dist/data-branching-7B25ogCm.cjs +1 -0
- package/dist/data-branching-B_jX2zDY.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.mjs +1 -1
- package/dist/devops-DbKWJZmr.cjs +17 -0
- package/dist/devops-nYQjPDoH.js +7684 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.mjs +3 -3
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.mjs +15 -14
- package/dist/index-By5F3DMu.js +67607 -0
- package/dist/index-aAc_1dLg.cjs +5518 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +76 -5
- package/dist/index.mjs +986 -985
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +332 -5
- package/dist/navigation.mjs +4 -4
- package/dist/no-code-C4DPSqYz.cjs +332 -0
- package/dist/no-code-zo1dWOLX.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 +2 -2
- package/dist/pickerCommons-BRJZMI3n.cjs +1 -0
- package/dist/pickerCommons-DWhw7aWu.js +2043 -0
- package/dist/pickerCommons.css +1 -0
- package/dist/style.css +4 -4
- package/package.json +2 -2
|
@@ -0,0 +1,2043 @@
|
|
|
1
|
+
import { jsxs as b, jsx as e, Fragment as Re } from "react/jsx-runtime";
|
|
2
|
+
import { p as Me, Z as Te, G as Ae, F as Fe, H as $e, B as Ke, T as Ze, d as Ie, O as Pe, e as Be, N as Xe, Y as We, f as en, h as nn } from "./core-BbGBF3q0.js";
|
|
3
|
+
import Ve, { forwardRef as xe, useCallback as W, useMemo as oe, useState as re, useRef as De, useLayoutEffect as Ue, useEffect as Ye } from "react";
|
|
4
|
+
import cn from "react-dom";
|
|
5
|
+
import { F as tn } from "./vendor-DF586kuF.js";
|
|
6
|
+
const Oe = xe(
|
|
7
|
+
({
|
|
8
|
+
label: c,
|
|
9
|
+
helperText: a,
|
|
10
|
+
error: t,
|
|
11
|
+
required: l,
|
|
12
|
+
disabled: i,
|
|
13
|
+
readOnly: n,
|
|
14
|
+
size: f = "md",
|
|
15
|
+
name: _,
|
|
16
|
+
id: o,
|
|
17
|
+
className: u,
|
|
18
|
+
style: p,
|
|
19
|
+
accessMode: k,
|
|
20
|
+
displayStyle: P,
|
|
21
|
+
variant: h,
|
|
22
|
+
value: M,
|
|
23
|
+
defaultValue: D,
|
|
24
|
+
onChange: m,
|
|
25
|
+
onBlur: J,
|
|
26
|
+
onKeyDown: R,
|
|
27
|
+
placeholder: x,
|
|
28
|
+
type: L = "text",
|
|
29
|
+
maxLength: g,
|
|
30
|
+
prefix: T,
|
|
31
|
+
suffix: K,
|
|
32
|
+
clearable: A,
|
|
33
|
+
autoFocus: H,
|
|
34
|
+
submitOnEnter: w,
|
|
35
|
+
onSubmit: F,
|
|
36
|
+
showKeyboardHints: Z,
|
|
37
|
+
labelPlacement: E,
|
|
38
|
+
errorPlacement: O,
|
|
39
|
+
loading: ae,
|
|
40
|
+
labelWidth: le,
|
|
41
|
+
controlWidth: z,
|
|
42
|
+
displayMode: V,
|
|
43
|
+
...ue
|
|
44
|
+
}, N) => {
|
|
45
|
+
const y = Me(k, o), j = y === "hidden";
|
|
46
|
+
y === "disabled" && (i = !0), y === "readOnly" && (n = !0);
|
|
47
|
+
const { t: I } = Te(), S = Ae(o), ee = Fe("input", P), se = $e("input", P), pe = h === "filled" ? "filled" : h === "underlined" ? "underlined" : "", q = W(() => m?.(""), [m]), Y = Ke({ enabled: V, readOnly: n, disabled: i }), de = Ze({
|
|
48
|
+
enabled: w,
|
|
49
|
+
onSubmit: F
|
|
50
|
+
}), ie = W(
|
|
51
|
+
(v) => {
|
|
52
|
+
de(v), R?.(v);
|
|
53
|
+
},
|
|
54
|
+
[de, R]
|
|
55
|
+
), d = oe(() => {
|
|
56
|
+
const v = [];
|
|
57
|
+
return w && v.push({ key: "Enter", description: I("shortcuts.submit", "Submit") }), A && v.push({ key: "Escape", description: I("shortcuts.clear", "Clear") }), v;
|
|
58
|
+
}, [w, A, I]);
|
|
59
|
+
return j ? null : /* @__PURE__ */ b(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
className: `nice-field nice-field--${f} ${E === "left" ? "nice-field--label-left" : ""} ${E === "inside" ? "nice-field--label-inside" : ""} ${ae ? "nice-field--loading" : ""} ${u || ""}`,
|
|
63
|
+
style: {
|
|
64
|
+
...p,
|
|
65
|
+
...le != null && {
|
|
66
|
+
"--nice-field-label-width": typeof le == "number" ? `${le}px` : le
|
|
67
|
+
},
|
|
68
|
+
...z != null && {
|
|
69
|
+
"--nice-field-control-width": typeof z == "number" ? `${z}px` : z
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"aria-busy": ae || void 0,
|
|
73
|
+
"data-floating": E === "inside" && M ? "true" : void 0,
|
|
74
|
+
children: [
|
|
75
|
+
c && E !== "inside" && /* @__PURE__ */ b(
|
|
76
|
+
"label",
|
|
77
|
+
{
|
|
78
|
+
htmlFor: S,
|
|
79
|
+
className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
|
|
80
|
+
children: [
|
|
81
|
+
c,
|
|
82
|
+
Z && d.length > 0 && /* @__PURE__ */ e(Ie, { shortcuts: d, size: "sm" })
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ b("div", { className: "nice-field__control", children: [
|
|
87
|
+
Y.isDisplay ? /* @__PURE__ */ e(
|
|
88
|
+
Pe,
|
|
89
|
+
{
|
|
90
|
+
value: M ?? D ?? "",
|
|
91
|
+
placeholder: x,
|
|
92
|
+
disabled: i,
|
|
93
|
+
readOnly: n,
|
|
94
|
+
onActivate: Y.enterEdit,
|
|
95
|
+
ariaLabel: c
|
|
96
|
+
}
|
|
97
|
+
) : /* @__PURE__ */ b(
|
|
98
|
+
"div",
|
|
99
|
+
{
|
|
100
|
+
className: `nice-input nice-input--${f} nice-input--ds-${pe || se} ${t ? "nice-input--error" : ""} ${i ? "nice-input--disabled" : ""} ${n ? "nice-input--readonly" : ""}`,
|
|
101
|
+
style: h ? void 0 : ee,
|
|
102
|
+
children: [
|
|
103
|
+
T && /* @__PURE__ */ e("span", { className: "nice-input__icon", children: T }),
|
|
104
|
+
/* @__PURE__ */ e(
|
|
105
|
+
"input",
|
|
106
|
+
{
|
|
107
|
+
ref: (v) => {
|
|
108
|
+
typeof N == "function" ? N(v) : N && (N.current = v), Y.autoFocusRef(v);
|
|
109
|
+
},
|
|
110
|
+
id: S,
|
|
111
|
+
className: "nice-input__native",
|
|
112
|
+
type: L,
|
|
113
|
+
name: _,
|
|
114
|
+
value: M,
|
|
115
|
+
defaultValue: D,
|
|
116
|
+
placeholder: x,
|
|
117
|
+
disabled: i || ae,
|
|
118
|
+
readOnly: n,
|
|
119
|
+
maxLength: g,
|
|
120
|
+
autoFocus: H,
|
|
121
|
+
"aria-invalid": !!t,
|
|
122
|
+
"aria-describedby": t ? `${S}-error` : a ? `${S}-helper` : void 0,
|
|
123
|
+
onChange: (v) => m?.(v.target.value),
|
|
124
|
+
onBlur: (v) => {
|
|
125
|
+
V && Y.exitEdit(), J?.(v);
|
|
126
|
+
},
|
|
127
|
+
onKeyDown: ie,
|
|
128
|
+
...ue
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
A && M && /* @__PURE__ */ e(
|
|
132
|
+
"button",
|
|
133
|
+
{
|
|
134
|
+
type: "button",
|
|
135
|
+
className: "nice-input__clear",
|
|
136
|
+
onClick: q,
|
|
137
|
+
"aria-label": I("controls.clear", "Clear"),
|
|
138
|
+
children: "✕"
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
K && /* @__PURE__ */ e("span", { className: "nice-input__icon", children: K }),
|
|
142
|
+
c && E === "inside" && /* @__PURE__ */ e(
|
|
143
|
+
"label",
|
|
144
|
+
{
|
|
145
|
+
htmlFor: S,
|
|
146
|
+
className: `nice-input__floating-label ${l ? "nice-input__floating-label--required" : ""}`,
|
|
147
|
+
children: c
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
ae && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
154
|
+
O === "right" && t && /* @__PURE__ */ e("div", { id: `${S}-error`, className: "nice-field__error", role: "alert", children: t }),
|
|
155
|
+
O === "right" && !t && a && /* @__PURE__ */ e("div", { id: `${S}-helper`, className: "nice-field__helper", children: a })
|
|
156
|
+
] }),
|
|
157
|
+
O !== "right" && t && /* @__PURE__ */ e("div", { id: `${S}-error`, className: "nice-field__error", role: "alert", children: t }),
|
|
158
|
+
O !== "right" && !t && a && /* @__PURE__ */ e("div", { id: `${S}-helper`, className: "nice-field__helper", children: a })
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
Oe.displayName = "NiceTextInput";
|
|
165
|
+
const xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
166
|
+
__proto__: null,
|
|
167
|
+
NiceTextInput: Oe
|
|
168
|
+
}, Symbol.toStringTag, { value: "Module" })), ze = xe(
|
|
169
|
+
({
|
|
170
|
+
label: c,
|
|
171
|
+
helperText: a,
|
|
172
|
+
error: t,
|
|
173
|
+
required: l,
|
|
174
|
+
disabled: i,
|
|
175
|
+
readOnly: n,
|
|
176
|
+
size: f = "md",
|
|
177
|
+
name: _,
|
|
178
|
+
id: o,
|
|
179
|
+
className: u,
|
|
180
|
+
style: p,
|
|
181
|
+
accessMode: k,
|
|
182
|
+
displayStyle: P,
|
|
183
|
+
value: h,
|
|
184
|
+
onChange: M,
|
|
185
|
+
onBlur: D,
|
|
186
|
+
onKeyDown: m,
|
|
187
|
+
placeholder: J,
|
|
188
|
+
min: R,
|
|
189
|
+
max: x,
|
|
190
|
+
step: L = 1,
|
|
191
|
+
precision: g,
|
|
192
|
+
prefix: T,
|
|
193
|
+
prefixType: K = "label",
|
|
194
|
+
prefixOptions: A,
|
|
195
|
+
prefixValue: H,
|
|
196
|
+
onPrefixChange: w,
|
|
197
|
+
suffix: F,
|
|
198
|
+
showStepper: Z = !0,
|
|
199
|
+
submitOnEnter: E,
|
|
200
|
+
onSubmit: O,
|
|
201
|
+
showKeyboardHints: ae,
|
|
202
|
+
labelPlacement: le,
|
|
203
|
+
errorPlacement: z,
|
|
204
|
+
loading: V,
|
|
205
|
+
labelWidth: ue,
|
|
206
|
+
controlWidth: N,
|
|
207
|
+
formatPreset: y,
|
|
208
|
+
format: j,
|
|
209
|
+
suffixType: I = "label",
|
|
210
|
+
suffixOptions: S,
|
|
211
|
+
suffixValue: ee,
|
|
212
|
+
onSuffixChange: se,
|
|
213
|
+
displayMode: pe
|
|
214
|
+
}, q) => {
|
|
215
|
+
const Y = Me(k, o), de = Y === "hidden";
|
|
216
|
+
Y === "disabled" && (i = !0), Y === "readOnly" && (n = !0);
|
|
217
|
+
const { t: ie } = Te(), d = Ae(o), v = Fe("input", P), U = $e("input", P), [C, Q] = re(!1), [X, ve] = re(null), Ne = Ke({ enabled: pe, readOnly: n, disabled: i }), he = oe(() => {
|
|
218
|
+
let s = 3;
|
|
219
|
+
return x != null && (s = String(Math.abs(Math.floor(x))).length), R != null && R < 0 && (s += 1), g && (s += g + 1), Math.max(3, s) + 1;
|
|
220
|
+
}, [x, R, g]), Se = W(
|
|
221
|
+
(s) => {
|
|
222
|
+
if (j)
|
|
223
|
+
return j(s);
|
|
224
|
+
if (!y)
|
|
225
|
+
return g != null ? s.toFixed(g) : String(s);
|
|
226
|
+
switch (y) {
|
|
227
|
+
case "integer":
|
|
228
|
+
return Math.round(s).toLocaleString();
|
|
229
|
+
case "decimal":
|
|
230
|
+
return s.toLocaleString(void 0, {
|
|
231
|
+
minimumFractionDigits: g ?? 2,
|
|
232
|
+
maximumFractionDigits: g ?? 2
|
|
233
|
+
});
|
|
234
|
+
case "money":
|
|
235
|
+
return s.toLocaleString(void 0, {
|
|
236
|
+
minimumFractionDigits: g ?? 2,
|
|
237
|
+
maximumFractionDigits: g ?? 2,
|
|
238
|
+
useGrouping: !0
|
|
239
|
+
});
|
|
240
|
+
case "percent":
|
|
241
|
+
return (s * 100).toLocaleString(void 0, {
|
|
242
|
+
minimumFractionDigits: g ?? 0,
|
|
243
|
+
maximumFractionDigits: g ?? 2
|
|
244
|
+
}) + "%";
|
|
245
|
+
default:
|
|
246
|
+
return String(s);
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
[j, y, g]
|
|
250
|
+
), Ce = oe(() => C && X !== null ? X : h == null ? "" : C ? g != null ? h.toFixed(g) : String(h) : Se(h), [h, C, X, Se, g]), me = h != null && h < 0, ce = !!(T || K === "select" && A && A.length > 0), ne = me && ce && !C, He = ne ? Ce.replace(/^[-−]/, "") : Ce, _e = W(
|
|
251
|
+
(s) => {
|
|
252
|
+
let $ = s;
|
|
253
|
+
return R !== void 0 && ($ = Math.max(R, $)), x !== void 0 && ($ = Math.min(x, $)), g !== void 0 && ($ = parseFloat($.toFixed(g))), $;
|
|
254
|
+
},
|
|
255
|
+
[R, x, g]
|
|
256
|
+
), Ge = W(
|
|
257
|
+
(s) => {
|
|
258
|
+
const $ = s.target.value;
|
|
259
|
+
if (ve($), $ === "" || $ === "-" || $ === "." || $ === "-.") {
|
|
260
|
+
$ === "" && M?.(null);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
const fe = parseFloat($);
|
|
264
|
+
if (!isNaN(fe)) {
|
|
265
|
+
let ge = fe;
|
|
266
|
+
R !== void 0 && (ge = Math.max(R, ge)), x !== void 0 && (ge = Math.min(x, ge)), M?.(ge);
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
[M, R, x]
|
|
270
|
+
), ye = W(() => {
|
|
271
|
+
const s = ke.current, $ = _e((s ?? 0) + L);
|
|
272
|
+
ke.current = $, M?.($);
|
|
273
|
+
}, [L, M, _e]), Le = W(() => {
|
|
274
|
+
const s = ke.current, $ = _e((s ?? 0) - L);
|
|
275
|
+
ke.current = $, M?.($);
|
|
276
|
+
}, [L, M, _e]), ke = De(h);
|
|
277
|
+
ke.current = h;
|
|
278
|
+
const r = De(null), B = W(() => {
|
|
279
|
+
r.current && (clearTimeout(r.current), r.current = null);
|
|
280
|
+
}, []), G = W(
|
|
281
|
+
(s) => {
|
|
282
|
+
B();
|
|
283
|
+
let $ = 300;
|
|
284
|
+
const fe = () => {
|
|
285
|
+
s(), $ = Math.max(30, $ * 0.82), r.current = setTimeout(fe, $);
|
|
286
|
+
};
|
|
287
|
+
r.current = setTimeout(fe, 400);
|
|
288
|
+
},
|
|
289
|
+
[B]
|
|
290
|
+
), be = Ze({
|
|
291
|
+
enabled: E,
|
|
292
|
+
onSubmit: O
|
|
293
|
+
}), Ee = W(
|
|
294
|
+
(s) => {
|
|
295
|
+
be(s), s.key === "ArrowUp" ? (s.preventDefault(), ye()) : s.key === "ArrowDown" && (s.preventDefault(), Le()), m?.(s);
|
|
296
|
+
},
|
|
297
|
+
[be, m, ye, Le]
|
|
298
|
+
), te = oe(() => {
|
|
299
|
+
const s = [];
|
|
300
|
+
return E && s.push(Be.submit), Z && (s.push({ key: "ArrowUp", description: ie("shortcuts.increment", "Increase value") }), s.push({ key: "ArrowDown", description: ie("shortcuts.decrement", "Decrease value") })), s;
|
|
301
|
+
}, [E, Z, ie]);
|
|
302
|
+
return de ? null : /* @__PURE__ */ b(
|
|
303
|
+
"div",
|
|
304
|
+
{
|
|
305
|
+
className: `nice-field nice-field--${f} ${le === "left" ? "nice-field--label-left" : ""} ${V ? "nice-field--loading" : ""} ${u || ""}`,
|
|
306
|
+
style: {
|
|
307
|
+
...p,
|
|
308
|
+
...ue != null && {
|
|
309
|
+
"--nice-field-label-width": typeof ue == "number" ? `${ue}px` : ue
|
|
310
|
+
},
|
|
311
|
+
...N != null && {
|
|
312
|
+
"--nice-field-control-width": typeof N == "number" ? `${N}px` : N
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
"aria-busy": V || void 0,
|
|
316
|
+
children: [
|
|
317
|
+
c && /* @__PURE__ */ b(
|
|
318
|
+
"label",
|
|
319
|
+
{
|
|
320
|
+
htmlFor: d,
|
|
321
|
+
className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
|
|
322
|
+
children: [
|
|
323
|
+
c,
|
|
324
|
+
ae && te.length > 0 && /* @__PURE__ */ e(Ie, { shortcuts: te, size: "sm" })
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
),
|
|
328
|
+
/* @__PURE__ */ b("div", { className: "nice-field__control", children: [
|
|
329
|
+
Ne.isDisplay ? /* @__PURE__ */ e(
|
|
330
|
+
Pe,
|
|
331
|
+
{
|
|
332
|
+
value: h == null ? "" : T ? /* @__PURE__ */ b(Re, { children: [
|
|
333
|
+
T,
|
|
334
|
+
Ce
|
|
335
|
+
] }) : Ce,
|
|
336
|
+
placeholder: J,
|
|
337
|
+
disabled: i,
|
|
338
|
+
readOnly: n,
|
|
339
|
+
onActivate: Ne.enterEdit,
|
|
340
|
+
ariaLabel: c
|
|
341
|
+
}
|
|
342
|
+
) : /* @__PURE__ */ e(Re, { children: /* @__PURE__ */ b(
|
|
343
|
+
"div",
|
|
344
|
+
{
|
|
345
|
+
className: `nice-input nice-input--number nice-input--${f} nice-input--ds-${U} ${t ? "nice-input--error" : ""} ${i ? "nice-input--disabled" : ""} ${n ? "nice-input--readonly" : ""}`,
|
|
346
|
+
style: v,
|
|
347
|
+
children: [
|
|
348
|
+
Z && !n && /* @__PURE__ */ e(
|
|
349
|
+
"button",
|
|
350
|
+
{
|
|
351
|
+
type: "button",
|
|
352
|
+
className: "nice-input__clear nice-input__minus",
|
|
353
|
+
onClick: Le,
|
|
354
|
+
onMouseDown: () => G(Le),
|
|
355
|
+
onMouseUp: B,
|
|
356
|
+
onMouseLeave: B,
|
|
357
|
+
disabled: i,
|
|
358
|
+
"aria-label": ie("controls.decrement", "Decrement"),
|
|
359
|
+
children: "−"
|
|
360
|
+
}
|
|
361
|
+
),
|
|
362
|
+
K === "select" && A && A.length > 0 ? /* @__PURE__ */ b(Re, { children: [
|
|
363
|
+
ne && /* @__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: H ?? A[0]?.value,
|
|
369
|
+
disabled: i,
|
|
370
|
+
onChange: (s) => {
|
|
371
|
+
const $ = s.target.value, fe = A.find(
|
|
372
|
+
(we) => we.value === (H ?? A[0]?.value)
|
|
373
|
+
), ge = A.find((we) => we.value === $);
|
|
374
|
+
w?.($, fe?.weight, ge?.weight);
|
|
375
|
+
},
|
|
376
|
+
children: A.map((s) => /* @__PURE__ */ e("option", { value: s.value, children: s.label }, s.value))
|
|
377
|
+
}
|
|
378
|
+
)
|
|
379
|
+
] }) : T ? /* @__PURE__ */ b("span", { className: "nice-input__icon nice-input__icon--prefix", children: [
|
|
380
|
+
ne && /* @__PURE__ */ e("span", { className: "nice-input__sign", children: "−" }),
|
|
381
|
+
T
|
|
382
|
+
] }) : null,
|
|
383
|
+
/* @__PURE__ */ e(
|
|
384
|
+
"input",
|
|
385
|
+
{
|
|
386
|
+
ref: (s) => {
|
|
387
|
+
typeof q == "function" ? q(s) : q && (q.current = s), Ne.autoFocusRef(s);
|
|
388
|
+
},
|
|
389
|
+
id: d,
|
|
390
|
+
className: "nice-input__native",
|
|
391
|
+
type: !C && (j || y) ? "text" : "number",
|
|
392
|
+
name: _,
|
|
393
|
+
value: He,
|
|
394
|
+
placeholder: J,
|
|
395
|
+
min: R,
|
|
396
|
+
max: x,
|
|
397
|
+
step: L,
|
|
398
|
+
disabled: i || V,
|
|
399
|
+
readOnly: n,
|
|
400
|
+
"aria-invalid": !!t,
|
|
401
|
+
onChange: Ge,
|
|
402
|
+
onFocus: (s) => {
|
|
403
|
+
Q(!0), ve(null), s.target.select();
|
|
404
|
+
},
|
|
405
|
+
onBlur: (s) => {
|
|
406
|
+
if (Q(!1), ve(null), h != null && g !== void 0) {
|
|
407
|
+
const $ = parseFloat(h.toFixed(g));
|
|
408
|
+
$ !== h && M?.($);
|
|
409
|
+
}
|
|
410
|
+
pe && Ne.exitEdit(), D?.(s);
|
|
411
|
+
},
|
|
412
|
+
onKeyDown: Ee,
|
|
413
|
+
style: { width: `${he}ch` }
|
|
414
|
+
}
|
|
415
|
+
),
|
|
416
|
+
I === "select" && S && S.length > 0 ? /* @__PURE__ */ e(
|
|
417
|
+
"select",
|
|
418
|
+
{
|
|
419
|
+
className: "nice-input__suffix-select nice-input__icon--suffix",
|
|
420
|
+
value: ee ?? S[0]?.value,
|
|
421
|
+
disabled: i,
|
|
422
|
+
onChange: (s) => {
|
|
423
|
+
const $ = s.target.value, fe = S.find(
|
|
424
|
+
(we) => we.value === (ee ?? S[0]?.value)
|
|
425
|
+
), ge = S.find((we) => we.value === $);
|
|
426
|
+
se?.($, fe?.weight, ge?.weight);
|
|
427
|
+
},
|
|
428
|
+
children: S.map((s) => /* @__PURE__ */ e("option", { value: s.value, children: s.label }, s.value))
|
|
429
|
+
}
|
|
430
|
+
) : F ? /* @__PURE__ */ e("span", { className: "nice-input__icon nice-input__icon--suffix", children: F }) : null,
|
|
431
|
+
Z && !n && /* @__PURE__ */ e(
|
|
432
|
+
"button",
|
|
433
|
+
{
|
|
434
|
+
type: "button",
|
|
435
|
+
className: "nice-input__clear nice-input__plus",
|
|
436
|
+
onClick: ye,
|
|
437
|
+
onMouseDown: () => G(ye),
|
|
438
|
+
onMouseUp: B,
|
|
439
|
+
onMouseLeave: B,
|
|
440
|
+
disabled: i,
|
|
441
|
+
"aria-label": ie("controls.increment", "Increment"),
|
|
442
|
+
children: "+"
|
|
443
|
+
}
|
|
444
|
+
)
|
|
445
|
+
]
|
|
446
|
+
}
|
|
447
|
+
) }),
|
|
448
|
+
V && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
449
|
+
z === "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
|
|
450
|
+
z === "right" && !t && a && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: a })
|
|
451
|
+
] }),
|
|
452
|
+
z !== "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
|
|
453
|
+
z !== "right" && !t && a && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: a })
|
|
454
|
+
]
|
|
455
|
+
}
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
);
|
|
459
|
+
ze.displayName = "NiceNumberInput";
|
|
460
|
+
const Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
461
|
+
__proto__: null,
|
|
462
|
+
NiceNumberInput: ze
|
|
463
|
+
}, Symbol.toStringTag, { value: "Module" })), qe = xe(
|
|
464
|
+
({
|
|
465
|
+
label: c,
|
|
466
|
+
helperText: a,
|
|
467
|
+
error: t,
|
|
468
|
+
required: l,
|
|
469
|
+
disabled: i,
|
|
470
|
+
size: n = "md",
|
|
471
|
+
name: f,
|
|
472
|
+
id: _,
|
|
473
|
+
className: o,
|
|
474
|
+
style: u,
|
|
475
|
+
accessMode: p,
|
|
476
|
+
displayStyle: k,
|
|
477
|
+
options: P,
|
|
478
|
+
value: h,
|
|
479
|
+
onChange: M,
|
|
480
|
+
placeholder: D,
|
|
481
|
+
multiple: m = !1,
|
|
482
|
+
searchable: J = !1,
|
|
483
|
+
clearable: R = !1,
|
|
484
|
+
emptyText: x,
|
|
485
|
+
maxHeight: L = 240,
|
|
486
|
+
optionsSource: g,
|
|
487
|
+
valueField: T,
|
|
488
|
+
labelField: K,
|
|
489
|
+
virtualScroll: A,
|
|
490
|
+
optionHeight: H = 36,
|
|
491
|
+
onSearch: w,
|
|
492
|
+
loading: F,
|
|
493
|
+
renderOption: Z,
|
|
494
|
+
multipleAutosize: E = !1,
|
|
495
|
+
showKeyboardHints: O,
|
|
496
|
+
labelPlacement: ae,
|
|
497
|
+
errorPlacement: le,
|
|
498
|
+
labelWidth: z,
|
|
499
|
+
controlWidth: V,
|
|
500
|
+
displayMode: ue
|
|
501
|
+
}, N) => {
|
|
502
|
+
const y = Me(p, _), j = y === "hidden";
|
|
503
|
+
(y === "disabled" || y === "readOnly") && (i = !0);
|
|
504
|
+
const { t: I } = Te(), S = Fe("input", k), ee = $e("input", k), se = Ae(_), pe = Ke({ enabled: ue, disabled: i }), [q, Y] = re(!1), [de, ie] = re(""), [d, v] = re(-1), [U, C] = re(0), Q = De(null), X = De(null), [ve, Ne] = re(null);
|
|
505
|
+
Ue(() => {
|
|
506
|
+
!F && X.current && Ne(X.current.offsetWidth);
|
|
507
|
+
}, [F, h, k]);
|
|
508
|
+
const [he, Se] = re(null);
|
|
509
|
+
Ue(() => {
|
|
510
|
+
m && !E && X.current && he == null && Se(X.current.offsetWidth);
|
|
511
|
+
}, [m, E, he]);
|
|
512
|
+
const Ce = Xe(
|
|
513
|
+
g ?? null,
|
|
514
|
+
T ?? g?.keyField ?? "id",
|
|
515
|
+
K ?? "name"
|
|
516
|
+
), me = g ? Ce.options : (P ?? []).map(
|
|
517
|
+
(r) => typeof r == "string" ? { value: r, label: r } : r
|
|
518
|
+
);
|
|
519
|
+
We(Q, () => {
|
|
520
|
+
Y(!1), ie("");
|
|
521
|
+
});
|
|
522
|
+
const ce = oe(() => h ? Array.isArray(h) ? h : [h] : [], [h]), ne = oe(() => {
|
|
523
|
+
if (!de && !w || w)
|
|
524
|
+
return me;
|
|
525
|
+
const r = de.toLowerCase();
|
|
526
|
+
return me.filter(
|
|
527
|
+
(B) => B.label.toLowerCase().includes(r) || String(B.value).toLowerCase().includes(r)
|
|
528
|
+
);
|
|
529
|
+
}, [me, de, w]), He = oe(() => {
|
|
530
|
+
const r = /* @__PURE__ */ new Map();
|
|
531
|
+
for (const B of ne) {
|
|
532
|
+
const G = B.group || "";
|
|
533
|
+
r.has(G) || r.set(G, []), r.get(G).push(B);
|
|
534
|
+
}
|
|
535
|
+
return r;
|
|
536
|
+
}, [ne]), _e = W(
|
|
537
|
+
(r) => {
|
|
538
|
+
if (m) {
|
|
539
|
+
const B = ce.includes(r) ? ce.filter((G) => G !== r) : [...ce, r];
|
|
540
|
+
M?.(B);
|
|
541
|
+
} else
|
|
542
|
+
M?.(r), Y(!1), ie("");
|
|
543
|
+
},
|
|
544
|
+
[m, ce, M]
|
|
545
|
+
), Ge = W(
|
|
546
|
+
(r) => {
|
|
547
|
+
if (r.key === "Escape") {
|
|
548
|
+
Y(!1), ie("");
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
if (r.key === "Enter" || r.key === " ") {
|
|
552
|
+
if (!q) {
|
|
553
|
+
Y(!0), r.preventDefault();
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
d >= 0 && ne[d] && (_e(ne[d].value), r.preventDefault());
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
r.key === "ArrowDown" && (r.preventDefault(), v((B) => Math.min(B + 1, ne.length - 1))), r.key === "ArrowUp" && (r.preventDefault(), v((B) => Math.max(B - 1, 0)));
|
|
560
|
+
},
|
|
561
|
+
[q, d, ne, _e]
|
|
562
|
+
), ye = oe(() => ce.length === 0 ? null : m ? ce.map((r) => me.find((B) => B.value === r)?.label || r).join(", ") : me.find((r) => r.value === ce[0])?.label || ce[0], [ce, me, m]), Le = W(
|
|
563
|
+
(r) => {
|
|
564
|
+
r.stopPropagation(), M?.(m ? [] : "");
|
|
565
|
+
},
|
|
566
|
+
[M, m]
|
|
567
|
+
), ke = oe(
|
|
568
|
+
() => [
|
|
569
|
+
{ key: "Enter", description: I("shortcuts.select", "Select") },
|
|
570
|
+
{ key: "Space", description: I("shortcuts.openDropdown", "Open dropdown") },
|
|
571
|
+
Be.moveUp,
|
|
572
|
+
Be.moveDown,
|
|
573
|
+
Be.cancel
|
|
574
|
+
],
|
|
575
|
+
[I]
|
|
576
|
+
);
|
|
577
|
+
return j ? null : /* @__PURE__ */ b(
|
|
578
|
+
"div",
|
|
579
|
+
{
|
|
580
|
+
className: `nice-field ${V == null ? "nice-field--select-auto" : ""} nice-field--${n} ${ae === "left" ? "nice-field--label-left" : ""} ${F ? "nice-field--loading" : ""} ${o || ""}`,
|
|
581
|
+
style: {
|
|
582
|
+
...u,
|
|
583
|
+
...z != null && {
|
|
584
|
+
"--nice-field-label-width": typeof z == "number" ? `${z}px` : z
|
|
585
|
+
},
|
|
586
|
+
...V != null && {
|
|
587
|
+
"--nice-field-control-width": typeof V == "number" ? `${V}px` : V
|
|
588
|
+
},
|
|
589
|
+
...F && ve != null && { "--nice-select-locked-width": `${ve}px` }
|
|
590
|
+
},
|
|
591
|
+
"aria-busy": F || void 0,
|
|
592
|
+
children: [
|
|
593
|
+
c && /* @__PURE__ */ b(
|
|
594
|
+
"label",
|
|
595
|
+
{
|
|
596
|
+
htmlFor: se,
|
|
597
|
+
className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
|
|
598
|
+
children: [
|
|
599
|
+
c,
|
|
600
|
+
O && /* @__PURE__ */ e(Ie, { shortcuts: ke, size: "sm" })
|
|
601
|
+
]
|
|
602
|
+
}
|
|
603
|
+
),
|
|
604
|
+
/* @__PURE__ */ b("div", { className: "nice-field__control", children: [
|
|
605
|
+
pe.isDisplay ? /* @__PURE__ */ e(
|
|
606
|
+
Pe,
|
|
607
|
+
{
|
|
608
|
+
value: ye,
|
|
609
|
+
placeholder: D || I("controls.select", "Select..."),
|
|
610
|
+
disabled: i,
|
|
611
|
+
onActivate: () => {
|
|
612
|
+
pe.enterEdit(), Y(!0);
|
|
613
|
+
},
|
|
614
|
+
ariaLabel: c
|
|
615
|
+
}
|
|
616
|
+
) : /* @__PURE__ */ b("div", { className: "nice-select", ref: Q, children: [
|
|
617
|
+
/* @__PURE__ */ b(
|
|
618
|
+
"button",
|
|
619
|
+
{
|
|
620
|
+
ref: (r) => {
|
|
621
|
+
X.current = r, typeof N == "function" ? N(r) : N && (N.current = r);
|
|
622
|
+
},
|
|
623
|
+
type: "button",
|
|
624
|
+
id: se,
|
|
625
|
+
role: "combobox",
|
|
626
|
+
"aria-expanded": q,
|
|
627
|
+
"aria-haspopup": "listbox",
|
|
628
|
+
"aria-invalid": !!t,
|
|
629
|
+
className: `nice-select__trigger nice-select__trigger--${n} nice-select--ds-${ee} ${q ? "nice-select__trigger--open" : ""} ${t ? "nice-select__trigger--error" : ""} ${i ? "nice-select__trigger--disabled" : ""}`,
|
|
630
|
+
style: {
|
|
631
|
+
...S,
|
|
632
|
+
...m && !E && he != null ? {
|
|
633
|
+
width: he,
|
|
634
|
+
maxWidth: he,
|
|
635
|
+
overflow: "hidden"
|
|
636
|
+
} : {}
|
|
637
|
+
},
|
|
638
|
+
disabled: i,
|
|
639
|
+
onClick: () => Y(!q),
|
|
640
|
+
onKeyDown: Ge,
|
|
641
|
+
children: [
|
|
642
|
+
ye ? /* @__PURE__ */ e(
|
|
643
|
+
"span",
|
|
644
|
+
{
|
|
645
|
+
style: m && !E ? {
|
|
646
|
+
flex: 1,
|
|
647
|
+
minWidth: 0,
|
|
648
|
+
overflow: "hidden",
|
|
649
|
+
textOverflow: "ellipsis",
|
|
650
|
+
whiteSpace: "nowrap"
|
|
651
|
+
} : void 0,
|
|
652
|
+
children: ye
|
|
653
|
+
}
|
|
654
|
+
) : /* @__PURE__ */ e("span", { className: "nice-select__placeholder", children: D || I("controls.select", "Select...") }),
|
|
655
|
+
/* @__PURE__ */ b("span", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
656
|
+
R && ce.length > 0 && /* @__PURE__ */ e(
|
|
657
|
+
"span",
|
|
658
|
+
{
|
|
659
|
+
className: "nice-input__clear",
|
|
660
|
+
onClick: Le,
|
|
661
|
+
role: "button",
|
|
662
|
+
"aria-label": I("controls.clear", "Clear"),
|
|
663
|
+
children: "✕"
|
|
664
|
+
}
|
|
665
|
+
),
|
|
666
|
+
/* @__PURE__ */ e(
|
|
667
|
+
"svg",
|
|
668
|
+
{
|
|
669
|
+
className: `nice-select__chevron ${q ? "nice-select__chevron--open" : ""}`,
|
|
670
|
+
viewBox: "0 0 20 20",
|
|
671
|
+
fill: "currentColor",
|
|
672
|
+
children: /* @__PURE__ */ e(
|
|
673
|
+
"path",
|
|
674
|
+
{
|
|
675
|
+
fillRule: "evenodd",
|
|
676
|
+
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",
|
|
677
|
+
clipRule: "evenodd"
|
|
678
|
+
}
|
|
679
|
+
)
|
|
680
|
+
}
|
|
681
|
+
)
|
|
682
|
+
] })
|
|
683
|
+
]
|
|
684
|
+
}
|
|
685
|
+
),
|
|
686
|
+
q && /* @__PURE__ */ b(
|
|
687
|
+
"div",
|
|
688
|
+
{
|
|
689
|
+
className: "nice-select__dropdown",
|
|
690
|
+
role: "listbox",
|
|
691
|
+
style: { maxHeight: L },
|
|
692
|
+
onScroll: A ? (r) => C(r.currentTarget.scrollTop) : void 0,
|
|
693
|
+
children: [
|
|
694
|
+
(J || w) && /* @__PURE__ */ e("div", { className: "nice-select__search", children: /* @__PURE__ */ e(
|
|
695
|
+
"input",
|
|
696
|
+
{
|
|
697
|
+
type: "text",
|
|
698
|
+
value: de,
|
|
699
|
+
onChange: (r) => {
|
|
700
|
+
ie(r.target.value), v(0), w?.(r.target.value);
|
|
701
|
+
},
|
|
702
|
+
placeholder: I("controls.search", "Search..."),
|
|
703
|
+
autoFocus: !0
|
|
704
|
+
}
|
|
705
|
+
) }),
|
|
706
|
+
F && /* @__PURE__ */ e("div", { className: "nice-select__loading", children: /* @__PURE__ */ e(
|
|
707
|
+
"div",
|
|
708
|
+
{
|
|
709
|
+
className: "nice-spinner nice-spinner--sm",
|
|
710
|
+
style: { margin: "8px auto" }
|
|
711
|
+
}
|
|
712
|
+
) }),
|
|
713
|
+
!F && ne.length === 0 ? /* @__PURE__ */ e("div", { className: "nice-select__empty", children: x || I("controls.noResults", "No results found") }) : A && !Array.from(He.keys()).some((r) => r !== "") ? (() => {
|
|
714
|
+
const B = ne.length * H, G = Math.max(
|
|
715
|
+
0,
|
|
716
|
+
Math.floor(U / H) - 3
|
|
717
|
+
), be = Math.min(
|
|
718
|
+
ne.length,
|
|
719
|
+
Math.ceil((U + L) / H) + 3
|
|
720
|
+
), Ee = ne.slice(G, be);
|
|
721
|
+
return /* @__PURE__ */ e("div", { style: { height: B, position: "relative" }, children: Ee.map((te, s) => {
|
|
722
|
+
const $ = G + s, fe = ce.includes(te.value);
|
|
723
|
+
return /* @__PURE__ */ e(
|
|
724
|
+
"div",
|
|
725
|
+
{
|
|
726
|
+
role: "option",
|
|
727
|
+
"aria-selected": fe,
|
|
728
|
+
className: `nice-select__option ${fe ? "nice-select__option--selected" : ""} ${$ === d ? "nice-select__option--highlighted" : ""} ${te.disabled ? "nice-select__option--disabled" : ""}`,
|
|
729
|
+
style: {
|
|
730
|
+
position: "absolute",
|
|
731
|
+
top: $ * H,
|
|
732
|
+
left: 0,
|
|
733
|
+
right: 0,
|
|
734
|
+
height: H,
|
|
735
|
+
display: "flex",
|
|
736
|
+
alignItems: "center",
|
|
737
|
+
padding: "0 12px"
|
|
738
|
+
},
|
|
739
|
+
onClick: () => !te.disabled && _e(String(te.value)),
|
|
740
|
+
onMouseEnter: () => v($),
|
|
741
|
+
children: Z ? Z(te, fe) : /* @__PURE__ */ b(Re, { children: [
|
|
742
|
+
te.icon && /* @__PURE__ */ e("span", { children: te.icon }),
|
|
743
|
+
/* @__PURE__ */ b("div", { style: { flex: 1 }, children: [
|
|
744
|
+
/* @__PURE__ */ e("div", { children: te.label }),
|
|
745
|
+
te.description && /* @__PURE__ */ e("div", { className: "nice-select__option-desc", children: te.description })
|
|
746
|
+
] }),
|
|
747
|
+
fe && /* @__PURE__ */ e(
|
|
748
|
+
"svg",
|
|
749
|
+
{
|
|
750
|
+
className: "nice-select__option-check",
|
|
751
|
+
viewBox: "0 0 20 20",
|
|
752
|
+
fill: "currentColor",
|
|
753
|
+
children: /* @__PURE__ */ e(
|
|
754
|
+
"path",
|
|
755
|
+
{
|
|
756
|
+
fillRule: "evenodd",
|
|
757
|
+
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",
|
|
758
|
+
clipRule: "evenodd"
|
|
759
|
+
}
|
|
760
|
+
)
|
|
761
|
+
}
|
|
762
|
+
)
|
|
763
|
+
] })
|
|
764
|
+
},
|
|
765
|
+
te.value
|
|
766
|
+
);
|
|
767
|
+
}) });
|
|
768
|
+
})() : Array.from(He.entries()).map(([r, B]) => /* @__PURE__ */ b(Ve.Fragment, { children: [
|
|
769
|
+
r && /* @__PURE__ */ e("div", { className: "nice-select__group-label", children: r }),
|
|
770
|
+
B.map((G) => {
|
|
771
|
+
const be = ce.includes(G.value), Ee = ne.indexOf(G);
|
|
772
|
+
return /* @__PURE__ */ e(
|
|
773
|
+
"div",
|
|
774
|
+
{
|
|
775
|
+
role: "option",
|
|
776
|
+
"aria-selected": be,
|
|
777
|
+
className: `nice-select__option ${be ? "nice-select__option--selected" : ""} ${Ee === d ? "nice-select__option--highlighted" : ""} ${G.disabled ? "nice-select__option--disabled" : ""}`,
|
|
778
|
+
onClick: () => !G.disabled && _e(String(G.value)),
|
|
779
|
+
onMouseEnter: () => v(Ee),
|
|
780
|
+
children: Z ? Z(G, be) : /* @__PURE__ */ b(Re, { children: [
|
|
781
|
+
G.icon && /* @__PURE__ */ e("span", { children: G.icon }),
|
|
782
|
+
/* @__PURE__ */ b("div", { style: { flex: 1 }, children: [
|
|
783
|
+
/* @__PURE__ */ e("div", { children: G.label }),
|
|
784
|
+
G.description && /* @__PURE__ */ e("div", { className: "nice-select__option-desc", children: G.description })
|
|
785
|
+
] }),
|
|
786
|
+
be && /* @__PURE__ */ e(
|
|
787
|
+
"svg",
|
|
788
|
+
{
|
|
789
|
+
className: "nice-select__option-check",
|
|
790
|
+
viewBox: "0 0 20 20",
|
|
791
|
+
fill: "currentColor",
|
|
792
|
+
children: /* @__PURE__ */ e(
|
|
793
|
+
"path",
|
|
794
|
+
{
|
|
795
|
+
fillRule: "evenodd",
|
|
796
|
+
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",
|
|
797
|
+
clipRule: "evenodd"
|
|
798
|
+
}
|
|
799
|
+
)
|
|
800
|
+
}
|
|
801
|
+
)
|
|
802
|
+
] })
|
|
803
|
+
},
|
|
804
|
+
G.value
|
|
805
|
+
);
|
|
806
|
+
})
|
|
807
|
+
] }, r))
|
|
808
|
+
]
|
|
809
|
+
}
|
|
810
|
+
)
|
|
811
|
+
] }),
|
|
812
|
+
F && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
813
|
+
le === "right" && t && /* @__PURE__ */ e("div", { id: `${se}-error`, className: "nice-field__error", role: "alert", children: t }),
|
|
814
|
+
le === "right" && !t && a && /* @__PURE__ */ e("div", { id: `${se}-helper`, className: "nice-field__helper", children: a })
|
|
815
|
+
] }),
|
|
816
|
+
le !== "right" && t && /* @__PURE__ */ e("div", { id: `${se}-error`, className: "nice-field__error", role: "alert", children: t }),
|
|
817
|
+
le !== "right" && !t && a && /* @__PURE__ */ e("div", { id: `${se}-helper`, className: "nice-field__helper", children: a })
|
|
818
|
+
]
|
|
819
|
+
}
|
|
820
|
+
);
|
|
821
|
+
}
|
|
822
|
+
);
|
|
823
|
+
qe.displayName = "NiceSelect";
|
|
824
|
+
const Cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
825
|
+
__proto__: null,
|
|
826
|
+
NiceSelect: qe
|
|
827
|
+
}, Symbol.toStringTag, { value: "Module" })), Je = xe(
|
|
828
|
+
({
|
|
829
|
+
label: c,
|
|
830
|
+
checked: a = !1,
|
|
831
|
+
indeterminate: t = !1,
|
|
832
|
+
onChange: l,
|
|
833
|
+
disabled: i,
|
|
834
|
+
readOnly: n,
|
|
835
|
+
loading: f,
|
|
836
|
+
required: _,
|
|
837
|
+
size: o = "md",
|
|
838
|
+
name: u,
|
|
839
|
+
id: p,
|
|
840
|
+
className: k,
|
|
841
|
+
style: P,
|
|
842
|
+
error: h,
|
|
843
|
+
helperText: M,
|
|
844
|
+
accessMode: D,
|
|
845
|
+
displayStyle: m,
|
|
846
|
+
showKeyboardHints: J,
|
|
847
|
+
labelPlacement: R,
|
|
848
|
+
errorPlacement: x,
|
|
849
|
+
labelWidth: L,
|
|
850
|
+
controlWidth: g
|
|
851
|
+
}, T) => {
|
|
852
|
+
const K = Me(D, p), A = K === "hidden";
|
|
853
|
+
(K === "disabled" || K === "readOnly") && (i = !0);
|
|
854
|
+
const { t: H } = Te(), w = Ae(p);
|
|
855
|
+
$e("toggle", m);
|
|
856
|
+
const F = oe(
|
|
857
|
+
() => [{ key: "Space", description: H("shortcuts.toggle", "Toggle") }],
|
|
858
|
+
[H]
|
|
859
|
+
), Z = Ve.useCallback(
|
|
860
|
+
(E) => {
|
|
861
|
+
E && (E.indeterminate = t), typeof T == "function" ? T(E) : T && (T.current = E);
|
|
862
|
+
},
|
|
863
|
+
[t, T]
|
|
864
|
+
);
|
|
865
|
+
return A ? null : /* @__PURE__ */ b(
|
|
866
|
+
"div",
|
|
867
|
+
{
|
|
868
|
+
className: `nice-field nice-field--inline nice-field--${o} ${R === "left" ? "nice-field--label-left" : ""} ${x === "right" ? "nice-field--error-right" : ""} ${f ? "nice-field--loading" : ""} ${k || ""}`,
|
|
869
|
+
style: {
|
|
870
|
+
...P,
|
|
871
|
+
...L != null && {
|
|
872
|
+
"--nice-field-label-width": typeof L == "number" ? `${L}px` : L
|
|
873
|
+
},
|
|
874
|
+
...g != null && {
|
|
875
|
+
"--nice-field-control-width": typeof g == "number" ? `${g}px` : g
|
|
876
|
+
}
|
|
877
|
+
},
|
|
878
|
+
"aria-busy": f || void 0,
|
|
879
|
+
children: [
|
|
880
|
+
R === "left" && c && /* @__PURE__ */ e("span", { className: `nice-field__label ${_ ? "nice-field__label--required" : ""}`, children: c }),
|
|
881
|
+
/* @__PURE__ */ b("div", { className: "nice-field__control", children: [
|
|
882
|
+
/* @__PURE__ */ b(
|
|
883
|
+
"label",
|
|
884
|
+
{
|
|
885
|
+
className: `nice-checkbox ${o !== "md" ? `nice-checkbox--${o}` : ""} ${i || f ? "nice-checkbox--disabled" : ""}`,
|
|
886
|
+
htmlFor: w,
|
|
887
|
+
children: [
|
|
888
|
+
/* @__PURE__ */ e(
|
|
889
|
+
"input",
|
|
890
|
+
{
|
|
891
|
+
ref: Z,
|
|
892
|
+
id: w,
|
|
893
|
+
type: "checkbox",
|
|
894
|
+
className: "nice-checkbox__input",
|
|
895
|
+
name: u,
|
|
896
|
+
checked: a,
|
|
897
|
+
disabled: i || f,
|
|
898
|
+
readOnly: n,
|
|
899
|
+
"aria-invalid": !!h,
|
|
900
|
+
onChange: (E) => {
|
|
901
|
+
n || f || l?.(E.target.checked);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
),
|
|
905
|
+
/* @__PURE__ */ e("span", { className: "nice-checkbox__box", children: /* @__PURE__ */ e(
|
|
906
|
+
"svg",
|
|
907
|
+
{
|
|
908
|
+
viewBox: "0 0 12 12",
|
|
909
|
+
fill: "none",
|
|
910
|
+
stroke: "currentColor",
|
|
911
|
+
strokeWidth: "2",
|
|
912
|
+
strokeLinecap: "round",
|
|
913
|
+
strokeLinejoin: "round",
|
|
914
|
+
children: t ? /* @__PURE__ */ e("line", { x1: "2", y1: "6", x2: "10", y2: "6" }) : /* @__PURE__ */ e("polyline", { points: "2 6 5 9 10 3" })
|
|
915
|
+
}
|
|
916
|
+
) }),
|
|
917
|
+
R !== "left" && c && /* @__PURE__ */ e("span", { children: c }),
|
|
918
|
+
J && /* @__PURE__ */ e(Ie, { shortcuts: F, size: "sm" })
|
|
919
|
+
]
|
|
920
|
+
}
|
|
921
|
+
),
|
|
922
|
+
f && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
923
|
+
x === "right" && h && /* @__PURE__ */ e("div", { id: `${w}-error`, className: "nice-field__error", role: "alert", children: h }),
|
|
924
|
+
x === "right" && !h && M && /* @__PURE__ */ e("div", { id: `${w}-helper`, className: "nice-field__helper", children: M })
|
|
925
|
+
] }),
|
|
926
|
+
x !== "right" && h && /* @__PURE__ */ e("div", { id: `${w}-error`, className: "nice-field__error", role: "alert", children: h }),
|
|
927
|
+
x !== "right" && !h && M && /* @__PURE__ */ e("div", { id: `${w}-helper`, className: "nice-field__helper", children: M })
|
|
928
|
+
]
|
|
929
|
+
}
|
|
930
|
+
);
|
|
931
|
+
}
|
|
932
|
+
);
|
|
933
|
+
Je.displayName = "NiceCheckbox";
|
|
934
|
+
const Ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
935
|
+
__proto__: null,
|
|
936
|
+
NiceCheckbox: Je
|
|
937
|
+
}, Symbol.toStringTag, { value: "Module" })), fn = xe(
|
|
938
|
+
({
|
|
939
|
+
label: c,
|
|
940
|
+
checked: a = !1,
|
|
941
|
+
onChange: t,
|
|
942
|
+
disabled: l,
|
|
943
|
+
readOnly: i,
|
|
944
|
+
loading: n,
|
|
945
|
+
required: f,
|
|
946
|
+
size: _ = "md",
|
|
947
|
+
name: o,
|
|
948
|
+
id: u,
|
|
949
|
+
className: p,
|
|
950
|
+
style: k,
|
|
951
|
+
accessMode: P,
|
|
952
|
+
displayStyle: h,
|
|
953
|
+
showKeyboardHints: M,
|
|
954
|
+
error: D,
|
|
955
|
+
helperText: m,
|
|
956
|
+
labelPlacement: J,
|
|
957
|
+
errorPlacement: R,
|
|
958
|
+
labelWidth: x,
|
|
959
|
+
controlWidth: L
|
|
960
|
+
}, g) => {
|
|
961
|
+
const T = Me(P, u), K = T === "hidden";
|
|
962
|
+
(T === "disabled" || T === "readOnly") && (l = !0);
|
|
963
|
+
const { t: A } = Te(), H = Ae(u);
|
|
964
|
+
Fe("toggle", h);
|
|
965
|
+
const w = $e("toggle", h), F = oe(
|
|
966
|
+
() => [{ key: "Space", description: A("shortcuts.toggle", "Toggle on/off") }],
|
|
967
|
+
[A]
|
|
968
|
+
);
|
|
969
|
+
return K ? null : /* @__PURE__ */ b(
|
|
970
|
+
"div",
|
|
971
|
+
{
|
|
972
|
+
className: `nice-field nice-field--inline nice-field--${_} ${J === "left" ? "nice-field--label-left" : ""} ${n ? "nice-field--loading" : ""} ${p || ""}`,
|
|
973
|
+
style: {
|
|
974
|
+
...k,
|
|
975
|
+
...x != null && {
|
|
976
|
+
"--nice-field-label-width": typeof x == "number" ? `${x}px` : x
|
|
977
|
+
},
|
|
978
|
+
...L != null && {
|
|
979
|
+
"--nice-field-control-width": typeof L == "number" ? `${L}px` : L
|
|
980
|
+
}
|
|
981
|
+
},
|
|
982
|
+
"aria-busy": n || void 0,
|
|
983
|
+
children: [
|
|
984
|
+
J === "left" && c && /* @__PURE__ */ e("span", { className: `nice-field__label ${f ? "nice-field__label--required" : ""}`, children: c }),
|
|
985
|
+
/* @__PURE__ */ b("div", { className: "nice-field__control", children: [
|
|
986
|
+
/* @__PURE__ */ b(
|
|
987
|
+
"label",
|
|
988
|
+
{
|
|
989
|
+
className: `nice-toggle nice-toggle--ds-${w} ${_ !== "md" ? `nice-toggle--${_}` : ""} ${l || n ? "nice-toggle--disabled" : ""}`,
|
|
990
|
+
htmlFor: H,
|
|
991
|
+
children: [
|
|
992
|
+
/* @__PURE__ */ e(
|
|
993
|
+
"input",
|
|
994
|
+
{
|
|
995
|
+
ref: g,
|
|
996
|
+
id: H,
|
|
997
|
+
type: "checkbox",
|
|
998
|
+
className: "nice-toggle__input",
|
|
999
|
+
name: o,
|
|
1000
|
+
checked: a,
|
|
1001
|
+
disabled: l || n,
|
|
1002
|
+
readOnly: i,
|
|
1003
|
+
role: "switch",
|
|
1004
|
+
"aria-checked": a,
|
|
1005
|
+
"aria-invalid": !!D,
|
|
1006
|
+
onChange: (Z) => {
|
|
1007
|
+
i || n || t?.(Z.target.checked);
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
),
|
|
1011
|
+
/* @__PURE__ */ e("span", { className: "nice-toggle__track", children: /* @__PURE__ */ e("span", { className: "nice-toggle__thumb" }) }),
|
|
1012
|
+
J !== "left" && c && /* @__PURE__ */ e("span", { children: c }),
|
|
1013
|
+
M && /* @__PURE__ */ e(Ie, { shortcuts: F, size: "sm" })
|
|
1014
|
+
]
|
|
1015
|
+
}
|
|
1016
|
+
),
|
|
1017
|
+
n && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
1018
|
+
R === "right" && D && /* @__PURE__ */ e("div", { id: `${H}-error`, className: "nice-field__error", role: "alert", children: D }),
|
|
1019
|
+
R === "right" && !D && m && /* @__PURE__ */ e("div", { id: `${H}-helper`, className: "nice-field__helper", children: m })
|
|
1020
|
+
] }),
|
|
1021
|
+
R !== "right" && D && /* @__PURE__ */ e("div", { id: `${H}-error`, className: "nice-field__error", role: "alert", children: D }),
|
|
1022
|
+
R !== "right" && !D && m && /* @__PURE__ */ e("div", { id: `${H}-helper`, className: "nice-field__helper", children: m })
|
|
1023
|
+
]
|
|
1024
|
+
}
|
|
1025
|
+
);
|
|
1026
|
+
}
|
|
1027
|
+
);
|
|
1028
|
+
fn.displayName = "NiceToggle";
|
|
1029
|
+
const ln = [
|
|
1030
|
+
"var(--nice-danger, #ef4444)",
|
|
1031
|
+
"var(--nice-warning, #f97316)",
|
|
1032
|
+
"var(--nice-warning, #f59e0b)",
|
|
1033
|
+
"var(--nice-success, #84cc16)",
|
|
1034
|
+
"var(--nice-success, #10b981)",
|
|
1035
|
+
"var(--nice-info, #06b6d4)",
|
|
1036
|
+
"var(--nice-primary, #3b82f6)",
|
|
1037
|
+
"var(--nice-info, #6366f1)",
|
|
1038
|
+
"var(--nice-accent, #8b5cf6)",
|
|
1039
|
+
"var(--nice-accent-pink, #ec4899)",
|
|
1040
|
+
"var(--nice-text-secondary, #64748b)",
|
|
1041
|
+
"var(--nice-text, #1e293b)"
|
|
1042
|
+
];
|
|
1043
|
+
function an() {
|
|
1044
|
+
return "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
|
|
1045
|
+
}
|
|
1046
|
+
function sn(c) {
|
|
1047
|
+
const a = /^#?([0-9a-f]{6})$/i.exec(c.trim());
|
|
1048
|
+
if (!a)
|
|
1049
|
+
return { r: 0, g: 0, b: 0 };
|
|
1050
|
+
const t = parseInt(a[1], 16);
|
|
1051
|
+
return { r: t >> 16 & 255, g: t >> 8 & 255, b: t & 255 };
|
|
1052
|
+
}
|
|
1053
|
+
function rn(c, a, t) {
|
|
1054
|
+
const l = (i) => Math.max(0, Math.min(255, Math.round(i))).toString(16).padStart(2, "0");
|
|
1055
|
+
return `#${l(c)}${l(a)}${l(t)}`;
|
|
1056
|
+
}
|
|
1057
|
+
function on(c, a, t) {
|
|
1058
|
+
const l = c / 255, i = a / 255, n = t / 255, f = Math.max(l, i, n), _ = Math.min(l, i, n), o = (f + _) / 2;
|
|
1059
|
+
let u = 0, p = 0;
|
|
1060
|
+
if (f !== _) {
|
|
1061
|
+
const k = f - _;
|
|
1062
|
+
switch (p = o > 0.5 ? k / (2 - f - _) : k / (f + _), f) {
|
|
1063
|
+
case l:
|
|
1064
|
+
u = (i - n) / k + (i < n ? 6 : 0);
|
|
1065
|
+
break;
|
|
1066
|
+
case i:
|
|
1067
|
+
u = (n - l) / k + 2;
|
|
1068
|
+
break;
|
|
1069
|
+
case n:
|
|
1070
|
+
u = (l - i) / k + 4;
|
|
1071
|
+
break;
|
|
1072
|
+
}
|
|
1073
|
+
u *= 60;
|
|
1074
|
+
}
|
|
1075
|
+
return { h: Math.round(u), s: Math.round(p * 100), l: Math.round(o * 100) };
|
|
1076
|
+
}
|
|
1077
|
+
function dn(c, a, t) {
|
|
1078
|
+
const l = a / 100, i = t / 100, n = (1 - Math.abs(2 * i - 1)) * l, f = n * (1 - Math.abs(c / 60 % 2 - 1)), _ = i - n / 2;
|
|
1079
|
+
let o = 0, u = 0, p = 0;
|
|
1080
|
+
return c < 60 ? [o, u, p] = [n, f, 0] : c < 120 ? [o, u, p] = [f, n, 0] : c < 180 ? [o, u, p] = [0, n, f] : c < 240 ? [o, u, p] = [0, f, n] : c < 300 ? [o, u, p] = [f, 0, n] : [o, u, p] = [n, 0, f], {
|
|
1081
|
+
r: Math.round((o + _) * 255),
|
|
1082
|
+
g: Math.round((u + _) * 255),
|
|
1083
|
+
b: Math.round((p + _) * 255)
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
function un(c, a, t) {
|
|
1087
|
+
const l = c / 255, i = a / 255, n = t / 255, f = Math.max(l, i, n), _ = Math.min(l, i, n), o = f - _;
|
|
1088
|
+
let u = 0;
|
|
1089
|
+
o !== 0 && (f === l ? u = (i - n) / o % 6 : f === i ? u = (n - l) / o + 2 : u = (l - i) / o + 4, u *= 60, u < 0 && (u += 360));
|
|
1090
|
+
const p = f === 0 ? 0 : o / f;
|
|
1091
|
+
return { h: Math.round(u), s: Math.round(p * 100), v: Math.round(f * 100) };
|
|
1092
|
+
}
|
|
1093
|
+
function pn(c, a, t) {
|
|
1094
|
+
const l = a / 100, i = t / 100, n = i * l, f = n * (1 - Math.abs(c / 60 % 2 - 1)), _ = i - n;
|
|
1095
|
+
let o = 0, u = 0, p = 0;
|
|
1096
|
+
return c < 60 ? [o, u, p] = [n, f, 0] : c < 120 ? [o, u, p] = [f, n, 0] : c < 180 ? [o, u, p] = [0, n, f] : c < 240 ? [o, u, p] = [0, f, n] : c < 300 ? [o, u, p] = [f, 0, n] : [o, u, p] = [n, 0, f], {
|
|
1097
|
+
r: Math.round((o + _) * 255),
|
|
1098
|
+
g: Math.round((u + _) * 255),
|
|
1099
|
+
b: Math.round((p + _) * 255)
|
|
1100
|
+
};
|
|
1101
|
+
}
|
|
1102
|
+
function hn(c) {
|
|
1103
|
+
const a = /^#?([0-9a-f]{6})$/i.exec(c.trim()), t = /^#?([0-9a-f]{8})$/i.exec(c.trim());
|
|
1104
|
+
if (t) {
|
|
1105
|
+
const l = t[1];
|
|
1106
|
+
return {
|
|
1107
|
+
r: parseInt(l.slice(0, 2), 16),
|
|
1108
|
+
g: parseInt(l.slice(2, 4), 16),
|
|
1109
|
+
b: parseInt(l.slice(4, 6), 16),
|
|
1110
|
+
a: parseInt(l.slice(6, 8), 16) / 255
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1113
|
+
if (a) {
|
|
1114
|
+
const l = parseInt(a[1], 16);
|
|
1115
|
+
return { r: l >> 16 & 255, g: l >> 8 & 255, b: l & 255, a: 1 };
|
|
1116
|
+
}
|
|
1117
|
+
return { r: 0, g: 0, b: 0, a: 1 };
|
|
1118
|
+
}
|
|
1119
|
+
function mn(c, a, t, l, i) {
|
|
1120
|
+
const n = (_) => Math.max(0, Math.min(255, Math.round(_))).toString(16).padStart(2, "0"), f = `#${n(c)}${n(a)}${n(t)}`;
|
|
1121
|
+
return i ? `${f}${n(l * 255)}` : f;
|
|
1122
|
+
}
|
|
1123
|
+
const Qe = xe(
|
|
1124
|
+
({
|
|
1125
|
+
label: c,
|
|
1126
|
+
helperText: a,
|
|
1127
|
+
error: t,
|
|
1128
|
+
required: l,
|
|
1129
|
+
disabled: i,
|
|
1130
|
+
id: n,
|
|
1131
|
+
className: f,
|
|
1132
|
+
style: _,
|
|
1133
|
+
accessMode: o,
|
|
1134
|
+
displayStyle: u,
|
|
1135
|
+
value: p = "var(--nice-primary, #3b82f6)",
|
|
1136
|
+
onChange: k,
|
|
1137
|
+
presets: P = ln,
|
|
1138
|
+
showInput: h = !0,
|
|
1139
|
+
showRandom: M = !0,
|
|
1140
|
+
withAlpha: D = !1,
|
|
1141
|
+
showKeyboardHints: m,
|
|
1142
|
+
size: J = "md",
|
|
1143
|
+
labelPlacement: R,
|
|
1144
|
+
errorPlacement: x,
|
|
1145
|
+
labelWidth: L,
|
|
1146
|
+
controlWidth: g,
|
|
1147
|
+
loading: T
|
|
1148
|
+
}, K) => {
|
|
1149
|
+
const A = Me(o, n), H = A === "hidden";
|
|
1150
|
+
(A === "disabled" || A === "readOnly") && (i = !0);
|
|
1151
|
+
const { t: w } = Te(), F = Ae(n);
|
|
1152
|
+
$e("input", u);
|
|
1153
|
+
const Z = W(() => {
|
|
1154
|
+
i || k?.(an());
|
|
1155
|
+
}, [i, k]), [E, O] = re(!1), [ae, le] = re(null), z = De(null), V = De(null);
|
|
1156
|
+
Ue(() => {
|
|
1157
|
+
if (!E || !V.current)
|
|
1158
|
+
return;
|
|
1159
|
+
const N = () => {
|
|
1160
|
+
const y = V.current?.getBoundingClientRect();
|
|
1161
|
+
if (!y)
|
|
1162
|
+
return;
|
|
1163
|
+
const j = 280, I = 360;
|
|
1164
|
+
let S = y.left, ee = y.bottom + 6;
|
|
1165
|
+
S + j > window.innerWidth - 8 && (S = Math.max(8, window.innerWidth - j - 8)), ee + I > window.innerHeight - 8 && (ee = Math.max(8, y.top - I - 6)), le({ left: S, top: ee });
|
|
1166
|
+
};
|
|
1167
|
+
return N(), window.addEventListener("scroll", N, !0), window.addEventListener("resize", N), () => {
|
|
1168
|
+
window.removeEventListener("scroll", N, !0), window.removeEventListener("resize", N);
|
|
1169
|
+
};
|
|
1170
|
+
}, [E]), Ye(() => {
|
|
1171
|
+
if (!E)
|
|
1172
|
+
return;
|
|
1173
|
+
const N = (j) => {
|
|
1174
|
+
const I = j.target;
|
|
1175
|
+
z.current?.contains(I) || V.current?.contains(I) || O(!1);
|
|
1176
|
+
}, y = (j) => {
|
|
1177
|
+
j.key === "Escape" && O(!1);
|
|
1178
|
+
};
|
|
1179
|
+
return document.addEventListener("mousedown", N), document.addEventListener("keydown", y), () => {
|
|
1180
|
+
document.removeEventListener("mousedown", N), document.removeEventListener("keydown", y);
|
|
1181
|
+
};
|
|
1182
|
+
}, [E]);
|
|
1183
|
+
const ue = oe(
|
|
1184
|
+
() => [
|
|
1185
|
+
{ key: "Enter", description: w("shortcuts.openPicker", "Open color picker") },
|
|
1186
|
+
{ key: "Arrow keys", description: w("shortcuts.navigatePresets", "Navigate presets") }
|
|
1187
|
+
],
|
|
1188
|
+
[w]
|
|
1189
|
+
);
|
|
1190
|
+
return H ? null : /* @__PURE__ */ b(
|
|
1191
|
+
"div",
|
|
1192
|
+
{
|
|
1193
|
+
className: `nice-field nice-field--${J} ${R === "left" ? "nice-field--label-left" : ""} ${T ? "nice-field--loading" : ""} ${f || ""}`,
|
|
1194
|
+
style: {
|
|
1195
|
+
..._,
|
|
1196
|
+
...L != null && {
|
|
1197
|
+
"--nice-field-label-width": typeof L == "number" ? `${L}px` : L
|
|
1198
|
+
},
|
|
1199
|
+
...g != null && {
|
|
1200
|
+
"--nice-field-control-width": typeof g == "number" ? `${g}px` : g
|
|
1201
|
+
}
|
|
1202
|
+
},
|
|
1203
|
+
"aria-busy": T || void 0,
|
|
1204
|
+
children: [
|
|
1205
|
+
c && /* @__PURE__ */ b(
|
|
1206
|
+
"label",
|
|
1207
|
+
{
|
|
1208
|
+
htmlFor: F,
|
|
1209
|
+
className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
|
|
1210
|
+
children: [
|
|
1211
|
+
c,
|
|
1212
|
+
m && /* @__PURE__ */ e(Ie, { shortcuts: ue, size: "sm" })
|
|
1213
|
+
]
|
|
1214
|
+
}
|
|
1215
|
+
),
|
|
1216
|
+
/* @__PURE__ */ e("div", { className: "nice-field__control", children: /* @__PURE__ */ b("div", { className: "nice-color-picker", children: [
|
|
1217
|
+
/* @__PURE__ */ b("div", { className: "nice-color-picker__preview-row", children: [
|
|
1218
|
+
/* @__PURE__ */ e(
|
|
1219
|
+
"div",
|
|
1220
|
+
{
|
|
1221
|
+
ref: V,
|
|
1222
|
+
className: "nice-color-picker__swatch",
|
|
1223
|
+
id: F,
|
|
1224
|
+
style: { background: p },
|
|
1225
|
+
onClick: (N) => {
|
|
1226
|
+
N.stopPropagation(), i || O((y) => !y);
|
|
1227
|
+
},
|
|
1228
|
+
onKeyDown: (N) => {
|
|
1229
|
+
!i && (N.key === "Enter" || N.key === " ") && (N.preventDefault(), O((y) => !y));
|
|
1230
|
+
},
|
|
1231
|
+
role: "button",
|
|
1232
|
+
tabIndex: 0,
|
|
1233
|
+
"aria-label": w("colorPicker.openPalette", "Open color palette"),
|
|
1234
|
+
"aria-haspopup": "dialog",
|
|
1235
|
+
"aria-expanded": E,
|
|
1236
|
+
children: /* @__PURE__ */ e(
|
|
1237
|
+
"input",
|
|
1238
|
+
{
|
|
1239
|
+
ref: (N) => {
|
|
1240
|
+
typeof K == "function" ? K(N) : K && (K.current = N);
|
|
1241
|
+
},
|
|
1242
|
+
type: "hidden",
|
|
1243
|
+
value: p,
|
|
1244
|
+
disabled: i,
|
|
1245
|
+
readOnly: !0
|
|
1246
|
+
}
|
|
1247
|
+
)
|
|
1248
|
+
}
|
|
1249
|
+
),
|
|
1250
|
+
h && /* @__PURE__ */ e("div", { className: "nice-input nice-input--sm", style: { width: 100 }, children: /* @__PURE__ */ e(
|
|
1251
|
+
"input",
|
|
1252
|
+
{
|
|
1253
|
+
className: "nice-input__native",
|
|
1254
|
+
type: "text",
|
|
1255
|
+
value: p,
|
|
1256
|
+
disabled: i,
|
|
1257
|
+
onChange: (N) => k?.(N.target.value),
|
|
1258
|
+
maxLength: 7
|
|
1259
|
+
}
|
|
1260
|
+
) }),
|
|
1261
|
+
M && /* @__PURE__ */ e(
|
|
1262
|
+
"button",
|
|
1263
|
+
{
|
|
1264
|
+
type: "button",
|
|
1265
|
+
className: "nice-btn nice-btn--outline nice-btn--sm nice-color-picker__random",
|
|
1266
|
+
onClick: Z,
|
|
1267
|
+
disabled: i,
|
|
1268
|
+
title: w("colorPicker.random", "Random"),
|
|
1269
|
+
"aria-label": w("colorPicker.random", "Random"),
|
|
1270
|
+
style: {
|
|
1271
|
+
fontSize: "0.65rem",
|
|
1272
|
+
textTransform: "uppercase",
|
|
1273
|
+
letterSpacing: "0.05em"
|
|
1274
|
+
},
|
|
1275
|
+
children: w("colorPicker.random", "Random")
|
|
1276
|
+
}
|
|
1277
|
+
),
|
|
1278
|
+
T && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
1279
|
+
x === "right" && t && /* @__PURE__ */ e("div", { id: `${F}-error`, className: "nice-field__error", role: "alert", children: t }),
|
|
1280
|
+
x === "right" && !t && a && /* @__PURE__ */ e("div", { id: `${F}-helper`, className: "nice-field__helper", children: a })
|
|
1281
|
+
] }),
|
|
1282
|
+
E && ae && typeof document < "u" && cn.createPortal(
|
|
1283
|
+
/* @__PURE__ */ e(
|
|
1284
|
+
"div",
|
|
1285
|
+
{
|
|
1286
|
+
ref: z,
|
|
1287
|
+
className: "nice-color-picker__popup nice-color-picker__popup--portal",
|
|
1288
|
+
role: "dialog",
|
|
1289
|
+
"aria-label": w("colorPicker.palette", "Color palette"),
|
|
1290
|
+
style: { position: "fixed", left: ae.left, top: ae.top },
|
|
1291
|
+
onClick: (N) => N.stopPropagation(),
|
|
1292
|
+
children: (() => {
|
|
1293
|
+
const N = hn(p), y = { r: N.r, g: N.g, b: N.b }, j = D ? N.a : 1, I = on(y.r, y.g, y.b), S = un(y.r, y.g, y.b), ee = (d, v, U, C = j) => k?.(mn(d, v, U, C, D)), se = (d, v, U) => ee(d, v, U), pe = (d, v, U) => {
|
|
1294
|
+
const C = dn(d, v, U);
|
|
1295
|
+
ee(C.r, C.g, C.b);
|
|
1296
|
+
}, q = (d, v, U) => {
|
|
1297
|
+
const C = pn(d, v, U);
|
|
1298
|
+
ee(C.r, C.g, C.b);
|
|
1299
|
+
}, Y = (d) => ee(y.r, y.g, y.b, d), de = (d) => {
|
|
1300
|
+
if (i)
|
|
1301
|
+
return;
|
|
1302
|
+
const v = d.currentTarget, U = (Q) => {
|
|
1303
|
+
const X = v.getBoundingClientRect(), ve = Math.max(0, Math.min(X.width, Q.clientX - X.left)), Ne = Math.max(0, Math.min(X.height, Q.clientY - X.top)), he = Math.round(ve / X.width * 100), Se = 100 - Math.round(Ne / X.height * 100);
|
|
1304
|
+
q(S.h, he, Se);
|
|
1305
|
+
};
|
|
1306
|
+
U(d);
|
|
1307
|
+
const C = () => {
|
|
1308
|
+
document.removeEventListener("pointermove", U), document.removeEventListener("pointerup", C);
|
|
1309
|
+
};
|
|
1310
|
+
document.addEventListener("pointermove", U), document.addEventListener("pointerup", C);
|
|
1311
|
+
}, ie = `hsl(${S.h}, 100%, 50%)`;
|
|
1312
|
+
return /* @__PURE__ */ b(Re, { children: [
|
|
1313
|
+
/* @__PURE__ */ e("div", { className: "nice-color-picker__popup-header", children: /* @__PURE__ */ e(
|
|
1314
|
+
"input",
|
|
1315
|
+
{
|
|
1316
|
+
type: "text",
|
|
1317
|
+
className: "nice-input__native nice-color-picker__popup-hex",
|
|
1318
|
+
value: p,
|
|
1319
|
+
disabled: i,
|
|
1320
|
+
onChange: (d) => k?.(d.target.value),
|
|
1321
|
+
maxLength: D ? 9 : 7,
|
|
1322
|
+
"aria-label": w("colorPicker.hexValue", "Hex value")
|
|
1323
|
+
}
|
|
1324
|
+
) }),
|
|
1325
|
+
/* @__PURE__ */ e(
|
|
1326
|
+
"input",
|
|
1327
|
+
{
|
|
1328
|
+
type: "range",
|
|
1329
|
+
min: 0,
|
|
1330
|
+
max: 360,
|
|
1331
|
+
value: S.h,
|
|
1332
|
+
disabled: i,
|
|
1333
|
+
onChange: (d) => q(Number(d.target.value), S.s, S.v),
|
|
1334
|
+
className: "nice-color-picker__hue-slider",
|
|
1335
|
+
"aria-label": w("colorPicker.hue", "Hue")
|
|
1336
|
+
}
|
|
1337
|
+
),
|
|
1338
|
+
/* @__PURE__ */ e(
|
|
1339
|
+
"div",
|
|
1340
|
+
{
|
|
1341
|
+
className: "nice-color-picker__sv",
|
|
1342
|
+
style: {
|
|
1343
|
+
background: `linear-gradient(to top, var(--nice-text, #000), transparent), linear-gradient(to right, var(--nice-bg, #FFF), ${ie})`
|
|
1344
|
+
},
|
|
1345
|
+
onPointerDown: de,
|
|
1346
|
+
role: "application",
|
|
1347
|
+
"aria-label": w("colorPicker.svPalette", "Saturation/value palette"),
|
|
1348
|
+
children: /* @__PURE__ */ e(
|
|
1349
|
+
"span",
|
|
1350
|
+
{
|
|
1351
|
+
className: "nice-color-picker__sv-marker",
|
|
1352
|
+
style: { left: `${S.s}%`, top: `${100 - S.v}%` }
|
|
1353
|
+
}
|
|
1354
|
+
)
|
|
1355
|
+
}
|
|
1356
|
+
),
|
|
1357
|
+
/* @__PURE__ */ b("div", { className: "nice-color-picker__sliders", children: [
|
|
1358
|
+
/* @__PURE__ */ e("div", { className: "nice-color-picker__slider-col", children: ["h", "s", "l"].map((d) => {
|
|
1359
|
+
const v = d === "h" ? 360 : 100, U = I[d], C = (Q) => pe(
|
|
1360
|
+
d === "h" ? Q : I.h,
|
|
1361
|
+
d === "s" ? Q : I.s,
|
|
1362
|
+
d === "l" ? Q : I.l
|
|
1363
|
+
);
|
|
1364
|
+
return /* @__PURE__ */ b("div", { className: "nice-color-picker__slider-row", children: [
|
|
1365
|
+
/* @__PURE__ */ e("label", { className: "nice-color-picker__slider-label", children: d.toUpperCase() }),
|
|
1366
|
+
/* @__PURE__ */ e(
|
|
1367
|
+
"input",
|
|
1368
|
+
{
|
|
1369
|
+
type: "range",
|
|
1370
|
+
min: 0,
|
|
1371
|
+
max: v,
|
|
1372
|
+
value: U,
|
|
1373
|
+
disabled: i,
|
|
1374
|
+
onChange: (Q) => C(Number(Q.target.value))
|
|
1375
|
+
}
|
|
1376
|
+
),
|
|
1377
|
+
/* @__PURE__ */ e(
|
|
1378
|
+
"input",
|
|
1379
|
+
{
|
|
1380
|
+
type: "number",
|
|
1381
|
+
min: 0,
|
|
1382
|
+
max: v,
|
|
1383
|
+
value: U,
|
|
1384
|
+
disabled: i,
|
|
1385
|
+
onChange: (Q) => C(Number(Q.target.value) || 0),
|
|
1386
|
+
className: "nice-input__native nice-color-picker__slider-num"
|
|
1387
|
+
}
|
|
1388
|
+
)
|
|
1389
|
+
] }, d);
|
|
1390
|
+
}) }),
|
|
1391
|
+
/* @__PURE__ */ e("div", { className: "nice-color-picker__slider-col", children: ["r", "g", "b"].map((d) => {
|
|
1392
|
+
const v = y[d], U = (C) => se(
|
|
1393
|
+
d === "r" ? C : y.r,
|
|
1394
|
+
d === "g" ? C : y.g,
|
|
1395
|
+
d === "b" ? C : y.b
|
|
1396
|
+
);
|
|
1397
|
+
return /* @__PURE__ */ b("div", { className: "nice-color-picker__slider-row", children: [
|
|
1398
|
+
/* @__PURE__ */ e("label", { className: "nice-color-picker__slider-label", children: d.toUpperCase() }),
|
|
1399
|
+
/* @__PURE__ */ e(
|
|
1400
|
+
"input",
|
|
1401
|
+
{
|
|
1402
|
+
type: "range",
|
|
1403
|
+
min: 0,
|
|
1404
|
+
max: 255,
|
|
1405
|
+
value: v,
|
|
1406
|
+
disabled: i,
|
|
1407
|
+
onChange: (C) => U(Number(C.target.value))
|
|
1408
|
+
}
|
|
1409
|
+
),
|
|
1410
|
+
/* @__PURE__ */ e(
|
|
1411
|
+
"input",
|
|
1412
|
+
{
|
|
1413
|
+
type: "number",
|
|
1414
|
+
min: 0,
|
|
1415
|
+
max: 255,
|
|
1416
|
+
value: v,
|
|
1417
|
+
disabled: i,
|
|
1418
|
+
onChange: (C) => U(Number(C.target.value) || 0),
|
|
1419
|
+
className: "nice-input__native nice-color-picker__slider-num"
|
|
1420
|
+
}
|
|
1421
|
+
)
|
|
1422
|
+
] }, d);
|
|
1423
|
+
}) })
|
|
1424
|
+
] }),
|
|
1425
|
+
D && /* @__PURE__ */ b("div", { className: "nice-color-picker__alpha-row", children: [
|
|
1426
|
+
/* @__PURE__ */ e("label", { className: "nice-color-picker__slider-label", children: "A" }),
|
|
1427
|
+
/* @__PURE__ */ e(
|
|
1428
|
+
"input",
|
|
1429
|
+
{
|
|
1430
|
+
type: "range",
|
|
1431
|
+
min: 0,
|
|
1432
|
+
max: 100,
|
|
1433
|
+
value: Math.round(j * 100),
|
|
1434
|
+
disabled: i,
|
|
1435
|
+
onChange: (d) => Y(Number(d.target.value) / 100),
|
|
1436
|
+
className: "nice-color-picker__alpha-slider",
|
|
1437
|
+
style: {
|
|
1438
|
+
background: `linear-gradient(to right, transparent, rgb(${y.r},${y.g},${y.b}))`
|
|
1439
|
+
},
|
|
1440
|
+
"aria-label": w("colorPicker.alpha", "Alpha")
|
|
1441
|
+
}
|
|
1442
|
+
),
|
|
1443
|
+
/* @__PURE__ */ e(
|
|
1444
|
+
"input",
|
|
1445
|
+
{
|
|
1446
|
+
type: "number",
|
|
1447
|
+
min: 0,
|
|
1448
|
+
max: 100,
|
|
1449
|
+
value: Math.round(j * 100),
|
|
1450
|
+
disabled: i,
|
|
1451
|
+
onChange: (d) => Y((Number(d.target.value) || 0) / 100),
|
|
1452
|
+
className: "nice-input__native nice-color-picker__slider-num"
|
|
1453
|
+
}
|
|
1454
|
+
)
|
|
1455
|
+
] }),
|
|
1456
|
+
P.length > 0 && /* @__PURE__ */ e("div", { className: "nice-color-picker__popup-presets", children: P.map((d) => /* @__PURE__ */ e(
|
|
1457
|
+
"div",
|
|
1458
|
+
{
|
|
1459
|
+
className: `nice-color-picker__preset ${p === d ? "nice-color-picker__preset--active" : ""}`,
|
|
1460
|
+
style: { background: d },
|
|
1461
|
+
onClick: () => {
|
|
1462
|
+
k?.(d), O(!1);
|
|
1463
|
+
},
|
|
1464
|
+
role: "button",
|
|
1465
|
+
tabIndex: 0,
|
|
1466
|
+
"aria-label": d,
|
|
1467
|
+
onKeyDown: (v) => {
|
|
1468
|
+
(v.key === "Enter" || v.key === " ") && (v.preventDefault(), k?.(d), O(!1));
|
|
1469
|
+
}
|
|
1470
|
+
},
|
|
1471
|
+
d
|
|
1472
|
+
)) })
|
|
1473
|
+
] });
|
|
1474
|
+
})()
|
|
1475
|
+
}
|
|
1476
|
+
),
|
|
1477
|
+
document.body
|
|
1478
|
+
)
|
|
1479
|
+
] }) }),
|
|
1480
|
+
x !== "right" && t && /* @__PURE__ */ e("div", { id: `${F}-error`, className: "nice-field__error", role: "alert", children: t }),
|
|
1481
|
+
x !== "right" && !t && a && /* @__PURE__ */ e("div", { id: `${F}-helper`, className: "nice-field__helper", children: a })
|
|
1482
|
+
]
|
|
1483
|
+
}
|
|
1484
|
+
);
|
|
1485
|
+
}
|
|
1486
|
+
);
|
|
1487
|
+
Qe.displayName = "NiceColorPicker";
|
|
1488
|
+
const En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1489
|
+
__proto__: null,
|
|
1490
|
+
NiceColorPicker: Qe,
|
|
1491
|
+
hexToRgb: sn,
|
|
1492
|
+
rgbToHex: rn
|
|
1493
|
+
}, Symbol.toStringTag, { value: "Module" })), _n = xe(
|
|
1494
|
+
({
|
|
1495
|
+
children: c,
|
|
1496
|
+
variant: a = "primary",
|
|
1497
|
+
size: t = "md",
|
|
1498
|
+
type: l = "button",
|
|
1499
|
+
disabled: i,
|
|
1500
|
+
loading: n,
|
|
1501
|
+
fullWidth: f,
|
|
1502
|
+
onClick: _,
|
|
1503
|
+
leftIcon: o,
|
|
1504
|
+
rightIcon: u,
|
|
1505
|
+
error: p,
|
|
1506
|
+
errorPlacement: k = "bottom",
|
|
1507
|
+
className: P,
|
|
1508
|
+
style: h,
|
|
1509
|
+
id: M,
|
|
1510
|
+
accessMode: D,
|
|
1511
|
+
displayStyle: m,
|
|
1512
|
+
...J
|
|
1513
|
+
}, R) => {
|
|
1514
|
+
const x = en(a), L = nn(t), g = Me(D, M), T = g === "hidden";
|
|
1515
|
+
(g === "disabled" || g === "readOnly") && (i = !0);
|
|
1516
|
+
const K = Fe("button", m), A = $e("button", m), H = x !== "primary" ? (({ background: Z, color: E, ...O }) => O)(
|
|
1517
|
+
K
|
|
1518
|
+
) : K, w = /* @__PURE__ */ b(
|
|
1519
|
+
"button",
|
|
1520
|
+
{
|
|
1521
|
+
ref: R,
|
|
1522
|
+
type: l,
|
|
1523
|
+
id: M,
|
|
1524
|
+
className: `nice-btn nice-btn--${x} nice-btn--${L} nice-btn--ds-${A} ${f ? "nice-btn--full-width" : ""} ${n ? "nice-btn--loading" : ""} ${p && !k ? "nice-btn--has-error" : ""} ${P || ""}`,
|
|
1525
|
+
style: { ...H, ...h },
|
|
1526
|
+
disabled: i || n,
|
|
1527
|
+
"aria-busy": n || void 0,
|
|
1528
|
+
"aria-disabled": i || n || void 0,
|
|
1529
|
+
onClick: _,
|
|
1530
|
+
...J,
|
|
1531
|
+
children: [
|
|
1532
|
+
n && /* @__PURE__ */ e(
|
|
1533
|
+
"svg",
|
|
1534
|
+
{
|
|
1535
|
+
className: "nice-btn__spinner",
|
|
1536
|
+
viewBox: "0 0 24 24",
|
|
1537
|
+
fill: "none",
|
|
1538
|
+
stroke: "currentColor",
|
|
1539
|
+
strokeWidth: "3",
|
|
1540
|
+
"aria-hidden": "true",
|
|
1541
|
+
children: /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10", strokeDasharray: "31.4 31.4", strokeLinecap: "round" })
|
|
1542
|
+
}
|
|
1543
|
+
),
|
|
1544
|
+
!n && o && /* @__PURE__ */ e("span", { "aria-hidden": "true", children: o }),
|
|
1545
|
+
!n && /* @__PURE__ */ e("span", { children: c }),
|
|
1546
|
+
n && /* @__PURE__ */ e("span", { style: { visibility: "hidden" }, "aria-hidden": "true", children: c }),
|
|
1547
|
+
!n && u && /* @__PURE__ */ e("span", { "aria-hidden": "true", children: u })
|
|
1548
|
+
]
|
|
1549
|
+
}
|
|
1550
|
+
);
|
|
1551
|
+
if (T)
|
|
1552
|
+
return null;
|
|
1553
|
+
if (!p)
|
|
1554
|
+
return w;
|
|
1555
|
+
const F = /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: p });
|
|
1556
|
+
return k === "right" ? /* @__PURE__ */ b(
|
|
1557
|
+
"span",
|
|
1558
|
+
{
|
|
1559
|
+
className: `nice-btn-field nice-btn-field--right nice-field--${L}`,
|
|
1560
|
+
style: {
|
|
1561
|
+
display: "inline-flex",
|
|
1562
|
+
flexDirection: "row",
|
|
1563
|
+
alignItems: "center",
|
|
1564
|
+
gap: "8px",
|
|
1565
|
+
width: "fit-content"
|
|
1566
|
+
},
|
|
1567
|
+
children: [
|
|
1568
|
+
w,
|
|
1569
|
+
F
|
|
1570
|
+
]
|
|
1571
|
+
}
|
|
1572
|
+
) : T ? null : /* @__PURE__ */ b(
|
|
1573
|
+
"span",
|
|
1574
|
+
{
|
|
1575
|
+
className: `nice-btn-field nice-btn-field--bottom nice-field--${L}`,
|
|
1576
|
+
style: {
|
|
1577
|
+
display: "inline-flex",
|
|
1578
|
+
flexDirection: "column",
|
|
1579
|
+
alignItems: "flex-start",
|
|
1580
|
+
gap: "4px",
|
|
1581
|
+
width: "fit-content"
|
|
1582
|
+
},
|
|
1583
|
+
children: [
|
|
1584
|
+
w,
|
|
1585
|
+
F
|
|
1586
|
+
]
|
|
1587
|
+
}
|
|
1588
|
+
);
|
|
1589
|
+
}
|
|
1590
|
+
);
|
|
1591
|
+
_n.displayName = "NiceButton";
|
|
1592
|
+
const Rn = ({
|
|
1593
|
+
tabs: c,
|
|
1594
|
+
activeTab: a,
|
|
1595
|
+
onChange: t,
|
|
1596
|
+
variant: l = "default",
|
|
1597
|
+
vertical: i,
|
|
1598
|
+
size: n = "md",
|
|
1599
|
+
className: f,
|
|
1600
|
+
style: _,
|
|
1601
|
+
displayStyle: o
|
|
1602
|
+
}) => {
|
|
1603
|
+
const u = Fe("tab", o), p = $e("tab", o), [k, P] = re(a || c[0]?.id), h = a ?? k, M = W(
|
|
1604
|
+
(m) => {
|
|
1605
|
+
P(m), t?.(m);
|
|
1606
|
+
},
|
|
1607
|
+
[t]
|
|
1608
|
+
), D = c.find((m) => m.id === h)?.content;
|
|
1609
|
+
return /* @__PURE__ */ b(
|
|
1610
|
+
"div",
|
|
1611
|
+
{
|
|
1612
|
+
className: `nice-tabs nice-tabs--${n} nice-tabs--ds-${p} ${f || ""}`,
|
|
1613
|
+
style: { ...u, ..._, ...i ? { display: "flex", gap: 16 } : {} },
|
|
1614
|
+
children: [
|
|
1615
|
+
/* @__PURE__ */ e(
|
|
1616
|
+
"div",
|
|
1617
|
+
{
|
|
1618
|
+
className: `nice-tabs__list ${l !== "default" ? `nice-tabs__list--${l}` : ""} ${i ? "nice-tabs__list--vertical" : ""}`,
|
|
1619
|
+
role: "tablist",
|
|
1620
|
+
children: c.map((m) => /* @__PURE__ */ b(
|
|
1621
|
+
"button",
|
|
1622
|
+
{
|
|
1623
|
+
type: "button",
|
|
1624
|
+
role: "tab",
|
|
1625
|
+
"aria-selected": h === m.id,
|
|
1626
|
+
className: `nice-tabs__tab ${h === m.id ? "nice-tabs__tab--active" : ""} ${m.disabled ? "nice-tabs__tab--disabled" : ""}`,
|
|
1627
|
+
disabled: m.disabled,
|
|
1628
|
+
onClick: () => M(m.id),
|
|
1629
|
+
children: [
|
|
1630
|
+
m.icon,
|
|
1631
|
+
/* @__PURE__ */ e("span", { children: m.label }),
|
|
1632
|
+
m.badge !== void 0 && /* @__PURE__ */ e("span", { className: "nice-tabs__badge", children: m.badge })
|
|
1633
|
+
]
|
|
1634
|
+
},
|
|
1635
|
+
m.id
|
|
1636
|
+
))
|
|
1637
|
+
}
|
|
1638
|
+
),
|
|
1639
|
+
D && /* @__PURE__ */ e("div", { className: "nice-tabs__panel", role: "tabpanel", children: D })
|
|
1640
|
+
]
|
|
1641
|
+
}
|
|
1642
|
+
);
|
|
1643
|
+
}, bn = Object.freeze({
|
|
1644
|
+
AR: ["#74acdf", "#ffffff", "#74acdf"],
|
|
1645
|
+
AT: ["#ed2939", "#ffffff", "#ed2939"],
|
|
1646
|
+
AU: ["#012169", "#ffffff", "#e4002b"],
|
|
1647
|
+
BE: ["#000000", "#fae042", "#ed2939"],
|
|
1648
|
+
BR: ["#009c3b", "#ffdf00", "#002776"],
|
|
1649
|
+
CA: ["#ff0000", "#ffffff", "#ff0000"],
|
|
1650
|
+
CH: ["#d52b1e", "#ffffff", "#d52b1e"],
|
|
1651
|
+
CN: ["#de2910", "#ffde00", "#de2910"],
|
|
1652
|
+
CZ: ["#11457e", "#ffffff", "#d7141a"],
|
|
1653
|
+
DE: ["#000000", "#dd0000", "#ffce00"],
|
|
1654
|
+
DK: ["#c8102e", "#ffffff", "#c8102e"],
|
|
1655
|
+
EE: ["#0072ce", "#000000", "#ffffff"],
|
|
1656
|
+
EG: ["#ce1126", "#ffffff", "#000000"],
|
|
1657
|
+
ES: ["#aa151b", "#f1bf00", "#aa151b"],
|
|
1658
|
+
FI: ["#ffffff", "#003580", "#ffffff"],
|
|
1659
|
+
FR: ["#0055a4", "#ffffff", "#ef4135"],
|
|
1660
|
+
GB: ["#012169", "#ffffff", "#c8102e"],
|
|
1661
|
+
GR: ["#0d5eaf", "#ffffff", "#0d5eaf"],
|
|
1662
|
+
HR: ["#171796", "#ffffff", "#ff0000"],
|
|
1663
|
+
HU: ["#ce2939", "#ffffff", "#477050"],
|
|
1664
|
+
IE: ["#169b62", "#ffffff", "#ff883e"],
|
|
1665
|
+
IL: ["#ffffff", "#0038b8", "#ffffff"],
|
|
1666
|
+
IN: ["#ff9933", "#ffffff", "#138808"],
|
|
1667
|
+
IS: ["#02529c", "#ffffff", "#dc1e35"],
|
|
1668
|
+
IT: ["#009246", "#ffffff", "#ce2b37"],
|
|
1669
|
+
JP: ["#ffffff", "#bc002d", "#ffffff"],
|
|
1670
|
+
KR: ["#ffffff", "#cd2e3a", "#0047a0"],
|
|
1671
|
+
LT: ["#fdb913", "#006a44", "#c1272d"],
|
|
1672
|
+
LU: ["#ed2939", "#ffffff", "#00a1de"],
|
|
1673
|
+
LV: ["#9e3039", "#ffffff", "#9e3039"],
|
|
1674
|
+
MX: ["#006847", "#ffffff", "#ce1126"],
|
|
1675
|
+
NL: ["#ae1c28", "#ffffff", "#21468b"],
|
|
1676
|
+
NO: ["#ef2b2d", "#ffffff", "#002868"],
|
|
1677
|
+
NZ: ["#012169", "#ffffff", "#cc142b"],
|
|
1678
|
+
PL: ["#ffffff", "#dc143c"],
|
|
1679
|
+
PT: ["#006600", "#ff0000"],
|
|
1680
|
+
RO: ["#002b7f", "#fcd116", "#ce1126"],
|
|
1681
|
+
RU: ["#ffffff", "#0039a6", "#d52b1e"],
|
|
1682
|
+
SE: ["#006aa7", "#fecc00", "#006aa7"],
|
|
1683
|
+
SK: ["#ffffff", "#0b4ea2", "#ee1c25"],
|
|
1684
|
+
TR: ["#e30a17", "#ffffff", "#e30a17"],
|
|
1685
|
+
UA: ["#005bbb", "#ffd500"],
|
|
1686
|
+
US: ["#b22234", "#ffffff", "#3c3b6e"],
|
|
1687
|
+
VN: ["#da251d", "#ffff00", "#da251d"],
|
|
1688
|
+
ZA: ["#007a4d", "#ffffff", "#de3831"],
|
|
1689
|
+
// ── Round 22 expansion: cover the full COUNTRIES catalogue ─────
|
|
1690
|
+
AD: ["#10069f", "#fedf00", "#d50032"],
|
|
1691
|
+
AE: ["#00732f", "#ffffff", "#000000"],
|
|
1692
|
+
AF: ["#000000", "#d32011", "#007a36"],
|
|
1693
|
+
AG: ["#ce1126", "#fcd116", "#000000"],
|
|
1694
|
+
AL: ["#e41e20", "#000000", "#e41e20"],
|
|
1695
|
+
AM: ["#d90012", "#0033a0", "#f2a800"],
|
|
1696
|
+
AO: ["#ce1126", "#000000", "#ffc500"],
|
|
1697
|
+
AZ: ["#0092bc", "#ed2939", "#509e2f"],
|
|
1698
|
+
BA: ["#002395", "#fecb00", "#ffffff"],
|
|
1699
|
+
BB: ["#00267f", "#ffc726", "#00267f"],
|
|
1700
|
+
BD: ["#006a4e", "#f42a41", "#006a4e"],
|
|
1701
|
+
BF: ["#ef2b2d", "#009e49", "#fcd116"],
|
|
1702
|
+
BG: ["#ffffff", "#00966e", "#d62612"],
|
|
1703
|
+
BH: ["#ffffff", "#ce1126", "#ce1126"],
|
|
1704
|
+
BI: ["#1eb53a", "#ffffff", "#ce1126"],
|
|
1705
|
+
BJ: ["#008751", "#fcd116", "#e8112d"],
|
|
1706
|
+
BN: ["#f7e017", "#ffffff", "#000000"],
|
|
1707
|
+
BO: ["#d52b1e", "#f9e300", "#007934"],
|
|
1708
|
+
BS: ["#00778b", "#ffc72c", "#000000"],
|
|
1709
|
+
BT: ["#ffcc33", "#ff4e12", "#ffcc33"],
|
|
1710
|
+
BW: ["#75aadb", "#ffffff", "#000000"],
|
|
1711
|
+
BY: ["#c8313e", "#007c30", "#ffffff"],
|
|
1712
|
+
BZ: ["#003f87", "#ce1126", "#003f87"],
|
|
1713
|
+
CD: ["#007fff", "#f7d618", "#ce1021"],
|
|
1714
|
+
CF: ["#003082", "#ffffff", "#289728"],
|
|
1715
|
+
CG: ["#009543", "#fbde4a", "#dc241f"],
|
|
1716
|
+
CI: ["#f77f00", "#ffffff", "#009e60"],
|
|
1717
|
+
CM: ["#007a5e", "#ce1126", "#fcd116"],
|
|
1718
|
+
CO: ["#fcd116", "#003893", "#ce1126"],
|
|
1719
|
+
CR: ["#002b7f", "#ffffff", "#ce1126"],
|
|
1720
|
+
CU: ["#002590", "#ffffff", "#cf142b"],
|
|
1721
|
+
CV: ["#003893", "#ffffff", "#cf2027"],
|
|
1722
|
+
CY: ["#ffffff", "#d57800", "#ffffff"],
|
|
1723
|
+
DJ: ["#6ab2e7", "#ffffff", "#12ad2b"],
|
|
1724
|
+
DM: ["#006b3f", "#ffffff", "#000000"],
|
|
1725
|
+
DO: ["#002d62", "#ffffff", "#ce1126"],
|
|
1726
|
+
DZ: ["#006233", "#ffffff", "#d21034"],
|
|
1727
|
+
EC: ["#ffd100", "#034ea2", "#ed1c24"],
|
|
1728
|
+
ER: ["#ea0437", "#0084c9", "#418fde"],
|
|
1729
|
+
ET: ["#078930", "#fcdd09", "#da121a"],
|
|
1730
|
+
FJ: ["#68bfe5", "#cc0000", "#ffffff"],
|
|
1731
|
+
GA: ["#3a75c4", "#ffe700", "#009e60"],
|
|
1732
|
+
GD: ["#ce1126", "#fcd116", "#007a5e"],
|
|
1733
|
+
GE: ["#ffffff", "#ff0000", "#ffffff"],
|
|
1734
|
+
GH: ["#ce1126", "#fcd116", "#006b3f"],
|
|
1735
|
+
GM: ["#ce1126", "#ffffff", "#0c1c8c"],
|
|
1736
|
+
GN: ["#ce1126", "#fcd116", "#009460"],
|
|
1737
|
+
GQ: ["#3e9a00", "#ffffff", "#e32118"],
|
|
1738
|
+
GT: ["#4997d0", "#ffffff", "#4997d0"],
|
|
1739
|
+
GW: ["#ce1126", "#fcd116", "#009e49"],
|
|
1740
|
+
GY: ["#009e49", "#ffffff", "#fcd116"],
|
|
1741
|
+
HK: ["#de2910", "#ffffff", "#de2910"],
|
|
1742
|
+
HN: ["#0073cf", "#ffffff", "#0073cf"],
|
|
1743
|
+
HT: ["#00209f", "#d21034", "#00209f"],
|
|
1744
|
+
ID: ["#ff0000", "#ffffff", "#ff0000"],
|
|
1745
|
+
IQ: ["#ce1126", "#ffffff", "#000000"],
|
|
1746
|
+
IR: ["#239f40", "#ffffff", "#da0000"],
|
|
1747
|
+
JM: ["#000000", "#fed100", "#009b3a"],
|
|
1748
|
+
JO: ["#000000", "#ffffff", "#007a3d"],
|
|
1749
|
+
KE: ["#000000", "#bb0000", "#006600"],
|
|
1750
|
+
KG: ["#ff0000", "#fcd116", "#ff0000"],
|
|
1751
|
+
KH: ["#032ea1", "#e00025", "#032ea1"],
|
|
1752
|
+
KM: ["#fcd116", "#ffffff", "#ce1126"],
|
|
1753
|
+
KP: ["#024fa2", "#ed1c27", "#024fa2"],
|
|
1754
|
+
KW: ["#007a3d", "#ffffff", "#ce1126"],
|
|
1755
|
+
KZ: ["#00afca", "#fec50c", "#00afca"],
|
|
1756
|
+
LA: ["#ce1126", "#002868", "#ce1126"],
|
|
1757
|
+
LB: ["#ed1c24", "#ffffff", "#ed1c24"],
|
|
1758
|
+
LI: ["#002780", "#ce1126", "#002780"],
|
|
1759
|
+
LK: ["#ffbe29", "#8d153a", "#00534e"],
|
|
1760
|
+
LR: ["#bf0a30", "#ffffff", "#002868"],
|
|
1761
|
+
LS: ["#00209f", "#ffffff", "#009543"],
|
|
1762
|
+
LY: ["#e70013", "#000000", "#239e46"],
|
|
1763
|
+
MA: ["#c1272d", "#006233", "#c1272d"],
|
|
1764
|
+
MD: ["#0046ae", "#ffd200", "#cc092f"],
|
|
1765
|
+
ME: ["#d4af37", "#cc0033", "#d4af37"],
|
|
1766
|
+
MG: ["#ffffff", "#fc3d32", "#007e3a"],
|
|
1767
|
+
MH: ["#003893", "#dd7500", "#ffffff"],
|
|
1768
|
+
MK: ["#d20000", "#ffe600", "#d20000"],
|
|
1769
|
+
ML: ["#14b53a", "#fcd116", "#ce1126"],
|
|
1770
|
+
MM: ["#fecb00", "#34b233", "#ea2839"],
|
|
1771
|
+
MN: ["#c4272f", "#015197", "#c4272f"],
|
|
1772
|
+
MO: ["#00785a", "#ffd700", "#ffffff"],
|
|
1773
|
+
MR: ["#006233", "#ffc400", "#d01c1f"],
|
|
1774
|
+
MT: ["#ffffff", "#cf142b", "#ffffff"],
|
|
1775
|
+
MU: ["#ea2839", "#1a206d", "#00a04d"],
|
|
1776
|
+
MV: ["#d21034", "#007e3a", "#ffffff"],
|
|
1777
|
+
MW: ["#000000", "#ce1126", "#339e35"],
|
|
1778
|
+
MY: ["#cc0000", "#ffffff", "#010066"],
|
|
1779
|
+
MZ: ["#009a44", "#ffffff", "#000000"],
|
|
1780
|
+
NA: ["#003580", "#ffffff", "#009543"],
|
|
1781
|
+
NE: ["#ff8000", "#ffffff", "#0db02b"],
|
|
1782
|
+
NG: ["#008753", "#ffffff", "#008753"],
|
|
1783
|
+
NI: ["#0067c6", "#ffffff", "#0067c6"],
|
|
1784
|
+
NP: ["#dc143c", "#003893", "#dc143c"],
|
|
1785
|
+
OM: ["#dc241f", "#ffffff", "#008000"],
|
|
1786
|
+
PA: ["#ffffff", "#cc0033", "#005aa7"],
|
|
1787
|
+
PE: ["#d91023", "#ffffff", "#d91023"],
|
|
1788
|
+
PG: ["#ce1126", "#000000", "#fcd116"],
|
|
1789
|
+
PH: ["#0038a8", "#ffffff", "#ce1126"],
|
|
1790
|
+
PK: ["#ffffff", "#01411c", "#01411c"],
|
|
1791
|
+
PS: ["#000000", "#ffffff", "#007a3d"],
|
|
1792
|
+
PY: ["#d52b1e", "#ffffff", "#0038a8"],
|
|
1793
|
+
QA: ["#ffffff", "#8a1538", "#8a1538"],
|
|
1794
|
+
RS: ["#c6363c", "#0c4076", "#ffffff"],
|
|
1795
|
+
RW: ["#00a1de", "#fad201", "#00a651"],
|
|
1796
|
+
SA: ["#006c35", "#ffffff", "#006c35"],
|
|
1797
|
+
SB: ["#0051ba", "#fcd116", "#215b33"],
|
|
1798
|
+
SC: ["#003f87", "#fcd116", "#d62828"],
|
|
1799
|
+
SD: ["#d21034", "#ffffff", "#000000"],
|
|
1800
|
+
SG: ["#ed2939", "#ffffff", "#ed2939"],
|
|
1801
|
+
SI: ["#ffffff", "#0000ff", "#ff0000"],
|
|
1802
|
+
SL: ["#1eb53a", "#ffffff", "#0072c6"],
|
|
1803
|
+
SM: ["#ffffff", "#5eb6e4", "#ffffff"],
|
|
1804
|
+
SN: ["#00853f", "#fdef42", "#e31b23"],
|
|
1805
|
+
SO: ["#4189dd", "#ffffff", "#4189dd"],
|
|
1806
|
+
SR: ["#377e3f", "#ffffff", "#b40a2d"],
|
|
1807
|
+
SS: ["#000000", "#ce1126", "#078930"],
|
|
1808
|
+
ST: ["#12ad2b", "#ffce00", "#d21034"],
|
|
1809
|
+
SV: ["#0047ab", "#ffffff", "#0047ab"],
|
|
1810
|
+
SY: ["#ce1126", "#ffffff", "#000000"],
|
|
1811
|
+
SZ: ["#3e5eb9", "#ffd900", "#b10c0c"],
|
|
1812
|
+
TD: ["#002664", "#fecb00", "#c60c30"],
|
|
1813
|
+
TG: ["#006a4e", "#fcd116", "#d21034"],
|
|
1814
|
+
TH: ["#ed1c24", "#ffffff", "#241d4f"],
|
|
1815
|
+
TJ: ["#cc0000", "#ffffff", "#006600"],
|
|
1816
|
+
TL: ["#dc241f", "#ffc726", "#000000"],
|
|
1817
|
+
TM: ["#00853e", "#ffffff", "#cc0000"],
|
|
1818
|
+
TN: ["#e70013", "#ffffff", "#e70013"],
|
|
1819
|
+
TO: ["#ffffff", "#c10000", "#c10000"],
|
|
1820
|
+
TT: ["#ce1126", "#ffffff", "#000000"],
|
|
1821
|
+
TW: ["#fe0000", "#000095", "#fe0000"],
|
|
1822
|
+
TZ: ["#1eb53a", "#fcd116", "#00a3dd"],
|
|
1823
|
+
UG: ["#000000", "#fcdc04", "#d90000"],
|
|
1824
|
+
UY: ["#ffffff", "#0038a8", "#ffffff"],
|
|
1825
|
+
UZ: ["#1eb53a", "#ffffff", "#0099b5"],
|
|
1826
|
+
VA: ["#ffe000", "#ffffff", "#ffe000"],
|
|
1827
|
+
VE: ["#fcd116", "#00247d", "#cf142b"],
|
|
1828
|
+
VU: ["#000000", "#ce1126", "#009543"],
|
|
1829
|
+
WS: ["#002b7f", "#ffffff", "#cc0033"],
|
|
1830
|
+
YE: ["#ce1126", "#ffffff", "#000000"],
|
|
1831
|
+
ZM: ["#198a00", "#de2010", "#ef7d00"],
|
|
1832
|
+
ZW: ["#078930", "#fcd116", "#cf2027"]
|
|
1833
|
+
}), je = ["#cbd5e1", "#94a3b8", "#cbd5e1"];
|
|
1834
|
+
function gn(c) {
|
|
1835
|
+
return c ? bn[c.toUpperCase()] ?? je : je;
|
|
1836
|
+
}
|
|
1837
|
+
const vn = tn, Dn = ({
|
|
1838
|
+
code: c,
|
|
1839
|
+
size: a = 22,
|
|
1840
|
+
className: t
|
|
1841
|
+
}) => {
|
|
1842
|
+
const l = c?.toUpperCase(), i = l ? vn[l] : void 0, n = a, f = Math.round(a * 2 / 3);
|
|
1843
|
+
return i ? /* @__PURE__ */ e(
|
|
1844
|
+
"span",
|
|
1845
|
+
{
|
|
1846
|
+
className: t,
|
|
1847
|
+
role: "img",
|
|
1848
|
+
"aria-label": `${l} flag`,
|
|
1849
|
+
style: {
|
|
1850
|
+
display: "inline-block",
|
|
1851
|
+
width: n,
|
|
1852
|
+
height: f,
|
|
1853
|
+
boxSizing: "content-box",
|
|
1854
|
+
border: "1px solid var(--nice-overlay-15, rgba(0, 0, 0, 0.15))",
|
|
1855
|
+
borderRadius: 2,
|
|
1856
|
+
overflow: "hidden",
|
|
1857
|
+
flexShrink: 0,
|
|
1858
|
+
verticalAlign: "middle",
|
|
1859
|
+
lineHeight: 0
|
|
1860
|
+
},
|
|
1861
|
+
dangerouslySetInnerHTML: {
|
|
1862
|
+
__html: i.replace(
|
|
1863
|
+
"<svg ",
|
|
1864
|
+
`<svg width="${n}" height="${f}" preserveAspectRatio="xMidYMid slice" `
|
|
1865
|
+
)
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
) : /* @__PURE__ */ e(Nn, { code: c, size: a, className: t });
|
|
1869
|
+
}, Nn = ({
|
|
1870
|
+
code: c,
|
|
1871
|
+
size: a = 18,
|
|
1872
|
+
className: t
|
|
1873
|
+
}) => {
|
|
1874
|
+
const l = gn(c);
|
|
1875
|
+
return /* @__PURE__ */ e(
|
|
1876
|
+
"span",
|
|
1877
|
+
{
|
|
1878
|
+
className: t,
|
|
1879
|
+
role: "img",
|
|
1880
|
+
"aria-label": `${c} flag`,
|
|
1881
|
+
style: {
|
|
1882
|
+
display: "inline-flex",
|
|
1883
|
+
width: a,
|
|
1884
|
+
height: Math.round(a * 0.7),
|
|
1885
|
+
boxSizing: "content-box",
|
|
1886
|
+
border: "1px solid var(--nice-overlay-15, rgba(0, 0, 0, 0.15))",
|
|
1887
|
+
borderRadius: 2,
|
|
1888
|
+
overflow: "hidden",
|
|
1889
|
+
flexShrink: 0,
|
|
1890
|
+
verticalAlign: "middle"
|
|
1891
|
+
},
|
|
1892
|
+
children: l.map((i, n) => /* @__PURE__ */ e("span", { style: { flex: 1, background: i } }, n))
|
|
1893
|
+
}
|
|
1894
|
+
);
|
|
1895
|
+
};
|
|
1896
|
+
function Tn(c, a, t, l = 280) {
|
|
1897
|
+
const [i, n] = re(t === "left" ? "left" : "right"), f = W(() => {
|
|
1898
|
+
if (t !== "auto") {
|
|
1899
|
+
n(t);
|
|
1900
|
+
return;
|
|
1901
|
+
}
|
|
1902
|
+
const _ = a.current;
|
|
1903
|
+
if (!_ || typeof window > "u")
|
|
1904
|
+
return;
|
|
1905
|
+
const o = _.getBoundingClientRect(), p = window.innerWidth - o.left, k = o.right;
|
|
1906
|
+
p >= l && p > k ? n("left") : n("right");
|
|
1907
|
+
}, [t, a, l]);
|
|
1908
|
+
return Ye(() => {
|
|
1909
|
+
if (c)
|
|
1910
|
+
return f(), window.addEventListener("resize", f), window.addEventListener("scroll", f, !0), () => {
|
|
1911
|
+
window.removeEventListener("resize", f), window.removeEventListener("scroll", f, !0);
|
|
1912
|
+
};
|
|
1913
|
+
}, [c, f]), i;
|
|
1914
|
+
}
|
|
1915
|
+
const An = ({ colors: c, size: a = 28, shape: t = "page", className: l }) => {
|
|
1916
|
+
const i = a, n = Math.round(a * 0.75), f = c.border ?? "color-mix(in srgb, currentColor 30%, transparent)";
|
|
1917
|
+
if (t === "swatch") {
|
|
1918
|
+
const P = [
|
|
1919
|
+
c.primary,
|
|
1920
|
+
c.background,
|
|
1921
|
+
c.backgroundSecondary ?? c.background,
|
|
1922
|
+
c.textColor
|
|
1923
|
+
];
|
|
1924
|
+
return /* @__PURE__ */ e(
|
|
1925
|
+
"span",
|
|
1926
|
+
{
|
|
1927
|
+
className: l,
|
|
1928
|
+
role: "img",
|
|
1929
|
+
"aria-label": "Theme preview",
|
|
1930
|
+
style: {
|
|
1931
|
+
display: "inline-flex",
|
|
1932
|
+
width: i,
|
|
1933
|
+
height: n,
|
|
1934
|
+
border: `1px solid ${f}`,
|
|
1935
|
+
borderRadius: 2,
|
|
1936
|
+
overflow: "hidden",
|
|
1937
|
+
flexShrink: 0,
|
|
1938
|
+
verticalAlign: "middle"
|
|
1939
|
+
},
|
|
1940
|
+
children: P.map((h, M) => /* @__PURE__ */ e("span", { style: { flex: 1, background: h } }, M))
|
|
1941
|
+
}
|
|
1942
|
+
);
|
|
1943
|
+
}
|
|
1944
|
+
const _ = Math.max(2, Math.round(n * 0.22)), o = c.backgroundSecondary ? Math.max(3, Math.round(i * 0.28)) : 0, u = Math.max(1, Math.round(n * 0.08)), p = Math.max(1, Math.round(n * 0.05)), k = Math.max(2, Math.round(i * 0.08));
|
|
1945
|
+
return /* @__PURE__ */ b(
|
|
1946
|
+
"span",
|
|
1947
|
+
{
|
|
1948
|
+
className: l,
|
|
1949
|
+
role: "img",
|
|
1950
|
+
"aria-label": "Theme preview",
|
|
1951
|
+
style: {
|
|
1952
|
+
position: "relative",
|
|
1953
|
+
display: "inline-block",
|
|
1954
|
+
width: i,
|
|
1955
|
+
height: n,
|
|
1956
|
+
boxSizing: "content-box",
|
|
1957
|
+
background: c.background,
|
|
1958
|
+
border: `1px solid ${f}`,
|
|
1959
|
+
borderRadius: 2,
|
|
1960
|
+
overflow: "hidden",
|
|
1961
|
+
flexShrink: 0,
|
|
1962
|
+
verticalAlign: "middle"
|
|
1963
|
+
},
|
|
1964
|
+
children: [
|
|
1965
|
+
/* @__PURE__ */ e(
|
|
1966
|
+
"span",
|
|
1967
|
+
{
|
|
1968
|
+
style: {
|
|
1969
|
+
position: "absolute",
|
|
1970
|
+
top: 0,
|
|
1971
|
+
left: 0,
|
|
1972
|
+
right: 0,
|
|
1973
|
+
height: _,
|
|
1974
|
+
background: c.primary
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
),
|
|
1978
|
+
o > 0 && /* @__PURE__ */ e(
|
|
1979
|
+
"span",
|
|
1980
|
+
{
|
|
1981
|
+
style: {
|
|
1982
|
+
position: "absolute",
|
|
1983
|
+
top: _,
|
|
1984
|
+
left: 0,
|
|
1985
|
+
bottom: 0,
|
|
1986
|
+
width: o,
|
|
1987
|
+
background: c.backgroundSecondary
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
),
|
|
1991
|
+
/* @__PURE__ */ e(
|
|
1992
|
+
"span",
|
|
1993
|
+
{
|
|
1994
|
+
style: {
|
|
1995
|
+
position: "absolute",
|
|
1996
|
+
top: _ + p,
|
|
1997
|
+
left: o + k,
|
|
1998
|
+
right: k,
|
|
1999
|
+
height: u,
|
|
2000
|
+
background: c.textColor,
|
|
2001
|
+
opacity: 0.8,
|
|
2002
|
+
borderRadius: 1
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
),
|
|
2006
|
+
/* @__PURE__ */ e(
|
|
2007
|
+
"span",
|
|
2008
|
+
{
|
|
2009
|
+
style: {
|
|
2010
|
+
position: "absolute",
|
|
2011
|
+
top: _ + p * 2 + u,
|
|
2012
|
+
left: o + k,
|
|
2013
|
+
width: `${Math.max(20, i - o - k * 2 - 4)}px`,
|
|
2014
|
+
height: u,
|
|
2015
|
+
background: c.textColor,
|
|
2016
|
+
opacity: 0.5,
|
|
2017
|
+
borderRadius: 1
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
)
|
|
2021
|
+
]
|
|
2022
|
+
}
|
|
2023
|
+
);
|
|
2024
|
+
};
|
|
2025
|
+
export {
|
|
2026
|
+
Dn as F,
|
|
2027
|
+
Je as N,
|
|
2028
|
+
An as T,
|
|
2029
|
+
Qe as a,
|
|
2030
|
+
ze as b,
|
|
2031
|
+
qe as c,
|
|
2032
|
+
Oe as d,
|
|
2033
|
+
fn as e,
|
|
2034
|
+
Rn as f,
|
|
2035
|
+
_n as g,
|
|
2036
|
+
Nn as h,
|
|
2037
|
+
xn as i,
|
|
2038
|
+
Sn as j,
|
|
2039
|
+
Cn as k,
|
|
2040
|
+
Ln as l,
|
|
2041
|
+
En as m,
|
|
2042
|
+
Tn as u
|
|
2043
|
+
};
|