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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. package/dist/lib.development.js +465 -93
  2. package/dist/lib.js +1 -1
  3. package/package.json +1 -1
  4. package/src/lib/components/Alert/Alert.jsx +3 -0
  5. package/src/lib/components/Alert/Alert.scss +10 -10
  6. package/src/lib/components/Alert/README.mdx +18 -2
  7. package/src/lib/components/Alert/index.js +1 -1
  8. package/src/lib/components/Badge/Badge.jsx +4 -8
  9. package/src/lib/components/Badge/Badge.scss +21 -21
  10. package/src/lib/components/Badge/README.mdx +15 -1
  11. package/src/lib/components/Badge/index.js +1 -1
  12. package/src/lib/components/Button/Button.jsx +23 -34
  13. package/src/lib/components/Button/README.mdx +21 -7
  14. package/src/lib/components/Button/_base.scss +20 -20
  15. package/src/lib/components/Button/_priorities.scss +35 -35
  16. package/src/lib/components/Button/helpers/getRootLabelVisibilityClassName.js +7 -7
  17. package/src/lib/components/Button/helpers/getRootPriorityClassName.js +3 -3
  18. package/src/lib/components/Button/index.js +1 -1
  19. package/src/lib/components/ButtonGroup/ButtonGroup.jsx +2 -8
  20. package/src/lib/components/ButtonGroup/README.mdx +18 -2
  21. package/src/lib/components/Card/Card.jsx +6 -10
  22. package/src/lib/components/Card/Card.scss +13 -13
  23. package/src/lib/components/Card/CardBody.jsx +6 -10
  24. package/src/lib/components/Card/CardFooter.jsx +6 -7
  25. package/src/lib/components/Card/README.mdx +21 -5
  26. package/src/lib/components/CheckboxField/CheckboxField.jsx +17 -44
  27. package/src/lib/components/CheckboxField/README.mdx +18 -6
  28. package/src/lib/components/CheckboxField/index.js +1 -1
  29. package/src/lib/components/FileInputField/FileInputField.jsx +20 -29
  30. package/src/lib/components/FileInputField/FileInputField.scss +3 -3
  31. package/src/lib/components/FileInputField/README.mdx +30 -28
  32. package/src/lib/components/FileInputField/index.js +1 -1
  33. package/src/lib/components/FormLayout/FormLayout.jsx +5 -9
  34. package/src/lib/components/FormLayout/FormLayout.scss +3 -3
  35. package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +4 -1
  36. package/src/lib/components/FormLayout/FormLayoutCustomField.scss +8 -8
  37. package/src/lib/components/FormLayout/README.mdx +28 -13
  38. package/src/lib/components/Grid/Grid.jsx +31 -35
  39. package/src/lib/components/Grid/Grid.scss +10 -15
  40. package/src/lib/components/Grid/GridSpan.jsx +5 -11
  41. package/src/lib/components/Grid/README.mdx +48 -36
  42. package/src/lib/components/Grid/_helpers/generateResponsiveCustomProperties.js +11 -3
  43. package/src/lib/components/Grid/_settings.scss +18 -0
  44. package/src/lib/components/Grid/_tools.scss +5 -5
  45. package/src/lib/components/Modal/Modal.jsx +147 -254
  46. package/src/lib/components/Modal/Modal.scss +7 -55
  47. package/src/lib/components/Modal/ModalBody.jsx +60 -0
  48. package/src/lib/components/Modal/ModalBody.scss +18 -0
  49. package/src/lib/components/Modal/ModalCloseButton.jsx +45 -0
  50. package/src/lib/components/Modal/ModalCloseButton.scss +18 -0
  51. package/src/lib/components/Modal/ModalContent.jsx +39 -0
  52. package/src/lib/components/Modal/ModalContent.scss +5 -0
  53. package/src/lib/components/Modal/ModalFooter.jsx +42 -0
  54. package/src/lib/components/Modal/ModalFooter.scss +35 -0
  55. package/src/lib/components/Modal/ModalHeader.jsx +44 -0
  56. package/src/lib/components/Modal/ModalHeader.scss +30 -0
  57. package/src/lib/components/Modal/ModalTitle.jsx +44 -0
  58. package/src/lib/components/Modal/ModalTitle.scss +10 -0
  59. package/src/lib/components/Modal/README.mdx +865 -195
  60. package/src/lib/components/Modal/_helpers/getJustifyClassName.js +19 -0
  61. package/src/lib/components/Modal/_helpers/getScrollingClassName.js +11 -0
  62. package/src/lib/components/Modal/_settings.scss +1 -5
  63. package/src/lib/components/Modal/_theme.scss +6 -0
  64. package/src/lib/components/Modal/index.js +7 -1
  65. package/src/lib/components/Paper/Paper.jsx +5 -9
  66. package/src/lib/components/Paper/Paper.scss +2 -2
  67. package/src/lib/components/Paper/README.mdx +15 -1
  68. package/src/lib/components/Paper/index.js +1 -1
  69. package/src/lib/components/Popover/Popover.jsx +14 -30
  70. package/src/lib/components/Popover/Popover.scss +7 -6
  71. package/src/lib/components/Popover/PopoverWrapper.jsx +5 -12
  72. package/src/lib/components/Popover/PopoverWrapper.scss +3 -0
  73. package/src/lib/components/Popover/README.mdx +32 -11
  74. package/src/lib/components/Popover/_theme.scss +1 -1
  75. package/src/lib/components/Radio/README.mdx +13 -6
  76. package/src/lib/components/Radio/Radio.jsx +39 -29
  77. package/src/lib/components/Radio/Radio.scss +3 -3
  78. package/src/lib/components/Radio/index.js +1 -1
  79. package/src/lib/components/ScrollView/README.mdx +165 -84
  80. package/src/lib/components/ScrollView/ScrollView.jsx +115 -117
  81. package/src/lib/components/ScrollView/ScrollView.scss +18 -16
  82. package/src/lib/components/ScrollView/index.js +1 -1
  83. package/src/lib/components/SelectField/README.mdx +83 -7
  84. package/src/lib/components/SelectField/SelectField.jsx +86 -61
  85. package/src/lib/components/SelectField/SelectField.scss +8 -8
  86. package/src/lib/components/SelectField/_components/Option/Option.jsx +46 -0
  87. package/src/lib/components/SelectField/_components/Option/index.js +1 -0
  88. package/src/lib/components/SelectField/index.js +1 -1
  89. package/src/lib/components/Table/README.mdx +25 -9
  90. package/src/lib/components/Table/Table.jsx +43 -101
  91. package/src/lib/components/Table/Table.scss +0 -24
  92. package/src/lib/components/Table/_components/TableBodyCell/TableBodyCell.jsx +46 -0
  93. package/src/lib/components/Table/_components/TableBodyCell/index.js +1 -0
  94. package/src/lib/components/Table/_components/TableCell.scss +25 -0
  95. package/src/lib/components/Table/_components/TableHeaderCell/TableHeaderCell.jsx +71 -0
  96. package/src/lib/components/Table/_components/TableHeaderCell/index.js +1 -0
  97. package/src/lib/components/Table/index.js +1 -1
  98. package/src/lib/components/Tabs/README.mdx +21 -3
  99. package/src/lib/components/Tabs/Tabs.jsx +6 -1
  100. package/src/lib/components/Tabs/TabsItem.jsx +3 -0
  101. package/src/lib/components/Tabs/TabsItem.scss +1 -2
  102. package/src/lib/components/Text/README.mdx +25 -7
  103. package/src/lib/components/Text/Text.jsx +3 -7
  104. package/src/lib/components/Text/Text.scss +6 -6
  105. package/src/lib/components/Text/_helpers/getRootClampClassName.js +2 -2
  106. package/src/lib/components/Text/_helpers/getRootHyphensClassName.js +2 -2
  107. package/src/lib/components/Text/_helpers/getRootWordWrappingClassName.js +2 -2
  108. package/src/lib/components/Text/index.js +1 -1
  109. package/src/lib/components/TextArea/README.mdx +34 -31
  110. package/src/lib/components/TextArea/TextArea.jsx +23 -63
  111. package/src/lib/components/TextArea/TextArea.scss +8 -8
  112. package/src/lib/components/TextArea/index.js +1 -1
  113. package/src/lib/components/TextField/README.mdx +56 -54
  114. package/src/lib/components/TextField/TextField.jsx +25 -52
  115. package/src/lib/components/TextField/TextField.scss +9 -9
  116. package/src/lib/components/TextField/index.js +1 -1
  117. package/src/lib/components/TextLink/README.mdx +13 -6
  118. package/src/lib/components/TextLink/TextLink.jsx +0 -10
  119. package/src/lib/components/TextLink/index.js +1 -1
  120. package/src/lib/components/Toggle/README.mdx +18 -6
  121. package/src/lib/components/Toggle/Toggle.jsx +18 -44
  122. package/src/lib/components/Toggle/index.js +1 -1
  123. package/src/lib/components/Toolbar/README.mdx +21 -6
  124. package/src/lib/components/Toolbar/Toolbar.jsx +9 -43
  125. package/src/lib/components/Toolbar/Toolbar.scss +24 -12
  126. package/src/lib/components/Toolbar/ToolbarGroup.jsx +7 -26
  127. package/src/lib/components/Toolbar/ToolbarItem.jsx +3 -7
  128. package/src/lib/components/Toolbar/_helpers/getAlignClassName.js +19 -0
  129. package/src/lib/components/Toolbar/_helpers/getJustifyClassName.js +16 -0
  130. package/src/lib/components/_helpers/getRootColorClassName.js +10 -10
  131. package/src/lib/components/_helpers/getRootSizeClassName.js +3 -3
  132. package/src/lib/components/_helpers/transferProps.js +1 -1
  133. package/src/lib/index.js +24 -16
  134. package/src/lib/provider/withGlobalProps.jsx +20 -3
  135. package/src/lib/styles/tools/form-fields/_box-field-layout.scss +15 -15
  136. package/src/lib/styles/tools/form-fields/_inline-field-elements.scss +1 -1
  137. package/src/lib/styles/tools/form-fields/_inline-field-layout.scss +9 -9
  138. package/src/lib/theme.scss +18 -26
  139. package/src/lib/translations/en.js +1 -1
  140. package/src/lib/components/Grid/_theme.scss +0 -11
  141. package/src/lib/components/ScrollView/_theme.scss +0 -2
  142. package/src/lib/components/withForwardedRef.jsx +0 -11
