@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 CHANGED
@@ -1,19 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var React = require('react');
4
3
  var lucideReact = require('lucide-react');
5
4
  var clsx = require('clsx');
6
5
  var button = require('@base-ui/react/button');
7
6
  var jsxRuntime = require('react/jsx-runtime');
8
7
  var popover = require('@base-ui/react/popover');
8
+ var React = require('react');
9
9
  var tabs = require('@base-ui/react/tabs');
10
- var classVarianceAuthority = require('class-variance-authority');
11
10
  var input = require('@base-ui/react/input');
12
11
  var select = require('@base-ui/react/select');
13
12
  var react = require('@hugeicons/react');
14
13
  var coreFreeIcons = require('@hugeicons/core-free-icons');
15
14
  var _switch = require('@base-ui/react/switch');
16
- var separator = require('@base-ui/react/separator');
17
15
  var dateFns = require('date-fns');
18
16
  var reactDayPicker = require('react-day-picker');
19
17
  var setMonth = require('date-fns/setMonth');
@@ -85,9 +83,10 @@ function PopoverContent({
85
83
  sideOffset = 4,
86
84
  disableAnchorTracking,
87
85
  collisionAvoidance,
86
+ container,
88
87
  ...props
89
88
  }) {
90
- return /* @__PURE__ */ jsxRuntime.jsx(popover.Popover.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
89
+ return /* @__PURE__ */ jsxRuntime.jsx(popover.Popover.Portal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(
91
90
  popover.Popover.Positioner,
92
91
  {
93
92
  align,
@@ -96,15 +95,12 @@ function PopoverContent({
96
95
  sideOffset,
97
96
  disableAnchorTracking,
98
97
  collisionAvoidance,
99
- className: "isolate z-50",
98
+ className: "dr-positioner",
100
99
  children: /* @__PURE__ */ jsxRuntime.jsx(
101
100
  popover.Popover.Popup,
102
101
  {
103
102
  "data-slot": "popover-content",
104
- className: cn(
105
- "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",
106
- className
107
- ),
103
+ className: cn("dr-popover-content", className),
108
104
  ...props
109
105
  }
110
106
  )
@@ -121,25 +117,11 @@ function Tabs({
121
117
  {
122
118
  "data-slot": "tabs",
123
119
  "data-orientation": orientation,
124
- className: cn("group/tabs flex gap-2 data-horizontal:flex-col", className),
120
+ className: cn("dr-tabs", className),
125
121
  ...props
126
122
  }
127
123
  );
128
124
  }
129
- var tabsListVariants = classVarianceAuthority.cva(
130
- "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",
131
- {
132
- variants: {
133
- variant: {
134
- default: "bg-[var(--bk-muted)]",
135
- line: "gap-1 bg-transparent"
136
- }
137
- },
138
- defaultVariants: {
139
- variant: "default"
140
- }
141
- }
142
- );
143
125
  function TabsList({
144
126
  className,
145
127
  variant = "default",
@@ -150,7 +132,7 @@ function TabsList({
150
132
  {
151
133
  "data-slot": "tabs-list",
152
134
  "data-variant": variant,
153
- className: cn(tabsListVariants({ variant }), className),
135
+ className: cn("dr-tabs-list", className),
154
136
  ...props
155
137
  }
156
138
  );
@@ -160,13 +142,7 @@ function TabsTrigger({ className, ...props }) {
160
142
  tabs.Tabs.Tab,
161
143
  {
162
144
  "data-slot": "tabs-trigger",
163
- className: cn(
164
- "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",
165
- "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent",
166
- "data-active:bg-[var(--bk-background)] data-active:text-[var(--bk-foreground)]",
167
- "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",
168
- className
169
- ),
145
+ className: cn("dr-tabs-trigger", className),
170
146
  ...props
171
147
  }
172
148
  );
@@ -176,7 +152,7 @@ function TabsContent({ className, ...props }) {
176
152
  tabs.Tabs.Panel,
177
153
  {
178
154
  "data-slot": "tabs-content",
179
- className: cn("flex-1 text-xs/relaxed outline-none", className),
155
+ className: cn("dr-tabs-content", className),
180
156
  ...props
181
157
  }
182
158
  );
@@ -201,7 +177,7 @@ function SelectValue({ className, ...props }) {
201
177
  select.Select.Value,
202
178
  {
203
179
  "data-slot": "select-value",
204
- className: cn("flex flex-1 text-left", className),
180
+ className: cn("dr-select-value", className),
205
181
  ...props
206
182
  }
207
183
  );
@@ -217,10 +193,7 @@ function SelectTrigger({
217
193
  {
218
194
  "data-slot": "select-trigger",
219
195
  "data-size": size,
220
- className: cn(
221
- "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",
222
- className
223
- ),
196
+ className: cn("dr-select-trigger", className),
224
197
  ...props,
225
198
  children: [
226
199
  children,
@@ -232,7 +205,7 @@ function SelectTrigger({
232
205
  {
233
206
  icon: coreFreeIcons.UnfoldMoreIcon,
234
207
  strokeWidth: 2,
235
- className: "pointer-events-none size-4 text-[var(--bk-muted-foreground)]"
208
+ className: "dr-select-icon"
236
209
  }
237
210
  )
238
211
  }
@@ -259,16 +232,13 @@ function SelectContent({
259
232
  align,
260
233
  alignOffset,
261
234
  alignItemWithTrigger,
262
- className: "isolate z-50",
235
+ className: "dr-positioner",
263
236
  children: /* @__PURE__ */ jsxRuntime.jsxs(
264
237
  select.Select.Popup,
265
238
  {
266
239
  "data-slot": "select-content",
267
240
  "data-align-trigger": alignItemWithTrigger,
268
- className: cn(
269
- "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!",
270
- className
271
- ),
241
+ className: cn("dr-select-content", className),
272
242
  ...props,
273
243
  children: [
274
244
  /* @__PURE__ */ jsxRuntime.jsx(SelectScrollUpButton, {}),
@@ -289,18 +259,15 @@ function SelectItem({
289
259
  select.Select.Item,
290
260
  {
291
261
  "data-slot": "select-item",
292
- className: cn(
293
- "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",
294
- className
295
- ),
262
+ className: cn("dr-select-item", className),
296
263
  ...props,
297
264
  children: [
298
- /* @__PURE__ */ jsxRuntime.jsx(select.Select.ItemText, { className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap", children }),
265
+ /* @__PURE__ */ jsxRuntime.jsx(select.Select.ItemText, { className: "dr-select-item-text", children }),
299
266
  /* @__PURE__ */ jsxRuntime.jsx(
300
267
  select.Select.ItemIndicator,
301
268
  {
302
- render: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center" }),
303
- children: /* @__PURE__ */ jsxRuntime.jsx(react.HugeiconsIcon, { icon: coreFreeIcons.Tick02Icon, strokeWidth: 2, className: "pointer-events-none" })
269
+ render: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "dr-select-item-indicator" }),
270
+ children: /* @__PURE__ */ jsxRuntime.jsx(react.HugeiconsIcon, { icon: coreFreeIcons.Tick02Icon, strokeWidth: 2, style: { pointerEvents: "none" } })
304
271
  }
305
272
  )
306
273
  ]
@@ -315,10 +282,7 @@ function SelectScrollUpButton({
315
282
  select.Select.ScrollUpArrow,
316
283
  {
317
284
  "data-slot": "select-scroll-up-button",
318
- className: cn(
319
- "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",
320
- className
321
- ),
285
+ className: cn("dr-select-scroll-btn dr-select-scroll-btn--up", className),
322
286
  ...props,
323
287
  children: /* @__PURE__ */ jsxRuntime.jsx(react.HugeiconsIcon, { icon: coreFreeIcons.ArrowUp01Icon, strokeWidth: 2 })
324
288
  }
@@ -332,10 +296,7 @@ function SelectScrollDownButton({
332
296
  select.Select.ScrollDownArrow,
333
297
  {
334
298
  "data-slot": "select-scroll-down-button",
335
- className: cn(
336
- "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",
337
- className
338
- ),
299
+ className: cn("dr-select-scroll-btn dr-select-scroll-btn--down", className),
339
300
  ...props,
340
301
  children: /* @__PURE__ */ jsxRuntime.jsx(react.HugeiconsIcon, { icon: coreFreeIcons.ArrowDown01Icon, strokeWidth: 2 })
341
302
  }
@@ -351,39 +312,18 @@ function Switch({
351
312
  {
352
313
  "data-slot": "switch",
353
314
  "data-size": size,
354
- className: cn(
355
- "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",
356
- className
357
- ),
315
+ className: cn("dr-switch", className),
358
316
  ...props,
359
317
  children: /* @__PURE__ */ jsxRuntime.jsx(
360
318
  _switch.Switch.Thumb,
361
319
  {
362
320
  "data-slot": "switch-thumb",
363
- className: "pointer-events-none block rounded-full bg-[var(--bk-switch-thumb)] ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0"
321
+ className: "dr-switch-thumb"
364
322
  }
365
323
  )
366
324
  }
367
325
  );
368
326
  }
369
- function Separator({
370
- className,
371
- orientation = "horizontal",
372
- ...props
373
- }) {
374
- return /* @__PURE__ */ jsxRuntime.jsx(
375
- separator.Separator,
376
- {
377
- "data-slot": "separator",
378
- orientation,
379
- className: cn(
380
- "shrink-0 bg-[var(--bk-border)] data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
381
- className
382
- ),
383
- ...props
384
- }
385
- );
386
- }
387
327
  function ScrollArea({
388
328
  className,
389
329
  style,
@@ -396,7 +336,7 @@ function ScrollArea({
396
336
  {
397
337
  "data-slot": "scroll-area",
398
338
  style: { position: "relative", ...style },
399
- className: cn("w-full", className),
339
+ className: cn("dr-scroll-area", className),
400
340
  ...props,
401
341
  children: [
402
342
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -404,7 +344,7 @@ function ScrollArea({
404
344
  {
405
345
  ref: viewportRef,
406
346
  "data-slot": "scroll-area-viewport",
407
- className: "size-full outline-none rounded-[inherit]",
347
+ className: "dr-scroll-area-viewport",
408
348
  children
409
349
  }
410
350
  ),
@@ -425,18 +365,13 @@ function ScrollBar({
425
365
  {
426
366
  "data-slot": "scroll-area-scrollbar",
427
367
  orientation,
428
- className: cn(
429
- "flex touch-none select-none p-px transition-opacity z-[11]",
430
- orientation === "vertical" && "h-full w-2.5",
431
- orientation === "horizontal" && "h-2.5 flex-col",
432
- className
433
- ),
368
+ className: cn("dr-scrollbar", className),
434
369
  ...props,
435
370
  children: /* @__PURE__ */ jsxRuntime.jsx(
436
371
  scrollArea.ScrollArea.Thumb,
437
372
  {
438
373
  "data-slot": "scroll-area-thumb",
439
- className: "relative flex-1 rounded-full bg-[var(--bk-muted-foreground)]/30 hover:bg-[var(--bk-muted-foreground)]/50 transition-colors"
374
+ className: "dr-scrollbar-thumb"
440
375
  }
441
376
  )
442
377
  }
@@ -799,40 +734,20 @@ function DateTimePanel({
799
734
  setPreviousDate(initDate);
800
735
  }, [initDate]);
801
736
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
802
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-3 pt-3", children: [
803
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-md font-bold flex gap-2 items-center cursor-pointer", children: [
737
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-panel-header", children: [
738
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-panel-nav-label", children: [
804
739
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
805
740
  /* @__PURE__ */ jsxRuntime.jsx("span", { onClick: () => setMonthYearPicker(monthYearPicker === "month" ? false : "month"), children: dateFns.format(month, "MMMM") }),
806
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ms-1", onClick: () => setMonthYearPicker(monthYearPicker === "year" ? false : "year"), children: dateFns.format(month, "yyyy") })
741
+ /* @__PURE__ */ jsxRuntime.jsx("span", { onClick: () => setMonthYearPicker(monthYearPicker === "year" ? false : "year"), children: dateFns.format(month, "yyyy") })
807
742
  ] }),
808
- /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", className: "w-7 h-7", onClick: () => setMonthYearPicker(monthYearPicker ? false : "year"), children: monthYearPicker ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUpIcon, { className: "w-4 h-4 stroke-muted-foreground" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "w-4 h-4 stroke-muted-foreground" }) })
743
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", onClick: () => setMonthYearPicker(monthYearPicker ? false : "year"), children: monthYearPicker ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUpIcon, { style: { width: 16, height: 16 } }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { style: { width: 16, height: 16 } }) })
809
744
  ] }),
810
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex space-x-2", monthYearPicker ? "hidden" : ""), children: [
811
- /* @__PURE__ */ jsxRuntime.jsx(
812
- Button,
813
- {
814
- variant: "ghost",
815
- size: "icon",
816
- className: "w-7 h-7",
817
- "aria-label": "Previous month",
818
- onClick: onPrevMonth,
819
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { className: "w-4 h-4 stroke-muted-foreground" })
820
- }
821
- ),
822
- /* @__PURE__ */ jsxRuntime.jsx(
823
- Button,
824
- {
825
- variant: "ghost",
826
- size: "icon",
827
- className: "w-7 h-7",
828
- "aria-label": "Next month",
829
- onClick: onNextMonth,
830
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRightIcon, { className: "w-4 h-4 stroke-muted-foreground" })
831
- }
832
- )
745
+ !monthYearPicker && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-panel-nav-btn", children: [
746
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", "aria-label": "Previous month", onClick: onPrevMonth, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { style: { width: 16, height: 16 } }) }),
747
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", "aria-label": "Next month", onClick: onNextMonth, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRightIcon, { style: { width: 16, height: 16 } }) })
833
748
  ] })
834
749
  ] }),
835
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative overflow-hidden px-3", children: [
750
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-panel-calendar", children: [
836
751
  /* @__PURE__ */ jsxRuntime.jsx(
837
752
  reactDayPicker.DayPicker,
838
753
  {
@@ -857,31 +772,31 @@ function DateTimePanel({
857
772
  disabled: [max ? { after: max } : null, min ? { before: min } : null].filter(Boolean),
858
773
  onMonthChange: setMonth,
859
774
  classNames: {
860
- dropdowns: "flex w-full gap-2",
861
- months: "flex w-full h-fit",
862
- month: "flex flex-col w-full",
775
+ dropdowns: "dr-cal-dropdowns",
776
+ months: "dr-cal-months",
777
+ month: "dr-cal-month",
863
778
  month_caption: "hidden",
864
779
  button_previous: "hidden",
865
780
  button_next: "hidden",
866
- month_grid: "w-full border-collapse",
867
- weekdays: "flex justify-between mt-2",
868
- weekday: "text-[var(--bk-muted-foreground)] rounded-md w-9 font-normal text-[0.8rem]",
869
- week: "flex w-full justify-between mt-2",
870
- day: "h-9 w-9 text-center text-sm p-0 relative flex items-center justify-center focus-within:relative focus-within:z-20 [&[aria-selected]>button:hover]:bg-[var(--bk-primary)] [&[aria-selected]>button:hover]:text-[var(--bk-primary-foreground)]",
871
- day_button: cn(buttonVariants({ variant: "ghost" }), "size-9 p-0 font-normal"),
872
- range_end: "day-range-end bg-[var(--bk-primary)]",
873
- selected: "bg-[var(--bk-primary)] text-[var(--bk-primary-foreground)] hover:bg-[var(--bk-primary)] hover:text-[var(--bk-primary-foreground)] focus:bg-[var(--bk-primary)] focus:text-[var(--bk-primary-foreground)]",
874
- today: "bg-[var(--bk-accent)] text-[var(--bk-accent-foreground)]",
875
- outside: "day-outside text-[var(--bk-muted-foreground)]/80 aria-selected:bg-[var(--bk-primary)] aria-selected:text-[var(--bk-primary-foreground)]",
876
- disabled: "text-[var(--bk-muted-foreground)] opacity-50",
877
- range_middle: "w-full bg-[var(--bk-secondary)] aria-selected:bg-[var(--bk-primary)] aria-selected:text-[var(--bk-primary-foreground)]",
878
- hidden: "invisible"
781
+ month_grid: "dr-cal-month-grid",
782
+ weekdays: "dr-cal-weekdays",
783
+ weekday: "dr-cal-weekday",
784
+ week: "dr-cal-week",
785
+ day: "dr-cal-day",
786
+ day_button: "dr-cal-day-btn",
787
+ range_end: "dr-cal-day-range-end",
788
+ selected: "dr-cal-day-selected",
789
+ today: "dr-cal-day-today",
790
+ outside: "dr-cal-day-outside",
791
+ disabled: "dr-cal-day-disabled",
792
+ range_middle: "dr-cal-day-range-middle",
793
+ hidden: "dr-cal-day-hidden"
879
794
  },
880
795
  showOutsideDays: true,
881
796
  ...props
882
797
  }
883
798
  ),
884
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("absolute top-0 left-0 bottom-0 right-0", monthYearPicker ? "bg-[var(--bk-popover)]" : "hidden") }),
799
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("dr-panel-overlay", !monthYearPicker && "dr-panel-overlay--hidden") }),
885
800
  /* @__PURE__ */ jsxRuntime.jsx(
886
801
  MonthYearPicker,
887
802
  {
@@ -890,12 +805,12 @@ function DateTimePanel({
890
805
  onChange: onMonthYearChanged,
891
806
  minDate,
892
807
  maxDate,
893
- className: cn("absolute top-0 left-0 bottom-0 right-0", monthYearPicker ? "" : "hidden")
808
+ className: cn("dr-panel-monthyear", !monthYearPicker && "dr-panel-monthyear--hidden")
894
809
  }
895
810
  )
896
811
  ] }),
897
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 px-3 pb-2", children: [
898
- precision !== "date" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 border-t border-[var(--bk-border)] pt-2", children: /* @__PURE__ */ jsxRuntime.jsx(
812
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-panel-footer", children: [
813
+ precision !== "date" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dr-panel-time", children: /* @__PURE__ */ jsxRuntime.jsx(
899
814
  TimePicker,
900
815
  {
901
816
  timePicker: precisionToTimePicker(precision),
@@ -906,8 +821,8 @@ function DateTimePanel({
906
821
  max: maxDate
907
822
  }
908
823
  ) }),
909
- (isError || errorType !== null) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-3 px-4 border border-[var(--bk-destructive)] max-w-full", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-[var(--bk-destructive)] leading-snug block", children: getRangeErrorMessage?.(errorType, title) ?? "Invalid date range." }) }),
910
- !immediate && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-2", children: [
824
+ (isError || errorType !== null) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dr-panel-error", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "dr-panel-error-msg", children: getRangeErrorMessage?.(errorType, title) ?? "Invalid date range." }) }),
825
+ !immediate && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-panel-buttons", children: [
911
826
  /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "sm", onClick: onCancel, children: "Cancel" }),
912
827
  /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "sm", onClick: onSubmit, children: "Done" })
913
828
  ] })
@@ -1069,13 +984,9 @@ function DatetimeSegmentInput({
1069
984
  "div",
1070
985
  {
1071
986
  ref: containerRef,
1072
- className: cn(
1073
- "inline-flex h-8 px-2.5 rounded-[var(--bk-radius)] border border-[var(--bk-input)] bg-transparent text-xs transition-colors",
1074
- "focus-within:border-[var(--bk-ring)] focus-within:ring-1 focus-within:ring-[var(--bk-ring)]/50 items-center",
1075
- isError && "border-[var(--bk-destructive)] ring-1 ring-[var(--bk-destructive)]/20",
1076
- disabled && "opacity-50 cursor-not-allowed pointer-events-none bg-[var(--bk-input)]/50",
1077
- className
1078
- ),
987
+ className: cn("dr-segment-input", className),
988
+ "data-error": isError || void 0,
989
+ "data-disabled": disabled || void 0,
1079
990
  onMouseDown: (e) => {
1080
991
  const target = e.target;
1081
992
  if (target.tagName === "SPAN") {
@@ -1087,7 +998,7 @@ function DatetimeSegmentInput({
1087
998
  const sep = idx === 0 ? null : idx === 3 ? "\xA0" : idx < 3 ? "-" : ":";
1088
999
  const isFocused = typing[seg.key] !== null;
1089
1000
  return /* @__PURE__ */ jsxRuntime.jsxs(React__default.default.Fragment, { children: [
1090
- sep !== null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[var(--bk-muted-foreground)] select-none items-center", "aria-hidden": true, children: sep }),
1001
+ sep !== null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "dr-segment-sep", "aria-hidden": true, children: sep }),
1091
1002
  /* @__PURE__ */ jsxRuntime.jsx(
1092
1003
  "div",
1093
1004
  {
@@ -1100,11 +1011,8 @@ function DatetimeSegmentInput({
1100
1011
  "aria-valuemin": seg.min,
1101
1012
  "aria-valuemax": seg.max,
1102
1013
  tabIndex: disabled ? -1 : 0,
1103
- className: cn(
1104
- "outline-none rounded-sm px-1 cursor-default select-none",
1105
- "focus:bg-[var(--bk-primary)] focus:text-[var(--bk-primary-foreground)]",
1106
- isFocused && "bg-[var(--bk-primary)]/20"
1107
- ),
1014
+ className: "dr-segment",
1015
+ "data-focused": isFocused || void 0,
1108
1016
  style: { height: "24px", lineHeight: "24px" },
1109
1017
  onKeyDown: (e) => handleKeyDown(e, seg),
1110
1018
  onBlur: () => handleBlur(seg.key),
@@ -1282,17 +1190,17 @@ function RelativeSidePanel({ value, onChange, relativeFormats, showNow, labels }
1282
1190
  });
1283
1191
  }
1284
1192
  };
1285
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 mt-3", children: [
1193
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-relative", children: [
1286
1194
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1287
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] text-muted-foreground mb-1.5", children: labels.amount }),
1288
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row gap-1.5", children: [
1195
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "dr-relative-label", children: labels.amount }),
1196
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-relative-row", children: [
1289
1197
  /* @__PURE__ */ jsxRuntime.jsx(
1290
1198
  Input,
1291
1199
  {
1292
1200
  type: "text",
1293
1201
  inputMode: "numeric",
1294
1202
  pattern: "[0-9]*",
1295
- className: "h-8 w-20 text-xs",
1203
+ className: "dr-relative-input",
1296
1204
  disabled: isNow,
1297
1205
  value: numValue,
1298
1206
  onChange: (e) => {
@@ -1319,14 +1227,14 @@ function RelativeSidePanel({ value, onChange, relativeFormats, showNow, labels }
1319
1227
  emit({ numValue, format: f, isNow });
1320
1228
  },
1321
1229
  children: [
1322
- /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "h-8 text-xs text-left leading-tight", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { children: format3 }) }),
1323
- /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: relativeFormats.map((f) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: f, className: "text-xs", children: f }, f)) })
1230
+ /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { children: format3 }) }),
1231
+ /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: relativeFormats.map((f) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: f, children: f }, f)) })
1324
1232
  ]
1325
1233
  }
