@ilo-org/react 0.10.6 → 0.12.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 (246) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/lib/cjs/AccordionCtx-be704051.js +9 -0
  3. package/lib/cjs/{GlobalCtx-97e4b433.js → GlobalCtx-10114bdd.js} +2 -2
  4. package/lib/cjs/ListCtx-14aa546f.js +9 -0
  5. package/lib/cjs/TagCtx-690a1d54.js +7 -0
  6. package/lib/cjs/components/Accordion/Accordion.js +6 -6
  7. package/lib/cjs/components/Accordion/AccordionButton.js +5 -5
  8. package/lib/cjs/components/Accordion/AccordionItem.js +2 -2
  9. package/lib/cjs/components/Accordion/AccordionPanel.js +8 -8
  10. package/lib/cjs/components/Accordion/index.js +2 -2
  11. package/lib/cjs/components/Breadcrumb/Breadcrumb.js +5 -5
  12. package/lib/cjs/components/Breadcrumb/index.js +1 -1
  13. package/lib/cjs/components/Button/Button.js +1 -1
  14. package/lib/cjs/components/Button/index.js +1 -1
  15. package/lib/cjs/components/Callout/Callout.js +4 -4
  16. package/lib/cjs/components/Callout/index.js +1 -1
  17. package/lib/cjs/components/Cards/Card.js +40 -0
  18. package/lib/cjs/components/Cards/CardGroup.js +33 -0
  19. package/lib/cjs/components/Cards/DataCard/index.js +27 -0
  20. package/lib/cjs/components/Cards/DetailCard/index.js +20 -0
  21. package/lib/cjs/components/Cards/FactlistCard/index.js +23 -0
  22. package/lib/cjs/components/Cards/FeatureCard/index.js +24 -0
  23. package/lib/cjs/components/Cards/MultilinkCard/index.js +24 -0
  24. package/lib/cjs/components/Cards/PromoCard/index.js +23 -0
  25. package/lib/cjs/components/Cards/StatCard/index.js +21 -0
  26. package/lib/cjs/components/Cards/TextCard/index.js +25 -0
  27. package/lib/cjs/components/Cards/index.js +37 -0
  28. package/lib/cjs/components/Checkbox/Checkbox.js +5 -5
  29. package/lib/cjs/components/Checkbox/index.js +1 -1
  30. package/lib/cjs/components/Collapse/Collapse.js +1194 -44
  31. package/lib/cjs/components/Collapse/index.js +0 -1
  32. package/lib/cjs/components/ContextMenu/ContextMenu.js +1 -1
  33. package/lib/cjs/components/ContextMenu/index.js +1 -1
  34. package/lib/cjs/components/Credit/Credit.js +3 -3
  35. package/lib/cjs/components/Credit/index.js +1 -1
  36. package/lib/cjs/components/DatePicker/DatePicker.js +4 -4
  37. package/lib/cjs/components/DatePicker/index.js +1 -1
  38. package/lib/cjs/components/Dropdown/Dropdown.js +5 -5
  39. package/lib/cjs/components/Dropdown/index.js +1 -1
  40. package/lib/cjs/components/Empty/Empty.js +1 -1
  41. package/lib/cjs/components/Empty/index.js +1 -1
  42. package/lib/cjs/components/Fieldset/Fieldset.js +5 -5
  43. package/lib/cjs/components/Fieldset/index.js +1 -1
  44. package/lib/cjs/components/FileUpload/FileUpload.js +5 -5
  45. package/lib/cjs/components/FileUpload/index.js +1 -1
  46. package/lib/cjs/components/Footer/Footer.js +1 -1
  47. package/lib/cjs/components/Footer/index.js +1 -1
  48. package/lib/cjs/components/Form/Form.js +3 -3
  49. package/lib/cjs/components/Form/index.js +1 -1
  50. package/lib/cjs/components/FormControl/FormControl.js +7 -7
  51. package/lib/cjs/components/FormControl/index.js +1 -1
  52. package/lib/cjs/components/GlobalProvider/GlobalProvider.js +1 -1
  53. package/lib/cjs/components/GlobalProvider/index.js +1 -1
  54. package/lib/cjs/components/Heading/Heading.js +1 -1
  55. package/lib/cjs/components/Heading/index.js +1 -1
  56. package/lib/cjs/components/Hero/Hero.js +1 -1
  57. package/lib/cjs/components/Hero/HeroCard.js +1 -1
  58. package/lib/cjs/components/Hero/index.js +1 -1
  59. package/lib/cjs/components/Icon/Icon.js +3 -3
  60. package/lib/cjs/components/Icon/index.js +1 -1
  61. package/lib/cjs/components/Image/Image.js +1 -1
  62. package/lib/cjs/components/Image/index.js +1 -1
  63. package/lib/cjs/components/Input/Input.js +1 -1
  64. package/lib/cjs/components/Input/index.js +1 -1
  65. package/lib/cjs/components/Link/Link.js +1 -1
  66. package/lib/cjs/components/Link/index.js +1 -1
  67. package/lib/cjs/components/LinkList/LinkList.js +2 -2
  68. package/lib/cjs/components/LinkList/index.js +1 -1
  69. package/lib/cjs/components/List/List.js +4 -4
  70. package/lib/cjs/components/List/ListItem.js +2 -2
  71. package/lib/cjs/components/List/index.js +2 -2
  72. package/lib/cjs/components/Loading/Loading.js +1 -1
  73. package/lib/cjs/components/Loading/index.js +1 -1
  74. package/lib/cjs/components/LocalNav/LocalNav.js +4 -4
  75. package/lib/cjs/components/LocalNav/index.js +1 -1
  76. package/lib/cjs/components/Logo/Logo.js +15 -15
  77. package/lib/cjs/components/Logo/index.js +1 -1
  78. package/lib/cjs/components/LogoGrid/LogoGrid.js +1 -1
  79. package/lib/cjs/components/LogoGrid/index.js +1 -1
  80. package/lib/cjs/components/Navigation/Navigation.js +6 -6
  81. package/lib/cjs/components/Navigation/index.js +1 -1
  82. package/lib/cjs/components/Notification/Notification.js +3 -3
  83. package/lib/cjs/components/Notification/index.js +1 -1
  84. package/lib/cjs/components/NumberPicker/NumberPicker.js +4 -4
  85. package/lib/cjs/components/NumberPicker/index.js +1 -1
  86. package/lib/cjs/components/Pagination/Pagination.js +1 -1
  87. package/lib/cjs/components/Pagination/index.js +1 -1
  88. package/lib/cjs/components/Profile/Profile.js +1 -1
  89. package/lib/cjs/components/Profile/index.js +1 -1
  90. package/lib/cjs/components/Radio/Radio.js +5 -5
  91. package/lib/cjs/components/Radio/index.js +1 -1
  92. package/lib/cjs/components/ReadMore/ReadMore.js +4 -4
  93. package/lib/cjs/components/ReadMore/index.js +1 -1
  94. package/lib/cjs/components/RichText/RichText.js +1 -1
  95. package/lib/cjs/components/RichText/index.js +1 -1
  96. package/lib/cjs/components/SearchField/SearchField.js +3 -3
  97. package/lib/cjs/components/SearchField/index.js +1 -1
  98. package/lib/cjs/components/SocialMedia/SocialMedia.js +1 -1
  99. package/lib/cjs/components/SocialMedia/index.js +1 -1
  100. package/lib/cjs/components/TableOfContents/TableOfContents.js +1 -1
  101. package/lib/cjs/components/TableOfContents/index.js +1 -1
  102. package/lib/cjs/components/Tabs/Tabs.args.js +156 -0
  103. package/lib/cjs/components/Tabs/Tabs.js +24 -0
  104. package/lib/cjs/components/Tabs/index.js +15 -0
  105. package/lib/cjs/components/Tag/Tag.js +4 -4
  106. package/lib/cjs/components/Tag/TagSet.js +6 -6
  107. package/lib/cjs/components/Tag/index.js +2 -2
  108. package/lib/cjs/components/TextInput/TextInput.js +4 -4
  109. package/lib/cjs/components/TextInput/index.js +1 -1
  110. package/lib/cjs/components/Textarea/Textarea.js +4 -4
  111. package/lib/cjs/components/Textarea/index.js +1 -1
  112. package/lib/cjs/components/Toggle/Toggle.js +4 -4
  113. package/lib/cjs/components/Toggle/index.js +1 -1
  114. package/lib/cjs/components/Tooltip/Tooltip.js +5 -5
  115. package/lib/cjs/components/Tooltip/index.js +1 -1
  116. package/lib/cjs/components/Video/Video.js +11 -12
  117. package/lib/cjs/components/Video/VideoPlayer.js +55 -13
  118. package/lib/cjs/components/Video/index.js +6 -8
  119. package/lib/cjs/components/index.js +21 -12
  120. package/lib/cjs/hooks/index.js +1 -1
  121. package/lib/cjs/hooks/useGlobalSettings.js +3 -3
  122. package/lib/cjs/hooks/usePrevious.js +3 -3
  123. package/lib/cjs/hooks/useVideoPlayer.js +7 -7
  124. package/lib/cjs/index.js +21 -12
  125. package/lib/esm/components/Cards/Card.js +38 -0
  126. package/lib/esm/components/{Card → Cards}/CardGroup.js +14 -6
  127. package/lib/esm/components/Cards/DataCard/index.js +25 -0
  128. package/lib/esm/components/Cards/DetailCard/index.js +18 -0
  129. package/lib/esm/components/Cards/FactlistCard/index.js +21 -0
  130. package/lib/esm/components/Cards/FeatureCard/index.js +22 -0
  131. package/lib/esm/components/Cards/MultilinkCard/index.js +22 -0
  132. package/lib/esm/components/Cards/PromoCard/index.js +21 -0
  133. package/lib/esm/components/Cards/StatCard/index.js +19 -0
  134. package/lib/esm/components/Cards/TextCard/index.js +23 -0
  135. package/lib/esm/components/Cards/index.js +22 -0
  136. package/lib/esm/components/Collapse/Collapse.js +1156 -6
  137. package/lib/esm/components/Collapse/index.js +0 -1
  138. package/lib/esm/components/FileUpload/FileUpload.js +3 -3
  139. package/lib/esm/components/LinkList/LinkList.js +1 -1
  140. package/lib/esm/components/NumberPicker/NumberPicker.js +3 -3
  141. package/lib/esm/components/Radio/Radio.js +3 -3
  142. package/lib/esm/components/Tabs/Tabs.args.js +154 -0
  143. package/lib/esm/components/Tabs/Tabs.js +22 -0
  144. package/lib/esm/components/Tabs/index.js +9 -0
  145. package/lib/esm/components/TextInput/TextInput.js +3 -3
  146. package/lib/esm/components/Textarea/Textarea.js +3 -3
  147. package/lib/esm/components/Video/Video.js +10 -11
  148. package/lib/esm/components/Video/VideoPlayer.js +57 -11
  149. package/lib/esm/components/Video/index.js +5 -7
  150. package/lib/esm/components/index.js +14 -6
  151. package/lib/esm/index.js +14 -6
  152. package/lib/types/react/src/components/Cards/Card.props.d.ts +307 -0
  153. package/lib/types/react/src/components/{Card → Cards}/CardGroup.props.d.ts +1 -1
  154. package/lib/types/react/src/components/Cards/DataCard/index.d.ts +4 -0
  155. package/lib/types/react/src/components/Cards/DetailCard/index.d.ts +4 -0
  156. package/lib/types/react/src/components/Cards/FactlistCard/index.d.ts +4 -0
  157. package/lib/types/react/src/components/Cards/FeatureCard/index.d.ts +4 -0
  158. package/lib/types/react/src/components/Cards/MultilinkCard/index.d.ts +4 -0
  159. package/lib/types/react/src/components/Cards/PromoCard/index.d.ts +4 -0
  160. package/lib/types/react/src/components/Cards/StatCard/index.d.ts +4 -0
  161. package/lib/types/react/src/components/Cards/TextCard/index.d.ts +4 -0
  162. package/lib/types/react/src/components/Cards/index.d.ts +11 -0
  163. package/lib/types/react/src/components/Tabs/Tabs.args.d.ts +10 -0
  164. package/lib/types/react/src/components/Tabs/Tabs.d.ts +4 -0
  165. package/lib/types/react/src/components/Tabs/Tabs.props.d.ts +12 -0
  166. package/lib/types/react/src/components/Tabs/index.d.ts +1 -0
  167. package/lib/types/react/src/components/Video/Video.d.ts +2 -2
  168. package/lib/types/react/src/components/Video/Video.props.d.ts +5 -43
  169. package/lib/types/react/src/components/Video/VideoPlayer.d.ts +3 -3
  170. package/lib/types/react/src/components/Video/VideoPlayer.props.d.ts +6 -31
  171. package/lib/types/react/src/components/index.d.ts +2 -1
  172. package/lib/types/react/src/types/index.d.ts +3 -3
  173. package/package.json +9 -7
  174. package/src/components/{Card → Cards}/Card.args.ts +41 -36
  175. package/src/components/Cards/Card.props.ts +382 -0
  176. package/src/components/Cards/Card.tsx +36 -0
  177. package/src/components/{Card → Cards}/CardGroup.args.ts +26 -26
  178. package/src/components/{Card → Cards}/CardGroup.props.ts +1 -1
  179. package/src/components/{Card → Cards}/CardGroup.tsx +12 -13
  180. package/src/components/Cards/DataCard/index.tsx +107 -0
  181. package/src/components/Cards/DetailCard/index.tsx +62 -0
  182. package/src/components/Cards/FactlistCard/index.tsx +42 -0
  183. package/src/components/Cards/FeatureCard/index.tsx +69 -0
  184. package/src/components/Cards/MultilinkCard/index.tsx +76 -0
  185. package/src/components/Cards/PromoCard/index.tsx +60 -0
  186. package/src/components/Cards/StatCard/index.tsx +36 -0
  187. package/src/components/Cards/TextCard/index.tsx +63 -0
  188. package/src/components/Cards/index.ts +22 -0
  189. package/src/components/LinkList/LinkList.tsx +1 -1
  190. package/src/components/Tabs/Tabs.args.tsx +201 -0
  191. package/src/components/Tabs/Tabs.props.ts +13 -0
  192. package/src/components/Tabs/Tabs.tsx +60 -0
  193. package/src/components/Tabs/index.ts +1 -0
  194. package/src/components/Video/Video.args.ts +18 -24
  195. package/src/components/Video/Video.props.ts +5 -47
  196. package/src/components/Video/Video.tsx +24 -19
  197. package/src/components/Video/VideoPlayer.props.ts +7 -38
  198. package/src/components/Video/VideoPlayer.tsx +67 -322
  199. package/src/components/index.ts +2 -1
  200. package/src/declarations.d.ts +22 -0
  201. package/src/types/index.ts +4 -4
  202. package/lib/cjs/AccordionCtx-fe08ff45.js +0 -9
  203. package/lib/cjs/DailyMotion-17b56ecb.js +0 -259
  204. package/lib/cjs/Facebook-0c8d86ee.js +0 -239
  205. package/lib/cjs/FilePlayer-01d6dc08.js +0 -596
  206. package/lib/cjs/Kaltura-40e8e581.js +0 -235
  207. package/lib/cjs/ListCtx-7db7fe04.js +0 -9
  208. package/lib/cjs/Mixcloud-e23f49d6.js +0 -222
  209. package/lib/cjs/Preview-8e490f54.js +0 -227
  210. package/lib/cjs/SoundCloud-2500b6cb.js +0 -249
  211. package/lib/cjs/Streamable-00723065.js +0 -234
  212. package/lib/cjs/TagCtx-929c7753.js +0 -7
  213. package/lib/cjs/Twitch-2c5c5733.js +0 -244
  214. package/lib/cjs/VideoPlayer-5f0a64c6.js +0 -2067
  215. package/lib/cjs/Vidyard-d36d6c45.js +0 -237
  216. package/lib/cjs/Vimeo-d311e3b8.js +0 -285
  217. package/lib/cjs/Wistia-318b4e43.js +0 -288
  218. package/lib/cjs/YouTube-a3796a55.js +0 -377
  219. package/lib/cjs/components/Card/Card.js +0 -43
  220. package/lib/cjs/components/Card/CardGroup.js +0 -25
  221. package/lib/cjs/components/Card/index.js +0 -21
  222. package/lib/cjs/index-0af02e81.js +0 -1154
  223. package/lib/esm/DailyMotion-989c2db3.js +0 -257
  224. package/lib/esm/Facebook-04e9cc59.js +0 -237
  225. package/lib/esm/FilePlayer-0789336d.js +0 -594
  226. package/lib/esm/Kaltura-a9ed37a9.js +0 -233
  227. package/lib/esm/Mixcloud-5a3b4353.js +0 -220
  228. package/lib/esm/Preview-7ca1835e.js +0 -225
  229. package/lib/esm/SoundCloud-47bccd79.js +0 -247
  230. package/lib/esm/Streamable-ee762126.js +0 -232
  231. package/lib/esm/Twitch-3cd4b54b.js +0 -242
  232. package/lib/esm/VideoPlayer-96c2b20c.js +0 -2062
  233. package/lib/esm/Vidyard-258ab0ef.js +0 -235
  234. package/lib/esm/Vimeo-4b29b580.js +0 -283
  235. package/lib/esm/Wistia-3cbce669.js +0 -286
  236. package/lib/esm/YouTube-db52da1c.js +0 -375
  237. package/lib/esm/components/Card/Card.js +0 -41
  238. package/lib/esm/components/Card/index.js +0 -14
  239. package/lib/esm/index-623ce3f5.js +0 -1152
  240. package/lib/types/react/src/components/Card/Card.props.d.ts +0 -110
  241. package/lib/types/react/src/components/Card/index.d.ts +0 -2
  242. package/src/components/Card/Card.props.ts +0 -142
  243. package/src/components/Card/Card.tsx +0 -183
  244. package/src/components/Card/index.ts +0 -2
  245. /package/lib/types/react/src/components/{Card → Cards}/Card.d.ts +0 -0
  246. /package/lib/types/react/src/components/{Card → Cards}/CardGroup.d.ts +0 -0
