@react-ui-org/react-ui 0.47.0 → 0.48.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. package/dist/lib.development.js +330 -54
  2. package/dist/lib.js +1 -1
  3. package/package.json +1 -1
  4. package/src/lib/components/Alert/README.mdx +4 -2
  5. package/src/lib/components/Alert/index.js +1 -1
  6. package/src/lib/components/Badge/README.mdx +1 -1
  7. package/src/lib/components/Badge/index.js +1 -1
  8. package/src/lib/components/Button/Button.jsx +31 -31
  9. package/src/lib/components/Button/README.mdx +4 -2
  10. package/src/lib/components/Button/index.js +1 -1
  11. package/src/lib/components/ButtonGroup/ButtonGroup.jsx +2 -1
  12. package/src/lib/components/ButtonGroup/README.mdx +4 -2
  13. package/src/lib/components/Card/README.mdx +7 -5
  14. package/src/lib/components/CheckboxField/CheckboxField.jsx +27 -28
  15. package/src/lib/components/CheckboxField/README.mdx +1 -1
  16. package/src/lib/components/CheckboxField/index.js +1 -1
  17. package/src/lib/components/FileInputField/FileInputField.jsx +27 -27
  18. package/src/lib/components/FileInputField/README.mdx +1 -1
  19. package/src/lib/components/FileInputField/index.js +1 -1
  20. package/src/lib/components/FormLayout/README.mdx +15 -13
  21. package/src/lib/components/Grid/Grid.jsx +31 -28
  22. package/src/lib/components/Grid/Grid.scss +10 -15
  23. package/src/lib/components/Grid/GridSpan.jsx +5 -4
  24. package/src/lib/components/Grid/README.mdx +34 -36
  25. package/src/lib/components/Grid/_helpers/generateResponsiveCustomProperties.js +11 -3
  26. package/src/lib/components/Grid/_settings.scss +18 -0
  27. package/src/lib/components/Grid/_tools.scss +5 -5
  28. package/src/lib/components/Modal/Modal.jsx +147 -250
  29. package/src/lib/components/Modal/Modal.scss +7 -55
  30. package/src/lib/components/Modal/ModalBody.jsx +64 -0
  31. package/src/lib/components/Modal/ModalBody.scss +18 -0
  32. package/src/lib/components/Modal/ModalCloseButton.jsx +61 -0
  33. package/src/lib/components/Modal/ModalCloseButton.scss +18 -0
  34. package/src/lib/components/Modal/ModalContent.jsx +43 -0
  35. package/src/lib/components/Modal/ModalContent.scss +5 -0
  36. package/src/lib/components/Modal/ModalFooter.jsx +46 -0
  37. package/src/lib/components/Modal/ModalFooter.scss +35 -0
  38. package/src/lib/components/Modal/ModalHeader.jsx +48 -0
  39. package/src/lib/components/Modal/ModalHeader.scss +30 -0
  40. package/src/lib/components/Modal/ModalTitle.jsx +45 -0
  41. package/src/lib/components/Modal/ModalTitle.scss +10 -0
  42. package/src/lib/components/Modal/README.mdx +842 -197
  43. package/src/lib/components/Modal/_helpers/getJustifyClassName.js +19 -0
  44. package/src/lib/components/Modal/_helpers/getScrollingClassName.js +11 -0
  45. package/src/lib/components/Modal/_settings.scss +1 -5
  46. package/src/lib/components/Modal/_theme.scss +6 -0
  47. package/src/lib/components/Modal/index.js +7 -1
  48. package/src/lib/components/Paper/README.mdx +1 -1
  49. package/src/lib/components/Paper/index.js +1 -1
  50. package/src/lib/components/Popover/Popover.jsx +24 -24
  51. package/src/lib/components/Popover/Popover.scss +7 -6
  52. package/src/lib/components/Popover/PopoverWrapper.jsx +5 -5
  53. package/src/lib/components/Popover/PopoverWrapper.scss +3 -0
  54. package/src/lib/components/Popover/README.mdx +13 -11
  55. package/src/lib/components/Popover/_theme.scss +1 -1
  56. package/src/lib/components/Radio/README.mdx +1 -1
  57. package/src/lib/components/Radio/Radio.jsx +37 -27
  58. package/src/lib/components/Radio/index.js +1 -1
  59. package/src/lib/components/ScrollView/README.mdx +146 -84
  60. package/src/lib/components/ScrollView/ScrollView.jsx +104 -113
  61. package/src/lib/components/ScrollView/ScrollView.scss +18 -16
  62. package/src/lib/components/ScrollView/index.js +1 -1
  63. package/src/lib/components/SelectField/README.mdx +66 -2
  64. package/src/lib/components/SelectField/SelectField.jsx +93 -49
  65. package/src/lib/components/SelectField/_components/Option/Option.jsx +46 -0
  66. package/src/lib/components/SelectField/_components/Option/index.js +1 -0
  67. package/src/lib/components/SelectField/index.js +1 -1
  68. package/src/lib/components/Table/README.mdx +4 -2
  69. package/src/lib/components/Table/Table.jsx +1 -1
  70. package/src/lib/components/Table/index.js +1 -1
  71. package/src/lib/components/Tabs/README.mdx +5 -3
  72. package/src/lib/components/Tabs/TabsItem.scss +1 -2
  73. package/src/lib/components/Text/README.mdx +9 -7
  74. package/src/lib/components/Text/index.js +1 -1
  75. package/src/lib/components/TextArea/README.mdx +1 -1
  76. package/src/lib/components/TextArea/TextArea.jsx +33 -33
  77. package/src/lib/components/TextArea/index.js +1 -1
  78. package/src/lib/components/TextField/README.mdx +3 -3
  79. package/src/lib/components/TextField/TextField.jsx +33 -34
  80. package/src/lib/components/TextField/index.js +1 -1
  81. package/src/lib/components/TextLink/README.mdx +1 -1
  82. package/src/lib/components/TextLink/index.js +1 -1
  83. package/src/lib/components/Toggle/README.mdx +1 -1
  84. package/src/lib/components/Toggle/Toggle.jsx +28 -28
  85. package/src/lib/components/Toggle/index.js +1 -1
  86. package/src/lib/components/Toolbar/README.mdx +8 -6
  87. package/src/lib/components/_helpers/transferProps.js +1 -1
  88. package/src/lib/index.js +24 -16
  89. package/src/lib/provider/withGlobalProps.jsx +20 -3
  90. package/src/lib/theme.scss +18 -26
  91. package/src/lib/translations/en.js +1 -1
  92. package/src/lib/components/Grid/_theme.scss +0 -11
  93. package/src/lib/components/ScrollView/_theme.scss +0 -2
  94. package/src/lib/components/withForwardedRef.jsx +0 -11
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.47.0",
4
+ "version": "0.48.0",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",
@@ -12,8 +12,10 @@ import {
12
12
  } from 'docz'
