@vellira-ui/react 2.22.0 → 2.22.4
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 +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +201 -243
- package/dist/styles.css +1 -1
- package/package.json +15 -15
package/dist/index.js
CHANGED
|
@@ -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: M(
|
|
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: M(
|
|
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
|
-
},
|
|
149
|
+
}, te = 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(W.button, {
|
|
156
|
+
[W.disabled]: c.disabled,
|
|
157
|
+
[W.iconOnly]: m
|
|
158
158
|
}, s),
|
|
159
159
|
"aria-label": _,
|
|
160
160
|
"aria-expanded": t,
|
|
@@ -163,22 +163,22 @@ 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: M(
|
|
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 ne = (e) => e.type !== "group" && e.type !== "separator", G = (e) => e.type === "group", re = (e) => e.type === "separator",
|
|
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
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,
|
|
@@ -190,9 +190,9 @@ var ne = (e) => e.type !== "group" && e.type !== "separator", G = (e) => e.type
|
|
|
190
190
|
});
|
|
191
191
|
}, F = () => {
|
|
192
192
|
y(!1), x(-1);
|
|
193
|
-
},
|
|
193
|
+
}, R = () => {
|
|
194
194
|
F(), S.current?.focus();
|
|
195
|
-
}, { onKeyDown:
|
|
195
|
+
}, { onKeyDown: B } = E({
|
|
196
196
|
activeIndex: b,
|
|
197
197
|
setActiveIndex: x,
|
|
198
198
|
items: A,
|
|
@@ -200,20 +200,20 @@ var ne = (e) => e.type !== "group" && e.type !== "separator", G = (e) => e.type
|
|
|
200
200
|
onOpen: P,
|
|
201
201
|
onSelect: () => {
|
|
202
202
|
let e = A[b];
|
|
203
|
-
!e || e.disabled || (i?.(e.value),
|
|
203
|
+
!e || e.disabled || (i?.(e.value), R());
|
|
204
204
|
},
|
|
205
|
-
onClose:
|
|
205
|
+
onClose: R
|
|
206
206
|
});
|
|
207
|
-
|
|
208
|
-
let
|
|
207
|
+
L([S, C], () => F(), v);
|
|
208
|
+
let H = (e) => {
|
|
209
209
|
S.current = e, O(e);
|
|
210
|
-
},
|
|
210
|
+
}, W = (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(ie.wrapper, o),
|
|
215
|
+
children: [/* @__PURE__ */ f(te, {
|
|
216
|
+
ref: H,
|
|
217
217
|
id: T,
|
|
218
218
|
isOpen: v,
|
|
219
219
|
disabled: l,
|
|
@@ -223,31 +223,31 @@ var ne = (e) => e.type !== "group" && e.type !== "separator", G = (e) => e.type
|
|
|
223
223
|
arrowIcon: _,
|
|
224
224
|
rotateAngle: u,
|
|
225
225
|
onClick: P,
|
|
226
|
-
onKeyDown:
|
|
226
|
+
onKeyDown: B,
|
|
227
227
|
"aria-expanded": v,
|
|
228
228
|
"aria-haspopup": "menu",
|
|
229
229
|
...v && { "aria-controls": w },
|
|
230
230
|
children: n
|
|
231
231
|
}), v && /* @__PURE__ */ f(ee, {
|
|
232
|
-
ref:
|
|
232
|
+
ref: W,
|
|
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: B,
|
|
239
239
|
children: r.map((e, t) => {
|
|
240
|
-
if (G(e)) return /* @__PURE__ */ f(
|
|
241
|
-
if (re(e)) 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
242
|
if (ne(e)) {
|
|
243
243
|
let t = A.findIndex((t) => t === e);
|
|
244
|
-
return /* @__PURE__ */ f(
|
|
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,78 +258,78 @@ var ne = (e) => e.type !== "group" && e.type !== "separator", G = (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
|
-
|
|
267
|
-
var
|
|
268
|
-
let { descriptionId: t } =
|
|
266
|
+
oe.displayName = "ModalContext";
|
|
267
|
+
var ce = { modalBody: "_modalBody_iv33a_1" }, le = ({ children: e }) => {
|
|
268
|
+
let { descriptionId: t } = se();
|
|
269
269
|
return /* @__PURE__ */ f("div", {
|
|
270
270
|
id: t,
|
|
271
|
-
className:
|
|
271
|
+
className: ce.modalBody,
|
|
272
272
|
children: e
|
|
273
273
|
});
|
|
274
274
|
};
|
|
275
|
-
|
|
276
|
-
var
|
|
277
|
-
className:
|
|
275
|
+
le.displayName = "ModalBody";
|
|
276
|
+
var ue = { content: "_content_avpai_1" }, de = ({ children: e }) => /* @__PURE__ */ f("div", {
|
|
277
|
+
className: ue.content,
|
|
278
278
|
children: e
|
|
279
279
|
});
|
|
280
|
-
|
|
281
|
-
var
|
|
282
|
-
className:
|
|
280
|
+
de.displayName = "ModalContent";
|
|
281
|
+
var fe = { modalFooter: "_modalFooter_ezys6_1" }, pe = ({ children: e }) => /* @__PURE__ */ f("div", {
|
|
282
|
+
className: fe.modalFooter,
|
|
283
283
|
children: e
|
|
284
284
|
});
|
|
285
|
-
|
|
286
|
-
var
|
|
285
|
+
pe.displayName = "ModalFooter";
|
|
286
|
+
var me = {
|
|
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
|
+
}, he = ({ children: e }) => {
|
|
291
|
+
let { onClose: t, titleId: n } = se();
|
|
292
292
|
return /* @__PURE__ */ p("div", {
|
|
293
|
-
className:
|
|
293
|
+
className: me.modalHeader,
|
|
294
294
|
children: [/* @__PURE__ */ f("h2", {
|
|
295
295
|
id: n,
|
|
296
|
-
className:
|
|
296
|
+
className: me.modalHeaderTitle,
|
|
297
297
|
children: e
|
|
298
298
|
}), t && /* @__PURE__ */ f("button", {
|
|
299
299
|
type: "button",
|
|
300
|
-
className:
|
|
300
|
+
className: me.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
|
+
he.displayName = "ModalHeader";
|
|
308
308
|
//#endregion
|
|
309
309
|
//#region src/hooks/useModalKeyboard.ts
|
|
310
|
-
var
|
|
310
|
+
var ge = ({ 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
|
+
}, _e = {
|
|
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
|
+
}, 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 } = se(), _ = n((e) => {
|
|
322
322
|
p && e.target === e.currentTarget && t?.();
|
|
323
323
|
}, [p, t]);
|
|
324
|
-
return
|
|
324
|
+
return ge({
|
|
325
325
|
isOpen: r,
|
|
326
326
|
onClose: l ? t : void 0
|
|
327
327
|
}), i(() => {
|
|
328
|
-
if (r) return
|
|
329
|
-
|
|
328
|
+
if (r) return K === 0 && (ve = document.body.style.overflow), K += 1, document.body.style.overflow = "hidden", () => {
|
|
329
|
+
K = Math.max(0, K - 1), K === 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(_e.overlay, r && _e["overlay--open"], d && _e["overlay--animated"], a),
|
|
333
333
|
onClick: _,
|
|
334
334
|
tabIndex: -1,
|
|
335
335
|
role: "presentation",
|
|
@@ -345,7 +345,7 @@ var he = ({ isOpen: e, onClose: t }) => {
|
|
|
345
345
|
children: /* @__PURE__ */ f("div", {
|
|
346
346
|
ref: m,
|
|
347
347
|
tabIndex: -1,
|
|
348
|
-
className:
|
|
348
|
+
className: _e.modal,
|
|
349
349
|
role: "dialog",
|
|
350
350
|
"aria-modal": "true",
|
|
351
351
|
"aria-labelledby": h,
|
|
@@ -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,
|
|
@@ -371,7 +371,7 @@ var be = ({ isOpen: e, children: t, onClose: n, closeOnBackdrop: r, closeOnClick
|
|
|
371
371
|
onClose: n,
|
|
372
372
|
closeOnBackdrop: r ?? i,
|
|
373
373
|
closeOnEsc: o,
|
|
374
|
-
children: /* @__PURE__ */ f(
|
|
374
|
+
children: /* @__PURE__ */ f(de, { children: t })
|
|
375
375
|
})
|
|
376
376
|
}) : null;
|
|
377
377
|
};
|
|
@@ -379,10 +379,10 @@ be.displayName = "Modal";
|
|
|
379
379
|
//#endregion
|
|
380
380
|
//#region src/components/Modal/index.ts
|
|
381
381
|
var xe = Object.assign(be, {
|
|
382
|
-
Header:
|
|
383
|
-
Body:
|
|
384
|
-
Content:
|
|
385
|
-
Footer:
|
|
382
|
+
Header: he,
|
|
383
|
+
Body: le,
|
|
384
|
+
Content: de,
|
|
385
|
+
Footer: pe
|
|
386
386
|
}), q = {
|
|
387
387
|
wrapper: "_wrapper_14t1p_1",
|
|
388
388
|
label: "_label_14t1p_9",
|
|
@@ -579,50 +579,50 @@ var ke = ({ label: e, description: t, id: r, name: i, value: l, defaultValue: u,
|
|
|
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]), ee = !!P, { floatingStyles: F, setRef:
|
|
582
|
+
}), [A, j] = c(!1), [M, N] = c(-1), P = o(() => m.find((e) => e.value === O), [m, O]), ee = !!P, { floatingStyles: F, setRef: R, setFloatingRef: z } = I({
|
|
583
583
|
open: A,
|
|
584
584
|
matchTriggerWidth: !0,
|
|
585
585
|
mobileSheetBreakpoint: 640
|
|
586
|
-
}),
|
|
586
|
+
}), B = 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]), V = n(() => {
|
|
590
|
+
_ || (N(B()), j(!0));
|
|
591
|
+
}, [_, B]), H = n(() => {
|
|
592
592
|
j(!1);
|
|
593
|
-
}, []),
|
|
593
|
+
}, []), U = n(() => {
|
|
594
594
|
if (!_) {
|
|
595
595
|
if (A) {
|
|
596
|
-
|
|
596
|
+
H();
|
|
597
597
|
return;
|
|
598
598
|
}
|
|
599
|
-
|
|
599
|
+
V();
|
|
600
600
|
}
|
|
601
601
|
}, [
|
|
602
|
-
|
|
602
|
+
H,
|
|
603
603
|
_,
|
|
604
604
|
A,
|
|
605
|
-
|
|
606
|
-
]),
|
|
607
|
-
k(e),
|
|
608
|
-
}, [
|
|
605
|
+
V
|
|
606
|
+
]), W = n((e) => {
|
|
607
|
+
k(e), H(), w.current?.focus();
|
|
608
|
+
}, [H, k]), { onKeyDown: te } = E({
|
|
609
609
|
activeIndex: M,
|
|
610
610
|
setActiveIndex: N,
|
|
611
611
|
items: m,
|
|
612
612
|
isOpen: A,
|
|
613
|
-
onOpen:
|
|
614
|
-
onClose:
|
|
613
|
+
onOpen: V,
|
|
614
|
+
onClose: H,
|
|
615
615
|
onSelect: () => {
|
|
616
616
|
let e = m[M];
|
|
617
|
-
!e || e.disabled ||
|
|
617
|
+
!e || e.disabled || W(e.value);
|
|
618
618
|
}
|
|
619
619
|
});
|
|
620
|
-
|
|
620
|
+
L([w, D], H, A);
|
|
621
621
|
let ne = n((e) => {
|
|
622
|
-
w.current = e,
|
|
623
|
-
}, [
|
|
624
|
-
D.current = e,
|
|
625
|
-
}, [
|
|
622
|
+
w.current = e, R(e);
|
|
623
|
+
}, [R]), G = n((e) => {
|
|
624
|
+
D.current = e, z(e);
|
|
625
|
+
}, [z]);
|
|
626
626
|
return /* @__PURE__ */ p(Se, {
|
|
627
627
|
id: x,
|
|
628
628
|
label: e,
|
|
@@ -645,8 +645,8 @@ var ke = ({ label: e, description: t, id: r, name: i, value: l, defaultValue: u,
|
|
|
645
645
|
displayText: P?.label ?? h,
|
|
646
646
|
isPlaceholder: !ee,
|
|
647
647
|
buttonRef: ne,
|
|
648
|
-
onClick:
|
|
649
|
-
onKeyDown:
|
|
648
|
+
onClick: U,
|
|
649
|
+
onKeyDown: te
|
|
650
650
|
}),
|
|
651
651
|
i && /* @__PURE__ */ f("input", {
|
|
652
652
|
type: "hidden",
|
|
@@ -663,7 +663,7 @@ var ke = ({ label: e, description: t, id: r, name: i, value: l, defaultValue: u,
|
|
|
663
663
|
selectedValue: O,
|
|
664
664
|
activeIndex: M,
|
|
665
665
|
setDropdownRef: G,
|
|
666
|
-
onSelect:
|
|
666
|
+
onSelect: W,
|
|
667
667
|
onMouseEnter: N
|
|
668
668
|
})
|
|
669
669
|
]
|
|
@@ -872,26 +872,26 @@ He.displayName = "Tooltip";
|
|
|
872
872
|
var Ue = (e, t) => {
|
|
873
873
|
process.env.NODE_ENV !== "production" && !e && console.warn(t);
|
|
874
874
|
}, Z = {
|
|
875
|
-
button: "
|
|
876
|
-
loading: "
|
|
877
|
-
solid: "
|
|
878
|
-
primary: "
|
|
879
|
-
secondary: "
|
|
880
|
-
danger: "
|
|
881
|
-
close: "
|
|
882
|
-
outline: "
|
|
883
|
-
ghost: "
|
|
884
|
-
sm: "
|
|
885
|
-
md: "
|
|
886
|
-
lg: "
|
|
887
|
-
fullWidth: "
|
|
888
|
-
iconOnly: "
|
|
889
|
-
label: "
|
|
890
|
-
icon: "
|
|
891
|
-
spinner: "
|
|
892
|
-
"button-spin": "_button-
|
|
875
|
+
button: "_button_s76yk_1",
|
|
876
|
+
loading: "_loading_s76yk_21",
|
|
877
|
+
solid: "_solid_s76yk_32",
|
|
878
|
+
primary: "_primary_s76yk_32",
|
|
879
|
+
secondary: "_secondary_s76yk_52",
|
|
880
|
+
danger: "_danger_s76yk_72",
|
|
881
|
+
close: "_close_s76yk_92",
|
|
882
|
+
outline: "_outline_s76yk_112",
|
|
883
|
+
ghost: "_ghost_s76yk_192",
|
|
884
|
+
sm: "_sm_s76yk_281",
|
|
885
|
+
md: "_md_s76yk_287",
|
|
886
|
+
lg: "_lg_s76yk_293",
|
|
887
|
+
fullWidth: "_fullWidth_s76yk_299",
|
|
888
|
+
iconOnly: "_iconOnly_s76yk_303",
|
|
889
|
+
label: "_label_s76yk_307",
|
|
890
|
+
icon: "_icon_s76yk_303",
|
|
891
|
+
spinner: "_spinner_s76yk_329",
|
|
892
|
+
"button-spin": "_button-spin_s76yk_1"
|
|
893
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) => {
|
|
894
|
-
let y = d || !e && (c || l), b = a || o, x = o && s ? s : e;
|
|
894
|
+
let y = d || !e && !!(c || l), b = a || o, x = o && s ? s : e;
|
|
895
895
|
return Ue(!y || !!g, "Button: icon-only buttons must provide aria-label."), /* @__PURE__ */ p("button", {
|
|
896
896
|
..._,
|
|
897
897
|
ref: v,
|
|
@@ -915,7 +915,7 @@ var Ue = (e, t) => {
|
|
|
915
915
|
className: Z.icon,
|
|
916
916
|
children: c
|
|
917
917
|
}),
|
|
918
|
-
x && /* @__PURE__ */ f("span", {
|
|
918
|
+
x && !y && /* @__PURE__ */ f("span", {
|
|
919
919
|
className: Z.label,
|
|
920
920
|
children: x
|
|
921
921
|
}),
|
|
@@ -985,28 +985,33 @@ var Q = {
|
|
|
985
985
|
});
|
|
986
986
|
Ge.displayName = "Checkbox";
|
|
987
987
|
var $ = {
|
|
988
|
-
inputWrapper: "
|
|
989
|
-
input: "
|
|
990
|
-
error: "
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
988
|
+
inputWrapper: "_inputWrapper_y9bue_1",
|
|
989
|
+
input: "_input_y9bue_1",
|
|
990
|
+
error: "_error_y9bue_41",
|
|
991
|
+
sm: "_sm_y9bue_48",
|
|
992
|
+
md: "_md_y9bue_52",
|
|
993
|
+
lg: "_lg_y9bue_56",
|
|
994
|
+
hasLeftAdornment: "_hasLeftAdornment_y9bue_84",
|
|
995
|
+
hasRightAdornment: "_hasRightAdornment_y9bue_88",
|
|
996
|
+
leftAdornment: "_leftAdornment_y9bue_92",
|
|
997
|
+
rightAdornment: "_rightAdornment_y9bue_93",
|
|
998
|
+
clearButton: "_clearButton_y9bue_114",
|
|
999
|
+
toneDefault: "_toneDefault_y9bue_153",
|
|
1000
|
+
tonePrimary: "_tonePrimary_y9bue_157",
|
|
1001
|
+
toneSecondary: "_toneSecondary_y9bue_161",
|
|
1002
|
+
toneSuccess: "_toneSuccess_y9bue_165",
|
|
1003
|
+
toneDanger: "_toneDanger_y9bue_169",
|
|
1004
|
+
toneMuted: "_toneMuted_y9bue_173",
|
|
1005
|
+
toneInverse: "_toneInverse_y9bue_177"
|
|
1006
|
+
}, Ke = {
|
|
1007
|
+
default: $.toneDefault,
|
|
1008
|
+
primary: $.tonePrimary,
|
|
1009
|
+
secondary: $.toneSecondary,
|
|
1010
|
+
success: $.toneSuccess,
|
|
1011
|
+
danger: $.toneDanger,
|
|
1012
|
+
muted: $.toneMuted,
|
|
1013
|
+
inverse: $.toneInverse
|
|
1014
|
+
}, qe = (e = "text", t) => {
|
|
1010
1015
|
if (t) return t;
|
|
1011
1016
|
switch (e) {
|
|
1012
1017
|
case "email": return "email";
|
|
@@ -1016,132 +1021,85 @@ var $ = {
|
|
|
1016
1021
|
case "search": return "off";
|
|
1017
1022
|
default: return;
|
|
1018
1023
|
}
|
|
1019
|
-
},
|
|
1020
|
-
let
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
}, []);
|
|
1028
|
-
i(() => {
|
|
1029
|
-
if (!A) return;
|
|
1030
|
-
if (K(), typeof ResizeObserver > "u") return window.addEventListener("resize", K), () => {
|
|
1031
|
-
window.removeEventListener("resize", K);
|
|
1032
|
-
};
|
|
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);
|
|
1036
|
-
};
|
|
1037
|
-
}, [K, A]), i(() => {
|
|
1038
|
-
A && K();
|
|
1039
|
-
}, [
|
|
1040
|
-
U,
|
|
1041
|
-
K,
|
|
1042
|
-
A
|
|
1043
|
-
]);
|
|
1044
|
-
let ie = n((e) => {
|
|
1045
|
-
if (I.current = e, typeof P == "function") {
|
|
1046
|
-
P(e);
|
|
1024
|
+
}, Je = 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": ee, "aria-invalid": F, ...I }, L) => {
|
|
1025
|
+
let R = a(), z = e ?? R, B = s(null), [V, H] = c(u ?? ""), U = l !== void 0, W = U ? l : V, te = W !== "", ne = qe(m, b), G = S && te && !_ && !x, re = [
|
|
1026
|
+
ee,
|
|
1027
|
+
i ? `${z}-description` : void 0,
|
|
1028
|
+
g ? `${z}-error` : void 0
|
|
1029
|
+
].filter(Boolean).join(" "), ie = E ?? "×", ae = n((e) => {
|
|
1030
|
+
if (B.current = e, typeof L == "function") {
|
|
1031
|
+
L(e);
|
|
1047
1032
|
return;
|
|
1048
1033
|
}
|
|
1049
|
-
|
|
1050
|
-
}, [
|
|
1034
|
+
L && (L.current = e);
|
|
1035
|
+
}, [L]), oe = n((e) => {
|
|
1051
1036
|
let t = e.target.value;
|
|
1052
|
-
|
|
1053
|
-
}, [
|
|
1054
|
-
|
|
1055
|
-
}, [
|
|
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;
|
|
1037
|
+
U || H(t), d?.(e);
|
|
1038
|
+
}, [U, d]), se = n(() => {
|
|
1039
|
+
U || H(""), C?.(), B.current?.focus();
|
|
1040
|
+
}, [U, C]), ce = !G && !!T;
|
|
1076
1041
|
return /* @__PURE__ */ f(Se, {
|
|
1077
|
-
id:
|
|
1042
|
+
id: z,
|
|
1078
1043
|
label: t,
|
|
1079
|
-
description:
|
|
1080
|
-
error:
|
|
1081
|
-
required:
|
|
1082
|
-
disabled:
|
|
1044
|
+
description: i,
|
|
1045
|
+
error: g,
|
|
1046
|
+
required: v,
|
|
1047
|
+
disabled: _,
|
|
1083
1048
|
children: /* @__PURE__ */ p("div", {
|
|
1084
1049
|
className: M($.inputWrapper, {
|
|
1085
|
-
[$.hasLeftAdornment]: !!
|
|
1086
|
-
[$.hasRightAdornment]: !!
|
|
1050
|
+
[$.hasLeftAdornment]: !!w,
|
|
1051
|
+
[$.hasRightAdornment]: !!T || G
|
|
1087
1052
|
}),
|
|
1088
1053
|
children: [
|
|
1089
|
-
|
|
1090
|
-
className: M($.leftAdornment,
|
|
1091
|
-
children:
|
|
1054
|
+
w && /* @__PURE__ */ f("span", {
|
|
1055
|
+
className: M($.leftAdornment, Ke[D]),
|
|
1056
|
+
children: w
|
|
1092
1057
|
}),
|
|
1093
1058
|
/* @__PURE__ */ f("input", {
|
|
1094
|
-
|
|
1095
|
-
|
|
1059
|
+
...I,
|
|
1060
|
+
ref: ae,
|
|
1061
|
+
id: z,
|
|
1096
1062
|
name: r,
|
|
1097
|
-
type:
|
|
1063
|
+
type: m,
|
|
1098
1064
|
autoComplete: ne,
|
|
1099
|
-
className: M($.input, $[
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
"aria-describedby": _ ? `${F}-error` : void 0,
|
|
1113
|
-
onMouseEnter: se,
|
|
1114
|
-
onMouseLeave: ce
|
|
1065
|
+
className: M($.input, $[h], { [$.error]: !!g }, y),
|
|
1066
|
+
value: W,
|
|
1067
|
+
onChange: oe,
|
|
1068
|
+
placeholder: o,
|
|
1069
|
+
disabled: _,
|
|
1070
|
+
readOnly: x,
|
|
1071
|
+
required: v,
|
|
1072
|
+
autoFocus: A,
|
|
1073
|
+
maxLength: j,
|
|
1074
|
+
"aria-invalid": g ? !0 : F,
|
|
1075
|
+
"aria-describedby": re || void 0,
|
|
1076
|
+
onMouseEnter: N,
|
|
1077
|
+
onMouseLeave: P
|
|
1115
1078
|
}),
|
|
1116
1079
|
G && /* @__PURE__ */ f("button", {
|
|
1117
1080
|
type: "button",
|
|
1118
|
-
className: M($.clearButton,
|
|
1119
|
-
onClick:
|
|
1081
|
+
className: M($.clearButton, Ke[k]),
|
|
1082
|
+
onClick: se,
|
|
1120
1083
|
"aria-label": "Clear input",
|
|
1121
|
-
children:
|
|
1122
|
-
}),
|
|
1123
|
-
ue && /* @__PURE__ */ f("div", {
|
|
1124
|
-
className: M($.rightAdornment, le[k]),
|
|
1125
|
-
children: E
|
|
1084
|
+
children: ie
|
|
1126
1085
|
}),
|
|
1127
|
-
|
|
1128
|
-
className: $.
|
|
1129
|
-
|
|
1130
|
-
children: U
|
|
1086
|
+
ce && /* @__PURE__ */ f("div", {
|
|
1087
|
+
className: M($.rightAdornment, Ke[O]),
|
|
1088
|
+
children: T
|
|
1131
1089
|
})
|
|
1132
1090
|
]
|
|
1133
1091
|
})
|
|
1134
1092
|
});
|
|
1135
1093
|
});
|
|
1136
|
-
|
|
1094
|
+
Je.displayName = "Input";
|
|
1137
1095
|
//#endregion
|
|
1138
1096
|
//#region src/theme/ThemeContext.ts
|
|
1139
|
-
var
|
|
1097
|
+
var Ye = e(null), Xe = (e) => e === "highContrast" ? "high-contrast" : e, Ze = ({ theme: e, defaultTheme: t = "light", onThemeChange: n, children: r }) => {
|
|
1140
1098
|
let [a, s] = T({
|
|
1141
1099
|
value: e,
|
|
1142
1100
|
defaultValue: t,
|
|
1143
1101
|
onChange: n
|
|
1144
|
-
}), c =
|
|
1102
|
+
}), c = Xe(a);
|
|
1145
1103
|
i(() => {
|
|
1146
1104
|
if (typeof document > "u") return;
|
|
1147
1105
|
let { documentElement: e } = document, t = e.dataset.velliraTheme;
|
|
@@ -1157,7 +1115,7 @@ var Je = e(null), Ye = (e) => e === "highContrast" ? "high-contrast" : e, Xe = (
|
|
|
1157
1115
|
theme: a,
|
|
1158
1116
|
setTheme: s
|
|
1159
1117
|
}), [a, s]);
|
|
1160
|
-
return /* @__PURE__ */ f(
|
|
1118
|
+
return /* @__PURE__ */ f(Ye.Provider, {
|
|
1161
1119
|
value: l,
|
|
1162
1120
|
children: /* @__PURE__ */ f("div", {
|
|
1163
1121
|
"data-vellira-theme": c,
|
|
@@ -1165,13 +1123,13 @@ var Je = e(null), Ye = (e) => e === "highContrast" ? "high-contrast" : e, Xe = (
|
|
|
1165
1123
|
})
|
|
1166
1124
|
});
|
|
1167
1125
|
};
|
|
1168
|
-
|
|
1126
|
+
Ze.displayName = "ThemeProvider";
|
|
1169
1127
|
//#endregion
|
|
1170
1128
|
//#region src/theme/useTheme.ts
|
|
1171
|
-
function
|
|
1172
|
-
let e = r(
|
|
1129
|
+
function Qe() {
|
|
1130
|
+
let e = r(Ye);
|
|
1173
1131
|
if (!e) throw Error("useTheme must be used within ThemeProvider.");
|
|
1174
1132
|
return e;
|
|
1175
1133
|
}
|
|
1176
1134
|
//#endregion
|
|
1177
|
-
export { We as Button, Ge as Checkbox,
|
|
1135
|
+
export { We as Button, Ge as Checkbox, ae as Dropdown, Se as FormField, Je as Input, xe as Modal, Ce as RadioGroup, ke as Select, ze as Tabs, Ze as ThemeProvider, He as Tooltip, Qe as useTheme };
|