@react-ui-org/react-ui 0.42.1 → 0.44.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +44 -25
- package/README.md +1 -1
- package/dist/lib.development.js +1597 -651
- package/dist/lib.js +1 -9
- package/package.json +47 -46
- package/src/lib/components/{ui/Alert → Alert}/Alert.jsx +17 -14
- package/src/lib/components/{ui/Alert → Alert}/Alert.scss +3 -3
- package/src/lib/components/{ui/Alert → Alert}/README.mdx +6 -6
- package/src/lib/components/{ui/Alert → Alert}/_settings.scss +1 -1
- package/src/lib/components/{ui/Alert → Alert}/_theme.scss +0 -0
- package/src/lib/components/{ui/Alert → Alert}/_tools.scss +0 -0
- package/src/lib/components/{ui/Alert → Alert}/index.js +0 -0
- package/src/lib/components/{ui/Badge → Badge}/Badge.jsx +2 -2
- package/src/lib/components/{ui/Badge → Badge}/Badge.scss +3 -3
- package/src/lib/components/{ui/Badge → Badge}/README.mdx +3 -3
- package/src/lib/components/{ui/Badge → Badge}/index.js +0 -0
- package/src/lib/components/Button/Button.jsx +198 -0
- package/src/lib/components/{ui/Button → Button}/Button.scss +0 -0
- package/src/lib/components/{ui/Button → Button}/README.mdx +161 -76
- package/src/lib/components/Button/_base.scss +148 -0
- package/src/lib/components/{ui/Button → Button}/_priorities.scss +0 -4
- package/src/lib/components/{ui/Button → Button}/_settings.scss +2 -3
- package/src/lib/components/{ui/Button → Button}/_theme.scss +3 -11
- package/src/lib/components/{ui/Button → Button}/_tools.scss +27 -44
- package/src/lib/components/Button/helpers/getRootLabelVisibilityClassName.js +33 -0
- package/src/lib/components/{ui/Button → Button}/helpers/getRootPriorityClassName.js +0 -4
- package/src/lib/components/{ui/Button → Button}/index.js +0 -0
- package/src/lib/components/{ui/ButtonGroup → ButtonGroup}/ButtonGroup.jsx +9 -11
- package/src/lib/components/{ui/ButtonGroup → ButtonGroup}/ButtonGroup.scss +0 -0
- package/src/lib/components/ButtonGroup/ButtonGroupContext.js +3 -0
- package/src/lib/components/{ui/ButtonGroup → ButtonGroup}/README.mdx +30 -6
- package/src/lib/components/ButtonGroup/index.js +2 -0
- package/src/lib/components/{layout/CTA → CTA}/CTA.jsx +5 -2
- package/src/lib/components/{layout/CTA → CTA}/CTA.scss +2 -2
- package/src/lib/components/{layout/CTA → CTA}/CTACenter.jsx +1 -1
- package/src/lib/components/{layout/CTA → CTA}/CTAEnd.jsx +1 -1
- package/src/lib/components/{layout/CTA → CTA}/CTAStart.jsx +1 -1
- package/src/lib/components/{layout/CTA → CTA}/README.mdx +4 -4
- package/src/lib/components/{layout/CTA → CTA}/index.js +0 -0
- package/src/lib/components/{ui/Card → Card}/Card.jsx +6 -4
- package/src/lib/components/{ui/Card → Card}/Card.scss +1 -1
- package/src/lib/components/{ui/Card → Card}/CardBody.jsx +1 -1
- package/src/lib/components/{ui/Card → Card}/CardFooter.jsx +1 -1
- package/src/lib/components/{ui/Card → Card}/README.mdx +4 -4
- package/src/lib/components/{ui/Card → Card}/_theme.scss +0 -0
- package/src/lib/components/{ui/Card → Card}/_tools.scss +0 -0
- package/src/lib/components/{ui/Card → Card}/index.js +0 -0
- package/src/lib/components/{layout/Center → Center}/Center.jsx +1 -1
- package/src/lib/components/{layout/Center → Center}/Center.scss +0 -0
- package/src/lib/components/{layout/Center → Center}/README.mdx +2 -2
- package/src/lib/components/{layout/Center → Center}/index.js +0 -0
- package/src/lib/components/CheckboxField/CheckboxField.jsx +164 -0
- package/src/lib/components/{ui/CheckboxField → CheckboxField}/CheckboxField.scss +5 -5
- package/src/lib/components/{ui/CheckboxField → CheckboxField}/README.mdx +17 -14
- package/src/lib/components/{ui/CheckboxField → CheckboxField}/index.js +0 -0
- package/src/lib/components/FileInputField/FileInputField.jsx +162 -0
- package/src/lib/components/{ui/FileInputField → FileInputField}/FileInputField.scss +5 -5
- package/src/lib/components/{ui/FileInputField → FileInputField}/README.mdx +8 -6
- package/src/lib/components/{ui/FileInputField → FileInputField}/index.js +0 -0
- package/src/lib/components/{layout/FormLayout → FormLayout}/FormLayout.jsx +16 -18
- package/src/lib/components/{layout/FormLayout → FormLayout}/FormLayout.scss +3 -3
- package/src/lib/components/FormLayout/FormLayoutContext.js +3 -0
- package/src/lib/components/{layout/FormLayout → FormLayout}/FormLayoutCustomField.jsx +33 -30
- package/src/lib/components/{layout/FormLayout → FormLayout}/FormLayoutCustomField.scss +4 -4
- package/src/lib/components/{layout/FormLayout → FormLayout}/README.mdx +37 -47
- package/src/lib/components/{layout/FormLayout → FormLayout}/_theme.scss +0 -0
- package/src/lib/components/{layout/FormLayout → FormLayout}/index.js +1 -0
- package/src/lib/components/{layout/Grid → Grid}/Grid.jsx +23 -5
- package/src/lib/components/{layout/Grid → Grid}/Grid.scss +13 -4
- package/src/lib/components/{layout/Grid → Grid}/GridSpan.jsx +10 -3
- package/src/lib/components/{layout/Grid → Grid}/README.mdx +42 -38
- package/src/lib/components/{layout/Grid → Grid}/_theme.scss +1 -2
- package/src/lib/components/{layout/Grid → Grid}/_tools.scss +2 -2
- package/src/lib/components/{layout/Grid → Grid}/helpers/generateResponsiveCustomProperties.js +0 -0
- package/src/lib/components/{layout/Grid → Grid}/index.js +0 -0
- package/src/lib/components/Link/Link.jsx +45 -0
- package/src/lib/components/Link/Link.scss +11 -0
- package/src/lib/components/Link/README.mdx +85 -0
- package/src/lib/components/Link/_theme.scss +4 -0
- package/src/lib/components/Link/index.js +1 -0
- package/src/lib/components/{layout/List → List}/List.jsx +1 -1
- package/src/lib/components/{layout/List → List}/List.scss +2 -2
- package/src/lib/components/{layout/List → List}/ListItem.jsx +1 -1
- package/src/lib/components/{layout/List → List}/README.mdx +3 -3
- package/src/lib/components/{layout/List → List}/_theme.scss +0 -0
- package/src/lib/components/{layout/List → List}/index.js +0 -0
- package/src/lib/components/{layout/Media → Media}/Media.jsx +4 -2
- package/src/lib/components/{layout/Media → Media}/Media.scss +1 -1
- package/src/lib/components/{layout/Media → Media}/MediaBody.jsx +1 -1
- package/src/lib/components/{layout/Media → Media}/MediaObject.jsx +1 -1
- package/src/lib/components/{layout/Media → Media}/README.mdx +2 -2
- package/src/lib/components/{layout/Media → Media}/index.js +0 -0
- package/src/lib/components/{ui/Modal → Modal}/Modal.jsx +28 -27
- package/src/lib/components/{ui/Modal → Modal}/Modal.scss +5 -5
- package/src/lib/components/{ui/Modal → Modal}/README.mdx +42 -42
- package/src/lib/components/{ui/Modal → Modal}/_settings.scss +4 -4
- package/src/lib/components/{ui/Modal → Modal}/_theme.scss +0 -0
- package/src/lib/components/{ui/Modal → Modal}/index.js +0 -0
- package/src/lib/components/{ui/Paper → Paper}/Paper.jsx +8 -1
- package/src/lib/components/{ui/Paper → Paper}/Paper.scss +5 -0
- package/src/lib/components/{ui/Paper → Paper}/README.mdx +15 -3
- package/src/lib/components/{ui/Paper → Paper}/_theme.scss +2 -0
- package/src/lib/components/{ui/Paper → Paper}/index.js +0 -0
- package/src/lib/components/{ui/Radio → Radio}/README.mdx +20 -17
- package/src/lib/components/Radio/Radio.jsx +188 -0
- package/src/lib/components/{ui/Radio → Radio}/Radio.scss +9 -9
- package/src/lib/components/{ui/Radio → Radio}/index.js +0 -0
- package/src/lib/components/{ui/ScrollView → ScrollView}/README.mdx +11 -11
- package/src/lib/components/{ui/ScrollView → ScrollView}/ScrollView.jsx +9 -10
- package/src/lib/components/{ui/ScrollView → ScrollView}/ScrollView.scss +6 -6
- package/src/lib/components/{ui/ScrollView → ScrollView}/_theme.scss +0 -0
- package/src/lib/components/{ui/ScrollView → ScrollView}/index.js +0 -0
- package/src/lib/components/{ui/SelectField → SelectField}/README.mdx +47 -44
- package/src/lib/components/SelectField/SelectField.jsx +219 -0
- package/src/lib/components/{ui/SelectField → SelectField}/SelectField.scss +6 -6
- package/src/lib/components/{ui/SelectField → SelectField}/index.js +0 -0
- package/src/lib/components/{ui/Table → Table}/README.mdx +10 -10
- package/src/lib/components/{ui/Table → Table}/Table.jsx +9 -13
- package/src/lib/components/{ui/Table → Table}/Table.scss +1 -1
- package/src/lib/components/{ui/Table → Table}/_settings.scss +4 -4
- package/src/lib/components/{ui/Table → Table}/index.js +0 -0
- package/src/lib/components/{ui/Tabs → Tabs}/README.mdx +4 -4
- package/src/lib/components/{ui/Tabs → Tabs}/Tabs.jsx +4 -4
- package/src/lib/components/{ui/Tabs → Tabs}/Tabs.scss +1 -1
- package/src/lib/components/{ui/Tabs → Tabs}/TabsItem.jsx +4 -3
- package/src/lib/components/{ui/Tabs → Tabs}/TabsItem.scss +3 -3
- package/src/lib/components/{ui/Tabs → Tabs}/_theme.scss +0 -0
- package/src/lib/components/{ui/Tabs → Tabs}/index.js +0 -0
- package/src/lib/components/{ui/Text → Text}/README.mdx +19 -19
- package/src/lib/components/{ui/Text → Text}/Text.jsx +1 -1
- package/src/lib/components/{ui/Text → Text}/Text.scss +0 -0
- package/src/lib/components/{ui/Text → Text}/helpers/getRootHyphensClassName.js +0 -0
- package/src/lib/components/{ui/Text → Text}/helpers/getRootWordWrappingClassName.js +0 -0
- package/src/lib/components/{ui/Text → Text}/index.js +0 -0
- package/src/lib/components/{ui/TextArea → TextArea}/README.mdx +8 -6
- package/src/lib/components/{ui/TextArea → TextArea}/TextArea.jsx +78 -78
- package/src/lib/components/{ui/TextArea → TextArea}/TextArea.scss +6 -6
- package/src/lib/components/{ui/TextArea → TextArea}/index.js +0 -0
- package/src/lib/components/{ui/TextField → TextField}/README.mdx +7 -6
- package/src/lib/components/{ui/TextField → TextField}/TextField.jsx +20 -22
- package/src/lib/components/{ui/TextField → TextField}/TextField.scss +6 -6
- package/src/lib/components/{ui/TextField → TextField}/index.js +0 -0
- package/src/lib/components/{ui/Toggle → Toggle}/README.mdx +17 -14
- package/src/lib/components/Toggle/Toggle.jsx +163 -0
- package/src/lib/components/{ui/Toggle → Toggle}/Toggle.scss +5 -5
- package/src/lib/components/{ui/Toggle → Toggle}/index.js +0 -0
- package/src/lib/components/{layout/Toolbar → Toolbar}/README.mdx +29 -29
- package/src/lib/components/{layout/Toolbar → Toolbar}/Toolbar.jsx +1 -1
- package/src/lib/components/{layout/Toolbar → Toolbar}/Toolbar.scss +1 -1
- package/src/lib/components/{layout/Toolbar → Toolbar}/ToolbarGroup.jsx +1 -1
- package/src/lib/components/{layout/Toolbar → Toolbar}/ToolbarItem.jsx +1 -1
- package/src/lib/components/{layout/Toolbar → Toolbar}/_theme.scss +0 -0
- package/src/lib/components/{layout/Toolbar → Toolbar}/index.js +0 -0
- package/src/lib/components/{ui/withForwardedRef.jsx → withForwardedRef.jsx} +0 -0
- package/src/lib/helpers/resolveContextOrProp.js +7 -0
- package/src/lib/index.js +34 -35
- package/src/lib/styles/tools/_accessibility.scss +9 -0
- package/src/lib/theme.scss +25 -7
- package/src/lib/components/ui/Button/Button.jsx +0 -191
- package/src/lib/components/ui/Button/_base.scss +0 -154
- package/src/lib/components/ui/Button/helpers/getRootLabelVisibilityClassName.js +0 -11
- package/src/lib/components/ui/ButtonGroup/index.js +0 -1
- package/src/lib/components/ui/CheckboxField/CheckboxField.jsx +0 -173
- package/src/lib/components/ui/FileInputField/FileInputField.jsx +0 -158
- package/src/lib/components/ui/Radio/Radio.jsx +0 -179
- package/src/lib/components/ui/SelectField/SelectField.jsx +0 -214
- package/src/lib/components/ui/Toggle/Toggle.jsx +0 -174
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: FormLayout
|
|
3
3
|
menu: 'Layouts'
|
|
4
|
-
route: /components/
|
|
4
|
+
route: /components/form-layout
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# FormLayout
|
|
@@ -12,16 +12,16 @@ import {
|
|
|
12
12
|
Playground,
|
|
13
13
|
Props,
|
|
14
14
|
} from 'docz'
|
|
15
|
-
import { Placeholder } from '
|
|
16
|
-
import { Button } from '
|
|
17
|
-
import { ButtonGroup } from '
|
|
18
|
-
import { CheckboxField } from '
|
|
19
|
-
import { FileInputField } from '
|
|
20
|
-
import { Radio } from '
|
|
21
|
-
import { SelectField } from '
|
|
22
|
-
import { TextArea } from '
|
|
23
|
-
import { TextField } from '
|
|
24
|
-
import { Toggle } from '
|
|
15
|
+
import { Placeholder } from '../../../docs/_components/Placeholder/Placeholder'
|
|
16
|
+
import { Button } from '../Button/Button'
|
|
17
|
+
import { ButtonGroup } from '../ButtonGroup/ButtonGroup'
|
|
18
|
+
import { CheckboxField } from '../CheckboxField/CheckboxField'
|
|
19
|
+
import { FileInputField } from '../FileInputField/FileInputField'
|
|
20
|
+
import { Radio } from '../Radio/Radio'
|
|
21
|
+
import { SelectField } from '../SelectField/SelectField'
|
|
22
|
+
import { TextArea } from '../TextArea/TextArea'
|
|
23
|
+
import { TextField } from '../TextField/TextField'
|
|
24
|
+
import { Toggle } from '../Toggle/Toggle'
|
|
25
25
|
import { Center } from '../Center/Center'
|
|
26
26
|
import { Toolbar } from '../Toolbar/Toolbar'
|
|
27
27
|
import { ToolbarItem } from '../Toolbar/ToolbarItem'
|
|
@@ -60,10 +60,10 @@ the job: the
|
|
|
60
60
|
are supported!). All React UI form components are ready for this use case and
|
|
61
61
|
don't need to be wrapped in any `div`s. Namely, the FormLayout supports the
|
|
62
62
|
following React UI components:
|
|
63
|
-
[CheckboxField](/components/
|
|
64
|
-
[Radio](/components/
|
|
65
|
-
[TextArea](/components/
|
|
66
|
-
and [Toggle](/components/
|
|
63
|
+
[CheckboxField](/components/checkbox-field),
|
|
64
|
+
[Radio](/components/radio), [SelectField](/components/select-field),
|
|
65
|
+
[TextArea](/components/text-area), [TextField](/components/text-field),
|
|
66
|
+
and [Toggle](/components/toggle).
|
|
67
67
|
|
|
68
68
|
- Use the [FormLayoutCustomField](#custom-fields) component when you need to
|
|
69
69
|
place any **custom content** inside the FormLayout. This layout helper ensures
|
|
@@ -80,7 +80,7 @@ in cases when there are longer validation messages or help texts.
|
|
|
80
80
|
|
|
81
81
|
## Vertical Layout
|
|
82
82
|
|
|
83
|
-
Vertical FormLayout works similar to the [List](/components/
|
|
83
|
+
Vertical FormLayout works similar to the [List](/components/list) layout
|
|
84
84
|
except that no equivalent of ListItems is needed. It stacks the form fields
|
|
85
85
|
vertically while it forces the vertical layout mode on them. To use this layout,
|
|
86
86
|
simply wrap your form fields with the FormLayout component:
|
|
@@ -135,7 +135,7 @@ with CSS custom properties.
|
|
|
135
135
|
- The `custom` mode (local) allows you to enter any **custom label width for
|
|
136
136
|
individual FormLayouts.**
|
|
137
137
|
|
|
138
|
-
Try
|
|
138
|
+
📐 Try resizing the playground to see how individual options work.
|
|
139
139
|
|
|
140
140
|
<Playground>
|
|
141
141
|
{() => {
|
|
@@ -150,37 +150,35 @@ Try to resize the playground to see how individual options work.
|
|
|
150
150
|
<ToolbarItem>
|
|
151
151
|
<ButtonGroup aria-labelledby="#label-width-options-label">
|
|
152
152
|
<Button
|
|
153
|
-
label="default"
|
|
154
|
-
clickHandler={() => setLabelWidth('default')}
|
|
155
153
|
color={labelWidth === 'default' ? 'dark' : 'primary'}
|
|
154
|
+
label="default"
|
|
155
|
+
onClick={() => setLabelWidth('default')}
|
|
156
156
|
/>
|
|
157
157
|
<Button
|
|
158
|
-
label="auto"
|
|
159
|
-
clickHandler={() => setLabelWidth('auto')}
|
|
160
158
|
color={labelWidth === 'auto' ? 'dark' : 'primary'}
|
|
159
|
+
label="auto"
|
|
160
|
+
onClick={() => setLabelWidth('auto')}
|
|
161
161
|
/>
|
|
162
162
|
<Button
|
|
163
|
-
label="limited"
|
|
164
|
-
clickHandler={() => setLabelWidth('limited')}
|
|
165
163
|
color={labelWidth === 'limited' ? 'dark' : 'primary'}
|
|
164
|
+
label="limited"
|
|
165
|
+
onClick={() => setLabelWidth('limited')}
|
|
166
166
|
/>
|
|
167
167
|
<Button
|
|
168
|
-
label="custom"
|
|
169
|
-
clickHandler={() => setLabelWidth('custom')}
|
|
170
168
|
color={labelWidth === 'custom' ? 'dark' : 'primary'}
|
|
169
|
+
label="custom"
|
|
170
|
+
onClick={() => setLabelWidth('custom')}
|
|
171
171
|
/>
|
|
172
172
|
</ButtonGroup>
|
|
173
173
|
</ToolbarItem>
|
|
174
174
|
{labelWidth === 'custom' && (
|
|
175
175
|
<ToolbarItem>
|
|
176
176
|
<TextField
|
|
177
|
-
changeHandler={(e) => (
|
|
178
|
-
setCustomLabelWidth(e.target.value)
|
|
179
|
-
)}
|
|
180
177
|
inputSize={5}
|
|
181
178
|
isLabelVisible={false}
|
|
182
179
|
label="Custom label width"
|
|
183
180
|
layout="horizontal"
|
|
181
|
+
onChange={(e) => setCustomLabelWidth(e.target.value)}
|
|
184
182
|
value={customLabelWidth}
|
|
185
183
|
/>
|
|
186
184
|
</ToolbarItem>
|
|
@@ -211,7 +209,7 @@ Try to resize the playground to see how individual options work.
|
|
|
211
209
|
|
|
212
210
|
Please note the `auto` and `limited` label width options may not function
|
|
213
211
|
correctly in combination with other auto layout mechanisms, e.g. the auto-width
|
|
214
|
-
[Modal](/components/
|
|
212
|
+
[Modal](/components/modal). It's just too much of magic that doesn't quite
|
|
215
213
|
work together yet 🎩.
|
|
216
214
|
|
|
217
215
|
#### Inline Form Fields
|
|
@@ -228,7 +226,7 @@ is fully supported in
|
|
|
228
226
|
## Alignment
|
|
229
227
|
|
|
230
228
|
To align whole FormLayout to center of a container, simply wrap it with the
|
|
231
|
-
[Center](/components/
|
|
229
|
+
[Center](/components/center) layout.
|
|
232
230
|
|
|
233
231
|
<Playground>
|
|
234
232
|
<Placeholder bordered height="24rem">
|
|
@@ -340,9 +338,9 @@ properly vertically aligned.
|
|
|
340
338
|
</ToolbarItem>
|
|
341
339
|
<ToolbarItem>
|
|
342
340
|
<CheckboxField
|
|
343
|
-
changeHandler={() => setIsChecked(!isChecked)}
|
|
344
341
|
checked={isChecked}
|
|
345
342
|
label="Another form field"
|
|
343
|
+
onChange={() => setIsChecked(!isChecked)}
|
|
346
344
|
/>
|
|
347
345
|
</ToolbarItem>
|
|
348
346
|
</Toolbar>
|
|
@@ -383,14 +381,14 @@ This is a demo of all components supported by FormLayout.
|
|
|
383
381
|
<ToolbarItem>
|
|
384
382
|
<ButtonGroup>
|
|
385
383
|
<Button
|
|
386
|
-
label="Vertical layout"
|
|
387
|
-
clickHandler={() => setFieldLayout('vertical')}
|
|
388
384
|
color={fieldLayout === 'vertical' ? 'dark' : 'primary'}
|
|
385
|
+
label="Vertical layout"
|
|
386
|
+
onClick={() => setFieldLayout('vertical')}
|
|
389
387
|
/>
|
|
390
388
|
<Button
|
|
391
|
-
label="Horizontal layout"
|
|
392
|
-
clickHandler={() => setFieldLayout('horizontal')}
|
|
393
389
|
color={fieldLayout === 'horizontal' ? 'dark' : 'primary'}
|
|
390
|
+
label="Horizontal layout"
|
|
391
|
+
onClick={() => setFieldLayout('horizontal')}
|
|
394
392
|
/>
|
|
395
393
|
</ButtonGroup>
|
|
396
394
|
</ToolbarItem>
|
|
@@ -398,34 +396,28 @@ This is a demo of all components supported by FormLayout.
|
|
|
398
396
|
<FormLayout fieldLayout={fieldLayout} labelWidth="auto">
|
|
399
397
|
<>
|
|
400
398
|
<TextField
|
|
401
|
-
changeHandler={() => {}}
|
|
402
399
|
label="First Name"
|
|
403
400
|
/>
|
|
404
401
|
<TextField
|
|
405
|
-
changeHandler={() => {}}
|
|
406
402
|
label="Last Name"
|
|
407
403
|
/>
|
|
408
404
|
</>
|
|
409
405
|
<TextField
|
|
410
|
-
changeHandler={() => {}}
|
|
411
406
|
helpText="Optional"
|
|
412
407
|
label="Email address"
|
|
413
408
|
type="email"
|
|
414
409
|
/>
|
|
415
410
|
<>
|
|
416
411
|
<TextField
|
|
417
|
-
changeHandler={() => {}}
|
|
418
412
|
label="Address"
|
|
419
413
|
placeholder="Address line 1"
|
|
420
414
|
/>
|
|
421
415
|
<TextField
|
|
422
|
-
changeHandler={() => {}}
|
|
423
416
|
isLabelVisible={false}
|
|
424
417
|
label="Address 2"
|
|
425
418
|
placeholder="Address line 2"
|
|
426
419
|
/>
|
|
427
420
|
<TextField
|
|
428
|
-
changeHandler={() => {}}
|
|
429
421
|
inputSize={6}
|
|
430
422
|
label="ZIP"
|
|
431
423
|
validationState="invalid"
|
|
@@ -435,37 +427,35 @@ This is a demo of all components supported by FormLayout.
|
|
|
435
427
|
<span>Czech Republic</span>
|
|
436
428
|
</FormLayoutCustomField>
|
|
437
429
|
<CheckboxField
|
|
438
|
-
changeHandler={() => setIsDeliveryAddress(!isDeliveryAddress)}
|
|
439
430
|
checked={isDeliveryAddress}
|
|
440
431
|
label="This is my delivery address"
|
|
432
|
+
onChange={() => setIsDeliveryAddress(!isDeliveryAddress)}
|
|
441
433
|
/>
|
|
442
434
|
</>
|
|
443
435
|
<SelectField
|
|
444
|
-
changeHandler={(e) => setFruit(e.target.value)}
|
|
445
436
|
label="Your favourite fruit"
|
|
437
|
+
onChange={(e) => setFruit(e.target.value)}
|
|
446
438
|
options={options}
|
|
447
439
|
value={fruit}
|
|
448
440
|
/>
|
|
449
441
|
<TextArea
|
|
450
|
-
changeHandler={() => {}}
|
|
451
442
|
fullWidth
|
|
452
443
|
label="Message"
|
|
453
444
|
rows={3}
|
|
454
445
|
/>
|
|
455
446
|
<FileInputField
|
|
456
|
-
changeHandler={() => {}}
|
|
457
447
|
label="Attachment"
|
|
458
448
|
/>
|
|
459
449
|
<Toggle
|
|
460
|
-
changeHandler={() => setReceiveNewsletter(!receiveNewsletter)}
|
|
461
450
|
checked={receiveNewsletter}
|
|
462
451
|
helpText="Only once per week!"
|
|
463
452
|
label="Receive weekly newsletter"
|
|
453
|
+
onChange={() => setReceiveNewsletter(!receiveNewsletter)}
|
|
464
454
|
required
|
|
465
455
|
/>
|
|
466
456
|
<Radio
|
|
467
|
-
changeHandler={(e) => setFruit(e.target.value)}
|
|
468
457
|
label="And fruit again!"
|
|
458
|
+
onChange={(e) => setFruit(e.target.value)}
|
|
469
459
|
options={options}
|
|
470
460
|
value={fruit}
|
|
471
461
|
/>
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { withProviderContext } from '
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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.
|
|
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 '
|
|
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); //
|
|
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.
|
|
@@ -53,3 +51,14 @@
|
|
|
53
51
|
grid-column: span var(--rui-local-column-span, 1); // 2.
|
|
54
52
|
grid-row: span var(--rui-local-row-span, 1); // 2.
|
|
55
53
|
}
|
|
54
|
+
|
|
55
|
+
/* stylelint-disable selector-no-qualifying-type */
|
|
56
|
+
|
|
57
|
+
dl.root,
|
|
58
|
+
ol.root,
|
|
59
|
+
ul.root {
|
|
60
|
+
padding-left: 0;
|
|
61
|
+
margin-left: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* stylelint-enable selector-no-qualifying-type */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { withProviderContext } from '
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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/
|
|
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 '
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
[
|
|
49
|
-
|
|
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
|
-
|
|
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=
|
|
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
|
|
232
|
-
[MDN]
|
|
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),
|
package/src/lib/components/{layout/Grid → Grid}/helpers/generateResponsiveCustomProperties.js
RENAMED
|
File without changes
|
|
File without changes
|
|
@@ -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;
|