@@ -3,128 +3,128 @@
3
3
  @use "theme";
4
4
  @use "tools";
5
5
 
6
- .rootPriorityFilled.rootColorPrimary {
6
+ .isRootPriorityFilled.isRootColorPrimary {
7
7
  @include tools.button-color(filled, primary);
8
8
  }
9
9
 
10
- .rootPriorityFilled.rootColorSecondary {
10
+ .isRootPriorityFilled.isRootColorSecondary {
11
11
  @include tools.button-color(filled, secondary);
12
12
  }
13
13
 
14
- .rootPriorityFilled.rootColorSuccess {
14
+ .isRootPriorityFilled.isRootColorSuccess {
15
15
  @include tools.button-color(filled, success);
16
16
  }
17
17
 
18
- .rootPriorityFilled.rootColorWarning {
18
+ .isRootPriorityFilled.isRootColorWarning {
19
19
  @include tools.button-color(filled, warning);
20
20
  }
21
21
 
22
- .rootPriorityFilled.rootColorDanger {
22
+ .isRootPriorityFilled.isRootColorDanger {
23
23
  @include tools.button-color(filled, danger);
24
24
  }
25
25
 
26
- .rootPriorityFilled.rootColorHelp {
26
+ .isRootPriorityFilled.isRootColorHelp {
27
27
  @include tools.button-color(filled, help);
28
28
  }
29
29
 
30
- .rootPriorityFilled.rootColorInfo {
30
+ .isRootPriorityFilled.isRootColorInfo {
31
31
  @include tools.button-color(filled, info);
32
32
  }
33
33
 
34
- .rootPriorityFilled.rootColorNote {
34
+ .isRootPriorityFilled.isRootColorNote {
35
35
  @include tools.button-color(filled, note);
36
36
  }
37
37
 
38
- .rootPriorityFilled.rootColorLight {
38
+ .isRootPriorityFilled.isRootColorLight {
39
39
  @include tools.button-color(filled, light);
40
40
  }
41
41
 
42
- .rootPriorityFilled.rootColorDark {
42
+ .isRootPriorityFilled.isRootColorDark {
43
43
  @include tools.button-color(filled, dark);
44
44
  }
45
45
 
46
- .rootPriorityOutline.rootColorPrimary {
46
+ .isRootPriorityOutline.isRootColorPrimary {
47
47
  @include tools.button-color(outline, primary);
48
48
  }
49
49
 
50
- .rootPriorityOutline.rootColorSecondary {
50
+ .isRootPriorityOutline.isRootColorSecondary {
51
51
  @include tools.button-color(outline, secondary);
52
52
  }
53
53
 
54
- .rootPriorityOutline.rootColorSuccess {
54
+ .isRootPriorityOutline.isRootColorSuccess {
55
55
  @include tools.button-color(outline, success);
56
56
  }
57
57
 
58
- .rootPriorityOutline.rootColorWarning {
58
+ .isRootPriorityOutline.isRootColorWarning {
59
59
  @include tools.button-color(outline, warning);
60
60
  }
61
61
 
62
- .rootPriorityOutline.rootColorDanger {
62
+ .isRootPriorityOutline.isRootColorDanger {
63
63
  @include tools.button-color(outline, danger);
64
64
  }
65
65
 
66
- .rootPriorityOutline.rootColorHelp {
66
+ .isRootPriorityOutline.isRootColorHelp {
67
67
  @include tools.button-color(outline, help);
68
68
  }
69
69
 
70
- .rootPriorityOutline.rootColorInfo {
70
+ .isRootPriorityOutline.isRootColorInfo {
71
71
  @include tools.button-color(outline, info);
72
72
  }
73
73
 
74
- .rootPriorityOutline.rootColorNote {
74
+ .isRootPriorityOutline.isRootColorNote {
75
75
  @include tools.button-color(outline, note);
76
76
  }
77
77
 
78
- .rootPriorityOutline.rootColorLight {
78
+ .isRootPriorityOutline.isRootColorLight {
79
79
  @include tools.button-color(outline, light);
80
80
  }
81
81
 
82
- .rootPriorityOutline.rootColorDark {
82
+ .isRootPriorityOutline.isRootColorDark {
83
83
  @include tools.button-color(outline, dark);
84
84
  }
85
85
 
86
- .rootPriorityFlat.rootColorPrimary {
86
+ .isRootPriorityFlat.isRootColorPrimary {
87
87
  @include tools.button-color(flat, primary);
88
88
  }
89
89
 
90
- .rootPriorityFlat.rootColorSecondary {
90
+ .isRootPriorityFlat.isRootColorSecondary {
91
91
  @include tools.button-color(flat, secondary);
92
92
  }
93
93
 
94
- .rootPriorityFlat.rootColorSuccess {
94
+ .isRootPriorityFlat.isRootColorSuccess {
95
95
  @include tools.button-color(flat, success);
96
96
  }
97
97
 
98
- .rootPriorityFlat.rootColorWarning {
98
+ .isRootPriorityFlat.isRootColorWarning {
99
99
  @include tools.button-color(flat, warning);
100
100
  }
101
101
 
102
- .rootPriorityFlat.rootColorDanger {
102
+ .isRootPriorityFlat.isRootColorDanger {
103
103
  @include tools.button-color(flat, danger);
104
104
  }
105
105
 
106
- .rootPriorityFlat.rootColorHelp {
106
+ .isRootPriorityFlat.isRootColorHelp {
107
107
  @include tools.button-color(flat, help);
108
108
  }
109
109
 
110
- .rootPriorityFlat.rootColorInfo {
110
+ .isRootPriorityFlat.isRootColorInfo {
111
111
  @include tools.button-color(flat, info);
112
112
  }
113
113
 
114
- .rootPriorityFlat.rootColorNote {
114
+ .isRootPriorityFlat.isRootColorNote {
115
115
  @include tools.button-color(flat, note);
116
116
  }
117
117
 
118
- .rootPriorityFlat.rootColorLight {
118
+ .isRootPriorityFlat.isRootColorLight {
119
119
  @include tools.button-color(flat, light);
120
120
  }
121
121
 
122
- .rootPriorityFlat.rootColorDark {
122
+ .isRootPriorityFlat.isRootColorDark {
123
123
  @include tools.button-color(flat, dark);
124
124
  }
125
125
 
126
- .rootPriorityFilled.rootGrouped:not(:first-child)::before,
127
- .rootPriorityFlat.rootGrouped:not(:first-child)::before {
126
+ .isRootPriorityFilled.isRootGrouped:not(:first-child)::before,
127
+ .isRootPriorityFlat.isRootGrouped:not(:first-child)::before {
128
128
  content: "";
129
129
  position: absolute;
130
130
  top: calc(-1 * #{theme.$border-width});
@@ -135,18 +135,18 @@
135
135
  transform: translateX(calc(-0.5 * var(--rui-local-gap) - 50%));
136
136
  }
137
137
 
138
- .rootPriorityFilled.rootGrouped:not(:first-child) {
138
+ .isRootPriorityFilled.isRootGrouped:not(:first-child) {
139
139
  --rui-local-gap: #{theme.$group-filled-gap};
140
140
  --rui-local-separator-width: #{theme.$group-filled-separator-width};
141
141
  --rui-local-separator-color: #{theme.$group-filled-separator-color};
142
142
  }
143
143
 
144
- .rootPriorityFlat.rootGrouped:not(:first-child) {
144
+ .isRootPriorityFlat.isRootGrouped:not(:first-child) {
145
145
  --rui-local-gap: #{theme.$group-flat-gap};
146
146
  --rui-local-separator-width: #{theme.$group-flat-separator-width};
147
147
  --rui-local-separator-color: #{theme.$group-flat-separator-color};
148
148
  }
149
149
 
150
- .rootPriorityOutline.rootGrouped:not(:first-child) {
150
+ .isRootPriorityOutline.isRootGrouped:not(:first-child) {
151
151
  --rui-local-gap: #{theme.$group-outline-gap};
152
152
  }
@@ -2,31 +2,31 @@ export default (labelVisibility, styles) => {
2
2
  // Intentionally omitting `xs` which means label is visible on all screen sizes.
3
3
 
4
4
  if (labelVisibility === 'sm') {
5
- return styles.withLabelVisibleSm;
5
+ return styles.hasLabelVisibleSm;
6
6
  }
7
7
 
8
8
  if (labelVisibility === 'md') {
9
- return styles.withLabelVisibleMd;
9
+ return styles.hasLabelVisibleMd;
10
10
  }
11
11
 
12
12
  if (labelVisibility === 'lg') {
13
- return styles.withLabelVisibleLg;
13
+ return styles.hasLabelVisibleLg;
14
14
  }
15
15
 
16
16
  if (labelVisibility === 'xl') {
17
- return styles.withLabelVisibleXl;
17
+ return styles.hasLabelVisibleXl;
18
18
  }
19
19
 
20
20
  if (labelVisibility === 'x2l') {
21
- return styles.withLabelVisibleX2l;
21
+ return styles.hasLabelVisibleX2l;
22
22
  }
23
23
 
24
24
  if (labelVisibility === 'x3l') {
25
- return styles.withLabelVisibleX3l;
25
+ return styles.hasLabelVisibleX3l;
26
26
  }
27
27
 
28
28
  if (labelVisibility === 'none') {
29
- return styles.withLabelHidden;
29
+ return styles.hasLabelHidden;
30
30
  }
31
31
 
32
32
  return null;
@@ -1,14 +1,14 @@
1
1
  export default (priority, styles) => {
2
2
  if (priority === 'filled') {
3
- return styles.rootPriorityFilled;
3
+ return styles.isRootPriorityFilled;
4
4
  }
5
5
 
6
6
  if (priority === 'outline') {
7
- return styles.rootPriorityOutline;
7
+ return styles.isRootPriorityOutline;
8
8
  }
9
9
 
10
10
  if (priority === 'flat') {
11
- return styles.rootPriorityFlat;
11
+ return styles.isRootPriorityFlat;
12
12
  }
13
13
 
14
14
  return null;
@@ -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
 
@@ -10,7 +11,6 @@ export const ButtonGroup = ({
10
11
  block,
11
12
  disabled,
12
13
  children,
13
- id,
14
14
  priority,
15
15
  size,
16
16
  ...restProps
@@ -21,13 +21,12 @@ export const ButtonGroup = ({
21
21
 
22
22
  return (
23
23
  <div
24
+ {...transferProps(restProps)}
24
25
  className={classNames(
25
26
  styles.root,
26
27
  block && styles.isRootBlock,
27
28
  )}
28
- id={id}
29
29
  role="group"
30
- {...restProps}
31
30
  >
32
31
  <ButtonGroupContext.Provider
33
32
  value={{
@@ -47,7 +46,6 @@ ButtonGroup.defaultProps = {
47
46
  block: false,
48
47
  children: null,
49
48
  disabled: false,
50
- id: undefined,
51
49
  priority: 'filled',
52
50
  size: 'medium',
53
51
  };
@@ -65,10 +63,6 @@ ButtonGroup.propTypes = {
65
63
  * If `true`, all buttons inside the group will be disabled.
66
64
  */
67
65
  disabled: PropTypes.bool,
68
- /**
69
- * ID of the root HTML element.
70
- */
71
- id: PropTypes.string,
72
66
  /**
73
67
  * Visual priority to highlight or suppress the buttons.
74
68
  */
@@ -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
 
@@ -229,6 +231,17 @@ and communicating the state of individual options.
229
231
  </>
230
232
  </Playground>
231
233
 
234
+ ## Forwarding HTML Attributes
235
+
236
+ In addition to the options below in the [component's API](#api) section, you
237
+ can specify [React synthetic events] or **any HTML attribute you like.** All
238
+ attributes that don't interfere with the API are forwarded to the root `<div>`
239
+ HTML element. This enables making the component interactive and helps to improve
240
+ its accessibility.
241
+
242
+ 👉 Refer to the MDN reference for the full list of supported attributes of the
243
+ [div] element.
244
+
232
245
  ## API
233
246
 
234
247
  <Props table of={ButtonGroup} />
@@ -244,3 +257,6 @@ and communicating the state of individual options.
244
257
  | `--rui-ButtonGroup--flat__separator__width` | Separator width for `flat` buttons |
245
258
  | `--rui-ButtonGroup--flat__separator__color` | Separator color for `flat` buttons |
246
259
  | `--rui-ButtonGroup--outline__gap` | Gap between `outline` buttons |
260
+
261
+ [React synthetic events]: https://reactjs.org/docs/events.html
262
+ [div]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
@@ -1,6 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import { withGlobalProps } from '../../provider';
4
+ import { transferProps } from '../_helpers/transferProps';
4
5
  import { classNames } from '../../utils/classNames';
5
6
  import { getRootColorClassName } from '../_helpers/getRootColorClassName';
6
7
  import styles from './Card.scss';
@@ -9,19 +10,19 @@ export const Card = ({
9
10
  children,
10
11
  dense,
11
12
  disabled,
12
- id,
13
13
  raised,
14
14
  color,
15
+ ...restProps
15
16
  }) => (
16
17
  <div
18
+ {...transferProps(restProps)}
17
19
  className={classNames(
18
20
  styles.root,
19
21
  getRootColorClassName(color, styles),
20
- dense && styles.rootDense,
21
- raised && styles.rootRaised,
22
- disabled && styles.isDisabled,
22
+ dense && styles.isRootDense,
23
+ raised && styles.isRootRaised,
24
+ disabled && styles.isRootDisabled,
23
25
  )}
24
- id={id}
25
26
  >
26
27
  {children}
27
28
  </div>
@@ -31,7 +32,6 @@ Card.defaultProps = {
31
32
  color: 'light',
32
33
  dense: false,
33
34
  disabled: false,
34
- id: undefined,
35
35
  raised: false,
36
36
  };
37
37
 
@@ -57,10 +57,6 @@ Card.propTypes = {
57
57
  * If `true`, the card will be disabled.
58
58
  */
59
59
  disabled: PropTypes.bool,
60
- /**
61
- * ID of the root HTML element.
62
- */
63
- id: PropTypes.string,
64
60
  /**
65
61
  * Add shadow to pull the card above surface.
66
62
  */
@@ -25,55 +25,55 @@
25
25
  padding: var(--rui-local-padding);
26
26
  }
27
27
 
28
- .rootDense {
28
+ .isRootDense {
29
29
  --rui-local-padding: #{theme.$dense-padding};
30
30
  }
31
31
 
32
- .rootRaised {
32
+ .isRootRaised {
33
33
  box-shadow: theme.$raised-box-shadow;
34
34
  }
35
35
 
36
- .rootColorPrimary {
36
+ .isRootColorPrimary {
37
37
  @include tools.color(primary);
38
38
  }
39
39
 
40
- .rootColorSecondary {
40
+ .isRootColorSecondary {
41
41
  @include tools.color(secondary);
42
42
  }
43
43
 
44
- .rootColorSuccess {
44
+ .isRootColorSuccess {
45
45
  @include tools.color(success);
46
46
  }
47
47
 
48
- .rootColorWarning {
48
+ .isRootColorWarning {
49
49
  @include tools.color(warning);
50
50
  }
51
51
 
52
- .rootColorDanger {
52
+ .isRootColorDanger {
53
53
  @include tools.color(danger);
54
54
  }
55
55
 
56
- .rootColorHelp {
56
+ .isRootColorHelp {
57
57
  @include tools.color(help);
58
58
  }
59
59
 
60
- .rootColorInfo {
60
+ .isRootColorInfo {
61
61
  @include tools.color(info);
62
62
  }
63
63
 
64
- .rootColorNote {
64
+ .isRootColorNote {
65
65
  @include tools.color(note);
66
66
  }
67
67
 
68
- .rootColorLight {
68
+ .isRootColorLight {
69
69
  @include tools.color(light);
70
70
  }
71
71
 
72
- .rootColorDark {
72
+ .isRootColorDark {
73
73
  @include tools.color(dark);
74
74
  }
75
75
 
76
- .isDisabled {
76
+ .isRootDisabled {
77
77
  background-color: theme.$disabled-background-color;
78
78
  opacity: theme.$disabled-opacity;
79
79
  }
@@ -1,30 +1,26 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import { withGlobalProps } from '../../provider';
4
+ import { transferProps } from '../_helpers/transferProps';
4
5
  import styles from './Card.scss';
5
6
 
6
7
  export const CardBody = ({
7
8
  children,
8
- id,
9
+ ...restProps
9
10
  }) => (
10
- <div className={styles.body} id={id}>
11
+ <div
12
+ {...transferProps(restProps)}
13
+ className={styles.body}
14
+ >
11
15
  {children}
12
16
  </div>
13
17
  );
14
18
 
15
- CardBody.defaultProps = {
16
- id: undefined,
17
- };
18
-
19
19
  CardBody.propTypes = {
20
20
  /**
21
21
  * Content of the card.
22
22
  */
23
23
  children: PropTypes.node.isRequired,
24
- /**
25
- * ID of the root HTML element.
26
- */
27
- id: PropTypes.string,
28
24
  };
29
25
 
30
26
  export const CardBodyWithGlobalProps = withGlobalProps(CardBody, 'CardBody');
@@ -2,18 +2,22 @@ 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 styles from './Card.scss';
6
7
 
7
8
  export const CardFooter = ({
8
9
  children,
9
- id,
10
+ ...restProps
10
11
  }) => {
11
12
  if (isChildrenEmpty(children)) {
12
13
  return null;
13
14
  }
14
15
 
15
16
  return (
16
- <div className={styles.footer} id={id}>
17
+ <div
18
+ {...transferProps(restProps)}
19
+ className={styles.footer}
20
+ >
17
21
  {children}
18
22
  </div>
19
23
  );
@@ -21,7 +25,6 @@ export const CardFooter = ({
21
25
 
22
26
  CardFooter.defaultProps = {
23
27
  children: null,
24
- id: undefined,
25
28
  };
26
29
 
27
30
  CardFooter.propTypes = {
@@ -29,10 +32,6 @@ CardFooter.propTypes = {
29
32
  * Card actions, usually buttons.
30
33
  */
31
34
  children: PropTypes.node,
32
- /**
33
- * ID of the root HTML element.
34
- */
35
- id: PropTypes.string,
36
35
  };
37
36
 
38
37
  export const CardFooterWithGlobalProps = withGlobalProps(CardFooter, 'CardFooter');
@@ -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
 
@@ -278,6 +280,17 @@ its interactive elements to disallow user's interaction.
278
280
  </Card>
279
281
  </Playground>
280
282
 
283
+ ## Forwarding HTML Attributes
284
+
285
+ In addition to the options below in the [component's API](#api) section, you
286
+ can specify [React synthetic events] or **any HTML attribute you like.** All
287
+ attributes that don't interfere with the API are forwarded to the root `<div>`
288
+ HTML element. This enables making the component interactive and helps to improve
289
+ its accessibility.
290
+
291
+ 👉 Refer to the MDN reference for the full list of supported attributes of the
292
+ [div] element.
293
+
281
294
  ## API
282
295
 
283
296
  <Props table of={Card} />
@@ -324,3 +337,6 @@ Where:
324
337
  (see [color variants](#color-variants) and [API](#api)),
325
338
  - `<PROPERTY>` is one of `color` (color of text), `border-color`, or
326
339
  `background-color`.
340
+
341
+ [React synthetic events]: https://reactjs.org/docs/events.html
342
+ [div]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes