@caspeco/casper-ui-library 8.0.3 → 8.1.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/combobox/combobox-item.d.ts +2 -1
- package/dist/components/combobox/combobox-item.d.ts.map +1 -1
- package/dist/components/combobox/combobox-item.js +12 -11
- package/dist/components/combobox/combobox-menu.d.ts +1 -1
- package/dist/components/combobox/combobox-menu.d.ts.map +1 -1
- package/dist/components/combobox/combobox-menu.js +250 -169
- package/dist/components/combobox/combobox.composition.d.ts +1 -0
- package/dist/components/combobox/combobox.composition.d.ts.map +1 -1
- package/dist/components/combobox/combobox.d.ts +1 -1
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/combobox.js +187 -148
- package/dist/components/combobox/types.d.ts +41 -0
- package/dist/components/combobox/types.d.ts.map +1 -1
- package/dist/components/icon-button/icon-button.d.ts +1 -1
- package/dist/components/icon-button/icon-button.d.ts.map +1 -1
- package/dist/components/icon-button/types.d.ts +2 -2
- package/dist/components/icon-button/types.d.ts.map +1 -1
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +123 -120
- package/package.json +6 -6
|
@@ -3,7 +3,8 @@ type ComboboxItemProps = {
|
|
|
3
3
|
item: ComboboxItemType;
|
|
4
4
|
asPlainText?: boolean;
|
|
5
5
|
isDeleting?: boolean;
|
|
6
|
+
highlightQuery?: string;
|
|
6
7
|
};
|
|
7
|
-
export declare function ComboboxItem({ item, asPlainText, isDeleting }: ComboboxItemProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function ComboboxItem({ item, asPlainText, isDeleting, highlightQuery }: ComboboxItemProps): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export {};
|
|
9
10
|
//# sourceMappingURL=combobox-item.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox-item.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox-item.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"combobox-item.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox-item.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAchE,KAAK,iBAAiB,GAAG;IACxB,IAAI,EAAE,gBAAgB,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,EAAE,iBAAiB,2CAoBhG"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Flex as
|
|
3
|
-
import { Box as
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Flex as s } from "@chakra-ui/react";
|
|
3
|
+
import { Box as n } from "../box/box.js";
|
|
4
|
+
import { Highlight as l } from "../highlight/highlight.js";
|
|
4
5
|
import { Tag as o } from "../tag/tag.js";
|
|
5
|
-
import { ThemeSpaceVariable as
|
|
6
|
-
const
|
|
6
|
+
import { ThemeSpaceVariable as m } from "../../theme/theme-types.js";
|
|
7
|
+
const f = {
|
|
7
8
|
info: o.Info,
|
|
8
9
|
success: o.Success,
|
|
9
10
|
warning: o.Warning,
|
|
@@ -13,14 +14,14 @@ const s = {
|
|
|
13
14
|
neutral: o,
|
|
14
15
|
undefined: o.ComboboxItem
|
|
15
16
|
};
|
|
16
|
-
function
|
|
17
|
-
const
|
|
18
|
-
return
|
|
17
|
+
function y({ item: r, asPlainText: d, isDeleting: p, highlightQuery: a }) {
|
|
18
|
+
const i = p ? "primary" : r.variant || "neutral", c = f[i];
|
|
19
|
+
return d ? /* @__PURE__ */ t(s, { gap: m.XSmall, overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis", children: [
|
|
19
20
|
r.prepend,
|
|
20
|
-
r.label,
|
|
21
|
+
/* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(l, { query: a ?? "", children: r.label }) }),
|
|
21
22
|
r.append
|
|
22
|
-
] }) : /* @__PURE__ */ e(
|
|
23
|
+
] }) : /* @__PURE__ */ e(n, { overflow: "hidden", children: /* @__PURE__ */ e(c, { prepend: r.prepend, append: r.append, dot: r.dot, solid: p, children: /* @__PURE__ */ e(n, { display: "block", overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis", children: /* @__PURE__ */ e(l, { query: a ?? "", children: r.label }) }) }) });
|
|
23
24
|
}
|
|
24
25
|
export {
|
|
25
|
-
|
|
26
|
+
y as ComboboxItem
|
|
26
27
|
};
|
|
@@ -3,5 +3,5 @@ export declare function CheckboxOrRadioButton({ isSingleSelect, isChecked, }: {
|
|
|
3
3
|
isSingleSelect: boolean;
|
|
4
4
|
isChecked: boolean;
|
|
5
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export declare function ComboboxMenu(
|
|
6
|
+
export declare function ComboboxMenu(props: ComboboxInnerProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
//# sourceMappingURL=combobox-menu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox-menu.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox-menu.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"combobox-menu.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox-menu.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACX,kBAAkB,EAIlB,MAAM,SAAS,CAAC;AA2CjB,wBAAgB,qBAAqB,CAAC,EACrC,cAAc,EACd,SAAS,GACT,EAAE;IACF,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;CACnB,2CAEA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,kBAAkB,2CAiGrD"}
|
|
@@ -1,117 +1,93 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Box as
|
|
3
|
-
import { autoUpdate as
|
|
4
|
-
import {
|
|
5
|
-
import { ComboboxItem as
|
|
6
|
-
import { interpolate as
|
|
7
|
-
import { ThemeColorVariable as
|
|
1
|
+
import { jsxs as g, jsx as n, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import { Box as C, Flex as y } from "@chakra-ui/react";
|
|
3
|
+
import { autoUpdate as G, computePosition as Q, flip as U } from "../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
|
|
4
|
+
import { useState as Y, useEffect as q, Fragment as T } from "react";
|
|
5
|
+
import { ComboboxItem as H } from "./combobox-item.js";
|
|
6
|
+
import { interpolate as J } from "./translations.js";
|
|
7
|
+
import { ThemeColorVariable as d, ThemeShadowVariable as K, ThemeRadiusVariable as Z, ThemeSpaceVariable as c, ThemeFontSizeVariable as R, ThemeBorderVariable as N, ThemeIconSizeVariable as F } from "../../theme/theme-types.js";
|
|
8
8
|
import { Text as V } from "../text/text.js";
|
|
9
|
-
import { Icon as
|
|
10
|
-
import { Icons as
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
import { Icon as z } from "../icon/icon.js";
|
|
10
|
+
import { Icons as D } from "../icon/types.js";
|
|
11
|
+
import { Checkbox as W } from "../checkbox/checkbox.js";
|
|
12
|
+
import { Radio as ee } from "../radio/radio.js";
|
|
13
|
+
const ne = (o, t, s, h, a) => {
|
|
14
|
+
const [b, x] = Y({
|
|
13
15
|
transform: "translate(0, 0)",
|
|
14
16
|
minWidth: 0
|
|
15
17
|
});
|
|
16
|
-
return
|
|
17
|
-
if (!
|
|
18
|
+
return q(() => {
|
|
19
|
+
if (!o.current || !t.current || !s) return () => {
|
|
18
20
|
};
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
21
|
-
const { width:
|
|
22
|
-
placement:
|
|
23
|
-
middleware: [
|
|
21
|
+
const k = async () => {
|
|
22
|
+
if (o.current && t.current && s) {
|
|
23
|
+
const { width: S } = o.current.getBoundingClientRect(), { x: P, y: u } = await Q(o.current, t.current, {
|
|
24
|
+
placement: a || "bottom-start",
|
|
25
|
+
middleware: [U()]
|
|
24
26
|
});
|
|
25
|
-
|
|
26
|
-
transform: `translate(${
|
|
27
|
-
minWidth:
|
|
27
|
+
x({
|
|
28
|
+
transform: `translate(${P}px, ${u}px)`,
|
|
29
|
+
minWidth: h || S
|
|
28
30
|
});
|
|
29
31
|
}
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
+
}, w = () => {
|
|
33
|
+
k().catch(console.error);
|
|
32
34
|
};
|
|
33
|
-
return
|
|
34
|
-
}, [
|
|
35
|
+
return G(o.current, t.current, w);
|
|
36
|
+
}, [o, t, s, a, h]), b;
|
|
35
37
|
};
|
|
36
|
-
function
|
|
37
|
-
isSingleSelect:
|
|
38
|
-
isChecked:
|
|
38
|
+
function X({
|
|
39
|
+
isSingleSelect: o,
|
|
40
|
+
isChecked: t
|
|
39
41
|
}) {
|
|
40
|
-
return /* @__PURE__ */
|
|
41
|
-
d,
|
|
42
|
-
{
|
|
43
|
-
position: "relative",
|
|
44
|
-
width: "24px",
|
|
45
|
-
height: "24px",
|
|
46
|
-
flexShrink: "0",
|
|
47
|
-
border: `${n && e ? 8 : 2}px solid ${e ? o.Primary : o.OnBackground}`,
|
|
48
|
-
backgroundColor: e && !n ? o.Primary : "auto",
|
|
49
|
-
borderRadius: n ? "50%" : D.Small,
|
|
50
|
-
children: !n && e && /* @__PURE__ */ i(
|
|
51
|
-
B,
|
|
52
|
-
{
|
|
53
|
-
top: "-2px",
|
|
54
|
-
position: "absolute",
|
|
55
|
-
width: $.Small,
|
|
56
|
-
color: o.Surface,
|
|
57
|
-
icon: C.Checkbox
|
|
58
|
-
}
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
);
|
|
42
|
+
return o ? /* @__PURE__ */ n(ee, { isChecked: t }) : /* @__PURE__ */ n(W, { isChecked: t });
|
|
62
43
|
}
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
O,
|
|
88
|
-
m.isOpen,
|
|
89
|
-
I,
|
|
90
|
-
X
|
|
91
|
-
), A = (r) => {
|
|
92
|
-
s.set(r);
|
|
44
|
+
function pe(o) {
|
|
45
|
+
const {
|
|
46
|
+
inputValue: t,
|
|
47
|
+
displayItems: s,
|
|
48
|
+
highlightState: h,
|
|
49
|
+
openState: a,
|
|
50
|
+
isSingleSelect: b,
|
|
51
|
+
isSearching: x,
|
|
52
|
+
isHidingItems: k,
|
|
53
|
+
popoverWidth: w,
|
|
54
|
+
popoverPlacement: S,
|
|
55
|
+
parentRef: P,
|
|
56
|
+
popupRef: u,
|
|
57
|
+
footerContent: l,
|
|
58
|
+
translation: e,
|
|
59
|
+
folderStyle: i
|
|
60
|
+
} = o, r = ne(
|
|
61
|
+
P,
|
|
62
|
+
u,
|
|
63
|
+
a.isOpen,
|
|
64
|
+
w,
|
|
65
|
+
S
|
|
66
|
+
), v = (m) => {
|
|
67
|
+
h.set(m);
|
|
93
68
|
};
|
|
94
|
-
return /* @__PURE__ */
|
|
95
|
-
|
|
69
|
+
return /* @__PURE__ */ g(
|
|
70
|
+
C,
|
|
96
71
|
{
|
|
97
|
-
display:
|
|
72
|
+
display: a.isOpen ? "block" : "none",
|
|
98
73
|
inset: "0 auto auto 0",
|
|
99
74
|
position: "fixed",
|
|
100
75
|
zIndex: "50",
|
|
101
76
|
visibility: "visible",
|
|
102
|
-
backgroundColor:
|
|
103
|
-
borderRadius:
|
|
104
|
-
boxShadow:
|
|
105
|
-
color:
|
|
77
|
+
backgroundColor: d.Surface,
|
|
78
|
+
borderRadius: Z.Medium,
|
|
79
|
+
boxShadow: K.Medium,
|
|
80
|
+
color: d.OnSurface,
|
|
106
81
|
overflow: "hidden",
|
|
107
|
-
style:
|
|
108
|
-
ref:
|
|
109
|
-
|
|
110
|
-
|
|
82
|
+
style: r,
|
|
83
|
+
ref: u,
|
|
84
|
+
maxW: "90%",
|
|
85
|
+
onClick: (m) => {
|
|
86
|
+
m.preventDefault(), m.stopPropagation(), b && a.close();
|
|
111
87
|
},
|
|
112
88
|
children: [
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
|
|
89
|
+
/* @__PURE__ */ g(
|
|
90
|
+
y,
|
|
115
91
|
{
|
|
116
92
|
as: "ul",
|
|
117
93
|
flexDirection: "column",
|
|
@@ -119,103 +95,208 @@ function fo({
|
|
|
119
95
|
overflowY: "auto",
|
|
120
96
|
overflowX: "hidden",
|
|
121
97
|
role: "listbox",
|
|
122
|
-
"aria-multiselectable": !
|
|
123
|
-
padding: `${
|
|
98
|
+
"aria-multiselectable": !b,
|
|
99
|
+
padding: `${c.Small} 0`,
|
|
124
100
|
children: [
|
|
125
|
-
|
|
101
|
+
x && s.length === 0 && t.length > 0 && /* @__PURE__ */ n(
|
|
126
102
|
V,
|
|
127
103
|
{
|
|
128
|
-
px:
|
|
129
|
-
color:
|
|
130
|
-
children: `${
|
|
104
|
+
px: c.Small,
|
|
105
|
+
color: d.OnSurfaceSubdued,
|
|
106
|
+
children: `${e.noMatchFor} "${t}"`
|
|
131
107
|
}
|
|
132
108
|
),
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
c.stopPropagation(), c.preventDefault(), p(r);
|
|
136
|
-
}, U = r.children?.length, P = r.id === "_back", W = M.opened[M.opened.length - 1], F = r.id === W?.id, Y = P ? /* @__PURE__ */ l(g, { gap: t.XSmall, alignItems: "center", children: [
|
|
137
|
-
/* @__PURE__ */ i(B, { icon: C.Back, size: $.Small }),
|
|
138
|
-
r.label
|
|
139
|
-
] }) : /* @__PURE__ */ l(G, { children: [
|
|
140
|
-
/* @__PURE__ */ l(g, { gap: t.XSmall, alignItems: "center", whiteSpace: "nowrap", children: [
|
|
141
|
-
S[r.id]?.map((c) => /* @__PURE__ */ l(z, { children: [
|
|
142
|
-
/* @__PURE__ */ i(d, { color: o.OnSurfaceSubdued, children: c }),
|
|
143
|
-
/* @__PURE__ */ i(d, { color: o.OnSurfaceSubdued, children: "/" })
|
|
144
|
-
] }, c)),
|
|
145
|
-
/* @__PURE__ */ i(Z, { item: r, asPlainText: n })
|
|
146
|
-
] }),
|
|
147
|
-
x ? void 0 : U && !F && !b ? /* @__PURE__ */ i(
|
|
148
|
-
B,
|
|
149
|
-
{
|
|
150
|
-
icon: C.Forward,
|
|
151
|
-
size: $.Small,
|
|
152
|
-
color: o.OnBackgroundSubdued
|
|
153
|
-
}
|
|
154
|
-
) : /* @__PURE__ */ i(to, { isSingleSelect: h, isChecked: y })
|
|
155
|
-
] }), _ = w.length > 0 && w.length - 1 === f && w.length < a.length, q = !x && !b && (_ || (P || F));
|
|
156
|
-
return /* @__PURE__ */ l(z, { children: [
|
|
157
|
-
/* @__PURE__ */ i(
|
|
158
|
-
g,
|
|
159
|
-
{
|
|
160
|
-
as: "li",
|
|
161
|
-
role: "option",
|
|
162
|
-
width: "100%",
|
|
163
|
-
flexDirection: "row",
|
|
164
|
-
justifyContent: "space-between",
|
|
165
|
-
padding: `${t.Small} ${t.Medium}`,
|
|
166
|
-
gap: t.Medium,
|
|
167
|
-
textDecoration: "none",
|
|
168
|
-
backgroundColor: s.index === f ? o.AccentHoverAlpha : "",
|
|
169
|
-
onClick: E,
|
|
170
|
-
tabIndex: -1,
|
|
171
|
-
onMouseEnter: () => A(f),
|
|
172
|
-
"data-is-active-index": s.index === f,
|
|
173
|
-
"aria-selected": y,
|
|
174
|
-
children: Y
|
|
175
|
-
}
|
|
176
|
-
),
|
|
177
|
-
q && /* @__PURE__ */ i(
|
|
178
|
-
d,
|
|
179
|
-
{
|
|
180
|
-
margin: `${t.Small} ${P ? 0 : t.Medium}`,
|
|
181
|
-
height: "1px",
|
|
182
|
-
flexShrink: 0,
|
|
183
|
-
backgroundColor: o.OnBackgroundBorder
|
|
184
|
-
}
|
|
185
|
-
)
|
|
186
|
-
] }, r.id);
|
|
187
|
-
}),
|
|
188
|
-
k && /* @__PURE__ */ i(
|
|
109
|
+
i === "stacked" ? /* @__PURE__ */ n(oe, { ...o, onHover: v }) : /* @__PURE__ */ n(re, { ...o, onHover: v }),
|
|
110
|
+
k && /* @__PURE__ */ n(
|
|
189
111
|
V,
|
|
190
112
|
{
|
|
191
|
-
px:
|
|
192
|
-
py:
|
|
193
|
-
color:
|
|
194
|
-
fontSize:
|
|
195
|
-
children:
|
|
196
|
-
count:
|
|
113
|
+
px: c.Small,
|
|
114
|
+
py: c.Small,
|
|
115
|
+
color: d.OnSurfaceSubdued,
|
|
116
|
+
fontSize: R.Small,
|
|
117
|
+
children: J(e.showMaxItems, {
|
|
118
|
+
count: s.length
|
|
197
119
|
})
|
|
198
120
|
}
|
|
199
121
|
)
|
|
200
122
|
]
|
|
201
123
|
}
|
|
202
124
|
),
|
|
203
|
-
|
|
204
|
-
|
|
125
|
+
l && /* @__PURE__ */ n(
|
|
126
|
+
C,
|
|
205
127
|
{
|
|
206
128
|
position: "sticky",
|
|
207
129
|
bottom: "0",
|
|
208
|
-
backgroundColor:
|
|
209
|
-
padding: `${
|
|
210
|
-
borderTop: `${
|
|
211
|
-
children:
|
|
130
|
+
backgroundColor: d.Surface,
|
|
131
|
+
padding: `${c.Small} ${c.Medium}`,
|
|
132
|
+
borderTop: `${N.XSmall} ${d.OnSurfaceBorder}`,
|
|
133
|
+
children: l
|
|
212
134
|
}
|
|
213
135
|
)
|
|
214
136
|
]
|
|
215
137
|
}
|
|
216
138
|
);
|
|
217
139
|
}
|
|
140
|
+
const A = ({
|
|
141
|
+
children: o,
|
|
142
|
+
isChecked: t,
|
|
143
|
+
onClick: s,
|
|
144
|
+
isActive: h,
|
|
145
|
+
onHover: a
|
|
146
|
+
}) => /* @__PURE__ */ n(
|
|
147
|
+
y,
|
|
148
|
+
{
|
|
149
|
+
as: "li",
|
|
150
|
+
role: "option",
|
|
151
|
+
width: "100%",
|
|
152
|
+
flexDirection: "row",
|
|
153
|
+
justifyContent: "space-between",
|
|
154
|
+
padding: `${c.Small} ${c.Medium}`,
|
|
155
|
+
gap: c.Medium,
|
|
156
|
+
textDecoration: "none",
|
|
157
|
+
backgroundColor: h ? d.AccentHoverAlpha : "",
|
|
158
|
+
onClick: s,
|
|
159
|
+
tabIndex: -1,
|
|
160
|
+
onMouseEnter: a,
|
|
161
|
+
"data-is-active-index": h,
|
|
162
|
+
"aria-selected": t,
|
|
163
|
+
children: o
|
|
164
|
+
}
|
|
165
|
+
), oe = ({
|
|
166
|
+
displayItems: o,
|
|
167
|
+
selectedItems: t,
|
|
168
|
+
toggleItem: s,
|
|
169
|
+
onHover: h,
|
|
170
|
+
parentSelectsChildren: a,
|
|
171
|
+
highlightState: b,
|
|
172
|
+
inputValue: x,
|
|
173
|
+
isSingleSelect: k
|
|
174
|
+
}) => {
|
|
175
|
+
const w = (l, e) => l.children && l.children.length > 0 ? l.children.every((i) => w(i, e)) : e.some((i) => i.id === l.id), S = (l) => l.children && l.children.length > 0 ? l.children.some((e) => S(e)) : t.some((e) => e.id === l.id);
|
|
176
|
+
let P = 0;
|
|
177
|
+
const u = (l, e, i = []) => l.map((r) => {
|
|
178
|
+
const v = (p) => {
|
|
179
|
+
p.stopPropagation(), p.preventDefault(), s(r);
|
|
180
|
+
};
|
|
181
|
+
i.length > 0 && (i[i.length - 1] -= 1);
|
|
182
|
+
const m = P++, B = r.children && r.children.length > 0, I = !B || r.isSelectableParent;
|
|
183
|
+
let $ = e.some((p) => p.id === r.id);
|
|
184
|
+
return a && B && !r.isSelectableParent && w(r, e) && ($ = !0), /* @__PURE__ */ g(T, { children: [
|
|
185
|
+
/* @__PURE__ */ g(
|
|
186
|
+
A,
|
|
187
|
+
{
|
|
188
|
+
isActive: b.index === m,
|
|
189
|
+
isChecked: $,
|
|
190
|
+
onClick: v,
|
|
191
|
+
onHover: () => h(m),
|
|
192
|
+
children: [
|
|
193
|
+
/* @__PURE__ */ g(y, { alignItems: "center", whiteSpace: "nowrap", minW: 0, children: [
|
|
194
|
+
i.map((p, O, M) => {
|
|
195
|
+
const f = M.length === O + 1, j = p > 0, E = p === 0, L = j || f;
|
|
196
|
+
return /* @__PURE__ */ g(
|
|
197
|
+
y,
|
|
198
|
+
{
|
|
199
|
+
w: c.Medium,
|
|
200
|
+
minW: c.Medium,
|
|
201
|
+
alignItems: "center",
|
|
202
|
+
my: "-0.5rem",
|
|
203
|
+
h: "2.5rem",
|
|
204
|
+
children: [
|
|
205
|
+
L && /* @__PURE__ */ n(
|
|
206
|
+
C,
|
|
207
|
+
{
|
|
208
|
+
w: "1px",
|
|
209
|
+
h: E ? "52%" : "100%",
|
|
210
|
+
backgroundColor: d.OnSurface,
|
|
211
|
+
mb: "auto"
|
|
212
|
+
}
|
|
213
|
+
),
|
|
214
|
+
f && /* @__PURE__ */ n(
|
|
215
|
+
C,
|
|
216
|
+
{
|
|
217
|
+
w: "inherit",
|
|
218
|
+
height: "1px",
|
|
219
|
+
backgroundColor: d.OnSurface,
|
|
220
|
+
mr: c.XSmall
|
|
221
|
+
}
|
|
222
|
+
)
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
`${r.id}_${O}`
|
|
226
|
+
);
|
|
227
|
+
}),
|
|
228
|
+
/* @__PURE__ */ n(H, { item: r, asPlainText: !0, highlightQuery: x })
|
|
229
|
+
] }),
|
|
230
|
+
I ? /* @__PURE__ */ n(X, { isSingleSelect: k, isChecked: $ }) : a && !k && /* @__PURE__ */ n(W, { isIndeterminate: S(r), isChecked: $ })
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
r.children && u(r.children, e, [...i, r.children.length])
|
|
235
|
+
] }, r.id);
|
|
236
|
+
});
|
|
237
|
+
return u(o, t);
|
|
238
|
+
}, re = ({
|
|
239
|
+
displayItems: o,
|
|
240
|
+
selectedItems: t,
|
|
241
|
+
toggleItem: s,
|
|
242
|
+
onHover: h,
|
|
243
|
+
highlightState: a,
|
|
244
|
+
isSingleSelect: b,
|
|
245
|
+
subMenuState: x,
|
|
246
|
+
parentStrings: k,
|
|
247
|
+
asPlainText: w,
|
|
248
|
+
isSearching: S,
|
|
249
|
+
isReadOnly: P,
|
|
250
|
+
previousSelectedItems: u
|
|
251
|
+
}) => {
|
|
252
|
+
const l = (e, i) => {
|
|
253
|
+
e.stopPropagation(), e.preventDefault(), s(i);
|
|
254
|
+
};
|
|
255
|
+
return o.map((e, i) => {
|
|
256
|
+
const r = t.some((f) => f.id === e.id), v = e.children?.length, m = e.id === "_back", B = x.opened[x.opened.length - 1], I = e.id === B?.id, $ = m ? /* @__PURE__ */ g(y, { gap: c.XSmall, alignItems: "center", children: [
|
|
257
|
+
/* @__PURE__ */ n(z, { icon: D.Back, size: F.Small }),
|
|
258
|
+
e.label
|
|
259
|
+
] }) : /* @__PURE__ */ g(_, { children: [
|
|
260
|
+
/* @__PURE__ */ g(y, { gap: c.XSmall, alignItems: "center", whiteSpace: "nowrap", children: [
|
|
261
|
+
k[e.id]?.map((f) => /* @__PURE__ */ g(T, { children: [
|
|
262
|
+
/* @__PURE__ */ n(C, { color: d.OnSurfaceSubdued, children: f }),
|
|
263
|
+
/* @__PURE__ */ n(C, { color: d.OnSurfaceSubdued, children: "/" })
|
|
264
|
+
] }, f)),
|
|
265
|
+
/* @__PURE__ */ n(H, { item: e, asPlainText: w })
|
|
266
|
+
] }),
|
|
267
|
+
P ? void 0 : v && !I && !S ? /* @__PURE__ */ n(
|
|
268
|
+
z,
|
|
269
|
+
{
|
|
270
|
+
icon: D.Forward,
|
|
271
|
+
size: F.Small,
|
|
272
|
+
color: d.OnBackgroundSubdued
|
|
273
|
+
}
|
|
274
|
+
) : /* @__PURE__ */ n(X, { isSingleSelect: b, isChecked: r })
|
|
275
|
+
] }), p = u.length > 0 && u.length - 1 === i && u.length < o.length, M = !P && !S && (p || (m || I));
|
|
276
|
+
return /* @__PURE__ */ g(T, { children: [
|
|
277
|
+
/* @__PURE__ */ n(
|
|
278
|
+
A,
|
|
279
|
+
{
|
|
280
|
+
isActive: a.index === i,
|
|
281
|
+
isChecked: r,
|
|
282
|
+
onClick: (f) => l(f, e),
|
|
283
|
+
onHover: () => h(i),
|
|
284
|
+
children: $
|
|
285
|
+
}
|
|
286
|
+
),
|
|
287
|
+
M && /* @__PURE__ */ n(
|
|
288
|
+
C,
|
|
289
|
+
{
|
|
290
|
+
margin: `${c.Small} ${m ? 0 : c.Medium}`,
|
|
291
|
+
height: "1px",
|
|
292
|
+
flexShrink: 0,
|
|
293
|
+
backgroundColor: d.OnBackgroundBorder
|
|
294
|
+
}
|
|
295
|
+
)
|
|
296
|
+
] }, e.id);
|
|
297
|
+
});
|
|
298
|
+
};
|
|
218
299
|
export {
|
|
219
|
-
|
|
220
|
-
|
|
300
|
+
X as CheckboxOrRadioButton,
|
|
301
|
+
pe as ComboboxMenu
|
|
221
302
|
};
|
|
@@ -6,4 +6,5 @@ export declare const Sizes: () => import("react/jsx-runtime").JSX.Element;
|
|
|
6
6
|
export declare const GhostVariant: () => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export declare const WithItemsAsPlainText: () => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export declare const WithFooterContent: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const WithFolderStyleStacked: () => import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
//# sourceMappingURL=combobox.composition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.composition.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox.composition.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"combobox.composition.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox.composition.tsx"],"names":[],"mappings":"AAqOA,eAAO,MAAM,YAAY,+CAoBxB,CAAC;AAEF,eAAO,MAAM,WAAW,+CAmBvB,CAAC;AAEF,eAAO,MAAM,QAAQ,+CAiDpB,CAAC;AAEF,eAAO,MAAM,OAAO,+CAoBnB,CAAC;AAEF,eAAO,MAAM,KAAK,+CAyEjB,CAAC;AAEF,eAAO,MAAM,YAAY,+CAoBxB,CAAC;AAEF,eAAO,MAAM,oBAAoB,+CAyBhC,CAAC;AAEF,eAAO,MAAM,iBAAiB,+CAyB7B,CAAC;AAEF,eAAO,MAAM,sBAAsB,+CA8BlC,CAAC"}
|
|
@@ -6,5 +6,5 @@ import { ComboboxProps } from './types.js';
|
|
|
6
6
|
*
|
|
7
7
|
* @see Docs https://caspeco.github.io/casper-ui-library/components/combobox
|
|
8
8
|
*/
|
|
9
|
-
export declare function Combobox({ id, label, isSingleSelect, selectedItems, locale, size, variant, asPlainText, onSearch, items, maxVisibleItems, onChange, onBlur, isDisabled, isReadOnly, isRequired, placeholder, isInvalid, footerContent, popoverWidth, popoverPlacement, collapsed, ...props }: ComboboxProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function Combobox({ id, label, isSingleSelect, selectedItems, locale, size, variant, asPlainText, onSearch, items, maxVisibleItems, onChange, onBlur, isDisabled, isReadOnly, isRequired, placeholder, isInvalid, footerContent, popoverWidth, popoverPlacement, collapsed, folderStyle, parentSelectsChildren, ...props }: ComboboxProps): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
//# sourceMappingURL=combobox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAIX,aAAa,EAKb,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAIX,aAAa,EAKb,MAAM,SAAS,CAAC;AAsGjB;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,EACxB,EAAE,EACF,KAAU,EACV,cAAsB,EACtB,aAAkB,EAClB,MAAgB,EAChB,IAAW,EACX,OAAmB,EACnB,WAAmB,EACnB,QAAQ,EACR,KAAK,EACL,eAAe,EACf,QAAQ,EACR,MAAM,EACN,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,SAAiB,EACjB,WAAuB,EACvB,qBAAqB,EACrB,GAAG,KAAK,EACR,EAAE,aAAa,2CAgTf"}
|