@react-ui-org/react-ui 0.52.1 → 0.54.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. package/README.md +10 -7
  2. package/dist/react-ui.css +5 -3
  3. package/dist/react-ui.development.css +11302 -0
  4. package/dist/react-ui.development.js +1588 -0
  5. package/dist/react-ui.js +1 -1
  6. package/package.json +66 -77
  7. package/src/{lib/components → components}/Alert/Alert.jsx +1 -1
  8. package/src/{lib/components/Alert/README.mdx → components/Alert/README.md} +84 -100
  9. package/src/{lib/components → components}/Badge/Badge.jsx +1 -1
  10. package/src/{lib/components → components}/Badge/Badge.scss +1 -1
  11. package/src/components/Badge/README.md +103 -0
  12. package/src/{lib/components → components}/Button/Button.jsx +1 -1
  13. package/src/components/Button/README.md +580 -0
  14. package/src/{lib/components → components}/ButtonGroup/ButtonGroup.jsx +11 -9
  15. package/src/{lib/components/ButtonGroup/README.mdx → components/ButtonGroup/README.md} +128 -134
  16. package/src/{lib/components → components}/Card/Card.jsx +1 -1
  17. package/src/components/Card/README.md +314 -0
  18. package/src/{lib/components/CheckboxField/README.mdx → components/CheckboxField/README.md} +96 -108
  19. package/src/{lib/components/FileInputField/README.mdx → components/FileInputField/README.md} +83 -95
  20. package/src/{lib/components → components}/FormLayout/FormLayout.jsx +4 -4
  21. package/src/components/FormLayout/README.md +462 -0
  22. package/src/{lib/components → components}/Grid/Grid.jsx +2 -2
  23. package/src/components/Grid/README.md +281 -0
  24. package/src/{lib/components → components}/InputGroup/InputGroup.jsx +28 -19
  25. package/src/{lib/components → components}/InputGroup/InputGroup.scss +4 -5
  26. package/src/{lib/components/InputGroup/README.mdx → components/InputGroup/README.md} +162 -165
  27. package/src/{lib/components → components}/Modal/Modal.jsx +6 -6
  28. package/src/components/Modal/README.md +1090 -0
  29. package/src/components/Modal/_hooks/useModalScrollPrevention.js +37 -0
  30. package/src/{lib/components/Paper/README.mdx → components/Paper/README.md} +18 -30
  31. package/src/{lib/components/Popover/README.mdx → components/Popover/README.md} +102 -132
  32. package/src/{lib/components/Radio/README.mdx → components/Radio/README.md} +122 -134
  33. package/src/{lib/components → components}/Radio/Radio.jsx +11 -12
  34. package/src/{lib/components → components}/Radio/Radio.scss +0 -5
  35. package/src/components/ScrollView/README.md +503 -0
  36. package/src/{lib/components → components}/ScrollView/ScrollView.jsx +12 -3
  37. package/src/components/SelectField/README.md +681 -0
  38. package/src/components/Table/README.md +259 -0
  39. package/src/{lib/components → components}/Table/Table.jsx +4 -1
  40. package/src/{lib/components → components}/Table/_components/TableHeaderCell/TableHeaderCell.jsx +1 -1
  41. package/src/{lib/components/Tabs/README.mdx → components/Tabs/README.md} +117 -134
  42. package/src/{lib/components → components}/Tabs/TabsItem.jsx +3 -3
  43. package/src/components/Text/README.md +220 -0
  44. package/src/components/TextArea/README.md +359 -0
  45. package/src/{lib/components/TextField/README.mdx → components/TextField/README.md} +336 -342
  46. package/src/{lib/components/TextLink/README.mdx → components/TextLink/README.md} +19 -31
  47. package/src/{lib/components/Toggle/README.mdx → components/Toggle/README.md} +98 -110
  48. package/src/components/Toolbar/README.md +359 -0
  49. package/src/{lib/components → components}/Toolbar/_helpers/getAlignClassName.js +12 -4
  50. package/src/components/_helpers/getRootPriorityClassName.js +15 -0
  51. package/src/{lib/index.js → index.js} +6 -0
  52. package/src/{lib/provider → provider}/RUIProvider.jsx +17 -11
  53. package/src/{lib/styles → styles}/tools/_caret.scss +1 -1
  54. package/src/{lib/styles → styles}/tools/form-fields/_box-field-elements.scss +1 -1
  55. package/src/{lib/styles → styles}/tools/form-fields/_inline-field-elements.scss +2 -2
  56. package/src/{lib/theme.scss → theme.scss} +4 -3
  57. package/CONTRIBUTING.md +0 -137
  58. package/dist/lib.development.js +0 -3179
  59. package/dist/lib.js +0 -1
  60. package/public/racom.svg +0 -11
  61. package/src/lib/components/Badge/README.mdx +0 -126
  62. package/src/lib/components/Button/README.mdx +0 -581
  63. package/src/lib/components/Card/README.mdx +0 -326
  64. package/src/lib/components/FormLayout/README.mdx +0 -501
  65. package/src/lib/components/Grid/README.mdx +0 -299
  66. package/src/lib/components/Modal/README.mdx +0 -1360
  67. package/src/lib/components/Modal/_hooks/useModalScrollPrevention.js +0 -35
  68. package/src/lib/components/ScrollView/README.mdx +0 -521
  69. package/src/lib/components/SelectField/README.mdx +0 -693
  70. package/src/lib/components/Table/README.mdx +0 -275
  71. package/src/lib/components/Text/README.mdx +0 -241
  72. package/src/lib/components/TextArea/README.mdx +0 -366
  73. package/src/lib/components/Toolbar/README.mdx +0 -386
  74. package/src/{lib/components → components}/Alert/Alert.scss +0 -0
  75. package/src/{lib/components → components}/Alert/_settings.scss +0 -0
  76. package/src/{lib/components → components}/Alert/_theme.scss +0 -0
  77. package/src/{lib/components → components}/Alert/_tools.scss +0 -0
  78. package/src/{lib/components → components}/Alert/index.js +0 -0
  79. package/src/{lib/components → components}/Badge/index.js +0 -0
  80. package/src/{lib/components → components}/Button/Button.scss +0 -0
  81. package/src/{lib/components → components}/Button/_base.scss +0 -0
  82. package/src/{lib/components → components}/Button/_priorities.scss +0 -0
  83. package/src/{lib/components → components}/Button/_settings.scss +0 -0
  84. package/src/{lib/components → components}/Button/_theme.scss +0 -0
  85. package/src/{lib/components → components}/Button/_tools.scss +0 -0
  86. package/src/{lib/components → components}/Button/helpers/getRootLabelVisibilityClassName.js +0 -0
  87. package/src/{lib/components/_helpers → components/Button/helpers}/getRootPriorityClassName.js +0 -0
  88. package/src/{lib/components → components}/Button/index.js +0 -0
  89. package/src/{lib/components → components}/ButtonGroup/ButtonGroup.scss +0 -0
  90. package/src/{lib/components → components}/ButtonGroup/ButtonGroupContext.js +0 -0
  91. package/src/{lib/components → components}/ButtonGroup/_theme.scss +0 -0
  92. package/src/{lib/components → components}/ButtonGroup/index.js +0 -0
  93. package/src/{lib/components → components}/Card/Card.scss +0 -0
  94. package/src/{lib/components → components}/Card/CardBody.jsx +0 -0
  95. package/src/{lib/components → components}/Card/CardFooter.jsx +0 -0
  96. package/src/{lib/components → components}/Card/_theme.scss +0 -0
  97. package/src/{lib/components → components}/Card/_tools.scss +0 -0
  98. package/src/{lib/components → components}/Card/index.js +0 -0
  99. package/src/{lib/components → components}/CheckboxField/CheckboxField.jsx +0 -0
  100. package/src/{lib/components → components}/CheckboxField/CheckboxField.scss +0 -0
  101. package/src/{lib/components → components}/CheckboxField/index.js +0 -0
  102. package/src/{lib/components → components}/FileInputField/FileInputField.jsx +0 -0
  103. package/src/{lib/components → components}/FileInputField/FileInputField.scss +0 -0
  104. package/src/{lib/components → components}/FileInputField/index.js +0 -0
  105. package/src/{lib/components → components}/FormLayout/FormLayout.scss +0 -0
  106. package/src/{lib/components → components}/FormLayout/FormLayoutContext.js +0 -0
  107. package/src/{lib/components → components}/FormLayout/FormLayoutCustomField.jsx +4 -4
  108. package/src/{lib/components → components}/FormLayout/FormLayoutCustomField.scss +0 -0
  109. package/src/{lib/components → components}/FormLayout/_theme.scss +0 -0
  110. package/src/{lib/components → components}/FormLayout/index.js +0 -0
  111. package/src/{lib/components → components}/Grid/Grid.scss +0 -0
  112. package/src/{lib/components → components}/Grid/GridSpan.jsx +0 -0
  113. package/src/{lib/components → components}/Grid/_helpers/generateResponsiveCustomProperties.js +0 -0
  114. package/src/{lib/components → components}/Grid/_settings.scss +0 -0
  115. package/src/{lib/components → components}/Grid/_tools.scss +0 -0
  116. package/src/{lib/components → components}/Grid/index.js +0 -0
  117. package/src/{lib/components → components}/InputGroup/InputGroupContext.js +0 -0
  118. package/src/{lib/components → components}/InputGroup/_theme.scss +0 -0
  119. package/src/{lib/components → components}/InputGroup/index.js +0 -0
  120. package/src/{lib/components → components}/Modal/Modal.scss +0 -0
  121. package/src/{lib/components → components}/Modal/ModalBody.jsx +0 -0
  122. package/src/{lib/components → components}/Modal/ModalBody.scss +0 -0
  123. package/src/{lib/components → components}/Modal/ModalCloseButton.jsx +1 -1
  124. package/src/{lib/components → components}/Modal/ModalCloseButton.scss +0 -0
  125. package/src/{lib/components → components}/Modal/ModalContent.jsx +0 -0
  126. package/src/{lib/components → components}/Modal/ModalContent.scss +0 -0
  127. package/src/{lib/components → components}/Modal/ModalFooter.jsx +0 -0
  128. package/src/{lib/components → components}/Modal/ModalFooter.scss +0 -0
  129. package/src/{lib/components → components}/Modal/ModalHeader.jsx +0 -0
  130. package/src/{lib/components → components}/Modal/ModalHeader.scss +0 -0
  131. package/src/{lib/components → components}/Modal/ModalTitle.jsx +0 -0
  132. package/src/{lib/components → components}/Modal/ModalTitle.scss +0 -0
  133. package/src/{lib/components → components}/Modal/_helpers/getJustifyClassName.js +0 -0
  134. package/src/{lib/components → components}/Modal/_helpers/getPositionClassName.js +0 -0
  135. package/src/{lib/components → components}/Modal/_helpers/getScrollingClassName.js +0 -0
  136. package/src/{lib/components → components}/Modal/_helpers/getSizeClassName.js +0 -0
  137. package/src/{lib/components → components}/Modal/_hooks/useModalFocus.js +0 -0
  138. package/src/{lib/components → components}/Modal/_settings.scss +0 -0
  139. package/src/{lib/components → components}/Modal/_theme.scss +0 -0
  140. package/src/{lib/components → components}/Modal/index.js +0 -0
  141. package/src/{lib/components → components}/Paper/Paper.jsx +0 -0
  142. package/src/{lib/components → components}/Paper/Paper.scss +0 -0
  143. package/src/{lib/components → components}/Paper/_theme.scss +0 -0
  144. package/src/{lib/components → components}/Paper/index.js +0 -0
  145. package/src/{lib/components → components}/Popover/Popover.jsx +0 -0
  146. package/src/{lib/components → components}/Popover/Popover.scss +0 -0
  147. package/src/{lib/components → components}/Popover/PopoverWrapper.jsx +0 -0
  148. package/src/{lib/components → components}/Popover/PopoverWrapper.scss +0 -0
  149. package/src/{lib/components → components}/Popover/_helpers/getRootAlignmentClassName.js +0 -0
  150. package/src/{lib/components → components}/Popover/_helpers/getRootSideClassName.js +0 -0
  151. package/src/{lib/components → components}/Popover/_theme.scss +0 -0
  152. package/src/{lib/components → components}/Popover/index.js +0 -0
  153. package/src/{lib/components → components}/Radio/index.js +0 -0
  154. package/src/{lib/components → components}/ScrollView/ScrollView.scss +0 -0
  155. package/src/{lib/components → components}/ScrollView/_helpers/getElementsPositionDifference.js +0 -0
  156. package/src/{lib/components → components}/ScrollView/_hooks/useLoadResizeHook.js +0 -0
  157. package/src/{lib/components → components}/ScrollView/_hooks/useScrollPositionHook.js +0 -0
  158. package/src/{lib/components → components}/ScrollView/index.js +0 -0
  159. package/src/{lib/components → components}/SelectField/SelectField.jsx +0 -0
  160. package/src/{lib/components → components}/SelectField/SelectField.scss +0 -0
  161. package/src/{lib/components → components}/SelectField/_components/Option/Option.jsx +0 -0
  162. package/src/{lib/components → components}/SelectField/_components/Option/index.js +0 -0
  163. package/src/{lib/components → components}/SelectField/index.js +0 -0
  164. package/src/{lib/components → components}/Table/Table.scss +0 -0
  165. package/src/{lib/components → components}/Table/_components/TableBodyCell/TableBodyCell.jsx +0 -0
  166. package/src/{lib/components → components}/Table/_components/TableBodyCell/index.js +0 -0
  167. package/src/{lib/components → components}/Table/_components/TableCell.scss +0 -0
  168. package/src/{lib/components → components}/Table/_components/TableHeaderCell/index.js +0 -0
  169. package/src/{lib/components → components}/Table/_settings.scss +0 -0
  170. package/src/{lib/components → components}/Table/index.js +0 -0
  171. package/src/{lib/components → components}/Tabs/Tabs.jsx +0 -0
  172. package/src/{lib/components → components}/Tabs/Tabs.scss +0 -0
  173. package/src/{lib/components → components}/Tabs/TabsItem.scss +0 -0
  174. package/src/{lib/components → components}/Tabs/_theme.scss +0 -0
  175. package/src/{lib/components → components}/Tabs/index.js +0 -0
  176. package/src/{lib/components → components}/Text/Text.jsx +0 -0
  177. package/src/{lib/components → components}/Text/Text.scss +0 -0
  178. package/src/{lib/components → components}/Text/_helpers/getRootClampClassName.js +0 -0
  179. package/src/{lib/components → components}/Text/_helpers/getRootHyphensClassName.js +0 -0
  180. package/src/{lib/components → components}/Text/_helpers/getRootWordWrappingClassName.js +0 -0
  181. package/src/{lib/components → components}/Text/index.js +0 -0
  182. package/src/{lib/components → components}/TextArea/TextArea.jsx +0 -0
  183. package/src/{lib/components → components}/TextArea/TextArea.scss +0 -0
  184. package/src/{lib/components → components}/TextArea/index.js +0 -0
  185. package/src/{lib/components → components}/TextField/TextField.jsx +0 -0
  186. package/src/{lib/components → components}/TextField/TextField.scss +0 -0
  187. package/src/{lib/components → components}/TextField/index.js +0 -0
  188. package/src/{lib/components → components}/TextLink/TextLink.jsx +1 -1
  189. /package/src/{lib/components → components}/TextLink/TextLink.scss +0 -0
  190. /package/src/{lib/components → components}/TextLink/_theme.scss +0 -0
  191. /package/src/{lib/components → components}/TextLink/index.js +0 -0
  192. /package/src/{lib/components → components}/Toggle/Toggle.jsx +0 -0
  193. /package/src/{lib/components → components}/Toggle/Toggle.scss +0 -0
  194. /package/src/{lib/components → components}/Toggle/index.js +0 -0
  195. /package/src/{lib/components → components}/Toolbar/Toolbar.jsx +0 -0
  196. /package/src/{lib/components → components}/Toolbar/Toolbar.scss +0 -0
  197. /package/src/{lib/components → components}/Toolbar/ToolbarGroup.jsx +0 -0
  198. /package/src/{lib/components → components}/Toolbar/ToolbarItem.jsx +0 -0
  199. /package/src/{lib/components → components}/Toolbar/_helpers/getJustifyClassName.js +0 -0
  200. /package/src/{lib/components → components}/Toolbar/_theme.scss +0 -0
  201. /package/src/{lib/components → components}/Toolbar/index.js +0 -0
  202. /package/src/{lib/components → components}/_helpers/getRootColorClassName.js +0 -0
  203. /package/src/{lib/components → components}/_helpers/getRootSizeClassName.js +0 -0
  204. /package/src/{lib/components → components}/_helpers/getRootValidationStateClassName.js +0 -0
  205. /package/src/{lib/components → components}/_helpers/isChildrenEmpty.js +0 -0
  206. /package/src/{lib/components → components}/_helpers/resolveContextOrProp.js +0 -0
  207. /package/src/{lib/components → components}/_helpers/transferProps.js +0 -0
  208. /package/src/{lib/foundation.scss → foundation.scss} +0 -0
  209. /package/src/{lib/helpers.scss → helpers.scss} +0 -0
  210. /package/src/{lib/provider → provider}/RUIContext.jsx +0 -0
  211. /package/src/{lib/provider → provider}/index.js +0 -0
  212. /package/src/{lib/provider → provider}/withGlobalProps.jsx +0 -0
  213. /package/src/{lib/styles → styles}/_utilities.scss +0 -0
  214. /package/src/{lib/styles → styles}/elements/_code.scss +0 -0
  215. /package/src/{lib/styles → styles}/elements/_links.scss +0 -0
  216. /package/src/{lib/styles → styles}/elements/_lists.scss +0 -0
  217. /package/src/{lib/styles → styles}/elements/_page.scss +0 -0
  218. /package/src/{lib/styles → styles}/elements/_rulers.scss +0 -0
  219. /package/src/{lib/styles → styles}/elements/_small.scss +0 -0
  220. /package/src/{lib/styles → styles}/generic/_box-sizing.scss +0 -0
  221. /package/src/{lib/styles → styles}/generic/_focus.scss +0 -0
  222. /package/src/{lib/styles → styles}/generic/_forms.scss +0 -0
  223. /package/src/{lib/styles → styles}/generic/_reset.scss +0 -0
  224. /package/src/{lib/styles → styles}/generic/_shared.scss +0 -0
  225. /package/src/{lib/styles → styles}/helpers/_animation.scss +0 -0
  226. /package/src/{lib/styles → styles}/settings/_animations.scss +0 -0
  227. /package/src/{lib/styles → styles}/settings/_breakpoints.scss +0 -0
  228. /package/src/{lib/styles → styles}/settings/_escaped-characters.scss +0 -0
  229. /package/src/{lib/styles → styles}/settings/_form-fields.scss +0 -0
  230. /package/src/{lib/styles → styles}/settings/_forms.scss +0 -0
  231. /package/src/{lib/styles → styles}/settings/_utilities.scss +0 -0
  232. /package/src/{lib/styles → styles}/settings/_z-indexes.scss +0 -0
  233. /package/src/{lib/styles → styles}/theme/_accessibility.scss +0 -0
  234. /package/src/{lib/styles → styles}/theme/_borders.scss +0 -0
  235. /package/src/{lib/styles → styles}/theme/_code.scss +0 -0
  236. /package/src/{lib/styles → styles}/theme/_form-fields.scss +0 -0
  237. /package/src/{lib/styles → styles}/theme/_links.scss +0 -0
  238. /package/src/{lib/styles → styles}/theme/_lists.scss +0 -0
  239. /package/src/{lib/styles → styles}/theme/_page.scss +0 -0
  240. /package/src/{lib/styles → styles}/theme/_spacing.scss +0 -0
  241. /package/src/{lib/styles → styles}/theme/_typography.scss +0 -0
  242. /package/src/{lib/styles → styles}/theme-constants/_breakpoints.scss +0 -0
  243. /package/src/{lib/styles → styles}/theme-constants/_colors.scss +0 -0
  244. /package/src/{lib/styles → styles}/theme-constants/_svg.scss +0 -0
  245. /package/src/{lib/styles → styles}/tools/_accessibility.scss +0 -0
  246. /package/src/{lib/styles → styles}/tools/_breakpoint.scss +0 -0
  247. /package/src/{lib/styles → styles}/tools/_colors.scss +0 -0
  248. /package/src/{lib/styles → styles}/tools/_reset.scss +0 -0
  249. /package/src/{lib/styles → styles}/tools/_scrollbar.scss +0 -0
  250. /package/src/{lib/styles → styles}/tools/_spacing.scss +0 -0
  251. /package/src/{lib/styles → styles}/tools/_string.scss +0 -0
  252. /package/src/{lib/styles → styles}/tools/_svg.scss +0 -0
  253. /package/src/{lib/styles → styles}/tools/_transition.scss +0 -0
  254. /package/src/{lib/styles → styles}/tools/_utilities.scss +0 -0
  255. /package/src/{lib/styles → styles}/tools/form-fields/_box-field-layout.scss +0 -0
  256. /package/src/{lib/styles → styles}/tools/form-fields/_box-field-sizes.scss +0 -0
  257. /package/src/{lib/styles → styles}/tools/form-fields/_foundation.scss +0 -0
  258. /package/src/{lib/styles → styles}/tools/form-fields/_inline-field-layout.scss +0 -0
  259. /package/src/{lib/styles → styles}/tools/form-fields/_variants.scss +0 -0
  260. /package/src/{lib/translations → translations}/en.js +0 -0
  261. /package/src/{lib/utils → utils}/classNames.js +0 -0
