@yuno-payments/dashboard-design-system 1.1.7 → 1.2.0
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/combobox/combobox.js +100 -95
- package/dist/components/atoms/combobox/types.d.ts +14 -2
- package/dist/components/atoms/filter/filter.js +2 -2
- package/dist/components/atoms/multi-select/multi-select.js +1 -1
- package/dist/components/atoms/search-field/search-field.js +1 -1
- package/dist/components/atoms/search-field/search-field.types.d.ts +1 -1
- package/dist/components/atoms/select/search-select.js +1 -1
- package/dist/dashboard-design-system.css +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.min.js +1630 -1625
- package/dist/index.umd.min.js +7 -7
- package/package.json +1 -1
|
@@ -1,98 +1,100 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { j as s } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { forwardRef as _, useState as y, useRef as W, useEffect as z } from "react";
|
|
3
3
|
import { cn as f } from "../../../lib/utils.js";
|
|
4
|
-
import { Combobox as
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { Label as
|
|
4
|
+
import { Combobox as A, ComboboxTrigger as P, ComboboxContent as ee } from "../../../vendor/shadcn/combobox.js";
|
|
5
|
+
import { Icon as B } from "../icon/icon.js";
|
|
6
|
+
import { Label as se } from "../label/label.js";
|
|
7
7
|
import { Typography as C } from "../typography/typography.js";
|
|
8
8
|
import { Badge as N } from "../badge/badge.js";
|
|
9
|
-
import { Checkbox as
|
|
10
|
-
const
|
|
9
|
+
import { Checkbox as te } from "../checkbox/checkbox.js";
|
|
10
|
+
const ne = ({ message: n = "No results" }) => /* @__PURE__ */ s.jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ s.jsx(C, { variant: "sm", className: "text-muted-foreground", children: n }) }), re = _(
|
|
11
11
|
({
|
|
12
12
|
value: n,
|
|
13
|
-
options:
|
|
14
|
-
selectPlaceholder:
|
|
15
|
-
searchPlaceholder: w = "Search
|
|
13
|
+
options: o,
|
|
14
|
+
selectPlaceholder: K = "Select",
|
|
15
|
+
searchPlaceholder: w = "Search",
|
|
16
16
|
onChange: k,
|
|
17
17
|
onCloseChip: x,
|
|
18
18
|
valueProp: r = "value",
|
|
19
|
-
fullWidth:
|
|
20
|
-
disabled:
|
|
19
|
+
fullWidth: D = !1,
|
|
20
|
+
disabled: a = !1,
|
|
21
21
|
withSearch: d = !0,
|
|
22
|
-
limitTags:
|
|
23
|
-
maxHeightList:
|
|
24
|
-
emptyState:
|
|
25
|
-
label:
|
|
26
|
-
description:
|
|
22
|
+
limitTags: v = 10,
|
|
23
|
+
maxHeightList: g = 320,
|
|
24
|
+
emptyState: G = /* @__PURE__ */ s.jsx(ne, {}),
|
|
25
|
+
label: E,
|
|
26
|
+
description: O,
|
|
27
27
|
error: u,
|
|
28
28
|
deleteAll: l,
|
|
29
|
-
className:
|
|
30
|
-
id: i
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
className: L,
|
|
30
|
+
id: i,
|
|
31
|
+
renderOption: R,
|
|
32
|
+
renderChip: F
|
|
33
|
+
}, M) => {
|
|
34
|
+
const [c, S] = y(!1), [U, V] = y(""), [T, p] = y(o), h = W(null);
|
|
35
|
+
z(() => {
|
|
36
|
+
p(o);
|
|
37
|
+
}, [o]), z(() => {
|
|
36
38
|
c && h.current && d && setTimeout(() => {
|
|
37
39
|
h.current?.focus();
|
|
38
40
|
}, 0);
|
|
39
41
|
}, [c, d]);
|
|
40
42
|
const b = (e) => {
|
|
41
|
-
const
|
|
42
|
-
return String(
|
|
43
|
-
},
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
|
|
43
|
+
const t = e.label || e[r];
|
|
44
|
+
return String(t);
|
|
45
|
+
}, X = (e) => {
|
|
46
|
+
const t = e.target.value;
|
|
47
|
+
if (V(t), t === "")
|
|
48
|
+
p(o);
|
|
47
49
|
else {
|
|
48
|
-
const m =
|
|
49
|
-
(
|
|
50
|
+
const m = o.filter(
|
|
51
|
+
(Z) => b(Z).toLowerCase().includes(t.toLowerCase())
|
|
50
52
|
);
|
|
51
|
-
|
|
53
|
+
p(m);
|
|
52
54
|
}
|
|
53
55
|
}, j = (e) => {
|
|
54
|
-
if (
|
|
55
|
-
const
|
|
56
|
-
k(
|
|
57
|
-
},
|
|
58
|
-
if (!
|
|
56
|
+
if (a) return;
|
|
57
|
+
const t = n.includes(e) ? n.filter((m) => m !== e) : [...n, e];
|
|
58
|
+
k(t);
|
|
59
|
+
}, q = (e) => {
|
|
60
|
+
if (!a)
|
|
59
61
|
if (x)
|
|
60
62
|
x(e);
|
|
61
63
|
else {
|
|
62
|
-
const
|
|
63
|
-
k(
|
|
64
|
+
const t = n.filter((m) => m !== e);
|
|
65
|
+
k(t);
|
|
64
66
|
}
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
return /* @__PURE__ */
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
}, H = () => {
|
|
68
|
+
a || !l?.onClick || l.onClick();
|
|
69
|
+
}, J = (e, t) => e?.length <= t ? e : e?.substring(0, t) + "...", I = n.map((e) => o.find((t) => t[r] === e)).filter(Boolean), Q = l && !a && n.length >= l.length, Y = I.slice(0, v), $ = I.length - v;
|
|
70
|
+
return /* @__PURE__ */ s.jsxs("div", { className: f("w-full", D && "w-full", L), children: [
|
|
71
|
+
E && /* @__PURE__ */ s.jsx(
|
|
72
|
+
se,
|
|
71
73
|
{
|
|
72
74
|
htmlFor: i,
|
|
73
|
-
className: f("mb-2 block",
|
|
74
|
-
children:
|
|
75
|
+
className: f("mb-2 block", a && "opacity-50"),
|
|
76
|
+
children: E
|
|
75
77
|
}
|
|
76
78
|
),
|
|
77
|
-
|
|
79
|
+
O && !u && /* @__PURE__ */ s.jsx(
|
|
78
80
|
C,
|
|
79
81
|
{
|
|
80
82
|
variant: "sm",
|
|
81
83
|
className: f(
|
|
82
84
|
"text-muted-foreground mb-2",
|
|
83
|
-
|
|
85
|
+
a && "opacity-50"
|
|
84
86
|
),
|
|
85
|
-
children:
|
|
87
|
+
children: O
|
|
86
88
|
}
|
|
87
89
|
),
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ s.jsxs(A, { open: c, onOpenChange: S, children: [
|
|
91
|
+
/* @__PURE__ */ s.jsx(P, { asChild: !0, children: /* @__PURE__ */ s.jsxs(
|
|
90
92
|
"button",
|
|
91
93
|
{
|
|
92
|
-
ref:
|
|
94
|
+
ref: M,
|
|
93
95
|
id: i,
|
|
94
96
|
type: "button",
|
|
95
|
-
disabled:
|
|
97
|
+
disabled: a,
|
|
96
98
|
role: "combobox",
|
|
97
99
|
"aria-expanded": c,
|
|
98
100
|
"aria-haspopup": "listbox",
|
|
@@ -100,17 +102,17 @@ const te = ({ message: n = "No results" }) => /* @__PURE__ */ t.jsx("div", { cla
|
|
|
100
102
|
className: f(
|
|
101
103
|
"flex h-auto min-h-[38px] w-full items-center justify-between gap-2 rounded-md border border-input bg-input px-3 py-1.5 text-sm shadow-xs 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:opacity-50",
|
|
102
104
|
u && "border-destructive",
|
|
103
|
-
|
|
105
|
+
D && "w-full"
|
|
104
106
|
),
|
|
105
107
|
children: [
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
|
|
108
|
+
/* @__PURE__ */ s.jsx("div", { className: "flex flex-wrap gap-1 flex-1 items-center", children: n.length === 0 ? /* @__PURE__ */ s.jsx("span", { className: "text-muted-foreground", children: K }) : /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
|
|
109
|
+
Q && /* @__PURE__ */ s.jsx(
|
|
108
110
|
"div",
|
|
109
111
|
{
|
|
110
112
|
onClick: (e) => {
|
|
111
|
-
e.preventDefault(), e.stopPropagation(),
|
|
113
|
+
e.preventDefault(), e.stopPropagation(), H();
|
|
112
114
|
},
|
|
113
|
-
children: /* @__PURE__ */
|
|
115
|
+
children: /* @__PURE__ */ s.jsx(
|
|
114
116
|
N,
|
|
115
117
|
{
|
|
116
118
|
variant: "secondary",
|
|
@@ -120,28 +122,28 @@ const te = ({ message: n = "No results" }) => /* @__PURE__ */ t.jsx("div", { cla
|
|
|
120
122
|
)
|
|
121
123
|
}
|
|
122
124
|
),
|
|
123
|
-
|
|
125
|
+
Y.map((e) => /* @__PURE__ */ s.jsx(
|
|
124
126
|
"div",
|
|
125
127
|
{
|
|
126
|
-
onClick: (
|
|
127
|
-
x && !
|
|
128
|
+
onClick: (t) => {
|
|
129
|
+
x && !a && (t.preventDefault(), t.stopPropagation(), q(e[r]));
|
|
128
130
|
},
|
|
129
|
-
children: /* @__PURE__ */
|
|
131
|
+
children: F ? F(e) : /* @__PURE__ */ s.jsx(
|
|
130
132
|
N,
|
|
131
133
|
{
|
|
132
134
|
variant: "outline",
|
|
133
135
|
className: "gap-1 flex items-center",
|
|
134
|
-
endIcon: x && !
|
|
135
|
-
children:
|
|
136
|
+
endIcon: x && !a ? "X" : void 0,
|
|
137
|
+
children: J(b(e), 8)
|
|
136
138
|
}
|
|
137
139
|
)
|
|
138
140
|
},
|
|
139
141
|
e[r]
|
|
140
142
|
)),
|
|
141
|
-
|
|
143
|
+
$ > 0 && /* @__PURE__ */ s.jsx(N, { variant: "outline", className: "flex items-center", children: `+${$}` })
|
|
142
144
|
] }) }),
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
|
|
145
|
+
/* @__PURE__ */ s.jsx(
|
|
146
|
+
B,
|
|
145
147
|
{
|
|
146
148
|
name: "CaretUpDown",
|
|
147
149
|
size: "sm",
|
|
@@ -154,82 +156,85 @@ const te = ({ message: n = "No results" }) => /* @__PURE__ */ t.jsx("div", { cla
|
|
|
154
156
|
]
|
|
155
157
|
}
|
|
156
158
|
) }),
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
-
|
|
159
|
+
/* @__PURE__ */ s.jsx(
|
|
160
|
+
ee,
|
|
159
161
|
{
|
|
160
162
|
className: "p-0",
|
|
161
163
|
align: "start",
|
|
162
|
-
style: { maxHeight:
|
|
164
|
+
style: { maxHeight: g },
|
|
163
165
|
id: i ? `${i}-listbox` : void 0,
|
|
164
166
|
role: "listbox",
|
|
165
|
-
children: /* @__PURE__ */
|
|
166
|
-
d &&
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
-
|
|
167
|
+
children: /* @__PURE__ */ s.jsxs("div", { className: "flex flex-col", children: [
|
|
168
|
+
d && o.length > 0 && /* @__PURE__ */ s.jsxs("div", { className: "flex items-center gap-2 px-3 py-2 border-b", children: [
|
|
169
|
+
/* @__PURE__ */ s.jsx(
|
|
170
|
+
B,
|
|
169
171
|
{
|
|
170
172
|
name: "MagnifyingGlass",
|
|
171
173
|
size: "sm",
|
|
172
174
|
className: "text-muted-foreground"
|
|
173
175
|
}
|
|
174
176
|
),
|
|
175
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ s.jsx(
|
|
176
178
|
"input",
|
|
177
179
|
{
|
|
178
180
|
ref: h,
|
|
179
181
|
type: "text",
|
|
180
182
|
placeholder: w,
|
|
181
|
-
value:
|
|
182
|
-
onChange:
|
|
183
|
+
value: U,
|
|
184
|
+
onChange: X,
|
|
183
185
|
onKeyDown: (e) => {
|
|
184
|
-
e.stopPropagation(), e.key === "Escape" &&
|
|
186
|
+
e.stopPropagation(), e.key === "Escape" && S(!1);
|
|
185
187
|
},
|
|
186
188
|
className: "flex-1 outline-none bg-transparent text-sm placeholder:text-muted-foreground",
|
|
187
189
|
"aria-label": w
|
|
188
190
|
}
|
|
189
191
|
)
|
|
190
192
|
] }),
|
|
191
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ s.jsx(
|
|
192
194
|
"div",
|
|
193
195
|
{
|
|
194
196
|
className: "overflow-y-auto",
|
|
195
197
|
style: {
|
|
196
|
-
maxHeight: d ?
|
|
198
|
+
maxHeight: d ? g - 48 : g
|
|
197
199
|
},
|
|
198
|
-
children:
|
|
200
|
+
children: T.length > 0 ? T.map((e) => /* @__PURE__ */ s.jsx(
|
|
199
201
|
"div",
|
|
200
202
|
{
|
|
201
203
|
role: "option",
|
|
202
204
|
"aria-selected": n.includes(e[r]),
|
|
203
205
|
className: "flex items-center gap-2 px-3 py-2 cursor-pointer hover:bg-accent transition-colors",
|
|
204
206
|
onClick: () => j(e[r]),
|
|
205
|
-
onKeyDown: (
|
|
206
|
-
(
|
|
207
|
+
onKeyDown: (t) => {
|
|
208
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), j(e[r]));
|
|
207
209
|
},
|
|
208
|
-
children:
|
|
209
|
-
|
|
210
|
-
|
|
210
|
+
children: R ? R(
|
|
211
|
+
e,
|
|
212
|
+
n.includes(e[r])
|
|
213
|
+
) : /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
|
|
214
|
+
/* @__PURE__ */ s.jsx(
|
|
215
|
+
te,
|
|
211
216
|
{
|
|
212
217
|
checked: n.includes(e[r]),
|
|
213
218
|
onChange: () => j(e[r]),
|
|
214
|
-
onClick: (
|
|
219
|
+
onClick: (t) => t.stopPropagation()
|
|
215
220
|
}
|
|
216
221
|
),
|
|
217
|
-
/* @__PURE__ */
|
|
218
|
-
]
|
|
222
|
+
/* @__PURE__ */ s.jsx("span", { className: "text-sm flex-1", children: b(e) })
|
|
223
|
+
] })
|
|
219
224
|
},
|
|
220
225
|
e[r]
|
|
221
|
-
)) :
|
|
226
|
+
)) : G
|
|
222
227
|
}
|
|
223
228
|
)
|
|
224
229
|
] })
|
|
225
230
|
}
|
|
226
231
|
)
|
|
227
232
|
] }),
|
|
228
|
-
u && /* @__PURE__ */
|
|
233
|
+
u && /* @__PURE__ */ s.jsx(C, { variant: "sm", className: "text-destructive mt-2", children: u })
|
|
229
234
|
] });
|
|
230
235
|
}
|
|
231
236
|
);
|
|
232
|
-
|
|
237
|
+
re.displayName = "Combobox";
|
|
233
238
|
export {
|
|
234
|
-
|
|
239
|
+
re as Combobox
|
|
235
240
|
};
|
|
@@ -30,12 +30,12 @@ export interface ComboboxProps {
|
|
|
30
30
|
options: ComboboxOption[];
|
|
31
31
|
/**
|
|
32
32
|
* Placeholder text when no options are selected
|
|
33
|
-
* @default "Select
|
|
33
|
+
* @default "Select"
|
|
34
34
|
*/
|
|
35
35
|
selectPlaceholder?: string;
|
|
36
36
|
/**
|
|
37
37
|
* Placeholder text for the search input
|
|
38
|
-
* @default "Search
|
|
38
|
+
* @default "Search"
|
|
39
39
|
*/
|
|
40
40
|
searchPlaceholder?: string;
|
|
41
41
|
/**
|
|
@@ -117,4 +117,16 @@ export interface ComboboxProps {
|
|
|
117
117
|
* HTML id attribute
|
|
118
118
|
*/
|
|
119
119
|
id?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Custom render function for each option in the dropdown list.
|
|
122
|
+
* Replaces inner content only — the wrapper with role="option",
|
|
123
|
+
* click handlers, and hover styles is always provided by the Combobox.
|
|
124
|
+
*/
|
|
125
|
+
renderOption?: (option: ComboboxOption, isSelected: boolean) => ReactNode;
|
|
126
|
+
/**
|
|
127
|
+
* Custom render function for each selected chip in the trigger area.
|
|
128
|
+
* Replaces the default truncated Badge — the wrapper div with
|
|
129
|
+
* remove-on-click behavior is always provided by the Combobox.
|
|
130
|
+
*/
|
|
131
|
+
renderChip?: (option: ComboboxOption) => ReactNode;
|
|
120
132
|
}
|
|
@@ -101,7 +101,7 @@ const q = g(
|
|
|
101
101
|
items: t,
|
|
102
102
|
className: c,
|
|
103
103
|
searchable: m = !1,
|
|
104
|
-
searchPlaceholder: u = "Search
|
|
104
|
+
searchPlaceholder: u = "Search",
|
|
105
105
|
showActions: d = !1,
|
|
106
106
|
enableSelectAll: b = !0,
|
|
107
107
|
enableInverse: v = !0,
|
|
@@ -260,7 +260,7 @@ const D = g(
|
|
|
260
260
|
({
|
|
261
261
|
children: s,
|
|
262
262
|
showSearch: l = !1,
|
|
263
|
-
searchPlaceholder: n = "Search
|
|
263
|
+
searchPlaceholder: n = "Search",
|
|
264
264
|
searchValue: t,
|
|
265
265
|
onSearchChange: c,
|
|
266
266
|
className: m
|
|
@@ -22,7 +22,7 @@ export interface SearchValue {
|
|
|
22
22
|
export interface SearchFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "className"> {
|
|
23
23
|
/**
|
|
24
24
|
* Placeholder text for the input
|
|
25
|
-
* @default "Search
|
|
25
|
+
* @default "Search"
|
|
26
26
|
*/
|
|
27
27
|
placeholder?: string;
|
|
28
28
|
/**
|
|
@@ -21,7 +21,7 @@ const W = r.forwardRef(
|
|
|
21
21
|
groups: o = [],
|
|
22
22
|
className: E,
|
|
23
23
|
id: g,
|
|
24
|
-
searchPlaceholder: z = "Search
|
|
24
|
+
searchPlaceholder: z = "Search",
|
|
25
25
|
maxHeight: F = 300
|
|
26
26
|
}, I) => {
|
|
27
27
|
const [i, C] = r.useState(!1), [v, S] = r.useState(""), d = o.length > 0, w = c.length > 0, R = r.useCallback(() => {
|