@yuno-payments/dashboard-design-system 0.0.173 → 0.0.174
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.
|
@@ -10,7 +10,7 @@ const A = O(
|
|
|
10
10
|
onChange: p,
|
|
11
11
|
label: w,
|
|
12
12
|
description: f,
|
|
13
|
-
error:
|
|
13
|
+
error: j,
|
|
14
14
|
placeholder: v = "Type and press Enter...",
|
|
15
15
|
disabled: l = !1,
|
|
16
16
|
id: C,
|
|
@@ -19,13 +19,13 @@ const A = O(
|
|
|
19
19
|
addOnBlur: B = !0,
|
|
20
20
|
allowDuplicates: I = !1,
|
|
21
21
|
maxItems: m,
|
|
22
|
-
validate:
|
|
22
|
+
validate: k,
|
|
23
23
|
badgeVariant: N = "outline",
|
|
24
24
|
orientation: $ = "vertical",
|
|
25
25
|
className: T,
|
|
26
26
|
deleteAll: a
|
|
27
27
|
}, R) => {
|
|
28
|
-
const M = Q(), o = C || M, h = !!
|
|
28
|
+
const M = Q(), o = C || M, h = !!j, [x, D] = b(""), [S, F] = b(!1), [g, i] = b(""), s = (e) => {
|
|
29
29
|
const n = e.trim();
|
|
30
30
|
if (n !== "") {
|
|
31
31
|
if (m && t.length >= m) {
|
|
@@ -36,8 +36,8 @@ const A = O(
|
|
|
36
36
|
i("Duplicate values are not allowed");
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
if (
|
|
40
|
-
const d =
|
|
39
|
+
if (k) {
|
|
40
|
+
const d = k(n);
|
|
41
41
|
if (d !== !0) {
|
|
42
42
|
i(
|
|
43
43
|
typeof d == "string" ? d : "Invalid value"
|
|
@@ -62,7 +62,7 @@ const A = O(
|
|
|
62
62
|
e.preventDefault(), e.stopPropagation(), P(n);
|
|
63
63
|
}, H = () => {
|
|
64
64
|
l || !a?.onClick || a.onClick();
|
|
65
|
-
}, u =
|
|
65
|
+
}, u = j || g;
|
|
66
66
|
return /* @__PURE__ */ r.jsxs(
|
|
67
67
|
U,
|
|
68
68
|
{
|
|
@@ -76,7 +76,7 @@ const A = O(
|
|
|
76
76
|
"div",
|
|
77
77
|
{
|
|
78
78
|
className: y(
|
|
79
|
-
"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-
|
|
79
|
+
"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-input 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",
|
|
80
80
|
"flex-wrap gap-1.5 items-center",
|
|
81
81
|
S && "border-ring ring-ring/50 ring-[3px]",
|
|
82
82
|
(h || g) && "border-destructive ring-destructive/20 dark:ring-destructive/40",
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as r from "react";
|
|
3
3
|
import { cn as a } from "../../../lib/utils.js";
|
|
4
4
|
import { FieldLabel as A } from "../../../vendor/shadcn/field.js";
|
|
5
5
|
import { Icon as b } from "../icon/icon.js";
|
|
6
6
|
import { Combobox as B, ComboboxTrigger as H, ComboboxContent as J } from "../../../vendor/shadcn/combobox.js";
|
|
7
|
-
import { Command as K, CommandInput as M, CommandList as P, CommandEmpty as Q, CommandGroup as U, CommandItem as
|
|
7
|
+
import { Command as K, CommandInput as M, CommandList as P, CommandEmpty as Q, CommandGroup as U, CommandItem as G } from "../../../vendor/shadcn/command.js";
|
|
8
8
|
import { Typography as x } from "../typography/typography.js";
|
|
9
|
-
const W =
|
|
9
|
+
const W = r.forwardRef(
|
|
10
10
|
({
|
|
11
11
|
label: j,
|
|
12
12
|
description: N,
|
|
13
13
|
error: u,
|
|
14
|
-
optional:
|
|
15
|
-
placeholder:
|
|
16
|
-
value:
|
|
14
|
+
optional: L = !1,
|
|
15
|
+
placeholder: k = "Select an option",
|
|
16
|
+
value: l,
|
|
17
17
|
defaultValue: p,
|
|
18
18
|
onChange: h,
|
|
19
19
|
disabled: f = !1,
|
|
@@ -24,56 +24,56 @@ const W = n.forwardRef(
|
|
|
24
24
|
searchPlaceholder: z = "Search...",
|
|
25
25
|
maxHeight: F = 300
|
|
26
26
|
}, I) => {
|
|
27
|
-
const [i, C] =
|
|
28
|
-
if (!
|
|
27
|
+
const [i, C] = r.useState(!1), [v, S] = r.useState(""), d = o.length > 0, w = c.length > 0, R = r.useCallback(() => {
|
|
28
|
+
if (!l) return null;
|
|
29
29
|
if (d)
|
|
30
30
|
for (const s of o) {
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
31
|
+
const n = s.options.find((t) => t.value === l);
|
|
32
|
+
if (n) return n.label;
|
|
33
33
|
}
|
|
34
34
|
else if (w) {
|
|
35
|
-
const s = c.find((
|
|
35
|
+
const s = c.find((n) => n.value === l);
|
|
36
36
|
if (s) return s.label;
|
|
37
37
|
}
|
|
38
38
|
return null;
|
|
39
|
-
}, [
|
|
39
|
+
}, [l, o, c, d, w]), T = r.useCallback(
|
|
40
40
|
(s) => {
|
|
41
41
|
if (!s)
|
|
42
42
|
return { filteredOptions: c, filteredGroups: o };
|
|
43
|
-
const
|
|
43
|
+
const n = s.toLowerCase();
|
|
44
44
|
if (d) {
|
|
45
45
|
const t = o.map((m) => ({
|
|
46
46
|
...m,
|
|
47
47
|
options: m.options.filter(
|
|
48
|
-
(V) => V.label.toLowerCase().includes(
|
|
48
|
+
(V) => V.label.toLowerCase().includes(n)
|
|
49
49
|
)
|
|
50
50
|
})).filter((m) => m.options.length > 0);
|
|
51
51
|
return { filteredOptions: [], filteredGroups: t };
|
|
52
52
|
} else
|
|
53
53
|
return { filteredOptions: c.filter(
|
|
54
|
-
(m) => m.label.toLowerCase().includes(
|
|
54
|
+
(m) => m.label.toLowerCase().includes(n)
|
|
55
55
|
), filteredGroups: [] };
|
|
56
56
|
},
|
|
57
57
|
[c, o, d]
|
|
58
58
|
), { filteredOptions: q, filteredGroups: D } = T(v);
|
|
59
|
-
|
|
59
|
+
r.useEffect(() => {
|
|
60
60
|
i && setTimeout(() => {
|
|
61
61
|
document.querySelector(
|
|
62
62
|
'[data-slot="command-input"]'
|
|
63
63
|
)?.focus();
|
|
64
64
|
}, 0);
|
|
65
|
-
}, [i]),
|
|
65
|
+
}, [i]), r.useEffect(() => {
|
|
66
66
|
i || S("");
|
|
67
|
-
}, [i]),
|
|
68
|
-
p && !
|
|
69
|
-
}, [p,
|
|
67
|
+
}, [i]), r.useEffect(() => {
|
|
68
|
+
p && !l && h?.(p);
|
|
69
|
+
}, [p, l, h]);
|
|
70
70
|
const y = (s) => {
|
|
71
71
|
f || (h?.(s), C(!1));
|
|
72
72
|
}, O = R();
|
|
73
73
|
return /* @__PURE__ */ e.jsxs("div", { className: a("w-full", E), children: [
|
|
74
74
|
j && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 mb-2", children: [
|
|
75
75
|
/* @__PURE__ */ e.jsx(A, { htmlFor: g, className: a(f && "text-muted-foreground"), children: j }),
|
|
76
|
-
|
|
76
|
+
L && /* @__PURE__ */ e.jsx(x, { variant: "sm", className: "text-muted-foreground", children: "(Optional)" })
|
|
77
77
|
] }),
|
|
78
78
|
N && !u && /* @__PURE__ */ e.jsx(
|
|
79
79
|
x,
|
|
@@ -98,7 +98,7 @@ const W = n.forwardRef(
|
|
|
98
98
|
"aria-expanded": i,
|
|
99
99
|
"aria-haspopup": "listbox",
|
|
100
100
|
className: a(
|
|
101
|
-
"flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-
|
|
101
|
+
"flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-input px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:text-muted- shadow-xs [&>span]:min-w-0 [&>span]:truncate",
|
|
102
102
|
u && "border-destructive"
|
|
103
103
|
),
|
|
104
104
|
children: [
|
|
@@ -109,7 +109,7 @@ const W = n.forwardRef(
|
|
|
109
109
|
"truncate",
|
|
110
110
|
!O && "text-muted-foreground"
|
|
111
111
|
),
|
|
112
|
-
children: O ||
|
|
112
|
+
children: O || k
|
|
113
113
|
}
|
|
114
114
|
),
|
|
115
115
|
/* @__PURE__ */ e.jsx(
|
|
@@ -141,23 +141,23 @@ const W = n.forwardRef(
|
|
|
141
141
|
children: "No results found."
|
|
142
142
|
}
|
|
143
143
|
) }),
|
|
144
|
-
d ? D.map((s,
|
|
144
|
+
d ? D.map((s, n) => /* @__PURE__ */ e.jsxs(U, { children: [
|
|
145
145
|
s.label && /* @__PURE__ */ e.jsx("div", { className: "px-2 py-1.5 text-xs font-medium text-muted-foreground", children: s.label }),
|
|
146
146
|
s.options.map((t) => /* @__PURE__ */ e.jsxs(
|
|
147
|
-
|
|
147
|
+
G,
|
|
148
148
|
{
|
|
149
149
|
value: t.value,
|
|
150
150
|
onSelect: () => y(t.value),
|
|
151
151
|
className: a(
|
|
152
152
|
"cursor-pointer",
|
|
153
|
-
|
|
153
|
+
l === t.value && "bg-accent"
|
|
154
154
|
),
|
|
155
155
|
children: [
|
|
156
156
|
/* @__PURE__ */ e.jsxs("span", { className: "flex items-center", children: [
|
|
157
157
|
t.icon && /* @__PURE__ */ e.jsx("span", { className: "mr-2 inline-flex items-center", children: t.icon }),
|
|
158
158
|
t.label
|
|
159
159
|
] }),
|
|
160
|
-
|
|
160
|
+
l === t.value && /* @__PURE__ */ e.jsx(
|
|
161
161
|
b,
|
|
162
162
|
{
|
|
163
163
|
name: "Check",
|
|
@@ -169,21 +169,21 @@ const W = n.forwardRef(
|
|
|
169
169
|
},
|
|
170
170
|
t.value
|
|
171
171
|
))
|
|
172
|
-
] },
|
|
173
|
-
|
|
172
|
+
] }, n)) : q.map((s) => /* @__PURE__ */ e.jsxs(
|
|
173
|
+
G,
|
|
174
174
|
{
|
|
175
175
|
value: s.value,
|
|
176
176
|
onSelect: () => y(s.value),
|
|
177
177
|
className: a(
|
|
178
178
|
"cursor-pointer",
|
|
179
|
-
|
|
179
|
+
l === s.value && "bg-accent"
|
|
180
180
|
),
|
|
181
181
|
children: [
|
|
182
182
|
/* @__PURE__ */ e.jsxs("span", { className: "flex items-center", children: [
|
|
183
183
|
s.icon && /* @__PURE__ */ e.jsx("span", { className: "mr-2 inline-flex items-center", children: s.icon }),
|
|
184
184
|
s.label
|
|
185
185
|
] }),
|
|
186
|
-
|
|
186
|
+
l === s.value && /* @__PURE__ */ e.jsx(b, { name: "Check", size: "sm", className: "ml-auto" })
|
|
187
187
|
]
|
|
188
188
|
},
|
|
189
189
|
s.value
|