@bfrs/agentic-components 0.7.9 → 0.8.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.
@@ -1,30 +1,30 @@
1
- import { jsxs as l, jsx as r, Fragment as ct } from "react/jsx-runtime";
2
- import { Root as Tt, Trigger as Mt, Portal as Bt, Content as zt } from "../../../node_modules/@radix-ui/react-popover/dist/index.js";
1
+ import { jsxs as c, jsx as r, Fragment as gt } from "react/jsx-runtime";
2
+ import { Root as zt, Trigger as Wt, Portal as Ft, Content as It } from "../../../node_modules/@radix-ui/react-popover/dist/index.js";
3
3
  import { CalendarBlank as Lt } from "../../../node_modules/@phosphor-icons/react/dist/csr/CalendarBlank.es.js";
4
- import { CaretDown as dt } from "../../../node_modules/@phosphor-icons/react/dist/csr/CaretDown.es.js";
5
- import { CaretLeft as Je } from "../../../node_modules/@phosphor-icons/react/dist/csr/CaretLeft.es.js";
6
- import { CaretRight as Ke } from "../../../node_modules/@phosphor-icons/react/dist/csr/CaretRight.es.js";
7
- import { Check as Qe } from "../../../node_modules/@phosphor-icons/react/dist/csr/Check.es.js";
8
- import { X as Ft } from "../../../node_modules/@phosphor-icons/react/dist/csr/X.es.js";
9
- import { useState as D, useMemo as z, useRef as It, useCallback as ye, useEffect as gt } from "react";
4
+ import { CaretDown as ft } from "../../../node_modules/@phosphor-icons/react/dist/csr/CaretDown.es.js";
5
+ import { CaretLeft as Qe } from "../../../node_modules/@phosphor-icons/react/dist/csr/CaretLeft.es.js";
6
+ import { CaretRight as Ze } from "../../../node_modules/@phosphor-icons/react/dist/csr/CaretRight.es.js";
7
+ import { Check as et } from "../../../node_modules/@phosphor-icons/react/dist/csr/Check.es.js";
8
+ import { X as Yt } from "../../../node_modules/@phosphor-icons/react/dist/csr/X.es.js";
9
+ import { useState as S, useMemo as x, useRef as Et, useCallback as De, useEffect as pt } from "react";
10
10
  import o from "@emotion/styled";
