@caspeco/casper-ui-library 4.0.1 → 4.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.
Files changed (63) hide show
  1. package/dist/components/box/box.d.ts +3 -3
  2. package/dist/components/box/box.d.ts.map +1 -1
  3. package/dist/components/button/button.d.ts +3 -2
  4. package/dist/components/button/button.d.ts.map +1 -1
  5. package/dist/components/checkbox/checkbox.d.ts +1 -1
  6. package/dist/components/checkbox-group/checkbox-group.d.ts +1 -1
  7. package/dist/components/combobox/combobox-button.d.ts +1 -1
  8. package/dist/components/combobox/combobox-button.d.ts.map +1 -1
  9. package/dist/components/combobox/combobox-button.js +90 -73
  10. package/dist/components/combobox/combobox-item.d.ts +2 -1
  11. package/dist/components/combobox/combobox-item.d.ts.map +1 -1
  12. package/dist/components/combobox/combobox-item.js +10 -10
  13. package/dist/components/combobox/combobox.d.ts +1 -1
  14. package/dist/components/combobox/combobox.d.ts.map +1 -1
  15. package/dist/components/combobox/combobox.js +90 -88
  16. package/dist/components/combobox/types.d.ts +2 -0
  17. package/dist/components/combobox/types.d.ts.map +1 -1
  18. package/dist/components/date-picker/date-picker.d.ts +1 -1
  19. package/dist/components/date-picker/date-range-picker.d.ts +1 -1
  20. package/dist/components/date-picker/date-week-picker.d.ts +1 -1
  21. package/dist/components/divider/divider.d.ts +1 -1
  22. package/dist/components/drawer/drawer.d.ts +1 -1
  23. package/dist/components/form-control/form-control.d.ts +1 -1
  24. package/dist/components/form-control/form-error-message.d.ts +1 -1
  25. package/dist/components/form-control/form-helper-text.d.ts +1 -1
  26. package/dist/components/form-control/form-label.d.ts +1 -1
  27. package/dist/components/grid/grid-item.d.ts +1 -1
  28. package/dist/components/grid/grid.d.ts +1 -1
  29. package/dist/components/heading/heading.d.ts +1 -1
  30. package/dist/components/icon-button/icon-button.d.ts +1 -1
  31. package/dist/components/image/image.d.ts +1 -1
  32. package/dist/components/input/input.d.ts +1 -1
  33. package/dist/components/link/link.d.ts +1 -1
  34. package/dist/components/list/list.d.ts +1 -1
  35. package/dist/components/message/message.d.ts +1 -1
  36. package/dist/components/modal/modal-body.d.ts +1 -1
  37. package/dist/components/modal/modal-close-button.d.ts +1 -1
  38. package/dist/components/modal/modal-footer.d.ts +1 -1
  39. package/dist/components/modal/modal-header.d.ts +1 -1
  40. package/dist/components/navigation-list/navigation-list-item.d.ts +2 -2
  41. package/dist/components/navigation-list/navigation-list.d.ts +1 -1
  42. package/dist/components/radio/radio-addon.d.ts +1 -1
  43. package/dist/components/radio/radio-card.d.ts +1 -1
  44. package/dist/components/radio/radio.d.ts +1 -1
  45. package/dist/components/radio-group/radio-group.d.ts +1 -1
  46. package/dist/components/segmented-control/segmented-control.d.ts +1 -1
  47. package/dist/components/skeleton/skeleton-text.d.ts +1 -1
  48. package/dist/components/skeleton/skeleton.d.ts +1 -1
  49. package/dist/components/stack/stack.d.ts +3 -3
  50. package/dist/components/stack/stack.d.ts.map +1 -1
  51. package/dist/components/stepper/stepper.d.ts +1 -1
  52. package/dist/components/tabs/tab-list.d.ts +1 -1
  53. package/dist/components/tabs/tab-panel.d.ts +1 -1
  54. package/dist/components/tabs/tab-panels.d.ts +1 -1
  55. package/dist/components/tabs/tab.d.ts +1 -1
  56. package/dist/components/tabs/tabs.d.ts +1 -1
  57. package/dist/components/text/text.d.ts +1 -1
  58. package/dist/components/toast/toast.d.ts +1 -1
  59. package/dist/components/toggle-button/toggle-button.d.ts +1 -1
  60. package/dist/components/tooltip/tooltip.d.ts +1 -1
  61. package/dist/theme/theme-provider.d.ts +1 -1
  62. package/dist/theme/theme-style-props.d.ts +1 -1
  63. package/package.json +2 -2
