@phillips/seldon 1.245.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.
- package/dist/_virtual/index10.js +2 -2
- package/dist/_virtual/index11.js +2 -2
- package/dist/_virtual/index6.js +5 -3
- package/dist/_virtual/index7.js +3 -5
- package/dist/_virtual/index8.js +2 -2
- package/dist/_virtual/index9.js +2 -2
- package/dist/assets/formatted/Search.js +8 -9
- package/dist/components/Accordion/Accordion.stories.d.ts +0 -1
- package/dist/components/Accordion/AccordionItem.d.ts +0 -5
- package/dist/components/Accordion/AccordionItem.js +66 -94
- package/dist/components/Accordion/index.d.ts +1 -1
- package/dist/components/Accordion/types.d.ts +0 -12
- package/dist/components/Accordion/types.js +1 -2
- package/dist/components/Accordion/utils.d.ts +2 -3
- package/dist/components/Accordion/utils.js +7 -9
- package/dist/components/AddToCalendar/calendarLinks.js +1 -1
- package/dist/components/Input/utils.js +5 -3
- package/dist/components/Navigation/Navigation.js +51 -27
- package/dist/components/Navigation/Navigation.stories.d.ts +1 -2
- package/dist/components/Navigation/NavigationItem/NavigationItem.d.ts +8 -0
- package/dist/components/Navigation/NavigationItem/NavigationItem.js +43 -42
- package/dist/components/Navigation/NavigationItemWithSubmenu/NavigationDesktopSubmenu.d.ts +17 -0
- package/dist/components/Navigation/NavigationItemWithSubmenu/NavigationDesktopSubmenu.js +70 -0
- package/dist/components/Navigation/NavigationItemWithSubmenu/NavigationItemWithSubmenu.d.ts +31 -0
- package/dist/components/Navigation/NavigationItemWithSubmenu/NavigationItemWithSubmenu.js +68 -0
- package/dist/components/Navigation/NavigationItemWithSubmenu/index.d.ts +2 -0
- package/dist/components/Navigation/NavigationList/NavigationList.d.ts +11 -8
- package/dist/components/Navigation/NavigationList/NavigationList.js +21 -46
- package/dist/components/Navigation/NavigationSubmenu/NavigationSubmenu.d.ts +33 -0
- package/dist/components/Navigation/NavigationSubmenu/NavigationSubmenu.js +41 -0
- package/dist/components/Navigation/NavigationSubmenu/NavigationSubmenu.test.d.ts +1 -0
- package/dist/components/Search/Search.js +51 -47
- package/dist/components/Search/SearchButton.js +10 -10
- package/dist/components/Search/SearchResults/SearchResults.d.ts +2 -1
- package/dist/components/Search/SearchResults/SearchResults.js +22 -21
- package/dist/index.d.ts +3 -1
- package/dist/index.js +236 -233
- package/dist/node_modules/@radix-ui/react-navigation-menu/dist/index.js +597 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/primitive/dist/index.js +9 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-collection/dist/index.js +50 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +127 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-presence/dist/index.js +70 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-primitive/dist/index.js +36 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-slot/dist/index.js +49 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +52 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-visually-hidden/dist/index.js +32 -0
- package/dist/node_modules/ics/dist/index.js +1 -1
- package/dist/node_modules/ics/dist/pipeline/index.js +1 -1
- package/dist/node_modules/prop-types/index.js +1 -1
- package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/react-transition-group/esm/CSSTransition.js +1 -1
- package/dist/node_modules/react-transition-group/esm/Transition.js +1 -1
- package/dist/node_modules/react-transition-group/esm/utils/PropTypes.js +1 -1
- package/dist/patterns/UserManagement/UserManagement.js +45 -27
- package/dist/scss/componentStyles.scss +1 -1
- package/dist/scss/components/Accordion/_accordion.scss +6 -12
- package/dist/scss/components/Navigation/NavigationItem/_navigationItem.scss +0 -12
- package/dist/scss/components/Navigation/NavigationItemWithSubmenu/_navigationItemWithSubmenu.scss +114 -0
- package/dist/scss/components/Navigation/NavigationList/_navigationList.scss +15 -3
- package/dist/scss/components/Navigation/_navigation.scss +109 -0
- package/dist/scss/components/Search/_search.scss +1 -0
- package/dist/scss/site-furniture/Header/_header.scss +24 -0
- package/dist/site-furniture/Header/Header.d.ts +8 -4
- package/dist/site-furniture/Header/Header.js +55 -50
- package/dist/site-furniture/Header/Header.stories.d.ts +278 -0
- package/dist/site-furniture/Header/utils.js +1 -2
- package/package.json +5 -1
- package/dist/components/Navigation/NavigationItemTrigger/NavigationItemTrigger.d.ts +0 -22
- package/dist/components/Navigation/NavigationItemTrigger/NavigationItemTrigger.js +0 -80
- package/dist/scss/components/Navigation/NavigationItemTrigger/_navigationItemTrigger.scss +0 -111
- /package/dist/components/Navigation/{NavigationItemTrigger/NavigationItemTrigger.test.d.ts → NavigationItemWithSubmenu/NavigationItemWithSubmenu.test.d.ts} +0 -0
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { px as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { LinkVariants as
|
|
6
|
-
import { forwardRef as
|
|
7
|
-
|
|
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:
|
|
10
|
-
className:
|
|
11
|
-
href:
|
|
12
|
-
isViewAllLink:
|
|
13
|
-
label:
|
|
14
|
-
navGroup:
|
|
15
|
-
navType:
|
|
16
|
-
onClick:
|
|
17
|
-
element:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
45
|
+
g.displayName = "NavigationItem";
|
|
45
46
|
export {
|
|
46
|
-
|
|
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
|
+
};
|
|
@@ -9,17 +9,20 @@ export interface NavigationListProps extends React.ComponentProps<'ul'> {
|
|
|
9
9
|
*/
|
|
10
10
|
isOffScreen?: boolean;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Rewrite the onClick event
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
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
|
-
|
|
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 {
|
|
2
|
-
import
|
|
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
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
23
|
+
C.displayName = "NavigationList";
|
|
49
24
|
export {
|
|
50
|
-
|
|
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;
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -18,66 +18,66 @@ const X = j(
|
|
|
18
18
|
onSearch: S,
|
|
19
19
|
onCancel: _,
|
|
20
20
|
searchResults: N = [],
|
|
21
|
-
state:
|
|
21
|
+
state: i = "idle",
|
|
22
22
|
defaultValue: R = "",
|
|
23
|
-
className:
|
|
23
|
+
className: b,
|
|
24
24
|
placeholder: I = "",
|
|
25
|
-
searchButtonText:
|
|
26
|
-
loadingText:
|
|
27
|
-
invalidText:
|
|
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":
|
|
33
|
-
S(
|
|
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(
|
|
36
|
-
_?.(), p(!1),
|
|
35
|
+
z($, (a) => {
|
|
36
|
+
_?.(), p(!1), a.stopPropagation();
|
|
37
37
|
});
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
if (
|
|
41
|
-
const V = w(v(
|
|
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
|
-
|
|
44
|
+
a.currentTarget instanceof HTMLAnchorElement && (h(!1), a.currentTarget.click());
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
a.key === "Escape" && (m.current?.reset(), c.setIsSearchExpanded(!1));
|
|
47
47
|
};
|
|
48
48
|
O(() => {
|
|
49
|
-
if (
|
|
49
|
+
if (r) {
|
|
50
50
|
d.current?.focus();
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
}, [
|
|
54
|
-
const p = (
|
|
55
|
-
m.current?.reset(), c.setIsSearchExpanded(
|
|
53
|
+
}, [r]);
|
|
54
|
+
const p = (a) => {
|
|
55
|
+
m.current?.reset(), c.setIsSearchExpanded(a);
|
|
56
56
|
};
|
|
57
|
-
return /* @__PURE__ */ t(J, { enabled:
|
|
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:
|
|
62
|
-
onClick: (
|
|
63
|
-
|
|
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:
|
|
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,
|
|
72
|
-
"data-testid":
|
|
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": `${
|
|
78
|
+
"data-testid": `${n}-form`,
|
|
79
79
|
className: s(`${e}__form`, {
|
|
80
|
-
[`${e}__form--active`]:
|
|
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`]:
|
|
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:
|
|
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": !
|
|
105
|
+
"aria-hidden": !r,
|
|
104
106
|
className: `${e}__input`,
|
|
105
107
|
id: "search-input",
|
|
106
108
|
hideLabel: !0,
|
|
107
|
-
labelText:
|
|
108
|
-
placeholder:
|
|
109
|
+
labelText: l,
|
|
110
|
+
placeholder: r ? I : "",
|
|
109
111
|
type: "text",
|
|
110
112
|
defaultValue: R,
|
|
111
|
-
invalid:
|
|
112
|
-
invalidText:
|
|
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:
|
|
125
|
-
state:
|
|
126
|
-
testId:
|
|
127
|
-
isSearchExpanded:
|
|
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
|
-
|
|
138
|
+
r && T && o && o.length > 2 ? /* @__PURE__ */ t(
|
|
136
139
|
U,
|
|
137
140
|
{
|
|
141
|
+
id: `${n}-listbox`,
|
|
138
142
|
autoCompleteResults: N,
|
|
139
|
-
isLoading:
|
|
140
|
-
loadingText:
|
|
141
|
-
onKeyDown:
|
|
142
|
-
userInputValue:
|
|
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(
|
|
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
|
)
|