@react-ui-org/react-ui 0.54.0 → 0.55.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +7 -5
- package/dist/react-ui.css +36 -38
- package/dist/react-ui.development.css +10021 -10523
- package/dist/react-ui.development.js +211 -231
- package/dist/react-ui.js +1 -1
- package/package.json +3 -2
- 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 +1 -1
- package/src/components/InputGroup/InputGroup.module.scss +93 -0
- package/src/components/InputGroup/README.md +10 -8
- 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/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 -91
- 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
@@ -0,0 +1,119 @@
|
|
1
|
+
// 1. Keep inactive items under Tabs' decorative bottom border and pop active ones above it.
|
2
|
+
|
3
|
+
@use "../../styles/tools/breakpoint";
|
4
|
+
@use "../../styles/tools/reset";
|
5
|
+
@use "../../styles/tools/transition";
|
6
|
+
@use "theme";
|
7
|
+
|
8
|
+
@layer components.tabs {
|
9
|
+
.root {
|
10
|
+
@include transition.add(transform);
|
11
|
+
|
12
|
+
position: relative; // 1.
|
13
|
+
z-index: 1; // 1.
|
14
|
+
flex: none;
|
15
|
+
padding-top: calc(-1 * #{theme.$item-active-shift-y});
|
16
|
+
margin-bottom: theme.$item-active-shift-y;
|
17
|
+
transform: translateY(0);
|
18
|
+
|
19
|
+
&:hover,
|
20
|
+
&:focus-within {
|
21
|
+
transform: translateY(theme.$item-hover-shift-y);
|
22
|
+
}
|
23
|
+
|
24
|
+
&:not(:last-child) {
|
25
|
+
margin-right: theme.$gap-xs;
|
26
|
+
}
|
27
|
+
|
28
|
+
@include breakpoint.up(sm) {
|
29
|
+
&:not(:last-child) {
|
30
|
+
margin-right: theme.$gap-sm;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
@include breakpoint.up(md) {
|
35
|
+
&:not(:last-child) {
|
36
|
+
margin-right: theme.$gap-md;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
.link {
|
42
|
+
@include reset.link();
|
43
|
+
@include transition.add((color, border-color, background-color, box-shadow));
|
44
|
+
|
45
|
+
display: block;
|
46
|
+
padding: theme.$item-padding-xs;
|
47
|
+
font-weight: theme.$item-font-weight;
|
48
|
+
line-height: 1;
|
49
|
+
text-decoration: none;
|
50
|
+
color: theme.$item-color;
|
51
|
+
border: theme.$item-border-width solid;
|
52
|
+
border-color: theme.$item-border-color;
|
53
|
+
border-top-left-radius: theme.$item-border-radius;
|
54
|
+
border-top-right-radius: theme.$item-border-radius;
|
55
|
+
background-color: theme.$item-background-color;
|
56
|
+
box-shadow: theme.$item-box-shadow;
|
57
|
+
|
58
|
+
&:hover,
|
59
|
+
&:focus {
|
60
|
+
font-weight: theme.$item-hover-font-weight;
|
61
|
+
color: theme.$item-hover-color;
|
62
|
+
border-width: theme.$item-hover-border-width;
|
63
|
+
border-color: theme.$item-hover-border-color;
|
64
|
+
background-color: theme.$item-hover-background-color;
|
65
|
+
box-shadow: theme.$item-hover-box-shadow;
|
66
|
+
}
|
67
|
+
|
68
|
+
@include breakpoint.up(sm) {
|
69
|
+
padding: theme.$item-padding-sm;
|
70
|
+
}
|
71
|
+
|
72
|
+
@include breakpoint.up(md) {
|
73
|
+
padding: theme.$item-padding-md;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
.linkContent {
|
78
|
+
@include transition.add(transform);
|
79
|
+
|
80
|
+
display: flex;
|
81
|
+
align-items: center;
|
82
|
+
transform: translateY(0);
|
83
|
+
}
|
84
|
+
|
85
|
+
.label:not(:first-child) {
|
86
|
+
margin-left: theme.$item-icon-gap;
|
87
|
+
}
|
88
|
+
|
89
|
+
.label:not(:last-child) {
|
90
|
+
margin-right: theme.$item-icon-gap;
|
91
|
+
}
|
92
|
+
|
93
|
+
.isRootActive,
|
94
|
+
.isRootActive:hover,
|
95
|
+
.isRootActive:focus-within {
|
96
|
+
z-index: 2; // 1.
|
97
|
+
transform: translateY(theme.$item-active-shift-y);
|
98
|
+
}
|
99
|
+
|
100
|
+
.isRootActive .link {
|
101
|
+
font-weight: theme.$item-active-font-weight;
|
102
|
+
color: theme.$item-active-color;
|
103
|
+
border-width: theme.$item-active-border-width;
|
104
|
+
border-color: theme.$item-active-border-color;
|
105
|
+
background-color: theme.$item-active-background-color;
|
106
|
+
box-shadow: theme.$item-active-box-shadow;
|
107
|
+
}
|
108
|
+
|
109
|
+
.link:hover .linkContent,
|
110
|
+
.link:focus .linkContent {
|
111
|
+
transform: translateY(theme.$item-hover-label-shift-y);
|
112
|
+
}
|
113
|
+
|
114
|
+
.isRootActive .link .linkContent,
|
115
|
+
.isRootActive .link:hover .linkContent,
|
116
|
+
.isRootActive .link:focus .linkContent {
|
117
|
+
transform: translateY(theme.$item-active-label-shift-y);
|
118
|
+
}
|
119
|
+
}
|
@@ -202,19 +202,25 @@ React.createElement(() => {
|
|
202
202
|
## Forwarding HTML Attributes
|
203
203
|
|
204
204
|
In addition to the options below in the [component's API](#api) section, you
|
205
|
-
can specify
|
206
|
-
|
207
|
-
|
208
|
-
|
205
|
+
can specify **any HTML attribute you like.** All attributes that don't interfere
|
206
|
+
with the API of the React component are forwarded to the root:
|
207
|
+
|
208
|
+
- `<span>` HTML element in case that `blockLevel` is set to `false`
|
209
|
+
- `<div>` HTML element in case that `blockLevel` is set to `true`
|
210
|
+
|
211
|
+
This enables making the component interactive and helps to improve its
|
209
212
|
accessibility.
|
210
213
|
|
211
|
-
👉
|
212
|
-
|
214
|
+
👉 For the full list of supported attributes refer to:
|
215
|
+
|
216
|
+
- [`<span>` HTML element attributes][span-attributes]{:target="_blank"}
|
217
|
+
- [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
|
218
|
+
- [React common props]{:target="_blank"}
|
213
219
|
|
214
220
|
## API
|
215
221
|
|
216
222
|
<docoff-react-props src="/components/Text/Text.jsx"></docoff-react-props>
|
217
223
|
|
218
|
-
[
|
219
|
-
[
|
220
|
-
[
|
224
|
+
[div-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
|
225
|
+
[React common props]: https://react.dev/reference/react-dom/components/common#common-props
|
226
|
+
[span-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span#attributes
|
@@ -7,7 +7,7 @@ import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
|
7
7
|
import { getRootClampClassName } from './_helpers/getRootClampClassName';
|
8
8
|
import { getRootHyphensClassName } from './_helpers/getRootHyphensClassName';
|
9
9
|
import { getRootWordWrappingClassName } from './_helpers/getRootWordWrappingClassName';
|
10
|
-
import styles from './Text.scss';
|
10
|
+
import styles from './Text.module.scss';
|
11
11
|
|
12
12
|
export const Text = ({
|
13
13
|
blockLevel,
|
@@ -0,0 +1,42 @@
|
|
1
|
+
// 1. `word-break: break-word` is deprecated in favour of `overflow-wrap: anywhere`, but it's still
|
2
|
+
// required for Safari.
|
3
|
+
// https://caniuse.com/mdn-css_properties_overflow-wrap_anywhere
|
4
|
+
//
|
5
|
+
// 2. Different approaches are used for single and multiline texts because the latter approach
|
6
|
+
// doesn't always work for single-line texts.
|
7
|
+
|
8
|
+
@layer components.text {
|
9
|
+
.isRootClampSingleLine {
|
10
|
+
display: block; // 2.
|
11
|
+
overflow: hidden;
|
12
|
+
text-overflow: ellipsis;
|
13
|
+
white-space: nowrap;
|
14
|
+
}
|
15
|
+
|
16
|
+
// stylelint-disable property-no-vendor-prefix, value-no-vendor-prefix
|
17
|
+
.isRootClampMultiLine {
|
18
|
+
display: -webkit-box; // 2.
|
19
|
+
-webkit-line-clamp: var(--rui-custom-lines);
|
20
|
+
-webkit-box-orient: vertical;
|
21
|
+
overflow: hidden;
|
22
|
+
text-overflow: ellipsis;
|
23
|
+
}
|
24
|
+
// stylelint-enable property-no-vendor-prefix, value-no-vendor-prefix
|
25
|
+
|
26
|
+
.isRootHyphensAuto {
|
27
|
+
hyphens: auto;
|
28
|
+
}
|
29
|
+
|
30
|
+
.isRootHyphensManual {
|
31
|
+
hyphens: manual;
|
32
|
+
}
|
33
|
+
|
34
|
+
.isRootWordWrappingAnywhere {
|
35
|
+
word-break: break-all;
|
36
|
+
}
|
37
|
+
|
38
|
+
.isRootWordWrappingLongWords {
|
39
|
+
word-break: break-word; // 1.
|
40
|
+
overflow-wrap: anywhere;
|
41
|
+
}
|
42
|
+
}
|
@@ -317,10 +317,10 @@ It's possible to disable the whole input.
|
|
317
317
|
## Forwarding HTML Attributes
|
318
318
|
|
319
319
|
In addition to the options below in the [component's API](#api) section, you
|
320
|
-
can specify
|
321
|
-
|
322
|
-
|
323
|
-
|
320
|
+
can specify **any HTML attribute you like.** All attributes that don't interfere
|
321
|
+
with the API of the React component are forwarded to the root `<textarea>` HTML
|
322
|
+
element. This enables making the component interactive and helps to improve
|
323
|
+
its accessibility.
|
324
324
|
|
325
325
|
```docoff-react-preview
|
326
326
|
<TextArea
|
@@ -338,8 +338,10 @@ to helps to improve its accessibility.
|
|
338
338
|
/>
|
339
339
|
```
|
340
340
|
|
341
|
-
👉
|
342
|
-
|
341
|
+
👉 For the full list of supported attributes refer to:
|
342
|
+
|
343
|
+
- [`<textarea>` HTML element attributes][textarea-attributes]{:target="_blank"}
|
344
|
+
- [React common props]{:target="_blank"}
|
343
345
|
|
344
346
|
## Forwarding ref
|
345
347
|
|
@@ -354,6 +356,6 @@ If you provide [ref], it is forwarded to the native HTML `<textarea>` element.
|
|
354
356
|
Head to [Forms Theming](/docs/customize/theming/forms) to see shared form theming
|
355
357
|
options.
|
356
358
|
|
357
|
-
[React
|
358
|
-
[textarea]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attributes
|
359
|
+
[React common props]: https://react.dev/reference/react-dom/components/common#common-props
|
359
360
|
[ref]: https://reactjs.org/docs/refs-and-the-dom.html
|
361
|
+
[textarea-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attributes
|
@@ -7,7 +7,7 @@ import { getRootValidationStateClassName } from '../_helpers/getRootValidationSt
|
|
7
7
|
import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
|
8
8
|
import { transferProps } from '../_helpers/transferProps';
|
9
9
|
import { FormLayoutContext } from '../FormLayout';
|
10
|
-
import styles from './TextArea.scss';
|
10
|
+
import styles from './TextArea.module.scss';
|
11
11
|
|
12
12
|
export const TextArea = React.forwardRef((props, ref) => {
|
13
13
|
const {
|
@@ -0,0 +1,97 @@
|
|
1
|
+
@use "../../styles/tools/form-fields/box-field-elements";
|
2
|
+
@use "../../styles/tools/form-fields/box-field-layout";
|
3
|
+
@use "../../styles/tools/form-fields/box-field-sizes";
|
4
|
+
@use "../../styles/tools/form-fields/foundation";
|
5
|
+
@use "../../styles/tools/form-fields/variants";
|
6
|
+
@use "../../styles/tools/accessibility";
|
7
|
+
|
8
|
+
@layer components.text-area {
|
9
|
+
// Foundation
|
10
|
+
.root {
|
11
|
+
@include foundation.root();
|
12
|
+
}
|
13
|
+
|
14
|
+
.label {
|
15
|
+
@include foundation.label();
|
16
|
+
}
|
17
|
+
|
18
|
+
.inputContainer {
|
19
|
+
@include box-field-elements.input-container();
|
20
|
+
}
|
21
|
+
|
22
|
+
.input {
|
23
|
+
@include box-field-elements.input();
|
24
|
+
@include box-field-elements.input-textarea();
|
25
|
+
}
|
26
|
+
|
27
|
+
.bottomLine {
|
28
|
+
@include box-field-elements.bottom-line();
|
29
|
+
}
|
30
|
+
|
31
|
+
.helpText,
|
32
|
+
.validationText {
|
33
|
+
@include foundation.help-text();
|
34
|
+
}
|
35
|
+
|
36
|
+
.isRootRequired .label {
|
37
|
+
@include foundation.label-required();
|
38
|
+
}
|
39
|
+
|
40
|
+
// Visual variants
|
41
|
+
.isRootVariantFilled {
|
42
|
+
@include variants.visual(box, $variant: filled);
|
43
|
+
}
|
44
|
+
|
45
|
+
.isRootVariantOutline {
|
46
|
+
@include variants.visual(box, $variant: outline);
|
47
|
+
}
|
48
|
+
|
49
|
+
// States
|
50
|
+
.isRootStateInvalid {
|
51
|
+
@include variants.validation(invalid);
|
52
|
+
}
|
53
|
+
|
54
|
+
.isRootStateValid {
|
55
|
+
@include variants.validation(valid);
|
56
|
+
}
|
57
|
+
|
58
|
+
.isRootStateWarning {
|
59
|
+
@include variants.validation(warning);
|
60
|
+
}
|
61
|
+
|
62
|
+
// Invisible label
|
63
|
+
.isLabelHidden {
|
64
|
+
@include accessibility.hide-text();
|
65
|
+
}
|
66
|
+
|
67
|
+
// Layouts
|
68
|
+
.isRootLayoutVertical,
|
69
|
+
.isRootLayoutHorizontal {
|
70
|
+
@include box-field-layout.vertical();
|
71
|
+
}
|
72
|
+
|
73
|
+
.isRootLayoutHorizontal {
|
74
|
+
@include box-field-layout.horizontal();
|
75
|
+
}
|
76
|
+
|
77
|
+
.isRootFullWidth {
|
78
|
+
@include box-field-layout.full-width();
|
79
|
+
}
|
80
|
+
|
81
|
+
.isRootInFormLayout {
|
82
|
+
@include box-field-layout.in-form-layout();
|
83
|
+
}
|
84
|
+
|
85
|
+
// Sizes
|
86
|
+
.isRootSizeSmall {
|
87
|
+
@include box-field-sizes.size(small, $is-multiline: true);
|
88
|
+
}
|
89
|
+
|
90
|
+
.isRootSizeMedium {
|
91
|
+
@include box-field-sizes.size(medium, $is-multiline: true);
|
92
|
+
}
|
93
|
+
|
94
|
+
.isRootSizeLarge {
|
95
|
+
@include box-field-sizes.size(large, $is-multiline: true);
|
96
|
+
}
|
97
|
+
}
|
@@ -445,10 +445,10 @@ It's possible to disable the whole input.
|
|
445
445
|
## Forwarding HTML Attributes
|
446
446
|
|
447
447
|
In addition to the options below in the [component's API](#api) section, you
|
448
|
-
can specify
|
449
|
-
|
450
|
-
|
451
|
-
|
448
|
+
can specify **any HTML attribute you like.** All attributes that don't interfere
|
449
|
+
with the API of the React component are forwarded to the root `<input>` HTML
|
450
|
+
element. This enables making the component interactive and helps to improve
|
451
|
+
its accessibility.
|
452
452
|
|
453
453
|
```docoff-react-preview
|
454
454
|
<TextField
|
@@ -481,9 +481,14 @@ helps to improve its accessibility.
|
|
481
481
|
/>
|
482
482
|
```
|
483
483
|
|
484
|
-
👉
|
485
|
-
|
486
|
-
[
|
484
|
+
👉 For the full list of supported attributes refer to:
|
485
|
+
|
486
|
+
- [`<input type="text" />` HTML element attributes][input-text]{:target="_blank"}
|
487
|
+
- [`<input type="email" />` HTML element attributes][input-email]{:target="_blank"}
|
488
|
+
- [`<input type="number" />` HTML element attributes][input-number]{:target="_blank"}
|
489
|
+
- [`<input type="tel" />` HTML element attributes][input-tel]{:target="_blank"}
|
490
|
+
- [`<input type="password" />` HTML element attributes][input-password]{:target="_blank"}
|
491
|
+
- [React common props]{:target="_blank"}
|
487
492
|
|
488
493
|
## Forwarding ref
|
489
494
|
|
@@ -508,5 +513,5 @@ Head to [Forms Theming][theming-forms] to see shared form theming options.
|
|
508
513
|
[input-tel]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/tel#additional_attributes
|
509
514
|
[input-password]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/password#additional_attributes
|
510
515
|
[theming-forms]: /docs/customize/theming/forms
|
511
|
-
[React
|
516
|
+
[React common props]: https://react.dev/reference/react-dom/components/common#common-props
|
512
517
|
[ref]: https://reactjs.org/docs/refs-and-the-dom.html
|
@@ -8,7 +8,7 @@ import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
|
|
8
8
|
import { transferProps } from '../_helpers/transferProps';
|
9
9
|
import { FormLayoutContext } from '../FormLayout';
|
10
10
|
import { InputGroupContext } from '../InputGroup/InputGroupContext';
|
11
|
-
import styles from './TextField.scss';
|
11
|
+
import styles from './TextField.module.scss';
|
12
12
|
|
13
13
|
const SMALL_INPUT_SIZE = 10;
|
14
14
|
|
@@ -0,0 +1,109 @@
|
|
1
|
+
@use "../../styles/tools/form-fields/box-field-elements";
|
2
|
+
@use "../../styles/tools/form-fields/box-field-layout";
|
3
|
+
@use "../../styles/tools/form-fields/box-field-sizes";
|
4
|
+
@use "../../styles/tools/form-fields/foundation";
|
5
|
+
@use "../../styles/tools/form-fields/variants";
|
6
|
+
@use "../../styles/tools/accessibility";
|
7
|
+
|
8
|
+
@layer components.text-field {
|
9
|
+
// Foundation
|
10
|
+
.root {
|
11
|
+
@include foundation.root();
|
12
|
+
}
|
13
|
+
|
14
|
+
.label {
|
15
|
+
@include foundation.label();
|
16
|
+
}
|
17
|
+
|
18
|
+
.inputContainer {
|
19
|
+
@include box-field-elements.input-container();
|
20
|
+
}
|
21
|
+
|
22
|
+
.input {
|
23
|
+
@include box-field-elements.input();
|
24
|
+
}
|
25
|
+
|
26
|
+
.bottomLine {
|
27
|
+
@include box-field-elements.bottom-line();
|
28
|
+
}
|
29
|
+
|
30
|
+
.helpText,
|
31
|
+
.validationText {
|
32
|
+
@include foundation.help-text();
|
33
|
+
}
|
34
|
+
|
35
|
+
.hasRootCustomInputSize .input {
|
36
|
+
@include box-field-elements.input-size();
|
37
|
+
}
|
38
|
+
|
39
|
+
.isRootRequired .label {
|
40
|
+
@include foundation.label-required();
|
41
|
+
}
|
42
|
+
|
43
|
+
// Variants
|
44
|
+
.isRootVariantFilled {
|
45
|
+
@include variants.visual(box, $variant: filled);
|
46
|
+
}
|
47
|
+
|
48
|
+
.isRootVariantOutline {
|
49
|
+
@include variants.visual(box, $variant: outline);
|
50
|
+
}
|
51
|
+
|
52
|
+
// States
|
53
|
+
.isRootStateInvalid {
|
54
|
+
@include variants.validation(invalid);
|
55
|
+
}
|
56
|
+
|
57
|
+
.isRootStateValid {
|
58
|
+
@include variants.validation(valid);
|
59
|
+
}
|
60
|
+
|
61
|
+
.isRootStateWarning {
|
62
|
+
@include variants.validation(warning);
|
63
|
+
}
|
64
|
+
|
65
|
+
// Invisible label
|
66
|
+
.isLabelHidden {
|
67
|
+
@include accessibility.hide-text();
|
68
|
+
}
|
69
|
+
|
70
|
+
// Layouts
|
71
|
+
.isRootLayoutVertical,
|
72
|
+
.isRootLayoutHorizontal {
|
73
|
+
@include box-field-layout.vertical();
|
74
|
+
}
|
75
|
+
|
76
|
+
.isRootLayoutHorizontal {
|
77
|
+
@include box-field-layout.horizontal();
|
78
|
+
}
|
79
|
+
|
80
|
+
.isRootFullWidth {
|
81
|
+
@include box-field-layout.full-width();
|
82
|
+
}
|
83
|
+
|
84
|
+
.isRootInFormLayout {
|
85
|
+
@include box-field-layout.in-form-layout();
|
86
|
+
}
|
87
|
+
|
88
|
+
.hasRootSmallInput.isRootLayoutHorizontal {
|
89
|
+
@include box-field-layout.horizontal-with-small-input();
|
90
|
+
}
|
91
|
+
|
92
|
+
// Sizes
|
93
|
+
.isRootSizeSmall {
|
94
|
+
@include box-field-sizes.size(small);
|
95
|
+
}
|
96
|
+
|
97
|
+
.isRootSizeMedium {
|
98
|
+
@include box-field-sizes.size(medium);
|
99
|
+
}
|
100
|
+
|
101
|
+
.isRootSizeLarge {
|
102
|
+
@include box-field-sizes.size(large);
|
103
|
+
}
|
104
|
+
|
105
|
+
// Groups
|
106
|
+
.isRootGrouped {
|
107
|
+
@include box-field-elements.in-group-layout();
|
108
|
+
}
|
109
|
+
}
|
@@ -47,13 +47,15 @@ It's common to use custom function for routing within SPAs. Use the
|
|
47
47
|
## Forwarding HTML Attributes
|
48
48
|
|
49
49
|
In addition to the options below in the [component's API](#api) section, you
|
50
|
-
can specify
|
51
|
-
|
52
|
-
element. This enables making the component interactive and helps to improve
|
53
|
-
accessibility.
|
50
|
+
can specify **any HTML attribute you like.** All attributes that don't interfere
|
51
|
+
with the API of the React component are forwarded to the root `<a>` HTML
|
52
|
+
element. This enables making the component interactive and helps to improve
|
53
|
+
its accessibility.
|
54
54
|
|
55
|
-
👉
|
56
|
-
|
55
|
+
👉 For the full list of supported attributes refer to:
|
56
|
+
|
57
|
+
- [`<a>` HTML element attributes][a-attributes]{:target="_blank"}
|
58
|
+
- [React common props]{:target="_blank"}
|
57
59
|
|
58
60
|
## API
|
59
61
|
|
@@ -70,5 +72,5 @@ accessibility.
|
|
70
72
|
| `--rui-TextLink--active__color` | Text color in the active state |
|
71
73
|
| `--rui-TextLink--active__text-decoration` | Text decoration in the active state |
|
72
74
|
|
73
|
-
[
|
74
|
-
[
|
75
|
+
[a-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes
|
76
|
+
[React common props]: https://react.dev/reference/react-dom/components/common#common-props
|
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
3
3
|
import { withGlobalProps } from '../../provider';
|
4
4
|
import { transferProps } from '../_helpers/transferProps';
|
5
|
-
import styles from './TextLink.scss';
|
5
|
+
import styles from './TextLink.module.scss';
|
6
6
|
|
7
7
|
export const TextLink = ({
|
8
8
|
href,
|
@@ -0,0 +1,18 @@
|
|
1
|
+
@use "theme";
|
2
|
+
|
3
|
+
@layer components.text-link {
|
4
|
+
.root {
|
5
|
+
text-decoration: theme.$text-decoration;
|
6
|
+
color: theme.$color;
|
7
|
+
|
8
|
+
&:hover {
|
9
|
+
text-decoration: theme.$hover-text-decoration;
|
10
|
+
color: theme.$hover-color;
|
11
|
+
}
|
12
|
+
|
13
|
+
&:active {
|
14
|
+
text-decoration: theme.$active-text-decoration;
|
15
|
+
color: theme.$active-color;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
@@ -168,13 +168,15 @@ Disabled state makes the input unavailable.
|
|
168
168
|
## Forwarding HTML Attributes
|
169
169
|
|
170
170
|
In addition to the options below in the [component's API](#api) section, you
|
171
|
-
can specify
|
172
|
-
|
173
|
-
|
174
|
-
|
171
|
+
can specify **any HTML attribute you like.** All attributes that don't interfere
|
172
|
+
with the API of the React component are forwarded to the root `<input>` HTML
|
173
|
+
element. This enables making the component interactive and helps to improve
|
174
|
+
its accessibility.
|
175
175
|
|
176
|
-
👉
|
177
|
-
|
176
|
+
👉 For the full list of supported attributes refer to:
|
177
|
+
|
178
|
+
- [`<input type="checkbox" />` HTML element attributes][checkbox-attributes]{:target="_blank"}
|
179
|
+
- [React common props]{:target="_blank"}
|
178
180
|
|
179
181
|
## Forwarding ref
|
180
182
|
|
@@ -199,6 +201,6 @@ options. On top of that, the following options are available for Toggle.
|
|
199
201
|
| `--rui-FormField--check__input--toggle--checked__background-image` | Background image of checked input |
|
200
202
|
| `--rui-FormField--check__input--toggle--checked__background-position` | Background position of checked input |
|
201
203
|
|
202
|
-
[
|
203
|
-
[
|
204
|
+
[checkbox-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#additional_attributes
|
205
|
+
[React common props]: https://react.dev/reference/react-dom/components/common#common-props
|
204
206
|
[ref]: https://reactjs.org/docs/refs-and-the-dom.html
|
@@ -5,7 +5,7 @@ import { classNames } from '../../utils/classNames';
|
|
5
5
|
import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
|
6
6
|
import { transferProps } from '../_helpers/transferProps';
|
7
7
|
import { FormLayoutContext } from '../FormLayout';
|
8
|
-
import styles from './Toggle.scss';
|
8
|
+
import styles from './Toggle.module.scss';
|
9
9
|
|
10
10
|
export const Toggle = React.forwardRef((props, ref) => {
|
11
11
|
const {
|