@iress-oss/ids-components 6.4.1 → 6.4.3

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.
@@ -75,6 +75,7 @@ export declare const field: import('../../styled-system/types').SlotRecipeRuntim
75
75
  };
76
76
  footer: {
77
77
  position: "static";
78
+ mt: "none";
78
79
  };
79
80
  };
80
81
  false: {
@@ -82,7 +82,10 @@ var t = e({
82
82
  removeErrorMargin: {
83
83
  true: {
84
84
  root: { mb: "none" },
85
- footer: { position: "static" }
85
+ footer: {
86
+ position: "static",
87
+ mt: "none"
88
+ }
86
89
  },
87
90
  false: {
88
91
  root: { mb: "field.footer" },
@@ -50,6 +50,6 @@ export interface IressSelectMenuItemProps extends Omit<IressMenuItemProps<'butto
50
50
  hiddenOnMobile?: boolean;
51
51
  }
52
52
  export declare const IressSelectMenu: {
53
- <TMultiple extends boolean = false>({ heading, hideSelectedItems, items, limitDesktop, limitMobile, multiSelect, noResults, onChange, role, selected, selectedFirst, ...restProps }: IressSelectMenuProps<TMultiple>): import("react/jsx-runtime").JSX.Element;
53
+ <TMultiple extends boolean = false>({ heading, hideSelectedItems, items, limitDesktop, limitMobile, multiSelect, noResults, onChange, onMouseDown, role, selected, selectedFirst, ...restProps }: IressSelectMenuProps<TMultiple>): import("react/jsx-runtime").JSX.Element;
54
54
  displayName: string;
55
55
  };
@@ -3,84 +3,88 @@ import { GlobalCSSClass as t } from "../../../enums.js";
3
3
  import { propagateTestid as n } from "../../../helpers/utility/propagateTestid.js";
4
4
  import { toArray as r } from "../../../helpers/formatting/toArray.js";
5
5
  import { useIdIfNeeded as i } from "../../../hooks/useIdIfNeeded.js";
6
- import { getFormControlValueAsString as a } from "../../../helpers/form/getFormControlValueAsString.js";
7
- import { getFormControlValueAsStringIfDefined as o } from "../../../helpers/form/getFormControlValueAsStringIfDefined.js";
8
- import { IressMenu as s } from "../../Menu/Menu.js";
9
- import { IressMenuText as c } from "../../Menu/MenuText/MenuText.js";
10
- import { IressMenuGroup as l } from "../../Menu/MenuGroup/MenuGroup.js";
11
- import { getValueFromLabelValues as u } from "../../../helpers/label-value/getValueFromLabelValues.js";
12
- import { IressSelectMenuItem as d } from "./SelectMenuItem.js";
13
- import { selectMenu as f } from "./SelectMenu.styles.js";
14
- import { IressSelectHeading as p } from "../SelectHeading/SelectHeading.js";
15
- import { createElement as m, useCallback as h, useMemo as g } from "react";
16
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
6
+ import { usePopover as a } from "../../Popover/hooks/usePopover.js";
7
+ import { getFormControlValueAsString as o } from "../../../helpers/form/getFormControlValueAsString.js";
8
+ import { getFormControlValueAsStringIfDefined as s } from "../../../helpers/form/getFormControlValueAsStringIfDefined.js";
9
+ import { IressMenu as c } from "../../Menu/Menu.js";
10
+ import { IressMenuText as l } from "../../Menu/MenuText/MenuText.js";
11
+ import { IressMenuGroup as u } from "../../Menu/MenuGroup/MenuGroup.js";
12
+ import { getValueFromLabelValues as d } from "../../../helpers/label-value/getValueFromLabelValues.js";
13
+ import { IressSelectMenuItem as f } from "./SelectMenuItem.js";
14
+ import { selectMenu as p } from "./SelectMenu.styles.js";
15
+ import { IressSelectHeading as m } from "../SelectHeading/SelectHeading.js";
16
+ import { createElement as h, useCallback as g, useMemo as _ } from "react";
17
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
17
18
  //#region src/components/Select/SelectMenu/SelectMenu.tsx
18
- var y = ({ heading: y, hideSelectedItems: S, items: w = [], limitDesktop: T, limitMobile: E, multiSelect: D, noResults: O, onChange: k, role: A = "listbox", selected: j, selectedFirst: M, ...N }) => {
19
- let P = `${i({ id: N.id })}--label`, F = g(() => u(j, D), [D, j]), I = g(() => {
20
- let e = M ? b(w, F) : w;
21
- if (S) {
22
- let t = r(F);
19
+ var b = ({ heading: b, hideSelectedItems: C, items: T = [], limitDesktop: E, limitMobile: D, multiSelect: O, noResults: k, onChange: A, onMouseDown: j, role: M = "listbox", selected: N, selectedFirst: P, ...F }) => {
20
+ let I = a(), L = `${i({ id: F.id })}--label`, R = _(() => d(N, O), [O, N]), z = _(() => {
21
+ let e = P ? x(T, R) : T;
22
+ if (C) {
23
+ let t = r(R);
23
24
  e = e.map((e) => {
24
25
  if (e.children && e.children.length > 0) {
25
- let n = e.children.filter((e) => !t.includes(o(e.value) ?? e.label));
26
+ let n = e.children.filter((e) => !t.includes(s(e.value) ?? e.label));
26
27
  return n.length > 0 ? {
27
28
  ...e,
28
29
  children: n
29
30
  } : null;
30
31
  }
31
- return t.includes(o(e.value) ?? e.label) ? null : e;
32
+ return t.includes(s(e.value) ?? e.label) ? null : e;
32
33
  }).filter((e) => e !== null);
33
34
  }
34
- return x(e, T, E);
35
+ return S(e, E, D);
35
36
  }, [
36
- S,
37
- w,
37
+ C,
38
38
  T,
39
39
  E,
40
- F,
41
- M
42
- ]), L = I.length === 0, R = h((e) => {
43
- let t = C(w, j, e ?? void 0);
44
- k?.(D ? t : t[0]);
45
- }, [
46
- w,
47
40
  D,
48
- k,
49
- j
50
- ]), z = f();
51
- return /* @__PURE__ */ v(s, {
52
- ...N,
53
- "aria-labelledby": typeof y == "string" ? P : N["aria-labelledby"],
54
- multiSelect: D,
55
- onChange: R,
56
- role: A,
57
- selected: F,
58
- className: e(z.root, t.SelectMenu, N.className),
41
+ R,
42
+ P
43
+ ]), B = z.length === 0, V = g((e) => {
44
+ let t = w(T, N, e ?? void 0);
45
+ A?.(O ? t : t[0]);
46
+ }, [
47
+ T,
48
+ O,
49
+ A,
50
+ N
51
+ ]), H = p();
52
+ return /* @__PURE__ */ y(c, {
53
+ ...F,
54
+ "aria-labelledby": typeof b == "string" ? L : F["aria-labelledby"],
55
+ multiSelect: O,
56
+ onChange: V,
57
+ onMouseDown: (e) => {
58
+ j?.(e), I?.isVirtualFocus && e.target instanceof Element && e.target.closest(`.${t.MenuGroup}`) && e.preventDefault();
59
+ },
60
+ role: M,
61
+ selected: R,
62
+ className: e(H.root, t.SelectMenu, F.className),
59
63
  children: [
60
- typeof y == "string" ? /* @__PURE__ */ _(p, {
61
- id: P,
62
- children: y
63
- }) : y,
64
- I.map((e, t) => e.children && e.children.length > 0 ? /* @__PURE__ */ _(l, {
64
+ typeof b == "string" ? /* @__PURE__ */ v(m, {
65
+ id: L,
66
+ children: b
67
+ }) : b,
68
+ z.map((e, t) => e.children && e.children.length > 0 ? /* @__PURE__ */ v(u, {
65
69
  label: e.label,
66
- "data-testid": n(N?.["data-testid"], "menu-group"),
70
+ "data-testid": n(F?.["data-testid"], "menu-group"),
67
71
  divider: e.divider,
68
- children: e.children.map((e, t) => /* @__PURE__ */ m(d, {
72
+ children: e.children.map((e, t) => /* @__PURE__ */ h(f, {
69
73
  ...e,
70
- "data-testid": n(N?.["data-testid"], "menu-item"),
71
- key: `${a(e.value ?? e.label)}-${t}`
74
+ "data-testid": n(F?.["data-testid"], "menu-item"),
75
+ key: `${o(e.value ?? e.label)}-${t}`
72
76
  }))
73
- }, `group-${a(e.value ?? e.label)}-${t}`) : /* @__PURE__ */ m(d, {
77
+ }, `group-${o(e.value ?? e.label)}-${t}`) : /* @__PURE__ */ h(f, {
74
78
  ...e,
75
- "data-testid": n(N?.["data-testid"], "menu-item"),
76
- key: `${a(e.value ?? e.label)}-${t}`
79
+ "data-testid": n(F?.["data-testid"], "menu-item"),
80
+ key: `${o(e.value ?? e.label)}-${t}`
77
81
  })),
78
- L && (typeof O == "string" ? /* @__PURE__ */ _(c, { children: O }) : O)
82
+ B && (typeof k == "string" ? /* @__PURE__ */ v(l, { children: k }) : k)
79
83
  ]
80
84
  });
81
85
  };
82
- y.displayName = "IressSelectMenu";
83
- var b = (e, t) => {
86
+ b.displayName = "IressSelectMenu";
87
+ var x = (e, t) => {
84
88
  let n = r(t), i = [], a = [];
85
89
  for (let t of e) t.children && t.children.length > 0 ? t.children.some((e) => n.includes(e.value ?? e.label)) ? i.push(t) : a.push(t) : n.includes(t.value ?? t.label) ? i.push(t) : a.push(t);
86
90
  return i.length && a.length ? i.concat([{
@@ -88,7 +92,7 @@ var b = (e, t) => {
88
92
  value: "",
89
93
  divider: !0
90
94
  }]).concat(a) : i.concat(a);
91
- }, x = (e, t, n) => {
95
+ }, S = (e, t, n) => {
92
96
  let r = {
93
97
  mobileCount: 0,
94
98
  desktopCount: 0
@@ -96,7 +100,7 @@ var b = (e, t) => {
96
100
  for (let a of e) {
97
101
  if (t && r.desktopCount >= t) break;
98
102
  if (a.children && a.children.length > 0) {
99
- let e = S(a.children, r, t, n);
103
+ let e = C(a.children, r, t, n);
100
104
  e.length > 0 && i.push({
101
105
  ...a,
102
106
  children: e
@@ -107,7 +111,7 @@ var b = (e, t) => {
107
111
  }), r.mobileCount++, r.desktopCount++;
108
112
  }
109
113
  return i;
110
- }, S = (e, t, n, r) => {
114
+ }, C = (e, t, n, r) => {
111
115
  let i = [];
112
116
  for (let a of e) {
113
117
  if (n && t.desktopCount >= n) break;
@@ -117,10 +121,10 @@ var b = (e, t) => {
117
121
  }), t.mobileCount++, t.desktopCount++;
118
122
  }
119
123
  return i;
120
- }, C = (e, t, n) => {
121
- let i = r(t);
122
- return r(n).map((t) => w(e, i, t)).filter((e) => e !== void 0);
123
124
  }, w = (e, t, n) => {
125
+ let i = r(t);
126
+ return r(n).map((t) => T(e, i, t)).filter((e) => e !== void 0);
127
+ }, T = (e, t, n) => {
124
128
  let r = e?.find((e) => e.value === n || e.value === void 0 && e.label === n);
125
129
  if (!r) {
126
130
  for (let t of e) if (t.children && t.children.length > 0 && (r = t.children.find((e) => e.value === n || e.value === void 0 && e.label === n), r)) break;
@@ -128,4 +132,4 @@ var b = (e, t) => {
128
132
  return r ?? t.find((e) => e.value === n || e.value === void 0 && e.label === n);
129
133
  };
130
134
  //#endregion
131
- export { y as IressSelectMenu };
135
+ export { b as IressSelectMenu };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iress-oss/ids-components",
3
- "version": "6.4.1",
3
+ "version": "6.4.3",
4
4
  "description": "Iress React Component Library",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",