@phillips/seldon 1.51.1 → 1.53.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/assets/account_circle.svg.js +2 -2
- package/dist/assets/minus.svg.js +1 -1
- package/dist/assets/plus.svg.js +1 -1
- package/dist/components/Accordion/AccordionItem.d.ts +8 -4
- package/dist/components/Accordion/AccordionItem.js +67 -65
- package/dist/components/Collapsible/Collapsible.d.ts +10 -0
- package/dist/components/Collapsible/Collapsible.js +13 -0
- package/dist/components/Collapsible/CollapsibleContent.d.ts +11 -0
- package/dist/components/Collapsible/CollapsibleContent.js +21 -0
- package/dist/components/Collapsible/CollapsibleTrigger.d.ts +10 -0
- package/dist/components/Collapsible/CollapsibleTrigger.js +21 -0
- package/dist/components/Collapsible/index.d.ts +3 -0
- package/dist/components/Dropdown/Dropdown.d.ts +2 -2
- package/dist/components/Header/Header.d.ts +20 -13
- package/dist/components/Header/Header.js +73 -76
- package/dist/components/Header/utils.d.ts +2 -9
- package/dist/components/Header/utils.js +3 -7
- package/dist/components/LanguageSelector/LanguageSelector.d.ts +36 -0
- package/dist/components/LanguageSelector/LanguageSelector.js +73 -0
- package/dist/components/LanguageSelector/index.d.ts +1 -0
- package/dist/components/Link/Link.d.ts +3 -11
- package/dist/components/Link/index.d.ts +2 -0
- package/dist/components/Navigation/Navigation.d.ts +12 -4
- package/dist/components/Navigation/Navigation.js +34 -51
- package/dist/components/Navigation/NavigationItem/NavigationItem.d.ts +15 -10
- package/dist/components/Navigation/NavigationItem/NavigationItem.js +19 -37
- package/dist/components/Navigation/NavigationItemTrigger/NavigationItemTrigger.d.ts +12 -3
- package/dist/components/Navigation/NavigationItemTrigger/NavigationItemTrigger.js +33 -29
- package/dist/components/Navigation/NavigationList/NavigationList.d.ts +2 -2
- package/dist/components/Navigation/NavigationList/NavigationList.js +31 -32
- package/dist/components/ReadMore/ReadMore.d.ts +35 -0
- package/dist/components/ReadMore/ReadMore.js +57 -0
- package/dist/components/ReadMore/index.d.ts +1 -0
- package/dist/components/Search/Search.d.ts +1 -1
- package/dist/components/Search/Search.js +134 -122
- package/dist/components/Search/SearchButton.js +21 -17
- package/dist/components/Search/SearchResults/SearchResults.js +14 -13
- package/dist/components/UserManagement/UserManagement.d.ts +21 -13
- package/dist/components/UserManagement/UserManagement.js +31 -61
- package/dist/index.d.ts +3 -0
- package/dist/index.js +87 -76
- package/dist/scss/_utils.scss +13 -3
- package/dist/scss/_vars.scss +30 -11
- package/dist/scss/componentStyles.scss +2 -0
- package/dist/scss/components/Accordion/_accordion.scss +3 -0
- package/dist/scss/components/Button/_button.scss +2 -2
- package/dist/scss/components/Dropdown/_dropdown.scss +2 -0
- package/dist/scss/components/Header/_header.scss +72 -86
- package/dist/scss/components/LanguageSelector/_languageSelector.scss +47 -0
- package/dist/scss/components/Link/_link.scss +15 -4
- package/dist/scss/components/LinkList/_linkList.scss +4 -0
- package/dist/scss/components/Navigation/NavigationItem/_navigationItem.scss +4 -119
- package/dist/scss/components/Navigation/NavigationItemTrigger/_navigationItemTrigger.scss +75 -0
- package/dist/scss/components/Navigation/NavigationList/_navigationList.scss +29 -42
- package/dist/scss/components/Navigation/_navigation.scss +24 -82
- package/dist/scss/components/ReadMore/_readMore.scss +58 -0
- package/dist/scss/components/Search/SearchResults/_searchResults.scss +1 -25
- package/dist/scss/components/Search/_search.scss +48 -7
- package/dist/scss/components/Search/_searchButton.scss +6 -2
- package/dist/scss/components/UserManagement/_userManagement.scss +33 -94
- package/dist/scss/components/Video/_video.scss +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +31 -24
- package/package.json +3 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsxs as b, Fragment as h, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as L } from "react";
|
|
3
|
+
import { getCommonProps as N, noOp as x } from "../../utils/index.js";
|
|
4
|
+
import C from "../../node_modules/classnames/index.js";
|
|
5
|
+
import { SupportedLanguages as s } from "../../types/commonTypes.js";
|
|
6
|
+
import S from "../Dropdown/Dropdown.js";
|
|
7
|
+
import k from "../Accordion/Accordion.js";
|
|
8
|
+
import w from "../Accordion/AccordionItem.js";
|
|
9
|
+
import y from "../Navigation/NavigationItem/NavigationItem.js";
|
|
10
|
+
import { LinkVariants as P } from "../Link/types.js";
|
|
11
|
+
import { TextVariants as T } from "../Text/types.js";
|
|
12
|
+
import V from "../Text/Text.js";
|
|
13
|
+
import j from "../Navigation/NavigationList/NavigationList.js";
|
|
14
|
+
const A = ({
|
|
15
|
+
id: o,
|
|
16
|
+
value: n,
|
|
17
|
+
// can't be passed to the accordion
|
|
18
|
+
onValueChange: r,
|
|
19
|
+
label: t,
|
|
20
|
+
options: l,
|
|
21
|
+
...m
|
|
22
|
+
}) => /* @__PURE__ */ e(k, { ...m, children: /* @__PURE__ */ e(
|
|
23
|
+
w,
|
|
24
|
+
{
|
|
25
|
+
variation: "sm",
|
|
26
|
+
id: o != null ? o : "language-selector-accordion",
|
|
27
|
+
label: /* @__PURE__ */ e(V, { variant: T.snwHeaderLink, children: t }),
|
|
28
|
+
children: /* @__PURE__ */ e(j, { id: `${o}-navlist`, children: l.map((a) => /* @__PURE__ */ e(
|
|
29
|
+
y,
|
|
30
|
+
{
|
|
31
|
+
label: a.label,
|
|
32
|
+
onClick: () => r(a.value),
|
|
33
|
+
navType: P.snwFlyoutLink
|
|
34
|
+
},
|
|
35
|
+
a.value
|
|
36
|
+
)) })
|
|
37
|
+
}
|
|
38
|
+
) }), E = L(
|
|
39
|
+
({
|
|
40
|
+
className: o,
|
|
41
|
+
currentLanguage: n = s.en,
|
|
42
|
+
languageOptions: r = [
|
|
43
|
+
{ label: "English", value: s.en },
|
|
44
|
+
{ label: "中文", value: s.zh }
|
|
45
|
+
],
|
|
46
|
+
onLanguageChange: t = x,
|
|
47
|
+
id: l,
|
|
48
|
+
isHidden: m,
|
|
49
|
+
...a
|
|
50
|
+
}, c) => {
|
|
51
|
+
var g, f;
|
|
52
|
+
const { className: p, ...v } = N({ id: l }, "LanguageSelector"), d = (f = (g = r.find((i) => i.value === n)) == null ? void 0 : g.label) != null ? f : "English", u = {
|
|
53
|
+
...v,
|
|
54
|
+
...a,
|
|
55
|
+
id: l,
|
|
56
|
+
className: C(p, o, {
|
|
57
|
+
[`${p}--hidden`]: m
|
|
58
|
+
}),
|
|
59
|
+
options: r,
|
|
60
|
+
value: n,
|
|
61
|
+
onValueChange: (i) => t(i),
|
|
62
|
+
label: d
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ b(h, { children: [
|
|
65
|
+
/* @__PURE__ */ e(S, { ...u, ref: c }),
|
|
66
|
+
/* @__PURE__ */ e(A, { ...u, ref: c })
|
|
67
|
+
] });
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
E.displayName = "LanguageSelector";
|
|
71
|
+
export {
|
|
72
|
+
E as default
|
|
73
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LanguageSelector, type LanguageSelectorProps } from './LanguageSelector';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentProps, ElementType } from 'react';
|
|
2
2
|
import { LinkVariants } from './types';
|
|
3
|
-
export interface LinkProps extends
|
|
3
|
+
export interface LinkProps extends ComponentProps<'a'> {
|
|
4
4
|
/**
|
|
5
5
|
* Describes where the link is used. It controls the styling of the link so we apply consistent styles. Defaults to `standalone`. See the documentation [here](https://www.figma.com/file/xMuOXOAKVt5HC7hgYjF3ot/Components-v2.0?type=design&node-id=5731-12815) to see where each variant is used.
|
|
6
6
|
*
|
|
@@ -8,19 +8,11 @@ export interface LinkProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
|
8
8
|
* @see LinkVariants
|
|
9
9
|
*/
|
|
10
10
|
variant?: LinkVariants;
|
|
11
|
-
/**
|
|
12
|
-
* The text of the link
|
|
13
|
-
*/
|
|
14
|
-
children: React.ReactNode;
|
|
15
|
-
/**
|
|
16
|
-
* URL to navigate to when clicked
|
|
17
|
-
*/
|
|
18
|
-
href?: string;
|
|
19
11
|
/**
|
|
20
12
|
* Can be used to render alternative link components like the prefetching `Link` from `@remix-run/react`.
|
|
21
13
|
* This component should handle the `children`, `data-testid`, `id`, `className`, and `href` props.
|
|
22
14
|
*/
|
|
23
|
-
element?:
|
|
15
|
+
element?: ElementType<LinkProps & {
|
|
24
16
|
'data-testid': string;
|
|
25
17
|
}>;
|
|
26
18
|
}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
export interface NavigationProps extends
|
|
3
|
-
backBtnLabel?: string;
|
|
1
|
+
import React, { ComponentProps } from 'react';
|
|
2
|
+
export interface NavigationProps extends ComponentProps<'nav'> {
|
|
4
3
|
/**
|
|
5
4
|
* Optional visible state
|
|
6
5
|
*/
|
|
7
6
|
visible?: boolean;
|
|
8
7
|
}
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* ## Overview
|
|
10
|
+
*
|
|
11
|
+
* This is used within the Header component and displays the site navigation links. It support both mobile and desktop.
|
|
12
|
+
*
|
|
13
|
+
* [Figma Link](https://www.figma.com/design/hMu9IWH5N3KamJy8tLFdyV/EASEL-Compendium%3A-Tokens%2C-Components-%26-Patterns?node-id=10570-5784&m=dev)
|
|
14
|
+
*
|
|
15
|
+
* [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-navigation--overview)
|
|
16
|
+
*/
|
|
17
|
+
declare const Navigation: React.ForwardRefExoticComponent<Omit<NavigationProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
10
18
|
export default Navigation;
|
|
@@ -1,54 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { findChildrenOfType as
|
|
4
|
-
import
|
|
5
|
-
import { HeaderContext as
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
children: i,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
className: `${a}-nav__back-btn`,
|
|
30
|
-
onClick: h,
|
|
31
|
-
children: f
|
|
32
|
-
}
|
|
33
|
-
),
|
|
34
|
-
/* @__PURE__ */ c(
|
|
35
|
-
"h2",
|
|
36
|
-
{
|
|
37
|
-
id: `${e}-label`,
|
|
38
|
-
"data-testid": `${e}-label`,
|
|
39
|
-
className: b(`${a}-nav__label`, { [`${a}-nav__label--hidden`]: !s }),
|
|
40
|
-
style: { "--visible": s ? "visible" : "hidden" },
|
|
41
|
-
children: n || "Main Menu"
|
|
42
|
-
}
|
|
43
|
-
),
|
|
44
|
-
/* @__PURE__ */ r("div", { className: `${a}-nav__list-container`, children: [
|
|
45
|
-
l.isValidElement(t == null ? void 0 : t[0]) ? l.cloneElement(t[0], { isOffScreen: $ }) : void 0,
|
|
46
|
-
u
|
|
1
|
+
import { jsx as x, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import e, { forwardRef as E } from "react";
|
|
3
|
+
import { findChildrenOfType as l, findChildrenExcludingTypes as N, px as d } from "../../utils/index.js";
|
|
4
|
+
import C from "../../node_modules/classnames/index.js";
|
|
5
|
+
import { HeaderContext as y } from "../Header/Header.js";
|
|
6
|
+
import m from "./NavigationList/NavigationList.js";
|
|
7
|
+
import c from "../LanguageSelector/LanguageSelector.js";
|
|
8
|
+
const S = E(
|
|
9
|
+
({ children: i, className: f, id: n, visible: p = !0, ...v }, g) => {
|
|
10
|
+
var r, s;
|
|
11
|
+
const { isSearchExpanded: a } = e.useContext(y), o = (r = l(i, m)) == null ? void 0 : r[0], u = N(i, [m, c]), t = (s = l(i, c)) == null ? void 0 : s[0];
|
|
12
|
+
return /* @__PURE__ */ x(
|
|
13
|
+
"nav",
|
|
14
|
+
{
|
|
15
|
+
role: "navigation",
|
|
16
|
+
"data-testid": n,
|
|
17
|
+
id: n,
|
|
18
|
+
style: { "--visible": p ? "visible" : "hidden" },
|
|
19
|
+
className: C(`${d}-nav`, f),
|
|
20
|
+
...v,
|
|
21
|
+
ref: g,
|
|
22
|
+
children: /* @__PURE__ */ h("div", { className: `${d}-nav__list-container`, children: [
|
|
23
|
+
u,
|
|
24
|
+
e.isValidElement(o) ? e.cloneElement(o, { isOffScreen: a }) : void 0,
|
|
25
|
+
/* This is not visible through css when in desktop breakpoint */
|
|
26
|
+
e.isValidElement(t) && t ? e.cloneElement(t, {
|
|
27
|
+
isHidden: a
|
|
28
|
+
}) : void 0
|
|
47
29
|
] })
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
S.displayName = "Navigation";
|
|
52
35
|
export {
|
|
53
|
-
|
|
36
|
+
S as default
|
|
54
37
|
};
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { LinkProps } from '../../Link/Link';
|
|
3
2
|
import { LinkVariants } from '../../Link/types';
|
|
4
|
-
|
|
3
|
+
import { ComponentProps, ElementType, ReactNode } from 'react';
|
|
4
|
+
export interface NavigationItemProps extends ComponentProps<'li'> {
|
|
5
5
|
/**
|
|
6
6
|
* Optional badge for navigation item. Used currently for location of auctions
|
|
7
7
|
*/
|
|
8
|
-
badge?:
|
|
8
|
+
badge?: ReactNode;
|
|
9
9
|
/**
|
|
10
10
|
* href link
|
|
11
11
|
*/
|
|
12
12
|
href?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Optional listen to onClick event
|
|
15
|
-
*/
|
|
16
|
-
onClick?: (event: React.MouseEvent<HTMLLIElement>) => void;
|
|
17
13
|
/**
|
|
18
14
|
* Label for the navigation item
|
|
19
15
|
*/
|
|
20
|
-
label?:
|
|
16
|
+
label?: ReactNode;
|
|
21
17
|
/**
|
|
22
18
|
* Optional group for navigation items
|
|
23
19
|
*/
|
|
@@ -29,7 +25,16 @@ export interface NavigationItemProps extends Omit<React.HTMLAttributes<HTMLLIEle
|
|
|
29
25
|
/**
|
|
30
26
|
* Element to render within the navigation item, renders <Link> by default
|
|
31
27
|
*/
|
|
32
|
-
element?:
|
|
28
|
+
element?: ElementType<LinkProps>;
|
|
33
29
|
}
|
|
34
|
-
|
|
30
|
+
/**
|
|
31
|
+
* ## Overview
|
|
32
|
+
*
|
|
33
|
+
* Renders a styled link within the Header->Navigation component. It supports both mobile and desktop layouts. It can be used with Remix links as well.
|
|
34
|
+
*
|
|
35
|
+
* [Figma Link](https://www.figma.com/design/hMu9IWH5N3KamJy8tLFdyV/EASEL-Compendium%3A-Tokens%2C-Components-%26-Patterns?node-id=10570-6295&m=dev)
|
|
36
|
+
*
|
|
37
|
+
* [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-languageselector--overview)
|
|
38
|
+
*/
|
|
39
|
+
declare const NavigationItem: import("react").ForwardRefExoticComponent<Omit<NavigationItemProps, "ref"> & import("react").RefAttributes<HTMLLIElement>>;
|
|
35
40
|
export default NavigationItem;
|
|
@@ -1,44 +1,26 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
badge: a,
|
|
10
|
-
className: r = "",
|
|
11
|
-
href: i,
|
|
12
|
-
label: n,
|
|
13
|
-
navGroup: s,
|
|
14
|
-
navType: m,
|
|
15
|
-
onClick: o,
|
|
16
|
-
element: l = _,
|
|
17
|
-
...d
|
|
18
|
-
}) => {
|
|
19
|
-
const { expandedItem: c } = f.useContext($);
|
|
20
|
-
return /* @__PURE__ */ e(
|
|
1
|
+
import { jsx as a, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { px as i } from "../../../utils/index.js";
|
|
3
|
+
import f from "../../../node_modules/classnames/index.js";
|
|
4
|
+
import v from "../../Link/Link.js";
|
|
5
|
+
import { LinkVariants as N } from "../../Link/types.js";
|
|
6
|
+
import { forwardRef as _ } from "react";
|
|
7
|
+
const $ = _(
|
|
8
|
+
({ badge: e, className: t = "", href: n, label: m, navGroup: s, navType: r, onClick: o, element: l = v, ...d }, p) => /* @__PURE__ */ a(
|
|
21
9
|
"li",
|
|
22
10
|
{
|
|
23
11
|
...d,
|
|
24
12
|
onClick: o,
|
|
25
|
-
"data-testid": `nav-item-${
|
|
26
|
-
className:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
tabIndex: c === "" ? 0 : -1,
|
|
33
|
-
children: [
|
|
34
|
-
/* @__PURE__ */ e("span", { className: `${t}-nav__item--label`, children: n }),
|
|
35
|
-
a ? /* @__PURE__ */ e("span", { className: `${t}-nav__item--badge `, children: ` • ${a}` }) : null
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
)
|
|
13
|
+
"data-testid": `nav-item-${m}`,
|
|
14
|
+
className: f(`${i}-nav__item`, s, t),
|
|
15
|
+
ref: p,
|
|
16
|
+
children: /* @__PURE__ */ c(l, { href: n, variant: r || N.snwHeaderLink, children: [
|
|
17
|
+
/* @__PURE__ */ a("span", { className: `${i}-nav__item--label`, children: m }),
|
|
18
|
+
e ? /* @__PURE__ */ a("span", { className: `${i}-nav__item--badge `, children: ` • ${e}` }) : null
|
|
19
|
+
] })
|
|
39
20
|
}
|
|
40
|
-
)
|
|
41
|
-
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
$.displayName = "NavigationItem";
|
|
42
24
|
export {
|
|
43
|
-
|
|
25
|
+
$ as default
|
|
44
26
|
};
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
export interface NavigationItemTriggerProps extends
|
|
1
|
+
import React, { ComponentProps } from 'react';
|
|
2
|
+
export interface NavigationItemTriggerProps extends ComponentProps<'li'> {
|
|
3
3
|
/**
|
|
4
4
|
* Label for the navigation item
|
|
5
5
|
*/
|
|
6
6
|
label: string;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* ## Overview
|
|
10
|
+
*
|
|
11
|
+
* Supports clicking in mobile mode and hovering in desktop mode to expand the child navigation lists
|
|
12
|
+
*
|
|
13
|
+
* [Figma Link](https://www.figma.com/design/hMu9IWH5N3KamJy8tLFdyV/EASEL-Compendium%3A-Tokens%2C-Components-%26-Patterns?node-id=10570-6295&m=dev)
|
|
14
|
+
*
|
|
15
|
+
* [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-languageselector--overview)
|
|
16
|
+
*/
|
|
17
|
+
declare const NavigationItemTrigger: React.ForwardRefExoticComponent<Omit<NavigationItemTriggerProps, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
9
18
|
export default NavigationItemTrigger;
|
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
1
|
+
import { jsxs as f, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { getCommonProps as g, findChildrenOfType as v, px as s } from "../../../utils/index.js";
|
|
3
|
+
import N from "../../../node_modules/classnames/index.js";
|
|
4
|
+
import _, { forwardRef as x, useState as b } from "react";
|
|
5
|
+
import { TextVariants as T } from "../../Text/types.js";
|
|
6
|
+
import h from "../../Text/Text.js";
|
|
7
|
+
import O from "../NavigationList/NavigationList.js";
|
|
8
|
+
const I = x(
|
|
9
|
+
({ id: n, label: i, children: m, className: l, onClick: p, ...d }, u) => {
|
|
10
|
+
const { className: e, ...c } = g({ id: n }, "NavigationItemTrigger"), [t, a] = b(!1), r = v(m, O);
|
|
11
|
+
return /* @__PURE__ */ f(
|
|
12
|
+
"li",
|
|
13
|
+
{
|
|
14
|
+
...c,
|
|
15
|
+
ref: u,
|
|
16
|
+
"aria-expanded": t,
|
|
17
|
+
className: N(l, e, `${s}-nav__item`, {
|
|
18
|
+
[`${e}--hovered`]: t
|
|
19
|
+
}),
|
|
20
|
+
onClick: p,
|
|
21
|
+
onMouseOver: () => a(!0),
|
|
22
|
+
onMouseOut: () => a(!1),
|
|
23
|
+
...d,
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ o("button", { className: `${s}-nav__item-trigger`, type: "button", children: /* @__PURE__ */ o(h, { variant: T.snwHeaderLink, children: i }) }),
|
|
26
|
+
r ? _.cloneElement(r[0], { className: `${e}__submenu` }) : void 0
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
I.displayName = "NavigationItemTrigger";
|
|
29
33
|
export {
|
|
30
|
-
|
|
34
|
+
I as default
|
|
31
35
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export interface NavigationListProps extends React.
|
|
2
|
+
export interface NavigationListProps extends React.ComponentProps<'ul'> {
|
|
3
3
|
/**
|
|
4
4
|
* id for the navigation list
|
|
5
5
|
*/
|
|
@@ -9,5 +9,5 @@ export interface NavigationListProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
9
9
|
*/
|
|
10
10
|
isOffScreen?: boolean;
|
|
11
11
|
}
|
|
12
|
-
declare const NavigationList: React.
|
|
12
|
+
declare const NavigationList: React.ForwardRefExoticComponent<Omit<NavigationListProps, "ref"> & React.RefAttributes<HTMLUListElement>>;
|
|
13
13
|
export default NavigationList;
|
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as p, jsx as _ } from "react/jsx-runtime";
|
|
2
2
|
import * as r from "react";
|
|
3
3
|
import { px as a } from "../../../utils/index.js";
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
4
|
+
import e from "../../../node_modules/classnames/index.js";
|
|
5
|
+
const c = r.forwardRef(
|
|
6
|
+
({ id: i, children: s, className: m, isOffScreen: o }, v) => {
|
|
7
|
+
const n = r.Children.toArray(s).filter((t) => {
|
|
8
|
+
if (t && t.props.navGroup === "nav-link-lg")
|
|
9
|
+
return t;
|
|
10
|
+
}), l = r.Children.toArray(s).filter((t) => {
|
|
11
|
+
if (t && t.props.navGroup === "nav-link-sm")
|
|
12
|
+
return t;
|
|
13
|
+
});
|
|
14
|
+
return /* @__PURE__ */ p(
|
|
15
|
+
"ul",
|
|
16
|
+
{
|
|
17
|
+
"aria-hidden": o,
|
|
18
|
+
id: i,
|
|
19
|
+
"data-testid": i,
|
|
20
|
+
role: "list",
|
|
21
|
+
className: e(m, `${a}-nav__list`, { [`${a}-nav__list--offscreen`]: o }),
|
|
22
|
+
ref: v,
|
|
23
|
+
children: [
|
|
24
|
+
n.length > 0 ? /* @__PURE__ */ _("div", { className: e(`${a}-nav__list__section`, `${a}-nav__list__section--large-cta`), children: n }) : null,
|
|
25
|
+
l.length > 0 ? /* @__PURE__ */ _("div", { className: e(`${a}-nav__list__section`, `${a}-nav__list__section--small-cta`), children: l }) : null,
|
|
26
|
+
!n.length && !l.length ? s : null
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
c.displayName = "NavigationList";
|
|
34
33
|
export {
|
|
35
|
-
|
|
34
|
+
c as default
|
|
36
35
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ReadMoreProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Unique id for component testing
|
|
5
|
+
*/
|
|
6
|
+
id?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Child element pass in to display as item content.
|
|
9
|
+
*/
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Text for the "Read More" button
|
|
13
|
+
*/
|
|
14
|
+
readMoreText?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Text for the "Read Less" button
|
|
17
|
+
*/
|
|
18
|
+
readLessText?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum height of the content when collapsed
|
|
21
|
+
*/
|
|
22
|
+
maxHeight?: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* ## Overview
|
|
26
|
+
*
|
|
27
|
+
* A component for displaying expandable content with a "Read More" functionality.
|
|
28
|
+
*
|
|
29
|
+
* This component is a wrapper around the Collapsible and Button component and uses the CollapsibleTrigger and CollapsibleContent components to control the expand and collapse functionality.
|
|
30
|
+
*
|
|
31
|
+
* [Figma Link](https://www.figma.com/design/hMu9IWH5N3KamJy8tLFdyV/EASEL-Compendium%3A-Tokens%2C-Components-%26-Patterns?node-id=7755-5572&t=JCYbkM8yQcdb51UQ-4)
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
declare const ReadMore: React.ForwardRefExoticComponent<ReadMoreProps & React.RefAttributes<HTMLDivElement>>;
|
|
35
|
+
export default ReadMore;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsxs as m, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as N, useState as i, useRef as R, useEffect as x, useCallback as $ } from "react";
|
|
3
|
+
import c from "../../node_modules/classnames/index.js";
|
|
4
|
+
import { getCommonProps as M } from "../../utils/index.js";
|
|
5
|
+
import b from "../Button/Button.js";
|
|
6
|
+
import { ButtonVariants as w } from "../Button/types.js";
|
|
7
|
+
import E from "../Collapsible/Collapsible.js";
|
|
8
|
+
import O from "../Collapsible/CollapsibleContent.js";
|
|
9
|
+
import P from "../Collapsible/CollapsibleTrigger.js";
|
|
10
|
+
import S from "../../assets/plus.svg.js";
|
|
11
|
+
import j from "../../assets/minus.svg.js";
|
|
12
|
+
const B = N(
|
|
13
|
+
({ className: d, children: l, readMoreText: f = "Read More", readLessText: u = "Read Less", maxHeight: s = 480, ...o }, p) => {
|
|
14
|
+
const { className: e, ...g } = M(o, "ReadMore"), [a, v] = i(!1), [n, C] = i(!1), t = R(null);
|
|
15
|
+
x(() => {
|
|
16
|
+
t.current && C(t.current.scrollHeight > s);
|
|
17
|
+
}, [l, s]);
|
|
18
|
+
const h = $(() => {
|
|
19
|
+
v((y) => !y);
|
|
20
|
+
}, []);
|
|
21
|
+
return /* @__PURE__ */ m(
|
|
22
|
+
E,
|
|
23
|
+
{
|
|
24
|
+
id: o == null ? void 0 : o.id,
|
|
25
|
+
open: a,
|
|
26
|
+
onOpenChange: h,
|
|
27
|
+
className: c(e, d),
|
|
28
|
+
style: {
|
|
29
|
+
"--read-more-max-height": `${s}px`
|
|
30
|
+
},
|
|
31
|
+
ref: p,
|
|
32
|
+
...g,
|
|
33
|
+
...o,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ r(O, { className: `${e}-content`, ref: t, forceMount: !0, children: l }),
|
|
36
|
+
n ? /* @__PURE__ */ r(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
className: c(`${e}-overlay`, {
|
|
40
|
+
[`${e}-overlay--expanded`]: a,
|
|
41
|
+
[`${e}-overlay--gradient`]: n && !a
|
|
42
|
+
}),
|
|
43
|
+
children: /* @__PURE__ */ r("div", { className: `${e}-overlay-trigger-wrapper`, children: /* @__PURE__ */ r(P, { asChild: !0, className: `${e}-overlay-trigger`, children: /* @__PURE__ */ m(b, { variant: w.secondary, children: [
|
|
44
|
+
a ? /* @__PURE__ */ r(j, {}) : /* @__PURE__ */ r(S, {}),
|
|
45
|
+
a ? u : f
|
|
46
|
+
] }) }) })
|
|
47
|
+
}
|
|
48
|
+
) : null
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
B.displayName = "ReadMore";
|
|
55
|
+
export {
|
|
56
|
+
B as default
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ReadMore, type ReadMoreProps } from './ReadMore';
|