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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. package/CONTRIBUTING.md +7 -0
  2. package/dist/lib.development.js +209 -305
  3. package/dist/lib.js +1 -1
  4. package/package.json +10 -13
  5. package/src/lib/components/Alert/Alert.jsx +4 -3
  6. package/src/lib/components/Alert/Alert.scss +48 -48
  7. package/src/lib/components/Alert/_settings.scss +4 -4
  8. package/src/lib/components/Alert/_theme.scss +50 -50
  9. package/src/lib/components/Alert/_tools.scss +6 -6
  10. package/src/lib/components/Badge/Badge.jsx +6 -8
  11. package/src/lib/components/Badge/Badge.scss +57 -57
  12. package/src/lib/components/Button/Button.jsx +10 -9
  13. package/src/lib/components/Button/Button.scss +2 -2
  14. package/src/lib/components/Button/README.mdx +8 -3
  15. package/src/lib/components/Button/_base.scss +65 -65
  16. package/src/lib/components/Button/_priorities.scss +49 -49
  17. package/src/lib/components/Button/_settings.scss +10 -10
  18. package/src/lib/components/Button/_theme.scss +18 -15
  19. package/src/lib/components/Button/_tools.scss +98 -100
  20. package/src/lib/components/ButtonGroup/ButtonGroup.jsx +31 -22
  21. package/src/lib/components/ButtonGroup/ButtonGroup.scss +3 -3
  22. package/src/lib/components/ButtonGroup/README.mdx +4 -4
  23. package/src/lib/components/Card/Card.jsx +7 -6
  24. package/src/lib/components/Card/Card.scss +28 -28
  25. package/src/lib/components/Card/CardBody.jsx +5 -11
  26. package/src/lib/components/Card/CardFooter.jsx +10 -5
  27. package/src/lib/components/Card/README.mdx +2 -2
  28. package/src/lib/components/Card/_theme.scss +50 -50
  29. package/src/lib/components/Card/_tools.scss +6 -6
  30. package/src/lib/components/CheckboxField/CheckboxField.jsx +18 -17
  31. package/src/lib/components/CheckboxField/CheckboxField.scss +20 -20
  32. package/src/lib/components/CheckboxField/README.mdx +3 -3
  33. package/src/lib/components/FileInputField/FileInputField.jsx +13 -12
  34. package/src/lib/components/FileInputField/FileInputField.scss +19 -19
  35. package/src/lib/components/FileInputField/README.mdx +1 -1
  36. package/src/lib/components/FormLayout/FormLayout.jsx +16 -14
  37. package/src/lib/components/FormLayout/FormLayout.scss +17 -17
  38. package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +15 -9
  39. package/src/lib/components/FormLayout/FormLayoutCustomField.scss +18 -18
  40. package/src/lib/components/FormLayout/README.mdx +27 -49
  41. package/src/lib/components/Grid/Grid.jsx +4 -3
  42. package/src/lib/components/Grid/Grid.scss +32 -23
  43. package/src/lib/components/Grid/GridSpan.jsx +4 -3
  44. package/src/lib/components/Grid/{helpers → _helpers}/generateResponsiveCustomProperties.js +0 -2
  45. package/src/lib/components/Grid/_theme.scss +9 -9
  46. package/src/lib/components/Grid/_tools.scss +20 -20
  47. package/src/lib/components/List/List.jsx +14 -12
  48. package/src/lib/components/List/List.scss +21 -21
  49. package/src/lib/components/List/ListItem.jsx +3 -2
  50. package/src/lib/components/List/README.mdx +1 -1
  51. package/src/lib/components/Media/Media.jsx +12 -5
  52. package/src/lib/components/Media/Media.scss +6 -6
  53. package/src/lib/components/Media/MediaBody.jsx +18 -7
  54. package/src/lib/components/Media/MediaObject.jsx +18 -7
  55. package/src/lib/components/Modal/Modal.jsx +8 -6
  56. package/src/lib/components/Modal/Modal.scss +73 -73
  57. package/src/lib/components/Modal/README.mdx +2 -2
  58. package/src/lib/components/Modal/_settings.scss +5 -5
  59. package/src/lib/components/Modal/_theme.scss +17 -17
  60. package/src/lib/components/Paper/Paper.jsx +6 -6
  61. package/src/lib/components/Paper/Paper.scss +8 -8
  62. package/src/lib/components/Paper/README.mdx +1 -1
  63. package/src/lib/components/Radio/README.mdx +4 -4
  64. package/src/lib/components/Radio/Radio.jsx +12 -11
  65. package/src/lib/components/Radio/Radio.scss +26 -26
  66. package/src/lib/components/ScrollView/README.mdx +4 -1
  67. package/src/lib/components/ScrollView/ScrollView.jsx +11 -9
  68. package/src/lib/components/ScrollView/ScrollView.scss +113 -113
  69. package/src/lib/{services/elementPositionService.js → components/ScrollView/_helpers/getElementsPositionDifference.js} +0 -2
  70. package/src/lib/{hooks → components/ScrollView/_hooks}/useLoadResizeHook.js +1 -1
  71. package/src/lib/{hooks → components/ScrollView/_hooks}/useScrollPositionHook.js +1 -1
  72. package/src/lib/components/SelectField/README.mdx +4 -4
  73. package/src/lib/components/SelectField/SelectField.jsx +14 -13
  74. package/src/lib/components/SelectField/SelectField.scss +30 -30
  75. package/src/lib/components/Table/README.mdx +3 -3
  76. package/src/lib/components/Table/Table.scss +28 -35
  77. package/src/lib/components/Table/_settings.scss +5 -5
  78. package/src/lib/components/Tabs/README.mdx +1 -1
  79. package/src/lib/components/Tabs/Tabs.jsx +1 -2
  80. package/src/lib/components/Tabs/Tabs.scss +21 -21
  81. package/src/lib/components/Tabs/TabsItem.jsx +4 -3
  82. package/src/lib/components/Tabs/TabsItem.scss +78 -78
  83. package/src/lib/components/Text/README.mdx +1 -1
  84. package/src/lib/components/Text/Text.jsx +13 -6
  85. package/src/lib/components/Text/Text.scss +23 -13
  86. package/src/lib/components/Text/_helpers/getRootClampClassName.js +11 -0
  87. package/src/lib/components/Text/{helpers → _helpers}/getRootHyphensClassName.js +1 -1
  88. package/src/lib/components/Text/{helpers → _helpers}/getRootWordWrappingClassName.js +1 -1
  89. package/src/lib/components/TextArea/README.mdx +1 -1
  90. package/src/lib/components/TextArea/TextArea.jsx +18 -14
  91. package/src/lib/components/TextArea/TextArea.scss +27 -27
  92. package/src/lib/components/TextField/README.mdx +1 -1
  93. package/src/lib/components/TextField/TextField.jsx +16 -14
  94. package/src/lib/components/TextField/TextField.scss +28 -28
  95. package/src/lib/components/TextLink/README.mdx +77 -0
  96. package/src/lib/components/{Link/Link.jsx → TextLink/TextLink.jsx} +12 -13
  97. package/src/lib/components/TextLink/TextLink.scss +11 -0
  98. package/src/lib/components/TextLink/_theme.scss +4 -0
  99. package/src/lib/components/TextLink/index.js +1 -0
  100. package/src/lib/components/Toggle/README.mdx +3 -3
  101. package/src/lib/components/Toggle/Toggle.jsx +18 -17
  102. package/src/lib/components/Toggle/Toggle.scss +20 -20
  103. package/src/lib/components/Toolbar/README.mdx +19 -3
  104. package/src/lib/components/Toolbar/Toolbar.jsx +23 -14
  105. package/src/lib/components/Toolbar/Toolbar.scss +35 -30
  106. package/src/lib/components/Toolbar/ToolbarGroup.jsx +18 -13
  107. package/src/lib/components/Toolbar/ToolbarItem.jsx +26 -7
  108. package/src/lib/{helpers → components/_helpers}/getRootColorClassName.js +1 -1
  109. package/src/lib/{helpers → components/_helpers}/getRootSizeClassName.js +1 -1
  110. package/src/lib/{helpers → components/_helpers}/getRootValidationStateClassName.js +1 -1
  111. package/src/lib/components/_helpers/isChildrenEmpty.js +3 -0
  112. package/src/lib/{helpers → components/_helpers}/resolveContextOrProp.js +0 -0
  113. package/src/lib/{utils → components/_helpers}/transferProps.js +1 -1
  114. package/src/lib/foundation.scss +11 -11
  115. package/src/lib/helpers.scss +2 -2
  116. package/src/lib/index.js +4 -8
  117. package/src/lib/styles/_utilities.scss +13 -13
  118. package/src/lib/styles/elements/_code.scss +7 -7
  119. package/src/lib/styles/elements/_links.scss +8 -8
  120. package/src/lib/styles/elements/_lists.scss +3 -3
  121. package/src/lib/styles/elements/_page.scss +14 -14
  122. package/src/lib/styles/elements/_rulers.scss +6 -6
  123. package/src/lib/styles/elements/_small.scss +2 -2
  124. package/src/lib/styles/generic/_box-sizing.scss +3 -2
  125. package/src/lib/styles/generic/_forms.scss +3 -3
  126. package/src/lib/styles/generic/_reset.scss +6 -6
  127. package/src/lib/styles/generic/_shared.scss +3 -3
  128. package/src/lib/styles/helpers/_animation.scss +8 -8
  129. package/src/lib/styles/settings/_breakpoints.scss +7 -7
  130. package/src/lib/styles/settings/_escaped-characters.scss +5 -5
  131. package/src/lib/styles/settings/_form-fields.scss +24 -24
  132. package/src/lib/styles/settings/_utilities.scss +112 -100
  133. package/src/lib/styles/theme/_colors.scss +50 -50
  134. package/src/lib/styles/theme/_form-fields.scss +32 -32
  135. package/src/lib/styles/theme/_spacing.scss +11 -11
  136. package/src/lib/styles/theme/_typography.scss +12 -11
  137. package/src/lib/styles/theme-constants/_breakpoints.scss +2 -2
  138. package/src/lib/styles/theme-constants/_colors.scss +2 -2
  139. package/src/lib/styles/theme-constants/_svg.scss +1 -2
  140. package/src/lib/styles/tools/_accessibility.scss +29 -29
  141. package/src/lib/styles/tools/_breakpoint.scss +11 -14
  142. package/src/lib/styles/tools/_caret.scss +8 -8
  143. package/src/lib/styles/tools/_colors.scss +3 -3
  144. package/src/lib/styles/tools/_reset.scss +24 -21
  145. package/src/lib/styles/tools/_scrollbar.scss +4 -4
  146. package/src/lib/styles/tools/_spacing.scss +17 -21
  147. package/src/lib/styles/tools/_string.scss +9 -9
  148. package/src/lib/styles/tools/_svg.scss +13 -16
  149. package/src/lib/styles/tools/_transition.scss +42 -44
  150. package/src/lib/styles/tools/_utilities.scss +19 -19
  151. package/src/lib/styles/tools/form-fields/_box-field-elements.scss +88 -88
  152. package/src/lib/styles/tools/form-fields/_box-field-layout.scss +147 -147
  153. package/src/lib/styles/tools/form-fields/_box-field-sizes.scss +13 -15
  154. package/src/lib/styles/tools/form-fields/_foundation.scss +12 -12
  155. package/src/lib/styles/tools/form-fields/_inline-field-elements.scss +82 -71
  156. package/src/lib/styles/tools/form-fields/_inline-field-layout.scss +88 -47
  157. package/src/lib/styles/tools/form-fields/_variants.scss +104 -106
  158. package/src/lib/theme.scss +958 -954
  159. package/src/lib/utils/classNames.js +8 -0
  160. package/src/lib/components/CTA/CTA.jsx +0 -60
  161. package/src/lib/components/CTA/CTA.scss +0 -71
  162. package/src/lib/components/CTA/CTACenter.jsx +0 -27
  163. package/src/lib/components/CTA/CTAEnd.jsx +0 -27
  164. package/src/lib/components/CTA/CTAStart.jsx +0 -27
  165. package/src/lib/components/CTA/README.mdx +0 -119
  166. package/src/lib/components/CTA/index.js +0 -4
  167. package/src/lib/components/Center/Center.jsx +0 -27
  168. package/src/lib/components/Center/Center.scss +0 -7
  169. package/src/lib/components/Center/README.mdx +0 -52
  170. package/src/lib/components/Center/index.js +0 -1
  171. package/src/lib/components/Link/Link.scss +0 -11
  172. package/src/lib/components/Link/README.mdx +0 -85
  173. package/src/lib/components/Link/_theme.scss +0 -4
  174. package/src/lib/components/Link/index.js +0 -1
