@react-ui-org/react-ui 0.44.1 → 0.47.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CONTRIBUTING.md +7 -0
- package/README.md +15 -16
- package/dist/lib.development.js +271 -415
- package/dist/lib.js +1 -1
- package/package.json +11 -13
- package/src/lib/components/Alert/Alert.jsx +45 -44
- package/src/lib/components/Alert/Alert.scss +48 -48
- package/src/lib/components/Alert/README.mdx +2 -5
- package/src/lib/components/Alert/_settings.scss +4 -4
- package/src/lib/components/Alert/_theme.scss +50 -50
- package/src/lib/components/Alert/_tools.scss +6 -6
- package/src/lib/components/Badge/Badge.jsx +9 -11
- package/src/lib/components/Badge/Badge.scss +57 -57
- package/src/lib/components/Button/Button.jsx +14 -13
- package/src/lib/components/Button/Button.scss +2 -2
- package/src/lib/components/Button/README.mdx +11 -6
- package/src/lib/components/Button/_base.scss +69 -69
- package/src/lib/components/Button/_priorities.scss +49 -49
- package/src/lib/components/Button/_settings.scss +10 -10
- package/src/lib/components/Button/_theme.scss +18 -15
- package/src/lib/components/Button/_tools.scss +98 -100
- package/src/lib/components/Button/helpers/getRootLabelVisibilityClassName.js +4 -4
- package/src/lib/components/ButtonGroup/ButtonGroup.jsx +41 -25
- package/src/lib/components/ButtonGroup/ButtonGroup.scss +3 -3
- package/src/lib/components/ButtonGroup/README.mdx +1 -1
- package/src/lib/components/Card/Card.jsx +10 -9
- package/src/lib/components/Card/Card.scss +28 -28
- package/src/lib/components/Card/CardBody.jsx +17 -12
- package/src/lib/components/Card/CardFooter.jsx +22 -9
- package/src/lib/components/Card/_theme.scss +50 -50
- package/src/lib/components/Card/_tools.scss +6 -6
- package/src/lib/components/CheckboxField/CheckboxField.jsx +21 -20
- package/src/lib/components/CheckboxField/CheckboxField.scss +20 -20
- package/src/lib/components/CheckboxField/README.mdx +1 -1
- package/src/lib/components/FileInputField/FileInputField.jsx +16 -15
- package/src/lib/components/FileInputField/FileInputField.scss +19 -19
- package/src/lib/components/FileInputField/README.mdx +1 -1
- package/src/lib/components/FormLayout/FormLayout.jsx +19 -17
- package/src/lib/components/FormLayout/FormLayout.scss +17 -17
- package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +18 -12
- package/src/lib/components/FormLayout/FormLayoutCustomField.scss +18 -18
- package/src/lib/components/FormLayout/README.mdx +26 -49
- package/src/lib/components/Grid/Grid.jsx +25 -24
- package/src/lib/components/Grid/Grid.scss +33 -29
- package/src/lib/components/Grid/GridSpan.jsx +11 -10
- package/src/lib/components/Grid/README.mdx +46 -20
- package/src/lib/components/Grid/{helpers → _helpers}/generateResponsiveCustomProperties.js +0 -2
- package/src/lib/components/Grid/_theme.scss +9 -9
- package/src/lib/components/Grid/_tools.scss +20 -20
- package/src/lib/components/Modal/Modal.jsx +38 -32
- package/src/lib/components/Modal/Modal.scss +73 -73
- package/src/lib/components/Modal/README.mdx +2 -5
- package/src/lib/components/Modal/_settings.scss +5 -5
- package/src/lib/components/Modal/_theme.scss +17 -17
- package/src/lib/components/Paper/Paper.jsx +9 -9
- package/src/lib/components/Paper/Paper.scss +8 -8
- package/src/lib/components/Popover/Popover.jsx +94 -0
- package/src/lib/components/Popover/Popover.scss +235 -0
- package/src/lib/components/Popover/PopoverWrapper.jsx +46 -0
- package/src/lib/components/Popover/README.mdx +333 -0
- package/src/lib/components/Popover/_helpers/getRootAlignmentClassName.js +13 -0
- package/src/lib/components/Popover/_helpers/getRootSideClassName.js +17 -0
- package/src/lib/components/Popover/_theme.scss +16 -0
- package/src/lib/components/Popover/index.js +2 -0
- package/src/lib/components/Radio/README.mdx +1 -1
- package/src/lib/components/Radio/Radio.jsx +15 -14
- package/src/lib/components/Radio/Radio.scss +26 -26
- package/src/lib/components/ScrollView/README.mdx +5 -5
- package/src/lib/components/ScrollView/ScrollView.jsx +22 -22
- package/src/lib/components/ScrollView/ScrollView.scss +113 -113
- package/src/lib/{services/elementPositionService.js → components/ScrollView/_helpers/getElementsPositionDifference.js} +0 -2
- package/src/lib/{hooks → components/ScrollView/_hooks}/useLoadResizeHook.js +1 -1
- package/src/lib/{hooks → components/ScrollView/_hooks}/useScrollPositionHook.js +1 -1
- package/src/lib/components/SelectField/README.mdx +1 -1
- package/src/lib/components/SelectField/SelectField.jsx +17 -16
- package/src/lib/components/SelectField/SelectField.scss +30 -30
- package/src/lib/components/Table/README.mdx +1 -1
- package/src/lib/components/Table/Table.jsx +3 -3
- package/src/lib/components/Table/Table.scss +28 -35
- package/src/lib/components/Table/_settings.scss +5 -5
- package/src/lib/components/Tabs/Tabs.jsx +4 -5
- package/src/lib/components/Tabs/Tabs.scss +21 -21
- package/src/lib/components/Tabs/TabsItem.jsx +7 -6
- package/src/lib/components/Tabs/TabsItem.scss +78 -78
- package/src/lib/components/Text/README.mdx +3 -3
- package/src/lib/components/Text/Text.jsx +16 -9
- package/src/lib/components/Text/Text.scss +23 -13
- package/src/lib/components/Text/_helpers/getRootClampClassName.js +11 -0
- package/src/lib/components/Text/{helpers → _helpers}/getRootHyphensClassName.js +1 -1
- package/src/lib/components/Text/{helpers → _helpers}/getRootWordWrappingClassName.js +1 -1
- package/src/lib/components/TextArea/README.mdx +1 -1
- package/src/lib/components/TextArea/TextArea.jsx +21 -17
- package/src/lib/components/TextArea/TextArea.scss +27 -27
- package/src/lib/components/TextField/README.mdx +1 -1
- package/src/lib/components/TextField/TextField.jsx +19 -18
- package/src/lib/components/TextField/TextField.scss +28 -28
- package/src/lib/components/TextLink/README.mdx +77 -0
- package/src/lib/components/TextLink/TextLink.jsx +44 -0
- package/src/lib/components/TextLink/TextLink.scss +11 -0
- package/src/lib/components/TextLink/_theme.scss +4 -0
- package/src/lib/components/TextLink/index.js +1 -0
- package/src/lib/components/Toggle/README.mdx +1 -1
- package/src/lib/components/Toggle/Toggle.jsx +21 -20
- package/src/lib/components/Toggle/Toggle.scss +20 -20
- package/src/lib/components/Toolbar/README.mdx +33 -5
- package/src/lib/components/Toolbar/Toolbar.jsx +33 -17
- package/src/lib/components/Toolbar/Toolbar.scss +29 -42
- package/src/lib/components/Toolbar/ToolbarGroup.jsx +28 -16
- package/src/lib/components/Toolbar/ToolbarItem.jsx +36 -10
- package/src/lib/{helpers → components/_helpers}/getRootColorClassName.js +1 -1
- package/src/lib/{helpers → components/_helpers}/getRootSizeClassName.js +1 -1
- package/src/lib/{helpers → components/_helpers}/getRootValidationStateClassName.js +1 -1
- package/src/lib/components/_helpers/isChildrenEmpty.js +3 -0
- package/src/lib/{helpers → components/_helpers}/resolveContextOrProp.js +0 -0
- package/src/lib/{utils → components/_helpers}/transferProps.js +1 -1
- package/src/lib/foundation.scss +11 -11
- package/src/lib/helpers.scss +2 -2
- package/src/lib/index.js +8 -17
- package/src/lib/provider/index.js +2 -1
- package/src/lib/provider/withGlobalProps.jsx +21 -0
- package/src/lib/styles/_utilities.scss +13 -13
- package/src/lib/styles/elements/_code.scss +7 -7
- package/src/lib/styles/elements/_links.scss +8 -8
- package/src/lib/styles/elements/_lists.scss +3 -3
- package/src/lib/styles/elements/_page.scss +14 -14
- package/src/lib/styles/elements/_rulers.scss +6 -6
- package/src/lib/styles/elements/_small.scss +2 -2
- package/src/lib/styles/generic/_box-sizing.scss +3 -2
- package/src/lib/styles/generic/_forms.scss +3 -3
- package/src/lib/styles/generic/_reset.scss +6 -6
- package/src/lib/styles/generic/_shared.scss +3 -3
- package/src/lib/styles/helpers/_animation.scss +8 -8
- package/src/lib/styles/settings/_breakpoints.scss +7 -7
- package/src/lib/styles/settings/_escaped-characters.scss +5 -5
- package/src/lib/styles/settings/_form-fields.scss +24 -24
- package/src/lib/styles/settings/_utilities.scss +112 -100
- package/src/lib/styles/theme/_colors.scss +50 -50
- package/src/lib/styles/theme/_form-fields.scss +32 -32
- package/src/lib/styles/theme/_spacing.scss +11 -11
- package/src/lib/styles/theme/_typography.scss +12 -11
- package/src/lib/styles/theme-constants/_breakpoints.scss +4 -4
- package/src/lib/styles/theme-constants/_colors.scss +2 -2
- package/src/lib/styles/theme-constants/_svg.scss +1 -2
- package/src/lib/styles/tools/_accessibility.scss +29 -29
- package/src/lib/styles/tools/_breakpoint.scss +11 -14
- package/src/lib/styles/tools/_caret.scss +8 -8
- package/src/lib/styles/tools/_colors.scss +3 -3
- package/src/lib/styles/tools/_reset.scss +24 -21
- package/src/lib/styles/tools/_scrollbar.scss +4 -4
- package/src/lib/styles/tools/_spacing.scss +14 -22
- package/src/lib/styles/tools/_string.scss +9 -9
- package/src/lib/styles/tools/_svg.scss +13 -16
- package/src/lib/styles/tools/_transition.scss +42 -44
- package/src/lib/styles/tools/_utilities.scss +19 -19
- package/src/lib/styles/tools/form-fields/_box-field-elements.scss +88 -88
- package/src/lib/styles/tools/form-fields/_box-field-layout.scss +147 -147
- package/src/lib/styles/tools/form-fields/_box-field-sizes.scss +13 -15
- package/src/lib/styles/tools/form-fields/_foundation.scss +12 -12
- package/src/lib/styles/tools/form-fields/_inline-field-elements.scss +82 -71
- package/src/lib/styles/tools/form-fields/_inline-field-layout.scss +88 -47
- package/src/lib/styles/tools/form-fields/_variants.scss +104 -106
- package/src/lib/theme.scss +959 -954
- package/src/lib/utils/classNames.js +8 -0
- package/src/lib/components/CTA/CTA.jsx +0 -60
- package/src/lib/components/CTA/CTA.scss +0 -71
- package/src/lib/components/CTA/CTACenter.jsx +0 -27
- package/src/lib/components/CTA/CTAEnd.jsx +0 -27
- package/src/lib/components/CTA/CTAStart.jsx +0 -27
- package/src/lib/components/CTA/README.mdx +0 -119
- package/src/lib/components/CTA/index.js +0 -4
- package/src/lib/components/Center/Center.jsx +0 -27
- package/src/lib/components/Center/Center.scss +0 -7
- package/src/lib/components/Center/README.mdx +0 -52
- package/src/lib/components/Center/index.js +0 -1
- package/src/lib/components/Link/Link.jsx +0 -45
- package/src/lib/components/Link/Link.scss +0 -11
- package/src/lib/components/Link/README.mdx +0 -85
- package/src/lib/components/Link/_theme.scss +0 -4
- package/src/lib/components/Link/index.js +0 -1
- package/src/lib/components/List/List.jsx +0 -71
- package/src/lib/components/List/List.scss +0 -53
- package/src/lib/components/List/ListItem.jsx +0 -31
- package/src/lib/components/List/README.mdx +0 -114
- package/src/lib/components/List/_theme.scss +0 -1
- package/src/lib/components/List/index.js +0 -2
- package/src/lib/components/Media/Media.jsx +0 -29
- package/src/lib/components/Media/Media.scss +0 -16
- package/src/lib/components/Media/MediaBody.jsx +0 -21
- package/src/lib/components/Media/MediaObject.jsx +0 -21
- package/src/lib/components/Media/README.mdx +0 -63
- package/src/lib/components/Media/index.js +0 -3
- package/src/lib/provider/withProviderContext.jsx +0 -32
@@ -1,6 +1,6 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
|
-
import {
|
3
|
+
import { withGlobalProps } from '../../provider';
|
4
4
|
import Button from '../Button';
|
5
5
|
import styles from './Table.scss';
|
6
6
|
|
@@ -145,6 +145,6 @@ Table.propTypes = {
|
|
145
145
|
}),
|
146
146
|
};
|
147
147
|
|
148
|
-
export const
|
148
|
+
export const TableWithGlobalProps = withGlobalProps(Table, 'Table');
|
149
149
|
|
150
|
-
export default
|
150
|
+
export default TableWithGlobalProps;
|
@@ -1,59 +1,52 @@
|
|
1
|
-
@use
|
2
|
-
@use
|
3
|
-
|
4
|
-
// Ignore pascalCase values of `composes` property:
|
5
|
-
// stylelint-disable value-keyword-case
|
1
|
+
@use "../../styles/tools/transition";
|
2
|
+
@use "settings";
|
6
3
|
|
7
4
|
.table {
|
8
|
-
|
9
|
-
|
5
|
+
width: 100%;
|
6
|
+
border-collapse: collapse;
|
10
7
|
}
|
11
8
|
|
12
|
-
.tableRow
|
13
|
-
|
9
|
+
.tableRow,
|
10
|
+
.tableHeadRow {
|
11
|
+
@include transition.add((background-color));
|
12
|
+
}
|
14
13
|
|
15
|
-
|
14
|
+
.tableRow {
|
15
|
+
background-color: settings.$background-color;
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
&:hover {
|
18
|
+
background-color: settings.$hover-background-color;
|
19
|
+
}
|
20
20
|
}
|
21
21
|
|
22
22
|
.tableHeadRow {
|
23
|
-
composes: tableRow;
|
24
|
-
background-color: settings.$head-background-color;
|
25
|
-
|
26
|
-
&:hover {
|
27
23
|
background-color: settings.$head-background-color;
|
28
|
-
}
|
29
|
-
}
|
30
|
-
|
31
|
-
.tableCell {
|
32
|
-
padding: settings.$cell-padding-y settings.$cell-padding-x;
|
33
|
-
text-align: left;
|
34
|
-
border-bottom: settings.$border-width solid settings.$border-color;
|
35
|
-
}
|
36
24
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
border-bottom-width: 2px;
|
25
|
+
&:hover {
|
26
|
+
background-color: settings.$head-background-color;
|
27
|
+
}
|
41
28
|
}
|
42
29
|
|
30
|
+
.tableCell,
|
31
|
+
.tableHeadCell,
|
43
32
|
.isTableCellSortingActive,
|
44
33
|
.isTableHeadCellSortingActive {
|
45
|
-
|
34
|
+
padding: settings.$cell-padding-y settings.$cell-padding-x;
|
35
|
+
text-align: left;
|
36
|
+
border-bottom: settings.$border-width solid settings.$border-color;
|
46
37
|
}
|
47
38
|
|
48
|
-
.
|
49
|
-
|
39
|
+
.tableHeadCell {
|
40
|
+
font-weight: settings.$head-font-weight;
|
41
|
+
border-bottom-width: 2px;
|
50
42
|
}
|
51
43
|
|
44
|
+
.isTableCellSortingActive,
|
52
45
|
.isTableHeadCellSortingActive {
|
53
|
-
|
46
|
+
background-color: settings.$sorted-background-color;
|
54
47
|
}
|
55
48
|
|
56
49
|
.sortButton {
|
57
|
-
|
58
|
-
|
50
|
+
display: inline-block;
|
51
|
+
margin-right: settings.$cell-padding-x;
|
59
52
|
}
|
@@ -1,8 +1,8 @@
|
|
1
|
-
@use
|
2
|
-
@use
|
3
|
-
@use
|
4
|
-
@use
|
5
|
-
@use
|
1
|
+
@use "sass:map";
|
2
|
+
@use "../../styles/theme/borders";
|
3
|
+
@use "../../styles/theme/colors";
|
4
|
+
@use "../../styles/theme/typography";
|
5
|
+
@use "../../styles/tools/spacing";
|
6
6
|
|
7
7
|
$cell-padding-x: spacing.of(3);
|
8
8
|
$cell-padding-y: spacing.of(1);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
|
-
import {
|
3
|
+
import { withGlobalProps } from '../../provider';
|
4
4
|
import styles from './Tabs.scss';
|
5
5
|
|
6
6
|
export const Tabs = ({
|
@@ -18,7 +18,6 @@ export const Tabs = ({
|
|
18
18
|
);
|
19
19
|
|
20
20
|
Tabs.defaultProps = {
|
21
|
-
children: null,
|
22
21
|
id: undefined,
|
23
22
|
};
|
24
23
|
|
@@ -26,7 +25,7 @@ Tabs.propTypes = {
|
|
26
25
|
/**
|
27
26
|
* Nested `TabsItem` elements.
|
28
27
|
*/
|
29
|
-
children: PropTypes.node,
|
28
|
+
children: PropTypes.node.isRequired,
|
30
29
|
/**
|
31
30
|
* ID of the root HTML element. It also serves as base for nested element:
|
32
31
|
* * `<ID>__list`
|
@@ -34,6 +33,6 @@ Tabs.propTypes = {
|
|
34
33
|
id: PropTypes.string,
|
35
34
|
};
|
36
35
|
|
37
|
-
export const
|
36
|
+
export const TabsWithGlobalProps = withGlobalProps(Tabs, 'Tabs');
|
38
37
|
|
39
|
-
export default
|
38
|
+
export default TabsWithGlobalProps;
|
@@ -1,28 +1,28 @@
|
|
1
1
|
// 1. Decorative bottom border.
|
2
2
|
|
3
|
-
@use
|
4
|
-
@use
|
3
|
+
@use "../../styles/tools/reset";
|
4
|
+
@use "theme";
|
5
5
|
|
6
6
|
.list {
|
7
|
-
|
7
|
+
@include reset.list();
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
position: relative;
|
10
|
+
display: inline-flex;
|
11
|
+
min-width: 100%;
|
12
|
+
padding-right: theme.$padding-x;
|
13
|
+
padding-left: theme.$padding-x;
|
14
|
+
overflow-y: hidden;
|
15
|
+
white-space: nowrap;
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
17
|
+
// 1.
|
18
|
+
&::after {
|
19
|
+
content: "";
|
20
|
+
position: absolute;
|
21
|
+
right: 0;
|
22
|
+
bottom: 0;
|
23
|
+
left: 0;
|
24
|
+
z-index: 1;
|
25
|
+
height: theme.$border-bottom-width;
|
26
|
+
background-color: theme.$border-bottom-color;
|
27
|
+
}
|
28
28
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
|
-
import {
|
3
|
+
import { withGlobalProps } from '../../provider';
|
4
|
+
import { classNames } from '../../utils/classNames';
|
4
5
|
import styles from './TabsItem.scss';
|
5
6
|
|
6
7
|
export const TabsItem = ({
|
@@ -13,10 +14,10 @@ export const TabsItem = ({
|
|
13
14
|
onClick,
|
14
15
|
}) => (
|
15
16
|
<li
|
16
|
-
className={
|
17
|
+
className={classNames(
|
17
18
|
styles.root,
|
18
|
-
isActive
|
19
|
-
|
19
|
+
isActive && styles.isRootActive,
|
20
|
+
)}
|
20
21
|
id={id}
|
21
22
|
key={href}
|
22
23
|
>
|
@@ -82,6 +83,6 @@ TabsItem.propTypes = {
|
|
82
83
|
onClick: PropTypes.func,
|
83
84
|
};
|
84
85
|
|
85
|
-
export const
|
86
|
+
export const TabsItemWithGlobalProps = withGlobalProps(TabsItem, 'TabsItem');
|
86
87
|
|
87
|
-
export default
|
88
|
+
export default TabsItemWithGlobalProps;
|
@@ -1,118 +1,118 @@
|
|
1
1
|
// 1. Keep inactive items under Tabs' decorative bottom border and pop active ones above it.
|
2
2
|
|
3
|
-
@use
|
4
|
-
@use
|
5
|
-
@use
|
6
|
-
@use
|
3
|
+
@use "../../styles/tools/breakpoint";
|
4
|
+
@use "../../styles/tools/reset";
|
5
|
+
@use "../../styles/tools/transition";
|
6
|
+
@use "theme";
|
7
7
|
|
8
8
|
.root {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
&:not(:last-child) {
|
24
|
-
margin-right: theme.$gap-xs;
|
25
|
-
}
|
9
|
+
@include transition.add(transform);
|
10
|
+
|
11
|
+
position: relative; // 1.
|
12
|
+
z-index: 1; // 1.
|
13
|
+
flex: none;
|
14
|
+
padding-top: calc(-1 * #{theme.$item-active-shift-y});
|
15
|
+
margin-bottom: theme.$item-active-shift-y;
|
16
|
+
transform: translateY(0);
|
17
|
+
|
18
|
+
&:hover,
|
19
|
+
&:focus-within {
|
20
|
+
transform: translateY(theme.$item-hover-shift-y);
|
21
|
+
}
|
26
22
|
|
27
|
-
@include breakpoint.up(sm) {
|
28
23
|
&:not(:last-child) {
|
29
|
-
|
24
|
+
margin-right: theme.$gap-xs;
|
30
25
|
}
|
31
|
-
}
|
32
26
|
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
@include breakpoint.up(sm) {
|
28
|
+
&:not(:last-child) {
|
29
|
+
margin-right: theme.$gap-sm;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
@include breakpoint.up(md) {
|
34
|
+
&:not(:last-child) {
|
35
|
+
margin-right: theme.$gap-md;
|
36
|
+
}
|
36
37
|
}
|
37
|
-
}
|
38
38
|
}
|
39
39
|
|
40
40
|
.link {
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
41
|
+
@include reset.link();
|
42
|
+
@include transition.add((color, border-color, background-color, box-shadow));
|
43
|
+
|
44
|
+
display: block;
|
45
|
+
padding: theme.$item-padding-xs;
|
46
|
+
font-weight: theme.$item-font-weight;
|
47
|
+
line-height: 1;
|
48
|
+
text-decoration: none;
|
49
|
+
color: theme.$item-color;
|
50
|
+
border-width: theme.$item-border-width;
|
51
|
+
border-style: 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
75
|
}
|
76
76
|
|
77
77
|
.linkContent {
|
78
|
-
|
78
|
+
@include transition.add(transform);
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
display: flex;
|
81
|
+
align-items: center;
|
82
|
+
transform: translateY(0);
|
83
83
|
}
|
84
84
|
|
85
85
|
.label:not(:first-child) {
|
86
|
-
|
86
|
+
margin-left: theme.$item-icon-gap;
|
87
87
|
}
|
88
88
|
|
89
89
|
.label:not(:last-child) {
|
90
|
-
|
90
|
+
margin-right: theme.$item-icon-gap;
|
91
91
|
}
|
92
92
|
|
93
93
|
.isRootActive,
|
94
94
|
.isRootActive:hover,
|
95
95
|
.isRootActive:focus-within {
|
96
|
-
|
97
|
-
|
96
|
+
z-index: 2; // 1.
|
97
|
+
transform: translateY(theme.$item-active-shift-y);
|
98
98
|
}
|
99
99
|
|
100
100
|
.isRootActive .link {
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
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
107
|
}
|
108
108
|
|
109
109
|
.link:hover .linkContent,
|
110
110
|
.link:focus .linkContent {
|
111
|
-
|
111
|
+
transform: translateY(theme.$item-hover-label-shift-y);
|
112
112
|
}
|
113
113
|
|
114
114
|
.isRootActive .link .linkContent,
|
115
115
|
.isRootActive .link:hover .linkContent,
|
116
116
|
.isRootActive .link:focus .linkContent {
|
117
|
-
|
117
|
+
transform: translateY(theme.$item-active-label-shift-y);
|
118
118
|
}
|
@@ -81,7 +81,7 @@ appended by an ellipsis (`…`).
|
|
81
81
|
label="Number of lines"
|
82
82
|
min={1}
|
83
83
|
max={100}
|
84
|
-
onChange={(e) => setLines(e.target.value)}
|
84
|
+
onChange={(e) => setLines(Number(e.target.value))}
|
85
85
|
type="number"
|
86
86
|
value={lines}
|
87
87
|
/>
|
@@ -154,7 +154,7 @@ will override automatic break point selection in `auto` mode when present.
|
|
154
154
|
<span id="word-wrapping-options-label">Word wrapping:</span>
|
155
155
|
</ToolbarItem>
|
156
156
|
<ToolbarItem>
|
157
|
-
<ButtonGroup aria-labelledby="
|
157
|
+
<ButtonGroup aria-labelledby="word-wrapping-options-label">
|
158
158
|
<Button
|
159
159
|
color={wordWrapping === 'normal' ? 'dark' : 'primary'}
|
160
160
|
label="normal"
|
@@ -178,7 +178,7 @@ will override automatic break point selection in `auto` mode when present.
|
|
178
178
|
<span id="hyphens-options-label">Hyphens:</span>
|
179
179
|
</ToolbarItem>
|
180
180
|
<ToolbarItem>
|
181
|
-
<ButtonGroup aria-labelledby="
|
181
|
+
<ButtonGroup aria-labelledby="hyphens-options-label">
|
182
182
|
<Button
|
183
183
|
color={hyphens === 'none' ? 'dark' : 'primary'}
|
184
184
|
label="none"
|
@@ -1,8 +1,11 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
|
-
import {
|
4
|
-
import
|
5
|
-
import
|
3
|
+
import { withGlobalProps } from '../../provider';
|
4
|
+
import { classNames } from '../../utils/classNames';
|
5
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
6
|
+
import { getRootClampClassName } from './_helpers/getRootClampClassName';
|
7
|
+
import { getRootHyphensClassName } from './_helpers/getRootHyphensClassName';
|
8
|
+
import { getRootWordWrappingClassName } from './_helpers/getRootWordWrappingClassName';
|
6
9
|
import styles from './Text.scss';
|
7
10
|
|
8
11
|
export const Text = ({
|
@@ -13,19 +16,23 @@ export const Text = ({
|
|
13
16
|
lines,
|
14
17
|
wordWrapping,
|
15
18
|
}) => {
|
19
|
+
if (isChildrenEmpty(children)) {
|
20
|
+
return null;
|
21
|
+
}
|
22
|
+
|
16
23
|
const HtmlElement = blockLevel ? 'div' : 'span';
|
17
24
|
|
18
25
|
return (
|
19
26
|
<HtmlElement
|
20
27
|
className={(hyphens !== 'none' || lines > 0 || wordWrapping !== 'normal')
|
21
|
-
?
|
22
|
-
(lines
|
28
|
+
? classNames(
|
29
|
+
getRootClampClassName(lines, styles),
|
23
30
|
getRootHyphensClassName(hyphens, styles),
|
24
31
|
getRootWordWrappingClassName(wordWrapping, styles),
|
25
|
-
|
32
|
+
)
|
26
33
|
: undefined}
|
27
34
|
id={id}
|
28
|
-
style={(lines >
|
35
|
+
style={(lines > 1) ? { '--rui-custom-lines': lines } : undefined}
|
29
36
|
>
|
30
37
|
{children}
|
31
38
|
</HtmlElement>
|
@@ -68,6 +75,6 @@ Text.propTypes = {
|
|
68
75
|
wordWrapping: PropTypes.oneOf(['normal', 'long-words', 'anywhere']),
|
69
76
|
};
|
70
77
|
|
71
|
-
export const
|
78
|
+
export const TextWithGlobalProps = withGlobalProps(Text, 'Text');
|
72
79
|
|
73
|
-
export default
|
80
|
+
export default TextWithGlobalProps;
|
@@ -1,30 +1,40 @@
|
|
1
1
|
// 1. `word-break: break-word` is deprecated in favour of `overflow-wrap: anywhere`, but it's still
|
2
2
|
// required for Safari.
|
3
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.
|
4
7
|
|
5
|
-
|
6
|
-
.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
overflow: hidden;
|
11
|
-
text-overflow: ellipsis;
|
8
|
+
.rootClampSingleLine {
|
9
|
+
display: block; // 2.
|
10
|
+
overflow: hidden;
|
11
|
+
text-overflow: ellipsis;
|
12
|
+
white-space: nowrap;
|
12
13
|
}
|
13
|
-
|
14
|
+
|
15
|
+
// stylelint-disable property-no-vendor-prefix, value-no-vendor-prefix
|
16
|
+
.rootClampMultiLine {
|
17
|
+
display: -webkit-box; // 2.
|
18
|
+
-webkit-line-clamp: var(--rui-custom-lines);
|
19
|
+
-webkit-box-orient: vertical;
|
20
|
+
overflow: hidden;
|
21
|
+
text-overflow: ellipsis;
|
22
|
+
}
|
23
|
+
// stylelint-enable property-no-vendor-prefix, value-no-vendor-prefix
|
14
24
|
|
15
25
|
.rootHyphensAuto {
|
16
|
-
|
26
|
+
hyphens: auto;
|
17
27
|
}
|
18
28
|
|
19
29
|
.rootHyphensManual {
|
20
|
-
|
30
|
+
hyphens: manual;
|
21
31
|
}
|
22
32
|
|
23
33
|
.rootWordWrappingAnywhere {
|
24
|
-
|
34
|
+
word-break: break-all;
|
25
35
|
}
|
26
36
|
|
27
37
|
.rootWordWrappingLongWords {
|
28
|
-
|
29
|
-
|
38
|
+
word-break: break-word; // 1.
|
39
|
+
overflow-wrap: anywhere;
|
30
40
|
}
|
@@ -350,7 +350,7 @@ It's possible to disable the whole input.
|
|
350
350
|
|
351
351
|
In addition to the options below, you can specify [React synthetic events] or
|
352
352
|
any custom HTML attributes that do not interfere with the API, and they will be
|
353
|
-
passed to the
|
353
|
+
passed to the `<textarea>` HTML element. This enables making the component
|
354
354
|
interactive and helps improve its [accessibility](#forwarding-html-attributes).
|
355
355
|
|
356
356
|
<Props table of={TextArea} />
|