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