@iress-oss/ids-components 6.0.1 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/Autocomplete-BRGD9dSh.js +321 -0
  2. package/dist/Shadow-D2KoVwxD.js +57 -0
  3. package/dist/components/Autocomplete/Autocomplete.js +1 -1
  4. package/dist/components/Autocomplete/hooks/useAutocompleteSearch.js +1 -1
  5. package/dist/components/Autocomplete/index.js +2 -2
  6. package/dist/components/Field/Field.js +47 -47
  7. package/dist/components/Field/Field.styles.d.ts +1 -1
  8. package/dist/components/Field/Field.styles.js +6 -0
  9. package/dist/components/Field/components/FieldHint.js +27 -19
  10. package/dist/components/Field/index.d.ts +0 -2
  11. package/dist/components/Field/index.js +1 -3
  12. package/dist/components/{Field/FieldGroup → FieldGroup}/FieldGroup.js +9 -9
  13. package/dist/components/{Field/FieldGroup → FieldGroup}/FieldGroup.styles.d.ts +1 -1
  14. package/dist/components/{Field/FieldGroup → FieldGroup}/FieldGroup.styles.js +2 -2
  15. package/dist/components/FieldGroup/index.d.ts +2 -0
  16. package/dist/components/FieldGroup/index.js +3 -0
  17. package/dist/components/Input/Input.styles.d.ts +4 -4
  18. package/dist/components/Input/Input.styles.js +4 -4
  19. package/dist/components/Link/Link.styles.d.ts +1 -0
  20. package/dist/components/Link/Link.styles.js +4 -1
  21. package/dist/components/Menu/Menu.js +81 -77
  22. package/dist/components/Menu/Menu.styles.js +7 -0
  23. package/dist/components/Menu/MenuGroup/MenuGroup.d.ts +18 -3
  24. package/dist/components/Menu/MenuGroup/MenuGroup.js +38 -34
  25. package/dist/components/Menu/MenuHeading/MenuHeading.d.ts +20 -0
  26. package/dist/components/Menu/MenuHeading/MenuHeading.js +14 -0
  27. package/dist/components/Menu/MenuItem/MenuItem.styles.js +9 -0
  28. package/dist/components/Menu/MenuText/MenuText.d.ts +1 -5
  29. package/dist/components/Menu/MenuText/MenuText.js +11 -17
  30. package/dist/components/Menu/index.d.ts +1 -0
  31. package/dist/components/Menu/index.js +4 -3
  32. package/dist/components/Select/Select.js +1 -1
  33. package/dist/components/Select/SelectHeading/SelectHeading.js +5 -5
  34. package/dist/components/Select/SelectTags/SelectTags.js +15 -15
  35. package/dist/components/Select/components/SelectOptions.js +108 -95
  36. package/dist/components/Select/index.js +1 -1
  37. package/dist/components/Slideout/Slideout.styles.js +1 -0
  38. package/dist/components/TabSet/TabSet.d.ts +6 -1
  39. package/dist/components/TabSet/TabSet.js +34 -30
  40. package/dist/components/TabSet/TabSet.styles.d.ts +1 -1
  41. package/dist/components/TabSet/TabSet.styles.js +13 -1
  42. package/dist/components/Tag/Tag.styles.d.ts +14 -14
  43. package/dist/components/Tag/Tag.styles.js +16 -16
  44. package/dist/components/Tag/index.d.ts +0 -1
  45. package/dist/components/Tag/index.js +1 -2
  46. package/dist/components/{Tag/TagInput → TagInput}/TagInput.d.ts +1 -1
  47. package/dist/components/{Tag/TagInput → TagInput}/TagInput.js +7 -7
  48. package/dist/components/TagInput/TagInput.styles.d.ts +1 -0
  49. package/dist/components/{Tag/TagInput → TagInput}/TagInput.styles.js +2 -2
  50. package/dist/components/TagInput/index.d.ts +2 -0
  51. package/dist/components/TagInput/index.js +3 -0
  52. package/dist/components/Tooltip/Tooltip.d.ts +7 -2
  53. package/dist/components/Tooltip/Tooltip.js +48 -42
  54. package/dist/components/Tooltip/TooltipProvider.d.ts +27 -0
  55. package/dist/components/Tooltip/TooltipProvider.js +14 -0
  56. package/dist/components/Tooltip/hooks/useTooltipContainer.d.ts +17 -0
  57. package/dist/components/Tooltip/hooks/useTooltipContainer.js +5 -0
  58. package/dist/components/Tooltip/index.d.ts +4 -0
  59. package/dist/components/Tooltip/index.js +4 -2
  60. package/dist/components/ValidationMessage/ValidationMessage.js +2 -2
  61. package/dist/main.d.ts +2 -0
  62. package/dist/main.js +125 -121
  63. package/dist/patterns/DropdownMenu/DropdownMenu.js +113 -102
  64. package/dist/patterns/DropdownMenu/hooks/useDropdownMenuFlags.d.ts +1 -0
  65. package/dist/patterns/DropdownMenu/hooks/useDropdownMenuFlags.js +1 -0
  66. package/dist/patterns/Form/FormField/FormFieldset.d.ts +1 -1
  67. package/dist/patterns/Form/FormField/FormFieldset.js +1 -1
  68. package/dist/patterns/Form/FormValidationSummary/FormValidationSummary.js +1 -0
  69. package/dist/patterns/Form/components/LongForm.js +3 -1
  70. package/dist/patterns/Form/components/ShortForm.js +1 -0
  71. package/dist/patterns/Loading/Loading.styles.d.ts +3 -0
  72. package/dist/patterns/Loading/Loading.styles.js +4 -1
  73. package/dist/patterns/Loading/components/PageLoading.js +4 -4
  74. package/dist/patterns/Shadow/Shadow.js +1 -1
  75. package/dist/patterns/Shadow/index.js +1 -1
  76. package/dist/patterns/SideNav/SideNav.d.ts +6 -0
  77. package/dist/patterns/SideNav/SideNav.js +74 -68
  78. package/dist/patterns/SideNav/SideNav.styles.js +6 -2
  79. package/dist/style.css +1 -1
  80. package/dist/{useAutocompleteSearch-BJ_hhoKp.js → useAutocompleteSearch-DxKxs6HH.js} +29 -24
  81. package/package.json +1 -1
  82. package/dist/Autocomplete-CuUjmIAw.js +0 -308
  83. package/dist/Shadow-OHZiBoEb.js +0 -57
  84. package/dist/components/Tag/TagInput/TagInput.styles.d.ts +0 -1
  85. /package/dist/components/{Field/FieldGroup → FieldGroup}/FieldGroup.d.ts +0 -0
