@openedx/paragon 23.14.8 → 23.14.9

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 (63) hide show
  1. package/dist/Chip/constants.js +0 -1
  2. package/dist/Chip/constants.js.map +1 -1
  3. package/dist/Container/index.js +0 -1
  4. package/dist/Container/index.js.map +1 -1
  5. package/dist/DataTable/CollapsibleButtonGroup.js +0 -1
  6. package/dist/DataTable/CollapsibleButtonGroup.js.map +1 -1
  7. package/dist/DataTable/filters/CheckboxFilter.js +1 -1
  8. package/dist/DataTable/filters/CheckboxFilter.js.map +1 -1
  9. package/dist/DataTable/index.js +7 -2
  10. package/dist/DataTable/index.js.map +1 -1
  11. package/dist/Dropdown/index.js +10 -18
  12. package/dist/Dropdown/index.js.map +1 -1
  13. package/dist/Modal/ModalDialogHeader.js +4 -1
  14. package/dist/Modal/ModalDialogHeader.js.map +1 -1
  15. package/dist/Modal/ModalLayer.js +7 -12
  16. package/dist/Modal/ModalLayer.js.map +1 -1
  17. package/dist/OverflowScroll/data/constants.js +0 -2
  18. package/dist/ProductTour/index.js +5 -7
  19. package/dist/ProductTour/index.js.map +1 -1
  20. package/dist/ProgressBar/utils.js +0 -1
  21. package/dist/SelectableBox/utils.js +1 -1
  22. package/dist/Sticky/index.js +1 -2
  23. package/dist/Sticky/index.js.map +1 -1
  24. package/dist/asInput/index.js +7 -14
  25. package/dist/asInput/index.js.map +1 -1
  26. package/dist/setupTest.js.map +1 -1
  27. package/dist/utils/index.js +0 -1
  28. package/dist/utils/index.js.map +1 -1
  29. package/lib/version.js +1 -2
  30. package/package.json +3 -3
  31. package/src/Card/CardCarousel/tests/CardCarousel.test.jsx +0 -1
  32. package/src/Chip/constants.ts +0 -1
  33. package/src/ChipCarousel/ChipCarousel.test.jsx +9 -11
  34. package/src/Container/index.tsx +0 -1
  35. package/src/DataTable/CollapsibleButtonGroup.jsx +0 -1
  36. package/src/DataTable/README.md +12 -12
  37. package/src/DataTable/filters/CheckboxFilter.jsx +1 -1
  38. package/src/DataTable/filters/tests/CheckboxFilter.test.jsx +31 -0
  39. package/src/DataTable/index.jsx +6 -2
  40. package/src/DataTable/selection/tests/utils.js +0 -1
  41. package/src/DataTable/tablecontrolbar.mdx +4 -4
  42. package/src/DataTable/tablefilters.mdx +8 -8
  43. package/src/DataTable/tests/DataTable.test.jsx +6 -4
  44. package/src/DataTable/tests/TableHeaderCell.test.jsx +0 -1
  45. package/src/DataTable/utils/tests/getTableArgs.test.js +3 -2
  46. package/src/DataTable/utils/tests/getVisibleColumns.test.js +0 -2
  47. package/src/Dropdown/index.jsx +11 -16
  48. package/src/Form/tests/useCheckboxSetValues.test.jsx +17 -9
  49. package/src/Modal/ModalDialogHeader.tsx +5 -1
  50. package/src/Modal/ModalLayer.tsx +1 -2
  51. package/src/Modal/tests/ModalLayer.test.tsx +1 -2
  52. package/src/OverflowScroll/data/constants.js +0 -2
  53. package/src/ProductTour/index.jsx +5 -7
  54. package/src/ProgressBar/utils.js +0 -1
  55. package/src/SelectableBox/tests/SelectableBox.test.jsx +0 -1
  56. package/src/SelectableBox/utils.js +1 -1
  57. package/src/Sticky/index.jsx +1 -1
  58. package/src/TransitionReplace/README.md +2 -2
  59. package/src/TransitionReplace/TransitionReplace.test.jsx +1 -1
  60. package/src/asInput/index.jsx +0 -3
  61. package/src/hooks/tests/useToggle.test.tsx +4 -5
  62. package/src/setupTest.ts +0 -1
  63. package/src/utils/index.ts +0 -1
