@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,5 +1,5 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import { d, i as h, r as n, g as c, s as o, v as b, f as a } from "../../vi.ClIskdbk-DlR4jLzR.js";
2
+ import { d, i as h, r as n, g as c, s as o, v as b, f as a } from "../../vi.ClIskdbk-CFW_9sOK.js";
3
3
  import l from "./Checkbox.js";
4
4
  d("Checkbox", () => {
5
5
  d("Rendering", () => {
@@ -8,6 +8,7 @@ type CreatableProps = {
8
8
  value?: string[];
9
9
  disabled?: boolean;
10
10
  required?: boolean;
11
+ maxLength?: number;
11
12
  searchPlaceholder?: string;
12
13
  errorMessage?: string;
13
14
  helpText?: string;
@@ -49,5 +50,5 @@ type CreatableProps = {
49
50
  * @param {DataAttributes} [props.data-*] - Additional `data-` attributes forwarded to the root element
50
51
  * @returns {JSX.Element} The rendered Creatable component
51
52
  */
52
- export default function Creatable({ className, label, options, value, disabled, required, searchPlaceholder, errorMessage, helpText, helpLink, helpLinkText, onChange, onSearch, multiSelect, grouped, align, dropdownMenuClassName, labelTooltip, unselect, selectedOptionsLabel, allOptionsSelectedLabel, caseSensitive, ...props }: CreatableProps): import("react/jsx-runtime").JSX.Element;
53
+ export default function Creatable({ className, label, options, value, disabled, required, maxLength, searchPlaceholder, errorMessage, helpText, helpLink, helpLinkText, onChange, onSearch, multiSelect, grouped, align, dropdownMenuClassName, labelTooltip, unselect, selectedOptionsLabel, allOptionsSelectedLabel, caseSensitive, ...props }: CreatableProps): import("react/jsx-runtime").JSX.Element;
53
54
  export {};
@@ -1,234 +1,232 @@
1
1
  import { jsxs as w, jsx as l } from "react/jsx-runtime";
2
2
  import { c as C } from "../../clsx-OuTLNxxd.js";
3
- import { useState as O, useRef as A, useEffect as R, useCallback as le } from "react";
4
- import W from "../Icon/Icon.js";
3
+ import { useContext as Ie, useState as A, useRef as R, useEffect as V, useCallback as ae } from "react";
4
+ import B from "../Icon/Icon.js";
5
5
  import ve from "../Button/Button.js";
6
6
  import "../Input/Input.js";
7
- import ge from "../Tooltip/Tooltip.js";
8
- import { R as Ne, A as Le, P as ye, C as De } from "../../index-BKtdMA_j.js";
9
- import '../../assets/Creatable.css';const ke = "Creatable-module__dropdownContainer___y0ptC", xe = "Creatable-module__dropdownLabel___RyuSY", Oe = "Creatable-module__dropdownLabelDisabled___nhYc0", Ae = "Creatable-module__required___g26DB", Re = "Creatable-module__dropdownWrapper___wu-B3", Ve = "Creatable-module__selectedItemsCreatable___P0mME", Ee = "Creatable-module__selectedItem___0LADh", Fe = "Creatable-module__selectedItemLabel___m0LSV", Me = "Creatable-module__removeButton___tjxwh", Se = "Creatable-module__removeIcon___KQKbD", Be = "Creatable-module__singleSelectedCreatableItem___tanxX", We = "Creatable-module__singleSelectedCreatableItemRemoveButton___Qi9Si", Ge = "Creatable-module__dropdownActions___FmHZe", Ke = "Creatable-module__dropdownArrow___SJmKg", je = "Creatable-module__dropdownArrowOpen___T3E0S", Ue = "Creatable-module__dropdownMenu___HEhC3", $e = "Creatable-module__dropdownCreatableSearchContainer___AgXA3", Je = "Creatable-module__disabled___ZIdus", Pe = "Creatable-module__dropdownCreatableError___FYVla", Ye = "Creatable-module__creatableInput___KaKxv", qe = "Creatable-module__optionsList___VZgJf", ze = "Creatable-module__categoryGroup___g8f-g", Qe = "Creatable-module__categoryDivider___QUgR9", Ze = "Creatable-module__categoryLabel___YhGp9", He = "Creatable-module__optionItem___Ys808", Xe = "Creatable-module__optionItemDisabled___jvfGz", Te = "Creatable-module__optionItemFocused___OfIQd", et = "Creatable-module__optionContent___9RCsJ", tt = "Creatable-module__optionLabel___FJfM1", ot = "Creatable-module__tickIcon___VjpDN", lt = "Creatable-module__helpers___GmPY4", rt = "Creatable-module__helpText___89mXU", at = "Creatable-module__helpTextDisabled___shU6E", nt = "Creatable-module__helpLink___IdU0g", st = "Creatable-module__helpLinkDisabled___B8rpy", dt = "Creatable-module__errorMessage___HRKr5", t = {
7
+ import Le from "../Tooltip/Tooltip.js";
8
+ import { DialogContext as Ne } from "../Dialog/Dialog.js";
9
+ import { R as ge, A as De, P as ye, C as xe } from "../../index-BKtdMA_j.js";
10
+ import '../../assets/Creatable.css';const ke = "Creatable-module__dropdownContainer___y0ptC", Oe = "Creatable-module__dropdownLabel___RyuSY", Ae = "Creatable-module__dropdownLabelDisabled___nhYc0", Re = "Creatable-module__required___g26DB", Ve = "Creatable-module__dropdownWrapper___wu-B3", Ee = "Creatable-module__selectedItemsCreatable___P0mME", Fe = "Creatable-module__selectedItem___0LADh", Se = "Creatable-module__selectedItemLabel___m0LSV", Me = "Creatable-module__removeButton___tjxwh", Be = "Creatable-module__removeIcon___KQKbD", Ge = "Creatable-module__singleSelectedCreatableItem___tanxX", Ke = "Creatable-module__singleSelectedCreatableItemRemoveButton___Qi9Si", je = "Creatable-module__dropdownActions___FmHZe", Ue = "Creatable-module__dropdownArrow___SJmKg", We = "Creatable-module__dropdownArrowOpen___T3E0S", $e = "Creatable-module__dropdownMenu___HEhC3", Je = "Creatable-module__dropdownCreatableSearchContainer___AgXA3", Pe = "Creatable-module__disabled___ZIdus", Ye = "Creatable-module__dropdownCreatableError___FYVla", qe = "Creatable-module__creatableInput___KaKxv", ze = "Creatable-module__optionsList___VZgJf", Qe = "Creatable-module__categoryGroup___g8f-g", Ze = "Creatable-module__categoryDivider___QUgR9", He = "Creatable-module__categoryLabel___YhGp9", Te = "Creatable-module__optionItem___Ys808", Xe = "Creatable-module__optionItemDisabled___jvfGz", et = "Creatable-module__optionItemFocused___OfIQd", tt = "Creatable-module__optionContent___9RCsJ", ot = "Creatable-module__optionLabel___FJfM1", lt = "Creatable-module__tickIcon___VjpDN", at = "Creatable-module__helpers___GmPY4", rt = "Creatable-module__helpText___89mXU", nt = "Creatable-module__helpTextDisabled___shU6E", st = "Creatable-module__helpLink___IdU0g", dt = "Creatable-module__helpLinkDisabled___B8rpy", ct = "Creatable-module__errorMessage___HRKr5", t = {
10
11
  dropdownContainer: ke,
11
- dropdownLabel: xe,
12
+ dropdownLabel: Oe,
12
13
  "label-text": "Creatable-module__label-text___jlV2x",
13
- dropdownLabelDisabled: Oe,
14
+ dropdownLabelDisabled: Ae,
14
15
  "label-tooltip-icon": "Creatable-module__label-tooltip-icon___G7Bou",
15
- required: Ae,
16
- dropdownWrapper: Re,
17
- selectedItemsCreatable: Ve,
18
- selectedItem: Ee,
19
- selectedItemLabel: Fe,
16
+ required: Re,
17
+ dropdownWrapper: Ve,
18
+ selectedItemsCreatable: Ee,
19
+ selectedItem: Fe,
20
+ selectedItemLabel: Se,
20
21
  removeButton: Me,
21
- removeIcon: Se,
22
- singleSelectedCreatableItem: Be,
23
- singleSelectedCreatableItemRemoveButton: We,
24
- dropdownActions: Ge,
25
- dropdownArrow: Ke,
26
- dropdownArrowOpen: je,
27
- dropdownMenu: Ue,
22
+ removeIcon: Be,
23
+ singleSelectedCreatableItem: Ge,
24
+ singleSelectedCreatableItemRemoveButton: Ke,
25
+ dropdownActions: je,
26
+ dropdownArrow: Ue,
27
+ dropdownArrowOpen: We,
28
+ dropdownMenu: $e,
28
29
  "dropdown-container-grouped": "Creatable-module__dropdown-container-grouped___gZle-",
29
30
  "dropdown-container-multi-select": "Creatable-module__dropdown-container-multi-select___1U1U4",
30
- dropdownCreatableSearchContainer: $e,
31
- disabled: Je,
32
- dropdownCreatableError: Pe,
33
- creatableInput: Ye,
34
- optionsList: qe,
35
- categoryGroup: ze,
36
- categoryDivider: Qe,
37
- categoryLabel: Ze,
38
- optionItem: He,
31
+ dropdownCreatableSearchContainer: Je,
32
+ disabled: Pe,
33
+ dropdownCreatableError: Ye,
34
+ creatableInput: qe,
35
+ optionsList: ze,
36
+ categoryGroup: Qe,
37
+ categoryDivider: Ze,
38
+ categoryLabel: He,
39
+ optionItem: Te,
39
40
  optionItemDisabled: Xe,
40
- optionItemFocused: Te,
41
- optionContent: et,
42
- optionLabel: tt,
43
- tickIcon: ot,
44
- helpers: lt,
41
+ optionItemFocused: et,
42
+ optionContent: tt,
43
+ optionLabel: ot,
44
+ tickIcon: lt,
45
+ helpers: at,
45
46
  helpText: rt,
46
- helpTextDisabled: at,
47
- helpLink: nt,
48
- helpLinkDisabled: st,
49
- errorMessage: dt
47
+ helpTextDisabled: nt,
48
+ helpLink: st,
49
+ helpLinkDisabled: dt,
50
+ errorMessage: ct
50
51
  };
51
- function wt({
52
+ function ht({
52
53
  className: re,
53
54
  label: G,
54
- options: D,
55
- value: k = [],
55
+ options: y,
56
+ value: x = [],
56
57
  disabled: v = !1,
57
- required: ae = !1,
58
- searchPlaceholder: ne = "Search options...",
59
- errorMessage: V,
60
- helpText: F,
61
- helpLink: K,
62
- helpLinkText: j,
63
- onChange: a,
64
- onSearch: x,
58
+ required: ne = !1,
59
+ maxLength: se,
60
+ searchPlaceholder: de = "Search options...",
61
+ errorMessage: E,
62
+ helpText: K,
63
+ helpLink: J,
64
+ helpLinkText: P,
65
+ onChange: r,
66
+ onSearch: k,
65
67
  multiSelect: m = !1,
66
- grouped: se = !1,
68
+ grouped: ce = !1,
67
69
  align: Y = "left",
68
- dropdownMenuClassName: de,
69
- labelTooltip: g,
70
+ dropdownMenuClassName: ie,
71
+ labelTooltip: L,
70
72
  unselect: q = !1,
71
73
  selectedOptionsLabel: z = "options selected",
72
- allOptionsSelectedLabel: M,
73
- caseSensitive: U = !1,
74
- ...ce
74
+ allOptionsSelectedLabel: F,
75
+ caseSensitive: j = !1,
76
+ ..._e
75
77
  }) {
76
- const [u, N] = O(k), [c, h] = O(!1), [Q, b] = O(""), [f, i] = O(-1), Z = A(null), ie = A(null), E = A(null), L = A(null), H = A(null), [_e, ue] = O(0), [pe, me] = O(0), X = A(k);
77
- R(() => {
78
- JSON.stringify(X.current) !== JSON.stringify(k) && (N(k), X.current = k);
79
- }, [k]), R(() => {
80
- var r;
81
- const e = (r = ie.current) == null ? void 0 : r.getBoundingClientRect().width;
82
- e && ue(e);
83
- }, []), R(() => {
84
- var r;
85
- const e = (r = E.current) == null ? void 0 : r.getBoundingClientRect().width;
86
- e && me(e);
78
+ const ue = Ie(Ne), [u, N] = A(x), [c, h] = A(!1), [Q, b] = A(""), [f, i] = A(-1), Z = R(null), O = R(null), g = R(null), H = R(null), [T, pe] = A(0), X = R(x);
79
+ V(() => {
80
+ JSON.stringify(X.current) !== JSON.stringify(x) && (N(x), X.current = x);
81
+ }, [x]), V(() => {
82
+ var a;
83
+ const e = (a = O.current) == null ? void 0 : a.getBoundingClientRect().width;
84
+ e && pe(e);
87
85
  }, []);
88
- const _ = Q.trim(), p = D.filter((e) => {
89
- const r = U ? e.label : e.label.toLowerCase(), o = U ? _ : _.toLowerCase();
90
- return r.includes(o);
91
- }), S = _ !== "" && !D.find((e) => U ? e.label === _ : e.label.toLowerCase() === _.toLowerCase());
92
- R(() => {
93
- c && L.current && L.current.focus();
86
+ const _ = Q.trim(), p = y.filter((e) => {
87
+ const a = j ? e.label : e.label.toLowerCase(), o = j ? _ : _.toLowerCase();
88
+ return a.includes(o);
89
+ }), S = _ !== "" && !y.find((e) => j ? e.label === _ : e.label.toLowerCase() === _.toLowerCase());
90
+ V(() => {
91
+ c && g.current && g.current.focus();
94
92
  }, [c]);
95
- const be = (e) => {
93
+ const me = (e) => {
96
94
  h(e), b(""), i(-1);
97
- }, $ = le((e) => {
95
+ }, U = ae((e) => {
98
96
  var o, n;
99
- const r = {
97
+ const a = {
100
98
  value: e,
101
99
  label: e,
102
100
  disabled: !1
103
101
  };
104
- if (D.push(r), m) {
105
- const y = u.includes(e) ? u : [...u, e];
106
- N(y), a == null || a(y), (o = L.current) == null || o.focus(), b(""), h(!0), i(-1);
102
+ if (y.push(a), m) {
103
+ const D = u.includes(e) ? u : [...u, e];
104
+ N(D), r == null || r(D), (o = g.current) == null || o.focus(), b(""), h(!0), i(-1);
107
105
  } else {
108
106
  const d = [e];
109
- N(d), a == null || a(d), b(""), (n = E.current) == null || n.focus(), h(!1), i(-1);
107
+ N(d), r == null || r(d), b(""), (n = O.current) == null || n.focus(), h(!1), i(-1);
110
108
  }
111
- }, [m, a, D, u]), J = le((e) => {
112
- var r, o, n;
109
+ }, [m, r, y, u]), W = ae((e) => {
110
+ var a, o, n;
113
111
  if (!e.disabled)
114
112
  if (m) {
115
- const y = u.includes(e.value) ? u.filter((Ie) => Ie !== e.value) : [...u, e.value];
116
- N(y), a == null || a(y), h(!0), (r = L.current) == null || r.focus(), b(""), i(-1);
113
+ const D = u.includes(e.value) ? u.filter((he) => he !== e.value) : [...u, e.value];
114
+ N(D), r == null || r(D), h(!0), (a = g.current) == null || a.focus(), b(""), i(-1);
117
115
  } else if (u.includes(e.value)) {
118
116
  if (q) {
119
117
  const d = [];
120
- N(d), a == null || a(d), (o = E.current) == null || o.focus(), h(!1), b(""), i(-1);
118
+ N(d), r == null || r(d), (o = O.current) == null || o.focus(), h(!1), b(""), i(-1);
121
119
  }
122
120
  } else {
123
121
  const d = [e.value];
124
- N(d), a == null || a(d), (n = E.current) == null || n.focus(), h(!1), b(""), i(-1);
122
+ N(d), r == null || r(d), (n = O.current) == null || n.focus(), h(!1), b(""), i(-1);
125
123
  }
126
- }, [m, a, u, q]), fe = (e) => {
127
- h(!0), b(e), i(-1), x == null || x(e);
128
- }, P = (e) => {
129
- h(!0), b(e), i(-1), x == null || x(e);
130
- }, T = (e) => {
131
- const r = u.filter((o) => o !== e);
132
- N(r), a == null || a(r);
124
+ }, [m, r, u, q]), be = (e) => {
125
+ h(!0), b(e), i(-1), k == null || k(e);
126
+ }, $ = (e) => {
127
+ h(!0), b(e), i(-1), k == null || k(e);
128
+ }, ee = (e) => {
129
+ const a = u.filter((o) => o !== e);
130
+ N(a), r == null || r(a);
133
131
  };
134
- R(() => {
135
- const e = (r) => {
132
+ V(() => {
133
+ const e = (a) => {
136
134
  if (!c) return;
137
135
  const o = p.length + (S ? 1 : 0);
138
136
  if (o !== 0)
139
- switch (r.key) {
137
+ switch (a.key) {
140
138
  case "ArrowDown":
141
- r.preventDefault(), i((n) => n < 0 ? 0 : n < o - 1 ? n + 1 : 0);
139
+ a.preventDefault(), i((n) => n < 0 ? 0 : n < o - 1 ? n + 1 : 0);
142
140
  break;
143
141
  case "ArrowUp":
144
- r.preventDefault(), i((n) => n < 0 ? o - 1 : n > 0 ? n - 1 : o - 1);
142
+ a.preventDefault(), i((n) => n < 0 ? o - 1 : n > 0 ? n - 1 : o - 1);
145
143
  break;
146
144
  case "Enter":
147
- if (r.preventDefault(), f >= 0 && f < p.length) {
145
+ if (a.preventDefault(), f >= 0 && f < p.length) {
148
146
  const n = p[f];
149
- J(n);
150
- } else S && f === p.length && $(_);
147
+ W(n);
148
+ } else S && f === p.length && U(_);
151
149
  break;
152
150
  case "Escape":
153
- r.preventDefault(), h(!1), b(""), i(-1);
151
+ a.preventDefault(), h(!1), b(""), i(-1);
154
152
  break;
155
153
  }
156
154
  };
157
155
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
158
- }, [f, p, $, J, S, c, _]), R(() => {
156
+ }, [f, p, U, W, S, c, _]), V(() => {
159
157
  if (!c || f < 0) return;
160
- const e = H.current, r = e == null ? void 0 : e.querySelector(`[data-option-index="${f}"]`);
161
- e && r && r.scrollIntoView({
158
+ const e = H.current, a = e == null ? void 0 : e.querySelector(`[data-option-index="${f}"]`);
159
+ e && a && a.scrollIntoView({
162
160
  block: "nearest"
163
161
  });
164
162
  }, [c, f]);
165
- const B = u, s = D.filter((e) => B.includes(e.value)), we = !!V, ee = D.filter((e) => !e.disabled), te = ee.length > 0 && ee.every((e) => B.includes(e.value)), Ce = p.reduce((e, r) => {
166
- const o = r.category || "default";
167
- return e[o] || (e[o] = []), e[o].push(r), e;
168
- }, {}), he = p, {
163
+ const M = u, s = y.filter((e) => M.includes(e.value)), fe = !!E, te = y.filter((e) => !e.disabled), oe = te.length > 0 && te.every((e) => M.includes(e.value)), we = p.reduce((e, a) => {
164
+ const o = a.category || "default";
165
+ return e[o] || (e[o] = []), e[o].push(a), e;
166
+ }, {}), Ce = p, {
169
167
  onBlur: I,
170
- ...oe
171
- } = ce;
172
- return /* @__PURE__ */ w("div", { ref: Z, className: C(t.dropdownContainer, se && t["dropdown-container-grouped"], m && t["dropdown-container-multi-select"], re), ...oe, children: [
168
+ ...le
169
+ } = _e;
170
+ return /* @__PURE__ */ w("div", { ref: Z, className: C(t.dropdownContainer, ce && t["dropdown-container-grouped"], m && t["dropdown-container-multi-select"], re), ...le, children: [
173
171
  G && /* @__PURE__ */ w("label", { className: C(t.dropdownLabel, v && t.dropdownLabelDisabled), children: [
174
172
  /* @__PURE__ */ l("span", { title: G, className: t["label-text"], children: G }),
175
- ae && /* @__PURE__ */ l("span", { className: t.required, children: "*" }),
176
- g && /* @__PURE__ */ l(ge, { content: g.content, size: g.size, theme: g.theme, tipSide: g.tipSide, tipAlignment: g.tipAlignment, startVisible: g.startVisible, children: /* @__PURE__ */ l(W, { icon: "ap-icon-info", className: t["label-tooltip-icon"] }) })
173
+ ne && /* @__PURE__ */ l("span", { className: t.required, children: "*" }),
174
+ L && /* @__PURE__ */ l(Le, { content: L.content, size: L.size, theme: L.theme, tipSide: L.tipSide, tipAlignment: L.tipAlignment, startVisible: L.startVisible, children: /* @__PURE__ */ l(B, { icon: "ap-icon-info", className: t["label-tooltip-icon"] }) })
177
175
  ] }),
178
- /* @__PURE__ */ l(Ne, { open: c, onOpenChange: be, children: /* @__PURE__ */ w("div", { className: t.dropdownWrapper, children: [
179
- /* @__PURE__ */ l(Le, { children: /* @__PURE__ */ w("div", { tabIndex: !m && s.length > 0 ? 0 : -1, ref: E, className: C(t.dropdownCreatableSearchContainer, v && t.disabled, we && t.dropdownCreatableError), onBlur: (e) => {
176
+ /* @__PURE__ */ l(ge, { open: c, onOpenChange: me, children: /* @__PURE__ */ w("div", { className: t.dropdownWrapper, children: [
177
+ /* @__PURE__ */ l(De, { children: /* @__PURE__ */ w("div", { tabIndex: !m && s.length > 0 ? 0 : -1, ref: O, className: C(t.dropdownCreatableSearchContainer, v && t.disabled, fe && t.dropdownCreatableError), onBlur: (e) => {
180
178
  c || I == null || I(e);
181
179
  }, onClick: () => {
182
180
  var e;
183
181
  if (!m && s.length > 0)
184
- return P("");
185
- (e = L.current) == null || e.focus();
182
+ return $("");
183
+ (e = g.current) == null || e.focus();
186
184
  }, onKeyDown: (e) => {
187
185
  if (e.key === "Enter" && !m && s.length > 0 && !c)
188
- return P("");
189
- }, ...oe, children: [
190
- s.length > 0 && /* @__PURE__ */ l("div", { className: C(t.selectedItemsCreatable), children: m ? s.length > 3 ? /* @__PURE__ */ l("div", { className: t.selectedItem, children: /* @__PURE__ */ l("span", { className: t.selectedItemLabel, title: te && M ? M : `${s.length} ${z}`, children: te && M ? M : `${s.length} ${z}` }) }) : s.map((e) => /* @__PURE__ */ w("div", { className: t.selectedItem, children: [
186
+ return $("");
187
+ }, ...le, children: [
188
+ s.length > 0 && /* @__PURE__ */ l("div", { className: C(t.selectedItemsCreatable), children: m ? s.length > 3 ? /* @__PURE__ */ l("div", { className: t.selectedItem, children: /* @__PURE__ */ l("span", { className: t.selectedItemLabel, title: oe && F ? F : `${s.length} ${z}`, children: oe && F ? F : `${s.length} ${z}` }) }) : s.map((e) => /* @__PURE__ */ w("div", { className: t.selectedItem, children: [
191
189
  /* @__PURE__ */ l("span", { className: t.selectedItemLabel, title: e.label, children: e.label }),
192
- /* @__PURE__ */ l("button", { type: "button", className: t.removeButton, onClick: () => T(e.value), disabled: v, children: /* @__PURE__ */ l(W, { icon: "ap-icon-close", className: t.removeIcon }) })
190
+ /* @__PURE__ */ l("button", { type: "button", className: t.removeButton, onClick: () => ee(e.value), disabled: v, children: /* @__PURE__ */ l(B, { icon: "ap-icon-close", className: t.removeIcon }) })
193
191
  ] }, e.value)) : s.length > 0 && /* @__PURE__ */ w("div", { className: t.singleSelectedCreatableItem, children: [
194
192
  /* @__PURE__ */ l("span", { className: t.selectedItemLabel, title: s[0].label, children: s[0].label }),
195
- /* @__PURE__ */ l(ve, { type: "tertiary", variant: "default", size: "sm", onClick: () => T(s[0].value), disabled: v, icon: "ap-icon-add-filled", className: t.singleSelectedCreatableItemRemoveButton })
193
+ /* @__PURE__ */ l(ve, { type: "tertiary", variant: "default", size: "sm", onClick: () => ee(s[0].value), disabled: v, icon: "ap-icon-add-filled", className: t.singleSelectedCreatableItemRemoveButton })
196
194
  ] }) }),
197
- (m || !s.length) && /* @__PURE__ */ l("input", { ref: L, placeholder: s.length > 0 ? "" : ne, value: Q, onChange: (e) => fe(e.target.value), onFocus: (e) => P(e.target.value), onBlur: (e) => {
195
+ (m || !s.length) && /* @__PURE__ */ l("input", { maxLength: se, ref: g, placeholder: s.length > 0 ? "" : de, value: Q, onChange: (e) => be(e.target.value), onFocus: (e) => $(e.target.value), onBlur: (e) => {
198
196
  c || I == null || I(e);
199
197
  }, disabled: v, className: t.creatableInput }),
200
- /* @__PURE__ */ l("div", { className: t.dropdownActions, children: /* @__PURE__ */ l(W, { icon: "ap-icon-expand-more", className: C(t.dropdownArrow, c && t.dropdownArrowOpen) }) })
198
+ /* @__PURE__ */ l("div", { className: t.dropdownActions, children: /* @__PURE__ */ l(B, { icon: "ap-icon-expand-more", className: C(t.dropdownArrow, c && t.dropdownArrowOpen) }) })
201
199
  ] }) }),
202
- /* @__PURE__ */ l(ye, { children: /* @__PURE__ */ l(De, { onOpenAutoFocus: (e) => {
200
+ /* @__PURE__ */ l(ye, { container: ue, children: /* @__PURE__ */ l(xe, { onOpenAutoFocus: (e) => {
203
201
  e.preventDefault();
204
202
  }, align: Y === "right" ? "end" : "start", side: "bottom", avoidCollisions: !0, sideOffset: 6, collisionPadding: 8, style: {
205
- minWidth: _e,
203
+ width: T,
206
204
  zIndex: 9999
207
205
  }, onInteractOutside: (e) => {
208
206
  var o;
209
- e.target === L.current && e.preventDefault(), ((o = Z.current) == null ? void 0 : o.contains(e.target)) || I == null || I(e);
207
+ e.target === g.current && e.preventDefault(), ((o = Z.current) == null ? void 0 : o.contains(e.target)) || I == null || I(e);
210
208
  }, children: c && /* @__PURE__ */ l("div", { style: {
211
- minWidth: pe
212
- }, className: C(t.dropdownMenu, de, Y === "right" && t.dropdownMenuRight), children: /* @__PURE__ */ w("div", { ref: H, className: t.optionsList, "data-dropdown-options-list": !0, children: [
213
- p.length > 0 ? Object.entries(Ce).map(([e, r]) => /* @__PURE__ */ w("div", { className: t.categoryGroup, children: [
209
+ width: T
210
+ }, className: C(t.dropdownMenu, ie, Y === "right" && t.dropdownMenuRight), children: /* @__PURE__ */ w("div", { ref: H, className: t.optionsList, "data-dropdown-options-list": !0, children: [
211
+ p.length > 0 ? Object.entries(we).map(([e, a]) => /* @__PURE__ */ w("div", { className: t.categoryGroup, children: [
214
212
  e !== "default" && /* @__PURE__ */ l("div", { className: t.categoryDivider, children: /* @__PURE__ */ l("span", { className: t.categoryLabel, children: e }) }),
215
- r.map((o) => {
216
- const n = he.indexOf(o), d = p.find((y) => y.value === o.value);
217
- return /* @__PURE__ */ l("button", { title: (d == null ? void 0 : d.label) || o.label, type: "button", className: C(t.optionItem, B.includes(o.value) && t.optionItemSelected, o.disabled && t.optionItemDisabled, n === f && t.optionItemFocused), onClick: () => J(o), disabled: o.disabled, "data-dropdown-option-item": !0, "data-option-index": n, children: /* @__PURE__ */ w("div", { className: t.optionContent, children: [
213
+ a.map((o) => {
214
+ const n = Ce.indexOf(o), d = p.find((D) => D.value === o.value);
215
+ return /* @__PURE__ */ l("button", { title: (d == null ? void 0 : d.label) || o.label, type: "button", className: C(t.optionItem, M.includes(o.value) && t.optionItemSelected, o.disabled && t.optionItemDisabled, n === f && t.optionItemFocused), onClick: () => W(o), disabled: o.disabled, "data-dropdown-option-item": !0, "data-option-index": n, children: /* @__PURE__ */ w("div", { className: t.optionContent, children: [
218
216
  /* @__PURE__ */ l("span", { className: t.optionLabel, children: o.label }),
219
- B.includes(o.value) && /* @__PURE__ */ l(W, { icon: "ap-icon-check", className: t.tickIcon })
217
+ M.includes(o.value) && /* @__PURE__ */ l(B, { icon: "ap-icon-check", className: t.tickIcon })
220
218
  ] }) }, o.value);
221
219
  })
222
220
  ] }, e)) : null,
223
- S && /* @__PURE__ */ l("button", { type: "button", className: C(t.optionItem, t.optionItemCreatable, f === p.length && t.optionItemFocused), title: _ ? `Create "${_}"` : "Create new option", "data-option-index": p.length, onClick: () => $(_), children: /* @__PURE__ */ l("div", { className: t.optionContent, children: /* @__PURE__ */ l("span", { className: t.optionLabel, children: _ ? `Create "${_}"` : "Create new option" }) }) })
221
+ S && /* @__PURE__ */ l("button", { type: "button", className: C(t.optionItem, t.optionItemCreatable, f === p.length && t.optionItemFocused), title: _ ? `Create "${_}"` : "Create new option", "data-option-index": p.length, onClick: () => U(_), children: /* @__PURE__ */ l("div", { className: t.optionContent, children: /* @__PURE__ */ l("span", { className: t.optionLabel, children: _ ? `Create "${_}"` : "Create new option" }) }) })
224
222
  ] }) }) }) })
225
223
  ] }) }),
226
- (V || F || K && j) && /* @__PURE__ */ w("div", { className: t.helpers, children: [
227
- V ? /* @__PURE__ */ l("span", { title: V, className: t.errorMessage, children: V }) : F && /* @__PURE__ */ l("span", { title: F, className: C(t.helpText, v && t.helpTextDisabled), children: F }),
228
- K && j && /* @__PURE__ */ l("a", { href: K, className: C(t.helpLink, v && t.helpLinkDisabled), target: "_blank", rel: "noopener noreferrer", children: j })
224
+ /* @__PURE__ */ w("div", { className: t.helpers, children: [
225
+ E ? /* @__PURE__ */ l("span", { title: E, className: t.errorMessage, children: E }) : K && /* @__PURE__ */ l("span", { title: K, className: C(t.helpText, v && t.helpTextDisabled), children: K }),
226
+ J && P && /* @__PURE__ */ l("a", { href: J, className: C(t.helpLink, v && t.helpLinkDisabled), target: "_blank", rel: "noopener noreferrer", children: P })
229
227
  ] })
230
228
  ] });
231
229
  }
232
230
  export {
233
- wt as default
231
+ ht as default
234
232
  };
@@ -1,5 +1,6 @@
1
1
  import { DataAttributes } from '../../types/data-attributes';
2
2
  import { ApIcon } from '../../assets/ap-icons-types';
3
+ export declare const DialogContext: import('react').Context<HTMLElement | null>;
3
4
  /**
4
5
  * Dialog component that displays modal content with customizable actions and optional illustration.
5
6
  * Provides a native HTML dialog element with backdrop support, confirmation/cancellation actions, and accessibility features.
@@ -1,5 +1,5 @@
1
1
  import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
- import { useRef as h, useEffect as I } from "react";
2
+ import { createContext as I, useRef as h, useEffect as P } from "react";
3
3
  import f from "../Button/Button.js";
4
4
  import H from "../Icon/Icon.js";
5
5
  import '../../assets/Dialog.css';const J = "Dialog-module__dialog___r4ljx", a = {
@@ -11,38 +11,38 @@ import '../../assets/Dialog.css';const J = "Dialog-module__dialog___r4ljx", a =
11
11
  "dialog-buttons": "Dialog-module__dialog-buttons___x-v2M",
12
12
  "dialog-close-button": "Dialog-module__dialog-close-button___-PzEz",
13
13
  "dialog-close-button-icon": "Dialog-module__dialog-close-button-icon___BeGg2"
14
- };
15
- function q({
14
+ }, K = I(null);
15
+ function F({
16
16
  children: g,
17
17
  isOpen: d,
18
18
  onClose: l,
19
19
  title: v,
20
- description: b,
20
+ description: D,
21
21
  illustrationSrc: s,
22
22
  confirmButtonText: _,
23
- cancelButtonText: u,
24
- confirmButtonType: D = "primary",
23
+ cancelButtonText: n,
24
+ confirmButtonType: b = "primary",
25
25
  cancelButtonType: p = "primary",
26
26
  confirmButtonVariant: N = "default",
27
27
  cancelButtonVariant: k = "cancel",
28
- confirmButtonSize: y = "md",
29
- cancelButtonSize: z = "md",
30
- confirmButtonIcon: j,
31
- cancelButtonIcon: x,
28
+ confirmButtonSize: x = "md",
29
+ cancelButtonSize: y = "md",
30
+ confirmButtonIcon: z,
31
+ cancelButtonIcon: j,
32
32
  onConfirm: e,
33
33
  onCancel: r,
34
34
  className: M,
35
35
  ...R
36
36
  }) {
37
37
  const w = h(null), t = h(null);
38
- I(() => {
38
+ P(() => {
39
39
  var i, m;
40
40
  d !== void 0 && (d ? (i = t.current) == null || i.showModal() : (m = t.current) == null || m.close());
41
41
  }, [d]);
42
42
  const A = () => {
43
43
  var i;
44
44
  (i = t.current) == null || i.showModal();
45
- }, n = () => {
45
+ }, u = () => {
46
46
  var i;
47
47
  l == null || l(), d === void 0 && ((i = t.current) == null || i.close());
48
48
  }, E = () => {
@@ -54,20 +54,21 @@ function q({
54
54
  };
55
55
  return /* @__PURE__ */ c("div", { className: M, ...R, children: [
56
56
  g && /* @__PURE__ */ o("div", { ref: w, onClick: A, children: g }),
57
- /* @__PURE__ */ c("dialog", { className: a.dialog, ref: t, onClose: n, children: [
58
- l && /* @__PURE__ */ o("button", { className: a["dialog-close-button"], onClick: n, children: /* @__PURE__ */ o(H, { className: a["dialog-close-button-icon"], icon: "ap-icon-close" }) }),
57
+ /* @__PURE__ */ o("dialog", { className: a.dialog, ref: t, onClose: u, children: /* @__PURE__ */ c(K.Provider, { value: t.current, children: [
58
+ l && /* @__PURE__ */ o("button", { className: a["dialog-close-button"], onClick: u, children: /* @__PURE__ */ o(H, { className: a["dialog-close-button-icon"], icon: "ap-icon-close" }) }),
59
59
  s && /* @__PURE__ */ o("div", { className: a["dialog-illustration"], children: /* @__PURE__ */ o("img", { src: s, alt: "Dialog illustration" }) }),
60
60
  /* @__PURE__ */ c("div", { className: a["dialog-content"], children: [
61
61
  /* @__PURE__ */ o("h2", { className: a["dialog-title"], children: v }),
62
- /* @__PURE__ */ o("div", { className: a["dialog-description"], children: b })
62
+ /* @__PURE__ */ o("div", { className: a["dialog-description"], children: D })
63
63
  ] }),
64
64
  /* @__PURE__ */ c("div", { className: a["dialog-buttons"], children: [
65
- u && /* @__PURE__ */ o(f, { type: p, variant: k, size: z, onClick: G, icon: x, children: u }),
66
- _ && /* @__PURE__ */ o(f, { type: D, variant: N, size: y, onClick: E, icon: j, children: _ })
65
+ n && /* @__PURE__ */ o(f, { type: p, variant: k, size: y, onClick: G, icon: j, children: n }),
66
+ _ && /* @__PURE__ */ o(f, { type: b, variant: N, size: x, onClick: E, icon: z, children: _ })
67
67
  ] })
68
- ] })
68
+ ] }) })
69
69
  ] });
70
70
  }
71
71
  export {
72
- q as default
72
+ K as DialogContext,
73
+ F as default
73
74
  };