@devalok/shilp-sutra 0.22.2 → 0.23.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/tree-view.js +26 -26
- package/dist/_chunks/use-calendar.js +106 -106
- package/dist/composed/activity-feed.js +10 -10
- package/dist/composed/avatar-group.js +74 -75
- package/dist/composed/command-palette.js +8 -8
- package/dist/composed/content-card.js +10 -10
- package/dist/composed/empty-state.js +6 -6
- package/dist/composed/error-boundary.js +2 -2
- package/dist/composed/loading-skeleton.js +83 -83
- package/dist/composed/member-picker.js +6 -6
- package/dist/composed/page-skeletons.js +5 -5
- package/dist/composed/rich-text-editor.js +63 -63
- package/dist/composed/schedule-view.js +26 -26
- package/dist/composed/status-badge.js +8 -8
- package/dist/shell/bottom-navbar.js +4 -4
- package/dist/shell/notification-center.js +29 -29
- package/dist/shell/notification-preferences.js +2 -2
- package/dist/shell/sidebar.js +6 -6
- package/dist/shell/top-bar.js +71 -71
- package/dist/tailwind/index.cjs +33 -11
- package/dist/tailwind/preset.d.ts.map +1 -1
- package/dist/tailwind/preset.js +33 -11
- package/dist/tokens/primitives.css +2 -0
- package/dist/tokens/semantic.css +83 -14
- package/dist/tokens/typography.css +1 -1
- package/dist/ui/accordion.js +1 -1
- package/dist/ui/alert-dialog.js +32 -32
- package/dist/ui/alert.js +12 -12
- package/dist/ui/autocomplete.js +16 -16
- package/dist/ui/avatar.d.ts.map +1 -1
- package/dist/ui/avatar.js +81 -74
- package/dist/ui/badge.js +2 -2
- package/dist/ui/banner.js +1 -1
- package/dist/ui/button.js +8 -8
- package/dist/ui/card.d.ts +1 -1
- package/dist/ui/card.js +10 -10
- package/dist/ui/charts/index.js +312 -312
- package/dist/ui/checkbox.js +3 -3
- package/dist/ui/chip.js +4 -4
- package/dist/ui/code.js +2 -2
- package/dist/ui/color-input.js +1 -1
- package/dist/ui/combobox.js +37 -37
- package/dist/ui/context-menu.js +6 -6
- package/dist/ui/data-table-toolbar.js +18 -18
- package/dist/ui/data-table.js +132 -132
- package/dist/ui/dialog.js +12 -12
- package/dist/ui/dropdown-menu.js +67 -67
- package/dist/ui/file-upload.js +3 -3
- package/dist/ui/hover-card.js +13 -13
- package/dist/ui/input-otp.js +9 -9
- package/dist/ui/input.js +10 -10
- package/dist/ui/menubar.js +33 -33
- package/dist/ui/navigation-menu.js +52 -52
- package/dist/ui/number-input.js +14 -14
- package/dist/ui/pagination.js +25 -25
- package/dist/ui/popover.js +17 -17
- package/dist/ui/progress.js +1 -1
- package/dist/ui/radio.js +2 -2
- package/dist/ui/search-input.js +3 -3
- package/dist/ui/segmented-control.d.ts +1 -1
- package/dist/ui/segmented-control.js +16 -16
- package/dist/ui/select.js +17 -17
- package/dist/ui/sheet.js +21 -21
- package/dist/ui/sidebar.js +13 -13
- package/dist/ui/slider.js +2 -2
- package/dist/ui/stat-card.js +52 -52
- package/dist/ui/stepper.js +1 -1
- package/dist/ui/switch.js +11 -11
- package/dist/ui/table.js +19 -19
- package/dist/ui/tabs.js +2 -2
- package/dist/ui/textarea.js +6 -6
- package/dist/ui/toast.js +3 -3
- package/dist/ui/toggle.js +7 -7
- package/dist/ui/tooltip.js +17 -17
- package/docs/components/composed/avatar-group.md +5 -0
- package/docs/components/ui/avatar.md +4 -0
- package/llms-full.txt +10 -1
- package/llms.txt +66 -5
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import * as
|
|
2
|
+
import { jsxs as p, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import * as h from "react";
|
|
4
4
|
import { useState as Pe } from "react";
|
|
5
5
|
import { format as D, startOfMonth as z, endOfMonth as me, startOfWeek as Se, endOfWeek as Ye, addDays as _, subMonths as be, addMonths as te, isSameMonth as ge, isSameDay as X, lastDayOfMonth as Re, isBefore as C, startOfDay as K, isAfter as ee, isWithinInterval as xe, setMonth as re, setYear as ne, endOfDay as U, startOfYear as Te, subDays as ue, setHours as J, setMinutes as se, setSeconds as ye } from "date-fns";
|
|
6
6
|
import { IconChevronLeft as Ae, IconChevronRight as He, IconCalendarEvent as we, IconClock as Oe, IconCalendarClock as De } from "@tabler/icons-react";
|
|
7
7
|
import { cn as y } from "../ui/lib/utils.js";
|
|
8
8
|
import { Popover as ce, PopoverTrigger as oe, PopoverContent as ae } from "../ui/popover.js";
|
|
9
|
-
const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q =
|
|
9
|
+
const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = h.forwardRef(
|
|
10
10
|
function({
|
|
11
11
|
currentMonth: e,
|
|
12
12
|
selected: n,
|
|
@@ -16,7 +16,7 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = p.forwardRef(
|
|
|
16
16
|
onSelect: b,
|
|
17
17
|
onHover: f,
|
|
18
18
|
onMonthChange: x,
|
|
19
|
-
onHeaderClick:
|
|
19
|
+
onHeaderClick: k,
|
|
20
20
|
disabledDates: P,
|
|
21
21
|
minDate: M,
|
|
22
22
|
maxDate: w,
|
|
@@ -26,7 +26,7 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = p.forwardRef(
|
|
|
26
26
|
className: Y,
|
|
27
27
|
...R
|
|
28
28
|
}, m) {
|
|
29
|
-
const O =
|
|
29
|
+
const O = h.useRef(null), H = h.useMemo(() => {
|
|
30
30
|
const c = /* @__PURE__ */ new Map();
|
|
31
31
|
if (!A) return c;
|
|
32
32
|
for (const s of A) {
|
|
@@ -88,14 +88,14 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = p.forwardRef(
|
|
|
88
88
|
}
|
|
89
89
|
o && (c.preventDefault(), F(o));
|
|
90
90
|
};
|
|
91
|
-
return /* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */
|
|
91
|
+
return /* @__PURE__ */ p("div", { ref: m, ...R, className: y("w-[252px]", Y), children: [
|
|
92
|
+
/* @__PURE__ */ p("div", { className: "flex items-center justify-between px-ds-02 pb-ds-04", children: [
|
|
93
93
|
T ? /* @__PURE__ */ t("span", { className: "h-ds-xs-plus w-ds-xs-plus" }) : /* @__PURE__ */ t(
|
|
94
94
|
"button",
|
|
95
95
|
{
|
|
96
96
|
type: "button",
|
|
97
97
|
onClick: () => x(be(e, 1)),
|
|
98
|
-
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-
|
|
98
|
+
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
99
|
"aria-label": "Previous month",
|
|
100
100
|
children: /* @__PURE__ */ t(Ae, { className: "h-ico-sm w-ico-sm", stroke: 1.5 })
|
|
101
101
|
}
|
|
@@ -104,10 +104,10 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = p.forwardRef(
|
|
|
104
104
|
"button",
|
|
105
105
|
{
|
|
106
106
|
type: "button",
|
|
107
|
-
onClick:
|
|
107
|
+
onClick: k,
|
|
108
108
|
className: y(
|
|
109
109
|
"text-ds-md font-semibold text-surface-fg",
|
|
110
|
-
|
|
110
|
+
k && "cursor-pointer rounded-ds-md px-ds-02 transition-colors duration-fast-01 ease-productive-standard hover:bg-surface-raised-hover"
|
|
111
111
|
),
|
|
112
112
|
"aria-label": "Switch to month/year view",
|
|
113
113
|
children: D(e, "MMMM yyyy")
|
|
@@ -118,13 +118,13 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = p.forwardRef(
|
|
|
118
118
|
{
|
|
119
119
|
type: "button",
|
|
120
120
|
onClick: () => x(te(e, 1)),
|
|
121
|
-
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-
|
|
121
|
+
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
122
|
"aria-label": "Next month",
|
|
123
123
|
children: /* @__PURE__ */ t(He, { className: "h-ico-sm w-ico-sm", stroke: 1.5 })
|
|
124
124
|
}
|
|
125
125
|
)
|
|
126
126
|
] }),
|
|
127
|
-
/* @__PURE__ */
|
|
127
|
+
/* @__PURE__ */ p(
|
|
128
128
|
"div",
|
|
129
129
|
{
|
|
130
130
|
ref: O,
|
|
@@ -144,13 +144,13 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = p.forwardRef(
|
|
|
144
144
|
c
|
|
145
145
|
)),
|
|
146
146
|
L.map((c, s) => {
|
|
147
|
-
const l = ge(c, e), r = I(c), o = n && X(c, n), i = B(c),
|
|
148
|
-
return /* @__PURE__ */
|
|
147
|
+
const l = ge(c, e), r = I(c), o = n && X(c, n), i = B(c), v = V(c), de = X(c, /* @__PURE__ */ new Date()), he = D(c, "yyyy-MM-dd"), pe = H.get(he) ?? [];
|
|
148
|
+
return /* @__PURE__ */ p(
|
|
149
149
|
"button",
|
|
150
150
|
{
|
|
151
151
|
type: "button",
|
|
152
152
|
role: "gridcell",
|
|
153
|
-
"data-date":
|
|
153
|
+
"data-date": he,
|
|
154
154
|
tabIndex: l && !r ? 0 : -1,
|
|
155
155
|
disabled: !l || r,
|
|
156
156
|
onClick: () => {
|
|
@@ -159,27 +159,27 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = p.forwardRef(
|
|
|
159
159
|
onMouseEnter: () => f == null ? void 0 : f(c),
|
|
160
160
|
onMouseLeave: () => f == null ? void 0 : f(null),
|
|
161
161
|
"aria-label": D(c, "EEEE, MMMM d, yyyy"),
|
|
162
|
-
"aria-selected": o ||
|
|
162
|
+
"aria-selected": o || v || void 0,
|
|
163
163
|
"aria-disabled": !l || r || void 0,
|
|
164
164
|
className: y(
|
|
165
165
|
"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
166
|
!l && "pointer-events-none opacity-0",
|
|
167
167
|
l && r && "opacity-action-disabled pointer-events-none cursor-not-allowed",
|
|
168
|
-
l && !r && !o && !
|
|
169
|
-
i && !
|
|
170
|
-
(o ||
|
|
171
|
-
de && !o && !
|
|
168
|
+
l && !r && !o && !v && !i && "text-surface-fg hover:bg-surface-raised-hover",
|
|
169
|
+
i && !v && "rounded-ds-none bg-surface-raised-hover text-surface-fg",
|
|
170
|
+
(o || v) && "bg-accent-9 text-accent-fg hover:bg-accent-10",
|
|
171
|
+
de && !o && !v && !r && "font-semibold text-accent-11"
|
|
172
172
|
),
|
|
173
173
|
children: [
|
|
174
174
|
D(c, "d"),
|
|
175
|
-
|
|
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((ve, ke) => /* @__PURE__ */ t(
|
|
176
176
|
"span",
|
|
177
177
|
{
|
|
178
178
|
"data-event-dot": !0,
|
|
179
179
|
className: "h-[4px] w-[4px] rounded-ds-full",
|
|
180
|
-
style: { backgroundColor:
|
|
180
|
+
style: { backgroundColor: ve.color ?? "var(--color-accent-9)" }
|
|
181
181
|
},
|
|
182
|
-
|
|
182
|
+
ke
|
|
183
183
|
)) })
|
|
184
184
|
]
|
|
185
185
|
},
|
|
@@ -193,7 +193,7 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = p.forwardRef(
|
|
|
193
193
|
}
|
|
194
194
|
);
|
|
195
195
|
Q.displayName = "CalendarGrid";
|
|
196
|
-
const le =
|
|
196
|
+
const le = h.forwardRef(
|
|
197
197
|
function({
|
|
198
198
|
currentYear: e,
|
|
199
199
|
selectedYear: n,
|
|
@@ -203,12 +203,12 @@ const le = p.forwardRef(
|
|
|
203
203
|
className: b,
|
|
204
204
|
...f
|
|
205
205
|
}, x) {
|
|
206
|
-
const
|
|
207
|
-
return /* @__PURE__ */
|
|
208
|
-
/* @__PURE__ */
|
|
209
|
-
|
|
206
|
+
const k = Math.floor(e / 10) * 10, P = Array.from({ length: 12 }, (M, w) => k + w);
|
|
207
|
+
return /* @__PURE__ */ p("div", { ref: x, ...f, className: y("w-[252px]", b), children: [
|
|
208
|
+
/* @__PURE__ */ p("div", { className: "text-center pb-ds-04 text-ds-md font-semibold text-surface-fg", children: [
|
|
209
|
+
k,
|
|
210
210
|
" – ",
|
|
211
|
-
|
|
211
|
+
k + 11
|
|
212
212
|
] }),
|
|
213
213
|
/* @__PURE__ */ t("div", { className: "grid grid-cols-3 gap-ds-02", children: P.map((M) => {
|
|
214
214
|
const w = M === n, T = d != null && M < d.getFullYear() || g != null && M > g.getFullYear();
|
|
@@ -222,7 +222,7 @@ const le = p.forwardRef(
|
|
|
222
222
|
"h-ds-sm-plus rounded-ds-md text-ds-md transition-colors",
|
|
223
223
|
T && "opacity-action-disabled pointer-events-none cursor-not-allowed",
|
|
224
224
|
w && "bg-accent-9 text-accent-fg",
|
|
225
|
-
!w && !T && "hover:bg-surface-
|
|
225
|
+
!w && !T && "hover:bg-surface-raised-hover text-surface-fg"
|
|
226
226
|
),
|
|
227
227
|
children: M
|
|
228
228
|
},
|
|
@@ -246,7 +246,7 @@ const $e = [
|
|
|
246
246
|
"Oct",
|
|
247
247
|
"Nov",
|
|
248
248
|
"Dec"
|
|
249
|
-
], ie =
|
|
249
|
+
], ie = h.forwardRef(
|
|
250
250
|
function({
|
|
251
251
|
currentYear: e,
|
|
252
252
|
selectedMonth: n,
|
|
@@ -256,9 +256,9 @@ const $e = [
|
|
|
256
256
|
className: b,
|
|
257
257
|
...f
|
|
258
258
|
}, x) {
|
|
259
|
-
return /* @__PURE__ */
|
|
259
|
+
return /* @__PURE__ */ p("div", { ref: x, ...f, className: y("w-[252px]", b), children: [
|
|
260
260
|
/* @__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((
|
|
261
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-4 gap-ds-02", children: $e.map((k, P) => {
|
|
262
262
|
const M = P === n, w = d != null && (e < d.getFullYear() || e === d.getFullYear() && P < d.getMonth()) || g != null && (e > g.getFullYear() || e === g.getFullYear() && P > g.getMonth());
|
|
263
263
|
return /* @__PURE__ */ t(
|
|
264
264
|
"button",
|
|
@@ -270,18 +270,18 @@ const $e = [
|
|
|
270
270
|
"h-ds-sm-plus rounded-ds-md text-ds-md transition-colors",
|
|
271
271
|
w && "opacity-action-disabled pointer-events-none cursor-not-allowed",
|
|
272
272
|
M && "bg-accent-9 text-accent-fg",
|
|
273
|
-
!M && !w && "hover:bg-surface-
|
|
273
|
+
!M && !w && "hover:bg-surface-raised-hover text-surface-fg"
|
|
274
274
|
),
|
|
275
|
-
children:
|
|
275
|
+
children: k
|
|
276
276
|
},
|
|
277
|
-
|
|
277
|
+
k
|
|
278
278
|
);
|
|
279
279
|
}) })
|
|
280
280
|
] });
|
|
281
281
|
}
|
|
282
282
|
);
|
|
283
283
|
ie.displayName = "MonthPicker";
|
|
284
|
-
const je =
|
|
284
|
+
const je = h.forwardRef(
|
|
285
285
|
function({
|
|
286
286
|
value: e,
|
|
287
287
|
onChange: n,
|
|
@@ -291,12 +291,12 @@ const je = p.forwardRef(
|
|
|
291
291
|
minDate: b,
|
|
292
292
|
maxDate: f,
|
|
293
293
|
disabledDates: x,
|
|
294
|
-
...
|
|
294
|
+
...k
|
|
295
295
|
}, P) {
|
|
296
|
-
const [M, w] =
|
|
296
|
+
const [M, w] = h.useState(!1), [T, N] = h.useState(
|
|
297
297
|
e ?? /* @__PURE__ */ new Date()
|
|
298
|
-
), [A, Y] =
|
|
299
|
-
|
|
298
|
+
), [A, Y] = h.useState("days");
|
|
299
|
+
h.useEffect(() => {
|
|
300
300
|
M || Y("days");
|
|
301
301
|
}, [M]);
|
|
302
302
|
const R = (S) => {
|
|
@@ -347,16 +347,16 @@ const je = p.forwardRef(
|
|
|
347
347
|
);
|
|
348
348
|
}
|
|
349
349
|
};
|
|
350
|
-
return /* @__PURE__ */
|
|
351
|
-
/* @__PURE__ */ t(oe, { asChild: !0, children: /* @__PURE__ */
|
|
350
|
+
return /* @__PURE__ */ p(ce, { open: M, onOpenChange: w, children: [
|
|
351
|
+
/* @__PURE__ */ t(oe, { asChild: !0, children: /* @__PURE__ */ p(
|
|
352
352
|
"button",
|
|
353
353
|
{
|
|
354
354
|
ref: P,
|
|
355
355
|
type: "button",
|
|
356
356
|
"aria-label": e ? `Change date, ${D(e, g)}` : a,
|
|
357
|
-
...
|
|
357
|
+
...k,
|
|
358
358
|
className: y(
|
|
359
|
-
"inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-surface-border-strong bg-surface-
|
|
359
|
+
"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
360
|
"hover:border-surface-border-strong",
|
|
361
361
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
|
|
362
362
|
d
|
|
@@ -385,7 +385,7 @@ const je = p.forwardRef(
|
|
|
385
385
|
/* @__PURE__ */ t(
|
|
386
386
|
ae,
|
|
387
387
|
{
|
|
388
|
-
className: "w-auto border-surface-border-strong bg-surface-
|
|
388
|
+
className: "w-auto border-surface-border-strong bg-surface-overlay p-ds-04",
|
|
389
389
|
align: "start",
|
|
390
390
|
sideOffset: 4,
|
|
391
391
|
children: E()
|
|
@@ -445,7 +445,7 @@ const Ie = {
|
|
|
445
445
|
return { start: Te(u), end: U(u) };
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
|
-
}, Ne =
|
|
448
|
+
}, Ne = h.forwardRef(
|
|
449
449
|
function({ presets: e, onSelect: n, className: a, ...d }, g) {
|
|
450
450
|
return /* @__PURE__ */ t("div", { ref: g, ...d, className: y("flex flex-col gap-ds-01", a), children: e.map((b) => {
|
|
451
451
|
const f = Ie[b];
|
|
@@ -454,13 +454,13 @@ const Ie = {
|
|
|
454
454
|
{
|
|
455
455
|
type: "button",
|
|
456
456
|
onClick: () => {
|
|
457
|
-
const { start: x, end:
|
|
458
|
-
n(x,
|
|
457
|
+
const { start: x, end: k } = f.getRange();
|
|
458
|
+
n(x, k);
|
|
459
459
|
},
|
|
460
460
|
className: y(
|
|
461
461
|
"h-ds-sm w-full rounded-ds-md px-ds-03 text-left text-ds-sm",
|
|
462
462
|
"text-surface-fg transition-colors",
|
|
463
|
-
"hover:bg-surface-
|
|
463
|
+
"hover:bg-surface-raised-hover",
|
|
464
464
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9"
|
|
465
465
|
),
|
|
466
466
|
children: f.label
|
|
@@ -471,7 +471,7 @@ const Ie = {
|
|
|
471
471
|
}
|
|
472
472
|
);
|
|
473
473
|
Ne.displayName = "Presets";
|
|
474
|
-
const Le =
|
|
474
|
+
const Le = h.forwardRef(
|
|
475
475
|
function({
|
|
476
476
|
startDate: e,
|
|
477
477
|
endDate: n,
|
|
@@ -481,29 +481,29 @@ const Le = p.forwardRef(
|
|
|
481
481
|
formatStr: b = "MMM d, yyyy",
|
|
482
482
|
minDate: f,
|
|
483
483
|
maxDate: x,
|
|
484
|
-
disabledDates:
|
|
484
|
+
disabledDates: k,
|
|
485
485
|
presets: P,
|
|
486
486
|
numberOfMonths: M = 1,
|
|
487
487
|
...w
|
|
488
488
|
}, T) {
|
|
489
|
-
const [N, A] =
|
|
489
|
+
const [N, A] = h.useState(!1), [Y, R] = h.useState(
|
|
490
490
|
e ?? /* @__PURE__ */ new Date()
|
|
491
|
-
), [m, O] =
|
|
491
|
+
), [m, O] = h.useState(
|
|
492
492
|
e ?? null
|
|
493
|
-
), [H, E] =
|
|
493
|
+
), [H, E] = h.useState(
|
|
494
494
|
n ?? null
|
|
495
|
-
), [S, $] =
|
|
496
|
-
|
|
495
|
+
), [S, $] = h.useState(null), [G, L] = h.useState("days"), j = Math.max(1, M);
|
|
496
|
+
h.useEffect(() => {
|
|
497
497
|
O(e ?? null), E(n ?? null);
|
|
498
|
-
}, [e, n]),
|
|
498
|
+
}, [e, n]), h.useEffect(() => {
|
|
499
499
|
N || L("days");
|
|
500
500
|
}, [N]);
|
|
501
501
|
const I = (o) => {
|
|
502
502
|
if (!m || m && H)
|
|
503
503
|
O(o), E(null);
|
|
504
504
|
else {
|
|
505
|
-
const i = C(o, m) ? o : m,
|
|
506
|
-
O(i), E(
|
|
505
|
+
const i = C(o, m) ? o : m, v = ee(o, m) ? o : m;
|
|
506
|
+
O(i), E(v), a == null || a({ start: i, end: v }), A(!1);
|
|
507
507
|
}
|
|
508
508
|
}, B = (o, i) => {
|
|
509
509
|
O(o), E(i), a == null || a({ start: o, end: i }), A(!1);
|
|
@@ -524,7 +524,7 @@ const Le = p.forwardRef(
|
|
|
524
524
|
onHover: $,
|
|
525
525
|
onMonthChange: R,
|
|
526
526
|
onHeaderClick: V,
|
|
527
|
-
disabledDates:
|
|
527
|
+
disabledDates: k,
|
|
528
528
|
minDate: f,
|
|
529
529
|
maxDate: x
|
|
530
530
|
}
|
|
@@ -537,11 +537,11 @@ const Le = p.forwardRef(
|
|
|
537
537
|
hoverDate: S,
|
|
538
538
|
onSelect: I,
|
|
539
539
|
onHover: $,
|
|
540
|
-
onMonthChange: (
|
|
541
|
-
R(te(
|
|
540
|
+
onMonthChange: (v) => {
|
|
541
|
+
R(te(v, -i));
|
|
542
542
|
},
|
|
543
543
|
onHeaderClick: V,
|
|
544
|
-
disabledDates:
|
|
544
|
+
disabledDates: k,
|
|
545
545
|
minDate: f,
|
|
546
546
|
maxDate: x,
|
|
547
547
|
hidePrevNav: i > 0,
|
|
@@ -576,8 +576,8 @@ const Le = p.forwardRef(
|
|
|
576
576
|
return s();
|
|
577
577
|
}
|
|
578
578
|
}, r = P && P.length > 0;
|
|
579
|
-
return /* @__PURE__ */
|
|
580
|
-
/* @__PURE__ */ t(oe, { asChild: !0, children: /* @__PURE__ */
|
|
579
|
+
return /* @__PURE__ */ p(ce, { open: N, onOpenChange: A, children: [
|
|
580
|
+
/* @__PURE__ */ t(oe, { asChild: !0, children: /* @__PURE__ */ p(
|
|
581
581
|
"button",
|
|
582
582
|
{
|
|
583
583
|
ref: T,
|
|
@@ -585,7 +585,7 @@ const Le = p.forwardRef(
|
|
|
585
585
|
"aria-label": m && H ? `Change date range, ${c()}` : d,
|
|
586
586
|
...w,
|
|
587
587
|
className: y(
|
|
588
|
-
"inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-surface-border-strong bg-surface-
|
|
588
|
+
"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
589
|
"hover:border-surface-border-strong",
|
|
590
590
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
|
|
591
591
|
g
|
|
@@ -614,10 +614,10 @@ const Le = p.forwardRef(
|
|
|
614
614
|
/* @__PURE__ */ t(
|
|
615
615
|
ae,
|
|
616
616
|
{
|
|
617
|
-
className: "w-auto border-surface-border-strong bg-surface-
|
|
617
|
+
className: "w-auto border-surface-border-strong bg-surface-overlay p-ds-04",
|
|
618
618
|
align: "start",
|
|
619
619
|
sideOffset: 4,
|
|
620
|
-
children: r ? /* @__PURE__ */
|
|
620
|
+
children: r ? /* @__PURE__ */ p("div", { className: "flex flex-row gap-ds-04", children: [
|
|
621
621
|
/* @__PURE__ */ t("div", { className: "min-w-[140px] border-r border-surface-border-strong pr-ds-04", children: /* @__PURE__ */ t(Ne, { presets: P, onSelect: B }) }),
|
|
622
622
|
/* @__PURE__ */ t("div", { children: l() })
|
|
623
623
|
] }) : l()
|
|
@@ -636,7 +636,7 @@ function Z(u, e, n) {
|
|
|
636
636
|
function q(u) {
|
|
637
637
|
return u.toString().padStart(2, "0");
|
|
638
638
|
}
|
|
639
|
-
const Ve =
|
|
639
|
+
const Ve = h.forwardRef(
|
|
640
640
|
function({
|
|
641
641
|
value: e,
|
|
642
642
|
onChange: n,
|
|
@@ -646,16 +646,16 @@ const Ve = p.forwardRef(
|
|
|
646
646
|
showSeconds: b = !1,
|
|
647
647
|
placeholder: f = "Pick a time",
|
|
648
648
|
className: x,
|
|
649
|
-
disabled:
|
|
649
|
+
disabled: k = !1,
|
|
650
650
|
...P
|
|
651
651
|
}, M) {
|
|
652
|
-
const [w, T] =
|
|
652
|
+
const [w, T] = h.useState(!1), N = e ? e.getHours() : null, A = e ? e.getMinutes() : null, Y = e ? e.getSeconds() : null, R = N !== null ? N >= 12 ? "PM" : "AM" : null, m = N !== null ? N === 0 ? 12 : N > 12 ? N - 12 : N : null, O = a === "12h" ? Z(1, 12, 1) : Z(0, 23, 1), H = Z(0, 59, d), E = Z(0, 59, g), S = (s) => {
|
|
653
653
|
const l = e ? new Date(e) : /* @__PURE__ */ new Date();
|
|
654
654
|
let r = s.hours ?? l.getHours();
|
|
655
655
|
const o = s.minutes ?? l.getMinutes(), i = s.seconds ?? l.getSeconds();
|
|
656
656
|
a === "12h" && s.hours !== void 0 && ((s.ampm ?? R ?? "AM") === "AM" ? r = s.hours === 12 ? 0 : s.hours : r = s.hours === 12 ? 12 : s.hours + 12);
|
|
657
|
-
let
|
|
658
|
-
return
|
|
657
|
+
let v = J(l, r);
|
|
658
|
+
return v = se(v, o), v = ye(v, i), v;
|
|
659
659
|
}, $ = (s) => {
|
|
660
660
|
const l = S({ hours: s });
|
|
661
661
|
n == null || n(l);
|
|
@@ -675,20 +675,20 @@ const Ve = p.forwardRef(
|
|
|
675
675
|
const l = e.getHours();
|
|
676
676
|
let r;
|
|
677
677
|
s === "AM" ? r = l >= 12 ? l - 12 : l : r = l < 12 ? l + 12 : l, n == null || n(J(new Date(e), r));
|
|
678
|
-
}, I =
|
|
679
|
-
return /* @__PURE__ */
|
|
680
|
-
/* @__PURE__ */ t(oe, { asChild: !0, children: /* @__PURE__ */
|
|
678
|
+
}, I = h.useMemo(() => e ? a === "12h" ? D(e, b ? "h:mm:ss a" : "h:mm a") : D(e, b ? "HH:mm:ss" : "HH:mm") : null, [e, a, b]), B = a === "12h" ? m : 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", W = "bg-accent-9 text-accent-fg", c = "text-surface-fg hover:bg-surface-raised-hover";
|
|
679
|
+
return /* @__PURE__ */ p(ce, { open: w, onOpenChange: T, children: [
|
|
680
|
+
/* @__PURE__ */ t(oe, { asChild: !0, children: /* @__PURE__ */ p(
|
|
681
681
|
"button",
|
|
682
682
|
{
|
|
683
683
|
ref: M,
|
|
684
684
|
type: "button",
|
|
685
|
-
disabled:
|
|
685
|
+
disabled: k,
|
|
686
686
|
...P,
|
|
687
687
|
className: y(
|
|
688
|
-
"inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-surface-border-strong bg-surface-
|
|
688
|
+
"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
689
|
"hover:border-surface-border-strong",
|
|
690
690
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
|
|
691
|
-
|
|
691
|
+
k && "opacity-action-disabled pointer-events-none",
|
|
692
692
|
x
|
|
693
693
|
),
|
|
694
694
|
"aria-label": I ? `Selected time: ${I}` : f,
|
|
@@ -716,11 +716,11 @@ const Ve = p.forwardRef(
|
|
|
716
716
|
/* @__PURE__ */ t(
|
|
717
717
|
ae,
|
|
718
718
|
{
|
|
719
|
-
className: "w-auto border-surface-border-strong bg-surface-
|
|
719
|
+
className: "w-auto border-surface-border-strong bg-surface-overlay p-ds-04",
|
|
720
720
|
align: "start",
|
|
721
721
|
sideOffset: 4,
|
|
722
|
-
children: /* @__PURE__ */
|
|
723
|
-
/* @__PURE__ */
|
|
722
|
+
children: /* @__PURE__ */ p("div", { className: "flex gap-ds-03", role: "group", "aria-label": "Time picker", children: [
|
|
723
|
+
/* @__PURE__ */ p("div", { className: "flex flex-col items-center gap-ds-02", children: [
|
|
724
724
|
/* @__PURE__ */ t("span", { className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle", children: "Hr" }),
|
|
725
725
|
/* @__PURE__ */ t("div", { className: y(V, "min-w-[48px]"), children: O.map((s) => /* @__PURE__ */ t(
|
|
726
726
|
"button",
|
|
@@ -738,7 +738,7 @@ const Ve = p.forwardRef(
|
|
|
738
738
|
s
|
|
739
739
|
)) })
|
|
740
740
|
] }),
|
|
741
|
-
/* @__PURE__ */
|
|
741
|
+
/* @__PURE__ */ p("div", { className: "flex flex-col items-center gap-ds-02", children: [
|
|
742
742
|
/* @__PURE__ */ t("span", { className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle", children: "Min" }),
|
|
743
743
|
/* @__PURE__ */ t("div", { className: y(V, "min-w-[48px]"), children: H.map((s) => /* @__PURE__ */ t(
|
|
744
744
|
"button",
|
|
@@ -756,7 +756,7 @@ const Ve = p.forwardRef(
|
|
|
756
756
|
s
|
|
757
757
|
)) })
|
|
758
758
|
] }),
|
|
759
|
-
b && /* @__PURE__ */
|
|
759
|
+
b && /* @__PURE__ */ p("div", { className: "flex flex-col items-center gap-ds-02", children: [
|
|
760
760
|
/* @__PURE__ */ t("span", { className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle", children: "Sec" }),
|
|
761
761
|
/* @__PURE__ */ t("div", { className: y(V, "min-w-[48px]"), children: E.map((s) => /* @__PURE__ */ t(
|
|
762
762
|
"button",
|
|
@@ -774,7 +774,7 @@ const Ve = p.forwardRef(
|
|
|
774
774
|
s
|
|
775
775
|
)) })
|
|
776
776
|
] }),
|
|
777
|
-
a === "12h" && /* @__PURE__ */
|
|
777
|
+
a === "12h" && /* @__PURE__ */ p("div", { className: "flex flex-col items-center gap-ds-02", children: [
|
|
778
778
|
/* @__PURE__ */ t("span", { className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle", children: " " }),
|
|
779
779
|
/* @__PURE__ */ t("div", { className: "flex flex-col gap-ds-01 px-ds-01", children: ["AM", "PM"].map((s) => /* @__PURE__ */ t(
|
|
780
780
|
"button",
|
|
@@ -809,7 +809,7 @@ function fe(u, e, n) {
|
|
|
809
809
|
a.push(d);
|
|
810
810
|
return a;
|
|
811
811
|
}
|
|
812
|
-
const Fe =
|
|
812
|
+
const Fe = h.forwardRef(
|
|
813
813
|
function({
|
|
814
814
|
value: e,
|
|
815
815
|
onChange: n,
|
|
@@ -819,11 +819,11 @@ const Fe = p.forwardRef(
|
|
|
819
819
|
timeFormat: b = "12h",
|
|
820
820
|
minuteStep: f = 1,
|
|
821
821
|
placeholder: x = "Pick date & time",
|
|
822
|
-
className:
|
|
822
|
+
className: k,
|
|
823
823
|
...P
|
|
824
824
|
}, M) {
|
|
825
|
-
const [w, T] =
|
|
826
|
-
|
|
825
|
+
const [w, T] = h.useState(!1), [N, A] = h.useState(e ?? /* @__PURE__ */ new Date()), [Y, R] = h.useState("days");
|
|
826
|
+
h.useEffect(() => {
|
|
827
827
|
w || R("days");
|
|
828
828
|
}, [w]);
|
|
829
829
|
const m = e ? e.getHours() : 0, O = e ? e.getMinutes() : 0, H = m >= 12 ? "PM" : "AM", E = m === 0 ? 12 : m > 12 ? m - 12 : m, S = b === "12h" ? fe(1, 12, 1) : fe(0, 23, 1), $ = fe(0, 59, f), G = b === "12h" ? E : m, L = (r) => {
|
|
@@ -839,16 +839,16 @@ const Fe = p.forwardRef(
|
|
|
839
839
|
const o = e ? new Date(e) : /* @__PURE__ */ new Date();
|
|
840
840
|
let i = r;
|
|
841
841
|
b === "12h" && ((e ? H : "AM") === "AM" ? i = r === 12 ? 0 : r : i = r === 12 ? 12 : r + 12);
|
|
842
|
-
const
|
|
843
|
-
n == null || n(
|
|
842
|
+
const v = J(o, i);
|
|
843
|
+
n == null || n(v);
|
|
844
844
|
}, F = (r) => {
|
|
845
845
|
const o = e ? new Date(e) : /* @__PURE__ */ new Date(), i = se(o, r);
|
|
846
846
|
n == null || n(i);
|
|
847
847
|
}, W = (r) => {
|
|
848
848
|
const o = e ? new Date(e) : /* @__PURE__ */ new Date(), i = o.getHours();
|
|
849
|
-
let
|
|
850
|
-
r === "AM" ?
|
|
851
|
-
}, c =
|
|
849
|
+
let v;
|
|
850
|
+
r === "AM" ? v = i >= 12 ? i - 12 : i : v = i < 12 ? i + 12 : i, n == null || n(J(o, v));
|
|
851
|
+
}, c = h.useMemo(() => e ? D(e, b === "12h" ? "MMM d, yyyy h:mm a" : "MMM d, yyyy HH:mm") : null, [e, b]), s = () => {
|
|
852
852
|
switch (Y) {
|
|
853
853
|
case "years":
|
|
854
854
|
return /* @__PURE__ */ t(
|
|
@@ -887,19 +887,19 @@ const Fe = p.forwardRef(
|
|
|
887
887
|
}
|
|
888
888
|
);
|
|
889
889
|
}
|
|
890
|
-
}, l = "h-ds-sm rounded-ds-md border border-surface-border-strong bg-surface-
|
|
891
|
-
return /* @__PURE__ */
|
|
892
|
-
/* @__PURE__ */ t(oe, { asChild: !0, children: /* @__PURE__ */
|
|
890
|
+
}, l = "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";
|
|
891
|
+
return /* @__PURE__ */ p(ce, { open: w, onOpenChange: T, children: [
|
|
892
|
+
/* @__PURE__ */ t(oe, { asChild: !0, children: /* @__PURE__ */ p(
|
|
893
893
|
"button",
|
|
894
894
|
{
|
|
895
895
|
ref: M,
|
|
896
896
|
type: "button",
|
|
897
897
|
...P,
|
|
898
898
|
className: y(
|
|
899
|
-
"inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-surface-border-strong bg-surface-
|
|
899
|
+
"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
900
|
"hover:border-surface-border-strong",
|
|
901
901
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
|
|
902
|
-
|
|
902
|
+
k
|
|
903
903
|
),
|
|
904
904
|
"aria-label": c ? `Selected: ${c}` : x,
|
|
905
905
|
children: [
|
|
@@ -926,14 +926,14 @@ const Fe = p.forwardRef(
|
|
|
926
926
|
/* @__PURE__ */ t(
|
|
927
927
|
ae,
|
|
928
928
|
{
|
|
929
|
-
className: "w-auto border-surface-border-strong bg-surface-
|
|
929
|
+
className: "w-auto border-surface-border-strong bg-surface-overlay p-ds-04",
|
|
930
930
|
align: "start",
|
|
931
931
|
sideOffset: 4,
|
|
932
|
-
children: /* @__PURE__ */
|
|
932
|
+
children: /* @__PURE__ */ p("div", { className: "flex flex-col gap-ds-04", children: [
|
|
933
933
|
s(),
|
|
934
|
-
Y === "days" && /* @__PURE__ */
|
|
934
|
+
Y === "days" && /* @__PURE__ */ p("div", { className: "flex items-center gap-ds-02 border-t border-surface-border-strong pt-ds-04", children: [
|
|
935
935
|
/* @__PURE__ */ t("span", { className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle", children: "Time" }),
|
|
936
|
-
/* @__PURE__ */
|
|
936
|
+
/* @__PURE__ */ p(
|
|
937
937
|
"select",
|
|
938
938
|
{
|
|
939
939
|
value: G ?? "",
|
|
@@ -947,7 +947,7 @@ const Fe = p.forwardRef(
|
|
|
947
947
|
}
|
|
948
948
|
),
|
|
949
949
|
/* @__PURE__ */ t("span", { className: "text-ds-md font-semibold text-surface-fg-subtle", children: ":" }),
|
|
950
|
-
/* @__PURE__ */
|
|
950
|
+
/* @__PURE__ */ p(
|
|
951
951
|
"select",
|
|
952
952
|
{
|
|
953
953
|
value: e ? O : "",
|
|
@@ -960,7 +960,7 @@ const Fe = p.forwardRef(
|
|
|
960
960
|
]
|
|
961
961
|
}
|
|
962
962
|
),
|
|
963
|
-
b === "12h" && /* @__PURE__ */
|
|
963
|
+
b === "12h" && /* @__PURE__ */ p(
|
|
964
964
|
"select",
|
|
965
965
|
{
|
|
966
966
|
value: e ? H : "",
|