@react-ui-org/react-ui 0.44.1 → 0.47.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 (192) hide show
  1. package/CONTRIBUTING.md +7 -0
  2. package/README.md +15 -16
  3. package/dist/lib.development.js +271 -415
  4. package/dist/lib.js +1 -1
  5. package/package.json +11 -13
  6. package/src/lib/components/Alert/Alert.jsx +45 -44
  7. package/src/lib/components/Alert/Alert.scss +48 -48
  8. package/src/lib/components/Alert/README.mdx +2 -5
  9. package/src/lib/components/Alert/_settings.scss +4 -4
  10. package/src/lib/components/Alert/_theme.scss +50 -50
  11. package/src/lib/components/Alert/_tools.scss +6 -6
  12. package/src/lib/components/Badge/Badge.jsx +9 -11
  13. package/src/lib/components/Badge/Badge.scss +57 -57
  14. package/src/lib/components/Button/Button.jsx +14 -13
  15. package/src/lib/components/Button/Button.scss +2 -2
  16. package/src/lib/components/Button/README.mdx +11 -6
  17. package/src/lib/components/Button/_base.scss +69 -69
  18. package/src/lib/components/Button/_priorities.scss +49 -49
  19. package/src/lib/components/Button/_settings.scss +10 -10
  20. package/src/lib/components/Button/_theme.scss +18 -15
  21. package/src/lib/components/Button/_tools.scss +98 -100
  22. package/src/lib/components/Button/helpers/getRootLabelVisibilityClassName.js +4 -4
  23. package/src/lib/components/ButtonGroup/ButtonGroup.jsx +41 -25
  24. package/src/lib/components/ButtonGroup/ButtonGroup.scss +3 -3
  25. package/src/lib/components/ButtonGroup/README.mdx +1 -1
  26. package/src/lib/components/Card/Card.jsx +10 -9
  27. package/src/lib/components/Card/Card.scss +28 -28
  28. package/src/lib/components/Card/CardBody.jsx +17 -12
  29. package/src/lib/components/Card/CardFooter.jsx +22 -9
  30. package/src/lib/components/Card/_theme.scss +50 -50
  31. package/src/lib/components/Card/_tools.scss +6 -6
  32. package/src/lib/components/CheckboxField/CheckboxField.jsx +21 -20
  33. package/src/lib/components/CheckboxField/CheckboxField.scss +20 -20
  34. package/src/lib/components/CheckboxField/README.mdx +1 -1
  35. package/src/lib/components/FileInputField/FileInputField.jsx +16 -15
  36. package/src/lib/components/FileInputField/FileInputField.scss +19 -19
  37. package/src/lib/components/FileInputField/README.mdx +1 -1
  38. package/src/lib/components/FormLayout/FormLayout.jsx +19 -17
  39. package/src/lib/components/FormLayout/FormLayout.scss +17 -17
  40. package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +18 -12
  41. package/src/lib/components/FormLayout/FormLayoutCustomField.scss +18 -18
  42. package/src/lib/components/FormLayout/README.mdx +26 -49
  43. package/src/lib/components/Grid/Grid.jsx +25 -24
  44. package/src/lib/components/Grid/Grid.scss +33 -29
  45. package/src/lib/components/Grid/GridSpan.jsx +11 -10
  46. package/src/lib/components/Grid/README.mdx +46 -20
  47. package/src/lib/components/Grid/{helpers → _helpers}/generateResponsiveCustomProperties.js +0 -2
  48. package/src/lib/components/Grid/_theme.scss +9 -9
  49. package/src/lib/components/Grid/_tools.scss +20 -20
  50. package/src/lib/components/Modal/Modal.jsx +38 -32
  51. package/src/lib/components/Modal/Modal.scss +73 -73
  52. package/src/lib/components/Modal/README.mdx +2 -5
  53. package/src/lib/components/Modal/_settings.scss +5 -5
  54. package/src/lib/components/Modal/_theme.scss +17 -17
  55. package/src/lib/components/Paper/Paper.jsx +9 -9
  56. package/src/lib/components/Paper/Paper.scss +8 -8
  57. package/src/lib/components/Popover/Popover.jsx +94 -0
  58. package/src/lib/components/Popover/Popover.scss +235 -0
  59. package/src/lib/components/Popover/PopoverWrapper.jsx +46 -0
  60. package/src/lib/components/Popover/README.mdx +333 -0
  61. package/src/lib/components/Popover/_helpers/getRootAlignmentClassName.js +13 -0
  62. package/src/lib/components/Popover/_helpers/getRootSideClassName.js +17 -0
  63. package/src/lib/components/Popover/_theme.scss +16 -0
  64. package/src/lib/components/Popover/index.js +2 -0
  65. package/src/lib/components/Radio/README.mdx +1 -1
  66. package/src/lib/components/Radio/Radio.jsx +15 -14
  67. package/src/lib/components/Radio/Radio.scss +26 -26
  68. package/src/lib/components/ScrollView/README.mdx +5 -5
  69. package/src/lib/components/ScrollView/ScrollView.jsx +22 -22
  70. package/src/lib/components/ScrollView/ScrollView.scss +113 -113
  71. package/src/lib/{services/elementPositionService.js → components/ScrollView/_helpers/getElementsPositionDifference.js} +0 -2
  72. package/src/lib/{hooks → components/ScrollView/_hooks}/useLoadResizeHook.js +1 -1
  73. package/src/lib/{hooks → components/ScrollView/_hooks}/useScrollPositionHook.js +1 -1
  74. package/src/lib/components/SelectField/README.mdx +1 -1
  75. package/src/lib/components/SelectField/SelectField.jsx +17 -16
  76. package/src/lib/components/SelectField/SelectField.scss +30 -30
  77. package/src/lib/components/Table/README.mdx +1 -1
  78. package/src/lib/components/Table/Table.jsx +3 -3
  79. package/src/lib/components/Table/Table.scss +28 -35
  80. package/src/lib/components/Table/_settings.scss +5 -5
  81. package/src/lib/components/Tabs/Tabs.jsx +4 -5
  82. package/src/lib/components/Tabs/Tabs.scss +21 -21
  83. package/src/lib/components/Tabs/TabsItem.jsx +7 -6
  84. package/src/lib/components/Tabs/TabsItem.scss +78 -78
  85. package/src/lib/components/Text/README.mdx +3 -3
  86. package/src/lib/components/Text/Text.jsx +16 -9
  87. package/src/lib/components/Text/Text.scss +23 -13
  88. package/src/lib/components/Text/_helpers/getRootClampClassName.js +11 -0
  89. package/src/lib/components/Text/{helpers → _helpers}/getRootHyphensClassName.js +1 -1
  90. package/src/lib/components/Text/{helpers → _helpers}/getRootWordWrappingClassName.js +1 -1
  91. package/src/lib/components/TextArea/README.mdx +1 -1
  92. package/src/lib/components/TextArea/TextArea.jsx +21 -17
  93. package/src/lib/components/TextArea/TextArea.scss +27 -27
  94. package/src/lib/components/TextField/README.mdx +1 -1
  95. package/src/lib/components/TextField/TextField.jsx +19 -18
  96. package/src/lib/components/TextField/TextField.scss +28 -28
  97. package/src/lib/components/TextLink/README.mdx +77 -0
  98. package/src/lib/components/TextLink/TextLink.jsx +44 -0
  99. package/src/lib/components/TextLink/TextLink.scss +11 -0
  100. package/src/lib/components/TextLink/_theme.scss +4 -0
  101. package/src/lib/components/TextLink/index.js +1 -0
  102. package/src/lib/components/Toggle/README.mdx +1 -1
  103. package/src/lib/components/Toggle/Toggle.jsx +21 -20
  104. package/src/lib/components/Toggle/Toggle.scss +20 -20
  105. package/src/lib/components/Toolbar/README.mdx +33 -5
  106. package/src/lib/components/Toolbar/Toolbar.jsx +33 -17
  107. package/src/lib/components/Toolbar/Toolbar.scss +29 -42
  108. package/src/lib/components/Toolbar/ToolbarGroup.jsx +28 -16
  109. package/src/lib/components/Toolbar/ToolbarItem.jsx +36 -10
  110. package/src/lib/{helpers → components/_helpers}/getRootColorClassName.js +1 -1
  111. package/src/lib/{helpers → components/_helpers}/getRootSizeClassName.js +1 -1
  112. package/src/lib/{helpers → components/_helpers}/getRootValidationStateClassName.js +1 -1
  113. package/src/lib/components/_helpers/isChildrenEmpty.js +3 -0
  114. package/src/lib/{helpers → components/_helpers}/resolveContextOrProp.js +0 -0
  115. package/src/lib/{utils → components/_helpers}/transferProps.js +1 -1
  116. package/src/lib/foundation.scss +11 -11
  117. package/src/lib/helpers.scss +2 -2
  118. package/src/lib/index.js +8 -17
  119. package/src/lib/provider/index.js +2 -1
  120. package/src/lib/provider/withGlobalProps.jsx +21 -0
  121. package/src/lib/styles/_utilities.scss +13 -13
  122. package/src/lib/styles/elements/_code.scss +7 -7
  123. package/src/lib/styles/elements/_links.scss +8 -8
  124. package/src/lib/styles/elements/_lists.scss +3 -3
  125. package/src/lib/styles/elements/_page.scss +14 -14
  126. package/src/lib/styles/elements/_rulers.scss +6 -6
  127. package/src/lib/styles/elements/_small.scss +2 -2
  128. package/src/lib/styles/generic/_box-sizing.scss +3 -2
  129. package/src/lib/styles/generic/_forms.scss +3 -3
  130. package/src/lib/styles/generic/_reset.scss +6 -6
  131. package/src/lib/styles/generic/_shared.scss +3 -3
  132. package/src/lib/styles/helpers/_animation.scss +8 -8
  133. package/src/lib/styles/settings/_breakpoints.scss +7 -7
  134. package/src/lib/styles/settings/_escaped-characters.scss +5 -5
  135. package/src/lib/styles/settings/_form-fields.scss +24 -24
  136. package/src/lib/styles/settings/_utilities.scss +112 -100
  137. package/src/lib/styles/theme/_colors.scss +50 -50
  138. package/src/lib/styles/theme/_form-fields.scss +32 -32
  139. package/src/lib/styles/theme/_spacing.scss +11 -11
  140. package/src/lib/styles/theme/_typography.scss +12 -11
  141. package/src/lib/styles/theme-constants/_breakpoints.scss +4 -4
  142. package/src/lib/styles/theme-constants/_colors.scss +2 -2
  143. package/src/lib/styles/theme-constants/_svg.scss +1 -2
  144. package/src/lib/styles/tools/_accessibility.scss +29 -29
  145. package/src/lib/styles/tools/_breakpoint.scss +11 -14
  146. package/src/lib/styles/tools/_caret.scss +8 -8
  147. package/src/lib/styles/tools/_colors.scss +3 -3
  148. package/src/lib/styles/tools/_reset.scss +24 -21
  149. package/src/lib/styles/tools/_scrollbar.scss +4 -4
  150. package/src/lib/styles/tools/_spacing.scss +14 -22
  151. package/src/lib/styles/tools/_string.scss +9 -9
  152. package/src/lib/styles/tools/_svg.scss +13 -16
  153. package/src/lib/styles/tools/_transition.scss +42 -44
  154. package/src/lib/styles/tools/_utilities.scss +19 -19
  155. package/src/lib/styles/tools/form-fields/_box-field-elements.scss +88 -88
  156. package/src/lib/styles/tools/form-fields/_box-field-layout.scss +147 -147
  157. package/src/lib/styles/tools/form-fields/_box-field-sizes.scss +13 -15
  158. package/src/lib/styles/tools/form-fields/_foundation.scss +12 -12
  159. package/src/lib/styles/tools/form-fields/_inline-field-elements.scss +82 -71
  160. package/src/lib/styles/tools/form-fields/_inline-field-layout.scss +88 -47
  161. package/src/lib/styles/tools/form-fields/_variants.scss +104 -106
  162. package/src/lib/theme.scss +959 -954
  163. package/src/lib/utils/classNames.js +8 -0
  164. package/src/lib/components/CTA/CTA.jsx +0 -60
  165. package/src/lib/components/CTA/CTA.scss +0 -71
  166. package/src/lib/components/CTA/CTACenter.jsx +0 -27
  167. package/src/lib/components/CTA/CTAEnd.jsx +0 -27
  168. package/src/lib/components/CTA/CTAStart.jsx +0 -27
  169. package/src/lib/components/CTA/README.mdx +0 -119
  170. package/src/lib/components/CTA/index.js +0 -4
  171. package/src/lib/components/Center/Center.jsx +0 -27
  172. package/src/lib/components/Center/Center.scss +0 -7
  173. package/src/lib/components/Center/README.mdx +0 -52
  174. package/src/lib/components/Center/index.js +0 -1
  175. package/src/lib/components/Link/Link.jsx +0 -45
  176. package/src/lib/components/Link/Link.scss +0 -11
  177. package/src/lib/components/Link/README.mdx +0 -85
  178. package/src/lib/components/Link/_theme.scss +0 -4
  179. package/src/lib/components/Link/index.js +0 -1
  180. package/src/lib/components/List/List.jsx +0 -71
  181. package/src/lib/components/List/List.scss +0 -53
  182. package/src/lib/components/List/ListItem.jsx +0 -31
  183. package/src/lib/components/List/README.mdx +0 -114
  184. package/src/lib/components/List/_theme.scss +0 -1
  185. package/src/lib/components/List/index.js +0 -2
  186. package/src/lib/components/Media/Media.jsx +0 -29
  187. package/src/lib/components/Media/Media.scss +0 -16
  188. package/src/lib/components/Media/MediaBody.jsx +0 -21
  189. package/src/lib/components/Media/MediaObject.jsx +0 -21
  190. package/src/lib/components/Media/README.mdx +0 -63
  191. package/src/lib/components/Media/index.js +0 -3
  192. package/src/lib/provider/withProviderContext.jsx +0 -32
