@ilo-org/react 0.12.0 → 0.14.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 (260) hide show
  1. package/.storybook/main.ts +41 -0
  2. package/.storybook/manager-head.html +92 -0
  3. package/.storybook/manager.ts +6 -0
  4. package/.storybook/preview-head.html +5 -0
  5. package/.storybook/preview.tsx +81 -0
  6. package/.storybook/styles.scss +25 -0
  7. package/.storybook/theme.ts +46 -0
  8. package/.turbo/turbo-build:lib.log +15 -0
  9. package/CHANGELOG.md +43 -0
  10. package/lib/cjs/components/Cards/CardGroup/CardGroup.js +41 -0
  11. package/lib/cjs/components/Cards/CardGroup/index.js +796 -0
  12. package/lib/cjs/components/Cards/DataCard/DataCard.js +27 -0
  13. package/lib/cjs/components/Cards/DataCard/index.js +73 -19
  14. package/lib/cjs/components/Cards/DetailCard/DetailCard.js +20 -0
  15. package/lib/cjs/components/Cards/DetailCard/index.js +17 -12
  16. package/lib/cjs/components/Cards/FactlistCard/FactListCard.js +22 -0
  17. package/lib/cjs/components/Cards/FactlistCard/index.js +16 -15
  18. package/lib/cjs/components/Cards/FeatureCard/FeatureCard.js +24 -0
  19. package/lib/cjs/components/Cards/FeatureCard/index.js +31 -16
  20. package/lib/cjs/components/Cards/MultilinkCard/MultiLinkCard.js +24 -0
  21. package/lib/cjs/components/Cards/MultilinkCard/index.js +35 -16
  22. package/lib/cjs/components/Cards/PromoCard/PromoCard.js +23 -0
  23. package/lib/cjs/components/Cards/PromoCard/index.js +18 -15
  24. package/lib/cjs/components/Cards/StatCard/StatCard.js +21 -0
  25. package/lib/cjs/components/Cards/StatCard/index.js +15 -13
  26. package/lib/cjs/components/Cards/TextCard/TextCard.js +23 -0
  27. package/lib/cjs/components/Cards/TextCard/index.js +22 -17
  28. package/lib/cjs/components/Footer/Footer.js +1 -1
  29. package/lib/cjs/components/List/List.js +9 -11
  30. package/lib/cjs/components/List/ListItem.js +4 -7
  31. package/lib/cjs/components/List/index.js +1 -2
  32. package/lib/cjs/components/Navigation/Navigation.js +3 -3
  33. package/lib/cjs/components/Pagination/Pagination.js +1 -1
  34. package/lib/cjs/components/index.js +10 -13
  35. package/lib/cjs/index.js +10 -13
  36. package/lib/esm/components/Cards/CardGroup/CardGroup.js +39 -0
  37. package/lib/esm/components/Cards/CardGroup/index.js +793 -0
  38. package/lib/esm/components/Cards/DataCard/DataCard.js +25 -0
  39. package/lib/esm/components/Cards/DataCard/index.js +72 -19
  40. package/lib/esm/components/Cards/DetailCard/DetailCard.js +18 -0
  41. package/lib/esm/components/Cards/DetailCard/index.js +16 -12
  42. package/lib/esm/components/Cards/FactlistCard/FactListCard.js +20 -0
  43. package/lib/esm/components/Cards/FactlistCard/index.js +15 -15
  44. package/lib/esm/components/Cards/FeatureCard/FeatureCard.js +22 -0
  45. package/lib/esm/components/Cards/FeatureCard/index.js +30 -16
  46. package/lib/esm/components/Cards/MultilinkCard/MultiLinkCard.js +22 -0
  47. package/lib/esm/components/Cards/MultilinkCard/index.js +34 -16
  48. package/lib/esm/components/Cards/PromoCard/PromoCard.js +21 -0
  49. package/lib/esm/components/Cards/PromoCard/index.js +17 -15
  50. package/lib/esm/components/Cards/StatCard/StatCard.js +19 -0
  51. package/lib/esm/components/Cards/StatCard/index.js +14 -13
  52. package/lib/esm/components/Cards/TextCard/TextCard.js +21 -0
  53. package/lib/esm/components/Cards/TextCard/index.js +21 -17
  54. package/lib/esm/components/Footer/Footer.js +1 -1
  55. package/lib/esm/components/List/List.js +10 -12
  56. package/lib/esm/components/List/ListItem.js +4 -7
  57. package/lib/esm/components/List/index.js +1 -2
  58. package/lib/esm/components/Navigation/Navigation.js +3 -3
  59. package/lib/esm/components/Pagination/Pagination.js +1 -1
  60. package/lib/esm/components/index.js +9 -11
  61. package/lib/esm/index.js +9 -11
  62. package/lib/types/react/src/components/Cards/CardGroup/CardGroup.args.d.ts +13 -0
  63. package/lib/types/react/src/components/Cards/CardGroup/CardGroup.props.d.ts +58 -0
  64. package/lib/types/react/src/components/Cards/CardGroup/index.d.ts +3 -0
  65. package/lib/types/react/src/components/Cards/DataCard/DataCard.args.d.ts +2 -0
  66. package/lib/types/react/src/components/Cards/DataCard/DataCard.d.ts +4 -0
  67. package/lib/types/react/src/components/Cards/DataCard/DataCard.props.d.ts +50 -0
  68. package/lib/types/react/src/components/Cards/DataCard/index.d.ts +3 -4
  69. package/lib/types/react/src/components/Cards/DetailCard/DetailCard.args.d.ts +3 -0
  70. package/lib/types/react/src/components/Cards/DetailCard/DetailCard.d.ts +4 -0
  71. package/lib/types/react/src/components/Cards/DetailCard/DetailCard.props.d.ts +35 -0
  72. package/lib/types/react/src/components/Cards/DetailCard/index.d.ts +3 -4
  73. package/lib/types/react/src/components/Cards/FactlistCard/FactListCard.args.d.ts +3 -0
  74. package/lib/types/react/src/components/Cards/FactlistCard/FactListCard.d.ts +4 -0
  75. package/lib/types/react/src/components/Cards/FactlistCard/FactListCard.props.d.ts +16 -0
  76. package/lib/types/react/src/components/Cards/FactlistCard/index.d.ts +3 -4
  77. package/lib/types/react/src/components/Cards/FeatureCard/FeatureCard.args.d.ts +3 -0
  78. package/lib/types/react/src/components/Cards/FeatureCard/FeatureCard.d.ts +4 -0
  79. package/lib/types/react/src/components/Cards/FeatureCard/FeatureCard.props.d.ts +31 -0
  80. package/lib/types/react/src/components/Cards/FeatureCard/index.d.ts +3 -4
  81. package/lib/types/react/src/components/Cards/MultilinkCard/MultiLinkCard.d.ts +4 -0
  82. package/lib/types/react/src/components/Cards/MultilinkCard/MultilinkCard.args.d.ts +2 -0
  83. package/lib/types/react/src/components/Cards/MultilinkCard/MultilinkCard.props.d.ts +25 -0
  84. package/lib/types/react/src/components/Cards/MultilinkCard/index.d.ts +3 -4
  85. package/lib/types/react/src/components/Cards/PromoCard/PromoCard.args.d.ts +3 -0
  86. package/lib/types/react/src/components/Cards/PromoCard/PromoCard.d.ts +4 -0
  87. package/lib/types/react/src/components/Cards/PromoCard/PromoCard.props.d.ts +30 -0
  88. package/lib/types/react/src/components/Cards/PromoCard/index.d.ts +3 -4
  89. package/lib/types/react/src/components/Cards/StatCard/StatCard.args.d.ts +3 -0
  90. package/lib/types/react/src/components/Cards/StatCard/StatCard.d.ts +4 -0
  91. package/lib/types/react/src/components/Cards/StatCard/StatCard.props.d.ts +18 -0
  92. package/lib/types/react/src/components/Cards/StatCard/index.d.ts +3 -4
  93. package/lib/types/react/src/components/Cards/TextCard/TextCard.args.d.ts +3 -0
  94. package/lib/types/react/src/components/Cards/TextCard/TextCard.d.ts +4 -0
  95. package/lib/types/react/src/components/Cards/TextCard/TextCard.props.d.ts +26 -0
  96. package/lib/types/react/src/components/Cards/TextCard/index.d.ts +3 -4
  97. package/lib/types/react/src/components/List/List.props.d.ts +2 -9
  98. package/lib/types/react/src/components/List/ListItem.props.d.ts +0 -6
  99. package/lib/types/react/src/components/index.d.ts +1 -1
  100. package/lib/types/react/src/types/index.d.ts +4 -2
  101. package/package.json +32 -12
  102. package/public/react.svg +8 -0
  103. package/rollup.config.mjs +2 -0
  104. package/src/__tests__/Accordion.test.tsx +16 -0
  105. package/src/__tests__/Button.test.tsx +60 -0
  106. package/src/__tests__/Callout.test.tsx +43 -0
  107. package/src/__tests__/ContextMenu.test.tsx +19 -0
  108. package/src/__tests__/Dropdown.test.tsx +38 -0
  109. package/src/__tests__/Heading.test.tsx +51 -0
  110. package/src/__tests__/Image.test.tsx +21 -0
  111. package/src/__tests__/LinkList.test.tsx +17 -0
  112. package/src/__tests__/List.test.tsx +25 -0
  113. package/src/__tests__/Loading.test.tsx +33 -0
  114. package/src/__tests__/Notification.test.tsx +39 -0
  115. package/src/__tests__/Pagination.test.tsx +58 -0
  116. package/src/__tests__/Profile.test.tsx +48 -0
  117. package/src/__tests__/ReadMore.test.tsx +43 -0
  118. package/src/__tests__/RichText.test.tsx +16 -0
  119. package/src/__tests__/SearchField.test.tsx +35 -0
  120. package/src/__tests__/TableOfContents.test.tsx +12 -0
  121. package/src/__tests__/Tag.test.tsx +10 -0
  122. package/src/components/Cards/{CardGroup.args.ts → CardGroup/CardGroup.args.ts} +299 -437
  123. package/src/components/Cards/CardGroup/CardGroup.props.ts +78 -0
  124. package/src/components/Cards/CardGroup/CardGroup.tsx +54 -0
  125. package/src/components/Cards/CardGroup/index.tsx +3 -0
  126. package/src/components/Cards/DataCard/DataCard.args.ts +69 -0
  127. package/src/components/Cards/DataCard/DataCard.props.ts +60 -0
  128. package/src/components/Cards/DataCard/DataCard.tsx +107 -0
  129. package/src/components/Cards/DataCard/index.tsx +3 -107
  130. package/src/components/Cards/DetailCard/DetailCard.args.ts +17 -0
  131. package/src/components/Cards/DetailCard/DetailCard.props.ts +43 -0
  132. package/src/components/Cards/DetailCard/DetailCard.tsx +62 -0
  133. package/src/components/Cards/DetailCard/index.tsx +3 -62
  134. package/src/components/Cards/FactlistCard/FactListCard.args.ts +14 -0
  135. package/src/components/Cards/FactlistCard/FactListCard.props.ts +19 -0
  136. package/src/components/Cards/FactlistCard/FactListCard.tsx +42 -0
  137. package/src/components/Cards/FactlistCard/index.tsx +3 -42
  138. package/src/components/Cards/FeatureCard/FeatureCard.args.ts +30 -0
  139. package/src/components/Cards/FeatureCard/FeatureCard.props.ts +38 -0
  140. package/src/components/Cards/FeatureCard/FeatureCard.tsx +69 -0
  141. package/src/components/Cards/FeatureCard/index.tsx +3 -69
  142. package/src/components/Cards/MultilinkCard/MultiLinkCard.tsx +76 -0
  143. package/src/components/Cards/MultilinkCard/MultilinkCard.args.ts +33 -0
  144. package/src/components/Cards/MultilinkCard/MultilinkCard.props.ts +30 -0
  145. package/src/components/Cards/MultilinkCard/index.tsx +3 -76
  146. package/src/components/Cards/PromoCard/PromoCard.args.ts +19 -0
  147. package/src/components/Cards/PromoCard/PromoCard.props.ts +36 -0
  148. package/src/components/Cards/PromoCard/PromoCard.tsx +60 -0
  149. package/src/components/Cards/PromoCard/index.tsx +3 -60
  150. package/src/components/Cards/StatCard/StatCard.args.ts +14 -0
  151. package/src/components/Cards/StatCard/StatCard.props.ts +21 -0
  152. package/src/components/Cards/StatCard/StatCard.tsx +36 -0
  153. package/src/components/Cards/StatCard/index.tsx +3 -36
  154. package/src/components/Cards/TextCard/TextCard.args.ts +21 -0
  155. package/src/components/Cards/TextCard/TextCard.props.ts +32 -0
  156. package/src/components/Cards/TextCard/TextCard.tsx +62 -0
  157. package/src/components/Cards/TextCard/index.tsx +3 -63
  158. package/src/components/Footer/Footer.args.ts +4 -16
  159. package/src/components/Footer/Footer.tsx +41 -37
  160. package/src/components/List/List.props.ts +2 -10
  161. package/src/components/List/List.tsx +17 -22
  162. package/src/components/List/ListItem.props.ts +0 -7
  163. package/src/components/List/ListItem.tsx +6 -11
  164. package/src/components/Navigation/Navigation.tsx +5 -5
  165. package/src/components/Pagination/Pagination.tsx +2 -1
  166. package/src/components/index.ts +1 -1
  167. package/src/setup.ts +6 -0
  168. package/src/stories/Accordion/Accordion.stories.tsx +145 -0
  169. package/src/stories/Breadcrumb/Breadcrumb.mdx +17 -0
  170. package/src/stories/Breadcrumb/Breadcrumb.stories.tsx +20 -0
  171. package/src/stories/Button/Button.mdx +94 -0
  172. package/src/stories/Button/Button.stories.tsx +68 -0
  173. package/src/stories/Callout/Callout.mdx +35 -0
  174. package/src/stories/Callout/Callout.stories.tsx +43 -0
  175. package/src/stories/Card/DataCard.stories.tsx +45 -0
  176. package/src/stories/Card/DetailCard.stories.tsx +41 -0
  177. package/src/stories/Card/FactlistCard.stories.tsx +48 -0
  178. package/src/stories/Card/FeatureCard.stories.tsx +56 -0
  179. package/src/stories/Card/MultilinkCard.stories.tsx +48 -0
  180. package/src/stories/Card/PromoCard.stories.tsx +48 -0
  181. package/src/stories/Card/StatCard.stories.tsx +45 -0
  182. package/src/stories/Card/TextCard.stories.tsx +45 -0
  183. package/src/stories/CardGroup/CardGroup.mdx +17 -0
  184. package/src/stories/CardGroup/CardGroup.stories.tsx +50 -0
  185. package/src/stories/Checkbox/Checkbox.stories.tsx +118 -0
  186. package/src/stories/ContextMenu/ContextMenu.stories.tsx +83 -0
  187. package/src/stories/DatePicker/DatePicker.stories.tsx +110 -0
  188. package/src/stories/Dropdown/Dropdown.stories.tsx +145 -0
  189. package/src/stories/Empty/Empty.stories.tsx +53 -0
  190. package/src/stories/Fieldset/Fieldset.stories.tsx +167 -0
  191. package/src/stories/FileUpload/FileUpload.stories.tsx +103 -0
  192. package/src/stories/Footer/Footer.mdx +17 -0
  193. package/src/stories/Footer/Footer.stories.tsx +15 -0
  194. package/src/stories/Form/Form.mdx +58 -0
  195. package/src/stories/Form/Form.stories.tsx +162 -0
  196. package/src/stories/GetStarted.mdx +57 -0
  197. package/src/stories/Heading/Heading.stories.tsx +193 -0
  198. package/src/stories/Hero/Hero.stories.tsx +68 -0
  199. package/src/stories/Image/Image.stories.tsx +50 -0
  200. package/src/stories/Link/Link.stories.tsx +81 -0
  201. package/src/stories/LinkList/LinkList.args.ts +190 -0
  202. package/src/stories/LinkList/LinkList.stories.tsx +60 -0
  203. package/src/stories/List/List.stories.tsx +167 -0
  204. package/src/stories/Loading/Loading.stories.tsx +97 -0
  205. package/src/stories/LocalNav/LocalNav.mdx +17 -0
  206. package/src/stories/LocalNav/LocalNav.stories.tsx +15 -0
  207. package/src/stories/Logo/Logo.stories.tsx +172 -0
  208. package/src/stories/LogoGrid/LogoGrid.stories.tsx +59 -0
  209. package/src/stories/Navigation/Navigation.mdx +17 -0
  210. package/src/stories/Navigation/Navigation.stories.tsx +15 -0
  211. package/src/stories/Notification/Notification.stories.tsx +187 -0
  212. package/src/stories/NumberPicker/NumberPicker.stories.tsx +69 -0
  213. package/src/stories/Pagination/Pagination.stories.tsx +86 -0
  214. package/src/stories/Profile/Profile.stories.tsx +64 -0
  215. package/src/stories/Radio/Radio.stories.tsx +232 -0
  216. package/src/stories/ReadMore/ReadMore.stories.tsx +59 -0
  217. package/src/stories/RichText/RichText.stories.tsx +63 -0
  218. package/src/stories/SearchField/SearchField.stories.tsx +91 -0
  219. package/src/stories/SocialMedia/SocialMedia.stories.tsx +60 -0
  220. package/src/stories/TableOfContents/TableOfContents.stories.tsx +55 -0
  221. package/src/stories/Tabs/Tabs.mdx +17 -0
  222. package/src/stories/Tabs/Tabs.stories.tsx +25 -0
  223. package/src/stories/Tag/Tag.stories.tsx +130 -0
  224. package/src/stories/TextInput/TextInput.stories.tsx +100 -0
  225. package/src/stories/Textarea/Textarea.stories.tsx +147 -0
  226. package/src/stories/Toggle/Toggle.stories.tsx +99 -0
  227. package/src/stories/Tooltip/Tooltip.stories.tsx +82 -0
  228. package/src/stories/Video/Video.stories.tsx +71 -0
  229. package/src/stories/Welcome.stories.mdx +37 -0
  230. package/src/stories/assets/code-brackets.svg +1 -0
  231. package/src/stories/assets/colors.svg +1 -0
  232. package/src/stories/assets/comments.svg +1 -0
  233. package/src/stories/assets/direction.svg +1 -0
  234. package/src/stories/assets/flow.svg +1 -0
  235. package/src/stories/assets/plugin.svg +1 -0
  236. package/src/stories/assets/repo.svg +1 -0
  237. package/src/stories/assets/stackalt.svg +1 -0
  238. package/src/stories/welcome.scss +133 -0
  239. package/src/types/index.ts +6 -2
  240. package/lib/cjs/ListCtx-14aa546f.js +0 -9
  241. package/lib/cjs/components/Cards/Card.js +0 -40
  242. package/lib/cjs/components/Cards/CardGroup.js +0 -33
  243. package/lib/cjs/components/Cards/index.js +0 -37
  244. package/lib/esm/ListCtx-da435fdf.js +0 -6
  245. package/lib/esm/components/Cards/Card.js +0 -38
  246. package/lib/esm/components/Cards/CardGroup.js +0 -31
  247. package/lib/esm/components/Cards/index.js +0 -22
  248. package/lib/types/react/src/components/Cards/Card.d.ts +0 -4
  249. package/lib/types/react/src/components/Cards/Card.props.d.ts +0 -307
  250. package/lib/types/react/src/components/Cards/CardGroup.props.d.ts +0 -16
  251. package/lib/types/react/src/components/Cards/index.d.ts +0 -11
  252. package/lib/types/react/src/components/List/ListCtx.d.ts +0 -4
  253. package/src/components/Cards/Card.args.ts +0 -220
  254. package/src/components/Cards/Card.props.ts +0 -382
  255. package/src/components/Cards/Card.tsx +0 -36
  256. package/src/components/Cards/CardGroup.props.ts +0 -19
  257. package/src/components/Cards/CardGroup.tsx +0 -54
  258. package/src/components/Cards/index.ts +0 -22
  259. package/src/components/List/ListCtx.ts +0 -7
  260. /package/lib/types/react/src/components/Cards/{CardGroup.d.ts → CardGroup/CardGroup.d.ts} +0 -0