1326
1234
  )
1327
1235
  ] })
1328
1236
  ] }),
1329
- showNow && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row gap-2 items-center pt-0.5", children: [
1237
+ showNow && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-relative-now-row", children: [
1330
1238
  /* @__PURE__ */ jsxRuntime.jsx(
1331
1239
  Switch,
1332
1240
  {
@@ -1337,9 +1245,9 @@ function RelativeSidePanel({ value, onChange, relativeFormats, showNow, labels }
1337
1245
  }
1338
1246
  }
1339
1247
  ),
1340
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
1341
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-xs font-medium", children: labels.now }),
1342
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] text-muted-foreground", children: labels.nowDescription })
1248
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-relative-now-labels", children: [
1249
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "dr-relative-now-label", children: labels.now }),
1250
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "dr-relative-now-desc", children: labels.nowDescription })
1343
1251
  ] })
1344
1252
  ] })
1345
1253
  ] });
@@ -1356,14 +1264,14 @@ function AbsoluteContent({
1356
1264
  use12HourFormat
1357
1265
  }) {
1358
1266
  const compareDate = compareValue ? toDate(compareValue) : void 0;
1359
- const absoluteDate_ = value.type === "absolute" ? toDate(value) : /* @__PURE__ */ new Date();
1360
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 mt-3", children: [
1267
+ const currentDate = value.type === "absolute" ? toDate(value) : /* @__PURE__ */ new Date();
1268
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-absolute-row", children: [
1361
1269
  /* @__PURE__ */ jsxRuntime.jsx(
1362
1270
  DatetimeSegmentInput,
1363
1271
  {
1364
- value: absoluteDate_,
1272
+ value: currentDate,
1365
1273
  onChange: (d) => onChange(absoluteDate(d)),
1366
- className: "flex-1",
1274
+ className: "dr-absolute-input",
1367
1275
  precision
1368
1276
  }
1369
1277
  ),
@@ -1378,7 +1286,7 @@ function AbsoluteContent({
1378
1286
  type: "button",
1379
1287
  variant: "outline",
1380
1288
  size: "icon",
1381
- className: "h-8 w-8 shrink-0",
1289
+ className: "dr-absolute-btn",
1382
1290
  title: "Pick from calendar",
1383
1291
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarDays, { size: 14 })
1384
1292
  }
@@ -1396,7 +1304,7 @@ function AbsoluteContent({
1396
1304
  children: /* @__PURE__ */ jsxRuntime.jsx(
1397
1305
  DateTimePanel,
1398
1306
  {
1399
- value: value.type === "absolute" ? toDate(value) : void 0,
1307
+ value: value.type === "absolute" ? currentDate : void 0,
1400
1308
  compareValue: compareDate,
1401
1309
  title,
1402
1310
  immediate: true,
@@ -1421,22 +1329,23 @@ function SidePanel({
1421
1329
  value,
1422
1330
  compareValue,
1423
1331
  onChange,
1424
- showAbsolute,
1425
- showRelative,
1426
- precision,
1427
- relativeFormats,
1428
- showNow,
1332
+ showAbsolute = true,
1333
+ showRelative = true,
1334
+ precision = "second",
1335
+ relativeFormats = RELATIVE_FORMATS,
1336
+ showNow = true,
1429
1337
  min,
1430
1338
  max,
1431
1339
  timezone,
1432
1340
  use12HourFormat,
1433
- labels
1341
+ labels: labelsProp
1434
1342
  }) {
1343
+ const labels = { ...DEFAULT_LABELS, ...labelsProp };
1435
1344
  React.useEffect(() => {
1436
1345
  if (!showRelative && value.type === "relative") {
1437
1346
  onChange(absoluteDate(/* @__PURE__ */ new Date()));
1438
1347
  } else if (!showAbsolute && value.type === "absolute") {
1439
- onChange({ type: "relative", relativeValue: "5", relativeFormat: relativeFormats[0] ?? "Minutes ago" });
1348
+ onChange({ type: "relative", relativeValue: "5", relativeFormat: relativeFormats[0] ?? RELATIVE_FORMATS[0] });
1440
1349
  }
1441
1350
  }, [showRelative, showAbsolute]);
1442
1351
  const hasBothModes = showAbsolute && showRelative;
@@ -1464,22 +1373,22 @@ function SidePanel({
1464
1373
  labels
1465
1374
  }
1466
1375
  );
1467
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col w-[268px]", children: [
1468
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] font-semibold text-muted-foreground uppercase tracking-widest pb-2", children: title }),
1376
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-side-panel", children: [
1377
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "dr-side-panel-title", children: title }),
1469
1378
  hasBothModes ? /* @__PURE__ */ jsxRuntime.jsxs(
1470
1379
  Tabs,
1471
1380
  {
1472
1381
  value: value.type,
1473
- className: "flex-col",
1382
+ className: "dr-side-panel-tabs",
1474
1383
  onValueChange: (t) => {
1475
1384
  if (t === "absolute") {
1476
1385
  onChange(absoluteDate(value.type === "absolute" ? toDate(value) : /* @__PURE__ */ new Date()));
1477
1386
  } else if (value.type !== "relative") {
1478
- onChange({ type: "relative", relativeValue: "5", relativeFormat: relativeFormats[0] ?? "Minutes ago" });
1387
+ onChange({ type: "relative", relativeValue: "5", relativeFormat: relativeFormats[0] ?? RELATIVE_FORMATS[0] });
1479
1388
  }
1480
1389
  },
1481
1390
  children: [
1482
- /* @__PURE__ */ jsxRuntime.jsxs(TabsList, { className: "grid w-full grid-cols-2", children: [
1391
+ /* @__PURE__ */ jsxRuntime.jsxs(TabsList, { className: "dr-tabs-list--grid dr-tabs-list--grid-2", children: [
1483
1392
  /* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { value: "absolute", children: labels.absolute }),
1484
1393
  /* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { value: "relative", children: labels.relative })
1485
1394
  ] }),
@@ -1490,41 +1399,27 @@ function SidePanel({
1490
1399
  ) : showAbsolute ? absoluteContent : relativeContent
1491
1400
  ] });
1492
1401
  }
1493
- function DatetimeRange({
1402
+ function useDatetimeRange({
1494
1403
  startTime,
1495
1404
  endTime,
1496
- onChange,
1497
- quickPresets = QUICK_PRESETS,
1498
- showQuickRanges = true,
1499
- showAbsolute = true,
1500
- showRelative = true,
1501
- precision = "second",
1502
- relativeFormats = RELATIVE_FORMATS,
1503
- min,
1504
- max,
1505
- timezone,
1506
- use12HourFormat = false,
1507
- showNow = true,
1508
- disabled = false,
1509
- labels: labelsProp,
1510
- popoverAlign = "start",
1511
- popoverSide = "bottom",
1512
- renderTrigger,
1513
- className
1405
+ onChange
1514
1406
  }) {
1515
- const labels = { ...DEFAULT_LABELS, ...labelsProp };
1516
1407
  const [isOpen, setIsOpen] = React.useState(false);
1517
1408
  const [draftStart, setDraftStart] = React.useState(startTime);
1518
1409
  const [draftEnd, setDraftEnd] = React.useState(endTime);
1519
1410
  const [error, setError] = React.useState(null);
1411
+ const wasOpen = React.useRef(false);
1520
1412
  React.useEffect(() => {
1521
- if (isOpen) {
1413
+ const justOpened = isOpen && !wasOpen.current;
1414
+ wasOpen.current = isOpen;
1415
+ if (justOpened) {
1522
1416
  setDraftStart(startTime);
1523
1417
  setDraftEnd(endTime);
1524
1418
  setError(null);
1525
1419
  }
1526
1420
  }, [isOpen, startTime, endTime]);
1527
- const handleApply = () => {
1421
+ const clearError = React.useCallback(() => setError(null), []);
1422
+ const onApply = React.useCallback(() => {
1528
1423
  const err = validateRange(draftStart, draftEnd);
1529
1424
  if (err) {
1530
1425
  setError(err);
@@ -1532,17 +1427,68 @@ function DatetimeRange({
1532
1427
  }
1533
1428
  onChange(draftStart, draftEnd);
1534
1429
  setIsOpen(false);
1535
- };
1536
- const handleCancel = () => {
1430
+ }, [draftStart, draftEnd, onChange]);
1431
+ const onCancel = React.useCallback(() => {
1537
1432
  setDraftStart(startTime);
1538
1433
  setDraftEnd(endTime);
1539
1434
  setError(null);
1540
1435
  setIsOpen(false);
1541
- };
1542
- const handlePreset = (preset) => {
1436
+ }, [startTime, endTime]);
1437
+ const onPreset = React.useCallback((preset) => {
1543
1438
  onChange(preset.start, preset.end);
1544
1439
  setIsOpen(false);
1440
+ }, [onChange]);
1441
+ return {
1442
+ isOpen,
1443
+ setIsOpen,
1444
+ draftStart,
1445
+ setDraftStart,
1446
+ draftEnd,
1447
+ setDraftEnd,
1448
+ error,
1449
+ clearError,
1450
+ onApply,
1451
+ onCancel,
1452
+ onPreset
1545
1453
  };
1454
+ }
1455
+ function DatetimeRange({
1456
+ startTime,
1457
+ endTime,
1458
+ onChange,
1459
+ quickPresets = QUICK_PRESETS,
1460
+ showQuickRanges = true,
1461
+ showAbsolute = true,
1462
+ showRelative = true,
1463
+ precision = "second",
1464
+ relativeFormats = RELATIVE_FORMATS,
1465
+ min,
1466
+ max,
1467
+ timezone,
1468
+ use12HourFormat = false,
1469
+ showNow = true,
1470
+ disabled = false,
1471
+ labels: labelsProp,
1472
+ popoverAlign = "start",
1473
+ popoverSide = "bottom",
1474
+ renderTrigger,
1475
+ portalContainer,
1476
+ className
1477
+ }) {
1478
+ const labels = { ...DEFAULT_LABELS, ...labelsProp };
1479
+ const {
1480
+ isOpen,
1481
+ setIsOpen,
1482
+ draftStart,
1483
+ setDraftStart,
1484
+ draftEnd,
1485
+ setDraftEnd,
1486
+ error,
1487
+ clearError,
1488
+ onApply: handleApply,
1489
+ onCancel: handleCancel,
1490
+ onPreset: handlePreset
1491
+ } = useDatetimeRange({ startTime, endTime, onChange });
1546
1492
  const sidePanelProps = {
1547
1493
  showAbsolute,
1548
1494
  showRelative,
@@ -1566,15 +1512,11 @@ function DatetimeRange({
1566
1512
  ...triggerProps,
1567
1513
  variant: "outline",
1568
1514
  disabled,
1569
- className: cn(
1570
- "h-8 px-3 gap-2 text-xs font-normal justify-start",
1571
- isOpen && "border-[var(--bk-foreground)]",
1572
- className
1573
- ),
1515
+ className: cn("dr-range-trigger", isOpen && "dr-range-trigger--open", className),
1574
1516
  children: [
1575
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarDays, { size: 14, className: "text-muted-foreground shrink-0" }),
1517
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarDays, { size: 14, className: "dr-range-trigger-icon" }),
1576
1518
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: toDisplayString(startTime, { precision }) }),
1577
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "\u2192" }),
1519
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "dr-range-trigger-arrow", children: "\u2192" }),
1578
1520
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: toDisplayString(endTime, { precision }) })
1579
1521
  ]
1580
1522
  }
@@ -1584,28 +1526,29 @@ function DatetimeRange({
1584
1526
  /* @__PURE__ */ jsxRuntime.jsx(
1585
1527
  PopoverContent,
1586
1528
  {
1587
- className: "p-0 w-auto",
1529
+ className: "dr-range-popup-content",
1588
1530
  align: popoverAlign,
1589
1531
  side: popoverSide,
1590
1532
  sideOffset: 4,
1591
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex", children: [
1592
- showQuickRanges && quickPresets.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 border-r w-40 relative", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute inset-0 flex flex-col overflow-hidden", children: [
1593
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 pt-2.5 pb-1 text-[11px] font-semibold text-muted-foreground uppercase tracking-widest shrink-0", children: labels.quickRanges }),
1594
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-y-auto", children: quickPresets.map((preset) => /* @__PURE__ */ jsxRuntime.jsx(
1533
+ container: portalContainer,
1534
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-range-popup", children: [
1535
+ showQuickRanges && quickPresets.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dr-range-quick", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-range-quick-inner", children: [
1536
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dr-range-quick-label", children: labels.quickRanges }),
1537
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dr-range-quick-list", children: quickPresets.map((preset) => /* @__PURE__ */ jsxRuntime.jsx(
1595
1538
  "button",
1596
1539
  {
1597
1540
  type: "button",
1598
- className: "block w-full text-left text-xs px-3 py-1.5 hover:bg-accent hover:text-accent-foreground transition-colors",
1541
+ className: "dr-range-quick-item",
1599
1542
  onClick: () => handlePreset(preset),
1600
1543
  children: preset.label
1601
1544
  },
1602
1545
  preset.label
1603
1546
  )) })
1604
1547
  ] }) }),
1605
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col justify-between relative", children: [
1606
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pointer-events-none absolute top-0 bottom-0 left-1/2 w-px bg-border" }),
1607
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex", children: [
1608
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 pb-4 pt-3", children: /* @__PURE__ */ jsxRuntime.jsx(
1548
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-range-pickers", children: [
1549
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dr-range-divider" }),
1550
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-range-panels", children: [
1551
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dr-range-panel-slot", children: /* @__PURE__ */ jsxRuntime.jsx(
1609
1552
  SidePanel,
1610
1553
  {
1611
1554
  title: labels.start,
@@ -1613,12 +1556,12 @@ function DatetimeRange({
1613
1556
  compareValue: draftEnd,
1614
1557
  onChange: (v) => {
1615
1558
  setDraftStart(v);
1616
- setError(null);
1559
+ clearError();
1617
1560
  },
1618
1561
  ...sidePanelProps
1619
1562
  }
1620
1563
  ) }),
1621
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 pb-4 pt-3", children: /* @__PURE__ */ jsxRuntime.jsx(
1564
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dr-range-panel-slot", children: /* @__PURE__ */ jsxRuntime.jsx(
1622
1565
  SidePanel,
1623
1566
  {
1624
1567
  title: labels.end,
@@ -1626,16 +1569,15 @@ function DatetimeRange({
1626
1569
  compareValue: draftStart,
1627
1570
  onChange: (v) => {
1628
1571
  setDraftEnd(v);
1629
- setError(null);
1572
+ clearError();
1630
1573
  },
1631
1574
  ...sidePanelProps
1632
1575
  }
1633
1576
  ) })
1634
1577
  ] }),
1635
- /* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
1636
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 py-2 gap-4", children: [
1637
- error === "validation" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-destructive", children: "Start must be earlier than end." }) : /* @__PURE__ */ jsxRuntime.jsx("span", {}),
1638
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
1578
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-range-footer", children: [
1579
+ error === "validation" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "dr-range-error-text", children: "Start must be earlier than end." }) : /* @__PURE__ */ jsxRuntime.jsx("span", {}),
1580
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dr-range-actions", children: [
1639
1581
  /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "sm", onClick: handleCancel, children: labels.cancel }),
1640
1582
  /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "sm", onClick: handleApply, children: labels.apply })
1641
1583
  ] })
@@ -1652,6 +1594,7 @@ exports.DatetimeRange = DatetimeRange;
1652
1594
  exports.DatetimeSegmentInput = DatetimeSegmentInput;
1653
1595
  exports.QUICK_PRESETS = QUICK_PRESETS;
1654
1596
  exports.RELATIVE_FORMATS = RELATIVE_FORMATS;
1597
+ exports.SidePanel = SidePanel;
1655
1598
  exports.absoluteDate = absoluteDate;
1656
1599
  exports.fromUrlString = fromUrlString;
1657
1600
  exports.relativeAgo = relativeAgo;
@@ -1661,6 +1604,7 @@ exports.toDisplayString = toDisplayString;
1661
1604
  exports.toTimestamp = toTimestamp;
1662
1605
  exports.toTimestampMs = toTimestampMs;
1663
1606
  exports.toUrlString = toUrlString;
1607
+ exports.useDatetimeRange = useDatetimeRange;
1664
1608
  exports.validateRange = validateRange;
1665
1609
  //# sourceMappingURL=index.cjs.map
1666
1610
  //# sourceMappingURL=index.cjs.map