@ilo-org/react 0.14.1 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/lib/cjs/components/Cards/CardGroup/CardGroup.js +7 -4
  2. package/lib/cjs/components/Cards/CardGroup/index.js +9 -8
  3. package/lib/cjs/components/Cards/DetailCard/DetailCard.js +2 -2
  4. package/lib/cjs/components/Cards/FactlistCard/FactListCard.js +2 -2
  5. package/lib/cjs/components/Cards/FeatureCard/FeatureCard.js +2 -2
  6. package/lib/cjs/components/Cards/MultilinkCard/MultiLinkCard.js +2 -2
  7. package/lib/cjs/components/Cards/PromoCard/PromoCard.js +2 -2
  8. package/lib/cjs/components/Cards/StatCard/StatCard.js +2 -2
  9. package/lib/cjs/components/Cards/TextCard/TextCard.js +2 -2
  10. package/lib/cjs/components/LogoGrid/LogoGrid.js +1 -1
  11. package/lib/cjs/components/Navigation/Navigation.js +34 -8
  12. package/lib/cjs/components/SocialMedia/SocialMedia.js +1 -1
  13. package/lib/cjs/hooks/index.js +0 -2
  14. package/lib/esm/components/Cards/CardGroup/CardGroup.js +7 -4
  15. package/lib/esm/components/Cards/CardGroup/index.js +9 -8
  16. package/lib/esm/components/Cards/DetailCard/DetailCard.js +2 -2
  17. package/lib/esm/components/Cards/FactlistCard/FactListCard.js +2 -2
  18. package/lib/esm/components/Cards/FeatureCard/FeatureCard.js +2 -2
  19. package/lib/esm/components/Cards/MultilinkCard/MultiLinkCard.js +2 -2
  20. package/lib/esm/components/Cards/PromoCard/PromoCard.js +2 -2
  21. package/lib/esm/components/Cards/StatCard/StatCard.js +2 -2
  22. package/lib/esm/components/Cards/TextCard/TextCard.js +2 -2
  23. package/lib/esm/components/LogoGrid/LogoGrid.js +1 -1
  24. package/lib/esm/components/Navigation/Navigation.js +35 -9
  25. package/lib/esm/components/SocialMedia/SocialMedia.js +1 -1
  26. package/lib/esm/hooks/index.js +0 -1
  27. package/lib/types/react/src/components/Cards/CardGroup/CardGroup.props.d.ts +28 -2
  28. package/lib/types/react/src/components/Cards/DetailCard/DetailCard.props.d.ts +5 -1
  29. package/lib/types/react/src/components/Cards/FactlistCard/FactListCard.props.d.ts +5 -1
  30. package/lib/types/react/src/components/Cards/FeatureCard/FeatureCard.props.d.ts +5 -1
  31. package/lib/types/react/src/components/Cards/MultilinkCard/MultilinkCard.props.d.ts +5 -1
  32. package/lib/types/react/src/components/Cards/PromoCard/PromoCard.props.d.ts +5 -1
  33. package/lib/types/react/src/components/Cards/StatCard/StatCard.props.d.ts +8 -1
  34. package/lib/types/react/src/components/Cards/TextCard/TextCard.props.d.ts +5 -1
  35. package/lib/types/react/src/hooks/index.d.ts +0 -1
  36. package/lib/types/react/src/types/index.d.ts +1 -0
  37. package/package.json +3 -3
  38. package/lib/cjs/hooks/useVideoPlayer.js +0 -75
  39. package/lib/esm/hooks/useVideoPlayer.js +0 -73
  40. package/lib/types/react/src/hooks/useVideoPlayer.d.ts +0 -12
@@ -6,7 +6,7 @@ import 'tslib';
6
6
  import 'react';
7
7
  import '../../../GlobalCtx-7fb23cfa.js';
8
8
 
