@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.
- package/README.md +10 -7
- package/dist/react-ui.css +5 -3
- package/dist/react-ui.development.css +11302 -0
- package/dist/react-ui.development.js +1588 -0
- package/dist/react-ui.js +1 -1
- package/package.json +66 -77
- package/src/{lib/components → components}/Alert/Alert.jsx +1 -1
- package/src/{lib/components/Alert/README.mdx → components/Alert/README.md} +84 -100
- package/src/{lib/components → components}/Badge/Badge.jsx +1 -1
- package/src/{lib/components → components}/Badge/Badge.scss +1 -1
- package/src/components/Badge/README.md +103 -0
- package/src/{lib/components → components}/Button/Button.jsx +1 -1
- package/src/components/Button/README.md +580 -0
- package/src/{lib/components → components}/ButtonGroup/ButtonGroup.jsx +11 -9
- package/src/{lib/components/ButtonGroup/README.mdx → components/ButtonGroup/README.md} +128 -134
- package/src/{lib/components → components}/Card/Card.jsx +1 -1
- package/src/components/Card/README.md +314 -0
- package/src/{lib/components/CheckboxField/README.mdx → components/CheckboxField/README.md} +96 -108
- package/src/{lib/components/FileInputField/README.mdx → components/FileInputField/README.md} +83 -95
- package/src/{lib/components → components}/FormLayout/FormLayout.jsx +4 -4
- package/src/components/FormLayout/README.md +462 -0
- package/src/{lib/components → components}/Grid/Grid.jsx +2 -2
- package/src/components/Grid/README.md +281 -0
- package/src/{lib/components → components}/InputGroup/InputGroup.jsx +28 -19
- package/src/{lib/components → components}/InputGroup/InputGroup.scss +4 -5
- package/src/{lib/components/InputGroup/README.mdx → components/InputGroup/README.md} +162 -165
- package/src/{lib/components → components}/Modal/Modal.jsx +6 -6
- package/src/components/Modal/README.md +1090 -0
- package/src/components/Modal/_hooks/useModalScrollPrevention.js +37 -0
- package/src/{lib/components/Paper/README.mdx → components/Paper/README.md} +18 -30
- package/src/{lib/components/Popover/README.mdx → components/Popover/README.md} +102 -132
- package/src/{lib/components/Radio/README.mdx → components/Radio/README.md} +122 -134
- package/src/{lib/components → components}/Radio/Radio.jsx +11 -12
- package/src/{lib/components → components}/Radio/Radio.scss +0 -5
- package/src/components/ScrollView/README.md +503 -0
- package/src/{lib/components → components}/ScrollView/ScrollView.jsx +12 -3
- package/src/components/SelectField/README.md +681 -0
- package/src/components/Table/README.md +259 -0
- package/src/{lib/components → components}/Table/Table.jsx +4 -1
- package/src/{lib/components → components}/Table/_components/TableHeaderCell/TableHeaderCell.jsx +1 -1
- package/src/{lib/components/Tabs/README.mdx → components/Tabs/README.md} +117 -134
- package/src/{lib/components → components}/Tabs/TabsItem.jsx +3 -3
- package/src/components/Text/README.md +220 -0
- package/src/components/TextArea/README.md +359 -0
- package/src/{lib/components/TextField/README.mdx → components/TextField/README.md} +336 -342
- package/src/{lib/components/TextLink/README.mdx → components/TextLink/README.md} +19 -31
- package/src/{lib/components/Toggle/README.mdx → components/Toggle/README.md} +98 -110
- package/src/components/Toolbar/README.md +359 -0
- package/src/{lib/components → components}/Toolbar/_helpers/getAlignClassName.js +12 -4
- package/src/components/_helpers/getRootPriorityClassName.js +15 -0
- package/src/{lib/index.js → index.js} +6 -0
- package/src/{lib/provider → provider}/RUIProvider.jsx +17 -11
- package/src/{lib/styles → styles}/tools/_caret.scss +1 -1
- package/src/{lib/styles → styles}/tools/form-fields/_box-field-elements.scss +1 -1
- package/src/{lib/styles → styles}/tools/form-fields/_inline-field-elements.scss +2 -2
- package/src/{lib/theme.scss → theme.scss} +4 -3
- package/CONTRIBUTING.md +0 -137
- package/dist/lib.development.js +0 -3179
- package/dist/lib.js +0 -1
- package/public/racom.svg +0 -11
- package/src/lib/components/Badge/README.mdx +0 -126
- package/src/lib/components/Button/README.mdx +0 -581
- package/src/lib/components/Card/README.mdx +0 -326
- package/src/lib/components/FormLayout/README.mdx +0 -501
- package/src/lib/components/Grid/README.mdx +0 -299
- package/src/lib/components/Modal/README.mdx +0 -1360
- package/src/lib/components/Modal/_hooks/useModalScrollPrevention.js +0 -35
- package/src/lib/components/ScrollView/README.mdx +0 -521
- package/src/lib/components/SelectField/README.mdx +0 -693
- package/src/lib/components/Table/README.mdx +0 -275
- package/src/lib/components/Text/README.mdx +0 -241
- package/src/lib/components/TextArea/README.mdx +0 -366
- package/src/lib/components/Toolbar/README.mdx +0 -386
- package/src/{lib/components → components}/Alert/Alert.scss +0 -0
- package/src/{lib/components → components}/Alert/_settings.scss +0 -0
- package/src/{lib/components → components}/Alert/_theme.scss +0 -0
- package/src/{lib/components → components}/Alert/_tools.scss +0 -0
- package/src/{lib/components → components}/Alert/index.js +0 -0
- package/src/{lib/components → components}/Badge/index.js +0 -0
- package/src/{lib/components → components}/Button/Button.scss +0 -0
- package/src/{lib/components → components}/Button/_base.scss +0 -0
- package/src/{lib/components → components}/Button/_priorities.scss +0 -0
- package/src/{lib/components → components}/Button/_settings.scss +0 -0
- package/src/{lib/components → components}/Button/_theme.scss +0 -0
- package/src/{lib/components → components}/Button/_tools.scss +0 -0
- package/src/{lib/components → components}/Button/helpers/getRootLabelVisibilityClassName.js +0 -0
- package/src/{lib/components/_helpers → components/Button/helpers}/getRootPriorityClassName.js +0 -0
- package/src/{lib/components → components}/Button/index.js +0 -0
- package/src/{lib/components → components}/ButtonGroup/ButtonGroup.scss +0 -0
- package/src/{lib/components → components}/ButtonGroup/ButtonGroupContext.js +0 -0
- package/src/{lib/components → components}/ButtonGroup/_theme.scss +0 -0
- package/src/{lib/components → components}/ButtonGroup/index.js +0 -0
- package/src/{lib/components → components}/Card/Card.scss +0 -0
- package/src/{lib/components → components}/Card/CardBody.jsx +0 -0
- package/src/{lib/components → components}/Card/CardFooter.jsx +0 -0
- package/src/{lib/components → components}/Card/_theme.scss +0 -0
- package/src/{lib/components → components}/Card/_tools.scss +0 -0
- package/src/{lib/components → components}/Card/index.js +0 -0
- package/src/{lib/components → components}/CheckboxField/CheckboxField.jsx +0 -0
- package/src/{lib/components → components}/CheckboxField/CheckboxField.scss +0 -0
- package/src/{lib/components → components}/CheckboxField/index.js +0 -0
- package/src/{lib/components → components}/FileInputField/FileInputField.jsx +0 -0
- package/src/{lib/components → components}/FileInputField/FileInputField.scss +0 -0
- package/src/{lib/components → components}/FileInputField/index.js +0 -0
- package/src/{lib/components → components}/FormLayout/FormLayout.scss +0 -0
- package/src/{lib/components → components}/FormLayout/FormLayoutContext.js +0 -0
- package/src/{lib/components → components}/FormLayout/FormLayoutCustomField.jsx +4 -4
- package/src/{lib/components → components}/FormLayout/FormLayoutCustomField.scss +0 -0
- package/src/{lib/components → components}/FormLayout/_theme.scss +0 -0
- package/src/{lib/components → components}/FormLayout/index.js +0 -0
- package/src/{lib/components → components}/Grid/Grid.scss +0 -0
- package/src/{lib/components → components}/Grid/GridSpan.jsx +0 -0
- package/src/{lib/components → components}/Grid/_helpers/generateResponsiveCustomProperties.js +0 -0
- package/src/{lib/components → components}/Grid/_settings.scss +0 -0
- package/src/{lib/components → components}/Grid/_tools.scss +0 -0
- package/src/{lib/components → components}/Grid/index.js +0 -0
- package/src/{lib/components → components}/InputGroup/InputGroupContext.js +0 -0
- package/src/{lib/components → components}/InputGroup/_theme.scss +0 -0
- package/src/{lib/components → components}/InputGroup/index.js +0 -0
- package/src/{lib/components → components}/Modal/Modal.scss +0 -0
- package/src/{lib/components → components}/Modal/ModalBody.jsx +0 -0
- package/src/{lib/components → components}/Modal/ModalBody.scss +0 -0
- package/src/{lib/components → components}/Modal/ModalCloseButton.jsx +1 -1
- package/src/{lib/components → components}/Modal/ModalCloseButton.scss +0 -0
- package/src/{lib/components → components}/Modal/ModalContent.jsx +0 -0
- package/src/{lib/components → components}/Modal/ModalContent.scss +0 -0
- package/src/{lib/components → components}/Modal/ModalFooter.jsx +0 -0
- package/src/{lib/components → components}/Modal/ModalFooter.scss +0 -0
- package/src/{lib/components → components}/Modal/ModalHeader.jsx +0 -0
- package/src/{lib/components → components}/Modal/ModalHeader.scss +0 -0
- package/src/{lib/components → components}/Modal/ModalTitle.jsx +0 -0
- package/src/{lib/components → components}/Modal/ModalTitle.scss +0 -0
- package/src/{lib/components → components}/Modal/_helpers/getJustifyClassName.js +0 -0
- package/src/{lib/components → components}/Modal/_helpers/getPositionClassName.js +0 -0
- package/src/{lib/components → components}/Modal/_helpers/getScrollingClassName.js +0 -0
- package/src/{lib/components → components}/Modal/_helpers/getSizeClassName.js +0 -0
- package/src/{lib/components → components}/Modal/_hooks/useModalFocus.js +0 -0
- package/src/{lib/components → components}/Modal/_settings.scss +0 -0
- package/src/{lib/components → components}/Modal/_theme.scss +0 -0
- package/src/{lib/components → components}/Modal/index.js +0 -0
- package/src/{lib/components → components}/Paper/Paper.jsx +0 -0
- package/src/{lib/components → components}/Paper/Paper.scss +0 -0
- package/src/{lib/components → components}/Paper/_theme.scss +0 -0
- package/src/{lib/components → components}/Paper/index.js +0 -0
- package/src/{lib/components → components}/Popover/Popover.jsx +0 -0
- package/src/{lib/components → components}/Popover/Popover.scss +0 -0
- package/src/{lib/components → components}/Popover/PopoverWrapper.jsx +0 -0
- package/src/{lib/components → components}/Popover/PopoverWrapper.scss +0 -0
- package/src/{lib/components → components}/Popover/_helpers/getRootAlignmentClassName.js +0 -0
- package/src/{lib/components → components}/Popover/_helpers/getRootSideClassName.js +0 -0
- package/src/{lib/components → components}/Popover/_theme.scss +0 -0
- package/src/{lib/components → components}/Popover/index.js +0 -0
- package/src/{lib/components → components}/Radio/index.js +0 -0
- package/src/{lib/components → components}/ScrollView/ScrollView.scss +0 -0
- package/src/{lib/components → components}/ScrollView/_helpers/getElementsPositionDifference.js +0 -0
- package/src/{lib/components → components}/ScrollView/_hooks/useLoadResizeHook.js +0 -0
- package/src/{lib/components → components}/ScrollView/_hooks/useScrollPositionHook.js +0 -0
- package/src/{lib/components → components}/ScrollView/index.js +0 -0
- package/src/{lib/components → components}/SelectField/SelectField.jsx +0 -0
- package/src/{lib/components → components}/SelectField/SelectField.scss +0 -0
- package/src/{lib/components → components}/SelectField/_components/Option/Option.jsx +0 -0
- package/src/{lib/components → components}/SelectField/_components/Option/index.js +0 -0
- package/src/{lib/components → components}/SelectField/index.js +0 -0
- package/src/{lib/components → components}/Table/Table.scss +0 -0
- package/src/{lib/components → components}/Table/_components/TableBodyCell/TableBodyCell.jsx +0 -0
- package/src/{lib/components → components}/Table/_components/TableBodyCell/index.js +0 -0
- package/src/{lib/components → components}/Table/_components/TableCell.scss +0 -0
- package/src/{lib/components → components}/Table/_components/TableHeaderCell/index.js +0 -0
- package/src/{lib/components → components}/Table/_settings.scss +0 -0
- package/src/{lib/components → components}/Table/index.js +0 -0
- package/src/{lib/components → components}/Tabs/Tabs.jsx +0 -0
- package/src/{lib/components → components}/Tabs/Tabs.scss +0 -0
- package/src/{lib/components → components}/Tabs/TabsItem.scss +0 -0
- package/src/{lib/components → components}/Tabs/_theme.scss +0 -0
- package/src/{lib/components → components}/Tabs/index.js +0 -0
- package/src/{lib/components → components}/Text/Text.jsx +0 -0
- package/src/{lib/components → components}/Text/Text.scss +0 -0
- package/src/{lib/components → components}/Text/_helpers/getRootClampClassName.js +0 -0
- package/src/{lib/components → components}/Text/_helpers/getRootHyphensClassName.js +0 -0
- package/src/{lib/components → components}/Text/_helpers/getRootWordWrappingClassName.js +0 -0
- package/src/{lib/components → components}/Text/index.js +0 -0
- package/src/{lib/components → components}/TextArea/TextArea.jsx +0 -0
- package/src/{lib/components → components}/TextArea/TextArea.scss +0 -0
- package/src/{lib/components → components}/TextArea/index.js +0 -0
- package/src/{lib/components → components}/TextField/TextField.jsx +0 -0
- package/src/{lib/components → components}/TextField/TextField.scss +0 -0
- package/src/{lib/components → components}/TextField/index.js +0 -0
- package/src/{lib/components → components}/TextLink/TextLink.jsx +1 -1
- /package/src/{lib/components → components}/TextLink/TextLink.scss +0 -0
- /package/src/{lib/components → components}/TextLink/_theme.scss +0 -0
- /package/src/{lib/components → components}/TextLink/index.js +0 -0
- /package/src/{lib/components → components}/Toggle/Toggle.jsx +0 -0
- /package/src/{lib/components → components}/Toggle/Toggle.scss +0 -0
- /package/src/{lib/components → components}/Toggle/index.js +0 -0
- /package/src/{lib/components → components}/Toolbar/Toolbar.jsx +0 -0
- /package/src/{lib/components → components}/Toolbar/Toolbar.scss +0 -0
- /package/src/{lib/components → components}/Toolbar/ToolbarGroup.jsx +0 -0
- /package/src/{lib/components → components}/Toolbar/ToolbarItem.jsx +0 -0
- /package/src/{lib/components → components}/Toolbar/_helpers/getJustifyClassName.js +0 -0
- /package/src/{lib/components → components}/Toolbar/_theme.scss +0 -0
- /package/src/{lib/components → components}/Toolbar/index.js +0 -0
- /package/src/{lib/components → components}/_helpers/getRootColorClassName.js +0 -0
- /package/src/{lib/components → components}/_helpers/getRootSizeClassName.js +0 -0
- /package/src/{lib/components → components}/_helpers/getRootValidationStateClassName.js +0 -0
- /package/src/{lib/components → components}/_helpers/isChildrenEmpty.js +0 -0
- /package/src/{lib/components → components}/_helpers/resolveContextOrProp.js +0 -0
- /package/src/{lib/components → components}/_helpers/transferProps.js +0 -0
- /package/src/{lib/foundation.scss → foundation.scss} +0 -0
- /package/src/{lib/helpers.scss → helpers.scss} +0 -0
- /package/src/{lib/provider → provider}/RUIContext.jsx +0 -0
- /package/src/{lib/provider → provider}/index.js +0 -0
- /package/src/{lib/provider → provider}/withGlobalProps.jsx +0 -0
- /package/src/{lib/styles → styles}/_utilities.scss +0 -0
- /package/src/{lib/styles → styles}/elements/_code.scss +0 -0
- /package/src/{lib/styles → styles}/elements/_links.scss +0 -0
- /package/src/{lib/styles → styles}/elements/_lists.scss +0 -0
- /package/src/{lib/styles → styles}/elements/_page.scss +0 -0
- /package/src/{lib/styles → styles}/elements/_rulers.scss +0 -0
- /package/src/{lib/styles → styles}/elements/_small.scss +0 -0
- /package/src/{lib/styles → styles}/generic/_box-sizing.scss +0 -0
- /package/src/{lib/styles → styles}/generic/_focus.scss +0 -0
- /package/src/{lib/styles → styles}/generic/_forms.scss +0 -0
- /package/src/{lib/styles → styles}/generic/_reset.scss +0 -0
- /package/src/{lib/styles → styles}/generic/_shared.scss +0 -0
- /package/src/{lib/styles → styles}/helpers/_animation.scss +0 -0
- /package/src/{lib/styles → styles}/settings/_animations.scss +0 -0
- /package/src/{lib/styles → styles}/settings/_breakpoints.scss +0 -0
- /package/src/{lib/styles → styles}/settings/_escaped-characters.scss +0 -0
- /package/src/{lib/styles → styles}/settings/_form-fields.scss +0 -0
- /package/src/{lib/styles → styles}/settings/_forms.scss +0 -0
- /package/src/{lib/styles → styles}/settings/_utilities.scss +0 -0
- /package/src/{lib/styles → styles}/settings/_z-indexes.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_accessibility.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_borders.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_code.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_form-fields.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_links.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_lists.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_page.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_spacing.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_typography.scss +0 -0
- /package/src/{lib/styles → styles}/theme-constants/_breakpoints.scss +0 -0
- /package/src/{lib/styles → styles}/theme-constants/_colors.scss +0 -0
- /package/src/{lib/styles → styles}/theme-constants/_svg.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_accessibility.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_breakpoint.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_colors.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_reset.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_scrollbar.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_spacing.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_string.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_svg.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_transition.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_utilities.scss +0 -0
- /package/src/{lib/styles → styles}/tools/form-fields/_box-field-layout.scss +0 -0
- /package/src/{lib/styles → styles}/tools/form-fields/_box-field-sizes.scss +0 -0
- /package/src/{lib/styles → styles}/tools/form-fields/_foundation.scss +0 -0
- /package/src/{lib/styles → styles}/tools/form-fields/_inline-field-layout.scss +0 -0
- /package/src/{lib/styles → styles}/tools/form-fields/_variants.scss +0 -0
- /package/src/{lib/translations → translations}/en.js +0 -0
- /package/src/{lib/utils → utils}/classNames.js +0 -0
@@ -0,0 +1,359 @@
|
|
1
|
+
# Toolbar
|
2
|
+
|
3
|
+
The responsive Toolbar layout is a versatile tool that allows spacing, grouping,
|
4
|
+
and aligning inline items.
|
5
|
+
|
6
|
+
## Basic Usage
|
7
|
+
|
8
|
+
To implement the Toolbar component, you need to import it first:
|
9
|
+
|
10
|
+
```js
|
11
|
+
import { Toolbar, ToolbarItem } from '@react-ui-org/react-ui';
|
12
|
+
```
|
13
|
+
|
14
|
+
And use it:
|
15
|
+
|
16
|
+
```docoff-react-preview
|
17
|
+
<Toolbar>
|
18
|
+
<ToolbarItem>
|
19
|
+
<docoff-placeholder bordered>Toolbar item</docoff-placeholder>
|
20
|
+
</ToolbarItem>
|
21
|
+
<ToolbarItem>
|
22
|
+
<docoff-placeholder bordered>Toolbar item</docoff-placeholder>
|
23
|
+
</ToolbarItem>
|
24
|
+
<ToolbarItem>
|
25
|
+
<docoff-placeholder bordered>Toolbar item</docoff-placeholder>
|
26
|
+
</ToolbarItem>
|
27
|
+
</Toolbar>
|
28
|
+
```
|
29
|
+
|
30
|
+
See [API](#api) for all available options.
|
31
|
+
|
32
|
+
## General Guidelines
|
33
|
+
|
34
|
+
- **Toolbar is great for flexible inline layouts.** For stacking your content
|
35
|
+
vertically or building two-dimensional layouts head to the [Grid][grid]
|
36
|
+
layout.
|
37
|
+
|
38
|
+
- **Wrap your items** into the ToolbarItem component. This ensures your content
|
39
|
+
is properly spaced and aligned with other Toolbar elements. Do **not** try to
|
40
|
+
put any custom HTML or React components directly into the Toolbar layout
|
41
|
+
without wrapping it with the ToolbarItem first.
|
42
|
+
|
43
|
+
- **Be careful with using Toolbar with long or dynamic items in narrow
|
44
|
+
containers.** Toolbar intentionally prevents its items from shrinking using
|
45
|
+
`flex: none` which may cause overflow in case of lack of horizontal space.
|
46
|
+
Depending on your situation, consider turning on the `nowrap` option
|
47
|
+
(which allows shrinking of items but disables Toolbar from wrapping), using
|
48
|
+
the [Text][text] component to precisely control text wrapping, or switching to
|
49
|
+
the [Grid][grid] layout.
|
50
|
+
|
51
|
+
## Alignment
|
52
|
+
|
53
|
+
You can tweak your Toolbar layout using rich alignment options, both in
|
54
|
+
horizontal and vertical direction.
|
55
|
+
|
56
|
+
👉 At the current stage of development, React UI is **RTL aware** so switching
|
57
|
+
to a fully RTL-compatible behavior in the future should be painless. That's why
|
58
|
+
the justification values are called rather `start` than `left` and `end` instead
|
59
|
+
of `right`.
|
60
|
+
|
61
|
+
```docoff-react-preview
|
62
|
+
React.createElement(() => {
|
63
|
+
const [alignment, setAlignment] = React.useState('top');
|
64
|
+
const [justification, setJustification] = React.useState('start');
|
65
|
+
return (
|
66
|
+
<div>
|
67
|
+
<Toolbar>
|
68
|
+
<ToolbarGroup align="baseline">
|
69
|
+
<ToolbarItem>
|
70
|
+
<span id="alignment-label">Alignment:</span>
|
71
|
+
</ToolbarItem>
|
72
|
+
<ToolbarItem>
|
73
|
+
<ButtonGroup aria-labelledby="alignment-label" priority="outline">
|
74
|
+
<Button
|
75
|
+
aria-pressed={alignment === 'top'}
|
76
|
+
color={alignment === 'top' ? 'selected' : 'secondary'}
|
77
|
+
label="top"
|
78
|
+
onClick={() => setAlignment('top')}
|
79
|
+
/>
|
80
|
+
<Button
|
81
|
+
aria-pressed={alignment === 'middle'}
|
82
|
+
color={alignment === 'middle' ? 'selected' : 'secondary'}
|
83
|
+
label="middle"
|
84
|
+
onClick={() => setAlignment('middle')}
|
85
|
+
/>
|
86
|
+
<Button
|
87
|
+
aria-pressed={alignment === 'bottom'}
|
88
|
+
color={alignment === 'bottom' ? 'selected' : 'secondary'}
|
89
|
+
label="bottom"
|
90
|
+
onClick={() => setAlignment('bottom')}
|
91
|
+
/>
|
92
|
+
<Button
|
93
|
+
aria-pressed={alignment === 'baseline'}
|
94
|
+
color={alignment === 'baseline' ? 'selected' : 'secondary'}
|
95
|
+
label="baseline"
|
96
|
+
onClick={() => setAlignment('baseline')}
|
97
|
+
/>
|
98
|
+
</ButtonGroup>
|
99
|
+
</ToolbarItem>
|
100
|
+
</ToolbarGroup>
|
101
|
+
<ToolbarGroup align="baseline">
|
102
|
+
<ToolbarItem>
|
103
|
+
<span id="justification-label">Justification:</span>
|
104
|
+
</ToolbarItem>
|
105
|
+
<ToolbarItem>
|
106
|
+
<ButtonGroup aria-labelledby="justification-label" priority="outline">
|
107
|
+
<Button
|
108
|
+
aria-pressed={justification === 'start'}
|
109
|
+
color={justification === 'start' ? 'selected' : 'secondary'}
|
110
|
+
label="start"
|
111
|
+
onClick={() => setJustification('start')}
|
112
|
+
/>
|
113
|
+
<Button
|
114
|
+
aria-pressed={justification === 'center'}
|
115
|
+
color={justification === 'center' ? 'selected' : 'secondary'}
|
116
|
+
label="center"
|
117
|
+
onClick={() => setJustification('center')}
|
118
|
+
/>
|
119
|
+
<Button
|
120
|
+
aria-pressed={justification === 'end'}
|
121
|
+
color={justification === 'end' ? 'selected' : 'secondary'}
|
122
|
+
label="end"
|
123
|
+
onClick={() => setJustification('end')}
|
124
|
+
/>
|
125
|
+
<Button
|
126
|
+
aria-pressed={justification === 'space-between'}
|
127
|
+
color={justification === 'space-between' ? 'selected' : 'secondary'}
|
128
|
+
label="space-between"
|
129
|
+
onClick={() => setJustification('space-between')}
|
130
|
+
/>
|
131
|
+
</ButtonGroup>
|
132
|
+
</ToolbarItem>
|
133
|
+
</ToolbarGroup>
|
134
|
+
</Toolbar>
|
135
|
+
<Toolbar align={alignment} justify={justification}>
|
136
|
+
<ToolbarItem>
|
137
|
+
<docoff-placeholder bordered>First item</docoff-placeholder>
|
138
|
+
</ToolbarItem>
|
139
|
+
<ToolbarItem>
|
140
|
+
<docoff-placeholder bordered>
|
141
|
+
Second item<br />
|
142
|
+
is taller
|
143
|
+
</docoff-placeholder>
|
144
|
+
</ToolbarItem>
|
145
|
+
<ToolbarItem>
|
146
|
+
<docoff-placeholder bordered>Third item</docoff-placeholder>
|
147
|
+
</ToolbarItem>
|
148
|
+
</Toolbar>
|
149
|
+
</div>
|
150
|
+
);
|
151
|
+
});
|
152
|
+
```
|
153
|
+
|
154
|
+
## Groups
|
155
|
+
|
156
|
+
Toolbar items can be grouped which enables you aligning related items together.
|
157
|
+
To provide the best possible flexibility for building your layout, the
|
158
|
+
ToolbarGroup allows you to set many options similar to the Toolbar: vertical
|
159
|
+
alignment, [dense spacing](#dense-layout), or [disable wrapping](#wrapping).
|
160
|
+
|
161
|
+
```docoff-react-preview
|
162
|
+
<Toolbar justify="space-between">
|
163
|
+
<ToolbarGroup>
|
164
|
+
<ToolbarItem>
|
165
|
+
<docoff-placeholder bordered>Group A</docoff-placeholder>
|
166
|
+
</ToolbarItem>
|
167
|
+
<ToolbarItem>
|
168
|
+
<docoff-placeholder bordered>Group A</docoff-placeholder>
|
169
|
+
</ToolbarItem>
|
170
|
+
</ToolbarGroup>
|
171
|
+
<ToolbarGroup align="middle">
|
172
|
+
<ToolbarItem>
|
173
|
+
<docoff-placeholder bordered>Group B</docoff-placeholder>
|
174
|
+
</ToolbarItem>
|
175
|
+
<ToolbarItem>
|
176
|
+
<docoff-placeholder bordered>Group B</docoff-placeholder>
|
177
|
+
</ToolbarItem>
|
178
|
+
</ToolbarGroup>
|
179
|
+
<ToolbarItem>
|
180
|
+
<docoff-placeholder bordered>Item</docoff-placeholder>
|
181
|
+
</ToolbarItem>
|
182
|
+
</Toolbar>
|
183
|
+
```
|
184
|
+
|
185
|
+
## Dense Layout
|
186
|
+
|
187
|
+
Sometimes it's useful to get related items even closer together. This can be
|
188
|
+
easily achieved through the `dense` option which can be applied on individual
|
189
|
+
toolbar groups, or on the entire toolbar.
|
190
|
+
|
191
|
+
```docoff-react-preview
|
192
|
+
React.createElement(() => {
|
193
|
+
const [isGroupDense, setIsGroupDense] = React.useState(false);
|
194
|
+
const [isToolbarDense, setIsToolbarDense] = React.useState(false);
|
195
|
+
return (
|
196
|
+
<div>
|
197
|
+
<Toolbar>
|
198
|
+
<ToolbarItem>
|
199
|
+
<CheckboxField
|
200
|
+
checked={isGroupDense}
|
201
|
+
label="Dense ToolbarGroup"
|
202
|
+
onChange={(e) => setIsGroupDense(e.target.checked)}
|
203
|
+
/>
|
204
|
+
</ToolbarItem>
|
205
|
+
<ToolbarItem>
|
206
|
+
<CheckboxField
|
207
|
+
checked={isToolbarDense}
|
208
|
+
label="Dense Toolbar"
|
209
|
+
onChange={(e) => setIsToolbarDense(e.target.checked)}
|
210
|
+
/>
|
211
|
+
</ToolbarItem>
|
212
|
+
</Toolbar>
|
213
|
+
<Toolbar dense={isToolbarDense}>
|
214
|
+
<ToolbarGroup dense={isGroupDense}>
|
215
|
+
<ToolbarItem>
|
216
|
+
<docoff-placeholder bordered>Group item</docoff-placeholder>
|
217
|
+
</ToolbarItem>
|
218
|
+
<ToolbarItem>
|
219
|
+
<docoff-placeholder bordered>Group item</docoff-placeholder>
|
220
|
+
</ToolbarItem>
|
221
|
+
</ToolbarGroup>
|
222
|
+
<ToolbarItem>
|
223
|
+
<docoff-placeholder bordered>Standalone item</docoff-placeholder>
|
224
|
+
</ToolbarItem>
|
225
|
+
<ToolbarItem>
|
226
|
+
<docoff-placeholder bordered>Standalone item</docoff-placeholder>
|
227
|
+
</ToolbarItem>
|
228
|
+
</Toolbar>
|
229
|
+
</div>
|
230
|
+
);
|
231
|
+
});
|
232
|
+
```
|
233
|
+
|
234
|
+
## Wrapping
|
235
|
+
|
236
|
+
By default, all toolbar items are queued up one after another in a row. The
|
237
|
+
items automatically wrap and create a new row. To prevent this behavior, just
|
238
|
+
set the `nowrap` option on the Toolbar or on individual ToolbarGroups. Note that
|
239
|
+
ToolbarGroups can still wrap when the wrapping is disabled just on their parent
|
240
|
+
Toolbar.
|
241
|
+
|
242
|
+
```docoff-react-preview
|
243
|
+
<p>Disabled wrapping on entire toolbar:</p>
|
244
|
+
<Toolbar justify="space-between" nowrap>
|
245
|
+
<ToolbarGroup>
|
246
|
+
<ToolbarItem>
|
247
|
+
<docoff-placeholder bordered>Group A</docoff-placeholder>
|
248
|
+
</ToolbarItem>
|
249
|
+
<ToolbarItem>
|
250
|
+
<docoff-placeholder bordered>Group A</docoff-placeholder>
|
251
|
+
</ToolbarItem>
|
252
|
+
</ToolbarGroup>
|
253
|
+
<ToolbarGroup>
|
254
|
+
<ToolbarItem>
|
255
|
+
<docoff-placeholder bordered>Group B</docoff-placeholder>
|
256
|
+
</ToolbarItem>
|
257
|
+
<ToolbarItem>
|
258
|
+
<docoff-placeholder bordered>Group B</docoff-placeholder>
|
259
|
+
</ToolbarItem>
|
260
|
+
</ToolbarGroup>
|
261
|
+
<ToolbarItem>
|
262
|
+
<docoff-placeholder bordered>Item</docoff-placeholder>
|
263
|
+
</ToolbarItem>
|
264
|
+
</Toolbar>
|
265
|
+
<p>Disabled wrapping on toolbar groups:</p>
|
266
|
+
<Toolbar justify="space-between">
|
267
|
+
<ToolbarGroup nowrap>
|
268
|
+
<ToolbarItem>
|
269
|
+
<docoff-placeholder bordered>Group A</docoff-placeholder>
|
270
|
+
</ToolbarItem>
|
271
|
+
<ToolbarItem>
|
272
|
+
<docoff-placeholder bordered>Group A</docoff-placeholder>
|
273
|
+
</ToolbarItem>
|
274
|
+
</ToolbarGroup>
|
275
|
+
<ToolbarGroup nowrap>
|
276
|
+
<ToolbarItem>
|
277
|
+
<docoff-placeholder bordered>Group B</docoff-placeholder>
|
278
|
+
</ToolbarItem>
|
279
|
+
<ToolbarItem>
|
280
|
+
<docoff-placeholder bordered>Group B</docoff-placeholder>
|
281
|
+
</ToolbarItem>
|
282
|
+
</ToolbarGroup>
|
283
|
+
<ToolbarItem>
|
284
|
+
<docoff-placeholder bordered>Item</docoff-placeholder>
|
285
|
+
</ToolbarItem>
|
286
|
+
</Toolbar>
|
287
|
+
```
|
288
|
+
|
289
|
+
👉 Depending on your situation, you may need to further control wrapping of text
|
290
|
+
content placed within Toolbar. The [Text][text] component is designed
|
291
|
+
specifically for this kind of job.
|
292
|
+
|
293
|
+
## Flexible Items
|
294
|
+
|
295
|
+
Toolbar items can be made flexible to grow and shrink according to the available
|
296
|
+
space. This is useful e.g. when you need to combine text with an action:
|
297
|
+
|
298
|
+
```docoff-react-preview
|
299
|
+
<Toolbar>
|
300
|
+
<ToolbarItem flexible>
|
301
|
+
<docoff-placeholder bordered>My Headline</docoff-placeholder>
|
302
|
+
</ToolbarItem>
|
303
|
+
<ToolbarItem>
|
304
|
+
<docoff-placeholder bordered>Action</docoff-placeholder>
|
305
|
+
</ToolbarItem>
|
306
|
+
</Toolbar>
|
307
|
+
```
|
308
|
+
|
309
|
+
Or to build a classic media layout with image on the left and text on the right:
|
310
|
+
|
311
|
+
```docoff-react-preview
|
312
|
+
<Toolbar>
|
313
|
+
<ToolbarItem>
|
314
|
+
<docoff-placeholder bordered>Media object</docoff-placeholder>
|
315
|
+
</ToolbarItem>
|
316
|
+
<ToolbarItem flexible>
|
317
|
+
<docoff-placeholder bordered>Media body</docoff-placeholder>
|
318
|
+
</ToolbarItem>
|
319
|
+
</Toolbar>
|
320
|
+
```
|
321
|
+
|
322
|
+
## Forwarding HTML Attributes
|
323
|
+
|
324
|
+
In addition to the options below in the [component's API](#api) section, you
|
325
|
+
can specify [React synthetic events] or **any HTML attribute you like.** All
|
326
|
+
attributes that don't interfere with the API are forwarded to the root `<div>`
|
327
|
+
HTML element. This enables making the component interactive and helps to improve
|
328
|
+
its accessibility.
|
329
|
+
|
330
|
+
👉 Refer to the MDN reference for the full list of supported attributes of the
|
331
|
+
[div] element.
|
332
|
+
|
333
|
+
## API
|
334
|
+
|
335
|
+
<docoff-react-props src="/components/Toolbar/Toolbar.jsx"></docoff-react-props>
|
336
|
+
|
337
|
+
### ToolbarGroup API
|
338
|
+
|
339
|
+
A wrapper for grouping ToolbarItems together.
|
340
|
+
|
341
|
+
<docoff-react-props src="/components/Toolbar/ToolbarGroup.jsx"></docoff-react-props>
|
342
|
+
|
343
|
+
### ToolbarItem API
|
344
|
+
|
345
|
+
A wrapper for individual toolbar items.
|
346
|
+
|
347
|
+
<docoff-react-props src="/components/Toolbar/ToolbarItem.jsx"></docoff-react-props>
|
348
|
+
|
349
|
+
## Theming
|
350
|
+
|
351
|
+
| Custom Property | Description |
|
352
|
+
|------------------------------------------------------|--------------------------------------------------------------|
|
353
|
+
| `--rui-Toolbar__gap` | Gap between toolbar items |
|
354
|
+
| `--rui-Toolbar__gap--dense` | Dense gap between toolbar items |
|
355
|
+
|
356
|
+
[grid]: /components/Grid
|
357
|
+
[text]: /components/Text
|
358
|
+
[React synthetic events]: https://reactjs.org/docs/events.html
|
359
|
+
[div]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
|
@@ -1,19 +1,27 @@
|
|
1
1
|
export const getAlignClassName = (value, styles, type) => {
|
2
2
|
if (value === 'top') {
|
3
|
-
if (type === 'group')
|
3
|
+
if (type === 'group') {
|
4
|
+
return styles.isGroupAlignedToTop;
|
5
|
+
}
|
4
6
|
return styles.isToolbarAlignedToTop;
|
5
7
|
}
|
6
8
|
|
7
9
|
if (value === 'middle') {
|
8
|
-
if (type === 'group')
|
10
|
+
if (type === 'group') {
|
11
|
+
return styles.isGroupAlignedToMiddle;
|
12
|
+
}
|
9
13
|
return styles.isToolbarAlignedToMiddle;
|
10
14
|
}
|
11
15
|
|
12
16
|
if (value === 'bottom') {
|
13
|
-
if (type === 'group')
|
17
|
+
if (type === 'group') {
|
18
|
+
return styles.isGroupAlignedToBottom;
|
19
|
+
}
|
14
20
|
return styles.isToolbarAlignedToBottom;
|
15
21
|
}
|
16
22
|
|
17
|
-
if (type === 'group')
|
23
|
+
if (type === 'group') {
|
24
|
+
return styles.isGroupAlignedToBaseline;
|
25
|
+
}
|
18
26
|
return styles.isToolbarAlignedToBaseline;
|
19
27
|
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export default (priority, styles) => {
|
2
|
+
if (priority === 'filled') {
|
3
|
+
return styles.isRootPriorityFilled;
|
4
|
+
}
|
5
|
+
|
6
|
+
if (priority === 'outline') {
|
7
|
+
return styles.isRootPriorityOutline;
|
8
|
+
}
|
9
|
+
|
10
|
+
if (priority === 'flat') {
|
11
|
+
return styles.isRootPriorityFlat;
|
12
|
+
}
|
13
|
+
|
14
|
+
return null;
|
15
|
+
};
|
@@ -1,3 +1,9 @@
|
|
1
|
+
// Global definitions
|
2
|
+
// These need to be imported here to be placed in the distribution CSS file
|
3
|
+
import './theme.scss';
|
4
|
+
import './foundation.scss';
|
5
|
+
import './helpers.scss';
|
6
|
+
|
1
7
|
// Components
|
2
8
|
export { Alert } from './components/Alert';
|
3
9
|
export { Badge } from './components/Badge';
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
|
-
import React
|
2
|
+
import React, {
|
3
|
+
useMemo,
|
4
|
+
} from 'react';
|
3
5
|
import defaultTranslations from '../translations/en';
|
4
6
|
import RUIContext from './RUIContext';
|
5
7
|
|
@@ -7,16 +9,20 @@ const RUIProvider = ({
|
|
7
9
|
children,
|
8
10
|
globalProps,
|
9
11
|
translations,
|
10
|
-
}) =>
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
12
|
+
}) => {
|
13
|
+
const childProps = useMemo(() => ({
|
14
|
+
globalProps,
|
15
|
+
translations,
|
16
|
+
}), [globalProps, translations]);
|
17
|
+
|
18
|
+
return (
|
19
|
+
<RUIContext.Provider
|
20
|
+
value={childProps}
|
21
|
+
>
|
22
|
+
{children}
|
23
|
+
</RUIContext.Provider>
|
24
|
+
);
|
25
|
+
};
|
20
26
|
|
21
27
|
RUIProvider.defaultProps = {
|
22
28
|
children: null,
|
@@ -11,7 +11,7 @@
|
|
11
11
|
|
12
12
|
@use "../../theme/typography";
|
13
13
|
@use "../../theme/form-fields" as theme;
|
14
|
-
@use "
|
14
|
+
@use "../accessibility";
|
15
15
|
@use "../transition";
|
16
16
|
|
17
17
|
@mixin check-input($type) {
|
@@ -26,7 +26,7 @@
|
|
26
26
|
background-size: contain;
|
27
27
|
background-repeat: no-repeat;
|
28
28
|
background-color: var(--rui-local-check-background-color);
|
29
|
-
color-adjust: exact; // 1.
|
29
|
+
print-color-adjust: exact; // 1.
|
30
30
|
|
31
31
|
&:focus,
|
32
32
|
&:checked:focus {
|
@@ -4,7 +4,8 @@
|
|
4
4
|
@use "styles/theme-constants/colors";
|
5
5
|
@use "styles/theme-constants/svg";
|
6
6
|
|
7
|
-
:root
|
7
|
+
:root,
|
8
|
+
:host {
|
8
9
|
// ============================================================================================ //
|
9
10
|
// GLOBAL TOKENS //
|
10
11
|
// ============================================================================================ //
|
@@ -717,7 +718,7 @@
|
|
717
718
|
// ButtonGroup: filled buttons
|
718
719
|
--rui-ButtonGroup--filled__gap: calc(-1 * var(--rui-Button__border-width));
|
719
720
|
--rui-ButtonGroup--filled__separator__width: var(--rui-Button__border-width);
|
720
|
-
--rui-ButtonGroup--filled__separator__color:
|
721
|
+
--rui-ButtonGroup--filled__separator__color: currentcolor;
|
721
722
|
|
722
723
|
// ButtonGroup: outline buttons
|
723
724
|
--rui-ButtonGroup--outline__gap: calc(-1 * var(--rui-Button__border-width));
|
@@ -727,7 +728,7 @@
|
|
727
728
|
// ButtonGroup: flat buttons
|
728
729
|
--rui-ButtonGroup--flat__gap: var(--rui-Button__border-width);
|
729
730
|
--rui-ButtonGroup--flat__separator__width: var(--rui-ButtonGroup--flat__gap);
|
730
|
-
--rui-ButtonGroup--flat__separator__color:
|
731
|
+
--rui-ButtonGroup--flat__separator__color: currentcolor;
|
731
732
|
|
732
733
|
//
|
733
734
|
// Card
|
package/CONTRIBUTING.md
DELETED
@@ -1,137 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: General Guidelines
|
3
|
-
route: /contribute/guidelines
|
4
|
-
menu: Contribute
|
5
|
-
---
|
6
|
-
|
7
|
-
# Contributing
|
8
|
-
|
9
|
-
In the first place, thank you for your interest in contributing! 🙏
|
10
|
-
|
11
|
-
## Development
|
12
|
-
|
13
|
-
To build the project:
|
14
|
-
|
15
|
-
1. Install local npm packages: `npm install`
|
16
|
-
2. Run the build: `npm run build`
|
17
|
-
|
18
|
-
To run the dev server:
|
19
|
-
|
20
|
-
1. Install local npm packages: `npm install`
|
21
|
-
2. Run the dev server (usually on `http://localhost:3000`): `npm start`
|
22
|
-
|
23
|
-
## Git Workflow
|
24
|
-
|
25
|
-
In order for the automation to work in the best possible way (we use GitHub
|
26
|
-
Actions), please follow these guidelines:
|
27
|
-
|
28
|
-
1. **One pull request per subject.** Don't combine unrelated changes in a single
|
29
|
-
PR unless they are really subtle details such as fix of a typo.
|
30
|
-
|
31
|
-
2. **Only PRs into `master` branch are listed in changelog.** PRs into other
|
32
|
-
branches are not picked up by release automation.
|
33
|
-
|
34
|
-
3. **Name your branches according to nature of change.** Choose one of:
|
35
|
-
|
36
|
-
- `bc/*` for breaking changes
|
37
|
-
- `feature/*` for features
|
38
|
-
- `bugfix/*` for bugfixes
|
39
|
-
- `refactoring/*` for refactoring of the library
|
40
|
-
- `docs/*` or `documentation/*` for changes in docs
|
41
|
-
- `maintenance/*` for maintenance (builds, dependencies, automation, etc.)
|
42
|
-
- `release/*` for [releases](/contribute/releasing) (administrators only)
|
43
|
-
|
44
|
-
4. **Write clear, helpful and descriptive commit messages.**
|
45
|
-
|
46
|
-
1. **Use imperative and write in English,** e.g. _Update dependencies_ or
|
47
|
-
_Claim support for controlled components only_.
|
48
|
-
2. **If an issue exists for your changes, append the issue number** in
|
49
|
-
parentheses to the end of the commit message, e.g. _Update dependencies
|
50
|
-
(#261)_.
|
51
|
-
3. Optionally use Markdown code blocks to emphasize, e.g.
|
52
|
-
_Create `ScrollView` component (#53)_.
|
53
|
-
|
54
|
-
5. **Write clear, helpful and descriptive PR names.**
|
55
|
-
|
56
|
-
1. **All rules for commit messages apply** also for PR names.
|
57
|
-
2. **Always check that PR name meets the requirements** above because **PR
|
58
|
-
names are used in changelog**. GitHub automatically truncates long PR
|
59
|
-
names and picks up branch name for multi-commit PRs, so it's necessary to
|
60
|
-
make sure the PR name is what we want to have in the changelog.
|
61
|
-
3. **If an issue exists for your changes, append this text to PR
|
62
|
-
description** (the topmost comment in the PR) in order for the issue to be
|
63
|
-
closed automatically once the PR is merged: `Closes #<ISSUE NUMBER>`. You
|
64
|
-
will know the issue is linked correctly when it appears in the _Linked
|
65
|
-
issues_ section of the PR. (Having the issue mentioned in commit message
|
66
|
-
and/or PR name does _not_ have this effect.)
|
67
|
-
4. **If there is no issue for your changes, please add your PR to `The
|
68
|
-
Board`** GitHub project in the _Projects_ section of the PR. The correct
|
69
|
-
board column will be selected automatically. This helps us keep track of
|
70
|
-
what is in development.
|
71
|
-
|
72
|
-
Pull requests are labelled automatically. You can add more labels to better
|
73
|
-
qualify the nature of the change — in such case, it will be included in all
|
74
|
-
corresponding changelog groups. Or use the `skip changelog` label to exclude a
|
75
|
-
pull request from the changelog.
|
76
|
-
|
77
|
-
## Package Linking
|
78
|
-
|
79
|
-
The best way for development of React UI is to link `react-ui` into your
|
80
|
-
application with `npm link` so you can see it in action.
|
81
|
-
|
82
|
-
1. In React UI repository, run `npm link`
|
83
|
-
2. In your application, run `npm link @react-ui-org/react-ui`
|
84
|
-
|
85
|
-
To prevent
|
86
|
-
[Invalid Hook Call Warning](https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react)
|
87
|
-
when React UI is linked, add the following code to your app's Webpack config:
|
88
|
-
|
89
|
-
```js
|
90
|
-
const path = require('path');
|
91
|
-
|
92
|
-
module.exports = {
|
93
|
-
resolve: {
|
94
|
-
alias: {
|
95
|
-
react: path.resolve('./node_modules/react'),
|
96
|
-
'react-dom': path.resolve('./node_modules/react-dom'),
|
97
|
-
},
|
98
|
-
},
|
99
|
-
};
|
100
|
-
```
|
101
|
-
|
102
|
-
## General Guidelines
|
103
|
-
|
104
|
-
To keep React UI consistent and predictable the following guidelines should be observed:
|
105
|
-
|
106
|
-
1. If component accepts the `children` prop it should be either required or the element
|
107
|
-
should return `null` when no children are provided.
|
108
|
-
|
109
|
-
## Documenting
|
110
|
-
|
111
|
-
We use [Docz](https://docz.site) (powered by [Gatsby](https://www.gatsbyjs.com))
|
112
|
-
as the documentation platform. The documentation itself is written in
|
113
|
-
[MDX](https://mdxjs.com) format — a human-readable blend of the popular Markdown
|
114
|
-
and JSX syntax.
|
115
|
-
|
116
|
-
Run `npm start` to run the docs in development mode, and open
|
117
|
-
`http://localhost:3000` in your browser to see the docs in live-reload mode.
|
118
|
-
|
119
|
-
A few things to note:
|
120
|
-
|
121
|
-
- In order to get component props parsed and rendered by Docz, it's crucial to
|
122
|
-
**import the component into an MDX file right from its source file** — parsing
|
123
|
-
a re-exported component (typically via `index.js`) isn't currently supported.
|
124
|
-
|
125
|
-
- If you don't want Gatsby to collect **anonymous statistics**, you may want to
|
126
|
-
disable [Gatsby telemetry](https://www.gatsbyjs.com/docs/telemetry/) by
|
127
|
-
running `npx gatsby telemetry --disable`.
|
128
|
-
|
129
|
-
- If you see the Not found page after having **changed the configuration of Docz
|
130
|
-
or Gatsby in the live-reload mode,** you may either restart the Docz
|
131
|
-
development server (`ctrl + c` and `npm start`), or try to edit an MDX file
|
132
|
-
which makes the Docz rebuild, too.
|
133
|
-
|
134
|
-
- To **make your authoring experience better,** we recommend to make sure your
|
135
|
-
IDE understands the MDX syntax and is able to help you wrap lines in MD and
|
136
|
-
MDX files automatically (Jetbrains IDE's and VSCode support both features
|
137
|
-
out-of-the-box or through a plugin).
|