@@ -1,61 +1,61 @@
1
- @use '../../styles/tools/form-fields/foundation';
2
- @use '../../styles/tools/form-fields/inline-field-elements';
3
- @use '../../styles/tools/form-fields/inline-field-layout';
4
- @use '../../styles/tools/form-fields/variants';
5
- @use '../../styles/tools/accessibility';
1
+ @use "../../styles/tools/form-fields/foundation";
2
+ @use "../../styles/tools/form-fields/inline-field-elements";
3
+ @use "../../styles/tools/form-fields/inline-field-layout";
4
+ @use "../../styles/tools/form-fields/variants";
5
+ @use "../../styles/tools/accessibility";
6
6
 
7
7
  // Foundation
8
8
  .root {
9
- @include foundation.root();
10
- @include inline-field-layout.root();
11
- @include inline-field-elements.min-tap-target($type: toggle);
12
- @include variants.visual(check);
9
+ @include foundation.root();
10
+ @include inline-field-layout.root();
11
+ @include inline-field-elements.min-tap-target($type: toggle);
12
+ @include variants.visual(check);
13
13
  }
14
14
 
15
15
  .label {
16
- @include foundation.label();
16
+ @include foundation.label();
17
17
  }
18
18
 
19
19
  .field {
20
- @include inline-field-layout.field();
20
+ @include inline-field-layout.field($type: toggle);
21
21
  }
