@react-ui-org/react-ui 0.44.1 → 0.45.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 (139) hide show
  1. package/dist/lib.development.js +138 -258
  2. package/dist/lib.js +1 -1
  3. package/package.json +7 -10
  4. package/src/lib/components/Alert/Alert.jsx +4 -3
  5. package/src/lib/components/Alert/Alert.scss +48 -48
  6. package/src/lib/components/Alert/_settings.scss +4 -4
  7. package/src/lib/components/Alert/_theme.scss +50 -50
  8. package/src/lib/components/Alert/_tools.scss +6 -6
  9. package/src/lib/components/Badge/Badge.jsx +5 -4
  10. package/src/lib/components/Badge/Badge.scss +57 -57
  11. package/src/lib/components/Button/Button.jsx +10 -9
  12. package/src/lib/components/Button/Button.scss +2 -2
  13. package/src/lib/components/Button/README.mdx +6 -1
  14. package/src/lib/components/Button/_base.scss +65 -65
  15. package/src/lib/components/Button/_priorities.scss +49 -49
  16. package/src/lib/components/Button/_settings.scss +10 -10
  17. package/src/lib/components/Button/_theme.scss +18 -15
  18. package/src/lib/components/Button/_tools.scss +98 -100
  19. package/src/lib/components/ButtonGroup/ButtonGroup.jsx +4 -3
  20. package/src/lib/components/ButtonGroup/ButtonGroup.scss +3 -3
  21. package/src/lib/components/Card/Card.jsx +7 -6
  22. package/src/lib/components/Card/Card.scss +28 -28
  23. package/src/lib/components/Card/_theme.scss +50 -50
  24. package/src/lib/components/Card/_tools.scss +6 -6
  25. package/src/lib/components/CheckboxField/CheckboxField.jsx +12 -11
  26. package/src/lib/components/CheckboxField/CheckboxField.scss +20 -20
  27. package/src/lib/components/FileInputField/FileInputField.jsx +13 -12
  28. package/src/lib/components/FileInputField/FileInputField.scss +19 -19
  29. package/src/lib/components/FormLayout/FormLayout.jsx +5 -4
  30. package/src/lib/components/FormLayout/FormLayout.scss +17 -17
  31. package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +9 -8
  32. package/src/lib/components/FormLayout/FormLayoutCustomField.scss +18 -18
  33. package/src/lib/components/FormLayout/README.mdx +16 -36
  34. package/src/lib/components/Grid/Grid.jsx +1 -1
  35. package/src/lib/components/Grid/Grid.scss +28 -30
  36. package/src/lib/components/Grid/GridSpan.jsx +1 -1
  37. package/src/lib/components/Grid/{helpers → _helpers}/generateResponsiveCustomProperties.js +0 -2
  38. package/src/lib/components/Grid/_theme.scss +9 -9
  39. package/src/lib/components/Grid/_tools.scss +20 -20
  40. package/src/lib/components/Link/Link.jsx +1 -1
  41. package/src/lib/components/Link/Link.scss +7 -7
  42. package/src/lib/components/List/List.jsx +11 -10
  43. package/src/lib/components/List/List.scss +21 -21
  44. package/src/lib/components/Media/Media.scss +6 -6
  45. package/src/lib/components/Modal/Modal.jsx +6 -5
  46. package/src/lib/components/Modal/Modal.scss +73 -73
  47. package/src/lib/components/Modal/_settings.scss +5 -5
  48. package/src/lib/components/Modal/_theme.scss +17 -17
  49. package/src/lib/components/Paper/Paper.jsx +5 -4
  50. package/src/lib/components/Paper/Paper.scss +8 -8
  51. package/src/lib/components/Radio/Radio.jsx +12 -11
  52. package/src/lib/components/Radio/Radio.scss +26 -26
  53. package/src/lib/components/ScrollView/ScrollView.jsx +9 -8
  54. package/src/lib/components/ScrollView/ScrollView.scss +113 -113
  55. package/src/lib/{services/elementPositionService.js → components/ScrollView/_helpers/getElementsPositionDifference.js} +0 -2
  56. package/src/lib/{hooks → components/ScrollView/_hooks}/useLoadResizeHook.js +1 -1
  57. package/src/lib/{hooks → components/ScrollView/_hooks}/useScrollPositionHook.js +1 -1
  58. package/src/lib/components/SelectField/SelectField.jsx +14 -13
  59. package/src/lib/components/SelectField/SelectField.scss +30 -30
  60. package/src/lib/components/Table/Table.scss +28 -35
  61. package/src/lib/components/Table/_settings.scss +5 -5
  62. package/src/lib/components/Tabs/Tabs.scss +21 -21
  63. package/src/lib/components/Tabs/TabsItem.jsx +4 -3
  64. package/src/lib/components/Tabs/TabsItem.scss +78 -78
  65. package/src/lib/components/Text/Text.jsx +5 -4
  66. package/src/lib/components/Text/Text.scss +12 -12
  67. package/src/lib/components/Text/{helpers → _helpers}/getRootHyphensClassName.js +1 -1
  68. package/src/lib/components/Text/{helpers → _helpers}/getRootWordWrappingClassName.js +1 -1
  69. package/src/lib/components/TextArea/TextArea.jsx +14 -13
  70. package/src/lib/components/TextArea/TextArea.scss +27 -27
  71. package/src/lib/components/TextField/TextField.jsx +16 -15
  72. package/src/lib/components/TextField/TextField.scss +28 -28
  73. package/src/lib/components/Toggle/Toggle.jsx +12 -11
  74. package/src/lib/components/Toggle/Toggle.scss +20 -20
  75. package/src/lib/components/Toolbar/Toolbar.jsx +5 -4
  76. package/src/lib/components/Toolbar/Toolbar.scss +25 -25
  77. package/src/lib/components/Toolbar/ToolbarGroup.jsx +5 -4
  78. package/src/lib/{helpers → components/_helpers}/getRootColorClassName.js +1 -1
  79. package/src/lib/{helpers → components/_helpers}/getRootSizeClassName.js +1 -1
  80. package/src/lib/{helpers → components/_helpers}/getRootValidationStateClassName.js +1 -1
  81. package/src/lib/{helpers → components/_helpers}/resolveContextOrProp.js +0 -0
  82. package/src/lib/{utils → components/_helpers}/transferProps.js +1 -1
  83. package/src/lib/foundation.scss +11 -11
  84. package/src/lib/helpers.scss +2 -2
  85. package/src/lib/index.js +3 -7
  86. package/src/lib/styles/_utilities.scss +13 -13
  87. package/src/lib/styles/elements/_code.scss +7 -7
  88. package/src/lib/styles/elements/_links.scss +8 -8
  89. package/src/lib/styles/elements/_lists.scss +3 -3
  90. package/src/lib/styles/elements/_page.scss +14 -14
  91. package/src/lib/styles/elements/_rulers.scss +6 -6
  92. package/src/lib/styles/elements/_small.scss +2 -2
  93. package/src/lib/styles/generic/_box-sizing.scss +3 -2
  94. package/src/lib/styles/generic/_forms.scss +3 -3
  95. package/src/lib/styles/generic/_reset.scss +6 -6
  96. package/src/lib/styles/generic/_shared.scss +3 -3
  97. package/src/lib/styles/helpers/_animation.scss +8 -8
  98. package/src/lib/styles/settings/_breakpoints.scss +7 -7
  99. package/src/lib/styles/settings/_escaped-characters.scss +5 -5
  100. package/src/lib/styles/settings/_form-fields.scss +24 -24
  101. package/src/lib/styles/settings/_utilities.scss +112 -100
  102. package/src/lib/styles/theme/_colors.scss +50 -50
  103. package/src/lib/styles/theme/_form-fields.scss +32 -32
  104. package/src/lib/styles/theme/_spacing.scss +11 -11
  105. package/src/lib/styles/theme/_typography.scss +12 -11
  106. package/src/lib/styles/theme-constants/_breakpoints.scss +2 -2
  107. package/src/lib/styles/theme-constants/_colors.scss +2 -2
  108. package/src/lib/styles/theme-constants/_svg.scss +1 -2
  109. package/src/lib/styles/tools/_accessibility.scss +29 -29
  110. package/src/lib/styles/tools/_breakpoint.scss +11 -14
  111. package/src/lib/styles/tools/_caret.scss +8 -8
  112. package/src/lib/styles/tools/_colors.scss +3 -3
  113. package/src/lib/styles/tools/_reset.scss +21 -21
  114. package/src/lib/styles/tools/_scrollbar.scss +4 -4
  115. package/src/lib/styles/tools/_spacing.scss +17 -21
  116. package/src/lib/styles/tools/_string.scss +9 -9
  117. package/src/lib/styles/tools/_svg.scss +13 -16
  118. package/src/lib/styles/tools/_transition.scss +42 -44
  119. package/src/lib/styles/tools/_utilities.scss +19 -19
  120. package/src/lib/styles/tools/form-fields/_box-field-elements.scss +88 -88
  121. package/src/lib/styles/tools/form-fields/_box-field-layout.scss +144 -144
  122. package/src/lib/styles/tools/form-fields/_box-field-sizes.scss +13 -15
  123. package/src/lib/styles/tools/form-fields/_foundation.scss +12 -12
  124. package/src/lib/styles/tools/form-fields/_inline-field-elements.scss +71 -71
  125. package/src/lib/styles/tools/form-fields/_inline-field-layout.scss +44 -44
  126. package/src/lib/styles/tools/form-fields/_variants.scss +104 -106
  127. package/src/lib/theme.scss +958 -954
  128. package/src/lib/utils/classNames.js +8 -0
  129. package/src/lib/components/CTA/CTA.jsx +0 -60
  130. package/src/lib/components/CTA/CTA.scss +0 -71
  131. package/src/lib/components/CTA/CTACenter.jsx +0 -27
  132. package/src/lib/components/CTA/CTAEnd.jsx +0 -27
  133. package/src/lib/components/CTA/CTAStart.jsx +0 -27
  134. package/src/lib/components/CTA/README.mdx +0 -119
  135. package/src/lib/components/CTA/index.js +0 -4
  136. package/src/lib/components/Center/Center.jsx +0 -27
  137. package/src/lib/components/Center/Center.scss +0 -7
  138. package/src/lib/components/Center/README.mdx +0 -52
  139. package/src/lib/components/Center/index.js +0 -1
