@react-ui-org/react-ui 0.42.1 → 0.44.1

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 +1597 -651
  4. package/dist/lib.js +1 -9
  5. package/package.json +47 -46
  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 +161 -76
  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 +30 -6
  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 +4 -4
  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 +4 -4
  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 +17 -14
  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 +37 -47
  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 +13 -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 +3 -3
  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 +42 -42
  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 +15 -3
  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 +20 -17
  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 +11 -11
  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 +47 -44
  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 +10 -10
  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 +4 -4
  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 -22
  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 +17 -14
  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 +29 -29
  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 Button from '../Button';
5
5
  import styles from './Table.scss';
6
6
 
@@ -32,7 +32,6 @@ export class Table extends React.Component {
32
32
  {sort && column.isSortable && (
33
33
  <div className={styles.sortButton}>
34
34
  <Button
35
- clickHandler={() => sort.changeHandler(column.name, sortDirection)}
36
35
  beforeLabel={
37
36
  sortDirection === 'asc'
38
37
  ? sort.ascendingIcon
@@ -40,6 +39,7 @@ export class Table extends React.Component {
40
39
  }
41
40
  label={sortDirection}
42
41
  labelVisibility="none"
42
+ onClick={() => sort.onClick(column.name, sortDirection)}
43
43
  priority="flat"
44
44
  {...(id && { id: `${id}__headerCell__${column.name}__sortButton` })}
45
45
  />
@@ -123,29 +123,25 @@ Table.propTypes = {
123
123
  name: PropTypes.string.isRequired,
124
124
  })).isRequired,
125
125
  /**
126
- * ID of the root HTML element. It also serves as a prefix for important inner elements:
127
- * `<ID>__headerCell__<COLUMN_NAME>`, `<ID>__headerCell__<COLUMN_NAME>__sortButton`, and
128
- * `<ID>__bodyCell__<COLUMN_NAME>__<ROW_ID>`.
126
+ * ID of the root HTML element. It also serves as base fo nested elements:
127
+ * * `<ID>__headerCell__<COLUMN_NAME>`
128
+ * * `<ID>__headerCell__<COLUMN_NAME>__sortButton`
129
+ * * `<ID>__bodyCell__<COLUMN_NAME>__<ROW_ID>`
129
130
  */
130
131
  id: PropTypes.string,
131
132
  /**
132
- * Table data rows paired with columns through column IDs.
133
+ * Table data rows, each object key must match a column `name`
133
134
  */
134
- rows: PropTypes.arrayOf(PropTypes.shape({
135
- id: PropTypes.oneOfType([
136
- PropTypes.number,
137
- PropTypes.string,
138
- ]).isRequired,
139
- })).isRequired,
135
+ rows: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
140
136
  /**
141
137
  * Sorting configuration required to make columns sortable.
142
138
  */
143
139
  sort: PropTypes.shape({
144
140
  ascendingIcon: PropTypes.node.isRequired,
145
- changeHandler: PropTypes.func.isRequired,
146
141
  column: PropTypes.string.isRequired,
147
142
  descendingIcon: PropTypes.node.isRequired,
148
143
  direction: PropTypes.oneOf(['asc', 'desc']).isRequired,
144
+ onClick: PropTypes.func.isRequired,
149
145
  }),
150
146
  };
151
147
 
@@ -1,4 +1,4 @@
1
- @use '../../../styles/tools/transition';
1
+ @use '../../styles/tools/transition';
2
2
  @use 'settings';
3
3
 
4
4
  // Ignore pascalCase values of `composes` property:
@@ -1,8 +1,8 @@
1
1
  @use 'sass:map';
2
- @use '../../../styles/theme/borders';
3
- @use '../../../styles/theme/colors';
4
- @use '../../../styles/theme/typography';
5
- @use '../../../styles/tools/spacing';
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);
File without changes
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: Tabs
3
- menu: 'UI'
4
- route: /components/ui/tabs
3
+ menu: 'Miscellaneous'
4
+ route: /components/tabs
5
5
  ---
6
6
 
7
7
  # Tabs
@@ -10,7 +10,7 @@ import {
10
10
  Playground,
11
11
  Props,
12
12
  } from 'docz'
13
- import { Icon } from '../../../../docs/_components/Icon/Icon'
13
+ import { Icon } from '../../../docs/_components/Icon/Icon'
14
14
  import ScrollView from '../ScrollView'
15
15
  import { Tabs } from './Tabs'
16
16
  import { TabsItem } from './TabsItem'
