@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,14 +1,19 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, {
3
+ useContext,
3
4
  useEffect,
4
5
  useLayoutEffect,
5
6
  useRef,
6
7
  useState,
7
8
  } from 'react';
8
- import { useLoadResize } from '../../hooks/useLoadResizeHook';
9
- import { useScrollPosition } from '../../hooks/useScrollPositionHook';
10
- import { withProviderContext } from '../../provider';
11
- import { getElementsPositionDifference } from '../../services/elementPositionService';
9
+ import {
10
+ RUIContext,
11
+ withGlobalProps,
12
+ } from '../../provider';
13
+ import { classNames } from '../../utils/classNames';
14
+ import { getElementsPositionDifference } from './_helpers/getElementsPositionDifference';
15
+ import { useLoadResize } from './_hooks/useLoadResizeHook';
16
+ import { useScrollPosition } from './_hooks/useScrollPositionHook';
12
17
  import styles from './ScrollView.scss';
13
18
 
14
19
  // Function `getElementsPositionDifference` sometimes returns floating point values that results
@@ -33,9 +38,10 @@ export const ScrollView = (props) => {
33
38
  scrollbar,
34
39
  shadowColor,
35
40
  shadowSize,
36
- translations,
37
41
  } = props;
38
42
 
43
+ const { translations } = useContext(RUIContext);
44
+
39
45
  const [isAutoScrollInProgress, setIsAutoScrollInProgress] = useState(false);
40
46
  const [isScrolledAtStart, setIsScrolledAtStart] = useState(false);
41
47
  const [isScrolledAtEnd, setIsScrolledAtEnd] = useState(false);
