@bzync/rui 0.0.5 → 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 +5 -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 -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 +2 -2
- 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,25 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as e } from "../cn-
|
|
3
|
-
import "../component-styles-
|
|
2
|
+
import { t as e } from "../cn-BJyZJP-y.js";
|
|
3
|
+
import "../component-styles-C2CbHEEA.js";
|
|
4
4
|
import { t } from "../focus-Dk1YWVPN.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { n } from "../motion-gnRzFS5f.js";
|
|
6
|
+
import { AnimatePresence as r, motion as i } from "framer-motion";
|
|
7
|
+
import { createContext as a, useContext as o, useEffect as s, useId as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
8
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
8
9
|
//#region src/components/command.tsx
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
let e =
|
|
10
|
+
var m = a(null);
|
|
11
|
+
function h() {
|
|
12
|
+
let e = o(m);
|
|
12
13
|
if (!e) throw Error("useCommand must be inside <CommandProvider>");
|
|
13
14
|
return e;
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
let [n, r] =
|
|
17
|
-
return
|
|
16
|
+
function g({ children: e, shortcut: t = "k" }) {
|
|
17
|
+
let [n, r] = d(!1);
|
|
18
|
+
return s(() => {
|
|
18
19
|
function e(e) {
|
|
19
20
|
(e.metaKey || e.ctrlKey) && e.key === t && (e.preventDefault(), r((e) => !e));
|
|
20
21
|
}
|
|
21
22
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
22
|
-
}, [t]), /* @__PURE__ */
|
|
23
|
+
}, [t]), /* @__PURE__ */ f(m.Provider, {
|
|
23
24
|
value: {
|
|
24
25
|
open: n,
|
|
25
26
|
setOpen: r
|
|
@@ -27,63 +28,63 @@ function h({ children: e, shortcut: t = "k" }) {
|
|
|
27
28
|
children: e
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
-
let { open:
|
|
32
|
-
|
|
33
|
-
if (!
|
|
34
|
-
let e = document.activeElement instanceof HTMLElement ? document.activeElement : null, n = document.body.style.overflow, r = window.setTimeout(() =>
|
|
31
|
+
function _({ items: a, placeholder: o = "Search commands…", emptyText: m = "No results found.", ariaLabel: g = "Command palette", className: _, overlayClassName: v, searchClassName: y, inputClassName: b, listClassName: x, itemClassName: S, emptyClassName: C }) {
|
|
32
|
+
let { open: w, setOpen: T } = h(), [E, D] = d(""), [O, k] = d(0), A = u(null), j = u(null), M = u(null), N = c();
|
|
33
|
+
s(() => {
|
|
34
|
+
if (!w) return;
|
|
35
|
+
let e = document.activeElement instanceof HTMLElement ? document.activeElement : null, n = document.body.style.overflow, r = window.setTimeout(() => A.current?.focus(), 0), i = (e) => {
|
|
35
36
|
if (e.key === "Escape") {
|
|
36
|
-
e.preventDefault(),
|
|
37
|
+
e.preventDefault(), T(!1);
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
|
-
if (e.key !== "Tab" || !
|
|
40
|
-
let n = t(
|
|
40
|
+
if (e.key !== "Tab" || !M.current) return;
|
|
41
|
+
let n = t(M.current);
|
|
41
42
|
if (n.length === 0) {
|
|
42
|
-
e.preventDefault(),
|
|
43
|
+
e.preventDefault(), M.current.focus();
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
45
46
|
let r = n[0], i = n[n.length - 1];
|
|
46
47
|
e.shiftKey && document.activeElement === r ? (e.preventDefault(), i.focus()) : !e.shiftKey && document.activeElement === i && (e.preventDefault(), r.focus());
|
|
47
48
|
};
|
|
48
|
-
return
|
|
49
|
+
return D(""), k(0), document.body.style.overflow = "hidden", document.addEventListener("keydown", i), () => {
|
|
49
50
|
window.clearTimeout(r), document.body.style.overflow = n, document.removeEventListener("keydown", i), e?.focus();
|
|
50
51
|
};
|
|
51
|
-
}, [
|
|
52
|
-
let
|
|
53
|
-
if (!
|
|
54
|
-
let e =
|
|
55
|
-
return
|
|
56
|
-
}, [
|
|
52
|
+
}, [w, T]);
|
|
53
|
+
let P = l(() => {
|
|
54
|
+
if (!E) return a;
|
|
55
|
+
let e = E.toLowerCase();
|
|
56
|
+
return a.filter((t) => t.label.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e) || t.keywords?.some((t) => t.toLowerCase().includes(e)));
|
|
57
|
+
}, [E, a]), F = l(() => {
|
|
57
58
|
let e = /* @__PURE__ */ new Map();
|
|
58
|
-
for (let t of
|
|
59
|
+
for (let t of P) {
|
|
59
60
|
let n = t.group ?? "";
|
|
60
61
|
e.has(n) || e.set(n, []), e.get(n).push(t);
|
|
61
62
|
}
|
|
62
63
|
return e;
|
|
63
|
-
}, [
|
|
64
|
-
function
|
|
65
|
-
e.key === "ArrowDown" ? (e.preventDefault(),
|
|
64
|
+
}, [P]), I = l(() => Array.from(F.values()).flat(), [F]);
|
|
65
|
+
function L(e) {
|
|
66
|
+
e.key === "ArrowDown" ? (e.preventDefault(), k((e) => Math.min(e + 1, Math.max(I.length - 1, 0)))) : e.key === "ArrowUp" ? (e.preventDefault(), k((e) => Math.max(e - 1, 0))) : e.key === "Enter" ? (e.preventDefault(), I[O]?.onSelect(), T(!1)) : e.key === "Escape" && T(!1);
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}, [
|
|
70
|
-
let
|
|
71
|
-
return /* @__PURE__ */
|
|
68
|
+
s(() => {
|
|
69
|
+
j.current && j.current.querySelector("[data-active=\"true\"]")?.scrollIntoView({ block: "nearest" });
|
|
70
|
+
}, [O]);
|
|
71
|
+
let R = 0;
|
|
72
|
+
return /* @__PURE__ */ f(r, { children: w && /* @__PURE__ */ p("div", {
|
|
72
73
|
className: "fixed inset-0 z-[200] flex items-start justify-center pt-[15vh] p-4",
|
|
73
|
-
children: [/* @__PURE__ */
|
|
74
|
+
children: [/* @__PURE__ */ f(i.div, {
|
|
74
75
|
initial: { opacity: 0 },
|
|
75
76
|
animate: { opacity: 1 },
|
|
76
77
|
exit: { opacity: 0 },
|
|
77
|
-
transition:
|
|
78
|
-
className: "absolute inset-0 bg-overlay",
|
|
79
|
-
onClick: () =>
|
|
78
|
+
transition: n.fade,
|
|
79
|
+
className: e("absolute inset-0 bg-overlay", v),
|
|
80
|
+
onClick: () => T(!1),
|
|
80
81
|
"aria-hidden": "true"
|
|
81
|
-
}), /* @__PURE__ */
|
|
82
|
-
ref:
|
|
82
|
+
}), /* @__PURE__ */ p(i.div, {
|
|
83
|
+
ref: M,
|
|
83
84
|
tabIndex: -1,
|
|
84
85
|
role: "dialog",
|
|
85
86
|
"aria-modal": "true",
|
|
86
|
-
"aria-label":
|
|
87
|
+
"aria-label": g,
|
|
87
88
|
initial: {
|
|
88
89
|
opacity: 0,
|
|
89
90
|
scale: .96,
|
|
@@ -104,11 +105,11 @@ function g({ items: i, placeholder: a = "Search commands…", emptyText: p = "No
|
|
|
104
105
|
stiffness: 400,
|
|
105
106
|
damping: 30
|
|
106
107
|
},
|
|
107
|
-
className: "relative w-full max-w-lg overflow-hidden rounded-[var(--radius-xl)] border border-border bg-surface-raised shadow-overlay",
|
|
108
|
-
children: [/* @__PURE__ */
|
|
109
|
-
className: "flex items-center gap-3 border-b border-border px-4",
|
|
108
|
+
className: e("relative w-full max-w-lg overflow-hidden rounded-[var(--radius-xl)] border border-border bg-surface-raised shadow-overlay", _),
|
|
109
|
+
children: [/* @__PURE__ */ p("div", {
|
|
110
|
+
className: e("flex items-center gap-3 border-b border-border px-4", y),
|
|
110
111
|
children: [
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ p("svg", {
|
|
112
113
|
width: "16",
|
|
113
114
|
height: "16",
|
|
114
115
|
viewBox: "0 0 24 24",
|
|
@@ -118,80 +119,80 @@ function g({ items: i, placeholder: a = "Search commands…", emptyText: p = "No
|
|
|
118
119
|
strokeLinecap: "round",
|
|
119
120
|
strokeLinejoin: "round",
|
|
120
121
|
className: "text-slate-400 shrink-0",
|
|
121
|
-
children: [/* @__PURE__ */
|
|
122
|
+
children: [/* @__PURE__ */ f("circle", {
|
|
122
123
|
cx: "11",
|
|
123
124
|
cy: "11",
|
|
124
125
|
r: "8"
|
|
125
|
-
}), /* @__PURE__ */
|
|
126
|
+
}), /* @__PURE__ */ f("path", { d: "m21 21-4.35-4.35" })]
|
|
126
127
|
}),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
ref:
|
|
128
|
+
/* @__PURE__ */ f("input", {
|
|
129
|
+
ref: A,
|
|
129
130
|
type: "search",
|
|
130
131
|
role: "combobox",
|
|
131
|
-
"aria-label":
|
|
132
|
+
"aria-label": g,
|
|
132
133
|
"aria-autocomplete": "list",
|
|
133
134
|
"aria-expanded": "true",
|
|
134
|
-
"aria-controls":
|
|
135
|
-
"aria-activedescendant": O
|
|
136
|
-
value:
|
|
135
|
+
"aria-controls": N,
|
|
136
|
+
"aria-activedescendant": I[O] ? `${N}-option-${O}` : void 0,
|
|
137
|
+
value: E,
|
|
137
138
|
onChange: (e) => {
|
|
138
|
-
|
|
139
|
+
D(e.target.value), k(0);
|
|
139
140
|
},
|
|
140
|
-
onKeyDown:
|
|
141
|
-
placeholder:
|
|
142
|
-
className: "min-w-0 flex-1 bg-transparent py-3.5 text-sm text-foreground outline-none placeholder:text-muted-foreground"
|
|
141
|
+
onKeyDown: L,
|
|
142
|
+
placeholder: o,
|
|
143
|
+
className: e("min-w-0 flex-1 bg-transparent py-3.5 text-sm text-foreground outline-none placeholder:text-muted-foreground", b)
|
|
143
144
|
}),
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ f("kbd", {
|
|
145
146
|
className: "shrink-0 rounded-[var(--radius-sm)] border border-border-strong bg-surface-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",
|
|
146
147
|
children: "ESC"
|
|
147
148
|
})
|
|
148
149
|
]
|
|
149
|
-
}), /* @__PURE__ */
|
|
150
|
-
id:
|
|
151
|
-
ref:
|
|
150
|
+
}), /* @__PURE__ */ f("div", {
|
|
151
|
+
id: N,
|
|
152
|
+
ref: j,
|
|
152
153
|
role: "listbox",
|
|
153
154
|
"aria-label": "Commands",
|
|
154
|
-
className: "max-h-80 overflow-y-auto py-1.5",
|
|
155
|
-
children:
|
|
156
|
-
className: "py-10 text-center text-sm text-muted-foreground",
|
|
157
|
-
children:
|
|
158
|
-
}) : Array.from(
|
|
155
|
+
className: e("max-h-80 overflow-y-auto py-1.5", x),
|
|
156
|
+
children: P.length === 0 ? /* @__PURE__ */ f("p", {
|
|
157
|
+
className: e("py-10 text-center text-sm text-muted-foreground", C),
|
|
158
|
+
children: m
|
|
159
|
+
}) : Array.from(F.entries()).map(([t, n]) => /* @__PURE__ */ p("div", {
|
|
159
160
|
role: "group",
|
|
160
161
|
"aria-label": t || void 0,
|
|
161
|
-
children: [t && /* @__PURE__ */
|
|
162
|
+
children: [t && /* @__PURE__ */ f("p", {
|
|
162
163
|
className: "px-4 py-1 text-[10px] font-semibold text-slate-500 uppercase tracking-widest",
|
|
163
164
|
children: t
|
|
164
165
|
}), n.map((t) => {
|
|
165
|
-
let n =
|
|
166
|
-
return /* @__PURE__ */
|
|
167
|
-
id: `${
|
|
166
|
+
let n = R++, r = n === O;
|
|
167
|
+
return /* @__PURE__ */ p("button", {
|
|
168
|
+
id: `${N}-option-${n}`,
|
|
168
169
|
type: "button",
|
|
169
170
|
role: "option",
|
|
170
171
|
"aria-selected": r,
|
|
171
172
|
"data-active": r,
|
|
172
173
|
onClick: () => {
|
|
173
|
-
t.onSelect(),
|
|
174
|
+
t.onSelect(), T(!1);
|
|
174
175
|
},
|
|
175
|
-
onMouseEnter: () =>
|
|
176
|
-
className: e("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors", "focus-
|
|
176
|
+
onMouseEnter: () => k(n),
|
|
177
|
+
className: e("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors", "focus-ring", r ? "bg-surface-muted" : "hover:bg-surface-muted/70", S),
|
|
177
178
|
children: [
|
|
178
|
-
t.icon && /* @__PURE__ */
|
|
179
|
+
t.icon && /* @__PURE__ */ f("span", {
|
|
179
180
|
className: "shrink-0 text-slate-500 dark:text-slate-400 w-5 flex items-center justify-center",
|
|
180
181
|
children: t.icon
|
|
181
182
|
}),
|
|
182
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ p("div", {
|
|
183
184
|
className: "flex-1 min-w-0",
|
|
184
|
-
children: [/* @__PURE__ */
|
|
185
|
+
children: [/* @__PURE__ */ f("p", {
|
|
185
186
|
className: "truncate text-sm text-foreground",
|
|
186
187
|
children: t.label
|
|
187
|
-
}), t.description && /* @__PURE__ */
|
|
188
|
+
}), t.description && /* @__PURE__ */ f("p", {
|
|
188
189
|
className: "truncate text-xs text-muted-foreground",
|
|
189
190
|
children: t.description
|
|
190
191
|
})]
|
|
191
192
|
}),
|
|
192
|
-
t.shortcut && /* @__PURE__ */
|
|
193
|
+
t.shortcut && /* @__PURE__ */ f("div", {
|
|
193
194
|
className: "flex items-center gap-0.5 shrink-0",
|
|
194
|
-
children: t.shortcut.map((e, t) => /* @__PURE__ */
|
|
195
|
+
children: t.shortcut.map((e, t) => /* @__PURE__ */ f("kbd", {
|
|
195
196
|
className: "rounded-[var(--radius-sm)] border border-border bg-surface-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",
|
|
196
197
|
children: e
|
|
197
198
|
}, t))
|
|
@@ -205,4 +206,4 @@ function g({ items: i, placeholder: a = "Search commands…", emptyText: p = "No
|
|
|
205
206
|
}) });
|
|
206
207
|
}
|
|
207
208
|
//#endregion
|
|
208
|
-
export {
|
|
209
|
+
export { _ as CommandPalette, g as CommandProvider, h as useCommand };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./button.cjs"),
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-B6R3HKzx.cjs"),t=require("./button.cjs"),n=require("./modal.cjs");let r=require("react/jsx-runtime");function i({open:i,onClose:a,onConfirm:o,title:s=`Are you sure?`,description:c,confirmLabel:l=`Confirm`,cancelLabel:u=`Cancel`,destructive:d=!1,loading:f=!1,icon:p,className:m,overlayClassName:h,panelClassName:g,contentClassName:_,actionsClassName:v,cancelButtonClassName:y,confirmButtonClassName:b}){return(0,r.jsxs)(n.Modal,{open:i,onClose:a,size:`sm`,title:s,description:typeof c==`string`?c:void 0,icon:p??(d?(0,r.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`text-red-600 dark:text-red-400`,children:[(0,r.jsx)(`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z`}),(0,r.jsx)(`path`,{d:`M12 9v4`}),(0,r.jsx)(`path`,{d:`M12 17h.01`})]}):(0,r.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`text-info`,children:[(0,r.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,r.jsx)(`path`,{d:`M12 16v-4`}),(0,r.jsx)(`path`,{d:`M12 8h.01`})]})),className:m,overlayClassName:h,panelClassName:g,children:[typeof c!=`string`&&c&&(0,r.jsx)(`div`,{className:e.t(`text-sm leading-relaxed text-slate-600 dark:text-slate-400`,_),children:c}),(0,r.jsxs)(`div`,{className:e.t(`flex flex-wrap justify-end gap-2.5 pt-2`,v),children:[(0,r.jsx)(t.Button,{variant:`ghost`,onClick:a,disabled:f,className:y,children:u}),(0,r.jsx)(t.Button,{variant:d?`destructive`:`primary`,onClick:o,loading:f,autoFocus:!0,className:b,children:l})]})]})}exports.ConfirmDialog=i;
|
|
@@ -10,5 +10,12 @@ export interface ConfirmDialogProps {
|
|
|
10
10
|
destructive?: boolean;
|
|
11
11
|
loading?: boolean;
|
|
12
12
|
icon?: ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
overlayClassName?: string;
|
|
15
|
+
panelClassName?: string;
|
|
16
|
+
contentClassName?: string;
|
|
17
|
+
actionsClassName?: string;
|
|
18
|
+
cancelButtonClassName?: string;
|
|
19
|
+
confirmButtonClassName?: string;
|
|
13
20
|
}
|
|
14
|
-
export declare function ConfirmDialog({ open, onClose, onConfirm, title, description, confirmLabel, cancelLabel, destructive, loading, icon, }: ConfirmDialogProps): import("react").JSX.Element;
|
|
21
|
+
export declare function ConfirmDialog({ open, onClose, onConfirm, title, description, confirmLabel, cancelLabel, destructive, loading, icon, className, overlayClassName, panelClassName, contentClassName, actionsClassName, cancelButtonClassName, confirmButtonClassName, }: ConfirmDialogProps): import("react").JSX.Element;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { t as e } from "../cn-BJyZJP-y.js";
|
|
3
|
+
import { Button as t } from "./button.js";
|
|
4
|
+
import { Modal as n } from "./modal.js";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/confirm-dialog.tsx
|
|
6
|
-
function
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
-
open:
|
|
9
|
-
onClose:
|
|
7
|
+
function a({ open: a, onClose: o, onConfirm: s, title: c = "Are you sure?", description: l, confirmLabel: u = "Confirm", cancelLabel: d = "Cancel", destructive: f = !1, loading: p = !1, icon: m, className: h, overlayClassName: g, panelClassName: _, contentClassName: v, actionsClassName: y, cancelButtonClassName: b, confirmButtonClassName: x }) {
|
|
8
|
+
return /* @__PURE__ */ i(n, {
|
|
9
|
+
open: a,
|
|
10
|
+
onClose: o,
|
|
10
11
|
size: "sm",
|
|
11
|
-
title:
|
|
12
|
-
description: typeof
|
|
13
|
-
icon:
|
|
12
|
+
title: c,
|
|
13
|
+
description: typeof l == "string" ? l : void 0,
|
|
14
|
+
icon: m ?? (f ? /* @__PURE__ */ i("svg", {
|
|
14
15
|
width: "20",
|
|
15
16
|
height: "20",
|
|
16
17
|
viewBox: "0 0 24 24",
|
|
@@ -21,11 +22,11 @@ function i({ open: i, onClose: a, onConfirm: o, title: s = "Are you sure?", desc
|
|
|
21
22
|
strokeLinejoin: "round",
|
|
22
23
|
className: "text-red-600 dark:text-red-400",
|
|
23
24
|
children: [
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
25
|
+
/* @__PURE__ */ r("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }),
|
|
26
|
+
/* @__PURE__ */ r("path", { d: "M12 9v4" }),
|
|
27
|
+
/* @__PURE__ */ r("path", { d: "M12 17h.01" })
|
|
27
28
|
]
|
|
28
|
-
}) : /* @__PURE__ */
|
|
29
|
+
}) : /* @__PURE__ */ i("svg", {
|
|
29
30
|
width: "20",
|
|
30
31
|
height: "20",
|
|
31
32
|
viewBox: "0 0 24 24",
|
|
@@ -36,34 +37,39 @@ function i({ open: i, onClose: a, onConfirm: o, title: s = "Are you sure?", desc
|
|
|
36
37
|
strokeLinejoin: "round",
|
|
37
38
|
className: "text-info",
|
|
38
39
|
children: [
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ r("circle", {
|
|
40
41
|
cx: "12",
|
|
41
42
|
cy: "12",
|
|
42
43
|
r: "10"
|
|
43
44
|
}),
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ r("path", { d: "M12 16v-4" }),
|
|
46
|
+
/* @__PURE__ */ r("path", { d: "M12 8h.01" })
|
|
46
47
|
]
|
|
47
48
|
})),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
className: "
|
|
53
|
-
children:
|
|
49
|
+
className: h,
|
|
50
|
+
overlayClassName: g,
|
|
51
|
+
panelClassName: _,
|
|
52
|
+
children: [typeof l != "string" && l && /* @__PURE__ */ r("div", {
|
|
53
|
+
className: e("text-sm leading-relaxed text-slate-600 dark:text-slate-400", v),
|
|
54
|
+
children: l
|
|
55
|
+
}), /* @__PURE__ */ i("div", {
|
|
56
|
+
className: e("flex flex-wrap justify-end gap-2.5 pt-2", y),
|
|
57
|
+
children: [/* @__PURE__ */ r(t, {
|
|
54
58
|
variant: "ghost",
|
|
55
|
-
onClick: a,
|
|
56
|
-
disabled: f,
|
|
57
|
-
children: u
|
|
58
|
-
}), /* @__PURE__ */ n(e, {
|
|
59
|
-
variant: d ? "destructive" : "primary",
|
|
60
59
|
onClick: o,
|
|
61
|
-
|
|
60
|
+
disabled: p,
|
|
61
|
+
className: b,
|
|
62
|
+
children: d
|
|
63
|
+
}), /* @__PURE__ */ r(t, {
|
|
64
|
+
variant: f ? "destructive" : "primary",
|
|
65
|
+
onClick: s,
|
|
66
|
+
loading: p,
|
|
62
67
|
autoFocus: !0,
|
|
63
|
-
|
|
68
|
+
className: x,
|
|
69
|
+
children: u
|
|
64
70
|
})]
|
|
65
71
|
})]
|
|
66
72
|
});
|
|
67
73
|
}
|
|
68
74
|
//#endregion
|
|
69
|
-
export {
|
|
75
|
+
export { a as ConfirmDialog };
|
|
@@ -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("framer-motion"),n=require("react"),r=require("react/jsx-runtime");var i=()=>(0,r.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,r.jsx)(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),(0,r.jsx)(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]}),a=()=>(0,r.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,r.jsx)(`path`,{d:`m20 6-11 11-5-5`})});function o({value:o,timeout:s=2e3,label:c,size:l=`sm`,className:u,...d}){let[f,p]=(0,n.useState)(!1);async function m(){try{await navigator.clipboard.writeText(o),p(!0),setTimeout(()=>p(!1),s)}catch{}}return(0,r.jsx)(`button`,{type:`button`,onClick:m,"aria-label":c?void 0:f?`Copied to clipboard`:`Copy to clipboard`,className:e.t(`focus-ring inline-flex shrink-0 items-center justify-center whitespace-nowrap font-medium select-none border`,`transition-[color,background-color,border-color] duration-150`,f?`border-success/25 bg-success/10 text-success dark:text-emerald-400`:`border-border bg-muted text-muted-foreground hover:bg-surface-muted hover:text-foreground`,l===`sm`?`h-6 px-2 text-xs gap-1 rounded-[var(--radius-md)]`:`h-8 px-3 text-sm gap-1.5 rounded-[var(--radius-lg)]`,u),...d,children:(0,r.jsx)(t.AnimatePresence,{mode:`wait`,initial:!1,children:f?(0,r.jsxs)(t.motion.span,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},transition:{duration:.1},className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[(0,r.jsx)(a,{}),c&&`Copied`]},`check`):(0,r.jsxs)(t.motion.span,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},transition:{duration:.1},className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[(0,r.jsx)(i,{}),c&&c]},`copy`)})})}exports.CopyButton=o;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as e } from "../cn-
|
|
2
|
+
import { t as e } from "../cn-BJyZJP-y.js";
|
|
3
3
|
import { AnimatePresence as t, motion as n } from "framer-motion";
|
|
4
4
|
import { useState as r } from "react";
|
|
5
5
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
@@ -42,7 +42,8 @@ function c({ value: c, timeout: l = 2e3, label: u, size: d = "sm", className: f,
|
|
|
42
42
|
return /* @__PURE__ */ i("button", {
|
|
43
43
|
type: "button",
|
|
44
44
|
onClick: g,
|
|
45
|
-
|
|
45
|
+
"aria-label": u ? void 0 : m ? "Copied to clipboard" : "Copy to clipboard",
|
|
46
|
+
className: e("focus-ring inline-flex shrink-0 items-center justify-center whitespace-nowrap font-medium select-none border", "transition-[color,background-color,border-color] duration-150", m ? "border-success/25 bg-success/10 text-success dark:text-emerald-400" : "border-border bg-muted text-muted-foreground hover:bg-surface-muted hover:text-foreground", d === "sm" ? "h-6 px-2 text-xs gap-1 rounded-[var(--radius-md)]" : "h-8 px-3 text-sm gap-1.5 rounded-[var(--radius-lg)]", f),
|
|
46
47
|
...p,
|
|
47
48
|
children: /* @__PURE__ */ i(t, {
|
|
48
49
|
mode: "wait",
|
|
@@ -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"),n=require("react/jsx-runtime");var r={default:`text-foreground`,positive:`text-success`,negative:`text-destructive`,muted:`text-muted-foreground`},i={xs:`text-xs`,sm:`text-sm`,md:`text-base`,lg:`text-lg`,xl:`text-2xl`};function a(e){return typeof e==`bigint`?e<0n:e<0}function o(e){return typeof e==`bigint`||Number.isFinite(e)}function s(e,{currency:t=`USD`,locale:n=`en-US`,accounting:r=!1,options:i}={}){if(!o(e))return null;try{return new Intl.NumberFormat(n,{...i,style:`currency`,currency:t,currencySign:r?`accounting`:`standard`}).format(e)}catch{return null}}var c=(0,t.forwardRef)(({value:t,currency:o=`USD`,locale:c=`en-US`,accounting:l=!1,options:u,tone:d=`auto`,size:f=`md`,fallback:p=`—`,className:m,...h},g)=>{let _=s(t,{currency:o,locale:c,accounting:l,options:u}),v=d===`auto`?a(t)?`negative`:`default`:d,y=u?.notation===`compact`?s(t,{currency:o,locale:c,accounting:l,options:{...u,notation:`standard`}})??void 0:void 0;return(0,n.jsx)(`span`,{ref:g,"data-invalid":_===null||void 0,"aria-label":y,className:e.t(`inline whitespace-nowrap font-medium tabular-nums`,r[v],i[f],m),...h,children:_??p})});c.displayName=`Currency`,exports.Currency=c,exports.formatCurrency=s;
|
|
@@ -18,6 +18,10 @@ export interface DataTableProps<T extends {
|
|
|
18
18
|
emptyMessage?: string;
|
|
19
19
|
onRowClick?: (row: T) => void;
|
|
20
20
|
className?: string;
|
|
21
|
+
toolbarClassName?: string;
|
|
22
|
+
tableClassName?: string;
|
|
23
|
+
/** Removes the default table chrome while preserving its data behavior. */
|
|
24
|
+
unstyled?: boolean;
|
|
21
25
|
/** Show search bar. Pass column keys to search — defaults to all searchable columns */
|
|
22
26
|
searchable?: boolean;
|
|
23
27
|
searchPlaceholder?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../datatable-
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../datatable-t0U7t_xh.cjs");exports.DataTable=e.t;
|
|
@@ -2,8 +2,4 @@ import { DataTableProps } from './datatable/types';
|
|
|
2
2
|
export type { SortDir, ColumnDef, DataTableProps } from './datatable/types';
|
|
3
3
|
export declare function DataTable<T extends {
|
|
4
4
|
id: string | number;
|
|
5
|
-
}>({ columns, data, loading, emptyMessage, onRowClick, className, toolbarClassName, tableClassName, searchable, searchPlaceholder, pageSizeOptions, defaultPageSize, density, ariaLabel, getRowLabel, unstyled, }: DataTableProps<T>
|
|
6
|
-
toolbarClassName?: string;
|
|
7
|
-
tableClassName?: string;
|
|
8
|
-
unstyled?: boolean;
|
|
9
|
-
}): import("react").JSX.Element;
|
|
5
|
+
}>({ columns, data, loading, emptyMessage, onRowClick, className, toolbarClassName, tableClassName, searchable, searchPlaceholder, pageSizeOptions, defaultPageSize, density, ariaLabel, getRowLabel, unstyled, }: DataTableProps<T>): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-BdjraxxU.cjs"),t=require("../component-styles-DOUctc8_.cjs");let n=require("framer-motion"),r=require("react"),i=require("react/jsx-runtime");var a=[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],o=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`];function s(e){return`${o[e.getMonth()].slice(0,3)} ${e.getDate()}, ${e.getFullYear()}`}function c(e,t){return new Date(e,t+1,0).getDate()}function l(e,t){return new Date(e,t,1).getDay()}function u(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function d({value:d,onChange:f,label:p,hint:m,error:h,placeholder:g=`Select date…`,disabled:_,clearable:v=!0,minDate:y,maxDate:b,className:x}){let[S,C]=(0,r.useState)(null),w=d===void 0?S:d,T=new Date,[E,D]=(0,r.useState)(!1),[O,k]=(0,r.useState)((w??T).getFullYear()),[A,j]=(0,r.useState)((w??T).getMonth()),M=(0,r.useRef)(null),N=(0,r.useId)(),P=`${N}-message`;function F(e){d===void 0&&C(e),f?.(e),D(!1)}function I(e){e.stopPropagation(),d===void 0&&C(null),f?.(null)}function L(){A===0?(j(11),k(e=>e-1)):j(e=>e-1)}function R(){A===11?(j(0),k(e=>e+1)):j(e=>e+1)}(0,r.useEffect)(()=>{function e(e){M.current?.contains(e.target)||D(!1)}function t(e){e.key===`Escape`&&D(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[]);let z=c(O,A),B=l(O,A),V=[...Array(B).fill(null),...Array.from({length:z},(e,t)=>t+1)];return(0,i.jsxs)(`div`,{ref:M,className:e.t(`relative`,t.o,x),children:[p&&(0,i.jsx)(`label`,{htmlFor:N,className:`text-xs font-semibold leading-5 text-foreground`,children:p}),(0,i.jsxs)(`button`,{type:`button`,id:N,"aria-expanded":E,"aria-haspopup":`dialog`,"aria-invalid":h?!0:void 0,"aria-describedby":h||m?P:void 0,disabled:_,onClick:()=>D(e=>!e),className:e.t(`flex h-9 w-full items-center gap-2 rounded-[var(--radius-md)] px-3 text-left outline-none`,t.t,`focus:border-accent-500 focus:ring-2 focus:ring-focus-ring/20`,h&&`border-destructive/60 hover:border-destructive/70 focus-within:border-destructive focus-within:ring-destructive/20`,_&&`opacity-50 cursor-not-allowed`),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-500 shrink-0`,children:[(0,i.jsx)(`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,ry:`2`}),(0,i.jsx)(`line`,{x1:`16`,x2:`16`,y1:`2`,y2:`6`}),(0,i.jsx)(`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`6`}),(0,i.jsx)(`line`,{x1:`3`,x2:`21`,y1:`10`,y2:`10`})]}),(0,i.jsx)(`span`,{className:e.t(`flex-1 text-sm truncate`,w?`text-foreground`:`text-muted-foreground`),children:w?s(w):g}),v&&w&&!_&&(0,i.jsx)(`span`,{role:`button`,tabIndex:-1,onClick:I,className:`shrink-0 text-slate-500 hover:text-slate-700 dark:hover:text-slate-300 transition-colors`,children:(0,i.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,i.jsx)(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),(0,i.jsx)(n.AnimatePresence,{children:E&&(0,i.jsxs)(n.motion.div,{initial:{opacity:0,y:-4,scaleY:.97},animate:{opacity:1,y:0,scaleY:1},exit:{opacity:0,y:-4,scaleY:.97},transition:{duration:.13},style:{originY:0},role:`dialog`,"aria-label":`Choose date`,className:`absolute left-0 top-full z-50 mt-1.5 w-[min(18rem,calc(100vw-2rem))] rounded-[var(--radius-lg)] border border-border bg-surface-raised p-3 shadow-floating`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:L,"aria-label":`Previous month`,className:e.t(t.c,`size-7`),children:(0,i.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,i.jsx)(`path`,{d:`m15 18-6-6 6-6`})})}),(0,i.jsxs)(`span`,{"aria-live":`polite`,className:`text-sm font-semibold text-foreground`,children:[o[A],` `,O]}),(0,i.jsx)(`button`,{type:`button`,onClick:R,"aria-label":`Next month`,className:e.t(t.c,`size-7`),children:(0,i.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,i.jsx)(`path`,{d:`m9 18 6-6-6-6`})})})]}),(0,i.jsx)(`div`,{className:`grid grid-cols-7 gap-0.5 mb-1`,children:a.map(e=>(0,i.jsx)(`div`,{"aria-hidden":`true`,className:`text-center text-[10px] font-semibold text-muted-foreground py-1`,children:e},e))}),(0,i.jsx)(`div`,{className:`grid grid-cols-7 gap-0.5`,children:V.map((t,n)=>{if(!t)return(0,i.jsx)(`div`,{},`empty-${n}`);let r=new Date(O,A,t),a=w?u(r,w):!1,o=u(r,T),s=y&&r<y||b&&r>b;return(0,i.jsx)(`button`,{type:`button`,disabled:!!s,onClick:()=>F(r),"aria-label":r.toLocaleDateString(void 0,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`}),"aria-pressed":a,"aria-current":o?`date`:void 0,className:e.t(`h-8 w-full rounded-md text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/35`,a?`bg-primary text-primary-foreground font-medium`:o?`border border-accent-500/40 text-accent-400 hover:bg-accent-500/10`:`text-slate-700 dark:text-slate-200 hover:bg-black/6 dark:hover:bg-white/6`,s&&`opacity-30 cursor-not-allowed`),children:t},t)})})]})}),h&&(0,i.jsx)(`p`,{id:P,"aria-live":`polite`,className:`text-xs leading-5 text-destructive`,children:h}),m&&!h&&(0,i.jsx)(`p`,{id:P,className:`text-xs leading-5 text-muted-foreground`,children:m})]})}exports.DatePicker=d;
|
|
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=[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],o=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`];function s(e){return`${o[e.getMonth()].slice(0,3)} ${e.getDate()}, ${e.getFullYear()}`}function c(e,t){return new Date(e,t+1,0).getDate()}function l(e,t){return new Date(e,t,1).getDay()}function u(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function d(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}var f=(0,r.forwardRef)(({value:f,onChange:p,label:m,hint:h,error:g,placeholder:_=`Select date…`,disabled:v,clearable:y=!0,minDate:b,maxDate:x,className:S,...C},w)=>{let[T,E]=(0,r.useState)(null),D=f===void 0?T:f,O=new Date,[k,A]=(0,r.useState)(!1),[j,M]=(0,r.useState)((D??O).getFullYear()),[N,P]=(0,r.useState)((D??O).getMonth()),[F,I]=(0,r.useState)(D??O),[L,R]=(0,r.useState)({visibility:`hidden`}),z=(0,r.useRef)(null),B=(0,r.useRef)(null),V=(0,r.useRef)(null);(0,r.useImperativeHandle)(w,()=>z.current);let H=(0,r.useId)(),U=`${H}-dialog`,W=`${H}-message`;function G(e){return!!(b&&e<b||x&&e>x)}function K(e){if(G(e))return;let t=e.getFullYear()===j&&e.getMonth()===N;if(I(e),M(e.getFullYear()),P(e.getMonth()),t){V.current?.querySelector(`[data-date="${d(e)}"]`)?.focus({preventScroll:!0});return}requestAnimationFrame(()=>requestAnimationFrame(()=>{V.current?.querySelector(`[data-date="${d(e)}"]`)?.focus({preventScroll:!0})}))}function q(){return D&&!G(D)?D:G(O)?b&&(!x||b<=x)?b:x??O:O}function J(){let e=q();I(e),M(e.getFullYear()),P(e.getMonth()),R({visibility:`hidden`}),A(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>{V.current?.querySelector(`[data-date="${d(e)}"]`)?.focus({preventScroll:!0})}))}function Y(e=!1){A(!1),e&&requestAnimationFrame(()=>B.current?.focus())}function X(e){f===void 0&&E(e),p?.(e),Y(!0)}function Z(){f===void 0&&E(null),p?.(null)}function Q(e,t){let n=new Date(e,t,1),r=new Date(e,t+1,0,23,59,59,999);return!(b&&b>r)&&!(x&&x<n)}function $(e){let t=new Date(j,N+e,1),n=t.getFullYear(),r=t.getMonth();if(!Q(n,r))return;let i=new Date(n,r,Math.min(F.getDate(),c(n,r)));b&&i<b&&b.getFullYear()===n&&b.getMonth()===r&&(i=new Date(n,r,b.getDate())),x&&i>x&&x.getFullYear()===n&&x.getMonth()===r&&(i=new Date(n,r,x.getDate())),M(n),P(r),I(i)}(0,r.useEffect)(()=>{function e(e){z.current?.contains(e.target)||Y()}function t(e){e.key===`Escape`&&k&&(e.preventDefault(),Y(!0))}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[k]),(0,r.useLayoutEffect)(()=>{if(!k)return;let e=()=>{let e=B.current,t=V.current;if(!e||!t)return;let n=t.getBoundingClientRect();if(window.innerWidth<640){R({insetInline:8,bottom:8,top:`auto`,width:`auto`,visibility:`visible`});return}let r=e.getBoundingClientRect(),i=Math.min(Math.max(r.left,16),Math.max(16,window.innerWidth-n.width-16)),a=r.bottom+6,o=r.top-n.height-6,s=a+n.height<=window.innerHeight-16||o<16?a:o;R({left:i,top:Math.min(Math.max(s,16),Math.max(16,window.innerHeight-n.height-16)),visibility:`visible`})};return e(),window.addEventListener(`resize`,e),document.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),document.removeEventListener(`scroll`,e,!0)}},[k]),(0,r.useEffect)(()=>{if(!k||window.innerWidth>=640)return;let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[k]);function ee(e,t){let n;e.key===`ArrowLeft`?n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-1):e.key===`ArrowRight`?n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+1):e.key===`ArrowUp`?n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-7):e.key===`ArrowDown`?n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+7):e.key===`Home`?n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-t.getDay()):e.key===`End`?n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+(6-t.getDay())):e.key===`PageUp`?n=new Date(t.getFullYear(),t.getMonth()-1,Math.min(t.getDate(),c(t.getFullYear(),t.getMonth()-1))):e.key===`PageDown`&&(n=new Date(t.getFullYear(),t.getMonth()+1,Math.min(t.getDate(),c(t.getFullYear(),t.getMonth()+1)))),n&&(e.preventDefault(),K(n))}let te=c(j,N),ne=l(j,N),re=[...Array(ne).fill(null),...Array.from({length:te},(e,t)=>t+1)];return(0,i.jsxs)(`div`,{ref:z,className:e.t(`relative`,t.o,S),...C,children:[m&&(0,i.jsx)(`label`,{htmlFor:H,className:`text-xs font-semibold leading-5 text-foreground`,children:m}),(0,i.jsxs)(`div`,{className:e.t(`flex h-11 w-full items-center rounded-[var(--radius-md)] sm:h-9`,t.t,g&&`border-destructive/60 hover:border-destructive/70 focus-within:border-destructive focus-within:ring-destructive/25`,v&&`cursor-not-allowed opacity-50`),children:[(0,i.jsxs)(`button`,{ref:B,type:`button`,id:H,"aria-expanded":k,"aria-haspopup":`dialog`,"aria-controls":U,"aria-invalid":g?!0:void 0,"aria-describedby":g||h?W:void 0,disabled:v,onClick:()=>k?Y():J(),className:`flex h-full min-w-0 flex-1 items-center gap-2 rounded-[var(--radius-md)] px-3 text-left outline-none focus-visible:ring-[3px] focus-visible:ring-focus-ring/35`,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-500 shrink-0`,children:[(0,i.jsx)(`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,ry:`2`}),(0,i.jsx)(`line`,{x1:`16`,x2:`16`,y1:`2`,y2:`6`}),(0,i.jsx)(`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`6`}),(0,i.jsx)(`line`,{x1:`3`,x2:`21`,y1:`10`,y2:`10`})]}),(0,i.jsx)(`span`,{className:e.t(`flex-1 text-sm truncate`,D?`text-foreground`:`text-muted-foreground`),children:D?s(D):_})]}),y&&D&&!v&&(0,i.jsx)(`button`,{type:`button`,"aria-label":`Clear ${m?.toLowerCase()??`date`}`,onClick:Z,className:e.t(t.c,`mr-1 size-9 sm:size-7`),children:(0,i.jsx)(`svg`,{"aria-hidden":`true`,width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,i.jsx)(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),(0,i.jsx)(n.AnimatePresence,{children:k&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.motion.div,{"aria-hidden":`true`,className:`fixed inset-0 z-40 bg-overlay sm:hidden`,onMouseDown:()=>Y(!0),initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}),(0,i.jsxs)(n.motion.div,{ref:V,id:U,initial:{opacity:0,y:-4,scaleY:.97},animate:{opacity:1,y:0,scaleY:1},exit:{opacity:0,y:-4,scaleY:.97},transition:{duration:.13},role:`dialog`,"aria-label":m?`Choose ${m.toLowerCase()}`:`Choose date`,className:`fixed z-50 w-[min(18rem,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`,style:{...L,originY:0},children:[(0,i.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3 sm:hidden`,children:[(0,i.jsx)(`strong`,{className:`text-sm text-foreground`,children:m?`Choose ${m.toLowerCase()}`:`Choose date`}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>Y(!0),className:e.t(t.c,`size-11`),"aria-label":`Close date picker`,children:(0,i.jsx)(`svg`,{"aria-hidden":`true`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,i.jsx)(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),(0,i.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:()=>$(-1),disabled:!Q(new Date(j,N-1,1).getFullYear(),new Date(j,N-1,1).getMonth()),"aria-label":`Previous month`,className:e.t(t.c,`size-11 disabled:cursor-not-allowed disabled:opacity-35 sm:size-7`),children:(0,i.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,i.jsx)(`path`,{d:`m15 18-6-6 6-6`})})}),(0,i.jsxs)(`span`,{"aria-live":`polite`,className:`text-sm font-semibold text-foreground`,children:[o[N],` `,j]}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>$(1),disabled:!Q(new Date(j,N+1,1).getFullYear(),new Date(j,N+1,1).getMonth()),"aria-label":`Next month`,className:e.t(t.c,`size-11 disabled:cursor-not-allowed disabled:opacity-35 sm:size-7`),children:(0,i.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,i.jsx)(`path`,{d:`m9 18 6-6-6-6`})})})]}),(0,i.jsx)(`div`,{className:`grid grid-cols-7 gap-0.5 mb-1`,children:a.map(e=>(0,i.jsx)(`div`,{"aria-hidden":`true`,className:`py-1 text-center text-[10px] font-semibold text-muted-foreground`,children:e},e))}),(0,i.jsx)(`div`,{className:`grid grid-cols-7 gap-0.5`,children:re.map((t,n)=>{if(!t)return(0,i.jsx)(`div`,{},`empty-${n}`);let r=new Date(j,N,t),a=D?u(r,D):!1,o=u(r,O),s=G(r);return(0,i.jsx)(`button`,{type:`button`,disabled:!!s,onClick:()=>X(r),onFocus:()=>I(r),onKeyDown:e=>ee(e,r),"data-date":d(r),tabIndex:u(r,F)?0:-1,"aria-label":r.toLocaleDateString(void 0,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`}),"aria-pressed":a,"aria-current":o?`date`:void 0,className:e.t(`h-11 w-full rounded-md text-sm transition-colors focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-focus-ring/35 sm:h-8`,a?`bg-primary text-primary-foreground font-medium`:o?`border border-accent-500/40 text-accent-400 hover:bg-accent-500/10`:`text-slate-700 dark:text-slate-200 hover:bg-black/6 dark:hover:bg-white/6`,s&&`opacity-30 cursor-not-allowed`),children:t},t)})}),(0,i.jsxs)(`div`,{className:e.t(`mt-3 flex items-center border-t border-border pt-3`,G(O)?`justify-end`:`justify-between`),children:[!G(O)&&(0,i.jsx)(`button`,{type:`button`,onClick:()=>K(O),className:`h-11 rounded-md px-3 text-xs font-medium text-accent-700 hover:bg-muted focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-focus-ring/35 sm:h-10 dark:text-accent-300`,children:`Today`}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>Y(!0),className:`h-11 rounded-md px-3 text-xs font-medium text-muted-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-focus-ring/35 sm:h-10`,children:`Cancel`})]})]})]})}),g&&(0,i.jsx)(`p`,{id:W,"aria-live":`polite`,className:`text-xs leading-5 text-destructive`,children:g}),h&&!g&&(0,i.jsx)(`p`,{id:W,className:`text-xs leading-5 text-muted-foreground`,children:h})]})});f.displayName=`DatePicker`,exports.DatePicker=f;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export interface DatePickerProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
2
3
|
value?: Date | null;
|
|
3
4
|
onChange?: (date: Date | null) => void;
|
|
4
5
|
label?: string;
|
|
@@ -9,6 +10,5 @@ export interface DatePickerProps {
|
|
|
9
10
|
clearable?: boolean;
|
|
10
11
|
minDate?: Date;
|
|
11
12
|
maxDate?: Date;
|
|
12
|
-
className?: string;
|
|
13
13
|
}
|
|
14
|
-
export declare
|
|
14
|
+
export declare const DatePicker: import('react').ForwardRefExoticComponent<DatePickerProps & import('react').RefAttributes<HTMLDivElement>>;
|