11
- import { twRing as He, twTransform as ft, kfContentIn as Wt } from "../../../lib/emotionTw.js";
12
- import { Button as We } from "../../primitives/Button/Button.js";
13
- import { WarningAlertIcon as Yt, warningSurfaceTextStyle as Et } from "../../ui/feedback/warningVisual.js";
14
- import { floatingCollisionPadding as Ht } from "../../ui/overlays/overlayPositioning.js";
15
- import { coerceDateRangeValue as Ze, CUSTOM_PRESET_ID as m, YEAR_LAST_ONE as xe, YEAR_LAST_30_DAYS as et, getInitialCalendar as Ye, shiftMonth as S, startOfDay as w, addDays as Re, computeYearRange as tt, compareDay as L, hasCompleteRange as C, BASE_YEAR as pt, getPresetLabel as Nt, defaultDateRangePresets as _t, sameDay as Ne, defaultFormatDate as ht, clampYearRange as $t, differenceInCalendarDays as jt, YEAR_OPTIONS as rt, normalizeRange as _e, daysInMonth as Ot, MONTH_NAMES as Vt, SHORT_MONTH_NAMES as ot, DAY_HEADS as Gt } from "./DateRangePicker.utils.js";
16
- import { BfrsPortalScope as Ut } from "../../ui/providers/BfrsProvider/BfrsProvider.js";
17
- import { Select as Xt } from "../../ui/forms/Select/Select.js";
18
- const $e = (e) => e ? He("2px", `hsl(var(--bfrs-color-border-focus) / ${e})`) : {
19
- ...He("2px", "hsl(var(--bfrs-color-border-focus) / var(--tw-ring-opacity, 1))"),
11
+ import { twRing as Oe, twTransform as mt, kfContentIn as Ht } from "../../../lib/emotionTw.js";
12
+ import { Button as Ne } from "../../primitives/Button/Button.js";
13
+ import { WarningAlertIcon as Nt, warningSurfaceTextStyle as _t } from "../../ui/feedback/warningVisual.js";
14
+ import { floatingCollisionPadding as Vt } from "../../ui/overlays/overlayPositioning.js";
15
+ import { coerceDateRangeValue as tt, CUSTOM_PRESET_ID as p, buildDayWindowOptions as Ot, YEAR_LAST_30_DAYS as $t, dayWindowValueForSpan as jt, YEAR_LAST_ONE as we, getInitialCalendar as _e, shiftMonth as B, startOfDay as v, addDays as Ce, computeYearRange as rt, compareDay as W, hasCompleteRange as C, sameDay as Ae, dayWindowValue as Gt, differenceInCalendarDays as ot, BASE_YEAR as ht, getPresetLabel as Ut, defaultDateRangePresets as Xt, defaultFormatDate as ut, clampYearRange as qt, YEAR_OPTIONS as nt, RESTRICTED_WINDOW_DAYS as Jt, normalizeRange as $e, daysInMonth as Kt, MONTH_NAMES as Qt, SHORT_MONTH_NAMES as at, DAY_HEADS as Zt } from "./DateRangePicker.utils.js";
16
+ import { BfrsPortalScope as er } from "../../ui/providers/BfrsProvider/BfrsProvider.js";
17
+ import { Select as tr } from "../../ui/forms/Select/Select.js";
18
+ const je = (e) => e ? Oe("2px", `hsl(var(--bfrs-color-border-focus) / ${e})`) : {
19
+ ...Oe("2px", "hsl(var(--bfrs-color-border-focus) / var(--tw-ring-opacity, 1))"),
20
20
  "--tw-ring-opacity": "1"
21
- }, $ = {
21
+ }, V = {
22
22
  "--tw-text-opacity": "1",
23
23
  color: "hsl(var(--bfrs-color-text-muted) / var(--tw-text-opacity, 1))"
24
- }, A = {
24
+ }, M = {
25
25
  "--tw-text-opacity": "1",
26
26
  color: "hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))"
27
- }, Pe = {
27
+ }, Te = {
28
28
  "--tw-text-opacity": "1",
29
29
  color: "hsl(var(--bfrs-color-text-secondary) / var(--tw-text-opacity, 1))"
30
30
  }, Z = {
@@ -40,30 +40,30 @@ const $e = (e) => e ? He("2px", `hsl(var(--bfrs-color-border-focus) / ${e})`) :
40
40
  "--tw-border-opacity": "1",
41
41
  borderColor: "hsl(var(--bfrs-color-border) / var(--tw-border-opacity, 1))"
42
42
  };
43
- function _(e, c) {
44
- const h = Date.UTC(e.year, e.month, 1), d = Date.UTC(c.year, c.month, 1);
45
- return h === d ? 0 : h < d ? -1 : 1;
43
+ function _(e, s) {
44
+ const m = Date.UTC(e.year, e.month, 1), d = Date.UTC(s.year, s.month, 1);
45
+ return m === d ? 0 : m < d ? -1 : 1;
46
46
  }
47
- function qt(e, c, h) {
48
- return _(e, c) < 0 || _(e, h) > 0;
47
+ function rr(e, s, m) {
48
+ return _(e, s) < 0 || _(e, m) > 0;
49
49
  }
50
- function nt(e) {
50
+ function it(e) {
51
51
  return { year: e.getFullYear(), month: e.getMonth() };
52
52
  }
53
- function Jt(e, c, h) {
54
- const d = S(e.year, e.month, 1);
55
- if (!h || _(d, h) <= 0)
53
+ function or(e, s, m) {
54
+ const d = B(e.year, e.month, 1);
55
+ if (!m || _(d, m) <= 0)
56
56
  return { left: e, right: d };
57
- const b = S(e.year, e.month, -1);
58
- return !c || _(b, c) >= 0 ? { left: b, right: e } : { left: e, right: d };
57
+ const h = B(e.year, e.month, -1);
58
+ return !s || _(h, s) >= 0 ? { left: h, right: e } : { left: e, right: d };
59
59
  }
60
- function Ee(e, c, h, d) {
61
- const b = nt(e);
62
- if (h === 1) return { left: b, right: b };
63
- const j = nt(c);
64
- return _(b, j) < 0 ? { left: b, right: j } : Jt(b, d == null ? void 0 : d.minMonth, d == null ? void 0 : d.maxMonth);
60
+ function Ve(e, s, m, d) {
61
+ const h = it(e);
62
+ if (m === 1) return { left: h, right: h };
63
+ const O = it(s);
64
+ return _(h, O) < 0 ? { left: h, right: O } : or(h, d == null ? void 0 : d.minMonth, d == null ? void 0 : d.maxMonth);
65
65
  }
66
- const Kt = /* @__PURE__ */ o("div", {
66
+ const nr = /* @__PURE__ */ o("div", {
67
67
  label: "AgenticDateRangePicker-calendar"
68
68
  })({
69
69
  width: "252px",
@@ -75,14 +75,14 @@ const Kt = /* @__PURE__ */ o("div", {
75
75
  "--tw-shadow": "var(--bfrs-shadow-low)",
76
76
  "--tw-shadow-colored": "var(--bfrs-shadow-low)",
77
77
  boxShadow: "var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)"
78
- }), Qt = /* @__PURE__ */ o("div", {
78
+ }), ar = /* @__PURE__ */ o("div", {
79
79
  label: "AgenticDateRangePicker-calendarHeader"
80
80
  })({
81
81
  marginBottom: ".5rem",
82
82
  display: "flex",
83
83
  alignItems: "center",
84
84
  justifyContent: "space-between"
85
- }), ke = /* @__PURE__ */ o("button", {
85
+ }), Se = /* @__PURE__ */ o("button", {
86
86
  label: "AgenticDateRangePicker-navButton",
87
87
  shouldForwardProp: (e) => e !== "ownerState"
88
88
  })(({ ownerState: e }) => [
@@ -93,14 +93,14 @@ const Kt = /* @__PURE__ */ o("div", {
93
93
  alignItems: "center",
94
94
  justifyContent: "center",
95
95
  borderRadius: "var(--bfrs-radius-md)",
96
- ...$,
96
+ ...V,
97
97
  outline: "2px solid transparent",
98
98
  outlineOffset: "2px",
99
99
  "&:hover": {
100
100
  ...N,
101
- ...A
101
+ ...M
102
102
  },
103
- "&:focus-visible": $e()
103
+ "&:focus-visible": je()
104
104
  },
105
105
  e.disableable && {
106
106
  "&:disabled": {
@@ -108,12 +108,12 @@ const Kt = /* @__PURE__ */ o("div", {
108
108
  opacity: ".3"
109
109
  }
110
110
  }
111
- ]), at = /* @__PURE__ */ o("div", {
111
+ ]), lt = /* @__PURE__ */ o("div", {
112
112
  label: "AgenticDateRangePicker-navSpacer"
113
113
  })({
114
114
  width: "1.75rem",
115
115
  height: "1.75rem"
116
- }), Zt = /* @__PURE__ */ o("button", {
116
+ }), ir = /* @__PURE__ */ o("button", {
117
117
  label: "AgenticDateRangePicker-titleButton"
118
118
  })({
119
119
  display: "flex",
@@ -122,7 +122,7 @@ const Kt = /* @__PURE__ */ o("div", {
122
122
  fontSize: ".875rem",
123
123
  lineHeight: "1.25rem",
124
124
  fontWeight: 700,
125
- ...A,
125
+ ...M,
126
126
  outline: "2px solid transparent",
127
127
  outlineOffset: "2px",
128
128
  "&:hover": {
@@ -132,18 +132,18 @@ const Kt = /* @__PURE__ */ o("div", {
132
132
  transitionProperty: "color,background-color,border-color,text-decoration-color,fill,stroke",
133
133
  transitionTimingFunction: "cubic-bezier(.4,0,.2,1)",
134
134
  transitionDuration: ".15s"
135
- }), er = /* @__PURE__ */ o(dt, {
135
+ }), lr = /* @__PURE__ */ o(ft, {
136
136
  label: "AgenticDateRangePicker-titleCaret",
137
137
  shouldForwardProp: (e) => e !== "ownerState"
138
138
  })(({ ownerState: e }) => [
139
139
  {
140
- ...$,
140
+ ...V,
141
141
  transitionProperty: "transform",
142
142
  transitionTimingFunction: "cubic-bezier(.4,0,.2,1)",
143
143
  transitionDuration: ".15s"
144
144
  },
145
- e.open && ft({ "--tw-rotate": "180deg" })
146
- ]), tr = /* @__PURE__ */ o("div", {
145
+ e.open && mt({ "--tw-rotate": "180deg" })
146
+ ]), cr = /* @__PURE__ */ o("div", {
147
147
  label: "AgenticDateRangePicker-monthGrid"
148
148
  })({
149
149
  display: "grid",
@@ -151,7 +151,7 @@ const Kt = /* @__PURE__ */ o("div", {
151
151
  gap: ".375rem",
152
152
  paddingTop: ".25rem",
153
153
  paddingBottom: ".25rem"
154
- }), rr = /* @__PURE__ */ o("button", {
154
+ }), sr = /* @__PURE__ */ o("button", {
155
155
  label: "AgenticDateRangePicker-monthButton",
156
156
  shouldForwardProp: (e) => e !== "ownerState"
157
157
  })(({ ownerState: e }) => [
@@ -163,7 +163,7 @@ const Kt = /* @__PURE__ */ o("div", {
163
163
  paddingBottom: ".625rem",
164
164
  fontSize: "12px",
165
165
  fontWeight: 500,
166
- ...Pe,
166
+ ...Te,
167
167
  outline: "2px solid transparent",
168
168
  outlineOffset: "2px",
169
169
  transitionProperty: "color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter",
@@ -171,9 +171,9 @@ const Kt = /* @__PURE__ */ o("div", {
171
171
  transitionDuration: ".15s",
172
172
  "&:hover": {
173
173
  ...N,
174
- ...A
174
+ ...M
175
175
  },
176
- "&:focus-visible": $e()
176
+ "&:focus-visible": je()
177
177
  },
178
178
  e.current && {
179
179
  "--tw-bg-opacity": "1",
@@ -197,7 +197,7 @@ const Kt = /* @__PURE__ */ o("div", {
197
197
  ...Z
198
198
  }
199
199
  }
200
- ]), or = /* @__PURE__ */ o("div", {
200
+ ]), dr = /* @__PURE__ */ o("div", {
201
201
  label: "AgenticDateRangePicker-dayHeads"
202
202
  })({
203
203
  marginBottom: ".125rem",
@@ -206,7 +206,7 @@ const Kt = /* @__PURE__ */ o("div", {
206
206
  borderBottomWidth: "1px",
207
207
  ...te,
208
208
  paddingBottom: ".375rem"
209
- }), nr = /* @__PURE__ */ o("div", {
209
+ }), gr = /* @__PURE__ */ o("div", {
210
210
  label: "AgenticDateRangePicker-dayHead"
211
211
  })({
212
212
  textAlign: "center",
@@ -214,12 +214,12 @@ const Kt = /* @__PURE__ */ o("div", {
214
214
  lineHeight: "1rem",
215
215
  fontWeight: 600,
216
216
  ...Z
217
- }), ar = /* @__PURE__ */ o("div", {
217
+ }), fr = /* @__PURE__ */ o("div", {
218
218
  label: "AgenticDateRangePicker-daysGrid"
219
219
  })({
220
220
  display: "grid",
221
221
  gridTemplateColumns: "repeat(7,minmax(0,1fr))"
222
- }), ir = /* @__PURE__ */ o("div", {
222
+ }), pr = /* @__PURE__ */ o("div", {
223
223
  label: "AgenticDateRangePicker-monthLabel"
224
224
  })({
225
225
  gridColumn: "span 7 / span 7",
@@ -231,11 +231,11 @@ const Kt = /* @__PURE__ */ o("div", {
231
231
  fontWeight: 700,
232
232
  letterSpacing: ".12em",
233
233
  ...Z
234
- }), lr = /* @__PURE__ */ o("div", {
234
+ }), mr = /* @__PURE__ */ o("div", {
235
235
  label: "AgenticDateRangePicker-blankCell"
236
236
  })({
237
237
  height: "2rem"
238
- }), sr = /* @__PURE__ */ o("div", {
238
+ }), hr = /* @__PURE__ */ o("div", {
239
239
  label: "AgenticDateRangePicker-dayCell"
240
240
  })({
241
241
  position: "relative",
@@ -243,7 +243,7 @@ const Kt = /* @__PURE__ */ o("div", {
243
243
  height: "2rem",
244
244
  alignItems: "center",
245
245
  justifyContent: "center"
246
- }), cr = /* @__PURE__ */ o("div", {
246
+ }), ur = /* @__PURE__ */ o("div", {
247
247
  label: "AgenticDateRangePicker-rangeBand",
248
248
  shouldForwardProp: (e) => e !== "ownerState"
249
249
  })(({ ownerState: e }) => [
@@ -265,7 +265,7 @@ const Kt = /* @__PURE__ */ o("div", {
265
265
  borderTopRightRadius: "var(--bfrs-radius-lg)",
266
266
  borderBottomRightRadius: "var(--bfrs-radius-lg)"
267
267
  }
268
- ]), dr = /* @__PURE__ */ o("button", {
268
+ ]), br = /* @__PURE__ */ o("button", {
269
269
  label: "AgenticDateRangePicker-dayButton",
270
270
  shouldForwardProp: (e) => e !== "ownerState"
271
271
  })(({ ownerState: e }) => [
@@ -284,7 +284,7 @@ const Kt = /* @__PURE__ */ o("div", {
284
284
  transitionProperty: "color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter",
285
285
  transitionTimingFunction: "cubic-bezier(.4,0,.2,1)",
286
286
  transitionDuration: ".15s",
287
- "&:focus-visible": $e()
287
+ "&:focus-visible": je()
288
288
  },
289
289
  e.shape === "start" ? {
290
290
  borderTopLeftRadius: "var(--bfrs-radius-lg)",
@@ -303,12 +303,12 @@ const Kt = /* @__PURE__ */ o("div", {
303
303
  "--tw-shadow-colored": "var(--bfrs-shadow-low)",
304
304
  boxShadow: "var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)"
305
305
  },
306
- !e.selected && e.inRange && { fontWeight: 500, ...A },
306
+ !e.selected && e.inRange && { fontWeight: 500, ...M },
307
307
  !e.selected && !e.inRange && {
308
- ...Pe,
308
+ ...Te,
309
309
  "&:hover": {
310
310
  ...N,
311
- ...A
311
+ ...M
312
312
  }
313
313
  },
314
314
  e.disabled && {
@@ -321,154 +321,154 @@ const Kt = /* @__PURE__ */ o("div", {
321
321
  }
322
322
  }
323
323
  ]);
324
- function it({
324
+ function ct({
325
325
  year: e,
326
- month: c,
327
- from: h,
326
+ month: s,
327
+ from: m,
328
328
  to: d,
329
- hovered: b,
330
- awaitingTo: j,
331
- isDateDisabled: pe,
332
- onSelectDate: he,
333
- onHoverDate: O,
334
- onPrev: De,
335
- onNext: Ce,
329
+ hovered: h,
330
+ awaitingTo: O,
331
+ isDateDisabled: ve,
332
+ onSelectDate: ye,
333
+ onHoverDate: $,
334
+ onPrev: Be,
335
+ onNext: Me,
336
336
  showPrev: F = !0,
337
337
  showNext: I = !0,
338
- minMonth: v,
339
- maxMonth: Se,
340
- onNavigateTo: se,
341
- className: Ae
338
+ minMonth: u,
339
+ maxMonth: ze,
340
+ onNavigateTo: de,
341
+ className: We
342
342
  }) {
343
- const [y, me] = D(!1), [x, re] = D(e), Te = (/* @__PURE__ */ new Date()).getFullYear();
344
- gt(() => {
345
- y || re(e);
346
- }, [e, y]);
347
- const Me = new Date(e, c, 1).getDay(), be = Ot(e, c), oe = Array(Me).fill(null);
348
- for (let s = 1; s <= be; s += 1)
349
- oe.push(s);
343
+ const [R, xe] = S(!1), [k, re] = S(e), Fe = (/* @__PURE__ */ new Date()).getFullYear();
344
+ pt(() => {
345
+ R || re(e);
346
+ }, [e, R]);
347
+ const ge = new Date(e, s, 1).getDay(), Re = Kt(e, s), oe = Array(ge).fill(null);
348
+ for (let l = 1; l <= Re; l += 1)
349
+ oe.push(l);
350
350
  for (; oe.length % 7 !== 0; )
351
351
  oe.push(null);
352
- const T = d ?? (j ? b : void 0), f = h && T ? _e(h, T) : void 0;
353
- return /* @__PURE__ */ l(Kt, { className: Ae, children: [
354
- /* @__PURE__ */ l(Qt, { children: [
355
- y ? /* @__PURE__ */ r(
356
- ke,
352
+ const ke = d ?? (O ? h : void 0), g = m && ke ? $e(m, ke) : void 0;
353
+ return /* @__PURE__ */ c(nr, { className: We, children: [
354
+ /* @__PURE__ */ c(ar, { children: [
355
+ R ? /* @__PURE__ */ r(
356
+ Se,
357
357
  {
358
358
  type: "button",
359
359
  ownerState: { disableable: !0 },
360
- onClick: () => re((s) => s - 1),
361
- disabled: x <= pt,
360
+ onClick: () => re((l) => l - 1),
361
+ disabled: k <= ht,
362
362
  "aria-label": "Previous year",
363
- children: /* @__PURE__ */ r(Je, { size: 14, weight: "bold" })
363
+ children: /* @__PURE__ */ r(Qe, { size: 14, weight: "bold" })
364
364
  }
365
- ) : F ? /* @__PURE__ */ r(ke, { type: "button", ownerState: { disableable: !1 }, onClick: De, "aria-label": "Previous month", children: /* @__PURE__ */ r(Je, { size: 14, weight: "bold" }) }) : /* @__PURE__ */ r(at, { "aria-hidden": "true" }),
366
- /* @__PURE__ */ l(
367
- Zt,
365
+ ) : F ? /* @__PURE__ */ r(Se, { type: "button", ownerState: { disableable: !1 }, onClick: Be, "aria-label": "Previous month", children: /* @__PURE__ */ r(Qe, { size: 14, weight: "bold" }) }) : /* @__PURE__ */ r(lt, { "aria-hidden": "true" }),
366
+ /* @__PURE__ */ c(
367
+ ir,
368
368
  {
369
369
  type: "button",
370
370
  onClick: () => {
371
- re(e), me((s) => !s);
371
+ re(e), xe((l) => !l);
372
372
  },
373
373
  children: [
374
- y ? x : `${Vt[c]}, ${e}`,
375
- /* @__PURE__ */ r(er, { size: 11, weight: "bold", ownerState: { open: y } })
374
+ R ? k : `${Qt[s]}, ${e}`,
375
+ /* @__PURE__ */ r(lr, { size: 11, weight: "bold", ownerState: { open: R } })
376
376
  ]
377
377
  }
378
378
  ),
379
- y ? /* @__PURE__ */ r(
380
- ke,
379
+ R ? /* @__PURE__ */ r(
380
+ Se,
381
381
  {
382
382
  type: "button",
383
383
  ownerState: { disableable: !0 },
384
- onClick: () => re((s) => s + 1),
385
- disabled: x >= Te + 1,
384
+ onClick: () => re((l) => l + 1),
385
+ disabled: k >= Fe + 1,
386
386
  "aria-label": "Next year",
387
- children: /* @__PURE__ */ r(Ke, { size: 14, weight: "bold" })
387
+ children: /* @__PURE__ */ r(Ze, { size: 14, weight: "bold" })
388
388
  }
389
- ) : I ? /* @__PURE__ */ r(ke, { type: "button", ownerState: { disableable: !1 }, onClick: Ce, "aria-label": "Next month", children: /* @__PURE__ */ r(Ke, { size: 14, weight: "bold" }) }) : /* @__PURE__ */ r(at, { "aria-hidden": "true" })
389
+ ) : I ? /* @__PURE__ */ r(Se, { type: "button", ownerState: { disableable: !1 }, onClick: Me, "aria-label": "Next month", children: /* @__PURE__ */ r(Ze, { size: 14, weight: "bold" }) }) : /* @__PURE__ */ r(lt, { "aria-hidden": "true" })
390
390
  ] }),
391
- y ? /* @__PURE__ */ r(tr, { children: ot.map((s, R) => {
392
- const u = R === c && x === e, M = qt({ year: x, month: R }, v, Se);
391
+ R ? /* @__PURE__ */ r(cr, { children: at.map((l, P) => {
392
+ const y = P === s && k === e, A = rr({ year: k, month: P }, u, ze);
393
393
  return /* @__PURE__ */ r(
394
- rr,
394
+ sr,
395
395
  {
396
396
  type: "button",
397
- disabled: M,
398
- ownerState: { current: u, disabled: M },
397
+ disabled: A,
398
+ ownerState: { current: y, disabled: A },
399
399
  onClick: () => {
400
- M || (se == null || se(x, R), me(!1));
400
+ A || (de == null || de(k, P), xe(!1));
401
401
  },
402
- children: s
402
+ children: l
403
403
  },
404
- R
404
+ P
405
405
  );
406
- }) }) : /* @__PURE__ */ l(ct, { children: [
407
- /* @__PURE__ */ r(or, { children: Gt.map((s, R) => /* @__PURE__ */ r(nr, { children: s }, `${s}-${R}`)) }),
408
- /* @__PURE__ */ l(ar, { children: [
409
- /* @__PURE__ */ r(ir, { children: ot[c] }),
410
- oe.map((s, R) => {
411
- if (!s)
412
- return /* @__PURE__ */ r(lr, {}, `blank-${R}`);
413
- const u = new Date(e, c, s), M = Ne(u, (f == null ? void 0 : f.from) ?? h), W = Ne(u, (f == null ? void 0 : f.to) ?? d), k = M || W, B = !!(f && L(u, f.from) > 0 && L(u, f.to) < 0), V = pe(u), ue = R % 7, p = !!(f && L(f.from, f.to) !== 0);
414
- return /* @__PURE__ */ l(
415
- sr,
406
+ }) }) : /* @__PURE__ */ c(gt, { children: [
407
+ /* @__PURE__ */ r(dr, { children: Zt.map((l, P) => /* @__PURE__ */ r(gr, { children: l }, `${l}-${P}`)) }),
408
+ /* @__PURE__ */ c(fr, { children: [
409
+ /* @__PURE__ */ r(pr, { children: at[s] }),
410
+ oe.map((l, P) => {
411
+ if (!l)
412
+ return /* @__PURE__ */ r(mr, {}, `blank-${P}`);
413
+ const y = new Date(e, s, l), A = Ae(y, (g == null ? void 0 : g.from) ?? m), fe = Ae(y, (g == null ? void 0 : g.to) ?? d), b = A || fe, T = !!(g && W(y, g.from) > 0 && W(y, g.to) < 0), z = ve(y), L = P % 7, j = !!(g && W(g.from, g.to) !== 0);
414
+ return /* @__PURE__ */ c(
415
+ hr,
416
416
  {
417
- onMouseEnter: () => O(u),
418
- onMouseLeave: () => O(void 0),
417
+ onMouseEnter: () => $(y),
418
+ onMouseLeave: () => $(void 0),
419
419
  children: [
420
- (B || p && k) && /* @__PURE__ */ r(
421
- cr,
420
+ (T || j && b) && /* @__PURE__ */ r(
421
+ ur,
422
422
  {
423
423
  ownerState: {
424
- shape: p && M ? "start" : p && W ? "end" : "middle",
425
- roundLeft: ue === 0 || s === 1,
426
- roundRight: ue === 6 || s === be
424
+ shape: j && A ? "start" : j && fe ? "end" : "middle",
425
+ roundLeft: L === 0 || l === 1,
426
+ roundRight: L === 6 || l === Re
427
427
  },
428
428
  "aria-hidden": "true"
429
429
  }
430
430
  ),
431
431
  /* @__PURE__ */ r(
432
- dr,
432
+ br,
433
433
  {
434
434
  type: "button",
435
- disabled: V,
436
- onClick: () => he(u),
437
- "aria-pressed": k,
438
- "aria-label": ht(u),
435
+ disabled: z,
436
+ onClick: () => ye(y),
437
+ "aria-pressed": b,
438
+ "aria-label": ut(y),
439
439
  ownerState: {
440
440
  // Range endpoints square off the side that meets the band so they sit flush
441
441
  // with it; the start keeps its left corners, the end keeps its right corners.
442
- shape: p && M ? "start" : p && W ? "end" : "single",
443
- selected: k,
444
- inRange: B,
445
- disabled: V
442
+ shape: j && A ? "start" : j && fe ? "end" : "single",
443
+ selected: b,
444
+ inRange: T,
445
+ disabled: z
446
446
  },
447
- children: s
447
+ children: l
448
448
  }
449
449
  )
450
450
  ]
451
451
  },
452
- s
452
+ l
453
453
  );
454
454
  })
455
455
  ] })
456
456
  ] })
457
457
  ] });
458
458
  }
459
- const gr = /* @__PURE__ */ o("div", {
459
+ const wr = /* @__PURE__ */ o("div", {
460
460
  label: "AgenticDateRangePicker-root"
461
461
  })({
462
462
  display: "inline-flex",
463
463
  flexDirection: "column",
464
464
  gap: ".375rem"
465
- }), fr = /* @__PURE__ */ o("div", {
465
+ }), vr = /* @__PURE__ */ o("div", {
466
466
  label: "AgenticDateRangePicker-label"
467
467
  })({
468
468
  fontSize: "12px",
469
469
  fontWeight: 600,
470
- ...A
471
- }), pr = /* @__PURE__ */ o("button", {
470
+ ...M
471
+ }), yr = /* @__PURE__ */ o("button", {
472
472
  label: "AgenticDateRangePicker-trigger",
473
473
  shouldForwardProp: (e) => e !== "ownerState"
474
474
  })(({ ownerState: e }) => [
@@ -485,7 +485,7 @@ const gr = /* @__PURE__ */ o("div", {
485
485
  ...ee,
486
486
  fontSize: "12px",
487
487
  fontWeight: 400,
488
- ...A,
488
+ ...M,
489
489
  outline: "2px solid transparent",
490
490
  outlineOffset: "2px",
491
491
  transitionProperty: "color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter",
@@ -496,24 +496,24 @@ const gr = /* @__PURE__ */ o("div", {
496
496
  "--tw-bg-opacity": "1",
497
497
  backgroundColor: "hsl(var(--bfrs-color-surface-muted) / var(--tw-bg-opacity, 1))"
498
498
  },
499
- "&:focus-visible": He("2px", "hsl(var(--bfrs-color-border-focus) / .25)"),
499
+ "&:focus-visible": Oe("2px", "hsl(var(--bfrs-color-border-focus) / .25)"),
500
500
  "&:disabled": {
501
501
  pointerEvents: "none",
502
502
  opacity: ".55"
503
503
  }
504
504
  },
505
505
  e.md ? { height: "2.25rem", paddingLeft: ".75rem", paddingRight: ".75rem" } : { height: "1.75rem", paddingLeft: ".75rem", paddingRight: ".75rem" },
506
- e.empty ? $ : A,
506
+ e.empty ? V : M,
507
507
  e.smFilled && {
508
508
  "--tw-border-opacity": "1",
509
509
  borderColor: "hsl(var(--bfrs-color-border-focus) / var(--tw-border-opacity, 1))"
510
510
  }
511
- ]), hr = /* @__PURE__ */ o(Lt, {
511
+ ]), xr = /* @__PURE__ */ o(Lt, {
512
512
  label: "AgenticDateRangePicker-triggerIcon"
513
513
  })({
514
514
  flexShrink: 0,
515
- ...$
516
- }), mr = /* @__PURE__ */ o("span", {
515
+ ...V
516
+ }), Rr = /* @__PURE__ */ o("span", {
517
517
  label: "AgenticDateRangePicker-triggerLabel"
518
518
  })({
519
519
  flex: "1 1 0%",
@@ -521,19 +521,19 @@ const gr = /* @__PURE__ */ o("div", {
521
521
  textOverflow: "ellipsis",
522
522
  whiteSpace: "nowrap",
523
523
  textAlign: "left"
524
- }), br = /* @__PURE__ */ o(dt, {
524
+ }), kr = /* @__PURE__ */ o(ft, {
525
525
  label: "AgenticDateRangePicker-caret",
526
526
  shouldForwardProp: (e) => e !== "ownerState"
527
527
  })(({ ownerState: e }) => [
528
528
  {
529
529
  flexShrink: 0,
530
- ...$,
530
+ ...V,
531
531
  transitionProperty: "transform",
532
532
  transitionTimingFunction: "cubic-bezier(.4,0,.2,1)",
533
533
  transitionDuration: ".15s"
534
534
  },
535
- e.open && ft({ "--tw-rotate": "180deg" })
536
- ]), ur = /* @__PURE__ */ o(zt, {
535
+ e.open && mt({ "--tw-rotate": "180deg" })
536
+ ]), Pr = /* @__PURE__ */ o(It, {
537
537
  label: "AgenticDateRangePicker-content",
538
538
  shouldForwardProp: (e) => e !== "ownerState"
539
539
  })(({ ownerState: e }) => [
@@ -552,13 +552,13 @@ const gr = /* @__PURE__ */ o("div", {
552
552
  boxShadow: "var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)",
553
553
  outline: "2px solid transparent",
554
554
  outlineOffset: "2px",
555
- ...Wt,
555
+ ...Ht,
556
556
  animation: "bfrs-bfrs-content-in var(--bfrs-motion-normal) var(--bfrs-ease-out)"
557
557
  },
558
558
  e.widthMode === "presets" && { width: "14rem" },
559
559
  e.widthMode === "one" && { width: "min(calc(100vw - 1rem),420px)" },
560
560
  e.widthMode === "two" && { width: "min(calc(100vw - 1rem),700px)" }
561
- ]), wr = /* @__PURE__ */ o("div", {
561
+ ]), Dr = /* @__PURE__ */ o("div", {
562
562
  label: "AgenticDateRangePicker-scroll",
563
563
  shouldForwardProp: (e) => e !== "ownerState"
564
564
  })(({ ownerState: e }) => [
@@ -573,7 +573,7 @@ const gr = /* @__PURE__ */ o("div", {
573
573
  flexDirection: "column",
574
574
  "@media (min-width:768px)": { flexDirection: "row" }
575
575
  }
576
- ]), vr = /* @__PURE__ */ o("div", {
576
+ ]), Cr = /* @__PURE__ */ o("div", {
577
577
  label: "AgenticDateRangePicker-presetColumn",
578
578
  shouldForwardProp: (e) => e !== "ownerState"
579
579
  })(({ ownerState: e }) => [
@@ -591,13 +591,13 @@ const gr = /* @__PURE__ */ o("div", {
591
591
  borderRightWidth: "1px"
592
592
  }
593
593
  }
594
- ]), yr = /* @__PURE__ */ o("div", {
594
+ ]), Sr = /* @__PURE__ */ o("div", {
595
595
  label: "AgenticDateRangePicker-presetList"
596
596
  })({
597
597
  flex: "1 1 0%",
598
598
  paddingTop: ".5rem",
599
599
  paddingBottom: ".5rem"
600
- }), lt = /* @__PURE__ */ o("button", {
600
+ }), st = /* @__PURE__ */ o("button", {
601
601
  label: "AgenticDateRangePicker-presetButton",
602
602
  shouldForwardProp: (e) => e !== "ownerState"
603
603
  })(({ ownerState: e }) => [
@@ -619,14 +619,14 @@ const gr = /* @__PURE__ */ o("div", {
619
619
  "&:focus-visible": N
620
620
  },
621
621
  e.md ? { height: "2.25rem", paddingLeft: ".75rem", paddingRight: ".75rem" } : { height: "1.75rem", paddingLeft: ".625rem", paddingRight: ".625rem" },
622
- e.selected ? { ...N, fontWeight: 700, ...A } : { fontWeight: 500, ...Pe },
622
+ e.selected ? { ...N, fontWeight: 700, ...M } : { fontWeight: 500, ...Te },
623
623
  e.presetDisabled && {
624
624
  cursor: "not-allowed",
625
625
  ...Z,
626
626
  opacity: ".6",
627
627
  "&:hover": { backgroundColor: "transparent" }
628
628
  }
629
- ]), xr = /* @__PURE__ */ o("div", {
629
+ ]), Ar = /* @__PURE__ */ o("div", {
630
630
  label: "AgenticDateRangePicker-rangeLimit"
631
631
  })({
632
632
  position: "sticky",
@@ -643,26 +643,26 @@ const gr = /* @__PURE__ */ o("div", {
643
643
  paddingBottom: ".75rem",
644
644
  fontSize: ".75rem",
645
645
  lineHeight: "1.25rem",
646
- ...$
647
- }), Rr = /* @__PURE__ */ o("span", {
646
+ ...V
647
+ }), Tr = /* @__PURE__ */ o("span", {
648
648
  label: "AgenticDateRangePicker-rangeLimitIcon"
649
649
  })({
650
650
  marginTop: ".125rem",
651
651
  display: "flex",
652
652
  flexShrink: 0
653
- }), kr = /* @__PURE__ */ o("div", {
653
+ }), Br = /* @__PURE__ */ o("div", {
654
654
  label: "AgenticDateRangePicker-customArea"
655
655
  })({
656
656
  minWidth: "0px",
657
657
  flex: "1 1 0%",
658
658
  ...ee
659
- }), Pr = /* @__PURE__ */ o("div", {
659
+ }), Mr = /* @__PURE__ */ o("div", {
660
660
  label: "AgenticDateRangePicker-yearRow"
661
661
  })({
662
662
  paddingLeft: "1rem",
663
663
  paddingRight: "1rem",
664
664
  paddingTop: "1rem"
665
- }), Dr = /* @__PURE__ */ o("div", {
665
+ }), zr = /* @__PURE__ */ o("div", {
666
666
  label: "AgenticDateRangePicker-yearBanner"
667
667
  })({
668
668
  display: "flex",
@@ -673,21 +673,21 @@ const gr = /* @__PURE__ */ o("div", {
673
673
  paddingRight: ".75rem",
674
674
  paddingTop: ".5rem",
675
675
  paddingBottom: ".5rem"
676
- }), Cr = /* @__PURE__ */ o("span", {
676
+ }), Wr = /* @__PURE__ */ o("span", {
677
677
  label: "AgenticDateRangePicker-yearText"
678
678
  })({
679
679
  flex: "1 1 0%",
680
680
  fontSize: "12.5px",
681
681
  fontWeight: 500,
682
- ...A
683
- }), Sr = /* @__PURE__ */ o(Xt, {
682
+ ...M
683
+ }), Fr = /* @__PURE__ */ o(tr, {
684
684
  label: "AgenticDateRangePicker-yearSelect"
685
685
  })({
686
686
  "&&": {
687
687
  width: "8rem",
688
688
  flexShrink: 0
689
689
  }
690
- }), Ar = /* @__PURE__ */ o("div", {
690
+ }), Ir = /* @__PURE__ */ o("div", {
691
691
  label: "AgenticDateRangePicker-calendarGrid",
692
692
  shouldForwardProp: (e) => e !== "ownerState"
693
693
  })(({ ownerState: e }) => [
@@ -698,7 +698,7 @@ const gr = /* @__PURE__ */ o("div", {
698
698
  padding: "1rem"
699
699
  },
700
700
  e.two ? { "@media (min-width:768px)": { gridTemplateColumns: "repeat(2,minmax(0,1fr))" } } : { gridTemplateColumns: "repeat(1,minmax(0,1fr))" }
701
- ]), Tr = /* @__PURE__ */ o("div", {
701
+ ]), Lr = /* @__PURE__ */ o("div", {
702
702
  label: "AgenticDateRangePicker-footer"
703
703
  })({
704
704
  display: "flex",
@@ -706,7 +706,7 @@ const gr = /* @__PURE__ */ o("div", {
706
706
  alignItems: "stretch",
707
707
  borderTopWidth: "1px",
708
708
  ...te
709
- }), Mr = /* @__PURE__ */ o("div", {
709
+ }), Yr = /* @__PURE__ */ o("div", {
710
710
  label: "AgenticDateRangePicker-footerInner"
711
711
  })({
712
712
  display: "flex",
@@ -723,359 +723,388 @@ const gr = /* @__PURE__ */ o("div", {
723
723
  alignItems: "center",
724
724
  justifyContent: "space-between"
725
725
  }
726
- }), Br = /* @__PURE__ */ o("div", {
726
+ }), Er = /* @__PURE__ */ o("div", {
727
727
  label: "AgenticDateRangePicker-selectedBlock"
728
728
  })({
729
729
  display: "flex",
730
730
  flexDirection: "column",
731
731
  gap: ".125rem"
732
- }), zr = /* @__PURE__ */ o("div", {
732
+ }), Hr = /* @__PURE__ */ o("div", {
733
733
  label: "AgenticDateRangePicker-selectedText"
734
734
  })({
735
735
  fontSize: "13px",
736
- ...Pe
737
- }), Lr = /* @__PURE__ */ o("span", {
736
+ ...Te
737
+ }), Nr = /* @__PURE__ */ o("span", {
738
738
  label: "AgenticDateRangePicker-selectedLabel"
739
739
  })({
740
740
  fontWeight: 600,
741
741
  "--tw-text-opacity": "1",
742
742
  color: "hsl(var(--bfrs-color-primary) / var(--tw-text-opacity, 1))"
743
- }), st = /* @__PURE__ */ o("span", {
743
+ }), dt = /* @__PURE__ */ o("span", {
744
744
  label: "AgenticDateRangePicker-selectedValue"
745
745
  })({
746
746
  fontWeight: 500
747
- }), Fr = /* @__PURE__ */ o("span", {
747
+ }), _r = /* @__PURE__ */ o("span", {
748
748
  label: "AgenticDateRangePicker-selectedTo"
749
- })($), Ir = /* @__PURE__ */ o("div", {
749
+ })(V), Vr = /* @__PURE__ */ o("div", {
750
750
  label: "AgenticDateRangePicker-incomplete"
751
751
  })({
752
752
  fontSize: "12px",
753
753
  "--tw-text-opacity": "1",
754
754
  color: "hsl(var(--bfrs-color-danger) / var(--tw-text-opacity, 1))"
755
- }), Wr = /* @__PURE__ */ o("div", {
755
+ }), Or = /* @__PURE__ */ o("div", {
756
756
  label: "AgenticDateRangePicker-footerActions"
757
757
  })({
758
758
  display: "flex",
759
759
  flexWrap: "wrap",
760
760
  justifyContent: "flex-end",
761
761
  gap: ".5rem"
762
- }), Yr = /* @__PURE__ */ o("div", {
762
+ }), $r = /* @__PURE__ */ o("div", {
763
763
  label: "AgenticDateRangePicker-helper"
764
764
  })({
765
765
  fontSize: ".75rem",
766
766
  lineHeight: "1.25rem",
767
- ...$
767
+ ...V
768
768
  });
769
- function ro({
769
+ function so({
770
770
  className: e,
771
- value: c,
772
- defaultValue: h,
771
+ value: s,
772
+ defaultValue: m,
773
773
  onChange: d,
774
- presets: b = _t,
775
- placeholder: j = "Select date range",
776
- label: pe,
777
- helperText: he,
778
- size: O = "md",
779
- disabled: De,
780
- clearable: Ce,
774
+ presets: h = Xt,
775
+ placeholder: O = "Select date range",
776
+ label: ve,
777
+ helperText: ye,
778
+ size: $ = "md",
779
+ disabled: Be,
780
+ clearable: Me,
781
781
  minDate: F,
782
782
  maxDate: I,
783
- maxRangeDays: v,
784
- months: Se = 2,
785
- align: se = "start",
786
- side: Ae = "bottom",
787
- open: y,
788
- defaultOpen: me = !1,
789
- onOpenChange: x,
783
+ maxRangeDays: u,
784
+ months: ze = 2,
785
+ align: de = "start",
786
+ side: We = "bottom",
787
+ open: R,
788
+ defaultOpen: xe = !1,
789
+ onOpenChange: k,
790
790
  infoText: re,
791
- customPresetLabel: Te = "Custom",
792
- applyLabel: Me = "Apply",
793
- cancelLabel: be = "Cancel",
794
- clearLabel: oe = "Clear",
795
- formatDate: T = ht,
796
- formatRange: f,
797
- triggerClassName: s,
798
- contentClassName: R,
799
- calendarClassName: u,
800
- rangeLimitClassName: M,
801
- restrictToLast3Months: W = !1,
802
- singleDateMode: k = !1,
803
- allowedFutureDate: B = !1,
804
- showLastOneYearOnly: V = !1,
805
- ...ue
791
+ customPresetLabel: Fe = "Custom",
792
+ customPresetDefaultDays: ge = 30,
793
+ applyLabel: Re = "Apply",
794
+ cancelLabel: oe = "Cancel",
795
+ clearLabel: ke = "Clear",
796
+ formatDate: g = ut,
797
+ formatRange: l,
798
+ triggerClassName: P,
799
+ contentClassName: y,
800
+ calendarClassName: A,
801
+ rangeLimitClassName: fe,
802
+ restrictToLast3Months: b = !1,
803
+ singleDateMode: T = !1,
804
+ allowedFutureDate: z = !1,
805
+ showLastOneYearOnly: L = !1,
806
+ ...j
806
807
  }) {
807
- const p = k ? 1 : Se, [Be, je] = D(() => Ze(h ?? {})), n = z(() => Ze(c ?? Be), [c, Be]), [mt, bt] = D(me), ce = y ?? mt, [Oe, ne] = D(n.preset ?? m), [g, Y] = D(n), [Ve, ae] = D(), [ie, G] = D(!1), [ze, we] = D(V ? xe : et), [U, X] = D(() => Ye(n, p)), [le, q] = D(() => {
808
- const t = Ye(n, p);
809
- return S(t.year, t.month, 1);
810
- }), Ge = It(!1), J = p, ve = z(() => {
811
- if (W) {
812
- const t = w(/* @__PURE__ */ new Date());
813
- return { min: Re(t, -90), max: t };
808
+ const D = T ? 1 : ze, [Ie, bt] = S(() => tt(m ?? {})), n = x(() => tt(s ?? Ie), [s, Ie]), [wt, vt] = S(xe), pe = R ?? wt, [Ge, ne] = S(n.preset ?? p), [f, Y] = S(n), [Ue, ae] = S(), [ie, G] = S(!1), me = x(
809
+ () => Ot(u ?? Jt),
810
+ [u]
811
+ ), Le = x(() => {
812
+ const t = ge > 0 ? Math.floor(ge) : 30;
813
+ return u ? Math.min(t, u) : t;
814
+ }, [ge, u]), he = x(
815
+ () => b ? jt(Le, me) : $t,
816
+ [b, Le, me]
817
+ ), [Ye, le] = S(
818
+ L ? we : he
819
+ ), [U, X] = S(() => _e(n, D)), [ce, q] = S(() => {
820
+ const t = _e(n, D);
821
+ return B(t.year, t.month, 1);
822
+ }), Xe = Et(!1), J = D, Pe = x(() => {
823
+ if (b) {
824
+ const t = v(/* @__PURE__ */ new Date());
825
+ return { min: Ce(t, -90), max: t };
814
826
  }
815
- return tt(ze);
816
- }, [W, ze]), K = z(() => {
817
- if (B)
818
- return Re(w(/* @__PURE__ */ new Date()), 1);
819
- const t = ve.min;
820
- return F && L(w(F), t) > 0 ? w(F) : t;
821
- }, [B, ve, F]), Q = z(() => {
822
- if (B)
823
- return Re(w(/* @__PURE__ */ new Date()), 365);
824
- const t = ve.max;
825
- return I && L(w(I), t) < 0 ? w(I) : t;
826
- }, [B, ve, I]), de = z(
827
+ return rt(Ye);
828
+ }, [b, Ye]), K = x(() => {
829
+ if (z)
830
+ return Ce(v(/* @__PURE__ */ new Date()), 1);
831
+ const t = Pe.min;
832
+ return F && W(v(F), t) > 0 ? v(F) : t;
833
+ }, [z, Pe, F]), Q = x(() => {
834
+ if (z)
835
+ return Ce(v(/* @__PURE__ */ new Date()), 365);
836
+ const t = Pe.max;
837
+ return I && W(v(I), t) < 0 ? v(I) : t;
838
+ }, [z, Pe, I]), ue = x(
827
839
  () => ({ year: K.getFullYear(), month: K.getMonth() }),
828
840
  [K]
829
- ), E = z(
841
+ ), E = x(
830
842
  () => ({ year: Q.getFullYear(), month: Q.getMonth() }),
831
843
  [Q]
832
- ), ut = z(() => J !== 2 ? E : S(le.year, le.month, -1), [E, le, J]), wt = z(() => S(U.year, U.month, 1), [U]), ge = ye(
844
+ ), yt = x(() => J !== 2 ? E : B(ce.year, ce.month, -1), [E, ce, J]), xt = x(() => B(U.year, U.month, 1), [U]), be = De(
833
845
  (t) => {
834
- y === void 0 && bt(t), x == null || x(t);
846
+ R === void 0 && vt(t), k == null || k(t);
835
847
  },
836
- [y, x]
837
- ), Le = ye(
848
+ [R, k]
849
+ ), Ee = De(
838
850
  (t) => {
839
- c === void 0 && je(t), d == null || d(t);
851
+ s === void 0 && bt(t), d == null || d(t);
840
852
  },
841
- [d, c]
853
+ [d, s]
842
854
  );
843
- gt(() => {
844
- const t = ce && !Ge.current;
845
- if (Ge.current = ce, !t) return;
846
- if (Y(n), ne(n.preset ?? (C(n) ? m : "")), ae(void 0), G(!1), C(n) && p === 2) {
847
- const i = Ee(n.from, n.to, p, {
848
- minMonth: de,
855
+ pt(() => {
856
+ const t = pe && !Xe.current;
857
+ if (Xe.current = pe, !t) return;
858
+ if (Y(n), ne(n.preset ?? (C(n) ? p : "")), ae(void 0), G(!1), C(n) && D === 2) {
859
+ const a = Ve(n.from, n.to, D, {
860
+ minMonth: ue,
849
861
  maxMonth: E
850
862
  });
851
- X(i.left), q(i.right);
863
+ X(a.left), q(a.right);
852
864
  } else {
853
- const i = Ye(n, p);
854
- X(i), q(S(i.year, i.month, 1));
865
+ const a = _e(n, D);
866
+ X(a), q(B(a.year, a.month, 1));
855
867
  }
856
- const a = (/* @__PURE__ */ new Date()).getFullYear();
857
- if (C(n) && n.preset === m) {
858
- const i = n.from.getFullYear(), P = n.to.getFullYear();
859
- i === P && i >= pt && i < a ? we(String(i)) : we(xe);
868
+ if (b) {
869
+ const a = C(n) && n.preset === p && Ae(n.to, v(/* @__PURE__ */ new Date())) ? Gt(ot(n.to, n.from) + 1) : void 0;
870
+ le(
871
+ a && me.some((w) => w.value === a) ? a : he
872
+ );
873
+ return;
874
+ }
875
+ const i = (/* @__PURE__ */ new Date()).getFullYear();
876
+ if (C(n) && n.preset === p) {
877
+ const a = n.from.getFullYear(), w = n.to.getFullYear();
878
+ a === w && a >= ht && a < i ? le(String(a)) : le(we);
860
879
  } else
861
- we(V ? xe : et);
862
- }, [n, E, de, p, ce, V]);
863
- const vt = z(() => {
864
- if (f)
865
- return f(n);
866
- const t = Nt(b, n.preset);
867
- return t && n.preset !== m ? t : C(n) ? Ne(n.from, n.to) ? T(n.from) : `${T(n.from)} - ${T(n.to)}` : j;
868
- }, [n, T, f, j, b]), yt = ye(
880
+ le(L ? we : he);
881
+ }, [
882
+ n,
883
+ me,
884
+ he,
885
+ E,
886
+ ue,
887
+ D,
888
+ pe,
889
+ b,
890
+ L
891
+ ]);
892
+ const Rt = x(() => {
893
+ if (l)
894
+ return l(n);
895
+ const t = Ut(h, n.preset);
896
+ return t && n.preset !== p ? t : C(n) ? Ae(n.from, n.to) ? g(n.from) : `${g(n.from)} - ${g(n.to)}` : O;
897
+ }, [n, g, l, O, h]), kt = De(
869
898
  (t) => {
870
- we(t);
871
- const a = tt(t), { from: i, to: P } = $t(a, { minDate: F, maxDate: I, maxRangeDays: v });
872
- Y({ preset: m, from: i, to: P });
873
- const fe = Ee(i, P, p, {
874
- minMonth: { year: i.getFullYear(), month: i.getMonth() },
875
- maxMonth: { year: P.getFullYear(), month: P.getMonth() }
899
+ le(t);
900
+ const i = rt(t), { from: a, to: w } = qt(i, { minDate: F, maxDate: I, maxRangeDays: u });
901
+ Y({ preset: p, from: a, to: w });
902
+ const se = Ve(a, w, D, {
903
+ minMonth: { year: a.getFullYear(), month: a.getMonth() },
904
+ maxMonth: { year: w.getFullYear(), month: w.getMonth() }
876
905
  });
877
- X(fe.left), q(fe.right), G(!1), ae(void 0);
906
+ X(se.left), q(se.right), G(!1), ae(void 0);
878
907
  },
879
- [p, F, I, v]
880
- ), Fe = ye(
908
+ [D, F, I, u]
909
+ ), He = De(
881
910
  (t) => {
882
- const a = w(t), i = w(K), P = w(Q);
883
- return !!(L(a, i) < 0 || L(a, P) > 0 || ie && g.from && v && jt(a, g.from) + 1 > v);
911
+ const i = v(t), a = v(K), w = v(Q);
912
+ return !!(W(i, a) < 0 || W(i, w) > 0 || ie && f.from && u && ot(i, f.from) + 1 > u);
884
913
  },
885
- [ie, g.from, K, Q, v]
886
- ), xt = (t) => {
914
+ [ie, f.from, K, Q, u]
915
+ ), Pt = (t) => {
887
916
  if (t.disabled) return;
888
- const a = t.getRange(), i = _e(a.from, a.to);
889
- Le({ preset: t.id, ...i }), ge(!1);
890
- }, Rt = () => {
891
- ne(m);
892
- const t = (Ie) => L(Ie, K) < 0 ? K : L(Ie, Q) > 0 ? Q : Ie, a = t(w(/* @__PURE__ */ new Date())), i = v ? Math.min(30, v) : 30, P = t(Re(a, -(i - 1)));
893
- Y({ preset: m, from: P, to: a });
894
- const fe = Ee(P, a, p, {
895
- minMonth: de,
917
+ const i = t.getRange(), a = $e(i.from, i.to);
918
+ Ee({ preset: t.id, ...a }), be(!1);
919
+ }, Dt = () => {
920
+ ne(p), le(L ? we : he);
921
+ const t = (se) => W(se, K) < 0 ? K : W(se, Q) > 0 ? Q : se, i = t(v(/* @__PURE__ */ new Date())), a = t(Ce(i, -(Le - 1)));
922
+ Y({ preset: p, from: a, to: i });
923
+ const w = Ve(a, i, D, {
924
+ minMonth: ue,
896
925
  maxMonth: E
897
926
  });
898
- X(fe.left), q(fe.right), G(!1), ae(void 0);
899
- }, Ue = (t) => {
900
- if (Fe(t)) return;
901
- const a = w(t);
902
- if (k) {
903
- Y({ preset: m, from: a, to: a }), ne(m);
927
+ X(w.left), q(w.right), G(!1), ae(void 0);
928
+ }, qe = (t) => {
929
+ if (He(t)) return;
930
+ const i = v(t);
931
+ if (T) {
932
+ Y({ preset: p, from: i, to: i }), ne(p);
904
933
  return;
905
934
  }
906
- if (!ie || !g.from || g.to) {
907
- Y({ preset: m, from: a, to: void 0 }), ne(m), G(!0);
935
+ if (!ie || !f.from || f.to) {
936
+ Y({ preset: p, from: i, to: void 0 }), ne(p), G(!0);
908
937
  return;
909
938
  }
910
- const i = _e(g.from, a);
911
- Y({ preset: m, ...i }), G(!1);
912
- }, kt = () => {
913
- C(g) && (Le({ preset: m, from: g.from, to: g.to }), ge(!1));
914
- }, Pt = () => {
915
- Y(n), ne(n.preset ?? (C(n) ? m : "")), G(!1), ae(void 0), ge(!1);
916
- }, Dt = () => {
917
- Le({}), Y({}), ne(""), G(!1), ge(!1);
918
- }, Ct = C(g), H = Oe === m, St = k ? !!g.from : Ct, Xe = re ?? (v ? `Date range can be selected for up to ${v} days.` : W ? "Date can be viewed only for the last 90 days." : k && B ? "Date can be viewed only for a period of future date." : "Date can be viewed only for a period of up to 1 year."), At = _(U, de) > 0, qe = J === 2 ? _(le, E) < 0 : _(U, E) < 0;
919
- return /* @__PURE__ */ l(gr, { className: e, ...ue, children: [
920
- pe && /* @__PURE__ */ r(fr, { children: pe }),
921
- /* @__PURE__ */ l(Tt, { open: ce, onOpenChange: ge, children: [
922
- /* @__PURE__ */ r(Mt, { asChild: !0, children: /* @__PURE__ */ l(
923
- pr,
939
+ const a = $e(f.from, i);
940
+ Y({ preset: p, ...a }), G(!1);
941
+ }, Ct = () => {
942
+ C(f) && (Ee({ preset: p, from: f.from, to: f.to }), be(!1));
943
+ }, St = () => {
944
+ Y(n), ne(n.preset ?? (C(n) ? p : "")), G(!1), ae(void 0), be(!1);
945
+ }, At = () => {
946
+ Ee({}), Y({}), ne(""), G(!1), be(!1);
947
+ }, Tt = C(f), H = Ge === p, Bt = T ? !!f.from : Tt, Je = re ?? (u ? `Date range can be selected for up to ${u} days.` : b ? "Date can be viewed only for the last 90 days." : T && z ? "Date can be viewed only for a period of future date." : "Date can be viewed only for a period of up to 1 year."), Mt = _(U, ue) > 0, Ke = J === 2 ? _(ce, E) < 0 : _(U, E) < 0;
948
+ return /* @__PURE__ */ c(wr, { className: e, ...j, children: [
949
+ ve && /* @__PURE__ */ r(vr, { children: ve }),
950
+ /* @__PURE__ */ c(zt, { open: pe, onOpenChange: be, children: [
951
+ /* @__PURE__ */ r(Wt, { asChild: !0, children: /* @__PURE__ */ c(
952
+ yr,
924
953
  {
925
954
  type: "button",
926
- disabled: De,
955
+ disabled: Be,
927
956
  "data-filled": C(n) || n.preset ? "" : void 0,
928
957
  ownerState: {
929
- md: O === "md",
958
+ md: $ === "md",
930
959
  empty: !C(n) && !n.preset,
931
- smFilled: O === "sm" && (C(n) || !!n.preset)
960
+ smFilled: $ === "sm" && (C(n) || !!n.preset)
932
961
  },
933
- className: s,
962
+ className: P,
934
963
  children: [
935
- /* @__PURE__ */ r(hr, { size: 13 }),
936
- /* @__PURE__ */ r(mr, { children: vt }),
937
- /* @__PURE__ */ r(br, { size: 10, weight: "bold", ownerState: { open: ce } })
964
+ /* @__PURE__ */ r(xr, { size: 13 }),
965
+ /* @__PURE__ */ r(Rr, { children: Rt }),
966
+ /* @__PURE__ */ r(kr, { size: 10, weight: "bold", ownerState: { open: pe } })
938
967
  ]
939
968
  }
940
969
  ) }),
941
- /* @__PURE__ */ r(Bt, { children: /* @__PURE__ */ r(Ut, { children: /* @__PURE__ */ l(
942
- ur,
970
+ /* @__PURE__ */ r(Ft, { children: /* @__PURE__ */ r(er, { children: /* @__PURE__ */ c(
971
+ Pr,
943
972
  {
944
- align: se,
945
- side: Ae,
973
+ align: de,
974
+ side: We,
946
975
  sideOffset: 6,
947
- collisionPadding: Ht,
976
+ collisionPadding: Vt,
948
977
  ownerState: { widthMode: H ? J === 1 ? "one" : "two" : "presets" },
949
- className: R,
978
+ className: y,
950
979
  children: [
951
- /* @__PURE__ */ l(wr, { ownerState: { customPanel: H }, children: [
952
- /* @__PURE__ */ l(vr, { ownerState: { customPanel: H }, children: [
953
- /* @__PURE__ */ l(yr, { children: [
954
- b.map((t) => {
955
- const a = Oe === t.id;
956
- return /* @__PURE__ */ l(
957
- lt,
980
+ /* @__PURE__ */ c(Dr, { ownerState: { customPanel: H }, children: [
981
+ /* @__PURE__ */ c(Cr, { ownerState: { customPanel: H }, children: [
982
+ /* @__PURE__ */ c(Sr, { children: [
983
+ h.map((t) => {
984
+ const i = Ge === t.id;
985
+ return /* @__PURE__ */ c(
986
+ st,
958
987
  {
959
988
  type: "button",
960
989
  disabled: t.disabled,
961
- onClick: () => xt(t),
962
- ownerState: { md: O === "md", selected: a, presetDisabled: !!t.disabled },
990
+ onClick: () => Pt(t),
991
+ ownerState: { md: $ === "md", selected: i, presetDisabled: !!t.disabled },
963
992
  children: [
964
993
  /* @__PURE__ */ r("span", { children: t.label }),
965
- a && /* @__PURE__ */ r(Qe, { size: 14, weight: "bold" })
994
+ i && /* @__PURE__ */ r(et, { size: 14, weight: "bold" })
966
995
  ]
967
996
  },
968
997
  t.id
969
998
  );
970
999
  }),
971
- /* @__PURE__ */ l(
972
- lt,
1000
+ /* @__PURE__ */ c(
1001
+ st,
973
1002
  {
974
1003
  type: "button",
975
- onClick: Rt,
976
- ownerState: { md: O === "md", selected: H, presetDisabled: !1 },
1004
+ onClick: Dt,
1005
+ ownerState: { md: $ === "md", selected: H, presetDisabled: !1 },
977
1006
  children: [
978
- /* @__PURE__ */ r("span", { children: Te }),
979
- H && /* @__PURE__ */ r(Qe, { size: 14, weight: "bold" })
1007
+ /* @__PURE__ */ r("span", { children: Fe }),
1008
+ H && /* @__PURE__ */ r(et, { size: 14, weight: "bold" })
980
1009
  ]
981
1010
  }
982
1011
  )
983
1012
  ] }),
984
- Xe && H && /* @__PURE__ */ l(xr, { className: M, children: [
985
- /* @__PURE__ */ r(Rr, { children: /* @__PURE__ */ r(Yt, {}) }),
986
- /* @__PURE__ */ r("span", { children: Xe })
1013
+ Je && H && /* @__PURE__ */ c(Ar, { className: fe, children: [
1014
+ /* @__PURE__ */ r(Tr, { children: /* @__PURE__ */ r(Nt, {}) }),
1015
+ /* @__PURE__ */ r("span", { children: Je })
987
1016
  ] })
988
1017
  ] }),
989
- H && /* @__PURE__ */ l(kr, { children: [
990
- !W && !B && !k && /* @__PURE__ */ r(Pr, { children: /* @__PURE__ */ l(Dr, { style: Et, children: [
991
- /* @__PURE__ */ r(Cr, { children: "Please select the year you want to view data for" }),
1018
+ H && /* @__PURE__ */ c(Br, { children: [
1019
+ !z && !T && /* @__PURE__ */ r(Mr, { children: /* @__PURE__ */ c(zr, { style: _t, children: [
1020
+ /* @__PURE__ */ r(Wr, { children: b ? "Please select the period you want to view data for" : "Please select the year you want to view data for" }),
992
1021
  /* @__PURE__ */ r(
993
- Sr,
1022
+ Fr,
994
1023
  {
995
1024
  size: "sm",
996
- value: ze,
997
- onValueChange: yt,
998
- options: V ? rt.filter((t) => t.value === xe) : rt
1025
+ value: Ye,
1026
+ onValueChange: kt,
1027
+ options: b ? me : L ? nt.filter((t) => t.value === we) : nt
999
1028
  }
1000
1029
  )
1001
1030
  ] }) }),
1002
- /* @__PURE__ */ l(Ar, { ownerState: { two: J === 2 }, children: [
1031
+ /* @__PURE__ */ c(Ir, { ownerState: { two: J === 2 }, children: [
1003
1032
  /* @__PURE__ */ r(
1004
- it,
1033
+ ct,
1005
1034
  {
1006
1035
  year: U.year,
1007
1036
  month: U.month,
1008
- from: g.from,
1009
- to: g.to,
1010
- hovered: Ve,
1037
+ from: f.from,
1038
+ to: f.to,
1039
+ hovered: Ue,
1011
1040
  awaitingTo: ie,
1012
- isDateDisabled: Fe,
1013
- onSelectDate: Ue,
1041
+ isDateDisabled: He,
1042
+ onSelectDate: qe,
1014
1043
  onHoverDate: ae,
1015
- onPrev: () => X((t) => S(t.year, t.month, -1)),
1016
- onNext: () => X((t) => S(t.year, t.month, 1)),
1017
- onNavigateTo: (t, a) => X({ year: t, month: a }),
1018
- minMonth: de,
1019
- maxMonth: ut,
1020
- showPrev: At,
1021
- showNext: J !== 2 && qe,
1022
- className: u
1044
+ onPrev: () => X((t) => B(t.year, t.month, -1)),
1045
+ onNext: () => X((t) => B(t.year, t.month, 1)),
1046
+ onNavigateTo: (t, i) => X({ year: t, month: i }),
1047
+ minMonth: ue,
1048
+ maxMonth: yt,
1049
+ showPrev: Mt,
1050
+ showNext: J !== 2 && Ke,
1051
+ className: A
1023
1052
  }
1024
1053
  ),
1025
1054
  J === 2 && /* @__PURE__ */ r(
1026
- it,
1055
+ ct,
1027
1056
  {
1028
- year: le.year,
1029
- month: le.month,
1030
- from: g.from,
1031
- to: g.to,
1032
- hovered: Ve,
1057
+ year: ce.year,
1058
+ month: ce.month,
1059
+ from: f.from,
1060
+ to: f.to,
1061
+ hovered: Ue,
1033
1062
  awaitingTo: ie,
1034
- isDateDisabled: Fe,
1035
- onSelectDate: Ue,
1063
+ isDateDisabled: He,
1064
+ onSelectDate: qe,
1036
1065
  onHoverDate: ae,
1037
- onPrev: () => q((t) => S(t.year, t.month, -1)),
1038
- onNext: () => q((t) => S(t.year, t.month, 1)),
1039
- onNavigateTo: (t, a) => q({ year: t, month: a }),
1040
- minMonth: wt,
1066
+ onPrev: () => q((t) => B(t.year, t.month, -1)),
1067
+ onNext: () => q((t) => B(t.year, t.month, 1)),
1068
+ onNavigateTo: (t, i) => q({ year: t, month: i }),
1069
+ minMonth: xt,
1041
1070
  maxMonth: E,
1042
1071
  showPrev: !1,
1043
- showNext: qe,
1044
- className: u
1072
+ showNext: Ke,
1073
+ className: A
1045
1074
  }
1046
1075
  )
1047
1076
  ] })
1048
1077
  ] })
1049
1078
  ] }),
1050
- H && /* @__PURE__ */ r(Tr, { children: /* @__PURE__ */ l(Mr, { children: [
1051
- /* @__PURE__ */ l(Br, { children: [
1052
- /* @__PURE__ */ l(zr, { children: [
1053
- /* @__PURE__ */ r(Lr, { children: "Selected:" }),
1079
+ H && /* @__PURE__ */ r(Lr, { children: /* @__PURE__ */ c(Yr, { children: [
1080
+ /* @__PURE__ */ c(Er, { children: [
1081
+ /* @__PURE__ */ c(Hr, { children: [
1082
+ /* @__PURE__ */ r(Nr, { children: "Selected:" }),
1054
1083
  " ",
1055
- /* @__PURE__ */ r(st, { children: g.from ? T(g.from) : "--/--/----" }),
1056
- !k && /* @__PURE__ */ l(ct, { children: [
1084
+ /* @__PURE__ */ r(dt, { children: f.from ? g(f.from) : "--/--/----" }),
1085
+ !T && /* @__PURE__ */ c(gt, { children: [
1057
1086
  " ",
1058
- /* @__PURE__ */ r(Fr, { children: "To" }),
1087
+ /* @__PURE__ */ r(_r, { children: "To" }),
1059
1088
  " ",
1060
- /* @__PURE__ */ r(st, { children: g.to ? T(g.to) : "--/--/----" })
1089
+ /* @__PURE__ */ r(dt, { children: f.to ? g(f.to) : "--/--/----" })
1061
1090
  ] })
1062
1091
  ] }),
1063
- ie && !k && /* @__PURE__ */ r(Ir, { children: "Date range incomplete. Select both Start and End dates." })
1092
+ ie && !T && /* @__PURE__ */ r(Vr, { children: "Date range incomplete. Select both Start and End dates." })
1064
1093
  ] }),
1065
- /* @__PURE__ */ l(Wr, { children: [
1066
- Ce && /* @__PURE__ */ r(We, { variant: "ghost", size: "sm", leftIcon: /* @__PURE__ */ r(Ft, { size: 13, weight: "bold" }), onClick: Dt, children: oe }),
1067
- /* @__PURE__ */ r(We, { variant: "outline", size: "sm", onClick: Pt, children: be }),
1068
- /* @__PURE__ */ r(We, { size: "sm", disabled: !St, onClick: kt, children: Me })
1094
+ /* @__PURE__ */ c(Or, { children: [
1095
+ Me && /* @__PURE__ */ r(Ne, { variant: "ghost", size: "sm", leftIcon: /* @__PURE__ */ r(Yt, { size: 13, weight: "bold" }), onClick: At, children: ke }),
1096
+ /* @__PURE__ */ r(Ne, { variant: "outline", size: "sm", onClick: St, children: oe }),
1097
+ /* @__PURE__ */ r(Ne, { size: "sm", disabled: !Bt, onClick: Ct, children: Re })
1069
1098
  ] })
1070
1099
  ] }) })
1071
1100
  ]
1072
1101
  }
1073
1102
  ) }) })
1074
1103
  ] }),
1075
- he && /* @__PURE__ */ r(Yr, { children: he })
1104
+ ye && /* @__PURE__ */ r($r, { children: ye })
1076
1105
  ] });
1077
1106
  }
1078
1107
  export {
1079
- ro as DateRangePicker
1108
+ so as DateRangePicker
1080
1109
  };
1081
1110
  //# sourceMappingURL=DateRangePicker.js.map