@@ -1,152 +1,152 @@
1
- @use 'sass:map';
2
- @use 'settings';
3
- @use 'theme';
4
- @use 'tools';
1
+ @use "sass:map";
2
+ @use "settings";
3
+ @use "theme";
4
+ @use "tools";
5
5
 
6
6
  .rootPriorityFilled.rootColorPrimary {
7
- @include tools.button-color(filled, primary);
7
+ @include tools.button-color(filled, primary);
8
8
  }
9
9
 
10
10
  .rootPriorityFilled.rootColorSecondary {
11
- @include tools.button-color(filled, secondary);
11
+ @include tools.button-color(filled, secondary);
12
12
  }
13
13
 
14
14
  .rootPriorityFilled.rootColorSuccess {
15
- @include tools.button-color(filled, success);
15
+ @include tools.button-color(filled, success);
16
16
  }
17
17
 
18
18
  .rootPriorityFilled.rootColorWarning {
19
- @include tools.button-color(filled, warning);
19
+ @include tools.button-color(filled, warning);
20
20
  }
21
21
 
22
22
  .rootPriorityFilled.rootColorDanger {
23
- @include tools.button-color(filled, danger);
23
+ @include tools.button-color(filled, danger);
24
24
  }
25
25
 
26
26
  .rootPriorityFilled.rootColorHelp {
27
- @include tools.button-color(filled, help);
27
+ @include tools.button-color(filled, help);
28
28
  }
