@react-ui-org/react-ui 0.45.0 → 0.46.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/CONTRIBUTING.md +7 -0
- package/dist/lib.development.js +113 -89
- package/dist/lib.js +1 -1
- package/package.json +4 -4
- package/src/lib/components/Badge/Badge.jsx +1 -4
- package/src/lib/components/Button/README.mdx +1 -1
- package/src/lib/components/ButtonGroup/ButtonGroup.jsx +30 -22
- package/src/lib/components/Card/CardBody.jsx +5 -11
- package/src/lib/components/Card/CardFooter.jsx +10 -5
- package/src/lib/components/CheckboxField/CheckboxField.jsx +9 -9
- package/src/lib/components/CheckboxField/CheckboxField.scss +1 -1
- package/src/lib/components/CheckboxField/README.mdx +1 -1
- package/src/lib/components/FileInputField/README.mdx +1 -1
- package/src/lib/components/FormLayout/FormLayout.jsx +11 -10
- package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +6 -1
- package/src/lib/components/FormLayout/README.mdx +7 -9
- package/src/lib/components/Grid/Grid.jsx +3 -2
- package/src/lib/components/Grid/GridSpan.jsx +3 -2
- package/src/lib/components/List/List.jsx +3 -2
- package/src/lib/components/List/ListItem.jsx +3 -2
- package/src/lib/components/Media/Media.jsx +12 -5
- package/src/lib/components/Media/MediaBody.jsx +18 -7
- package/src/lib/components/Media/MediaObject.jsx +18 -7
- package/src/lib/components/Modal/Modal.jsx +2 -1
- package/src/lib/components/Paper/Paper.jsx +1 -2
- package/src/lib/components/Radio/README.mdx +1 -1
- package/src/lib/components/Radio/Radio.scss +1 -1
- package/src/lib/components/ScrollView/README.mdx +3 -0
- package/src/lib/components/ScrollView/ScrollView.jsx +2 -1
- package/src/lib/components/SelectField/README.mdx +1 -1
- package/src/lib/components/Tabs/Tabs.jsx +1 -2
- package/src/lib/components/Text/README.mdx +1 -1
- package/src/lib/components/Text/Text.jsx +8 -2
- package/src/lib/components/Text/Text.scss +12 -2
- package/src/lib/components/Text/_helpers/getRootClampClassName.js +11 -0
- package/src/lib/components/TextArea/README.mdx +1 -1
- package/src/lib/components/TextArea/TextArea.jsx +4 -1
- package/src/lib/components/TextField/README.mdx +1 -1
- package/src/lib/components/TextLink/README.mdx +77 -0
- package/src/lib/components/{Link/Link.jsx → TextLink/TextLink.jsx} +11 -12
- package/src/lib/components/TextLink/TextLink.scss +11 -0
- package/src/lib/components/TextLink/_theme.scss +4 -0
- package/src/lib/components/TextLink/index.js +1 -0
- package/src/lib/components/Toggle/README.mdx +1 -1
- package/src/lib/components/Toggle/Toggle.jsx +9 -9
- package/src/lib/components/Toggle/Toggle.scss +1 -1
- package/src/lib/components/Toolbar/README.mdx +16 -0
- package/src/lib/components/Toolbar/Toolbar.jsx +18 -10
- package/src/lib/components/Toolbar/Toolbar.scss +13 -8
- package/src/lib/components/Toolbar/ToolbarGroup.jsx +13 -9
- package/src/lib/components/Toolbar/ToolbarItem.jsx +26 -7
- package/src/lib/components/_helpers/isChildrenEmpty.js +3 -0
- package/src/lib/index.js +1 -1
- package/src/lib/styles/tools/_reset.scss +4 -1
- package/src/lib/styles/tools/form-fields/_box-field-layout.scss +3 -3
- package/src/lib/styles/tools/form-fields/_inline-field-elements.scss +12 -1
- package/src/lib/styles/tools/form-fields/_inline-field-layout.scss +46 -5
- package/src/lib/theme.scss +6 -6
- package/src/lib/components/Link/Link.scss +0 -11
- package/src/lib/components/Link/README.mdx +0 -85
- package/src/lib/components/Link/_theme.scss +0 -4
- package/src/lib/components/Link/index.js +0 -1
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-ui-org/react-ui",
|
3
3
|
"description": "React UI is a themeable UI library for React apps.",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.46.0",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
7
7
|
"ui",
|
@@ -29,8 +29,8 @@
|
|
29
29
|
"url": "https://github.com/react-ui-org/react-ui"
|
30
30
|
},
|
31
31
|
"engines": {
|
32
|
-
"node": ">=14.
|
33
|
-
"npm": ">=
|
32
|
+
"node": ">=16.14.0 <17",
|
33
|
+
"npm": ">=8.3.0"
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
36
|
"normalize.css": "^8.0.1"
|
@@ -84,7 +84,7 @@
|
|
84
84
|
"sinon": "^12.0.1",
|
85
85
|
"style-loader": "^2.0.0",
|
86
86
|
"stylelint": "^14.2.0",
|
87
|
-
"stylelint-webpack-plugin": "^3.
|
87
|
+
"stylelint-webpack-plugin": "^2.3.2",
|
88
88
|
"webpack": "^4.46.0",
|
89
89
|
"webpack-cli": "^3.3.12",
|
90
90
|
"webpack-visualizer-plugin": "^0.1.11"
|
@@ -43,10 +43,7 @@ Badge.propTypes = {
|
|
43
43
|
/**
|
44
44
|
* Text to be displayed.
|
45
45
|
*/
|
46
|
-
label: PropTypes.
|
47
|
-
PropTypes.string,
|
48
|
-
PropTypes.number,
|
49
|
-
]).isRequired,
|
46
|
+
label: PropTypes.string.isRequired,
|
50
47
|
/**
|
51
48
|
* Visual priority to highlight or suppress the badge.
|
52
49
|
*/
|
@@ -399,7 +399,7 @@ animation is made.
|
|
399
399
|
|
400
400
|
In addition to the options below, you can specify [React synthetic events] or
|
401
401
|
any custom HTML attributes that do not interfere with the API, and they will be
|
402
|
-
passed to the
|
402
|
+
passed to the `<button>` HTML element. This enables making the component
|
403
403
|
interactive and helps improve its accessibility.
|
404
404
|
|
405
405
|
<Props table of={Button} />
|
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
4
|
import { classNames } from '../../utils/classNames';
|
5
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
5
6
|
import styles from './ButtonGroup.scss';
|
6
7
|
import { ButtonGroupContext } from './ButtonGroupContext';
|
7
8
|
|
@@ -12,30 +13,37 @@ export const ButtonGroup = ({
|
|
12
13
|
priority,
|
13
14
|
size,
|
14
15
|
...restProps
|
15
|
-
}) =>
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
priority,
|
29
|
-
size,
|
30
|
-
}}
|
16
|
+
}) => {
|
17
|
+
if (isChildrenEmpty(children)) {
|
18
|
+
return null;
|
19
|
+
}
|
20
|
+
|
21
|
+
return (
|
22
|
+
<div
|
23
|
+
className={classNames(
|
24
|
+
styles.root,
|
25
|
+
block && styles.isRootBlock,
|
26
|
+
)}
|
27
|
+
role="group"
|
28
|
+
{...restProps}
|
31
29
|
>
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
<ButtonGroupContext.Provider
|
31
|
+
value={{
|
32
|
+
block,
|
33
|
+
disabled,
|
34
|
+
priority,
|
35
|
+
size,
|
36
|
+
}}
|
37
|
+
>
|
38
|
+
{children}
|
39
|
+
</ButtonGroupContext.Provider>
|
40
|
+
</div>
|
41
|
+
);
|
42
|
+
};
|
36
43
|
|
37
44
|
ButtonGroup.defaultProps = {
|
38
45
|
block: false,
|
46
|
+
children: null,
|
39
47
|
disabled: false,
|
40
48
|
priority: 'filled',
|
41
49
|
size: 'medium',
|
@@ -47,9 +55,9 @@ ButtonGroup.propTypes = {
|
|
47
55
|
*/
|
48
56
|
block: PropTypes.bool,
|
49
57
|
/**
|
50
|
-
* Buttons to be grouped.
|
58
|
+
* Buttons to be grouped. If none are provided nothing is rendered.
|
51
59
|
*/
|
52
|
-
children: PropTypes.node
|
60
|
+
children: PropTypes.node,
|
53
61
|
/**
|
54
62
|
* If `true`, all buttons inside the group will be disabled.
|
55
63
|
*/
|
@@ -3,17 +3,11 @@ import React from 'react';
|
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
4
|
import styles from './Card.scss';
|
5
5
|
|
6
|
-
export const CardBody = (
|
7
|
-
|
8
|
-
children
|
9
|
-
|
10
|
-
|
11
|
-
return (
|
12
|
-
<div className={styles.body}>
|
13
|
-
{children}
|
14
|
-
</div>
|
15
|
-
);
|
16
|
-
};
|
6
|
+
export const CardBody = ({ children }) => (
|
7
|
+
<div className={styles.body}>
|
8
|
+
{children}
|
9
|
+
</div>
|
10
|
+
);
|
17
11
|
|
18
12
|
CardBody.propTypes = {
|
19
13
|
/**
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
4
5
|
import styles from './Card.scss';
|
5
6
|
|
6
|
-
export const CardFooter = (
|
7
|
-
|
8
|
-
|
9
|
-
}
|
7
|
+
export const CardFooter = ({ children }) => {
|
8
|
+
if (isChildrenEmpty(children)) {
|
9
|
+
return null;
|
10
|
+
}
|
10
11
|
|
11
12
|
return (
|
12
13
|
<div className={styles.footer}>
|
@@ -15,11 +16,15 @@ export const CardFooter = (props) => {
|
|
15
16
|
);
|
16
17
|
};
|
17
18
|
|
19
|
+
CardFooter.defaultProps = {
|
20
|
+
children: null,
|
21
|
+
};
|
22
|
+
|
18
23
|
CardFooter.propTypes = {
|
19
24
|
/**
|
20
25
|
* Card actions, usually buttons.
|
21
26
|
*/
|
22
|
-
children: PropTypes.node
|
27
|
+
children: PropTypes.node,
|
23
28
|
};
|
24
29
|
|
25
30
|
export const CardFooterWithContext = withProviderContext(CardFooter, 'CardFooter');
|
@@ -40,6 +40,15 @@ export const CheckboxField = ({
|
|
40
40
|
id={id && `${id}__label`}
|
41
41
|
>
|
42
42
|
<div className={styles.field}>
|
43
|
+
<div
|
44
|
+
className={classNames(
|
45
|
+
styles.label,
|
46
|
+
!isLabelVisible && styles.isLabelHidden,
|
47
|
+
)}
|
48
|
+
id={id && `${id}__labelText`}
|
49
|
+
>
|
50
|
+
{label}
|
51
|
+
</div>
|
43
52
|
<input
|
44
53
|
{...transferProps(restProps)}
|
45
54
|
checked={checked}
|
@@ -51,15 +60,6 @@ export const CheckboxField = ({
|
|
51
60
|
type="checkbox"
|
52
61
|
value={value}
|
53
62
|
/>
|
54
|
-
<div
|
55
|
-
className={classNames(
|
56
|
-
styles.label,
|
57
|
-
!isLabelVisible && styles.isLabelHidden,
|
58
|
-
)}
|
59
|
-
id={id && `${id}__labelText`}
|
60
|
-
>
|
61
|
-
{label}
|
62
|
-
</div>
|
63
63
|
</div>
|
64
64
|
{helpText && (
|
65
65
|
<div
|
@@ -185,7 +185,7 @@ Disabled state makes the input unavailable.
|
|
185
185
|
|
186
186
|
In addition to the options below, you can specify [React synthetic events] or
|
187
187
|
any custom HTML attributes that do not interfere with the API, and they will be
|
188
|
-
passed to the
|
188
|
+
passed to the `<input>` HTML element. This enables making the component
|
189
189
|
interactive and helps improve its accessibility.
|
190
190
|
|
191
191
|
<Props table of={CheckboxField} />
|
@@ -191,7 +191,7 @@ It's possible to disable the whole input.
|
|
191
191
|
|
192
192
|
In addition to the options below, you can specify [React synthetic events] or
|
193
193
|
any custom HTML attributes that do not interfere with the API, and they will be
|
194
|
-
passed to the
|
194
|
+
passed to the `<input>` HTML element. This enables making the component
|
195
195
|
interactive and helps improve its [accessibility](#forwarding-html-attributes).
|
196
196
|
|
197
197
|
<Props table of={FileInputField} />
|
@@ -2,21 +2,20 @@ import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
4
|
import { classNames } from '../../utils/classNames';
|
5
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
5
6
|
import { FormLayoutContext } from './FormLayoutContext';
|
6
7
|
import styles from './FormLayout.scss';
|
7
8
|
|
8
9
|
const PREDEFINED_LABEL_WIDTH_VALUES = ['auto', 'default', 'limited'];
|
9
10
|
|
10
|
-
export const FormLayout = (
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
if (!children) {
|
11
|
+
export const FormLayout = ({
|
12
|
+
autoWidth,
|
13
|
+
children,
|
14
|
+
fieldLayout,
|
15
|
+
id,
|
16
|
+
labelWidth,
|
17
|
+
}) => {
|
18
|
+
if (isChildrenEmpty(children)) {
|
20
19
|
return null;
|
21
20
|
}
|
22
21
|
|
@@ -89,6 +88,8 @@ FormLayout.propTypes = {
|
|
89
88
|
* * `TextArea`
|
90
89
|
* * `TextField`
|
91
90
|
* * `Toggle`
|
91
|
+
*
|
92
|
+
* If none are provided nothing is rendered.
|
92
93
|
*/
|
93
94
|
children: PropTypes.node,
|
94
95
|
/**
|
@@ -4,6 +4,7 @@ import { withProviderContext } from '../../provider';
|
|
4
4
|
import { classNames } from '../../utils/classNames';
|
5
5
|
import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
|
6
6
|
import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
|
7
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
7
8
|
import { FormLayoutContext } from './FormLayoutContext';
|
8
9
|
import styles from './FormLayoutCustomField.scss';
|
9
10
|
|
@@ -47,6 +48,10 @@ export const FormLayoutCustomField = ({
|
|
47
48
|
}) => {
|
48
49
|
const context = useContext(FormLayoutContext);
|
49
50
|
|
51
|
+
if (isChildrenEmpty(children)) {
|
52
|
+
return null;
|
53
|
+
}
|
54
|
+
|
50
55
|
return (
|
51
56
|
<div
|
52
57
|
id={id}
|
@@ -85,7 +90,7 @@ FormLayoutCustomField.defaultProps = {
|
|
85
90
|
|
86
91
|
FormLayoutCustomField.propTypes = {
|
87
92
|
/**
|
88
|
-
* Custom HTML or React component(s).
|
93
|
+
* Custom HTML or React component(s). If none are provided nothing is rendered.
|
89
94
|
*/
|
90
95
|
children: PropTypes.node,
|
91
96
|
/**
|
@@ -200,21 +200,18 @@ with CSS custom properties.
|
|
200
200
|
|
201
201
|
### Limitations
|
202
202
|
|
203
|
+
#### Label Position
|
204
|
+
|
205
|
+
Label position of inline form fields (CheckboxField, Toggle) is ignored in
|
206
|
+
horizontal FormLayout.
|
207
|
+
|
203
208
|
#### Modals
|
204
209
|
|
205
210
|
Please note the `auto` and `limited` label width options may not function
|
206
211
|
correctly in combination with other auto layout mechanisms, e.g. the auto-width
|
207
|
-
[Modal](/components/modal). It's just too much of magic that
|
212
|
+
[Modal](/components/modal). It's just too much of magic that does not quite
|
208
213
|
work together yet 🎩.
|
209
214
|
|
210
|
-
#### Inline Form Fields
|
211
|
-
|
212
|
-
CheckboxField and Toggle always display their labels after inputs inside
|
213
|
-
FormLayout. In other words, their labels never appear in a column with other
|
214
|
-
fields' labels even when they have `labelPosition` set to `before`. This feature
|
215
|
-
[will be implemented][rui-232] once [CSS subgrid][subgrid] is fully supported in
|
216
|
-
[browsers that we support](/getting-started/browsers-and-devices).
|
217
|
-
|
218
215
|
## Custom Fields
|
219
216
|
|
220
217
|
You can even place any content you need into the FormLayout — just wrap it with
|
@@ -402,6 +399,7 @@ This is a demo of all components supported by FormLayout.
|
|
402
399
|
</FormLayoutCustomField>
|
403
400
|
<CheckboxField
|
404
401
|
checked={isDeliveryAddress}
|
402
|
+
helpText="Uncheck if you wish to deliver to a different address."
|
405
403
|
label="This is my delivery address"
|
406
404
|
onChange={() => setIsDeliveryAddress(!isDeliveryAddress)}
|
407
405
|
/>
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
4
5
|
import { generateResponsiveCustomProperties } from './_helpers/generateResponsiveCustomProperties';
|
5
6
|
import styles from './Grid.scss';
|
6
7
|
|
@@ -19,7 +20,7 @@ export const Grid = ({
|
|
19
20
|
tag: Tag,
|
20
21
|
...other
|
21
22
|
}) => {
|
22
|
-
if (
|
23
|
+
if (isChildrenEmpty(children)) {
|
23
24
|
return null;
|
24
25
|
}
|
25
26
|
|
@@ -113,7 +114,7 @@ Grid.propTypes = {
|
|
113
114
|
}),
|
114
115
|
]),
|
115
116
|
/**
|
116
|
-
* Items to be aligned in the grid.
|
117
|
+
* Items to be aligned in the grid. If none are provided nothing is rendered.
|
117
118
|
*/
|
118
119
|
children: PropTypes.node,
|
119
120
|
/**
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
4
5
|
import { generateResponsiveCustomProperties } from './_helpers/generateResponsiveCustomProperties';
|
5
6
|
import styles from './Grid.scss';
|
6
7
|
|
@@ -12,7 +13,7 @@ export const GridSpan = ({
|
|
12
13
|
tag: Tag,
|
13
14
|
...other
|
14
15
|
}) => {
|
15
|
-
if (
|
16
|
+
if (isChildrenEmpty(children)) {
|
16
17
|
return null;
|
17
18
|
}
|
18
19
|
|
@@ -44,7 +45,7 @@ GridSpan.defaultProps = {
|
|
44
45
|
|
45
46
|
GridSpan.propTypes = {
|
46
47
|
/**
|
47
|
-
* Items to be aligned in the grid.
|
48
|
+
* Items to be aligned in the grid. If none are provided nothing is rendered.
|
48
49
|
*/
|
49
50
|
children: PropTypes.node,
|
50
51
|
/**
|
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
4
|
import { classNames } from '../../utils/classNames';
|
5
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
5
6
|
import styles from './List.scss';
|
6
7
|
|
7
8
|
export const List = ({
|
@@ -9,7 +10,7 @@ export const List = ({
|
|
9
10
|
autoWidth,
|
10
11
|
children,
|
11
12
|
}) => {
|
12
|
-
if (
|
13
|
+
if (isChildrenEmpty(children)) {
|
13
14
|
return null;
|
14
15
|
}
|
15
16
|
|
@@ -62,7 +63,7 @@ List.propTypes = {
|
|
62
63
|
*/
|
63
64
|
autoWidth: PropTypes.bool,
|
64
65
|
/**
|
65
|
-
* Individual ListItems.
|
66
|
+
* Individual ListItems. If none are provided nothing is rendered.
|
66
67
|
*/
|
67
68
|
children: PropTypes.node,
|
68
69
|
};
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
4
5
|
import styles from './List.scss';
|
5
6
|
|
6
7
|
export const ListItem = ({ children }) => {
|
7
|
-
if (
|
8
|
+
if (isChildrenEmpty(children)) {
|
8
9
|
return null;
|
9
10
|
}
|
10
11
|
|
@@ -21,7 +22,7 @@ ListItem.defaultProps = {
|
|
21
22
|
|
22
23
|
ListItem.propTypes = {
|
23
24
|
/**
|
24
|
-
* Content of the list item.
|
25
|
+
* Content of the list item. If none are provided nothing is rendered.
|
25
26
|
*/
|
26
27
|
children: PropTypes.node,
|
27
28
|
};
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
4
5
|
import styles from './Media.scss';
|
5
6
|
|
6
|
-
export const Media = (
|
7
|
-
|
8
|
-
|
9
|
-
}
|
7
|
+
export const Media = ({ children }) => {
|
8
|
+
if (isChildrenEmpty(children)) {
|
9
|
+
return null;
|
10
|
+
}
|
10
11
|
|
11
12
|
return (
|
12
13
|
<div className={styles.media}>
|
@@ -15,13 +16,19 @@ export const Media = (props) => {
|
|
15
16
|
);
|
16
17
|
};
|
17
18
|
|
19
|
+
Media.defaultProps = {
|
20
|
+
children: null,
|
21
|
+
};
|
22
|
+
|
18
23
|
Media.propTypes = {
|
19
24
|
/**
|
20
25
|
* Nested elements. Supported types are:
|
21
26
|
* * `MediaBody`
|
22
27
|
* * `MediaObject`
|
28
|
+
*
|
29
|
+
* If none are provided nothing is rendered.
|
23
30
|
*/
|
24
|
-
children: PropTypes.node
|
31
|
+
children: PropTypes.node,
|
25
32
|
};
|
26
33
|
|
27
34
|
export const MediaWithContext = withProviderContext(Media, 'Media');
|
@@ -1,19 +1,30 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
4
5
|
import styles from './Media.scss';
|
5
6
|
|
6
|
-
export const MediaBody = ({ children }) =>
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
export const MediaBody = ({ children }) => {
|
8
|
+
if (isChildrenEmpty(children)) {
|
9
|
+
return null;
|
10
|
+
}
|
11
|
+
|
12
|
+
return (
|
13
|
+
<div className={styles.body}>
|
14
|
+
{children}
|
15
|
+
</div>
|
16
|
+
);
|
17
|
+
};
|
18
|
+
|
19
|
+
MediaBody.defaultProps = {
|
20
|
+
children: null,
|
21
|
+
};
|
11
22
|
|
12
23
|
MediaBody.propTypes = {
|
13
24
|
/**
|
14
|
-
* Content of the media layout.
|
25
|
+
* Content of the media layout. If none are provided nothing is rendered.
|
15
26
|
*/
|
16
|
-
children: PropTypes.node
|
27
|
+
children: PropTypes.node,
|
17
28
|
};
|
18
29
|
|
19
30
|
export const MediaBodyWithContext = withProviderContext(MediaBody, 'MediaBody');
|
@@ -1,19 +1,30 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
4
5
|
import styles from './Media.scss';
|
5
6
|
|
6
|
-
export const MediaObject = ({ children }) =>
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
export const MediaObject = ({ children }) => {
|
8
|
+
if (isChildrenEmpty(children)) {
|
9
|
+
return null;
|
10
|
+
}
|
11
|
+
|
12
|
+
return (
|
13
|
+
<div className={styles.object}>
|
14
|
+
{children}
|
15
|
+
</div>
|
16
|
+
);
|
17
|
+
};
|
18
|
+
|
19
|
+
MediaObject.defaultProps = {
|
20
|
+
children: null,
|
21
|
+
};
|
11
22
|
|
12
23
|
MediaObject.propTypes = {
|
13
24
|
/**
|
14
|
-
* Accompanying media object for the Media layout, eg. an image.
|
25
|
+
* Accompanying media object for the Media layout, eg. an image. If none are provided nothing is rendered.
|
15
26
|
*/
|
16
|
-
children: PropTypes.node
|
27
|
+
children: PropTypes.node,
|
17
28
|
};
|
18
29
|
|
19
30
|
export const MediaObjectWithContext = withProviderContext(MediaObject, 'MediaObject');
|
@@ -235,6 +235,7 @@ export class Modal extends React.Component {
|
|
235
235
|
Modal.defaultProps = {
|
236
236
|
actions: [],
|
237
237
|
autoFocus: true,
|
238
|
+
children: null,
|
238
239
|
id: undefined,
|
239
240
|
onClose: null,
|
240
241
|
portalId: null,
|
@@ -266,7 +267,7 @@ Modal.propTypes = {
|
|
266
267
|
/**
|
267
268
|
* Content of the modal.
|
268
269
|
*/
|
269
|
-
children: PropTypes.node
|
270
|
+
children: PropTypes.node,
|
270
271
|
/**
|
271
272
|
* ID of the root HTML element. It also serves as a base for nested elements:
|
272
273
|
* * `<ID>__content`
|
@@ -23,7 +23,6 @@ export const Paper = ({
|
|
23
23
|
);
|
24
24
|
|
25
25
|
Paper.defaultProps = {
|
26
|
-
children: null,
|
27
26
|
id: undefined,
|
28
27
|
muted: false,
|
29
28
|
raised: false,
|
@@ -33,7 +32,7 @@ Paper.propTypes = {
|
|
33
32
|
/**
|
34
33
|
* Content to be placed onto Paper.
|
35
34
|
*/
|
36
|
-
children: PropTypes.node,
|
35
|
+
children: PropTypes.node.isRequired,
|
37
36
|
/**
|
38
37
|
* ID of the root HTML element.
|
39
38
|
*/
|
@@ -287,7 +287,7 @@ It's possible to disable just some options or the whole set.
|
|
287
287
|
|
288
288
|
In addition to the options below, you can specify [React synthetic events] or
|
289
289
|
any custom HTML attributes that do not interfere with the API, and they will be
|
290
|
-
passed to the
|
290
|
+
passed to the `<input>` HTML element. This enables making the component
|
291
291
|
interactive and helps improve its accessibility.
|
292
292
|
|
293
293
|
<Props table of={Radio} />
|
@@ -272,6 +272,7 @@ ScrollView.defaultProps = {
|
|
272
272
|
arrowsColor: undefined,
|
273
273
|
arrowsScrollStep: 200,
|
274
274
|
autoScroll: 'off',
|
275
|
+
children: null,
|
275
276
|
customEndShadowStyle: {},
|
276
277
|
customNextArrow: null,
|
277
278
|
customPrevArrow: null,
|
@@ -316,7 +317,7 @@ ScrollView.propTypes = {
|
|
316
317
|
/**
|
317
318
|
* Content to be scrollable.
|
318
319
|
*/
|
319
|
-
children: PropTypes.node
|
320
|
+
children: PropTypes.node,
|
320
321
|
/**
|
321
322
|
* Custom CSS to replace the default end scrolling shadow.
|
322
323
|
*/
|
@@ -598,7 +598,7 @@ It's possible to disable just some options or the whole input.
|
|
598
598
|
|
599
599
|
In addition to the options below, you can specify [React synthetic events] or
|
600
600
|
any custom HTML attributes that do not interfere with the API, and they will be
|
601
|
-
passed to the
|
601
|
+
passed to the `<select>` HTML element. This enables making the component
|
602
602
|
interactive and helps improve its accessibility.
|
603
603
|
|
604
604
|
<Props table of={SelectField} />
|