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