@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
@@ -1,7 +1,15 @@
1
- import { CardProps } from "./Card.props";
1
+ import {
2
+ TextCardProps,
3
+ StatCardProps,
4
+ MultilinkCardProps,
5
+ PromoCardProps,
6
+ FeatureCardProps,
7
+ DetailCardProps,
8
+ FactlistCardProps,
9
+ DataCardProps,
10
+ } from "./Card.props";
2
11
 
3
- const graphicTextCard: CardProps = {
4
- variant: "graphic",
12
+ const textCard: TextCardProps = {
5
13
  title: "Why we need greater social justice",
6
14
  eyebrow: "Podcast",
7
15
  date: {
@@ -10,8 +18,6 @@ const graphicTextCard: CardProps = {
10
18
  },
11
19
  theme: "light",
12
20
  link: "https:/www.ilo.org",
13
- intro:
14
- "A toxic combination of mutually-reinforcing crises – inflation, debt, food and fuel price rises, geopolitical tensions and conflict, climate change – are threatening to increase poverty, inequality and discrimination worldwide.",
15
21
  profile: {
16
22
  avatar: "/ilo-dg.jpg",
17
23
  description:
@@ -21,10 +27,8 @@ const graphicTextCard: CardProps = {
21
27
  },
22
28
  };
23
29
 
24
- const statCard: CardProps = {
25
- variant: "stat",
30
+ const statCard: StatCardProps = {
26
31
  title: "Global employment growth down by half in 2023",
27
- eyebrow: "Report",
28
32
  intro:
29
33
  "The current global economic slowdown is likely to force more workers to accept lower quality, poorly paid jobs which lack job security and social protection, so accentuating inequalities exacerbated by the COVID-19 crisis.",
30
34
  color: "turquoise",
@@ -34,8 +38,7 @@ const statCard: CardProps = {
34
38
  },
35
39
  };
36
40
 
37
- const multilinkCard: CardProps = {
38
- variant: "multilink",
41
+ const multilinkCard: MultilinkCardProps = {
39
42
  title:
40
43
  "ILO welcomes G7 call to make a just transition to a green economy happen",
41
44
  eyebrow: "High-level meeting",
@@ -43,10 +46,7 @@ const multilinkCard: CardProps = {
43
46
  "At the end of their meeting the G7 Labour Ministers highlighted the urgent need to greater focus on rights and occupational safety and health.",
44
47
  image: "/hero.jpg",
45
48
  alignment: "left",
46
- date: {
47
- human: "6 September 2023",
48
- unix: "1670389200",
49
- },
49
+ link: "https:/www.ilo.org",
50
50
  linklist: {
51
51
  headline: "",
52
52
  linkgroup: [
@@ -70,13 +70,13 @@ const multilinkCard: CardProps = {
70
70
  },
71
71
  };
72
72
 
73
- const graphicPromoCard: CardProps = {
74
- variant: "graphicpromo",
73
+ const promoCard: PromoCardProps = {
74
+ size: "standard",
75
75
  title:
76
76
  "ILO welcomes G7 call to make a just transition to a green economy happen",
77
77
  eyebrow: "High-level meeting",
78
- theme: "light",
79
- cornercut: "cornercut",
78
+ theme: "dark",
79
+ cornercut: true,
80
80
  intro:
81
81
  "At the end of their meeting the G7 Labour Ministers highlighted the urgent need to greater focus on rights and occupational safety and health.",
82
82
  link: "https:/www.ilo.org",
@@ -86,8 +86,7 @@ const graphicPromoCard: CardProps = {
86
86
  },
87
87
  };
88
88
 
89
- const featureCard: CardProps = {
90
- variant: "feature",
89
+ const featureCard: FeatureCardProps = {
91
90
  isvideo: false,
92
91
  title:
93
92
  "ILO welcomes G7 call to make a just transition to a green economy happen",
@@ -114,8 +113,7 @@ const featureCard: CardProps = {
114
113
  },
115
114
  };
116
115
 
117
- const detailCard: CardProps = {
118
- variant: "detail",
116
+ const detailCard: DetailCardProps = {
119
117
  title: "Technical meeting on digitalization in the construction sector",
120
118
  eyebrow: "Meeting",
121
119
  intro:
@@ -129,28 +127,22 @@ const detailCard: CardProps = {
129
127
  eventdetails: "8:30 - 12:00 CET | Geneva",
130
128
  };
131
129
 
132
- const factListCard: CardProps = {
133
- variant: "factlist",
130
+ const factListCard: FactlistCardProps = {
134
131
  title:
135
132
  "Economic slowdown likely to force workers to accept lower quality jobs",
136
- eyebrow: "Report",
137
133
  theme: "light",
138
- cornercut: "cornercut",
139
- intro:
140
- "A toxic combination of mutually-reinforcing crises – inflation, debt, food and fuel price rises, geopolitical tensions and conflict, climate change – are threatening to increase poverty, inequality and discrimination worldwide.",
141
- listitems: [
134
+ list: [
142
135
  "Global employment growth will be only 1.0 per cent in 2023, less than half the level in 2022.",
143
136
  "The labour market deterioration is mainly due to emerging geopolitical tensions and the Ukraine conflict.",
144
137
  "The current slowdown means that many workers will have to accept lower quality jobs, often at very low pay.",
145
138
  ],
146
139
  };
147
140
 
148
- const dataCard: CardProps = {
149
- variant: "data",
150
- title: "Technical meeting on digitalization in the construction sector",
141
+ const dataCard: DataCardProps = {
142
+ size: "wide",
151
143
  eyebrow: "Meeting",
152
- eventdetails:
153
- "The purpose of the meeting will be to discuss opportunities and challenges for the future of work in the construction industry as a vehicle to ensure a human-centred economic recovery.",
144
+ image: "/small.jpg",
145
+ columns: "two",
154
146
  dataset: {
155
147
  content: {
156
148
  items: [
@@ -181,6 +173,19 @@ const dataCard: CardProps = {
181
173
  },
182
174
  ],
183
175
  },
176
+ cta: {
177
+ headline: "Read online",
178
+ items: [
179
+ {
180
+ label: "HTML Version",
181
+ url: "https://www.ilo.org",
182
+ },
183
+ {
184
+ label: "InfoStories",
185
+ url: "https://www.ilo.org/infostories/en-GB",
186
+ },
187
+ ],
188
+ },
184
189
  links: {
185
190
  headline: "Languages",
186
191
  items: [
@@ -202,10 +207,10 @@ const dataCard: CardProps = {
202
207
  };
203
208
 
204
209
  const CardArgs = {
205
- graphicTextCard,
210
+ textCard,
206
211
  statCard,
207
212
  multilinkCard,
208
- graphicPromoCard,
213
+ promoCard,
209
214
  featureCard,
210
215
  detailCard,
211
216
  factListCard,
@@ -0,0 +1,382 @@
1
+ import {
2
+ CardAlignment,
3
+ ThemeTypes,
4
+ CardCornerType,
5
+ CardColor,
6
+ CardSize,
7
+ CardTypes,
8
+ } from "../../types";
9
+ import { LinkProps, LinkListProps } from "../LinkList/LinkList.props";
10
+ import { ProfileProps } from "../Profile/Profile.props";
11
+
12
+ export type DataCardProps = {
13
+ /**
14
+ * A line of text that appears as a small heading at the top of the card
15
+ */
16
+ eyebrow?: string;
17
+
18
+ /**
19
+ * How big should the card be
20
+ */
21
+ size?: Omit<CardSize, "standard">;
22
+
23
+ /**
24
+ * The image to show in the card
25
+ */
26
+ image?: string;
27
+
28
+ /**
29
+ * Array of Content (label, copy), Files object (optional headline, array of items with label and url) and Links * * object (optional headline, array of items with label and url)
30
+ */
31
+ dataset?: CardDataset;
32
+
33
+ /**
34
+ * Make the content appear in one or two columns. Only applies when the size is set to `wide` or `fluid`
35
+ */
36
+ columns?: string;
37
+ };
38
+
39
+ export type DetailCardProps = {
40
+ /**
41
+ * A line of text that appears as a small heading above the title of the card
42
+ */
43
+ eyebrow?: string;
44
+
45
+ /**
46
+ * The title of the card
47
+ */
48
+ title: string;
49
+
50
+ /**
51
+ * Introductory text in the card
52
+ */
53
+ intro?: string;
54
+
55
+ /**
56
+ * Specify the event Date, in both human and Unix format.
57
+ */
58
+ date?: EventDate;
59
+
60
+ /**
61
+ * Information about an event
62
+ */
63
+ eventdetails?: string;
64
+
65
+ /**
66
+ * A URL to link to
67
+ */
68
+ link?: string;
69
+
70
+ /**
71
+ * The image to show in the card
72
+ */
73
+ image?: string;
74
+
75
+ /**
76
+ * How big should the card be
77
+ */
78
+ size?: Omit<CardSize, "standard">;
79
+ };
80
+
81
+ export type FactlistCardProps = {
82
+ /**
83
+ * The title of the card
84
+ */
85
+ title: string;
86
+
87
+ /**
88
+ * Will render the card to appear on light or dark backgrounds
89
+ */
90
+ theme?: ThemeTypes;
91
+
92
+ /**
93
+ * How big should the card be
94
+ */
95
+ size?: Omit<CardSize, "standard">;
96
+ list?: string[];
97
+ };
98
+
99
+ export type FeatureCardProps = {
100
+ isvideo?: boolean;
101
+
102
+ /**
103
+ * A line of text that appears as a small heading above the title of the card
104
+ */
105
+ eyebrow?: string;
106
+
107
+ /**
108
+ * The title of the card
109
+ */
110
+ title: string;
111
+
112
+ /**
113
+ * Will render the card to appear on light or dark backgrounds
114
+ */
115
+ theme?: ThemeTypes;
116
+
117
+ /**
118
+ * How big should the card be
119
+ */
120
+ size?: Omit<CardSize, "standard">;
121
+
122
+ /**
123
+ * Specify the event Date, in both human and Unix format.
124
+ */
125
+ date?: EventDate;
126
+ link?: string;
127
+ linklist?: LinkListProps;
128
+
129
+ /**
130
+ * The image to show in the card
131
+ */
132
+ image?: string;
133
+ };
134
+
135
+ export type MultilinkCardProps = {
136
+ isvideo?: boolean;
137
+
138
+ /**
139
+ * A line of text that appears as a small heading above the title of the card
140
+ */
141
+ eyebrow?: string;
142
+
143
+ /**
144
+ * The title of the card
145
+ */
146
+ title: string;
147
+
148
+ /**
149
+ * How big should the card be
150
+ */
151
+ size?: CardSize;
152
+ alignment?: CardAlignment;
153
+ intro?: string;
154
+ link?: string;
155
+ linklist?: LinkListProps;
156
+
157
+ /**
158
+ * The image to show in the card
159
+ */
160
+ image?: string;
161
+ };
162
+
163
+ export type PromoCardProps = {
164
+ /**
165
+ * A line of text that appears as a small heading above the title of the card
166
+ */
167
+ eyebrow?: string;
168
+
169
+ /**
170
+ * The title of the card
171
+ */
172
+ title: string;
173
+
174
+ /**
175
+ * Will render the card to appear on light or dark backgrounds
176
+ */
177
+ theme?: ThemeTypes;
178
+
179
+ /**
180
+ * How big should the card be
181
+ */
182
+ size?: CardSize;
183
+
184
+ /**
185
+ * Apply an optional corner cut to the top of the card
186
+ */
187
+ cornercut?: CardCornerType;
188
+
189
+ /**
190
+ * Introductory text in the card
191
+ */
192
+ intro?: string;
193
+ link?: string;
194
+ cta?: LinkProps;
195
+ };
196
+
197
+ export type StatCardProps = {
198
+ /**
199
+ * The title of the card
200
+ */
201
+ title: string;
202
+ color?: CardColor;
203
+
204
+ /**
205
+ * How big should the card be
206
+ */
207
+ size?: Omit<CardSize, "narrow" | "wide">;
208
+
209
+ /**
210
+ * Introductory text in the card
211
+ */
212
+ intro?: string;
213
+ source?: LinkProps;
214
+ };
215
+
216
+ export type TextCardProps = {
217
+ /**
218
+ * A line of text that appears as a small heading above the title of the card
219
+ */
220
+ eyebrow?: string;
221
+
222
+ /**
223
+ * The title of the card
224
+ */
225
+ title: string;
226
+
227
+ /**
228
+ * Will render the card to appear on light or dark backgrounds
229
+ */
230
+ theme?: ThemeTypes;
231
+
232
+ /**
233
+ * How big should the card be
234
+ */
235
+ size?: Omit<CardSize, "standard">;
236
+
237
+ /**
238
+ * Specify the event Date, in both human and Unix format.
239
+ */
240
+ date?: EventDate;
241
+ profile: ProfileProps;
242
+ link?: string;
243
+ };
244
+
245
+ export interface CardProps {
246
+ /**
247
+ * Specify whether the card should display a video icon (for Feature card). Possible options: true | false
248
+ */
249
+ isvideo?: boolean;
250
+
251
+ /**
252
+ * Eyebrow field for the card.
253
+ */
254
+ eyebrow: string;
255
+
256
+ /**
257
+ * Title field for the card
258
+ */
259
+ title: string;
260
+
261
+ /**
262
+ * Color of the stat cards, options are turquoise | green| yellow| blue. Only used for stat cards.
263
+ */
264
+ color?: CardColor;
265
+
266
+ /**
267
+ * The theme type for the card. Theme doesn't apply to these card types: Multilink, Data, Stat and Detail. Possible themes: light | dark.
268
+ */
269
+ theme?: ThemeTypes;
270
+
271
+ /**
272
+ * Type - Sets the type of card to render.
273
+ Option keys: feature, text, detail, promo, multilink, data, stat, factlist
274
+ */
275
+ type: CardTypes;
276
+
277
+ /**
278
+ * Size of the cards (usually reduces padding). `Wide` on Multilink and Feature cause a two column structure above a desktop breakpoint. Possible options: Wide | Standard | Narrow.
279
+ */
280
+ size?: CardSize;
281
+
282
+ /**
283
+ * Specify whether the card has a cut corner. The only card that uses this setting are `Promo`.
284
+ */
285
+ cornercut?: CardCornerType;
286
+
287
+ /**
288
+ * Specify whether a card image is right-aligned or left-aligned for `Multilink` cards. Possible options: left | right.
289
+ */
290
+ alignment?: CardAlignment;
291
+
292
+ /**
293
+ * Intro text field for the card
294
+ */
295
+ intro?: string;
296
+
297
+ /**
298
+ * Specify the event Date, in both human and Unix format.
299
+ */
300
+ date?: EventDate;
301
+
302
+ /**
303
+ * Event details for `Detail` card
304
+ */
305
+ eventdetails?: string;
306
+
307
+ /**
308
+ * Profile to embed in the card for `Text` card
309
+ */
310
+ profile?: ProfileProps;
311
+
312
+ /**
313
+ * A list of text itmes to be embed in the card, specifically used in `Factlist` card.
314
+ */
315
+ listitems?: Array<string>;
316
+
317
+ /**
318
+ * A Link behind a clickable card. Do no use on `Multilink`, `Factlist`, `Data`, or `Stat` cards.
319
+ */
320
+ link?: string;
321
+
322
+ /**
323
+ * Props of the LinkList component. Appears at the bottom of `Multilink` or `Feature` card.
324
+ */
325
+ linklist?: LinkListProps;
326
+
327
+ /**
328
+ * Items for clickable CTA button, specifically used for `Promo` card.
329
+ */
330
+ cta?: LinkProps;
331
+
332
+ /**
333
+ * The image used in a card. Images should be avoided on `Promo`, `Text`, `Factlist`, and `Stat` card.
334
+ */
335
+ image?: string;
336
+
337
+ /**
338
+ * Source link for `Stat` cards.
339
+ */
340
+ source?: LinkProps;
341
+
342
+ /**
343
+ * Dataset object for the `Data` card. An array of Content (label, copy), Files (optional headline, array of items with label and url), and Links (optional headline, array of items with label and url).
344
+ */
345
+ dataset?: CardDataset;
346
+ }
347
+
348
+ interface EventDate {
349
+ unix?: string;
350
+ human?: string;
351
+ }
352
+
353
+ interface CardDataset {
354
+ content?: DataContent;
355
+ files?: DataFile;
356
+ links?: DataLink;
357
+ cta?: Cta;
358
+ }
359
+
360
+ interface DataContent {
361
+ items?: Array<ContentItem>;
362
+ }
363
+
364
+ interface ContentItem {
365
+ label?: string;
366
+ copy?: string;
367
+ }
368
+
369
+ interface DataFile {
370
+ headline?: string;
371
+ items?: Array<LinkProps>;
372
+ }
373
+
374
+ interface DataLink {
375
+ headline?: string;
376
+ items?: Array<LinkProps>;
377
+ }
378
+
379
+ interface Cta {
380
+ headline?: string;
381
+ items?: Array<LinkProps>;
382
+ }
@@ -0,0 +1,36 @@
1
+ import { FC } from "react";
2
+ import { CardProps } from "./Card.props";
3
+ import {
4
+ DataCard,
5
+ DetailCard,
6
+ FactlistCard,
7
+ FeatureCard,
8
+ MultilinkCard,
9
+ PromoCard,
10
+ StatCard,
11
+ TextCard,
12
+ } from ".";
13
+
14
+ type ComponentMap = {
15
+ [key: string]: FC<any>;
16
+ };
17
+
18
+ const Card: FC<CardProps> = (props: CardProps) => {
19
+ const componentMap: ComponentMap = {
20
+ data: DataCard,
21
+ detail: DetailCard,
22
+ factlist: FactlistCard,
23
+ featurecard: FeatureCard,
24
+ multilink: MultilinkCard,
25
+ promo: PromoCard,
26
+ stat: StatCard,
27
+ text: TextCard,
28
+ };
29
+
30
+ const { type } = props;
31
+
32
+ const SelectedCardComponent = componentMap[type] || FeatureCard;
33
+ return <SelectedCardComponent {...props} />;
34
+ };
35
+
36
+ export default Card;