22
22
 
23
23
  .input {
24
- @include inline-field-elements.check-input($type: toggle);
24
+ @include inline-field-elements.check-input($type: toggle);
25
25
  }
26
26
 
27
27
  .helpText,
28
28
  .validationText {
29
- @include foundation.help-text();
29
+ @include foundation.help-text();
30
30
  }
31
31
 
32
32
  .isRootRequired .label {
33
- @include foundation.label-required();
33
+ @include foundation.label-required();
34
34
  }
35
35
 
36
36
  // States
37
37
  .isRootStateInvalid {
38
- @include variants.validation(invalid);
38
+ @include variants.validation(invalid);
39
39
  }
40
40
 
41
41
  .isRootStateValid {
42
- @include variants.validation(valid);
42
+ @include variants.validation(valid);
43
43
  }
44
44
 
45
45
  .isRootStateWarning {
46
- @include variants.validation(warning);
46
+ @include variants.validation(warning);
47
47
  }
48
48
 
49
49
  // Invisible label
50
50
  .isLabelHidden {
51
- @include accessibility.hide-text();
51
+ @include accessibility.hide-text();
52
52
  }
53
53
 
54
54
  // Layouts
55
55
  .hasRootLabelBefore {
56
- @include inline-field-layout.has-label-before();
56
+ @include inline-field-layout.has-label-before();
57
57
  }