29
29
 
30
30
  .rootPriorityFilled.rootColorInfo {
31
- @include tools.button-color(filled, info);
31
+ @include tools.button-color(filled, info);
32
32
  }
33
33
 
34
34
  .rootPriorityFilled.rootColorNote {
35
- @include tools.button-color(filled, note);
35
+ @include tools.button-color(filled, note);
36
36
  }
37
37
 
38
38
  .rootPriorityFilled.rootColorLight {
39
- @include tools.button-color(filled, light);
39
+ @include tools.button-color(filled, light);
40
40
  }
41
41
 
42
42
  .rootPriorityFilled.rootColorDark {
43
- @include tools.button-color(filled, dark);
43
+ @include tools.button-color(filled, dark);
44
44
  }
45
45
 
46
46
  .rootPriorityOutline.rootColorPrimary {
47
- @include tools.button-color(outline, primary);
47
+ @include tools.button-color(outline, primary);
48
48
  }
49
49
 
50
50
  .rootPriorityOutline.rootColorSecondary {
51
- @include tools.button-color(outline, secondary);
51
+ @include tools.button-color(outline, secondary);
52
52
  }
53
53
 
54
54
  .rootPriorityOutline.rootColorSuccess {
55
- @include tools.button-color(outline, success);
55
+ @include tools.button-color(outline, success);
56
56
  }
