@react-ui-org/react-ui 0.44.0 → 0.46.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/CONTRIBUTING.md +7 -0
- package/dist/lib.development.js +209 -305
- package/dist/lib.js +1 -1
- package/package.json +10 -13
- 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 +6 -8
- 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 +8 -3
- 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 +31 -22
- package/src/lib/components/ButtonGroup/ButtonGroup.scss +3 -3
- package/src/lib/components/ButtonGroup/README.mdx +4 -4
- package/src/lib/components/Card/Card.jsx +7 -6
- package/src/lib/components/Card/Card.scss +28 -28
- package/src/lib/components/Card/CardBody.jsx +5 -11
- package/src/lib/components/Card/CardFooter.jsx +10 -5
- package/src/lib/components/Card/README.mdx +2 -2
- 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 +18 -17
- package/src/lib/components/CheckboxField/CheckboxField.scss +20 -20
- package/src/lib/components/CheckboxField/README.mdx +3 -3
- package/src/lib/components/FileInputField/FileInputField.jsx +13 -12
- 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 +16 -14
- package/src/lib/components/FormLayout/FormLayout.scss +17 -17
- package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +15 -9
- package/src/lib/components/FormLayout/FormLayoutCustomField.scss +18 -18
- package/src/lib/components/FormLayout/README.mdx +27 -49
- package/src/lib/components/Grid/Grid.jsx +4 -3
- package/src/lib/components/Grid/Grid.scss +32 -23
- package/src/lib/components/Grid/GridSpan.jsx +4 -3
- 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/List/List.jsx +14 -12
- package/src/lib/components/List/List.scss +21 -21
- package/src/lib/components/List/ListItem.jsx +3 -2
- package/src/lib/components/List/README.mdx +1 -1
- package/src/lib/components/Media/Media.jsx +12 -5
- package/src/lib/components/Media/Media.scss +6 -6
- package/src/lib/components/Media/MediaBody.jsx +18 -7
- package/src/lib/components/Media/MediaObject.jsx +18 -7
- package/src/lib/components/Modal/Modal.jsx +8 -6
- package/src/lib/components/Modal/Modal.scss +73 -73
- package/src/lib/components/Modal/README.mdx +2 -2
- 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 +6 -6
- package/src/lib/components/Paper/Paper.scss +8 -8
- package/src/lib/components/Paper/README.mdx +1 -1
- package/src/lib/components/Radio/README.mdx +4 -4
- package/src/lib/components/Radio/Radio.jsx +12 -11
- package/src/lib/components/Radio/Radio.scss +26 -26
- package/src/lib/components/ScrollView/README.mdx +4 -1
- package/src/lib/components/ScrollView/ScrollView.jsx +11 -9
- 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 +4 -4
- package/src/lib/components/SelectField/SelectField.jsx +14 -13
- package/src/lib/components/SelectField/SelectField.scss +30 -30
- package/src/lib/components/Table/README.mdx +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/README.mdx +1 -1
- package/src/lib/components/Tabs/Tabs.jsx +1 -2
- 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/README.mdx +1 -1
- package/src/lib/components/Text/Text.jsx +13 -6
- 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 +18 -14
- 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 +16 -14
- package/src/lib/components/TextField/TextField.scss +28 -28
- package/src/lib/components/TextLink/README.mdx +77 -0
- package/src/lib/components/{Link/Link.jsx → TextLink/TextLink.jsx} +12 -13
- 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 +3 -3
- package/src/lib/components/Toggle/Toggle.jsx +18 -17
- package/src/lib/components/Toggle/Toggle.scss +20 -20
- package/src/lib/components/Toolbar/README.mdx +19 -3
- package/src/lib/components/Toolbar/Toolbar.jsx +23 -14
- package/src/lib/components/Toolbar/Toolbar.scss +35 -30
- package/src/lib/components/Toolbar/ToolbarGroup.jsx +18 -13
- package/src/lib/components/Toolbar/ToolbarItem.jsx +26 -7
- 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 +4 -8
- 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 +24 -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 +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 +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/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
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
@use
|
|
2
|
-
@use
|
|
3
|
-
@use
|
|
4
|
-
@use
|
|
5
|
-
@use
|
|
6
|
-
@use
|
|
7
|
-
@use
|
|
8
|
-
@use
|
|
9
|
-
@use
|
|
1
|
+
@use "../../styles/tools/form-fields/box-field-elements";
|
|
2
|
+
@use "../../styles/tools/form-fields/box-field-layout";
|
|
3
|
+
@use "../../styles/tools/form-fields/foundation";
|
|
4
|
+
@use "../../styles/tools/form-fields/inline-field-elements";
|
|
5
|
+
@use "../../styles/tools/form-fields/inline-field-layout";
|
|
6
|
+
@use "../../styles/tools/form-fields/variants";
|
|
7
|
+
@use "../../styles/tools/accessibility";
|
|
8
|
+
@use "../../styles/tools/reset";
|
|
9
|
+
@use "../../styles/tools/spacing";
|
|
10
10
|
|
|
11
11
|
// Foundation
|
|
12
12
|
.root {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
@include foundation.root();
|
|
14
|
+
@include variants.visual(check);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.label,
|
|
18
18
|
.optionLabel {
|
|
19
|
-
|
|
19
|
+
@include foundation.label();
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.list {
|
|
23
|
-
|
|
23
|
+
@include reset.list();
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
.option {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
@include inline-field-layout.field($type: radio);
|
|
28
|
+
@include inline-field-elements.min-tap-target($type: radio);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
.input {
|
|
32
|
-
|
|
32
|
+
@include inline-field-elements.check-input($type: radio);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
.helpText,
|
|
36
36
|
.validationText {
|
|
37
|
-
|
|
37
|
+
@include foundation.help-text();
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
.isRootRequired .label {
|
|
41
|
-
|
|
41
|
+
@include foundation.label-required();
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// States
|
|
45
45
|
.isRootStateInvalid {
|
|
46
|
-
|
|
46
|
+
@include variants.validation(invalid);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
.isRootStateValid {
|
|
50
|
-
|
|
50
|
+
@include variants.validation(valid);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
.isRootStateWarning {
|
|
54
|
-
|
|
54
|
+
@include variants.validation(warning);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// Invisible label
|
|
58
58
|
.isLabelHidden {
|
|
59
|
-
|
|
59
|
+
@include accessibility.hide-text();
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// Layouts
|
|
63
63
|
.rootLayoutVertical,
|
|
64
64
|
.rootLayoutHorizontal {
|
|
65
|
-
|
|
65
|
+
@include box-field-layout.vertical($has-list: true);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
.rootLayoutHorizontal {
|
|
69
|
-
|
|
69
|
+
@include box-field-layout.horizontal($has-min-tap-target: true);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
.isRootFullWidth {
|
|
73
|
-
|
|
73
|
+
@include box-field-layout.full-width();
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
.isRootInFormLayout {
|
|
77
|
-
|
|
77
|
+
@include box-field-layout.in-form-layout();
|
|
78
78
|
}
|
|
@@ -8,6 +8,9 @@ route: /components/scroll-view
|
|
|
8
8
|
|
|
9
9
|
ScrollView makes long content scrollable.
|
|
10
10
|
|
|
11
|
+
👉 Please note that HTML is rendered even when no children are provided.
|
|
12
|
+
This is needed to allow the autoscroll feature to work.
|
|
13
|
+
|
|
11
14
|
import {
|
|
12
15
|
Playground,
|
|
13
16
|
Props,
|
|
@@ -358,7 +361,7 @@ Aside from setting a custom shadow color and size, you can entirely customize
|
|
|
358
361
|
the scrolling shadows with `background` or `box-shadow` CSS properties.
|
|
359
362
|
|
|
360
363
|
The following example demonstrates exactly the same custom scrolling shadows as
|
|
361
|
-
we use in the [Modal](/components/
|
|
364
|
+
we use in the [Modal](/components/modal#scrolling-long-content) component.
|
|
362
365
|
|
|
363
366
|
<Playground>
|
|
364
367
|
<Placeholder height="200px">
|
|
@@ -5,10 +5,11 @@ import React, {
|
|
|
5
5
|
useRef,
|
|
6
6
|
useState,
|
|
7
7
|
} from 'react';
|
|
8
|
-
import { useLoadResize } from '../../hooks/useLoadResizeHook';
|
|
9
|
-
import { useScrollPosition } from '../../hooks/useScrollPositionHook';
|
|
10
8
|
import { withProviderContext } from '../../provider';
|
|
11
|
-
import {
|
|
9
|
+
import { classNames } from '../../utils/classNames';
|
|
10
|
+
import { getElementsPositionDifference } from './_helpers/getElementsPositionDifference';
|
|
11
|
+
import { useLoadResize } from './_hooks/useLoadResizeHook';
|
|
12
|
+
import { useScrollPosition } from './_hooks/useScrollPositionHook';
|
|
12
13
|
import styles from './ScrollView.scss';
|
|
13
14
|
|
|
14
15
|
// Function `getElementsPositionDifference` sometimes returns floating point values that results
|
|
@@ -197,13 +198,13 @@ export const ScrollView = (props) => {
|
|
|
197
198
|
|
|
198
199
|
return (
|
|
199
200
|
<div
|
|
200
|
-
className={
|
|
201
|
+
className={classNames(
|
|
201
202
|
styles.root,
|
|
202
|
-
isScrolledAtStart
|
|
203
|
-
isScrolledAtEnd
|
|
204
|
-
scrollbar
|
|
203
|
+
isScrolledAtStart && styles.isRootScrolledAtStart,
|
|
204
|
+
isScrolledAtEnd && styles.isRootScrolledAtEnd,
|
|
205
|
+
!scrollbar && styles.hasRootScrollbarDisabled,
|
|
205
206
|
direction === 'horizontal' ? styles.isRootHorizontal : styles.isRootVertical,
|
|
206
|
-
|
|
207
|
+
)}
|
|
207
208
|
style={inlineStyle(
|
|
208
209
|
direction,
|
|
209
210
|
arrowsColor,
|
|
@@ -271,6 +272,7 @@ ScrollView.defaultProps = {
|
|
|
271
272
|
arrowsColor: undefined,
|
|
272
273
|
arrowsScrollStep: 200,
|
|
273
274
|
autoScroll: 'off',
|
|
275
|
+
children: null,
|
|
274
276
|
customEndShadowStyle: {},
|
|
275
277
|
customNextArrow: null,
|
|
276
278
|
customPrevArrow: null,
|
|
@@ -315,7 +317,7 @@ ScrollView.propTypes = {
|
|
|
315
317
|
/**
|
|
316
318
|
* Content to be scrollable.
|
|
317
319
|
*/
|
|
318
|
-
children: PropTypes.node
|
|
320
|
+
children: PropTypes.node,
|
|
319
321
|
/**
|
|
320
322
|
* Custom CSS to replace the default end scrolling shadow.
|
|
321
323
|
*/
|
|
@@ -21,204 +21,204 @@
|
|
|
21
21
|
// 7. Hide content overflowing in the other direction because scrollbars would be unreachable under
|
|
22
22
|
// scrolling shadows.
|
|
23
23
|
|
|
24
|
-
@use
|
|
25
|
-
@use
|
|
26
|
-
@use
|
|
27
|
-
@use
|
|
28
|
-
@use
|
|
29
|
-
@use
|
|
30
|
-
@use
|
|
24
|
+
@use "../../styles/tools/accessibility";
|
|
25
|
+
@use "../../styles/tools/caret";
|
|
26
|
+
@use "../../styles/tools/reset";
|
|
27
|
+
@use "../../styles/tools/scrollbar";
|
|
28
|
+
@use "../../styles/tools/spacing";
|
|
29
|
+
@use "../../styles/tools/transition";
|
|
30
|
+
@use "theme";
|
|
31
31
|
|
|
32
32
|
$_arrow-inner-spacing: spacing.of(2);
|
|
33
33
|
$_arrow-outer-spacing: spacing.of(4);
|
|
34
34
|
|
|
35
35
|
.root {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
position: relative; // 2.
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
width: 100%;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
// 1.
|
|
43
43
|
.scrollingShadows {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
44
|
+
position: absolute; // 2.
|
|
45
|
+
width: 100%; // 2.
|
|
46
|
+
height: 100%; // 2.
|
|
47
|
+
overflow: hidden; // 2.
|
|
48
|
+
|
|
49
|
+
&::before,
|
|
50
|
+
&::after {
|
|
51
|
+
@include transition.add((visibility, opacity, transform));
|
|
52
|
+
|
|
53
|
+
content: "";
|
|
54
|
+
position: absolute;
|
|
55
|
+
z-index: 2; // 2.
|
|
56
|
+
display: block;
|
|
57
|
+
width: var(--rui-local-shadow-width);
|
|
58
|
+
height: var(--rui-local-shadow-height);
|
|
59
|
+
visibility: hidden;
|
|
60
|
+
opacity: 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&::before {
|
|
64
|
+
background: var(--rui-local-start-shadow-background);
|
|
65
|
+
box-shadow: var(--rui-local-start-shadow-box-shadow);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&::after {
|
|
69
|
+
background: var(--rui-local-end-shadow-background);
|
|
70
|
+
box-shadow: var(--rui-local-end-shadow-box-shadow);
|
|
71
|
+
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
.viewport {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
z-index: 1; // 2.
|
|
76
|
+
width: 100%;
|
|
77
|
+
scroll-behavior: smooth;
|
|
78
|
+
-webkit-overflow-scrolling: touch;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
.arrowPrev,
|
|
82
82
|
.arrowNext {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
@include reset.button();
|
|
84
|
+
@include accessibility.min-tap-target();
|
|
85
|
+
@include transition.add((visibility, opacity, transform));
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
position: absolute; // 3.
|
|
88
|
+
z-index: 3; // 3.
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
justify-content: center;
|
|
92
|
+
color: var(--rui-local-arrow-color);
|
|
93
|
+
visibility: hidden;
|
|
94
|
+
opacity: 0;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
.arrowIcon {
|
|
98
|
-
|
|
98
|
+
@include caret.create();
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
.isRootVertical {
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
height: 100%;
|
|
103
|
+
min-height: 0; // 6.
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
.isRootVertical .viewport {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
height: 100%;
|
|
108
|
+
overflow-x: hidden; // 7.
|
|
109
|
+
overflow-y: auto; // 2.
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
.isRootVertical .arrowPrev {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
113
|
+
top: 0;
|
|
114
|
+
right: 0;
|
|
115
|
+
left: 0;
|
|
116
|
+
width: 100%;
|
|
117
|
+
padding-top: $_arrow-outer-spacing;
|
|
118
|
+
padding-bottom: $_arrow-inner-spacing;
|
|
119
|
+
transform: translateY(theme.$arrow-initial-offset);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
.isRootVertical .arrowPrev .arrowIcon {
|
|
123
|
-
|
|
123
|
+
@include caret.rotate(180);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
.isRootVertical .arrowNext {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
127
|
+
right: 0;
|
|
128
|
+
bottom: 0;
|
|
129
|
+
left: 0;
|
|
130
|
+
width: 100%;
|
|
131
|
+
padding-top: $_arrow-inner-spacing;
|
|
132
|
+
padding-bottom: $_arrow-outer-spacing;
|
|
133
|
+
transform: translateY(calc(-1 * #{theme.$arrow-initial-offset}));
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
.isRootHorizontal {
|
|
137
|
-
|
|
137
|
+
min-width: 0; // 6.
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
.isRootHorizontal .arrowPrev {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
141
|
+
top: 0;
|
|
142
|
+
bottom: 0;
|
|
143
|
+
left: 0;
|
|
144
|
+
padding-right: $_arrow-inner-spacing;
|
|
145
|
+
padding-left: $_arrow-outer-spacing;
|
|
146
|
+
transform: translateX(theme.$arrow-initial-offset);
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
.isRootHorizontal .arrowPrev .arrowIcon {
|
|
150
|
-
|
|
150
|
+
@include caret.rotate(90);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
.isRootHorizontal .arrowNext {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
154
|
+
top: 0;
|
|
155
|
+
right: 0;
|
|
156
|
+
bottom: 0;
|
|
157
|
+
padding-right: $_arrow-outer-spacing;
|
|
158
|
+
padding-left: $_arrow-inner-spacing;
|
|
159
|
+
transform: translateX(calc(-1 * #{theme.$arrow-initial-offset}));
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
.isRootHorizontal .arrowNext .arrowIcon {
|
|
163
|
-
|
|
163
|
+
@include caret.rotate(270);
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
.isRootVertical .scrollingShadows::before,
|
|
167
167
|
.isRootVertical .scrollingShadows::after {
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
right: 0;
|
|
169
|
+
left: 0;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
.isRootVertical .scrollingShadows::before {
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
top: 0;
|
|
174
|
+
transform: translateY(theme.$shadow-initial-offset);
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
.isRootVertical .scrollingShadows::after {
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
bottom: 0;
|
|
179
|
+
transform: translateY(calc(-1 * #{theme.$shadow-initial-offset}));
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
.isRootHorizontal .viewport {
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
overflow-x: auto; // 2.
|
|
184
|
+
overflow-y: hidden; // 5., 7.
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
.isRootHorizontal .content {
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
display: inline-flex; // 4.
|
|
189
|
+
min-width: 100%;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
.isRootHorizontal .scrollingShadows::before,
|
|
193
193
|
.isRootHorizontal .scrollingShadows::after {
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
top: 0;
|
|
195
|
+
bottom: 0;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
.isRootHorizontal .scrollingShadows::before {
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
left: 0;
|
|
200
|
+
transform: translateX(theme.$shadow-initial-offset);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
.isRootHorizontal .scrollingShadows::after {
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
right: 0;
|
|
205
|
+
transform: translateX(calc(-1 * #{theme.$shadow-initial-offset}));
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
.isRootScrolledAtStart .scrollingShadows::before,
|
|
209
209
|
.isRootScrolledAtStart .arrowPrev {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
visibility: visible;
|
|
211
|
+
opacity: 1;
|
|
212
|
+
transform: translate(0, 0);
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
.isRootScrolledAtEnd .scrollingShadows::after,
|
|
216
216
|
.isRootScrolledAtEnd .arrowNext {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
visibility: visible;
|
|
218
|
+
opacity: 1;
|
|
219
|
+
transform: translate(0, 0);
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
.hasRootScrollbarDisabled .viewport {
|
|
223
|
-
|
|
223
|
+
@include scrollbar.hide();
|
|
224
224
|
}
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
useLayoutEffect,
|
|
3
3
|
useRef,
|
|
4
4
|
} from 'react';
|
|
5
|
-
import { getElementsPositionDifference } from '../
|
|
5
|
+
import { getElementsPositionDifference } from '../_helpers/getElementsPositionDifference';
|
|
6
6
|
|
|
7
7
|
export const useLoadResize = (effect, dependencies, contentEl, viewportEl, wait) => {
|
|
8
8
|
const throttleTimeout = useRef(null);
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
useLayoutEffect,
|
|
3
3
|
useRef,
|
|
4
4
|
} from 'react';
|
|
5
|
-
import { getElementsPositionDifference } from '../
|
|
5
|
+
import { getElementsPositionDifference } from '../_helpers/getElementsPositionDifference';
|
|
6
6
|
|
|
7
7
|
export const useScrollPosition = (effect, dependencies, contentEl, viewportEl, wait) => {
|
|
8
8
|
const throttleTimeout = useRef(null);
|
|
@@ -56,13 +56,13 @@ See [API](#api) for all available options.
|
|
|
56
56
|
## General Guidelines
|
|
57
57
|
|
|
58
58
|
- Use SelectField for **many options**. For sets of just a few options
|
|
59
|
-
(say 3 at maximum) consider using the [Radio](/components/
|
|
59
|
+
(say 3 at maximum) consider using the [Radio](/components/radio) component.
|
|
60
60
|
This will help keep your UI clean and uncluttered and prevent your users from
|
|
61
61
|
being overwhelmed by too many options.
|
|
62
62
|
|
|
63
63
|
- **Don't use for boolean** (true/false) selection or to toggle things on and
|
|
64
|
-
off. [CheckboxField](/components/
|
|
65
|
-
[Toggle](/components/
|
|
64
|
+
off. [CheckboxField](/components/checkbox-field) and
|
|
65
|
+
[Toggle](/components/toggle) are more suitable for such cases.
|
|
66
66
|
|
|
67
67
|
- Use **short and descriptive labels**, ideally nouns rather than seemingly
|
|
68
68
|
polite phrases like _Please select your favourite fruit_. Short labels will
|
|
@@ -598,7 +598,7 @@ It's possible to disable just some options or the whole input.
|
|
|
598
598
|
|
|
599
599
|
In addition to the options below, you can specify [React synthetic events] or
|
|
600
600
|
any custom HTML attributes that do not interfere with the API, and they will be
|
|
601
|
-
passed to the
|
|
601
|
+
passed to the `<select>` HTML element. This enables making the component
|
|
602
602
|
interactive and helps improve its accessibility.
|
|
603
603
|
|
|
604
604
|
<Props table of={SelectField} />
|
|
@@ -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 getRootValidationStateClassName from '../../helpers/getRootValidationStateClassName';
|
|
5
|
-
import { resolveContextOrProp } from '../../helpers/resolveContextOrProp';
|
|
6
3
|
import { withProviderContext } from '../../provider';
|
|
7
|
-
import
|
|
4
|
+
import { classNames } from '../../utils/classNames';
|
|
5
|
+
import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
|
|
6
|
+
import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
|
|
7
|
+
import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
|
|
8
|
+
import { transferProps } from '../_helpers/transferProps';
|
|
8
9
|
import { FormLayoutContext } from '../FormLayout';
|
|
9
10
|
import withForwardedRef from '../withForwardedRef';
|
|
10
11
|
import styles from './SelectField.scss';
|
|
@@ -31,27 +32,27 @@ export const SelectField = ({
|
|
|
31
32
|
|
|
32
33
|
return (
|
|
33
34
|
<label
|
|
34
|
-
className={
|
|
35
|
+
className={classNames(
|
|
35
36
|
styles.root,
|
|
36
|
-
fullWidth
|
|
37
|
-
context
|
|
37
|
+
fullWidth && styles.isRootFullWidth,
|
|
38
|
+
context && styles.isRootInFormLayout,
|
|
38
39
|
resolveContextOrProp(context && context.layout, layout) === 'horizontal'
|
|
39
40
|
? styles.rootLayoutHorizontal
|
|
40
41
|
: styles.rootLayoutVertical,
|
|
41
|
-
disabled
|
|
42
|
-
required
|
|
42
|
+
disabled && styles.isRootDisabled,
|
|
43
|
+
required && styles.isRootRequired,
|
|
43
44
|
getRootSizeClassName(size, styles),
|
|
44
45
|
getRootValidationStateClassName(validationState, styles),
|
|
45
46
|
variant === 'filled' ? styles.rootVariantFilled : styles.rootVariantOutline,
|
|
46
|
-
|
|
47
|
+
)}
|
|
47
48
|
htmlFor={id}
|
|
48
49
|
id={id && `${id}__label`}
|
|
49
50
|
>
|
|
50
51
|
<div
|
|
51
|
-
className={
|
|
52
|
+
className={classNames(
|
|
52
53
|
styles.label,
|
|
53
|
-
isLabelVisible
|
|
54
|
-
|
|
54
|
+
!isLabelVisible && styles.isLabelHidden,
|
|
55
|
+
)}
|
|
55
56
|
id={id && `${id}__labelText`}
|
|
56
57
|
>
|
|
57
58
|
{label}
|