@caspeco/casper-ui-library 7.7.4 → 7.7.5
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.
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsxs as f, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { useStyleConfig as
|
|
3
|
-
import { Fragment as
|
|
4
|
-
import { ComboboxItem as
|
|
5
|
-
import { Tag as
|
|
6
|
-
import { Icon as
|
|
7
|
-
import { Icons as
|
|
8
|
-
import { ThemeColorVariable as r, ThemeSpaceVariable as
|
|
9
|
-
function
|
|
2
|
+
import { useStyleConfig as N, Flex as c, Box as d, Input as X } from "@chakra-ui/react";
|
|
3
|
+
import { Fragment as $ } from "react";
|
|
4
|
+
import { ComboboxItem as E } from "./combobox-item.js";
|
|
5
|
+
import { Tag as K } from "../tag/tag.js";
|
|
6
|
+
import { Icon as U } from "../icon/icon.js";
|
|
7
|
+
import { Icons as q } from "../icon/types.js";
|
|
8
|
+
import { ThemeColorVariable as r, ThemeSpaceVariable as u, ThemeRadiusVariable as G, ThemeIconSizeVariable as J } from "../../theme/theme-types.js";
|
|
9
|
+
function j() {
|
|
10
10
|
return /* @__PURE__ */ i(
|
|
11
|
-
|
|
11
|
+
d,
|
|
12
12
|
{
|
|
13
13
|
backgroundColor: r.NeutralContainer,
|
|
14
14
|
width: "8px",
|
|
@@ -26,51 +26,51 @@ function E() {
|
|
|
26
26
|
}
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
id:
|
|
29
|
+
function oo({
|
|
30
|
+
id: B,
|
|
31
31
|
asPlainText: e,
|
|
32
|
-
inputValue:
|
|
32
|
+
inputValue: h,
|
|
33
33
|
selectedItems: n,
|
|
34
|
-
displayItems:
|
|
34
|
+
displayItems: R,
|
|
35
35
|
toggleItem: C,
|
|
36
36
|
highlightState: l,
|
|
37
37
|
openState: a,
|
|
38
|
-
parentStrings:
|
|
39
|
-
size:
|
|
40
|
-
variant:
|
|
38
|
+
parentStrings: V,
|
|
39
|
+
size: W,
|
|
40
|
+
variant: v,
|
|
41
41
|
label: S,
|
|
42
|
-
placeHolderText:
|
|
43
|
-
isDisabled:
|
|
42
|
+
placeHolderText: s,
|
|
43
|
+
isDisabled: b,
|
|
44
44
|
isReadOnly: m,
|
|
45
|
-
isInvalid:
|
|
46
|
-
collapsed:
|
|
47
|
-
hasPendingDelete:
|
|
45
|
+
isInvalid: w,
|
|
46
|
+
collapsed: k,
|
|
47
|
+
hasPendingDelete: t,
|
|
48
48
|
setHasPendingDelete: g,
|
|
49
|
-
setInputValue:
|
|
50
|
-
onSearch:
|
|
49
|
+
setInputValue: O,
|
|
50
|
+
onSearch: y,
|
|
51
51
|
isSingleSelect: z
|
|
52
52
|
}) {
|
|
53
|
-
const A =
|
|
54
|
-
if (o.key === "Enter" && (o.preventDefault(), o.stopPropagation(), a.isOpen ? C(
|
|
53
|
+
const A = N("Combobox", { size: W, variant: v }), D = (o) => {
|
|
54
|
+
if (o.key === "Enter" && (o.preventDefault(), o.stopPropagation(), a.isOpen ? C(R[l.index]) : a.open()), o.key === "Escape") {
|
|
55
55
|
if (!a.isOpen) return;
|
|
56
|
-
o.preventDefault(), o.stopPropagation(), a.close(), e || (
|
|
56
|
+
o.preventDefault(), o.stopPropagation(), a.close(), e || (O(""), y?.(""));
|
|
57
57
|
}
|
|
58
|
-
o.key === "Backspace" ?
|
|
58
|
+
o.key === "Backspace" ? h.length === 0 && n.length > 0 && !e && (t ? (C(n[n.length - 1]), g(!1)) : g(!0)) : g(!1), o.key === "ArrowDown" && (a.isOpen ? l.next() : a.open()), o.key === "ArrowUp" && (a.isOpen ? l.previous() : a.open());
|
|
59
59
|
}, F = (o) => {
|
|
60
60
|
o.preventDefault(), o.stopPropagation();
|
|
61
61
|
const p = o.target.value;
|
|
62
|
-
|
|
63
|
-
}, x = n[0],
|
|
62
|
+
O(p), y?.(p), l.set(0), a.open();
|
|
63
|
+
}, x = n[0], _ = n[n.length - 1], L = a.isOpen || e || s;
|
|
64
64
|
return /* @__PURE__ */ f(
|
|
65
65
|
c,
|
|
66
66
|
{
|
|
67
67
|
__css: A,
|
|
68
|
-
"aria-disabled":
|
|
68
|
+
"aria-disabled": b,
|
|
69
69
|
"aria-readonly": m,
|
|
70
|
-
"aria-invalid":
|
|
71
|
-
borderRadius:
|
|
72
|
-
padding:
|
|
73
|
-
_focusWithin:
|
|
70
|
+
"aria-invalid": w,
|
|
71
|
+
borderRadius: G.Small,
|
|
72
|
+
padding: u.Small,
|
|
73
|
+
_focusWithin: w ? {
|
|
74
74
|
borderColor: r.Error,
|
|
75
75
|
boxShadow: `0 0 0 4px ${r.ErrorContainer}`,
|
|
76
76
|
backgroundColor: r.Surface
|
|
@@ -87,45 +87,45 @@ function I({
|
|
|
87
87
|
/* @__PURE__ */ f(
|
|
88
88
|
c,
|
|
89
89
|
{
|
|
90
|
-
flexWrap:
|
|
91
|
-
gap:
|
|
90
|
+
flexWrap: k || z ? "nowrap" : "wrap",
|
|
91
|
+
gap: u.Small,
|
|
92
92
|
overflow: "hidden",
|
|
93
93
|
children: [
|
|
94
|
-
S && /* @__PURE__ */ i(
|
|
95
|
-
!e && (
|
|
94
|
+
S && /* @__PURE__ */ i(d, { whiteSpace: "nowrap", children: S }),
|
|
95
|
+
!e && (k ? n.length > 0 && _ && /* @__PURE__ */ f(
|
|
96
96
|
c,
|
|
97
97
|
{
|
|
98
|
-
gap:
|
|
98
|
+
gap: u.XSmall,
|
|
99
99
|
flexShrink: "1",
|
|
100
100
|
overflow: "hidden",
|
|
101
101
|
whiteSpace: "nowrap",
|
|
102
102
|
textOverflow: "ellipsis",
|
|
103
103
|
children: [
|
|
104
|
-
n.length > 3 && /* @__PURE__ */ i(
|
|
105
|
-
n.length > 2 && /* @__PURE__ */ i(
|
|
106
|
-
n.length > 1 && /* @__PURE__ */ i(
|
|
104
|
+
n.length > 3 && /* @__PURE__ */ i(j, {}),
|
|
105
|
+
n.length > 2 && /* @__PURE__ */ i(j, {}),
|
|
106
|
+
n.length > 1 && /* @__PURE__ */ i(K, { children: n.length - 1 }),
|
|
107
107
|
/* @__PURE__ */ i(
|
|
108
|
-
|
|
108
|
+
E,
|
|
109
109
|
{
|
|
110
|
-
isDeleting:
|
|
111
|
-
item:
|
|
110
|
+
isDeleting: t,
|
|
111
|
+
item: _,
|
|
112
112
|
asPlainText: e
|
|
113
113
|
}
|
|
114
114
|
)
|
|
115
115
|
]
|
|
116
116
|
}
|
|
117
117
|
) : n.map((o, p) => /* @__PURE__ */ i(
|
|
118
|
-
|
|
118
|
+
E,
|
|
119
119
|
{
|
|
120
120
|
item: o,
|
|
121
121
|
asPlainText: e,
|
|
122
|
-
isDeleting: p === n.length - 1 &&
|
|
122
|
+
isDeleting: p === n.length - 1 && t
|
|
123
123
|
},
|
|
124
124
|
o.id
|
|
125
125
|
))),
|
|
126
|
-
e && n.length > 0 && x &&
|
|
126
|
+
e && n.length > 0 && x && h === x.label && V[x.id]?.map((o) => /* @__PURE__ */ f($, { children: [
|
|
127
127
|
/* @__PURE__ */ i(
|
|
128
|
-
|
|
128
|
+
d,
|
|
129
129
|
{
|
|
130
130
|
color: r.OnSurfaceSubdued,
|
|
131
131
|
textOverflow: "ellipsis",
|
|
@@ -134,22 +134,22 @@ function I({
|
|
|
134
134
|
children: o
|
|
135
135
|
}
|
|
136
136
|
),
|
|
137
|
-
/* @__PURE__ */ i(
|
|
137
|
+
/* @__PURE__ */ i(d, { color: r.OnSurfaceSubdued, children: "/" })
|
|
138
138
|
] }, o)),
|
|
139
139
|
/* @__PURE__ */ i(
|
|
140
|
-
|
|
140
|
+
X,
|
|
141
141
|
{
|
|
142
|
-
id:
|
|
143
|
-
isDisabled:
|
|
142
|
+
id: B,
|
|
143
|
+
isDisabled: b,
|
|
144
144
|
isReadOnly: m,
|
|
145
|
-
isInvalid:
|
|
145
|
+
isInvalid: w,
|
|
146
146
|
onKeyDown: D,
|
|
147
147
|
variant: "unstyled",
|
|
148
|
-
value:
|
|
148
|
+
value: h,
|
|
149
149
|
autoComplete: "off",
|
|
150
|
-
minWidth:
|
|
150
|
+
minWidth: u.XLarge,
|
|
151
151
|
onChange: F,
|
|
152
|
-
placeholder:
|
|
152
|
+
placeholder: s,
|
|
153
153
|
border: "none",
|
|
154
154
|
flex: 1,
|
|
155
155
|
color: r.OnSurface,
|
|
@@ -161,7 +161,7 @@ function I({
|
|
|
161
161
|
cursor: "not-allowed",
|
|
162
162
|
color: r.OnSurfaceSubdued
|
|
163
163
|
},
|
|
164
|
-
sx:
|
|
164
|
+
sx: L ? {} : {
|
|
165
165
|
position: "absolute",
|
|
166
166
|
width: "1px",
|
|
167
167
|
height: "1px",
|
|
@@ -178,11 +178,11 @@ function I({
|
|
|
178
178
|
}
|
|
179
179
|
),
|
|
180
180
|
/* @__PURE__ */ i(c, { className: "combobox-dropdown-icon", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ i(
|
|
181
|
-
|
|
181
|
+
U,
|
|
182
182
|
{
|
|
183
|
-
icon:
|
|
184
|
-
size:
|
|
185
|
-
color:
|
|
183
|
+
icon: q.TreeViewCollapse,
|
|
184
|
+
size: J.Small,
|
|
185
|
+
color: b || m ? r.OnSurfaceSubdued : r.OnSurface
|
|
186
186
|
}
|
|
187
187
|
) })
|
|
188
188
|
]
|
|
@@ -190,5 +190,5 @@ function I({
|
|
|
190
190
|
);
|
|
191
191
|
}
|
|
192
192
|
export {
|
|
193
|
-
|
|
193
|
+
oo as ComboboxButton
|
|
194
194
|
};
|