@@ -1,19 +1,7 @@
1
- ---
2
- name: CheckboxField
3
- menu: 'Inputs'
4
- route: /components/checkbox-field
5
- ---
6
-
7
1
  # CheckboxField
8
2
 
9
3
  CheckboxField allows users to select one or more options from a set.
10
4
 
11
- import {
12
- Playground,
13
- Props,
14
- } from 'docz'
15
- import { CheckboxField } from '../..'
16
-
17
5
  ## Basic Usage
18
6
 
19
7
  To implement the CheckboxField component, you need to import it first:
@@ -24,18 +12,18 @@ import { CheckboxField } from '@react-ui-org/react-ui';
24
12
 
25
13
  And use it:
26
14
 
27
- <Playground>
28
- {() => {
29
- const [agree, setAgree] = React.useState(true);
30
- return (
31
- <CheckboxField
32
- checked={agree}
33
- label="I agree"
34
- onChange={() => setAgree(!agree)}
35
- />
36
- );
37
- }}
38
- </Playground>
15
+ ```docoff-react-preview
16
+ React.createElement(() => {
17
+ const [agree, setAgree] = React.useState(true);
18
+ return (
19
+ <CheckboxField
20
+ checked={agree}
21
+ label="I agree"
22
+ onChange={() => setAgree(!agree)}
23
+ />
24
+ );
25
+ });
26
+ ```
39
27
 
