@bzync/rui 0.0.4 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/autocomplete-D6z5B-WU.cjs +1 -0
- package/dist/{autocomplete-BgKbj6M4.js → autocomplete-bgySuP8X.js} +149 -142
- package/dist/calendar-CQumLNgS.cjs +1 -0
- package/dist/{calendar-j2_zvum1.js → calendar-nkYCMEy3.js} +9 -9
- package/dist/charts-Cot5lCgC.cjs +1 -0
- package/dist/{charts-CxEy2c3M.js → charts-Dscl6UC3.js} +122 -145
- package/dist/cn-B6R3HKzx.cjs +1 -0
- package/dist/{cn-DpgY2leY.js → cn-BJyZJP-y.js} +389 -389
- package/dist/{component-styles-Bgy44fc8.js → component-styles-C2CbHEEA.js} +2 -2
- package/dist/component-styles-DY4wigiq.cjs +1 -0
- package/dist/components/accordion.cjs +1 -1
- package/dist/components/accordion.js +2 -2
- package/dist/components/alert.cjs +1 -1
- package/dist/components/alert.js +3 -3
- package/dist/components/aspect-ratio.cjs +1 -0
- package/dist/components/aspect-ratio.d.ts +5 -0
- package/dist/components/aspect-ratio.js +20 -0
- package/dist/components/auth-backdrop.cjs +1 -1
- package/dist/components/auth-backdrop.d.ts +4 -1
- package/dist/components/auth-backdrop.js +12 -8
- package/dist/components/autocomplete/dropdown.d.ts +4 -1
- package/dist/components/autocomplete/multi-trigger.d.ts +3 -1
- package/dist/components/autocomplete/single-trigger.d.ts +3 -1
- package/dist/components/autocomplete/types.d.ts +15 -0
- package/dist/components/autocomplete.cjs +1 -1
- package/dist/components/autocomplete.js +1 -1
- package/dist/components/avatar-group.cjs +1 -0
- package/dist/components/avatar-group.d.ts +14 -0
- package/dist/components/avatar-group.js +35 -0
- package/dist/components/avatar.cjs +1 -1
- package/dist/components/avatar.js +2 -2
- package/dist/components/badge.cjs +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/billing-interval-toggle.cjs +1 -1
- package/dist/components/billing-interval-toggle.d.ts +4 -6
- package/dist/components/billing-interval-toggle.js +26 -19
- package/dist/components/blockquote.cjs +1 -0
- package/dist/components/blockquote.d.ts +10 -0
- package/dist/components/blockquote.js +32 -0
- package/dist/components/breadcrumb.cjs +1 -1
- package/dist/components/breadcrumb.js +2 -2
- package/dist/components/button-group.cjs +1 -0
- package/dist/components/button-group.d.ts +7 -0
- package/dist/components/button-group.js +26 -0
- package/dist/components/button.cjs +1 -1
- package/dist/components/button.d.ts +2 -0
- package/dist/components/button.js +79 -36
- package/dist/components/calendar.cjs +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/callout.cjs +1 -1
- package/dist/components/callout.js +14 -14
- package/dist/components/card.cjs +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/charts/shared.d.ts +15 -0
- package/dist/components/charts.cjs +1 -1
- package/dist/components/charts.js +1 -1
- package/dist/components/checkbox.cjs +1 -1
- package/dist/components/checkbox.js +3 -3
- package/dist/components/code.cjs +3 -3
- package/dist/components/code.d.ts +4 -4
- package/dist/components/code.js +62 -60
- package/dist/components/command.cjs +1 -1
- package/dist/components/command.d.ts +8 -1
- package/dist/components/command.js +84 -83
- package/dist/components/confirm-dialog.cjs +1 -1
- package/dist/components/confirm-dialog.d.ts +8 -1
- package/dist/components/confirm-dialog.js +37 -31
- package/dist/components/copy-button.cjs +1 -1
- package/dist/components/copy-button.js +5 -4
- package/dist/components/currency.cjs +1 -0
- package/dist/components/currency.d.ts +18 -0
- package/dist/components/currency.js +62 -0
- package/dist/components/datatable/types.d.ts +4 -0
- package/dist/components/datatable.cjs +1 -1
- package/dist/components/datatable.d.ts +1 -5
- package/dist/components/datatable.js +1 -1
- package/dist/components/datepicker.cjs +1 -1
- package/dist/components/datepicker.d.ts +3 -3
- package/dist/components/datepicker.js +234 -105
- package/dist/components/description-list.cjs +1 -0
- package/dist/components/description-list.d.ts +14 -0
- package/dist/components/description-list.js +38 -0
- package/dist/components/divider.cjs +1 -0
- package/dist/components/divider.d.ts +12 -0
- package/dist/components/divider.js +45 -0
- package/dist/components/drawer.cjs +1 -1
- package/dist/components/drawer.d.ts +6 -1
- package/dist/components/drawer.js +128 -2
- package/dist/components/dropdown-menu-panel.cjs +1 -0
- package/dist/components/dropdown-menu-panel.d.ts +24 -0
- package/dist/components/dropdown-menu-panel.js +84 -0
- package/dist/components/dropdown-menu.cjs +1 -1
- package/dist/components/dropdown-menu.d.ts +5 -1
- package/dist/components/dropdown-menu.js +38 -93
- package/dist/components/empty-state.cjs +1 -1
- package/dist/components/empty-state.d.ts +5 -1
- package/dist/components/empty-state.js +9 -9
- package/dist/components/error-state.cjs +1 -1
- package/dist/components/error-state.js +2 -2
- package/dist/components/file-upload.cjs +1 -1
- package/dist/components/file-upload.js +4 -4
- package/dist/components/form-field.cjs +1 -1
- package/dist/components/form-field.d.ts +9 -0
- package/dist/components/form-field.js +49 -14
- package/dist/components/info-button.cjs +1 -1
- package/dist/components/info-button.d.ts +5 -3
- package/dist/components/info-button.js +33 -29
- package/dist/components/input.cjs +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/kbd.cjs +1 -1
- package/dist/components/kbd.js +1 -1
- package/dist/components/label.cjs +1 -1
- package/dist/components/label.js +2 -2
- package/dist/components/layout.cjs +1 -1
- package/dist/components/layout.js +1 -1
- package/dist/components/link.cjs +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/list.cjs +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/modal.cjs +1 -1
- package/dist/components/modal.d.ts +8 -1
- package/dist/components/modal.js +74 -120
- package/dist/components/navigation.cjs +1 -1
- package/dist/components/navigation.js +2 -2
- package/dist/components/number-input.cjs +1 -1
- package/dist/components/number-input.js +3 -3
- package/dist/components/otp-input.cjs +1 -1
- package/dist/components/otp-input.js +2 -2
- package/dist/components/overlay.cjs +1 -0
- package/dist/components/overlay.d.ts +52 -0
- package/dist/components/overlay.js +87 -0
- package/dist/components/pagination.cjs +1 -1
- package/dist/components/pagination.js +2 -2
- package/dist/components/popover.cjs +1 -1
- package/dist/components/popover.d.ts +2 -1
- package/dist/components/popover.js +41 -40
- package/dist/components/progressbar.cjs +1 -1
- package/dist/components/progressbar.js +1 -1
- package/dist/components/radio.cjs +1 -1
- package/dist/components/radio.js +3 -3
- package/dist/components/rating.cjs +1 -0
- package/dist/components/rating.d.ts +15 -0
- package/dist/components/rating.js +75 -0
- package/dist/components/richtext.cjs +1 -1
- package/dist/components/richtext.js +2 -2
- package/dist/components/scroll-area.cjs +1 -0
- package/dist/components/scroll-area.d.ts +8 -0
- package/dist/components/scroll-area.js +19 -0
- package/dist/components/select/option-list.d.ts +3 -1
- package/dist/components/select/types.d.ts +4 -0
- package/dist/components/select.cjs +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/seo.cjs +1 -1
- package/dist/components/seo.js +1 -1
- package/dist/components/separator.cjs +1 -1
- package/dist/components/separator.js +1 -1
- package/dist/components/skeleton.cjs +1 -1
- package/dist/components/skeleton.d.ts +14 -1
- package/dist/components/skeleton.js +56 -4
- package/dist/components/slider.cjs +1 -1
- package/dist/components/slider.js +2 -2
- package/dist/components/slot.cjs +1 -0
- package/dist/components/slot.d.ts +12 -0
- package/dist/components/slot.js +16 -0
- package/dist/components/snackbar-viewport.cjs +1 -0
- package/dist/components/snackbar-viewport.d.ts +27 -0
- package/dist/components/snackbar-viewport.js +181 -0
- package/dist/components/snackbar.cjs +1 -1
- package/dist/components/snackbar.d.ts +5 -1
- package/dist/components/snackbar.js +36 -200
- package/dist/components/spinner.cjs +1 -1
- package/dist/components/spinner.js +1 -1
- package/dist/components/stat.cjs +1 -1
- package/dist/components/stat.js +1 -1
- package/dist/components/status-dot.cjs +1 -1
- package/dist/components/status-dot.js +1 -1
- package/dist/components/stepper.cjs +1 -1
- package/dist/components/stepper.js +5 -5
- package/dist/components/switch.cjs +1 -1
- package/dist/components/switch.js +37 -43
- package/dist/components/table.cjs +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.cjs +1 -1
- package/dist/components/tabs.d.ts +6 -4
- package/dist/components/tabs.js +51 -81
- package/dist/components/tag.cjs +1 -1
- package/dist/components/tag.js +1 -1
- package/dist/components/terminal.cjs +1 -1
- package/dist/components/terminal.js +1 -1
- package/dist/components/textarea.cjs +1 -1
- package/dist/components/textarea.js +3 -3
- package/dist/components/theme-provider.cjs +1 -1
- package/dist/components/theme-provider.js +1 -1
- package/dist/components/theme-toggle.cjs +1 -1
- package/dist/components/theme-toggle.js +27 -3
- package/dist/components/time-picker.cjs +1 -0
- package/dist/components/time-picker.d.ts +31 -0
- package/dist/components/time-picker.js +394 -0
- package/dist/components/timeline.cjs +1 -1
- package/dist/components/timeline.js +1 -1
- package/dist/components/toggle.cjs +1 -0
- package/dist/components/toggle.d.ts +42 -0
- package/dist/components/toggle.js +116 -0
- package/dist/components/tooltip.cjs +1 -1
- package/dist/components/tooltip.d.ts +2 -1
- package/dist/components/tooltip.js +37 -36
- package/dist/components/tree.cjs +1 -1
- package/dist/components/tree.js +1 -1
- package/dist/components/typography.cjs +1 -0
- package/dist/components/typography.d.ts +50 -0
- package/dist/components/typography.js +202 -0
- package/dist/components/visually-hidden.cjs +1 -0
- package/dist/components/visually-hidden.d.ts +16 -0
- package/dist/components/visually-hidden.js +13 -0
- package/dist/{datatable-yBN4M3UV.js → datatable-BJoZMrKI.js} +6 -6
- package/dist/datatable-t0U7t_xh.cjs +1 -0
- package/dist/icons-Dfetr1L2.cjs +1 -0
- package/dist/icons-Dk7VZ4Ph.js +51 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.js +125 -86
- package/dist/lib/cn.d.ts +13 -1
- package/dist/lib/component-styles.d.ts +14 -2
- package/dist/lib/icons.d.ts +12 -0
- package/dist/lib/motion.d.ts +58 -0
- package/dist/motion-B2shivEB.cjs +1 -0
- package/dist/motion-gnRzFS5f.js +62 -0
- package/dist/select-ByjnuEcE.cjs +1 -0
- package/dist/{select-ClWrcj3R.js → select-CiMzLhUK.js} +128 -122
- package/dist/styles.css +1 -1
- package/dist/{terminal-CpraMs50.cjs → terminal-1U0ftG3i.cjs} +2 -2
- package/dist/{terminal-BOR2cFi1.js → terminal-VXdxVoAv.js} +4 -4
- package/dist/use-focus-trap-CPLT49gN.cjs +1 -0
- package/dist/use-focus-trap-CS6BXJAB.js +77 -0
- package/dist/{utils-CQ8pvCtk.js → utils-DEw5mQrH.js} +1 -1
- package/dist/{utils-DOFJTw8o.cjs → utils-MnnCTelh.cjs} +1 -1
- package/package.json +56 -9
- package/dist/autocomplete-Bk4pRQ2R.cjs +0 -1
- package/dist/calendar-CUXpVrVE.cjs +0 -1
- package/dist/charts-UDqS1BH1.cjs +0 -1
- package/dist/cn-BdjraxxU.cjs +0 -1
- package/dist/component-styles-DOUctc8_.cjs +0 -1
- package/dist/createLucideIcon-DDY8HuQR.js +0 -42
- package/dist/createLucideIcon-b_X_3fj-.cjs +0 -1
- package/dist/datatable-rzDgQ3r6.cjs +0 -1
- package/dist/drawer-CTeBsYrO.cjs +0 -1
- package/dist/drawer-ixuzyLVS.js +0 -189
- package/dist/select-BFwx--uK.cjs +0 -1
- package/dist/theme-toggle-Bb0BYo51.js +0 -71
- package/dist/theme-toggle-Cld8tktJ.cjs +0 -1
|
@@ -1,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",
|
|
@@ -61,7 +62,7 @@ function c({ value: c, timeout: l = 2e3, label: u, size: d = "sm", className: f,
|
|
|
61
62
|
opacity: 0
|
|
62
63
|
},
|
|
63
64
|
transition: { duration: .1 },
|
|
64
|
-
className: "flex items-center gap-1",
|
|
65
|
+
className: "inline-flex items-center gap-1 whitespace-nowrap",
|
|
65
66
|
children: [/* @__PURE__ */ i(s, {}), u && "Copied"]
|
|
66
67
|
}, "check") : /* @__PURE__ */ a(n.span, {
|
|
67
68
|
initial: {
|
|
@@ -77,7 +78,7 @@ function c({ value: c, timeout: l = 2e3, label: u, size: d = "sm", className: f,
|
|
|
77
78
|
opacity: 0
|
|
78
79
|
},
|
|
79
80
|
transition: { duration: .1 },
|
|
80
|
-
className: "flex items-center gap-1",
|
|
81
|
+
className: "inline-flex items-center gap-1 whitespace-nowrap",
|
|
81
82
|
children: [/* @__PURE__ */ i(o, {}), u && u]
|
|
82
83
|
}, "copy")
|
|
83
84
|
})
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type CurrencyTone = "auto" | "default" | "positive" | "negative" | "muted";
|
|
3
|
+
export type CurrencySize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
4
|
+
export type CurrencyFormatOptions = Omit<Intl.NumberFormatOptions, "style" | "currency" | "currencySign">;
|
|
5
|
+
export interface FormatCurrencyOptions {
|
|
6
|
+
currency?: string;
|
|
7
|
+
locale?: Intl.LocalesArgument;
|
|
8
|
+
accounting?: boolean;
|
|
9
|
+
options?: CurrencyFormatOptions;
|
|
10
|
+
}
|
|
11
|
+
export declare function formatCurrency(value: number | bigint, { currency, locale, accounting, options, }?: FormatCurrencyOptions): string | null;
|
|
12
|
+
export interface CurrencyProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children">, FormatCurrencyOptions {
|
|
13
|
+
value: number | bigint;
|
|
14
|
+
tone?: CurrencyTone;
|
|
15
|
+
size?: CurrencySize;
|
|
16
|
+
fallback?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
export declare const Currency: import('react').ForwardRefExoticComponent<CurrencyProps & import('react').RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { t as e } from "../cn-BJyZJP-y.js";
|
|
2
|
+
import { forwardRef as t } from "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/currency.tsx
|
|
5
|
+
var r = {
|
|
6
|
+
default: "text-foreground",
|
|
7
|
+
positive: "text-success",
|
|
8
|
+
negative: "text-destructive",
|
|
9
|
+
muted: "text-muted-foreground"
|
|
10
|
+
}, i = {
|
|
11
|
+
xs: "text-xs",
|
|
12
|
+
sm: "text-sm",
|
|
13
|
+
md: "text-base",
|
|
14
|
+
lg: "text-lg",
|
|
15
|
+
xl: "text-2xl"
|
|
16
|
+
};
|
|
17
|
+
function a(e) {
|
|
18
|
+
return typeof e == "bigint" ? e < 0n : e < 0;
|
|
19
|
+
}
|
|
20
|
+
function o(e) {
|
|
21
|
+
return typeof e == "bigint" || Number.isFinite(e);
|
|
22
|
+
}
|
|
23
|
+
function s(e, { currency: t = "USD", locale: n = "en-US", accounting: r = !1, options: i } = {}) {
|
|
24
|
+
if (!o(e)) return null;
|
|
25
|
+
try {
|
|
26
|
+
return new Intl.NumberFormat(n, {
|
|
27
|
+
...i,
|
|
28
|
+
style: "currency",
|
|
29
|
+
currency: t,
|
|
30
|
+
currencySign: r ? "accounting" : "standard"
|
|
31
|
+
}).format(e);
|
|
32
|
+
} catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
var c = t(({ 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) => {
|
|
37
|
+
let _ = s(t, {
|
|
38
|
+
currency: o,
|
|
39
|
+
locale: c,
|
|
40
|
+
accounting: l,
|
|
41
|
+
options: u
|
|
42
|
+
}), v = d === "auto" ? a(t) ? "negative" : "default" : d, y = u?.notation === "compact" ? s(t, {
|
|
43
|
+
currency: o,
|
|
44
|
+
locale: c,
|
|
45
|
+
accounting: l,
|
|
46
|
+
options: {
|
|
47
|
+
...u,
|
|
48
|
+
notation: "standard"
|
|
49
|
+
}
|
|
50
|
+
}) ?? void 0 : void 0;
|
|
51
|
+
return /* @__PURE__ */ n("span", {
|
|
52
|
+
ref: g,
|
|
53
|
+
"data-invalid": _ === null || void 0,
|
|
54
|
+
"aria-label": y,
|
|
55
|
+
className: e("inline whitespace-nowrap font-medium tabular-nums", r[v], i[f], m),
|
|
56
|
+
...h,
|
|
57
|
+
children: _ ?? p
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
c.displayName = "Currency";
|
|
61
|
+
//#endregion
|
|
62
|
+
export { c as Currency, s as formatCurrency };
|
|
@@ -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>>;
|