@@ -9,40 +9,44 @@ import { IressPopover as s } from "../../Popover/Popover.js";
9
9
  import { IressMenu as c, MenuContext as l } from "../Menu.js";
10
10
  import { menuGroup as u } from "./MenuGroup.styles.js";
11
11
  import { IressMenuDivider as d } from "../MenuDivider/MenuDivider.js";
12
- import { IressMenuHeading as f } from "../MenuText/MenuText.js";
13
- import { IressMenuItem as p } from "../MenuItem/MenuItem.js";
12
+ import { IressMenuItem as f } from "../MenuItem/MenuItem.js";
13
+ import { IressMenuHeading as p } from "../MenuHeading/MenuHeading.js";
14
14
  import { useContext as m } from "react";
15
15
  import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
16
16
  //#region src/components/Menu/MenuGroup/MenuGroup.tsx
17
- var v = ({ append: v, active: y, children: b, className: x, defaultActive: S, divider: C, label: w, onActiveChange: T, variant: E, "data-testid": D, ...O }) => {
18
- let k = a(O), A = m(l), j = o(), M = E ?? A?.variant;
19
- if (M && (j?.type === "listbox" || A?.role === "listbox")) throw Error("[IressMenuGroup] IressMenu with variants cannot be used within a Menu with role=\"listbox\" or Popover with type=\"listbox\", as it is not intended for that use case. Please unset the variant for grouping in listbox contexts.");
20
- let { value: N, setValue: P } = i({
17
+ var v = ({ append: v, active: y, children: b, className: x, defaultActive: S, divider: C, element: w, href: T, label: E, onActiveChange: D, onClick: O, variant: k, "data-testid": A, ...j }) => {
18
+ let M = a(j), N = m(l), P = o(), F = k ?? N?.variant;
19
+ if (F && (P?.type === "listbox" || N?.role === "listbox")) throw Error("[IressMenuGroup] IressMenu with variants cannot be used within a Menu with role=\"listbox\" or Popover with type=\"listbox\", as it is not intended for that use case. Please unset the variant for grouping in listbox contexts.");
20
+ let { value: I, setValue: L } = i({
21
21
  component: "IressMenuGroup",
22
22
  defaultValue: S,
23
- onChange: T,
23
+ onChange: D,
24
24
  value: y
25
25
  });
26
- if (M == "side") {
26
+ if (F == "side") {
27
27
  let n = u({
28
- numbered: A?.numbered,
29
- open: N
28
+ numbered: N?.numbered,
29
+ open: I
30
30
  });
31
31
  return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("div", {
32
32
  className: e(n.root, x),
33
- ...O,
34
- "data-testid": D,
35
- children: [/* @__PURE__ */ g(p, {
33
+ ...j,
34
+ "data-testid": A,
35
+ children: [/* @__PURE__ */ g(f, {
36
36
  className: e(n.activator, t.MenuGroupActivator),
37
- "data-testid": r(D, "activator"),
38
- onClick: () => P(!N),
39
- "aria-expanded": N,
40
- id: k,
41
- "aria-controls": `${k}-content`,
42
- children: w
37
+ "data-testid": r(A, "activator"),
38
+ href: T,
39
+ element: w,
40
+ onClick: (e) => {
41
+ L(!I), O?.(e);
42
+ },
43
+ "aria-expanded": I,
44
+ id: M,
45
+ "aria-controls": `${M}-content`,
46
+ children: E
43
47
  }), /* @__PURE__ */ g("div", {
44
48
  className: e(n.wrapper, t.MenuGroup),
45
- id: `${k}-content`,
49
+ id: `${M}-content`,
46
50
  children: /* @__PURE__ */ g("div", {
47
51
  className: n.content,
48
52
  children: b
@@ -50,34 +54,34 @@ var v = ({ append: v, active: y, children: b, className: x, defaultActive: S, di
50
54
  })]
51
55
  }), C && /* @__PURE__ */ g(d, {})] });
52
56
  }
53
- return M == "subdraw" ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(s, {
57
+ return F == "subdraw" ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(s, {
54
58
  align: "right-start",
55
59
  nested: !0,
56
60
  offset: {
57
61
  mainAxis: 0,
58
62
  crossAxis: 0
59
63
  },
60
- type: A?.role === "list" ? void 0 : A?.role,
61
- virtualFocus: j?.isVirtualFocus,
64
+ type: N?.role === "list" ? void 0 : N?.role,
65
+ virtualFocus: P?.isVirtualFocus,
62
66
  contentStyle: { p: "none" },
63
- ...O,
67
+ ...j,
64
68
  className: e(t.MenuGroup, x),
65
- "data-testid": r(D, "subdraw"),
66
- activator: /* @__PURE__ */ g(p, {
69
+ "data-testid": r(A, "subdraw"),
70
+ activator: /* @__PURE__ */ g(f, {
67
71
  append: v ?? /* @__PURE__ */ g(n, { name: "keyboard_arrow_right" }),
68
72
  className: t.MenuGroupActivator,
69
- "data-testid": r(D, "subdraw__trigger"),
70
- children: w
73
+ "data-testid": r(A, "subdraw__trigger"),
74
+ children: E
71
75
  }),
72
76
  children: /* @__PURE__ */ g(c, { children: b })
73
77
  }), C && /* @__PURE__ */ g(d, {})] }) : /* @__PURE__ */ _(h, { children: [
74
- /* @__PURE__ */ g(f, {
75
- "data-testid": D,
76
- ...O,
78
+ /* @__PURE__ */ g(p, {
79
+ "data-testid": A,
80
+ ...j,
77
81
  className: e(t.MenuGroup, x),
78
- srOnly: M == "rail" ? !0 : void 0,
79
- width: M == "rail" ? "auto" : void 0,
80
- children: w
82
+ srOnly: F == "rail" ? !0 : void 0,
83
+ width: F == "rail" ? "auto" : void 0,
84
+ children: E
81
85
  }),
82
86
  b,
83
87
  C && /* @__PURE__ */ g(d, {})
@@ -0,0 +1,20 @@
1
+ import { TextElements } from '../../Text';
2
+ import { IressMenuTextProps } from '../MenuText/MenuText';
3
+ export type { IressMenuTextProps as IressMenuHeadingProps } from '../MenuText/MenuText';
4
+ /**
5
+ * A heading element within a menu, used to label groups of menu items.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * import { IressMenu, IressMenuHeading, IressMenuItem } from '@iress-oss/ids-components';
10
+ *
11
+ * <IressMenu>
12
+ * <IressMenuHeading>Actions</IressMenuHeading>
13
+ * <IressMenuItem>Edit</IressMenuItem>
14
+ * </IressMenu>
15
+ * ```
16
+ */
17
+ export declare const IressMenuHeading: {
18
+ <E extends TextElements = "h2">({ className, element, textStyle, ...restProps }: IressMenuTextProps<E>): import("react/jsx-runtime").JSX.Element;
19
+ displayName: string;
20
+ };
@@ -0,0 +1,14 @@
1
+ import { t as e } from "../../../cx-CZ8IJJTy.js";
2
+ import { GlobalCSSClass as t } from "../../../enums.js";
3
+ import { IressMenuText as n } from "../MenuText/MenuText.js";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ //#region src/components/Menu/MenuHeading/MenuHeading.tsx
6
+ var i = ({ className: i, element: a = "h2", textStyle: o = "typography.body.md.medium", ...s }) => /* @__PURE__ */ r(n, {
7
+ element: a,
8
+ textStyle: o,
9
+ ...s,
10
+ className: e(i, t.MenuHeading)
11
+ });
12
+ i.displayName = "IressMenuHeading";
13
+ //#endregion
14
+ export { i as IressMenuHeading };
@@ -194,6 +194,15 @@ var t = e({
194
194
  "option"
195
195
  ],
196
196
  css: { root: { focusable: "colour.primary.onFill" } }
197
+ },
198
+ {
199
+ variant: "side",
200
+ selected: !0,
201
+ css: { root: {
202
+ bg: "colour.neutral.20",
203
+ color: "colour.primary.text",
204
+ _after: { width: "menu.indicator" }
205
+ } }
197
206
  }
198
207
  ],
199
208
  defaultVariants: { layout: "stack" }
@@ -16,10 +16,6 @@ export type IressMenuTextProps<E extends TextElements = 'div'> = IressTextProps<
16
16
  prepend?: ReactNode;
17
17
  };
18
18
  export declare const IressMenuText: {
19
- <E extends TextElements = "div">({ append, children, className, "data-testid": dataTestid, divider, element, prepend, role, textStyle, ...restProps }: IressMenuTextProps<E>): import("react/jsx-runtime").JSX.Element;
20
- displayName: string;
21
- };
22
- export declare const IressMenuHeading: {
23
- <E extends TextElements = "h2">({ className, element, textStyle, ...restProps }: IressMenuTextProps<E>): import("react/jsx-runtime").JSX.Element;
19
+ <E extends TextElements = "div">({ append, children, className, "data-testid": dataTestid, divider, element, prepend, role, textStyle, width, ...restProps }: IressMenuTextProps<E>): import("react/jsx-runtime").JSX.Element;
24
20
  displayName: string;
25
21
  };
@@ -23,39 +23,33 @@ var p = (e, t) => (e && [
23
23
  "typography.heading.3",
24
24
  "typography.heading.4",
25
25
  "typography.heading.5"
26
- ].includes(t)), m = ({ append: m, children: h, className: g, "data-testid": _, divider: v, element: y, prepend: b, role: x, textStyle: S, ...C }) => {
27
- let w = l(a), T = c() ?? x, E = o.raw({
28
- layout: w?.layout,
26
+ ].includes(t)), m = ({ append: m, children: h, className: g, "data-testid": _, divider: v, element: y, prepend: b, role: x, textStyle: S, width: C = "12/12", ...w }) => {
27
+ let T = l(a), E = c() ?? x, D = o.raw({
28
+ layout: T?.layout,
29
29
  isHeading: p(y, S),
30
30
  hasAppendOrPrepend: !!(m ?? b)
31
- }), [D, O] = n(C);
31
+ }), [O, k] = n(w);
32
32
  return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("div", {
33
- className: t(g, e(E.root, D), r.MenuText),
33
+ className: t(g, e(D.root, O, { width: C }), r.MenuText),
34
34
  "data-testid": _,
35
- role: T,
35
+ role: E,
36
36
  children: [
37
37
  b && /* @__PURE__ */ d("div", { children: b }),
38
38
  /* @__PURE__ */ d(i, {
39
- ...O,
40
- className: e(E.contents),
39
+ ...k,
40
+ className: e(D.contents),
41
41
  element: y,
42
42
  textStyle: S,
43
+ width: C,
43
44
  children: h
44
45
  }),
45
46
  m && /* @__PURE__ */ d("div", {
46
- className: e(E.append),
47
+ className: e(D.append),
47
48
  children: m
48
49
  })
49
50
  ]
50
51
  }), v && /* @__PURE__ */ d(s, { mt: "spacing.1" })] });
51
52
  };
52
53
  m.displayName = "IressMenuText";
53
- var h = ({ className: e, element: n = "h2", textStyle: i = "typography.body.md.medium", ...a }) => /* @__PURE__ */ d(m, {
54
- element: n,
55
- textStyle: i,
56
- ...a,
57
- className: t(e, r.MenuHeading)
58
- });
59
- h.displayName = "IressMenuHeading";
60
54
  //#endregion
61
- export { h as IressMenuHeading, m as IressMenuText };
55
+ export { m as IressMenuText };
@@ -7,3 +7,4 @@ export * from './MenuDivider/MenuDivider';
7
7
  export * from './MenuGroup/MenuGroup';
8
8
  export * from './MenuItem/MenuItem';
9
9
  export * from './MenuText/MenuText';
10
+ export * from './MenuHeading/MenuHeading';
@@ -3,7 +3,8 @@ import { IressMenu as t } from "./Menu.js";
3
3
  import { menuItem as n } from "./MenuItem/MenuItem.styles.js";
4
4
  import { menuGroup as r } from "./MenuGroup/MenuGroup.styles.js";
5
5
  import { IressMenuDivider as i } from "./MenuDivider/MenuDivider.js";
6
- import { IressMenuHeading as a, IressMenuText as o } from "./MenuText/MenuText.js";
7
- import { IressMenuItem as s } from "./MenuItem/MenuItem.js";
6
+ import { IressMenuItem as a } from "./MenuItem/MenuItem.js";
7
+ import { IressMenuText as o } from "./MenuText/MenuText.js";
8
+ import { IressMenuHeading as s } from "./MenuHeading/MenuHeading.js";
8
9
  import { IressMenuGroup as c } from "./MenuGroup/MenuGroup.js";
9
- export { t as IressMenu, i as IressMenuDivider, c as IressMenuGroup, a as IressMenuHeading, s as IressMenuItem, o as IressMenuText, e as menu, r as menuGroup, n as menuItem };
10
+ export { t as IressMenu, i as IressMenuDivider, c as IressMenuGroup, s as IressMenuHeading, a as IressMenuItem, o as IressMenuText, e as menu, r as menuGroup, n as menuItem };
@@ -1,2 +1,2 @@
1
- import { n as e } from "../../Autocomplete-CuUjmIAw.js";
1
+ import { n as e } from "../../Autocomplete-BRGD9dSh.js";
2
2
  export { e as IressSelect };
@@ -3,8 +3,8 @@ import { GlobalCSSClass as t } from "../../../enums.js";
3
3
  import { t as n } from "../../../Button-bZPKq0ue.js";
4
4
  import { usePopoverItem as r } from "../../Popover/hooks/usePopoverItem.js";
5
5
  import { select as i } from "../Select.styles.js";
6
- import { IressInline as a } from "../../Inline/Inline.js";
7
- import { IressMenuHeading as o } from "../../Menu/MenuText/MenuText.js";
6
+ import { IressMenuHeading as a } from "../../Menu/MenuHeading/MenuHeading.js";
7
+ import { IressInline as o } from "../../Inline/Inline.js";
8
8
  import { forwardRef as s, useImperativeHandle as c, useRef as l } from "react";
9
9
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
10
10
  //#region src/components/Select/SelectHeading/SelectHeading.tsx
@@ -15,17 +15,17 @@ var f = i(), p = s((i, a) => {
15
15
  ...d,
16
16
  className: e(f.dropdownClear, t.SelectClearButton),
17
17
  active: s,
18
- mode: "tertiary",
18
+ mode: "quaternary",
19
19
  ref: (e) => {
20
20
  o.current = e, d?.ref?.(o.current);
21
21
  }
22
22
  });
23
- }), m = ({ children: n, className: r, clearAll: i, onClearAll: s, textStyle: c = "typography.heading.4", ...l }) => /* @__PURE__ */ u(o, {
23
+ }), m = ({ children: n, className: r, clearAll: i, onClearAll: s, textStyle: c = "typography.body.md.medium", ...l }) => /* @__PURE__ */ u(a, {
24
24
  ...l,
25
25
  className: e(f.dropdownSelectedHeading, r, t.SelectHeading),
26
26
  role: void 0,
27
27
  textStyle: c,
28
- children: /* @__PURE__ */ d(a, {
28
+ children: /* @__PURE__ */ d(o, {
29
29
  horizontalAlign: "between",
30
30
  verticalAlign: "middle",
31
31
  children: [n, i && /* @__PURE__ */ u(p, {
@@ -12,9 +12,9 @@ import { getFormControlValueAsStringIfDefined as u } from "../../../helpers/form
12
12
  import { composeLabelValueDescriptor as d } from "../../../helpers/label-value/composeLabelValueDescriptor.js";
13
13
  import { selectTags as f } from "./SelectTags.styles.js";
14
14
  import { IressTag as p } from "../../Tag/Tag.js";
15
- import { IressInline as m } from "../../Inline/Inline.js";
16
- import { IressMenu as h } from "../../Menu/Menu.js";
17
- import { IressMenuItem as g } from "../../Menu/MenuItem/MenuItem.js";
15
+ import { IressMenu as m } from "../../Menu/Menu.js";
16
+ import { IressMenuItem as h } from "../../Menu/MenuItem/MenuItem.js";
17
+ import { IressInline as g } from "../../Inline/Inline.js";
18
18
  import { useCallback as _, useMemo as v, useState as y } from "react";
19
19
  import { jsx as b, jsxs as x } from "react/jsx-runtime";
20
20
  //#region src/components/Select/SelectTags/SelectTags.tsx
@@ -26,17 +26,17 @@ var S = (e, t) => {
26
26
  let e = r.indexOf(t.currentTarget), i = r.filter((e) => e !== t.currentTarget), a = Math.max(e - 1, 0);
27
27
  !i[a] && i[0] ? i[0].focus() : i[0] ? i[a].focus() : n?.focus();
28
28
  }
29
- }, C = ({ "data-testid": e, limit: t = 5, onDelete: i, onDeleteAll: o, onToggleActions: s, selectedArray: m, selectedOptionsText: v }) => {
29
+ }, C = ({ "data-testid": e, limit: t = 5, onDelete: i, onDeleteAll: o, onToggleActions: s, selectedArray: g, selectedOptionsText: v }) => {
30
30
  let [C, w] = y(!1), T = c(), E = f(), D = _((e, t) => {
31
- i?.(m.find((t) => t.label === e), t), t.stopPropagation(), S(T, t);
31
+ i?.(g.find((t) => t.label === e), t), t.stopPropagation(), S(T, t);
32
32
  }, [
33
33
  i,
34
34
  T,
35
- m
35
+ g
36
36
  ]), O = _((e) => {
37
37
  o?.(e), T?.getFocusableActivator()?.focus();
38
38
  }, [o, T]);
39
- return C && m.length || !t || m.length <= t ? m.map((t) => /* @__PURE__ */ b(p, {
39
+ return C && g.length || !t || g.length <= t ? g.map((t) => /* @__PURE__ */ b(p, {
40
40
  className: E.tag,
41
41
  "data-testid": a(e, "tag"),
42
42
  deleteButtonText: `Delete ${t.label}`,
@@ -63,34 +63,34 @@ var S = (e, t) => {
63
63
  align: "bottom-end",
64
64
  contentStyle: { p: "none" },
65
65
  virtualFocus: !0,
66
- children: /* @__PURE__ */ x(h, { children: [/* @__PURE__ */ b(g, {
66
+ children: /* @__PURE__ */ x(m, { children: [/* @__PURE__ */ b(h, {
67
67
  onClick: () => w(!0),
68
68
  children: "Expand all"
69
- }), /* @__PURE__ */ b(g, {
69
+ }), /* @__PURE__ */ b(h, {
70
70
  onClick: O,
71
71
  children: "Delete all"
72
72
  })] })
73
73
  }),
74
74
  compact: !0,
75
- children: d(m, v)
75
+ children: d(g, v)
76
76
  });
77
- }, w = ({ append: n = "", className: r, "data-testid": a, id: s, limit: c = 5, onDelete: l, onDeleteAll: u, onToggleActions: d, placeholder: p, prepend: h, selected: g, selectedOptionsText: _ = "{{numOptions}} selected", ...y }) => {
78
- let S = v(() => o(g), [g]), w = !S.length && p, T = !!S.length, E = f({ showDefaultChevron: n == null || n === "" || !n });
77
+ }, w = ({ append: n = "", className: r, "data-testid": a, id: s, limit: c = 5, onDelete: l, onDeleteAll: u, onToggleActions: d, placeholder: p, prepend: m, selected: h, selectedOptionsText: _ = "{{numOptions}} selected", ...y }) => {
78
+ let S = v(() => o(h), [h]), w = !S.length && p, T = !!S.length, E = f({ showDefaultChevron: n == null || n === "" || !n });
79
79
  return /* @__PURE__ */ x(i, {
80
80
  ...y,
81
81
  id: s,
82
82
  tabIndex: 0,
83
83
  className: e(r, E.root, t.FormElementInner, t.SelectTags),
84
84
  children: [
85
- h && /* @__PURE__ */ b("span", {
85
+ m && /* @__PURE__ */ b("span", {
86
86
  className: E.prepend,
87
- children: h
87
+ children: m
88
88
  }),
89
89
  w && /* @__PURE__ */ b(i, {
90
90
  className: E.placeholder,
91
91
  children: p
92
92
  }),
93
- T && /* @__PURE__ */ b(m, {
93
+ T && /* @__PURE__ */ b(g, {
94
94
  gap: "sm",
95
95
  className: E.tagsList,
96
96
  children: /* @__PURE__ */ b(C, {
@@ -1,149 +1,162 @@
1
- import { toArray as e } from "../../../helpers/formatting/toArray.js";
2
- import { IressAlert as t } from "../../Alert/Alert.js";
3
- import { getValueAsEvent as n } from "../../../helpers/form/getValueAsEvent.js";
4
- import { IressMenuDivider as r } from "../../Menu/MenuDivider/MenuDivider.js";
5
- import { toPrimitiveValue as i } from "../helpers/toPrimitiveValue.js";
6
- import { IressSelectSearch as a } from "../SelectSearch/SelectSearch.js";
7
- import { IressSelectHeading as o } from "../SelectHeading/SelectHeading.js";
8
- import { IressSelectMenu as s } from "../SelectMenu/SelectMenu.js";
9
- import { IressSelectSearchInput as c } from "../SelectSearchInput/SelectSearchInput.js";
10
- import { useCallback as l, useEffect as u, useId as d, useRef as f } from "react";
11
- import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
1
+ import { IressText as e } from "../../Text/Text.js";
2
+ import { IressSpinner as t } from "../../Spinner/Spinner.js";
3
+ import { toArray as n } from "../../../helpers/formatting/toArray.js";
4
+ import { IressAlert as r } from "../../Alert/Alert.js";
5
+ import { getValueAsEvent as i } from "../../../helpers/form/getValueAsEvent.js";
6
+ import { IressMenuDivider as a } from "../../Menu/MenuDivider/MenuDivider.js";
7
+ import { IressInline as o } from "../../Inline/Inline.js";
8
+ import { toPrimitiveValue as s } from "../helpers/toPrimitiveValue.js";
9
+ import { IressSelectSearch as c } from "../SelectSearch/SelectSearch.js";
10
+ import { IressSelectHeading as l } from "../SelectHeading/SelectHeading.js";
11
+ import { IressSelectMenu as u } from "../SelectMenu/SelectMenu.js";
12
+ import { IressSelectSearchInput as d } from "../SelectSearchInput/SelectSearchInput.js";
13
+ import { useCallback as f, useEffect as p, useId as m, useRef as h } from "react";
14
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
12
15
  //#region src/components/Select/components/SelectOptions.tsx
13
- var g = ({ minSearchLength: e, multiSelect: t, onChange: n, query: r, results: i, shouldShowInstructions: a, shouldShowNoResults: o, value: c }) => /* @__PURE__ */ m(s, {
14
- heading: t ? "Search results" : void 0,
15
- items: i,
16
- multiSelect: t,
16
+ var y = ({ debouncedQuery: e, minSearchLength: t, multiSelect: n, onChange: r, query: i, results: a, shouldShowInstructions: o, shouldShowNoResults: s, value: c }) => /* @__PURE__ */ _(u, {
17
+ heading: n && a.length && e ? `Search results (${a.length})` : void 0,
18
+ items: a,
19
+ multiSelect: n,
17
20
  noResults: (() => {
18
- if (r) {
19
- if (a) return `Type at least ${e} character${e === 1 ? "" : "s"} to search`;
20
- if (o) return "No results found";
21
+ if (i) {
22
+ if (o) return `Type at least ${t} character${t === 1 ? "" : "s"} to search`;
23
+ if (s) return "No results found";
21
24
  }
22
25
  })(),
23
- onChange: n,
26
+ onChange: r,
24
27
  selected: c,
25
- hideSelectedItems: t
28
+ hideSelectedItems: n
26
29
  });
27
- g.displayName = "SelectAsyncResults";
28
- var _ = ({ error: e }) => e ? /* @__PURE__ */ m(t, {
30
+ y.displayName = "SelectAsyncResults";
31
+ var b = ({ error: e }) => e ? /* @__PURE__ */ _(r, {
29
32
  status: "danger",
30
- children: typeof e == "string" ? e : /* @__PURE__ */ h(p, { children: [
33
+ children: typeof e == "string" ? e : /* @__PURE__ */ v(g, { children: [
31
34
  "An unknown error occurred.",
32
- /* @__PURE__ */ m("br", {}),
35
+ /* @__PURE__ */ _("br", {}),
33
36
  " Please contact support if the error persists."
34
37
  ] })
35
38
  }) : null;
36
- _.displayName = "SelectAsyncError";
37
- var v = ({ autoHighlight: t, error: n, loading: i, minSearchLength: l, multiSelect: p, onChange: v, onClear: y, query: b, results: x, setQuery: S, show: C, value: w, shouldShowInstructions: T, shouldShowNoResults: E }) => {
38
- let D = e(w).map((e) => {
39
+ b.displayName = "SelectAsyncError";
40
+ var x = ({ autoHighlight: r, debouncedQuery: i, error: s, loading: f, minSearchLength: g, multiSelect: x, onChange: S, onClear: C, query: w, results: T, setQuery: E, show: D, value: O, shouldShowInstructions: k, shouldShowNoResults: A }) => {
41
+ let j = n(O).map((e) => {
39
42
  let { formattedLabel: t, ...n } = e;
40
43
  return n;
41
- }), O = !n && (!!x?.length || b && !i), k = !!D.length && p, A = O && k, j = f(null), M = d();
42
- u(() => {
43
- C || S?.("");
44
- }, [C, S]);
45
- let N = k ? D.length + 1 : 0;
46
- return /* @__PURE__ */ h(a, {
47
- activator: /* @__PURE__ */ m(c, {
44
+ }), M = !s && (!!T?.length || w && !f), N = !!j.length && x, P = M && N, F = h(null), I = m();
45
+ p(() => {
46
+ D || E?.("");
47
+ }, [D, E]);
48
+ let L = N ? j.length + 1 : 0;
49
+ return /* @__PURE__ */ v(c, {
50
+ activator: /* @__PURE__ */ _(d, {
48
51
  "aria-label": "Search",
49
- loading: i,
50
- onChange: (e) => S?.(e.target.value),
51
- ref: j,
52
+ onChange: (e) => E?.(e.target.value),
53
+ ref: F,
52
54
  placeholder: "Search and select",
53
- value: b
55
+ value: w
54
56
  }),
55
- autoHighlight: t,
56
- focusStartIndex: t ? b && O ? N : +!!k : void 0,
57
+ autoHighlight: r,
58
+ focusStartIndex: r ? w && M ? L : +!!N : void 0,
57
59
  children: [
58
- k && /* @__PURE__ */ m(s, {
59
- "aria-labelledby": M,
60
- heading: /* @__PURE__ */ m(o, {
60
+ N && /* @__PURE__ */ _(u, {
61
+ "aria-labelledby": I,
62
+ heading: /* @__PURE__ */ _(l, {
61
63
  clearAll: !0,
62
64
  onClearAll: (e) => {
63
- y?.(e), j.current?.focus();
65
+ C?.(e), F.current?.focus();
64
66
  },
65
- children: /* @__PURE__ */ h("h2", {
66
- id: M,
67
+ children: /* @__PURE__ */ v("span", {
68
+ id: I,
67
69
  children: [
68
70
  "Selected (",
69
- D.length,
71
+ j.length,
70
72
  ")"
71
73
  ]
72
74
  })
73
75
  }),
74
- items: D,
75
- multiSelect: p,
76
- onChange: v,
77
- selected: w
76
+ items: j,
77
+ multiSelect: x,
78
+ onChange: S,
79
+ selected: O
78
80
  }),
79
- A && /* @__PURE__ */ m(r, {}),
80
- O && /* @__PURE__ */ m(g, {
81
- minSearchLength: l,
82
- multiSelect: p,
83
- onChange: v,
84
- query: b,
85
- results: x,
86
- value: w,
87
- shouldShowInstructions: T,
88
- shouldShowNoResults: E
81
+ P && /* @__PURE__ */ _(a, {}),
82
+ f && !T.length && /* @__PURE__ */ v(o, {
83
+ gap: "sm",
84
+ verticalAlign: "middle",
85
+ p: "spacing.3",
86
+ children: [/* @__PURE__ */ _(t, { color: "colour.neutral.70" }), /* @__PURE__ */ _(e, {
87
+ color: "colour.neutral.70",
88
+ children: "Loading results..."
89
+ })]
89
90
  }),
90
- /* @__PURE__ */ m(_, { error: n })
91
+ M && /* @__PURE__ */ _(y, {
92
+ debouncedQuery: i,
93
+ minSearchLength: g,
94
+ multiSelect: x,
95
+ onChange: S,
96
+ query: w,
97
+ results: T,
98
+ value: O,
99
+ shouldShowInstructions: k,
100
+ shouldShowNoResults: A
101
+ }),
102
+ /* @__PURE__ */ _(b, { error: s })
91
103
  ]
92
104
  });
93
105
  };
94
- v.displayName = "SelectAsyncOptions";
95
- var y = ({ autoHighlight: e, debouncedQuery: t, error: r, initialOptions: a, loading: o, minSearchLength: c, multiSelect: u, onChange: d, options: f, query: p, renderOptions: h, results: g, setQuery: _, setShow: y, setValue: b, show: x, shouldShowInstructions: S, shouldShowNoResults: C, value: w }) => {
96
- let T = typeof f == "function", E = a ?? (T ? [] : f), D = g.length ? g : E, O = l((e) => {
97
- b(e);
98
- let t = i(e);
99
- d?.(n(t), t, e), u || y(!1);
106
+ x.displayName = "SelectAsyncOptions";
107
+ var S = ({ autoHighlight: e, debouncedQuery: t, error: n, initialOptions: r, loading: a, minSearchLength: o, multiSelect: c, onChange: l, options: d, query: p, renderOptions: m, results: h, setQuery: g, setShow: v, setValue: y, show: b, shouldShowInstructions: S, shouldShowNoResults: C, value: w }) => {
108
+ let T = typeof d == "function", E = r ?? (T ? [] : d), D = h.length ? h : E, O = f((e) => {
109
+ y(e);
110
+ let t = s(e);
111
+ l?.(i(t), t, e), c || v(!1);
100
112
  }, [
113
+ v,
101
114
  y,
102
- b,
103
- d,
104
- u
105
- ]), k = l((e) => {
115
+ l,
116
+ c
117
+ ]), k = f((e) => {
106
118
  e.stopPropagation();
107
119
  let t = [];
108
- b(t);
109
- let r = i(t);
110
- d?.(n(r), r, t);
111
- }, [b, d]);
112
- return h ? h({
113
- close: () => y(!1),
120
+ y(t);
121
+ let n = s(t);
122
+ l?.(i(n), n, t);
123
+ }, [y, l]);
124
+ return m ? m({
125
+ close: () => v(!1),
114
126
  debouncedQuery: t,
115
- error: r,
127
+ error: n,
116
128
  handleClear: k,
117
129
  handleMenuChange: O,
118
- loading: o,
130
+ loading: a,
119
131
  query: p,
120
132
  results: D,
121
- setValue: b,
122
- setQuery: _,
123
- show: x,
133
+ setValue: y,
134
+ setQuery: g,
135
+ show: b,
124
136
  value: w
125
- }) : T ? /* @__PURE__ */ m(v, {
137
+ }) : T ? /* @__PURE__ */ _(x, {
126
138
  autoHighlight: e,
127
- error: r,
128
- loading: o,
129
- minSearchLength: c,
130
- multiSelect: u,
139
+ debouncedQuery: t,
140
+ error: n,
141
+ loading: a,
142
+ minSearchLength: o,
143
+ multiSelect: c,
131
144
  onChange: O,
132
145
  onClear: k,
133
146
  query: p,
134
- results: g,
135
- setQuery: _,
136
- show: x,
147
+ results: h,
148
+ setQuery: g,
149
+ show: b,
137
150
  value: w,
138
151
  shouldShowInstructions: S,
139
152
  shouldShowNoResults: C
140
- }) : /* @__PURE__ */ m(s, {
153
+ }) : /* @__PURE__ */ _(u, {
141
154
  items: D,
142
- multiSelect: u,
155
+ multiSelect: c,
143
156
  onChange: O,
144
157
  selected: w
145
158
  });
146
159
  };
147
- y.displayName = "SelectOptions";
160
+ S.displayName = "SelectOptions";
148
161
  //#endregion
149
- export { y as SelectOptions };
162
+ export { S as SelectOptions };
@@ -6,7 +6,7 @@ import { IressSelectHeading as i } from "./SelectHeading/SelectHeading.js";
6
6
  import { IressSelectMenu as a } from "./SelectMenu/SelectMenu.js";
7
7
  import { IressSelectSearchInput as o } from "./SelectSearchInput/SelectSearchInput.js";
8
8
  import { nativeSelect as s } from "./components/NativeSelect.styles.js";
9
- import { n as c } from "../../Autocomplete-CuUjmIAw.js";
9
+ import { n as c } from "../../Autocomplete-BRGD9dSh.js";
10
10
  import { IressSelectBody as l } from "./SelectBody/SelectBody.js";
11
11
  import { IressSelectCreate as u } from "./SelectCreate/SelectCreate.js";
12
12
  export { c as IressSelect, l as IressSelectBody, u as IressSelectCreate, i as IressSelectHeading, t as IressSelectLabel, a as IressSelectMenu, r as IressSelectSearch, o as IressSelectSearchInput, n as IressSelectTags, s as nativeSelect, e as select };