@kaizen/components 1.68.7 → 1.68.8
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/codemods/README.md +2 -1
- package/dist/cjs/__overlays__/Tooltip/v3/Tooltip.cjs +1 -1
- package/dist/esm/__overlays__/Tooltip/v3/Tooltip.mjs +1 -1
- package/dist/styles.css +62 -62
- package/dist/types/__overlays__/Tooltip/v3/Tooltip.d.ts +1 -1
- package/package.json +25 -25
- package/src/Avatar/_docs/Avatar.mdx +3 -4
- package/src/AvatarGroup/_docs/AvatarGroup.mdx +3 -3
- package/src/Badge/_docs/Badge.mdx +3 -3
- package/src/Brand/_docs/Brand.mdx +3 -4
- package/src/BrandMoment/_docs/BrandMoment.mdx +3 -3
- package/src/ButtonGroup/_docs/ButtonGroup.mdx +3 -3
- package/src/Calendar/CalendarRange/_docs/CalendarRange.mdx +3 -3
- package/src/Calendar/CalendarSingle/_docs/CalendarSingle.mdx +3 -3
- package/src/Card/_docs/Card.mdx +5 -4
- package/src/Checkbox/Checkbox/_docs/Checkbox.mdx +4 -5
- package/src/Checkbox/CheckboxField/_docs/CheckboxField.mdx +5 -3
- package/src/Checkbox/CheckboxGroup/_docs/CheckboxGroup.mdx +4 -3
- package/src/Collapsible/Collapsible/_docs/Collapsible.mdx +3 -3
- package/src/Collapsible/CollapsibleGroup/_docs/CollapsibleGroup.mdx +8 -7
- package/src/Collapsible/ExpertAdviceCollapsible/_docs/ExpertAdviceCollapsible.mdx +3 -3
- package/src/Container/_docs/Container.mdx +6 -4
- package/src/Content/_docs/Content.mdx +6 -4
- package/src/DatePicker/_docs/DatePicker.mdx +3 -3
- package/src/DateRangePicker/_docs/DateRangePicker.mdx +3 -4
- package/src/Divider/_docs/Divider.mdx +3 -3
- package/src/EmptyState/_docs/EmptyState.mdx +3 -3
- package/src/ErrorPage/_docs/ErrorPage.mdx +3 -3
- package/src/FieldGroup/_docs/FieldGroup.mdx +6 -4
- package/src/FieldMessage/_docs/FieldMessage.mdx +3 -4
- package/src/Filter/Filter/_docs/Filter.mdx +13 -14
- package/src/Filter/FilterBar/_docs/FilterBar.mdx +49 -48
- package/src/Filter/FilterButton/_docs/filter-buttons.mdx +5 -5
- package/src/Filter/FilterDatePicker/_docs/FilterDatePicker.mdx +8 -3
- package/src/Filter/FilterDateRangePicker/_docs/FilterDateRangePicker.mdx +9 -3
- package/src/Filter/FilterMultiSelect/_docs/FilterMultiSelect.mdx +90 -39
- package/src/Filter/FilterMultiSelect/subcomponents/MultiSelectOption/MultiSelectOption.spec.tsx +1 -0
- package/src/Filter/FilterSelect/_docs/FilterSelect.mdx +4 -4
- package/src/GuidanceBlock/_docs/GuidanceBlock.mdx +3 -3
- package/src/Heading/_docs/Heading.mdx +4 -4
- package/src/Icon/_docs/Icon.mdx +5 -7
- package/src/Illustration/Scene/BrandMomentCaptureIntro/_docs/BrandMomentCaptureIntro.mdx +10 -3
- package/src/Illustration/Scene/_docs/Scene.mdx +5 -8
- package/src/Illustration/Spot/_docs/Spot.mdx +4 -4
- package/src/Input/Input/_docs/Input.mdx +8 -4
- package/src/Input/InputRange/_docs/InputRange.mdx +3 -3
- package/src/Input/InputSearch/_docs/InputSearch.mdx +4 -3
- package/src/KaizenProvider/_docs/KaizenProvider.mdx +9 -9
- package/src/KaizenProvider/_docs/internationalization-in-kaizen.mdx +10 -11
- package/src/Label/_docs/Label.mdx +9 -3
- package/src/LabelledMessage/_docs/LabelledMessage.mdx +3 -3
- package/src/LikertScaleLegacy/_docs/LikertScaleLegacy.mdx +3 -3
- package/src/Loading/LoadingGraphic/_docs/LoadingGraphic.mdx +5 -5
- package/src/Loading/LoadingHeading/_docs/LoadingHeading.mdx +3 -3
- package/src/Loading/LoadingInput/_docs/LoadingInput.mdx +3 -3
- package/src/Loading/LoadingParagraph/_docs/LoadingParagraph.mdx +3 -3
- package/src/Loading/LoadingSpinner/_docs/LoadingSpinner.mdx +3 -4
- package/src/Modal/ConfirmationModal/_docs/ConfirmationModal.mdx +3 -3
- package/src/Modal/ContextModal/_docs/ContextModal.mdx +6 -3
- package/src/Modal/GenericModal/_docs/GenericModal.mdx +5 -4
- package/src/Modal/InputEditModal/_docs/InputEditModal.mdx +3 -4
- package/src/MultiSelect/_docs/MultiSelect.mdx +3 -4
- package/src/Notification/GlobalNotification/_docs/GlobalNotification.mdx +3 -3
- package/src/Notification/InlineNotification/_docs/InlineNotification.mdx +3 -4
- package/src/Notification/ToastNotification/_docs/ToastNotification.mdx +3 -3
- package/src/Pagination/_docs/Pagination.mdx +3 -3
- package/src/Pagination/subcomponents/DirectionalLink/_docs/DirectionalLink.mdx +3 -3
- package/src/Pagination/subcomponents/PaginationLink/_docs/PaginationLink.mdx +3 -3
- package/src/Popover/_docs/Popover.mdx +12 -10
- package/src/ProgressBar/_docs/ProgressBar.mdx +3 -4
- package/src/Radio/Radio/_docs/Radio.mdx +4 -4
- package/src/Radio/RadioField/_docs/RadioField.mdx +3 -3
- package/src/Radio/RadioGroup/_docs/RadioGroup.mdx +3 -3
- package/src/RichTextEditor/EditableRichTextContent/_docs/EditableRichTextContent.mdx +7 -10
- package/src/RichTextEditor/RichTextContent/_docs/RichTextContent.mdx +3 -5
- package/src/RichTextEditor/RichTextEditor/_docs/RichTextEditor.mdx +7 -9
- package/src/RichTextEditor/RichTextEditor/subcomponents/ToggleIconButton/_docs/ToggleIconButton.mdx +3 -3
- package/src/RichTextEditor/RichTextEditor/subcomponents/Toolbar/_docs/Toolbar.mdx +3 -3
- package/src/SearchField/_docs/SearchField.mdx +3 -3
- package/src/Select/_docs/Select.mdx +7 -3
- package/src/Skirt/_docs/Skirt.mdx +4 -4
- package/src/Slider/_docs/Slider.mdx +3 -3
- package/src/SplitButton/_docs/SplitButton.mdx +4 -3
- package/src/Table/_docs/Table.mdx +19 -6
- package/src/Tabs/_docs/Tabs.mdx +4 -7
- package/src/Tag/_docs/Tag.mdx +16 -5
- package/src/Text/_docs/Text.mdx +3 -3
- package/src/TextArea/_docs/TextArea.mdx +5 -4
- package/src/TextAreaField/_docs/TextAreaField.mdx +9 -4
- package/src/TextField/_docs/TextField.mdx +9 -4
- package/src/Tile/InformationTile/_docs/InformationTile.mdx +5 -4
- package/src/Tile/MultiActionTile/_docs/MultiActionTile.mdx +5 -3
- package/src/Tile/TileGrid/_docs/TileGrid.mdx +3 -3
- package/src/TimeField/_docs/TimeField.mdx +3 -3
- package/src/TitleBlockZen/_docs/TitleBlockZen.mdx +5 -3
- package/src/ToggleSwitch/ToggleSwitch/_docs/ToggleSwitch.mdx +3 -3
- package/src/ToggleSwitch/ToggleSwitchField/_docs/ToggleSwitchField.mdx +3 -3
- package/src/VisuallyHidden/_docs/VisuallyHidden.mdx +6 -4
- package/src/Well/_docs/Well.mdx +5 -5
- package/src/Workflow/_docs/ProgressStepper.mdx +3 -3
- package/src/Workflow/_docs/Workflow.mdx +25 -19
- package/src/Workflow/_docs/WorkflowFooter.mdx +3 -3
- package/src/Workflow/_docs/WorkflowHeader.mdx +3 -3
- package/src/__actions__/Button/v1/Button/_docs/Button.mdx +4 -4
- package/src/__actions__/Button/v1/IconButton/_docs/IconButton.mdx +3 -3
- package/src/__actions__/Button/v2/Button/_docs/Button.mdx +4 -4
- package/src/__actions__/Button/v2/IconButton/_docs/IconButton.mdx +3 -3
- package/src/__actions__/Button/v3/_docs/Button--api-specification.mdx +49 -17
- package/src/__actions__/Button/v3/_docs/Button--usage-guidelines.mdx +8 -6
- package/src/__actions__/Menu/v1/_docs/Menu.mdx +3 -4
- package/src/__actions__/Menu/v2/_docs/Menu.mdx +8 -4
- package/src/__actions__/Menu/v3/_docs/ApiSpecification.mdx +35 -24
- package/src/__actions__/Menu/v3/_docs/Menu.mdx +52 -39
- package/src/__future__/Icon/_docs/Icon--api-specification.mdx +17 -10
- package/src/__future__/Icon/_docs/Icon--usage-guidelines.mdx +5 -4
- package/src/__future__/Select/_docs/Select.mdx +9 -5
- package/src/__future__/Tabs/_docs/Tabs--api-specification.mdx +4 -8
- package/src/__future__/Tabs/_docs/Tabs--migration-guide.mdx +11 -4
- package/src/__future__/Tag/RemovableTag/_docs/RemovableTag.mdx +4 -6
- package/src/__future__/Tag/Tag/_docs/Tag-migration-guide.mdx +12 -20
- package/src/__future__/Tag/Tag/_docs/Tag.mdx +3 -4
- package/src/__overlays__/Focusable/v3/_docs/ApiSpecification.mdx +14 -13
- package/src/__overlays__/Tooltip/v1/_docs/Tooltip.mdx +5 -7
- package/src/__overlays__/Tooltip/v2/_docs/Tooltip.mdx +5 -6
- package/src/__overlays__/Tooltip/v3/Tooltip.tsx +3 -2
- package/src/__overlays__/Tooltip/v3/_docs/ApiSpecification.mdx +50 -46
- package/src/__overlays__/Tooltip/v3/_docs/Tooltip.mdx +63 -48
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { Canvas, Controls, Meta, Source } from
|
|
2
|
-
import { KAIOInstallation, ResourceLinks,
|
|
3
|
-
import * as docsStories from
|
|
4
|
-
import * as exampleStories from
|
|
1
|
+
import { Canvas, Controls, Meta, Source } from '@storybook/blocks'
|
|
2
|
+
import { KAIOInstallation, ResourceLinks, SbContent } from '~storybook/components'
|
|
3
|
+
import * as docsStories from './Menu.docs.stories'
|
|
4
|
+
import * as exampleStories from './Menu.stories'
|
|
5
5
|
|
|
6
|
-
<Meta title="Actions/Menu/v3/API Specification"/>
|
|
6
|
+
<Meta title="Actions/Menu/v3/API Specification" />
|
|
7
7
|
|
|
8
8
|
<SbContent>
|
|
9
9
|
# Menu API Specification (v3)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Updated July 4, 2024
|
|
12
|
+
|
|
12
13
|
</SbContent>
|
|
13
14
|
|
|
14
15
|
<ResourceLinks
|
|
@@ -23,24 +24,34 @@ import * as exampleStories from "./Menu.stories"
|
|
|
23
24
|
### Disclaimer
|
|
24
25
|
|
|
25
26
|
The `Menu` `v3` component is not backwards compatible with Kaizen `Button` `v1` and `v2`. For this reason, usage of this component is not recommended until a `Button` `v3` is released.
|
|
27
|
+
|
|
26
28
|
</div>
|
|
27
29
|
</SbContent>
|
|
28
30
|
|
|
29
31
|
<SbContent className="mb-24">
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
{' '}
|
|
34
|
+
|
|
35
|
+
<KAIOInstallation exportNames={['Menu', 'MenuTrigger', 'MenuItem']} family="actions" version="3" />
|
|
36
|
+
|
|
37
|
+
{' '}
|
|
32
38
|
|
|
33
|
-
|
|
39
|
+
<Source
|
|
40
|
+
code={'import { Popover, Section, Header } from "@kaizen/components/v3/react-aria-components"'}
|
|
41
|
+
language="tsx"
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
## Overview
|
|
34
45
|
|
|
35
|
-
|
|
46
|
+
A menu displays a list of actions in a popover, toggled opened with a button.
|
|
36
47
|
|
|
37
|
-
A menu displays a list of actions in a popover, toggled opened with a button.
|
|
38
48
|
</SbContent>
|
|
39
49
|
|
|
40
50
|
<Canvas
|
|
41
51
|
className="mb-64"
|
|
42
52
|
of={exampleStories.Basic}
|
|
43
|
-
source={{
|
|
53
|
+
source={{
|
|
54
|
+
code: `
|
|
44
55
|
<MenuTrigger>
|
|
45
56
|
<Button><Icon name="more_horiz" alt="Actions" /></Button>
|
|
46
57
|
<Popover>
|
|
@@ -50,24 +61,24 @@ import * as exampleStories from "./Menu.stories"
|
|
|
50
61
|
</Menu>
|
|
51
62
|
</Popover>
|
|
52
63
|
</MenuTrigger>
|
|
53
|
-
|
|
64
|
+
`,
|
|
65
|
+
}}
|
|
54
66
|
/>
|
|
55
67
|
|
|
56
68
|
<SbContent className="mb-64">
|
|
57
69
|
### React Aria
|
|
58
70
|
|
|
59
|
-
|
|
71
|
+
This component is built using the `react-aria-components` library and extends the [Menu component](https://react-spectrum.adobe.com/react-aria/Menu.html).
|
|
60
72
|
|
|
61
|
-
|
|
73
|
+
As this shares the same core [anatomy](https://react-spectrum.adobe.com/react-aria/Menu.html#anatomy), [props types](https://react-spectrum.adobe.com/react-aria/Menu.html#menu-1) and [functionality](https://react-spectrum.adobe.com/react-aria/Menu.html#features), the guidance below is tailored to our implementation and should cover known use cases of the Menu.
|
|
62
74
|
|
|
63
|
-
|
|
64
|
-
</SbContent>
|
|
75
|
+
More on the React Aria API and a deep dive into other examples can be found via the [React Aria docs page](https://react-spectrum.adobe.com/react-aria/Menu.html) if not present below.
|
|
65
76
|
|
|
66
|
-
<SbContent className="mb-12">
|
|
67
|
-
## API
|
|
68
77
|
</SbContent>
|
|
69
78
|
|
|
70
|
-
<
|
|
79
|
+
<SbContent className="mb-12">## API</SbContent>
|
|
80
|
+
|
|
81
|
+
<Controls of={exampleStories.Basic} />
|
|
71
82
|
|
|
72
83
|
## Actions and Next.js routing
|
|
73
84
|
|
|
@@ -76,7 +87,7 @@ Use the `href` prop when an action navigates to a new page.
|
|
|
76
87
|
|
|
77
88
|
Otherwise, use the `onAction` prop to trigger an action within the page.
|
|
78
89
|
|
|
79
|
-
<Canvas className="mb-24" of={docsStories.Actions}
|
|
90
|
+
<Canvas className="mb-24" of={docsStories.Actions} />
|
|
80
91
|
|
|
81
92
|
## Typeahead
|
|
82
93
|
|
|
@@ -84,22 +95,22 @@ Typeahead (the ability to quickly skip to an item by typing a few characters aft
|
|
|
84
95
|
|
|
85
96
|
If you're passing `ReactNode` into `MenuItem` `children`, you'll need to specify the `textValue` prop manually on `MenuItem` in order for typeahead to work.
|
|
86
97
|
|
|
87
|
-
<Canvas className="mb-24" of={exampleStories.RichContent}
|
|
98
|
+
<Canvas className="mb-24" of={exampleStories.RichContent} />
|
|
88
99
|
|
|
89
100
|
## Sections
|
|
90
101
|
|
|
91
102
|
Sections can be added with the `Section` and `Header` component from `react-aria-components`.
|
|
92
103
|
|
|
93
|
-
<Canvas className="mb-24" of={exampleStories.WithSections}
|
|
104
|
+
<Canvas className="mb-24" of={exampleStories.WithSections} />
|
|
94
105
|
|
|
95
106
|
## Disabling items
|
|
96
107
|
|
|
97
108
|
Menu items can be disabled with the `isDisabled` prop.
|
|
98
109
|
|
|
99
|
-
<Canvas className="mb-24" of={exampleStories.DisabledItems}
|
|
110
|
+
<Canvas className="mb-24" of={exampleStories.DisabledItems} />
|
|
100
111
|
|
|
101
112
|
## Controlled
|
|
102
113
|
|
|
103
114
|
By default, the open/closed state of the menu is handled under the hood. In cases where you need control over the open state, use the `isOpen` and `onOpenChange` props on the `MenuTrigger` component (both props must be used for this to work).
|
|
104
115
|
|
|
105
|
-
<Canvas className="mb-24" of={exampleStories.Controlled}
|
|
116
|
+
<Canvas className="mb-24" of={exampleStories.Controlled} />
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import { Canvas, Meta, Controls } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Canvas, Meta, Controls } from '@storybook/blocks'
|
|
2
|
+
import {
|
|
3
|
+
ResourceLinks,
|
|
4
|
+
SbContent,
|
|
5
|
+
Installation,
|
|
6
|
+
DosAndDonts,
|
|
7
|
+
DoOrDont,
|
|
8
|
+
} from '~storybook/components'
|
|
9
|
+
import * as MenuDocsStories from './Menu.docs.stories'
|
|
10
|
+
import * as MenuStories from './Menu.stories'
|
|
5
11
|
|
|
6
12
|
<Meta title="Actions/Menu/v3/Usage Guidelines" />
|
|
7
13
|
|
|
8
14
|
<SbContent>
|
|
9
15
|
# Menu (v3)
|
|
10
16
|
|
|
11
|
-
|
|
17
|
+
Updated July 6, 2024
|
|
18
|
+
|
|
12
19
|
</SbContent>
|
|
13
20
|
|
|
14
21
|
<ResourceLinks
|
|
@@ -24,14 +31,16 @@ import * as MenuStories from "./Menu.stories"
|
|
|
24
31
|
importStatement='import { MenuTrigger, Menu, MenuItem } from "@kaizen/components/v3/actions"'
|
|
25
32
|
/>
|
|
26
33
|
|
|
27
|
-
|
|
34
|
+
## Overview
|
|
35
|
+
|
|
36
|
+
A menu displays a list of actions in a popover, toggled opened with a button.
|
|
28
37
|
|
|
29
|
-
A menu displays a list of actions in a popover, toggled opened with a button.
|
|
30
38
|
</SbContent>
|
|
31
39
|
|
|
32
40
|
<Canvas
|
|
33
41
|
of={MenuStories.Playground}
|
|
34
|
-
source={{
|
|
42
|
+
source={{
|
|
43
|
+
code: `
|
|
35
44
|
<TooltipTrigger>
|
|
36
45
|
<Button>
|
|
37
46
|
<Icon name="more_horiz" alt="Additional actions" />
|
|
@@ -44,42 +53,41 @@ import * as MenuStories from "./Menu.stories"
|
|
|
44
53
|
</Menu>
|
|
45
54
|
</Popover>
|
|
46
55
|
</TooltipTrigger>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
`,
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
<Controls of={MenuStories.Playground} include={['placement', 'isOpen']} className="mb-64" />
|
|
51
60
|
|
|
52
61
|
<SbContent className="mb-64">
|
|
53
62
|
### Anatomy
|
|
54
63
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
</SbContent>
|
|
64
|
+
- A Menu is made up of:
|
|
65
|
+
- A trigger button
|
|
66
|
+
- A popover
|
|
67
|
+
- A list of menu items
|
|
68
|
+
- Menu items may be organised into sections, with a heading for each section.
|
|
69
|
+
- The menu trigger button, which may be any variation of a button.
|
|
62
70
|
|
|
71
|
+
</SbContent>
|
|
63
72
|
|
|
64
73
|
<SbContent className="mb-64">
|
|
65
74
|
### When to use
|
|
66
75
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
- Navigate somewhere
|
|
76
|
+
- When you have a group of related actions for a page or item on the page.
|
|
77
|
+
- The actions either: - Cause an action on the page (e.g. delete), or - Navigate somewhere
|
|
78
|
+
|
|
71
79
|
</SbContent>
|
|
72
80
|
|
|
73
81
|
<SbContent className="mb-64">
|
|
74
82
|
### When not to use
|
|
75
83
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
- When you want to persist a user selection.
|
|
85
|
+
- Use a Select/Multi-Select or Combobox/Multi-Combobox component instead.
|
|
86
|
+
- When you want additional elements beyond a list of menu items (e.g. a search input)
|
|
87
|
+
- Use a Modal, or construct your own pattern with a Popover.
|
|
88
|
+
- It's recommended that you avoid this because of the complexity it adds for accessibility.
|
|
89
|
+
- Inside a navigation bar - Different DOM elements and behaviour is required for a dropdown menu in a navigation bar.
|
|
90
|
+
|
|
83
91
|
</SbContent>
|
|
84
92
|
|
|
85
93
|
<div className="flex flex-col mt-16 gap-40 mb-64">
|
|
@@ -93,6 +101,7 @@ import * as MenuStories from "./Menu.stories"
|
|
|
93
101
|
<DoOrDont story={MenuDocsStories.ItemsDo} />
|
|
94
102
|
<DoOrDont story={MenuDocsStories.ItemsDont} isDont />
|
|
95
103
|
</DosAndDonts>
|
|
104
|
+
|
|
96
105
|
</div>
|
|
97
106
|
</div>
|
|
98
107
|
|
|
@@ -107,10 +116,10 @@ import * as MenuStories from "./Menu.stories"
|
|
|
107
116
|
<DosAndDonts>
|
|
108
117
|
<DoOrDont story={MenuDocsStories.SelectionDont} isDont />
|
|
109
118
|
</DosAndDonts>
|
|
119
|
+
|
|
110
120
|
</div>
|
|
111
121
|
</div>
|
|
112
122
|
|
|
113
|
-
|
|
114
123
|
<div className="flex flex-col mt-16 gap-40 mb-64">
|
|
115
124
|
<div className="flex flex-col m-0 gap-16">
|
|
116
125
|
<SbContent>
|
|
@@ -122,6 +131,7 @@ import * as MenuStories from "./Menu.stories"
|
|
|
122
131
|
<DoOrDont story={MenuDocsStories.LabelChevronDo} />
|
|
123
132
|
<DoOrDont story={MenuDocsStories.LabelChevronDont} isDont />
|
|
124
133
|
</DosAndDonts>
|
|
134
|
+
|
|
125
135
|
</div>
|
|
126
136
|
</div>
|
|
127
137
|
|
|
@@ -141,6 +151,7 @@ import * as MenuStories from "./Menu.stories"
|
|
|
141
151
|
<DoOrDont story={MenuDocsStories.LabelDo} />
|
|
142
152
|
<DoOrDont story={MenuDocsStories.LabelDont} isDont />
|
|
143
153
|
</DosAndDonts>
|
|
154
|
+
|
|
144
155
|
</div>
|
|
145
156
|
</div>
|
|
146
157
|
|
|
@@ -160,14 +171,15 @@ import * as MenuStories from "./Menu.stories"
|
|
|
160
171
|
<DoOrDont story={MenuDocsStories.ItemsDo} />
|
|
161
172
|
<DoOrDont story={MenuDocsStories.IconsDont} isDont />
|
|
162
173
|
</DosAndDonts>
|
|
174
|
+
|
|
163
175
|
</div>
|
|
164
176
|
</div>
|
|
165
177
|
|
|
166
178
|
<div className="flex flex-col mt-16 gap-40 mb-64">
|
|
167
179
|
<div className="flex flex-col m-0 gap-16">
|
|
168
180
|
<SbContent>
|
|
169
|
-
#### Don't repeat the same word in the menu item labels
|
|
170
|
-
|
|
181
|
+
#### Don't repeat the same word in the menu item labels Context may be useful in some cases,
|
|
182
|
+
but avoid adding context if it will be repeated in every menu item label.
|
|
171
183
|
</SbContent>
|
|
172
184
|
<DosAndDonts>
|
|
173
185
|
<DoOrDont story={MenuDocsStories.MenuItemLabelsDont} isDont />
|
|
@@ -178,11 +190,11 @@ import * as MenuStories from "./Menu.stories"
|
|
|
178
190
|
<div className="flex flex-col mt-16 gap-40 mb-64">
|
|
179
191
|
<div className="flex flex-col m-0 gap-16">
|
|
180
192
|
<SbContent>
|
|
181
|
-
#### Do use sentence case for menu items
|
|
182
|
-
|
|
193
|
+
#### Do use sentence case for menu items Write menu items in sentence case unless they contain
|
|
194
|
+
words that are branded terms.
|
|
183
195
|
</SbContent>
|
|
184
196
|
<DosAndDonts>
|
|
185
|
-
<DoOrDont story={MenuDocsStories.SentenceCaseDo}/>
|
|
197
|
+
<DoOrDont story={MenuDocsStories.SentenceCaseDo} />
|
|
186
198
|
<DoOrDont story={MenuDocsStories.SentenceCaseDont} isDont />
|
|
187
199
|
</DosAndDonts>
|
|
188
200
|
</div>
|
|
@@ -191,11 +203,12 @@ import * as MenuStories from "./Menu.stories"
|
|
|
191
203
|
<div className="flex flex-col mt-16 gap-40 mb-64">
|
|
192
204
|
<div className="flex flex-col m-0 gap-16">
|
|
193
205
|
<SbContent>
|
|
194
|
-
#### Don't use elipses in menu items
|
|
195
|
-
|
|
206
|
+
#### Don't use elipses in menu items Avoid using ellipses (…) in menu item names within
|
|
207
|
+
products whenever possible. An ellipsis often implies that the action for a menu item will
|
|
208
|
+
open in a new view, or that a user will be taken elsewhere.
|
|
196
209
|
</SbContent>
|
|
197
210
|
<DosAndDonts>
|
|
198
|
-
<DoOrDont story={MenuDocsStories.ElipsesDo}/>
|
|
211
|
+
<DoOrDont story={MenuDocsStories.ElipsesDo} />
|
|
199
212
|
<DoOrDont story={MenuDocsStories.ElipsesDont} isDont />
|
|
200
213
|
</DosAndDonts>
|
|
201
214
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Canvas, Meta, Controls, Story } from
|
|
2
|
-
import { ResourceLinks, KAIOInstallation } from
|
|
3
|
-
import * as IconStories from
|
|
1
|
+
import { Canvas, Meta, Controls, Story } from '@storybook/blocks'
|
|
2
|
+
import { ResourceLinks, KAIOInstallation } from '~storybook/components'
|
|
3
|
+
import * as IconStories from './Icon.docs.stories'
|
|
4
4
|
|
|
5
5
|
<Meta title="Illustrations/Icon/Icon (Future)/API Specification" />
|
|
6
6
|
|
|
@@ -20,9 +20,16 @@ Updated September 4, 2024
|
|
|
20
20
|
Add the following (CDN for the variable icon font) to your Storybook `preview-head.html` and to the `<head>` of your apps.
|
|
21
21
|
|
|
22
22
|
```html
|
|
23
|
-
<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin
|
|
24
|
-
<link
|
|
25
|
-
|
|
23
|
+
<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin />
|
|
24
|
+
<link
|
|
25
|
+
rel="preload"
|
|
26
|
+
as="style"
|
|
27
|
+
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,400,0..1,0&display=block"
|
|
28
|
+
/>
|
|
29
|
+
<link
|
|
30
|
+
rel="stylesheet"
|
|
31
|
+
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,400,0..1,0&display=block"
|
|
32
|
+
/>
|
|
26
33
|
```
|
|
27
34
|
|
|
28
35
|
## Overview
|
|
@@ -80,12 +87,12 @@ The Icon component inherits the color from its parent by default. You may also c
|
|
|
80
87
|
There are two ways to change the size of the icon:
|
|
81
88
|
|
|
82
89
|
1. (Recommended) Change the value of the `--icon-size` CSS variable (eg. in Tailwind - `[--icon-size:48]`).
|
|
83
|
-
This option will also scale the [optical size](https://m3.material.io/styles/icons/applying-icons#b41cbc01-9b49-4a44-a525-d153d1ea1425) of the icon.
|
|
84
|
-
Note that the value must be a whole number value without units.
|
|
90
|
+
This option will also scale the [optical size](https://m3.material.io/styles/icons/applying-icons#b41cbc01-9b49-4a44-a525-d153d1ea1425) of the icon.
|
|
91
|
+
Note that the value must be a whole number value without units.
|
|
85
92
|
|
|
86
93
|
2. Override the `font-size` CSS attribute (eg. in Tailwind - `text-[1em]`).
|
|
87
|
-
This option will not scale the optical size of the icon for you, so you will need to combine it with also
|
|
88
|
-
overriding the `--icon-optical-size` CSS variable (eg. in Tailwind - `[--icon-optical-size:48]`).
|
|
94
|
+
This option will not scale the optical size of the icon for you, so you will need to combine it with also
|
|
95
|
+
overriding the `--icon-optical-size` CSS variable (eg. in Tailwind - `[--icon-optical-size:48]`).
|
|
89
96
|
|
|
90
97
|
<Canvas of={IconStories.Size} />
|
|
91
98
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Canvas, Meta, Controls, Story } from
|
|
2
|
-
import { ResourceLinks, KAIOInstallation, DosAndDonts, DoOrDont } from
|
|
3
|
-
import * as IconStories from
|
|
1
|
+
import { Canvas, Meta, Controls, Story } from '@storybook/blocks'
|
|
2
|
+
import { ResourceLinks, KAIOInstallation, DosAndDonts, DoOrDont } from '~storybook/components'
|
|
3
|
+
import * as IconStories from './Icon.docs.stories'
|
|
4
4
|
|
|
5
5
|
<Meta title="Illustrations/Icon/Icon (Future)/Usage Guidelines" />
|
|
6
6
|
|
|
@@ -21,7 +21,7 @@ Updated September 13, 2024
|
|
|
21
21
|
Icons are simplified visual symbols that represent ideas, objects, or actions. They improve comprehension, guide interactivity, and draw attention to important information.
|
|
22
22
|
|
|
23
23
|
<Canvas of={IconStories.Playground} />
|
|
24
|
-
<Controls of={IconStories.Playground} include={[
|
|
24
|
+
<Controls of={IconStories.Playground} include={['name', 'isFilled']} />
|
|
25
25
|
|
|
26
26
|
### When to use
|
|
27
27
|
|
|
@@ -39,6 +39,7 @@ Icons are simplified visual symbols that represent ideas, objects, or actions. T
|
|
|
39
39
|
### Specs
|
|
40
40
|
|
|
41
41
|
When you need a new icon, use [Google's Material Symbols set](https://fonts.google.com/icons) via the [Figma plugin](https://www.figma.com/community/plugin/1088610476491668236/material-symbols) to add the relevant icons in:
|
|
42
|
+
|
|
42
43
|
- **Outlined**
|
|
43
44
|
- **Weight**: 400
|
|
44
45
|
- **Grade**: Normal (0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Canvas, Controls, Meta } from
|
|
2
|
-
import { ResourceLinks, KAIOInstallation } from
|
|
3
|
-
import * as SelectStories from
|
|
1
|
+
import { Canvas, Controls, Meta } from '@storybook/blocks'
|
|
2
|
+
import { ResourceLinks, KAIOInstallation } from '~storybook/components'
|
|
3
|
+
import * as SelectStories from './Select.stories'
|
|
4
4
|
|
|
5
5
|
<Meta of={SelectStories} />
|
|
6
6
|
|
|
@@ -25,6 +25,7 @@ import * as SelectStories from "./Select.stories"
|
|
|
25
25
|
### Options
|
|
26
26
|
|
|
27
27
|
Provide options in `items` in the `SelectOption` format to populate the options.
|
|
28
|
+
|
|
28
29
|
```ts
|
|
29
30
|
export type SelectOption = {
|
|
30
31
|
label: string
|
|
@@ -32,20 +33,21 @@ export type SelectOption = {
|
|
|
32
33
|
disabled?: boolean
|
|
33
34
|
options?: never
|
|
34
35
|
}
|
|
35
|
-
|
|
36
36
|
```
|
|
37
|
+
|
|
37
38
|
<Canvas of={SelectStories.SingleItems} />
|
|
38
39
|
|
|
39
40
|
### Grouped options
|
|
40
41
|
|
|
41
42
|
Group options by providing your `items` in the `SelectOptionGroup` format.
|
|
43
|
+
|
|
42
44
|
```ts
|
|
43
45
|
export type SelectOptionGroup<Option extends SelectOption> = {
|
|
44
46
|
label: string
|
|
45
47
|
options: Iterable<Option>
|
|
46
48
|
}
|
|
47
|
-
|
|
48
49
|
```
|
|
50
|
+
|
|
49
51
|
<Canvas of={SelectStories.GroupedItems} />
|
|
50
52
|
|
|
51
53
|
### Disabled options
|
|
@@ -87,11 +89,13 @@ Note that the `ref` exists as part of these spread props (there is a second arg
|
|
|
87
89
|
### Validation
|
|
88
90
|
|
|
89
91
|
Add validation messages using `status` and `validationMessage`.
|
|
92
|
+
|
|
90
93
|
<Canvas of={SelectStories.Validation} />
|
|
91
94
|
|
|
92
95
|
### Full width
|
|
93
96
|
|
|
94
97
|
Set `isFullWidth` to `true` to have the Select span the full width of its container.
|
|
98
|
+
|
|
95
99
|
<Canvas of={SelectStories.FullWidth} />
|
|
96
100
|
|
|
97
101
|
### Portals
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Canvas, Controls, Meta } from
|
|
2
|
-
import { ResourceLinks, KAIOInstallation } from
|
|
3
|
-
import * as TabsStories from
|
|
1
|
+
import { Canvas, Controls, Meta } from '@storybook/blocks'
|
|
2
|
+
import { ResourceLinks, KAIOInstallation } from '~storybook/components'
|
|
3
|
+
import * as TabsStories from './Tabs.stories'
|
|
4
4
|
|
|
5
5
|
<Meta title="Components/Tabs/Tabs (Future)/API Specification" />
|
|
6
6
|
|
|
@@ -13,10 +13,7 @@ import * as TabsStories from "./Tabs.stories"
|
|
|
13
13
|
|
|
14
14
|
/>
|
|
15
15
|
|
|
16
|
-
<KAIOInstallation
|
|
17
|
-
exportNames={["Tabs", "TabList", "Tab", "TabPanel"]}
|
|
18
|
-
isFuture
|
|
19
|
-
/>
|
|
16
|
+
<KAIOInstallation exportNames={['Tabs', 'TabList', 'Tab', 'TabPanel']} isFuture />
|
|
20
17
|
|
|
21
18
|
## Overview
|
|
22
19
|
|
|
@@ -31,7 +28,6 @@ If you need to control the state of the active tabs on the consuming side, use t
|
|
|
31
28
|
|
|
32
29
|
<Canvas of={TabsStories.Controlled} />
|
|
33
30
|
|
|
34
|
-
|
|
35
31
|
## `tablist|tab` role vs `nav|link`
|
|
36
32
|
|
|
37
33
|
This component implements the `tablist` role and WAI ARIA guidelines for tabs:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta } from
|
|
1
|
+
import { Meta } from '@storybook/blocks'
|
|
2
2
|
|
|
3
3
|
<Meta title="Components/Tabs/Tabs (Future)/Migration Guide" />
|
|
4
4
|
|
|
@@ -17,6 +17,7 @@ The Reach UI and React Aria APIs are fairly similar so there's not too much to a
|
|
|
17
17
|
The biggest adjustment is that you now need to provide an `id` for each `<Tab>` and match it with the one on `<TabPanel>`
|
|
18
18
|
|
|
19
19
|
Additionally:
|
|
20
|
+
|
|
20
21
|
- `<TabPanel>`s no longer needs to be wrapped in a `<TabPanels>` component
|
|
21
22
|
- `classNameOverride` changes to `className`
|
|
22
23
|
- `<Tabs defaultIndex={}>` changes to `<Tabs defaultSelectedKey={}>`
|
|
@@ -52,9 +53,13 @@ Additionally:
|
|
|
52
53
|
<TabList>
|
|
53
54
|
<Tab id="one">Tab 1</Tab>
|
|
54
55
|
<Tab id="two">Tab 2</Tab>
|
|
55
|
-
<Tab id="three" isDisabled>
|
|
56
|
+
<Tab id="three" isDisabled>
|
|
57
|
+
Disabled tab
|
|
58
|
+
</Tab>
|
|
56
59
|
</TabList>
|
|
57
|
-
<TabPanel id="one" className="p-4">
|
|
60
|
+
<TabPanel id="one" className="p-4">
|
|
61
|
+
Content 1
|
|
62
|
+
</TabPanel>
|
|
58
63
|
<TabPanel id="two">Content 2</TabPanel>
|
|
59
64
|
</Tabs>
|
|
60
65
|
```
|
|
@@ -85,7 +90,9 @@ Additionally:
|
|
|
85
90
|
<TabList>
|
|
86
91
|
<Tab id="one">Tab 1</Tab>
|
|
87
92
|
<Tab id="two">Tab 2</Tab>
|
|
88
|
-
<Tab id="three" isDisabled>
|
|
93
|
+
<Tab id="three" isDisabled>
|
|
94
|
+
Disabled tab
|
|
95
|
+
</Tab>
|
|
89
96
|
</TabList>
|
|
90
97
|
<TabPanel id="one">Content 1</TabPanel>
|
|
91
98
|
<TabPanel id="two">Content 2</TabPanel>
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { Canvas, Controls, Meta } from
|
|
2
|
-
import { ResourceLinks, KAIOInstallation } from
|
|
3
|
-
import * as RemovableTagStories from
|
|
1
|
+
import { Canvas, Controls, Meta } from '@storybook/blocks'
|
|
2
|
+
import { ResourceLinks, KAIOInstallation } from '~storybook/components'
|
|
3
|
+
import * as RemovableTagStories from './RemovableTag.stories'
|
|
4
4
|
|
|
5
5
|
<Meta of={RemovableTagStories} />
|
|
6
6
|
|
|
7
7
|
# RemovableTag
|
|
8
8
|
|
|
9
|
-
<ResourceLinks
|
|
10
|
-
sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__future__/Tag/RemovableTag.tsx"
|
|
11
|
-
/>
|
|
9
|
+
<ResourceLinks sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__future__/Tag/RemovableTag.tsx" />
|
|
12
10
|
|
|
13
11
|
<KAIOInstallation exportNames="RemovableTag" />
|
|
14
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Canvas, Meta } from
|
|
2
|
-
import * as LegacyTagStories from
|
|
3
|
-
import * as TagMigrationStories from
|
|
1
|
+
import { Canvas, Meta } from '@storybook/blocks'
|
|
2
|
+
import * as LegacyTagStories from '../../../../Tag/_docs/Tag.stories'
|
|
3
|
+
import * as TagMigrationStories from './Tag-migration-guide.stories'
|
|
4
4
|
|
|
5
5
|
<Meta of={TagMigrationStories} />
|
|
6
6
|
|
|
@@ -27,14 +27,13 @@ There were a number key changes between current and future `Tag` to achieve the
|
|
|
27
27
|
- `Avatar` and all child content must now be composed by the consumer.
|
|
28
28
|
- This offers a greater degree of flexibility to ensure that the right accessible context can be provided to the end user.
|
|
29
29
|
|
|
30
|
-
|
|
31
30
|
## Migration examples
|
|
32
31
|
|
|
33
32
|
The following are example of migrating from previously available props to the composable solution.
|
|
34
33
|
|
|
35
34
|
### Status
|
|
36
35
|
|
|
37
|
-
With the `variant` prop there are four values associated with statuses:
|
|
36
|
+
With the `variant` prop there are four values associated with statuses: `statusLive`, `statusDraft`, `statusClosed`, `statusAction`.
|
|
38
37
|
|
|
39
38
|
For the most part these can all be replaced with the use of the `color` prop, with exception to the `live` status.
|
|
40
39
|
|
|
@@ -42,14 +41,13 @@ For the most part these can all be replaced with the use of the `color` prop, wi
|
|
|
42
41
|
|
|
43
42
|
<Canvas of={LegacyTagStories.Status} />
|
|
44
43
|
|
|
45
|
-
|
|
46
44
|
#### After
|
|
47
45
|
|
|
48
|
-
<Canvas of={TagMigrationStories.StatusMigration} sourceState="shown"/>
|
|
46
|
+
<Canvas of={TagMigrationStories.StatusMigration} sourceState="shown" />
|
|
49
47
|
|
|
50
48
|
While the `LiveIcon` is exported from `@kaizen/components` the current `Tag` uses an animated implementation, which is not exported directly from Kaizen. As an interim solution, you can use the following Story's code snippet to create a `LiveIconComponent`. This can then be passed into the future `Tag` as `Children`.
|
|
51
49
|
|
|
52
|
-
<Canvas of={TagMigrationStories.LiveIconComponentStory} sourceState="hidden"/>
|
|
50
|
+
<Canvas of={TagMigrationStories.LiveIconComponentStory} sourceState="hidden" />
|
|
53
51
|
|
|
54
52
|
### Validation
|
|
55
53
|
|
|
@@ -63,8 +61,7 @@ Note: because the icons convey meaning, they should have an accessible label tha
|
|
|
63
61
|
|
|
64
62
|
#### After
|
|
65
63
|
|
|
66
|
-
<Canvas of={TagMigrationStories.ValidationMigration} sourceState="shown"/>
|
|
67
|
-
|
|
64
|
+
<Canvas of={TagMigrationStories.ValidationMigration} sourceState="shown" />
|
|
68
65
|
|
|
69
66
|
Note: When using the `icon` prop, the icon's color will be determined by the `color` value that has been set. This is to ensure that an accessible contrast ratio is achieved.
|
|
70
67
|
|
|
@@ -80,7 +77,7 @@ While migration of any `Tag` using, `sentimentPositive`, `sentimentNeutral` or `
|
|
|
80
77
|
|
|
81
78
|
#### After
|
|
82
79
|
|
|
83
|
-
<Canvas of={TagMigrationStories.SentimentsMigration} sourceState="shown"/>
|
|
80
|
+
<Canvas of={TagMigrationStories.SentimentsMigration} sourceState="shown" />
|
|
84
81
|
|
|
85
82
|
If required, you could use `classNameOverride` to implement the same UI. It is important that any override of the default styles still meets minimum contrast ratios to ensure the component is accessible.
|
|
86
83
|
|
|
@@ -88,7 +85,6 @@ If required, you could use `classNameOverride` to implement the same UI. It is i
|
|
|
88
85
|
|
|
89
86
|
This is also a good time to stop and check if this change is necessary. If there is an opportunity remove older styles that are no longer available, this can help to reduce inconsistencies across the platform. As always, check in with your designer to see if any new option can be used in its place.
|
|
90
87
|
|
|
91
|
-
|
|
92
88
|
### Dismissible
|
|
93
89
|
|
|
94
90
|
The `dismissible` prop is no longer available in the future `Tag` component. We have split the dismissible functionality into the [RemovableTag](/docs/components-tag-future-removabletag--docs).
|
|
@@ -101,11 +97,10 @@ This increases the hit box for the dismiss button and makes the `ariaLabel` in t
|
|
|
101
97
|
|
|
102
98
|
#### After
|
|
103
99
|
|
|
104
|
-
<Canvas of={TagMigrationStories.DismissibleMigration} sourceState="shown"/>
|
|
100
|
+
<Canvas of={TagMigrationStories.DismissibleMigration} sourceState="shown" />
|
|
105
101
|
|
|
106
102
|
Remember that when handling dismiss (or any destructive action), a user's focus should not be lost on the page.
|
|
107
103
|
|
|
108
|
-
|
|
109
104
|
### Avatars
|
|
110
105
|
|
|
111
106
|
Avatars are no longer provided directly to the `Tag` as a prop. Instead they will be passed in as children.
|
|
@@ -116,8 +111,7 @@ Avatars are no longer provided directly to the `Tag` as a prop. Instead they wil
|
|
|
116
111
|
|
|
117
112
|
#### After
|
|
118
113
|
|
|
119
|
-
<Canvas of={TagMigrationStories.AvatarMigration} sourceState="shown"/>
|
|
120
|
-
|
|
114
|
+
<Canvas of={TagMigrationStories.AvatarMigration} sourceState="shown" />
|
|
121
115
|
|
|
122
116
|
Note: The use of `ps-4` (or `padding-inline-start`) in the `classNameOverride` is to override the default spacing at start of the `Tag`. This will ensure the Avatar can contour the border radius of the `Tag`.
|
|
123
117
|
|
|
@@ -139,11 +133,10 @@ In future `Tag` this has been removed so consumers can now control spacing with
|
|
|
139
133
|
|
|
140
134
|
#### After
|
|
141
135
|
|
|
142
|
-
<Canvas of={TagMigrationStories.InlineMigration} sourceState="shown"/>
|
|
136
|
+
<Canvas of={TagMigrationStories.InlineMigration} sourceState="shown" />
|
|
143
137
|
|
|
144
138
|
To simplify this example we have avoided DOM elements such as `ul` and `li`. In production, lists should be used if you are rendering a group of `Tag`s.
|
|
145
139
|
|
|
146
|
-
|
|
147
140
|
### truncationWidth
|
|
148
141
|
|
|
149
142
|
While the current Tag controls truncation via the `truncationWidth` prop, which set a `max-width` of inner text via inline styles, we have chosen not to adopt this in the future `Tag` as it presents a risk of violating accessibility standards. While truncation can still be achieved in future `Tag` via Tailwind or DOM manipulation, it is important to call out out this as a accessibility concern.
|
|
@@ -162,11 +155,10 @@ The two sizes for tag have been remove in favour of a default size in between `m
|
|
|
162
155
|
|
|
163
156
|
`classNameOverride` can be leveraged to add padding and modify properties but should be done with caution to reduce inconsistencies in the platform and reduce the risk of accessibility violations.
|
|
164
157
|
|
|
165
|
-
|
|
166
158
|
#### Before
|
|
167
159
|
|
|
168
160
|
<Canvas of={LegacyTagStories.Sizes} />
|
|
169
161
|
|
|
170
162
|
#### After
|
|
171
163
|
|
|
172
|
-
<Canvas of={TagMigrationStories.SizesMigration} sourceState="shown"/>
|
|
164
|
+
<Canvas of={TagMigrationStories.SizesMigration} sourceState="shown" />
|