@@ -1,8 +1,8 @@
1
1
  import { ThemeStyleProps } from '../../theme/index.js';
2
- import { BoxProps as ChakraBoxProps } from '@chakra-ui/react';
2
+ import { BoxProps as ChakraBoxProps, ComponentWithAs } from '@chakra-ui/react';
3
3
  export type BoxProps = ThemeStyleProps & Pick<ChakraBoxProps, "children" | "as">;
4
4
  /**
5
- * @see Docs https://bit.cloud/caspeco/casper-ui-library/components/box
5
+ * @see Docs https://caspeco.github.io/casper-ui-library/components/box
6
6
  */
7
- export declare const Box: import('@chakra-ui/system').ComponentWithAs<"div", BoxProps>;
7
+ export declare const Box: ComponentWithAs<"div", BoxProps>;
8
8
  //# sourceMappingURL=box.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../../lib/components/box/box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAoB,KAAK,QAAQ,IAAI,cAAc,EAAc,MAAM,kBAAkB,CAAC;AAEjG,MAAM,MAAM,QAAQ,GAAG,eAAe,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,GAAG,8DAMd,CAAC"}
1
+ {"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../../lib/components/box/box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAEN,KAAK,QAAQ,IAAI,cAAc,EAC/B,KAAK,eAAe,EAEpB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,QAAQ,GAAG,eAAe,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC;AAEjF;;GAEG;AAGH,eAAO,MAAM,GAAG,EAMV,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC"}
@@ -1,10 +1,11 @@
1
+ import { ComponentWithAs } from '@chakra-ui/react';
1
2
  import { ButtonProps } from './types.js';
2
3
  /**
3
4
  * Button component is used to trigger an action or event,
4
5
  * such as submitting a form, opening a Dialog, canceling an action, or performing a delete operation.
5
6
  *
6
- * @see Docs https://bit.cloud/caspeco/casper-ui-library/components/button
7
+ * @see Docs https://caspeco.github.io/casper-ui-library/components/button
7
8
  * @see WAI-ARIA https://www.w3.org/WAI/ARIA/apg/patterns/button
8
9
  */
9
- export declare const Button: import('@chakra-ui/system').ComponentWithAs<"button", ButtonProps>;
10
+ export declare const Button: ComponentWithAs<"button", ButtonProps>;
10
11
  //# sourceMappingURL=button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../lib/components/button/button.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,oEAqCjB,CAAC"}
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../lib/components/button/button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsC,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAG5F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;GAMG;AAGH,eAAO,MAAM,MAAM,EAqCb,eAAe,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC"}
@@ -3,7 +3,7 @@ import { CheckboxProps } from './types.js';
3
3
  /**
4
4
  * Used in forms when a user needs to select multiple values from several options.
5
5
  *
6
- * @see Docs https://bit.cloud/caspeco/casper-ui-library/components/checkbox
6
+ * @see Docs https://caspeco.github.io/casper-ui-library/components/checkbox
7
7
  * @see WAI-ARIA https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/
8
8
  */
9
9
  export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
@@ -3,7 +3,7 @@ import { CheckboxGroupProps } from './types.js';
3
3
  * Used for multiple checkboxes which are bound in one group,
4
4
  * and it indicates whether one or more options are selected.
5
5
  *
6
- * @see Docs https://bit.cloud/caspeco/casper-ui-library/components/checkbox-group
6
+ * @see Docs https://caspeco.github.io/casper-ui-library/components/checkbox-group
7
7
  */
8
8
  export declare function CheckboxGroup({ children, ...props }: CheckboxGroupProps): import("react/jsx-runtime").JSX.Element;
9
9
  //# sourceMappingURL=checkbox-group.d.ts.map
@@ -1,3 +1,3 @@
1
1
  import { ComboboxInnerProps } from './types.js';
