@bzync/rui 0.0.4 → 0.0.8
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 +10 -0
- package/dist/autocomplete-D6z5B-WU.cjs +1 -0
- package/dist/{autocomplete-BgKbj6M4.js → autocomplete-bgySuP8X.js} +149 -142
- package/dist/calendar-CQumLNgS.cjs +1 -0
- package/dist/{calendar-j2_zvum1.js → calendar-nkYCMEy3.js} +9 -9
- package/dist/charts-Cot5lCgC.cjs +1 -0
- package/dist/{charts-CxEy2c3M.js → charts-Dscl6UC3.js} +122 -145
- package/dist/cn-B6R3HKzx.cjs +1 -0
- package/dist/{cn-DpgY2leY.js → cn-BJyZJP-y.js} +389 -389
- package/dist/{component-styles-Bgy44fc8.js → component-styles-C2CbHEEA.js} +2 -2
- package/dist/component-styles-DY4wigiq.cjs +1 -0
- package/dist/components/accordion.cjs +1 -1
- package/dist/components/accordion.js +2 -2
- package/dist/components/alert.cjs +1 -1
- package/dist/components/alert.js +3 -3
- package/dist/components/aspect-ratio.cjs +1 -0
- package/dist/components/aspect-ratio.d.ts +5 -0
- package/dist/components/aspect-ratio.js +20 -0
- package/dist/components/auth-backdrop.cjs +1 -1
- package/dist/components/auth-backdrop.d.ts +4 -1
- package/dist/components/auth-backdrop.js +12 -8
- package/dist/components/autocomplete/dropdown.d.ts +4 -1
- package/dist/components/autocomplete/multi-trigger.d.ts +3 -1
- package/dist/components/autocomplete/single-trigger.d.ts +3 -1
- package/dist/components/autocomplete/types.d.ts +15 -0
- package/dist/components/autocomplete.cjs +1 -1
- package/dist/components/autocomplete.js +1 -1
- package/dist/components/avatar-group.cjs +1 -0
- package/dist/components/avatar-group.d.ts +14 -0
- package/dist/components/avatar-group.js +35 -0
- package/dist/components/avatar.cjs +1 -1
- package/dist/components/avatar.js +2 -2
- package/dist/components/badge.cjs +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/billing-interval-toggle.cjs +1 -1
- package/dist/components/billing-interval-toggle.d.ts +4 -6
- package/dist/components/billing-interval-toggle.js +26 -19
- package/dist/components/blockquote.cjs +1 -0
- package/dist/components/blockquote.d.ts +10 -0
- package/dist/components/blockquote.js +32 -0
- package/dist/components/breadcrumb.cjs +1 -1
- package/dist/components/breadcrumb.js +2 -2
- package/dist/components/button-group.cjs +1 -0
- package/dist/components/button-group.d.ts +7 -0
- package/dist/components/button-group.js +26 -0
- package/dist/components/button.cjs +1 -1
- package/dist/components/button.d.ts +2 -0
- package/dist/components/button.js +79 -36
- package/dist/components/calendar.cjs +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/callout.cjs +1 -1
- package/dist/components/callout.js +14 -14
- package/dist/components/card.cjs +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/charts/shared.d.ts +15 -0
- package/dist/components/charts.cjs +1 -1
- package/dist/components/charts.js +1 -1
- package/dist/components/checkbox.cjs +1 -1
- package/dist/components/checkbox.js +3 -3
- package/dist/components/code.cjs +3 -3
- package/dist/components/code.d.ts +4 -4
- package/dist/components/code.js +62 -60
- package/dist/components/command.cjs +1 -1
- package/dist/components/command.d.ts +8 -1
- package/dist/components/command.js +84 -83
- package/dist/components/confirm-dialog.cjs +1 -1
- package/dist/components/confirm-dialog.d.ts +8 -1
- package/dist/components/confirm-dialog.js +37 -31
- package/dist/components/copy-button.cjs +1 -1
- package/dist/components/copy-button.js +5 -4
- package/dist/components/currency.cjs +1 -0
- package/dist/components/currency.d.ts +18 -0
- package/dist/components/currency.js +62 -0
- package/dist/components/datatable/types.d.ts +4 -0
- package/dist/components/datatable.cjs +1 -1
- package/dist/components/datatable.d.ts +1 -5
- package/dist/components/datatable.js +1 -1
- package/dist/components/datepicker.cjs +1 -1
- package/dist/components/datepicker.d.ts +3 -3
- package/dist/components/datepicker.js +234 -105
- package/dist/components/description-list.cjs +1 -0
- package/dist/components/description-list.d.ts +14 -0
- package/dist/components/description-list.js +38 -0
- package/dist/components/divider.cjs +1 -0
- package/dist/components/divider.d.ts +12 -0
- package/dist/components/divider.js +45 -0
- package/dist/components/drawer.cjs +1 -1
- package/dist/components/drawer.d.ts +6 -1
- package/dist/components/drawer.js +128 -2
- package/dist/components/dropdown-menu-panel.cjs +1 -0
- package/dist/components/dropdown-menu-panel.d.ts +24 -0
- package/dist/components/dropdown-menu-panel.js +84 -0
- package/dist/components/dropdown-menu.cjs +1 -1
- package/dist/components/dropdown-menu.d.ts +5 -1
- package/dist/components/dropdown-menu.js +38 -93
- package/dist/components/empty-state.cjs +1 -1
- package/dist/components/empty-state.d.ts +5 -1
- package/dist/components/empty-state.js +9 -9
- package/dist/components/error-state.cjs +1 -1
- package/dist/components/error-state.js +2 -2
- package/dist/components/file-upload.cjs +1 -1
- package/dist/components/file-upload.js +4 -4
- package/dist/components/form-field.cjs +1 -1
- package/dist/components/form-field.d.ts +9 -0
- package/dist/components/form-field.js +49 -14
- package/dist/components/info-button.cjs +1 -1
- package/dist/components/info-button.d.ts +5 -3
- package/dist/components/info-button.js +33 -29
- package/dist/components/input.cjs +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/kbd.cjs +1 -1
- package/dist/components/kbd.js +1 -1
- package/dist/components/label.cjs +1 -1
- package/dist/components/label.js +2 -2
- package/dist/components/layout.cjs +1 -1
- package/dist/components/layout.js +1 -1
- package/dist/components/link.cjs +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/list.cjs +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/modal.cjs +1 -1
- package/dist/components/modal.d.ts +8 -1
- package/dist/components/modal.js +74 -120
- package/dist/components/navigation.cjs +1 -1
- package/dist/components/navigation.js +2 -2
- package/dist/components/number-input.cjs +1 -1
- package/dist/components/number-input.js +3 -3
- package/dist/components/otp-input.cjs +1 -1
- package/dist/components/otp-input.js +2 -2
- package/dist/components/overlay.cjs +1 -0
- package/dist/components/overlay.d.ts +52 -0
- package/dist/components/overlay.js +87 -0
- package/dist/components/pagination.cjs +1 -1
- package/dist/components/pagination.js +2 -2
- package/dist/components/popover.cjs +1 -1
- package/dist/components/popover.d.ts +2 -1
- package/dist/components/popover.js +41 -40
- package/dist/components/progressbar.cjs +1 -1
- package/dist/components/progressbar.js +1 -1
- package/dist/components/radio.cjs +1 -1
- package/dist/components/radio.js +3 -3
- package/dist/components/rating.cjs +1 -0
- package/dist/components/rating.d.ts +15 -0
- package/dist/components/rating.js +75 -0
- package/dist/components/richtext.cjs +1 -1
- package/dist/components/richtext.js +2 -2
- package/dist/components/scroll-area.cjs +1 -0
- package/dist/components/scroll-area.d.ts +8 -0
- package/dist/components/scroll-area.js +19 -0
- package/dist/components/select/option-list.d.ts +3 -1
- package/dist/components/select/types.d.ts +4 -0
- package/dist/components/select.cjs +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/seo.cjs +1 -1
- package/dist/components/seo.js +1 -1
- package/dist/components/separator.cjs +1 -1
- package/dist/components/separator.js +1 -1
- package/dist/components/skeleton.cjs +1 -1
- package/dist/components/skeleton.d.ts +14 -1
- package/dist/components/skeleton.js +56 -4
- package/dist/components/slider.cjs +1 -1
- package/dist/components/slider.js +2 -2
- package/dist/components/slot.cjs +1 -0
- package/dist/components/slot.d.ts +12 -0
- package/dist/components/slot.js +16 -0
- package/dist/components/snackbar-viewport.cjs +1 -0
- package/dist/components/snackbar-viewport.d.ts +27 -0
- package/dist/components/snackbar-viewport.js +181 -0
- package/dist/components/snackbar.cjs +1 -1
- package/dist/components/snackbar.d.ts +5 -1
- package/dist/components/snackbar.js +36 -200
- package/dist/components/spinner.cjs +1 -1
- package/dist/components/spinner.js +1 -1
- package/dist/components/stat.cjs +1 -1
- package/dist/components/stat.js +1 -1
- package/dist/components/status-dot.cjs +1 -1
- package/dist/components/status-dot.js +1 -1
- package/dist/components/stepper.cjs +1 -1
- package/dist/components/stepper.js +5 -5
- package/dist/components/switch.cjs +1 -1
- package/dist/components/switch.js +37 -43
- package/dist/components/table.cjs +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.cjs +1 -1
- package/dist/components/tabs.d.ts +6 -4
- package/dist/components/tabs.js +51 -81
- package/dist/components/tag.cjs +1 -1
- package/dist/components/tag.js +1 -1
- package/dist/components/terminal.cjs +1 -1
- package/dist/components/terminal.js +1 -1
- package/dist/components/textarea.cjs +1 -1
- package/dist/components/textarea.js +3 -3
- package/dist/components/theme-provider.cjs +1 -1
- package/dist/components/theme-provider.js +1 -1
- package/dist/components/theme-toggle.cjs +1 -1
- package/dist/components/theme-toggle.js +27 -3
- package/dist/components/time-picker.cjs +1 -0
- package/dist/components/time-picker.d.ts +31 -0
- package/dist/components/time-picker.js +394 -0
- package/dist/components/timeline.cjs +1 -1
- package/dist/components/timeline.js +1 -1
- package/dist/components/toggle.cjs +1 -0
- package/dist/components/toggle.d.ts +42 -0
- package/dist/components/toggle.js +116 -0
- package/dist/components/tooltip.cjs +1 -1
- package/dist/components/tooltip.d.ts +2 -1
- package/dist/components/tooltip.js +37 -36
- package/dist/components/tree.cjs +1 -1
- package/dist/components/tree.js +1 -1
- package/dist/components/typography.cjs +1 -0
- package/dist/components/typography.d.ts +50 -0
- package/dist/components/typography.js +202 -0
- package/dist/components/visually-hidden.cjs +1 -0
- package/dist/components/visually-hidden.d.ts +16 -0
- package/dist/components/visually-hidden.js +13 -0
- package/dist/{datatable-yBN4M3UV.js → datatable-BJoZMrKI.js} +6 -6
- package/dist/datatable-t0U7t_xh.cjs +1 -0
- package/dist/icons-Dfetr1L2.cjs +1 -0
- package/dist/icons-Dk7VZ4Ph.js +51 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.js +125 -86
- package/dist/lib/cn.d.ts +13 -1
- package/dist/lib/component-styles.d.ts +14 -2
- package/dist/lib/icons.d.ts +12 -0
- package/dist/lib/motion.d.ts +58 -0
- package/dist/motion-B2shivEB.cjs +1 -0
- package/dist/motion-gnRzFS5f.js +62 -0
- package/dist/select-ByjnuEcE.cjs +1 -0
- package/dist/{select-ClWrcj3R.js → select-CiMzLhUK.js} +128 -122
- package/dist/styles.css +1 -1
- package/dist/{terminal-CpraMs50.cjs → terminal-1U0ftG3i.cjs} +2 -2
- package/dist/{terminal-BOR2cFi1.js → terminal-VXdxVoAv.js} +4 -4
- package/dist/use-focus-trap-CPLT49gN.cjs +1 -0
- package/dist/use-focus-trap-CS6BXJAB.js +77 -0
- package/dist/{utils-CQ8pvCtk.js → utils-DEw5mQrH.js} +1 -1
- package/dist/{utils-DOFJTw8o.cjs → utils-MnnCTelh.cjs} +1 -1
- package/package.json +56 -9
- package/dist/autocomplete-Bk4pRQ2R.cjs +0 -1
- package/dist/calendar-CUXpVrVE.cjs +0 -1
- package/dist/charts-UDqS1BH1.cjs +0 -1
- package/dist/cn-BdjraxxU.cjs +0 -1
- package/dist/component-styles-DOUctc8_.cjs +0 -1
- package/dist/createLucideIcon-DDY8HuQR.js +0 -42
- package/dist/createLucideIcon-b_X_3fj-.cjs +0 -1
- package/dist/datatable-rzDgQ3r6.cjs +0 -1
- package/dist/drawer-CTeBsYrO.cjs +0 -1
- package/dist/drawer-ixuzyLVS.js +0 -189
- package/dist/select-BFwx--uK.cjs +0 -1
- package/dist/theme-toggle-Bb0BYo51.js +0 -71
- package/dist/theme-toggle-Cld8tktJ.cjs +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { t as e } from "./cn-
|
|
2
|
-
import { o as t, t as n } from "./component-styles-
|
|
3
|
-
import { a as r, i, n as a, o, r as s, t as c } from "./utils-
|
|
1
|
+
import { t as e } from "./cn-BJyZJP-y.js";
|
|
2
|
+
import { o as t, t as n } from "./component-styles-C2CbHEEA.js";
|
|
3
|
+
import { a as r, i, n as a, o, r as s, t as c } from "./utils-DEw5mQrH.js";
|
|
4
4
|
import { t as l } from "./use-event-callback-DGkfO_uu.js";
|
|
5
5
|
import { AnimatePresence as u, motion as d } from "framer-motion";
|
|
6
6
|
import { forwardRef as f, useCallback as p, useEffect as m, useId as h, useMemo as g, useRef as _, useState as v } from "react";
|
|
7
|
-
import { Fragment as
|
|
8
|
-
import { createPortal as
|
|
7
|
+
import { Fragment as ee, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
8
|
+
import { createPortal as x } from "react-dom";
|
|
9
9
|
//#region src/components/select/option-list.tsx
|
|
10
|
-
function
|
|
11
|
-
return typeof document > "u" ? null :
|
|
10
|
+
function S({ listId: t, listRef: n, open: i, pos: a, options: o, flat: s, activeIdx: c, setActiveIdx: l, isSelected: f, onSelect: p, colorDot: m, multiselectable: h = !1, className: g, optionClassName: _, groupLabelClassName: v }) {
|
|
11
|
+
return typeof document > "u" ? null : x(/* @__PURE__ */ y(u, { children: i && a && /* @__PURE__ */ y(d.ul, {
|
|
12
12
|
ref: n,
|
|
13
13
|
id: t,
|
|
14
14
|
role: "listbox",
|
|
@@ -38,12 +38,12 @@ function C({ listId: t, listRef: n, open: i, pos: a, options: o, flat: s, active
|
|
|
38
38
|
maxHeight: a.maxHeight
|
|
39
39
|
},
|
|
40
40
|
className: e("z-[110] overflow-y-auto rounded-[var(--radius-lg)] border border-border bg-surface-raised py-1 shadow-floating", g),
|
|
41
|
-
children: o.map((
|
|
42
|
-
className: "px-3 pt-2 pb-1 text-xs font-semibold text-slate-600 uppercase tracking-widest",
|
|
43
|
-
children:
|
|
44
|
-
}), /* @__PURE__ */
|
|
41
|
+
children: o.map((n, i) => r(n) ? /* @__PURE__ */ b("li", { children: [/* @__PURE__ */ y("p", {
|
|
42
|
+
className: e("px-3 pt-2 pb-1 text-xs font-semibold text-slate-600 uppercase tracking-widest", v),
|
|
43
|
+
children: n.group
|
|
44
|
+
}), /* @__PURE__ */ y("ul", { children: n.options.map((e) => {
|
|
45
45
|
let n = s.find((t) => t.value === e.value);
|
|
46
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ y(C, {
|
|
47
47
|
opt: e,
|
|
48
48
|
listId: t,
|
|
49
49
|
flatIdx: n.flatIdx,
|
|
@@ -51,22 +51,24 @@ function C({ listId: t, listRef: n, open: i, pos: a, options: o, flat: s, active
|
|
|
51
51
|
isSelected: f(e.value),
|
|
52
52
|
onSelect: p,
|
|
53
53
|
onHover: l,
|
|
54
|
-
colorDot: m
|
|
54
|
+
colorDot: m,
|
|
55
|
+
className: _
|
|
55
56
|
}, e.value);
|
|
56
|
-
}) })] },
|
|
57
|
-
opt:
|
|
57
|
+
}) })] }, i) : /* @__PURE__ */ y(C, {
|
|
58
|
+
opt: n,
|
|
58
59
|
listId: t,
|
|
59
|
-
flatIdx: s.find((
|
|
60
|
-
isActive: s.find((
|
|
61
|
-
isSelected: f(
|
|
60
|
+
flatIdx: s.find((e) => e.value === n.value).flatIdx,
|
|
61
|
+
isActive: s.find((e) => e.value === n.value).flatIdx === c,
|
|
62
|
+
isSelected: f(n.value),
|
|
62
63
|
onSelect: p,
|
|
63
64
|
onHover: l,
|
|
64
|
-
colorDot: m
|
|
65
|
-
|
|
65
|
+
colorDot: m,
|
|
66
|
+
className: _
|
|
67
|
+
}, n.value))
|
|
66
68
|
}) }), document.body);
|
|
67
69
|
}
|
|
68
|
-
function
|
|
69
|
-
return /* @__PURE__ */
|
|
70
|
+
function C({ opt: t, listId: n, flatIdx: r, isActive: i, isSelected: a, onSelect: o, onHover: s, colorDot: c, className: l }) {
|
|
71
|
+
return /* @__PURE__ */ b("li", {
|
|
70
72
|
id: `${n}-opt-${r}`,
|
|
71
73
|
role: "option",
|
|
72
74
|
"aria-selected": a,
|
|
@@ -75,24 +77,24 @@ function w({ opt: t, listId: n, flatIdx: r, isActive: i, isSelected: a, onSelect
|
|
|
75
77
|
onMouseDown: (e) => e.preventDefault(),
|
|
76
78
|
onClick: () => !t.disabled && o(t),
|
|
77
79
|
onMouseEnter: () => !t.disabled && s(r),
|
|
78
|
-
className: e("flex min-h-9 items-center gap-3 px-3 py-2 cursor-pointer transition-colors select-none", i && "bg-surface-muted", a && !i && "bg-accent-50 dark:bg-accent-500/10", t.disabled && "opacity-40 cursor-not-allowed pointer-events-none"),
|
|
80
|
+
className: e("flex min-h-9 items-center gap-3 px-3 py-2 cursor-pointer transition-colors select-none", i && "bg-surface-muted", a && !i && "bg-accent-50 dark:bg-accent-500/10", t.disabled && "opacity-40 cursor-not-allowed pointer-events-none", l),
|
|
79
81
|
children: [
|
|
80
|
-
t.icon && /* @__PURE__ */
|
|
82
|
+
t.icon && /* @__PURE__ */ y("span", {
|
|
81
83
|
className: "shrink-0 text-slate-500 dark:text-slate-400",
|
|
82
84
|
children: t.icon
|
|
83
85
|
}),
|
|
84
|
-
t.color && t.color !== "default" && /* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
+
t.color && t.color !== "default" && /* @__PURE__ */ y("span", { className: e("w-2 h-2 rounded-full shrink-0", c[t.color]) }),
|
|
87
|
+
/* @__PURE__ */ b("div", {
|
|
86
88
|
className: "min-w-0 flex-1",
|
|
87
|
-
children: [/* @__PURE__ */
|
|
89
|
+
children: [/* @__PURE__ */ y("p", {
|
|
88
90
|
className: e("text-sm leading-snug truncate", a ? "text-accent-700 dark:text-accent-300 font-medium" : "text-foreground"),
|
|
89
91
|
children: t.label
|
|
90
|
-
}), t.description && /* @__PURE__ */
|
|
92
|
+
}), t.description && /* @__PURE__ */ y("p", {
|
|
91
93
|
className: "mt-0.5 truncate text-xs text-muted-foreground",
|
|
92
94
|
children: t.description
|
|
93
95
|
})]
|
|
94
96
|
}),
|
|
95
|
-
a && /* @__PURE__ */
|
|
97
|
+
a && /* @__PURE__ */ y("svg", {
|
|
96
98
|
"aria-hidden": "true",
|
|
97
99
|
width: "14",
|
|
98
100
|
height: "14",
|
|
@@ -103,19 +105,19 @@ function w({ opt: t, listId: n, flatIdx: r, isActive: i, isSelected: a, onSelect
|
|
|
103
105
|
strokeLinecap: "round",
|
|
104
106
|
strokeLinejoin: "round",
|
|
105
107
|
className: "text-accent-600 shrink-0",
|
|
106
|
-
children: /* @__PURE__ */
|
|
108
|
+
children: /* @__PURE__ */ y("path", { d: "m20 6-11 11-5-5" })
|
|
107
109
|
})
|
|
108
110
|
]
|
|
109
111
|
});
|
|
110
112
|
}
|
|
111
113
|
//#endregion
|
|
112
114
|
//#region src/components/select/select-single.tsx
|
|
113
|
-
var
|
|
114
|
-
let L = h(), R =
|
|
115
|
+
var w = f(({ options: r, value: u, defaultValue: d, onChange: f, placeholder: x = "Select…", label: C, hint: w, error: T, disabled: E, required: D, clearable: O = !1, className: k, wrapperClassName: A, triggerClassName: j, listClassName: M, labelClassName: te, messageClassName: N, optionClassName: ne, groupLabelClassName: P, id: re, unstyled: F = !1 }, I) => {
|
|
116
|
+
let L = h(), R = re ?? L, z = `${R}-list`, B = `${R}-message`, [V, H] = v(!1), [U, W] = v(d ?? ""), [G, K] = v(-1), q = _(null), J = _(null), Y = l((e) => f?.(e)), X = u === void 0 ? U : u, Z = g(() => i(r), [r]), Q = g(() => Z.find((e) => e.value === X), [Z, X]), $ = p((e) => {
|
|
115
117
|
u === void 0 && W(e.value), Y(e.value), H(!1), K(-1);
|
|
116
|
-
}, [u, Y]),
|
|
118
|
+
}, [u, Y]), ie = p((e) => {
|
|
117
119
|
e.stopPropagation(), u === void 0 && W(""), Y("");
|
|
118
|
-
}, [u, Y]),
|
|
120
|
+
}, [u, Y]), ae = p((e) => {
|
|
119
121
|
if (!V) {
|
|
120
122
|
if ([
|
|
121
123
|
"Enter",
|
|
@@ -158,46 +160,46 @@ var T = f(({ options: r, value: u, defaultValue: d, onChange: f, placeholder: S
|
|
|
158
160
|
}
|
|
159
161
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
160
162
|
}, []);
|
|
161
|
-
let
|
|
162
|
-
return F ? /* @__PURE__ */
|
|
163
|
+
let oe = o(V, q);
|
|
164
|
+
return F ? /* @__PURE__ */ b("div", {
|
|
163
165
|
ref: q,
|
|
164
|
-
className: e(
|
|
165
|
-
children: [/* @__PURE__ */
|
|
166
|
+
className: e(k, A),
|
|
167
|
+
children: [/* @__PURE__ */ y("button", {
|
|
166
168
|
ref: I,
|
|
167
169
|
id: R,
|
|
168
170
|
type: "button",
|
|
169
171
|
role: "combobox",
|
|
170
172
|
"aria-expanded": V,
|
|
171
173
|
onClick: () => H((e) => !e),
|
|
172
|
-
className:
|
|
173
|
-
children: Q?.label ??
|
|
174
|
-
}), V && /* @__PURE__ */
|
|
174
|
+
className: j,
|
|
175
|
+
children: Q?.label ?? x
|
|
176
|
+
}), V && /* @__PURE__ */ y("ul", {
|
|
175
177
|
ref: J,
|
|
176
178
|
id: z,
|
|
177
|
-
className:
|
|
178
|
-
children: Z.map((e) => /* @__PURE__ */
|
|
179
|
+
className: M,
|
|
180
|
+
children: Z.map((e) => /* @__PURE__ */ y("li", {
|
|
179
181
|
"data-idx": e.flatIdx,
|
|
180
182
|
onClick: () => $(e),
|
|
181
183
|
children: e.label
|
|
182
184
|
}, e.value))
|
|
183
185
|
})]
|
|
184
|
-
}) : /* @__PURE__ */
|
|
186
|
+
}) : /* @__PURE__ */ b("div", {
|
|
185
187
|
ref: q,
|
|
186
|
-
className: e("relative", t,
|
|
188
|
+
className: e("relative", t, A, k),
|
|
187
189
|
children: [
|
|
188
|
-
|
|
190
|
+
C && /* @__PURE__ */ b("label", {
|
|
189
191
|
htmlFor: R,
|
|
190
|
-
className: "text-xs font-semibold leading-5 text-foreground",
|
|
191
|
-
children: [
|
|
192
|
+
className: e("text-xs font-semibold leading-5 text-foreground", te),
|
|
193
|
+
children: [C, D && /* @__PURE__ */ b(ee, { children: [/* @__PURE__ */ y("span", {
|
|
192
194
|
"aria-hidden": "true",
|
|
193
195
|
className: "ml-1 text-destructive",
|
|
194
196
|
children: "*"
|
|
195
|
-
}), /* @__PURE__ */
|
|
197
|
+
}), /* @__PURE__ */ y("span", {
|
|
196
198
|
className: "sr-only",
|
|
197
199
|
children: " (required)"
|
|
198
200
|
})] })]
|
|
199
201
|
}),
|
|
200
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ b("button", {
|
|
201
203
|
ref: I,
|
|
202
204
|
id: R,
|
|
203
205
|
type: "button",
|
|
@@ -206,40 +208,40 @@ var T = f(({ options: r, value: u, defaultValue: d, onChange: f, placeholder: S
|
|
|
206
208
|
"aria-expanded": V,
|
|
207
209
|
"aria-controls": z,
|
|
208
210
|
"aria-activedescendant": V && G >= 0 ? `${z}-opt-${G}` : void 0,
|
|
209
|
-
"aria-invalid":
|
|
210
|
-
"aria-required":
|
|
211
|
-
"aria-describedby":
|
|
212
|
-
disabled:
|
|
213
|
-
onKeyDown:
|
|
211
|
+
"aria-invalid": T ? !0 : void 0,
|
|
212
|
+
"aria-required": D || void 0,
|
|
213
|
+
"aria-describedby": T || w ? B : void 0,
|
|
214
|
+
disabled: E,
|
|
215
|
+
onKeyDown: ae,
|
|
214
216
|
onClick: () => {
|
|
215
|
-
|
|
217
|
+
E || (H((e) => !e), V || K(Z.find((e) => e.value === X && e.flatIdx >= 0)?.flatIdx ?? -1));
|
|
216
218
|
},
|
|
217
|
-
className: e("flex h-9 w-full items-center gap-2 rounded-[var(--radius-md)] px-3 text-left outline-none", n, "focus:border-accent-500 focus:ring-
|
|
219
|
+
className: e("flex h-9 w-full items-center gap-2 rounded-[var(--radius-md)] px-3 text-left outline-none", n, "focus:border-accent-500 focus:ring-[3px] focus:ring-focus-ring/25", T && "border-destructive/60 hover:border-destructive/70 focus-within:border-destructive focus-within:ring-destructive/25", E && "opacity-50 cursor-not-allowed", j),
|
|
218
220
|
children: [
|
|
219
|
-
Q?.icon && /* @__PURE__ */
|
|
221
|
+
Q?.icon && /* @__PURE__ */ y("span", {
|
|
220
222
|
className: "shrink-0 text-slate-500 dark:text-slate-400",
|
|
221
223
|
children: Q.icon
|
|
222
224
|
}),
|
|
223
|
-
Q?.color && Q.color !== "default" && /* @__PURE__ */
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
+
Q?.color && Q.color !== "default" && /* @__PURE__ */ y("span", { className: e("w-2 h-2 rounded-full shrink-0", s[Q.color]) }),
|
|
226
|
+
/* @__PURE__ */ y("span", {
|
|
225
227
|
className: e("flex-1 min-w-0 text-sm truncate", Q ? "text-foreground" : "text-muted-foreground"),
|
|
226
|
-
children: Q?.label ??
|
|
228
|
+
children: Q?.label ?? x
|
|
227
229
|
}),
|
|
228
|
-
|
|
230
|
+
O && X && !E && /* @__PURE__ */ y("span", {
|
|
229
231
|
role: "button",
|
|
230
232
|
tabIndex: -1,
|
|
231
|
-
onClick:
|
|
233
|
+
onClick: ie,
|
|
232
234
|
className: "shrink-0 text-slate-400 hover:text-slate-600 dark:hover:text-slate-300 transition-colors",
|
|
233
|
-
children: /* @__PURE__ */
|
|
235
|
+
children: /* @__PURE__ */ y(a, {})
|
|
234
236
|
}),
|
|
235
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ y(c, { open: V })
|
|
236
238
|
]
|
|
237
239
|
}),
|
|
238
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ y(S, {
|
|
239
241
|
listId: z,
|
|
240
242
|
listRef: J,
|
|
241
243
|
open: V,
|
|
242
|
-
pos:
|
|
244
|
+
pos: oe,
|
|
243
245
|
options: r,
|
|
244
246
|
flat: Z,
|
|
245
247
|
activeIdx: G,
|
|
@@ -247,27 +249,29 @@ var T = f(({ options: r, value: u, defaultValue: d, onChange: f, placeholder: S
|
|
|
247
249
|
isSelected: (e) => e === X,
|
|
248
250
|
onSelect: $,
|
|
249
251
|
colorDot: s,
|
|
250
|
-
className:
|
|
252
|
+
className: M,
|
|
253
|
+
optionClassName: ne,
|
|
254
|
+
groupLabelClassName: P
|
|
251
255
|
}),
|
|
252
|
-
|
|
256
|
+
T && /* @__PURE__ */ y("p", {
|
|
253
257
|
id: B,
|
|
254
258
|
"aria-live": "polite",
|
|
255
|
-
className: "text-xs leading-5 text-destructive",
|
|
256
|
-
children:
|
|
259
|
+
className: e("text-xs leading-5 text-destructive", N),
|
|
260
|
+
children: T
|
|
257
261
|
}),
|
|
258
|
-
|
|
262
|
+
w && !T && /* @__PURE__ */ y("p", {
|
|
259
263
|
id: B,
|
|
260
|
-
className: "text-xs leading-5 text-muted-foreground",
|
|
261
|
-
children:
|
|
264
|
+
className: e("text-xs leading-5 text-muted-foreground", N),
|
|
265
|
+
children: w
|
|
262
266
|
})
|
|
263
267
|
]
|
|
264
268
|
});
|
|
265
269
|
});
|
|
266
|
-
|
|
270
|
+
w.displayName = "SelectSingle";
|
|
267
271
|
//#endregion
|
|
268
272
|
//#region src/components/select/select-multi.tsx
|
|
269
|
-
var
|
|
270
|
-
let
|
|
273
|
+
var T = f(({ options: r, value: l, defaultValue: u, onChange: d, placeholder: f = "Select…", label: p, hint: g, error: x, disabled: C, required: w, clearable: T = !1, className: E, wrapperClassName: D, triggerClassName: O, listClassName: k, labelClassName: A, messageClassName: j, optionClassName: M, groupLabelClassName: te, id: N, unstyled: ne = !1 }, P) => {
|
|
274
|
+
let re = h(), F = N ?? re, I = `${F}-list`, L = `${F}-message`, [R, z] = v(!1), [B, V] = v(u ?? []), [H, U] = v(-1), W = _(null), G = _(null), K = l === void 0 ? B : l, q = i(r), J = q.filter((e) => K.includes(e.value));
|
|
271
275
|
function Y(e) {
|
|
272
276
|
let t = K.includes(e.value) ? K.filter((t) => t !== e.value) : [...K, e.value];
|
|
273
277
|
l === void 0 && V(t), d?.(t);
|
|
@@ -314,11 +318,11 @@ var E = f(({ options: r, value: l, defaultValue: u, onChange: d, placeholder: f
|
|
|
314
318
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
315
319
|
}, []);
|
|
316
320
|
let $ = o(R, W);
|
|
317
|
-
return
|
|
321
|
+
return ne ? /* @__PURE__ */ b("div", {
|
|
318
322
|
ref: W,
|
|
319
|
-
className: e(
|
|
320
|
-
children: [/* @__PURE__ */
|
|
321
|
-
ref:
|
|
323
|
+
className: e(E, D),
|
|
324
|
+
children: [/* @__PURE__ */ y("button", {
|
|
325
|
+
ref: P,
|
|
322
326
|
id: F,
|
|
323
327
|
type: "button",
|
|
324
328
|
role: "combobox",
|
|
@@ -326,9 +330,9 @@ var E = f(({ options: r, value: l, defaultValue: u, onChange: d, placeholder: f
|
|
|
326
330
|
"aria-controls": I,
|
|
327
331
|
onKeyDown: Q,
|
|
328
332
|
onClick: () => z((e) => !e),
|
|
329
|
-
className:
|
|
333
|
+
className: O,
|
|
330
334
|
children: J.length > 0 ? J.map((e) => e.label).join(", ") : f
|
|
331
|
-
}), /* @__PURE__ */
|
|
335
|
+
}), /* @__PURE__ */ y(S, {
|
|
332
336
|
listId: I,
|
|
333
337
|
listRef: G,
|
|
334
338
|
open: R,
|
|
@@ -341,26 +345,26 @@ var E = f(({ options: r, value: l, defaultValue: u, onChange: d, placeholder: f
|
|
|
341
345
|
onSelect: Y,
|
|
342
346
|
multiselectable: !0,
|
|
343
347
|
colorDot: s,
|
|
344
|
-
className:
|
|
348
|
+
className: k
|
|
345
349
|
})]
|
|
346
|
-
}) : /* @__PURE__ */
|
|
350
|
+
}) : /* @__PURE__ */ b("div", {
|
|
347
351
|
ref: W,
|
|
348
|
-
className: e("relative", t,
|
|
352
|
+
className: e("relative", t, D, E),
|
|
349
353
|
children: [
|
|
350
|
-
p && /* @__PURE__ */
|
|
354
|
+
p && /* @__PURE__ */ b("label", {
|
|
351
355
|
htmlFor: F,
|
|
352
|
-
className: "text-xs font-semibold leading-5 text-foreground",
|
|
353
|
-
children: [p,
|
|
356
|
+
className: e("text-xs font-semibold leading-5 text-foreground", A),
|
|
357
|
+
children: [p, w && /* @__PURE__ */ b(ee, { children: [/* @__PURE__ */ y("span", {
|
|
354
358
|
"aria-hidden": "true",
|
|
355
359
|
className: "ml-1 text-destructive",
|
|
356
360
|
children: "*"
|
|
357
|
-
}), /* @__PURE__ */
|
|
361
|
+
}), /* @__PURE__ */ y("span", {
|
|
358
362
|
className: "sr-only",
|
|
359
363
|
children: " (required)"
|
|
360
364
|
})] })]
|
|
361
365
|
}),
|
|
362
|
-
/* @__PURE__ */
|
|
363
|
-
ref:
|
|
366
|
+
/* @__PURE__ */ b("button", {
|
|
367
|
+
ref: P,
|
|
364
368
|
id: F,
|
|
365
369
|
type: "button",
|
|
366
370
|
role: "combobox",
|
|
@@ -368,56 +372,56 @@ var E = f(({ options: r, value: l, defaultValue: u, onChange: d, placeholder: f
|
|
|
368
372
|
"aria-expanded": R,
|
|
369
373
|
"aria-controls": I,
|
|
370
374
|
"aria-activedescendant": R && H >= 0 ? `${I}-opt-${H}` : void 0,
|
|
371
|
-
"aria-invalid":
|
|
372
|
-
"aria-required":
|
|
373
|
-
"aria-describedby":
|
|
374
|
-
disabled:
|
|
375
|
+
"aria-invalid": x ? !0 : void 0,
|
|
376
|
+
"aria-required": w || void 0,
|
|
377
|
+
"aria-describedby": x || g ? L : void 0,
|
|
378
|
+
disabled: C,
|
|
375
379
|
onKeyDown: Q,
|
|
376
380
|
onClick: () => {
|
|
377
|
-
|
|
381
|
+
C || z((e) => !e);
|
|
378
382
|
},
|
|
379
|
-
className: e("flex min-h-9 w-full flex-wrap items-center gap-1.5 rounded-[var(--radius-md)] px-2.5 py-1.5 text-left outline-none", n, "focus:border-accent-500 focus:ring-
|
|
380
|
-
children: [J.length === 0 ? /* @__PURE__ */
|
|
383
|
+
className: e("flex min-h-9 w-full flex-wrap items-center gap-1.5 rounded-[var(--radius-md)] px-2.5 py-1.5 text-left outline-none", n, "focus:border-accent-500 focus:ring-[3px] focus:ring-focus-ring/25", x && "border-destructive/60 hover:border-destructive/70 focus-within:border-destructive focus-within:ring-destructive/25", C && "opacity-50 cursor-not-allowed", O),
|
|
384
|
+
children: [J.length === 0 ? /* @__PURE__ */ y("span", {
|
|
381
385
|
className: "flex-1 text-sm text-slate-500 truncate",
|
|
382
386
|
children: f
|
|
383
|
-
}) : J.map((t) => /* @__PURE__ */
|
|
387
|
+
}) : J.map((t) => /* @__PURE__ */ b("span", {
|
|
384
388
|
className: "inline-flex max-w-[160px] items-center gap-1 rounded-md border border-border bg-surface-muted px-2 py-0.5 text-xs font-medium text-foreground",
|
|
385
389
|
children: [
|
|
386
|
-
t.color && t.color !== "default" && /* @__PURE__ */
|
|
387
|
-
/* @__PURE__ */
|
|
390
|
+
t.color && t.color !== "default" && /* @__PURE__ */ y("span", { className: e("w-1.5 h-1.5 rounded-full shrink-0", s[t.color]) }),
|
|
391
|
+
/* @__PURE__ */ y("span", {
|
|
388
392
|
className: "truncate",
|
|
389
393
|
children: t.label
|
|
390
394
|
}),
|
|
391
|
-
/* @__PURE__ */
|
|
395
|
+
/* @__PURE__ */ y("span", {
|
|
392
396
|
role: "button",
|
|
393
397
|
tabIndex: -1,
|
|
394
398
|
onMouseDown: (e) => e.stopPropagation(),
|
|
395
399
|
onClick: (e) => X(t.value, e),
|
|
396
|
-
className: "shrink-0 text-slate-500 dark:text-slate-400 hover:text-
|
|
400
|
+
className: "shrink-0 text-slate-500 dark:text-slate-400 hover:text-foreground transition-colors cursor-pointer ml-0.5",
|
|
397
401
|
"aria-label": `Remove ${t.label}`,
|
|
398
|
-
children: /* @__PURE__ */
|
|
402
|
+
children: /* @__PURE__ */ y(a, {})
|
|
399
403
|
})
|
|
400
404
|
]
|
|
401
|
-
}, t.value)), /* @__PURE__ */
|
|
405
|
+
}, t.value)), /* @__PURE__ */ b("span", {
|
|
402
406
|
className: "ml-auto flex items-center gap-1.5 shrink-0 pl-1",
|
|
403
407
|
children: [
|
|
404
|
-
|
|
408
|
+
T && K.length > 0 && !C && /* @__PURE__ */ y("span", {
|
|
405
409
|
role: "button",
|
|
406
410
|
tabIndex: -1,
|
|
407
411
|
onClick: Z,
|
|
408
412
|
className: "text-slate-500 hover:text-slate-600 dark:hover:text-slate-300 transition-colors",
|
|
409
413
|
"aria-label": "Clear all",
|
|
410
|
-
children: /* @__PURE__ */
|
|
414
|
+
children: /* @__PURE__ */ y(a, {})
|
|
411
415
|
}),
|
|
412
|
-
K.length > 0 && /* @__PURE__ */
|
|
416
|
+
K.length > 0 && /* @__PURE__ */ y("span", {
|
|
413
417
|
className: "text-[10px] font-medium text-slate-500 tabular-nums",
|
|
414
418
|
children: K.length
|
|
415
419
|
}),
|
|
416
|
-
/* @__PURE__ */
|
|
420
|
+
/* @__PURE__ */ y(c, { open: R })
|
|
417
421
|
]
|
|
418
422
|
})]
|
|
419
423
|
}),
|
|
420
|
-
/* @__PURE__ */
|
|
424
|
+
/* @__PURE__ */ y(S, {
|
|
421
425
|
listId: I,
|
|
422
426
|
listRef: G,
|
|
423
427
|
open: R,
|
|
@@ -430,32 +434,34 @@ var E = f(({ options: r, value: l, defaultValue: u, onChange: d, placeholder: f
|
|
|
430
434
|
onSelect: Y,
|
|
431
435
|
multiselectable: !0,
|
|
432
436
|
colorDot: s,
|
|
433
|
-
className:
|
|
437
|
+
className: k,
|
|
438
|
+
optionClassName: M,
|
|
439
|
+
groupLabelClassName: te
|
|
434
440
|
}),
|
|
435
|
-
|
|
441
|
+
x && /* @__PURE__ */ y("p", {
|
|
436
442
|
id: L,
|
|
437
443
|
"aria-live": "polite",
|
|
438
|
-
className: "text-xs leading-5 text-destructive",
|
|
439
|
-
children:
|
|
444
|
+
className: e("text-xs leading-5 text-destructive", j),
|
|
445
|
+
children: x
|
|
440
446
|
}),
|
|
441
|
-
g && !
|
|
447
|
+
g && !x && /* @__PURE__ */ y("p", {
|
|
442
448
|
id: L,
|
|
443
|
-
className: "text-xs leading-5 text-muted-foreground",
|
|
449
|
+
className: e("text-xs leading-5 text-muted-foreground", j),
|
|
444
450
|
children: g
|
|
445
451
|
})
|
|
446
452
|
]
|
|
447
453
|
});
|
|
448
454
|
});
|
|
449
|
-
|
|
455
|
+
T.displayName = "SelectMulti";
|
|
450
456
|
//#endregion
|
|
451
457
|
//#region src/components/select.tsx
|
|
452
|
-
var
|
|
458
|
+
var E = f((e, t) => e.multiple ? /* @__PURE__ */ y(T, {
|
|
453
459
|
...e,
|
|
454
460
|
ref: t
|
|
455
|
-
}) : /* @__PURE__ */
|
|
461
|
+
}) : /* @__PURE__ */ y(w, {
|
|
456
462
|
...e,
|
|
457
463
|
ref: t
|
|
458
464
|
}));
|
|
459
|
-
|
|
465
|
+
E.displayName = "Select";
|
|
460
466
|
//#endregion
|
|
461
|
-
export {
|
|
467
|
+
export { E as t };
|