@alixpartners/ui-components 2.0.0-beta.9 → 2.0.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 (53) hide show
  1. package/README.md +2 -2
  2. package/dist/ap-logos-Cl1TR5nm.js +4 -0
  3. package/dist/assets/Banner.css +1 -1
  4. package/dist/assets/Button.css +1 -1
  5. package/dist/assets/Checkbox.css +1 -1
  6. package/dist/assets/Dialog.css +1 -1
  7. package/dist/assets/DragAndDrop.css +1 -1
  8. package/dist/assets/Dropdown.css +1 -1
  9. package/dist/assets/Input.css +1 -1
  10. package/dist/assets/LogosGallery.css +1 -0
  11. package/dist/assets/NavBar.css +1 -1
  12. package/dist/assets/SplitButton.css +1 -1
  13. package/dist/assets/TabNavigation.css +1 -1
  14. package/dist/assets/Tag.css +1 -1
  15. package/dist/assets/Textarea.css +1 -1
  16. package/dist/assets/Toast.css +1 -1
  17. package/dist/assets/ap-icons-types.d.ts +1 -1
  18. package/dist/assets/ap-icons.d.ts +1 -1
  19. package/dist/assets/ap-logos-types.d.ts +1 -0
  20. package/dist/assets/ap-logos.d.ts +1 -0
  21. package/dist/assets/main.css +1 -1
  22. package/dist/components/Button/Button.d.ts +11 -12
  23. package/dist/components/Button/Button.js +15 -14
  24. package/dist/components/Creatable/Creatable.d.ts +3 -1
  25. package/dist/components/Creatable/Creatable.js +26 -25
  26. package/dist/components/Dialog/Dialog.d.ts +15 -4
  27. package/dist/components/Dialog/Dialog.js +58 -42
  28. package/dist/components/DragAndDrop/DragAndDrop.d.ts +4 -1
  29. package/dist/components/DragAndDrop/DragAndDrop.js +82 -72
  30. package/dist/components/Dropdown/Dropdown.d.ts +8 -1
  31. package/dist/components/Dropdown/Dropdown.js +354 -320
  32. package/dist/components/Icons/IconsGallery.js +1 -1
  33. package/dist/components/Input/Input.d.ts +23 -22
  34. package/dist/components/Input/Input.js +62 -60
  35. package/dist/components/Logo/Logo.d.ts +8 -0
  36. package/dist/components/Logo/Logo.js +57 -0
  37. package/dist/components/Logos/LogosGallery.d.ts +1 -0
  38. package/dist/components/Logos/LogosGallery.js +16 -0
  39. package/dist/components/NavBar/NavBar.d.ts +13 -5
  40. package/dist/components/NavBar/NavBar.js +246 -230
  41. package/dist/components/SplitButton/SplitButton.js +20 -18
  42. package/dist/components/Tab/Tab.js +19 -19
  43. package/dist/components/TabNavigation/TabNavigation.js +11 -10
  44. package/dist/components/Tag/Tag.js +8 -8
  45. package/dist/components/Textarea/Textarea.d.ts +2 -2
  46. package/dist/components/Toast/Toast.js +2 -2
  47. package/dist/components/Toast/Toast.test.js +1 -1
  48. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  49. package/dist/components/Tooltip/Tooltip.js +12 -10
  50. package/dist/main.d.ts +5 -3
  51. package/dist/main.js +29 -25
  52. package/dist/storybook-docs-page.d.ts +4 -1
  53. package/package.json +1 -1
@@ -1,6 +1,17 @@
1
1
  import { ApIcon } from '../../assets/ap-icons-types';
2
2
  import { DataAttributes } from '../../types/data-attributes';
3
3
  import { InteractiveEventHandlers } from '../../types/native-events';
4
+ export type ButtonProps = {
5
+ type: 'primary' | 'secondary' | 'tertiary';
6
+ variant: 'default' | 'danger' | 'cancel';
7
+ size: 'sm' | 'md';
8
+ icon?: ApIcon;
9
+ disabled?: boolean;
10
+ loading?: boolean;
11
+ children?: React.ReactNode;
12
+ className?: string;
13
+ iconClassName?: string;
14
+ } & DataAttributes & InteractiveEventHandlers;
4
15
  /**
5
16
  * A versatile button component that supports different types, variants, sizes, and states.
6
17
  * Used for user interactions and form submissions throughout the application.
@@ -16,16 +27,4 @@ import { InteractiveEventHandlers } from '../../types/native-events';
16
27
  * @param {() => void} [props.onClick] - Callback fired when the button is clicked
17
28
  * @returns {JSX.Element} The rendered Button component
18
29
  */