13
13
  import Icon from '../../../docs/_components/Icon'
14
14
  import Placeholder from '../../../docs/_components/Placeholder'
15
- import Button from '../Button'
16
- import { Alert } from './Alert'
15
+ import {
16
+ Button,
17
+ Alert,
18
+ } from '../..'
17
19
 
18
20
  Alert presents feedback or important information to users.
19
21
 
@@ -1 +1 @@
1
- export { default } from './Alert';
1
+ export { default as Alert } from './Alert';
@@ -13,7 +13,7 @@ import {
13
13
  Props,
14
14
  } from 'docz'
15
15
  import Placeholder from '../../../docs/_components/Placeholder'
16
- import { Badge } from './Badge'
16
+ import { Badge } from '../..'
17
17
 
18
18
  ## Basic Usage
19
19
 
@@ -1 +1 @@
1
- export { default } from './Badge';
1
+ export { default as Badge } from './Badge';
@@ -6,30 +6,30 @@ import { getRootColorClassName } from '../_helpers/getRootColorClassName';
6
6
  import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
7
7
  import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
8
8
  import { transferProps } from '../_helpers/transferProps';
9
- import withForwardedRef from '../withForwardedRef';
10
9
  import { ButtonGroupContext } from '../ButtonGroup';
11
10
  import getRootLabelVisibilityClassName from './helpers/getRootLabelVisibilityClassName';
12
11
  import getRootPriorityClassName from './helpers/getRootPriorityClassName';
13
12
  import styles from './Button.scss';
14
13
 
