@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,60 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import { withProviderContext } from '../../provider';
|
4
|
-
import styles from './CTA.scss';
|
5
|
-
|
6
|
-
export const CTA = (props) => {
|
7
|
-
const {
|
8
|
-
align,
|
9
|
-
children,
|
10
|
-
} = props;
|
11
|
-
|
12
|
-
const alignClass = (value) => {
|
13
|
-
if (value === 'top') {
|
14
|
-
return styles.isAlignedToTop;
|
15
|
-
}
|
16
|
-
|
17
|
-
if (value === 'middle') {
|
18
|
-
return styles.isAlignedToMiddle;
|
19
|
-
}
|
20
|
-
|
21
|
-
if (value === 'bottom') {
|
22
|
-
return styles.isAlignedToBottom;
|
23
|
-
}
|
24
|
-
|
25
|
-
return styles.isAlignedToBaseline;
|
26
|
-
};
|
27
|
-
|
28
|
-
return (
|
29
|
-
<div
|
30
|
-
className={[
|
31
|
-
styles.root,
|
32
|
-
alignClass(align),
|
33
|
-
].join(' ')}
|
34
|
-
>
|
35
|
-
{children}
|
36
|
-
</div>
|
37
|
-
);
|
38
|
-
};
|
39
|
-
|
40
|
-
CTA.defaultProps = {
|
41
|
-
align: 'baseline',
|
42
|
-
};
|
43
|
-
|
44
|
-
CTA.propTypes = {
|
45
|
-
/**
|
46
|
-
* Vertical alignment of CTA elements.
|
47
|
-
*/
|
48
|
-
align: PropTypes.oneOf(['top', 'middle', 'bottom', 'baseline']),
|
49
|
-
/**
|
50
|
-
* Nested elements. Supported types are:
|
51
|
-
* * `CTAStart`
|
52
|
-
* * `CTACenter`
|
53
|
-
* * `CTAEnd`
|
54
|
-
*/
|
55
|
-
children: PropTypes.node.isRequired,
|
56
|
-
};
|
57
|
-
|
58
|
-
export const CTAWithContext = withProviderContext(CTA, 'CTA');
|
59
|
-
|
60
|
-
export default CTAWithContext;
|
@@ -1,71 +0,0 @@
|
|
1
|
-
@use '../../styles/tools/breakpoint';
|
2
|
-
@use '../../styles/tools/spacing';
|
3
|
-
|
4
|
-
$_breakpoint: lg;
|
5
|
-
$_spacing: spacing.of(1);
|
6
|
-
$_column-gap: spacing.of(3);
|
7
|
-
|
8
|
-
.root {
|
9
|
-
@include spacing.bottom(layouts, $compensation: $_spacing);
|
10
|
-
|
11
|
-
display: flex;
|
12
|
-
flex-wrap: wrap;
|
13
|
-
justify-content: space-between;
|
14
|
-
margin: calc(-1 * #{$_spacing});
|
15
|
-
|
16
|
-
@include breakpoint.up($_breakpoint) {
|
17
|
-
display: grid;
|
18
|
-
grid-template: 'start center end' auto #{'/'} 1fr auto 1fr;
|
19
|
-
grid-column-gap: $_column-gap;
|
20
|
-
margin: 0;
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
|
-
.start,
|
25
|
-
.center,
|
26
|
-
.end {
|
27
|
-
margin: $_spacing;
|
28
|
-
|
29
|
-
@include breakpoint.up($_breakpoint) {
|
30
|
-
margin: 0;
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
|
-
.start {
|
35
|
-
flex-basis: 100%;
|
36
|
-
|
37
|
-
@include breakpoint.up($_breakpoint) {
|
38
|
-
grid-area: start;
|
39
|
-
justify-self: start;
|
40
|
-
}
|
41
|
-
}
|
42
|
-
|
43
|
-
.center {
|
44
|
-
@include breakpoint.up($_breakpoint) {
|
45
|
-
grid-area: center;
|
46
|
-
justify-self: center;
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
.end {
|
51
|
-
@include breakpoint.up($_breakpoint) {
|
52
|
-
grid-area: end;
|
53
|
-
justify-self: end;
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
.isAlignedToTop {
|
58
|
-
align-items: start;
|
59
|
-
}
|
60
|
-
|
61
|
-
.isAlignedToMiddle {
|
62
|
-
align-items: center;
|
63
|
-
}
|
64
|
-
|
65
|
-
.isAlignedToBottom {
|
66
|
-
align-items: end;
|
67
|
-
}
|
68
|
-
|
69
|
-
.isAlignedToBaseline {
|
70
|
-
align-items: baseline;
|
71
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import { withProviderContext } from '../../provider';
|
4
|
-
import styles from './CTA.scss';
|
5
|
-
|
6
|
-
export const CTACenter = (props) => {
|
7
|
-
const {
|
8
|
-
children,
|
9
|
-
} = props;
|
10
|
-
|
11
|
-
return (
|
12
|
-
<div className={styles.center}>
|
13
|
-
{children}
|
14
|
-
</div>
|
15
|
-
);
|
16
|
-
};
|
17
|
-
|
18
|
-
CTACenter.propTypes = {
|
19
|
-
/**
|
20
|
-
* Content of the center element.
|
21
|
-
*/
|
22
|
-
children: PropTypes.node.isRequired,
|
23
|
-
};
|
24
|
-
|
25
|
-
export const CTACenterWithContext = withProviderContext(CTACenter, 'CTACenter');
|
26
|
-
|
27
|
-
export default CTACenterWithContext;
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import { withProviderContext } from '../../provider';
|
4
|
-
import styles from './CTA.scss';
|
5
|
-
|
6
|
-
export const CTAEnd = (props) => {
|
7
|
-
const {
|
8
|
-
children,
|
9
|
-
} = props;
|
10
|
-
|
11
|
-
return (
|
12
|
-
<div className={styles.end}>
|
13
|
-
{children}
|
14
|
-
</div>
|
15
|
-
);
|
16
|
-
};
|
17
|
-
|
18
|
-
CTAEnd.propTypes = {
|
19
|
-
/**
|
20
|
-
* Content of the end element.
|
21
|
-
*/
|
22
|
-
children: PropTypes.node.isRequired,
|
23
|
-
};
|
24
|
-
|
25
|
-
export const CTAEndWithContext = withProviderContext(CTAEnd, 'CTAEnd');
|
26
|
-
|
27
|
-
export default CTAEndWithContext;
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import { withProviderContext } from '../../provider';
|
4
|
-
import styles from './CTA.scss';
|
5
|
-
|
6
|
-
export const CTAStart = (props) => {
|
7
|
-
const {
|
8
|
-
children,
|
9
|
-
} = props;
|
10
|
-
|
11
|
-
return (
|
12
|
-
<div className={styles.start}>
|
13
|
-
{children}
|
14
|
-
</div>
|
15
|
-
);
|
16
|
-
};
|
17
|
-
|
18
|
-
CTAStart.propTypes = {
|
19
|
-
/**
|
20
|
-
* Content of the start element.
|
21
|
-
*/
|
22
|
-
children: PropTypes.node.isRequired,
|
23
|
-
};
|
24
|
-
|
25
|
-
export const CTAStartWithContext = withProviderContext(CTAStart, 'CTAStart');
|
26
|
-
|
27
|
-
export default CTAStartWithContext;
|
@@ -1,119 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: CTA
|
3
|
-
menu: 'Layouts'
|
4
|
-
route: /components/cta
|
5
|
-
---
|
6
|
-
|
7
|
-
# CTA
|
8
|
-
|
9
|
-
The responsive CTA layout holds an action at the center and two additional
|
10
|
-
elements on sides.
|
11
|
-
|
12
|
-
import {
|
13
|
-
Playground,
|
14
|
-
Props,
|
15
|
-
} from 'docz'
|
16
|
-
import { Placeholder } from '../../../docs/_components/Placeholder/Placeholder'
|
17
|
-
import { CTA } from './CTA'
|
18
|
-
import { CTACenter } from './CTACenter'
|
19
|
-
import { CTAEnd } from './CTAEnd'
|
20
|
-
import { CTAStart } from './CTAStart'
|
21
|
-
|
22
|
-
## Basic Usage
|
23
|
-
|
24
|
-
To implement the CTA component, you need to import it first:
|
25
|
-
|
26
|
-
```js
|
27
|
-
import { CTA } from '@react-ui-org/react-ui';
|
28
|
-
```
|
29
|
-
|
30
|
-
And use it:
|
31
|
-
|
32
|
-
<Playground>
|
33
|
-
<Placeholder bordered>
|
34
|
-
<CTA>
|
35
|
-
<CTAStart>
|
36
|
-
<Placeholder bordered>
|
37
|
-
Start
|
38
|
-
</Placeholder>
|
39
|
-
</CTAStart>
|
40
|
-
<CTACenter>
|
41
|
-
<Placeholder bordered>
|
42
|
-
Center
|
43
|
-
</Placeholder>
|
44
|
-
</CTACenter>
|
45
|
-
<CTAEnd>
|
46
|
-
<Placeholder bordered>
|
47
|
-
End
|
48
|
-
</Placeholder>
|
49
|
-
</CTAEnd>
|
50
|
-
</CTA>
|
51
|
-
</Placeholder>
|
52
|
-
</Playground>
|
53
|
-
|
54
|
-
See [API](#api) for all available options.
|
55
|
-
|
56
|
-
## General Guidelines
|
57
|
-
|
58
|
-
- The CTA (call to action) layout is designed for an **action placed at the
|
59
|
-
center** of its parent and two optional side elements. It works perfectly
|
60
|
-
especially in composition with a load-more button.
|
61
|
-
|
62
|
-
- Place rather **a few smaller elements** into the layout, so they fit the
|
63
|
-
screen even at the smallest size. For complex layouts and a lot of actions,
|
64
|
-
consider using the [Toolbar](/components/toolbar) layout.
|
65
|
-
|
66
|
-
📐 On screen sizes smaller than 66 em (the `lg`
|
67
|
-
[breakpoint](/foundation/breakpoints)), the start element expands over the full
|
68
|
-
width of its parent. Please resize your browser rather than the playground to
|
69
|
-
see this work.
|
70
|
-
|
71
|
-
## Vertical Alignment
|
72
|
-
|
73
|
-
There are four options of vertical alignment: baseline (default), top, middle,
|
74
|
-
and bottom.
|
75
|
-
|
76
|
-
<Playground>
|
77
|
-
<Placeholder bordered>
|
78
|
-
<CTA align="bottom">
|
79
|
-
<CTAStart>
|
80
|
-
<Placeholder bordered>
|
81
|
-
Start
|
82
|
-
</Placeholder>
|
83
|
-
</CTAStart>
|
84
|
-
<CTACenter>
|
85
|
-
<Placeholder bordered>
|
86
|
-
Center<br />
|
87
|
-
Element
|
88
|
-
</Placeholder>
|
89
|
-
</CTACenter>
|
90
|
-
<CTAEnd>
|
91
|
-
<Placeholder bordered>
|
92
|
-
End
|
93
|
-
</Placeholder>
|
94
|
-
</CTAEnd>
|
95
|
-
</CTA>
|
96
|
-
</Placeholder>
|
97
|
-
</Playground>
|
98
|
-
|
99
|
-
## API
|
100
|
-
|
101
|
-
<Props table of={CTA} />
|
102
|
-
|
103
|
-
### CTAStart
|
104
|
-
|
105
|
-
The start element of the CTA layout.
|
106
|
-
|
107
|
-
<Props table of={CTAStart} />
|
108
|
-
|
109
|
-
### CTACenter
|
110
|
-
|
111
|
-
The center element of the CTA layout.
|
112
|
-
|
113
|
-
<Props table of={CTACenter} />
|
114
|
-
|
115
|
-
### CTAEnd
|
116
|
-
|
117
|
-
The end element of the CTA layout.
|
118
|
-
|
119
|
-
<Props table of={CTAEnd} />
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import { withProviderContext } from '../../provider';
|
4
|
-
import styles from './Center.scss';
|
5
|
-
|
6
|
-
export const Center = ({ children }) => (
|
7
|
-
<div className={styles.root}>
|
8
|
-
<div>
|
9
|
-
{children}
|
10
|
-
</div>
|
11
|
-
</div>
|
12
|
-
);
|
13
|
-
|
14
|
-
Center.defaultProps = {
|
15
|
-
children: null,
|
16
|
-
};
|
17
|
-
|
18
|
-
Center.propTypes = {
|
19
|
-
/**
|
20
|
-
* The content to be centered.
|
21
|
-
*/
|
22
|
-
children: PropTypes.node,
|
23
|
-
};
|
24
|
-
|
25
|
-
export const CenterWithContext = withProviderContext(Center, 'Center');
|
26
|
-
|
27
|
-
export default CenterWithContext;
|
@@ -1,52 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: Center
|
3
|
-
menu: 'Layouts'
|
4
|
-
route: /components/center
|
5
|
-
---
|
6
|
-
|
7
|
-
# Center
|
8
|
-
|
9
|
-
The Center layout aligns content both horizontally and vertically.
|
10
|
-
|
11
|
-
import {
|
12
|
-
Playground,
|
13
|
-
Props,
|
14
|
-
} from 'docz'
|
15
|
-
import { Placeholder } from '../../../docs/_components/Placeholder/Placeholder'
|
16
|
-
import { Center } from './Center'
|
17
|
-
|
18
|
-
## Basic Usage
|
19
|
-
|
20
|
-
To implement the Center component, you need to import it first:
|
21
|
-
|
22
|
-
```js
|
23
|
-
import { Center } from '@react-ui-org/react-ui';
|
24
|
-
```
|
25
|
-
|
26
|
-
And use it:
|
27
|
-
|
28
|
-
<Playground>
|
29
|
-
<Placeholder height="200px" bordered>
|
30
|
-
<Center>
|
31
|
-
<Placeholder bordered>
|
32
|
-
Look, I'm centered!
|
33
|
-
</Placeholder>
|
34
|
-
</Center>
|
35
|
-
</Placeholder>
|
36
|
-
</Playground>
|
37
|
-
|
38
|
-
See [API](#api) for all available options.
|
39
|
-
|
40
|
-
## General Guidelines
|
41
|
-
|
42
|
-
- The Center takes up all **available horizontal space and expands vertically**
|
43
|
-
according to the length of its content. Depending on your layout, you may need
|
44
|
-
to define the height of its parent to see the vertical alignment work.
|
45
|
-
|
46
|
-
- The Center layout uses `flexbox` for alignment. You may need to define the
|
47
|
-
desired width of your centered content because it will be shrunk to the
|
48
|
-
smallest possible width by default.
|
49
|
-
|
50
|
-
## API
|
51
|
-
|
52
|
-
<Props table of={Center} />
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default } from './Center';
|
@@ -1,45 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import transferProps from '../../utils/transferProps';
|
4
|
-
import { withProviderContext } from '../../provider';
|
5
|
-
import styles from './Link.scss';
|
6
|
-
|
7
|
-
export const Link = ({
|
8
|
-
children,
|
9
|
-
href,
|
10
|
-
id,
|
11
|
-
...restProps
|
12
|
-
}) => (
|
13
|
-
<a
|
14
|
-
{...transferProps(restProps)}
|
15
|
-
href={href}
|
16
|
-
className={styles.root}
|
17
|
-
id={id}
|
18
|
-
>
|
19
|
-
{children}
|
20
|
-
</a>
|
21
|
-
);
|
22
|
-
|
23
|
-
Link.defaultProps = {
|
24
|
-
children: null,
|
25
|
-
id: undefined,
|
26
|
-
};
|
27
|
-
|
28
|
-
Link.propTypes = {
|
29
|
-
/**
|
30
|
-
* Content of the link.
|
31
|
-
*/
|
32
|
-
children: PropTypes.node,
|
33
|
-
/**
|
34
|
-
* Link's `href` attribute.
|
35
|
-
*/
|
36
|
-
href: PropTypes.string.isRequired,
|
37
|
-
/**
|
38
|
-
* ID of the root HTML element.
|
39
|
-
*/
|
40
|
-
id: PropTypes.string,
|
41
|
-
};
|
42
|
-
|
43
|
-
export const LinkWithContext = withProviderContext(Link, 'Link');
|
44
|
-
|
45
|
-
export default LinkWithContext;
|
@@ -1,85 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: Link
|
3
|
-
menu: 'Actions'
|
4
|
-
route: /components/link
|
5
|
-
---
|
6
|
-
|
7
|
-
# Link
|
8
|
-
|
9
|
-
import {
|
10
|
-
Playground,
|
11
|
-
Props,
|
12
|
-
} from 'docz'
|
13
|
-
import Placeholder from '../../../docs/_components/Placeholder'
|
14
|
-
import { Link } from './Link'
|
15
|
-
|
16
|
-
Link allow users to follow navigation.
|
17
|
-
|
18
|
-
## Basic Usage
|
19
|
-
|
20
|
-
To implement the Link component, you need to import it first:
|
21
|
-
|
22
|
-
```js
|
23
|
-
import { Link } from '@react-ui-org/react-ui';
|
24
|
-
```
|
25
|
-
|
26
|
-
And use it:
|
27
|
-
|
28
|
-
<Playground>
|
29
|
-
<Link href="/contribute/guidelines">How can I contribute to React UI?</Link>
|
30
|
-
</Playground>
|
31
|
-
|
32
|
-
See [API](#api) for all available options.
|
33
|
-
|
34
|
-
## General Guidelines
|
35
|
-
|
36
|
-
**Avoid using links for actions**, use a [Button](/components/button)
|
37
|
-
instead. This is because users expect navigation to happen when clicking on
|
38
|
-
something what looks like a link.
|
39
|
-
|
40
|
-
## Block-Level Content
|
41
|
-
|
42
|
-
Besides text, link can contain block-level elements too.
|
43
|
-
|
44
|
-
<Playground>
|
45
|
-
<Link href="/contribute/guidelines">
|
46
|
-
<Placeholder>Block-level element wrapped with link</Placeholder>
|
47
|
-
</Link>
|
48
|
-
</Playground>
|
49
|
-
|
50
|
-
## Custom Routing
|
51
|
-
|
52
|
-
It's common to use custom function for routing within SPAs. Use the
|
53
|
-
`onClick` option to provide such function.
|
54
|
-
|
55
|
-
<Playground>
|
56
|
-
<Link
|
57
|
-
href="/contribute/guidelines"
|
58
|
-
onClick={(event) => {
|
59
|
-
event.preventDefault();
|
60
|
-
window.location = event.currentTarget.getAttribute('href');
|
61
|
-
}}
|
62
|
-
>
|
63
|
-
This link is controlled by custom function
|
64
|
-
</Link>
|
65
|
-
</Playground>
|
66
|
-
|
67
|
-
## API
|
68
|
-
|
69
|
-
In addition to the options below, you can specify [React synthetic events] or
|
70
|
-
any custom HTML attributes that do not interfere with the API, and they will be
|
71
|
-
passed to the `a` HTML element. This enables making the component interactive
|
72
|
-
and helps improve its accessibility.
|
73
|
-
|
74
|
-
<Props table of={Link} />
|
75
|
-
|
76
|
-
## Theming
|
77
|
-
|
78
|
-
| Custom Property | Description |
|
79
|
-
|--------------------------------------|----------------------------------------------|
|
80
|
-
| `--rui-Link__color` | Text color |
|
81
|
-
| `--rui-Link__text-decoration` | Text decoration, e.g. underline |
|
82
|
-
| `--rui-Link--hover__color` | Text color on hover |
|
83
|
-
| `--rui-Link--hover__text-decoration` | Text decoration on hover |
|
84
|
-
|
85
|
-
[React synthetic events]: https://reactjs.org/docs/events.html
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default } from './Link';
|
@@ -1,71 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import { withProviderContext } from '../../provider';
|
4
|
-
import styles from './List.scss';
|
5
|
-
|
6
|
-
export const List = ({
|
7
|
-
align,
|
8
|
-
autoWidth,
|
9
|
-
children,
|
10
|
-
}) => {
|
11
|
-
if (!children) {
|
12
|
-
return null;
|
13
|
-
}
|
14
|
-
|
15
|
-
let alignClass = '';
|
16
|
-
|
17
|
-
if (align === 'start') {
|
18
|
-
alignClass = styles.alignStart;
|
19
|
-
} else if (align === 'end') {
|
20
|
-
alignClass = styles.alignEnd;
|
21
|
-
}
|
22
|
-
|
23
|
-
let autoWidthClass = '';
|
24
|
-
|
25
|
-
if (autoWidth) {
|
26
|
-
autoWidthClass = styles.isAutoWidth;
|
27
|
-
}
|
28
|
-
|
29
|
-
return (
|
30
|
-
<div
|
31
|
-
className={`
|
32
|
-
${styles.root}
|
33
|
-
${autoWidthClass}
|
34
|
-
`.trim()}
|
35
|
-
>
|
36
|
-
<ul
|
37
|
-
className={`
|
38
|
-
${styles.list}
|
39
|
-
${alignClass}
|
40
|
-
`.trim()}
|
41
|
-
>
|
42
|
-
{children}
|
43
|
-
</ul>
|
44
|
-
</div>
|
45
|
-
);
|
46
|
-
};
|
47
|
-
|
48
|
-
List.defaultProps = {
|
49
|
-
align: 'start',
|
50
|
-
autoWidth: false,
|
51
|
-
children: null,
|
52
|
-
};
|
53
|
-
|
54
|
-
List.propTypes = {
|
55
|
-
/**
|
56
|
-
* Horizontal alignment of list items.
|
57
|
-
*/
|
58
|
-
align: PropTypes.oneOf(['start', 'end']),
|
59
|
-
/**
|
60
|
-
* If `true`, the list items will take up only as much horizontal space as necessary.
|
61
|
-
*/
|
62
|
-
autoWidth: PropTypes.bool,
|
63
|
-
/**
|
64
|
-
* Individual ListItems.
|
65
|
-
*/
|
66
|
-
children: PropTypes.node,
|
67
|
-
};
|
68
|
-
|
69
|
-
export const ListWithContext = withProviderContext(List, 'List');
|
70
|
-
|
71
|
-
export default ListWithContext;
|