@@ -1,9 +1,10 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
- import getRootValidationStateClassName from '../../helpers/getRootValidationStateClassName';
4
- import { resolveContextOrProp } from '../../helpers/resolveContextOrProp';
5
3
  import { withProviderContext } from '../../provider';
6
- import transferProps from '../../utils/transferProps';
4
+ import { classNames } from '../../utils/classNames';
5
+ import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
6
+ import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
7
+ import { transferProps } from '../_helpers/transferProps';
7
8
  import { FormLayoutContext } from '../FormLayout';
8
9
  import withForwardedRef from '../withForwardedRef';
9
10
  import styles from './FileInputField.scss';
@@ -26,25 +27,25 @@ export const FileInputField = ({
26
27
 
27
28
  return (
28
29
  <label
29
- className={[
30
+ className={classNames(
30
31
  styles.root,
31
- fullWidth ? styles.isRootFullWidth : '',
32
- context ? styles.isRootInFormLayout : '',
32
+ fullWidth && styles.isRootFullWidth,
33
+ context && styles.isRootInFormLayout,
33
34
  resolveContextOrProp(context && context.layout, layout) === 'horizontal'
34
35
  ? styles.rootLayoutHorizontal
35
36
  : styles.rootLayoutVertical,
36
- disabled ? styles.isRootDisabled : '',
37
- required ? styles.isRootRequired : '',
37
+ disabled && styles.isRootDisabled,
38
+ required && styles.isRootRequired,
38
39
  getRootValidationStateClassName(validationState, styles),
39
- ].join(' ')}
40
+ )}
40
41
  htmlFor={id}
41
42
  id={id && `${id}__label`}
42
43
  >
43
44
  <div
44
- className={[
45
+ className={classNames(
45
46
  styles.label,
46
- isLabelVisible ? '' : styles.isLabelHidden,
47
- ].join(' ')}
47
+ !isLabelVisible && styles.isLabelHidden,
48
+ )}
48
49
  id={id && `${id}__labelText`}
49
50
  >
50
51
  {label}
@@ -1,67 +1,67 @@
1
- @use '../../styles/tools/form-fields/box-field-elements';
2
- @use '../../styles/tools/form-fields/box-field-layout';
3
- @use '../../styles/tools/form-fields/foundation';
4
- @use '../../styles/tools/form-fields/variants';
5
- @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/foundation";
4
+ @use "../../styles/tools/form-fields/variants";
5
+ @use "../../styles/tools/accessibility";
6
6
 
7
7
  // Foundation
8
8
  .root {
9
- @include foundation.root();
9
+ @include foundation.root();
10
10
  }
11
11
 
12
12
  .label {
13
- @include foundation.label();
13
+ @include foundation.label();
14
14
  }
15
15
 
16
16
  .inputContainer {
17
- @include box-field-elements.input-container();
17
+ @include box-field-elements.input-container();
18
18
  }
19
19
 
20
20
  .input {
21
- @include accessibility.focus-ring();
21
+ @include accessibility.focus-ring();
22
22
  }
23
23
 
24
24
  .helpText,
25
25
  .validationText {
26
- @include foundation.help-text();
26
+ @include foundation.help-text();
27
27
  }
28
28
 
29
29
  .isRootRequired .label {
30
- @include foundation.label-required();
30
+ @include foundation.label-required();
31
31
  }
32
32
 
33
33
  // States
34
34
  .isRootStateInvalid {
35
- @include variants.validation(invalid);
35
+ @include variants.validation(invalid);
36
36
  }
37
37
 
38
38
  .isRootStateValid {
39
- @include variants.validation(valid);
39
+ @include variants.validation(valid);
40
40
  }
41
41
 
42
42
  .isRootStateWarning {
43
- @include variants.validation(warning);
43
+ @include variants.validation(warning);
44
44
  }
45
45
 
46
46
  // Invisible label
47
47
  .isLabelHidden {
48
- @include accessibility.hide-text();
48
+ @include accessibility.hide-text();
49
49
  }
50
50
 
51
51
  // Layouts
52
52
  .rootLayoutVertical,
53
53
  .rootLayoutHorizontal {
54
- @include box-field-layout.vertical();
54
+ @include box-field-layout.vertical();
55
55
  }
56
56
 
57
57
  .rootLayoutHorizontal {
58
- @include box-field-layout.horizontal();
58
+ @include box-field-layout.horizontal();
59
59
  }
60
60
 
61
61
  .isRootFullWidth {
62
- @include box-field-layout.full-width();
62
+ @include box-field-layout.full-width();
63
63
  }
64
64
 
65
65
  .isRootInFormLayout {
66
- @include box-field-layout.in-form-layout();
66
+ @include box-field-layout.in-form-layout();
67
67
  }
@@ -1,6 +1,7 @@
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';
4
5
  import { FormLayoutContext } from './FormLayoutContext';
5
6
  import styles from './FormLayout.scss';
6
7
 
@@ -48,12 +49,12 @@ export const FormLayout = (props) => {
48
49
  return (
49
50
  <div
50
51
  id={id}
51
- className={[
52
+ className={classNames(
52
53
  styles.root,
53
54
  fieldLayoutClass(fieldLayout),
54
- autoWidth ? styles.isRootAutoWidth : '',
55
- fieldLayout === 'horizontal' ? labelWidthClass(labelWidth) : '',
56
- ].join(' ')}
55
+ autoWidth && styles.isRootAutoWidth,
56
+ fieldLayout === 'horizontal' && labelWidthClass(labelWidth),
57
+ )}
57
58
  {...hasCustomLabelWidth ? { style: { '--rui-custom-label-width': labelWidth } } : {}}
58
59
  >
59
60
  <FormLayoutContext.Provider
@@ -13,46 +13,46 @@
13
13
  // (a global default which can be customised per use).
14
14
  // https://github.com/react-ui-org/react-ui/issues/232
15
15
 
16
- @use '../../styles/settings/forms';
17
- @use '../../styles/tools/breakpoint';
18
- @use '../../styles/tools/spacing';
19
- @use 'theme';
16
+ @use "../../styles/settings/forms";
17
+ @use "../../styles/tools/breakpoint";
18
+ @use "../../styles/tools/spacing";
19
+ @use "theme";
20
20
 
21
21
  .root {
22
- --rui-local-field-width: 1fr;
22
+ --rui-local-field-width: 1fr;
23
23
 
24
- @include spacing.bottom(layouts);
24
+ @include spacing.bottom(layouts);
25
25
  }
26
26
 
27
27
  .rootFieldLayoutVertical,
28
28
  .rootFieldLayoutHorizontal {
29
- display: grid;
30
- grid-template-columns: var(--rui-local-field-width);
31
- grid-row-gap: theme.$row-gap;
29
+ display: grid;
30
+ grid-template-columns: var(--rui-local-field-width);
31
+ grid-row-gap: theme.$row-gap;
32
32
  }
33
33
 
34
34
  .rootFieldLayoutHorizontal {
35
- @include breakpoint.up(forms.$horizontal-breakpoint) {
36
- grid-template-columns: var(--rui-local-label-width) var(--rui-local-field-width); // 1.
37
- }
35
+ @include breakpoint.up(forms.$horizontal-breakpoint) {
36
+ grid-template-columns: var(--rui-local-label-width) var(--rui-local-field-width); // 1.
37
+ }
38
38
  }
39
39
 
40
40
  .hasRootLabelWidthDefault {
41
- --rui-local-label-width: #{theme.$horizontal-label-width}; // 1., 2.
41
+ --rui-local-label-width: #{theme.$horizontal-label-width}; // 1., 2.
42
42
  }
43
43
 
44
44
  .hasRootLabelWidthAuto {
45
- --rui-local-label-width: #{theme.$horizontal-label-width-auto}; // 4.
45
+ --rui-local-label-width: #{theme.$horizontal-label-width-auto}; // 4.
46
46
  }
47
47
 
48
48
  .hasRootLabelWidthLimited {
49
- --rui-local-label-width: #{theme.$horizontal-label-width-limited}; // 4.
49
+ --rui-local-label-width: #{theme.$horizontal-label-width-limited}; // 4.
50
50
  }
51
51
 
52
52
  .hasRootLabelWidthCustom {
53
- --rui-local-label-width: var(--rui-custom-label-width); // 3.
53
+ --rui-local-label-width: var(--rui-custom-label-width); // 3.
54
54
  }
55
55
 
56
56
  .isRootAutoWidth {
57
- --rui-local-field-width: min-content;
57
+ --rui-local-field-width: min-content;
58
58
  }
@@ -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
3
  import { withProviderContext } from '../../provider';
6
- import styles from './FormLayoutCustomField.scss';
4
+ import { classNames } from '../../utils/classNames';
5
+ import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
6
+ import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
7
7
  import { FormLayoutContext } from './FormLayoutContext';
8
+ import styles from './FormLayoutCustomField.scss';
8
9
 
9
10
  const renderLabel = (id, label, labelForId) => {
10
11
  if (labelForId && label) {
@@ -49,15 +50,15 @@ export const FormLayoutCustomField = ({
49
50
  return (
50
51
  <div
51
52
  id={id}
52
- className={[
53
+ className={classNames(
53
54
  styles.root,
54
- fullWidth ? styles.isRootFullWidth : '',
55
+ fullWidth && styles.isRootFullWidth,
55
56
  context && context.layout === 'horizontal' ? styles.rootLayoutHorizontal : styles.rootLayoutVertical,
56
- disabled ? styles.isRootDisabled : '',
57
- required ? styles.isRootRequired : '',
57
+ disabled && styles.isRootDisabled,
58
+ required && styles.isRootRequired,
58
59
  getRootSizeClassName(innerFieldSize, styles),
59
60
  getRootValidationStateClassName(validationState, styles),
60
- ].join(' ')}
61
+ )}
61
62
  >
62
63
  {renderLabel(id, label, labelForId)}
63
64
  <div
@@ -1,63 +1,63 @@
1
- @use '../../styles/tools/form-fields/foundation';
2
- @use '../../styles/tools/form-fields/box-field-layout';
3
- @use '../../styles/tools/form-fields/box-field-sizes';
4
- @use '../../styles/tools/form-fields/variants';
1
+ @use "../../styles/tools/form-fields/foundation";
2
+ @use "../../styles/tools/form-fields/box-field-layout";
3
+ @use "../../styles/tools/form-fields/box-field-sizes";
4
+ @use "../../styles/tools/form-fields/variants";
5
5
 
6
6
  // Foundation
7
7
  .root {
8
- @include box-field-layout.in-form-layout();
9
- @include variants.visual(custom);
8
+ @include box-field-layout.in-form-layout();
9
+ @include variants.visual(custom);
10
10
  }
11
11
 
12
12
  .label {
13
- @include foundation.label();
13
+ @include foundation.label();
14
14
  }
15
15
 
16
16
  .isRootRequired .label {
17
- @include foundation.label-required();
17
+ @include foundation.label-required();
18
18
  }
19
19
 
20
20
  // States
21
21
  .isRootStateInvalid {
22
- @include variants.validation(invalid);
22
+ @include variants.validation(invalid);
23
23
  }
24
24
 
25
25
  .isRootStateValid {
26
- @include variants.validation(valid);
26
+ @include variants.validation(valid);
27
27
  }
28
28
 
29
29
  .isRootStateWarning {
30
- @include variants.validation(warning);
30
+ @include variants.validation(warning);
31
31
  }
32
32
 
33
33
  // Layouts
34
34
  .rootLayoutVertical,
35
35
  .rootLayoutHorizontal {
36
- @include box-field-layout.vertical();
36
+ @include box-field-layout.vertical();
37
37
  }
38
38
 
39
39
  .rootLayoutHorizontal {
40
- @include box-field-layout.horizontal();
40
+ @include box-field-layout.horizontal();
41
41
  }
42
42
 
43
43
  .rootLayoutVertical .field,
44
44
  .rootLayoutHorizontal .field {
45
- width: auto;
45
+ width: auto;
46
46
  }
47
47
 
48
48
  .isRootFullWidth .field {
49
- justify-self: stretch;
49
+ justify-self: stretch;
50
50
  }
51
51
 
52
52
  // Sizes
53
53
  .rootSizeSmall {
54
- @include box-field-sizes.size(small);
54
+ @include box-field-sizes.size(small);
55
55
  }
56
56
 
57
57
  .rootSizeMedium {
58
- @include box-field-sizes.size(medium);
58
+ @include box-field-sizes.size(medium);
59
59
  }
60
60
 
61
61
  .rootSizeLarge {
62
- @include box-field-sizes.size(large);
62
+ @include box-field-sizes.size(large);
63
63
  }
@@ -22,7 +22,6 @@ import { SelectField } from '../SelectField/SelectField'
22
22
  import { TextArea } from '../TextArea/TextArea'
23
23
  import { TextField } from '../TextField/TextField'
24
24
  import { Toggle } from '../Toggle/Toggle'
25
- import { Center } from '../Center/Center'
26
25
  import { Toolbar } from '../Toolbar/Toolbar'
27
26
  import { ToolbarItem } from '../Toolbar/ToolbarItem'
28
27
  import { FormLayout } from './FormLayout'
@@ -51,13 +50,11 @@ See [API](#api) for all available options.
51
50
  Since all form fields in React UI are styled as inline blocks, they **queue up
52
51
  one after another in a row by default.** The FormLayout component is there to
53
52
  make building **vertical and horizontal forms** easy. It uses the right tool for
54
- the job: the
55
- [CSS grid layout](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout).
53
+ the job: the [CSS grid layout][grid].
56
54
 
57
55
  - Put **only form field components** from React UI inside the FormLayout and
58
- make sure they are **direct descendants** of it (React
59
- [fragments](https://reactjs.org/docs/fragments.html)
60
- are supported!). All React UI form components are ready for this use case and
56
+ make sure they are **direct descendants** of it (React [fragments] are
57
+ supported!). All React UI form components are ready for this use case and
61
58
  don't need to be wrapped in any `div`s. Namely, the FormLayout supports the
62
59
  following React UI components:
63
60
  [CheckboxField](/components/checkbox-field),
@@ -73,10 +70,8 @@ the job: the
73
70
 
74
71
  👉 For usage in auto-width Modal, you may need to turn on the `autoWidth` option
75
72
  for your FormLayout. This prevents FormLayout from unexpectedly growing in
76
- browsers that
77
- [don't support](https://github.com/react-ui-org/react-ui/issues/232)
78
- [CSS subgrid](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout/Subgrid)
79
- in cases when there are longer validation messages or help texts.
73
+ browsers that [don't support][rui-232] [CSS subgrid][subgrid] in cases when
74
+ there are longer validation messages or help texts.
80
75
 
81
76
  ## Vertical Layout
82
77
 
@@ -217,29 +212,9 @@ work together yet 🎩.
217
212
  CheckboxField and Toggle always display their labels after inputs inside
218
213
  FormLayout. In other words, their labels never appear in a column with other
219
214
  fields' labels even when they have `labelPosition` set to `before`. This feature
220
- [will be implemented](https://github.com/react-ui-org/react-ui/issues/232)
221
- once
222
- [CSS subgrid](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout/Subgrid)
223
- is fully supported in
215
+ [will be implemented][rui-232] once [CSS subgrid][subgrid] is fully supported in
224
216
  [browsers that we support](/getting-started/browsers-and-devices).
225
217
 
226
- ## Alignment
227
-
228
- To align whole FormLayout to center of a container, simply wrap it with the
229
- [Center](/components/center) layout.
230
-
231
- <Playground>
232
- <Placeholder bordered height="24rem">
233
- <Center>
234
- <FormLayout autoWidth>
235
- <TextField label="A form element" />
236
- <TextField label="Another form element" />
237
- <TextField label="Yet another one" />
238
- </FormLayout>
239
- </Center>
240
- </Placeholder>
241
- </Playground>
242
-
243
218
  ## Custom Fields
244
219
 
245
220
  You can even place any content you need into the FormLayout — just wrap it with
@@ -267,11 +242,10 @@ as API options as such are **not** inherited.
267
242
 
268
243
  If you are in a situation with one or more box form fields inside your
269
244
  FormLayoutCustomField, you may want to have its label aligned with the fields
270
- inside. Since it's
271
- [not quite possible to do this automatically](https://github.com/react-ui-org/react-ui/issues/265)
272
- due to limited browser support, there is `innerFieldSize` option which accepts
273
- any of existing box field sizes (small, medium, or large) and is intended right
274
- for this task.
245
+ inside. Since it's [not quite possible to do this automatically][rui-265] due to
246
+ limited browser support, there is `innerFieldSize` option which accepts any of
247
+ existing box field sizes (small, medium, or large) and is intended right for
248
+ this task.
275
249
 
276
250
  <Playground>
277
251
  <FormLayout fieldLayout="horizontal" labelWidth="auto">
@@ -493,3 +467,9 @@ FormLayoutCustomField can be styled using a small subset of
493
467
  |------------------------------------------------------|--------------------------------------------------------------|
494
468
  | `--rui-FormField--custom--default__surrounding-text-color` | Custom field label color in default state |
495
469
  | `--rui-FormField--custom--disabled__surrounding-text-color` | Custom field label color in disabled-like state |
470
+
471
+ [grid]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout
472
+ [subgrid]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout/Subgrid
473
+ [fragments]: https://reactjs.org/docs/fragments.html
474
+ [rui-232]: https://github.com/react-ui-org/react-ui/issues/232
475
+ [rui-265]: https://github.com/react-ui-org/react-ui/issues/265
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import { withProviderContext } from '../../provider';
4
- import { generateResponsiveCustomProperties } from './helpers/generateResponsiveCustomProperties';
4
+ import { generateResponsiveCustomProperties } from './_helpers/generateResponsiveCustomProperties';
5
5
  import styles from './Grid.scss';
6
6
 
7
7
  export const Grid = ({
@@ -6,7 +6,7 @@
6
6
  //
7
7
  // Fallback for `xs` breakpoint: `<INITIAL FALLBACK>`
8
8
  // Fallback for `sm` breakpoint: `var(--rui-local-<PROPERTY>-xs, <INITIAL FALLBACK>)`
9
- // Fallback for `md` breakpoint: `var(--rui-local-<PROPERTY>-sm, var(--rui-local-<PROPERTY>-xs, <INITIAL FALLBACK>))`
9
+ // Fallback for `md` breakpoint: `var(--rui-local-<PROPERTY>-sm, var(--rui-local-<PROPERTY>-xs, <INIT. FALLBACK>))`
10
10
  //
11
11
  // … etc, up to the largest breakpoint.
12
12
  //
@@ -20,45 +20,43 @@
20
20
  //
21
21
  // 2. Apply custom property value that is defined within current breakpoint, see 1.
22
22
 
23
- @use 'sass:map';
24
- @use '../../styles/tools/spacing';
25
- @use 'theme';
26
- @use 'tools';
23
+ @use "sass:map";
24
+ @use "../../styles/tools/spacing";
25
+ @use "theme";
26
+ @use "tools";
27
27
 
28
28
  .root {
29
- @include tools.assign-responsive-custom-properties(theme.$responsive-properties); // 1.
30
- @include spacing.bottom(layouts);
31
-
32
- display: grid;
33
- grid-template-columns: var(--rui-local-columns); // 2.
34
- grid-template-rows: var(--rui-local-rows); // 2.
35
- grid-auto-flow: var(--rui-local-auto-flow, #{map.get(theme.$responsive-properties, auto-flow)}); // 2.
36
- grid-gap: var(--rui-local-row-gap) var(--rui-local-column-gap); // 2.
37
- align-content: var(--rui-local-align-content, #{map.get(theme.$responsive-properties, align-content)}); // 2.
38
- align-items: var(--rui-local-align-items, #{map.get(theme.$responsive-properties, align-items)}); // 2.
39
- justify-content: var(--rui-local-justify-content, #{map.get(theme.$responsive-properties, justify-content)}); // 2.
40
- justify-items: var(--rui-local-justify-items, #{map.get(theme.$responsive-properties, justify-items)}); // 2.
29
+ @include tools.assign-responsive-custom-properties(theme.$responsive-properties); // 1.
30
+ @include spacing.bottom(layouts);
31
+
32
+ display: grid;
33
+ grid-template-columns: var(--rui-local-columns); // 2.
34
+ grid-template-rows: var(--rui-local-rows); // 2.
35
+ grid-auto-flow: var(--rui-local-auto-flow, #{map.get(theme.$responsive-properties, auto-flow)}); // 2.
36
+ grid-gap: var(--rui-local-row-gap) var(--rui-local-column-gap); // 2.
37
+ align-content: var(--rui-local-align-content, #{map.get(theme.$responsive-properties, align-content)}); // 2.
38
+ align-items: var(--rui-local-align-items, #{map.get(theme.$responsive-properties, align-items)}); // 2.
39
+ justify-content: var(--rui-local-justify-content, #{map.get(theme.$responsive-properties, justify-content)}); // 2.
40
+ justify-items: var(--rui-local-justify-items, #{map.get(theme.$responsive-properties, justify-items)}); // 2.
41
41
  }
42
42
 
43
43
  .span {
44
- $responsive-properties: (
45
- column-span: 1,
46
- row-span: 1,
47
- );
44
+ $responsive-properties: (
45
+ column-span: 1,
46
+ row-span: 1,
47
+ );
48
48
 
49
- @include tools.assign-responsive-custom-properties($responsive-properties); // 1.
49
+ @include tools.assign-responsive-custom-properties($responsive-properties); // 1.
50
50
 
51
- grid-column: span var(--rui-local-column-span, 1); // 2.
52
- grid-row: span var(--rui-local-row-span, 1); // 2.
51
+ grid-column: span var(--rui-local-column-span, 1); // 2.
52
+ grid-row: span var(--rui-local-row-span, 1); // 2.
53
53
  }
54
54
 
55
- /* stylelint-disable selector-no-qualifying-type */
56
-
55
+ // stylelint-disable selector-no-qualifying-type
57
56
  dl.root,
58
57
  ol.root,
59
58
  ul.root {
60
- padding-left: 0;
61
- margin-left: 0;
59
+ padding-left: 0;
60
+ margin-left: 0;
62
61
  }
63
-
64
- /* stylelint-enable selector-no-qualifying-type */
62
+ // stylelint-enable selector-no-qualifying-type
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import { withProviderContext } from '../../provider';
4
- import { generateResponsiveCustomProperties } from './helpers/generateResponsiveCustomProperties';
4
+ import { generateResponsiveCustomProperties } from './_helpers/generateResponsiveCustomProperties';
5
5
  import styles from './Grid.scss';
6
6
 
7
7
  export const GridSpan = ({
@@ -12,5 +12,3 @@ export const generateResponsiveCustomProperties = (prop, infix) => {
12
12
  [`--rui-local-${infix}-${breakpoint}`]: prop[breakpoint],
13
13
  }), {});
14
14
  };
15
-
16
- export default generateResponsiveCustomProperties;
@@ -1,11 +1,11 @@
1
1
  $responsive-properties: (
2
- columns: var(--rui-Grid__columns),
3
- column-gap: var(--rui-Grid__column-gap),
4
- rows: var(--rui-Grid__rows),
5
- row-gap: var(--rui-Grid__row-gap),
6
- auto-flow: var(--rui-Grid__auto-flow),
7
- align-content: var(--rui-Grid__align-content),
8
- align-items: var(--rui-Grid__align-items),
9
- justify-content: var(--rui-Grid__justify-content),
10
- justify-items: var(--rui-Grid__justify-items),
2
+ columns: var(--rui-Grid__columns),
3
+ column-gap: var(--rui-Grid__column-gap),
4
+ rows: var(--rui-Grid__rows),
5
+ row-gap: var(--rui-Grid__row-gap),
6
+ auto-flow: var(--rui-Grid__auto-flow),
7
+ align-content: var(--rui-Grid__align-content),
8
+ align-items: var(--rui-Grid__align-items),
9
+ justify-content: var(--rui-Grid__justify-content),
10
+ justify-items: var(--rui-Grid__justify-items),
11
11
  );
@@ -1,6 +1,6 @@
1
- @use 'sass:map';
2
- @use '../../styles/settings/breakpoints';
3
- @use '../../styles/tools/breakpoint';
1
+ @use "sass:map";
2
+ @use "../../styles/settings/breakpoints";
3
+ @use "../../styles/tools/breakpoint";
4
4
 
5
5
  // Generate fallback cascade using `var()` function fallbacks.
6
6
  //
@@ -8,15 +8,15 @@
8
8
  // $initial-fallback: <string> Initial fallback value
9
9
  // $current-breakpoint: <one of $breakpoint-values> Generate cascade for breakpoints smaller than this one
10
10
  @function _generate-custom-property-fallback-cascade($property-name, $initial-fallback, $current-breakpoint) {
11
- $fallback-cascade: $initial-fallback;
11
+ $fallback-cascade: $initial-fallback;
12
12
 
13
- @each $breakpoint in map.keys(breakpoints.$values) {
14
- @if $breakpoint == $current-breakpoint {
15
- @return $fallback-cascade;
16
- }
13
+ @each $breakpoint in map.keys(breakpoints.$values) {
14
+ @if $breakpoint == $current-breakpoint {
15
+ @return $fallback-cascade;
16
+ }
17
17
 
18
- $fallback-cascade: var(--rui-local-#{$property-name}-#{$breakpoint}, $fallback-cascade);
19
- }
18
+ $fallback-cascade: var(--rui-local-#{$property-name}-#{$breakpoint}, $fallback-cascade);
19
+ }
20
20
  }
21
21
 
22
22
  // Read custom properties within a given breakpoint and assign them to expected output custom
@@ -24,15 +24,15 @@
24
24
  //
25
25
  // $properties: <map of <<property name>: <initial fallback value>> pairs>
26
26
  @mixin assign-responsive-custom-properties($properties) {
27
- @each $breakpoint in map.keys(breakpoints.$values) {
28
- @include breakpoint.up($breakpoint) {
29
- @each $property-name, $initial-fallback in $properties {
30
- --rui-local-#{$property-name}:
31
- var(
32
- --rui-local-#{$property-name}-#{$breakpoint},
33
- #{_generate-custom-property-fallback-cascade($property-name, $initial-fallback, $breakpoint)}
34
- );
35
- }
27
+ @each $breakpoint in map.keys(breakpoints.$values) {
28
+ @include breakpoint.up($breakpoint) {
29
+ @each $property-name, $initial-fallback in $properties {
30
+ --rui-local-#{$property-name}:
31
+ var(
32
+ --rui-local-#{$property-name}-#{$breakpoint},
33
+ #{_generate-custom-property-fallback-cascade($property-name, $initial-fallback, $breakpoint)}
34
+ );
35
+ }
36
+ }
36
37
  }
37
- }
38
38
  }
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import transferProps from '../../utils/transferProps';
4
3
  import { withProviderContext } from '../../provider';
4
+ import { transferProps } from '../_helpers/transferProps';
5
5
  import styles from './Link.scss';
6
6
 
7
7
  export const Link = ({