@openedx/paragon 23.14.0 → 23.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -14
- package/dist/Alert/index.d.ts +20 -0
- package/dist/Alert/index.js +21 -80
- package/dist/Alert/index.js.map +1 -1
- package/dist/Bubble/index.d.ts +6 -2
- package/dist/Bubble/index.js +4 -26
- package/dist/Bubble/index.js.map +1 -1
- package/dist/DataTable/DropdownFilters.js +7 -2
- package/dist/DataTable/DropdownFilters.js.map +1 -1
- package/dist/DataTable/index.js +8 -1
- package/dist/DataTable/index.js.map +1 -1
- package/dist/DataTable/messages.js +5 -0
- package/dist/Modal/ModalDialog.d.ts +6 -65
- package/dist/Modal/ModalDialog.js +0 -64
- package/dist/Modal/ModalDialog.js.map +1 -1
- package/dist/Modal/ModalLayer.d.ts +0 -25
- package/dist/Modal/ModalLayer.js +0 -19
- package/dist/Modal/ModalLayer.js.map +1 -1
- package/dist/ProductTour/index.js +8 -2
- package/dist/ProductTour/index.js.map +1 -1
- package/dist/Spinner/index.d.ts +11 -0
- package/dist/Spinner/index.js +1 -11
- package/dist/Spinner/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/Alert/Alert.test.tsx +14 -1
- package/src/Alert/index.tsx +42 -93
- package/src/Bubble/index.tsx +12 -32
- package/src/DataTable/DropdownFilters.jsx +9 -2
- package/src/DataTable/README.md +19 -18
- package/src/DataTable/index.jsx +6 -1
- package/src/DataTable/messages.js +5 -0
- package/src/DataTable/tests/DataTable.test.jsx +51 -1
- package/src/DataTable/tests/DropdownFilters.test.jsx +11 -7
- package/src/Modal/ModalDialog.tsx +6 -66
- package/src/Modal/ModalLayer.tsx +0 -22
- package/src/ProductTour/ProductTour.test.jsx +40 -2
- package/src/ProductTour/index.jsx +8 -2
- package/src/Spinner/{index.jsx → index.tsx} +10 -15
- package/src/index.ts +1 -2
- /package/src/Spinner/{Spinner.test.jsx → Spinner.test.tsx} +0 -0
- /package/src/Spinner/__snapshots__/{Spinner.test.jsx.snap → Spinner.test.tsx.snap} +0 -0
package/README.md
CHANGED
|
@@ -136,6 +136,72 @@ Note that if you are using ``@edx/frontend-platform``'s ``AppProvider`` componen
|
|
|
136
136
|
});
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
+
## Available Scripts
|
|
140
|
+
|
|
141
|
+
Paragon provides a comprehensive set of npm scripts to help with development, testing, building, and maintenance tasks. Here's a detailed explanation of each available script:
|
|
142
|
+
|
|
143
|
+
### Build Scripts
|
|
144
|
+
|
|
145
|
+
- **`npm run build`** - Builds the entire Paragon design system using the Makefile. This compiles TypeScript, SCSS, and creates the distribution files in the `dist/` directory.
|
|
146
|
+
|
|
147
|
+
- **`npm run build-docs`** - Builds the documentation website specifically. This is useful when generating a static version of the docs for deployment.
|
|
148
|
+
|
|
149
|
+
- **`npm run build-types`** - Generates TypeScript declaration files (`.d.ts`). This is essential for providing type information to TypeScript consumers.
|
|
150
|
+
|
|
151
|
+
### Development Scripts
|
|
152
|
+
|
|
153
|
+
- **`npm start`** - Starts the documentation website development server. This is the primary way to view and interact with Paragon components during development.
|
|
154
|
+
|
|
155
|
+
- **`npm run generate-component`** - Launches the component generator tool. This interactive CLI helps create new components with all the necessary files and boilerplate code.
|
|
156
|
+
|
|
157
|
+
- **`npm run example:start`** - Starts the example application, which allows testing Paragon components in a micro-frontend (MFE) environment.
|
|
158
|
+
|
|
159
|
+
- **`npm run example:start:with-theme`** - Starts the example application with theme support, useful for testing branded components.
|
|
160
|
+
|
|
161
|
+
### Testing Scripts
|
|
162
|
+
|
|
163
|
+
- **`npm run test`** - Runs the full test suite with coverage reporting using Jest.
|
|
164
|
+
|
|
165
|
+
- **`npm run test:watch`** - Runs tests in watch mode, automatically re-running tests when files change.
|
|
166
|
+
|
|
167
|
+
- **`npm run debug-test`** - Runs tests with Node.js inspector enabled, allowing debugging tests in Chrome DevTools.
|
|
168
|
+
|
|
169
|
+
- **`npm run snapshot`** - Updates Jest snapshot files. Run this when intentional changes to component rendering should be reflected in snapshots.
|
|
170
|
+
|
|
171
|
+
### Code Quality Scripts
|
|
172
|
+
|
|
173
|
+
- **`npm run lint`** - Runs both ESLint (for JavaScript/TypeScript) and Stylelint (for SCSS) to check code quality and enforce coding standards.
|
|
174
|
+
|
|
175
|
+
- **`npm run stylelint`** - Runs Stylelint specifically on SCSS files to ensure consistent styling conventions.
|
|
176
|
+
|
|
177
|
+
- **`npm run type-check`** - Performs TypeScript type checking without emitting files.
|
|
178
|
+
|
|
179
|
+
- **`npm run type-check:watch`** - Runs TypeScript type checking in watch mode, continuously monitoring for type errors during development.
|
|
180
|
+
|
|
181
|
+
### Internationalization Scripts
|
|
182
|
+
|
|
183
|
+
- **`npm run i18n_extract`** - Extracts internationalization strings from React components and generates a JSON file for translation services like Transifex.
|
|
184
|
+
|
|
185
|
+
- **`npm run i18n_compile`** - Compiles translated messages back into the format expected by react-intl.
|
|
186
|
+
|
|
187
|
+
### Documentation and Playroom Scripts
|
|
188
|
+
|
|
189
|
+
- **`npm run playroom:start`** - Starts Playroom, a tool for developing and testing components in isolation with live code editing.
|
|
190
|
+
|
|
191
|
+
- **`npm run playroom:build`** - Builds a static version of Playroom for deployment.
|
|
192
|
+
|
|
193
|
+
### Release and Maintenance Scripts
|
|
194
|
+
|
|
195
|
+
- **`npm run semantic-release`** - Runs the semantic release process, which automatically determines version bumps, creates Git tags, and publishes to npm based on commit messages.
|
|
196
|
+
|
|
197
|
+
- **`npm run generate-changelog`** - Generates a changelog file based on commit history and semantic versioning.
|
|
198
|
+
|
|
199
|
+
- **`npm run commit`** - Runs the commitizen CLI, which helps create properly formatted commit messages that work with semantic-release.
|
|
200
|
+
|
|
201
|
+
- **`npm run prepublishOnly`** - Automatically runs before npm publish to ensure the library is built before distribution.
|
|
202
|
+
|
|
203
|
+
- **`npm run prepare`** - Sets up Git hooks (via Husky) for pre-commit linting and other checks.
|
|
204
|
+
|
|
139
205
|
## Contributing
|
|
140
206
|
|
|
141
207
|
The branch to target with your PR depends on the type of change you are contributing to Paragon.
|
|
@@ -163,7 +229,7 @@ If you want to test the changes with local MFE setup, you need to create a "modu
|
|
|
163
229
|
```javascript
|
|
164
230
|
module.exports = {
|
|
165
231
|
/*
|
|
166
|
-
Modules you want to use from local source code. Adding a module here means that when
|
|
232
|
+
Modules you want to use from local source code. Adding a module here means that when
|
|
167
233
|
your MFE runs its build, it'll resolve the source from peer directories of the app.
|
|
168
234
|
|
|
169
235
|
moduleName: the name you use to import code from the module.
|
|
@@ -188,26 +254,26 @@ Then, when importing Paragon's core SCSS in your MFE the import needs to begin w
|
|
|
188
254
|
When developing a new component you should generally follow three rules:
|
|
189
255
|
1. The component should not have **any** hardcoded strings as it would be impossible for consumers to translate it
|
|
190
256
|
2. Internationalize all default values of props that expect strings, i.e.
|
|
191
|
-
|
|
257
|
+
|
|
192
258
|
- For places where you need to display a string, and it's okay if it is a React element use ``FormattedMessage``, e.g. (see [Alert](src/Alert/index.jsx) component for a full example)
|
|
193
|
-
|
|
259
|
+
|
|
194
260
|
```javascript
|
|
195
261
|
import { FormattedMessage } from 'react-intl';
|
|
196
|
-
|
|
197
|
-
<FormattedMessage
|
|
262
|
+
|
|
263
|
+
<FormattedMessage
|
|
198
264
|
id="pgn.Alert.closeLabel"
|
|
199
265
|
defaultMessage="Dismiss"
|
|
200
266
|
description="Label of a close button on Alert component"
|
|
201
267
|
/>
|
|
202
268
|
```
|
|
203
|
-
|
|
269
|
+
|
|
204
270
|
- For places where the display string has to be a plain JavaScript string use ``formatMessage``, this would require access to ``intl`` object from ``react-intl``, e.g.
|
|
205
|
-
|
|
271
|
+
|
|
206
272
|
- For class components use ``injectIntl`` HOC
|
|
207
273
|
|
|
208
274
|
```javascript
|
|
209
275
|
import { injectIntl } from 'react-intl';
|
|
210
|
-
|
|
276
|
+
|
|
211
277
|
class MyClassComponent extends React.Component {
|
|
212
278
|
render() {
|
|
213
279
|
const { altText, intl } = this.props;
|
|
@@ -216,7 +282,7 @@ When developing a new component you should generally follow three rules:
|
|
|
216
282
|
defaultMessage: 'Close',
|
|
217
283
|
description: 'Close label for Toast component',
|
|
218
284
|
});
|
|
219
|
-
|
|
285
|
+
|
|
220
286
|
return (
|
|
221
287
|
<IconButton
|
|
222
288
|
alt={intlCloseLabel}
|
|
@@ -226,15 +292,15 @@ When developing a new component you should generally follow three rules:
|
|
|
226
292
|
)
|
|
227
293
|
}
|
|
228
294
|
}
|
|
229
|
-
|
|
295
|
+
|
|
230
296
|
export default injectIntl(MyClassComponent);
|
|
231
297
|
```
|
|
232
298
|
|
|
233
299
|
- For functional components use ``useIntl`` hook
|
|
234
300
|
|
|
235
|
-
```javascript
|
|
301
|
+
```javascript
|
|
236
302
|
import { useIntl } from 'react-intl';
|
|
237
|
-
|
|
303
|
+
|
|
238
304
|
const MyFunctionComponent = ({ altText }) => {
|
|
239
305
|
const intls = useIntl();
|
|
240
306
|
const intlAltText = altText || intl.formatMessage({
|
|
@@ -242,7 +308,7 @@ When developing a new component you should generally follow three rules:
|
|
|
242
308
|
defaultMessage: 'Close',
|
|
243
309
|
description: 'Close label for Toast component',
|
|
244
310
|
});
|
|
245
|
-
|
|
311
|
+
|
|
246
312
|
return (
|
|
247
313
|
<IconButton
|
|
248
314
|
alt={intlCloseLabel}
|
|
@@ -254,7 +320,7 @@ When developing a new component you should generally follow three rules:
|
|
|
254
320
|
|
|
255
321
|
export default MyFunctionComponent;
|
|
256
322
|
```
|
|
257
|
-
|
|
323
|
+
|
|
258
324
|
**Notes on the format above**:
|
|
259
325
|
- `id` is required and must be a dot-separated string of the format `pgn.<componentName>.<subcomponentName>.<propName>`
|
|
260
326
|
- The `defaultMessage` is required, and should be the English display string.
|
package/dist/Alert/index.d.ts
CHANGED
|
@@ -1,29 +1,49 @@
|
|
|
1
1
|
import React, { ReactNode, ElementType, FC, ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
2
|
import { AlertProps as BaseAlertProps } from 'react-bootstrap';
|
|
3
|
+
import { type TransitionComponent } from 'react-bootstrap/helpers';
|
|
3
4
|
import { IconProps } from '../Icon';
|
|
4
5
|
export declare const ALERT_CLOSE_LABEL_TEXT = "Dismiss";
|
|
5
6
|
export type AlertVariant = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light';
|
|
6
7
|
export type BaseProps = Omit<BaseAlertProps, 'children' | 'variant' | 'closeLabel'>;
|
|
7
8
|
export interface AlertProps extends BaseProps {
|
|
9
|
+
/** Specifies class name to append to the base element */
|
|
8
10
|
className?: string;
|
|
11
|
+
/** Overrides underlying component base CSS class name */
|
|
9
12
|
bsPrefix?: string;
|
|
13
|
+
/** Specifies variant to use. */
|
|
10
14
|
variant?: AlertVariant;
|
|
15
|
+
/**
|
|
16
|
+
* Animate the entering and exiting of the Alert. `true` will use the `<Fade>` transition,
|
|
17
|
+
* more detailed customization is also provided.
|
|
18
|
+
*/
|
|
19
|
+
transition?: boolean | TransitionComponent;
|
|
11
20
|
children?: ReactNode;
|
|
21
|
+
/** Icon that will be shown in the alert */
|
|
12
22
|
icon?: React.ComponentType<IconProps>;
|
|
23
|
+
/** Whether the alert is shown. */
|
|
13
24
|
show?: boolean;
|
|
25
|
+
/** Whether the alert is dismissible. Defaults to false. */
|
|
14
26
|
dismissible?: boolean;
|
|
27
|
+
/** Optional callback function for when the alert it dismissed. */
|
|
15
28
|
onClose?: () => void;
|
|
29
|
+
/** Optional list of action elements. May include, at most, 2 actions, or 1 if dismissible is true. */
|
|
16
30
|
actions?: React.ReactElement[];
|
|
31
|
+
/** Position of the dismiss and call-to-action buttons. Defaults to `false`. */
|
|
17
32
|
stacked?: boolean;
|
|
33
|
+
/** Sets the text for alert close button, defaults to 'Dismiss'. */
|
|
18
34
|
closeLabel?: string | ReactNode;
|
|
19
35
|
}
|
|
20
36
|
export interface AlertHeadingProps {
|
|
37
|
+
/** Specifies the base element */
|
|
21
38
|
as?: ElementType;
|
|
39
|
+
/** Overrides underlying component base CSS class name */
|
|
22
40
|
bsPrefix?: string;
|
|
23
41
|
children?: ReactNode;
|
|
24
42
|
}
|
|
25
43
|
export interface AlertLinkProps {
|
|
44
|
+
/** Specifies the base element */
|
|
26
45
|
as?: ElementType;
|
|
46
|
+
/** Overrides underlying component base CSS class name */
|
|
27
47
|
bsPrefix?: string;
|
|
28
48
|
children?: ReactNode;
|
|
29
49
|
href?: string;
|
package/dist/Alert/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable react/require-default-props */
|
|
2
2
|
import React, { useCallback, useEffect, useState, forwardRef, cloneElement } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
import { Alert as BaseAlert } from 'react-bootstrap';
|
|
6
5
|
import divWithClassName from 'react-bootstrap/divWithClassName';
|
|
@@ -17,10 +16,11 @@ const Alert = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
17
16
|
children,
|
|
18
17
|
icon,
|
|
19
18
|
actions,
|
|
20
|
-
dismissible,
|
|
21
|
-
onClose,
|
|
19
|
+
dismissible = false,
|
|
20
|
+
onClose = () => {},
|
|
22
21
|
closeLabel,
|
|
23
|
-
stacked,
|
|
22
|
+
stacked = false,
|
|
23
|
+
show = true,
|
|
24
24
|
...props
|
|
25
25
|
} = _ref;
|
|
26
26
|
const [isStacked, setIsStacked] = useState(stacked);
|
|
@@ -45,6 +45,7 @@ const Alert = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
45
45
|
return /*#__PURE__*/React.createElement(BaseAlert, {
|
|
46
46
|
...props,
|
|
47
47
|
className: classNames('alert-content', props.className),
|
|
48
|
+
show: show,
|
|
48
49
|
ref: ref
|
|
49
50
|
}, icon && /*#__PURE__*/React.createElement(Icon, {
|
|
50
51
|
src: icon,
|
|
@@ -74,90 +75,30 @@ const Alert = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
74
75
|
// so there seems to be no other way of providing correct default prop for base element
|
|
75
76
|
const DivStyledAsH4 = divWithClassName('h4');
|
|
76
77
|
DivStyledAsH4.displayName = 'DivStyledAsH4';
|
|
77
|
-
function AlertHeading(
|
|
78
|
+
function AlertHeading(_ref2) {
|
|
79
|
+
let {
|
|
80
|
+
as = DivStyledAsH4,
|
|
81
|
+
bsPrefix = 'alert-heading',
|
|
82
|
+
...props
|
|
83
|
+
} = _ref2;
|
|
78
84
|
return /*#__PURE__*/React.createElement(BaseAlert.Heading, {
|
|
85
|
+
as,
|
|
86
|
+
bsPrefix,
|
|
79
87
|
...props
|
|
80
88
|
});
|
|
81
89
|
}
|
|
82
|
-
function AlertLink(
|
|
90
|
+
function AlertLink(_ref3) {
|
|
91
|
+
let {
|
|
92
|
+
as = 'a',
|
|
93
|
+
bsPrefix = 'alert-link',
|
|
94
|
+
...props
|
|
95
|
+
} = _ref3;
|
|
83
96
|
return /*#__PURE__*/React.createElement(BaseAlert.Link, {
|
|
97
|
+
as,
|
|
98
|
+
bsPrefix,
|
|
84
99
|
...props
|
|
85
100
|
});
|
|
86
101
|
}
|
|
87
|
-
AlertLink.propTypes = {
|
|
88
|
-
/** Specifies the base element */
|
|
89
|
-
as: PropTypes.elementType,
|
|
90
|
-
/** Overrides underlying component base CSS class name */
|
|
91
|
-
bsPrefix: PropTypes.string
|
|
92
|
-
};
|
|
93
|
-
AlertHeading.propTypes = {
|
|
94
|
-
/** Specifies the base element */
|
|
95
|
-
as: PropTypes.elementType,
|
|
96
|
-
/** Overrides underlying component base CSS class name */
|
|
97
|
-
bsPrefix: PropTypes.string
|
|
98
|
-
};
|
|
99
|
-
AlertLink.defaultProps = {
|
|
100
|
-
as: 'a',
|
|
101
|
-
bsPrefix: 'alert-link'
|
|
102
|
-
};
|
|
103
|
-
AlertHeading.defaultProps = {
|
|
104
|
-
as: DivStyledAsH4,
|
|
105
|
-
bsPrefix: 'alert-heading'
|
|
106
|
-
};
|
|
107
|
-
Alert.propTypes = {
|
|
108
|
-
...BaseAlert.propTypes,
|
|
109
|
-
/** Specifies class name to append to the base element */
|
|
110
|
-
className: PropTypes.string,
|
|
111
|
-
/** Overrides underlying component base CSS class name */
|
|
112
|
-
bsPrefix: PropTypes.string,
|
|
113
|
-
/** Specifies variant to use. */
|
|
114
|
-
variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light']),
|
|
115
|
-
/**
|
|
116
|
-
* Animate the entering and exiting of the Alert. `true` will use the `<Fade>` transition,
|
|
117
|
-
* more detailed customization is also provided.
|
|
118
|
-
*/
|
|
119
|
-
transition: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
|
|
120
|
-
in: PropTypes.bool,
|
|
121
|
-
appear: PropTypes.bool,
|
|
122
|
-
children: PropTypes.node,
|
|
123
|
-
onEnter: PropTypes.func,
|
|
124
|
-
onEntered: PropTypes.func,
|
|
125
|
-
onEntering: PropTypes.func,
|
|
126
|
-
onExit: PropTypes.func,
|
|
127
|
-
onExited: PropTypes.func,
|
|
128
|
-
onExiting: PropTypes.func
|
|
129
|
-
})]),
|
|
130
|
-
/** Docstring for the children prop */
|
|
131
|
-
children: PropTypes.node,
|
|
132
|
-
/** Docstring for the icon prop... Icon that will be shown in the alert */
|
|
133
|
-
icon: PropTypes.func,
|
|
134
|
-
/** Whether the alert is shown. */
|
|
135
|
-
show: PropTypes.bool,
|
|
136
|
-
/** Whether the alert is dismissible. Defaults to true. */
|
|
137
|
-
dismissible: PropTypes.bool,
|
|
138
|
-
/** Optional callback function for when the alert it dismissed. */
|
|
139
|
-
onClose: PropTypes.func,
|
|
140
|
-
/** Optional list of action elements. May include, at most, 2 actions, or 1 if dismissible is true. */
|
|
141
|
-
actions: PropTypes.arrayOf(PropTypes.element),
|
|
142
|
-
/** Position of the dismiss and call-to-action buttons. Defaults to ``false``. */
|
|
143
|
-
stacked: PropTypes.bool,
|
|
144
|
-
/** Sets the text for alert close button, defaults to 'Dismiss'. */
|
|
145
|
-
closeLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
|
|
146
|
-
};
|
|
147
|
-
Alert.defaultProps = {
|
|
148
|
-
...BaseAlert.defaultProps,
|
|
149
|
-
children: undefined,
|
|
150
|
-
icon: undefined,
|
|
151
|
-
actions: undefined,
|
|
152
|
-
dismissible: false,
|
|
153
|
-
onClose: () => {},
|
|
154
|
-
closeLabel: undefined,
|
|
155
|
-
show: true,
|
|
156
|
-
stacked: false,
|
|
157
|
-
className: undefined,
|
|
158
|
-
bsPrefix: undefined,
|
|
159
|
-
variant: undefined
|
|
160
|
-
};
|
|
161
102
|
Alert.Heading = AlertHeading;
|
|
162
103
|
Alert.Link = AlertLink;
|
|
163
104
|
export default Alert;
|
package/dist/Alert/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useEffect","useState","forwardRef","cloneElement","PropTypes","classNames","Alert","BaseAlert","divWithClassName","FormattedMessage","useMediaQuery","Icon","breakpoints","Button","ActionRow","ALERT_CLOSE_LABEL_TEXT","_ref","ref","children","icon","actions","dismissible","onClose","closeLabel","stacked","props","isStacked","setIsStacked","isExtraSmall","maxWidth","extraSmall","actionButtonSize","cloneActionElement","Action","addtlActionProps","size","key","createElement","className","src","length","Spacer","variant","onClick","id","defaultMessage","description","map","DivStyledAsH4","displayName","AlertHeading","Heading","AlertLink","Link","propTypes","as","elementType","bsPrefix","string","defaultProps","oneOf","transition","oneOfType","bool","shape","in","appear","node","onEnter","func","onEntered","onEntering","onExit","onExited","onExiting","show","arrayOf","element","undefined"],"sources":["../../src/Alert/index.tsx"],"sourcesContent":["/* eslint-disable react/require-default-props */\nimport React, {\n useCallback,\n useEffect,\n useState,\n ReactNode,\n ElementType,\n forwardRef,\n FC,\n ForwardRefExoticComponent,\n RefAttributes,\n cloneElement,\n} from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport {\n Alert as BaseAlert,\n AlertProps as BaseAlertProps,\n} from 'react-bootstrap';\nimport divWithClassName from 'react-bootstrap/divWithClassName';\nimport { FormattedMessage } from 'react-intl';\nimport { useMediaQuery } from 'react-responsive';\nimport Icon, { IconProps } from '../Icon';\nimport breakpoints from '../utils/breakpoints';\nimport Button from '../Button';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ActionRow from '../ActionRow';\n\nexport const ALERT_CLOSE_LABEL_TEXT = 'Dismiss';\n\nexport type AlertVariant = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light';\n\nexport type BaseProps = Omit<BaseAlertProps, 'children' | 'variant' | 'closeLabel'>;\n\nexport interface AlertProps extends BaseProps {\n className?: string;\n bsPrefix?: string;\n variant?: AlertVariant;\n children?: ReactNode;\n icon?: React.ComponentType<IconProps>;\n show?: boolean;\n dismissible?: boolean;\n onClose?: () => void;\n actions?: React.ReactElement[];\n stacked?: boolean;\n closeLabel?: string | ReactNode;\n}\n\nexport interface AlertHeadingProps {\n as?: ElementType;\n bsPrefix?: string;\n children?: ReactNode;\n}\n\nexport interface AlertLinkProps {\n as?: ElementType;\n bsPrefix?: string;\n children?: ReactNode;\n href?: string;\n}\n\nexport interface AlertComponent extends ForwardRefExoticComponent<AlertProps & RefAttributes<HTMLDivElement>> {\n Heading: FC<AlertHeadingProps>;\n Link: FC<AlertLinkProps>;\n}\n\nconst Alert = forwardRef<HTMLDivElement, AlertProps>(({\n children,\n icon,\n actions,\n dismissible,\n onClose,\n closeLabel,\n stacked,\n ...props\n}, ref) => {\n const [isStacked, setIsStacked] = useState(stacked);\n const isExtraSmall = useMediaQuery({ maxWidth: breakpoints.extraSmall.maxWidth });\n const actionButtonSize = 'sm';\n\n useEffect(() => {\n if (isExtraSmall) {\n setIsStacked(true);\n } else {\n setIsStacked(stacked);\n }\n }, [isExtraSmall, stacked]);\n\n const cloneActionElement = useCallback(\n (Action: React.ReactElement) => {\n const addtlActionProps = { size: actionButtonSize, key: Action.props.children };\n return cloneElement(Action, addtlActionProps);\n },\n [],\n );\n\n return (\n <BaseAlert\n {...props}\n className={classNames('alert-content', props.className)}\n ref={ref}\n >\n {icon && <Icon src={icon} className=\"alert-icon\" />}\n <div\n className={classNames({\n 'pgn__alert-message-wrapper': !isStacked,\n 'pgn__alert-message-wrapper-stacked': isStacked,\n })}\n >\n <div className=\"alert-message-content\">\n {children}\n </div>\n {(dismissible || (actions && actions.length > 0)) && (\n <ActionRow className=\"pgn__alert-actions\">\n <ActionRow.Spacer />\n {dismissible && (\n <Button\n size={actionButtonSize}\n variant=\"tertiary\"\n onClick={onClose}\n >\n {closeLabel || (\n <FormattedMessage\n id=\"pgn.Alert.closeLabel\"\n defaultMessage=\"Dismiss\"\n description=\"Label of a close button on Alert component\"\n />\n )}\n </Button>\n )}\n {actions && actions.map(cloneActionElement)}\n </ActionRow>\n )}\n </div>\n </BaseAlert>\n );\n}) as AlertComponent;\n\n// This is needed to display a default prop for Alert.Heading element\n// Copied from react-bootstrap since BaseAlert.Heading component doesn't have defaultProps,\n// so there seems to be no other way of providing correct default prop for base element\nconst DivStyledAsH4 = divWithClassName('h4');\nDivStyledAsH4.displayName = 'DivStyledAsH4';\n\nfunction AlertHeading(props: AlertHeadingProps): JSX.Element {\n return <BaseAlert.Heading {...props} />;\n}\n\nfunction AlertLink(props: AlertLinkProps): JSX.Element {\n return <BaseAlert.Link {...props} />;\n}\n\nAlertLink.propTypes = {\n /** Specifies the base element */\n as: PropTypes.elementType as PropTypes.Validator<ElementType>,\n /** Overrides underlying component base CSS class name */\n bsPrefix: PropTypes.string,\n};\n\nAlertHeading.propTypes = {\n /** Specifies the base element */\n as: PropTypes.elementType as PropTypes.Validator<ElementType>,\n /** Overrides underlying component base CSS class name */\n bsPrefix: PropTypes.string,\n};\n\nAlertLink.defaultProps = {\n as: 'a' as ElementType,\n bsPrefix: 'alert-link',\n};\n\nAlertHeading.defaultProps = {\n as: DivStyledAsH4,\n bsPrefix: 'alert-heading',\n};\n\nAlert.propTypes = {\n ...BaseAlert.propTypes,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /** Overrides underlying component base CSS class name */\n bsPrefix: PropTypes.string,\n /** Specifies variant to use. */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'] as AlertVariant[]),\n /**\n * Animate the entering and exiting of the Alert. `true` will use the `<Fade>` transition,\n * more detailed customization is also provided.\n */\n transition: PropTypes.oneOfType([\n PropTypes.bool,\n PropTypes.shape({\n in: PropTypes.bool,\n appear: PropTypes.bool,\n children: PropTypes.node,\n onEnter: PropTypes.func,\n onEntered: PropTypes.func,\n onEntering: PropTypes.func,\n onExit: PropTypes.func,\n onExited: PropTypes.func,\n onExiting: PropTypes.func,\n }),\n ]) as PropTypes.Validator<BaseAlertProps['transition']>,\n /** Docstring for the children prop */\n children: PropTypes.node as PropTypes.Validator<ReactNode>,\n /** Docstring for the icon prop... Icon that will be shown in the alert */\n icon: PropTypes.func,\n /** Whether the alert is shown. */\n show: PropTypes.bool,\n /** Whether the alert is dismissible. Defaults to true. */\n dismissible: PropTypes.bool,\n /** Optional callback function for when the alert it dismissed. */\n onClose: PropTypes.func,\n /** Optional list of action elements. May include, at most, 2 actions, or 1 if dismissible is true. */\n actions: PropTypes.arrayOf(PropTypes.element) as PropTypes.Validator<React.ReactElement[]>,\n /** Position of the dismiss and call-to-action buttons. Defaults to ``false``. */\n stacked: PropTypes.bool,\n /** Sets the text for alert close button, defaults to 'Dismiss'. */\n closeLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n};\n\nAlert.defaultProps = {\n ...BaseAlert.defaultProps,\n children: undefined,\n icon: undefined,\n actions: undefined,\n dismissible: false,\n onClose: () => {},\n closeLabel: undefined,\n show: true,\n stacked: false,\n className: undefined,\n bsPrefix: undefined,\n variant: undefined,\n};\n\nAlert.Heading = AlertHeading;\nAlert.Link = AlertLink;\n\nexport default Alert;\n"],"mappings":"AAAA;AACA,OAAOA,KAAK,IACVC,WAAW,EACXC,S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E,KAAK;EACdc,SAAS,EAAEwC,SAAS;EACpBrB,QAAQ,EAAEqB,SAAS;EACnBpC,OAAO,EAAEoC;AACX,CAAC;AAEDxE,KAAK,CAAC6C,OAAO,GAAGD,YAAY;AAC5B5C,KAAK,CAAC+C,IAAI,GAAGD,SAAS;AAEtB,eAAe9C,KAAK","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useEffect","useState","forwardRef","cloneElement","classNames","Alert","BaseAlert","divWithClassName","FormattedMessage","useMediaQuery","Icon","breakpoints","Button","ActionRow","ALERT_CLOSE_LABEL_TEXT","_ref","ref","children","icon","actions","dismissible","onClose","closeLabel","stacked","show","props","isStacked","setIsStacked","isExtraSmall","maxWidth","extraSmall","actionButtonSize","cloneActionElement","Action","addtlActionProps","size","key","createElement","className","src","length","Spacer","variant","onClick","id","defaultMessage","description","map","DivStyledAsH4","displayName","AlertHeading","_ref2","as","bsPrefix","Heading","AlertLink","_ref3","Link"],"sources":["../../src/Alert/index.tsx"],"sourcesContent":["/* eslint-disable react/require-default-props */\nimport React, {\n useCallback,\n useEffect,\n useState,\n ReactNode,\n ElementType,\n forwardRef,\n FC,\n ForwardRefExoticComponent,\n RefAttributes,\n cloneElement,\n} from 'react';\nimport classNames from 'classnames';\nimport {\n Alert as BaseAlert,\n AlertProps as BaseAlertProps,\n} from 'react-bootstrap';\nimport { type TransitionComponent } from 'react-bootstrap/helpers';\nimport divWithClassName from 'react-bootstrap/divWithClassName';\nimport { FormattedMessage } from 'react-intl';\nimport { useMediaQuery } from 'react-responsive';\nimport Icon, { IconProps } from '../Icon';\nimport breakpoints from '../utils/breakpoints';\nimport Button from '../Button';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ActionRow from '../ActionRow';\n\nexport const ALERT_CLOSE_LABEL_TEXT = 'Dismiss';\n\nexport type AlertVariant = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light';\n\nexport type BaseProps = Omit<BaseAlertProps, 'children' | 'variant' | 'closeLabel'>;\n\nexport interface AlertProps extends BaseProps {\n /** Specifies class name to append to the base element */\n className?: string;\n /** Overrides underlying component base CSS class name */\n bsPrefix?: string;\n /** Specifies variant to use. */\n variant?: AlertVariant;\n /**\n * Animate the entering and exiting of the Alert. `true` will use the `<Fade>` transition,\n * more detailed customization is also provided.\n */\n transition?: boolean | TransitionComponent;\n children?: ReactNode;\n /** Icon that will be shown in the alert */\n icon?: React.ComponentType<IconProps>;\n /** Whether the alert is shown. */\n show?: boolean;\n /** Whether the alert is dismissible. Defaults to false. */\n dismissible?: boolean;\n /** Optional callback function for when the alert it dismissed. */\n onClose?: () => void;\n /** Optional list of action elements. May include, at most, 2 actions, or 1 if dismissible is true. */\n actions?: React.ReactElement[];\n /** Position of the dismiss and call-to-action buttons. Defaults to `false`. */\n stacked?: boolean;\n /** Sets the text for alert close button, defaults to 'Dismiss'. */\n closeLabel?: string | ReactNode;\n}\n\nexport interface AlertHeadingProps {\n /** Specifies the base element */\n as?: ElementType;\n /** Overrides underlying component base CSS class name */\n bsPrefix?: string;\n // eslint-disable-next-line react/no-unused-prop-types\n children?: ReactNode;\n}\n\nexport interface AlertLinkProps {\n /** Specifies the base element */\n as?: ElementType;\n /** Overrides underlying component base CSS class name */\n bsPrefix?: string;\n // eslint-disable-next-line react/no-unused-prop-types\n children?: ReactNode;\n // eslint-disable-next-line react/no-unused-prop-types\n href?: string;\n}\n\nexport interface AlertComponent extends ForwardRefExoticComponent<AlertProps & RefAttributes<HTMLDivElement>> {\n Heading: FC<AlertHeadingProps>;\n Link: FC<AlertLinkProps>;\n}\n\nconst Alert = forwardRef(({\n children,\n icon,\n actions,\n dismissible = false,\n onClose = () => {},\n closeLabel,\n stacked = false,\n show = true,\n ...props\n}: AlertProps, ref: React.ForwardedRef<HTMLDivElement>) => {\n const [isStacked, setIsStacked] = useState(stacked);\n const isExtraSmall = useMediaQuery({ maxWidth: breakpoints.extraSmall.maxWidth });\n const actionButtonSize = 'sm';\n\n useEffect(() => {\n if (isExtraSmall) {\n setIsStacked(true);\n } else {\n setIsStacked(stacked);\n }\n }, [isExtraSmall, stacked]);\n\n const cloneActionElement = useCallback(\n (Action: React.ReactElement) => {\n const addtlActionProps = { size: actionButtonSize, key: Action.props.children };\n return cloneElement(Action, addtlActionProps);\n },\n [],\n );\n\n return (\n <BaseAlert\n {...props}\n className={classNames('alert-content', props.className)}\n show={show}\n ref={ref}\n >\n {icon && <Icon src={icon} className=\"alert-icon\" />}\n <div\n className={classNames({\n 'pgn__alert-message-wrapper': !isStacked,\n 'pgn__alert-message-wrapper-stacked': isStacked,\n })}\n >\n <div className=\"alert-message-content\">\n {children}\n </div>\n {(dismissible || (actions && actions.length > 0)) && (\n <ActionRow className=\"pgn__alert-actions\">\n <ActionRow.Spacer />\n {dismissible && (\n <Button\n size={actionButtonSize}\n variant=\"tertiary\"\n onClick={onClose}\n >\n {closeLabel || (\n <FormattedMessage\n id=\"pgn.Alert.closeLabel\"\n defaultMessage=\"Dismiss\"\n description=\"Label of a close button on Alert component\"\n />\n )}\n </Button>\n )}\n {actions && actions.map(cloneActionElement)}\n </ActionRow>\n )}\n </div>\n </BaseAlert>\n );\n}) as AlertComponent;\n\n// This is needed to display a default prop for Alert.Heading element\n// Copied from react-bootstrap since BaseAlert.Heading component doesn't have defaultProps,\n// so there seems to be no other way of providing correct default prop for base element\nconst DivStyledAsH4 = divWithClassName('h4');\nDivStyledAsH4.displayName = 'DivStyledAsH4';\n\nfunction AlertHeading({\n as = DivStyledAsH4,\n bsPrefix = 'alert-heading',\n ...props\n}: AlertHeadingProps): JSX.Element {\n return <BaseAlert.Heading {...{ as, bsPrefix, ...props }} />;\n}\n\nfunction AlertLink({\n as = 'a',\n bsPrefix = 'alert-link',\n ...props\n}: AlertLinkProps): JSX.Element {\n return <BaseAlert.Link {...{ as, bsPrefix, ...props }} />;\n}\n\nAlert.Heading = AlertHeading;\nAlert.Link = AlertLink;\n\nexport default Alert;\n"],"mappings":"AAAA;AAC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,CAAC4B,GAAG,CAACf,kBAAkB,CACjC,CAEV,CACI,CAAC;AAEhB,CAAC,CAAmB;;AAEpB;AACA;AACA;AACA,MAAMgB,aAAa,GAAGzC,gBAAgB,CAAC,IAAI,CAAC;AAC5CyC,aAAa,CAACC,WAAW,GAAG,eAAe;AAE3C,SAASC,YAAYA,CAAAC,KAAA,EAIc;EAAA,IAJb;IACpBC,EAAE,GAAGJ,aAAa;IAClBK,QAAQ,GAAG,eAAe;IAC1B,GAAG5B;EACc,CAAC,GAAA0B,KAAA;EAClB,oBAAOrD,KAAA,CAAAuC,aAAA,CAAC/B,SAAS,CAACgD,OAAO;IAAOF,EAAE;IAAEC,QAAQ;IAAE,GAAG5B;EAAK,CAAK,CAAC;AAC9D;AAEA,SAAS8B,SAASA,CAAAC,KAAA,EAIc;EAAA,IAJb;IACjBJ,EAAE,GAAG,GAAG;IACRC,QAAQ,GAAG,YAAY;IACvB,GAAG5B;EACW,CAAC,GAAA+B,KAAA;EACf,oBAAO1D,KAAA,CAAAuC,aAAA,CAAC/B,SAAS,CAACmD,IAAI;IAAOL,EAAE;IAAEC,QAAQ;IAAE,GAAG5B;EAAK,CAAK,CAAC;AAC3D;AAEApB,KAAK,CAACiD,OAAO,GAAGJ,YAAY;AAC5B7C,KAAK,CAACoD,IAAI,GAAGF,SAAS;AAEtB,eAAelD,KAAK","ignoreList":[]}
|
package/dist/Bubble/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export type BubbleVariant = typeof STYLE_VARIANTS[number];
|
|
2
|
+
export type BubbleVariant = 'primary' | 'success' | 'error' | 'warning';
|
|
4
3
|
export interface BubbleProps {
|
|
4
|
+
/** Specifies contents of the component. */
|
|
5
5
|
children: React.ReactNode;
|
|
6
|
+
/** The `Bubble` style variant to use. */
|
|
6
7
|
variant?: BubbleVariant;
|
|
8
|
+
/** Activates disabled variant. */
|
|
7
9
|
disabled?: boolean;
|
|
10
|
+
/** Optional class name(s) to append to the base element. */
|
|
8
11
|
className?: string;
|
|
12
|
+
/** Specifies whether to add padding to the `Bubble` or not. */
|
|
9
13
|
expandable?: boolean;
|
|
10
14
|
}
|
|
11
15
|
declare const Bubble: React.ForwardRefExoticComponent<BubbleProps & React.RefAttributes<HTMLDivElement>>;
|
package/dist/Bubble/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
|
-
const STYLE_VARIANTS = ['primary', 'success', 'error', 'warning'];
|
|
5
3
|
const Bubble = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
6
4
|
let {
|
|
7
|
-
variant,
|
|
5
|
+
variant = 'primary',
|
|
8
6
|
className,
|
|
9
|
-
children,
|
|
10
|
-
disabled,
|
|
11
|
-
expandable,
|
|
7
|
+
children = null,
|
|
8
|
+
disabled = false,
|
|
9
|
+
expandable = false,
|
|
12
10
|
...props
|
|
13
11
|
} = _ref;
|
|
14
12
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -20,25 +18,5 @@ const Bubble = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
20
18
|
...props
|
|
21
19
|
}, children);
|
|
22
20
|
});
|
|
23
|
-
Bubble.propTypes = {
|
|
24
|
-
/** Specifies contents of the component. */
|
|
25
|
-
// @ts-ignore
|
|
26
|
-
children: PropTypes.node,
|
|
27
|
-
/** The `Bubble` style variant to use. */
|
|
28
|
-
variant: PropTypes.oneOf(STYLE_VARIANTS),
|
|
29
|
-
/** Activates disabled variant. */
|
|
30
|
-
disabled: PropTypes.bool,
|
|
31
|
-
/** A class name to append to the base element. */
|
|
32
|
-
className: PropTypes.string,
|
|
33
|
-
/** Specifies whether to add padding to the `Bubble` or not. */
|
|
34
|
-
expandable: PropTypes.bool
|
|
35
|
-
};
|
|
36
|
-
Bubble.defaultProps = {
|
|
37
|
-
children: null,
|
|
38
|
-
variant: 'primary',
|
|
39
|
-
disabled: false,
|
|
40
|
-
className: undefined,
|
|
41
|
-
expandable: false
|
|
42
|
-
};
|
|
43
21
|
export default Bubble;
|
|
44
22
|
//# sourceMappingURL=index.js.map
|
package/dist/Bubble/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","classNames","Bubble","forwardRef","_ref","ref","variant","className","children","disabled","expandable","props","createElement"],"sources":["../../src/Bubble/index.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\n\nexport type BubbleVariant = 'primary' | 'success' | 'error' | 'warning';\n\nexport interface BubbleProps {\n /** Specifies contents of the component. */\n children: React.ReactNode;\n /** The `Bubble` style variant to use. */\n variant?: BubbleVariant;\n /** Activates disabled variant. */\n disabled?: boolean;\n /** Optional class name(s) to append to the base element. */\n className?: string;\n /** Specifies whether to add padding to the `Bubble` or not. */\n expandable?: boolean;\n}\n\nconst Bubble = React.forwardRef(({\n variant = 'primary',\n className,\n children = null,\n disabled = false,\n expandable = false,\n ...props\n}: BubbleProps, ref: React.ForwardedRef<HTMLDivElement>) => (\n <div\n ref={ref}\n className={classNames(\n 'pgn__bubble',\n `pgn__bubble-${variant}`,\n className,\n { disabled, expandable },\n )}\n {...props}\n >\n {children}\n </div>\n));\n\nexport default Bubble;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AAiBnC,MAAMC,MAAM,gBAAGF,KAAK,CAACG,UAAU,CAAC,CAAAC,IAAA,EAOhBC,GAAuC;EAAA,IAPtB;IAC/BC,OAAO,GAAG,SAAS;IACnBC,SAAS;IACTC,QAAQ,GAAG,IAAI;IACfC,QAAQ,GAAG,KAAK;IAChBC,UAAU,GAAG,KAAK;IAClB,GAAGC;EACQ,CAAC,GAAAP,IAAA;EAAA,oBACZJ,KAAA,CAAAY,aAAA;IACEP,GAAG,EAAEA,GAAI;IACTE,SAAS,EAAEN,UAAU,CACnB,aAAa,EACb,eAAeK,OAAO,EAAE,EACxBC,SAAS,EACT;MAAEE,QAAQ;MAAEC;IAAW,CACzB,CAAE;IAAA,GACEC;EAAK,GAERH,QACE,CAAC;AAAA,CACP,CAAC;AAEF,eAAeN,MAAM","ignoreList":[]}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import React, { useContext, useMemo } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
2
3
|
import DataTableContext from './DataTableContext';
|
|
3
4
|
import { DropdownButton } from '../Dropdown';
|
|
4
5
|
import useWindowSize from '../hooks/useWindowSizeHook';
|
|
5
6
|
import breakpoints from '../utils/breakpoints';
|
|
7
|
+
import messages from './messages';
|
|
6
8
|
|
|
7
9
|
/** The first filter will be as an input, additional filters will be available in a dropdown. */
|
|
8
10
|
function DropdownFilters() {
|
|
11
|
+
const intl = useIntl();
|
|
9
12
|
const {
|
|
10
13
|
width
|
|
11
14
|
} = useWindowSize();
|
|
12
15
|
const {
|
|
13
16
|
columns,
|
|
14
|
-
numBreakoutFilters
|
|
17
|
+
numBreakoutFilters,
|
|
18
|
+
filtersTitle
|
|
15
19
|
} = useContext(DataTableContext);
|
|
16
20
|
const [breakoutFilters, otherFilters] = useMemo(() => {
|
|
17
21
|
if (!columns) {
|
|
@@ -26,6 +30,7 @@ function DropdownFilters() {
|
|
|
26
30
|
const dropdownFilters = availableFilters.slice(numberOfBreakoutFilters);
|
|
27
31
|
return [boFilters, dropdownFilters];
|
|
28
32
|
}, [columns, width, numBreakoutFilters]);
|
|
33
|
+
const dropdownTitle = filtersTitle || intl.formatMessage(messages.filtersDropdownTitle);
|
|
29
34
|
return /*#__PURE__*/React.createElement("div", {
|
|
30
35
|
className: "pgn__data-table-filters"
|
|
31
36
|
}, breakoutFilters.length > 0 && breakoutFilters.map(column => /*#__PURE__*/React.createElement("div", {
|
|
@@ -34,7 +39,7 @@ function DropdownFilters() {
|
|
|
34
39
|
}, column.render('Filter'))), otherFilters.length > 0 && /*#__PURE__*/React.createElement(DropdownButton, {
|
|
35
40
|
variant: "outline-primary",
|
|
36
41
|
id: "table-filters-dropdown",
|
|
37
|
-
title:
|
|
42
|
+
title: dropdownTitle
|
|
38
43
|
}, otherFilters.map(column => /*#__PURE__*/React.createElement("div", {
|
|
39
44
|
key: column.Header,
|
|
40
45
|
className: "pgn__data-table-filters-dropdown-item"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownFilters.js","names":["React","useContext","useMemo","DataTableContext","DropdownButton","useWindowSize","breakpoints","DropdownFilters","width","columns","numBreakoutFilters","breakoutFilters","otherFilters","availableFilters","filter","column","canFilter","small","minWidth","numberOfBreakoutFilters","boFilters","slice","dropdownFilters","createElement","className","length","map","key","Header","render","variant","id","title"],"sources":["../../src/DataTable/DropdownFilters.jsx"],"sourcesContent":["import React, { useContext, useMemo } from 'react';\nimport DataTableContext from './DataTableContext';\nimport { DropdownButton } from '../Dropdown';\nimport useWindowSize from '../hooks/useWindowSizeHook';\nimport breakpoints from '../utils/breakpoints';\n\n/** The first filter will be as an input, additional filters will be available in a dropdown. */\nfunction DropdownFilters() {\n const { width } = useWindowSize();\n const {
|
|
1
|
+
{"version":3,"file":"DropdownFilters.js","names":["React","useContext","useMemo","useIntl","DataTableContext","DropdownButton","useWindowSize","breakpoints","messages","DropdownFilters","intl","width","columns","numBreakoutFilters","filtersTitle","breakoutFilters","otherFilters","availableFilters","filter","column","canFilter","small","minWidth","numberOfBreakoutFilters","boFilters","slice","dropdownFilters","dropdownTitle","formatMessage","filtersDropdownTitle","createElement","className","length","map","key","Header","render","variant","id","title"],"sources":["../../src/DataTable/DropdownFilters.jsx"],"sourcesContent":["import React, { useContext, useMemo } from 'react';\nimport { useIntl } from 'react-intl';\nimport DataTableContext from './DataTableContext';\nimport { DropdownButton } from '../Dropdown';\nimport useWindowSize from '../hooks/useWindowSizeHook';\nimport breakpoints from '../utils/breakpoints';\nimport messages from './messages';\n\n/** The first filter will be as an input, additional filters will be available in a dropdown. */\nfunction DropdownFilters() {\n const intl = useIntl();\n const { width } = useWindowSize();\n const {\n columns, numBreakoutFilters, filtersTitle,\n } = useContext(DataTableContext);\n\n const [breakoutFilters, otherFilters] = useMemo(() => {\n if (!columns) {\n return [[], []];\n }\n const availableFilters = columns.filter((column) => column.canFilter);\n if (width < breakpoints.small.minWidth) {\n return [[], availableFilters];\n }\n\n const numberOfBreakoutFilters = numBreakoutFilters || 1;\n const boFilters = availableFilters.slice(0, numberOfBreakoutFilters);\n const dropdownFilters = availableFilters.slice(numberOfBreakoutFilters);\n\n return [boFilters, dropdownFilters];\n }, [columns, width, numBreakoutFilters]);\n\n const dropdownTitle = filtersTitle || intl.formatMessage(messages.filtersDropdownTitle);\n\n return (\n <div className=\"pgn__data-table-filters\">\n {breakoutFilters.length > 0 && breakoutFilters.map((column) => (\n <div className=\"pgn__data-table-filters-breakout-filter\" key={column.Header}>\n {column.render('Filter')}\n </div>\n ))}\n {otherFilters.length > 0 && (\n <DropdownButton variant=\"outline-primary\" id=\"table-filters-dropdown\" title={dropdownTitle}>\n {otherFilters.map((column) => (\n <div\n key={column.Header}\n className=\"pgn__data-table-filters-dropdown-item\"\n >\n {column.render('Filter')}\n </div>\n ))}\n </DropdownButton>\n )}\n </div>\n );\n}\n\nexport default DropdownFilters;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAClD,SAASC,OAAO,QAAQ,YAAY;AACpC,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,cAAc,QAAQ,aAAa;AAC5C,OAAOC,aAAa,MAAM,4BAA4B;AACtD,OAAOC,WAAW,MAAM,sBAAsB;AAC9C,OAAOC,QAAQ,MAAM,YAAY;;AAEjC;AACA,SAASC,eAAeA,CAAA,EAAG;EACzB,MAAMC,IAAI,GAAGP,OAAO,CAAC,CAAC;EACtB,MAAM;IAAEQ;EAAM,CA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,KAAA,CAAA8B,aAAA,CAACzB,cAAc;IAACgC,OAAO,EAAC,iBAAiB;IAACC,EAAE,EAAC,wBAAwB;IAACC,KAAK,EAAEZ;EAAc,GACxFX,YAAY,CAACiB,GAAG,CAAEd,MAAM,iBACvBnB,KAAA,CAAA8B,aAAA;IACEI,GAAG,EAAEf,MAAM,CAACgB,MAAO;IACnBJ,SAAS,EAAC;EAAuC,GAEhDZ,MAAM,CAACiB,MAAM,CAAC,QAAQ,CACpB,CACN,CACa,CAEf,CAAC;AAEV;AAEA,eAAe3B,eAAe","ignoreList":[]}
|
package/dist/DataTable/index.js
CHANGED
|
@@ -57,6 +57,7 @@ function DataTable(_ref) {
|
|
|
57
57
|
EmptyTableComponent,
|
|
58
58
|
manualSelectColumn,
|
|
59
59
|
showFiltersInSidebar,
|
|
60
|
+
filtersTitle,
|
|
60
61
|
dataViewToggleOptions,
|
|
61
62
|
disableElevation,
|
|
62
63
|
isLoading,
|
|
@@ -220,13 +221,16 @@ function DataTable(_ref) {
|
|
|
220
221
|
manualSelectColumn,
|
|
221
222
|
maxSelectedRows,
|
|
222
223
|
onMaxSelectedRows,
|
|
224
|
+
filtersTitle,
|
|
223
225
|
...selectionProps,
|
|
224
226
|
...selectionActions,
|
|
225
227
|
...props
|
|
226
228
|
};
|
|
227
229
|
return /*#__PURE__*/React.createElement(DataTableContext.Provider, {
|
|
228
230
|
value: enhancedInstance
|
|
229
|
-
}, /*#__PURE__*/React.createElement(DataTableLayout,
|
|
231
|
+
}, /*#__PURE__*/React.createElement(DataTableLayout, {
|
|
232
|
+
filtersTitle: filtersTitle
|
|
233
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
230
234
|
className: classNames('pgn__data-table-wrapper', {
|
|
231
235
|
'hide-shadow': !!disableElevation
|
|
232
236
|
})
|
|
@@ -257,6 +261,7 @@ DataTable.defaultProps = {
|
|
|
257
261
|
FilterStatusComponent: FilterStatus,
|
|
258
262
|
RowStatusComponent: RowStatus,
|
|
259
263
|
showFiltersInSidebar: false,
|
|
264
|
+
filtersTitle: undefined,
|
|
260
265
|
dataViewToggleOptions: {
|
|
261
266
|
isDataViewToggleEnabled: false,
|
|
262
267
|
onDataViewToggle: () => {},
|
|
@@ -396,6 +401,8 @@ DataTable.propTypes = {
|
|
|
396
401
|
children: PropTypes.node,
|
|
397
402
|
/** If true filters will be shown on sidebar instead */
|
|
398
403
|
showFiltersInSidebar: PropTypes.bool,
|
|
404
|
+
/** Title of the filters section */
|
|
405
|
+
filtersTitle: PropTypes.string,
|
|
399
406
|
/** options for data view toggle */
|
|
400
407
|
dataViewToggleOptions: PropTypes.shape({
|
|
401
408
|
/** Whether to show a toggle button group which allows view switching between card and table views */
|