58
58
 
59
59
  .isRootInFormLayout {
60
- @include inline-field-layout.in-form-layout();
60
+ @include inline-field-layout.in-form-layout();
61
61
  }
@@ -304,6 +304,22 @@ Toolbar.
304
304
  content placed within Toolbar. The [Text][text] component is designed
305
305
  specifically for this kind of job.
306
306
 
307
+ ## Flexible Items
308
+
309
+ Toolbar items can be made flexible to grow and shrink according to the available
310
+ space. This is useful e.g. when you need to combine text with an action.
311
+
312
+ <Playground>
313
+ <Toolbar>
314
+ <ToolbarItem flexible>
315
+ <Placeholder bordered>My Headline</Placeholder>
316
+ </ToolbarItem>
317
+ <ToolbarItem>
318
+ <Placeholder bordered>Action</Placeholder>
319
+ </ToolbarItem>
320
+ </Toolbar>
321
+ </Playground>
322
+
307
323
  ## API
308
324
 
309
325
  <Props table of={Toolbar} />
@@ -329,7 +345,7 @@ A wrapper for individual toolbar items.
329
345
 
330
346
  [inline-elements]: https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements
331
347
  [block-elements]: https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements
332
- [grid]: /components/layout/grid
333
- [list]: /components/layout/list
348
+ [grid]: /components/grid
349
+ [list]: /components/list
334
350
  [spacing]: /css-helpers/spacing
335
- [text]: /components/ui/text
351
+ [text]: /components/text
@@ -1,16 +1,20 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import { withProviderContext } from '../../provider';
4
+ import { classNames } from '../../utils/classNames';
5
+ import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
4
6
  import styles from './Toolbar.scss';