@@ -0,0 +1,162 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { Form, FormArgs } from "../../components/Form";
3
+
4
+ import { Fieldset } from "../../components/Fieldset";
5
+ import { TextInput } from "../../components/TextInput";
6
+ import {
7
+ Button,
8
+ Checkbox,
9
+ DatePicker,
10
+ Dropdown,
11
+ FileUpload,
12
+ NumberPicker,
13
+ Radio,
14
+ } from "../../components";
15
+ import * as DropdownArgs from "../../components/Dropdown/Dropdown.args";
16
+
17
+ const FormMeta: Meta<typeof Form> = {
18
+ title: "Components/Forms",
19
+ component: Form,
20
+ parameters: {
21
+ layout: "centered",
22
+ },
23
+ };
24
+
25
+ export default FormMeta;
26
+
27
+ const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
28
+ e.preventDefault();
29
+ const formData = new FormData(e.target as HTMLFormElement);
30
+ const data = Object.fromEntries(formData.entries());
31
+ console.log(data);
32
+ };
33
+
34
+ export const Example: StoryObj<typeof Form> = {
35
+ args: FormArgs.basic,
36
+
37
+ render: (args) => (
38
+ <Form {...args} style={{ width: "100%" }} onSubmit={handleSubmit}>
39
+ <h3>Request to attend the International Labour Conference</h3>
40
+ <Fieldset
41
+ legend="Personal information"
42
+ wrap="wrap"
43
+ direction="row"
44
+ style={{ width: "100%" }}
45
+ >
46
+ <TextInput
47
+ label="First name"
48
+ name="first-name"
49
+ placeholder="Juan"
50
+ type="text"
51
+ style={{ flex: "1 1 30%" }}
52
+ />
53
+ <TextInput
54
+ label="Last name"
55
+ name="last-name"
56
+ placeholder="Martinez"
57
+ type="text"
58
+ style={{ flex: "1 1 30%" }}
59
+ />
60
+ <DatePicker
61
+ label="Date of birth"
62
+ name="dob"
63
+ style={{ flex: "1 1 30%" }}
64
+ />
65
+ <TextInput
66
+ label="Street address"
67
+ name="street-address"
68
+ placeholder="Rue des Morillons 4"
69
+ type="text"
70
+ style={{ flex: "1 1 100%" }}
71
+ />
72
+ <TextInput
73
+ label="City"
74
+ name="city"
75
+ placeholder="Geneva"
76
+ type="text"
77
+ style={{ flex: "1 1 30%" }}
78
+ />
79
+ <Dropdown
80
+ label="Country"
81
+ name="country"
82
+ tooltip="This is not a complete list of countries."
83
+ value="Switzerland"
84
+ style={{ flex: "1 1 30%" }}
85
+ options={DropdownArgs.options}
86
+ />
87
+ <NumberPicker
88
+ label="Post code"
89
+ name="post-code"
90
+ placeholder="1201"
91
+ style={{ flex: "1 1 30%" }}
92
+ />
93
+ <TextInput
94
+ label="Email"
95
+ name="email"
96
+ placeholder="juanmartinez@ilo.org"
97
+ type="email"
98
+ style={{ flex: "1 1 49%" }}
99
+ required
100
+ helper="Required"
101
+ />
102
+ <TextInput
103
+ label="Telephone"
104
+ name="post-code"
105
+ placeholder="### ### ####"
106
+ type="tel"
107
+ style={{ flex: "1 1 49%" }}
108
+ required
109
+ helper="Required"
110
+ />
111
+ </Fieldset>
112
+ <Fieldset legend="Submit a copy of your passport">
113
+ <FileUpload
114
+ name="passport"
115
+ label="PDF or JPG files up to 10MB"
116
+ labelPlacement="end"
117
+ labelSize="small"
118
+ placeholder="Upload document"
119
+ />
120
+ </Fieldset>
121
+ <Fieldset direction="row" wrap="wrap" style={{ width: "100%" }}>
122
+ <Fieldset
123
+ legend="List the most important issues for your delegation"
124
+ direction="column"
125
+ wrap="wrap"
126
+ style={{ flex: "1 1 auto" }}
127
+ >
128
+ <Checkbox name="key-issues" label="Child labour" value="workers" />
129
+ <Checkbox
130
+ name="key-issues"
131
+ label="Full employment"
132
+ value="governments"
133
+ />
134
+ <Checkbox
135
+ name="key-issues"
136
+ label="Occupational health & safety"
137
+ value="employers"
138
+ />
139
+ <Checkbox
140
+ name="key-issues"
141
+ label="Freedom to organize"
142
+ value="other"
143
+ />
144
+ </Fieldset>
145
+ <Fieldset
146
+ legend="Who will you be representing?"
147
+ style={{ flex: "1 1 auto" }}
148
+ >
149
+ <Radio name="constituent-type" label="Workers" value="workers" />
150
+ <Radio
151
+ name="constituent-type"
152
+ label="Governments"
153
+ value="governments"
154
+ />
155
+ <Radio name="constituent-type" label="Employers" value="employers" />
156
+ <Radio name="constituent-type" label="Other" value="other" />
157
+ </Fieldset>
158
+ </Fieldset>
159
+ <Button label="Submit" kind="submit" />
160
+ </Form>
161
+ ),
162
+ };
@@ -0,0 +1,57 @@
1
+ import { Meta } from "@storybook/blocks";
2
+
3
+ <Meta title="Getting started" />
4
+
5
+ # Getting started
6
+
7
+ This website provides guidance and documentation for the ILO Design System using [React](https://reactjs.org). These docs are a work in progress so bear with us as we add and correct them.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ $ npm i @ilo-org/react
13
+ ```
14
+
15
+ If you plan on using the default styles for the library, then you should also install the `@ilo-org/styles` package.
16
+
17
+ ```bash
18
+ $ npm i @ilo-org/styles
19
+ ```
20
+
21
+ ## Peer dependencies
22
+
23
+ In order to use this component library, you will need to have `react` and `react-dom` installed as a dependency.
24
+
25
+ ```bash
26
+ $ npm i react react-dom
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ Components can be exported directly from the `@ilo-org/react` package.
32
+
33
+ ```typescript
34
+ import { Button } from "@ilo-org/react";
35
+ ```
36
+
37
+ This is fine if you think you're going to use all or most of the components in the library. However, if you're only going to use a few or you want to take advantage of code splitting, then you can import them individually.
38
+
39
+ ```typescript
40
+ import { Button } from "@ilo-org/react/Button";
41
+ ```
42
+
43
+ ## Styles
44
+
45
+ Styles for the library should be imported at the top of your project.
46
+
47
+ ```html
48
+ <link rel="stylesheet" href="node_modules/@ilo-org/styles/index.css" />
49
+ ```
50
+
51
+ ## Contributing
52
+
53
+ The ILO Design System is an open-source project. If you'd like to make a contribution, feel free to check out the [project](https://github.com/international-labour-organization/designsystem) on Github. Make sure to read the [Contribution Guidelines](https://github.com/international-labour-organization/designsystem/blob/develop/contributing.md) before making a pull request.
54
+
55
+ ## Issues and feature requests
56
+
57
+ Please feel free to open issues or make feature requests on our Github repo.
@@ -0,0 +1,193 @@
1
+ import { Meta, StoryFn } from "@storybook/react";
2
+ import {
3
+ Title,
4
+ Description,
5
+ Primary,
6
+ ArgsTable,
7
+ Stories,
8
+ Subheading,
9
+ } from "@storybook/addon-docs";
10
+ import { Heading } from "../../components/Heading";
11
+ import { HeadingProps } from "../../components/Heading/Heading.props";
12
+ import headingArgs from "../../components/Heading/Heading.args";
13
+
14
+ const headingDoc = `
15
+ By changing the \`level\` prop you can use different heading levels. The default heading level if not specified is \`h3\`.
16
+
17
+ | level | Description |
18
+ |----------|-------------|
19
+ | \`h1\` | heading level 1. |
20
+ | \`h2\` | heading level 2. |
21
+ | \`h3\` | heading level 3. |
22
+ | \`h4\` | heading level 4. |
23
+ | \`h5\` | heading level 5. |
24
+ | \`h6\` | heading level 6. |
25
+ `;
26
+
27
+ const typeDoc = `
28
+ By changing the \`type\` prop you can change the color of the heading. If not specified, the heading will inherit the color.
29
+
30
+ | type | Description |
31
+ |----------|-------------|
32
+ | \`default\` | Set the heading color to the base/default label theme. |
33
+ | \`actionable\` | set the heading color to the actionable label theme. |
34
+ | \`light\` | Set the heading color to the light label theme. |
35
+ `;
36
+
37
+ /**
38
+ * Accordion Story
39
+ *
40
+ */
41
+ const HeadingMeta: Meta<typeof Heading> = {
42
+ title: "Components/Content/Heading",
43
+ component: Heading,
44
+ tags: ["autodocs"],
45
+ argTypes: {
46
+ level: {
47
+ control: "text",
48
+ },
49
+ className: {
50
+ control: "text",
51
+ },
52
+ },
53
+ parameters: {
54
+ docs: {
55
+ page: () => (
56
+ <>
57
+ <Title />
58
+ <Primary />
59
+ <ArgsTable />
60
+ <Subheading>Heading Level Prop</Subheading>
61
+ <Description>{headingDoc}</Description>
62
+ <Subheading>Color Prop</Subheading>
63
+ <Description>{typeDoc}</Description>
64
+ <Stories title="Examples" />
65
+ <Subheading>Default Props</Subheading>
66
+ <ArgsTable />
67
+ </>
68
+ ),
69
+ },
70
+ },
71
+ };
72
+
73
+ export default HeadingMeta;
74
+
75
+ /**
76
+ * Heading 1 Template
77
+ *
78
+ * create a Storybook template for this component
79
+ *
80
+ *@param (Object) args - props to be passed to the component
81
+ */
82
+ const Heading1Template: StoryFn<HeadingProps> = () => (
83
+ <Heading {...headingArgs.heading1} />
84
+ );
85
+
86
+ /**
87
+ * Heading 2 Template
88
+ *
89
+ * create a Storybook template for this component
90
+ *
91
+ *@param (Object) args - props to be passed to the component
92
+ */
93
+ const Heading2Template: StoryFn<HeadingProps> = () => (
94
+ <Heading {...headingArgs.heading2} />
95
+ );
96
+
97
+ /**
98
+ * Heading 3 Template
99
+ *
100
+ * create a Storybook template for this component
101
+ *
102
+ *@param (Object) args - props to be passed to the component
103
+ */
104
+ const Heading3Template: StoryFn<HeadingProps> = () => (
105
+ <Heading {...headingArgs.heading3} />
106
+ );
107
+
108
+ /**
109
+ * Heading 4 Template
110
+ *
111
+ * create a Storybook template for this component
112
+ *
113
+ *@param (Object) args - props to be passed to the component
114
+ */
115
+ const Heading4Template: StoryFn<HeadingProps> = () => (
116
+ <Heading {...headingArgs.heading4} />
117
+ );
118
+
119
+ /**
120
+ * Heading 5 Template
121
+ *
122
+ * create a Storybook template for this component
123
+ *
124
+ *@param (Object) args - props to be passed to the component
125
+ */
126
+ const Heading5Template: StoryFn<HeadingProps> = () => (
127
+ <Heading {...headingArgs.heading5} />
128
+ );
129
+
130
+ /**
131
+ * Heading 6 Template
132
+ *
133
+ * create a Storybook template for this component
134
+ *
135
+ *@param (Object) args - props to be passed to the component
136
+ */
137
+ const Heading6Template: StoryFn<HeadingProps> = () => (
138
+ <Heading {...headingArgs.heading6} />
139
+ );
140
+
141
+ /**
142
+ * Heading 1 Instance
143
+ *
144
+ */
145
+ export const Heading1: StoryFn<HeadingProps> = Heading1Template.bind({});
146
+
147
+ /**
148
+ * Heading 2 Instance
149
+ *
150
+ */
151
+ export const Heading2: StoryFn<HeadingProps> = Heading2Template.bind({});
152
+
153
+ /**
154
+ * Heading 3 Instance
155
+ *
156
+ */
157
+ export const Heading3: StoryFn<HeadingProps> = Heading3Template.bind({});
158
+
159
+ /**
160
+ * Heading 4 Instance
161
+ *
162
+ */
163
+ export const Heading4: StoryFn<HeadingProps> = Heading4Template.bind({});
164
+
165
+ /**
166
+ * Heading 5 Instance
167
+ *
168
+ */
169
+ export const Heading5: StoryFn<HeadingProps> = Heading5Template.bind({});
170
+
171
+ /**
172
+ * Heading 6 Instance
173
+ *
174
+ */
175
+ export const Heading6: StoryFn<HeadingProps> = Heading6Template.bind({});
176
+
177
+ // enumerate the props for the heading 1.
178
+ Heading1.storyName = "Heading 1";
179
+
180
+ // enumerate the props
181
+ Heading2.storyName = "Heading 2";
182
+
183
+ // enumerate the props
184
+ Heading3.storyName = "Heading 3";
185
+
186
+ // enumerate the props
187
+ Heading4.storyName = "Heading 4";
188
+
189
+ // enumerate the props
190
+ Heading5.storyName = "Heading 5";
191
+
192
+ // enumerate the props
193
+ Heading6.storyName = "Heading 6";
@@ -0,0 +1,68 @@
1
+ import { StoryObj, Meta } from "@storybook/react";
2
+ import {
3
+ Title,
4
+ Description,
5
+ Primary,
6
+ ArgsTable,
7
+ Stories,
8
+ Subheading,
9
+ } from "@storybook/blocks";
10
+ import { Hero } from "../../components/Hero";
11
+ import * as heroArgs from "../../components/Hero/Hero.args";
12
+
13
+ const HeroMeta: Meta<typeof Hero> = {
14
+ title: "Components/Content/Hero",
15
+ component: Hero,
16
+ tags: ["autodocs"],
17
+ parameters: {
18
+ docs: {
19
+ page: () => (
20
+ <>
21
+ <Title />
22
+ <Description>
23
+ The Hero is an attention-grabbing section of a web page designed to
24
+ engage users and create a memorable first impression.
25
+ </Description>
26
+ <Primary />
27
+ <Stories title="Examples" />
28
+ <Subheading>Default Props</Subheading>
29
+ <ArgsTable />
30
+ </>
31
+ ),
32
+ },
33
+ },
34
+ };
35
+
36
+ export default HeroMeta;
37
+
38
+ export const Default: StoryObj<typeof Hero> = {
39
+ args: heroArgs.darkPortal,
40
+ };
41
+
42
+ export const Light: StoryObj<typeof Hero> = {
43
+ args: heroArgs.lightPortal,
44
+ };
45
+
46
+ export const SemiTransparent: StoryObj<typeof Hero> = {
47
+ args: heroArgs.semiTransparent,
48
+ };
49
+
50
+ export const Transparent: StoryObj<typeof Hero> = {
51
+ args: heroArgs.transparent,
52
+ };
53
+
54
+ export const Offset: StoryObj<typeof Hero> = {
55
+ args: heroArgs.offset,
56
+ };
57
+
58
+ export const Center: StoryObj<typeof Hero> = {
59
+ args: heroArgs.center,
60
+ };
61
+
62
+ export const CenterBottom: StoryObj<typeof Hero> = {
63
+ args: heroArgs.centerBottom,
64
+ };
65
+
66
+ export const NoPoster: StoryObj<typeof Hero> = {
67
+ args: heroArgs.noPoster,
68
+ };
@@ -0,0 +1,50 @@
1
+ import { StoryFn, Meta } from "@storybook/react";
2
+ import {
3
+ Title,
4
+ Description,
5
+ Primary,
6
+ ArgsTable,
7
+ Stories,
8
+ Subheading,
9
+ } from "@storybook/addon-docs";
10
+ import { Image } from "../../components/Image";
11
+ import { ImageProps } from "../../components/Image/Image.props";
12
+ import imageArgs from "../../components/Image/Image.args";
13
+
14
+ const urlDoc = `
15
+ The \`url\` prop expects an array of object each containing a \`breakpoint\` and a \`src\` prop. There must be a minimuim of one of these, but preferably multiple items corresponding to the same image at different raw sizes, so that responsive images can be displayed.`;
16
+
17
+ const ImageMeta: Meta<typeof Image> = {
18
+ title: "Components/Media/Image",
19
+ component: Image,
20
+ argTypes: {},
21
+ tags: ["autodocs"],
22
+ parameters: {
23
+ docs: {
24
+ page: () => (
25
+ <>
26
+ <Title />
27
+ <Description>
28
+ The Image component displays an image, along with an image credit
29
+ and optional caption.
30
+ </Description>
31
+ <Primary />
32
+ <Subheading>Responsive images</Subheading>
33
+ <Description>{urlDoc}</Description>
34
+ <Stories title="Examples"></Stories>
35
+ <Subheading>Default props</Subheading>
36
+ <ArgsTable />
37
+ </>
38
+ ),
39
+ },
40
+ },
41
+ };
42
+
43
+ export default ImageMeta;
44
+
45
+ const ImageTemplate: StoryFn<ImageProps> = (args) => <Image {...args} />;
46
+
47
+ export const ImageMedia: StoryFn<ImageProps> = ImageTemplate.bind({});
48
+
49
+ ImageMedia.args = imageArgs;
50
+ ImageMedia.storyName = "Image";
@@ -0,0 +1,81 @@
1
+ import { StoryFn, Meta } from "@storybook/react";
2
+ import {
3
+ Title,
4
+ Subtitle,
5
+ Description,
6
+ Primary,
7
+ ArgsTable,
8
+ Stories,
9
+ Subheading,
10
+ } from "@storybook/addon-docs";
11
+ import { Link } from "../../components/Link";
12
+ import { LinkProps } from "../../components/Link/Link.props";
13
+
14
+ const themeDoc = `
15
+ By changing the \`theme\` prop you can change base coloring of the links. By default this is set to \`light\`.
16
+
17
+ | Theme | Description |
18
+ |----------|-------------|
19
+ | \`light\` | Link theme for a light background color. |
20
+ | \`dark\` | Link theme for a dark background color. |
21
+ | \`footer\` | Link theme for a dark background color. |
22
+ `;
23
+
24
+ const LinkMeta: Meta<typeof Link> = {
25
+ title: "Components/Navigation/Link",
26
+ component: Link,
27
+ tags: ["autodocs"],
28
+ argTypes: {
29
+ theme: {
30
+ options: ["light", "dark", "footer"],
31
+ control: { type: "select" },
32
+ },
33
+ },
34
+ parameters: {
35
+ componentSubtitle: "Component",
36
+ docs: {
37
+ page: () => (
38
+ <>
39
+ <Subtitle />
40
+ <Title />
41
+ <Description>
42
+ The link component creates an anchor link with a specific theme.
43
+ </Description>
44
+ <Primary />
45
+ <Subheading>Theme</Subheading>
46
+ <Description>{themeDoc}</Description>
47
+ <Stories title="Examples"></Stories>
48
+ <Subheading>Default Props</Subheading>
49
+ <ArgsTable />
50
+ </>
51
+ ),
52
+ },
53
+ },
54
+ };
55
+
56
+ export default LinkMeta;
57
+
58
+ const LinkTemplate: StoryFn<LinkProps> = (args) => (
59
+ <Link {...args}>This is text for the link</Link>
60
+ );
61
+
62
+ export const BaseLink: StoryFn<LinkProps> = LinkTemplate.bind({});
63
+
64
+ export const DarkLink: StoryFn<LinkProps> = LinkTemplate.bind({});
65
+
66
+ export const FooterLink: StoryFn<LinkProps> = LinkTemplate.bind({});
67
+
68
+ BaseLink.args = { theme: "light" };
69
+ BaseLink.args.url = "https://www.ilo.org";
70
+ BaseLink.storyName = "Light";
71
+
72
+ DarkLink.args = { theme: "dark" };
73
+ DarkLink.parameters = {
74
+ backgrounds: { default: "dark" },
75
+ };
76
+ DarkLink.args.url = "https://www.ilo.org";
77
+ DarkLink.storyName = "Dark";
78
+
79
+ FooterLink.args = { theme: "footer" };
80
+ FooterLink.args.url = "https://www.ilo.org";
81
+ FooterLink.storyName = "Footer";