@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,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
|
-
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
import { Canvas, Meta, Controls } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 TooltipStories from './Tooltip.docs.stories'
|
|
10
|
+
import AnatomyPng from './assets/tooltip_anatomy.png'
|
|
11
|
+
import PlacementPng from './assets/tooltip_placement.png'
|
|
12
|
+
import DesignSpecPng from './assets/tooltip_spec.png'
|
|
13
|
+
import WhenToUsePng from './assets/tooltip_variant.png'
|
|
8
14
|
|
|
9
15
|
<Meta title="Overlays/Tooltip/v3/Usage Guidelines" />
|
|
10
16
|
|
|
11
17
|
<SbContent>
|
|
12
18
|
# Tooltip (v3)
|
|
13
19
|
|
|
14
|
-
|
|
15
|
-
</SbContent>
|
|
20
|
+
Updated June 25, 2024
|
|
16
21
|
|
|
22
|
+
</SbContent>
|
|
17
23
|
|
|
18
24
|
<ResourceLinks
|
|
19
25
|
sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/Tooltip"
|
|
@@ -29,50 +35,57 @@ import WhenToUsePng from "./assets/tooltip_variant.png"
|
|
|
29
35
|
importStatement='import { Tooltip, TooltipTrigger } from "@kaizen/components/v3/overlays"'
|
|
30
36
|
/>
|
|
31
37
|
|
|
32
|
-
|
|
38
|
+
## Overview
|
|
33
39
|
|
|
34
|
-
|
|
35
|
-
</SbContent>
|
|
40
|
+
Tooltips are brief floating labels used to add additional contextual information when users hover, click or focus on an interactive element. These should offer concise explanations, elaborating on the element they are associated with.
|
|
36
41
|
|
|
42
|
+
</SbContent>
|
|
37
43
|
|
|
38
44
|
<Canvas
|
|
39
45
|
of={TooltipStories.Playground}
|
|
40
|
-
source={{
|
|
46
|
+
source={{
|
|
47
|
+
code: `
|
|
41
48
|
<TooltipTrigger>
|
|
42
49
|
<Button label="Button" />
|
|
43
50
|
<Tooltip>Tooltip content</Tooltip>
|
|
44
51
|
</TooltipTrigger>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
`,
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
<Controls of={TooltipStories.Playground} include={['placement', 'isOpen']} className="mb-64" />
|
|
49
56
|
|
|
50
57
|
<SbContent className="mb-64">
|
|
51
58
|
### Anatomy
|
|
52
59
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
- The anatomy of a tooltip is made up of a container, description and arrow.
|
|
61
|
+
- **They do not include a title or heading**. If you need to include a title, use a Popover
|
|
62
|
+
- A tooltip is connected to a trigger element, such as a button or icon, that shows the tooltip when the interactive trigger element is hovered or focused. (More details below.)
|
|
63
|
+
|
|
64
|
+
<img
|
|
65
|
+
src={AnatomyPng}
|
|
66
|
+
alt="Indicates the anatomy of the Tooltip component, the Container, Label, Arrow and Trigger"
|
|
67
|
+
className="mt-24"
|
|
68
|
+
/>
|
|
56
69
|
|
|
57
|
-
<img src={AnatomyPng} alt="Indicates the anatomy of the Tooltip component, the Container, Label, Arrow and Trigger" className="mt-24" />
|
|
58
70
|
</ SbContent>
|
|
59
71
|
|
|
60
72
|
<SbContent className="mb-64">
|
|
61
73
|
### When to use
|
|
62
74
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
75
|
+
- Tooltips are used to provide additional information when space is tight.
|
|
76
|
+
- Tooltips must be concise with one or more lines of text.
|
|
77
|
+
- Tooltips must be accessible via hover and focus only.
|
|
78
|
+
- Trigger tooltips from Interactive elements (Buttons, Links, Icon buttons) or Non-interactive elements (Icons, Abbreviations Truncated text)—be mindful of keyboard accessibility
|
|
79
|
+
- **Never include any kind of error messages** in a tooltip
|
|
80
|
+
|
|
81
|
+
<img src={WhenToUsePng} className="mt-32" alt="Illustration of when to use the Tooltip component" />
|
|
68
82
|
|
|
69
|
-
<img src={WhenToUsePng} className="mt-32" alt="Illustration of when to use the Tooltip component" />
|
|
70
83
|
</ SbContent>
|
|
71
84
|
|
|
72
85
|
<SbContent className="mb-64">
|
|
73
86
|
### Specs
|
|
74
87
|
<img src={DesignSpecPng} alt="" />
|
|
75
|
-
</
|
|
88
|
+
</SbContent>
|
|
76
89
|
|
|
77
90
|
<div className="flex flex-col mt-16 gap-40 mb-64">
|
|
78
91
|
<div className="flex flex-col m-0 gap-16">
|
|
@@ -95,6 +108,7 @@ import WhenToUsePng from "./assets/tooltip_variant.png"
|
|
|
95
108
|
<DoOrDont story={TooltipStories.DoFieldTooltip} />
|
|
96
109
|
<DoOrDont story={TooltipStories.DontFieldTooltip} isDont />
|
|
97
110
|
</DosAndDonts>
|
|
111
|
+
|
|
98
112
|
</div>
|
|
99
113
|
|
|
100
114
|
<div className="flex flex-col m-0 gap-16">
|
|
@@ -107,42 +121,44 @@ import WhenToUsePng from "./assets/tooltip_variant.png"
|
|
|
107
121
|
<DoOrDont story={TooltipStories.DoConcise}/>
|
|
108
122
|
<DoOrDont story={TooltipStories.DontConcise} isDont />
|
|
109
123
|
</DosAndDonts>
|
|
124
|
+
|
|
110
125
|
</div>
|
|
111
126
|
</div>
|
|
112
127
|
|
|
113
128
|
<SbContent className="mb-64">
|
|
114
129
|
### Placements
|
|
115
130
|
|
|
116
|
-
|
|
131
|
+
{' '}
|
|
132
|
+
|
|
133
|
+
<img src={PlacementPng} alt="" className="mb-24" />
|
|
134
|
+
|
|
135
|
+
- Type: Dropdown to choose from Default (dark tooltip) and Reverse (light tooltip)
|
|
136
|
+
- Direction: Dropdown to choose where the arrow points
|
|
137
|
+
- Tooltip label: Input field allows you to type in the label from the properties panel
|
|
138
|
+
- Use strong signifiers for trigger elements to ensure the tooltip is discoverable.
|
|
139
|
+
- The proximity of tooltips is always paired to the element with which they are associated.
|
|
117
140
|
|
|
118
|
-
- Type: Dropdown to choose from Default (dark tooltip) and Reverse (light tooltip)
|
|
119
|
-
- Direction: Dropdown to choose where the arrow points
|
|
120
|
-
- Tooltip label: Input field allows you to type in the label from the properties panel
|
|
121
|
-
- Use strong signifiers for trigger elements to ensure the tooltip is discoverable.
|
|
122
|
-
- The proximity of tooltips is always paired to the element with which they are associated.
|
|
123
141
|
</SbContent>
|
|
124
142
|
|
|
125
143
|
<SbContent className="mb-24">
|
|
126
144
|
### Trigger
|
|
127
145
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
146
|
+
- A tooltip trigger needs to be discoverable:
|
|
147
|
+
- E.g. something like an icon to suggest there’s a tooltip.
|
|
148
|
+
- Avoid triggering tooltips from text that excludes a visual indicator (e.g. underline)
|
|
149
|
+
- A tooltip should be shown and accessible on hover, click or on focus events.
|
|
150
|
+
|
|
132
151
|
</SbContent>
|
|
133
152
|
|
|
134
153
|
<div className="mb-32">
|
|
135
154
|
<DosAndDonts>
|
|
136
155
|
<DoOrDont story={TooltipStories.TriggerDo} />
|
|
137
|
-
<DoOrDont story={TooltipStories.TriggerDont} isDont/>
|
|
156
|
+
<DoOrDont story={TooltipStories.TriggerDont} isDont />
|
|
138
157
|
</DosAndDonts>
|
|
139
158
|
</div>
|
|
140
159
|
|
|
141
160
|
<SbContent className="mb-24">
|
|
142
|
-
- Only trigger tooltips from interactive elements, such as:
|
|
143
|
-
- Buttons
|
|
144
|
-
- Links
|
|
145
|
-
- Icon buttons
|
|
161
|
+
- Only trigger tooltips from interactive elements, such as: - Buttons - Links - Icon buttons
|
|
146
162
|
</SbContent>
|
|
147
163
|
|
|
148
164
|
<div className="mb-32">
|
|
@@ -153,9 +169,8 @@ import WhenToUsePng from "./assets/tooltip_variant.png"
|
|
|
153
169
|
</div>
|
|
154
170
|
|
|
155
171
|
<SbContent>
|
|
156
|
-
- Non-interactive elements (be mindful of keyboard accessibility):
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
- For interactive elements that trigger tooltips, only have optional information in the tooltip because it could be missed when the user clicks
|
|
172
|
+
- Non-interactive elements (be mindful of keyboard accessibility): - Icons - Abbreviations (e.g.
|
|
173
|
+
dashed underlined text for HRIS that shows a tooltip that says Human Resource Information System)
|
|
174
|
+
- Truncated text - For interactive elements that trigger tooltips, only have optional information
|
|
175
|
+
in the tooltip because it could be missed when the user clicks
|
|
161
176
|
</SbContent>
|