@konstructio/ui 0.1.2-alpha.37 → 0.1.2-alpha.39
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/chevron-up-CRyLc5Ml.js +54 -0
- package/dist/components/Dropdown/components/Wrapper.js +71 -66
- package/dist/components/MultiSelectDropdown/MultiSelectDropdown.js +21 -0
- package/dist/components/MultiSelectDropdown/MultiSelectDropdown.variants.js +34 -0
- package/dist/components/MultiSelectDropdown/components/Item/Item.js +33 -0
- package/dist/components/MultiSelectDropdown/components/Item/Item.variants.js +38 -0
- package/dist/components/MultiSelectDropdown/components/List/List.js +29 -0
- package/dist/components/MultiSelectDropdown/components/List/List.variants.js +23 -0
- package/dist/components/MultiSelectDropdown/components/Wrapper/Wrapper.js +96 -0
- package/dist/components/MultiSelectDropdown/components/index.js +8 -0
- package/dist/components/MultiSelectDropdown/contexts/MultiSelectDropdown.context.js +19 -0
- package/dist/components/MultiSelectDropdown/contexts/MultiSelectDropdown.hook.js +13 -0
- package/dist/components/MultiSelectDropdown/contexts/MultiSelectDropdown.provider.js +119 -0
- package/dist/components/MultiSelectDropdown/contexts/index.js +6 -0
- package/dist/components/MultiSelectDropdown/hooks/useMultiSelectDropdown.js +32 -0
- package/dist/components/Tag/Tag.variants.js +1 -0
- package/dist/components/TagSelect/components/Wrapper/Wrapper.js +49 -98
- package/dist/components/index.js +84 -82
- package/dist/index.d.ts +35 -1
- package/dist/index.js +92 -90
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import l, { forwardRef as c } from "react";
|
|
2
|
+
import { P as a } from "./index--V_ZsiQe.js";
|
|
3
|
+
function p() {
|
|
4
|
+
return p = Object.assign || function(e) {
|
|
5
|
+
for (var o = 1; o < arguments.length; o++) {
|
|
6
|
+
var t = arguments[o];
|
|
7
|
+
for (var r in t)
|
|
8
|
+
Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]);
|
|
9
|
+
}
|
|
10
|
+
return e;
|
|
11
|
+
}, p.apply(this, arguments);
|
|
12
|
+
}
|
|
13
|
+
function u(e, o) {
|
|
14
|
+
if (e == null) return {};
|
|
15
|
+
var t = v(e, o), r, n;
|
|
16
|
+
if (Object.getOwnPropertySymbols) {
|
|
17
|
+
var i = Object.getOwnPropertySymbols(e);
|
|
18
|
+
for (n = 0; n < i.length; n++)
|
|
19
|
+
r = i[n], !(o.indexOf(r) >= 0) && Object.prototype.propertyIsEnumerable.call(e, r) && (t[r] = e[r]);
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
}
|
|
23
|
+
function v(e, o) {
|
|
24
|
+
if (e == null) return {};
|
|
25
|
+
var t = {}, r = Object.keys(e), n, i;
|
|
26
|
+
for (i = 0; i < r.length; i++)
|
|
27
|
+
n = r[i], !(o.indexOf(n) >= 0) && (t[n] = e[n]);
|
|
28
|
+
return t;
|
|
29
|
+
}
|
|
30
|
+
var s = c(function(e, o) {
|
|
31
|
+
var t = e.color, r = t === void 0 ? "currentColor" : t, n = e.size, i = n === void 0 ? 24 : n, f = u(e, ["color", "size"]);
|
|
32
|
+
return /* @__PURE__ */ l.createElement("svg", p({
|
|
33
|
+
ref: o,
|
|
34
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
35
|
+
width: i,
|
|
36
|
+
height: i,
|
|
37
|
+
viewBox: "0 0 24 24",
|
|
38
|
+
fill: "none",
|
|
39
|
+
stroke: r,
|
|
40
|
+
strokeWidth: "2",
|
|
41
|
+
strokeLinecap: "round",
|
|
42
|
+
strokeLinejoin: "round"
|
|
43
|
+
}, f), /* @__PURE__ */ l.createElement("polyline", {
|
|
44
|
+
points: "18 15 12 9 6 15"
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
s.propTypes = {
|
|
48
|
+
color: a.string,
|
|
49
|
+
size: a.oneOfType([a.string, a.number])
|
|
50
|
+
};
|
|
51
|
+
s.displayName = "ChevronUp";
|
|
52
|
+
export {
|
|
53
|
+
s as C
|
|
54
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as m, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as Z, useId as ee, useRef as C, useMemo as te, useImperativeHandle as ae, useEffect as re } from "react";
|
|
3
3
|
import { S as ne } from "../../../loader-juvMSJ9L.js";
|
|
4
4
|
import { Typography as se } from "../../Typography/Typography.js";
|
|
@@ -12,27 +12,27 @@ import { useDropdownContext as fe } from "../contexts/dropdown.hook.js";
|
|
|
12
12
|
const de = [
|
|
13
13
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
14
14
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
15
|
-
], xe = ue("search", de),
|
|
15
|
+
], xe = ue("search", de), je = Z(
|
|
16
16
|
({
|
|
17
|
-
additionalOptions:
|
|
18
|
-
className:
|
|
17
|
+
additionalOptions: b,
|
|
18
|
+
className: z,
|
|
19
19
|
defaultValue: x,
|
|
20
|
-
disabled:
|
|
21
|
-
error:
|
|
20
|
+
disabled: t = !1,
|
|
21
|
+
error: f,
|
|
22
22
|
iconClassName: R,
|
|
23
23
|
inputClassName: F,
|
|
24
|
-
isLoading:
|
|
24
|
+
isLoading: g,
|
|
25
25
|
isRequired: h,
|
|
26
26
|
label: v,
|
|
27
|
-
labelClassName:
|
|
28
|
-
listClassName:
|
|
29
|
-
listItemClassName:
|
|
30
|
-
listItemSecondRowClassName:
|
|
31
|
-
name:
|
|
32
|
-
placeholder:
|
|
33
|
-
searchable:
|
|
34
|
-
showSearchIcon:
|
|
35
|
-
theme:
|
|
27
|
+
labelClassName: S,
|
|
28
|
+
listClassName: T,
|
|
29
|
+
listItemClassName: D,
|
|
30
|
+
listItemSecondRowClassName: E,
|
|
31
|
+
name: d,
|
|
32
|
+
placeholder: w,
|
|
33
|
+
searchable: k = !1,
|
|
34
|
+
showSearchIcon: N,
|
|
35
|
+
theme: M,
|
|
36
36
|
wrapperClassName: W,
|
|
37
37
|
isInfiniteScrollEnabled: _ = !1,
|
|
38
38
|
onFetchMoreOptions: $,
|
|
@@ -50,104 +50,109 @@ const de = [
|
|
|
50
50
|
setSearchTerm: G,
|
|
51
51
|
setCanFilter: J,
|
|
52
52
|
toggleOpen: K
|
|
53
|
-
} = fe(), e = te(() => n.find(({ value:
|
|
53
|
+
} = fe(), e = te(() => n.find(({ value: a }) => a === s), [n, s]), { wrapperRef: Q, wrapperInputRef: V, handleOpen: j } = ce({
|
|
54
54
|
ulRef: L,
|
|
55
55
|
inputRef: l,
|
|
56
|
-
disabled:
|
|
56
|
+
disabled: t,
|
|
57
57
|
internalValue: e,
|
|
58
58
|
onBlur: H
|
|
59
|
-
}), p =
|
|
59
|
+
}), p = d ? `${I}-${d}` : I;
|
|
60
60
|
ae(q, () => l.current, [l]), re(() => {
|
|
61
61
|
if (x && !s) {
|
|
62
|
-
const
|
|
63
|
-
|
|
62
|
+
const a = n && n.find((u) => u.value === x);
|
|
63
|
+
a && c(a.value);
|
|
64
64
|
}
|
|
65
65
|
}, [x, n, c, s]);
|
|
66
|
-
const X = (
|
|
67
|
-
const u =
|
|
66
|
+
const X = (a) => {
|
|
67
|
+
const u = a.target.value;
|
|
68
68
|
J(!0), c(""), G(u ?? ""), P?.(u);
|
|
69
|
-
const
|
|
69
|
+
const O = n.find(
|
|
70
70
|
(Y) => Y.value.toLocaleLowerCase() === u.toLocaleLowerCase()
|
|
71
71
|
);
|
|
72
|
-
c(
|
|
72
|
+
c(O ? O.value : e?.value ?? "");
|
|
73
73
|
};
|
|
74
|
-
return /* @__PURE__ */
|
|
74
|
+
return /* @__PURE__ */ m(
|
|
75
75
|
"div",
|
|
76
76
|
{
|
|
77
77
|
ref: Q,
|
|
78
78
|
className: o("flex flex-col w-full relative", W),
|
|
79
|
-
"data-theme":
|
|
79
|
+
"data-theme": M,
|
|
80
80
|
children: [
|
|
81
|
-
v ? /* @__PURE__ */
|
|
81
|
+
v ? /* @__PURE__ */ m(
|
|
82
82
|
"label",
|
|
83
83
|
{
|
|
84
84
|
id: p,
|
|
85
|
-
className: o(oe({ className:
|
|
85
|
+
className: o(oe({ className: S })),
|
|
86
86
|
htmlFor: p,
|
|
87
|
-
onClick: () => !
|
|
87
|
+
onClick: () => !t && j(),
|
|
88
88
|
children: [
|
|
89
89
|
v,
|
|
90
|
-
h && /* @__PURE__ */
|
|
90
|
+
h && /* @__PURE__ */ r("span", { className: "text-red-600 ml-1", children: "*" })
|
|
91
91
|
]
|
|
92
92
|
}
|
|
93
93
|
) : null,
|
|
94
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ m(
|
|
95
95
|
"div",
|
|
96
96
|
{
|
|
97
|
-
ref:
|
|
97
|
+
ref: V,
|
|
98
98
|
id: p,
|
|
99
99
|
className: o(
|
|
100
|
-
ie({ className:
|
|
100
|
+
ie({ className: z, hasError: !!f, disabled: t })
|
|
101
101
|
),
|
|
102
102
|
role: "combobox",
|
|
103
|
-
onClick: () => !
|
|
103
|
+
onClick: () => !t && K(!i),
|
|
104
104
|
"aria-expanded": i,
|
|
105
105
|
tabIndex: A.current,
|
|
106
106
|
"aria-labelledby": p,
|
|
107
107
|
children: [
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
e?.leftIcon && !
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
/* @__PURE__ */ m("div", { className: "flex gap-2.5 items-center flex-1", children: [
|
|
109
|
+
e?.leftIcon && !N && /* @__PURE__ */ r("span", { className: "w-4 h-4 flex justify-center items-center dark:text-slate-50", children: e.leftIcon }),
|
|
110
|
+
N && /* @__PURE__ */ r(xe, { className: "w-4 h-4 text-zinc-500 select-none dark:text-slate-300 dark:group-focus-within:text-slate-50 transition-colors duration-300" }),
|
|
111
|
+
k ? /* @__PURE__ */ r(
|
|
112
112
|
"input",
|
|
113
113
|
{
|
|
114
114
|
type: "text",
|
|
115
115
|
value: i ? B : e?.label ?? s ?? "",
|
|
116
116
|
onChange: X,
|
|
117
|
-
placeholder:
|
|
117
|
+
placeholder: w,
|
|
118
118
|
className: o(le({ className: F }), {
|
|
119
|
-
"text-red-700 placeholder:text-red-700": !!
|
|
119
|
+
"text-red-700 placeholder:text-red-700": !!f
|
|
120
120
|
}),
|
|
121
|
-
onClick: (
|
|
122
|
-
|
|
121
|
+
onClick: (a) => {
|
|
122
|
+
a.stopPropagation(), t || j();
|
|
123
123
|
},
|
|
124
|
-
"aria-label": v ||
|
|
124
|
+
"aria-label": v || w,
|
|
125
125
|
"aria-labelledby": p,
|
|
126
126
|
required: h,
|
|
127
127
|
autoComplete: "off",
|
|
128
128
|
autoCapitalize: "words",
|
|
129
|
-
disabled:
|
|
129
|
+
disabled: t,
|
|
130
130
|
tabIndex: -1,
|
|
131
131
|
...y
|
|
132
132
|
}
|
|
133
|
-
) : /* @__PURE__ */
|
|
133
|
+
) : /* @__PURE__ */ m(
|
|
134
134
|
se,
|
|
135
135
|
{
|
|
136
136
|
variant: "body2",
|
|
137
137
|
className: o(
|
|
138
|
-
"flex-1 text-zinc-400 text-sm dark:text-slate-400",
|
|
138
|
+
"flex-1 text-zinc-400 text-sm dark:text-slate-400 flex gap-2 items-center",
|
|
139
139
|
{
|
|
140
|
-
"text-red-700": !!
|
|
140
|
+
"text-red-700": !!f,
|
|
141
141
|
"select-none": !e,
|
|
142
142
|
"text-slate-800 dark:text-slate-50": e,
|
|
143
|
-
"text-slate-400/50 dark:text-slate-50/50":
|
|
144
|
-
}
|
|
143
|
+
"text-slate-400/50 dark:text-slate-50/50": t
|
|
144
|
+
},
|
|
145
|
+
e?.wrapperClassNameOnSelectedValue
|
|
145
146
|
),
|
|
146
|
-
children:
|
|
147
|
+
children: [
|
|
148
|
+
e?.label || w,
|
|
149
|
+
" ",
|
|
150
|
+
e?.showRightComponentOnselectedValue ? e?.rightComponent : null
|
|
151
|
+
]
|
|
147
152
|
}
|
|
148
153
|
)
|
|
149
154
|
] }),
|
|
150
|
-
|
|
155
|
+
g ? /* @__PURE__ */ r(ne, { className: "w-4 h-4 text-slate-400 animate-spin select-none" }) : !N && /* @__PURE__ */ r(
|
|
151
156
|
me,
|
|
152
157
|
{
|
|
153
158
|
"data-state": i ? "open" : "closed",
|
|
@@ -155,8 +160,8 @@ const de = [
|
|
|
155
160
|
"w-4 h-4 text-zinc-500 transition-all duration-100 data-[state=open]:rotate-0 data-[state=closed]:rotate-180 select-none dark:group-focus-within:text-slate-50",
|
|
156
161
|
R,
|
|
157
162
|
{
|
|
158
|
-
"text-red-700": !!
|
|
159
|
-
"text-slate-400/50 dark:group-focus-within:text-zinc-500":
|
|
163
|
+
"text-red-700": !!f,
|
|
164
|
+
"text-slate-400/50 dark:group-focus-within:text-zinc-500": t
|
|
160
165
|
}
|
|
161
166
|
)
|
|
162
167
|
}
|
|
@@ -164,12 +169,12 @@ const de = [
|
|
|
164
169
|
]
|
|
165
170
|
}
|
|
166
171
|
),
|
|
167
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ r(
|
|
168
173
|
"input",
|
|
169
174
|
{
|
|
170
175
|
ref: l,
|
|
171
176
|
type: "text",
|
|
172
|
-
name:
|
|
177
|
+
name: d,
|
|
173
178
|
className: "hidden",
|
|
174
179
|
"aria-hidden": "true",
|
|
175
180
|
required: h,
|
|
@@ -178,20 +183,20 @@ const de = [
|
|
|
178
183
|
...y
|
|
179
184
|
}
|
|
180
185
|
),
|
|
181
|
-
i && /* @__PURE__ */
|
|
186
|
+
i && /* @__PURE__ */ r(
|
|
182
187
|
pe,
|
|
183
188
|
{
|
|
184
189
|
ref: L,
|
|
185
|
-
additionalOptions:
|
|
186
|
-
className:
|
|
187
|
-
itemClassName:
|
|
188
|
-
name:
|
|
189
|
-
wrapperInputRef:
|
|
190
|
+
additionalOptions: b,
|
|
191
|
+
className: T,
|
|
192
|
+
itemClassName: D,
|
|
193
|
+
name: d,
|
|
194
|
+
wrapperInputRef: V,
|
|
190
195
|
inputRef: l,
|
|
191
196
|
options: n,
|
|
192
|
-
isLoading: !!
|
|
193
|
-
searchable:
|
|
194
|
-
listItemSecondRowClassName:
|
|
197
|
+
isLoading: !!g,
|
|
198
|
+
searchable: k,
|
|
199
|
+
listItemSecondRowClassName: E,
|
|
195
200
|
isInfiniteScrollEnabled: _,
|
|
196
201
|
onFetchMoreOptions: $,
|
|
197
202
|
noOptionsText: U
|
|
@@ -203,5 +208,5 @@ const de = [
|
|
|
203
208
|
}
|
|
204
209
|
);
|
|
205
210
|
export {
|
|
206
|
-
|
|
211
|
+
je as Wrapper
|
|
207
212
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as l } from "react";
|
|
3
|
+
import { MultiSelectDropdownProvider as c } from "./contexts/MultiSelectDropdown.provider.js";
|
|
4
|
+
import { Wrapper as n } from "./components/Wrapper/Wrapper.js";
|
|
5
|
+
const x = l(
|
|
6
|
+
({ options: t, multiselect: p, value: e, onChange: i, onBlur: f, name: r, ...m }, d) => /* @__PURE__ */ o(
|
|
7
|
+
c,
|
|
8
|
+
{
|
|
9
|
+
defaultOptions: t,
|
|
10
|
+
multiselect: p,
|
|
11
|
+
value: e,
|
|
12
|
+
onChange: i,
|
|
13
|
+
onBlur: f,
|
|
14
|
+
name: r,
|
|
15
|
+
children: /* @__PURE__ */ o(n, { ref: d, ...m, name: r })
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
);
|
|
19
|
+
export {
|
|
20
|
+
x as MultiSelectDropdown
|
|
21
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { c as t } from "../../index-D29mdTf5.js";
|
|
2
|
+
const r = t([
|
|
3
|
+
"flex",
|
|
4
|
+
"flex-col",
|
|
5
|
+
"w-full",
|
|
6
|
+
"relative",
|
|
7
|
+
"text-slate-500",
|
|
8
|
+
"mb-1",
|
|
9
|
+
"cursor-pointer",
|
|
10
|
+
"text-sm",
|
|
11
|
+
"leading-5",
|
|
12
|
+
"tracking-[0.1px]",
|
|
13
|
+
"dark:text-slate-50"
|
|
14
|
+
]), a = t(["cursor-pointer", "mb-1"]), o = t([
|
|
15
|
+
"h-9",
|
|
16
|
+
"border",
|
|
17
|
+
"cursor-pointer",
|
|
18
|
+
"duration-250",
|
|
19
|
+
"ease-in-out",
|
|
20
|
+
"flex",
|
|
21
|
+
"items-center",
|
|
22
|
+
"justify-between",
|
|
23
|
+
"px-2",
|
|
24
|
+
"py-1",
|
|
25
|
+
"rounded-md",
|
|
26
|
+
"transition-all",
|
|
27
|
+
"w-full",
|
|
28
|
+
"border-gray-200"
|
|
29
|
+
]);
|
|
30
|
+
export {
|
|
31
|
+
a as labelVariants,
|
|
32
|
+
o as multiSelectDropdownVariants,
|
|
33
|
+
r as wrapperVariants
|
|
34
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { cn as m } from "../../../../utils/index.js";
|
|
3
|
+
import { wrapperVariants as i } from "./Item.variants.js";
|
|
4
|
+
import { useMultiSelectDropdown as s } from "../../contexts/MultiSelectDropdown.hook.js";
|
|
5
|
+
import { Typography as c } from "../../../Typography/Typography.js";
|
|
6
|
+
import { Tag as p } from "../../../Tag/Tag.js";
|
|
7
|
+
const x = ({ option: r, theme: a, isSelected: o }) => {
|
|
8
|
+
const { onSelectOption: e } = s();
|
|
9
|
+
return /* @__PURE__ */ l(
|
|
10
|
+
"li",
|
|
11
|
+
{
|
|
12
|
+
role: "option",
|
|
13
|
+
"data-theme": a,
|
|
14
|
+
className: m(i({ isSelected: o })),
|
|
15
|
+
onClick: () => e(r),
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ t(c, { variant: "body2", className: "text-slate-800", children: r.label }),
|
|
18
|
+
/* @__PURE__ */ t(
|
|
19
|
+
p,
|
|
20
|
+
{
|
|
21
|
+
id: r.id,
|
|
22
|
+
label: r.tagLabel,
|
|
23
|
+
color: r.tagColor,
|
|
24
|
+
isSelected: o
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
x as Item
|
|
33
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { c as e } from "../../../../index-D29mdTf5.js";
|
|
2
|
+
const r = e(
|
|
3
|
+
[
|
|
4
|
+
"cursor-pointer",
|
|
5
|
+
"py-1.5",
|
|
6
|
+
"px-2",
|
|
7
|
+
"last:pb-2",
|
|
8
|
+
"first:pt-2",
|
|
9
|
+
"h-full",
|
|
10
|
+
"hover:bg-gray-50",
|
|
11
|
+
"focus:bg-gray-50",
|
|
12
|
+
"dark:hover:bg-slate-700",
|
|
13
|
+
"dark:focus:bg-slate-700",
|
|
14
|
+
"flex",
|
|
15
|
+
"items-center",
|
|
16
|
+
"gap-4"
|
|
17
|
+
],
|
|
18
|
+
{
|
|
19
|
+
variants: {
|
|
20
|
+
isSelected: {
|
|
21
|
+
true: "",
|
|
22
|
+
false: ""
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
compoundVariants: [
|
|
26
|
+
{
|
|
27
|
+
isSelected: !0,
|
|
28
|
+
class: ["bg-slate-50"]
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
isSelected: !1
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
export {
|
|
37
|
+
r as wrapperVariants
|
|
38
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { cn as s } from "../../../../utils/index.js";
|
|
3
|
+
import { Item as a } from "../Item/Item.js";
|
|
4
|
+
import { wrapperVariants as p } from "./List.variants.js";
|
|
5
|
+
import { useMultiSelectDropdown as l } from "../../contexts/MultiSelectDropdown.hook.js";
|
|
6
|
+
import { Typography as c } from "../../../Typography/Typography.js";
|
|
7
|
+
const y = ({ theme: o }) => {
|
|
8
|
+
const { options: r, selectedOptions: i } = l();
|
|
9
|
+
return /* @__PURE__ */ e("ul", { role: "listbox", "data-theme": o, className: s(p()), children: r.length > 0 ? r.map((t) => /* @__PURE__ */ e(
|
|
10
|
+
a,
|
|
11
|
+
{
|
|
12
|
+
option: t,
|
|
13
|
+
isSelected: i.some(
|
|
14
|
+
(m) => m.id === t.id
|
|
15
|
+
)
|
|
16
|
+
},
|
|
17
|
+
t.id
|
|
18
|
+
)) : /* @__PURE__ */ e(
|
|
19
|
+
c,
|
|
20
|
+
{
|
|
21
|
+
variant: "body2",
|
|
22
|
+
className: "text-zinc-800 dark:text-slate-50 italic px-2 py-2",
|
|
23
|
+
children: "No options"
|
|
24
|
+
}
|
|
25
|
+
) });
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
y as List
|
|
29
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { c as o } from "../../../../index-D29mdTf5.js";
|
|
2
|
+
const a = o([
|
|
3
|
+
"absolute",
|
|
4
|
+
"bg-white",
|
|
5
|
+
"border",
|
|
6
|
+
"duration-100",
|
|
7
|
+
"flex",
|
|
8
|
+
"flex-col",
|
|
9
|
+
"mt-0.5",
|
|
10
|
+
"rounded",
|
|
11
|
+
"shadow-xs",
|
|
12
|
+
"top-full",
|
|
13
|
+
"transition-all",
|
|
14
|
+
"w-full",
|
|
15
|
+
"z-10",
|
|
16
|
+
"animate-in",
|
|
17
|
+
"fade-in-50",
|
|
18
|
+
"overflow-hidden",
|
|
19
|
+
"border-gray-200"
|
|
20
|
+
]);
|
|
21
|
+
export {
|
|
22
|
+
a as wrapperVariants
|
|
23
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import "../Item/Item.js";
|
|
2
|
+
import { List as v } from "../List/List.js";
|
|
3
|
+
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
4
|
+
import * as c from "react";
|
|
5
|
+
import { forwardRef as N, useId as b, useImperativeHandle as C } from "react";
|
|
6
|
+
import { Tag as O } from "../../../Tag/Tag.js";
|
|
7
|
+
import { cn as a } from "../../../../utils/index.js";
|
|
8
|
+
import { useMultiSelectDropdown as R } from "../../hooks/useMultiSelectDropdown.js";
|
|
9
|
+
import { labelVariants as S, multiSelectDropdownVariants as k, wrapperVariants as D } from "../../MultiSelectDropdown.variants.js";
|
|
10
|
+
import { C as M } from "../../../../chevron-up-CRyLc5Ml.js";
|
|
11
|
+
import { useMultiSelectDropdown as y } from "../../contexts/MultiSelectDropdown.hook.js";
|
|
12
|
+
const I = (r) => /* @__PURE__ */ c.createElement("svg", { width: 9, height: 9, viewBox: "0 0 9 9", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...r }, /* @__PURE__ */ c.createElement("path", { d: "M8.16667 0.8225L7.34417 0L4.08333 3.26083L0.8225 0L0 0.8225L3.26083 4.08333L0 7.34417L0.8225 8.16667L4.08333 4.90583L7.34417 8.16667L8.16667 7.34417L4.90583 4.08333L8.16667 0.8225Z", fill: "#364153" })), Z = N(
|
|
13
|
+
({ label: r, labelClassName: p, name: l, placeholder: d = "", theme: h, wrapperClassName: f }, u) => {
|
|
14
|
+
const i = b(), { selectedOptions: n, isOpen: o, onOpen: w, onRemoveOption: L, inputRef: s } = y(), { wrapperRef: g, handleOpen: x } = R();
|
|
15
|
+
return C(u, () => s.current, [s]), /* @__PURE__ */ m(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
ref: g,
|
|
19
|
+
className: a(
|
|
20
|
+
D({
|
|
21
|
+
className: f
|
|
22
|
+
})
|
|
23
|
+
),
|
|
24
|
+
"data-theme": h,
|
|
25
|
+
children: [
|
|
26
|
+
r ? /* @__PURE__ */ e(
|
|
27
|
+
"label",
|
|
28
|
+
{
|
|
29
|
+
htmlFor: l ?? i,
|
|
30
|
+
className: a(
|
|
31
|
+
S({
|
|
32
|
+
className: p
|
|
33
|
+
})
|
|
34
|
+
),
|
|
35
|
+
onClick: () => w(!0),
|
|
36
|
+
children: r
|
|
37
|
+
}
|
|
38
|
+
) : null,
|
|
39
|
+
/* @__PURE__ */ m(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
id: l ?? i,
|
|
43
|
+
className: a(k()),
|
|
44
|
+
role: "combobox",
|
|
45
|
+
onClick: x,
|
|
46
|
+
"aria-expanded": o,
|
|
47
|
+
children: [
|
|
48
|
+
n.length === 0 ? /* @__PURE__ */ e("span", { className: "text-base text-inherit select-none", children: d }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-2", children: n.map((t) => /* @__PURE__ */ e(
|
|
49
|
+
O,
|
|
50
|
+
{
|
|
51
|
+
id: t.id,
|
|
52
|
+
label: t.tagLabel,
|
|
53
|
+
color: t.tagColor || "gray-800",
|
|
54
|
+
className: "select-none gap-2",
|
|
55
|
+
rightIcon: /* @__PURE__ */ e(
|
|
56
|
+
I,
|
|
57
|
+
{
|
|
58
|
+
className: "w-2 h-2",
|
|
59
|
+
onClick: () => L(t)
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
"data-value": t.label
|
|
63
|
+
},
|
|
64
|
+
t.id
|
|
65
|
+
)) }),
|
|
66
|
+
/* @__PURE__ */ e(
|
|
67
|
+
M,
|
|
68
|
+
{
|
|
69
|
+
className: a(
|
|
70
|
+
"w-4 h-4 text-inherit transition-all duration-50 shrink-0",
|
|
71
|
+
o ? "rotate-0" : "rotate-180"
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ e(
|
|
79
|
+
"input",
|
|
80
|
+
{
|
|
81
|
+
ref: s,
|
|
82
|
+
type: "text",
|
|
83
|
+
name: l,
|
|
84
|
+
className: "hidden",
|
|
85
|
+
readOnly: !0
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
o ? /* @__PURE__ */ e(v, {}) : null
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
export {
|
|
95
|
+
Z as Wrapper
|
|
96
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createContext as t } from "react";
|
|
2
|
+
const n = {
|
|
3
|
+
options: [],
|
|
4
|
+
selectedOptions: [],
|
|
5
|
+
isOpen: !1,
|
|
6
|
+
inputRef: null,
|
|
7
|
+
onSelectOption() {
|
|
8
|
+
throw new Error("Function not implemented.");
|
|
9
|
+
},
|
|
10
|
+
onRemoveOption() {
|
|
11
|
+
throw new Error("Function not implemented.");
|
|
12
|
+
},
|
|
13
|
+
onOpen() {
|
|
14
|
+
throw new Error("Function not implemented.");
|
|
15
|
+
}
|
|
16
|
+
}, o = t(n);
|
|
17
|
+
export {
|
|
18
|
+
o as MultiSelectDropdownContext
|
|
19
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext as o } from "react";
|
|
2
|
+
import { MultiSelectDropdownContext as e } from "./MultiSelectDropdown.context.js";
|
|
3
|
+
const i = () => {
|
|
4
|
+
const t = o(e);
|
|
5
|
+
if (!t)
|
|
6
|
+
throw new Error(
|
|
7
|
+
"useMultiSelectDropdown must be used within a MultiSelectDropdownProvider"
|
|
8
|
+
);
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
i as useMultiSelectDropdown
|
|
13
|
+
};
|