@devalok/shilp-sutra 0.21.0 → 0.22.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/use-calendar.js +115 -115
- package/dist/_chunks/vendor-utils.js +1230 -1178
- package/dist/composed/activity-feed.d.ts.map +1 -1
- package/dist/composed/activity-feed.js +78 -78
- package/dist/composed/avatar-group.d.ts +2 -2
- package/dist/composed/avatar-group.d.ts.map +1 -1
- package/dist/composed/avatar-group.js +87 -117
- package/dist/composed/command-palette.js +50 -50
- package/dist/composed/content-card.js +10 -10
- package/dist/composed/empty-state.d.ts.map +1 -1
- package/dist/composed/empty-state.js +58 -48
- package/dist/composed/global-loading.d.ts.map +1 -1
- package/dist/composed/global-loading.js +11 -10
- package/dist/composed/loading-skeleton.d.ts.map +1 -1
- package/dist/composed/loading-skeleton.js +32 -29
- package/dist/composed/member-picker.d.ts.map +1 -1
- package/dist/composed/member-picker.js +28 -17
- package/dist/composed/page-header.js +25 -25
- package/dist/composed/priority-indicator.d.ts.map +1 -1
- package/dist/composed/priority-indicator.js +60 -36
- package/dist/composed/rich-text-editor.js +104 -104
- package/dist/composed/schedule-view.d.ts.map +1 -1
- package/dist/composed/schedule-view.js +52 -44
- package/dist/composed/status-badge.js +16 -16
- package/dist/shell/bottom-navbar.d.ts.map +1 -1
- package/dist/shell/bottom-navbar.js +35 -31
- package/dist/shell/notification-center.d.ts.map +1 -1
- package/dist/shell/notification-center.js +119 -111
- package/dist/shell/sidebar.js +2 -2
- package/dist/shell/top-bar.js +9 -9
- package/dist/tailwind/index.cjs +30 -3
- package/dist/tailwind/preset.d.ts.map +1 -1
- package/dist/tailwind/preset.js +30 -3
- package/dist/tokens/semantic.css +10 -10
- package/dist/tokens/typography-semantic.css +3 -3
- package/dist/ui/accordion.js +22 -22
- package/dist/ui/alert.js +8 -8
- package/dist/ui/avatar.d.ts.map +1 -1
- package/dist/ui/avatar.js +72 -86
- package/dist/ui/badge.js +5 -5
- package/dist/ui/banner.js +18 -18
- package/dist/ui/breadcrumb.js +23 -23
- package/dist/ui/button.js +22 -22
- package/dist/ui/card.js +16 -16
- package/dist/ui/checkbox.d.ts.map +1 -1
- package/dist/ui/checkbox.js +72 -25
- package/dist/ui/chip.js +14 -14
- package/dist/ui/code.js +9 -9
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/combobox.js +46 -45
- package/dist/ui/dialog.js +17 -17
- package/dist/ui/dropdown-menu.js +22 -22
- package/dist/ui/form.d.ts.map +1 -1
- package/dist/ui/form.js +35 -29
- package/dist/ui/input.js +20 -20
- package/dist/ui/label.js +15 -15
- package/dist/ui/lib/motion.d.ts.map +1 -1
- package/dist/ui/lib/motion.js +2 -2
- package/dist/ui/link.js +14 -14
- package/dist/ui/number-input.js +36 -36
- package/dist/ui/pagination.js +14 -14
- package/dist/ui/progress.js +6 -6
- package/dist/ui/radio.d.ts.map +1 -1
- package/dist/ui/radio.js +24 -12
- package/dist/ui/search-input.d.ts.map +1 -1
- package/dist/ui/search-input.js +25 -19
- package/dist/ui/select.js +15 -15
- package/dist/ui/separator.d.ts +10 -2
- package/dist/ui/separator.d.ts.map +1 -1
- package/dist/ui/separator.js +16 -15
- package/dist/ui/sheet.js +7 -7
- package/dist/ui/sidebar.d.ts +1 -1
- package/dist/ui/sidebar.d.ts.map +1 -1
- package/dist/ui/sidebar.js +22 -22
- package/dist/ui/skeleton.js +5 -5
- package/dist/ui/slider.js +7 -7
- package/dist/ui/stat-card.js +19 -19
- package/dist/ui/switch.d.ts.map +1 -1
- package/dist/ui/switch.js +14 -13
- package/dist/ui/tabs.d.ts.map +1 -1
- package/dist/ui/tabs.js +60 -51
- package/dist/ui/textarea.js +15 -15
- package/dist/ui/toast.js +1 -1
- package/dist/ui/toggle.js +5 -5
- package/dist/ui/tooltip.d.ts +0 -4
- package/dist/ui/tooltip.d.ts.map +1 -1
- package/dist/ui/tooltip.js +24 -24
- package/docs/components/ui/avatar.md +3 -0
- package/docs/components/ui/button.md +5 -0
- package/docs/components/ui/checkbox.md +5 -0
- package/docs/components/ui/dropdown-menu.md +3 -0
- package/docs/components/ui/separator.md +3 -0
- package/docs/components/ui/tooltip.md +5 -0
- package/llms-full.txt +25 -1
- package/llms.txt +20 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as h, jsx as t } from "react/jsx-runtime";
|
|
3
3
|
import * as p from "react";
|
|
4
|
-
import { useState as
|
|
5
|
-
import { format as D, startOfMonth as z, endOfMonth as me, startOfWeek as
|
|
4
|
+
import { useState as Pe } from "react";
|
|
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";
|
|
@@ -11,13 +11,13 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = p.forwardRef(
|
|
|
11
11
|
currentMonth: e,
|
|
12
12
|
selected: n,
|
|
13
13
|
rangeStart: a,
|
|
14
|
-
rangeEnd:
|
|
14
|
+
rangeEnd: d,
|
|
15
15
|
hoverDate: g,
|
|
16
16
|
onSelect: b,
|
|
17
17
|
onHover: f,
|
|
18
18
|
onMonthChange: x,
|
|
19
|
-
onHeaderClick:
|
|
20
|
-
disabledDates:
|
|
19
|
+
onHeaderClick: v,
|
|
20
|
+
disabledDates: P,
|
|
21
21
|
minDate: M,
|
|
22
22
|
maxDate: w,
|
|
23
23
|
hidePrevNav: T,
|
|
@@ -34,13 +34,13 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = p.forwardRef(
|
|
|
34
34
|
r.push(s), c.set(l, r);
|
|
35
35
|
}
|
|
36
36
|
return c;
|
|
37
|
-
}, [A]), E = z(e),
|
|
37
|
+
}, [A]), E = z(e), S = me(e), $ = Se(E), G = Ye(S), L = [];
|
|
38
38
|
let j = $;
|
|
39
39
|
for (; j <= G; )
|
|
40
40
|
L.push(j), j = _(j, 1);
|
|
41
|
-
const I = (c) => !!(
|
|
42
|
-
if (a &&
|
|
43
|
-
const s = C(a,
|
|
41
|
+
const I = (c) => !!(P != null && P(c) || M && C(c, K(M)) || w && ee(c, K(w))), B = (c) => {
|
|
42
|
+
if (a && d) {
|
|
43
|
+
const s = C(a, d) ? a : d, l = ee(d, a) ? d : a;
|
|
44
44
|
return xe(c, { start: s, end: l });
|
|
45
45
|
}
|
|
46
46
|
if (a && g) {
|
|
@@ -48,7 +48,7 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = p.forwardRef(
|
|
|
48
48
|
return xe(c, { start: s, end: l });
|
|
49
49
|
}
|
|
50
50
|
return !1;
|
|
51
|
-
}, V = (c) => !!(a && X(c, a) ||
|
|
51
|
+
}, V = (c) => !!(a && X(c, a) || d && X(c, d)), F = (c) => {
|
|
52
52
|
if (!O.current) return;
|
|
53
53
|
const s = D(c, "yyyy-MM-dd"), l = O.current.querySelector(
|
|
54
54
|
`[data-date="${s}"]`
|
|
@@ -95,7 +95,7 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = p.forwardRef(
|
|
|
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-3 hover:text-surface-fg-muted",
|
|
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-3 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: v,
|
|
108
108
|
className: y(
|
|
109
109
|
"text-ds-md font-semibold text-surface-fg",
|
|
110
|
-
|
|
110
|
+
v && "cursor-pointer rounded-ds-md px-ds-02 transition-colors duration-fast-01 ease-productive-standard hover:bg-surface-3"
|
|
111
111
|
),
|
|
112
112
|
"aria-label": "Switch to month/year view",
|
|
113
113
|
children: D(e, "MMMM yyyy")
|
|
@@ -118,7 +118,7 @@ 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-3 hover:text-surface-fg-muted",
|
|
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-3 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
|
}
|
|
@@ -144,7 +144,7 @@ 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),
|
|
147
|
+
const l = ge(c, e), r = I(c), o = n && X(c, n), i = B(c), k = V(c), de = X(c, /* @__PURE__ */ new Date()), pe = D(c, "yyyy-MM-dd"), he = H.get(pe) ?? [];
|
|
148
148
|
return /* @__PURE__ */ h(
|
|
149
149
|
"button",
|
|
150
150
|
{
|
|
@@ -165,21 +165,21 @@ const Ee = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Q = p.forwardRef(
|
|
|
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 && !k && !
|
|
169
|
-
|
|
168
|
+
l && !r && !o && !k && !i && "text-surface-fg hover:bg-surface-3",
|
|
169
|
+
i && !k && "rounded-ds-none bg-surface-3 text-surface-fg",
|
|
170
170
|
(o || k) && "bg-accent-9 text-accent-fg hover:bg-accent-10",
|
|
171
|
-
|
|
171
|
+
de && !o && !k && !r && "font-semibold text-accent-11"
|
|
172
172
|
),
|
|
173
173
|
children: [
|
|
174
174
|
D(c, "d"),
|
|
175
|
-
he.length > 0 && /* @__PURE__ */ t("span", { className: "flex gap-px justify-center absolute bottom-[2px] left-0 right-0", children: he.slice(0, 3).map((ke,
|
|
175
|
+
he.length > 0 && /* @__PURE__ */ t("span", { className: "flex gap-px justify-center absolute bottom-[2px] left-0 right-0", children: he.slice(0, 3).map((ke, ve) => /* @__PURE__ */ t(
|
|
176
176
|
"span",
|
|
177
177
|
{
|
|
178
178
|
"data-event-dot": !0,
|
|
179
179
|
className: "h-[4px] w-[4px] rounded-ds-full",
|
|
180
180
|
style: { backgroundColor: ke.color ?? "var(--color-accent-9)" }
|
|
181
181
|
},
|
|
182
|
-
|
|
182
|
+
ve
|
|
183
183
|
)) })
|
|
184
184
|
]
|
|
185
185
|
},
|
|
@@ -198,20 +198,20 @@ const le = p.forwardRef(
|
|
|
198
198
|
currentYear: e,
|
|
199
199
|
selectedYear: n,
|
|
200
200
|
onYearSelect: a,
|
|
201
|
-
minDate:
|
|
201
|
+
minDate: d,
|
|
202
202
|
maxDate: g,
|
|
203
203
|
className: b,
|
|
204
204
|
...f
|
|
205
205
|
}, x) {
|
|
206
|
-
const
|
|
206
|
+
const v = Math.floor(e / 10) * 10, P = Array.from({ length: 12 }, (M, w) => v + w);
|
|
207
207
|
return /* @__PURE__ */ h("div", { ref: x, ...f, className: y("w-[252px]", b), children: [
|
|
208
208
|
/* @__PURE__ */ h("div", { className: "text-center pb-ds-04 text-ds-md font-semibold text-surface-fg", children: [
|
|
209
|
-
|
|
209
|
+
v,
|
|
210
210
|
" – ",
|
|
211
|
-
|
|
211
|
+
v + 11
|
|
212
212
|
] }),
|
|
213
|
-
/* @__PURE__ */ t("div", { className: "grid grid-cols-3 gap-ds-02", children:
|
|
214
|
-
const w = M === n, T =
|
|
213
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-3 gap-ds-02", children: P.map((M) => {
|
|
214
|
+
const w = M === n, T = d != null && M < d.getFullYear() || g != null && M > g.getFullYear();
|
|
215
215
|
return /* @__PURE__ */ t(
|
|
216
216
|
"button",
|
|
217
217
|
{
|
|
@@ -246,67 +246,67 @@ const $e = [
|
|
|
246
246
|
"Oct",
|
|
247
247
|
"Nov",
|
|
248
248
|
"Dec"
|
|
249
|
-
],
|
|
249
|
+
], ie = p.forwardRef(
|
|
250
250
|
function({
|
|
251
251
|
currentYear: e,
|
|
252
252
|
selectedMonth: n,
|
|
253
253
|
onMonthSelect: a,
|
|
254
|
-
minDate:
|
|
254
|
+
minDate: d,
|
|
255
255
|
maxDate: g,
|
|
256
256
|
className: b,
|
|
257
257
|
...f
|
|
258
258
|
}, x) {
|
|
259
259
|
return /* @__PURE__ */ h("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((
|
|
262
|
-
const M =
|
|
261
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-4 gap-ds-02", children: $e.map((v, P) => {
|
|
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",
|
|
265
265
|
{
|
|
266
266
|
type: "button",
|
|
267
267
|
disabled: w || !1,
|
|
268
|
-
onClick: () => !w && a(
|
|
268
|
+
onClick: () => !w && a(P),
|
|
269
269
|
className: y(
|
|
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
273
|
!M && !w && "hover:bg-surface-3 text-surface-fg"
|
|
274
274
|
),
|
|
275
|
-
children:
|
|
275
|
+
children: v
|
|
276
276
|
},
|
|
277
|
-
|
|
277
|
+
v
|
|
278
278
|
);
|
|
279
279
|
}) })
|
|
280
280
|
] });
|
|
281
281
|
}
|
|
282
282
|
);
|
|
283
|
-
|
|
283
|
+
ie.displayName = "MonthPicker";
|
|
284
284
|
const je = p.forwardRef(
|
|
285
285
|
function({
|
|
286
286
|
value: e,
|
|
287
287
|
onChange: n,
|
|
288
288
|
placeholder: a = "Pick a date",
|
|
289
|
-
className:
|
|
289
|
+
className: d,
|
|
290
290
|
formatStr: g = "MMM d, yyyy",
|
|
291
291
|
minDate: b,
|
|
292
292
|
maxDate: f,
|
|
293
293
|
disabledDates: x,
|
|
294
|
-
...
|
|
295
|
-
},
|
|
294
|
+
...v
|
|
295
|
+
}, P) {
|
|
296
296
|
const [M, w] = p.useState(!1), [T, N] = p.useState(
|
|
297
297
|
e ?? /* @__PURE__ */ new Date()
|
|
298
298
|
), [A, Y] = p.useState("days");
|
|
299
299
|
p.useEffect(() => {
|
|
300
300
|
M || Y("days");
|
|
301
301
|
}, [M]);
|
|
302
|
-
const R = (
|
|
303
|
-
n == null || n(
|
|
302
|
+
const R = (S) => {
|
|
303
|
+
n == null || n(S), w(!1);
|
|
304
304
|
}, m = () => {
|
|
305
|
-
Y((
|
|
306
|
-
}, O = (
|
|
307
|
-
N(($) => re($,
|
|
308
|
-
}, H = (
|
|
309
|
-
N(($) => ne($,
|
|
305
|
+
Y((S) => S === "days" ? "months" : "years");
|
|
306
|
+
}, O = (S) => {
|
|
307
|
+
N(($) => re($, S)), Y("days");
|
|
308
|
+
}, H = (S) => {
|
|
309
|
+
N(($) => ne($, S)), Y("months");
|
|
310
310
|
}, E = () => {
|
|
311
311
|
switch (A) {
|
|
312
312
|
case "years":
|
|
@@ -322,7 +322,7 @@ const je = p.forwardRef(
|
|
|
322
322
|
);
|
|
323
323
|
case "months":
|
|
324
324
|
return /* @__PURE__ */ t(
|
|
325
|
-
|
|
325
|
+
ie,
|
|
326
326
|
{
|
|
327
327
|
currentYear: T.getFullYear(),
|
|
328
328
|
selectedMonth: e == null ? void 0 : e.getMonth(),
|
|
@@ -351,15 +351,15 @@ const je = p.forwardRef(
|
|
|
351
351
|
/* @__PURE__ */ t(oe, { asChild: !0, children: /* @__PURE__ */ h(
|
|
352
352
|
"button",
|
|
353
353
|
{
|
|
354
|
-
ref:
|
|
354
|
+
ref: P,
|
|
355
355
|
type: "button",
|
|
356
356
|
"aria-label": e ? `Change date, ${D(e, g)}` : a,
|
|
357
|
-
...
|
|
357
|
+
...v,
|
|
358
358
|
className: y(
|
|
359
359
|
"inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-surface-border-strong bg-surface-1 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
|
|
363
363
|
),
|
|
364
364
|
children: [
|
|
365
365
|
/* @__PURE__ */ t(
|
|
@@ -446,16 +446,16 @@ const Ie = {
|
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
}, Ne = p.forwardRef(
|
|
449
|
-
function({ presets: e, onSelect: n, className: a, ...
|
|
450
|
-
return /* @__PURE__ */ t("div", { ref: g, ...
|
|
449
|
+
function({ presets: e, onSelect: n, className: a, ...d }, g) {
|
|
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];
|
|
452
452
|
return f ? /* @__PURE__ */ t(
|
|
453
453
|
"button",
|
|
454
454
|
{
|
|
455
455
|
type: "button",
|
|
456
456
|
onClick: () => {
|
|
457
|
-
const { start: x, end:
|
|
458
|
-
n(x,
|
|
457
|
+
const { start: x, end: v } = f.getRange();
|
|
458
|
+
n(x, v);
|
|
459
459
|
},
|
|
460
460
|
className: y(
|
|
461
461
|
"h-ds-sm w-full rounded-ds-md px-ds-03 text-left text-ds-sm",
|
|
@@ -476,13 +476,13 @@ const Le = p.forwardRef(
|
|
|
476
476
|
startDate: e,
|
|
477
477
|
endDate: n,
|
|
478
478
|
onChange: a,
|
|
479
|
-
placeholder:
|
|
479
|
+
placeholder: d = "Pick a date range",
|
|
480
480
|
className: g,
|
|
481
481
|
formatStr: b = "MMM d, yyyy",
|
|
482
482
|
minDate: f,
|
|
483
483
|
maxDate: x,
|
|
484
|
-
disabledDates:
|
|
485
|
-
presets:
|
|
484
|
+
disabledDates: v,
|
|
485
|
+
presets: P,
|
|
486
486
|
numberOfMonths: M = 1,
|
|
487
487
|
...w
|
|
488
488
|
}, T) {
|
|
@@ -492,7 +492,7 @@ const Le = p.forwardRef(
|
|
|
492
492
|
e ?? null
|
|
493
493
|
), [H, E] = p.useState(
|
|
494
494
|
n ?? null
|
|
495
|
-
), [
|
|
495
|
+
), [S, $] = p.useState(null), [G, L] = p.useState("days"), j = Math.max(1, M);
|
|
496
496
|
p.useEffect(() => {
|
|
497
497
|
O(e ?? null), E(n ?? null);
|
|
498
498
|
}, [e, n]), p.useEffect(() => {
|
|
@@ -502,52 +502,52 @@ const Le = p.forwardRef(
|
|
|
502
502
|
if (!m || m && H)
|
|
503
503
|
O(o), E(null);
|
|
504
504
|
else {
|
|
505
|
-
const
|
|
506
|
-
O(
|
|
505
|
+
const i = C(o, m) ? o : m, k = ee(o, m) ? o : m;
|
|
506
|
+
O(i), E(k), a == null || a({ start: i, end: k }), A(!1);
|
|
507
507
|
}
|
|
508
|
-
}, B = (o,
|
|
509
|
-
O(o), E(
|
|
508
|
+
}, B = (o, i) => {
|
|
509
|
+
O(o), E(i), a == null || a({ start: o, end: i }), A(!1);
|
|
510
510
|
}, V = () => {
|
|
511
511
|
L((o) => o === "days" ? "months" : "years");
|
|
512
512
|
}, F = (o) => {
|
|
513
|
-
R((
|
|
513
|
+
R((i) => re(i, o)), L("days");
|
|
514
514
|
}, W = (o) => {
|
|
515
|
-
R((
|
|
516
|
-
}, c = () => m && H ? `${D(m, b)} - ${D(H, b)}` :
|
|
515
|
+
R((i) => ne(i, o)), L("months");
|
|
516
|
+
}, c = () => m && H ? `${D(m, b)} - ${D(H, b)}` : d, s = () => j === 1 ? /* @__PURE__ */ t(
|
|
517
517
|
Q,
|
|
518
518
|
{
|
|
519
519
|
currentMonth: Y,
|
|
520
520
|
rangeStart: m,
|
|
521
521
|
rangeEnd: H,
|
|
522
|
-
hoverDate:
|
|
522
|
+
hoverDate: S,
|
|
523
523
|
onSelect: I,
|
|
524
524
|
onHover: $,
|
|
525
525
|
onMonthChange: R,
|
|
526
526
|
onHeaderClick: V,
|
|
527
|
-
disabledDates:
|
|
527
|
+
disabledDates: v,
|
|
528
528
|
minDate: f,
|
|
529
529
|
maxDate: x
|
|
530
530
|
}
|
|
531
|
-
) : /* @__PURE__ */ t("div", { className: "flex flex-row gap-ds-04", children: Array.from({ length: j }, (o,
|
|
531
|
+
) : /* @__PURE__ */ t("div", { className: "flex flex-row gap-ds-04", children: Array.from({ length: j }, (o, i) => /* @__PURE__ */ t(
|
|
532
532
|
Q,
|
|
533
533
|
{
|
|
534
|
-
currentMonth: te(Y,
|
|
534
|
+
currentMonth: te(Y, i),
|
|
535
535
|
rangeStart: m,
|
|
536
536
|
rangeEnd: H,
|
|
537
|
-
hoverDate:
|
|
537
|
+
hoverDate: S,
|
|
538
538
|
onSelect: I,
|
|
539
539
|
onHover: $,
|
|
540
540
|
onMonthChange: (k) => {
|
|
541
|
-
R(te(k, -
|
|
541
|
+
R(te(k, -i));
|
|
542
542
|
},
|
|
543
543
|
onHeaderClick: V,
|
|
544
|
-
disabledDates:
|
|
544
|
+
disabledDates: v,
|
|
545
545
|
minDate: f,
|
|
546
546
|
maxDate: x,
|
|
547
|
-
hidePrevNav:
|
|
548
|
-
hideNextNav:
|
|
547
|
+
hidePrevNav: i > 0,
|
|
548
|
+
hideNextNav: i < j - 1
|
|
549
549
|
},
|
|
550
|
-
|
|
550
|
+
i
|
|
551
551
|
)) }), l = () => {
|
|
552
552
|
switch (G) {
|
|
553
553
|
case "years":
|
|
@@ -563,7 +563,7 @@ const Le = p.forwardRef(
|
|
|
563
563
|
);
|
|
564
564
|
case "months":
|
|
565
565
|
return /* @__PURE__ */ t(
|
|
566
|
-
|
|
566
|
+
ie,
|
|
567
567
|
{
|
|
568
568
|
currentYear: Y.getFullYear(),
|
|
569
569
|
selectedMonth: m == null ? void 0 : m.getMonth(),
|
|
@@ -575,14 +575,14 @@ const Le = p.forwardRef(
|
|
|
575
575
|
default:
|
|
576
576
|
return s();
|
|
577
577
|
}
|
|
578
|
-
}, r =
|
|
578
|
+
}, r = P && P.length > 0;
|
|
579
579
|
return /* @__PURE__ */ h(ce, { open: N, onOpenChange: A, children: [
|
|
580
580
|
/* @__PURE__ */ t(oe, { asChild: !0, children: /* @__PURE__ */ h(
|
|
581
581
|
"button",
|
|
582
582
|
{
|
|
583
583
|
ref: T,
|
|
584
584
|
type: "button",
|
|
585
|
-
"aria-label": m && H ? `Change date range, ${c()}` :
|
|
585
|
+
"aria-label": m && H ? `Change date range, ${c()}` : d,
|
|
586
586
|
...w,
|
|
587
587
|
className: y(
|
|
588
588
|
"inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-surface-border-strong bg-surface-1 px-ds-04 text-left transition-colors duration-fast-01 ease-productive-standard",
|
|
@@ -618,7 +618,7 @@ const Le = p.forwardRef(
|
|
|
618
618
|
align: "start",
|
|
619
619
|
sideOffset: 4,
|
|
620
620
|
children: r ? /* @__PURE__ */ h("div", { className: "flex flex-row gap-ds-04", children: [
|
|
621
|
-
/* @__PURE__ */ t("div", { className: "min-w-[140px] border-r border-surface-border-strong pr-ds-04", children: /* @__PURE__ */ t(Ne, { presets:
|
|
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()
|
|
624
624
|
}
|
|
@@ -629,8 +629,8 @@ const Le = p.forwardRef(
|
|
|
629
629
|
Le.displayName = "DateRangePicker";
|
|
630
630
|
function Z(u, e, n) {
|
|
631
631
|
const a = [];
|
|
632
|
-
for (let
|
|
633
|
-
a.push(
|
|
632
|
+
for (let d = u; d <= e; d += n)
|
|
633
|
+
a.push(d);
|
|
634
634
|
return a;
|
|
635
635
|
}
|
|
636
636
|
function q(u) {
|
|
@@ -641,35 +641,35 @@ const Ve = p.forwardRef(
|
|
|
641
641
|
value: e,
|
|
642
642
|
onChange: n,
|
|
643
643
|
format: a = "12h",
|
|
644
|
-
minuteStep:
|
|
644
|
+
minuteStep: d = 1,
|
|
645
645
|
secondStep: g = 1,
|
|
646
646
|
showSeconds: b = !1,
|
|
647
647
|
placeholder: f = "Pick a time",
|
|
648
648
|
className: x,
|
|
649
|
-
disabled:
|
|
650
|
-
...
|
|
649
|
+
disabled: v = !1,
|
|
650
|
+
...P
|
|
651
651
|
}, M) {
|
|
652
|
-
const [w, T] = p.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,
|
|
652
|
+
const [w, T] = p.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
|
-
const o = s.minutes ?? l.getMinutes(),
|
|
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
657
|
let k = J(l, r);
|
|
658
|
-
return k = se(k, o), k = ye(k,
|
|
658
|
+
return k = se(k, o), k = ye(k, i), k;
|
|
659
659
|
}, $ = (s) => {
|
|
660
|
-
const l =
|
|
660
|
+
const l = S({ hours: s });
|
|
661
661
|
n == null || n(l);
|
|
662
662
|
}, G = (s) => {
|
|
663
|
-
const l =
|
|
663
|
+
const l = S({ minutes: s });
|
|
664
664
|
n == null || n(l);
|
|
665
665
|
}, L = (s) => {
|
|
666
|
-
const l =
|
|
666
|
+
const l = S({ seconds: s });
|
|
667
667
|
n == null || n(l);
|
|
668
668
|
}, j = (s) => {
|
|
669
669
|
if (!e) {
|
|
670
670
|
const o = s === "AM" ? 0 : 12;
|
|
671
|
-
let
|
|
672
|
-
|
|
671
|
+
let i = /* @__PURE__ */ new Date();
|
|
672
|
+
i = J(i, o), i = se(i, 0), i = ye(i, 0), n == null || n(i);
|
|
673
673
|
return;
|
|
674
674
|
}
|
|
675
675
|
const l = e.getHours();
|
|
@@ -682,13 +682,13 @@ const Ve = p.forwardRef(
|
|
|
682
682
|
{
|
|
683
683
|
ref: M,
|
|
684
684
|
type: "button",
|
|
685
|
-
disabled:
|
|
686
|
-
...
|
|
685
|
+
disabled: v,
|
|
686
|
+
...P,
|
|
687
687
|
className: y(
|
|
688
688
|
"inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-surface-border-strong bg-surface-1 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
|
+
v && "opacity-action-disabled pointer-events-none",
|
|
692
692
|
x
|
|
693
693
|
),
|
|
694
694
|
"aria-label": I ? `Selected time: ${I}` : f,
|
|
@@ -805,8 +805,8 @@ function Me(u) {
|
|
|
805
805
|
}
|
|
806
806
|
function fe(u, e, n) {
|
|
807
807
|
const a = [];
|
|
808
|
-
for (let
|
|
809
|
-
a.push(
|
|
808
|
+
for (let d = u; d <= e; d += n)
|
|
809
|
+
a.push(d);
|
|
810
810
|
return a;
|
|
811
811
|
}
|
|
812
812
|
const Fe = p.forwardRef(
|
|
@@ -814,19 +814,19 @@ const Fe = p.forwardRef(
|
|
|
814
814
|
value: e,
|
|
815
815
|
onChange: n,
|
|
816
816
|
minDate: a,
|
|
817
|
-
maxDate:
|
|
817
|
+
maxDate: d,
|
|
818
818
|
disabledDates: g,
|
|
819
819
|
timeFormat: b = "12h",
|
|
820
820
|
minuteStep: f = 1,
|
|
821
821
|
placeholder: x = "Pick date & time",
|
|
822
|
-
className:
|
|
823
|
-
...
|
|
822
|
+
className: v,
|
|
823
|
+
...P
|
|
824
824
|
}, M) {
|
|
825
825
|
const [w, T] = p.useState(!1), [N, A] = p.useState(e ?? /* @__PURE__ */ new Date()), [Y, R] = p.useState("days");
|
|
826
826
|
p.useEffect(() => {
|
|
827
827
|
w || R("days");
|
|
828
828
|
}, [w]);
|
|
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,
|
|
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) => {
|
|
830
830
|
let o = J(r, e ? e.getHours() : m);
|
|
831
831
|
o = se(o, e ? e.getMinutes() : O), n == null || n(o);
|
|
832
832
|
}, j = () => {
|
|
@@ -837,17 +837,17 @@ const Fe = p.forwardRef(
|
|
|
837
837
|
A((o) => ne(o, r)), R("months");
|
|
838
838
|
}, V = (r) => {
|
|
839
839
|
const o = e ? new Date(e) : /* @__PURE__ */ new Date();
|
|
840
|
-
let
|
|
841
|
-
b === "12h" && ((e ? H : "AM") === "AM" ?
|
|
842
|
-
const k = J(o,
|
|
840
|
+
let i = r;
|
|
841
|
+
b === "12h" && ((e ? H : "AM") === "AM" ? i = r === 12 ? 0 : r : i = r === 12 ? 12 : r + 12);
|
|
842
|
+
const k = J(o, i);
|
|
843
843
|
n == null || n(k);
|
|
844
844
|
}, F = (r) => {
|
|
845
|
-
const o = e ? new Date(e) : /* @__PURE__ */ new Date(),
|
|
846
|
-
n == null || n(
|
|
845
|
+
const o = e ? new Date(e) : /* @__PURE__ */ new Date(), i = se(o, r);
|
|
846
|
+
n == null || n(i);
|
|
847
847
|
}, W = (r) => {
|
|
848
|
-
const o = e ? new Date(e) : /* @__PURE__ */ new Date(),
|
|
848
|
+
const o = e ? new Date(e) : /* @__PURE__ */ new Date(), i = o.getHours();
|
|
849
849
|
let k;
|
|
850
|
-
r === "AM" ? k =
|
|
850
|
+
r === "AM" ? k = i >= 12 ? i - 12 : i : k = i < 12 ? i + 12 : i, n == null || n(J(o, k));
|
|
851
851
|
}, c = p.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":
|
|
@@ -858,18 +858,18 @@ const Fe = p.forwardRef(
|
|
|
858
858
|
selectedYear: e == null ? void 0 : e.getFullYear(),
|
|
859
859
|
onYearSelect: B,
|
|
860
860
|
minDate: a,
|
|
861
|
-
maxDate:
|
|
861
|
+
maxDate: d
|
|
862
862
|
}
|
|
863
863
|
);
|
|
864
864
|
case "months":
|
|
865
865
|
return /* @__PURE__ */ t(
|
|
866
|
-
|
|
866
|
+
ie,
|
|
867
867
|
{
|
|
868
868
|
currentYear: N.getFullYear(),
|
|
869
869
|
selectedMonth: e == null ? void 0 : e.getMonth(),
|
|
870
870
|
onMonthSelect: I,
|
|
871
871
|
minDate: a,
|
|
872
|
-
maxDate:
|
|
872
|
+
maxDate: d
|
|
873
873
|
}
|
|
874
874
|
);
|
|
875
875
|
default:
|
|
@@ -883,7 +883,7 @@ const Fe = p.forwardRef(
|
|
|
883
883
|
onHeaderClick: j,
|
|
884
884
|
disabledDates: g,
|
|
885
885
|
minDate: a,
|
|
886
|
-
maxDate:
|
|
886
|
+
maxDate: d
|
|
887
887
|
}
|
|
888
888
|
);
|
|
889
889
|
}
|
|
@@ -894,12 +894,12 @@ const Fe = p.forwardRef(
|
|
|
894
894
|
{
|
|
895
895
|
ref: M,
|
|
896
896
|
type: "button",
|
|
897
|
-
...
|
|
897
|
+
...P,
|
|
898
898
|
className: y(
|
|
899
899
|
"inline-flex h-ds-sm-plus items-center gap-ds-03 rounded-ds-lg border border-surface-border-strong bg-surface-1 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
|
+
v
|
|
903
903
|
),
|
|
904
904
|
"aria-label": c ? `Selected: ${c}` : x,
|
|
905
905
|
children: [
|
|
@@ -942,7 +942,7 @@ const Fe = p.forwardRef(
|
|
|
942
942
|
"aria-label": "Hour",
|
|
943
943
|
children: [
|
|
944
944
|
!e && /* @__PURE__ */ t("option", { value: "", children: "--" }),
|
|
945
|
-
|
|
945
|
+
S.map((r) => /* @__PURE__ */ t("option", { value: r, children: b === "24h" ? Me(r) : r }, r))
|
|
946
946
|
]
|
|
947
947
|
}
|
|
948
948
|
),
|
|
@@ -983,7 +983,7 @@ const Fe = p.forwardRef(
|
|
|
983
983
|
);
|
|
984
984
|
Fe.displayName = "DateTimePicker";
|
|
985
985
|
function Ue(u) {
|
|
986
|
-
const [e, n] =
|
|
986
|
+
const [e, n] = Pe(u ?? /* @__PURE__ */ new Date());
|
|
987
987
|
return {
|
|
988
988
|
currentMonth: e,
|
|
989
989
|
setCurrentMonth: n,
|
|
@@ -996,7 +996,7 @@ function Ue(u) {
|
|
|
996
996
|
export {
|
|
997
997
|
Q as C,
|
|
998
998
|
je as D,
|
|
999
|
-
|
|
999
|
+
ie as M,
|
|
1000
1000
|
Ne as P,
|
|
1001
1001
|
Ve as T,
|
|
1002
1002
|
le as Y,
|