9
- const FeatureCard = ({ isvideo, eyebrow, title, theme, size = "narrow", date, link, linklist, image, }) => {
9
+ const FeatureCard = ({ isvideo, eyebrow, title, theme, size = "narrow", date, link, linklist, image, titleLevel: TitleElement, }) => {
10
10
  const { prefix } = useGlobalSettings();
11
11
  const baseClass = `${prefix}--card`;
12
12
  const cardClasses = classNames(baseClass, `${baseClass}__type__feature`, {
@@ -16,7 +16,7 @@ const FeatureCard = ({ isvideo, eyebrow, title, theme, size = "narrow", date, li
16
16
  [`${baseClass}__linklist`]: linklist,
17
17
  [`${baseClass}__theme__${theme}`]: theme,
18
18
  });
19
- return (jsxs("div", Object.assign({ className: cardClasses }, { children: [link && (jsx("a", Object.assign({ className: `${baseClass}--link`, href: link, title: title }, { children: jsx("span", Object.assign({ className: `${baseClass}--link--text` }, { children: title })) }))), jsxs("div", Object.assign({ className: `${baseClass}--wrap` }, { children: [image && (jsx("div", Object.assign({ className: `${baseClass}--image--wrapper` }, { children: jsx("picture", { children: jsx("img", { className: `${baseClass}--picture`, src: image, alt: title }) }) }))), jsxs("div", Object.assign({ className: `${baseClass}--content` }, { children: [eyebrow && jsx("p", Object.assign({ className: `${baseClass}--eyebrow` }, { children: eyebrow })), title && jsx("h5", Object.assign({ className: `${baseClass}--title` }, { children: title })), date && (jsx("time", Object.assign({ className: `${baseClass}--date`, dateTime: date.unix }, { children: date.human }))), linklist && (jsx(LinkList, { headline: linklist.headline, linkgroup: linklist.linkgroup }))] }))] }))] })));
19
+ return (jsxs("div", Object.assign({ className: cardClasses }, { children: [link && (jsx("a", Object.assign({ className: `${baseClass}--link`, href: link, title: title }, { children: jsx("span", Object.assign({ className: `${baseClass}--link--text` }, { children: title })) }))), jsxs("div", Object.assign({ className: `${baseClass}--wrap` }, { children: [image && (jsx("div", Object.assign({ className: `${baseClass}--image--wrapper` }, { children: jsx("picture", { children: jsx("img", { className: `${baseClass}--picture`, src: image, alt: title }) }) }))), jsxs("div", Object.assign({ className: `${baseClass}--content` }, { children: [eyebrow && jsx("p", Object.assign({ className: `${baseClass}--eyebrow` }, { children: eyebrow })), title && TitleElement ? (jsx(TitleElement, Object.assign({ className: `${baseClass}--title` }, { children: title }))) : (jsx("p", Object.assign({ className: `${baseClass}--title` }, { children: title }))), date && (jsx("time", Object.assign({ className: `${baseClass}--date`, dateTime: date.unix }, { children: date.human }))), linklist && (jsx(LinkList, { headline: linklist.headline, linkgroup: linklist.linkgroup }))] }))] }))] })));
20
20
  };
21
21
 
22
22
  export { FeatureCard as default };
@@ -6,7 +6,7 @@ import 'tslib';
6
6
  import 'react';
7
7
  import '../../../GlobalCtx-7fb23cfa.js';
8
8
 
9
- const MultilinkCard = ({ isvideo, eyebrow, title, size = "narrow", alignment, intro, link, linklist, image, }) => {
9
+ const MultilinkCard = ({ isvideo, eyebrow, title, size = "standard", alignment, intro, link, linklist, image, titleLevel: TitleElement, }) => {
10
10
  const { prefix } = useGlobalSettings();
11
11
  const baseClass = `${prefix}--card`;
12
12
  const cardClasses = classNames(baseClass, `${baseClass}__type__multilink`, {
@@ -16,7 +16,7 @@ const MultilinkCard = ({ isvideo, eyebrow, title, size = "narrow", alignment, in
16
16
  [`${baseClass}__isvideo`]: isvideo,
17
17
  [`${baseClass}__linklist`]: linklist,
18
18
  });
19
- return (jsxs("div", Object.assign({ className: cardClasses }, { children: [link && (jsx("a", Object.assign({ className: `${baseClass}--link`, href: link, title: title }, { children: jsx("span", Object.assign({ className: `${baseClass}--link--text` }, { children: title })) }))), jsxs("div", Object.assign({ className: `${baseClass}--wrap` }, { children: [image && (jsx("div", Object.assign({ className: `${baseClass}--image--wrapper` }, { children: jsx("picture", { children: jsx("img", { className: `${baseClass}--picture`, src: image, alt: title }) }) }))), jsxs("div", Object.assign({ className: `${baseClass}--content` }, { children: [eyebrow && jsx("p", Object.assign({ className: `${baseClass}--eyebrow` }, { children: eyebrow })), title && jsx("h5", Object.assign({ className: `${baseClass}--title` }, { children: title })), image && (jsx("div", Object.assign({ className: `${baseClass}--image--wrapper` }, { children: jsx("picture", { children: jsx("img", { className: `${baseClass}--picture`, src: image, alt: title }) }) }))), intro && jsx("p", Object.assign({ className: `${baseClass}--intro` }, { children: intro })), linklist && (jsx(LinkList, { headline: linklist.headline, linkgroup: linklist.linkgroup }))] }))] }))] })));
19
+ return (jsxs("div", Object.assign({ className: cardClasses }, { children: [link && (jsx("a", Object.assign({ className: `${baseClass}--link`, href: link, title: title }, { children: jsx("span", Object.assign({ className: `${baseClass}--link--text` }, { children: title })) }))), jsxs("div", Object.assign({ className: `${baseClass}--wrap` }, { children: [image && (jsx("div", Object.assign({ className: `${baseClass}--image--wrapper` }, { children: jsx("picture", { children: jsx("img", { className: `${baseClass}--picture`, src: image, alt: title }) }) }))), jsxs("div", Object.assign({ className: `${baseClass}--content` }, { children: [eyebrow && jsx("p", Object.assign({ className: `${baseClass}--eyebrow` }, { children: eyebrow })), title && TitleElement ? (jsx(TitleElement, Object.assign({ className: `${baseClass}--title` }, { children: title }))) : (jsx("p", Object.assign({ className: `${baseClass}--title` }, { children: title }))), image && (jsx("div", Object.assign({ className: `${baseClass}--image--wrapper` }, { children: jsx("picture", { children: jsx("img", { className: `${baseClass}--picture`, src: image, alt: title }) }) }))), intro && jsx("p", Object.assign({ className: `${baseClass}--intro` }, { children: intro })), linklist && (jsx(LinkList, { headline: linklist.headline, linkgroup: linklist.linkgroup }))] }))] }))] })));
20
20
  };
21
21
 
22
22
  export { MultilinkCard as default };
@@ -5,7 +5,7 @@ import 'tslib';
5
5
  import 'react';
6
6
  import '../../../GlobalCtx-7fb23cfa.js';
7
7
 
8
- const PromoCard = ({ eyebrow, title, theme, size = "narrow", cornercut, intro, link, cta, }) => {
8
+ const PromoCard = ({ eyebrow, title, theme, size = "narrow", cornercut, intro, link, cta, titleLevel: TitleElement, }) => {
9
9
  const { prefix } = useGlobalSettings();
10
10
  const baseClass = `${prefix}--card`;
11
11
  const wrapperClass = classNames(`${baseClass}--wrapper`, `${baseClass}--wrapper__type__promo ${baseClass}--wrapper__type__promo__size__${size}`);
@@ -15,7 +15,7 @@ const PromoCard = ({ eyebrow, title, theme, size = "narrow", cornercut, intro, l
15
15
  [`${baseClass}__size__${size}`]: size,
16
16
  [`${baseClass}__theme__${theme}`]: theme,
17
17
  });
18
- return (jsx("div", Object.assign({ className: wrapperClass }, { children: jsxs("div", Object.assign({ className: cardClasses }, { children: [link && (jsx("a", Object.assign({ className: `${baseClass}--link`, href: link, title: title }, { children: jsx("span", Object.assign({ className: `${baseClass}--link--text` }, { children: title })) }))), jsx("div", Object.assign({ className: `${baseClass}--wrap` }, { children: jsxs("div", Object.assign({ className: `${baseClass}--content` }, { children: [eyebrow && jsx("p", Object.assign({ className: `${baseClass}--eyebrow` }, { children: eyebrow })), title && jsx("h5", Object.assign({ className: `${baseClass}--title` }, { children: title })), intro && jsx("p", Object.assign({ className: `${baseClass}--intro` }, { children: intro })), cta && cta.label && (jsx("a", Object.assign({ className: `${baseClass}--cta ${prefix}--button ${prefix}--button--medium ${prefix}--button--primary`, href: cta.url }, { children: jsx("span", Object.assign({ className: "link__label" }, { children: cta.label })) })))] })) }))] })) })));
18
+ return (jsx("div", Object.assign({ className: wrapperClass }, { children: jsxs("div", Object.assign({ className: cardClasses }, { children: [link && (jsx("a", Object.assign({ className: `${baseClass}--link`, href: link, title: title }, { children: jsx("span", Object.assign({ className: `${baseClass}--link--text` }, { children: title })) }))), jsx("div", Object.assign({ className: `${baseClass}--wrap` }, { children: jsxs("div", Object.assign({ className: `${baseClass}--content` }, { children: [eyebrow && jsx("p", Object.assign({ className: `${baseClass}--eyebrow` }, { children: eyebrow })), title && TitleElement ? (jsx(TitleElement, Object.assign({ className: `${baseClass}--title` }, { children: title }))) : (jsx("p", Object.assign({ className: `${baseClass}--title` }, { children: title }))), intro && jsx("p", Object.assign({ className: `${baseClass}--intro` }, { children: intro })), cta && cta.label && (jsx("a", Object.assign({ className: `${baseClass}--cta ${prefix}--button ${prefix}--button--medium ${prefix}--button--primary`, href: cta.url }, { children: jsx("span", Object.assign({ className: "link__label" }, { children: cta.label })) })))] })) }))] })) })));
19
19
  };
20
20
 
21
21
  export { PromoCard as default };
@@ -6,14 +6,14 @@ import 'tslib';
6
6
  import 'react';
7
7
  import '../../../GlobalCtx-7fb23cfa.js';
8
8
 
9
- const StatCard = ({ title, color, size = "standard", intro, source, }) => {
9
+ const StatCard = ({ title, color, size = "standard", intro, source, titleLevel: TitleElement, }) => {
10
10
  const { prefix } = useGlobalSettings();
11
11
  const baseClass = `${prefix}--card`;
12
12
  const cardClasses = classNames(baseClass, `${baseClass}__type__stat`, {
13
13
  [`${baseClass}__color__${color}`]: color,
14
14
  [`${baseClass}__size__${size}`]: size,
15
15
  });
16
- return (jsx("div", Object.assign({ className: cardClasses }, { children: jsx("div", Object.assign({ className: `${baseClass}--wrap` }, { children: jsxs("div", Object.assign({ className: `${baseClass}--content` }, { children: [title && jsx("h5", Object.assign({ className: `${baseClass}--title` }, { children: title })), intro && jsx("p", Object.assign({ className: `${baseClass}--intro` }, { children: intro })), source && jsx(Link, Object.assign({ url: source.url }, { children: source.label }))] })) })) })));
16
+ return (jsx("div", Object.assign({ className: cardClasses }, { children: jsx("div", Object.assign({ className: `${baseClass}--wrap` }, { children: jsxs("div", Object.assign({ className: `${baseClass}--content` }, { children: [title && TitleElement ? (jsx(TitleElement, Object.assign({ className: `${baseClass}--title` }, { children: title }))) : (jsx("p", Object.assign({ className: `${baseClass}--title` }, { children: title }))), intro && jsx("p", Object.assign({ className: `${baseClass}--intro` }, { children: intro })), source && jsx(Link, Object.assign({ url: source.url }, { children: source.label }))] })) })) })));
17
17
  };
18
18
 
19
19
  export { StatCard as default };
@@ -6,7 +6,7 @@ import 'tslib';
6
6
  import 'react';
7
7
  import '../../../GlobalCtx-7fb23cfa.js';
8
8
 
9
- const TextCard = ({ eyebrow, title, theme, size, date, profile, link, }) => {
9
+ const TextCard = ({ eyebrow, title, theme, size, date, profile, link, titleLevel: TitleElement, }) => {
10
10
  const { prefix } = useGlobalSettings();
11
11
  const baseClass = `${prefix}--card`;
12
12
  const wrapperClass = classNames(`${baseClass}--wrapper`);
@@ -15,7 +15,7 @@ const TextCard = ({ eyebrow, title, theme, size, date, profile, link, }) => {
15
15
  [`${baseClass}__size__${size}`]: size,
16
16
  [`${baseClass}__theme__${theme}`]: theme,
17
17
  });
18
- return (jsx("div", Object.assign({ className: wrapperClass }, { children: jsxs("div", Object.assign({ className: cardClasses }, { children: [link && (jsx("a", Object.assign({ className: `${baseClass}--link`, href: link, title: title }, { children: jsx("span", Object.assign({ className: `${baseClass}--link--text` }, { children: title })) }))), jsx("div", Object.assign({ className: `${baseClass}--wrap` }, { children: jsxs("div", Object.assign({ className: `${baseClass}--content` }, { children: [eyebrow && jsx("p", Object.assign({ className: `${baseClass}--eyebrow` }, { children: eyebrow })), title && jsx("h5", Object.assign({ className: `${baseClass}--title` }, { children: title })), date && (jsx("time", Object.assign({ className: `${baseClass}--date`, dateTime: date.unix }, { children: date.human }))), profile && profile.avatar && (jsx(Profile, { avatar: profile.avatar, description: profile.description, link: profile.link, name: profile.name, role: profile.role, className: `${prefix}--profile__theme__${theme}` }))] })) }))] })) })));
18
+ return (jsx("div", Object.assign({ className: wrapperClass }, { children: jsxs("div", Object.assign({ className: cardClasses }, { children: [link && (jsx("a", Object.assign({ className: `${baseClass}--link`, href: link, title: title }, { children: jsx("span", Object.assign({ className: `${baseClass}--link--text` }, { children: title })) }))), jsx("div", Object.assign({ className: `${baseClass}--wrap` }, { children: jsxs("div", Object.assign({ className: `${baseClass}--content` }, { children: [eyebrow && jsx("p", Object.assign({ className: `${baseClass}--eyebrow` }, { children: eyebrow })), title && TitleElement ? (jsx(TitleElement, Object.assign({ className: `${baseClass}--title` }, { children: title }))) : (jsx("p", Object.assign({ className: `${baseClass}--title` }, { children: title }))), date && (jsx("time", Object.assign({ className: `${baseClass}--date`, dateTime: date.unix }, { children: date.human }))), profile && profile.avatar && (jsx(Profile, { avatar: profile.avatar, description: profile.description, link: profile.link, name: profile.name, role: profile.role, className: `${prefix}--profile__theme__${theme}` }))] })) }))] })) })));
19
19
  };
20
20
 
21
21
  export { TextCard as default };
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import classNames from 'classnames';
3
3
  import useGlobalSettings from '../../hooks/useGlobalSettings.js';
4
- import 'react';
5
4
  import 'tslib';
5
+ import 'react';
6
6
  import '../../GlobalCtx-7fb23cfa.js';
7
7
 
8
8
  const LogoGridItem = ({ url, label, src }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useState } from 'react';
2
+ import { useState, useCallback, useEffect } from 'react';
3
3
  import useGlobalSettings from '../../hooks/useGlobalSettings.js';
4
4
  import ContextMenu from '../ContextMenu/ContextMenu.js';
5
5
  import SearchField from '../SearchField/SearchField.js';
@@ -18,31 +18,57 @@ const Navigation = ({ logo, mobilelogo, siteurl, tagline, primarynav, subnav, me
18
18
  const { prefix } = useGlobalSettings();
19
19
  const [toggleMenuOpen, setMenuToggleOpen] = useState(false);
20
20
  const [toggleSearchOpen, setSearchToggleOpen] = useState(false);
21
+ const [searchTabbable, setSearchTabbable] = useState(false);
21
22
  const [toggleSubnavOpen, setSubnavToggleOpen] = useState(false);
23
+ const [subnavTabbable, setSubnavTabbable] = useState(false);
22
24
  const [toggleLanguageOpen, setLanguageToggleOpen] = useState(false);
23
25
  const baseClass = `${prefix}--header`;
24
26
  const NavigationClasses = classNames(baseClass, {
25
27
  [`${prefix}--mobile--open`]: toggleMenuOpen,
26
- [`${prefix}--select--open`]: toggleLanguageOpen,
27
28
  [`${prefix}--search--open`]: toggleSearchOpen,
28
29
  [`${prefix}--subnav--open`]: toggleSubnavOpen,
30
+ [`${prefix}--select--open`]: toggleLanguageOpen,
31
+ [`${prefix}--context--open`]: toggleLanguageOpen,
29
32
  });
30
33
  const handleMenuToggle = () => {
31
34
  setMenuToggleOpen(!toggleMenuOpen);
32
35
  };
33
- const handleLanguageToggle = () => {
36
+ const handleLanguageToggle = useCallback(() => {
34
37
  setLanguageToggleOpen(!toggleLanguageOpen);
35
- };
38
+ }, [toggleLanguageOpen]);
36
39
  const handleSearchToggle = () => {
37
- setSearchToggleOpen(!toggleSearchOpen);
40
+ if (toggleSearchOpen) {
41
+ setSearchToggleOpen(false);
42
+ setTimeout(() => setSearchTabbable(false), 225);
43
+ return;
44
+ }
45
+ setSearchTabbable(true);
46
+ setTimeout(() => setSearchToggleOpen(true), 10);
38
47
  };
39
48
  const handleSubnavToggle = () => {
40
- setSubnavToggleOpen(!toggleSubnavOpen);
49
+ if (toggleSubnavOpen) {
50
+ setSubnavToggleOpen(false);
51
+ setTimeout(() => setSubnavTabbable(false), 125);
52
+ return;
53
+ }
54
+ setSubnavTabbable(true);
55
+ setTimeout(() => setSubnavToggleOpen(true), 10);
41
56
  };
42
- 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 ${prefix}--container` }, { 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 ${prefix}--container` }, { 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 ${prefix}--container` }, { 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) &&
57
+ useEffect(() => {
58
+ if (window) {
59
+ if (toggleLanguageOpen) {
60
+ window.addEventListener("click", handleLanguageToggle);
61
+ }
62
+ else {
63
+ window.removeEventListener("click", handleLanguageToggle);
64
+ }
65
+ return () => window.removeEventListener("click", handleLanguageToggle);
66
+ }
67
+ }, [toggleLanguageOpen, handleLanguageToggle]);
68
+ 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", onClick: handleLanguageToggle }, { 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 ${prefix}--container` }, { 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 ${prefix}--container` }, { 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 ${prefix}--container` }, { 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) &&
43
69
  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) &&
44
- 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 ${prefix}--container` }, { 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) &&
45
- 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 ${prefix}--container` }, { children: jsx(SearchField, { input: searchfield === null || searchfield === void 0 ? void 0 : searchfield.input, action: searchfield === null || searchfield === void 0 ? void 0 : searchfield.action }) })) }))] }))] })));
70
+ 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({ style: { display: subnavTabbable ? "block" : "none" }, className: `${prefix}--subnav`, "aria-labelledby": "secondary-navigation" }, { children: jsxs("div", Object.assign({ className: `${prefix}--subnav--inner ${prefix}--container` }, { 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) &&
71
+ 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({ style: { display: searchTabbable ? "block" : "none" }, className: `${prefix}--search-box` }, { children: jsx("div", Object.assign({ className: `${prefix}--header--inner ${prefix}--container` }, { children: jsx(SearchField, { input: searchfield === null || searchfield === void 0 ? void 0 : searchfield.input, action: searchfield === null || searchfield === void 0 ? void 0 : searchfield.action }) })) }))] }))] })));
46
72
  };
