@ilo-org/react 0.2.1 → 0.4.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/CHANGELOG.md +26 -0
- package/README.md +1 -1
- package/lib/cjs/{DailyMotion-2aa7f048.js → DailyMotion-5654fa6e.js} +1 -1
- package/lib/cjs/{Facebook-87e24af8.js → Facebook-1924e510.js} +1 -1
- package/lib/cjs/{FilePlayer-e1216cc8.js → FilePlayer-9c697e42.js} +1 -1
- package/lib/cjs/{Kaltura-a673a8e9.js → Kaltura-177bb003.js} +1 -1
- package/lib/cjs/{Mixcloud-f9575c31.js → Mixcloud-91a772a6.js} +1 -1
- package/lib/cjs/{Preview-468c3a7f.js → Preview-8e2afb6a.js} +1 -1
- package/lib/cjs/{SoundCloud-7c59f293.js → SoundCloud-089e0f30.js} +1 -1
- package/lib/cjs/{Streamable-83e516e5.js → Streamable-4ca5b9c7.js} +1 -1
- package/lib/cjs/{Twitch-fdfa1c77.js → Twitch-dbc5c387.js} +1 -1
- package/lib/cjs/{VideoPlayer-9ce35136.js → VideoPlayer-874a52b0.js} +21 -16
- package/lib/cjs/{Vidyard-096bba3c.js → Vidyard-371acdcb.js} +1 -1
- package/lib/cjs/{Vimeo-2cb7476f.js → Vimeo-4d2029a8.js} +1 -1
- package/lib/cjs/{Wistia-5e830ac8.js → Wistia-cd0799ad.js} +1 -1
- package/lib/cjs/{YouTube-25a1d9a0.js → YouTube-23b7ec9e.js} +1 -1
- package/lib/cjs/components/Card/Card.js +43 -0
- package/lib/cjs/components/Card/CardGroup.js +25 -0
- package/lib/cjs/components/Card/index.js +21 -0
- package/lib/cjs/components/LocalNav/LocalNav.js +5 -3
- package/lib/cjs/components/LocalNav/index.js +1 -0
- package/lib/cjs/components/Logo/Logo.js +153 -0
- package/lib/cjs/components/Logo/index.js +13 -0
- package/lib/cjs/components/Navigation/Navigation.js +48 -0
- package/lib/cjs/components/Navigation/index.js +20 -0
- package/lib/cjs/components/Video/Video.js +1 -1
- package/lib/cjs/components/Video/VideoPlayer.js +1 -1
- package/lib/cjs/components/Video/index.js +1 -1
- package/lib/cjs/components/index.js +9 -1
- package/lib/cjs/index.js +9 -1
- package/lib/esm/{DailyMotion-66b6eff2.js → DailyMotion-88f6c379.js} +1 -1
- package/lib/esm/{Facebook-dbd1003d.js → Facebook-3a284039.js} +1 -1
- package/lib/esm/{FilePlayer-617ed2ce.js → FilePlayer-dee1f94b.js} +1 -1
- package/lib/esm/{Kaltura-bbcec33d.js → Kaltura-c5d42c88.js} +1 -1
- package/lib/esm/{Mixcloud-a681ec69.js → Mixcloud-430ab42a.js} +1 -1
- package/lib/esm/{Preview-407cc648.js → Preview-7f57e055.js} +1 -1
- package/lib/esm/{SoundCloud-16e78ee5.js → SoundCloud-d1ab591e.js} +1 -1
- package/lib/esm/{Streamable-ecb225c1.js → Streamable-042d61d5.js} +1 -1
- package/lib/esm/{Twitch-8d1b6769.js → Twitch-2f45534f.js} +1 -1
- package/lib/esm/{VideoPlayer-62e0ce79.js → VideoPlayer-719076c4.js} +21 -16
- package/lib/esm/{Vidyard-57e2834a.js → Vidyard-4625527b.js} +1 -1
- package/lib/esm/{Vimeo-faa058a2.js → Vimeo-03b960e6.js} +1 -1
- package/lib/esm/{Wistia-24fb5120.js → Wistia-48f9c303.js} +1 -1
- package/lib/esm/{YouTube-01b3e51f.js → YouTube-5b29a3d9.js} +1 -1
- package/lib/esm/components/Card/Card.js +41 -0
- package/lib/esm/components/Card/CardGroup.js +23 -0
- package/lib/esm/components/Card/index.js +14 -0
- package/lib/esm/components/LocalNav/LocalNav.js +5 -3
- package/lib/esm/components/LocalNav/index.js +1 -0
- package/lib/esm/components/Logo/Logo.js +151 -0
- package/lib/esm/components/Logo/index.js +7 -0
- package/lib/esm/components/Navigation/Navigation.js +46 -0
- package/lib/esm/components/Navigation/index.js +14 -0
- package/lib/esm/components/Video/Video.js +1 -1
- package/lib/esm/components/Video/VideoPlayer.js +1 -1
- package/lib/esm/components/Video/index.js +1 -1
- package/lib/esm/components/index.js +6 -1
- package/lib/esm/index.js +6 -1
- package/lib/types/react/src/components/Card/Card.d.ts +4 -0
- package/lib/types/react/src/components/Card/Card.props.d.ts +110 -0
- package/lib/types/react/src/components/Card/CardGroup.d.ts +4 -0
- package/lib/types/react/src/components/Card/CardGroup.props.d.ts +16 -0
- package/lib/types/react/src/components/Card/index.d.ts +2 -0
- package/lib/types/react/src/components/LocalNav/LocalNav.props.d.ts +4 -7
- package/lib/types/react/src/components/Logo/Logo.d.ts +4 -0
- package/lib/types/react/src/components/Logo/Logo.props.d.ts +55 -0
- package/lib/types/react/src/components/Logo/index.d.ts +1 -0
- package/lib/types/react/src/components/Navigation/Navigation.d.ts +4 -0
- package/lib/types/react/src/components/Navigation/Navigation.props.d.ts +99 -0
- package/lib/types/react/src/components/Navigation/index.d.ts +1 -0
- package/lib/types/react/src/components/index.d.ts +2 -0
- package/lib/types/react/src/types/index.d.ts +6 -0
- package/package.json +18 -17
- package/public/favicon.ico +0 -0
- package/src/components/Accordion/Accordion.args.ts +1 -4
- package/src/components/Card/Card.args.ts +215 -0
- package/src/components/Card/Card.props.ts +142 -0
- package/src/components/Card/Card.tsx +183 -0
- package/src/components/Card/CardGroup.args.ts +945 -0
- package/src/components/Card/CardGroup.props.ts +19 -0
- package/src/components/Card/CardGroup.tsx +55 -0
- package/src/components/Card/index.ts +2 -0
- package/src/components/LocalNav/LocalNav.args.ts +6 -6
- package/src/components/LocalNav/LocalNav.props.ts +4 -8
- package/src/components/LocalNav/LocalNav.tsx +21 -15
- package/src/components/Logo/Logo.args.ts +45 -0
- package/src/components/Logo/Logo.props.ts +67 -0
- package/src/components/Logo/Logo.tsx +247 -0
- package/src/components/Logo/index.ts +1 -0
- package/src/components/Navigation/Navigation.args.ts +112 -0
- package/src/components/Navigation/Navigation.props.ts +120 -0
- package/src/components/Navigation/Navigation.tsx +246 -0
- package/src/components/Navigation/index.ts +1 -0
- package/src/components/index.ts +2 -0
- package/src/types/index.ts +14 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useRef, useState, useEffect } from 'react';
|
|
4
|
+
import useGlobalSettings from '../../hooks/useGlobalSettings.js';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import '../../GlobalCtx-7fb23cfa.js';
|
|
7
|
+
|
|
8
|
+
const isOverflown = ({ clientHeight, clientWidth, scrollHeight, scrollWidth, }) => scrollHeight > clientHeight || scrollWidth > clientWidth;
|
|
9
|
+
const getFullFontSize = (container, { maxSize = 600, startingHeight = 9, step = 0.5 }) => {
|
|
10
|
+
let i = startingHeight;
|
|
11
|
+
let overflow = false;
|
|
12
|
+
while (!overflow && i < maxSize) {
|
|
13
|
+
container.style.fontSize = `${i}px`;
|
|
14
|
+
container.style.lineHeight = `${i}px`;
|
|
15
|
+
overflow = isOverflown(container);
|
|
16
|
+
if (!overflow) {
|
|
17
|
+
i = i + step;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// Reset styles to the way they were
|
|
21
|
+
container.style.fontSize = "";
|
|
22
|
+
container.style.lineHeight = "";
|
|
23
|
+
// Return the ideal font size
|
|
24
|
+
return i - step;
|
|
25
|
+
};
|
|
26
|
+
const BaseLogo = (_a) => {
|
|
27
|
+
var { baseClass, className, subbrand, alt, src, style: userStyles, size = "fluid", theme = "light" } = _a, props = __rest(_a, ["baseClass", "className", "subbrand", "alt", "src", "style", "size", "theme"]);
|
|
28
|
+
// The logo image element
|
|
29
|
+
const imageRef = useRef(null);
|
|
30
|
+
// The lockup container
|
|
31
|
+
const lockupRef = useRef(null);
|
|
32
|
+
// The lockup text
|
|
33
|
+
const lockupTextRef = useRef(null);
|
|
34
|
+
// Has the image loaded or not
|
|
35
|
+
const [imageLoaded, setImageLoaded] = useState(false);
|
|
36
|
+
// Dynamic height of the image
|
|
37
|
+
const [imageHeight, setImageHeight] = useState(0);
|
|
38
|
+
// Ratio of the font size to the height of the logo image
|
|
39
|
+
const [fontSizeRatio, setfontSizeRatio] = useState(0);
|
|
40
|
+
// Is the logo visible? Default to true if not a subbrand
|
|
41
|
+
const [isLogoVisible, setIsLogoVisible] = useState(!subbrand);
|
|
42
|
+
// Initial height of the image when it's loaded
|
|
43
|
+
const initialImageHeight = useRef(null);
|
|
44
|
+
// Resize observer gets the initial height of the image when
|
|
45
|
+
// it loads and updates the height when it changes in state
|
|
46
|
+
const observer = useRef(new ResizeObserver((entries) => {
|
|
47
|
+
const { height } = entries[0].contentRect;
|
|
48
|
+
if (!initialImageHeight.current) {
|
|
49
|
+
initialImageHeight.current = height;
|
|
50
|
+
}
|
|
51
|
+
setImageHeight(height);
|
|
52
|
+
}));
|
|
53
|
+
// Make the logo visible for subrand when everything is ready
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (subbrand && imageLoaded && fontSizeRatio) {
|
|
56
|
+
setIsLogoVisible(true);
|
|
57
|
+
}
|
|
58
|
+
}, [imageLoaded, fontSizeRatio, subbrand]);
|
|
59
|
+
// Set up the Resize observer to watch the image
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (imageLoaded && lockupRef.current && imageRef.current) {
|
|
62
|
+
const imageEl = imageRef.current;
|
|
63
|
+
observer.current.observe(imageEl);
|
|
64
|
+
return () => observer.current.unobserve(imageEl);
|
|
65
|
+
}
|
|
66
|
+
}, [imageLoaded]);
|
|
67
|
+
// Gets the font size necessary for the lockup text to fill the
|
|
68
|
+
// the lockup container as much as possible without overflowing.
|
|
69
|
+
// Then gets the ratio of full font size to image height which will
|
|
70
|
+
// be used to calculate the font size if the image gets resized
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
setFontSize();
|
|
73
|
+
}, [imageLoaded, initialImageHeight.current]);
|
|
74
|
+
// Adjust the font size if for some weird reason the subbrand changes
|
|
75
|
+
// This is mostly just to illustrate how the component works on Storybook
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
setFontSize();
|
|
78
|
+
}, [subbrand]);
|
|
79
|
+
function setFontSize() {
|
|
80
|
+
if (lockupRef.current &&
|
|
81
|
+
lockupTextRef.current &&
|
|
82
|
+
initialImageHeight.current) {
|
|
83
|
+
const fullFontSize = getFullFontSize(lockupRef.current, {
|
|
84
|
+
maxSize: initialImageHeight.current,
|
|
85
|
+
});
|
|
86
|
+
const ratio = fullFontSize / initialImageHeight.current;
|
|
87
|
+
setfontSizeRatio(ratio);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Has the image loaded or not
|
|
91
|
+
function handleImageLoaded() {
|
|
92
|
+
setImageLoaded(true);
|
|
93
|
+
}
|
|
94
|
+
// Conditions for different CSS classes
|
|
95
|
+
const hasSubbrand = !!subbrand;
|
|
96
|
+
const hasFluidWidth = size === "fluid";
|
|
97
|
+
const hasFixedWidth = !hasFluidWidth && typeof size === "number";
|
|
98
|
+
// Classes for the outer figure container
|
|
99
|
+
const subBrandClass = `${baseClass}--sub-brand`;
|
|
100
|
+
const fluidWidthClass = `${baseClass}--size--fluid`;
|
|
101
|
+
const visibilityHidden = `${baseClass}--visibility--hidden`;
|
|
102
|
+
// Outer figure classes
|
|
103
|
+
const classNames$1 = classNames(baseClass, className, `${baseClass}--theme--${theme}`, {
|
|
104
|
+
[visibilityHidden]: !isLogoVisible,
|
|
105
|
+
[fluidWidthClass]: hasFluidWidth,
|
|
106
|
+
[subBrandClass]: hasSubbrand,
|
|
107
|
+
});
|
|
108
|
+
// Classes for the image element
|
|
109
|
+
const noSubBrandImageClass = `${baseClass}--image`;
|
|
110
|
+
const subBrandImageClass = `${subBrandClass}--image`;
|
|
111
|
+
// Set inline CSS including variables on the outer figure element
|
|
112
|
+
const getStyle = () => {
|
|
113
|
+
const conditionalStyles = {};
|
|
114
|
+
// Add CSS vars if this is a sub-brand
|
|
115
|
+
if (hasSubbrand) {
|
|
116
|
+
conditionalStyles["--logo-image-height"] = `${imageHeight}px`;
|
|
117
|
+
conditionalStyles["--logo-font-size"] = `${fontSizeRatio * imageHeight}px`;
|
|
118
|
+
}
|
|
119
|
+
// Add fixed width if it has fixed width
|
|
120
|
+
if (hasFixedWidth) {
|
|
121
|
+
conditionalStyles.width = `${size}px`;
|
|
122
|
+
}
|
|
123
|
+
// User styles may be overriden
|
|
124
|
+
return Object.assign({ userStyles }, conditionalStyles);
|
|
125
|
+
};
|
|
126
|
+
const getImageSrc = () => {
|
|
127
|
+
if (typeof src === "string") {
|
|
128
|
+
return src;
|
|
129
|
+
}
|
|
130
|
+
return src[theme];
|
|
131
|
+
};
|
|
132
|
+
return (jsxs("figure", Object.assign({ className: classNames$1, style: getStyle() }, { children: [jsx("img", Object.assign({ ref: imageRef, alt: alt, src: getImageSrc(), className: classNames({
|
|
133
|
+
[subBrandImageClass]: hasSubbrand,
|
|
134
|
+
[noSubBrandImageClass]: !hasSubbrand,
|
|
135
|
+
}), onLoad: handleImageLoaded }, props)), hasSubbrand && (jsxs("div", Object.assign({ ref: lockupRef, className: `${subBrandClass}--lock-up` }, { children: [jsx("span", { className: `${subBrandClass}--lock-up--separator` }), jsx("span", Object.assign({ ref: lockupTextRef }, { children: subbrand }))] })))] })));
|
|
136
|
+
};
|
|
137
|
+
const Logo = (_a) => {
|
|
138
|
+
var { className, url, target, style, size } = _a, props = __rest(_a, ["className", "url", "target", "style", "size"]);
|
|
139
|
+
const { prefix } = useGlobalSettings();
|
|
140
|
+
const baseClass = `${prefix}--logo`;
|
|
141
|
+
const linkClass = `${baseClass}--link`;
|
|
142
|
+
const fluidClass = `${baseClass}--size--fluid`;
|
|
143
|
+
if (url) {
|
|
144
|
+
return (jsx("a", Object.assign({ href: url, target: target, className: classNames(linkClass, className, {
|
|
145
|
+
[fluidClass]: size === "fluid",
|
|
146
|
+
}), style: style }, { children: jsx(BaseLogo, Object.assign({}, props, { baseClass: baseClass, size: size })) })));
|
|
147
|
+
}
|
|
148
|
+
return (jsx(BaseLogo, Object.assign({ baseClass: baseClass, className: className, style: style, size: size }, props)));
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export { Logo as default };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import useGlobalSettings from '../../hooks/useGlobalSettings.js';
|
|
4
|
+
import ContextMenu from '../ContextMenu/ContextMenu.js';
|
|
5
|
+
import SearchField from '../SearchField/SearchField.js';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import 'tslib';
|
|
8
|
+
import '../../GlobalCtx-7fb23cfa.js';
|
|
9
|
+
import '../Input/Input.js';
|
|
10
|
+
import '../Fieldset/Fieldset.js';
|
|
11
|
+
import '../Tooltip/Tooltip.js';
|
|
12
|
+
import 'react-dom';
|
|
13
|
+
import '../FormElement/FormElement.js';
|
|
14
|
+
|
|
15
|
+
const Navigation = ({ logo, mobilelogo, siteurl, tagline, primarynav, subnav, menulabel, menucloselabel, searchlabel, searchfield, languagelabel, languagecontextmenu, }) => {
|
|
16
|
+
const { prefix } = useGlobalSettings();
|
|
17
|
+
const [toggleMenuOpen, setMenuToggleOpen] = useState(false);
|
|
18
|
+
const [toggleSearchOpen, setSearchToggleOpen] = useState(false);
|
|
19
|
+
const [toggleSubnavOpen, setSubnavToggleOpen] = useState(false);
|
|
20
|
+
const [toggleLanguageOpen, setLanguageToggleOpen] = useState(false);
|
|
21
|
+
const baseClass = `${prefix}--header`;
|
|
22
|
+
const NavigationClasses = classNames(baseClass, {
|
|
23
|
+
[`${prefix}--mobile--open`]: toggleMenuOpen,
|
|
24
|
+
[`${prefix}--select--open`]: toggleLanguageOpen,
|
|
25
|
+
[`${prefix}--search--open`]: toggleSearchOpen,
|
|
26
|
+
[`${prefix}--subnav--open`]: toggleSubnavOpen,
|
|
27
|
+
});
|
|
28
|
+
const handleMenuToggle = () => {
|
|
29
|
+
setMenuToggleOpen(!toggleMenuOpen);
|
|
30
|
+
};
|
|
31
|
+
const handleLanguageToggle = () => {
|
|
32
|
+
setLanguageToggleOpen(!toggleLanguageOpen);
|
|
33
|
+
};
|
|
34
|
+
const handleSearchToggle = () => {
|
|
35
|
+
setSearchToggleOpen(!toggleSearchOpen);
|
|
36
|
+
};
|
|
37
|
+
const handleSubnavToggle = () => {
|
|
38
|
+
setSubnavToggleOpen(!toggleSubnavOpen);
|
|
39
|
+
};
|
|
40
|
+
return (jsxs("header", Object.assign({ className: NavigationClasses }, { children: [jsx("div", Object.assign({ className: `${baseClass}--utility-bar` }, { children: jsx("div", Object.assign({ className: `${prefix}--language-switcher` }, { children: jsxs("div", Object.assign({ className: `${prefix}--language-switcher--wrap` }, { children: [jsx("button", Object.assign({ className: `${prefix}--language-switcher--button`, type: "button" }, { children: languagelabel })), jsx(ContextMenu, { links: languagecontextmenu === null || languagecontextmenu === void 0 ? void 0 : languagecontextmenu.links })] })) })) })), jsx("div", Object.assign({ className: `${baseClass}--logo-bar` }, { children: jsxs("div", Object.assign({ className: `${baseClass}--inner` }, { children: [jsx("a", Object.assign({ href: siteurl, className: `${baseClass}--logo-link` }, { children: jsx("img", { className: `${baseClass}--logo`, src: logo, alt: "ILO Logo" }) })), jsxs("p", Object.assign({ className: `${baseClass}--logo-tagline` }, { children: [tagline === null || tagline === void 0 ? void 0 : tagline.tag, jsx("span", Object.assign({ className: `${baseClass}--logo-tagline--small` }, { children: tagline === null || tagline === void 0 ? void 0 : tagline.small }))] })), jsx("button", Object.assign({ className: `${baseClass}--menu`, onClick: handleMenuToggle }, { children: menulabel }))] })) })), jsxs("div", Object.assign({ className: `${baseClass}--navigation` }, { children: [jsxs("div", Object.assign({ className: `${baseClass}--inner` }, { children: [jsxs("div", Object.assign({ className: `${prefix}--mobile--nav` }, { children: [jsxs("div", Object.assign({ className: `${prefix}--mobile--nav--logo` }, { children: [jsx("a", Object.assign({ href: siteurl, className: `${baseClass}--logo-link` }, { children: jsx("img", { className: `${baseClass}--logo`, src: mobilelogo, alt: "ILO Logo" }) })), jsx("button", Object.assign({ className: `${baseClass}--menu--close`, onClick: handleMenuToggle }, { children: menucloselabel }))] })), jsx("div", Object.assign({ className: `${prefix}--mobile--nav--search` }, { children: jsx(SearchField, { input: searchfield === null || searchfield === void 0 ? void 0 : searchfield.input, action: searchfield === null || searchfield === void 0 ? void 0 : searchfield.action }) })), jsx("div", Object.assign({ className: `${prefix}--mobile--nav--language--switcher` }, { children: jsx("button", Object.assign({ className: `${prefix}--mobile--nav--language--switcher--button`, onClick: handleLanguageToggle, type: "button" }, { children: languagelabel })) })), jsx("div", Object.assign({ className: `${prefix}--mobile--nav--language--select` }, { children: jsxs("div", Object.assign({ className: `${baseClass}--inner` }, { children: [jsxs("div", Object.assign({ className: `${prefix}--mobile--subnav--menu` }, { children: [jsx("button", Object.assign({ className: `${prefix}--mobile--subnav--back`, onClick: handleLanguageToggle, type: "button" }, { children: subnav === null || subnav === void 0 ? void 0 : subnav.mobilebacklabel })), jsx("button", Object.assign({ className: `${baseClass}--menu--close`, onClick: handleMenuToggle }, { children: subnav === null || subnav === void 0 ? void 0 : subnav.mobilecloselabel })), jsx("h6", Object.assign({ className: `${prefix}--mobile--subnav--label` }, { children: languagelabel }))] })), jsx("ul", Object.assign({ className: `${prefix}--nav--set` }, { children: (languagecontextmenu === null || languagecontextmenu === void 0 ? void 0 : languagecontextmenu.links) &&
|
|
41
|
+
languagecontextmenu.links.map((item, index) => (jsx("li", Object.assign({ className: `${prefix}--nav--items` }, { children: jsx("a", Object.assign({ href: item.url, className: `${prefix}--nav--link ${prefix}--nav--language` }, { children: item.label })) }), index))) }))] })) }))] })), jsxs("nav", Object.assign({ className: `${prefix}--nav`, "aria-labelledby": "primary-navigation" }, { children: [jsx("h2", Object.assign({ className: `${prefix}--nav--label`, id: "primary-navigation" }, { children: primarynav === null || primarynav === void 0 ? void 0 : primarynav.navlabel })), jsxs("ul", Object.assign({ className: `${prefix}--nav--set` }, { children: [(primarynav === null || primarynav === void 0 ? void 0 : primarynav.items) &&
|
|
42
|
+
primarynav.items.map((item, index) => (jsx("li", Object.assign({ className: `${prefix}--nav--items` }, { children: jsx("a", Object.assign({ href: item.url, className: `${prefix}--nav--link` }, { children: item.label })) }), index))), subnav && (jsx("li", Object.assign({ className: `${prefix}--nav--items` }, { children: jsx("button", Object.assign({ className: `${prefix}--nav--trigger`, onClick: handleSubnavToggle }, { children: subnav.buttonlabel })) })))] }))] })), jsx("div", Object.assign({ className: `${prefix}--search` }, { children: jsx("button", Object.assign({ className: `${prefix}--search--button`, type: "button", onClick: handleSearchToggle }, { children: searchlabel })) }))] })), subnav && (jsx("nav", Object.assign({ className: `${prefix}--subnav`, "aria-labelledby": "secondary-navigation" }, { children: jsxs("div", Object.assign({ className: `${prefix}--subnav--inner` }, { children: [jsx("div", Object.assign({ className: `${prefix}--mobile--subnav` }, { children: jsxs("div", Object.assign({ className: `${prefix}--mobile--subnav--menu` }, { children: [jsx("button", Object.assign({ className: `${prefix}--mobile--subnav--back`, onClick: handleSubnavToggle, type: "button" }, { children: subnav.mobilebacklabel })), jsx("button", Object.assign({ className: `${prefix}--header--menu--close`, onClick: handleMenuToggle }, { children: subnav.mobilecloselabel })), jsx("h6", Object.assign({ className: `${prefix}--mobile--subnav--label` }, { children: subnav.buttonlabel }))] })) })), jsx("h2", Object.assign({ className: `${prefix}--nav--label`, id: "secondary-navigation" }, { children: subnav.navlabel })), jsx("ul", Object.assign({ className: `${prefix}--subnav--set` }, { children: (subnav === null || subnav === void 0 ? void 0 : subnav.items) &&
|
|
43
|
+
subnav.items.map((item, index) => (jsx("li", Object.assign({ className: `${prefix}--subnav--items` }, { children: jsx("a", Object.assign({ href: item.url, className: `${prefix}--subnav--link` }, { children: item.label })) }), index))) }))] })) }))), jsx("div", Object.assign({ className: `${prefix}--search-box` }, { children: jsx("div", Object.assign({ className: `${prefix}--header--inner` }, { children: jsx(SearchField, { input: searchfield === null || searchfield === void 0 ? void 0 : searchfield.input, action: searchfield === null || searchfield === void 0 ? void 0 : searchfield.action }) })) }))] }))] })));
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { Navigation as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { default as Navigation } from './Navigation.js';
|
|
2
|
+
import 'react/jsx-runtime';
|
|
3
|
+
import 'react';
|
|
4
|
+
import '../../hooks/useGlobalSettings.js';
|
|
5
|
+
import 'tslib';
|
|
6
|
+
import '../../GlobalCtx-7fb23cfa.js';
|
|
7
|
+
import '../ContextMenu/ContextMenu.js';
|
|
8
|
+
import 'classnames';
|
|
9
|
+
import '../SearchField/SearchField.js';
|
|
10
|
+
import '../Input/Input.js';
|
|
11
|
+
import '../Fieldset/Fieldset.js';
|
|
12
|
+
import '../Tooltip/Tooltip.js';
|
|
13
|
+
import 'react-dom';
|
|
14
|
+
import '../FormElement/FormElement.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import useGlobalSettings from '../../hooks/useGlobalSettings.js';
|
|
4
|
-
import { V as VideoPlayer } from '../../VideoPlayer-
|
|
4
|
+
import { V as VideoPlayer } from '../../VideoPlayer-719076c4.js';
|
|
5
5
|
import 'tslib';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '../../GlobalCtx-7fb23cfa.js';
|
|
@@ -5,7 +5,7 @@ import '../../hooks/useGlobalSettings.js';
|
|
|
5
5
|
import 'tslib';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '../../GlobalCtx-7fb23cfa.js';
|
|
8
|
-
import '../../VideoPlayer-
|
|
8
|
+
import '../../VideoPlayer-719076c4.js';
|
|
9
9
|
import '../../index-8ebb2cc1.js';
|
|
10
10
|
import 'react-dom';
|
|
11
11
|
import '../../utils/hoursMinutesSeconds.js';
|
|
@@ -50,6 +50,9 @@ export { default as Profile } from './Profile/Profile.js';
|
|
|
50
50
|
export { default as TableOfContents } from './TableOfContents/TableOfContents.js';
|
|
51
51
|
export { default as Footer } from './Footer/Footer.js';
|
|
52
52
|
export { default as LocalNav } from './LocalNav/LocalNav.js';
|
|
53
|
+
export { default as Navigation } from './Navigation/Navigation.js';
|
|
54
|
+
export { default as Card } from './Card/Card.js';
|
|
55
|
+
export { default as CardGroup } from './Card/CardGroup.js';
|
|
53
56
|
import '../hooks/useGlobalSettings.js';
|
|
54
57
|
import '../AccordionCtx-8c051900.js';
|
|
55
58
|
import '@ilo-org/utils';
|
|
@@ -62,7 +65,9 @@ import '../css-7414f50b.js';
|
|
|
62
65
|
import '../utils/transitionEndListener.js';
|
|
63
66
|
import '../utils/triggerBrowserReflow.js';
|
|
64
67
|
import './Hero/HeroCard.js';
|
|
65
|
-
import '../VideoPlayer-
|
|
68
|
+
import '../VideoPlayer-719076c4.js';
|
|
66
69
|
import '../utils/hoursMinutesSeconds.js';
|
|
67
70
|
import 'screenfull';
|
|
68
71
|
import '@ilo-org/icons-react';
|
|
72
|
+
import './Logo/Logo.js';
|
|
73
|
+
import './List/ListItem.js';
|
package/lib/esm/index.js
CHANGED
|
@@ -50,6 +50,9 @@ export { default as Profile } from './components/Profile/Profile.js';
|
|
|
50
50
|
export { default as TableOfContents } from './components/TableOfContents/TableOfContents.js';
|
|
51
51
|
export { default as Footer } from './components/Footer/Footer.js';
|
|
52
52
|
export { default as LocalNav } from './components/LocalNav/LocalNav.js';
|
|
53
|
+
export { default as Navigation } from './components/Navigation/Navigation.js';
|
|
54
|
+
export { default as Card } from './components/Card/Card.js';
|
|
55
|
+
export { default as CardGroup } from './components/Card/CardGroup.js';
|
|
53
56
|
import './hooks/useGlobalSettings.js';
|
|
54
57
|
import './AccordionCtx-8c051900.js';
|
|
55
58
|
import '@ilo-org/utils';
|
|
@@ -62,7 +65,9 @@ import './css-7414f50b.js';
|
|
|
62
65
|
import './utils/transitionEndListener.js';
|
|
63
66
|
import './utils/triggerBrowserReflow.js';
|
|
64
67
|
import './components/Hero/HeroCard.js';
|
|
65
|
-
import './VideoPlayer-
|
|
68
|
+
import './VideoPlayer-719076c4.js';
|
|
66
69
|
import './utils/hoursMinutesSeconds.js';
|
|
67
70
|
import 'screenfull';
|
|
68
71
|
import '@ilo-org/icons-react';
|
|
72
|
+
import './components/Logo/Logo.js';
|
|
73
|
+
import './components/List/ListItem.js';
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { CardAlignment, HeroCardTheme, CardCornerType, CardColor, CardSize, CardTypes } from "../../types";
|
|
2
|
+
import { LinkProps, LinkListProps } from "../LinkList/LinkList.props";
|
|
3
|
+
import { ProfileProps } from "../Profile/Profile.props";
|
|
4
|
+
export interface CardProps {
|
|
5
|
+
/**
|
|
6
|
+
* Specify whether the card should display a video icon (for Feature card). Possible options: true | false
|
|
7
|
+
*/
|
|
8
|
+
isvideo?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Eyebrow field for the card.
|
|
11
|
+
*/
|
|
12
|
+
eyebrow: Required<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Title field for the card
|
|
15
|
+
*/
|
|
16
|
+
title: Required<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Color of the stat cards, options are turquoise | green| yellow| blue. Only used for stat cards.
|
|
19
|
+
*/
|
|
20
|
+
color?: CardColor;
|
|
21
|
+
/**
|
|
22
|
+
* The theme type for the card. Theme doesn't apply to these card types: Multilink, Data, Stat and Detail. Possible themes: light | dark.
|
|
23
|
+
*/
|
|
24
|
+
theme?: HeroCardTheme;
|
|
25
|
+
/**
|
|
26
|
+
* Different variations of card: Graphic | Stat | Graphic Promo | Multilink | Feature | Detail | Fact List | Data.
|
|
27
|
+
*/
|
|
28
|
+
variant: Required<CardTypes>;
|
|
29
|
+
/**
|
|
30
|
+
* Size of the cards (usually reduces padding). `Wide` on Multilink and Feature cause a two column structure above a desktop breakpoint. Possible options: Wide | Standard | Narrow.
|
|
31
|
+
*/
|
|
32
|
+
size?: CardSize;
|
|
33
|
+
/**
|
|
34
|
+
* Specify whether the card has a cut corner. The only cards that use this setting are `Graphic Promo` and `Factlist`. Possible options: cornercut | corner.
|
|
35
|
+
*/
|
|
36
|
+
cornercut?: CardCornerType;
|
|
37
|
+
/**
|
|
38
|
+
* Specify whether a card image is right-aligned or left-aligned for `Multilink` cards. Possible options: left | right.
|
|
39
|
+
*/
|
|
40
|
+
alignment?: CardAlignment;
|
|
41
|
+
/**
|
|
42
|
+
* Intro text field for the card
|
|
43
|
+
*/
|
|
44
|
+
intro?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Specify the event Date, in both human and Unix format.
|
|
47
|
+
*/
|
|
48
|
+
date?: EventDate;
|
|
49
|
+
/**
|
|
50
|
+
* Event details for `Detail` card
|
|
51
|
+
*/
|
|
52
|
+
eventdetails?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Profile to embed in the card for `Graphic Text`
|
|
55
|
+
*/
|
|
56
|
+
profile?: ProfileProps;
|
|
57
|
+
/**
|
|
58
|
+
* A list of text itmes to be embed in the card, specifically used in `Factlist` card.
|
|
59
|
+
*/
|
|
60
|
+
listitems?: Array<string>;
|
|
61
|
+
/**
|
|
62
|
+
* A Link behind a clickable card. Do no use on `Multilink`, `Factlist`, `Data`, or `Stat` cards.
|
|
63
|
+
*/
|
|
64
|
+
link?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Props of the LinkList component. Appears at the bottom of `Multilink` or `Feature` card.
|
|
67
|
+
*/
|
|
68
|
+
linklist?: LinkListProps;
|
|
69
|
+
/**
|
|
70
|
+
* Items for clickable CTA button, specifically used for `Graphic Promo` card.
|
|
71
|
+
*/
|
|
72
|
+
cta?: LinkProps;
|
|
73
|
+
/**
|
|
74
|
+
* The image used in a card. Images should be avoided on `Graphic Promo`, `Graphic Text`, `Factlist`, and `Stat` card.
|
|
75
|
+
*/
|
|
76
|
+
image?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Source link for `Stat` cards.
|
|
79
|
+
*/
|
|
80
|
+
source?: LinkProps;
|
|
81
|
+
/**
|
|
82
|
+
* Dataset object for the `Data` card. An array of Content (label, copy), Files (optional headline, array of items with label and url), and Links (optional headline, array of items with label and url).
|
|
83
|
+
*/
|
|
84
|
+
dataset?: CardDataset;
|
|
85
|
+
}
|
|
86
|
+
interface EventDate {
|
|
87
|
+
unix?: string;
|
|
88
|
+
human?: string;
|
|
89
|
+
}
|
|
90
|
+
interface CardDataset {
|
|
91
|
+
content?: DataContent;
|
|
92
|
+
files?: DataFile;
|
|
93
|
+
links?: DataLink;
|
|
94
|
+
}
|
|
95
|
+
interface DataContent {
|
|
96
|
+
items?: Array<ContentItem>;
|
|
97
|
+
}
|
|
98
|
+
interface ContentItem {
|
|
99
|
+
label?: string;
|
|
100
|
+
copy?: string;
|
|
101
|
+
}
|
|
102
|
+
interface DataFile {
|
|
103
|
+
headline?: string;
|
|
104
|
+
items?: Array<LinkProps>;
|
|
105
|
+
}
|
|
106
|
+
interface DataLink {
|
|
107
|
+
headline?: string;
|
|
108
|
+
items?: Array<LinkProps>;
|
|
109
|
+
}
|
|
110
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CardProps } from "../Card/Card.props";
|
|
2
|
+
import { LinkProps } from "../LinkList/LinkList.props";
|
|
3
|
+
export interface CardGroupProps {
|
|
4
|
+
/**
|
|
5
|
+
* An array of card objects
|
|
6
|
+
*/
|
|
7
|
+
cards?: Required<CardProps>[];
|
|
8
|
+
/**
|
|
9
|
+
* Number of cards in the group
|
|
10
|
+
*/
|
|
11
|
+
cardcount: Required<string>;
|
|
12
|
+
/**
|
|
13
|
+
* A Button to display after all the cards in the group
|
|
14
|
+
*/
|
|
15
|
+
cta?: LinkProps;
|
|
16
|
+
}
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { LinkProps, ContextMenuProps } from "../ContextMenu/ContextMenu.props";
|
|
2
|
+
import { LogoProps } from "../Logo/Logo.props";
|
|
2
3
|
export interface LocalNavProps {
|
|
3
4
|
/**
|
|
4
5
|
* Props for the background colour of the LocalNav
|
|
5
6
|
*/
|
|
6
7
|
background?: string;
|
|
7
8
|
/**
|
|
8
|
-
* Props for the
|
|
9
|
+
* Props for the Logo component of the LocalNav
|
|
9
10
|
*/
|
|
10
|
-
logo
|
|
11
|
-
/**
|
|
12
|
-
* Props for the home url of the LocalNav
|
|
13
|
-
*/
|
|
14
|
-
siteurl?: Required<string>;
|
|
11
|
+
logo: LogoProps;
|
|
15
12
|
/**
|
|
16
13
|
* Specify the primary items for the LocalNav
|
|
17
14
|
*/
|
|
18
|
-
primarynav?:
|
|
15
|
+
primarynav?: PrimaryNavProps;
|
|
19
16
|
/**
|
|
20
17
|
* Specify the main link for the LocalNav
|
|
21
18
|
*/
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
type LogoSrc = string | {
|
|
2
|
+
/**
|
|
3
|
+
* The url of the logo to use with light theme
|
|
4
|
+
*/
|
|
5
|
+
light: string;
|
|
6
|
+
/**
|
|
7
|
+
* The url of the logo to use with dark theme
|
|
8
|
+
*/
|
|
9
|
+
dark: string;
|
|
10
|
+
};
|
|
11
|
+
export interface LogoProps {
|
|
12
|
+
/**
|
|
13
|
+
* The location of the image file
|
|
14
|
+
*/
|
|
15
|
+
src: LogoSrc;
|
|
16
|
+
/**
|
|
17
|
+
* Alt text for the logo
|
|
18
|
+
*/
|
|
19
|
+
alt: string;
|
|
20
|
+
/**
|
|
21
|
+
* The name of the sub-brand if there is one
|
|
22
|
+
*/
|
|
23
|
+
subbrand?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The width of the logo or 'fluid' width
|
|
26
|
+
*/
|
|
27
|
+
size?: number | "fluid";
|
|
28
|
+
/**
|
|
29
|
+
* Styles to be applied to the outermost element
|
|
30
|
+
*/
|
|
31
|
+
style?: React.CSSProperties;
|
|
32
|
+
/**
|
|
33
|
+
* Optional className to be passed to the outermost element of the component
|
|
34
|
+
*/
|
|
35
|
+
className?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Optional destination if the logo is a link
|
|
38
|
+
*/
|
|
39
|
+
url?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Optional target if the logo is a link
|
|
42
|
+
*/
|
|
43
|
+
target?: "_blank" | "_self" | "_parent" | "_top";
|
|
44
|
+
/**
|
|
45
|
+
* Theme of the logo component
|
|
46
|
+
*/
|
|
47
|
+
theme?: "light" | "dark";
|
|
48
|
+
}
|
|
49
|
+
export interface InnerLogoProps extends LogoProps {
|
|
50
|
+
/**
|
|
51
|
+
* The base class of the logo component
|
|
52
|
+
*/
|
|
53
|
+
baseClass: string;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Logo } from "./Logo";
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { LinkProps, ContextMenuProps } from "../ContextMenu/ContextMenu.props";
|
|
2
|
+
import { SearchFieldProps } from "../SearchField/SearchField.props";
|
|
3
|
+
export interface NavigationProps {
|
|
4
|
+
/**
|
|
5
|
+
* Props for the logo of the Navigation
|
|
6
|
+
*/
|
|
7
|
+
logo?: Required<string>;
|
|
8
|
+
/**
|
|
9
|
+
* Props for the mobile logo of the Navigation
|
|
10
|
+
*/
|
|
11
|
+
mobilelogo?: Required<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Props for the home url of the Navigation
|
|
14
|
+
*/
|
|
15
|
+
siteurl?: Required<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Specify the tagline for the Navigation
|
|
18
|
+
*/
|
|
19
|
+
tagline?: Required<TaglineProps>;
|
|
20
|
+
/**
|
|
21
|
+
* Specify the primary items for the Navigation
|
|
22
|
+
*/
|
|
23
|
+
primarynav?: Required<PrimaryNavProps>;
|
|
24
|
+
/**
|
|
25
|
+
* Specify the secondary items for the Navigation
|
|
26
|
+
*/
|
|
27
|
+
subnav?: Required<SubNavProps>;
|
|
28
|
+
/**
|
|
29
|
+
* Specify the tagline for the Navigation
|
|
30
|
+
*/
|
|
31
|
+
searchlabel?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Specify the searchfield props for the Navigation
|
|
34
|
+
*/
|
|
35
|
+
searchfield?: SearchFieldProps;
|
|
36
|
+
/**
|
|
37
|
+
* Specify the menu label for the Navigation
|
|
38
|
+
*/
|
|
39
|
+
menulabel?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Specify the menu close label for the Navigation
|
|
42
|
+
*/
|
|
43
|
+
menucloselabel?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Specify the language label for the Navigation
|
|
46
|
+
*/
|
|
47
|
+
languagelabel?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Specify the language context menu for the Navigation
|
|
50
|
+
*/
|
|
51
|
+
languagecontextmenu?: ContextMenuProps;
|
|
52
|
+
}
|
|
53
|
+
interface PrimaryNavProps {
|
|
54
|
+
/**
|
|
55
|
+
* Specify the label for Navigation
|
|
56
|
+
*/
|
|
57
|
+
navlabel?: Required<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Specify the close label for mobile Navigation
|
|
60
|
+
*/
|
|
61
|
+
mobilecloselabel?: Required<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Specify the links
|
|
64
|
+
*/
|
|
65
|
+
items?: Required<Array<LinkProps>>;
|
|
66
|
+
}
|
|
67
|
+
interface SubNavProps {
|
|
68
|
+
/**
|
|
69
|
+
* Specify the label for sub Navigation
|
|
70
|
+
*/
|
|
71
|
+
navlabel?: Required<string>;
|
|
72
|
+
/**
|
|
73
|
+
* Specify the button label for sub Navigation
|
|
74
|
+
*/
|
|
75
|
+
buttonlabel?: Required<string>;
|
|
76
|
+
/**
|
|
77
|
+
* Specify the close label for mobile sub Navigation
|
|
78
|
+
*/
|
|
79
|
+
mobilecloselabel?: Required<string>;
|
|
80
|
+
/**
|
|
81
|
+
* Specify the back label for mobile sub Navigation
|
|
82
|
+
*/
|
|
83
|
+
mobilebacklabel?: Required<string>;
|
|
84
|
+
/**
|
|
85
|
+
* Specify the subnav links
|
|
86
|
+
*/
|
|
87
|
+
items?: Required<Array<LinkProps>>;
|
|
88
|
+
}
|
|
89
|
+
interface TaglineProps {
|
|
90
|
+
/**
|
|
91
|
+
* Specify the main tagline text
|
|
92
|
+
*/
|
|
93
|
+
tag?: Required<string>;
|
|
94
|
+
/**
|
|
95
|
+
* Specify the small tagline text
|
|
96
|
+
*/
|
|
97
|
+
small?: Required<string>;
|
|
98
|
+
}
|
|
99
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Navigation } from "./Navigation";
|