@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.
- package/dist/Autocomplete-BRGD9dSh.js +321 -0
- package/dist/Shadow-D2KoVwxD.js +57 -0
- package/dist/components/Autocomplete/Autocomplete.js +1 -1
- package/dist/components/Autocomplete/hooks/useAutocompleteSearch.js +1 -1
- package/dist/components/Autocomplete/index.js +2 -2
- package/dist/components/Field/Field.js +47 -47
- package/dist/components/Field/Field.styles.d.ts +1 -1
- package/dist/components/Field/Field.styles.js +6 -0
- package/dist/components/Field/components/FieldHint.js +27 -19
- package/dist/components/Field/index.d.ts +0 -2
- package/dist/components/Field/index.js +1 -3
- package/dist/components/{Field/FieldGroup → FieldGroup}/FieldGroup.js +9 -9
- package/dist/components/{Field/FieldGroup → FieldGroup}/FieldGroup.styles.d.ts +1 -1
- package/dist/components/{Field/FieldGroup → FieldGroup}/FieldGroup.styles.js +2 -2
- package/dist/components/FieldGroup/index.d.ts +2 -0
- package/dist/components/FieldGroup/index.js +3 -0
- package/dist/components/Input/Input.styles.d.ts +4 -4
- package/dist/components/Input/Input.styles.js +4 -4
- package/dist/components/Link/Link.styles.d.ts +1 -0
- package/dist/components/Link/Link.styles.js +4 -1
- package/dist/components/Menu/Menu.js +81 -77
- package/dist/components/Menu/Menu.styles.js +7 -0
- package/dist/components/Menu/MenuGroup/MenuGroup.d.ts +18 -3
- package/dist/components/Menu/MenuGroup/MenuGroup.js +38 -34
- package/dist/components/Menu/MenuHeading/MenuHeading.d.ts +20 -0
- package/dist/components/Menu/MenuHeading/MenuHeading.js +14 -0
- package/dist/components/Menu/MenuItem/MenuItem.styles.js +9 -0
- package/dist/components/Menu/MenuText/MenuText.d.ts +1 -5
- package/dist/components/Menu/MenuText/MenuText.js +11 -17
- package/dist/components/Menu/index.d.ts +1 -0
- package/dist/components/Menu/index.js +4 -3
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Select/SelectHeading/SelectHeading.js +5 -5
- package/dist/components/Select/SelectTags/SelectTags.js +15 -15
- package/dist/components/Select/components/SelectOptions.js +108 -95
- package/dist/components/Select/index.js +1 -1
- package/dist/components/Slideout/Slideout.styles.js +1 -0
- package/dist/components/TabSet/TabSet.d.ts +6 -1
- package/dist/components/TabSet/TabSet.js +34 -30
- package/dist/components/TabSet/TabSet.styles.d.ts +1 -1
- package/dist/components/TabSet/TabSet.styles.js +13 -1
- package/dist/components/Tag/Tag.styles.d.ts +14 -14
- package/dist/components/Tag/Tag.styles.js +16 -16
- package/dist/components/Tag/index.d.ts +0 -1
- package/dist/components/Tag/index.js +1 -2
- package/dist/components/{Tag/TagInput → TagInput}/TagInput.d.ts +1 -1
- package/dist/components/{Tag/TagInput → TagInput}/TagInput.js +7 -7
- package/dist/components/TagInput/TagInput.styles.d.ts +1 -0
- package/dist/components/{Tag/TagInput → TagInput}/TagInput.styles.js +2 -2
- package/dist/components/TagInput/index.d.ts +2 -0
- package/dist/components/TagInput/index.js +3 -0
- package/dist/components/Tooltip/Tooltip.d.ts +7 -2
- package/dist/components/Tooltip/Tooltip.js +48 -42
- package/dist/components/Tooltip/TooltipProvider.d.ts +27 -0
- package/dist/components/Tooltip/TooltipProvider.js +14 -0
- package/dist/components/Tooltip/hooks/useTooltipContainer.d.ts +17 -0
- package/dist/components/Tooltip/hooks/useTooltipContainer.js +5 -0
- package/dist/components/Tooltip/index.d.ts +4 -0
- package/dist/components/Tooltip/index.js +4 -2
- package/dist/components/ValidationMessage/ValidationMessage.js +2 -2
- package/dist/main.d.ts +2 -0
- package/dist/main.js +125 -121
- package/dist/patterns/DropdownMenu/DropdownMenu.js +113 -102
- package/dist/patterns/DropdownMenu/hooks/useDropdownMenuFlags.d.ts +1 -0
- package/dist/patterns/DropdownMenu/hooks/useDropdownMenuFlags.js +1 -0
- package/dist/patterns/Form/FormField/FormFieldset.d.ts +1 -1
- package/dist/patterns/Form/FormField/FormFieldset.js +1 -1
- package/dist/patterns/Form/FormValidationSummary/FormValidationSummary.js +1 -0
- package/dist/patterns/Form/components/LongForm.js +3 -1
- package/dist/patterns/Form/components/ShortForm.js +1 -0
- package/dist/patterns/Loading/Loading.styles.d.ts +3 -0
- package/dist/patterns/Loading/Loading.styles.js +4 -1
- package/dist/patterns/Loading/components/PageLoading.js +4 -4
- package/dist/patterns/Shadow/Shadow.js +1 -1
- package/dist/patterns/Shadow/index.js +1 -1
- package/dist/patterns/SideNav/SideNav.d.ts +6 -0
- package/dist/patterns/SideNav/SideNav.js +74 -68
- package/dist/patterns/SideNav/SideNav.styles.js +6 -2
- package/dist/style.css +1 -1
- package/dist/{useAutocompleteSearch-BJ_hhoKp.js → useAutocompleteSearch-DxKxs6HH.js} +29 -24
- package/package.json +1 -1
- package/dist/Autocomplete-CuUjmIAw.js +0 -308
- package/dist/Shadow-OHZiBoEb.js +0 -57
- package/dist/components/Tag/TagInput/TagInput.styles.d.ts +0 -1
- /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 {
|
|
13
|
-
import {
|
|
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,
|
|
18
|
-
let
|
|
19
|
-
if (
|
|
20
|
-
let { value:
|
|
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:
|
|
23
|
+
onChange: D,
|
|
24
24
|
value: y
|
|
25
25
|
});
|
|
26
|
-
if (
|
|
26
|
+
if (F == "side") {
|
|
27
27
|
let n = u({
|
|
28
|
-
numbered:
|
|
29
|
-
open:
|
|
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
|
-
...
|
|
34
|
-
"data-testid":
|
|
35
|
-
children: [/* @__PURE__ */ g(
|
|
33
|
+
...j,
|
|
34
|
+
"data-testid": A,
|
|
35
|
+
children: [/* @__PURE__ */ g(f, {
|
|
36
36
|
className: e(n.activator, t.MenuGroupActivator),
|
|
37
|
-
"data-testid": r(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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: `${
|
|
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
|
|
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:
|
|
61
|
-
virtualFocus:
|
|
64
|
+
type: N?.role === "list" ? void 0 : N?.role,
|
|
65
|
+
virtualFocus: P?.isVirtualFocus,
|
|
62
66
|
contentStyle: { p: "none" },
|
|
63
|
-
...
|
|
67
|
+
...j,
|
|
64
68
|
className: e(t.MenuGroup, x),
|
|
65
|
-
"data-testid": r(
|
|
66
|
-
activator: /* @__PURE__ */ g(
|
|
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(
|
|
70
|
-
children:
|
|
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(
|
|
75
|
-
"data-testid":
|
|
76
|
-
...
|
|
78
|
+
/* @__PURE__ */ g(p, {
|
|
79
|
+
"data-testid": A,
|
|
80
|
+
...j,
|
|
77
81
|
className: e(t.MenuGroup, x),
|
|
78
|
-
srOnly:
|
|
79
|
-
width:
|
|
80
|
-
children:
|
|
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,
|
|
27
|
-
let
|
|
28
|
-
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
|
-
}), [
|
|
31
|
+
}), [O, k] = n(w);
|
|
32
32
|
return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("div", {
|
|
33
|
-
className: t(g, e(
|
|
33
|
+
className: t(g, e(D.root, O, { width: C }), r.MenuText),
|
|
34
34
|
"data-testid": _,
|
|
35
|
-
role:
|
|
35
|
+
role: E,
|
|
36
36
|
children: [
|
|
37
37
|
b && /* @__PURE__ */ d("div", { children: b }),
|
|
38
38
|
/* @__PURE__ */ d(i, {
|
|
39
|
-
...
|
|
40
|
-
className: e(
|
|
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(
|
|
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 {
|
|
55
|
+
export { m as IressMenuText };
|
|
@@ -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 {
|
|
7
|
-
import {
|
|
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,
|
|
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-
|
|
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 {
|
|
7
|
-
import {
|
|
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: "
|
|
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.
|
|
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(
|
|
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 {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
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:
|
|
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?.(
|
|
31
|
+
i?.(g.find((t) => t.label === e), t), t.stopPropagation(), S(T, t);
|
|
32
32
|
}, [
|
|
33
33
|
i,
|
|
34
34
|
T,
|
|
35
|
-
|
|
35
|
+
g
|
|
36
36
|
]), O = _((e) => {
|
|
37
37
|
o?.(e), T?.getFocusableActivator()?.focus();
|
|
38
38
|
}, [o, T]);
|
|
39
|
-
return C &&
|
|
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(
|
|
66
|
+
children: /* @__PURE__ */ x(m, { children: [/* @__PURE__ */ b(h, {
|
|
67
67
|
onClick: () => w(!0),
|
|
68
68
|
children: "Expand all"
|
|
69
|
-
}), /* @__PURE__ */ b(
|
|
69
|
+
}), /* @__PURE__ */ b(h, {
|
|
70
70
|
onClick: O,
|
|
71
71
|
children: "Delete all"
|
|
72
72
|
})] })
|
|
73
73
|
}),
|
|
74
74
|
compact: !0,
|
|
75
|
-
children: d(
|
|
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:
|
|
78
|
-
let S = v(() => o(
|
|
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
|
-
|
|
85
|
+
m && /* @__PURE__ */ b("span", {
|
|
86
86
|
className: E.prepend,
|
|
87
|
-
children:
|
|
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(
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
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
|
|
14
|
-
heading:
|
|
15
|
-
items:
|
|
16
|
-
multiSelect:
|
|
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 (
|
|
19
|
-
if (
|
|
20
|
-
if (
|
|
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:
|
|
26
|
+
onChange: r,
|
|
24
27
|
selected: c,
|
|
25
|
-
hideSelectedItems:
|
|
28
|
+
hideSelectedItems: n
|
|
26
29
|
});
|
|
27
|
-
|
|
28
|
-
var
|
|
30
|
+
y.displayName = "SelectAsyncResults";
|
|
31
|
+
var b = ({ error: e }) => e ? /* @__PURE__ */ _(r, {
|
|
29
32
|
status: "danger",
|
|
30
|
-
children: typeof e == "string" ? e : /* @__PURE__ */
|
|
33
|
+
children: typeof e == "string" ? e : /* @__PURE__ */ v(g, { children: [
|
|
31
34
|
"An unknown error occurred.",
|
|
32
|
-
/* @__PURE__ */
|
|
35
|
+
/* @__PURE__ */ _("br", {}),
|
|
33
36
|
" Please contact support if the error persists."
|
|
34
37
|
] })
|
|
35
38
|
}) : null;
|
|
36
|
-
|
|
37
|
-
var
|
|
38
|
-
let
|
|
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
|
-
}),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}, [
|
|
45
|
-
let
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
activator: /* @__PURE__ */
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
ref: j,
|
|
52
|
+
onChange: (e) => E?.(e.target.value),
|
|
53
|
+
ref: F,
|
|
52
54
|
placeholder: "Search and select",
|
|
53
|
-
value:
|
|
55
|
+
value: w
|
|
54
56
|
}),
|
|
55
|
-
autoHighlight:
|
|
56
|
-
focusStartIndex:
|
|
57
|
+
autoHighlight: r,
|
|
58
|
+
focusStartIndex: r ? w && M ? L : +!!N : void 0,
|
|
57
59
|
children: [
|
|
58
|
-
|
|
59
|
-
"aria-labelledby":
|
|
60
|
-
heading: /* @__PURE__ */
|
|
60
|
+
N && /* @__PURE__ */ _(u, {
|
|
61
|
+
"aria-labelledby": I,
|
|
62
|
+
heading: /* @__PURE__ */ _(l, {
|
|
61
63
|
clearAll: !0,
|
|
62
64
|
onClearAll: (e) => {
|
|
63
|
-
|
|
65
|
+
C?.(e), F.current?.focus();
|
|
64
66
|
},
|
|
65
|
-
children: /* @__PURE__ */
|
|
66
|
-
id:
|
|
67
|
+
children: /* @__PURE__ */ v("span", {
|
|
68
|
+
id: I,
|
|
67
69
|
children: [
|
|
68
70
|
"Selected (",
|
|
69
|
-
|
|
71
|
+
j.length,
|
|
70
72
|
")"
|
|
71
73
|
]
|
|
72
74
|
})
|
|
73
75
|
}),
|
|
74
|
-
items:
|
|
75
|
-
multiSelect:
|
|
76
|
-
onChange:
|
|
77
|
-
selected:
|
|
76
|
+
items: j,
|
|
77
|
+
multiSelect: x,
|
|
78
|
+
onChange: S,
|
|
79
|
+
selected: O
|
|
78
80
|
}),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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__ */
|
|
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
|
-
|
|
95
|
-
var
|
|
96
|
-
let T = typeof
|
|
97
|
-
|
|
98
|
-
let t =
|
|
99
|
-
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
]), k = l((e) => {
|
|
115
|
+
l,
|
|
116
|
+
c
|
|
117
|
+
]), k = f((e) => {
|
|
106
118
|
e.stopPropagation();
|
|
107
119
|
let t = [];
|
|
108
|
-
|
|
109
|
-
let
|
|
110
|
-
|
|
111
|
-
}, [
|
|
112
|
-
return
|
|
113
|
-
close: () =>
|
|
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:
|
|
127
|
+
error: n,
|
|
116
128
|
handleClear: k,
|
|
117
129
|
handleMenuChange: O,
|
|
118
|
-
loading:
|
|
130
|
+
loading: a,
|
|
119
131
|
query: p,
|
|
120
132
|
results: D,
|
|
121
|
-
setValue:
|
|
122
|
-
setQuery:
|
|
123
|
-
show:
|
|
133
|
+
setValue: y,
|
|
134
|
+
setQuery: g,
|
|
135
|
+
show: b,
|
|
124
136
|
value: w
|
|
125
|
-
}) : T ? /* @__PURE__ */
|
|
137
|
+
}) : T ? /* @__PURE__ */ _(x, {
|
|
126
138
|
autoHighlight: e,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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:
|
|
135
|
-
setQuery:
|
|
136
|
-
show:
|
|
147
|
+
results: h,
|
|
148
|
+
setQuery: g,
|
|
149
|
+
show: b,
|
|
137
150
|
value: w,
|
|
138
151
|
shouldShowInstructions: S,
|
|
139
152
|
shouldShowNoResults: C
|
|
140
|
-
}) : /* @__PURE__ */
|
|
153
|
+
}) : /* @__PURE__ */ _(u, {
|
|
141
154
|
items: D,
|
|
142
|
-
multiSelect:
|
|
155
|
+
multiSelect: c,
|
|
143
156
|
onChange: O,
|
|
144
157
|
selected: w
|
|
145
158
|
});
|
|
146
159
|
};
|
|
147
|
-
|
|
160
|
+
S.displayName = "SelectOptions";
|
|
148
161
|
//#endregion
|
|
149
|
-
export {
|
|
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-
|
|
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 };
|