@caspeco/casper-ui-library 6.0.0 → 7.0.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/alert/alert.js +25 -25
- package/dist/components/button/types.d.ts +1 -1
- package/dist/components/button/types.d.ts.map +1 -1
- package/dist/components/combobox/combobox-button.d.ts.map +1 -1
- package/dist/components/combobox/combobox-button.js +57 -57
- package/dist/components/combobox/combobox-menu.d.ts.map +1 -1
- package/dist/components/combobox/combobox-menu.js +58 -56
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/combobox.js +34 -34
- package/dist/components/combobox/types.d.ts +2 -2
- package/dist/components/combobox/types.d.ts.map +1 -1
- package/dist/components/date-picker/base-date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/base-date-picker.js +129 -129
- package/dist/components/date-picker/types.d.ts +3 -2
- package/dist/components/date-picker/types.d.ts.map +1 -1
- package/dist/components/drawer/use-drawer-key-down.js +8 -6
- package/dist/components/icon/icon.d.ts.map +1 -1
- package/dist/components/icon/icon.js +13 -12
- package/dist/components/icon-button/icon-button.d.ts +1 -1
- package/dist/components/icon-button/types.d.ts +3 -2
- package/dist/components/icon-button/types.d.ts.map +1 -1
- package/dist/components/image-upload/image-cropper.d.ts.map +1 -1
- package/dist/components/image-upload/image-upload-dropzone.d.ts.map +1 -1
- package/dist/components/image-upload/image-upload-dropzone.js +24 -24
- package/dist/components/image-upload/image-upload-modal.d.ts.map +1 -1
- package/dist/components/image-upload/image-upload-modal.js +61 -58
- package/dist/components/menu/menu-item.d.ts +2 -1
- package/dist/components/menu/menu-item.d.ts.map +1 -1
- package/dist/components/menu/menu.composition.d.ts.map +1 -1
- package/dist/components/modal/modal-footer.d.ts.map +1 -1
- package/dist/components/modal/modal-footer.js +16 -13
- package/dist/components/table/index.d.ts +1 -0
- package/dist/components/table/index.d.ts.map +1 -1
- package/dist/components/table/table-cell.js +18 -18
- package/dist/components/table/table-content.d.ts.map +1 -1
- package/dist/components/table/table-content.js +21 -19
- package/dist/components/table/table-context-provider.d.ts +8 -4
- package/dist/components/table/table-context-provider.d.ts.map +1 -1
- package/dist/components/table/table-context-provider.js +96 -94
- package/dist/components/table/table-filter.d.ts +27 -0
- package/dist/components/table/table-filter.d.ts.map +1 -0
- package/dist/components/table/table-filter.js +140 -0
- package/dist/components/table/table-filter.spec.d.ts +2 -0
- package/dist/components/table/table-filter.spec.d.ts.map +1 -0
- package/dist/components/table/table-header-dropdown.d.ts +1 -1
- package/dist/components/table/table-header-dropdown.d.ts.map +1 -1
- package/dist/components/table/table-header-dropdown.js +71 -59
- package/dist/components/table/table-row.js +40 -40
- package/dist/components/table/table-toolbar.d.ts.map +1 -1
- package/dist/components/table/table-toolbar.js +111 -81
- package/dist/components/table/table.composition.d.ts +1 -1
- package/dist/components/table/table.composition.d.ts.map +1 -1
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +22 -24
- package/dist/components/table/translations.d.ts +10 -0
- package/dist/components/table/translations.d.ts.map +1 -1
- package/dist/components/table/translations.js +17 -9
- package/dist/components/table/types.d.ts +1 -5
- package/dist/components/table/types.d.ts.map +1 -1
- package/dist/components/tabs/tabs.composition.d.ts +1 -1
- package/dist/index.js +168 -165
- package/dist/theme/index.d.ts +2 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/theme-config/components/button-theme.d.ts.map +1 -1
- package/dist/theme/theme-config/components/button-theme.js +35 -20
- package/dist/theme/theme-context.d.ts +10 -0
- package/dist/theme/theme-context.d.ts.map +1 -0
- package/dist/theme/theme-context.js +11 -0
- package/dist/theme/theme-provider-context.composition.d.ts.map +1 -1
- package/dist/theme/theme-provider.d.ts +0 -8
- package/dist/theme/theme-provider.d.ts.map +1 -1
- package/dist/theme/theme-provider.js +21 -27
- package/package.json +16 -11
|
@@ -1,72 +1,72 @@
|
|
|
1
1
|
import { jsx as r, jsxs as t } from "react/jsx-runtime";
|
|
2
|
-
import { Alert as F, Flex as l, chakra as
|
|
2
|
+
import { Alert as F, Flex as l, chakra as V } from "@chakra-ui/react";
|
|
3
3
|
import { useMemo as i } from "react";
|
|
4
|
-
import { getAlertTextColor as
|
|
5
|
-
import { ThemeFontVariable as
|
|
6
|
-
import { Icon as
|
|
4
|
+
import { getAlertTextColor as k, getAlertBackgroundColor as I, getAlertIcon as M } from "./helper.js";
|
|
5
|
+
import { ThemeFontVariable as s, ThemeRadiusVariable as j, ThemeSpaceVariable as B, ThemeIconSizeVariable as f, ThemeFontSizeVariable as w } from "../../theme/theme-types.js";
|
|
6
|
+
import { Icon as d } from "../icon/icon.js";
|
|
7
7
|
import { Text as R } from "../text/text.js";
|
|
8
8
|
import { Icons as y } from "../icon/types.js";
|
|
9
9
|
function G({
|
|
10
|
-
minHeight:
|
|
11
|
-
px:
|
|
12
|
-
py:
|
|
13
|
-
w:
|
|
14
|
-
children:
|
|
10
|
+
minHeight: u = "48px",
|
|
11
|
+
px: x = B.Medium,
|
|
12
|
+
py: g = "12px",
|
|
13
|
+
w: p = "100%",
|
|
14
|
+
children: b,
|
|
15
15
|
title: o,
|
|
16
16
|
onClose: a,
|
|
17
17
|
type: e = "info",
|
|
18
|
-
iconVerticalAlign:
|
|
19
|
-
icon:
|
|
18
|
+
iconVerticalAlign: h,
|
|
19
|
+
icon: c,
|
|
20
20
|
...C
|
|
21
21
|
}) {
|
|
22
|
-
const n = i(() =>
|
|
23
|
-
|
|
22
|
+
const n = i(() => k(e), [e]), S = i(() => I(e), [e]), T = i(() => c ?? M(e), [c, e]), A = () => a ? /* @__PURE__ */ r(
|
|
23
|
+
V.button,
|
|
24
24
|
{
|
|
25
25
|
type: "button",
|
|
26
26
|
"aria-label": "Close",
|
|
27
27
|
onClick: a,
|
|
28
28
|
mt: o ? "4px" : 0,
|
|
29
29
|
alignSelf: o ? "flex-start" : "center",
|
|
30
|
-
children: /* @__PURE__ */ r(
|
|
30
|
+
children: /* @__PURE__ */ r(d, { icon: y.Close, size: f.Medium, color: n })
|
|
31
31
|
}
|
|
32
|
-
) : null,
|
|
32
|
+
) : null, m = h || (o ? "flex-start" : "center"), z = m === "flex-start" ? "4px" : 0;
|
|
33
33
|
return /* @__PURE__ */ r(
|
|
34
34
|
F,
|
|
35
35
|
{
|
|
36
36
|
bgColor: S,
|
|
37
|
-
px:
|
|
38
|
-
py:
|
|
39
|
-
w:
|
|
37
|
+
px: x,
|
|
38
|
+
py: g,
|
|
39
|
+
w: p,
|
|
40
40
|
borderRadius: j.Small,
|
|
41
41
|
display: "flex",
|
|
42
42
|
alignItems: "center",
|
|
43
|
-
minHeight:
|
|
44
|
-
fontFamily:
|
|
43
|
+
minHeight: u,
|
|
44
|
+
fontFamily: s.Body,
|
|
45
45
|
color: n,
|
|
46
46
|
...C,
|
|
47
47
|
children: /* @__PURE__ */ t(l, { align: "center", w: "100%", justify: "space-between", gap: "10px", children: [
|
|
48
48
|
/* @__PURE__ */ t(l, { gap: "10px", children: [
|
|
49
49
|
/* @__PURE__ */ r(
|
|
50
|
-
|
|
50
|
+
d,
|
|
51
51
|
{
|
|
52
52
|
color: n,
|
|
53
53
|
icon: T,
|
|
54
|
-
size:
|
|
54
|
+
size: f.Small,
|
|
55
55
|
mt: z,
|
|
56
|
-
alignSelf:
|
|
56
|
+
alignSelf: m
|
|
57
57
|
}
|
|
58
58
|
),
|
|
59
59
|
/* @__PURE__ */ t(l, { direction: "column", alignContent: "flex-start", children: [
|
|
60
60
|
o && /* @__PURE__ */ r(
|
|
61
61
|
R,
|
|
62
62
|
{
|
|
63
|
-
fontFamily:
|
|
63
|
+
fontFamily: s.SubHeader,
|
|
64
64
|
fontSize: w.Large,
|
|
65
65
|
fontWeight: "medium",
|
|
66
66
|
children: o
|
|
67
67
|
}
|
|
68
68
|
),
|
|
69
|
-
|
|
69
|
+
b
|
|
70
70
|
] })
|
|
71
71
|
] }),
|
|
72
72
|
A()
|
|
@@ -7,7 +7,7 @@ export type ButtonProps = CustomChakraBoxProps & LayoutProps & MarginProps & Pad
|
|
|
7
7
|
* @note The 'segmentedControl' variant is only used by the SegmentedControl component.
|
|
8
8
|
* @note The 'card' variant is deprecated, use the component ToggleButton instead.
|
|
9
9
|
*/
|
|
10
|
-
variant?: ResponsiveValue<"primary" | "secondary" | "link" | "ghost" | "tertiary" | "segmentedControl" | "card"> | undefined;
|
|
10
|
+
variant?: ResponsiveValue<"primary" | "secondary" | "link" | "ghost" | "tertiary" | "segmentedControl" | "card" | "alert"> | undefined;
|
|
11
11
|
/** The size of the button, default: md */
|
|
12
12
|
size?: ResponsiveValue<"lg" | "sm" | "md"> | undefined;
|
|
13
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/components/button/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,EACN,KAAK,WAAW,IAAI,iBAAiB,EACrC,KAAK,SAAS,IAAI,eAAe,EACjC,KAAK,eAAe,EACpB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,WAAW,GAAG,oBAAoB,GAC7C,WAAW,GACX,WAAW,GACX,YAAY,GACZ,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC,GAChD,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG;IACvG;;;;OAIG;IACH,OAAO,CAAC,EACL,eAAe,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/components/button/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,EACN,KAAK,WAAW,IAAI,iBAAiB,EACrC,KAAK,SAAS,IAAI,eAAe,EACjC,KAAK,eAAe,EACpB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,WAAW,GAAG,oBAAoB,GAC7C,WAAW,GACX,WAAW,GACX,YAAY,GACZ,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC,GAChD,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG;IACvG;;;;OAIG;IACH,OAAO,CAAC,EACL,eAAe,CACf,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,kBAAkB,GAAG,MAAM,GAAG,OAAO,CAC9F,GACD,SAAS,CAAC;IAEb,0CAA0C;IAC1C,IAAI,CAAC,EAAE,eAAe,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IAEvD;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEjC,iDAAiD;IACjD,QAAQ,CAAC,EAAE,KAAK,CAAC;IAEjB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,KAAK,CAAC;CAClB,CAAC"}
|
|
@@ -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,2CAsLpB"}
|
|
@@ -1,12 +1,12 @@
|
|
|
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 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 _ } from "./combobox-item.js";
|
|
5
|
+
import { Tag as v } from "../tag/tag.js";
|
|
6
|
+
import { Icon as K } from "../icon/icon.js";
|
|
7
|
+
import { Icons as T } from "../icon/types.js";
|
|
8
|
+
import { ThemeColorVariable as r, ThemeSpaceVariable as u, ThemeRadiusVariable as U, ThemeIconSizeVariable as q } from "../../theme/theme-types.js";
|
|
9
|
+
function E() {
|
|
10
10
|
return /* @__PURE__ */ i(
|
|
11
11
|
d,
|
|
12
12
|
{
|
|
@@ -26,50 +26,50 @@ function s() {
|
|
|
26
26
|
}
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
id:
|
|
31
|
-
asPlainText:
|
|
29
|
+
function P({
|
|
30
|
+
id: j,
|
|
31
|
+
asPlainText: e,
|
|
32
32
|
inputValue: b,
|
|
33
33
|
selectedItems: n,
|
|
34
|
-
displayItems:
|
|
34
|
+
displayItems: B,
|
|
35
35
|
toggleItem: C,
|
|
36
|
-
highlightState:
|
|
36
|
+
highlightState: l,
|
|
37
37
|
openState: a,
|
|
38
|
-
parentStrings:
|
|
39
|
-
size:
|
|
40
|
-
variant:
|
|
38
|
+
parentStrings: R,
|
|
39
|
+
size: V,
|
|
40
|
+
variant: W,
|
|
41
41
|
label: S,
|
|
42
|
-
placeHolderText:
|
|
42
|
+
placeHolderText: z,
|
|
43
43
|
isDisabled: h,
|
|
44
44
|
isReadOnly: m,
|
|
45
45
|
isInvalid: w,
|
|
46
46
|
collapsed: k,
|
|
47
47
|
hasPendingDelete: g,
|
|
48
|
-
setHasPendingDelete:
|
|
49
|
-
setInputValue:
|
|
48
|
+
setHasPendingDelete: t,
|
|
49
|
+
setInputValue: s,
|
|
50
50
|
onSearch: O,
|
|
51
|
-
isSingleSelect:
|
|
51
|
+
isSingleSelect: A
|
|
52
52
|
}) {
|
|
53
|
-
const
|
|
54
|
-
if (o.key === "Enter" && (o.preventDefault(), o.stopPropagation(), a.isOpen ? C(
|
|
53
|
+
const D = N("Combobox", { size: V, variant: W }), F = (o) => {
|
|
54
|
+
if (o.key === "Enter" && (o.preventDefault(), o.stopPropagation(), a.isOpen ? C(B[l.index]) : a.open()), o.key === "Escape") {
|
|
55
55
|
if (!a.isOpen) return;
|
|
56
|
-
o.preventDefault(), o.stopPropagation(), a.close(),
|
|
56
|
+
o.preventDefault(), o.stopPropagation(), a.close(), e || (s(""), O?.(""));
|
|
57
57
|
}
|
|
58
|
-
o.key === "Backspace" ? b.length === 0 && n.length > 0 && !
|
|
59
|
-
},
|
|
58
|
+
o.key === "Backspace" ? b.length === 0 && n.length > 0 && !e && (g ? (C(n[n.length - 1]), t(!1)) : t(!0)) : t(!1), o.key === "ArrowDown" && (a.isOpen ? l.next() : a.open()), o.key === "ArrowUp" && (a.isOpen ? l.previous() : a.open());
|
|
59
|
+
}, L = (o) => {
|
|
60
60
|
o.preventDefault(), o.stopPropagation();
|
|
61
61
|
const f = o.target.value;
|
|
62
|
-
|
|
63
|
-
};
|
|
62
|
+
s(f), O?.(f), l.set(0), a.open();
|
|
63
|
+
}, x = n[0], y = n[n.length - 1];
|
|
64
64
|
return /* @__PURE__ */ p(
|
|
65
|
-
|
|
65
|
+
c,
|
|
66
66
|
{
|
|
67
|
-
__css:
|
|
67
|
+
__css: D,
|
|
68
68
|
"aria-disabled": h,
|
|
69
69
|
"aria-readonly": m,
|
|
70
70
|
"aria-invalid": w,
|
|
71
|
-
borderRadius:
|
|
72
|
-
padding:
|
|
71
|
+
borderRadius: U.Small,
|
|
72
|
+
padding: u.Small,
|
|
73
73
|
_focusWithin: w ? {
|
|
74
74
|
borderColor: r.Error,
|
|
75
75
|
boxShadow: `0 0 0 4px ${r.ErrorContainer}`,
|
|
@@ -85,45 +85,45 @@ function H({
|
|
|
85
85
|
},
|
|
86
86
|
children: [
|
|
87
87
|
/* @__PURE__ */ p(
|
|
88
|
-
|
|
88
|
+
c,
|
|
89
89
|
{
|
|
90
|
-
flexWrap: k ||
|
|
91
|
-
gap:
|
|
90
|
+
flexWrap: k || A ? "nowrap" : "wrap",
|
|
91
|
+
gap: u.Small,
|
|
92
92
|
overflow: "hidden",
|
|
93
93
|
children: [
|
|
94
94
|
S && /* @__PURE__ */ i(d, { whiteSpace: "nowrap", children: S }),
|
|
95
|
-
!
|
|
96
|
-
|
|
95
|
+
!e && (k ? n.length > 0 && y && /* @__PURE__ */ p(
|
|
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(E, {}),
|
|
105
|
+
n.length > 2 && /* @__PURE__ */ i(E, {}),
|
|
106
|
+
n.length > 1 && /* @__PURE__ */ i(v, { children: n.length - 1 }),
|
|
107
107
|
/* @__PURE__ */ i(
|
|
108
|
-
|
|
108
|
+
_,
|
|
109
109
|
{
|
|
110
110
|
isDeleting: g,
|
|
111
|
-
item:
|
|
112
|
-
asPlainText:
|
|
111
|
+
item: y,
|
|
112
|
+
asPlainText: e
|
|
113
113
|
}
|
|
114
114
|
)
|
|
115
115
|
]
|
|
116
116
|
}
|
|
117
117
|
) : n.map((o, f) => /* @__PURE__ */ i(
|
|
118
|
-
|
|
118
|
+
_,
|
|
119
119
|
{
|
|
120
120
|
item: o,
|
|
121
|
-
asPlainText:
|
|
121
|
+
asPlainText: e,
|
|
122
122
|
isDeleting: f === n.length - 1 && g
|
|
123
123
|
},
|
|
124
124
|
o.id
|
|
125
125
|
))),
|
|
126
|
-
|
|
126
|
+
e && n.length > 0 && x && b === x.label && R[x.id]?.map((o) => /* @__PURE__ */ p($, { children: [
|
|
127
127
|
/* @__PURE__ */ i(
|
|
128
128
|
d,
|
|
129
129
|
{
|
|
@@ -137,19 +137,19 @@ function H({
|
|
|
137
137
|
/* @__PURE__ */ i(d, { color: r.OnSurfaceSubdued, children: "/" })
|
|
138
138
|
] }, o)),
|
|
139
139
|
/* @__PURE__ */ i(
|
|
140
|
-
|
|
140
|
+
X,
|
|
141
141
|
{
|
|
142
|
-
id:
|
|
142
|
+
id: j,
|
|
143
143
|
isDisabled: h,
|
|
144
144
|
isReadOnly: m,
|
|
145
145
|
isInvalid: w,
|
|
146
|
-
onKeyDown:
|
|
146
|
+
onKeyDown: F,
|
|
147
147
|
variant: "unstyled",
|
|
148
148
|
value: b,
|
|
149
149
|
autoComplete: "off",
|
|
150
|
-
minWidth:
|
|
151
|
-
onChange:
|
|
152
|
-
placeholder:
|
|
150
|
+
minWidth: u.XLarge,
|
|
151
|
+
onChange: L,
|
|
152
|
+
placeholder: z,
|
|
153
153
|
border: "none",
|
|
154
154
|
flex: 1,
|
|
155
155
|
color: r.OnSurface,
|
|
@@ -166,11 +166,11 @@ function H({
|
|
|
166
166
|
]
|
|
167
167
|
}
|
|
168
168
|
),
|
|
169
|
-
/* @__PURE__ */ i(
|
|
170
|
-
|
|
169
|
+
/* @__PURE__ */ i(c, { className: "combobox-dropdown-icon", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ i(
|
|
170
|
+
K,
|
|
171
171
|
{
|
|
172
|
-
icon:
|
|
173
|
-
size:
|
|
172
|
+
icon: T.TreeViewCollapse,
|
|
173
|
+
size: q.Small,
|
|
174
174
|
color: h || m ? r.OnSurfaceSubdued : r.OnSurface
|
|
175
175
|
}
|
|
176
176
|
) })
|
|
@@ -179,5 +179,5 @@ function H({
|
|
|
179
179
|
);
|
|
180
180
|
}
|
|
181
181
|
export {
|
|
182
|
-
|
|
182
|
+
P as ComboboxButton
|
|
183
183
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox-menu.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox-menu.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"combobox-menu.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox-menu.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAyClD,wBAAgB,qBAAqB,CAAC,EACrC,cAAc,EACd,SAAS,GACT,EAAE;IACF,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;CACnB,2CAwBA;AAED,wBAAgB,YAAY,CAAC,EAC5B,WAAW,EACX,UAAU,EACV,aAAa,EACb,YAAY,EACZ,UAAU,EACV,cAAc,EACd,SAAS,EACT,aAAa,EACb,cAAc,EACd,WAAW,EACX,UAAU,EACV,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,SAAS,EACT,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,WAAW,GACX,EAAE,kBAAkB,2CAqJpB"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsxs as l, jsx as i, Fragment as G } from "react/jsx-runtime";
|
|
2
2
|
import { Box as d, Flex as g } from "@chakra-ui/react";
|
|
3
3
|
import { autoUpdate as J, computePosition as K, flip as L } from "../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
|
|
4
|
-
import { Fragment as
|
|
4
|
+
import { Fragment as z, useState as N, useEffect as Q } from "react";
|
|
5
5
|
import { ComboboxItem as Z } from "./combobox-item.js";
|
|
6
6
|
import { interpolate as R } from "./translations.js";
|
|
7
|
-
import { ThemeColorVariable as o, ThemeShadowVariable as oo, ThemeRadiusVariable as
|
|
8
|
-
import { Text as
|
|
9
|
-
import { Icon as
|
|
10
|
-
import { Icons as
|
|
11
|
-
const eo = (n, e, u, a,
|
|
12
|
-
const [
|
|
7
|
+
import { ThemeColorVariable as o, ThemeShadowVariable as oo, ThemeRadiusVariable as D, ThemeSpaceVariable as t, ThemeIconSizeVariable as $, ThemeFontSizeVariable as ro, ThemeBorderVariable as no } from "../../theme/theme-types.js";
|
|
8
|
+
import { Text as V } from "../text/text.js";
|
|
9
|
+
import { Icon as B } from "../icon/icon.js";
|
|
10
|
+
import { Icons as C } from "../icon/types.js";
|
|
11
|
+
const eo = (n, e, u, a, p) => {
|
|
12
|
+
const [s, m] = N({
|
|
13
13
|
transform: "translate(0, 0)",
|
|
14
14
|
minWidth: 0
|
|
15
15
|
});
|
|
@@ -18,18 +18,20 @@ const eo = (n, e, u, a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
const S = async () => {
|
|
20
20
|
if (n.current && e.current && u) {
|
|
21
|
-
const { width:
|
|
22
|
-
placement:
|
|
21
|
+
const { width: h } = n.current.getBoundingClientRect(), { x, y: k } = await K(n.current, e.current, {
|
|
22
|
+
placement: p || "bottom-start",
|
|
23
23
|
middleware: [L()]
|
|
24
24
|
});
|
|
25
|
-
|
|
26
|
-
transform: `translate(${
|
|
27
|
-
minWidth: a ||
|
|
25
|
+
m({
|
|
26
|
+
transform: `translate(${x}px, ${k}px)`,
|
|
27
|
+
minWidth: a || h
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
+
}, b = () => {
|
|
31
|
+
S().catch(console.error);
|
|
30
32
|
};
|
|
31
|
-
return J(n.current, e.current,
|
|
32
|
-
}, [n, e, u,
|
|
33
|
+
return J(n.current, e.current, b);
|
|
34
|
+
}, [n, e, u, p, a]), s;
|
|
33
35
|
};
|
|
34
36
|
function to({
|
|
35
37
|
isSingleSelect: n,
|
|
@@ -44,15 +46,15 @@ function to({
|
|
|
44
46
|
flexShrink: "0",
|
|
45
47
|
border: `${n && e ? 8 : 2}px solid ${e ? o.Primary : o.OnBackground}`,
|
|
46
48
|
backgroundColor: e && !n ? o.Primary : "auto",
|
|
47
|
-
borderRadius: n ? "50%" :
|
|
49
|
+
borderRadius: n ? "50%" : D.Small,
|
|
48
50
|
children: !n && e && /* @__PURE__ */ i(
|
|
49
|
-
|
|
51
|
+
B,
|
|
50
52
|
{
|
|
51
53
|
top: "-2px",
|
|
52
54
|
position: "absolute",
|
|
53
55
|
width: $.Small,
|
|
54
56
|
color: o.Surface,
|
|
55
|
-
icon:
|
|
57
|
+
icon: C.Checkbox
|
|
56
58
|
}
|
|
57
59
|
)
|
|
58
60
|
}
|
|
@@ -63,49 +65,49 @@ function fo({
|
|
|
63
65
|
inputValue: e,
|
|
64
66
|
selectedItems: u,
|
|
65
67
|
displayItems: a,
|
|
66
|
-
toggleItem:
|
|
67
|
-
highlightState:
|
|
68
|
-
openState:
|
|
68
|
+
toggleItem: p,
|
|
69
|
+
highlightState: s,
|
|
70
|
+
openState: m,
|
|
69
71
|
parentStrings: S,
|
|
70
|
-
isSingleSelect:
|
|
72
|
+
isSingleSelect: b,
|
|
71
73
|
isSearching: h,
|
|
72
74
|
isReadOnly: x,
|
|
73
|
-
isHidingItems:
|
|
75
|
+
isHidingItems: k,
|
|
74
76
|
popoverWidth: I,
|
|
75
77
|
popoverPlacement: X,
|
|
76
|
-
previousSelectedItems:
|
|
78
|
+
previousSelectedItems: w,
|
|
77
79
|
parentRef: j,
|
|
78
|
-
popupRef:
|
|
79
|
-
footerContent:
|
|
80
|
-
subMenuState:
|
|
81
|
-
translation:
|
|
80
|
+
popupRef: O,
|
|
81
|
+
footerContent: v,
|
|
82
|
+
subMenuState: M,
|
|
83
|
+
translation: T
|
|
82
84
|
}) {
|
|
83
85
|
const H = eo(
|
|
84
86
|
j,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
O,
|
|
88
|
+
m.isOpen,
|
|
87
89
|
I,
|
|
88
90
|
X
|
|
89
91
|
), A = (r) => {
|
|
90
|
-
|
|
92
|
+
s.set(r);
|
|
91
93
|
};
|
|
92
94
|
return /* @__PURE__ */ l(
|
|
93
95
|
d,
|
|
94
96
|
{
|
|
95
|
-
display:
|
|
97
|
+
display: m.isOpen ? "block" : "none",
|
|
96
98
|
inset: "0 auto auto 0",
|
|
97
99
|
position: "fixed",
|
|
98
100
|
zIndex: "50",
|
|
99
101
|
visibility: "visible",
|
|
100
102
|
backgroundColor: o.Surface,
|
|
101
|
-
borderRadius:
|
|
103
|
+
borderRadius: D.Medium,
|
|
102
104
|
boxShadow: oo.Medium,
|
|
103
105
|
color: o.OnSurface,
|
|
104
106
|
overflow: "hidden",
|
|
105
107
|
style: H,
|
|
106
|
-
ref:
|
|
108
|
+
ref: O,
|
|
107
109
|
onClick: (r) => {
|
|
108
|
-
r.preventDefault(), r.stopPropagation(),
|
|
110
|
+
r.preventDefault(), r.stopPropagation(), b && m.close();
|
|
109
111
|
},
|
|
110
112
|
children: [
|
|
111
113
|
/* @__PURE__ */ l(
|
|
@@ -119,37 +121,37 @@ function fo({
|
|
|
119
121
|
padding: `${t.Small} 0`,
|
|
120
122
|
children: [
|
|
121
123
|
h && a.length === 0 && e.length > 0 && /* @__PURE__ */ i(
|
|
122
|
-
|
|
124
|
+
V,
|
|
123
125
|
{
|
|
124
126
|
px: t.Small,
|
|
125
127
|
color: o.OnSurfaceSubdued,
|
|
126
|
-
children: `${
|
|
128
|
+
children: `${T.noMatchFor} "${e}"`
|
|
127
129
|
}
|
|
128
130
|
),
|
|
129
131
|
a.map((r, f) => {
|
|
130
|
-
const
|
|
131
|
-
c.stopPropagation(), c.preventDefault(),
|
|
132
|
-
}, U = r.children?.length,
|
|
133
|
-
/* @__PURE__ */ i(
|
|
132
|
+
const y = u.some((c) => c.id === r.id), E = (c) => {
|
|
133
|
+
c.stopPropagation(), c.preventDefault(), p(r);
|
|
134
|
+
}, 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: [
|
|
135
|
+
/* @__PURE__ */ i(B, { icon: C.Back, size: $.Small }),
|
|
134
136
|
r.label
|
|
135
137
|
] }) : /* @__PURE__ */ l(G, { children: [
|
|
136
138
|
/* @__PURE__ */ l(g, { gap: t.XSmall, alignItems: "center", whiteSpace: "nowrap", children: [
|
|
137
|
-
S[r.id]?.map((c) => /* @__PURE__ */ l(
|
|
139
|
+
S[r.id]?.map((c) => /* @__PURE__ */ l(z, { children: [
|
|
138
140
|
/* @__PURE__ */ i(d, { color: o.OnSurfaceSubdued, children: c }),
|
|
139
141
|
/* @__PURE__ */ i(d, { color: o.OnSurfaceSubdued, children: "/" })
|
|
140
142
|
] }, c)),
|
|
141
143
|
/* @__PURE__ */ i(Z, { item: r, asPlainText: n })
|
|
142
144
|
] }),
|
|
143
|
-
x ? void 0 : U && !
|
|
144
|
-
|
|
145
|
+
x ? void 0 : U && !F && !h ? /* @__PURE__ */ i(
|
|
146
|
+
B,
|
|
145
147
|
{
|
|
146
|
-
icon:
|
|
148
|
+
icon: C.Forward,
|
|
147
149
|
size: $.Small,
|
|
148
150
|
color: o.OnBackgroundSubdued
|
|
149
151
|
}
|
|
150
|
-
) : /* @__PURE__ */ i(to, { isSingleSelect:
|
|
151
|
-
] }), _ =
|
|
152
|
-
return /* @__PURE__ */ l(
|
|
152
|
+
) : /* @__PURE__ */ i(to, { isSingleSelect: b, isChecked: y })
|
|
153
|
+
] }), _ = w.length > 0 && w.length - 1 === f && w.length < a.length, q = !x && !h && (_ || (P || F));
|
|
154
|
+
return /* @__PURE__ */ l(z, { children: [
|
|
153
155
|
/* @__PURE__ */ i(
|
|
154
156
|
g,
|
|
155
157
|
{
|
|
@@ -160,19 +162,19 @@ function fo({
|
|
|
160
162
|
padding: `${t.Small} ${t.Medium}`,
|
|
161
163
|
gap: t.Medium,
|
|
162
164
|
textDecoration: "none",
|
|
163
|
-
backgroundColor:
|
|
165
|
+
backgroundColor: s.index === f ? o.AccentHoverAlpha : "",
|
|
164
166
|
onClick: E,
|
|
165
167
|
tabIndex: -1,
|
|
166
168
|
onMouseEnter: () => A(f),
|
|
167
|
-
"data-is-active-index":
|
|
168
|
-
"aria-selected":
|
|
169
|
+
"data-is-active-index": s.index === f,
|
|
170
|
+
"aria-selected": y,
|
|
169
171
|
children: Y
|
|
170
172
|
}
|
|
171
173
|
),
|
|
172
174
|
q && /* @__PURE__ */ i(
|
|
173
175
|
d,
|
|
174
176
|
{
|
|
175
|
-
margin: `${t.Small} ${
|
|
177
|
+
margin: `${t.Small} ${P ? 0 : t.Medium}`,
|
|
176
178
|
height: "1px",
|
|
177
179
|
flexShrink: 0,
|
|
178
180
|
backgroundColor: o.OnBackgroundBorder
|
|
@@ -180,14 +182,14 @@ function fo({
|
|
|
180
182
|
)
|
|
181
183
|
] }, r.id);
|
|
182
184
|
}),
|
|
183
|
-
|
|
184
|
-
|
|
185
|
+
k && /* @__PURE__ */ i(
|
|
186
|
+
V,
|
|
185
187
|
{
|
|
186
188
|
px: t.Small,
|
|
187
189
|
py: t.Small,
|
|
188
190
|
color: o.OnSurfaceSubdued,
|
|
189
191
|
fontSize: ro.Small,
|
|
190
|
-
children: R(
|
|
192
|
+
children: R(T.showMaxItems, {
|
|
191
193
|
count: a.length
|
|
192
194
|
})
|
|
193
195
|
}
|
|
@@ -195,7 +197,7 @@ function fo({
|
|
|
195
197
|
]
|
|
196
198
|
}
|
|
197
199
|
),
|
|
198
|
-
|
|
200
|
+
v && /* @__PURE__ */ i(
|
|
199
201
|
d,
|
|
200
202
|
{
|
|
201
203
|
position: "sticky",
|
|
@@ -203,7 +205,7 @@ function fo({
|
|
|
203
205
|
backgroundColor: o.Surface,
|
|
204
206
|
padding: `${t.Small} ${t.Medium}`,
|
|
205
207
|
borderTop: `${no.XSmall} ${o.OnSurfaceBorder}`,
|
|
206
|
-
children:
|
|
208
|
+
children: v
|
|
207
209
|
}
|
|
208
210
|
)
|
|
209
211
|
]
|
|
@@ -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;AAiGjB;;;;;;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,GAAG,KAAK,EACR,EAAE,aAAa,
|
|
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;AAiGjB;;;;;;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,GAAG,KAAK,EACR,EAAE,aAAa,2CA+Lf"}
|