@phillips/seldon 1.246.0 → 1.247.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 (53) hide show
  1. package/dist/_virtual/index12.js +2 -2
  2. package/dist/_virtual/index13.js +2 -2
  3. package/dist/assets/formatted/Search.js +8 -9
  4. package/dist/components/Input/utils.js +5 -3
  5. package/dist/components/Navigation/Navigation.js +51 -27
  6. package/dist/components/Navigation/Navigation.stories.d.ts +1 -2
  7. package/dist/components/Navigation/NavigationItem/NavigationItem.d.ts +8 -0
  8. package/dist/components/Navigation/NavigationItem/NavigationItem.js +43 -42
  9. package/dist/components/Navigation/NavigationItemWithSubmenu/NavigationDesktopSubmenu.d.ts +17 -0
  10. package/dist/components/Navigation/NavigationItemWithSubmenu/NavigationDesktopSubmenu.js +70 -0
  11. package/dist/components/Navigation/NavigationItemWithSubmenu/NavigationItemWithSubmenu.d.ts +31 -0
  12. package/dist/components/Navigation/NavigationItemWithSubmenu/NavigationItemWithSubmenu.js +68 -0
  13. package/dist/components/Navigation/NavigationItemWithSubmenu/index.d.ts +2 -0
  14. package/dist/components/Navigation/NavigationList/NavigationList.d.ts +11 -8
  15. package/dist/components/Navigation/NavigationList/NavigationList.js +21 -46
  16. package/dist/components/Navigation/NavigationSubmenu/NavigationSubmenu.d.ts +33 -0
  17. package/dist/components/Navigation/NavigationSubmenu/NavigationSubmenu.js +41 -0
  18. package/dist/components/Navigation/NavigationSubmenu/NavigationSubmenu.test.d.ts +1 -0
  19. package/dist/components/Search/Search.js +51 -47
  20. package/dist/components/Search/SearchButton.js +10 -10
  21. package/dist/components/Search/SearchResults/SearchResults.d.ts +2 -1
  22. package/dist/components/Search/SearchResults/SearchResults.js +22 -21
  23. package/dist/index.d.ts +3 -1
  24. package/dist/index.js +201 -197
  25. package/dist/node_modules/@radix-ui/react-navigation-menu/dist/index.js +597 -0
  26. package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/primitive/dist/index.js +9 -0
  27. package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-collection/dist/index.js +50 -0
  28. package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +127 -0
  29. package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-presence/dist/index.js +70 -0
  30. package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-primitive/dist/index.js +36 -0
  31. package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-slot/dist/index.js +49 -0
  32. package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +52 -0
  33. package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-visually-hidden/dist/index.js +32 -0
  34. package/dist/node_modules/ics/dist/schema/index.js +1 -1
  35. package/dist/node_modules/ics/dist/utils/index.js +1 -1
  36. package/dist/patterns/UserManagement/UserManagement.js +45 -27
  37. package/dist/scss/componentStyles.scss +1 -1
  38. package/dist/scss/components/Accordion/_accordion.scss +6 -0
  39. package/dist/scss/components/Navigation/NavigationItem/_navigationItem.scss +0 -12
  40. package/dist/scss/components/Navigation/NavigationItemWithSubmenu/_navigationItemWithSubmenu.scss +114 -0
  41. package/dist/scss/components/Navigation/NavigationList/_navigationList.scss +15 -3
  42. package/dist/scss/components/Navigation/_navigation.scss +109 -0
  43. package/dist/scss/components/Search/_search.scss +1 -0
  44. package/dist/scss/site-furniture/Header/_header.scss +24 -0
  45. package/dist/site-furniture/Header/Header.d.ts +8 -4
  46. package/dist/site-furniture/Header/Header.js +55 -50
  47. package/dist/site-furniture/Header/Header.stories.d.ts +278 -0
  48. package/dist/site-furniture/Header/utils.js +1 -2
  49. package/package.json +5 -1
  50. package/dist/components/Navigation/NavigationItemTrigger/NavigationItemTrigger.d.ts +0 -22
  51. package/dist/components/Navigation/NavigationItemTrigger/NavigationItemTrigger.js +0 -80
  52. package/dist/scss/components/Navigation/NavigationItemTrigger/_navigationItemTrigger.scss +0 -111
  53. /package/dist/components/Navigation/{NavigationItemTrigger/NavigationItemTrigger.test.d.ts → NavigationItemWithSubmenu/NavigationItemWithSubmenu.test.d.ts} +0 -0