57
57
 
58
58
  .rootPriorityOutline.rootColorWarning {
59
- @include tools.button-color(outline, warning);
59
+ @include tools.button-color(outline, warning);
60
60
  }
61
61
 
62
62
  .rootPriorityOutline.rootColorDanger {
63
- @include tools.button-color(outline, danger);
63
+ @include tools.button-color(outline, danger);
64
64
  }
65
65
 
66
66
  .rootPriorityOutline.rootColorHelp {
67
- @include tools.button-color(outline, help);
67
+ @include tools.button-color(outline, help);
68
68
  }
69
69
 
70
70
  .rootPriorityOutline.rootColorInfo {
71
- @include tools.button-color(outline, info);
71
+ @include tools.button-color(outline, info);
72
72
  }
73
73
 
74
74
  .rootPriorityOutline.rootColorNote {
75
- @include tools.button-color(outline, note);
75
+ @include tools.button-color(outline, note);
76
76
  }
77
77
 
78
78
  .rootPriorityOutline.rootColorLight {
79
- @include tools.button-color(outline, light);
79
+ @include tools.button-color(outline, light);
80
80
  }
81
81
 
82
82
  .rootPriorityOutline.rootColorDark {
83
- @include tools.button-color(outline, dark);
83
+ @include tools.button-color(outline, dark);
84
84
  }
85
85
 
86
86
  .rootPriorityFlat.rootColorPrimary {
87
- @include tools.button-color(flat, primary);
87
+ @include tools.button-color(flat, primary);
88
88
  }
89
89
 
90
90
  .rootPriorityFlat.rootColorSecondary {
91
- @include tools.button-color(flat, secondary);
91
+ @include tools.button-color(flat, secondary);
92
92
  }
93
93
 
94
94
  .rootPriorityFlat.rootColorSuccess {
95
- @include tools.button-color(flat, success);
95
+ @include tools.button-color(flat, success);
96
96
  }
97
97
 
98
98
  .rootPriorityFlat.rootColorWarning {
99
- @include tools.button-color(flat, warning);
99
+ @include tools.button-color(flat, warning);
100
100
  }
101
101
 
102
102
  .rootPriorityFlat.rootColorDanger {
103
- @include tools.button-color(flat, danger);
103
+ @include tools.button-color(flat, danger);
104
104
  }
105
105
 
106
106
  .rootPriorityFlat.rootColorHelp {
107
- @include tools.button-color(flat, help);
107
+ @include tools.button-color(flat, help);
108
108
  }
109
109
 
110
110
  .rootPriorityFlat.rootColorInfo {
111
- @include tools.button-color(flat, info);
111
+ @include tools.button-color(flat, info);
112
112
  }
113
113
 
114
114
  .rootPriorityFlat.rootColorNote {
115
- @include tools.button-color(flat, note);
115
+ @include tools.button-color(flat, note);
116
116
  }