@@ -0,0 +1,36 @@
1
+ import { FC } from "react";
2
+ import classnames from "classnames";
3
+ import useGlobalSettings from "../../../hooks/useGlobalSettings";
4
+ import { StatCardProps } from "../Card.props";
5
+ import { Link } from "../../Link";
6
+
7
+ const StatCard: FC<StatCardProps> = ({
8
+ title,
9
+ color,
10
+ size = "standard",
11
+ intro,
12
+ source,
13
+ }) => {
14
+ const { prefix } = useGlobalSettings();
15
+
16
+ const baseClass = `${prefix}--card`;
17
+
18
+ const cardClasses = classnames(baseClass, `${baseClass}__type__stat`, {
19
+ [`${baseClass}__color__${color}`]: color,
20
+ [`${baseClass}__size__${size}`]: size,
21
+ });
22
+
23
+ return (
24
+ <div className={cardClasses}>
25
+ <div className={`${baseClass}--wrap`}>
26
+ <div className={`${baseClass}--content`}>
27
+ {title && <h5 className={`${baseClass}--title`}>{title}</h5>}
28
+ {intro && <p className={`${baseClass}--intro`}>{intro}</p>}
29
+ {source && <Link url={source.url}>{source.label}</Link>}
30
+ </div>
31
+ </div>
32
+ </div>
33
+ );
34
+ };
35
+
36
+ export default StatCard;
@@ -0,0 +1,63 @@
1
+ import { FC } from "react";
2
+ import classnames from "classnames";
3
+ import useGlobalSettings from "../../../hooks/useGlobalSettings";
4
+ import { TextCardProps } from "../Card.props";
5
+ import { Profile } from "../../Profile";
6
+
7
+ const TextCard: FC<TextCardProps> = ({
8
+ eyebrow,
9
+ title,
10
+ theme,
11
+ size,
12
+ date,
13
+ profile,
14
+ link,
15
+ }) => {
16
+ const { prefix } = useGlobalSettings();
17
+
18
+ const baseClass = `${prefix}--card`;
19
+
20
+ const wrapperClass = classnames(`${baseClass}--wrapper`);
21
+
22
+ const cardClasses = classnames(baseClass, `${baseClass}__type__text`, {
23
+ [`${baseClass}__action`]: link,
24
+ [`${baseClass}__size__${size}`]: size,
25
+ [`${baseClass}__theme__${theme}`]: theme,
26
+ });
27
+ console.log("heloo");
28
+ console.log(profile);
29
+ return (
30
+ <div className={wrapperClass}>
31
+ <div className={cardClasses}>
32
+ {link && (
33
+ <a className={`${baseClass}--link`} href={link} title={title}>
34
+ <span className={`${baseClass}--link--text`}>{title}</span>
35
+ </a>
36
+ )}
37
+ <div className={`${baseClass}--wrap`}>
38
+ <div className={`${baseClass}--content`}>
39
+ {eyebrow && <p className={`${baseClass}--eyebrow`}>{eyebrow}</p>}
40
+ {title && <h5 className={`${baseClass}--title`}>{title}</h5>}
41
+ {date && (
42
+ <time className={`${baseClass}--date`} dateTime={date.unix}>
43
+ {date.human}
44
+ </time>
45
+ )}
46
+ {profile && profile.avatar && (
47
+ <Profile
48
+ avatar={profile.avatar}
49
+ description={profile.description}
50
+ link={profile.link}
51
+ name={profile.name}
52
+ role={profile.role}
53
+ className={`${prefix}--profile--contents--${theme}`}
54
+ />
55
+ )}
56
+ </div>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ );
61
+ };
62
+
63
+ export default TextCard;
@@ -0,0 +1,22 @@
1
+ import FeatureCard from "./FeatureCard";
2
+ import DataCard from "./DataCard";
3
+ import DetailCard from "./DetailCard";
4
+ import FactlistCard from "./FactlistCard";
5
+ import MultilinkCard from "./MultilinkCard";
6
+ import PromoCard from "./PromoCard";
7
+ import StatCard from "./StatCard";
8
+ import TextCard from "./TextCard";
9
+
10
+ export {
11
+ FeatureCard,
12
+ DataCard,
13
+ DetailCard,
14
+ FactlistCard,
15
+ MultilinkCard,
16
+ PromoCard,
17
+ StatCard,
18
+ TextCard,
19
+ };
20
+
21
+ export { default as Card } from "./Card";
22
+ export { default as CardGroup } from "./CardGroup";
@@ -19,7 +19,7 @@ const LinkList: FC<LinkListProps> = ({
19
19
 
20
20
  return (
21
21
  <div className={linkListClasses}>
22
- <h3 className={`${baseClass}--headline`}>{headline}</h3>
22
+ {headline && <h3 className={`${baseClass}--headline`}>{headline}</h3>}
23
23
  <ul className={`${baseClass}--linkgroups`}>
24
24
  {linkgroup &&
25
25
  linkgroup.map((linkset, i) => (
@@ -0,0 +1,201 @@
1
+ import { RichText } from "../RichText";
2
+ import { Image } from "../Image";
3
+ import { TabsProps } from "./Tabs.props";
4
+
5
+ const tabs: TabsProps = {
6
+ items: [
7
+ {
8
+ label:
9
+ "Tab Label With A Really Really Lenghty Title Even Though We Do Not Recommend Such A Lengthy Title",
10
+ content: (
11
+ <Image
12
+ alt="My alt text"
13
+ caption="Women construction workers in Nepal build roads and bridges as part of a National Rural Transport Programme co-sponsored by the ILO."
14
+ credit="© Marcel Crozet/ILO"
15
+ url={[
16
+ { breakpoint: 0, src: "/small.jpg" },
17
+ { breakpoint: 800, src: "/medium.jpg" },
18
+ { breakpoint: 1200, src: "/large.jpg" },
19
+ { breakpoint: 1440, src: "/large.jpg" },
20
+ ]}
21
+ />
22
+ ),
23
+ },
24
+ {
25
+ label: "Tab Label 2",
26
+ content: (
27
+ <RichText content="<h2>International Labour Organization</h2> <p>The <b>International Labour Organization</b> (<b>ILO</b>) is a <a href='https://www.un.org'>United Nations</a> agency whose mandate is to advance social and economic justice by setting international labour standards. Founded in October 1919 under the League of Nations, it is the first and oldest specialised agency of the UN. The ILO has 187 member states: 186 out of 193 UN member states plus the Cook Islands.</p> <p>Whereas also the failure of any nation to adopt humane conditions of labour is an obstacle in the way of other nations which desire to improve the conditions in their own countries.</p> <figure><img alt='placeholder image' class='right' src='/ilo-headquarters.jpg'><figcaption>The ILO's headquarters in Geneva, Switzerland. ©Steiner SA</figcaption></figure> <h3>ILO Constitution</h3> <p>The driving forces for the ILO's creation arose from security, humanitarian, political and economic considerations.</p> <blockquote> <p>The fundamental ideas that forged the ILO one hundred and three years ago still underpin the global pledge to leave no one behind.</p> <cite>ILO Director-General Gilbert F. Houngbo</cite> </blockquote> Reflecting these ideas, the Preamble of the ILO Constitution states:</p> <ol> <li>Whereas universal and lasting peace can be established only if it is based upon social justice;</li> <li>And whereas conditions of labour exist involving such injustice, hardship and privation to large numbers of people as to produce unrest so great that the peace and harmony of the world are imperilled; and an improvement of those conditions is urgently required;</li> <li>Whereas also the failure of any nation to adopt humane conditions of labour is an obstacle in the way of other nations which desire to improve the conditions in their own countries.</li> </ol>" />
28
+ ),
29
+ },
30
+ ],
31
+ };
32
+
33
+ const withIcon: TabsProps = {
34
+ items: [
35
+ {
36
+ icon: {
37
+ hidden: false,
38
+ name: "info",
39
+ },
40
+ label:
41
+ "Tab Label With A Really Really Lenghty Title Even Though We Do Not Recommend Such A Lengthy Title",
42
+ content: (
43
+ <Image
44
+ alt="My alt text"
45
+ caption="Women construction workers in Nepal build roads and bridges as part of a National Rural Transport Programme co-sponsored by the ILO."
46
+ credit="© Marcel Crozet/ILO"
47
+ url={[
48
+ { breakpoint: 0, src: "/small.jpg" },
49
+ { breakpoint: 800, src: "/medium.jpg" },
50
+ { breakpoint: 1200, src: "/large.jpg" },
51
+ { breakpoint: 1440, src: "/large.jpg" },
52
+ ]}
53
+ />
54
+ ),
55
+ },
56
+ {
57
+ icon: {
58
+ hidden: false,
59
+ name: "info",
60
+ },
61
+ label: "Tab Label 2",
62
+ content: (
63
+ <RichText content="<h2>International Labour Organization</h2> <p>The <b>International Labour Organization</b> (<b>ILO</b>) is a <a href='https://www.un.org'>United Nations</a> agency whose mandate is to advance social and economic justice by setting international labour standards. Founded in October 1919 under the League of Nations, it is the first and oldest specialised agency of the UN. The ILO has 187 member states: 186 out of 193 UN member states plus the Cook Islands.</p> <p>Whereas also the failure of any nation to adopt humane conditions of labour is an obstacle in the way of other nations which desire to improve the conditions in their own countries.</p> <figure><img alt='placeholder image' class='right' src='/ilo-headquarters.jpg'><figcaption>The ILO's headquarters in Geneva, Switzerland. ©Steiner SA</figcaption></figure> <h3>ILO Constitution</h3> <p>The driving forces for the ILO's creation arose from security, humanitarian, political and economic considerations.</p> <blockquote> <p>The fundamental ideas that forged the ILO one hundred and three years ago still underpin the global pledge to leave no one behind.</p> <cite>ILO Director-General Gilbert F. Houngbo</cite> </blockquote> Reflecting these ideas, the Preamble of the ILO Constitution states:</p> <ol> <li>Whereas universal and lasting peace can be established only if it is based upon social justice;</li> <li>And whereas conditions of labour exist involving such injustice, hardship and privation to large numbers of people as to produce unrest so great that the peace and harmony of the world are imperilled; and an improvement of those conditions is urgently required;</li> <li>Whereas also the failure of any nation to adopt humane conditions of labour is an obstacle in the way of other nations which desire to improve the conditions in their own countries.</li> </ol>" />
64
+ ),
65
+ },
66
+ ],
67
+ };
68
+
69
+ const fiveItems: TabsProps = {
70
+ items: [
71
+ {
72
+ label: "Tab One",
73
+ content: (
74
+ <RichText content="<h2>International Labour Organization</h2> <p>The <b>International Labour Organization</b> (<b>ILO</b>) is a <a href='https://www.un.org'>United Nations</a> agency whose mandate is to advance social and economic justice by setting international labour standards. Founded in October 1919 under the League of Nations, it is the first and oldest specialised agency of the UN. The ILO has 187 member states: 186 out of 193 UN member states plus the Cook Islands.</p> <p>Whereas also the failure of any nation to adopt humane conditions of labour is an obstacle in the way of other nations which desire to improve the conditions in their own countries.</p> <figure><img alt='placeholder image' class='right' src='/ilo-headquarters.jpg'><figcaption>The ILO's headquarters in Geneva, Switzerland. ©Steiner SA</figcaption></figure> <h3>ILO Constitution</h3> <p>The driving forces for the ILO's creation arose from security, humanitarian, political and economic considerations.</p> <blockquote> <p>The fundamental ideas that forged the ILO one hundred and three years ago still underpin the global pledge to leave no one behind.</p> <cite>ILO Director-General Gilbert F. Houngbo</cite> </blockquote> Reflecting these ideas, the Preamble of the ILO Constitution states:</p> <ol> <li>Whereas universal and lasting peace can be established only if it is based upon social justice;</li> <li>And whereas conditions of labour exist involving such injustice, hardship and privation to large numbers of people as to produce unrest so great that the peace and harmony of the world are imperilled; and an improvement of those conditions is urgently required;</li> <li>Whereas also the failure of any nation to adopt humane conditions of labour is an obstacle in the way of other nations which desire to improve the conditions in their own countries.</li> </ol>" />
75
+ ),
76
+ },
77
+ {
78
+ label: "Tab Two",
79
+ content: (
80
+ <Image
81
+ alt="My alt text"
82
+ caption="Women construction workers in Nepal build roads and bridges as part of a National Rural Transport Programme co-sponsored by the ILO."
83
+ credit="© Marcel Crozet/ILO"
84
+ url={[
85
+ {
86
+ breakpoint: 0,
87
+ src: "https://place-hold.it/400x300?text=Tab Two Image",
88
+ },
89
+ {
90
+ breakpoint: 800,
91
+ src: "https://place-hold.it/800x600?text=Tab Two Image",
92
+ },
93
+ {
94
+ breakpoint: 1200,
95
+ src: "https://place-hold.it/1200x900?text=Tab Two Image",
96
+ },
97
+ {
98
+ breakpoint: 1440,
99
+ src: "https://place-hold.it/1600x1200?text=Tab Two Image",
100
+ },
101
+ ]}
102
+ />
103
+ ),
104
+ },
105
+ {
106
+ label: "Tab Three",
107
+ content: (
108
+ <Image
109
+ alt="My alt text"
110
+ caption="Women construction workers in Nepal build roads and bridges as part of a National Rural Transport Programme co-sponsored by the ILO."
111
+ credit="© Marcel Crozet/ILO"
112
+ url={[
113
+ {
114
+ breakpoint: 0,
115
+ src: "https://place-hold.it/400x300?text=Tab Three Image",
116
+ },
117
+ {
118
+ breakpoint: 800,
119
+ src: "https://place-hold.it/800x600?text=Tab Three Image",
120
+ },
121
+ {
122
+ breakpoint: 1200,
123
+ src: "https://place-hold.it/1200x900?text=Tab Three Image",
124
+ },
125
+ {
126
+ breakpoint: 1440,
127
+ src: "https://place-hold.it/1600x1200?text=Tab Three Image",
128
+ },
129
+ ]}
130
+ />
131
+ ),
132
+ },
133
+ {
134
+ label: "Tab Four Has A Really Lenghthy Title Which Might Get Truncated",
135
+ content: (
136
+ <Image
137
+ alt="My alt text"
138
+ caption="Women construction workers in Nepal build roads and bridges as part of a National Rural Transport Programme co-sponsored by the ILO."
139
+ credit="© Marcel Crozet/ILO"
140
+ url={[
141
+ {
142
+ breakpoint: 0,
143
+ src: "https://place-hold.it/400x300?text=Tab Four Image",
144
+ },
145
+ {
146
+ breakpoint: 800,
147
+ src: "https://place-hold.it/800x600?text=Tab Four Image",
148
+ },
149
+ {
150
+ breakpoint: 1200,
151
+ src: "https://place-hold.it/1200x900?text=Tab Four Image",
152
+ },
153
+ {
154
+ breakpoint: 1440,
155
+ src: "https://place-hold.it/1600x1200?text=Tab Four Image",
156
+ },
157
+ ]}
158
+ />
159
+ ),
160
+ },
161
+ {
162
+ label: "Tab Five",
163
+ content: (
164
+ <Image
165
+ alt="My alt text"
166
+ caption="Women construction workers in Nepal build roads and bridges as part of a National Rural Transport Programme co-sponsored by the ILO."
167
+ credit="© Marcel Crozet/ILO"
168
+ url={[
169
+ {
170
+ breakpoint: 0,
171
+ src: "https://place-hold.it/400x300?text=Tab Five Image",
172
+ },
173
+ {
174
+ breakpoint: 800,
175
+ src: "https://place-hold.it/800x600?text=Tab Five Image",
176
+ },
177
+ {
178
+ breakpoint: 1200,
179
+ src: "https://place-hold.it/1200x900?text=Tab Five Image",
180
+ },
181
+ {
182
+ breakpoint: 1440,
183
+ src: "https://place-hold.it/1600x1200?text=Tab Five Image",
184
+ },
185
+ ]}
186
+ />
187
+ ),
188
+ },
189
+ ],
190
+ };
191
+
192
+ /**
193
+ * Sample prop definitions for Button's enumerable properties (imported in stories and tests).
194
+ */
195
+ const TabsArgs = {
196
+ tabs,
197
+ withIcon,
198
+ fiveItems,
199
+ };
200
+
201
+ export default TabsArgs;
@@ -0,0 +1,13 @@
1
+ import { IconProps } from "../Icon/Icon.props";
2
+ export interface TabsProps {
3
+ /**
4
+ * Specify the items inside a tab
5
+ */
6
+ items: Required<Array<TabItem>>;
7
+ }
8
+
9
+ export interface TabItem {
10
+ icon?: IconProps;
11
+ label: Required<string>;
12
+ content: Required<any>;
13
+ }
@@ -0,0 +1,60 @@
1
+ import { FC, SetStateAction, useState } from "react";
2
+ import useGlobalSettings from "../../hooks/useGlobalSettings";
3
+ import classnames from "classnames";
4
+ import { TabsProps } from "./Tabs.props";
5
+ import { Icon } from "../Icon";
6
+
7
+ const Tabs: FC<TabsProps> = ({ items }) => {
8
+ const [activeTab, setActiveTab] = useState(0);
9
+
10
+ const handleTabClick = (
11
+ index: SetStateAction<number>,
12
+ e: React.MouseEvent<HTMLElement>
13
+ ) => {
14
+ setActiveTab(index);
15
+ e.preventDefault();
16
+ };
17
+
18
+ const { prefix } = useGlobalSettings();
19
+
20
+ const baseClass = `${prefix}--tabs`;
21
+ const tabsClasses = classnames(baseClass);
22
+
23
+ return (
24
+ <div className={`${tabsClasses} tabs--js`}>
25
+ <ul className={`${baseClass}--selection`} role="tablist">
26
+ {items.map((tab, index) => (
27
+ <li
28
+ key={`#tab--${index}`}
29
+ role="tab"
30
+ className={`${baseClass}--selection--item ${
31
+ activeTab === index ? "active" : ""
32
+ }`}
33
+ onClick={(e) => handleTabClick(index, e)}
34
+ >
35
+ <a
36
+ href={`#tab--${index}`}
37
+ className={`${baseClass}--selection--button${
38
+ tab.icon ? " icon" : ""
39
+ }`}
40
+ role="tab"
41
+ aria-controls={`tab--${index}`}
42
+ aria-selected={index === activeTab ? true : false}
43
+ title={tab.label}
44
+ >
45
+ <span className={`${baseClass}--selection--label`}>
46
+ {tab.label}
47
+ </span>
48
+ {tab.icon && (
49
+ <Icon name={tab.icon.name} hidden={tab.icon.hidden} />
50
+ )}
51
+ </a>
52
+ </li>
53
+ ))}
54
+ </ul>
55
+ <div className={`${baseClass}--content`}>{items[activeTab].content}</div>
56
+ </div>
57
+ );
58
+ };
59
+
60
+ export default Tabs;
@@ -0,0 +1 @@
1
+ export { default as Tabs } from "./Tabs";
@@ -1,45 +1,39 @@
1
1
  import { VideoProps } from "./Video.props";
2
2
 
3
3
  const videofile: VideoProps = {
4
- alt: "The ILO logo on a blue background",
5
4
  className: "image",
6
5
  caption:
7
6
  "The ILO brings together governments, employers and workers to set labour standards and promote decent work.",
8
7
  poster: {
9
- url: [{ src: "/media-file-poster.jpg" }],
10
- alt: "",
8
+ src: "/media-file-poster.jpg",
9
+ alt: "The ILO logo on a blue background",
11
10
  },
12
- video: {
13
- controls: {
14
- fullscreen: "Fullscreen",
15
- play: "Play",
16
- pause: "Pause",
17
- volume: "Volume",
18
- },
19
- src: "/video-example.mp4",
20
- youtube: false,
11
+ controls: {
12
+ fullscreen: "Fullscreen",
13
+ play: "Play",
14
+ pause: "Pause",
15
+ volume: "Volume",
21
16
  },
17
+ src: "/video-example.mp4",
18
+ youtube: false,
22
19
  };
23
20
 
24
21
  const videoyt: VideoProps = {
25
- alt: "An smiling woman with gray hair holds a bowl full of corn in front of her home.",
26
22
  caption:
27
23
  "Indigenous entrepreneur Celestina Ábalos runs a tourism business in the UNESCO World Heritage site of Quebrada de Humahuaca in northern Argentina. ©ILO/Ivar Velasquez",
28
24
  className: "image",
29
25
  poster: {
30
- url: [{ src: "/youtube-video-poster.avif" }],
31
- alt: "",
26
+ src: "/youtube-video-poster.avif",
27
+ alt: "An smiling woman with gray hair holds a bowl full of corn in front of her home.",
32
28
  },
33
- video: {
34
- controls: {
35
- fullscreen: "Fullscreen",
36
- play: "Play",
37
- pause: "Pause",
38
- volume: "Volume",
39
- },
40
- src: "https://youtu.be/X72_A4_6zjU",
41
- youtube: true,
29
+ controls: {
30
+ fullscreen: "Fullscreen",
31
+ play: "Play",
32
+ pause: "Pause",
33
+ volume: "Volume",
42
34
  },
35
+ src: "https://youtu.be/X72_A4_6zjU",
36
+ youtube: true,
43
37
  };
44
38
 
45
39
  /**
@@ -1,59 +1,22 @@
1
- import { TracksConfig } from "./VideoPlayer.props";
1
+ import { VideoPlayerControls } from "./VideoPlayer.props";
2
2
 
3
3
  export interface Poster {
4
- url: { src: string }[];
4
+ src: string;
5
5
  alt: string;
6
6
  }
7
7
 
8
- interface VideoPlayerControls {
9
- /**
10
- * Specify the label for the fullscreen button
11
- */
12
- fullscreen?: Required<string>;
13
-
14
- /**
15
- * Specify the label for the play button
16
- */
17
- play?: Required<string>;
18
-
19
- /**
20
- * Specify the label for the pause button
21
- */
22
- pause?: Required<string>;
23
-
24
- /**
25
- * Specify the label for the volume button
26
- */
27
- volume?: Required<string>;
28
- }
8
+ export interface VideoProps {
9
+ src: string;
29
10
 
30
- interface Video {
31
11
  /**
32
12
  * Specify the strings to be used as labels for the video controls
33
13
  */
34
- controls?: Required<VideoPlayerControls | false>;
35
-
36
- /**
37
- * if self-hosted, specify the url of this video
38
- */
39
- src?: string | null;
40
-
41
- /**
42
- * if there are closed-caption tracks,
43
- */
44
- tracks?: TracksConfig[];
14
+ controls?: VideoPlayerControls;
45
15
 
46
16
  /**
47
17
  * if YouTube, set to true
48
18
  */
49
19
  youtube?: boolean;
50
- }
51
-
52
- export interface VideoProps {
53
- /**
54
- * Specify the alt for the image
55
- */
56
- alt: string;
57
20
 
58
21
  /**
59
22
  * Specify the caption for the image/video
@@ -69,9 +32,4 @@ export interface VideoProps {
69
32
  * Specify the image src for the image
70
33
  */
71
34
  poster?: Poster;
72
-
73
- /**
74
- * Specify whether there is a video being shown
75
- */
76
- video: Video;
77
35
  }
@@ -1,29 +1,34 @@
1
- import { FC } from "react";
1
+ import { forwardRef } from "react";
2
2
  import classNames from "classnames";
3
3
  import useGlobalSettings from "../../hooks/useGlobalSettings";
4
4
  import { VideoProps } from "./Video.props";
5
5
  import VideoPlayer from "./VideoPlayer";
6
+ import { VideoPlayerRef } from "./VideoPlayer.props";
6
7
 
7
- const Video: FC<VideoProps> = ({ className, caption, poster, video }) => {
8
- const { prefix } = useGlobalSettings();
9
- const baseClass = `${prefix}--legacyvideo`;
8
+ const Video = forwardRef<VideoPlayerRef, VideoProps>(
9
+ ({ className, caption, ...video }, ref) => {
10
+ const { prefix } = useGlobalSettings();
11
+ const baseClass = `${prefix}--video`;
10
12
 
11
- const videoClasses = classNames(className, {
12
- [baseClass]: true,
13
- });
13
+ const videoClasses = classNames(className, {
14
+ [baseClass]: true,
15
+ });
14
16
 
15
- const captionClasses = classNames("", {
16
- [`${baseClass}--caption`]: true,
17
- });
17
+ const captionClasses = classNames("", {
18
+ [`${baseClass}--caption`]: true,
19
+ });
18
20
 
19
- return (
20
- <figure className={videoClasses}>
21
- <div className={`${videoClasses}--wrapper`}>
22
- {video && <VideoPlayer {...video} poster={poster} />}
23
- </div>
24
- {caption && <figcaption className={captionClasses}>{caption}</figcaption>}
25
- </figure>
26
- );
27
- };
21
+ return (
22
+ <figure className={videoClasses}>
23
+ <div className={`${videoClasses}--wrapper`}>
24
+ {video && <VideoPlayer {...video} ref={ref} />}
25
+ </div>
26
+ {caption && (
27
+ <figcaption className={captionClasses}>{caption}</figcaption>
28
+ )}
29
+ </figure>
30
+ );
31
+ }
32
+ );
28
33
 
29
34
  export default Video;
@@ -1,5 +1,9 @@
1
1
  import { Poster } from "./Video.props";
2
+ import videojs from "video.js";
2
3
 
4
+ export interface VideoPlayerRef {
5
+ player: videojs.Player | undefined;
6
+ }
3
7
  export interface VideoPlayerControls {
4
8
  /**
5
9
  * Specify the label for the fullscreen button
@@ -22,29 +26,9 @@ export interface VideoPlayerControls {
22
26
  volume: string;
23
27
  }
24
28
 
25
- export interface TracksConfig {
26
- /**
27
- * is this the default track?
28
- */
29
- default?: boolean;
30
-
31
- /**
32
- * What kind of track is it?
33
- */
34
- kind?: string;
35
-
36
- /**
37
- * url for the track
38
- */
39
- src?: string;
40
-
41
- /**
42
- * language of the track
43
- */
44
- srcLang?: string;
45
- }
46
-
47
29
  export interface VideoPlayerProps {
30
+ src: string;
31
+
48
32
  /**
49
33
  * Specify an optional className to be added to your Media.
50
34
  */
@@ -53,28 +37,13 @@ export interface VideoPlayerProps {
53
37
  /**
54
38
  * Specify the strings to be used as labels for the video controls
55
39
  */
56
- controls?: Required<VideoPlayerControls | false>;
57
-
58
- /**
59
- * Specify whether a video is to be shown
60
- */
61
- hasvideo?: Required<boolean>;
40
+ controls?: VideoPlayerControls;
62
41
 
63
42
  /**
64
43
  * poster image for video
65
44
  */
66
45
  poster?: Poster;
67
46
 
68
- /**
69
- * if self-hosted, specify the url of this video
70
- */
71
- src?: string | null;
72
-
73
- /**
74
- * if there are closed-caption tracks,
75
- */
76
- tracks?: Required<Array<TracksConfig>> | null;
77
-
78
47
  /**
79
48
  * if YouTube, set to true
80
49
  */