@react-ui-org/react-ui 0.42.0 → 0.44.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 (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,7 +1,7 @@
1
1
  ---
2
2
  name: Button
3
- menu: 'UI'
4
- route: /components/ui/button
3
+ menu: 'Actions'
4
+ route: /components/button
5
5
  ---
6
6
 
7
7
  # Button
@@ -10,8 +10,8 @@ import {
10
10
  Playground,
11
11
  Props,
12
12
  } from 'docz'
13
- import Icon from '../../../../docs/_components/Icon'
14
- import Placeholder from '../../../../docs/_components/Placeholder'
13
+ import Icon from '../../../docs/_components/Icon'
14
+ import Placeholder from '../../../docs/_components/Placeholder'
15
15
  import Badge from '../Badge'
16
16
  import { Button } from './Button'
17
17
 
@@ -55,9 +55,6 @@ lowest:
55
55
  All priorities come in supported
56
56
  [component colors](/foundation/colors#component-colors).
57
57
 
58
- To complete the list, there is also a [link priority](#link)
59
- which is reserved for special cases.
60
-
61
58
  ### Filled
62
59
 
63
60
  The default, high-emphasis priority should be used for primary actions of your
@@ -121,21 +118,6 @@ the content.
121
118
  <Button priority="flat" label="Dark" color="dark" />
122
119
  </Playground>
123
120
 
124
- ### Link
125
-
126
- Link button is more a workaround than a priority level. Use it for what needs
127
- to appear as navigation to users but where a button must be used due to
128
- technical reasons. Under normal circumstances, you should always use a link
129
- HTML element `<a href="…">` for navigation.
130
-
131
- ⚠️ **Avoid using link buttons for actions**, choose flat or outline priority
132
- instead. This is because users expect navigation to happen when clicking on
133
- something what looks like a link.
134
-
135
- <Playground>
136
- <Button label="Link that needs to be implemented as button" priority="link" />
137
- </Playground>
138
-
139
121
  ## Sizes
140
122
 
141
123
  Aside from the default (medium) size, two additional sizes are available: small
@@ -170,29 +152,55 @@ before or after the button's label.
170
152
  label="Icon after label"
171
153
  afterLabel={<Icon icon="star" />}
172
154
  />
173
- <Button
174
- label="Link button with icon"
175
- beforeLabel={<Icon icon="star" />}
176
- priority="link"
177
- />
178
155
  </Playground>
179
156
 
180
157
  ### Icon Buttons
181
158
 
182
159
  For clear and simple actions, buttons can visually consist just of an icon.
183
- Label remains mandatory to keep the button accessible. Icon buttons can
184
- optionally enhance on desktop and display the label once there is enough room
185
- for it.
160
+ Label remains mandatory to keep the button accessible.
186
161
 
187
162
  <Playground>
188
163
  <Button
189
164
  label="Icon button"
190
165
  labelVisibility="none"
191
- afterLabel={<Icon icon="pencil" />}
166
+ beforeLabel={<Icon icon="pencil" />}
167
+ />
168
+ </Playground>
169
+
170
+ Icon buttons can optionally enhance on a [breakpoint](/foundation/breakpoints)
171
+ of your choice and display label once you know there is enough room for it.
172
+
173
+ 📐 Try resizing your browser to see how label visibility changes.
174
+
175
+ <Playground>
176
+ <Button
177
+ label="Label visible from sm up"
178
+ labelVisibility="sm"
179
+ beforeLabel={<Icon icon="pencil" />}
180
+ />
181
+ <Button
182
+ label="Label visible from md up"
183
+ labelVisibility="md"
184
+ beforeLabel={<Icon icon="pencil" />}
185
+ />
186
+ <Button
187
+ label="Label visible from lg up"
188
+ labelVisibility="lg"
189
+ beforeLabel={<Icon icon="pencil" />}
190
+ />
191
+ <Button
192
+ label="Label visible from xl up"
193
+ labelVisibility="xl"
194
+ beforeLabel={<Icon icon="pencil" />}
195
+ />
196
+ <Button
197
+ label="Label visible from xxl up"
198
+ labelVisibility="xxl"
199
+ beforeLabel={<Icon icon="pencil" />}
192
200
  />
193
201
  <Button
194
- label="Icon button with label visible on desktop"
195
- labelVisibility="desktop"
202
+ label="Label visible from xxxl up"
203
+ labelVisibility="xxxl"
196
204
  beforeLabel={<Icon icon="pencil" />}
197
205
  />
198
206
  </Playground>
@@ -237,7 +245,7 @@ Badges play nicely with icon buttons, too:
237
245
  />
238
246
  <Button
239
247
  label="Icon button with badge"
240
- labelVisibility="desktop"
248
+ labelVisibility="md"
241
249
  priority="outline"
242
250
  beforeLabel={<Icon icon="warning-sign" />}
243
251
  startCorner={<Badge label={3} color="danger" />}
@@ -256,46 +264,127 @@ Disabled state makes the action unavailable.
256
264
  <Button label="Disabled flat button" priority="flat" disabled />
257
265
  </Playground>
258
266
 
259
- ### Loading State
267
+ ### Feedback State
268
+
269
+ When user's action triggers an asynchronous process on background, the button's
270
+ feedback state can be indicated by showing an icon. The icon replaces button's
271
+ label while retaining original dimensions of the button. Buttons in feedback
272
+ state are automatically disabled to prevent unwanted interaction.
260
273
 
261
- When an action triggers an asynchronous process on background, the button's
262
- loading state can be indicated by showing a loading icon. Buttons in loading
263
- state are automatically made disabled to prevent unwanted interaction.
274
+ Filled buttons in feedback state:
264
275
 
265
276
  <Playground>
266
277
  <Button
267
- label="Button in loading state"
268
- loadingIcon={(
269
- <span className="d-inline-flex animation-spin-counterclockwise">
270
- <Icon icon="loading" />
271
- </span>
272
- )}
278
+ label="Success"
279
+ color="success"
280
+ feedbackIcon={<Icon icon="success" />}
273
281
  />
274
282
  <Button
275
- label="Icon button in loading state"
283
+ label="Success"
276
284
  labelVisibility="none"
277
- beforeLabel={<Icon icon="pencil" />}
278
- loadingIcon={(
285
+ color="success"
286
+ feedbackIcon={<Icon icon="success" />}
287
+ endCorner={<Badge color="danger" label={3} />}
288
+ />
289
+ <Placeholder dark inline>
290
+ <Button
291
+ label="Light"
292
+ color="light"
293
+ feedbackIcon={<Icon icon="success" />}
294
+ />
295
+ </Placeholder>
296
+ <Button
297
+ label="Dark"
298
+ color="dark"
299
+ feedbackIcon={<Icon icon="success" />}
300
+ />
301
+ <Button
302
+ label="Primary"
303
+ feedbackIcon={(
279
304
  <span className="d-inline-flex animation-spin-counterclockwise">
280
305
  <Icon icon="loading" />
281
306
  </span>
282
307
  )}
283
308
  />
309
+ </Playground>
310
+
311
+ Outline buttons in feedback state:
312
+
313
+ <Playground>
314
+ <Button
315
+ label="Success"
316
+ priority="outline"
317
+ color="success"
318
+ feedbackIcon={<Icon icon="success" />}
319
+ />
284
320
  <Button
285
- label="Icon button with badge, loading"
286
- labelVisibility="desktop"
287
- beforeLabel={<Icon icon="pencil" />}
288
- loadingIcon={(
321
+ label="Success"
322
+ labelVisibility="none"
323
+ priority="outline"
324
+ color="success"
325
+ feedbackIcon={<Icon icon="success" />}
326
+ endCorner={<Badge color="danger" label={3} />}
327
+ />
328
+ <Placeholder dark inline>
329
+ <Button
330
+ label="Light"
331
+ priority="outline"
332
+ color="light"
333
+ feedbackIcon={<Icon icon="success" />}
334
+ />
335
+ </Placeholder>
336
+ <Button
337
+ label="Dark"
338
+ priority="outline"
339
+ color="dark"
340
+ feedbackIcon={<Icon icon="success" />}
341
+ />
342
+ <Button
343
+ label="Primary"
344
+ priority="outline"
345
+ feedbackIcon={(
289
346
  <span className="d-inline-flex animation-spin-counterclockwise">
290
347
  <Icon icon="loading" />
291
348
  </span>
292
349
  )}
293
- startCorner={<Badge label={3} color="danger" />}
350
+ />
351
+ </Playground>
352
+
353
+ Flat buttons in feedback state:
354
+
355
+ <Playground>
356
+ <Button
357
+ label="Success"
358
+ priority="flat"
359
+ color="success"
360
+ feedbackIcon={<Icon icon="success" />}
361
+ />
362
+ <Button
363
+ label="Success"
364
+ labelVisibility="none"
365
+ priority="flat"
366
+ color="success"
367
+ feedbackIcon={<Icon icon="success" />}
368
+ endCorner={<Badge color="danger" label={3} />}
369
+ />
370
+ <Placeholder dark inline>
371
+ <Button
372
+ label="Light"
373
+ priority="flat"
374
+ color="light"
375
+ feedbackIcon={<Icon icon="success" />}
376
+ />
377
+ </Placeholder>
378
+ <Button
379
+ label="Dark"
380
+ priority="flat"
381
+ color="dark"
382
+ feedbackIcon={<Icon icon="success" />}
294
383
  />
295
384
  <Button
296
- label="Icon after label, loading"
297
- afterLabel={<Icon icon="up" />}
298
- loadingIcon={(
385
+ label="Primary"
386
+ priority="flat"
387
+ feedbackIcon={(
299
388
  <span className="d-inline-flex animation-spin-counterclockwise">
300
389
  <Icon icon="loading" />
301
390
  </span>
@@ -308,9 +397,10 @@ animation is made.
308
397
 
309
398
  ## API
310
399
 
311
- In addition to the options below, you can add any custom attributes that do not
312
- interfere with the API, and they will be passed to the `button` HTML element.
313
- This is useful mainly to improve component's accessibility.
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.
314
404
 
315
405
  <Props table of={Button} />
316
406
 
@@ -318,9 +408,6 @@ This is useful mainly to improve component's accessibility.
318
408
 
319
409
  ### Common Theming Options
320
410
 
321
- The following theme options are common to all priorities and color variants
322
- **except** the `link` priority (see [below for more](#link-priority)):
323
-
324
411
  | Custom Property | Description |
325
412
  |--------------------------------|----------------------------------------------|
326
413
  | `--rui-Button__font-weight` | Font weight |
@@ -351,20 +438,6 @@ Where:
351
438
  - `color`, `border-color`, or `background` for the `outline` priority,
352
439
  - `color` or `background` for the `flat` priority.
353
440
 
354
- #### Theming Link Priority
355
-
356
- The `link` priority is treated a bit different because from the theming point of
357
- view it doesn't share anything with other priorities. However, it shares
358
- everything with common links and thus can be adjusted by editing corresponding
359
- design tokens:
360
-
361
- | Custom Property | Description |
362
- |-------------------------------|----------------------------------------------|
363
- | `--rui-link-color` | Text color |
364
- | `--rui-link-decoration` | Text decoration, e.g. underline |
365
- | `--rui-link-hover-color` | Text color on hover |
366
- | `--rui-link-hover-decoration` | Text decoration on hover |
367
-
368
441
  ### Theming Sizes
369
442
 
370
443
  Available sizes can be adjusted as follows:
@@ -470,3 +543,15 @@ Example:
470
543
  />
471
544
  </div>
472
545
  </Playground>
546
+
547
+ ### Theming Feedback State
548
+
549
+ Similarly to disabled state, opacity and cursor can be set for buttons in
550
+ feedback state.
551
+
552
+ | Custom Property | Description |
553
+ |-----------------------------------|------------------------------------------------------|
554
+ | `--rui-Button--feedback__opacity` | Opacity of buttons in feedback state |
555
+ | `--rui-Button--feedback__cursor` | Cursor to show on hovering buttons in feedback state |
556
+
557
+ [React synthetic events]: https://reactjs.org/docs/events.html
@@ -0,0 +1,148 @@
1
+ @use 'sass:map';
2
+ @use '../../styles/tools/breakpoint';
3
+ @use 'settings';
4
+ @use 'theme';
5
+ @use 'tools';
6
+
7
+ .root {
8
+ @include tools.button();
9
+ }
10
+
11
+ .label {
12
+ display: block;
13
+ }
14
+
15
+ .beforeLabel,
16
+ .afterLabel,
17
+ .startCorner,
18
+ .endCorner,
19
+ .feedbackIcon {
20
+ display: flex;
21
+ align-items: baseline;
22
+ justify-content: center;
23
+ }
24
+
25
+ .startCorner,
26
+ .endCorner {
27
+ position: absolute;
28
+ top: -0.35rem;
29
+ z-index: 2;
30
+ }
31
+
32
+ .startCorner {
33
+ left: 0;
34
+ margin-left: -0.35rem;
35
+ }
36
+
37
+ .endCorner {
38
+ right: 0;
39
+ margin-right: -0.35rem;
40
+ }
41
+
42
+ .feedbackIcon {
43
+ position: absolute;
44
+ top: 0;
45
+ right: 0;
46
+ bottom: 0;
47
+ left: 0;
48
+ z-index: 1;
49
+ align-items: center;
50
+ }
51
+
52
+ .rootSizeSmall {
53
+ @include tools.button-size(small);
54
+ }
55
+
56
+ .rootSizeMedium {
57
+ @include tools.button-size(medium);
58
+ }
59
+
60
+ .rootSizeLarge {
61
+ @include tools.button-size(large);
62
+ }
63
+
64
+ .rootBlock {
65
+ width: 100%;
66
+ }
67
+
68
+ .hasRootFeedback:disabled {
69
+ opacity: theme.$feedback-opacity;
70
+ cursor: theme.$feedback-cursor;
71
+ }
72
+
73
+ .hasRootFeedback .label,
74
+ .hasRootFeedback .beforeLabel,
75
+ .hasRootFeedback .afterLabel {
76
+ color: transparent;
77
+ }
78
+
79
+ .rootGrouped {
80
+ z-index: map.get(settings.$group-z-indexes, button);
81
+
82
+ &:not(:first-child) {
83
+ margin-left: var(--local-gap);
84
+ border-top-left-radius: 0;
85
+ border-bottom-left-radius: 0;
86
+ }
87
+
88
+ &:not(:last-child) {
89
+ border-top-right-radius: 0;
90
+ border-bottom-right-radius: 0;
91
+ }
92
+
93
+ &:focus,
94
+ &:not(:disabled):hover {
95
+ z-index: map.get(settings.$group-z-indexes, button-hover);
96
+ }
97
+ }
98
+
99
+ .rootGrouped .startCorner,
100
+ .rootGrouped .endCorner {
101
+ z-index: map.get(settings.$group-z-indexes, button-overflowing-elements);
102
+ }
103
+
104
+ .withLabelHidden,
105
+ .withLabelVisibleSm,
106
+ .withLabelVisibleMd,
107
+ .withLabelVisibleLg,
108
+ .withLabelVisibleXl,
109
+ .withLabelVisibleXxl,
110
+ .withLabelVisibleXxxl {
111
+ @include tools.hide-label();
112
+ }
113
+
114
+ .withLabelVisibleSm {
115
+ @include breakpoint.up(sm) {
116
+ @include tools.show-label();
117
+ }
118
+ }
119
+
120
+ .withLabelVisibleMd {
121
+ @include breakpoint.up(md) {
122
+ @include tools.show-label();
123
+ }
124
+ }
125
+
126
+ .withLabelVisibleLg {
127
+ @include breakpoint.up(lg) {
128
+ @include tools.show-label();
129
+ }
130
+ }
131
+
132
+ .withLabelVisibleXl {
133
+ @include breakpoint.up(xl) {
134
+ @include tools.show-label();
135
+ }
136
+ }
137
+
138
+ .withLabelVisibleXxl {
139
+ @include breakpoint.up(xxl) {
140
+ @include tools.show-label();
141
+ }
142
+ }
143
+
144
+ .withLabelVisibleXxxl {
145
+ @include breakpoint.up(xxxl) {
146
+ @include tools.show-label();
147
+ }
148
+ }
@@ -123,10 +123,6 @@
123
123
  @include tools.button-color(flat, dark);
124
124
  }
125
125
 
126
- .rootPriorityLink {
127
- @include tools.button-link();
128
- }
129
-
130
126
  .rootPriorityFilled.rootGrouped:not(:first-child)::before,
131
127
  .rootPriorityFlat.rootGrouped:not(:first-child)::before {
132
128
  content: '';
@@ -1,10 +1,9 @@
1
- @use '../../../styles/theme/typography';
2
- @use '../../../styles/tools/spacing';
1
+ @use '../../styles/theme/typography';
2
+ @use '../../styles/tools/spacing';
3
3
 
4
4
  $font-family: typography.$font-family-base;
5
5
  $line-height: typography.$line-height-base;
6
6
  $icon-spacing: spacing.of(2);
7
- $breakpoint: lg;
8
7
 
9
8
  $group-z-indexes: (
10
9
  button: auto,
@@ -6,8 +6,11 @@ $letter-spacing: var(--rui-Button__letter-spacing);
6
6
  $text-transform: var(--rui-Button__text-transform);
7
7
  $border-width: var(--rui-Button__border-width);
8
8
  $border-radius: var(--rui-Button__border-radius);
9
+
9
10
  $disabled-opacity: var(--rui-Button--disabled__opacity);
10
11
  $disabled-cursor: var(--rui-Button--disabled__cursor);
12
+ $feedback-opacity: var(--rui-Button--feedback__opacity);
13
+ $feedback-cursor: var(--rui-Button--feedback__cursor);
11
14
 
12
15
  $group-filled-gap: var(--rui-ButtonGroup--filled__gap);
13
16
  $group-filled-separator-width: var(--rui-ButtonGroup--filled__separator__width);
@@ -19,17 +22,6 @@ $group-flat-separator-color: var(--rui-ButtonGroup--flat__separator__color);
19
22
 
20
23
  $group-outline-gap: var(--rui-ButtonGroup--outline__gap);
21
24
 
22
- $link-priority-properties: (
23
- default: (
24
- color: var(--rui-link-color),
25
- text-decoration: var(--rui-link-decoration),
26
- ),
27
- hover: (
28
- color: var(--rui-link-hover-color),
29
- text-decoration: var(--rui-link-hover-decoration),
30
- ),
31
- );
32
-
33
25
  $sizes: (
34
26
  small: (
35
27
  height: var(--rui-Button--small__height),
@@ -6,9 +6,6 @@
6
6
  // - outline
7
7
  // - flat
8
8
  //
9
- // The “link” priority is treated separately as it doesn't share much of appearance with other
10
- // variants listed above.
11
- //
12
9
  // 2. Disabled state theming is optional so `default` theme options are used if no `disabled`
13
10
  // styling is provided for specific variant.
14
11
  //
@@ -16,15 +13,14 @@
16
13
  //
17
14
  // 4. Icon buttons should appear as squares, that's why width and height is equal here.
18
15
  //
19
- // 5. Unset undesired properties so the link button appears as link while it keeps some button
20
- // settings. It might be tempting to use something like `all: initial` or `all: inherit` but it
21
- // actually causes more harm rather than a useful reset.
16
+ // 5. Use original padding to restore square buttons back to their size.
22
17
 
23
18
  @use 'sass:list';
24
19
  @use 'sass:map';
25
20
  @use 'sass:math';
26
- @use '../../../styles/tools/breakpoint';
27
- @use '../../../styles/tools/transition';
21
+ @use '../../styles/tools/accessibility';
22
+ @use '../../styles/tools/breakpoint';
23
+ @use '../../styles/tools/transition';
28
24
  @use 'settings';
29
25
  @use 'theme';
30
26
 
@@ -65,20 +61,16 @@
65
61
  }
66
62
  }
67
63
 
68
- @mixin _unset-button-appearance() {
69
- width: unset;
70
- height: unset;
71
- padding: unset;
72
- font-weight: unset;
73
- line-height: unset;
74
- font-family: unset;
75
- text-transform: unset;
76
- vertical-align: unset;
77
- border: unset;
78
- border-radius: unset;
79
- box-shadow: unset;
80
- user-select: unset;
81
- transition: unset;
64
+ // 4.
65
+ @mixin _button-square() {
66
+ --rui-local-padding: 0;
67
+ --rui-local-width: var(--rui-local-height);
68
+ }
69
+
70
+ // 5.
71
+ @mixin _button-size-restore() {
72
+ --rui-local-padding: var(--rui-local-padding-original);
73
+ --rui-local-width: unset;
82
74
  }
83
75
 
84
76
  @mixin button() {
@@ -86,6 +78,7 @@
86
78
 
87
79
  position: relative; // 3.
88
80
  display: inline-flex;
81
+ column-gap: settings.$icon-spacing;
89
82
  align-items: center;
90
83
  justify-content: center;
91
84
  width: var(--rui-local-width, auto);
@@ -95,7 +88,6 @@
95
88
  letter-spacing: theme.$letter-spacing;
96
89
  text-align: center;
97
90
  text-decoration: none;
98
- text-overflow: ellipsis;
99
91
  text-transform: theme.$text-transform;
100
92
  vertical-align: middle;
101
93
  color: var(--rui-local-color);
@@ -126,20 +118,8 @@
126
118
 
127
119
  --rui-local-height: #{map.get($properties, height)};
128
120
  --rui-local-padding: 0 #{map.get($properties, padding-x)};
121
+ --rui-local-padding-original: 0 #{map.get($properties, padding-x)}; // 5.
129
122
  --rui-local-font-size: #{map.get($properties, font-size)};
130
-
131
- &.withLabelHidden,
132
- &.withLabelHiddenMobile {
133
- --rui-local-padding: 0;
134
- --rui-local-width: #{map.get($properties, height)}; // 4.
135
- }
136
-
137
- &.withLabelHiddenMobile {
138
- @include breakpoint.up(settings.$breakpoint) {
139
- --rui-local-padding: 0 #{map.get($properties, padding-x)};
140
- --rui-local-width: auto;
141
- }
142
- }
143
123
  }
144
124
 
145
125
  @mixin button-color($priority, $color) {
@@ -159,15 +139,18 @@
159
139
  }
160
140
  }
161
141
 
162
- @mixin button-link() {
163
- @include _unset-button-appearance(); // 5.
142
+ @mixin hide-label() {
143
+ @include _button-square();
144
+
145
+ .label {
146
+ @include accessibility.hide-text();
147
+ }
148
+ }
164
149
 
165
- text-decoration: map.get(theme.$link-priority-properties, default, text-decoration);
166
- color: map.get(theme.$link-priority-properties, default, color);
150
+ @mixin show-label() {
151
+ @include _button-size-restore();
167
152
 
168
- &:not(:disabled):hover,
169
- &:not(:disabled):focus {
170
- text-decoration: map.get(theme.$link-priority-properties, hover, text-decoration);
171
- color: map.get(theme.$link-priority-properties, hover, color);
153
+ .label {
154
+ @include accessibility.unhide-text();
172
155
  }
173
156
  }
@@ -0,0 +1,33 @@
1
+ export default (labelVisibility, styles) => {
2
+ // Intentionally omitting `xs` which means label is visible on all screen sizes.
3
+
4
+ if (labelVisibility === 'sm') {
5
+ return styles.withLabelVisibleSm;
6
+ }
7
+
8
+ if (labelVisibility === 'md') {
9
+ return styles.withLabelVisibleMd;
10
+ }
11
+
12
+ if (labelVisibility === 'lg') {
13
+ return styles.withLabelVisibleLg;
14
+ }
15
+
16
+ if (labelVisibility === 'xl') {
17
+ return styles.withLabelVisibleXl;
18
+ }
19
+
20
+ if (labelVisibility === 'xxl') {
21
+ return styles.withLabelVisibleXxl;
22
+ }
23
+
24
+ if (labelVisibility === 'xxxl') {
25
+ return styles.withLabelVisibleXxxl;
26
+ }
27
+
28
+ if (labelVisibility === 'none') {
29
+ return styles.withLabelHidden;
30
+ }
31
+
32
+ return null;
33
+ };