@kaizen/components 1.79.2 → 1.79.4
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/dist/cjs/src/Menu/subcomponents/StatelessMenu/StatelessMenu.cjs +0 -1
- package/dist/cjs/src/__next__/Tabs/subcomponents/TabList/TabList.cjs +3 -3
- package/dist/esm/src/Menu/subcomponents/StatelessMenu/StatelessMenu.mjs +0 -1
- package/dist/esm/src/__next__/Tabs/subcomponents/TabList/TabList.mjs +3 -3
- package/dist/styles.css +9 -0
- package/dist/types/Menu/subcomponents/StatelessMenu/StatelessMenu.d.ts +0 -1
- package/package.json +1 -1
- package/src/Menu/subcomponents/StatelessMenu/StatelessMenu.tsx +0 -2
- package/src/Modal/GenericModal/GenericModal.module.scss +2 -0
- package/src/Modal/GenericModal/_docs/GenericModal.spec.stories.tsx +6 -1
- package/src/__next__/Button/_docs/Button--migration-guide.mdx +12 -5
- package/src/__next__/Icon/_docs/Icon--migration-guide.mdx +11 -3
- package/src/__next__/Tabs/_docs/Tabs--migration-guide.mdx +10 -2
- package/src/__next__/Tabs/_docs/Tabs.spec.stories.tsx +48 -3
- package/src/__next__/Tabs/_docs/Tabs.stories.tsx +13 -2
- package/src/__next__/Tabs/subcomponents/TabList/TabList.tsx +3 -3
- package/src/__next__/Tooltip/_docs/Tooltip--migration-guide.mdx +62 -0
|
@@ -70,7 +70,7 @@ var TabList = function (props) {
|
|
|
70
70
|
}
|
|
71
71
|
setLeftArrowEnabled(false);
|
|
72
72
|
}, {
|
|
73
|
-
threshold: 0.
|
|
73
|
+
threshold: 0.8,
|
|
74
74
|
root: containerElement
|
|
75
75
|
});
|
|
76
76
|
firstTabObserver.observe(isRTL$1 ? tabs[tabs.length - 1] : tabs[0]);
|
|
@@ -81,7 +81,7 @@ var TabList = function (props) {
|
|
|
81
81
|
}
|
|
82
82
|
setRightArrowEnabled(false);
|
|
83
83
|
}, {
|
|
84
|
-
threshold: 0.
|
|
84
|
+
threshold: 0.8,
|
|
85
85
|
root: containerElement
|
|
86
86
|
});
|
|
87
87
|
lastTabObserver.observe(isRTL$1 ? tabs[0] : tabs[tabs.length - 1]);
|
|
@@ -89,7 +89,7 @@ var TabList = function (props) {
|
|
|
89
89
|
firstTabObserver.disconnect();
|
|
90
90
|
lastTabObserver.disconnect();
|
|
91
91
|
};
|
|
92
|
-
}, [isDocumentReady, containerElement, isRTL$1]);
|
|
92
|
+
}, [isDocumentReady, containerElement, isRTL$1, tabListContext === null || tabListContext === void 0 ? void 0 : tabListContext.collection.size]);
|
|
93
93
|
React.useEffect(function () {
|
|
94
94
|
var _a;
|
|
95
95
|
if (!isDocumentReady) {
|
|
@@ -61,7 +61,7 @@ var TabList = function (props) {
|
|
|
61
61
|
}
|
|
62
62
|
setLeftArrowEnabled(false);
|
|
63
63
|
}, {
|
|
64
|
-
threshold: 0.
|
|
64
|
+
threshold: 0.8,
|
|
65
65
|
root: containerElement
|
|
66
66
|
});
|
|
67
67
|
firstTabObserver.observe(isRTL$1 ? tabs[tabs.length - 1] : tabs[0]);
|
|
@@ -72,7 +72,7 @@ var TabList = function (props) {
|
|
|
72
72
|
}
|
|
73
73
|
setRightArrowEnabled(false);
|
|
74
74
|
}, {
|
|
75
|
-
threshold: 0.
|
|
75
|
+
threshold: 0.8,
|
|
76
76
|
root: containerElement
|
|
77
77
|
});
|
|
78
78
|
lastTabObserver.observe(isRTL$1 ? tabs[0] : tabs[tabs.length - 1]);
|
|
@@ -80,7 +80,7 @@ var TabList = function (props) {
|
|
|
80
80
|
firstTabObserver.disconnect();
|
|
81
81
|
lastTabObserver.disconnect();
|
|
82
82
|
};
|
|
83
|
-
}, [isDocumentReady, containerElement, isRTL$1]);
|
|
83
|
+
}, [isDocumentReady, containerElement, isRTL$1, tabListContext === null || tabListContext === void 0 ? void 0 : tabListContext.collection.size]);
|
|
84
84
|
useEffect(function () {
|
|
85
85
|
var _a;
|
|
86
86
|
if (!isDocumentReady) {
|
package/dist/styles.css
CHANGED
|
@@ -1853,6 +1853,7 @@
|
|
|
1853
1853
|
position: relative;
|
|
1854
1854
|
border: 1px solid transparent;
|
|
1855
1855
|
border-radius: var(--border-borderless-border-radius);
|
|
1856
|
+
z-index: 0;
|
|
1856
1857
|
}
|
|
1857
1858
|
|
|
1858
1859
|
/* This absolute element is used to give the illusion of a gradient border without expanding the size of the Well/Card */
|
|
@@ -6329,6 +6330,8 @@
|
|
|
6329
6330
|
.GenericModal-module_transitionLayer__zTH-C {
|
|
6330
6331
|
transition: opacity var(--animation-duration-fast, 300ms) ease-in-out;
|
|
6331
6332
|
opacity: 1;
|
|
6333
|
+
position: relative;
|
|
6334
|
+
z-index: 1050;
|
|
6332
6335
|
}
|
|
6333
6336
|
.GenericModal-module_transitionLayer__zTH-C .GenericModal-module_backdropLayer__RNQ-U {
|
|
6334
6337
|
/*
|
|
@@ -6720,6 +6723,8 @@
|
|
|
6720
6723
|
.ConfirmationModal-module_transitionLayer__Ue95T {
|
|
6721
6724
|
transition: opacity var(--animation-duration-fast, 300ms) ease-in-out;
|
|
6722
6725
|
opacity: 1;
|
|
6726
|
+
position: relative;
|
|
6727
|
+
z-index: 1050;
|
|
6723
6728
|
}
|
|
6724
6729
|
.ConfirmationModal-module_transitionLayer__Ue95T .ConfirmationModal-module_backdropLayer__wvXnl {
|
|
6725
6730
|
/*
|
|
@@ -7070,6 +7075,8 @@
|
|
|
7070
7075
|
.ContextModal-module_transitionLayer__IjJem {
|
|
7071
7076
|
transition: opacity var(--animation-duration-fast, 300ms) ease-in-out;
|
|
7072
7077
|
opacity: 1;
|
|
7078
|
+
position: relative;
|
|
7079
|
+
z-index: 1050;
|
|
7073
7080
|
}
|
|
7074
7081
|
.ContextModal-module_transitionLayer__IjJem .ContextModal-module_backdropLayer__wuj3B {
|
|
7075
7082
|
/*
|
|
@@ -7394,6 +7401,8 @@
|
|
|
7394
7401
|
.InputEditModal-module_transitionLayer__1B3VI {
|
|
7395
7402
|
transition: opacity var(--animation-duration-fast, 300ms) ease-in-out;
|
|
7396
7403
|
opacity: 1;
|
|
7404
|
+
position: relative;
|
|
7405
|
+
z-index: 1050;
|
|
7397
7406
|
}
|
|
7398
7407
|
.InputEditModal-module_transitionLayer__1B3VI .InputEditModal-module_backdropLayer__aVLSb {
|
|
7399
7408
|
/*
|
|
@@ -41,7 +41,6 @@ export type StatelessMenuProps = {
|
|
|
41
41
|
'renderButton': (args: {
|
|
42
42
|
'onClick': (e: any) => void;
|
|
43
43
|
'onMouseDown': (e: any) => void;
|
|
44
|
-
'aria-haspopup': boolean;
|
|
45
44
|
'aria-expanded': boolean;
|
|
46
45
|
}) => React.ReactElement;
|
|
47
46
|
'onClick'?: (event: SyntheticEvent) => void;
|
package/package.json
CHANGED
|
@@ -46,7 +46,6 @@ export type StatelessMenuProps = {
|
|
|
46
46
|
'renderButton': (args: {
|
|
47
47
|
'onClick': (e: any) => void
|
|
48
48
|
'onMouseDown': (e: any) => void
|
|
49
|
-
'aria-haspopup': boolean
|
|
50
49
|
'aria-expanded': boolean
|
|
51
50
|
}) => React.ReactElement
|
|
52
51
|
'onClick'?: (event: SyntheticEvent) => void
|
|
@@ -76,7 +75,6 @@ export const StatelessMenu = ({
|
|
|
76
75
|
toggleMenuDropdown()
|
|
77
76
|
},
|
|
78
77
|
'onMouseDown': (e: React.MouseEvent<Element, MouseEvent>) => e.preventDefault(),
|
|
79
|
-
'aria-haspopup': true,
|
|
80
78
|
'aria-expanded': isMenuVisible,
|
|
81
79
|
})
|
|
82
80
|
|
|
@@ -21,7 +21,11 @@ export const TestBase: Story = {
|
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
23
|
<>
|
|
24
|
-
<button
|
|
24
|
+
<button
|
|
25
|
+
type="button"
|
|
26
|
+
className="border border-gray-500 relative z-10"
|
|
27
|
+
onClick={() => setIsOpen(true)}
|
|
28
|
+
>
|
|
25
29
|
Open Modal
|
|
26
30
|
</button>
|
|
27
31
|
<GenericModal
|
|
@@ -30,6 +34,7 @@ export const TestBase: Story = {
|
|
|
30
34
|
onOutsideModalClick={handleDismiss}
|
|
31
35
|
onEscapeKeyup={handleDismiss}
|
|
32
36
|
id="GenericModalTestId"
|
|
37
|
+
className="will-change-[opacity]"
|
|
33
38
|
>
|
|
34
39
|
<ModalHeader>
|
|
35
40
|
<ModalAccessibleLabel>Test Modal</ModalAccessibleLabel>
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ResourceLinks, KAIOInstallation } from '~storybook/components'
|
|
1
|
+
import { Meta } from '@storybook/blocks'
|
|
3
2
|
|
|
4
|
-
<Meta title="Components/Button/Migration
|
|
3
|
+
<Meta title="Components/Button/Migration guide" />
|
|
5
4
|
|
|
6
|
-
# Button
|
|
5
|
+
# Button migration guide
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Audience
|
|
8
|
+
|
|
9
|
+
This guide is relevant for Kaizen All-In-One (KAIO) v1 consumers.
|
|
10
|
+
|
|
11
|
+
## Purpose
|
|
12
|
+
|
|
13
|
+
This guide provides instructions for migrating button usage from `deprecated` (`@kaizen/components`) `Button` and `IconButton` components to `next` (`@kaizen/components/next`) `Button` and `LinkButton` components.
|
|
14
|
+
|
|
15
|
+
This migration is a prerequisite for [migrating to KAIO v2](/docs/releases-upcoming-major-releases--docs).
|
|
9
16
|
|
|
10
17
|
## Key API differences
|
|
11
18
|
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Meta, Story } from '@storybook/blocks'
|
|
2
|
+
import { LinkTo } from '~storybook/components'
|
|
3
3
|
import * as IconStories from './Icon.docs.stories'
|
|
4
4
|
|
|
5
5
|
<Meta title="Components/Icon/Migration guide" />
|
|
6
6
|
|
|
7
7
|
# Icon migration guide
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Audience
|
|
10
|
+
|
|
11
|
+
This guide is relevant for Kaizen All-In-One (KAIO) v1 consumers.
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
This guide provides instructions for migrating icon usage from the `deprecated` (`@kaizen/components`) `*Icon` components to the `next` (`@kaizen/components/next`) `Icon` component.
|
|
16
|
+
|
|
17
|
+
This migration is a prerequisite for [migrating to KAIO v2](/docs/releases-upcoming-major-releases--docs).
|
|
10
18
|
|
|
11
19
|
## Codemod
|
|
12
20
|
|
|
@@ -2,9 +2,17 @@ import { Meta } from '@storybook/blocks'
|
|
|
2
2
|
|
|
3
3
|
<Meta title="Components/Tabs/Migration guide" />
|
|
4
4
|
|
|
5
|
-
#
|
|
5
|
+
# Tabs migration guide
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Audience
|
|
8
|
+
|
|
9
|
+
This guide is relevant for Kaizen All-In-One (KAIO) v1 consumers.
|
|
10
|
+
|
|
11
|
+
## Purpose
|
|
12
|
+
|
|
13
|
+
This guide provides instructions for migrating tabs usage from the `deprecated` (`@kaizen/components`) `Tabs` component to the `next` (`@kaizen/components/next`) `Tabs` component.
|
|
14
|
+
|
|
15
|
+
This migration is a prerequisite for [migrating to KAIO v2](/docs/releases-upcoming-major-releases--docs).
|
|
8
16
|
|
|
9
17
|
## Why the change?
|
|
10
18
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
2
|
import { type Meta, type StoryObj } from '@storybook/react'
|
|
3
|
-
import { expect, userEvent, within } from '@storybook/test'
|
|
3
|
+
import { expect, userEvent, waitFor, within } from '@storybook/test'
|
|
4
4
|
import { Text } from '~components/Text'
|
|
5
|
-
import { Tab, TabList, TabPanel, Tabs } from '../index'
|
|
5
|
+
import { Tab, TabList, TabPanel, Tabs, type Key } from '../index'
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
8
8
|
title: 'Components/Tabs/Tabs (next)/Tabs (next) tests',
|
|
@@ -116,3 +116,48 @@ export const ArrowsShowingAndHidingRTL: Story = {
|
|
|
116
116
|
expect(leftArrow).not.toBeInTheDocument()
|
|
117
117
|
},
|
|
118
118
|
}
|
|
119
|
+
|
|
120
|
+
export const AsyncLoaded: Story = {
|
|
121
|
+
render: () => {
|
|
122
|
+
const [selectedKey, setSelectedKey] = useState<Key>(0)
|
|
123
|
+
|
|
124
|
+
const [showSecondTab, setShowSecondTab] = React.useState(false)
|
|
125
|
+
React.useEffect(() => {
|
|
126
|
+
const timer = setTimeout(() => setShowSecondTab(true), 1000)
|
|
127
|
+
return () => clearTimeout(timer)
|
|
128
|
+
}, [])
|
|
129
|
+
return (
|
|
130
|
+
<div style={{ maxWidth: '300px' }}>
|
|
131
|
+
<Tabs selectedKey={selectedKey} onSelectionChange={setSelectedKey}>
|
|
132
|
+
<TabList aria-label="Tabs" data-testid="sb-arrows">
|
|
133
|
+
<Tab id="one">Conversation</Tab>
|
|
134
|
+
{showSecondTab && <Tab id="two">Personal notes</Tab>}
|
|
135
|
+
</TabList>
|
|
136
|
+
<TabPanel id="one" className="p-24">
|
|
137
|
+
<Text variant="body">Content 1</Text>
|
|
138
|
+
</TabPanel>
|
|
139
|
+
<TabPanel id="two" className="p-24">
|
|
140
|
+
<Text variant="body">Content 2</Text>
|
|
141
|
+
</TabPanel>
|
|
142
|
+
</Tabs>
|
|
143
|
+
</div>
|
|
144
|
+
)
|
|
145
|
+
},
|
|
146
|
+
play: async ({ canvasElement, step }) => {
|
|
147
|
+
const canvas = within(canvasElement.parentElement!)
|
|
148
|
+
expect(canvas.queryByTestId('kz-tablist-right-arrow')).not.toBeInTheDocument()
|
|
149
|
+
await waitFor(() => userEvent.click(canvasElement))
|
|
150
|
+
await new Promise((r) => setTimeout(r, 2000))
|
|
151
|
+
|
|
152
|
+
await step('Check if second tab is loaded', async () => {
|
|
153
|
+
await waitFor(() => {
|
|
154
|
+
expect(canvas.queryByText('Personal notes')).toBeInTheDocument()
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
await waitFor(async () => {
|
|
158
|
+
const rightTab = await canvas.findByTestId('sb-arrows-kz-tablist-right-arrow')
|
|
159
|
+
expect(rightTab).toBeInTheDocument()
|
|
160
|
+
})
|
|
161
|
+
})
|
|
162
|
+
},
|
|
163
|
+
}
|
|
@@ -66,11 +66,22 @@ export const Playground: Story = {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
export const Controlled: Story = {
|
|
69
|
-
render: (
|
|
69
|
+
render: () => {
|
|
70
70
|
const [selectedKey, setSelectedKey] = useState<Key>(0)
|
|
71
71
|
return (
|
|
72
72
|
<>
|
|
73
|
-
<Tabs
|
|
73
|
+
<Tabs selectedKey={selectedKey} onSelectionChange={setSelectedKey}>
|
|
74
|
+
<TabList aria-label="Tabs">
|
|
75
|
+
<Tab id="one">Tab 1</Tab>
|
|
76
|
+
<Tab id="two">Tab 2</Tab>
|
|
77
|
+
</TabList>
|
|
78
|
+
<TabPanel id="one" className="p-24">
|
|
79
|
+
<Text variant="body">Content 1</Text>
|
|
80
|
+
</TabPanel>
|
|
81
|
+
<TabPanel id="two" className="p-24">
|
|
82
|
+
<Text variant="body">Content 2</Text>
|
|
83
|
+
</TabPanel>
|
|
84
|
+
</Tabs>
|
|
74
85
|
<Button label="Switch to tab 2" onClick={(): void => setSelectedKey('two')} />
|
|
75
86
|
</>
|
|
76
87
|
)
|
|
@@ -75,7 +75,7 @@ export const TabList = (props: TabListProps): JSX.Element => {
|
|
|
75
75
|
setLeftArrowEnabled(false)
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
|
-
threshold: 0.
|
|
78
|
+
threshold: 0.8,
|
|
79
79
|
root: containerElement,
|
|
80
80
|
},
|
|
81
81
|
)
|
|
@@ -90,7 +90,7 @@ export const TabList = (props: TabListProps): JSX.Element => {
|
|
|
90
90
|
setRightArrowEnabled(false)
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
|
-
threshold: 0.
|
|
93
|
+
threshold: 0.8,
|
|
94
94
|
root: containerElement,
|
|
95
95
|
},
|
|
96
96
|
)
|
|
@@ -100,7 +100,7 @@ export const TabList = (props: TabListProps): JSX.Element => {
|
|
|
100
100
|
firstTabObserver.disconnect()
|
|
101
101
|
lastTabObserver.disconnect()
|
|
102
102
|
}
|
|
103
|
-
}, [isDocumentReady, containerElement, isRTL])
|
|
103
|
+
}, [isDocumentReady, containerElement, isRTL, tabListContext?.collection.size])
|
|
104
104
|
|
|
105
105
|
useEffect(() => {
|
|
106
106
|
if (!isDocumentReady) {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Meta } from '@storybook/blocks'
|
|
2
|
+
|
|
3
|
+
<Meta title="Components/Tooltip/Migration guide" />
|
|
4
|
+
|
|
5
|
+
# Tooltip migration guide
|
|
6
|
+
|
|
7
|
+
## Audience
|
|
8
|
+
|
|
9
|
+
This guide is relevant for Kaizen All-In-One (KAIO) v1 consumers.
|
|
10
|
+
|
|
11
|
+
## Purpose
|
|
12
|
+
|
|
13
|
+
This guide provides instructions for migrating tooltip usage from the `deprecated` (`@kaizen/components`) `Tooltip` component to the `next` (`@kaizen/components/next`) `Tooltip` component.
|
|
14
|
+
|
|
15
|
+
This migration is a prerequisite for [migrating to KAIO v2](/docs/releases-upcoming-major-releases--docs).
|
|
16
|
+
|
|
17
|
+
## Key API changes
|
|
18
|
+
|
|
19
|
+
The `next` tooltip separates its functionality into two distinct components:
|
|
20
|
+
|
|
21
|
+
- `TooltipTrigger` component wraps the `Tooltip` component and its trigger element, and controls open and close interactions.
|
|
22
|
+
- `Tooltip` component provides the tooltip's content and controls its placement.
|
|
23
|
+
|
|
24
|
+
Other notable changes:
|
|
25
|
+
|
|
26
|
+
- `animationDuration` prop is retired
|
|
27
|
+
- `children` prop becomes `TooltipTrigger.Children`
|
|
28
|
+
- `display` prop is retired
|
|
29
|
+
- `isInitiallyVisible` prop becomes `Tooltip.defaultOpen`
|
|
30
|
+
- `mood` prop is retired
|
|
31
|
+
- This change aligns with a broader move towards more judicious use of colour
|
|
32
|
+
- `portalSelector` prop is retired
|
|
33
|
+
- Where needed, [PortalProvider](https://react-spectrum.adobe.com/react-aria/PortalProvider.html) can be used to control portalling behaviour
|
|
34
|
+
- `position` prop becomes `Tooltip.placement`, and values are mapped as follows:
|
|
35
|
+
- `above` becomes `top`
|
|
36
|
+
- `below` becomes `bottom`
|
|
37
|
+
- `left` becomes `start`
|
|
38
|
+
- `right` becomes `end`
|
|
39
|
+
- `text` prop becomes `Tooltip.Children`
|
|
40
|
+
|
|
41
|
+
## Migration example
|
|
42
|
+
|
|
43
|
+
### Before
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
<Tooltip text="Content" position="above">
|
|
47
|
+
<Button>Trigger</Button>
|
|
48
|
+
</Tooltip>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### After
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
<TooltipTrigger>
|
|
55
|
+
<Button>Trigger</Button>
|
|
56
|
+
<Tooltip placement="top">Content</Tooltip>
|
|
57
|
+
</TooltipTrigger>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## More information
|
|
61
|
+
|
|
62
|
+
More information about the `next` `Tooltip` component can be found at [API Specification](/docs/components-tooltip-tooltip-next-api-specification--docs) and [Usage Guidelines](/docs/components-tooltip-tooltip-next-usage-guidelines--docs).
|