@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.
- package/dist/lib.development.js +138 -258
- package/dist/lib.js +1 -1
- package/package.json +7 -10
- package/src/lib/components/Alert/Alert.jsx +4 -3
- package/src/lib/components/Alert/Alert.scss +48 -48
- package/src/lib/components/Alert/_settings.scss +4 -4
- package/src/lib/components/Alert/_theme.scss +50 -50
- package/src/lib/components/Alert/_tools.scss +6 -6
- package/src/lib/components/Badge/Badge.jsx +5 -4
- package/src/lib/components/Badge/Badge.scss +57 -57
- package/src/lib/components/Button/Button.jsx +10 -9
- package/src/lib/components/Button/Button.scss +2 -2
- package/src/lib/components/Button/README.mdx +6 -1
- package/src/lib/components/Button/_base.scss +65 -65
- package/src/lib/components/Button/_priorities.scss +49 -49
- package/src/lib/components/Button/_settings.scss +10 -10
- package/src/lib/components/Button/_theme.scss +18 -15
- package/src/lib/components/Button/_tools.scss +98 -100
- package/src/lib/components/ButtonGroup/ButtonGroup.jsx +4 -3
- package/src/lib/components/ButtonGroup/ButtonGroup.scss +3 -3
- package/src/lib/components/Card/Card.jsx +7 -6
- package/src/lib/components/Card/Card.scss +28 -28
- package/src/lib/components/Card/_theme.scss +50 -50
- package/src/lib/components/Card/_tools.scss +6 -6
- package/src/lib/components/CheckboxField/CheckboxField.jsx +12 -11
- package/src/lib/components/CheckboxField/CheckboxField.scss +20 -20
- package/src/lib/components/FileInputField/FileInputField.jsx +13 -12
- package/src/lib/components/FileInputField/FileInputField.scss +19 -19
- package/src/lib/components/FormLayout/FormLayout.jsx +5 -4
- package/src/lib/components/FormLayout/FormLayout.scss +17 -17
- package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +9 -8
- package/src/lib/components/FormLayout/FormLayoutCustomField.scss +18 -18
- package/src/lib/components/FormLayout/README.mdx +16 -36
- package/src/lib/components/Grid/Grid.jsx +1 -1
- package/src/lib/components/Grid/Grid.scss +28 -30
- package/src/lib/components/Grid/GridSpan.jsx +1 -1
- package/src/lib/components/Grid/{helpers → _helpers}/generateResponsiveCustomProperties.js +0 -2
- package/src/lib/components/Grid/_theme.scss +9 -9
- package/src/lib/components/Grid/_tools.scss +20 -20
- package/src/lib/components/Link/Link.jsx +1 -1
- package/src/lib/components/Link/Link.scss +7 -7
- package/src/lib/components/List/List.jsx +11 -10
- package/src/lib/components/List/List.scss +21 -21
- package/src/lib/components/Media/Media.scss +6 -6
- package/src/lib/components/Modal/Modal.jsx +6 -5
- package/src/lib/components/Modal/Modal.scss +73 -73
- package/src/lib/components/Modal/_settings.scss +5 -5
- package/src/lib/components/Modal/_theme.scss +17 -17
- package/src/lib/components/Paper/Paper.jsx +5 -4
- package/src/lib/components/Paper/Paper.scss +8 -8
- package/src/lib/components/Radio/Radio.jsx +12 -11
- package/src/lib/components/Radio/Radio.scss +26 -26
- package/src/lib/components/ScrollView/ScrollView.jsx +9 -8
- package/src/lib/components/ScrollView/ScrollView.scss +113 -113
- package/src/lib/{services/elementPositionService.js → components/ScrollView/_helpers/getElementsPositionDifference.js} +0 -2
- package/src/lib/{hooks → components/ScrollView/_hooks}/useLoadResizeHook.js +1 -1
- package/src/lib/{hooks → components/ScrollView/_hooks}/useScrollPositionHook.js +1 -1
- package/src/lib/components/SelectField/SelectField.jsx +14 -13
- package/src/lib/components/SelectField/SelectField.scss +30 -30
- package/src/lib/components/Table/Table.scss +28 -35
- package/src/lib/components/Table/_settings.scss +5 -5
- package/src/lib/components/Tabs/Tabs.scss +21 -21
- package/src/lib/components/Tabs/TabsItem.jsx +4 -3
- package/src/lib/components/Tabs/TabsItem.scss +78 -78
- package/src/lib/components/Text/Text.jsx +5 -4
- package/src/lib/components/Text/Text.scss +12 -12
- package/src/lib/components/Text/{helpers → _helpers}/getRootHyphensClassName.js +1 -1
- package/src/lib/components/Text/{helpers → _helpers}/getRootWordWrappingClassName.js +1 -1
- package/src/lib/components/TextArea/TextArea.jsx +14 -13
- package/src/lib/components/TextArea/TextArea.scss +27 -27
- package/src/lib/components/TextField/TextField.jsx +16 -15
- package/src/lib/components/TextField/TextField.scss +28 -28
- package/src/lib/components/Toggle/Toggle.jsx +12 -11
- package/src/lib/components/Toggle/Toggle.scss +20 -20
- package/src/lib/components/Toolbar/Toolbar.jsx +5 -4
- package/src/lib/components/Toolbar/Toolbar.scss +25 -25
- package/src/lib/components/Toolbar/ToolbarGroup.jsx +5 -4
- package/src/lib/{helpers → components/_helpers}/getRootColorClassName.js +1 -1
- package/src/lib/{helpers → components/_helpers}/getRootSizeClassName.js +1 -1
- package/src/lib/{helpers → components/_helpers}/getRootValidationStateClassName.js +1 -1
- package/src/lib/{helpers → components/_helpers}/resolveContextOrProp.js +0 -0
- package/src/lib/{utils → components/_helpers}/transferProps.js +1 -1
- package/src/lib/foundation.scss +11 -11
- package/src/lib/helpers.scss +2 -2
- package/src/lib/index.js +3 -7
- package/src/lib/styles/_utilities.scss +13 -13
- package/src/lib/styles/elements/_code.scss +7 -7
- package/src/lib/styles/elements/_links.scss +8 -8
- package/src/lib/styles/elements/_lists.scss +3 -3
- package/src/lib/styles/elements/_page.scss +14 -14
- package/src/lib/styles/elements/_rulers.scss +6 -6
- package/src/lib/styles/elements/_small.scss +2 -2
- package/src/lib/styles/generic/_box-sizing.scss +3 -2
- package/src/lib/styles/generic/_forms.scss +3 -3
- package/src/lib/styles/generic/_reset.scss +6 -6
- package/src/lib/styles/generic/_shared.scss +3 -3
- package/src/lib/styles/helpers/_animation.scss +8 -8
- package/src/lib/styles/settings/_breakpoints.scss +7 -7
- package/src/lib/styles/settings/_escaped-characters.scss +5 -5
- package/src/lib/styles/settings/_form-fields.scss +24 -24
- package/src/lib/styles/settings/_utilities.scss +112 -100
- package/src/lib/styles/theme/_colors.scss +50 -50
- package/src/lib/styles/theme/_form-fields.scss +32 -32
- package/src/lib/styles/theme/_spacing.scss +11 -11
- package/src/lib/styles/theme/_typography.scss +12 -11
- package/src/lib/styles/theme-constants/_breakpoints.scss +2 -2
- package/src/lib/styles/theme-constants/_colors.scss +2 -2
- package/src/lib/styles/theme-constants/_svg.scss +1 -2
- package/src/lib/styles/tools/_accessibility.scss +29 -29
- package/src/lib/styles/tools/_breakpoint.scss +11 -14
- package/src/lib/styles/tools/_caret.scss +8 -8
- package/src/lib/styles/tools/_colors.scss +3 -3
- package/src/lib/styles/tools/_reset.scss +21 -21
- package/src/lib/styles/tools/_scrollbar.scss +4 -4
- package/src/lib/styles/tools/_spacing.scss +17 -21
- package/src/lib/styles/tools/_string.scss +9 -9
- package/src/lib/styles/tools/_svg.scss +13 -16
- package/src/lib/styles/tools/_transition.scss +42 -44
- package/src/lib/styles/tools/_utilities.scss +19 -19
- package/src/lib/styles/tools/form-fields/_box-field-elements.scss +88 -88
- package/src/lib/styles/tools/form-fields/_box-field-layout.scss +144 -144
- package/src/lib/styles/tools/form-fields/_box-field-sizes.scss +13 -15
- package/src/lib/styles/tools/form-fields/_foundation.scss +12 -12
- package/src/lib/styles/tools/form-fields/_inline-field-elements.scss +71 -71
- package/src/lib/styles/tools/form-fields/_inline-field-layout.scss +44 -44
- package/src/lib/styles/tools/form-fields/_variants.scss +104 -106
- package/src/lib/theme.scss +958 -954
- package/src/lib/utils/classNames.js +8 -0
- package/src/lib/components/CTA/CTA.jsx +0 -60
- package/src/lib/components/CTA/CTA.scss +0 -71
- package/src/lib/components/CTA/CTACenter.jsx +0 -27
- package/src/lib/components/CTA/CTAEnd.jsx +0 -27
- package/src/lib/components/CTA/CTAStart.jsx +0 -27
- package/src/lib/components/CTA/README.mdx +0 -119
- package/src/lib/components/CTA/index.js +0 -4
- package/src/lib/components/Center/Center.jsx +0 -27
- package/src/lib/components/Center/Center.scss +0 -7
- package/src/lib/components/Center/README.mdx +0 -52
- 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
|
|
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
|
|
32
|
-
context
|
|
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
|
|
37
|
-
required
|
|
37
|
+
disabled && styles.isRootDisabled,
|
|
38
|
+
required && styles.isRootRequired,
|
|
38
39
|
getRootValidationStateClassName(validationState, styles),
|
|
39
|
-
|
|
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
|
|
47
|
-
|
|
47
|
+
!isLabelVisible && styles.isLabelHidden,
|
|
48
|
+
)}
|
|
48
49
|
id={id && `${id}__labelText`}
|
|
49
50
|
>
|
|
50
51
|
{label}
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
@use
|
|
2
|
-
@use
|
|
3
|
-
@use
|
|
4
|
-
@use
|
|
5
|
-
@use
|
|
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
|
-
|
|
9
|
+
@include foundation.root();
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.label {
|
|
13
|
-
|
|
13
|
+
@include foundation.label();
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.inputContainer {
|
|
17
|
-
|
|
17
|
+
@include box-field-elements.input-container();
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.input {
|
|
21
|
-
|
|
21
|
+
@include accessibility.focus-ring();
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.helpText,
|
|
25
25
|
.validationText {
|
|
26
|
-
|
|
26
|
+
@include foundation.help-text();
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.isRootRequired .label {
|
|
30
|
-
|
|
30
|
+
@include foundation.label-required();
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// States
|
|
34
34
|
.isRootStateInvalid {
|
|
35
|
-
|
|
35
|
+
@include variants.validation(invalid);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.isRootStateValid {
|
|
39
|
-
|
|
39
|
+
@include variants.validation(valid);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.isRootStateWarning {
|
|
43
|
-
|
|
43
|
+
@include variants.validation(warning);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// Invisible label
|
|
47
47
|
.isLabelHidden {
|
|
48
|
-
|
|
48
|
+
@include accessibility.hide-text();
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// Layouts
|
|
52
52
|
.rootLayoutVertical,
|
|
53
53
|
.rootLayoutHorizontal {
|
|
54
|
-
|
|
54
|
+
@include box-field-layout.vertical();
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
.rootLayoutHorizontal {
|
|
58
|
-
|
|
58
|
+
@include box-field-layout.horizontal();
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
.isRootFullWidth {
|
|
62
|
-
|
|
62
|
+
@include box-field-layout.full-width();
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
.isRootInFormLayout {
|
|
66
|
-
|
|
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
|
|
55
|
-
fieldLayout === 'horizontal'
|
|
56
|
-
|
|
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
|
|
17
|
-
@use
|
|
18
|
-
@use
|
|
19
|
-
@use
|
|
16
|
+
@use "../../styles/settings/forms";
|
|
17
|
+
@use "../../styles/tools/breakpoint";
|
|
18
|
+
@use "../../styles/tools/spacing";
|
|
19
|
+
@use "theme";
|
|
20
20
|
|
|
21
21
|
.root {
|
|
22
|
-
|
|
22
|
+
--rui-local-field-width: 1fr;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
@include spacing.bottom(layouts);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.rootFieldLayoutVertical,
|
|
28
28
|
.rootFieldLayoutHorizontal {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
36
|
-
|
|
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
|
-
|
|
41
|
+
--rui-local-label-width: #{theme.$horizontal-label-width}; // 1., 2.
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.hasRootLabelWidthAuto {
|
|
45
|
-
|
|
45
|
+
--rui-local-label-width: #{theme.$horizontal-label-width-auto}; // 4.
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
.hasRootLabelWidthLimited {
|
|
49
|
-
|
|
49
|
+
--rui-local-label-width: #{theme.$horizontal-label-width-limited}; // 4.
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
.hasRootLabelWidthCustom {
|
|
53
|
-
|
|
53
|
+
--rui-local-label-width: var(--rui-custom-label-width); // 3.
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
.isRootAutoWidth {
|
|
57
|
-
|
|
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
|
|
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
|
|
55
|
+
fullWidth && styles.isRootFullWidth,
|
|
55
56
|
context && context.layout === 'horizontal' ? styles.rootLayoutHorizontal : styles.rootLayoutVertical,
|
|
56
|
-
disabled
|
|
57
|
-
required
|
|
57
|
+
disabled && styles.isRootDisabled,
|
|
58
|
+
required && styles.isRootRequired,
|
|
58
59
|
getRootSizeClassName(innerFieldSize, styles),
|
|
59
60
|
getRootValidationStateClassName(validationState, styles),
|
|
60
|
-
|
|
61
|
+
)}
|
|
61
62
|
>
|
|
62
63
|
{renderLabel(id, label, labelForId)}
|
|
63
64
|
<div
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
@use
|
|
2
|
-
@use
|
|
3
|
-
@use
|
|
4
|
-
@use
|
|
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
|
-
|
|
9
|
-
|
|
8
|
+
@include box-field-layout.in-form-layout();
|
|
9
|
+
@include variants.visual(custom);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.label {
|
|
13
|
-
|
|
13
|
+
@include foundation.label();
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.isRootRequired .label {
|
|
17
|
-
|
|
17
|
+
@include foundation.label-required();
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
// States
|
|
21
21
|
.isRootStateInvalid {
|
|
22
|
-
|
|
22
|
+
@include variants.validation(invalid);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.isRootStateValid {
|
|
26
|
-
|
|
26
|
+
@include variants.validation(valid);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.isRootStateWarning {
|
|
30
|
-
|
|
30
|
+
@include variants.validation(warning);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// Layouts
|
|
34
34
|
.rootLayoutVertical,
|
|
35
35
|
.rootLayoutHorizontal {
|
|
36
|
-
|
|
36
|
+
@include box-field-layout.vertical();
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
.rootLayoutHorizontal {
|
|
40
|
-
|
|
40
|
+
@include box-field-layout.horizontal();
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.rootLayoutVertical .field,
|
|
44
44
|
.rootLayoutHorizontal .field {
|
|
45
|
-
|
|
45
|
+
width: auto;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
.isRootFullWidth .field {
|
|
49
|
-
|
|
49
|
+
justify-self: stretch;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// Sizes
|
|
53
53
|
.rootSizeSmall {
|
|
54
|
-
|
|
54
|
+
@include box-field-sizes.size(small);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
.rootSizeMedium {
|
|
58
|
-
|
|
58
|
+
@include box-field-sizes.size(medium);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
.rootSizeLarge {
|
|
62
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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]
|
|
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
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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 './
|
|
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, <
|
|
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
|
|
24
|
-
@use
|
|
25
|
-
@use
|
|
26
|
-
@use
|
|
23
|
+
@use "sass:map";
|
|
24
|
+
@use "../../styles/tools/spacing";
|
|
25
|
+
@use "theme";
|
|
26
|
+
@use "tools";
|
|
27
27
|
|
|
28
28
|
.root {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
$responsive-properties: (
|
|
45
|
+
column-span: 1,
|
|
46
|
+
row-span: 1,
|
|
47
|
+
);
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
@include tools.assign-responsive-custom-properties($responsive-properties); // 1.
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
56
|
-
|
|
55
|
+
// stylelint-disable selector-no-qualifying-type
|
|
57
56
|
dl.root,
|
|
58
57
|
ol.root,
|
|
59
58
|
ul.root {
|
|
60
|
-
|
|
61
|
-
|
|
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 './
|
|
4
|
+
import { generateResponsiveCustomProperties } from './_helpers/generateResponsiveCustomProperties';
|
|
5
5
|
import styles from './Grid.scss';
|
|
6
6
|
|
|
7
7
|
export const GridSpan = ({
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
$responsive-properties: (
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
2
|
-
@use
|
|
3
|
-
@use
|
|
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
|
-
|
|
11
|
+
$fallback-cascade: $initial-fallback;
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
@each $breakpoint in map.keys(breakpoints.$values) {
|
|
14
|
+
@if $breakpoint == $current-breakpoint {
|
|
15
|
+
@return $fallback-cascade;
|
|
16
|
+
}
|
|
17
17
|
|
|
18
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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 = ({
|