@vellira-ui/react 2.22.5 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -7
- package/dist/index.cjs +1 -1
- package/dist/index.js +314 -258
- package/dist/styles.css +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3,21 +3,21 @@ import l from "clsx";
|
|
|
3
3
|
import { createPortal as u } from "react-dom";
|
|
4
4
|
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
5
5
|
import { FloatingPortal as m, arrow as h, autoUpdate as g, flip as _, offset as v, shift as y, size as b, useFloating as x, useFocus as S, useHover as C, useInteractions as w } from "@floating-ui/react";
|
|
6
|
-
import { useControllableState as T, useKeyboardNavigation as
|
|
7
|
-
import { Check as
|
|
8
|
-
import
|
|
6
|
+
import { useControllableState as T, useKeyboardNavigation as E, useTabsKeyboard as D } from "@vellira-ui/core";
|
|
7
|
+
import { Check as O, ChevronDown as k, Close as A } from "@vellira-ui/icons";
|
|
8
|
+
import j from "focus-trap-react";
|
|
9
9
|
//#region src/utils/cn.ts
|
|
10
|
-
var
|
|
10
|
+
var M = (...e) => l(e), N = ({ children: e }) => {
|
|
11
11
|
let [t, n] = c(!1);
|
|
12
12
|
if (i(() => {
|
|
13
13
|
n(!0);
|
|
14
14
|
}, []), !t) return null;
|
|
15
15
|
let r = document.getElementById("overlay-root") ?? document.body;
|
|
16
16
|
return r ? u(e, r) : null;
|
|
17
|
-
},
|
|
17
|
+
}, P = {
|
|
18
18
|
dropdown: "_dropdown_6pgxt_1",
|
|
19
19
|
dropdownIn: "_dropdownIn_6pgxt_1"
|
|
20
|
-
},
|
|
20
|
+
}, F = t(({ children: e, floatingStyles: t, menuId: n, labelledById: r, label: i, activeDescendantId: a, onKeyDown: o, className: s }, c) => /* @__PURE__ */ f(N, { children: /* @__PURE__ */ f("ul", {
|
|
21
21
|
ref: c,
|
|
22
22
|
id: n,
|
|
23
23
|
role: "menu",
|
|
@@ -27,13 +27,13 @@ var j = (...e) => l(e), M = ({ children: e }) => {
|
|
|
27
27
|
"aria-activedescendant": a,
|
|
28
28
|
onKeyDown: o,
|
|
29
29
|
style: t,
|
|
30
|
-
className:
|
|
30
|
+
className: M(P.dropdown, s),
|
|
31
31
|
children: e
|
|
32
32
|
}) }));
|
|
33
|
-
|
|
33
|
+
F.displayName = "DropdownContent";
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region src/hooks/useFloatingPosition.ts
|
|
36
|
-
var
|
|
36
|
+
var I = (e) => {
|
|
37
37
|
let [t, n] = c(() => typeof window > "u" || typeof window.matchMedia != "function" || !e ? !1 : window.matchMedia(`(max-width: ${e}px)`).matches);
|
|
38
38
|
return i(() => {
|
|
39
39
|
if (typeof window > "u" || typeof window.matchMedia != "function" || !e) return;
|
|
@@ -42,8 +42,8 @@ var F = (e) => {
|
|
|
42
42
|
t.removeEventListener("change", r);
|
|
43
43
|
};
|
|
44
44
|
}, [e]), t;
|
|
45
|
-
},
|
|
46
|
-
let l =
|
|
45
|
+
}, ee = ({ open: e, onOpenChange: t, placement: n = "bottom-start", strategy: r = "fixed", matchTriggerWidth: a = !1, mobileSheetBreakpoint: s, middleware: c = [] } = {}) => {
|
|
46
|
+
let l = I(s), { refs: u, floatingStyles: d, update: f, context: p, middlewareData: m, placement: h } = x({
|
|
47
47
|
open: e,
|
|
48
48
|
onOpenChange: t,
|
|
49
49
|
placement: n,
|
|
@@ -76,7 +76,7 @@ var F = (e) => {
|
|
|
76
76
|
setFloatingRef: u.setFloating,
|
|
77
77
|
updatePosition: f
|
|
78
78
|
};
|
|
79
|
-
},
|
|
79
|
+
}, L = (e, t, n = !0) => {
|
|
80
80
|
let r = s(e);
|
|
81
81
|
r.current = e;
|
|
82
82
|
let a = s(t);
|
|
@@ -88,11 +88,11 @@ var F = (e) => {
|
|
|
88
88
|
};
|
|
89
89
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
90
90
|
}, [n]);
|
|
91
|
-
},
|
|
91
|
+
}, R = { group: "_group_1yomt_1" }, z = ({ label: e }) => /* @__PURE__ */ f("li", {
|
|
92
92
|
role: "presentation",
|
|
93
|
-
className:
|
|
93
|
+
className: R.group,
|
|
94
94
|
children: e
|
|
95
|
-
}),
|
|
95
|
+
}), B = {
|
|
96
96
|
item: "_item_t87eq_1",
|
|
97
97
|
disabled: "_disabled_t87eq_18",
|
|
98
98
|
active: "_active_t87eq_28",
|
|
@@ -103,7 +103,7 @@ var F = (e) => {
|
|
|
103
103
|
"itemText--truncate": "_itemText--truncate_t87eq_74",
|
|
104
104
|
"itemText--wrap": "_itemText--wrap_t87eq_79",
|
|
105
105
|
"itemText--nowrap": "_itemText--nowrap_t87eq_83"
|
|
106
|
-
},
|
|
106
|
+
}, V = ({ id: e, children: t, label: n, icon: r, danger: i, disabled: a, active: o, onClick: s, onMouseEnter: c, shortcut: l, textWrap: u = "truncate", className: d }) => {
|
|
107
107
|
let m = t || n;
|
|
108
108
|
return /* @__PURE__ */ p("li", {
|
|
109
109
|
id: e,
|
|
@@ -114,47 +114,47 @@ var F = (e) => {
|
|
|
114
114
|
"data-danger": i || void 0,
|
|
115
115
|
onClick: a ? void 0 : s,
|
|
116
116
|
onMouseEnter: a ? void 0 : c,
|
|
117
|
-
className:
|
|
118
|
-
[
|
|
119
|
-
[
|
|
120
|
-
[
|
|
117
|
+
className: M(B.item, {
|
|
118
|
+
[B.active]: o,
|
|
119
|
+
[B.disabled]: a,
|
|
120
|
+
[B.danger]: i
|
|
121
121
|
}, d),
|
|
122
122
|
children: [
|
|
123
123
|
r && /* @__PURE__ */ f("span", {
|
|
124
124
|
"aria-hidden": "true",
|
|
125
|
-
className:
|
|
125
|
+
className: B.itemIcon,
|
|
126
126
|
children: r
|
|
127
127
|
}),
|
|
128
128
|
m && /* @__PURE__ */ f("span", {
|
|
129
|
-
className:
|
|
129
|
+
className: M(B.itemText, B[`itemText--${u}`]),
|
|
130
130
|
children: m
|
|
131
131
|
}),
|
|
132
132
|
l && /* @__PURE__ */ f("span", {
|
|
133
|
-
className:
|
|
133
|
+
className: B.itemShortcut,
|
|
134
134
|
children: l
|
|
135
135
|
})
|
|
136
136
|
]
|
|
137
137
|
});
|
|
138
|
-
},
|
|
138
|
+
}, H = { group: "_group_ts4nb_1" }, U = () => /* @__PURE__ */ f("li", {
|
|
139
139
|
role: "separator",
|
|
140
|
-
className:
|
|
140
|
+
className: H.separator,
|
|
141
141
|
"aria-hidden": "true"
|
|
142
|
-
}),
|
|
142
|
+
}), W = {
|
|
143
143
|
button: "_button_ii6sx_1",
|
|
144
144
|
disabled: "_disabled_ii6sx_16",
|
|
145
145
|
iconLeft: "_iconLeft_ii6sx_27",
|
|
146
146
|
arrow: "_arrow_ii6sx_39",
|
|
147
147
|
iconOnly: "_iconOnly_ii6sx_42",
|
|
148
148
|
open: "_open_ii6sx_75"
|
|
149
|
-
},
|
|
150
|
-
let u = !!n, d = !!e, m = u && !d, h = i && d, g = r ?? /* @__PURE__ */ f(
|
|
149
|
+
}, te = t(({ children: e, isOpen: t, icon: n, arrowIcon: r, showArrow: i = !0, rotateAngle: a = 90, label: o, className: s, ...c }, l) => {
|
|
150
|
+
let u = !!n, d = !!e, m = u && !d, h = i && d, g = r ?? /* @__PURE__ */ f(k, {}), _ = m ? o ?? "Open menu" : void 0;
|
|
151
151
|
return /* @__PURE__ */ p("button", {
|
|
152
152
|
...c,
|
|
153
153
|
ref: l,
|
|
154
154
|
type: "button",
|
|
155
|
-
className:
|
|
156
|
-
[
|
|
157
|
-
[
|
|
155
|
+
className: M(W.button, {
|
|
156
|
+
[W.disabled]: c.disabled,
|
|
157
|
+
[W.iconOnly]: m
|
|
158
158
|
}, s),
|
|
159
159
|
"aria-label": _,
|
|
160
160
|
"aria-expanded": t,
|
|
@@ -163,57 +163,57 @@ var F = (e) => {
|
|
|
163
163
|
children: [
|
|
164
164
|
u && /* @__PURE__ */ f("span", {
|
|
165
165
|
"aria-hidden": "true",
|
|
166
|
-
className:
|
|
166
|
+
className: W.iconLeft,
|
|
167
167
|
children: n
|
|
168
168
|
}),
|
|
169
169
|
e,
|
|
170
170
|
h && /* @__PURE__ */ f("span", {
|
|
171
171
|
"aria-hidden": "true",
|
|
172
|
-
className:
|
|
172
|
+
className: M(W.arrow, { [W.open]: t }),
|
|
173
173
|
children: g
|
|
174
174
|
})
|
|
175
175
|
]
|
|
176
176
|
});
|
|
177
177
|
});
|
|
178
|
-
|
|
178
|
+
te.displayName = "DropdownTrigger";
|
|
179
179
|
//#endregion
|
|
180
180
|
//#region src/components/Dropdown/types.ts
|
|
181
|
-
var
|
|
182
|
-
let [v, y] = c(!1), [b, x] = c(-1), S = s(null), C = s(null), w = a(), T = `${w}-trigger`, { floatingStyles:
|
|
181
|
+
var ne = (e) => e.type !== "group" && e.type !== "separator", G = (e) => e.type === "group", re = (e) => e.type === "separator", ie = { wrapper: "_wrapper_14ue8_1" }, ae = ({ label: e, icon: t, trigger: n, items: r = [], onSelect: i, className: o, disabled: l, rotateAngle: u = 90, placement: d, matchTriggerWidth: m, textWrap: h, showArrow: g = !0, arrowIcon: _ }) => {
|
|
182
|
+
let [v, y] = c(!1), [b, x] = c(-1), S = s(null), C = s(null), w = a(), T = `${w}-trigger`, { floatingStyles: D, setRef: O, setFloatingRef: k } = ee({
|
|
183
183
|
placement: d,
|
|
184
184
|
matchTriggerWidth: m,
|
|
185
185
|
mobileSheetBreakpoint: 640
|
|
186
|
-
}),
|
|
186
|
+
}), A = r.filter(ne), j = v && b >= 0 ? `${w}-item-${b}` : void 0, N = () => A.findIndex((e) => !e.disabled), P = () => {
|
|
187
187
|
l || y((e) => {
|
|
188
188
|
let t = !e;
|
|
189
|
-
return x(t ?
|
|
189
|
+
return x(t ? N() : -1), t;
|
|
190
190
|
});
|
|
191
|
-
},
|
|
191
|
+
}, I = () => {
|
|
192
192
|
y(!1), x(-1);
|
|
193
|
-
},
|
|
194
|
-
|
|
195
|
-
}, { onKeyDown:
|
|
193
|
+
}, R = () => {
|
|
194
|
+
I(), S.current?.focus();
|
|
195
|
+
}, { onKeyDown: B } = E({
|
|
196
196
|
activeIndex: b,
|
|
197
197
|
setActiveIndex: x,
|
|
198
|
-
items:
|
|
198
|
+
items: A,
|
|
199
199
|
isOpen: v,
|
|
200
|
-
onOpen:
|
|
200
|
+
onOpen: P,
|
|
201
201
|
onSelect: () => {
|
|
202
|
-
let e =
|
|
203
|
-
!e || e.disabled || (i?.(e.value),
|
|
202
|
+
let e = A[b];
|
|
203
|
+
!e || e.disabled || (i?.(e.value), R());
|
|
204
204
|
},
|
|
205
|
-
onClose:
|
|
205
|
+
onClose: R
|
|
206
206
|
});
|
|
207
|
-
|
|
208
|
-
let
|
|
209
|
-
S.current = e,
|
|
210
|
-
},
|
|
211
|
-
C.current = e,
|
|
207
|
+
L([S, C], () => I(), v);
|
|
208
|
+
let H = (e) => {
|
|
209
|
+
S.current = e, O(e);
|
|
210
|
+
}, W = (e) => {
|
|
211
|
+
C.current = e, k(e), e?.focus();
|
|
212
212
|
};
|
|
213
213
|
return /* @__PURE__ */ p("div", {
|
|
214
|
-
className:
|
|
215
|
-
children: [/* @__PURE__ */ f(
|
|
216
|
-
ref:
|
|
214
|
+
className: M(ie.wrapper, o),
|
|
215
|
+
children: [/* @__PURE__ */ f(te, {
|
|
216
|
+
ref: H,
|
|
217
217
|
id: T,
|
|
218
218
|
isOpen: v,
|
|
219
219
|
disabled: l,
|
|
@@ -222,32 +222,32 @@ var re = (e) => e.type !== "group" && e.type !== "separator", W = (e) => e.type
|
|
|
222
222
|
showArrow: g,
|
|
223
223
|
arrowIcon: _,
|
|
224
224
|
rotateAngle: u,
|
|
225
|
-
onClick:
|
|
226
|
-
onKeyDown:
|
|
225
|
+
onClick: P,
|
|
226
|
+
onKeyDown: B,
|
|
227
227
|
"aria-expanded": v,
|
|
228
228
|
"aria-haspopup": "menu",
|
|
229
229
|
...v && { "aria-controls": w },
|
|
230
230
|
children: n
|
|
231
|
-
}), v && /* @__PURE__ */ f(
|
|
232
|
-
ref:
|
|
233
|
-
floatingStyles:
|
|
231
|
+
}), v && /* @__PURE__ */ f(F, {
|
|
232
|
+
ref: W,
|
|
233
|
+
floatingStyles: D,
|
|
234
234
|
menuId: w,
|
|
235
235
|
labelledById: n ? T : void 0,
|
|
236
236
|
label: n ? void 0 : e,
|
|
237
|
-
activeDescendantId:
|
|
238
|
-
onKeyDown:
|
|
237
|
+
activeDescendantId: j,
|
|
238
|
+
onKeyDown: B,
|
|
239
239
|
children: r.map((e, t) => {
|
|
240
|
-
if (
|
|
241
|
-
if (
|
|
242
|
-
if (
|
|
243
|
-
let t =
|
|
244
|
-
return /* @__PURE__ */ f(
|
|
240
|
+
if (G(e)) return /* @__PURE__ */ f(z, { label: e.label }, `group-${e.label}`);
|
|
241
|
+
if (re(e)) return /* @__PURE__ */ f(U, {}, `separator-${t}`);
|
|
242
|
+
if (ne(e)) {
|
|
243
|
+
let t = A.findIndex((t) => t === e);
|
|
244
|
+
return /* @__PURE__ */ f(V, {
|
|
245
245
|
id: `${w}-item-${t}`,
|
|
246
246
|
...e,
|
|
247
247
|
active: b === t,
|
|
248
248
|
textWrap: e.textWrap || h,
|
|
249
249
|
onClick: () => {
|
|
250
|
-
e.disabled || (i?.(e.value),
|
|
250
|
+
e.disabled || (i?.(e.value), R());
|
|
251
251
|
},
|
|
252
252
|
onMouseEnter: () => {
|
|
253
253
|
t < 0 || e.disabled || x(t);
|
|
@@ -258,14 +258,14 @@ var re = (e) => e.type !== "group" && e.type !== "separator", W = (e) => e.type
|
|
|
258
258
|
})
|
|
259
259
|
})]
|
|
260
260
|
});
|
|
261
|
-
},
|
|
262
|
-
let e = r(
|
|
261
|
+
}, oe = e(void 0), se = () => {
|
|
262
|
+
let e = r(oe);
|
|
263
263
|
if (e === void 0) throw Error("Modal compound components must be used inside Modal");
|
|
264
264
|
return e;
|
|
265
265
|
};
|
|
266
|
-
|
|
266
|
+
oe.displayName = "ModalContext";
|
|
267
267
|
var ce = { modalBody: "_modalBody_iv33a_1" }, le = ({ children: e }) => {
|
|
268
|
-
let { descriptionId: t } =
|
|
268
|
+
let { descriptionId: t } = se();
|
|
269
269
|
return /* @__PURE__ */ f("div", {
|
|
270
270
|
id: t,
|
|
271
271
|
className: ce.modalBody,
|
|
@@ -288,7 +288,7 @@ var me = {
|
|
|
288
288
|
modalHeaderTitle: "_modalHeaderTitle_155d7_8",
|
|
289
289
|
modalHeaderCloseButton: "_modalHeaderCloseButton_155d7_15"
|
|
290
290
|
}, he = ({ children: e }) => {
|
|
291
|
-
let { onClose: t, titleId: n } =
|
|
291
|
+
let { onClose: t, titleId: n } = se();
|
|
292
292
|
return /* @__PURE__ */ p("div", {
|
|
293
293
|
className: me.modalHeader,
|
|
294
294
|
children: [/* @__PURE__ */ f("h2", {
|
|
@@ -300,7 +300,7 @@ var me = {
|
|
|
300
300
|
className: me.modalHeaderCloseButton,
|
|
301
301
|
onClick: t,
|
|
302
302
|
"aria-label": "Close modal",
|
|
303
|
-
children: /* @__PURE__ */ f(
|
|
303
|
+
children: /* @__PURE__ */ f(A, { size: 16 })
|
|
304
304
|
})]
|
|
305
305
|
});
|
|
306
306
|
};
|
|
@@ -318,7 +318,7 @@ var ge = ({ isOpen: e, onClose: t }) => {
|
|
|
318
318
|
"overlay--animated": "_overlay--animated_1xotg_17",
|
|
319
319
|
modal: "_modal_1xotg_21"
|
|
320
320
|
}, K = 0, ve = "", ye = ({ children: e, onClose: t, isOpen: r, className: a, closeOnBackdrop: o, closeOnClick: c, closeOnEsc: l = !0, zIndex: u = 1e3, animated: d = !0 }) => {
|
|
321
|
-
let p = o ?? c ?? !0, m = s(null), { titleId: h, descriptionId: g } =
|
|
321
|
+
let p = o ?? c ?? !0, m = s(null), { titleId: h, descriptionId: g } = se(), _ = n((e) => {
|
|
322
322
|
p && e.target === e.currentTarget && t?.();
|
|
323
323
|
}, [p, t]);
|
|
324
324
|
return ge({
|
|
@@ -328,14 +328,14 @@ var ge = ({ isOpen: e, onClose: t }) => {
|
|
|
328
328
|
if (r) return K === 0 && (ve = document.body.style.overflow), K += 1, document.body.style.overflow = "hidden", () => {
|
|
329
329
|
K = Math.max(0, K - 1), K === 0 && (document.body.style.overflow = ve);
|
|
330
330
|
};
|
|
331
|
-
}, [r]), !r && !d ? null : /* @__PURE__ */ f(
|
|
332
|
-
className:
|
|
331
|
+
}, [r]), !r && !d ? null : /* @__PURE__ */ f(N, { children: /* @__PURE__ */ f("div", {
|
|
332
|
+
className: M(_e.overlay, r && _e["overlay--open"], d && _e["overlay--animated"], a),
|
|
333
333
|
onClick: _,
|
|
334
334
|
tabIndex: -1,
|
|
335
335
|
role: "presentation",
|
|
336
336
|
"aria-hidden": !r,
|
|
337
337
|
style: { zIndex: u },
|
|
338
|
-
children: /* @__PURE__ */ f(
|
|
338
|
+
children: /* @__PURE__ */ f(j, {
|
|
339
339
|
active: r,
|
|
340
340
|
focusTrapOptions: {
|
|
341
341
|
fallbackFocus: () => m.current,
|
|
@@ -360,7 +360,7 @@ ye.displayName = "ModalOverlay";
|
|
|
360
360
|
//#region src/components/Modal/Modal.tsx
|
|
361
361
|
var be = ({ isOpen: e, children: t, onClose: n, closeOnBackdrop: r, closeOnClick: i, closeOnEsc: o = !0 }) => {
|
|
362
362
|
let s = a(), c = a();
|
|
363
|
-
return e ? /* @__PURE__ */ f(
|
|
363
|
+
return e ? /* @__PURE__ */ f(oe.Provider, {
|
|
364
364
|
value: {
|
|
365
365
|
onClose: n,
|
|
366
366
|
titleId: s,
|
|
@@ -384,17 +384,17 @@ var xe = Object.assign(be, {
|
|
|
384
384
|
Content: de,
|
|
385
385
|
Footer: pe
|
|
386
386
|
}), q = {
|
|
387
|
-
wrapper: "
|
|
388
|
-
label: "
|
|
389
|
-
required: "
|
|
390
|
-
description: "
|
|
391
|
-
control: "
|
|
392
|
-
errorText: "
|
|
393
|
-
disabled: "
|
|
387
|
+
wrapper: "_wrapper_aekin_1",
|
|
388
|
+
label: "_label_aekin_9",
|
|
389
|
+
required: "_required_aekin_20",
|
|
390
|
+
description: "_description_aekin_25",
|
|
391
|
+
control: "_control_aekin_32",
|
|
392
|
+
errorText: "_errorText_aekin_40",
|
|
393
|
+
disabled: "_disabled_aekin_47"
|
|
394
394
|
}, Se = ({ id: e, label: t, description: n, error: r, required: i = !1, disabled: o = !1, children: s, className: c }) => {
|
|
395
395
|
let l = a(), u = e ?? l, d = n ? `${u}-description` : void 0, m = r ? `${u}-error` : void 0;
|
|
396
396
|
return /* @__PURE__ */ p("div", {
|
|
397
|
-
className:
|
|
397
|
+
className: M(q.wrapper, { [q.disabled]: o }, c),
|
|
398
398
|
"data-disabled": o || void 0,
|
|
399
399
|
"data-invalid": !!r || void 0,
|
|
400
400
|
children: [
|
|
@@ -457,7 +457,7 @@ var xe = Object.assign(be, {
|
|
|
457
457
|
})]
|
|
458
458
|
}), /* @__PURE__ */ f("div", {
|
|
459
459
|
id: g,
|
|
460
|
-
className:
|
|
460
|
+
className: M(J.group, J[m], d),
|
|
461
461
|
role: "radiogroup",
|
|
462
462
|
"aria-labelledby": _,
|
|
463
463
|
"aria-required": c || void 0,
|
|
@@ -467,7 +467,7 @@ var xe = Object.assign(be, {
|
|
|
467
467
|
let t = `${h}-${e.value}`, n = l || e.disabled;
|
|
468
468
|
return /* @__PURE__ */ p("label", {
|
|
469
469
|
htmlFor: t,
|
|
470
|
-
className:
|
|
470
|
+
className: M(J.option, { [J.disabled]: n }),
|
|
471
471
|
children: [
|
|
472
472
|
/* @__PURE__ */ f("input", {
|
|
473
473
|
id: t,
|
|
@@ -509,7 +509,7 @@ var we = {
|
|
|
509
509
|
role: "option",
|
|
510
510
|
"aria-selected": t,
|
|
511
511
|
"aria-disabled": o || void 0,
|
|
512
|
-
className:
|
|
512
|
+
className: M(we.option, {
|
|
513
513
|
[we.selected]: t,
|
|
514
514
|
[we.active]: n,
|
|
515
515
|
[we.disabled]: o
|
|
@@ -527,7 +527,7 @@ Te.displayName = "SelectOption";
|
|
|
527
527
|
var Ee = {
|
|
528
528
|
dropdown: "_dropdown_1vrjb_1",
|
|
529
529
|
dropdownIn: "_dropdownIn_1vrjb_1"
|
|
530
|
-
}, De = ({ isOpen: e, listboxId: t, labelledById: n, setDropdownRef: r, style: i, options: a, selectedValue: o, activeIndex: s, onSelect: c, onMouseEnter: l }) => e ? /* @__PURE__ */ f(
|
|
530
|
+
}, De = ({ isOpen: e, listboxId: t, labelledById: n, setDropdownRef: r, style: i, options: a, selectedValue: o, activeIndex: s, onSelect: c, onMouseEnter: l }) => e ? /* @__PURE__ */ f(N, { children: /* @__PURE__ */ f("ul", {
|
|
531
531
|
ref: r,
|
|
532
532
|
id: t,
|
|
533
533
|
role: "listbox",
|
|
@@ -566,73 +566,73 @@ var Y = {
|
|
|
566
566
|
"aria-controls": n ? a : void 0,
|
|
567
567
|
"aria-describedby": t,
|
|
568
568
|
"aria-activedescendant": n && o >= 0 ? `${a}-option-${o}` : void 0,
|
|
569
|
-
className:
|
|
569
|
+
className: M(Y.control, {
|
|
570
570
|
[Y.error]: !!c,
|
|
571
571
|
[Y.disabled]: r
|
|
572
572
|
}),
|
|
573
573
|
onClick: m,
|
|
574
574
|
onKeyDown: h,
|
|
575
575
|
children: [/* @__PURE__ */ f("span", {
|
|
576
|
-
className:
|
|
576
|
+
className: M(Y.value, { [Y.placeholder]: u }),
|
|
577
577
|
children: l
|
|
578
578
|
}), /* @__PURE__ */ f("span", {
|
|
579
|
-
className:
|
|
579
|
+
className: M(Y.arrow, { [Y.open]: n }),
|
|
580
580
|
"aria-hidden": "true",
|
|
581
|
-
children: /* @__PURE__ */ f(
|
|
581
|
+
children: /* @__PURE__ */ f(k, {})
|
|
582
582
|
})]
|
|
583
583
|
});
|
|
584
584
|
Oe.displayName = "SelectTrigger";
|
|
585
585
|
//#endregion
|
|
586
586
|
//#region src/components/Select/Select.tsx
|
|
587
587
|
var ke = ({ label: e, description: t, id: r, name: i, value: l, defaultValue: u, onChange: d, options: m, placeholder: h = "Select...", required: g = !1, disabled: _ = !1, error: v, className: y }) => {
|
|
588
|
-
let b = a(), x = r ?? b, S = `${x}-listbox`, C = v ? `${x}-error` : void 0, w = s(null),
|
|
588
|
+
let b = a(), x = r ?? b, S = `${x}-listbox`, C = v ? `${x}-error` : void 0, w = s(null), D = s(null), [O, k] = T({
|
|
589
589
|
value: l,
|
|
590
590
|
defaultValue: u ?? "",
|
|
591
591
|
onChange: d
|
|
592
|
-
}), [
|
|
593
|
-
open:
|
|
592
|
+
}), [A, j] = c(!1), [M, N] = c(-1), P = o(() => m.find((e) => e.value === O), [m, O]), F = !!P, { floatingStyles: I, setRef: R, setFloatingRef: z } = ee({
|
|
593
|
+
open: A,
|
|
594
594
|
matchTriggerWidth: !0,
|
|
595
595
|
mobileSheetBreakpoint: 640
|
|
596
|
-
}),
|
|
597
|
-
let e = m.findIndex((e) => e.value ===
|
|
596
|
+
}), B = n(() => {
|
|
597
|
+
let e = m.findIndex((e) => e.value === O && !e.disabled);
|
|
598
598
|
return e >= 0 ? e : m.findIndex((e) => !e.disabled);
|
|
599
|
-
}, [m,
|
|
600
|
-
_ || (
|
|
601
|
-
}, [_,
|
|
602
|
-
|
|
603
|
-
}, []),
|
|
599
|
+
}, [m, O]), V = n(() => {
|
|
600
|
+
_ || (N(B()), j(!0));
|
|
601
|
+
}, [_, B]), H = n(() => {
|
|
602
|
+
j(!1);
|
|
603
|
+
}, []), U = n(() => {
|
|
604
604
|
if (!_) {
|
|
605
|
-
if (
|
|
606
|
-
|
|
605
|
+
if (A) {
|
|
606
|
+
H();
|
|
607
607
|
return;
|
|
608
608
|
}
|
|
609
|
-
|
|
609
|
+
V();
|
|
610
610
|
}
|
|
611
611
|
}, [
|
|
612
|
-
|
|
612
|
+
H,
|
|
613
613
|
_,
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
]),
|
|
617
|
-
|
|
618
|
-
}, [
|
|
619
|
-
activeIndex:
|
|
620
|
-
setActiveIndex:
|
|
614
|
+
A,
|
|
615
|
+
V
|
|
616
|
+
]), W = n((e) => {
|
|
617
|
+
k(e), H(), w.current?.focus();
|
|
618
|
+
}, [H, k]), { onKeyDown: te } = E({
|
|
619
|
+
activeIndex: M,
|
|
620
|
+
setActiveIndex: N,
|
|
621
621
|
items: m,
|
|
622
|
-
isOpen:
|
|
623
|
-
onOpen:
|
|
624
|
-
onClose:
|
|
622
|
+
isOpen: A,
|
|
623
|
+
onOpen: V,
|
|
624
|
+
onClose: H,
|
|
625
625
|
onSelect: () => {
|
|
626
|
-
let e = m[
|
|
627
|
-
!e || e.disabled ||
|
|
626
|
+
let e = m[M];
|
|
627
|
+
!e || e.disabled || W(e.value);
|
|
628
628
|
}
|
|
629
629
|
});
|
|
630
|
-
|
|
631
|
-
let
|
|
632
|
-
w.current = e,
|
|
633
|
-
}, [
|
|
634
|
-
|
|
635
|
-
}, [
|
|
630
|
+
L([w, D], H, A);
|
|
631
|
+
let ne = n((e) => {
|
|
632
|
+
w.current = e, R(e);
|
|
633
|
+
}, [R]), G = n((e) => {
|
|
634
|
+
D.current = e, z(e);
|
|
635
|
+
}, [z]);
|
|
636
636
|
return /* @__PURE__ */ p(Se, {
|
|
637
637
|
id: x,
|
|
638
638
|
label: e,
|
|
@@ -645,36 +645,36 @@ var ke = ({ label: e, description: t, id: r, name: i, value: l, defaultValue: u,
|
|
|
645
645
|
/* @__PURE__ */ f(Oe, {
|
|
646
646
|
id: x,
|
|
647
647
|
errorId: C,
|
|
648
|
-
isOpen:
|
|
648
|
+
isOpen: A,
|
|
649
649
|
disabled: _,
|
|
650
650
|
required: g,
|
|
651
651
|
listboxId: S,
|
|
652
|
-
activeIndex:
|
|
653
|
-
ariaLabel: e ? void 0 :
|
|
652
|
+
activeIndex: M,
|
|
653
|
+
ariaLabel: e ? void 0 : P?.label || h,
|
|
654
654
|
error: v,
|
|
655
|
-
displayText:
|
|
656
|
-
isPlaceholder: !
|
|
657
|
-
buttonRef:
|
|
658
|
-
onClick:
|
|
659
|
-
onKeyDown:
|
|
655
|
+
displayText: P?.label ?? h,
|
|
656
|
+
isPlaceholder: !F,
|
|
657
|
+
buttonRef: ne,
|
|
658
|
+
onClick: U,
|
|
659
|
+
onKeyDown: te
|
|
660
660
|
}),
|
|
661
661
|
i && /* @__PURE__ */ f("input", {
|
|
662
662
|
type: "hidden",
|
|
663
663
|
name: i,
|
|
664
|
-
value:
|
|
664
|
+
value: O,
|
|
665
665
|
disabled: _
|
|
666
666
|
}),
|
|
667
667
|
/* @__PURE__ */ f(De, {
|
|
668
|
-
isOpen:
|
|
668
|
+
isOpen: A,
|
|
669
669
|
listboxId: S,
|
|
670
670
|
labelledById: x,
|
|
671
|
-
style:
|
|
671
|
+
style: I,
|
|
672
672
|
options: m,
|
|
673
|
-
selectedValue:
|
|
674
|
-
activeIndex:
|
|
675
|
-
setDropdownRef:
|
|
676
|
-
onSelect:
|
|
677
|
-
onMouseEnter:
|
|
673
|
+
selectedValue: O,
|
|
674
|
+
activeIndex: M,
|
|
675
|
+
setDropdownRef: G,
|
|
676
|
+
onSelect: W,
|
|
677
|
+
onMouseEnter: N
|
|
678
678
|
})
|
|
679
679
|
]
|
|
680
680
|
});
|
|
@@ -695,7 +695,7 @@ var Ae = e(null), je = () => {
|
|
|
695
695
|
...n,
|
|
696
696
|
role: "tablist",
|
|
697
697
|
"aria-orientation": r,
|
|
698
|
-
className:
|
|
698
|
+
className: M(Me.list, r === "vertical" && Me.vertical, i === "underline" && Me.underline, i === "pills" && Me.pills, t),
|
|
699
699
|
children: e
|
|
700
700
|
});
|
|
701
701
|
};
|
|
@@ -719,7 +719,7 @@ var Pe = {
|
|
|
719
719
|
"aria-labelledby": `tab-${e}`,
|
|
720
720
|
hidden: !l,
|
|
721
721
|
tabIndex: 0,
|
|
722
|
-
className:
|
|
722
|
+
className: M(Pe.panel, o && Pe.visible, a === "vertical" && Pe.vertical, n),
|
|
723
723
|
children: t
|
|
724
724
|
});
|
|
725
725
|
};
|
|
@@ -750,7 +750,7 @@ var X = {
|
|
|
750
750
|
id: `tab-${e}`,
|
|
751
751
|
disabled: i,
|
|
752
752
|
tabIndex: v ? 0 : -1,
|
|
753
|
-
className:
|
|
753
|
+
className: M(X.tab, X[h], m === "vertical" && X.vertical, y && X.withIcon, b && X.iconOnly, r),
|
|
754
754
|
onClick: (t) => {
|
|
755
755
|
i || (d(e), o?.(t));
|
|
756
756
|
},
|
|
@@ -777,7 +777,7 @@ var Le = {
|
|
|
777
777
|
p || d(e), i?.(e);
|
|
778
778
|
}, [p, i]), g = s([]), _ = n((e, t) => {
|
|
779
779
|
g.current[e] = t;
|
|
780
|
-
}, []), { onKeyDown: v } =
|
|
780
|
+
}, []), { onKeyDown: v } = D({
|
|
781
781
|
activeIndex: m,
|
|
782
782
|
setActiveIndex: h,
|
|
783
783
|
tabRefs: g,
|
|
@@ -793,7 +793,7 @@ var Le = {
|
|
|
793
793
|
return /* @__PURE__ */ f(Ae.Provider, {
|
|
794
794
|
value: y,
|
|
795
795
|
children: /* @__PURE__ */ f("div", {
|
|
796
|
-
className:
|
|
796
|
+
className: M(Le.tabs, a === "vertical" && Le.vertical, l),
|
|
797
797
|
children: e
|
|
798
798
|
})
|
|
799
799
|
});
|
|
@@ -823,7 +823,7 @@ var ze = Object.assign(Re, {
|
|
|
823
823
|
};
|
|
824
824
|
return /* @__PURE__ */ p("div", {
|
|
825
825
|
ref: c,
|
|
826
|
-
className:
|
|
826
|
+
className: M(Be.tooltip, a),
|
|
827
827
|
"data-placement": t,
|
|
828
828
|
"data-state": "open",
|
|
829
829
|
style: o,
|
|
@@ -842,38 +842,38 @@ var He = ({ children: e, placement: t = "top", content: n, disabled: r = !1, del
|
|
|
842
842
|
open: 300,
|
|
843
843
|
close: 100
|
|
844
844
|
}, maxWidth: o = 250, className: l, onOpenChange: u }) => {
|
|
845
|
-
let [g, _] = c(!1), v = s(null), y = a(), { context: b, floatingStyles: x, middlewareData: T, setRef:
|
|
845
|
+
let [g, _] = c(!1), v = s(null), y = a(), { context: b, floatingStyles: x, middlewareData: T, setRef: E, setFloatingRef: D, placement: O } = ee({
|
|
846
846
|
open: g,
|
|
847
847
|
onOpenChange: (e) => {
|
|
848
848
|
r || (_(e), u?.(e));
|
|
849
849
|
},
|
|
850
850
|
placement: t,
|
|
851
851
|
middleware: [h({ element: v })]
|
|
852
|
-
}),
|
|
852
|
+
}), k = T.arrow?.x, A = T.arrow?.y, { getReferenceProps: j, getFloatingProps: M } = w([C(b, { delay: {
|
|
853
853
|
open: i.open,
|
|
854
854
|
close: i.close
|
|
855
855
|
} }), S(b)]);
|
|
856
856
|
return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("div", {
|
|
857
|
-
ref:
|
|
857
|
+
ref: E,
|
|
858
858
|
style: { display: "inline-flex" },
|
|
859
859
|
"aria-describedby": g ? y : void 0,
|
|
860
|
-
...
|
|
860
|
+
...j(),
|
|
861
861
|
children: e
|
|
862
862
|
}), /* @__PURE__ */ f(m, { children: g && n && /* @__PURE__ */ f(Ve, {
|
|
863
863
|
id: y,
|
|
864
|
-
ref:
|
|
864
|
+
ref: D,
|
|
865
865
|
content: n,
|
|
866
866
|
arrowRef: v,
|
|
867
|
-
arrowX:
|
|
868
|
-
arrowY:
|
|
867
|
+
arrowX: k,
|
|
868
|
+
arrowY: A,
|
|
869
869
|
role: "tooltip",
|
|
870
870
|
style: {
|
|
871
871
|
...x,
|
|
872
872
|
maxWidth: typeof o == "number" ? `${o}px` : o
|
|
873
873
|
},
|
|
874
|
-
placement:
|
|
874
|
+
placement: O,
|
|
875
875
|
className: l,
|
|
876
|
-
...
|
|
876
|
+
...M()
|
|
877
877
|
}) })] });
|
|
878
878
|
};
|
|
879
879
|
He.displayName = "Tooltip";
|
|
@@ -910,7 +910,7 @@ var Ue = (e, t) => {
|
|
|
910
910
|
onClick: b ? void 0 : h,
|
|
911
911
|
"aria-label": g || void 0,
|
|
912
912
|
"aria-busy": o || void 0,
|
|
913
|
-
className:
|
|
913
|
+
className: M(Z.button, Z[t], Z[n], Z[r], m, {
|
|
914
914
|
[Z.disabled]: b,
|
|
915
915
|
[Z.loading]: o,
|
|
916
916
|
[Z.fullWidth]: u,
|
|
@@ -938,62 +938,118 @@ var Ue = (e, t) => {
|
|
|
938
938
|
});
|
|
939
939
|
We.displayName = "Button";
|
|
940
940
|
var Q = {
|
|
941
|
-
wrapper: "
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
941
|
+
wrapper: "_wrapper_1xtic_1",
|
|
942
|
+
wrapperSm: "_wrapperSm_1xtic_12",
|
|
943
|
+
wrapperMd: "_wrapperMd_1xtic_18",
|
|
944
|
+
wrapperLg: "_wrapperLg_1xtic_24",
|
|
945
|
+
iconOnly: "_iconOnly_1xtic_30",
|
|
946
|
+
container: "_container_1xtic_36",
|
|
947
|
+
containerSm: "_containerSm_1xtic_43",
|
|
948
|
+
containerMd: "_containerMd_1xtic_47",
|
|
949
|
+
containerLg: "_containerLg_1xtic_51",
|
|
950
|
+
input: "_input_1xtic_55",
|
|
951
|
+
customCheckbox: "_customCheckbox_1xtic_67",
|
|
952
|
+
requiredMark: "_requiredMark_1xtic_82",
|
|
953
|
+
checkmark: "_checkmark_1xtic_92",
|
|
954
|
+
indeterminateMark: "_indeterminateMark_1xtic_108",
|
|
955
|
+
label: "_label_1xtic_118",
|
|
956
|
+
descriptionText: "_descriptionText_1xtic_123",
|
|
957
|
+
errorText: "_errorText_1xtic_130",
|
|
958
|
+
labelSm: "_labelSm_1xtic_137",
|
|
959
|
+
labelMd: "_labelMd_1xtic_141",
|
|
960
|
+
labelLg: "_labelLg_1xtic_145",
|
|
961
|
+
indeterminate: "_indeterminate_1xtic_108",
|
|
962
|
+
error: "_error_1xtic_130",
|
|
963
|
+
disabled: "_disabled_1xtic_200"
|
|
964
|
+
}, Ge = {
|
|
965
|
+
sm: Q.labelSm,
|
|
966
|
+
md: Q.labelMd,
|
|
967
|
+
lg: Q.labelLg
|
|
968
|
+
}, Ke = {
|
|
969
|
+
sm: Q.wrapperSm,
|
|
970
|
+
md: Q.wrapperMd,
|
|
971
|
+
lg: Q.wrapperLg
|
|
972
|
+
}, qe = {
|
|
973
|
+
sm: Q.containerSm,
|
|
974
|
+
md: Q.containerMd,
|
|
975
|
+
lg: Q.containerLg
|
|
976
|
+
}, Je = t(({ id: e, label: t, description: r, checked: o, size: c = "md", defaultChecked: l = !1, disabled: u = !1, required: d = !1, indeterminate: m = !1, className: h, wrapperClassName: g, onCheckedChange: _, error: v, "aria-label": y, "aria-labelledby": b, "aria-describedby": x, ...S }, C) => {
|
|
977
|
+
let w = a(), E = e ?? w, D = s(null), k = !!v, A = r ? `${E}-description` : void 0, j = k ? `${E}-error` : void 0, N = [
|
|
978
|
+
x,
|
|
979
|
+
A,
|
|
980
|
+
j
|
|
981
|
+
].filter(Boolean).join(" "), [P, F] = T({
|
|
982
|
+
value: o,
|
|
983
|
+
defaultValue: l,
|
|
984
|
+
onChange: _
|
|
985
|
+
}), I = n((e) => {
|
|
986
|
+
if (D.current = e, typeof C == "function") {
|
|
987
|
+
C(e);
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
C && (C.current = e);
|
|
991
|
+
}, [C]);
|
|
992
|
+
i(() => {
|
|
993
|
+
D.current && (D.current.indeterminate = m);
|
|
994
|
+
}, [m]);
|
|
995
|
+
let ee = (e) => {
|
|
996
|
+
F(e.target.checked);
|
|
997
|
+
};
|
|
998
|
+
return Ue(!!(t || y || b), "Checkbox: an accessible label must be provided through label, aria-label, or aria-labelledby."), /* @__PURE__ */ p("div", {
|
|
999
|
+
className: M(Q.container, qe[c], h),
|
|
1000
|
+
children: [
|
|
1001
|
+
/* @__PURE__ */ p("label", {
|
|
1002
|
+
htmlFor: E,
|
|
1003
|
+
className: M(Q.wrapper, Ke[c], !t && Q.iconOnly, u && Q.disabled, g),
|
|
1004
|
+
children: [
|
|
1005
|
+
/* @__PURE__ */ f("input", {
|
|
1006
|
+
...S,
|
|
1007
|
+
ref: I,
|
|
1008
|
+
id: E,
|
|
1009
|
+
type: "checkbox",
|
|
1010
|
+
checked: P,
|
|
1011
|
+
disabled: u,
|
|
1012
|
+
required: d,
|
|
1013
|
+
onChange: ee,
|
|
1014
|
+
className: Q.input,
|
|
1015
|
+
"aria-label": y,
|
|
1016
|
+
"aria-labelledby": b,
|
|
1017
|
+
"aria-checked": m ? "mixed" : S["aria-checked"],
|
|
1018
|
+
"aria-invalid": k ? !0 : S["aria-invalid"],
|
|
1019
|
+
"aria-describedby": N || void 0
|
|
1020
|
+
}),
|
|
1021
|
+
/* @__PURE__ */ f("span", {
|
|
1022
|
+
className: M(Q.customCheckbox, k && Q.error, m && Q.indeterminate),
|
|
1023
|
+
"aria-hidden": "true",
|
|
1024
|
+
children: m ? /* @__PURE__ */ f("span", { className: Q.indeterminateMark }) : P && /* @__PURE__ */ f("span", {
|
|
1025
|
+
className: Q.checkmark,
|
|
1026
|
+
children: /* @__PURE__ */ f(O, {})
|
|
1027
|
+
})
|
|
1028
|
+
}),
|
|
1029
|
+
t && /* @__PURE__ */ p("span", {
|
|
1030
|
+
className: M(Q.label, Ge[c]),
|
|
1031
|
+
children: [t, d && /* @__PURE__ */ f("span", {
|
|
1032
|
+
className: Q.requiredMark,
|
|
1033
|
+
"aria-hidden": "true",
|
|
1034
|
+
children: "*"
|
|
1035
|
+
})]
|
|
982
1036
|
})
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
1037
|
+
]
|
|
1038
|
+
}),
|
|
1039
|
+
r && /* @__PURE__ */ f("span", {
|
|
1040
|
+
id: A,
|
|
1041
|
+
className: Q.descriptionText,
|
|
1042
|
+
children: r
|
|
1043
|
+
}),
|
|
1044
|
+
k && /* @__PURE__ */ f("span", {
|
|
1045
|
+
id: j,
|
|
1046
|
+
className: Q.errorText,
|
|
1047
|
+
children: v
|
|
1048
|
+
})
|
|
1049
|
+
]
|
|
994
1050
|
});
|
|
995
1051
|
});
|
|
996
|
-
|
|
1052
|
+
Je.displayName = "Checkbox";
|
|
997
1053
|
var $ = {
|
|
998
1054
|
inputWrapper: "_inputWrapper_y9bue_1",
|
|
999
1055
|
input: "_input_y9bue_1",
|
|
@@ -1013,7 +1069,7 @@ var $ = {
|
|
|
1013
1069
|
toneDanger: "_toneDanger_y9bue_169",
|
|
1014
1070
|
toneMuted: "_toneMuted_y9bue_173",
|
|
1015
1071
|
toneInverse: "_toneInverse_y9bue_177"
|
|
1016
|
-
},
|
|
1072
|
+
}, Ye = {
|
|
1017
1073
|
default: $.toneDefault,
|
|
1018
1074
|
primary: $.tonePrimary,
|
|
1019
1075
|
secondary: $.toneSecondary,
|
|
@@ -1021,7 +1077,7 @@ var $ = {
|
|
|
1021
1077
|
danger: $.toneDanger,
|
|
1022
1078
|
muted: $.toneMuted,
|
|
1023
1079
|
inverse: $.toneInverse
|
|
1024
|
-
},
|
|
1080
|
+
}, Xe = (e = "text", t) => {
|
|
1025
1081
|
if (t) return t;
|
|
1026
1082
|
switch (e) {
|
|
1027
1083
|
case "email": return "email";
|
|
@@ -1031,86 +1087,86 @@ var $ = {
|
|
|
1031
1087
|
case "search": return "off";
|
|
1032
1088
|
default: return;
|
|
1033
1089
|
}
|
|
1034
|
-
},
|
|
1035
|
-
let
|
|
1036
|
-
|
|
1037
|
-
i ? `${
|
|
1038
|
-
g ? `${
|
|
1039
|
-
].filter(Boolean).join(" "),
|
|
1040
|
-
if (
|
|
1041
|
-
|
|
1090
|
+
}, Ze = t(({ id: e, label: t, name: r, description: i, placeholder: o, value: l, defaultValue: u, onChange: d, type: m = "text", size: h = "md", error: g, disabled: _ = !1, required: v = !1, className: y, autoComplete: b, readOnly: x = !1, clearable: S = !1, onClear: C, leftAdornment: w, rightAdornment: T, clearIcon: E, leftAdornmentTone: D = "default", rightAdornmentTone: O = "default", clearIconTone: k = "danger", autoFocus: A, maxLength: j, onMouseEnter: N, onMouseLeave: P, "aria-describedby": F, "aria-invalid": I, ...ee }, L) => {
|
|
1091
|
+
let R = a(), z = e ?? R, B = s(null), [V, H] = c(u ?? ""), U = l !== void 0, W = U ? l : V, te = W !== "", ne = Xe(m, b), G = S && te && !_ && !x, re = [
|
|
1092
|
+
F,
|
|
1093
|
+
i ? `${z}-description` : void 0,
|
|
1094
|
+
g ? `${z}-error` : void 0
|
|
1095
|
+
].filter(Boolean).join(" "), ie = E ?? "×", ae = n((e) => {
|
|
1096
|
+
if (B.current = e, typeof L == "function") {
|
|
1097
|
+
L(e);
|
|
1042
1098
|
return;
|
|
1043
1099
|
}
|
|
1044
|
-
|
|
1045
|
-
}, [
|
|
1100
|
+
L && (L.current = e);
|
|
1101
|
+
}, [L]), oe = n((e) => {
|
|
1046
1102
|
let t = e.target.value;
|
|
1047
|
-
|
|
1048
|
-
}, [
|
|
1049
|
-
|
|
1050
|
-
}, [
|
|
1103
|
+
U || H(t), d?.(e);
|
|
1104
|
+
}, [U, d]), se = n(() => {
|
|
1105
|
+
U || H(""), C?.(), B.current?.focus();
|
|
1106
|
+
}, [U, C]), ce = !G && !!T;
|
|
1051
1107
|
return /* @__PURE__ */ f(Se, {
|
|
1052
|
-
id:
|
|
1108
|
+
id: z,
|
|
1053
1109
|
label: t,
|
|
1054
1110
|
description: i,
|
|
1055
1111
|
error: g,
|
|
1056
1112
|
required: v,
|
|
1057
1113
|
disabled: _,
|
|
1058
1114
|
children: /* @__PURE__ */ p("div", {
|
|
1059
|
-
className:
|
|
1115
|
+
className: M($.inputWrapper, {
|
|
1060
1116
|
[$.hasLeftAdornment]: !!w,
|
|
1061
|
-
[$.hasRightAdornment]: !!T ||
|
|
1117
|
+
[$.hasRightAdornment]: !!T || G
|
|
1062
1118
|
}),
|
|
1063
1119
|
children: [
|
|
1064
1120
|
w && /* @__PURE__ */ f("span", {
|
|
1065
1121
|
"aria-hidden": "true",
|
|
1066
|
-
className:
|
|
1122
|
+
className: M($.leftAdornment, Ye[D]),
|
|
1067
1123
|
children: w
|
|
1068
1124
|
}),
|
|
1069
1125
|
/* @__PURE__ */ f("input", {
|
|
1070
|
-
...
|
|
1071
|
-
ref:
|
|
1072
|
-
id:
|
|
1126
|
+
...ee,
|
|
1127
|
+
ref: ae,
|
|
1128
|
+
id: z,
|
|
1073
1129
|
name: r,
|
|
1074
1130
|
type: m,
|
|
1075
|
-
autoComplete:
|
|
1076
|
-
className:
|
|
1077
|
-
value:
|
|
1078
|
-
onChange:
|
|
1131
|
+
autoComplete: ne,
|
|
1132
|
+
className: M($.input, $[h], { [$.error]: !!g }, y),
|
|
1133
|
+
value: W,
|
|
1134
|
+
onChange: oe,
|
|
1079
1135
|
placeholder: o,
|
|
1080
1136
|
disabled: _,
|
|
1081
1137
|
readOnly: x,
|
|
1082
1138
|
required: v,
|
|
1083
|
-
autoFocus:
|
|
1084
|
-
maxLength:
|
|
1085
|
-
"aria-invalid": g ? !0 :
|
|
1086
|
-
"aria-describedby":
|
|
1087
|
-
onMouseEnter:
|
|
1088
|
-
onMouseLeave:
|
|
1139
|
+
autoFocus: A,
|
|
1140
|
+
maxLength: j,
|
|
1141
|
+
"aria-invalid": g ? !0 : I,
|
|
1142
|
+
"aria-describedby": re || void 0,
|
|
1143
|
+
onMouseEnter: N,
|
|
1144
|
+
onMouseLeave: P
|
|
1089
1145
|
}),
|
|
1090
|
-
|
|
1146
|
+
G && /* @__PURE__ */ f("button", {
|
|
1091
1147
|
type: "button",
|
|
1092
|
-
className:
|
|
1093
|
-
onClick:
|
|
1148
|
+
className: M($.clearButton, Ye[k]),
|
|
1149
|
+
onClick: se,
|
|
1094
1150
|
"aria-label": "Clear input",
|
|
1095
|
-
children:
|
|
1151
|
+
children: ie
|
|
1096
1152
|
}),
|
|
1097
1153
|
ce && /* @__PURE__ */ f("div", {
|
|
1098
|
-
className:
|
|
1154
|
+
className: M($.rightAdornment, Ye[O]),
|
|
1099
1155
|
children: T
|
|
1100
1156
|
})
|
|
1101
1157
|
]
|
|
1102
1158
|
})
|
|
1103
1159
|
});
|
|
1104
1160
|
});
|
|
1105
|
-
|
|
1161
|
+
Ze.displayName = "Input";
|
|
1106
1162
|
//#endregion
|
|
1107
1163
|
//#region src/theme/ThemeContext.ts
|
|
1108
|
-
var
|
|
1164
|
+
var Qe = e(null), $e = (e) => e === "highContrast" ? "high-contrast" : e, et = ({ theme: e, defaultTheme: t = "light", onThemeChange: n, children: r }) => {
|
|
1109
1165
|
let [a, s] = T({
|
|
1110
1166
|
value: e,
|
|
1111
1167
|
defaultValue: t,
|
|
1112
1168
|
onChange: n
|
|
1113
|
-
}), c =
|
|
1169
|
+
}), c = $e(a);
|
|
1114
1170
|
i(() => {
|
|
1115
1171
|
if (typeof document > "u") return;
|
|
1116
1172
|
let { documentElement: e } = document, t = e.dataset.velliraTheme;
|
|
@@ -1126,7 +1182,7 @@ var Ye = e(null), Xe = (e) => e === "highContrast" ? "high-contrast" : e, Ze = (
|
|
|
1126
1182
|
theme: a,
|
|
1127
1183
|
setTheme: s
|
|
1128
1184
|
}), [a, s]);
|
|
1129
|
-
return /* @__PURE__ */ f(
|
|
1185
|
+
return /* @__PURE__ */ f(Qe.Provider, {
|
|
1130
1186
|
value: l,
|
|
1131
1187
|
children: /* @__PURE__ */ f("div", {
|
|
1132
1188
|
"data-vellira-theme": c,
|
|
@@ -1134,13 +1190,13 @@ var Ye = e(null), Xe = (e) => e === "highContrast" ? "high-contrast" : e, Ze = (
|
|
|
1134
1190
|
})
|
|
1135
1191
|
});
|
|
1136
1192
|
};
|
|
1137
|
-
|
|
1193
|
+
et.displayName = "ThemeProvider";
|
|
1138
1194
|
//#endregion
|
|
1139
1195
|
//#region src/theme/useTheme.ts
|
|
1140
|
-
function
|
|
1141
|
-
let e = r(
|
|
1196
|
+
function tt() {
|
|
1197
|
+
let e = r(Qe);
|
|
1142
1198
|
if (!e) throw Error("useTheme must be used within ThemeProvider.");
|
|
1143
1199
|
return e;
|
|
1144
1200
|
}
|
|
1145
1201
|
//#endregion
|
|
1146
|
-
export { We as Button,
|
|
1202
|
+
export { We as Button, Je as Checkbox, ae as Dropdown, Se as FormField, Ze as Input, xe as Modal, Ce as RadioGroup, ke as Select, ze as Tabs, et as ThemeProvider, He as Tooltip, tt as useTheme };
|