@react-ui-org/react-ui 0.44.1 → 0.45.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/lib.development.js +138 -258
- package/dist/lib.js +1 -1
- package/package.json +7 -10
- package/src/lib/components/Alert/Alert.jsx +4 -3
- package/src/lib/components/Alert/Alert.scss +48 -48
- package/src/lib/components/Alert/_settings.scss +4 -4
- package/src/lib/components/Alert/_theme.scss +50 -50
- package/src/lib/components/Alert/_tools.scss +6 -6
- package/src/lib/components/Badge/Badge.jsx +5 -4
- package/src/lib/components/Badge/Badge.scss +57 -57
- package/src/lib/components/Button/Button.jsx +10 -9
- package/src/lib/components/Button/Button.scss +2 -2
- package/src/lib/components/Button/README.mdx +6 -1
- package/src/lib/components/Button/_base.scss +65 -65
- package/src/lib/components/Button/_priorities.scss +49 -49
- package/src/lib/components/Button/_settings.scss +10 -10
- package/src/lib/components/Button/_theme.scss +18 -15
- package/src/lib/components/Button/_tools.scss +98 -100
- package/src/lib/components/ButtonGroup/ButtonGroup.jsx +4 -3
- package/src/lib/components/ButtonGroup/ButtonGroup.scss +3 -3
- package/src/lib/components/Card/Card.jsx +7 -6
- package/src/lib/components/Card/Card.scss +28 -28
- package/src/lib/components/Card/_theme.scss +50 -50
- package/src/lib/components/Card/_tools.scss +6 -6
- package/src/lib/components/CheckboxField/CheckboxField.jsx +12 -11
- package/src/lib/components/CheckboxField/CheckboxField.scss +20 -20
- package/src/lib/components/FileInputField/FileInputField.jsx +13 -12
- package/src/lib/components/FileInputField/FileInputField.scss +19 -19
- package/src/lib/components/FormLayout/FormLayout.jsx +5 -4
- package/src/lib/components/FormLayout/FormLayout.scss +17 -17
- package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +9 -8
- package/src/lib/components/FormLayout/FormLayoutCustomField.scss +18 -18
- package/src/lib/components/FormLayout/README.mdx +16 -36
- package/src/lib/components/Grid/Grid.jsx +1 -1
- package/src/lib/components/Grid/Grid.scss +28 -30
- package/src/lib/components/Grid/GridSpan.jsx +1 -1
- package/src/lib/components/Grid/{helpers → _helpers}/generateResponsiveCustomProperties.js +0 -2
- package/src/lib/components/Grid/_theme.scss +9 -9
- package/src/lib/components/Grid/_tools.scss +20 -20
- package/src/lib/components/Link/Link.jsx +1 -1
- package/src/lib/components/Link/Link.scss +7 -7
- package/src/lib/components/List/List.jsx +11 -10
- package/src/lib/components/List/List.scss +21 -21
- package/src/lib/components/Media/Media.scss +6 -6
- package/src/lib/components/Modal/Modal.jsx +6 -5
- package/src/lib/components/Modal/Modal.scss +73 -73
- package/src/lib/components/Modal/_settings.scss +5 -5
- package/src/lib/components/Modal/_theme.scss +17 -17
- package/src/lib/components/Paper/Paper.jsx +5 -4
- package/src/lib/components/Paper/Paper.scss +8 -8
- package/src/lib/components/Radio/Radio.jsx +12 -11
- package/src/lib/components/Radio/Radio.scss +26 -26
- package/src/lib/components/ScrollView/ScrollView.jsx +9 -8
- package/src/lib/components/ScrollView/ScrollView.scss +113 -113
- package/src/lib/{services/elementPositionService.js → components/ScrollView/_helpers/getElementsPositionDifference.js} +0 -2
- package/src/lib/{hooks → components/ScrollView/_hooks}/useLoadResizeHook.js +1 -1
- package/src/lib/{hooks → components/ScrollView/_hooks}/useScrollPositionHook.js +1 -1
- package/src/lib/components/SelectField/SelectField.jsx +14 -13
- package/src/lib/components/SelectField/SelectField.scss +30 -30
- package/src/lib/components/Table/Table.scss +28 -35
- package/src/lib/components/Table/_settings.scss +5 -5
- package/src/lib/components/Tabs/Tabs.scss +21 -21
- package/src/lib/components/Tabs/TabsItem.jsx +4 -3
- package/src/lib/components/Tabs/TabsItem.scss +78 -78
- package/src/lib/components/Text/Text.jsx +5 -4
- package/src/lib/components/Text/Text.scss +12 -12
- package/src/lib/components/Text/{helpers → _helpers}/getRootHyphensClassName.js +1 -1
- package/src/lib/components/Text/{helpers → _helpers}/getRootWordWrappingClassName.js +1 -1
- package/src/lib/components/TextArea/TextArea.jsx +14 -13
- package/src/lib/components/TextArea/TextArea.scss +27 -27
- package/src/lib/components/TextField/TextField.jsx +16 -15
- package/src/lib/components/TextField/TextField.scss +28 -28
- package/src/lib/components/Toggle/Toggle.jsx +12 -11
- package/src/lib/components/Toggle/Toggle.scss +20 -20
- package/src/lib/components/Toolbar/Toolbar.jsx +5 -4
- package/src/lib/components/Toolbar/Toolbar.scss +25 -25
- package/src/lib/components/Toolbar/ToolbarGroup.jsx +5 -4
- package/src/lib/{helpers → components/_helpers}/getRootColorClassName.js +1 -1
- package/src/lib/{helpers → components/_helpers}/getRootSizeClassName.js +1 -1
- package/src/lib/{helpers → components/_helpers}/getRootValidationStateClassName.js +1 -1
- package/src/lib/{helpers → components/_helpers}/resolveContextOrProp.js +0 -0
- package/src/lib/{utils → components/_helpers}/transferProps.js +1 -1
- package/src/lib/foundation.scss +11 -11
- package/src/lib/helpers.scss +2 -2
- package/src/lib/index.js +3 -7
- package/src/lib/styles/_utilities.scss +13 -13
- package/src/lib/styles/elements/_code.scss +7 -7
- package/src/lib/styles/elements/_links.scss +8 -8
- package/src/lib/styles/elements/_lists.scss +3 -3
- package/src/lib/styles/elements/_page.scss +14 -14
- package/src/lib/styles/elements/_rulers.scss +6 -6
- package/src/lib/styles/elements/_small.scss +2 -2
- package/src/lib/styles/generic/_box-sizing.scss +3 -2
- package/src/lib/styles/generic/_forms.scss +3 -3
- package/src/lib/styles/generic/_reset.scss +6 -6
- package/src/lib/styles/generic/_shared.scss +3 -3
- package/src/lib/styles/helpers/_animation.scss +8 -8
- package/src/lib/styles/settings/_breakpoints.scss +7 -7
- package/src/lib/styles/settings/_escaped-characters.scss +5 -5
- package/src/lib/styles/settings/_form-fields.scss +24 -24
- package/src/lib/styles/settings/_utilities.scss +112 -100
- package/src/lib/styles/theme/_colors.scss +50 -50
- package/src/lib/styles/theme/_form-fields.scss +32 -32
- package/src/lib/styles/theme/_spacing.scss +11 -11
- package/src/lib/styles/theme/_typography.scss +12 -11
- package/src/lib/styles/theme-constants/_breakpoints.scss +2 -2
- package/src/lib/styles/theme-constants/_colors.scss +2 -2
- package/src/lib/styles/theme-constants/_svg.scss +1 -2
- package/src/lib/styles/tools/_accessibility.scss +29 -29
- package/src/lib/styles/tools/_breakpoint.scss +11 -14
- package/src/lib/styles/tools/_caret.scss +8 -8
- package/src/lib/styles/tools/_colors.scss +3 -3
- package/src/lib/styles/tools/_reset.scss +21 -21
- package/src/lib/styles/tools/_scrollbar.scss +4 -4
- package/src/lib/styles/tools/_spacing.scss +17 -21
- package/src/lib/styles/tools/_string.scss +9 -9
- package/src/lib/styles/tools/_svg.scss +13 -16
- package/src/lib/styles/tools/_transition.scss +42 -44
- package/src/lib/styles/tools/_utilities.scss +19 -19
- package/src/lib/styles/tools/form-fields/_box-field-elements.scss +88 -88
- package/src/lib/styles/tools/form-fields/_box-field-layout.scss +144 -144
- package/src/lib/styles/tools/form-fields/_box-field-sizes.scss +13 -15
- package/src/lib/styles/tools/form-fields/_foundation.scss +12 -12
- package/src/lib/styles/tools/form-fields/_inline-field-elements.scss +71 -71
- package/src/lib/styles/tools/form-fields/_inline-field-layout.scss +44 -44
- package/src/lib/styles/tools/form-fields/_variants.scss +104 -106
- package/src/lib/theme.scss +958 -954
- package/src/lib/utils/classNames.js +8 -0
- package/src/lib/components/CTA/CTA.jsx +0 -60
- package/src/lib/components/CTA/CTA.scss +0 -71
- package/src/lib/components/CTA/CTACenter.jsx +0 -27
- package/src/lib/components/CTA/CTAEnd.jsx +0 -27
- package/src/lib/components/CTA/CTAStart.jsx +0 -27
- package/src/lib/components/CTA/README.mdx +0 -119
- package/src/lib/components/CTA/index.js +0 -4
- package/src/lib/components/Center/Center.jsx +0 -27
- package/src/lib/components/Center/Center.scss +0 -7
- package/src/lib/components/Center/README.mdx +0 -52
- package/src/lib/components/Center/index.js +0 -1
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-ui-org/react-ui",
|
3
3
|
"description": "React UI is a themeable UI library for React apps.",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.45.0",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
7
7
|
"ui",
|
@@ -49,9 +49,8 @@
|
|
49
49
|
"@testing-library/react": "^12.1.2",
|
50
50
|
"@testing-library/user-event": "^13.5.0",
|
51
51
|
"@visionappscz/eslint-config-visionapps": "^1.5.0",
|
52
|
-
"@visionappscz/stylelint-config
|
53
|
-
"
|
54
|
-
"autoprefixer": "^10.4.0",
|
52
|
+
"@visionappscz/stylelint-config": "^3.0.0-rc1",
|
53
|
+
"autoprefixer": "^10.4.2",
|
55
54
|
"babel-core": "^7.0.0-bridge.0",
|
56
55
|
"babel-jest": "^27.3.1",
|
57
56
|
"babel-loader": "^8.2.3",
|
@@ -73,20 +72,18 @@
|
|
73
72
|
"jest": "^27.3.1",
|
74
73
|
"markdownlint-cli2": "~0.3.2",
|
75
74
|
"nodemon": "^2.0.15",
|
76
|
-
"postcss": "^8.
|
75
|
+
"postcss": "^8.4.5",
|
77
76
|
"postcss-loader": "^4.3.0",
|
78
77
|
"prism-react-renderer": "^1.2.1",
|
79
78
|
"prop-types": "^15.7.2",
|
80
79
|
"react": "^17.0.2",
|
81
80
|
"react-dom": "^17.0.2",
|
82
81
|
"rimraf": "^3.0.2",
|
83
|
-
"sass": "^1.
|
82
|
+
"sass": "^1.47.0",
|
84
83
|
"sass-loader": "^10.2.0",
|
85
84
|
"sinon": "^12.0.1",
|
86
85
|
"style-loader": "^2.0.0",
|
87
|
-
"stylelint": "^
|
88
|
-
"stylelint-config-css-modules": "^2.3.0",
|
89
|
-
"stylelint-order": "^5.0.0",
|
86
|
+
"stylelint": "^14.2.0",
|
90
87
|
"stylelint-webpack-plugin": "^3.1.0",
|
91
88
|
"webpack": "^4.46.0",
|
92
89
|
"webpack-cli": "^3.3.12",
|
@@ -108,7 +105,7 @@
|
|
108
105
|
"lib:build": "concurrently \"webpack --mode development --config webpack.config.js\" \"webpack --mode production --config webpack.config.js\"",
|
109
106
|
"lib:jest": "jest",
|
110
107
|
"lib:test:js": "concurrently \"eslint --ext js,jsx src/lib tests/propTests\" \"npm run lib:jest\"",
|
111
|
-
"lib:test:css": "stylelint \"src
|
108
|
+
"lib:test:css": "stylelint \"src/**/*.scss\" --config stylelint.config.js",
|
112
109
|
"markdown:lint": "markdownlint-cli2 \"**/*.md?(x)\" \"#.docz\" \"#dist\" \"#node_modules\" && eslint \"**/*.md?(x)\"",
|
113
110
|
"markdown:watch": "nodemon --watch . --ext md,mdx --exec \"npm run markdown:lint\"",
|
114
111
|
"prepublishOnly": "npm run lib:build",
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
|
-
import getRootColorClassName from '../../helpers/getRootColorClassName';
|
4
3
|
import { withProviderContext } from '../../provider';
|
4
|
+
import { classNames } from '../../utils/classNames';
|
5
|
+
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
|
5
6
|
import styles from './Alert.scss';
|
6
7
|
|
7
8
|
export const Alert = ({
|
@@ -13,10 +14,10 @@ export const Alert = ({
|
|
13
14
|
translations,
|
14
15
|
}) => (
|
15
16
|
<div
|
16
|
-
className={
|
17
|
+
className={classNames(
|
17
18
|
styles.root,
|
18
19
|
getRootColorClassName(color, styles),
|
19
|
-
|
20
|
+
)}
|
20
21
|
id={id}
|
21
22
|
role="alert"
|
22
23
|
>
|
@@ -1,106 +1,106 @@
|
|
1
|
-
@use
|
2
|
-
@use
|
3
|
-
@use
|
4
|
-
@use
|
5
|
-
@use
|
6
|
-
@use
|
7
|
-
@use
|
1
|
+
@use "sass:map";
|
2
|
+
@use "../../styles/theme/typography";
|
3
|
+
@use "../../styles/tools/accessibility";
|
4
|
+
@use "../../styles/tools/reset";
|
5
|
+
@use "settings";
|
6
|
+
@use "theme";
|
7
|
+
@use "tools";
|
8
8
|
|
9
9
|
.root {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
10
|
+
position: relative;
|
11
|
+
display: flex;
|
12
|
+
align-items: flex-start;
|
13
|
+
width: 100%;
|
14
|
+
color: var(--rui-local-color);
|
15
|
+
border-width: theme.$border-width theme.$border-width theme.$border-width theme.$stripe-width;
|
16
|
+
border-style: solid;
|
17
|
+
border-color: var(--rui-local-foreground-color);
|
18
|
+
border-radius: theme.$border-radius;
|
19
|
+
background-color: var(--rui-local-background-color);
|
20
20
|
}
|
21
21
|
|
22
22
|
.icon,
|
23
23
|
.message {
|
24
|
-
|
24
|
+
padding: theme.$padding;
|
25
25
|
}
|
26
26
|
|
27
27
|
.close,
|
28
28
|
.icon {
|
29
|
-
|
30
|
-
|
29
|
+
height: settings.$min-height;
|
30
|
+
color: var(--rui-local-foreground-color);
|
31
31
|
}
|
32
32
|
|
33
33
|
.icon {
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
display: flex;
|
35
|
+
flex: none;
|
36
|
+
align-items: center;
|
37
|
+
justify-content: center;
|
38
|
+
padding-right: 0;
|
39
39
|
}
|
40
40
|
|
41
41
|
.message {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
flex-grow: 1;
|
43
|
+
font-weight: theme.$font-weight;
|
44
|
+
font-size: settings.$font-size;
|
45
|
+
line-height: settings.$line-height;
|
46
46
|
}
|
47
47
|
|
48
48
|
.message a,
|
49
49
|
.message strong {
|
50
|
-
|
51
|
-
|
50
|
+
font-weight: theme.$emphasis-font-weight;
|
51
|
+
color: var(--rui-local-foreground-color);
|
52
52
|
}
|
53
53
|
|
54
54
|
.close {
|
55
|
-
|
56
|
-
|
55
|
+
@include reset.button();
|
56
|
+
@include accessibility.min-tap-target();
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
padding: theme.$padding;
|
59
|
+
font-size: map.get(typography.$size-values, 3);
|
60
|
+
line-height: 1;
|
61
61
|
}
|
62
62
|
|
63
63
|
.closeSign {
|
64
|
-
|
65
|
-
|
64
|
+
position: relative;
|
65
|
+
top: -0.1em;
|
66
66
|
}
|
67
67
|
|
68
68
|
.rootColorPrimary {
|
69
|
-
|
69
|
+
@include tools.color(primary);
|
70
70
|
}
|
71
71
|
|
72
72
|
.rootColorSecondary {
|
73
|
-
|
73
|
+
@include tools.color(secondary);
|
74
74
|
}
|
75
75
|
|
76
76
|
.rootColorSuccess {
|
77
|
-
|
77
|
+
@include tools.color(success);
|
78
78
|
}
|
79
79
|
|
80
80
|
.rootColorWarning {
|
81
|
-
|
81
|
+
@include tools.color(warning);
|
82
82
|
}
|
83
83
|
|
84
84
|
.rootColorDanger {
|
85
|
-
|
85
|
+
@include tools.color(danger);
|
86
86
|
}
|
87
87
|
|
88
88
|
.rootColorHelp {
|
89
|
-
|
89
|
+
@include tools.color(help);
|
90
90
|
}
|
91
91
|
|
92
92
|
.rootColorInfo {
|
93
|
-
|
93
|
+
@include tools.color(info);
|
94
94
|
}
|
95
95
|
|
96
96
|
.rootColorNote {
|
97
|
-
|
97
|
+
@include tools.color(note);
|
98
98
|
}
|
99
99
|
|
100
100
|
.rootColorLight {
|
101
|
-
|
101
|
+
@include tools.color(light);
|
102
102
|
}
|
103
103
|
|
104
104
|
.rootColorDark {
|
105
|
-
|
105
|
+
@include tools.color(dark);
|
106
106
|
}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
@use
|
2
|
-
@use
|
3
|
-
@use
|
1
|
+
@use "sass:map";
|
2
|
+
@use "../../styles/theme/typography";
|
3
|
+
@use "theme";
|
4
4
|
|
5
5
|
$font-size: map.get(typography.$size-values, 0);
|
6
|
-
$line-height:
|
6
|
+
$line-height: typography.$line-height-base;
|
7
7
|
$min-height: calc(#{$font-size} * #{$line-height} + 2 * #{theme.$padding});
|
@@ -6,54 +6,54 @@ $emphasis-font-weight: var(--rui-Alert__emphasis__font-weight);
|
|
6
6
|
$stripe-width: var(--rui-Alert__stripe__width);
|
7
7
|
|
8
8
|
$colors: (
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
9
|
+
primary: (
|
10
|
+
color: var(--rui-Alert--primary__color),
|
11
|
+
foreground-color: var(--rui-Alert--primary__foreground-color),
|
12
|
+
background-color: var(--rui-Alert--primary__background-color),
|
13
|
+
),
|
14
|
+
secondary: (
|
15
|
+
color: var(--rui-Alert--secondary__color),
|
16
|
+
foreground-color: var(--rui-Alert--secondary__foreground-color),
|
17
|
+
background-color: var(--rui-Alert--secondary__background-color),
|
18
|
+
),
|
19
|
+
success: (
|
20
|
+
color: var(--rui-Alert--success__color),
|
21
|
+
foreground-color: var(--rui-Alert--success__foreground-color),
|
22
|
+
background-color: var(--rui-Alert--success__background-color),
|
23
|
+
),
|
24
|
+
warning: (
|
25
|
+
color: var(--rui-Alert--warning__color),
|
26
|
+
foreground-color: var(--rui-Alert--warning__foreground-color),
|
27
|
+
background-color: var(--rui-Alert--warning__background-color),
|
28
|
+
),
|
29
|
+
danger: (
|
30
|
+
color: var(--rui-Alert--danger__color),
|
31
|
+
foreground-color: var(--rui-Alert--danger__foreground-color),
|
32
|
+
background-color: var(--rui-Alert--danger__background-color),
|
33
|
+
),
|
34
|
+
info: (
|
35
|
+
color: var(--rui-Alert--info__color),
|
36
|
+
foreground-color: var(--rui-Alert--info__foreground-color),
|
37
|
+
background-color: var(--rui-Alert--info__background-color),
|
38
|
+
),
|
39
|
+
help: (
|
40
|
+
color: var(--rui-Alert--help__color),
|
41
|
+
foreground-color: var(--rui-Alert--help__foreground-color),
|
42
|
+
background-color: var(--rui-Alert--help__background-color),
|
43
|
+
),
|
44
|
+
note: (
|
45
|
+
color: var(--rui-Alert--note__color),
|
46
|
+
foreground-color: var(--rui-Alert--note__foreground-color),
|
47
|
+
background-color: var(--rui-Alert--note__background-color),
|
48
|
+
),
|
49
|
+
light: (
|
50
|
+
color: var(--rui-Alert--light__color),
|
51
|
+
foreground-color: var(--rui-Alert--light__foreground-color),
|
52
|
+
background-color: var(--rui-Alert--light__background-color),
|
53
|
+
),
|
54
|
+
dark: (
|
55
|
+
color: var(--rui-Alert--dark__color),
|
56
|
+
foreground-color: var(--rui-Alert--dark__foreground-color),
|
57
|
+
background-color: var(--rui-Alert--dark__background-color),
|
58
|
+
),
|
59
59
|
);
|
@@ -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-foreground-color: #{map.get($color-variant-properties, foreground-color)};
|
9
|
+
--rui-local-background-color: #{map.get($color-variant-properties, background-color)};
|
10
10
|
}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
|
-
import getRootColorClassName from '../../helpers/getRootColorClassName';
|
4
3
|
import { withProviderContext } from '../../provider';
|
4
|
+
import { classNames } from '../../utils/classNames';
|
5
|
+
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
|
5
6
|
import styles from './Badge.scss';
|
6
7
|
|
7
8
|
export const Badge = ({
|
@@ -11,11 +12,11 @@ export const Badge = ({
|
|
11
12
|
priority,
|
12
13
|
}) => (
|
13
14
|
<div
|
14
|
-
className={
|
15
|
+
className={classNames(
|
15
16
|
styles.root,
|
16
|
-
priority === 'outline'
|
17
|
+
priority === 'outline' && styles.rootPriorityOutline,
|
17
18
|
getRootColorClassName(color, styles),
|
18
|
-
|
19
|
+
)}
|
19
20
|
id={id}
|
20
21
|
>
|
21
22
|
{label}
|
@@ -1,126 +1,126 @@
|
|
1
|
-
@use
|
2
|
-
@use
|
3
|
-
@use
|
4
|
-
@use
|
5
|
-
@use
|
1
|
+
@use "sass:map";
|
2
|
+
@use "sass:math";
|
3
|
+
@use "../../styles/theme/borders";
|
4
|
+
@use "../../styles/theme/colors";
|
5
|
+
@use "../../styles/theme/typography";
|
6
6
|
|
7
7
|
$_badge-size: 1.25rem;
|
8
8
|
|
9
9
|
.root {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
10
|
+
display: inline-block;
|
11
|
+
min-width: $_badge-size;
|
12
|
+
height: $_badge-size;
|
13
|
+
padding: 0.25rem 0.35rem;
|
14
|
+
overflow: hidden;
|
15
|
+
font-weight: map.get(typography.$font-weight-values, bold);
|
16
|
+
font-size: typography.$size-smaller;
|
17
|
+
line-height: 1;
|
18
|
+
text-align: center;
|
19
|
+
white-space: nowrap;
|
20
|
+
vertical-align: baseline;
|
21
|
+
color: var(--rui-local-color);
|
22
|
+
border-radius: math.div($_badge-size, 2);
|
23
|
+
background-color: var(--rui-local-background-color);
|
24
|
+
box-shadow: var(--rui-local-box-shadow, #{0 0 0 2px rgb(255 255 255 / 80%)});
|
25
25
|
}
|
26
26
|
|
27
27
|
.rootColorPrimary {
|
28
|
-
|
29
|
-
|
28
|
+
--rui-local-color: #{map.get(colors.$brand, on-primary)};
|
29
|
+
--rui-local-background-color: #{map.get(colors.$brand, primary)};
|
30
30
|
}
|
31
31
|
|
32
32
|
.rootColorSecondary {
|
33
|
-
|
34
|
-
|
33
|
+
--rui-local-color: #{map.get(colors.$brand, on-secondary)};
|
34
|
+
--rui-local-background-color: #{map.get(colors.$brand, secondary)};
|
35
35
|
}
|
36
36
|
|
37
37
|
.rootColorSuccess {
|
38
|
-
|
39
|
-
|
38
|
+
--rui-local-color: #{map.get(colors.$ui, on-success)};
|
39
|
+
--rui-local-background-color: #{map.get(colors.$ui, success)};
|
40
40
|
}
|
41
41
|
|
42
42
|
.rootColorWarning {
|
43
|
-
|
44
|
-
|
43
|
+
--rui-local-color: #{map.get(colors.$ui, on-warning)};
|
44
|
+
--rui-local-background-color: #{map.get(colors.$ui, warning)};
|
45
45
|
}
|
46
46
|
|
47
47
|
.rootColorDanger {
|
48
|
-
|
49
|
-
|
48
|
+
--rui-local-color: #{map.get(colors.$ui, on-danger)};
|
49
|
+
--rui-local-background-color: #{map.get(colors.$ui, danger)};
|
50
50
|
}
|
51
51
|
|
52
52
|
.rootColorHelp {
|
53
|
-
|
54
|
-
|
53
|
+
--rui-local-color: #{map.get(colors.$ui, on-help)};
|
54
|
+
--rui-local-background-color: #{map.get(colors.$ui, help)};
|
55
55
|
}
|
56
56
|
|
57
57
|
.rootColorInfo {
|
58
|
-
|
59
|
-
|
58
|
+
--rui-local-color: #{map.get(colors.$ui, on-info)};
|
59
|
+
--rui-local-background-color: #{map.get(colors.$ui, info)};
|
60
60
|
}
|
61
61
|
|
62
62
|
.rootColorNote {
|
63
|
-
|
64
|
-
|
63
|
+
--rui-local-color: #{map.get(colors.$ui, on-note)};
|
64
|
+
--rui-local-background-color: #{map.get(colors.$ui, note)};
|
65
65
|
}
|
66
66
|
|
67
67
|
.rootColorLight {
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
--rui-local-color: #{colors.$dark};
|
69
|
+
--rui-local-background-color: #{colors.$light};
|
70
|
+
--rui-local-box-shadow: none;
|
71
71
|
}
|
72
72
|
|
73
73
|
.rootColorDark {
|
74
|
-
|
75
|
-
|
76
|
-
|
74
|
+
--rui-local-color: #{colors.$light};
|
75
|
+
--rui-local-background-color: #{colors.$dark};
|
76
|
+
--rui-local-box-shadow: none;
|
77
77
|
}
|
78
78
|
|
79
79
|
.rootPriorityOutline {
|
80
|
-
|
81
|
-
|
80
|
+
--rui-local-background-color: transparent;
|
81
|
+
--rui-local-box-shadow: none;
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
padding-top: 0.1875rem;
|
84
|
+
padding-bottom: 0.1875rem;
|
85
|
+
border: borders.$width solid currentColor;
|
86
86
|
}
|
87
87
|
|
88
88
|
.rootPriorityOutline.rootColorPrimary {
|
89
|
-
|
89
|
+
--rui-local-color: #{map.get(colors.$brand, primary)};
|
90
90
|
}
|
91
91
|
|
92
92
|
.rootPriorityOutline.rootColorSecondary {
|
93
|
-
|
93
|
+
--rui-local-color: #{map.get(colors.$brand, secondary)};
|
94
94
|
}
|
95
95
|
|
96
96
|
.rootPriorityOutline.rootColorSuccess {
|
97
|
-
|
97
|
+
--rui-local-color: #{map.get(colors.$ui, success)};
|
98
98
|
}
|
99
99
|
|
100
100
|
.rootPriorityOutline.rootColorWarning {
|
101
|
-
|
101
|
+
--rui-local-color: #{map.get(colors.$ui, warning)};
|
102
102
|
}
|
103
103
|
|
104
104
|
.rootPriorityOutline.rootColorDanger {
|
105
|
-
|
105
|
+
--rui-local-color: #{map.get(colors.$ui, danger)};
|
106
106
|
}
|
107
107
|
|
108
108
|
.rootPriorityOutline.rootColorHelp {
|
109
|
-
|
109
|
+
--rui-local-color: #{map.get(colors.$ui, help)};
|
110
110
|
}
|
111
111
|
|
112
112
|
.rootPriorityOutline.rootColorInfo {
|
113
|
-
|
113
|
+
--rui-local-color: #{map.get(colors.$ui, info)};
|
114
114
|
}
|
115
115
|
|
116
116
|
.rootPriorityOutline.rootColorNote {
|
117
|
-
|
117
|
+
--rui-local-color: #{map.get(colors.$ui, note)};
|
118
118
|
}
|
119
119
|
|
120
120
|
.rootPriorityOutline.rootColorLight {
|
121
|
-
|
121
|
+
--rui-local-color: #{colors.$light};
|
122
122
|
}
|
123
123
|
|
124
124
|
.rootPriorityOutline.rootColorDark {
|
125
|
-
|
125
|
+
--rui-local-color: #{colors.$dark};
|
126
126
|
}
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React, { useContext } from 'react';
|
3
|
-
import getRootSizeClassName from '../../helpers/getRootSizeClassName';
|
4
|
-
import getRootColorClassName from '../../helpers/getRootColorClassName';
|
5
|
-
import { resolveContextOrProp } from '../../helpers/resolveContextOrProp';
|
6
3
|
import { withProviderContext } from '../../provider';
|
7
|
-
import
|
4
|
+
import { classNames } from '../../utils/classNames';
|
5
|
+
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
|
6
|
+
import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
|
7
|
+
import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
|
8
|
+
import { transferProps } from '../_helpers/transferProps';
|
8
9
|
import withForwardedRef from '../withForwardedRef';
|
9
10
|
import { ButtonGroupContext } from '../ButtonGroup';
|
10
11
|
import getRootLabelVisibilityClassName from './helpers/getRootLabelVisibilityClassName';
|
@@ -36,7 +37,7 @@ export const Button = ({
|
|
36
37
|
/* eslint-disable react/button-has-type */
|
37
38
|
<button
|
38
39
|
{...transferProps(restProps)}
|
39
|
-
className={
|
40
|
+
className={classNames(
|
40
41
|
styles.root,
|
41
42
|
getRootPriorityClassName(
|
42
43
|
resolveContextOrProp(context && context.priority, priority),
|
@@ -48,10 +49,10 @@ export const Button = ({
|
|
48
49
|
styles,
|
49
50
|
),
|
50
51
|
getRootLabelVisibilityClassName(labelVisibility, styles),
|
51
|
-
resolveContextOrProp(context && context.block, block)
|
52
|
-
context
|
53
|
-
feedbackIcon
|
54
|
-
|
52
|
+
resolveContextOrProp(context && context.block, block) && styles.rootBlock,
|
53
|
+
context && styles.rootGrouped,
|
54
|
+
feedbackIcon && styles.hasRootFeedback,
|
55
|
+
)}
|
55
56
|
disabled={resolveContextOrProp(context && context.disabled, disabled) || !!feedbackIcon}
|
56
57
|
id={id}
|
57
58
|
ref={forwardedRef}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
@use
|
2
|
-
@use
|
1
|
+
@use "base";
|
2
|
+
@use "priorities";
|
@@ -448,7 +448,11 @@ Where:
|
|
448
448
|
|
449
449
|
- `<SIZE>` is one of `small`, `medium`, or `large` (see [Sizes](#sizes) and
|
450
450
|
[API](#api))
|
451
|
-
- `<PROPERTY>` is one of `height`, `padding-x`, or `font-size`
|
451
|
+
- `<PROPERTY>` is one of `height`, `padding-x`, `padding-y`, or `font-size`
|
452
|
+
|
453
|
+
👉 Button sizes are linked to
|
454
|
+
[box field sizes](/customize/theming/forms#box-field-sizes) sizes so they align
|
455
|
+
nicely when placed in row.
|
452
456
|
|
453
457
|
### Example Theme
|
454
458
|
|
@@ -464,6 +468,7 @@ Where:
|
|
464
468
|
0.1em 0.1em 0.5em rgba(0, 0, 0, 0.3);
|
465
469
|
--rui-Button--medium__height: 3rem;
|
466
470
|
--rui-Button--medium__padding-x: 1.25rem;
|
471
|
+
--rui-Button--medium__padding-y: 0.25rem;
|
467
472
|
}
|
468
473
|
`}
|
469
474
|
</style>
|