@react-ui-org/react-ui 0.42.0 → 0.44.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. package/CONTRIBUTING.md +44 -25
  2. package/README.md +1 -1
  3. package/dist/lib.development.js +1598 -652
  4. package/dist/lib.js +1 -9
  5. package/package.json +49 -48
  6. package/src/lib/components/{ui/Alert → Alert}/Alert.jsx +17 -14
  7. package/src/lib/components/{ui/Alert → Alert}/Alert.scss +3 -3
  8. package/src/lib/components/{ui/Alert → Alert}/README.mdx +6 -6
  9. package/src/lib/components/{ui/Alert → Alert}/_settings.scss +1 -1
  10. package/src/lib/components/{ui/Alert → Alert}/_theme.scss +0 -0
  11. package/src/lib/components/{ui/Alert → Alert}/_tools.scss +0 -0
  12. package/src/lib/components/{ui/Alert → Alert}/index.js +0 -0
  13. package/src/lib/components/{ui/Badge → Badge}/Badge.jsx +2 -2
  14. package/src/lib/components/{ui/Badge → Badge}/Badge.scss +3 -3
  15. package/src/lib/components/{ui/Badge → Badge}/README.mdx +3 -3
  16. package/src/lib/components/{ui/Badge → Badge}/index.js +0 -0
  17. package/src/lib/components/Button/Button.jsx +198 -0
  18. package/src/lib/components/{ui/Button → Button}/Button.scss +0 -0
  19. package/src/lib/components/{ui/Button → Button}/README.mdx +160 -75
  20. package/src/lib/components/Button/_base.scss +148 -0
  21. package/src/lib/components/{ui/Button → Button}/_priorities.scss +0 -4
  22. package/src/lib/components/{ui/Button → Button}/_settings.scss +2 -3
  23. package/src/lib/components/{ui/Button → Button}/_theme.scss +3 -11
  24. package/src/lib/components/{ui/Button → Button}/_tools.scss +27 -44
  25. package/src/lib/components/Button/helpers/getRootLabelVisibilityClassName.js +33 -0
  26. package/src/lib/components/{ui/Button → Button}/helpers/getRootPriorityClassName.js +0 -4
  27. package/src/lib/components/{ui/Button → Button}/index.js +0 -0
  28. package/src/lib/components/{ui/ButtonGroup → ButtonGroup}/ButtonGroup.jsx +9 -11
  29. package/src/lib/components/{ui/ButtonGroup → ButtonGroup}/ButtonGroup.scss +0 -0
  30. package/src/lib/components/ButtonGroup/ButtonGroupContext.js +3 -0
  31. package/src/lib/components/{ui/ButtonGroup → ButtonGroup}/README.mdx +26 -2
  32. package/src/lib/components/ButtonGroup/index.js +2 -0
  33. package/src/lib/components/{layout/CTA → CTA}/CTA.jsx +5 -2
  34. package/src/lib/components/{layout/CTA → CTA}/CTA.scss +2 -2
  35. package/src/lib/components/{layout/CTA → CTA}/CTACenter.jsx +1 -1
  36. package/src/lib/components/{layout/CTA → CTA}/CTAEnd.jsx +1 -1
  37. package/src/lib/components/{layout/CTA → CTA}/CTAStart.jsx +1 -1
  38. package/src/lib/components/{layout/CTA → CTA}/README.mdx +3 -3
  39. package/src/lib/components/{layout/CTA → CTA}/index.js +0 -0
  40. package/src/lib/components/{ui/Card → Card}/Card.jsx +6 -4
  41. package/src/lib/components/{ui/Card → Card}/Card.scss +1 -1
  42. package/src/lib/components/{ui/Card → Card}/CardBody.jsx +1 -1
  43. package/src/lib/components/{ui/Card → Card}/CardFooter.jsx +1 -1
  44. package/src/lib/components/{ui/Card → Card}/README.mdx +2 -2
  45. package/src/lib/components/{ui/Card → Card}/_theme.scss +0 -0
  46. package/src/lib/components/{ui/Card → Card}/_tools.scss +0 -0
  47. package/src/lib/components/{ui/Card → Card}/index.js +0 -0
  48. package/src/lib/components/{layout/Center → Center}/Center.jsx +1 -1
  49. package/src/lib/components/{layout/Center → Center}/Center.scss +0 -0
  50. package/src/lib/components/{layout/Center → Center}/README.mdx +2 -2
  51. package/src/lib/components/{layout/Center → Center}/index.js +0 -0
  52. package/src/lib/components/CheckboxField/CheckboxField.jsx +164 -0
  53. package/src/lib/components/{ui/CheckboxField → CheckboxField}/CheckboxField.scss +5 -5
  54. package/src/lib/components/{ui/CheckboxField → CheckboxField}/README.mdx +15 -12
  55. package/src/lib/components/{ui/CheckboxField → CheckboxField}/index.js +0 -0
  56. package/src/lib/components/FileInputField/FileInputField.jsx +162 -0
  57. package/src/lib/components/{ui/FileInputField → FileInputField}/FileInputField.scss +5 -5
  58. package/src/lib/components/{ui/FileInputField → FileInputField}/README.mdx +8 -6
  59. package/src/lib/components/{ui/FileInputField → FileInputField}/index.js +0 -0
  60. package/src/lib/components/{layout/FormLayout → FormLayout}/FormLayout.jsx +16 -18
  61. package/src/lib/components/{layout/FormLayout → FormLayout}/FormLayout.scss +3 -3
  62. package/src/lib/components/FormLayout/FormLayoutContext.js +3 -0
  63. package/src/lib/components/{layout/FormLayout → FormLayout}/FormLayoutCustomField.jsx +33 -30
  64. package/src/lib/components/{layout/FormLayout → FormLayout}/FormLayoutCustomField.scss +4 -4
  65. package/src/lib/components/{layout/FormLayout → FormLayout}/README.mdx +30 -40
  66. package/src/lib/components/{layout/FormLayout → FormLayout}/_theme.scss +0 -0
  67. package/src/lib/components/{layout/FormLayout → FormLayout}/index.js +1 -0
  68. package/src/lib/components/{layout/Grid → Grid}/Grid.jsx +23 -5
  69. package/src/lib/components/{layout/Grid → Grid}/Grid.scss +2 -4
  70. package/src/lib/components/{layout/Grid → Grid}/GridSpan.jsx +10 -3
  71. package/src/lib/components/{layout/Grid → Grid}/README.mdx +42 -38
  72. package/src/lib/components/{layout/Grid → Grid}/_theme.scss +1 -2
  73. package/src/lib/components/{layout/Grid → Grid}/_tools.scss +2 -2
  74. package/src/lib/components/{layout/Grid → Grid}/helpers/generateResponsiveCustomProperties.js +0 -0
  75. package/src/lib/components/{layout/Grid → Grid}/index.js +0 -0
  76. package/src/lib/components/Link/Link.jsx +45 -0
  77. package/src/lib/components/Link/Link.scss +11 -0
  78. package/src/lib/components/Link/README.mdx +85 -0
  79. package/src/lib/components/Link/_theme.scss +4 -0
  80. package/src/lib/components/Link/index.js +1 -0
  81. package/src/lib/components/{layout/List → List}/List.jsx +1 -1
  82. package/src/lib/components/{layout/List → List}/List.scss +2 -2
  83. package/src/lib/components/{layout/List → List}/ListItem.jsx +1 -1
  84. package/src/lib/components/{layout/List → List}/README.mdx +2 -2
  85. package/src/lib/components/{layout/List → List}/_theme.scss +0 -0
  86. package/src/lib/components/{layout/List → List}/index.js +0 -0
  87. package/src/lib/components/{layout/Media → Media}/Media.jsx +4 -2
  88. package/src/lib/components/{layout/Media → Media}/Media.scss +1 -1
  89. package/src/lib/components/{layout/Media → Media}/MediaBody.jsx +1 -1
  90. package/src/lib/components/{layout/Media → Media}/MediaObject.jsx +1 -1
  91. package/src/lib/components/{layout/Media → Media}/README.mdx +2 -2
  92. package/src/lib/components/{layout/Media → Media}/index.js +0 -0
  93. package/src/lib/components/{ui/Modal → Modal}/Modal.jsx +28 -27
  94. package/src/lib/components/{ui/Modal → Modal}/Modal.scss +5 -5
  95. package/src/lib/components/{ui/Modal → Modal}/README.mdx +40 -40
  96. package/src/lib/components/{ui/Modal → Modal}/_settings.scss +4 -4
  97. package/src/lib/components/{ui/Modal → Modal}/_theme.scss +0 -0
  98. package/src/lib/components/{ui/Modal → Modal}/index.js +0 -0
  99. package/src/lib/components/{ui/Paper → Paper}/Paper.jsx +8 -1
  100. package/src/lib/components/{ui/Paper → Paper}/Paper.scss +5 -0
  101. package/src/lib/components/{ui/Paper → Paper}/README.mdx +14 -2
  102. package/src/lib/components/{ui/Paper → Paper}/_theme.scss +2 -0
  103. package/src/lib/components/{ui/Paper → Paper}/index.js +0 -0
  104. package/src/lib/components/{ui/Radio → Radio}/README.mdx +17 -14
  105. package/src/lib/components/Radio/Radio.jsx +188 -0
  106. package/src/lib/components/{ui/Radio → Radio}/Radio.scss +9 -9
  107. package/src/lib/components/{ui/Radio → Radio}/index.js +0 -0
  108. package/src/lib/components/{ui/ScrollView → ScrollView}/README.mdx +10 -10
  109. package/src/lib/components/{ui/ScrollView → ScrollView}/ScrollView.jsx +9 -10
  110. package/src/lib/components/{ui/ScrollView → ScrollView}/ScrollView.scss +6 -6
  111. package/src/lib/components/{ui/ScrollView → ScrollView}/_theme.scss +0 -0
  112. package/src/lib/components/{ui/ScrollView → ScrollView}/index.js +0 -0
  113. package/src/lib/components/{ui/SelectField → SelectField}/README.mdx +44 -41
  114. package/src/lib/components/SelectField/SelectField.jsx +219 -0
  115. package/src/lib/components/{ui/SelectField → SelectField}/SelectField.scss +6 -6
  116. package/src/lib/components/{ui/SelectField → SelectField}/index.js +0 -0
  117. package/src/lib/components/{ui/Table → Table}/README.mdx +7 -7
  118. package/src/lib/components/{ui/Table → Table}/Table.jsx +9 -13
  119. package/src/lib/components/{ui/Table → Table}/Table.scss +1 -1
  120. package/src/lib/components/{ui/Table → Table}/_settings.scss +4 -4
  121. package/src/lib/components/{ui/Table → Table}/index.js +0 -0
  122. package/src/lib/components/{ui/Tabs → Tabs}/README.mdx +3 -3
  123. package/src/lib/components/{ui/Tabs → Tabs}/Tabs.jsx +4 -4
  124. package/src/lib/components/{ui/Tabs → Tabs}/Tabs.scss +1 -1
  125. package/src/lib/components/{ui/Tabs → Tabs}/TabsItem.jsx +4 -3
  126. package/src/lib/components/{ui/Tabs → Tabs}/TabsItem.scss +3 -3
  127. package/src/lib/components/{ui/Tabs → Tabs}/_theme.scss +0 -0
  128. package/src/lib/components/{ui/Tabs → Tabs}/index.js +0 -0
  129. package/src/lib/components/{ui/Text → Text}/README.mdx +19 -19
  130. package/src/lib/components/{ui/Text → Text}/Text.jsx +1 -1
  131. package/src/lib/components/{ui/Text → Text}/Text.scss +0 -0
  132. package/src/lib/components/{ui/Text → Text}/helpers/getRootHyphensClassName.js +0 -0
  133. package/src/lib/components/{ui/Text → Text}/helpers/getRootWordWrappingClassName.js +0 -0
  134. package/src/lib/components/{ui/Text → Text}/index.js +0 -0
  135. package/src/lib/components/{ui/TextArea → TextArea}/README.mdx +8 -6
  136. package/src/lib/components/{ui/TextArea → TextArea}/TextArea.jsx +78 -78
  137. package/src/lib/components/{ui/TextArea → TextArea}/TextArea.scss +6 -6
  138. package/src/lib/components/{ui/TextArea → TextArea}/index.js +0 -0
  139. package/src/lib/components/{ui/TextField → TextField}/README.mdx +7 -6
  140. package/src/lib/components/{ui/TextField → TextField}/TextField.jsx +20 -23
  141. package/src/lib/components/{ui/TextField → TextField}/TextField.scss +6 -6
  142. package/src/lib/components/{ui/TextField → TextField}/index.js +0 -0
  143. package/src/lib/components/{ui/Toggle → Toggle}/README.mdx +15 -12
  144. package/src/lib/components/Toggle/Toggle.jsx +163 -0
  145. package/src/lib/components/{ui/Toggle → Toggle}/Toggle.scss +5 -5
  146. package/src/lib/components/{ui/Toggle → Toggle}/index.js +0 -0
  147. package/src/lib/components/{layout/Toolbar → Toolbar}/README.mdx +26 -26
  148. package/src/lib/components/{layout/Toolbar → Toolbar}/Toolbar.jsx +1 -1
  149. package/src/lib/components/{layout/Toolbar → Toolbar}/Toolbar.scss +1 -1
  150. package/src/lib/components/{layout/Toolbar → Toolbar}/ToolbarGroup.jsx +1 -1
  151. package/src/lib/components/{layout/Toolbar → Toolbar}/ToolbarItem.jsx +1 -1
  152. package/src/lib/components/{layout/Toolbar → Toolbar}/_theme.scss +0 -0
  153. package/src/lib/components/{layout/Toolbar → Toolbar}/index.js +0 -0
  154. package/src/lib/components/{ui/withForwardedRef.jsx → withForwardedRef.jsx} +0 -0
  155. package/src/lib/helpers/resolveContextOrProp.js +7 -0
  156. package/src/lib/index.js +34 -35
  157. package/src/lib/styles/tools/_accessibility.scss +9 -0
  158. package/src/lib/theme.scss +25 -7
  159. package/src/lib/components/ui/Button/Button.jsx +0 -191
  160. package/src/lib/components/ui/Button/_base.scss +0 -154
  161. package/src/lib/components/ui/Button/helpers/getRootLabelVisibilityClassName.js +0 -11
  162. package/src/lib/components/ui/ButtonGroup/index.js +0 -1
  163. package/src/lib/components/ui/CheckboxField/CheckboxField.jsx +0 -173
  164. package/src/lib/components/ui/FileInputField/FileInputField.jsx +0 -158
  165. package/src/lib/components/ui/Radio/Radio.jsx +0 -179
  166. package/src/lib/components/ui/SelectField/SelectField.jsx +0 -214
  167. package/src/lib/components/ui/Toggle/Toggle.jsx +0 -174
