@codecademy/styleguide 78.5.6-alpha.a75de2.0 → 78.5.6-alpha.d3472d.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/CHANGELOG.md +1 -1
- package/package.json +2 -2
- package/src/lib/Atoms/FormElements/FormGroup/FormGroup.mdx +0 -6
- package/src/lib/Atoms/FormElements/FormGroup/FormGroup.stories.tsx +0 -11
- package/src/lib/Molecules/Tips/InfoTip/InfoTip.mdx +8 -24
- package/src/lib/Molecules/Tips/InfoTip/InfoTip.stories.tsx +34 -86
- package/src/lib/Organisms/BarChart/BarChart.mdx +455 -0
- package/src/lib/Organisms/BarChart/BarChart.stories.tsx +296 -0
- package/src/lib/Organisms/ConnectedForm/ConnectedFormGroup/ConnectedFormGroup.mdx +0 -20
- package/src/lib/Organisms/ConnectedForm/ConnectedFormGroup/ConnectedFormGroup.stories.tsx +0 -84
- package/src/lib/Organisms/GridForm/Fields.mdx +0 -20
- package/src/lib/Organisms/GridForm/Fields.stories.tsx +1 -73
- package/src/lib/Organisms/GridForm/Layout.mdx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
### [78.5.6-alpha.
|
|
6
|
+
### [78.5.6-alpha.d3472d.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@78.5.5...@codecademy/styleguide@78.5.6-alpha.d3472d.0) (2026-01-23)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @codecademy/styleguide
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/styleguide",
|
|
3
3
|
"description": "Styleguide & Component library for codecademy.com",
|
|
4
|
-
"version": "78.5.6-alpha.
|
|
4
|
+
"version": "78.5.6-alpha.d3472d.0",
|
|
5
5
|
"author": "Codecademy Engineering",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
10
10
|
"repository": "git@github.com:Codecademy/gamut.git",
|
|
11
|
-
"gitHead": "
|
|
11
|
+
"gitHead": "05ae7677a91ab165f0feb40a8b984397e27f26be"
|
|
12
12
|
}
|
|
@@ -69,12 +69,6 @@ A field can include <LinkTo id="Molecules/Tips/InfoTip"> our existing `InfoTip`<
|
|
|
69
69
|
|
|
70
70
|
<Canvas of={FormGroupStories.HighEmphasisInfoTip} />
|
|
71
71
|
|
|
72
|
-
#### Accessibility
|
|
73
|
-
|
|
74
|
-
InfoTip buttons are automatically labelled by string field labels for accessibility.
|
|
75
|
-
|
|
76
|
-
<Canvas of={FormGroupStories.InfoTipAutoLabelling} />
|
|
77
|
-
|
|
78
72
|
## Playground
|
|
79
73
|
|
|
80
74
|
<Canvas sourceState="shown" of={FormGroupStories.Default} />
|
|
@@ -97,14 +97,3 @@ export const HighEmphasisInfoTip: Story = {
|
|
|
97
97
|
children: <Input />,
|
|
98
98
|
},
|
|
99
99
|
};
|
|
100
|
-
|
|
101
|
-
export const InfoTipAutoLabelling: Story = {
|
|
102
|
-
args: {
|
|
103
|
-
label: 'Email address',
|
|
104
|
-
htmlFor: 'auto-label-input',
|
|
105
|
-
infotip: {
|
|
106
|
-
info: 'We will never share your email with third parties.',
|
|
107
|
-
},
|
|
108
|
-
children: <Input htmlFor="auto-label-input" type="email" />,
|
|
109
|
-
},
|
|
110
|
-
};
|
|
@@ -28,7 +28,8 @@ export const parameters = {
|
|
|
28
28
|
A tip is triggered by clicking on an information icon button and can be closed by clicking outside, pressing <KeyboardKey>Esc</KeyboardKey>, or clicking the info button again.
|
|
29
29
|
|
|
30
30
|
Use an infotip to provide additional info about a nearby element or content.
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
Infotip consists of an icon button and the .tip-bg subcomponent. The info button has low and high emphasis variants and the `.tip` has 4 alignment variants.
|
|
32
33
|
|
|
33
34
|
## Variants
|
|
34
35
|
|
|
@@ -56,19 +57,17 @@ This `floating` variant should only be used as needed.
|
|
|
56
57
|
|
|
57
58
|
### InfoTips with links or buttons
|
|
58
59
|
|
|
59
|
-
Links or buttons within InfoTips should be used sparingly and only when the information is critical to the user's understanding of the content.
|
|
60
|
+
Links or buttons within InfoTips should be used sparingly and only when the information is critical to the user's understanding of the content. If an infotip _absolutely requires_ a link or button, it needs to provide a programmatic focus by way of the `onClick` prop. The `onClick` prop accepts a function that can accept an `{isTipHidden}` argument and using that you can set programmatic focus as needed.
|
|
60
61
|
|
|
61
62
|
<Canvas of={InfoTipStories.WithLinksOrButtons} />
|
|
62
63
|
|
|
63
|
-
###
|
|
64
|
+
### Floating placement
|
|
64
65
|
|
|
65
|
-
InfoTips
|
|
66
|
+
When using `placement="floating"`, InfoTips implements focus management for easier navigation:
|
|
66
67
|
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
- **<KeyboardKey>
|
|
70
|
-
- **<KeyboardKey>Tab</KeyboardKey> or <KeyboardKey>Shift</KeyboardKey> +<KeyboardKey>Tab</KeyboardKey> (Inline)**: Follows normal document flow
|
|
71
|
-
- **<KeyboardKey>Escape</KeyboardKey>**: Closes the tip and returns focus to the InfoTip button
|
|
68
|
+
- **<KeyboardKey>Tab</KeyboardKey>**: Navigate forward through focusable elements (links, buttons) inside the tip. When reaching the last element, wraps back to the InfoTip button for convenience
|
|
69
|
+
- **<KeyboardKey>Shift</KeyboardKey>+<KeyboardKey>Tab</KeyboardKey>**: Navigate backward naturally through the page
|
|
70
|
+
- **<KeyboardKey>Esc</KeyboardKey>**: Closes the tip and returns focus to the InfoTip button
|
|
72
71
|
|
|
73
72
|
<Canvas of={InfoTipStories.KeyboardNavigation} />
|
|
74
73
|
|
|
@@ -83,21 +82,6 @@ InfoTips have intelligent Escape key handling that works correctly both inside a
|
|
|
83
82
|
|
|
84
83
|
<Canvas of={InfoTipStories.InfoTipInsideModal} />
|
|
85
84
|
|
|
86
|
-
## Custom Accessible Labeling
|
|
87
|
-
|
|
88
|
-
Provide either `ariaLabel` or `ariaLabelledby` to ensure screen reader users understand the purpose of the InfoTip button.
|
|
89
|
-
|
|
90
|
-
The InfoTip button's accessible label can be customized using either prop:
|
|
91
|
-
|
|
92
|
-
- **`ariaLabel`**: Directly sets the accessible label text. Useful when you want to provide a custom label without referencing another element.
|
|
93
|
-
- **`ariaLabelledby`**: References the ID of another element to use as the label. Useful when you want the InfoTip button to be labeled by visible text elsewhere on the page. This is useful for when the `InfoTip` is beside text that contextualizes it.
|
|
94
|
-
|
|
95
|
-
### Custom Role Description
|
|
96
|
-
|
|
97
|
-
The `InfoTipButton` uses [`aria-roledescription`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-roledescription) to provide additional context to screen reader users about the button's specific purpose. This defaults to `"More information button"` but can be customized via the `ariaRoleDescription` prop for translation or other accessibility needs.
|
|
98
|
-
|
|
99
|
-
<Canvas of={InfoTipStories.AriaLabel} />
|
|
100
|
-
|
|
101
85
|
## InfoTips and zIndex
|
|
102
86
|
|
|
103
87
|
You can change the zIndex of your `InfoTip` with the zIndex property.
|
|
@@ -4,20 +4,17 @@ import {
|
|
|
4
4
|
FillButton,
|
|
5
5
|
FlexBox,
|
|
6
6
|
GridBox,
|
|
7
|
-
IconButton,
|
|
8
7
|
InfoTip,
|
|
9
8
|
Modal,
|
|
10
9
|
Text,
|
|
11
10
|
} from '@codecademy/gamut';
|
|
12
|
-
import { SparkleIcon } from '@codecademy/gamut-icons';
|
|
13
11
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
14
|
-
import { useState } from 'react';
|
|
12
|
+
import { useRef, useState } from 'react';
|
|
15
13
|
|
|
16
14
|
const meta: Meta<typeof InfoTip> = {
|
|
17
15
|
component: InfoTip,
|
|
18
16
|
args: {
|
|
19
17
|
alignment: 'top-left',
|
|
20
|
-
ariaLabel: 'More information',
|
|
21
18
|
info: `I am additional information about a nearby element or content.`,
|
|
22
19
|
},
|
|
23
20
|
};
|
|
@@ -31,10 +28,7 @@ export const Emphasis: Story = {
|
|
|
31
28
|
},
|
|
32
29
|
render: (args) => (
|
|
33
30
|
<FlexBox center m={24} py={64}>
|
|
34
|
-
<Text
|
|
35
|
-
Some text that needs info
|
|
36
|
-
</Text>
|
|
37
|
-
<InfoTip {...args} ariaLabelledby="emphasis-text" />
|
|
31
|
+
<Text mr={4}>Some text that needs info</Text> <InfoTip {...args} />
|
|
38
32
|
</FlexBox>
|
|
39
33
|
),
|
|
40
34
|
};
|
|
@@ -44,15 +38,10 @@ export const Alignments: Story = {
|
|
|
44
38
|
<GridBox gap={24} gridTemplateColumns="1fr 1fr" ml={8} py={64}>
|
|
45
39
|
{(['top-right', 'top-left', 'bottom-right', 'bottom-left'] as const).map(
|
|
46
40
|
(alignment) => {
|
|
47
|
-
const labelId = `alignment-${alignment}`;
|
|
48
41
|
return (
|
|
49
42
|
<Box key={alignment}>
|
|
50
|
-
<Text
|
|
51
|
-
<InfoTip
|
|
52
|
-
{...args}
|
|
53
|
-
alignment={alignment}
|
|
54
|
-
ariaLabelledby={labelId}
|
|
55
|
-
/>
|
|
43
|
+
<Text>{alignment}</Text>
|
|
44
|
+
<InfoTip {...args} alignment={alignment} />
|
|
56
45
|
</Box>
|
|
57
46
|
);
|
|
58
47
|
}
|
|
@@ -67,51 +56,10 @@ export const Placement: Story = {
|
|
|
67
56
|
},
|
|
68
57
|
render: (args) => (
|
|
69
58
|
<FlexBox center>
|
|
70
|
-
<Text
|
|
59
|
+
<Text mr={4}>
|
|
71
60
|
This text is in a small space and needs floating placement
|
|
72
61
|
</Text>{' '}
|
|
73
|
-
<InfoTip {...args}
|
|
74
|
-
</FlexBox>
|
|
75
|
-
),
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export const AriaLabel: Story = {
|
|
79
|
-
render: (args) => (
|
|
80
|
-
<FlexBox center column gap={24} my={48} width={1}>
|
|
81
|
-
<FlexBox alignItems="center" gap={8}>
|
|
82
|
-
<Text fontSize={16} fontWeight="bold">
|
|
83
|
-
Using ariaLabel (no visible label text):
|
|
84
|
-
</Text>
|
|
85
|
-
</FlexBox>
|
|
86
|
-
<FlexBox alignItems="center" gap={8}>
|
|
87
|
-
<IconButton
|
|
88
|
-
icon={SparkleIcon}
|
|
89
|
-
tip="This tool needs to be explained in the InfoTip"
|
|
90
|
-
tipProps={{ placement: 'floating' }}
|
|
91
|
-
onClick={() => null}
|
|
92
|
-
/>
|
|
93
|
-
<InfoTip
|
|
94
|
-
{...args}
|
|
95
|
-
ariaLabel="Learn more about this tool"
|
|
96
|
-
info="This is some helpful info about the tool represented by the IconButton"
|
|
97
|
-
/>
|
|
98
|
-
</FlexBox>
|
|
99
|
-
|
|
100
|
-
<FlexBox alignItems="center" gap={8}>
|
|
101
|
-
<Text fontSize={16} fontWeight="bold">
|
|
102
|
-
Using ariaLabelledby (references visible text):
|
|
103
|
-
</Text>
|
|
104
|
-
</FlexBox>
|
|
105
|
-
<FlexBox alignItems="center" gap={8}>
|
|
106
|
-
<Text id="custom-info-id">
|
|
107
|
-
I am some helpful yet concise text that needs more explanation
|
|
108
|
-
</Text>
|
|
109
|
-
<InfoTip
|
|
110
|
-
alignment="bottom-left"
|
|
111
|
-
ariaLabelledby="custom-info-id"
|
|
112
|
-
info="I am clarifying information related to the concise text."
|
|
113
|
-
/>
|
|
114
|
-
</FlexBox>
|
|
62
|
+
<InfoTip {...args} />
|
|
115
63
|
</FlexBox>
|
|
116
64
|
),
|
|
117
65
|
};
|
|
@@ -121,16 +69,19 @@ export const WithLinksOrButtons: Story = {
|
|
|
121
69
|
placement: 'floating',
|
|
122
70
|
},
|
|
123
71
|
render: function WithLinksOrButtons(args) {
|
|
72
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
73
|
+
|
|
74
|
+
const onClick = ({ isTipHidden }: { isTipHidden: boolean }) => {
|
|
75
|
+
if (!isTipHidden) ref.current?.focus();
|
|
76
|
+
};
|
|
77
|
+
|
|
124
78
|
return (
|
|
125
79
|
<FlexBox center py={64}>
|
|
126
|
-
<Text
|
|
127
|
-
This text is in a small space and needs info
|
|
128
|
-
</Text>{' '}
|
|
80
|
+
<Text mr={4}>This text is in a small space and needs info </Text>{' '}
|
|
129
81
|
<InfoTip
|
|
130
82
|
{...args}
|
|
131
|
-
ariaLabelledby="links-text"
|
|
132
83
|
info={
|
|
133
|
-
<Text tabIndex={-1}>
|
|
84
|
+
<Text ref={ref} tabIndex={-1}>
|
|
134
85
|
Hey! Here is a{' '}
|
|
135
86
|
<Anchor href="https://giphy.com/search/nichijou">
|
|
136
87
|
cool link
|
|
@@ -142,6 +93,7 @@ export const WithLinksOrButtons: Story = {
|
|
|
142
93
|
that is also super important.
|
|
143
94
|
</Text>
|
|
144
95
|
}
|
|
96
|
+
onClick={onClick}
|
|
145
97
|
/>
|
|
146
98
|
</FlexBox>
|
|
147
99
|
);
|
|
@@ -150,35 +102,42 @@ export const WithLinksOrButtons: Story = {
|
|
|
150
102
|
|
|
151
103
|
export const KeyboardNavigation: Story = {
|
|
152
104
|
render: function KeyboardNavigation() {
|
|
105
|
+
const floatingRef = useRef<HTMLDivElement>(null);
|
|
106
|
+
const inlineRef = useRef<HTMLDivElement>(null);
|
|
107
|
+
|
|
153
108
|
const examples = [
|
|
154
109
|
{
|
|
155
110
|
title: 'Floating Placement',
|
|
156
111
|
placement: 'floating' as const,
|
|
112
|
+
ref: floatingRef,
|
|
157
113
|
links: ['Link 1', 'Link 2', 'Link 3'],
|
|
158
114
|
},
|
|
159
115
|
{
|
|
160
116
|
title: 'Inline Placement',
|
|
161
117
|
placement: 'inline' as const,
|
|
162
118
|
alignment: 'bottom-right' as const,
|
|
119
|
+
ref: inlineRef,
|
|
163
120
|
links: ['Link A', 'Link B'],
|
|
164
121
|
},
|
|
165
122
|
];
|
|
166
123
|
|
|
167
124
|
return (
|
|
168
|
-
<FlexBox center
|
|
125
|
+
<FlexBox center column gap={24} py={64}>
|
|
169
126
|
<GridBox gap={16} gridTemplateColumns="1fr 1fr">
|
|
170
|
-
{examples.map(({ title, placement, alignment, links }) => {
|
|
171
|
-
const
|
|
127
|
+
{examples.map(({ title, placement, alignment, ref, links }) => {
|
|
128
|
+
const onClick = ({ isTipHidden }: { isTipHidden: boolean }) => {
|
|
129
|
+
if (!isTipHidden) ref.current?.focus();
|
|
130
|
+
};
|
|
131
|
+
|
|
172
132
|
return (
|
|
173
133
|
<FlexBox gap={8} key={placement}>
|
|
174
|
-
<Text fontSize={16} fontWeight="bold"
|
|
134
|
+
<Text fontSize={16} fontWeight="bold">
|
|
175
135
|
{title}
|
|
176
136
|
</Text>
|
|
177
137
|
<InfoTip
|
|
178
138
|
alignment={alignment}
|
|
179
|
-
ariaLabelledby={labelId}
|
|
180
139
|
info={
|
|
181
|
-
<Text>
|
|
140
|
+
<Text ref={ref} tabIndex={-1}>
|
|
182
141
|
{links.map((label, idx) => (
|
|
183
142
|
<>
|
|
184
143
|
{idx > 0 && ', '}
|
|
@@ -191,6 +150,7 @@ export const KeyboardNavigation: Story = {
|
|
|
191
150
|
</Text>
|
|
192
151
|
}
|
|
193
152
|
placement={placement}
|
|
153
|
+
onClick={onClick}
|
|
194
154
|
/>
|
|
195
155
|
</FlexBox>
|
|
196
156
|
);
|
|
@@ -202,10 +162,6 @@ export const KeyboardNavigation: Story = {
|
|
|
202
162
|
Keyboard Navigation:
|
|
203
163
|
</Text>
|
|
204
164
|
<Box as="ul" fontSize={14} pl={16}>
|
|
205
|
-
<li>
|
|
206
|
-
<strong>Opening:</strong> Focus automatically moves to the tip
|
|
207
|
-
content when opened
|
|
208
|
-
</li>
|
|
209
165
|
<li>
|
|
210
166
|
<strong>Floating - Tab:</strong> Navigates forward through links,
|
|
211
167
|
then wraps to button (contained)
|
|
@@ -268,10 +224,8 @@ export const InfoTipInsideModal: Story = {
|
|
|
268
224
|
<Text>This modal contains an InfoTip below:</Text>
|
|
269
225
|
|
|
270
226
|
<FlexBox alignItems="center" gap={8}>
|
|
271
|
-
<Text
|
|
272
|
-
|
|
273
|
-
</Text>
|
|
274
|
-
<InfoTip {...args} ariaLabelledby="modal-infotip-text" />
|
|
227
|
+
<Text>Some text that needs explanation</Text>
|
|
228
|
+
<InfoTip {...args} />
|
|
275
229
|
</FlexBox>
|
|
276
230
|
|
|
277
231
|
<Text color="text-disabled" fontSize={14}>
|
|
@@ -299,14 +253,11 @@ export const ZIndex: Story = {
|
|
|
299
253
|
<Box bg="paleBlue" zIndex={3}>
|
|
300
254
|
I will not be behind the infotip, sad + unreadable
|
|
301
255
|
</Box>
|
|
302
|
-
<InfoTip
|
|
303
|
-
ariaLabel="z-index example without override"
|
|
304
|
-
info="I am inline, cool"
|
|
305
|
-
/>
|
|
256
|
+
<InfoTip info="I am inline, cool" />
|
|
306
257
|
<Box bg="paleBlue" zIndex={3}>
|
|
307
258
|
I will be behind the infotip, nice + great
|
|
308
259
|
</Box>
|
|
309
|
-
<InfoTip {...args}
|
|
260
|
+
<InfoTip {...args} />
|
|
310
261
|
</FlexBox>
|
|
311
262
|
),
|
|
312
263
|
};
|
|
@@ -314,10 +265,7 @@ export const ZIndex: Story = {
|
|
|
314
265
|
export const Default: Story = {
|
|
315
266
|
render: (args) => (
|
|
316
267
|
<FlexBox center m={24} py={64}>
|
|
317
|
-
<Text
|
|
318
|
-
Some text that needs info
|
|
319
|
-
</Text>
|
|
320
|
-
<InfoTip {...args} ariaLabelledby="default-text" />
|
|
268
|
+
<Text mr={4}>Some text that needs info</Text> <InfoTip {...args} />
|
|
321
269
|
</FlexBox>
|
|
322
270
|
),
|
|
323
271
|
};
|
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
import { Canvas, Controls, Meta } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Callout,
|
|
5
|
+
ComponentHeader,
|
|
6
|
+
ImageWrapper,
|
|
7
|
+
LinkTo,
|
|
8
|
+
} from '~styleguide/blocks';
|
|
9
|
+
|
|
10
|
+
import * as BarChartStories from './BarChart.stories';
|
|
11
|
+
|
|
12
|
+
export const parameters = {
|
|
13
|
+
title: 'BarChart',
|
|
14
|
+
subtitle: `A horizontal bar chart for visualizing comparative data`,
|
|
15
|
+
design: {
|
|
16
|
+
type: 'figma',
|
|
17
|
+
url: 'https://www.figma.com/design/ReGfRNillGABAj5SlITalN/%F0%9F%93%90-Gamut?node-id=55123-4176',
|
|
18
|
+
},
|
|
19
|
+
status: 'updating',
|
|
20
|
+
source: {
|
|
21
|
+
repo: 'gamut',
|
|
22
|
+
githubLink:
|
|
23
|
+
'https://github.com/Codecademy/gamut/blob/main/packages/gamut/src/BarChart',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
<Meta of={BarChartStories} />
|
|
28
|
+
|
|
29
|
+
<ComponentHeader {...parameters} />
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
Use BarChart to display comparative data across categories, such as skills progress, XP earned, or any quantitative metrics that benefit from visual comparison.
|
|
34
|
+
|
|
35
|
+
### Best practices:
|
|
36
|
+
|
|
37
|
+
- Use consistent units across all bars in a chart
|
|
38
|
+
- Limit the number of bars to maintain readability (5-10 is optimal)
|
|
39
|
+
- Consider using the stacked variant to show progress toward a goal
|
|
40
|
+
- Sort bars by value (descending) when ranking is important
|
|
41
|
+
- Ensure bar colors maintain at least a 3:1 contrast ratio with the background
|
|
42
|
+
|
|
43
|
+
### When NOT to use:
|
|
44
|
+
|
|
45
|
+
- **Progress tracking** – for displaying the completion status of a task, use the <LinkTo id="Atoms/ProgressBar">ProgressBar</LinkTo> component.
|
|
46
|
+
|
|
47
|
+
## Anatomy
|
|
48
|
+
|
|
49
|
+
<ImageWrapper
|
|
50
|
+
src="./organisms/barchart.png"
|
|
51
|
+
alt="The anatomy of the BarChart component, detailed below."
|
|
52
|
+
/>
|
|
53
|
+
|
|
54
|
+
1. **Bar row**
|
|
55
|
+
|
|
56
|
+
- Represents a single category and its values.
|
|
57
|
+
|
|
58
|
+
2. **Category icon** (optional)
|
|
59
|
+
|
|
60
|
+
- Use to clarify or reinforce the category name.
|
|
61
|
+
|
|
62
|
+
3. **Category label**
|
|
63
|
+
|
|
64
|
+
- Displays gridlines and labels to indicate the scale of the data values.
|
|
65
|
+
- The number of dividers, as well as the minimum and maximum values on the value axis, are adjustable.
|
|
66
|
+
- The minimum value should always be 0.
|
|
67
|
+
|
|
68
|
+
4. **Series one value**
|
|
69
|
+
|
|
70
|
+
- Displays the numerical value of the series one bar for clarity and precise data representation.
|
|
71
|
+
|
|
72
|
+
5. **Series two value** (optional)
|
|
73
|
+
|
|
74
|
+
- Displays the numerical value of the series two bar for clarity and precise data representation.
|
|
75
|
+
- Include a second series value by using the stacked property. Stacked bar charts compare parts of a whole and are best suited for displaying discrete data segmented into meaningful categories.
|
|
76
|
+
|
|
77
|
+
6. ** Series one bar**
|
|
78
|
+
|
|
79
|
+
- A visual representation of the first value for the associated category.
|
|
80
|
+
- By default, the first series bars use the text color, however, it can be overridden to any color.
|
|
81
|
+
- Bars include a required border that uses white or navy, chosen automatically to ensure the highest contrast with the bar color.
|
|
82
|
+
|
|
83
|
+
8. **Series two bar** _(bars with zero value)_
|
|
84
|
+
|
|
85
|
+
- A visual representation of the second value for the associated category.
|
|
86
|
+
- By default, the second series bars use the primary color, however, it can be overridden to any color.
|
|
87
|
+
- Bars include a required border that uses white or navy, chosen automatically to ensure the highest contrast with the bar color.
|
|
88
|
+
- Bars include a required border that uses white or navy, chosen automatically to ensure the highest contrast with the bar color.
|
|
89
|
+
|
|
90
|
+
## Variants
|
|
91
|
+
|
|
92
|
+
### Simple (Non-stacked)
|
|
93
|
+
|
|
94
|
+
Use the simple variant when showing single values per category. Only `seriesOneValue` is provided.
|
|
95
|
+
|
|
96
|
+
<Canvas of={BarChartStories.Default} />
|
|
97
|
+
|
|
98
|
+
### Stacked
|
|
99
|
+
|
|
100
|
+
Use the stacked variant when showing progress within a total. Provide both `seriesOneValue` (progress) and `seriesTwoValue` (total).
|
|
101
|
+
|
|
102
|
+
<Canvas of={BarChartStories.Stacked} />
|
|
103
|
+
|
|
104
|
+
### With Icons
|
|
105
|
+
|
|
106
|
+
Add icons to labels for better visual identification of categories.
|
|
107
|
+
|
|
108
|
+
<Canvas of={BarChartStories.WithIcons} />
|
|
109
|
+
|
|
110
|
+
### Animated
|
|
111
|
+
|
|
112
|
+
Enable entrance animations for a more engaging experience.
|
|
113
|
+
|
|
114
|
+
<Canvas of={BarChartStories.Animated} />
|
|
115
|
+
|
|
116
|
+
### Interactive
|
|
117
|
+
|
|
118
|
+
Rows can be made interactive with `onClick` handlers or `href` links.
|
|
119
|
+
|
|
120
|
+
<Canvas of={BarChartStories.Interactive} />
|
|
121
|
+
|
|
122
|
+
### Sorting
|
|
123
|
+
|
|
124
|
+
BarChart includes an optional sorting dropdown in the title area. The dropdown only renders when the `sortFns` prop is provided. You can control which sort options appear by including string literals or custom sort functions in the array.
|
|
125
|
+
|
|
126
|
+
**String Literals:**
|
|
127
|
+
|
|
128
|
+
- `'alphabetically'` - Adds both "Label (A-Z)" and "Label (Z-A)" options
|
|
129
|
+
- `'numerically'` - Adds both "Value (Low-High)" and "Value (High-Low)" options
|
|
130
|
+
- `'none'` - Adds "None" option (preserves original order)
|
|
131
|
+
|
|
132
|
+
**Custom Sort Functions:**
|
|
133
|
+
You can also provide custom sort functions as objects with:
|
|
134
|
+
|
|
135
|
+
- `label`: The text displayed in the dropdown
|
|
136
|
+
- `value`: A unique identifier for the sort option
|
|
137
|
+
- `sortFn`: A function that takes an array of bars and returns a sorted array
|
|
138
|
+
|
|
139
|
+
**Type Definition:**
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
type CustomSortOption<TBar extends BarProps = BarProps> = {
|
|
143
|
+
label: string;
|
|
144
|
+
value: string;
|
|
145
|
+
sortFn: (bars: TBar[]) => TBar[];
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// sortFns prop accepts:
|
|
149
|
+
sortFns?: ('alphabetically' | 'numerically' | 'none' | CustomSortOption<TBar>)[]
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Automatic Type Inference:**
|
|
153
|
+
TypeScript automatically infers the bar type from your `barValues` prop. This means custom properties (like `dateAdded`, `category`, etc.) are automatically typed in your sort functions - no type assertions needed!
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
const barsWithDates = [
|
|
157
|
+
{ yLabel: 'Python', seriesOneValue: 1500, dateAdded: new Date('2023-01-15') },
|
|
158
|
+
{
|
|
159
|
+
yLabel: 'JavaScript',
|
|
160
|
+
seriesOneValue: 2000,
|
|
161
|
+
dateAdded: new Date('2023-03-20'),
|
|
162
|
+
},
|
|
163
|
+
// ...
|
|
164
|
+
];
|
|
165
|
+
|
|
166
|
+
<BarChart
|
|
167
|
+
barValues={barsWithDates}
|
|
168
|
+
sortFns={[
|
|
169
|
+
{
|
|
170
|
+
label: 'Recently Added',
|
|
171
|
+
value: 'recent',
|
|
172
|
+
sortFn: (bars) => {
|
|
173
|
+
// TypeScript automatically knows bars have dateAdded property!
|
|
174
|
+
return [...bars].sort((a, b) => {
|
|
175
|
+
const aDate = a.dateAdded as Date | undefined;
|
|
176
|
+
const bDate = b.dateAdded as Date | undefined;
|
|
177
|
+
if (!aDate || !bDate) return 0;
|
|
178
|
+
return bDate.getTime() - aDate.getTime();
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
]}
|
|
183
|
+
/>;
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Note:** Since `BarProps` uses `Record<string, unknown>` for extensibility, custom properties are typed as `unknown` by default. You may need a simple type assertion (`as Date | undefined`) when accessing them, but the property names are fully type-checked.
|
|
187
|
+
|
|
188
|
+
<Canvas of={BarChartStories.WithSorting} />
|
|
189
|
+
|
|
190
|
+
**Example with Custom Sort Functions:**
|
|
191
|
+
|
|
192
|
+
Custom sort functions can access additional properties on `BarProps` for domain-specific sorting, such as sorting by dates or categories.
|
|
193
|
+
|
|
194
|
+
<Canvas of={BarChartStories.WithCustomSorting} />
|
|
195
|
+
|
|
196
|
+
When a bar has an `onClick` handler or `href` link, an `aria-label` is automatically generated from the bar's data and applied to the button or link element. The label summarizes the bar's values (e.g., "100 XP in Python" for a simple bar, or "200 XP gained - now at 1500 XP in Python" for a stacked bar).
|
|
197
|
+
|
|
198
|
+
This ensures that screen reader users receive a clear, data-driven description when interacting with bars, without requiring manual `aria-label` props.
|
|
199
|
+
|
|
200
|
+
<Canvas of={BarChartStories.WithLinks} />
|
|
201
|
+
|
|
202
|
+
## Interactive states
|
|
203
|
+
|
|
204
|
+
BarChart supports both interactive and static bar rows, each with distinct visual states.
|
|
205
|
+
|
|
206
|
+
### Static bars
|
|
207
|
+
|
|
208
|
+
When bars have neither `onClick` handlers nor `href` links, they are rendered as static, non-interactive elements.
|
|
209
|
+
|
|
210
|
+
<Canvas of={BarChartStories.Default} />
|
|
211
|
+
|
|
212
|
+
### Interactive bars
|
|
213
|
+
|
|
214
|
+
When bars have `onClick` handlers or `href` links, they become interactive. Interactive bars are rendered as buttons or anchor elements, providing full keyboard accessibility and proper semantic HTML.
|
|
215
|
+
|
|
216
|
+
<Canvas of={BarChartStories.Interactive} />
|
|
217
|
+
|
|
218
|
+
## Color modes
|
|
219
|
+
|
|
220
|
+
BarChart automatically adapts to both light and dark color modes, ensuring proper contrast and readability in all themes. The component uses semantic color tokens that adjust based on the current color mode. The `styleConfig` prop should be provided by semantic color tokens to ensure the `BarChart` is accessible in all color modes.
|
|
221
|
+
|
|
222
|
+
## Custom styling
|
|
223
|
+
|
|
224
|
+
BarChart supports custom color styling through the `styleConfig` prop, allowing you to customize the appearance of chart elements to match your design needs.
|
|
225
|
+
|
|
226
|
+
### Style configuration options
|
|
227
|
+
|
|
228
|
+
The `styleConfig` prop accepts an object with the following optional properties:
|
|
229
|
+
|
|
230
|
+
- **`textColor`**: Color for text labels (y-axis labels). Defaults to `'text'`
|
|
231
|
+
- **`foregroundBarColor`**: Color for the foreground/progress bar (used in stacked charts for `seriesOneValue`). Defaults to `'feedback-warning'`
|
|
232
|
+
- **`backgroundBarColor`**: Color for the background/total bar (used for `seriesTwoValue` in stacked charts, or `seriesOneValue` in simple charts). Defaults to `'background-primary'`
|
|
233
|
+
- **`seriesOneLabel`**: Color for the series one value label (first right label when stacked, or displayValue when not stacked). Defaults to `'text-secondary'`
|
|
234
|
+
- **`seriesTwoLabel`**: Color for the series two value label (displayValue when stacked). Defaults to `'primary'`
|
|
235
|
+
|
|
236
|
+
All color values should be valid color tokens from the Gamut design system. When customizing colors, ensure they maintain at least a 3:1 contrast ratio with the background for accessibility.
|
|
237
|
+
|
|
238
|
+
### Default values
|
|
239
|
+
|
|
240
|
+
If `styleConfig` is not provided, BarChart uses these default colors:
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
{
|
|
244
|
+
textColor: 'text',
|
|
245
|
+
foregroundBarColor: 'feedback-warning',
|
|
246
|
+
backgroundBarColor: 'background-primary',
|
|
247
|
+
seriesOneLabel: 'text-secondary',
|
|
248
|
+
seriesTwoLabel: 'primary',
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Example
|
|
253
|
+
|
|
254
|
+
<Canvas of={BarChartStories.CustomStyles} />
|
|
255
|
+
|
|
256
|
+
## Custom scale
|
|
257
|
+
|
|
258
|
+
BarChart allows you to customize the x-axis scale interval using the `xScale` prop, which controls the spacing and granularity of scale markers along the horizontal axis.
|
|
259
|
+
|
|
260
|
+
### Scale configuration
|
|
261
|
+
|
|
262
|
+
The `xScale` prop determines the interval between scale markers on the x-axis. By default, BarChart automatically calculates an appropriate scale interval based on the `minRange` and `maxRange` values. However, you can override this with a custom interval to achieve more granular or specific scale markings.
|
|
263
|
+
|
|
264
|
+
**When to use custom scale:**
|
|
265
|
+
|
|
266
|
+
- When you need specific scale intervals (e.g., increments of 250, 500, or 1000)
|
|
267
|
+
- When the automatic scale calculation doesn't provide the desired granularity
|
|
268
|
+
- When you want to match scale intervals across multiple charts for consistency
|
|
269
|
+
- When you need scale markers at specific values for better data interpretation
|
|
270
|
+
|
|
271
|
+
**How it works:**
|
|
272
|
+
|
|
273
|
+
The `xScale` value represents the interval between consecutive scale markers. For example:
|
|
274
|
+
|
|
275
|
+
- `xScale: 250` creates markers at 0, 250, 500, 750, 1000, etc.
|
|
276
|
+
- `xScale: 500` creates markers at 0, 500, 1000, 1500, 2000, etc.
|
|
277
|
+
|
|
278
|
+
The number of tick marks is automatically calculated as: `Math.ceil((maxRange - minRange) / xScale) + 1`
|
|
279
|
+
|
|
280
|
+
### Example
|
|
281
|
+
|
|
282
|
+
<Canvas of={BarChartStories.CustomScale} />
|
|
283
|
+
|
|
284
|
+
## Accessibility considerations
|
|
285
|
+
|
|
286
|
+
### Chart and row labeling
|
|
287
|
+
|
|
288
|
+
**Chart-level labeling:**
|
|
289
|
+
|
|
290
|
+
- Always provide either `title` or `aria-labelledby` to describe the chart (see Title and description section below for details)
|
|
291
|
+
- The chart is wrapped in a semantic `<figure>` element for proper structure
|
|
292
|
+
|
|
293
|
+
**Row-level labeling:**
|
|
294
|
+
|
|
295
|
+
- For non-interactive bars: A hidden text element (visible only to screen readers) is automatically added as the first child of each list item, summarizing the bar's values (e.g., "100 XP in Python")
|
|
296
|
+
- For interactive bars (with `onClick` or `href`): An `aria-label` is automatically generated from the bar's data and applied to the button or link element, ensuring proper screen reader announcements
|
|
297
|
+
- All accessibility labels are automatically generated from the bar's data - no manual `aria-label` props are required
|
|
298
|
+
|
|
299
|
+
## UX writing
|
|
300
|
+
|
|
301
|
+
- Keep y-axis labels concise (1-3 words)
|
|
302
|
+
- Use consistent unit labels (e.g., "XP", "hours", "points")
|
|
303
|
+
- Consider locale-aware number formatting for international audiences
|
|
304
|
+
|
|
305
|
+
### Title and description
|
|
306
|
+
|
|
307
|
+
The BarChart component uses semantic HTML to provide context and accessibility. The chart is wrapped in a [`<figure>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figure) element, and the description is displayed in a [`<figcaption>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figcaption) element. This semantic structure helps screen readers and other assistive technologies understand the relationship between the chart and its description. **Visual title + description is the greatly preferred pattern** for accessibility and user experience.
|
|
308
|
+
|
|
309
|
+
**Preferred pattern: Visual title + description**
|
|
310
|
+
|
|
311
|
+
Provide both `title` and `description` props to make the chart's purpose and key takeaways clear to all users:
|
|
312
|
+
|
|
313
|
+
- `title`: A heading that identifies the chart. Can be a string or an object with `{ as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6', title: string, variant?: Text['variant'] }` to specify the heading level and optionally override the default styling with a <LinkTo id="Typography/Text">Text variant</LinkTo>.
|
|
314
|
+
- `description`: A summary of the information or the overall takeaway displayed in the `<figcaption>` element.
|
|
315
|
+
|
|
316
|
+
<Canvas of={BarChartStories.WithVisualTitleAndDescription} />
|
|
317
|
+
|
|
318
|
+
**Alternative patterns:**
|
|
319
|
+
`hideTitle` and `hideDescription` will keep the screenreader text but hide the visual descriptions.
|
|
320
|
+
|
|
321
|
+
<Canvas of={BarChartStories.WithHiddenTitleAndDescription} />
|
|
322
|
+
|
|
323
|
+
- **External title with visual description**: Use `aria-labelledby` for the title but show the description visually when the title exists elsewhere but you want to display the description.
|
|
324
|
+
|
|
325
|
+
<Canvas of={BarChartStories.WithExternalTitle} />
|
|
326
|
+
|
|
327
|
+
**Best practices:**
|
|
328
|
+
|
|
329
|
+
- Always provide a `description` prop - it's required and should summarize the chart's key information
|
|
330
|
+
- Use semantic heading levels for titles (h1-h6) to maintain proper document structure
|
|
331
|
+
- When using `aria-labelledby`, ensure the referenced element exists and is properly labeled
|
|
332
|
+
|
|
333
|
+
## Playground
|
|
334
|
+
|
|
335
|
+
<Canvas sourceState="shown" of={BarChartStories.Default} />
|
|
336
|
+
|
|
337
|
+
<Controls />
|
|
338
|
+
|
|
339
|
+
## Internationalization
|
|
340
|
+
|
|
341
|
+
<Callout text="We are currently updating global internationalization in Gamut, so the following features are subject to change." />
|
|
342
|
+
|
|
343
|
+
BarChart supports internationalization through the `translations` prop, which allows you to customize all user-facing strings and configure locale-aware number formatting.
|
|
344
|
+
|
|
345
|
+
**Translation Structure:**
|
|
346
|
+
|
|
347
|
+
```typescript
|
|
348
|
+
type BarChartTranslations = {
|
|
349
|
+
sortLabel: string;
|
|
350
|
+
sortOptions: {
|
|
351
|
+
none: string;
|
|
352
|
+
labelAsc: string;
|
|
353
|
+
labelDesc: string;
|
|
354
|
+
valueAsc: string;
|
|
355
|
+
valueDesc: string;
|
|
356
|
+
};
|
|
357
|
+
accessibility: {
|
|
358
|
+
gainedNowAt: string; // Template: "{value} {unit} gained - now at {value} {unit} in {label}"
|
|
359
|
+
inLabel: string; // Template: "{value} {unit} in {label}"
|
|
360
|
+
inOnly: string; // Template: "{value} {unit} in "
|
|
361
|
+
};
|
|
362
|
+
locale: string; // For Intl.NumberFormat, e.g., 'en', 'es', 'fr', 'de-DE'
|
|
363
|
+
};
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
**Basic Usage:**
|
|
367
|
+
|
|
368
|
+
The `translations` prop is optional and accepts partial translations that will be merged with the default English translations. This means you only need to provide the translations you want to override.
|
|
369
|
+
|
|
370
|
+
```tsx
|
|
371
|
+
<BarChart
|
|
372
|
+
title="Habilidades"
|
|
373
|
+
barValues={barData}
|
|
374
|
+
description="Progreso de habilidades"
|
|
375
|
+
minRange={0}
|
|
376
|
+
maxRange={200}
|
|
377
|
+
sortFns={['alphabetically', 'none']}
|
|
378
|
+
translations={{
|
|
379
|
+
sortLabel: 'Ordenar por:',
|
|
380
|
+
sortOptions: {
|
|
381
|
+
none: 'Ninguno',
|
|
382
|
+
labelAsc: 'Etiqueta (A-Z)',
|
|
383
|
+
labelDesc: 'Etiqueta (Z-A)',
|
|
384
|
+
valueAsc: 'Valor (Bajo-Alto)',
|
|
385
|
+
valueDesc: 'Valor (Alto-Bajo)',
|
|
386
|
+
},
|
|
387
|
+
locale: 'es',
|
|
388
|
+
}}
|
|
389
|
+
/>
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
**Partial Translations:**
|
|
393
|
+
|
|
394
|
+
You can provide only the translations you need to customize. All other strings will use the default English values:
|
|
395
|
+
|
|
396
|
+
```tsx
|
|
397
|
+
<BarChart
|
|
398
|
+
// ... other props
|
|
399
|
+
translations={{
|
|
400
|
+
sortLabel: 'Sort by:',
|
|
401
|
+
// sortOptions will use default English values
|
|
402
|
+
locale: 'en-GB', // Use British English number formatting
|
|
403
|
+
}}
|
|
404
|
+
/>
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
**Locale-Aware Number Formatting:**
|
|
408
|
+
|
|
409
|
+
The `locale` property controls how numbers are formatted throughout the chart using `Intl.NumberFormat`. This affects:
|
|
410
|
+
|
|
411
|
+
- Scale labels on the x-axis
|
|
412
|
+
- Value labels on bars
|
|
413
|
+
- All numeric displays
|
|
414
|
+
|
|
415
|
+
```tsx
|
|
416
|
+
// German locale (1.000 instead of 1,000)
|
|
417
|
+
<BarChart
|
|
418
|
+
// ... other props
|
|
419
|
+
translations={{
|
|
420
|
+
locale: 'de-DE',
|
|
421
|
+
}}
|
|
422
|
+
/>
|
|
423
|
+
|
|
424
|
+
// French locale
|
|
425
|
+
<BarChart
|
|
426
|
+
// ... other props
|
|
427
|
+
translations={{
|
|
428
|
+
locale: 'fr-FR',
|
|
429
|
+
}}
|
|
430
|
+
/>
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
**Accessibility Translations:**
|
|
434
|
+
|
|
435
|
+
The accessibility strings are used in automatically generated `aria-label` attributes for interactive bars and screen reader text for non-interactive bars. These should be translated to match the language of your application:
|
|
436
|
+
|
|
437
|
+
```tsx
|
|
438
|
+
<BarChart
|
|
439
|
+
// ... other props
|
|
440
|
+
translations={{
|
|
441
|
+
accessibility: {
|
|
442
|
+
gainedNowAt: 'ganado - ahora en', // Spanish: "gained - now at"
|
|
443
|
+
inLabel: 'en', // Spanish: "in"
|
|
444
|
+
inOnly: 'en ', // Spanish: "in "
|
|
445
|
+
},
|
|
446
|
+
}}
|
|
447
|
+
/>
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
**Best Practices:**
|
|
451
|
+
|
|
452
|
+
- Always provide complete translations for the language your application uses
|
|
453
|
+
- Use appropriate locale codes (e.g., `'en-US'`, `'es-ES'`, `'fr-FR'`) for number formatting
|
|
454
|
+
- Test accessibility strings with screen readers in the target language
|
|
455
|
+
- Consider creating translation objects that can be reused across multiple BarChart instances
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { BarChart, BarProps, Box } from '@codecademy/gamut';
|
|
2
|
+
import {
|
|
3
|
+
BookFlipPageIcon,
|
|
4
|
+
DataScienceIcon,
|
|
5
|
+
TerminalIcon,
|
|
6
|
+
} from '@codecademy/gamut-icons';
|
|
7
|
+
import { action } from '@storybook/addon-actions';
|
|
8
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof BarChart> = {
|
|
11
|
+
component: BarChart,
|
|
12
|
+
args: {
|
|
13
|
+
title: 'Skills experience chart',
|
|
14
|
+
description: 'Chart showing programming language experience levels',
|
|
15
|
+
minRange: 0,
|
|
16
|
+
maxRange: 2000,
|
|
17
|
+
unit: 'XP',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
22
|
+
type Story = StoryObj<typeof BarChart>;
|
|
23
|
+
|
|
24
|
+
const simpleBarData: BarProps[] = [
|
|
25
|
+
{ yLabel: 'Python', seriesOneValue: 1500 },
|
|
26
|
+
{ yLabel: 'JavaScript', seriesOneValue: 2000 },
|
|
27
|
+
{ yLabel: 'HTML/CSS', seriesOneValue: 800 },
|
|
28
|
+
{ yLabel: 'SQL', seriesOneValue: 600 },
|
|
29
|
+
{ yLabel: 'React', seriesOneValue: 450 },
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const stackedBarData: BarProps[] = [
|
|
33
|
+
{ yLabel: 'Python', seriesOneValue: 200, seriesTwoValue: 1500 },
|
|
34
|
+
{
|
|
35
|
+
yLabel: 'JavaScript',
|
|
36
|
+
icon: TerminalIcon,
|
|
37
|
+
seriesOneValue: 1800,
|
|
38
|
+
seriesTwoValue: 2000,
|
|
39
|
+
},
|
|
40
|
+
{ yLabel: 'HTML/CSS', seriesOneValue: 600, seriesTwoValue: 800 },
|
|
41
|
+
{ yLabel: 'SQL', seriesOneValue: 550, seriesTwoValue: 600 },
|
|
42
|
+
{ yLabel: 'React', seriesOneValue: 300, seriesTwoValue: 450 },
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
const barDataWithIcons: BarProps[] = [
|
|
46
|
+
{
|
|
47
|
+
yLabel: 'Python',
|
|
48
|
+
seriesOneValue: 200,
|
|
49
|
+
seriesTwoValue: 1500,
|
|
50
|
+
icon: TerminalIcon,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
yLabel: 'JavaScript',
|
|
54
|
+
seriesOneValue: 150,
|
|
55
|
+
seriesTwoValue: 2000,
|
|
56
|
+
icon: TerminalIcon,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
yLabel: 'Data Science',
|
|
60
|
+
seriesOneValue: 100,
|
|
61
|
+
seriesTwoValue: 800,
|
|
62
|
+
icon: DataScienceIcon,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
yLabel: 'Backend',
|
|
66
|
+
seriesOneValue: 50,
|
|
67
|
+
seriesTwoValue: 600,
|
|
68
|
+
icon: TerminalIcon,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
yLabel: 'Reading',
|
|
72
|
+
seriesOneValue: 75,
|
|
73
|
+
seriesTwoValue: 450,
|
|
74
|
+
icon: BookFlipPageIcon,
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
export const Default: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
barValues: simpleBarData,
|
|
81
|
+
title: 'Skills experience chart',
|
|
82
|
+
description: 'Chart showing programming language experience levels',
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const Stacked: Story = {
|
|
87
|
+
args: {
|
|
88
|
+
barValues: stackedBarData,
|
|
89
|
+
title: 'Skills progress chart',
|
|
90
|
+
description: 'Progress toward total goals for each programming language',
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const WithIcons: Story = {
|
|
95
|
+
args: {
|
|
96
|
+
barValues: barDataWithIcons,
|
|
97
|
+
title: 'Skills progress with icons',
|
|
98
|
+
description: 'Skills progress with visual icons for each category',
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const Animated: Story = {
|
|
103
|
+
args: {
|
|
104
|
+
barValues: stackedBarData,
|
|
105
|
+
animate: true,
|
|
106
|
+
title: 'Animated skills chart',
|
|
107
|
+
description: 'Animated chart showing progress with entrance animations',
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const Interactive: Story = {
|
|
112
|
+
args: {
|
|
113
|
+
barValues: simpleBarData.map((bar) => ({
|
|
114
|
+
...bar,
|
|
115
|
+
onClick: action(`Clicked ${bar.yLabel}`),
|
|
116
|
+
})),
|
|
117
|
+
title: 'Interactive skills chart',
|
|
118
|
+
description: 'Click on any row to view detailed course information',
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const WithLinks: Story = {
|
|
123
|
+
args: {
|
|
124
|
+
barValues: simpleBarData.map((bar) => ({
|
|
125
|
+
...bar,
|
|
126
|
+
href: `#${bar.yLabel.toLowerCase().replace(/\s+/g, '-')}`,
|
|
127
|
+
})),
|
|
128
|
+
title: 'Skills chart with links',
|
|
129
|
+
description: 'Each row links to its corresponding course page',
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const WithVisualTitleAndDescription: Story = {
|
|
134
|
+
args: {
|
|
135
|
+
barValues: simpleBarData,
|
|
136
|
+
title: 'Programming Skills Overview',
|
|
137
|
+
description:
|
|
138
|
+
'Experience points earned across different programming languages',
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const WithHiddenTitleAndDescription: Story = {
|
|
143
|
+
render: () => {
|
|
144
|
+
return (
|
|
145
|
+
<BarChart
|
|
146
|
+
barValues={simpleBarData}
|
|
147
|
+
description="Experience points earned across different programming languages"
|
|
148
|
+
hideDescription
|
|
149
|
+
hideTitle
|
|
150
|
+
maxRange={2000}
|
|
151
|
+
minRange={0}
|
|
152
|
+
title="Programming Skills Overview"
|
|
153
|
+
unit="XP"
|
|
154
|
+
/>
|
|
155
|
+
);
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const WithExternalTitle: Story = {
|
|
160
|
+
render: () => {
|
|
161
|
+
return (
|
|
162
|
+
<>
|
|
163
|
+
<Box
|
|
164
|
+
as="h2"
|
|
165
|
+
bg="paleBlue"
|
|
166
|
+
border={1}
|
|
167
|
+
borderRadius="lg"
|
|
168
|
+
id="external-chart-title"
|
|
169
|
+
p={16}
|
|
170
|
+
textAlign="right"
|
|
171
|
+
>
|
|
172
|
+
Programming Skills Overview
|
|
173
|
+
</Box>
|
|
174
|
+
<BarChart
|
|
175
|
+
aria-labelledby="external-title"
|
|
176
|
+
barValues={simpleBarData}
|
|
177
|
+
description="Experience points earned across different programming languages"
|
|
178
|
+
hideDescription={false}
|
|
179
|
+
maxRange={2000}
|
|
180
|
+
minRange={0}
|
|
181
|
+
unit="XP"
|
|
182
|
+
/>
|
|
183
|
+
</>
|
|
184
|
+
);
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export const WithSorting: Story = {
|
|
189
|
+
args: {
|
|
190
|
+
barValues: simpleBarData,
|
|
191
|
+
sortFns: ['alphabetically', 'numerically', 'none'],
|
|
192
|
+
title: 'Skills experience chart',
|
|
193
|
+
description: 'Use the dropdown to sort bars by different criteria',
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const customSortingBarValues = [
|
|
198
|
+
{
|
|
199
|
+
yLabel: 'Python',
|
|
200
|
+
seriesOneValue: 1500,
|
|
201
|
+
dateAdded: new Date('2023-01-15'),
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
yLabel: 'JavaScript',
|
|
205
|
+
seriesOneValue: 2000,
|
|
206
|
+
dateAdded: new Date('2023-03-20'),
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
yLabel: 'React',
|
|
210
|
+
seriesOneValue: 450,
|
|
211
|
+
dateAdded: new Date('2023-06-10'),
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
yLabel: 'TypeScript',
|
|
215
|
+
seriesOneValue: 300,
|
|
216
|
+
dateAdded: new Date('2023-08-05'),
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
yLabel: 'SQL',
|
|
220
|
+
seriesOneValue: 600,
|
|
221
|
+
dateAdded: new Date('2023-02-28'),
|
|
222
|
+
},
|
|
223
|
+
];
|
|
224
|
+
|
|
225
|
+
export const WithCustomSorting: Story = {
|
|
226
|
+
args: {
|
|
227
|
+
barValues: customSortingBarValues,
|
|
228
|
+
sortFns: [
|
|
229
|
+
'none',
|
|
230
|
+
{
|
|
231
|
+
label: 'Recently Added',
|
|
232
|
+
value: 'recent',
|
|
233
|
+
sortFn: (bars) => {
|
|
234
|
+
return [...bars].sort((a, b) => {
|
|
235
|
+
// TypeScript infers the type from barValues, so dateAdded is properly typed
|
|
236
|
+
const aDate = a.dateAdded as Date | undefined;
|
|
237
|
+
const bDate = b.dateAdded as Date | undefined;
|
|
238
|
+
if (!aDate && !bDate) return 0;
|
|
239
|
+
if (!aDate) return 1;
|
|
240
|
+
if (!bDate) return -1;
|
|
241
|
+
return bDate.getTime() - aDate.getTime();
|
|
242
|
+
});
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
label: 'Oldest First',
|
|
247
|
+
value: 'oldest',
|
|
248
|
+
sortFn: (bars) => {
|
|
249
|
+
return [...bars].sort((a, b) => {
|
|
250
|
+
// TypeScript infers the type from barValues, so dateAdded is properly typed
|
|
251
|
+
const aDate = a.dateAdded as Date | undefined;
|
|
252
|
+
const bDate = b.dateAdded as Date | undefined;
|
|
253
|
+
if (!aDate && !bDate) return 0;
|
|
254
|
+
if (!aDate) return 1;
|
|
255
|
+
if (!bDate) return -1;
|
|
256
|
+
return aDate.getTime() - bDate.getTime();
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
title: 'Skills chart with date sorting',
|
|
262
|
+
description:
|
|
263
|
+
'Custom sort functions can access additional properties on BarProps, such as dates',
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Bar chart with custom styling
|
|
269
|
+
*/
|
|
270
|
+
export const CustomStyles: Story = {
|
|
271
|
+
args: {
|
|
272
|
+
barValues: stackedBarData,
|
|
273
|
+
styleConfig: {
|
|
274
|
+
backgroundBarColor: 'text',
|
|
275
|
+
foregroundBarColor: 'primary',
|
|
276
|
+
textColor: 'primary',
|
|
277
|
+
seriesOneLabel: 'feedback-error',
|
|
278
|
+
seriesTwoLabel: 'feedback-success',
|
|
279
|
+
},
|
|
280
|
+
title: 'Custom styled skills chart',
|
|
281
|
+
description: 'Custom color scheme applied to chart elements',
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Bar chart with custom xScale interval
|
|
287
|
+
*/
|
|
288
|
+
export const CustomScale: Story = {
|
|
289
|
+
args: {
|
|
290
|
+
barValues: simpleBarData,
|
|
291
|
+
maxRange: 2000,
|
|
292
|
+
xScale: 250,
|
|
293
|
+
title: 'Skills chart with custom scale',
|
|
294
|
+
description: 'Custom scale intervals for more granular value display',
|
|
295
|
+
},
|
|
296
|
+
};
|
|
@@ -61,26 +61,6 @@ A `ConnectedFormGroup` can be in one of three states: `default`, `error`, or `di
|
|
|
61
61
|
|
|
62
62
|
<Canvas of={ConnectedFormGroupStories.States} />
|
|
63
63
|
|
|
64
|
-
## InfoTip
|
|
65
|
-
|
|
66
|
-
A `ConnectedFormGroup` can include an `infotip` prop to provide additional context.
|
|
67
|
-
|
|
68
|
-
### Automatic labelling
|
|
69
|
-
|
|
70
|
-
InfoTip buttons are automatically labelled by string field labels for accessibility.
|
|
71
|
-
|
|
72
|
-
<Canvas of={ConnectedFormGroupStories.InfoTipAutoLabelling} />
|
|
73
|
-
|
|
74
|
-
### ReactNode labels
|
|
75
|
-
|
|
76
|
-
For ReactNode labels (e.g., styled text or icons), you have three options:
|
|
77
|
-
|
|
78
|
-
- `labelledByFieldLabel: true` - opt into automatic labelling by the field label
|
|
79
|
-
- `ariaLabel` - provide a custom accessible name
|
|
80
|
-
- `ariaLabelledby` - reference another element on the page, such as a section heading
|
|
81
|
-
|
|
82
|
-
<Canvas of={ConnectedFormGroupStories.InfoTipWithReactNodeLabel} />
|
|
83
|
-
|
|
84
64
|
## Playground
|
|
85
65
|
|
|
86
66
|
To see how a `ConnectedFormGroup` can be used in a `ConnectedForm`, check out the <LinkTo id="Organisms/ConnectedForm/ConnectedForm">ConnectedForm</LinkTo> page.
|
|
@@ -2,9 +2,7 @@ import {
|
|
|
2
2
|
ConnectedForm,
|
|
3
3
|
ConnectedFormGroup,
|
|
4
4
|
ConnectedFormGroupProps,
|
|
5
|
-
ConnectedInput,
|
|
6
5
|
ConnectedRadioGroupInput,
|
|
7
|
-
Text,
|
|
8
6
|
useConnectedForm,
|
|
9
7
|
} from '@codecademy/gamut';
|
|
10
8
|
import { action } from '@storybook/addon-actions';
|
|
@@ -121,85 +119,3 @@ export const States = () => {
|
|
|
121
119
|
</ConnectedForm>
|
|
122
120
|
);
|
|
123
121
|
};
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* InfoTip buttons are automatically labelled by string field labels for accessibility.
|
|
127
|
-
* Screen readers will announce "Field Label, button" when focusing the InfoTip.
|
|
128
|
-
*/
|
|
129
|
-
export const InfoTipAutoLabelling: Story = {
|
|
130
|
-
render: () => (
|
|
131
|
-
<ConnectedForm
|
|
132
|
-
defaultValues={{ email: '' }}
|
|
133
|
-
onSubmit={(values) => action('Form Submitted')(values)}
|
|
134
|
-
>
|
|
135
|
-
<ConnectedFormGroup
|
|
136
|
-
field={{ component: ConnectedInput, type: 'email' }}
|
|
137
|
-
infotip={{
|
|
138
|
-
info: 'We will never share your email with third parties.',
|
|
139
|
-
placement: 'floating',
|
|
140
|
-
}}
|
|
141
|
-
label="Email address"
|
|
142
|
-
name="email"
|
|
143
|
-
/>
|
|
144
|
-
</ConnectedForm>
|
|
145
|
-
),
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* For ReactNode labels, you have three options for accessible InfoTip labelling:
|
|
150
|
-
* - `labelledByFieldLabel: true` - uses the field label
|
|
151
|
-
* - `ariaLabel` - provides a custom accessible name
|
|
152
|
-
* - `ariaLabelledby` - references another element on the page
|
|
153
|
-
*/
|
|
154
|
-
export const InfoTipWithReactNodeLabel: Story = {
|
|
155
|
-
render: () => (
|
|
156
|
-
<ConnectedForm
|
|
157
|
-
defaultValues={{ username: '', password: '', apiKey: '' }}
|
|
158
|
-
onSubmit={(values) => action('Form Submitted')(values)}
|
|
159
|
-
>
|
|
160
|
-
<Text as="h3" id="api-section-heading" mb={8}>
|
|
161
|
-
API Configuration
|
|
162
|
-
</Text>
|
|
163
|
-
<ConnectedFormGroup
|
|
164
|
-
field={{ component: ConnectedInput }}
|
|
165
|
-
infotip={{
|
|
166
|
-
alignment: 'bottom-left',
|
|
167
|
-
info: 'Choose a unique username between 3-20 characters.',
|
|
168
|
-
labelledByFieldLabel: true,
|
|
169
|
-
}}
|
|
170
|
-
label={
|
|
171
|
-
<Text as="span" fontWeight="bold">
|
|
172
|
-
Username (labelledByFieldLabel)
|
|
173
|
-
</Text>
|
|
174
|
-
}
|
|
175
|
-
name="username"
|
|
176
|
-
/>
|
|
177
|
-
<ConnectedFormGroup
|
|
178
|
-
field={{ component: ConnectedInput, type: 'password' }}
|
|
179
|
-
infotip={{
|
|
180
|
-
info: 'Password must be at least 8 characters with one uppercase letter and one number.',
|
|
181
|
-
ariaLabel: 'Password requirements',
|
|
182
|
-
}}
|
|
183
|
-
label={
|
|
184
|
-
<Text as="span" fontWeight="bold">
|
|
185
|
-
Password (ariaLabel)
|
|
186
|
-
</Text>
|
|
187
|
-
}
|
|
188
|
-
name="password"
|
|
189
|
-
/>
|
|
190
|
-
<ConnectedFormGroup
|
|
191
|
-
field={{ component: ConnectedInput }}
|
|
192
|
-
infotip={{
|
|
193
|
-
info: 'You can find your API key in the developer settings dashboard.',
|
|
194
|
-
ariaLabelledby: 'api-section-heading',
|
|
195
|
-
}}
|
|
196
|
-
label={
|
|
197
|
-
<Text as="span" fontWeight="bold">
|
|
198
|
-
API Key (ariaLabelledby)
|
|
199
|
-
</Text>
|
|
200
|
-
}
|
|
201
|
-
name="apiKey"
|
|
202
|
-
/>
|
|
203
|
-
</ConnectedForm>
|
|
204
|
-
),
|
|
205
|
-
};
|
|
@@ -95,23 +95,3 @@ Hidden inputs can be used to include data that users can't see or modify with th
|
|
|
95
95
|
We call it a "sweet container" so that bots do not immediately detect it as a honeypot input.
|
|
96
96
|
|
|
97
97
|
<Canvas of={FieldsStories.SweetContainer} />
|
|
98
|
-
|
|
99
|
-
## InfoTip
|
|
100
|
-
|
|
101
|
-
Any field can include an `infotip` prop to provide additional context to users.
|
|
102
|
-
|
|
103
|
-
### Automatic labelling
|
|
104
|
-
|
|
105
|
-
InfoTip buttons are automatically labelled by string field labels for accessibility.
|
|
106
|
-
|
|
107
|
-
<Canvas of={FieldsStories.InfoTipAutoLabelling} />
|
|
108
|
-
|
|
109
|
-
### ReactNode labels
|
|
110
|
-
|
|
111
|
-
For ReactNode labels, you have three options:
|
|
112
|
-
|
|
113
|
-
- `labelledByFieldLabel: true` - opt into automatic labelling by the field label
|
|
114
|
-
- `ariaLabel` - provide a custom accessible name
|
|
115
|
-
- `ariaLabelledby` - reference another element on the page, such as a section heading
|
|
116
|
-
|
|
117
|
-
<Canvas of={FieldsStories.InfoTipWithReactNodeLabel} />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormGroup, GridForm, Input
|
|
1
|
+
import { FormGroup, GridForm, Input } from '@codecademy/gamut';
|
|
2
2
|
import { action } from '@storybook/addon-actions';
|
|
3
3
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
4
|
|
|
@@ -328,75 +328,3 @@ export const SweetContainer: Story = {
|
|
|
328
328
|
],
|
|
329
329
|
},
|
|
330
330
|
};
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* InfoTip buttons are automatically labelled by string field labels for accessibility.
|
|
334
|
-
* Screen readers will announce "Field Label, button" when focusing the InfoTip.
|
|
335
|
-
*/
|
|
336
|
-
export const InfoTipAutoLabelling: Story = {
|
|
337
|
-
args: {
|
|
338
|
-
fields: [
|
|
339
|
-
{
|
|
340
|
-
label: 'Email address',
|
|
341
|
-
name: 'email',
|
|
342
|
-
size: 9,
|
|
343
|
-
type: 'email',
|
|
344
|
-
infotip: {
|
|
345
|
-
info: 'We will never share your email with third parties.',
|
|
346
|
-
placement: 'floating',
|
|
347
|
-
},
|
|
348
|
-
},
|
|
349
|
-
],
|
|
350
|
-
},
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* For ReactNode labels, you have three options for accessible InfoTip labelling:
|
|
355
|
-
* - `labelledByFieldLabel: true` - uses the field label
|
|
356
|
-
* - `ariaLabel` - provides a custom accessible name
|
|
357
|
-
* - `ariaLabelledby` - references another element on the page
|
|
358
|
-
*/
|
|
359
|
-
export const InfoTipWithReactNodeLabel: Story = {
|
|
360
|
-
render: (args) => (
|
|
361
|
-
<>
|
|
362
|
-
<Text as="h3" id="api-section-heading" mb={8}>
|
|
363
|
-
API Configuration
|
|
364
|
-
</Text>
|
|
365
|
-
<GridForm {...args} />
|
|
366
|
-
</>
|
|
367
|
-
),
|
|
368
|
-
args: {
|
|
369
|
-
fields: [
|
|
370
|
-
{
|
|
371
|
-
label: <strong>Username (labelledByFieldLabel)</strong>,
|
|
372
|
-
name: 'username',
|
|
373
|
-
size: 9,
|
|
374
|
-
type: 'text',
|
|
375
|
-
infotip: {
|
|
376
|
-
info: 'Choose a unique username between 3-20 characters.',
|
|
377
|
-
labelledByFieldLabel: true,
|
|
378
|
-
},
|
|
379
|
-
},
|
|
380
|
-
{
|
|
381
|
-
label: <strong>Password (ariaLabel)</strong>,
|
|
382
|
-
name: 'password',
|
|
383
|
-
size: 9,
|
|
384
|
-
type: 'password',
|
|
385
|
-
infotip: {
|
|
386
|
-
info: 'Password must be at least 8 characters with one uppercase letter and one number.',
|
|
387
|
-
ariaLabel: 'Password requirements',
|
|
388
|
-
},
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
label: <strong>API Key (ariaLabelledby)</strong>,
|
|
392
|
-
name: 'apiKey',
|
|
393
|
-
size: 9,
|
|
394
|
-
type: 'text',
|
|
395
|
-
infotip: {
|
|
396
|
-
info: 'You can find your API key in the developer settings dashboard.',
|
|
397
|
-
ariaLabelledby: 'api-section-heading',
|
|
398
|
-
},
|
|
399
|
-
},
|
|
400
|
-
],
|
|
401
|
-
},
|
|
402
|
-
};
|
|
@@ -34,7 +34,7 @@ Solo field form should always have their solo input be required. They should aut
|
|
|
34
34
|
|
|
35
35
|
## InfoTips
|
|
36
36
|
|
|
37
|
-
A field can include our existing `InfoTip`. See the <LinkTo id="Molecules/Tips/InfoTip">
|
|
37
|
+
A field can include our existing `InfoTip`. See the <LinkTo id="Molecules/Tips/InfoTip">InfoTip</LinkTo> story for more information on what props are available.
|
|
38
38
|
|
|
39
39
|
See the <LinkTo id="Atoms/FormInputs/Radio">Radio</LinkTo> story for an example of how to add a infotip to a radio option.
|
|
40
40
|
|