@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
@@ -1,4 +1,4 @@
1
- var a = {};
1
+ var r = {};
2
2
  export {
3
- a as __exports
3
+ r as __exports
4
4
  };
@@ -1,4 +1,4 @@
1
- var r = {};
1
+ var a = {};
2
2
  export {
3
- r as __exports
3
+ a as __exports
4
4
  };
@@ -1,9 +1,9 @@
1
1
  import { jsxs as s, jsx as i } from "react/jsx-runtime";
2
2
  import { memo as m, forwardRef as f } from "react";
3
- import { kebabCase as c } from "../../node_modules/change-case/dist/index.js";
4
- const g = m(
5
- f((l, o) => {
6
- const { color: r, height: d, width: a, title: e, titleId: n } = l, t = n || c(e || "");
3
+ import { kebabCase as h } from "../../node_modules/change-case/dist/index.js";
4
+ const u = m(
5
+ f((t, o) => {
6
+ const { color: r, height: d, width: a, title: e, titleId: n } = t, l = e ? n || h(e) : void 0;
7
7
  return /* @__PURE__ */ s(
8
8
  "svg",
9
9
  {
@@ -12,12 +12,11 @@ const g = m(
12
12
  viewBox: "0 0 24 24",
13
13
  height: d,
14
14
  width: a,
15
- role: "img",
16
15
  ref: o,
17
- "aria-labelledby": t,
18
- ...l,
16
+ ...l ? { role: "img", "aria-labelledby": l } : { "aria-hidden": !0 },
17
+ ...t,
19
18
  children: [
20
- e ? /* @__PURE__ */ i("title", { id: t, children: e }) : null,
19
+ e && l ? /* @__PURE__ */ i("title", { id: l, children: e }) : null,
21
20
  /* @__PURE__ */ i(
22
21
  "path",
23
22
  {
@@ -33,5 +32,5 @@ const g = m(
33
32
  })
34
33
  );
35
34
  export {
36
- g as default
35
+ u as default
37
36
  };
@@ -30,8 +30,10 @@ import "../LinkList/LinkList.js";
30
30
  import "../Modal/Modal.js";
31
31
  import "../Navigation/Navigation.js";
32
32
  import "../Navigation/NavigationItem/NavigationItem.js";
33
- import "../Navigation/NavigationItemTrigger/NavigationItemTrigger.js";
33
+ import "../Navigation/NavigationItemWithSubmenu/NavigationItemWithSubmenu.js";
34
+ import "../Navigation/NavigationItemWithSubmenu/NavigationDesktopSubmenu.js";
34
35
  import "../Navigation/NavigationList/NavigationList.js";
36
+ import "../Navigation/NavigationSubmenu/NavigationSubmenu.js";
35
37
  import "../Pagination/Pagination.js";
36
38
  import "../PinchZoom/PinchZoom.js";
37
39
  import "../Row/Row.js";
@@ -92,7 +94,7 @@ import "../../patterns/CountryPicker/CountryPicker.js";
92
94
  import "../../patterns/ProgressWizard/ProgressWizard.js";
93
95
  import "../../patterns/ProgressWizard/types.js";
94
96
  import "../../patterns/PhoneNumberInput/PhoneNumberInput.js";
95
- const Lp = () => ({
97
+ const Op = () => ({
96
98
  adornment: `${p}-input__wrapper__adornment`,
97
99
  emptyValidation: `${p}-input__empty-validation`,
98
100
  input: `${p}-input__input`,
@@ -104,5 +106,5 @@ const Lp = () => ({
104
106
  wrapperInput: `${p}-input__wrapper__input`
105
107
  });
106
108
  export {
107
- Lp as getInputClassNames
109
+ Op as getInputClassNames
108
110
  };
@@ -1,36 +1,60 @@
1
- import { jsx as r, jsxs as h } from "react/jsx-runtime";
2
- import e, { forwardRef as u } from "react";
3
- import { findChildrenOfType as s, findChildrenExcludingTypes as x, px as l } from "../../utils/index.js";
4
- import E from "../../_virtual/index.js";
5
- import { HeaderContext as N } from "../../site-furniture/Header/Header.js";
6
- import d from "./NavigationList/NavigationList.js";
7
- import m from "../../patterns/LanguageSelector/LanguageSelector.js";
8
- import { SSRMediaQuery as S } from "../../providers/SeldonProvider/utils.js";
9
- const y = u(
10
- ({ children: i, className: c, id: a, visible: f = !0, ...p }, v) => {
11
- const { isSearchExpanded: n } = e.useContext(N), o = s(i, d)?.[0], g = x(i, [d, m]), t = s(i, m)?.[0];
12
- return /* @__PURE__ */ r(
13
- "nav",
1
+ import { jsxs as c, jsx as i } from "react/jsx-runtime";
2
+ import e, { forwardRef as C } from "react";
3
+ import { findChildrenOfType as f, findChildrenExcludingTypes as M, px as a } from "../../utils/index.js";
4
+ import u from "../../_virtual/index.js";
5
+ import { HeaderContext as R } from "../../site-furniture/Header/Header.js";
6
+ import p from "./NavigationList/NavigationList.js";
7
+ import v from "../../patterns/LanguageSelector/LanguageSelector.js";
8
+ import { SSRMediaQuery as l } from "../../providers/SeldonProvider/utils.js";
9
+ import V from "../../node_modules/react-remove-scroll/dist/es2015/Combination.js";
10
+ import { Viewport as T, Root as $ } from "../../node_modules/@radix-ui/react-navigation-menu/dist/index.js";
11
+ const w = C(
12
+ ({ "aria-label": h, children: t, className: S, id: s, visible: g = !0, dir: O, ...x }, _) => {
13
+ const { isSearchExpanded: n, activeSubmenuId: b, setActiveSubmenuId: E } = e.useContext(R), o = f(t, p)?.[0], N = M(t, [p, v]), r = f(t, v)?.[0], d = b ?? "", y = /* @__PURE__ */ c(
14
+ "div",
14
15
  {
15
- role: "navigation",
16
- "data-testid": a,
17
- id: a,
18
- style: { "--visible": f ? "visible" : "hidden" },
19
- className: E(`${l}-nav`, c),
20
- ...p,
21
- ref: v,
22
- children: /* @__PURE__ */ h("div", { className: `${l}-nav__list-container`, children: [
23
- g,
24
- e.isValidElement(o) ? e.cloneElement(o, { isOffScreen: n }) : void 0,
25
- /* @__PURE__ */ r(S.Media, { lessThan: "md", children: e.isValidElement(t) && t ? e.cloneElement(t, {
16
+ className: u(`${a}-nav__list-container`, {
17
+ [`${a}-nav__list-container--search-expanded`]: n
18
+ }),
19
+ children: [
20
+ N,
21
+ /* @__PURE__ */ i(l.Media, { lessThan: "md", children: e.isValidElement(o) ? e.cloneElement(o, {
22
+ isOffScreen: n,
23
+ isMobile: !0
24
+ }) : void 0 }),
25
+ /* @__PURE__ */ i(l.Media, { greaterThanOrEqual: "md", children: e.isValidElement(o) ? /* @__PURE__ */ c(V, { enabled: !!d, allowPinchZoom: !0, removeScrollBar: !1, children: [
26
+ e.cloneElement(o, {
27
+ isOffScreen: n,
28
+ isMobile: !1
29
+ }),
30
+ /* @__PURE__ */ i(T, { className: `${a}-nav__radix-viewport` })
31
+ ] }) : void 0 }),
32
+ /* @__PURE__ */ i(l.Media, { lessThan: "md", children: e.isValidElement(r) && r ? e.cloneElement(r, {
26
33
  isHidden: n
27
34
  }) : void 0 })
28
- ] })
35
+ ]
36
+ }
37
+ );
38
+ return /* @__PURE__ */ i(
39
+ $,
40
+ {
41
+ "aria-label": h ?? "Main navigation",
42
+ "data-testid": s,
43
+ id: s,
44
+ style: { "--visible": g ? "visible" : "hidden" },
45
+ className: u(`${a}-nav`, `${a}-nav__radix-root`, S),
46
+ delayDuration: 0,
47
+ skipDelayDuration: 300,
48
+ value: d,
49
+ onValueChange: (m) => E(m === "" ? null : m),
50
+ ref: _,
51
+ ...x,
52
+ children: y
29
53
  }
30
54
  );
31
55
  }
32
56
  );
33
- y.displayName = "Navigation";
57
+ w.displayName = "Navigation";
34
58
  export {
35
- y as default
59
+ w as default
36
60
  };
@@ -1,7 +1,6 @@
1
- import { default as React } from 'react';
2
1
  declare const meta: {
3
2
  title: string;
4
- component: React.ForwardRefExoticComponent<Omit<import('./Navigation').NavigationProps, "ref"> & React.RefAttributes<HTMLElement>>;
3
+ component: import('react').ForwardRefExoticComponent<Omit<import('./Navigation').NavigationProps, "ref"> & import('react').RefAttributes<HTMLElement>>;
5
4
  tags: string[];
6
5
  parameters: {
7
6
  docs: {
@@ -30,6 +30,14 @@ export interface NavigationItemProps extends ComponentProps<'li'> {
30
30
  * Element to render within the navigation item, renders <Link> by default
31
31
  */
32
32
  element?: ElementType<LinkProps>;
33
+ /**
34
+ * When false (desktop), render as NavigationMenu.Item + Link for arrow-key navigation. Set by NavigationList.
35
+ */
36
+ isMobile?: boolean;
37
+ /**
38
+ * When true (desktop submenu), wrap link in NavigationMenu.Link so Radix closes the submenu on click
39
+ */
40
+ asRadixSubmenuLink?: boolean;
33
41
  }
34
42
  /**
35
43
  * ## Overview
@@ -1,47 +1,48 @@
1
- import { jsx as i, jsxs as _ } from "react/jsx-runtime";
2
- import { px as a } from "../../../utils/index.js";
3
- import n from "../../../_virtual/index.js";
4
- import v from "../../Link/Link.js";
5
- import { LinkVariants as $ } from "../../Link/types.js";
6
- import { forwardRef as N } from "react";
7
- const h = N(
1
+ import { jsxs as k, jsx as a } from "react/jsx-runtime";
2
+ import { px as t } from "../../../utils/index.js";
3
+ import d from "../../../_virtual/index.js";
4
+ import x from "../../Link/Link.js";
5
+ import { LinkVariants as L } from "../../Link/types.js";
6
+ import { forwardRef as C } from "react";
7
+ import { Item as I, Link as c } from "../../../node_modules/@radix-ui/react-navigation-menu/dist/index.js";
8
+ const g = C(
8
9
  ({
9
- badge: e,
10
- className: r = "",
11
- href: s,
12
- isViewAllLink: l = !1,
13
- label: m,
14
- navGroup: o,
15
- navType: t,
16
- onClick: c,
17
- element: d = v,
18
- ...f
19
- }, p) => /* @__PURE__ */ i(
20
- "li",
21
- {
22
- ...f,
23
- onClick: c,
24
- "data-testid": `nav-item-${m}`,
25
- className: n(`${a}-nav__item`, `${a}-nav__item--${o}`, r),
26
- ref: p,
27
- children: /* @__PURE__ */ _(
28
- d,
29
- {
30
- className: n({
31
- [`${a}-nav__item--view-all`]: l
32
- }),
33
- href: s,
34
- variant: t || $.linkStylised,
35
- children: [
36
- /* @__PURE__ */ i("span", { className: `${a}-nav__item--label`, children: m }),
37
- e ? /* @__PURE__ */ i("span", { className: `${a}-nav__item--badge `, children: ` • ${e}` }) : null
38
- ]
39
- }
40
- )
10
+ badge: r,
11
+ className: f = "",
12
+ href: v,
13
+ isViewAllLink: _ = !1,
14
+ label: i,
15
+ navGroup: $,
16
+ navType: l,
17
+ onClick: o,
18
+ element: h = x,
19
+ isMobile: N,
20
+ asRadixSubmenuLink: u,
21
+ ...e
22
+ }, n) => {
23
+ const s = d(`${t}-nav__item`, `${t}-nav__item--${$}`, f), m = /* @__PURE__ */ k(
24
+ h,
25
+ {
26
+ className: d({
27
+ [`${t}-nav__item--view-all`]: _
28
+ }),
29
+ href: v,
30
+ variant: l || L.linkStylised,
31
+ onClick: o,
32
+ children: [
33
+ /* @__PURE__ */ a("span", { className: `${t}-nav__item--label`, children: i }),
34
+ r ? /* @__PURE__ */ a("span", { className: `${t}-nav__item--badge `, children: ` • ${r}` }) : null
35
+ ]
36
+ }
37
+ );
38
+ if (N === !1) {
39
+ const { value: j, ...p } = e;
40
+ return /* @__PURE__ */ a(I, { ref: n, "data-testid": `nav-item-${i}`, className: s, ...p, children: /* @__PURE__ */ a(c, { asChild: !0, children: m }) });
41
41
  }
42
- )
42
+ return u ? /* @__PURE__ */ a("li", { ...e, "data-testid": `nav-item-${i}`, className: s, ref: n, children: /* @__PURE__ */ a(c, { asChild: !0, children: m }) }) : /* @__PURE__ */ a("li", { ...e, onClick: o, "data-testid": `nav-item-${i}`, className: s, ref: n, children: m });
43
+ }
43
44
  );
44
- h.displayName = "NavigationItem";
45
+ g.displayName = "NavigationItem";
45
46
  export {
46
- h as default
47
+ g as default
47
48
  };
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ import { NavigationSubmenuProps } from '../NavigationSubmenu/NavigationSubmenu';
3
+ import { NavigationItemWithSubmenuProps } from './NavigationItemWithSubmenu';
4
+ export interface NavigationDesktopSubmenuProps {
5
+ navSubmenuElement: React.ReactElement<NavigationSubmenuProps>[] | null | undefined;
6
+ itemValue: string;
7
+ baseClassName: string;
8
+ commonProps: Record<string, unknown>;
9
+ label: string;
10
+ className?: string;
11
+ onClick?: React.MouseEventHandler<HTMLLIElement>;
12
+ closeMenu?: () => void;
13
+ setActiveSubmenuId?: (id: string | null) => void;
14
+ itemProps: Omit<NavigationItemWithSubmenuProps, 'id' | 'label' | 'children' | 'className' | 'onClick' | 'renderMode' | 'isMobile'>;
15
+ }
16
+ declare const NavigationDesktopSubmenu: React.ForwardRefExoticComponent<NavigationDesktopSubmenuProps & React.RefAttributes<HTMLLIElement>>;
17
+ export default NavigationDesktopSubmenu;
@@ -0,0 +1,70 @@
1
+ import { jsxs as k, jsx as i } from "react/jsx-runtime";
2
+ import c from "../../../_virtual/index.js";
3
+ import u, { forwardRef as v } from "react";
4
+ import { Item as x, Trigger as $, Content as N } from "../../../node_modules/@radix-ui/react-navigation-menu/dist/index.js";
5
+ import { px as t } from "../../../utils/index.js";
6
+ import { TextVariants as _ } from "../../Text/types.js";
7
+ import f from "../../Text/Text.js";
8
+ const w = v(
9
+ ({
10
+ navSubmenuElement: a,
11
+ itemValue: g,
12
+ baseClassName: n,
13
+ commonProps: o,
14
+ label: e,
15
+ className: s,
16
+ onClick: l,
17
+ closeMenu: m,
18
+ setActiveSubmenuId: p,
19
+ itemProps: h
20
+ }, d) => a?.length ? /* @__PURE__ */ k(
21
+ x,
22
+ {
23
+ value: g,
24
+ ref: d,
25
+ className: c(s, n, `${t}-nav__item`),
26
+ children: [
27
+ /* @__PURE__ */ i(
28
+ $,
29
+ {
30
+ "aria-label": e,
31
+ className: `${t}-nav__item-trigger-wrapper`,
32
+ "data-testid": o["data-testid"],
33
+ onClick: l ? (r) => l(r) : void 0,
34
+ children: /* @__PURE__ */ i("span", { className: `${t}-nav__item-trigger`, children: /* @__PURE__ */ i(f, { variant: _.linkStylised, children: e }) })
35
+ }
36
+ ),
37
+ /* @__PURE__ */ i(
38
+ N,
39
+ {
40
+ className: `${n}__submenu`,
41
+ "aria-label": `${e} submenu`,
42
+ onSelect: (r) => {
43
+ a[0].props?.onClick?.(r), m?.(), p?.(null);
44
+ },
45
+ children: u.cloneElement(a[0], {
46
+ wrapLinksInRadixLink: !0,
47
+ onClick: (r) => {
48
+ a[0].props?.onClick?.(r), m?.(), p?.(null);
49
+ }
50
+ })
51
+ }
52
+ )
53
+ ]
54
+ }
55
+ ) : /* @__PURE__ */ i(
56
+ "li",
57
+ {
58
+ ...o,
59
+ ref: d,
60
+ className: c(s, n, `${t}-nav__item`),
61
+ onClick: l,
62
+ ...h,
63
+ children: /* @__PURE__ */ i("span", { className: `${t}-nav__item-trigger`, children: /* @__PURE__ */ i(f, { variant: _.linkStylised, children: e }) })
64
+ }
65
+ )
66
+ );
67
+ w.displayName = "NavigationDesktopSubmenu";
68
+ export {
69
+ w as default
70
+ };
@@ -0,0 +1,31 @@
1
+ import { default as React, ComponentProps } from 'react';
2
+ export interface NavigationItemWithSubmenuProps extends ComponentProps<'li'> {
3
+ /**
4
+ * Label for the navigation item
5
+ */
6
+ label: string;
7
+ /**
8
+ * ID for the trigger - required for context-based submenu management
9
+ */
10
+ id?: string;
11
+ /**
12
+ * When set by Navigation/NavigationList, render only this variant so list items stay direct children of ul
13
+ * (no SSRMediaQuery wrapper). Prefer isMobile; renderMode is kept for backwards compatibility.
14
+ */
15
+ renderMode?: 'mobile' | 'desktop';
16
+ /**
17
+ * Explicit mobile/desktop flag injected by NavigationList; when set, takes precedence over renderMode.
18
+ */
19
+ isMobile?: boolean;
20
+ }
21
+ /**
22
+ * ## Overview
23
+ *
24
+ * Supports clicking in mobile mode and hovering in desktop mode to expand the child navigation lists
25
+ *
26
+ * [Figma Link](https://www.figma.com/design/hMu9IWH5N3KamJy8tLFdyV/EASEL-Compendium%3A-Tokens%2C-Components-%26-Patterns?node-id=10570-6295&m=dev)
27
+ *
28
+ * [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-languageselector--overview)
29
+ */
30
+ declare const NavigationItemWithSubmenu: React.ForwardRefExoticComponent<Omit<NavigationItemWithSubmenuProps, "ref"> & React.RefAttributes<HTMLLIElement>>;
31
+ export default NavigationItemWithSubmenu;
@@ -0,0 +1,68 @@
1
+ import { jsx as e, Fragment as I, jsxs as T } from "react/jsx-runtime";
2
+ import f from "../../../_virtual/index.js";
3
+ import m, { forwardRef as $ } from "react";
4
+ import y from "../../../node_modules/react-remove-scroll/dist/es2015/Combination.js";
5
+ import { SSRMediaQuery as h } from "../../../providers/SeldonProvider/utils.js";
6
+ import { HeaderContext as N } from "../../../site-furniture/Header/Header.js";
7
+ import { getCommonProps as M, findChildrenOfType as W, px as b } from "../../../utils/index.js";
8
+ import P from "../../Accordion/Accordion.js";
9
+ import R from "../../Accordion/AccordionItem.js";
10
+ import { TextVariants as E } from "../../Text/types.js";
11
+ import O from "../../Text/Text.js";
12
+ import A from "../NavigationSubmenu/NavigationSubmenu.js";
13
+ import V from "./NavigationDesktopSubmenu.js";
14
+ const v = ({ id: n, label: o, children: a }) => {
15
+ const { isMenuOpen: s } = m.useContext(N);
16
+ return /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
17
+ R,
18
+ {
19
+ hasTransition: !0,
20
+ id: `accordion-item-${n}`,
21
+ label: /* @__PURE__ */ e(O, { variant: E.linkStylised, children: o }),
22
+ children: a
23
+ },
24
+ `accordion-key-${o}`
25
+ ) }, `accordion-key-${o}-${s}`);
26
+ }, j = $(
27
+ ({ id: n, label: o, children: a, className: s, onClick: S, renderMode: k, isMobile: u, ...C }, _) => {
28
+ const { className: i, ...r } = M({ id: n }, "NavigationItemWithSubmenu"), t = W(a, A), { closeMenu: c, setActiveSubmenuId: g } = m.useContext(N), d = /* @__PURE__ */ e(
29
+ V,
30
+ {
31
+ ref: _,
32
+ navSubmenuElement: t,
33
+ itemValue: n ?? i ?? "item",
34
+ baseClassName: i,
35
+ commonProps: r,
36
+ label: o,
37
+ className: s,
38
+ onClick: S,
39
+ closeMenu: c,
40
+ setActiveSubmenuId: g,
41
+ itemProps: C
42
+ }
43
+ ), p = typeof u == "boolean" ? u ? "mobile" : "desktop" : k;
44
+ if (p === "mobile")
45
+ return /* @__PURE__ */ e("li", { className: f(i, `${b}-nav__item`), ...r, children: /* @__PURE__ */ e(v, { id: n, label: o, ...r, children: t ? m.cloneElement(t[0], {
46
+ className: `${i}__submenu--mobile`,
47
+ onClick: (l) => {
48
+ t[0].props?.onClick?.(l), c?.();
49
+ }
50
+ }) : null }) });
51
+ if (p === "desktop")
52
+ return d;
53
+ const { "data-testid": q, ...x } = r;
54
+ return /* @__PURE__ */ e(I, { children: /* @__PURE__ */ T(y, { enabled: !1, allowPinchZoom: !0, removeScrollBar: !1, children: [
55
+ /* @__PURE__ */ e(h.Media, { lessThan: "md", children: /* @__PURE__ */ e("li", { className: f(i, `${b}-nav__item`), ...x, children: /* @__PURE__ */ e(v, { id: n, label: o, ...r, children: t ? m.cloneElement(t[0], {
56
+ className: `${i}__submenu--mobile`,
57
+ onClick: (l) => {
58
+ t[0].props?.onClick?.(l), c?.();
59
+ }
60
+ }) : null }) }) }),
61
+ /* @__PURE__ */ e(h.Media, { greaterThanOrEqual: "md", children: d })
62
+ ] }) });
63
+ }
64
+ );
65
+ j.displayName = "NavigationItemWithSubmenu";
66
+ export {
67
+ j as default
68
+ };
@@ -0,0 +1,2 @@
1
+ export { default, type NavigationItemWithSubmenuProps } from './NavigationItemWithSubmenu';
2
+ export { default as NavigationDesktopSubmenu, type NavigationDesktopSubmenuProps } from './NavigationDesktopSubmenu';
@@ -9,17 +9,20 @@ export interface NavigationListProps extends React.ComponentProps<'ul'> {
9
9
  */
10
10
  isOffScreen?: boolean;
11
11
  /**
12
- * Optional left section heading
12
+ * Rewrite the onClick event
13
13
  */
14
- leftSectionHeading?: string;
14
+ onClick?: React.MouseEventHandler<HTMLElement>;
15
15
  /**
16
- * Optional right section heading
16
+ * When false (desktop), wrap in Radix NavigationMenu.List and pass desktop behavior to children.
17
+ * When true or omitted (mobile), render plain list and pass mobile behavior to children.
17
18
  */
18
- rightSectionHeading?: string;
19
- /**
20
- * Rewrite the onClick event
21
- * */
22
- onClick?: React.MouseEventHandler<HTMLElement>;
19
+ isMobile?: boolean;
23
20
  }
21
+ /**
22
+ * ## Overview
23
+ *
24
+ * Top-level nav list used inside Navigation. Renders direct children (NavigationItem, NavigationItemWithSubmenu).
25
+ * For submenu content with left/right sections, use NavigationSubmenu inside NavigationItemWithSubmenu.
26
+ */
24
27
  declare const NavigationList: React.ForwardRefExoticComponent<Omit<NavigationListProps, "ref"> & React.RefAttributes<HTMLUListElement>>;
25
28
  export default NavigationList;
@@ -1,51 +1,26 @@
1
- import { jsxs as r, jsx as d } from "react/jsx-runtime";
2
- import o from "../../../_virtual/index.js";
1
+ import { jsx as r, Fragment as p } from "react/jsx-runtime";
2
+ import f from "../../../_virtual/index.js";
3
3
  import * as a from "react";
4
- import { px as n } from "../../../utils/index.js";
5
- import { TextVariants as u } from "../../Text/types.js";
6
- import f from "../../Text/Text.js";
7
- const g = a.forwardRef(
8
- ({ id: _, children: s, className: N, isOffScreen: m, leftSectionHeading: p, rightSectionHeading: c, onClick: v }, $) => {
9
- const l = a.Children.toArray(s).map((t) => {
10
- if (a.isValidElement(t) && t.props.navGroup === "nav-link-start")
11
- return a.cloneElement(t, {
12
- onClick: (e) => {
13
- v?.(e), t.props?.onClick?.(e);
14
- }
15
- });
16
- }).filter(Boolean), i = a.Children.toArray(s).map((t) => {
17
- if (a.isValidElement(t) && t.props.navGroup === "nav-link-end")
18
- return a.cloneElement(t, {
19
- onClick: (e) => {
20
- v?.(e), t.props?.onClick?.(e);
21
- }
22
- });
23
- }).filter(Boolean);
24
- return /* @__PURE__ */ r(
25
- "ul",
26
- {
27
- "aria-hidden": m,
28
- id: _,
29
- "data-testid": _,
30
- role: "list",
31
- className: o(N, `${n}-nav__list`, { [`${n}-nav__list--offscreen`]: m }),
32
- ref: $,
33
- children: [
34
- l.length > 0 ? /* @__PURE__ */ r("div", { className: o(`${n}-nav__list__section`, `${n}-nav__list__section--start`), children: [
35
- p ? /* @__PURE__ */ d(f, { variant: u.headingMedium, className: `${n}-nav__list__section--start__title`, children: p }) : null,
36
- l
37
- ] }) : null,
38
- i.length > 0 ? /* @__PURE__ */ r("div", { className: o(`${n}-nav__list__section`, `${n}-nav__list__section--end`), children: [
39
- c ? /* @__PURE__ */ d(f, { variant: u.headingMedium, className: `${n}-nav__list__section--end__title`, children: c }) : null,
40
- i
41
- ] }) : null,
42
- !l.length && !i.length ? s : null
43
- ]
44
- }
45
- );
4
+ import { px as u } from "../../../utils/index.js";
5
+ import d from "../NavigationItem/NavigationItem.js";
6
+ import { List as c } from "../../../node_modules/@radix-ui/react-navigation-menu/dist/index.js";
7
+ import N from "../NavigationItemWithSubmenu/NavigationItemWithSubmenu.js";
8
+ function v({ children: e, isMobile: n = !0 }) {
9
+ return /* @__PURE__ */ r(p, { children: a.Children.map(e, (t) => a.isValidElement(t) && t.type === d ? a.cloneElement(t, {
10
+ isMobile: n
11
+ }) : a.isValidElement(t) && t.type === N ? a.cloneElement(t, {
12
+ isMobile: n
13
+ }) : t) });
14
+ }
15
+ const C = a.forwardRef(
16
+ ({ id: e, children: n, className: t, isOffScreen: i, onClick: g, isMobile: o = !0 }, m) => {
17
+ const s = /* @__PURE__ */ r(v, { isMobile: o, children: n }), l = f(t, `${u}-nav__list`, {
18
+ [`${u}-nav__list--offscreen`]: i
19
+ });
20
+ return o ? /* @__PURE__ */ r("ul", { "aria-hidden": i, id: e, "data-testid": e, role: "list", className: l, ref: m, children: s }) : /* @__PURE__ */ r(c, { asChild: !0, children: /* @__PURE__ */ r("ul", { "aria-hidden": i, id: e, "data-testid": e, role: "list", className: l, ref: m, children: s }) });
46
21
  }
47
22
  );
48
- g.displayName = "NavigationList";
23
+ C.displayName = "NavigationList";
49
24
  export {
50
- g as default
25
+ C as default
51
26
  };
@@ -0,0 +1,33 @@
1
+ import * as React from 'react';
2
+ export interface NavigationSubmenuProps extends React.ComponentProps<'ul'> {
3
+ /**
4
+ * id for the submenu list
5
+ */
6
+ id: string;
7
+ /**
8
+ * Optional left section heading (for nav-link-start items)
9
+ */
10
+ leftSectionHeading?: string;
11
+ /**
12
+ * Optional right section heading (for nav-link-end items, e.g. "View all")
13
+ */
14
+ rightSectionHeading?: string;
15
+ /**
16
+ * Rewrite the onClick event (e.g. close menu on link click)
17
+ */
18
+ onClick?: React.MouseEventHandler<HTMLElement>;
19
+ /**
20
+ * When true (desktop submenu content), wrap each section item in NavigationMenu.Link so submenu closes on link click
21
+ */
22
+ wrapLinksInRadixLink?: boolean;
23
+ }
24
+ /**
25
+ * ## Overview
26
+ *
27
+ * Used as the content of a submenu (inside NavigationItemWithSubmenu). Renders left and right sections
28
+ * from NavigationItem children with navGroup="nav-link-start" and navGroup="nav-link-end".
29
+ *
30
+ * Use NavigationList for the top-level nav in Navigation; use NavigationSubmenu for dropdown submenus.
31
+ */
32
+ declare const NavigationSubmenu: React.ForwardRefExoticComponent<Omit<NavigationSubmenuProps, "ref"> & React.RefAttributes<HTMLUListElement>>;
33
+ export default NavigationSubmenu;