@kaizen/components 1.68.7 → 1.68.9
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/Calendar/CalendarPopover/CalendarPopover.mjs +1 -1
- package/dist/esm/EmptyState/EmptyState.mjs +1 -1
- package/dist/esm/Filter/FilterMultiSelect/subcomponents/ListBox/ListBox.mjs +1 -1
- package/dist/esm/MultiSelect/subcomponents/Popover/Popover.mjs +1 -1
- package/dist/esm/RichTextEditor/RichTextEditor/RichTextEditor.mjs +1 -1
- package/dist/esm/RichTextEditor/RichTextEditor/schema.mjs +1 -1
- package/dist/esm/RichTextEditor/utils/schema/nodes.mjs +1 -1
- package/dist/esm/TimeField/TimeField.mjs +1 -1
- package/dist/esm/__overlays__/Tooltip/v1/Tooltip.mjs +1 -1
- package/dist/esm/__overlays__/Tooltip/v3/Tooltip.mjs +1 -1
- package/dist/styles.css +50 -50
- package/dist/types/__overlays__/Tooltip/v3/Tooltip.d.ts +1 -1
- package/package.json +30 -30
- 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,7 +1,7 @@
|
|
|
1
|
-
import { Canvas, Meta, Controls, ArgTypes, DocsStory } from
|
|
2
|
-
import { ResourceLinks, KAIOInstallation } from
|
|
3
|
-
import * as exampleStories from
|
|
4
|
-
import * as specStories from
|
|
1
|
+
import { Canvas, Meta, Controls, ArgTypes, DocsStory } from '@storybook/blocks'
|
|
2
|
+
import { ResourceLinks, KAIOInstallation } from '~storybook/components'
|
|
3
|
+
import * as exampleStories from './Button.docs.stories'
|
|
4
|
+
import * as specStories from './Button.spec.stories'
|
|
5
5
|
|
|
6
6
|
<Meta title="Actions/Button/Button (v3)/API Specification" />
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@ Updated Nov 19, 2024
|
|
|
15
15
|
designGuidelines="/?path=/docs/actions-button-button-v3-usage-guidelines--docs"
|
|
16
16
|
/>
|
|
17
17
|
|
|
18
|
-
<KAIOInstallation exportNames={[
|
|
18
|
+
<KAIOInstallation exportNames={['Button']} family="actions" version="3" />
|
|
19
19
|
|
|
20
20
|
## Overview
|
|
21
21
|
|
|
@@ -25,7 +25,26 @@ The following example and table showcases the essential props that enable the co
|
|
|
25
25
|
|
|
26
26
|
<Canvas of={exampleStories.Playground} />
|
|
27
27
|
|
|
28
|
-
<Controls
|
|
28
|
+
<Controls
|
|
29
|
+
of={exampleStories.Playground}
|
|
30
|
+
className="mb-64"
|
|
31
|
+
include={[
|
|
32
|
+
'children',
|
|
33
|
+
'hasHiddenLabel',
|
|
34
|
+
'className',
|
|
35
|
+
'size',
|
|
36
|
+
'variant',
|
|
37
|
+
'isReversed',
|
|
38
|
+
'onPress',
|
|
39
|
+
'icon',
|
|
40
|
+
'iconPosition',
|
|
41
|
+
'isFullWidth',
|
|
42
|
+
'isDisabled',
|
|
43
|
+
'isPending',
|
|
44
|
+
'pendingLabel',
|
|
45
|
+
'hasHiddenPendingLabel',
|
|
46
|
+
]}
|
|
47
|
+
/>
|
|
29
48
|
|
|
30
49
|
## Buttons and links
|
|
31
50
|
|
|
@@ -50,8 +69,8 @@ Reversed variants are handled via the `ReversedColors` Provider.
|
|
|
50
69
|
To enable the reversed theme, you will need to wrap the component or application in the `ReversedColors` provider, ie:
|
|
51
70
|
|
|
52
71
|
```tsx
|
|
53
|
-
import { Button } from
|
|
54
|
-
import { ReversedColors } from
|
|
72
|
+
import { Button } from '@kaizen/components/v3/actions'
|
|
73
|
+
import { ReversedColors } from '@kaizen/components/v3/utilities'
|
|
55
74
|
// application code
|
|
56
75
|
|
|
57
76
|
return (
|
|
@@ -74,15 +93,13 @@ One key change to the `Button`'s API is the shift from `onClick` to React A
|
|
|
74
93
|
Functionally this does not change the way we pass actions into `Button`. Consumers can safely replace `onClick` with `onPress` without any additional changes, ie:
|
|
75
94
|
|
|
76
95
|
```tsx
|
|
77
|
-
<Button label="Submit" onClick={e => sumbit(e)}/>
|
|
96
|
+
<Button label="Submit" onClick={(e) => sumbit(e)} />
|
|
78
97
|
```
|
|
79
98
|
|
|
80
99
|
Can safely be replaced with the following:
|
|
81
100
|
|
|
82
101
|
```tsx
|
|
83
|
-
<Button onPress={e => submit(e)}>
|
|
84
|
-
Submit
|
|
85
|
-
</Button>
|
|
102
|
+
<Button onPress={(e) => submit(e)}>Submit</Button>
|
|
86
103
|
```
|
|
87
104
|
|
|
88
105
|
### Button content and children
|
|
@@ -90,7 +107,7 @@ Can safely be replaced with the following:
|
|
|
90
107
|
Labels and any button content can be passed into the `Button` as `children`. Content wrapped by the `Button` will be spaced evenly relative to the `size` prop.
|
|
91
108
|
|
|
92
109
|
```tsx
|
|
93
|
-
<Button variant="secondary" onPress={e => submit(e)}>
|
|
110
|
+
<Button variant="secondary" onPress={(e) => submit(e)}>
|
|
94
111
|
Label
|
|
95
112
|
</Button>
|
|
96
113
|
```
|
|
@@ -107,12 +124,11 @@ Set the position of the icon using the `iconPosition` prop. This will ensure con
|
|
|
107
124
|
|
|
108
125
|
<Canvas of={exampleStories.ButtonWithIconEnd} />
|
|
109
126
|
|
|
110
|
-
|
|
111
127
|
### Icon-only `Button` and `hasHiddenLabel`
|
|
112
128
|
|
|
113
129
|
To achieve an icon-only `Button` (previously: `IconButton`) use the `icon` prop and set `hasHiddenLabel` to `true`. This will visually hide the button's `children` and `pendingLabel`, while still announcing the content to screen readers.
|
|
114
130
|
|
|
115
|
-
<Canvas of={exampleStories.IconButton} className="mb-32"
|
|
131
|
+
<Canvas of={exampleStories.IconButton} className="mb-32" />
|
|
116
132
|
|
|
117
133
|
This pattern ensures that the `Button`'s accessible name is determined by its children, which helps to announce relevant content to the screen readers, as with the [pending state](#pending-state). You can learn more about this [accessible pattern here](https://cultureamp.atlassian.net/wiki/spaces/PA/pages/3833331831/Accessible+button+and+link+labels).
|
|
118
134
|
|
|
@@ -132,7 +148,6 @@ As mentioned in the [previous section](#icon-only-button-and-hashiddenlabel), an
|
|
|
132
148
|
|
|
133
149
|
<Canvas of={specStories.PendingIconButton} />
|
|
134
150
|
|
|
135
|
-
|
|
136
151
|
### Full width Buttons
|
|
137
152
|
|
|
138
153
|
If a button is statically the full width of a container you can use the `isFullWidth` property.
|
|
@@ -147,4 +162,21 @@ The following table is a collection of additional React Aria and native HTML pro
|
|
|
147
162
|
|
|
148
163
|
You can learn more about React Aria's Button API and advance configuration options [here](https://react-spectrum.adobe.com/react-aria/Button.html#props).
|
|
149
164
|
|
|
150
|
-
<ArgTypes
|
|
165
|
+
<ArgTypes
|
|
166
|
+
of={exampleStories.Playground}
|
|
167
|
+
exclude={[
|
|
168
|
+
'children',
|
|
169
|
+
'hasHiddenLabel',
|
|
170
|
+
'className',
|
|
171
|
+
'size',
|
|
172
|
+
'variant',
|
|
173
|
+
'onPress',
|
|
174
|
+
'icon',
|
|
175
|
+
'iconPosition',
|
|
176
|
+
'isFullWidth',
|
|
177
|
+
'isDisabled',
|
|
178
|
+
'isPending',
|
|
179
|
+
'pendingLabel',
|
|
180
|
+
'hasHiddenPendingLabel',
|
|
181
|
+
]}
|
|
182
|
+
/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Canvas, Meta, Controls } from
|
|
2
|
-
import { ResourceLinks, Installation } from
|
|
3
|
-
import * as Button from
|
|
1
|
+
import { Canvas, Meta, Controls } from '@storybook/blocks'
|
|
2
|
+
import { ResourceLinks, Installation } from '~storybook/components'
|
|
3
|
+
import * as Button from './Button.docs.stories'
|
|
4
4
|
|
|
5
5
|
<Meta title="Actions/Button/Button (v3)/Usage Guidelines" />
|
|
6
6
|
|
|
@@ -25,6 +25,8 @@ Buttons allow users to perform an action. They have multiple styles for various
|
|
|
25
25
|
|
|
26
26
|
<Canvas of={Button.Playground} />
|
|
27
27
|
|
|
28
|
-
<Controls
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
<Controls
|
|
29
|
+
of={Button.Playground}
|
|
30
|
+
include={['children', 'variant', 'size', 'isDisabled', 'icon', 'iconPosition']}
|
|
31
|
+
className="mb-64"
|
|
32
|
+
/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Canvas, Controls, Meta } from
|
|
2
|
-
import { ResourceLinks, Installation } from
|
|
3
|
-
import * as MenuStories from
|
|
1
|
+
import { Canvas, Controls, Meta } from '@storybook/blocks'
|
|
2
|
+
import { ResourceLinks, Installation } from '~storybook/components'
|
|
3
|
+
import * as MenuStories from './Menu.stories'
|
|
4
4
|
|
|
5
5
|
<Meta of={MenuStories} />
|
|
6
6
|
|
|
@@ -26,4 +26,3 @@ A menu contains links to places or button actions. It does NOT show a selected i
|
|
|
26
26
|
|
|
27
27
|
<Canvas of={MenuStories.Playground} />
|
|
28
28
|
<Controls of={MenuStories.Playground} />
|
|
29
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Canvas, Controls, Meta } from
|
|
2
|
-
import { ResourceLinks, KAIOInstallation } from
|
|
3
|
-
import * as MenuStories from
|
|
1
|
+
import { Canvas, Controls, Meta } from '@storybook/blocks'
|
|
2
|
+
import { ResourceLinks, KAIOInstallation } from '~storybook/components'
|
|
3
|
+
import * as MenuStories from './Menu.stories'
|
|
4
4
|
|
|
5
5
|
<Meta of={MenuStories} />
|
|
6
6
|
|
|
@@ -13,7 +13,11 @@ import * as MenuStories from "./Menu.stories"
|
|
|
13
13
|
|
|
14
14
|
/>
|
|
15
15
|
|
|
16
|
-
<KAIOInstallation
|
|
16
|
+
<KAIOInstallation
|
|
17
|
+
exportNames={['Menu', 'MenuDropdown', 'MenuList', 'MenuItem']}
|
|
18
|
+
family="actions"
|
|
19
|
+
version="2"
|
|
20
|
+
/>
|
|
17
21
|
|
|
18
22
|
## Overview
|
|
19
23
|
|
|
@@ -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
|