19
- type ButtonProps = {
20
- type: 'primary' | 'secondary' | 'tertiary';
21
- variant: 'default' | 'danger' | 'cancel';
22
- size: 'sm' | 'md';
23
- icon?: ApIcon;
24
- disabled?: boolean;
25
- loading?: boolean;
26
- children?: React.ReactNode;
27
- className?: string;
28
- iconClassName?: string;
29
- } & DataAttributes & InteractiveEventHandlers;
30
30
  export default function Button({ type, variant, size, icon, disabled, loading, children, className, iconClassName, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
31
- export {};
@@ -1,8 +1,9 @@
1
1
  import { jsxs as y, jsx as b } from "react/jsx-runtime";
2
- import { c as m } from "../../clsx-OuTLNxxd.js";
3
- import g from "../Spinner/Spinner.js";
4
- import '../../assets/Button.css';const f = "Button-module__btn___daEdK", w = "Button-module__loading___QfItr", t = {
5
- btn: f,
2
+ import { c as a } from "../../clsx-OuTLNxxd.js";
3
+ import f from "../Spinner/Spinner.js";
4
+ import g from "../Icon/Icon.js";
5
+ import '../../assets/Button.css';const w = "Button-module__btn___daEdK", x = "Button-module__loading___QfItr", t = {
6
+ btn: w,
6
7
  "btn-icon": "Button-module__btn-icon___G7m4S",
7
8
  "btn-icon-sm": "Button-module__btn-icon-sm___w7eg9",
8
9
  "btn-icon-md": "Button-module__btn-icon-md___8Ywy2",
@@ -15,12 +16,12 @@ import '../../assets/Button.css';const f = "Button-module__btn___daEdK", w = "Bu
15
16
  "btn-tertiary": "Button-module__btn-tertiary___G-7lD",
16
17
  "btn-disabled": "Button-module__btn-disabled___eg1uH",
17
18
  "btn-loading": "Button-module__btn-loading___vAg78",
18
- loading: w,
19
+ loading: x,
19
20
  "btn-sm": "Button-module__btn-sm___KNlkv",
20
21
  "btn-md": "Button-module__btn-md___C8vqh",
21
22
  "btn-text": "Button-module__btn-text___3ccH9"
22
23
  };
23
- function D({
24
+ function h({
24
25
  type: c,
25
26
  variant: i,
26
27
  size: o,
@@ -28,20 +29,20 @@ function D({
28
29
  disabled: u = !1,
29
30
  loading: e = !1,
30
31
  children: d,
31
- className: s,
32
- iconClassName: r,
32
+ className: r,
33
+ iconClassName: s,
33
34
  ..._
34
35
  }) {
35
36
  const B = (n) => {
36
- var a;
37
- (n.key === "Enter" || n.key === " ") && (n.preventDefault(), n.currentTarget.click()), (a = _.onKeyDown) == null || a.call(_, n);
37
+ var m;
38
+ (n.key === "Enter" || n.key === " ") && (n.preventDefault(), n.currentTarget.click()), (m = _.onKeyDown) == null || m.call(_, n);
38
39
  };
39
- return /* @__PURE__ */ y("button", { type: "button", className: m(t.btn, t[`btn-${c}`], t[`btn-${i}`], t[`btn-${o}`], u && t["btn-disabled"], s), disabled: u || e, onKeyDown: B, ..._, children: [
40
- !!l && !e && /* @__PURE__ */ b("span", { className: m(t["btn-icon"], t[`btn-icon-${o}`], l, r) }),
41
- e && /* @__PURE__ */ b(g, { size: o, color: "white", className: t["loading-spinner"] }),
40
+ return /* @__PURE__ */ y("button", { type: "button", className: a(t.btn, t[`btn-${c}`], t[`btn-${i}`], t[`btn-${o}`], u && t["btn-disabled"], r), disabled: u || e, onKeyDown: B, ..._, children: [
41
+ !!l && !e && /* @__PURE__ */ b(g, { icon: l, className: a(t["btn-icon"], t[`btn-icon-${o}`], s) }),
42
+ e && /* @__PURE__ */ b(f, { size: o, color: "white", className: t["loading-spinner"] }),
42
43
  d && /* @__PURE__ */ b("span", { className: t["btn-text"], children: d })
43
44
  ] });
44
45
  }
45
46
  export {
46
- D as default
47
+ h as default
47
48
  };
@@ -12,6 +12,7 @@ type CreatableProps = {
12
12
  helpLink?: string;
13
13
  helpLinkText?: string;
14
14
  disabled?: boolean;
15
+ caseSensitive?: boolean;
15
16
  errorMessage?: string;
16
17
  onChange?: (selectedValues: string[]) => void;
17
18
  } & DataAttributes & InteractiveEventHandlers;
@@ -31,10 +32,11 @@ type CreatableProps = {
31
32
  * @param {[string]} [props.helpLink] - Optional URL for help link displayed with helper text
32
33
  * @param {[string]} [props.helpLinkText] - Optional help link label to display when `helpLink` is provided
33
34
  * @param {[boolean]} [props.disabled] - Whether the field is disabled
35
+ * @param {[boolean]} [props.caseSensitive] - Whether to perform case-sensitive matching when checking for existing options in creatable mode (defaults to false)
34
36
  * @param {[string]} [props.errorMessage] - Optional error message displayed below the field
35
37
  * @param {(selectedValues: string[]) => void} [props.onChange] - Callback fired when selection changes
36
38
  * @param {DataAttributes} [props.data-*] - Additional `data-` attributes forwarded to the root element
37
39
  * @returns {JSX.Element} The rendered Creatable component
38
40
  */
39
- export default function Creatable({ className, label, required, multiSelect, value, helpText, helpLink, helpLinkText, disabled, errorMessage, onChange, onClick, onDoubleClick, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave, onMouseOver, onMouseOut, onMouseMove, onKeyDown, onKeyUp, onFocus, onBlur, ...props }: CreatableProps): import("react/jsx-runtime").JSX.Element;
41
+ export default function Creatable({ className, label, required, multiSelect, value, helpText, helpLink, helpLinkText, disabled, caseSensitive, errorMessage, onChange, onClick, onDoubleClick, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave, onMouseOver, onMouseOut, onMouseMove, onKeyDown, onKeyUp, onFocus, onBlur, ...props }: CreatableProps): import("react/jsx-runtime").JSX.Element;
40
42
  export {};
@@ -1,34 +1,35 @@
1
- import { jsx as v } from "react/jsx-runtime";
2
- import y from "../Dropdown/Dropdown.js";
3
- function B({
4
- className: r,
5
- label: e,
6
- required: t = !1,
7
- multiSelect: a = !1,
1
+ import { jsx as y } from "react/jsx-runtime";
2
+ import z from "../Dropdown/Dropdown.js";
3
+ function E({
4
+ className: e,
5
+ label: r,
6
+ required: a = !1,
7
+ multiSelect: t = !1,
8
8
  value: o,
9
9
  helpText: f,
10
10
  helpLink: l,
11
11
  helpLinkText: s,
12
12
  disabled: i,
13
- errorMessage: m,
14
- onChange: n,
15
- onClick: p,
16
- onDoubleClick: u,
17
- onMouseDown: b,
18
- onMouseUp: d,
19
- onMouseEnter: x,
20
- onMouseLeave: C,
21
- onMouseOver: c,
22
- onMouseOut: j,
23
- onMouseMove: w,
24
- onKeyDown: D,
25
- onKeyUp: g,
26
- onFocus: h,
27
- onBlur: k,
28
- ...q
13
+ caseSensitive: m = !1,
14
+ errorMessage: n,
15
+ onChange: p,
16
+ onClick: u,
17
+ onDoubleClick: b,
18
+ onMouseDown: d,
19
+ onMouseUp: x,
20
+ onMouseEnter: C,
21
+ onMouseLeave: c,
22
+ onMouseOver: j,
23
+ onMouseOut: w,
24
+ onMouseMove: D,
25
+ onKeyDown: g,
26
+ onKeyUp: h,
27
+ onFocus: k,
28
+ onBlur: q,
29
+ ...v
29
30
  }) {
30
- return /* @__PURE__ */ v(y, { className: r, label: e, required: t, isCreatable: !0, multiSelect: a, value: o, helpText: f, helpLink: l, helpLinkText: s, disabled: i, errorMessage: m, onChange: n, onClick: p, onDoubleClick: u, onMouseDown: b, onMouseUp: d, onMouseEnter: x, onMouseLeave: C, onMouseOver: c, onMouseOut: j, onMouseMove: w, onKeyDown: D, onKeyUp: g, onFocus: h, onBlur: k, ...q });
31
+ return /* @__PURE__ */ y(z, { className: e, label: r, required: a, isCreatable: !0, multiSelect: t, value: o, helpText: f, helpLink: l, helpLinkText: s, disabled: i, caseSensitive: m, errorMessage: n, onChange: p, onClick: u, onDoubleClick: b, onMouseDown: d, onMouseUp: x, onMouseEnter: C, onMouseLeave: c, onMouseOver: j, onMouseOut: w, onMouseMove: D, onKeyDown: g, onKeyUp: h, onFocus: k, onBlur: q, ...v });
31
32
  }
32
33
  export {
33
- B as default
34
+ E as default
34
35
  };
@@ -1,10 +1,12 @@
1
1
  import { DataAttributes } from '../../types/data-attributes';
2
+ import { ApIcon } from '../../assets/ap-icons-types';
2
3
  /**
3
4
  * Dialog component that displays modal content with customizable actions and optional illustration.
4
5
  * Provides a native HTML dialog element with backdrop support, confirmation/cancellation actions, and accessibility features.
5
6
  *
6
7
  * @param {object} props - Dialog component props
7
- * @param {React.ReactNode} props.children - The trigger element that opens the dialog when clicked
8
+ * @param {React.ReactNode} [props.children] - The trigger element that opens the dialog when clicked (optional when using isOpen prop)
9
+ * @param {boolean} [props.isOpen] - Controls whether the dialog is displayed. When provided, the dialog becomes controlled and children trigger is optional
8
10
  * @param {() => void} [props.onClose] - Callback fired when the dialog is closed (shows close button when provided)
9
11
  * @param {string} props.title - The title text displayed at the top of the dialog
10
12
  * @param {string} props.description - The description text displayed below the title
@@ -17,15 +19,24 @@ import { DataAttributes } from '../../types/data-attributes';
17
19
  */
18
20
  type DialogProps = {
19
21
  className?: string;
20
- children: React.ReactNode;
22
+ children?: React.ReactNode;
23
+ isOpen?: boolean;
21
24
  onClose?: () => void;
22
25
  title: string;
23
- description: string;
26
+ description: React.ReactNode;
24
27
  illustrationSrc?: string;
25
28
  confirmButtonText?: string;
26
29
  cancelButtonText?: string;
30
+ confirmButtonType?: 'primary' | 'secondary' | 'tertiary';
31
+ cancelButtonType?: 'primary' | 'secondary' | 'tertiary';
32
+ confirmButtonVariant?: 'default' | 'danger' | 'cancel';
33
+ cancelButtonVariant?: 'default' | 'danger' | 'cancel';
34
+ confirmButtonSize?: 'sm' | 'md';
35
+ cancelButtonSize?: 'sm' | 'md';
36
+ confirmButtonIcon?: ApIcon;
37
+ cancelButtonIcon?: ApIcon;
27
38
  onConfirm?: () => void;
28
39
  onCancel?: () => void;
29
40
  } & DataAttributes;
30
- export default function Dialog({ children, onClose, title, description, illustrationSrc, confirmButtonText, cancelButtonText, onConfirm, onCancel, className, ...props }: DialogProps): import("react/jsx-runtime").JSX.Element;
41
+ export default function Dialog({ children, isOpen, onClose, title, description, illustrationSrc, confirmButtonText, cancelButtonText, confirmButtonType, cancelButtonType, confirmButtonVariant, cancelButtonVariant, confirmButtonSize, cancelButtonSize, confirmButtonIcon, cancelButtonIcon, onConfirm, onCancel, className, ...props }: DialogProps): import("react/jsx-runtime").JSX.Element;
31
42
  export {};
@@ -1,57 +1,73 @@
1
- import { jsxs as e, jsx as i } from "react/jsx-runtime";
2
- import { useRef as _ } from "react";
3
- import r from "../Button/Button.js";
4
- import '../../assets/Dialog.css';const k = "Dialog-module__dialog___r4ljx", a = {
5
- dialog: k,
1
+ import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
+ import { useRef as h, useEffect as I } from "react";
3
+ import f from "../Button/Button.js";
4
+ import H from "../Icon/Icon.js";
5
+ import '../../assets/Dialog.css';const J = "Dialog-module__dialog___r4ljx", a = {
6
+ dialog: J,
6
7
  "dialog-illustration": "Dialog-module__dialog-illustration___IHiQl",
7
8
  "dialog-content": "Dialog-module__dialog-content___3hOGc",
8
- "dialog-close-button-container": "Dialog-module__dialog-close-button-container___35uPS",
9
9
  "dialog-title": "Dialog-module__dialog-title___KACAJ",
10
10
  "dialog-description": "Dialog-module__dialog-description___hL8fm",
11
- "dialog-buttons": "Dialog-module__dialog-buttons___x-v2M"
11
+ "dialog-buttons": "Dialog-module__dialog-buttons___x-v2M",
12
+ "dialog-close-button": "Dialog-module__dialog-close-button___-PzEz",
13
+ "dialog-close-button-icon": "Dialog-module__dialog-close-button-icon___BeGg2"
12
14
  };
13
- function R({
14
- children: u,
15
- onClose: o,
16
- title: m,
17
- description: h,
15
+ function q({
16
+ children: g,
17
+ isOpen: d,
18
+ onClose: l,
19
+ title: v,
20
+ description: b,
18
21
  illustrationSrc: s,
19
- confirmButtonText: n,
20
- cancelButtonText: g,
21
- onConfirm: d,
22
- onCancel: c,
23
- className: p,
24
- ...v
22
+ confirmButtonText: _,
23
+ cancelButtonText: u,
24
+ confirmButtonType: D = "primary",
25
+ cancelButtonType: p = "primary",
26
+ confirmButtonVariant: N = "default",
27
+ cancelButtonVariant: k = "cancel",
28
+ confirmButtonSize: y = "md",
29
+ cancelButtonSize: z = "md",
30
+ confirmButtonIcon: j,
31
+ cancelButtonIcon: x,
32
+ onConfirm: e,
33
+ onCancel: r,
34
+ className: M,
35
+ ...R
25
36
  }) {
26
- const D = _(null), t = _(null), f = () => {
27
- var l;
28
- (l = t.current) == null || l.showModal();
29
- }, N = () => {
30
- var l;
31
- (l = t.current) == null || l.close(), o == null || o();
32
- }, b = () => {
33
- var l;
34
- (l = t.current) == null || l.close(), d == null || d();
35
- }, y = () => {
36
- var l;
37
- (l = t.current) == null || l.close(), c == null || c();
37
+ const w = h(null), t = h(null);
38
+ I(() => {
39
+ var i, m;
40
+ d !== void 0 && (d ? (i = t.current) == null || i.showModal() : (m = t.current) == null || m.close());
41
+ }, [d]);
42
+ const A = () => {
43
+ var i;
44
+ (i = t.current) == null || i.showModal();
45
+ }, n = () => {
46
+ var i;
47
+ l == null || l(), d === void 0 && ((i = t.current) == null || i.close());
48
+ }, E = () => {
49
+ var i;
50
+ e == null || e(), d === void 0 && ((i = t.current) == null || i.close(), l == null || l());
51
+ }, G = () => {
52
+ var i;
53
+ r == null || r(), d === void 0 && ((i = t.current) == null || i.close(), l == null || l());
38
54
  };
39
- return /* @__PURE__ */ e("div", { className: p, ...v, children: [
40
- /* @__PURE__ */ i("div", { ref: D, onClick: f, children: u }),
41
- /* @__PURE__ */ e("dialog", { className: a.dialog, ref: t, onClose: o, children: [
42
- /* @__PURE__ */ i("div", { className: a["dialog-close-button-container"], children: o && /* @__PURE__ */ i(r, { className: a["dialog-close-button"], type: "tertiary", variant: "cancel", size: "md", onClick: N, icon: "ap-icon-close" }) }),
43
- s && /* @__PURE__ */ i("div", { className: a["dialog-illustration"], children: /* @__PURE__ */ i("img", { src: s, alt: "Dialog illustration" }) }),
44
- /* @__PURE__ */ e("div", { className: a["dialog-content"], children: [
45
- /* @__PURE__ */ i("h2", { className: a["dialog-title"], children: m }),
46
- /* @__PURE__ */ i("p", { className: a["dialog-description"], children: h })
55
+ return /* @__PURE__ */ c("div", { className: M, ...R, children: [
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" }) }),
59
+ s && /* @__PURE__ */ o("div", { className: a["dialog-illustration"], children: /* @__PURE__ */ o("img", { src: s, alt: "Dialog illustration" }) }),
60
+ /* @__PURE__ */ c("div", { className: a["dialog-content"], children: [
61
+ /* @__PURE__ */ o("h2", { className: a["dialog-title"], children: v }),
62
+ /* @__PURE__ */ o("div", { className: a["dialog-description"], children: b })
47
63
  ] }),
48
- /* @__PURE__ */ e("div", { className: a["dialog-buttons"], children: [
49
- g && /* @__PURE__ */ i(r, { type: "primary", variant: "cancel", size: "md", onClick: y, children: g }),
50
- n && /* @__PURE__ */ i(r, { type: "primary", variant: "default", size: "md", onClick: b, children: n })
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: _ })
51
67
  ] })
52
68
  ] })
53
69
  ] });
54
70
  }
55
71
  export {
56
- R as default
72
+ q as default
57
73
  };
@@ -13,7 +13,9 @@ type DragAndDropProps = {
13
13
  fileExtensionsAllowed: string[];
14
14
  maxSize: number;
15
15
  maxFiles?: number;
16
+ value?: File | File[];
16
17
  onUpload?: (files: UploadFile[]) => void;
18
+ onRemoveFile?: (fileName: string) => void;
17
19
  queueFiles?: boolean;
18
20
  } & DataAttributes & DraggableEventHandlers;
19
21
  /**
@@ -28,9 +30,10 @@ type DragAndDropProps = {
28
30
  * @param {string[]} props.fileExtensionsAllowed - Allowed file extensions (e.g. ['pdf','png'])
29
31
  * @param {number} props.maxSize - Maximum file size in MB
30
32
  * @param {number} [props.maxFiles] - Maximum number of files when type is 'multiple'
33
+ * @param {File | File[]} [props.value] - Controlled value for the component; accepts a single File or array of Files
31
34
  * @param {(files: UploadFile[]) => void} [props.onUpload] - Callback fired with validated files upon selection or drop
32
35
  * @param {boolean} [props.queueFiles] - When true, newly selected files are appended to the existing list
33
36
  * @returns {JSX.Element} The rendered DragAndDrop component
34
37
  */
35
- export default function DragAndDrop({ label, type, disabled, required, fileExtensionsAllowed, maxSize, maxFiles, onUpload, queueFiles, className, ...props }: DragAndDropProps): import("react/jsx-runtime").JSX.Element;
38
+ export default function DragAndDrop({ label, type, disabled, required, fileExtensionsAllowed, maxSize, maxFiles, value, onUpload, onRemoveFile, queueFiles, className, ...props }: DragAndDropProps): import("react/jsx-runtime").JSX.Element;
36
39
  export {};
@@ -1,16 +1,16 @@
1
- import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
- import { useId as S, useRef as B, useState as H } from "react";
3
- import F from "../Button/Button.js";
4
- import { c as Q } from "../../clsx-OuTLNxxd.js";
5
- import I from "../Icon/Icon.js";
6
- import '../../assets/DragAndDrop.css';const W = "DragAndDrop-module__disabled___h47do", G = "DragAndDrop-module__required___z3cHB", J = "DragAndDrop-module__active___ZMuEx", r = {
1
+ import { jsxs as l, jsx as n } from "react/jsx-runtime";
2
+ import { useId as J, useRef as w, useState as K, useCallback as M } from "react";
3
+ import j from "../Button/Button.js";
4
+ import { c as R } from "../../clsx-OuTLNxxd.js";
5
+ import q from "../Icon/Icon.js";
6
+ import '../../assets/DragAndDrop.css';const X = "DragAndDrop-module__disabled___h47do", U = "DragAndDrop-module__required___z3cHB", ee = "DragAndDrop-module__active___ZMuEx", a = {
7
7
  "drag-and-drop-container": "DragAndDrop-module__drag-and-drop-container___WHqGh",
8
- disabled: W,
9
- required: G,
8
+ disabled: X,
9
+ required: U,
10
10
  "drag-and-drop-space-text-message": "DragAndDrop-module__drag-and-drop-space-text-message___fL-Ac",
11
11
  "drag-and-drop-space-text-constraints": "DragAndDrop-module__drag-and-drop-space-text-constraints___YrL7J",
12
12
  "drag-and-drop-space": "DragAndDrop-module__drag-and-drop-space___09a0I",
13
- active: J,
13
+ active: ee,
14
14
  "drag-and-drop-space-text": "DragAndDrop-module__drag-and-drop-space-text___-8rqC",
15
15
  "drag-and-drop-files-list": "DragAndDrop-module__drag-and-drop-files-list___7WNCk",
16
16
  "drag-and-drop-files-list-item": "DragAndDrop-module__drag-and-drop-files-list-item___vQO6M",
@@ -22,91 +22,101 @@ import '../../assets/DragAndDrop.css';const W = "DragAndDrop-module__disabled___
22
22
  "drag-and-drop-files-list-item-name": "DragAndDrop-module__drag-and-drop-files-list-item-name___M7OAd",
23
23
  "drag-and-drop-files-list-item-size": "DragAndDrop-module__drag-and-drop-files-list-item-size___aaovj",
24
24
  "drag-and-drop-files-list-item-error": "DragAndDrop-module__drag-and-drop-files-list-item-error___yR0DY",
25
- "drag-and-drop-files-list-item-icon-error": "DragAndDrop-module__drag-and-drop-files-list-item-icon-error___17EE-"
25
+ "drag-and-drop-files-list-item-icon-error": "DragAndDrop-module__drag-and-drop-files-list-item-icon-error___17EE-",
26
+ "drag-and-drop-files-list-item-icon-delete": "DragAndDrop-module__drag-and-drop-files-list-item-icon-delete___Z1l-B"
26
27
  };
27
- function ee({
28
- label: A,
29
- type: m = "single",
30
- disabled: f,
31
- required: O,
28
+ function ne({
29
+ label: k,
30
+ type: c = "single",
31
+ disabled: z,
32
+ required: E,
32
33
  fileExtensionsAllowed: p,
33
- maxSize: _,
34
- maxFiles: u,
35
- onUpload: n,
36
- queueFiles: N,
37
- className: q,
38
- ...i
34
+ maxSize: g,
35
+ maxFiles: m = Number.POSITIVE_INFINITY,
36
+ value: f,
37
+ onUpload: t,
38
+ onRemoveFile: N,
39
+ queueFiles: D,
40
+ className: P,
41
+ ...s
39
42
  }) {
40
- const x = S(), y = B(null), g = B(null), [c, D] = H([]), z = p.join(", "), C = _ ? `up to ${_}MB` : "", w = p.map((e) => `.${e.replace(/^\./, "")}`).join(","), T = () => {
43
+ const B = J(), O = w(null), h = w(null), [A, x] = K([]), v = f !== void 0, C = p.join(", "), I = g ? `up to ${g}MB` : "", Y = p.map((e) => `.${e.replace(/^\./, "")}`).join(","), $ = () => {
41
44
  var e;
42
- f || (e = y.current) == null || e.click();
43
- }, L = (e) => {
44
- const d = _ ? _ * 1024 * 1024 : Number.POSITIVE_INFINITY, a = new Set(p.map((o) => o.toLowerCase().replace(/^\./, ""))), l = e.map((o) => {
45
- const v = o.size <= d, k = o.name.toLowerCase(), Y = k.includes(".") ? k.split(".").pop() ?? "" : "", $ = a.size === 0 || a.has(Y);
46
- let h;
47
- return v || (h = `File size is too large. Must be ${C}.`), $ || (h = `The file format is incorrect. Please make sure it is one of the extensions: ${z}.`), {
48
- file: o,
49
- error: h
45
+ u() || (e = O.current) == null || e.click();
46
+ }, y = M((e) => {
47
+ const i = g ? g * 1024 * 1024 : Number.POSITIVE_INFINITY, r = new Set(p.map((_) => _.toLowerCase().replace(/^\./, ""))), o = e.map((_) => {
48
+ const L = _.size <= i, T = _.name.toLowerCase(), F = T.includes(".") ? T.split(".").pop() ?? "" : "", G = r.size === 0 || r.has(F);
49
+ let b;
50
+ return L || (b = `File size is too large. Must be ${I}.`), G || (b = `The file format is incorrect. Please make sure it is one of the extensions: ${C}.`), {
51
+ file: _,
52
+ error: b
50
53
  };
51
54
  });
52
- return m === "single" ? l.slice(0, 1) : u && u > 0 ? l.slice(0, u) : l;
53
- }, M = (e) => {
55
+ return c === "single" ? o.slice(0, 1) : m && m > 0 ? o.slice(0, m) : o;
56
+ }, [g, p, I, C, c, m]), d = v ? (() => {
57
+ const e = Array.isArray(f) ? f : f ? [f] : [];
58
+ return y(e);
59
+ })() : A, S = (e) => (e / 1024).toFixed(2) + " KB", u = M(() => z || (d == null ? void 0 : d.length) >= m || c === "single" && (d == null ? void 0 : d.length) > 0, [z, d, m, c]), H = (e) => {
54
60
  if (!e.target.files) return;
55
- const d = Array.from(e.target.files), a = L(d);
56
- D((l) => N ? [...l, ...a] : a), n == null || n(a), e.target.value = "";
57
- }, j = (e) => {
58
- const d = c.filter((a) => a.file.name !== e);
59
- D(d), n == null || n(d);
60
- }, E = (e) => (e / 1024).toFixed(2) + " KB", R = (e) => {
61
- var d, a;
62
- e.preventDefault(), (d = g.current) == null || d.classList.add(r.active), (a = i.onDragOver) == null || a.call(i, e);
63
- }, b = (e) => {
64
- var d, a;
65
- e.preventDefault(), (d = g.current) == null || d.classList.remove(r.active), (a = i.onDragLeave) == null || a.call(i, e);
66
- }, P = (e) => {
67
- var l, o;
61
+ const i = Array.from(e.target.files), r = y(i);
62
+ v ? t == null || t(r) : (x((o) => D ? [...o, ...r] : r), D ? t == null || t([...A, ...r]) : t == null || t(r)), e.target.value = "";
63
+ }, Q = (e) => {
64
+ if (!v) {
65
+ const i = A.filter((r) => r.file.name !== e);
66
+ x(i);
67
+ }
68
+ N == null || N(e);
69
+ }, V = (e) => {
70
+ var i, r;
71
+ u() || (e.preventDefault(), (i = h.current) == null || i.classList.add(a.active), (r = s.onDragOver) == null || r.call(s, e));
72
+ }, W = (e) => {
73
+ var i, r;
74
+ e.preventDefault(), (i = h.current) == null || i.classList.remove(a.active), (r = s.onDragLeave) == null || r.call(s, e);
75
+ }, Z = (e) => {
76
+ var o, _;
77
+ if (u()) return;
68
78
  e.preventDefault();
69
- const d = Array.from(e.dataTransfer.files), a = L(d);
70
- D((v) => N ? [...v, ...a] : a), n == null || n(a), e.dataTransfer.clearData(), (l = g.current) == null || l.classList.remove(r.active), (o = i.onDrop) == null || o.call(i, e);
79
+ const i = Array.from(e.dataTransfer.files), r = y(i);
80
+ v ? t == null || t(r) : (x((L) => D ? [...L, ...r] : r), D ? t == null || t([...A, ...r]) : t == null || t(r)), e.dataTransfer.clearData(), (o = h.current) == null || o.classList.remove(a.active), (_ = s.onDrop) == null || _.call(s, e);
71
81
  };
72
- return /* @__PURE__ */ s("div", { className: Q(r["drag-and-drop-container"], f && r.disabled, q), ...i, children: [
73
- A && /* @__PURE__ */ s("label", { htmlFor: x, children: [
74
- A,
75
- O && /* @__PURE__ */ t("span", { "aria-hidden": "true", className: r.required, children: "*" })
82
+ return /* @__PURE__ */ l("div", { className: R(a["drag-and-drop-container"], u() && a.disabled, P), ...s, children: [
83
+ k && /* @__PURE__ */ l("label", { htmlFor: B, children: [
84
+ k,
85
+ E && /* @__PURE__ */ n("span", { "aria-hidden": "true", className: a.required, children: "*" })
76
86
  ] }),
77
- /* @__PURE__ */ s("div", { ref: g, className: r["drag-and-drop-space"], onDragOver: R, onDragLeave: b, onDrop: P, ...i, children: [
78
- /* @__PURE__ */ t(F, { type: "secondary", variant: "default", size: "sm", disabled: f, onClick: T, children: m === "single" ? "Browse file" : "Browse files" }),
79
- /* @__PURE__ */ t("input", { id: x, ref: y, type: "file", style: {
87
+ /* @__PURE__ */ l("div", { ref: h, className: a["drag-and-drop-space"], onDragOver: V, onDragLeave: W, onDrop: Z, ...s, children: [
88
+ /* @__PURE__ */ n(j, { type: "secondary", variant: "default", size: "sm", disabled: u(), onClick: $, children: c === "single" ? "Browse file" : "Browse files" }),
89
+ /* @__PURE__ */ n("input", { id: B, ref: O, type: "file", style: {
80
90
  display: "none"
81
- }, multiple: m === "multiple", accept: w, onChange: M }),
82
- /* @__PURE__ */ s("div", { className: r["drag-and-drop-space-text"], children: [
83
- /* @__PURE__ */ t("span", { className: r["drag-and-drop-space-text-message"], children: m === "single" ? "or drag your file" : "or drag multiple files" }),
84
- /* @__PURE__ */ s("span", { className: r["drag-and-drop-space-text-constraints"], children: [
91
+ }, multiple: c === "multiple", accept: Y, onChange: H }),
92
+ /* @__PURE__ */ l("div", { className: a["drag-and-drop-space-text"], children: [
93
+ /* @__PURE__ */ n("span", { className: a["drag-and-drop-space-text-message"], children: c === "single" ? "or drag your file" : "or drag multiple files" }),
94
+ /* @__PURE__ */ l("span", { className: a["drag-and-drop-space-text-constraints"], children: [
85
95
  " ",
86
- z,
96
+ C,
87
97
  " ",
88
- m === "single" ? "file" : "files",
98
+ c === "single" ? "file" : "files",
89
99
  " ",
90
- C
100
+ I
91
101
  ] })
92
102
  ] })
93
103
  ] }),
94
- (c == null ? void 0 : c.length) > 0 && /* @__PURE__ */ t("ul", { className: r["drag-and-drop-files-list"], children: c == null ? void 0 : c.map((e, d) => /* @__PURE__ */ t("li", { className: r["drag-and-drop-files-list-item"], children: /* @__PURE__ */ s("div", { className: r["drag-and-drop-files-list-item-content"], children: [
95
- /* @__PURE__ */ t("span", { className: r["drag-and-drop-files-list-item-icon-container"], children: /* @__PURE__ */ t(I, { icon: "ap-icon-document", className: r["drag-and-drop-files-list-item-icon"] }) }),
96
- /* @__PURE__ */ s("div", { className: r["drag-and-drop-files-list-item-content-data"], children: [
97
- /* @__PURE__ */ s("div", { className: r["drag-and-drop-files-list-item-text"], children: [
98
- /* @__PURE__ */ t("span", { className: r["drag-and-drop-files-list-item-name"], children: e.file.name }),
99
- /* @__PURE__ */ t("span", { className: r["drag-and-drop-files-list-item-size"], children: E(e.file.size) }),
100
- e.error && /* @__PURE__ */ s("span", { className: r["drag-and-drop-files-list-item-error"], children: [
101
- /* @__PURE__ */ t(I, { icon: "ap-icon-alert", className: r["drag-and-drop-files-list-item-icon-error"] }),
104
+ (d == null ? void 0 : d.length) > 0 && /* @__PURE__ */ n("ul", { className: a["drag-and-drop-files-list"], children: d == null ? void 0 : d.map((e, i) => /* @__PURE__ */ n("li", { className: a["drag-and-drop-files-list-item"], children: /* @__PURE__ */ l("div", { className: a["drag-and-drop-files-list-item-content"], children: [
105
+ /* @__PURE__ */ n("span", { className: a["drag-and-drop-files-list-item-icon-container"], children: /* @__PURE__ */ n(q, { icon: "ap-icon-document", className: a["drag-and-drop-files-list-item-icon"] }) }),
106
+ /* @__PURE__ */ l("div", { className: a["drag-and-drop-files-list-item-content-data"], children: [
107
+ /* @__PURE__ */ l("div", { className: a["drag-and-drop-files-list-item-text"], children: [
108
+ /* @__PURE__ */ n("span", { className: a["drag-and-drop-files-list-item-name"], children: e.file.name }),
109
+ /* @__PURE__ */ n("span", { className: a["drag-and-drop-files-list-item-size"], children: S(e.file.size) }),
110
+ e.error && /* @__PURE__ */ l("span", { className: a["drag-and-drop-files-list-item-error"], children: [
111
+ /* @__PURE__ */ n(q, { icon: "ap-icon-alert", className: a["drag-and-drop-files-list-item-icon-error"] }),
102
112
  e.error
103
113
  ] })
104
114
  ] }),
105
- /* @__PURE__ */ t(F, { type: "tertiary", variant: "default", size: "sm", onClick: () => j(e.file.name), icon: "ap-icon-delete" })
115
+ /* @__PURE__ */ n(j, { type: "tertiary", variant: "default", size: "sm", onClick: () => Q(e.file.name), icon: "ap-icon-delete", iconClassName: a["drag-and-drop-files-list-item-icon-delete"] })
106
116
  ] })
107
- ] }) }, d)) })
117
+ ] }) }, i)) })
108
118
  ] });
109
119
  }
110
120
  export {
111
- ee as default
121
+ ne as default
112
122
  };
@@ -35,6 +35,11 @@ type DropdownProps = {
35
35
  hideSelectedItems?: boolean;
36
36
  labelTooltip?: LabelTooltipProps;
37
37
  isTagsFields?: boolean;
38
+ unselect?: boolean;
39
+ selectedOptionLabel?: string;
40
+ selectedOptionsLabel?: string;
41
+ allOptionsSelectedLabel?: string;
42
+ caseSensitive?: boolean;
38
43
  } & DataAttributes & InteractiveEventHandlers;
39
44
  /**
40
45
  * A flexible dropdown component that supports single and multi-select functionality with search, categorization, and keyboard navigation.
@@ -64,7 +69,9 @@ type DropdownProps = {
64
69
  * @param {boolean} [props.hideSelectedItems] - Whether to hide the selected items in the dropdown trigger (defaults to false)
65
70
  * @param {LabelTooltipProps} [props.labelTooltip] - Tooltip to display next to the label
66
71
  * @param {boolean} [props.isTagsFields] - Whether to use creatable-style UI without creation functionality (defaults to false)
72
+ * @param {boolean} [props.unselect] - Whether single select dropdown allows deselection of selected items (defaults to false)
73
+ * @param {boolean} [props.caseSensitive] - Whether to perform case-sensitive matching when checking for existing options in creatable mode (defaults to false)
67
74
  * @returns {JSX.Element} The rendered Dropdown component
68
75
  */
69
- export default function Dropdown({ className, label, options, value, placeholder, disabled, required, searchable, searchPlaceholder, errorMessage, helpText, helpLink, helpLinkText, onChange, onSearch, multiSelect, grouped, align, onToggleChange, toggleLabel, isCreatable, dropdownTriggerClassName, dropdownMenuClassName, hideSelectedItems, labelTooltip, isTagsFields, ...props }: DropdownProps): import("react/jsx-runtime").JSX.Element;
76
+ export default function Dropdown({ className, label, options, value, placeholder, disabled, required, searchable, searchPlaceholder, errorMessage, helpText, helpLink, helpLinkText, onChange, onSearch, multiSelect, grouped, align, onToggleChange, toggleLabel, isCreatable, dropdownTriggerClassName, dropdownMenuClassName, hideSelectedItems, labelTooltip, isTagsFields, unselect, selectedOptionLabel, selectedOptionsLabel, allOptionsSelectedLabel, caseSensitive, ...props }: DropdownProps): import("react/jsx-runtime").JSX.Element;
70
77
  export {};