@openedx/paragon 22.12.0 → 22.14.0

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 (255) hide show
  1. package/dist/Alert/_variables.scss +2 -1
  2. package/dist/Annotation/index.js.map +1 -1
  3. package/dist/Annotation/index.scss +6 -5
  4. package/dist/Avatar/index.js.map +1 -1
  5. package/dist/AvatarButton/index.js.map +1 -1
  6. package/dist/Breadcrumb/index.js.map +1 -1
  7. package/dist/Bubble/index.js +1 -0
  8. package/dist/Bubble/index.js.map +1 -1
  9. package/dist/Bubble/index.scss +3 -2
  10. package/dist/Button/deprecated/index.js.map +1 -1
  11. package/dist/Button/index.scss +19 -18
  12. package/dist/Card/CardCarousel/CardCarouselHeader.js +2 -2
  13. package/dist/Card/CardCarousel/CardCarouselHeader.js.map +1 -1
  14. package/dist/Card/CardFooter.js.map +1 -1
  15. package/dist/Card/CardHeader.js +1 -1
  16. package/dist/Card/CardHeader.js.map +1 -1
  17. package/dist/Card/CardImageCap.js.map +1 -1
  18. package/dist/Card/CardStatus.js.map +1 -1
  19. package/dist/Card/_variables.scss +3 -2
  20. package/dist/Card/index.js.map +1 -1
  21. package/dist/Card/index.scss +10 -9
  22. package/dist/Chip/ChipIcon.d.ts +1 -1
  23. package/dist/Chip/index.js +1 -0
  24. package/dist/Chip/index.js.map +1 -1
  25. package/dist/ChipCarousel/index.js.map +1 -1
  26. package/dist/Collapsible/index.js.map +1 -1
  27. package/dist/ColorPicker/index.js +1 -1
  28. package/dist/ColorPicker/index.js.map +1 -1
  29. package/dist/ColorPicker/index.scss +2 -1
  30. package/dist/DataTable/CollapsibleButtonGroup.js +2 -2
  31. package/dist/DataTable/CollapsibleButtonGroup.js.map +1 -1
  32. package/dist/DataTable/DropdownFilters.js +1 -1
  33. package/dist/DataTable/DropdownFilters.js.map +1 -1
  34. package/dist/DataTable/TableRow.js.map +1 -1
  35. package/dist/DataTable/filters/CheckboxFilter.js.map +1 -1
  36. package/dist/DataTable/filters/DropdownFilter.js.map +1 -1
  37. package/dist/DataTable/filters/MultiSelectDropdownFilter.js.map +1 -1
  38. package/dist/DataTable/filters/TextFilter.js.map +1 -1
  39. package/dist/DataTable/index.scss +14 -13
  40. package/dist/DataTable/utils/getVisibleColumns.js +1 -1
  41. package/dist/DataTable/utils/getVisibleColumns.js.map +1 -1
  42. package/dist/Dropdown/_variables.scss +2 -1
  43. package/dist/Dropdown/deprecated/DropdownMenu.js +15 -19
  44. package/dist/Dropdown/deprecated/DropdownMenu.js.map +1 -1
  45. package/dist/Dropdown/deprecated/index.js +1 -1
  46. package/dist/Dropdown/deprecated/index.js.map +1 -1
  47. package/dist/Dropdown/index.js.map +1 -1
  48. package/dist/Dropzone/DefaultContent.js.map +1 -1
  49. package/dist/Dropzone/UploadProgress.js.map +1 -1
  50. package/dist/Dropzone/index.scss +3 -2
  51. package/dist/Fieldset/index.js.map +1 -1
  52. package/dist/Form/FormAutosuggest.js +1 -1
  53. package/dist/Form/FormAutosuggest.js.map +1 -1
  54. package/dist/Form/FormControl.js.map +1 -1
  55. package/dist/Form/FormControlDecorator.js.map +1 -1
  56. package/dist/Form/FormGroupContext.d.ts +1 -1
  57. package/dist/Form/FormGroupContext.js.map +1 -1
  58. package/dist/Form/FormText.js.map +1 -1
  59. package/dist/Form/_index.scss +9 -7
  60. package/dist/Form/_variables.scss +4 -2
  61. package/dist/Form/fieldUtils.js.map +1 -1
  62. package/dist/Hyperlink/index.js +1 -0
  63. package/dist/Hyperlink/index.js.map +1 -1
  64. package/dist/Hyperlink/index.scss +3 -1
  65. package/dist/Icon/index.js.map +1 -1
  66. package/dist/IconButton/index.d.ts +13 -8
  67. package/dist/IconButton/index.js.map +1 -1
  68. package/dist/IconButtonToggle/index.js.map +1 -1
  69. package/dist/IconButtonToggle/index.scss +3 -1
  70. package/dist/Input/index.js.map +1 -1
  71. package/dist/InputSelect/index.js.map +1 -1
  72. package/dist/Layout/index.js.map +1 -1
  73. package/dist/ListBox/index.js.map +1 -1
  74. package/dist/ListBoxOption/index.js.map +1 -1
  75. package/dist/Menu/SelectMenu.js +1 -1
  76. package/dist/Menu/SelectMenu.js.map +1 -1
  77. package/dist/Menu/index.js +1 -1
  78. package/dist/Menu/index.js.map +1 -1
  79. package/dist/Modal/ModalContext.d.ts +1 -1
  80. package/dist/Modal/ModalDialog.d.ts +1 -1
  81. package/dist/Modal/ModalDialog.js.map +1 -1
  82. package/dist/Modal/ModalDialogBody.js +1 -1
  83. package/dist/Modal/ModalDialogBody.js.map +1 -1
  84. package/dist/Modal/ModalDialogHeroBackground.js.map +1 -1
  85. package/dist/Modal/ModalLayer.d.ts +3 -3
  86. package/dist/Modal/ModalLayer.js.map +1 -1
  87. package/dist/Modal/ModalPopup.js.map +1 -1
  88. package/dist/Modal/_ModalDialog.scss +3 -1
  89. package/dist/Modal/index.js +3 -1
  90. package/dist/Modal/index.js.map +1 -1
  91. package/dist/Modal/index.scss +3 -5
  92. package/dist/Nav/_mixins.scss +3 -1
  93. package/dist/Overlay/index.d.ts +2 -2
  94. package/dist/PageBanner/index.js.map +1 -1
  95. package/dist/PageBanner/index.scss +2 -1
  96. package/dist/Pagination/PaginationContext.js.map +1 -1
  97. package/dist/Pagination/index.js.map +1 -1
  98. package/dist/Popover/_variables.scss +2 -1
  99. package/dist/Popover/index.js.map +1 -1
  100. package/dist/ProductTour/Checkpoint.scss +9 -8
  101. package/dist/ProductTour/index.js +1 -1
  102. package/dist/ProductTour/index.js.map +1 -1
  103. package/dist/ProgressBar/index.js.map +1 -1
  104. package/dist/Scrollable/index.js +1 -1
  105. package/dist/Scrollable/index.js.map +1 -1
  106. package/dist/SearchField/SearchFieldAdvanced.js.map +1 -1
  107. package/dist/SearchField/index.scss +2 -1
  108. package/dist/SelectableBox/SelectableBoxSet.js.map +1 -1
  109. package/dist/Sheet/index.js.map +1 -1
  110. package/dist/Stack/index.js.map +1 -1
  111. package/dist/StatefulButton/index.js.map +1 -1
  112. package/dist/StatusAlert/index.js.map +1 -1
  113. package/dist/Stepper/StepperHeader.js +1 -1
  114. package/dist/Stepper/StepperHeader.js.map +1 -1
  115. package/dist/Stepper/StepperHeaderStep.js.map +1 -1
  116. package/dist/Sticky/index.js.map +1 -1
  117. package/dist/Table/_variables.scss +2 -1
  118. package/dist/Tabs/deprecated/index.js.map +1 -1
  119. package/dist/Tabs/index.js +1 -1
  120. package/dist/Tabs/index.js.map +1 -1
  121. package/dist/Toast/ToastContainer.scss +1 -1
  122. package/dist/Toast/index.scss +2 -2
  123. package/dist/Truncate/index.js +1 -1
  124. package/dist/Truncate/index.js.map +1 -1
  125. package/dist/ValidationFormGroup/index.js.map +1 -1
  126. package/dist/asInput/index.js.map +1 -1
  127. package/dist/hooks/useArrowKeyNavigationHook.d.ts +10 -0
  128. package/dist/hooks/{useArrowKeyNavigation.js → useArrowKeyNavigationHook.js} +13 -11
  129. package/dist/hooks/useArrowKeyNavigationHook.js.map +1 -0
  130. package/dist/hooks/useIndexOfLastVisibleChildHook.d.ts +12 -0
  131. package/dist/hooks/{useIndexOfLastVisibleChild.js → useIndexOfLastVisibleChildHook.js} +16 -12
  132. package/dist/hooks/useIndexOfLastVisibleChildHook.js.map +1 -0
  133. package/dist/hooks/useIsVisibleHook.d.ts +3 -0
  134. package/dist/hooks/{useIsVisible.js → useIsVisibleHook.js} +2 -2
  135. package/dist/hooks/useIsVisibleHook.js.map +1 -0
  136. package/dist/hooks/useToggleHook.d.ts +12 -0
  137. package/dist/hooks/useToggleHook.js +31 -0
  138. package/dist/hooks/useToggleHook.js.map +1 -0
  139. package/dist/hooks/useWindowSizeHook.d.ts +6 -0
  140. package/dist/hooks/{useWindowSize.js → useWindowSizeHook.js} +1 -1
  141. package/dist/hooks/useWindowSizeHook.js.map +1 -0
  142. package/dist/index.d.ts +5 -5
  143. package/dist/index.js +5 -5
  144. package/dist/paragon.css +1 -45
  145. package/dist/utils/newId.js.map +1 -1
  146. package/dist/withDeprecatedProps.js.map +1 -1
  147. package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/CHANGELOG.md +50 -0
  148. package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/LICENSE +7 -0
  149. package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/README.md +37 -0
  150. package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/dist/index.d.ts +20 -0
  151. package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/dist/index.js +79 -0
  152. package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/dist/index.js.map +1 -0
  153. package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/package.json +40 -0
  154. package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/tsconfig.json +4 -0
  155. package/icons/package.json +1 -1
  156. package/package.json +12 -19
  157. package/scss/core/_exports.module.scss +7 -6
  158. package/scss/core/_functions.scss +9 -7
  159. package/scss/core/_typography.scss +2 -1
  160. package/scss/core/_utilities.scss +2 -1
  161. package/scss/core/_variables.scss +98 -95
  162. package/src/Alert/_variables.scss +2 -1
  163. package/src/Annotation/index.scss +6 -5
  164. package/src/Breadcrumb/Breadcrumb.test.jsx +3 -2
  165. package/src/Bubble/index.scss +3 -2
  166. package/src/Bubble/index.tsx +1 -0
  167. package/src/Button/deprecated/Button.test.jsx +6 -4
  168. package/src/Button/index.scss +19 -18
  169. package/src/Card/CardCarousel/tests/CardCarouselControls.test.jsx +6 -4
  170. package/src/Card/_variables.scss +3 -2
  171. package/src/Card/index.scss +10 -9
  172. package/src/Chip/index.tsx +1 -0
  173. package/src/Collapsible/Collapsible.test.jsx +15 -7
  174. package/src/ColorPicker/ColorPicker.test.jsx +9 -16
  175. package/src/ColorPicker/index.jsx +1 -1
  176. package/src/ColorPicker/index.scss +2 -1
  177. package/src/DataTable/CollapsibleButtonGroup.jsx +2 -2
  178. package/src/DataTable/DropdownFilters.jsx +1 -1
  179. package/src/DataTable/dataviews.mdx +1 -8
  180. package/src/DataTable/index.scss +14 -13
  181. package/src/DataTable/selection/tests/ControlledSelectHeader.test.jsx +6 -4
  182. package/src/DataTable/tests/BulkActions.test.jsx +2 -4
  183. package/src/DataTable/tests/DataViewToggle.test.jsx +3 -7
  184. package/src/DataTable/tests/DropdownFilters.test.jsx +1 -1
  185. package/src/DataTable/tests/TableActions.test.jsx +1 -1
  186. package/src/Dropdown/_variables.scss +2 -1
  187. package/src/Dropdown/deprecated/Dropdown.test.jsx +43 -27
  188. package/src/Dropzone/README.md +3 -3
  189. package/src/Dropzone/index.scss +3 -2
  190. package/src/Dropzone/tests/__snapshots__/Dropzone.test.jsx.snap +10 -1
  191. package/src/Form/FormAutosuggest.jsx +1 -1
  192. package/src/Form/FormGroupContext.tsx +1 -1
  193. package/src/Form/_index.scss +9 -7
  194. package/src/Form/_variables.scss +4 -2
  195. package/src/Form/tests/FormAutosuggest.test.jsx +76 -57
  196. package/src/Form/tests/FormCheckboxSet.test.jsx +3 -2
  197. package/src/Form/tests/FormControl.test.jsx +9 -6
  198. package/src/Form/tests/FormRadioSet.test.jsx +3 -2
  199. package/src/Hyperlink/index.scss +3 -1
  200. package/src/Hyperlink/index.tsx +1 -0
  201. package/src/IconButtonToggle/IconButtonToggle.test.jsx +3 -2
  202. package/src/IconButtonToggle/index.scss +3 -1
  203. package/src/ListBox/ListBox.test.jsx +8 -4
  204. package/src/Menu/Menu.test.jsx +15 -10
  205. package/src/Menu/SelectMenu.jsx +1 -1
  206. package/src/Menu/index.jsx +1 -1
  207. package/src/Modal/ModalDialogBody.jsx +1 -1
  208. package/src/Modal/_ModalDialog.scss +3 -1
  209. package/src/Modal/index.jsx +2 -0
  210. package/src/Modal/index.scss +3 -5
  211. package/src/Modal/tests/ModalLayer.test.tsx +3 -2
  212. package/src/Nav/_mixins.scss +3 -1
  213. package/src/OverflowScroll/data/tests/useOverflowScroll.test.jsx +1 -2
  214. package/src/OverflowScroll/data/tests/useOverflowScrollActions.test.jsx +1 -1
  215. package/src/OverflowScroll/data/tests/useOverflowScrollElementAttributes.test.jsx +1 -1
  216. package/src/OverflowScroll/data/tests/useOverflowScrollEventListeners.test.jsx +1 -2
  217. package/src/PageBanner/index.scss +2 -1
  218. package/src/Pagination/Pagination.test.jsx +36 -28
  219. package/src/Popover/_variables.scss +2 -1
  220. package/src/ProductTour/Checkpoint.scss +9 -8
  221. package/src/ProductTour/Checkpoint.test.jsx +3 -2
  222. package/src/ProductTour/ProductTour.test.jsx +11 -24
  223. package/src/ProductTour/index.jsx +1 -1
  224. package/src/Scrollable/Scrollable.test.jsx +2 -2
  225. package/src/Scrollable/index.jsx +1 -1
  226. package/src/SearchField/index.scss +2 -1
  227. package/src/SelectableBox/tests/SelectableBox.test.jsx +3 -2
  228. package/src/StatusAlert/StatusAlert.test.jsx +6 -2
  229. package/src/Stepper/StepperHeader.jsx +1 -1
  230. package/src/Stepper/tests/Stepper.test.jsx +1 -1
  231. package/src/Table/_variables.scss +2 -1
  232. package/src/Tabs/Tabs.test.jsx +1 -1
  233. package/src/Tabs/deprecated/Tabs.test.jsx +6 -4
  234. package/src/Tabs/index.jsx +1 -1
  235. package/src/Toast/ToastContainer.scss +1 -1
  236. package/src/Toast/index.scss +2 -2
  237. package/src/Truncate/index.jsx +1 -1
  238. package/src/hooks/tests/{useIndexOfLastVisibleChild.test.jsx → useIndexOfLastVisibleChild.test.tsx} +2 -2
  239. package/src/hooks/tests/{useToggle.test.jsx → useToggle.test.tsx} +2 -1
  240. package/src/hooks/{useArrowKeyNavigation.jsx → useArrowKeyNavigationHook.tsx} +41 -13
  241. package/src/hooks/{useIndexOfLastVisibleChild.jsx → useIndexOfLastVisibleChildHook.tsx} +22 -16
  242. package/src/hooks/{useIsVisible.jsx → useIsVisibleHook.tsx} +6 -3
  243. package/src/hooks/useToggleHook.tsx +42 -0
  244. package/src/hooks/{useWindowSize.jsx → useWindowSizeHook.tsx} +7 -2
  245. package/src/index.d.ts +5 -5
  246. package/src/index.js +5 -5
  247. package/dist/hooks/useArrowKeyNavigation.js.map +0 -1
  248. package/dist/hooks/useIndexOfLastVisibleChild.js.map +0 -1
  249. package/dist/hooks/useIsVisible.js.map +0 -1
  250. package/dist/hooks/useToggle.js +0 -38
  251. package/dist/hooks/useToggle.js.map +0 -1
  252. package/dist/hooks/useWindowSize.js.map +0 -1
  253. package/src/DataTable/tests/utils.js +0 -9
  254. package/src/hooks/useToggle.jsx +0 -37
  255. /package/src/hooks/tests/{useWindowSize.test.jsx → useWindowSize.test.tsx} +0 -0
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import useArrowKeyNavigation from '../hooks/useArrowKeyNavigation';
4
+ import useArrowKeyNavigation from '../hooks/useArrowKeyNavigationHook';
5
5
 