5
7
 
6
- export const Toolbar = (props) => {
7
- const {
8
- align,
9
- children,
10
- dense,
11
- justify,
12
- nowrap,
13
- } = props;
8
+ export const Toolbar = ({
9
+ align,
10
+ children,
11
+ dense,
12
+ justify,
13
+ nowrap,
14
+ }) => {
15
+ if (isChildrenEmpty(children)) {
16
+ return null;
17
+ }
14
18
 
15
19
  const alignClass = (value) => {
16
20
  if (value === 'top') {
@@ -46,13 +50,13 @@ export const Toolbar = (props) => {
46
50
 
47
51
  return (
48
52
  <div
49
- className={[
53
+ className={classNames(
50
54
  styles.toolbar,
51
- dense ? styles.isDense : null,
52
- nowrap ? styles.isNowrap : null,
55
+ dense && styles.isDense,
56
+ nowrap && styles.isNowrap,
53
57
  alignClass(align),
54
58
  justifyClass(justify),
55
- ].join(' ')}
59
+ )}
56
60
  >
57
61
  {children}
58
62
  </div>
@@ -61,6 +65,7 @@ export const Toolbar = (props) => {
61
65
 
62
66
  Toolbar.defaultProps = {
63
67
  align: 'top',
68
+ children: null,
64
69
  dense: false,
65
70
  justify: 'start',
66
71
  nowrap: false,
@@ -72,9 +77,13 @@ Toolbar.propTypes = {
72
77
  */
73
78
  align: PropTypes.oneOf(['top', 'middle', 'bottom', 'baseline']),
74
79
  /**
75
- * Individual ToolbarItems and ToolbarGroups.
80
+ * Nested elements. Supported types are:
81
+ * * `ToolbarItems`
82
+ * * `ToolbarGroups`
83
+ *
84
+ * If none are provided nothing is rendered.
76
85
  */
77
- children: PropTypes.node.isRequired,
86
+ children: PropTypes.node,
78
87
  /**
79
88
  * If `true`, spacing of all toolbar items in the toolbar will be reduced.
80
89
  */
@@ -1,84 +1,89 @@
1
1
  // 1. Get rid of unwanted spacing of inline elements by invocation of flex layout.
2
2
 
3
- @use '../../styles/tools/spacing';
4
- @use 'theme';
3
+ @use "../../styles/tools/spacing";
4
+ @use "theme";
5
5
 
6
6
  .toolbar,
7
7
  .group {
8
- display: flex;
9
- flex-wrap: wrap;
8
+ display: flex;
9
+ flex-wrap: wrap;
10
10
  }
11
11
 
12
12
  .toolbar {
13
- @include spacing.bottom(layouts, $compensation: theme.$gap);
13
+ @include spacing.bottom(layouts, $compensation: theme.$gap);
14
14
 
15
- margin: calc(-1 * #{theme.$gap});
15
+ margin: calc(-1 * #{theme.$gap});
16
16
  }
17
17
 
18
18
  .item {
19
- display: flex; // 1.
20
- flex: none;
21
- flex-direction: column; // 1.
22
- margin: theme.$gap;
19
+ display: flex; // 1.
20
+ flex: none;
21
+ flex-direction: column; // 1.
22
+ margin: theme.$gap;
23
+ }
24
+
25
+ .isItemFlexible {
26
+ flex: 1;
27
+ min-width: 0;
23
28
  }
24
29
 
25
30
  .isAlignedToTop {
26
- align-items: flex-start;
31
+ align-items: flex-start;
27
32
  }
28
33
 
29
34
  .isAlignedToMiddle {
30
- align-items: center;
35
+ align-items: center;
31
36
  }
32
37
 
33
38
  .isAlignedToBottom {
34
- align-items: flex-end;
39
+ align-items: flex-end;
35
40
  }
36
41
 
37
42
  .isAlignedToBaseline {
38
- align-items: baseline;
43
+ align-items: baseline;
39
44
  }
40
45
 
41
46
  .isJustifiedToStart {
42
- justify-content: flex-start;
47
+ justify-content: flex-start;
43
48
  }
44
49
 
45
50
  .isJustifiedToCenter {
46
- justify-content: center;
51
+ justify-content: center;
47
52
  }
48
53
 
49
54
  .isJustifiedToEnd {
50
- justify-content: flex-end;
55
+ justify-content: flex-end;
51
56
  }
52
57
 
53
58
  .isJustifiedToSpaceBetween {
54
- justify-content: space-between;
59
+ justify-content: space-between;
55
60
  }
56
61
 
57
- .isNowrap {
58
- flex-wrap: nowrap;
62
+ .isDense {
63
+ margin: calc(-1 * #{theme.$gap-dense});
59
64
  }
60
65
 
61
- .isNowrap > .item {
62
- flex: 0 1 auto;
66
+ .isDense .item {
67
+ margin: theme.$gap-dense;
63
68
  }
64
69
 
65
- .isDense {
66
- margin: calc(-1 * #{theme.$gap-dense});
70
+ .isDense > .isDense {
71
+ margin: 0;
67
72
  }
68
73
 
69
- .isDense .item {
70
- margin: theme.$gap-dense;
74
+ .isNowrap {
75
+ flex-wrap: nowrap;
71
76
  }
72
77
 
73
- .isDense > .isDense {
74
- margin: 0;
78
+ .isNowrap > .item:not(.isItemFlexible) {
79
+ flex: 0 1 auto;
75
80
  }
76
81
 
77
82
  .toolbar.isDense {
78
- @include spacing.bottom(layouts, $compensation: theme.$gap-dense);
83
+ @include spacing.bottom(layouts, $compensation: theme.$gap-dense);
79
84
  }
80
85
 
81
86
  .toolbar:not(.isDense) > .isDense,
82
87
  .group:not(.isDense) > .isDense {
83
- margin: theme.$gap-dense;
88
+ margin: theme.$gap-dense;
84
89
  }
@@ -1,15 +1,19 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import { withProviderContext } from '../../provider';
4
+ import { classNames } from '../../utils/classNames';
5
+ import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
4
6
  import styles from './Toolbar.scss';
5
7
 
6
- export const ToolbarGroup = (props) => {
7
- const {
8
- align,
9
- children,
10
- dense,
11
- nowrap,
12
- } = props;
8
+ export const ToolbarGroup = ({
9
+ align,
10
+ children,
11
+ dense,
12
+ nowrap,
13
+ }) => {
14
+ if (isChildrenEmpty(children)) {
15
+ return null;
16
+ }
13
17
 
14
18
  const alignClass = (value) => {
15
19
  if (value === 'top') {
@@ -29,12 +33,12 @@ export const ToolbarGroup = (props) => {
29
33
 
30
34
  return (
31
35
  <div
32
- className={[
36
+ className={classNames(
33
37
  styles.group,
34
- dense ? styles.isDense : null,
35
- nowrap ? styles.isNowrap : null,
38
+ dense && styles.isDense,
39
+ nowrap && styles.isNowrap,
36
40
  alignClass(align),
37
- ].join(' ')}
41
+ )}
38
42
  >
39
43
  {children}
40
44
  </div>
@@ -43,6 +47,7 @@ export const ToolbarGroup = (props) => {
43
47
 
44
48
  ToolbarGroup.defaultProps = {
45
49
  align: 'top',
50
+ children: null,
46
51
  dense: false,
47
52
  nowrap: false,
48
53
  };
@@ -53,9 +58,9 @@ ToolbarGroup.propTypes = {
53
58
  */
54
59
  align: PropTypes.oneOf(['top', 'middle', 'bottom', 'baseline']),
55
60
  /**
56
- * Grouped ToolbarItems.
61
+ * Grouped ToolbarItems. If none are provided nothing is rendered.
57
62
  */
58
- children: PropTypes.node.isRequired,
63
+ children: PropTypes.node,
59
64
  /**
60
65
  * If `true`, spacing of toolbar items in the group will be reduced.
61
66
  */
@@ -1,25 +1,44 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
+ import { classNames } from '../../utils/classNames';
3
4
  import { withProviderContext } from '../../provider';
5
+ import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
4
6
  import styles from './Toolbar.scss';
5
7
 
6
- export const ToolbarItem = (props) => {
7
- const {
8
- children,
9
- } = props;
8
+ export const ToolbarItem = ({
9
+ children,
10
+ flexible,
11
+ }) => {
12
+ if (isChildrenEmpty(children)) {
13
+ return null;
14
+ }
10
15
 
11
16
  return (
12
- <div className={styles.item}>
17
+ <div
18
+ className={classNames(
19
+ styles.item,
20
+ flexible && styles.isItemFlexible,
21
+ )}
22
+ >
13
23
  {children}
14
24
  </div>
15
25
  );
16
26
  };
17
27
 
28
+ ToolbarItem.defaultProps = {
29
+ children: null,
30
+ flexible: false,
31
+ };
32
+
18
33
  ToolbarItem.propTypes = {
19
34
  /**
20
- * Content of the toolbar item.
35
+ * Content of the toolbar item. If none are provided nothing is rendered.
36
+ */
37
+ children: PropTypes.node,
38
+ /**
39
+ * Allow item to grow and shrink if needed.
21
40
  */
22
- children: PropTypes.node.isRequired,
41
+ flexible: PropTypes.bool,
23
42
  };
24
43
 
25
44
  export const ToolbarItemWithContext = withProviderContext(ToolbarItem, 'ToolbarItem');
@@ -1,4 +1,4 @@
1
- export default (variant, styles) => {
1
+ export const getRootColorClassName = (variant, styles) => {
2
2
  if (variant === 'primary') {
3
3
  return styles.rootColorPrimary;
4
4
  }
@@ -1,4 +1,4 @@
1
- export default (size, styles) => {
1
+ export const getRootSizeClassName = (size, styles) => {
2
2
  if (size === 'small') {
3
3
  return styles.rootSizeSmall;
4
4
  }
@@ -1,4 +1,4 @@
1
- export default (validationState, styles) => {
1
+ export const getRootValidationStateClassName = (validationState, styles) => {
2
2
  if (validationState === 'invalid') {
3
3
  return styles.isRootStateInvalid;
4
4
  }
@@ -0,0 +1,3 @@
1
+ export const isChildrenEmpty = (children) => children == null
2
+ || children === false
3
+ || (Array.isArray(children) && children.length === 0);
@@ -1,4 +1,4 @@
1
- export default ({
1
+ export const transferProps = ({
2
2
  children,
3
3
  className,
4
4
  forwardedRef,
@@ -7,11 +7,11 @@
7
7
  //
8
8
  // Ground-zero styles.
9
9
 
10
- @use 'styles/generic/box-sizing';
11
- @use 'normalize.css/normalize.css';
12
- @use 'styles/generic/forms';
13
- @use 'styles/generic/reset';
14
- @use 'styles/generic/shared';
10
+ @use "styles/generic/box-sizing";
11
+ @use "normalize.css/normalize.css";
12
+ @use "styles/generic/forms";
13
+ @use "styles/generic/reset";
14
+ @use "styles/generic/shared";
15
15
 
16
16
  //
17
17
  // 2. Elements
@@ -19,9 +19,9 @@
19
19
  //
20
20
  // Unclassed HTML elements (type selectors).
21
21
 
22
- @use 'styles/elements/code';
23
- @use 'styles/elements/links';
24
- @use 'styles/elements/lists';
25
- @use 'styles/elements/page';
26
- @use 'styles/elements/rulers';
27
- @use 'styles/elements/small';
22
+ @use "styles/elements/code";
23
+ @use "styles/elements/links";
24
+ @use "styles/elements/lists";
25
+ @use "styles/elements/page";
26
+ @use "styles/elements/rulers";
27
+ @use "styles/elements/small";
@@ -9,7 +9,7 @@
9
9
  // General purpose helpers for common situations. They can compose multiple CSS rules to do a bit
10
10
  // more complicated tasks.
11
11
 
12
- @use 'styles/helpers/animation';
12
+ @use "styles/helpers/animation";
13
13
 
14
14
  //
15
15
  // 2. Utilities
@@ -19,4 +19,4 @@
19
19
  // thing: they set a single CSS rule and use the otherwise disallowed `!important` to enforce it.
20
20
  // Also they are often responsive (can be adjusted for individual breakpoints).
21
21
 
22
- @use 'styles/utilities';
22
+ @use "styles/utilities";
package/src/lib/index.js CHANGED
@@ -8,14 +8,7 @@ export {
8
8
  CardBody,
9
9
  CardFooter,
10
10
  } from './components/Card';
11
- export { default as Center } from './components/Center';
12
11
  export { default as CheckboxField } from './components/CheckboxField';
13
- export {
14
- CTA,
15
- CTACenter,
16
- CTAEnd,
17
- CTAStart,
18
- } from './components/CTA';
19
12
  export { default as FileInputField } from './components/FileInputField';
20
13
  export {
21
14
  FormLayout,
@@ -25,7 +18,6 @@ export {
25
18
  Grid,
26
19
  GridSpan,
27
20
  } from './components/Grid';
28
- export { default as Link } from './components/Link';
29
21
  export {
30
22
  List,
31
23
  ListItem,
@@ -48,6 +40,7 @@ export { default as Table } from './components/Table';
48
40
  export { default as Text } from './components/Text';
49
41
  export { default as TextArea } from './components/TextArea';
50
42
  export { default as TextField } from './components/TextField';
43
+ export { default as TextLink } from './components/TextLink';
51
44
  export { default as Toggle } from './components/Toggle';
52
45
  export {
53
46
  Toolbar,
@@ -57,3 +50,6 @@ export {
57
50
 
58
51
  // Provider
59
52
  export { RUIProvider } from './provider';
53
+
54
+ // Utils
55
+ export { classNames } from './utils/classNames';
@@ -1,18 +1,18 @@
1
- @use 'sass:map';
2
- @use 'sass:meta';
3
- @use 'settings/breakpoints' as breakpoint-settings;
4
- @use 'settings/utilities' as utility-settings;
5
- @use 'tools/breakpoint';
6
- @use 'tools/utilities';
1
+ @use "sass:map";
2
+ @use "sass:meta";
3
+ @use "settings/breakpoints" as breakpoint-settings;
4
+ @use "settings/utilities" as utility-settings;
5
+ @use "tools/breakpoint";
6
+ @use "tools/utilities";
7
7
 
8
8
  @each $breakpoint in map.keys(breakpoint-settings.$values) {
9
- @include breakpoint.up($breakpoint) {
10
- $infix: if(map.get(breakpoint-settings.$values, $breakpoint) == 0, '', '-#{$breakpoint}');
9
+ @include breakpoint.up($breakpoint) {
10
+ $infix: if(map.get(breakpoint-settings.$values, $breakpoint) == 0, "", "-#{$breakpoint}");
11
11
 
12
- @each $key, $utility in utility-settings.$map {
13
- @if meta.type-of($utility) == 'map' and (map.get($utility, responsive) == true or $infix == '') {
14
- @include utilities.generate($utility, $infix);
15
- }
12
+ @each $key, $utility in utility-settings.$map {
13
+ @if meta.type-of($utility) == "map" and (map.get($utility, responsive) == true or $infix == "") {
14
+ @include utilities.generate($utility, $infix);
15
+ }
16
+ }
16
17
  }
17
- }
18
18
  }
@@ -1,14 +1,14 @@
1
- @use 'sass:map';
2
- @use '../theme/code';
3
- @use '../theme/colors';
1
+ @use "sass:map";
2
+ @use "../theme/code";
3
+ @use "../theme/colors";
4
4
 
5
5
  code,
6
6
  pre {
7
- font-size: code.$font-size;
8
- font-family: code.$font-family;
7
+ font-size: code.$font-size;
8
+ font-family: code.$font-family;
9
9
  }
10
10
 
11
11
  code {
12
- padding: 0.15em 0.5em;
13
- background-color: map.get(colors.$grays, gray-100);
12
+ padding: 0.15em 0.5em;
13
+ background-color: map.get(colors.$grays, gray-100);
14
14
  }
@@ -1,12 +1,12 @@
1
- @use '../theme/links';
1
+ @use "../theme/links";
2
2
 
3
3
  a {
4
- text-decoration: links.$decoration;
5
- color: links.$color;
4
+ text-decoration: links.$decoration;
5
+ color: links.$color;
6
6
 
7
- &:hover,
8
- &:focus {
9
- text-decoration: links.$hover-decoration;
10
- color: links.$hover-color;
11
- }
7
+ &:hover,
8
+ &:focus {
9
+ text-decoration: links.$hover-decoration;
10
+ color: links.$hover-color;
11
+ }
12
12
  }
@@ -1,10 +1,10 @@
1
- @use '../theme/lists';
1
+ @use "../theme/lists";
2
2
 
3
3
  ol,
4
4
  ul {
5
- padding-left: 1.25em;
5
+ padding-left: 1.25em;
6
6
  }
7
7
 
8
8
  ul {
9
- list-style-type: lists.$unordered-style;
9
+ list-style-type: lists.$unordered-style;
10
10
  }