@react-ui-org/react-ui 0.44.0 → 0.46.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CONTRIBUTING.md +7 -0
- package/dist/lib.development.js +209 -305
- package/dist/lib.js +1 -1
- package/package.json +10 -13
- 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 +6 -8
- 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 +8 -3
- 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 +31 -22
- package/src/lib/components/ButtonGroup/ButtonGroup.scss +3 -3
- package/src/lib/components/ButtonGroup/README.mdx +4 -4
- package/src/lib/components/Card/Card.jsx +7 -6
- package/src/lib/components/Card/Card.scss +28 -28
- package/src/lib/components/Card/CardBody.jsx +5 -11
- package/src/lib/components/Card/CardFooter.jsx +10 -5
- package/src/lib/components/Card/README.mdx +2 -2
- 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 +18 -17
- package/src/lib/components/CheckboxField/CheckboxField.scss +20 -20
- package/src/lib/components/CheckboxField/README.mdx +3 -3
- package/src/lib/components/FileInputField/FileInputField.jsx +13 -12
- package/src/lib/components/FileInputField/FileInputField.scss +19 -19
- package/src/lib/components/FileInputField/README.mdx +1 -1
- package/src/lib/components/FormLayout/FormLayout.jsx +16 -14
- package/src/lib/components/FormLayout/FormLayout.scss +17 -17
- package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +15 -9
- package/src/lib/components/FormLayout/FormLayoutCustomField.scss +18 -18
- package/src/lib/components/FormLayout/README.mdx +27 -49
- package/src/lib/components/Grid/Grid.jsx +4 -3
- package/src/lib/components/Grid/Grid.scss +32 -23
- package/src/lib/components/Grid/GridSpan.jsx +4 -3
- 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/List/List.jsx +14 -12
- package/src/lib/components/List/List.scss +21 -21
- package/src/lib/components/List/ListItem.jsx +3 -2
- package/src/lib/components/List/README.mdx +1 -1
- package/src/lib/components/Media/Media.jsx +12 -5
- package/src/lib/components/Media/Media.scss +6 -6
- package/src/lib/components/Media/MediaBody.jsx +18 -7
- package/src/lib/components/Media/MediaObject.jsx +18 -7
- package/src/lib/components/Modal/Modal.jsx +8 -6
- package/src/lib/components/Modal/Modal.scss +73 -73
- package/src/lib/components/Modal/README.mdx +2 -2
- 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 +6 -6
- package/src/lib/components/Paper/Paper.scss +8 -8
- package/src/lib/components/Paper/README.mdx +1 -1
- package/src/lib/components/Radio/README.mdx +4 -4
- package/src/lib/components/Radio/Radio.jsx +12 -11
- package/src/lib/components/Radio/Radio.scss +26 -26
- package/src/lib/components/ScrollView/README.mdx +4 -1
- package/src/lib/components/ScrollView/ScrollView.jsx +11 -9
- 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/README.mdx +4 -4
- package/src/lib/components/SelectField/SelectField.jsx +14 -13
- package/src/lib/components/SelectField/SelectField.scss +30 -30
- package/src/lib/components/Table/README.mdx +3 -3
- package/src/lib/components/Table/Table.scss +28 -35
- package/src/lib/components/Table/_settings.scss +5 -5
- package/src/lib/components/Tabs/README.mdx +1 -1
- package/src/lib/components/Tabs/Tabs.jsx +1 -2
- 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/README.mdx +1 -1
- package/src/lib/components/Text/Text.jsx +13 -6
- package/src/lib/components/Text/Text.scss +23 -13
- package/src/lib/components/Text/_helpers/getRootClampClassName.js +11 -0
- 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/README.mdx +1 -1
- package/src/lib/components/TextArea/TextArea.jsx +18 -14
- package/src/lib/components/TextArea/TextArea.scss +27 -27
- package/src/lib/components/TextField/README.mdx +1 -1
- package/src/lib/components/TextField/TextField.jsx +16 -14
- package/src/lib/components/TextField/TextField.scss +28 -28
- package/src/lib/components/TextLink/README.mdx +77 -0
- package/src/lib/components/{Link/Link.jsx → TextLink/TextLink.jsx} +12 -13
- package/src/lib/components/TextLink/TextLink.scss +11 -0
- package/src/lib/components/TextLink/_theme.scss +4 -0
- package/src/lib/components/TextLink/index.js +1 -0
- package/src/lib/components/Toggle/README.mdx +3 -3
- package/src/lib/components/Toggle/Toggle.jsx +18 -17
- package/src/lib/components/Toggle/Toggle.scss +20 -20
- package/src/lib/components/Toolbar/README.mdx +19 -3
- package/src/lib/components/Toolbar/Toolbar.jsx +23 -14
- package/src/lib/components/Toolbar/Toolbar.scss +35 -30
- package/src/lib/components/Toolbar/ToolbarGroup.jsx +18 -13
- package/src/lib/components/Toolbar/ToolbarItem.jsx +26 -7
- 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/components/_helpers/isChildrenEmpty.js +3 -0
- 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 +4 -8
- 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 +24 -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 +147 -147
- 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 +82 -71
- package/src/lib/styles/tools/form-fields/_inline-field-layout.scss +88 -47
- 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
- package/src/lib/components/Link/Link.scss +0 -11
- package/src/lib/components/Link/README.mdx +0 -85
- package/src/lib/components/Link/_theme.scss +0 -4
- package/src/lib/components/Link/index.js +0 -1
@@ -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,19 +50,17 @@ 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
|
-
[CheckboxField](/components/
|
64
|
-
[Radio](/components/
|
65
|
-
[TextArea](/components/
|
66
|
-
and [Toggle](/components/
|
60
|
+
[CheckboxField](/components/checkbox-field),
|
61
|
+
[Radio](/components/radio), [SelectField](/components/select-field),
|
62
|
+
[TextArea](/components/text-area), [TextField](/components/text-field),
|
63
|
+
and [Toggle](/components/toggle).
|
67
64
|
|
68
65
|
- Use the [FormLayoutCustomField](#custom-fields) component when you need to
|
69
66
|
place any **custom content** inside the FormLayout. This layout helper ensures
|
@@ -73,14 +70,12 @@ 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
|
|
83
|
-
Vertical FormLayout works similar to the [List](/components/
|
78
|
+
Vertical FormLayout works similar to the [List](/components/list) layout
|
84
79
|
except that no equivalent of ListItems is needed. It stacks the form fields
|
85
80
|
vertically while it forces the vertical layout mode on them. To use this layout,
|
86
81
|
simply wrap your form fields with the FormLayout component:
|
@@ -205,41 +200,18 @@ with CSS custom properties.
|
|
205
200
|
|
206
201
|
### Limitations
|
207
202
|
|
203
|
+
#### Label Position
|
204
|
+
|
205
|
+
Label position of inline form fields (CheckboxField, Toggle) is ignored in
|
206
|
+
horizontal FormLayout.
|
207
|
+
|
208
208
|
#### Modals
|
209
209
|
|
210
210
|
Please note the `auto` and `limited` label width options may not function
|
211
211
|
correctly in combination with other auto layout mechanisms, e.g. the auto-width
|
212
|
-
[Modal](/components/
|
212
|
+
[Modal](/components/modal). It's just too much of magic that does not quite
|
213
213
|
work together yet 🎩.
|
214
214
|
|
215
|
-
#### Inline Form Fields
|
216
|
-
|
217
|
-
CheckboxField and Toggle always display their labels after inputs inside
|
218
|
-
FormLayout. In other words, their labels never appear in a column with other
|
219
|
-
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
|
224
|
-
[browsers that we support](/getting-started/browsers-and-devices).
|
225
|
-
|
226
|
-
## Alignment
|
227
|
-
|
228
|
-
To align whole FormLayout to center of a container, simply wrap it with the
|
229
|
-
[Center](/components/layout/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
215
|
## Custom Fields
|
244
216
|
|
245
217
|
You can even place any content you need into the FormLayout — just wrap it with
|
@@ -267,11 +239,10 @@ as API options as such are **not** inherited.
|
|
267
239
|
|
268
240
|
If you are in a situation with one or more box form fields inside your
|
269
241
|
FormLayoutCustomField, you may want to have its label aligned with the fields
|
270
|
-
inside. Since it's
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
for this task.
|
242
|
+
inside. Since it's [not quite possible to do this automatically][rui-265] due to
|
243
|
+
limited browser support, there is `innerFieldSize` option which accepts any of
|
244
|
+
existing box field sizes (small, medium, or large) and is intended right for
|
245
|
+
this task.
|
275
246
|
|
276
247
|
<Playground>
|
277
248
|
<FormLayout fieldLayout="horizontal" labelWidth="auto">
|
@@ -428,6 +399,7 @@ This is a demo of all components supported by FormLayout.
|
|
428
399
|
</FormLayoutCustomField>
|
429
400
|
<CheckboxField
|
430
401
|
checked={isDeliveryAddress}
|
402
|
+
helpText="Uncheck if you wish to deliver to a different address."
|
431
403
|
label="This is my delivery address"
|
432
404
|
onChange={() => setIsDeliveryAddress(!isDeliveryAddress)}
|
433
405
|
/>
|
@@ -493,3 +465,9 @@ FormLayoutCustomField can be styled using a small subset of
|
|
493
465
|
|------------------------------------------------------|--------------------------------------------------------------|
|
494
466
|
| `--rui-FormField--custom--default__surrounding-text-color` | Custom field label color in default state |
|
495
467
|
| `--rui-FormField--custom--disabled__surrounding-text-color` | Custom field label color in disabled-like state |
|
468
|
+
|
469
|
+
[grid]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout
|
470
|
+
[subgrid]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout/Subgrid
|
471
|
+
[fragments]: https://reactjs.org/docs/fragments.html
|
472
|
+
[rui-232]: https://github.com/react-ui-org/react-ui/issues/232
|
473
|
+
[rui-265]: https://github.com/react-ui-org/react-ui/issues/265
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
|
-
import {
|
4
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
5
|
+
import { generateResponsiveCustomProperties } from './_helpers/generateResponsiveCustomProperties';
|
5
6
|
import styles from './Grid.scss';
|
6
7
|
|
7
8
|
export const Grid = ({
|
@@ -19,7 +20,7 @@ export const Grid = ({
|
|
19
20
|
tag: Tag,
|
20
21
|
...other
|
21
22
|
}) => {
|
22
|
-
if (
|
23
|
+
if (isChildrenEmpty(children)) {
|
23
24
|
return null;
|
24
25
|
}
|
25
26
|
|
@@ -113,7 +114,7 @@ Grid.propTypes = {
|
|
113
114
|
}),
|
114
115
|
]),
|
115
116
|
/**
|
116
|
-
* Items to be aligned in the grid.
|
117
|
+
* Items to be aligned in the grid. If none are provided nothing is rendered.
|
117
118
|
*/
|
118
119
|
children: PropTypes.node,
|
119
120
|
/**
|
@@ -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,34 +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
|
-
|
29
|
+
@include tools.assign-responsive-custom-properties(theme.$responsive-properties); // 1.
|
30
|
+
@include spacing.bottom(layouts);
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
+
|
55
|
+
// stylelint-disable selector-no-qualifying-type
|
56
|
+
dl.root,
|
57
|
+
ol.root,
|
58
|
+
ul.root {
|
59
|
+
padding-left: 0;
|
60
|
+
margin-left: 0;
|
61
|
+
}
|
62
|
+
// stylelint-enable selector-no-qualifying-type
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
|
-
import {
|
4
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
5
|
+
import { generateResponsiveCustomProperties } from './_helpers/generateResponsiveCustomProperties';
|
5
6
|
import styles from './Grid.scss';
|
6
7
|
|
7
8
|
export const GridSpan = ({
|
@@ -12,7 +13,7 @@ export const GridSpan = ({
|
|
12
13
|
tag: Tag,
|
13
14
|
...other
|
14
15
|
}) => {
|
15
|
-
if (
|
16
|
+
if (isChildrenEmpty(children)) {
|
16
17
|
return null;
|
17
18
|
}
|
18
19
|
|
@@ -44,7 +45,7 @@ GridSpan.defaultProps = {
|
|
44
45
|
|
45
46
|
GridSpan.propTypes = {
|
46
47
|
/**
|
47
|
-
* Items to be aligned in the grid.
|
48
|
+
* Items to be aligned in the grid. If none are provided nothing is rendered.
|
48
49
|
*/
|
49
50
|
children: PropTypes.node,
|
50
51
|
/**
|
@@ -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,6 +1,8 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
|
+
import { classNames } from '../../utils/classNames';
|
5
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
4
6
|
import styles from './List.scss';
|
5
7
|
|
6
8
|
export const List = ({
|
@@ -8,11 +10,11 @@ export const List = ({
|
|
8
10
|
autoWidth,
|
9
11
|
children,
|
10
12
|
}) => {
|
11
|
-
if (
|
13
|
+
if (isChildrenEmpty(children)) {
|
12
14
|
return null;
|
13
15
|
}
|
14
16
|
|
15
|
-
let alignClass
|
17
|
+
let alignClass;
|
16
18
|
|
17
19
|
if (align === 'start') {
|
18
20
|
alignClass = styles.alignStart;
|
@@ -20,7 +22,7 @@ export const List = ({
|
|
20
22
|
alignClass = styles.alignEnd;
|
21
23
|
}
|
22
24
|
|
23
|
-
let autoWidthClass
|
25
|
+
let autoWidthClass;
|
24
26
|
|
25
27
|
if (autoWidth) {
|
26
28
|
autoWidthClass = styles.isAutoWidth;
|
@@ -28,16 +30,16 @@ export const List = ({
|
|
28
30
|
|
29
31
|
return (
|
30
32
|
<div
|
31
|
-
className={
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
className={classNames(
|
34
|
+
styles.root,
|
35
|
+
autoWidthClass,
|
36
|
+
)}
|
35
37
|
>
|
36
38
|
<ul
|
37
|
-
className={
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
className={classNames(
|
40
|
+
styles.list,
|
41
|
+
alignClass,
|
42
|
+
)}
|
41
43
|
>
|
42
44
|
{children}
|
43
45
|
</ul>
|
@@ -61,7 +63,7 @@ List.propTypes = {
|
|
61
63
|
*/
|
62
64
|
autoWidth: PropTypes.bool,
|
63
65
|
/**
|
64
|
-
* Individual ListItems.
|
66
|
+
* Individual ListItems. If none are provided nothing is rendered.
|
65
67
|
*/
|
66
68
|
children: PropTypes.node,
|
67
69
|
};
|
@@ -1,53 +1,53 @@
|
|
1
|
-
@use
|
2
|
-
@use
|
3
|
-
@use
|
1
|
+
@use "../../styles/tools/reset";
|
2
|
+
@use "../../styles/tools/spacing";
|
3
|
+
@use "theme";
|
4
4
|
|
5
5
|
.root {
|
6
|
-
|
6
|
+
@include spacing.bottom(layouts);
|
7
7
|
}
|
8
8
|
|
9
9
|
.list {
|
10
|
-
|
10
|
+
@include reset.list();
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
display: flex;
|
13
|
+
flex-direction: column;
|
14
14
|
}
|
15
15
|
|
16
16
|
.item {
|
17
|
-
|
18
|
-
|
17
|
+
width: 100%;
|
18
|
+
margin-bottom: theme.$row-gap;
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
&:last-child {
|
21
|
+
margin-bottom: 0;
|
22
|
+
}
|
23
23
|
}
|
24
24
|
|
25
25
|
.alignStart {
|
26
|
-
|
27
|
-
|
26
|
+
align-items: flex-start;
|
27
|
+
text-align: left;
|
28
28
|
}
|
29
29
|
|
30
30
|
.alignEnd {
|
31
|
-
|
32
|
-
|
31
|
+
align-items: flex-end;
|
32
|
+
text-align: right;
|
33
33
|
}
|
34
34
|
|
35
35
|
[dir="rtl"] .alignStart {
|
36
|
-
|
36
|
+
text-align: right;
|
37
37
|
}
|
38
38
|
|
39
39
|
[dir="rtl"] .alignEnd {
|
40
|
-
|
40
|
+
text-align: left;
|
41
41
|
}
|
42
42
|
|
43
43
|
.isAutoWidth .list {
|
44
|
-
|
44
|
+
display: inline-flex;
|
45
45
|
}
|
46
46
|
|
47
47
|
.isAutoWidth .item {
|
48
|
-
|
48
|
+
width: auto;
|
49
49
|
}
|
50
50
|
|
51
51
|
.item .root {
|
52
|
-
|
52
|
+
margin-bottom: 0;
|
53
53
|
}
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
4
5
|
import styles from './List.scss';
|
5
6
|
|
6
7
|
export const ListItem = ({ children }) => {
|
7
|
-
if (
|
8
|
+
if (isChildrenEmpty(children)) {
|
8
9
|
return null;
|
9
10
|
}
|
10
11
|
|
@@ -21,7 +22,7 @@ ListItem.defaultProps = {
|
|
21
22
|
|
22
23
|
ListItem.propTypes = {
|
23
24
|
/**
|
24
|
-
* Content of the list item.
|
25
|
+
* Content of the list item. If none are provided nothing is rendered.
|
25
26
|
*/
|
26
27
|
children: PropTypes.node,
|
27
28
|
};
|
@@ -49,7 +49,7 @@ See [API](#api) for all available options.
|
|
49
49
|
**not** try to put any custom HTML or React components directly into the
|
50
50
|
List layout without wrapping it with the ListItem first.
|
51
51
|
|
52
|
-
- For forms, use rather the [FormLayout](/components/
|
52
|
+
- For forms, use rather the [FormLayout](/components/form-layout)
|
53
53
|
component which is designed specifically for that purpose.
|
54
54
|
|
55
55
|
## List Alignment
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
4
5
|
import styles from './Media.scss';
|
5
6
|
|
6
|
-
export const Media = (
|
7
|
-
|
8
|
-
|
9
|
-
}
|
7
|
+
export const Media = ({ children }) => {
|
8
|
+
if (isChildrenEmpty(children)) {
|
9
|
+
return null;
|
10
|
+
}
|
10
11
|
|
11
12
|
return (
|
12
13
|
<div className={styles.media}>
|
@@ -15,13 +16,19 @@ export const Media = (props) => {
|
|
15
16
|
);
|
16
17
|
};
|
17
18
|
|
19
|
+
Media.defaultProps = {
|
20
|
+
children: null,
|
21
|
+
};
|
22
|
+
|
18
23
|
Media.propTypes = {
|
19
24
|
/**
|
20
25
|
* Nested elements. Supported types are:
|
21
26
|
* * `MediaBody`
|
22
27
|
* * `MediaObject`
|
28
|
+
*
|
29
|
+
* If none are provided nothing is rendered.
|
23
30
|
*/
|
24
|
-
children: PropTypes.node
|
31
|
+
children: PropTypes.node,
|
25
32
|
};
|
26
33
|
|
27
34
|
export const MediaWithContext = withProviderContext(Media, 'Media');
|