@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
@@ -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 { classNames } from '../../utils/classNames';
|
5
|
+
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
|
5
6
|
import styles from './Card.scss';
|
6
7
|
|
7
8
|
export const Card = ({
|
@@ -13,13 +14,13 @@ export const Card = ({
|
|
13
14
|
color,
|
14
15
|
}) => (
|
15
16
|
<div
|
16
|
-
className={
|
17
|
+
className={classNames(
|
17
18
|
styles.root,
|
18
19
|
getRootColorClassName(color, styles),
|
19
|
-
dense
|
20
|
-
raised
|
21
|
-
disabled
|
22
|
-
|
20
|
+
dense && styles.rootDense,
|
21
|
+
raised && styles.rootRaised,
|
22
|
+
disabled && styles.isDisabled,
|
23
|
+
)}
|
23
24
|
id={id}
|
24
25
|
>
|
25
26
|
{children}
|
@@ -66,6 +67,6 @@ Card.propTypes = {
|
|
66
67
|
raised: PropTypes.bool,
|
67
68
|
};
|
68
69
|
|
69
|
-
export const
|
70
|
+
export const CardWithGlobalProps = withGlobalProps(Card, 'Card');
|
70
71
|
|
71
|
-
export default
|
72
|
+
export default CardWithGlobalProps;
|
@@ -1,79 +1,79 @@
|
|
1
1
|
// 1. Retain equal card widths in flex and grid layouts independently on their content.
|
2
2
|
|
3
|
-
@use
|
4
|
-
@use
|
5
|
-
@use
|
3
|
+
@use "../../styles/theme/colors";
|
4
|
+
@use "theme";
|
5
|
+
@use "tools";
|
6
6
|
|
7
7
|
.root {
|
8
|
-
|
8
|
+
--rui-local-padding: #{theme.$padding};
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
display: flex;
|
11
|
+
flex-direction: column;
|
12
|
+
min-width: 0; // 1.
|
13
|
+
color: var(--rui-local-color);
|
14
|
+
border: theme.$border-width solid var(--rui-local-border-color);
|
15
|
+
border-radius: theme.$border-radius;
|
16
|
+
background-color: var(--rui-local-background-color);
|
17
17
|
}
|
18
18
|
|
19
19
|
.body {
|
20
|
-
|
21
|
-
|
20
|
+
flex: 1 0 auto;
|
21
|
+
padding: var(--rui-local-padding);
|
22
22
|
}
|
23
23
|
|
24
24
|
.footer {
|
25
|
-
|
25
|
+
padding: var(--rui-local-padding);
|
26
26
|
}
|
27
27
|
|
28
28
|
.rootDense {
|
29
|
-
|
29
|
+
--rui-local-padding: #{theme.$dense-padding};
|
30
30
|
}
|
31
31
|
|
32
32
|
.rootRaised {
|
33
|
-
|
33
|
+
box-shadow: theme.$raised-box-shadow;
|
34
34
|
}
|
35
35
|
|
36
36
|
.rootColorPrimary {
|
37
|
-
|
37
|
+
@include tools.color(primary);
|
38
38
|
}
|
39
39
|
|
40
40
|
.rootColorSecondary {
|
41
|
-
|
41
|
+
@include tools.color(secondary);
|
42
42
|
}
|
43
43
|
|
44
44
|
.rootColorSuccess {
|
45
|
-
|
45
|
+
@include tools.color(success);
|
46
46
|
}
|
47
47
|
|
48
48
|
.rootColorWarning {
|
49
|
-
|
49
|
+
@include tools.color(warning);
|
50
50
|
}
|
51
51
|
|
52
52
|
.rootColorDanger {
|
53
|
-
|
53
|
+
@include tools.color(danger);
|
54
54
|
}
|
55
55
|
|
56
56
|
.rootColorHelp {
|
57
|
-
|
57
|
+
@include tools.color(help);
|
58
58
|
}
|
59
59
|
|
60
60
|
.rootColorInfo {
|
61
|
-
|
61
|
+
@include tools.color(info);
|
62
62
|
}
|
63
63
|
|
64
64
|
.rootColorNote {
|
65
|
-
|
65
|
+
@include tools.color(note);
|
66
66
|
}
|
67
67
|
|
68
68
|
.rootColorLight {
|
69
|
-
|
69
|
+
@include tools.color(light);
|
70
70
|
}
|
71
71
|
|
72
72
|
.rootColorDark {
|
73
|
-
|
73
|
+
@include tools.color(dark);
|
74
74
|
}
|
75
75
|
|
76
76
|
.isDisabled {
|
77
|
-
|
78
|
-
|
77
|
+
background-color: theme.$disabled-background-color;
|
78
|
+
opacity: theme.$disabled-opacity;
|
79
79
|
}
|
@@ -1,18 +1,19 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
|
-
import {
|
3
|
+
import { withGlobalProps } from '../../provider';
|
4
4
|
import styles from './Card.scss';
|
5
5
|
|
6
|
-
export const CardBody = (
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
export const CardBody = ({
|
7
|
+
children,
|
8
|
+
id,
|
9
|
+
}) => (
|
10
|
+
<div className={styles.body} id={id}>
|
11
|
+
{children}
|
12
|
+
</div>
|
13
|
+
);
|
10
14
|
|
11
|
-
|
12
|
-
|
13
|
-
{children}
|
14
|
-
</div>
|
15
|
-
);
|
15
|
+
CardBody.defaultProps = {
|
16
|
+
id: undefined,
|
16
17
|
};
|
17
18
|
|
18
19
|
CardBody.propTypes = {
|
@@ -20,8 +21,12 @@ CardBody.propTypes = {
|
|
20
21
|
* Content of the card.
|
21
22
|
*/
|
22
23
|
children: PropTypes.node.isRequired,
|
24
|
+
/**
|
25
|
+
* ID of the root HTML element.
|
26
|
+
*/
|
27
|
+
id: PropTypes.string,
|
23
28
|
};
|
24
29
|
|
25
|
-
export const
|
30
|
+
export const CardBodyWithGlobalProps = withGlobalProps(CardBody, 'CardBody');
|
26
31
|
|
27
|
-
export default
|
32
|
+
export default CardBodyWithGlobalProps;
|
@@ -1,27 +1,40 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
|
-
import {
|
3
|
+
import { withGlobalProps } from '../../provider';
|
4
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
4
5
|
import styles from './Card.scss';
|
5
6
|
|
6
|
-
export const CardFooter = (
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
export const CardFooter = ({
|
8
|
+
children,
|
9
|
+
id,
|
10
|
+
}) => {
|
11
|
+
if (isChildrenEmpty(children)) {
|
12
|
+
return null;
|
13
|
+
}
|
10
14
|
|
11
15
|
return (
|
12
|
-
<div className={styles.footer}>
|
16
|
+
<div className={styles.footer} id={id}>
|
13
17
|
{children}
|
14
18
|
</div>
|
15
19
|
);
|
16
20
|
};
|
17
21
|
|
22
|
+
CardFooter.defaultProps = {
|
23
|
+
children: null,
|
24
|
+
id: undefined,
|
25
|
+
};
|
26
|
+
|
18
27
|
CardFooter.propTypes = {
|
19
28
|
/**
|
20
29
|
* Card actions, usually buttons.
|
21
30
|
*/
|
22
|
-
children: PropTypes.node
|
31
|
+
children: PropTypes.node,
|
32
|
+
/**
|
33
|
+
* ID of the root HTML element.
|
34
|
+
*/
|
35
|
+
id: PropTypes.string,
|
23
36
|
};
|
24
37
|
|
25
|
-
export const
|
38
|
+
export const CardFooterWithGlobalProps = withGlobalProps(CardFooter, 'CardFooter');
|
26
39
|
|
27
|
-
export default
|
40
|
+
export default CardFooterWithGlobalProps;
|
@@ -9,54 +9,54 @@ $disabled-background-color: var(--rui-Card--disabled__background-color);
|
|
9
9
|
$disabled-opacity: var(--rui-Card--disabled__opacity);
|
10
10
|
|
11
11
|
$colors: (
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
12
|
+
primary: (
|
13
|
+
color: var(--rui-Card--primary__color),
|
14
|
+
border-color: var(--rui-Card--primary__border-color),
|
15
|
+
background-color: var(--rui-Card--primary__background-color),
|
16
|
+
),
|
17
|
+
secondary: (
|
18
|
+
color: var(--rui-Card--secondary__color),
|
19
|
+
border-color: var(--rui-Card--secondary__border-color),
|
20
|
+
background-color: var(--rui-Card--secondary__background-color),
|
21
|
+
),
|
22
|
+
success: (
|
23
|
+
color: var(--rui-Card--success__color),
|
24
|
+
border-color: var(--rui-Card--success__border-color),
|
25
|
+
background-color: var(--rui-Card--success__background-color),
|
26
|
+
),
|
27
|
+
warning: (
|
28
|
+
color: var(--rui-Card--warning__color),
|
29
|
+
border-color: var(--rui-Card--warning__border-color),
|
30
|
+
background-color: var(--rui-Card--warning__background-color),
|
31
|
+
),
|
32
|
+
danger: (
|
33
|
+
color: var(--rui-Card--danger__color),
|
34
|
+
border-color: var(--rui-Card--danger__border-color),
|
35
|
+
background-color: var(--rui-Card--danger__background-color),
|
36
|
+
),
|
37
|
+
info: (
|
38
|
+
color: var(--rui-Card--info__color),
|
39
|
+
border-color: var(--rui-Card--info__border-color),
|
40
|
+
background-color: var(--rui-Card--info__background-color),
|
41
|
+
),
|
42
|
+
help: (
|
43
|
+
color: var(--rui-Card--help__color),
|
44
|
+
border-color: var(--rui-Card--help__border-color),
|
45
|
+
background-color: var(--rui-Card--help__background-color),
|
46
|
+
),
|
47
|
+
note: (
|
48
|
+
color: var(--rui-Card--note__color),
|
49
|
+
border-color: var(--rui-Card--note__border-color),
|
50
|
+
background-color: var(--rui-Card--note__background-color),
|
51
|
+
),
|
52
|
+
light: (
|
53
|
+
color: var(--rui-Card--light__color),
|
54
|
+
border-color: var(--rui-Card--light__border-color),
|
55
|
+
background-color: var(--rui-Card--light__background-color),
|
56
|
+
),
|
57
|
+
dark: (
|
58
|
+
color: var(--rui-Card--dark__color),
|
59
|
+
border-color: var(--rui-Card--dark__border-color),
|
60
|
+
background-color: var(--rui-Card--dark__background-color),
|
61
|
+
),
|
62
62
|
);
|
@@ -1,10 +1,10 @@
|
|
1
|
-
@use
|
2
|
-
@use
|
1
|
+
@use "sass:map";
|
2
|
+
@use "theme";
|
3
3
|
|
4
4
|
@mixin color($color) {
|
5
|
-
|
5
|
+
$color-variant-properties: map.get(theme.$colors, $color);
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
--rui-local-color: #{map.get($color-variant-properties, color)};
|
8
|
+
--rui-local-border-color: #{map.get($color-variant-properties, border-color)};
|
9
|
+
--rui-local-background-color: #{map.get($color-variant-properties, background-color)};
|
10
10
|
}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React, { useContext } from 'react';
|
3
|
-
import
|
4
|
-
import {
|
5
|
-
import
|
3
|
+
import { withGlobalProps } from '../../provider';
|
4
|
+
import { classNames } from '../../utils/classNames';
|
5
|
+
import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
|
6
|
+
import { transferProps } from '../_helpers/transferProps';
|
6
7
|
import { FormLayoutContext } from '../FormLayout';
|
7
8
|
import withForwardedRef from '../withForwardedRef';
|
8
9
|
import styles from './CheckboxField.scss';
|
@@ -26,19 +27,28 @@ export const CheckboxField = ({
|
|
26
27
|
|
27
28
|
return (
|
28
29
|
<label
|
29
|
-
className={
|
30
|
+
className={classNames(
|
30
31
|
styles.root,
|
31
|
-
context
|
32
|
+
context && styles.isRootInFormLayout,
|
32
33
|
context && context.layout === 'horizontal' ? styles.rootLayoutHorizontal : styles.rootLayoutVertical,
|
33
|
-
labelPosition === 'before'
|
34
|
-
disabled
|
35
|
-
required
|
34
|
+
labelPosition === 'before' && styles.hasRootLabelBefore,
|
35
|
+
disabled && styles.isRootDisabled,
|
36
|
+
required && styles.isRootRequired,
|
36
37
|
getRootValidationStateClassName(validationState, styles),
|
37
|
-
|
38
|
+
)}
|
38
39
|
htmlFor={id}
|
39
40
|
id={id && `${id}__label`}
|
40
41
|
>
|
41
42
|
<div className={styles.field}>
|
43
|
+
<div
|
44
|
+
className={classNames(
|
45
|
+
styles.label,
|
46
|
+
!isLabelVisible && styles.isLabelHidden,
|
47
|
+
)}
|
48
|
+
id={id && `${id}__labelText`}
|
49
|
+
>
|
50
|
+
{label}
|
51
|
+
</div>
|
42
52
|
<input
|
43
53
|
{...transferProps(restProps)}
|
44
54
|
checked={checked}
|
@@ -50,15 +60,6 @@ export const CheckboxField = ({
|
|
50
60
|
type="checkbox"
|
51
61
|
value={value}
|
52
62
|
/>
|
53
|
-
<div
|
54
|
-
className={[
|
55
|
-
styles.label,
|
56
|
-
isLabelVisible ? '' : styles.isLabelHidden,
|
57
|
-
].join(' ')}
|
58
|
-
id={id && `${id}__labelText`}
|
59
|
-
>
|
60
|
-
{label}
|
61
|
-
</div>
|
62
63
|
</div>
|
63
64
|
{helpText && (
|
64
65
|
<div
|
@@ -159,6 +160,6 @@ CheckboxField.propTypes = {
|
|
159
160
|
]),
|
160
161
|
};
|
161
162
|
|
162
|
-
export const
|
163
|
+
export const CheckboxFieldWithGlobalProps = withForwardedRef(withGlobalProps(CheckboxField, 'CheckboxField'));
|
163
164
|
|
164
|
-
export default
|
165
|
+
export default CheckboxFieldWithGlobalProps;
|
@@ -1,61 +1,61 @@
|
|
1
|
-
@use
|
2
|
-
@use
|
3
|
-
@use
|
4
|
-
@use
|
5
|
-
@use
|
1
|
+
@use "../../styles/tools/form-fields/foundation";
|
2
|
+
@use "../../styles/tools/form-fields/inline-field-elements";
|
3
|
+
@use "../../styles/tools/form-fields/inline-field-layout";
|
4
|
+
@use "../../styles/tools/form-fields/variants";
|
5
|
+
@use "../../styles/tools/accessibility";
|
6
6
|
|
7
7
|
// Foundation
|
8
8
|
.root {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
@include foundation.root();
|
10
|
+
@include inline-field-layout.root();
|
11
|
+
@include inline-field-elements.min-tap-target($type: checkbox);
|
12
|
+
@include variants.visual(check);
|
13
13
|
}
|
14
14
|
|
15
15
|
.label {
|
16
|
-
|
16
|
+
@include foundation.label();
|
17
17
|
}
|
18
18
|
|
19
19
|
.field {
|
20
|
-
|
20
|
+
@include inline-field-layout.field($type: checkbox);
|
21
21
|
}
|
22
22
|
|
23
23
|
.input {
|
24
|
-
|
24
|
+
@include inline-field-elements.check-input($type: checkbox);
|
25
25
|
}
|
26
26
|
|
27
27
|
.helpText,
|
28
28
|
.validationText {
|
29
|
-
|
29
|
+
@include foundation.help-text();
|
30
30
|
}
|
31
31
|
|
32
32
|
.isRootRequired .label {
|
33
|
-
|
33
|
+
@include foundation.label-required();
|
34
34
|
}
|
35
35
|
|
36
36
|
// States
|
37
37
|
.isRootStateInvalid {
|
38
|
-
|
38
|
+
@include variants.validation(invalid);
|
39
39
|
}
|
40
40
|
|
41
41
|
.isRootStateValid {
|
42
|
-
|
42
|
+
@include variants.validation(valid);
|
43
43
|
}
|
44
44
|
|
45
45
|
.isRootStateWarning {
|
46
|
-
|
46
|
+
@include variants.validation(warning);
|
47
47
|
}
|
48
48
|
|
49
49
|
// Invisible label
|
50
50
|
.isLabelHidden {
|
51
|
-
|
51
|
+
@include accessibility.hide-text();
|
52
52
|
}
|
53
53
|
|
54
54
|
// Layouts
|
55
55
|
.hasRootLabelBefore {
|
56
|
-
|
56
|
+
@include inline-field-layout.has-label-before();
|
57
57
|
}
|
58
58
|
|
59
59
|
.isRootInFormLayout {
|
60
|
-
|
60
|
+
@include inline-field-layout.in-form-layout();
|
61
61
|
}
|
@@ -185,7 +185,7 @@ Disabled state makes the input unavailable.
|
|
185
185
|
|
186
186
|
In addition to the options below, you can specify [React synthetic events] or
|
187
187
|
any custom HTML attributes that do not interfere with the API, and they will be
|
188
|
-
passed to the
|
188
|
+
passed to the `<input>` HTML element. This enables making the component
|
189
189
|
interactive and helps improve its accessibility.
|
190
190
|
|
191
191
|
<Props table of={CheckboxField} />
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React, { useContext } from 'react';
|
3
|
-
import
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import
|
3
|
+
import { withGlobalProps } from '../../provider';
|
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}
|
@@ -157,6 +158,6 @@ FileInputField.propTypes = {
|
|
157
158
|
validationText: PropTypes.node,
|
158
159
|
};
|
159
160
|
|
160
|
-
export const
|
161
|
+
export const FileInputFieldWithGlobalProps = withForwardedRef(withGlobalProps(FileInputField, 'FileInputField'));
|
161
162
|
|
162
|
-
export default
|
163
|
+
export default FileInputFieldWithGlobalProps;
|