@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.
Files changed (174) hide show
  1. package/CONTRIBUTING.md +7 -0
  2. package/dist/lib.development.js +209 -305
  3. package/dist/lib.js +1 -1
  4. package/package.json +10 -13
  5. package/src/lib/components/Alert/Alert.jsx +4 -3
  6. package/src/lib/components/Alert/Alert.scss +48 -48
  7. package/src/lib/components/Alert/_settings.scss +4 -4
  8. package/src/lib/components/Alert/_theme.scss +50 -50
  9. package/src/lib/components/Alert/_tools.scss +6 -6
  10. package/src/lib/components/Badge/Badge.jsx +6 -8
  11. package/src/lib/components/Badge/Badge.scss +57 -57
  12. package/src/lib/components/Button/Button.jsx +10 -9
  13. package/src/lib/components/Button/Button.scss +2 -2
  14. package/src/lib/components/Button/README.mdx +8 -3
  15. package/src/lib/components/Button/_base.scss +65 -65
  16. package/src/lib/components/Button/_priorities.scss +49 -49
  17. package/src/lib/components/Button/_settings.scss +10 -10
  18. package/src/lib/components/Button/_theme.scss +18 -15
  19. package/src/lib/components/Button/_tools.scss +98 -100
  20. package/src/lib/components/ButtonGroup/ButtonGroup.jsx +31 -22
  21. package/src/lib/components/ButtonGroup/ButtonGroup.scss +3 -3
  22. package/src/lib/components/ButtonGroup/README.mdx +4 -4
  23. package/src/lib/components/Card/Card.jsx +7 -6
  24. package/src/lib/components/Card/Card.scss +28 -28
  25. package/src/lib/components/Card/CardBody.jsx +5 -11
  26. package/src/lib/components/Card/CardFooter.jsx +10 -5
  27. package/src/lib/components/Card/README.mdx +2 -2
  28. package/src/lib/components/Card/_theme.scss +50 -50
  29. package/src/lib/components/Card/_tools.scss +6 -6
  30. package/src/lib/components/CheckboxField/CheckboxField.jsx +18 -17
  31. package/src/lib/components/CheckboxField/CheckboxField.scss +20 -20
  32. package/src/lib/components/CheckboxField/README.mdx +3 -3
  33. package/src/lib/components/FileInputField/FileInputField.jsx +13 -12
  34. package/src/lib/components/FileInputField/FileInputField.scss +19 -19
  35. package/src/lib/components/FileInputField/README.mdx +1 -1
  36. package/src/lib/components/FormLayout/FormLayout.jsx +16 -14
  37. package/src/lib/components/FormLayout/FormLayout.scss +17 -17
  38. package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +15 -9
  39. package/src/lib/components/FormLayout/FormLayoutCustomField.scss +18 -18
  40. package/src/lib/components/FormLayout/README.mdx +27 -49
  41. package/src/lib/components/Grid/Grid.jsx +4 -3
  42. package/src/lib/components/Grid/Grid.scss +32 -23
  43. package/src/lib/components/Grid/GridSpan.jsx +4 -3
  44. package/src/lib/components/Grid/{helpers → _helpers}/generateResponsiveCustomProperties.js +0 -2
  45. package/src/lib/components/Grid/_theme.scss +9 -9
  46. package/src/lib/components/Grid/_tools.scss +20 -20
  47. package/src/lib/components/List/List.jsx +14 -12
  48. package/src/lib/components/List/List.scss +21 -21
  49. package/src/lib/components/List/ListItem.jsx +3 -2
  50. package/src/lib/components/List/README.mdx +1 -1
  51. package/src/lib/components/Media/Media.jsx +12 -5
  52. package/src/lib/components/Media/Media.scss +6 -6
  53. package/src/lib/components/Media/MediaBody.jsx +18 -7
  54. package/src/lib/components/Media/MediaObject.jsx +18 -7
  55. package/src/lib/components/Modal/Modal.jsx +8 -6
  56. package/src/lib/components/Modal/Modal.scss +73 -73
  57. package/src/lib/components/Modal/README.mdx +2 -2
  58. package/src/lib/components/Modal/_settings.scss +5 -5
  59. package/src/lib/components/Modal/_theme.scss +17 -17
  60. package/src/lib/components/Paper/Paper.jsx +6 -6
  61. package/src/lib/components/Paper/Paper.scss +8 -8
  62. package/src/lib/components/Paper/README.mdx +1 -1
  63. package/src/lib/components/Radio/README.mdx +4 -4
  64. package/src/lib/components/Radio/Radio.jsx +12 -11
  65. package/src/lib/components/Radio/Radio.scss +26 -26
  66. package/src/lib/components/ScrollView/README.mdx +4 -1
  67. package/src/lib/components/ScrollView/ScrollView.jsx +11 -9
  68. package/src/lib/components/ScrollView/ScrollView.scss +113 -113
  69. package/src/lib/{services/elementPositionService.js → components/ScrollView/_helpers/getElementsPositionDifference.js} +0 -2
  70. package/src/lib/{hooks → components/ScrollView/_hooks}/useLoadResizeHook.js +1 -1
  71. package/src/lib/{hooks → components/ScrollView/_hooks}/useScrollPositionHook.js +1 -1
  72. package/src/lib/components/SelectField/README.mdx +4 -4
  73. package/src/lib/components/SelectField/SelectField.jsx +14 -13
  74. package/src/lib/components/SelectField/SelectField.scss +30 -30
  75. package/src/lib/components/Table/README.mdx +3 -3
  76. package/src/lib/components/Table/Table.scss +28 -35
  77. package/src/lib/components/Table/_settings.scss +5 -5
  78. package/src/lib/components/Tabs/README.mdx +1 -1
  79. package/src/lib/components/Tabs/Tabs.jsx +1 -2
  80. package/src/lib/components/Tabs/Tabs.scss +21 -21
  81. package/src/lib/components/Tabs/TabsItem.jsx +4 -3
  82. package/src/lib/components/Tabs/TabsItem.scss +78 -78
  83. package/src/lib/components/Text/README.mdx +1 -1
  84. package/src/lib/components/Text/Text.jsx +13 -6
  85. package/src/lib/components/Text/Text.scss +23 -13
  86. package/src/lib/components/Text/_helpers/getRootClampClassName.js +11 -0
  87. package/src/lib/components/Text/{helpers → _helpers}/getRootHyphensClassName.js +1 -1
  88. package/src/lib/components/Text/{helpers → _helpers}/getRootWordWrappingClassName.js +1 -1
  89. package/src/lib/components/TextArea/README.mdx +1 -1
  90. package/src/lib/components/TextArea/TextArea.jsx +18 -14
  91. package/src/lib/components/TextArea/TextArea.scss +27 -27
  92. package/src/lib/components/TextField/README.mdx +1 -1
  93. package/src/lib/components/TextField/TextField.jsx +16 -14
  94. package/src/lib/components/TextField/TextField.scss +28 -28
  95. package/src/lib/components/TextLink/README.mdx +77 -0
  96. package/src/lib/components/{Link/Link.jsx → TextLink/TextLink.jsx} +12 -13
  97. package/src/lib/components/TextLink/TextLink.scss +11 -0
  98. package/src/lib/components/TextLink/_theme.scss +4 -0
  99. package/src/lib/components/TextLink/index.js +1 -0
  100. package/src/lib/components/Toggle/README.mdx +3 -3
  101. package/src/lib/components/Toggle/Toggle.jsx +18 -17
  102. package/src/lib/components/Toggle/Toggle.scss +20 -20
  103. package/src/lib/components/Toolbar/README.mdx +19 -3
  104. package/src/lib/components/Toolbar/Toolbar.jsx +23 -14
  105. package/src/lib/components/Toolbar/Toolbar.scss +35 -30
  106. package/src/lib/components/Toolbar/ToolbarGroup.jsx +18 -13
  107. package/src/lib/components/Toolbar/ToolbarItem.jsx +26 -7
  108. package/src/lib/{helpers → components/_helpers}/getRootColorClassName.js +1 -1
  109. package/src/lib/{helpers → components/_helpers}/getRootSizeClassName.js +1 -1
  110. package/src/lib/{helpers → components/_helpers}/getRootValidationStateClassName.js +1 -1
  111. package/src/lib/components/_helpers/isChildrenEmpty.js +3 -0
  112. package/src/lib/{helpers → components/_helpers}/resolveContextOrProp.js +0 -0
  113. package/src/lib/{utils → components/_helpers}/transferProps.js +1 -1
  114. package/src/lib/foundation.scss +11 -11
  115. package/src/lib/helpers.scss +2 -2
  116. package/src/lib/index.js +4 -8
  117. package/src/lib/styles/_utilities.scss +13 -13
  118. package/src/lib/styles/elements/_code.scss +7 -7
  119. package/src/lib/styles/elements/_links.scss +8 -8
  120. package/src/lib/styles/elements/_lists.scss +3 -3
  121. package/src/lib/styles/elements/_page.scss +14 -14
  122. package/src/lib/styles/elements/_rulers.scss +6 -6
  123. package/src/lib/styles/elements/_small.scss +2 -2
  124. package/src/lib/styles/generic/_box-sizing.scss +3 -2
  125. package/src/lib/styles/generic/_forms.scss +3 -3
  126. package/src/lib/styles/generic/_reset.scss +6 -6
  127. package/src/lib/styles/generic/_shared.scss +3 -3
  128. package/src/lib/styles/helpers/_animation.scss +8 -8
  129. package/src/lib/styles/settings/_breakpoints.scss +7 -7
  130. package/src/lib/styles/settings/_escaped-characters.scss +5 -5
  131. package/src/lib/styles/settings/_form-fields.scss +24 -24
  132. package/src/lib/styles/settings/_utilities.scss +112 -100
  133. package/src/lib/styles/theme/_colors.scss +50 -50
  134. package/src/lib/styles/theme/_form-fields.scss +32 -32
  135. package/src/lib/styles/theme/_spacing.scss +11 -11
  136. package/src/lib/styles/theme/_typography.scss +12 -11
  137. package/src/lib/styles/theme-constants/_breakpoints.scss +2 -2
  138. package/src/lib/styles/theme-constants/_colors.scss +2 -2
  139. package/src/lib/styles/theme-constants/_svg.scss +1 -2
  140. package/src/lib/styles/tools/_accessibility.scss +29 -29
  141. package/src/lib/styles/tools/_breakpoint.scss +11 -14
  142. package/src/lib/styles/tools/_caret.scss +8 -8
  143. package/src/lib/styles/tools/_colors.scss +3 -3
  144. package/src/lib/styles/tools/_reset.scss +24 -21
  145. package/src/lib/styles/tools/_scrollbar.scss +4 -4
  146. package/src/lib/styles/tools/_spacing.scss +17 -21
  147. package/src/lib/styles/tools/_string.scss +9 -9
  148. package/src/lib/styles/tools/_svg.scss +13 -16
  149. package/src/lib/styles/tools/_transition.scss +42 -44
  150. package/src/lib/styles/tools/_utilities.scss +19 -19
  151. package/src/lib/styles/tools/form-fields/_box-field-elements.scss +88 -88
  152. package/src/lib/styles/tools/form-fields/_box-field-layout.scss +147 -147
  153. package/src/lib/styles/tools/form-fields/_box-field-sizes.scss +13 -15
  154. package/src/lib/styles/tools/form-fields/_foundation.scss +12 -12
  155. package/src/lib/styles/tools/form-fields/_inline-field-elements.scss +82 -71
  156. package/src/lib/styles/tools/form-fields/_inline-field-layout.scss +88 -47
  157. package/src/lib/styles/tools/form-fields/_variants.scss +104 -106
  158. package/src/lib/theme.scss +958 -954
  159. package/src/lib/utils/classNames.js +8 -0
  160. package/src/lib/components/CTA/CTA.jsx +0 -60
  161. package/src/lib/components/CTA/CTA.scss +0 -71
  162. package/src/lib/components/CTA/CTACenter.jsx +0 -27
  163. package/src/lib/components/CTA/CTAEnd.jsx +0 -27
  164. package/src/lib/components/CTA/CTAStart.jsx +0 -27
  165. package/src/lib/components/CTA/README.mdx +0 -119
  166. package/src/lib/components/CTA/index.js +0 -4
  167. package/src/lib/components/Center/Center.jsx +0 -27
  168. package/src/lib/components/Center/Center.scss +0 -7
  169. package/src/lib/components/Center/README.mdx +0 -52
  170. package/src/lib/components/Center/index.js +0 -1
  171. package/src/lib/components/Link/Link.scss +0 -11
  172. package/src/lib/components/Link/README.mdx +0 -85
  173. package/src/lib/components/Link/_theme.scss +0 -4
  174. package/src/lib/components/Link/index.js +0 -1
