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