@openedx/paragon 21.11.3 → 21.12.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.
- package/dist/Button/_variables.scss +3 -1
- package/dist/Button/index.scss +2 -2
- package/dist/DataTable/index.js +2 -1
- package/dist/DataTable/index.js.map +1 -1
- package/dist/DataTable/selection/BaseSelectionStatus.js +3 -2
- package/dist/DataTable/selection/BaseSelectionStatus.js.map +1 -1
- package/dist/paragon.css +1 -1
- package/icons/es5/RightSidebarFilled.js +15 -0
- package/icons/es5/RightSidebarOutlined.js +15 -0
- package/icons/es5/index.js +2 -0
- package/icons/jsx/RightSidebarFilled.jsx +19 -0
- package/icons/jsx/RightSidebarOutlined.jsx +19 -0
- package/icons/jsx/index.jsx +2 -0
- package/icons/svg/right_sidebar_filled.svg +3 -0
- package/icons/svg/right_sidebar_outlined.svg +3 -0
- package/package.json +1 -1
- package/scss/core/_variables.scss +1 -1
- package/src/Button/README.md +141 -85
- package/src/Button/_variables.scss +3 -1
- package/src/Button/index.scss +2 -2
- package/src/DataTable/README.md +3 -3
- package/src/DataTable/index.jsx +2 -1
- package/src/DataTable/selection/BaseSelectionStatus.jsx +2 -2
- package/src/DataTable/tablefilters.mdx +3 -3
- package/src/DataTable/tests/DataTable.test.jsx +31 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
const SvgRightSidebarFilled = props => /*#__PURE__*/React.createElement("svg", _extends({
|
|
4
|
+
width: 24,
|
|
5
|
+
height: 24,
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
fill: "none",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
9
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
10
|
+
fillRule: "evenodd",
|
|
11
|
+
clipRule: "evenodd",
|
|
12
|
+
d: "M2 22V2h20v20H2ZM14 4H4v16h10V4Z",
|
|
13
|
+
fill: "currentColor"
|
|
14
|
+
}));
|
|
15
|
+
export default SvgRightSidebarFilled;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
const SvgRightSidebarOutlined = props => /*#__PURE__*/React.createElement("svg", _extends({
|
|
4
|
+
width: 24,
|
|
5
|
+
height: 24,
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
fill: "none",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
9
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
10
|
+
fillRule: "evenodd",
|
|
11
|
+
clipRule: "evenodd",
|
|
12
|
+
d: "M2 2v20h20V2H2Zm18 2h-4v16h4V4ZM4 4h10v16H4V4Z",
|
|
13
|
+
fill: "currentColor"
|
|
14
|
+
}));
|
|
15
|
+
export default SvgRightSidebarOutlined;
|
package/icons/es5/index.js
CHANGED
|
@@ -1694,6 +1694,8 @@ export { default as RestoreFromTrash } from "./RestoreFromTrash";
|
|
|
1694
1694
|
export { default as RestorePage } from "./RestorePage";
|
|
1695
1695
|
export { default as Reviews } from "./Reviews";
|
|
1696
1696
|
export { default as RiceBowl } from "./RiceBowl";
|
|
1697
|
+
export { default as RightSidebarFilled } from "./RightSidebarFilled";
|
|
1698
|
+
export { default as RightSidebarOutlined } from "./RightSidebarOutlined";
|
|
1697
1699
|
export { default as RingVolume } from "./RingVolume";
|
|
1698
1700
|
export { default as Rocket } from "./Rocket";
|
|
1699
1701
|
export { default as RocketLaunch } from "./RocketLaunch";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const SvgRightSidebarFilled = (props) => (
|
|
3
|
+
<svg
|
|
4
|
+
width={24}
|
|
5
|
+
height={24}
|
|
6
|
+
viewBox="0 0 24 24"
|
|
7
|
+
fill="none"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
{...props}
|
|
10
|
+
>
|
|
11
|
+
<path
|
|
12
|
+
fillRule="evenodd"
|
|
13
|
+
clipRule="evenodd"
|
|
14
|
+
d="M2 22V2h20v20H2ZM14 4H4v16h10V4Z"
|
|
15
|
+
fill="currentColor"
|
|
16
|
+
/>
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
export default SvgRightSidebarFilled;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const SvgRightSidebarOutlined = (props) => (
|
|
3
|
+
<svg
|
|
4
|
+
width={24}
|
|
5
|
+
height={24}
|
|
6
|
+
viewBox="0 0 24 24"
|
|
7
|
+
fill="none"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
{...props}
|
|
10
|
+
>
|
|
11
|
+
<path
|
|
12
|
+
fillRule="evenodd"
|
|
13
|
+
clipRule="evenodd"
|
|
14
|
+
d="M2 2v20h20V2H2Zm18 2h-4v16h4V4ZM4 4h10v16H4V4Z"
|
|
15
|
+
fill="currentColor"
|
|
16
|
+
/>
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
export default SvgRightSidebarOutlined;
|
package/icons/jsx/index.jsx
CHANGED
|
@@ -1694,6 +1694,8 @@ export { default as RestoreFromTrash } from "./RestoreFromTrash";
|
|
|
1694
1694
|
export { default as RestorePage } from "./RestorePage";
|
|
1695
1695
|
export { default as Reviews } from "./Reviews";
|
|
1696
1696
|
export { default as RiceBowl } from "./RiceBowl";
|
|
1697
|
+
export { default as RightSidebarFilled } from "./RightSidebarFilled";
|
|
1698
|
+
export { default as RightSidebarOutlined } from "./RightSidebarOutlined";
|
|
1697
1699
|
export { default as RingVolume } from "./RingVolume";
|
|
1698
1700
|
export { default as Rocket } from "./Rocket";
|
|
1699
1701
|
export { default as RocketLaunch } from "./RocketLaunch";
|
package/package.json
CHANGED
package/src/Button/README.md
CHANGED
|
@@ -22,11 +22,11 @@ This component utilizes `Button` from React-Bootstrap and extends it with an abi
|
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
24
|
<Stack gap={2} direction={ isExtraSmall ? "vertical" : "horizontal" }>
|
|
25
|
-
<Button variant="brand"
|
|
26
|
-
<Button variant="outline-brand"
|
|
27
|
-
<Button variant="primary"
|
|
28
|
-
<Button variant="outline-primary"
|
|
29
|
-
<Button variant="tertiary"
|
|
25
|
+
<Button variant="brand">Brand</Button>
|
|
26
|
+
<Button variant="outline-brand">Outline Brand</Button>
|
|
27
|
+
<Button variant="primary">Primary</Button>
|
|
28
|
+
<Button variant="outline-primary">Outline Primary</Button>
|
|
29
|
+
<Button variant="tertiary">Tertiary</Button>
|
|
30
30
|
</Stack>
|
|
31
31
|
)}
|
|
32
32
|
```
|
|
@@ -43,11 +43,11 @@ This component utilizes `Button` from React-Bootstrap and extends it with an abi
|
|
|
43
43
|
gap={2}
|
|
44
44
|
direction={ isExtraSmall ? "vertical" : "horizontal" }
|
|
45
45
|
>
|
|
46
|
-
<Button variant="inverse-brand"
|
|
47
|
-
<Button variant="inverse-outline-brand"
|
|
48
|
-
<Button variant="inverse-primary"
|
|
49
|
-
<Button variant="inverse-outline-primary"
|
|
50
|
-
<Button variant="inverse-tertiary"
|
|
46
|
+
<Button variant="inverse-brand">Brand</Button>
|
|
47
|
+
<Button variant="inverse-outline-brand">Outline Brand</Button>
|
|
48
|
+
<Button variant="inverse-primary">Primary</Button>
|
|
49
|
+
<Button variant="inverse-outline-primary">Outline Primary</Button>
|
|
50
|
+
<Button variant="inverse-tertiary">Tertiary</Button>
|
|
51
51
|
</Stack>
|
|
52
52
|
)}
|
|
53
53
|
```
|
|
@@ -65,20 +65,20 @@ This component utilizes `Button` from React-Bootstrap and extends it with an abi
|
|
|
65
65
|
gap={2}
|
|
66
66
|
direction={ isExtraSmall ? "vertical" : "horizontal" }
|
|
67
67
|
>
|
|
68
|
-
<Button variant="success"
|
|
69
|
-
<Button variant="danger"
|
|
70
|
-
<Button variant="outline-success"
|
|
71
|
-
<Button variant="outline-danger"
|
|
68
|
+
<Button variant="success">Success</Button>
|
|
69
|
+
<Button variant="danger">Danger</Button>
|
|
70
|
+
<Button variant="outline-success">Success</Button>
|
|
71
|
+
<Button variant="outline-danger">Danger</Button>
|
|
72
72
|
</Stack>
|
|
73
73
|
<Stack
|
|
74
74
|
gap={2}
|
|
75
75
|
direction={ isExtraSmall ? "vertical" : "horizontal" }
|
|
76
76
|
>
|
|
77
|
-
<Button variant="link"
|
|
78
|
-
<Button variant="light"
|
|
79
|
-
<Button variant="dark"
|
|
80
|
-
<Button variant="outline-light"
|
|
81
|
-
<Button variant="outline-dark"
|
|
77
|
+
<Button variant="link">Link</Button>
|
|
78
|
+
<Button variant="light">Light</Button>
|
|
79
|
+
<Button variant="dark">Dark</Button>
|
|
80
|
+
<Button variant="outline-light">Light</Button>
|
|
81
|
+
<Button variant="outline-dark">Dark</Button>
|
|
82
82
|
</Stack>
|
|
83
83
|
</>
|
|
84
84
|
)}
|
|
@@ -92,34 +92,41 @@ This component utilizes `Button` from React-Bootstrap and extends it with an abi
|
|
|
92
92
|
|
|
93
93
|
return (
|
|
94
94
|
<>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
95
|
+
<Stack
|
|
96
|
+
className="mb-2"
|
|
97
|
+
gap={2}
|
|
98
|
+
direction={ isExtraSmall ? "vertical" : "horizontal" }
|
|
99
|
+
>
|
|
100
|
+
<Button variant="primary" size="lg">
|
|
101
|
+
Large button
|
|
102
|
+
</Button>
|
|
103
|
+
<Button variant="outline-primary" size="lg">
|
|
104
|
+
Large button
|
|
105
|
+
</Button>
|
|
106
|
+
</Stack>
|
|
107
|
+
<Stack
|
|
108
|
+
className="mb-2"
|
|
109
|
+
gap={2}
|
|
110
|
+
direction={ isExtraSmall ? "vertical" : "horizontal" }
|
|
111
|
+
>
|
|
112
|
+
<Button variant="primary" size="sm">
|
|
113
|
+
Small button
|
|
114
|
+
</Button>
|
|
115
|
+
<Button variant="outline-primary" size="sm">
|
|
116
|
+
Small button
|
|
117
|
+
</Button>
|
|
118
|
+
</Stack>
|
|
119
|
+
<Stack
|
|
120
|
+
className="mb-2"
|
|
121
|
+
gap={2}
|
|
122
|
+
direction={ isExtraSmall ? "vertical" : "horizontal" }
|
|
123
|
+
>
|
|
124
|
+
<Button variant="link" size="inline">Inline button</Button>
|
|
125
|
+
<Button variant="link" size="inline">Inline button</Button>
|
|
126
|
+
</Stack>
|
|
121
127
|
</>
|
|
122
|
-
)
|
|
128
|
+
)
|
|
129
|
+
}
|
|
123
130
|
```
|
|
124
131
|
|
|
125
132
|
### When to use the inline size
|
|
@@ -127,13 +134,11 @@ This component utilizes `Button` from React-Bootstrap and extends it with an abi
|
|
|
127
134
|
Use inline size buttons for when a button sits with a line of text.
|
|
128
135
|
|
|
129
136
|
```jsx live
|
|
130
|
-
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
</p>
|
|
136
|
-
</>
|
|
137
|
+
<p>
|
|
138
|
+
<span className="mr-1">2 items selected.</span>
|
|
139
|
+
<Button variant="link" size="inline" className="mr-1">Select all</Button>
|
|
140
|
+
<Button variant="link" size="inline">Clear</Button>
|
|
141
|
+
</p>
|
|
137
142
|
```
|
|
138
143
|
|
|
139
144
|
## Block Buttons
|
|
@@ -152,21 +157,41 @@ Use inline size buttons for when a button sits with a line of text.
|
|
|
152
157
|
### Disabled
|
|
153
158
|
|
|
154
159
|
```jsx live
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
+
() => {
|
|
161
|
+
const isExtraSmall = useMediaQuery({ maxWidth: breakpoints.extraSmall.maxWidth });
|
|
162
|
+
|
|
163
|
+
return (
|
|
164
|
+
<Stack
|
|
165
|
+
className="mb-2"
|
|
166
|
+
gap={2}
|
|
167
|
+
direction={ isExtraSmall ? "vertical" : "horizontal" }
|
|
168
|
+
>
|
|
169
|
+
<Button variant="primary" disabled>Primary disabled</Button>
|
|
170
|
+
<Button variant="secondary" disabled>Secondary disabled</Button>
|
|
171
|
+
<Button as="a" href="https://edx.org" disabled>Link disabled</Button>
|
|
172
|
+
</Stack>
|
|
173
|
+
)
|
|
174
|
+
}
|
|
160
175
|
```
|
|
161
176
|
|
|
162
177
|
### With empty href
|
|
163
178
|
For link to be `disabled`, it must have href defined with some value.
|
|
164
179
|
|
|
165
180
|
```jsx live
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
181
|
+
() => {
|
|
182
|
+
const isExtraSmall = useMediaQuery({ maxWidth: breakpoints.extraSmall.maxWidth });
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<Stack
|
|
186
|
+
className="mb-2"
|
|
187
|
+
gap={2}
|
|
188
|
+
direction={ isExtraSmall ? "vertical" : "horizontal" }
|
|
189
|
+
>
|
|
190
|
+
<Button as="a" disabled>No href</Button>
|
|
191
|
+
<Button as="a" href="" disabled>Empty string href</Button>
|
|
192
|
+
</Stack>
|
|
193
|
+
)
|
|
194
|
+
}
|
|
170
195
|
```
|
|
171
196
|
|
|
172
197
|
### With Icons before or after
|
|
@@ -181,23 +206,24 @@ For link to be `disabled`, it must have href defined with some value.
|
|
|
181
206
|
gap={2}
|
|
182
207
|
direction={ isExtraSmall ? "vertical" : "horizontal" }
|
|
183
208
|
>
|
|
184
|
-
<Button variant="brand" iconBefore={ArrowBack}
|
|
209
|
+
<Button variant="brand" iconBefore={ArrowBack}>
|
|
185
210
|
Brand
|
|
186
211
|
</Button>
|
|
187
|
-
<Button variant="outline-brand" iconAfter={ArrowDropDown}
|
|
212
|
+
<Button variant="outline-brand" iconAfter={ArrowDropDown}>
|
|
188
213
|
Outline Brand
|
|
189
214
|
</Button>
|
|
190
|
-
<Button variant="primary" iconBefore={Remove} iconAfter={Add}
|
|
215
|
+
<Button variant="primary" iconBefore={Remove} iconAfter={Add}>
|
|
191
216
|
Primary
|
|
192
217
|
</Button>
|
|
193
|
-
<Button variant="outline-primary" iconBefore={Highlight}
|
|
218
|
+
<Button variant="outline-primary" iconBefore={Highlight}>
|
|
194
219
|
Outline Primary
|
|
195
220
|
</Button>
|
|
196
|
-
<Button variant="tertiary" iconAfter={Add}
|
|
221
|
+
<Button variant="tertiary" iconAfter={Add}>
|
|
197
222
|
Tertiary
|
|
198
223
|
</Button>
|
|
199
224
|
</Stack>
|
|
200
|
-
)
|
|
225
|
+
)
|
|
226
|
+
}
|
|
201
227
|
```
|
|
202
228
|
|
|
203
229
|
## Stateful buttons
|
|
@@ -219,33 +245,63 @@ user-friendly experience.
|
|
|
219
245
|
### (Deprecated) color variants
|
|
220
246
|
|
|
221
247
|
```jsx live
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
248
|
+
() => {
|
|
249
|
+
const isExtraSmall = useMediaQuery({ maxWidth: breakpoints.large.maxWidth });
|
|
250
|
+
|
|
251
|
+
return (
|
|
252
|
+
<Stack
|
|
253
|
+
className="mb-2"
|
|
254
|
+
gap={2}
|
|
255
|
+
direction={ isExtraSmall ? "vertical" : "horizontal" }
|
|
256
|
+
>
|
|
257
|
+
<Button.Deprecated className="btn-primary">Primary</Button.Deprecated>
|
|
258
|
+
<Button.Deprecated className="btn-success">Success</Button.Deprecated>
|
|
259
|
+
<Button.Deprecated className="btn-danger">Danger</Button.Deprecated>
|
|
260
|
+
<Button.Deprecated className="btn-light">Light</Button.Deprecated>
|
|
261
|
+
<Button.Deprecated className="btn-dark">Dark</Button.Deprecated>
|
|
262
|
+
</Stack>
|
|
263
|
+
)
|
|
264
|
+
}
|
|
229
265
|
```
|
|
230
266
|
|
|
231
267
|
### (Deprecated) outline variants
|
|
232
268
|
|
|
233
269
|
```jsx live
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
270
|
+
() => {
|
|
271
|
+
const isExtraSmall = useMediaQuery({ maxWidth: breakpoints.extraSmall.maxWidth });
|
|
272
|
+
|
|
273
|
+
return (
|
|
274
|
+
<Stack
|
|
275
|
+
className="mb-2"
|
|
276
|
+
gap={2}
|
|
277
|
+
direction={ isExtraSmall ? "vertical" : "horizontal" }
|
|
278
|
+
>
|
|
279
|
+
<Button.Deprecated className="btn-outline-primary">Primary</Button.Deprecated>
|
|
280
|
+
<Button.Deprecated className="btn-outline-success">Success</Button.Deprecated>
|
|
281
|
+
<Button.Deprecated className="btn-outline-danger">Danger</Button.Deprecated>
|
|
282
|
+
</Stack>
|
|
283
|
+
)
|
|
284
|
+
}
|
|
239
285
|
```
|
|
240
286
|
|
|
241
287
|
### (Deprecated) inverse variants
|
|
242
288
|
|
|
243
289
|
```jsx live
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
290
|
+
() => {
|
|
291
|
+
const isExtraSmall = useMediaQuery({ maxWidth: breakpoints.extraSmall.maxWidth });
|
|
292
|
+
|
|
293
|
+
return (
|
|
294
|
+
<Stack
|
|
295
|
+
className="mb-2 p-3 bg-gray-700"
|
|
296
|
+
gap={2}
|
|
297
|
+
direction={ isExtraSmall ? "vertical" : "horizontal" }
|
|
298
|
+
>
|
|
299
|
+
<Button.Deprecated className="btn-inverse-primary">Primary</Button.Deprecated>
|
|
300
|
+
<Button.Deprecated className="btn-inverse-success">Success</Button.Deprecated>
|
|
301
|
+
<Button.Deprecated className="btn-inverse-danger">Danger</Button.Deprecated>
|
|
302
|
+
</Stack>
|
|
303
|
+
)
|
|
304
|
+
}
|
|
249
305
|
```
|
|
250
306
|
|
|
251
307
|
### (Deprecated) link variant
|
|
@@ -19,7 +19,7 @@ $btn-border-width: $input-btn-border-width !default;
|
|
|
19
19
|
$btn-font-weight: $font-weight-normal !default;
|
|
20
20
|
$btn-box-shadow: inset 0 1px 0 rgba($white, .15), 0 1px 1px rgba($black, .075) !default;
|
|
21
21
|
$btn-focus-width: 2px !default;
|
|
22
|
-
$btn-focus-gap:
|
|
22
|
+
$btn-focus-gap: $btn-focus-width !default;
|
|
23
23
|
$btn-focus-box-shadow: $input-btn-focus-box-shadow !default;
|
|
24
24
|
$btn-disabled-opacity: .65 !default;
|
|
25
25
|
$btn-active-box-shadow: none;
|
|
@@ -48,3 +48,5 @@ $btn-focus-border-gap: $btn-focus-width + $btn-focus-gap !default;
|
|
|
48
48
|
$btn-focus-distance-to-border: $btn-focus-border-gap + $btn-border-width !default;
|
|
49
49
|
|
|
50
50
|
$btn-focus-border-radius: calc(#{$btn-border-radius} + #{$btn-focus-border-gap}) !default;
|
|
51
|
+
$btn-focus-border-radius-lg: $btn-focus-border-radius !default;
|
|
52
|
+
$btn-focus-border-radius-sm: $btn-border-radius !default;
|
package/src/Button/index.scss
CHANGED
|
@@ -150,11 +150,11 @@
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
&.btn-lg::before {
|
|
153
|
-
border-radius: $btn-focus-border-radius;
|
|
153
|
+
border-radius: $btn-focus-border-radius-lg;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
&.btn-sm::before {
|
|
157
|
-
border-radius: $btn-focus-border-radius;
|
|
157
|
+
border-radius: $btn-focus-border-radius-sm;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
&:active,
|
package/src/DataTable/README.md
CHANGED
|
@@ -28,11 +28,11 @@ designStatus: 'Done'
|
|
|
28
28
|
devStatus: 'In progress'
|
|
29
29
|
---
|
|
30
30
|
|
|
31
|
-
The DataTable component is a wrapper that uses the <a href="https://
|
|
31
|
+
The DataTable component is a wrapper that uses the <a href="https://github.com/TanStack/table/tree/v7/docs/src/pages/docs" target="_blank" rel="noopener noreferrer">react-table</a> library to
|
|
32
32
|
create tables. It can be used as is, or its subcomponents can be used on their own, allowing the developer full control.
|
|
33
33
|
|
|
34
34
|
Paragon also exports all React hooks from ``react-table`` allowing the developers to use them and make customizations more freely without adding ``react-table`` as a separate dependency to their project.
|
|
35
|
-
For full list of available hooks view <a href="https://
|
|
35
|
+
For full list of available hooks view <a href="https://github.com/TanStack/table/tree/v7/docs/src/pages/docs/api" target="_blank" rel="noopener noreferrer">react-table API reference</a>.
|
|
36
36
|
|
|
37
37
|
## How children get information
|
|
38
38
|
|
|
@@ -49,7 +49,7 @@ const instance = useContext(DataTableContext)
|
|
|
49
49
|
For small tables (less than ~10,000 rows), filtering, sorting and pagination can be done quickly and easily on the frontend.
|
|
50
50
|
|
|
51
51
|
In this example, a default TextFilter component is used for all columns. A default filter can be passed in,
|
|
52
|
-
or a filter component can be defined on the column. See <a href="https://
|
|
52
|
+
or a filter component can be defined on the column. See <a href="https://github.com/TanStack/table/blob/v7/docs/src/pages/docs/api/useFilters.md" target="_blank" rel="noopener noreferrer">react-table filters documentation</a>
|
|
53
53
|
for more information.
|
|
54
54
|
|
|
55
55
|
```jsx live
|
package/src/DataTable/index.jsx
CHANGED
|
@@ -187,6 +187,7 @@ function DataTable({
|
|
|
187
187
|
|
|
188
188
|
const enhancedInstance = {
|
|
189
189
|
...instance,
|
|
190
|
+
manualFilters,
|
|
190
191
|
itemCount,
|
|
191
192
|
numBreakoutFilters,
|
|
192
193
|
bulkActions,
|
|
@@ -329,7 +330,7 @@ DataTable.propTypes = {
|
|
|
329
330
|
/** Function that will fetch table data. Called when page size, page index or filters change.
|
|
330
331
|
* Meant to be used with manual filters and pagination */
|
|
331
332
|
fetchData: PropTypes.func,
|
|
332
|
-
/** Initial state passed to react-table's documentation https://
|
|
333
|
+
/** Initial state passed to react-table's documentation https://github.com/TanStack/table/blob/v7/docs/src/pages/docs/api/useTable.md */
|
|
333
334
|
initialState: PropTypes.shape({
|
|
334
335
|
pageSize: requiredWhen(PropTypes.number, 'isPaginated'),
|
|
335
336
|
pageIndex: requiredWhen(PropTypes.number, 'isPaginated'),
|
|
@@ -22,11 +22,11 @@ function BaseSelectionStatus({
|
|
|
22
22
|
}) {
|
|
23
23
|
const {
|
|
24
24
|
itemCount, filteredRows, isPaginated, state,
|
|
25
|
-
isSelectable, maxSelectedRows,
|
|
25
|
+
isSelectable, maxSelectedRows, manualFilters,
|
|
26
26
|
} = useContext(DataTableContext);
|
|
27
27
|
const hasAppliedFilters = state?.filters?.length > 0;
|
|
28
28
|
const isAllRowsSelected = numSelectedRows === itemCount;
|
|
29
|
-
const filteredItems = filteredRows?.length || itemCount;
|
|
29
|
+
const filteredItems = manualFilters ? itemCount : (filteredRows?.length || itemCount);
|
|
30
30
|
const hasMaxSelectedRows = isSelectable && maxSelectedRows;
|
|
31
31
|
|
|
32
32
|
const intlAllSelectedText = allSelectedText || (
|
|
@@ -14,18 +14,18 @@ devStatus: 'In progress'
|
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
The ``DataTable`` component is a wrapper that uses the <a href="https://
|
|
17
|
+
The ``DataTable`` component is a wrapper that uses the <a href="https://github.com/TanStack/table/tree/v7/docs/src/pages/docs" target="_blank" rel="noopener noreferrer">react-table</a> library to
|
|
18
18
|
create tables. It can be used as is, or its subcomponents can be used on their own, allowing the developer full control.
|
|
19
19
|
|
|
20
20
|
## Filtering and sorting
|
|
21
21
|
Paragon currently provides a variety of filter types, and you can also define your own filter types.
|
|
22
22
|
|
|
23
23
|
In the example below, a default ``TextFilter`` component is used as the default filter for all columns. A default filter can be passed in,
|
|
24
|
-
or a filter component can be defined on the column using the ``Filter`` attribute. See <a href="https://
|
|
24
|
+
or a filter component can be defined on the column using the ``Filter`` attribute. See <a href="https://github.com/TanStack/table/blob/v7/docs/src/pages/docs/api/useFilters.md" target="_blank" rel="noopener noreferrer">react-table filters documentation</a>
|
|
25
25
|
for more information.
|
|
26
26
|
|
|
27
27
|
## Available filter functions
|
|
28
|
-
A filtering function can be defined on the column as well as the filter component. Custom filtering functions can also be defined, see <a href="https://
|
|
28
|
+
A filtering function can be defined on the column as well as the filter component. Custom filtering functions can also be defined, see <a href="https://github.com/TanStack/table/blob/v7/docs/src/pages/docs/api/useFilters.md#column-options" target="_blank" rel="noopener noreferrer">react-table filters documentation</a>
|
|
29
29
|
for more information.
|
|
30
30
|
Filter functions are defined on the column as the ``filter`` attribute.
|
|
31
31
|
<dl>
|
|
@@ -6,6 +6,8 @@ import { IntlProvider } from 'react-intl';
|
|
|
6
6
|
|
|
7
7
|
import DataTable from '..';
|
|
8
8
|
import DataTableContext from '../DataTableContext';
|
|
9
|
+
import { TextFilter } from '../..';
|
|
10
|
+
import { SELECT_ALL_TEST_ID } from '../selection/data/constants';
|
|
9
11
|
|
|
10
12
|
const additionalColumns = [
|
|
11
13
|
{
|
|
@@ -198,6 +200,35 @@ describe('<DataTable />', () => {
|
|
|
198
200
|
|
|
199
201
|
expect(spinner).toBeTruthy();
|
|
200
202
|
});
|
|
203
|
+
it('displays the total number of items when applying filter and selecting all items', async () => {
|
|
204
|
+
const propsWithSelection = {
|
|
205
|
+
...props,
|
|
206
|
+
isSelectable: true,
|
|
207
|
+
isFilterable: true,
|
|
208
|
+
manualFilters: true,
|
|
209
|
+
defaultColumnValues: { Filter: TextFilter },
|
|
210
|
+
isPaginated: true,
|
|
211
|
+
initialState: { pageSize: 3, pageIndex: 0 },
|
|
212
|
+
pageCount: 3,
|
|
213
|
+
fetchData: jest.fn(),
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
render(<DataTableWrapper {...propsWithSelection} />);
|
|
217
|
+
const filtersButton = screen.getByRole('button', { name: 'Filters' });
|
|
218
|
+
|
|
219
|
+
await userEvent.click(filtersButton);
|
|
220
|
+
|
|
221
|
+
const searchFormControl = screen.getByPlaceholderText('Search coat color');
|
|
222
|
+
await userEvent.type(searchFormControl, 'brown tabby');
|
|
223
|
+
|
|
224
|
+
const selectAllCheckBox = screen.getByTitle('Toggle All Current Page Rows Selected');
|
|
225
|
+
await userEvent.click(selectAllCheckBox);
|
|
226
|
+
|
|
227
|
+
const selectAllButton = screen.getByTestId(SELECT_ALL_TEST_ID);
|
|
228
|
+
// A filtered array is returned from the backend,
|
|
229
|
+
// and the element counter displays its length.
|
|
230
|
+
expect(selectAllButton).toHaveTextContent('Select all 7');
|
|
231
|
+
});
|
|
201
232
|
|
|
202
233
|
describe('[legacy] controlled table selections', () => {
|
|
203
234
|
it('passes initial controlledTableSelections to context', async () => {
|