@react-ui-org/react-ui 0.42.0 → 0.44.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. package/CONTRIBUTING.md +44 -25
  2. package/README.md +1 -1
  3. package/dist/lib.development.js +1598 -652
  4. package/dist/lib.js +1 -9
  5. package/package.json +49 -48
  6. package/src/lib/components/{ui/Alert → Alert}/Alert.jsx +17 -14
  7. package/src/lib/components/{ui/Alert → Alert}/Alert.scss +3 -3
  8. package/src/lib/components/{ui/Alert → Alert}/README.mdx +6 -6
  9. package/src/lib/components/{ui/Alert → Alert}/_settings.scss +1 -1
  10. package/src/lib/components/{ui/Alert → Alert}/_theme.scss +0 -0
  11. package/src/lib/components/{ui/Alert → Alert}/_tools.scss +0 -0
  12. package/src/lib/components/{ui/Alert → Alert}/index.js +0 -0
  13. package/src/lib/components/{ui/Badge → Badge}/Badge.jsx +2 -2
  14. package/src/lib/components/{ui/Badge → Badge}/Badge.scss +3 -3
  15. package/src/lib/components/{ui/Badge → Badge}/README.mdx +3 -3
  16. package/src/lib/components/{ui/Badge → Badge}/index.js +0 -0
  17. package/src/lib/components/Button/Button.jsx +198 -0
  18. package/src/lib/components/{ui/Button → Button}/Button.scss +0 -0
  19. package/src/lib/components/{ui/Button → Button}/README.mdx +160 -75
  20. package/src/lib/components/Button/_base.scss +148 -0
  21. package/src/lib/components/{ui/Button → Button}/_priorities.scss +0 -4
  22. package/src/lib/components/{ui/Button → Button}/_settings.scss +2 -3
  23. package/src/lib/components/{ui/Button → Button}/_theme.scss +3 -11
  24. package/src/lib/components/{ui/Button → Button}/_tools.scss +27 -44
  25. package/src/lib/components/Button/helpers/getRootLabelVisibilityClassName.js +33 -0
  26. package/src/lib/components/{ui/Button → Button}/helpers/getRootPriorityClassName.js +0 -4
  27. package/src/lib/components/{ui/Button → Button}/index.js +0 -0
  28. package/src/lib/components/{ui/ButtonGroup → ButtonGroup}/ButtonGroup.jsx +9 -11
  29. package/src/lib/components/{ui/ButtonGroup → ButtonGroup}/ButtonGroup.scss +0 -0
  30. package/src/lib/components/ButtonGroup/ButtonGroupContext.js +3 -0
  31. package/src/lib/components/{ui/ButtonGroup → ButtonGroup}/README.mdx +26 -2
  32. package/src/lib/components/ButtonGroup/index.js +2 -0
  33. package/src/lib/components/{layout/CTA → CTA}/CTA.jsx +5 -2
  34. package/src/lib/components/{layout/CTA → CTA}/CTA.scss +2 -2
  35. package/src/lib/components/{layout/CTA → CTA}/CTACenter.jsx +1 -1
  36. package/src/lib/components/{layout/CTA → CTA}/CTAEnd.jsx +1 -1
  37. package/src/lib/components/{layout/CTA → CTA}/CTAStart.jsx +1 -1
  38. package/src/lib/components/{layout/CTA → CTA}/README.mdx +3 -3
  39. package/src/lib/components/{layout/CTA → CTA}/index.js +0 -0
  40. package/src/lib/components/{ui/Card → Card}/Card.jsx +6 -4
  41. package/src/lib/components/{ui/Card → Card}/Card.scss +1 -1
  42. package/src/lib/components/{ui/Card → Card}/CardBody.jsx +1 -1
  43. package/src/lib/components/{ui/Card → Card}/CardFooter.jsx +1 -1
  44. package/src/lib/components/{ui/Card → Card}/README.mdx +2 -2
  45. package/src/lib/components/{ui/Card → Card}/_theme.scss +0 -0
  46. package/src/lib/components/{ui/Card → Card}/_tools.scss +0 -0
  47. package/src/lib/components/{ui/Card → Card}/index.js +0 -0
  48. package/src/lib/components/{layout/Center → Center}/Center.jsx +1 -1
  49. package/src/lib/components/{layout/Center → Center}/Center.scss +0 -0
  50. package/src/lib/components/{layout/Center → Center}/README.mdx +2 -2
  51. package/src/lib/components/{layout/Center → Center}/index.js +0 -0
  52. package/src/lib/components/CheckboxField/CheckboxField.jsx +164 -0
  53. package/src/lib/components/{ui/CheckboxField → CheckboxField}/CheckboxField.scss +5 -5
  54. package/src/lib/components/{ui/CheckboxField → CheckboxField}/README.mdx +15 -12
  55. package/src/lib/components/{ui/CheckboxField → CheckboxField}/index.js +0 -0
  56. package/src/lib/components/FileInputField/FileInputField.jsx +162 -0
  57. package/src/lib/components/{ui/FileInputField → FileInputField}/FileInputField.scss +5 -5
  58. package/src/lib/components/{ui/FileInputField → FileInputField}/README.mdx +8 -6
  59. package/src/lib/components/{ui/FileInputField → FileInputField}/index.js +0 -0
  60. package/src/lib/components/{layout/FormLayout → FormLayout}/FormLayout.jsx +16 -18
  61. package/src/lib/components/{layout/FormLayout → FormLayout}/FormLayout.scss +3 -3
  62. package/src/lib/components/FormLayout/FormLayoutContext.js +3 -0
  63. package/src/lib/components/{layout/FormLayout → FormLayout}/FormLayoutCustomField.jsx +33 -30
  64. package/src/lib/components/{layout/FormLayout → FormLayout}/FormLayoutCustomField.scss +4 -4
  65. package/src/lib/components/{layout/FormLayout → FormLayout}/README.mdx +30 -40
  66. package/src/lib/components/{layout/FormLayout → FormLayout}/_theme.scss +0 -0
  67. package/src/lib/components/{layout/FormLayout → FormLayout}/index.js +1 -0
  68. package/src/lib/components/{layout/Grid → Grid}/Grid.jsx +23 -5
  69. package/src/lib/components/{layout/Grid → Grid}/Grid.scss +2 -4
  70. package/src/lib/components/{layout/Grid → Grid}/GridSpan.jsx +10 -3
  71. package/src/lib/components/{layout/Grid → Grid}/README.mdx +42 -38
  72. package/src/lib/components/{layout/Grid → Grid}/_theme.scss +1 -2
  73. package/src/lib/components/{layout/Grid → Grid}/_tools.scss +2 -2
  74. package/src/lib/components/{layout/Grid → Grid}/helpers/generateResponsiveCustomProperties.js +0 -0
  75. package/src/lib/components/{layout/Grid → Grid}/index.js +0 -0
  76. package/src/lib/components/Link/Link.jsx +45 -0
  77. package/src/lib/components/Link/Link.scss +11 -0
  78. package/src/lib/components/Link/README.mdx +85 -0
  79. package/src/lib/components/Link/_theme.scss +4 -0
  80. package/src/lib/components/Link/index.js +1 -0
  81. package/src/lib/components/{layout/List → List}/List.jsx +1 -1
  82. package/src/lib/components/{layout/List → List}/List.scss +2 -2
  83. package/src/lib/components/{layout/List → List}/ListItem.jsx +1 -1
  84. package/src/lib/components/{layout/List → List}/README.mdx +2 -2
  85. package/src/lib/components/{layout/List → List}/_theme.scss +0 -0
  86. package/src/lib/components/{layout/List → List}/index.js +0 -0
  87. package/src/lib/components/{layout/Media → Media}/Media.jsx +4 -2
  88. package/src/lib/components/{layout/Media → Media}/Media.scss +1 -1
  89. package/src/lib/components/{layout/Media → Media}/MediaBody.jsx +1 -1
  90. package/src/lib/components/{layout/Media → Media}/MediaObject.jsx +1 -1
  91. package/src/lib/components/{layout/Media → Media}/README.mdx +2 -2
  92. package/src/lib/components/{layout/Media → Media}/index.js +0 -0
  93. package/src/lib/components/{ui/Modal → Modal}/Modal.jsx +28 -27
  94. package/src/lib/components/{ui/Modal → Modal}/Modal.scss +5 -5
  95. package/src/lib/components/{ui/Modal → Modal}/README.mdx +40 -40
  96. package/src/lib/components/{ui/Modal → Modal}/_settings.scss +4 -4
  97. package/src/lib/components/{ui/Modal → Modal}/_theme.scss +0 -0
  98. package/src/lib/components/{ui/Modal → Modal}/index.js +0 -0
  99. package/src/lib/components/{ui/Paper → Paper}/Paper.jsx +8 -1
  100. package/src/lib/components/{ui/Paper → Paper}/Paper.scss +5 -0
  101. package/src/lib/components/{ui/Paper → Paper}/README.mdx +14 -2
  102. package/src/lib/components/{ui/Paper → Paper}/_theme.scss +2 -0
  103. package/src/lib/components/{ui/Paper → Paper}/index.js +0 -0
  104. package/src/lib/components/{ui/Radio → Radio}/README.mdx +17 -14
  105. package/src/lib/components/Radio/Radio.jsx +188 -0
  106. package/src/lib/components/{ui/Radio → Radio}/Radio.scss +9 -9
  107. package/src/lib/components/{ui/Radio → Radio}/index.js +0 -0
  108. package/src/lib/components/{ui/ScrollView → ScrollView}/README.mdx +10 -10
  109. package/src/lib/components/{ui/ScrollView → ScrollView}/ScrollView.jsx +9 -10
  110. package/src/lib/components/{ui/ScrollView → ScrollView}/ScrollView.scss +6 -6
  111. package/src/lib/components/{ui/ScrollView → ScrollView}/_theme.scss +0 -0
  112. package/src/lib/components/{ui/ScrollView → ScrollView}/index.js +0 -0
  113. package/src/lib/components/{ui/SelectField → SelectField}/README.mdx +44 -41
  114. package/src/lib/components/SelectField/SelectField.jsx +219 -0
  115. package/src/lib/components/{ui/SelectField → SelectField}/SelectField.scss +6 -6
  116. package/src/lib/components/{ui/SelectField → SelectField}/index.js +0 -0
  117. package/src/lib/components/{ui/Table → Table}/README.mdx +7 -7
  118. package/src/lib/components/{ui/Table → Table}/Table.jsx +9 -13
  119. package/src/lib/components/{ui/Table → Table}/Table.scss +1 -1
  120. package/src/lib/components/{ui/Table → Table}/_settings.scss +4 -4
  121. package/src/lib/components/{ui/Table → Table}/index.js +0 -0
  122. package/src/lib/components/{ui/Tabs → Tabs}/README.mdx +3 -3
  123. package/src/lib/components/{ui/Tabs → Tabs}/Tabs.jsx +4 -4
  124. package/src/lib/components/{ui/Tabs → Tabs}/Tabs.scss +1 -1
  125. package/src/lib/components/{ui/Tabs → Tabs}/TabsItem.jsx +4 -3
  126. package/src/lib/components/{ui/Tabs → Tabs}/TabsItem.scss +3 -3
  127. package/src/lib/components/{ui/Tabs → Tabs}/_theme.scss +0 -0
  128. package/src/lib/components/{ui/Tabs → Tabs}/index.js +0 -0
  129. package/src/lib/components/{ui/Text → Text}/README.mdx +19 -19
  130. package/src/lib/components/{ui/Text → Text}/Text.jsx +1 -1
  131. package/src/lib/components/{ui/Text → Text}/Text.scss +0 -0
  132. package/src/lib/components/{ui/Text → Text}/helpers/getRootHyphensClassName.js +0 -0
  133. package/src/lib/components/{ui/Text → Text}/helpers/getRootWordWrappingClassName.js +0 -0
  134. package/src/lib/components/{ui/Text → Text}/index.js +0 -0
  135. package/src/lib/components/{ui/TextArea → TextArea}/README.mdx +8 -6
  136. package/src/lib/components/{ui/TextArea → TextArea}/TextArea.jsx +78 -78
  137. package/src/lib/components/{ui/TextArea → TextArea}/TextArea.scss +6 -6
  138. package/src/lib/components/{ui/TextArea → TextArea}/index.js +0 -0
  139. package/src/lib/components/{ui/TextField → TextField}/README.mdx +7 -6
  140. package/src/lib/components/{ui/TextField → TextField}/TextField.jsx +20 -23
  141. package/src/lib/components/{ui/TextField → TextField}/TextField.scss +6 -6
  142. package/src/lib/components/{ui/TextField → TextField}/index.js +0 -0
  143. package/src/lib/components/{ui/Toggle → Toggle}/README.mdx +15 -12
  144. package/src/lib/components/Toggle/Toggle.jsx +163 -0
  145. package/src/lib/components/{ui/Toggle → Toggle}/Toggle.scss +5 -5
  146. package/src/lib/components/{ui/Toggle → Toggle}/index.js +0 -0
  147. package/src/lib/components/{layout/Toolbar → Toolbar}/README.mdx +26 -26
  148. package/src/lib/components/{layout/Toolbar → Toolbar}/Toolbar.jsx +1 -1
  149. package/src/lib/components/{layout/Toolbar → Toolbar}/Toolbar.scss +1 -1
  150. package/src/lib/components/{layout/Toolbar → Toolbar}/ToolbarGroup.jsx +1 -1
  151. package/src/lib/components/{layout/Toolbar → Toolbar}/ToolbarItem.jsx +1 -1
  152. package/src/lib/components/{layout/Toolbar → Toolbar}/_theme.scss +0 -0
  153. package/src/lib/components/{layout/Toolbar → Toolbar}/index.js +0 -0
  154. package/src/lib/components/{ui/withForwardedRef.jsx → withForwardedRef.jsx} +0 -0
  155. package/src/lib/helpers/resolveContextOrProp.js +7 -0
  156. package/src/lib/index.js +34 -35
  157. package/src/lib/styles/tools/_accessibility.scss +9 -0
  158. package/src/lib/theme.scss +25 -7
  159. package/src/lib/components/ui/Button/Button.jsx +0 -191
  160. package/src/lib/components/ui/Button/_base.scss +0 -154
  161. package/src/lib/components/ui/Button/helpers/getRootLabelVisibilityClassName.js +0 -11
  162. package/src/lib/components/ui/ButtonGroup/index.js +0 -1
  163. package/src/lib/components/ui/CheckboxField/CheckboxField.jsx +0 -173
  164. package/src/lib/components/ui/FileInputField/FileInputField.jsx +0 -158
  165. package/src/lib/components/ui/Radio/Radio.jsx +0 -179
  166. package/src/lib/components/ui/SelectField/SelectField.jsx +0 -214
  167. package/src/lib/components/ui/Toggle/Toggle.jsx +0 -174
