@bzync/rui 0.0.5 → 0.0.9
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 +476 -57
- 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 -1
- package/dist/components/aspect-ratio.js +1 -1
- 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 -1
- package/dist/components/avatar-group.js +1 -1
- 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 -1
- package/dist/components/blockquote.js +3 -3
- package/dist/components/breadcrumb.cjs +1 -1
- package/dist/components/breadcrumb.js +2 -2
- package/dist/components/button-group.cjs +1 -1
- package/dist/components/button-group.js +1 -1
- 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.js +4 -4
- 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 +3 -2
- package/dist/components/currency.cjs +1 -1
- package/dist/components/currency.js +1 -1
- 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 -1
- package/dist/components/description-list.js +1 -1
- package/dist/components/divider.cjs +1 -1
- package/dist/components/divider.js +1 -1
- 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 -1
- package/dist/components/rating.js +3 -3
- package/dist/components/richtext.cjs +1 -1
- package/dist/components/richtext.js +45 -18
- package/dist/components/scroll-area.cjs +1 -1
- package/dist/components/scroll-area.js +3 -3
- 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 -1
- package/dist/components/time-picker.d.ts +2 -0
- package/dist/components/time-picker.js +206 -148
- package/dist/components/timeline.cjs +1 -1
- package/dist/components/timeline.js +1 -1
- package/dist/components/toggle.cjs +1 -1
- package/dist/components/toggle.js +2 -2
- 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 -1
- package/dist/components/typography.d.ts +2 -3
- package/dist/components/typography.js +37 -24
- 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 +4 -0
- package/dist/index.js +126 -99
- 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,3 +1,129 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as e } from "../
|
|
3
|
-
|
|
2
|
+
import { t as e } from "../cn-BJyZJP-y.js";
|
|
3
|
+
import { c as t } from "../component-styles-C2CbHEEA.js";
|
|
4
|
+
import { t as n } from "../use-event-callback-DGkfO_uu.js";
|
|
5
|
+
import { n as r } from "../motion-gnRzFS5f.js";
|
|
6
|
+
import { n as i, t as a } from "../use-focus-trap-CS6BXJAB.js";
|
|
7
|
+
import { t as o } from "../icons-Dk7VZ4Ph.js";
|
|
8
|
+
import { AnimatePresence as s, motion as c } from "framer-motion";
|
|
9
|
+
import { useId as l, useRef as u } from "react";
|
|
10
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
|
+
import { createPortal as m } from "react-dom";
|
|
12
|
+
//#region src/components/drawer.tsx
|
|
13
|
+
function h({ open: h, onClose: g, position: _ = "left", title: v, children: y, width: b = 320, className: x, overlayClassName: S, panelClassName: C, headerClassName: w, titleClassName: T, closeButtonClassName: E, contentClassName: D, handleClassName: O, unstyled: k = !1, ariaLabel: A = "Drawer", closeAriaLabel: j = "Close drawer", closeOnEscape: M = !0, closeOnOverlayClick: N = !0 }) {
|
|
14
|
+
let P = n(g), F = u(null), I = l(), { previouslyFocusedRef: L, restoreNow: R } = i(h);
|
|
15
|
+
a(F, {
|
|
16
|
+
active: h,
|
|
17
|
+
onEscape: P,
|
|
18
|
+
closeOnEscape: M
|
|
19
|
+
});
|
|
20
|
+
let z = R;
|
|
21
|
+
if (typeof document > "u") return null;
|
|
22
|
+
if (k && h) return m(/* @__PURE__ */ f("div", {
|
|
23
|
+
ref: F,
|
|
24
|
+
tabIndex: -1,
|
|
25
|
+
role: "dialog",
|
|
26
|
+
"aria-modal": "true",
|
|
27
|
+
"aria-label": typeof v == "string" ? v : A,
|
|
28
|
+
className: e(x, C),
|
|
29
|
+
children: y
|
|
30
|
+
}), document.body);
|
|
31
|
+
if (_ === "bottom") return m(/* @__PURE__ */ f(s, {
|
|
32
|
+
onExitComplete: z,
|
|
33
|
+
children: h && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(c.div, {
|
|
34
|
+
initial: { opacity: 0 },
|
|
35
|
+
animate: { opacity: 1 },
|
|
36
|
+
exit: { opacity: 0 },
|
|
37
|
+
transition: r.overlay,
|
|
38
|
+
className: e("fixed inset-0 z-[100] bg-overlay", S),
|
|
39
|
+
onClick: N ? P : void 0
|
|
40
|
+
}, "drawer-backdrop"), /* @__PURE__ */ p(c.div, {
|
|
41
|
+
ref: F,
|
|
42
|
+
tabIndex: -1,
|
|
43
|
+
initial: { y: "100%" },
|
|
44
|
+
animate: { y: 0 },
|
|
45
|
+
exit: { y: "100%" },
|
|
46
|
+
transition: r.panelEnter,
|
|
47
|
+
role: "dialog",
|
|
48
|
+
"aria-modal": "true",
|
|
49
|
+
"aria-labelledby": v ? I : void 0,
|
|
50
|
+
"aria-label": v ? void 0 : A,
|
|
51
|
+
className: e("fixed bottom-0 left-0 right-0 z-[101] flex max-h-[80dvh] flex-col rounded-t-[var(--radius-xl)] border-t border-border bg-surface-raised shadow-overlay", C, x),
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ f("div", {
|
|
54
|
+
className: "flex justify-center pb-1 pt-3 shrink-0",
|
|
55
|
+
"aria-hidden": "true",
|
|
56
|
+
children: /* @__PURE__ */ f("div", { className: e("h-1 w-9 rounded-full bg-border-strong", O) })
|
|
57
|
+
}),
|
|
58
|
+
v && /* @__PURE__ */ p("div", {
|
|
59
|
+
className: e("flex items-center justify-between border-b border-border px-5 py-3 shrink-0", w),
|
|
60
|
+
children: [/* @__PURE__ */ f("h2", {
|
|
61
|
+
id: I,
|
|
62
|
+
className: e("text-sm font-semibold text-foreground", T),
|
|
63
|
+
children: v
|
|
64
|
+
}), /* @__PURE__ */ f("button", {
|
|
65
|
+
type: "button",
|
|
66
|
+
onClick: P,
|
|
67
|
+
className: e(t, E),
|
|
68
|
+
"aria-label": j,
|
|
69
|
+
children: /* @__PURE__ */ f(o, {
|
|
70
|
+
size: 14,
|
|
71
|
+
"aria-hidden": "true"
|
|
72
|
+
})
|
|
73
|
+
})]
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ f("div", {
|
|
76
|
+
className: e("flex-1 overflow-y-auto pb-safe-bottom", D),
|
|
77
|
+
children: y
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
}, "drawer-panel")] })
|
|
81
|
+
}), document.body);
|
|
82
|
+
let B = _ === "left" ? "-100%" : "100%";
|
|
83
|
+
return m(/* @__PURE__ */ f(s, {
|
|
84
|
+
onExitComplete: z,
|
|
85
|
+
children: h && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(c.div, {
|
|
86
|
+
initial: { opacity: 0 },
|
|
87
|
+
animate: { opacity: 1 },
|
|
88
|
+
exit: { opacity: 0 },
|
|
89
|
+
transition: r.overlay,
|
|
90
|
+
className: e("fixed inset-0 z-[100] bg-overlay", S),
|
|
91
|
+
onClick: N ? P : void 0
|
|
92
|
+
}, "drawer-backdrop"), /* @__PURE__ */ p(c.div, {
|
|
93
|
+
ref: F,
|
|
94
|
+
tabIndex: -1,
|
|
95
|
+
initial: { x: B },
|
|
96
|
+
animate: { x: 0 },
|
|
97
|
+
exit: { x: B },
|
|
98
|
+
transition: r.panelEnter,
|
|
99
|
+
role: "dialog",
|
|
100
|
+
"aria-modal": "true",
|
|
101
|
+
"aria-labelledby": v ? I : void 0,
|
|
102
|
+
"aria-label": v ? void 0 : A,
|
|
103
|
+
className: e("fixed top-0 bottom-0 z-[101] flex max-w-[100vw] flex-col bg-surface-raised shadow-overlay", _ === "left" ? "left-0 border-r border-border" : "right-0 border-l border-border", C, x),
|
|
104
|
+
style: { width: b },
|
|
105
|
+
children: [v && /* @__PURE__ */ p("div", {
|
|
106
|
+
className: e("flex h-14 items-center justify-between gap-3 border-b border-border px-5 shrink-0", w),
|
|
107
|
+
children: [/* @__PURE__ */ f("h2", {
|
|
108
|
+
id: I,
|
|
109
|
+
className: e("min-w-0 truncate text-sm font-semibold text-foreground", T),
|
|
110
|
+
children: v
|
|
111
|
+
}), /* @__PURE__ */ f("button", {
|
|
112
|
+
type: "button",
|
|
113
|
+
onClick: P,
|
|
114
|
+
className: e(t, E),
|
|
115
|
+
"aria-label": j,
|
|
116
|
+
children: /* @__PURE__ */ f(o, {
|
|
117
|
+
size: 14,
|
|
118
|
+
"aria-hidden": "true"
|
|
119
|
+
})
|
|
120
|
+
})]
|
|
121
|
+
}), /* @__PURE__ */ f("div", {
|
|
122
|
+
className: e("flex-1 overflow-y-auto", D),
|
|
123
|
+
children: y
|
|
124
|
+
})]
|
|
125
|
+
}, "drawer-panel")] })
|
|
126
|
+
}), document.body);
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
export { h as Drawer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../cn-B6R3HKzx.cjs"),t=require("../motion-B2shivEB.cjs");let n=require("framer-motion"),r=require("react/jsx-runtime");var i={bottom:`top-full mt-1.5`,top:`bottom-full mb-1.5`},a={start:`left-0`,end:`right-0`,center:`left-1/2 -translate-x-1/2`},o={bottom:{y:-4},top:{y:4}};function s(e){return`items`in e}function c({open:c,menuRef:l,items:u,side:d,align:f,className:p,itemClassName:m,groupLabelClassName:h,separatorClassName:g,ariaLabel:_,onKeyDown:v,onSelect:y}){function b(t,n){return(0,r.jsxs)(`button`,{type:`button`,disabled:t.disabled,role:`menuitem`,onClick:()=>{t.disabled||(t.onClick?.(),y())},className:e.t(`flex min-h-9 items-center gap-2.5 w-full px-3 py-2 text-sm rounded-md transition-colors text-left focus-visible:outline-none focus-visible:bg-surface-muted`,t.destructive?`text-destructive hover:bg-destructive/10`:`text-foreground hover:bg-surface-muted`,t.disabled&&`opacity-40 cursor-not-allowed pointer-events-none`,m),children:[t.icon&&(0,r.jsx)(`span`,{className:e.t(`shrink-0`,t.destructive?`text-red-400`:`text-slate-500 dark:text-slate-400`),children:t.icon}),(0,r.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:t.label}),t.shortcut&&(0,r.jsx)(`span`,{className:`text-[10px] text-slate-500 shrink-0 font-mono`,children:t.shortcut})]},n)}return(0,r.jsx)(n.AnimatePresence,{children:c&&(0,r.jsx)(n.motion.div,{ref:l,role:`menu`,"aria-label":_,onKeyDown:v,initial:{opacity:0,scaleY:.96,...o[d]},animate:{opacity:1,scaleY:1,y:0},exit:{opacity:0,scaleY:.96,...o[d]},transition:t.n.fade,style:{originY:d===`bottom`?0:1},className:e.t(`absolute z-50 min-w-[180px] rounded-[var(--radius-lg)] border border-border bg-surface-raised shadow-floating`,`p-1`,i[d],a[f],p),children:u.map((t,n)=>s(t)?(0,r.jsxs)(`div`,{children:[n>0&&(0,r.jsx)(`div`,{role:`separator`,className:e.t(`my-1 border-t border-border`,g)}),t.group&&(0,r.jsx)(`p`,{className:e.t(`px-3 pt-1.5 pb-1 text-xs font-medium text-muted-foreground`,h),children:t.group}),t.items.map((e,t)=>b(e,t))]},n):b(t,n))})})}module.exports=c;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DropdownMenuSection } from './dropdown-menu';
|
|
2
|
+
type Side = "bottom" | "top";
|
|
3
|
+
type Align = "start" | "end" | "center";
|
|
4
|
+
export interface DropdownMenuPanelProps {
|
|
5
|
+
open: boolean;
|
|
6
|
+
menuRef: React.RefObject<HTMLDivElement | null>;
|
|
7
|
+
items: DropdownMenuSection[];
|
|
8
|
+
side: Side;
|
|
9
|
+
align: Align;
|
|
10
|
+
className?: string;
|
|
11
|
+
itemClassName?: string;
|
|
12
|
+
groupLabelClassName?: string;
|
|
13
|
+
separatorClassName?: string;
|
|
14
|
+
ariaLabel: string;
|
|
15
|
+
onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
16
|
+
onSelect: () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The framer-motion-backed menu surface for {@link DropdownMenu}, split into its
|
|
20
|
+
* own async chunk so the motion runtime stays off the initial critical path —
|
|
21
|
+
* it loads on first open of any dropdown, not on page load.
|
|
22
|
+
*/
|
|
23
|
+
export default function DropdownMenuPanel({ open, menuRef, items, side, align, className, itemClassName, groupLabelClassName, separatorClassName, ariaLabel, onKeyDown, onSelect, }: DropdownMenuPanelProps): import("react").JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "../cn-BJyZJP-y.js";
|
|
3
|
+
import { n as t } from "../motion-gnRzFS5f.js";
|
|
4
|
+
import { AnimatePresence as n, motion as r } from "framer-motion";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/dropdown-menu-panel.tsx
|
|
7
|
+
var o = {
|
|
8
|
+
bottom: "top-full mt-1.5",
|
|
9
|
+
top: "bottom-full mb-1.5"
|
|
10
|
+
}, s = {
|
|
11
|
+
start: "left-0",
|
|
12
|
+
end: "right-0",
|
|
13
|
+
center: "left-1/2 -translate-x-1/2"
|
|
14
|
+
}, c = {
|
|
15
|
+
bottom: { y: -4 },
|
|
16
|
+
top: { y: 4 }
|
|
17
|
+
};
|
|
18
|
+
function l(e) {
|
|
19
|
+
return "items" in e;
|
|
20
|
+
}
|
|
21
|
+
function u({ open: u, menuRef: d, items: f, side: p, align: m, className: h, itemClassName: g, groupLabelClassName: _, separatorClassName: v, ariaLabel: y, onKeyDown: b, onSelect: x }) {
|
|
22
|
+
function S(t, n) {
|
|
23
|
+
return /* @__PURE__ */ a("button", {
|
|
24
|
+
type: "button",
|
|
25
|
+
disabled: t.disabled,
|
|
26
|
+
role: "menuitem",
|
|
27
|
+
onClick: () => {
|
|
28
|
+
t.disabled || (t.onClick?.(), x());
|
|
29
|
+
},
|
|
30
|
+
className: e("flex min-h-9 items-center gap-2.5 w-full px-3 py-2 text-sm rounded-md transition-colors text-left focus-visible:outline-none focus-visible:bg-surface-muted", t.destructive ? "text-destructive hover:bg-destructive/10" : "text-foreground hover:bg-surface-muted", t.disabled && "opacity-40 cursor-not-allowed pointer-events-none", g),
|
|
31
|
+
children: [
|
|
32
|
+
t.icon && /* @__PURE__ */ i("span", {
|
|
33
|
+
className: e("shrink-0", t.destructive ? "text-red-400" : "text-slate-500 dark:text-slate-400"),
|
|
34
|
+
children: t.icon
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ i("span", {
|
|
37
|
+
className: "flex-1 min-w-0 truncate",
|
|
38
|
+
children: t.label
|
|
39
|
+
}),
|
|
40
|
+
t.shortcut && /* @__PURE__ */ i("span", {
|
|
41
|
+
className: "text-[10px] text-slate-500 shrink-0 font-mono",
|
|
42
|
+
children: t.shortcut
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
}, n);
|
|
46
|
+
}
|
|
47
|
+
return /* @__PURE__ */ i(n, { children: u && /* @__PURE__ */ i(r.div, {
|
|
48
|
+
ref: d,
|
|
49
|
+
role: "menu",
|
|
50
|
+
"aria-label": y,
|
|
51
|
+
onKeyDown: b,
|
|
52
|
+
initial: {
|
|
53
|
+
opacity: 0,
|
|
54
|
+
scaleY: .96,
|
|
55
|
+
...c[p]
|
|
56
|
+
},
|
|
57
|
+
animate: {
|
|
58
|
+
opacity: 1,
|
|
59
|
+
scaleY: 1,
|
|
60
|
+
y: 0
|
|
61
|
+
},
|
|
62
|
+
exit: {
|
|
63
|
+
opacity: 0,
|
|
64
|
+
scaleY: .96,
|
|
65
|
+
...c[p]
|
|
66
|
+
},
|
|
67
|
+
transition: t.fade,
|
|
68
|
+
style: { originY: p === "bottom" ? 0 : 1 },
|
|
69
|
+
className: e("absolute z-50 min-w-[180px] rounded-[var(--radius-lg)] border border-border bg-surface-raised shadow-floating", "p-1", o[p], s[m], h),
|
|
70
|
+
children: f.map((t, n) => l(t) ? /* @__PURE__ */ a("div", { children: [
|
|
71
|
+
n > 0 && /* @__PURE__ */ i("div", {
|
|
72
|
+
role: "separator",
|
|
73
|
+
className: e("my-1 border-t border-border", v)
|
|
74
|
+
}),
|
|
75
|
+
t.group && /* @__PURE__ */ i("p", {
|
|
76
|
+
className: e("px-3 pt-1.5 pb-1 text-xs font-medium text-muted-foreground", _),
|
|
77
|
+
children: t.group
|
|
78
|
+
}),
|
|
79
|
+
t.items.map((e, t) => S(e, t))
|
|
80
|
+
] }, n) : S(t, n))
|
|
81
|
+
}) });
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { u as default };
|
|
@@ -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");let t=require("react"),n=require("react/jsx-runtime");var r=(0,t.lazy)(()=>Promise.resolve().then(()=>require("./dropdown-menu-panel.cjs")));function i({trigger:i,items:a,side:o=`bottom`,align:s=`start`,className:c,wrapperClassName:l,itemClassName:u,groupLabelClassName:d,separatorClassName:f,ariaLabel:p=`Actions menu`}){let[m,h]=(0,t.useState)(!1),[g,_]=(0,t.useState)(!1),v=(0,t.useRef)(null),y=(0,t.useRef)(null);(0,t.useEffect)(()=>{m&&_(!0)},[m]),(0,t.useEffect)(()=>{function e(e){v.current?.contains(e.target)||h(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,t.useEffect)(()=>{m&&y.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()},[m,g]);function b(){h(!1),v.current?.querySelector(`[aria-haspopup="menu"]`)?.focus()}function x(e){let t=Array.from(y.current?.querySelectorAll(`[role="menuitem"]:not(:disabled)`)??[]),n=t.indexOf(document.activeElement);e.key===`Escape`?(e.preventDefault(),b()):[`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)&&t.length>0&&(e.preventDefault(),t[e.key===`Home`?0:e.key===`End`?t.length-1:(Math.max(n,0)+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus())}let S=(0,t.isValidElement)(i)?(0,t.cloneElement)(i,{"aria-haspopup":`menu`,"aria-expanded":m,onClick:e=>{i.props.onClick?.(e),e.defaultPrevented||h(e=>!e)}}):(0,n.jsx)(`button`,{type:`button`,"aria-haspopup":`menu`,"aria-expanded":m,onClick:()=>h(e=>!e),children:i});return(0,n.jsxs)(`div`,{ref:v,className:e.t(`relative inline-flex`,l),children:[S,g&&(0,n.jsx)(t.Suspense,{fallback:null,children:(0,n.jsx)(r,{open:m,menuRef:y,items:a,side:o,align:s,className:c,itemClassName:u,groupLabelClassName:d,separatorClassName:f,ariaLabel:p,onKeyDown:x,onSelect:()=>h(!1)})})]})}exports.DropdownMenu=i;
|
|
@@ -20,7 +20,11 @@ export interface DropdownMenuProps {
|
|
|
20
20
|
side?: Side;
|
|
21
21
|
align?: Align;
|
|
22
22
|
className?: string;
|
|
23
|
+
wrapperClassName?: string;
|
|
24
|
+
itemClassName?: string;
|
|
25
|
+
groupLabelClassName?: string;
|
|
26
|
+
separatorClassName?: string;
|
|
23
27
|
ariaLabel?: string;
|
|
24
28
|
}
|
|
25
|
-
export declare function DropdownMenu({ trigger, items, side, align, className, ariaLabel, }: DropdownMenuProps): import("react").JSX.Element;
|
|
29
|
+
export declare function DropdownMenu({ trigger, items, side, align, className, wrapperClassName, itemClassName, groupLabelClassName, separatorClassName, ariaLabel, }: DropdownMenuProps): import("react").JSX.Element;
|
|
26
30
|
export {};
|
|
@@ -1,122 +1,67 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as e } from "../cn-
|
|
3
|
-
import {
|
|
4
|
-
import { cloneElement as r, isValidElement as i, useEffect as a, useRef as o, useState as s } from "react";
|
|
2
|
+
import { t as e } from "../cn-BJyZJP-y.js";
|
|
3
|
+
import { Suspense as t, cloneElement as n, isValidElement as r, lazy as i, useEffect as a, useRef as o, useState as s } from "react";
|
|
5
4
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
5
|
//#region src/components/dropdown-menu.tsx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var d = {
|
|
11
|
-
bottom: "top-full mt-1.5",
|
|
12
|
-
top: "bottom-full mb-1.5"
|
|
13
|
-
}, f = {
|
|
14
|
-
start: "left-0",
|
|
15
|
-
end: "right-0",
|
|
16
|
-
center: "left-1/2 -translate-x-1/2"
|
|
17
|
-
}, p = {
|
|
18
|
-
bottom: { y: -4 },
|
|
19
|
-
top: { y: 4 }
|
|
20
|
-
};
|
|
21
|
-
function m({ trigger: m, items: h, side: g = "bottom", align: _ = "start", className: v, ariaLabel: y = "Actions menu" }) {
|
|
22
|
-
let [b, x] = s(!1), S = o(null), C = o(null);
|
|
6
|
+
var u = i(() => import("./dropdown-menu-panel.js"));
|
|
7
|
+
function d({ trigger: i, items: d, side: f = "bottom", align: p = "start", className: m, wrapperClassName: h, itemClassName: g, groupLabelClassName: _, separatorClassName: v, ariaLabel: y = "Actions menu" }) {
|
|
8
|
+
let [b, x] = s(!1), [S, C] = s(!1), w = o(null), T = o(null);
|
|
23
9
|
a(() => {
|
|
10
|
+
b && C(!0);
|
|
11
|
+
}, [b]), a(() => {
|
|
24
12
|
function e(e) {
|
|
25
|
-
|
|
13
|
+
w.current?.contains(e.target) || x(!1);
|
|
26
14
|
}
|
|
27
15
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
28
16
|
}, []), a(() => {
|
|
29
|
-
b &&
|
|
30
|
-
}, [b]);
|
|
31
|
-
function
|
|
32
|
-
x(!1),
|
|
17
|
+
b && T.current?.querySelector("[role=\"menuitem\"]:not(:disabled)")?.focus();
|
|
18
|
+
}, [b, S]);
|
|
19
|
+
function E() {
|
|
20
|
+
x(!1), w.current?.querySelector("[aria-haspopup=\"menu\"]")?.focus();
|
|
33
21
|
}
|
|
34
|
-
function
|
|
35
|
-
let t = Array.from(
|
|
36
|
-
e.key === "Escape" ? (e.preventDefault(),
|
|
22
|
+
function D(e) {
|
|
23
|
+
let t = Array.from(T.current?.querySelectorAll("[role=\"menuitem\"]:not(:disabled)") ?? []), n = t.indexOf(document.activeElement);
|
|
24
|
+
e.key === "Escape" ? (e.preventDefault(), E()) : [
|
|
37
25
|
"ArrowDown",
|
|
38
26
|
"ArrowUp",
|
|
39
27
|
"Home",
|
|
40
28
|
"End"
|
|
41
29
|
].includes(e.key) && t.length > 0 && (e.preventDefault(), t[e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : (Math.max(n, 0) + (e.key === "ArrowDown" ? 1 : -1) + t.length) % t.length]?.focus());
|
|
42
30
|
}
|
|
43
|
-
|
|
44
|
-
return /* @__PURE__ */ l("button", {
|
|
45
|
-
type: "button",
|
|
46
|
-
disabled: t.disabled,
|
|
47
|
-
role: "menuitem",
|
|
48
|
-
onClick: () => {
|
|
49
|
-
t.disabled || (t.onClick?.(), x(!1));
|
|
50
|
-
},
|
|
51
|
-
className: e("flex min-h-9 items-center gap-2.5 w-full px-3 py-2 text-sm rounded-md transition-colors text-left focus-visible:outline-none focus-visible:bg-surface-muted", t.destructive ? "text-destructive hover:bg-destructive/10" : "text-foreground hover:bg-surface-muted", t.disabled && "opacity-40 cursor-not-allowed pointer-events-none"),
|
|
52
|
-
children: [
|
|
53
|
-
t.icon && /* @__PURE__ */ c("span", {
|
|
54
|
-
className: e("shrink-0", t.destructive ? "text-red-400" : "text-slate-500 dark:text-slate-400"),
|
|
55
|
-
children: t.icon
|
|
56
|
-
}),
|
|
57
|
-
/* @__PURE__ */ c("span", {
|
|
58
|
-
className: "flex-1 min-w-0 truncate",
|
|
59
|
-
children: t.label
|
|
60
|
-
}),
|
|
61
|
-
t.shortcut && /* @__PURE__ */ c("span", {
|
|
62
|
-
className: "text-[10px] text-slate-500 shrink-0 font-mono",
|
|
63
|
-
children: t.shortcut
|
|
64
|
-
})
|
|
65
|
-
]
|
|
66
|
-
}, n);
|
|
67
|
-
}
|
|
68
|
-
let D = i(m) ? r(m, {
|
|
31
|
+
let O = r(i) ? n(i, {
|
|
69
32
|
"aria-haspopup": "menu",
|
|
70
33
|
"aria-expanded": b,
|
|
71
34
|
onClick: (e) => {
|
|
72
|
-
|
|
35
|
+
i.props.onClick?.(e), e.defaultPrevented || x((e) => !e);
|
|
73
36
|
}
|
|
74
37
|
}) : /* @__PURE__ */ c("button", {
|
|
75
38
|
type: "button",
|
|
76
39
|
"aria-haspopup": "menu",
|
|
77
40
|
"aria-expanded": b,
|
|
78
41
|
onClick: () => x((e) => !e),
|
|
79
|
-
children:
|
|
42
|
+
children: i
|
|
80
43
|
});
|
|
81
44
|
return /* @__PURE__ */ l("div", {
|
|
82
|
-
ref:
|
|
83
|
-
className: "relative inline-flex",
|
|
84
|
-
children: [
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
scaleY: .96,
|
|
102
|
-
...p[g]
|
|
103
|
-
},
|
|
104
|
-
transition: { duration: .13 },
|
|
105
|
-
style: { originY: g === "bottom" ? 0 : 1 },
|
|
106
|
-
className: e("absolute z-50 min-w-[180px] rounded-[var(--radius-lg)] border border-border bg-surface-raised shadow-floating", "p-1", d[g], f[_], v),
|
|
107
|
-
children: h.map((e, t) => u(e) ? /* @__PURE__ */ l("div", { children: [
|
|
108
|
-
t > 0 && /* @__PURE__ */ c("div", {
|
|
109
|
-
role: "separator",
|
|
110
|
-
className: "my-1 border-t border-border"
|
|
111
|
-
}),
|
|
112
|
-
e.group && /* @__PURE__ */ c("p", {
|
|
113
|
-
className: "px-3 pt-1.5 pb-1 text-xs font-medium text-muted-foreground",
|
|
114
|
-
children: e.group
|
|
115
|
-
}),
|
|
116
|
-
e.items.map((e, t) => E(e, t))
|
|
117
|
-
] }, t) : E(e, t))
|
|
118
|
-
}) })]
|
|
45
|
+
ref: w,
|
|
46
|
+
className: e("relative inline-flex", h),
|
|
47
|
+
children: [O, S && /* @__PURE__ */ c(t, {
|
|
48
|
+
fallback: null,
|
|
49
|
+
children: /* @__PURE__ */ c(u, {
|
|
50
|
+
open: b,
|
|
51
|
+
menuRef: T,
|
|
52
|
+
items: d,
|
|
53
|
+
side: f,
|
|
54
|
+
align: p,
|
|
55
|
+
className: m,
|
|
56
|
+
itemClassName: g,
|
|
57
|
+
groupLabelClassName: _,
|
|
58
|
+
separatorClassName: v,
|
|
59
|
+
ariaLabel: y,
|
|
60
|
+
onKeyDown: D,
|
|
61
|
+
onSelect: () => x(!1)
|
|
62
|
+
})
|
|
63
|
+
})]
|
|
119
64
|
});
|
|
120
65
|
}
|
|
121
66
|
//#endregion
|
|
122
|
-
export {
|
|
67
|
+
export { d as DropdownMenu };
|
|
@@ -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={sm:{wrap:`py-6`,icon:`w-5 h-5`,title:`text-sm`,desc:`text-xs`,iconWrap:`w-8 h-8`},md:{wrap:`py-10`,icon:`w-6 h-6`,title:`text-base`,desc:`text-sm`,iconWrap:`w-9 h-9`},lg:{wrap:`py-12`,icon:`w-7 h-7`,title:`text-lg`,desc:`text-sm`,iconWrap:`w-10 h-10`}},r=({className:e})=>(0,t.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,t.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,t.jsx)(`path`,{d:`m21 21-4.35-4.35`})]});function i({icon:i,title:a,description:o,action:s,className:c,size:l=`md`,density:u,variant:d}){let f=u??(d===`compact`?`compact`:`comfortable`),p=n[l],m=f===`compact`?`py-4`:p.wrap;return(0,t.jsxs)(`div`,{className:e.t(`flex flex-col items-center justify-center text-center px-4`,m,c),children:[(0,t.jsx)(`div`,{className:e.t(`mb-3 flex items-center justify-center text-muted-foreground`,p.iconWrap),children:i?(0,t.jsx)(`span`,{className:e.t(`inline-flex items-center justify-center text-muted-foreground`,p.icon),children:i}):(0,t.jsx)(r,{className:e.t(`text-muted-foreground`,p.icon)})}),(0,t.jsx)(`p`,{className:e.t(`font-semibold text-foreground`,p.title),children:a}),o&&(0,t.jsx)(`p`,{className:e.t(`mt-1.5 max-w-sm leading-5 text-muted-foreground`,p.desc),children:o}),s&&(0,t.jsx)(`div`,{className:`mt-4`,children:s})]})}exports.EmptyState=i;
|
|
@@ -6,5 +6,9 @@ export interface EmptyStateProps {
|
|
|
6
6
|
action?: ReactNode;
|
|
7
7
|
className?: string;
|
|
8
8
|
size?: "sm" | "md" | "lg";
|
|
9
|
+
/** Density adjusts vertical padding for tight layouts (tables, cards). */
|
|
10
|
+
density?: "compact" | "comfortable";
|
|
11
|
+
/** Optional density alias — density wins if both provided */
|
|
12
|
+
variant?: "default" | "compact";
|
|
9
13
|
}
|
|
10
|
-
export declare function EmptyState({ icon, title, description, action, className, size, }: EmptyStateProps): import("react").JSX.Element;
|
|
14
|
+
export declare function EmptyState({ icon, title, description, action, className, size, density, variant, }: EmptyStateProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "../cn-
|
|
1
|
+
import { t as e } from "../cn-BJyZJP-y.js";
|
|
2
2
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/empty-state.tsx
|
|
4
4
|
var r = {
|
|
@@ -37,24 +37,24 @@ var r = {
|
|
|
37
37
|
r: "8"
|
|
38
38
|
}), /* @__PURE__ */ t("path", { d: "m21 21-4.35-4.35" })]
|
|
39
39
|
});
|
|
40
|
-
function a({ icon: a, title: o, description: s, action: c, className: l, size: u = "md" }) {
|
|
41
|
-
let d = r[u];
|
|
40
|
+
function a({ icon: a, title: o, description: s, action: c, className: l, size: u = "md", density: d, variant: f }) {
|
|
41
|
+
let p = d ?? (f === "compact" ? "compact" : "comfortable"), m = r[u], h = p === "compact" ? "py-4" : m.wrap;
|
|
42
42
|
return /* @__PURE__ */ n("div", {
|
|
43
|
-
className: e("flex flex-col items-center justify-center text-center px-4",
|
|
43
|
+
className: e("flex flex-col items-center justify-center text-center px-4", h, l),
|
|
44
44
|
children: [
|
|
45
45
|
/* @__PURE__ */ t("div", {
|
|
46
|
-
className: e("mb-3 flex items-center justify-center text-muted-foreground",
|
|
46
|
+
className: e("mb-3 flex items-center justify-center text-muted-foreground", m.iconWrap),
|
|
47
47
|
children: a ? /* @__PURE__ */ t("span", {
|
|
48
|
-
className: e("inline-flex items-center justify-center text-muted-foreground",
|
|
48
|
+
className: e("inline-flex items-center justify-center text-muted-foreground", m.icon),
|
|
49
49
|
children: a
|
|
50
|
-
}) : /* @__PURE__ */ t(i, { className: e("text-muted-foreground",
|
|
50
|
+
}) : /* @__PURE__ */ t(i, { className: e("text-muted-foreground", m.icon) })
|
|
51
51
|
}),
|
|
52
52
|
/* @__PURE__ */ t("p", {
|
|
53
|
-
className: e("font-semibold text-foreground",
|
|
53
|
+
className: e("font-semibold text-foreground", m.title),
|
|
54
54
|
children: o
|
|
55
55
|
}),
|
|
56
56
|
s && /* @__PURE__ */ t("p", {
|
|
57
|
-
className: e("mt-1.5 max-w-sm leading-5 text-muted-foreground",
|
|
57
|
+
className: e("mt-1.5 max-w-sm leading-5 text-muted-foreground", m.desc),
|
|
58
58
|
children: s
|
|
59
59
|
}),
|
|
60
60
|
c && /* @__PURE__ */ t("div", {
|
|
@@ -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"),t=require("./button.cjs");let n=require("react/jsx-runtime");function r({title:r=`This didn't load`,description:i=`The request didn't finish. Try again — if it keeps failing, the problem is on our end, not yours.`,error:a,onRetry:o,action:s,className:c}){let l=a instanceof Error?a.message:a;return(0,n.jsxs)(`div`,{role:`alert`,className:e.t(`flex flex-col items-center justify-center text-center px-4 py-10`,c),children:[(0,n.jsx)(`div`,{className:`mb-3 flex size-9 items-center justify-center text-destructive`,children:(0,n.jsxs)(`svg`,{"aria-hidden":`true`,width:`22`,height:`22`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,n.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,n.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]})}),(0,n.jsx)(`p`,{className:`text-base font-semibold text-foreground`,children:r}),(0,n.jsx)(`p`,{className:`mt-1.5 max-w-sm text-sm leading-5 text-muted-foreground`,children:i}),l&&(0,n.jsx)(`p`,{className:`mt-3 max-w-sm break-all rounded-md border border-destructive/20 bg-destructive/5 px-3 py-2 font-mono text-xs text-destructive`,children:l}),(o||s)&&(0,n.jsxs)(`div`,{className:`mt-5 flex items-center gap-3`,children:[o&&(0,n.jsx)(t.Button,{variant:`outline`,size:`sm`,onClick:o,icon:(0,n.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}),(0,n.jsx)(`path`,{d:`M3 3v5h5`})]}),children:`Try again`}),s]})]})}exports.ErrorState=r;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as e } from "../cn-
|
|
1
|
+
import { t as e } from "../cn-BJyZJP-y.js";
|
|
2
2
|
import { Button as t } from "./button.js";
|
|
3
3
|
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/error-state.tsx
|
|
5
|
-
function i({ title: i = "
|
|
5
|
+
function i({ title: i = "This didn't load", description: a = "The request didn't finish. Try again — if it keeps failing, the problem is on our end, not yours.", error: o, onRetry: s, action: c, className: l }) {
|
|
6
6
|
let u = o instanceof Error ? o.message : o;
|
|
7
7
|
return /* @__PURE__ */ r("div", {
|
|
8
8
|
role: "alert",
|
|
@@ -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("../component-styles-DY4wigiq.cjs");let n=require("framer-motion"),r=require("react"),i=require("react/jsx-runtime");var a=(0,r.forwardRef)(({className:a,label:o,hint:s,error:c,accept:l,maxSizeMB:u,onFilesChange:d,disabled:f,multiple:p,id:m,...h},g)=>{let[_,v]=(0,r.useState)(!1),[y,b]=(0,r.useState)([]),[x,S]=(0,r.useState)(``),C=(0,r.useRef)(null),w=(0,r.useId)(),T=m??w,E=`${T}-message`,D=u&&(u>=1024?`${u/1024}GB`:`${u}MB`);function O(e){if(!e)return;let t=Array.from(e);if(u){let e=t.find(e=>e.size>u*1024*1024);if(e){S(`${e.name} exceeds ${D}`);return}}S(``);let n=p?[...y,...t]:t;b(n),d?.(n)}function k(e){let t=y.filter((t,n)=>n!==e);b(t),d?.(t)}function A(e){e.preventDefault(),v(!1),!f&&O(e.dataTransfer.files)}let j=c??x;return(0,i.jsxs)(`div`,{className:e.t(t.o,a),children:[o&&(0,i.jsx)(`label`,{htmlFor:T,className:`text-xs font-semibold leading-5 text-foreground`,children:o}),(0,i.jsxs)(`label`,{htmlFor:T,onDragOver:e=>{e.preventDefault(),f||v(!0)},onDragLeave:()=>v(!1),onDrop:A,className:e.t(`relative flex flex-col items-center justify-center gap-2 rounded-[var(--radius-lg)] border border-dashed px-4 py-7 text-center cursor-pointer transition-colors focus-within:ring-[3px] focus-within:ring-focus-ring/25`,_?`border-accent-500/60 bg-accent-500/6`:j?`border-red-500/40 bg-red-500/4`:`border-border-strong bg-surface-muted/50 hover:border-accent-500/60 hover:bg-muted`,f&&`opacity-50 cursor-not-allowed pointer-events-none`),children:[(0,i.jsx)(`input`,{ref:e=>{C.current=e,typeof g==`function`?g(e):g&&(g.current=e)},type:`file`,id:T,accept:l,multiple:p,disabled:f,"aria-invalid":j?!0:void 0,"aria-describedby":j||s?E:void 0,className:`sr-only`,onChange:e=>O(e.target.files),...h}),(0,i.jsxs)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`text-muted-foreground`,children:[(0,i.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,i.jsx)(`polyline`,{points:`17 8 12 3 7 8`}),(0,i.jsx)(`line`,{x1:`12`,y1:`3`,x2:`12`,y2:`15`})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsxs)(`p`,{className:`text-sm font-medium text-foreground`,children:[`Drop files here or `,(0,i.jsx)(`span`,{className:`text-accent-700 dark:text-accent-300`,children:`browse`})]}),(l||u)&&(0,i.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[l&&`Accepts ${l}`,D&&`Max ${D}`].filter(Boolean).join(` · `)})]})]}),(0,i.jsx)(n.AnimatePresence,{initial:!1,children:y.length>0&&(0,i.jsx)(n.motion.ul,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},className:`flex flex-col gap-1 overflow-hidden`,children:y.map((t,n)=>(0,i.jsxs)(`li`,{className:`flex items-center gap-2 rounded-[var(--radius-md)] border border-border bg-surface-muted px-3 py-2`,children:[(0,i.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`text-slate-400 shrink-0`,children:[(0,i.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,i.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]}),(0,i.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-foreground`,children:t.name}),(0,i.jsxs)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:[(t.size/1024).toFixed(0),`KB`]}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>k(n),"aria-label":`Remove ${t.name}`,className:e.t(`shrink-0 rounded-sm text-muted-foreground hover:text-destructive transition-colors`,`focus-ring`),children:(0,i.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,i.jsx)(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]},`${t.name}-${n}`))})}),j&&(0,i.jsx)(`p`,{id:E,"aria-live":`polite`,className:`text-xs leading-5 text-destructive`,children:j}),s&&!j&&(0,i.jsx)(`p`,{id:E,className:`text-xs leading-5 text-muted-foreground`,children:s})]})});a.displayName=`FileUpload`,exports.FileUpload=a;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as e } from "../cn-
|
|
3
|
-
import { o as t } from "../component-styles-
|
|
2
|
+
import { t as e } from "../cn-BJyZJP-y.js";
|
|
3
|
+
import { o as t } from "../component-styles-C2CbHEEA.js";
|
|
4
4
|
import { AnimatePresence as n, motion as r } from "framer-motion";
|
|
5
5
|
import { forwardRef as i, useId as a, useRef as o, useState as s } from "react";
|
|
6
6
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
@@ -44,7 +44,7 @@ var u = i(({ className: i, label: u, hint: d, error: f, accept: p, maxSizeMB: m,
|
|
|
44
44
|
},
|
|
45
45
|
onDragLeave: () => S(!1),
|
|
46
46
|
onDrop: P,
|
|
47
|
-
className: e("relative flex flex-col items-center justify-center gap-2 rounded-[var(--radius-lg)] border border-dashed px-4 py-7 text-center cursor-pointer transition-colors focus-within:ring-
|
|
47
|
+
className: e("relative flex flex-col items-center justify-center gap-2 rounded-[var(--radius-lg)] border border-dashed px-4 py-7 text-center cursor-pointer transition-colors focus-within:ring-[3px] focus-within:ring-focus-ring/25", x ? "border-accent-500/60 bg-accent-500/6" : F ? "border-red-500/40 bg-red-500/4" : "border-border-strong bg-surface-muted/50 hover:border-accent-500/60 hover:bg-muted", g && "opacity-50 cursor-not-allowed pointer-events-none"),
|
|
48
48
|
children: [
|
|
49
49
|
/* @__PURE__ */ c("input", {
|
|
50
50
|
ref: (e) => {
|
|
@@ -137,7 +137,7 @@ var u = i(({ className: i, label: u, hint: d, error: f, accept: p, maxSizeMB: m,
|
|
|
137
137
|
type: "button",
|
|
138
138
|
onClick: () => N(n),
|
|
139
139
|
"aria-label": `Remove ${t.name}`,
|
|
140
|
-
className: e("shrink-0 rounded-sm text-muted-foreground hover:text-destructive transition-colors", "focus-
|
|
140
|
+
className: e("shrink-0 rounded-sm text-muted-foreground hover:text-destructive transition-colors", "focus-ring"),
|
|
141
141
|
children: /* @__PURE__ */ c("svg", {
|
|
142
142
|
width: "12",
|
|
143
143
|
height: "12",
|
|
@@ -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"),t=require("../component-styles-DY4wigiq.cjs");let n=require("react/jsx-runtime");function r({label:r,hint:i,error:a,required:o,htmlFor:s,className:c,children:l,...u}){return(0,n.jsxs)(`div`,{className:e.t(t.o,c),...u,children:[r&&(0,n.jsxs)(`label`,{htmlFor:s,className:e.t(`flex items-center gap-1`,`text-xs font-semibold leading-5 text-foreground`),children:[r,o&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`span`,{"aria-hidden":`true`,className:`text-destructive`,children:`*`}),(0,n.jsx)(`span`,{className:`sr-only`,children:` (required)`})]})]}),l,a&&(0,n.jsx)(`p`,{"aria-live":`polite`,className:`text-xs leading-5 text-destructive`,children:a}),i&&!a&&(0,n.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:i})]})}var i=r;function a({className:r,children:i,required:a,htmlFor:o,...s}){return(0,n.jsxs)(`label`,{htmlFor:o,className:e.t(`flex items-center gap-1`,t.a,r),...s,children:[i,a&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`span`,{"aria-hidden":`true`,className:`text-destructive`,children:` *`}),(0,n.jsx)(`span`,{className:`sr-only`,children:` (required)`})]})]})}function o({className:r,...i}){return(0,n.jsx)(`p`,{className:e.t(t.r,r),...i})}function s({className:r,...i}){return(0,n.jsx)(`p`,{"aria-live":`polite`,className:e.t(t.i,r),...i})}function c({className:t,...r}){return(0,n.jsx)(`div`,{className:e.t(`flex flex-col gap-1.5`,t),...r})}exports.Field=i,exports.FieldContent=c,exports.FieldDescription=o,exports.FieldError=s,exports.FieldLabel=a,exports.FormField=r;
|
|
@@ -8,3 +8,12 @@ export interface FormFieldProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
8
8
|
children: ReactNode;
|
|
9
9
|
}
|
|
10
10
|
export declare function FormField({ label, hint, error, required, htmlFor, className, children, ...props }: FormFieldProps): import("react").JSX.Element;
|
|
11
|
+
export declare const Field: typeof FormField;
|
|
12
|
+
export type FieldProps = FormFieldProps;
|
|
13
|
+
export declare function FieldLabel({ className, children, required, htmlFor, ...props }: HTMLAttributes<HTMLLabelElement> & {
|
|
14
|
+
required?: boolean;
|
|
15
|
+
htmlFor?: string;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
17
|
+
export declare function FieldDescription({ className, ...props }: HTMLAttributes<HTMLParagraphElement>): import("react").JSX.Element;
|
|
18
|
+
export declare function FieldError({ className, ...props }: HTMLAttributes<HTMLParagraphElement>): import("react").JSX.Element;
|
|
19
|
+
export declare function FieldContent({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|