@ilo-org/react 0.10.6 → 0.11.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 (185) hide show
  1. package/CHANGELOG.md +14 -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/Card/Card.js +2 -2
  18. package/lib/cjs/components/Card/CardGroup.js +2 -2
  19. package/lib/cjs/components/Card/index.js +2 -2
  20. package/lib/cjs/components/Checkbox/Checkbox.js +5 -5
  21. package/lib/cjs/components/Checkbox/index.js +1 -1
  22. package/lib/cjs/components/Collapse/Collapse.js +1194 -44
  23. package/lib/cjs/components/Collapse/index.js +0 -1
  24. package/lib/cjs/components/ContextMenu/ContextMenu.js +1 -1
  25. package/lib/cjs/components/ContextMenu/index.js +1 -1
  26. package/lib/cjs/components/Credit/Credit.js +3 -3
  27. package/lib/cjs/components/Credit/index.js +1 -1
  28. package/lib/cjs/components/DatePicker/DatePicker.js +4 -4
  29. package/lib/cjs/components/DatePicker/index.js +1 -1
  30. package/lib/cjs/components/Dropdown/Dropdown.js +5 -5
  31. package/lib/cjs/components/Dropdown/index.js +1 -1
  32. package/lib/cjs/components/Empty/Empty.js +1 -1
  33. package/lib/cjs/components/Empty/index.js +1 -1
  34. package/lib/cjs/components/Fieldset/Fieldset.js +5 -5
  35. package/lib/cjs/components/Fieldset/index.js +1 -1
  36. package/lib/cjs/components/FileUpload/FileUpload.js +5 -5
  37. package/lib/cjs/components/FileUpload/index.js +1 -1
  38. package/lib/cjs/components/Footer/Footer.js +1 -1
  39. package/lib/cjs/components/Footer/index.js +1 -1
  40. package/lib/cjs/components/Form/Form.js +3 -3
  41. package/lib/cjs/components/Form/index.js +1 -1
  42. package/lib/cjs/components/FormControl/FormControl.js +7 -7
  43. package/lib/cjs/components/FormControl/index.js +1 -1
  44. package/lib/cjs/components/GlobalProvider/GlobalProvider.js +1 -1
  45. package/lib/cjs/components/GlobalProvider/index.js +1 -1
  46. package/lib/cjs/components/Heading/Heading.js +1 -1
  47. package/lib/cjs/components/Heading/index.js +1 -1
  48. package/lib/cjs/components/Hero/Hero.js +1 -1
  49. package/lib/cjs/components/Hero/HeroCard.js +1 -1
  50. package/lib/cjs/components/Hero/index.js +1 -1
  51. package/lib/cjs/components/Icon/Icon.js +3 -3
  52. package/lib/cjs/components/Icon/index.js +1 -1
  53. package/lib/cjs/components/Image/Image.js +1 -1
  54. package/lib/cjs/components/Image/index.js +1 -1
  55. package/lib/cjs/components/Input/Input.js +1 -1
  56. package/lib/cjs/components/Input/index.js +1 -1
  57. package/lib/cjs/components/Link/Link.js +1 -1
  58. package/lib/cjs/components/Link/index.js +1 -1
  59. package/lib/cjs/components/LinkList/LinkList.js +1 -1
  60. package/lib/cjs/components/LinkList/index.js +1 -1
  61. package/lib/cjs/components/List/List.js +4 -4
  62. package/lib/cjs/components/List/ListItem.js +2 -2
  63. package/lib/cjs/components/List/index.js +2 -2
  64. package/lib/cjs/components/Loading/Loading.js +1 -1
  65. package/lib/cjs/components/Loading/index.js +1 -1
  66. package/lib/cjs/components/LocalNav/LocalNav.js +4 -4
  67. package/lib/cjs/components/LocalNav/index.js +1 -1
  68. package/lib/cjs/components/Logo/Logo.js +15 -15
  69. package/lib/cjs/components/Logo/index.js +1 -1
  70. package/lib/cjs/components/LogoGrid/LogoGrid.js +1 -1
  71. package/lib/cjs/components/LogoGrid/index.js +1 -1
  72. package/lib/cjs/components/Navigation/Navigation.js +6 -6
  73. package/lib/cjs/components/Navigation/index.js +1 -1
  74. package/lib/cjs/components/Notification/Notification.js +3 -3
  75. package/lib/cjs/components/Notification/index.js +1 -1
  76. package/lib/cjs/components/NumberPicker/NumberPicker.js +4 -4
  77. package/lib/cjs/components/NumberPicker/index.js +1 -1
  78. package/lib/cjs/components/Pagination/Pagination.js +1 -1
  79. package/lib/cjs/components/Pagination/index.js +1 -1
  80. package/lib/cjs/components/Profile/Profile.js +1 -1
  81. package/lib/cjs/components/Profile/index.js +1 -1
  82. package/lib/cjs/components/Radio/Radio.js +5 -5
  83. package/lib/cjs/components/Radio/index.js +1 -1
  84. package/lib/cjs/components/ReadMore/ReadMore.js +4 -4
  85. package/lib/cjs/components/ReadMore/index.js +1 -1
  86. package/lib/cjs/components/RichText/RichText.js +1 -1
  87. package/lib/cjs/components/RichText/index.js +1 -1
  88. package/lib/cjs/components/SearchField/SearchField.js +3 -3
  89. package/lib/cjs/components/SearchField/index.js +1 -1
  90. package/lib/cjs/components/SocialMedia/SocialMedia.js +1 -1
  91. package/lib/cjs/components/SocialMedia/index.js +1 -1
  92. package/lib/cjs/components/TableOfContents/TableOfContents.js +1 -1
  93. package/lib/cjs/components/TableOfContents/index.js +1 -1
  94. package/lib/cjs/components/Tabs/Tabs.args.js +156 -0
  95. package/lib/cjs/components/Tabs/Tabs.js +24 -0
  96. package/lib/cjs/components/Tabs/index.js +15 -0
  97. package/lib/cjs/components/Tag/Tag.js +4 -4
  98. package/lib/cjs/components/Tag/TagSet.js +6 -6
  99. package/lib/cjs/components/Tag/index.js +2 -2
  100. package/lib/cjs/components/TextInput/TextInput.js +4 -4
  101. package/lib/cjs/components/TextInput/index.js +1 -1
  102. package/lib/cjs/components/Textarea/Textarea.js +4 -4
  103. package/lib/cjs/components/Textarea/index.js +1 -1
  104. package/lib/cjs/components/Toggle/Toggle.js +4 -4
  105. package/lib/cjs/components/Toggle/index.js +1 -1
  106. package/lib/cjs/components/Tooltip/Tooltip.js +5 -5
  107. package/lib/cjs/components/Tooltip/index.js +1 -1
  108. package/lib/cjs/components/Video/Video.js +11 -12
  109. package/lib/cjs/components/Video/VideoPlayer.js +55 -13
  110. package/lib/cjs/components/Video/index.js +6 -8
  111. package/lib/cjs/components/index.js +9 -8
  112. package/lib/cjs/hooks/index.js +1 -1
  113. package/lib/cjs/hooks/useGlobalSettings.js +3 -3
  114. package/lib/cjs/hooks/usePrevious.js +3 -3
  115. package/lib/cjs/hooks/useVideoPlayer.js +7 -7
  116. package/lib/cjs/index.js +9 -8
  117. package/lib/esm/components/Collapse/Collapse.js +1156 -6
  118. package/lib/esm/components/Collapse/index.js +0 -1
  119. package/lib/esm/components/FileUpload/FileUpload.js +3 -3
  120. package/lib/esm/components/NumberPicker/NumberPicker.js +3 -3
  121. package/lib/esm/components/Radio/Radio.js +3 -3
  122. package/lib/esm/components/Tabs/Tabs.args.js +154 -0
  123. package/lib/esm/components/Tabs/Tabs.js +22 -0
  124. package/lib/esm/components/Tabs/index.js +9 -0
  125. package/lib/esm/components/TextInput/TextInput.js +3 -3
  126. package/lib/esm/components/Textarea/Textarea.js +3 -3
  127. package/lib/esm/components/Video/Video.js +10 -11
  128. package/lib/esm/components/Video/VideoPlayer.js +57 -11
  129. package/lib/esm/components/Video/index.js +5 -7
  130. package/lib/esm/components/index.js +4 -4
  131. package/lib/esm/index.js +4 -4
  132. package/lib/types/react/src/components/Tabs/Tabs.args.d.ts +10 -0
  133. package/lib/types/react/src/components/Tabs/Tabs.d.ts +4 -0
  134. package/lib/types/react/src/components/Tabs/Tabs.props.d.ts +12 -0
  135. package/lib/types/react/src/components/Tabs/index.d.ts +1 -0
  136. package/lib/types/react/src/components/Video/Video.d.ts +2 -2
  137. package/lib/types/react/src/components/Video/Video.props.d.ts +5 -43
  138. package/lib/types/react/src/components/Video/VideoPlayer.d.ts +3 -3
  139. package/lib/types/react/src/components/Video/VideoPlayer.props.d.ts +6 -31
  140. package/lib/types/react/src/components/index.d.ts +1 -0
  141. package/package.json +9 -7
  142. package/src/components/Tabs/Tabs.args.tsx +201 -0
  143. package/src/components/Tabs/Tabs.props.ts +13 -0
  144. package/src/components/Tabs/Tabs.tsx +60 -0
  145. package/src/components/Tabs/index.ts +1 -0
  146. package/src/components/Video/Video.args.ts +18 -24
  147. package/src/components/Video/Video.props.ts +5 -47
  148. package/src/components/Video/Video.tsx +24 -19
  149. package/src/components/Video/VideoPlayer.props.ts +7 -38
  150. package/src/components/Video/VideoPlayer.tsx +67 -322
  151. package/src/components/index.ts +1 -0
  152. package/src/declarations.d.ts +22 -0
  153. package/lib/cjs/AccordionCtx-fe08ff45.js +0 -9
  154. package/lib/cjs/DailyMotion-17b56ecb.js +0 -259
  155. package/lib/cjs/Facebook-0c8d86ee.js +0 -239
  156. package/lib/cjs/FilePlayer-01d6dc08.js +0 -596
  157. package/lib/cjs/Kaltura-40e8e581.js +0 -235
  158. package/lib/cjs/ListCtx-7db7fe04.js +0 -9
  159. package/lib/cjs/Mixcloud-e23f49d6.js +0 -222
  160. package/lib/cjs/Preview-8e490f54.js +0 -227
  161. package/lib/cjs/SoundCloud-2500b6cb.js +0 -249
  162. package/lib/cjs/Streamable-00723065.js +0 -234
  163. package/lib/cjs/TagCtx-929c7753.js +0 -7
  164. package/lib/cjs/Twitch-2c5c5733.js +0 -244
  165. package/lib/cjs/VideoPlayer-5f0a64c6.js +0 -2067
  166. package/lib/cjs/Vidyard-d36d6c45.js +0 -237
  167. package/lib/cjs/Vimeo-d311e3b8.js +0 -285
  168. package/lib/cjs/Wistia-318b4e43.js +0 -288
  169. package/lib/cjs/YouTube-a3796a55.js +0 -377
  170. package/lib/cjs/index-0af02e81.js +0 -1154
  171. package/lib/esm/DailyMotion-989c2db3.js +0 -257
  172. package/lib/esm/Facebook-04e9cc59.js +0 -237
  173. package/lib/esm/FilePlayer-0789336d.js +0 -594
  174. package/lib/esm/Kaltura-a9ed37a9.js +0 -233
  175. package/lib/esm/Mixcloud-5a3b4353.js +0 -220
  176. package/lib/esm/Preview-7ca1835e.js +0 -225
  177. package/lib/esm/SoundCloud-47bccd79.js +0 -247
  178. package/lib/esm/Streamable-ee762126.js +0 -232
  179. package/lib/esm/Twitch-3cd4b54b.js +0 -242
  180. package/lib/esm/VideoPlayer-96c2b20c.js +0 -2062
  181. package/lib/esm/Vidyard-258ab0ef.js +0 -235
  182. package/lib/esm/Vimeo-4b29b580.js +0 -283
  183. package/lib/esm/Wistia-3cbce669.js +0 -286
  184. package/lib/esm/YouTube-db52da1c.js +0 -375
  185. package/lib/esm/index-623ce3f5.js +0 -1152
