@react-ui-org/react-ui 0.44.1 → 0.47.0
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 +7 -0
- package/README.md +15 -16
- package/dist/lib.development.js +271 -415
- package/dist/lib.js +1 -1
- package/package.json +11 -13
- package/src/lib/components/Alert/Alert.jsx +45 -44
- package/src/lib/components/Alert/Alert.scss +48 -48
- package/src/lib/components/Alert/README.mdx +2 -5
- package/src/lib/components/Alert/_settings.scss +4 -4
- package/src/lib/components/Alert/_theme.scss +50 -50
- package/src/lib/components/Alert/_tools.scss +6 -6
- package/src/lib/components/Badge/Badge.jsx +9 -11
- package/src/lib/components/Badge/Badge.scss +57 -57
- package/src/lib/components/Button/Button.jsx +14 -13
- package/src/lib/components/Button/Button.scss +2 -2
- package/src/lib/components/Button/README.mdx +11 -6
- package/src/lib/components/Button/_base.scss +69 -69
- package/src/lib/components/Button/_priorities.scss +49 -49
- package/src/lib/components/Button/_settings.scss +10 -10
- package/src/lib/components/Button/_theme.scss +18 -15
- package/src/lib/components/Button/_tools.scss +98 -100
- package/src/lib/components/Button/helpers/getRootLabelVisibilityClassName.js +4 -4
- package/src/lib/components/ButtonGroup/ButtonGroup.jsx +41 -25
- package/src/lib/components/ButtonGroup/ButtonGroup.scss +3 -3
- package/src/lib/components/ButtonGroup/README.mdx +1 -1
- package/src/lib/components/Card/Card.jsx +10 -9
- package/src/lib/components/Card/Card.scss +28 -28
- package/src/lib/components/Card/CardBody.jsx +17 -12
- package/src/lib/components/Card/CardFooter.jsx +22 -9
- package/src/lib/components/Card/_theme.scss +50 -50
- package/src/lib/components/Card/_tools.scss +6 -6
- package/src/lib/components/CheckboxField/CheckboxField.jsx +21 -20
- package/src/lib/components/CheckboxField/CheckboxField.scss +20 -20
- package/src/lib/components/CheckboxField/README.mdx +1 -1
- package/src/lib/components/FileInputField/FileInputField.jsx +16 -15
- package/src/lib/components/FileInputField/FileInputField.scss +19 -19
- package/src/lib/components/FileInputField/README.mdx +1 -1
- package/src/lib/components/FormLayout/FormLayout.jsx +19 -17
- package/src/lib/components/FormLayout/FormLayout.scss +17 -17
- package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +18 -12
- package/src/lib/components/FormLayout/FormLayoutCustomField.scss +18 -18
- package/src/lib/components/FormLayout/README.mdx +26 -49
- package/src/lib/components/Grid/Grid.jsx +25 -24
- package/src/lib/components/Grid/Grid.scss +33 -29
- package/src/lib/components/Grid/GridSpan.jsx +11 -10
- package/src/lib/components/Grid/README.mdx +46 -20
- package/src/lib/components/Grid/{helpers → _helpers}/generateResponsiveCustomProperties.js +0 -2
- package/src/lib/components/Grid/_theme.scss +9 -9
- package/src/lib/components/Grid/_tools.scss +20 -20
- package/src/lib/components/Modal/Modal.jsx +38 -32
- package/src/lib/components/Modal/Modal.scss +73 -73
- package/src/lib/components/Modal/README.mdx +2 -5
- package/src/lib/components/Modal/_settings.scss +5 -5
- package/src/lib/components/Modal/_theme.scss +17 -17
- package/src/lib/components/Paper/Paper.jsx +9 -9
- package/src/lib/components/Paper/Paper.scss +8 -8
- package/src/lib/components/Popover/Popover.jsx +94 -0
- package/src/lib/components/Popover/Popover.scss +235 -0
- package/src/lib/components/Popover/PopoverWrapper.jsx +46 -0
- package/src/lib/components/Popover/README.mdx +333 -0
- package/src/lib/components/Popover/_helpers/getRootAlignmentClassName.js +13 -0
- package/src/lib/components/Popover/_helpers/getRootSideClassName.js +17 -0
- package/src/lib/components/Popover/_theme.scss +16 -0
- package/src/lib/components/Popover/index.js +2 -0
- package/src/lib/components/Radio/README.mdx +1 -1
- package/src/lib/components/Radio/Radio.jsx +15 -14
- package/src/lib/components/Radio/Radio.scss +26 -26
- package/src/lib/components/ScrollView/README.mdx +5 -5
- package/src/lib/components/ScrollView/ScrollView.jsx +22 -22
- package/src/lib/components/ScrollView/ScrollView.scss +113 -113
- package/src/lib/{services/elementPositionService.js → components/ScrollView/_helpers/getElementsPositionDifference.js} +0 -2
- package/src/lib/{hooks → components/ScrollView/_hooks}/useLoadResizeHook.js +1 -1
- package/src/lib/{hooks → components/ScrollView/_hooks}/useScrollPositionHook.js +1 -1
- package/src/lib/components/SelectField/README.mdx +1 -1
- package/src/lib/components/SelectField/SelectField.jsx +17 -16
- package/src/lib/components/SelectField/SelectField.scss +30 -30
- package/src/lib/components/Table/README.mdx +1 -1
- package/src/lib/components/Table/Table.jsx +3 -3
- package/src/lib/components/Table/Table.scss +28 -35
- package/src/lib/components/Table/_settings.scss +5 -5
- package/src/lib/components/Tabs/Tabs.jsx +4 -5
- package/src/lib/components/Tabs/Tabs.scss +21 -21
- package/src/lib/components/Tabs/TabsItem.jsx +7 -6
- package/src/lib/components/Tabs/TabsItem.scss +78 -78
- package/src/lib/components/Text/README.mdx +3 -3
- package/src/lib/components/Text/Text.jsx +16 -9
- package/src/lib/components/Text/Text.scss +23 -13
- package/src/lib/components/Text/_helpers/getRootClampClassName.js +11 -0
- package/src/lib/components/Text/{helpers → _helpers}/getRootHyphensClassName.js +1 -1
- package/src/lib/components/Text/{helpers → _helpers}/getRootWordWrappingClassName.js +1 -1
- package/src/lib/components/TextArea/README.mdx +1 -1
- package/src/lib/components/TextArea/TextArea.jsx +21 -17
- package/src/lib/components/TextArea/TextArea.scss +27 -27
- package/src/lib/components/TextField/README.mdx +1 -1
- package/src/lib/components/TextField/TextField.jsx +19 -18
- package/src/lib/components/TextField/TextField.scss +28 -28
- package/src/lib/components/TextLink/README.mdx +77 -0
- package/src/lib/components/TextLink/TextLink.jsx +44 -0
- package/src/lib/components/TextLink/TextLink.scss +11 -0
- package/src/lib/components/TextLink/_theme.scss +4 -0
- package/src/lib/components/TextLink/index.js +1 -0
- package/src/lib/components/Toggle/README.mdx +1 -1
- package/src/lib/components/Toggle/Toggle.jsx +21 -20
- package/src/lib/components/Toggle/Toggle.scss +20 -20
- package/src/lib/components/Toolbar/README.mdx +33 -5
- package/src/lib/components/Toolbar/Toolbar.jsx +33 -17
- package/src/lib/components/Toolbar/Toolbar.scss +29 -42
- package/src/lib/components/Toolbar/ToolbarGroup.jsx +28 -16
- package/src/lib/components/Toolbar/ToolbarItem.jsx +36 -10
- package/src/lib/{helpers → components/_helpers}/getRootColorClassName.js +1 -1
- package/src/lib/{helpers → components/_helpers}/getRootSizeClassName.js +1 -1
- package/src/lib/{helpers → components/_helpers}/getRootValidationStateClassName.js +1 -1
- package/src/lib/components/_helpers/isChildrenEmpty.js +3 -0
- package/src/lib/{helpers → components/_helpers}/resolveContextOrProp.js +0 -0
- package/src/lib/{utils → components/_helpers}/transferProps.js +1 -1
- package/src/lib/foundation.scss +11 -11
- package/src/lib/helpers.scss +2 -2
- package/src/lib/index.js +8 -17
- package/src/lib/provider/index.js +2 -1
- package/src/lib/provider/withGlobalProps.jsx +21 -0
- package/src/lib/styles/_utilities.scss +13 -13
- package/src/lib/styles/elements/_code.scss +7 -7
- package/src/lib/styles/elements/_links.scss +8 -8
- package/src/lib/styles/elements/_lists.scss +3 -3
- package/src/lib/styles/elements/_page.scss +14 -14
- package/src/lib/styles/elements/_rulers.scss +6 -6
- package/src/lib/styles/elements/_small.scss +2 -2
- package/src/lib/styles/generic/_box-sizing.scss +3 -2
- package/src/lib/styles/generic/_forms.scss +3 -3
- package/src/lib/styles/generic/_reset.scss +6 -6
- package/src/lib/styles/generic/_shared.scss +3 -3
- package/src/lib/styles/helpers/_animation.scss +8 -8
- package/src/lib/styles/settings/_breakpoints.scss +7 -7
- package/src/lib/styles/settings/_escaped-characters.scss +5 -5
- package/src/lib/styles/settings/_form-fields.scss +24 -24
- package/src/lib/styles/settings/_utilities.scss +112 -100
- package/src/lib/styles/theme/_colors.scss +50 -50
- package/src/lib/styles/theme/_form-fields.scss +32 -32
- package/src/lib/styles/theme/_spacing.scss +11 -11
- package/src/lib/styles/theme/_typography.scss +12 -11
- package/src/lib/styles/theme-constants/_breakpoints.scss +4 -4
- package/src/lib/styles/theme-constants/_colors.scss +2 -2
- package/src/lib/styles/theme-constants/_svg.scss +1 -2
- package/src/lib/styles/tools/_accessibility.scss +29 -29
- package/src/lib/styles/tools/_breakpoint.scss +11 -14
- package/src/lib/styles/tools/_caret.scss +8 -8
- package/src/lib/styles/tools/_colors.scss +3 -3
- package/src/lib/styles/tools/_reset.scss +24 -21
- package/src/lib/styles/tools/_scrollbar.scss +4 -4
- package/src/lib/styles/tools/_spacing.scss +14 -22
- package/src/lib/styles/tools/_string.scss +9 -9
- package/src/lib/styles/tools/_svg.scss +13 -16
- package/src/lib/styles/tools/_transition.scss +42 -44
- package/src/lib/styles/tools/_utilities.scss +19 -19
- package/src/lib/styles/tools/form-fields/_box-field-elements.scss +88 -88
- package/src/lib/styles/tools/form-fields/_box-field-layout.scss +147 -147
- package/src/lib/styles/tools/form-fields/_box-field-sizes.scss +13 -15
- package/src/lib/styles/tools/form-fields/_foundation.scss +12 -12
- package/src/lib/styles/tools/form-fields/_inline-field-elements.scss +82 -71
- package/src/lib/styles/tools/form-fields/_inline-field-layout.scss +88 -47
- package/src/lib/styles/tools/form-fields/_variants.scss +104 -106
- package/src/lib/theme.scss +959 -954
- package/src/lib/utils/classNames.js +8 -0
- package/src/lib/components/CTA/CTA.jsx +0 -60
- package/src/lib/components/CTA/CTA.scss +0 -71
- package/src/lib/components/CTA/CTACenter.jsx +0 -27
- package/src/lib/components/CTA/CTAEnd.jsx +0 -27
- package/src/lib/components/CTA/CTAStart.jsx +0 -27
- package/src/lib/components/CTA/README.mdx +0 -119
- package/src/lib/components/CTA/index.js +0 -4
- package/src/lib/components/Center/Center.jsx +0 -27
- package/src/lib/components/Center/Center.scss +0 -7
- package/src/lib/components/Center/README.mdx +0 -52
- package/src/lib/components/Center/index.js +0 -1
- package/src/lib/components/Link/Link.jsx +0 -45
- package/src/lib/components/Link/Link.scss +0 -11
- package/src/lib/components/Link/README.mdx +0 -85
- package/src/lib/components/Link/_theme.scss +0 -4
- package/src/lib/components/Link/index.js +0 -1
- package/src/lib/components/List/List.jsx +0 -71
- package/src/lib/components/List/List.scss +0 -53
- package/src/lib/components/List/ListItem.jsx +0 -31
- package/src/lib/components/List/README.mdx +0 -114
- package/src/lib/components/List/_theme.scss +0 -1
- package/src/lib/components/List/index.js +0 -2
- package/src/lib/components/Media/Media.jsx +0 -29
- package/src/lib/components/Media/Media.scss +0 -16
- package/src/lib/components/Media/MediaBody.jsx +0 -21
- package/src/lib/components/Media/MediaObject.jsx +0 -21
- package/src/lib/components/Media/README.mdx +0 -63
- package/src/lib/components/Media/index.js +0 -3
- package/src/lib/provider/withProviderContext.jsx +0 -32
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
@use
|
|
2
|
-
@use
|
|
3
|
-
@use
|
|
4
|
-
@use
|
|
5
|
-
@use
|
|
1
|
+
@use "../../styles/tools/form-fields/foundation";
|
|
2
|
+
@use "../../styles/tools/form-fields/inline-field-elements";
|
|
3
|
+
@use "../../styles/tools/form-fields/inline-field-layout";
|
|
4
|
+
@use "../../styles/tools/form-fields/variants";
|
|
5
|
+
@use "../../styles/tools/accessibility";
|
|
6
6
|
|
|
7
7
|
// Foundation
|
|
8
8
|
.root {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
@include foundation.root();
|
|
10
|
+
@include inline-field-layout.root();
|
|
11
|
+
@include inline-field-elements.min-tap-target($type: toggle);
|
|
12
|
+
@include variants.visual(check);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.label {
|
|
16
|
-
|
|
16
|
+
@include foundation.label();
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.field {
|
|
20
|
-
|
|
20
|
+
@include inline-field-layout.field($type: toggle);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
.input {
|
|
24
|
-
|
|
24
|
+
@include inline-field-elements.check-input($type: toggle);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.helpText,
|
|
28
28
|
.validationText {
|
|
29
|
-
|
|
29
|
+
@include foundation.help-text();
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
.isRootRequired .label {
|
|
33
|
-
|
|
33
|
+
@include foundation.label-required();
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
// States
|
|
37
37
|
.isRootStateInvalid {
|
|
38
|
-
|
|
38
|
+
@include variants.validation(invalid);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
.isRootStateValid {
|
|
42
|
-
|
|
42
|
+
@include variants.validation(valid);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
.isRootStateWarning {
|
|
46
|
-
|
|
46
|
+
@include variants.validation(warning);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
// Invisible label
|
|
50
50
|
.isLabelHidden {
|
|
51
|
-
|
|
51
|
+
@include accessibility.hide-text();
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
// Layouts
|
|
55
55
|
.hasRootLabelBefore {
|
|
56
|
-
|
|
56
|
+
@include inline-field-layout.has-label-before();
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
.isRootInFormLayout {
|
|
60
|
-
|
|
60
|
+
@include inline-field-layout.in-form-layout();
|
|
61
61
|
}
|
|
@@ -50,8 +50,8 @@ See [API](#api) for all available options.
|
|
|
50
50
|
## General Guidelines
|
|
51
51
|
|
|
52
52
|
- **Toolbar is great for flexible inline layouts.** For stacking your content
|
|
53
|
-
vertically
|
|
54
|
-
|
|
53
|
+
vertically or building two-dimensional layouts head to the [Grid][grid]
|
|
54
|
+
layout.
|
|
55
55
|
|
|
56
56
|
- **Wrap your items** into the ToolbarItem component. This ensures your content
|
|
57
57
|
is properly spaced and aligned with other Toolbar elements. Do **not** try to
|
|
@@ -88,7 +88,7 @@ of `right`.
|
|
|
88
88
|
<span id="alignment-label">Alignment:</span>
|
|
89
89
|
</ToolbarItem>
|
|
90
90
|
<ToolbarItem>
|
|
91
|
-
<ButtonGroup aria-labelledby="
|
|
91
|
+
<ButtonGroup aria-labelledby="alignment-label">
|
|
92
92
|
<Button
|
|
93
93
|
color={alignment === 'top' ? 'dark' : 'primary'}
|
|
94
94
|
label="top"
|
|
@@ -117,7 +117,7 @@ of `right`.
|
|
|
117
117
|
<span id="justification-label">Justification:</span>
|
|
118
118
|
</ToolbarItem>
|
|
119
119
|
<ToolbarItem>
|
|
120
|
-
<ButtonGroup aria-labelledby="
|
|
120
|
+
<ButtonGroup aria-labelledby="justification-label">
|
|
121
121
|
<Button
|
|
122
122
|
color={justification === 'start' ? 'dark' : 'primary'}
|
|
123
123
|
label="start"
|
|
@@ -304,6 +304,35 @@ Toolbar.
|
|
|
304
304
|
content placed within Toolbar. The [Text][text] component is designed
|
|
305
305
|
specifically for this kind of job.
|
|
306
306
|
|
|
307
|
+
## Flexible Items
|
|
308
|
+
|
|
309
|
+
Toolbar items can be made flexible to grow and shrink according to the available
|
|
310
|
+
space. This is useful e.g. when you need to combine text with an action:
|
|
311
|
+
|
|
312
|
+
<Playground>
|
|
313
|
+
<Toolbar>
|
|
314
|
+
<ToolbarItem flexible>
|
|
315
|
+
<Placeholder bordered>My Headline</Placeholder>
|
|
316
|
+
</ToolbarItem>
|
|
317
|
+
<ToolbarItem>
|
|
318
|
+
<Placeholder bordered>Action</Placeholder>
|
|
319
|
+
</ToolbarItem>
|
|
320
|
+
</Toolbar>
|
|
321
|
+
</Playground>
|
|
322
|
+
|
|
323
|
+
Or to build a classic media layout with image on the left and text on the right:
|
|
324
|
+
|
|
325
|
+
<Playground>
|
|
326
|
+
<Toolbar>
|
|
327
|
+
<ToolbarItem>
|
|
328
|
+
<Placeholder bordered>Media object</Placeholder>
|
|
329
|
+
</ToolbarItem>
|
|
330
|
+
<ToolbarItem flexible>
|
|
331
|
+
<Placeholder bordered>Media body</Placeholder>
|
|
332
|
+
</ToolbarItem>
|
|
333
|
+
</Toolbar>
|
|
334
|
+
</Playground>
|
|
335
|
+
|
|
307
336
|
## API
|
|
308
337
|
|
|
309
338
|
<Props table of={Toolbar} />
|
|
@@ -330,6 +359,5 @@ A wrapper for individual toolbar items.
|
|
|
330
359
|
[inline-elements]: https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements
|
|
331
360
|
[block-elements]: https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements
|
|
332
361
|
[grid]: /components/grid
|
|
333
|
-
[list]: /components/list
|
|
334
362
|
[spacing]: /css-helpers/spacing
|
|
335
363
|
[text]: /components/text
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { withGlobalProps } from '../../provider';
|
|
4
|
+
import { classNames } from '../../utils/classNames';
|
|
5
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
|
4
6
|
import styles from './Toolbar.scss';
|
|
5
7
|
|
|
6
|
-
export const Toolbar = (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
export const Toolbar = ({
|
|
9
|
+
align,
|
|
10
|
+
children,
|
|
11
|
+
dense,
|
|
12
|
+
id,
|
|
13
|
+
justify,
|
|
14
|
+
nowrap,
|
|
15
|
+
}) => {
|
|
16
|
+
if (isChildrenEmpty(children)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
14
19
|
|
|
15
20
|
const alignClass = (value) => {
|
|
16
21
|
if (value === 'top') {
|
|
@@ -46,13 +51,14 @@ export const Toolbar = (props) => {
|
|
|
46
51
|
|
|
47
52
|
return (
|
|
48
53
|
<div
|
|
49
|
-
className={
|
|
54
|
+
className={classNames(
|
|
50
55
|
styles.toolbar,
|
|
51
|
-
dense
|
|
52
|
-
nowrap
|
|
56
|
+
dense && styles.isDense,
|
|
57
|
+
nowrap && styles.isNowrap,
|
|
53
58
|
alignClass(align),
|
|
54
59
|
justifyClass(justify),
|
|
55
|
-
|
|
60
|
+
)}
|
|
61
|
+
id={id}
|
|
56
62
|
>
|
|
57
63
|
{children}
|
|
58
64
|
</div>
|
|
@@ -61,7 +67,9 @@ export const Toolbar = (props) => {
|
|
|
61
67
|
|
|
62
68
|
Toolbar.defaultProps = {
|
|
63
69
|
align: 'top',
|
|
70
|
+
children: null,
|
|
64
71
|
dense: false,
|
|
72
|
+
id: undefined,
|
|
65
73
|
justify: 'start',
|
|
66
74
|
nowrap: false,
|
|
67
75
|
};
|
|
@@ -72,13 +80,21 @@ Toolbar.propTypes = {
|
|
|
72
80
|
*/
|
|
73
81
|
align: PropTypes.oneOf(['top', 'middle', 'bottom', 'baseline']),
|
|
74
82
|
/**
|
|
75
|
-
*
|
|
83
|
+
* Nested elements. Supported types are:
|
|
84
|
+
* * `ToolbarItems`
|
|
85
|
+
* * `ToolbarGroups`
|
|
86
|
+
*
|
|
87
|
+
* If none are provided nothing is rendered.
|
|
76
88
|
*/
|
|
77
|
-
children: PropTypes.node
|
|
89
|
+
children: PropTypes.node,
|
|
78
90
|
/**
|
|
79
91
|
* If `true`, spacing of all toolbar items in the toolbar will be reduced.
|
|
80
92
|
*/
|
|
81
93
|
dense: PropTypes.bool,
|
|
94
|
+
/**
|
|
95
|
+
* ID of the root HTML element.
|
|
96
|
+
*/
|
|
97
|
+
id: PropTypes.string,
|
|
82
98
|
/**
|
|
83
99
|
* Horizontal alignment (distribution) of toolbar items and groups.
|
|
84
100
|
*/
|
|
@@ -89,6 +105,6 @@ Toolbar.propTypes = {
|
|
|
89
105
|
nowrap: PropTypes.bool,
|
|
90
106
|
};
|
|
91
107
|
|
|
92
|
-
export const
|
|
108
|
+
export const ToolbarWithGlobalProps = withGlobalProps(Toolbar, 'Toolbar');
|
|
93
109
|
|
|
94
|
-
export default
|
|
110
|
+
export default ToolbarWithGlobalProps;
|
|
@@ -1,84 +1,71 @@
|
|
|
1
1
|
// 1. Get rid of unwanted spacing of inline elements by invocation of flex layout.
|
|
2
2
|
|
|
3
|
-
@use
|
|
4
|
-
@use
|
|
3
|
+
@use "../../styles/tools/spacing";
|
|
4
|
+
@use "theme";
|
|
5
5
|
|
|
6
6
|
.toolbar,
|
|
7
7
|
.group {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
gap: theme.$gap;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
.toolbar {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
margin: calc(-1 * #{theme.$gap});
|
|
14
|
+
@include spacing.bottom(layouts);
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
.item {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
display: flex; // 1.
|
|
19
|
+
flex: none;
|
|
20
|
+
flex-direction: column; // 1.
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.isItemFlexible {
|
|
24
|
+
flex: 1;
|
|
25
|
+
min-width: 0;
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
.isAlignedToTop {
|
|
26
|
-
|
|
29
|
+
align-items: flex-start;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
.isAlignedToMiddle {
|
|
30
|
-
|
|
33
|
+
align-items: center;
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
.isAlignedToBottom {
|
|
34
|
-
|
|
37
|
+
align-items: flex-end;
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
.isAlignedToBaseline {
|
|
38
|
-
|
|
41
|
+
align-items: baseline;
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
.isJustifiedToStart {
|
|
42
|
-
|
|
45
|
+
justify-content: flex-start;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
.isJustifiedToCenter {
|
|
46
|
-
|
|
49
|
+
justify-content: center;
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
.isJustifiedToEnd {
|
|
50
|
-
|
|
53
|
+
justify-content: flex-end;
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
.isJustifiedToSpaceBetween {
|
|
54
|
-
|
|
57
|
+
justify-content: space-between;
|
|
55
58
|
}
|
|
56
59
|
|
|
57
|
-
.
|
|
58
|
-
|
|
60
|
+
.isDense,
|
|
61
|
+
.isDense .group {
|
|
62
|
+
gap: theme.$gap-dense;
|
|
59
63
|
}
|
|
60
64
|
|
|
61
|
-
.isNowrap
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.isDense {
|
|
66
|
-
margin: calc(-1 * #{theme.$gap-dense});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.isDense .item {
|
|
70
|
-
margin: theme.$gap-dense;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.isDense > .isDense {
|
|
74
|
-
margin: 0;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.toolbar.isDense {
|
|
78
|
-
@include spacing.bottom(layouts, $compensation: theme.$gap-dense);
|
|
65
|
+
.isNowrap {
|
|
66
|
+
flex-wrap: nowrap;
|
|
79
67
|
}
|
|
80
68
|
|
|
81
|
-
.
|
|
82
|
-
|
|
83
|
-
margin: theme.$gap-dense;
|
|
69
|
+
.isNowrap > .item:not(.isItemFlexible) {
|
|
70
|
+
flex: 0 1 auto;
|
|
84
71
|
}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { withGlobalProps } from '../../provider';
|
|
4
|
+
import { classNames } from '../../utils/classNames';
|
|
5
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
|
4
6
|
import styles from './Toolbar.scss';
|
|
5
7
|
|
|
6
|
-
export const ToolbarGroup = (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export const ToolbarGroup = ({
|
|
9
|
+
align,
|
|
10
|
+
children,
|
|
11
|
+
dense,
|
|
12
|
+
id,
|
|
13
|
+
nowrap,
|
|
14
|
+
}) => {
|
|
15
|
+
if (isChildrenEmpty(children)) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
13
18
|
|
|
14
19
|
const alignClass = (value) => {
|
|
15
20
|
if (value === 'top') {
|
|
@@ -29,12 +34,13 @@ export const ToolbarGroup = (props) => {
|
|
|
29
34
|
|
|
30
35
|
return (
|
|
31
36
|
<div
|
|
32
|
-
className={
|
|
37
|
+
className={classNames(
|
|
33
38
|
styles.group,
|
|
34
|
-
dense
|
|
35
|
-
nowrap
|
|
39
|
+
dense && styles.isDense,
|
|
40
|
+
nowrap && styles.isNowrap,
|
|
36
41
|
alignClass(align),
|
|
37
|
-
|
|
42
|
+
)}
|
|
43
|
+
id={id}
|
|
38
44
|
>
|
|
39
45
|
{children}
|
|
40
46
|
</div>
|
|
@@ -43,7 +49,9 @@ export const ToolbarGroup = (props) => {
|
|
|
43
49
|
|
|
44
50
|
ToolbarGroup.defaultProps = {
|
|
45
51
|
align: 'top',
|
|
52
|
+
children: null,
|
|
46
53
|
dense: false,
|
|
54
|
+
id: undefined,
|
|
47
55
|
nowrap: false,
|
|
48
56
|
};
|
|
49
57
|
|
|
@@ -53,19 +61,23 @@ ToolbarGroup.propTypes = {
|
|
|
53
61
|
*/
|
|
54
62
|
align: PropTypes.oneOf(['top', 'middle', 'bottom', 'baseline']),
|
|
55
63
|
/**
|
|
56
|
-
* Grouped ToolbarItems.
|
|
64
|
+
* Grouped ToolbarItems. If none are provided nothing is rendered.
|
|
57
65
|
*/
|
|
58
|
-
children: PropTypes.node
|
|
66
|
+
children: PropTypes.node,
|
|
59
67
|
/**
|
|
60
68
|
* If `true`, spacing of toolbar items in the group will be reduced.
|
|
61
69
|
*/
|
|
62
70
|
dense: PropTypes.bool,
|
|
71
|
+
/**
|
|
72
|
+
* ID of the root HTML element.
|
|
73
|
+
*/
|
|
74
|
+
id: PropTypes.string,
|
|
63
75
|
/**
|
|
64
76
|
* If set, the toolbar group will not wrap.
|
|
65
77
|
*/
|
|
66
78
|
nowrap: PropTypes.bool,
|
|
67
79
|
};
|
|
68
80
|
|
|
69
|
-
export const
|
|
81
|
+
export const ToolbarGroupWithGlobalProps = withGlobalProps(ToolbarGroup, 'ToolbarGroup');
|
|
70
82
|
|
|
71
|
-
export default
|
|
83
|
+
export default ToolbarGroupWithGlobalProps;
|
|
@@ -1,27 +1,53 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { classNames } from '../../utils/classNames';
|
|
4
|
+
import { withGlobalProps } from '../../provider';
|
|
5
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
|
4
6
|
import styles from './Toolbar.scss';
|
|
5
7
|
|
|
6
|
-
export const ToolbarItem = (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
export const ToolbarItem = ({
|
|
9
|
+
children,
|
|
10
|
+
flexible,
|
|
11
|
+
id,
|
|
12
|
+
}) => {
|
|
13
|
+
if (isChildrenEmpty(children)) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
10
16
|
|
|
11
17
|
return (
|
|
12
|
-
<div
|
|
18
|
+
<div
|
|
19
|
+
className={classNames(
|
|
20
|
+
styles.item,
|
|
21
|
+
flexible && styles.isItemFlexible,
|
|
22
|
+
)}
|
|
23
|
+
id={id}
|
|
24
|
+
>
|
|
13
25
|
{children}
|
|
14
26
|
</div>
|
|
15
27
|
);
|
|
16
28
|
};
|
|
17
29
|
|
|
30
|
+
ToolbarItem.defaultProps = {
|
|
31
|
+
children: null,
|
|
32
|
+
flexible: false,
|
|
33
|
+
id: undefined,
|
|
34
|
+
};
|
|
35
|
+
|
|
18
36
|
ToolbarItem.propTypes = {
|
|
19
37
|
/**
|
|
20
|
-
* Content of the toolbar item.
|
|
38
|
+
* Content of the toolbar item. If none are provided nothing is rendered.
|
|
39
|
+
*/
|
|
40
|
+
children: PropTypes.node,
|
|
41
|
+
/**
|
|
42
|
+
* Allow item to grow and shrink if needed.
|
|
43
|
+
*/
|
|
44
|
+
flexible: PropTypes.bool,
|
|
45
|
+
/**
|
|
46
|
+
* ID of the root HTML element.
|
|
21
47
|
*/
|
|
22
|
-
|
|
48
|
+
id: PropTypes.string,
|
|
23
49
|
};
|
|
24
50
|
|
|
25
|
-
export const
|
|
51
|
+
export const ToolbarItemWithGlobalProps = withGlobalProps(ToolbarItem, 'ToolbarItem');
|
|
26
52
|
|
|
27
|
-
export default
|
|
53
|
+
export default ToolbarItemWithGlobalProps;
|
|
File without changes
|
package/src/lib/foundation.scss
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
//
|
|
8
8
|
// Ground-zero styles.
|
|
9
9
|
|
|
10
|
-
@use
|
|
11
|
-
@use
|
|
12
|
-
@use
|
|
13
|
-
@use
|
|
14
|
-
@use
|
|
10
|
+
@use "styles/generic/box-sizing";
|
|
11
|
+
@use "normalize.css/normalize.css";
|
|
12
|
+
@use "styles/generic/forms";
|
|
13
|
+
@use "styles/generic/reset";
|
|
14
|
+
@use "styles/generic/shared";
|
|
15
15
|
|
|
16
16
|
//
|
|
17
17
|
// 2. Elements
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
//
|
|
20
20
|
// Unclassed HTML elements (type selectors).
|
|
21
21
|
|
|
22
|
-
@use
|
|
23
|
-
@use
|
|
24
|
-
@use
|
|
25
|
-
@use
|
|
26
|
-
@use
|
|
27
|
-
@use
|
|
22
|
+
@use "styles/elements/code";
|
|
23
|
+
@use "styles/elements/links";
|
|
24
|
+
@use "styles/elements/lists";
|
|
25
|
+
@use "styles/elements/page";
|
|
26
|
+
@use "styles/elements/rulers";
|
|
27
|
+
@use "styles/elements/small";
|
package/src/lib/helpers.scss
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// General purpose helpers for common situations. They can compose multiple CSS rules to do a bit
|
|
10
10
|
// more complicated tasks.
|
|
11
11
|
|
|
12
|
-
@use
|
|
12
|
+
@use "styles/helpers/animation";
|
|
13
13
|
|
|
14
14
|
//
|
|
15
15
|
// 2. Utilities
|
|
@@ -19,4 +19,4 @@
|
|
|
19
19
|
// thing: they set a single CSS rule and use the otherwise disallowed `!important` to enforce it.
|
|
20
20
|
// Also they are often responsive (can be adjusted for individual breakpoints).
|
|
21
21
|
|
|
22
|
-
@use
|
|
22
|
+
@use "styles/utilities";
|
package/src/lib/index.js
CHANGED
|
@@ -8,14 +8,7 @@ export {
|
|
|
8
8
|
CardBody,
|
|
9
9
|
CardFooter,
|
|
10
10
|
} from './components/Card';
|
|
11
|
-
export { default as Center } from './components/Center';
|
|
12
11
|
export { default as CheckboxField } from './components/CheckboxField';
|
|
13
|
-
export {
|
|
14
|
-
CTA,
|
|
15
|
-
CTACenter,
|
|
16
|
-
CTAEnd,
|
|
17
|
-
CTAStart,
|
|
18
|
-
} from './components/CTA';
|
|
19
12
|
export { default as FileInputField } from './components/FileInputField';
|
|
20
13
|
export {
|
|
21
14
|
FormLayout,
|
|
@@ -25,18 +18,12 @@ export {
|
|
|
25
18
|
Grid,
|
|
26
19
|
GridSpan,
|
|
27
20
|
} from './components/Grid';
|
|
28
|
-
export { default as Link } from './components/Link';
|
|
29
|
-
export {
|
|
30
|
-
List,
|
|
31
|
-
ListItem,
|
|
32
|
-
} from './components/List';
|
|
33
|
-
export {
|
|
34
|
-
Media,
|
|
35
|
-
MediaBody,
|
|
36
|
-
MediaObject,
|
|
37
|
-
} from './components/Media';
|
|
38
21
|
export { default as Modal } from './components/Modal';
|
|
39
22
|
export { default as Paper } from './components/Paper';
|
|
23
|
+
export {
|
|
24
|
+
Popover,
|
|
25
|
+
PopoverWrapper,
|
|
26
|
+
} from './components/Popover';
|
|
40
27
|
export { default as Radio } from './components/Radio';
|
|
41
28
|
export { default as ScrollView } from './components/ScrollView';
|
|
42
29
|
export { default as SelectField } from './components/SelectField';
|
|
@@ -48,6 +35,7 @@ export { default as Table } from './components/Table';
|
|
|
48
35
|
export { default as Text } from './components/Text';
|
|
49
36
|
export { default as TextArea } from './components/TextArea';
|
|
50
37
|
export { default as TextField } from './components/TextField';
|
|
38
|
+
export { default as TextLink } from './components/TextLink';
|
|
51
39
|
export { default as Toggle } from './components/Toggle';
|
|
52
40
|
export {
|
|
53
41
|
Toolbar,
|
|
@@ -57,3 +45,6 @@ export {
|
|
|
57
45
|
|
|
58
46
|
// Provider
|
|
59
47
|
export { RUIProvider } from './provider';
|
|
48
|
+
|
|
49
|
+
// Utils
|
|
50
|
+
export { classNames } from './utils/classNames';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import RUIContext from './RUIContext';
|
|
3
|
+
|
|
4
|
+
export default (Component, componentName) => {
|
|
5
|
+
const WithGlobalPropsComponent = (props) => (
|
|
6
|
+
<RUIContext.Consumer>
|
|
7
|
+
{({ globalProps }) => {
|
|
8
|
+
const contextGlobalProps = globalProps ? globalProps[componentName] : null;
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<Component
|
|
12
|
+
{...contextGlobalProps}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}}
|
|
17
|
+
</RUIContext.Consumer>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return WithGlobalPropsComponent;
|
|
21
|
+
};
|