@vellira-ui/react 2.21.0 → 2.22.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 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +340 -273
- package/dist/styles.css +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var M = (...e) => l(e), N = ({ children: e }) => {
|
|
|
17
17
|
}, P = {
|
|
18
18
|
dropdown: "_dropdown_6pgxt_1",
|
|
19
19
|
dropdownIn: "_dropdownIn_6pgxt_1"
|
|
20
|
-
},
|
|
20
|
+
}, ee = 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",
|
|
@@ -30,10 +30,10 @@ var M = (...e) => l(e), N = ({ children: e }) => {
|
|
|
30
30
|
className: M(P.dropdown, s),
|
|
31
31
|
children: e
|
|
32
32
|
}) }));
|
|
33
|
-
|
|
33
|
+
ee.displayName = "DropdownContent";
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region src/hooks/useFloatingPosition.ts
|
|
36
|
-
var
|
|
36
|
+
var F = (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 I = (e) => {
|
|
|
42
42
|
t.removeEventListener("change", r);
|
|
43
43
|
};
|
|
44
44
|
}, [e]), t;
|
|
45
|
-
},
|
|
46
|
-
let l =
|
|
45
|
+
}, I = ({ open: e, onOpenChange: t, placement: n = "bottom-start", strategy: r = "fixed", matchTriggerWidth: a = !1, mobileSheetBreakpoint: s, middleware: c = [] } = {}) => {
|
|
46
|
+
let l = F(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,
|
|
@@ -88,11 +88,11 @@ var I = (e) => {
|
|
|
88
88
|
};
|
|
89
89
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
90
90
|
}, [n]);
|
|
91
|
-
}, L = { group: "_group_1yomt_1" },
|
|
91
|
+
}, L = { group: "_group_1yomt_1" }, R = ({ label: e }) => /* @__PURE__ */ f("li", {
|
|
92
92
|
role: "presentation",
|
|
93
93
|
className: L.group,
|
|
94
94
|
children: e
|
|
95
|
-
}),
|
|
95
|
+
}), z = {
|
|
96
96
|
item: "_item_t87eq_1",
|
|
97
97
|
disabled: "_disabled_t87eq_18",
|
|
98
98
|
active: "_active_t87eq_28",
|
|
@@ -103,7 +103,7 @@ var I = (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
|
+
}, B = ({ 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 I = (e) => {
|
|
|
114
114
|
"data-danger": i || void 0,
|
|
115
115
|
onClick: a ? void 0 : s,
|
|
116
116
|
onMouseEnter: a ? void 0 : c,
|
|
117
|
-
className: M(
|
|
118
|
-
[
|
|
119
|
-
[
|
|
120
|
-
[
|
|
117
|
+
className: M(z.item, {
|
|
118
|
+
[z.active]: o,
|
|
119
|
+
[z.disabled]: a,
|
|
120
|
+
[z.danger]: i
|
|
121
121
|
}, d),
|
|
122
122
|
children: [
|
|
123
123
|
r && /* @__PURE__ */ f("span", {
|
|
124
124
|
"aria-hidden": "true",
|
|
125
|
-
className:
|
|
125
|
+
className: z.itemIcon,
|
|
126
126
|
children: r
|
|
127
127
|
}),
|
|
128
128
|
m && /* @__PURE__ */ f("span", {
|
|
129
|
-
className: M(
|
|
129
|
+
className: M(z.itemText, z[`itemText--${u}`]),
|
|
130
130
|
children: m
|
|
131
131
|
}),
|
|
132
132
|
l && /* @__PURE__ */ f("span", {
|
|
133
|
-
className:
|
|
133
|
+
className: z.itemShortcut,
|
|
134
134
|
children: l
|
|
135
135
|
})
|
|
136
136
|
]
|
|
137
137
|
});
|
|
138
|
-
},
|
|
138
|
+
}, V = { group: "_group_ts4nb_1" }, H = () => /* @__PURE__ */ f("li", {
|
|
139
139
|
role: "separator",
|
|
140
|
-
className:
|
|
140
|
+
className: V.separator,
|
|
141
141
|
"aria-hidden": "true"
|
|
142
|
-
}),
|
|
142
|
+
}), U = {
|
|
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
|
-
},
|
|
149
|
+
}, W = t(({ children: e, isOpen: t, icon: n, arrowIcon: r, showArrow: i = !0, rotateAngle: a = 90, label: o, className: s, ...c }, l) => {
|
|
150
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: M(
|
|
156
|
-
[
|
|
157
|
-
[
|
|
155
|
+
className: M(U.button, {
|
|
156
|
+
[U.disabled]: c.disabled,
|
|
157
|
+
[U.iconOnly]: m
|
|
158
158
|
}, s),
|
|
159
159
|
"aria-label": _,
|
|
160
160
|
"aria-expanded": t,
|
|
@@ -163,36 +163,36 @@ var I = (e) => {
|
|
|
163
163
|
children: [
|
|
164
164
|
u && /* @__PURE__ */ f("span", {
|
|
165
165
|
"aria-hidden": "true",
|
|
166
|
-
className:
|
|
166
|
+
className: U.iconLeft,
|
|
167
167
|
children: n
|
|
168
168
|
}),
|
|
169
169
|
e,
|
|
170
170
|
h && /* @__PURE__ */ f("span", {
|
|
171
171
|
"aria-hidden": "true",
|
|
172
|
-
className: M(
|
|
172
|
+
className: M(U.arrow, { [U.open]: t }),
|
|
173
173
|
children: g
|
|
174
174
|
})
|
|
175
175
|
]
|
|
176
176
|
});
|
|
177
177
|
});
|
|
178
|
-
|
|
178
|
+
W.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: D, setRef: O, setFloatingRef: k } =
|
|
181
|
+
var ne = (e) => e.type !== "group" && e.type !== "separator", G = (e) => e.type === "group", re = (e) => e.type === "separator", K = { wrapper: "_wrapper_14ue8_1" }, ie = ({ 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 } = I({
|
|
183
183
|
placement: d,
|
|
184
184
|
matchTriggerWidth: m,
|
|
185
185
|
mobileSheetBreakpoint: 640
|
|
186
|
-
}), A = r.filter(
|
|
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
189
|
return x(t ? N() : -1), t;
|
|
190
190
|
});
|
|
191
|
-
},
|
|
191
|
+
}, F = () => {
|
|
192
192
|
y(!1), x(-1);
|
|
193
193
|
}, L = () => {
|
|
194
|
-
|
|
195
|
-
}, { onKeyDown:
|
|
194
|
+
F(), S.current?.focus();
|
|
195
|
+
}, { onKeyDown: z } = E({
|
|
196
196
|
activeIndex: b,
|
|
197
197
|
setActiveIndex: x,
|
|
198
198
|
items: A,
|
|
@@ -204,16 +204,16 @@ var ae = (e) => e.type !== "group" && e.type !== "separator", oe = (e) => e.type
|
|
|
204
204
|
},
|
|
205
205
|
onClose: L
|
|
206
206
|
});
|
|
207
|
-
te([S, C], () =>
|
|
208
|
-
let
|
|
207
|
+
te([S, C], () => F(), v);
|
|
208
|
+
let V = (e) => {
|
|
209
209
|
S.current = e, O(e);
|
|
210
|
-
},
|
|
210
|
+
}, U = (e) => {
|
|
211
211
|
C.current = e, k(e), e?.focus();
|
|
212
212
|
};
|
|
213
213
|
return /* @__PURE__ */ p("div", {
|
|
214
|
-
className: M(
|
|
215
|
-
children: [/* @__PURE__ */ f(
|
|
216
|
-
ref:
|
|
214
|
+
className: M(K.wrapper, o),
|
|
215
|
+
children: [/* @__PURE__ */ f(W, {
|
|
216
|
+
ref: V,
|
|
217
217
|
id: T,
|
|
218
218
|
isOpen: v,
|
|
219
219
|
disabled: l,
|
|
@@ -223,25 +223,25 @@ var ae = (e) => e.type !== "group" && e.type !== "separator", oe = (e) => e.type
|
|
|
223
223
|
arrowIcon: _,
|
|
224
224
|
rotateAngle: u,
|
|
225
225
|
onClick: P,
|
|
226
|
-
onKeyDown:
|
|
226
|
+
onKeyDown: z,
|
|
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:
|
|
231
|
+
}), v && /* @__PURE__ */ f(ee, {
|
|
232
|
+
ref: U,
|
|
233
233
|
floatingStyles: D,
|
|
234
234
|
menuId: w,
|
|
235
235
|
labelledById: n ? T : void 0,
|
|
236
236
|
label: n ? void 0 : e,
|
|
237
237
|
activeDescendantId: j,
|
|
238
|
-
onKeyDown:
|
|
238
|
+
onKeyDown: z,
|
|
239
239
|
children: r.map((e, t) => {
|
|
240
|
-
if (
|
|
241
|
-
if (
|
|
242
|
-
if (
|
|
240
|
+
if (G(e)) return /* @__PURE__ */ f(R, { label: e.label }, `group-${e.label}`);
|
|
241
|
+
if (re(e)) return /* @__PURE__ */ f(H, {}, `separator-${t}`);
|
|
242
|
+
if (ne(e)) {
|
|
243
243
|
let t = A.findIndex((t) => t === e);
|
|
244
|
-
return /* @__PURE__ */ f(
|
|
244
|
+
return /* @__PURE__ */ f(B, {
|
|
245
245
|
id: `${w}-item-${t}`,
|
|
246
246
|
...e,
|
|
247
247
|
active: b === t,
|
|
@@ -258,78 +258,78 @@ var ae = (e) => e.type !== "group" && e.type !== "separator", oe = (e) => e.type
|
|
|
258
258
|
})
|
|
259
259
|
})]
|
|
260
260
|
});
|
|
261
|
-
},
|
|
262
|
-
let e = r(
|
|
261
|
+
}, ae = e(void 0), oe = () => {
|
|
262
|
+
let e = r(ae);
|
|
263
263
|
if (e === void 0) throw Error("Modal compound components must be used inside Modal");
|
|
264
264
|
return e;
|
|
265
265
|
};
|
|
266
|
-
|
|
267
|
-
var
|
|
268
|
-
let { descriptionId: t } =
|
|
266
|
+
ae.displayName = "ModalContext";
|
|
267
|
+
var se = { modalBody: "_modalBody_iv33a_1" }, ce = ({ children: e }) => {
|
|
268
|
+
let { descriptionId: t } = oe();
|
|
269
269
|
return /* @__PURE__ */ f("div", {
|
|
270
270
|
id: t,
|
|
271
|
-
className:
|
|
271
|
+
className: se.modalBody,
|
|
272
272
|
children: e
|
|
273
273
|
});
|
|
274
274
|
};
|
|
275
|
-
|
|
276
|
-
var
|
|
277
|
-
className:
|
|
275
|
+
ce.displayName = "ModalBody";
|
|
276
|
+
var le = { content: "_content_avpai_1" }, ue = ({ children: e }) => /* @__PURE__ */ f("div", {
|
|
277
|
+
className: le.content,
|
|
278
278
|
children: e
|
|
279
279
|
});
|
|
280
|
-
|
|
281
|
-
var
|
|
282
|
-
className:
|
|
280
|
+
ue.displayName = "ModalContent";
|
|
281
|
+
var de = { modalFooter: "_modalFooter_ezys6_1" }, fe = ({ children: e }) => /* @__PURE__ */ f("div", {
|
|
282
|
+
className: de.modalFooter,
|
|
283
283
|
children: e
|
|
284
284
|
});
|
|
285
|
-
|
|
286
|
-
var
|
|
285
|
+
fe.displayName = "ModalFooter";
|
|
286
|
+
var pe = {
|
|
287
287
|
modalHeader: "_modalHeader_155d7_1",
|
|
288
288
|
modalHeaderTitle: "_modalHeaderTitle_155d7_8",
|
|
289
289
|
modalHeaderCloseButton: "_modalHeaderCloseButton_155d7_15"
|
|
290
|
-
},
|
|
291
|
-
let { onClose: t, titleId: n } =
|
|
290
|
+
}, me = ({ children: e }) => {
|
|
291
|
+
let { onClose: t, titleId: n } = oe();
|
|
292
292
|
return /* @__PURE__ */ p("div", {
|
|
293
|
-
className:
|
|
293
|
+
className: pe.modalHeader,
|
|
294
294
|
children: [/* @__PURE__ */ f("h2", {
|
|
295
295
|
id: n,
|
|
296
|
-
className:
|
|
296
|
+
className: pe.modalHeaderTitle,
|
|
297
297
|
children: e
|
|
298
298
|
}), t && /* @__PURE__ */ f("button", {
|
|
299
299
|
type: "button",
|
|
300
|
-
className:
|
|
300
|
+
className: pe.modalHeaderCloseButton,
|
|
301
301
|
onClick: t,
|
|
302
302
|
"aria-label": "Close modal",
|
|
303
303
|
children: /* @__PURE__ */ f(A, { size: 16 })
|
|
304
304
|
})]
|
|
305
305
|
});
|
|
306
306
|
};
|
|
307
|
-
|
|
307
|
+
me.displayName = "ModalHeader";
|
|
308
308
|
//#endregion
|
|
309
309
|
//#region src/hooks/useModalKeyboard.ts
|
|
310
|
-
var
|
|
310
|
+
var he = ({ isOpen: e, onClose: t }) => {
|
|
311
311
|
let r = n((n) => {
|
|
312
312
|
e && n.key === "Escape" && (n.preventDefault(), t?.());
|
|
313
313
|
}, [e, t]);
|
|
314
314
|
i(() => (document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r)), [r]);
|
|
315
|
-
},
|
|
315
|
+
}, ge = {
|
|
316
316
|
overlay: "_overlay_1xotg_1",
|
|
317
317
|
"overlay--open": "_overlay--open_1xotg_13",
|
|
318
318
|
"overlay--animated": "_overlay--animated_1xotg_17",
|
|
319
319
|
modal: "_modal_1xotg_21"
|
|
320
|
-
},
|
|
321
|
-
let p = o ?? c ?? !0, m = s(null), { titleId: h, descriptionId: g } =
|
|
320
|
+
}, _e = 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 } = oe(), _ = n((e) => {
|
|
322
322
|
p && e.target === e.currentTarget && t?.();
|
|
323
323
|
}, [p, t]);
|
|
324
|
-
return
|
|
324
|
+
return he({
|
|
325
325
|
isOpen: r,
|
|
326
326
|
onClose: l ? t : void 0
|
|
327
327
|
}), i(() => {
|
|
328
|
-
if (r) return
|
|
329
|
-
|
|
328
|
+
if (r) return _e === 0 && (ve = document.body.style.overflow), _e += 1, document.body.style.overflow = "hidden", () => {
|
|
329
|
+
_e = Math.max(0, _e - 1), _e === 0 && (document.body.style.overflow = ve);
|
|
330
330
|
};
|
|
331
331
|
}, [r]), !r && !d ? null : /* @__PURE__ */ f(N, { children: /* @__PURE__ */ f("div", {
|
|
332
|
-
className: M(
|
|
332
|
+
className: M(ge.overlay, r && ge["overlay--open"], d && ge["overlay--animated"], a),
|
|
333
333
|
onClick: _,
|
|
334
334
|
tabIndex: -1,
|
|
335
335
|
role: "presentation",
|
|
@@ -345,7 +345,7 @@ var be = ({ isOpen: e, onClose: t }) => {
|
|
|
345
345
|
children: /* @__PURE__ */ f("div", {
|
|
346
346
|
ref: m,
|
|
347
347
|
tabIndex: -1,
|
|
348
|
-
className:
|
|
348
|
+
className: ge.modal,
|
|
349
349
|
role: "dialog",
|
|
350
350
|
"aria-modal": "true",
|
|
351
351
|
"aria-labelledby": h,
|
|
@@ -355,35 +355,35 @@ var be = ({ isOpen: e, onClose: t }) => {
|
|
|
355
355
|
})
|
|
356
356
|
}) });
|
|
357
357
|
};
|
|
358
|
-
|
|
358
|
+
ye.displayName = "ModalOverlay";
|
|
359
359
|
//#endregion
|
|
360
360
|
//#region src/components/Modal/Modal.tsx
|
|
361
|
-
var
|
|
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(ae.Provider, {
|
|
364
364
|
value: {
|
|
365
365
|
onClose: n,
|
|
366
366
|
titleId: s,
|
|
367
367
|
descriptionId: c
|
|
368
368
|
},
|
|
369
|
-
children: /* @__PURE__ */ f(
|
|
369
|
+
children: /* @__PURE__ */ f(ye, {
|
|
370
370
|
isOpen: e,
|
|
371
371
|
onClose: n,
|
|
372
372
|
closeOnBackdrop: r ?? i,
|
|
373
373
|
closeOnEsc: o,
|
|
374
|
-
children: /* @__PURE__ */ f(
|
|
374
|
+
children: /* @__PURE__ */ f(ue, { children: t })
|
|
375
375
|
})
|
|
376
376
|
}) : null;
|
|
377
377
|
};
|
|
378
|
-
|
|
378
|
+
be.displayName = "Modal";
|
|
379
379
|
//#endregion
|
|
380
380
|
//#region src/components/Modal/index.ts
|
|
381
|
-
var
|
|
382
|
-
Header:
|
|
383
|
-
Body:
|
|
384
|
-
Content:
|
|
385
|
-
Footer:
|
|
386
|
-
}),
|
|
381
|
+
var xe = Object.assign(be, {
|
|
382
|
+
Header: me,
|
|
383
|
+
Body: ce,
|
|
384
|
+
Content: ue,
|
|
385
|
+
Footer: fe
|
|
386
|
+
}), q = {
|
|
387
387
|
wrapper: "_wrapper_14t1p_1",
|
|
388
388
|
label: "_label_14t1p_9",
|
|
389
389
|
required: "_required_14t1p_20",
|
|
@@ -391,40 +391,40 @@ var we = Object.assign(Ce, {
|
|
|
391
391
|
control: "_control_14t1p_32",
|
|
392
392
|
errorText: "_errorText_14t1p_38",
|
|
393
393
|
disabled: "_disabled_14t1p_45"
|
|
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: M(
|
|
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: [
|
|
401
401
|
t && /* @__PURE__ */ p("label", {
|
|
402
|
-
className:
|
|
402
|
+
className: q.label,
|
|
403
403
|
htmlFor: u,
|
|
404
404
|
children: [t, i && /* @__PURE__ */ f("span", {
|
|
405
|
-
className:
|
|
405
|
+
className: q.required,
|
|
406
406
|
"aria-hidden": "true",
|
|
407
407
|
children: "*"
|
|
408
408
|
})]
|
|
409
409
|
}),
|
|
410
410
|
n && /* @__PURE__ */ f("span", {
|
|
411
|
-
className:
|
|
411
|
+
className: q.description,
|
|
412
412
|
id: d,
|
|
413
413
|
children: n
|
|
414
414
|
}),
|
|
415
415
|
/* @__PURE__ */ f("div", {
|
|
416
|
-
className:
|
|
416
|
+
className: q.control,
|
|
417
417
|
children: s
|
|
418
418
|
}),
|
|
419
419
|
r && /* @__PURE__ */ f("span", {
|
|
420
|
-
className:
|
|
420
|
+
className: q.errorText,
|
|
421
421
|
id: m,
|
|
422
422
|
role: "alert",
|
|
423
423
|
children: r
|
|
424
424
|
})
|
|
425
425
|
]
|
|
426
426
|
});
|
|
427
|
-
},
|
|
427
|
+
}, J = {
|
|
428
428
|
group: "_group_rncsx_1",
|
|
429
429
|
vertical: "_vertical_rncsx_7",
|
|
430
430
|
horizontal: "_horizontal_rncsx_11",
|
|
@@ -433,13 +433,13 @@ var we = Object.assign(Ce, {
|
|
|
433
433
|
customRadio: "_customRadio_rncsx_30",
|
|
434
434
|
input: "_input_rncsx_35",
|
|
435
435
|
label: "_label_rncsx_86"
|
|
436
|
-
},
|
|
436
|
+
}, Ce = ({ label: e, description: t, value: n, defaultValue: r, onChange: i, options: o, name: s, required: c = !1, disabled: l = !1, error: u, className: d, orientation: m = "vertical" }) => {
|
|
437
437
|
let h = a(), g = `${h}-group`, _ = [t ? `${h}-description` : void 0, u ? `${h}-error` : void 0].filter(Boolean).join(" ") || void 0, [v, y] = T({
|
|
438
438
|
value: n,
|
|
439
439
|
defaultValue: r ?? "",
|
|
440
440
|
onChange: i
|
|
441
441
|
});
|
|
442
|
-
return /* @__PURE__ */ f(
|
|
442
|
+
return /* @__PURE__ */ f(Se, {
|
|
443
443
|
id: h,
|
|
444
444
|
label: e,
|
|
445
445
|
description: t,
|
|
@@ -448,7 +448,7 @@ var we = Object.assign(Ce, {
|
|
|
448
448
|
error: u,
|
|
449
449
|
children: /* @__PURE__ */ f("div", {
|
|
450
450
|
id: g,
|
|
451
|
-
className: M(
|
|
451
|
+
className: M(J.group, J[m], d),
|
|
452
452
|
role: "radiogroup",
|
|
453
453
|
"aria-required": c || void 0,
|
|
454
454
|
"aria-invalid": !!u || void 0,
|
|
@@ -457,7 +457,7 @@ var we = Object.assign(Ce, {
|
|
|
457
457
|
let t = `${h}-${e.value}`, n = l || e.disabled;
|
|
458
458
|
return /* @__PURE__ */ p("label", {
|
|
459
459
|
htmlFor: t,
|
|
460
|
-
className: M(
|
|
460
|
+
className: M(J.option, { [J.disabled]: n }),
|
|
461
461
|
children: [
|
|
462
462
|
/* @__PURE__ */ f("input", {
|
|
463
463
|
id: t,
|
|
@@ -470,14 +470,14 @@ var we = Object.assign(Ce, {
|
|
|
470
470
|
onChange: () => {
|
|
471
471
|
n || y(e.value);
|
|
472
472
|
},
|
|
473
|
-
className:
|
|
473
|
+
className: J.input
|
|
474
474
|
}),
|
|
475
475
|
/* @__PURE__ */ f("span", {
|
|
476
|
-
className:
|
|
476
|
+
className: J.customRadio,
|
|
477
477
|
"aria-hidden": "true"
|
|
478
478
|
}),
|
|
479
479
|
/* @__PURE__ */ f("span", {
|
|
480
|
-
className:
|
|
480
|
+
className: J.label,
|
|
481
481
|
children: e.label
|
|
482
482
|
})
|
|
483
483
|
]
|
|
@@ -486,23 +486,23 @@ var we = Object.assign(Ce, {
|
|
|
486
486
|
})
|
|
487
487
|
});
|
|
488
488
|
};
|
|
489
|
-
|
|
490
|
-
var
|
|
489
|
+
Ce.displayName = "RadioGroup";
|
|
490
|
+
var we = {
|
|
491
491
|
option: "_option_1qm3g_1",
|
|
492
492
|
selected: "_selected_1qm3g_10",
|
|
493
493
|
disabled: "_disabled_1qm3g_10",
|
|
494
494
|
active: "_active_1qm3g_21"
|
|
495
|
-
},
|
|
495
|
+
}, Te = ({ option: e, isSelected: t, isActive: n, optionId: r, onSelect: i, onMouseEnter: a }) => {
|
|
496
496
|
let o = !!e.disabled;
|
|
497
497
|
return /* @__PURE__ */ f("li", {
|
|
498
498
|
id: r,
|
|
499
499
|
role: "option",
|
|
500
500
|
"aria-selected": t,
|
|
501
501
|
"aria-disabled": o || void 0,
|
|
502
|
-
className: M(
|
|
503
|
-
[
|
|
504
|
-
[
|
|
505
|
-
[
|
|
502
|
+
className: M(we.option, {
|
|
503
|
+
[we.selected]: t,
|
|
504
|
+
[we.active]: n,
|
|
505
|
+
[we.disabled]: o
|
|
506
506
|
}),
|
|
507
507
|
onClick: () => {
|
|
508
508
|
o || i(e.value);
|
|
@@ -513,18 +513,18 @@ var q = {
|
|
|
513
513
|
children: e.label
|
|
514
514
|
});
|
|
515
515
|
};
|
|
516
|
-
|
|
517
|
-
var
|
|
516
|
+
Te.displayName = "SelectOption";
|
|
517
|
+
var Ee = {
|
|
518
518
|
dropdown: "_dropdown_1vrjb_1",
|
|
519
519
|
dropdownIn: "_dropdownIn_1vrjb_1"
|
|
520
|
-
},
|
|
520
|
+
}, 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", {
|
|
521
521
|
ref: r,
|
|
522
522
|
id: t,
|
|
523
523
|
role: "listbox",
|
|
524
524
|
"aria-labelledby": n,
|
|
525
|
-
className:
|
|
525
|
+
className: Ee.dropdown,
|
|
526
526
|
style: i,
|
|
527
|
-
children: a.map((e, n) => /* @__PURE__ */ f(
|
|
527
|
+
children: a.map((e, n) => /* @__PURE__ */ f(Te, {
|
|
528
528
|
option: e,
|
|
529
529
|
isSelected: e.value === o,
|
|
530
530
|
isActive: n === s,
|
|
@@ -533,8 +533,8 @@ var De = {
|
|
|
533
533
|
onMouseEnter: () => l(n)
|
|
534
534
|
}, e.value))
|
|
535
535
|
}) }) : null;
|
|
536
|
-
|
|
537
|
-
var
|
|
536
|
+
De.displayName = "SelectDropdown";
|
|
537
|
+
var Y = {
|
|
538
538
|
control: "_control_mmsxg_1",
|
|
539
539
|
disabled: "_disabled_mmsxg_19",
|
|
540
540
|
arrow: "_arrow_mmsxg_24",
|
|
@@ -542,7 +542,7 @@ var J = {
|
|
|
542
542
|
placeholder: "_placeholder_mmsxg_42",
|
|
543
543
|
error: "_error_mmsxg_46",
|
|
544
544
|
open: "_open_mmsxg_87"
|
|
545
|
-
},
|
|
545
|
+
}, Oe = ({ id: e, errorId: t, isOpen: n, disabled: r, required: i, listboxId: a, activeIndex: o, ariaLabel: s, error: c, displayText: l, isPlaceholder: u, buttonRef: d, onClick: m, onKeyDown: h }) => /* @__PURE__ */ p("button", {
|
|
546
546
|
id: e,
|
|
547
547
|
ref: d,
|
|
548
548
|
type: "button",
|
|
@@ -556,74 +556,74 @@ var J = {
|
|
|
556
556
|
"aria-controls": n ? a : void 0,
|
|
557
557
|
"aria-describedby": t,
|
|
558
558
|
"aria-activedescendant": n && o >= 0 ? `${a}-option-${o}` : void 0,
|
|
559
|
-
className: M(
|
|
560
|
-
[
|
|
561
|
-
[
|
|
559
|
+
className: M(Y.control, {
|
|
560
|
+
[Y.error]: !!c,
|
|
561
|
+
[Y.disabled]: r
|
|
562
562
|
}),
|
|
563
563
|
onClick: m,
|
|
564
564
|
onKeyDown: h,
|
|
565
565
|
children: [/* @__PURE__ */ f("span", {
|
|
566
|
-
className: M(
|
|
566
|
+
className: M(Y.value, { [Y.placeholder]: u }),
|
|
567
567
|
children: l
|
|
568
568
|
}), /* @__PURE__ */ f("span", {
|
|
569
|
-
className: M(
|
|
569
|
+
className: M(Y.arrow, { [Y.open]: n }),
|
|
570
570
|
"aria-hidden": "true",
|
|
571
571
|
children: /* @__PURE__ */ f(k, {})
|
|
572
572
|
})]
|
|
573
573
|
});
|
|
574
|
-
|
|
574
|
+
Oe.displayName = "SelectTrigger";
|
|
575
575
|
//#endregion
|
|
576
576
|
//#region src/components/Select/Select.tsx
|
|
577
|
-
var
|
|
577
|
+
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 }) => {
|
|
578
578
|
let b = a(), x = r ?? b, S = `${x}-listbox`, C = v ? `${x}-error` : void 0, w = s(null), D = s(null), [O, k] = T({
|
|
579
579
|
value: l,
|
|
580
580
|
defaultValue: u ?? "",
|
|
581
581
|
onChange: d
|
|
582
|
-
}), [A, j] = c(!1), [M, N] = c(-1), P = o(() => m.find((e) => e.value === O), [m, O]),
|
|
582
|
+
}), [A, j] = c(!1), [M, N] = c(-1), P = o(() => m.find((e) => e.value === O), [m, O]), ee = !!P, { floatingStyles: F, setRef: L, setFloatingRef: R } = I({
|
|
583
583
|
open: A,
|
|
584
584
|
matchTriggerWidth: !0,
|
|
585
585
|
mobileSheetBreakpoint: 640
|
|
586
|
-
}),
|
|
586
|
+
}), z = n(() => {
|
|
587
587
|
let e = m.findIndex((e) => e.value === O && !e.disabled);
|
|
588
588
|
return e >= 0 ? e : m.findIndex((e) => !e.disabled);
|
|
589
|
-
}, [m, O]),
|
|
590
|
-
_ || (N(
|
|
591
|
-
}, [_,
|
|
589
|
+
}, [m, O]), B = n(() => {
|
|
590
|
+
_ || (N(z()), j(!0));
|
|
591
|
+
}, [_, z]), V = n(() => {
|
|
592
592
|
j(!1);
|
|
593
|
-
}, []),
|
|
593
|
+
}, []), H = n(() => {
|
|
594
594
|
if (!_) {
|
|
595
595
|
if (A) {
|
|
596
|
-
|
|
596
|
+
V();
|
|
597
597
|
return;
|
|
598
598
|
}
|
|
599
|
-
|
|
599
|
+
B();
|
|
600
600
|
}
|
|
601
601
|
}, [
|
|
602
|
-
|
|
602
|
+
V,
|
|
603
603
|
_,
|
|
604
604
|
A,
|
|
605
|
-
|
|
606
|
-
]),
|
|
607
|
-
k(e),
|
|
608
|
-
}, [
|
|
605
|
+
B
|
|
606
|
+
]), U = n((e) => {
|
|
607
|
+
k(e), V(), w.current?.focus();
|
|
608
|
+
}, [V, k]), { onKeyDown: W } = E({
|
|
609
609
|
activeIndex: M,
|
|
610
610
|
setActiveIndex: N,
|
|
611
611
|
items: m,
|
|
612
612
|
isOpen: A,
|
|
613
|
-
onOpen:
|
|
614
|
-
onClose:
|
|
613
|
+
onOpen: B,
|
|
614
|
+
onClose: V,
|
|
615
615
|
onSelect: () => {
|
|
616
616
|
let e = m[M];
|
|
617
|
-
!e || e.disabled ||
|
|
617
|
+
!e || e.disabled || U(e.value);
|
|
618
618
|
}
|
|
619
619
|
});
|
|
620
|
-
te([w, D],
|
|
621
|
-
let
|
|
620
|
+
te([w, D], V, A);
|
|
621
|
+
let ne = n((e) => {
|
|
622
622
|
w.current = e, L(e);
|
|
623
|
-
}, [L]),
|
|
624
|
-
D.current = e,
|
|
625
|
-
}, [
|
|
626
|
-
return /* @__PURE__ */ p(
|
|
623
|
+
}, [L]), G = n((e) => {
|
|
624
|
+
D.current = e, R(e);
|
|
625
|
+
}, [R]);
|
|
626
|
+
return /* @__PURE__ */ p(Se, {
|
|
627
627
|
id: x,
|
|
628
628
|
label: e,
|
|
629
629
|
description: t,
|
|
@@ -632,7 +632,7 @@ var Ae = ({ label: e, description: t, id: r, name: i, value: l, defaultValue: u,
|
|
|
632
632
|
disabled: _,
|
|
633
633
|
className: y,
|
|
634
634
|
children: [
|
|
635
|
-
/* @__PURE__ */ f(
|
|
635
|
+
/* @__PURE__ */ f(Oe, {
|
|
636
636
|
id: x,
|
|
637
637
|
errorId: C,
|
|
638
638
|
isOpen: A,
|
|
@@ -643,10 +643,10 @@ var Ae = ({ label: e, description: t, id: r, name: i, value: l, defaultValue: u,
|
|
|
643
643
|
ariaLabel: e ? void 0 : P?.label || h,
|
|
644
644
|
error: v,
|
|
645
645
|
displayText: P?.label ?? h,
|
|
646
|
-
isPlaceholder: !
|
|
647
|
-
buttonRef:
|
|
648
|
-
onClick:
|
|
649
|
-
onKeyDown:
|
|
646
|
+
isPlaceholder: !ee,
|
|
647
|
+
buttonRef: ne,
|
|
648
|
+
onClick: H,
|
|
649
|
+
onKeyDown: W
|
|
650
650
|
}),
|
|
651
651
|
i && /* @__PURE__ */ f("input", {
|
|
652
652
|
type: "hidden",
|
|
@@ -654,38 +654,38 @@ var Ae = ({ label: e, description: t, id: r, name: i, value: l, defaultValue: u,
|
|
|
654
654
|
value: O,
|
|
655
655
|
disabled: _
|
|
656
656
|
}),
|
|
657
|
-
/* @__PURE__ */ f(
|
|
657
|
+
/* @__PURE__ */ f(De, {
|
|
658
658
|
isOpen: A,
|
|
659
659
|
listboxId: S,
|
|
660
660
|
labelledById: x,
|
|
661
|
-
style:
|
|
661
|
+
style: F,
|
|
662
662
|
options: m,
|
|
663
663
|
selectedValue: O,
|
|
664
664
|
activeIndex: M,
|
|
665
|
-
setDropdownRef:
|
|
666
|
-
onSelect:
|
|
665
|
+
setDropdownRef: G,
|
|
666
|
+
onSelect: U,
|
|
667
667
|
onMouseEnter: N
|
|
668
668
|
})
|
|
669
669
|
]
|
|
670
670
|
});
|
|
671
671
|
};
|
|
672
|
-
|
|
672
|
+
ke.displayName = "Select";
|
|
673
673
|
//#endregion
|
|
674
674
|
//#region src/components/Tabs/TabsContext.tsx
|
|
675
|
-
var
|
|
676
|
-
let e = r(
|
|
675
|
+
var Ae = e(null), je = () => {
|
|
676
|
+
let e = r(Ae);
|
|
677
677
|
if (!e) throw Error("Tabs components must be used inside Tabs");
|
|
678
678
|
return e;
|
|
679
|
-
},
|
|
679
|
+
}, Me = {
|
|
680
680
|
list: "_list_astty_1",
|
|
681
681
|
vertical: "_vertical_astty_8"
|
|
682
682
|
}, Ne = ({ children: e, className: t, ...n }) => {
|
|
683
|
-
let { orientation: r, appearance: i } =
|
|
683
|
+
let { orientation: r, appearance: i } = je();
|
|
684
684
|
return /* @__PURE__ */ f("div", {
|
|
685
685
|
...n,
|
|
686
686
|
role: "tablist",
|
|
687
687
|
"aria-orientation": r,
|
|
688
|
-
className: M(
|
|
688
|
+
className: M(Me.list, r === "vertical" && Me.vertical, i === "underline" && Me.underline, i === "pills" && Me.pills, t),
|
|
689
689
|
children: e
|
|
690
690
|
});
|
|
691
691
|
};
|
|
@@ -695,7 +695,7 @@ var Pe = {
|
|
|
695
695
|
visible: "_visible_1e9ds_10",
|
|
696
696
|
vertical: "_vertical_1e9ds_15"
|
|
697
697
|
}, Fe = ({ index: e, children: t, className: n }) => {
|
|
698
|
-
let { activeIndex: r, orientation: a } =
|
|
698
|
+
let { activeIndex: r, orientation: a } = je(), [o, s] = c(!1), l = r === e;
|
|
699
699
|
return i(() => {
|
|
700
700
|
if (!l) {
|
|
701
701
|
s(!1);
|
|
@@ -724,7 +724,7 @@ var X = {
|
|
|
724
724
|
pills: "_pills_160gh_81",
|
|
725
725
|
vertical: "_vertical_160gh_93"
|
|
726
726
|
}, Ie = t(({ index: e, children: t, className: r, disabled: i = !1, icon: a, onClick: o, onKeyDown: s, ...c }, l) => {
|
|
727
|
-
let { activeIndex: u, setActiveIndex: d, orientation: m, appearance: h = "default", registerTab: g, onTabKeyDown: _ } =
|
|
727
|
+
let { activeIndex: u, setActiveIndex: d, orientation: m, appearance: h = "default", registerTab: g, onTabKeyDown: _ } = je(), v = u === e, y = !!a, b = y && t == null;
|
|
728
728
|
return /* @__PURE__ */ p("button", {
|
|
729
729
|
type: "button",
|
|
730
730
|
ref: n((t) => {
|
|
@@ -780,7 +780,7 @@ var Le = {
|
|
|
780
780
|
registerTab: _,
|
|
781
781
|
onTabKeyDown: v
|
|
782
782
|
};
|
|
783
|
-
return /* @__PURE__ */ f(
|
|
783
|
+
return /* @__PURE__ */ f(Ae.Provider, {
|
|
784
784
|
value: y,
|
|
785
785
|
children: /* @__PURE__ */ f("div", {
|
|
786
786
|
className: M(Le.tabs, a === "vertical" && Le.vertical, l),
|
|
@@ -832,7 +832,7 @@ var He = ({ children: e, placement: t = "top", content: n, disabled: r = !1, del
|
|
|
832
832
|
open: 300,
|
|
833
833
|
close: 100
|
|
834
834
|
}, maxWidth: o = 250, className: l, onOpenChange: u }) => {
|
|
835
|
-
let [g, _] = c(!1), v = s(null), y = a(), { context: b, floatingStyles: x, middlewareData: T, setRef: E, setFloatingRef: D, placement: O } =
|
|
835
|
+
let [g, _] = c(!1), v = s(null), y = a(), { context: b, floatingStyles: x, middlewareData: T, setRef: E, setFloatingRef: D, placement: O } = I({
|
|
836
836
|
open: g,
|
|
837
837
|
onOpenChange: (e) => {
|
|
838
838
|
r || (_(e), u?.(e));
|
|
@@ -867,28 +867,32 @@ var He = ({ children: e, placement: t = "top", content: n, disabled: r = !1, del
|
|
|
867
867
|
}) })] });
|
|
868
868
|
};
|
|
869
869
|
He.displayName = "Tooltip";
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
870
|
+
//#endregion
|
|
871
|
+
//#region src/utils/devWarning.ts
|
|
872
|
+
var Ue = (e, t) => {
|
|
873
|
+
process.env.NODE_ENV !== "production" && !e && console.warn(t);
|
|
874
|
+
}, Z = {
|
|
875
|
+
button: "_button_g2sgv_1",
|
|
876
|
+
loading: "_loading_g2sgv_21",
|
|
877
|
+
solid: "_solid_g2sgv_32",
|
|
878
|
+
primary: "_primary_g2sgv_32",
|
|
879
|
+
secondary: "_secondary_g2sgv_51",
|
|
880
|
+
danger: "_danger_g2sgv_70",
|
|
881
|
+
close: "_close_g2sgv_89",
|
|
882
|
+
outline: "_outline_g2sgv_108",
|
|
883
|
+
ghost: "_ghost_g2sgv_184",
|
|
884
|
+
sm: "_sm_g2sgv_269",
|
|
885
|
+
md: "_md_g2sgv_275",
|
|
886
|
+
lg: "_lg_g2sgv_281",
|
|
887
|
+
fullWidth: "_fullWidth_g2sgv_287",
|
|
888
|
+
iconOnly: "_iconOnly_g2sgv_291",
|
|
889
|
+
label: "_label_g2sgv_295",
|
|
890
|
+
icon: "_icon_g2sgv_291",
|
|
891
|
+
spinner: "_spinner_g2sgv_317",
|
|
892
|
+
"button-spin": "_button-spin_g2sgv_1"
|
|
893
|
+
}, We = t(({ children: e, color: t = "primary", variant: n = "solid", size: r = "md", type: i = "button", disabled: a = !1, loading: o = !1, loadingText: s, leftIcon: c, rightIcon: l, fullWidth: u = !1, iconOnly: d = !1, className: m, onClick: h, "aria-label": g, ..._ }, v) => {
|
|
890
894
|
let y = d || !e && (c || l), b = a || o, x = o && s ? s : e;
|
|
891
|
-
return y
|
|
895
|
+
return Ue(!y || !!g, "Button: icon-only buttons must provide aria-label."), /* @__PURE__ */ p("button", {
|
|
892
896
|
..._,
|
|
893
897
|
ref: v,
|
|
894
898
|
type: i,
|
|
@@ -922,18 +926,18 @@ var Z = {
|
|
|
922
926
|
]
|
|
923
927
|
});
|
|
924
928
|
});
|
|
925
|
-
|
|
929
|
+
We.displayName = "Button";
|
|
926
930
|
var Q = {
|
|
927
|
-
wrapper: "
|
|
928
|
-
input: "
|
|
929
|
-
customCheckbox: "
|
|
930
|
-
checkmark: "
|
|
931
|
-
container: "
|
|
932
|
-
label: "
|
|
933
|
-
error: "
|
|
934
|
-
errorText: "
|
|
935
|
-
disabled: "
|
|
936
|
-
},
|
|
931
|
+
wrapper: "_wrapper_1s06j_1",
|
|
932
|
+
input: "_input_1s06j_9",
|
|
933
|
+
customCheckbox: "_customCheckbox_1s06j_21",
|
|
934
|
+
checkmark: "_checkmark_1s06j_38",
|
|
935
|
+
container: "_container_1s06j_54",
|
|
936
|
+
label: "_label_1s06j_60",
|
|
937
|
+
error: "_error_1s06j_65",
|
|
938
|
+
errorText: "_errorText_1s06j_69",
|
|
939
|
+
disabled: "_disabled_1s06j_115"
|
|
940
|
+
}, Ge = t(({ label: e, checked: t, defaultChecked: n = !1, disabled: r = !1, className: i, onCheckedChange: o, error: s }, c) => {
|
|
937
941
|
let l = a(), u = !!s, [d, m] = T({
|
|
938
942
|
value: t,
|
|
939
943
|
defaultValue: n,
|
|
@@ -979,102 +983,165 @@ var Q = {
|
|
|
979
983
|
})]
|
|
980
984
|
});
|
|
981
985
|
});
|
|
982
|
-
|
|
986
|
+
Ge.displayName = "Checkbox";
|
|
983
987
|
var $ = {
|
|
984
|
-
inputWrapper: "
|
|
985
|
-
input: "
|
|
986
|
-
error: "
|
|
987
|
-
withEllipsis: "
|
|
988
|
-
sm: "
|
|
989
|
-
md: "
|
|
990
|
-
lg: "
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
988
|
+
inputWrapper: "_inputWrapper_1tupw_1",
|
|
989
|
+
input: "_input_1tupw_1",
|
|
990
|
+
error: "_error_1tupw_41",
|
|
991
|
+
withEllipsis: "_withEllipsis_1tupw_48",
|
|
992
|
+
sm: "_sm_1tupw_53",
|
|
993
|
+
md: "_md_1tupw_57",
|
|
994
|
+
lg: "_lg_1tupw_61",
|
|
995
|
+
hasLeftAdornment: "_hasLeftAdornment_1tupw_89",
|
|
996
|
+
hasRightAdornment: "_hasRightAdornment_1tupw_93",
|
|
997
|
+
leftAdornment: "_leftAdornment_1tupw_97",
|
|
998
|
+
rightAdornment: "_rightAdornment_1tupw_98",
|
|
999
|
+
clearButton: "_clearButton_1tupw_112",
|
|
1000
|
+
toneDefault: "_toneDefault_1tupw_166",
|
|
1001
|
+
tonePrimary: "_tonePrimary_1tupw_170",
|
|
1002
|
+
toneSecondary: "_toneSecondary_1tupw_174",
|
|
1003
|
+
toneSuccess: "_toneSuccess_1tupw_178",
|
|
1004
|
+
toneDanger: "_toneDanger_1tupw_182",
|
|
1005
|
+
toneMuted: "_toneMuted_1tupw_186",
|
|
1006
|
+
toneInverse: "_toneInverse_1tupw_190",
|
|
1007
|
+
tooltip: "_tooltip_1tupw_196",
|
|
1008
|
+
fadeIn: "_fadeIn_1tupw_1"
|
|
1009
|
+
}, Ke = (e = "text", t) => {
|
|
1010
|
+
if (t) return t;
|
|
1011
|
+
switch (e) {
|
|
1012
|
+
case "email": return "email";
|
|
1013
|
+
case "password": return "current-password";
|
|
1014
|
+
case "tel": return "tel";
|
|
1015
|
+
case "url": return "url";
|
|
1016
|
+
case "search": return "off";
|
|
1017
|
+
default: return;
|
|
1018
|
+
}
|
|
1019
|
+
}, qe = t(({ id: e, label: t, name: r, description: o, placeholder: l, value: u, defaultValue: d, onChange: m, type: h = "text", size: g = "md", error: _, disabled: v = !1, required: y = !1, className: b, autoComplete: x, readOnly: S = !1, clearable: C = !1, onClear: w, leftAdornment: T, rightAdornment: E, clearIcon: D, leftAdornmentTone: O = "default", rightAdornmentTone: k = "default", showOverflowTooltip: A = !1, autoFocus: j, maxLength: N }, P) => {
|
|
1020
|
+
let ee = a(), F = e ?? ee, I = s(null), [te, L] = c(d ?? ""), [R, z] = c(!1), [B, V] = c(!1), H = u !== void 0, U = H ? u : te, W = U !== "", ne = Ke(h, x), G = C && W && !v && !S, re = D ?? "×", K = n(() => {
|
|
1021
|
+
let e = I.current;
|
|
996
1022
|
if (!e) {
|
|
997
|
-
|
|
1023
|
+
z(!1);
|
|
998
1024
|
return;
|
|
999
1025
|
}
|
|
1000
|
-
|
|
1026
|
+
z(e.scrollWidth > e.clientWidth);
|
|
1001
1027
|
}, []);
|
|
1002
1028
|
i(() => {
|
|
1003
|
-
if (!
|
|
1004
|
-
if (
|
|
1005
|
-
window.removeEventListener("resize",
|
|
1029
|
+
if (!A) return;
|
|
1030
|
+
if (K(), typeof ResizeObserver > "u") return window.addEventListener("resize", K), () => {
|
|
1031
|
+
window.removeEventListener("resize", K);
|
|
1006
1032
|
};
|
|
1007
|
-
let e = new ResizeObserver(
|
|
1008
|
-
return
|
|
1009
|
-
e.disconnect(), window.removeEventListener("resize",
|
|
1033
|
+
let e = new ResizeObserver(K);
|
|
1034
|
+
return I.current && e.observe(I.current), window.addEventListener("resize", K), () => {
|
|
1035
|
+
e.disconnect(), window.removeEventListener("resize", K);
|
|
1010
1036
|
};
|
|
1011
|
-
}, [
|
|
1012
|
-
|
|
1037
|
+
}, [K, A]), i(() => {
|
|
1038
|
+
A && K();
|
|
1013
1039
|
}, [
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1040
|
+
U,
|
|
1041
|
+
K,
|
|
1042
|
+
A
|
|
1017
1043
|
]);
|
|
1018
|
-
let
|
|
1019
|
-
if (
|
|
1020
|
-
|
|
1044
|
+
let ie = n((e) => {
|
|
1045
|
+
if (I.current = e, typeof P == "function") {
|
|
1046
|
+
P(e);
|
|
1021
1047
|
return;
|
|
1022
1048
|
}
|
|
1023
|
-
|
|
1024
|
-
}, [
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1049
|
+
P && (P.current = e);
|
|
1050
|
+
}, [P]), ae = n((e) => {
|
|
1051
|
+
let t = e.target.value;
|
|
1052
|
+
H || L(t), m?.(t);
|
|
1053
|
+
}, [H, m]), oe = n(() => {
|
|
1054
|
+
H || L(""), m?.(""), w?.(), I.current?.focus();
|
|
1028
1055
|
}, [
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
]),
|
|
1033
|
-
|
|
1034
|
-
}, [
|
|
1035
|
-
|
|
1036
|
-
|
|
1056
|
+
H,
|
|
1057
|
+
m,
|
|
1058
|
+
w
|
|
1059
|
+
]), se = n(() => {
|
|
1060
|
+
A && R && W && V(!0);
|
|
1061
|
+
}, [
|
|
1062
|
+
W,
|
|
1063
|
+
R,
|
|
1064
|
+
A
|
|
1065
|
+
]), ce = n(() => {
|
|
1066
|
+
V(!1);
|
|
1067
|
+
}, []), le = {
|
|
1068
|
+
default: $.toneDefault,
|
|
1069
|
+
primary: $.tonePrimary,
|
|
1070
|
+
secondary: $.toneSecondary,
|
|
1071
|
+
success: $.toneSuccess,
|
|
1072
|
+
danger: $.toneDanger,
|
|
1073
|
+
muted: $.toneMuted,
|
|
1074
|
+
inverse: $.toneInverse
|
|
1075
|
+
}, ue = !G && !!E;
|
|
1076
|
+
return /* @__PURE__ */ f(Se, {
|
|
1077
|
+
id: F,
|
|
1037
1078
|
label: t,
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1079
|
+
description: o,
|
|
1080
|
+
error: _,
|
|
1081
|
+
required: y,
|
|
1082
|
+
disabled: v,
|
|
1041
1083
|
children: /* @__PURE__ */ p("div", {
|
|
1042
|
-
className: $.inputWrapper,
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1084
|
+
className: M($.inputWrapper, {
|
|
1085
|
+
[$.hasLeftAdornment]: !!T,
|
|
1086
|
+
[$.hasRightAdornment]: !!E || G
|
|
1087
|
+
}),
|
|
1088
|
+
children: [
|
|
1089
|
+
T && /* @__PURE__ */ f("span", {
|
|
1090
|
+
className: M($.leftAdornment, le[O]),
|
|
1091
|
+
children: T
|
|
1092
|
+
}),
|
|
1093
|
+
/* @__PURE__ */ f("input", {
|
|
1094
|
+
ref: ie,
|
|
1095
|
+
id: F,
|
|
1096
|
+
name: r,
|
|
1097
|
+
type: h,
|
|
1098
|
+
autoComplete: ne,
|
|
1099
|
+
className: M($.input, $[g], {
|
|
1100
|
+
[$.error]: !!_,
|
|
1101
|
+
[$.withEllipsis]: A
|
|
1102
|
+
}, b),
|
|
1103
|
+
value: U,
|
|
1104
|
+
onChange: ae,
|
|
1105
|
+
placeholder: l,
|
|
1106
|
+
disabled: v,
|
|
1107
|
+
readOnly: S,
|
|
1108
|
+
required: y,
|
|
1109
|
+
autoFocus: j,
|
|
1110
|
+
maxLength: N,
|
|
1111
|
+
"aria-invalid": !!_,
|
|
1112
|
+
"aria-describedby": _ ? `${F}-error` : void 0,
|
|
1113
|
+
onMouseEnter: se,
|
|
1114
|
+
onMouseLeave: ce
|
|
1115
|
+
}),
|
|
1116
|
+
G && /* @__PURE__ */ f("button", {
|
|
1117
|
+
type: "button",
|
|
1118
|
+
className: M($.clearButton, le[k]),
|
|
1119
|
+
onClick: oe,
|
|
1120
|
+
"aria-label": "Clear input",
|
|
1121
|
+
children: re
|
|
1122
|
+
}),
|
|
1123
|
+
ue && /* @__PURE__ */ f("div", {
|
|
1124
|
+
className: M($.rightAdornment, le[k]),
|
|
1125
|
+
children: E
|
|
1126
|
+
}),
|
|
1127
|
+
A && B && R && W && /* @__PURE__ */ f("div", {
|
|
1128
|
+
className: $.tooltip,
|
|
1129
|
+
role: "tooltip",
|
|
1130
|
+
children: U
|
|
1131
|
+
})
|
|
1132
|
+
]
|
|
1066
1133
|
})
|
|
1067
1134
|
});
|
|
1068
1135
|
});
|
|
1069
|
-
|
|
1136
|
+
qe.displayName = "Input";
|
|
1070
1137
|
//#endregion
|
|
1071
1138
|
//#region src/theme/ThemeContext.ts
|
|
1072
|
-
var
|
|
1139
|
+
var Je = e(null), Ye = (e) => e === "highContrast" ? "high-contrast" : e, Xe = ({ theme: e, defaultTheme: t = "light", onThemeChange: n, children: r }) => {
|
|
1073
1140
|
let [a, s] = T({
|
|
1074
1141
|
value: e,
|
|
1075
1142
|
defaultValue: t,
|
|
1076
1143
|
onChange: n
|
|
1077
|
-
}), c =
|
|
1144
|
+
}), c = Ye(a);
|
|
1078
1145
|
i(() => {
|
|
1079
1146
|
if (typeof document > "u") return;
|
|
1080
1147
|
let { documentElement: e } = document, t = e.dataset.velliraTheme;
|
|
@@ -1090,7 +1157,7 @@ var Ke = e(null), qe = (e) => e === "highContrast" ? "high-contrast" : e, Je = (
|
|
|
1090
1157
|
theme: a,
|
|
1091
1158
|
setTheme: s
|
|
1092
1159
|
}), [a, s]);
|
|
1093
|
-
return /* @__PURE__ */ f(
|
|
1160
|
+
return /* @__PURE__ */ f(Je.Provider, {
|
|
1094
1161
|
value: l,
|
|
1095
1162
|
children: /* @__PURE__ */ f("div", {
|
|
1096
1163
|
"data-vellira-theme": c,
|
|
@@ -1098,13 +1165,13 @@ var Ke = e(null), qe = (e) => e === "highContrast" ? "high-contrast" : e, Je = (
|
|
|
1098
1165
|
})
|
|
1099
1166
|
});
|
|
1100
1167
|
};
|
|
1101
|
-
|
|
1168
|
+
Xe.displayName = "ThemeProvider";
|
|
1102
1169
|
//#endregion
|
|
1103
1170
|
//#region src/theme/useTheme.ts
|
|
1104
|
-
function
|
|
1105
|
-
let e = r(
|
|
1171
|
+
function Ze() {
|
|
1172
|
+
let e = r(Je);
|
|
1106
1173
|
if (!e) throw Error("useTheme must be used within ThemeProvider.");
|
|
1107
1174
|
return e;
|
|
1108
1175
|
}
|
|
1109
1176
|
//#endregion
|
|
1110
|
-
export {
|
|
1177
|
+
export { We as Button, Ge as Checkbox, ie as Dropdown, Se as FormField, qe as Input, xe as Modal, Ce as RadioGroup, ke as Select, ze as Tabs, Xe as ThemeProvider, He as Tooltip, Ze as useTheme };
|