@react-ui-org/react-ui 0.53.0 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/react-ui.css +36 -38
- package/dist/react-ui.development.css +10800 -0
- package/dist/react-ui.development.js +1568 -0
- package/dist/react-ui.js +1 -1
- package/package.json +7 -4
- package/src/components/Alert/Alert.jsx +1 -1
- package/src/components/Alert/Alert.module.scss +100 -0
- package/src/components/Alert/README.md +9 -7
- package/src/components/Badge/Badge.jsx +1 -1
- package/src/components/Badge/Badge.module.scss +109 -0
- package/src/components/Badge/README.md +9 -7
- package/src/components/Button/Button.jsx +1 -1
- package/src/components/Button/README.md +9 -7
- package/src/components/Button/_base.scss +117 -115
- package/src/components/Button/_priorities.scss +135 -133
- package/src/components/ButtonGroup/ButtonGroup.jsx +1 -1
- package/src/components/ButtonGroup/ButtonGroup.module.scss +35 -0
- package/src/components/ButtonGroup/README.md +10 -8
- package/src/components/Card/Card.jsx +1 -1
- package/src/components/Card/Card.module.scss +72 -0
- package/src/components/Card/CardBody.jsx +1 -1
- package/src/components/Card/CardFooter.jsx +1 -1
- package/src/components/Card/README.md +9 -7
- package/src/components/CheckboxField/CheckboxField.jsx +1 -1
- package/src/components/CheckboxField/CheckboxField.module.scss +63 -0
- package/src/components/CheckboxField/README.md +10 -8
- package/src/components/FileInputField/FileInputField.jsx +1 -1
- package/src/components/FileInputField/FileInputField.module.scss +65 -0
- package/src/components/FileInputField/README.md +10 -8
- package/src/components/FormLayout/FormLayout.jsx +1 -1
- package/src/components/FormLayout/{FormLayout.scss → FormLayout.module.scss} +30 -28
- package/src/components/FormLayout/FormLayoutCustomField.jsx +1 -1
- package/src/components/FormLayout/FormLayoutCustomField.module.scss +65 -0
- package/src/components/FormLayout/README.md +11 -9
- package/src/components/Grid/Grid.jsx +1 -1
- package/src/components/Grid/Grid.module.scss +66 -0
- package/src/components/Grid/GridSpan.jsx +1 -1
- package/src/components/Grid/README.md +11 -8
- package/src/components/InputGroup/InputGroup.jsx +9 -1
- package/src/components/InputGroup/InputGroup.module.scss +93 -0
- package/src/components/InputGroup/README.md +27 -10
- package/src/components/Modal/Modal.jsx +1 -1
- package/src/components/Modal/Modal.module.scss +80 -0
- package/src/components/Modal/ModalBody.jsx +1 -1
- package/src/components/Modal/ModalBody.module.scss +20 -0
- package/src/components/Modal/ModalCloseButton.jsx +1 -1
- package/src/components/Modal/ModalCloseButton.module.scss +20 -0
- package/src/components/Modal/ModalContent.jsx +1 -1
- package/src/components/Modal/ModalContent.module.scss +7 -0
- package/src/components/Modal/ModalFooter.jsx +1 -1
- package/src/components/Modal/ModalFooter.module.scss +37 -0
- package/src/components/Modal/ModalHeader.jsx +1 -1
- package/src/components/Modal/ModalHeader.module.scss +32 -0
- package/src/components/Modal/ModalTitle.jsx +1 -1
- package/src/components/Modal/ModalTitle.module.scss +12 -0
- package/src/components/Modal/README.md +17 -14
- package/src/components/Paper/Paper.jsx +1 -1
- package/src/components/Paper/Paper.module.scss +19 -0
- package/src/components/Paper/README.md +9 -7
- package/src/components/Popover/Popover.jsx +1 -1
- package/src/components/Popover/Popover.module.scss +238 -0
- package/src/components/Popover/PopoverWrapper.jsx +1 -2
- package/src/components/Popover/PopoverWrapper.module.scss +5 -0
- package/src/components/Popover/README.md +9 -7
- package/src/components/Radio/README.md +12 -10
- package/src/components/Radio/Radio.jsx +1 -1
- package/src/components/Radio/Radio.module.scss +85 -0
- package/src/components/ScrollView/README.md +10 -8
- package/src/components/ScrollView/ScrollView.jsx +1 -1
- package/src/components/ScrollView/ScrollView.module.scss +233 -0
- package/src/components/SelectField/README.md +10 -8
- package/src/components/SelectField/SelectField.jsx +1 -1
- package/src/components/SelectField/SelectField.module.scss +111 -0
- package/src/components/Table/README.md +10 -8
- package/src/components/Table/Table.jsx +1 -1
- package/src/components/Table/Table.module.scss +30 -0
- package/src/components/Table/_components/TableBodyCell/TableBodyCell.jsx +1 -1
- package/src/components/Table/_components/TableCell.module.scss +28 -0
- package/src/components/Table/_components/TableHeaderCell/TableHeaderCell.jsx +1 -1
- package/src/components/Tabs/README.md +16 -10
- package/src/components/Tabs/Tabs.jsx +1 -1
- package/src/components/Tabs/Tabs.module.scss +31 -0
- package/src/components/Tabs/TabsItem.jsx +1 -1
- package/src/components/Tabs/TabsItem.module.scss +119 -0
- package/src/components/Text/README.md +15 -9
- package/src/components/Text/Text.jsx +1 -1
- package/src/components/Text/Text.module.scss +42 -0
- package/src/components/TextArea/README.md +10 -8
- package/src/components/TextArea/TextArea.jsx +1 -1
- package/src/components/TextArea/TextArea.module.scss +97 -0
- package/src/components/TextField/README.md +13 -8
- package/src/components/TextField/TextField.jsx +1 -1
- package/src/components/TextField/TextField.module.scss +109 -0
- package/src/components/TextLink/README.md +10 -8
- package/src/components/TextLink/TextLink.jsx +1 -1
- package/src/components/TextLink/TextLink.module.scss +18 -0
- package/src/components/Toggle/README.md +10 -8
- package/src/components/Toggle/Toggle.jsx +1 -1
- package/src/components/Toggle/Toggle.module.scss +63 -0
- package/src/components/Toolbar/README.md +9 -7
- package/src/components/Toolbar/Toolbar.jsx +1 -1
- package/src/components/Toolbar/Toolbar.module.scss +85 -0
- package/src/components/Toolbar/ToolbarGroup.jsx +1 -1
- package/src/components/Toolbar/ToolbarItem.jsx +1 -1
- package/src/components/_helpers/transferProps.js +47 -7
- package/src/foundation.scss +22 -17
- package/src/helpers.scss +12 -8
- package/src/index.js +3 -4
- package/src/index.scss +7 -0
- package/src/layers.scss +4 -0
- package/src/styles/elements/_page.scss +0 -4
- package/src/styles/helpers/_animation.scss +2 -2
- package/src/styles/tools/_utilities.scss +1 -1
- package/src/theme.scss +1040 -1038
- package/CODEOWNERS +0 -23
- package/src/components/Alert/Alert.scss +0 -98
- package/src/components/Badge/Badge.scss +0 -107
- package/src/components/ButtonGroup/ButtonGroup.scss +0 -33
- package/src/components/Card/Card.scss +0 -70
- package/src/components/CheckboxField/CheckboxField.scss +0 -61
- package/src/components/FileInputField/FileInputField.scss +0 -63
- package/src/components/FormLayout/FormLayoutCustomField.scss +0 -63
- package/src/components/Grid/Grid.scss +0 -63
- package/src/components/InputGroup/InputGroup.scss +0 -87
- package/src/components/Modal/Modal.scss +0 -78
- package/src/components/Modal/ModalBody.scss +0 -18
- package/src/components/Modal/ModalCloseButton.scss +0 -18
- package/src/components/Modal/ModalContent.scss +0 -5
- package/src/components/Modal/ModalFooter.scss +0 -35
- package/src/components/Modal/ModalHeader.scss +0 -30
- package/src/components/Modal/ModalTitle.scss +0 -10
- package/src/components/Paper/Paper.scss +0 -17
- package/src/components/Popover/Popover.scss +0 -236
- package/src/components/Popover/PopoverWrapper.scss +0 -3
- package/src/components/Radio/Radio.scss +0 -83
- package/src/components/ScrollView/ScrollView.scss +0 -227
- package/src/components/SelectField/SelectField.scss +0 -109
- package/src/components/Table/Table.scss +0 -28
- package/src/components/Table/_components/TableCell.scss +0 -26
- package/src/components/Tabs/Tabs.scss +0 -28
- package/src/components/Tabs/TabsItem.scss +0 -117
- package/src/components/Text/Text.scss +0 -40
- package/src/components/TextArea/TextArea.scss +0 -95
- package/src/components/TextField/TextField.scss +0 -107
- package/src/components/TextLink/TextLink.scss +0 -16
- package/src/components/Toggle/Toggle.scss +0 -61
- package/src/components/Toolbar/Toolbar.scss +0 -83
- /package/src/components/Button/{Button.scss → Button.module.scss} +0 -0
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.55.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
7
7
|
"ui",
|
|
@@ -33,13 +33,16 @@
|
|
|
33
33
|
"npm": ">=9"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
|
-
"build": "webpack --mode=production",
|
|
37
|
-
"copy": "
|
|
36
|
+
"build": "webpack --mode=production && webpack --mode=development",
|
|
37
|
+
"copy": "npm run copy:css && npm run copy:js",
|
|
38
|
+
"copy:css": "cp src/docs/_assets/generated/react-ui.css dist && cp src/docs/_assets/generated/react-ui.development.css dist",
|
|
39
|
+
"copy:js": "cp src/docs/_assets/generated/react-ui.js dist && cp src/docs/_assets/generated/react-ui.development.js dist",
|
|
38
40
|
"eslint": "eslint --ext js,jsx src",
|
|
39
41
|
"jest": "jest src --coverage",
|
|
40
42
|
"lint": "npm run eslint && npm run markdownlint && npm run stylelint",
|
|
41
43
|
"markdownlint": "markdownlint-cli2 \"CONTRIBUTING.md\" \"README.md\" \"RELEASING.md\" \"src/**/*.md\"",
|
|
42
44
|
"postbuild": "npm run copy",
|
|
45
|
+
"postinstall": "cp -n .env.dist .env || true",
|
|
43
46
|
"precopy": "rm -rf dist && mkdir dist",
|
|
44
47
|
"prepublishOnly": "npm run build",
|
|
45
48
|
"start": "webpack --watch --mode=development",
|
|
@@ -73,7 +76,7 @@
|
|
|
73
76
|
"babel-jest": "^29.6.4",
|
|
74
77
|
"babel-loader": "^9.1.3",
|
|
75
78
|
"core-js": "^3.32.1",
|
|
76
|
-
"css-loader": "^6.
|
|
79
|
+
"css-loader": "^6.10.0",
|
|
77
80
|
"eslint": "^8.48.0",
|
|
78
81
|
"eslint-config-airbnb": "^19.0.4",
|
|
79
82
|
"eslint-plugin-import": "^2.28.1",
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import { transferProps } from '../_helpers/transferProps';
|
|
8
8
|
import { classNames } from '../../utils/classNames';
|
|
9
9
|
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
|
|
10
|
-
import styles from './Alert.scss';
|
|
10
|
+
import styles from './Alert.module.scss';
|
|
11
11
|
|
|
12
12
|
export const Alert = ({
|
|
13
13
|
children,
|
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
|
|
9
|
+
@layer components.alert {
|
|
10
|
+
.root {
|
|
11
|
+
position: relative;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: flex-start;
|
|
14
|
+
width: 100%;
|
|
15
|
+
color: var(--rui-local-color);
|
|
16
|
+
border-width: theme.$border-width theme.$border-width theme.$border-width theme.$stripe-width;
|
|
17
|
+
border-style: solid;
|
|
18
|
+
border-color: var(--rui-local-foreground-color);
|
|
19
|
+
border-radius: theme.$border-radius;
|
|
20
|
+
background-color: var(--rui-local-background-color);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.icon,
|
|
24
|
+
.message {
|
|
25
|
+
padding: theme.$padding;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.close,
|
|
29
|
+
.icon {
|
|
30
|
+
height: settings.$min-height;
|
|
31
|
+
color: var(--rui-local-foreground-color);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.icon {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex: none;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
padding-right: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.message {
|
|
43
|
+
flex-grow: 1;
|
|
44
|
+
font-weight: theme.$font-weight;
|
|
45
|
+
font-size: settings.$font-size;
|
|
46
|
+
line-height: settings.$line-height;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.message a,
|
|
50
|
+
.message strong {
|
|
51
|
+
font-weight: theme.$emphasis-font-weight;
|
|
52
|
+
color: var(--rui-local-foreground-color);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.close {
|
|
56
|
+
@include reset.button();
|
|
57
|
+
@include accessibility.min-tap-target();
|
|
58
|
+
|
|
59
|
+
padding: theme.$padding;
|
|
60
|
+
font-size: map.get(typography.$font-size-values, 4);
|
|
61
|
+
line-height: 1;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.closeSign {
|
|
65
|
+
position: relative;
|
|
66
|
+
top: -0.1em;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.isRootColorSuccess {
|
|
70
|
+
@include tools.color(success);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.isRootColorWarning {
|
|
74
|
+
@include tools.color(warning);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.isRootColorDanger {
|
|
78
|
+
@include tools.color(danger);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.isRootColorHelp {
|
|
82
|
+
@include tools.color(help);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.isRootColorInfo {
|
|
86
|
+
@include tools.color(info);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.isRootColorNote {
|
|
90
|
+
@include tools.color(note);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.isRootColorLight {
|
|
94
|
+
@include tools.color(light);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.isRootColorDark {
|
|
98
|
+
@include tools.color(dark);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -171,13 +171,15 @@ React.createElement(() => {
|
|
|
171
171
|
## Forwarding HTML Attributes
|
|
172
172
|
|
|
173
173
|
In addition to the options below in the [component's API](#api) section, you
|
|
174
|
-
can specify
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
can specify **any HTML attribute you like.** All attributes that don't interfere
|
|
175
|
+
with the API of the React component are forwarded to the root `<div>` HTML
|
|
176
|
+
element. This enables making the component interactive and helps to improve
|
|
177
177
|
its accessibility.
|
|
178
178
|
|
|
179
|
-
👉
|
|
180
|
-
|
|
179
|
+
👉 For the full list of supported attributes refer to:
|
|
180
|
+
|
|
181
|
+
- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
|
|
182
|
+
- [React common props]{:target="_blank"}
|
|
181
183
|
|
|
182
184
|
## API
|
|
183
185
|
|
|
@@ -211,5 +213,5 @@ Where:
|
|
|
211
213
|
- `<PROPERTY>` is one of `color` (color of text), `foreground-color` (color of
|
|
212
214
|
border, icon, links, and emphasis), or `background-color`.
|
|
213
215
|
|
|
214
|
-
[
|
|
215
|
-
[
|
|
216
|
+
[div-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
|
|
217
|
+
[React common props]: https://react.dev/reference/react-dom/components/common#common-props
|
|
@@ -4,7 +4,7 @@ import { withGlobalProps } from '../../provider';
|
|
|
4
4
|
import { transferProps } from '../_helpers/transferProps';
|
|
5
5
|
import { classNames } from '../../utils/classNames';
|
|
6
6
|
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
|
|
7
|
-
import styles from './Badge.scss';
|
|
7
|
+
import styles from './Badge.module.scss';
|
|
8
8
|
|
|
9
9
|
export const Badge = ({
|
|
10
10
|
color,
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
@use "sass:map";
|
|
2
|
+
@use "sass:math";
|
|
3
|
+
@use "../../styles/theme/borders";
|
|
4
|
+
@use "../../styles/theme/typography";
|
|
5
|
+
|
|
6
|
+
$_badge-size: 1.25rem;
|
|
7
|
+
|
|
8
|
+
@layer components.badge {
|
|
9
|
+
.root {
|
|
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.$font-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
|
+
}
|
|
26
|
+
|
|
27
|
+
.isRootColorSuccess {
|
|
28
|
+
--rui-local-color: var(--rui-color-feedback-on-success);
|
|
29
|
+
--rui-local-background-color: var(--rui-color-feedback-success);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.isRootColorWarning {
|
|
33
|
+
--rui-local-color: var(--rui-color-feedback-on-warning);
|
|
34
|
+
--rui-local-background-color: var(--rui-color-feedback-warning);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.isRootColorDanger {
|
|
38
|
+
--rui-local-color: var(--rui-color-feedback-on-danger);
|
|
39
|
+
--rui-local-background-color: var(--rui-color-feedback-danger);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.isRootColorHelp {
|
|
43
|
+
--rui-local-color: var(--rui-color-feedback-on-help);
|
|
44
|
+
--rui-local-background-color: var(--rui-color-feedback-help);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.isRootColorInfo {
|
|
48
|
+
--rui-local-color: var(--rui-color-feedback-on-info);
|
|
49
|
+
--rui-local-background-color: var(--rui-color-feedback-info);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.isRootColorNote {
|
|
53
|
+
--rui-local-color: var(--rui-color-feedback-on-note);
|
|
54
|
+
--rui-local-background-color: var(--rui-color-feedback-note);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.isRootColorLight {
|
|
58
|
+
--rui-local-color: var(--rui-color-neutral-on-light);
|
|
59
|
+
--rui-local-background-color: var(--rui-color-neutral-light);
|
|
60
|
+
--rui-local-box-shadow: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.isRootColorDark {
|
|
64
|
+
--rui-local-color: var(--rui-color-neutral-on-dark);
|
|
65
|
+
--rui-local-background-color: var(--rui-color-neutral-dark);
|
|
66
|
+
--rui-local-box-shadow: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.isRootPriorityOutline {
|
|
70
|
+
--rui-local-background-color: transparent;
|
|
71
|
+
--rui-local-box-shadow: none;
|
|
72
|
+
|
|
73
|
+
padding-top: 0.1875rem;
|
|
74
|
+
padding-bottom: 0.1875rem;
|
|
75
|
+
border: borders.$width solid currentcolor;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.isRootPriorityOutline.isRootColorSuccess {
|
|
79
|
+
--rui-local-color: var(--rui-color-feedback-success);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.isRootPriorityOutline.isRootColorWarning {
|
|
83
|
+
--rui-local-color: var(--rui-color-feedback-warning);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.isRootPriorityOutline.isRootColorDanger {
|
|
87
|
+
--rui-local-color: var(--rui-color-feedback-danger);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.isRootPriorityOutline.isRootColorHelp {
|
|
91
|
+
--rui-local-color: var(--rui-color-feedback-help);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.isRootPriorityOutline.isRootColorInfo {
|
|
95
|
+
--rui-local-color: var(--rui-color-feedback-info);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.isRootPriorityOutline.isRootColorNote {
|
|
99
|
+
--rui-local-color: var(--rui-color-feedback-note);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.isRootPriorityOutline.isRootColorLight {
|
|
103
|
+
--rui-local-color: var(--rui-color-neutral-light);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.isRootPriorityOutline.isRootColorDark {
|
|
107
|
+
--rui-local-color: var(--rui-color-neutral-dark);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -87,17 +87,19 @@ Medium-emphasis priority to provide additional context in an unobtrusive way.
|
|
|
87
87
|
## Forwarding HTML Attributes
|
|
88
88
|
|
|
89
89
|
In addition to the options below in the [component's API](#api) section, you
|
|
90
|
-
can specify
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
can specify **any HTML attribute you like.** All attributes that don't interfere
|
|
91
|
+
with the API of the React component are forwarded to the root `<div>` HTML
|
|
92
|
+
element. This enables making the component interactive and helps to improve
|
|
93
93
|
its accessibility.
|
|
94
94
|
|
|
95
|
-
👉
|
|
96
|
-
|
|
95
|
+
👉 For the full list of supported attributes refer to:
|
|
96
|
+
|
|
97
|
+
- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
|
|
98
|
+
- [React common props]{:target="_blank"}
|
|
97
99
|
|
|
98
100
|
## API
|
|
99
101
|
|
|
100
102
|
<docoff-react-props src="/components/Badge/Badge.jsx" />
|
|
101
103
|
|
|
102
|
-
[
|
|
103
|
-
[
|
|
104
|
+
[div-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
|
|
105
|
+
[React common props]: https://react.dev/reference/react-dom/components/common#common-props
|
|
@@ -10,7 +10,7 @@ import { ButtonGroupContext } from '../ButtonGroup';
|
|
|
10
10
|
import { InputGroupContext } from '../InputGroup/InputGroupContext';
|
|
11
11
|
import getRootPriorityClassName from '../_helpers/getRootPriorityClassName';
|
|
12
12
|
import getRootLabelVisibilityClassName from './helpers/getRootLabelVisibilityClassName';
|
|
13
|
-
import styles from './Button.scss';
|
|
13
|
+
import styles from './Button.module.scss';
|
|
14
14
|
|
|
15
15
|
export const Button = React.forwardRef((props, ref) => {
|
|
16
16
|
const {
|
|
@@ -388,13 +388,15 @@ animation is made.
|
|
|
388
388
|
## Forwarding HTML Attributes
|
|
389
389
|
|
|
390
390
|
In addition to the options below in the [component's API](#api) section, you
|
|
391
|
-
can specify
|
|
392
|
-
|
|
393
|
-
|
|
391
|
+
can specify **any HTML attribute you like.** All attributes that don't interfere
|
|
392
|
+
with the API of the React component are forwarded to the root `<button>` HTML
|
|
393
|
+
element. This enables making the component interactive and helps to improve
|
|
394
394
|
its accessibility.
|
|
395
395
|
|
|
396
|
-
👉
|
|
397
|
-
|
|
396
|
+
👉 For the full list of supported attributes refer to:
|
|
397
|
+
|
|
398
|
+
- [`<button>` HTML element attributes][button-attributes]{:target="_blank"}
|
|
399
|
+
- [React common props]{:target="_blank"}
|
|
398
400
|
|
|
399
401
|
## Forwarding ref
|
|
400
402
|
|
|
@@ -575,6 +577,6 @@ feedback state.
|
|
|
575
577
|
| `--rui-Button--feedback__opacity` | Opacity of buttons in feedback state |
|
|
576
578
|
| `--rui-Button--feedback__cursor` | Cursor to show on hovering buttons in feedback state |
|
|
577
579
|
|
|
578
|
-
[
|
|
579
|
-
[
|
|
580
|
+
[button-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes
|
|
581
|
+
[React common props]: https://react.dev/reference/react-dom/components/common#common-props
|
|
580
582
|
[ref]: https://reactjs.org/docs/refs-and-the-dom.html
|
|
@@ -7,151 +7,153 @@
|
|
|
7
7
|
@use "theme";
|
|
8
8
|
@use "tools";
|
|
9
9
|
|
|
10
|
-
.
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
@layer components.button {
|
|
11
|
+
.root {
|
|
12
|
+
@include tools.button();
|
|
13
|
+
}
|
|
13
14
|
|
|
14
|
-
.label {
|
|
15
|
-
|
|
16
|
-
}
|
|
15
|
+
.label {
|
|
16
|
+
display: block;
|
|
17
|
+
}
|
|
17
18
|
|
|
18
|
-
.beforeLabel,
|
|
19
|
-
.afterLabel,
|
|
20
|
-
.startCorner,
|
|
21
|
-
.endCorner,
|
|
22
|
-
.feedbackIcon {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
19
|
+
.beforeLabel,
|
|
20
|
+
.afterLabel,
|
|
21
|
+
.startCorner,
|
|
22
|
+
.endCorner,
|
|
23
|
+
.feedbackIcon {
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: baseline;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
}
|
|
27
28
|
|
|
28
|
-
.startCorner,
|
|
29
|
-
.endCorner {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
29
|
+
.startCorner,
|
|
30
|
+
.endCorner {
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: -0.35rem;
|
|
33
|
+
z-index: 2;
|
|
34
|
+
}
|
|
34
35
|
|
|
35
|
-
.startCorner {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
36
|
+
.startCorner {
|
|
37
|
+
left: 0;
|
|
38
|
+
margin-left: -0.35rem;
|
|
39
|
+
}
|
|
39
40
|
|
|
40
|
-
.endCorner {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
41
|
+
.endCorner {
|
|
42
|
+
right: 0;
|
|
43
|
+
margin-right: -0.35rem;
|
|
44
|
+
}
|
|
44
45
|
|
|
45
|
-
.feedbackIcon {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
46
|
+
.feedbackIcon {
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 0;
|
|
49
|
+
right: 0;
|
|
50
|
+
bottom: 0;
|
|
51
|
+
left: 0;
|
|
52
|
+
z-index: 1;
|
|
53
|
+
align-items: center;
|
|
54
|
+
}
|
|
54
55
|
|
|
55
|
-
.isRootSizeSmall {
|
|
56
|
-
|
|
57
|
-
}
|
|
56
|
+
.isRootSizeSmall {
|
|
57
|
+
@include tools.button-size(small);
|
|
58
|
+
}
|
|
58
59
|
|
|
59
|
-
.isRootSizeMedium {
|
|
60
|
-
|
|
61
|
-
}
|
|
60
|
+
.isRootSizeMedium {
|
|
61
|
+
@include tools.button-size(medium);
|
|
62
|
+
}
|
|
62
63
|
|
|
63
|
-
.isRootSizeLarge {
|
|
64
|
-
|
|
65
|
-
}
|
|
64
|
+
.isRootSizeLarge {
|
|
65
|
+
@include tools.button-size(large);
|
|
66
|
+
}
|
|
66
67
|
|
|
67
|
-
.isRootBlock {
|
|
68
|
-
|
|
69
|
-
}
|
|
68
|
+
.isRootBlock {
|
|
69
|
+
width: 100%;
|
|
70
|
+
}
|
|
70
71
|
|
|
71
|
-
.hasRootFeedback:disabled {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
72
|
+
.hasRootFeedback:disabled {
|
|
73
|
+
opacity: theme.$feedback-opacity;
|
|
74
|
+
cursor: theme.$feedback-cursor;
|
|
75
|
+
}
|
|
75
76
|
|
|
76
|
-
.hasRootFeedback .label,
|
|
77
|
-
.hasRootFeedback .beforeLabel,
|
|
78
|
-
.hasRootFeedback .afterLabel {
|
|
79
|
-
|
|
80
|
-
}
|
|
77
|
+
.hasRootFeedback .label,
|
|
78
|
+
.hasRootFeedback .beforeLabel,
|
|
79
|
+
.hasRootFeedback .afterLabel {
|
|
80
|
+
color: transparent;
|
|
81
|
+
}
|
|
81
82
|
|
|
82
|
-
.isRootInButtonGroup,
|
|
83
|
-
.isRootInInputGroup {
|
|
84
|
-
|
|
83
|
+
.isRootInButtonGroup,
|
|
84
|
+
.isRootInInputGroup {
|
|
85
|
+
z-index: map.get(settings.$group-z-indexes, button);
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
&:not(:first-child) {
|
|
88
|
+
border-start-start-radius: var(--rui-local-inner-border-radius);
|
|
89
|
+
border-end-start-radius: var(--rui-local-inner-border-radius);
|
|
90
|
+
}
|
|
90
91
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
&:not(:last-child) {
|
|
93
|
+
border-start-end-radius: var(--rui-local-inner-border-radius);
|
|
94
|
+
border-end-end-radius: var(--rui-local-inner-border-radius);
|
|
95
|
+
}
|
|
94
96
|
}
|
|
95
|
-
}
|
|
96
97
|
|
|
97
|
-
.isRootInButtonGroup:not(:first-child) {
|
|
98
|
-
|
|
99
|
-
}
|
|
98
|
+
.isRootInButtonGroup:not(:first-child) {
|
|
99
|
+
margin-inline-start: var(--rui-local-gap); // 1.
|
|
100
|
+
}
|
|
100
101
|
|
|
101
|
-
.isRootInButtonGroup:focus,
|
|
102
|
-
.isRootInButtonGroup:not(:disabled):hover {
|
|
103
|
-
|
|
104
|
-
}
|
|
102
|
+
.isRootInButtonGroup:focus,
|
|
103
|
+
.isRootInButtonGroup:not(:disabled):hover {
|
|
104
|
+
z-index: map.get(settings.$group-z-indexes, button-hover);
|
|
105
|
+
}
|
|
105
106
|
|
|
106
|
-
.isRootInButtonGroup .startCorner,
|
|
107
|
-
.isRootInInputGroup .startCorner,
|
|
108
|
-
.isRootInButtonGroup .endCorner,
|
|
109
|
-
.isRootInInputGroup .endCorner {
|
|
110
|
-
|
|
111
|
-
}
|
|
107
|
+
.isRootInButtonGroup .startCorner,
|
|
108
|
+
.isRootInInputGroup .startCorner,
|
|
109
|
+
.isRootInButtonGroup .endCorner,
|
|
110
|
+
.isRootInInputGroup .endCorner {
|
|
111
|
+
z-index: map.get(settings.$group-z-indexes, button-overflowing-elements);
|
|
112
|
+
}
|
|
112
113
|
|
|
113
|
-
.hasLabelHidden,
|
|
114
|
-
.hasLabelVisibleSm,
|
|
115
|
-
.hasLabelVisibleMd,
|
|
116
|
-
.hasLabelVisibleLg,
|
|
117
|
-
.hasLabelVisibleXl,
|
|
118
|
-
.hasLabelVisibleX2l,
|
|
119
|
-
.hasLabelVisibleX3l {
|
|
120
|
-
|
|
121
|
-
}
|
|
114
|
+
.hasLabelHidden,
|
|
115
|
+
.hasLabelVisibleSm,
|
|
116
|
+
.hasLabelVisibleMd,
|
|
117
|
+
.hasLabelVisibleLg,
|
|
118
|
+
.hasLabelVisibleXl,
|
|
119
|
+
.hasLabelVisibleX2l,
|
|
120
|
+
.hasLabelVisibleX3l {
|
|
121
|
+
@include tools.hide-label();
|
|
122
|
+
}
|
|
122
123
|
|
|
123
|
-
.hasLabelVisibleSm {
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
.hasLabelVisibleSm {
|
|
125
|
+
@include breakpoint.up(sm) {
|
|
126
|
+
@include tools.show-label();
|
|
127
|
+
}
|
|
126
128
|
}
|
|
127
|
-
}
|
|
128
129
|
|
|
129
|
-
.hasLabelVisibleMd {
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
.hasLabelVisibleMd {
|
|
131
|
+
@include breakpoint.up(md) {
|
|
132
|
+
@include tools.show-label();
|
|
133
|
+
}
|
|
132
134
|
}
|
|
133
|
-
}
|
|
134
135
|
|
|
135
|
-
.hasLabelVisibleLg {
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
.hasLabelVisibleLg {
|
|
137
|
+
@include breakpoint.up(lg) {
|
|
138
|
+
@include tools.show-label();
|
|
139
|
+
}
|
|
138
140
|
}
|
|
139
|
-
}
|
|
140
141
|
|
|
141
|
-
.hasLabelVisibleXl {
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
.hasLabelVisibleXl {
|
|
143
|
+
@include breakpoint.up(xl) {
|
|
144
|
+
@include tools.show-label();
|
|
145
|
+
}
|
|
144
146
|
}
|
|
145
|
-
}
|
|
146
147
|
|
|
147
|
-
.hasLabelVisibleX2l {
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
.hasLabelVisibleX2l {
|
|
149
|
+
@include breakpoint.up(x2l) {
|
|
150
|
+
@include tools.show-label();
|
|
151
|
+
}
|
|
150
152
|
}
|
|
151
|
-
}
|
|
152
153
|
|
|
153
|
-
.hasLabelVisibleX3l {
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
.hasLabelVisibleX3l {
|
|
155
|
+
@include breakpoint.up(x3l) {
|
|
156
|
+
@include tools.show-label();
|
|
157
|
+
}
|
|
156
158
|
}
|
|
157
159
|
}
|