@loykin/datetime-range 0.0.1-dev.0 → 0.0.1-dev.1
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/index.cjs +176 -232
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -2
- package/dist/index.d.ts +50 -2
- package/dist/index.js +175 -233
- package/dist/index.js.map +1 -1
- package/dist/styles.css +651 -93
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import React, { useState, useMemo, useCallback, useEffect, useRef } from 'react';
|
|
2
1
|
import { ChevronUpIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CalendarDays, Clock, CheckIcon } from 'lucide-react';
|
|
3
2
|
import { clsx } from 'clsx';
|
|
4
3
|
import { Button as Button$1 } from '@base-ui/react/button';
|
|
5
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
5
|
import { Popover as Popover$1 } from '@base-ui/react/popover';
|
|
6
|
+
import React, { useState, useMemo, useCallback, useEffect, useRef } from 'react';
|
|
7
7
|
import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
|
|
8
|
-
import { cva } from 'class-variance-authority';
|
|
9
8
|
import { Input as Input$1 } from '@base-ui/react/input';
|
|
10
9
|
import { Select as Select$1 } from '@base-ui/react/select';
|
|
11
10
|
import { HugeiconsIcon } from '@hugeicons/react';
|
|
12
11
|
import { UnfoldMoreIcon, Tick02Icon, ArrowUp01Icon, ArrowDown01Icon } from '@hugeicons/core-free-icons';
|
|
13
12
|
import { Switch as Switch$1 } from '@base-ui/react/switch';
|
|
14
|
-
import { Separator as Separator$1 } from '@base-ui/react/separator';
|
|
15
13
|
import { setYear, getYear, addMonths, subMonths, format, startOfYear, endOfYear, startOfMonth, endOfMonth, getMonth, setHours, endOfHour, startOfHour, setMinutes, endOfMinute, startOfMinute, setMilliseconds, setSeconds, startOfDay, endOfDay, addHours, subHours, parse } from 'date-fns';
|
|
16
14
|
import { TZDate, DayPicker } from 'react-day-picker';
|
|
17
15
|
import { setMonth } from 'date-fns/setMonth';
|
|
@@ -60,9 +58,10 @@ function PopoverContent({
|
|
|
60
58
|
sideOffset = 4,
|
|
61
59
|
disableAnchorTracking,
|
|
62
60
|
collisionAvoidance,
|
|
61
|
+
container,
|
|
63
62
|
...props
|
|
64
63
|
}) {
|
|
65
|
-
return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(
|
|
64
|
+
return /* @__PURE__ */ jsx(Popover$1.Portal, { container, children: /* @__PURE__ */ jsx(
|
|
66
65
|
Popover$1.Positioner,
|
|
67
66
|
{
|
|
68
67
|
align,
|
|
@@ -71,15 +70,12 @@ function PopoverContent({
|
|
|
71
70
|
sideOffset,
|
|
72
71
|
disableAnchorTracking,
|
|
73
72
|
collisionAvoidance,
|
|
74
|
-
className: "
|
|
73
|
+
className: "dr-positioner",
|
|
75
74
|
children: /* @__PURE__ */ jsx(
|
|
76
75
|
Popover$1.Popup,
|
|
77
76
|
{
|
|
78
77
|
"data-slot": "popover-content",
|
|
79
|
-
className: cn(
|
|
80
|
-
"z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-[var(--bk-radius)] bg-[var(--bk-popover)] p-2.5 text-xs text-[var(--bk-popover-foreground)] shadow-md ring-1 ring-[var(--bk-foreground)]/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
81
|
-
className
|
|
82
|
-
),
|
|
78
|
+
className: cn("dr-popover-content", className),
|
|
83
79
|
...props
|
|
84
80
|
}
|
|
85
81
|
)
|
|
@@ -96,25 +92,11 @@ function Tabs({
|
|
|
96
92
|
{
|
|
97
93
|
"data-slot": "tabs",
|
|
98
94
|
"data-orientation": orientation,
|
|
99
|
-
className: cn("
|
|
95
|
+
className: cn("dr-tabs", className),
|
|
100
96
|
...props
|
|
101
97
|
}
|
|
102
98
|
);
|
|
103
99
|
}
|
|
104
|
-
var tabsListVariants = cva(
|
|
105
|
-
"group/tabs-list inline-flex w-fit items-center justify-center rounded-[var(--bk-radius)] p-[3px] text-[var(--bk-muted-foreground)] group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",
|
|
106
|
-
{
|
|
107
|
-
variants: {
|
|
108
|
-
variant: {
|
|
109
|
-
default: "bg-[var(--bk-muted)]",
|
|
110
|
-
line: "gap-1 bg-transparent"
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
defaultVariants: {
|
|
114
|
-
variant: "default"
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
);
|
|
118
100
|
function TabsList({
|
|
119
101
|
className,
|
|
120
102
|
variant = "default",
|
|
@@ -125,7 +107,7 @@ function TabsList({
|
|
|
125
107
|
{
|
|
126
108
|
"data-slot": "tabs-list",
|
|
127
109
|
"data-variant": variant,
|
|
128
|
-
className: cn(
|
|
110
|
+
className: cn("dr-tabs-list", className),
|
|
129
111
|
...props
|
|
130
112
|
}
|
|
131
113
|
);
|
|
@@ -135,13 +117,7 @@ function TabsTrigger({ className, ...props }) {
|
|
|
135
117
|
Tabs$1.Tab,
|
|
136
118
|
{
|
|
137
119
|
"data-slot": "tabs-trigger",
|
|
138
|
-
className: cn(
|
|
139
|
-
"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-[max(0px,calc(var(--bk-radius)-3px))] border border-transparent px-1.5 py-0.5 text-xs font-medium whitespace-nowrap text-[var(--bk-muted-foreground)] transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:py-[calc(--spacing(1.25))] hover:text-[var(--bk-foreground)] focus-visible:border-[var(--bk-ring)] focus-visible:ring-[3px] focus-visible:ring-[var(--bk-ring)]/50 focus-visible:outline-1 focus-visible:outline-[var(--bk-ring)] disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
140
|
-
"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent",
|
|
141
|
-
"data-active:bg-[var(--bk-background)] data-active:text-[var(--bk-foreground)]",
|
|
142
|
-
"after:absolute after:bg-[var(--bk-foreground)] after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
|
|
143
|
-
className
|
|
144
|
-
),
|
|
120
|
+
className: cn("dr-tabs-trigger", className),
|
|
145
121
|
...props
|
|
146
122
|
}
|
|
147
123
|
);
|
|
@@ -151,7 +127,7 @@ function TabsContent({ className, ...props }) {
|
|
|
151
127
|
Tabs$1.Panel,
|
|
152
128
|
{
|
|
153
129
|
"data-slot": "tabs-content",
|
|
154
|
-
className: cn("
|
|
130
|
+
className: cn("dr-tabs-content", className),
|
|
155
131
|
...props
|
|
156
132
|
}
|
|
157
133
|
);
|
|
@@ -176,7 +152,7 @@ function SelectValue({ className, ...props }) {
|
|
|
176
152
|
Select$1.Value,
|
|
177
153
|
{
|
|
178
154
|
"data-slot": "select-value",
|
|
179
|
-
className: cn("
|
|
155
|
+
className: cn("dr-select-value", className),
|
|
180
156
|
...props
|
|
181
157
|
}
|
|
182
158
|
);
|
|
@@ -192,10 +168,7 @@ function SelectTrigger({
|
|
|
192
168
|
{
|
|
193
169
|
"data-slot": "select-trigger",
|
|
194
170
|
"data-size": size,
|
|
195
|
-
className: cn(
|
|
196
|
-
"flex w-fit items-center justify-between gap-1.5 rounded-[var(--bk-radius)] border border-[var(--bk-input)] bg-transparent py-2 pr-2 pl-2.5 text-xs whitespace-nowrap transition-colors outline-none select-none focus-visible:border-[var(--bk-ring)] focus-visible:ring-1 focus-visible:ring-[var(--bk-ring)]/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-[var(--bk-destructive)] aria-invalid:ring-1 aria-invalid:ring-[var(--bk-destructive)]/20 data-placeholder:text-[var(--bk-muted-foreground)] data-[size=default]:h-8 data-[size=sm]:h-7 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
197
|
-
className
|
|
198
|
-
),
|
|
171
|
+
className: cn("dr-select-trigger", className),
|
|
199
172
|
...props,
|
|
200
173
|
children: [
|
|
201
174
|
children,
|
|
@@ -207,7 +180,7 @@ function SelectTrigger({
|
|
|
207
180
|
{
|
|
208
181
|
icon: UnfoldMoreIcon,
|
|
209
182
|
strokeWidth: 2,
|
|
210
|
-
className: "
|
|
183
|
+
className: "dr-select-icon"
|
|
211
184
|
}
|
|
212
185
|
)
|
|
213
186
|
}
|
|
@@ -234,16 +207,13 @@ function SelectContent({
|
|
|
234
207
|
align,
|
|
235
208
|
alignOffset,
|
|
236
209
|
alignItemWithTrigger,
|
|
237
|
-
className: "
|
|
210
|
+
className: "dr-positioner",
|
|
238
211
|
children: /* @__PURE__ */ jsxs(
|
|
239
212
|
Select$1.Popup,
|
|
240
213
|
{
|
|
241
214
|
"data-slot": "select-content",
|
|
242
215
|
"data-align-trigger": alignItemWithTrigger,
|
|
243
|
-
className: cn(
|
|
244
|
-
"isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-[var(--bk-radius)] bg-[var(--bk-popover)] text-[var(--bk-popover-foreground)] shadow-md ring-1 ring-[var(--bk-foreground)]/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 animate-none!",
|
|
245
|
-
className
|
|
246
|
-
),
|
|
216
|
+
className: cn("dr-select-content", className),
|
|
247
217
|
...props,
|
|
248
218
|
children: [
|
|
249
219
|
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
@@ -264,18 +234,15 @@ function SelectItem({
|
|
|
264
234
|
Select$1.Item,
|
|
265
235
|
{
|
|
266
236
|
"data-slot": "select-item",
|
|
267
|
-
className: cn(
|
|
268
|
-
"relative flex w-full cursor-default items-center gap-2 rounded-none py-2 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-[var(--bk-accent)] focus:text-[var(--bk-accent-foreground)] data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
269
|
-
className
|
|
270
|
-
),
|
|
237
|
+
className: cn("dr-select-item", className),
|
|
271
238
|
...props,
|
|
272
239
|
children: [
|
|
273
|
-
/* @__PURE__ */ jsx(Select$1.ItemText, { className: "
|
|
240
|
+
/* @__PURE__ */ jsx(Select$1.ItemText, { className: "dr-select-item-text", children }),
|
|
274
241
|
/* @__PURE__ */ jsx(
|
|
275
242
|
Select$1.ItemIndicator,
|
|
276
243
|
{
|
|
277
|
-
render: /* @__PURE__ */ jsx("span", { className: "
|
|
278
|
-
children: /* @__PURE__ */ jsx(HugeiconsIcon, { icon: Tick02Icon, strokeWidth: 2,
|
|
244
|
+
render: /* @__PURE__ */ jsx("span", { className: "dr-select-item-indicator" }),
|
|
245
|
+
children: /* @__PURE__ */ jsx(HugeiconsIcon, { icon: Tick02Icon, strokeWidth: 2, style: { pointerEvents: "none" } })
|
|
279
246
|
}
|
|
280
247
|
)
|
|
281
248
|
]
|
|
@@ -290,10 +257,7 @@ function SelectScrollUpButton({
|
|
|
290
257
|
Select$1.ScrollUpArrow,
|
|
291
258
|
{
|
|
292
259
|
"data-slot": "select-scroll-up-button",
|
|
293
|
-
className: cn(
|
|
294
|
-
"top-0 z-10 flex w-full cursor-default items-center justify-center bg-[var(--bk-popover)] py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
295
|
-
className
|
|
296
|
-
),
|
|
260
|
+
className: cn("dr-select-scroll-btn dr-select-scroll-btn--up", className),
|
|
297
261
|
...props,
|
|
298
262
|
children: /* @__PURE__ */ jsx(HugeiconsIcon, { icon: ArrowUp01Icon, strokeWidth: 2 })
|
|
299
263
|
}
|
|
@@ -307,10 +271,7 @@ function SelectScrollDownButton({
|
|
|
307
271
|
Select$1.ScrollDownArrow,
|
|
308
272
|
{
|
|
309
273
|
"data-slot": "select-scroll-down-button",
|
|
310
|
-
className: cn(
|
|
311
|
-
"bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-[var(--bk-popover)] py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
312
|
-
className
|
|
313
|
-
),
|
|
274
|
+
className: cn("dr-select-scroll-btn dr-select-scroll-btn--down", className),
|
|
314
275
|
...props,
|
|
315
276
|
children: /* @__PURE__ */ jsx(HugeiconsIcon, { icon: ArrowDown01Icon, strokeWidth: 2 })
|
|
316
277
|
}
|
|
@@ -326,39 +287,18 @@ function Switch({
|
|
|
326
287
|
{
|
|
327
288
|
"data-slot": "switch",
|
|
328
289
|
"data-size": size,
|
|
329
|
-
className: cn(
|
|
330
|
-
"peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-[var(--bk-ring)] focus-visible:ring-1 focus-visible:ring-[var(--bk-ring)]/50 aria-invalid:border-[var(--bk-destructive)] aria-invalid:ring-1 aria-invalid:ring-[var(--bk-destructive)]/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] data-checked:bg-[var(--bk-primary)] data-unchecked:bg-[var(--bk-input)] data-disabled:cursor-not-allowed data-disabled:opacity-50",
|
|
331
|
-
className
|
|
332
|
-
),
|
|
290
|
+
className: cn("dr-switch", className),
|
|
333
291
|
...props,
|
|
334
292
|
children: /* @__PURE__ */ jsx(
|
|
335
293
|
Switch$1.Thumb,
|
|
336
294
|
{
|
|
337
295
|
"data-slot": "switch-thumb",
|
|
338
|
-
className: "
|
|
296
|
+
className: "dr-switch-thumb"
|
|
339
297
|
}
|
|
340
298
|
)
|
|
341
299
|
}
|
|
342
300
|
);
|
|
343
301
|
}
|
|
344
|
-
function Separator({
|
|
345
|
-
className,
|
|
346
|
-
orientation = "horizontal",
|
|
347
|
-
...props
|
|
348
|
-
}) {
|
|
349
|
-
return /* @__PURE__ */ jsx(
|
|
350
|
-
Separator$1,
|
|
351
|
-
{
|
|
352
|
-
"data-slot": "separator",
|
|
353
|
-
orientation,
|
|
354
|
-
className: cn(
|
|
355
|
-
"shrink-0 bg-[var(--bk-border)] data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
|
|
356
|
-
className
|
|
357
|
-
),
|
|
358
|
-
...props
|
|
359
|
-
}
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
302
|
function ScrollArea({
|
|
363
303
|
className,
|
|
364
304
|
style,
|
|
@@ -371,7 +311,7 @@ function ScrollArea({
|
|
|
371
311
|
{
|
|
372
312
|
"data-slot": "scroll-area",
|
|
373
313
|
style: { position: "relative", ...style },
|
|
374
|
-
className: cn("
|
|
314
|
+
className: cn("dr-scroll-area", className),
|
|
375
315
|
...props,
|
|
376
316
|
children: [
|
|
377
317
|
/* @__PURE__ */ jsx(
|
|
@@ -379,7 +319,7 @@ function ScrollArea({
|
|
|
379
319
|
{
|
|
380
320
|
ref: viewportRef,
|
|
381
321
|
"data-slot": "scroll-area-viewport",
|
|
382
|
-
className: "
|
|
322
|
+
className: "dr-scroll-area-viewport",
|
|
383
323
|
children
|
|
384
324
|
}
|
|
385
325
|
),
|
|
@@ -400,18 +340,13 @@ function ScrollBar({
|
|
|
400
340
|
{
|
|
401
341
|
"data-slot": "scroll-area-scrollbar",
|
|
402
342
|
orientation,
|
|
403
|
-
className: cn(
|
|
404
|
-
"flex touch-none select-none p-px transition-opacity z-[11]",
|
|
405
|
-
orientation === "vertical" && "h-full w-2.5",
|
|
406
|
-
orientation === "horizontal" && "h-2.5 flex-col",
|
|
407
|
-
className
|
|
408
|
-
),
|
|
343
|
+
className: cn("dr-scrollbar", className),
|
|
409
344
|
...props,
|
|
410
345
|
children: /* @__PURE__ */ jsx(
|
|
411
346
|
ScrollArea$1.Thumb,
|
|
412
347
|
{
|
|
413
348
|
"data-slot": "scroll-area-thumb",
|
|
414
|
-
className: "
|
|
349
|
+
className: "dr-scrollbar-thumb"
|
|
415
350
|
}
|
|
416
351
|
)
|
|
417
352
|
}
|
|
@@ -774,40 +709,20 @@ function DateTimePanel({
|
|
|
774
709
|
setPreviousDate(initDate);
|
|
775
710
|
}, [initDate]);
|
|
776
711
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
777
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
778
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
712
|
+
/* @__PURE__ */ jsxs("div", { className: "dr-panel-header", children: [
|
|
713
|
+
/* @__PURE__ */ jsxs("div", { className: "dr-panel-nav-label", children: [
|
|
779
714
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
780
715
|
/* @__PURE__ */ jsx("span", { onClick: () => setMonthYearPicker(monthYearPicker === "month" ? false : "month"), children: format(month, "MMMM") }),
|
|
781
|
-
/* @__PURE__ */ jsx("span", {
|
|
716
|
+
/* @__PURE__ */ jsx("span", { onClick: () => setMonthYearPicker(monthYearPicker === "year" ? false : "year"), children: format(month, "yyyy") })
|
|
782
717
|
] }),
|
|
783
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon",
|
|
718
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", onClick: () => setMonthYearPicker(monthYearPicker ? false : "year"), children: monthYearPicker ? /* @__PURE__ */ jsx(ChevronUpIcon, { style: { width: 16, height: 16 } }) : /* @__PURE__ */ jsx(ChevronDownIcon, { style: { width: 16, height: 16 } }) })
|
|
784
719
|
] }),
|
|
785
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
786
|
-
/* @__PURE__ */ jsx(
|
|
787
|
-
|
|
788
|
-
{
|
|
789
|
-
variant: "ghost",
|
|
790
|
-
size: "icon",
|
|
791
|
-
className: "w-7 h-7",
|
|
792
|
-
"aria-label": "Previous month",
|
|
793
|
-
onClick: onPrevMonth,
|
|
794
|
-
children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "w-4 h-4 stroke-muted-foreground" })
|
|
795
|
-
}
|
|
796
|
-
),
|
|
797
|
-
/* @__PURE__ */ jsx(
|
|
798
|
-
Button,
|
|
799
|
-
{
|
|
800
|
-
variant: "ghost",
|
|
801
|
-
size: "icon",
|
|
802
|
-
className: "w-7 h-7",
|
|
803
|
-
"aria-label": "Next month",
|
|
804
|
-
onClick: onNextMonth,
|
|
805
|
-
children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "w-4 h-4 stroke-muted-foreground" })
|
|
806
|
-
}
|
|
807
|
-
)
|
|
720
|
+
!monthYearPicker && /* @__PURE__ */ jsxs("div", { className: "dr-panel-nav-btn", children: [
|
|
721
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", "aria-label": "Previous month", onClick: onPrevMonth, children: /* @__PURE__ */ jsx(ChevronLeftIcon, { style: { width: 16, height: 16 } }) }),
|
|
722
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", "aria-label": "Next month", onClick: onNextMonth, children: /* @__PURE__ */ jsx(ChevronRightIcon, { style: { width: 16, height: 16 } }) })
|
|
808
723
|
] })
|
|
809
724
|
] }),
|
|
810
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
725
|
+
/* @__PURE__ */ jsxs("div", { className: "dr-panel-calendar", children: [
|
|
811
726
|
/* @__PURE__ */ jsx(
|
|
812
727
|
DayPicker,
|
|
813
728
|
{
|
|
@@ -832,31 +747,31 @@ function DateTimePanel({
|
|
|
832
747
|
disabled: [max ? { after: max } : null, min ? { before: min } : null].filter(Boolean),
|
|
833
748
|
onMonthChange: setMonth,
|
|
834
749
|
classNames: {
|
|
835
|
-
dropdowns: "
|
|
836
|
-
months: "
|
|
837
|
-
month: "
|
|
750
|
+
dropdowns: "dr-cal-dropdowns",
|
|
751
|
+
months: "dr-cal-months",
|
|
752
|
+
month: "dr-cal-month",
|
|
838
753
|
month_caption: "hidden",
|
|
839
754
|
button_previous: "hidden",
|
|
840
755
|
button_next: "hidden",
|
|
841
|
-
month_grid: "
|
|
842
|
-
weekdays: "
|
|
843
|
-
weekday: "
|
|
844
|
-
week: "
|
|
845
|
-
day: "
|
|
846
|
-
day_button:
|
|
847
|
-
range_end: "day-range-end
|
|
848
|
-
selected: "
|
|
849
|
-
today: "
|
|
850
|
-
outside: "day-outside
|
|
851
|
-
disabled: "
|
|
852
|
-
range_middle: "
|
|
853
|
-
hidden: "
|
|
756
|
+
month_grid: "dr-cal-month-grid",
|
|
757
|
+
weekdays: "dr-cal-weekdays",
|
|
758
|
+
weekday: "dr-cal-weekday",
|
|
759
|
+
week: "dr-cal-week",
|
|
760
|
+
day: "dr-cal-day",
|
|
761
|
+
day_button: "dr-cal-day-btn",
|
|
762
|
+
range_end: "dr-cal-day-range-end",
|
|
763
|
+
selected: "dr-cal-day-selected",
|
|
764
|
+
today: "dr-cal-day-today",
|
|
765
|
+
outside: "dr-cal-day-outside",
|
|
766
|
+
disabled: "dr-cal-day-disabled",
|
|
767
|
+
range_middle: "dr-cal-day-range-middle",
|
|
768
|
+
hidden: "dr-cal-day-hidden"
|
|
854
769
|
},
|
|
855
770
|
showOutsideDays: true,
|
|
856
771
|
...props
|
|
857
772
|
}
|
|
858
773
|
),
|
|
859
|
-
/* @__PURE__ */ jsx("div", { className: cn("
|
|
774
|
+
/* @__PURE__ */ jsx("div", { className: cn("dr-panel-overlay", !monthYearPicker && "dr-panel-overlay--hidden") }),
|
|
860
775
|
/* @__PURE__ */ jsx(
|
|
861
776
|
MonthYearPicker,
|
|
862
777
|
{
|
|
@@ -865,12 +780,12 @@ function DateTimePanel({
|
|
|
865
780
|
onChange: onMonthYearChanged,
|
|
866
781
|
minDate,
|
|
867
782
|
maxDate,
|
|
868
|
-
className: cn("
|
|
783
|
+
className: cn("dr-panel-monthyear", !monthYearPicker && "dr-panel-monthyear--hidden")
|
|
869
784
|
}
|
|
870
785
|
)
|
|
871
786
|
] }),
|
|
872
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
873
|
-
precision !== "date" && /* @__PURE__ */ jsx("div", { className: "
|
|
787
|
+
/* @__PURE__ */ jsxs("div", { className: "dr-panel-footer", children: [
|
|
788
|
+
precision !== "date" && /* @__PURE__ */ jsx("div", { className: "dr-panel-time", children: /* @__PURE__ */ jsx(
|
|
874
789
|
TimePicker,
|
|
875
790
|
{
|
|
876
791
|
timePicker: precisionToTimePicker(precision),
|
|
@@ -881,8 +796,8 @@ function DateTimePanel({
|
|
|
881
796
|
max: maxDate
|
|
882
797
|
}
|
|
883
798
|
) }),
|
|
884
|
-
(isError || errorType !== null) && /* @__PURE__ */ jsx("div", { className: "
|
|
885
|
-
!immediate && /* @__PURE__ */ jsxs("div", { className: "
|
|
799
|
+
(isError || errorType !== null) && /* @__PURE__ */ jsx("div", { className: "dr-panel-error", children: /* @__PURE__ */ jsx("span", { className: "dr-panel-error-msg", children: getRangeErrorMessage?.(errorType, title) ?? "Invalid date range." }) }),
|
|
800
|
+
!immediate && /* @__PURE__ */ jsxs("div", { className: "dr-panel-buttons", children: [
|
|
886
801
|
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: onCancel, children: "Cancel" }),
|
|
887
802
|
/* @__PURE__ */ jsx(Button, { size: "sm", onClick: onSubmit, children: "Done" })
|
|
888
803
|
] })
|
|
@@ -1044,13 +959,9 @@ function DatetimeSegmentInput({
|
|
|
1044
959
|
"div",
|
|
1045
960
|
{
|
|
1046
961
|
ref: containerRef,
|
|
1047
|
-
className: cn(
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
isError && "border-[var(--bk-destructive)] ring-1 ring-[var(--bk-destructive)]/20",
|
|
1051
|
-
disabled && "opacity-50 cursor-not-allowed pointer-events-none bg-[var(--bk-input)]/50",
|
|
1052
|
-
className
|
|
1053
|
-
),
|
|
962
|
+
className: cn("dr-segment-input", className),
|
|
963
|
+
"data-error": isError || void 0,
|
|
964
|
+
"data-disabled": disabled || void 0,
|
|
1054
965
|
onMouseDown: (e) => {
|
|
1055
966
|
const target = e.target;
|
|
1056
967
|
if (target.tagName === "SPAN") {
|
|
@@ -1062,7 +973,7 @@ function DatetimeSegmentInput({
|
|
|
1062
973
|
const sep = idx === 0 ? null : idx === 3 ? "\xA0" : idx < 3 ? "-" : ":";
|
|
1063
974
|
const isFocused = typing[seg.key] !== null;
|
|
1064
975
|
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
1065
|
-
sep !== null && /* @__PURE__ */ jsx("span", { className: "
|
|
976
|
+
sep !== null && /* @__PURE__ */ jsx("span", { className: "dr-segment-sep", "aria-hidden": true, children: sep }),
|
|
1066
977
|
/* @__PURE__ */ jsx(
|
|
1067
978
|
"div",
|
|
1068
979
|
{
|
|
@@ -1075,11 +986,8 @@ function DatetimeSegmentInput({
|
|
|
1075
986
|
"aria-valuemin": seg.min,
|
|
1076
987
|
"aria-valuemax": seg.max,
|
|
1077
988
|
tabIndex: disabled ? -1 : 0,
|
|
1078
|
-
className:
|
|
1079
|
-
|
|
1080
|
-
"focus:bg-[var(--bk-primary)] focus:text-[var(--bk-primary-foreground)]",
|
|
1081
|
-
isFocused && "bg-[var(--bk-primary)]/20"
|
|
1082
|
-
),
|
|
989
|
+
className: "dr-segment",
|
|
990
|
+
"data-focused": isFocused || void 0,
|
|
1083
991
|
style: { height: "24px", lineHeight: "24px" },
|
|
1084
992
|
onKeyDown: (e) => handleKeyDown(e, seg),
|
|
1085
993
|
onBlur: () => handleBlur(seg.key),
|
|
@@ -1257,17 +1165,17 @@ function RelativeSidePanel({ value, onChange, relativeFormats, showNow, labels }
|
|
|
1257
1165
|
});
|
|
1258
1166
|
}
|
|
1259
1167
|
};
|
|
1260
|
-
return /* @__PURE__ */ jsxs("div", { className: "
|
|
1168
|
+
return /* @__PURE__ */ jsxs("div", { className: "dr-relative", children: [
|
|
1261
1169
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1262
|
-
/* @__PURE__ */ jsx("p", { className: "
|
|
1263
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
1170
|
+
/* @__PURE__ */ jsx("p", { className: "dr-relative-label", children: labels.amount }),
|
|
1171
|
+
/* @__PURE__ */ jsxs("div", { className: "dr-relative-row", children: [
|
|
1264
1172
|
/* @__PURE__ */ jsx(
|
|
1265
1173
|
Input,
|
|
1266
1174
|
{
|
|
1267
1175
|
type: "text",
|
|
1268
1176
|
inputMode: "numeric",
|
|
1269
1177
|
pattern: "[0-9]*",
|
|
1270
|
-
className: "
|
|
1178
|
+
className: "dr-relative-input",
|
|
1271
1179
|
disabled: isNow,
|
|
1272
1180
|
value: numValue,
|
|
1273
1181
|
onChange: (e) => {
|
|
@@ -1294,14 +1202,14 @@ function RelativeSidePanel({ value, onChange, relativeFormats, showNow, labels }
|
|
|
1294
1202
|
emit({ numValue, format: f, isNow });
|
|
1295
1203
|
},
|
|
1296
1204
|
children: [
|
|
1297
|
-
/* @__PURE__ */ jsx(SelectTrigger, {
|
|
1298
|
-
/* @__PURE__ */ jsx(SelectContent, { children: relativeFormats.map((f) => /* @__PURE__ */ jsx(SelectItem, { value: f,
|
|
1205
|
+
/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { children: format3 }) }),
|
|
1206
|
+
/* @__PURE__ */ jsx(SelectContent, { children: relativeFormats.map((f) => /* @__PURE__ */ jsx(SelectItem, { value: f, children: f }, f)) })
|
|
1299
1207
|
]
|
|
1300
1208
|
}
|
|
1301
1209
|
)
|
|
1302
1210
|
] })
|
|
1303
1211
|
] }),
|
|
1304
|
-
showNow && /* @__PURE__ */ jsxs("div", { className: "
|
|
1212
|
+
showNow && /* @__PURE__ */ jsxs("div", { className: "dr-relative-now-row", children: [
|
|
1305
1213
|
/* @__PURE__ */ jsx(
|
|
1306
1214
|
Switch,
|
|
1307
1215
|
{
|
|
@@ -1312,9 +1220,9 @@ function RelativeSidePanel({ value, onChange, relativeFormats, showNow, labels }
|
|
|
1312
1220
|
}
|
|
1313
1221
|
}
|
|
1314
1222
|
),
|
|
1315
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
1316
|
-
/* @__PURE__ */ jsx("label", { className: "
|
|
1317
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
1223
|
+
/* @__PURE__ */ jsxs("div", { className: "dr-relative-now-labels", children: [
|
|
1224
|
+
/* @__PURE__ */ jsx("label", { className: "dr-relative-now-label", children: labels.now }),
|
|
1225
|
+
/* @__PURE__ */ jsx("span", { className: "dr-relative-now-desc", children: labels.nowDescription })
|
|
1318
1226
|
] })
|
|
1319
1227
|
] })
|
|
1320
1228
|
] });
|
|
@@ -1331,14 +1239,14 @@ function AbsoluteContent({
|
|
|
1331
1239
|
use12HourFormat
|
|
1332
1240
|
}) {
|
|
1333
1241
|
const compareDate = compareValue ? toDate(compareValue) : void 0;
|
|
1334
|
-
const
|
|
1335
|
-
return /* @__PURE__ */ jsxs("div", { className: "
|
|
1242
|
+
const currentDate = value.type === "absolute" ? toDate(value) : /* @__PURE__ */ new Date();
|
|
1243
|
+
return /* @__PURE__ */ jsxs("div", { className: "dr-absolute-row", children: [
|
|
1336
1244
|
/* @__PURE__ */ jsx(
|
|
1337
1245
|
DatetimeSegmentInput,
|
|
1338
1246
|
{
|
|
1339
|
-
value:
|
|
1247
|
+
value: currentDate,
|
|
1340
1248
|
onChange: (d) => onChange(absoluteDate(d)),
|
|
1341
|
-
className: "
|
|
1249
|
+
className: "dr-absolute-input",
|
|
1342
1250
|
precision
|
|
1343
1251
|
}
|
|
1344
1252
|
),
|
|
@@ -1353,7 +1261,7 @@ function AbsoluteContent({
|
|
|
1353
1261
|
type: "button",
|
|
1354
1262
|
variant: "outline",
|
|
1355
1263
|
size: "icon",
|
|
1356
|
-
className: "
|
|
1264
|
+
className: "dr-absolute-btn",
|
|
1357
1265
|
title: "Pick from calendar",
|
|
1358
1266
|
children: /* @__PURE__ */ jsx(CalendarDays, { size: 14 })
|
|
1359
1267
|
}
|
|
@@ -1371,7 +1279,7 @@ function AbsoluteContent({
|
|
|
1371
1279
|
children: /* @__PURE__ */ jsx(
|
|
1372
1280
|
DateTimePanel,
|
|
1373
1281
|
{
|
|
1374
|
-
value: value.type === "absolute" ?
|
|
1282
|
+
value: value.type === "absolute" ? currentDate : void 0,
|
|
1375
1283
|
compareValue: compareDate,
|
|
1376
1284
|
title,
|
|
1377
1285
|
immediate: true,
|
|
@@ -1396,22 +1304,23 @@ function SidePanel({
|
|
|
1396
1304
|
value,
|
|
1397
1305
|
compareValue,
|
|
1398
1306
|
onChange,
|
|
1399
|
-
showAbsolute,
|
|
1400
|
-
showRelative,
|
|
1401
|
-
precision,
|
|
1402
|
-
relativeFormats,
|
|
1403
|
-
showNow,
|
|
1307
|
+
showAbsolute = true,
|
|
1308
|
+
showRelative = true,
|
|
1309
|
+
precision = "second",
|
|
1310
|
+
relativeFormats = RELATIVE_FORMATS,
|
|
1311
|
+
showNow = true,
|
|
1404
1312
|
min,
|
|
1405
1313
|
max,
|
|
1406
1314
|
timezone,
|
|
1407
1315
|
use12HourFormat,
|
|
1408
|
-
labels
|
|
1316
|
+
labels: labelsProp
|
|
1409
1317
|
}) {
|
|
1318
|
+
const labels = { ...DEFAULT_LABELS, ...labelsProp };
|
|
1410
1319
|
useEffect(() => {
|
|
1411
1320
|
if (!showRelative && value.type === "relative") {
|
|
1412
1321
|
onChange(absoluteDate(/* @__PURE__ */ new Date()));
|
|
1413
1322
|
} else if (!showAbsolute && value.type === "absolute") {
|
|
1414
|
-
onChange({ type: "relative", relativeValue: "5", relativeFormat: relativeFormats[0] ??
|
|
1323
|
+
onChange({ type: "relative", relativeValue: "5", relativeFormat: relativeFormats[0] ?? RELATIVE_FORMATS[0] });
|
|
1415
1324
|
}
|
|
1416
1325
|
}, [showRelative, showAbsolute]);
|
|
1417
1326
|
const hasBothModes = showAbsolute && showRelative;
|
|
@@ -1439,22 +1348,22 @@ function SidePanel({
|
|
|
1439
1348
|
labels
|
|
1440
1349
|
}
|
|
1441
1350
|
);
|
|
1442
|
-
return /* @__PURE__ */ jsxs("div", { className: "
|
|
1443
|
-
/* @__PURE__ */ jsx("p", { className: "
|
|
1351
|
+
return /* @__PURE__ */ jsxs("div", { className: "dr-side-panel", children: [
|
|
1352
|
+
/* @__PURE__ */ jsx("p", { className: "dr-side-panel-title", children: title }),
|
|
1444
1353
|
hasBothModes ? /* @__PURE__ */ jsxs(
|
|
1445
1354
|
Tabs,
|
|
1446
1355
|
{
|
|
1447
1356
|
value: value.type,
|
|
1448
|
-
className: "
|
|
1357
|
+
className: "dr-side-panel-tabs",
|
|
1449
1358
|
onValueChange: (t) => {
|
|
1450
1359
|
if (t === "absolute") {
|
|
1451
1360
|
onChange(absoluteDate(value.type === "absolute" ? toDate(value) : /* @__PURE__ */ new Date()));
|
|
1452
1361
|
} else if (value.type !== "relative") {
|
|
1453
|
-
onChange({ type: "relative", relativeValue: "5", relativeFormat: relativeFormats[0] ??
|
|
1362
|
+
onChange({ type: "relative", relativeValue: "5", relativeFormat: relativeFormats[0] ?? RELATIVE_FORMATS[0] });
|
|
1454
1363
|
}
|
|
1455
1364
|
},
|
|
1456
1365
|
children: [
|
|
1457
|
-
/* @__PURE__ */ jsxs(TabsList, { className: "grid
|
|
1366
|
+
/* @__PURE__ */ jsxs(TabsList, { className: "dr-tabs-list--grid dr-tabs-list--grid-2", children: [
|
|
1458
1367
|
/* @__PURE__ */ jsx(TabsTrigger, { value: "absolute", children: labels.absolute }),
|
|
1459
1368
|
/* @__PURE__ */ jsx(TabsTrigger, { value: "relative", children: labels.relative })
|
|
1460
1369
|
] }),
|
|
@@ -1465,41 +1374,27 @@ function SidePanel({
|
|
|
1465
1374
|
) : showAbsolute ? absoluteContent : relativeContent
|
|
1466
1375
|
] });
|
|
1467
1376
|
}
|
|
1468
|
-
function
|
|
1377
|
+
function useDatetimeRange({
|
|
1469
1378
|
startTime,
|
|
1470
1379
|
endTime,
|
|
1471
|
-
onChange
|
|
1472
|
-
quickPresets = QUICK_PRESETS,
|
|
1473
|
-
showQuickRanges = true,
|
|
1474
|
-
showAbsolute = true,
|
|
1475
|
-
showRelative = true,
|
|
1476
|
-
precision = "second",
|
|
1477
|
-
relativeFormats = RELATIVE_FORMATS,
|
|
1478
|
-
min,
|
|
1479
|
-
max,
|
|
1480
|
-
timezone,
|
|
1481
|
-
use12HourFormat = false,
|
|
1482
|
-
showNow = true,
|
|
1483
|
-
disabled = false,
|
|
1484
|
-
labels: labelsProp,
|
|
1485
|
-
popoverAlign = "start",
|
|
1486
|
-
popoverSide = "bottom",
|
|
1487
|
-
renderTrigger,
|
|
1488
|
-
className
|
|
1380
|
+
onChange
|
|
1489
1381
|
}) {
|
|
1490
|
-
const labels = { ...DEFAULT_LABELS, ...labelsProp };
|
|
1491
1382
|
const [isOpen, setIsOpen] = useState(false);
|
|
1492
1383
|
const [draftStart, setDraftStart] = useState(startTime);
|
|
1493
1384
|
const [draftEnd, setDraftEnd] = useState(endTime);
|
|
1494
1385
|
const [error, setError] = useState(null);
|
|
1386
|
+
const wasOpen = useRef(false);
|
|
1495
1387
|
useEffect(() => {
|
|
1496
|
-
|
|
1388
|
+
const justOpened = isOpen && !wasOpen.current;
|
|
1389
|
+
wasOpen.current = isOpen;
|
|
1390
|
+
if (justOpened) {
|
|
1497
1391
|
setDraftStart(startTime);
|
|
1498
1392
|
setDraftEnd(endTime);
|
|
1499
1393
|
setError(null);
|
|
1500
1394
|
}
|
|
1501
1395
|
}, [isOpen, startTime, endTime]);
|
|
1502
|
-
const
|
|
1396
|
+
const clearError = useCallback(() => setError(null), []);
|
|
1397
|
+
const onApply = useCallback(() => {
|
|
1503
1398
|
const err = validateRange(draftStart, draftEnd);
|
|
1504
1399
|
if (err) {
|
|
1505
1400
|
setError(err);
|
|
@@ -1507,17 +1402,68 @@ function DatetimeRange({
|
|
|
1507
1402
|
}
|
|
1508
1403
|
onChange(draftStart, draftEnd);
|
|
1509
1404
|
setIsOpen(false);
|
|
1510
|
-
};
|
|
1511
|
-
const
|
|
1405
|
+
}, [draftStart, draftEnd, onChange]);
|
|
1406
|
+
const onCancel = useCallback(() => {
|
|
1512
1407
|
setDraftStart(startTime);
|
|
1513
1408
|
setDraftEnd(endTime);
|
|
1514
1409
|
setError(null);
|
|
1515
1410
|
setIsOpen(false);
|
|
1516
|
-
};
|
|
1517
|
-
const
|
|
1411
|
+
}, [startTime, endTime]);
|
|
1412
|
+
const onPreset = useCallback((preset) => {
|
|
1518
1413
|
onChange(preset.start, preset.end);
|
|
1519
1414
|
setIsOpen(false);
|
|
1415
|
+
}, [onChange]);
|
|
1416
|
+
return {
|
|
1417
|
+
isOpen,
|
|
1418
|
+
setIsOpen,
|
|
1419
|
+
draftStart,
|
|
1420
|
+
setDraftStart,
|
|
1421
|
+
draftEnd,
|
|
1422
|
+
setDraftEnd,
|
|
1423
|
+
error,
|
|
1424
|
+
clearError,
|
|
1425
|
+
onApply,
|
|
1426
|
+
onCancel,
|
|
1427
|
+
onPreset
|
|
1520
1428
|
};
|
|
1429
|
+
}
|
|
1430
|
+
function DatetimeRange({
|
|
1431
|
+
startTime,
|
|
1432
|
+
endTime,
|
|
1433
|
+
onChange,
|
|
1434
|
+
quickPresets = QUICK_PRESETS,
|
|
1435
|
+
showQuickRanges = true,
|
|
1436
|
+
showAbsolute = true,
|
|
1437
|
+
showRelative = true,
|
|
1438
|
+
precision = "second",
|
|
1439
|
+
relativeFormats = RELATIVE_FORMATS,
|
|
1440
|
+
min,
|
|
1441
|
+
max,
|
|
1442
|
+
timezone,
|
|
1443
|
+
use12HourFormat = false,
|
|
1444
|
+
showNow = true,
|
|
1445
|
+
disabled = false,
|
|
1446
|
+
labels: labelsProp,
|
|
1447
|
+
popoverAlign = "start",
|
|
1448
|
+
popoverSide = "bottom",
|
|
1449
|
+
renderTrigger,
|
|
1450
|
+
portalContainer,
|
|
1451
|
+
className
|
|
1452
|
+
}) {
|
|
1453
|
+
const labels = { ...DEFAULT_LABELS, ...labelsProp };
|
|
1454
|
+
const {
|
|
1455
|
+
isOpen,
|
|
1456
|
+
setIsOpen,
|
|
1457
|
+
draftStart,
|
|
1458
|
+
setDraftStart,
|
|
1459
|
+
draftEnd,
|
|
1460
|
+
setDraftEnd,
|
|
1461
|
+
error,
|
|
1462
|
+
clearError,
|
|
1463
|
+
onApply: handleApply,
|
|
1464
|
+
onCancel: handleCancel,
|
|
1465
|
+
onPreset: handlePreset
|
|
1466
|
+
} = useDatetimeRange({ startTime, endTime, onChange });
|
|
1521
1467
|
const sidePanelProps = {
|
|
1522
1468
|
showAbsolute,
|
|
1523
1469
|
showRelative,
|
|
@@ -1541,15 +1487,11 @@ function DatetimeRange({
|
|
|
1541
1487
|
...triggerProps,
|
|
1542
1488
|
variant: "outline",
|
|
1543
1489
|
disabled,
|
|
1544
|
-
className: cn(
|
|
1545
|
-
"h-8 px-3 gap-2 text-xs font-normal justify-start",
|
|
1546
|
-
isOpen && "border-[var(--bk-foreground)]",
|
|
1547
|
-
className
|
|
1548
|
-
),
|
|
1490
|
+
className: cn("dr-range-trigger", isOpen && "dr-range-trigger--open", className),
|
|
1549
1491
|
children: [
|
|
1550
|
-
/* @__PURE__ */ jsx(CalendarDays, { size: 14, className: "
|
|
1492
|
+
/* @__PURE__ */ jsx(CalendarDays, { size: 14, className: "dr-range-trigger-icon" }),
|
|
1551
1493
|
/* @__PURE__ */ jsx("span", { children: toDisplayString(startTime, { precision }) }),
|
|
1552
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
1494
|
+
/* @__PURE__ */ jsx("span", { className: "dr-range-trigger-arrow", children: "\u2192" }),
|
|
1553
1495
|
/* @__PURE__ */ jsx("span", { children: toDisplayString(endTime, { precision }) })
|
|
1554
1496
|
]
|
|
1555
1497
|
}
|
|
@@ -1559,28 +1501,29 @@ function DatetimeRange({
|
|
|
1559
1501
|
/* @__PURE__ */ jsx(
|
|
1560
1502
|
PopoverContent,
|
|
1561
1503
|
{
|
|
1562
|
-
className: "
|
|
1504
|
+
className: "dr-range-popup-content",
|
|
1563
1505
|
align: popoverAlign,
|
|
1564
1506
|
side: popoverSide,
|
|
1565
1507
|
sideOffset: 4,
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
1508
|
+
container: portalContainer,
|
|
1509
|
+
children: /* @__PURE__ */ jsxs("div", { className: "dr-range-popup", children: [
|
|
1510
|
+
showQuickRanges && quickPresets.length > 0 && /* @__PURE__ */ jsx("div", { className: "dr-range-quick", children: /* @__PURE__ */ jsxs("div", { className: "dr-range-quick-inner", children: [
|
|
1511
|
+
/* @__PURE__ */ jsx("div", { className: "dr-range-quick-label", children: labels.quickRanges }),
|
|
1512
|
+
/* @__PURE__ */ jsx("div", { className: "dr-range-quick-list", children: quickPresets.map((preset) => /* @__PURE__ */ jsx(
|
|
1570
1513
|
"button",
|
|
1571
1514
|
{
|
|
1572
1515
|
type: "button",
|
|
1573
|
-
className: "
|
|
1516
|
+
className: "dr-range-quick-item",
|
|
1574
1517
|
onClick: () => handlePreset(preset),
|
|
1575
1518
|
children: preset.label
|
|
1576
1519
|
},
|
|
1577
1520
|
preset.label
|
|
1578
1521
|
)) })
|
|
1579
1522
|
] }) }),
|
|
1580
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
1581
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
1582
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
1583
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
1523
|
+
/* @__PURE__ */ jsxs("div", { className: "dr-range-pickers", children: [
|
|
1524
|
+
/* @__PURE__ */ jsx("div", { className: "dr-range-divider" }),
|
|
1525
|
+
/* @__PURE__ */ jsxs("div", { className: "dr-range-panels", children: [
|
|
1526
|
+
/* @__PURE__ */ jsx("div", { className: "dr-range-panel-slot", children: /* @__PURE__ */ jsx(
|
|
1584
1527
|
SidePanel,
|
|
1585
1528
|
{
|
|
1586
1529
|
title: labels.start,
|
|
@@ -1588,12 +1531,12 @@ function DatetimeRange({
|
|
|
1588
1531
|
compareValue: draftEnd,
|
|
1589
1532
|
onChange: (v) => {
|
|
1590
1533
|
setDraftStart(v);
|
|
1591
|
-
|
|
1534
|
+
clearError();
|
|
1592
1535
|
},
|
|
1593
1536
|
...sidePanelProps
|
|
1594
1537
|
}
|
|
1595
1538
|
) }),
|
|
1596
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
1539
|
+
/* @__PURE__ */ jsx("div", { className: "dr-range-panel-slot", children: /* @__PURE__ */ jsx(
|
|
1597
1540
|
SidePanel,
|
|
1598
1541
|
{
|
|
1599
1542
|
title: labels.end,
|
|
@@ -1601,16 +1544,15 @@ function DatetimeRange({
|
|
|
1601
1544
|
compareValue: draftStart,
|
|
1602
1545
|
onChange: (v) => {
|
|
1603
1546
|
setDraftEnd(v);
|
|
1604
|
-
|
|
1547
|
+
clearError();
|
|
1605
1548
|
},
|
|
1606
1549
|
...sidePanelProps
|
|
1607
1550
|
}
|
|
1608
1551
|
) })
|
|
1609
1552
|
] }),
|
|
1610
|
-
/* @__PURE__ */
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
1553
|
+
/* @__PURE__ */ jsxs("div", { className: "dr-range-footer", children: [
|
|
1554
|
+
error === "validation" ? /* @__PURE__ */ jsx("span", { className: "dr-range-error-text", children: "Start must be earlier than end." }) : /* @__PURE__ */ jsx("span", {}),
|
|
1555
|
+
/* @__PURE__ */ jsxs("div", { className: "dr-range-actions", children: [
|
|
1614
1556
|
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: handleCancel, children: labels.cancel }),
|
|
1615
1557
|
/* @__PURE__ */ jsx(Button, { size: "sm", onClick: handleApply, children: labels.apply })
|
|
1616
1558
|
] })
|
|
@@ -1622,6 +1564,6 @@ function DatetimeRange({
|
|
|
1622
1564
|
] });
|
|
1623
1565
|
}
|
|
1624
1566
|
|
|
1625
|
-
export { DateTimePanel, DatetimeRange, DatetimeSegmentInput, QUICK_PRESETS, RELATIVE_FORMATS, absoluteDate, fromUrlString, relativeAgo, relativeNow, toDate, toDisplayString, toTimestamp, toTimestampMs, toUrlString, validateRange };
|
|
1567
|
+
export { DateTimePanel, DatetimeRange, DatetimeSegmentInput, QUICK_PRESETS, RELATIVE_FORMATS, SidePanel, absoluteDate, fromUrlString, relativeAgo, relativeNow, toDate, toDisplayString, toTimestamp, toTimestampMs, toUrlString, useDatetimeRange, validateRange };
|
|
1626
1568
|
//# sourceMappingURL=index.js.map
|
|
1627
1569
|
//# sourceMappingURL=index.js.map
|