117
117
 
118
118
  .rootPriorityFlat.rootColorLight {
119
- @include tools.button-color(flat, light);
119
+ @include tools.button-color(flat, light);
120
120
  }
121
121
 
122
122
  .rootPriorityFlat.rootColorDark {
123
- @include tools.button-color(flat, dark);
123
+ @include tools.button-color(flat, dark);
124
124
  }
125
125
 
126
126
  .rootPriorityFilled.rootGrouped:not(:first-child)::before,
127
127
  .rootPriorityFlat.rootGrouped:not(:first-child)::before {
128
- content: '';
129
- position: absolute;
130
- top: calc(-1 * #{theme.$border-width});
131
- bottom: calc(-1 * #{theme.$border-width});
132
- left: calc(-1 * #{theme.$border-width});
133
- z-index: map.get(settings.$group-z-indexes, separator);
134
- border-left: var(--local-separator-width) solid var(--local-separator-color);
135
- transform: translateX(calc(-0.5 * var(--local-gap) - 50%));
128
+ content: "";
129
+ position: absolute;
130
+ top: calc(-1 * #{theme.$border-width});
131
+ bottom: calc(-1 * #{theme.$border-width});
132
+ left: calc(-1 * #{theme.$border-width});
133
+ z-index: map.get(settings.$group-z-indexes, separator);
134
+ border-left: var(--rui-local-separator-width) solid var(--rui-local-separator-color);
135
+ transform: translateX(calc(-0.5 * var(--rui-local-gap) - 50%));
136
136
  }
137
137
 
138
138
  .rootPriorityFilled.rootGrouped:not(:first-child) {
139
- --local-gap: #{theme.$group-filled-gap};
140
- --local-separator-width: #{theme.$group-filled-separator-width};
141
- --local-separator-color: #{theme.$group-filled-separator-color};
139
+ --rui-local-gap: #{theme.$group-filled-gap};
140
+ --rui-local-separator-width: #{theme.$group-filled-separator-width};
141
+ --rui-local-separator-color: #{theme.$group-filled-separator-color};
142
142
  }
143
143
 
144
144
  .rootPriorityFlat.rootGrouped:not(:first-child) {
145
- --local-gap: #{theme.$group-flat-gap};
146
- --local-separator-width: #{theme.$group-flat-separator-width};
147
- --local-separator-color: #{theme.$group-flat-separator-color};
145
+ --rui-local-gap: #{theme.$group-flat-gap};
146
+ --rui-local-separator-width: #{theme.$group-flat-separator-width};
147
+ --rui-local-separator-color: #{theme.$group-flat-separator-color};
148
148
  }
149
149
 
150
150
  .rootPriorityOutline.rootGrouped:not(:first-child) {
151
- --local-gap: #{theme.$group-outline-gap};
151
+ --rui-local-gap: #{theme.$group-outline-gap};
152
152
  }
@@ -1,21 +1,21 @@
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
- $line-height: typography.$line-height-base;
5
+ $line-height: typography.$line-height-small;
6
6
  $icon-spacing: spacing.of(2);
7
7
 
8
8
  $group-z-indexes: (
9
- button: auto,
10
- button-hover: 1,
11
- separator: 2,
12
- button-overflowing-elements: 3,
9
+ button: auto,
10
+ button-hover: 1,
11
+ separator: 2,
12
+ button-overflowing-elements: 3,
13
13
  );
14
14
 
15
15
  $themeable-variants: (primary, secondary, success, warning, danger, help, info, note, light, dark);
16
16
  $themeable-states: (default, hover, active, disabled);
17
17
  $themeable-priority-properties: (
18
- filled: (color, border-color, background, box-shadow),
19
- outline: (color, border-color, background),
20
- flat: (color, background),
18
+ filled: (color, border-color, background, box-shadow),
19
+ outline: (color, border-color, background),
20
+ flat: (color, background),
21
21
  );
@@ -23,19 +23,22 @@ $group-flat-separator-color: var(--rui-ButtonGroup--flat__separator__color);
23
23
  $group-outline-gap: var(--rui-ButtonGroup--outline__gap);
24
24
 
25
25
  $sizes: (
26
- small: (
27
- height: var(--rui-Button--small__height),
28
- padding-x: var(--rui-Button--small__padding-x),
29
- font-size: var(--rui-Button--small__font-size),
30
- ),
31
- medium: (
32
- height: var(--rui-Button--medium__height),
33
- padding-x: var(--rui-Button--medium__padding-x),
34
- font-size: var(--rui-Button--medium__font-size),
35
- ),
36
- large: (
37
- height: var(--rui-Button--large__height),
38
- padding-x: var(--rui-Button--large__padding-x),
39
- font-size: var(--rui-Button--large__font-size),
40
- ),
26
+ small: (
27
+ height: var(--rui-Button--small__height),
28
+ padding-y: var(--rui-Button--small__padding-y),
29
+ padding-x: var(--rui-Button--small__padding-x),
30
+ font-size: var(--rui-Button--small__font-size),
31
+ ),
32
+ medium: (
33
+ height: var(--rui-Button--medium__height),
34
+ padding-y: var(--rui-Button--medium__padding-y),
35
+ padding-x: var(--rui-Button--medium__padding-x),
36
+ font-size: var(--rui-Button--medium__font-size),
37
+ ),
38
+ large: (
39
+ height: var(--rui-Button--large__height),
40
+ padding-y: var(--rui-Button--large__padding-y),
41
+ padding-x: var(--rui-Button--large__padding-x),
42
+ font-size: var(--rui-Button--large__font-size),
43
+ ),
41
44
  );
@@ -15,142 +15,140 @@
15
15
  //
16
16
  // 5. Use original padding to restore square buttons back to their size.
17
17
 
18
- @use 'sass:list';
19
- @use 'sass:map';
20
- @use 'sass:math';
21
- @use '../../styles/tools/accessibility';
22
- @use '../../styles/tools/breakpoint';
23
- @use '../../styles/tools/transition';
24
- @use 'settings';
25
- @use 'theme';
18
+ @use "sass:list";
19
+ @use "sass:map";
20
+ @use "sass:math";
21
+ @use "../../styles/tools/accessibility";
22
+ @use "../../styles/tools/breakpoint";
23
+ @use "../../styles/tools/transition";
24
+ @use "settings";
25
+ @use "theme";
26
26
 
27
27
  // 1.
28
28
  @mixin _get-themeable-properties($priority, $color, $state) {
29
- @if (not list.index(map.keys(settings.$themeable-priority-properties), $priority)) {
30
- @error "Invalid priority specified! #{$priority} doesn't exist. "
31
- + "Choose one of #{settings.$themeable-priority-properties}.";
32
- }
33
-
34
- @if (not list.index(settings.$themeable-variants, $color)) {
35
- @error "Invalid variant specified! #{$color} doesn't exist. "
36
- + "Choose one of #{settings.$themeable-variants}.";
37
- }
38
-
39
- @if (not list.index(settings.$themeable-states, $state)) {
40
- @error "Invalid state specified! #{$state} doesn't exist. "
41
- + "Choose one of #{settings.$themeable-states}.";
42
- }
43
-
44
- $properties: map.get(settings.$themeable-priority-properties, $priority);
45
-
46
- // 2.
47
- @if ($state == 'disabled') {
48
- @each $property in $properties {
49
- --rui-local-#{$property}:
50
- var(
51
- --rui-Button--#{$priority}--#{$color}--#{$state}__#{$property},
52
- var(--rui-Button--#{$priority}--#{$color}--default__#{$property})
53
- );
29
+ @if not list.index(map.keys(settings.$themeable-priority-properties), $priority) {
30
+ @error "Invalid priority specified! #{$priority} doesn't exist. "
31
+ + "Choose one of #{settings.$themeable-priority-properties}.";
54
32
  }
55
- }
56
33
 
57
- @else {
58
- @each $property in $properties {
59
- --rui-local-#{$property}: var(--rui-Button--#{$priority}--#{$color}--#{$state}__#{$property});
34
+ @if not list.index(settings.$themeable-variants, $color) {
35
+ @error "Invalid variant specified! #{$color} doesn't exist. "
36
+ + "Choose one of #{settings.$themeable-variants}.";
37
+ }
38
+
39
+ @if not list.index(settings.$themeable-states, $state) {
40
+ @error "Invalid state specified! #{$state} doesn't exist. "
41
+ + "Choose one of #{settings.$themeable-states}.";
42
+ }
43
+
44
+ $properties: map.get(settings.$themeable-priority-properties, $priority);
45
+
46
+ // 2.
47
+ @if $state == "disabled" {
48
+ @each $property in $properties {
49
+ --rui-local-#{$property}:
50
+ var(
51
+ --rui-Button--#{$priority}--#{$color}--#{$state}__#{$property},
52
+ var(--rui-Button--#{$priority}--#{$color}--default__#{$property})
53
+ );
54
+ }
55
+ } @else {
56
+ @each $property in $properties {
57
+ --rui-local-#{$property}: var(--rui-Button--#{$priority}--#{$color}--#{$state}__#{$property});
58
+ }
60
59
  }
61
- }
62
60
  }
63
61
 
64
62
  // 4.
65
63
  @mixin _button-square() {
66
- --rui-local-padding: 0;
67
- --rui-local-width: var(--rui-local-height);
64
+ --rui-local-padding: 0;
65
+ --rui-local-width: var(--rui-local-height);
68
66
  }
69
67
 
70
68
  // 5.
71
69
  @mixin _button-size-restore() {
72
- --rui-local-padding: var(--rui-local-padding-original);
73
- --rui-local-width: unset;
70
+ --rui-local-padding: var(--rui-local-padding-original);
71
+ --rui-local-width: unset;
74
72
  }
75
73
 
76
74
  @mixin button() {
77
- @include transition.add((opacity, color, border-color, background-color, box-shadow));
78
-
79
- position: relative; // 3.
80
- display: inline-flex;
81
- column-gap: settings.$icon-spacing;
82
- align-items: center;
83
- justify-content: center;
84
- width: var(--rui-local-width, auto);
85
- height: var(--rui-local-height, auto);
86
- padding: var(--rui-local-padding);
87
- font: theme.$font-weight list.slash(var(--rui-local-font-size), settings.$line-height) settings.$font-family;
88
- letter-spacing: theme.$letter-spacing;
89
- text-align: center;
90
- text-decoration: none;
91
- text-transform: theme.$text-transform;
92
- vertical-align: middle;
93
- color: var(--rui-local-color);
94
- border: theme.$border-width solid var(--rui-local-border-color, transparent);
95
- border-radius: theme.$border-radius;
96
- background: var(--rui-local-background, transparent);
97
- box-shadow: var(--rui-local-box-shadow, none);
98
- user-select: none;
99
- cursor: pointer;
100
-
101
- &:hover,
102
- &:focus {
75
+ @include transition.add((opacity, color, border-color, background-color, box-shadow));
76
+
77
+ position: relative; // 3.
78
+ display: inline-flex;
79
+ column-gap: settings.$icon-spacing;
80
+ align-items: center;
81
+ justify-content: center;
82
+ width: var(--rui-local-width, auto);
83
+ min-height: var(--rui-local-height, auto);
84
+ padding: var(--rui-local-padding);
85
+ font: theme.$font-weight list.slash(var(--rui-local-font-size), settings.$line-height) settings.$font-family;
86
+ letter-spacing: theme.$letter-spacing;
87
+ text-align: center;
103
88
  text-decoration: none;
104
- }
89
+ text-transform: theme.$text-transform;
90
+ vertical-align: middle;
91
+ color: var(--rui-local-color);
92
+ border: theme.$border-width solid var(--rui-local-border-color, transparent);
93
+ border-radius: theme.$border-radius;
94
+ background: var(--rui-local-background, transparent);
95
+ box-shadow: var(--rui-local-box-shadow, none);
96
+ user-select: none;
97
+ cursor: pointer;
98
+
99
+ &:hover,
100
+ &:focus {
101
+ text-decoration: none;
102
+ }
105
103
 
106
- &:disabled {
107
- opacity: theme.$disabled-opacity;
108
- cursor: theme.$disabled-cursor;
109
- }
104
+ &:disabled {
105
+ opacity: theme.$disabled-opacity;
106
+ cursor: theme.$disabled-cursor;
107
+ }
110
108
 
111
- &:-moz-focusring {
112
- outline: 0;
113
- }
109
+ &:-moz-focusring {
110
+ outline: 0;
111
+ }
114
112
  }
115
113
 
116
114
  @mixin button-size($size) {
117
- $properties: map.get(theme.$sizes, $size);
115
+ $properties: map.get(theme.$sizes, $size);
118
116
 
119
- --rui-local-height: #{map.get($properties, height)};
120
- --rui-local-padding: 0 #{map.get($properties, padding-x)};
121
- --rui-local-padding-original: 0 #{map.get($properties, padding-x)}; // 5.
122
- --rui-local-font-size: #{map.get($properties, font-size)};
117
+ --rui-local-height: #{map.get($properties, height)};
118
+ --rui-local-padding: #{map.get($properties, padding-y)} #{map.get($properties, padding-x)};
119
+ --rui-local-padding-original: #{map.get($properties, padding-y)} #{map.get($properties, padding-x)}; // 5.
120
+ --rui-local-font-size: #{map.get($properties, font-size)};
123
121
  }
124
122
 
125
123
  @mixin button-color($priority, $color) {
126
- @include _get-themeable-properties($priority, $color, default);
124
+ @include _get-themeable-properties($priority, $color, default);
127
125
 
128
- &:disabled {
129
- @include _get-themeable-properties($priority, $color, disabled);
130
- }
126
+ &:disabled {
127
+ @include _get-themeable-properties($priority, $color, disabled);
128
+ }
131
129
 
132
- &:not(:disabled):hover,
133
- &:not(:disabled):focus {
134
- @include _get-themeable-properties($priority, $color, hover);
135
- }
130
+ &:not(:disabled):hover,
131
+ &:not(:disabled):focus {
132
+ @include _get-themeable-properties($priority, $color, hover);
133
+ }
136
134
 
137
- &:not(:disabled):active {
138
- @include _get-themeable-properties($priority, $color, active);
139
- }
135
+ &:not(:disabled):active {
136
+ @include _get-themeable-properties($priority, $color, active);
137
+ }
140
138
  }
141
139
 
142
140
  @mixin hide-label() {
143
- @include _button-square();
141
+ @include _button-square();
144
142
 
145
- .label {
146
- @include accessibility.hide-text();
147
- }
143
+ .label {
144
+ @include accessibility.hide-text();
145
+ }
148
146
  }
149
147
 
150
148
  @mixin show-label() {
151
- @include _button-size-restore();
149
+ @include _button-size-restore();
152
150
 
153
- .label {
154
- @include accessibility.unhide-text();
155
- }
151
+ .label {
152
+ @include accessibility.unhide-text();
153
+ }
156
154
  }
@@ -17,12 +17,12 @@ export default (labelVisibility, styles) => {
17
17
  return styles.withLabelVisibleXl;
18
18
  }
19
19
 
20
- if (labelVisibility === 'xxl') {
21
- return styles.withLabelVisibleXxl;
20
+ if (labelVisibility === 'x2l') {
21
+ return styles.withLabelVisibleX2l;
22
22
  }
23
23
 
24
- if (labelVisibility === 'xxxl') {
25
- return styles.withLabelVisibleXxxl;
24
+ if (labelVisibility === 'x3l') {
25
+ return styles.withLabelVisibleX3l;
26
26
  }
27
27
 
28
28
  if (labelVisibility === 'none') {
@@ -1,6 +1,8 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { withProviderContext } from '../../provider';
3
+ import { withGlobalProps } from '../../provider';
4
+ import { classNames } from '../../utils/classNames';
5
+ import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
4
6
  import styles from './ButtonGroup.scss';
5
7
  import { ButtonGroupContext } from './ButtonGroupContext';
6
8
 
@@ -8,34 +10,44 @@ export const ButtonGroup = ({
8
10
  block,
9
11
  disabled,
10
12
  children,
13
+ id,
11
14
  priority,
12
15
  size,
13
16
  ...restProps
14
- }) => (
15
- <div
16
- className={[
17
- styles.root,
18
- block ? styles.isRootBlock : '',
19
- ].join(' ')}
20
- role="group"
21
- {...restProps}
22
- >
23
- <ButtonGroupContext.Provider
24
- value={{
25
- block,
26
- disabled,
27
- priority,
28
- size,
29
- }}
17
+ }) => {
18
+ if (isChildrenEmpty(children)) {
19
+ return null;
20
+ }
21
+
22
+ return (
23
+ <div
24
+ className={classNames(
25
+ styles.root,
26
+ block && styles.isRootBlock,
27
+ )}
28
+ id={id}
29
+ role="group"
30
+ {...restProps}
30
31
  >
31
- {children}
32
- </ButtonGroupContext.Provider>
33
- </div>
34
- );
32
+ <ButtonGroupContext.Provider
33
+ value={{
34
+ block,
35
+ disabled,
36
+ priority,
37
+ size,
38
+ }}
39
+ >
40
+ {children}
41
+ </ButtonGroupContext.Provider>
42
+ </div>
43
+ );
44
+ };
35
45
 
36
46
  ButtonGroup.defaultProps = {
37
47
  block: false,
48
+ children: null,
38
49
  disabled: false,
50
+ id: undefined,
39
51
  priority: 'filled',
40
52
  size: 'medium',
41
53
  };
@@ -46,13 +58,17 @@ ButtonGroup.propTypes = {
46
58
  */
47
59
  block: PropTypes.bool,
48
60
  /**
49
- * Buttons to be grouped.
61
+ * Buttons to be grouped. If none are provided nothing is rendered.
50
62
  */
51
- children: PropTypes.node.isRequired,
63
+ children: PropTypes.node,
52
64
  /**
53
65
  * If `true`, all buttons inside the group will be disabled.
54
66
  */
55
67
  disabled: PropTypes.bool,
68
+ /**
69
+ * ID of the root HTML element.
70
+ */
71
+ id: PropTypes.string,
56
72
  /**
57
73
  * Visual priority to highlight or suppress the buttons.
58
74
  */
@@ -63,6 +79,6 @@ ButtonGroup.propTypes = {
63
79
  size: PropTypes.oneOf(['small', 'medium', 'large']),
64
80
  };
65
81
 
66
- export const ButtonGroupWithContext = withProviderContext(ButtonGroup, 'ButtonGroup');
82
+ export const ButtonGroupWithGlobalProps = withGlobalProps(ButtonGroup, 'ButtonGroup');
67
83
 
68
- export default ButtonGroupWithContext;
84
+ export default ButtonGroupWithGlobalProps;
@@ -1,8 +1,8 @@
1
1
  .root {
2
- display: inline-flex;
2
+ display: inline-flex;
3
3
  }
4
4
 
5
5
  .isRootBlock {
6
- display: flex;
7
- width: 100%;
6
+ display: flex;
7
+ width: 100%;
8
8
  }
@@ -221,7 +221,7 @@ and communicating the state of individual options.
221
221
  <Playground>
222
222
  <>
223
223
  <span id="period-label">Period:</span>
224
- <ButtonGroup aria-labelledby="#period-label">
224
+ <ButtonGroup aria-labelledby="period-label">
225
225
  <Button label="Week" aria-pressed color="dark" />
226
226
  <Button label="Month" aria-pressed={false} />
227
227
  <Button label="Year" aria-pressed={false} />