15
- export const Button = ({
16
- afterLabel,
17
- beforeLabel,
18
- block,
19
- disabled,
20
- endCorner,
21
- feedbackIcon,
22
- forwardedRef,
23
- id,
24
- label,
25
- labelVisibility,
26
- priority,
27
- size,
28
- startCorner,
29
- type,
30
- color,
31
- ...restProps
32
- }) => {
14
+ export const Button = React.forwardRef((props, ref) => {
15
+ const {
16
+ afterLabel,
17
+ beforeLabel,
18
+ block,
19
+ disabled,
20
+ endCorner,
21
+ feedbackIcon,
22
+ id,
23
+ label,
24
+ labelVisibility,
25
+ priority,
26
+ size,
27
+ startCorner,
28
+ type,
29
+ color,
30
+ ...restProps
31
+ } = props;
32
+
33
33
  const context = useContext(ButtonGroupContext);
34
34
 
35
35
  return (
@@ -55,7 +55,7 @@ export const Button = ({
55
55
  )}
56
56
  disabled={resolveContextOrProp(context && context.disabled, disabled) || !!feedbackIcon}
57
57
  id={id}
58
- ref={forwardedRef}
58
+ ref={ref}
59
59
  type={type}
60
60
  >
61
61
  {startCorner && (
@@ -92,7 +92,7 @@ export const Button = ({
92
92
  </button>
93
93
  /* eslint-enable react/button-has-type */
94
94
  );
95
- };
95
+ });
96
96
 
97
97
  Button.defaultProps = {
98
98
  afterLabel: null,
@@ -102,10 +102,10 @@ Button.defaultProps = {
102
102
  disabled: false,
103
103
  endCorner: null,
104
104
  feedbackIcon: null,
105
- forwardedRef: undefined,
106
105
  id: undefined,
107
106
  labelVisibility: 'xs',
108
107
  priority: 'filled',
108
+ ref: undefined,
109
109
  size: 'medium',
110
110
  startCorner: null,
111
111
  type: 'button',
@@ -147,14 +147,6 @@ Button.propTypes = {
147
147
  * button is in feedback state.
148
148
  */
149
149
  feedbackIcon: PropTypes.node,
150
- /**
151
- * Reference forwarded to the `button` element.
152
- */
153
- forwardedRef: PropTypes.oneOfType([
154
- PropTypes.func,
155
- // eslint-disable-next-line react/forbid-prop-types
156
- PropTypes.shape({ current: PropTypes.any }),
157
- ]),
158
150
  /**
159
151
  * ID of the root HTML element.
160
152
  *
@@ -177,6 +169,14 @@ Button.propTypes = {
177
169
  * as the value is inherited in such case.
178
170
  */
179
171
  priority: PropTypes.oneOf(['filled', 'outline', 'flat']),
172
+ /**
173
+ * Reference forwarded to the `button` element.
174
+ */
175
+ ref: PropTypes.oneOfType([
176
+ PropTypes.func,
177
+ // eslint-disable-next-line react/forbid-prop-types
178
+ PropTypes.shape({ current: PropTypes.any }),
179
+ ]),
180
180
  /**
181
181
  * Size of the button.
182
182
  *
@@ -194,6 +194,6 @@ Button.propTypes = {
194
194
  type: PropTypes.oneOf(['button', 'submit']),
195
195
  };
196
196
 
197
- export const ButtonWithGlobalProps = withForwardedRef(withGlobalProps(Button, 'Button'));
197
+ export const ButtonWithGlobalProps = withGlobalProps(Button, 'Button');
198
198
 
199
199
  export default ButtonWithGlobalProps;
@@ -12,8 +12,10 @@ import {
12
12
  } from 'docz'
13
13
  import Icon from '../../../docs/_components/Icon'
14
14
  import Placeholder from '../../../docs/_components/Placeholder'
15
- import Badge from '../Badge'
16
- import { Button } from './Button'
15
+ import {
16
+ Badge,
17
+ Button,
18
+ } from '../..'
17
19
 
18
20
  Buttons allow users to take actions.
19
21
 
@@ -1 +1 @@
1
- export { default } from './Button';
1
+ export { default as Button } from './Button';
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { withGlobalProps } from '../../provider';
4
4
  import { classNames } from '../../utils/classNames';
5
5
  import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
6
+ import { transferProps } from '../_helpers/transferProps';
6
7
  import styles from './ButtonGroup.scss';
7
8
  import { ButtonGroupContext } from './ButtonGroupContext';
8
9
 
@@ -21,13 +22,13 @@ export const ButtonGroup = ({
21
22
 
22
23
  return (
23
24
  <div
25
+ {...transferProps(restProps)}
24
26
  className={classNames(
25
27
  styles.root,
26
28
  block && styles.isRootBlock,
27
29
  )}
28
30
  id={id}
29
31
  role="group"
30
- {...restProps}
31
32
  >
32
33
  <ButtonGroupContext.Provider
33
34
  value={{
@@ -13,8 +13,10 @@ import {
13
13
  Props,
14
14
  } from 'docz'
15
15
  import Icon from '../../../docs/_components/Icon'
16
- import Button from '../Button'
17
- import { ButtonGroup } from './ButtonGroup'
16
+ import {
17
+ Button,
18
+ ButtonGroup,
19
+ } from '../..'
18
20
 
19
21
  ## Basic Usage
20
22
 
@@ -10,11 +10,13 @@ import {
10
10
  Playground,
11
11
  Props,
12
12
  } from 'docz'
13
- import Button from '../Button'
14
- import ScrollView from '../ScrollView'
15
- import { Card } from './Card'
16
- import { CardBody } from './CardBody'
17
- import { CardFooter } from './CardFooter'
13
+ import {
14
+ Button,
15
+ ScrollView,
16
+ Card,
17
+ CardBody,
18
+ CardFooter,
19
+ } from '../..'
18
20
 
19
21
  Cards contain content and actions about a single subject.
20
22
 
@@ -5,24 +5,23 @@ import { classNames } from '../../utils/classNames';
5
5
  import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
6
6
  import { transferProps } from '../_helpers/transferProps';
7
7
  import { FormLayoutContext } from '../FormLayout';
8
- import withForwardedRef from '../withForwardedRef';
9
8
  import styles from './CheckboxField.scss';
10
9
 
11
- export const CheckboxField = ({
12
- checked,
13
- disabled,
14
- forwardedRef,
15
- helpText,
16
- id,
17
- isLabelVisible,
18
- label,
19
- labelPosition,
20
- required,
21
- validationState,
22
- validationText,
23
- value,
24
- ...restProps
25
- }) => {
10
+ export const CheckboxField = React.forwardRef((props, ref) => {
11
+ const {
12
+ checked,
13
+ disabled,
14
+ helpText,
15
+ id,
16
+ isLabelVisible,
17
+ label,
18
+ labelPosition,
19
+ required,
20
+ validationState,
21
+ validationText,
22
+ value,
23
+ ...restProps
24
+ } = props;
26
25
  const context = useContext(FormLayoutContext);
27
26
 
28
27
  return (
@@ -55,7 +54,7 @@ export const CheckboxField = ({
55
54
  className={styles.input}
56
55
  disabled={disabled}
57
56
  id={id}
58
- ref={forwardedRef}
57
+ ref={ref}
59
58
  required={required}
60
59
  type="checkbox"
61
60
  value={value}
@@ -79,16 +78,16 @@ export const CheckboxField = ({
79
78
  )}
80
79
  </label>
81
80
  );
82
- };
81
+ });
83
82
 
84
83
  CheckboxField.defaultProps = {
85
84
  checked: undefined,
86
85
  disabled: false,
87
- forwardedRef: undefined,
88
86
  helpText: null,
89
87
  id: undefined,
90
88
  isLabelVisible: true,
91
89
  labelPosition: 'after',
90
+ ref: undefined,
92
91
  required: false,
93
92
  validationState: null,
94
93
  validationText: null,
@@ -104,14 +103,6 @@ CheckboxField.propTypes = {
104
103
  * If `true`, the input will be disabled.
105
104
  */
106
105
  disabled: PropTypes.bool,
107
- /**
108
- * Reference forwarded to the `input` element.
109
- */
110
- forwardedRef: PropTypes.oneOfType([
111
- PropTypes.func,
112
- // eslint-disable-next-line react/forbid-prop-types
113
- PropTypes.shape({ current: PropTypes.any }),
114
- ]),
115
106
  /**
116
107
  * Optional help text.
117
108
  */
@@ -139,6 +130,14 @@ CheckboxField.propTypes = {
139
130
  * Placement of the label relative to the input.
140
131
  */
141
132
  labelPosition: PropTypes.oneOf(['before', 'after']),
133
+ /**
134
+ * Reference forwarded to the `input` element.
135
+ */
136
+ ref: PropTypes.oneOfType([
137
+ PropTypes.func,
138
+ // eslint-disable-next-line react/forbid-prop-types
139
+ PropTypes.shape({ current: PropTypes.any }),
140
+ ]),
142
141
  /**
143
142
  * If `true`, the input will be required.
144
143
  */
@@ -160,6 +159,6 @@ CheckboxField.propTypes = {
160
159
  ]),
161
160
  };
162
161
 
163
- export const CheckboxFieldWithGlobalProps = withForwardedRef(withGlobalProps(CheckboxField, 'CheckboxField'));
162
+ export const CheckboxFieldWithGlobalProps = withGlobalProps(CheckboxField, 'CheckboxField');
164
163
 
165
164
  export default CheckboxFieldWithGlobalProps;
@@ -12,7 +12,7 @@ import {
12
12
  Playground,
13
13
  Props,
14
14
  } from 'docz'
15
- import { CheckboxField } from './CheckboxField'
15
+ import { CheckboxField } from '../..'
16
16
 
17
17
  ## Basic Usage
18
18
 
@@ -1 +1 @@
1
- export { default } from './CheckboxField';
1
+ export { default as CheckboxField } from './CheckboxField';
@@ -6,23 +6,23 @@ import { getRootValidationStateClassName } from '../_helpers/getRootValidationSt
6
6
  import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
7
7
  import { transferProps } from '../_helpers/transferProps';
8
8
  import { FormLayoutContext } from '../FormLayout';
9
- import withForwardedRef from '../withForwardedRef';
10
9
  import styles from './FileInputField.scss';
11
10
 
12
- export const FileInputField = ({
13
- disabled,
14
- forwardedRef,
15
- fullWidth,
16
- helpText,
17
- id,
18
- isLabelVisible,
19
- label,
20
- layout,
21
- required,
22
- validationState,
23
- validationText,
24
- ...restProps
25
- }) => {
11
+ export const FileInputField = React.forwardRef((props, ref) => {
12
+ const {
13
+ disabled,
14
+ fullWidth,
15
+ helpText,
16
+ id,
17
+ isLabelVisible,
18
+ label,
19
+ layout,
20
+ required,
21
+ validationState,
22
+ validationText,
23
+ ...restProps
24
+ } = props;
25
+
26
26
  const context = useContext(FormLayoutContext);
27
27
 
28
28
  return (
@@ -57,7 +57,7 @@ export const FileInputField = ({
57
57
  className={styles.input}
58
58
  disabled={disabled}
59
59
  id={id}
60
- ref={forwardedRef}
60
+ ref={ref}
61
61
  required={required}
62
62
  type="file"
63
63
  />
@@ -81,16 +81,16 @@ export const FileInputField = ({
81
81
  </div>
82
82
  </label>
83
83
  );
84
- };
84
+ });
85
85
 
86
86
  FileInputField.defaultProps = {
87
87
  disabled: false,
88
- forwardedRef: undefined,
89
88
  fullWidth: false,
90
89
  helpText: null,
91
90
  id: undefined,
92
91
  isLabelVisible: true,
93
92
  layout: 'vertical',
93
+ ref: undefined,
94
94
  required: false,
95
95
  validationState: null,
96
96
  validationText: null,
@@ -101,14 +101,6 @@ FileInputField.propTypes = {
101
101
  * If `true`, the input will be disabled.
102
102
  */
103
103
  disabled: PropTypes.bool,
104
- /**
105
- * Reference forwarded to the `input` element.
106
- */
107
- forwardedRef: PropTypes.oneOfType([
108
- PropTypes.func,
109
- // eslint-disable-next-line react/forbid-prop-types
110
- PropTypes.shape({ current: PropTypes.any }),
111
- ]),
112
104
  /**
113
105
  * If `true`, the field will span the full width of its parent.
114
106
  */
@@ -144,6 +136,14 @@ FileInputField.propTypes = {
144
136
  *
145
137
  */
146
138
  layout: PropTypes.oneOf(['horizontal', 'vertical']),
139
+ /**
140
+ * Reference forwarded to the `input` element.
141
+ */
142
+ ref: PropTypes.oneOfType([
143
+ PropTypes.func,
144
+ // eslint-disable-next-line react/forbid-prop-types
145
+ PropTypes.shape({ current: PropTypes.any }),
146
+ ]),
147
147
  /**
148
148
  * If `true`, the input will be required.
149
149
  */
@@ -158,6 +158,6 @@ FileInputField.propTypes = {
158
158
  validationText: PropTypes.node,
159
159
  };
160
160
 
161
- export const FileInputFieldWithGlobalProps = withForwardedRef(withGlobalProps(FileInputField, 'FileInputField'));
161
+ export const FileInputFieldWithGlobalProps = withGlobalProps(FileInputField, 'FileInputField');
162
162
 
163
163
  export default FileInputFieldWithGlobalProps;
@@ -12,7 +12,7 @@ import {
12
12
  Playground,
13
13
  Props,
14
14
  } from 'docz'
15
- import { FileInputField } from './FileInputField'
15
+ import { FileInputField } from '../..'
16
16
 
17
17
  ## Basic Usage
18
18
 
@@ -1 +1 @@
1
- export { default } from './FileInputField';
1
+ export { default as FileInputField } from './FileInputField';
@@ -13,19 +13,21 @@ import {
13
13
  Props,
14
14
  } from 'docz'
15
15
  import { Placeholder } from '../../../docs/_components/Placeholder/Placeholder'
16
- import { Button } from '../Button/Button'
17
- import { ButtonGroup } from '../ButtonGroup/ButtonGroup'
18
- import { CheckboxField } from '../CheckboxField/CheckboxField'
19
- import { FileInputField } from '../FileInputField/FileInputField'
20
- import { Radio } from '../Radio/Radio'
21
- import { SelectField } from '../SelectField/SelectField'
22
- import { TextArea } from '../TextArea/TextArea'
23
- import { TextField } from '../TextField/TextField'
24
- import { Toggle } from '../Toggle/Toggle'
25
- import { Toolbar } from '../Toolbar/Toolbar'
26
- import { ToolbarItem } from '../Toolbar/ToolbarItem'
27
- import { FormLayout } from './FormLayout'
28
- import { FormLayoutCustomField } from './FormLayoutCustomField'
16
+ import {
17
+ Button,
18
+ ButtonGroup,
19
+ CheckboxField,
20
+ FileInputField,
21
+ Radio,
22
+ SelectField,
23
+ TextArea,
24
+ TextField,
25
+ Toggle,
26
+ Toolbar,
27
+ ToolbarItem,
28
+ FormLayout,
29
+ FormLayoutCustomField,
30
+ } from '../..'
29
31
 
30
32
  ## Basic Usage
31
33
 
@@ -2,9 +2,12 @@ import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import { withGlobalProps } from '../../provider';
4
4
  import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
5
+ import { transferProps } from '../_helpers/transferProps';
5
6
  import { generateResponsiveCustomProperties } from './_helpers/generateResponsiveCustomProperties';
6
7
  import styles from './Grid.scss';
7
8
 
9
+ const SPACING_VALUES = [0, 1, 2, 3, 4, 5, 6, 7];
10
+
8
11
  export const Grid = ({
9
12
  alignContent,
10
13
  alignItems,
@@ -18,7 +21,7 @@ export const Grid = ({
18
21
  rowGap,
19
22
  rows,
20
23
  tag: Tag,
21
- ...other
24
+ ...restProps
22
25
  }) => {
23
26
  if (isChildrenEmpty(children)) {
24
27
  return null;
@@ -26,20 +29,20 @@ export const Grid = ({
26
29
 
27
30
  return (
28
31
  <Tag
32
+ {...transferProps(restProps)}
29
33
  id={id}
30
34
  className={styles.root}
31
35
  style={{
32
36
  ...generateResponsiveCustomProperties(columns, 'columns'),
33
- ...generateResponsiveCustomProperties(columnGap, 'column-gap'),
37
+ ...generateResponsiveCustomProperties(columnGap, 'column-gap', 'spacing'),
34
38
  ...generateResponsiveCustomProperties(rows, 'rows'),
35
- ...generateResponsiveCustomProperties(rowGap, 'row-gap'),
39
+ ...generateResponsiveCustomProperties(rowGap, 'row-gap', 'spacing'),
36
40
  ...generateResponsiveCustomProperties(autoFlow, 'auto-flow'),
37
41
  ...generateResponsiveCustomProperties(alignContent, 'align-content'),
38
42
  ...generateResponsiveCustomProperties(alignItems, 'align-items'),
39
43
  ...generateResponsiveCustomProperties(justifyContent, 'justify-content'),
40
44
  ...generateResponsiveCustomProperties(justifyItems, 'justify-items'),
41
45
  }}
42
- {...other}
43
46
  >
44
47
  {children}
45
48
  </Tag>
@@ -54,13 +57,13 @@ Grid.defaultProps = {
54
57
  alignItems: undefined,
55
58
  autoFlow: undefined,
56
59
  children: null,
57
- columnGap: undefined,
58
- columns: undefined,
60
+ columnGap: 4,
61
+ columns: '1fr',
59
62
  id: undefined,
60
63
  justifyContent: undefined,
61
64
  justifyItems: undefined,
62
- rowGap: undefined,
63
- rows: undefined,
65
+ rowGap: 4,
66
+ rows: 'auto',
64
67
  tag: 'div',
65
68
  };
66
69
 
@@ -118,19 +121,19 @@ Grid.propTypes = {
118
121
  */
119
122
  children: PropTypes.node,
120
123
  /**
121
- * Gap between columns. Accepts any valid value of `grid-column-gap` CSS property.
122
- * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/column-gap) for more.
124
+ * Gap between columns. Accepts any of [spacing values](/foundation/spacing-values) as number.
125
+ * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/column-gap) for more about `column-gap`.
123
126
  */
124
127
  columnGap: PropTypes.oneOfType([
125
- PropTypes.string,
128
+ PropTypes.oneOf(SPACING_VALUES),
126
129
  PropTypes.shape({
127
- xs: PropTypes.string,
128
- sm: PropTypes.string,
129
- md: PropTypes.string,
130
- lg: PropTypes.string,
131
- xl: PropTypes.string,
132
- x2l: PropTypes.string,
133
- x3l: PropTypes.string,
130
+ xs: PropTypes.oneOf(SPACING_VALUES),
131
+ sm: PropTypes.oneOf(SPACING_VALUES),
132
+ md: PropTypes.oneOf(SPACING_VALUES),
133
+ lg: PropTypes.oneOf(SPACING_VALUES),
134
+ xl: PropTypes.oneOf(SPACING_VALUES),
135
+ x2l: PropTypes.oneOf(SPACING_VALUES),
136
+ x3l: PropTypes.oneOf(SPACING_VALUES),
134
137
  }),
135
138
  ]),
136
139
  /**
@@ -186,19 +189,19 @@ Grid.propTypes = {
186
189
  }),
187
190
  ]),
188
191
  /**
189
- * Gap between rows. Accepts any valid value of `grid-row-gap` CSS property.
190
- * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/row-gap) for more.
192
+ * Gap between rows. Accepts any of [spacing values](/foundation/spacing-values) as number.
193
+ * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/row-gap) for more about `row-gap`.
191
194
  */
192
195
  rowGap: PropTypes.oneOfType([
193
- PropTypes.string,
196
+ PropTypes.oneOf(SPACING_VALUES),
194
197
  PropTypes.shape({
195
- xs: PropTypes.string,
196
- sm: PropTypes.string,
197
- md: PropTypes.string,
198
- lg: PropTypes.string,
199
- xl: PropTypes.string,
200
- x2l: PropTypes.string,
201
- x3l: PropTypes.string,
198
+ xs: PropTypes.oneOf(SPACING_VALUES),
199
+ sm: PropTypes.oneOf(SPACING_VALUES),
200
+ md: PropTypes.oneOf(SPACING_VALUES),
201
+ lg: PropTypes.oneOf(SPACING_VALUES),
202
+ xl: PropTypes.oneOf(SPACING_VALUES),
203
+ x2l: PropTypes.oneOf(SPACING_VALUES),
204
+ x3l: PropTypes.oneOf(SPACING_VALUES),
202
205
  }),
203
206
  ]),
204
207
  /**