@@ -73,22 +73,22 @@ It always shows the `SmartStatus` component. If applicable, it displays the `Dro
73
73
  Filter: CheckboxFilter,
74
74
  filter: 'includesValue',
75
75
  filterChoices: [{
76
- name: 'russian white',
76
+ name: 'Russian white',
77
77
  number: 1,
78
78
  value: 'russian white',
79
79
  },
80
80
  {
81
- name: 'orange tabby',
81
+ name: 'Orange Tabby',
82
82
  number: 2,
83
83
  value: 'orange tabby',
84
84
  },
85
85
  {
86
- name: 'brown tabby',
86
+ name: 'Brown Tabby',
87
87
  number: 3,
88
88
  value: 'brown tabby',
89
89
  },
90
90
  {
91
- name: 'siamese',
91
+ name: 'Siamese',
92
92
  number: 1,
93
93
  value: 'siamese',
94
94
  }]
@@ -104,22 +104,22 @@ all filters will be rendered in the dropdown.
104
104
  Filter: CheckboxFilter,
105
105
  filter: 'includesValue',
106
106
  filterChoices: [{
107
- name: 'russian white',
107
+ name: 'Russian white',
108
108
  number: 1,
109
109
  value: 'russian white',
110
110
  },
111
111
  {
112
- name: 'orange tabby',
112
+ name: 'Orange Tabby',
113
113
  number: 2,
114
114
  value: 'orange tabby',
115
115
  },
116
116
  {
117
- name: 'brown tabby',
117
+ name: 'Brown Tabby',
118
118
  number: 3,
119
119
  value: 'brown tabby',
120
120
  },
121
121
  {
122
- name: 'siamese',
122
+ name: 'Siamese',
123
123
  number: 1,
124
124
  value: 'siamese',
125
125
  }]
@@ -227,22 +227,22 @@ all filters will be rendered in the dropdown.
227
227
  Filter: CheckboxFilter,
228
228
  filter: 'includesValue',
229
229
  filterChoices: [{
230
- name: 'russian white',
230
+ name: 'Russian white',
231
231
  number: 1,
232
232
  value: 'russian white',
233
233
  },
234
234
  {
235
- name: 'orange tabby',
235
+ name: 'Orange Tabby',
236
236
  number: 2,
237
237
  value: 'orange tabby',
238
238
  },
239
239
  {
240
- name: 'brown tabby',
240
+ name: 'Brown Tabby',
241
241
  number: 3,
242
242
  value: 'brown tabby',
243
243
  },
244
244
  {
245
- name: 'siamese',
245
+ name: 'Siamese',
246
246
  number: 1,
247
247
  value: 'siamese',
248
248
  }]
@@ -14,13 +14,11 @@ const additionalColumns = [
14
14
  {
15
15
  id: 'action',
16
16
  Header: 'Action',
17
- // eslint-disable-next-line react/prop-types
18
17
  Cell: () => <div>extra content</div>,
19
18
  },
20
19
  {
21
20
  id: 'action2',
22
21
  Header: 'More',
23
- // eslint-disable-next-line react/prop-types
24
22
  Cell: () => <div>extra content</div>,
25
23
  },
26
24
  ];
@@ -227,8 +225,12 @@ describe('<DataTable />', () => {
227
225
  [{ manualFilters: true, pageCount: 1 }, { manualFilters: true, manualPagination: false, manualSortBy: false }],
228
226
  [{ manualPagination: true, pageCount: 1 }, { manualFilters: false, manualPagination: true, manualSortBy: false }],
229
227
  [{ manualSortBy: true, pageCount: 1 }, { manualFilters: false, manualPagination: false, manualSortBy: true }],
230
- // eslint-disable-next-line max-len, object-curly-newline
231
- [{ manualSortBy: true, manualFilters: true, manualPagination: true, pageCount: 1 }, { manualFilters: true, manualPagination: true, manualSortBy: true }],
228
+ [
229
+ {
230
+ manualSortBy: true, manualFilters: true, manualPagination: true, pageCount: 1,
231
+ },
232
+ { manualFilters: true, manualPagination: true, manualSortBy: true },
233
+ ],
232
234
  ])('calls useTable with the correct manual settings %#', (additionalProps, expected) => {
233
235
  const spy = jest.spyOn(reactTable, 'useTable');
234
236
  render(<DataTableWrapper {...props} {...additionalProps} />);
@@ -14,7 +14,6 @@ const props = {
14
14
  headerClassName: 'align-me',
15
15
  };
16
16
 
17
- // eslint-disable-next-line react/prop-types
18
17
  function FakeTable({ ...rest }) {
19
18
  return <table><thead><tr><TableHeaderCell {...rest} /></tr></thead></table>;
20
19
  }
@@ -1,4 +1,3 @@
1
- /* eslint-disable object-curly-newline */
2
1
  import {
3
2
  useSortBy, useFilters, useRowSelect, usePagination, useExpanded,
4
3
  } from 'react-table';
@@ -19,7 +18,9 @@ describe('getTableArgs', () => {
19
18
  [{ tableOptions, isFilterable: true, isSelectable: true }, [tableOptions, useFilters, useRowSelect]],
20
19
  [{ tableOptions, isFilterable: true, isExpandable: true }, [tableOptions, useFilters, useExpanded]],
21
20
  [
22
- { tableOptions, isFilterable: true, isSelectable: true, isSortable: true, isPaginated: true, isExpandable: true },
21
+ {
22
+ tableOptions, isFilterable: true, isSelectable: true, isSortable: true, isPaginated: true, isExpandable: true,
23
+ },
23
24
  [tableOptions, useFilters, useSortBy, useExpanded, usePagination, useRowSelect],
24
25
  ],
25
26
  [
@@ -1,5 +1,3 @@
1
- /* eslint-disable object-curly-newline */
2
-
3
1
  import getVisibleColumns, { selectColumn } from '../getVisibleColumns';
4
2
 
5
3
  describe('getVisibleColums', () => {
@@ -9,15 +9,14 @@ import Button from '../Button';
9
9
  import IconButton from '../IconButton';
10
10
 
11
11
  const Dropdown = React.forwardRef(
12
- // eslint-disable-next-line prefer-arrow-callback
13
- function Dropdown({
12
+ ({
14
13
  show,
15
14
  autoClose,
16
15
  onToggle,
17
16
  variant,
18
17
  className,
19
18
  ...rest
20
- }, ref) {
19
+ }, ref) => {
21
20
  const [internalShow, setInternalShow] = React.useState(show);
22
21
  const isClosingPermitted = (source) => {
23
22
  // autoClose=false only permits close on button click
@@ -89,12 +88,11 @@ Dropdown.defaultProps = {
89
88
  };
90
89
 
91
90
  const DropdownToggle = React.forwardRef(
92
- // eslint-disable-next-line prefer-arrow-callback
93
- function DropdownToggle({
91
+ ({
94
92
  as,
95
93
  bsPrefix,
96
94
  ...otherProps
97
- }, ref) {
95
+ }, ref) => {
98
96
  // hide arrow from the toggle if it is rendered as IconButton
99
97
  // because it hinders the positioning of IconButton
100
98
  const prefix = as === IconButton ? 'pgn__dropdown-toggle-iconbutton' : bsPrefix;
@@ -117,16 +115,13 @@ DropdownToggle.defaultProps = {
117
115
  };
118
116
 
119
117
  Dropdown.Item = React.forwardRef(
120
- // eslint-disable-next-line prefer-arrow-callback
121
- function DropdownItem({ className, ...otherProps }, ref) {
122
- return (
123
- <BaseDropdownItem
124
- className={classNames(className, 'pgn__dropdown-item')}
125
- ref={ref}
126
- {...otherProps}
127
- />
128
- );
129
- },
118
+ ({ className, ...otherProps }, ref) => (
119
+ <BaseDropdownItem
120
+ className={classNames(className, 'pgn__dropdown-item')}
121
+ ref={ref}
122
+ {...otherProps}
123
+ />
124
+ ),
130
125
  );
131
126
 
132
127
  Dropdown.Item.propTypes = {
@@ -1,8 +1,8 @@
1
- /* eslint-disable react/button-has-type */
2
1
  import React from 'react';
3
2
  import { render, screen } from '@testing-library/react';
4
3
  import userEvent from '@testing-library/user-event';
5
4
 
5
+ import Button from '../../Button';
6
6
  import useCheckboxSetValues from '../useCheckboxSetValues';
7
7
 
8
8
  const VALUES = 'values';
@@ -14,10 +14,18 @@ function Example() {
14
14
  return (
15
15
  <>
16
16
  <span data-testid={VALUES}>{values.join(' ')}</span>
17
- <button data-testid="add" onClick={() => add('provolone')}>Add</button>
18
- <button data-testid="remove" onClick={() => remove('provolone')}>Remove</button>
19
- <button data-testid="set" onClick={() => set(['cheddar', 'swiss', 'provolone'])}>Set</button>
20
- <button data-testid="clear" onClick={() => clear()}>Clear</button>
17
+ <Button onClick={() => add('provolone')}>
18
+ Add
19
+ </Button>
20
+ <Button onClick={() => remove('provolone')}>
21
+ Remove
22
+ </Button>
23
+ <Button onClick={() => set(['cheddar', 'swiss', 'provolone'])}>
24
+ Set
25
+ </Button>
26
+ <Button onClick={() => clear()}>
27
+ Clear
28
+ </Button>
21
29
  </>
22
30
  );
23
31
  }
@@ -31,7 +39,7 @@ describe('useCheckboxSetValues', () => {
31
39
 
32
40
  it('can append a value', async () => {
33
41
  render(<Example />);
34
- const addButton = screen.getByTestId('add');
42
+ const addButton = screen.getByRole('button', { name: 'Add' });
35
43
  const values = screen.getByTestId(VALUES);
36
44
 
37
45
  await userEvent.click(addButton);
@@ -41,7 +49,7 @@ describe('useCheckboxSetValues', () => {
41
49
 
42
50
  it('can remove a value', async () => {
43
51
  render(<Example />);
44
- const removeButton = screen.getByTestId('remove');
52
+ const removeButton = screen.getByRole('button', { name: 'Remove' });
45
53
  const values = screen.getByTestId(VALUES);
46
54
 
47
55
  await userEvent.click(removeButton);
@@ -51,7 +59,7 @@ describe('useCheckboxSetValues', () => {
51
59
 
52
60
  it('can replace all values', async () => {
53
61
  render(<Example />);
54
- const setButton = screen.getByTestId('set');
62
+ const setButton = screen.getByRole('button', { name: 'Set' });
55
63
  const values = screen.getByTestId(VALUES);
56
64
 
57
65
  await userEvent.click(setButton);
@@ -61,7 +69,7 @@ describe('useCheckboxSetValues', () => {
61
69
 
62
70
  it('can clear all values', async () => {
63
71
  render(<Example />);
64
- const clearButton = screen.getByTestId('clear');
72
+ const clearButton = screen.getByRole('button', { name: 'Clear' });
65
73
  const values = screen.getByTestId(VALUES);
66
74
 
67
75
  await userEvent.click(clearButton);
@@ -1,4 +1,3 @@
1
- /* eslint-disable react/require-default-props */
2
1
  import React from 'react';
3
2
  import PropTypes from 'prop-types';
4
3
  import classNames from 'classnames';
@@ -37,4 +36,9 @@ ModalDialogHeader.propTypes = {
37
36
  className: PropTypes.string,
38
37
  };
39
38
 
39
+ ModalDialogHeader.defaultProps = {
40
+ as: 'div',
41
+ className: '',
42
+ };
43
+
40
44
  export default ModalDialogHeader;
@@ -4,15 +4,14 @@ import { FocusOn } from 'react-focus-on';
4
4
  import Portal from './Portal';
5
5
  import { ModalContextProvider } from './ModalContext';
6
6
 
7
- // istanbul ignore next
8
7
  function ModalBackdrop({ onClick }: { onClick?: () => void }) {
9
8
  return (
10
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
11
9
  <div
12
10
  className="pgn__modal-backdrop"
13
11
  onClick={onClick}
14
12
  onKeyDown={onClick}
15
13
  data-testid="modal-backdrop"
14
+ role="presentation"
16
15
  />
17
16
  );
18
17
  }
@@ -5,7 +5,6 @@ import userEvent from '@testing-library/user-event';
5
5
 
6
6
  import ModalLayer from '../ModalLayer';
7
7
 
8
- /* eslint-disable react/prop-types */
9
8
  jest.mock('../Portal', () => function PortalMock(props: any) {
10
9
  const { children, ...otherProps } = props;
11
10
  return (
@@ -66,7 +65,7 @@ describe('<ModalLayer />', () => {
66
65
  });
67
66
  });
68
67
 
69
- test('when isOpen is false the dialog is not rendered', () => {
68
+ it('when isOpen is false the dialog is not rendered', () => {
70
69
  render(
71
70
  <ModalLayer isOpen={false} onClose={jest.fn()}>
72
71
  <Dialog />
@@ -1,3 +1 @@
1
- /* eslint-disable import/prefer-default-export */
2
-
3
1
  export const OVERFLOW_SCROLL_ITEM_CLASS = 'pgn__overflow-scroll-item';
@@ -111,16 +111,14 @@ const ProductTour = React.forwardRef(({ tours }, ref) => {
111
111
  }
112
112
  setCurrentCheckpointData(null);
113
113
  };
114
- /* eslint-disable */
115
114
  /**
116
115
  * Takes the final checkpoint array index value and looks for an existing onEnd callback.
117
- *
118
- * If an onEnd callback exist on checkpointIndex value and it is the final checkpoint
119
- * in the array, the onEnd callback will be called for the parent, and individual onEnd object.
120
- *
121
- * @param {Integer} checkpointIndex
116
+ *
117
+ * If an onEnd callback exist on checkpointIndex value and it is the final checkpoint
118
+ * in the array, the onEnd callback will be called for the parent, and individual onEnd object.
119
+ *
120
+ * @param {Integer} checkpointIndex
122
121
  */
123
- /* eslint-enable */
124
122
  const handleEnd = (checkpointIndex) => {
125
123
  setIndex(0);
126
124
  setIsTourEnabled(false);
@@ -25,7 +25,6 @@ export const placeInfoAtZero = (
25
25
  horizontalMargin += annotationOnly ? 0.0 : elementParams.width;
26
26
  }
27
27
  }
28
- // eslint-disable-next-line no-param-reassign
29
28
  ref.current.style[direction === 'rtl' ? 'marginRight' : 'marginLeft'] = `${-horizontalMargin}px`;
30
29
  return true;
31
30
  };
@@ -38,7 +38,6 @@ describe('<SelectableBox />', () => {
38
38
  it('renders with radio input type if neither checkbox nor radio is passed', () => {
39
39
  // Mock the `console.error` is intentional because an invalid `type` prop
40
40
  // with `wrongType` specified for `ForwardRef` expects one of the ['radio','flag'] parameters.
41
- // eslint-disable-next-line no-console
42
41
  const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
43
42
  render(<SelectableRadio type="wrongType" />);
44
43
  const selectableBox = screen.getByRole('button');
@@ -1,6 +1,5 @@
1
1
  import Form, { CheckboxControl, RadioControl } from '../Form';
2
2
 
3
- // eslint-disable-next-line import/prefer-default-export,consistent-return
4
3
  export const getInputType = (component, type) => {
5
4
  if (component === 'SelectableBox') {
6
5
  switch (type) {
@@ -21,4 +20,5 @@ export const getInputType = (component, type) => {
21
20
  return Form.RadioSet;
22
21
  }
23
22
  }
23
+ return null;
24
24
  };
@@ -18,7 +18,6 @@ const Sticky = React.forwardRef(({
18
18
  const defaultRef = React.useRef();
19
19
  const resolvedRef = ref || defaultRef;
20
20
 
21
- // eslint-disable-next-line consistent-return
22
21
  useLayoutEffect(() => {
23
22
  if (resolvedRef.current) {
24
23
  const stickyElement = resolvedRef.current;
@@ -45,6 +44,7 @@ const Sticky = React.forwardRef(({
45
44
  observer.unobserve(stickyElement);
46
45
  };
47
46
  }
47
+ return undefined;
48
48
  }, [position, resolvedRef]);
49
49
 
50
50
  return (
@@ -37,7 +37,7 @@ TransitionReplace expects only one child at any time. Swap content inside the co
37
37
  </div>
38
38
  )}
39
39
  </TransitionReplace>
40
- <Button variant="primary" onClick={() => setIsEditing(!isEditing)}>
40
+ <Button onClick={() => setIsEditing(!isEditing)}>
41
41
  Toggle
42
42
  </Button>
43
43
  </div>
@@ -112,7 +112,7 @@ function DemoTransitionReplace() {
112
112
 
113
113
  return (
114
114
  <div>
115
- <Button variant="primary" className="mb-2" onClick={changeContent}>
115
+ <Button className="mb-2" onClick={changeContent}>
116
116
  Next Quote
117
117
  </Button>
118
118
  <div
@@ -1,9 +1,9 @@
1
- /* eslint-disable no-plusplus, react/prop-types */
2
1
  import React from 'react';
3
2
  import { render } from '@testing-library/react';
4
3
 
5
4
  import TransitionReplace from '.';
6
5
 
6
+ /* eslint-disable-next-line react/prop-types */
7
7
  function TestReplacement({ showContentA, ...props }) {
8
8
  return (
9
9
  <TransitionReplace {...props}>
@@ -1,4 +1,3 @@
1
- /* eslint-disable react/no-unused-prop-types */
2
1
  import React from 'react';
3
2
  import PropTypes from 'prop-types';
4
3
  import classNames from 'classnames';
@@ -84,7 +83,6 @@ const asInput = (WrappedComponent, inputType = undefined, labelFirst = true) =>
84
83
  };
85
84
  }
86
85
 
87
- /* eslint-disable react/no-did-update-set-state */
88
86
  componentDidUpdate(prevProps) {
89
87
  const updatedState = {};
90
88
  if (this.props.value !== prevProps.value) {
@@ -135,7 +133,6 @@ const asInput = (WrappedComponent, inputType = undefined, labelFirst = true) =>
135
133
 
136
134
  getLabel() {
137
135
  return (
138
- // eslint-disable-next-line jsx-a11y/label-has-for
139
136
  <label
140
137
  id={`label-${this.state.id}`}
141
138
  htmlFor={this.state.id}
@@ -1,8 +1,8 @@
1
- /* eslint-disable react/button-has-type */
2
1
  import React from 'react';
3
2
  import { render, screen } from '@testing-library/react';
4
3
  import userEvent from '@testing-library/user-event';
5
4
 
5
+ import Button from '../../Button';
6
6
  import { useToggle } from '../..';
7
7
  import { ToggleHandlers } from '../useToggleHook';
8
8
 
@@ -19,16 +19,15 @@ const resetHandlerMocks = () => {
19
19
  mockHandleToggle.mockReset();
20
20
  };
21
21
 
22
- // eslint-disable-next-line react/prop-types
23
22
  function FakeComponent({ defaultIsOn, handlers }: { defaultIsOn: boolean, handlers: ToggleHandlers }) {
24
23
  const [isOn, setOn, setOff, toggle] = useToggle(defaultIsOn, handlers);
25
24
 
26
25
  return (
27
26
  <div>
28
27
  <div data-testid="toggle-value">{isOn ? TOGGLE_IS_ON : TOGGLE_IS_OFF}</div>
29
- <button id="set-on" onClick={setOn}>set on</button>
30
- <button id="set-off" onClick={setOff}>set off</button>
31
- <button id="toggle" onClick={toggle}>toggle</button>
28
+ <Button onClick={setOn}>set on</Button>
29
+ <Button onClick={setOff}>set off</Button>
30
+ <Button onClick={toggle}>toggle</Button>
32
31
  </div>
33
32
  );
34
33
  }
package/src/setupTest.ts CHANGED
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-extraneous-dependencies */
2
1
  import 'regenerator-runtime/runtime';
3
2
 
4
3
  import '@testing-library/jest-dom';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/prefer-default-export
2
1
  export { default as newId } from './newId';