@yuno-payments/dashboard-design-system 0.0.137 → 0.0.138-beta.2
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 +140 -165
- package/dist/components/atoms/filter/filter.d.ts +4 -0
- package/dist/components/atoms/filter/filter.js +75 -63
- 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/index.css +1 -1
- package/dist/vendor/shadcn/select.js +1 -1
- package/package.json +1 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { Button as
|
|
2
|
+
import { forwardRef as f, useState as A, useMemo as M } from "react";
|
|
3
|
+
import { Button as j } from "../../../vendor/shadcn/button.js";
|
|
4
4
|
import { Badge as C } from "../../../vendor/shadcn/badge.js";
|
|
5
5
|
import { Separator as p } from "../../../vendor/shadcn/separator.js";
|
|
6
|
-
import { Checkbox as
|
|
7
|
-
import { RadioGroup as
|
|
6
|
+
import { Checkbox as E } from "../../../vendor/shadcn/checkbox.js";
|
|
7
|
+
import { RadioGroup as Q, RadioGroupItem as L } from "../../../vendor/shadcn/radio-group.js";
|
|
8
8
|
import { Icon as y } from "../icon/icon.js";
|
|
9
|
-
import { cn as
|
|
9
|
+
import { cn as g } from "../../../lib/utils.js";
|
|
10
10
|
import { Field as k } from "../field/field.js";
|
|
11
11
|
import { Tooltip as v } from "../tooltip/tooltip.js";
|
|
12
|
-
const F =
|
|
12
|
+
const F = f(
|
|
13
13
|
({ label: s, onRemove: t, className: n, ...l }, i) => /* @__PURE__ */ e.jsxs(
|
|
14
14
|
C,
|
|
15
15
|
{
|
|
16
16
|
ref: i,
|
|
17
17
|
variant: "secondary",
|
|
18
|
-
className:
|
|
18
|
+
className: g("h-8 gap-2 px-3 py-2 shadow-xs", n),
|
|
19
19
|
...l,
|
|
20
20
|
children: [
|
|
21
21
|
/* @__PURE__ */ e.jsx("span", { className: "text-xs font-medium leading-none", children: s }),
|
|
@@ -33,49 +33,49 @@ const F = x(
|
|
|
33
33
|
)
|
|
34
34
|
);
|
|
35
35
|
F.displayName = "FilterTag";
|
|
36
|
-
const P =
|
|
36
|
+
const P = f(
|
|
37
37
|
({
|
|
38
38
|
appliedFilters: s = [],
|
|
39
39
|
onRemoveFilter: t,
|
|
40
40
|
onClearAll: n,
|
|
41
41
|
maxVisibleTags: l = 4,
|
|
42
42
|
className: i,
|
|
43
|
-
...
|
|
44
|
-
},
|
|
45
|
-
const
|
|
43
|
+
...c
|
|
44
|
+
}, r) => {
|
|
45
|
+
const o = s.length > 0, x = s.slice(0, l), u = s.length - l;
|
|
46
46
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
47
47
|
/* @__PURE__ */ e.jsxs(
|
|
48
|
-
|
|
48
|
+
j,
|
|
49
49
|
{
|
|
50
|
-
ref:
|
|
50
|
+
ref: r,
|
|
51
51
|
variant: "outline",
|
|
52
52
|
size: "sm",
|
|
53
|
-
className:
|
|
54
|
-
...
|
|
53
|
+
className: g("h-8 gap-2 px-3 py-2", i),
|
|
54
|
+
...c,
|
|
55
55
|
children: [
|
|
56
56
|
/* @__PURE__ */ e.jsx(y, { name: "FunnelSimple", className: "size-4" }),
|
|
57
57
|
/* @__PURE__ */ e.jsx("span", { className: "text-xs font-medium leading-none", children: "Add filter" })
|
|
58
58
|
]
|
|
59
59
|
}
|
|
60
60
|
),
|
|
61
|
-
|
|
61
|
+
o && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
62
62
|
/* @__PURE__ */ e.jsx(p, { orientation: "vertical", className: "h-5" }),
|
|
63
63
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
64
|
-
|
|
64
|
+
x.map((m) => /* @__PURE__ */ e.jsx(
|
|
65
65
|
F,
|
|
66
66
|
{
|
|
67
|
-
label:
|
|
68
|
-
onRemove: () => t?.(
|
|
67
|
+
label: m.label,
|
|
68
|
+
onRemove: () => t?.(m.id)
|
|
69
69
|
},
|
|
70
|
-
|
|
70
|
+
m.id
|
|
71
71
|
)),
|
|
72
|
-
|
|
72
|
+
u > 0 && /* @__PURE__ */ e.jsx(C, { variant: "default", className: "h-8 px-3 py-2 shadow-xs", children: /* @__PURE__ */ e.jsxs("span", { className: "text-xs font-medium leading-none", children: [
|
|
73
73
|
"+",
|
|
74
|
-
|
|
74
|
+
u,
|
|
75
75
|
" more"
|
|
76
76
|
] }) }),
|
|
77
77
|
n && /* @__PURE__ */ e.jsx(
|
|
78
|
-
|
|
78
|
+
j,
|
|
79
79
|
{
|
|
80
80
|
variant: "ghost",
|
|
81
81
|
size: "sm",
|
|
@@ -86,7 +86,7 @@ const P = x(
|
|
|
86
86
|
)
|
|
87
87
|
] })
|
|
88
88
|
] }),
|
|
89
|
-
!
|
|
89
|
+
!o && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
90
90
|
/* @__PURE__ */ e.jsx(p, { orientation: "vertical", className: "h-5" }),
|
|
91
91
|
/* @__PURE__ */ e.jsx("span", { className: "text-sm font-normal text-muted-foreground", children: "No filters applied" })
|
|
92
92
|
] })
|
|
@@ -94,43 +94,43 @@ const P = x(
|
|
|
94
94
|
}
|
|
95
95
|
);
|
|
96
96
|
P.displayName = "FilterButton";
|
|
97
|
-
const X =
|
|
97
|
+
const X = f(
|
|
98
98
|
(s, t) => {
|
|
99
99
|
const {
|
|
100
100
|
title: n,
|
|
101
101
|
items: l,
|
|
102
102
|
className: i,
|
|
103
|
-
searchable:
|
|
104
|
-
searchPlaceholder:
|
|
105
|
-
showActions:
|
|
106
|
-
enableSelectAll:
|
|
107
|
-
enableInverse:
|
|
108
|
-
enableNone:
|
|
109
|
-
} = s,
|
|
103
|
+
searchable: c = !1,
|
|
104
|
+
searchPlaceholder: r = "Search...",
|
|
105
|
+
showActions: o = !1,
|
|
106
|
+
enableSelectAll: x = !0,
|
|
107
|
+
enableInverse: u = !0,
|
|
108
|
+
enableNone: m = !0
|
|
109
|
+
} = s, d = s.type || "checkbox", w = d === "radio", z = d === "checkbox" || !s.type, [N, I] = A(""), b = M(() => N ? l.filter(
|
|
110
110
|
(a) => a.label.toLowerCase().includes(N.toLowerCase())
|
|
111
111
|
) : l, [l, N]), R = () => {
|
|
112
|
-
if (
|
|
113
|
-
const a = l.map((
|
|
112
|
+
if (d === "checkbox" && "selectedValues" in s) {
|
|
113
|
+
const a = l.map((h) => h.value);
|
|
114
114
|
s.onChange(a);
|
|
115
115
|
}
|
|
116
116
|
}, T = () => {
|
|
117
|
-
if (
|
|
118
|
-
const a = l.filter((
|
|
117
|
+
if (d === "checkbox" && "selectedValues" in s) {
|
|
118
|
+
const a = l.filter((h) => !s.selectedValues.includes(h.value)).map((h) => h.value);
|
|
119
119
|
s.onChange(a);
|
|
120
120
|
}
|
|
121
121
|
}, B = () => {
|
|
122
|
-
|
|
122
|
+
d === "checkbox" && "selectedValues" in s ? s.onChange([]) : d === "radio" && "selectedValue" in s && s.onChange("");
|
|
123
123
|
}, G = (a) => {
|
|
124
|
-
if (
|
|
124
|
+
if (d === "checkbox" && "selectedValues" in s) {
|
|
125
125
|
const O = s.selectedValues.includes(a) ? s.selectedValues.filter(($) => $ !== a) : [...s.selectedValues, a];
|
|
126
126
|
s.onChange(O);
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
|
-
return /* @__PURE__ */ e.jsxs("div", { ref: t, className:
|
|
130
|
-
|
|
129
|
+
return /* @__PURE__ */ e.jsxs("div", { ref: t, className: g("flex flex-col h-full", i), children: [
|
|
130
|
+
c && /* @__PURE__ */ e.jsx(
|
|
131
131
|
k,
|
|
132
132
|
{
|
|
133
|
-
placeholder:
|
|
133
|
+
placeholder: r,
|
|
134
134
|
value: N,
|
|
135
135
|
onChange: (a) => I(a.target.value),
|
|
136
136
|
startIcon: "MagnifyingGlass",
|
|
@@ -139,9 +139,9 @@ const X = x(
|
|
|
139
139
|
),
|
|
140
140
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between mb-1", children: [
|
|
141
141
|
/* @__PURE__ */ e.jsx("span", { className: "text-sm font-normal text-foreground", children: n }),
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
o && d === "checkbox" && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-end gap-2", children: [
|
|
143
|
+
x && /* @__PURE__ */ e.jsx(
|
|
144
|
+
j,
|
|
145
145
|
{
|
|
146
146
|
variant: "link",
|
|
147
147
|
size: "sm",
|
|
@@ -150,8 +150,8 @@ const X = x(
|
|
|
150
150
|
children: "Select all"
|
|
151
151
|
}
|
|
152
152
|
),
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
u && /* @__PURE__ */ e.jsx(
|
|
154
|
+
j,
|
|
155
155
|
{
|
|
156
156
|
variant: "link",
|
|
157
157
|
size: "sm",
|
|
@@ -160,8 +160,8 @@ const X = x(
|
|
|
160
160
|
children: "Inverse"
|
|
161
161
|
}
|
|
162
162
|
),
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
m && /* @__PURE__ */ e.jsx(
|
|
164
|
+
j,
|
|
165
165
|
{
|
|
166
166
|
variant: "link",
|
|
167
167
|
size: "sm",
|
|
@@ -174,7 +174,7 @@ const X = x(
|
|
|
174
174
|
] }),
|
|
175
175
|
/* @__PURE__ */ e.jsx(p, { className: "w-full mb-6" }),
|
|
176
176
|
w && "selectedValue" in s ? /* @__PURE__ */ e.jsx(
|
|
177
|
-
|
|
177
|
+
Q,
|
|
178
178
|
{
|
|
179
179
|
value: s.selectedValue,
|
|
180
180
|
onValueChange: s.onChange,
|
|
@@ -194,6 +194,7 @@ const X = x(
|
|
|
194
194
|
{
|
|
195
195
|
label: a.label,
|
|
196
196
|
description: a.description,
|
|
197
|
+
icon: a.icon,
|
|
197
198
|
checked: s.selectedValues.includes(a.value),
|
|
198
199
|
onCheckedChange: () => G(a.value)
|
|
199
200
|
},
|
|
@@ -203,19 +204,30 @@ const X = x(
|
|
|
203
204
|
}
|
|
204
205
|
);
|
|
205
206
|
X.displayName = "FilterSection";
|
|
206
|
-
const V =
|
|
207
|
-
const
|
|
208
|
-
return /* @__PURE__ */ e.jsxs("label", { className:
|
|
209
|
-
/* @__PURE__ */ e.jsx(
|
|
207
|
+
const V = f(({ label: s, checked: t, onCheckedChange: n, description: l, className: i, maxLabelLength: c = 14, icon: r }, o) => {
|
|
208
|
+
const x = s.length > c, u = x ? `${s.slice(0, c)}...` : s;
|
|
209
|
+
return /* @__PURE__ */ e.jsxs("label", { className: g("flex items-start gap-2 cursor-pointer", i), children: [
|
|
210
|
+
/* @__PURE__ */ e.jsx(E, { ref: o, checked: t, onCheckedChange: n }),
|
|
211
|
+
r && /* @__PURE__ */ e.jsx(
|
|
212
|
+
"img",
|
|
213
|
+
{
|
|
214
|
+
src: r,
|
|
215
|
+
alt: "",
|
|
216
|
+
className: "size-4 object-contain shrink-0",
|
|
217
|
+
onError: (m) => {
|
|
218
|
+
m.currentTarget.style.display = "none";
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
),
|
|
210
222
|
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1.5 min-w-0 flex-1", children: [
|
|
211
|
-
/* @__PURE__ */ e.jsx(v, { content:
|
|
223
|
+
/* @__PURE__ */ e.jsx(v, { content: x ? s : "", children: /* @__PURE__ */ e.jsx("span", { className: "text-sm font-medium leading-none truncate", children: u }) }),
|
|
212
224
|
l && /* @__PURE__ */ e.jsx("span", { className: "text-sm font-normal leading-5 text-muted-foreground truncate", children: l })
|
|
213
225
|
] })
|
|
214
226
|
] });
|
|
215
227
|
});
|
|
216
228
|
V.displayName = "FilterCheckboxOption";
|
|
217
|
-
const S =
|
|
218
|
-
({ label: s, value: t, description: n, className: l }, i) => /* @__PURE__ */ e.jsxs("div", { className:
|
|
229
|
+
const S = f(
|
|
230
|
+
({ label: s, value: t, description: n, className: l }, i) => /* @__PURE__ */ e.jsxs("div", { className: g("flex items-start gap-3", l), children: [
|
|
219
231
|
/* @__PURE__ */ e.jsx(L, { ref: i, value: t, id: `radio-${t}` }),
|
|
220
232
|
/* @__PURE__ */ e.jsxs(
|
|
221
233
|
"label",
|
|
@@ -231,21 +243,21 @@ const S = x(
|
|
|
231
243
|
] })
|
|
232
244
|
);
|
|
233
245
|
S.displayName = "FilterRadioOption";
|
|
234
|
-
const q =
|
|
246
|
+
const q = f(
|
|
235
247
|
({
|
|
236
248
|
children: s,
|
|
237
249
|
showSearch: t = !1,
|
|
238
250
|
searchPlaceholder: n = "Search...",
|
|
239
251
|
searchValue: l,
|
|
240
252
|
onSearchChange: i,
|
|
241
|
-
className:
|
|
242
|
-
},
|
|
253
|
+
className: c
|
|
254
|
+
}, r) => /* @__PURE__ */ e.jsxs(
|
|
243
255
|
"div",
|
|
244
256
|
{
|
|
245
|
-
ref:
|
|
246
|
-
className:
|
|
257
|
+
ref: r,
|
|
258
|
+
className: g(
|
|
247
259
|
"flex flex-col gap-6 bg-background rounded-md p-6 min-w-[448px]",
|
|
248
|
-
|
|
260
|
+
c
|
|
249
261
|
),
|
|
250
262
|
children: [
|
|
251
263
|
t && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
|
|
@@ -261,7 +273,7 @@ const q = x(
|
|
|
261
273
|
{
|
|
262
274
|
placeholder: n,
|
|
263
275
|
value: l,
|
|
264
|
-
onChange: (
|
|
276
|
+
onChange: (o) => i?.(o.target.value),
|
|
265
277
|
className: "pl-9"
|
|
266
278
|
}
|
|
267
279
|
)
|
|
@@ -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
|
};
|