@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.
- package/.storybook/main.ts +41 -0
- package/.storybook/manager-head.html +92 -0
- package/.storybook/manager.ts +6 -0
- package/.storybook/preview-head.html +5 -0
- package/.storybook/preview.tsx +81 -0
- package/.storybook/styles.scss +25 -0
- package/.storybook/theme.ts +46 -0
- package/.turbo/turbo-build:lib.log +15 -0
- package/CHANGELOG.md +26 -0
- package/lib/cjs/components/Cards/CardGroup/CardGroup.js +0 -1
- package/lib/cjs/components/Cards/CardGroup/index.js +197 -160
- package/lib/cjs/components/Cards/FactlistCard/FactListCard.js +0 -1
- package/lib/cjs/components/Cards/FactlistCard/index.js +0 -1
- package/lib/cjs/components/Cards/TextCard/TextCard.js +1 -1
- package/lib/cjs/components/List/List.js +9 -11
- package/lib/cjs/components/List/ListItem.js +4 -7
- package/lib/cjs/components/List/index.js +1 -2
- package/lib/cjs/components/index.js +0 -1
- package/lib/cjs/index.js +0 -1
- package/lib/esm/components/Cards/CardGroup/CardGroup.js +0 -1
- package/lib/esm/components/Cards/CardGroup/index.js +197 -160
- package/lib/esm/components/Cards/FactlistCard/FactListCard.js +0 -1
- package/lib/esm/components/Cards/FactlistCard/index.js +0 -1
- package/lib/esm/components/Cards/TextCard/TextCard.js +1 -1
- package/lib/esm/components/List/List.js +10 -12
- package/lib/esm/components/List/ListItem.js +4 -7
- package/lib/esm/components/List/index.js +1 -2
- package/lib/esm/components/index.js +0 -1
- package/lib/esm/index.js +0 -1
- package/lib/types/react/src/components/List/List.props.d.ts +2 -9
- package/lib/types/react/src/components/List/ListItem.props.d.ts +0 -6
- package/lib/types/react/src/types/index.d.ts +0 -2
- package/package.json +32 -12
- package/public/fao-logo.svg +195 -0
- package/public/favicon.ico +0 -0
- package/public/hero.jpg +0 -0
- package/public/ilo-dg.jpg +0 -0
- package/public/ilo-headquarters.jpg +0 -0
- package/public/large.jpg +0 -0
- package/public/media-file-poster.jpg +0 -0
- package/public/medium.jpg +0 -0
- package/public/react.svg +8 -0
- package/public/small.jpg +0 -0
- package/public/unhcr-logo.svg +1 -0
- package/public/unicef-logo.png +0 -0
- package/public/video-example.mp4 +0 -0
- package/public/wfp-logo.svg +1 -0
- package/public/who-logo.svg +1 -0
- package/public/youtube-video-poster.avif +0 -0
- package/rollup.config.mjs +2 -0
- package/src/__tests__/Accordion.test.tsx +16 -0
- package/src/__tests__/Button.test.tsx +60 -0
- package/src/__tests__/Callout.test.tsx +43 -0
- package/src/__tests__/ContextMenu.test.tsx +19 -0
- package/src/__tests__/Dropdown.test.tsx +38 -0
- package/src/__tests__/Heading.test.tsx +51 -0
- package/src/__tests__/Image.test.tsx +21 -0
- package/src/__tests__/LinkList.test.tsx +17 -0
- package/src/__tests__/List.test.tsx +25 -0
- package/src/__tests__/Loading.test.tsx +33 -0
- package/src/__tests__/Notification.test.tsx +39 -0
- package/src/__tests__/Pagination.test.tsx +58 -0
- package/src/__tests__/Profile.test.tsx +48 -0
- package/src/__tests__/ReadMore.test.tsx +43 -0
- package/src/__tests__/RichText.test.tsx +16 -0
- package/src/__tests__/SearchField.test.tsx +35 -0
- package/src/__tests__/TableOfContents.test.tsx +12 -0
- package/src/__tests__/Tag.test.tsx +10 -0
- package/src/components/Cards/CardGroup/CardGroup.args.ts +205 -166
- package/src/components/Cards/TextCard/TextCard.tsx +1 -1
- package/src/components/List/List.props.ts +2 -10
- package/src/components/List/List.tsx +17 -22
- package/src/components/List/ListItem.props.ts +0 -7
- package/src/components/List/ListItem.tsx +6 -11
- package/src/setup.ts +6 -0
- package/src/stories/Accordion/Accordion.stories.tsx +145 -0
- package/src/stories/Breadcrumb/Breadcrumb.mdx +17 -0
- package/src/stories/Breadcrumb/Breadcrumb.stories.tsx +20 -0
- package/src/stories/Button/Button.mdx +94 -0
- package/src/stories/Button/Button.stories.tsx +68 -0
- package/src/stories/Callout/Callout.mdx +35 -0
- package/src/stories/Callout/Callout.stories.tsx +43 -0
- package/src/stories/Card/DataCard.stories.tsx +45 -0
- package/src/stories/Card/DetailCard.stories.tsx +41 -0
- package/src/stories/Card/FactlistCard.stories.tsx +48 -0
- package/src/stories/Card/FeatureCard.stories.tsx +56 -0
- package/src/stories/Card/MultilinkCard.stories.tsx +48 -0
- package/src/stories/Card/PromoCard.stories.tsx +48 -0
- package/src/stories/Card/StatCard.stories.tsx +45 -0
- package/src/stories/Card/TextCard.stories.tsx +45 -0
- package/src/stories/CardGroup/CardGroup.mdx +17 -0
- package/src/stories/CardGroup/CardGroup.stories.tsx +50 -0
- package/src/stories/Checkbox/Checkbox.stories.tsx +118 -0
- package/src/stories/ContextMenu/ContextMenu.stories.tsx +83 -0
- package/src/stories/DatePicker/DatePicker.stories.tsx +110 -0
- package/src/stories/Dropdown/Dropdown.stories.tsx +145 -0
- package/src/stories/Empty/Empty.stories.tsx +53 -0
- package/src/stories/Fieldset/Fieldset.stories.tsx +167 -0
- package/src/stories/FileUpload/FileUpload.stories.tsx +103 -0
- package/src/stories/Footer/Footer.mdx +17 -0
- package/src/stories/Footer/Footer.stories.tsx +15 -0
- package/src/stories/Form/Form.mdx +58 -0
- package/src/stories/Form/Form.stories.tsx +162 -0
- package/src/stories/GetStarted.mdx +57 -0
- package/src/stories/Heading/Heading.stories.tsx +193 -0
- package/src/stories/Hero/Hero.stories.tsx +68 -0
- package/src/stories/Image/Image.stories.tsx +50 -0
- package/src/stories/Link/Link.stories.tsx +81 -0
- package/src/stories/LinkList/LinkList.args.ts +190 -0
- package/src/stories/LinkList/LinkList.stories.tsx +60 -0
- package/src/stories/List/List.stories.tsx +167 -0
- package/src/stories/Loading/Loading.stories.tsx +97 -0
- package/src/stories/LocalNav/LocalNav.mdx +17 -0
- package/src/stories/LocalNav/LocalNav.stories.tsx +15 -0
- package/src/stories/Logo/Logo.stories.tsx +172 -0
- package/src/stories/LogoGrid/LogoGrid.stories.tsx +59 -0
- package/src/stories/Navigation/Navigation.mdx +17 -0
- package/src/stories/Navigation/Navigation.stories.tsx +15 -0
- package/src/stories/Notification/Notification.stories.tsx +187 -0
- package/src/stories/NumberPicker/NumberPicker.stories.tsx +69 -0
- package/src/stories/Pagination/Pagination.stories.tsx +86 -0
- package/src/stories/Profile/Profile.stories.tsx +64 -0
- package/src/stories/Radio/Radio.stories.tsx +232 -0
- package/src/stories/ReadMore/ReadMore.stories.tsx +59 -0
- package/src/stories/RichText/RichText.stories.tsx +63 -0
- package/src/stories/SearchField/SearchField.stories.tsx +91 -0
- package/src/stories/SocialMedia/SocialMedia.stories.tsx +60 -0
- package/src/stories/TableOfContents/TableOfContents.stories.tsx +55 -0
- package/src/stories/Tabs/Tabs.mdx +17 -0
- package/src/stories/Tabs/Tabs.stories.tsx +25 -0
- package/src/stories/Tag/Tag.stories.tsx +130 -0
- package/src/stories/TextInput/TextInput.stories.tsx +100 -0
- package/src/stories/Textarea/Textarea.stories.tsx +147 -0
- package/src/stories/Toggle/Toggle.stories.tsx +99 -0
- package/src/stories/Tooltip/Tooltip.stories.tsx +82 -0
- package/src/stories/Video/Video.stories.tsx +71 -0
- package/src/stories/Welcome.stories.mdx +37 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/stories/assets/stackalt.svg +1 -0
- package/src/stories/welcome.scss +133 -0
- package/src/types/index.ts +0 -2
- package/lib/cjs/ListCtx-14aa546f.js +0 -9
- package/lib/esm/ListCtx-da435fdf.js +0 -6
- package/lib/types/react/src/components/List/ListCtx.d.ts +0 -4
- package/src/components/List/ListCtx.ts +0 -7
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Logo } from "../../components/Logo";
|
|
3
|
+
import {
|
|
4
|
+
Title,
|
|
5
|
+
Description,
|
|
6
|
+
Primary,
|
|
7
|
+
Stories,
|
|
8
|
+
Subheading,
|
|
9
|
+
ArgTypes,
|
|
10
|
+
} from "@storybook/blocks";
|
|
11
|
+
import {
|
|
12
|
+
basic,
|
|
13
|
+
withSubBrand,
|
|
14
|
+
withDarkTheme,
|
|
15
|
+
withLongSubbrand,
|
|
16
|
+
fluidWidth,
|
|
17
|
+
} from "../../components/Logo/Logo.args";
|
|
18
|
+
import { brand } from "@ilo-org/themes/tokens/brand/base.json";
|
|
19
|
+
|
|
20
|
+
const LogoMeta: Meta<typeof Logo> = {
|
|
21
|
+
title: "Components/Brand/Logo",
|
|
22
|
+
component: Logo,
|
|
23
|
+
tags: ["autodocs"],
|
|
24
|
+
argTypes: {
|
|
25
|
+
src: {
|
|
26
|
+
control: "object",
|
|
27
|
+
},
|
|
28
|
+
alt: {
|
|
29
|
+
control: "text",
|
|
30
|
+
},
|
|
31
|
+
subbrand: {
|
|
32
|
+
control: "text",
|
|
33
|
+
},
|
|
34
|
+
size: {
|
|
35
|
+
control: "number",
|
|
36
|
+
},
|
|
37
|
+
style: {
|
|
38
|
+
control: "object",
|
|
39
|
+
},
|
|
40
|
+
className: {
|
|
41
|
+
control: "text",
|
|
42
|
+
},
|
|
43
|
+
target: {
|
|
44
|
+
control: "select",
|
|
45
|
+
options: ["_blank", "_self", "_parent", "_top"],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
parameters: {
|
|
49
|
+
docs: {
|
|
50
|
+
page: () => (
|
|
51
|
+
<>
|
|
52
|
+
<Title />
|
|
53
|
+
<Description>
|
|
54
|
+
The Logo component renders an image representing an organization. It
|
|
55
|
+
can be shown on a light or dark background (theme) and may include
|
|
56
|
+
an sub-brand, which appears in a "lockup" next to the main logo.
|
|
57
|
+
</Description>
|
|
58
|
+
<Primary />
|
|
59
|
+
<Subheading>Why use this component?</Subheading>
|
|
60
|
+
<Description>
|
|
61
|
+
The `Logo` component provides a standard interface for rendering
|
|
62
|
+
brand-compliant logos in different contexts and backgrounds. It can
|
|
63
|
+
be rendered at fixed or fluid sizes (widths) and offers a convenient
|
|
64
|
+
way of handling `light` and `dark` themes (backgrounds).
|
|
65
|
+
</Description>
|
|
66
|
+
<Description>
|
|
67
|
+
It's especially handy for implementing sub-brands, which can be
|
|
68
|
+
added by means of a single `subbrand` prop. This takes a `string`
|
|
69
|
+
(the name of the sub-brand) and renders it as a responsive lockup
|
|
70
|
+
that resizes dynamically together with the logo. This allows you to
|
|
71
|
+
treat a `Logo` with subbrand as if it were a single image.
|
|
72
|
+
</Description>
|
|
73
|
+
<Subheading>Theme</Subheading>
|
|
74
|
+
<Description>
|
|
75
|
+
The `theme` prop determines whether the logo should be rendered on a
|
|
76
|
+
`light` or `dark` background. In order to work, the `src` prop
|
|
77
|
+
should be an object with `light` and `dark` properties that point to
|
|
78
|
+
the image files you want to use in either scenario. [See
|
|
79
|
+
example](/story/components-brand-logo--dark-theme).
|
|
80
|
+
</Description>
|
|
81
|
+
<Subheading>Sub-brands</Subheading>
|
|
82
|
+
<Description>
|
|
83
|
+
Add a sub-brand by passing a `string` to the `subbrand` prop with
|
|
84
|
+
the text to appear in the lockup space next to the logo. The
|
|
85
|
+
font-size of the subbrand will resize automatically to fill the
|
|
86
|
+
available space without overflowing the lockup. The lockup is
|
|
87
|
+
responsive, so you can treat the component like an image. [See
|
|
88
|
+
example](/story/components-brand-logo--long-subrand).
|
|
89
|
+
</Description>
|
|
90
|
+
<Subheading>Size</Subheading>
|
|
91
|
+
<Description>
|
|
92
|
+
Pass a `number` to the `size` prop to set a fixed with on the Logo
|
|
93
|
+
component or use `fluid` if you want the component to fill the
|
|
94
|
+
available space from its parent.
|
|
95
|
+
</Description>
|
|
96
|
+
<Stories title="Examples"></Stories>
|
|
97
|
+
<ArgTypes of={LogoMeta} />
|
|
98
|
+
</>
|
|
99
|
+
),
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export default LogoMeta;
|
|
105
|
+
|
|
106
|
+
export const BasicLogo: StoryObj<typeof Logo> = {
|
|
107
|
+
args: basic,
|
|
108
|
+
name: "Default",
|
|
109
|
+
parameters: {
|
|
110
|
+
docs: {
|
|
111
|
+
canvas: { sourceState: "shown" },
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
argTypes: {
|
|
115
|
+
subbrand: {
|
|
116
|
+
table: {
|
|
117
|
+
disable: true,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const argTypesWithTheme = {
|
|
124
|
+
theme: {
|
|
125
|
+
control: "select",
|
|
126
|
+
options: ["light", "dark"],
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const SubBrandLogo: StoryObj<typeof Logo> = {
|
|
131
|
+
args: withSubBrand,
|
|
132
|
+
name: "Sub-brand",
|
|
133
|
+
argTypes: argTypesWithTheme,
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const LongSubrand: StoryObj<typeof Logo> = {
|
|
137
|
+
args: withLongSubbrand,
|
|
138
|
+
name: "Sub-brand on multiple lines",
|
|
139
|
+
argTypes: argTypesWithTheme,
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const DarkTheme: StoryObj<typeof Logo> = {
|
|
143
|
+
args: withDarkTheme,
|
|
144
|
+
name: "Dark theme",
|
|
145
|
+
argTypes: argTypesWithTheme,
|
|
146
|
+
parameters: {
|
|
147
|
+
backgrounds: {
|
|
148
|
+
default: "ilo",
|
|
149
|
+
values: [{ name: "ilo", value: brand["ilo-dark-blue"].value }],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const FluidWidth: StoryObj<typeof Logo> = {
|
|
155
|
+
args: fluidWidth,
|
|
156
|
+
name: "Fluid width",
|
|
157
|
+
parameters: {
|
|
158
|
+
backgrounds: {
|
|
159
|
+
default: "ilo",
|
|
160
|
+
values: [{ name: "ilo", value: brand["ilo-dark-blue"].value }],
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
argTypes: {
|
|
164
|
+
size: { control: "text" },
|
|
165
|
+
...argTypesWithTheme,
|
|
166
|
+
},
|
|
167
|
+
render: (args) => (
|
|
168
|
+
<div style={{ width: "600px", border: "1px dotted #fff" }}>
|
|
169
|
+
<Logo {...args} />
|
|
170
|
+
</div>
|
|
171
|
+
),
|
|
172
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { LogoGrid } from "../../components/LogoGrid";
|
|
3
|
+
import {
|
|
4
|
+
Title,
|
|
5
|
+
Description,
|
|
6
|
+
Primary,
|
|
7
|
+
Stories,
|
|
8
|
+
ArgTypes,
|
|
9
|
+
} from "@storybook/blocks";
|
|
10
|
+
import {
|
|
11
|
+
defaultLogoGrid,
|
|
12
|
+
darkLogoGrid,
|
|
13
|
+
noLinksGrid,
|
|
14
|
+
} from "../../components/LogoGrid/LogoGrid.args";
|
|
15
|
+
|
|
16
|
+
const LogoMeta: Meta<typeof LogoGrid> = {
|
|
17
|
+
title: "Components/Brand/LogoGrid",
|
|
18
|
+
component: LogoGrid,
|
|
19
|
+
tags: ["autodocs"],
|
|
20
|
+
parameters: {
|
|
21
|
+
docs: {
|
|
22
|
+
page: () => (
|
|
23
|
+
<>
|
|
24
|
+
<Title />
|
|
25
|
+
<Description>
|
|
26
|
+
The Logo Grid component renders a series of logos representing a
|
|
27
|
+
group of organizations. It can be shown on a light or dark
|
|
28
|
+
background.
|
|
29
|
+
</Description>
|
|
30
|
+
<Primary />
|
|
31
|
+
<Stories title="Examples"></Stories>
|
|
32
|
+
<ArgTypes of={LogoMeta} />
|
|
33
|
+
</>
|
|
34
|
+
),
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default LogoMeta;
|
|
40
|
+
|
|
41
|
+
export const basic: StoryObj<typeof LogoGrid> = {
|
|
42
|
+
args: defaultLogoGrid,
|
|
43
|
+
parameters: {
|
|
44
|
+
docs: {
|
|
45
|
+
canvas: { sourceState: "shown" },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const dark: StoryObj<typeof LogoGrid> = {
|
|
51
|
+
args: darkLogoGrid,
|
|
52
|
+
parameters: {
|
|
53
|
+
backgrounds: { default: "dark" },
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const noLinks: StoryObj<typeof LogoGrid> = {
|
|
58
|
+
args: noLinksGrid,
|
|
59
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Meta, Story, Canvas, ArgsTable, Unstyled } from "@storybook/blocks";
|
|
2
|
+
import * as NavigationStories from "./Navigation.stories.tsx";
|
|
3
|
+
import { Navigation } from "../../components";
|
|
4
|
+
|
|
5
|
+
<Meta title="Navigation" of={NavigationStories} />
|
|
6
|
+
|
|
7
|
+
# Global Navigation Example
|
|
8
|
+
|
|
9
|
+
This global navigation component should be used as the header of the main site.
|
|
10
|
+
|
|
11
|
+
<Canvas>
|
|
12
|
+
<Story of={NavigationStories.BasicNavigation} />
|
|
13
|
+
</Canvas>
|
|
14
|
+
|
|
15
|
+
## Default Props
|
|
16
|
+
|
|
17
|
+
<ArgsTable of={Navigation} />
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Navigation } from "../../components/Navigation";
|
|
3
|
+
import NavigationArgs from "../../components/Navigation/Navigation.args";
|
|
4
|
+
|
|
5
|
+
const NavigationMeta: Meta<typeof Navigation> = {
|
|
6
|
+
title: "Components/Navigation/Navigation",
|
|
7
|
+
component: Navigation,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default NavigationMeta;
|
|
11
|
+
|
|
12
|
+
export const BasicNavigation: StoryObj<typeof Navigation> = {
|
|
13
|
+
args: NavigationArgs.basic,
|
|
14
|
+
name: "Basic",
|
|
15
|
+
};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { StoryFn, Meta } from "@storybook/react";
|
|
2
|
+
import {
|
|
3
|
+
Title,
|
|
4
|
+
Subheading,
|
|
5
|
+
Description,
|
|
6
|
+
Primary,
|
|
7
|
+
ArgsTable,
|
|
8
|
+
Stories,
|
|
9
|
+
} from "@storybook/addon-docs";
|
|
10
|
+
import { Notification } from "../../components/Notification";
|
|
11
|
+
import { NotificationProps } from "../../components/Notification/Notification.props";
|
|
12
|
+
import notificationArgs from "../../components/Notification/Notification.args";
|
|
13
|
+
|
|
14
|
+
const typeDoc = `
|
|
15
|
+
By changing the \`type\` prop you can set which icon to use with the Notification.
|
|
16
|
+
|
|
17
|
+
| type | Description |
|
|
18
|
+
|----------|-------------|
|
|
19
|
+
| \`error\` | The Notification alerts user to an error. Border is red with an error icon. |
|
|
20
|
+
| \`info\` | The Notification alerts user to new information. Border is blue with an info icon. |
|
|
21
|
+
| \`success\` | The Notification alerts user to an operation's success. Border is green with a success icon. |
|
|
22
|
+
| \`warning\` | The Notification alerts user to a warning. Border is yellow with a warning icon. |`;
|
|
23
|
+
|
|
24
|
+
const placementDoc = `
|
|
25
|
+
By changing the \`placement\` prop you can set whether the Notification is displayed inline in the document flow, or highest in the document z-index as a dialog.
|
|
26
|
+
|
|
27
|
+
| type | Description |
|
|
28
|
+
|----------|-------------|
|
|
29
|
+
| \`dialog\` | The Notification appears highest in the document z-index, outside the doucment flow. |
|
|
30
|
+
| \`inline\` | The Notification appears in the normal document flow. |`;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Notification Story
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
const NotificationMeta: Meta<typeof Notification> = {
|
|
37
|
+
title: "Components/Feedback/Notification",
|
|
38
|
+
component: Notification,
|
|
39
|
+
tags: ["autodocs"],
|
|
40
|
+
argTypes: {
|
|
41
|
+
type: {
|
|
42
|
+
options: ["error", "info", "success", "warning"],
|
|
43
|
+
control: { type: "select" },
|
|
44
|
+
},
|
|
45
|
+
placement: {
|
|
46
|
+
options: ["dialog", "inline"],
|
|
47
|
+
control: { type: "select" },
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
parameters: {
|
|
51
|
+
docs: {
|
|
52
|
+
page: () => (
|
|
53
|
+
<>
|
|
54
|
+
<Title />
|
|
55
|
+
<Description>
|
|
56
|
+
The Notification component presents a dismissible alert. It can
|
|
57
|
+
appear as an inline alert, which appears in the normal flow of the
|
|
58
|
+
document, or it can appear as a dialog, highest in the document's
|
|
59
|
+
z-index.
|
|
60
|
+
</Description>
|
|
61
|
+
<Primary />
|
|
62
|
+
<Subheading>Type</Subheading>
|
|
63
|
+
<Description>{typeDoc}</Description>
|
|
64
|
+
<Subheading>Placement</Subheading>
|
|
65
|
+
<Description>{placementDoc}</Description>
|
|
66
|
+
<Stories title="Examples"></Stories>
|
|
67
|
+
<Subheading>Default props</Subheading>
|
|
68
|
+
<ArgsTable />
|
|
69
|
+
</>
|
|
70
|
+
),
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default NotificationMeta;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Notification Template
|
|
79
|
+
*
|
|
80
|
+
* create a Storybook template for this component
|
|
81
|
+
*
|
|
82
|
+
*@param (Object) args - props to be passed to the component
|
|
83
|
+
*/
|
|
84
|
+
const NotificationTemplate: StoryFn<NotificationProps> = (args) => (
|
|
85
|
+
<Notification {...args} />
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Notification Instance without CTA
|
|
90
|
+
*
|
|
91
|
+
*/
|
|
92
|
+
export const BaseNotification: StoryFn<NotificationProps> =
|
|
93
|
+
NotificationTemplate.bind({});
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Notification Instance - CTA is populated
|
|
97
|
+
*
|
|
98
|
+
*/
|
|
99
|
+
export const NotificationWithCTA: StoryFn<NotificationProps> =
|
|
100
|
+
NotificationTemplate.bind({});
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Notification Instance - error
|
|
104
|
+
*
|
|
105
|
+
*/
|
|
106
|
+
export const NotificationError: StoryFn<NotificationProps> =
|
|
107
|
+
NotificationTemplate.bind({});
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Notification Instance - success
|
|
111
|
+
*
|
|
112
|
+
*/
|
|
113
|
+
export const NotificationSuccess: StoryFn<NotificationProps> =
|
|
114
|
+
NotificationTemplate.bind({});
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Notification Instance - warning
|
|
118
|
+
*
|
|
119
|
+
*/
|
|
120
|
+
export const NotificationWarning: StoryFn<NotificationProps> =
|
|
121
|
+
NotificationTemplate.bind({});
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Notification Instance - info, as dialog
|
|
125
|
+
*
|
|
126
|
+
*/
|
|
127
|
+
export const DialogNotification: StoryFn<NotificationProps> =
|
|
128
|
+
NotificationTemplate.bind({});
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Notification Instance - CTA is populated, as dialog
|
|
132
|
+
*
|
|
133
|
+
*/
|
|
134
|
+
export const DialogWithCTA: StoryFn<NotificationProps> =
|
|
135
|
+
NotificationTemplate.bind({});
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Notification Instance - error, as dialog
|
|
139
|
+
*
|
|
140
|
+
*/
|
|
141
|
+
export const DialogError: StoryFn<NotificationProps> =
|
|
142
|
+
NotificationTemplate.bind({});
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Notification Instance - success, as dialog
|
|
146
|
+
*
|
|
147
|
+
*/
|
|
148
|
+
export const DialogSuccess: StoryFn<NotificationProps> =
|
|
149
|
+
NotificationTemplate.bind({});
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Notification Instance - warning, as dialog
|
|
153
|
+
*
|
|
154
|
+
*/
|
|
155
|
+
export const DialogWarning: StoryFn<NotificationProps> =
|
|
156
|
+
NotificationTemplate.bind({});
|
|
157
|
+
|
|
158
|
+
// enumerate the props for the read more component
|
|
159
|
+
BaseNotification.args = notificationArgs.nocta;
|
|
160
|
+
BaseNotification.storyName = "Info";
|
|
161
|
+
|
|
162
|
+
NotificationWithCTA.args = notificationArgs.hascta;
|
|
163
|
+
NotificationWithCTA.storyName = "Call to action";
|
|
164
|
+
|
|
165
|
+
NotificationError.args = notificationArgs.error;
|
|
166
|
+
NotificationError.storyName = "Error";
|
|
167
|
+
|
|
168
|
+
NotificationSuccess.args = notificationArgs.success;
|
|
169
|
+
NotificationSuccess.storyName = "Success";
|
|
170
|
+
|
|
171
|
+
NotificationWarning.args = notificationArgs.warning;
|
|
172
|
+
NotificationWarning.storyName = "Warning";
|
|
173
|
+
|
|
174
|
+
DialogNotification.args = notificationArgs.infodialog;
|
|
175
|
+
DialogNotification.storyName = "Info";
|
|
176
|
+
|
|
177
|
+
DialogWithCTA.args = notificationArgs.hasctadialog;
|
|
178
|
+
DialogWithCTA.storyName = "Dialog with call to action";
|
|
179
|
+
|
|
180
|
+
DialogError.args = notificationArgs.errordialog;
|
|
181
|
+
DialogError.storyName = "Error dialog";
|
|
182
|
+
|
|
183
|
+
DialogSuccess.args = notificationArgs.successdialog;
|
|
184
|
+
DialogSuccess.storyName = "Success dialog";
|
|
185
|
+
|
|
186
|
+
DialogWarning.args = notificationArgs.warningdialog;
|
|
187
|
+
DialogWarning.storyName = "Warning dialog";
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import {
|
|
3
|
+
Title,
|
|
4
|
+
Subtitle,
|
|
5
|
+
Description,
|
|
6
|
+
Primary,
|
|
7
|
+
Stories,
|
|
8
|
+
Subheading,
|
|
9
|
+
ArgsTable,
|
|
10
|
+
ArgTypes,
|
|
11
|
+
} from "@storybook/addon-docs";
|
|
12
|
+
import { NumberPicker } from "../../components";
|
|
13
|
+
import NumberPickerArgs from "../../components/NumberPicker/NumberPicker.args";
|
|
14
|
+
import { labelledFormFieldArgTypes } from "../../types/forms.args";
|
|
15
|
+
|
|
16
|
+
const NumberPickerMeta: Meta<typeof NumberPicker> = {
|
|
17
|
+
title: "Components/Forms/NumberPicker",
|
|
18
|
+
component: NumberPicker,
|
|
19
|
+
tags: ["autodocs"],
|
|
20
|
+
argTypes: {
|
|
21
|
+
placeholder: {
|
|
22
|
+
description: "The placeholder text for the number picker",
|
|
23
|
+
control: {
|
|
24
|
+
type: "text",
|
|
25
|
+
},
|
|
26
|
+
table: {
|
|
27
|
+
type: {
|
|
28
|
+
summary: "string",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
...labelledFormFieldArgTypes("HTMLInputElement"),
|
|
33
|
+
},
|
|
34
|
+
parameters: {
|
|
35
|
+
docs: {
|
|
36
|
+
page: () => (
|
|
37
|
+
<>
|
|
38
|
+
<Subtitle />
|
|
39
|
+
<Title />
|
|
40
|
+
<Description>
|
|
41
|
+
The NumberPicker component allows users to select a number from a
|
|
42
|
+
list.
|
|
43
|
+
</Description>
|
|
44
|
+
<Primary />
|
|
45
|
+
<Subheading>Props</Subheading>
|
|
46
|
+
<ArgTypes of={NumberPickerMeta} />
|
|
47
|
+
<Stories title="Examples" />
|
|
48
|
+
</>
|
|
49
|
+
),
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default NumberPickerMeta;
|
|
55
|
+
|
|
56
|
+
export const Basic: StoryObj<typeof NumberPicker> = {
|
|
57
|
+
args: NumberPickerArgs.basic,
|
|
58
|
+
render: (args) => <NumberPicker {...args} />,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const Error: StoryObj<typeof NumberPicker> = {
|
|
62
|
+
args: NumberPickerArgs.haserror,
|
|
63
|
+
render: (args) => <NumberPicker {...args} />,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const Disabled: StoryObj<typeof NumberPicker> = {
|
|
67
|
+
args: { ...NumberPickerArgs.basic, disabled: true },
|
|
68
|
+
render: (args) => <NumberPicker {...args} />,
|
|
69
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { StoryFn, Meta } from "@storybook/react";
|
|
2
|
+
import {
|
|
3
|
+
Title,
|
|
4
|
+
Subheading,
|
|
5
|
+
Description,
|
|
6
|
+
Primary,
|
|
7
|
+
ArgsTable,
|
|
8
|
+
Stories,
|
|
9
|
+
} from "@storybook/addon-docs";
|
|
10
|
+
import { Pagination } from "../../components/Pagination";
|
|
11
|
+
import { PaginationProps } from "../../components/Pagination/Pagination.props";
|
|
12
|
+
import paginationArgs from "../../components/Pagination/Pagination.args";
|
|
13
|
+
|
|
14
|
+
const typeDoc = `
|
|
15
|
+
Generic pagination component with a first, previous, last and next button`;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Pagination Story
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
const PaginationMeta: Meta<typeof Pagination> = {
|
|
22
|
+
title: "Components/Navigation/Pagination",
|
|
23
|
+
component: Pagination,
|
|
24
|
+
tags: ["autodocs"],
|
|
25
|
+
argTypes: {},
|
|
26
|
+
parameters: {
|
|
27
|
+
docs: {
|
|
28
|
+
page: () => (
|
|
29
|
+
<>
|
|
30
|
+
<Title />
|
|
31
|
+
<Description>
|
|
32
|
+
Pagination allows users to view lists of content items in chunks or
|
|
33
|
+
"pages". It's ideal when infinite loading isn't used or in contexts
|
|
34
|
+
where SEO is important, such as articles or blog posts.
|
|
35
|
+
</Description>
|
|
36
|
+
<Primary />
|
|
37
|
+
<Subheading>Type</Subheading>
|
|
38
|
+
<Description>{typeDoc}</Description>
|
|
39
|
+
<Stories title="Examples"></Stories>
|
|
40
|
+
<Subheading>Default props</Subheading>
|
|
41
|
+
<ArgsTable />
|
|
42
|
+
</>
|
|
43
|
+
),
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default PaginationMeta;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Pagination Template
|
|
52
|
+
*
|
|
53
|
+
* create a Storybook template for this component
|
|
54
|
+
*
|
|
55
|
+
*@param (Object) args - props to be passed to the component
|
|
56
|
+
*/
|
|
57
|
+
const PaginationTemplate: StoryFn<PaginationProps> = (args) => (
|
|
58
|
+
<div
|
|
59
|
+
style={{
|
|
60
|
+
width: "100%",
|
|
61
|
+
display: "flex",
|
|
62
|
+
justifyContent: "center",
|
|
63
|
+
alignItems: "center",
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
<div
|
|
67
|
+
style={{
|
|
68
|
+
width: "100%",
|
|
69
|
+
maxWidth: "300px",
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
<Pagination {...args} />
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Pagination Instance without CTA
|
|
79
|
+
*
|
|
80
|
+
*/
|
|
81
|
+
export const BasePagination: StoryFn<PaginationProps> = PaginationTemplate.bind(
|
|
82
|
+
{}
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
BasePagination.args = paginationArgs.pagination;
|
|
86
|
+
BasePagination.storyName = "Pagination";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { StoryFn, Meta } from "@storybook/react";
|
|
2
|
+
import {
|
|
3
|
+
Title,
|
|
4
|
+
Description,
|
|
5
|
+
Primary,
|
|
6
|
+
Stories,
|
|
7
|
+
Subheading,
|
|
8
|
+
ArgsTable,
|
|
9
|
+
} from "@storybook/addon-docs";
|
|
10
|
+
import { Profile } from "../../components/Profile";
|
|
11
|
+
import { ProfileProps } from "../../components/Profile/Profile.props";
|
|
12
|
+
import profileArgs from "../../components/Profile/Profile.args";
|
|
13
|
+
|
|
14
|
+
const ProfileMeta: Meta<typeof Profile> = {
|
|
15
|
+
title: "Components/Content/Profile",
|
|
16
|
+
component: Profile,
|
|
17
|
+
tags: ["autodocs"],
|
|
18
|
+
parameters: {
|
|
19
|
+
docs: {
|
|
20
|
+
page: () => (
|
|
21
|
+
<>
|
|
22
|
+
<Title />
|
|
23
|
+
<Description>
|
|
24
|
+
The Profile component is used to display information about a person.
|
|
25
|
+
</Description>
|
|
26
|
+
<Primary />
|
|
27
|
+
<Stories title="Examples"></Stories>
|
|
28
|
+
<Subheading>Default props</Subheading>
|
|
29
|
+
<ArgsTable></ArgsTable>
|
|
30
|
+
</>
|
|
31
|
+
),
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
} as Meta<typeof Profile>;
|
|
35
|
+
|
|
36
|
+
export default ProfileMeta;
|
|
37
|
+
|
|
38
|
+
const ProfileTemplate: StoryFn<ProfileProps> = (args) => <Profile {...args} />;
|
|
39
|
+
|
|
40
|
+
export const Basic: StoryFn<ProfileProps> = ProfileTemplate.bind({});
|
|
41
|
+
|
|
42
|
+
export const HasAll: StoryFn<ProfileProps> = ProfileTemplate.bind({});
|
|
43
|
+
|
|
44
|
+
export const HasDescription: StoryFn<ProfileProps> = ProfileTemplate.bind({});
|
|
45
|
+
|
|
46
|
+
export const HasLink: StoryFn<ProfileProps> = ProfileTemplate.bind({});
|
|
47
|
+
|
|
48
|
+
export const HasRole: StoryFn<ProfileProps> = ProfileTemplate.bind({});
|
|
49
|
+
|
|
50
|
+
// enumerate the props for the variations on the Profile component
|
|
51
|
+
Basic.args = profileArgs.basic;
|
|
52
|
+
Basic.storyName = "Basic";
|
|
53
|
+
|
|
54
|
+
HasAll.args = profileArgs.hasall;
|
|
55
|
+
HasAll.storyName = "Detailed";
|
|
56
|
+
|
|
57
|
+
HasDescription.args = profileArgs.hasdescription;
|
|
58
|
+
HasDescription.storyName = "Description";
|
|
59
|
+
|
|
60
|
+
HasLink.args = profileArgs.haslink;
|
|
61
|
+
HasLink.storyName = "Link";
|
|
62
|
+
|
|
63
|
+
HasRole.args = profileArgs.hasrole;
|
|
64
|
+
HasRole.storyName = "Role";
|