@yuno-payments/dashboard-design-system 0.0.136 → 0.0.138-beta.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.
Files changed (33) hide show
  1. package/dist/components/atoms/filter/filter-date-range.js +185 -161
  2. package/dist/components/atoms/filter/filter.d.ts +4 -0
  3. package/dist/components/atoms/filter/filter.js +82 -70
  4. package/dist/components/atoms/filter-dropdown/filter-dropdown.js +84 -87
  5. package/dist/components/atoms/icon/icon-list.d.ts +0 -3
  6. package/dist/components/atoms/icon/icon-list.js +392 -398
  7. package/dist/components/atoms/multi-values-field/multi-values-field.js +28 -28
  8. package/dist/components/atoms/radio-group/radio-group-option.js +7 -7
  9. package/dist/components/atoms/search-field/search-field.js +9 -9
  10. package/dist/components/atoms/switch/switch.js +13 -13
  11. package/dist/components/atoms/time-picker/time-picker.d.ts +5 -0
  12. package/dist/components/atoms/time-picker/time-picker.js +123 -115
  13. package/dist/components/molecules/empty/empty-icon.js +6 -6
  14. package/dist/components/organisms/data-table/data-table.d.ts +1 -24
  15. package/dist/components/organisms/data-table/data-table.js +93 -104
  16. package/dist/components/organisms/data-table/data-table.types.d.ts +0 -20
  17. package/dist/components/organisms/data-table/hooks/use-data-table-state.d.ts +2 -7
  18. package/dist/components/organisms/data-table/hooks/use-data-table-state.js +46 -80
  19. package/dist/components/organisms/data-table/utils/data-table-constants.d.ts +2 -2
  20. package/dist/components/organisms/data-table/utils/data-table-constants.js +11 -11
  21. package/dist/index.css +1 -1
  22. package/dist/vendor/shadcn/badge.js +17 -17
  23. package/dist/vendor/shadcn/card.js +7 -7
  24. package/dist/vendor/shadcn/input.js +7 -7
  25. package/dist/vendor/shadcn/select.js +1 -1
  26. package/dist/vendor/shadcn/table.js +18 -18
  27. package/package.json +1 -1
  28. package/dist/components/atoms/icon/aida-logo.d.ts +0 -3
  29. package/dist/components/atoms/icon/aida-logo.js +0 -64
  30. package/dist/node_modules/@phosphor-icons/react/dist/csr/File.es.js +0 -8
  31. package/dist/node_modules/@phosphor-icons/react/dist/csr/Table.es.js +0 -8
  32. package/dist/node_modules/@phosphor-icons/react/dist/defs/File.es.js +0 -30
  33. package/dist/node_modules/@phosphor-icons/react/dist/defs/Table.es.js +0 -30
@@ -1,15 +1,15 @@
1
- import { j as n } from "../../../_virtual/jsx-runtime.js";
1
+ import { j as o } from "../../../_virtual/jsx-runtime.js";
2
2
  import { forwardRef as q, useId as z, useState as g } from "react";
3
3
  import { cn as b } from "../../../lib/utils.js";
4
4
  import { Field as G, FieldLabel as H, FieldDescription as J, FieldError as K } from "../../../vendor/shadcn/field.js";
5
5
  import { Badge as O } from "../badge/badge.js";
