@kaizen/components 1.79.2 → 1.79.3

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.
@@ -70,7 +70,7 @@ var TabList = function (props) {
70
70
  }
71
71
  setLeftArrowEnabled(false);
72
72
  }, {
73
- threshold: 0.75,
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.75,
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.75,
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,
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
@@ -6329,6 +6329,8 @@
6329
6329
  .GenericModal-module_transitionLayer__zTH-C {
6330
6330
  transition: opacity var(--animation-duration-fast, 300ms) ease-in-out;
6331
6331
  opacity: 1;
6332
+ position: relative;
6333
+ z-index: 1050;
6332
6334
  }
6333
6335
  .GenericModal-module_transitionLayer__zTH-C .GenericModal-module_backdropLayer__RNQ-U {
6334
6336
  /*
@@ -6720,6 +6722,8 @@
6720
6722
  .ConfirmationModal-module_transitionLayer__Ue95T {
6721
6723
  transition: opacity var(--animation-duration-fast, 300ms) ease-in-out;
6722
6724
  opacity: 1;
6725
+ position: relative;
6726
+ z-index: 1050;
6723
6727
  }
6724
6728
  .ConfirmationModal-module_transitionLayer__Ue95T .ConfirmationModal-module_backdropLayer__wvXnl {
6725
6729
  /*
@@ -7070,6 +7074,8 @@
7070
7074
  .ContextModal-module_transitionLayer__IjJem {
7071
7075
  transition: opacity var(--animation-duration-fast, 300ms) ease-in-out;
7072
7076
  opacity: 1;
7077
+ position: relative;
7078
+ z-index: 1050;
7073
7079
  }
7074
7080
  .ContextModal-module_transitionLayer__IjJem .ContextModal-module_backdropLayer__wuj3B {
7075
7081
  /*
@@ -7394,6 +7400,8 @@
7394
7400
  .InputEditModal-module_transitionLayer__1B3VI {
7395
7401
  transition: opacity var(--animation-duration-fast, 300ms) ease-in-out;
7396
7402
  opacity: 1;
7403
+ position: relative;
7404
+ z-index: 1050;
7397
7405
  }
7398
7406
  .InputEditModal-module_transitionLayer__1B3VI .InputEditModal-module_backdropLayer__aVLSb {
7399
7407
  /*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaizen/components",
3
- "version": "1.79.2",
3
+ "version": "1.79.3",
4
4
  "description": "Kaizen component library",
5
5
  "author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
6
6
  "homepage": "https://cultureamp.design",
@@ -68,6 +68,8 @@
68
68
  .transitionLayer {
69
69
  transition: opacity $ca-duration-fast ease-in-out;
70
70
  opacity: 1;
71
+ position: relative;
72
+ z-index: $ca-z-index-modal;
71
73
 
72
74
  .backdropLayer {
73
75
  /*
@@ -21,7 +21,11 @@ export const TestBase: Story = {
21
21
 
22
22
  return (
23
23
  <>
24
- <button type="button" className="border border-gray-500" onClick={() => setIsOpen(true)}>
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 { Canvas, Meta, Controls, Story } from '@storybook/blocks'
2
- import { ResourceLinks, KAIOInstallation } from '~storybook/components'
1
+ import { Meta } from '@storybook/blocks'
3
2
 
4
- <Meta title="Components/Button/Migration Guide" />
3
+ <Meta title="Components/Button/Migration guide" />
5
4
 
6
- # Button Migration Guide (next)
5
+ # Button migration guide
7
6
 
8
- This is a short guide to assist in migration from the old to new `Button` and `LinkButton` component.
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 { Canvas, Meta, Controls, Story } from '@storybook/blocks'
2
- import { ResourceLinks, KAIOInstallation, LinkTo } from '~storybook/components'
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
- This is a short guide to assist in migration from the old to new Icon component.
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
- # Next Tabs migration guide
5
+ # Tabs migration guide
6
6
 
7
- A brief guide on how and why to migrate from Kaizen's current `Tabs` to the `next` release.
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: (args) => {
69
+ render: () => {
70
70
  const [selectedKey, setSelectedKey] = useState<Key>(0)
71
71
  return (
72
72
  <>
73
- <Tabs {...args} selectedKey={selectedKey} onSelectionChange={setSelectedKey} />
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.75,
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.75,
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).