@react-ui-org/react-ui 0.47.0 → 0.49.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.
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
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.49.0",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",
@@ -4,6 +4,7 @@ import {
4
4
  RUIContext,
5
5
  withGlobalProps,
6
6
  } from '../../provider';
7
+ import { transferProps } from '../_helpers/transferProps';
7
8
  import { classNames } from '../../utils/classNames';
8
9
  import { getRootColorClassName } from '../_helpers/getRootColorClassName';
9
10
  import styles from './Alert.scss';
@@ -14,11 +15,13 @@ export const Alert = ({
14
15
  icon,
15
16
  id,
16
17
  onClose,
18
+ ...restProps
17
19
  }) => {
18
20
  const { translations } = useContext(RUIContext);
19
21
 
20
22
  return (
21
23
  <div
24
+ {...transferProps(restProps)}
22
25
  className={classNames(
23
26
  styles.root,
24
27
  getRootColorClassName(color, styles),
@@ -65,42 +65,42 @@
65
65
  top: -0.1em;
66
66
  }
67
67
 
68
- .rootColorPrimary {
68
+ .isRootColorPrimary {
69
69
  @include tools.color(primary);
70
70
  }
71
71
 
72
- .rootColorSecondary {
72
+ .isRootColorSecondary {
73
73
  @include tools.color(secondary);
74
74
  }
75
75
 
76
- .rootColorSuccess {
76
+ .isRootColorSuccess {
77
77
  @include tools.color(success);
78
78
  }
79
79
 
80
- .rootColorWarning {
80
+ .isRootColorWarning {
81
81
  @include tools.color(warning);
82
82
  }
83
83
 
84
- .rootColorDanger {
84
+ .isRootColorDanger {
85
85
  @include tools.color(danger);
86
86
  }
87
87
 
88
- .rootColorHelp {
88
+ .isRootColorHelp {
89
89
  @include tools.color(help);
90
90
  }
91
91
 
92
- .rootColorInfo {
92
+ .isRootColorInfo {
93
93
  @include tools.color(info);
94
94
  }
95
95
 
96
- .rootColorNote {
96
+ .isRootColorNote {
97
97
  @include tools.color(note);
98
98
  }
99
99
 
100
- .rootColorLight {
100
+ .isRootColorLight {
101
101
  @include tools.color(light);
102
102
  }
103
103
 
104
- .rootColorDark {
104
+ .isRootColorDark {
105
105
  @include tools.color(dark);
106
106
  }
@@ -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
 
@@ -202,6 +204,17 @@ click on the close button:
202
204
  }}
203
205
  </Playground>
204
206
 
207
+ ## Forwarding HTML Attributes
208
+
209
+ In addition to the options below in the [component's API](#api) section, you
210
+ can specify [React synthetic events] or **any HTML attribute you like.** All
211
+ attributes that don't interfere with the API are forwarded to the root `<div>`
212
+ HTML element. This enables making the component interactive and helps to improve
213
+ its accessibility.
214
+
215
+ 👉 Refer to the MDN reference for the full list of supported attributes of the
216
+ [div] element.
217
+
205
218
  ## API
206
219
 
207
220
  <Props table of={Alert} />
@@ -233,3 +246,6 @@ Where:
233
246
  (see alert [color variants](#color-variants) and [API](#api)),
234
247
  - `<PROPERTY>` is one of `color` (color of text), `foreground-color` (color of
235
248
  border, icon, links, and emphasis), or `background-color`.
249
+
250
+ [React synthetic events]: https://reactjs.org/docs/events.html
251
+ [div]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
@@ -1 +1 @@
1
- export { default } from './Alert';
1
+ export { default as Alert } from './Alert';
@@ -1,23 +1,24 @@
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 './Badge.scss';
7
8
 
8
9
  export const Badge = ({
9
10
  color,
10
- id,
11
11
  label,
12
12
  priority,
13
+ ...restProps
13
14
  }) => (
14
15
  <div
16
+ {...transferProps(restProps)}
15
17
  className={classNames(
16
18
  styles.root,
17
- priority === 'outline' && styles.rootPriorityOutline,
19
+ priority === 'outline' && styles.isRootPriorityOutline,
18
20
  getRootColorClassName(color, styles),
19
21
  )}
20
- id={id}
21
22
  >
22
23
  {label}
23
24
  </div>
@@ -25,7 +26,6 @@ export const Badge = ({
25
26
 
26
27
  Badge.defaultProps = {
27
28
  color: 'note',
28
- id: undefined,
29
29
  priority: 'filled',
30
30
  };
31
31
 
@@ -36,10 +36,6 @@ Badge.propTypes = {
36
36
  color: PropTypes.oneOf(
37
37
  ['primary', 'secondary', 'success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark'],
38
38
  ),
39
- /**
40
- * ID of the root HTML element.
41
- */
42
- id: PropTypes.string,
43
39
  /**
44
40
  * Text to be displayed.
45
41
  */
@@ -24,59 +24,59 @@ $_badge-size: 1.25rem;
24
24
  box-shadow: var(--rui-local-box-shadow, #{0 0 0 2px rgb(255 255 255 / 80%)});
25
25
  }
26
26
 
27
- .rootColorPrimary {
27
+ .isRootColorPrimary {
28
28
  --rui-local-color: #{map.get(colors.$brand, on-primary)};
29
29
  --rui-local-background-color: #{map.get(colors.$brand, primary)};
30
30
  }
31
31
 
32
- .rootColorSecondary {
32
+ .isRootColorSecondary {
33
33
  --rui-local-color: #{map.get(colors.$brand, on-secondary)};
34
34
  --rui-local-background-color: #{map.get(colors.$brand, secondary)};
35
35
  }
36
36
 
37
- .rootColorSuccess {
37
+ .isRootColorSuccess {
38
38
  --rui-local-color: #{map.get(colors.$ui, on-success)};
39
39
  --rui-local-background-color: #{map.get(colors.$ui, success)};
40
40
  }
41
41
 
42
- .rootColorWarning {
42
+ .isRootColorWarning {
43
43
  --rui-local-color: #{map.get(colors.$ui, on-warning)};
44
44
  --rui-local-background-color: #{map.get(colors.$ui, warning)};
45
45
  }
46
46
 
47
- .rootColorDanger {
47
+ .isRootColorDanger {
48
48
  --rui-local-color: #{map.get(colors.$ui, on-danger)};
49
49
  --rui-local-background-color: #{map.get(colors.$ui, danger)};
50
50
  }
51
51
 
52
- .rootColorHelp {
52
+ .isRootColorHelp {
53
53
  --rui-local-color: #{map.get(colors.$ui, on-help)};
54
54
  --rui-local-background-color: #{map.get(colors.$ui, help)};
55
55
  }
56
56
 
57
- .rootColorInfo {
57
+ .isRootColorInfo {
58
58
  --rui-local-color: #{map.get(colors.$ui, on-info)};
59
59
  --rui-local-background-color: #{map.get(colors.$ui, info)};
60
60
  }
61
61
 
62
- .rootColorNote {
62
+ .isRootColorNote {
63
63
  --rui-local-color: #{map.get(colors.$ui, on-note)};
64
64
  --rui-local-background-color: #{map.get(colors.$ui, note)};
65
65
  }
66
66
 
67
- .rootColorLight {
67
+ .isRootColorLight {
68
68
  --rui-local-color: #{colors.$dark};
69
69
  --rui-local-background-color: #{colors.$light};
70
70
  --rui-local-box-shadow: none;
71
71
  }
72
72
 
73
- .rootColorDark {
73
+ .isRootColorDark {
74
74
  --rui-local-color: #{colors.$light};
75
75
  --rui-local-background-color: #{colors.$dark};
76
76
  --rui-local-box-shadow: none;
77
77
  }
78
78
 
79
- .rootPriorityOutline {
79
+ .isRootPriorityOutline {
80
80
  --rui-local-background-color: transparent;
81
81
  --rui-local-box-shadow: none;
82
82
 
@@ -85,42 +85,42 @@ $_badge-size: 1.25rem;
85
85
  border: borders.$width solid currentColor;
86
86
  }
87
87
 
88
- .rootPriorityOutline.rootColorPrimary {
88
+ .isRootPriorityOutline.isRootColorPrimary {
89
89
  --rui-local-color: #{map.get(colors.$brand, primary)};
90
90
  }
91
91
 
92
- .rootPriorityOutline.rootColorSecondary {
92
+ .isRootPriorityOutline.isRootColorSecondary {
93
93
  --rui-local-color: #{map.get(colors.$brand, secondary)};
94
94
  }
95
95
 
96
- .rootPriorityOutline.rootColorSuccess {
96
+ .isRootPriorityOutline.isRootColorSuccess {
97
97
  --rui-local-color: #{map.get(colors.$ui, success)};
98
98
  }
99
99
 
100
- .rootPriorityOutline.rootColorWarning {
100
+ .isRootPriorityOutline.isRootColorWarning {
101
101
  --rui-local-color: #{map.get(colors.$ui, warning)};
102
102
  }
103
103
 
104
- .rootPriorityOutline.rootColorDanger {
104
+ .isRootPriorityOutline.isRootColorDanger {
105
105
  --rui-local-color: #{map.get(colors.$ui, danger)};
106
106
  }
107
107
 
108
- .rootPriorityOutline.rootColorHelp {
108
+ .isRootPriorityOutline.isRootColorHelp {
109
109
  --rui-local-color: #{map.get(colors.$ui, help)};
110
110
  }
111
111
 
112
- .rootPriorityOutline.rootColorInfo {
112
+ .isRootPriorityOutline.isRootColorInfo {
113
113
  --rui-local-color: #{map.get(colors.$ui, info)};
114
114
  }
115
115
 
116
- .rootPriorityOutline.rootColorNote {
116
+ .isRootPriorityOutline.isRootColorNote {
117
117
  --rui-local-color: #{map.get(colors.$ui, note)};
118
118
  }
119
119
 
120
- .rootPriorityOutline.rootColorLight {
120
+ .isRootPriorityOutline.isRootColorLight {
121
121
  --rui-local-color: #{colors.$light};
122
122
  }
123
123
 
124
- .rootPriorityOutline.rootColorDark {
124
+ .isRootPriorityOutline.isRootColorDark {
125
125
  --rui-local-color: #{colors.$dark};
126
126
  }
@@ -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
 
@@ -115,6 +115,20 @@ Medium-emphasis priority to provide additional context in an unobtrusive way.
115
115
  <Badge priority="outline" label="Dark" color="dark" />
116
116
  </Playground>
117
117
 
118
+ ## Forwarding HTML Attributes
119
+
120
+ In addition to the options below in the [component's API](#api) section, you
121
+ can specify [React synthetic events] or **any HTML attribute you like.** All
122
+ attributes that don't interfere with the API are forwarded to the root `<div>`
123
+ HTML element. This enables making the component interactive and helps to improve
124
+ its accessibility.
125
+
126
+ 👉 Refer to the MDN reference for the full list of supported attributes of the
127
+ [div] element.
128
+
118
129
  ## API
119
130
 
120
131
  <Props table of={Badge} />
132
+
133
+ [React synthetic events]: https://reactjs.org/docs/events.html
134
+ [div]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
@@ -1 +1 @@
1
- export { default } from './Badge';
1
+ export { default as Badge } from './Badge';
@@ -6,30 +6,29 @@ 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
+ color,
29
+ ...restProps
30
+ } = props;
31
+
33
32
  const context = useContext(ButtonGroupContext);
34
33
 
35
34
  return (
@@ -49,14 +48,13 @@ export const Button = ({
49
48
  styles,
50
49
  ),
51
50
  getRootLabelVisibilityClassName(labelVisibility, styles),
52
- resolveContextOrProp(context && context.block, block) && styles.rootBlock,
53
- context && styles.rootGrouped,
51
+ resolveContextOrProp(context && context.block, block) && styles.isRootBlock,
52
+ context && styles.isRootGrouped,
54
53
  feedbackIcon && styles.hasRootFeedback,
55
54
  )}
56
55
  disabled={resolveContextOrProp(context && context.disabled, disabled) || !!feedbackIcon}
57
56
  id={id}
58
- ref={forwardedRef}
59
- type={type}
57
+ ref={ref}
60
58
  >
61
59
  {startCorner && (
62
60
  <span className={styles.startCorner}>
@@ -92,7 +90,7 @@ export const Button = ({
92
90
  </button>
93
91
  /* eslint-enable react/button-has-type */
94
92
  );
95
- };
93
+ });
96
94
 
97
95
  Button.defaultProps = {
98
96
  afterLabel: null,
@@ -102,7 +100,6 @@ Button.defaultProps = {
102
100
  disabled: false,
103
101
  endCorner: null,
104
102
  feedbackIcon: null,
105
- forwardedRef: undefined,
106
103
  id: undefined,
107
104
  labelVisibility: 'xs',
108
105
  priority: 'filled',
@@ -147,14 +144,6 @@ Button.propTypes = {
147
144
  * button is in feedback state.
148
145
  */
149
146
  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
147
  /**
159
148
  * ID of the root HTML element.
160
149
  *
@@ -194,6 +183,6 @@ Button.propTypes = {
194
183
  type: PropTypes.oneOf(['button', 'submit']),
195
184
  };
196
185
 
197
- export const ButtonWithGlobalProps = withForwardedRef(withGlobalProps(Button, 'Button'));
186
+ export const ButtonWithGlobalProps = withGlobalProps(Button, 'Button');
198
187
 
199
188
  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
 
@@ -395,12 +397,22 @@ Flat buttons in feedback state:
395
397
  👉 Visit the [CSS Helpers](/css-helpers/animation) section to see how the icon
396
398
  animation is made.
397
399
 
398
- ## API
400
+ ## Forwarding HTML Attributes
401
+
402
+ In addition to the options below in the [component's API](#api) section, you
403
+ can specify [React synthetic events] or **any HTML attribute you like.** All
404
+ attributes that don't interfere with the API are forwarded to the native HTML
405
+ `<button>`. This enables making the component interactive and helps to improve
406
+ its accessibility.
407
+
408
+ 👉 Refer to the MDN reference for the full list of supported attributes of the
409
+ [button] element.
399
410
 
400
- In addition to the options below, you can specify [React synthetic events] or
401
- any custom HTML attributes that do not interfere with the API, and they will be
402
- passed to the `<button>` HTML element. This enables making the component
403
- interactive and helps improve its accessibility.
411
+ ## Forwarding ref
412
+
413
+ If you provide [ref], it is forwarded to the native HTML `<button>` element.
414
+
415
+ ## API
404
416
 
405
417
  <Props table of={Button} />
406
418
 
@@ -560,3 +572,5 @@ feedback state.
560
572
  | `--rui-Button--feedback__cursor` | Cursor to show on hovering buttons in feedback state |
561
573
 
562
574
  [React synthetic events]: https://reactjs.org/docs/events.html
575
+ [button]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes
576
+ [ref]: https://reactjs.org/docs/refs-and-the-dom.html
@@ -49,19 +49,19 @@
49
49
  align-items: center;
50
50
  }
51
51
 
52
- .rootSizeSmall {
52
+ .isRootSizeSmall {
53
53
  @include tools.button-size(small);
54
54
  }
55
55
 
56
- .rootSizeMedium {
56
+ .isRootSizeMedium {
57
57
  @include tools.button-size(medium);
58
58
  }
59
59
 
60
- .rootSizeLarge {
60
+ .isRootSizeLarge {
61
61
  @include tools.button-size(large);
62
62
  }
63
63
 
64
- .rootBlock {
64
+ .isRootBlock {
65
65
  width: 100%;
66
66
  }
67
67
 
@@ -76,7 +76,7 @@
76
76
  color: transparent;
77
77
  }
78
78
 
79
- .rootGrouped {
79
+ .isRootGrouped {
80
80
  z-index: map.get(settings.$group-z-indexes, button);
81
81
 
82
82
  &:not(:first-child) {
@@ -96,52 +96,52 @@
96
96
  }
97
97
  }
98
98
 
99
- .rootGrouped .startCorner,
100
- .rootGrouped .endCorner {
99
+ .isRootGrouped .startCorner,
100
+ .isRootGrouped .endCorner {
101
101
  z-index: map.get(settings.$group-z-indexes, button-overflowing-elements);
102
102
  }
103
103
 
104
- .withLabelHidden,
105
- .withLabelVisibleSm,
106
- .withLabelVisibleMd,
107
- .withLabelVisibleLg,
108
- .withLabelVisibleXl,
109
- .withLabelVisibleX2l,
110
- .withLabelVisibleX3l {
104
+ .hasLabelHidden,
105
+ .hasLabelVisibleSm,
106
+ .hasLabelVisibleMd,
107
+ .hasLabelVisibleLg,
108
+ .hasLabelVisibleXl,
109
+ .hasLabelVisibleX2l,
110
+ .hasLabelVisibleX3l {
111
111
  @include tools.hide-label();
112
112
  }
113
113
 
114
- .withLabelVisibleSm {
114
+ .hasLabelVisibleSm {
115
115
  @include breakpoint.up(sm) {
116
116
  @include tools.show-label();
117
117
  }
118
118
  }
119
119
 
120
- .withLabelVisibleMd {
120
+ .hasLabelVisibleMd {
121
121
  @include breakpoint.up(md) {
122
122
  @include tools.show-label();
123
123
  }
124
124
  }
125
125
 
126
- .withLabelVisibleLg {
126
+ .hasLabelVisibleLg {
127
127
  @include breakpoint.up(lg) {
128
128
  @include tools.show-label();
129
129
  }
130
130
  }
131
131
 
132
- .withLabelVisibleXl {
132
+ .hasLabelVisibleXl {
133
133
  @include breakpoint.up(xl) {
134
134
  @include tools.show-label();
135
135
  }
136
136
  }
137
137
 
138
- .withLabelVisibleX2l {
138
+ .hasLabelVisibleX2l {
139
139
  @include breakpoint.up(x2l) {
140
140
  @include tools.show-label();
141
141
  }
142
142
  }
143
143
 
144
- .withLabelVisibleX3l {
144
+ .hasLabelVisibleX3l {
145
145
  @include breakpoint.up(x3l) {
146
146
  @include tools.show-label();
147
147
  }