@kaizen/components 1.61.0 → 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 (105) 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 +115 -114
  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/__layout__/Workflow/v3/_docs/Workflow.stories.tsx +8 -2
  96. package/src/__layout__/Workflow/v3/subcomponents/Footer/components/Root/FooterRoot.module.css +1 -0
  97. package/src/__layout__/Workflow/v3/subcomponents/Header/components/Root/Root.module.css +1 -1
  98. package/src/__overlays__/Tooltip/v1/Tooltip.spec.tsx +1 -1
  99. package/src/__overlays__/Tooltip/v1/utils/isSemanticElement.spec.tsx +4 -9
  100. package/src/utils/useMediaQueries.spec.tsx +7 -7
  101. package/src/Heading/__snapshots__/Heading.spec.tsx.snap +0 -85
  102. package/src/Illustration/utils/usePausePlay.spec.tsx +0 -85
  103. package/src/Notification/subcomponents/GenericNotification/GenericNotification.spec.tsx +0 -76
  104. package/src/Text/__snapshots__/Text.spec.tsx.snap +0 -49
  105. package/src/__overlays__/Tooltip/v1/subcomponents/AppearanceAnim.spec.tsx +0 -39
@@ -1,6 +1,6 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
- exports[`transformSource updates the value of Pancakes topping to jam 1`] = `
3
+ exports[`transformSource > updates the value of Pancakes topping to jam 1`] = `
4
4
  "import * as React from "react";
5
5
  // @ts-ignore
6
6
  import { Pancakes } from "@kaizen/components";
@@ -47,13 +47,22 @@ var RichTextContent = function (props) {
47
47
  classNameOverride = props.classNameOverride,
48
48
  restProps = tslib.__rest(props, ["content", "classNameOverride"]);
49
49
  var schema$1 = React.useState(schema.createSchemaWithAll())[0];
50
+ var editorId = React.useId();
51
+ React.useEffect(function () {
52
+ var _a;
53
+ // prosemirror only allows us to set this to false (which has caused a strange bug in the platform)
54
+ // so we have to hack a bit to remove the attribute completely
55
+ (_a = document.getElementById(editorId)) === null || _a === void 0 ? void 0 : _a.removeAttribute("contenteditable");
56
+ }, []);
50
57
  var editorRef = useRichTextEditor.useRichTextEditor(ProseMirrorState__namespace.EditorState.create({
51
58
  doc: ProseMirrorModel__namespace.Node.fromJSON(schema$1, {
52
59
  type: "doc",
53
60
  content: content
54
61
  }),
55
62
  schema: schema$1
56
- }), undefined, {
63
+ }), {
64
+ id: editorId
65
+ }, {
57
66
  editable: false
58
67
  })[0];
59
68
  return React__default.default.createElement("div", tslib.__assign({
@@ -1,5 +1,5 @@
1
1
  import { __rest, __assign } from 'tslib';
2
- import React, { useState } from 'react';
2
+ import React, { useState, useId, useEffect } from 'react';
3
3
  import classnames from 'classnames';
4
4
  import { createSchemaWithAll } from '../RichTextEditor/schema.mjs';
5
5
  import * as ProseMirrorState from 'prosemirror-state';
@@ -18,13 +18,22 @@ const RichTextContent = /*#__PURE__*/function () {
18
18
  classNameOverride = props.classNameOverride,
19
19
  restProps = __rest(props, ["content", "classNameOverride"]);
20
20
  var schema = useState(createSchemaWithAll())[0];
21
+ var editorId = useId();
22
+ useEffect(function () {
23
+ var _a;
24
+ // prosemirror only allows us to set this to false (which has caused a strange bug in the platform)
25
+ // so we have to hack a bit to remove the attribute completely
26
+ (_a = document.getElementById(editorId)) === null || _a === void 0 ? void 0 : _a.removeAttribute("contenteditable");
27
+ }, []);
21
28
  var editorRef = useRichTextEditor(ProseMirrorState.EditorState.create({
22
29
  doc: ProseMirrorModel.Node.fromJSON(schema, {
23
30
  type: "doc",
24
31
  content: content
25
32
  }),
26
33
  schema: schema
27
- }), undefined, {
34
+ }), {
35
+ id: editorId
36
+ }, {
28
37
  editable: false
29
38
  })[0];
30
39
  return /*#__PURE__*/React.createElement("div", __assign({
package/dist/styles.css CHANGED
@@ -133,6 +133,7 @@
133
133
  padding: var(--spacing-24) var(--spacing-12);
134
134
  background: var(--color-white);
135
135
  gap: var(--spacing-16);
136
+ border-top: 2px solid rgba(var(--color-gray-600-rgb), 0.1);
136
137
 
137
138
  @media (width >= 768px) {
138
139
  grid-template-columns: 1fr 5fr 1fr;
@@ -143,6 +144,22 @@
143
144
  }
144
145
  }
145
146
 
147
+ .FooterActions-module_footerAction__yu1mj {
148
+ display: flex;
149
+ flex-grow: 1;
150
+ flex-basis: auto;
151
+ }
152
+
153
+ .FooterActions-module_footerActionPrevious__C-ejW {
154
+ grid-area: "prev";
155
+ justify-content: start;
156
+ }
157
+
158
+ .FooterActions-module_footerActionNext__yLUMV {
159
+ grid-area: "next";
160
+ justify-content: end;
161
+ }
162
+
146
163
  .Branding-module_branding__bawwf {
147
164
  justify-content: center;
148
165
  grid-area: branding;
@@ -159,25 +176,26 @@
159
176
  flex-basis: 7.5rem;
160
177
  }
161
178
 
162
- .Root-module_root__FYpNx {
163
- display: grid;
164
- background-color: var(--color-white);
165
- grid-template: "branding" min-content "titles" max-content "actions" min-content / 1fr;
166
- flex-grow: 1;
167
- justify-content: center;
179
+ .Titles-module_titles__gE8Zb {
180
+ grid-area: titles;
181
+ display: flex;
182
+ flex-direction: column;
168
183
  align-items: center;
169
- text-align: center;
170
- box-shadow: var(--shadow-small-box-shadow);
171
- padding: var(--spacing-24);
172
- gap: var(--spacing-16);
184
+ justify-content: center;
185
+ flex-grow: 1;
186
+ }
173
187
 
174
- @media (width >= 768px) {
175
- align-items: start;
176
- grid-template: "branding titles actions" min-content / 1fr max-content 1fr;
177
- position: sticky;
178
- top: 0;
179
- z-index: 1;
180
- }
188
+ .Titles-module_pageTitle__CMn-j {
189
+ display: flex;
190
+ flex-direction: column;
191
+ }
192
+
193
+ .Titles-module_prefix__-Kflu {
194
+ margin-bottom: var(--spacing-4);
195
+ }
196
+
197
+ .Titles-module_statusTag__fhxfV {
198
+ margin-top: var(--spacing-8);
181
199
  }
182
200
 
183
201
  .Actions-module_actions__WJwtK {
@@ -196,42 +214,25 @@
196
214
  }
197
215
  }
198
216
 
199
- .FooterActions-module_footerAction__yu1mj {
200
- display: flex;
217
+ .Root-module_root__FYpNx {
218
+ display: grid;
219
+ background-color: var(--color-white);
220
+ grid-template: "branding" min-content "titles" max-content "actions" min-content / 1fr;
201
221
  flex-grow: 1;
202
- flex-basis: auto;
203
- }
204
-
205
- .FooterActions-module_footerActionPrevious__C-ejW {
206
- grid-area: "prev";
207
- justify-content: start;
208
- }
209
-
210
- .FooterActions-module_footerActionNext__yLUMV {
211
- grid-area: "next";
212
- justify-content: end;
213
- }
214
-
215
- .Titles-module_titles__gE8Zb {
216
- grid-area: titles;
217
- display: flex;
218
- flex-direction: column;
219
- align-items: center;
220
222
  justify-content: center;
221
- flex-grow: 1;
222
- }
223
-
224
- .Titles-module_pageTitle__CMn-j {
225
- display: flex;
226
- flex-direction: column;
227
- }
228
-
229
- .Titles-module_prefix__-Kflu {
230
- margin-bottom: var(--spacing-4);
231
- }
223
+ align-items: center;
224
+ text-align: center;
225
+ padding: var(--spacing-24);
226
+ gap: var(--spacing-16);
227
+ border-bottom: 2px solid rgb(var(--color-gray-600-rgb), 0.1);
232
228
 
233
- .Titles-module_statusTag__fhxfV {
234
- margin-top: var(--spacing-8);
229
+ @media (width >= 768px) {
230
+ align-items: start;
231
+ grid-template: "branding titles actions" min-content / 1fr max-content 1fr;
232
+ position: sticky;
233
+ top: 0;
234
+ z-index: 1;
235
+ }
235
236
  }
236
237
 
237
238
  /** THIS IS AN AUTOGENERATED FILE **/
@@ -262,6 +263,70 @@
262
263
  .OverlayArrow-module_overlayArrow__hoDyK.OverlayArrow-module_reversed__-WGcR path {
263
264
  fill: var(--color-white, #ffffff);
264
265
  }
266
+ .MenuItem-module_item__DPerF {
267
+ font-family: var(--typography-paragraph-body-font-family);
268
+ font-size: var(--typography-paragraph-body-font-size);
269
+ letter-spacing: var(--typography-paragraph-body-letter-spacing);
270
+ font-weight: var(--typography-paragraph-body-font-weight);
271
+ line-height: var(--typography-paragraph-body-line-height);
272
+ color: rgba(var(--color-purple-800-rgb), 0.7);
273
+ padding: var(--spacing-6) var(--spacing-8);
274
+ border: var(--border-focus-ring-border-width) var(--border-focus-ring-border-style) transparent;
275
+ border-radius: 4px;
276
+ display: flex;
277
+ gap: 0 var(--spacing-8);
278
+ align-items: center;
279
+ margin-inline: var(--spacing-6);
280
+ text-decoration: none;
281
+ cursor: pointer;
282
+ }
283
+
284
+ .MenuItem-module_iconWrapper__bRdQN {
285
+ flex-shrink: 0;
286
+ display: flex;
287
+ align-items: center;
288
+ }
289
+
290
+ .MenuItem-module_item__DPerF[data-focused] {
291
+ background-color: var(--color-blue-100);
292
+ color: var(--color-blue-500);
293
+ outline: none;
294
+ border-color: var(--color-blue-500);
295
+ }
296
+
297
+ .MenuItem-module_item__DPerF[data-disabled] {
298
+ opacity: 0.3;
299
+ }
300
+ .Menu-module_menu__iHYqh {
301
+ background-color: var(--color-white);
302
+ color: var(--color-purple-800);
303
+ width: 248px;
304
+ max-height: 22rem;
305
+ overflow: auto;
306
+ padding-block: var(--spacing-6);
307
+ outline: none;
308
+ border-radius: var(--border-solid-border-radius);
309
+ box-shadow: var(--shadow-large-box-shadow);
310
+ }
311
+
312
+ .Menu-module_menu__iHYqh .react-aria-Header {
313
+ font-family: var(--typography-heading-6-font-family);
314
+ font-size: var(--typography-heading-6-font-size);
315
+ letter-spacing: var(--typography-heading-6-letter-spacing);
316
+ font-weight: var(--typography-heading-6-font-weight);
317
+ line-height: var(--typography-heading-6-line-height);
318
+ padding: var(--spacing-6) 10px;
319
+ margin-inline: var(--spacing-6);
320
+ }
321
+
322
+ .Menu-module_menu__iHYqh section:not(:last-of-type)::after {
323
+ width: 100%;
324
+ height: 1px;
325
+ background-color: var(--border-solid-border-color);
326
+ content: "";
327
+ display: block;
328
+ margin-block: var(--spacing-6);
329
+ }
265
330
  .Button-module_button__QOSYH {
266
331
  --button-min-height-width: var(--spacing-48);
267
332
  --button-padding-x: calc(
@@ -350,70 +415,6 @@
350
415
  --button-icon-size: var(--spacing-16);
351
416
  gap: var(--spacing-8);
352
417
  }
353
- .Menu-module_menu__iHYqh {
354
- background-color: var(--color-white);
355
- color: var(--color-purple-800);
356
- width: 248px;
357
- max-height: 22rem;
358
- overflow: auto;
359
- padding-block: var(--spacing-6);
360
- outline: none;
361
- border-radius: var(--border-solid-border-radius);
362
- box-shadow: var(--shadow-large-box-shadow);
363
- }
364
-
365
- .Menu-module_menu__iHYqh .react-aria-Header {
366
- font-family: var(--typography-heading-6-font-family);
367
- font-size: var(--typography-heading-6-font-size);
368
- letter-spacing: var(--typography-heading-6-letter-spacing);
369
- font-weight: var(--typography-heading-6-font-weight);
370
- line-height: var(--typography-heading-6-line-height);
371
- padding: var(--spacing-6) 10px;
372
- margin-inline: var(--spacing-6);
373
- }
374
-
375
- .Menu-module_menu__iHYqh section:not(:last-of-type)::after {
376
- width: 100%;
377
- height: 1px;
378
- background-color: var(--border-solid-border-color);
379
- content: "";
380
- display: block;
381
- margin-block: var(--spacing-6);
382
- }
383
- .MenuItem-module_item__DPerF {
384
- font-family: var(--typography-paragraph-body-font-family);
385
- font-size: var(--typography-paragraph-body-font-size);
386
- letter-spacing: var(--typography-paragraph-body-letter-spacing);
387
- font-weight: var(--typography-paragraph-body-font-weight);
388
- line-height: var(--typography-paragraph-body-line-height);
389
- color: rgba(var(--color-purple-800-rgb), 0.7);
390
- padding: var(--spacing-6) var(--spacing-8);
391
- border: var(--border-focus-ring-border-width) var(--border-focus-ring-border-style) transparent;
392
- border-radius: 4px;
393
- display: flex;
394
- gap: 0 var(--spacing-8);
395
- align-items: center;
396
- margin-inline: var(--spacing-6);
397
- text-decoration: none;
398
- cursor: pointer;
399
- }
400
-
401
- .MenuItem-module_iconWrapper__bRdQN {
402
- flex-shrink: 0;
403
- display: flex;
404
- align-items: center;
405
- }
406
-
407
- .MenuItem-module_item__DPerF[data-focused] {
408
- background-color: var(--color-blue-100);
409
- color: var(--color-blue-500);
410
- outline: none;
411
- border-color: var(--color-blue-500);
412
- }
413
-
414
- .MenuItem-module_item__DPerF[data-disabled] {
415
- opacity: 0.3;
416
- }
417
418
  .Focusable-module_focusableWrapper__NfuIi {
418
419
  display: inline-flex;
419
420
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaizen/components",
3
- "version": "1.61.0",
3
+ "version": "1.61.2",
4
4
  "description": "Kaizen component library",
5
5
  "author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
6
6
  "homepage": "https://cultureamp.design",
@@ -92,6 +92,8 @@
92
92
  "@cultureamp/frontend-apis": "^9.8.2",
93
93
  "@cultureamp/i18n-react-intl": "^2.6.1",
94
94
  "@tanstack/react-query": "^5.51.23",
95
+ "@testing-library/dom": "^10.4.0",
96
+ "@types/jest-axe": "^3.5.9",
95
97
  "@types/lodash.debounce": "^4.0.9",
96
98
  "@types/react-highlight": "^0.12.8",
97
99
  "@types/react-textfit": "^1.1.4",
@@ -99,6 +101,7 @@
99
101
  "autoprefixer": "^10.4.20",
100
102
  "concat-cli": "^4.0.0",
101
103
  "identity-obj-proxy": "^3.0.0",
104
+ "jest-axe": "^9.0.0",
102
105
  "lodash.isempty": "^4.4.0",
103
106
  "normalize.css": "^8.0.1",
104
107
  "postcss": "^8.4.41",
@@ -115,7 +118,6 @@
115
118
  "sass": "^1.77.8",
116
119
  "serialize-query-params": "^2.0.2",
117
120
  "svgo": "^3.3.2",
118
- "ts-jest": "^29.2.4",
119
121
  "tslib": "^2.6.3",
120
122
  "tsx": "^4.17.0",
121
123
  "@kaizen/design-tokens": "10.6.0",
@@ -142,8 +144,7 @@
142
144
  "build:global-styles": "postcss ./styles/global.css --output dist/global.css",
143
145
  "build:combine-styles": "concat-cli -f ./dist/global.css ./dist/styles.css -o ./dist/styles.css && rm ./dist/global.css",
144
146
  "build:styles": "pnpm build:global-styles && pnpm build:combine-styles",
145
- "test": "FORCE_COLOR=1 jest",
146
- "test:ci": "pnpm test -- --ci",
147
+ "test": "FORCE_COLOR=1 vitest --config ../../vite.config.ts",
147
148
  "update-icons": "./src/Icon/bin/update-icons.sh",
148
149
  "i18n:extract": "pnpm i18n-extract",
149
150
  "clean": "rimraf 'dist' 'node_modules' '.turbo'",
@@ -6,7 +6,7 @@ describe("<Avatar />", () => {
6
6
  // there is an issue with react-textfit that is only flagged in a test suite
7
7
  // this solution silences that specific case https://github.com/malte-wessel/react-textfit/issues/35
8
8
  beforeEach(() => {
9
- jest.spyOn(console, "warn").mockImplementation(() => "")
9
+ vi.spyOn(console, "warn").mockImplementation(() => "")
10
10
  })
11
11
 
12
12
  it("renders user initials if the image link is broken", () => {
@@ -2,13 +2,13 @@ import React from "react"
2
2
  import { render, screen, within } from "@testing-library/react"
3
3
  import { format } from "date-fns"
4
4
  import { enUS } from "date-fns/locale"
5
+ import { vi } from "vitest"
5
6
  import { CalendarSingle, CalendarSingleProps } from "../CalendarSingle"
6
7
  import { setFocusInCalendar } from "./setFocusInCalendar"
7
-
8
8
  const CalendarWrapper = (props: Partial<CalendarSingleProps>): JSX.Element => (
9
9
  <CalendarSingle
10
10
  id="calendar-dialog"
11
- onDayClick={jest.fn()}
11
+ onDayClick={vi.fn()}
12
12
  locale={enUS}
13
13
  onMount={calendarElement =>
14
14
  setFocusInCalendar(calendarElement, props.selected)
@@ -1,9 +1,9 @@
1
1
  import React from "react"
2
2
  import { render, waitFor } from "@testing-library/react"
3
3
  import userEvent from "@testing-library/user-event"
4
+ import { vi } from "vitest"
4
5
  import { CheckboxProps } from "./Checkbox"
5
6
  import { Checkbox } from "."
6
-
7
7
  const user = userEvent.setup()
8
8
 
9
9
  const defaultProps = {
@@ -11,7 +11,7 @@ const defaultProps = {
11
11
  checkedStatus: "off",
12
12
  disabled: false,
13
13
  name: "someCheckboxName",
14
- onCheck: jest.fn(),
14
+ onCheck: vi.fn(),
15
15
  } satisfies CheckboxProps
16
16
 
17
17
  describe("<Checkbox />", () => {
@@ -1,23 +1,11 @@
1
1
  import React from "react"
2
2
  import { queryByTestId, render, waitFor } from "@testing-library/react"
3
3
  import userEvent from "@testing-library/user-event"
4
+ import { vi } from "vitest"
4
5
  import { Collapsible } from "./Collapsible"
5
-
6
6
  const user = userEvent.setup()
7
7
 
8
8
  describe("<Collapsible />", () => {
9
- it("includes the 'sticky' class on buttons when the 'sticky' prop is specified", () => {
10
- const { getByTestId } = render(
11
- <Collapsible id="1" title="First panel" sticky={{ top: "0px" }}>
12
- First panel content
13
- </Collapsible>
14
- )
15
-
16
- const collapsibleContainer = getByTestId("collapsible-header-1")
17
-
18
- expect(collapsibleContainer.classList.contains("sticky")).toBeTruthy()
19
- })
20
-
21
9
  it("toggles the height of the section on click of the button", async () => {
22
10
  const { getByTestId } = render(
23
11
  <Collapsible id="1" open title="First panel">
@@ -74,7 +62,7 @@ describe("<Collapsible />", () => {
74
62
  })
75
63
 
76
64
  it("runs the onToggle callback", async () => {
77
- const onToggle = jest.fn()
65
+ const onToggle = vi.fn()
78
66
 
79
67
  const { getByTestId } = render(
80
68
  <Collapsible id="1" open title="First panel" onToggle={onToggle}>
@@ -1,6 +1,8 @@
1
1
  import React from "react"
2
2
  import { Meta } from "@storybook/react"
3
+ import { within } from "@storybook/test"
3
4
  import { Heading } from "~components/Heading"
5
+ import { Text } from "~components/Text"
4
6
  import {
5
7
  StickerSheet,
6
8
  StickerSheetStory,
@@ -73,3 +75,50 @@ export const StickerSheetRTL: StickerSheetStory = {
73
75
  name: "Sticker Sheet (RTL)",
74
76
  parameters: { textDirection: "rtl" },
75
77
  }
78
+
79
+ export const Sticky: StickerSheetStory = {
80
+ render: () => (
81
+ <StickerSheet>
82
+ <StickerSheet.Body>
83
+ <StickerSheet.Row rowTitle="Sticky header">
84
+ <div style={{ height: "300px", overflow: "auto" }}>
85
+ <Collapsible
86
+ open
87
+ title="Sticky"
88
+ sticky={{ top: "-1px" }}
89
+ style={{ maxWidth: "300px" }}
90
+ >
91
+ <Text variant="body">
92
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
93
+ Phasellus ac scelerisque sem, vel ultricies justo. Donec eu
94
+ porttitor ante, nec gravida orci. Nulla facilisi. Cras varius
95
+ erat id fermentum mattis. Mauris bibendum vestibulum erat, quis
96
+ blandit metus viverra sit amet. Vivamus pretium vitae turpis ut
97
+ condimentum. Sed vulputate magna nisl, in cursus urna hendrerit
98
+ et. Aenean semper, est non feugiat sodales, nisl ligula aliquet
99
+ lorem, sit amet scelerisque arcu quam a sapien. Donec in viverra
100
+ urna.
101
+ </Text>
102
+ <Text variant="body" data-testid="bottom-content">
103
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
104
+ Phasellus ac scelerisque sem, vel ultricies justo. Donec eu
105
+ porttitor ante, nec gravida orci. Nulla facilisi. Cras varius
106
+ erat id fermentum mattis. Mauris bibendum vestibulum erat, quis
107
+ blandit metus viverra sit amet. Vivamus pretium vitae turpis ut
108
+ condimentum. Sed vulputate magna nisl, in cursus urna hendrerit
109
+ et. Aenean semper, est non feugiat sodales, nisl ligula aliquet
110
+ lorem, sit amet scelerisque arcu quam a sapien. Donec in viverra
111
+ urna.
112
+ </Text>
113
+ </Collapsible>
114
+ </div>
115
+ </StickerSheet.Row>
116
+ </StickerSheet.Body>
117
+ </StickerSheet>
118
+ ),
119
+ play: async ({ canvasElement }) => {
120
+ const canvas = within(canvasElement)
121
+ const element = canvas.getByTestId("bottom-content")
122
+ element.scrollIntoView({ behavior: "instant", block: "end" })
123
+ },
124
+ }
@@ -88,17 +88,6 @@ export const CustomHeader: Story = {
88
88
  ),
89
89
  }
90
90
 
91
- export const Sticky: Story = {
92
- args: {
93
- title: "Sticky header",
94
- },
95
- render: ({ title }) => (
96
- <Collapsible open title={title} sticky={{ top: "-1px" }}>
97
- This does not work in Storybook docs, so use this as a code example only.
98
- </Collapsible>
99
- ),
100
- }
101
-
102
91
  const controlledSourceCode = `
103
92
  const [isOpen, setIsOpen] = useState<boolean>(false)
104
93
  return (<Collapsible {...args} open={isOpen} onToggle={setIsOpen} />)
@@ -1,19 +1,18 @@
1
1
  import React from "react"
2
- import { waitFor } from "@testing-library/react"
2
+ import { waitFor, render } from "@testing-library/react"
3
3
  import { enUS } from "date-fns/locale"
4
- import { renderWithIntl } from "~tests"
5
4
  import { DateInputDescription } from "./DateInputDescription"
6
5
 
7
6
  describe("DateInputDescription", () => {
8
7
  it("returns template string when description is undefined", async () => {
9
- const { container } = renderWithIntl(<DateInputDescription locale={enUS} />)
8
+ const { container } = render(<DateInputDescription locale={enUS} />)
10
9
  await waitFor(() => {
11
10
  expect(container).toHaveTextContent("Input format:mm/dd/yyyy")
12
11
  })
13
12
  })
14
13
 
15
14
  it("returns template string when description is empty string", async () => {
16
- const { container } = renderWithIntl(
15
+ const { container } = render(
17
16
  <DateInputDescription description="" locale={enUS} />
18
17
  )
19
18
  await waitFor(() => {
@@ -22,7 +21,7 @@ describe("DateInputDescription", () => {
22
21
  })
23
22
 
24
23
  it("returns template string when description is a string", async () => {
25
- const { container } = renderWithIntl(
24
+ const { container } = render(
26
25
  <DateInputDescription
27
26
  description="Custom description here"
28
27
  locale={enUS}
@@ -36,7 +35,7 @@ describe("DateInputDescription", () => {
36
35
  })
37
36
 
38
37
  it("returns template string when description is an element", async () => {
39
- const { container } = renderWithIntl(
38
+ const { container } = render(
40
39
  <DateInputDescription
41
40
  description={<span>Custom description span</span>}
42
41
  locale={enUS}
@@ -1,6 +1,7 @@
1
1
  import React, { useRef } from "react"
2
2
  import { render, screen } from "@testing-library/react"
3
3
  import userEvent from "@testing-library/user-event"
4
+ import { vi } from "vitest"
4
5
  import {
5
6
  DateInputWithIconButton,
6
7
  DateInputWithIconButtonProps,
@@ -11,7 +12,7 @@ const user = userEvent.setup()
11
12
  const defaultProps: DateInputWithIconButtonProps = {
12
13
  id: "test__date-input-with-icon-button",
13
14
  labelText: "Due date",
14
- onButtonClick: jest.fn<void, []>(),
15
+ onButtonClick: vi.fn(),
15
16
  }
16
17
 
17
18
  const DateInputWithIconButtonWrapper = (
@@ -52,10 +53,7 @@ describe("<DateInputWithIconButton />", () => {
52
53
 
53
54
  describe("Refs", () => {
54
55
  it("correctly passes through input and button refs", async () => {
55
- const onButtonClick = jest.fn<
56
- void,
57
- [string | null | undefined, string | null | undefined]
58
- >()
56
+ const onButtonClick = vi.fn()
59
57
 
60
58
  const Wrapper = (): JSX.Element => {
61
59
  const inputRef = useRef<HTMLInputElement>(null)
@@ -74,7 +72,7 @@ describe("<DateInputWithIconButton />", () => {
74
72
  ref={ref}
75
73
  id="test__date-input-field--ref"
76
74
  labelText="label"
77
- onButtonClick={jest.fn<void, []>()}
75
+ onButtonClick={vi.fn()}
78
76
  />
79
77
  <button type="button" onClick={handleClick}>
80
78
  Click me