@kaizen/components 1.61.1 → 1.61.2

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.
Files changed (102) hide show
  1. package/codemods/utils/__snapshots__/transformSource.spec.ts.snap +2 -2
  2. package/dist/cjs/RichTextEditor/RichTextContent/RichTextContent.cjs +10 -1
  3. package/dist/esm/RichTextEditor/RichTextContent/RichTextContent.mjs +11 -2
  4. package/dist/styles.css +220 -220
  5. package/package.json +5 -4
  6. package/src/Avatar/Avatar.spec.tsx +1 -1
  7. package/src/Calendar/utils/setFocusInCalendar.spec.tsx +2 -2
  8. package/src/Checkbox/Checkbox/Checkbox.spec.tsx +2 -2
  9. package/src/Collapsible/Collapsible/Collapsible.spec.tsx +2 -14
  10. package/src/Collapsible/Collapsible/_docs/Collapsible.stickersheet.stories.tsx +49 -0
  11. package/src/Collapsible/Collapsible/_docs/Collapsible.stories.tsx +0 -11
  12. package/src/DateInput/DateInputDescription/DateInputDescription.spec.tsx +5 -6
  13. package/src/DateInput/DateInputWithIconButton/DateInputWithIconButton.spec.tsx +4 -6
  14. package/src/DatePicker/DatePicker.spec.tsx +32 -36
  15. package/src/DatePicker/subcomponents/DateInputField/DateInputField.spec.tsx +13 -13
  16. package/src/DatePicker/utils/validateDate.spec.ts +5 -6
  17. package/src/EmptyState/EmptyState.spec.tsx +1 -1
  18. package/src/ErrorPage/ErrorPage.spec.tsx +19 -19
  19. package/src/Filter/FilterBar/FilterBar.spec.tsx +26 -26
  20. package/src/Filter/FilterBar/context/utils/updateDependentFilters.spec.ts +2 -4
  21. package/src/Filter/FilterBar/subcomponents/AddFiltersMenu/AddFiltersMenu.spec.tsx +3 -4
  22. package/src/Filter/FilterBar/subcomponents/FilterBarButton/FilterBarButton.spec.tsx +3 -6
  23. package/src/Filter/FilterBar/subcomponents/FilterBarDatePicker/FilterBarDatePicker.spec.tsx +10 -12
  24. package/src/Filter/FilterBar/subcomponents/FilterBarDateRangePicker/FilterBarDateRangePicker.spec.tsx +9 -10
  25. package/src/Filter/FilterBar/subcomponents/FilterBarMultiSelect/FilterBarMultiSelect.spec.tsx +12 -14
  26. package/src/Filter/FilterBar/subcomponents/FilterBarSelect/FilterBarSelect.spec.tsx +11 -13
  27. package/src/Filter/FilterButton/FilterButtonRemovable/FilterButtonRemovable.spec.tsx +5 -5
  28. package/src/Filter/FilterDatePicker/FilterDatePicker.spec.tsx +12 -15
  29. package/src/Filter/FilterDatePicker/hooks/useDateInputHandlers.spec.ts +12 -15
  30. package/src/Filter/FilterDatePicker/hooks/useDateValidation.spec.ts +3 -5
  31. package/src/Filter/FilterDatePicker/subcomponents/FilterDatePickerField/FilterDatePickerField.spec.tsx +23 -28
  32. package/src/Filter/FilterDatePicker/utils/getDateValidationHandler.spec.tsx +2 -6
  33. package/src/Filter/FilterDatePicker/utils/validateDate.spec.ts +5 -6
  34. package/src/Filter/FilterDateRangePicker/FilterDateRangePicker.spec.tsx +2 -3
  35. package/src/Filter/FilterDateRangePicker/_docs/FilterDateRangePicker.stickersheet.stories.tsx +27 -0
  36. package/src/Filter/FilterDateRangePicker/subcomponents/DateRangeInputField/DateRangeInputField.spec.tsx +9 -11
  37. package/src/Filter/FilterDateRangePicker/subcomponents/DateRangeValidationMessage/DateRangeValidationMessage.spec.tsx +1 -63
  38. package/src/Filter/FilterDateRangePicker/subcomponents/FilterDateRangePickerField/FilterDateRangePickerField.spec.tsx +32 -32
  39. package/src/Filter/FilterDateRangePicker/subcomponents/FilterDateRangePickerField/hooks/useEndDateValidation.spec.ts +3 -8
  40. package/src/Filter/FilterDateRangePicker/subcomponents/FilterDateRangePickerField/hooks/useStartDateValidation.spec.ts +2 -5
  41. package/src/Filter/FilterDateRangePicker/subcomponents/FilterDateRangePickerField/utils/validateEndDateBeforeStartDate.spec.ts +2 -3
  42. package/src/Filter/FilterMultiSelect/FilterMultiSelect.spec.tsx +9 -10
  43. package/src/Filter/FilterMultiSelect/context/MenuTriggerProvider/MenuTriggerProvider.spec.tsx +2 -1
  44. package/src/Filter/FilterMultiSelect/context/SelectionProvider/SelectionProvider.spec.tsx +32 -32
  45. package/src/Filter/FilterMultiSelect/subcomponents/MultiSelectOption/MultiSelectOption.spec.tsx +9 -7
  46. package/src/Filter/FilterMultiSelect/subcomponents/SearchInput/SearchInput.spec.tsx +12 -12
  47. package/src/Filter/FilterMultiSelect/subcomponents/SelectionControlButton/ClearButton/ClearButton.spec.tsx +7 -7
  48. package/src/Filter/FilterMultiSelect/subcomponents/SelectionControlButton/SelectAllButton/SelectAllButton.spec.tsx +9 -9
  49. package/src/Filter/FilterSelect/FilterSelect.spec.tsx +2 -2
  50. package/src/Heading/Heading.spec.tsx +1 -31
  51. package/src/Illustration/subcomponents/VideoPlayer/VideoPlayer.spec.tsx +43 -97
  52. package/src/Illustration/subcomponents/VideoPlayer/VideoPlayer.stickersheet.stories.tsx +68 -0
  53. package/src/Illustration/subcomponents/VideoPlayer/VideoPlayer.stories.tsx +37 -0
  54. package/src/Input/InputRange/InputRange.spec.tsx +2 -2
  55. package/src/Input/InputSearch/InputSearch.spec.tsx +3 -5
  56. package/src/KaizenProvider/KaizenProvider.spec.tsx +2 -2
  57. package/src/KaizenProvider/subcomponents/OptionalIntlProvider/OptionalIntlProvider.spec.tsx +2 -3
  58. package/src/Modal/ConfirmationModal/ConfirmationModal.spec.tsx +7 -7
  59. package/src/Modal/ContextModal/ContextModal.spec.tsx +5 -5
  60. package/src/Modal/GenericModal/GenericModal.spec.tsx +4 -4
  61. package/src/Modal/InputEditModal/InputEditModal.spec.tsx +7 -7
  62. package/src/MultiSelect/subcomponents/MultiSelectOptionField/MultiSelectOptionField.spec.tsx +3 -3
  63. package/src/MultiSelect/subcomponents/MultiSelectOptions/MultiSelectOptions.spec.tsx +3 -3
  64. package/src/MultiSelect/subcomponents/MultiSelectToggle/MultiSelectToggle.spec.tsx +2 -2
  65. package/src/Notification/subcomponents/GenericNotification/GenericNotification.stories.tsx +60 -0
  66. package/src/Pagination/Pagination.spec.tsx +2 -2
  67. package/src/RichTextEditor/EditableRichTextContent/EditableRichTextContent.spec.tsx +4 -4
  68. package/src/RichTextEditor/RichTextContent/RichTextContent.tsx +11 -2
  69. package/src/RichTextEditor/utils/commands/addMark.spec.ts +2 -2
  70. package/src/RichTextEditor/utils/commands/fixtures/helpers.ts +4 -3
  71. package/src/RichTextEditor/utils/commands/getMarkAttrs.spec.ts +2 -2
  72. package/src/RichTextEditor/utils/commands/getMarkRange.spec.ts +2 -2
  73. package/src/RichTextEditor/utils/commands/listIsActive.spec.ts +2 -2
  74. package/src/RichTextEditor/utils/commands/markContainsSelection.spec.ts +2 -2
  75. package/src/RichTextEditor/utils/commands/markIsActive.spec.ts +2 -2
  76. package/src/RichTextEditor/utils/commands/removeMark.spec.ts +2 -2
  77. package/src/RichTextEditor/utils/commands/updateMark.spec.ts +2 -2
  78. package/src/RichTextEditor/utils/commands/validateAndRemoveMarks.spec.ts +3 -3
  79. package/src/RichTextEditor/utils/core/createRichTextEditor.spec.ts +11 -11
  80. package/src/RichTextEditor/utils/core/hooks/useRichTextEditor.spec.tsx +2 -2
  81. package/src/SplitButton/SplitButton.spec.tsx +5 -5
  82. package/src/SplitButton/subcomponents/DropdownButton/DropdownButton.spec.tsx +3 -4
  83. package/src/Text/Text.spec.tsx +1 -57
  84. package/src/TextArea/TextArea.spec.tsx +2 -2
  85. package/src/TimeField/TimeField.spec.tsx +2 -2
  86. package/src/TitleBlockZen/TitleBlockZen.spec.tsx +36 -68
  87. package/src/TitleBlockZen/_docs/TitleBlockZen.stories.tsx +78 -8
  88. package/src/TitleBlockZen/subcomponents/MobileActions.spec.tsx +2 -2
  89. package/src/TitleBlockZen/subcomponents/NavigationTabs.spec.tsx +8 -2
  90. package/src/ToggleSwitch/ToggleSwitch/ToggleSwitch.spec.tsx +2 -2
  91. package/src/__actions__/Menu/v1/Menu.spec.tsx +2 -2
  92. package/src/__containers__/GuidanceBlock/v1/GuidanceBlock.spec.tsx +5 -5
  93. package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.spec.tsx +5 -5
  94. package/src/__future__/Select/Select.spec.tsx +4 -4
  95. package/src/__overlays__/Tooltip/v1/Tooltip.spec.tsx +1 -1
  96. package/src/__overlays__/Tooltip/v1/utils/isSemanticElement.spec.tsx +4 -9
  97. package/src/utils/useMediaQueries.spec.tsx +7 -7
  98. package/src/Heading/__snapshots__/Heading.spec.tsx.snap +0 -85
  99. package/src/Illustration/utils/usePausePlay.spec.tsx +0 -85
  100. package/src/Notification/subcomponents/GenericNotification/GenericNotification.spec.tsx +0 -76
  101. package/src/Text/__snapshots__/Text.spec.tsx.snap +0 -49
  102. package/src/__overlays__/Tooltip/v1/subcomponents/AppearanceAnim.spec.tsx +0 -39
