@alixpartners/ui-components 2.0.2 → 2.1.2

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 (40) hide show
  1. package/README.md +99 -99
  2. package/dist/assets/Creatable.css +1 -1
  3. package/dist/assets/Dialog.css +1 -1
  4. package/dist/assets/Dropdown.css +1 -1
  5. package/dist/assets/FilePicker.css +1 -0
  6. package/dist/assets/Input.css +1 -1
  7. package/dist/assets/NavBar.css +1 -1
  8. package/dist/assets/TagsFields.css +1 -1
  9. package/dist/assets/Textarea.css +1 -1
  10. package/dist/components/Banner/Banner.test.js +1 -1
  11. package/dist/components/Button/Button.d.ts +2 -1
  12. package/dist/components/Button/Button.js +16 -15
  13. package/dist/components/Button/Button.test.js +3218 -120
  14. package/dist/components/Checkbox/Checkbox.test.js +1 -1
  15. package/dist/components/Creatable/Creatable.d.ts +2 -1
  16. package/dist/components/Creatable/Creatable.js +136 -138
  17. package/dist/components/Dialog/Dialog.d.ts +1 -0
  18. package/dist/components/Dialog/Dialog.js +20 -19
  19. package/dist/components/Dropdown/Dropdown.js +101 -100
  20. package/dist/components/FilePicker/FilePicker.d.ts +46 -0
  21. package/dist/components/FilePicker/FilePicker.js +153 -0
  22. package/dist/components/FilePicker/FilePicker.test.d.ts +1 -0
  23. package/dist/components/FilePicker/FilePicker.test.js +8 -0
  24. package/dist/components/Ghost/Ghost.test.js +1 -1
  25. package/dist/components/Input/Input.test.js +1 -1
  26. package/dist/components/RadioGroup/RadioGroup.test.js +1 -1
  27. package/dist/components/Search/Search.test.js +1 -1
  28. package/dist/components/SplitButton/SplitButton.js +4 -3
  29. package/dist/components/SplitButton/SplitButton.test.js +1 -1
  30. package/dist/components/Tag/Tag.test.js +1 -1
  31. package/dist/components/TagsFields/TagsFields.js +3 -2
  32. package/dist/components/Textarea/Textarea.js +70 -68
  33. package/dist/components/Textarea/Textarea.test.js +1 -1
  34. package/dist/components/Toast/Toast.test.js +1 -1
  35. package/dist/components/Toggle/Toggle.test.js +1 -1
  36. package/dist/main.d.ts +2 -0
  37. package/dist/main.js +36 -34
  38. package/dist/{vi.ClIskdbk-DlR4jLzR.js → vi.ClIskdbk-CFW_9sOK.js} +1 -0
  39. package/dist/web.config +8 -8
  40. package/package.json +84 -84
@@ -1,60 +1,61 @@
1
- import { jsxs as l, jsx as d } from "react/jsx-runtime";
2
- import { c as h } from "../../clsx-OuTLNxxd.js";
3
- import { useState as b, useRef as T, useEffect as v, useCallback as oe } from "react";
1
+ import { jsxs as s, jsx as d } from "react/jsx-runtime";
2
+ import { c as D } from "../../clsx-OuTLNxxd.js";
3
+ import { useContext as Me, useState as b, useRef as T, useEffect as v, useCallback as oe } from "react";
4
4
  import B from "../Icon/Icon.js";
5
- import Ce from "../Toggle/Toggle.js";
5
+ import Se from "../Toggle/Toggle.js";
6
6
  import ne from "../Button/Button.js";
7
7
  import re from "../Ghost/Ghost.js";
