@react-ui-org/react-ui 0.44.1 → 0.47.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CONTRIBUTING.md +7 -0
- package/README.md +15 -16
- package/dist/lib.development.js +271 -415
- package/dist/lib.js +1 -1
- package/package.json +11 -13
- package/src/lib/components/Alert/Alert.jsx +45 -44
- package/src/lib/components/Alert/Alert.scss +48 -48
- package/src/lib/components/Alert/README.mdx +2 -5
- 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 +9 -11
- package/src/lib/components/Badge/Badge.scss +57 -57
- package/src/lib/components/Button/Button.jsx +14 -13
- package/src/lib/components/Button/Button.scss +2 -2
- package/src/lib/components/Button/README.mdx +11 -6
- package/src/lib/components/Button/_base.scss +69 -69
- 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/Button/helpers/getRootLabelVisibilityClassName.js +4 -4
- package/src/lib/components/ButtonGroup/ButtonGroup.jsx +41 -25
- package/src/lib/components/ButtonGroup/ButtonGroup.scss +3 -3
- package/src/lib/components/ButtonGroup/README.mdx +1 -1
- package/src/lib/components/Card/Card.jsx +10 -9
- package/src/lib/components/Card/Card.scss +28 -28
- package/src/lib/components/Card/CardBody.jsx +17 -12
- package/src/lib/components/Card/CardFooter.jsx +22 -9
- 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 +21 -20
- package/src/lib/components/CheckboxField/CheckboxField.scss +20 -20
- package/src/lib/components/CheckboxField/README.mdx +1 -1
- package/src/lib/components/FileInputField/FileInputField.jsx +16 -15
- 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 +19 -17
- package/src/lib/components/FormLayout/FormLayout.scss +17 -17
- package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +18 -12
- package/src/lib/components/FormLayout/FormLayoutCustomField.scss +18 -18
- package/src/lib/components/FormLayout/README.mdx +26 -49
- package/src/lib/components/Grid/Grid.jsx +25 -24
- package/src/lib/components/Grid/Grid.scss +33 -29
- package/src/lib/components/Grid/GridSpan.jsx +11 -10
- package/src/lib/components/Grid/README.mdx +46 -20
- 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/Modal/Modal.jsx +38 -32
- package/src/lib/components/Modal/Modal.scss +73 -73
- package/src/lib/components/Modal/README.mdx +2 -5
- 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 +9 -9
- package/src/lib/components/Paper/Paper.scss +8 -8
- package/src/lib/components/Popover/Popover.jsx +94 -0
- package/src/lib/components/Popover/Popover.scss +235 -0
- package/src/lib/components/Popover/PopoverWrapper.jsx +46 -0
- package/src/lib/components/Popover/README.mdx +333 -0
- package/src/lib/components/Popover/_helpers/getRootAlignmentClassName.js +13 -0
- package/src/lib/components/Popover/_helpers/getRootSideClassName.js +17 -0
- package/src/lib/components/Popover/_theme.scss +16 -0
- package/src/lib/components/Popover/index.js +2 -0
- package/src/lib/components/Radio/README.mdx +1 -1
- package/src/lib/components/Radio/Radio.jsx +15 -14
- package/src/lib/components/Radio/Radio.scss +26 -26
- package/src/lib/components/ScrollView/README.mdx +5 -5
- package/src/lib/components/ScrollView/ScrollView.jsx +22 -22
- 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 +1 -1
- package/src/lib/components/SelectField/SelectField.jsx +17 -16
- package/src/lib/components/SelectField/SelectField.scss +30 -30
- package/src/lib/components/Table/README.mdx +1 -1
- package/src/lib/components/Table/Table.jsx +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/Tabs.jsx +4 -5
- package/src/lib/components/Tabs/Tabs.scss +21 -21
- package/src/lib/components/Tabs/TabsItem.jsx +7 -6
- package/src/lib/components/Tabs/TabsItem.scss +78 -78
- package/src/lib/components/Text/README.mdx +3 -3
- package/src/lib/components/Text/Text.jsx +16 -9
- 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 +21 -17
- 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 +19 -18
- package/src/lib/components/TextField/TextField.scss +28 -28
- package/src/lib/components/TextLink/README.mdx +77 -0
- package/src/lib/components/TextLink/TextLink.jsx +44 -0
- 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 +1 -1
- package/src/lib/components/Toggle/Toggle.jsx +21 -20
- package/src/lib/components/Toggle/Toggle.scss +20 -20
- package/src/lib/components/Toolbar/README.mdx +33 -5
- package/src/lib/components/Toolbar/Toolbar.jsx +33 -17
- package/src/lib/components/Toolbar/Toolbar.scss +29 -42
- package/src/lib/components/Toolbar/ToolbarGroup.jsx +28 -16
- package/src/lib/components/Toolbar/ToolbarItem.jsx +36 -10
- 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 +8 -17
- package/src/lib/provider/index.js +2 -1
- package/src/lib/provider/withGlobalProps.jsx +21 -0
- 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 +4 -4
- 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 +14 -22
- 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 +959 -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.jsx +0 -45
- 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
- package/src/lib/components/List/List.jsx +0 -71
- package/src/lib/components/List/List.scss +0 -53
- package/src/lib/components/List/ListItem.jsx +0 -31
- package/src/lib/components/List/README.mdx +0 -114
- package/src/lib/components/List/_theme.scss +0 -1
- package/src/lib/components/List/index.js +0 -2
- package/src/lib/components/Media/Media.jsx +0 -29
- package/src/lib/components/Media/Media.scss +0 -16
- package/src/lib/components/Media/MediaBody.jsx +0 -21
- package/src/lib/components/Media/MediaObject.jsx +0 -21
- package/src/lib/components/Media/README.mdx +0 -63
- package/src/lib/components/Media/index.js +0 -3
- package/src/lib/provider/withProviderContext.jsx +0 -32
@@ -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,49 @@
|
|
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
|
+
}
|
42
|
+
|
43
|
+
// stylelint-disable-next-line selector-max-universal -- Reset any previously added margins.
|
44
|
+
.root > * {
|
45
|
+
margin-block: 0;
|
41
46
|
}
|
42
47
|
|
43
48
|
.span {
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
49
|
+
$responsive-properties: (
|
50
|
+
column-span: 1,
|
51
|
+
row-span: 1,
|
52
|
+
);
|
48
53
|
|
49
|
-
|
54
|
+
@include tools.assign-responsive-custom-properties($responsive-properties); // 1.
|
50
55
|
|
51
|
-
|
52
|
-
|
56
|
+
grid-column: span var(--rui-local-column-span, 1); // 2.
|
57
|
+
grid-row: span var(--rui-local-row-span, 1); // 2.
|
53
58
|
}
|
54
59
|
|
55
|
-
|
56
|
-
|
60
|
+
// stylelint-disable selector-no-qualifying-type
|
57
61
|
dl.root,
|
58
62
|
ol.root,
|
59
63
|
ul.root {
|
60
|
-
|
61
|
-
|
64
|
+
padding-left: 0;
|
65
|
+
margin-left: 0;
|
66
|
+
list-style: none;
|
62
67
|
}
|
63
|
-
|
64
|
-
/* stylelint-enable selector-no-qualifying-type */
|
68
|
+
// stylelint-enable selector-no-qualifying-type
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
|
-
import {
|
4
|
-
import {
|
3
|
+
import { withGlobalProps } from '../../provider';
|
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
|
/**
|
@@ -58,8 +59,8 @@ GridSpan.propTypes = {
|
|
58
59
|
md: PropTypes.number,
|
59
60
|
lg: PropTypes.number,
|
60
61
|
xl: PropTypes.number,
|
61
|
-
|
62
|
-
|
62
|
+
x2l: PropTypes.number,
|
63
|
+
x3l: PropTypes.number,
|
63
64
|
}),
|
64
65
|
]),
|
65
66
|
/**
|
@@ -77,8 +78,8 @@ GridSpan.propTypes = {
|
|
77
78
|
md: PropTypes.number,
|
78
79
|
lg: PropTypes.number,
|
79
80
|
xl: PropTypes.number,
|
80
|
-
|
81
|
-
|
81
|
+
x2l: PropTypes.number,
|
82
|
+
x3l: PropTypes.number,
|
82
83
|
}),
|
83
84
|
]),
|
84
85
|
/**
|
@@ -88,6 +89,6 @@ GridSpan.propTypes = {
|
|
88
89
|
tag: PropTypes.string,
|
89
90
|
};
|
90
91
|
|
91
|
-
export const
|
92
|
+
export const GridSpanWithGlobalProps = withGlobalProps(GridSpan, 'GridSpan');
|
92
93
|
|
93
|
-
export default
|
94
|
+
export default GridSpanWithGlobalProps;
|
@@ -27,10 +27,7 @@ import { Grid } from '@react-ui-org/react-ui';
|
|
27
27
|
And use it:
|
28
28
|
|
29
29
|
<Playground>
|
30
|
-
<Grid
|
31
|
-
<Placeholder bordered>Grid item</Placeholder>
|
32
|
-
<Placeholder bordered>Grid item</Placeholder>
|
33
|
-
<Placeholder bordered>Grid item</Placeholder>
|
30
|
+
<Grid>
|
34
31
|
<Placeholder bordered>Grid item</Placeholder>
|
35
32
|
<Placeholder bordered>Grid item</Placeholder>
|
36
33
|
<Placeholder bordered>Grid item</Placeholder>
|
@@ -41,7 +38,7 @@ See [API](#api) for all available options.
|
|
41
38
|
|
42
39
|
## General Guidelines
|
43
40
|
|
44
|
-
- This component implements native [CSS grid layout][grid-layout],
|
41
|
+
- This component implements native [CSS grid layout][grid-layout], a powerful
|
45
42
|
tool for two-dimensional layouts. You may use any value accepted by
|
46
43
|
[grid-template-columns], [grid-template-rows], [grid-column-gap],
|
47
44
|
[grid-row-gap], [grid-auto-flow], [align-content], [align-items],
|
@@ -53,20 +50,22 @@ See [API](#api) for all available options.
|
|
53
50
|
markup** like GridItem or Cell is necessary for your items. But it's there
|
54
51
|
when you really need it—see [Advanced Layouts](#advanced-layouts).
|
55
52
|
|
53
|
+
- For forms, use rather the [FormLayout](/components/form-layout) component
|
54
|
+
which is designed specifically for that purpose.
|
55
|
+
|
56
56
|
- The Grid component is so powerful that it enables you to build even very
|
57
57
|
advanced layouts **without** having to write **a single line of custom CSS.**
|
58
58
|
See [Advanced Layouts](#advanced-layouts) for more.
|
59
59
|
|
60
|
-
👉
|
61
|
-
[size 4](/foundation/spacing). Defaults for all Grid API options can be
|
62
|
-
[customized](/customize/theming/overview) with CSS custom properties.
|
60
|
+
👉 Vertical margin of items inside Grid is reset to zero.
|
63
61
|
|
64
|
-
## Columns
|
62
|
+
## Columns
|
65
63
|
|
66
|
-
Use `columns`
|
64
|
+
Stack is the default outcome of Grid. Use the `columns` option to organize your
|
65
|
+
items into grid.
|
67
66
|
|
68
67
|
<Playground>
|
69
|
-
<Grid columns="1fr
|
68
|
+
<Grid columns="1fr 1fr 1fr">
|
70
69
|
<Placeholder bordered>Grid item</Placeholder>
|
71
70
|
<Placeholder bordered>Grid item</Placeholder>
|
72
71
|
<Placeholder bordered>Grid item</Placeholder>
|
@@ -106,6 +105,21 @@ responsive layouts. Resize the playground to see it in action.
|
|
106
105
|
👉 If you need your items to have **equal height** even with content of varying
|
107
106
|
length, it may be necessary to set `height: 100%` on them.
|
108
107
|
|
108
|
+
## Rows
|
109
|
+
|
110
|
+
Use `columns` and `rows` to specify a more complicated grid layout.
|
111
|
+
|
112
|
+
<Playground>
|
113
|
+
<Grid columns="1fr 2fr" rows="auto 200px auto">
|
114
|
+
<Placeholder bordered>Grid item</Placeholder>
|
115
|
+
<Placeholder bordered>Grid item</Placeholder>
|
116
|
+
<Placeholder bordered>Grid item</Placeholder>
|
117
|
+
<Placeholder bordered>Grid item</Placeholder>
|
118
|
+
<Placeholder bordered>Grid item</Placeholder>
|
119
|
+
<Placeholder bordered>Grid item</Placeholder>
|
120
|
+
</Grid>
|
121
|
+
</Playground>
|
122
|
+
|
109
123
|
## Gaps
|
110
124
|
|
111
125
|
Both column and row gaps can be customized.
|
@@ -141,13 +155,32 @@ Individual items and the entire grid content can be aligned and along both axes.
|
|
141
155
|
</Grid>
|
142
156
|
</Playground>
|
143
157
|
|
158
|
+
## Custom HTML Tag
|
159
|
+
|
160
|
+
To render as list for example, just change the output `tag` to `ul` or `ol` and
|
161
|
+
wrap your items with `<li>`.
|
162
|
+
|
163
|
+
<Playground>
|
164
|
+
<Grid tag="ul">
|
165
|
+
<li>
|
166
|
+
<Placeholder bordered>List item</Placeholder>
|
167
|
+
</li>
|
168
|
+
<li>
|
169
|
+
<Placeholder bordered>List item</Placeholder>
|
170
|
+
</li>
|
171
|
+
<li>
|
172
|
+
<Placeholder bordered>List item</Placeholder>
|
173
|
+
</li>
|
174
|
+
</Grid>
|
175
|
+
</Playground>
|
176
|
+
|
144
177
|
## Media Queries
|
145
178
|
|
146
179
|
If you need to build more complicated layouts, you have full control over the
|
147
180
|
grid definition. Just specify your grid layout for
|
148
181
|
[breakpoints](/foundation/breakpoints) where a change of layout is needed.
|
149
182
|
The Grid component is written with the mobile-first approach so values for small
|
150
|
-
breakpoints are used until they're
|
183
|
+
breakpoints are used until they're overridden by a bigger breakpoint. If `xs`
|
151
184
|
settings are omitted, theme defaults are used. Resize your browser to see how it
|
152
185
|
works.
|
153
186
|
|
@@ -237,15 +270,8 @@ Wrapper for content that should span multiple rows or columns.
|
|
237
270
|
|
238
271
|
| Custom Property | Description |
|
239
272
|
|------------------------------------------------------|--------------------------------------------------------------|
|
240
|
-
| `--rui-Grid__columns` | Default columns layout |
|
241
273
|
| `--rui-Grid__column-gap` | Default column gap |
|
242
|
-
| `--rui-Grid__rows` | Default rows layout |
|
243
274
|
| `--rui-Grid__row-gap` | Default row gap |
|
244
|
-
| `--rui-Grid__align-content` | Default vertical alignment of the layout |
|
245
|
-
| `--rui-Grid__align-items` | Default vertical alignment of grid items |
|
246
|
-
| `--rui-Grid__justify-content` | Default horizontal alignment of the layout |
|
247
|
-
| `--rui-Grid__justify-items` | Default horizontal alignment of grid items |
|
248
|
-
| `--rui-Grid__auto-flow` | Default auto-flow algorithm |
|
249
275
|
|
250
276
|
[grid-layout]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout
|
251
277
|
[grid-template-columns]: https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns
|
@@ -253,7 +279,7 @@ Wrapper for content that should span multiple rows or columns.
|
|
253
279
|
[grid-column-gap]: https://developer.mozilla.org/en-US/docs/Web/CSS/column-gap
|
254
280
|
[grid-row-gap]: https://developer.mozilla.org/en-US/docs/Web/CSS/row-gap
|
255
281
|
[grid-auto-flow]: https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow
|
256
|
-
[
|
282
|
+
[align-content]: https://developer.mozilla.org/en-US/docs/Web/CSS/align-content
|
257
283
|
[align-items]: https://developer.mozilla.org/en-US/docs/Web/CSS/align-items
|
258
284
|
[justify-content]: https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content
|
259
285
|
[justify-items]: https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items
|
@@ -1,11 +1,11 @@
|
|
1
1
|
$responsive-properties: (
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
columns: 1fr,
|
3
|
+
column-gap: var(--rui-Grid__column-gap),
|
4
|
+
rows: auto,
|
5
|
+
row-gap: var(--rui-Grid__row-gap),
|
6
|
+
auto-flow: initial,
|
7
|
+
align-content: initial,
|
8
|
+
align-items: initial,
|
9
|
+
justify-content: initial,
|
10
|
+
justify-items: initial,
|
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,8 +1,12 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { createPortal } from 'react-dom';
|
4
|
-
import
|
5
|
-
|
4
|
+
import {
|
5
|
+
RUIContext,
|
6
|
+
withGlobalProps,
|
7
|
+
} from '../../provider';
|
8
|
+
import { classNames } from '../../utils/classNames';
|
9
|
+
import { transferProps } from '../_helpers/transferProps';
|
6
10
|
import {
|
7
11
|
Toolbar,
|
8
12
|
ToolbarItem,
|
@@ -80,7 +84,6 @@ export class Modal extends React.Component {
|
|
80
84
|
scrollView,
|
81
85
|
size,
|
82
86
|
title,
|
83
|
-
translations,
|
84
87
|
} = this.props;
|
85
88
|
|
86
89
|
const sizeClass = (modalSize) => {
|
@@ -125,10 +128,10 @@ export class Modal extends React.Component {
|
|
125
128
|
if (scrollView) {
|
126
129
|
return (
|
127
130
|
<div
|
128
|
-
className={
|
131
|
+
className={classNames(
|
129
132
|
styles.body,
|
130
133
|
styles.isBodyScrollable,
|
131
|
-
|
134
|
+
)}
|
132
135
|
>
|
133
136
|
{React.cloneElement(scrollView, scrollView.props, content)}
|
134
137
|
</div>
|
@@ -154,11 +157,11 @@ export class Modal extends React.Component {
|
|
154
157
|
role="presentation"
|
155
158
|
>
|
156
159
|
<div
|
157
|
-
className={
|
160
|
+
className={classNames(
|
158
161
|
styles.root,
|
159
162
|
sizeClass(size),
|
160
163
|
positionClass(position),
|
161
|
-
|
164
|
+
)}
|
162
165
|
onClick={(e) => {
|
163
166
|
e.stopPropagation();
|
164
167
|
}}
|
@@ -172,15 +175,19 @@ export class Modal extends React.Component {
|
|
172
175
|
{title}
|
173
176
|
</h3>
|
174
177
|
{onClose && (
|
175
|
-
<
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
178
|
+
<RUIContext.Consumer>
|
179
|
+
{({ translations }) => (
|
180
|
+
<button
|
181
|
+
type="button"
|
182
|
+
className={styles.close}
|
183
|
+
onClick={onClose}
|
184
|
+
title={translations.Modal.close}
|
185
|
+
{...(id && { id: `${id}__closeModalHeaderButton` })}
|
186
|
+
>
|
187
|
+
×
|
188
|
+
</button>
|
189
|
+
)}
|
190
|
+
</RUIContext.Consumer>
|
184
191
|
)}
|
185
192
|
</div>
|
186
193
|
{modalBody()}
|
@@ -204,12 +211,16 @@ export class Modal extends React.Component {
|
|
204
211
|
))}
|
205
212
|
{onClose && (
|
206
213
|
<ToolbarItem>
|
207
|
-
<
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
214
|
+
<RUIContext.Consumer>
|
215
|
+
{({ translations }) => (
|
216
|
+
<Button
|
217
|
+
label={translations.Modal.close}
|
218
|
+
onClick={onClose}
|
219
|
+
priority="flat"
|
220
|
+
{...(id && { id: `${id}__closeModalFooterButton` })}
|
221
|
+
/>
|
222
|
+
)}
|
223
|
+
</RUIContext.Consumer>
|
213
224
|
</ToolbarItem>
|
214
225
|
)}
|
215
226
|
</Toolbar>
|
@@ -234,6 +245,7 @@ export class Modal extends React.Component {
|
|
234
245
|
Modal.defaultProps = {
|
235
246
|
actions: [],
|
236
247
|
autoFocus: true,
|
248
|
+
children: null,
|
237
249
|
id: undefined,
|
238
250
|
onClose: null,
|
239
251
|
portalId: null,
|
@@ -265,7 +277,7 @@ Modal.propTypes = {
|
|
265
277
|
/**
|
266
278
|
* Content of the modal.
|
267
279
|
*/
|
268
|
-
children: PropTypes.node
|
280
|
+
children: PropTypes.node,
|
269
281
|
/**
|
270
282
|
* ID of the root HTML element. It also serves as a base for nested elements:
|
271
283
|
* * `<ID>__content`
|
@@ -278,7 +290,7 @@ Modal.propTypes = {
|
|
278
290
|
*/
|
279
291
|
onClose: PropTypes.func,
|
280
292
|
/**
|
281
|
-
* If set,
|
293
|
+
* If set, modal is rendered in the React Portal with that ID.
|
282
294
|
*/
|
283
295
|
portalId: PropTypes.string,
|
284
296
|
/**
|
@@ -299,14 +311,8 @@ Modal.propTypes = {
|
|
299
311
|
* Title displayed in modal header.
|
300
312
|
*/
|
301
313
|
title: PropTypes.string.isRequired,
|
302
|
-
/**
|
303
|
-
* Translations required by the component.
|
304
|
-
*/
|
305
|
-
translations: PropTypes.shape({
|
306
|
-
close: PropTypes.string.isRequired,
|
307
|
-
}).isRequired,
|
308
314
|
};
|
309
315
|
|
310
|
-
export const
|
316
|
+
export const ModalWithGlobalProps = withGlobalProps(Modal, 'Modal');
|
311
317
|
|
312
|
-
export default
|
318
|
+
export default ModalWithGlobalProps;
|