@devalok/shilp-sutra 0.30.0 → 0.32.0
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 +82 -239
- package/dist/_chunks/badge-group.js +123 -171
- package/dist/_chunks/document-preview.js +92 -0
- package/dist/_chunks/file-preview.js +511 -0
- package/dist/_chunks/image-preview.js +90 -0
- package/dist/_chunks/primitives.js +109 -109
- package/dist/_chunks/stat-row.js +144 -124
- package/dist/_chunks/use-calendar.js +558 -490
- package/dist/ai/block-renderer.d.ts +2 -1
- package/dist/ai/block-renderer.d.ts.map +1 -1
- package/dist/ai/block-renderer.js +30 -29
- package/dist/ai/blocks/block-table.d.ts.map +1 -1
- package/dist/ai/blocks/confirm.d.ts.map +1 -1
- package/dist/ai/blocks/divider.d.ts.map +1 -1
- package/dist/ai/blocks/error.d.ts.map +1 -1
- package/dist/ai/blocks/info.d.ts.map +1 -1
- package/dist/ai/blocks/loading.d.ts.map +1 -1
- package/dist/ai/blocks/stat-row.d.ts.map +1 -1
- package/dist/ai/blocks/success.d.ts.map +1 -1
- package/dist/ai/blocks/text.d.ts.map +1 -1
- package/dist/ai/command-bar.d.ts +18 -0
- package/dist/ai/command-bar.d.ts.map +1 -1
- package/dist/ai/command-bar.js +126 -125
- package/dist/ai/conversation.d.ts +13 -1
- package/dist/ai/conversation.d.ts.map +1 -1
- package/dist/ai/conversation.js +78 -78
- package/dist/ai/types.d.ts +0 -1
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/types.js +1 -0
- package/dist/composed/bulk-action-bar.d.ts +6 -4
- package/dist/composed/bulk-action-bar.d.ts.map +1 -1
- package/dist/composed/bulk-action-bar.js +102 -58
- package/dist/composed/command-palette.d.ts +9 -0
- package/dist/composed/command-palette.d.ts.map +1 -1
- package/dist/composed/command-palette.js +68 -68
- package/dist/composed/confirm-dialog.d.ts +1 -1
- package/dist/composed/confirm-dialog.d.ts.map +1 -1
- package/dist/composed/confirm-dialog.js +10 -10
- package/dist/composed/content-card.d.ts.map +1 -1
- package/dist/composed/date-picker/date-picker.d.ts +11 -1
- package/dist/composed/date-picker/date-picker.d.ts.map +1 -1
- package/dist/composed/date-picker/month-picker.d.ts.map +1 -1
- package/dist/composed/date-picker/year-picker.d.ts.map +1 -1
- package/dist/composed/deadline-indicator.d.ts +1 -1
- package/dist/composed/deadline-indicator.d.ts.map +1 -1
- package/dist/composed/deadline-indicator.js +39 -36
- package/dist/composed/emoji-picker.d.ts +6 -0
- package/dist/composed/emoji-picker.d.ts.map +1 -1
- package/dist/composed/emoji-picker.js +22 -20
- package/dist/composed/error-boundary.d.ts +21 -1
- package/dist/composed/error-boundary.d.ts.map +1 -1
- package/dist/composed/error-boundary.js +47 -32
- package/dist/composed/file-preview/audio-preview.d.ts +7 -0
- package/dist/composed/file-preview/audio-preview.d.ts.map +1 -0
- package/dist/composed/file-preview/document-preview.d.ts +7 -0
- package/dist/composed/file-preview/document-preview.d.ts.map +1 -0
- package/dist/composed/file-preview/embed-preview.d.ts +7 -0
- package/dist/composed/file-preview/embed-preview.d.ts.map +1 -0
- package/dist/composed/file-preview/image-preview.d.ts +7 -0
- package/dist/composed/file-preview/image-preview.d.ts.map +1 -0
- package/dist/composed/file-preview/shared.d.ts +20 -0
- package/dist/composed/file-preview/shared.d.ts.map +1 -0
- package/dist/composed/file-preview/video-preview.d.ts +6 -0
- package/dist/composed/file-preview/video-preview.d.ts.map +1 -0
- package/dist/composed/file-preview.d.ts.map +1 -1
- package/dist/composed/file-preview.js +10 -662
- package/dist/composed/filter-bar.d.ts +10 -2
- package/dist/composed/filter-bar.d.ts.map +1 -1
- package/dist/composed/filter-bar.js +42 -43
- package/dist/composed/form-section.d.ts +1 -1
- package/dist/composed/form-section.d.ts.map +1 -1
- package/dist/composed/form-section.js +22 -21
- package/dist/composed/index.d.ts +2 -2
- package/dist/composed/index.d.ts.map +1 -1
- package/dist/composed/index.js +58 -57
- package/dist/composed/inline-edit.d.ts +1 -1
- package/dist/composed/inline-edit.d.ts.map +1 -1
- package/dist/composed/inline-edit.js +33 -32
- package/dist/composed/lib/string-utils.d.ts.map +1 -1
- package/dist/composed/loading-skeleton.d.ts.map +1 -1
- package/dist/composed/markdown-viewer.d.ts +1 -1
- package/dist/composed/markdown-viewer.d.ts.map +1 -1
- package/dist/composed/markdown-viewer.js +60 -59
- package/dist/composed/master-detail.d.ts +11 -7
- package/dist/composed/master-detail.d.ts.map +1 -1
- package/dist/composed/master-detail.js +123 -84
- package/dist/composed/page-header.d.ts.map +1 -1
- package/dist/composed/page-skeletons.d.ts.map +1 -1
- package/dist/composed/priority-indicator.d.ts +1 -0
- package/dist/composed/priority-indicator.js +1 -0
- package/dist/composed/responsive-overlay.d.ts +8 -0
- package/dist/composed/responsive-overlay.d.ts.map +1 -1
- package/dist/composed/rich-text-editor.d.ts +11 -3
- package/dist/composed/rich-text-editor.d.ts.map +1 -1
- package/dist/composed/rich-text-editor.js +21 -20
- package/dist/composed/schedule-view.d.ts +9 -1
- package/dist/composed/schedule-view.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +8 -4
- package/dist/hooks/use-touch-device.d.ts +12 -0
- package/dist/hooks/use-touch-device.d.ts.map +1 -0
- package/dist/hooks/use-touch-device.js +13 -0
- package/dist/hooks/use-viewport-height.d.ts +11 -0
- package/dist/hooks/use-viewport-height.d.ts.map +1 -0
- package/dist/hooks/use-viewport-height.js +16 -0
- package/dist/shell/bottom-navbar.d.ts.map +1 -1
- package/dist/shell/bottom-navbar.js +72 -63
- package/dist/shell/command-registry.d.ts.map +1 -1
- package/dist/shell/notification-center.d.ts.map +1 -1
- package/dist/shell/notification-center.js +77 -77
- package/dist/shell/top-bar.d.ts +2 -2
- package/dist/shell/top-bar.d.ts.map +1 -1
- package/dist/shell/top-bar.js +61 -60
- package/dist/tailwind/index.cjs +51 -7
- package/dist/tailwind/preset.d.ts.map +1 -1
- package/dist/tailwind/preset.js +51 -7
- package/dist/tokens/primitives.css +3 -1
- package/dist/tokens/semantic.css +16 -13
- package/dist/tokens/typography.css +33 -4
- package/dist/ui/alert.d.ts +1 -0
- package/dist/ui/alert.d.ts.map +1 -1
- package/dist/ui/alert.js +42 -37
- package/dist/ui/autocomplete.d.ts.map +1 -1
- package/dist/ui/autocomplete.js +38 -39
- package/dist/ui/badge.d.ts +110 -2
- package/dist/ui/badge.d.ts.map +1 -1
- package/dist/ui/banner.d.ts.map +1 -1
- package/dist/ui/banner.js +8 -7
- package/dist/ui/button.d.ts +2 -2
- package/dist/ui/button.d.ts.map +1 -1
- package/dist/ui/button.js +54 -74
- package/dist/ui/card.d.ts +5 -1
- package/dist/ui/card.d.ts.map +1 -1
- package/dist/ui/card.js +111 -79
- package/dist/ui/charts/area-chart.d.ts +2 -0
- package/dist/ui/charts/area-chart.d.ts.map +1 -1
- package/dist/ui/charts/bar-chart.d.ts +2 -0
- package/dist/ui/charts/bar-chart.d.ts.map +1 -1
- package/dist/ui/charts/chart-container.d.ts +2 -0
- package/dist/ui/charts/chart-container.d.ts.map +1 -1
- package/dist/ui/charts/index.js +583 -577
- package/dist/ui/charts/line-chart.d.ts +2 -0
- package/dist/ui/charts/line-chart.d.ts.map +1 -1
- package/dist/ui/charts/pie-chart.d.ts +2 -0
- package/dist/ui/charts/pie-chart.d.ts.map +1 -1
- package/dist/ui/charts/radar-chart.d.ts +2 -0
- package/dist/ui/charts/radar-chart.d.ts.map +1 -1
- package/dist/ui/checkbox.d.ts +2 -0
- package/dist/ui/checkbox.d.ts.map +1 -1
- package/dist/ui/checkbox.js +36 -27
- package/dist/ui/code.d.ts.map +1 -1
- package/dist/ui/color-input.js +5 -5
- package/dist/ui/combobox.d.ts +6 -1
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/combobox.js +1 -1
- package/dist/ui/container.d.ts.map +1 -1
- package/dist/ui/context-menu.js +1 -1
- package/dist/ui/data-table-body.d.ts +12 -0
- package/dist/ui/data-table-body.d.ts.map +1 -0
- package/dist/ui/data-table-body.js +219 -0
- package/dist/ui/data-table-bulk-actions.d.ts +19 -0
- package/dist/ui/data-table-bulk-actions.d.ts.map +1 -0
- package/dist/ui/data-table-bulk-actions.js +61 -0
- package/dist/ui/data-table-card.d.ts +9 -0
- package/dist/ui/data-table-card.d.ts.map +1 -0
- package/dist/ui/data-table-card.js +73 -0
- package/dist/ui/data-table-context.d.ts +62 -0
- package/dist/ui/data-table-context.d.ts.map +1 -0
- package/dist/ui/data-table-context.js +48 -0
- package/dist/ui/data-table-header.d.ts +10 -0
- package/dist/ui/data-table-header.d.ts.map +1 -0
- package/dist/ui/data-table-header.js +141 -0
- package/dist/ui/data-table-pagination.d.ts +13 -0
- package/dist/ui/data-table-pagination.d.ts.map +1 -0
- package/dist/ui/data-table-pagination.js +84 -0
- package/dist/ui/data-table.d.ts +11 -9
- package/dist/ui/data-table.d.ts.map +1 -1
- package/dist/ui/data-table.js +258 -573
- package/dist/ui/dialog.d.ts +6 -2
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +84 -82
- package/dist/ui/dropdown-menu.js +1 -1
- package/dist/ui/hover-card.d.ts +7 -0
- package/dist/ui/hover-card.d.ts.map +1 -1
- package/dist/ui/hover-card.js +3 -3
- package/dist/ui/icon-group.d.ts +2 -4
- package/dist/ui/icon-group.d.ts.map +1 -1
- package/dist/ui/icon-group.js +22 -23
- package/dist/ui/index.d.ts +1 -2
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +94 -99
- package/dist/ui/label.js +1 -1
- package/dist/ui/lib/bottom-sheet.d.ts +16 -0
- package/dist/ui/lib/bottom-sheet.d.ts.map +1 -0
- package/dist/ui/lib/date-utils.d.ts.map +1 -1
- package/dist/ui/lib/motion.d.ts.map +1 -1
- package/dist/ui/lib/utils.d.ts.map +1 -1
- package/dist/ui/menubar.d.ts.map +1 -1
- package/dist/ui/menubar.js +64 -73
- package/dist/ui/navigation-menu.d.ts.map +1 -1
- package/dist/ui/navigation-menu.js +40 -44
- package/dist/ui/number-input.d.ts.map +1 -1
- package/dist/ui/number-input.js +19 -17
- package/dist/ui/popover.d.ts.map +1 -1
- package/dist/ui/popover.js +107 -32
- package/dist/ui/progress-ring.d.ts.map +1 -1
- package/dist/ui/progress-ring.js +80 -80
- package/dist/ui/progress.js +4 -4
- package/dist/ui/radio.d.ts +5 -2
- package/dist/ui/radio.d.ts.map +1 -1
- package/dist/ui/radio.js +29 -20
- package/dist/ui/search-input.d.ts.map +1 -1
- package/dist/ui/search-input.js +13 -12
- package/dist/ui/segmented-control.d.ts +6 -108
- package/dist/ui/segmented-control.d.ts.map +1 -1
- package/dist/ui/segmented-control.js +86 -272
- package/dist/ui/select.d.ts +3 -1
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +83 -71
- package/dist/ui/separator.js +5 -5
- package/dist/ui/sheet.d.ts +2 -0
- package/dist/ui/sheet.d.ts.map +1 -1
- package/dist/ui/sheet.js +102 -84
- package/dist/ui/sidebar.d.ts.map +1 -1
- package/dist/ui/sidebar.js +200 -175
- package/dist/ui/skeleton.d.ts.map +1 -1
- package/dist/ui/slider.js +14 -14
- package/dist/ui/stack.d.ts.map +1 -1
- package/dist/ui/status-dot.js +8 -8
- package/dist/ui/stepper.d.ts.map +1 -1
- package/dist/ui/stepper.js +33 -31
- package/dist/ui/switch.js +3 -3
- package/dist/ui/table.d.ts.map +1 -1
- package/dist/ui/tabs.d.ts +7 -0
- package/dist/ui/tabs.d.ts.map +1 -1
- package/dist/ui/tabs.js +102 -76
- package/dist/ui/text.d.ts.map +1 -1
- package/dist/ui/toast-types.d.ts +0 -1
- package/dist/ui/toast-types.d.ts.map +1 -1
- package/dist/ui/toast-types.js +0 -1
- package/dist/ui/toast.d.ts.map +1 -1
- package/dist/ui/toast.js +156 -150
- package/dist/ui/toggle-group.js +1 -1
- package/dist/ui/toggle.js +1 -1
- package/dist/ui/tooltip.js +3 -3
- package/dist/ui/visually-hidden.d.ts.map +1 -1
- package/docs/components/ui/alert.md +3 -0
- package/docs/components/ui/badge.md +3 -0
- package/docs/components/ui/card.md +4 -0
- package/docs/components/ui/data-table-body.md +13 -0
- package/docs/components/ui/data-table-bulk-actions.md +13 -0
- package/docs/components/ui/data-table-card.md +13 -0
- package/docs/components/ui/data-table-context.md +13 -0
- package/docs/components/ui/data-table-header.md +13 -0
- package/docs/components/ui/data-table-pagination.md +13 -0
- package/docs/components/ui/select.md +4 -0
- package/docs/components/ui/tabs.md +4 -0
- package/llms-full.txt +97 -48
- package/llms.txt +46 -1
- package/package.json +37 -7
- package/dist/ui/chip.d.ts +0 -19
- package/dist/ui/chip.d.ts.map +0 -1
- package/dist/ui/chip.js +0 -14
- package/dist/ui/lib/use-ripple.d.ts +0 -14
- package/dist/ui/lib/use-ripple.d.ts.map +0 -1
|
@@ -1,77 +1,77 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import * as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { format as D, startOfMonth as q, endOfMonth as ge, startOfWeek as
|
|
6
|
-
import { IconChevronLeft as
|
|
7
|
-
import { Icon as
|
|
8
|
-
import { cn as
|
|
9
|
-
import { Popover as
|
|
10
|
-
const
|
|
2
|
+
import { jsxs as M, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import * as b from "react";
|
|
4
|
+
import { useState as Ce } from "react";
|
|
5
|
+
import { format as D, startOfMonth as q, endOfMonth as ge, startOfWeek as Pe, endOfWeek as Ae, addDays as G, subMonths as be, addMonths as se, isSameMonth as xe, isSameDay as X, lastDayOfMonth as Re, isBefore as ee, startOfDay as V, isAfter as te, isWithinInterval as ye, setMonth as re, setYear as ae, endOfDay as J, startOfYear as Oe, subDays as fe, setHours as W, setMinutes as ne, setSeconds as Me } from "date-fns";
|
|
6
|
+
import { IconChevronLeft as Ye, IconChevronRight as He, IconCalendarEvent as ve, IconClock as Te, IconCalendarClock as De } from "@tabler/icons-react";
|
|
7
|
+
import { Icon as B } from "../ui/icon.js";
|
|
8
|
+
import { cn as S } from "../ui/lib/utils.js";
|
|
9
|
+
import { Popover as oe, PopoverTrigger as ce, PopoverContent as le } from "../ui/popover.js";
|
|
10
|
+
const Le = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = b.forwardRef(
|
|
11
11
|
function({
|
|
12
12
|
currentMonth: e,
|
|
13
|
-
selected:
|
|
14
|
-
rangeStart:
|
|
15
|
-
rangeEnd:
|
|
16
|
-
hoverDate:
|
|
17
|
-
onSelect:
|
|
18
|
-
onHover:
|
|
19
|
-
onMonthChange:
|
|
20
|
-
onHeaderClick:
|
|
21
|
-
disabledDates:
|
|
22
|
-
minDate:
|
|
23
|
-
maxDate:
|
|
24
|
-
hidePrevNav:
|
|
25
|
-
hideNextNav:
|
|
26
|
-
events:
|
|
27
|
-
className:
|
|
28
|
-
...
|
|
29
|
-
},
|
|
30
|
-
const A =
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
33
|
-
for (const s of
|
|
34
|
-
const
|
|
35
|
-
n.push(s),
|
|
13
|
+
selected: d,
|
|
14
|
+
rangeStart: l,
|
|
15
|
+
rangeEnd: u,
|
|
16
|
+
hoverDate: w,
|
|
17
|
+
onSelect: x,
|
|
18
|
+
onHover: m,
|
|
19
|
+
onMonthChange: v,
|
|
20
|
+
onHeaderClick: H,
|
|
21
|
+
disabledDates: C,
|
|
22
|
+
minDate: O,
|
|
23
|
+
maxDate: k,
|
|
24
|
+
hidePrevNav: T,
|
|
25
|
+
hideNextNav: y,
|
|
26
|
+
events: p,
|
|
27
|
+
className: h,
|
|
28
|
+
...g
|
|
29
|
+
}, r) {
|
|
30
|
+
const A = b.useRef(null), N = b.useMemo(() => {
|
|
31
|
+
const a = /* @__PURE__ */ new Map();
|
|
32
|
+
if (!p) return a;
|
|
33
|
+
for (const s of p) {
|
|
34
|
+
const c = D(s.date, "yyyy-MM-dd"), n = a.get(c) ?? [];
|
|
35
|
+
n.push(s), a.set(c, n);
|
|
36
36
|
}
|
|
37
|
-
return
|
|
38
|
-
}, [
|
|
39
|
-
let
|
|
40
|
-
for (;
|
|
41
|
-
|
|
42
|
-
const I = (
|
|
43
|
-
if (
|
|
44
|
-
const s = ee(
|
|
45
|
-
return ye(
|
|
37
|
+
return a;
|
|
38
|
+
}, [p]), Y = q(e), R = ge(e), L = Pe(Y), U = Ae(R), $ = [];
|
|
39
|
+
let E = L;
|
|
40
|
+
for (; E <= U; )
|
|
41
|
+
$.push(E), E = G(E, 1);
|
|
42
|
+
const I = (a) => !!(C?.(a) || O && ee(a, V(O)) || k && te(a, V(k))), z = (a) => {
|
|
43
|
+
if (l && u) {
|
|
44
|
+
const s = ee(l, u) ? l : u, c = te(u, l) ? u : l;
|
|
45
|
+
return ye(a, { start: s, end: c });
|
|
46
46
|
}
|
|
47
|
-
if (
|
|
48
|
-
const s = ee(
|
|
49
|
-
return ye(
|
|
47
|
+
if (l && w) {
|
|
48
|
+
const s = ee(l, w) ? l : w, c = te(w, l) ? w : l;
|
|
49
|
+
return ye(a, { start: s, end: c });
|
|
50
50
|
}
|
|
51
51
|
return !1;
|
|
52
|
-
},
|
|
52
|
+
}, j = (a) => !!(l && X(a, l) || u && X(a, u)), K = (a) => {
|
|
53
53
|
if (!A.current) return;
|
|
54
|
-
const s = D(
|
|
54
|
+
const s = D(a, "yyyy-MM-dd"), c = A.current.querySelector(
|
|
55
55
|
`[data-date="${s}"]`
|
|
56
56
|
);
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
const
|
|
60
|
-
if (!
|
|
61
|
-
const n = /* @__PURE__ */ new Date(
|
|
57
|
+
c ? c.focus() : v(q(a));
|
|
58
|
+
}, F = (a) => {
|
|
59
|
+
const c = a.target.getAttribute("data-date");
|
|
60
|
+
if (!c) return;
|
|
61
|
+
const n = /* @__PURE__ */ new Date(c + "T00:00:00");
|
|
62
62
|
let o = null;
|
|
63
|
-
switch (
|
|
63
|
+
switch (a.key) {
|
|
64
64
|
case "ArrowLeft":
|
|
65
|
-
o =
|
|
65
|
+
o = G(n, -1);
|
|
66
66
|
break;
|
|
67
67
|
case "ArrowRight":
|
|
68
|
-
o =
|
|
68
|
+
o = G(n, 1);
|
|
69
69
|
break;
|
|
70
70
|
case "ArrowUp":
|
|
71
|
-
o =
|
|
71
|
+
o = G(n, -7);
|
|
72
72
|
break;
|
|
73
73
|
case "ArrowDown":
|
|
74
|
-
o =
|
|
74
|
+
o = G(n, 7);
|
|
75
75
|
break;
|
|
76
76
|
case "Home":
|
|
77
77
|
o = q(n);
|
|
@@ -81,51 +81,51 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = g.forwardRef(
|
|
|
81
81
|
break;
|
|
82
82
|
case "Enter":
|
|
83
83
|
case " ": {
|
|
84
|
-
|
|
84
|
+
a.preventDefault(), !I(n) && xe(n, e) && x(n);
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
default:
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
|
-
o && (
|
|
90
|
+
o && (a.preventDefault(), K(o));
|
|
91
91
|
};
|
|
92
|
-
return /* @__PURE__ */
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
|
|
92
|
+
return /* @__PURE__ */ M("div", { ref: r, ...g, className: S("w-[252px]", h), children: [
|
|
93
|
+
/* @__PURE__ */ M("div", { className: "flex items-center justify-between px-ds-02 pb-ds-04", children: [
|
|
94
|
+
T ? /* @__PURE__ */ t("span", { className: "h-ds-xs-plus w-ds-xs-plus" }) : /* @__PURE__ */ t(
|
|
95
95
|
"button",
|
|
96
96
|
{
|
|
97
97
|
type: "button",
|
|
98
|
-
onClick: () =>
|
|
98
|
+
onClick: () => v(be(e, 1)),
|
|
99
99
|
className: "inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md text-surface-fg-subtle transition-colors duration-fast-01 ease-productive-standard hover:bg-surface-raised-hover hover:text-surface-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9",
|
|
100
100
|
"aria-label": "Previous month",
|
|
101
|
-
children: /* @__PURE__ */ t(
|
|
101
|
+
children: /* @__PURE__ */ t(B, { icon: Ye, size: "sm", stroke: "light" })
|
|
102
102
|
}
|
|
103
103
|
),
|
|
104
104
|
/* @__PURE__ */ t(
|
|
105
105
|
"button",
|
|
106
106
|
{
|
|
107
107
|
type: "button",
|
|
108
|
-
onClick:
|
|
109
|
-
className:
|
|
108
|
+
onClick: H,
|
|
109
|
+
className: S(
|
|
110
110
|
"text-ds-md font-semibold text-surface-fg",
|
|
111
|
-
|
|
111
|
+
H && "cursor-pointer rounded-ds-md px-ds-02 transition-colors duration-fast-01 ease-productive-standard hover:bg-surface-raised-hover"
|
|
112
112
|
),
|
|
113
113
|
"aria-label": "Switch to month/year view",
|
|
114
114
|
children: D(e, "MMMM yyyy")
|
|
115
115
|
}
|
|
116
116
|
),
|
|
117
|
-
|
|
117
|
+
y ? /* @__PURE__ */ t("span", { className: "h-ds-xs-plus w-ds-xs-plus" }) : /* @__PURE__ */ t(
|
|
118
118
|
"button",
|
|
119
119
|
{
|
|
120
120
|
type: "button",
|
|
121
|
-
onClick: () =>
|
|
121
|
+
onClick: () => v(se(e, 1)),
|
|
122
122
|
className: "inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md text-surface-fg-subtle transition-colors duration-fast-01 ease-productive-standard hover:bg-surface-raised-hover hover:text-surface-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9",
|
|
123
123
|
"aria-label": "Next month",
|
|
124
|
-
children: /* @__PURE__ */ t(
|
|
124
|
+
children: /* @__PURE__ */ t(B, { icon: He, size: "sm", stroke: "light" })
|
|
125
125
|
}
|
|
126
126
|
)
|
|
127
127
|
] }),
|
|
128
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ M(
|
|
129
129
|
"div",
|
|
130
130
|
{
|
|
131
131
|
ref: A,
|
|
@@ -133,52 +133,52 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = g.forwardRef(
|
|
|
133
133
|
role: "grid",
|
|
134
134
|
tabIndex: 0,
|
|
135
135
|
"aria-label": "Calendar",
|
|
136
|
-
onKeyDown:
|
|
136
|
+
onKeyDown: F,
|
|
137
137
|
children: [
|
|
138
|
-
|
|
138
|
+
Le.map((a) => /* @__PURE__ */ t(
|
|
139
139
|
"div",
|
|
140
140
|
{
|
|
141
141
|
role: "columnheader",
|
|
142
142
|
className: "flex h-ds-sm items-center justify-center text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle",
|
|
143
|
-
children:
|
|
143
|
+
children: a
|
|
144
144
|
},
|
|
145
|
-
|
|
145
|
+
a
|
|
146
146
|
)),
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
return /* @__PURE__ */
|
|
147
|
+
$.map((a, s) => {
|
|
148
|
+
const c = xe(a, e), n = I(a), o = d && X(a, d), i = z(a), P = j(a), ue = X(a, /* @__PURE__ */ new Date()), me = D(a, "yyyy-MM-dd"), pe = N.get(me) ?? [];
|
|
149
|
+
return /* @__PURE__ */ M(
|
|
150
150
|
"button",
|
|
151
151
|
{
|
|
152
152
|
type: "button",
|
|
153
153
|
role: "gridcell",
|
|
154
|
-
"data-date":
|
|
155
|
-
tabIndex:
|
|
156
|
-
disabled: !
|
|
154
|
+
"data-date": me,
|
|
155
|
+
tabIndex: c && !n ? 0 : -1,
|
|
156
|
+
disabled: !c || n,
|
|
157
157
|
onClick: () => {
|
|
158
|
-
|
|
158
|
+
c && !n && x(a);
|
|
159
159
|
},
|
|
160
|
-
onMouseEnter: () =>
|
|
161
|
-
onMouseLeave: () =>
|
|
162
|
-
"aria-label": D(
|
|
163
|
-
"aria-selected": o ||
|
|
164
|
-
"aria-disabled": !
|
|
165
|
-
className:
|
|
160
|
+
onMouseEnter: () => m?.(a),
|
|
161
|
+
onMouseLeave: () => m?.(null),
|
|
162
|
+
"aria-label": D(a, "EEEE, MMMM d, yyyy"),
|
|
163
|
+
"aria-selected": o || P || void 0,
|
|
164
|
+
"aria-disabled": !c || n || void 0,
|
|
165
|
+
className: S(
|
|
166
166
|
"relative flex h-ds-sm w-ds-sm-plus items-center justify-center rounded-ds-md text-ds-md font-body transition-colors duration-fast-01 ease-productive-standard",
|
|
167
|
-
!
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
(o ||
|
|
172
|
-
ue && !o && !
|
|
167
|
+
!c && "pointer-events-none opacity-0",
|
|
168
|
+
c && n && "opacity-action-disabled pointer-events-none cursor-not-allowed",
|
|
169
|
+
c && !n && !o && !P && !i && "text-surface-fg hover:bg-surface-raised-hover",
|
|
170
|
+
i && !P && "rounded-ds-none bg-surface-raised-hover text-surface-fg",
|
|
171
|
+
(o || P) && "bg-accent-9 text-accent-fg hover:bg-accent-10",
|
|
172
|
+
ue && !o && !P && !n && "font-semibold text-accent-11"
|
|
173
173
|
),
|
|
174
174
|
children: [
|
|
175
|
-
D(
|
|
176
|
-
pe.length > 0 && /* @__PURE__ */ t("span", { className: "flex gap-px justify-center absolute bottom-[2px] left-0 right-0", children: pe.slice(0, 3).map((
|
|
175
|
+
D(a, "d"),
|
|
176
|
+
pe.length > 0 && /* @__PURE__ */ t("span", { className: "flex gap-px justify-center absolute bottom-[2px] left-0 right-0", children: pe.slice(0, 3).map((Ne, Se) => /* @__PURE__ */ t(
|
|
177
177
|
"span",
|
|
178
178
|
{
|
|
179
179
|
"data-event-dot": !0,
|
|
180
180
|
className: "h-[4px] w-[4px] rounded-ds-full",
|
|
181
|
-
style: { backgroundColor:
|
|
181
|
+
style: { backgroundColor: Ne.color ?? "var(--color-accent-9)" }
|
|
182
182
|
},
|
|
183
183
|
Se
|
|
184
184
|
)) })
|
|
@@ -194,47 +194,82 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = g.forwardRef(
|
|
|
194
194
|
}
|
|
195
195
|
);
|
|
196
196
|
Q.displayName = "CalendarGrid";
|
|
197
|
-
const ie =
|
|
197
|
+
const ie = b.forwardRef(
|
|
198
198
|
function({
|
|
199
199
|
currentYear: e,
|
|
200
|
-
selectedYear:
|
|
201
|
-
onYearSelect:
|
|
202
|
-
minDate:
|
|
203
|
-
maxDate:
|
|
204
|
-
className:
|
|
205
|
-
...
|
|
206
|
-
},
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
200
|
+
selectedYear: d,
|
|
201
|
+
onYearSelect: l,
|
|
202
|
+
minDate: u,
|
|
203
|
+
maxDate: w,
|
|
204
|
+
className: x,
|
|
205
|
+
...m
|
|
206
|
+
}, v) {
|
|
207
|
+
const C = Math.floor(e / 10) * 10, O = Array.from({ length: 12 }, (g, r) => C + r), [k, T] = b.useState(() => {
|
|
208
|
+
const g = O.indexOf(d ?? e);
|
|
209
|
+
return g >= 0 ? g : 0;
|
|
210
|
+
}), y = b.useRef([]), p = (g) => u != null && g < u.getFullYear() || w != null && g > w.getFullYear(), h = (g) => {
|
|
211
|
+
let r = k;
|
|
212
|
+
switch (g.key) {
|
|
213
|
+
case "ArrowRight":
|
|
214
|
+
r = Math.min(11, k + 1);
|
|
215
|
+
break;
|
|
216
|
+
case "ArrowLeft":
|
|
217
|
+
r = Math.max(0, k - 1);
|
|
218
|
+
break;
|
|
219
|
+
case "ArrowDown":
|
|
220
|
+
r = Math.min(11, k + 3);
|
|
221
|
+
break;
|
|
222
|
+
case "ArrowUp":
|
|
223
|
+
r = Math.max(0, k - 3);
|
|
224
|
+
break;
|
|
225
|
+
case "Home":
|
|
226
|
+
r = 0;
|
|
227
|
+
break;
|
|
228
|
+
case "End":
|
|
229
|
+
r = 11;
|
|
230
|
+
break;
|
|
231
|
+
default:
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
for (g.preventDefault(); r !== k && p(O[r]); )
|
|
235
|
+
if (r += g.key === "ArrowLeft" || g.key === "ArrowUp" ? -1 : 1, r < 0 || r > 11) return;
|
|
236
|
+
T(r), y.current[r]?.focus();
|
|
237
|
+
};
|
|
238
|
+
return /* @__PURE__ */ M("div", { ref: v, ...m, className: S("w-[252px]", x), children: [
|
|
239
|
+
/* @__PURE__ */ M("div", { className: "text-center pb-ds-04 text-ds-md font-semibold text-surface-fg", children: [
|
|
240
|
+
C,
|
|
211
241
|
" – ",
|
|
212
|
-
|
|
242
|
+
C + 11
|
|
213
243
|
] }),
|
|
214
|
-
/* @__PURE__ */ t("div", { className: "grid grid-cols-3 gap-ds-02", children:
|
|
215
|
-
const
|
|
244
|
+
/* @__PURE__ */ t("div", { role: "grid", "aria-label": "Year picker", tabIndex: -1, onKeyDown: h, children: [0, 1, 2, 3].map((g) => /* @__PURE__ */ t("div", { role: "row", className: "grid grid-cols-3 gap-ds-02 mb-ds-02 last:mb-0", children: O.slice(g * 3, g * 3 + 3).map((r) => {
|
|
245
|
+
const A = O.indexOf(r), N = r === d, Y = p(r);
|
|
216
246
|
return /* @__PURE__ */ t(
|
|
217
247
|
"button",
|
|
218
248
|
{
|
|
249
|
+
ref: (R) => {
|
|
250
|
+
y.current[A] = R;
|
|
251
|
+
},
|
|
219
252
|
type: "button",
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
253
|
+
role: "gridcell",
|
|
254
|
+
tabIndex: A === k ? 0 : -1,
|
|
255
|
+
disabled: Y || !1,
|
|
256
|
+
onClick: () => !Y && l(r),
|
|
257
|
+
className: S(
|
|
258
|
+
"h-ds-sm-plus rounded-ds-md text-ds-md transition-colors focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
|
|
259
|
+
Y && "opacity-action-disabled pointer-events-none cursor-not-allowed",
|
|
260
|
+
N && "bg-accent-9 text-accent-fg",
|
|
261
|
+
!N && !Y && "hover:bg-surface-raised-hover text-surface-fg"
|
|
227
262
|
),
|
|
228
|
-
children:
|
|
263
|
+
children: r
|
|
229
264
|
},
|
|
230
|
-
|
|
265
|
+
r
|
|
231
266
|
);
|
|
232
|
-
}) })
|
|
267
|
+
}) }, g)) })
|
|
233
268
|
] });
|
|
234
269
|
}
|
|
235
270
|
);
|
|
236
271
|
ie.displayName = "YearPicker";
|
|
237
|
-
const
|
|
272
|
+
const Ee = [
|
|
238
273
|
"Jan",
|
|
239
274
|
"Feb",
|
|
240
275
|
"Mar",
|
|
@@ -247,131 +282,164 @@ const $e = [
|
|
|
247
282
|
"Oct",
|
|
248
283
|
"Nov",
|
|
249
284
|
"Dec"
|
|
250
|
-
], de =
|
|
285
|
+
], de = b.forwardRef(
|
|
251
286
|
function({
|
|
252
287
|
currentYear: e,
|
|
253
|
-
selectedMonth:
|
|
254
|
-
onMonthSelect:
|
|
255
|
-
minDate:
|
|
256
|
-
maxDate:
|
|
257
|
-
className:
|
|
258
|
-
...
|
|
259
|
-
},
|
|
260
|
-
|
|
288
|
+
selectedMonth: d,
|
|
289
|
+
onMonthSelect: l,
|
|
290
|
+
minDate: u,
|
|
291
|
+
maxDate: w,
|
|
292
|
+
className: x,
|
|
293
|
+
...m
|
|
294
|
+
}, v) {
|
|
295
|
+
const [C, O] = b.useState(d ?? 0), k = b.useRef([]), T = (p) => u != null && (e < u.getFullYear() || e === u.getFullYear() && p < u.getMonth()) || w != null && (e > w.getFullYear() || e === w.getFullYear() && p > w.getMonth()), y = (p) => {
|
|
296
|
+
let h = C;
|
|
297
|
+
switch (p.key) {
|
|
298
|
+
case "ArrowRight":
|
|
299
|
+
h = Math.min(11, C + 1);
|
|
300
|
+
break;
|
|
301
|
+
case "ArrowLeft":
|
|
302
|
+
h = Math.max(0, C - 1);
|
|
303
|
+
break;
|
|
304
|
+
case "ArrowDown":
|
|
305
|
+
h = Math.min(11, C + 4);
|
|
306
|
+
break;
|
|
307
|
+
case "ArrowUp":
|
|
308
|
+
h = Math.max(0, C - 4);
|
|
309
|
+
break;
|
|
310
|
+
case "Home":
|
|
311
|
+
h = 0;
|
|
312
|
+
break;
|
|
313
|
+
case "End":
|
|
314
|
+
h = 11;
|
|
315
|
+
break;
|
|
316
|
+
default:
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
for (p.preventDefault(); h !== C && T(h); )
|
|
320
|
+
if (h += p.key === "ArrowLeft" || p.key === "ArrowUp" ? -1 : 1, h < 0 || h > 11) return;
|
|
321
|
+
O(h), k.current[h]?.focus();
|
|
322
|
+
};
|
|
323
|
+
return /* @__PURE__ */ M("div", { ref: v, ...m, className: S("w-[252px]", x), children: [
|
|
261
324
|
/* @__PURE__ */ t("div", { className: "text-center pb-ds-04 text-ds-md font-semibold text-surface-fg", children: e }),
|
|
262
|
-
/* @__PURE__ */ t("div", { className: "grid grid-cols-4 gap-ds-02", children:
|
|
263
|
-
const
|
|
325
|
+
/* @__PURE__ */ t("div", { role: "grid", "aria-label": "Month picker", tabIndex: -1, onKeyDown: y, children: [0, 1, 2].map((p) => /* @__PURE__ */ t("div", { role: "row", className: "grid grid-cols-4 gap-ds-02 mb-ds-02 last:mb-0", children: Ee.slice(p * 4, p * 4 + 4).map((h, g) => {
|
|
326
|
+
const r = p * 4 + g, A = r === d, N = T(r);
|
|
264
327
|
return /* @__PURE__ */ t(
|
|
265
328
|
"button",
|
|
266
329
|
{
|
|
330
|
+
ref: (Y) => {
|
|
331
|
+
k.current[r] = Y;
|
|
332
|
+
},
|
|
267
333
|
type: "button",
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
334
|
+
role: "gridcell",
|
|
335
|
+
tabIndex: r === C ? 0 : -1,
|
|
336
|
+
disabled: N || !1,
|
|
337
|
+
onClick: () => !N && l(r),
|
|
338
|
+
className: S(
|
|
339
|
+
"h-ds-sm-plus rounded-ds-md text-ds-md transition-colors focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
|
|
340
|
+
N && "opacity-action-disabled pointer-events-none cursor-not-allowed",
|
|
341
|
+
A && "bg-accent-9 text-accent-fg",
|
|
342
|
+
!A && !N && "hover:bg-surface-raised-hover text-surface-fg"
|
|
275
343
|
),
|
|
276
|
-
children:
|
|
344
|
+
children: h
|
|
277
345
|
},
|
|
278
|
-
|
|
346
|
+
h
|
|
279
347
|
);
|
|
280
|
-
}) })
|
|
348
|
+
}) }, p)) })
|
|
281
349
|
] });
|
|
282
350
|
}
|
|
283
351
|
);
|
|
284
352
|
de.displayName = "MonthPicker";
|
|
285
|
-
const Ie =
|
|
353
|
+
const Ie = b.forwardRef(
|
|
286
354
|
function({
|
|
287
355
|
value: e,
|
|
288
|
-
onChange:
|
|
289
|
-
placeholder:
|
|
290
|
-
className:
|
|
291
|
-
formatStr:
|
|
292
|
-
minDate:
|
|
293
|
-
maxDate:
|
|
294
|
-
disabledDates:
|
|
295
|
-
...
|
|
296
|
-
},
|
|
297
|
-
const [
|
|
356
|
+
onChange: d,
|
|
357
|
+
placeholder: l = "Pick a date",
|
|
358
|
+
className: u,
|
|
359
|
+
formatStr: w = "MMM d, yyyy",
|
|
360
|
+
minDate: x,
|
|
361
|
+
maxDate: m,
|
|
362
|
+
disabledDates: v,
|
|
363
|
+
...H
|
|
364
|
+
}, C) {
|
|
365
|
+
const [O, k] = b.useState(!1), [T, y] = b.useState(
|
|
298
366
|
e ?? /* @__PURE__ */ new Date()
|
|
299
|
-
), [
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}, [
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
},
|
|
306
|
-
|
|
307
|
-
}, A = (
|
|
308
|
-
|
|
309
|
-
},
|
|
310
|
-
|
|
311
|
-
},
|
|
312
|
-
switch (
|
|
367
|
+
), [p, h] = b.useState("days");
|
|
368
|
+
b.useEffect(() => {
|
|
369
|
+
O || h("days");
|
|
370
|
+
}, [O]);
|
|
371
|
+
const g = (R) => {
|
|
372
|
+
d?.(R), k(!1);
|
|
373
|
+
}, r = () => {
|
|
374
|
+
h((R) => R === "days" ? "months" : "years");
|
|
375
|
+
}, A = (R) => {
|
|
376
|
+
y((L) => re(L, R)), h("days");
|
|
377
|
+
}, N = (R) => {
|
|
378
|
+
y((L) => ae(L, R)), h("months");
|
|
379
|
+
}, Y = () => {
|
|
380
|
+
switch (p) {
|
|
313
381
|
case "years":
|
|
314
382
|
return /* @__PURE__ */ t(
|
|
315
383
|
ie,
|
|
316
384
|
{
|
|
317
|
-
currentYear:
|
|
385
|
+
currentYear: T.getFullYear(),
|
|
318
386
|
selectedYear: e?.getFullYear(),
|
|
319
|
-
onYearSelect:
|
|
320
|
-
minDate:
|
|
321
|
-
maxDate:
|
|
387
|
+
onYearSelect: N,
|
|
388
|
+
minDate: x,
|
|
389
|
+
maxDate: m
|
|
322
390
|
}
|
|
323
391
|
);
|
|
324
392
|
case "months":
|
|
325
393
|
return /* @__PURE__ */ t(
|
|
326
394
|
de,
|
|
327
395
|
{
|
|
328
|
-
currentYear:
|
|
396
|
+
currentYear: T.getFullYear(),
|
|
329
397
|
selectedMonth: e?.getMonth(),
|
|
330
398
|
onMonthSelect: A,
|
|
331
|
-
minDate:
|
|
332
|
-
maxDate:
|
|
399
|
+
minDate: x,
|
|
400
|
+
maxDate: m
|
|
333
401
|
}
|
|
334
402
|
);
|
|
335
403
|
default:
|
|
336
404
|
return /* @__PURE__ */ t(
|
|
337
405
|
Q,
|
|
338
406
|
{
|
|
339
|
-
currentMonth:
|
|
407
|
+
currentMonth: T,
|
|
340
408
|
selected: e,
|
|
341
|
-
onSelect:
|
|
342
|
-
onMonthChange:
|
|
343
|
-
onHeaderClick:
|
|
344
|
-
disabledDates:
|
|
345
|
-
minDate:
|
|
346
|
-
maxDate:
|
|
409
|
+
onSelect: g,
|
|
410
|
+
onMonthChange: y,
|
|
411
|
+
onHeaderClick: r,
|
|
412
|
+
disabledDates: v,
|
|
413
|
+
minDate: x,
|
|
414
|
+
maxDate: m
|
|
347
415
|
}
|
|
348
416
|
);
|
|
349
417
|
}
|
|
350
418
|
};
|
|
351
|
-
return /* @__PURE__ */
|
|
352
|
-
/* @__PURE__ */ t(ce, { asChild: !0, children: /* @__PURE__ */
|
|
419
|
+
return /* @__PURE__ */ M(oe, { open: O, onOpenChange: k, children: [
|
|
420
|
+
/* @__PURE__ */ t(ce, { asChild: !0, children: /* @__PURE__ */ M(
|
|
353
421
|
"button",
|
|
354
422
|
{
|
|
355
|
-
ref:
|
|
423
|
+
ref: C,
|
|
356
424
|
type: "button",
|
|
357
|
-
"aria-label": e ? `Change date, ${D(e,
|
|
358
|
-
...
|
|
359
|
-
className:
|
|
425
|
+
"aria-label": e ? `Change date, ${D(e, w)}` : l,
|
|
426
|
+
...H,
|
|
427
|
+
className: S(
|
|
360
428
|
"inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-surface-border-strong bg-surface-overlay px-ds-04 text-left transition-colors duration-fast-01 ease-productive-standard",
|
|
361
429
|
"hover:border-surface-border-strong",
|
|
362
430
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
|
|
363
|
-
|
|
431
|
+
u
|
|
364
432
|
),
|
|
365
433
|
children: [
|
|
366
|
-
/* @__PURE__ */ t(
|
|
434
|
+
/* @__PURE__ */ t(B, { icon: ve, size: "sm", stroke: "light", className: "text-surface-fg-subtle" }),
|
|
367
435
|
/* @__PURE__ */ t(
|
|
368
436
|
"span",
|
|
369
437
|
{
|
|
370
|
-
className:
|
|
438
|
+
className: S(
|
|
371
439
|
"text-ds-md",
|
|
372
440
|
e ? "text-surface-fg" : "text-surface-fg-subtle"
|
|
373
441
|
),
|
|
374
|
-
children: e ? D(e,
|
|
442
|
+
children: e ? D(e, w) : l
|
|
375
443
|
}
|
|
376
444
|
)
|
|
377
445
|
]
|
|
@@ -383,218 +451,218 @@ const Ie = g.forwardRef(
|
|
|
383
451
|
className: "w-auto border-surface-border-strong bg-surface-overlay p-ds-04",
|
|
384
452
|
align: "start",
|
|
385
453
|
sideOffset: 4,
|
|
386
|
-
children:
|
|
454
|
+
children: Y()
|
|
387
455
|
}
|
|
388
456
|
)
|
|
389
457
|
] });
|
|
390
458
|
}
|
|
391
459
|
);
|
|
392
460
|
Ie.displayName = "DatePicker";
|
|
393
|
-
const
|
|
461
|
+
const $e = {
|
|
394
462
|
today: {
|
|
395
463
|
label: "Today",
|
|
396
464
|
getRange: () => {
|
|
397
|
-
const
|
|
398
|
-
return { start:
|
|
465
|
+
const f = /* @__PURE__ */ new Date();
|
|
466
|
+
return { start: V(f), end: J(f) };
|
|
399
467
|
}
|
|
400
468
|
},
|
|
401
469
|
yesterday: {
|
|
402
470
|
label: "Yesterday",
|
|
403
471
|
getRange: () => {
|
|
404
|
-
const
|
|
405
|
-
return { start:
|
|
472
|
+
const f = fe(/* @__PURE__ */ new Date(), 1);
|
|
473
|
+
return { start: V(f), end: J(f) };
|
|
406
474
|
}
|
|
407
475
|
},
|
|
408
476
|
last7days: {
|
|
409
477
|
label: "Last 7 days",
|
|
410
478
|
getRange: () => {
|
|
411
|
-
const
|
|
412
|
-
return { start:
|
|
479
|
+
const f = /* @__PURE__ */ new Date();
|
|
480
|
+
return { start: V(fe(f, 6)), end: J(f) };
|
|
413
481
|
}
|
|
414
482
|
},
|
|
415
483
|
last30days: {
|
|
416
484
|
label: "Last 30 days",
|
|
417
485
|
getRange: () => {
|
|
418
|
-
const
|
|
419
|
-
return { start:
|
|
486
|
+
const f = /* @__PURE__ */ new Date();
|
|
487
|
+
return { start: V(fe(f, 29)), end: J(f) };
|
|
420
488
|
}
|
|
421
489
|
},
|
|
422
490
|
thisMonth: {
|
|
423
491
|
label: "This month",
|
|
424
492
|
getRange: () => {
|
|
425
|
-
const
|
|
426
|
-
return { start: q(
|
|
493
|
+
const f = /* @__PURE__ */ new Date();
|
|
494
|
+
return { start: q(f), end: ge(f) };
|
|
427
495
|
}
|
|
428
496
|
},
|
|
429
497
|
lastMonth: {
|
|
430
498
|
label: "Last month",
|
|
431
499
|
getRange: () => {
|
|
432
|
-
const e =
|
|
500
|
+
const e = be(/* @__PURE__ */ new Date(), 1);
|
|
433
501
|
return { start: q(e), end: ge(e) };
|
|
434
502
|
}
|
|
435
503
|
},
|
|
436
504
|
thisYear: {
|
|
437
505
|
label: "This year",
|
|
438
506
|
getRange: () => {
|
|
439
|
-
const
|
|
440
|
-
return { start:
|
|
507
|
+
const f = /* @__PURE__ */ new Date();
|
|
508
|
+
return { start: Oe(f), end: J(f) };
|
|
441
509
|
}
|
|
442
510
|
}
|
|
443
|
-
},
|
|
444
|
-
function({ presets: e, onSelect:
|
|
445
|
-
return /* @__PURE__ */ t("div", { ref:
|
|
446
|
-
const
|
|
447
|
-
return
|
|
511
|
+
}, ke = b.forwardRef(
|
|
512
|
+
function({ presets: e, onSelect: d, className: l, ...u }, w) {
|
|
513
|
+
return /* @__PURE__ */ t("div", { ref: w, ...u, className: S("flex flex-col gap-ds-01", l), children: e.map((x) => {
|
|
514
|
+
const m = $e[x];
|
|
515
|
+
return m ? /* @__PURE__ */ t(
|
|
448
516
|
"button",
|
|
449
517
|
{
|
|
450
518
|
type: "button",
|
|
451
519
|
onClick: () => {
|
|
452
|
-
const { start:
|
|
453
|
-
|
|
520
|
+
const { start: v, end: H } = m.getRange();
|
|
521
|
+
d(v, H);
|
|
454
522
|
},
|
|
455
|
-
className:
|
|
523
|
+
className: S(
|
|
456
524
|
"h-ds-sm w-full rounded-ds-md px-ds-03 text-left text-ds-sm",
|
|
457
525
|
"text-surface-fg transition-colors",
|
|
458
526
|
"hover:bg-surface-raised-hover",
|
|
459
527
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9"
|
|
460
528
|
),
|
|
461
|
-
children:
|
|
529
|
+
children: m.label
|
|
462
530
|
},
|
|
463
|
-
|
|
531
|
+
x
|
|
464
532
|
) : null;
|
|
465
533
|
}) });
|
|
466
534
|
}
|
|
467
535
|
);
|
|
468
|
-
|
|
469
|
-
const
|
|
536
|
+
ke.displayName = "Presets";
|
|
537
|
+
const je = b.forwardRef(
|
|
470
538
|
function({
|
|
471
539
|
startDate: e,
|
|
472
|
-
endDate:
|
|
473
|
-
onChange:
|
|
474
|
-
placeholder:
|
|
475
|
-
className:
|
|
476
|
-
formatStr:
|
|
477
|
-
minDate:
|
|
478
|
-
maxDate:
|
|
479
|
-
disabledDates:
|
|
480
|
-
presets:
|
|
481
|
-
numberOfMonths:
|
|
482
|
-
...
|
|
483
|
-
},
|
|
484
|
-
const [
|
|
540
|
+
endDate: d,
|
|
541
|
+
onChange: l,
|
|
542
|
+
placeholder: u = "Pick a date range",
|
|
543
|
+
className: w,
|
|
544
|
+
formatStr: x = "MMM d, yyyy",
|
|
545
|
+
minDate: m,
|
|
546
|
+
maxDate: v,
|
|
547
|
+
disabledDates: H,
|
|
548
|
+
presets: C,
|
|
549
|
+
numberOfMonths: O = 1,
|
|
550
|
+
...k
|
|
551
|
+
}, T) {
|
|
552
|
+
const [y, p] = b.useState(!1), [h, g] = b.useState(
|
|
485
553
|
e ?? /* @__PURE__ */ new Date()
|
|
486
|
-
), [
|
|
554
|
+
), [r, A] = b.useState(
|
|
487
555
|
e ?? null
|
|
488
|
-
), [
|
|
489
|
-
|
|
490
|
-
), [
|
|
491
|
-
|
|
492
|
-
A(e ?? null),
|
|
493
|
-
}, [e,
|
|
494
|
-
|
|
495
|
-
}, [
|
|
556
|
+
), [N, Y] = b.useState(
|
|
557
|
+
d ?? null
|
|
558
|
+
), [R, L] = b.useState(null), [U, $] = b.useState("days"), E = Math.max(1, O);
|
|
559
|
+
b.useEffect(() => {
|
|
560
|
+
A(e ?? null), Y(d ?? null);
|
|
561
|
+
}, [e, d]), b.useEffect(() => {
|
|
562
|
+
y || $("days");
|
|
563
|
+
}, [y]);
|
|
496
564
|
const I = (o) => {
|
|
497
|
-
if (!
|
|
498
|
-
A(o),
|
|
565
|
+
if (!r || r && N)
|
|
566
|
+
A(o), Y(null);
|
|
499
567
|
else {
|
|
500
|
-
const
|
|
501
|
-
A(
|
|
568
|
+
const i = ee(o, r) ? o : r, P = te(o, r) ? o : r;
|
|
569
|
+
A(i), Y(P), l?.({ start: i, end: P }), p(!1);
|
|
502
570
|
}
|
|
503
|
-
},
|
|
504
|
-
A(o),
|
|
505
|
-
},
|
|
506
|
-
|
|
507
|
-
},
|
|
508
|
-
|
|
509
|
-
},
|
|
510
|
-
|
|
511
|
-
},
|
|
571
|
+
}, z = (o, i) => {
|
|
572
|
+
A(o), Y(i), l?.({ start: o, end: i }), p(!1);
|
|
573
|
+
}, j = () => {
|
|
574
|
+
$((o) => o === "days" ? "months" : "years");
|
|
575
|
+
}, K = (o) => {
|
|
576
|
+
g((i) => re(i, o)), $("days");
|
|
577
|
+
}, F = (o) => {
|
|
578
|
+
g((i) => ae(i, o)), $("months");
|
|
579
|
+
}, a = () => r && N ? `${D(r, x)} - ${D(N, x)}` : u, s = () => E === 1 ? /* @__PURE__ */ t(
|
|
512
580
|
Q,
|
|
513
581
|
{
|
|
514
|
-
currentMonth:
|
|
515
|
-
rangeStart:
|
|
516
|
-
rangeEnd:
|
|
517
|
-
hoverDate:
|
|
582
|
+
currentMonth: h,
|
|
583
|
+
rangeStart: r,
|
|
584
|
+
rangeEnd: N,
|
|
585
|
+
hoverDate: R,
|
|
518
586
|
onSelect: I,
|
|
519
|
-
onHover:
|
|
520
|
-
onMonthChange:
|
|
521
|
-
onHeaderClick:
|
|
522
|
-
disabledDates:
|
|
523
|
-
minDate:
|
|
524
|
-
maxDate:
|
|
587
|
+
onHover: L,
|
|
588
|
+
onMonthChange: g,
|
|
589
|
+
onHeaderClick: j,
|
|
590
|
+
disabledDates: H,
|
|
591
|
+
minDate: m,
|
|
592
|
+
maxDate: v
|
|
525
593
|
}
|
|
526
|
-
) : /* @__PURE__ */ t("div", { className: "flex flex-row gap-ds-04", children: Array.from({ length:
|
|
594
|
+
) : /* @__PURE__ */ t("div", { className: "flex flex-row gap-ds-04", children: Array.from({ length: E }, (o, i) => /* @__PURE__ */ t(
|
|
527
595
|
Q,
|
|
528
596
|
{
|
|
529
|
-
currentMonth: se(
|
|
530
|
-
rangeStart:
|
|
531
|
-
rangeEnd:
|
|
532
|
-
hoverDate:
|
|
597
|
+
currentMonth: se(h, i),
|
|
598
|
+
rangeStart: r,
|
|
599
|
+
rangeEnd: N,
|
|
600
|
+
hoverDate: R,
|
|
533
601
|
onSelect: I,
|
|
534
|
-
onHover:
|
|
535
|
-
onMonthChange: (
|
|
536
|
-
|
|
602
|
+
onHover: L,
|
|
603
|
+
onMonthChange: (P) => {
|
|
604
|
+
g(se(P, -i));
|
|
537
605
|
},
|
|
538
|
-
onHeaderClick:
|
|
539
|
-
disabledDates:
|
|
540
|
-
minDate:
|
|
541
|
-
maxDate:
|
|
542
|
-
hidePrevNav:
|
|
543
|
-
hideNextNav:
|
|
606
|
+
onHeaderClick: j,
|
|
607
|
+
disabledDates: H,
|
|
608
|
+
minDate: m,
|
|
609
|
+
maxDate: v,
|
|
610
|
+
hidePrevNav: i > 0,
|
|
611
|
+
hideNextNav: i < E - 1
|
|
544
612
|
},
|
|
545
|
-
|
|
546
|
-
)) }),
|
|
547
|
-
switch (
|
|
613
|
+
i
|
|
614
|
+
)) }), c = () => {
|
|
615
|
+
switch (U) {
|
|
548
616
|
case "years":
|
|
549
617
|
return /* @__PURE__ */ t(
|
|
550
618
|
ie,
|
|
551
619
|
{
|
|
552
|
-
currentYear:
|
|
553
|
-
selectedYear:
|
|
554
|
-
onYearSelect:
|
|
555
|
-
minDate:
|
|
556
|
-
maxDate:
|
|
620
|
+
currentYear: h.getFullYear(),
|
|
621
|
+
selectedYear: r?.getFullYear(),
|
|
622
|
+
onYearSelect: F,
|
|
623
|
+
minDate: m,
|
|
624
|
+
maxDate: v
|
|
557
625
|
}
|
|
558
626
|
);
|
|
559
627
|
case "months":
|
|
560
628
|
return /* @__PURE__ */ t(
|
|
561
629
|
de,
|
|
562
630
|
{
|
|
563
|
-
currentYear:
|
|
564
|
-
selectedMonth:
|
|
565
|
-
onMonthSelect:
|
|
566
|
-
minDate:
|
|
567
|
-
maxDate:
|
|
631
|
+
currentYear: h.getFullYear(),
|
|
632
|
+
selectedMonth: r?.getMonth(),
|
|
633
|
+
onMonthSelect: K,
|
|
634
|
+
minDate: m,
|
|
635
|
+
maxDate: v
|
|
568
636
|
}
|
|
569
637
|
);
|
|
570
638
|
default:
|
|
571
639
|
return s();
|
|
572
640
|
}
|
|
573
|
-
}, n =
|
|
574
|
-
return /* @__PURE__ */
|
|
575
|
-
/* @__PURE__ */ t(ce, { asChild: !0, children: /* @__PURE__ */
|
|
641
|
+
}, n = C && C.length > 0;
|
|
642
|
+
return /* @__PURE__ */ M(oe, { open: y, onOpenChange: p, children: [
|
|
643
|
+
/* @__PURE__ */ t(ce, { asChild: !0, children: /* @__PURE__ */ M(
|
|
576
644
|
"button",
|
|
577
645
|
{
|
|
578
|
-
ref:
|
|
646
|
+
ref: T,
|
|
579
647
|
type: "button",
|
|
580
|
-
"aria-label":
|
|
581
|
-
...
|
|
582
|
-
className:
|
|
648
|
+
"aria-label": r && N ? `Change date range, ${a()}` : u,
|
|
649
|
+
...k,
|
|
650
|
+
className: S(
|
|
583
651
|
"inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-surface-border-strong bg-surface-overlay px-ds-04 text-left transition-colors duration-fast-01 ease-productive-standard",
|
|
584
652
|
"hover:border-surface-border-strong",
|
|
585
653
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
|
|
586
|
-
|
|
654
|
+
w
|
|
587
655
|
),
|
|
588
656
|
children: [
|
|
589
|
-
/* @__PURE__ */ t(
|
|
657
|
+
/* @__PURE__ */ t(B, { icon: ve, size: "sm", stroke: "light", className: "text-surface-fg-subtle" }),
|
|
590
658
|
/* @__PURE__ */ t(
|
|
591
659
|
"span",
|
|
592
660
|
{
|
|
593
|
-
className:
|
|
661
|
+
className: S(
|
|
594
662
|
"text-ds-md",
|
|
595
|
-
|
|
663
|
+
r && N ? "text-surface-fg" : "text-surface-fg-subtle"
|
|
596
664
|
),
|
|
597
|
-
children:
|
|
665
|
+
children: a()
|
|
598
666
|
}
|
|
599
667
|
)
|
|
600
668
|
]
|
|
@@ -606,91 +674,91 @@ const ze = g.forwardRef(
|
|
|
606
674
|
className: "w-auto border-surface-border-strong bg-surface-overlay p-ds-04",
|
|
607
675
|
align: "start",
|
|
608
676
|
sideOffset: 4,
|
|
609
|
-
children: n ? /* @__PURE__ */
|
|
610
|
-
/* @__PURE__ */ t("div", { className: "min-w-[140px] border-r border-surface-border-strong pr-ds-04", children: /* @__PURE__ */ t(
|
|
611
|
-
/* @__PURE__ */ t("div", { children:
|
|
612
|
-
] }) :
|
|
677
|
+
children: n ? /* @__PURE__ */ M("div", { className: "flex flex-row gap-ds-04", children: [
|
|
678
|
+
/* @__PURE__ */ t("div", { className: "min-w-[140px] border-r border-surface-border-strong pr-ds-04", children: /* @__PURE__ */ t(ke, { presets: C, onSelect: z }) }),
|
|
679
|
+
/* @__PURE__ */ t("div", { children: c() })
|
|
680
|
+
] }) : c()
|
|
613
681
|
}
|
|
614
682
|
)
|
|
615
683
|
] });
|
|
616
684
|
}
|
|
617
685
|
);
|
|
618
|
-
|
|
619
|
-
function Z(
|
|
620
|
-
const
|
|
621
|
-
for (let
|
|
622
|
-
|
|
623
|
-
return
|
|
686
|
+
je.displayName = "DateRangePicker";
|
|
687
|
+
function Z(f, e, d) {
|
|
688
|
+
const l = [];
|
|
689
|
+
for (let u = f; u <= e; u += d)
|
|
690
|
+
l.push(u);
|
|
691
|
+
return l;
|
|
624
692
|
}
|
|
625
|
-
function
|
|
626
|
-
return
|
|
693
|
+
function _(f) {
|
|
694
|
+
return f.toString().padStart(2, "0");
|
|
627
695
|
}
|
|
628
|
-
const
|
|
696
|
+
const Ke = b.forwardRef(
|
|
629
697
|
function({
|
|
630
698
|
value: e,
|
|
631
|
-
onChange:
|
|
632
|
-
format:
|
|
633
|
-
minuteStep:
|
|
634
|
-
secondStep:
|
|
635
|
-
showSeconds:
|
|
636
|
-
placeholder:
|
|
637
|
-
className:
|
|
638
|
-
disabled:
|
|
639
|
-
...
|
|
640
|
-
},
|
|
641
|
-
const [
|
|
642
|
-
const
|
|
643
|
-
let n = s.hours ??
|
|
644
|
-
const o = s.minutes ??
|
|
645
|
-
|
|
646
|
-
let
|
|
647
|
-
return
|
|
648
|
-
},
|
|
649
|
-
const
|
|
650
|
-
|
|
651
|
-
},
|
|
652
|
-
const
|
|
653
|
-
|
|
654
|
-
}, j = (s) => {
|
|
655
|
-
const a = P({ seconds: s });
|
|
656
|
-
u?.(a);
|
|
699
|
+
onChange: d,
|
|
700
|
+
format: l = "12h",
|
|
701
|
+
minuteStep: u = 1,
|
|
702
|
+
secondStep: w = 1,
|
|
703
|
+
showSeconds: x = !1,
|
|
704
|
+
placeholder: m = "Pick a time",
|
|
705
|
+
className: v,
|
|
706
|
+
disabled: H = !1,
|
|
707
|
+
...C
|
|
708
|
+
}, O) {
|
|
709
|
+
const [k, T] = b.useState(!1), y = e ? e.getHours() : null, p = e ? e.getMinutes() : null, h = e ? e.getSeconds() : null, g = y !== null ? y >= 12 ? "PM" : "AM" : null, r = y !== null ? y === 0 ? 12 : y > 12 ? y - 12 : y : null, A = l === "12h" ? Z(1, 12, 1) : Z(0, 23, 1), N = Z(0, 59, u), Y = Z(0, 59, w), R = (s) => {
|
|
710
|
+
const c = e ? new Date(e) : /* @__PURE__ */ new Date();
|
|
711
|
+
let n = s.hours ?? c.getHours();
|
|
712
|
+
const o = s.minutes ?? c.getMinutes(), i = s.seconds ?? c.getSeconds();
|
|
713
|
+
l === "12h" && s.hours !== void 0 && ((s.ampm ?? g ?? "AM") === "AM" ? n = s.hours === 12 ? 0 : s.hours : n = s.hours === 12 ? 12 : s.hours + 12);
|
|
714
|
+
let P = W(c, n);
|
|
715
|
+
return P = ne(P, o), P = Me(P, i), P;
|
|
716
|
+
}, L = (s) => {
|
|
717
|
+
const c = R({ hours: s });
|
|
718
|
+
d?.(c);
|
|
719
|
+
}, U = (s) => {
|
|
720
|
+
const c = R({ minutes: s });
|
|
721
|
+
d?.(c);
|
|
657
722
|
}, $ = (s) => {
|
|
723
|
+
const c = R({ seconds: s });
|
|
724
|
+
d?.(c);
|
|
725
|
+
}, E = (s) => {
|
|
658
726
|
if (!e) {
|
|
659
727
|
const o = s === "AM" ? 0 : 12;
|
|
660
|
-
let
|
|
661
|
-
|
|
728
|
+
let i = /* @__PURE__ */ new Date();
|
|
729
|
+
i = W(i, o), i = ne(i, 0), i = Me(i, 0), d?.(i);
|
|
662
730
|
return;
|
|
663
731
|
}
|
|
664
|
-
const
|
|
732
|
+
const c = e.getHours();
|
|
665
733
|
let n;
|
|
666
|
-
s === "AM" ? n =
|
|
667
|
-
}, I =
|
|
668
|
-
return /* @__PURE__ */
|
|
669
|
-
/* @__PURE__ */ t(ce, { asChild: !0, children: /* @__PURE__ */
|
|
734
|
+
s === "AM" ? n = c >= 12 ? c - 12 : c : n = c < 12 ? c + 12 : c, d?.(W(new Date(e), n));
|
|
735
|
+
}, I = b.useMemo(() => e ? l === "12h" ? D(e, x ? "h:mm:ss a" : "h:mm a") : D(e, x ? "HH:mm:ss" : "HH:mm") : null, [e, l, x]), z = l === "12h" ? r : y, j = "flex flex-col gap-ds-01 overflow-y-auto max-h-[200px] px-ds-01", K = "flex h-ds-sm w-full items-center justify-center rounded-ds-md text-ds-md transition-colors duration-fast-01 ease-productive-standard cursor-pointer", F = "bg-accent-9 text-accent-fg", a = "text-surface-fg hover:bg-surface-raised-hover";
|
|
736
|
+
return /* @__PURE__ */ M(oe, { open: k, onOpenChange: T, children: [
|
|
737
|
+
/* @__PURE__ */ t(ce, { asChild: !0, children: /* @__PURE__ */ M(
|
|
670
738
|
"button",
|
|
671
739
|
{
|
|
672
|
-
ref:
|
|
740
|
+
ref: O,
|
|
673
741
|
type: "button",
|
|
674
|
-
disabled:
|
|
675
|
-
...
|
|
676
|
-
className:
|
|
742
|
+
disabled: H,
|
|
743
|
+
...C,
|
|
744
|
+
className: S(
|
|
677
745
|
"inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-surface-border-strong bg-surface-overlay px-ds-04 text-left transition-colors duration-fast-01 ease-productive-standard",
|
|
678
746
|
"hover:border-surface-border-strong",
|
|
679
747
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
|
|
680
|
-
|
|
681
|
-
|
|
748
|
+
H && "opacity-action-disabled pointer-events-none",
|
|
749
|
+
v
|
|
682
750
|
),
|
|
683
|
-
"aria-label": I ? `Selected time: ${I}` :
|
|
751
|
+
"aria-label": I ? `Selected time: ${I}` : m,
|
|
684
752
|
children: [
|
|
685
|
-
/* @__PURE__ */ t(
|
|
753
|
+
/* @__PURE__ */ t(B, { icon: Te, size: "sm", stroke: "light", className: "text-surface-fg-subtle" }),
|
|
686
754
|
/* @__PURE__ */ t(
|
|
687
755
|
"span",
|
|
688
756
|
{
|
|
689
|
-
className:
|
|
757
|
+
className: S(
|
|
690
758
|
"text-ds-md",
|
|
691
759
|
I ? "text-surface-fg" : "text-surface-fg-subtle"
|
|
692
760
|
),
|
|
693
|
-
children: I ??
|
|
761
|
+
children: I ?? m
|
|
694
762
|
}
|
|
695
763
|
)
|
|
696
764
|
]
|
|
@@ -702,75 +770,75 @@ const Le = g.forwardRef(
|
|
|
702
770
|
className: "w-auto border-surface-border-strong bg-surface-overlay p-ds-04",
|
|
703
771
|
align: "start",
|
|
704
772
|
sideOffset: 4,
|
|
705
|
-
children: /* @__PURE__ */
|
|
706
|
-
/* @__PURE__ */
|
|
773
|
+
children: /* @__PURE__ */ M("div", { className: "flex gap-ds-03", role: "group", "aria-label": "Time picker", children: [
|
|
774
|
+
/* @__PURE__ */ M("div", { className: "flex flex-col items-center gap-ds-02", children: [
|
|
707
775
|
/* @__PURE__ */ t("span", { className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle", children: "Hr" }),
|
|
708
|
-
/* @__PURE__ */ t("div", { className:
|
|
776
|
+
/* @__PURE__ */ t("div", { className: S(j, "min-w-[48px]"), children: A.map((s) => /* @__PURE__ */ t(
|
|
709
777
|
"button",
|
|
710
778
|
{
|
|
711
779
|
type: "button",
|
|
712
|
-
onClick: () =>
|
|
713
|
-
className:
|
|
714
|
-
|
|
715
|
-
|
|
780
|
+
onClick: () => L(s),
|
|
781
|
+
className: S(
|
|
782
|
+
K,
|
|
783
|
+
z === s ? F : a
|
|
716
784
|
),
|
|
717
785
|
"aria-label": `${s} hours`,
|
|
718
|
-
"aria-selected":
|
|
719
|
-
children:
|
|
786
|
+
"aria-selected": z === s || void 0,
|
|
787
|
+
children: l === "24h" ? _(s) : s
|
|
720
788
|
},
|
|
721
789
|
s
|
|
722
790
|
)) })
|
|
723
791
|
] }),
|
|
724
|
-
/* @__PURE__ */
|
|
792
|
+
/* @__PURE__ */ M("div", { className: "flex flex-col items-center gap-ds-02", children: [
|
|
725
793
|
/* @__PURE__ */ t("span", { className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle", children: "Min" }),
|
|
726
|
-
/* @__PURE__ */ t("div", { className:
|
|
794
|
+
/* @__PURE__ */ t("div", { className: S(j, "min-w-[48px]"), children: N.map((s) => /* @__PURE__ */ t(
|
|
727
795
|
"button",
|
|
728
796
|
{
|
|
729
797
|
type: "button",
|
|
730
|
-
onClick: () =>
|
|
731
|
-
className:
|
|
732
|
-
|
|
733
|
-
|
|
798
|
+
onClick: () => U(s),
|
|
799
|
+
className: S(
|
|
800
|
+
K,
|
|
801
|
+
p === s ? F : a
|
|
734
802
|
),
|
|
735
|
-
"aria-label": `${
|
|
736
|
-
"aria-selected":
|
|
737
|
-
children:
|
|
803
|
+
"aria-label": `${_(s)} minutes`,
|
|
804
|
+
"aria-selected": p === s || void 0,
|
|
805
|
+
children: _(s)
|
|
738
806
|
},
|
|
739
807
|
s
|
|
740
808
|
)) })
|
|
741
809
|
] }),
|
|
742
|
-
|
|
810
|
+
x && /* @__PURE__ */ M("div", { className: "flex flex-col items-center gap-ds-02", children: [
|
|
743
811
|
/* @__PURE__ */ t("span", { className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle", children: "Sec" }),
|
|
744
|
-
/* @__PURE__ */ t("div", { className:
|
|
812
|
+
/* @__PURE__ */ t("div", { className: S(j, "min-w-[48px]"), children: Y.map((s) => /* @__PURE__ */ t(
|
|
745
813
|
"button",
|
|
746
814
|
{
|
|
747
815
|
type: "button",
|
|
748
|
-
onClick: () =>
|
|
749
|
-
className:
|
|
750
|
-
|
|
751
|
-
|
|
816
|
+
onClick: () => $(s),
|
|
817
|
+
className: S(
|
|
818
|
+
K,
|
|
819
|
+
h === s ? F : a
|
|
752
820
|
),
|
|
753
|
-
"aria-label": `${
|
|
754
|
-
"aria-selected":
|
|
755
|
-
children:
|
|
821
|
+
"aria-label": `${_(s)} seconds`,
|
|
822
|
+
"aria-selected": h === s || void 0,
|
|
823
|
+
children: _(s)
|
|
756
824
|
},
|
|
757
825
|
s
|
|
758
826
|
)) })
|
|
759
827
|
] }),
|
|
760
|
-
|
|
828
|
+
l === "12h" && /* @__PURE__ */ M("div", { className: "flex flex-col items-center gap-ds-02", children: [
|
|
761
829
|
/* @__PURE__ */ t("span", { className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle", children: " " }),
|
|
762
830
|
/* @__PURE__ */ t("div", { className: "flex flex-col gap-ds-01 px-ds-01", children: ["AM", "PM"].map((s) => /* @__PURE__ */ t(
|
|
763
831
|
"button",
|
|
764
832
|
{
|
|
765
833
|
type: "button",
|
|
766
|
-
onClick: () =>
|
|
767
|
-
className:
|
|
768
|
-
|
|
834
|
+
onClick: () => E(s),
|
|
835
|
+
className: S(
|
|
836
|
+
K,
|
|
769
837
|
"min-w-[44px] font-semibold",
|
|
770
|
-
|
|
838
|
+
g === s ? F : a
|
|
771
839
|
),
|
|
772
840
|
"aria-label": s,
|
|
773
|
-
"aria-selected":
|
|
841
|
+
"aria-selected": g === s || void 0,
|
|
774
842
|
children: s
|
|
775
843
|
},
|
|
776
844
|
s
|
|
@@ -782,119 +850,119 @@ const Le = g.forwardRef(
|
|
|
782
850
|
] });
|
|
783
851
|
}
|
|
784
852
|
);
|
|
785
|
-
|
|
786
|
-
function we(
|
|
787
|
-
return
|
|
853
|
+
Ke.displayName = "TimePicker";
|
|
854
|
+
function we(f) {
|
|
855
|
+
return f.toString().padStart(2, "0");
|
|
788
856
|
}
|
|
789
|
-
function he(
|
|
790
|
-
const
|
|
791
|
-
for (let
|
|
792
|
-
|
|
793
|
-
return
|
|
857
|
+
function he(f, e, d) {
|
|
858
|
+
const l = [];
|
|
859
|
+
for (let u = f; u <= e; u += d)
|
|
860
|
+
l.push(u);
|
|
861
|
+
return l;
|
|
794
862
|
}
|
|
795
|
-
const
|
|
863
|
+
const Fe = b.forwardRef(
|
|
796
864
|
function({
|
|
797
865
|
value: e,
|
|
798
|
-
onChange:
|
|
799
|
-
minDate:
|
|
800
|
-
maxDate:
|
|
801
|
-
disabledDates:
|
|
802
|
-
timeFormat:
|
|
803
|
-
minuteStep:
|
|
804
|
-
placeholder:
|
|
805
|
-
className:
|
|
806
|
-
...
|
|
807
|
-
},
|
|
808
|
-
const [
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
}, [
|
|
812
|
-
const
|
|
813
|
-
let o =
|
|
814
|
-
o = ne(o, e ? e.getMinutes() : A),
|
|
815
|
-
},
|
|
816
|
-
|
|
866
|
+
onChange: d,
|
|
867
|
+
minDate: l,
|
|
868
|
+
maxDate: u,
|
|
869
|
+
disabledDates: w,
|
|
870
|
+
timeFormat: x = "12h",
|
|
871
|
+
minuteStep: m = 1,
|
|
872
|
+
placeholder: v = "Pick date & time",
|
|
873
|
+
className: H,
|
|
874
|
+
...C
|
|
875
|
+
}, O) {
|
|
876
|
+
const [k, T] = b.useState(!1), [y, p] = b.useState(e ?? /* @__PURE__ */ new Date()), [h, g] = b.useState("days");
|
|
877
|
+
b.useEffect(() => {
|
|
878
|
+
k || g("days");
|
|
879
|
+
}, [k]);
|
|
880
|
+
const r = e ? e.getHours() : 0, A = e ? e.getMinutes() : 0, N = r >= 12 ? "PM" : "AM", Y = r === 0 ? 12 : r > 12 ? r - 12 : r, R = x === "12h" ? he(1, 12, 1) : he(0, 23, 1), L = he(0, 59, m), U = x === "12h" ? Y : r, $ = (n) => {
|
|
881
|
+
let o = W(n, e ? e.getHours() : r);
|
|
882
|
+
o = ne(o, e ? e.getMinutes() : A), d?.(o);
|
|
883
|
+
}, E = () => {
|
|
884
|
+
g((n) => n === "days" ? "months" : "years");
|
|
817
885
|
}, I = (n) => {
|
|
818
|
-
|
|
819
|
-
}, F = (n) => {
|
|
820
|
-
T((o) => oe(o, n)), Y("months");
|
|
886
|
+
p((o) => re(o, n)), g("days");
|
|
821
887
|
}, z = (n) => {
|
|
888
|
+
p((o) => ae(o, n)), g("months");
|
|
889
|
+
}, j = (n) => {
|
|
822
890
|
const o = e ? new Date(e) : /* @__PURE__ */ new Date();
|
|
823
|
-
let
|
|
824
|
-
|
|
825
|
-
const
|
|
826
|
-
|
|
827
|
-
},
|
|
828
|
-
const o = e ? new Date(e) : /* @__PURE__ */ new Date(),
|
|
829
|
-
|
|
830
|
-
},
|
|
831
|
-
const o = e ? new Date(e) : /* @__PURE__ */ new Date(),
|
|
832
|
-
let
|
|
833
|
-
n === "AM" ?
|
|
834
|
-
},
|
|
835
|
-
switch (
|
|
891
|
+
let i = n;
|
|
892
|
+
x === "12h" && ((e ? N : "AM") === "AM" ? i = n === 12 ? 0 : n : i = n === 12 ? 12 : n + 12);
|
|
893
|
+
const P = W(o, i);
|
|
894
|
+
d?.(P);
|
|
895
|
+
}, K = (n) => {
|
|
896
|
+
const o = e ? new Date(e) : /* @__PURE__ */ new Date(), i = ne(o, n);
|
|
897
|
+
d?.(i);
|
|
898
|
+
}, F = (n) => {
|
|
899
|
+
const o = e ? new Date(e) : /* @__PURE__ */ new Date(), i = o.getHours();
|
|
900
|
+
let P;
|
|
901
|
+
n === "AM" ? P = i >= 12 ? i - 12 : i : P = i < 12 ? i + 12 : i, d?.(W(o, P));
|
|
902
|
+
}, a = b.useMemo(() => e ? D(e, x === "12h" ? "MMM d, yyyy h:mm a" : "MMM d, yyyy HH:mm") : null, [e, x]), s = () => {
|
|
903
|
+
switch (h) {
|
|
836
904
|
case "years":
|
|
837
905
|
return /* @__PURE__ */ t(
|
|
838
906
|
ie,
|
|
839
907
|
{
|
|
840
|
-
currentYear:
|
|
908
|
+
currentYear: y.getFullYear(),
|
|
841
909
|
selectedYear: e?.getFullYear(),
|
|
842
|
-
onYearSelect:
|
|
843
|
-
minDate:
|
|
844
|
-
maxDate:
|
|
910
|
+
onYearSelect: z,
|
|
911
|
+
minDate: l,
|
|
912
|
+
maxDate: u
|
|
845
913
|
}
|
|
846
914
|
);
|
|
847
915
|
case "months":
|
|
848
916
|
return /* @__PURE__ */ t(
|
|
849
917
|
de,
|
|
850
918
|
{
|
|
851
|
-
currentYear:
|
|
919
|
+
currentYear: y.getFullYear(),
|
|
852
920
|
selectedMonth: e?.getMonth(),
|
|
853
921
|
onMonthSelect: I,
|
|
854
|
-
minDate:
|
|
855
|
-
maxDate:
|
|
922
|
+
minDate: l,
|
|
923
|
+
maxDate: u
|
|
856
924
|
}
|
|
857
925
|
);
|
|
858
926
|
default:
|
|
859
927
|
return /* @__PURE__ */ t(
|
|
860
928
|
Q,
|
|
861
929
|
{
|
|
862
|
-
currentMonth:
|
|
930
|
+
currentMonth: y,
|
|
863
931
|
selected: e,
|
|
864
|
-
onSelect:
|
|
865
|
-
onMonthChange:
|
|
866
|
-
onHeaderClick:
|
|
867
|
-
disabledDates:
|
|
868
|
-
minDate:
|
|
869
|
-
maxDate:
|
|
932
|
+
onSelect: $,
|
|
933
|
+
onMonthChange: p,
|
|
934
|
+
onHeaderClick: E,
|
|
935
|
+
disabledDates: w,
|
|
936
|
+
minDate: l,
|
|
937
|
+
maxDate: u
|
|
870
938
|
}
|
|
871
939
|
);
|
|
872
940
|
}
|
|
873
|
-
},
|
|
874
|
-
return /* @__PURE__ */
|
|
875
|
-
/* @__PURE__ */ t(ce, { asChild: !0, children: /* @__PURE__ */
|
|
941
|
+
}, c = "h-ds-sm rounded-ds-md border border-surface-border-strong bg-surface-overlay px-ds-02 text-ds-md text-surface-fg transition-colors duration-fast-01 ease-productive-standard hover:border-surface-border-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9 cursor-pointer appearance-none";
|
|
942
|
+
return /* @__PURE__ */ M(oe, { open: k, onOpenChange: T, children: [
|
|
943
|
+
/* @__PURE__ */ t(ce, { asChild: !0, children: /* @__PURE__ */ M(
|
|
876
944
|
"button",
|
|
877
945
|
{
|
|
878
|
-
ref:
|
|
946
|
+
ref: O,
|
|
879
947
|
type: "button",
|
|
880
|
-
...
|
|
881
|
-
className:
|
|
948
|
+
...C,
|
|
949
|
+
className: S(
|
|
882
950
|
"inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-surface-border-strong bg-surface-overlay px-ds-04 text-left transition-colors duration-fast-01 ease-productive-standard",
|
|
883
951
|
"hover:border-surface-border-strong",
|
|
884
952
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
|
|
885
|
-
|
|
953
|
+
H
|
|
886
954
|
),
|
|
887
|
-
"aria-label":
|
|
955
|
+
"aria-label": a ? `Selected: ${a}` : v,
|
|
888
956
|
children: [
|
|
889
|
-
/* @__PURE__ */ t(
|
|
957
|
+
/* @__PURE__ */ t(B, { icon: De, size: "sm", stroke: "light", className: "text-surface-fg-subtle" }),
|
|
890
958
|
/* @__PURE__ */ t(
|
|
891
959
|
"span",
|
|
892
960
|
{
|
|
893
|
-
className:
|
|
961
|
+
className: S(
|
|
894
962
|
"text-ds-md",
|
|
895
|
-
|
|
963
|
+
a ? "text-surface-fg" : "text-surface-fg-subtle"
|
|
896
964
|
),
|
|
897
|
-
children:
|
|
965
|
+
children: a ?? v
|
|
898
966
|
}
|
|
899
967
|
)
|
|
900
968
|
]
|
|
@@ -906,43 +974,43 @@ const Ve = g.forwardRef(
|
|
|
906
974
|
className: "w-auto border-surface-border-strong bg-surface-overlay p-ds-04",
|
|
907
975
|
align: "start",
|
|
908
976
|
sideOffset: 4,
|
|
909
|
-
children: /* @__PURE__ */
|
|
977
|
+
children: /* @__PURE__ */ M("div", { className: "flex flex-col gap-ds-04", children: [
|
|
910
978
|
s(),
|
|
911
|
-
|
|
979
|
+
h === "days" && /* @__PURE__ */ M("div", { className: "flex items-center gap-ds-02 border-t border-surface-border-strong pt-ds-04", children: [
|
|
912
980
|
/* @__PURE__ */ t("span", { className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle", children: "Time" }),
|
|
913
|
-
/* @__PURE__ */
|
|
981
|
+
/* @__PURE__ */ M(
|
|
914
982
|
"select",
|
|
915
983
|
{
|
|
916
|
-
value:
|
|
917
|
-
onChange: (n) =>
|
|
918
|
-
className:
|
|
984
|
+
value: U ?? "",
|
|
985
|
+
onChange: (n) => j(Number(n.target.value)),
|
|
986
|
+
className: c,
|
|
919
987
|
"aria-label": "Hour",
|
|
920
988
|
children: [
|
|
921
989
|
!e && /* @__PURE__ */ t("option", { value: "", children: "--" }),
|
|
922
|
-
|
|
990
|
+
R.map((n) => /* @__PURE__ */ t("option", { value: n, children: x === "24h" ? we(n) : n }, n))
|
|
923
991
|
]
|
|
924
992
|
}
|
|
925
993
|
),
|
|
926
994
|
/* @__PURE__ */ t("span", { className: "text-ds-md font-semibold text-surface-fg-subtle", children: ":" }),
|
|
927
|
-
/* @__PURE__ */
|
|
995
|
+
/* @__PURE__ */ M(
|
|
928
996
|
"select",
|
|
929
997
|
{
|
|
930
998
|
value: e ? A : "",
|
|
931
|
-
onChange: (n) =>
|
|
932
|
-
className:
|
|
999
|
+
onChange: (n) => K(Number(n.target.value)),
|
|
1000
|
+
className: c,
|
|
933
1001
|
"aria-label": "Minute",
|
|
934
1002
|
children: [
|
|
935
1003
|
!e && /* @__PURE__ */ t("option", { value: "", children: "--" }),
|
|
936
|
-
|
|
1004
|
+
L.map((n) => /* @__PURE__ */ t("option", { value: n, children: we(n) }, n))
|
|
937
1005
|
]
|
|
938
1006
|
}
|
|
939
1007
|
),
|
|
940
|
-
|
|
1008
|
+
x === "12h" && /* @__PURE__ */ M(
|
|
941
1009
|
"select",
|
|
942
1010
|
{
|
|
943
|
-
value: e ?
|
|
944
|
-
onChange: (n) =>
|
|
945
|
-
className:
|
|
1011
|
+
value: e ? N : "",
|
|
1012
|
+
onChange: (n) => F(n.target.value),
|
|
1013
|
+
className: c,
|
|
946
1014
|
"aria-label": "AM or PM",
|
|
947
1015
|
children: [
|
|
948
1016
|
!e && /* @__PURE__ */ t("option", { value: "", children: "--" }),
|
|
@@ -958,26 +1026,26 @@ const Ve = g.forwardRef(
|
|
|
958
1026
|
] });
|
|
959
1027
|
}
|
|
960
1028
|
);
|
|
961
|
-
|
|
962
|
-
function
|
|
963
|
-
const [e,
|
|
1029
|
+
Fe.displayName = "DateTimePicker";
|
|
1030
|
+
function _e(f) {
|
|
1031
|
+
const [e, d] = Ce(f ?? /* @__PURE__ */ new Date());
|
|
964
1032
|
return {
|
|
965
1033
|
currentMonth: e,
|
|
966
|
-
setCurrentMonth:
|
|
967
|
-
goToPreviousMonth: () =>
|
|
968
|
-
goToNextMonth: () =>
|
|
969
|
-
goToMonth: (
|
|
970
|
-
goToYear: (
|
|
1034
|
+
setCurrentMonth: d,
|
|
1035
|
+
goToPreviousMonth: () => d((m) => be(m, 1)),
|
|
1036
|
+
goToNextMonth: () => d((m) => se(m, 1)),
|
|
1037
|
+
goToMonth: (m) => d((v) => re(v, m)),
|
|
1038
|
+
goToYear: (m) => d((v) => ae(v, m))
|
|
971
1039
|
};
|
|
972
1040
|
}
|
|
973
1041
|
export {
|
|
974
1042
|
Q as C,
|
|
975
1043
|
Ie as D,
|
|
976
1044
|
de as M,
|
|
977
|
-
|
|
978
|
-
|
|
1045
|
+
ke as P,
|
|
1046
|
+
Ke as T,
|
|
979
1047
|
ie as Y,
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
1048
|
+
je as a,
|
|
1049
|
+
Fe as b,
|
|
1050
|
+
_e as u
|
|
983
1051
|
};
|