@ilo-org/react 0.13.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 (151) 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 +26 -0
  10. package/lib/cjs/components/Cards/CardGroup/CardGroup.js +0 -1
  11. package/lib/cjs/components/Cards/CardGroup/index.js +197 -160
  12. package/lib/cjs/components/Cards/FactlistCard/FactListCard.js +0 -1
  13. package/lib/cjs/components/Cards/FactlistCard/index.js +0 -1
  14. package/lib/cjs/components/Cards/TextCard/TextCard.js +1 -1
  15. package/lib/cjs/components/List/List.js +9 -11
  16. package/lib/cjs/components/List/ListItem.js +4 -7
  17. package/lib/cjs/components/List/index.js +1 -2
  18. package/lib/cjs/components/index.js +0 -1
  19. package/lib/cjs/index.js +0 -1
  20. package/lib/esm/components/Cards/CardGroup/CardGroup.js +0 -1
  21. package/lib/esm/components/Cards/CardGroup/index.js +197 -160
  22. package/lib/esm/components/Cards/FactlistCard/FactListCard.js +0 -1
  23. package/lib/esm/components/Cards/FactlistCard/index.js +0 -1
  24. package/lib/esm/components/Cards/TextCard/TextCard.js +1 -1
  25. package/lib/esm/components/List/List.js +10 -12
  26. package/lib/esm/components/List/ListItem.js +4 -7
  27. package/lib/esm/components/List/index.js +1 -2
  28. package/lib/esm/components/index.js +0 -1
  29. package/lib/esm/index.js +0 -1
  30. package/lib/types/react/src/components/List/List.props.d.ts +2 -9
  31. package/lib/types/react/src/components/List/ListItem.props.d.ts +0 -6
  32. package/lib/types/react/src/types/index.d.ts +0 -2
  33. package/package.json +32 -12
  34. package/public/fao-logo.svg +195 -0
  35. package/public/favicon.ico +0 -0
  36. package/public/hero.jpg +0 -0
  37. package/public/ilo-dg.jpg +0 -0
  38. package/public/ilo-headquarters.jpg +0 -0
  39. package/public/large.jpg +0 -0
  40. package/public/media-file-poster.jpg +0 -0
  41. package/public/medium.jpg +0 -0
  42. package/public/react.svg +8 -0
  43. package/public/small.jpg +0 -0
  44. package/public/unhcr-logo.svg +1 -0
  45. package/public/unicef-logo.png +0 -0
  46. package/public/video-example.mp4 +0 -0
  47. package/public/wfp-logo.svg +1 -0
  48. package/public/who-logo.svg +1 -0
  49. package/public/youtube-video-poster.avif +0 -0
  50. package/rollup.config.mjs +2 -0
  51. package/src/__tests__/Accordion.test.tsx +16 -0
  52. package/src/__tests__/Button.test.tsx +60 -0
  53. package/src/__tests__/Callout.test.tsx +43 -0
  54. package/src/__tests__/ContextMenu.test.tsx +19 -0
  55. package/src/__tests__/Dropdown.test.tsx +38 -0
  56. package/src/__tests__/Heading.test.tsx +51 -0
  57. package/src/__tests__/Image.test.tsx +21 -0
  58. package/src/__tests__/LinkList.test.tsx +17 -0
  59. package/src/__tests__/List.test.tsx +25 -0
  60. package/src/__tests__/Loading.test.tsx +33 -0
  61. package/src/__tests__/Notification.test.tsx +39 -0
  62. package/src/__tests__/Pagination.test.tsx +58 -0
  63. package/src/__tests__/Profile.test.tsx +48 -0
  64. package/src/__tests__/ReadMore.test.tsx +43 -0
  65. package/src/__tests__/RichText.test.tsx +16 -0
  66. package/src/__tests__/SearchField.test.tsx +35 -0
  67. package/src/__tests__/TableOfContents.test.tsx +12 -0
  68. package/src/__tests__/Tag.test.tsx +10 -0
  69. package/src/components/Cards/CardGroup/CardGroup.args.ts +205 -166
  70. package/src/components/Cards/TextCard/TextCard.tsx +1 -1
  71. package/src/components/List/List.props.ts +2 -10
  72. package/src/components/List/List.tsx +17 -22
  73. package/src/components/List/ListItem.props.ts +0 -7
  74. package/src/components/List/ListItem.tsx +6 -11
  75. package/src/setup.ts +6 -0
  76. package/src/stories/Accordion/Accordion.stories.tsx +145 -0
  77. package/src/stories/Breadcrumb/Breadcrumb.mdx +17 -0
  78. package/src/stories/Breadcrumb/Breadcrumb.stories.tsx +20 -0
  79. package/src/stories/Button/Button.mdx +94 -0
  80. package/src/stories/Button/Button.stories.tsx +68 -0
  81. package/src/stories/Callout/Callout.mdx +35 -0
  82. package/src/stories/Callout/Callout.stories.tsx +43 -0
  83. package/src/stories/Card/DataCard.stories.tsx +45 -0
  84. package/src/stories/Card/DetailCard.stories.tsx +41 -0
  85. package/src/stories/Card/FactlistCard.stories.tsx +48 -0
  86. package/src/stories/Card/FeatureCard.stories.tsx +56 -0
  87. package/src/stories/Card/MultilinkCard.stories.tsx +48 -0
  88. package/src/stories/Card/PromoCard.stories.tsx +48 -0
  89. package/src/stories/Card/StatCard.stories.tsx +45 -0
  90. package/src/stories/Card/TextCard.stories.tsx +45 -0
  91. package/src/stories/CardGroup/CardGroup.mdx +17 -0
  92. package/src/stories/CardGroup/CardGroup.stories.tsx +50 -0
  93. package/src/stories/Checkbox/Checkbox.stories.tsx +118 -0
  94. package/src/stories/ContextMenu/ContextMenu.stories.tsx +83 -0
  95. package/src/stories/DatePicker/DatePicker.stories.tsx +110 -0
  96. package/src/stories/Dropdown/Dropdown.stories.tsx +145 -0
  97. package/src/stories/Empty/Empty.stories.tsx +53 -0
  98. package/src/stories/Fieldset/Fieldset.stories.tsx +167 -0
  99. package/src/stories/FileUpload/FileUpload.stories.tsx +103 -0
  100. package/src/stories/Footer/Footer.mdx +17 -0
  101. package/src/stories/Footer/Footer.stories.tsx +15 -0
  102. package/src/stories/Form/Form.mdx +58 -0
  103. package/src/stories/Form/Form.stories.tsx +162 -0
  104. package/src/stories/GetStarted.mdx +57 -0
  105. package/src/stories/Heading/Heading.stories.tsx +193 -0
  106. package/src/stories/Hero/Hero.stories.tsx +68 -0
  107. package/src/stories/Image/Image.stories.tsx +50 -0
  108. package/src/stories/Link/Link.stories.tsx +81 -0
  109. package/src/stories/LinkList/LinkList.args.ts +190 -0
  110. package/src/stories/LinkList/LinkList.stories.tsx +60 -0
  111. package/src/stories/List/List.stories.tsx +167 -0
  112. package/src/stories/Loading/Loading.stories.tsx +97 -0
  113. package/src/stories/LocalNav/LocalNav.mdx +17 -0
  114. package/src/stories/LocalNav/LocalNav.stories.tsx +15 -0
  115. package/src/stories/Logo/Logo.stories.tsx +172 -0
  116. package/src/stories/LogoGrid/LogoGrid.stories.tsx +59 -0
  117. package/src/stories/Navigation/Navigation.mdx +17 -0
  118. package/src/stories/Navigation/Navigation.stories.tsx +15 -0
  119. package/src/stories/Notification/Notification.stories.tsx +187 -0
  120. package/src/stories/NumberPicker/NumberPicker.stories.tsx +69 -0
  121. package/src/stories/Pagination/Pagination.stories.tsx +86 -0
  122. package/src/stories/Profile/Profile.stories.tsx +64 -0
  123. package/src/stories/Radio/Radio.stories.tsx +232 -0
  124. package/src/stories/ReadMore/ReadMore.stories.tsx +59 -0
  125. package/src/stories/RichText/RichText.stories.tsx +63 -0
  126. package/src/stories/SearchField/SearchField.stories.tsx +91 -0
  127. package/src/stories/SocialMedia/SocialMedia.stories.tsx +60 -0
  128. package/src/stories/TableOfContents/TableOfContents.stories.tsx +55 -0
  129. package/src/stories/Tabs/Tabs.mdx +17 -0
  130. package/src/stories/Tabs/Tabs.stories.tsx +25 -0
  131. package/src/stories/Tag/Tag.stories.tsx +130 -0
  132. package/src/stories/TextInput/TextInput.stories.tsx +100 -0
  133. package/src/stories/Textarea/Textarea.stories.tsx +147 -0
  134. package/src/stories/Toggle/Toggle.stories.tsx +99 -0
  135. package/src/stories/Tooltip/Tooltip.stories.tsx +82 -0
  136. package/src/stories/Video/Video.stories.tsx +71 -0
  137. package/src/stories/Welcome.stories.mdx +37 -0
  138. package/src/stories/assets/code-brackets.svg +1 -0
  139. package/src/stories/assets/colors.svg +1 -0
  140. package/src/stories/assets/comments.svg +1 -0
  141. package/src/stories/assets/direction.svg +1 -0
  142. package/src/stories/assets/flow.svg +1 -0
  143. package/src/stories/assets/plugin.svg +1 -0
  144. package/src/stories/assets/repo.svg +1 -0
  145. package/src/stories/assets/stackalt.svg +1 -0
  146. package/src/stories/welcome.scss +133 -0
  147. package/src/types/index.ts +0 -2
  148. package/lib/cjs/ListCtx-14aa546f.js +0 -9
  149. package/lib/esm/ListCtx-da435fdf.js +0 -6
  150. package/lib/types/react/src/components/List/ListCtx.d.ts +0 -4
  151. package/src/components/List/ListCtx.ts +0 -7