@@ -1,4 +1,8 @@
1
1
  import { Poster } from "./Video.props";
2
+ import videojs from "video.js";
3
+ export interface VideoPlayerRef {
4
+ player: videojs.Player | undefined;
5
+ }
2
6
  export interface VideoPlayerControls {
3
7
  /**
4
8
  * Specify the label for the fullscreen button
@@ -17,25 +21,8 @@ export interface VideoPlayerControls {
17
21
  */
18
22
  volume: string;
19
23
  }
20
- export interface TracksConfig {
21
- /**
22
- * is this the default track?
23
- */
24
- default?: boolean;
25
- /**
26
- * What kind of track is it?
27
- */
28
- kind?: string;
29
- /**
30
- * url for the track
31
- */
32
- src?: string;
33
- /**
34
- * language of the track
35
- */
36
- srcLang?: string;
37
- }
38
24
  export interface VideoPlayerProps {
25
+ src: string;
39
26
  /**
40
27
  * Specify an optional className to be added to your Media.
41
28
  */
@@ -43,23 +30,11 @@ export interface VideoPlayerProps {
43
30
  /**
44
31
  * Specify the strings to be used as labels for the video controls
45
32
  */
46
- controls?: Required<VideoPlayerControls | false>;
47
- /**
48
- * Specify whether a video is to be shown
49
- */
50
- hasvideo?: Required<boolean>;
33
+ controls?: VideoPlayerControls;
51
34
  /**
52
35
  * poster image for video
53
36
  */
54
37
  poster?: Poster;
55
- /**
56
- * if self-hosted, specify the url of this video
57
- */
58
- src?: string | null;
59
- /**
60
- * if there are closed-caption tracks,
61
- */
62
- tracks?: Required<Array<TracksConfig>> | null;
63
38
  /**
64
39
  * if YouTube, set to true
65
40
  */
@@ -38,3 +38,4 @@ export { LocalNav } from "./LocalNav";
38
38
  export { Navigation } from "./Navigation";
39
39
  export { Card, CardGroup } from "./Card";
40
40
  export { Breadcrumb } from "./Breadcrumb";
41
+ export { Tabs } from "./Tabs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilo-org/react",
3
- "version": "0.10.6",
3
+ "version": "0.11.0",
4
4
  "description": "React components for the ILO's Design System",
5
5
  "keywords": [
6
6
  "ui_patterns",
@@ -72,13 +72,14 @@
72
72
  "classnames": "^2.3.1",
73
73
  "dom-helpers": "^5.2.1",
74
74
  "nanoid": "^3.3.6",
75
- "react-player": "2.10.1",
76
75
  "react-transition-group": "^4.4.1",
76
+ "video.js": "^7.21.2",
77
+ "videojs-youtube": "^3.0.1",
77
78
  "@ilo-org/brand-assets": "0.4.0",
78
- "@ilo-org/icons-react": "0.0.21",
79
79
  "@ilo-org/fonts": "0.1.2",
80
- "@ilo-org/styles": "0.14.0",
81
- "@ilo-org/themes": "0.7.1",
80
+ "@ilo-org/icons-react": "0.0.21",
81
+ "@ilo-org/styles": "0.14.1",
82
+ "@ilo-org/themes": "0.7.2",
82
83
  "@ilo-org/utils": "0.0.11"
83
84
  },
84
85
  "devDependencies": {
@@ -107,6 +108,7 @@
107
108
  "@types/node": "^17.0.45",
108
109
  "@types/react": "^17.0.11",
109
110
  "@types/react-dom": "^17.0.20",
111
+ "@types/video.js": "7",
110
112
  "http-server": "^14.1.0",
111
113
  "identity-obj-proxy": "^3.0.0",
112
114
  "jest-environment-jsdom": "27.5.1",
@@ -132,8 +134,8 @@
132
134
  "tslib": "^2.3.1",
133
135
  "vite": "^4.5.2",
134
136
  "@ilo-org/eslint-config": "0.1.0",
135
- "@ilo-org/typescript-config": "0.0.1",
136
- "@ilo-org/prettier-config": "0.0.2"
137
+ "@ilo-org/prettier-config": "0.0.2",
138
+ "@ilo-org/typescript-config": "0.0.1"
137
139
  },
138
140
  "peerDependencies": {
139
141
  "react": ">16",
@@ -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
  */