@openedx/paragon 23.14.7 → 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.
- package/dist/Chip/constants.js +0 -1
- package/dist/Chip/constants.js.map +1 -1
- package/dist/Container/index.js +0 -1
- package/dist/Container/index.js.map +1 -1
- package/dist/DataTable/CollapsibleButtonGroup.js +0 -1
- package/dist/DataTable/CollapsibleButtonGroup.js.map +1 -1
- package/dist/DataTable/filters/CheckboxFilter.js +1 -1
- package/dist/DataTable/filters/CheckboxFilter.js.map +1 -1
- package/dist/DataTable/index.js +7 -2
- package/dist/DataTable/index.js.map +1 -1
- package/dist/Dropdown/index.js +10 -18
- package/dist/Dropdown/index.js.map +1 -1
- package/dist/Modal/ModalDialogHeader.js +4 -1
- package/dist/Modal/ModalDialogHeader.js.map +1 -1
- package/dist/Modal/ModalLayer.js +7 -12
- package/dist/Modal/ModalLayer.js.map +1 -1
- package/dist/OverflowScroll/data/constants.js +0 -2
- package/dist/ProductTour/index.js +5 -7
- package/dist/ProductTour/index.js.map +1 -1
- package/dist/ProgressBar/utils.js +0 -1
- package/dist/SelectableBox/utils.js +1 -1
- package/dist/Sticky/index.js +1 -2
- package/dist/Sticky/index.js.map +1 -1
- package/dist/asInput/index.js +7 -14
- package/dist/asInput/index.js.map +1 -1
- package/dist/setupTest.js.map +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/icons/package.json +1 -1
- package/lib/version.js +1 -2
- package/package.json +4 -4
- package/src/Card/CardCarousel/tests/CardCarousel.test.jsx +0 -1
- package/src/Chip/constants.ts +0 -1
- package/src/ChipCarousel/ChipCarousel.test.jsx +9 -11
- package/src/Container/index.tsx +0 -1
- package/src/DataTable/CollapsibleButtonGroup.jsx +0 -1
- package/src/DataTable/README.md +12 -12
- package/src/DataTable/filters/CheckboxFilter.jsx +1 -1
- package/src/DataTable/filters/tests/CheckboxFilter.test.jsx +31 -0
- package/src/DataTable/index.jsx +6 -2
- package/src/DataTable/selection/tests/utils.js +0 -1
- package/src/DataTable/tablecontrolbar.mdx +4 -4
- package/src/DataTable/tablefilters.mdx +8 -8
- package/src/DataTable/tests/DataTable.test.jsx +6 -4
- package/src/DataTable/tests/TableHeaderCell.test.jsx +0 -1
- package/src/DataTable/utils/tests/getTableArgs.test.js +3 -2
- package/src/DataTable/utils/tests/getVisibleColumns.test.js +0 -2
- package/src/Dropdown/index.jsx +11 -16
- package/src/Form/tests/useCheckboxSetValues.test.jsx +17 -9
- package/src/Modal/ModalDialogHeader.tsx +5 -1
- package/src/Modal/ModalLayer.tsx +1 -2
- package/src/Modal/tests/ModalLayer.test.tsx +1 -2
- package/src/OverflowScroll/data/constants.js +0 -2
- package/src/ProductTour/index.jsx +5 -7
- package/src/ProgressBar/utils.js +0 -1
- package/src/SelectableBox/tests/SelectableBox.test.jsx +0 -1
- package/src/SelectableBox/utils.js +1 -1
- package/src/Sticky/index.jsx +1 -1
- package/src/TransitionReplace/README.md +2 -2
- package/src/TransitionReplace/TransitionReplace.test.jsx +1 -1
- package/src/asInput/index.jsx +0 -3
- package/src/hooks/tests/useToggle.test.tsx +4 -5
- package/src/setupTest.ts +0 -1
- package/src/utils/index.ts +0 -1
- package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/CHANGELOG.md +0 -50
- package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/LICENSE +0 -7
- package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/README.md +0 -37
- package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/dist/index.d.ts +0 -20
- package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/dist/index.js +0 -79
- package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/dist/index.js.map +0 -1
- package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/package.json +0 -40
- package/icons/node_modules/@svgr/babel-plugin-add-jsx-attribute/tsconfig.json +0 -4
package/src/DataTable/index.jsx
CHANGED
|
@@ -52,6 +52,7 @@ function DataTable({
|
|
|
52
52
|
filtersTitle,
|
|
53
53
|
dataViewToggleOptions,
|
|
54
54
|
disableElevation,
|
|
55
|
+
className,
|
|
55
56
|
isLoading,
|
|
56
57
|
children,
|
|
57
58
|
onSelectedRowsChanged,
|
|
@@ -224,7 +225,7 @@ function DataTable({
|
|
|
224
225
|
|
|
225
226
|
return (
|
|
226
227
|
<DataTableContext.Provider value={enhancedInstance}>
|
|
227
|
-
<DataTableLayout filtersTitle={filtersTitle}>
|
|
228
|
+
<DataTableLayout filtersTitle={filtersTitle} className={className}>
|
|
228
229
|
<div className={classNames('pgn__data-table-wrapper', {
|
|
229
230
|
'hide-shadow': !!disableElevation,
|
|
230
231
|
})}
|
|
@@ -275,6 +276,7 @@ DataTable.defaultProps = {
|
|
|
275
276
|
},
|
|
276
277
|
disableElevation: false,
|
|
277
278
|
renderRowSubComponent: undefined,
|
|
279
|
+
className: undefined,
|
|
278
280
|
isExpandable: false,
|
|
279
281
|
isLoading: false,
|
|
280
282
|
onSelectedRowsChanged: undefined,
|
|
@@ -321,7 +323,7 @@ DataTable.propTypes = {
|
|
|
321
323
|
isPaginated: PropTypes.bool,
|
|
322
324
|
/** Indicates that pagination will be done manually. A fetchData function must be provided */
|
|
323
325
|
manualPagination: PropTypes.bool,
|
|
324
|
-
|
|
326
|
+
/** Number of pages in the table. Required when manualPagination is true */
|
|
325
327
|
pageCount: requiredWhen(PropTypes.number, 'manualPagination'),
|
|
326
328
|
/** Table rows can be filtered, using a default filter in the default column values, or in the column definition */
|
|
327
329
|
isFilterable: PropTypes.bool,
|
|
@@ -428,6 +430,8 @@ DataTable.propTypes = {
|
|
|
428
430
|
children: PropTypes.node,
|
|
429
431
|
/** If true filters will be shown on sidebar instead */
|
|
430
432
|
showFiltersInSidebar: PropTypes.bool,
|
|
433
|
+
/** Class name for the data table layout */
|
|
434
|
+
className: PropTypes.string,
|
|
431
435
|
/** Title of the filters section */
|
|
432
436
|
filtersTitle: PropTypes.string,
|
|
433
437
|
/** options for data view toggle */
|
|
@@ -2,7 +2,6 @@ import { act } from 'react-dom/test-utils';
|
|
|
2
2
|
|
|
3
3
|
import { CheckboxControl } from '../../../Form';
|
|
4
4
|
|
|
5
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
6
5
|
export const toggleCheckbox = ({ isChecked, wrapper }) => {
|
|
7
6
|
act(() => {
|
|
8
7
|
wrapper.find(CheckboxControl).simulate('change', { target: { checked: isChecked } });
|
|
@@ -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: '
|
|
76
|
+
name: 'Russian white',
|
|
77
77
|
number: 1,
|
|
78
78
|
value: 'russian white',
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
|
-
name: '
|
|
81
|
+
name: 'Orange Tabby',
|
|
82
82
|
number: 2,
|
|
83
83
|
value: 'orange tabby',
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
name: '
|
|
86
|
+
name: 'Brown Tabby',
|
|
87
87
|
number: 3,
|
|
88
88
|
value: 'brown tabby',
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
|
-
name: '
|
|
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: '
|
|
107
|
+
name: 'Russian white',
|
|
108
108
|
number: 1,
|
|
109
109
|
value: 'russian white',
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
|
-
name: '
|
|
112
|
+
name: 'Orange Tabby',
|
|
113
113
|
number: 2,
|
|
114
114
|
value: 'orange tabby',
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
|
-
name: '
|
|
117
|
+
name: 'Brown Tabby',
|
|
118
118
|
number: 3,
|
|
119
119
|
value: 'brown tabby',
|
|
120
120
|
},
|
|
121
121
|
{
|
|
122
|
-
name: '
|
|
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: '
|
|
230
|
+
name: 'Russian white',
|
|
231
231
|
number: 1,
|
|
232
232
|
value: 'russian white',
|
|
233
233
|
},
|
|
234
234
|
{
|
|
235
|
-
name: '
|
|
235
|
+
name: 'Orange Tabby',
|
|
236
236
|
number: 2,
|
|
237
237
|
value: 'orange tabby',
|
|
238
238
|
},
|
|
239
239
|
{
|
|
240
|
-
name: '
|
|
240
|
+
name: 'Brown Tabby',
|
|
241
241
|
number: 3,
|
|
242
242
|
value: 'brown tabby',
|
|
243
243
|
},
|
|
244
244
|
{
|
|
245
|
-
name: '
|
|
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
|
-
|
|
231
|
-
|
|
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} />);
|
|
@@ -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
|
-
{
|
|
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
|
[
|
package/src/Dropdown/index.jsx
CHANGED
|
@@ -9,15 +9,14 @@ import Button from '../Button';
|
|
|
9
9
|
import IconButton from '../IconButton';
|
|
10
10
|
|
|
11
11
|
const Dropdown = React.forwardRef(
|
|
12
|
-
|
|
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
|
-
|
|
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
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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;
|
package/src/Modal/ModalLayer.tsx
CHANGED
|
@@ -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
|
-
|
|
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 />
|
|
@@ -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);
|
package/src/ProgressBar/utils.js
CHANGED
|
@@ -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
|
};
|
package/src/Sticky/index.jsx
CHANGED
|
@@ -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
|
|
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
|
|
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}>
|
package/src/asInput/index.jsx
CHANGED
|
@@ -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
|
-
<
|
|
30
|
-
<
|
|
31
|
-
<
|
|
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
package/src/utils/index.ts
CHANGED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
## [6.5.1](https://github.com/gregberge/svgr/compare/v6.5.0...v6.5.1) (2022-10-27)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @svgr/babel-plugin-add-jsx-attribute
|
|
9
|
-
|
|
10
|
-
# [6.5.0](https://github.com/gregberge/svgr/compare/v6.4.0...v6.5.0) (2022-10-14)
|
|
11
|
-
|
|
12
|
-
**Note:** Version bump only for package @svgr/babel-plugin-add-jsx-attribute
|
|
13
|
-
|
|
14
|
-
## [6.3.1](https://github.com/gregberge/svgr/compare/v6.3.0...v6.3.1) (2022-07-22)
|
|
15
|
-
|
|
16
|
-
### Bug Fixes
|
|
17
|
-
|
|
18
|
-
- fix exports compat with ESM ([#749](https://github.com/gregberge/svgr/issues/749)) ([f3e304c](https://github.com/gregberge/svgr/commit/f3e304c166282f042ecd4d6c396a0798a7f0b490))
|
|
19
|
-
|
|
20
|
-
# [6.3.0](https://github.com/gregberge/svgr/compare/v6.2.1...v6.3.0) (2022-07-18)
|
|
21
|
-
|
|
22
|
-
### Bug Fixes
|
|
23
|
-
|
|
24
|
-
- **package.json:** fix exports ([#745](https://github.com/gregberge/svgr/issues/745)) ([2a368d1](https://github.com/gregberge/svgr/commit/2a368d1305949ec6426c7c7312c04224071ec2bd))
|
|
25
|
-
|
|
26
|
-
# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-add-jsx-attribute/compare/v5.3.1...v5.4.0) (2020-04-27)
|
|
27
|
-
|
|
28
|
-
**Note:** Version bump only for package @svgr/babel-plugin-add-jsx-attribute
|
|
29
|
-
|
|
30
|
-
## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-add-jsx-attribute/compare/v5.0.0...v5.0.1) (2019-12-29)
|
|
31
|
-
|
|
32
|
-
### Bug Fixes
|
|
33
|
-
|
|
34
|
-
- fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-add-jsx-attribute/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))
|
|
35
|
-
|
|
36
|
-
# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-add-jsx-attribute/compare/v4.1.0...v4.2.0) (2019-04-11)
|
|
37
|
-
|
|
38
|
-
**Note:** Version bump only for package @svgr/babel-plugin-add-jsx-attribute
|
|
39
|
-
|
|
40
|
-
# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)
|
|
41
|
-
|
|
42
|
-
### Features
|
|
43
|
-
|
|
44
|
-
- **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))
|
|
45
|
-
|
|
46
|
-
### BREAKING CHANGES
|
|
47
|
-
|
|
48
|
-
- **v4:** - `template` option must now returns a Babel AST
|
|
49
|
-
|
|
50
|
-
* `@svgr/core` does not include svgo & prettier by default
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
Copyright 2017 Smooth Code
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
-
|
|
5
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# @svgr/babel-plugin-add-jsx-attribute
|
|
2
|
-
|
|
3
|
-
## Install
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
npm install --save-dev @svgr/babel-plugin-add-jsx-attribute
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
## Usage
|
|
10
|
-
|
|
11
|
-
**.babelrc**
|
|
12
|
-
|
|
13
|
-
```json
|
|
14
|
-
{
|
|
15
|
-
"plugins": [
|
|
16
|
-
[
|
|
17
|
-
"@svgr/babel-plugin-add-jsx-attribute",
|
|
18
|
-
{
|
|
19
|
-
"elements": ["svg"],
|
|
20
|
-
"attributes": [
|
|
21
|
-
{
|
|
22
|
-
"name": "width",
|
|
23
|
-
"value": "200",
|
|
24
|
-
"spread": false,
|
|
25
|
-
"literal": false,
|
|
26
|
-
"position": "end"
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## License
|
|
36
|
-
|
|
37
|
-
MIT
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ConfigAPI, NodePath, types } from '@babel/core';
|
|
2
|
-
|
|
3
|
-
interface Attribute {
|
|
4
|
-
name: string;
|
|
5
|
-
value?: boolean | number | string | null;
|
|
6
|
-
spread?: boolean;
|
|
7
|
-
literal?: boolean;
|
|
8
|
-
position?: 'start' | 'end';
|
|
9
|
-
}
|
|
10
|
-
interface Options {
|
|
11
|
-
elements: string[];
|
|
12
|
-
attributes: Attribute[];
|
|
13
|
-
}
|
|
14
|
-
declare const addJSXAttribute: (_: ConfigAPI, opts: Options) => {
|
|
15
|
-
visitor: {
|
|
16
|
-
JSXOpeningElement(path: NodePath<types.JSXOpeningElement>): void;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { Attribute, Options, addJSXAttribute as default };
|