@sth87/shadcn-design-system 0.1.5 → 0.1.6

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.
Files changed (48) hide show
  1. package/dist/AI_CONTEXT.md +1 -0
  2. package/dist/cjs/components/Button/Button.cjs +1 -1
  3. package/dist/cjs/components/Button/Button.cjs.map +1 -1
  4. package/dist/cjs/components/DatePicker/RangePicker.cjs +1 -1
  5. package/dist/cjs/components/DatePicker/RangePicker.cjs.map +1 -1
  6. package/dist/cjs/components/Input/Input.cjs +1 -1
  7. package/dist/cjs/components/Input/Input.cjs.map +1 -1
  8. package/dist/cjs/components/Table/data-table.cjs +1 -1
  9. package/dist/cjs/components/Table/data-table.cjs.map +1 -1
  10. package/dist/cjs/packages/ui/src/components/alert-dialog.cjs +1 -1
  11. package/dist/cjs/packages/ui/src/components/alert-dialog.cjs.map +1 -1
  12. package/dist/cjs/packages/ui/src/components/calendar.cjs +1 -1
  13. package/dist/cjs/packages/ui/src/components/calendar.cjs.map +1 -1
  14. package/dist/cjs/packages/ui/src/components/combobox.cjs +1 -1
  15. package/dist/cjs/packages/ui/src/components/combobox.cjs.map +1 -1
  16. package/dist/cjs/packages/ui/src/components/context-menu.cjs +1 -1
  17. package/dist/cjs/packages/ui/src/components/context-menu.cjs.map +1 -1
  18. package/dist/cjs/packages/ui/src/components/popover.cjs +1 -1
  19. package/dist/cjs/packages/ui/src/components/popover.cjs.map +1 -1
  20. package/dist/cjs/packages/ui/src/components/sidebar.cjs +1 -1
  21. package/dist/cjs/packages/ui/src/components/sidebar.cjs.map +1 -1
  22. package/dist/cjs/styles/index.css +1 -1
  23. package/dist/esm/components/Button/Button.js +22 -24
  24. package/dist/esm/components/Button/Button.js.map +1 -1
  25. package/dist/esm/components/DatePicker/RangePicker.js +41 -41
  26. package/dist/esm/components/DatePicker/RangePicker.js.map +1 -1
  27. package/dist/esm/components/Input/Input.js +37 -36
  28. package/dist/esm/components/Input/Input.js.map +1 -1
  29. package/dist/esm/components/Table/data-table.js +22 -16
  30. package/dist/esm/components/Table/data-table.js.map +1 -1
  31. package/dist/esm/packages/ui/src/components/alert-dialog.js +7 -7
  32. package/dist/esm/packages/ui/src/components/alert-dialog.js.map +1 -1
  33. package/dist/esm/packages/ui/src/components/calendar.js +1 -1
  34. package/dist/esm/packages/ui/src/components/calendar.js.map +1 -1
  35. package/dist/esm/packages/ui/src/components/combobox.js +1 -1
  36. package/dist/esm/packages/ui/src/components/combobox.js.map +1 -1
  37. package/dist/esm/packages/ui/src/components/context-menu.js +1 -1
  38. package/dist/esm/packages/ui/src/components/context-menu.js.map +1 -1
  39. package/dist/esm/packages/ui/src/components/popover.js +1 -1
  40. package/dist/esm/packages/ui/src/components/popover.js.map +1 -1
  41. package/dist/esm/packages/ui/src/components/sidebar.js +2 -2
  42. package/dist/esm/packages/ui/src/components/sidebar.js.map +1 -1
  43. package/dist/esm/styles/index.css +1 -1
  44. package/dist/types/components/Button/Button.d.ts.map +1 -1
  45. package/dist/types/components/Input/Input.d.ts +1 -0
  46. package/dist/types/components/Input/Input.d.ts.map +1 -1
  47. package/dist/types/components/Table/data-table.d.ts.map +1 -1
  48. package/package.json +1 -1