@@ -0,0 +1,8 @@
1
+ export const classNames = (...classes) => {
2
+ const filteredClassNames = classes.filter(
3
+ (className) => typeof className === 'string'
4
+ && className.trim().length > 0,
5
+ );
6
+
7
+ return filteredClassNames.length > 0 ? filteredClassNames.join(' ') : undefined;
8
+ };
@@ -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/layout/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,4 +0,0 @@
1
- export { default as CTA } from './CTA';
2
- export { default as CTACenter } from './CTACenter';
3
- export { default as CTAEnd } from './CTAEnd';
4
- export { default as CTAStart } from './CTAStart';
@@ -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,7 +0,0 @@
1
- .root {
2
- display: flex;
3
- align-items: center;
4
- justify-content: center;
5
- width: 100%;
6
- height: 100%;
7
- }
@@ -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&apos;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,11 +0,0 @@
1
- @use 'theme';
2
-
3
- .root {
4
- text-decoration: theme.$link-text-decoration;
5
- color: theme.$link-color;
6
-
7
- &:hover {
8
- text-decoration: theme.$link-hover-text-decoration;
9
- color: theme.$link-hover-color;
10
- }
11
- }
@@ -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/ui/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,4 +0,0 @@
1
- $link-color: var(--rui-Link__color);
2
- $link-text-decoration: var(--rui-Link__text-decoration);
3
- $link-hover-color: var(--rui-Link--hover__color);
4
- $link-hover-text-decoration: var(--rui-Link--hover__text-decoration);
@@ -1 +0,0 @@
1
- export { default } from './Link';