6
6
  function Menu({
7
7
  as,
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import useIsVisible from '../hooks/useIsVisible';
4
+ import useIsVisible from '../hooks/useIsVisibleHook';
5
5
 
6
6
  function ModalDialogBody({
7
7
  as,
@@ -1,3 +1,5 @@
1
+ @use "sass:map";
2
+
1
3
  .pgn__modal {
2
4
  background: $modal-content-bg;
3
5
  border-radius: $modal-content-inner-border-radius;
@@ -315,7 +317,7 @@
315
317
 
316
318
  .pgn__alert-modal__title_icon {
317
319
  flex-shrink: 0;
318
- margin-right: map-get($spacers, 2\.5);
320
+ margin-right: map.get($spacers, 2\.5);
319
321
  }
320
322
  }
321
323
  }
@@ -50,6 +50,8 @@ class Modal extends React.Component {
50
50
 
51
51
  componentWillUnmount() {
52
52
  if (this.parentElement) {
53
+ // TODO: update this to use the new createRoot() compatible APIs.
54
+ // eslint-disable-next-line react/no-deprecated
53
55
  ReactDOM.unmountComponentAtNode(this.parentElement);
54
56
  }
55
57
  }
@@ -1,3 +1,4 @@
1
+ @use "sass:map";
1
2
  @import "variables";
2
3
  @import "~bootstrap/scss/modal";
3
4
  @import "ModalDialog";
@@ -19,12 +20,9 @@
19
20
 
20
21
  .pgn__modal-backdrop {
21
22
  background: $modal-backdrop-bg;
22
- bottom: 0;
23
- left: 0;
23
+ inset: 0;
24
24
  opacity: $modal-backdrop-opacity;
25
25
  position: fixed;
26
- right: 0;
27
- top: 0;
28
26
  z-index: 0;
29
27
  }
30
28
 
@@ -88,7 +86,7 @@
88
86
  margin: auto;
89
87
  padding: calc($spacer / 2);
90
88
 
91
- @media (min-width: map-get($grid-breakpoints, "sm")) {
89
+ @media (min-width: map.get($grid-breakpoints, "sm")) {
92
90
  padding: $spacer;
93
91
  }
94
92
  }
@@ -78,7 +78,8 @@ describe('<ModalLayer />', () => {
78
78
  });
79
79
 
80
80
  describe('Dismiss modal', () => {
81
- it('closes a non-blocking modal layer when backdrop is clicked', () => {
81
+ it('closes a non-blocking modal layer when backdrop is clicked', async () => {
82
+ const user = userEvent.setup();
82
83
  const closeFn = jest.fn();
83
84
  render(
84
85
  <ModalLayer isOpen onClose={closeFn} isBlocking={false}>
@@ -86,7 +87,7 @@ describe('<ModalLayer />', () => {
86
87
  </ModalLayer>,
87
88
  );
88
89
  const backdrop = screen.getByTestId('modal-backdrop');
89
- userEvent.click(backdrop);
90
+ await user.click(backdrop);
90
91
  expect(closeFn).toHaveBeenCalled();
91
92
  });
92
93
 
@@ -1,3 +1,5 @@
1
+ @use "sass:map";
2
+
1
3
  @mixin nav-tabs-link-focus(
2
4
  $border-color,
3
5
  $radius: $nav-tabs-border-radius,
@@ -5,7 +7,7 @@
5
7
  ) {
6
8
  position: relative;
7
9
  outline: 0;
8
- z-index: map-get($map: $indexes, $key: 1);
10
+ z-index: map.get($map: $indexes, $key: 1);
9
11
 
10
12
  &::before {
11
13
  content: "";
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import { renderHook } from '@testing-library/react-hooks/dom';
3
- import { act } from '@testing-library/react';
2
+ import { act, renderHook } from '@testing-library/react';
4
3
  import useOverflowScroll from '../useOverflowScroll';
5
4
  import useOverflowScrollActions from '../useOverflowScrollActions';
6
5
  import getChildrenElements from '../getChildrenElements';
@@ -1,4 +1,4 @@
1
- import { renderHook } from '@testing-library/react-hooks/dom';
1
+ import { renderHook } from '@testing-library/react';
2
2
  import { act } from 'react-test-renderer';
3
3
  import useOverflowScrollActions from '../useOverflowScrollActions';
4
4
 
@@ -1,4 +1,4 @@
1
- import { renderHook } from '@testing-library/react-hooks/dom';
1
+ import { renderHook } from '@testing-library/react';
2
2
  import useOverflowScrollElementAttributes, {
3
3
  OVERFLOW_SCROLL_OVERFLOW_CONTAINER_CLASS,
4
4
  OVERFLOW_SCROLL_OVERFLOW_OPACITY_MASK_GRADIENT_START,
@@ -1,5 +1,4 @@
1
- import { renderHook } from '@testing-library/react-hooks/dom';
2
- import { act } from '@testing-library/react';
1
+ import { act, renderHook } from '@testing-library/react';
3
2
  import useOverflowScrollEventListeners from '../useOverflowScrollEventListeners';
4
3
 
5
4
  const divElement = document.createElement('div');
@@ -1,3 +1,4 @@
1
+ @use "sass:map";
1
2
  // stylelint-disable-next-line selector-class-pattern
2
3
  .pgn__pageBanner-component {
3
4
  width: 100%;
@@ -46,7 +47,7 @@
46
47
  flex-grow: 1;
47
48
  justify-content: center;
48
49
  align-items: center;
49
- padding: map_get($spacers, 2) map_get($spacers, 2\.5);
50
+ padding: map.get($spacers, 2) map.get($spacers, 2\.5);
50
51
  text-align: center;
51
52
  }
52
53
 
@@ -3,7 +3,6 @@ import { Context as ResponsiveContext } from 'react-responsive';
3
3
  import renderer from 'react-test-renderer';
4
4
  import {
5
5
  render,
6
- act,
7
6
  screen,
8
7
  } from '@testing-library/react';
9
8
  import userEvent from '@testing-library/user-event';
@@ -66,48 +65,53 @@ describe('<Pagination />', () => {
66
65
  });
67
66
 
68
67
  describe('handles controlled and uncontrolled behaviour properly', () => {
69
- it('does not internally change page on page click if currentPage is provided', () => {
68
+ it('does not internally change page on page click if currentPage is provided', async () => {
69
+ const user = userEvent.setup();
70
70
  render(<Pagination {...baseProps} />);
71
71
  expect(screen.getByLabelText(PAGINATION_BUTTON_LABEL_CURRENT_PAGE, { exact: false })).toHaveTextContent('1');
72
72
 
73
- userEvent.click(screen.getByText(PAGINATION_BUTTON_LABEL_NEXT));
73
+ await user.click(screen.getByText(PAGINATION_BUTTON_LABEL_NEXT));
74
74
  expect(screen.getByLabelText(PAGINATION_BUTTON_LABEL_CURRENT_PAGE, { exact: false })).toHaveTextContent('1');
75
75
 
76
- userEvent.click(screen.getByRole('button', { name: `${PAGINATION_BUTTON_LABEL_PAGE} 3` }));
76
+ await user.click(screen.getByRole('button', { name: `${PAGINATION_BUTTON_LABEL_PAGE} 3` }));
77
77
  expect(screen.getByLabelText(PAGINATION_BUTTON_LABEL_CURRENT_PAGE, { exact: false })).toHaveTextContent('1');
78
78
  });
79
79
 
80
- it('controls page selection internally if currentPage is not provided', () => {
80
+ it('controls page selection internally if currentPage is not provided', async () => {
81
+ const user = userEvent.setup();
81
82
  render(<Pagination {...baseProps} currentPage={undefined} />);
82
83
  expect(screen.getByLabelText(PAGINATION_BUTTON_LABEL_CURRENT_PAGE, { exact: false })).toHaveTextContent('1');
83
84
 
84
- userEvent.click(screen.getByText(PAGINATION_BUTTON_LABEL_NEXT));
85
+ await user.click(screen.getByText(PAGINATION_BUTTON_LABEL_NEXT));
85
86
  expect(screen.getByLabelText(PAGINATION_BUTTON_LABEL_CURRENT_PAGE, { exact: false })).toHaveTextContent('2');
86
87
 
87
- userEvent.click(screen.getByRole('button', { name: `${PAGINATION_BUTTON_LABEL_PAGE} 3` }));
88
+ await user.click(screen.getByRole('button', { name: `${PAGINATION_BUTTON_LABEL_PAGE} 3` }));
88
89
  expect(screen.getByLabelText(PAGINATION_BUTTON_LABEL_CURRENT_PAGE, { exact: false })).toHaveTextContent('3');
89
90
 
90
- userEvent.click(screen.getByText(PAGINATION_BUTTON_LABEL_PREV));
91
+ await user.click(screen.getByText(PAGINATION_BUTTON_LABEL_PREV));
91
92
  expect(screen.getByLabelText(PAGINATION_BUTTON_LABEL_CURRENT_PAGE, { exact: false })).toHaveTextContent('2');
92
93
  });
93
94
 
94
- it('does not chang page if you click "next" button while on last page', () => {
95
+ it('does not chang page if you click "next" button while on last page', async () => {
96
+ const user = userEvent.setup();
95
97
  render(<Pagination {...baseProps} currentPage={undefined} initialPage={5} />);
96
98
  expect(screen.getByLabelText(PAGINATION_BUTTON_LABEL_CURRENT_PAGE, { exact: false })).toHaveTextContent('5');
97
- userEvent.click(screen.getByText(PAGINATION_BUTTON_LABEL_NEXT));
99
+ await user.click(screen.getByText(PAGINATION_BUTTON_LABEL_NEXT));
98
100
  expect(screen.getByLabelText(PAGINATION_BUTTON_LABEL_CURRENT_PAGE, { exact: false })).toHaveTextContent('5');
99
101
  });
100
102
 
101
- it('does not chang page if you click "previous" button while on first page', () => {
103
+ it('does not chang page if you click "previous" button while on first page', async () => {
104
+ const user = userEvent.setup();
102
105
  render(<Pagination {...baseProps} currentPage={undefined} initialPage={1} />);
103
106
  expect(screen.getByLabelText(PAGINATION_BUTTON_LABEL_CURRENT_PAGE, { exact: false })).toHaveTextContent('1');
104
- userEvent.click(screen.getByText(PAGINATION_BUTTON_LABEL_PREV));
107
+ await user.click(screen.getByText(PAGINATION_BUTTON_LABEL_PREV));
105
108
  expect(screen.getByLabelText(PAGINATION_BUTTON_LABEL_CURRENT_PAGE, { exact: false })).toHaveTextContent('1');
106
109
  });
107
110
  });
108
111
 
109
112
  describe('handles focus properly', () => {
110
- it('should change focus to next button if previous page is first page', () => {
113
+ it('should change focus to next button if previous page is first page', async () => {
114
+ const user = userEvent.setup();
111
115
  const props = {
112
116
  ...baseProps,
113
117
  currentPage: 2,
@@ -117,11 +121,12 @@ describe('<Pagination />', () => {
117
121
  },
118
122
  };
119
123
  render(<Pagination {...props} />);
120
- userEvent.click(screen.getByText(PAGINATION_BUTTON_LABEL_PREV));
124
+ await user.click(screen.getByText(PAGINATION_BUTTON_LABEL_PREV));
121
125
  expect(screen.getByText(PAGINATION_BUTTON_LABEL_NEXT)).toHaveFocus();
122
126
  });
123
127
 
124
- it('should change focus to previous button if next page is last page', () => {
128
+ it('should change focus to previous button if next page is last page', async () => {
129
+ const user = userEvent.setup();
125
130
  const props = {
126
131
  ...baseProps,
127
132
  currentPage: baseProps.pageCount - 1,
@@ -131,7 +136,7 @@ describe('<Pagination />', () => {
131
136
  },
132
137
  };
133
138
  render(<Pagination {...props} />);
134
- userEvent.click(screen.getByText(props.buttonLabel.next));
139
+ await user.click(screen.getByText(props.buttonLabel.next));
135
140
  expect(screen.getByText(props.buttonLabel.previous)).toHaveFocus();
136
141
  });
137
142
  });
@@ -191,7 +196,8 @@ describe('<Pagination />', () => {
191
196
  });
192
197
 
193
198
  describe('should fire callbacks properly', () => {
194
- it('should not fire onPageSelect when selecting current page', () => {
199
+ it('should not fire onPageSelect when selecting current page', async () => {
200
+ const user = userEvent.setup();
195
201
  const spy = jest.fn();
196
202
  const props = {
197
203
  ...baseProps,
@@ -203,11 +209,12 @@ describe('<Pagination />', () => {
203
209
  </ResponsiveContext.Provider>
204
210
  ));
205
211
 
206
- userEvent.click(screen.getByLabelText(PAGINATION_BUTTON_LABEL_CURRENT_PAGE, { exact: false }));
212
+ await user.click(screen.getByLabelText(PAGINATION_BUTTON_LABEL_CURRENT_PAGE, { exact: false }));
207
213
  expect(spy).toHaveBeenCalledTimes(0);
208
214
  });
209
215
 
210
- it('should fire onPageSelect callback when selecting new page', () => {
216
+ it('should fire onPageSelect callback when selecting new page', async () => {
217
+ const user = userEvent.setup();
211
218
  const spy = jest.fn();
212
219
  const props = {
213
220
  ...baseProps,
@@ -219,17 +226,18 @@ describe('<Pagination />', () => {
219
226
  </ResponsiveContext.Provider>
220
227
  ));
221
228
 
222
- userEvent.click(screen.getByLabelText(`${PAGINATION_BUTTON_LABEL_PAGE} 2`));
229
+ await user.click(screen.getByLabelText(`${PAGINATION_BUTTON_LABEL_PAGE} 2`));
223
230
  expect(spy).toHaveBeenCalledTimes(1);
224
231
 
225
- userEvent.click(screen.getByLabelText(`${PAGINATION_BUTTON_LABEL_PAGE} 3`));
232
+ await user.click(screen.getByLabelText(`${PAGINATION_BUTTON_LABEL_PAGE} 3`));
226
233
  expect(spy).toHaveBeenCalledTimes(2);
227
234
  });
228
235
  });
229
236
  });
230
237
 
231
238
  describe('fires previous and next button click handlers', () => {
232
- it('previous button onClick', () => {
239
+ it('previous button onClick', async () => {
240
+ const user = userEvent.setup();
233
241
  const spy = jest.fn();
234
242
  const props = {
235
243
  ...baseProps,
@@ -238,11 +246,12 @@ describe('<Pagination />', () => {
238
246
  };
239
247
  render(<Pagination {...props} />);
240
248
  const expectedPrevButtonAriaLabel = `${PAGINATION_BUTTON_LABEL_PREV}, ${PAGINATION_BUTTON_LABEL_PAGE} 2`;
241
- userEvent.click(screen.getByRole('button', { name: expectedPrevButtonAriaLabel }));
249
+ await user.click(screen.getByRole('button', { name: expectedPrevButtonAriaLabel }));
242
250
  expect(spy).toHaveBeenCalledTimes(1);
243
251
  });
244
252
 
245
- it('next button onClick', () => {
253
+ it('next button onClick', async () => {
254
+ const user = userEvent.setup();
246
255
  const spy = jest.fn();
247
256
  const props = {
248
257
  ...baseProps,
@@ -250,7 +259,7 @@ describe('<Pagination />', () => {
250
259
  };
251
260
  render(<Pagination {...props} />);
252
261
  const expectedNextButtonAriaLabel = `${PAGINATION_BUTTON_LABEL_NEXT}, ${PAGINATION_BUTTON_LABEL_PAGE} 2`;
253
- userEvent.click(screen.getByRole('button', { name: expectedNextButtonAriaLabel }));
262
+ await user.click(screen.getByRole('button', { name: expectedNextButtonAriaLabel }));
254
263
  expect(spy).toHaveBeenCalledTimes(1);
255
264
  });
256
265
  });
@@ -318,13 +327,12 @@ describe('<Pagination />', () => {
318
327
  });
319
328
 
320
329
  it('for the reduced variant shows dropdown button with the page count as label', async () => {
330
+ const user = userEvent.setup();
321
331
  render(<Pagination variant="reduced" {...props} />);
322
332
 
323
333
  const dropdownLabel = `${baseProps.currentPage} de ${baseProps.pageCount}`;
324
334
 
325
- await act(async () => {
326
- userEvent.click(screen.getByRole('button', { name: dropdownLabel }));
327
- });
335
+ await user.click(screen.getByRole('button', { name: dropdownLabel }));
328
336
  expect(screen.queryAllByRole('button', { name: /^\d+$/ }).length).toEqual(baseProps.pageCount);
329
337
  });
330
338
 
@@ -1,3 +1,4 @@
1
+ @use "sass:color";
1
2
  // Popovers
2
3
 
3
4
  $popover-font-size: $font-size-sm !default;
@@ -26,7 +27,7 @@ $popover-arrow-width: 1rem !default;
26
27
  $popover-arrow-height: .5rem !default;
27
28
  $popover-arrow-color: $popover-bg !default;
28
29
 
29
- $popover-arrow-outer-color: fade-in($popover-border-color, .05) !default;
30
+ $popover-arrow-outer-color: color.adjust($popover-border-color, $alpha: .05) !default;
30
31
 
31
32
  $popover-success-bg: $success-100 !default;
32
33
  $popover-success-icon-color: $success-500 !default;
@@ -1,3 +1,4 @@
1
+ @use "sass:map";
1
2
  @import "variables";
2
3
 
3
4
  $checkpoint-arrow-top-color: solid $checkpoint-arrow-width $checkpoint-border-color;
@@ -9,12 +10,12 @@ $checkpoint-arrow-transparent: solid $checkpoint-arrow-width transparent;
9
10
  background: $checkpoint-background-color;
10
11
  border-top: $checkpoint-border-width solid $checkpoint-border-color;
11
12
  border-radius: $border-radius;
12
- padding: map_get($spacers, 4);
13
+ padding: map.get($spacers, 4);
13
14
  box-shadow: 0 .25rem .5rem rgba(0, 0, 0, .3);
14
15
  z-index: $checkpoint-z-index;
15
16
  max-width: $checkpoint-max-width;
16
17
 
17
- @media (max-width: map-get($grid-breakpoints, "md")) {
18
+ @media (max-width: map.get($grid-breakpoints, "md")) {
18
19
  min-width: 90%;
19
20
  max-width: 90%;
20
21
  }
@@ -43,7 +44,7 @@ $checkpoint-arrow-transparent: solid $checkpoint-arrow-width transparent;
43
44
  }
44
45
 
45
46
  .pgn__checkpoint-button_dismiss {
46
- margin-inline-end: map_get($spacers, 2);
47
+ margin-inline-end: map.get($spacers, 2);
47
48
  }
48
49
 
49
50
  .pgn__checkpoint-breadcrumb {
@@ -61,11 +62,11 @@ $checkpoint-arrow-transparent: solid $checkpoint-arrow-width transparent;
61
62
  }
62
63
 
63
64
  &:not(:first-child) {
64
- margin-left: map_get($spacers, 1\.5);
65
+ margin-left: map.get($spacers, 1\.5);
65
66
  }
66
67
 
67
68
  [dir="rtl"] & {
68
- margin-left: map_get($spacers, 1\.5);
69
+ margin-left: map.get($spacers, 1\.5);
69
70
  margin-right: 0;
70
71
 
71
72
  &:last-child {
@@ -81,19 +82,19 @@ $checkpoint-arrow-transparent: solid $checkpoint-arrow-width transparent;
81
82
 
82
83
  .pgn__checkpoint-body {
83
84
  color: $checkpoint-body-color;
84
- margin-bottom: map_get($spacers, 3\.5);
85
+ margin-bottom: map.get($spacers, 3\.5);
85
86
  text-align: start;
86
87
  }
87
88
 
88
89
  .pgn__checkpoint-header {
89
90
  display: flex;
90
91
  justify-content: space-between;
91
- margin-bottom: map_get($spacers, 2\.5);
92
+ margin-bottom: map.get($spacers, 2\.5);
92
93
  }
93
94
 
94
95
  #pgn__checkpoint-title {
95
96
  font-size: $h3-font-size;
96
- margin-inline-end: map_get($spacers, 2\.5);
97
+ margin-inline-end: map.get($spacers, 2\.5);
97
98
  margin-bottom: 0;
98
99
  }
99
100
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { render, screen } from '@testing-library/react';
3
- import userEvent from '@testing-library/user-event';
3
+ import userEvent, { PointerEventsCheckLevel } from '@testing-library/user-event';
4
4
  import { IntlProvider } from 'react-intl';
5
5
 
6
6
  import * as popper from '@popperjs/core';
@@ -100,8 +100,9 @@ describe('Checkpoint', () => {
100
100
  });
101
101
 
102
102
  it('end button onClick calls handleEnd', async () => {
103
+ const user = userEvent.setup({ pointerEventsCheck: PointerEventsCheckLevel.Never });
103
104
  const endButton = screen.getByText('End', { selector: 'button' });
104
- await userEvent.click(endButton, undefined, { skipPointerEventsCheck: true });
105
+ await user.click(endButton);
105
106
  expect(handleEnd).toHaveBeenCalledTimes(1);
106
107
  });
107
108
  });
@@ -144,6 +144,7 @@ describe('<ProductTour />', () => {
144
144
  });
145
145
 
146
146
  it('onClick of end button disables tour', async () => {
147
+ const user = userEvent.setup();
147
148
  const { rerender } = render(<ProductTourWrapper tours={[tourData]} />);
148
149
 
149
150
  // Verify a Checkpoint has rendered
@@ -151,29 +152,21 @@ describe('<ProductTour />', () => {
151
152
 
152
153
  // Advance the Tour to the last Checkpoint
153
154
  const advanceButton1 = screen.getByRole('button', { name: 'Next' });
154
- await act(async () => {
155
- await userEvent.click(advanceButton1);
156
- });
155
+ await user.click(advanceButton1);
157
156
 
158
157
  const advanceButton2 = screen.getByRole('button', { name: 'Next' });
159
- await act(async () => {
160
- await userEvent.click(advanceButton2);
161
- });
158
+ await user.click(advanceButton2);
162
159
 
163
160
  rerender(<ProductTourWrapper tours={[tourData]} />);
164
161
 
165
162
  const advanceButton3 = screen.getByRole('button', { name: 'Override advance' });
166
- await act(async () => {
167
- await userEvent.click(advanceButton3);
168
- });
163
+ await user.click(advanceButton3);
169
164
 
170
165
  rerender(<ProductTourWrapper tours={[tourData]} />);
171
166
 
172
167
  // Click the end button
173
168
  const endButton = screen.getByRole('button', { name: 'End' });
174
- await act(async () => {
175
- await userEvent.click(endButton);
176
- });
169
+ await user.click(endButton);
177
170
 
178
171
  // Verify no Checkpoints have rendered
179
172
  expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
@@ -188,9 +181,7 @@ describe('<ProductTour />', () => {
188
181
  expect(screen.getByRole('dialog', { name: 'Checkpoint 1' })).toBeInTheDocument();
189
182
 
190
183
  // Click Escape key
191
- await act(async () => {
192
- await userEvent.keyboard('{escape}');
193
- });
184
+ await userEvent.keyboard('{Escape}');
194
185
 
195
186
  // Verify no Checkpoints have been rendered
196
187
  expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
@@ -271,31 +262,27 @@ describe('<ProductTour />', () => {
271
262
  expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
272
263
  });
273
264
  it('calls customHandleOnEnd onClick of end button', async () => {
265
+ const user = userEvent.setup();
274
266
  const { rerender } = render(<ProductTourWrapper tours={[overrideTourData]} />);
275
267
  const advanceButton = screen.getByRole('button', { name: 'Override advance' });
276
- await act(async () => {
277
- await userEvent.click(advanceButton);
278
- });
268
+ await user.click(advanceButton);
279
269
 
280
270
  rerender(<ProductTourWrapper tours={[overrideTourData]} />);
281
271
 
282
272
  expect(screen.getByText('Checkpoint 4')).toBeInTheDocument();
283
273
  const endButton = screen.getByRole('button', { name: 'Override end' });
284
- await act(async () => {
285
- await userEvent.click(endButton);
286
- });
274
+ await user.click(endButton);
287
275
  expect(handleEnd).toBeCalledTimes(1);
288
276
  expect(customOnEnd).toHaveBeenCalledTimes(1);
289
277
  expect(screen.queryByText('Checkpoint 4')).not.toBeInTheDocument();
290
278
  });
291
279
  it('calls onEscape on escape button key press', async () => {
280
+ const user = userEvent.setup();
292
281
  render(<ProductTourWrapper tours={[overrideTourData]} />);
293
282
  expect(screen.getByText('Checkpoint 3')).toBeInTheDocument();
294
283
  const container = screen.getByRole('dialog');
295
284
  container.focus();
296
- await act(async () => {
297
- await userEvent.keyboard('{escape}');
298
- });
285
+ await user.keyboard('{Escape}');
299
286
  expect(handleEscape).toHaveBeenCalledTimes(1);
300
287
  expect(screen.queryByText('Checkpoint 3')).not.toBeInTheDocument();
301
288
  });
@@ -46,7 +46,7 @@ const ProductTour = React.forwardRef(({ tours }, ref) => {
46
46
 
47
47
  useEffect(() => {
48
48
  const handleEsc = (event) => {
49
- if (event.keyCode === 27) {
49
+ if (event.key === 'Escape') {
50
50
  setIsTourEnabled(false);
51
51
  if (onEscape) {
52
52
  onEscape();
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { render, screen } from '@testing-library/react'; // (or /dom, /vue, ...)
3
- import useIsVisible from '../hooks/useIsVisible';
3
+ import useIsVisible from '../hooks/useIsVisibleHook';
4
4
 
5
5
  import Scrollable, { CLASSNAME_SCROLL_BOTTOM, CLASSNAME_SCROLL_TOP } from '.';
6
6
 
7
- jest.mock('../hooks/useIsVisible');
7
+ jest.mock('../hooks/useIsVisibleHook');
8
8
 
9
9
  function rangeOfNumbers() {
10
10
  return Array.from({ length: 50 }, (v, k) => k + 1);
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
 
5
- import useIsVisible from '../hooks/useIsVisible';
5
+ import useIsVisible from '../hooks/useIsVisibleHook';
6
6
 
7
7
  export const CLASSNAME_SCROLL_TOP = 'pgn__scrollable-body-scroll-top';
8
8
  export const CLASSNAME_SCROLL_BOTTOM = 'pgn__scrollable-body-scroll-bottom';
@@ -1,3 +1,4 @@
1
+ @use "sass:map";
1
2
  @import "variables";
2
3
 
3
4
  .pgn__searchfield {
@@ -129,5 +130,5 @@
129
130
  .pgn__searchfield__iconbutton-submit,
130
131
  .pgn__searchfield__iconbutton-reset {
131
132
  flex-shrink: 0;
132
- margin-inline-end: map-get($spacers, 1);
133
+ margin-inline-end: map.get($spacers, 1);
133
134
  }
@@ -123,12 +123,13 @@ describe('<SelectableBox />', () => {
123
123
  rerender(<SelectableRadio checked />);
124
124
  expect(radio.className).toContain('pgn__selectable_box-active');
125
125
  });
126
- it('ref is passed to onClick function', () => {
126
+ it('ref is passed to onClick function', async () => {
127
+ const user = userEvent.setup();
127
128
  let inputRef;
128
129
  const onClick = (ref) => { inputRef = ref; };
129
130
  render(<SelectableRadio onClick={onClick} />);
130
131
  const radio = screen.getByRole('button');
131
- userEvent.click(radio);
132
+ await user.click(radio);
132
133
  expect(inputRef).not.toBeFalsy();
133
134
  });
134
135
  });
@@ -113,17 +113,21 @@ describe('<StatusAlert />', () => {
113
113
  });
114
114
 
115
115
  it('does nothing on invalid keystroke q', async () => {
116
+ const user = userEvent.setup();
116
117
  const closeButton = screen.getByRole('button');
117
118
  expect(document.activeElement).toEqual(closeButton);
118
119
  closeButton.focus();
119
- await userEvent.keyboard('{q}');
120
+ await user.keyboard('{q}');
120
121
  expect(document.activeElement).toEqual(closeButton);
121
122
  });
122
123
 
123
124
  it('does nothing on invalid keystroke + ctrl', async () => {
125
+ const user = userEvent.setup();
124
126
  const closeButton = screen.getByRole('button');
125
127
  expect(document.activeElement).toEqual(closeButton);
126
- await userEvent.keyboard('{ctrl>}{tab}{/ctrl}');
128
+ // This was '{Control>}{Tab}{/Control}' before, but that _does_ seem to be changing the focus in newer RTL/React.
129
+ // I don't think that was the point of the test though, so it's 'z' for now.
130
+ await user.keyboard('{Control>}z{/Control}');
127
131
  expect(document.activeElement).toEqual(closeButton);
128
132
  });
129
133
  });
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
  import StepperHeaderStep from './StepperHeaderStep';
5
5
  import { StepperContext } from './StepperContext';
6
- import useWindowSize from '../hooks/useWindowSize';
6
+ import useWindowSize from '../hooks/useWindowSizeHook';
7
7
  import breakpoints, { Size } from '../utils/breakpoints';
8
8
 
9
9
  function StepListSeparator() {
@@ -7,7 +7,7 @@ import { stepsReducer } from '../StepperContext';
7
7
 
8
8
  const mockWindowSize = { width: 1000, height: 1000 };
9
9
 
10
- jest.mock('../../hooks/useWindowSize', () => () => mockWindowSize);
10
+ jest.mock('../../hooks/useWindowSizeHook', () => () => mockWindowSize);
11
11
 
12
12
  function Example({
13
13
  // eslint-disable-next-line react/prop-types
@@ -1,3 +1,4 @@
1
+ @use "sass:color";
1
2
  // Tables
2
3
  //
3
4
  // Customizes the `.table` component with basic values, each used across all table variations.
@@ -23,7 +24,7 @@ $table-dark-bg: theme-color("gray", "hover") !default;
23
24
  $table-dark-accent-bg: rgba($white, .05) !default;
24
25
  $table-dark-hover-color: $table-dark-color !default;
25
26
  $table-dark-hover-bg: rgba($white, .075) !default;
26
- $table-dark-border-color: lighten($table-dark-bg, 7.5%) !default;
27
+ $table-dark-border-color: color.adjust($table-dark-bg, $lightness: 7.5%) !default;
27
28
  $table-dark-color: $white !default;
28
29
 
29
30
  $table-striped-order: odd !default;