@@ -119,7 +119,7 @@ for each tab and don't leave some tabs without an icon.
119
119
 
120
120
  If you have more than a few tabs, you may need to make sure they will be all
121
121
  accessible no matter the space they have around. Wrap Tabs into
122
- [ScrollView](/components/ui/scroll-view) to make them scrollable if necessary.
122
+ [ScrollView](/components/scroll-view) to make them scrollable if necessary.
123
123
 
124
124
  <Playground>
125
125
  {() => {
@@ -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 './Tabs.scss';
5
5
 
6
6
  export const Tabs = ({
@@ -24,12 +24,12 @@ Tabs.defaultProps = {
24
24
 
25
25
  Tabs.propTypes = {
26
26
  /**
27
- * Individual `TabsItem`s.
27
+ * Nested `TabsItem` elements.
28
28
  */
29
29
  children: PropTypes.node,
30
30
  /**
31
- * ID of the root HTML element. It also serves as a prefix for inner list element:
32
- * `<ID>__list`.
31
+ * ID of the root HTML element. It also serves as base for nested element:
32
+ * * `<ID>__list`
33
33
  */
34
34
  id: PropTypes.string,
35
35
  };
@@ -1,6 +1,6 @@
1
1
  // 1. Decorative bottom border.
2
2
 
3
- @use '../../../styles/tools/reset';
3
+ @use '../../styles/tools/reset';
4
4
  @use 'theme';
5
5
 
6
6
  .list {
@@ -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 './TabsItem.scss';
5
5
 
6
6
  export const TabsItem = ({
@@ -63,8 +63,9 @@ TabsItem.propTypes = {
63
63
  */
64
64
  href: PropTypes.string.isRequired,
65
65
  /**
66
- * ID of the root HTML element. It also serves as a prefix for important inner elements:
67
- * `<ID>__link`, `<ID>__label`.
66
+ * ID of the root HTML element. It also serves as base for nested elements:
67
+ * * `<ID>__link`
68
+ * * `<ID>__label`
68
69
  */
69
70
  id: PropTypes.string,
70
71
  /**
@@ -1,8 +1,8 @@
1
1
  // 1. Keep inactive items under Tabs' decorative bottom border and pop active ones above it.
2
2
 
3
- @use '../../../styles/tools/breakpoint';
4
- @use '../../../styles/tools/reset';
5
- @use '../../../styles/tools/transition';
3
+ @use '../../styles/tools/breakpoint';
4
+ @use '../../styles/tools/reset';
5
+ @use '../../styles/tools/transition';
6
6
  @use 'theme';
7
7
 
8
8
  .root {
File without changes
File without changes
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: Text
3
- menu: 'UI'
4
- route: /components/ui/text
3
+ menu: 'Miscellaneous'
4
+ route: /components/text
5
5
  ---
6
6
 
7
7
  # Text
@@ -10,10 +10,10 @@ import {
10
10
  Playground,
11
11
  Props,
12
12
  } from 'docz'
13
- import { Placeholder } from '../../../../docs/_components/Placeholder/Placeholder'
14
- import { Toolbar } from '../../layout/Toolbar/Toolbar'
15
- import { ToolbarGroup } from '../../layout/Toolbar/ToolbarGroup'
16
- import { ToolbarItem } from '../../layout/Toolbar/ToolbarItem'
13
+ import { Placeholder } from '../../../docs/_components/Placeholder/Placeholder'
14
+ import { Toolbar } from '../Toolbar/Toolbar'
15
+ import { ToolbarGroup } from '../Toolbar/ToolbarGroup'
16
+ import { ToolbarItem } from '../Toolbar/ToolbarItem'
17
17
  import { Button } from '../Button/Button'
18
18
  import { ButtonGroup } from '../ButtonGroup/ButtonGroup'
19
19
  import { TextField } from '../TextField/TextField'
@@ -78,10 +78,10 @@ appended by an ellipsis (`…`).
78
78
  <Toolbar align="baseline">
79
79
  <ToolbarItem>
80
80
  <TextField
81
- changeHandler={(e) => setLines(e.target.value)}
82
81
  label="Number of lines"
83
82
  min={1}
84
83
  max={100}
84
+ onChange={(e) => setLines(e.target.value)}
85
85
  type="number"
86
86
  value={lines}
87
87
  />
@@ -156,19 +156,19 @@ will override automatic break point selection in `auto` mode when present.
156
156
  <ToolbarItem>
157
157
  <ButtonGroup aria-labelledby="#word-wrapping-options-label">
158
158
  <Button
159
- label="normal"
160
- clickHandler={() => setWordWrapping('normal')}
161
159
  color={wordWrapping === 'normal' ? 'dark' : 'primary'}
160
+ label="normal"
161
+ onClick={() => setWordWrapping('normal')}
162
162
  />
163
163
  <Button
164
- label="long-words"
165
- clickHandler={() => setWordWrapping('long-words')}
166
164
  color={wordWrapping === 'long-words' ? 'dark' : 'primary'}
165
+ label="long-words"
166
+ onClick={() => setWordWrapping('long-words')}
167
167
  />
168
168
  <Button
169
- label="anywhere"
170
- clickHandler={() => setWordWrapping('anywhere')}
171
169
  color={wordWrapping === 'anywhere' ? 'dark' : 'primary'}
170
+ label="anywhere"
171
+ onClick={() => setWordWrapping('anywhere')}
172
172
  />
173
173
  </ButtonGroup>
174
174
  </ToolbarItem>
@@ -180,19 +180,19 @@ will override automatic break point selection in `auto` mode when present.
180
180
  <ToolbarItem>
181
181
  <ButtonGroup aria-labelledby="#hyphens-options-label">
182
182
  <Button
183
- label="none"
184
- clickHandler={() => setHyphens('none')}
185
183
  color={hyphens === 'none' ? 'dark' : 'primary'}
184
+ label="none"
185
+ onClick={() => setHyphens('none')}
186
186
  />
187
187
  <Button
188
- label="auto"
189
- clickHandler={() => setHyphens('auto')}
190
188
  color={hyphens === 'auto' ? 'dark' : 'primary'}
189
+ label="auto"
190
+ onClick={() => setHyphens('auto')}
191
191
  />
192
192
  <Button
193
- label="manual"
194
- clickHandler={() => setHyphens('manual')}
195
193
  color={hyphens === 'manual' ? 'dark' : 'primary'}
194
+ label="manual"
195
+ onClick={() => setHyphens('manual')}
196
196
  />
197
197
  </ButtonGroup>
198
198
  </ToolbarItem>
@@ -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 getRootHyphensClassName from './helpers/getRootHyphensClassName';
5
5
  import getRootWordWrappingClassName from './helpers/getRootWordWrappingClassName';
6
6
  import styles from './Text.scss';
File without changes
File without changes
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: TextArea
3
- menu: 'UI'
4
- route: /components/ui/text-area
3
+ menu: 'Inputs'
4
+ route: /components/text-area
5
5
  ---
6
6
 
7
7
  # TextArea
@@ -348,10 +348,10 @@ It's possible to disable the whole input.
348
348
 
349
349
  ## API
350
350
 
351
- In addition to the options below, you can add any custom attributes that do not
352
- interfere with the API, and they will be passed to the `textarea` HTML element.
353
- This is useful mainly to improve component's
354
- [accessibility](#forwarding-html-attributes).
351
+ In addition to the options below, you can specify [React synthetic events] or
352
+ any custom HTML attributes that do not interfere with the API, and they will be
353
+ passed to the `textarea` HTML element. This enables making the component
354
+ interactive and helps improve its [accessibility](#forwarding-html-attributes).
355
355
 
356
356
  <Props table of={TextArea} />
357
357
 
@@ -359,3 +359,5 @@ This is useful mainly to improve component's
359
359
 
360
360
  Head to [Forms Theming](/customize/theming/forms) to see shared form theming
361
361
  options.
362
+
363
+ [React synthetic events]: https://reactjs.org/docs/events.html
@@ -1,21 +1,21 @@
1
1
  import PropTypes from 'prop-types';
2
- import React from 'react';
3
- import getRootSizeClassName from '../../../helpers/getRootSizeClassName';
4
- import getRootValidationStateClassName from '../../../helpers/getRootValidationStateClassName';
5
- import { withProviderContext } from '../../../provider';
6
- import transferProps from '../../../utils/transferProps';
2
+ import React, { useContext } from 'react';
3
+ import getRootSizeClassName from '../../helpers/getRootSizeClassName';
4
+ import getRootValidationStateClassName from '../../helpers/getRootValidationStateClassName';
5
+ import { resolveContextOrProp } from '../../helpers/resolveContextOrProp';
6
+ import { withProviderContext } from '../../provider';
7
+ import transferProps from '../../utils/transferProps';
8
+ import { FormLayoutContext } from '../FormLayout';
7
9
  import withForwardedRef from '../withForwardedRef';
8
10
  import styles from './TextArea.scss';
9
11
 
10
12
  export const TextArea = ({
11
- changeHandler,
12
13
  cols,
13
14
  disabled,
14
15
  forwardedRef,
15
16
  fullWidth,
16
17
  helpText,
17
18
  id,
18
- inFormLayout,
19
19
  isLabelVisible,
20
20
  label,
21
21
  layout,
@@ -28,79 +28,82 @@ export const TextArea = ({
28
28
  value,
29
29
  variant,
30
30
  ...restProps
31
- }) => (
32
- <label
33
- className={[
34
- styles.root,
35
- fullWidth ? styles.isRootFullWidth : '',
36
- inFormLayout ? styles.isRootInFormLayout : '',
37
- layout === 'horizontal' ? styles.rootLayoutHorizontal : styles.rootLayoutVertical,
38
- disabled ? styles.isRootDisabled : '',
39
- required ? styles.isRootRequired : '',
40
- getRootSizeClassName(size, styles),
41
- getRootValidationStateClassName(validationState, styles),
42
- variant === 'filled' ? styles.rootVariantFilled : styles.rootVariantOutline,
43
- ].join(' ')}
44
- htmlFor={id}
45
- id={id && `${id}__label`}
46
- >
47
- <div
31
+ }) => {
32
+ const context = useContext(FormLayoutContext);
33
+
34
+ return (
35
+ <label
48
36
  className={[
49
- styles.label,
50
- isLabelVisible ? '' : styles.isLabelHidden,
37
+ styles.root,
38
+ fullWidth ? styles.isRootFullWidth : '',
39
+ context ? styles.isRootInFormLayout : '',
40
+ resolveContextOrProp(context && context.layout, layout) === 'horizontal'
41
+ ? styles.rootLayoutHorizontal
42
+ : styles.rootLayoutVertical,
43
+ disabled ? styles.isRootDisabled : '',
44
+ required ? styles.isRootRequired : '',
45
+ getRootSizeClassName(size, styles),
46
+ getRootValidationStateClassName(validationState, styles),
47
+ variant === 'filled' ? styles.rootVariantFilled : styles.rootVariantOutline,
51
48
  ].join(' ')}
52
- id={id && `${id}__labelText`}
49
+ htmlFor={id}
50
+ id={id && `${id}__label`}
53
51
  >
54
- {label}
55
- </div>
56
- <div className={styles.field}>
57
- <div className={styles.inputContainer}>
58
- <textarea
59
- {...transferProps(restProps)}
60
- className={styles.input}
61
- cols={cols}
62
- disabled={disabled}
63
- id={id}
64
- onChange={changeHandler}
65
- placeholder={placeholder}
66
- ref={forwardedRef}
67
- required={required}
68
- rows={rows}
69
- value={value}
70
- />
71
- {variant === 'filled' && (
72
- <div className={styles.bottomLine} />
73
- )}
52
+ <div
53
+ className={[
54
+ styles.label,
55
+ isLabelVisible ? '' : styles.isLabelHidden,
56
+ ].join(' ')}
57
+ id={id && `${id}__labelText`}
58
+ >
59
+ {label}
74
60
  </div>
75
- {helpText && (
76
- <div
77
- className={styles.helpText}
78
- id={id && `${id}__helpText`}
79
- >
80
- {helpText}
81
- </div>
82
- )}
83
- {validationText && (
84
- <div
85
- className={styles.validationText}
86
- id={id && `${id}__validationText`}
87
- >
88
- {validationText}
61
+ <div className={styles.field}>
62
+ <div className={styles.inputContainer}>
63
+ <textarea
64
+ {...transferProps(restProps)}
65
+ className={styles.input}
66
+ cols={cols}
67
+ disabled={disabled}
68
+ id={id}
69
+ placeholder={placeholder}
70
+ ref={forwardedRef}
71
+ required={required}
72
+ rows={rows}
73
+ value={value}
74
+ />
75
+ {variant === 'filled' && (
76
+ <div className={styles.bottomLine} />
77
+ )}
89
78
  </div>
90
- )}
91
- </div>
92
- </label>
93
- );
79
+ {helpText && (
80
+ <div
81
+ className={styles.helpText}
82
+ id={id && `${id}__helpText`}
83
+ >
84
+ {helpText}
85
+ </div>
86
+ )}
87
+ {validationText && (
88
+ <div
89
+ className={styles.validationText}
90
+ id={id && `${id}__validationText`}
91
+ >
92
+ {validationText}
93
+ </div>
94
+ )}
95
+ </div>
96
+ </label>
97
+ );
98
+ };
94
99
 
95
100
  TextArea.defaultProps = {
96
- changeHandler: null,
97
101
  cols: null,
98
102
  disabled: false,
99
103
  forwardedRef: undefined,
100
104
  fullWidth: false,
101
105
  helpText: null,
102
106
  id: undefined,
103
- inFormLayout: false,
104
107
  isLabelVisible: true,
105
108
  layout: 'vertical',
106
109
  placeholder: null,
@@ -114,10 +117,6 @@ TextArea.defaultProps = {
114
117
  };
115
118
 
116
119
  TextArea.propTypes = {
117
- /**
118
- * Function to call when the input has changed.
119
- */
120
- changeHandler: PropTypes.func,
121
120
  /**
122
121
  * The number of visible text columns for the control.
123
122
  */
@@ -142,15 +141,13 @@ TextArea.propTypes = {
142
141
  * Optional help text.
143
142
  */
144
143
  helpText: PropTypes.node,
145
- /**
146
- * ID of the input HTML element. It also serves as a prefix for important inner elements:
147
- * `<ID>__label`, `<ID>__labelText`, and `<ID>__helpText`, and `<ID>__validationText`.
144
+ /** ID of the input HTML element. It also serves as a prefix for nested elements:
145
+ * * `<ID>__label`
146
+ * * `<ID>__labelText`
147
+ * * `<ID>__helpText`
148
+ * * `<ID>__validationText`
148
149
  */
149
150
  id: PropTypes.string,
150
- /**
151
- * Treat the field differently when it's inside a FormLayout. Do not set manually!
152
- */
153
- inFormLayout: PropTypes.bool,
154
151
  /**
155
152
  * If `false`, the label will be visually hidden (but remains accessible by assistive
156
153
  * technologies).
@@ -162,6 +159,9 @@ TextArea.propTypes = {
162
159
  label: PropTypes.string.isRequired,
163
160
  /**
164
161
  * Layout of the field.
162
+ *
163
+ * Ignored if the component is rendered within `FormLayout` component
164
+ * as the value is inherited in such case.
165
165
  */
166
166
  layout: PropTypes.oneOf(['horizontal', 'vertical']),
167
167
  /**
@@ -1,9 +1,9 @@
1
- @use '../../../styles/tools/form-fields/box-field-elements';
2
- @use '../../../styles/tools/form-fields/box-field-layout';
3
- @use '../../../styles/tools/form-fields/box-field-sizes';
4
- @use '../../../styles/tools/form-fields/foundation';
5
- @use '../../../styles/tools/form-fields/variants';
6
- @use '../../../styles/tools/accessibility';
1
+ @use '../../styles/tools/form-fields/box-field-elements';
2
+ @use '../../styles/tools/form-fields/box-field-layout';
3
+ @use '../../styles/tools/form-fields/box-field-sizes';
4
+ @use '../../styles/tools/form-fields/foundation';
5
+ @use '../../styles/tools/form-fields/variants';
6
+ @use '../../styles/tools/accessibility';
7
7
 
8
8
  // Foundation
9
9
  .root {
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: TextField
3
- menu: 'UI'
4
- route: /components/ui/text-field
3
+ menu: 'Inputs'
4
+ route: /components/text-field
5
5
  ---
6
6
 
7
7
  # TextField
@@ -491,10 +491,10 @@ It's possible to disable the whole input.
491
491
 
492
492
  ## API
493
493
 
494
- In addition to the options below, you can add any custom attributes that do not
495
- interfere with the API, and they will be passed to the `input` HTML element.
496
- This is useful mainly to improve component's
497
- [accessibility](#forwarding-html-attributes).
494
+ In addition to the options below, you can specify [React synthetic events] or
495
+ any custom HTML attributes that do not interfere with the API, and they will be
496
+ passed to the `input` HTML element. This enables making the component
497
+ interactive and helps improve its [accessibility](#forwarding-html-attributes).
498
498
 
499
499
  <Props table of={TextField} />
500
500
 
@@ -513,3 +513,4 @@ Head to [Forms Theming][theming-forms] to see shared form theming options.
513
513
  [input-tel]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/tel
514
514
  [input-password]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/password
515
515
  [theming-forms]: /customize/theming/forms
516
+ [React synthetic events]: https://reactjs.org/docs/events.html