@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,56 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import {
3
+ FeatureCard,
4
+ FeatureCardArgs,
5
+ } from "../../components/Cards/FeatureCard";
6
+ import {
7
+ ArgTypes,
8
+ Description,
9
+ Primary,
10
+ Stories,
11
+ Title,
12
+ } from "@storybook/blocks";
13
+
14
+ const CardMeta: Meta<typeof FeatureCard> = {
15
+ title: "Components/Cards/Feature Card",
16
+ component: FeatureCard,
17
+ tags: ["autodocs"],
18
+ argTypes: {
19
+ theme: {
20
+ options: ["dark", "light"],
21
+ control: { type: "radio" },
22
+ },
23
+ size: {
24
+ options: ["wide", "narrow", "fluid"],
25
+ control: { type: "radio" },
26
+ },
27
+ },
28
+ parameters: {
29
+ docs: {
30
+ page: () => (
31
+ <>
32
+ <Title>Card</Title>
33
+ <Description>
34
+ Cards display prominent content of a page. This component is a
35
+ wrapper around all of the card types in the design system except for
36
+ the Hero Card. To use it, pass a `type` setting to the card and then
37
+ pass the appropriate fields for that card type. For more information
38
+ about the settings you can pass to each card type, see the
39
+ documentation for that card.
40
+ </Description>
41
+ <Primary />
42
+ <ArgTypes of={CardMeta} />
43
+ <Stories />
44
+ </>
45
+ ),
46
+ },
47
+ },
48
+ };
49
+
50
+ export default CardMeta;
51
+
52
+ export const FeatureCardDefault: StoryObj<typeof FeatureCard> = {
53
+ args: FeatureCardArgs,
54
+ name: "Default",
55
+ render: (args) => <FeatureCard {...args} />,
56
+ };
@@ -0,0 +1,48 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import {
3
+ MultilinkCard,
4
+ MultilinkCardArgs,
5
+ } from "../../components/Cards/MultilinkCard";
6
+ import {
7
+ ArgTypes,
8
+ Description,
9
+ Primary,
10
+ Stories,
11
+ Title,
12
+ } from "@storybook/blocks";
13
+
14
+ const CardMeta: Meta<typeof MultilinkCard> = {
15
+ title: "Components/Cards/Multilink Card",
16
+ component: MultilinkCard,
17
+ tags: ["autodocs"],
18
+ argTypes: {
19
+ size: {
20
+ options: ["wide", "standard", "narrow", "fluid"],
21
+ control: { type: "radio" },
22
+ },
23
+ alignment: {
24
+ options: ["left", "right"],
25
+ control: { type: "radio" },
26
+ },
27
+ },
28
+ parameters: {
29
+ docs: {
30
+ page: () => (
31
+ <>
32
+ <Title>Card</Title>
33
+ <Description>Cards display prominent content of a page.</Description>
34
+ <Primary />
35
+ <ArgTypes of={CardMeta} />
36
+ <Stories />
37
+ </>
38
+ ),
39
+ },
40
+ },
41
+ };
42
+
43
+ export default CardMeta;
44
+
45
+ export const MultilinkCardDefault: StoryObj<typeof MultilinkCard> = {
46
+ args: MultilinkCardArgs,
47
+ name: "Default",
48
+ };
@@ -0,0 +1,48 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { PromoCard, PromoCardArgs } from "../../components/Cards/PromoCard";
3
+ import {
4
+ ArgTypes,
5
+ Description,
6
+ Primary,
7
+ Stories,
8
+ Title,
9
+ } from "@storybook/blocks";
10
+
11
+ const CardMeta: Meta<typeof PromoCard> = {
12
+ title: "Components/Cards/Promo Card",
13
+ component: PromoCard,
14
+ tags: ["autodocs"],
15
+ argTypes: {
16
+ theme: {
17
+ options: ["dark", "light"],
18
+ control: { type: "radio" },
19
+ },
20
+ cornercut: {
21
+ control: { type: "boolean" },
22
+ },
23
+ size: {
24
+ options: ["wide", "standard", "narrow", "fluid"],
25
+ control: { type: "radio" },
26
+ },
27
+ },
28
+ parameters: {
29
+ docs: {
30
+ page: () => (
31
+ <>
32
+ <Title>Card</Title>
33
+ <Description>Cards display prominent content of a page.</Description>
34
+ <Primary />
35
+ <ArgTypes of={CardMeta} />
36
+ <Stories />
37
+ </>
38
+ ),
39
+ },
40
+ },
41
+ };
42
+
43
+ export default CardMeta;
44
+
45
+ export const PromoCardDefault: StoryObj<typeof PromoCard> = {
46
+ args: PromoCardArgs,
47
+ name: "Default",
48
+ };
@@ -0,0 +1,45 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { StatCard, StatCardArgs } from "../../components/Cards/StatCard";
3
+ import {
4
+ ArgTypes,
5
+ Description,
6
+ Primary,
7
+ Stories,
8
+ Title,
9
+ } from "@storybook/blocks";
10
+
11
+ const CardMeta: Meta<typeof StatCard> = {
12
+ title: "Components/Cards/Stat Card",
13
+ component: StatCard,
14
+ tags: ["autodocs"],
15
+ argTypes: {
16
+ color: {
17
+ options: ["turquoise", "green", "yellow", "blue"],
18
+ control: { type: "select" },
19
+ },
20
+ size: {
21
+ options: ["standard", "fluid"],
22
+ control: { type: "radio" },
23
+ },
24
+ },
25
+ parameters: {
26
+ docs: {
27
+ page: () => (
28
+ <>
29
+ <Title>Card</Title>
30
+ <Description>Cards display prominent content of a page.</Description>
31
+ <Primary />
32
+ <ArgTypes of={CardMeta} />
33
+ <Stories />
34
+ </>
35
+ ),
36
+ },
37
+ },
38
+ };
39
+
40
+ export default CardMeta;
41
+
42
+ export const StatCardDefault: StoryObj<typeof StatCard> = {
43
+ args: StatCardArgs,
44
+ name: "Default",
45
+ };
@@ -0,0 +1,45 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { TextCard, TextCardArgs } from "../../components/Cards/TextCard";
3
+ import {
4
+ ArgTypes,
5
+ Description,
6
+ Primary,
7
+ Stories,
8
+ Title,
9
+ } from "@storybook/blocks";
10
+
11
+ const CardMeta: Meta<typeof TextCard> = {
12
+ title: "Components/Cards/Text Card",
13
+ component: TextCard,
14
+ tags: ["autodocs"],
15
+ argTypes: {
16
+ theme: {
17
+ options: ["dark", "light"],
18
+ control: { type: "radio" },
19
+ },
20
+ size: {
21
+ options: ["wide", "fluid", "narrow"],
22
+ control: { type: "radio" },
23
+ },
24
+ },
25
+ parameters: {
26
+ docs: {
27
+ page: () => (
28
+ <>
29
+ <Title>Card</Title>
30
+ <Description>Cards display prominent content of a page.</Description>
31
+ <Primary />
32
+ <ArgTypes of={CardMeta} />
33
+ <Stories />
34
+ </>
35
+ ),
36
+ },
37
+ },
38
+ };
39
+
40
+ export default CardMeta;
41
+
42
+ export const TextCardDefault: StoryObj<typeof TextCard> = {
43
+ args: TextCardArgs,
44
+ name: "Default",
45
+ };
@@ -0,0 +1,17 @@
1
+ import { Meta, Story, Canvas, ArgsTable, Unstyled } from "@storybook/blocks";
2
+ import * as CardGroupStories from "./CardGroup.stories.tsx";
3
+ import { CardGroup } from "../../components";
4
+
5
+ <Meta title="CardGroup" of={CardGroupStories} />
6
+
7
+ # Card Group
8
+
9
+ Card Group displays a group of Cards.
10
+
11
+ <Canvas>
12
+ <Story of={CardGroupStories.FeatureCardGroup} />
13
+ </Canvas>
14
+
15
+ ## Default Props
16
+
17
+ <ArgsTable of={CardGroup} />
@@ -0,0 +1,50 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import CardGroup from "../../components/Cards/CardGroup/CardGroup";
3
+ import CardGroupArgs from "../../components/Cards/CardGroup/CardGroup.args";
4
+
5
+ const CardGroupMeta: Meta<typeof CardGroup> = {
6
+ title: "Components/Cards/CardGroup",
7
+ component: CardGroup,
8
+ };
9
+
10
+ export default CardGroupMeta;
11
+
12
+ export const FeatureCardGroup: StoryObj<typeof CardGroup> = {
13
+ args: CardGroupArgs.featureCardGroup,
14
+ name: "Feature Group",
15
+ };
16
+
17
+ export const GraphicCardGroup: StoryObj<typeof CardGroup> = {
18
+ args: CardGroupArgs.textCardGroup,
19
+ name: "Text Group",
20
+ };
21
+
22
+ export const StatCardGroup: StoryObj<typeof CardGroup> = {
23
+ args: CardGroupArgs.statCardGroup,
24
+ name: "Stat Group",
25
+ };
26
+
27
+ export const MultilinkCardGroup: StoryObj<typeof CardGroup> = {
28
+ args: CardGroupArgs.multilinkCardGroup,
29
+ name: "Multilink Group",
30
+ };
31
+
32
+ export const GraphicPromoCardGroup: StoryObj<typeof CardGroup> = {
33
+ args: CardGroupArgs.promoCardGroup,
34
+ name: "Promo Group",
35
+ };
36
+
37
+ export const DetailCardGroup: StoryObj<typeof CardGroup> = {
38
+ args: CardGroupArgs.detailCardGroup,
39
+ name: "Detail Group",
40
+ };
41
+
42
+ export const FactListCardGroup: StoryObj<typeof CardGroup> = {
43
+ args: CardGroupArgs.factListCardGroup,
44
+ name: "Fact List Group",
45
+ };
46
+
47
+ export const DataCardGroup: StoryObj<typeof CardGroup> = {
48
+ args: CardGroupArgs.dataCardGroup,
49
+ name: "Data Group",
50
+ };
@@ -0,0 +1,118 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { Checkbox, CheckboxArgs } from "../../components/Checkbox";
3
+ import { LabelledCheckboxProps } from "../../components/Checkbox/Checkbox.props";
4
+ import {
5
+ ArgTypes,
6
+ Description,
7
+ Heading,
8
+ Primary,
9
+ Stories,
10
+ Title,
11
+ } from "@storybook/blocks";
12
+ import { Fieldset } from "../../components";
13
+ import { FieldsetProps } from "../../components/Fieldset/Fieldset.props";
14
+ import { labelledChoiceFieldArgTypes } from "../../types/forms.args";
15
+
16
+ const CheckboxMeta: Meta<typeof Checkbox> = {
17
+ title: "Components/Forms/Checkbox",
18
+ component: Checkbox,
19
+ tags: ["autodocs"],
20
+ argTypes: {
21
+ ...labelledChoiceFieldArgTypes("HTMLInputElement"),
22
+ },
23
+ parameters: {
24
+ docs: {
25
+ page: () => (
26
+ <>
27
+ <Title />
28
+ <Description>
29
+ The checkbox component provides users with a switch they can use to
30
+ select more than one option from a list.
31
+ </Description>
32
+ <Primary />
33
+ <Heading>Props</Heading>
34
+ <ArgTypes of={CheckboxMeta} />
35
+ <Stories />
36
+ </>
37
+ ),
38
+ },
39
+ },
40
+ };
41
+
42
+ const fieldSetDefaults: FieldsetProps = {
43
+ legend: "What world of work topics interest you?",
44
+ errorMessage: "You must choose at least one topic",
45
+ };
46
+
47
+ const renderCheckboxes = (
48
+ args: LabelledCheckboxProps,
49
+ fieldsetArgs: FieldsetProps = fieldSetDefaults
50
+ ) => (
51
+ <Fieldset {...fieldsetArgs}>
52
+ <Checkbox
53
+ {...args}
54
+ labelPlacement="end"
55
+ labelSize="small"
56
+ label="Social Justice"
57
+ name="checkbox-1"
58
+ />
59
+ <Checkbox
60
+ {...args}
61
+ labelPlacement="end"
62
+ labelSize="small"
63
+ label="Decent work"
64
+ name="checkbox-2"
65
+ />
66
+ <Checkbox
67
+ {...args}
68
+ labelPlacement="end"
69
+ labelSize="small"
70
+ label="Ending child labour"
71
+ name="checkbox-3"
72
+ />
73
+ <Checkbox
74
+ {...args}
75
+ labelPlacement="end"
76
+ labelSize="small"
77
+ label="Achieving full employment"
78
+ name="checkbox-4"
79
+ />
80
+ </Fieldset>
81
+ );
82
+
83
+ export const Default: StoryObj<LabelledCheckboxProps> = {
84
+ args: CheckboxArgs.basic,
85
+ render: (args) => renderCheckboxes(args),
86
+ };
87
+
88
+ export const CheckedByDefault: StoryObj<LabelledCheckboxProps> = {
89
+ args: CheckboxArgs.checked,
90
+ render: (args) => renderCheckboxes(args),
91
+ };
92
+
93
+ export const Row: StoryObj<LabelledCheckboxProps> = {
94
+ args: CheckboxArgs.basic,
95
+ render: (args) => renderCheckboxes(args),
96
+ };
97
+
98
+ export const Helper: StoryObj<LabelledCheckboxProps> = {
99
+ args: CheckboxArgs.basic,
100
+ render: (args) =>
101
+ renderCheckboxes(args, {
102
+ ...fieldSetDefaults,
103
+ helper: "Choose at least one topic",
104
+ }),
105
+ };
106
+
107
+ export const Error: StoryObj<LabelledCheckboxProps> = {
108
+ args: CheckboxArgs.error,
109
+ render: (args) => renderCheckboxes(args),
110
+ };
111
+
112
+ export const Disabled: StoryObj<LabelledCheckboxProps> = {
113
+ args: CheckboxArgs.basic,
114
+ render: (args) =>
115
+ renderCheckboxes(args, { ...fieldSetDefaults, disabled: true }),
116
+ };
117
+
118
+ export default CheckboxMeta;
@@ -0,0 +1,83 @@
1
+ import { Meta, StoryFn } from "@storybook/react";
2
+ import {
3
+ Title,
4
+ Subtitle,
5
+ Description,
6
+ Primary,
7
+ Stories,
8
+ Subheading,
9
+ ArgsTable,
10
+ } from "@storybook/addon-docs";
11
+ import { ContextMenu } from "../../components/ContextMenu";
12
+ import { ContextMenuProps } from "../../components/ContextMenu/ContextMenu.props";
13
+ import contextMenuArgs from "../../components/ContextMenu/ContextMenu.args";
14
+
15
+ const propsDoc = `
16
+ The ContextMenu receives a list of urls with labels and an optional prop indicating if this link is at the end of a 'section.'
17
+
18
+ | Prop | Description |
19
+ |----------|-------------|
20
+ | \`endsection\` | Boolean - is this at the end of a 'section'? |
21
+ | \`label\` | Label for this link. |
22
+ | \`url\` | URL for this link. |
23
+ `;
24
+
25
+ const ContextMenuMeta: Meta<typeof ContextMenu> = {
26
+ title: "Components/Navigation/ContextMenu",
27
+ component: ContextMenu,
28
+ tags: ["autodocs"],
29
+ parameters: {
30
+ docs: {
31
+ page: () => (
32
+ <>
33
+ <Subtitle />
34
+ <Title />
35
+ <Description>
36
+ The ContextMenu component is used to display a list of contextual
37
+ links.
38
+ </Description>
39
+ <Primary />
40
+ <Subheading>ContextMenus with sections</Subheading>
41
+ <Description>{propsDoc}</Description>
42
+ <Stories title="Examples"></Stories>
43
+ <Subheading>Default Props</Subheading>
44
+ <ArgsTable />
45
+ </>
46
+ ),
47
+ },
48
+ },
49
+ };
50
+
51
+ export default ContextMenuMeta;
52
+
53
+ /**
54
+ * ContextMenu Template
55
+ *
56
+ * create a Storybook template for this component
57
+ *
58
+ *@param (Object) args - props to be passed to the component
59
+ */
60
+ const ContextMenuTemplate: StoryFn<ContextMenuProps> = (args) => (
61
+ <ContextMenu {...args} />
62
+ );
63
+
64
+ export const Basic: StoryFn<ContextMenuProps> = ContextMenuTemplate.bind({});
65
+
66
+ export const WithSection: StoryFn<ContextMenuProps> = ContextMenuTemplate.bind(
67
+ {}
68
+ );
69
+
70
+ // enumerate the props for the variations on the ContextMenu component
71
+ Basic.args = contextMenuArgs.basic;
72
+ Basic.storyName = "Basic";
73
+
74
+ WithSection.args = contextMenuArgs.withsection;
75
+ WithSection.storyName = "Sectioned";
76
+ WithSection.parameters = {
77
+ docs: {
78
+ description: {
79
+ story:
80
+ "The Context menu iteams can each be marked, via the `endsection` prop, as a *section*, which display a 100% width bottom border.",
81
+ },
82
+ },
83
+ };
@@ -0,0 +1,110 @@
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 { DatePicker } from "../../components";
12
+ import DatePickerArgs from "../../components/DatePicker/DatePicker.args";
13
+ import { FormControlPublicProps } from "../../components/FormControl/FormControl.props";
14
+ import { labelledFormFieldArgTypes } from "../../types/forms.args";
15
+
16
+ const DatePickerMeta: Meta<typeof DatePicker> = {
17
+ title: "Components/Forms/DatePicker",
18
+ component: DatePicker,
19
+ tags: ["autodocs"],
20
+ argTypes: {
21
+ max: {
22
+ description: "The maximum date that can be selected",
23
+ control: {
24
+ type: "date",
25
+ },
26
+ table: {
27
+ type: {
28
+ summary: "string",
29
+ },
30
+ },
31
+ },
32
+ min: {
33
+ description: "The minimum date that can be selected",
34
+ control: {
35
+ type: "date",
36
+ },
37
+ table: {
38
+ type: {
39
+ summary: "string",
40
+ },
41
+ },
42
+ },
43
+ step: {
44
+ description: "The step value for the date picker",
45
+ control: {
46
+ type: "number",
47
+ },
48
+ table: {
49
+ type: {
50
+ summary: "number",
51
+ },
52
+ },
53
+ },
54
+ placeholder: {
55
+ description: "The placeholder text for the date picker",
56
+ control: {
57
+ type: "text",
58
+ },
59
+ table: {
60
+ type: {
61
+ summary: "string",
62
+ },
63
+ },
64
+ },
65
+ ...labelledFormFieldArgTypes("HTMLInputElement"),
66
+ },
67
+ parameters: {
68
+ docs: {
69
+ page: () => (
70
+ <>
71
+ <Subtitle />
72
+ <Title />
73
+ <Description>
74
+ The DatePicker component allows users to select a date from a
75
+ calendar.
76
+ </Description>
77
+ <Primary />
78
+ <Subheading>Props</Subheading>
79
+ <ArgTypes of={DatePickerMeta} />
80
+ <Stories title="Examples" />
81
+ </>
82
+ ),
83
+ },
84
+ },
85
+ };
86
+
87
+ export default DatePickerMeta;
88
+
89
+ const startFormCtrlProps: FormControlPublicProps = {
90
+ label: "Select a date",
91
+ labelPlacement: "top",
92
+ labelSize: "medium",
93
+ style: { width: "50%" },
94
+ errorMessage: "There was an error selecting your date",
95
+ };
96
+
97
+ export const Basic: StoryObj<typeof DatePicker> = {
98
+ args: { ...DatePickerArgs.basic, ...startFormCtrlProps },
99
+ render: (args) => <DatePicker {...args} />,
100
+ };
101
+
102
+ export const Error: StoryObj<typeof DatePicker> = {
103
+ args: { ...DatePickerArgs.haserror, ...startFormCtrlProps },
104
+ render: (args) => <DatePicker {...args} />,
105
+ };
106
+
107
+ export const Disabled: StoryObj<typeof DatePicker> = {
108
+ args: { ...DatePickerArgs.basic, disabled: true, ...startFormCtrlProps },
109
+ render: (args) => <DatePicker {...args} />,
110
+ };