@@ -1,53 +1,51 @@
1
- import { jsxs as d, Fragment as u, jsx as o } from "react/jsx-runtime";
2
- import h, { useMemo as f } from "react";
3
- import { buttonVariants as p, Button as N } from "../../packages/ui/src/components/button.js";
4
- import { cn as C } from "../../packages/ui/src/lib/utils.js";
5
- import { LoaderCircle as y } from "lucide-react";
6
- import { animationEffect as g } from "../../utils/animations.js";
7
- const v = h.forwardRef(
1
+ import { jsxs as c, Fragment as d, jsx as o } from "react/jsx-runtime";
2
+ import u, { useMemo as h } from "react";
3
+ import { buttonVariants as f, Button as p } from "../../packages/ui/src/components/button.js";
4
+ import { cn as N } from "../../packages/ui/src/lib/utils.js";
5
+ import { LoaderCircle as C } from "lucide-react";
6
+ import { animationEffect as y } from "../../utils/animations.js";
7
+ const g = u.forwardRef(
8
8
  (e, i) => {
9
9
  const {
10
10
  variant: n = "solid",
11
- size: r = "normal",
12
- color: l = "muted",
13
- animation: s,
11
+ size: s = "normal",
12
+ animation: r,
14
13
  ...t
15
- } = e, a = f(() => g({
16
- animation: s,
14
+ } = e, a = h(() => y({
15
+ animation: r,
17
16
  children: t?.children,
18
17
  className: t?.className,
19
- rootClassName: p({
18
+ rootClassName: f({
20
19
  variant: n,
21
- size: r
20
+ size: s
22
21
  }),
23
22
  variantType: n,
24
23
  ...t
25
- }), [s, t, r, n]), m = (a?.children ? !0 : t.asChild) && !t?.isLoading, c = t?.isLoading ? /* @__PURE__ */ d(u, { children: [
26
- /* @__PURE__ */ o(y, { className: "ds:animate-spin" }),
24
+ }), [r, t, s, n]), l = (a?.children ? !0 : t.asChild) && !t?.isLoading, m = t?.isLoading ? /* @__PURE__ */ c(d, { children: [
25
+ /* @__PURE__ */ o(C, { className: "ds:animate-spin" }),
27
26
  a?.children ?? t.children ?? null
28
27
  ] }) : a?.children ?? t.children ?? null;
29
28
  return /* @__PURE__ */ o(
30
- N,
29
+ p,
31
30
  {
32
31
  ref: i,
33
32
  ...t,
34
- className: C(
33
+ className: N(
35
34
  "ds:cursor-pointer ds:group",
36
35
  t?.className,
37
36
  a?.className
38
37
  ),
39
- asChild: m,
38
+ asChild: l,
40
39
  style: { ...t.style || {}, ...a?.style || {} },
41
40
  variant: a?.variant ?? n,
42
- color: l,
43
- size: r,
44
- children: c
41
+ size: s,
42
+ children: m
45
43
  }
46
44
  );
47
45
  }
48
46
  );
49
- v.displayName = "Button";
47
+ g.displayName = "Button";
50
48
  export {
51
- v as default
49
+ g as default
52
50
  };
53
51
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport {\n buttonVariants,\n Button as SButton,\n type ButtonProps as SButtonProps,\n} from \"@dsui/ui/components/button\";\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport type { ButtonAnimation } from \"@/types/variables\";\nimport { LoaderCircle } from \"lucide-react\";\nimport { animationEffect } from \"@/utils/animations\";\n\nexport type ButtonProps = SButtonProps & {\n animation?: ButtonAnimation;\n isLoading?: boolean;\n};\n\ntype AnimResult = {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n variant?: SButtonProps[\"variant\"];\n};\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (props, ref) => {\n const {\n variant = \"solid\",\n size = \"normal\",\n color = \"muted\",\n animation,\n ...rest\n } = props;\n\n const buttonAnimation = useMemo<AnimResult | null>(() => {\n return animationEffect<ButtonAnimation, SButtonProps[\"variant\"]>({\n animation,\n children: rest?.children,\n className: rest?.className,\n rootClassName: buttonVariants({\n variant: variant,\n size: size,\n }),\n variantType: variant,\n ...rest,\n });\n }, [animation, rest, size, variant]);\n\n // Disable asChild when loading to avoid React.Children.only error\n const shouldUseAsChild =\n (buttonAnimation?.children ? true : rest.asChild) && !rest?.isLoading;\n\n const buttonContent = rest?.isLoading ? (\n <>\n <LoaderCircle className=\"ds:animate-spin\" />\n {\n (buttonAnimation?.children ??\n rest.children ??\n null) as SButtonProps[\"children\"]\n }\n </>\n ) : (\n ((buttonAnimation?.children ??\n rest.children ??\n null) as SButtonProps[\"children\"])\n );\n\n return (\n <SButton\n ref={ref}\n {...rest}\n className={cn(\n \"ds:cursor-pointer ds:group\",\n rest?.className,\n buttonAnimation?.className\n )}\n asChild={shouldUseAsChild}\n style={{ ...(rest.style || {}), ...(buttonAnimation?.style || {}) }}\n variant={buttonAnimation?.variant ?? variant}\n color={color}\n size={size}\n >\n {buttonContent}\n </SButton>\n );\n }\n);\n\nButton.displayName = \"Button\";\nexport default Button;\n"],"names":["Button","React","props","ref","variant","size","color","animation","rest","buttonAnimation","useMemo","animationEffect","buttonVariants","shouldUseAsChild","buttonContent","jsxs","Fragment","jsx","LoaderCircle","SButton","cn"],"mappings":";;;;;;AAuBA,MAAM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React, { useMemo } from \"react\";\nimport {\n buttonVariants,\n Button as SButton,\n type ButtonProps as SButtonProps,\n} from \"@dsui/ui/components/button\";\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport type { ButtonAnimation } from \"@/types/variables\";\nimport { LoaderCircle } from \"lucide-react\";\nimport { animationEffect } from \"@/utils/animations\";\n\nexport type ButtonProps = SButtonProps & {\n animation?: ButtonAnimation;\n isLoading?: boolean;\n};\n\ntype AnimResult = {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n variant?: SButtonProps[\"variant\"];\n};\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (props, ref) => {\n const {\n variant = \"solid\",\n size = \"normal\",\n animation,\n ...rest\n } = props;\n\n const buttonAnimation = useMemo<AnimResult | null>(() => {\n return animationEffect<ButtonAnimation, SButtonProps[\"variant\"]>({\n animation,\n children: rest?.children,\n className: rest?.className,\n rootClassName: buttonVariants({\n variant: variant,\n size: size,\n }),\n variantType: variant,\n ...rest,\n });\n }, [animation, rest, size, variant]);\n\n // Disable asChild when loading to avoid React.Children.only error\n const shouldUseAsChild =\n (buttonAnimation?.children ? true : rest.asChild) && !rest?.isLoading;\n\n const buttonContent = rest?.isLoading ? (\n <>\n <LoaderCircle className=\"ds:animate-spin\" />\n {\n (buttonAnimation?.children ??\n rest.children ??\n null) as SButtonProps[\"children\"]\n }\n </>\n ) : (\n ((buttonAnimation?.children ??\n rest.children ??\n null) as SButtonProps[\"children\"])\n );\n\n return (\n <SButton\n ref={ref}\n {...rest}\n className={cn(\n \"ds:cursor-pointer ds:group\",\n rest?.className,\n buttonAnimation?.className\n )}\n asChild={shouldUseAsChild}\n style={{ ...(rest.style || {}), ...(buttonAnimation?.style || {}) }}\n variant={buttonAnimation?.variant ?? variant}\n size={size}\n >\n {buttonContent}\n </SButton>\n );\n }\n);\n\nButton.displayName = \"Button\";\nexport default Button;\n"],"names":["Button","React","props","ref","variant","size","animation","rest","buttonAnimation","useMemo","animationEffect","bu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@@
1
- import { jsxs as N, jsx as c } from "react/jsx-runtime";
1
+ import { jsxs as T, jsx as c } from "react/jsx-runtime";
2
2
  import * as D from "react";
3
- import { Calendar as Vo } from "../../packages/ui/src/components/calendar.js";
4
- import { Popover as Co, PopoverTrigger as Po, PopoverContent as So } from "../../packages/ui/src/components/popover.js";
3
+ import { Calendar as Co } from "../../packages/ui/src/components/calendar.js";
4
+ import { Popover as Vo, PopoverTrigger as Po, PopoverContent as So } from "../../packages/ui/src/components/popover.js";
5
5
  import { Drawer as ko, DrawerTrigger as Oo, DrawerContent as jo, DrawerHeader as Lo, DrawerTitle as Eo, DrawerDescription as $o } from "../../packages/ui/src/components/drawer.js";
6
6
  import "@radix-ui/react-slot";
7
7
  import "../../packages/ui/src/components/button.js";
@@ -74,12 +74,12 @@ function Et({
74
74
  label: p,
75
75
  value: d,
76
76
  placeholder: v,
77
- onChange: T,
77
+ onChange: R,
78
78
  onSelect: m,
79
79
  calendarClassName: lo,
80
80
  side: uo = "bottom",
81
81
  align: go = "end",
82
- format: C = "dd/MM/yyyy",
82
+ format: V = "dd/MM/yyyy",
83
83
  language: po = "vi",
84
84
  mask: j,
85
85
  closeOnSelect: wo = !1,
@@ -100,7 +100,7 @@ function Et({
100
100
  }) {
101
101
  const eo = D.useId();
102
102
  let l, $;
103
- typeof C == "string" ? (l = C, $ = C) : (l = C.input, $ = C.output);
103
+ typeof V == "string" ? (l = V, $ = V) : (l = V.input, $ = V.output);
104
104
  let A;
105
105
  j === !0 ? A = Wo(l) : typeof j == "string" && (A = j);
106
106
  const ro = d?.from ? y(d.from, l) : void 0, zo = d?.to ? y(d.to, l) : void 0, Mo = {
@@ -108,15 +108,15 @@ function Et({
108
108
  to: zo
109
109
  }, [so, k] = D.useState(!1), [s, f] = D.useState(Mo), [Fo, B] = D.useState(
110
110
  ro || /* @__PURE__ */ new Date()
111
- ), [I, h] = D.useState(d?.from || ""), [x, b] = D.useState(d?.to || ""), [U, Y] = D.useState(void 0), [_, K] = D.useState(void 0), q = D.useRef(null), G = D.useRef(null), Ro = !!(I.trim() || x.trim()), J = L?.locale ? L?.locale : po === "en" ? _o : Ko, e = (o) => {
111
+ ), [I, h] = D.useState(d?.from || ""), [x, b] = D.useState(d?.to || ""), [U, Y] = D.useState(void 0), [_, K] = D.useState(void 0), q = D.useRef(null), G = D.useRef(null), No = !!(I.trim() || x.trim()), J = L?.locale ? L?.locale : po === "en" ? _o : Ko, e = (o) => {
112
112
  if (!o) return "";
113
113
  let t = Qo(o, $, J);
114
114
  return z && (t += ` ${O(o, w)}`), t;
115
- }, To = (o) => {
115
+ }, Ro = (o) => {
116
116
  f(o);
117
117
  const t = e(o?.from), r = e(o?.to);
118
118
  h(t), b(r), m?.(o, { from: t, to: r });
119
- }, No = (o) => {
119
+ }, To = (o) => {
120
120
  if (h(o), o.trim() === "") {
121
121
  h(""), b("");
122
122
  const u = { from: void 0, to: void 0 };
@@ -170,7 +170,7 @@ function Et({
170
170
  f(r), h(e(t)), m?.(r, {
171
171
  from: e(t),
172
172
  to: e(s?.to)
173
- }), T?.(r, {
173
+ }), R?.(r, {
174
174
  from: e(t),
175
175
  to: e(s?.to)
176
176
  });
@@ -192,7 +192,7 @@ function Et({
192
192
  f(r), b(e(t)), m?.(r, {
193
193
  from: e(s?.from),
194
194
  to: e(t)
195
- }), T?.(r, {
195
+ }), R?.(r, {
196
196
  from: e(s?.from),
197
197
  to: e(t)
198
198
  });
@@ -201,10 +201,10 @@ function Et({
201
201
  fromValue: I,
202
202
  toValue: x,
203
203
  range: s,
204
- onSelect: To,
205
- onFromChange: No,
204
+ onSelect: Ro,
205
+ onFromChange: To,
206
206
  onToChange: Ho
207
- }) : /* @__PURE__ */ N(
207
+ }) : /* @__PURE__ */ T(
208
208
  Go,
209
209
  {
210
210
  variant: "ghost",
@@ -224,13 +224,13 @@ function Et({
224
224
  /* @__PURE__ */ c("span", { className: "ds:sr-only", children: "Select date range" })
225
225
  ]
226
226
  }
227
- ), io = /* @__PURE__ */ N(
227
+ ), io = /* @__PURE__ */ T(
228
228
  "div",
229
229
  {
230
230
  className: H("ds:flex ds:items-stretch", z && !to ? "ds:gap-0" : ""),
231
231
  children: [
232
232
  !to && /* @__PURE__ */ c(
233
- Vo,
233
+ Co,
234
234
  {
235
235
  ...L,
236
236
  mode: "range",
@@ -269,7 +269,7 @@ function Et({
269
269
  h(r), b(u), m?.(t, {
270
270
  from: r,
271
271
  to: u
272
- }), T?.(t, {
272
+ }), R?.(t, {
273
273
  from: r,
274
274
  to: u
275
275
  }), wo && t?.from && t?.to && !z && k(!1);
@@ -289,7 +289,7 @@ function Et({
289
289
  )
290
290
  }
291
291
  ),
292
- z && /* @__PURE__ */ N("div", { className: "ds:flex ds:gap-0 ds:border-l ds:border-border", children: [
292
+ z && /* @__PURE__ */ T("div", { className: "ds:flex ds:gap-0 ds:border-l ds:border-border", children: [
293
293
  /* @__PURE__ */ c(
294
294
  co,
295
295
  {
@@ -320,7 +320,7 @@ function Et({
320
320
  ] })
321
321
  ]
322
322
  }
323
- ), Q = /* @__PURE__ */ N(Co, { open: so, onOpenChange: k, children: [
323
+ ), Q = /* @__PURE__ */ T(Vo, { open: so, onOpenChange: k, children: [
324
324
  /* @__PURE__ */ c(Po, { asChild: !0, disabled: n.disabled, children: no }),
325
325
  /* @__PURE__ */ c(
326
326
  So,
@@ -334,9 +334,9 @@ function Et({
334
334
  children: io
335
335
  }
336
336
  )
337
- ] }), W = /* @__PURE__ */ N(ko, { open: so, onOpenChange: k, children: [
337
+ ] }), W = /* @__PURE__ */ T(ko, { open: so, onOpenChange: k, children: [
338
338
  /* @__PURE__ */ c(Oo, { asChild: !0, children: no }),
339
- /* @__PURE__ */ N(
339
+ /* @__PURE__ */ T(
340
340
  jo,
341
341
  {
342
342
  className: H(
@@ -344,7 +344,7 @@ function Et({
344
344
  "ds:backdrop-blur ds:bg-background"
345
345
  ),
346
346
  children: [
347
- /* @__PURE__ */ N(Lo, { className: "ds:sr-only", children: [
347
+ /* @__PURE__ */ T(Lo, { className: "ds:sr-only", children: [
348
348
  /* @__PURE__ */ c(Eo, { children: "Select date range" }),
349
349
  /* @__PURE__ */ c($o, { children: "Set your date range" })
350
350
  ] }),
@@ -365,9 +365,9 @@ function Et({
365
365
  ref: i ? q : G,
366
366
  id: eo,
367
367
  size: n.isFloatLabel ? n.size ? n.size : "xl" : n.size,
368
- className: H(
369
- n.className,
370
- "ds:relative ds:peer ds:border-0 ds:focus:ring-0 ds:rounded-none ds:hover:bg-transparent ds:active:bg-transparent ds:focus-visible:ring-0 ds:focus-visible:border-0",
368
+ className: n.className,
369
+ inputClassName: H(
370
+ "ds:border-0 ds:focus:ring-0 ds:rounded-none ds:hover:bg-transparent ds:active:bg-transparent ds:focus-visible:ring-0 ds:focus-visible:border-0 ds:shadow-none",
371
371
  i ? "ds:pr-0" : ""
372
372
  ),
373
373
  label: n.isFloatLabel && typeof p == "object" ? i ? p?.from || "" : p?.to || "" : "",
@@ -380,26 +380,26 @@ function Et({
380
380
  if (r(M), M.trim() === "") {
381
381
  h(""), b("");
382
382
  const F = { from: void 0, to: void 0 };
383
- f(F), m?.(F, F), T?.(F, F);
383
+ f(F), m?.(F, F), R?.(F, F);
384
384
  return;
385
385
  }
386
386
  let g;
387
387
  z ? g = y(M, `${l} ${w}`) : g = y(M, l);
388
- const V = i ? { from: g, to: s?.to } : { from: s?.from, to: g };
388
+ const C = i ? { from: g, to: s?.to } : { from: s?.from, to: g };
389
389
  if (g) {
390
- f(V), i && B(g), i ? Y(g) : K(g);
390
+ f(C), i && B(g), i ? Y(g) : K(g);
391
391
  const F = e(
392
392
  i ? g : s?.from
393
393
  ), mo = e(i ? s?.to : g);
394
- m?.(V, { from: F, to: mo }), T?.(V, {
394
+ m?.(C, { from: F, to: mo }), R?.(C, {
395
395
  from: i ? M : I,
396
396
  to: i ? x : M
397
397
  });
398
398
  } else
399
- m?.(V, {
399
+ m?.(C, {
400
400
  from: e(s?.from),
401
401
  to: i ? e(s?.to) : void 0
402
- }), T?.(V, {
402
+ }), R?.(C, {
403
403
  from: e(s?.from),
404
404
  to: i ? e(s?.to) : void 0
405
405
  });
@@ -407,25 +407,25 @@ function Et({
407
407
  onClear: i ? void 0 : () => {
408
408
  h(""), b("");
409
409
  const a = { from: void 0, to: void 0 };
410
- f(a), m?.(a, a), T?.(a, a);
410
+ f(a), m?.(a, a), R?.(a, a);
411
411
  },
412
412
  onBlur: () => {
413
413
  const a = document.activeElement;
414
414
  a !== q.current && a !== G.current && setTimeout(() => {
415
415
  const M = document.activeElement;
416
416
  if (M !== q.current && M !== G.current) {
417
- const g = (R) => {
418
- if (R.trim() === "") return !0;
417
+ const g = (N) => {
418
+ if (N.trim() === "") return !0;
419
419
  let X;
420
- return z ? X = y(R, `${l} ${w}`) : X = y(R, l), !!X;
421
- }, V = g(I), F = g(x);
422
- if (!V || !F || I.trim() && !x.trim() || !I.trim() && x.trim()) {
420
+ return z ? X = y(N, `${l} ${w}`) : X = y(N, l), !!X;
421
+ }, C = g(I), F = g(x);
422
+ if (!C || !F || I.trim() && !x.trim() || !I.trim() && x.trim()) {
423
423
  h(""), b("");
424
- const R = {
424
+ const N = {
425
425
  from: void 0,
426
426
  to: void 0
427
427
  };
428
- f(R), m?.(R, R), T?.(R, R);
428
+ f(N), m?.(N, N), R?.(N, N);
429
429
  }
430
430
  }
431
431
  }, 100);
@@ -436,7 +436,7 @@ function Et({
436
436
  }
437
437
  );
438
438
  };
439
- return /* @__PURE__ */ N(
439
+ return /* @__PURE__ */ T(
440
440
  "div",
441
441
  {
442
442
  className: H(
@@ -469,7 +469,7 @@ function Et({
469
469
  size: n.size,
470
470
  infoTooltip: n.infoTooltip,
471
471
  className: "ds:z-10",
472
- shouldFloat: Ro,
472
+ shouldFloat: No,
473
473
  children: p
474
474
  }
475
475
  )
@@ -1 +1 @@
1
- {"version":3,"file":"RangePicker.js","sources":["../../../../src/components/DatePicker/RangePicker.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n CalendarDayButton as SCalendarDayButton,\n type CalendarDayButtonProps as SCalendarDayButtonProps,\n Calendar,\n type CalendarColor,\n} from \"@dsui/ui/components/calendar\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@dsui/ui/components/popover\";\nimport {\n Drawer,\n DrawerContent,\n DrawerDescription,\n DrawerHeader,\n DrawerTitle,\n DrawerTrigger,\n} from \"@dsui/ui/components/drawer\";\nimport { cn } from \"@dsui/ui/index\";\nimport { Input, type InputProps } from \"../Input\";\nimport { Button } from \"../Button\";\nimport { TimePicker } from \"./TimePicker\";\nimport { type DatePickerProps } from \"./DatePicker\";\nimport { CalendarIcon, MoveRight } from \"lucide-react\";\nimport { isMobile } from \"react-device-detect\";\nimport { format as dfFormat, parse, isValid, type Locale } from \"date-fns\";\nimport { vi, enUS } from \"date-fns/locale\";\nimport { DATE_FORMAT } from \"@/constants/common\";\nimport { FloatingLabel } from \"@/components/FloatLabel\";\n\nexport type DateRange = {\n from?: Date | undefined;\n to?: Date | undefined;\n};\n\nexport type DateRangeText = { from?: string; to?: string } | null;\n\nfunction formatDate(\n date: Date | undefined,\n outputFormat: string = DATE_FORMAT,\n locale?: Locale\n) {\n if (!date) return \"\";\n\n return dfFormat(date, outputFormat, locale ? { locale } : undefined);\n}\n\nconst parseDate = (\n str: string,\n inputFormat: string = DATE_FORMAT\n): Date | undefined => {\n const date = parse(str, inputFormat, new Date());\n return isValid(date) ? date : undefined;\n};\n\nfunction generateMaskFromFormat(format: string): string {\n return format\n .replace(/dd|MM|yyyy/g, (match) => {\n switch (match) {\n case \"dd\":\n case \"MM\":\n return \"99\";\n case \"yyyy\":\n return \"9999\";\n default:\n return match;\n }\n })\n .replace(/d|M|y/g, (match) => {\n switch (match) {\n case \"d\":\n case \"M\":\n return \"9\";\n case \"y\":\n return \"9\";\n default:\n return match;\n }\n });\n}\n\nexport type FormatType = string | { input: string; output: string };\n\nexport type RangePickerRenderProps = {\n fromValue: string;\n toValue: string;\n range?: DateRange;\n onSelect: (range?: DateRange) => void;\n onFromChange: (text: string) => void;\n onToChange: (text: string) => void;\n};\n\nexport type TimeConfig = Omit<\n React.ComponentProps<typeof TimePicker>,\n \"value\" | \"onSelect\" | \"format\"\n>;\n\nexport type RangePickerProps = Omit<\n DatePickerProps,\n \"value\" | \"onChange\" | \"onSelect\" | \"children\" | \"label\" | \"placeholder\"\n> & {\n label?: string | DateRangeText;\n placeholder?: string | DateRangeText;\n value?: DateRangeText;\n onChange?: (value?: DateRange, text?: DateRangeText) => void;\n onSelect?: (value?: DateRange, text?: DateRangeText) => void;\n children?: (props: RangePickerRenderProps) => React.ReactNode;\n separator?: React.ReactNode;\n timeConfig?: [TimeConfig, TimeConfig];\n numberOfMonths?: number;\n variant?: \"default\" | \"rounded\";\n color?: CalendarColor;\n};\n\nexport function RangePicker({\n label,\n value,\n placeholder,\n onChange,\n onSelect,\n calendarClassName,\n side = \"bottom\",\n align = \"end\",\n format = \"dd/MM/yyyy\",\n language = \"vi\",\n mask,\n closeOnSelect = false,\n showOutsideDays = true,\n calendarConfig,\n timeConfig,\n desktopMode = \"popover\",\n mobileMode = \"drawer\",\n children,\n separator = <MoveRight className=\"ds:size-5\" />,\n showTime = false,\n timeFormat = \"HH:mm\",\n hideDate = false,\n numberOfMonths = 1,\n variant = \"default\",\n color = \"primary\",\n ...props\n}: RangePickerProps) {\n const inputId = React.useId();\n\n let inputFormat: string;\n let outputFormat: string;\n if (typeof format === \"string\") {\n inputFormat = format;\n outputFormat = format;\n } else {\n inputFormat = format.input;\n outputFormat = format.output;\n }\n\n // Determine the mask to use\n let maskToUse: string | undefined;\n if (mask === true) {\n maskToUse = generateMaskFromFormat(inputFormat);\n } else if (typeof mask === \"string\") {\n maskToUse = mask;\n }\n\n const initialFromDate = value?.from\n ? parseDate(value.from, inputFormat)\n : undefined;\n const initialToDate = value?.to\n ? parseDate(value.to, inputFormat)\n : undefined;\n const initialRange: DateRange = {\n from: initialFromDate,\n to: initialToDate,\n };\n\n const [open, setOpen] = React.useState(false);\n const [range, setRange] = React.useState<DateRange | undefined>(initialRange);\n const [month, setMonth] = React.useState<Date | undefined>(\n initialFromDate || new Date()\n );\n const [fromInputValue, setFromInputValue] = React.useState(value?.from || \"\");\n const [toInputValue, setToInputValue] = React.useState(value?.to || \"\");\n const [fromTime, setFromTime] = React.useState<Date | undefined>(undefined);\n const [toTime, setToTime] = React.useState<Date | undefined>(undefined);\n const fromInputRef = React.useRef<HTMLInputElement>(null);\n const toInputRef = React.useRef<HTMLInputElement>(null);\n\n const shouldFloat = !!(fromInputValue.trim() || toInputValue.trim());\n\n const _locale: Locale = calendarConfig?.locale\n ? (calendarConfig?.locale as Locale)\n : language === \"en\"\n ? enUS\n : vi;\n\n // Helper to format date-time based on showTime and timeFormat\n const formatDateTimeValue = (d: Date | undefined): string => {\n if (!d) return \"\";\n let result = formatDate(d, outputFormat, _locale);\n if (showTime) {\n result += ` ${dfFormat(d, timeFormat)}`;\n }\n return result;\n };\n\n // Helper functions for render props\n const handleSelectForRenderProp = (range?: DateRange) => {\n setRange(range);\n const fromFormatted = formatDateTimeValue(range?.from);\n const toFormatted = formatDateTimeValue(range?.to);\n setFromInputValue(fromFormatted);\n setToInputValue(toFormatted);\n onSelect?.(range, { from: fromFormatted, to: toFormatted });\n };\n\n const handleFromChangeForRenderProp = (text: string) => {\n setFromInputValue(text);\n\n // If the input is cleared (empty), clear both fields\n if (text.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let parsedDate: Date | undefined;\n if (showTime) {\n parsedDate = parseDate(text, `${inputFormat} ${timeFormat}`);\n } else {\n parsedDate = parseDate(text, inputFormat);\n }\n const newRange: DateRange = { from: parsedDate, to: range?.to };\n if (parsedDate) {\n setRange(newRange);\n setMonth(parsedDate);\n setFromTime(parsedDate);\n onSelect?.(newRange, {\n from: formatDateTimeValue(parsedDate),\n to: formatDateTimeValue(range?.to),\n });\n } else {\n setRange(newRange);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(range?.to),\n });\n }\n };\n\n const handleToChangeForRenderProp = (text: string) => {\n setToInputValue(text);\n\n // If the input is cleared (empty), clear both fields\n if (text.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let parsedDate: Date | undefined;\n if (showTime) {\n parsedDate = parseDate(text, `${inputFormat} ${timeFormat}`);\n } else {\n parsedDate = parseDate(text, inputFormat);\n }\n const newRange: DateRange = {\n from: range?.from,\n to: parsedDate,\n };\n if (parsedDate) {\n setRange(newRange);\n setToTime(parsedDate);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(parsedDate),\n });\n } else {\n setRange(newRange);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: undefined,\n });\n }\n };\n\n const handleTimeChangeFrom = (date?: Date) => {\n if (date) {\n setFromTime(date);\n // Merge: keep date (year, month, day) from existing range.from, take time (hours, minutes, seconds) from TimePicker\n const mergedDate = new Date(range?.from || new Date());\n mergedDate.setHours(\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n 0\n );\n\n const newRange: DateRange = {\n from: mergedDate,\n to: range?.to,\n };\n setRange(newRange);\n setFromInputValue(formatDateTimeValue(mergedDate));\n onSelect?.(newRange, {\n from: formatDateTimeValue(mergedDate),\n to: formatDateTimeValue(range?.to),\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(mergedDate),\n to: formatDateTimeValue(range?.to),\n });\n }\n };\n\n const handleTimeChangeTo = (date?: Date) => {\n if (date) {\n setToTime(date);\n // Merge: keep date (year, month, day) from existing range.to, take time (hours, minutes, seconds) from TimePicker\n const mergedDate = new Date(range?.to || new Date());\n mergedDate.setHours(\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n 0\n );\n\n const newRange: DateRange = {\n from: range?.from,\n to: mergedDate,\n };\n setRange(newRange);\n setToInputValue(formatDateTimeValue(mergedDate));\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(mergedDate),\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(mergedDate),\n });\n }\n };\n\n // Determine trigger component\n const triggerComponent = children ? (\n children({\n fromValue: fromInputValue,\n toValue: toInputValue,\n range,\n onSelect: handleSelectForRenderProp,\n onFromChange: handleFromChangeForRenderProp,\n onToChange: handleToChangeForRenderProp,\n })\n ) : (\n <Button\n variant=\"ghost\"\n className=\"ds:!p-1 ds:!leading-0 ds:h-auto ds:rounded ds:hover:bg-accent ds:transition-colors\"\n size={props?.size}\n >\n <CalendarIcon\n className={cn({\n \"ds:size-3\": props.size === \"xs\" || props.size === \"sm\",\n \"ds:size-3.5\": !props.size || props.size === \"normal\",\n \"ds:size-4\": props.size === \"lg\" || props.size === \"xl\",\n })}\n />\n <span className=\"ds:sr-only\">Select date range</span>\n </Button>\n );\n\n const calendarSelection = (\n <div\n className={cn(\"ds:flex ds:items-stretch\", showTime && !hideDate ? \"ds:gap-0\" : \"\")}\n >\n {!hideDate && (\n <Calendar\n {...calendarConfig}\n mode=\"range\"\n selected={range as any}\n captionLayout=\"dropdown\"\n month={month}\n onMonthChange={setMonth}\n numberOfMonths={isMobile ? 1 : numberOfMonths || 1}\n variant={variant}\n color={color}\n onSelect={(selectedRange) => {\n // Preserve time from TimePicker values if showTime is enabled\n let preservedRange = selectedRange;\n if (showTime) {\n // Get current time from TimePicker state\n const fromTimeObj = fromTime;\n const toTimeObj = toTime;\n\n preservedRange = {\n from: selectedRange?.from\n ? new Date(\n selectedRange.from.getFullYear(),\n selectedRange.from.getMonth(),\n selectedRange.from.getDate(),\n fromTimeObj?.getHours() || 0,\n fromTimeObj?.getMinutes() || 0,\n fromTimeObj?.getSeconds() || 0\n )\n : undefined,\n to: selectedRange?.to\n ? new Date(\n selectedRange.to.getFullYear(),\n selectedRange.to.getMonth(),\n selectedRange.to.getDate(),\n toTimeObj?.getHours() || 0,\n toTimeObj?.getMinutes() || 0,\n toTimeObj?.getSeconds() || 0\n )\n : undefined,\n };\n }\n setRange(preservedRange);\n const fromFormatted = formatDateTimeValue(preservedRange?.from);\n const toFormatted = formatDateTimeValue(preservedRange?.to);\n setFromInputValue(fromFormatted);\n setToInputValue(toFormatted);\n onSelect?.(preservedRange, {\n from: fromFormatted,\n to: toFormatted,\n });\n onChange?.(preservedRange, {\n from: fromFormatted,\n to: toFormatted,\n });\n if (\n closeOnSelect &&\n preservedRange?.from &&\n preservedRange?.to &&\n !showTime\n ) {\n setOpen(false);\n }\n }}\n locale={_locale}\n formatters={{\n formatMonthDropdown: (date) =>\n date.toLocaleString(_locale.code, { month: \"short\" }),\n }}\n showOutsideDays={showOutsideDays}\n className={cn(\n \"ds:mx-auto\",\n {\n \"ds:[--cell-size:clamp(0px,calc(100vw/7.5),52px)] ds:mb-8 ds:bg-transparent\":\n isMobile || desktopMode === \"drawer\",\n \"ds:[--cell-size:clamp(0px,calc(100vw/7.5),34px)]\":\n !isMobile && desktopMode !== \"drawer\",\n },\n calendarClassName\n )}\n />\n )}\n {showTime && (\n <div className=\"ds:flex ds:gap-0 ds:border-l ds:border-border\">\n <TimePicker\n {...timeConfig?.[0]}\n value={fromTime ? dfFormat(fromTime, timeFormat) : undefined}\n onSelect={handleTimeChangeFrom}\n format={timeFormat}\n showHours\n showMinutes\n showSeconds={timeFormat === \"HH:mm:ss\"}\n standalone={false}\n />\n <div className=\"ds:border-l ds:border-border\" />\n <TimePicker\n {...timeConfig?.[1]}\n value={toTime ? dfFormat(toTime, timeFormat) : undefined}\n onSelect={handleTimeChangeTo}\n format={timeFormat}\n showHours\n showMinutes\n showSeconds={timeFormat === \"HH:mm:ss\"}\n standalone={false}\n />\n </div>\n )}\n </div>\n );\n\n const popPicker = (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild disabled={props.disabled}>\n {triggerComponent}\n </PopoverTrigger>\n <PopoverContent\n className={cn(\n \"ds:w-auto ds:overflow-hidden ds:p-0\",\n \"ds:backdrop-blur ds:bg-background/50\"\n )}\n side={side}\n align={align}\n >\n {calendarSelection}\n </PopoverContent>\n </Popover>\n );\n\n const drawPicker = (\n <Drawer open={open} onOpenChange={setOpen}>\n <DrawerTrigger asChild>{triggerComponent}</DrawerTrigger>\n <DrawerContent\n className={cn(\n \"ds:w-auto ds:overflow-hidden ds:p-0\",\n \"ds:backdrop-blur ds:bg-background\"\n )}\n >\n <DrawerHeader className=\"ds:sr-only\">\n <DrawerTitle>Select date range</DrawerTitle>\n <DrawerDescription>Set your date range</DrawerDescription>\n </DrawerHeader>\n {calendarSelection}\n </DrawerContent>\n </Drawer>\n );\n\n // If children is provided, use render prop pattern with picker\n if (children) {\n const mode = isMobile ? mobileMode : desktopMode;\n return mode === \"drawer\" ? drawPicker : popPicker;\n }\n\n // Helper function to render range input\n const renderRangeInput = (\n type: \"from\" | \"to\",\n inputValue: string,\n setInputValue: (value: string) => void,\n additionalProps?: Partial<InputProps>\n ) => {\n const isFrom = type === \"from\";\n\n return (\n <Input\n {...props}\n {...additionalProps}\n ref={isFrom ? fromInputRef : toInputRef}\n id={inputId}\n size={\n props.isFloatLabel ? (props.size ? props.size : \"xl\") : props.size\n }\n className={cn(\n props.className,\n \"ds:relative ds:peer ds:border-0 ds:focus:ring-0 ds:rounded-none ds:hover:bg-transparent ds:active:bg-transparent ds:focus-visible:ring-0 ds:focus-visible:border-0\",\n isFrom ? \"ds:pr-0\" : \"\"\n )}\n label={\n props.isFloatLabel && typeof label === \"object\"\n ? isFrom\n ? label?.from || \"\"\n : label?.to || \"\"\n : \"\"\n }\n placeholder={\n typeof placeholder === \"object\"\n ? isFrom\n ? placeholder?.from || \"\"\n : placeholder?.to || \"\"\n : placeholder\n }\n clearable={!isFrom}\n value={inputValue}\n mask={maskToUse}\n onChange={(e) => {\n const inputValue = e.target.value;\n setInputValue(inputValue);\n\n // If the input is cleared (empty), clear both fields\n if (inputValue.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let date: Date | undefined;\n if (showTime) {\n date = parseDate(inputValue, `${inputFormat} ${timeFormat}`);\n } else {\n date = parseDate(inputValue, inputFormat);\n }\n const newRange: DateRange = isFrom\n ? { from: date, to: range?.to }\n : { from: range?.from, to: date };\n\n if (date) {\n setRange(newRange);\n if (isFrom) setMonth(date);\n // Update time state if time was parsed\n if (isFrom) {\n setFromTime(date);\n // setFromInputValue(formatDateTimeValue(date)); // Sync input value\n } else {\n setToTime(date);\n // setToInputValue(formatDateTimeValue(date)); // Sync input value\n }\n const fromFormatted = formatDateTimeValue(\n isFrom ? date : range?.from\n );\n const toFormatted = formatDateTimeValue(isFrom ? range?.to : date);\n onSelect?.(newRange, { from: fromFormatted, to: toFormatted });\n onChange?.(newRange, {\n from: isFrom ? inputValue : fromInputValue,\n to: isFrom ? toInputValue : inputValue,\n });\n\n // If from input and date is valid, auto-focus to to input if to is empty\n // if (isFrom && toInputRef.current && !toInputValue.trim()) {\n // requestAnimationFrame(() => toInputRef.current?.focus());\n // }\n } else {\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: isFrom ? formatDateTimeValue(range?.to) : undefined,\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: isFrom ? formatDateTimeValue(range?.to) : undefined,\n });\n }\n }}\n onClear={\n !isFrom\n ? () => {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n }\n : undefined\n }\n onBlur={() => {\n // Check if blurring out of the entire range picker group\n const activeElement = document.activeElement;\n if (\n activeElement !== fromInputRef.current &&\n activeElement !== toInputRef.current\n ) {\n // Delay validation by 100ms\n setTimeout(() => {\n // Check again if still blurred out of the group\n const currentActiveElement = document.activeElement;\n if (\n currentActiveElement !== fromInputRef.current &&\n currentActiveElement !== toInputRef.current\n ) {\n // Blurred out of the group, validate both inputs\n const validateInput = (val: string) => {\n if (val.trim() === \"\") return true; // empty is valid (will clear)\n let parsed: Date | undefined;\n if (showTime) {\n parsed = parseDate(val, `${inputFormat} ${timeFormat}`);\n } else {\n parsed = parseDate(val, inputFormat);\n }\n return !!parsed;\n };\n\n const fromValid = validateInput(fromInputValue);\n const toValid = validateInput(toInputValue);\n\n // Clear if either is invalid, or if only one has value\n const shouldClear =\n !fromValid ||\n !toValid ||\n (fromInputValue.trim() && !toInputValue.trim()) ||\n (!fromInputValue.trim() && toInputValue.trim());\n\n if (shouldClear) {\n // If either is invalid, clear both\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = {\n from: undefined,\n to: undefined,\n };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n }\n }\n }, 100);\n }\n }}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setOpen(true);\n }\n }}\n />\n );\n };\n\n // Default input rendering with two inputs\n return (\n <div\n className={cn(\n \"ds:group ds:relative ds:flex ds:items-center ds:border ds:rounded-md ds:focus-within:ring-2 ds:focus-within:ring-offset-2 ds:bg-background ds:transition-[color,box-shadow]\",\n {\n \"ds:border-input ds:focus-within:ring-ring\": !props.state,\n \"ds:border-success ds:focus-within:ring-success\": props.state === \"success\",\n \"ds:border-warning ds:focus-within:ring-warning\": props.state === \"warning\",\n \"ds:border-error ds:focus-within:ring-error\": props.state === \"error\",\n }\n )}\n >\n {renderRangeInput(\"from\", fromInputValue, setFromInputValue)}\n <span\n className={cn(\"ds:text-muted-foreground ds:select-none ds:pl-2\", {\n \"ds:opacity-30\": props.disabled,\n })}\n >\n {separator}\n </span>\n {renderRangeInput(\"to\", toInputValue, setToInputValue, {\n suffixIcon: isMobile\n ? mobileMode === \"drawer\"\n ? drawPicker\n : popPicker\n : desktopMode === \"drawer\"\n ? drawPicker\n : popPicker,\n })}\n {props.isFloatLabel && typeof label === \"string\" && (\n <FloatingLabel\n htmlFor={inputId}\n size={props.size}\n infoTooltip={props.infoTooltip}\n className=\"ds:z-10\"\n shouldFloat={shouldFloat}\n >\n {label}\n </FloatingLabel>\n )}\n </div>\n );\n}\n"],"names":["formatDate","date","outputFormat","DATE_FORMAT","locale","dfFormat","parseDate","str","inputFormat","parse","isValid","generateMaskFromFormat","format","match","RangePicker","label","value","placeholder","onChange","onSelect","calendarClassName","side","align","language","mask","closeOnSelect","showOutsideDays","calendarConfig","timeConfig","desktopMode","mobileMode","children","separator","jsx","MoveRight","showTime","timeFormat","hideDate","numberOfMonths","variant","color","props","inputId","React","maskToUse","initialFromDate","initialToDate","initialRange","open","setOpen","range","setRange","month","setMonth","fromInputValue","setFromInputValue","toInputValue","setToInputValue","fromTime","setFromTime","toTime","setToTime","fromInputRef","toInputRef","shouldFloat","_locale","enUS","vi","formatDateTimeValue","d","result","handleSelectForRenderProp","fromFormatted","toFormatted","handleFromChangeForRenderProp","text","newRange","parsedDate","handleToChangeForRenderProp","handleTimeChangeFrom","mergedDate","handleTimeChangeTo","triggerComponent","jsxs","Button","CalendarIcon","cn","calendarSelection","Calendar","isMobile","selectedRange","preservedRange","fromTimeObj","toTimeObj","TimePicker","popPicker","Popover","PopoverTrigger","PopoverContent","drawPicker","Drawer","DrawerTrigger","DrawerContent","DrawerHeader","DrawerTitle","DrawerDescription","renderRangeInput","type","inputValue","setInputValue","additionalProps","isFrom","Input","e","activeElement","currentActiveElement","validateInput","val","parsed","fromValid","toValid","FloatingLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAAA,YAAA,CACxB;AAAA,YAEA,UAAAT;AAAA,UAAA;AAAA,QAAA;AAAA,QAEF0E,GAAiB,MAAMlD,GAAcC,GAAiB;AAAA,UACrD,YAAYgC,IACR3D,OAAe,WACbqE,IACAJ,IACFlE,MAAgB,WACdsE,IACAJ;AAAA,QAAA,CACP;AAAA,QACAtD,EAAM,gBAAgB,OAAO1B,KAAU,YACtC,gBAAAkB;AAAA,UAACwF;AAAA,UAAA;AAAA,YACC,SAAS/E;AAAA,YACT,MAAMD,EAAM;AAAA,YACZ,aAAaA,EAAM;AAAA,YACnB,WAAU;AAAA,YACV,aAAAuB;AAAA,YAEC,UAAAjD;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR;"}
1
+ {"version":3,"file":"RangePicker.js","sources":["../../../../src/components/DatePicker/RangePicker.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n CalendarDayButton as SCalendarDayButton,\n type CalendarDayButtonProps as SCalendarDayButtonProps,\n Calendar,\n type CalendarColor,\n} from \"@dsui/ui/components/calendar\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@dsui/ui/components/popover\";\nimport {\n Drawer,\n DrawerContent,\n DrawerDescription,\n DrawerHeader,\n DrawerTitle,\n DrawerTrigger,\n} from \"@dsui/ui/components/drawer\";\nimport { cn } from \"@dsui/ui/index\";\nimport { Input, type InputProps } from \"../Input\";\nimport { Button } from \"../Button\";\nimport { TimePicker } from \"./TimePicker\";\nimport { type DatePickerProps } from \"./DatePicker\";\nimport { CalendarIcon, MoveRight } from \"lucide-react\";\nimport { isMobile } from \"react-device-detect\";\nimport { format as dfFormat, parse, isValid, type Locale } from \"date-fns\";\nimport { vi, enUS } from \"date-fns/locale\";\nimport { DATE_FORMAT } from \"@/constants/common\";\nimport { FloatingLabel } from \"@/components/FloatLabel\";\n\nexport type DateRange = {\n from?: Date | undefined;\n to?: Date | undefined;\n};\n\nexport type DateRangeText = { from?: string; to?: string } | null;\n\nfunction formatDate(\n date: Date | undefined,\n outputFormat: string = DATE_FORMAT,\n locale?: Locale\n) {\n if (!date) return \"\";\n\n return dfFormat(date, outputFormat, locale ? { locale } : undefined);\n}\n\nconst parseDate = (\n str: string,\n inputFormat: string = DATE_FORMAT\n): Date | undefined => {\n const date = parse(str, inputFormat, new Date());\n return isValid(date) ? date : undefined;\n};\n\nfunction generateMaskFromFormat(format: string): string {\n return format\n .replace(/dd|MM|yyyy/g, (match) => {\n switch (match) {\n case \"dd\":\n case \"MM\":\n return \"99\";\n case \"yyyy\":\n return \"9999\";\n default:\n return match;\n }\n })\n .replace(/d|M|y/g, (match) => {\n switch (match) {\n case \"d\":\n case \"M\":\n return \"9\";\n case \"y\":\n return \"9\";\n default:\n return match;\n }\n });\n}\n\nexport type FormatType = string | { input: string; output: string };\n\nexport type RangePickerRenderProps = {\n fromValue: string;\n toValue: string;\n range?: DateRange;\n onSelect: (range?: DateRange) => void;\n onFromChange: (text: string) => void;\n onToChange: (text: string) => void;\n};\n\nexport type TimeConfig = Omit<\n React.ComponentProps<typeof TimePicker>,\n \"value\" | \"onSelect\" | \"format\"\n>;\n\nexport type RangePickerProps = Omit<\n DatePickerProps,\n \"value\" | \"onChange\" | \"onSelect\" | \"children\" | \"label\" | \"placeholder\"\n> & {\n label?: string | DateRangeText;\n placeholder?: string | DateRangeText;\n value?: DateRangeText;\n onChange?: (value?: DateRange, text?: DateRangeText) => void;\n onSelect?: (value?: DateRange, text?: DateRangeText) => void;\n children?: (props: RangePickerRenderProps) => React.ReactNode;\n separator?: React.ReactNode;\n timeConfig?: [TimeConfig, TimeConfig];\n numberOfMonths?: number;\n variant?: \"default\" | \"rounded\";\n color?: CalendarColor;\n};\n\nexport function RangePicker({\n label,\n value,\n placeholder,\n onChange,\n onSelect,\n calendarClassName,\n side = \"bottom\",\n align = \"end\",\n format = \"dd/MM/yyyy\",\n language = \"vi\",\n mask,\n closeOnSelect = false,\n showOutsideDays = true,\n calendarConfig,\n timeConfig,\n desktopMode = \"popover\",\n mobileMode = \"drawer\",\n children,\n separator = <MoveRight className=\"ds:size-5\" />,\n showTime = false,\n timeFormat = \"HH:mm\",\n hideDate = false,\n numberOfMonths = 1,\n variant = \"default\",\n color = \"primary\",\n ...props\n}: RangePickerProps) {\n const inputId = React.useId();\n\n let inputFormat: string;\n let outputFormat: string;\n if (typeof format === \"string\") {\n inputFormat = format;\n outputFormat = format;\n } else {\n inputFormat = format.input;\n outputFormat = format.output;\n }\n\n // Determine the mask to use\n let maskToUse: string | undefined;\n if (mask === true) {\n maskToUse = generateMaskFromFormat(inputFormat);\n } else if (typeof mask === \"string\") {\n maskToUse = mask;\n }\n\n const initialFromDate = value?.from\n ? parseDate(value.from, inputFormat)\n : undefined;\n const initialToDate = value?.to\n ? parseDate(value.to, inputFormat)\n : undefined;\n const initialRange: DateRange = {\n from: initialFromDate,\n to: initialToDate,\n };\n\n const [open, setOpen] = React.useState(false);\n const [range, setRange] = React.useState<DateRange | undefined>(initialRange);\n const [month, setMonth] = React.useState<Date | undefined>(\n initialFromDate || new Date()\n );\n const [fromInputValue, setFromInputValue] = React.useState(value?.from || \"\");\n const [toInputValue, setToInputValue] = React.useState(value?.to || \"\");\n const [fromTime, setFromTime] = React.useState<Date | undefined>(undefined);\n const [toTime, setToTime] = React.useState<Date | undefined>(undefined);\n const fromInputRef = React.useRef<HTMLInputElement>(null);\n const toInputRef = React.useRef<HTMLInputElement>(null);\n\n const shouldFloat = !!(fromInputValue.trim() || toInputValue.trim());\n\n const _locale: Locale = calendarConfig?.locale\n ? (calendarConfig?.locale as Locale)\n : language === \"en\"\n ? enUS\n : vi;\n\n // Helper to format date-time based on showTime and timeFormat\n const formatDateTimeValue = (d: Date | undefined): string => {\n if (!d) return \"\";\n let result = formatDate(d, outputFormat, _locale);\n if (showTime) {\n result += ` ${dfFormat(d, timeFormat)}`;\n }\n return result;\n };\n\n // Helper functions for render props\n const handleSelectForRenderProp = (range?: DateRange) => {\n setRange(range);\n const fromFormatted = formatDateTimeValue(range?.from);\n const toFormatted = formatDateTimeValue(range?.to);\n setFromInputValue(fromFormatted);\n setToInputValue(toFormatted);\n onSelect?.(range, { from: fromFormatted, to: toFormatted });\n };\n\n const handleFromChangeForRenderProp = (text: string) => {\n setFromInputValue(text);\n\n // If the input is cleared (empty), clear both fields\n if (text.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let parsedDate: Date | undefined;\n if (showTime) {\n parsedDate = parseDate(text, `${inputFormat} ${timeFormat}`);\n } else {\n parsedDate = parseDate(text, inputFormat);\n }\n const newRange: DateRange = { from: parsedDate, to: range?.to };\n if (parsedDate) {\n setRange(newRange);\n setMonth(parsedDate);\n setFromTime(parsedDate);\n onSelect?.(newRange, {\n from: formatDateTimeValue(parsedDate),\n to: formatDateTimeValue(range?.to),\n });\n } else {\n setRange(newRange);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(range?.to),\n });\n }\n };\n\n const handleToChangeForRenderProp = (text: string) => {\n setToInputValue(text);\n\n // If the input is cleared (empty), clear both fields\n if (text.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let parsedDate: Date | undefined;\n if (showTime) {\n parsedDate = parseDate(text, `${inputFormat} ${timeFormat}`);\n } else {\n parsedDate = parseDate(text, inputFormat);\n }\n const newRange: DateRange = {\n from: range?.from,\n to: parsedDate,\n };\n if (parsedDate) {\n setRange(newRange);\n setToTime(parsedDate);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(parsedDate),\n });\n } else {\n setRange(newRange);\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: undefined,\n });\n }\n };\n\n const handleTimeChangeFrom = (date?: Date) => {\n if (date) {\n setFromTime(date);\n // Merge: keep date (year, month, day) from existing range.from, take time (hours, minutes, seconds) from TimePicker\n const mergedDate = new Date(range?.from || new Date());\n mergedDate.setHours(\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n 0\n );\n\n const newRange: DateRange = {\n from: mergedDate,\n to: range?.to,\n };\n setRange(newRange);\n setFromInputValue(formatDateTimeValue(mergedDate));\n onSelect?.(newRange, {\n from: formatDateTimeValue(mergedDate),\n to: formatDateTimeValue(range?.to),\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(mergedDate),\n to: formatDateTimeValue(range?.to),\n });\n }\n };\n\n const handleTimeChangeTo = (date?: Date) => {\n if (date) {\n setToTime(date);\n // Merge: keep date (year, month, day) from existing range.to, take time (hours, minutes, seconds) from TimePicker\n const mergedDate = new Date(range?.to || new Date());\n mergedDate.setHours(\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n 0\n );\n\n const newRange: DateRange = {\n from: range?.from,\n to: mergedDate,\n };\n setRange(newRange);\n setToInputValue(formatDateTimeValue(mergedDate));\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(mergedDate),\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: formatDateTimeValue(mergedDate),\n });\n }\n };\n\n // Determine trigger component\n const triggerComponent = children ? (\n children({\n fromValue: fromInputValue,\n toValue: toInputValue,\n range,\n onSelect: handleSelectForRenderProp,\n onFromChange: handleFromChangeForRenderProp,\n onToChange: handleToChangeForRenderProp,\n })\n ) : (\n <Button\n variant=\"ghost\"\n className=\"ds:!p-1 ds:!leading-0 ds:h-auto ds:rounded ds:hover:bg-accent ds:transition-colors\"\n size={props?.size}\n >\n <CalendarIcon\n className={cn({\n \"ds:size-3\": props.size === \"xs\" || props.size === \"sm\",\n \"ds:size-3.5\": !props.size || props.size === \"normal\",\n \"ds:size-4\": props.size === \"lg\" || props.size === \"xl\",\n })}\n />\n <span className=\"ds:sr-only\">Select date range</span>\n </Button>\n );\n\n const calendarSelection = (\n <div\n className={cn(\"ds:flex ds:items-stretch\", showTime && !hideDate ? \"ds:gap-0\" : \"\")}\n >\n {!hideDate && (\n <Calendar\n {...calendarConfig}\n mode=\"range\"\n selected={range as any}\n captionLayout=\"dropdown\"\n month={month}\n onMonthChange={setMonth}\n numberOfMonths={isMobile ? 1 : numberOfMonths || 1}\n variant={variant}\n color={color}\n onSelect={(selectedRange) => {\n // Preserve time from TimePicker values if showTime is enabled\n let preservedRange = selectedRange;\n if (showTime) {\n // Get current time from TimePicker state\n const fromTimeObj = fromTime;\n const toTimeObj = toTime;\n\n preservedRange = {\n from: selectedRange?.from\n ? new Date(\n selectedRange.from.getFullYear(),\n selectedRange.from.getMonth(),\n selectedRange.from.getDate(),\n fromTimeObj?.getHours() || 0,\n fromTimeObj?.getMinutes() || 0,\n fromTimeObj?.getSeconds() || 0\n )\n : undefined,\n to: selectedRange?.to\n ? new Date(\n selectedRange.to.getFullYear(),\n selectedRange.to.getMonth(),\n selectedRange.to.getDate(),\n toTimeObj?.getHours() || 0,\n toTimeObj?.getMinutes() || 0,\n toTimeObj?.getSeconds() || 0\n )\n : undefined,\n };\n }\n setRange(preservedRange);\n const fromFormatted = formatDateTimeValue(preservedRange?.from);\n const toFormatted = formatDateTimeValue(preservedRange?.to);\n setFromInputValue(fromFormatted);\n setToInputValue(toFormatted);\n onSelect?.(preservedRange, {\n from: fromFormatted,\n to: toFormatted,\n });\n onChange?.(preservedRange, {\n from: fromFormatted,\n to: toFormatted,\n });\n if (\n closeOnSelect &&\n preservedRange?.from &&\n preservedRange?.to &&\n !showTime\n ) {\n setOpen(false);\n }\n }}\n locale={_locale}\n formatters={{\n formatMonthDropdown: (date) =>\n date.toLocaleString(_locale.code, { month: \"short\" }),\n }}\n showOutsideDays={showOutsideDays}\n className={cn(\n \"ds:mx-auto\",\n {\n \"ds:[--cell-size:clamp(0px,calc(100vw/7.5),52px)] ds:mb-8 ds:bg-transparent\":\n isMobile || desktopMode === \"drawer\",\n \"ds:[--cell-size:clamp(0px,calc(100vw/7.5),34px)]\":\n !isMobile && desktopMode !== \"drawer\",\n },\n calendarClassName\n )}\n />\n )}\n {showTime && (\n <div className=\"ds:flex ds:gap-0 ds:border-l ds:border-border\">\n <TimePicker\n {...timeConfig?.[0]}\n value={fromTime ? dfFormat(fromTime, timeFormat) : undefined}\n onSelect={handleTimeChangeFrom}\n format={timeFormat}\n showHours\n showMinutes\n showSeconds={timeFormat === \"HH:mm:ss\"}\n standalone={false}\n />\n <div className=\"ds:border-l ds:border-border\" />\n <TimePicker\n {...timeConfig?.[1]}\n value={toTime ? dfFormat(toTime, timeFormat) : undefined}\n onSelect={handleTimeChangeTo}\n format={timeFormat}\n showHours\n showMinutes\n showSeconds={timeFormat === \"HH:mm:ss\"}\n standalone={false}\n />\n </div>\n )}\n </div>\n );\n\n const popPicker = (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild disabled={props.disabled}>\n {triggerComponent}\n </PopoverTrigger>\n <PopoverContent\n className={cn(\n \"ds:w-auto ds:overflow-hidden ds:p-0\",\n \"ds:backdrop-blur ds:bg-background/50\"\n )}\n side={side}\n align={align}\n >\n {calendarSelection}\n </PopoverContent>\n </Popover>\n );\n\n const drawPicker = (\n <Drawer open={open} onOpenChange={setOpen}>\n <DrawerTrigger asChild>{triggerComponent}</DrawerTrigger>\n <DrawerContent\n className={cn(\n \"ds:w-auto ds:overflow-hidden ds:p-0\",\n \"ds:backdrop-blur ds:bg-background\"\n )}\n >\n <DrawerHeader className=\"ds:sr-only\">\n <DrawerTitle>Select date range</DrawerTitle>\n <DrawerDescription>Set your date range</DrawerDescription>\n </DrawerHeader>\n {calendarSelection}\n </DrawerContent>\n </Drawer>\n );\n\n // If children is provided, use render prop pattern with picker\n if (children) {\n const mode = isMobile ? mobileMode : desktopMode;\n return mode === \"drawer\" ? drawPicker : popPicker;\n }\n\n // Helper function to render range input\n const renderRangeInput = (\n type: \"from\" | \"to\",\n inputValue: string,\n setInputValue: (value: string) => void,\n additionalProps?: Partial<InputProps>\n ) => {\n const isFrom = type === \"from\";\n\n return (\n <Input\n {...props}\n {...additionalProps}\n ref={isFrom ? fromInputRef : toInputRef}\n id={inputId}\n size={\n props.isFloatLabel ? (props.size ? props.size : \"xl\") : props.size\n }\n className={props.className}\n inputClassName={cn(\n \"ds:border-0 ds:focus:ring-0 ds:rounded-none ds:hover:bg-transparent ds:active:bg-transparent ds:focus-visible:ring-0 ds:focus-visible:border-0 ds:shadow-none\",\n isFrom ? \"ds:pr-0\" : \"\"\n )}\n label={\n props.isFloatLabel && typeof label === \"object\"\n ? isFrom\n ? label?.from || \"\"\n : label?.to || \"\"\n : \"\"\n }\n placeholder={\n typeof placeholder === \"object\"\n ? isFrom\n ? placeholder?.from || \"\"\n : placeholder?.to || \"\"\n : placeholder\n }\n clearable={!isFrom}\n value={inputValue}\n mask={maskToUse}\n onChange={(e) => {\n const inputValue = e.target.value;\n setInputValue(inputValue);\n\n // If the input is cleared (empty), clear both fields\n if (inputValue.trim() === \"\") {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n return;\n }\n\n // Try to parse based on showTime\n let date: Date | undefined;\n if (showTime) {\n date = parseDate(inputValue, `${inputFormat} ${timeFormat}`);\n } else {\n date = parseDate(inputValue, inputFormat);\n }\n const newRange: DateRange = isFrom\n ? { from: date, to: range?.to }\n : { from: range?.from, to: date };\n\n if (date) {\n setRange(newRange);\n if (isFrom) setMonth(date);\n // Update time state if time was parsed\n if (isFrom) {\n setFromTime(date);\n // setFromInputValue(formatDateTimeValue(date)); // Sync input value\n } else {\n setToTime(date);\n // setToInputValue(formatDateTimeValue(date)); // Sync input value\n }\n const fromFormatted = formatDateTimeValue(\n isFrom ? date : range?.from\n );\n const toFormatted = formatDateTimeValue(isFrom ? range?.to : date);\n onSelect?.(newRange, { from: fromFormatted, to: toFormatted });\n onChange?.(newRange, {\n from: isFrom ? inputValue : fromInputValue,\n to: isFrom ? toInputValue : inputValue,\n });\n\n // If from input and date is valid, auto-focus to to input if to is empty\n // if (isFrom && toInputRef.current && !toInputValue.trim()) {\n // requestAnimationFrame(() => toInputRef.current?.focus());\n // }\n } else {\n onSelect?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: isFrom ? formatDateTimeValue(range?.to) : undefined,\n });\n onChange?.(newRange, {\n from: formatDateTimeValue(range?.from),\n to: isFrom ? formatDateTimeValue(range?.to) : undefined,\n });\n }\n }}\n onClear={\n !isFrom\n ? () => {\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = { from: undefined, to: undefined };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n }\n : undefined\n }\n onBlur={() => {\n // Check if blurring out of the entire range picker group\n const activeElement = document.activeElement;\n if (\n activeElement !== fromInputRef.current &&\n activeElement !== toInputRef.current\n ) {\n // Delay validation by 100ms\n setTimeout(() => {\n // Check again if still blurred out of the group\n const currentActiveElement = document.activeElement;\n if (\n currentActiveElement !== fromInputRef.current &&\n currentActiveElement !== toInputRef.current\n ) {\n // Blurred out of the group, validate both inputs\n const validateInput = (val: string) => {\n if (val.trim() === \"\") return true; // empty is valid (will clear)\n let parsed: Date | undefined;\n if (showTime) {\n parsed = parseDate(val, `${inputFormat} ${timeFormat}`);\n } else {\n parsed = parseDate(val, inputFormat);\n }\n return !!parsed;\n };\n\n const fromValid = validateInput(fromInputValue);\n const toValid = validateInput(toInputValue);\n\n // Clear if either is invalid, or if only one has value\n const shouldClear =\n !fromValid ||\n !toValid ||\n (fromInputValue.trim() && !toInputValue.trim()) ||\n (!fromInputValue.trim() && toInputValue.trim());\n\n if (shouldClear) {\n // If either is invalid, clear both\n setFromInputValue(\"\");\n setToInputValue(\"\");\n const newRange: DateRange = {\n from: undefined,\n to: undefined,\n };\n setRange(newRange);\n onSelect?.(newRange, newRange as DateRangeText);\n onChange?.(newRange, newRange as DateRangeText);\n }\n }\n }, 100);\n }\n }}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setOpen(true);\n }\n }}\n />\n );\n };\n\n // Default input rendering with two inputs\n return (\n <div\n className={cn(\n \"ds:group ds:relative ds:flex ds:items-center ds:border ds:rounded-md ds:focus-within:ring-2 ds:focus-within:ring-offset-2 ds:bg-background ds:transition-[color,box-shadow]\",\n {\n \"ds:border-input ds:focus-within:ring-ring\": !props.state,\n \"ds:border-success ds:focus-within:ring-success\": props.state === \"success\",\n \"ds:border-warning ds:focus-within:ring-warning\": props.state === \"warning\",\n \"ds:border-error ds:focus-within:ring-error\": props.state === \"error\",\n }\n )}\n >\n {renderRangeInput(\"from\", fromInputValue, setFromInputValue)}\n <span\n className={cn(\"ds:text-muted-foreground ds:select-none ds:pl-2\", {\n \"ds:opacity-30\": props.disabled,\n })}\n >\n {separator}\n </span>\n {renderRangeInput(\"to\", toInputValue, setToInputValue, {\n suffixIcon: isMobile\n ? mobileMode === \"drawer\"\n ? drawPicker\n : popPicker\n : desktopMode === \"drawer\"\n ? drawPicker\n : popPicker,\n })}\n {props.isFloatLabel && typeof label === \"string\" && (\n <FloatingLabel\n htmlFor={inputId}\n size={props.size}\n infoTooltip={props.infoTooltip}\n className=\"ds:z-10\"\n shouldFloat={shouldFloat}\n >\n {label}\n </FloatingLabel>\n )}\n </div>\n );\n}\n"],"names":["formatDate","date","outputFormat","DATE_FORMAT","locale","dfFormat","parseDate","str","inputFormat","parse","isValid","generateMaskFromFormat","format","match","RangePicker","label","value","placeholder","onChange","onSelect","calendarClassName","side","align","language","mask","closeOnSelect","showOutsideDays","calendarConfig","timeConfig","desktopMode","mobileMode","children","separator","jsx","MoveRight","showTime","timeFormat","hideDate","numberOfMonths","variant","color","props","inputId","React","maskToUse","initialFromDate","initialToDate","initialRange","open","setOpen","range","setRange","month","setMonth","fromInputValue","setFromInputValue","toInputValue","setToInputValue","fromTime","setFromTime","toTime","setToTime","fromInputRef","toInputRef","shouldFloat","_locale","enUS","vi","formatDateTimeValue","d","result","handleSelectForRenderProp","fromFormatted","toFormatted","handleFromChangeForRenderProp","text","newRange","parsedDate","handleToChangeForRenderProp","handleTimeChangeFrom","mergedDate","handleTimeChangeTo","triggerComponent","jsxs","Button","CalendarIcon","cn","calendarSelection","Calendar","isMobile","selectedRange","preservedRange","fromTimeObj","toTimeObj","TimePicker","popPicker","Popover","PopoverTrigger","PopoverContent","drawPicker","Drawer","DrawerTrigger","DrawerContent","DrawerHeader","DrawerTitle","DrawerDescription","renderRangeInput","type","inputValue","setInputValue","additionalProps","isFrom","Input","e","activeElement","currentActiveElement","validateInput","val","parsed","fromValid","toValid","FloatingLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAASA,GACPC,GACAC,IAAuBC,IACvBC,GACA;AACA,SAAKH,IAEEI,EAASJ,GAAMC,GAAcE,IAAS,EAAE,QAAAA,EAAA,IAAW,MAAS,IAFjD;AAGpB;AAEA,MAAME,IAAY,CAChBC,GACAC,IAAsBL,OACD;AACrB,QAAMF,IAAOQ,GAAMF,GAAKC,GAAa,oBAAI,MAAM;AAC/C,SAAOE,GAAQT,CAAI,IAAIA,IAAO;AAChC;AAEA,SAASU,GAAuBC,GAAwB;AACtD,SAAOA,EACJ,QAAQ,eAAe,CAACC,MAAU;AACjC,YAAQA,GAAA;AAAA,MACN,KAAK;AAAA,MACL,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAOA;AAAA,IAAA;AAAA,EAEb,CAAC,EACA,QAAQ,UAAU,CAACA,MAAU;AAC5B,YAAQA,GAAA;AAAA,MACN,KAAK;AAAA,MACL,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAA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