@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.
- package/dist/components/atoms/filter/filter-date-range.js +185 -161
- package/dist/components/atoms/filter/filter.d.ts +4 -0
- package/dist/components/atoms/filter/filter.js +82 -70
- package/dist/components/atoms/filter-dropdown/filter-dropdown.js +84 -87
- package/dist/components/atoms/icon/icon-list.d.ts +0 -3
- package/dist/components/atoms/icon/icon-list.js +392 -398
- package/dist/components/atoms/multi-values-field/multi-values-field.js +28 -28
- package/dist/components/atoms/radio-group/radio-group-option.js +7 -7
- package/dist/components/atoms/search-field/search-field.js +9 -9
- package/dist/components/atoms/switch/switch.js +13 -13
- package/dist/components/atoms/time-picker/time-picker.d.ts +5 -0
- package/dist/components/atoms/time-picker/time-picker.js +123 -115
- package/dist/components/molecules/empty/empty-icon.js +6 -6
- package/dist/components/organisms/data-table/data-table.d.ts +1 -24
- package/dist/components/organisms/data-table/data-table.js +93 -104
- package/dist/components/organisms/data-table/data-table.types.d.ts +0 -20
- package/dist/components/organisms/data-table/hooks/use-data-table-state.d.ts +2 -7
- package/dist/components/organisms/data-table/hooks/use-data-table-state.js +46 -80
- package/dist/components/organisms/data-table/utils/data-table-constants.d.ts +2 -2
- package/dist/components/organisms/data-table/utils/data-table-constants.js +11 -11
- package/dist/index.css +1 -1
- package/dist/vendor/shadcn/badge.js +17 -17
- package/dist/vendor/shadcn/card.js +7 -7
- package/dist/vendor/shadcn/input.js +7 -7
- package/dist/vendor/shadcn/select.js +1 -1
- package/dist/vendor/shadcn/table.js +18 -18
- package/package.json +1 -1
- package/dist/components/atoms/icon/aida-logo.d.ts +0 -3
- package/dist/components/atoms/icon/aida-logo.js +0 -64
- package/dist/node_modules/@phosphor-icons/react/dist/csr/File.es.js +0 -8
- package/dist/node_modules/@phosphor-icons/react/dist/csr/Table.es.js +0 -8
- package/dist/node_modules/@phosphor-icons/react/dist/defs/File.es.js +0 -30
- package/dist/node_modules/@phosphor-icons/react/dist/defs/Table.es.js +0 -30
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { j as
|
|
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:
|
|
8
|
+
value: n = [],
|
|
9
9
|
onChange: d,
|
|
10
|
-
label:
|
|
10
|
+
label: y,
|
|
11
11
|
description: c,
|
|
12
|
-
error:
|
|
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(),
|
|
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 &&
|
|
29
|
+
if (f && n.length >= f) {
|
|
30
30
|
i(`Maximum ${f} items allowed`);
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
if (!D &&
|
|
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([...
|
|
46
|
+
i(""), d([...n, r]), E("");
|
|
47
47
|
}
|
|
48
48
|
}, M = (e) => {
|
|
49
|
-
d(
|
|
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 === "" &&
|
|
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 &&
|
|
58
|
+
F(!1), B && x.trim() !== "" && s(x);
|
|
59
59
|
}, X = (e, r) => {
|
|
60
60
|
e.preventDefault(), e.stopPropagation(), M(r);
|
|
61
|
-
}, a =
|
|
62
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */
|
|
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-
|
|
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 ||
|
|
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(
|
|
82
|
+
u || document.getElementById(t)?.focus();
|
|
83
83
|
},
|
|
84
84
|
children: [
|
|
85
|
-
|
|
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__ */
|
|
99
|
+
/* @__PURE__ */ o.jsx(
|
|
100
100
|
"input",
|
|
101
101
|
{
|
|
102
102
|
ref: C,
|
|
103
|
-
id:
|
|
103
|
+
id: t,
|
|
104
104
|
name: V,
|
|
105
105
|
type: "text",
|
|
106
|
-
value:
|
|
106
|
+
value: x,
|
|
107
107
|
onChange: A,
|
|
108
108
|
onKeyDown: P,
|
|
109
109
|
onFocus: L,
|
|
110
110
|
onBlur: S,
|
|
111
|
-
placeholder:
|
|
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 || !!
|
|
119
|
-
"aria-describedby": c || a ? `${
|
|
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__ */
|
|
126
|
-
a && /* @__PURE__ */
|
|
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
|
|
4
|
-
import { Label as
|
|
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-
|
|
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
|
-
|
|
25
|
+
l,
|
|
26
26
|
{
|
|
27
27
|
htmlFor: s,
|
|
28
|
-
className:
|
|
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
|
-
|
|
38
|
+
l,
|
|
39
39
|
{
|
|
40
40
|
htmlFor: s,
|
|
41
|
-
className:
|
|
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
|
|
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:
|
|
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] =
|
|
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] =
|
|
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) &&
|
|
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
|
-
),
|
|
68
|
+
), l(o);
|
|
69
69
|
}, X = () => {
|
|
70
|
-
d(""),
|
|
70
|
+
d(""), l(""), g.current?.focus();
|
|
71
71
|
}, q = (e) => {
|
|
72
|
-
d(e),
|
|
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:
|
|
8
|
+
label: c,
|
|
9
9
|
description: o,
|
|
10
|
-
side:
|
|
10
|
+
side: i = "left",
|
|
11
11
|
variant: l = "default",
|
|
12
|
-
id:
|
|
12
|
+
id: d,
|
|
13
13
|
name: t,
|
|
14
14
|
onChange: a,
|
|
15
|
-
className:
|
|
16
|
-
switchClassName:
|
|
17
|
-
...
|
|
15
|
+
className: f,
|
|
16
|
+
switchClassName: m,
|
|
17
|
+
...x
|
|
18
18
|
}, p) => {
|
|
19
|
-
const h = v(), r =
|
|
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",
|
|
45
|
+
className: n("cursor-pointer", m),
|
|
46
46
|
onCheckedChange: u,
|
|
47
|
-
...
|
|
47
|
+
...x
|
|
48
48
|
}
|
|
49
49
|
), w = n(
|
|
50
50
|
"flex gap-3 items-start",
|
|
51
51
|
{
|
|
52
|
-
"flex-row-reverse":
|
|
53
|
-
"bg-
|
|
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
|
-
|
|
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:
|
|
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
|
|
2
|
-
import * as
|
|
3
|
-
import { useId as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { TimePicker as
|
|
7
|
-
import { Field as
|
|
8
|
-
const
|
|
9
|
-
if (
|
|
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 /
|
|
12
|
-
return Array.from({ length: n }, (o, i) => i *
|
|
13
|
-
},
|
|
14
|
-
const n =
|
|
15
|
-
return { hour:
|
|
16
|
-
},
|
|
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:
|
|
18
|
+
className: e,
|
|
19
19
|
label: n,
|
|
20
20
|
error: o,
|
|
21
21
|
description: i,
|
|
22
22
|
orientation: x = "vertical",
|
|
23
|
-
id:
|
|
24
|
-
onChange:
|
|
25
|
-
mode:
|
|
26
|
-
divisorMinutes:
|
|
27
|
-
width:
|
|
28
|
-
value:
|
|
29
|
-
disabled:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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:
|
|
38
|
-
id:
|
|
39
|
-
value:
|
|
40
|
-
disabled:
|
|
41
|
-
className:
|
|
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) &&
|
|
44
|
+
!(n || o || i) && e
|
|
44
45
|
),
|
|
45
46
|
"aria-invalid": v ? !0 : void 0,
|
|
46
|
-
"aria-describedby": i || o ? `${
|
|
47
|
-
...
|
|
48
|
-
onChange: (
|
|
49
|
-
|
|
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__ */
|
|
54
|
-
|
|
54
|
+
return n || o || i ? /* @__PURE__ */ r.jsxs(
|
|
55
|
+
R,
|
|
55
56
|
{
|
|
56
57
|
orientation: x,
|
|
57
58
|
"data-invalid": v,
|
|
58
|
-
className:
|
|
59
|
+
className: c("w-full", e),
|
|
59
60
|
children: [
|
|
60
|
-
n && /* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
|
|
63
|
-
i && !o && /* @__PURE__ */
|
|
64
|
-
o && /* @__PURE__ */
|
|
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
|
-
) :
|
|
69
|
+
) : k;
|
|
69
70
|
}
|
|
70
|
-
return /* @__PURE__ */
|
|
71
|
-
|
|
71
|
+
return /* @__PURE__ */ r.jsx(
|
|
72
|
+
ne,
|
|
72
73
|
{
|
|
73
|
-
value:
|
|
74
|
-
onChange:
|
|
75
|
-
divisorMinutes:
|
|
76
|
-
width:
|
|
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:
|
|
81
|
-
className:
|
|
81
|
+
disabled: p,
|
|
82
|
+
className: e,
|
|
83
|
+
use24Hour: w
|
|
82
84
|
}
|
|
83
85
|
);
|
|
84
86
|
}
|
|
85
87
|
);
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
value:
|
|
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:
|
|
94
|
-
description:
|
|
95
|
-
disabled:
|
|
96
|
-
className:
|
|
95
|
+
error: m,
|
|
96
|
+
description: f,
|
|
97
|
+
disabled: y,
|
|
98
|
+
className: j,
|
|
99
|
+
use24Hour: s = !1
|
|
97
100
|
}) => {
|
|
98
|
-
const [l,
|
|
99
|
-
const [
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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",
|
|
118
|
+
return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
|
|
111
119
|
}, [l]);
|
|
112
|
-
const
|
|
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:
|
|
116
|
-
className:
|
|
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__ */
|
|
127
|
+
/* @__PURE__ */ r.jsxs(
|
|
120
128
|
"button",
|
|
121
129
|
{
|
|
122
130
|
type: "button",
|
|
123
|
-
disabled:
|
|
124
|
-
onClick: () => !
|
|
125
|
-
className:
|
|
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
|
-
|
|
139
|
+
m && "border-destructive"
|
|
132
140
|
),
|
|
133
141
|
children: [
|
|
134
|
-
/* @__PURE__ */
|
|
135
|
-
/* @__PURE__ */
|
|
136
|
-
|
|
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__ */
|
|
154
|
+
l && /* @__PURE__ */ r.jsxs(
|
|
147
155
|
"div",
|
|
148
156
|
{
|
|
149
|
-
ref:
|
|
150
|
-
className:
|
|
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__ */
|
|
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: () =>
|
|
161
|
-
className:
|
|
168
|
+
onClick: () => D(t),
|
|
169
|
+
className: c(
|
|
162
170
|
"px-3 py-2 text-sm text-left hover:bg-accent",
|
|
163
|
-
|
|
171
|
+
a === t && "bg-primary text-primary-foreground hover:bg-primary"
|
|
164
172
|
),
|
|
165
|
-
children:
|
|
173
|
+
children: d(t)
|
|
166
174
|
},
|
|
167
|
-
|
|
175
|
+
t
|
|
168
176
|
)) }),
|
|
169
|
-
/* @__PURE__ */
|
|
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: () =>
|
|
174
|
-
className:
|
|
181
|
+
onClick: () => F(t),
|
|
182
|
+
className: c(
|
|
175
183
|
"px-3 py-2 text-sm text-left hover:bg-accent",
|
|
176
|
-
|
|
184
|
+
b === t && "bg-primary text-primary-foreground hover:bg-primary"
|
|
177
185
|
),
|
|
178
|
-
children:
|
|
186
|
+
children: d(t)
|
|
179
187
|
},
|
|
180
|
-
|
|
188
|
+
t
|
|
181
189
|
)) }),
|
|
182
|
-
/* @__PURE__ */
|
|
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: () =>
|
|
187
|
-
className:
|
|
194
|
+
onClick: () => L(t),
|
|
195
|
+
className: c(
|
|
188
196
|
"px-3 py-2 text-sm text-left hover:bg-accent",
|
|
189
|
-
|
|
197
|
+
M === t && "bg-primary text-primary-foreground hover:bg-primary"
|
|
190
198
|
),
|
|
191
|
-
children:
|
|
199
|
+
children: t
|
|
192
200
|
},
|
|
193
|
-
|
|
201
|
+
t
|
|
194
202
|
)) })
|
|
195
203
|
]
|
|
196
204
|
}
|
|
@@ -198,15 +206,15 @@ const Z = ({
|
|
|
198
206
|
]
|
|
199
207
|
}
|
|
200
208
|
);
|
|
201
|
-
return x ||
|
|
202
|
-
x && /* @__PURE__ */
|
|
203
|
-
/* @__PURE__ */
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
-
|
|
219
|
+
re as TimePicker
|
|
212
220
|
};
|