2
- export declare function ComboboxButton({ id, asPlainText, inputValue, selectedItems, displayItems, toggleItem, highlightState, openState, parentStrings, size, variant, label, placeHolderText, isDisabled, isReadOnly, isInvalid, collapsed, setInputValue, onSearch, isSingleSelect, }: ComboboxInnerProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function ComboboxButton({ id, asPlainText, inputValue, selectedItems, displayItems, toggleItem, highlightState, openState, parentStrings, size, variant, label, placeHolderText, isDisabled, isReadOnly, isInvalid, collapsed, hasPendingDelete, setHasPendingDelete, setInputValue, onSearch, isSingleSelect, }: ComboboxInnerProps): import("react/jsx-runtime").JSX.Element;
3
3
  //# sourceMappingURL=combobox-button.d.ts.map
@@ -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,aAAa,EACb,QAAQ,EACR,cAAc,GACd,EAAE,kBAAkB,2CAuJpB"}
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,2CAwKpB"}
@@ -1,14 +1,14 @@
1
- import { jsxs as f, jsx as i } from "react/jsx-runtime";
2
- import { useStyleConfig as z, Flex as p, Box as c, Input as A } from "@chakra-ui/react";
3
- import { Fragment as E } from "react";
4
- import { ComboboxItem as S } from "./combobox-item.js";
5
- import { Tag as F } from "../tag/tag.js";
6
- import { Icon as L } from "../icon/icon.js";
7
- import { Icons as N } from "../icon/types.js";
8
- import { ThemeColorVariable as n, ThemeSpaceVariable as u, ThemeRadiusVariable as X, ThemeIconSizeVariable as K } from "../../theme/theme-types.js";
9
- function k() {
1
+ import { jsxs as p, jsx as i } from "react/jsx-runtime";
2
+ import { useStyleConfig as E, Flex as u, Box as d, Input as F } from "@chakra-ui/react";
3
+ import { Fragment as L } from "react";
4
+ import { ComboboxItem as O } from "./combobox-item.js";
5
+ import { Tag as N } from "../tag/tag.js";
6
+ import { Icon as X } from "../icon/icon.js";
7
+ import { Icons as K } from "../icon/types.js";
8
+ import { ThemeColorVariable as n, ThemeSpaceVariable as c, ThemeRadiusVariable as T, ThemeIconSizeVariable as U } from "../../theme/theme-types.js";
9
+ function y() {
10
10
  return /* @__PURE__ */ i(
11
- c,
11
+ d,
12
12
  {
13
13
  backgroundColor: n.NeutralContainer,
14
14
  width: "8px",
@@ -26,47 +26,49 @@ function k() {
26
26
  }
27
27
  );
28
28
  }
29
- function Q({
29
+ function H({
30
30
  id: s,
31
- asPlainText: e,
32
- inputValue: d,
31
+ asPlainText: l,
32
+ inputValue: b,
33
33
  selectedItems: r,
34
- displayItems: O,
35
- toggleItem: m,
36
- highlightState: l,
34
+ displayItems: _,
35
+ toggleItem: x,
36
+ highlightState: f,
37
37
  openState: a,
38
- parentStrings: y,
39
- size: _,
40
- variant: D,
41
- label: g,
42
- placeHolderText: j,
43
- isDisabled: b,
44
- isReadOnly: h,
45
- isInvalid: B,
46
- collapsed: w,
47
- setInputValue: x,
48
- onSearch: C,
49
- isSingleSelect: R
38
+ parentStrings: j,
39
+ size: B,
40
+ variant: R,
41
+ label: C,
42
+ placeHolderText: V,
43
+ isDisabled: h,
44
+ isReadOnly: m,
45
+ isInvalid: W,
46
+ collapsed: S,
47
+ hasPendingDelete: w,
48
+ setHasPendingDelete: g,
49
+ setInputValue: k,
50
+ onSearch: t,
51
+ isSingleSelect: v
50
52
  }) {
51
- const V = z("Combobox", { size: _, variant: D }), W = (o) => {
52
- if (o.key === "Enter" && (o.preventDefault(), o.stopPropagation(), a.isOpen ? m(O[l.index]) : a.open()), o.key === "Escape") {
53
+ const z = E("Combobox", { size: B, variant: R }), A = (o) => {
54
+ if (o.key === "Enter" && (o.preventDefault(), o.stopPropagation(), a.isOpen ? x(_[f.index]) : a.open()), o.key === "Escape") {
53
55
  if (!a.isOpen) return;
54
- o.preventDefault(), o.stopPropagation(), a.close(), e || (x(""), C?.(""));
56
+ o.preventDefault(), o.stopPropagation(), a.close(), l || (k(""), t?.(""));
55
57
  }
56
- o.key === "Backspace" && d.length === 0 && r.length > 0 && !e && m(r[r.length - 1]), o.key === "ArrowDown" && (a.isOpen ? l.next() : a.open()), o.key === "ArrowUp" && (a.isOpen ? l.previous() : a.open());
57
- }, v = (o) => {
58
+ o.key === "Backspace" ? b.length === 0 && r.length > 0 && !l && (w ? (x(r[r.length - 1]), g(!1)) : g(!0)) : g(!1), o.key === "ArrowDown" && (a.isOpen ? f.next() : a.open()), o.key === "ArrowUp" && (a.isOpen ? f.previous() : a.open());
59
+ }, D = (o) => {
58
60
  o.preventDefault(), o.stopPropagation();
59
- const t = o.target.value;
60
- x(t), C?.(t), l.set(0), a.open();
61
+ const e = o.target.value;
62
+ k(e), t?.(e), f.set(0), a.open();
61
63
  };
62
- return /* @__PURE__ */ f(
63
- p,
64
+ return /* @__PURE__ */ p(
65
+ u,
64
66
  {
65
- __css: V,
66
- "aria-disabled": b,
67
- "aria-readonly": h,
68
- borderRadius: X.Small,
69
- padding: u.Small,
67
+ __css: z,
68
+ "aria-disabled": h,
69
+ "aria-readonly": m,
70
+ borderRadius: T.Small,
71
+ padding: c.Small,
70
72
  _focusWithin: {
71
73
  borderColor: n.Info,
72
74
  boxShadow: `0 0 0 4px ${n.InfoContainer}`,
@@ -77,33 +79,48 @@ function Q({
77
79
  backgroundColor: n.SurfaceDisabled
78
80
  },
79
81
  children: [
80
- /* @__PURE__ */ f(
81
- p,
82
+ /* @__PURE__ */ p(
83
+ u,
82
84
  {
83
- flexWrap: w || R ? "nowrap" : "wrap",
84
- gap: u.Small,
85
+ flexWrap: S || v ? "nowrap" : "wrap",
86
+ gap: c.Small,
85
87
  overflow: "hidden",
86
88
  children: [
87
- g && /* @__PURE__ */ i(c, { whiteSpace: "nowrap", children: g }),
88
- !e && (w ? r.length > 0 && /* @__PURE__ */ f(
89
- p,
89
+ C && /* @__PURE__ */ i(d, { whiteSpace: "nowrap", children: C }),
90
+ !l && (S ? r.length > 0 && /* @__PURE__ */ p(
91
+ u,
90
92
  {
91
- gap: u.XSmall,
93
+ gap: c.XSmall,
92
94
  flexShrink: "1",
93
95
  overflow: "hidden",
94
96
  whiteSpace: "nowrap",
95
97
  textOverflow: "ellipsis",
96
98
  children: [
97
- r.length > 3 && /* @__PURE__ */ i(k, {}),
98
- r.length > 2 && /* @__PURE__ */ i(k, {}),
99
- r.length > 1 && /* @__PURE__ */ i(F, { children: r.length - 1 }),
100
- /* @__PURE__ */ i(S, { item: r[r.length - 1], asPlainText: e })
99
+ r.length > 3 && /* @__PURE__ */ i(y, {}),
100
+ r.length > 2 && /* @__PURE__ */ i(y, {}),
101
+ r.length > 1 && /* @__PURE__ */ i(N, { children: r.length - 1 }),
102
+ /* @__PURE__ */ i(
103
+ O,
104
+ {
105
+ isDeleting: w,
106
+ item: r[r.length - 1],
107
+ asPlainText: l
108
+ }
109
+ )
101
110
  ]
102
111
  }
103
- ) : r.map((o) => /* @__PURE__ */ i(S, { item: o, asPlainText: e }, o.id))),
104
- e && r.length > 0 && d === r[0].label && y[r[0].id]?.map((o) => /* @__PURE__ */ f(E, { children: [
112
+ ) : r.map((o, e) => /* @__PURE__ */ i(
113
+ O,
114
+ {
115
+ item: o,
116
+ asPlainText: l,
117
+ isDeleting: e === r.length - 1 && w
118
+ },
119
+ o.id
120
+ ))),
121
+ l && r.length > 0 && b === r[0].label && j[r[0].id]?.map((o) => /* @__PURE__ */ p(L, { children: [
105
122
  /* @__PURE__ */ i(
106
- c,
123
+ d,
107
124
  {
108
125
  color: n.OnSurfaceSubdued,
109
126
  textOverflow: "ellipsis",
@@ -112,22 +129,22 @@ function Q({
112
129
  children: o
113
130
  }
114
131
  ),
115
- /* @__PURE__ */ i(c, { color: n.OnSurfaceSubdued, children: "/" })
132
+ /* @__PURE__ */ i(d, { color: n.OnSurfaceSubdued, children: "/" })
116
133
  ] }, o)),
117
134
  /* @__PURE__ */ i(
118
- A,
135
+ F,
119
136
  {
120
137
  id: s,
121
- isDisabled: b,
122
- isReadOnly: h,
123
- isInvalid: B,
124
- onKeyDown: W,
138
+ isDisabled: h,
139
+ isReadOnly: m,
140
+ isInvalid: W,
141
+ onKeyDown: A,
125
142
  variant: "unstyled",
126
- value: d,
143
+ value: b,
127
144
  autoComplete: "off",
128
- minWidth: u.XLarge,
129
- onChange: v,
130
- placeholder: j,
145
+ minWidth: c.XLarge,
146
+ onChange: D,
147
+ placeholder: V,
131
148
  border: "none",
132
149
  flex: 1,
133
150
  color: n.OnSurface,
@@ -144,12 +161,12 @@ function Q({
144
161
  ]
145
162
  }
146
163
  ),
147
- /* @__PURE__ */ i(p, { className: "combobox-dropdown-icon", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ i(
148
- L,
164
+ /* @__PURE__ */ i(u, { className: "combobox-dropdown-icon", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ i(
165
+ X,
149
166
  {
150
- icon: N.TreeViewCollapse,
151
- size: K.Small,
152
- color: b || h ? n.OnSurfaceSubdued : n.OnSurface
167
+ icon: K.TreeViewCollapse,
168
+ size: U.Small,
169
+ color: h || m ? n.OnSurfaceSubdued : n.OnSurface
153
170
  }
154
171
  ) })
155
172
  ]
@@ -157,5 +174,5 @@ function Q({
157
174
  );
158
175
  }
159
176
  export {
160
- Q as ComboboxButton
177
+ H as ComboboxButton
161
178
  };
@@ -2,7 +2,8 @@ import { ComboboxItem as ComboboxItemType } from './types.js';
2
2
  type ComboboxItemProps = {
3
3
  item: ComboboxItemType;
4
4
  asPlainText?: boolean;
5
+ isDeleting?: boolean;
5
6
  };
6
- export declare function ComboboxItem({ item, asPlainText }: ComboboxItemProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function ComboboxItem({ item, asPlainText, isDeleting }: ComboboxItemProps): import("react/jsx-runtime").JSX.Element;
7
8
  export {};
8
9
  //# 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;AAahE,KAAK,iBAAiB,GAAG;IACxB,IAAI,EAAE,gBAAgB,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,iBAAiB,2CAiBpE"}
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;AAahE,KAAK,iBAAiB,GAAG;IACxB,IAAI,EAAE,gBAAgB,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,iBAAiB,2CAiBhF"}
@@ -1,9 +1,9 @@
1
- import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
- import { Flex as t } from "@chakra-ui/react";
3
- import { Box as n } from "../box/box.js";
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import { Flex as d } from "@chakra-ui/react";
3
+ import { Box as a } from "../box/box.js";
4
4
  import { Tag as r } from "../tag/tag.js";
5
- import { ThemeSpaceVariable as d } from "../../theme/theme-types.js";
6
- const c = {
5
+ import { ThemeSpaceVariable as c } from "../../theme/theme-types.js";
6
+ const s = {
7
7
  info: r.Info,
8
8
  success: r.Success,
9
9
  warning: r.Warning,
@@ -13,13 +13,13 @@ const c = {
13
13
  neutral: r,
14
14
  undefined: r.ComboboxItem
15
15
  };
16
- function x({ item: o, asPlainText: a }) {
17
- const l = o.variant || "neutral", p = c[l];
18
- return a ? /* @__PURE__ */ i(t, { gap: d.XSmall, overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis", children: [
16
+ function b({ item: o, asPlainText: p, isDeleting: n }) {
17
+ const l = n ? "primary" : o.variant || "neutral", i = s[l];
18
+ return p ? /* @__PURE__ */ t(d, { gap: c.XSmall, overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis", children: [
19
19
  o.prepend,
20
20
  o.label
21
- ] }) : /* @__PURE__ */ e(n, { overflow: "hidden", children: /* @__PURE__ */ e(p, { prepend: o.prepend, dot: o.dot, children: /* @__PURE__ */ e(n, { display: "block", overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis", children: o.label }) }) });
21
+ ] }) : /* @__PURE__ */ e(a, { overflow: "hidden", children: /* @__PURE__ */ e(i, { prepend: o.prepend, dot: o.dot, solid: n, children: /* @__PURE__ */ e(a, { display: "block", overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis", children: o.label }) }) });
22
22
  }
23
23
  export {
24
- x as ComboboxItem
24
+ b as ComboboxItem
25
25
  };
@@ -4,7 +4,7 @@ import { ComboboxProps } from './types.js';
4
4
  * are many and can benefit from having a search filter. Can be used as both single select
5
5
  * and multiselect.
6
6
  *
7
- * @see Docs https://bit.cloud/caspeco/casper-ui-library/components/combobox
7
+ * @see Docs https://caspeco.github.io/casper-ui-library/components/combobox
8
8
  */
9
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;
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;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,2CAsLf"}
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,2CA2Lf"}
@@ -1,13 +1,13 @@
1
- import { jsxs as T, jsx as F } from "react/jsx-runtime";
2
- import { Box as D } from "@chakra-ui/react";
3
- import { useState as g, useRef as V, useEffect as M, useMemo as _ } from "react";
4
- import { ComboboxButton as ee } from "./combobox-button.js";
5
- import { ComboboxMenu as ne } from "./combobox-menu.js";
6
- import { translations as te } from "./translations.js";
7
- const re = (o, s) => {
8
- const [n, e] = g(0), c = (l) => {
9
- if (!s.current) return;
10
- const b = [...s.current.querySelectorAll("li")];
1
+ import { jsxs as ee, jsx as V } from "react/jsx-runtime";
2
+ import { Box as ne } from "@chakra-ui/react";
3
+ import { useState as p, useRef as _, useEffect as q, useMemo as m } from "react";
4
+ import { ComboboxButton as te } from "./combobox-button.js";
5
+ import { ComboboxMenu as re } from "./combobox-menu.js";
6
+ import { translations as oe } from "./translations.js";
7
+ const le = (o, c) => {
8
+ const [n, e] = p(0), i = (l) => {
9
+ if (!c.current) return;
10
+ const b = [...c.current.querySelectorAll("li")];
11
11
  b[l] && (b[l]?.scrollIntoView({
12
12
  behavior: "smooth",
13
13
  block: "nearest"
@@ -15,28 +15,28 @@ const re = (o, s) => {
15
15
  };
16
16
  return {
17
17
  index: n,
18
- set: c,
19
- next: () => c((n + 1) % o.length),
20
- previous: () => c((n - 1 + o.length) % o.length)
18
+ set: i,
19
+ next: () => i((n + 1) % o.length),
20
+ previous: () => i((n - 1 + o.length) % o.length)
21
21
  };
22
- }, oe = (o, s, n, e) => {
23
- const [c, t] = g(!1);
24
- return M(() => {
22
+ }, se = (o, c, n, e) => {
23
+ const [i, t] = p(!1);
24
+ return q(() => {
25
25
  e && t(!1);
26
- }, [e, t]), { isOpen: c, close: () => {
27
- s || n(""), t(!1);
26
+ }, [e, t]), { isOpen: i, close: () => {
27
+ c || n(""), t(!1);
28
28
  }, open: () => {
29
- c || e || (t(!0), o.set(0));
29
+ i || e || (t(!0), o.set(0));
30
30
  } };
31
- }, le = (o, s) => {
32
- const [n, e] = g([]), c = _(() => {
31
+ }, ie = (o, c) => {
32
+ const [n, e] = p([]), i = m(() => {
33
33
  if (!n.length) return o;
34
34
  const t = n[n.length - 1], h = {
35
35
  id: "_back",
36
- label: s.back
36
+ label: c.back
37
37
  }, l = n[n.length - 1].children || [];
38
38
  return t.isSelectableParent ? [h, t, ...l] : [h, ...l];
39
- }, [n, o, s]);
39
+ }, [n, o, c]);
40
40
  return {
41
41
  open: (t) => {
42
42
  e((h) => [...h, t]);
@@ -45,65 +45,65 @@ const re = (o, s) => {
45
45
  n.length && e((t) => [...t.slice(0, n.length - 1)]);
46
46
  },
47
47
  opened: n,
48
- current: c
48
+ current: i
49
49
  };
50
- }, ie = (o) => _(() => {
51
- const s = {};
52
- function n(e, c) {
53
- s[e.id] = [...c], e.children && e.children.forEach((t) => n(t, [...c, e.label]));
50
+ }, ce = (o) => m(() => {
51
+ const c = {};
52
+ function n(e, i) {
53
+ c[e.id] = [...i], e.children && e.children.forEach((t) => n(t, [...i, e.label]));
54
54
  }
55
- return o.forEach((e) => n(e, [])), s;
55
+ return o.forEach((e) => n(e, [])), c;
56
56
  }, [o]);
57
- function pe({
57
+ function be({
58
58
  id: o,
59
- label: s = "",
59
+ label: c = "",
60
60
  isSingleSelect: n = !1,
61
61
  selectedItems: e = [],
62
- locale: c = "en-US",
62
+ locale: i = "en-US",
63
63
  size: t = "md",
64
64
  variant: h = "outline",
65
65
  asPlainText: l = !1,
66
66
  onSearch: b,
67
67
  items: I,
68
- maxVisibleItems: L,
69
- onChange: N,
70
- onBlur: P,
68
+ maxVisibleItems: M,
69
+ onChange: L,
70
+ onBlur: N,
71
71
  isDisabled: S,
72
72
  isReadOnly: x,
73
- isRequired: m,
74
- placeholder: U,
73
+ isRequired: U,
74
+ placeholder: W,
75
75
  isInvalid: B,
76
- footerContent: W,
77
- popoverWidth: z,
78
- popoverPlacement: G,
79
- collapsed: J = !1,
80
- ...K
76
+ footerContent: z,
77
+ popoverWidth: G,
78
+ popoverPlacement: J,
79
+ collapsed: K = !1,
80
+ ...Q
81
81
  }) {
82
- const [v, p] = g(""), k = te[c], w = V(null), O = V(null), f = le(I, k), Q = v.toLowerCase() === e[0]?.label.toLowerCase(), C = v.length > 0 && !(l && Q);
82
+ const [H, g] = p(""), [X, j] = p(!1), k = oe[i], w = _(null), O = _(null), f = ie(I, k), Y = H.toLowerCase() === e[0]?.label.toLowerCase(), v = H.length > 0 && !(l && Y);
83
83
  let u = f.current;
84
- if (C) {
85
- const r = [], d = (i) => {
86
- r.push(i), i.children && i.children.forEach(d);
84
+ if (v) {
85
+ const r = [], d = (s) => {
86
+ r.push(s), s.children && s.children.forEach(d);
87
87
  };
88
- I.forEach(d), u = r.filter((i) => {
89
- const A = i.label.toLowerCase().includes(v.toLowerCase());
90
- return (!(i.children && i.children.length > 0) || i.isSelectableParent) && A;
88
+ I.forEach(d), u = r.filter((s) => {
89
+ const F = s.label.toLowerCase().includes(H.toLowerCase());
90
+ return (!(s.children && s.children.length > 0) || s.isSelectableParent) && F;
91
91
  });
92
92
  }
93
- const E = re(u, O), a = oe(E, l, p, S);
94
- M(() => {
95
- l && !a.isOpen && p(e[0]?.label || "");
93
+ const E = le(u, O), a = se(E, l, g, S);
94
+ q(() => {
95
+ l && !a.isOpen && g(e[0]?.label || "");
96
96
  }, [a.isOpen, e, l]);
97
- const [q, X] = g([]);
98
- M(() => {
99
- !a.isOpen || n || X(e);
100
- }, [a.isOpen]), C || (u = [
101
- ...q,
102
- ...u.filter((r) => !q.find((d) => d.label === r.label))
97
+ const [P, Z] = p([]);
98
+ q(() => {
99
+ !a.isOpen || n || Z(e);
100
+ }, [a.isOpen]), v || (u = [
101
+ ...P,
102
+ ...u.filter((r) => !P.find((d) => d.label === r.label))
103
103
  ]);
104
- let j = !1;
105
- x ? u = e : (j = u.length > (L ?? 1 / 0), u = u.slice(0, L));
106
- const Y = ie(I), Z = (r) => {
104
+ let y = !1;
105
+ x ? u = e : (y = u.length > (M ?? 1 / 0), u = u.slice(0, M));
106
+ const $ = ce(I), R = (r) => {
107
107
  if (x || S)
108
108
  return;
109
109
  if (r.id === "_back") {
@@ -112,50 +112,52 @@ function pe({
112
112
  }
113
113
  O.current?.parentNode?.querySelector("input")?.focus();
114
114
  const d = f.opened.length > 0 && f.opened[f.opened.length - 1].id === r.id;
115
- if (!C && !d && r.children && r.children.length > 0) {
115
+ if (!v && !d && r.children && r.children.length > 0) {
116
116
  f.open(r), requestAnimationFrame(() => E.set(1));
117
117
  return;
118
118
  }
119
- let i = [r];
120
- n || (e.some((H) => H.id === r.id) ? i = e.filter((H) => H.id !== r.id) : i = [...e, r]), p(l ? i[0]?.label : ""), n && (i.length === 0 ? a.open() : a.close()), N && N(i);
121
- }, $ = e.length === 0 ? U ?? k.search : void 0, R = (r) => {
122
- w.current?.contains(r.relatedTarget) || (a.close(), P && P(e));
123
- }, y = {
119
+ let s = [r];
120
+ n || (e.some((C) => C.id === r.id) ? s = e.filter((C) => C.id !== r.id) : s = [...e, r]), g(l ? s[0]?.label : ""), n && (s.length === 0 ? a.open() : a.close()), L && L(s);
121
+ }, T = e.length === 0 ? W ?? k.search : void 0, D = (r) => {
122
+ w.current?.contains(r.relatedTarget) || (a.close(), j(!1), N && N(e));
123
+ }, A = {
124
124
  id: o,
125
125
  asPlainText: l,
126
- inputValue: v,
126
+ inputValue: H,
127
127
  selectedItems: e,
128
128
  displayItems: u,
129
- toggleItem: Z,
129
+ toggleItem: R,
130
130
  highlightState: E,
131
131
  openState: a,
132
- parentStrings: Y,
132
+ parentStrings: $,
133
133
  // Button
134
134
  size: t,
135
135
  variant: h,
136
- label: s,
137
- placeHolderText: $,
136
+ label: c,
137
+ placeHolderText: T,
138
138
  isDisabled: S,
139
139
  isReadOnly: x,
140
140
  isInvalid: B,
141
- collapsed: J,
142
- setInputValue: p,
141
+ collapsed: K,
142
+ hasPendingDelete: X,
143
+ setHasPendingDelete: j,
144
+ setInputValue: g,
143
145
  onSearch: b,
144
146
  // Menu
145
147
  isSingleSelect: n,
146
- isSearching: C,
147
- isHidingItems: j,
148
- popoverWidth: z,
149
- popoverPlacement: G,
150
- previousSelectedItems: q,
148
+ isSearching: v,
149
+ isHidingItems: y,
150
+ popoverWidth: G,
151
+ popoverPlacement: J,
152
+ previousSelectedItems: P,
151
153
  parentRef: w,
152
154
  popupRef: O,
153
- footerContent: W,
155
+ footerContent: z,
154
156
  subMenuState: f,
155
157
  translation: k
156
158
  };
157
- return /* @__PURE__ */ T(
158
- D,
159
+ return /* @__PURE__ */ ee(
160
+ ne,
159
161
  {
160
162
  role: "combobox",
161
163
  as: "label",
@@ -163,22 +165,22 @@ function pe({
163
165
  className: "combobox",
164
166
  ref: w,
165
167
  onClick: a.open,
166
- onBlur: R,
168
+ onBlur: D,
167
169
  overflow: "visible",
168
170
  width: "100%",
169
171
  "aria-expanded": a.isOpen,
170
172
  "aria-invalid": B,
171
- "aria-required": m,
173
+ "aria-required": U,
172
174
  "aria-disabled": S,
173
175
  "aria-readonly": x,
174
- ...K,
176
+ ...Q,
175
177
  children: [
176
- /* @__PURE__ */ F(ee, { ...y }),
177
- a.isOpen && /* @__PURE__ */ F(ne, { ...y })
178
+ /* @__PURE__ */ V(te, { ...A }),
179
+ a.isOpen && /* @__PURE__ */ V(re, { ...A })
178
180
  ]
179
181
  }
180
182
  );
181
183
  }
182
184
  export {
183
- pe as Combobox
185
+ be as Combobox
184
186
  };