@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
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "../cn-BJyZJP-y.js";
|
|
3
|
+
import { o as t, s as n, t as r } from "../component-styles-C2CbHEEA.js";
|
|
4
|
+
import { forwardRef as i, useEffect as a, useId as o, useImperativeHandle as s, useLayoutEffect as c, useRef as l, useState as u } from "react";
|
|
5
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/time-picker.tsx
|
|
7
|
+
var ee = {
|
|
8
|
+
sm: "h-10 px-2.5 text-xs sm:h-8",
|
|
9
|
+
md: "h-11 px-3 text-sm sm:h-9",
|
|
10
|
+
lg: "h-12 px-3.5 text-sm sm:h-10"
|
|
11
|
+
}, m = (e) => String(e).padStart(2, "0");
|
|
12
|
+
function h(e) {
|
|
13
|
+
if (!e) return null;
|
|
14
|
+
let t = /^(?:([01]\d|2[0-3])):([0-5]\d)(?::([0-5]\d))?$/.exec(e);
|
|
15
|
+
return t ? {
|
|
16
|
+
hour: Number(t[1]),
|
|
17
|
+
minute: Number(t[2]),
|
|
18
|
+
second: Number(t[3] ?? 0)
|
|
19
|
+
} : null;
|
|
20
|
+
}
|
|
21
|
+
function g(e) {
|
|
22
|
+
return e.hour * 3600 + e.minute * 60 + e.second;
|
|
23
|
+
}
|
|
24
|
+
function _(e, t) {
|
|
25
|
+
let n = `${m(e.hour)}:${m(e.minute)}`;
|
|
26
|
+
return t ? `${n}:${m(e.second)}` : n;
|
|
27
|
+
}
|
|
28
|
+
function v(e, t, n) {
|
|
29
|
+
let r = h(e);
|
|
30
|
+
if (!r) return "";
|
|
31
|
+
let i = m(r.minute), a = n ? `:${m(r.second)}` : "";
|
|
32
|
+
if (t === "24") return `${m(r.hour)}:${i}${a}`;
|
|
33
|
+
let o = r.hour >= 12 ? "PM" : "AM";
|
|
34
|
+
return `${r.hour % 12 || 12}:${i}${a} ${o}`;
|
|
35
|
+
}
|
|
36
|
+
function y(e) {
|
|
37
|
+
let t = /* @__PURE__ */ new Date(), n = Math.floor(59 / e) * e;
|
|
38
|
+
return {
|
|
39
|
+
hour: t.getHours(),
|
|
40
|
+
minute: Math.min(n, Math.round(t.getMinutes() / e) * e),
|
|
41
|
+
second: t.getSeconds()
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function b(e, t, n) {
|
|
45
|
+
let r = Math.floor(59 / t) * t;
|
|
46
|
+
return {
|
|
47
|
+
...e,
|
|
48
|
+
minute: Math.min(r, Math.round(e.minute / t) * t),
|
|
49
|
+
second: n ? e.second : 0
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function x({ label: t, id: r, name: i, options: a, value: o, onSelect: s }) {
|
|
53
|
+
let c = `${r}-label`;
|
|
54
|
+
function l(e, t) {
|
|
55
|
+
if (![
|
|
56
|
+
"ArrowUp",
|
|
57
|
+
"ArrowDown",
|
|
58
|
+
"Home",
|
|
59
|
+
"End"
|
|
60
|
+
].includes(e.key)) return;
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
let n = e.key === "Home" ? 0 : e.key === "End" ? a.length - 1 : (t + (e.key === "ArrowDown" ? 1 : -1) + a.length) % a.length, r = a[n];
|
|
63
|
+
r && (s(r.value), e.currentTarget.closest("[data-time-column]")?.querySelectorAll("[role=\"option\"]")[n]?.focus());
|
|
64
|
+
}
|
|
65
|
+
return /* @__PURE__ */ p("div", {
|
|
66
|
+
className: "min-w-0",
|
|
67
|
+
children: [/* @__PURE__ */ f("p", {
|
|
68
|
+
id: c,
|
|
69
|
+
className: "mb-1.5 truncate text-center text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",
|
|
70
|
+
children: t
|
|
71
|
+
}), /* @__PURE__ */ f("div", {
|
|
72
|
+
role: "listbox",
|
|
73
|
+
"aria-labelledby": c,
|
|
74
|
+
"data-time-column": i,
|
|
75
|
+
className: "max-h-52 min-w-0 overflow-y-auto overscroll-contain rounded-[var(--radius-md)] border border-border bg-surface p-1 scrollbar-thin sm:max-h-44",
|
|
76
|
+
children: a.map((t, r) => {
|
|
77
|
+
let i = t.value === o;
|
|
78
|
+
return /* @__PURE__ */ f("button", {
|
|
79
|
+
type: "button",
|
|
80
|
+
role: "option",
|
|
81
|
+
"aria-selected": i,
|
|
82
|
+
tabIndex: i ? 0 : -1,
|
|
83
|
+
onClick: () => s(t.value),
|
|
84
|
+
onKeyDown: (e) => l(e, r),
|
|
85
|
+
className: e("flex h-11 w-full items-center justify-center rounded-[var(--radius-sm)] px-1 text-sm tabular-nums transition-colors sm:h-9 sm:text-xs", n, i ? "bg-primary font-semibold text-primary-foreground" : "text-muted-foreground hover:bg-muted hover:text-foreground"),
|
|
86
|
+
children: t.label
|
|
87
|
+
}, t.value);
|
|
88
|
+
})
|
|
89
|
+
})]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
var S = i(({ label: i, hint: S, error: C, value: w, defaultValue: te = "", onValueChange: ne, format: T = "12", minuteStep: E = 5, showSeconds: D = !1, min: re, max: ie, name: O, disabled: k = !1, required: A = !1, clearable: ae = !0, placeholder: oe = "Select time…", size: se = "md", side: j = "bottom", align: M = "start", triggerClassName: ce, panelClassName: le, labelClassName: ue, messageClassName: N, className: de, id: fe, onBlur: pe, onKeyDown: me, ...he }, ge) => {
|
|
93
|
+
let _e = o(), P = fe ?? _e, F = `${P}-panel`, I = `${P}-message`, L = l(null), R = l(null), z = l(null);
|
|
94
|
+
s(ge, () => R.current);
|
|
95
|
+
let B = Number.isFinite(E) ? Math.max(1, Math.min(30, Math.floor(E))) : 5, V = (e) => {
|
|
96
|
+
let t = h(e);
|
|
97
|
+
return t ? _(t, D) : "";
|
|
98
|
+
}, [ve, ye] = u(() => V(te)), H = V(w ?? ve), [U, be] = u(!1), [xe, W] = u({ visibility: "hidden" }), [G, K] = u(() => b(h(H) ?? y(B), B, D)), Se = Array.from({ length: 24 }, (e, t) => ({
|
|
99
|
+
value: t,
|
|
100
|
+
label: m(t)
|
|
101
|
+
})), Ce = Array.from({ length: 12 }, (e, t) => ({
|
|
102
|
+
value: t + 1,
|
|
103
|
+
label: m(t + 1)
|
|
104
|
+
})), we = Array.from({ length: Math.floor(59 / B) + 1 }, (e, t) => {
|
|
105
|
+
let n = t * B;
|
|
106
|
+
return {
|
|
107
|
+
value: n,
|
|
108
|
+
label: m(n)
|
|
109
|
+
};
|
|
110
|
+
}), Te = Array.from({ length: 60 }, (e, t) => ({
|
|
111
|
+
value: t,
|
|
112
|
+
label: m(t)
|
|
113
|
+
})), Ee = [{
|
|
114
|
+
value: 0,
|
|
115
|
+
label: "AM"
|
|
116
|
+
}, {
|
|
117
|
+
value: 1,
|
|
118
|
+
label: "PM"
|
|
119
|
+
}], q = h(re), J = h(ie), Y = g(G), X = q ? Y < g(q) : !1, De = J ? Y > g(J) : !1, Z = X || De, Oe = v(H, T, D);
|
|
120
|
+
function ke() {
|
|
121
|
+
k || (K(b(h(H) ?? y(B), B, D)), W({ visibility: "hidden" }), be(!0));
|
|
122
|
+
}
|
|
123
|
+
function Q(e = !1) {
|
|
124
|
+
be(!1), e && R.current?.focus();
|
|
125
|
+
}
|
|
126
|
+
function $(e) {
|
|
127
|
+
w === void 0 && ye(e), ne?.(e), Q(!0);
|
|
128
|
+
}
|
|
129
|
+
return a(() => {
|
|
130
|
+
if (!U) return;
|
|
131
|
+
let e = (e) => {
|
|
132
|
+
L.current?.contains(e.target) || Q();
|
|
133
|
+
};
|
|
134
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
135
|
+
}, [U]), c(() => {
|
|
136
|
+
if (!U) return;
|
|
137
|
+
let e = () => {
|
|
138
|
+
let e = R.current, t = z.current;
|
|
139
|
+
if (!e || !t) return;
|
|
140
|
+
if (window.innerWidth < 640) {
|
|
141
|
+
W({
|
|
142
|
+
insetInline: 8,
|
|
143
|
+
bottom: 8,
|
|
144
|
+
top: "auto",
|
|
145
|
+
width: "auto",
|
|
146
|
+
visibility: "visible"
|
|
147
|
+
});
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = M === "start" ? n.left : n.right - r.width, a = Math.max(16, window.innerWidth - r.width - 16), o = Math.min(Math.max(i, 16), a), s = n.bottom + 6, c = n.top - r.height - 6, l = s + r.height <= window.innerHeight - 16, u = c >= 16, d = j === "bottom" ? l || !u ? s : c : u || !l ? c : s, f = Math.max(16, window.innerHeight - r.height - 16);
|
|
151
|
+
W({
|
|
152
|
+
left: o,
|
|
153
|
+
top: Math.min(Math.max(d, 16), f),
|
|
154
|
+
visibility: "visible"
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
return e(), window.addEventListener("resize", e), document.addEventListener("scroll", e, !0), () => {
|
|
158
|
+
window.removeEventListener("resize", e), document.removeEventListener("scroll", e, !0);
|
|
159
|
+
};
|
|
160
|
+
}, [
|
|
161
|
+
M,
|
|
162
|
+
U,
|
|
163
|
+
j
|
|
164
|
+
]), a(() => {
|
|
165
|
+
if (!U || window.innerWidth >= 640) return;
|
|
166
|
+
let e = document.body.style.overflow;
|
|
167
|
+
return document.body.style.overflow = "hidden", () => {
|
|
168
|
+
document.body.style.overflow = e;
|
|
169
|
+
};
|
|
170
|
+
}, [U]), a(() => {
|
|
171
|
+
U && requestAnimationFrame(() => {
|
|
172
|
+
let e = L.current?.querySelector("[data-time-column=\"hour\"] [aria-selected=\"true\"]"), t = e?.closest("[role=\"listbox\"]");
|
|
173
|
+
e?.focus({ preventScroll: !0 }), e && t && (t.scrollTop = e.offsetTop - t.clientHeight / 2 + e.clientHeight / 2);
|
|
174
|
+
});
|
|
175
|
+
}, [U]), /* @__PURE__ */ p("div", {
|
|
176
|
+
ref: L,
|
|
177
|
+
className: e("relative", t, de),
|
|
178
|
+
onBlur: (e) => {
|
|
179
|
+
pe?.(e), e.currentTarget.contains(e.relatedTarget) || Q();
|
|
180
|
+
},
|
|
181
|
+
onKeyDown: (e) => {
|
|
182
|
+
me?.(e), !e.defaultPrevented && e.key === "Escape" && U && (e.preventDefault(), Q(!0));
|
|
183
|
+
},
|
|
184
|
+
...he,
|
|
185
|
+
children: [
|
|
186
|
+
i && /* @__PURE__ */ p("label", {
|
|
187
|
+
htmlFor: P,
|
|
188
|
+
className: e("text-xs font-semibold leading-5 text-foreground", ue),
|
|
189
|
+
children: [i, A && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("span", {
|
|
190
|
+
"aria-hidden": "true",
|
|
191
|
+
className: "ml-1 text-destructive",
|
|
192
|
+
children: "*"
|
|
193
|
+
}), /* @__PURE__ */ f("span", {
|
|
194
|
+
className: "sr-only",
|
|
195
|
+
children: " (required)"
|
|
196
|
+
})] })]
|
|
197
|
+
}),
|
|
198
|
+
/* @__PURE__ */ p("button", {
|
|
199
|
+
ref: R,
|
|
200
|
+
id: P,
|
|
201
|
+
type: "button",
|
|
202
|
+
disabled: k,
|
|
203
|
+
"aria-expanded": U,
|
|
204
|
+
"aria-haspopup": "dialog",
|
|
205
|
+
"aria-controls": F,
|
|
206
|
+
"aria-invalid": C ? !0 : void 0,
|
|
207
|
+
"aria-required": A || void 0,
|
|
208
|
+
"aria-describedby": C || S ? I : void 0,
|
|
209
|
+
onClick: () => U ? Q() : ke(),
|
|
210
|
+
onKeyDown: (e) => {
|
|
211
|
+
e.key === "ArrowDown" && !U && (e.preventDefault(), ke());
|
|
212
|
+
},
|
|
213
|
+
className: e("flex w-full min-w-0 items-center gap-2 rounded-[var(--radius-md)] text-left", r, n, C && "border-destructive/60 hover:border-destructive/70 focus-within:border-destructive focus-within:ring-destructive/25", ee[se], ce),
|
|
214
|
+
children: [
|
|
215
|
+
/* @__PURE__ */ p("svg", {
|
|
216
|
+
"aria-hidden": "true",
|
|
217
|
+
width: "15",
|
|
218
|
+
height: "15",
|
|
219
|
+
viewBox: "0 0 24 24",
|
|
220
|
+
fill: "none",
|
|
221
|
+
stroke: "currentColor",
|
|
222
|
+
strokeWidth: "2",
|
|
223
|
+
strokeLinecap: "round",
|
|
224
|
+
strokeLinejoin: "round",
|
|
225
|
+
className: "shrink-0 text-muted-foreground",
|
|
226
|
+
children: [/* @__PURE__ */ f("circle", {
|
|
227
|
+
cx: "12",
|
|
228
|
+
cy: "12",
|
|
229
|
+
r: "9"
|
|
230
|
+
}), /* @__PURE__ */ f("path", { d: "M12 7v5l3 2" })]
|
|
231
|
+
}),
|
|
232
|
+
/* @__PURE__ */ f("span", {
|
|
233
|
+
className: e("min-w-0 flex-1 truncate", Oe ? "text-foreground" : "text-muted-foreground"),
|
|
234
|
+
children: Oe || oe
|
|
235
|
+
}),
|
|
236
|
+
/* @__PURE__ */ f("svg", {
|
|
237
|
+
"aria-hidden": "true",
|
|
238
|
+
width: "13",
|
|
239
|
+
height: "13",
|
|
240
|
+
viewBox: "0 0 24 24",
|
|
241
|
+
fill: "none",
|
|
242
|
+
stroke: "currentColor",
|
|
243
|
+
strokeWidth: "2.5",
|
|
244
|
+
strokeLinecap: "round",
|
|
245
|
+
strokeLinejoin: "round",
|
|
246
|
+
className: e("shrink-0 text-muted-foreground transition-transform", U && "rotate-180"),
|
|
247
|
+
children: /* @__PURE__ */ f("path", { d: "m6 9 6 6 6-6" })
|
|
248
|
+
})
|
|
249
|
+
]
|
|
250
|
+
}),
|
|
251
|
+
O && /* @__PURE__ */ f("input", {
|
|
252
|
+
type: "hidden",
|
|
253
|
+
name: O,
|
|
254
|
+
value: H,
|
|
255
|
+
disabled: k
|
|
256
|
+
}),
|
|
257
|
+
U && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("div", {
|
|
258
|
+
"aria-hidden": "true",
|
|
259
|
+
className: "fixed inset-0 z-40 bg-overlay sm:hidden",
|
|
260
|
+
onMouseDown: () => Q(!0)
|
|
261
|
+
}), /* @__PURE__ */ p("div", {
|
|
262
|
+
ref: z,
|
|
263
|
+
id: F,
|
|
264
|
+
role: "dialog",
|
|
265
|
+
"aria-label": i ? `Choose ${i.toLowerCase()}` : "Choose time",
|
|
266
|
+
"data-side": j,
|
|
267
|
+
"data-align": M,
|
|
268
|
+
style: xe,
|
|
269
|
+
className: e("fixed z-50 w-[min(22rem,calc(100vw-2rem))] max-h-[calc(100dvh-1rem)] overflow-y-auto rounded-[var(--radius-lg)] border border-border bg-surface-raised p-3 shadow-floating", le),
|
|
270
|
+
children: [
|
|
271
|
+
/* @__PURE__ */ p("div", {
|
|
272
|
+
className: "mb-3 flex items-center justify-between gap-3",
|
|
273
|
+
children: [/* @__PURE__ */ p("div", {
|
|
274
|
+
className: "min-w-0",
|
|
275
|
+
children: [/* @__PURE__ */ f("p", {
|
|
276
|
+
className: "truncate text-sm font-semibold text-foreground",
|
|
277
|
+
children: "Choose time"
|
|
278
|
+
}), /* @__PURE__ */ p("p", {
|
|
279
|
+
className: "text-[11px] text-muted-foreground",
|
|
280
|
+
children: [T === "12" ? "12-hour" : "24-hour", " format"]
|
|
281
|
+
})]
|
|
282
|
+
}), /* @__PURE__ */ f("button", {
|
|
283
|
+
type: "button",
|
|
284
|
+
onClick: () => K(b(y(B), B, D)),
|
|
285
|
+
className: e("h-11 rounded-md px-3 text-xs font-medium text-accent-700 hover:bg-muted sm:h-8 sm:px-2.5 dark:text-accent-300", "focus-ring"),
|
|
286
|
+
children: "Now"
|
|
287
|
+
})]
|
|
288
|
+
}),
|
|
289
|
+
/* @__PURE__ */ f("div", {
|
|
290
|
+
"aria-live": "polite",
|
|
291
|
+
className: "mb-3 flex h-11 items-center justify-center rounded-[var(--radius-md)] bg-muted px-3 text-lg font-semibold tabular-nums text-foreground",
|
|
292
|
+
children: v(_(G, D), T, D)
|
|
293
|
+
}),
|
|
294
|
+
/* @__PURE__ */ p("div", {
|
|
295
|
+
className: e("grid gap-2", T === "12" && D ? "grid-cols-4" : D || T === "12" ? "grid-cols-3" : "grid-cols-2"),
|
|
296
|
+
children: [
|
|
297
|
+
/* @__PURE__ */ f(x, {
|
|
298
|
+
label: "Hour",
|
|
299
|
+
id: `${P}-hour`,
|
|
300
|
+
name: "hour",
|
|
301
|
+
options: T === "24" ? Se : Ce,
|
|
302
|
+
value: T === "24" ? G.hour : G.hour % 12 || 12,
|
|
303
|
+
onSelect: (e) => K((t) => ({
|
|
304
|
+
...t,
|
|
305
|
+
hour: T === "24" ? e : e % 12 + (t.hour >= 12 ? 12 : 0)
|
|
306
|
+
}))
|
|
307
|
+
}),
|
|
308
|
+
/* @__PURE__ */ f(x, {
|
|
309
|
+
id: `${P}-minute`,
|
|
310
|
+
label: "Minute",
|
|
311
|
+
name: "minute",
|
|
312
|
+
options: we,
|
|
313
|
+
value: G.minute,
|
|
314
|
+
onSelect: (e) => K((t) => ({
|
|
315
|
+
...t,
|
|
316
|
+
minute: e
|
|
317
|
+
}))
|
|
318
|
+
}),
|
|
319
|
+
D && /* @__PURE__ */ f(x, {
|
|
320
|
+
id: `${P}-second`,
|
|
321
|
+
label: "Second",
|
|
322
|
+
name: "second",
|
|
323
|
+
options: Te,
|
|
324
|
+
value: G.second,
|
|
325
|
+
onSelect: (e) => K((t) => ({
|
|
326
|
+
...t,
|
|
327
|
+
second: e
|
|
328
|
+
}))
|
|
329
|
+
}),
|
|
330
|
+
T === "12" && /* @__PURE__ */ f(x, {
|
|
331
|
+
id: `${P}-period`,
|
|
332
|
+
label: "Period",
|
|
333
|
+
name: "period",
|
|
334
|
+
options: Ee,
|
|
335
|
+
value: +(G.hour >= 12),
|
|
336
|
+
onSelect: (e) => K((t) => ({
|
|
337
|
+
...t,
|
|
338
|
+
hour: t.hour % 12 + e * 12
|
|
339
|
+
}))
|
|
340
|
+
})
|
|
341
|
+
]
|
|
342
|
+
}),
|
|
343
|
+
Z && /* @__PURE__ */ p("p", {
|
|
344
|
+
role: "status",
|
|
345
|
+
className: "mt-2 text-xs text-destructive",
|
|
346
|
+
children: [
|
|
347
|
+
"Choose a time ",
|
|
348
|
+
X ? `at or after ${v(_(q, D), T, D)}` : `at or before ${v(_(J, D), T, D)}`,
|
|
349
|
+
"."
|
|
350
|
+
]
|
|
351
|
+
}),
|
|
352
|
+
/* @__PURE__ */ p("div", {
|
|
353
|
+
className: "sticky bottom-0 -mx-3 -mb-3 mt-3 flex flex-wrap items-center justify-end gap-2 border-t border-border bg-surface-raised px-3 pb-3 pt-3",
|
|
354
|
+
children: [
|
|
355
|
+
ae && !A && H && /* @__PURE__ */ f("button", {
|
|
356
|
+
type: "button",
|
|
357
|
+
onClick: () => $(""),
|
|
358
|
+
className: e("mr-auto h-11 rounded-md px-3 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground sm:h-8 sm:px-2.5", "focus-ring"),
|
|
359
|
+
children: "Clear"
|
|
360
|
+
}),
|
|
361
|
+
/* @__PURE__ */ f("button", {
|
|
362
|
+
type: "button",
|
|
363
|
+
onClick: () => Q(!0),
|
|
364
|
+
className: e("h-11 rounded-md px-3 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground sm:h-8", "focus-ring"),
|
|
365
|
+
children: "Cancel"
|
|
366
|
+
}),
|
|
367
|
+
/* @__PURE__ */ f("button", {
|
|
368
|
+
type: "button",
|
|
369
|
+
disabled: Z,
|
|
370
|
+
onClick: () => $(_(G, D)),
|
|
371
|
+
className: e("h-11 rounded-md bg-primary px-4 text-xs font-semibold text-primary-foreground hover:bg-primary-hover disabled:cursor-not-allowed disabled:opacity-40 sm:h-8 sm:px-3", "focus-ring"),
|
|
372
|
+
children: "Apply"
|
|
373
|
+
})
|
|
374
|
+
]
|
|
375
|
+
})
|
|
376
|
+
]
|
|
377
|
+
})] }),
|
|
378
|
+
C && /* @__PURE__ */ f("p", {
|
|
379
|
+
id: I,
|
|
380
|
+
"aria-live": "polite",
|
|
381
|
+
className: e("text-xs leading-5 text-destructive", N),
|
|
382
|
+
children: C
|
|
383
|
+
}),
|
|
384
|
+
S && !C && /* @__PURE__ */ f("p", {
|
|
385
|
+
id: I,
|
|
386
|
+
className: e("text-xs leading-5 text-muted-foreground", N),
|
|
387
|
+
children: S
|
|
388
|
+
})
|
|
389
|
+
]
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
S.displayName = "TimePicker";
|
|
393
|
+
//#endregion
|
|
394
|
+
export { S as TimePicker };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-B6R3HKzx.cjs");let t=require("react/jsx-runtime");var n={default:`bg-slate-400 border-slate-400/30`,success:`bg-emerald-400 border-emerald-400/30`,warning:`bg-amber-400 border-amber-400/30`,error:`bg-red-400 border-red-400/30`,info:`bg-sky-400 border-sky-400/30`},r={default:`bg-slate-500/15 text-slate-400`,success:`bg-emerald-500/15 text-emerald-400`,warning:`bg-amber-500/15 text-amber-400`,error:`bg-red-500/15 text-red-400`,info:`bg-sky-500/15 text-sky-400`};function i({events:i,className:a}){return(0,t.jsx)(`div`,{className:e.t(`flex flex-col`,a),children:i.map((a,o)=>{let s=o===i.length-1,c=a.variant??`default`;return(0,t.jsxs)(`div`,{className:`flex gap-3`,children:[(0,t.jsxs)(`div`,{className:`flex flex-col items-center`,children:[a.icon?(0,t.jsx)(`div`,{className:e.t(`w-8 h-8 rounded-full flex items-center justify-center shrink-0`,r[c]),children:(0,t.jsx)(`span`,{className:`w-4 h-4 flex items-center justify-center`,children:a.icon})}):(0,t.jsx)(`div`,{className:e.t(`w-2.5 h-2.5 rounded-full shrink-0 border-2 mt-1.5`,n[c])}),!s&&(0,t.jsx)(`div`,{className:`flex-1 w-px bg-black/10 dark:bg-white/10 my-1`})]}),(0,t.jsxs)(`div`,{className:e.t(`pb-5 min-w-0`,s&&`pb-0`),children:[(0,t.jsxs)(`div`,{className:`flex items-baseline gap-2 flex-wrap`,children:[(0,t.jsx)(`p`,{className:`text-sm font-medium text-slate-700 dark:text-slate-200`,children:a.title}),a.timestamp&&(0,t.jsx)(`span`,{className:`text-xs text-slate-500`,children:a.timestamp})]}),a.description&&(0,t.jsx)(`p`,{className:`text-sm text-slate-500 mt-0.5`,children:a.description})]})]},a.id)})})}exports.Timeline=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-B6R3HKzx.cjs"),t=require("../component-styles-DY4wigiq.cjs");let n=require("react"),r=require("react/jsx-runtime");var i={default:[`border border-transparent bg-transparent text-muted-foreground`,`hover:bg-muted hover:text-foreground`,`data-[state=on]:bg-accent-100 data-[state=on]:text-accent-800`,`dark:data-[state=on]:bg-accent-900/45 dark:data-[state=on]:text-accent-200`].join(` `),outline:[`border border-border bg-surface text-muted-foreground shadow-xs`,`hover:border-border-strong hover:bg-surface-muted hover:text-foreground`,`data-[state=on]:border-accent-300 data-[state=on]:bg-accent-50 data-[state=on]:text-accent-800`,`dark:data-[state=on]:border-accent-700 dark:data-[state=on]:bg-accent-900/35 dark:data-[state=on]:text-accent-200`].join(` `)},a={sm:`h-8 rounded-[var(--radius-md)] px-2.5 text-xs gap-1.5`,md:`h-9 rounded-[var(--radius-md)] px-3 text-sm gap-2`,lg:`h-10 rounded-[var(--radius-lg)] px-4 text-sm gap-2`,icon:`size-9 rounded-[var(--radius-md)] p-0`},o=[`inline-flex shrink-0 cursor-pointer select-none items-center justify-center font-medium`,`transition-[color,background-color,border-color,box-shadow] duration-150`,`disabled:pointer-events-none disabled:opacity-40`,t.s].join(` `),s=(0,n.forwardRef)(({pressed:t,defaultPressed:s=!1,onPressedChange:c,variant:l=`default`,size:u=`md`,className:d,type:f=`button`,onClick:p,...m},h)=>{let[g,_]=(0,n.useState)(s),v=t??g;return(0,r.jsx)(`button`,{ref:h,type:f,"aria-pressed":v,"data-state":v?`on`:`off`,className:e.t(o,i[l],a[u],d),onClick:e=>{if(p?.(e),e.defaultPrevented)return;let n=!v;t===void 0&&_(n),c?.(n)},...m})});s.displayName=`Toggle`;var c=(0,n.createContext)(null);function l(){let e=(0,n.useContext)(c);if(!e)throw Error(`ToggleGroupItem must be inside <ToggleGroup>`);return e}var u=(0,n.forwardRef)(({type:t=`single`,value:i,defaultValue:a,onValueChange:o,orientation:s=`horizontal`,variant:l=`default`,size:u=`md`,disabled:d=!1,loop:f=!0,className:p,children:m,...h},g)=>{let[_,v]=(0,n.useState)(()=>a??(t===`multiple`?[]:``)),y=i??_,b=o;function x(e){return t===`multiple`?Array.isArray(y)&&y.includes(e):y===e}function S(e){let n=t===`multiple`?(()=>{let t=Array.isArray(y)?y:[];return t.includes(e)?t.filter(t=>t!==e):[...t,e]})():y===e?``:e;i===void 0&&v(n),b?.(n)}return(0,r.jsx)(c.Provider,{value:{disabled:d,isPressed:x,loop:f,orientation:s,select:S,size:u,variant:l},children:(0,r.jsx)(`div`,{ref:g,role:`group`,"data-rui-toggle-group":``,"data-orientation":s,className:e.t(`inline-flex w-fit rounded-[var(--radius-lg)]`,s===`horizontal`?`max-w-full flex-row items-center gap-1 overflow-x-auto overscroll-x-contain p-0.5 scrollbar-none [&>*]:shrink-0`:`max-w-full flex-col items-stretch gap-1`,p),...h,children:m})})});u.displayName=`ToggleGroup`;var d=(0,n.forwardRef)(({value:t,variant:n,size:s,className:c,disabled:u,type:d=`button`,onClick:f,onKeyDown:p,...m},h)=>{let g=l(),_=g.isPressed(t),v=g.disabled||u;function y(e){if(p?.(e),e.defaultPrevented)return;let t=g.orientation===`horizontal`?`ArrowLeft`:`ArrowUp`,n=g.orientation===`horizontal`?`ArrowRight`:`ArrowDown`;if(e.key!==t&&e.key!==n&&e.key!==`Home`&&e.key!==`End`)return;let r=e.currentTarget.closest(`[data-rui-toggle-group]`),i=Array.from(r?.querySelectorAll(`[data-rui-toggle-item]:not(:disabled)`)??[]).filter(e=>e.closest(`[data-rui-toggle-group]`)===r),a=i.indexOf(e.currentTarget);if(a<0||i.length===0)return;e.preventDefault();let o=e.key===`Home`?0:e.key===`End`?i.length-1:a+(e.key===n?1:-1);o=g.loop?(o+i.length)%i.length:Math.max(0,Math.min(i.length-1,o)),i[o]?.focus()}return(0,r.jsx)(`button`,{ref:h,type:d,"aria-pressed":_,"data-rui-toggle-item":``,"data-state":_?`on`:`off`,disabled:v,className:e.t(o,i[n??g.variant],a[s??g.size],c),onClick:e=>{f?.(e),e.defaultPrevented||g.select(t)},onKeyDown:y,...m})});d.displayName=`ToggleGroupItem`,exports.Toggle=s,exports.ToggleGroup=u,exports.ToggleGroupItem=d,exports.toggleSizes=a,exports.toggleVariants=i;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type ToggleVariant = "default" | "outline";
|
|
3
|
+
export type ToggleSize = "sm" | "md" | "lg" | "icon";
|
|
4
|
+
export declare const toggleVariants: Record<ToggleVariant, string>;
|
|
5
|
+
export declare const toggleSizes: Record<ToggleSize, string>;
|
|
6
|
+
export interface ToggleProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
7
|
+
pressed?: boolean;
|
|
8
|
+
defaultPressed?: boolean;
|
|
9
|
+
onPressedChange?: (pressed: boolean) => void;
|
|
10
|
+
variant?: ToggleVariant;
|
|
11
|
+
size?: ToggleSize;
|
|
12
|
+
}
|
|
13
|
+
export declare const Toggle: import('react').ForwardRefExoticComponent<ToggleProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
interface ToggleGroupBaseProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue"> {
|
|
15
|
+
orientation?: "horizontal" | "vertical";
|
|
16
|
+
variant?: ToggleVariant;
|
|
17
|
+
size?: ToggleSize;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
loop?: boolean;
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
export interface ToggleGroupSingleProps extends ToggleGroupBaseProps {
|
|
23
|
+
type?: "single";
|
|
24
|
+
value?: string;
|
|
25
|
+
defaultValue?: string;
|
|
26
|
+
onValueChange?: (value: string) => void;
|
|
27
|
+
}
|
|
28
|
+
export interface ToggleGroupMultipleProps extends ToggleGroupBaseProps {
|
|
29
|
+
type: "multiple";
|
|
30
|
+
value?: string[];
|
|
31
|
+
defaultValue?: string[];
|
|
32
|
+
onValueChange?: (value: string[]) => void;
|
|
33
|
+
}
|
|
34
|
+
export type ToggleGroupProps = ToggleGroupSingleProps | ToggleGroupMultipleProps;
|
|
35
|
+
export declare const ToggleGroup: import('react').ForwardRefExoticComponent<ToggleGroupProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
36
|
+
export interface ToggleGroupItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "value"> {
|
|
37
|
+
value: string;
|
|
38
|
+
variant?: ToggleVariant;
|
|
39
|
+
size?: ToggleSize;
|
|
40
|
+
}
|
|
41
|
+
export declare const ToggleGroupItem: import('react').ForwardRefExoticComponent<ToggleGroupItemProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "../cn-BJyZJP-y.js";
|
|
3
|
+
import { s as t } from "../component-styles-C2CbHEEA.js";
|
|
4
|
+
import { createContext as n, forwardRef as r, useContext as i, useState as a } from "react";
|
|
5
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/toggle.tsx
|
|
7
|
+
var s = {
|
|
8
|
+
default: [
|
|
9
|
+
"border border-transparent bg-transparent text-muted-foreground",
|
|
10
|
+
"hover:bg-muted hover:text-foreground",
|
|
11
|
+
"data-[state=on]:bg-accent-100 data-[state=on]:text-accent-800",
|
|
12
|
+
"dark:data-[state=on]:bg-accent-900/45 dark:data-[state=on]:text-accent-200"
|
|
13
|
+
].join(" "),
|
|
14
|
+
outline: [
|
|
15
|
+
"border border-border bg-surface text-muted-foreground shadow-xs",
|
|
16
|
+
"hover:border-border-strong hover:bg-surface-muted hover:text-foreground",
|
|
17
|
+
"data-[state=on]:border-accent-300 data-[state=on]:bg-accent-50 data-[state=on]:text-accent-800",
|
|
18
|
+
"dark:data-[state=on]:border-accent-700 dark:data-[state=on]:bg-accent-900/35 dark:data-[state=on]:text-accent-200"
|
|
19
|
+
].join(" ")
|
|
20
|
+
}, c = {
|
|
21
|
+
sm: "h-8 rounded-[var(--radius-md)] px-2.5 text-xs gap-1.5",
|
|
22
|
+
md: "h-9 rounded-[var(--radius-md)] px-3 text-sm gap-2",
|
|
23
|
+
lg: "h-10 rounded-[var(--radius-lg)] px-4 text-sm gap-2",
|
|
24
|
+
icon: "size-9 rounded-[var(--radius-md)] p-0"
|
|
25
|
+
}, l = [
|
|
26
|
+
"inline-flex shrink-0 cursor-pointer select-none items-center justify-center font-medium",
|
|
27
|
+
"transition-[color,background-color,border-color,box-shadow] duration-150",
|
|
28
|
+
"disabled:pointer-events-none disabled:opacity-40",
|
|
29
|
+
t
|
|
30
|
+
].join(" "), u = r(({ pressed: t, defaultPressed: n = !1, onPressedChange: r, variant: i = "default", size: u = "md", className: d, type: f = "button", onClick: p, ...m }, h) => {
|
|
31
|
+
let [g, _] = a(n), v = t ?? g;
|
|
32
|
+
return /* @__PURE__ */ o("button", {
|
|
33
|
+
ref: h,
|
|
34
|
+
type: f,
|
|
35
|
+
"aria-pressed": v,
|
|
36
|
+
"data-state": v ? "on" : "off",
|
|
37
|
+
className: e(l, s[i], c[u], d),
|
|
38
|
+
onClick: (e) => {
|
|
39
|
+
if (p?.(e), e.defaultPrevented) return;
|
|
40
|
+
let n = !v;
|
|
41
|
+
t === void 0 && _(n), r?.(n);
|
|
42
|
+
},
|
|
43
|
+
...m
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
u.displayName = "Toggle";
|
|
47
|
+
var d = n(null);
|
|
48
|
+
function f() {
|
|
49
|
+
let e = i(d);
|
|
50
|
+
if (!e) throw Error("ToggleGroupItem must be inside <ToggleGroup>");
|
|
51
|
+
return e;
|
|
52
|
+
}
|
|
53
|
+
var p = r(({ type: t = "single", value: n, defaultValue: r, onValueChange: i, orientation: s = "horizontal", variant: c = "default", size: l = "md", disabled: u = !1, loop: f = !0, className: p, children: m, ...h }, g) => {
|
|
54
|
+
let [_, v] = a(() => r ?? (t === "multiple" ? [] : "")), y = n ?? _, b = i;
|
|
55
|
+
function x(e) {
|
|
56
|
+
return t === "multiple" ? Array.isArray(y) && y.includes(e) : y === e;
|
|
57
|
+
}
|
|
58
|
+
function S(e) {
|
|
59
|
+
let r = t === "multiple" ? (() => {
|
|
60
|
+
let t = Array.isArray(y) ? y : [];
|
|
61
|
+
return t.includes(e) ? t.filter((t) => t !== e) : [...t, e];
|
|
62
|
+
})() : y === e ? "" : e;
|
|
63
|
+
n === void 0 && v(r), b?.(r);
|
|
64
|
+
}
|
|
65
|
+
return /* @__PURE__ */ o(d.Provider, {
|
|
66
|
+
value: {
|
|
67
|
+
disabled: u,
|
|
68
|
+
isPressed: x,
|
|
69
|
+
loop: f,
|
|
70
|
+
orientation: s,
|
|
71
|
+
select: S,
|
|
72
|
+
size: l,
|
|
73
|
+
variant: c
|
|
74
|
+
},
|
|
75
|
+
children: /* @__PURE__ */ o("div", {
|
|
76
|
+
ref: g,
|
|
77
|
+
role: "group",
|
|
78
|
+
"data-rui-toggle-group": "",
|
|
79
|
+
"data-orientation": s,
|
|
80
|
+
className: e("inline-flex w-fit rounded-[var(--radius-lg)]", s === "horizontal" ? "max-w-full flex-row items-center gap-1 overflow-x-auto overscroll-x-contain p-0.5 scrollbar-none [&>*]:shrink-0" : "max-w-full flex-col items-stretch gap-1", p),
|
|
81
|
+
...h,
|
|
82
|
+
children: m
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
p.displayName = "ToggleGroup";
|
|
87
|
+
var m = r(({ value: t, variant: n, size: r, className: i, disabled: a, type: u = "button", onClick: d, onKeyDown: p, ...m }, h) => {
|
|
88
|
+
let g = f(), _ = g.isPressed(t), v = g.disabled || a;
|
|
89
|
+
function y(e) {
|
|
90
|
+
if (p?.(e), e.defaultPrevented) return;
|
|
91
|
+
let t = g.orientation === "horizontal" ? "ArrowLeft" : "ArrowUp", n = g.orientation === "horizontal" ? "ArrowRight" : "ArrowDown";
|
|
92
|
+
if (e.key !== t && e.key !== n && e.key !== "Home" && e.key !== "End") return;
|
|
93
|
+
let r = e.currentTarget.closest("[data-rui-toggle-group]"), i = Array.from(r?.querySelectorAll("[data-rui-toggle-item]:not(:disabled)") ?? []).filter((e) => e.closest("[data-rui-toggle-group]") === r), a = i.indexOf(e.currentTarget);
|
|
94
|
+
if (a < 0 || i.length === 0) return;
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
let o = e.key === "Home" ? 0 : e.key === "End" ? i.length - 1 : a + (e.key === n ? 1 : -1);
|
|
97
|
+
o = g.loop ? (o + i.length) % i.length : Math.max(0, Math.min(i.length - 1, o)), i[o]?.focus();
|
|
98
|
+
}
|
|
99
|
+
return /* @__PURE__ */ o("button", {
|
|
100
|
+
ref: h,
|
|
101
|
+
type: u,
|
|
102
|
+
"aria-pressed": _,
|
|
103
|
+
"data-rui-toggle-item": "",
|
|
104
|
+
"data-state": _ ? "on" : "off",
|
|
105
|
+
disabled: v,
|
|
106
|
+
className: e(l, s[n ?? g.variant], c[r ?? g.size], i),
|
|
107
|
+
onClick: (e) => {
|
|
108
|
+
d?.(e), e.defaultPrevented || g.select(t);
|
|
109
|
+
},
|
|
110
|
+
onKeyDown: y,
|
|
111
|
+
...m
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
m.displayName = "ToggleGroupItem";
|
|
115
|
+
//#endregion
|
|
116
|
+
export { u as Toggle, p as ToggleGroup, m as ToggleGroupItem, c as toggleSizes, s as toggleVariants };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-B6R3HKzx.cjs"),t=require("../motion-B2shivEB.cjs");let n=require("framer-motion"),r=require("react"),i=require("react/jsx-runtime");var a={top:{container:`bottom-full left-1/2 -translate-x-1/2 mb-2`,initial:{y:4}},bottom:{container:`top-full left-1/2 -translate-x-1/2 mt-2`,initial:{y:-4}},left:{container:`right-full top-1/2 -translate-y-1/2 mr-2`,initial:{x:4}},right:{container:`left-full top-1/2 -translate-y-1/2 ml-2`,initial:{x:-4}}};function o({content:o,children:s,position:c=`top`,delayMs:l=0,className:u,wrapperClassName:d}){let[f,p]=(0,r.useState)(!1),m=(0,r.useRef)(null),h=(0,r.useId)(),{container:g,initial:_}=a[c];function v(){l>0?m.current=setTimeout(()=>p(!0),l):p(!0)}function y(){m.current&&clearTimeout(m.current),p(!1)}(0,r.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]);let b=(0,r.isValidElement)(s)?(0,r.cloneElement)(s,{"aria-describedby":f?h:void 0,onMouseEnter:e=>{s.props.onMouseEnter?.(e),e.defaultPrevented||v()},onMouseLeave:e=>{s.props.onMouseLeave?.(e),y()},onFocus:e=>{s.props.onFocus?.(e),e.defaultPrevented||v()},onBlur:e=>{s.props.onBlur?.(e),y()}}):(0,i.jsx)(`span`,{tabIndex:0,"aria-describedby":f?h:void 0,onMouseEnter:v,onMouseLeave:y,onFocus:v,onBlur:y,children:s});return(0,i.jsxs)(`div`,{className:e.t(`relative inline-flex`,d),children:[b,(0,i.jsx)(n.AnimatePresence,{children:f&&(0,i.jsx)(n.motion.div,{id:h,role:`tooltip`,initial:{opacity:0,..._},animate:{opacity:1,y:0,x:0},exit:{opacity:0,..._},transition:t.n.fade,className:e.t(`absolute z-50 pointer-events-none`,`max-w-[min(20rem,calc(100vw-2rem))] rounded-md px-2.5 py-1.5 text-xs font-medium leading-4`,`border border-slate-700 bg-slate-900 text-slate-50 shadow-floating dark:border-border-strong dark:bg-surface-raised dark:text-foreground`,g,u),children:o})})]})}exports.Tooltip=o;
|
|
@@ -6,6 +6,7 @@ export interface TooltipProps {
|
|
|
6
6
|
position?: Position;
|
|
7
7
|
delayMs?: number;
|
|
8
8
|
className?: string;
|
|
9
|
+
wrapperClassName?: string;
|
|
9
10
|
}
|
|
10
|
-
export declare function Tooltip({ content, children, position, delayMs, className, }: TooltipProps): import("react").JSX.Element;
|
|
11
|
+
export declare function Tooltip({ content, children, position, delayMs, className, wrapperClassName, }: TooltipProps): import("react").JSX.Element;
|
|
11
12
|
export {};
|