40
28
  See [API](#api) for all available options.
41
29
 
@@ -44,13 +32,13 @@ See [API](#api) for all available options.
44
32
  - Use the CheckboxField when there are lists of options and the user may
45
33
  **select any number of choices,** including zero, one, or several. For
46
34
  selecting just a single option from the list, use either the
47
- [Radio](/components/radio) or [SelectField](/components/select-field)
35
+ [Radio](/components/Radio) or [SelectField](/components/SelectField)
48
36
  component.
49
37
 
50
38
  - Use the CheckboxField for boolean (true/false) input **in forms that require
51
39
  to be confirmed** by a button to become active. To toggle things on or off
52
40
  with an immediate effect (without confirmation), use rather the
53
- [Toggle](/components/toggle) component.
41
+ [Toggle](/components/Toggle) component.
54
42
 
55
43
  - **Use positive wording for the checkbox label,** so that it's clear what will
56
44
  happen when the user turns on the checkbox. Avoid negations such as “Don't
@@ -76,54 +64,54 @@ See [API](#api) for all available options.
76
64
  You may provide an additional help text to clarify what will be the impact of
77
65
  turning the checkbox on or off.
78
66
 
79
- <Playground>
80
- {() => {
81
- const [getNewsletter, setGetNewsletter] = React.useState(true);
82
- return (
83
- <CheckboxField
84
- checked={getNewsletter}
85
- helpText="We will not bother you more than once a month, we promise!"
86
- label="Send me newsletter"
87
- onChange={() => setGetNewsletter(!getNewsletter)}
88
- />
89
- );
90
- }}
91
- </Playground>
67
+ ```docoff-react-preview
68
+ React.createElement(() => {
69
+ const [getNewsletter, setGetNewsletter] = React.useState(true);
70
+ return (
71
+ <CheckboxField
72
+ checked={getNewsletter}
73
+ helpText="We will not bother you more than once a month, we promise!"
74
+ label="Send me newsletter"
75
+ onChange={() => setGetNewsletter(!getNewsletter)}
76
+ />
77
+ );
78
+ });
79
+ ```
92
80
 
93
81
  ## Label Options
94
82
 
95
83
  In some cases, it may be convenient to visually hide the checkbox label. The
96
84
  label remains accessible to assistive technologies.
97
85
 
98
- <Playground>
99
- {() => {
100
- const [checked, setChecked] = React.useState(true);
101
- return (
102
- <CheckboxField
103
- checked={checked}
104
- isLabelVisible={false}
105
- label="You cannot see this"
106
- onChange={() => setChecked(!checked)}
107
- />
108
- );
109
- }}
110
- </Playground>
86
+ ```docoff-react-preview
87
+ React.createElement(() => {
88
+ const [checked, setChecked] = React.useState(true);
89
+ return (
90
+ <CheckboxField
91
+ checked={checked}
92
+ isLabelVisible={false}
93
+ label="You cannot see this"
94
+ onChange={() => setChecked(!checked)}
95
+ />
96
+ );
97
+ });
98
+ ```
111
99
 
112
100
  It's also possible to display label before input:
113
101
 
114
- <Playground>
115
- {() => {
116
- const [checked, setChecked] = React.useState(true);
117
- return (
118
- <CheckboxField
119
- checked={checked}
120
- label="Label precedes input"
121
- labelPosition="before"
122
- onChange={() => setChecked(!checked)}
123
- />
124
- );
125
- }}
126
- </Playground>
102
+ ```docoff-react-preview
103
+ React.createElement(() => {
104
+ const [checked, setChecked] = React.useState(true);
105
+ return (
106
+ <CheckboxField
107
+ checked={checked}
108
+ label="Label precedes input"
109
+ labelPosition="before"
110
+ onChange={() => setChecked(!checked)}
111
+ />
112
+ );
113
+ });
114
+ ```
127
115
 
128
116
  ## States
129
117
 
@@ -134,52 +122,52 @@ should always **provide validation message for states other than valid** so
134
122
  users know what happened and what action they should take or what options they
135
123
  have.
136
124
 
137
- <Playground>
138
- {() => {
139
- const [agree, setAgree] = React.useState(true);
140
- return (
141
- <>
142
- <CheckboxField
143
- checked={agree}
144
- label="I have read and agree with terms and conditions"
145
- onChange={() => setAgree(!agree)}
146
- validationState="valid"
147
- />
148
- <CheckboxField
149
- checked={agree}
150
- label="I have read and agree with terms and conditions"
151
- onChange={() => setAgree(!agree)}
152
- validationState="warning"
153
- validationText="Please wait 10 minutes until we verify your data."
154
- />
155
- <CheckboxField
156
- checked={agree}
157
- label="I have read and agree with terms and conditions"
158
- onChange={() => setAgree(!agree)}
159
- required
160
- validationState="invalid"
161
- validationText="You must agree to be able to proceed."
162
- />
163
- </>
164
- );
165
- }}
166
- </Playground>
125
+ ```docoff-react-preview
126
+ React.createElement(() => {
127
+ const [agree, setAgree] = React.useState(true);
128
+ return (
129
+ <>
130
+ <CheckboxField
131
+ checked={agree}
132
+ label="I have read and agree with terms and conditions"
133
+ onChange={() => setAgree(!agree)}
134
+ validationState="valid"
135
+ />
136
+ <CheckboxField
137
+ checked={agree}
138
+ label="I have read and agree with terms and conditions"
139
+ onChange={() => setAgree(!agree)}
140
+ validationState="warning"
141
+ validationText="Please wait 10 minutes until we verify your data."
142
+ />
143
+ <CheckboxField
144
+ checked={agree}
145
+ label="I have read and agree with terms and conditions"
146
+ onChange={() => setAgree(!agree)}
147
+ required
148
+ validationState="invalid"
149
+ validationText="You must agree to be able to proceed."
150
+ />
151
+ </>
152
+ );
153
+ });
154
+ ```
167
155
 
168
156
  ### Disabled State
169
157
 
170
158
  Disabled state makes the input unavailable.
171
159
 
172
- <Playground>
173
- <CheckboxField
174
- disabled
175
- label="Disabled checkbox"
176
- />
177
- <CheckboxField
178
- checked
179
- disabled
180
- label="Disabled checkbox, checked"
181
- />
182
- </Playground>
160
+ ```docoff-react-preview
161
+ <CheckboxField
162
+ disabled
163
+ label="Disabled checkbox"
164
+ />
165
+ <CheckboxField
166
+ checked
167
+ disabled
168
+ label="Disabled checkbox, checked"
169
+ />
170
+ ```
183
171
 
184
172
  ## Forwarding HTML Attributes
185
173
 
@@ -198,11 +186,11 @@ If you provide [ref], it is forwarded to the native HTML `<input>` element.
198
186
 
199
187
  ## API
200
188
 
201
- <Props table of={CheckboxField} />
189
+ <docoff-react-props src="/components/CheckboxField/CheckboxField.jsx"></docoff-react-props>
202
190
 
203
191
  ## Theming
204
192
 
205
- Head to [Forms Theming](/customize/theming/forms) to see shared form theming
193
+ Head to [Forms Theming](/docs/customize/theming/forms) to see shared form theming
206
194
  options. On top of that, the following options are available for CheckboxField.
207
195
 
208
196
  | Custom Property | Description |
@@ -1,19 +1,7 @@
1
- ---
2
- name: FileInputField
3
- menu: 'Inputs'
4
- route: /components/file-input-field
5
- ---
6
-
7
1
  # FileInputField
8
2
 
9
3
  FileInputField allows users to select files to upload.
10
4
 
11
- import {
12
- Playground,
13
- Props,
14
- } from 'docz'
15
- import { FileInputField } from '../..'
16
-
17
5
  ## Basic Usage
18
6
 
19
7
  To implement the FileInputField component, you need to import it first:
@@ -24,9 +12,9 @@ import { FileInputField } from '@react-ui-org/react-ui';
24
12
 
25
13
  And use it:
26
14
 
27
- <Playground>
28
- <FileInputField label="Attachment" />
29
- </Playground>
15
+ ```docoff-react-preview
16
+ <FileInputField label="Attachment" />
17
+ ```
30
18
 
31
19
  See [API](#api) for all available options.
32
20
 
@@ -59,12 +47,12 @@ layout perspective, FileInputFields work just like any other form fields.
59
47
 
60
48
  Full-width fields span the full width of a parent:
61
49
 
62
- <Playground>
63
- <FileInputField
64
- fullWidth
65
- label="First name"
66
- />
67
- </Playground>
50
+ ```docoff-react-preview
51
+ <FileInputField
52
+ fullWidth
53
+ label="First name"
54
+ />
55
+ ```
68
56
 
69
57
  ## Invisible Label
70
58
 
@@ -75,12 +63,12 @@ While it may be acceptable for simple forms with just a few fields, it's
75
63
  dangerous to hide labels from users in most cases. Keep in mind you should
76
64
  **provide another visual clue** so users know what to fill into the input.
77
65
 
78
- <Playground>
79
- <FileInputField
80
- isLabelVisible={false}
81
- label="Attachment"
82
- />
83
- </Playground>
66
+ ```docoff-react-preview
67
+ <FileInputField
68
+ isLabelVisible={false}
69
+ label="Attachment"
70
+ />
71
+ ```
84
72
 
85
73
  ## Horizontal Layout
86
74
 
@@ -88,41 +76,41 @@ The default vertical layout is very easy to use and work with. However, there
88
76
  are situations where horizontal layout suits better — and that's why React UI
89
77
  supports this kind of layout as well.
90
78
 
91
- <Playground>
92
- <FileInputField
93
- label="Attachment"
94
- layout="horizontal"
95
- />
96
- <FileInputField
97
- fullWidth
98
- isLabelVisible={false}
99
- label="Attachment"
100
- layout="horizontal"
101
- />
102
- </Playground>
79
+ ```docoff-react-preview
80
+ <FileInputField
81
+ label="Attachment"
82
+ layout="horizontal"
83
+ />
84
+ <FileInputField
85
+ fullWidth
86
+ isLabelVisible={false}
87
+ label="Attachment"
88
+ layout="horizontal"
89
+ />
90
+ ```
103
91
 
104
92
  ## Help Text
105
93
 
106
94
  You may provide an additional help text to clarify how the input should be
107
95
  filled.
108
96
 
109
- <Playground>
110
- <FileInputField
111
- helpText="Choose one or more files to upload."
112
- label="Attachment"
113
- />
114
- <FileInputField
115
- helpText="Choose one or more files to upload."
116
- label="Attachment"
117
- layout="horizontal"
118
- />
119
- <FileInputField
120
- fullWidth
121
- helpText="Choose one or more files to upload."
122
- label="Attachment"
123
- layout="horizontal"
124
- />
125
- </Playground>
97
+ ```docoff-react-preview
98
+ <FileInputField
99
+ helpText="Choose one or more files to upload."
100
+ label="Attachment"
101
+ />
102
+ <FileInputField
103
+ helpText="Choose one or more files to upload."
104
+ label="Attachment"
105
+ layout="horizontal"
106
+ />
107
+ <FileInputField
108
+ fullWidth
109
+ helpText="Choose one or more files to upload."
110
+ label="Attachment"
111
+ layout="horizontal"
112
+ />
113
+ ```
126
114
 
127
115
  ## States
128
116
 
@@ -133,37 +121,37 @@ should always **provide a validation message for states other than valid** so
133
121
  users know what happened and what action they should take or what options they
134
122
  have.
135
123
 
136
- <Playground>
137
- <FileInputField
138
- label="Attachment"
139
- validationState="valid"
140
- validationText="Looks good!"
141
- />
142
- <FileInputField
143
- label="Attachment"
144
- validationState="invalid"
145
- validationText="Your file is too big. Please select something smaller."
146
- />
147
- <FileInputField
148
- label="Attachment"
149
- validationState="warning"
150
- validationText={`
151
- You selected more than 10 files.
152
- It may take some time before we process them.
153
- `}
154
- />
155
- </Playground>
124
+ ```docoff-react-preview
125
+ <FileInputField
126
+ label="Attachment"
127
+ validationState="valid"
128
+ validationText="Looks good!"
129
+ />
130
+ <FileInputField
131
+ label="Attachment"
132
+ validationState="invalid"
133
+ validationText="Your file is too big. Please select something smaller."
134
+ />
135
+ <FileInputField
136
+ label="Attachment"
137
+ validationState="warning"
138
+ validationText={`
139
+ You selected more than 10 files.
140
+ It may take some time before we process them.
141
+ `}
142
+ />
143
+ ```
156
144
 
157
145
  ### Disabled State
158
146
 
159
147
  It's possible to disable the whole input.
160
148
 
161
- <Playground>
162
- <FileInputField
163
- disabled
164
- label="Attachment"
165
- />
166
- </Playground>
149
+ ```docoff-react-preview
150
+ <FileInputField
151
+ disabled
152
+ label="Attachment"
153
+ />
154
+ ```
167
155
 
168
156
  ## Forwarding HTML Attributes
169
157
 
@@ -173,17 +161,17 @@ you like.** All attributes that don't interfere with the API are forwarded to
173
161
  the native HTML `<input>`. This enables making the component interactive and
174
162
  helps to improve its accessibility.
175
163
 
176
- <Playground>
177
- <FileInputField
178
- accept=".pdf,.jpg,.jpeg,.png"
179
- helpText={`
180
- Choose up to 10 files. Allowed extensions are .pdf, .jpg, .jpeg, or .png.
181
- Size limit is 10 MB.
182
- `}
183
- label="Attachment"
184
- multiple
185
- />
186
- </Playground>
164
+ ```docoff-react-preview
165
+ <FileInputField
166
+ accept=".pdf,.jpg,.jpeg,.png"
167
+ helpText={`
168
+ Choose up to 10 files. Allowed extensions are .pdf, .jpg, .jpeg, or .png.
169
+ Size limit is 10 MB.
170
+ `}
171
+ label="Attachment"
172
+ multiple
173
+ />
174
+ ```
187
175
 
188
176
  👉 Refer to the MDN reference for the full list of supported attributes of the
189
177
  [file] input type.
@@ -194,11 +182,11 @@ If you provide [ref], it is forwarded to the native HTML `<input>` element.
194
182
 
195
183
  ## API
196
184
 
197
- <Props table of={FileInputField} />
185
+ <docoff-react-props src="/components/FileInputField/FileInputField.jsx"></docoff-react-props>
198
186
 
199
187
  ## Theming
200
188
 
201
- Head to [Forms Theming](/customize/theming/forms) to see shared form theming
189
+ Head to [Forms Theming](/docs/customize/theming/forms) to see shared form theming
202
190
  options.
203
191
 
204
192
  [React synthetic events]: https://reactjs.org/docs/events.html
@@ -1,5 +1,5 @@
1
1
  import PropTypes from 'prop-types';
2
- import React from 'react';
2
+ import React, { useMemo } from 'react';
3
3
  import { withGlobalProps } from '../../provider';
4
4
  import { transferProps } from '../_helpers/transferProps';
5
5
  import { classNames } from '../../utils/classNames';
@@ -16,6 +16,8 @@ export const FormLayout = ({
16
16
  labelWidth,
17
17
  ...restProps
18
18
  }) => {
19
+ const childProps = useMemo(() => ({ layout: fieldLayout }), [fieldLayout]);
20
+
19
21
  if (isChildrenEmpty(children)) {
20
22
  return null;
21
23
  }
@@ -57,9 +59,7 @@ export const FormLayout = ({
57
59
  )}
58
60
  {...hasCustomLabelWidth ? { style: { '--rui-custom-label-width': labelWidth } } : {}}
59
61
  >
60
- <FormLayoutContext.Provider
61
- value={{ layout: fieldLayout }}
62
- >
62
+ <FormLayoutContext.Provider value={childProps}>
63
63
  {children}
64
64
  </FormLayoutContext.Provider>
65
65
  </div>