@@ -197,13 +203,13 @@ export const ScrollView = (props) => {
197
203
 
198
204
  return (
199
205
  <div
200
- className={[
206
+ className={classNames(
201
207
  styles.root,
202
- isScrolledAtStart ? styles.isRootScrolledAtStart : '',
203
- isScrolledAtEnd ? styles.isRootScrolledAtEnd : '',
204
- scrollbar ? '' : styles.hasRootScrollbarDisabled,
208
+ isScrolledAtStart && styles.isRootScrolledAtStart,
209
+ isScrolledAtEnd && styles.isRootScrolledAtEnd,
210
+ !scrollbar && styles.hasRootScrollbarDisabled,
205
211
  direction === 'horizontal' ? styles.isRootHorizontal : styles.isRootVertical,
206
- ].join(' ')}
212
+ )}
207
213
  style={inlineStyle(
208
214
  direction,
209
215
  arrowsColor,
@@ -236,7 +242,7 @@ export const ScrollView = (props) => {
236
242
  'prev',
237
243
  arrowsScrollStep,
238
244
  )}
239
- title={translations.previous}
245
+ title={translations.ScrollView.previous}
240
246
  id={id && `${id}__arrowPrevButton`}
241
247
  >
242
248
  {customPrevArrow || (
@@ -253,7 +259,7 @@ export const ScrollView = (props) => {
253
259
  'next',
254
260
  arrowsScrollStep,
255
261
  )}
256
- title={translations.next}
262
+ title={translations.ScrollView.next}
257
263
  id={id && `${id}__arrowNextButton`}
258
264
  >
259
265
  {customNextArrow || (
@@ -271,6 +277,7 @@ ScrollView.defaultProps = {
271
277
  arrowsColor: undefined,
272
278
  arrowsScrollStep: 200,
273
279
  autoScroll: 'off',
280
+ children: null,
274
281
  customEndShadowStyle: {},
275
282
  customNextArrow: null,
276
283
  customPrevArrow: null,
@@ -315,7 +322,7 @@ ScrollView.propTypes = {
315
322
  /**
316
323
  * Content to be scrollable.
317
324
  */
318
- children: PropTypes.node.isRequired,
325
+ children: PropTypes.node,
319
326
  /**
320
327
  * Custom CSS to replace the default end scrolling shadow.
321
328
  */
@@ -372,15 +379,8 @@ ScrollView.propTypes = {
372
379
  * mode.
373
380
  */
374
381
  shadowSize: PropTypes.string,
375
- /**
376
- * Translations required by the component.
377
- */
378
- translations: PropTypes.shape({
379
- next: PropTypes.string.isRequired,
380
- previous: PropTypes.string.isRequired,
381
- }).isRequired,
382
382
  };
383
383
 
384
- export const ScrollViewWithContext = withProviderContext(ScrollView, 'ScrollView');
384
+ export const ScrollViewWithGlobalProps = withGlobalProps(ScrollView, 'ScrollView');
385
385
 
386
- export default ScrollViewWithContext;
386
+ export default ScrollViewWithGlobalProps;
@@ -21,204 +21,204 @@
21
21
  // 7. Hide content overflowing in the other direction because scrollbars would be unreachable under
22
22
  // scrolling shadows.
23
23
 
24
- @use '../../styles/tools/accessibility';
25
- @use '../../styles/tools/caret';
26
- @use '../../styles/tools/reset';
27
- @use '../../styles/tools/scrollbar';
28
- @use '../../styles/tools/spacing';
29
- @use '../../styles/tools/transition';
30
- @use 'theme';
24
+ @use "../../styles/tools/accessibility";
25
+ @use "../../styles/tools/caret";
26
+ @use "../../styles/tools/reset";
27
+ @use "../../styles/tools/scrollbar";
28
+ @use "../../styles/tools/spacing";
29
+ @use "../../styles/tools/transition";
30
+ @use "theme";
31
31
 
32
32
  $_arrow-inner-spacing: spacing.of(2);
33
33
  $_arrow-outer-spacing: spacing.of(4);
34
34
 
35
35
  .root {
36
- position: relative; // 2.
37
- display: flex;
38
- flex-direction: column;
39
- width: 100%;
36
+ position: relative; // 2.
37
+ display: flex;
38
+ flex-direction: column;
39
+ width: 100%;
40
40
  }
41
41
 
42
42
  // 1.
43
43
  .scrollingShadows {
44
- position: absolute; // 2.
45
- width: 100%; // 2.
46
- height: 100%; // 2.
47
- overflow: hidden; // 2.
48
-
49
- &::before,
50
- &::after {
51
- @include transition.add((visibility, opacity, transform));
52
-
53
- content: '';
54
- position: absolute;
55
- z-index: 2; // 2.
56
- display: block;
57
- width: var(--rui-local-shadow-width);
58
- height: var(--rui-local-shadow-height);
59
- visibility: hidden;
60
- opacity: 0;
61
- }
62
-
63
- &::before {
64
- background: var(--rui-local-start-shadow-background);
65
- box-shadow: var(--rui-local-start-shadow-box-shadow);
66
- }
67
-
68
- &::after {
69
- background: var(--rui-local-end-shadow-background);
70
- box-shadow: var(--rui-local-end-shadow-box-shadow);
71
- }
44
+ position: absolute; // 2.
45
+ width: 100%; // 2.
46
+ height: 100%; // 2.
47
+ overflow: hidden; // 2.
48
+
49
+ &::before,
50
+ &::after {
51
+ @include transition.add((visibility, opacity, transform));
52
+
53
+ content: "";
54
+ position: absolute;
55
+ z-index: 2; // 2.
56
+ display: block;
57
+ width: var(--rui-local-shadow-width);
58
+ height: var(--rui-local-shadow-height);
59
+ visibility: hidden;
60
+ opacity: 0;
61
+ }
62
+
63
+ &::before {
64
+ background: var(--rui-local-start-shadow-background);
65
+ box-shadow: var(--rui-local-start-shadow-box-shadow);
66
+ }
67
+
68
+ &::after {
69
+ background: var(--rui-local-end-shadow-background);
70
+ box-shadow: var(--rui-local-end-shadow-box-shadow);
71
+ }
72
72
  }
73
73
 
74
74
  .viewport {
75
- z-index: 1; // 2.
76
- width: 100%;
77
- scroll-behavior: smooth;
78
- -webkit-overflow-scrolling: touch;
75
+ z-index: 1; // 2.
76
+ width: 100%;
77
+ scroll-behavior: smooth;
78
+ -webkit-overflow-scrolling: touch;
79
79
  }
80
80
 
81
81
  .arrowPrev,
82
82
  .arrowNext {
83
- @include reset.button();
84
- @include accessibility.min-tap-target();
85
- @include transition.add((visibility, opacity, transform));
83
+ @include reset.button();
84
+ @include accessibility.min-tap-target();
85
+ @include transition.add((visibility, opacity, transform));
86
86
 
87
- position: absolute; // 3.
88
- z-index: 3; // 3.
89
- display: flex;
90
- align-items: center;
91
- justify-content: center;
92
- color: var(--rui-local-arrow-color);
93
- visibility: hidden;
94
- opacity: 0;
87
+ position: absolute; // 3.
88
+ z-index: 3; // 3.
89
+ display: flex;
90
+ align-items: center;
91
+ justify-content: center;
92
+ color: var(--rui-local-arrow-color);
93
+ visibility: hidden;
94
+ opacity: 0;
95
95
  }
96
96
 
97
97
  .arrowIcon {
98
- @include caret.create();
98
+ @include caret.create();
99
99
  }
100
100
 
101
101
  .isRootVertical {
102
- height: 100%;
103
- min-height: 0; // 6.
102
+ height: 100%;
103
+ min-height: 0; // 6.
104
104
  }
105
105
 
106
106
  .isRootVertical .viewport {
107
- height: 100%;
108
- overflow-x: hidden; // 7.
109
- overflow-y: auto; // 2.
107
+ height: 100%;
108
+ overflow-x: hidden; // 7.
109
+ overflow-y: auto; // 2.
110
110
  }
111
111
 
112
112
  .isRootVertical .arrowPrev {
113
- top: 0;
114
- right: 0;
115
- left: 0;
116
- width: 100%;
117
- padding-top: $_arrow-outer-spacing;
118
- padding-bottom: $_arrow-inner-spacing;
119
- transform: translateY(theme.$arrow-initial-offset);
113
+ top: 0;
114
+ right: 0;
115
+ left: 0;
116
+ width: 100%;
117
+ padding-top: $_arrow-outer-spacing;
118
+ padding-bottom: $_arrow-inner-spacing;
119
+ transform: translateY(theme.$arrow-initial-offset);
120
120
  }
121
121
 
122
122
  .isRootVertical .arrowPrev .arrowIcon {
123
- @include caret.rotate(180);
123
+ @include caret.rotate(180);
124
124
  }
125
125
 
126
126
  .isRootVertical .arrowNext {
127
- right: 0;
128
- bottom: 0;
129
- left: 0;
130
- width: 100%;
131
- padding-top: $_arrow-inner-spacing;
132
- padding-bottom: $_arrow-outer-spacing;
133
- transform: translateY(calc(-1 * #{theme.$arrow-initial-offset}));
127
+ right: 0;
128
+ bottom: 0;
129
+ left: 0;
130
+ width: 100%;
131
+ padding-top: $_arrow-inner-spacing;
132
+ padding-bottom: $_arrow-outer-spacing;
133
+ transform: translateY(calc(-1 * #{theme.$arrow-initial-offset}));
134
134
  }
135
135
 
136
136
  .isRootHorizontal {
137
- min-width: 0; // 6.
137
+ min-width: 0; // 6.
138
138
  }
139
139
 
140
140
  .isRootHorizontal .arrowPrev {
141
- top: 0;
142
- bottom: 0;
143
- left: 0;
144
- padding-right: $_arrow-inner-spacing;
145
- padding-left: $_arrow-outer-spacing;
146
- transform: translateX(theme.$arrow-initial-offset);
141
+ top: 0;
142
+ bottom: 0;
143
+ left: 0;
144
+ padding-right: $_arrow-inner-spacing;
145
+ padding-left: $_arrow-outer-spacing;
146
+ transform: translateX(theme.$arrow-initial-offset);
147
147
  }
148
148
 
149
149
  .isRootHorizontal .arrowPrev .arrowIcon {
150
- @include caret.rotate(90);
150
+ @include caret.rotate(90);
151
151
  }
152
152
 
153
153
  .isRootHorizontal .arrowNext {
154
- top: 0;
155
- right: 0;
156
- bottom: 0;
157
- padding-right: $_arrow-outer-spacing;
158
- padding-left: $_arrow-inner-spacing;
159
- transform: translateX(calc(-1 * #{theme.$arrow-initial-offset}));
154
+ top: 0;
155
+ right: 0;
156
+ bottom: 0;
157
+ padding-right: $_arrow-outer-spacing;
158
+ padding-left: $_arrow-inner-spacing;
159
+ transform: translateX(calc(-1 * #{theme.$arrow-initial-offset}));
160
160
  }
161
161
 
162
162
  .isRootHorizontal .arrowNext .arrowIcon {
163
- @include caret.rotate(270);
163
+ @include caret.rotate(270);
164
164
  }
165
165
 
166
166
  .isRootVertical .scrollingShadows::before,
167
167
  .isRootVertical .scrollingShadows::after {
168
- right: 0;
169
- left: 0;
168
+ right: 0;
169
+ left: 0;
170
170
  }
171
171
 
172
172
  .isRootVertical .scrollingShadows::before {
173
- top: 0;
174
- transform: translateY(theme.$shadow-initial-offset);
173
+ top: 0;
174
+ transform: translateY(theme.$shadow-initial-offset);
175
175
  }
176
176
 
177
177
  .isRootVertical .scrollingShadows::after {
178
- bottom: 0;
179
- transform: translateY(calc(-1 * #{theme.$shadow-initial-offset}));
178
+ bottom: 0;
179
+ transform: translateY(calc(-1 * #{theme.$shadow-initial-offset}));
180
180
  }
181
181
 
182
182
  .isRootHorizontal .viewport {
183
- overflow-x: auto; // 2.
184
- overflow-y: hidden; // 5., 7.
183
+ overflow-x: auto; // 2.
184
+ overflow-y: hidden; // 5., 7.
185
185
  }
186
186
 
187
187
  .isRootHorizontal .content {
188
- display: inline-flex; // 4.
189
- min-width: 100%;
188
+ display: inline-flex; // 4.
189
+ min-width: 100%;
190
190
  }
191
191
 
192
192
  .isRootHorizontal .scrollingShadows::before,
193
193
  .isRootHorizontal .scrollingShadows::after {
194
- top: 0;
195
- bottom: 0;
194
+ top: 0;
195
+ bottom: 0;
196
196
  }
197
197
 
198
198
  .isRootHorizontal .scrollingShadows::before {
199
- left: 0;
200
- transform: translateX(theme.$shadow-initial-offset);
199
+ left: 0;
200
+ transform: translateX(theme.$shadow-initial-offset);
201
201
  }
202
202
 
203
203
  .isRootHorizontal .scrollingShadows::after {
204
- right: 0;
205
- transform: translateX(calc(-1 * #{theme.$shadow-initial-offset}));
204
+ right: 0;
205
+ transform: translateX(calc(-1 * #{theme.$shadow-initial-offset}));
206
206
  }
207
207
 
208
208
  .isRootScrolledAtStart .scrollingShadows::before,
209
209
  .isRootScrolledAtStart .arrowPrev {
210
- visibility: visible;
211
- opacity: 1;
212
- transform: translate(0, 0);
210
+ visibility: visible;
211
+ opacity: 1;
212
+ transform: translate(0, 0);
213
213
  }
214
214
 
215
215
  .isRootScrolledAtEnd .scrollingShadows::after,
216
216
  .isRootScrolledAtEnd .arrowNext {
217
- visibility: visible;
218
- opacity: 1;
219
- transform: translate(0, 0);
217
+ visibility: visible;
218
+ opacity: 1;
219
+ transform: translate(0, 0);
220
220
  }
221
221
 
222
222
  .hasRootScrollbarDisabled .viewport {
223
- @include scrollbar.hide();
223
+ @include scrollbar.hide();
224
224
  }
@@ -9,5 +9,3 @@ export const getElementsPositionDifference = (contentEl, viewportEl) => {
9
9
  top: contentPosition.top - viewportPosition.top,
10
10
  };
11
11
  };
12
-
13
- export default getElementsPositionDifference;
@@ -2,7 +2,7 @@ import {
2
2
  useLayoutEffect,
3
3
  useRef,
4
4
  } from 'react';
5
- import { getElementsPositionDifference } from '../services/elementPositionService';
5
+ import { getElementsPositionDifference } from '../_helpers/getElementsPositionDifference';
6
6
 
7
7
  export const useLoadResize = (effect, dependencies, contentEl, viewportEl, wait) => {
8
8
  const throttleTimeout = useRef(null);
@@ -2,7 +2,7 @@ import {
2
2
  useLayoutEffect,
3
3
  useRef,
4
4
  } from 'react';
5
- import { getElementsPositionDifference } from '../services/elementPositionService';
5
+ import { getElementsPositionDifference } from '../_helpers/getElementsPositionDifference';
6
6
 
7
7
  export const useScrollPosition = (effect, dependencies, contentEl, viewportEl, wait) => {
8
8
  const throttleTimeout = useRef(null);
@@ -598,7 +598,7 @@ It's possible to disable just some options or the whole input.
598
598
 
599
599
  In addition to the options below, you can specify [React synthetic events] or
600
600
  any custom HTML attributes that do not interfere with the API, and they will be
601
- passed to the `select` HTML element. This enables making the component
601
+ passed to the `<select>` HTML element. This enables making the component
602
602
  interactive and helps improve its accessibility.
603
603
 
604
604
  <Props table of={SelectField} />
@@ -1,10 +1,11 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
- import getRootSizeClassName from '../../helpers/getRootSizeClassName';
4
- import getRootValidationStateClassName from '../../helpers/getRootValidationStateClassName';
5
- import { resolveContextOrProp } from '../../helpers/resolveContextOrProp';
6
- import { withProviderContext } from '../../provider';
7
- import transferProps from '../../utils/transferProps';
3
+ import { withGlobalProps } from '../../provider';
4
+ import { classNames } from '../../utils/classNames';
5
+ import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
6
+ import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
7
+ import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
8
+ import { transferProps } from '../_helpers/transferProps';
8
9
  import { FormLayoutContext } from '../FormLayout';
9
10
  import withForwardedRef from '../withForwardedRef';
10
11
  import styles from './SelectField.scss';
@@ -31,27 +32,27 @@ export const SelectField = ({
31
32
 
32
33
  return (
33
34
  <label
34
- className={[
35
+ className={classNames(
35
36
  styles.root,
36
- fullWidth ? styles.isRootFullWidth : '',
37
- context ? styles.isRootInFormLayout : '',
37
+ fullWidth && styles.isRootFullWidth,
38
+ context && styles.isRootInFormLayout,
38
39
  resolveContextOrProp(context && context.layout, layout) === 'horizontal'
39
40
  ? styles.rootLayoutHorizontal
40
41
  : styles.rootLayoutVertical,
41
- disabled ? styles.isRootDisabled : '',
42
- required ? styles.isRootRequired : '',
42
+ disabled && styles.isRootDisabled,
43
+ required && styles.isRootRequired,
43
44
  getRootSizeClassName(size, styles),
44
45
  getRootValidationStateClassName(validationState, styles),
45
46
  variant === 'filled' ? styles.rootVariantFilled : styles.rootVariantOutline,
46
- ].join(' ')}
47
+ )}
47
48
  htmlFor={id}
48
49
  id={id && `${id}__label`}
49
50
  >
50
51
  <div
51
- className={[
52
+ className={classNames(
52
53
  styles.label,
53
- isLabelVisible ? '' : styles.isLabelHidden,
54
- ].join(' ')}
54
+ !isLabelVisible && styles.isLabelHidden,
55
+ )}
55
56
  id={id && `${id}__labelText`}
56
57
  >
57
58
  {label}
@@ -214,6 +215,6 @@ SelectField.propTypes = {
214
215
  variant: PropTypes.oneOf(['filled', 'outline']),
215
216
  };
216
217
 
217
- export const SelectFieldWithContext = withForwardedRef(withProviderContext(SelectField, 'SelectField'));
218
+ export const SelectFieldWithGlobalProps = withForwardedRef(withGlobalProps(SelectField, 'SelectField'));
218
219
 
219
- export default SelectFieldWithContext;
220
+ export default SelectFieldWithGlobalProps;
@@ -1,104 +1,104 @@
1
- @use '../../styles/tools/form-fields/box-field-elements';
2
- @use '../../styles/tools/form-fields/box-field-layout';
3
- @use '../../styles/tools/form-fields/box-field-sizes';
4
- @use '../../styles/tools/form-fields/foundation';
5
- @use '../../styles/tools/form-fields/variants';
6
- @use '../../styles/tools/accessibility';
1
+ @use "../../styles/tools/form-fields/box-field-elements";
2
+ @use "../../styles/tools/form-fields/box-field-layout";
3
+ @use "../../styles/tools/form-fields/box-field-sizes";
4
+ @use "../../styles/tools/form-fields/foundation";
5
+ @use "../../styles/tools/form-fields/variants";
6
+ @use "../../styles/tools/accessibility";
7
7
 
8
8
  // Foundation
9
9
  .root {
10
- @include foundation.root();
10
+ @include foundation.root();
11
11
  }
12
12
 
13
13
  .label {
14
- @include foundation.label();
14
+ @include foundation.label();
15
15
  }
16
16
 
17
17
  .inputContainer {
18
- @include box-field-elements.input-container();
18
+ @include box-field-elements.input-container();
19
19
  }
20
20
 
21
21
  .input {
22
- @include box-field-elements.input();
23
- @include box-field-elements.input-select();
24
- @include box-field-elements.input-select-option();
22
+ @include box-field-elements.input();
23
+ @include box-field-elements.input-select();
24
+ @include box-field-elements.input-select-option();
25
25
  }
26
26
 
27
27
  .caret {
28
- @include box-field-elements.caret();
28
+ @include box-field-elements.caret();
29
29
  }
30
30
 
31
31
  .caretIcon {
32
- @include box-field-elements.caret-icon();
32
+ @include box-field-elements.caret-icon();
33
33
  }
34
34
 
35
35
  .bottomLine {
36
- @include box-field-elements.bottom-line();
36
+ @include box-field-elements.bottom-line();
37
37
  }
38
38
 
39
39
  .helpText,
40
40
  .validationText {
41
- @include foundation.help-text();
41
+ @include foundation.help-text();
42
42
  }
43
43
 
44
44
  .isRootRequired .label {
45
- @include foundation.label-required();
45
+ @include foundation.label-required();
46
46
  }
47
47
 
48
48
  // Variants
49
49
  .rootVariantFilled {
50
- @include variants.visual(box, $variant: filled, $has-caret: true);
50
+ @include variants.visual(box, $variant: filled, $has-caret: true);
51
51
  }
52
52
 
53
53
  .rootVariantOutline {
54
- @include variants.visual(box, $variant: outline, $has-caret: true);
54
+ @include variants.visual(box, $variant: outline, $has-caret: true);
55
55
  }
56
56
 
57
57
  // States
58
58
  .isRootStateInvalid {
59
- @include variants.validation(invalid);
59
+ @include variants.validation(invalid);
60
60
  }
61
61
 
62
62
  .isRootStateValid {
63
- @include variants.validation(valid);
63
+ @include variants.validation(valid);
64
64
  }
65
65
 
66
66
  .isRootStateWarning {
67
- @include variants.validation(warning);
67
+ @include variants.validation(warning);
68
68
  }
69
69
 
70
70
  // Invisible label
71
71
  .isLabelHidden {
72
- @include accessibility.hide-text();
72
+ @include accessibility.hide-text();
73
73
  }
74
74
 
75
75
  // Layouts
76
76
  .rootLayoutVertical,
77
77
  .rootLayoutHorizontal {
78
- @include box-field-layout.vertical();
78
+ @include box-field-layout.vertical();
79
79
  }
80
80
 
81
81
  .rootLayoutHorizontal {
82
- @include box-field-layout.horizontal();
82
+ @include box-field-layout.horizontal();
83
83
  }
84
84
 
85
85
  .isRootFullWidth {
86
- @include box-field-layout.full-width();
86
+ @include box-field-layout.full-width();
87
87
  }
88
88
 
89
89
  .isRootInFormLayout {
90
- @include box-field-layout.in-form-layout();
90
+ @include box-field-layout.in-form-layout();
91
91
  }
92
92
 
93
93
  // Sizes
94
94
  .rootSizeSmall {
95
- @include box-field-sizes.size(small);
95
+ @include box-field-sizes.size(small);
96
96
  }
97
97
 
98
98
  .rootSizeMedium {
99
- @include box-field-sizes.size(medium);
99
+ @include box-field-sizes.size(medium);
100
100
  }
101
101
 
102
102
  .rootSizeLarge {
103
- @include box-field-sizes.size(large);
103
+ @include box-field-sizes.size(large);
104
104
  }
@@ -77,7 +77,7 @@ See [API](#api) for all available options.
77
77
 
78
78
  - Tables are **good for displaying complex tabular data.** For simpler data sets
79
79
  or even plain key-value pairs, consider using the
80
- [List](/components/list) component.
80
+ [Grid](/components/grid) component.
81
81
 
82
82
  - Tables make **lots of information easier to scan and compare.** If you have
83
83
  fewer sections and want to emphasize each group more, consider using