@react-ui-org/react-ui 0.46.0 → 0.47.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +15 -16
- package/dist/lib.development.js +106 -154
- package/dist/lib.js +1 -1
- package/package.json +2 -1
- package/src/lib/components/Alert/Alert.jsx +43 -43
- package/src/lib/components/Alert/README.mdx +2 -5
- package/src/lib/components/Badge/Badge.jsx +3 -3
- package/src/lib/components/Button/Button.jsx +4 -4
- package/src/lib/components/Button/README.mdx +4 -4
- package/src/lib/components/Button/_base.scss +6 -6
- package/src/lib/components/Button/helpers/getRootLabelVisibilityClassName.js +4 -4
- package/src/lib/components/ButtonGroup/ButtonGroup.jsx +10 -3
- package/src/lib/components/ButtonGroup/README.mdx +1 -1
- package/src/lib/components/Card/Card.jsx +3 -3
- package/src/lib/components/Card/CardBody.jsx +16 -5
- package/src/lib/components/Card/CardFooter.jsx +13 -5
- package/src/lib/components/CheckboxField/CheckboxField.jsx +3 -3
- package/src/lib/components/FileInputField/FileInputField.jsx +3 -3
- package/src/lib/components/FormLayout/FormLayout.jsx +3 -3
- package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +3 -3
- package/src/lib/components/FormLayout/README.mdx +4 -5
- package/src/lib/components/Grid/Grid.jsx +21 -21
- package/src/lib/components/Grid/Grid.scss +6 -0
- package/src/lib/components/Grid/GridSpan.jsx +7 -7
- package/src/lib/components/Grid/README.mdx +46 -20
- package/src/lib/components/Grid/_theme.scss +7 -7
- package/src/lib/components/Modal/Modal.jsx +30 -26
- package/src/lib/components/Modal/README.mdx +2 -5
- package/src/lib/components/Paper/Paper.jsx +3 -3
- 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/Radio.jsx +3 -3
- package/src/lib/components/ScrollView/README.mdx +2 -5
- package/src/lib/components/ScrollView/ScrollView.jsx +11 -13
- package/src/lib/components/SelectField/SelectField.jsx +3 -3
- package/src/lib/components/Table/README.mdx +1 -1
- package/src/lib/components/Table/Table.jsx +3 -3
- package/src/lib/components/Tabs/Tabs.jsx +3 -3
- package/src/lib/components/Tabs/TabsItem.jsx +3 -3
- package/src/lib/components/Text/README.mdx +2 -2
- package/src/lib/components/Text/Text.jsx +3 -3
- package/src/lib/components/TextArea/TextArea.jsx +3 -3
- package/src/lib/components/TextField/TextField.jsx +3 -3
- package/src/lib/components/TextLink/TextLink.jsx +3 -3
- package/src/lib/components/Toggle/Toggle.jsx +3 -3
- package/src/lib/components/Toolbar/README.mdx +18 -6
- package/src/lib/components/Toolbar/Toolbar.jsx +10 -3
- package/src/lib/components/Toolbar/Toolbar.scss +5 -23
- package/src/lib/components/Toolbar/ToolbarGroup.jsx +10 -3
- package/src/lib/components/Toolbar/ToolbarItem.jsx +10 -3
- package/src/lib/index.js +4 -9
- package/src/lib/provider/index.js +2 -1
- package/src/lib/provider/withGlobalProps.jsx +21 -0
- package/src/lib/styles/settings/_breakpoints.scss +2 -2
- package/src/lib/styles/theme-constants/_breakpoints.scss +2 -2
- package/src/lib/styles/tools/_spacing.scss +2 -6
- package/src/lib/theme.scss +19 -18
- package/src/lib/components/List/List.jsx +0 -73
- package/src/lib/components/List/List.scss +0 -53
- package/src/lib/components/List/ListItem.jsx +0 -32
- 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 -36
- package/src/lib/components/Media/Media.scss +0 -16
- package/src/lib/components/Media/MediaBody.jsx +0 -32
- package/src/lib/components/Media/MediaObject.jsx +0 -32
- 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,114 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: List
|
3
|
-
menu: 'Layouts'
|
4
|
-
route: /components/list
|
5
|
-
---
|
6
|
-
|
7
|
-
# List
|
8
|
-
|
9
|
-
import {
|
10
|
-
Playground,
|
11
|
-
Props,
|
12
|
-
} from 'docz'
|
13
|
-
import { Placeholder } from '../../../docs/_components/Placeholder/Placeholder'
|
14
|
-
import { List } from './List'
|
15
|
-
import { ListItem } from './ListItem'
|
16
|
-
|
17
|
-
The List aligns content into an organized list.
|
18
|
-
|
19
|
-
## Basic Usage
|
20
|
-
|
21
|
-
To implement the List component, you need to import it first:
|
22
|
-
|
23
|
-
```js
|
24
|
-
import { List, ListItem } from '@react-ui-org/react-ui';
|
25
|
-
```
|
26
|
-
|
27
|
-
And use it:
|
28
|
-
|
29
|
-
<Playground>
|
30
|
-
<List>
|
31
|
-
<ListItem>
|
32
|
-
<Placeholder bordered>List item</Placeholder>
|
33
|
-
</ListItem>
|
34
|
-
<ListItem>
|
35
|
-
<Placeholder bordered>List item</Placeholder>
|
36
|
-
</ListItem>
|
37
|
-
<ListItem>
|
38
|
-
<Placeholder bordered>List item</Placeholder>
|
39
|
-
</ListItem>
|
40
|
-
</List>
|
41
|
-
</Playground>
|
42
|
-
|
43
|
-
See [API](#api) for all available options.
|
44
|
-
|
45
|
-
## General Guidelines
|
46
|
-
|
47
|
-
- **Wrap your items** into the [ListItem](#listitem) component. This ensures
|
48
|
-
your content is properly spaced and aligned with other List elements. Do
|
49
|
-
**not** try to put any custom HTML or React components directly into the
|
50
|
-
List layout without wrapping it with the ListItem first.
|
51
|
-
|
52
|
-
- For forms, use rather the [FormLayout](/components/form-layout)
|
53
|
-
component which is designed specifically for that purpose.
|
54
|
-
|
55
|
-
## List Alignment
|
56
|
-
|
57
|
-
You can simply set the list alignment by specifying the `align` option.
|
58
|
-
|
59
|
-
👉 At the current stage of development, React UI is **RTL aware** so switching
|
60
|
-
to a fully RTL-compatible behavior in the future should be painless. That's why
|
61
|
-
the alignment values are called rather `start` than `left` and `end` instead of
|
62
|
-
`right`.
|
63
|
-
|
64
|
-
<Playground>
|
65
|
-
<List align="end">
|
66
|
-
<ListItem>
|
67
|
-
<Placeholder bordered>List item</Placeholder>
|
68
|
-
</ListItem>
|
69
|
-
<ListItem>
|
70
|
-
<Placeholder bordered>List item</Placeholder>
|
71
|
-
</ListItem>
|
72
|
-
<ListItem>
|
73
|
-
<Placeholder bordered>List item</Placeholder>
|
74
|
-
</ListItem>
|
75
|
-
</List>
|
76
|
-
</Playground>
|
77
|
-
|
78
|
-
## Auto Width
|
79
|
-
|
80
|
-
For cases when you prefer the list items to keep their original width and don't
|
81
|
-
want them to expand over the full width of the parent of the list, there is the
|
82
|
-
`autoWidth` option. It **shrinks the list according to its longest item.**
|
83
|
-
However, the root div always behaves as a full-width block element (unless you
|
84
|
-
put it inside a flex or grid layout).
|
85
|
-
|
86
|
-
<Playground>
|
87
|
-
<List align="end" autoWidth>
|
88
|
-
<ListItem>
|
89
|
-
<Placeholder bordered>List item</Placeholder>
|
90
|
-
</ListItem>
|
91
|
-
<ListItem>
|
92
|
-
<Placeholder bordered>List item that is longer</Placeholder>
|
93
|
-
</ListItem>
|
94
|
-
<ListItem>
|
95
|
-
<Placeholder bordered>List item that is even a bit longer</Placeholder>
|
96
|
-
</ListItem>
|
97
|
-
</List>
|
98
|
-
</Playground>
|
99
|
-
|
100
|
-
## API
|
101
|
-
|
102
|
-
<Props table of={List} />
|
103
|
-
|
104
|
-
### ListItem API
|
105
|
-
|
106
|
-
A wrapper for individual list items.
|
107
|
-
|
108
|
-
<Props table of={ListItem} />
|
109
|
-
|
110
|
-
## Theming
|
111
|
-
|
112
|
-
| Custom Property | Description |
|
113
|
-
|------------------------------------------------------|--------------------------------------------------------------|
|
114
|
-
| `--rui-List__row-gap` | Gap between list items |
|
@@ -1 +0,0 @@
|
|
1
|
-
$row-gap: var(--rui-List__row-gap);
|
@@ -1,36 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import { withProviderContext } from '../../provider';
|
4
|
-
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
5
|
-
import styles from './Media.scss';
|
6
|
-
|
7
|
-
export const Media = ({ children }) => {
|
8
|
-
if (isChildrenEmpty(children)) {
|
9
|
-
return null;
|
10
|
-
}
|
11
|
-
|
12
|
-
return (
|
13
|
-
<div className={styles.media}>
|
14
|
-
{children}
|
15
|
-
</div>
|
16
|
-
);
|
17
|
-
};
|
18
|
-
|
19
|
-
Media.defaultProps = {
|
20
|
-
children: null,
|
21
|
-
};
|
22
|
-
|
23
|
-
Media.propTypes = {
|
24
|
-
/**
|
25
|
-
* Nested elements. Supported types are:
|
26
|
-
* * `MediaBody`
|
27
|
-
* * `MediaObject`
|
28
|
-
*
|
29
|
-
* If none are provided nothing is rendered.
|
30
|
-
*/
|
31
|
-
children: PropTypes.node,
|
32
|
-
};
|
33
|
-
|
34
|
-
export const MediaWithContext = withProviderContext(Media, 'Media');
|
35
|
-
|
36
|
-
export default MediaWithContext;
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import { withProviderContext } from '../../provider';
|
4
|
-
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
5
|
-
import styles from './Media.scss';
|
6
|
-
|
7
|
-
export const MediaBody = ({ children }) => {
|
8
|
-
if (isChildrenEmpty(children)) {
|
9
|
-
return null;
|
10
|
-
}
|
11
|
-
|
12
|
-
return (
|
13
|
-
<div className={styles.body}>
|
14
|
-
{children}
|
15
|
-
</div>
|
16
|
-
);
|
17
|
-
};
|
18
|
-
|
19
|
-
MediaBody.defaultProps = {
|
20
|
-
children: null,
|
21
|
-
};
|
22
|
-
|
23
|
-
MediaBody.propTypes = {
|
24
|
-
/**
|
25
|
-
* Content of the media layout. If none are provided nothing is rendered.
|
26
|
-
*/
|
27
|
-
children: PropTypes.node,
|
28
|
-
};
|
29
|
-
|
30
|
-
export const MediaBodyWithContext = withProviderContext(MediaBody, 'MediaBody');
|
31
|
-
|
32
|
-
export default MediaBodyWithContext;
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import { withProviderContext } from '../../provider';
|
4
|
-
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
5
|
-
import styles from './Media.scss';
|
6
|
-
|
7
|
-
export const MediaObject = ({ children }) => {
|
8
|
-
if (isChildrenEmpty(children)) {
|
9
|
-
return null;
|
10
|
-
}
|
11
|
-
|
12
|
-
return (
|
13
|
-
<div className={styles.object}>
|
14
|
-
{children}
|
15
|
-
</div>
|
16
|
-
);
|
17
|
-
};
|
18
|
-
|
19
|
-
MediaObject.defaultProps = {
|
20
|
-
children: null,
|
21
|
-
};
|
22
|
-
|
23
|
-
MediaObject.propTypes = {
|
24
|
-
/**
|
25
|
-
* Accompanying media object for the Media layout, eg. an image. If none are provided nothing is rendered.
|
26
|
-
*/
|
27
|
-
children: PropTypes.node,
|
28
|
-
};
|
29
|
-
|
30
|
-
export const MediaObjectWithContext = withProviderContext(MediaObject, 'MediaObject');
|
31
|
-
|
32
|
-
export default MediaObjectWithContext;
|
@@ -1,63 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: Media
|
3
|
-
menu: 'Layouts'
|
4
|
-
route: /components/media
|
5
|
-
---
|
6
|
-
|
7
|
-
# Media
|
8
|
-
|
9
|
-
import {
|
10
|
-
Playground,
|
11
|
-
Props,
|
12
|
-
} from 'docz'
|
13
|
-
import { Placeholder } from '../../../docs/_components/Placeholder/Placeholder'
|
14
|
-
import { Media } from './Media'
|
15
|
-
import { MediaBody } from './MediaBody'
|
16
|
-
import { MediaObject } from './MediaObject'
|
17
|
-
|
18
|
-
The Media layout nicely aligns text content next to an object.
|
19
|
-
|
20
|
-
## Basic Usage
|
21
|
-
|
22
|
-
To implement the Media component, you need to import it first:
|
23
|
-
|
24
|
-
```js
|
25
|
-
import { Media, MediaBody, MediaObject } from '@react-ui-org/react-ui';
|
26
|
-
```
|
27
|
-
|
28
|
-
And use it:
|
29
|
-
|
30
|
-
<Playground>
|
31
|
-
<Media>
|
32
|
-
<MediaObject>
|
33
|
-
<Placeholder bordered>Media object</Placeholder>
|
34
|
-
</MediaObject>
|
35
|
-
<MediaBody>
|
36
|
-
<Placeholder bordered>Media body</Placeholder>
|
37
|
-
</MediaBody>
|
38
|
-
</Media>
|
39
|
-
</Playground>
|
40
|
-
|
41
|
-
See [API](#api) for all available options.
|
42
|
-
|
43
|
-
## General Guidelines
|
44
|
-
|
45
|
-
Use the Media layout for **highly repetitive layouts** like comments, article
|
46
|
-
teasers, etc., ie. when you need a **fixed-sized object** (e.g. an image) and an
|
47
|
-
**area that expands** over the remaining horizontal space (e.g. a paragraph).
|
48
|
-
|
49
|
-
## API
|
50
|
-
|
51
|
-
<Props table of={Media} />
|
52
|
-
|
53
|
-
### MediaBody
|
54
|
-
|
55
|
-
A place for the text content.
|
56
|
-
|
57
|
-
<Props table of={MediaBody} />
|
58
|
-
|
59
|
-
### MediaObject
|
60
|
-
|
61
|
-
A place for the media object.
|
62
|
-
|
63
|
-
<Props table of={MediaObject} />
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import RUIContext from './RUIContext';
|
4
|
-
|
5
|
-
export default (Component, componentName) => {
|
6
|
-
const WithProviderContextComponent = (props) => (
|
7
|
-
<RUIContext.Consumer>
|
8
|
-
{(context) => {
|
9
|
-
const contextGlobalProps = context?.globalProps ? context.globalProps[componentName] : null;
|
10
|
-
const contextTranslations = context?.translations ? context.translations[componentName] : null;
|
11
|
-
|
12
|
-
return (
|
13
|
-
<Component
|
14
|
-
{...contextGlobalProps}
|
15
|
-
{...props}
|
16
|
-
translations={props.translations || contextTranslations}
|
17
|
-
/>
|
18
|
-
);
|
19
|
-
}}
|
20
|
-
</RUIContext.Consumer>
|
21
|
-
);
|
22
|
-
|
23
|
-
WithProviderContextComponent.defaultProps = {
|
24
|
-
translations: undefined,
|
25
|
-
};
|
26
|
-
|
27
|
-
WithProviderContextComponent.propTypes = {
|
28
|
-
translations: PropTypes.shape({}),
|
29
|
-
};
|
30
|
-
|
31
|
-
return WithProviderContextComponent;
|
32
|
-
};
|