47
73
 
48
74
  export { Navigation as default };
@@ -1,8 +1,8 @@
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 'react';
5
4
  import 'tslib';
5
+ import 'react';
6
6
  import '../../GlobalCtx-7fb23cfa.js';
7
7
 
8
8
  const SocialMedia = ({ className, theme = "light", justify = "start", headline, icons, }) => {
@@ -1,5 +1,4 @@
1
1
  export { default as useGlobalSettings } from './useGlobalSettings.js';
2
- export { default as useVideoPlayer } from './useVideoPlayer.js';
3
2
  import 'tslib';
4
3
  import 'react';
5
4
  import 'react/jsx-runtime';
@@ -7,15 +7,40 @@ import { FeatureCardProps } from "../FeatureCard";
7
7
  import { DetailCardProps } from "../DetailCard";
8
8
  import { FactlistCardProps } from "../FactlistCard";
9
9
  import { DataCardProps } from "../DataCard";
10
+ import { HeadingTypes, CardSize, ThemeTypes, CardAlignment } from "../../../types";
10
11
  export interface CommonCardGroupProps {
11
12
  /**
12
- * Number of cards in the group
13
+ *Collapsed - Optionally collapses margins between the cards.
14
+ *Option keys: true, false
15
+ */
16
+ collapsed?: boolean;
17
+ /**
18
+ *Number of cards in the group
13
19
  */
14
20
  cardCount: string;
15
21
  /**
16
- * A Button to display after all the cards in the group
22
+ *Size - Sets the layout of the cards in the group. See the Card component for more info on this setting, which has different effects on the different types of cards.
23
+ *Option keys: standard, narrow, wide, fluid
24
+ */
25
+ size: CardSize;
26
+ /**
27
+ *Alignment - Positions the image to the right or to the left of the content when the card is displayed in a wide or fluid size. Has no effect if the card is displayed in a standard or narrow size. Only used by `Multilink Card`.
28
+ *Option keys: left, right
29
+ */
30
+ alignment?: CardAlignment;
31
+ /**
32
+ *Set the title level for all the cards in the group
33
+ */
34
+ titleLevel?: HeadingTypes;
35
+ /**
36
+ *A Button to display after all the cards in the group
17
37
  */
18
38
  cta?: LinkProps;
39
+ /**
40
+ *Theme - Sets all of the cards to appear as either light or dark. Used by all card groups except for Multilink Card, Data Card and Stat Card.
41
+ *Option keys: dark, light
42
+ */
43
+ theme?: ThemeTypes;
19
44
  }
20
45
  export interface StatCardGroup extends CommonCardGroupProps {
21
46
  /**
@@ -53,6 +78,7 @@ export interface FactlistCardGroup extends CommonCardGroupProps {
53
78
  }
54
79
  export interface DataCardGroup extends CommonCardGroupProps {
55
80
  type: "data";
81
+ titleLevel?: never;
56
82
  cards: DataCardProps[];
57
83
  }
58
84
  export type CardGroupProps = StatCardGroup | MultilinkCardGroup | TextCardGroup | PromoCardGroup | FeatureCardGroup | DetailCardGroup | FactlistCardGroup | DataCardGroup;
@@ -1,4 +1,4 @@
1
- import { CardSize, EventDate } from "../../../types";
1
+ import { CardSize, EventDate, HeadingTypes } from "../../../types";
2
2
  export type DetailCardProps = {
3
3
  /**
4
4
  * A line of text that appears as a small heading above the title of the card
@@ -8,6 +8,10 @@ export type DetailCardProps = {
8
8
  * The title of the card
9
9
  */
10
10
  title: string;
11
+ /**
12
+ * HTML element used for the title
13
+ */
14
+ titleLevel?: HeadingTypes;
11
15
  /**
12
16
  * Introductory text in the card
13
17
  */
@@ -1,9 +1,13 @@
1
- import { ThemeTypes, CardSize } from "../../../types";
1
+ import { ThemeTypes, CardSize, HeadingTypes } from "../../../types";
2
2
  export type FactlistCardProps = {
3
3
  /**
4
4
  * The title of the card
5
5
  */
6
6
  title: string;
7
+ /**
8
+ * HTML element used for the title
9
+ */
10
+ titleLevel?: HeadingTypes;
7
11
  /**
8
12
  * Will render the card to appear on light or dark backgrounds
9
13
  */
@@ -1,4 +1,4 @@
1
- import { ThemeTypes, CardSize, EventDate } from "../../../types";
1
+ import { ThemeTypes, CardSize, EventDate, HeadingTypes } from "../../../types";
2
2
  import { LinkListProps } from "../../LinkList/LinkList.props";
3
3
  export type FeatureCardProps = {
4
4
  isvideo?: boolean;
@@ -10,6 +10,10 @@ export type FeatureCardProps = {
10
10
  * The title of the card
11
11
  */
12
12
  title: string;
13
+ /**
14
+ * HTML element used for the title
15
+ */
16
+ titleLevel?: HeadingTypes;
13
17
  /**
14
18
  * Will render the card to appear on light or dark backgrounds
15
19
  */
@@ -1,4 +1,4 @@
1
- import { CardAlignment, CardSize } from "../../../types";
1
+ import { CardAlignment, CardSize, HeadingTypes } from "../../../types";
2
2
  import { LinkListProps } from "../../LinkList/LinkList.props";
3
3
  export type MultilinkCardProps = {
4
4
  isvideo?: boolean;
@@ -10,6 +10,10 @@ export type MultilinkCardProps = {
10
10
  * The title of the card
11
11
  */
12
12
  title: string;
13
+ /**
14
+ * HTML element used for the title
15
+ */
16
+ titleLevel?: HeadingTypes;
13
17
  /**
14
18
  * How big should the card be
15
19
  */
@@ -1,4 +1,4 @@
1
- import { ThemeTypes, CardCornerType, CardSize } from "../../../types";
1
+ import { ThemeTypes, CardCornerType, CardSize, HeadingTypes } from "../../../types";
2
2
  import { LinkProps } from "../../LinkList/LinkList.props";
3
3
  export type PromoCardProps = {
4
4
  /**
@@ -9,6 +9,10 @@ export type PromoCardProps = {
9
9
  * The title of the card
10
10
  */
11
11
  title: string;
12
+ /**
13
+ * HTML element used for the title
14
+ */
15
+ titleLevel?: HeadingTypes;
12
16
  /**
13
17
  * Will render the card to appear on light or dark backgrounds
14
18
  */
@@ -1,10 +1,17 @@
1
- import { CardColor, CardSize } from "../../../types";
1
+ import { CardColor, CardSize, HeadingTypes } from "../../../types";
2
2
  import { LinkProps } from "../../LinkList/LinkList.props";
3
3
  export type StatCardProps = {
4
4
  /**
5
5
  * The title of the card
6
6
  */
7
7
  title: string;
8
+ /**
9
+ * HTML element used for the title
10
+ */
11
+ titleLevel?: HeadingTypes;
12
+ /**
13
+ * Background color of stat card
14
+ */
8
15
  color?: CardColor;
9
16
  /**
10
17
  * How big should the card be
@@ -1,4 +1,4 @@
1
- import { ThemeTypes, CardSize, EventDate } from "../../../types";
1
+ import { ThemeTypes, CardSize, EventDate, HeadingTypes } from "../../../types";
2
2
  import { ProfileProps } from "../../Profile/Profile.props";
3
3
  export type TextCardProps = {
4
4
  /**
@@ -9,6 +9,10 @@ export type TextCardProps = {
9
9
  * The title of the card
10
10
  */
11
11
  title: string;
12
+ /**
13
+ * HTML element used for the title
14
+ */
15
+ titleLevel?: HeadingTypes;
12
16
  /**
13
17
  * Will render the card to appear on light or dark backgrounds
14
18
  */
@@ -1,2 +1 @@
1
1
  export { default as useGlobalSettings } from "./useGlobalSettings";
2
- export { default as useVideoPlayer } from "./useVideoPlayer";
@@ -29,6 +29,7 @@ export type CardSize = "wide" | "standard" | "narrow" | "fluid";
29
29
  export type CardCornerType = boolean;
30
30
  export type CardAlignment = "left" | "right";
31
31
  export type CardTypes = "stat" | "multilink" | "text" | "promo" | "feature" | "detail" | "factlist" | "data";
32
+ export type HeadingTypes = "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
32
33
  export type EventDate = {
33
34
  unix?: string;
34
35
  human?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilo-org/react",
3
- "version": "0.14.1",
3
+ "version": "0.15.0",
4
4
  "description": "React components for the ILO's Design System",
5
5
  "keywords": [
6
6
  "ui_patterns",
@@ -101,7 +101,7 @@
101
101
  "@ilo-org/brand-assets": "0.5.1",
102
102
  "@ilo-org/fonts": "0.2.1",
103
103
  "@ilo-org/icons-react": "0.1.1",
104
- "@ilo-org/styles": "0.16.1",
104
+ "@ilo-org/styles": "1.0.0",
105
105
  "@ilo-org/themes": "0.8.1",
106
106
  "@ilo-org/utils": "0.1.1"
107
107
  },
@@ -155,7 +155,7 @@
155
155
  "ts-dedent": "^2.2.0",
156
156
  "ts-jest": "^29.1.1",
157
157
  "tslib": "^2.3.1",
158
- "vite": "^4.5.2",
158
+ "vite": "^4.5.3",
159
159
  "@ilo-org/eslint-config": "0.2.1",
160
160
  "@ilo-org/prettier-config": "0.1.1",
161
161
  "@ilo-org/typescript-config": "0.1.1"
@@ -1,75 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
-
5
- const useVideoPlayer = (videoElement) => {
6
- const [fullscreen, setFullscreen] = React.useState(false);
7
- const [playing, setPlaying] = React.useState(false);
8
- const [progress, setProgress] = React.useState(0);
9
- const [showvolume, showVolume] = React.useState(false);
10
- /**
11
- * Fullscreen functionality
12
- */
13
- const toggleFullscreen = () => {
14
- setFullscreen(!fullscreen);
15
- };
16
- React.useEffect(() => {
17
- if (fullscreen) {
18
- if (videoElement.requestFullscreen) {
19
- videoElement.requestFullscreen();
20
- }
21
- }
22
- else {
23
- document.exitFullscreen();
24
- }
25
- }, [fullscreen, videoElement]);
26
- /**
27
- * Play/pause functionality
28
- */
29
- const togglePlay = () => {
30
- setPlaying(!playing);
31
- };
32
- React.useEffect(() => {
33
- playing ? videoElement.current.play() : videoElement.current.pause();
34
- }, [playing, videoElement]);
35
- /**
36
- * Progress indicator
37
- */
38
- const handleOnTimeUpdate = () => {
39
- setProgress((videoElement.current.currentTime / videoElement.current.duration) * 100);
40
- };
41
- /**
42
- * Scrub functionality
43
- */
44
- const handleVideoScrub = (event) => {
45
- const scrubValue = Number((event.offsetX * event.target.max) / event.target.offsetWidth);
46
- videoElement.current.currentTime =
47
- videoElement.current.duration * scrubValue;
48
- setProgress(scrubValue);
49
- };
50
- /**
51
- * Show volume slider
52
- */
53
- const toggleVolumeSlider = () => {
54
- showVolume(!showvolume);
55
- };
56
- /**
57
- * Volume change
58
- */
59
- const handleVolumeChange = (event) => {
60
- videoElement.volume = event.target.value;
61
- };
62
- return {
63
- handleOnTimeUpdate,
64
- handleVideoScrub,
65
- handleVolumeChange,
66
- playing,
67
- progress,
68
- showvolume,
69
- toggleFullscreen,
70
- togglePlay,
71
- toggleVolumeSlider,
72
- };
73
- };
74
-
75
- module.exports = useVideoPlayer;
@@ -1,73 +0,0 @@
1
- import { useState, useEffect } from 'react';
2
-
3
- const useVideoPlayer = (videoElement) => {
4
- const [fullscreen, setFullscreen] = useState(false);
5
- const [playing, setPlaying] = useState(false);
6
- const [progress, setProgress] = useState(0);
7
- const [showvolume, showVolume] = useState(false);
8
- /**
9
- * Fullscreen functionality
10
- */
11
- const toggleFullscreen = () => {
12
- setFullscreen(!fullscreen);
13
- };
14
- useEffect(() => {
15
- if (fullscreen) {
16
- if (videoElement.requestFullscreen) {
17
- videoElement.requestFullscreen();
18
- }
19
- }
20
- else {
21
- document.exitFullscreen();
22
- }
23
- }, [fullscreen, videoElement]);
24
- /**
25
- * Play/pause functionality
26
- */
27
- const togglePlay = () => {
28
- setPlaying(!playing);
29
- };
30
- useEffect(() => {
31
- playing ? videoElement.current.play() : videoElement.current.pause();
32
- }, [playing, videoElement]);
33
- /**
34
- * Progress indicator
35
- */
36
- const handleOnTimeUpdate = () => {
37
- setProgress((videoElement.current.currentTime / videoElement.current.duration) * 100);
38
- };
39
- /**
40
- * Scrub functionality
41
- */
42
- const handleVideoScrub = (event) => {
43
- const scrubValue = Number((event.offsetX * event.target.max) / event.target.offsetWidth);
44
- videoElement.current.currentTime =
45
- videoElement.current.duration * scrubValue;
46
- setProgress(scrubValue);
47
- };
48
- /**
49
- * Show volume slider
50
- */
51
- const toggleVolumeSlider = () => {
52
- showVolume(!showvolume);
53
- };
54
- /**
55
- * Volume change
56
- */
57
- const handleVolumeChange = (event) => {
58
- videoElement.volume = event.target.value;
59
- };
60
- return {
61
- handleOnTimeUpdate,
62
- handleVideoScrub,
63
- handleVolumeChange,
64
- playing,
65
- progress,
66
- showvolume,
67
- toggleFullscreen,
68
- togglePlay,
69
- toggleVolumeSlider,
70
- };
71
- };
72
-
73
- export { useVideoPlayer as default };
@@ -1,12 +0,0 @@
1
- declare const useVideoPlayer: (videoElement: any) => {
2
- handleOnTimeUpdate: () => void;
3
- handleVideoScrub: (event: any) => void;
4
- handleVolumeChange: (event: any) => void;
5
- playing: boolean;
6
- progress: number;
7
- showvolume: boolean;
8
- toggleFullscreen: () => void;
9
- togglePlay: () => void;
10
- toggleVolumeSlider: () => void;
11
- };
12
- export default useVideoPlayer;