@@ -1,85 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<Heading /> defaults to the correct HTML element renders the correct element for <Heading variant={display-0} /> 1`] = `
4
- <body>
5
- <div>
6
- <h1
7
- class="heading display-0 dark large"
8
- >
9
- Example
10
- </h1>
11
- </div>
12
- </body>
13
- `;
14
-
15
- exports[`<Heading /> defaults to the correct HTML element renders the correct element for <Heading variant={heading-1} /> 1`] = `
16
- <body>
17
- <div>
18
- <h1
19
- class="heading heading-1 dark large"
20
- >
21
- Example
22
- </h1>
23
- </div>
24
- </body>
25
- `;
26
-
27
- exports[`<Heading /> defaults to the correct HTML element renders the correct element for <Heading variant={heading-2} /> 1`] = `
28
- <body>
29
- <div>
30
- <h2
31
- class="heading heading-2 dark large"
32
- >
33
- Example
34
- </h2>
35
- </div>
36
- </body>
37
- `;
38
-
39
- exports[`<Heading /> defaults to the correct HTML element renders the correct element for <Heading variant={heading-3} /> 1`] = `
40
- <body>
41
- <div>
42
- <h3
43
- class="heading heading-3 dark small"
44
- >
45
- Example
46
- </h3>
47
- </div>
48
- </body>
49
- `;
50
-
51
- exports[`<Heading /> defaults to the correct HTML element renders the correct element for <Heading variant={heading-4} /> 1`] = `
52
- <body>
53
- <div>
54
- <h4
55
- class="heading heading-4 dark small"
56
- >
57
- Example
58
- </h4>
59
- </div>
60
- </body>
61
- `;
62
-
63
- exports[`<Heading /> defaults to the correct HTML element renders the correct element for <Heading variant={heading-5} /> 1`] = `
64
- <body>
65
- <div>
66
- <h5
67
- class="heading heading-5 dark small"
68
- >
69
- Example
70
- </h5>
71
- </div>
72
- </body>
73
- `;
74
-
75
- exports[`<Heading /> defaults to the correct HTML element renders the correct element for <Heading variant={heading-6} /> 1`] = `
76
- <body>
77
- <div>
78
- <h6
79
- class="heading heading-6 dark small"
80
- >
81
- Example
82
- </h6>
83
- </div>
84
- </body>
85
- `;
@@ -1,85 +0,0 @@
1
- import React, { RefObject, act } from "react"
2
- import { render, renderHook } from "@testing-library/react"
3
- import { LaunchIcon, PauseIcon } from "~components/Icon"
4
- import { usePausePlay, usePausePlayHook } from "./usePausePlay"
5
-
6
- describe("usePausePlay()", () => {
7
- beforeEach(() => {
8
- jest.clearAllMocks()
9
- })
10
-
11
- let hookResult: usePausePlayHook
12
- const mockPause = jest.fn()
13
- const mockPlay = jest.fn()
14
-
15
- describe("when toggling a currently playing video", () => {
16
- beforeEach(() => {
17
- const fakeRef = {
18
- current: {
19
- pause: mockPause,
20
- play: mockPlay,
21
- paused: false, // It's playing
22
- },
23
- } as unknown as RefObject<HTMLVideoElement>
24
-
25
- const { result } = renderHook(() => usePausePlay(fakeRef))
26
-
27
- act(() => {
28
- result.current.toggle()
29
- })
30
-
31
- hookResult = result.current
32
- })
33
-
34
- it("pauses the video", () => {
35
- expect(mockPause).toHaveBeenCalled()
36
- })
37
-
38
- it("returns the play icon", () => {
39
- const { baseElement: original } = render(hookResult.icon)
40
- const { baseElement: comparison } = render(
41
- <LaunchIcon role="presentation" />
42
- )
43
- expect(original).toEqual(comparison)
44
- })
45
-
46
- it("returns the 'Play animation' label", () => {
47
- expect(hookResult.label).toEqual("Play animation")
48
- })
49
- })
50
-
51
- describe("when toggling a currently paused video", () => {
52
- beforeEach(() => {
53
- const fakeRef = {
54
- current: {
55
- pause: mockPause,
56
- play: mockPlay,
57
- paused: true, // It's not playing
58
- },
59
- } as unknown as RefObject<HTMLVideoElement>
60
-
61
- const { result } = renderHook(() => usePausePlay(fakeRef))
62
-
63
- act(() => {
64
- result.current.toggle()
65
- })
66
-
67
- hookResult = result.current
68
- })
69
- it("starts the video again", () => {
70
- expect(mockPlay).toHaveBeenCalled()
71
- })
72
-
73
- it("returns the pause icon", () => {
74
- const { baseElement: original } = render(hookResult.icon)
75
- const { baseElement: comparison } = render(
76
- <PauseIcon role="presentation" />
77
- )
78
- expect(original).toEqual(comparison)
79
- })
80
-
81
- it("returns the 'Pause animation' label", () => {
82
- expect(hookResult.label).toEqual("Pause animation")
83
- })
84
- })
85
- })
@@ -1,76 +0,0 @@
1
- import React, { act } from "react"
2
- import { fireEvent, waitFor } from "@testing-library/dom"
3
- import { render } from "@testing-library/react"
4
- import ReactTestUtils from "react-dom/test-utils"
5
- import { GenericNotification } from "./GenericNotification"
6
-
7
- describe("<GenericNotification />", () => {
8
- afterEach(() => {
9
- jest.runAllTimers()
10
- })
11
-
12
- beforeEach(() => {
13
- jest.useFakeTimers()
14
- })
15
-
16
- it('begins "hidden" but transitions out of it immediately', async () => {
17
- const { container } = render(
18
- <GenericNotification type="positive" style="inline" title="Success">
19
- This is my positive notification
20
- </GenericNotification>
21
- )
22
-
23
- await waitFor(() => {
24
- expect(container.querySelector(".hidden")).toBeInTheDocument()
25
- })
26
-
27
- await act(async () => {
28
- jest.advanceTimersByTime(50)
29
- })
30
-
31
- await waitFor(() => {
32
- expect(container.querySelector(".hidden")).not.toBeInTheDocument()
33
- })
34
- })
35
-
36
- it("hides the notification and triggers the onHide callback when the cancel button is clicked", async () => {
37
- const onHide = jest.fn()
38
- const { container, getByTestId } = render(
39
- <GenericNotification
40
- type="positive"
41
- style="inline"
42
- title="Success"
43
- onHide={onHide}
44
- >
45
- Notification Text
46
- </GenericNotification>
47
- )
48
-
49
- // The element should start in a "hidden" state
50
- expect(container.querySelector(".hidden")).toBeTruthy()
51
-
52
- // After clicking, the element should fade out, but the onHide not trigger yet.
53
- const cancelButton = getByTestId("close-button")
54
- const notification = container.querySelector(".notification")
55
-
56
- fireEvent(cancelButton, new MouseEvent("click"))
57
-
58
- await waitFor(() => {
59
- expect(notification).toBeTruthy()
60
- })
61
-
62
- // Cannot use @testing-library/react `fireEvent` as it relies on jsdom events
63
- // TransitionEvent has not been implemented yet, using `ReactTestUtils.Simulate` is a workaround
64
- act(() => {
65
- notification &&
66
- ReactTestUtils.Simulate.transitionEnd(notification, {
67
- propertyName: "margin-top",
68
- } as any)
69
- })
70
-
71
- await waitFor(() => {
72
- expect(notification).not.toBeInTheDocument()
73
- })
74
- await waitFor(() => expect(onHide).toHaveBeenCalledTimes(1))
75
- })
76
- })
@@ -1,49 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<Text /> defaults to the correct HTML element renders the correct element for <Text variant={body} /> 1`] = `
4
- <body>
5
- <div>
6
- <p
7
- class="text body dark"
8
- >
9
- Example
10
- </p>
11
- </div>
12
- </body>
13
- `;
14
-
15
- exports[`<Text /> defaults to the correct HTML element renders the correct element for <Text variant={extra-small} /> 1`] = `
16
- <body>
17
- <div>
18
- <p
19
- class="text extra-small dark"
20
- >
21
- Example
22
- </p>
23
- </div>
24
- </body>
25
- `;
26
-
27
- exports[`<Text /> defaults to the correct HTML element renders the correct element for <Text variant={intro-lede} /> 1`] = `
28
- <body>
29
- <div>
30
- <p
31
- class="text intro-lede dark"
32
- >
33
- Example
34
- </p>
35
- </div>
36
- </body>
37
- `;
38
-
39
- exports[`<Text /> defaults to the correct HTML element renders the correct element for <Text variant={small} /> 1`] = `
40
- <body>
41
- <div>
42
- <p
43
- class="text small dark"
44
- >
45
- Example
46
- </p>
47
- </div>
48
- </body>
49
- `;
@@ -1,39 +0,0 @@
1
- import React from "react"
2
- import { render } from "@testing-library/react"
3
- import useDebounce from "use-debounce"
4
- import { AnimationProvider } from "./AppearanceAnim"
5
-
6
- jest.mock("use-debounce")
7
-
8
- const useDebouncedCallback = useDebounce.useDebouncedCallback as jest.Mock
9
- let mockReturnValue: Record<string, any>
10
-
11
- describe("<AnimationProvider />", () => {
12
- beforeEach(() => {
13
- mockReturnValue = jest.fn()
14
- mockReturnValue.cancel = (): void => undefined
15
- useDebouncedCallback.mockImplementation(() => mockReturnValue)
16
- })
17
-
18
- describe("When no animationDuration prop is given", () => {
19
- it("calls useDebouncedCallback with a 400 ms delay", () => {
20
- render(<AnimationProvider isVisible />)
21
- expect(useDebouncedCallback).toHaveBeenCalledWith(
22
- expect.anything(),
23
- 400,
24
- expect.anything()
25
- )
26
- })
27
- })
28
- describe("When an animationDuration prop is given", () => {
29
- it("calls useDebouncedCallback with the animationDuration value", () => {
30
- const expected = 1000
31
- render(<AnimationProvider isVisible animationDuration={expected} />)
32
- expect(useDebouncedCallback).toHaveBeenCalledWith(
33
- expect.anything(),
34
- expected,
35
- expect.anything()
36
- )
37
- })
38
- })
39
- })