@@ -0,0 +1,41 @@
1
+ import { jsxs as s, Fragment as h, jsx as i } from "react/jsx-runtime";
2
+ import l from "../../../_virtual/index.js";
3
+ import * as n from "react";
4
+ import { px as e } from "../../../utils/index.js";
5
+ import { TextVariants as d } from "../../Text/types.js";
6
+ import f from "../../Text/Text.js";
7
+ const k = n.forwardRef(
8
+ ({ id: r, children: o, className: N, leftSectionHeading: m, rightSectionHeading: _, onClick: u, wrapLinksInRadixLink: c, ...x }, C) => {
9
+ const p = n.Children.toArray(o).map((t) => {
10
+ if (n.isValidElement(t) && t.props.navGroup === "nav-link-start")
11
+ return n.cloneElement(t, {
12
+ onClick: (a) => {
13
+ u?.(a), t.props?.onClick?.(a);
14
+ },
15
+ ...c ? { asRadixSubmenuLink: !0 } : {}
16
+ });
17
+ }).filter(Boolean), v = n.Children.toArray(o).map((t) => {
18
+ if (n.isValidElement(t) && t.props.navGroup === "nav-link-end")
19
+ return n.cloneElement(t, {
20
+ onClick: (a) => {
21
+ u?.(a), t.props?.onClick?.(a);
22
+ },
23
+ ...c ? { asRadixSubmenuLink: !0 } : {}
24
+ });
25
+ }).filter(Boolean), $ = /* @__PURE__ */ s(h, { children: [
26
+ p.length > 0 ? /* @__PURE__ */ s("div", { className: l(`${e}-nav__list__section`, `${e}-nav__list__section--start`), children: [
27
+ m ? /* @__PURE__ */ i(f, { variant: d.headingMedium, className: `${e}-nav__list__section--start__title`, children: m }) : null,
28
+ p
29
+ ] }) : null,
30
+ v.length > 0 ? /* @__PURE__ */ s("div", { className: l(`${e}-nav__list__section`, `${e}-nav__list__section--end`), children: [
31
+ _ ? /* @__PURE__ */ i(f, { variant: d.headingMedium, className: `${e}-nav__list__section--end__title`, children: _ }) : null,
32
+ v
33
+ ] }) : null
34
+ ] }), g = l(N, `${e}-nav__list`);
35
+ return /* @__PURE__ */ i("ul", { id: r, "data-testid": r, role: "list", className: g, ref: C, ...x, children: $ });
36
+ }
37
+ );
38
+ k.displayName = "NavigationSubmenu";
39
+ export {
40
+ k as default
41
+ };
@@ -18,66 +18,66 @@ const X = j(
18
18
  onSearch: S,
19
19
  onCancel: _,
20
20
  searchResults: N = [],
21
- state: o = "idle",
21
+ state: i = "idle",
22
22
  defaultValue: R = "",
23
- className: C,
23
+ className: b,
24
24
  placeholder: I = "",
25
- searchButtonText: i = "Search",
26
- loadingText: E = "Search In Progress...",
27
- invalidText: b = "Invalid search",
25
+ searchButtonText: l = "Search",
26
+ loadingText: C = "Search In Progress...",
27
+ invalidText: E = "Invalid search",
28
28
  getAllResultsText: k = (e) => `View all results for ${e}`,
29
29
  getAllResultsLink: v = (e) => `/Search?Search=${e}`,
30
30
  ...x
31
31
  }, L) => {
32
- const { className: e, "data-testid": l, ...P } = A(x, "Search"), c = D(B), d = f(null), m = f(null), g = f(null), a = c.isSearchExpanded, n = d.current?.value, [T, h] = H(!0), y = S ? (r) => {
33
- S(r.target.value);
32
+ const { className: e, "data-testid": n, ...P } = A(x, "Search"), c = D(B), d = f(null), m = f(null), $ = f(null), r = c.isSearchExpanded, o = d.current?.value, [T, h] = H(!0), y = S ? (a) => {
33
+ S(a.target.value);
34
34
  } : void 0;
35
- z(g, (r) => {
36
- _?.(), p(!1), r.stopPropagation();
35
+ z($, (a) => {
36
+ _?.(), p(!1), a.stopPropagation();
37
37
  });
38
- const $ = (r) => {
39
- if (r.stopPropagation(), r.key === "Enter") {
40
- if (r.preventDefault(), n && n.length > 2) {
41
- const V = w(v(n));
38
+ const g = (a) => {
39
+ if (a.stopPropagation(), a.key === "Enter") {
40
+ if (a.preventDefault(), o && o.length > 2) {
41
+ const V = w(v(o));
42
42
  h(!1), window.location.href = V;
43
43
  }
44
- r.currentTarget instanceof HTMLAnchorElement && (h(!1), r.currentTarget.click());
44
+ a.currentTarget instanceof HTMLAnchorElement && (h(!1), a.currentTarget.click());
45
45
  }
46
- r.key === "Escape" && (m.current?.reset(), c.setIsSearchExpanded(!1));
46
+ a.key === "Escape" && (m.current?.reset(), c.setIsSearchExpanded(!1));
47
47
  };
48
48
  O(() => {
49
- if (a) {
49
+ if (r) {
50
50
  d.current?.focus();
51
51
  return;
52
52
  }
53
- }, [a]);
54
- const p = (r) => {
55
- m.current?.reset(), c.setIsSearchExpanded(r);
53
+ }, [r]);
54
+ const p = (a) => {
55
+ m.current?.reset(), c.setIsSearchExpanded(a);
56
56
  };
57
- return /* @__PURE__ */ t(J, { enabled: a, allowPinchZoom: !0, removeScrollBar: !1, children: /* @__PURE__ */ t("div", { className: `${e}__container`, ref: L, children: /* @__PURE__ */ u(
57
+ return /* @__PURE__ */ t(J, { enabled: r, allowPinchZoom: !0, removeScrollBar: !1, children: /* @__PURE__ */ t("div", { className: `${e}__container`, ref: L, children: /* @__PURE__ */ u(
58
58
  "div",
59
59
  {
60
60
  className: `${e}__container__inner`,
61
- ref: g,
62
- onClick: (r) => {
63
- a || (p(!0), r.stopPropagation());
61
+ ref: $,
62
+ onClick: (a) => {
63
+ r || (p(!0), a.stopPropagation());
64
64
  },
65
65
  children: [
66
- /* @__PURE__ */ t(q, { variant: Z.headingSmall, className: `${e}__container__inner__label`, children: i }),
66
+ /* @__PURE__ */ t(q, { variant: Z.headingSmall, className: `${e}__container__inner__label`, children: l }),
67
67
  /* @__PURE__ */ t(
68
68
  "div",
69
69
  {
70
70
  ...P,
71
- className: s(e, C, { [`${e}--active`]: a }),
72
- "data-testid": l,
71
+ className: s(e, b, { [`${e}--active`]: r }),
72
+ "data-testid": n,
73
73
  role: "search",
74
74
  ...x,
75
75
  children: /* @__PURE__ */ u(
76
76
  "form",
77
77
  {
78
- "data-testid": `${l}-form`,
78
+ "data-testid": `${n}-form`,
79
79
  className: s(`${e}__form`, {
80
- [`${e}__form--active`]: a
80
+ [`${e}__form--active`]: r
81
81
  }),
82
82
  ref: m,
83
83
  children: [
@@ -85,34 +85,37 @@ const X = j(
85
85
  "div",
86
86
  {
87
87
  className: s(`${e}__content-wrapper`, {
88
- [`${e}__content-wrapper--active`]: a
88
+ [`${e}__content-wrapper--active`]: r
89
89
  }),
90
90
  role: "combobox",
91
91
  "aria-haspopup": "listbox",
92
+ "aria-expanded": r,
93
+ "aria-controls": r ? `${n}-listbox` : void 0,
92
94
  children: [
93
95
  /* @__PURE__ */ t(
94
96
  W,
95
97
  {
96
- in: a,
98
+ in: r,
97
99
  classNames: `${F}-input`,
98
100
  addEndListener: () => {
99
101
  },
100
102
  children: /* @__PURE__ */ t(
101
103
  K,
102
104
  {
103
- "aria-hidden": !a,
105
+ "aria-hidden": !r,
104
106
  className: `${e}__input`,
105
107
  id: "search-input",
106
108
  hideLabel: !0,
107
- labelText: i,
108
- placeholder: a ? I : "",
109
+ labelText: l,
110
+ placeholder: r ? I : "",
109
111
  type: "text",
110
112
  defaultValue: R,
111
- invalid: o === "invalid",
112
- invalidText: b,
113
- onKeyDown: $,
113
+ invalid: i === "invalid",
114
+ invalidText: E,
115
+ onKeyDown: g,
114
116
  onChange: y,
115
- ref: d
117
+ ref: d,
118
+ tabIndex: r ? 0 : -1
116
119
  }
117
120
  )
118
121
  }
@@ -121,10 +124,10 @@ const X = j(
121
124
  G,
122
125
  {
123
126
  className: e,
124
- searchButtonText: i,
125
- state: o,
126
- testId: l,
127
- isSearchExpanded: a,
127
+ searchButtonText: l,
128
+ state: i,
129
+ testId: n,
130
+ isSearchExpanded: r,
128
131
  setIsSearchExpanded: p,
129
132
  onCancel: _
130
133
  }
@@ -132,20 +135,21 @@ const X = j(
132
135
  ]
133
136
  }
134
137
  ),
135
- a && T && n && n.length > 2 ? /* @__PURE__ */ t(
138
+ r && T && o && o.length > 2 ? /* @__PURE__ */ t(
136
139
  U,
137
140
  {
141
+ id: `${n}-listbox`,
138
142
  autoCompleteResults: N,
139
- isLoading: o === "loading",
140
- loadingText: E,
141
- onKeyDown: $,
142
- userInputValue: n,
143
+ isLoading: i === "loading",
144
+ loadingText: C,
145
+ onKeyDown: g,
146
+ userInputValue: o,
143
147
  closeSearch: h,
144
148
  children: /* @__PURE__ */ t(
145
149
  "li",
146
150
  {
147
151
  className: s(`${e}__result`, `${e}__result--view-all`),
148
- children: /* @__PURE__ */ t(M, { href: w(v(n)), variant: Q.linkLarge, children: /* @__PURE__ */ t("p", { children: k(n) }) })
152
+ children: /* @__PURE__ */ t(M, { href: w(v(o)), variant: Q.linkLarge, children: /* @__PURE__ */ t("p", { children: k(o) }) })
149
153
  },
150
154
  "viewAllSearchResults"
151
155
  )
@@ -1,37 +1,37 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import e from "../Icon/Icon.js";
3
3
  const f = ({
4
- state: c,
4
+ state: b,
5
5
  isSearchExpanded: r,
6
- setIsSearchExpanded: u,
7
- searchButtonText: _,
6
+ setIsSearchExpanded: a,
7
+ searchButtonText: c,
8
8
  className: t,
9
9
  testId: o,
10
- onCancel: b,
11
- ...a
10
+ onCancel: _,
11
+ ...u
12
12
  }) => r ? r ? /* @__PURE__ */ n(
13
13
  "button",
14
14
  {
15
- ...a,
15
+ ...u,
16
16
  type: "button",
17
17
  "data-testid": `${o}-close-button`,
18
18
  "aria-label": "Close Search",
19
19
  className: `${t}__button ${t}__button--close`,
20
20
  onClick: (i) => {
21
- b?.(), u(!1), i.stopPropagation();
21
+ _?.(), a(!1), i.stopPropagation();
22
22
  },
23
23
  children: /* @__PURE__ */ n(e, { icon: "CloseX", "data-testid": `${o}-form-icon`, className: `${t}__button__icon` })
24
24
  }
25
25
  ) : null : /* @__PURE__ */ n(
26
26
  "button",
27
27
  {
28
- ...a,
28
+ ...u,
29
29
  type: "button",
30
30
  "data-testid": `${o}-button`,
31
- "aria-label": _,
31
+ "aria-label": c || "Search",
32
32
  className: `${t}__button ${t}__button--search`,
33
33
  onClick: (i) => {
34
- u(!0), i.stopPropagation();
34
+ a(!0), i.stopPropagation();
35
35
  },
36
36
  children: /* @__PURE__ */ n(e, { icon: "Search", "data-testid": `${o}-button-icon`, className: `${t}__button__icon` })
37
37
  }
@@ -12,6 +12,7 @@ export interface SearchResultsProps extends React.HTMLAttributes<HTMLElement> {
12
12
  onKeyDown?: (event: React.KeyboardEvent<HTMLAnchorElement>) => void;
13
13
  userInputValue?: string;
14
14
  closeSearch: (value: boolean) => void;
15
+ id?: string;
15
16
  }
16
- declare const SearchResults: ({ autoCompleteResults, isLoading, children, loadingText, onKeyDown, userInputValue, closeSearch, }: React.PropsWithChildren<SearchResultsProps>) => import("react/jsx-runtime").JSX.Element;
17
+ declare const SearchResults: ({ autoCompleteResults, isLoading, children, loadingText, onKeyDown, userInputValue, closeSearch, id, }: React.PropsWithChildren<SearchResultsProps>) => import("react/jsx-runtime").JSX.Element;
17
18
  export default SearchResults;
@@ -1,37 +1,38 @@
1
- import { jsx as r, jsxs as u } from "react/jsx-runtime";
1
+ import { jsx as r, jsxs as f } from "react/jsx-runtime";
2
2
  import { px as e } from "../../../utils/index.js";
3
- import f from "../../Link/Link.js";
4
- import { LinkVariants as L } from "../../Link/types.js";
5
- const b = ({
3
+ import L from "../../Link/Link.js";
4
+ import { LinkVariants as x } from "../../Link/types.js";
5
+ const w = ({
6
6
  autoCompleteResults: l = [],
7
- isLoading: n,
8
- children: t,
7
+ isLoading: t,
8
+ children: n,
9
9
  loadingText: c = "Loading...",
10
10
  onKeyDown: o,
11
11
  userInputValue: h = "",
12
- closeSearch: d
12
+ closeSearch: d,
13
+ id: m
13
14
  }) => {
14
- const m = Array.isArray(l) && l.length > 0;
15
- function _(a, s) {
16
- return a.split(new RegExp(`(${s})`, "gi")).map(
17
- (i, p) => i.toLocaleLowerCase() === s.toLocaleLowerCase() ? /* @__PURE__ */ r("strong", { children: i }, p) : i
15
+ const _ = Array.isArray(l) && l.length > 0;
16
+ function p(s, a) {
17
+ return s.split(new RegExp(`(${a})`, "gi")).map(
18
+ (i, u) => i.toLocaleLowerCase() === a.toLocaleLowerCase() ? /* @__PURE__ */ r("strong", { children: i }, u) : i
18
19
  );
19
20
  }
20
- return /* @__PURE__ */ r("div", { className: `${e}-search__results`, children: /* @__PURE__ */ u("ul", { "data-testid": "search-results", className: `${e}-search__results-container`, children: [
21
- n ? /* @__PURE__ */ r("li", { className: `${e}-search__result`, children: c }) : null,
22
- m && l.map((a, s) => /* @__PURE__ */ r("li", { className: `${e}-search__result`, children: /* @__PURE__ */ r(
23
- f,
21
+ return /* @__PURE__ */ r("div", { className: `${e}-search__results`, children: /* @__PURE__ */ f("ul", { id: m, role: "listbox", "data-testid": "search-results", className: `${e}-search__results-container`, children: [
22
+ t ? /* @__PURE__ */ r("li", { className: `${e}-search__result`, children: c }) : null,
23
+ _ && l.map((s, a) => /* @__PURE__ */ r("li", { className: `${e}-search__result`, children: /* @__PURE__ */ r(
24
+ L,
24
25
  {
25
- href: a.url,
26
+ href: s.url,
26
27
  onKeyDown: o,
27
28
  onClick: () => d(!1),
28
- variant: L.linkLarge,
29
- children: /* @__PURE__ */ r("span", { "data-testid": `search-result-${s}`, className: "${px}-search__result__label", children: _(a.label, h) })
29
+ variant: x.linkLarge,
30
+ children: /* @__PURE__ */ r("span", { "data-testid": `search-result-${a}`, className: "${px}-search__result__label", children: p(s.label, h) })
30
31
  }
31
- ) }, a.id)),
32
- t
32
+ ) }, s.id)),
33
+ n
33
34
  ] }) });
34
35
  };
35
36
  export {
36
- b as default
37
+ w as default
37
38
  };
package/dist/index.d.ts CHANGED
@@ -26,8 +26,10 @@ export { default as LinkList, type LinkListProps } from './components/LinkList/L
26
26
  export { default as Modal, type ModalProps } from './components/Modal/Modal';
27
27
  export { default as Navigation, type NavigationProps } from './components/Navigation/Navigation';
28
28
  export { default as NavigationItem, type NavigationItemProps, } from './components/Navigation/NavigationItem/NavigationItem';
29
- export { default as NavigationItemTrigger, type NavigationItemTriggerProps, } from './components/Navigation/NavigationItemTrigger/NavigationItemTrigger';
29
+ export { default as NavigationItemWithSubmenu, type NavigationItemWithSubmenuProps, } from './components/Navigation/NavigationItemWithSubmenu/';
30
30
  export { default as NavigationList, type NavigationListProps, } from './components/Navigation/NavigationList/NavigationList';
31
+ export { default as NavigationSubmenu, type NavigationSubmenuProps, } from './components/Navigation/NavigationSubmenu/NavigationSubmenu';
32
+ export { NavigationDesktopSubmenu, type NavigationDesktopSubmenuProps, } from './components/Navigation/NavigationItemWithSubmenu/';
31
33
  export { default as Pagination, type PaginationOption, type PaginationOptionValue, type PaginationProps, } from './components/Pagination/Pagination';
32
34
  export * from './components/PinchZoom';
33
35
  export { default as Row, type RowProps } from './components/Row/Row';