6
6
  const Q = q(
7
7
  ({
8
- value: t = [],
8
+ value: n = [],
9
9
  onChange: d,
10
- label: w,
10
+ label: y,
11
11
  description: c,
12
- error: y,
12
+ error: w,
13
13
  placeholder: j = "Type and press Enter...",
14
14
  disabled: u = !1,
15
15
  id: v,
@@ -23,14 +23,14 @@ const Q = q(
23
23
  orientation: N = "vertical",
24
24
  className: $
25
25
  }, C) => {
26
- const T = z(), o = v || T, m = !!y, [h, E] = g(""), [R, F] = g(!1), [x, i] = g(""), s = (e) => {
26
+ const T = z(), t = v || T, m = !!w, [x, E] = g(""), [R, F] = g(!1), [h, i] = g(""), s = (e) => {
27
27
  const r = e.trim();
28
28
  if (r !== "") {
29
- if (f && t.length >= f) {
29
+ if (f && n.length >= f) {
30
30
  i(`Maximum ${f} items allowed`);
31
31
  return;
32
32
  }
33
- if (!D && t.includes(r)) {
33
+ if (!D && n.includes(r)) {
34
34
  i("Duplicate values are not allowed");
35
35
  return;
36
36
  }
@@ -43,46 +43,46 @@ const Q = q(
43
43
  return;
44
44
  }
45
45
  }
46
- i(""), d([...t, r]), E("");
46
+ i(""), d([...n, r]), E("");
47
47
  }
48
48
  }, M = (e) => {
49
- d(t.filter((r) => r !== e)), i("");
49
+ d(n.filter((r) => r !== e)), i("");
50
50
  }, P = (e) => {
51
51
  const r = e.currentTarget.value;
52
- e.key === "Enter" && p.includes("Enter") ? (e.preventDefault(), s(r)) : e.key === "Tab" && p.includes("Tab") ? r.trim() !== "" && (e.preventDefault(), s(r)) : (e.key === "," || e.key === ",") && p.includes("Comma") ? (e.preventDefault(), s(r)) : e.key === "Backspace" && r === "" && t.length > 0 && d(t.slice(0, -1));
52
+ e.key === "Enter" && p.includes("Enter") ? (e.preventDefault(), s(r)) : e.key === "Tab" && p.includes("Tab") ? r.trim() !== "" && (e.preventDefault(), s(r)) : (e.key === "," || e.key === ",") && p.includes("Comma") ? (e.preventDefault(), s(r)) : e.key === "Backspace" && r === "" && n.length > 0 && d(n.slice(0, -1));
53
53
  }, A = (e) => {
54
54
  E(e.target.value), i("");
55
55
  }, L = () => {
56
56
  F(!0);
57
57
  }, S = () => {
58
- F(!1), B && h.trim() !== "" && s(h);
58
+ F(!1), B && x.trim() !== "" && s(x);
59
59
  }, X = (e, r) => {
60
60
  e.preventDefault(), e.stopPropagation(), M(r);
61
- }, a = y || x;
62
- return /* @__PURE__ */ n.jsxs(
61
+ }, a = w || h;
62
+ return /* @__PURE__ */ o.jsxs(
63
63
  G,
64
64
  {
65
65
  orientation: N,
66
66
  "data-invalid": m,
67
67
  className: b("w-full", $),
68
68
  children: [
69
- w && /* @__PURE__ */ n.jsx(H, { htmlFor: o, children: w }),
70
- /* @__PURE__ */ n.jsxs("div", { className: "flex flex-col gap-2 flex-1", children: [
71
- /* @__PURE__ */ n.jsxs(
69
+ y && /* @__PURE__ */ o.jsx(H, { htmlFor: t, children: y }),
70
+ /* @__PURE__ */ o.jsxs("div", { className: "flex flex-col gap-2 flex-1", children: [
71
+ /* @__PURE__ */ o.jsxs(
72
72
  "div",
73
73
  {
74
74
  className: b(
75
- "font-normal file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex min-h-9 w-full min-w-0 rounded-md border bg-white px-3 py-1.5 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 text-sm",
75
+ "font-normal file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex min-h-9 w-full min-w-0 rounded-md border bg-background px-3 py-1.5 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 text-sm",
76
76
  "flex-wrap gap-1.5 items-center",
77
77
  R && "border-ring ring-ring/50 ring-[3px]",
78
- (m || x) && "border-destructive ring-destructive/20 dark:ring-destructive/40",
78
+ (m || h) && "border-destructive ring-destructive/20 dark:ring-destructive/40",
79
79
  u && "opacity-50 cursor-not-allowed"
80
80
  ),
81
81
  onClick: () => {
82
- u || document.getElementById(o)?.focus();
82
+ u || document.getElementById(t)?.focus();
83
83
  },
84
84
  children: [
85
- t.map((e, r) => /* @__PURE__ */ n.jsx(
85
+ n.map((e, r) => /* @__PURE__ */ o.jsx(
86
86
  O,
87
87
  {
88
88
  variant: I,
@@ -96,34 +96,34 @@ const Q = q(
96
96
  },
97
97
  `${e}-${r}`
98
98
  )),
99
- /* @__PURE__ */ n.jsx(
99
+ /* @__PURE__ */ o.jsx(
100
100
  "input",
101
101
  {
102
102
  ref: C,
103
- id: o,
103
+ id: t,
104
104
  name: V,
105
105
  type: "text",
106
- value: h,
106
+ value: x,
107
107
  onChange: A,
108
108
  onKeyDown: P,
109
109
  onFocus: L,
110
110
  onBlur: S,
111
- placeholder: t.length === 0 ? j : "",
111
+ placeholder: n.length === 0 ? j : "",
112
112
  disabled: u,
113
113
  className: b(
114
114
  "flex-1 min-w-[120px] outline-none bg-transparent border-none shadow-none p-0 h-6",
115
115
  "placeholder:text-muted-foreground",
116
116
  "disabled:cursor-not-allowed"
117
117
  ),
118
- "aria-invalid": m || !!x,
119
- "aria-describedby": c || a ? `${o}-description` : void 0
118
+ "aria-invalid": m || !!h,
119
+ "aria-describedby": c || a ? `${t}-description` : void 0
120
120
  }
121
121
  )
122
122
  ]
123
123
  }
124
124
  ),
125
- c && !a && /* @__PURE__ */ n.jsx(J, { id: `${o}-description`, children: c }),
126
- a && /* @__PURE__ */ n.jsx(K, { id: `${o}-description`, children: a })
125
+ c && !a && /* @__PURE__ */ o.jsx(J, { id: `${t}-description`, children: c }),
126
+ a && /* @__PURE__ */ o.jsx(K, { id: `${t}-description`, children: a })
127
127
  ] })
128
128
  ]
129
129
  }
@@ -1,7 +1,7 @@
1
1
  import { j as r } from "../../../_virtual/jsx-runtime.js";
2
2
  import { RadioGroupItem as d } from "../../../vendor/shadcn/radio-group.js";
3
- import { cn as l } from "../../../lib/utils.js";
4
- import { Label as a } from "../../../vendor/shadcn/label.js";
3
+ import { cn as a } from "../../../lib/utils.js";
4
+ import { Label as l } from "../../../vendor/shadcn/label.js";
5
5
  const o = ({
6
6
  option: e,
7
7
  radioId: s,
@@ -17,15 +17,15 @@ const o = ({
17
17
  value: e.value,
18
18
  id: s,
19
19
  disabled: e.disabled,
20
- className: "size-3.5 data-[state=unchecked]:bg-white border-border cursor-pointer"
20
+ className: "size-3.5 data-[state=unchecked]:bg-background border-border cursor-pointer"
21
21
  }
22
22
  ),
23
23
  t ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
24
24
  /* @__PURE__ */ r.jsx(
25
- a,
25
+ l,
26
26
  {
27
27
  htmlFor: s,
28
- className: l(
28
+ className: a(
29
29
  "cursor-pointer",
30
30
  e.disabled && "text-muted-foreground"
31
31
  ),
@@ -35,10 +35,10 @@ const o = ({
35
35
  e.description && /* @__PURE__ */ r.jsx("p", { className: "text-sm text-muted-foreground ml-auto", children: e.description })
36
36
  ] }) : /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-1.5 flex-1", children: [
37
37
  /* @__PURE__ */ r.jsx(
38
- a,
38
+ l,
39
39
  {
40
40
  htmlFor: s,
41
- className: l(
41
+ className: a(
42
42
  "cursor-pointer",
43
43
  e.disabled && "text-muted-foreground"
44
44
  ),
@@ -1,5 +1,5 @@
1
1
  import { j as t } from "../../../_virtual/jsx-runtime.js";
2
- import { forwardRef as U, useId as Y, useState as l, useRef as V, useEffect as z } from "react";
2
+ import { forwardRef as U, useId as Y, useState as n, useRef as V, useEffect as z } from "react";
3
3
  import { cn as r } from "../../../lib/utils.js";
4
4
  import { Input as Z } from "../../../vendor/shadcn/input.js";
5
5
  import { Icon as w } from "../icon/icon.js";
@@ -28,7 +28,7 @@ const P = D("flex gap-2 w-full", {
28
28
  }), te = U(
29
29
  ({
30
30
  placeholder: F = "Search...",
31
- onSearch: n,
31
+ onSearch: l,
32
32
  limitSearch: y = 10,
33
33
  persistKey: c = "",
34
34
  value: m = "",
@@ -43,15 +43,15 @@ const P = D("flex gap-2 w-full", {
43
43
  inputProps: h,
44
44
  ...E
45
45
  }, i) => {
46
- const M = Y(), u = O || h?.id || M, b = !!a, [o, d] = l(m), [f, R] = l(() => {
46
+ const M = Y(), u = O || h?.id || M, b = !!a, [o, d] = n(m), [f, R] = n(() => {
47
47
  if (c) {
48
48
  const e = localStorage.getItem(`${c}_searchfield`);
49
49
  return e ? JSON.parse(e) : [];
50
50
  }
51
51
  return [];
52
- }), [C, L] = l([]), [B, v] = l(!1), [J, I] = l(!1), g = V(null), _ = V(null), G = (e) => {
52
+ }), [C, L] = n([]), [B, v] = n(!1), [J, I] = n(!1), g = V(null), _ = V(null), G = (e) => {
53
53
  const s = e.target.value;
54
- d(s), (s === "" || H) && n(s);
54
+ d(s), (s === "" || H) && l(s);
55
55
  }, W = (e) => {
56
56
  e.key === "Enter" && o !== "" && S();
57
57
  }, S = () => {
@@ -65,11 +65,11 @@ const P = D("flex gap-2 w-full", {
65
65
  R(k), c && localStorage.setItem(
66
66
  `${c}_searchfield`,
67
67
  JSON.stringify(k)
68
- ), n(o);
68
+ ), l(o);
69
69
  }, X = () => {
70
- d(""), n(""), g.current?.focus();
70
+ d(""), l(""), g.current?.focus();
71
71
  }, q = (e) => {
72
- d(e), n(e), v(!1), g.current?.focus();
72
+ d(e), l(e), v(!1), g.current?.focus();
73
73
  }, A = () => {
74
74
  v(!0);
75
75
  }, Q = () => {
@@ -124,7 +124,7 @@ const P = D("flex gap-2 w-full", {
124
124
  size: "sm",
125
125
  onClick: S,
126
126
  className: r(
127
- "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",
127
+ "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground dark:text-foreground",
128
128
  !x && "cursor-pointer hover:text-foreground transition-colors"
129
129
  )
130
130
  }
@@ -5,18 +5,18 @@ import { cn as n } from "../../../lib/utils.js";
5
5
  import { Label as y } from "../../../vendor/shadcn/label.js";
6
6
  const N = j(
7
7
  ({
8
- label: i,
8
+ label: c,
9
9
  description: o,
10
- side: c = "left",
10
+ side: i = "left",
11
11
  variant: l = "default",
12
- id: f,
12
+ id: d,
13
13
  name: t,
14
14
  onChange: a,
15
- className: m,
16
- switchClassName: x,
17
- ...d
15
+ className: f,
16
+ switchClassName: m,
17
+ ...x
18
18
  }, p) => {
19
- const h = v(), r = f || t || h, u = (s) => {
19
+ const h = v(), r = d || t || h, u = (s) => {
20
20
  if (!a) return;
21
21
  a({
22
22
  target: {
@@ -42,17 +42,17 @@ const N = j(
42
42
  ref: p,
43
43
  id: r,
44
44
  name: t,
45
- className: n("cursor-pointer", x),
45
+ className: n("cursor-pointer", m),
46
46
  onCheckedChange: u,
47
- ...d
47
+ ...x
48
48
  }
49
49
  ), w = n(
50
50
  "flex gap-3 items-start",
51
51
  {
52
- "flex-row-reverse": c === "right",
53
- "bg-white box-border justify-start p-4 rounded-lg border shadow-xs": l === "box"
52
+ "flex-row-reverse": i === "right",
53
+ "bg-background box-border justify-start p-4 rounded-lg border shadow-xs": l === "box"
54
54
  },
55
- m
55
+ f
56
56
  );
57
57
  return /* @__PURE__ */ e.jsxs("div", { className: w, children: [
58
58
  g,
@@ -62,7 +62,7 @@ const N = j(
62
62
  {
63
63
  htmlFor: r,
64
64
  className: "text-sm leading-[18.39px] cursor-pointer",
65
- children: i
65
+ children: c
66
66
  }
67
67
  ),
68
68
  o && /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: o })
@@ -43,6 +43,11 @@ export interface TimePickerProps extends Omit<TimePickerPrimitiveProps, "onChang
43
43
  * @default 140
44
44
  */
45
45
  width?: number | string;
46
+ /**
47
+ * Use 24-hour format (military time) instead of 12-hour with AM/PM
48
+ * @default false
49
+ */
50
+ use24Hour?: boolean;
46
51
  }
47
52
  /**
48
53
  * Time input picker with label, description, and error handling.
@@ -1,139 +1,147 @@
1
- import { j as e } from "../../../_virtual/jsx-runtime.js";
2
- import * as U from "react";
3
- import { useId as B, useState as k, useRef as I, useEffect as S } from "react";
4
- import { cn as s } from "../../../lib/utils.js";
5
- import { Icon as W } from "../icon/icon.js";
6
- import { TimePicker as q } from "../../../vendor/shadcn/time-picker.js";
7
- import { Field as C, FieldLabel as E, FieldDescription as T, FieldError as R } from "../../../vendor/shadcn/field.js";
8
- const G = Array.from({ length: 12 }, (t, n) => n + 1), J = ["AM", "PM"], K = (t) => {
9
- if (t === 0)
1
+ import { j as r } from "../../../_virtual/jsx-runtime.js";
2
+ import * as G from "react";
3
+ import { useId as J, useState as $, useRef as C, useEffect as E } from "react";
4
+ import { cn as c } from "../../../lib/utils.js";
5
+ import { Icon as K } from "../icon/icon.js";
6
+ import { TimePicker as Q } from "../../../vendor/shadcn/time-picker.js";
7
+ import { Field as R, FieldLabel as T, FieldDescription as O, FieldError as _ } from "../../../vendor/shadcn/field.js";
8
+ const X = Array.from({ length: 12 }, (e, n) => n + 1), Y = Array.from({ length: 24 }, (e, n) => n), Z = ["AM", "PM"], H = (e) => {
9
+ if (e === 0)
10
10
  return Array.from({ length: 60 }, (o, i) => i);
11
- const n = 60 / t;
12
- return Array.from({ length: n }, (o, i) => i * t);
13
- }, u = (t) => t.toString().padStart(2, "0"), Q = (t) => {
14
- const n = t >= 12 ? "PM" : "AM";
15
- return { hour: t === 0 ? 12 : t > 12 ? t - 12 : t, meridiem: n };
16
- }, X = (t, n) => t === 12 ? n === "AM" ? 0 : 12 : n === "PM" ? t + 12 : t, Y = U.forwardRef(
11
+ const n = 60 / e;
12
+ return Array.from({ length: n }, (o, i) => i * e);
13
+ }, d = (e) => e.toString().padStart(2, "0"), ee = (e) => {
14
+ const n = e >= 12 ? "PM" : "AM";
15
+ return { hour: e === 0 ? 12 : e > 12 ? e - 12 : e, meridiem: n };
16
+ }, te = (e, n) => e === 12 ? n === "AM" ? 0 : 12 : n === "PM" ? e + 12 : e, re = G.forwardRef(
17
17
  ({
18
- className: t,
18
+ className: e,
19
19
  label: n,
20
20
  error: o,
21
21
  description: i,
22
22
  orientation: x = "vertical",
23
- id: c,
24
- onChange: m,
25
- mode: b = "native",
26
- divisorMinutes: g = 0,
27
- width: l = 140,
28
- value: f,
29
- disabled: y,
30
- ...p
31
- }, M) => {
32
- const N = B(), a = c || N, v = !!o;
33
- if (b === "native") {
34
- const d = /* @__PURE__ */ e.jsx(
35
- q,
23
+ id: m,
24
+ onChange: f,
25
+ mode: y = "native",
26
+ divisorMinutes: j = 0,
27
+ width: s = 140,
28
+ value: l,
29
+ disabled: p,
30
+ use24Hour: w = !1,
31
+ ...h
32
+ }, P) => {
33
+ const S = J(), u = m || S, v = !!o;
34
+ if (y === "native") {
35
+ const k = /* @__PURE__ */ r.jsx(
36
+ Q,
36
37
  {
37
- ref: M,
38
- id: a,
39
- value: f,
40
- disabled: y,
41
- className: s(
38
+ ref: P,
39
+ id: u,
40
+ value: l,
41
+ disabled: p,
42
+ className: c(
42
43
  v && "border-destructive focus-visible:border-destructive",
43
- !(n || o || i) && t
44
+ !(n || o || i) && e
44
45
  ),
45
46
  "aria-invalid": v ? !0 : void 0,
46
- "aria-describedby": i || o ? `${a}-description` : void 0,
47
- ...p,
48
- onChange: (P) => {
49
- m?.(P.target.value);
47
+ "aria-describedby": i || o ? `${u}-description` : void 0,
48
+ ...h,
49
+ onChange: (a) => {
50
+ f?.(a.target.value);
50
51
  }
51
52
  }
52
53
  );
53
- return n || o || i ? /* @__PURE__ */ e.jsxs(
54
- C,
54
+ return n || o || i ? /* @__PURE__ */ r.jsxs(
55
+ R,
55
56
  {
56
57
  orientation: x,
57
58
  "data-invalid": v,
58
- className: s("w-full", t),
59
+ className: c("w-full", e),
59
60
  children: [
60
- n && /* @__PURE__ */ e.jsx(E, { htmlFor: a, children: n }),
61
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2 flex-1", children: [
62
- d,
63
- i && !o && /* @__PURE__ */ e.jsx(T, { id: `${a}-description`, children: i }),
64
- o && /* @__PURE__ */ e.jsx(R, { id: `${a}-description`, children: o })
61
+ n && /* @__PURE__ */ r.jsx(T, { htmlFor: u, children: n }),
62
+ /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-2 flex-1", children: [
63
+ k,
64
+ i && !o && /* @__PURE__ */ r.jsx(O, { id: `${u}-description`, children: i }),
65
+ o && /* @__PURE__ */ r.jsx(_, { id: `${u}-description`, children: o })
65
66
  ] })
66
67
  ]
67
68
  }
68
- ) : d;
69
+ ) : k;
69
70
  }
70
- return /* @__PURE__ */ e.jsx(
71
- Z,
71
+ return /* @__PURE__ */ r.jsx(
72
+ ne,
72
73
  {
73
- value: f || "12:00",
74
- onChange: m,
75
- divisorMinutes: g,
76
- width: l,
74
+ value: l || (w ? "00:00" : "12:00"),
75
+ onChange: f,
76
+ divisorMinutes: j,
77
+ width: s,
77
78
  label: n,
78
79
  error: o,
79
80
  description: i,
80
- disabled: y,
81
- className: t
81
+ disabled: p,
82
+ className: e,
83
+ use24Hour: w
82
84
  }
83
85
  );
84
86
  }
85
87
  );
86
- Y.displayName = "TimePicker";
87
- const Z = ({
88
- value: t,
88
+ re.displayName = "TimePicker";
89
+ const ne = ({
90
+ value: e,
89
91
  onChange: n,
90
92
  divisorMinutes: o,
91
93
  width: i,
92
94
  label: x,
93
- error: c,
94
- description: m,
95
- disabled: b,
96
- className: g
95
+ error: m,
96
+ description: f,
97
+ disabled: y,
98
+ className: j,
99
+ use24Hour: s = !1
97
100
  }) => {
98
- const [l, f] = k(!1), y = I(null), p = I(null), M = (r) => {
99
- const [h, O] = r.split(":"), _ = parseInt(h, 10) || 0, L = parseInt(O, 10) || 0, { hour: V, meridiem: z } = Q(_);
100
- return { hour: V, minute: L, meridiem: z };
101
- }, { hour: N, minute: a, meridiem: v } = M(t), [d, P] = k(N), [j, A] = k(a), [w, D] = k(v), F = K(o);
102
- S(() => {
103
- const r = X(d, w), h = `${u(r)}:${u(j)}`;
104
- n?.(h);
105
- }, [d, j, w, n]), S(() => {
106
- const r = (h) => {
107
- p.current && !p.current.contains(h.target) && f(!1);
101
+ const [l, p] = $(!1), w = C(null), h = C(null), P = (t) => {
102
+ const [g, B] = t.split(":"), N = parseInt(g, 10) || 0, A = parseInt(B, 10) || 0;
103
+ if (s)
104
+ return { hour24: N, minute: A, hour: N, meridiem: "AM" };
105
+ const { hour: W, meridiem: q } = ee(N);
106
+ return { hour24: N, minute: A, hour: W, meridiem: q };
107
+ }, { hour: S, hour24: u, minute: v, meridiem: k } = P(e), [a, D] = $(s ? u : S), [b, F] = $(v), [M, L] = $(k), U = H(o);
108
+ E(() => {
109
+ let t;
110
+ s ? t = a : t = te(a, M);
111
+ const g = `${d(t)}:${d(b)}`;
112
+ n?.(g);
113
+ }, [a, b, M, n, s]), E(() => {
114
+ const t = (g) => {
115
+ h.current && !h.current.contains(g.target) && p(!1);
108
116
  };
109
117
  if (l)
110
- return document.addEventListener("mousedown", r), () => document.removeEventListener("mousedown", r);
118
+ return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
111
119
  }, [l]);
112
- const H = `${u(d)}:${u(j)} ${w}`, $ = /* @__PURE__ */ e.jsxs(
120
+ const V = s ? `${d(a)}:${d(b)}` : `${d(a)}:${d(b)} ${M}`, z = s ? Y : X, I = /* @__PURE__ */ r.jsxs(
113
121
  "div",
114
122
  {
115
- ref: p,
116
- className: s("relative inline-block", g),
123
+ ref: h,
124
+ className: c("relative inline-block", j),
117
125
  style: { width: typeof i == "number" ? `${i}px` : i },
118
126
  children: [
119
- /* @__PURE__ */ e.jsxs(
127
+ /* @__PURE__ */ r.jsxs(
120
128
  "button",
121
129
  {
122
130
  type: "button",
123
- disabled: b,
124
- onClick: () => !b && f(!l),
125
- className: s(
131
+ disabled: y,
132
+ onClick: () => !y && p(!l),
133
+ className: c(
126
134
  "flex items-center justify-between w-full h-9 px-3 py-2",
127
135
  "text-sm rounded-md border border-input bg-background",
128
136
  "hover:bg-accent hover:text-accent-foreground",
129
137
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
130
138
  "disabled:cursor-not-allowed disabled:opacity-50",
131
- c && "border-destructive"
139
+ m && "border-destructive"
132
140
  ),
133
141
  children: [
134
- /* @__PURE__ */ e.jsx("span", { children: H }),
135
- /* @__PURE__ */ e.jsx(
136
- W,
142
+ /* @__PURE__ */ r.jsx("span", { children: V }),
143
+ /* @__PURE__ */ r.jsx(
144
+ K,
137
145
  {
138
146
  name: l ? "CaretUp" : "CaretDown",
139
147
  size: "sm",
@@ -143,54 +151,54 @@ const Z = ({
143
151
  ]
144
152
  }
145
153
  ),
146
- l && /* @__PURE__ */ e.jsxs(
154
+ l && /* @__PURE__ */ r.jsxs(
147
155
  "div",
148
156
  {
149
- ref: y,
150
- className: s(
157
+ ref: w,
158
+ className: c(
151
159
  "absolute z-50 mt-1 bg-popover border border-border rounded-md shadow-lg",
152
160
  "flex divide-x divide-border"
153
161
  ),
154
- style: { width: "fit-content", minWidth: "200px" },
162
+ style: { width: "fit-content", minWidth: s ? "140px" : "200px" },
155
163
  children: [
156
- /* @__PURE__ */ e.jsx("div", { className: "flex flex-col overflow-y-auto max-h-[200px] min-w-[60px]", children: G.map((r) => /* @__PURE__ */ e.jsx(
164
+ /* @__PURE__ */ r.jsx("div", { className: "flex flex-col overflow-y-auto max-h-[200px] min-w-[60px]", children: z.map((t) => /* @__PURE__ */ r.jsx(
157
165
  "button",
158
166
  {
159
167
  type: "button",
160
- onClick: () => P(r),
161
- className: s(
168
+ onClick: () => D(t),
169
+ className: c(
162
170
  "px-3 py-2 text-sm text-left hover:bg-accent",
163
- d === r && "bg-primary text-primary-foreground hover:bg-primary"
171
+ a === t && "bg-primary text-primary-foreground hover:bg-primary"
164
172
  ),
165
- children: u(r)
173
+ children: d(t)
166
174
  },
167
- r
175
+ t
168
176
  )) }),
169
- /* @__PURE__ */ e.jsx("div", { className: "flex flex-col overflow-y-auto max-h-[200px] min-w-[60px]", children: F.map((r) => /* @__PURE__ */ e.jsx(
177
+ /* @__PURE__ */ r.jsx("div", { className: "flex flex-col overflow-y-auto max-h-[200px] min-w-[60px]", children: U.map((t) => /* @__PURE__ */ r.jsx(
170
178
  "button",
171
179
  {
172
180
  type: "button",
173
- onClick: () => A(r),
174
- className: s(
181
+ onClick: () => F(t),
182
+ className: c(
175
183
  "px-3 py-2 text-sm text-left hover:bg-accent",
176
- j === r && "bg-primary text-primary-foreground hover:bg-primary"
184
+ b === t && "bg-primary text-primary-foreground hover:bg-primary"
177
185
  ),
178
- children: u(r)
186
+ children: d(t)
179
187
  },
180
- r
188
+ t
181
189
  )) }),
182
- /* @__PURE__ */ e.jsx("div", { className: "flex flex-col min-w-[60px]", children: J.map((r) => /* @__PURE__ */ e.jsx(
190
+ !s && /* @__PURE__ */ r.jsx("div", { className: "flex flex-col min-w-[60px]", children: Z.map((t) => /* @__PURE__ */ r.jsx(
183
191
  "button",
184
192
  {
185
193
  type: "button",
186
- onClick: () => D(r),
187
- className: s(
194
+ onClick: () => L(t),
195
+ className: c(
188
196
  "px-3 py-2 text-sm text-left hover:bg-accent",
189
- w === r && "bg-primary text-primary-foreground hover:bg-primary"
197
+ M === t && "bg-primary text-primary-foreground hover:bg-primary"
190
198
  ),
191
- children: r
199
+ children: t
192
200
  },
193
- r
201
+ t
194
202
  )) })
195
203
  ]
196
204
  }
@@ -198,15 +206,15 @@ const Z = ({
198
206
  ]
199
207
  }
200
208
  );
201
- return x || c || m ? /* @__PURE__ */ e.jsxs(C, { orientation: "vertical", className: s("w-full", g), children: [
202
- x && /* @__PURE__ */ e.jsx(E, { children: x }),
203
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2 flex-1", children: [
204
- $,
205
- m && !c && /* @__PURE__ */ e.jsx(T, { children: m }),
206
- c && /* @__PURE__ */ e.jsx(R, { children: c })
209
+ return x || m || f ? /* @__PURE__ */ r.jsxs(R, { orientation: "vertical", className: c("w-full", j), children: [
210
+ x && /* @__PURE__ */ r.jsx(T, { children: x }),
211
+ /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-2 flex-1", children: [
212
+ I,
213
+ f && !m && /* @__PURE__ */ r.jsx(O, { children: f }),
214
+ m && /* @__PURE__ */ r.jsx(_, { children: m })
207
215
  ] })
208
- ] }) : $;
216
+ ] }) : I;
209
217
  };
210
218
  export {
211
- Y as TimePicker
219
+ re as TimePicker
212
220
  };