@react-ui-org/react-ui 0.47.0 → 0.48.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/lib.development.js +330 -54
- package/dist/lib.js +1 -1
- package/package.json +1 -1
- package/src/lib/components/Alert/README.mdx +4 -2
- package/src/lib/components/Alert/index.js +1 -1
- package/src/lib/components/Badge/README.mdx +1 -1
- package/src/lib/components/Badge/index.js +1 -1
- package/src/lib/components/Button/Button.jsx +31 -31
- package/src/lib/components/Button/README.mdx +4 -2
- package/src/lib/components/Button/index.js +1 -1
- package/src/lib/components/ButtonGroup/ButtonGroup.jsx +2 -1
- package/src/lib/components/ButtonGroup/README.mdx +4 -2
- package/src/lib/components/Card/README.mdx +7 -5
- package/src/lib/components/CheckboxField/CheckboxField.jsx +27 -28
- package/src/lib/components/CheckboxField/README.mdx +1 -1
- package/src/lib/components/CheckboxField/index.js +1 -1
- package/src/lib/components/FileInputField/FileInputField.jsx +27 -27
- package/src/lib/components/FileInputField/README.mdx +1 -1
- package/src/lib/components/FileInputField/index.js +1 -1
- package/src/lib/components/FormLayout/README.mdx +15 -13
- package/src/lib/components/Grid/Grid.jsx +31 -28
- package/src/lib/components/Grid/Grid.scss +10 -15
- package/src/lib/components/Grid/GridSpan.jsx +5 -4
- package/src/lib/components/Grid/README.mdx +34 -36
- package/src/lib/components/Grid/_helpers/generateResponsiveCustomProperties.js +11 -3
- package/src/lib/components/Grid/_settings.scss +18 -0
- package/src/lib/components/Grid/_tools.scss +5 -5
- package/src/lib/components/Modal/Modal.jsx +147 -250
- package/src/lib/components/Modal/Modal.scss +7 -55
- package/src/lib/components/Modal/ModalBody.jsx +64 -0
- package/src/lib/components/Modal/ModalBody.scss +18 -0
- package/src/lib/components/Modal/ModalCloseButton.jsx +61 -0
- package/src/lib/components/Modal/ModalCloseButton.scss +18 -0
- package/src/lib/components/Modal/ModalContent.jsx +43 -0
- package/src/lib/components/Modal/ModalContent.scss +5 -0
- package/src/lib/components/Modal/ModalFooter.jsx +46 -0
- package/src/lib/components/Modal/ModalFooter.scss +35 -0
- package/src/lib/components/Modal/ModalHeader.jsx +48 -0
- package/src/lib/components/Modal/ModalHeader.scss +30 -0
- package/src/lib/components/Modal/ModalTitle.jsx +45 -0
- package/src/lib/components/Modal/ModalTitle.scss +10 -0
- package/src/lib/components/Modal/README.mdx +842 -197
- package/src/lib/components/Modal/_helpers/getJustifyClassName.js +19 -0
- package/src/lib/components/Modal/_helpers/getScrollingClassName.js +11 -0
- package/src/lib/components/Modal/_settings.scss +1 -5
- package/src/lib/components/Modal/_theme.scss +6 -0
- package/src/lib/components/Modal/index.js +7 -1
- package/src/lib/components/Paper/README.mdx +1 -1
- package/src/lib/components/Paper/index.js +1 -1
- package/src/lib/components/Popover/Popover.jsx +24 -24
- package/src/lib/components/Popover/Popover.scss +7 -6
- package/src/lib/components/Popover/PopoverWrapper.jsx +5 -5
- package/src/lib/components/Popover/PopoverWrapper.scss +3 -0
- package/src/lib/components/Popover/README.mdx +13 -11
- package/src/lib/components/Popover/_theme.scss +1 -1
- package/src/lib/components/Radio/README.mdx +1 -1
- package/src/lib/components/Radio/Radio.jsx +37 -27
- package/src/lib/components/Radio/index.js +1 -1
- package/src/lib/components/ScrollView/README.mdx +146 -84
- package/src/lib/components/ScrollView/ScrollView.jsx +104 -113
- package/src/lib/components/ScrollView/ScrollView.scss +18 -16
- package/src/lib/components/ScrollView/index.js +1 -1
- package/src/lib/components/SelectField/README.mdx +66 -2
- package/src/lib/components/SelectField/SelectField.jsx +93 -49
- package/src/lib/components/SelectField/_components/Option/Option.jsx +46 -0
- package/src/lib/components/SelectField/_components/Option/index.js +1 -0
- package/src/lib/components/SelectField/index.js +1 -1
- package/src/lib/components/Table/README.mdx +4 -2
- package/src/lib/components/Table/Table.jsx +1 -1
- package/src/lib/components/Table/index.js +1 -1
- package/src/lib/components/Tabs/README.mdx +5 -3
- package/src/lib/components/Tabs/TabsItem.scss +1 -2
- package/src/lib/components/Text/README.mdx +9 -7
- package/src/lib/components/Text/index.js +1 -1
- package/src/lib/components/TextArea/README.mdx +1 -1
- package/src/lib/components/TextArea/TextArea.jsx +33 -33
- package/src/lib/components/TextArea/index.js +1 -1
- package/src/lib/components/TextField/README.mdx +3 -3
- package/src/lib/components/TextField/TextField.jsx +33 -34
- package/src/lib/components/TextField/index.js +1 -1
- package/src/lib/components/TextLink/README.mdx +1 -1
- package/src/lib/components/TextLink/index.js +1 -1
- package/src/lib/components/Toggle/README.mdx +1 -1
- package/src/lib/components/Toggle/Toggle.jsx +28 -28
- package/src/lib/components/Toggle/index.js +1 -1
- package/src/lib/components/Toolbar/README.mdx +8 -6
- package/src/lib/components/_helpers/transferProps.js +1 -1
- package/src/lib/index.js +24 -16
- package/src/lib/provider/withGlobalProps.jsx +20 -3
- package/src/lib/theme.scss +18 -26
- package/src/lib/translations/en.js +1 -1
- package/src/lib/components/Grid/_theme.scss +0 -11
- package/src/lib/components/ScrollView/_theme.scss +0 -2
- package/src/lib/components/withForwardedRef.jsx +0 -11
@@ -0,0 +1,19 @@
|
|
1
|
+
export const getJustifyClassName = (value, styles) => {
|
2
|
+
if (value === 'start') {
|
3
|
+
return styles.isJustifiedToStart;
|
4
|
+
}
|
5
|
+
|
6
|
+
if (value === 'center') {
|
7
|
+
return styles.isJustifiedToCenter;
|
8
|
+
}
|
9
|
+
|
10
|
+
if (value === 'end') {
|
11
|
+
return styles.isJustifiedToEnd;
|
12
|
+
}
|
13
|
+
|
14
|
+
if (value === 'space-between') {
|
15
|
+
return styles.isJustifiedToSpaceBetween;
|
16
|
+
}
|
17
|
+
|
18
|
+
return styles.isJustifiedToStretch;
|
19
|
+
};
|
@@ -2,12 +2,8 @@
|
|
2
2
|
@use "../../styles/settings/z-indexes";
|
3
3
|
@use "../../styles/theme/borders";
|
4
4
|
@use "../../styles/theme/typography";
|
5
|
-
@use "../../styles/tools/spacing";
|
6
5
|
|
7
|
-
$padding-x: spacing.of(5);
|
8
|
-
$padding-y: spacing.of(3);
|
9
|
-
$content-padding-bottom: spacing.of(6);
|
10
6
|
$border-radius: borders.$radius;
|
11
|
-
$head-title-font-size: map.get(typography.$size-values, 1);
|
12
7
|
$z-index: z-indexes.$modal;
|
13
8
|
$backdrop-z-index: z-indexes.$modal-backdrop;
|
9
|
+
$title-font-size: map.get(typography.$size-values, 1);
|
@@ -1,6 +1,12 @@
|
|
1
|
+
$padding-x: var(--rui-Modal__padding-x);
|
2
|
+
$padding-y: var(--rui-Modal__padding-y);
|
1
3
|
$background: var(--rui-Modal__background);
|
2
4
|
$box-shadow: var(--rui-Modal__box-shadow);
|
5
|
+
$separator-width: var(--rui-Modal__separator__width);
|
6
|
+
$separator-color: var(--rui-Modal__separator__color);
|
7
|
+
$header-gap: var(--rui-Modal__header__gap);
|
3
8
|
$footer-background: var(--rui-Modal__footer__background);
|
9
|
+
$footer-gap: var(--rui-Modal__footer__gap);
|
4
10
|
$backdrop-background: var(--rui-Modal__backdrop__background);
|
5
11
|
$outer-spacing-xs: var(--rui-Modal__outer-spacing--xs);
|
6
12
|
$outer-spacing-sm: var(--rui-Modal__outer-spacing--sm);
|
@@ -1 +1,7 @@
|
|
1
|
-
export { default } from './Modal';
|
1
|
+
export { default as Modal } from './Modal';
|
2
|
+
export { default as ModalBody } from './ModalBody';
|
3
|
+
export { default as ModalCloseButton } from './ModalCloseButton';
|
4
|
+
export { default as ModalContent } from './ModalContent';
|
5
|
+
export { default as ModalHeader } from './ModalHeader';
|
6
|
+
export { default as ModalFooter } from './ModalFooter';
|
7
|
+
export { default as ModalTitle } from './ModalTitle';
|
@@ -1 +1 @@
|
|
1
|
-
export { default } from './Paper';
|
1
|
+
export { default as Paper } from './Paper';
|
@@ -4,30 +4,30 @@ import { createPortal } from 'react-dom';
|
|
4
4
|
import { withGlobalProps } from '../../provider';
|
5
5
|
import { classNames } from '../../utils/classNames';
|
6
6
|
import { transferProps } from '../_helpers/transferProps';
|
7
|
-
import withForwardedRef from '../withForwardedRef';
|
8
7
|
import getRootSideClassName from './_helpers/getRootSideClassName';
|
9
8
|
import getRootAlignmentClassName from './_helpers/getRootAlignmentClassName';
|
10
9
|
import styles from './Popover.scss';
|
11
10
|
|
12
|
-
export const Popover = ({
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
}
|
11
|
+
export const Popover = React.forwardRef((props, ref) => {
|
12
|
+
const {
|
13
|
+
placement,
|
14
|
+
children,
|
15
|
+
id,
|
16
|
+
portalId,
|
17
|
+
...restProps
|
18
|
+
} = props;
|
19
|
+
|
20
20
|
const PopoverEl = (
|
21
21
|
<div
|
22
|
+
{...transferProps(restProps)}
|
22
23
|
className={classNames(
|
23
24
|
styles.root,
|
24
|
-
|
25
|
+
ref && styles.isRootControlled,
|
25
26
|
getRootSideClassName(placement, styles),
|
26
27
|
getRootAlignmentClassName(placement, styles),
|
27
28
|
)}
|
28
29
|
id={id}
|
29
|
-
ref={
|
30
|
-
{...transferProps(restProps)}
|
30
|
+
ref={ref}
|
31
31
|
>
|
32
32
|
{children}
|
33
33
|
<span className={styles.arrow} />
|
@@ -39,13 +39,13 @@ export const Popover = ({
|
|
39
39
|
}
|
40
40
|
|
41
41
|
return createPortal(PopoverEl, document.getElementById(portalId));
|
42
|
-
};
|
42
|
+
});
|
43
43
|
|
44
44
|
Popover.defaultProps = {
|
45
|
-
forwardedRef: undefined,
|
46
45
|
id: undefined,
|
47
46
|
placement: 'bottom',
|
48
47
|
portalId: null,
|
48
|
+
ref: undefined,
|
49
49
|
};
|
50
50
|
|
51
51
|
Popover.propTypes = {
|
@@ -53,14 +53,6 @@ Popover.propTypes = {
|
|
53
53
|
* Popover content.
|
54
54
|
*/
|
55
55
|
children: PropTypes.node.isRequired,
|
56
|
-
/**
|
57
|
-
* Reference forwarded to the root `div` element.
|
58
|
-
*/
|
59
|
-
forwardedRef: PropTypes.oneOfType([
|
60
|
-
PropTypes.func,
|
61
|
-
// eslint-disable-next-line react/forbid-prop-types
|
62
|
-
PropTypes.shape({ current: PropTypes.any }),
|
63
|
-
]),
|
64
56
|
/**
|
65
57
|
* ID of the root HTML element.
|
66
58
|
*/
|
@@ -87,8 +79,16 @@ Popover.propTypes = {
|
|
87
79
|
* If set, popover is rendered in the React Portal with that ID.
|
88
80
|
*/
|
89
81
|
portalId: PropTypes.string,
|
82
|
+
/**
|
83
|
+
* Reference forwarded to the root `div` element.
|
84
|
+
*/
|
85
|
+
ref: PropTypes.oneOfType([
|
86
|
+
PropTypes.func,
|
87
|
+
// eslint-disable-next-line react/forbid-prop-types
|
88
|
+
PropTypes.shape({ current: PropTypes.any }),
|
89
|
+
]),
|
90
90
|
};
|
91
91
|
|
92
|
-
export const
|
92
|
+
export const PopoverWithGlobalProps = withGlobalProps(Popover, 'Popover');
|
93
93
|
|
94
|
-
export default
|
94
|
+
export default PopoverWithGlobalProps;
|
@@ -4,14 +4,15 @@
|
|
4
4
|
|
5
5
|
@use "theme";
|
6
6
|
|
7
|
-
.wrapper {
|
8
|
-
position: relative;
|
9
|
-
}
|
10
|
-
|
11
7
|
.root {
|
12
8
|
position: absolute;
|
13
|
-
width:
|
9
|
+
width: max-content;
|
10
|
+
max-width: theme.$max-width;
|
14
11
|
padding: theme.$padding;
|
12
|
+
text-align: left;
|
13
|
+
white-space: normal;
|
14
|
+
word-break: normal;
|
15
|
+
word-wrap: break-word;
|
15
16
|
color: theme.$color;
|
16
17
|
border: theme.$border-width solid theme.$border-color;
|
17
18
|
border-radius: theme.$border-radius;
|
@@ -205,7 +206,7 @@
|
|
205
206
|
transform: translate(0, -100%) rotateZ(90deg);
|
206
207
|
}
|
207
208
|
|
208
|
-
// Controlled
|
209
|
+
// Controlled placement
|
209
210
|
.isRootControlled.isRootAtTop,
|
210
211
|
.isRootControlled.isRootAtBottom,
|
211
212
|
.isRootControlled.isRootAtLeft,
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { withGlobalProps } from '../../provider';
|
4
|
-
import
|
5
|
-
import styles from './
|
4
|
+
import { transferProps } from '../_helpers/transferProps';
|
5
|
+
import styles from './PopoverWrapper.scss';
|
6
6
|
|
7
7
|
export const PopoverWrapper = ({
|
8
8
|
children,
|
@@ -11,9 +11,9 @@ export const PopoverWrapper = ({
|
|
11
11
|
...restProps
|
12
12
|
}) => (
|
13
13
|
<Tag
|
14
|
-
|
14
|
+
{...transferProps(restProps)}
|
15
|
+
className={styles.root}
|
15
16
|
id={id}
|
16
|
-
{...restProps}
|
17
17
|
>
|
18
18
|
{children}
|
19
19
|
</Tag>
|
@@ -40,7 +40,7 @@ PopoverWrapper.propTypes = {
|
|
40
40
|
tag: PropTypes.string,
|
41
41
|
};
|
42
42
|
|
43
|
-
export const PopoverWrapperWithContext =
|
43
|
+
export const PopoverWrapperWithContext = withGlobalProps(PopoverWrapper, 'PopoverWrapper');
|
44
44
|
|
45
45
|
export default PopoverWrapperWithContext;
|
46
46
|
|
@@ -16,13 +16,15 @@ import {
|
|
16
16
|
Props,
|
17
17
|
} from 'docz'
|
18
18
|
import { Placeholder } from '../../../docs/_components/Placeholder/Placeholder'
|
19
|
-
import {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
import {
|
20
|
+
Button,
|
21
|
+
Popover,
|
22
|
+
ButtonGroup,
|
23
|
+
SelectField,
|
24
|
+
Toolbar,
|
25
|
+
ToolbarItem,
|
26
|
+
PopoverWrapper,
|
27
|
+
} from '../..'
|
26
28
|
|
27
29
|
Popover displays additional information without interrupting user flow.
|
28
30
|
|
@@ -205,8 +207,8 @@ As opposed to the [basic setup](#placement), Popover will be placed according to
|
|
205
207
|
its triggering component (`reference`), but still recognizing the closest parent
|
206
208
|
element with `position: relative` or `position: absolute` if there is any.
|
207
209
|
|
208
|
-
Popover reacts on the `
|
209
|
-
when `
|
210
|
+
Popover reacts on the `ref` option, necessary for advanced positioning:
|
211
|
+
when `ref` is set, Popover resets its built-in positioning and relies
|
210
212
|
on provided `style`.
|
211
213
|
|
212
214
|
👉 Please consult [Floating UI] documentation to understand how it works and to
|
@@ -284,13 +286,12 @@ get an idea of all possible cases you may need to cover.
|
|
284
286
|
>
|
285
287
|
<Button
|
286
288
|
aria-describedby={isPopoverOpen ? 'my-advanced-popover' : undefined}
|
287
|
-
forwardedRef={reference}
|
288
289
|
label="Trigger Popover"
|
289
290
|
onClick={() => setIsPopoverOpen(!isPopoverOpen)}
|
291
|
+
ref={reference}
|
290
292
|
/>
|
291
293
|
{isPopoverOpen && (
|
292
294
|
<Popover
|
293
|
-
forwardedRef={floating}
|
294
295
|
id="my-advanced-popover"
|
295
296
|
placement={finalPlacement}
|
296
297
|
style={{
|
@@ -298,6 +299,7 @@ get an idea of all possible cases you may need to cover.
|
|
298
299
|
top: y ? y : '',
|
299
300
|
left: x ? x : '',
|
300
301
|
}}
|
302
|
+
ref={floating}
|
301
303
|
>
|
302
304
|
Auto-flipping Popover
|
303
305
|
</Popover>
|
@@ -50,34 +50,37 @@ export const Radio = ({
|
|
50
50
|
<div className={styles.field}>
|
51
51
|
<ul className={styles.list}>
|
52
52
|
{
|
53
|
-
options.map((option) =>
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
{...transferProps(restProps)}
|
62
|
-
className={styles.input}
|
63
|
-
checked={restProps.onChange
|
64
|
-
? (value === option.value) || false
|
65
|
-
: undefined}
|
66
|
-
disabled={disabled || option.disabled}
|
67
|
-
id={id && `${id}__item__${option.value}`}
|
68
|
-
name={id}
|
69
|
-
type="radio"
|
70
|
-
value={option.value}
|
71
|
-
/>
|
72
|
-
<span
|
73
|
-
className={styles.optionLabel}
|
74
|
-
id={id && `${id}__item__${option.value}__labelText`}
|
53
|
+
options.map((option) => {
|
54
|
+
const key = option.key ?? option.value;
|
55
|
+
return (
|
56
|
+
<li key={key}>
|
57
|
+
<label
|
58
|
+
className={styles.option}
|
59
|
+
htmlFor={id && `${id}__item__${key}`}
|
60
|
+
id={id && `${id}__item__${key}__label`}
|
75
61
|
>
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
62
|
+
<input
|
63
|
+
{...transferProps(restProps)}
|
64
|
+
className={styles.input}
|
65
|
+
checked={restProps.onChange
|
66
|
+
? (value === option.value) || false
|
67
|
+
: undefined}
|
68
|
+
disabled={disabled || option.disabled}
|
69
|
+
id={id && `${id}__item__${key}`}
|
70
|
+
name={id}
|
71
|
+
type="radio"
|
72
|
+
value={option.value}
|
73
|
+
/>
|
74
|
+
<span
|
75
|
+
className={styles.optionLabel}
|
76
|
+
id={id && `${id}__item__${key}__labelText`}
|
77
|
+
>
|
78
|
+
{ option.label }
|
79
|
+
</span>
|
80
|
+
</label>
|
81
|
+
</li>
|
82
|
+
);
|
83
|
+
})
|
81
84
|
}
|
82
85
|
</ul>
|
83
86
|
{helpText && (
|
@@ -134,6 +137,9 @@ Radio.propTypes = {
|
|
134
137
|
* * `<ID>__item__<VALUE>`
|
135
138
|
* * `<ID>__item__<VALUE>__label`
|
136
139
|
* * `<ID>__item__<VALUE>__labelText`
|
140
|
+
*
|
141
|
+
* If `key` in the option definition object is set,
|
142
|
+
* then `option.key` is used instead of `option.value` in place of `<VALUE>`.
|
137
143
|
*/
|
138
144
|
id: PropTypes.string,
|
139
145
|
/**
|
@@ -154,9 +160,13 @@ Radio.propTypes = {
|
|
154
160
|
layout: PropTypes.oneOf(['horizontal', 'vertical']),
|
155
161
|
/**
|
156
162
|
* Set of options to be chosen from.
|
163
|
+
*
|
164
|
+
* For generating unique IDs the `option.value` is normally used. For cases when this is not practical or
|
165
|
+
* the `option.value` values are not unique the `option.key` attribute can be set manually.
|
157
166
|
*/
|
158
167
|
options: PropTypes.arrayOf(PropTypes.shape({
|
159
168
|
disabled: PropTypes.bool,
|
169
|
+
key: PropTypes.string,
|
160
170
|
label: PropTypes.string.isRequired,
|
161
171
|
value: PropTypes.oneOfType([
|
162
172
|
PropTypes.string,
|
@@ -1 +1 @@
|
|
1
|
-
export { default } from './Radio';
|
1
|
+
export { default as Radio } from './Radio';
|