8
- import Me from "../Search/Search.js";
9
- import Se from "../Tooltip/Tooltip.js";
10
- import { R as Ve, T as Re, P as Ee, C as Fe } from "../../index-BKtdMA_j.js";
11
- import '../../assets/Dropdown.css';const We = "Dropdown-module__dropdownContainer___beNhQ", qe = "Dropdown-module__dropdownLabel___T9FmB", Je = "Dropdown-module__dropdownLabelDisabled___SLRmM", ze = "Dropdown-module__required___ChI1m", Ge = "Dropdown-module__dropdownWrapper___AUuWD", Be = "Dropdown-module__dropdownTrigger___Rue93", Ue = "Dropdown-module__dropdownTriggerDisabled___63wkd", je = "Dropdown-module__dropdownTriggerOpen___cbm8V", Pe = "Dropdown-module__dropdownTriggerError___Uu02x", Ye = "Dropdown-module__dropdownContent___zLMhL", $e = "Dropdown-module__dropdownSelectedItems___iXnpQ", Ze = "Dropdown-module__selectedOptionLabel___7Zdh3", Qe = "Dropdown-module__placeholder___fWdch", Ke = "Dropdown-module__dropdownActions___d55Fa", Xe = "Dropdown-module__dropdownArrow___dLbrb", He = "Dropdown-module__dropdownArrowOpen___Z4Nh1", eo = "Dropdown-module__dropdownMenu___toYcy", oo = "Dropdown-module__dropdownMenuToolbar___gFne0", no = "Dropdown-module__searchContainer___4kUvD", ro = "Dropdown-module__search___JmgDx", to = "Dropdown-module__optionsList___rk2hi", lo = "Dropdown-module__categoryGroup___Np2bP", so = "Dropdown-module__categoryDivider___Gh6F0", io = "Dropdown-module__categoryLabel___B9IDR", co = "Dropdown-module__optionItem___7pi10", ao = "Dropdown-module__optionItemDisabled___aepUD", po = "Dropdown-module__optionItemFocused___u2781", _o = "Dropdown-module__optionContent___nf1VC", uo = "Dropdown-module__optionLabel___sJerM", mo = "Dropdown-module__tickIcon___hYdCr", wo = "Dropdown-module__noOptions___8vmhM", fo = "Dropdown-module__helpers___s4ulA", ho = "Dropdown-module__helpText___YooJE", Do = "Dropdown-module__helpTextDisabled___Ct4qq", bo = "Dropdown-module__helpLink___-Zwpq", go = "Dropdown-module__helpLinkDisabled___r-opC", No = "Dropdown-module__errorMessage___3Mopi", vo = "Dropdown-module__selectAllContainer___Dlk3J", Lo = "Dropdown-module__actionButtons___-2nvr", o = {
12
- dropdownContainer: We,
13
- dropdownLabel: qe,
8
+ import Ve from "../Search/Search.js";
9
+ import Re from "../Tooltip/Tooltip.js";
10
+ import { DialogContext as Ee } from "../Dialog/Dialog.js";
11
+ import { R as Fe, T as We, P as qe, C as Je } from "../../index-BKtdMA_j.js";
12
+ import '../../assets/Dropdown.css';const ze = "Dropdown-module__dropdownContainer___beNhQ", Ge = "Dropdown-module__dropdownLabel___T9FmB", Be = "Dropdown-module__dropdownLabelDisabled___SLRmM", Ue = "Dropdown-module__required___ChI1m", je = "Dropdown-module__dropdownWrapper___AUuWD", Pe = "Dropdown-module__dropdownTrigger___Rue93", Ye = "Dropdown-module__dropdownTriggerDisabled___63wkd", $e = "Dropdown-module__dropdownTriggerOpen___cbm8V", Ze = "Dropdown-module__placeholder___fWdch", Qe = "Dropdown-module__selectedOptionLabel___7Zdh3", Ke = "Dropdown-module__dropdownSelectedItems___iXnpQ", Xe = "Dropdown-module__dropdownTriggerError___Uu02x", He = "Dropdown-module__dropdownContent___zLMhL", eo = "Dropdown-module__dropdownActions___d55Fa", oo = "Dropdown-module__dropdownArrow___dLbrb", no = "Dropdown-module__dropdownArrowOpen___Z4Nh1", ro = "Dropdown-module__dropdownMenu___toYcy", to = "Dropdown-module__dropdownMenuToolbar___gFne0", lo = "Dropdown-module__searchContainer___4kUvD", so = "Dropdown-module__search___JmgDx", io = "Dropdown-module__optionsList___rk2hi", co = "Dropdown-module__categoryGroup___Np2bP", ao = "Dropdown-module__categoryDivider___Gh6F0", po = "Dropdown-module__categoryLabel___B9IDR", _o = "Dropdown-module__optionItem___7pi10", uo = "Dropdown-module__optionItemDisabled___aepUD", mo = "Dropdown-module__optionItemFocused___u2781", wo = "Dropdown-module__optionContent___nf1VC", fo = "Dropdown-module__optionLabel___sJerM", Do = "Dropdown-module__tickIcon___hYdCr", ho = "Dropdown-module__noOptions___8vmhM", bo = "Dropdown-module__helpers___s4ulA", go = "Dropdown-module__helpText___YooJE", No = "Dropdown-module__helpTextDisabled___Ct4qq", vo = "Dropdown-module__helpLink___-Zwpq", Lo = "Dropdown-module__helpLinkDisabled___r-opC", Oo = "Dropdown-module__errorMessage___3Mopi", Io = "Dropdown-module__selectAllContainer___Dlk3J", yo = "Dropdown-module__actionButtons___-2nvr", o = {
13
+ dropdownContainer: ze,
14
+ dropdownLabel: Ge,
14
15
  "label-text": "Dropdown-module__label-text___VEqG-",
15
- dropdownLabelDisabled: Je,
16
+ dropdownLabelDisabled: Be,
16
17
  "label-tooltip-icon": "Dropdown-module__label-tooltip-icon___JYVOm",
17
- required: ze,
18
- dropdownWrapper: Ge,
18
+ required: Ue,
19
+ dropdownWrapper: je,
19
20
  "dropdown-menu-trigger": "Dropdown-module__dropdown-menu-trigger___fgqVT",
20
- dropdownTrigger: Be,
21
- dropdownTriggerDisabled: Ue,
22
- dropdownTriggerOpen: je,
23
- dropdownTriggerError: Pe,
24
- dropdownContent: Ye,
25
- dropdownSelectedItems: $e,
26
- selectedOptionLabel: Ze,
27
- placeholder: Qe,
28
- dropdownActions: Ke,
29
- dropdownArrow: Xe,
30
- dropdownArrowOpen: He,
31
- dropdownMenu: eo,
21
+ dropdownTrigger: Pe,
22
+ dropdownTriggerDisabled: Ye,
23
+ dropdownTriggerOpen: $e,
24
+ placeholder: Ze,
25
+ selectedOptionLabel: Qe,
26
+ dropdownSelectedItems: Ke,
27
+ dropdownTriggerError: Xe,
28
+ dropdownContent: He,
29
+ dropdownActions: eo,
30
+ dropdownArrow: oo,
31
+ dropdownArrowOpen: no,
32
+ dropdownMenu: ro,
32
33
  "dropdown-container-grouped": "Dropdown-module__dropdown-container-grouped___1twhU",
33
34
  "dropdown-container-multi-select": "Dropdown-module__dropdown-container-multi-select___zdaum",
34
- dropdownMenuToolbar: oo,
35
- searchContainer: no,
36
- search: ro,
37
- optionsList: to,
38
- categoryGroup: lo,
39
- categoryDivider: so,
40
- categoryLabel: io,
41
- optionItem: co,
42
- optionItemDisabled: ao,
43
- optionItemFocused: po,
44
- optionContent: _o,
45
- optionLabel: uo,
46
- tickIcon: mo,
47
- noOptions: wo,
48
- helpers: fo,
49
- helpText: ho,
50
- helpTextDisabled: Do,
51
- helpLink: bo,
52
- helpLinkDisabled: go,
53
- errorMessage: No,
54
- selectAllContainer: vo,
55
- actionButtons: Lo
35
+ dropdownMenuToolbar: to,
36
+ searchContainer: lo,
37
+ search: so,
38
+ optionsList: io,
39
+ categoryGroup: co,
40
+ categoryDivider: ao,
41
+ categoryLabel: po,
42
+ optionItem: _o,
43
+ optionItemDisabled: uo,
44
+ optionItemFocused: mo,
45
+ optionContent: wo,
46
+ optionLabel: fo,
47
+ tickIcon: Do,
48
+ noOptions: ho,
49
+ helpers: bo,
50
+ helpText: go,
51
+ helpTextDisabled: No,
52
+ helpLink: vo,
53
+ helpLinkDisabled: Lo,
54
+ errorMessage: Oo,
55
+ selectAllContainer: Io,
56
+ actionButtons: yo
56
57
  };
57
- function Vo({
58
+ function Wo({
58
59
  className: de,
59
60
  label: E,
60
61
  options: F,
@@ -78,7 +79,7 @@ function Vo({
78
79
  dropdownTriggerClassName: ce,
79
80
  dropdownMenuClassName: ae,
80
81
  hideSelectedItems: pe = !1,
81
- labelTooltip: D,
82
+ labelTooltip: h,
82
83
  unselect: S = !1,
83
84
  selectedOptionLabel: _e = "option selected",
84
85
  selectedOptionsLabel: ue = "options selected",
@@ -86,34 +87,34 @@ function Vo({
86
87
  caseSensitive: P = !1,
87
88
  ...me
88
89
  }) {
89
- const [s, g] = b(p), [i, f] = b(!1), [Y, _] = b(""), [I, c] = b(-1), [w, u] = b([]), $ = T(null), Z = T(null), we = T(null), z = T(null), [Q, fe] = b(0), [he, De] = b(p.length > 0 ? p.join(", ") : A ?? ""), K = T(p);
90
+ const we = Me(Ee), [i, g] = b(p), [l, f] = b(!1), [Y, _] = b(""), [I, c] = b(-1), [w, u] = b([]), $ = T(null), Z = T(null), fe = T(null), z = T(null), [Q, De] = b(0), [he, be] = b(p.length > 0 ? p.join(", ") : A ?? ""), K = T(p);
90
91
  v(() => {
91
92
  JSON.stringify(K.current) !== JSON.stringify(p) && (g(p), K.current = p);
92
93
  }, [p]), v(() => {
93
94
  var r;
94
95
  const e = (r = Z.current) == null ? void 0 : r.getBoundingClientRect().width;
95
- e && fe(e);
96
- }, []), v(() => {
97
- i && u([...s]);
98
- }, [i, s]);
96
+ e && De(e);
97
+ }, [l]), v(() => {
98
+ l && u([...i]);
99
+ }, [l, i]);
99
100
  const X = Y.trim(), a = F.filter((e) => {
100
101
  const r = P ? e.label : e.label.toLowerCase(), n = P ? X : X.toLowerCase();
101
102
  return r.includes(n);
102
103
  });
103
104
  v(() => {
104
- De(p.length > 0 ? p.join(", ") : A ?? "");
105
+ be(p.length > 0 ? p.join(", ") : A ?? "");
105
106
  }, [p, A]), v(() => {
106
- i && x && z.current && z.current.focus();
107
- }, [i, x]);
108
- const be = (e) => {
109
- f(e), e ? (u([...s]), _(""), c(-1)) : (_(""), c(-1), u([]));
107
+ l && x && z.current && z.current.focus();
108
+ }, [l, x]);
109
+ const ge = (e) => {
110
+ f(e), e ? (u([...i]), _(""), c(-1)) : (_(""), c(-1), u([]));
110
111
  }, G = oe((e) => {
111
112
  if (e.disabled) return;
112
113
  let r = [];
113
114
  if (m)
114
115
  r = w.includes(e.value) ? w.filter((n) => n !== e.value) : [...w, e.value];
115
116
  else {
116
- if (s.includes(e.value))
117
+ if (i.includes(e.value))
117
118
  if (S)
118
119
  r = [];
119
120
  else
@@ -124,19 +125,19 @@ function Vo({
124
125
  return;
125
126
  }
126
127
  u(r);
127
- }, [m, t, w, s, S]), ge = () => {
128
+ }, [m, t, w, i, S]), Ne = () => {
128
129
  g(w), t == null || t(w), f(!1), _(""), c(-1), u([]);
129
- }, Ne = () => {
130
+ }, ve = () => {
130
131
  f(!1), _(""), c(-1), u([]);
131
- }, ve = (e) => {
132
+ }, Le = (e) => {
132
133
  _(e), c(-1), J == null || J(e);
133
- }, Le = oe((e) => {
134
+ }, Oe = oe((e) => {
134
135
  var r;
135
136
  if (!e.disabled) {
136
137
  if (m) {
137
- const R = s.includes(e.value) ? s.filter((k) => k !== e.value) : [...s, e.value];
138
+ const R = i.includes(e.value) ? i.filter((k) => k !== e.value) : [...i, e.value];
138
139
  g(R), t == null || t(R), f(!0), _(""), c(-1);
139
- } else if (s.includes(e.value)) {
140
+ } else if (i.includes(e.value)) {
140
141
  if (S) {
141
142
  const n = [];
142
143
  g(n), t == null || t(n), f(!1), _(""), c(-1);
@@ -145,14 +146,14 @@ function Vo({
145
146
  const n = [e.value];
146
147
  g(n), t == null || t(n), f(!1), _(""), c(-1);
147
148
  }
148
- (r = we.current) == null || r.focus();
149
+ (r = fe.current) == null || r.focus();
149
150
  }
150
- }, [m, t, s, S]), Oe = (e) => {
151
+ }, [m, t, i, S]), Ie = (e) => {
151
152
  M == null || M(e);
152
153
  };
153
154
  v(() => {
154
155
  const e = (r) => {
155
- if (i)
156
+ if (l)
156
157
  switch (r.key) {
157
158
  case "ArrowDown":
158
159
  r.preventDefault(), c((n) => n < a.length - 1 ? n + 1 : 0);
@@ -172,45 +173,45 @@ function Vo({
172
173
  }
173
174
  };
174
175
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
175
- }, [i, I, a, Le, G]);
176
- const V = i ? w : s, y = F.filter((e) => V.includes(e.value)), Ie = !!O, ye = JSON.stringify(w) !== JSON.stringify(s), H = F.filter((e) => !e.disabled), ke = H.length > 0 && H.every((e) => V.includes(e.value)), Te = a.reduce((e, r) => {
176
+ }, [l, I, a, Oe, G]);
177
+ const V = l ? w : i, y = F.filter((e) => V.includes(e.value)), ye = !!O, ke = JSON.stringify(w) !== JSON.stringify(i), H = F.filter((e) => !e.disabled), Te = H.length > 0 && H.every((e) => V.includes(e.value)), Ae = a.reduce((e, r) => {
177
178
  const n = r.category || "default";
178
179
  return e[n] || (e[n] = []), e[n].push(r), e;
179
- }, {}), Ae = a, {
180
+ }, {}), xe = a, {
180
181
  onBlur: N,
181
182
  ...ee
182
183
  } = me;
183
- return /* @__PURE__ */ l("div", { ref: $, className: h(o.root, o.dropdownContainer, se && o["dropdown-container-grouped"], m && o["dropdown-container-multi-select"], de), ...ee, children: [
184
- E && /* @__PURE__ */ l("label", { className: h(o.dropdownLabel, L && o.dropdownLabelDisabled), children: [
184
+ return /* @__PURE__ */ s("div", { ref: $, className: D(o.root, o.dropdownContainer, se && o["dropdown-container-grouped"], m && o["dropdown-container-multi-select"], de), ...ee, children: [
185
+ E && /* @__PURE__ */ s("label", { className: D(o.dropdownLabel, L && o.dropdownLabelDisabled), children: [
185
186
  /* @__PURE__ */ d("span", { title: E, className: o["label-text"], children: E }),
186
187
  te && /* @__PURE__ */ d("span", { className: o.required, children: "*" }),
187
- D && /* @__PURE__ */ d(Se, { content: D.content, size: D.size, theme: D.theme, tipSide: D.tipSide, tipAlignment: D.tipAlignment, startVisible: D.startVisible, children: /* @__PURE__ */ d(B, { icon: "ap-icon-info", className: o["label-tooltip-icon"] }) })
188
+ h && /* @__PURE__ */ d(Re, { content: h.content, size: h.size, theme: h.theme, tipSide: h.tipSide, tipAlignment: h.tipAlignment, startVisible: h.startVisible, children: /* @__PURE__ */ d(B, { icon: "ap-icon-info", className: o["label-tooltip-icon"] }) })
188
189
  ] }),
189
- /* @__PURE__ */ d(Ve, { open: i, onOpenChange: be, children: /* @__PURE__ */ l("div", { className: o.dropdownWrapper, children: [
190
- /* @__PURE__ */ d(Re, { disabled: L, className: h(o["dropdown-menu-trigger"], o.dropdownTrigger, ce, i && o.dropdownTriggerOpen, L && o.dropdownTriggerDisabled, Ie && o.dropdownTriggerError), ref: Z, onBlur: (e) => {
191
- i || N == null || N(e);
192
- }, ...ee, children: /* @__PURE__ */ l("div", { className: o.dropdownContent, children: [
193
- !pe && /* @__PURE__ */ d("div", { className: o.dropdownSelectedItems, children: y.length > 0 ? m ? ke && j ? j : y.length === 1 ? ` ${y.length} ${_e}` : ` ${y.length} ${ue}` : (
190
+ /* @__PURE__ */ d(Fe, { open: l, onOpenChange: ge, children: /* @__PURE__ */ s("div", { className: o.dropdownWrapper, children: [
191
+ /* @__PURE__ */ d(We, { disabled: L, className: D(o["dropdown-menu-trigger"], o.dropdownTrigger, ce, l && o.dropdownTriggerOpen, L && o.dropdownTriggerDisabled, ye && o.dropdownTriggerError), ref: Z, onBlur: (e) => {
192
+ l || N == null || N(e);
193
+ }, ...ee, children: /* @__PURE__ */ s("div", { className: o.dropdownContent, children: [
194
+ !pe && /* @__PURE__ */ d("div", { className: o.dropdownSelectedItems, children: y.length > 0 ? m ? Te && j ? j : y.length === 1 ? ` ${y.length} ${_e}` : ` ${y.length} ${ue}` : (
194
195
  // For single select, show the selected option label
195
196
  /* @__PURE__ */ d("span", { className: o.selectedOptionLabel, children: y[0].label })
196
197
  ) : /* @__PURE__ */ d("span", { title: he, className: o.placeholder, children: A }) }),
197
- /* @__PURE__ */ d("div", { className: o.dropdownActions, children: /* @__PURE__ */ d(B, { icon: "ap-icon-expand-more", className: h(o.dropdownArrow, i && o.dropdownArrowOpen) }) })
198
+ /* @__PURE__ */ d("div", { className: o.dropdownActions, children: /* @__PURE__ */ d(B, { icon: "ap-icon-expand-more", className: D(o.dropdownArrow, l && o.dropdownArrowOpen) }) })
198
199
  ] }) }),
199
- /* @__PURE__ */ d(Ee, { children: /* @__PURE__ */ d(Fe, { align: U === "right" ? "end" : "start", side: "bottom", avoidCollisions: !0, sideOffset: 6, collisionPadding: 8, style: {
200
+ /* @__PURE__ */ d(qe, { container: we, children: /* @__PURE__ */ d(Je, { align: U === "right" ? "end" : "start", side: "bottom", avoidCollisions: !0, sideOffset: 6, collisionPadding: 8, style: {
200
201
  minWidth: Q,
201
202
  zIndex: 9999
202
203
  }, onInteractOutside: (e) => {
203
204
  var n;
204
205
  e.target === z.current && e.preventDefault(), ((n = $.current) == null ? void 0 : n.contains(e.target)) || N == null || N(e);
205
- }, children: i && /* @__PURE__ */ l("div", { style: {
206
+ }, children: l && /* @__PURE__ */ s("div", { style: {
206
207
  minWidth: Q
207
- }, className: h(o.dropdownMenu, ae, U === "right" && o.dropdownMenuRight), children: [
208
- (x || m) && /* @__PURE__ */ l("div", { className: o.dropdownMenuToolbar, children: [
209
- x && /* @__PURE__ */ l("div", { className: o.searchContainer, children: [
210
- /* @__PURE__ */ d(Me, { placeholder: le, value: Y, onChange: ve, className: o.search }),
211
- M && /* @__PURE__ */ d(Ce, { label: ie, onChange: Oe })
208
+ }, className: D(o.dropdownMenu, ae, U === "right" && o.dropdownMenuRight), children: [
209
+ (x || m) && /* @__PURE__ */ s("div", { className: o.dropdownMenuToolbar, children: [
210
+ x && /* @__PURE__ */ s("div", { className: o.searchContainer, children: [
211
+ /* @__PURE__ */ d(Ve, { placeholder: le, value: Y, onChange: Le, className: o.search }),
212
+ M && /* @__PURE__ */ d(Se, { label: ie, onChange: Ie })
212
213
  ] }),
213
- m && /* @__PURE__ */ l("div", { className: o.selectAllContainer, children: [
214
+ m && /* @__PURE__ */ s("div", { className: o.selectAllContainer, children: [
214
215
  /* @__PURE__ */ d(re, { variant: "default", noIcon: !0, onClick: () => {
215
216
  const e = a.filter((r) => !r.disabled).map((r) => r.value);
216
217
  u(e);
@@ -218,12 +219,12 @@ function Vo({
218
219
  /* @__PURE__ */ d(re, { variant: "default", noIcon: !0, onClick: () => u([]), disabled: w.length === 0, children: "Deselect all" })
219
220
  ] })
220
221
  ] }),
221
- /* @__PURE__ */ l("div", { className: o.optionsList, "data-dropdown-options-list": !0, children: [
222
- a.length > 0 ? Object.entries(Te).map(([e, r]) => /* @__PURE__ */ l("div", { className: o.categoryGroup, children: [
222
+ /* @__PURE__ */ s("div", { className: o.optionsList, "data-dropdown-options-list": !0, children: [
223
+ a.length > 0 ? Object.entries(Ae).map(([e, r]) => /* @__PURE__ */ s("div", { className: o.categoryGroup, children: [
223
224
  e !== "default" && /* @__PURE__ */ d("div", { className: o.categoryDivider, children: /* @__PURE__ */ d("span", { className: o.categoryLabel, children: e }) }),
224
225
  r.map((n) => {
225
- const R = Ae.indexOf(n), k = a.find((xe) => xe.value === n.value);
226
- return /* @__PURE__ */ d("button", { title: (k == null ? void 0 : k.label) || n.label, type: "button", className: h(o.optionItem, V.includes(n.value) && o.optionItemSelected, n.disabled && o.optionItemDisabled, R === I && o.optionItemFocused), onClick: () => G(n), disabled: n.disabled, "data-dropdown-option-item": !0, children: /* @__PURE__ */ l("div", { className: o.optionContent, children: [
226
+ const R = xe.indexOf(n), k = a.find((Ce) => Ce.value === n.value);
227
+ return /* @__PURE__ */ d("button", { title: (k == null ? void 0 : k.label) || n.label, type: "button", className: D(o.optionItem, V.includes(n.value) && o.optionItemSelected, n.disabled && o.optionItemDisabled, R === I && o.optionItemFocused), onClick: () => G(n), disabled: n.disabled, "data-dropdown-option-item": !0, children: /* @__PURE__ */ s("div", { className: o.optionContent, children: [
227
228
  /* @__PURE__ */ d("span", { className: o.optionLabel, children: n.label }),
228
229
  V.includes(n.value) && /* @__PURE__ */ d(B, { icon: "ap-icon-check", className: o.tickIcon })
229
230
  ] }) }, n.value);
@@ -232,18 +233,18 @@ function Vo({
232
233
  a.length === 0 && /* @__PURE__ */ d("div", { className: o.noOptions, children: "No options found" })
233
234
  ] }),
234
235
  " ",
235
- m && /* @__PURE__ */ l("div", { className: o.actionButtons, children: [
236
- /* @__PURE__ */ d(ne, { type: "primary", variant: "cancel", size: "md", onClick: Ne, children: "Cancel" }),
237
- /* @__PURE__ */ d(ne, { type: "primary", variant: "default", size: "md", onClick: ge, disabled: !ye, children: "Apply" })
236
+ m && /* @__PURE__ */ s("div", { className: o.actionButtons, children: [
237
+ /* @__PURE__ */ d(ne, { type: "primary", variant: "cancel", size: "md", onClick: ve, children: "Cancel" }),
238
+ /* @__PURE__ */ d(ne, { type: "primary", variant: "default", size: "md", onClick: Ne, disabled: !ke, children: "Apply" })
238
239
  ] })
239
240
  ] }) }) })
240
241
  ] }) }),
241
- (O || C || W && q) && /* @__PURE__ */ l("div", { className: o.helpers, children: [
242
- O ? /* @__PURE__ */ d("span", { title: O, className: o.errorMessage, children: O }) : C && /* @__PURE__ */ d("span", { title: C, className: h(o.helpText, L && o.helpTextDisabled), children: C }),
243
- W && q && /* @__PURE__ */ d("a", { href: W, className: h(o.helpLink, L && o.helpLinkDisabled), target: "_blank", rel: "noopener noreferrer", children: q })
242
+ (O || C || W && q) && /* @__PURE__ */ s("div", { className: o.helpers, children: [
243
+ O ? /* @__PURE__ */ d("span", { title: O, className: o.errorMessage, children: O }) : C && /* @__PURE__ */ d("span", { title: C, className: D(o.helpText, L && o.helpTextDisabled), children: C }),
244
+ W && q && /* @__PURE__ */ d("a", { href: W, className: D(o.helpLink, L && o.helpLinkDisabled), target: "_blank", rel: "noopener noreferrer", children: q })
244
245
  ] })
245
246
  ] });
246
247
  }
247
248
  export {
248
- Vo as default
249
+ Wo as default
249
250
  };
@@ -0,0 +1,46 @@
1
+ import { InteractiveEventHandlers } from '../../types/native-events';
2
+ import { InputLabelTooltipProps } from '../Input/Input';
3
+ export type UploadFile = {
4
+ file: File;
5
+ error?: string;
6
+ };
7
+ type FilePickerProps = {
8
+ type?: 'single' | 'multiple';
9
+ maxFiles?: number;
10
+ fileExtensionsAllowed: string[];
11
+ maxSize: number;
12
+ queueFiles?: boolean;
13
+ disabled?: boolean;
14
+ value?: File[];
15
+ label: string;
16
+ required?: boolean;
17
+ placeholder?: string;
18
+ errorMessage?: string;
19
+ helpText?: string;
20
+ helpLink?: string;
21
+ helpLinkText?: string;
22
+ labelTooltip?: InputLabelTooltipProps;
23
+ } & InteractiveEventHandlers;
24
+ /**
25
+ * FilePicker component for uploading files.
26
+ *
27
+ * @param {object} props - FilePicker component props
28
+ * @param {'single' | 'multiple'} props.type - The type of file picker to display
29
+ * @param {number} props.maxFiles - The maximum number of files to upload
30
+ * @param {string[]} props.fileExtensionsAllowed - The allowed file extensions
31
+ * @param {number} props.maxSize - The maximum file size in MB
32
+ * @param {boolean} props.queueFiles - Whether to queue files
33
+ * @param {boolean} props.disabled - Whether the component is disabled
34
+ * @param {File[]} props.value - The value of the component
35
+ * @param {string} props.label - The label of the component
36
+ * @param {boolean} props.required - Whether the component is required
37
+ * @param {string} props.placeholder - The placeholder of the component
38
+ * @param {string} props.errorMessage - The error message of the component
39
+ * @param {string} props.helpText - The help text of the component
40
+ * @param {string} props.helpLink - The help link of the component
41
+ * @param {string} props.helpLinkText - The help link text of the component
42
+ * @param {InputLabelTooltipProps} props.labelTooltip - The label tooltip of the component
43
+ * @returns {JSX.Element} The rendered FilePicker component
44
+ */
45
+ export default function FilePicker({ type, maxFiles, fileExtensionsAllowed, maxSize, queueFiles, disabled, value, label, required, placeholder, errorMessage, helpText, helpLink, helpLinkText, labelTooltip, }: FilePickerProps): import("react/jsx-runtime").JSX.Element;
46
+ export {};
@@ -0,0 +1,153 @@
1
+ import { jsxs as n, jsx as t } from "react/jsx-runtime";
2
+ import { useId as J, useRef as Y, useState as M, useEffect as G } from "react";
3
+ import Q from "../Tooltip/Tooltip.js";
4
+ import g from "../Icon/Icon.js";
5
+ import I from "../Button/Button.js";
6
+ import { c as W } from "../../clsx-OuTLNxxd.js";
7
+ import '../../assets/FilePicker.css';const Z = "FilePicker-module__container___knCCi", ee = "FilePicker-module__label___al7Xe", ie = "FilePicker-module__required___41Vjd", le = "FilePicker-module__labelTooltipIcon___Cc1QF", te = "FilePicker-module__helpers___79-g5", ne = "FilePicker-module__helperText___ja9Rr", se = "FilePicker-module__errorMessage___TvHrL", oe = "FilePicker-module__singleFileHelpLinkContainer___mpjUf", ce = "FilePicker-module__singleFileHelpLinkReservedSpace___r8j2b", re = "FilePicker-module__helpLink___uu45D", me = "FilePicker-module__input___cL1Hs", ae = "FilePicker-module__singleFileContainer___OFSDt", ue = "FilePicker-module__singleFileInputContainer___MOkES", pe = "FilePicker-module__inputFileName___sMs7R", _e = "FilePicker-module__inputFileNamePlaceholder___-mkDD", Fe = "FilePicker-module__inputButton___ghLlD", de = "FilePicker-module__multipleHelpText___5tnnn", Ie = "FilePicker-module__multipleInputButton___WCJp9", he = "FilePicker-module__multipleFilesList___Kim0I", Le = "FilePicker-module__multipleFilesListItem___01PDS", ke = "FilePicker-module__multipleFilesListItemContent___pKbho", fe = "FilePicker-module__multipleFilesListItemContentData___5GC-C", Ne = "FilePicker-module__multipleFilesListItemIconContainer___7sUL5", ge = "FilePicker-module__multipleFilesListItemIcon___nfMX9", Ce = "FilePicker-module__multipleFilesListItemText___nPqrL", Pe = "FilePicker-module__multipleFilesListItemName___NjHhX", xe = "FilePicker-module__multipleFilesListItemSize___wc8LJ", ve = "FilePicker-module__multipleFilesListItemError___x9qkT", De = "FilePicker-module__multipleFilesListItemIconError___0RO46", Ee = "FilePicker-module__multipleFilesListItemIconDelete___9Z9Dl", Te = "FilePicker-module__disabled___szMiq", e = {
8
+ container: Z,
9
+ label: ee,
10
+ required: ie,
11
+ labelTooltipIcon: le,
12
+ helpers: te,
13
+ helperText: ne,
14
+ errorMessage: se,
15
+ singleFileHelpLinkContainer: oe,
16
+ singleFileHelpLinkReservedSpace: ce,
17
+ helpLink: re,
18
+ input: me,
19
+ singleFileContainer: ae,
20
+ singleFileInputContainer: ue,
21
+ inputFileName: pe,
22
+ inputFileNamePlaceholder: _e,
23
+ inputButton: Fe,
24
+ multipleHelpText: de,
25
+ multipleInputButton: Ie,
26
+ multipleFilesList: he,
27
+ multipleFilesListItem: Le,
28
+ multipleFilesListItemContent: ke,
29
+ multipleFilesListItemContentData: fe,
30
+ multipleFilesListItemIconContainer: Ne,
31
+ multipleFilesListItemIcon: ge,
32
+ multipleFilesListItemText: Ce,
33
+ multipleFilesListItemName: Pe,
34
+ multipleFilesListItemSize: xe,
35
+ multipleFilesListItemError: ve,
36
+ multipleFilesListItemIconError: De,
37
+ multipleFilesListItemIconDelete: Ee,
38
+ disabled: Te
39
+ };
40
+ function Me({
41
+ type: c = "single",
42
+ maxFiles: _ = 1,
43
+ fileExtensionsAllowed: h,
44
+ maxSize: u,
45
+ queueFiles: j = !1,
46
+ disabled: s = !1,
47
+ value: F,
48
+ label: C,
49
+ required: b = !1,
50
+ placeholder: q,
51
+ errorMessage: m,
52
+ helpText: L,
53
+ helpLink: P,
54
+ helpLinkText: x,
55
+ labelTooltip: r
56
+ }) {
57
+ var R, w;
58
+ const v = J(), k = Y(null), [l, d] = M(F ? F.map((i) => ({
59
+ file: i
60
+ })) : []), [D, E] = M(!1);
61
+ G(() => {
62
+ const i = B(F ?? []);
63
+ d(i);
64
+ }, [F]);
65
+ const K = h.map((i) => `.${i.replace(/^\./, "")}`).join(","), T = h.join(", "), V = (i) => {
66
+ const o = i.name.toLowerCase();
67
+ return o.includes(".") ? o.split(".").pop() ?? "" : "";
68
+ }, B = (i) => {
69
+ const a = l.length + i.length > _;
70
+ E(a);
71
+ const f = u ? u * 1024 * 1024 : Number.POSITIVE_INFINITY, y = new Set(h.map((p) => p.toLowerCase().replace(/^\./, "")));
72
+ return i.map((p) => {
73
+ const U = p.size <= f, X = y.size === 0 || y.has(V(p));
74
+ let N;
75
+ const A = u ? `up to ${u}MB` : "";
76
+ return U || (N = `File size is too large. Must be ${A}.`), X || (N = `The file format is incorrect. Please make sure it is one of the extensions: ${T}.`), {
77
+ file: p,
78
+ error: N
79
+ };
80
+ });
81
+ }, O = (i) => (i / 1024).toFixed(2) + " KB", H = () => {
82
+ var i;
83
+ s || (i = k.current) == null || i.click();
84
+ }, S = (i) => {
85
+ var o;
86
+ s || i.key === "Enter" && ((o = k.current) == null || o.click());
87
+ }, $ = (i) => {
88
+ if (s) return;
89
+ const o = i.target.files, a = B(Array.from(o ?? []));
90
+ d(c === "multiple" && j ? [...l, ...a] : a);
91
+ }, z = (i) => {
92
+ if (s || !l) return;
93
+ const a = l.length - 1 > _;
94
+ E(a), d(l == null ? void 0 : l.filter((f) => f.file.name !== i));
95
+ };
96
+ return /* @__PURE__ */ n("div", { className: W(e.container, s && e.disabled), children: [
97
+ /* @__PURE__ */ n("label", { htmlFor: v, onClick: (i) => i.preventDefault(), className: e.label, children: [
98
+ /* @__PURE__ */ t("span", { title: C, className: e.labelText, children: C }),
99
+ b && /* @__PURE__ */ t("span", { "aria-hidden": "true", className: e.required, children: "*" }),
100
+ r && /* @__PURE__ */ t(Q, { content: r.content, size: r.size, theme: r.theme, tipSide: r.tipSide, tipAlignment: r.tipAlignment, startVisible: r.startVisible, children: /* @__PURE__ */ t(g, { icon: "ap-icon-info", className: e.labelTooltipIcon }) }),
101
+ c === "multiple" && /* @__PURE__ */ n("span", { className: e.multipleHelpText, children: [
102
+ "Only ",
103
+ T,
104
+ " files with max size of ",
105
+ u,
106
+ "MB"
107
+ ] })
108
+ ] }),
109
+ /* @__PURE__ */ t("input", { accept: K, multiple: c === "multiple", ref: k, type: "file", id: v, className: e.input, onChange: $ }),
110
+ c === "single" && /* @__PURE__ */ n("div", { className: e.singleFileContainer, children: [
111
+ /* @__PURE__ */ n("div", { tabIndex: s ? -1 : 0, onClick: H, onKeyDown: S, className: e.singleFileInputContainer, children: [
112
+ /* @__PURE__ */ n("span", { className: e.inputFileName, children: [
113
+ l && l.length > 0 && /* @__PURE__ */ t("span", { className: e.inputFileNameText, children: l[0].file.name }),
114
+ l && l.length === 0 && /* @__PURE__ */ t("span", { className: e.inputFileNamePlaceholder, children: q })
115
+ ] }),
116
+ /* @__PURE__ */ t(I, { type: "tertiary", variant: "default", size: "md", icon: "ap-icon-upload", className: e.inputButton, tabIndex: -1, disabled: s, children: /* @__PURE__ */ t("span", { children: "Browse file" }) })
117
+ ] }),
118
+ /* @__PURE__ */ t("span", { className: e.singleFileHelpLinkReservedSpace, children: l && l.length > 0 && /* @__PURE__ */ t(I, { type: "tertiary", variant: "default", size: "md", icon: "ap-icon-delete", className: e.singleFileDeleteButton, onClick: () => z(l[0].file.name), disabled: s }) })
119
+ ] }),
120
+ c === "multiple" && /* @__PURE__ */ t(I, { type: "secondary", variant: "default", size: "md", icon: "ap-icon-upload", className: e.multipleInputButton, onClick: H, onKeyDown: S, disabled: s, children: /* @__PURE__ */ n("span", { children: [
121
+ "Browse files (max ",
122
+ _,
123
+ " files)"
124
+ ] }) }),
125
+ /* @__PURE__ */ n("div", { className: e.helpers, children: [
126
+ m || D || (R = l[0]) != null && R.error ? /* @__PURE__ */ n("span", { title: m, className: e.errorMessage, children: [
127
+ c === "single" && (m || ((w = l[0]) == null ? void 0 : w.error)),
128
+ c === "multiple" && (m || (D ? `You can only upload up to ${_} files.` : ""))
129
+ ] }) : L && c === "single" && /* @__PURE__ */ t("span", { title: L, className: e.helperText, children: L }),
130
+ c === "single" && P && x && /* @__PURE__ */ n("span", { className: e.singleFileHelpLinkContainer, children: [
131
+ /* @__PURE__ */ t("a", { href: P, className: e.helpLink, target: "_blank", rel: "noopener noreferrer", tabIndex: s ? -1 : 0, children: x }),
132
+ /* @__PURE__ */ t("span", { className: e.singleFileHelpLinkReservedSpace })
133
+ ] })
134
+ ] }),
135
+ c === "multiple" && l && (l == null ? void 0 : l.length) > 0 && /* @__PURE__ */ t("ul", { className: e.multipleFilesList, children: l == null ? void 0 : l.map((i, o) => /* @__PURE__ */ t("li", { className: e.multipleFilesListItem, children: /* @__PURE__ */ n("div", { className: e.multipleFilesListItemContent, children: [
136
+ /* @__PURE__ */ t("span", { className: e.multipleFilesListItemIconContainer, children: /* @__PURE__ */ t(g, { icon: "ap-icon-document", className: e.multipleFilesListItemIcon }) }),
137
+ /* @__PURE__ */ n("div", { className: e.multipleFilesListItemContentData, children: [
138
+ /* @__PURE__ */ n("div", { className: e.multipleFilesListItemText, children: [
139
+ /* @__PURE__ */ t("span", { className: e.multipleFilesListItemName, children: i.file.name }),
140
+ /* @__PURE__ */ t("span", { className: e.multipleFilesListItemSize, children: O(i.file.size) }),
141
+ i.error && /* @__PURE__ */ n("span", { className: e.multipleFilesListItemError, children: [
142
+ /* @__PURE__ */ t(g, { icon: "ap-icon-alert", className: e.multipleFilesListItemIconError }),
143
+ i.error
144
+ ] })
145
+ ] }),
146
+ /* @__PURE__ */ t(I, { type: "tertiary", variant: "default", size: "sm", onClick: () => z(i.file.name), icon: "ap-icon-delete", iconClassName: e.multipleFilesListItemIconDelete, disabled: s })
147
+ ] })
148
+ ] }) }, o)) })
149
+ ] });
150
+ }
151
+ export {
152
+ Me as default
153
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import l from "./FilePicker.js";
3
+ import { d as i, i as r, r as t, g as o } from "../../vi.ClIskdbk-CFW_9sOK.js";
4
+ i("FilePicker", () => {
5
+ r("should render", () => {
6
+ t(/* @__PURE__ */ e(l, { type: "single", fileExtensionsAllowed: ["xlsx"], maxSize: 1, maxFiles: 10, label: "Label", required: !0, placeholder: "Select a file", helpText: "Help text", helpLink: "https://example.com", helpLinkText: "Help link" })), o(!0).toBe(!0);
7
+ });
8
+ });
@@ -1,5 +1,5 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { d as i, i as s, r as a, g as e, s as n, v as c, f as u } from "../../vi.ClIskdbk-DlR4jLzR.js";
2
+ import { d as i, i as s, r as a, g as e, s as n, v as c, f as u } from "../../vi.ClIskdbk-CFW_9sOK.js";
3
3
  import d from "./Ghost.js";
4
4
  i("Ghost", () => {
5
5
  i("Rendering", () => {
@@ -1,5 +1,5 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
- import { d as a, i as s, r as l, g as e, s as n, v as p, f as u } from "../../vi.ClIskdbk-DlR4jLzR.js";
2
+ import { d as a, i as s, r as l, g as e, s as n, v as p, f as u } from "../../vi.ClIskdbk-CFW_9sOK.js";
3
3
  import o from "./Input.js";
4
4
  a("Input", () => {
5
5
  a("Rendering", () => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs as p, jsx as o } from "react/jsx-runtime";
2
- import { d as r, i as l, r as i, g as n, s as a, v as u, f as c } from "../../vi.ClIskdbk-DlR4jLzR.js";
2
+ import { d as r, i as l, r as i, g as n, s as a, v as u, f as c } from "../../vi.ClIskdbk-CFW_9sOK.js";
3
3
  import d from "./RadioGroup.js";
4
4
  import t from "../Radio/Radio.js";
5
5
  r("RadioGroup", () => {
@@ -1,5 +1,5 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
- import { d as u, i as o, r as i, g as t, s as n, v as p, f as d } from "../../vi.ClIskdbk-DlR4jLzR.js";
2
+ import { d as u, i as o, r as i, g as t, s as n, v as p, f as d } from "../../vi.ClIskdbk-CFW_9sOK.js";
3
3
  import a from "./Search.js";
4
4
  u("Search", () => {
5
5
  u("Rendering", () => {
@@ -5,10 +5,11 @@ import * as d from "react";
5
5
  import { useRef as W, useState as N, useEffect as U } from "react";
6
6
  import $ from "../Icon/Icon.js";
7
7
  import "../Input/Input.js";
8
+ import "../Dialog/Dialog.js";
8
9
  import { u as K, c as H, P as j, a as M, b as F } from "../../index-DWydnyjJ.js";
9
10
  import { c as C, R as V, A as X, P as q, C as J, I as Q, G as Y, L as Z, a as oo, b as eo, d as no, e as to, S as ro, f as ao, g as io, h as po } from "../../index-CVWHq7Pr.js";
10
11
  import { u as I } from "../../index-2H7slGYV.js";
11
- import '../../assets/SplitButton.css';var v = "DropdownMenu", [so, Vo] = H(
12
+ import '../../assets/SplitButton.css';var v = "DropdownMenu", [so, Xo] = H(
12
13
  v,
13
14
  [C]
14
15
  ), s = C(), [uo, y] = so(v), x = (o) => {
@@ -201,7 +202,7 @@ const u = {
201
202
  "split-button-dropdown-menu-size-sm": "SplitButton-module__split-button-dropdown-menu-size-sm___xlVmW",
202
203
  "split-button-dropdown-arrow": "SplitButton-module__split-button-dropdown-arrow___-Pf9C"
203
204
  };
204
- function Xo({
205
+ function qo({
205
206
  type: o = "primary",
206
207
  trigger: t = "single",
207
208
  size: e = "md",
@@ -241,5 +242,5 @@ function Xo({
241
242
  ] });
242
243
  }
243
244
  export {
244
- Xo as default
245
+ qo as default
245
246
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as s } from "react/jsx-runtime";
2
- import { d, i as c, r as l, s as e, g as t, f as g, v as b } from "../../vi.ClIskdbk-DlR4jLzR.js";
2
+ import { d, i as c, r as l, s as e, g as t, f as g, v as b } from "../../vi.ClIskdbk-CFW_9sOK.js";
3
3
  import r from "./SplitButton.js";
4
4
  d("SplitButton", () => {
5
5
  const a = (i) => {
@@ -1,5 +1,5 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
- import { d as c, i as o, r as l, g as e, s as t } from "../../vi.ClIskdbk-DlR4jLzR.js";
2
+ import { d as c, i as o, r as l, g as e, s as t } from "../../vi.ClIskdbk-CFW_9sOK.js";
3
3
  import s from "./Tag.js";
4
4
  c("Tag", () => {
5
5
  c("Rendering", () => {