@kaizen/components 1.80.6 → 1.81.1
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/index.cjs +3 -0
- package/dist/cjs/reactAriaComponentsKZ.cjs +11 -0
- package/dist/cjs/reactAriaKZ.cjs +11 -0
- package/dist/cjs/src/Illustration/Spot/Spot.cjs +9 -0
- package/dist/cjs/src/Modal/GenericModal/GenericModal.cjs +33 -65
- package/dist/cjs/src/Modal/GenericModal/GenericModal.module.scss.cjs +1 -3
- package/dist/cjs/utilitiesV3.cjs +3 -0
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/reactAriaComponentsKZ.mjs +1 -0
- package/dist/esm/reactAriaKZ.mjs +1 -0
- package/dist/esm/src/Illustration/Spot/Spot.mjs +7 -1
- package/dist/esm/src/Modal/GenericModal/GenericModal.mjs +34 -65
- package/dist/esm/src/Modal/GenericModal/GenericModal.module.scss.mjs +1 -3
- package/dist/esm/utilitiesV3.mjs +1 -1
- package/dist/styles.css +9682 -9682
- package/dist/types/Illustration/Spot/Spot.d.ts +3 -0
- package/dist/types/__libs__/react-aria/index.d.ts +1 -0
- package/dist/types/__libs__/react-aria-components/index.d.ts +1 -0
- package/libs/README.md +7 -0
- package/libs/react-aria/package.json +5 -0
- package/libs/react-aria-components/package.json +5 -0
- package/package.json +12 -1
- package/src/Illustration/Spot/Spot.tsx +3 -0
- package/src/Illustration/Spot/_docs/Spot.stickersheet.stories.tsx +15 -0
- package/src/Modal/GenericModal/GenericModal.spec.tsx +1 -1
- package/src/Modal/GenericModal/GenericModal.tsx +38 -70
- package/src/RichTextEditor/RichTextEditor/RichTextEditor.spec.stories.tsx +10 -3
- package/src/__libs__/react-aria/index.ts +1 -0
- package/src/__libs__/react-aria-components/index.ts +1 -0
|
@@ -49,13 +49,16 @@ export declare const ReOnboarding: ({ enableAspectRatio, ...restProps }: SpotPro
|
|
|
49
49
|
* Template Library / Performance
|
|
50
50
|
*/
|
|
51
51
|
export declare const Individual360: ({ enableAspectRatio, ...restProps }: SpotProps) => JSX.Element;
|
|
52
|
+
export declare const Individual360Pulse: ({ enableAspectRatio, ...restProps }: SpotProps) => JSX.Element;
|
|
52
53
|
export declare const Leadership360: ({ enableAspectRatio, ...restProps }: SpotProps) => JSX.Element;
|
|
53
54
|
export declare const Manager360: ({ enableAspectRatio, ...restProps }: SpotProps) => JSX.Element;
|
|
55
|
+
export declare const Manager360Pulse: ({ enableAspectRatio, ...restProps }: SpotProps) => JSX.Element;
|
|
54
56
|
export declare const Individual180: ({ enableAspectRatio, ...restProps }: SpotProps) => JSX.Element;
|
|
55
57
|
export declare const Leadership180: ({ enableAspectRatio, ...restProps }: SpotProps) => JSX.Element;
|
|
56
58
|
export declare const Manager180: ({ enableAspectRatio, ...restProps }: SpotProps) => JSX.Element;
|
|
57
59
|
export declare const TeamEffectiveness1: ({ enableAspectRatio, ...restProps }: SpotProps) => JSX.Element;
|
|
58
60
|
export declare const TeamEffectiveness2: ({ enableAspectRatio, ...restProps }: SpotProps) => JSX.Element;
|
|
61
|
+
export declare const TeamEffectiveness3: ({ enableAspectRatio, ...restProps }: SpotProps) => JSX.Element;
|
|
59
62
|
/**
|
|
60
63
|
* Offices
|
|
61
64
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'react-aria';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'react-aria-components';
|
package/libs/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Entrypoint: libs
|
|
2
|
+
|
|
3
|
+
This directory is here to redirect any imports from `@kaizen/components/libs` to the correct distribution of compiled code to allow for treeshaking of external libraries like `react-aria`.
|
|
4
|
+
|
|
5
|
+
These are exported to reduce compatibility issues when using libs within our components.
|
|
6
|
+
|
|
7
|
+
More details: [https://github.com/theKashey/multiple-entry-points-example](https://github.com/theKashey/multiple-entry-points-example)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaizen/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.81.1",
|
|
4
4
|
"description": "Kaizen component library",
|
|
5
5
|
"author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
|
|
6
6
|
"homepage": "https://cultureamp.design",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"v1",
|
|
21
21
|
"v2",
|
|
22
22
|
"v3",
|
|
23
|
+
"libs",
|
|
23
24
|
"dist",
|
|
24
25
|
"icons",
|
|
25
26
|
"locales",
|
|
@@ -47,6 +48,16 @@
|
|
|
47
48
|
"import": "./dist/esm/next.mjs",
|
|
48
49
|
"require": "./dist/cjs/next.cjs"
|
|
49
50
|
},
|
|
51
|
+
"./libs/react-aria": {
|
|
52
|
+
"types": "./dist/types/__libs__/react-aria/index.d.ts",
|
|
53
|
+
"import": "./dist/esm/reactAriaKZ.mjs",
|
|
54
|
+
"require": "./dist/cjs/reactAriaKZ.cjs"
|
|
55
|
+
},
|
|
56
|
+
"./libs/react-aria-components": {
|
|
57
|
+
"types": "./dist/types/__libs__/react-aria-components/index.d.ts",
|
|
58
|
+
"import": "./dist/esm/reactAriaComponentsKZ.mjs",
|
|
59
|
+
"require": "./dist/cjs/reactAriaComponentsKZ.cjs"
|
|
60
|
+
},
|
|
50
61
|
"./v1/actions": {
|
|
51
62
|
"types": "./dist/types/v1-actions.d.ts",
|
|
52
63
|
"import": "./dist/esm/actionsV1.mjs",
|
|
@@ -67,13 +67,16 @@ const createSpotIllustration =
|
|
|
67
67
|
* Template Library / Performance
|
|
68
68
|
*/
|
|
69
69
|
/* prettier-ignore */ export const Individual360 = createSpotIllustration("template-library-individual-360.svg")
|
|
70
|
+
/* prettier-ignore */ export const Individual360Pulse = createSpotIllustration("template-library-individual-360-pulse.svg")
|
|
70
71
|
/* prettier-ignore */ export const Leadership360 = createSpotIllustration("template-library-leadership-360.svg")
|
|
71
72
|
/* prettier-ignore */ export const Manager360 = createSpotIllustration("template-library-manager-360.svg")
|
|
73
|
+
/* prettier-ignore */ export const Manager360Pulse = createSpotIllustration("template-library-manager-360-pulse.svg")
|
|
72
74
|
/* prettier-ignore */ export const Individual180 = createSpotIllustration("template-library-individual-180.svg")
|
|
73
75
|
/* prettier-ignore */ export const Leadership180 = createSpotIllustration("template-library-leadership-180.svg")
|
|
74
76
|
/* prettier-ignore */ export const Manager180 = createSpotIllustration("template-library-manager-180.svg")
|
|
75
77
|
/* prettier-ignore */ export const TeamEffectiveness1 = createSpotIllustration("template-library-team-effectiveness-1.svg")
|
|
76
78
|
/* prettier-ignore */ export const TeamEffectiveness2 = createSpotIllustration("template-library-team-effectiveness-2.svg")
|
|
79
|
+
/* prettier-ignore */ export const TeamEffectiveness3 = createSpotIllustration("template-library-team-effectiveness-3.svg")
|
|
77
80
|
|
|
78
81
|
/**
|
|
79
82
|
* Offices
|
|
@@ -54,6 +54,7 @@ import {
|
|
|
54
54
|
InclusionSurvey,
|
|
55
55
|
Individual180,
|
|
56
56
|
Individual360,
|
|
57
|
+
Individual360Pulse,
|
|
57
58
|
InfluentialCommunication,
|
|
58
59
|
Informative,
|
|
59
60
|
Insights,
|
|
@@ -67,6 +68,7 @@ import {
|
|
|
67
68
|
London,
|
|
68
69
|
Manager180,
|
|
69
70
|
Manager360,
|
|
71
|
+
Manager360Pulse,
|
|
70
72
|
ManagerLearning,
|
|
71
73
|
ManagerReportSharing,
|
|
72
74
|
MeetingVoices,
|
|
@@ -113,6 +115,7 @@ import {
|
|
|
113
115
|
Team2,
|
|
114
116
|
TeamEffectiveness1,
|
|
115
117
|
TeamEffectiveness2,
|
|
118
|
+
TeamEffectiveness3,
|
|
116
119
|
Templates,
|
|
117
120
|
Timezone,
|
|
118
121
|
TrafficCone,
|
|
@@ -269,6 +272,10 @@ const performanceSpots = [
|
|
|
269
272
|
Component: Individual360,
|
|
270
273
|
name: 'Individual360',
|
|
271
274
|
},
|
|
275
|
+
{
|
|
276
|
+
Component: Individual360Pulse,
|
|
277
|
+
name: 'Individual360Pulse',
|
|
278
|
+
},
|
|
272
279
|
{
|
|
273
280
|
Component: Leadership360,
|
|
274
281
|
name: 'Leadership360',
|
|
@@ -277,6 +284,10 @@ const performanceSpots = [
|
|
|
277
284
|
Component: Manager360,
|
|
278
285
|
name: 'Manager360',
|
|
279
286
|
},
|
|
287
|
+
{
|
|
288
|
+
Component: Manager360Pulse,
|
|
289
|
+
name: 'Manager360Pulse',
|
|
290
|
+
},
|
|
280
291
|
{
|
|
281
292
|
Component: Individual180,
|
|
282
293
|
name: 'Individual180',
|
|
@@ -297,6 +308,10 @@ const performanceSpots = [
|
|
|
297
308
|
Component: TeamEffectiveness2,
|
|
298
309
|
name: 'TeamEffectiveness2',
|
|
299
310
|
},
|
|
311
|
+
{
|
|
312
|
+
Component: TeamEffectiveness3,
|
|
313
|
+
name: 'TeamEffectiveness3',
|
|
314
|
+
},
|
|
300
315
|
]
|
|
301
316
|
|
|
302
317
|
const covidSpots = [
|
|
@@ -71,7 +71,7 @@ describe('<GenericModal />', () => {
|
|
|
71
71
|
|
|
72
72
|
it('closes the modal when a click is outside of the modal content', async () => {
|
|
73
73
|
const handleDismiss = vi.fn()
|
|
74
|
-
render(<GenericModalWrapper onOutsideModalClick={handleDismiss} />)
|
|
74
|
+
render(<GenericModalWrapper onOutsideModalClick={handleDismiss()} />)
|
|
75
75
|
|
|
76
76
|
await user.click(screen.getByTestId('GenericModalTestId-scrollLayer'))
|
|
77
77
|
await waitFor(() => {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useId, useRef } from 'react'
|
|
2
2
|
import { createPortal } from 'react-dom'
|
|
3
3
|
import { Transition } from '@headlessui/react'
|
|
4
4
|
import classnames from 'classnames'
|
|
5
|
-
import
|
|
5
|
+
import { FocusOn } from 'react-focus-on'
|
|
6
6
|
import { useIsClientReady } from '../../utils/useIsClientReady'
|
|
7
|
+
|
|
7
8
|
import { warn } from '../util/console'
|
|
8
9
|
import { ModalContext } from './context/ModalContext'
|
|
9
10
|
import styles from './GenericModal.module.scss'
|
|
@@ -38,39 +39,22 @@ export const GenericModal = ({
|
|
|
38
39
|
|
|
39
40
|
const labelledByID = useId()
|
|
40
41
|
const describedByID = useId()
|
|
41
|
-
|
|
42
42
|
const isClientReady = useIsClientReady()
|
|
43
43
|
|
|
44
|
-
const
|
|
45
|
-
const
|
|
44
|
+
const scrollLayerRef = useRef<HTMLDivElement | null>(null)
|
|
45
|
+
const modalLayerRef = useRef<HTMLDivElement | null>(null)
|
|
46
46
|
|
|
47
47
|
const scrollModalToTop = (): void => {
|
|
48
48
|
// If we have a really long modal, the autofocus could land on an element down below
|
|
49
49
|
// causing the modal to scroll down and skipping over the content near the modal's top.
|
|
50
50
|
// Ensure that when the modal opens, we are at the top of its content.
|
|
51
51
|
requestAnimationFrame(() => {
|
|
52
|
-
|
|
53
|
-
scrollLayer.scrollTop = 0
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const outsideModalClickHandler = (event: React.MouseEvent): void => {
|
|
58
|
-
if (event.target === scrollLayer || event.target === modalLayer) {
|
|
59
|
-
onOutsideModalClick?.(event)
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const focusOnAccessibleLabel = (): void => {
|
|
64
|
-
if (!isClientReady) return
|
|
65
|
-
|
|
66
|
-
// Check if focus already exists within the modal
|
|
67
|
-
if (modalLayer?.contains(document.activeElement)) {
|
|
68
|
-
return
|
|
69
|
-
}
|
|
52
|
+
const scrollElement = scrollLayerRef.current
|
|
70
53
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
54
|
+
// This little verbose of a check but this ensures that the element is attached to the DOM as it animates in. This additional check aims to avoid race conditions
|
|
55
|
+
if (!scrollElement?.isConnected) return
|
|
56
|
+
scrollElement.scrollTop = 0
|
|
57
|
+
})
|
|
74
58
|
}
|
|
75
59
|
|
|
76
60
|
const a11yWarn = (): void => {
|
|
@@ -86,60 +70,46 @@ export const GenericModal = ({
|
|
|
86
70
|
}
|
|
87
71
|
}
|
|
88
72
|
|
|
89
|
-
const
|
|
73
|
+
const focusOnAccessibleLabel = (): void => {
|
|
90
74
|
if (!isClientReady) return
|
|
75
|
+
const modalElement = modalLayerRef.current
|
|
76
|
+
if (!modalElement?.isConnected) return
|
|
91
77
|
|
|
92
|
-
|
|
93
|
-
|
|
78
|
+
// Check if focus already exists within the modal
|
|
79
|
+
if (modalElement.contains(document.activeElement)) {
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const labelElement: HTMLElement | null = document.getElementById(labelledByID)
|
|
94
84
|
|
|
95
|
-
if (
|
|
96
|
-
|
|
85
|
+
if (labelElement?.isConnected) {
|
|
86
|
+
labelElement.focus()
|
|
97
87
|
}
|
|
88
|
+
}
|
|
98
89
|
|
|
99
|
-
|
|
90
|
+
const onEscapeKeyHandler = (e: Event): void => {
|
|
91
|
+
if (e instanceof KeyboardEvent) {
|
|
92
|
+
onEscapeKeyup?.(e)
|
|
93
|
+
}
|
|
100
94
|
}
|
|
101
95
|
|
|
102
96
|
const onAfterEnterHandler = (): void => {
|
|
103
97
|
scrollModalToTop()
|
|
104
|
-
|
|
98
|
+
const modalElement = modalLayerRef.current
|
|
99
|
+
if (modalElement) {
|
|
105
100
|
onAfterEnter?.()
|
|
106
101
|
focusOnAccessibleLabel()
|
|
107
102
|
a11yWarn()
|
|
108
103
|
}
|
|
109
104
|
}
|
|
110
105
|
|
|
111
|
-
const
|
|
112
|
-
(
|
|
113
|
-
|
|
114
|
-
onEscapeKeyup?.(event)
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
[onEscapeKeyup],
|
|
118
|
-
)
|
|
119
|
-
|
|
120
|
-
const onBeforeEnterHandler = (): void => {
|
|
121
|
-
preventBodyScroll()
|
|
122
|
-
|
|
123
|
-
if (onEscapeKeyup && isClientReady) {
|
|
124
|
-
document.addEventListener('keyup', escapeKeyHandler)
|
|
106
|
+
const outsideModalClickHandler = (e: React.MouseEvent): void => {
|
|
107
|
+
if (e.target === scrollLayerRef.current || e.target === modalLayerRef.current) {
|
|
108
|
+
onOutsideModalClick?.(e)
|
|
125
109
|
}
|
|
126
110
|
}
|
|
127
111
|
|
|
128
|
-
const cleanUpAfterClose = useCallback(() => {
|
|
129
|
-
if (!isClientReady) return
|
|
130
|
-
|
|
131
|
-
document.documentElement.classList.remove(styles.unscrollable, styles.pseudoScrollbar)
|
|
132
|
-
|
|
133
|
-
if (onEscapeKeyup) {
|
|
134
|
-
document.removeEventListener('keyup', escapeKeyHandler)
|
|
135
|
-
}
|
|
136
|
-
}, [escapeKeyHandler, onEscapeKeyup, isClientReady])
|
|
137
|
-
|
|
138
|
-
/* Ensure sure add-on styles (e.g. unscrollable) and key event is cleaned up when the modal is unmounted*/
|
|
139
|
-
useEffect(() => () => cleanUpAfterClose(), [cleanUpAfterClose])
|
|
140
|
-
|
|
141
112
|
const onAfterLeaveHandler = (): void => {
|
|
142
|
-
cleanUpAfterClose()
|
|
143
113
|
propsOnAfterLeave?.()
|
|
144
114
|
}
|
|
145
115
|
|
|
@@ -152,7 +122,6 @@ export const GenericModal = ({
|
|
|
152
122
|
<Transition
|
|
153
123
|
appear={true}
|
|
154
124
|
show={isOpen}
|
|
155
|
-
beforeEnter={onBeforeEnterHandler}
|
|
156
125
|
afterEnter={onAfterEnterHandler}
|
|
157
126
|
afterLeave={onAfterLeaveHandler}
|
|
158
127
|
data-generic-modal-transition-wrapper
|
|
@@ -161,9 +130,10 @@ export const GenericModal = ({
|
|
|
161
130
|
as="div"
|
|
162
131
|
className={classnames(styles.transitionLayer, className)}
|
|
163
132
|
>
|
|
164
|
-
<
|
|
165
|
-
|
|
133
|
+
<FocusOn
|
|
134
|
+
focusLock={focusLockDisabled}
|
|
166
135
|
returnFocus={true}
|
|
136
|
+
onEscapeKey={onEscapeKeyHandler}
|
|
167
137
|
// Disabling false positive
|
|
168
138
|
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
169
139
|
autoFocus={false}
|
|
@@ -174,11 +144,9 @@ export const GenericModal = ({
|
|
|
174
144
|
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}
|
|
175
145
|
<div
|
|
176
146
|
className={styles.scrollLayer}
|
|
177
|
-
ref={
|
|
178
|
-
setScrollLayer(scrollLayerRef)
|
|
179
|
-
}}
|
|
180
|
-
onClick={outsideModalClickHandler}
|
|
147
|
+
ref={scrollLayerRef}
|
|
181
148
|
data-testid={`${id}-scrollLayer`}
|
|
149
|
+
onClick={outsideModalClickHandler}
|
|
182
150
|
>
|
|
183
151
|
<ModalContext.Provider
|
|
184
152
|
value={{
|
|
@@ -191,14 +159,14 @@ export const GenericModal = ({
|
|
|
191
159
|
className={styles.modalLayer}
|
|
192
160
|
aria-labelledby={labelledByID}
|
|
193
161
|
aria-describedby={describedByID}
|
|
194
|
-
ref={
|
|
162
|
+
ref={modalLayerRef}
|
|
195
163
|
data-testid={id}
|
|
196
164
|
>
|
|
197
165
|
{children}
|
|
198
166
|
</div>
|
|
199
167
|
</ModalContext.Provider>
|
|
200
168
|
</div>
|
|
201
|
-
</
|
|
169
|
+
</FocusOn>
|
|
202
170
|
</Transition>,
|
|
203
171
|
document.body,
|
|
204
172
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
2
|
import { 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 { type EditorContentArray } from '../types'
|
|
5
5
|
import { RichTextEditor, type RichTextEditorProps } from './RichTextEditor'
|
|
6
6
|
|
|
@@ -149,8 +149,9 @@ export const CreateALink: Story = {
|
|
|
149
149
|
name: 'Create a link',
|
|
150
150
|
play: async (context) => {
|
|
151
151
|
const { canvasElement, step } = context
|
|
152
|
-
const { getByRole, getByText } = within(canvasElement)
|
|
152
|
+
const { getByRole, getByText, queryByRole, findByRole } = within(canvasElement)
|
|
153
153
|
const editor = getByRole('textbox')
|
|
154
|
+
|
|
154
155
|
await step('Focus on editor', async () => {
|
|
155
156
|
await userEvent.click(editor)
|
|
156
157
|
expect(editor).toHaveFocus()
|
|
@@ -185,8 +186,14 @@ export const CreateALink: Story = {
|
|
|
185
186
|
await userEvent.keyboard('{Tab}{Enter}')
|
|
186
187
|
})
|
|
187
188
|
|
|
189
|
+
await step('The Link Modal closes', async () => {
|
|
190
|
+
await waitFor(() => {
|
|
191
|
+
expect(queryByRole('dialog')).not.toBeInTheDocument()
|
|
192
|
+
})
|
|
193
|
+
})
|
|
194
|
+
|
|
188
195
|
await step('Link exists in the RTE', async () => {
|
|
189
|
-
const link =
|
|
196
|
+
const link = await findByRole('link', { name: 'Link' })
|
|
190
197
|
expect(link).toBeInTheDocument()
|
|
191
198
|
})
|
|
192
199
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'react-aria'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'react-aria-components'
|