@@ -1,12 +1,12 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import { createPortal } from 'react-dom';
4
- import transferProps from '../../../utils/transferProps';
5
- import { withProviderContext } from '../../../provider';
4
+ import transferProps from '../../utils/transferProps';
5
+ import { withProviderContext } from '../../provider';
6
6
  import {
7
7
  Toolbar,
8
8
  ToolbarItem,
9
- } from '../../layout/Toolbar';
9
+ } from '../Toolbar';
10
10
  import Button from '../Button';
11
11
  import ScrollView from '../ScrollView';
12
12
  import styles from './Modal.scss';
@@ -54,18 +54,18 @@ export class Modal extends React.Component {
54
54
  keyPressHandler(e) {
55
55
  const {
56
56
  actions,
57
- closeHandler,
57
+ onClose,
58
58
  } = this.props;
59
59
 
60
- if (e.keyCode === 27 && closeHandler) {
61
- closeHandler();
60
+ if (e.keyCode === 27 && onClose) {
61
+ onClose();
62
62
  }
63
63
 
64
64
  if (e.keyCode === 13 && e.target.nodeName !== 'BUTTON') {
65
65
  const submitAction = actions.find((action) => action.type === 'submit');
66
66
 
67
67
  if (submitAction && !submitAction.disabled) {
68
- submitAction.clickHandler(e);
68
+ submitAction.onClick(e);
69
69
  }
70
70
  }
71
71
  }
@@ -74,8 +74,8 @@ export class Modal extends React.Component {
74
74
  const {
75
75
  actions,
76
76
  children,
77
- closeHandler,
78
77
  id,
78
+ onClose,
79
79
  position,
80
80
  scrollView,
81
81
  size,
@@ -147,8 +147,8 @@ export class Modal extends React.Component {
147
147
  className={styles.backdrop}
148
148
  id={id}
149
149
  onClick={(e) => {
150
- if (closeHandler) {
151
- closeHandler(e);
150
+ if (onClose) {
151
+ onClose(e);
152
152
  }
153
153
  }}
154
154
  role="presentation"
@@ -171,11 +171,11 @@ export class Modal extends React.Component {
171
171
  >
172
172
  {title}
173
173
  </h3>
174
- {closeHandler && (
174
+ {onClose && (
175
175
  <button
176
176
  type="button"
177
177
  className={styles.close}
178
- onClick={closeHandler}
178
+ onClick={onClose}
179
179
  title={translations.close}
180
180
  {...(id && { id: `${id}__closeModalHeaderButton` })}
181
181
  >
@@ -184,29 +184,29 @@ export class Modal extends React.Component {
184
184
  )}
185
185
  </div>
186
186
  {modalBody()}
187
- {(actions.length || closeHandler) && (
187
+ {(actions.length || onClose) && (
188
188
  <div className={styles.footer}>
189
189
  <Toolbar justify="center" dense>
190
190
  {actions.map((action) => (
191
191
  <ToolbarItem key={action.label}>
192
192
  <Button
193
193
  {...transferProps(action)}
194
- clickHandler={action.clickHandler}
195
194
  color={action.color}
196
195
  disabled={action.disabled}
196
+ feedbackIcon={action.feedbackIcon}
197
+ forwardedRef={this.submitButtonRef}
197
198
  id={action.id || undefined}
198
199
  label={action.label}
199
- loadingIcon={action.loadingIcon}
200
- forwardedRef={this.submitButtonRef}
200
+ onClick={action.onClick}
201
201
  type="button"
202
202
  />
203
203
  </ToolbarItem>
204
204
  ))}
205
- {closeHandler && (
205
+ {onClose && (
206
206
  <ToolbarItem>
207
207
  <Button
208
- clickHandler={closeHandler}
209
208
  label={translations.close}
209
+ onClick={onClose}
210
210
  priority="flat"
211
211
  {...(id && { id: `${id}__closeModalFooterButton` })}
212
212
  />
@@ -234,8 +234,8 @@ export class Modal extends React.Component {
234
234
  Modal.defaultProps = {
235
235
  actions: [],
236
236
  autoFocus: true,
237
- closeHandler: null,
238
237
  id: undefined,
238
+ onClose: null,
239
239
  portalId: null,
240
240
  position: 'center',
241
241
  scrollView: (<ScrollView
@@ -251,12 +251,12 @@ Modal.propTypes = {
251
251
  * Actions to be rendered in modal footer.
252
252
  */
253
253
  actions: PropTypes.arrayOf(PropTypes.shape({
254
- clickHandler: PropTypes.func.isRequired,
255
254
  color: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark']),
256
255
  disabled: PropTypes.bool,
256
+ feedbackIcon: PropTypes.node,
257
257
  id: PropTypes.string,
258
258
  label: PropTypes.string.isRequired,
259
- loadingIcon: PropTypes.node,
259
+ onClick: PropTypes.func.isRequired,
260
260
  })),
261
261
  /**
262
262
  * If `true`, focus the first action in the footer when the modal is opened.
@@ -267,15 +267,16 @@ Modal.propTypes = {
267
267
  */
268
268
  children: PropTypes.node.isRequired,
269
269
  /**
270
- * If a function is provided, the close buttons will be displayed.
270
+ * ID of the root HTML element. It also serves as a base for nested elements:
271
+ * * `<ID>__content`
272
+ * * `<ID>__closeModalHeaderButton`
273
+ * * `<ID>__closeModalFooterButton`
271
274
  */
272
- closeHandler: PropTypes.func,
275
+ id: PropTypes.string,
273
276
  /**
274
- * ID of the root HTML element. It also serves as a prefix for the element holding the content of
275
- * the modal and for the close buttons: `<ID>__content`, `<ID>__closeModalHeaderButton`,
276
- * `<ID>__closeModalFooterButton`.
277
+ * If a function is provided, the close buttons will be displayed.
277
278
  */
278
- id: PropTypes.string,
279
+ onClose: PropTypes.func,
279
280
  /**
280
281
  * If set, the modal is rendered in the React Portal with that ID.
281
282
  */
@@ -1,9 +1,9 @@
1
1
  @use 'sass:map';
2
- @use '../../../styles/theme/typography';
3
- @use '../../../styles/tools/accessibility';
4
- @use '../../../styles/tools/breakpoint';
5
- @use '../../../styles/tools/reset';
6
- @use '../../../styles/tools/spacing';
2
+ @use '../../styles/theme/typography';
3
+ @use '../../styles/tools/accessibility';
4
+ @use '../../styles/tools/breakpoint';
5
+ @use '../../styles/tools/reset';
6
+ @use '../../styles/tools/spacing';
7
7
  @use 'settings';
8
8
  @use 'theme';
9
9
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: Modal
3
- menu: 'UI'
4
- route: /components/ui/modal
3
+ menu: 'Miscellaneous'
4
+ route: /components/modal
5
5
  ---
6
6
 
7
7
  # Modal
@@ -34,20 +34,20 @@ And use it:
34
34
  return (
35
35
  <>
36
36
  <Button
37
- clickHandler={() => setModalOpen(true)}
38
37
  label="Launch modal"
38
+ onClick={() => setModalOpen(true)}
39
39
  priority="outline"
40
40
  />
41
41
  <div>
42
42
  {modalOpen && (
43
43
  <Modal
44
- title="Warning"
45
44
  actions={[{
46
- clickHandler: () => setModalOpen(false),
47
- label: 'Delete',
48
45
  color: 'danger',
46
+ label: 'Delete',
47
+ onClick: () => setModalOpen(false),
49
48
  }]}
50
- closeHandler={() => setModalOpen(false)}
49
+ onClose={() => setModalOpen(false)}
50
+ title="Warning"
51
51
  >
52
52
  <p>
53
53
  Do you really want to delete the user <code>admin</code>?
@@ -96,48 +96,48 @@ Modals of any size automatically shrink when they cannot fit the screen width.
96
96
  return (
97
97
  <>
98
98
  <Button
99
- clickHandler={() => {
99
+ label="Launch small modal"
100
+ onClick={() => {
100
101
  setModalSize('small');
101
102
  setModalOpen(true);
102
103
  }}
103
- label="Launch small modal"
104
104
  priority="outline"
105
105
  />
106
106
  <Button
107
- clickHandler={() => {
107
+ label="Launch medium modal"
108
+ onClick={() => {
108
109
  setModalSize('medium');
109
110
  setModalOpen(true);
110
111
  }}
111
- label="Launch medium modal"
112
112
  priority="outline"
113
113
  />
114
114
  <Button
115
- clickHandler={() => {
115
+ label="Launch large modal"
116
+ onClick={() => {
116
117
  setModalSize('large');
117
118
  setModalOpen(true);
118
119
  }}
119
- label="Launch large modal"
120
120
  priority="outline"
121
121
  />
122
122
  <Button
123
- clickHandler={() => {
123
+ label="Launch fullscreen modal"
124
+ onClick={() => {
124
125
  setModalSize('fullscreen');
125
126
  setModalOpen(true);
126
127
  }}
127
- label="Launch fullscreen modal"
128
128
  priority="outline"
129
129
  />
130
130
  <div>
131
131
  {modalOpen && (
132
132
  <Modal
133
- title="Delete the user?"
134
133
  actions={[{
135
- clickHandler: () => setModalOpen(false),
136
- label: 'Delete',
137
134
  color: 'danger',
135
+ label: 'Delete',
136
+ onClick: () => setModalOpen(false),
138
137
  }]}
139
- closeHandler={() => setModalOpen(false)}
138
+ onClose={() => setModalOpen(false)}
140
139
  size={modalSize}
140
+ title="Delete the user?"
141
141
  >
142
142
  <p>
143
143
  Do you really want to delete the user <code>admin</code>?
@@ -164,21 +164,21 @@ magic that doesn't work together yet 🎩.
164
164
  return (
165
165
  <>
166
166
  <Button
167
- clickHandler={() => setModalOpen(true)}
168
167
  label="Launch auto-width modal"
168
+ onClick={() => setModalOpen(true)}
169
169
  priority="outline"
170
170
  />
171
171
  <div>
172
172
  {modalOpen && (
173
173
  <Modal
174
- title="Delete the user?"
175
174
  actions={[{
176
- clickHandler: () => setModalOpen(false),
177
- label: 'Delete',
178
175
  color: 'danger',
176
+ label: 'Delete',
177
+ onClick: () => setModalOpen(false),
179
178
  }]}
180
- closeHandler={() => setModalOpen(false)}
179
+ onClose={() => setModalOpen(false)}
181
180
  size="auto"
181
+ title="Delete the user?"
182
182
  >
183
183
  <p>
184
184
  Do you really want to delete the user <code>admin</code>?
@@ -203,32 +203,32 @@ Modal can be aligned either to top or center of the screen.
203
203
  return (
204
204
  <>
205
205
  <Button
206
- clickHandler={() => {
206
+ label="Launch modal at center"
207
+ onClick={() => {
207
208
  setModalPosition('center');
208
209
  setModalOpen(true);
209
210
  }}
210
- label="Launch modal at center"
211
211
  priority="outline"
212
212
  />
213
213
  <Button
214
- clickHandler={() => {
214
+ label="Launch modal at top"
215
+ onClick={() => {
215
216
  setModalPosition('top');
216
217
  setModalOpen(true);
217
218
  }}
218
- label="Launch modal at top"
219
219
  priority="outline"
220
220
  />
221
221
  <div>
222
222
  {modalOpen && (
223
223
  <Modal
224
- title="Delete the user?"
225
224
  actions={[{
226
- clickHandler: () => setModalOpen(false),
225
+ onClick: () => setModalOpen(false),
227
226
  label: 'Delete',
228
227
  color: 'danger',
229
228
  }]}
230
- closeHandler={() => setModalOpen(false)}
229
+ onClose={() => setModalOpen(false)}
231
230
  position={modalPosition}
231
+ title="Delete the user?"
232
232
  >
233
233
  <p>
234
234
  Do you really want to delete the user <code>admin</code>?
@@ -258,33 +258,33 @@ component.
258
258
  return (
259
259
  <>
260
260
  <Button
261
- clickHandler={() => {
261
+ label="Launch modal with scrolling body"
262
+ onClick={() => {
262
263
  setModalScrollView(true);
263
264
  setModalOpen(true);
264
265
  }}
265
- label="Launch modal with scrolling body"
266
266
  priority="outline"
267
267
  />
268
268
  <Button
269
- clickHandler={() => {
269
+ label="Launch scrolling modal"
270
+ onClick={() => {
270
271
  setModalScrollView(false);
271
272
  setModalOpen(true);
272
273
  }}
273
- label="Launch scrolling modal"
274
274
  priority="outline"
275
275
  />
276
276
  <div>
277
277
  {modalOpen && (
278
278
  <Modal
279
- title="Modal with long content"
280
279
  actions={[{
281
- clickHandler: () => setModalOpen(false),
282
280
  label: 'OK',
281
+ onClick: () => setModalOpen(false),
283
282
  }]}
284
283
  autoFocus={false}
285
- closeHandler={() => setModalOpen(false)}
284
+ onClose={() => setModalOpen(false)}
286
285
  scrollView={modalScrollView ? undefined : null}
287
286
  size="small"
287
+ title="Modal with long content"
288
288
  >
289
289
  <p>
290
290
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean
@@ -380,8 +380,8 @@ to prevent interaction. That's where blocking modals may come handy.
380
380
  return (
381
381
  <>
382
382
  <Button
383
- clickHandler={() => setModalOpen(true)}
384
383
  label="Launch blocking modal"
384
+ onClick={() => setModalOpen(true)}
385
385
  priority="outline"
386
386
  />
387
387
  <div>
@@ -393,8 +393,8 @@ to prevent interaction. That's where blocking modals may come handy.
393
393
  Don&apos;t turn off the device!
394
394
  </p>
395
395
  <Button
396
- clickHandler={() => setModalOpen(false)}
397
396
  label="Close the demo"
397
+ onClick={() => setModalOpen(false)}
398
398
  priority="flat"
399
399
  />
400
400
  </Modal>
@@ -1,8 +1,8 @@
1
1
  @use 'sass:map';
2
- @use '../../../styles/settings/z-indexes';
3
- @use '../../../styles/theme/borders';
4
- @use '../../../styles/theme/typography';
5
- @use '../../../styles/tools/spacing';
2
+ @use '../../styles/settings/z-indexes';
3
+ @use '../../styles/theme/borders';
4
+ @use '../../styles/theme/typography';
5
+ @use '../../styles/tools/spacing';
6
6
 
7
7
  $padding-x: spacing.of(5);
8
8
  $padding-y: spacing.of(3);
File without changes
@@ -1,16 +1,18 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { withProviderContext } from '../../../provider';
3
+ import { withProviderContext } from '../../provider';
4
4
  import styles from './Paper.scss';
5
5
 
6
6
  export const Paper = ({
7
7
  children,
8
8
  id,
9
+ muted,
9
10
  raised,
10
11
  }) => (
11
12
  <div
12
13
  className={[
13
14
  styles.root,
15
+ muted ? styles.rootMuted : '',
14
16
  raised ? styles.rootRaised : '',
15
17
  ].join(' ')}
16
18
  id={id}
@@ -22,6 +24,7 @@ export const Paper = ({
22
24
  Paper.defaultProps = {
23
25
  children: null,
24
26
  id: undefined,
27
+ muted: false,
25
28
  raised: false,
26
29
  };
27
30
 
@@ -34,6 +37,10 @@ Paper.propTypes = {
34
37
  * ID of the root HTML element.
35
38
  */
36
39
  id: PropTypes.string,
40
+ /**
41
+ * Visually suppress Paper.
42
+ */
43
+ muted: PropTypes.bool,
37
44
  /**
38
45
  * Add shadow to pull the Paper above surface.
39
46
  */
@@ -7,6 +7,11 @@
7
7
  background-color: theme.$background-color;
8
8
  }
9
9
 
10
+ .rootMuted {
11
+ background-color: theme.$muted-background-color;
12
+ opacity: theme.$muted-opacity;
13
+ }
14
+
10
15
  .rootRaised {
11
16
  box-shadow: theme.$raised-box-shadow;
12
17
  }
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: Paper
3
- menu: 'UI'
4
- route: /components/ui/paper
3
+ menu: 'Miscellaneous'
4
+ route: /components/paper
5
5
  ---
6
6
 
7
7
  # Paper
@@ -53,6 +53,16 @@ Add optional shadow to lift the paper above background.
53
53
  </Paper>
54
54
  </Playground>
55
55
 
56
+ ## Muted Paper
57
+
58
+ Dim background and add transparency to visually suppress the Paper.
59
+
60
+ <Playground>
61
+ <Paper muted>
62
+ Sssh! I&apos;m paper and I&apos;m muted.
63
+ </Paper>
64
+ </Playground>
65
+
56
66
  ## API
57
67
 
58
68
  <Props table of={Paper} />
@@ -66,4 +76,6 @@ Add optional shadow to lift the paper above background.
66
76
  | `--rui-Paper__border-color` | Border color |
67
77
  | `--rui-Paper__border-radius` | Corner radius |
68
78
  | `--rui-Paper__background-color` | Paper background color |
79
+ | `--rui-Paper--muted__background-color` | Background color of muted paper |
80
+ | `--rui-Paper--muted__opacity` | Opacity of muted paper |
69
81
  | `--rui-Paper--raised__box-shadow` | Box shadow of raised paper |
@@ -3,4 +3,6 @@ $border-width: var(--rui-Paper__border-width);
3
3
  $border-color: var(--rui-Paper__border-color);
4
4
  $border-radius: var(--rui-Paper__border-radius);
5
5
  $background-color: var(--rui-Paper__background-color);
6
+ $muted-background-color: var(--rui-Paper--muted__background-color);
7
+ $muted-opacity: var(--rui-Paper--muted__opacity);
6
8
  $raised-box-shadow: var(--rui-Paper--raised__box-shadow);
File without changes
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: Radio
3
- menu: 'UI'
4
- route: /components/ui/radio
3
+ menu: 'Inputs'
4
+ route: /components/radio
5
5
  ---
6
6
 
7
7
  # Radio
@@ -29,8 +29,8 @@ And use it:
29
29
  const [fruit, setFruit] = React.useState('apple');
30
30
  return (
31
31
  <Radio
32
- changeHandler={(e) => setFruit(e.target.value)}
33
32
  label="Your favourite fruit"
33
+ onChange={(e) => setFruit(e.target.value)}
34
34
  options={[
35
35
  {
36
36
  label: 'Apple',
@@ -91,9 +91,9 @@ the input.
91
91
  const [frequency, setFrequency] = React.useState('weekly');
92
92
  return (
93
93
  <Radio
94
- changeHandler={(e) => setFrequency(e.target.value)}
95
94
  isLabelVisible={false}
96
95
  label="Newsletter frequency"
96
+ onChange={(e) => setFrequency(e.target.value)}
97
97
  options={[
98
98
  {
99
99
  label: 'I want to subscribe to the weekly newsletter',
@@ -125,9 +125,9 @@ supports this kind of layout as well.
125
125
  const [frequency, setFrequency] = React.useState('weekly');
126
126
  return (
127
127
  <Radio
128
- changeHandler={(e) => setFrequency(e.target.value)}
129
128
  label="Newsletter frequency"
130
129
  layout="horizontal"
130
+ onChange={(e) => setFrequency(e.target.value)}
131
131
  options={[
132
132
  {
133
133
  label: 'I want to subscribe to the weekly newsletter',
@@ -158,9 +158,9 @@ filled.
158
158
  const [fruit, setFruit] = React.useState('apple');
159
159
  return (
160
160
  <Radio
161
- changeHandler={(e) => setFruit(e.target.value)}
162
161
  helpText="What do you prefer?"
163
162
  label="Your favourite fruit"
163
+ onChange={(e) => setFruit(e.target.value)}
164
164
  options={[
165
165
  {
166
166
  label: 'Apple',
@@ -210,8 +210,8 @@ have.
210
210
  return (
211
211
  <>
212
212
  <Radio
213
- changeHandler={(e) => setFruit(e.target.value)}
214
213
  label="Your favourite fruit"
214
+ onChange={(e) => setFruit(e.target.value)}
215
215
  options={options}
216
216
  required
217
217
  validationState="valid"
@@ -219,8 +219,8 @@ have.
219
219
  value={fruit}
220
220
  />
221
221
  <Radio
222
- changeHandler={(e) => setFruit(e.target.value)}
223
222
  label="Your favourite fruit"
223
+ onChange={(e) => setFruit(e.target.value)}
224
224
  options={options}
225
225
  required
226
226
  validationState="warning"
@@ -228,8 +228,8 @@ have.
228
228
  value={fruit}
229
229
  />
230
230
  <Radio
231
- changeHandler={(e) => setFruit(e.target.value)}
232
231
  label="Your favourite fruit"
232
+ onChange={(e) => setFruit(e.target.value)}
233
233
  options={options}
234
234
  required
235
235
  validationState="invalid"
@@ -266,15 +266,15 @@ It's possible to disable just some options or the whole set.
266
266
  return (
267
267
  <>
268
268
  <Radio
269
- changeHandler={(e) => setFruit(e.target.value)}
270
269
  label="Your favourite fruit"
270
+ onChange={(e) => setFruit(e.target.value)}
271
271
  options={options}
272
272
  value={fruit}
273
273
  />
274
274
  <Radio
275
- changeHandler={(e) => setFruit(e.target.value)}
276
275
  disabled
277
276
  label="Your favourite fruit"
277
+ onChange={(e) => setFruit(e.target.value)}
278
278
  options={options}
279
279
  value="apple"
280
280
  />
@@ -285,9 +285,10 @@ It's possible to disable just some options or the whole set.
285
285
 
286
286
  ## API
287
287
 
288
- In addition to the options below, you can add any custom attributes that do not
289
- interfere with the API, and they will be passed to the `input` HTML element.
290
- This is useful mainly to improve component's accessibility.
288
+ In addition to the options below, you can specify [React synthetic events] or
289
+ any custom HTML attributes that do not interfere with the API, and they will be
290
+ passed to the `input` HTML element. This enables making the component
291
+ interactive and helps improve its accessibility.
291
292
 
292
293
  <Props table of={Radio} />
293
294
 
@@ -300,3 +301,5 @@ options. On top of that, the following options are available for Radio.
300
301
  |--------------------------------------------------------------------|------------------------------------------------|
301
302
  | `--rui-FormField--check__input--radio__border-radius` | Input corner radius |
302
303
  | `--rui-FormField--check__input--radio--checked__background-image` | Checked input background image (inline, URL, …) |
304
+
305
+ [React synthetic events]: https://reactjs.org/docs/events.html