@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,152 +1,152 @@
|
|
1
|
-
@use
|
2
|
-
@use
|
3
|
-
@use
|
4
|
-
@use
|
1
|
+
@use "sass:map";
|
2
|
+
@use "settings";
|
3
|
+
@use "theme";
|
4
|
+
@use "tools";
|
5
5
|
|
6
6
|
.rootPriorityFilled.rootColorPrimary {
|
7
|
-
|
7
|
+
@include tools.button-color(filled, primary);
|
8
8
|
}
|
9
9
|
|
10
10
|
.rootPriorityFilled.rootColorSecondary {
|
11
|
-
|
11
|
+
@include tools.button-color(filled, secondary);
|
12
12
|
}
|
13
13
|
|
14
14
|
.rootPriorityFilled.rootColorSuccess {
|
15
|
-
|
15
|
+
@include tools.button-color(filled, success);
|
16
16
|
}
|
17
17
|
|
18
18
|
.rootPriorityFilled.rootColorWarning {
|
19
|
-
|
19
|
+
@include tools.button-color(filled, warning);
|
20
20
|
}
|
21
21
|
|
22
22
|
.rootPriorityFilled.rootColorDanger {
|
23
|
-
|
23
|
+
@include tools.button-color(filled, danger);
|
24
24
|
}
|
25
25
|
|
26
26
|
.rootPriorityFilled.rootColorHelp {
|
27
|
-
|
27
|
+
@include tools.button-color(filled, help);
|
28
28
|
}
|
29
29
|
|
30
30
|
.rootPriorityFilled.rootColorInfo {
|
31
|
-
|
31
|
+
@include tools.button-color(filled, info);
|
32
32
|
}
|
33
33
|
|
34
34
|
.rootPriorityFilled.rootColorNote {
|
35
|
-
|
35
|
+
@include tools.button-color(filled, note);
|
36
36
|
}
|
37
37
|
|
38
38
|
.rootPriorityFilled.rootColorLight {
|
39
|
-
|
39
|
+
@include tools.button-color(filled, light);
|
40
40
|
}
|
41
41
|
|
42
42
|
.rootPriorityFilled.rootColorDark {
|
43
|
-
|
43
|
+
@include tools.button-color(filled, dark);
|
44
44
|
}
|
45
45
|
|
46
46
|
.rootPriorityOutline.rootColorPrimary {
|
47
|
-
|
47
|
+
@include tools.button-color(outline, primary);
|
48
48
|
}
|
49
49
|
|
50
50
|
.rootPriorityOutline.rootColorSecondary {
|
51
|
-
|
51
|
+
@include tools.button-color(outline, secondary);
|
52
52
|
}
|
53
53
|
|
54
54
|
.rootPriorityOutline.rootColorSuccess {
|
55
|
-
|
55
|
+
@include tools.button-color(outline, success);
|
56
56
|
}
|
57
57
|
|
58
58
|
.rootPriorityOutline.rootColorWarning {
|
59
|
-
|
59
|
+
@include tools.button-color(outline, warning);
|
60
60
|
}
|
61
61
|
|
62
62
|
.rootPriorityOutline.rootColorDanger {
|
63
|
-
|
63
|
+
@include tools.button-color(outline, danger);
|
64
64
|
}
|
65
65
|
|
66
66
|
.rootPriorityOutline.rootColorHelp {
|
67
|
-
|
67
|
+
@include tools.button-color(outline, help);
|
68
68
|
}
|
69
69
|
|
70
70
|
.rootPriorityOutline.rootColorInfo {
|
71
|
-
|
71
|
+
@include tools.button-color(outline, info);
|
72
72
|
}
|
73
73
|
|
74
74
|
.rootPriorityOutline.rootColorNote {
|
75
|
-
|
75
|
+
@include tools.button-color(outline, note);
|
76
76
|
}
|
77
77
|
|
78
78
|
.rootPriorityOutline.rootColorLight {
|
79
|
-
|
79
|
+
@include tools.button-color(outline, light);
|
80
80
|
}
|
81
81
|
|
82
82
|
.rootPriorityOutline.rootColorDark {
|
83
|
-
|
83
|
+
@include tools.button-color(outline, dark);
|
84
84
|
}
|
85
85
|
|
86
86
|
.rootPriorityFlat.rootColorPrimary {
|
87
|
-
|
87
|
+
@include tools.button-color(flat, primary);
|
88
88
|
}
|
89
89
|
|
90
90
|
.rootPriorityFlat.rootColorSecondary {
|
91
|
-
|
91
|
+
@include tools.button-color(flat, secondary);
|
92
92
|
}
|
93
93
|
|
94
94
|
.rootPriorityFlat.rootColorSuccess {
|
95
|
-
|
95
|
+
@include tools.button-color(flat, success);
|
96
96
|
}
|
97
97
|
|
98
98
|
.rootPriorityFlat.rootColorWarning {
|
99
|
-
|
99
|
+
@include tools.button-color(flat, warning);
|
100
100
|
}
|
101
101
|
|
102
102
|
.rootPriorityFlat.rootColorDanger {
|
103
|
-
|
103
|
+
@include tools.button-color(flat, danger);
|
104
104
|
}
|
105
105
|
|
106
106
|
.rootPriorityFlat.rootColorHelp {
|
107
|
-
|
107
|
+
@include tools.button-color(flat, help);
|
108
108
|
}
|
109
109
|
|
110
110
|
.rootPriorityFlat.rootColorInfo {
|
111
|
-
|
111
|
+
@include tools.button-color(flat, info);
|
112
112
|
}
|
113
113
|
|
114
114
|
.rootPriorityFlat.rootColorNote {
|
115
|
-
|
115
|
+
@include tools.button-color(flat, note);
|
116
116
|
}
|
117
117
|
|
118
118
|
.rootPriorityFlat.rootColorLight {
|
119
|
-
|
119
|
+
@include tools.button-color(flat, light);
|
120
120
|
}
|
121
121
|
|
122
122
|
.rootPriorityFlat.rootColorDark {
|
123
|
-
|
123
|
+
@include tools.button-color(flat, dark);
|
124
124
|
}
|
125
125
|
|
126
126
|
.rootPriorityFilled.rootGrouped:not(:first-child)::before,
|
127
127
|
.rootPriorityFlat.rootGrouped:not(:first-child)::before {
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
128
|
+
content: "";
|
129
|
+
position: absolute;
|
130
|
+
top: calc(-1 * #{theme.$border-width});
|
131
|
+
bottom: calc(-1 * #{theme.$border-width});
|
132
|
+
left: calc(-1 * #{theme.$border-width});
|
133
|
+
z-index: map.get(settings.$group-z-indexes, separator);
|
134
|
+
border-left: var(--rui-local-separator-width) solid var(--rui-local-separator-color);
|
135
|
+
transform: translateX(calc(-0.5 * var(--rui-local-gap) - 50%));
|
136
136
|
}
|
137
137
|
|
138
138
|
.rootPriorityFilled.rootGrouped:not(:first-child) {
|
139
|
-
|
140
|
-
|
141
|
-
|
139
|
+
--rui-local-gap: #{theme.$group-filled-gap};
|
140
|
+
--rui-local-separator-width: #{theme.$group-filled-separator-width};
|
141
|
+
--rui-local-separator-color: #{theme.$group-filled-separator-color};
|
142
142
|
}
|
143
143
|
|
144
144
|
.rootPriorityFlat.rootGrouped:not(:first-child) {
|
145
|
-
|
146
|
-
|
147
|
-
|
145
|
+
--rui-local-gap: #{theme.$group-flat-gap};
|
146
|
+
--rui-local-separator-width: #{theme.$group-flat-separator-width};
|
147
|
+
--rui-local-separator-color: #{theme.$group-flat-separator-color};
|
148
148
|
}
|
149
149
|
|
150
150
|
.rootPriorityOutline.rootGrouped:not(:first-child) {
|
151
|
-
|
151
|
+
--rui-local-gap: #{theme.$group-outline-gap};
|
152
152
|
}
|
@@ -1,21 +1,21 @@
|
|
1
|
-
@use
|
2
|
-
@use
|
1
|
+
@use "../../styles/theme/typography";
|
2
|
+
@use "../../styles/tools/spacing";
|
3
3
|
|
4
4
|
$font-family: typography.$font-family-base;
|
5
|
-
$line-height: typography.$line-height-
|
5
|
+
$line-height: typography.$line-height-small;
|
6
6
|
$icon-spacing: spacing.of(2);
|
7
7
|
|
8
8
|
$group-z-indexes: (
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
button: auto,
|
10
|
+
button-hover: 1,
|
11
|
+
separator: 2,
|
12
|
+
button-overflowing-elements: 3,
|
13
13
|
);
|
14
14
|
|
15
15
|
$themeable-variants: (primary, secondary, success, warning, danger, help, info, note, light, dark);
|
16
16
|
$themeable-states: (default, hover, active, disabled);
|
17
17
|
$themeable-priority-properties: (
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
filled: (color, border-color, background, box-shadow),
|
19
|
+
outline: (color, border-color, background),
|
20
|
+
flat: (color, background),
|
21
21
|
);
|
@@ -23,19 +23,22 @@ $group-flat-separator-color: var(--rui-ButtonGroup--flat__separator__color);
|
|
23
23
|
$group-outline-gap: var(--rui-ButtonGroup--outline__gap);
|
24
24
|
|
25
25
|
$sizes: (
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
26
|
+
small: (
|
27
|
+
height: var(--rui-Button--small__height),
|
28
|
+
padding-y: var(--rui-Button--small__padding-y),
|
29
|
+
padding-x: var(--rui-Button--small__padding-x),
|
30
|
+
font-size: var(--rui-Button--small__font-size),
|
31
|
+
),
|
32
|
+
medium: (
|
33
|
+
height: var(--rui-Button--medium__height),
|
34
|
+
padding-y: var(--rui-Button--medium__padding-y),
|
35
|
+
padding-x: var(--rui-Button--medium__padding-x),
|
36
|
+
font-size: var(--rui-Button--medium__font-size),
|
37
|
+
),
|
38
|
+
large: (
|
39
|
+
height: var(--rui-Button--large__height),
|
40
|
+
padding-y: var(--rui-Button--large__padding-y),
|
41
|
+
padding-x: var(--rui-Button--large__padding-x),
|
42
|
+
font-size: var(--rui-Button--large__font-size),
|
43
|
+
),
|
41
44
|
);
|
@@ -15,142 +15,140 @@
|
|
15
15
|
//
|
16
16
|
// 5. Use original padding to restore square buttons back to their size.
|
17
17
|
|
18
|
-
@use
|
19
|
-
@use
|
20
|
-
@use
|
21
|
-
@use
|
22
|
-
@use
|
23
|
-
@use
|
24
|
-
@use
|
25
|
-
@use
|
18
|
+
@use "sass:list";
|
19
|
+
@use "sass:map";
|
20
|
+
@use "sass:math";
|
21
|
+
@use "../../styles/tools/accessibility";
|
22
|
+
@use "../../styles/tools/breakpoint";
|
23
|
+
@use "../../styles/tools/transition";
|
24
|
+
@use "settings";
|
25
|
+
@use "theme";
|
26
26
|
|
27
27
|
// 1.
|
28
28
|
@mixin _get-themeable-properties($priority, $color, $state) {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
}
|
33
|
-
|
34
|
-
@if (not list.index(settings.$themeable-variants, $color)) {
|
35
|
-
@error "Invalid variant specified! #{$color} doesn't exist. "
|
36
|
-
+ "Choose one of #{settings.$themeable-variants}.";
|
37
|
-
}
|
38
|
-
|
39
|
-
@if (not list.index(settings.$themeable-states, $state)) {
|
40
|
-
@error "Invalid state specified! #{$state} doesn't exist. "
|
41
|
-
+ "Choose one of #{settings.$themeable-states}.";
|
42
|
-
}
|
43
|
-
|
44
|
-
$properties: map.get(settings.$themeable-priority-properties, $priority);
|
45
|
-
|
46
|
-
// 2.
|
47
|
-
@if ($state == 'disabled') {
|
48
|
-
@each $property in $properties {
|
49
|
-
--rui-local-#{$property}:
|
50
|
-
var(
|
51
|
-
--rui-Button--#{$priority}--#{$color}--#{$state}__#{$property},
|
52
|
-
var(--rui-Button--#{$priority}--#{$color}--default__#{$property})
|
53
|
-
);
|
29
|
+
@if not list.index(map.keys(settings.$themeable-priority-properties), $priority) {
|
30
|
+
@error "Invalid priority specified! #{$priority} doesn't exist. "
|
31
|
+
+ "Choose one of #{settings.$themeable-priority-properties}.";
|
54
32
|
}
|
55
|
-
}
|
56
33
|
|
57
|
-
|
58
|
-
|
59
|
-
|
34
|
+
@if not list.index(settings.$themeable-variants, $color) {
|
35
|
+
@error "Invalid variant specified! #{$color} doesn't exist. "
|
36
|
+
+ "Choose one of #{settings.$themeable-variants}.";
|
37
|
+
}
|
38
|
+
|
39
|
+
@if not list.index(settings.$themeable-states, $state) {
|
40
|
+
@error "Invalid state specified! #{$state} doesn't exist. "
|
41
|
+
+ "Choose one of #{settings.$themeable-states}.";
|
42
|
+
}
|
43
|
+
|
44
|
+
$properties: map.get(settings.$themeable-priority-properties, $priority);
|
45
|
+
|
46
|
+
// 2.
|
47
|
+
@if $state == "disabled" {
|
48
|
+
@each $property in $properties {
|
49
|
+
--rui-local-#{$property}:
|
50
|
+
var(
|
51
|
+
--rui-Button--#{$priority}--#{$color}--#{$state}__#{$property},
|
52
|
+
var(--rui-Button--#{$priority}--#{$color}--default__#{$property})
|
53
|
+
);
|
54
|
+
}
|
55
|
+
} @else {
|
56
|
+
@each $property in $properties {
|
57
|
+
--rui-local-#{$property}: var(--rui-Button--#{$priority}--#{$color}--#{$state}__#{$property});
|
58
|
+
}
|
60
59
|
}
|
61
|
-
}
|
62
60
|
}
|
63
61
|
|
64
62
|
// 4.
|
65
63
|
@mixin _button-square() {
|
66
|
-
|
67
|
-
|
64
|
+
--rui-local-padding: 0;
|
65
|
+
--rui-local-width: var(--rui-local-height);
|
68
66
|
}
|
69
67
|
|
70
68
|
// 5.
|
71
69
|
@mixin _button-size-restore() {
|
72
|
-
|
73
|
-
|
70
|
+
--rui-local-padding: var(--rui-local-padding-original);
|
71
|
+
--rui-local-width: unset;
|
74
72
|
}
|
75
73
|
|
76
74
|
@mixin button() {
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
text-decoration: none;
|
91
|
-
text-transform: theme.$text-transform;
|
92
|
-
vertical-align: middle;
|
93
|
-
color: var(--rui-local-color);
|
94
|
-
border: theme.$border-width solid var(--rui-local-border-color, transparent);
|
95
|
-
border-radius: theme.$border-radius;
|
96
|
-
background: var(--rui-local-background, transparent);
|
97
|
-
box-shadow: var(--rui-local-box-shadow, none);
|
98
|
-
user-select: none;
|
99
|
-
cursor: pointer;
|
100
|
-
|
101
|
-
&:hover,
|
102
|
-
&:focus {
|
75
|
+
@include transition.add((opacity, color, border-color, background-color, box-shadow));
|
76
|
+
|
77
|
+
position: relative; // 3.
|
78
|
+
display: inline-flex;
|
79
|
+
column-gap: settings.$icon-spacing;
|
80
|
+
align-items: center;
|
81
|
+
justify-content: center;
|
82
|
+
width: var(--rui-local-width, auto);
|
83
|
+
min-height: var(--rui-local-height, auto);
|
84
|
+
padding: var(--rui-local-padding);
|
85
|
+
font: theme.$font-weight list.slash(var(--rui-local-font-size), settings.$line-height) settings.$font-family;
|
86
|
+
letter-spacing: theme.$letter-spacing;
|
87
|
+
text-align: center;
|
103
88
|
text-decoration: none;
|
104
|
-
|
89
|
+
text-transform: theme.$text-transform;
|
90
|
+
vertical-align: middle;
|
91
|
+
color: var(--rui-local-color);
|
92
|
+
border: theme.$border-width solid var(--rui-local-border-color, transparent);
|
93
|
+
border-radius: theme.$border-radius;
|
94
|
+
background: var(--rui-local-background, transparent);
|
95
|
+
box-shadow: var(--rui-local-box-shadow, none);
|
96
|
+
user-select: none;
|
97
|
+
cursor: pointer;
|
98
|
+
|
99
|
+
&:hover,
|
100
|
+
&:focus {
|
101
|
+
text-decoration: none;
|
102
|
+
}
|
105
103
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
104
|
+
&:disabled {
|
105
|
+
opacity: theme.$disabled-opacity;
|
106
|
+
cursor: theme.$disabled-cursor;
|
107
|
+
}
|
110
108
|
|
111
|
-
|
112
|
-
|
113
|
-
|
109
|
+
&:-moz-focusring {
|
110
|
+
outline: 0;
|
111
|
+
}
|
114
112
|
}
|
115
113
|
|
116
114
|
@mixin button-size($size) {
|
117
|
-
|
115
|
+
$properties: map.get(theme.$sizes, $size);
|
118
116
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
117
|
+
--rui-local-height: #{map.get($properties, height)};
|
118
|
+
--rui-local-padding: #{map.get($properties, padding-y)} #{map.get($properties, padding-x)};
|
119
|
+
--rui-local-padding-original: #{map.get($properties, padding-y)} #{map.get($properties, padding-x)}; // 5.
|
120
|
+
--rui-local-font-size: #{map.get($properties, font-size)};
|
123
121
|
}
|
124
122
|
|
125
123
|
@mixin button-color($priority, $color) {
|
126
|
-
|
124
|
+
@include _get-themeable-properties($priority, $color, default);
|
127
125
|
|
128
|
-
|
129
|
-
|
130
|
-
|
126
|
+
&:disabled {
|
127
|
+
@include _get-themeable-properties($priority, $color, disabled);
|
128
|
+
}
|
131
129
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
130
|
+
&:not(:disabled):hover,
|
131
|
+
&:not(:disabled):focus {
|
132
|
+
@include _get-themeable-properties($priority, $color, hover);
|
133
|
+
}
|
136
134
|
|
137
|
-
|
138
|
-
|
139
|
-
|
135
|
+
&:not(:disabled):active {
|
136
|
+
@include _get-themeable-properties($priority, $color, active);
|
137
|
+
}
|
140
138
|
}
|
141
139
|
|
142
140
|
@mixin hide-label() {
|
143
|
-
|
141
|
+
@include _button-square();
|
144
142
|
|
145
|
-
|
146
|
-
|
147
|
-
|
143
|
+
.label {
|
144
|
+
@include accessibility.hide-text();
|
145
|
+
}
|
148
146
|
}
|
149
147
|
|
150
148
|
@mixin show-label() {
|
151
|
-
|
149
|
+
@include _button-size-restore();
|
152
150
|
|
153
|
-
|
154
|
-
|
155
|
-
|
151
|
+
.label {
|
152
|
+
@include accessibility.unhide-text();
|
153
|
+
}
|
156
154
|
}
|
@@ -17,12 +17,12 @@ export default (labelVisibility, styles) => {
|
|
17
17
|
return styles.withLabelVisibleXl;
|
18
18
|
}
|
19
19
|
|
20
|
-
if (labelVisibility === '
|
21
|
-
return styles.
|
20
|
+
if (labelVisibility === 'x2l') {
|
21
|
+
return styles.withLabelVisibleX2l;
|
22
22
|
}
|
23
23
|
|
24
|
-
if (labelVisibility === '
|
25
|
-
return styles.
|
24
|
+
if (labelVisibility === 'x3l') {
|
25
|
+
return styles.withLabelVisibleX3l;
|
26
26
|
}
|
27
27
|
|
28
28
|
if (labelVisibility === 'none') {
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
|
-
import {
|
3
|
+
import { withGlobalProps } from '../../provider';
|
4
|
+
import { classNames } from '../../utils/classNames';
|
5
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
4
6
|
import styles from './ButtonGroup.scss';
|
5
7
|
import { ButtonGroupContext } from './ButtonGroupContext';
|
6
8
|
|
@@ -8,34 +10,44 @@ export const ButtonGroup = ({
|
|
8
10
|
block,
|
9
11
|
disabled,
|
10
12
|
children,
|
13
|
+
id,
|
11
14
|
priority,
|
12
15
|
size,
|
13
16
|
...restProps
|
14
|
-
}) =>
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
size,
|
29
|
-
}}
|
17
|
+
}) => {
|
18
|
+
if (isChildrenEmpty(children)) {
|
19
|
+
return null;
|
20
|
+
}
|
21
|
+
|
22
|
+
return (
|
23
|
+
<div
|
24
|
+
className={classNames(
|
25
|
+
styles.root,
|
26
|
+
block && styles.isRootBlock,
|
27
|
+
)}
|
28
|
+
id={id}
|
29
|
+
role="group"
|
30
|
+
{...restProps}
|
30
31
|
>
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
<ButtonGroupContext.Provider
|
33
|
+
value={{
|
34
|
+
block,
|
35
|
+
disabled,
|
36
|
+
priority,
|
37
|
+
size,
|
38
|
+
}}
|
39
|
+
>
|
40
|
+
{children}
|
41
|
+
</ButtonGroupContext.Provider>
|
42
|
+
</div>
|
43
|
+
);
|
44
|
+
};
|
35
45
|
|
36
46
|
ButtonGroup.defaultProps = {
|
37
47
|
block: false,
|
48
|
+
children: null,
|
38
49
|
disabled: false,
|
50
|
+
id: undefined,
|
39
51
|
priority: 'filled',
|
40
52
|
size: 'medium',
|
41
53
|
};
|
@@ -46,13 +58,17 @@ ButtonGroup.propTypes = {
|
|
46
58
|
*/
|
47
59
|
block: PropTypes.bool,
|
48
60
|
/**
|
49
|
-
* Buttons to be grouped.
|
61
|
+
* Buttons to be grouped. If none are provided nothing is rendered.
|
50
62
|
*/
|
51
|
-
children: PropTypes.node
|
63
|
+
children: PropTypes.node,
|
52
64
|
/**
|
53
65
|
* If `true`, all buttons inside the group will be disabled.
|
54
66
|
*/
|
55
67
|
disabled: PropTypes.bool,
|
68
|
+
/**
|
69
|
+
* ID of the root HTML element.
|
70
|
+
*/
|
71
|
+
id: PropTypes.string,
|
56
72
|
/**
|
57
73
|
* Visual priority to highlight or suppress the buttons.
|
58
74
|
*/
|
@@ -63,6 +79,6 @@ ButtonGroup.propTypes = {
|
|
63
79
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
64
80
|
};
|
65
81
|
|
66
|
-
export const
|
82
|
+
export const ButtonGroupWithGlobalProps = withGlobalProps(ButtonGroup, 'ButtonGroup');
|
67
83
|
|
68
|
-
export default
|
84
|
+
export default ButtonGroupWithGlobalProps;
|
@@ -221,7 +221,7 @@ and communicating the state of individual options.
|
|
221
221
|
<Playground>
|
222
222
|
<>
|
223
223
|
<span id="period-label">Period:</span>
|
224
|
-
<ButtonGroup aria-labelledby="
|
224
|
+
<ButtonGroup aria-labelledby="period-label">
|
225
225
|
<Button label="Week" aria-pressed color="dark" />
|
226
226
|
<Button label="Month" aria-pressed={false} />
|
227
227
|
<Button label="Year" aria-pressed={false} />
|