@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,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" />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Canvas, Controls, Meta } from
|
|
2
|
-
import { ResourceLinks, KAIOInstallation } from
|
|
3
|
-
import * as TagStories from
|
|
1
|
+
import { Canvas, Controls, Meta } from '@storybook/blocks'
|
|
2
|
+
import { ResourceLinks, KAIOInstallation } from '~storybook/components'
|
|
3
|
+
import * as TagStories from './Tag.stories'
|
|
4
4
|
|
|
5
5
|
<Meta of={TagStories} />
|
|
6
6
|
|
|
@@ -21,7 +21,6 @@ Note: Tag does not yet have feature parity with the legacy Tag component. The go
|
|
|
21
21
|
component was to have a more flexible version of legacy Tag, and we will slowly add more functionality
|
|
22
22
|
to this component until we reach feature parity.
|
|
23
23
|
|
|
24
|
-
|
|
25
24
|
## API
|
|
26
25
|
|
|
27
26
|
<Canvas of={TagStories.Playground} />
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { Canvas, Controls, Meta } from
|
|
2
|
-
import { KAIOInstallation, ResourceLinks,
|
|
3
|
-
import * as exampleStories from
|
|
1
|
+
import { Canvas, Controls, Meta } from '@storybook/blocks'
|
|
2
|
+
import { KAIOInstallation, ResourceLinks, SbContent } from '~storybook/components'
|
|
3
|
+
import * as exampleStories from './Focusable.stories'
|
|
4
4
|
|
|
5
|
-
<Meta title="Overlays/Focusable/v3/API Specification"/>
|
|
5
|
+
<Meta title="Overlays/Focusable/v3/API Specification" />
|
|
6
6
|
|
|
7
7
|
<SbContent>
|
|
8
8
|
# Focusable API Specification (v3)
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Updated June 25, 2024
|
|
11
|
+
|
|
11
12
|
</SbContent>
|
|
12
13
|
|
|
13
14
|
<ResourceLinks
|
|
@@ -18,21 +19,21 @@ import * as exampleStories from "./Focusable.stories"
|
|
|
18
19
|
<SbContent className="mb-24">
|
|
19
20
|
<KAIOInstallation exportNames={["Focusable"]} family="overlays" version="3" />
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
## Overview
|
|
23
|
+
|
|
24
|
+
Focusable is a utility wrapper to allow users to add focus to a non-focusable element.
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
The main use case is for non semantic components like `Tag` that need a [Tooltip](/docs/overlays-tooltip-v3-usage-guidelines--docs).
|
|
24
27
|
|
|
25
|
-
The main use case is for non semantic components like `Tag` that need a [Tooltip](/docs/overlays-tooltip-v3-usage-guidelines--docs).
|
|
26
28
|
</SbContent>
|
|
27
29
|
|
|
28
30
|
<Canvas className="mb-24" of={exampleStories.Playground} />
|
|
29
31
|
|
|
30
32
|
<SbContent className="mb-64">
|
|
31
|
-
Be aware that this does not negate the need to meet A11Y standards and best practices. Use this
|
|
33
|
+
Be aware that this does not negate the need to meet A11Y standards and best practices. Use this
|
|
34
|
+
utility wrapper with caution.
|
|
32
35
|
</SbContent>
|
|
33
36
|
|
|
34
|
-
<SbContent className="mb-12">
|
|
35
|
-
## API
|
|
36
|
-
</SbContent>
|
|
37
|
+
<SbContent className="mb-12">## API</SbContent>
|
|
37
38
|
|
|
38
|
-
<Controls of={exampleStories.Playground}
|
|
39
|
+
<Controls of={exampleStories.Playground} />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Canvas, Controls, Meta } from
|
|
2
|
-
import { ResourceLinks, Installation } from
|
|
3
|
-
import * as TooltipStories from
|
|
1
|
+
import { Canvas, Controls, Meta } from '@storybook/blocks'
|
|
2
|
+
import { ResourceLinks, Installation } from '~storybook/components'
|
|
3
|
+
import * as TooltipStories from './Tooltip.stories'
|
|
4
4
|
|
|
5
5
|
<Meta of={TooltipStories} />
|
|
6
6
|
|
|
@@ -20,7 +20,6 @@ import * as TooltipStories from "./Tooltip.stories"
|
|
|
20
20
|
|
|
21
21
|
It is recommended that you import from the `v2` entry point.
|
|
22
22
|
|
|
23
|
-
|
|
24
23
|
## Overview
|
|
25
24
|
|
|
26
25
|
Adds a popover that will show on hover or focus of the child element, with simple text content.
|
|
@@ -33,6 +32,7 @@ Adds a popover that will show on hover or focus of the child element, with simpl
|
|
|
33
32
|
This component wasn't built with accessibility in mind, as a result it's quite easy to implement a tooltip in a non-accessible way. A rethink and rewrite is likely for the future.
|
|
34
33
|
|
|
35
34
|
There's two major accessibility concerns here:
|
|
35
|
+
|
|
36
36
|
- Keyboard only users
|
|
37
37
|
- Screen reader (or similar assistive tech) users
|
|
38
38
|
|
|
@@ -68,7 +68,6 @@ Again, try to keep the contents of your children as simple as possible, ideally
|
|
|
68
68
|
When your direct child is not semantic, you will get a console warning like this:
|
|
69
69
|
`<Tooltip /> is not directly wrapping a semantic element, screen reader users will not be able to access the tooltip info.`
|
|
70
70
|
|
|
71
|
-
|
|
72
71
|
### Tooltips, Kaizen components and avoiding common pitfalls
|
|
73
72
|
|
|
74
73
|
While technically any Kaizen component can be wrapped by a `Tooltip`, as called out previously, only those with [accessible roles](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles) like `button`, `link` or `heading`, will be readable to assistive technologies.
|
|
@@ -117,7 +116,7 @@ Without either of these, the `Tooltip` content will not be readable to keyboard
|
|
|
117
116
|
|
|
118
117
|
Seen in the example below simple `Tag`s with plain text as `children` will not accessible to keyboard users or assistive technologies as it's direct descendant is a `div` with no semantic `role`.
|
|
119
118
|
|
|
120
|
-
<Canvas of={TooltipStories.TagWithHoverOnlyTooltip}
|
|
119
|
+
<Canvas of={TooltipStories.TagWithHoverOnlyTooltip} />
|
|
121
120
|
|
|
122
121
|
While `Tooltip` should be avoided if there are no interactive states within the `Tag`, internal elements like buttons or links can be wrapped in a `Tooltip` component to add necessary context.
|
|
123
122
|
|
|
@@ -136,4 +135,3 @@ In the example above, the `Tooltip` content `"Select all users"` is accessible t
|
|
|
136
135
|
<Canvas of={TooltipStories.CheckboxFieldWithDescriptionTooltip} />
|
|
137
136
|
|
|
138
137
|
In these instances, `aria-describedby` can be leveraged to provide a description to the input.
|
|
139
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Canvas, Controls, Meta } from
|
|
2
|
-
import { ResourceLinks, KAIOInstallation } from
|
|
3
|
-
import * as TooltipStories from
|
|
1
|
+
import { Canvas, Controls, Meta } from '@storybook/blocks'
|
|
2
|
+
import { ResourceLinks, KAIOInstallation } from '~storybook/components'
|
|
3
|
+
import * as TooltipStories from './Tooltip.stories'
|
|
4
4
|
|
|
5
5
|
<Meta of={TooltipStories} />
|
|
6
6
|
|
|
@@ -25,6 +25,7 @@ Adds a popover that will show on hover or focus of the child element, with simpl
|
|
|
25
25
|
This component wasn't built with accessibility in mind, as a result it's quite easy to implement a tooltip in a non-accessible way. A rethink and rewrite is likely for the future.
|
|
26
26
|
|
|
27
27
|
There's two major accessibility concerns here:
|
|
28
|
+
|
|
28
29
|
- Keyboard only users
|
|
29
30
|
- Screen reader (or similar assistive tech) users
|
|
30
31
|
|
|
@@ -60,7 +61,6 @@ Again, try to keep the contents of your children as simple as possible, ideally
|
|
|
60
61
|
When your direct child is not semantic, you will get a console warning like this:
|
|
61
62
|
`<Tooltip /> is not directly wrapping a semantic element, screen reader users will not be able to access the tooltip info.`
|
|
62
63
|
|
|
63
|
-
|
|
64
64
|
### Tooltips, Kaizen components and avoiding common pitfalls
|
|
65
65
|
|
|
66
66
|
While technically any Kaizen component can be wrapped by a `Tooltip`, as called out previously, only those with [accessible roles](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles) like `button`, `link` or `heading`, will be readable to assistive technologies.
|
|
@@ -109,7 +109,7 @@ Without either of these, the `Tooltip` content will not be readable to keyboard
|
|
|
109
109
|
|
|
110
110
|
Seen in the example below simple `Tag`s with plain text as `children` will not accessible to keyboard users or assistive technologies as it's direct descendant is a `div` with no semantic `role`.
|
|
111
111
|
|
|
112
|
-
<Canvas of={TooltipStories.TagWithHoverOnlyTooltip}
|
|
112
|
+
<Canvas of={TooltipStories.TagWithHoverOnlyTooltip} />
|
|
113
113
|
|
|
114
114
|
While `Tooltip` should be avoided if there are no interactive states within the `Tag`, internal elements like buttons or links can be wrapped in a `Tooltip` component to add necessary context.
|
|
115
115
|
|
|
@@ -128,4 +128,3 @@ In the example above, the `Tooltip` content `"Select all users"` is accessible t
|
|
|
128
128
|
<Canvas of={TooltipStories.CheckboxFieldWithDescriptionTooltip} />
|
|
129
129
|
|
|
130
130
|
In these instances, `aria-describedby` can be leveraged to provide a description to the input.
|
|
131
|
-
|
|
@@ -2,7 +2,7 @@ import React, { forwardRef, useContext, useLayoutEffect, useState } from 'react'
|
|
|
2
2
|
import {
|
|
3
3
|
Tooltip as RACTooltip,
|
|
4
4
|
TooltipContext,
|
|
5
|
-
TooltipProps as RACTooltipProps,
|
|
5
|
+
type TooltipProps as RACTooltipProps,
|
|
6
6
|
TooltipTriggerStateContext,
|
|
7
7
|
useContextProps,
|
|
8
8
|
} from 'react-aria-components'
|
|
@@ -74,7 +74,8 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
74
74
|
{shouldInlineHiddenContent ? (
|
|
75
75
|
<VisuallyHidden>
|
|
76
76
|
{typeof children === 'function'
|
|
77
|
-
?
|
|
77
|
+
? contextState &&
|
|
78
|
+
children({
|
|
78
79
|
placement: 'center',
|
|
79
80
|
isEntering: false,
|
|
80
81
|
isExiting: false,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { Canvas, Controls, Meta } from
|
|
2
|
-
import { KAIOInstallation, ResourceLinks,
|
|
3
|
-
import * as docsStories from
|
|
4
|
-
import * as exampleStories from
|
|
1
|
+
import { Canvas, Controls, Meta } from '@storybook/blocks'
|
|
2
|
+
import { KAIOInstallation, ResourceLinks, SbContent } from '~storybook/components'
|
|
3
|
+
import * as docsStories from './Tooltip.docs.stories'
|
|
4
|
+
import * as exampleStories from './Tooltip.stories'
|
|
5
5
|
|
|
6
|
-
<Meta title="Overlays/Tooltip/v3/API Specification"/>
|
|
6
|
+
<Meta title="Overlays/Tooltip/v3/API Specification" />
|
|
7
7
|
|
|
8
8
|
<SbContent>
|
|
9
9
|
# Tooltip API Specification (v3)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Updated June 25, 2024
|
|
12
|
+
|
|
12
13
|
</SbContent>
|
|
13
14
|
|
|
14
15
|
<ResourceLinks
|
|
@@ -20,70 +21,80 @@ import * as exampleStories from "./Tooltip.stories"
|
|
|
20
21
|
|
|
21
22
|
<SbContent className="mb-24">
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
{' '}
|
|
25
|
+
|
|
26
|
+
<KAIOInstallation exportNames={['Tooltip', 'TooltipTrigger']} family="overlays" version="3" />
|
|
27
|
+
|
|
28
|
+
## Overview
|
|
24
29
|
|
|
25
|
-
|
|
30
|
+
Tooltips are brief floating labels used to add additional contextual information when users hover, click or focus on an interactive element.
|
|
26
31
|
|
|
27
|
-
Tooltips are brief floating labels used to add additional contextual information when users hover, click or focus on an interactive element.
|
|
28
32
|
</SbContent>
|
|
29
33
|
|
|
30
34
|
<Canvas
|
|
31
35
|
className="mb-64"
|
|
32
36
|
of={exampleStories.OnButton}
|
|
33
|
-
source={{
|
|
37
|
+
source={{
|
|
38
|
+
code: `
|
|
34
39
|
<TooltipTrigger>
|
|
35
40
|
<Button label="Button" />
|
|
36
41
|
<Tooltip>Tooltip content</Tooltip>
|
|
37
42
|
</TooltipTrigger>
|
|
38
|
-
|
|
43
|
+
`,
|
|
44
|
+
}}
|
|
39
45
|
/>
|
|
40
46
|
|
|
41
47
|
<SbContent className="mb-64">
|
|
42
48
|
### React Aria
|
|
43
49
|
|
|
44
|
-
|
|
50
|
+
This component is built using the `react-aria-components` library and extends the [Tooltip component](https://react-spectrum.adobe.com/react-aria/Tooltip.html).
|
|
45
51
|
|
|
46
|
-
|
|
52
|
+
As this shares the same core [anatomy](https://react-spectrum.adobe.com/react-aria/Tooltip.html#anatomy), [props types](https://react-spectrum.adobe.com/react-aria/Tooltip.html#tooltip-1) and [functionality](https://react-spectrum.adobe.com/react-aria/Tooltip.html#features), the guidance below is tailored to our implementation and should cover known use cases of the Tooltip.
|
|
47
53
|
|
|
48
|
-
|
|
49
|
-
</SbContent>
|
|
54
|
+
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/Tooltip.html) if not present below.
|
|
50
55
|
|
|
51
|
-
<SbContent className="mb-12">
|
|
52
|
-
## API
|
|
53
56
|
</SbContent>
|
|
54
57
|
|
|
55
|
-
<
|
|
58
|
+
<SbContent className="mb-12">## API</SbContent>
|
|
59
|
+
|
|
60
|
+
<Controls of={exampleStories.OnButton} />
|
|
56
61
|
|
|
57
62
|
<SbContent className=" mt-64">
|
|
58
63
|
### Placement
|
|
59
64
|
|
|
60
|
-
|
|
65
|
+
Placement controls where the `Tooltip` will float, relative to its reference element defined by the `triggerRef`. By default, this will float to the `bottom`.
|
|
66
|
+
|
|
61
67
|
</SbContent>
|
|
62
68
|
|
|
63
|
-
<Canvas className="mb-24" of={exampleStories.Placement}
|
|
69
|
+
<Canvas className="mb-24" of={exampleStories.Placement} />
|
|
64
70
|
|
|
65
71
|
<SbContent>
|
|
66
|
-
The option, `shouldFlip`, will control whether the `Tooltip` inverts its orientation when
|
|
72
|
+
The option, `shouldFlip`, will control whether the `Tooltip` inverts its orientation when
|
|
73
|
+
insufficient room is available in the viewport. You can see the below example with a constrained
|
|
74
|
+
[viewport here](?path=/story/overlays-tooltip-v3--should-flip&globals=viewport:small).
|
|
67
75
|
</SbContent>
|
|
68
76
|
|
|
69
|
-
<Canvas className="mb-64" of={docsStories.ShouldFlip}
|
|
77
|
+
<Canvas className="mb-64" of={docsStories.ShouldFlip} />
|
|
70
78
|
|
|
71
79
|
<SbContent>
|
|
72
80
|
### Controlled state
|
|
73
81
|
|
|
74
|
-
|
|
82
|
+
By default, the `Tooltip` state is controlled, so all interactive states do not need to be defined. There may be instances where a users may want want to toggle a `Tooltip` on or off. In this case we have exposed the `isOpen` prop.
|
|
83
|
+
|
|
75
84
|
</SbContent>
|
|
76
85
|
|
|
77
|
-
<Canvas className="mb-24" of={docsStories.UncontrolledState}
|
|
86
|
+
<Canvas className="mb-24" of={docsStories.UncontrolledState} />
|
|
78
87
|
|
|
79
88
|
<SbContent className="mb-64">
|
|
80
|
-
`isOpen` prop will negate the default state and relinquish control of `Tooltip` open and close to
|
|
89
|
+
`isOpen` prop will negate the default state and relinquish control of `Tooltip` open and close to
|
|
90
|
+
the user.
|
|
81
91
|
</SbContent>
|
|
82
92
|
|
|
83
93
|
<SbContent>
|
|
84
94
|
### TooltipTrigger
|
|
85
95
|
|
|
86
|
-
|
|
96
|
+
The `TooltipTrigger` wraps both the `Tooltip` and its trigger element, controlling the open and close interactions.
|
|
97
|
+
|
|
87
98
|
</SbContent>
|
|
88
99
|
|
|
89
100
|
```JSX
|
|
@@ -105,13 +116,15 @@ import * as exampleStories from "./Tooltip.stories"
|
|
|
105
116
|
<SbContent>
|
|
106
117
|
### Reversed
|
|
107
118
|
|
|
108
|
-
|
|
119
|
+
The `Tooltip` uses the `useReversedColors` hook and `ReversedColors` provider to control the dark and light theme.
|
|
120
|
+
|
|
109
121
|
</SbContent>
|
|
110
122
|
|
|
111
123
|
<Canvas className="bg-purple-600 mb-24" of={exampleStories.OnReversed} />
|
|
112
124
|
|
|
113
125
|
<SbContent>
|
|
114
|
-
To enable the reversed theme, you will need to the component or application in the
|
|
126
|
+
To enable the reversed theme, you will need to the component or application in the
|
|
127
|
+
`ReversedColors` provider.
|
|
115
128
|
</SbContent>
|
|
116
129
|
|
|
117
130
|
```JSX
|
|
@@ -121,42 +134,33 @@ import * as exampleStories from "./Tooltip.stories"
|
|
|
121
134
|
```
|
|
122
135
|
|
|
123
136
|
<SbContent className="mb-64">
|
|
124
|
-
These utilities can be imported from `@kaizen/components/v3/utilities`. This is an emerging
|
|
137
|
+
These utilities can be imported from `@kaizen/components/v3/utilities`. This is an emerging
|
|
138
|
+
pattern so more documentation will come.
|
|
125
139
|
</SbContent>
|
|
126
140
|
|
|
127
141
|
<SbContent className="mb-32">
|
|
128
142
|
## Examples
|
|
129
143
|
|
|
130
|
-
|
|
131
|
-
</SbContent>
|
|
144
|
+
Here are examples of how to use the `Tooltip` with compatible Kaizen components.
|
|
132
145
|
|
|
133
|
-
<SbContent>
|
|
134
|
-
### On Button
|
|
135
146
|
</SbContent>
|
|
136
147
|
|
|
148
|
+
<SbContent>### On Button</SbContent>
|
|
149
|
+
|
|
137
150
|
<Canvas of={exampleStories.OnButton} />
|
|
138
151
|
|
|
139
|
-
<SbContent>
|
|
140
|
-
### On Link
|
|
141
|
-
</SbContent>
|
|
152
|
+
<SbContent>### On Link</SbContent>
|
|
142
153
|
|
|
143
154
|
<Canvas of={exampleStories.OnLink} />
|
|
144
155
|
|
|
145
|
-
<SbContent>
|
|
146
|
-
### On IconButton
|
|
147
|
-
</SbContent>
|
|
156
|
+
<SbContent>### On IconButton</SbContent>
|
|
148
157
|
|
|
149
158
|
<Canvas of={exampleStories.OnIconButton} />
|
|
150
159
|
|
|
151
|
-
<SbContent>
|
|
152
|
-
### On Tabs
|
|
153
|
-
</SbContent>
|
|
160
|
+
<SbContent>### On Tabs</SbContent>
|
|
154
161
|
|
|
155
162
|
<Canvas of={exampleStories.OnTabs} />
|
|
156
163
|
|
|
157
|
-
<SbContent>
|
|
158
|
-
### On Tag
|
|
159
|
-
</SbContent>
|
|
164
|
+
<SbContent>### On Tag</SbContent>
|
|
160
165
|
|
|
161
166
|
<Canvas of={exampleStories.OnCustomFocusableElement} />
|
|
162
|
-
|