@caspeco/casper-ui-library 5.1.0 → 5.1.1
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox-button.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox-button.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAsBlD,wBAAgB,cAAc,CAAC,EAC9B,EAAE,EACF,WAAW,EACX,UAAU,EACV,aAAa,EACb,YAAY,EACZ,UAAU,EACV,cAAc,EACd,SAAS,EACT,aAAa,EACb,IAAI,EACJ,OAAO,EACP,KAAK,EACL,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,cAAc,GACd,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"combobox-button.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox-button.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAsBlD,wBAAgB,cAAc,CAAC,EAC9B,EAAE,EACF,WAAW,EACX,UAAU,EACV,aAAa,EACb,YAAY,EACZ,UAAU,EACV,cAAc,EACd,SAAS,EACT,aAAa,EACb,IAAI,EACJ,OAAO,EACP,KAAK,EACL,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,cAAc,GACd,EAAE,kBAAkB,2CAiLpB"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsxs as p, 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
|
|
9
|
-
function
|
|
2
|
+
import { useStyleConfig as F, Flex as u, Box as d, Input as L } from "@chakra-ui/react";
|
|
3
|
+
import { Fragment as N } from "react";
|
|
4
|
+
import { ComboboxItem as y } from "./combobox-item.js";
|
|
5
|
+
import { Tag as X } from "../tag/tag.js";
|
|
6
|
+
import { Icon as $ } from "../icon/icon.js";
|
|
7
|
+
import { Icons as v } from "../icon/types.js";
|
|
8
|
+
import { ThemeColorVariable as r, ThemeSpaceVariable as c, ThemeRadiusVariable as K, ThemeIconSizeVariable as T } from "../../theme/theme-types.js";
|
|
9
|
+
function s() {
|
|
10
10
|
return /* @__PURE__ */ i(
|
|
11
11
|
d,
|
|
12
12
|
{
|
|
13
|
-
backgroundColor:
|
|
13
|
+
backgroundColor: r.NeutralContainer,
|
|
14
14
|
width: "8px",
|
|
15
15
|
borderRadius: "4px",
|
|
16
16
|
marginRight: "-8px",
|
|
@@ -21,45 +21,45 @@ function y() {
|
|
|
21
21
|
height: "100%",
|
|
22
22
|
width: "8px",
|
|
23
23
|
display: "block",
|
|
24
|
-
backgroundColor:
|
|
24
|
+
backgroundColor: r.Surface
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
function H({
|
|
30
|
-
id:
|
|
30
|
+
id: _,
|
|
31
31
|
asPlainText: l,
|
|
32
32
|
inputValue: b,
|
|
33
|
-
selectedItems:
|
|
34
|
-
displayItems:
|
|
35
|
-
toggleItem:
|
|
36
|
-
highlightState:
|
|
33
|
+
selectedItems: n,
|
|
34
|
+
displayItems: E,
|
|
35
|
+
toggleItem: C,
|
|
36
|
+
highlightState: e,
|
|
37
37
|
openState: a,
|
|
38
38
|
parentStrings: j,
|
|
39
39
|
size: B,
|
|
40
40
|
variant: R,
|
|
41
|
-
label:
|
|
41
|
+
label: S,
|
|
42
42
|
placeHolderText: V,
|
|
43
43
|
isDisabled: h,
|
|
44
44
|
isReadOnly: m,
|
|
45
|
-
isInvalid:
|
|
46
|
-
collapsed:
|
|
47
|
-
hasPendingDelete:
|
|
48
|
-
setHasPendingDelete:
|
|
49
|
-
setInputValue:
|
|
50
|
-
onSearch:
|
|
51
|
-
isSingleSelect:
|
|
45
|
+
isInvalid: w,
|
|
46
|
+
collapsed: k,
|
|
47
|
+
hasPendingDelete: g,
|
|
48
|
+
setHasPendingDelete: x,
|
|
49
|
+
setInputValue: t,
|
|
50
|
+
onSearch: O,
|
|
51
|
+
isSingleSelect: W
|
|
52
52
|
}) {
|
|
53
|
-
const z =
|
|
54
|
-
if (o.key === "Enter" && (o.preventDefault(), o.stopPropagation(), a.isOpen ?
|
|
53
|
+
const z = F("Combobox", { size: B, variant: R }), A = (o) => {
|
|
54
|
+
if (o.key === "Enter" && (o.preventDefault(), o.stopPropagation(), a.isOpen ? C(E[e.index]) : a.open()), o.key === "Escape") {
|
|
55
55
|
if (!a.isOpen) return;
|
|
56
|
-
o.preventDefault(), o.stopPropagation(), a.close(), l || (
|
|
56
|
+
o.preventDefault(), o.stopPropagation(), a.close(), l || (t(""), O?.(""));
|
|
57
57
|
}
|
|
58
|
-
o.key === "Backspace" ? b.length === 0 &&
|
|
58
|
+
o.key === "Backspace" ? b.length === 0 && n.length > 0 && !l && (g ? (C(n[n.length - 1]), x(!1)) : x(!0)) : x(!1), o.key === "ArrowDown" && (a.isOpen ? e.next() : a.open()), o.key === "ArrowUp" && (a.isOpen ? e.previous() : a.open());
|
|
59
59
|
}, D = (o) => {
|
|
60
60
|
o.preventDefault(), o.stopPropagation();
|
|
61
|
-
const
|
|
62
|
-
|
|
61
|
+
const f = o.target.value;
|
|
62
|
+
t(f), O?.(f), e.set(0), a.open();
|
|
63
63
|
};
|
|
64
64
|
return /* @__PURE__ */ p(
|
|
65
65
|
u,
|
|
@@ -67,27 +67,32 @@ function H({
|
|
|
67
67
|
__css: z,
|
|
68
68
|
"aria-disabled": h,
|
|
69
69
|
"aria-readonly": m,
|
|
70
|
-
|
|
70
|
+
"aria-invalid": w,
|
|
71
|
+
borderRadius: K.Small,
|
|
71
72
|
padding: c.Small,
|
|
72
|
-
_focusWithin: {
|
|
73
|
-
borderColor:
|
|
74
|
-
boxShadow: `0 0 0 4px ${
|
|
75
|
-
backgroundColor:
|
|
73
|
+
_focusWithin: w ? {
|
|
74
|
+
borderColor: r.Error,
|
|
75
|
+
boxShadow: `0 0 0 4px ${r.ErrorContainer}`,
|
|
76
|
+
backgroundColor: r.Surface
|
|
77
|
+
} : {
|
|
78
|
+
borderColor: r.Info,
|
|
79
|
+
boxShadow: `0 0 0 4px ${r.InfoContainer}`,
|
|
80
|
+
backgroundColor: r.Surface
|
|
76
81
|
},
|
|
77
82
|
_disabled: {
|
|
78
83
|
borderColor: "transparent",
|
|
79
|
-
backgroundColor:
|
|
84
|
+
backgroundColor: r.SurfaceDisabled
|
|
80
85
|
},
|
|
81
86
|
children: [
|
|
82
87
|
/* @__PURE__ */ p(
|
|
83
88
|
u,
|
|
84
89
|
{
|
|
85
|
-
flexWrap:
|
|
90
|
+
flexWrap: k || W ? "nowrap" : "wrap",
|
|
86
91
|
gap: c.Small,
|
|
87
92
|
overflow: "hidden",
|
|
88
93
|
children: [
|
|
89
|
-
|
|
90
|
-
!l && (
|
|
94
|
+
S && /* @__PURE__ */ i(d, { whiteSpace: "nowrap", children: S }),
|
|
95
|
+
!l && (k ? n.length > 0 && /* @__PURE__ */ p(
|
|
91
96
|
u,
|
|
92
97
|
{
|
|
93
98
|
gap: c.XSmall,
|
|
@@ -96,48 +101,48 @@ function H({
|
|
|
96
101
|
whiteSpace: "nowrap",
|
|
97
102
|
textOverflow: "ellipsis",
|
|
98
103
|
children: [
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
104
|
+
n.length > 3 && /* @__PURE__ */ i(s, {}),
|
|
105
|
+
n.length > 2 && /* @__PURE__ */ i(s, {}),
|
|
106
|
+
n.length > 1 && /* @__PURE__ */ i(X, { children: n.length - 1 }),
|
|
102
107
|
/* @__PURE__ */ i(
|
|
103
|
-
|
|
108
|
+
y,
|
|
104
109
|
{
|
|
105
|
-
isDeleting:
|
|
106
|
-
item:
|
|
110
|
+
isDeleting: g,
|
|
111
|
+
item: n[n.length - 1],
|
|
107
112
|
asPlainText: l
|
|
108
113
|
}
|
|
109
114
|
)
|
|
110
115
|
]
|
|
111
116
|
}
|
|
112
|
-
) :
|
|
113
|
-
|
|
117
|
+
) : n.map((o, f) => /* @__PURE__ */ i(
|
|
118
|
+
y,
|
|
114
119
|
{
|
|
115
120
|
item: o,
|
|
116
121
|
asPlainText: l,
|
|
117
|
-
isDeleting:
|
|
122
|
+
isDeleting: f === n.length - 1 && g
|
|
118
123
|
},
|
|
119
124
|
o.id
|
|
120
125
|
))),
|
|
121
|
-
l &&
|
|
126
|
+
l && n.length > 0 && b === n[0].label && j[n[0].id]?.map((o) => /* @__PURE__ */ p(N, { children: [
|
|
122
127
|
/* @__PURE__ */ i(
|
|
123
128
|
d,
|
|
124
129
|
{
|
|
125
|
-
color:
|
|
130
|
+
color: r.OnSurfaceSubdued,
|
|
126
131
|
textOverflow: "ellipsis",
|
|
127
132
|
overflow: "hidden",
|
|
128
133
|
whiteSpace: "nowrap",
|
|
129
134
|
children: o
|
|
130
135
|
}
|
|
131
136
|
),
|
|
132
|
-
/* @__PURE__ */ i(d, { color:
|
|
137
|
+
/* @__PURE__ */ i(d, { color: r.OnSurfaceSubdued, children: "/" })
|
|
133
138
|
] }, o)),
|
|
134
139
|
/* @__PURE__ */ i(
|
|
135
|
-
|
|
140
|
+
L,
|
|
136
141
|
{
|
|
137
|
-
id:
|
|
142
|
+
id: _,
|
|
138
143
|
isDisabled: h,
|
|
139
144
|
isReadOnly: m,
|
|
140
|
-
isInvalid:
|
|
145
|
+
isInvalid: w,
|
|
141
146
|
onKeyDown: A,
|
|
142
147
|
variant: "unstyled",
|
|
143
148
|
value: b,
|
|
@@ -147,14 +152,14 @@ function H({
|
|
|
147
152
|
placeholder: V,
|
|
148
153
|
border: "none",
|
|
149
154
|
flex: 1,
|
|
150
|
-
color:
|
|
155
|
+
color: r.OnSurface,
|
|
151
156
|
outline: "none",
|
|
152
157
|
_placeholder: {
|
|
153
|
-
color:
|
|
158
|
+
color: r.OnSurfaceSubdued
|
|
154
159
|
},
|
|
155
160
|
_disabled: {
|
|
156
161
|
cursor: "not-allowed",
|
|
157
|
-
color:
|
|
162
|
+
color: r.OnSurfaceSubdued
|
|
158
163
|
}
|
|
159
164
|
}
|
|
160
165
|
)
|
|
@@ -162,11 +167,11 @@ function H({
|
|
|
162
167
|
}
|
|
163
168
|
),
|
|
164
169
|
/* @__PURE__ */ i(u, { className: "combobox-dropdown-icon", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ i(
|
|
165
|
-
|
|
170
|
+
$,
|
|
166
171
|
{
|
|
167
|
-
icon:
|
|
168
|
-
size:
|
|
169
|
-
color: h || m ?
|
|
172
|
+
icon: v.TreeViewCollapse,
|
|
173
|
+
size: T.Small,
|
|
174
|
+
color: h || m ? r.OnSurfaceSubdued : r.OnSurface
|
|
170
175
|
}
|
|
171
176
|
) })
|
|
172
177
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox-theme.d.ts","sourceRoot":"","sources":["../../../../lib/theme/theme-config/components/combobox-theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"combobox-theme.d.ts","sourceRoot":"","sources":["../../../../lib/theme/theme-config/components/combobox-theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAgF5E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIzB,CAAC"}
|
|
@@ -12,6 +12,18 @@ const a = {
|
|
|
12
12
|
'&[aria-readonly="true"]': {
|
|
13
13
|
borderColor: "transparent",
|
|
14
14
|
backgroundColor: o.SurfaceDisabled
|
|
15
|
+
},
|
|
16
|
+
'&[aria-invalid="true"]': {
|
|
17
|
+
borderColor: o.Error,
|
|
18
|
+
_focusWithin: {
|
|
19
|
+
borderColor: o.Error,
|
|
20
|
+
boxShadow: `0 0 0 4px ${o.ErrorContainer}`
|
|
21
|
+
},
|
|
22
|
+
"@media(hover: hover)": {
|
|
23
|
+
"&:hover:not(:focus-within)": {
|
|
24
|
+
borderColor: o.ErrorHover
|
|
25
|
+
}
|
|
26
|
+
}
|
|
15
27
|
}
|
|
16
28
|
}, n = {
|
|
17
29
|
outline: {
|