@@ -0,0 +1,145 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import {
3
+ Title,
4
+ Subtitle,
5
+ Description,
6
+ Primary,
7
+ Stories,
8
+ Subheading,
9
+ ArgTypes,
10
+ } from "@storybook/addon-docs";
11
+ import { Dropdown } from "../../components/Dropdown";
12
+ import dropdownArgs from "../../components/Dropdown/Dropdown.args";
13
+ import { labelledFormFieldArgTypes } from "../../types/forms.args";
14
+
15
+ const DropdownMeta: Meta<typeof Dropdown> = {
16
+ title: "Components/Forms/Dropdown",
17
+ component: Dropdown,
18
+ tags: ["autodocs"],
19
+ argTypes: {
20
+ autocomplete: {
21
+ description:
22
+ "A string providing a hint for a user agent's autocomplete feature.",
23
+ control: {
24
+ type: "string",
25
+ },
26
+ table: {
27
+ type: {
28
+ summary: "string",
29
+ },
30
+ },
31
+ },
32
+ form: {
33
+ description:
34
+ "The id of the form that the dropdown belongs to if it isn't nested in a form element",
35
+ control: {
36
+ type: "string",
37
+ },
38
+ table: {
39
+ type: {
40
+ summary: "string",
41
+ },
42
+ },
43
+ },
44
+ multiple: {
45
+ description: "Whether the dropdown allows multiple selections",
46
+ control: {
47
+ type: "boolean",
48
+ },
49
+ table: {
50
+ type: {
51
+ summary: "boolean",
52
+ },
53
+ },
54
+ },
55
+ options: {
56
+ description: "The options to display in the dropdown",
57
+ control: {
58
+ type: "object",
59
+ },
60
+ table: {
61
+ type: {
62
+ summary: "object",
63
+ },
64
+ },
65
+ },
66
+ selectSize: {
67
+ description:
68
+ "Number of rows in the list that should be visible at one time. Corresponds to the select element's size attribute.",
69
+ control: {
70
+ type: "number",
71
+ },
72
+ table: {
73
+ type: {
74
+ summary: "number",
75
+ },
76
+ },
77
+ },
78
+ value: {
79
+ description: "The value of the dropdown",
80
+ control: {
81
+ type: "string",
82
+ },
83
+ table: {
84
+ type: {
85
+ summary: "string",
86
+ },
87
+ },
88
+ },
89
+ ...labelledFormFieldArgTypes("HTMLSelectElement"),
90
+ },
91
+ parameters: {
92
+ docs: {
93
+ page: () => (
94
+ <>
95
+ <Subtitle />
96
+ <Title />
97
+ <Description>
98
+ The Dropdown displays a select element with options, and is most
99
+ commonly used in forms.
100
+ </Description>
101
+ <Primary />
102
+ <Subheading>Props</Subheading>
103
+ <ArgTypes of={DropdownMeta} />
104
+ <Stories title="Examples" />
105
+ </>
106
+ ),
107
+ },
108
+ },
109
+ };
110
+
111
+ export default DropdownMeta;
112
+
113
+ export const Basic: StoryObj<typeof Dropdown> = {
114
+ args: { ...dropdownArgs.basic, style: { width: "100%" } },
115
+ };
116
+
117
+ export const WithLabel: StoryObj<typeof Dropdown> = {
118
+ args: {
119
+ ...dropdownArgs.basic,
120
+ },
121
+ };
122
+
123
+ export const WithHelperText: StoryObj<typeof Dropdown> = {
124
+ args: {
125
+ ...dropdownArgs.basic,
126
+ },
127
+ };
128
+
129
+ export const Error: StoryObj<typeof Dropdown> = {
130
+ args: {
131
+ ...dropdownArgs.haserror,
132
+ },
133
+ };
134
+
135
+ export const Disabled: StoryObj<typeof Dropdown> = {
136
+ args: {
137
+ ...dropdownArgs.isdisabled,
138
+ },
139
+ };
140
+
141
+ export const WithToolTip: StoryObj<typeof Dropdown> = {
142
+ args: {
143
+ ...dropdownArgs.hastooltip,
144
+ },
145
+ };
@@ -0,0 +1,53 @@
1
+ import { Meta, StoryFn } from "@storybook/react";
2
+ import {
3
+ Title,
4
+ Description,
5
+ Primary,
6
+ Stories,
7
+ ArgsTable,
8
+ Subheading,
9
+ } from "@storybook/addon-docs";
10
+ import { Empty } from "../../components/Empty";
11
+ import { EmptyProps } from "../../components/Empty/Empty.props";
12
+
13
+ const EmptyMeta: Meta<typeof Empty> = {
14
+ title: "Components/Transitions/Empty",
15
+ component: Empty,
16
+ tags: ["autodocs"],
17
+ parameters: {
18
+ docs: {
19
+ page: () => (
20
+ <>
21
+ <Title />
22
+ <Description>
23
+ The Empty component receives no props. It it displayed on page load
24
+ as a placeholder component while data loads.
25
+ </Description>
26
+ <Primary />
27
+ <Stories title="Examples" />
28
+ <Subheading>Default Props</Subheading>
29
+ <ArgsTable />
30
+ </>
31
+ ),
32
+ },
33
+ },
34
+ decorators: [
35
+ (Story) => (
36
+ <div
37
+ style={{
38
+ display: "flex",
39
+ justifyContent: "center",
40
+ alignItems: "center",
41
+ }}
42
+ >
43
+ <Story />
44
+ </div>
45
+ ),
46
+ ],
47
+ };
48
+
49
+ export default EmptyMeta;
50
+
51
+ export const Default: StoryFn<EmptyProps> = () => (
52
+ <Empty style={{ width: "100%", maxWidth: "600px", height: "400px" }} />
53
+ );
@@ -0,0 +1,167 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { Dropdown, Fieldset } from "../../components";
3
+
4
+ import {
5
+ ArgTypes,
6
+ Description,
7
+ Heading,
8
+ Primary,
9
+ Stories,
10
+ Title,
11
+ } from "@storybook/blocks";
12
+ import { TextInput } from "../../components/TextInput";
13
+
14
+ const FieldsetMeta: Meta<typeof Fieldset> = {
15
+ title: "Components/Forms/Fieldset",
16
+ component: Fieldset,
17
+ tags: ["autodocs"],
18
+ argTypes: {
19
+ helper: {
20
+ description: "Optional helper text to display below the fieldset",
21
+ table: {
22
+ type: {
23
+ summary: "string",
24
+ },
25
+ },
26
+ },
27
+ tooltip: {
28
+ description: "Optional text to display in a tooltip",
29
+ table: {
30
+ type: {
31
+ summary: "string",
32
+ },
33
+ },
34
+ },
35
+ errorMessage: {
36
+ description:
37
+ "Message to display in case of an error. This is only shown the Fieldset contains Radio or Checkbox components.",
38
+ table: {
39
+ type: {
40
+ summary: "string",
41
+ },
42
+ },
43
+ },
44
+ disabled: {
45
+ description: "Whether the fieldset is disabled",
46
+ table: {
47
+ type: {
48
+ summary: "boolean",
49
+ },
50
+ },
51
+ },
52
+ wrap: {
53
+ description: "Whether the fieldset should wrap its children",
54
+ control: "select",
55
+ options: ["nowrap", "wrap"],
56
+ table: {
57
+ defaultValue: { summary: "nowrap" },
58
+ type: {
59
+ summary: "nowrap | wrap",
60
+ },
61
+ },
62
+ },
63
+ direction: {
64
+ description: "The direction of the fieldset",
65
+ control: "select",
66
+ options: ["column", "row", "column-reverse", "row-reverse"],
67
+ table: {
68
+ defaultValue: { summary: "column" },
69
+ type: {
70
+ summary: "column | row | column-reverse | row-reverse",
71
+ },
72
+ },
73
+ },
74
+ },
75
+ parameters: {
76
+ docs: {
77
+ page: () => (
78
+ <>
79
+ <Title />
80
+ <Description>
81
+ The Fieldset component is used to group related form elements. It
82
+ can also be used to show an error state for a group of Radio or
83
+ Checkbox components.
84
+ </Description>
85
+ <Primary />
86
+ <Heading>Props</Heading>
87
+ <ArgTypes of={FieldsetMeta} />
88
+ <Stories />
89
+ </>
90
+ ),
91
+ },
92
+ },
93
+ };
94
+
95
+ export default FieldsetMeta;
96
+
97
+ export const Example: StoryObj<typeof Fieldset> = {
98
+ args: {
99
+ legend: "Enter your contact details",
100
+ helper: "Email and telephone are required",
101
+ },
102
+ render: (args) => (
103
+ <Fieldset {...args} wrap="wrap" direction="row">
104
+ <TextInput
105
+ label="Email"
106
+ helper="Required"
107
+ placeholder="info@ilo.org"
108
+ name="email"
109
+ style={{ flex: "1 1 49%" }}
110
+ type="email"
111
+ required
112
+ />
113
+ <TextInput
114
+ label="Telephone"
115
+ helper="Required"
116
+ placeholder="### ### ####"
117
+ name="telephone"
118
+ style={{ flex: "1 1 49%" }}
119
+ type="tel"
120
+ required
121
+ />
122
+ <TextInput
123
+ label="Street"
124
+ placeholder="Route de Morillons"
125
+ name="street"
126
+ style={{ flex: "1 1 49%" }}
127
+ type="text"
128
+ />
129
+ <TextInput
130
+ label="City"
131
+ name="city"
132
+ placeholder="Geneva"
133
+ style={{ flex: "1 1 49%" }}
134
+ type="text"
135
+ />
136
+ <Dropdown
137
+ label="Country"
138
+ name="country"
139
+ style={{ flex: "1 1 75%" }}
140
+ tooltip="This is not a complete list of all the countries in the world."
141
+ options={[
142
+ { label: "Switzerland", value: "CH" },
143
+ { label: "Côte d'Ivoire ", value: "CI" },
144
+ { label: "Thailand", value: "TH" },
145
+ { label: "United States", value: "US" },
146
+ { label: "Zimbabwe", value: "ZW" },
147
+ { label: "Afghanistan", value: "AF" },
148
+ { label: "Åland Islands", value: "AX" },
149
+ { label: "Albania", value: "AL" },
150
+ { label: "Algeria", value: "DZ" },
151
+ { label: "American Samoa", value: "AS" },
152
+ { label: "AndorrA", value: "AD" },
153
+ { label: "Angola", value: "AO" },
154
+ { label: "Anguilla", value: "AI" },
155
+ { label: "Antarctica", value: "AQ" },
156
+ { label: "Antigua and Barbuda", value: "AG" },
157
+ { label: "Argentina", value: "AR" },
158
+ { label: "Armenia", value: "AM" },
159
+ { label: "Aruba", value: "AW" },
160
+ { label: "Australia", value: "AU" },
161
+ { label: "Austria", value: "AT" },
162
+ { label: "Azerbaijan", value: "AZ" },
163
+ ]}
164
+ />
165
+ </Fieldset>
166
+ ),
167
+ };
@@ -0,0 +1,103 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import {
3
+ Title,
4
+ Subtitle,
5
+ Description,
6
+ Primary,
7
+ Stories,
8
+ Subheading,
9
+ ArgTypes,
10
+ } from "@storybook/addon-docs";
11
+ import { FileUpload } from "../../components";
12
+ import fileUploadArgs from "../../components/FileUpload/FileUpload.args";
13
+ import { labelledFormFieldArgTypes } from "../../types/forms.args";
14
+
15
+ const FileUploadMeta: Meta<typeof FileUpload> = {
16
+ title: "Components/Forms/FileUpload",
17
+ component: FileUpload,
18
+ tags: ["autodocs"],
19
+ argTypes: {
20
+ multiple: {
21
+ description: "Whether or not multiple files can be uploaded",
22
+ control: {
23
+ type: "boolean",
24
+ },
25
+ table: {
26
+ type: {
27
+ summary: "boolean",
28
+ },
29
+ },
30
+ },
31
+ placeholder: {
32
+ description: "The placeholder text for the file upload",
33
+ control: {
34
+ type: "text",
35
+ },
36
+ table: {
37
+ type: {
38
+ summary: "string",
39
+ },
40
+ },
41
+ },
42
+ ...labelledFormFieldArgTypes("HTMLInputElement"),
43
+ },
44
+ parameters: {
45
+ docs: {
46
+ page: () => (
47
+ <>
48
+ <Subtitle />
49
+ <Title />
50
+ <Description>
51
+ The FileUpload component allows users to select and upload files
52
+ from their device to a web application. It displays a list of the
53
+ files to upload once they've been selected.
54
+ </Description>
55
+ <Primary />
56
+ <Subheading>Props</Subheading>
57
+ <ArgTypes of={FileUploadMeta} />
58
+ <Stories title="Examples" />
59
+ </>
60
+ ),
61
+ },
62
+ },
63
+ };
64
+
65
+ export default FileUploadMeta;
66
+
67
+ export const Basic: StoryObj<typeof FileUpload> = {
68
+ args: {
69
+ ...fileUploadArgs.basic,
70
+ label: "Upload your files here",
71
+ labelPlacement: "top",
72
+ labelSize: "medium",
73
+ },
74
+ };
75
+
76
+ export const Helper: StoryObj<typeof FileUpload> = {
77
+ args: {
78
+ ...fileUploadArgs.basic,
79
+ label: "Upload your files here",
80
+ labelPlacement: "top",
81
+ labelSize: "medium",
82
+ helper: "You can upload up to 5 files",
83
+ },
84
+ };
85
+
86
+ export const Error: StoryObj<typeof FileUpload> = {
87
+ args: {
88
+ ...fileUploadArgs.haserror,
89
+ label: "Upload your files here",
90
+ labelPlacement: "top",
91
+ labelSize: "medium",
92
+ errorMessage: "There was an error uploading your files",
93
+ },
94
+ };
95
+
96
+ export const Disabled: StoryObj<typeof FileUpload> = {
97
+ args: {
98
+ ...fileUploadArgs.disabled,
99
+ label: "Upload your files here",
100
+ labelPlacement: "top",
101
+ labelSize: "medium",
102
+ },
103
+ };
@@ -0,0 +1,17 @@
1
+ import { Meta, Story, Canvas, ArgsTable, Unstyled } from "@storybook/blocks";
2
+ import * as FooterStories from "./Footer.stories.tsx";
3
+ import { Footer } from "../../components";
4
+
5
+ <Meta title="Footer" of={FooterStories} />
6
+
7
+ # Footer Example
8
+
9
+ The footer informs users about the Organization that a website belongs to. It can include copyright details, links to Terms and Conditions and generic calls to action. It should be included at the bottom of each page.
10
+
11
+ <Canvas>
12
+ <Story of={FooterStories.BasicFooter} />
13
+ </Canvas>
14
+
15
+ ## Default Props
16
+
17
+ <ArgsTable of={Footer} />
@@ -0,0 +1,15 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { Footer } from "../../components/Footer";
3
+ import FooterArgs from "../../components/Footer/Footer.args";
4
+
5
+ const FooterMeta: Meta<typeof Footer> = {
6
+ title: "Components/Navigation/Footer",
7
+ component: Footer,
8
+ };
9
+
10
+ export default FooterMeta;
11
+
12
+ export const BasicFooter: StoryObj<typeof Footer> = {
13
+ args: FooterArgs.basic,
14
+ name: "Basic",
15
+ };
@@ -0,0 +1,58 @@
1
+ import { Primary, Meta, ArgTypes, Title } from "@storybook/blocks";
2
+ import * as FormStories from "./Form.stories";
3
+
4
+ <Meta of={FormStories} />
5
+
6
+ # Building Forms
7
+
8
+ Form components in the ILO Design System make it easy to build branded and accessible forms with a minimum of effort. The components are built on top of standard HTML form elements and can be used with most form libraries or validation strategy.
9
+
10
+ <Primary />
11
+
12
+ ## Usage
13
+
14
+ Here's a basic example of a form with four text inputs and a submit button. The `<Form>` component is simply a wrapper around an HTML form element. It's primary purpose is to provide standard layout and spacing for form fields. Otherwise, it takes the same props as a standard HTML form element.
15
+
16
+ ```tsx
17
+ import { Form, Fieldset, TextInput, Button } from "@ilo-org/react";
18
+
19
+ function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
20
+ // handle form submission
21
+ }
22
+
23
+ <Form theme="light" onSubmit={handleSubmit}>
24
+ <Fieldset legend="Personal Information">
25
+ <TextInput name="first-name" label="First Name" />
26
+ <TextInput name="last-name" label="Last Name" />
27
+ </Fieldset>
28
+ <Fieldset legend="Contact Information">
29
+ <TextInput name="email" type="email" label="Email" />
30
+ <TextInput name="phone" type="tel" label="Phone" />
31
+ </Fieldset>
32
+ <Button type="submit">Submit</Button
33
+ </Form>
34
+ ```
35
+
36
+ ## Form components
37
+
38
+ ### Names and ids
39
+
40
+ All form elements must be passed a `name` prop. If you don't also pass in an `id` then it will be set to the same value as the `name` prop.
41
+
42
+ ### Labels and legends
43
+
44
+ All form inputs include `labels` props that can be used to provide a label for the input. The label size and position can also be adjusted with the `labelSize` and `labelPosition` props. Form elements also include `helper` and `errorMessage` props that can be used to display additional info and error messages to the user
45
+
46
+ ## Grouping components together
47
+
48
+ ### Form
49
+
50
+ The form provides a simple wrapper around a standard HTML form element. It accepts all the same props as a standard HTML form element, but also accepts a `theme` prop that can be used to set the text color of the form for rendering on light or dark backgrounds.
51
+
52
+ ### Fieldset
53
+
54
+ The `<Fieldset>` component can be used to group related form elements together. It accepts a `legend` prop that can be used to provide a title for the fieldset. When used with `<Radio>` and `<Checkbox>` components, the `<Fieldset>` component can also be used to show error messages.
55
+
56
+ ## Validation
57
+
58
+ Form Components expose the standard HTML attributes that you can use for native form validation. For use with libraries, form components also expose a `ref` prop that can be used to access the underlying input elements. We recommend using the [React Hook Form](https://react-hook-form.com/) library for form validation.