@@ -1,6 +1,6 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { withProviderContext } from '../../../provider';
3
+ import { withProviderContext } from '../../provider';
4
4
  import { generateResponsiveCustomProperties } from './helpers/generateResponsiveCustomProperties';
5
5
  import styles from './Grid.scss';
6
6
 
@@ -16,6 +16,7 @@ export const Grid = ({
16
16
  justifyItems,
17
17
  rowGap,
18
18
  rows,
19
+ tag: Tag,
19
20
  ...other
20
21
  }) => {
21
22
  if (!children) {
@@ -23,15 +24,15 @@ export const Grid = ({
23
24
  }
24
25
 
25
26
  return (
26
- <div
27
+ <Tag
27
28
  id={id}
28
29
  className={styles.root}
29
30
  style={{
30
- ...(typeof autoFlow !== 'undefined' ? { '--rui-local-auto-flow': autoFlow } : {}),
31
31
  ...generateResponsiveCustomProperties(columns, 'columns'),
32
32
  ...generateResponsiveCustomProperties(columnGap, 'column-gap'),
33
33
  ...generateResponsiveCustomProperties(rows, 'rows'),
34
34
  ...generateResponsiveCustomProperties(rowGap, 'row-gap'),
35
+ ...generateResponsiveCustomProperties(autoFlow, 'auto-flow'),
35
36
  ...generateResponsiveCustomProperties(alignContent, 'align-content'),
36
37
  ...generateResponsiveCustomProperties(alignItems, 'align-items'),
37
38
  ...generateResponsiveCustomProperties(justifyContent, 'justify-content'),
@@ -40,7 +41,7 @@ export const Grid = ({
40
41
  {...other}
41
42
  >
42
43
  {children}
43
- </div>
44
+ </Tag>
44
45
  );
45
46
  };
46
47
 
@@ -59,6 +60,7 @@ Grid.defaultProps = {
59
60
  justifyItems: undefined,
60
61
  rowGap: undefined,
61
62
  rows: undefined,
63
+ tag: 'div',
62
64
  };
63
65
 
64
66
  Grid.propTypes = {
@@ -98,7 +100,18 @@ Grid.propTypes = {
98
100
  * Grid auto-flow algorithm to be used. Accepts any valid value of `grid-auto-flow` CSS property.
99
101
  * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow) for more.
100
102
  */
101
- autoFlow: PropTypes.oneOf(['row', 'column', 'dense', 'row dense', 'column dense']),
103
+ autoFlow: PropTypes.oneOfType([
104
+ PropTypes.string,
105
+ PropTypes.shape({
106
+ xs: PropTypes.string,
107
+ sm: PropTypes.string,
108
+ md: PropTypes.string,
109
+ lg: PropTypes.string,
110
+ xl: PropTypes.string,
111
+ xxl: PropTypes.string,
112
+ xxxl: PropTypes.string,
113
+ }),
114
+ ]),
102
115
  /**
103
116
  * Items to be aligned in the grid.
104
117
  */
@@ -203,6 +216,11 @@ Grid.propTypes = {
203
216
  xxxl: PropTypes.string,
204
217
  }),
205
218
  ]),
219
+ /**
220
+ * HTML tag to render. Can be any valid HTML tag of your choice, usually a
221
+ * [block-level element](https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements).
222
+ */
223
+ tag: PropTypes.string,
206
224
  };
207
225
 
208
226
  export const GridWithContext = withProviderContext(Grid, 'Grid');
@@ -19,11 +19,9 @@
19
19
  // `--rui-local-<PROPERTY>: var(--rui-local-<PROPERTY>-sm, var(--rui-local-<PROPERTY>-xs, <INITIAL FALLBACK>))`
20
20
  //
21
21
  // 2. Apply custom property value that is defined within current breakpoint, see 1.
22
- //
23
- // 3. Any valid auto-flow algorithm can be used. It's applied globally for all breakpoints.
24
22
 
25
23
  @use 'sass:map';
26
- @use '../../../styles/tools/spacing';
24
+ @use '../../styles/tools/spacing';
27
25
  @use 'theme';
28
26
  @use 'tools';
29
27
 
@@ -34,7 +32,7 @@
34
32
  display: grid;
35
33
  grid-template-columns: var(--rui-local-columns); // 2.
36
34
  grid-template-rows: var(--rui-local-rows); // 2.
37
- grid-auto-flow: var(--rui-local-auto-flow, theme.$auto-flow); // 3.
35
+ grid-auto-flow: var(--rui-local-auto-flow, #{map.get(theme.$responsive-properties, auto-flow)}); // 2.
38
36
  grid-gap: var(--rui-local-row-gap) var(--rui-local-column-gap); // 2.
39
37
  align-content: var(--rui-local-align-content, #{map.get(theme.$responsive-properties, align-content)}); // 2.
40
38
  align-items: var(--rui-local-align-items, #{map.get(theme.$responsive-properties, align-items)}); // 2.
@@ -1,6 +1,6 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { withProviderContext } from '../../../provider';
3
+ import { withProviderContext } from '../../provider';
4
4
  import { generateResponsiveCustomProperties } from './helpers/generateResponsiveCustomProperties';
5
5
  import styles from './Grid.scss';
6
6
 
@@ -9,6 +9,7 @@ export const GridSpan = ({
9
9
  columns,
10
10
  id,
11
11
  rows,
12
+ tag: Tag,
12
13
  ...other
13
14
  }) => {
14
15
  if (!children) {
@@ -16,7 +17,7 @@ export const GridSpan = ({
16
17
  }
17
18
 
18
19
  return (
19
- <div
20
+ <Tag
20
21
  id={id}
21
22
  className={styles.span}
22
23
  style={{
@@ -26,7 +27,7 @@ export const GridSpan = ({
26
27
  {...other}
27
28
  >
28
29
  {children}
29
- </div>
30
+ </Tag>
30
31
  );
31
32
  };
32
33
 
@@ -38,6 +39,7 @@ GridSpan.defaultProps = {
38
39
  columns: undefined,
39
40
  id: undefined,
40
41
  rows: undefined,
42
+ tag: 'div',
41
43
  };
42
44
 
43
45
  GridSpan.propTypes = {
@@ -79,6 +81,11 @@ GridSpan.propTypes = {
79
81
  xxxl: PropTypes.number,
80
82
  }),
81
83
  ]),
84
+ /**
85
+ * HTML tag to render. Can be any valid HTML tag of your choice, usually a
86
+ * [block-level element](https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements).
87
+ */
88
+ tag: PropTypes.string,
82
89
  };
83
90
 
84
91
  export const GridSpanWithContext = withProviderContext(GridSpan, 'GridSpan');
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: Grid
3
3
  menu: 'Layouts'
4
- route: /components/layout/grid
4
+ route: /components/grid
5
5
  ---
6
6
 
7
7
  # Grid
@@ -10,7 +10,7 @@ import {
10
10
  Playground,
11
11
  Props,
12
12
  } from 'docz'
13
- import { Placeholder } from '../../../../docs/_components/Placeholder/Placeholder'
13
+ import { Placeholder } from '../../../docs/_components/Placeholder/Placeholder'
14
14
  import { Grid } from './Grid'
15
15
  import { GridSpan } from './GridSpan'
16
16
 
@@ -41,20 +41,12 @@ See [API](#api) for all available options.
41
41
 
42
42
  ## General Guidelines
43
43
 
44
- - This component implements native
45
- [CSS grid layout](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout),
46
- the right CSS tool for two-dimensional layouts. You may use any value accepted
47
- by
48
- [grid-template-columns](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns),
49
- [grid-template-rows](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-rows),
50
- [grid-column-gap](https://developer.mozilla.org/en-US/docs/Web/CSS/column-gap),
51
- [grid-row-gap](https://developer.mozilla.org/en-US/docs/Web/CSS/row-gap),
52
- [grid-auto-flow](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow),
53
- [align-content](https://developer.mozilla.org/en-US/docs/Web/CSS/align-content),
54
- [align-items](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items),
55
- [justify-content](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content),
56
- [justify-items](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items)
57
- and CSS properties in corresponding API options of the component.
44
+ - This component implements native [CSS grid layout][grid-layout], the right CSS
45
+ tool for two-dimensional layouts. You may use any value accepted by
46
+ [grid-template-columns], [grid-template-rows], [grid-column-gap],
47
+ [grid-row-gap], [grid-auto-flow], [align-content], [align-items],
48
+ [justify-content], [justify-items], and CSS properties in corresponding API
49
+ options of the component.
58
50
 
59
51
  - To align your items in the grid, **simply wrap** them with the Grid
60
52
  component. Unlike other grid frameworks and UI libraries, **no additional
@@ -84,9 +76,7 @@ Use `columns` and `rows` to specify your grid layout.
84
76
  </Grid>
85
77
  </Playground>
86
78
 
87
- You can use the
88
- [`repeat()`](https://developer.mozilla.org/en-US/docs/Web/CSS/repeat) function
89
- to specify a recurring pattern.
79
+ You can use the [`repeat()`][repeat] function to specify a recurring pattern.
90
80
 
91
81
  <Playground>
92
82
  <Grid columns="repeat(3, 1fr)">
@@ -99,9 +89,8 @@ to specify a recurring pattern.
99
89
  </Grid>
100
90
  </Playground>
101
91
 
102
- Combine `repeat()` with `auto-fit` and
103
- [`minmax()`](https://developer.mozilla.org/en-US/docs/Web/CSS/minmax) to build
104
- automatic responsive layouts. Resize the playground to see it in action.
92
+ Combine `repeat()` with `auto-fit` and [`minmax()`][minmax] to build automatic
93
+ responsive layouts. Resize the playground to see it in action.
105
94
 
106
95
  <Playground>
107
96
  <Grid columns="repeat(auto-fit, minmax(200px, auto))">
@@ -198,7 +187,10 @@ responsive columns and rows.
198
187
 
199
188
  <Playground>
200
189
  <Grid
201
- autoFlow="row dense"
190
+ autoFlow={{
191
+ xs: 'row dense',
192
+ sm: 'column',
193
+ }}
202
194
  columns={{
203
195
  xs: 'repeat(2, 1fr)',
204
196
  sm: 'repeat(4, 1fr)',
@@ -208,29 +200,28 @@ responsive columns and rows.
208
200
  sm: 'auto 100px auto auto',
209
201
  }}
210
202
  >
211
- <Placeholder bordered>Grid item</Placeholder>
212
- <Placeholder bordered>Grid item</Placeholder>
213
- <Placeholder bordered>Grid item</Placeholder>
214
- <Placeholder bordered>Grid item</Placeholder>
215
- <Placeholder bordered>Grid item</Placeholder>
203
+ <Placeholder bordered>Grid item 1</Placeholder>
204
+ <Placeholder bordered>Grid item 2</Placeholder>
205
+ <Placeholder bordered>Grid item 3</Placeholder>
206
+ <Placeholder bordered>Grid item 4</Placeholder>
207
+ <Placeholder bordered>Grid item 5</Placeholder>
216
208
  <GridSpan columns={2} rows={2}>
217
209
  <Placeholder bordered height="100%">
218
210
  Grid item spanning over two lines and two rows
219
211
  </Placeholder>
220
212
  </GridSpan>
221
- <Placeholder bordered>Grid item</Placeholder>
222
- <Placeholder bordered>Grid item</Placeholder>
223
- <Placeholder bordered>Grid item</Placeholder>
224
- <Placeholder bordered>Grid item</Placeholder>
225
- <Placeholder bordered>Grid item</Placeholder>
226
- <Placeholder bordered>Grid item</Placeholder>
227
- <Placeholder bordered>Grid item</Placeholder>
213
+ <Placeholder bordered>Grid item 6</Placeholder>
214
+ <Placeholder bordered>Grid item 7</Placeholder>
215
+ <Placeholder bordered>Grid item 8</Placeholder>
216
+ <Placeholder bordered>Grid item 9</Placeholder>
217
+ <Placeholder bordered>Grid item 10</Placeholder>
218
+ <Placeholder bordered>Grid item 11</Placeholder>
219
+ <Placeholder bordered>Grid item 12</Placeholder>
228
220
  </Grid>
229
221
  </Playground>
230
222
 
231
- 👉 `autoFlow` implements the `grid-auto-flow` CSS property. See
232
- [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow) to fully
233
- understand available options.
223
+ 👉 `autoFlow` (used in the example above) implements the `grid-auto-flow` CSS
224
+ property. Check [MDN][grid-auto-flow] to fully understand available options.
234
225
 
235
226
  ## API
236
227
 
@@ -255,3 +246,16 @@ Wrapper for content that should span multiple rows or columns.
255
246
  | `--rui-Grid__justify-content` | Default horizontal alignment of the layout |
256
247
  | `--rui-Grid__justify-items` | Default horizontal alignment of grid items |
257
248
  | `--rui-Grid__auto-flow` | Default auto-flow algorithm |
249
+
250
+ [grid-layout]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout
251
+ [grid-template-columns]: https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns
252
+ [grid-template-rows]: https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-rows
253
+ [grid-column-gap]: https://developer.mozilla.org/en-US/docs/Web/CSS/column-gap
254
+ [grid-row-gap]: https://developer.mozilla.org/en-US/docs/Web/CSS/row-gap
255
+ [grid-auto-flow]: https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow
256
+ [aling-content]: https://developer.mozilla.org/en-US/docs/Web/CSS/align-content
257
+ [align-items]: https://developer.mozilla.org/en-US/docs/Web/CSS/align-items
258
+ [justify-content]: https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content
259
+ [justify-items]: https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items
260
+ [repeat]: https://developer.mozilla.org/en-US/docs/Web/CSS/repeat
261
+ [minmax]: https://developer.mozilla.org/en-US/docs/Web/CSS/minmax
@@ -1,10 +1,9 @@
1
- $auto-flow: var(--rui-Grid__auto-flow);
2
-
3
1
  $responsive-properties: (
4
2
  columns: var(--rui-Grid__columns),
5
3
  column-gap: var(--rui-Grid__column-gap),
6
4
  rows: var(--rui-Grid__rows),
7
5
  row-gap: var(--rui-Grid__row-gap),
6
+ auto-flow: var(--rui-Grid__auto-flow),
8
7
  align-content: var(--rui-Grid__align-content),
9
8
  align-items: var(--rui-Grid__align-items),
10
9
  justify-content: var(--rui-Grid__justify-content),
@@ -1,6 +1,6 @@
1
1
  @use 'sass:map';
2
- @use '../../../styles/settings/breakpoints';
3
- @use '../../../styles/tools/breakpoint';
2
+ @use '../../styles/settings/breakpoints';
3
+ @use '../../styles/tools/breakpoint';
4
4
 
5
5
  // Generate fallback cascade using `var()` function fallbacks.
6
6
  //
@@ -0,0 +1,45 @@
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;
@@ -0,0 +1,11 @@
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
+ }
@@ -0,0 +1,85 @@
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
@@ -0,0 +1,4 @@
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);
@@ -0,0 +1 @@
1
+ export { default } from './Link';
@@ -1,6 +1,6 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { withProviderContext } from '../../../provider';
3
+ import { withProviderContext } from '../../provider';
4
4
  import styles from './List.scss';
5
5
 
6
6
  export const List = ({
@@ -1,5 +1,5 @@
1
- @use '../../../styles/tools/reset';
2
- @use '../../../styles/tools/spacing';
1
+ @use '../../styles/tools/reset';
2
+ @use '../../styles/tools/spacing';
3
3
  @use 'theme';
4
4
 
5
5
  .root {
@@ -1,6 +1,6 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { withProviderContext } from '../../../provider';
3
+ import { withProviderContext } from '../../provider';
4
4
  import styles from './List.scss';
5
5
 
6
6
  export const ListItem = ({ children }) => {
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: List
3
3
  menu: 'Layouts'
4
- route: /components/layout/list
4
+ route: /components/list
5
5
  ---
6
6
 
7
7
  # List
@@ -10,7 +10,7 @@ import {
10
10
  Playground,
11
11
  Props,
12
12
  } from 'docz'
13
- import { Placeholder } from '../../../../docs/_components/Placeholder/Placeholder'
13
+ import { Placeholder } from '../../../docs/_components/Placeholder/Placeholder'
14
14
  import { List } from './List'
15
15
  import { ListItem } from './ListItem'
16
16
 
@@ -1,6 +1,6 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { withProviderContext } from '../../../provider';
3
+ import { withProviderContext } from '../../provider';
4
4
  import styles from './Media.scss';
5
5
 
6
6
  export const Media = (props) => {
@@ -17,7 +17,9 @@ export const Media = (props) => {
17
17
 
18
18
  Media.propTypes = {
19
19
  /**
20
- * Slot for MediaBody and MediaObject components.
20
+ * Nested elements. Supported types are:
21
+ * * `MediaBody`
22
+ * * `MediaObject`
21
23
  */
22
24
  children: PropTypes.node.isRequired,
23
25
  };
@@ -1,4 +1,4 @@
1
- @use '../../../styles/tools/spacing';
1
+ @use '../../styles/tools/spacing';
2
2
 
3
3
  .media {
4
4
  @include spacing.bottom(layouts);
@@ -1,6 +1,6 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { withProviderContext } from '../../../provider';
3
+ import { withProviderContext } from '../../provider';
4
4
  import styles from './Media.scss';
5
5
 
6
6
  export const MediaBody = ({ children }) => (
@@ -1,6 +1,6 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { withProviderContext } from '../../../provider';
3
+ import { withProviderContext } from '../../provider';
4
4
  import styles from './Media.scss';
5
5
 
6
6
  export const MediaObject = ({ children }) => (
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: Media
3
3
  menu: 'Layouts'
4
- route: /components/layout/media
4
+ route: /components/media
5
5
  ---
6
6
 
7
7
  # Media
@@ -10,7 +10,7 @@ import {
10
10
  Playground,
11
11
  Props,
12
12
  } from 'docz'
13
- import { Placeholder } from '../../../../docs/_components/Placeholder/Placeholder'
13
+ import { Placeholder } from '../../../docs/_components/Placeholder/Placeholder'
14
14
  import { Media } from './Media'
15
15
  import { MediaBody } from './MediaBody'
16
16
  import { MediaObject } from './MediaObject'