carbon-react 104.12.2 → 104.16.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/lib/__internal__/popover/index.d.ts +1 -1
- package/lib/__internal__/popover/popover.component.d.ts +3 -1
- package/lib/__internal__/popover/popover.component.js +12 -3
- package/lib/__internal__/popover/popover.d.ts +46 -0
- package/lib/__internal__/popover/popover.style.d.ts +2 -0
- package/lib/__internal__/popover/popover.style.js +29 -0
- package/lib/components/button-bar/button-bar.style.d.ts +0 -1
- package/lib/components/button-bar/button-bar.style.js +6 -7
- package/lib/components/button-toggle/button-toggle.style.js +25 -41
- package/lib/components/button-toggle-group/button-toggle-group.style.js +5 -13
- package/lib/components/dialog/dialog.style.js +3 -0
- package/lib/components/modal/modal.component.js +23 -24
- package/lib/components/modal/modal.style.js +22 -15
- package/lib/components/note/note.style.js +14 -28
- package/lib/components/profile/profile-test.stories.js +75 -0
- package/lib/components/select/filterable-select/filterable-select.component.js +9 -4
- package/lib/components/select/multi-select/multi-select.component.js +9 -5
- package/lib/components/select/multi-select/multi-select.style.js +1 -0
- package/lib/components/select/option-group-header/option-group-header.style.js +3 -3
- package/lib/components/select/select-list/select-list.component.js +18 -5
- package/lib/components/select/select-list/select-list.style.js +2 -2
- package/lib/components/select/select-textbox/select-textbox.component.d.ts +2 -1
- package/lib/components/select/select-textbox/select-textbox.component.js +67 -2
- package/lib/components/select/select.style.js +9 -3
- package/lib/components/select/simple-select/simple-select.component.js +12 -9
- package/lib/hooks/__internal__/useScrollBlock/index.d.ts +4 -0
- package/lib/hooks/__internal__/useScrollBlock/index.js +15 -0
- package/lib/hooks/__internal__/useScrollBlock/scroll-block-manager.d.ts +10 -0
- package/lib/hooks/__internal__/useScrollBlock/scroll-block-manager.js +63 -0
- package/lib/hooks/__internal__/useScrollBlock/useScrollBlock.d.ts +5 -0
- package/lib/hooks/__internal__/useScrollBlock/useScrollBlock.js +95 -0
- package/lib/style/themes/base/base-theme.config.d.ts +2 -4
- package/lib/style/themes/base/base-theme.config.js +2 -5
- package/lib/style/themes/sage/index.d.ts +1 -0
- package/package.json +16 -16
- package/lib/components/portal/portal.style.d.ts +0 -3
- package/lib/components/portal/portal.style.js +0 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from "./popover
|
|
1
|
+
export { default } from "./popover";
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
export default Popover;
|
|
2
|
-
declare function Popover({ children, placement, disablePortal, reference, onFirstUpdate, modifiers, }: {
|
|
2
|
+
declare function Popover({ children, placement, disablePortal, reference, onFirstUpdate, modifiers, disableBackgroundUI, }: {
|
|
3
3
|
children: any;
|
|
4
4
|
placement: any;
|
|
5
5
|
disablePortal: any;
|
|
6
6
|
reference: any;
|
|
7
7
|
onFirstUpdate: any;
|
|
8
8
|
modifiers: any;
|
|
9
|
+
disableBackgroundUI: any;
|
|
9
10
|
}): any;
|
|
10
11
|
declare namespace Popover {
|
|
11
12
|
namespace propTypes {
|
|
12
13
|
const children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
13
14
|
const placement: PropTypes.Requireable<string>;
|
|
15
|
+
const disableBackgroundUI: PropTypes.Requireable<boolean>;
|
|
14
16
|
const modifiers: PropTypes.Requireable<any[]>;
|
|
15
17
|
const onFirstUpdate: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
18
|
const disablePortal: PropTypes.Requireable<boolean>;
|
|
@@ -15,6 +15,8 @@ var _core = require("@popperjs/core");
|
|
|
15
15
|
|
|
16
16
|
var _useResizeObserver = _interopRequireDefault(require("../../hooks/__internal__/useResizeObserver"));
|
|
17
17
|
|
|
18
|
+
var _popover = _interopRequireDefault(require("./popover.style"));
|
|
19
|
+
|
|
18
20
|
var _carbonScopedTokensProvider = _interopRequireDefault(require("../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component"));
|
|
19
21
|
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -29,7 +31,8 @@ const Popover = ({
|
|
|
29
31
|
disablePortal,
|
|
30
32
|
reference,
|
|
31
33
|
onFirstUpdate,
|
|
32
|
-
modifiers
|
|
34
|
+
modifiers,
|
|
35
|
+
disableBackgroundUI
|
|
33
36
|
}) => {
|
|
34
37
|
const elementDOM = (0, _react.useRef)();
|
|
35
38
|
|
|
@@ -90,6 +93,10 @@ const Popover = ({
|
|
|
90
93
|
};
|
|
91
94
|
}, [disablePortal]);
|
|
92
95
|
|
|
96
|
+
if (disableBackgroundUI) {
|
|
97
|
+
content = /*#__PURE__*/_react.default.createElement(_popover.default, null, content);
|
|
98
|
+
}
|
|
99
|
+
|
|
93
100
|
if (disablePortal) {
|
|
94
101
|
return content;
|
|
95
102
|
}
|
|
@@ -102,11 +109,13 @@ Popover.propTypes = {
|
|
|
102
109
|
children: _propTypes.default.node.isRequired,
|
|
103
110
|
// Placement of children in relation to the reference element
|
|
104
111
|
placement: _propTypes.default.oneOf(["auto", "auto-start", "auto-end", "top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "right", "right-start", "right-end", "left", "left-start", "left-end"]),
|
|
112
|
+
// Disables interaction with background UI
|
|
113
|
+
disableBackgroundUI: _propTypes.default.bool,
|
|
105
114
|
// Optional modifiers array, for more information and object structure go to:
|
|
106
115
|
// https://popper.js.org/docs/v2/constructors/#modifiers
|
|
107
116
|
modifiers: _propTypes.default.array,
|
|
108
|
-
// Optional onFirstUpdate
|
|
109
|
-
// https://popper.js.org/docs/v2/
|
|
117
|
+
// Optional onFirstUpdate function, for more information go to:
|
|
118
|
+
// https://popper.js.org/docs/v2/lifecycle/#hook-into-the-lifecycle
|
|
110
119
|
onFirstUpdate: _propTypes.default.func,
|
|
111
120
|
// When true, children are not rendered in portal
|
|
112
121
|
disablePortal: _propTypes.default.bool,
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { State } from "@popperjs/core";
|
|
3
|
+
|
|
4
|
+
type PopoverModifier = {
|
|
5
|
+
name: string;
|
|
6
|
+
options?: Record<string, unknown>;
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export interface PopoverPropTypes {
|
|
11
|
+
// Element to be positioned, has to be a single node and has to accept `ref` and `style` props
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
// Placement of children in relation to the reference element
|
|
14
|
+
placement?:
|
|
15
|
+
| "auto"
|
|
16
|
+
| "auto-start"
|
|
17
|
+
| "auto-end"
|
|
18
|
+
| "top"
|
|
19
|
+
| "top-start"
|
|
20
|
+
| "top-end"
|
|
21
|
+
| "bottom"
|
|
22
|
+
| "bottom-start"
|
|
23
|
+
| "bottom-end"
|
|
24
|
+
| "right"
|
|
25
|
+
| "right-start"
|
|
26
|
+
| "right-end"
|
|
27
|
+
| "left"
|
|
28
|
+
| "left-start"
|
|
29
|
+
| "left-end";
|
|
30
|
+
// Disables interaction with background UI
|
|
31
|
+
disableBackgroundUI?: boolean;
|
|
32
|
+
// Optional modifiers array, for more information and object structure go to:
|
|
33
|
+
// https://popper.js.org/docs/v2/constructors/#modifiers
|
|
34
|
+
modifiers?: PopoverModifier[];
|
|
35
|
+
// Optional onFirstUpdate function, for more information go to:
|
|
36
|
+
// hhttps://popper.js.org/docs/v2/lifecycle/#hook-into-the-lifecycle
|
|
37
|
+
onFirstUpdate?: (state: State) => void;
|
|
38
|
+
// When true, children are not rendered in portal
|
|
39
|
+
disablePortal?: boolean;
|
|
40
|
+
// Reference element, children will be positioned in relation to this element - should be a ref
|
|
41
|
+
reference?: React.RefObject<HTMLElement>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare function Popover(props: PopoverPropTypes): JSX.Element;
|
|
45
|
+
|
|
46
|
+
export default Popover;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
const StyledBackdrop = _styledComponents.default.div`
|
|
15
|
+
bottom: 0;
|
|
16
|
+
left: 0;
|
|
17
|
+
position: fixed;
|
|
18
|
+
right: 0;
|
|
19
|
+
top: 0;
|
|
20
|
+
z-index: ${({
|
|
21
|
+
theme
|
|
22
|
+
}) => theme.zIndex.popover};
|
|
23
|
+
background: transparent;
|
|
24
|
+
`;
|
|
25
|
+
StyledBackdrop.defaultProps = {
|
|
26
|
+
theme: _base.default
|
|
27
|
+
};
|
|
28
|
+
var _default = StyledBackdrop;
|
|
29
|
+
exports.default = _default;
|
|
@@ -29,7 +29,6 @@ const ButtonBar = _styledComponents.default.div`
|
|
|
29
29
|
`;
|
|
30
30
|
|
|
31
31
|
function stylingForType({
|
|
32
|
-
theme,
|
|
33
32
|
size
|
|
34
33
|
}) {
|
|
35
34
|
return (0, _styledComponents.css)`
|
|
@@ -50,7 +49,7 @@ function stylingForType({
|
|
|
50
49
|
|
|
51
50
|
button {
|
|
52
51
|
margin: 0;
|
|
53
|
-
border: 2px solid
|
|
52
|
+
border: 2px solid var(--colorsActionMajor500);
|
|
54
53
|
|
|
55
54
|
&:not(:last-of-type) {
|
|
56
55
|
border-right-color: transparent;
|
|
@@ -61,20 +60,20 @@ function stylingForType({
|
|
|
61
60
|
&:focus {
|
|
62
61
|
position: relative;
|
|
63
62
|
z-index: 2;
|
|
64
|
-
border-right-color:
|
|
63
|
+
border-right-color: var(--colorsActionMajor500);
|
|
65
64
|
}
|
|
66
65
|
&:hover {
|
|
67
|
-
background-color:
|
|
68
|
-
border-color:
|
|
66
|
+
background-color: var(--colorsActionMajor600);
|
|
67
|
+
border-color: var(--colorsActionMajor600);
|
|
69
68
|
& + button {
|
|
70
|
-
border-left-color:
|
|
69
|
+
border-left-color: var(--colorsActionMajor600);
|
|
71
70
|
}
|
|
72
71
|
& ${_icon.default} {
|
|
73
72
|
color: white;
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
75
|
& ${_icon.default} {
|
|
77
|
-
color:
|
|
76
|
+
color: var(--colorsActionMajor500);
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
`;
|
|
@@ -9,8 +9,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
|
|
10
10
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
11
11
|
|
|
12
|
-
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
13
|
-
|
|
14
12
|
var _icon = _interopRequireDefault(require("../icon/icon.style"));
|
|
15
13
|
|
|
16
14
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -63,41 +61,35 @@ const StyledButtonToggleLabel = _styledComponents.default.label`
|
|
|
63
61
|
padding: 0 ${paddingConfig[size]}px;
|
|
64
62
|
font-size: ${fontSizeConfig[size]}px;
|
|
65
63
|
`}
|
|
66
|
-
font-weight:
|
|
64
|
+
font-weight: 700;
|
|
67
65
|
cursor: pointer;
|
|
68
66
|
|
|
69
|
-
|
|
70
|
-
theme
|
|
71
|
-
}) => (0, _styledComponents.css)`
|
|
72
|
-
border: 1px solid ${theme.colors.border};
|
|
73
|
-
background-color: ${theme.colors.white};
|
|
67
|
+
border: 1px solid var(--colorsActionMinor500);
|
|
74
68
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
${_icon.default} {
|
|
70
|
+
color: var(--colorsActionMinor500);
|
|
71
|
+
}
|
|
78
72
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
73
|
+
input:checked ~ && {
|
|
74
|
+
background-color: var(--colorsActionMinor300);
|
|
75
|
+
color: var(--colorsActionMinor600);
|
|
76
|
+
cursor: auto;
|
|
77
|
+
}
|
|
85
78
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
79
|
+
input:focus ~ & {
|
|
80
|
+
outline: 3px solid var(--colorsSemanticFocus500);
|
|
81
|
+
z-index: 100;
|
|
82
|
+
}
|
|
90
83
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
84
|
+
input:not(:checked):not(:disabled) ~ &:hover {
|
|
85
|
+
background-color: var(--colorsActionMinor200);
|
|
86
|
+
border-color: var(--colorsActionMinor500);
|
|
87
|
+
color: var(--colorsActionMinor500);
|
|
95
88
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
89
|
+
${_icon.default} {
|
|
90
|
+
color: var(--colorsActionMinor500);
|
|
99
91
|
}
|
|
100
|
-
|
|
92
|
+
}
|
|
101
93
|
|
|
102
94
|
${({
|
|
103
95
|
buttonIcon,
|
|
@@ -113,16 +105,14 @@ const StyledButtonToggleLabel = _styledComponents.default.label`
|
|
|
113
105
|
`}
|
|
114
106
|
|
|
115
107
|
${({
|
|
116
|
-
disabled
|
|
117
|
-
theme
|
|
108
|
+
disabled
|
|
118
109
|
}) => disabled && (0, _styledComponents.css)`
|
|
119
110
|
& {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
color: ${theme.disabled.buttonText};
|
|
111
|
+
border-color: var(--colorsActionDisabled500);
|
|
112
|
+
color: var(--colorsActionMinorYin030);
|
|
123
113
|
|
|
124
114
|
${_icon.default} {
|
|
125
|
-
color:
|
|
115
|
+
color: var(--colorsActionMinorYin030);
|
|
126
116
|
}
|
|
127
117
|
}
|
|
128
118
|
cursor: not-allowed;
|
|
@@ -188,10 +178,4 @@ const StyledButtonToggleInput = _styledComponents.default.input`
|
|
|
188
178
|
exports.StyledButtonToggleInput = StyledButtonToggleInput;
|
|
189
179
|
StyledButtonToggleIcon.propTypes = {
|
|
190
180
|
buttonIconSize: _propTypes.default.string
|
|
191
|
-
};
|
|
192
|
-
StyledButtonToggleLabel.defaultProps = {
|
|
193
|
-
theme: _base.default
|
|
194
|
-
};
|
|
195
|
-
StyledButtonToggleLabel.defaultProps = {
|
|
196
|
-
theme: _base.default
|
|
197
181
|
};
|
|
@@ -11,8 +11,6 @@ var _buttonToggle = require("../button-toggle/button-toggle.style");
|
|
|
11
11
|
|
|
12
12
|
var _validationIcon = _interopRequireDefault(require("../../__internal__/validations/validation-icon.style"));
|
|
13
13
|
|
|
14
|
-
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
15
|
-
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
15
|
|
|
18
16
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -30,24 +28,21 @@ const ButtonToggleGroupStyle = _styledComponents.default.div`
|
|
|
30
28
|
|
|
31
29
|
${_buttonToggle.StyledButtonToggleLabel} {
|
|
32
30
|
${({
|
|
33
|
-
theme,
|
|
34
31
|
info
|
|
35
32
|
}) => info && (0, _styledComponents.css)`
|
|
36
|
-
border-color:
|
|
33
|
+
border-color: var(--colorsActionMinor500);
|
|
37
34
|
`};
|
|
38
35
|
${({
|
|
39
|
-
theme,
|
|
40
36
|
warning
|
|
41
37
|
}) => warning && (0, _styledComponents.css)`
|
|
42
|
-
border-color:
|
|
38
|
+
border-color: var(--colorsSemanticCaution500);
|
|
43
39
|
`}
|
|
44
40
|
${({
|
|
45
|
-
theme,
|
|
46
41
|
error
|
|
47
42
|
}) => error && (0, _styledComponents.css)`
|
|
48
|
-
box-shadow: inset 1px 1px 0
|
|
49
|
-
inset -1px -1px 0
|
|
50
|
-
border-color:
|
|
43
|
+
box-shadow: inset 1px 1px 0 var(--colorsSemanticNegative500),
|
|
44
|
+
inset -1px -1px 0 var(--colorsSemanticNegative500);
|
|
45
|
+
border-color: var(--colorsSemanticNegative500);
|
|
51
46
|
`}
|
|
52
47
|
}
|
|
53
48
|
|
|
@@ -55,8 +50,5 @@ const ButtonToggleGroupStyle = _styledComponents.default.div`
|
|
|
55
50
|
margin-left: 4px;
|
|
56
51
|
}
|
|
57
52
|
`;
|
|
58
|
-
ButtonToggleGroupStyle.defaultProps = {
|
|
59
|
-
theme: _base.default
|
|
60
|
-
};
|
|
61
53
|
var _default = ButtonToggleGroupStyle;
|
|
62
54
|
exports.default = _default;
|
|
@@ -11,9 +11,11 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _reactTransitionGroup = require("react-transition-group");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _useScrollBlock = _interopRequireDefault(require("../../hooks/__internal__/useScrollBlock"));
|
|
15
|
+
|
|
16
|
+
var _portal = _interopRequireDefault(require("../portal"));
|
|
15
17
|
|
|
16
|
-
var
|
|
18
|
+
var _events = _interopRequireDefault(require("../../__internal__/utils/helpers/events"));
|
|
17
19
|
|
|
18
20
|
var _modalManager = _interopRequireDefault(require("./__internal__/modal-manager"));
|
|
19
21
|
|
|
@@ -44,35 +46,30 @@ const Modal = ({
|
|
|
44
46
|
const ref = (0, _react.useRef)();
|
|
45
47
|
const listenerAdded = (0, _react.useRef)(false);
|
|
46
48
|
const modalRegistered = (0, _react.useRef)(false);
|
|
47
|
-
const originalOverflow = (0, _react.useRef)(undefined);
|
|
48
49
|
const [isAnimationComplete, setAnimationComplete] = (0, _react.useState)(false);
|
|
49
50
|
const [triggerRefocusFlag, setTriggerRefocusFlag] = (0, _react.useState)(false);
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
}, [enableBackgroundUI]);
|
|
56
|
-
const unsetOverflow = (0, _react.useCallback)(() => {
|
|
57
|
-
if (typeof originalOverflow.current !== "undefined" && !enableBackgroundUI) {
|
|
58
|
-
document.documentElement.style.overflow = originalOverflow.current;
|
|
59
|
-
originalOverflow.current = undefined;
|
|
60
|
-
}
|
|
61
|
-
}, [enableBackgroundUI]);
|
|
51
|
+
const {
|
|
52
|
+
blockScroll,
|
|
53
|
+
allowScroll
|
|
54
|
+
} = (0, _useScrollBlock.default)();
|
|
62
55
|
(0, _react.useEffect)(() => {
|
|
63
|
-
if (
|
|
64
|
-
|
|
56
|
+
if (enableBackgroundUI) {
|
|
57
|
+
return;
|
|
65
58
|
}
|
|
66
59
|
|
|
67
|
-
if (
|
|
68
|
-
|
|
60
|
+
if (open) {
|
|
61
|
+
blockScroll();
|
|
62
|
+
} else {
|
|
63
|
+
allowScroll();
|
|
69
64
|
}
|
|
70
|
-
}, [
|
|
65
|
+
}, [allowScroll, blockScroll, enableBackgroundUI, open]);
|
|
71
66
|
(0, _react.useEffect)(() => {
|
|
72
67
|
return () => {
|
|
73
|
-
|
|
68
|
+
if (!enableBackgroundUI) {
|
|
69
|
+
allowScroll();
|
|
70
|
+
}
|
|
74
71
|
};
|
|
75
|
-
}, [
|
|
72
|
+
}, [allowScroll, enableBackgroundUI]);
|
|
76
73
|
const closeModal = (0, _react.useCallback)(ev => {
|
|
77
74
|
const isTopmost = _modalManager.default.isTopmost(ref.current);
|
|
78
75
|
|
|
@@ -143,7 +140,8 @@ const Modal = ({
|
|
|
143
140
|
if (open) {
|
|
144
141
|
background = !enableBackgroundUI ? /*#__PURE__*/_react.default.createElement(_modal.StyledModalBackground, {
|
|
145
142
|
"data-element": "modal-background",
|
|
146
|
-
transitionName: "modal-background"
|
|
143
|
+
transitionName: "modal-background",
|
|
144
|
+
transitionTime: timeout
|
|
147
145
|
}) : null;
|
|
148
146
|
content = children;
|
|
149
147
|
}
|
|
@@ -151,6 +149,7 @@ const Modal = ({
|
|
|
151
149
|
return /*#__PURE__*/_react.default.createElement(_portal.default, null, /*#__PURE__*/_react.default.createElement(_modal.StyledModal, _extends({
|
|
152
150
|
"data-state": open ? "open" : "closed",
|
|
153
151
|
transitionName: "modal",
|
|
152
|
+
transitionTime: timeout,
|
|
154
153
|
ref: ref
|
|
155
154
|
}, rest), /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.TransitionGroup, null, background && /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.CSSTransition, {
|
|
156
155
|
key: "modal",
|
|
@@ -197,7 +196,7 @@ Modal.defaultProps = {
|
|
|
197
196
|
onCancel: null,
|
|
198
197
|
enableBackgroundUI: false,
|
|
199
198
|
disableEscKey: false,
|
|
200
|
-
timeout:
|
|
199
|
+
timeout: 300
|
|
201
200
|
};
|
|
202
201
|
var _default = Modal;
|
|
203
202
|
exports.default = _default;
|
|
@@ -7,14 +7,15 @@ exports.StyledModalBackground = exports.StyledModal = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
|
|
10
|
+
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
10
14
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
11
15
|
|
|
12
16
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
17
|
|
|
14
18
|
const backgroundOpacity = "0.6";
|
|
15
|
-
const backgroundAnimationLength = "300ms";
|
|
16
|
-
const initialPosition = "50px";
|
|
17
|
-
const animationLength = "300ms";
|
|
18
19
|
const StyledModalBackground = _styledComponents.default.div`
|
|
19
20
|
background-color: rgba(0, 20, 29, 0.6);
|
|
20
21
|
bottom: 0;
|
|
@@ -25,7 +26,8 @@ const StyledModalBackground = _styledComponents.default.div`
|
|
|
25
26
|
top: 0;
|
|
26
27
|
|
|
27
28
|
${({
|
|
28
|
-
transitionName
|
|
29
|
+
transitionName,
|
|
30
|
+
transitionTime
|
|
29
31
|
}) => (0, _styledComponents.css)`
|
|
30
32
|
&.${transitionName}-enter, .${transitionName}-appear {
|
|
31
33
|
opacity: 0;
|
|
@@ -34,7 +36,7 @@ const StyledModalBackground = _styledComponents.default.div`
|
|
|
34
36
|
&.${transitionName}-enter.${transitionName}-enter-active,
|
|
35
37
|
&.${transitionName}-appear.${transitionName}-appear-active {
|
|
36
38
|
opacity: ${backgroundOpacity};
|
|
37
|
-
transition: opacity ${
|
|
39
|
+
transition: opacity ${transitionTime}ms ease-out;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
&.${transitionName}-exit {
|
|
@@ -43,37 +45,42 @@ const StyledModalBackground = _styledComponents.default.div`
|
|
|
43
45
|
|
|
44
46
|
&.${transitionName}-exit.${transitionName}-exit-active {
|
|
45
47
|
opacity: 0;
|
|
46
|
-
transition: opacity ${
|
|
48
|
+
transition: opacity ${transitionTime}ms 100ms ease-out;
|
|
47
49
|
}
|
|
48
|
-
`}
|
|
50
|
+
`};
|
|
49
51
|
`;
|
|
50
52
|
exports.StyledModalBackground = StyledModalBackground;
|
|
51
53
|
const StyledModal = _styledComponents.default.div`
|
|
54
|
+
position: absolute;
|
|
55
|
+
z-index: ${({
|
|
56
|
+
theme
|
|
57
|
+
}) => theme.zIndex.modal};
|
|
58
|
+
|
|
52
59
|
${({
|
|
53
|
-
transitionName
|
|
60
|
+
transitionName,
|
|
61
|
+
transitionTime
|
|
54
62
|
}) => (0, _styledComponents.css)`
|
|
55
63
|
.${transitionName}-enter, .${transitionName}-appear {
|
|
56
64
|
opacity: 0;
|
|
57
|
-
margin-top: ${initialPosition};
|
|
58
65
|
}
|
|
59
66
|
|
|
60
67
|
.${transitionName}-enter.${transitionName}-enter-active,
|
|
61
68
|
.${transitionName}-appear.${transitionName}-appear-active {
|
|
62
69
|
opacity: 1;
|
|
63
|
-
|
|
64
|
-
transition: all ${animationLength} 100ms ease-out;
|
|
70
|
+
transition: all ${transitionTime}ms 100ms ease-out;
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
.${transitionName}-exit {
|
|
68
74
|
opacity: 1;
|
|
69
|
-
margin-top: 0;
|
|
70
75
|
}
|
|
71
76
|
|
|
72
77
|
.${transitionName}-exit.${transitionName}-exit-active {
|
|
73
78
|
opacity: 0;
|
|
74
|
-
|
|
75
|
-
transition: all ${animationLength} ease-out;
|
|
79
|
+
transition: all ${transitionTime}ms ease-out;
|
|
76
80
|
}
|
|
77
81
|
`}
|
|
78
82
|
`;
|
|
79
|
-
exports.StyledModal = StyledModal;
|
|
83
|
+
exports.StyledModal = StyledModal;
|
|
84
|
+
StyledModal.defaultProps = {
|
|
85
|
+
theme: _base.default
|
|
86
|
+
};
|
|
@@ -26,7 +26,6 @@ const StyledNoteContent = _styledComponents.default.div`
|
|
|
26
26
|
width: 100%;
|
|
27
27
|
|
|
28
28
|
${({
|
|
29
|
-
theme,
|
|
30
29
|
hasPreview
|
|
31
30
|
}) => (0, _styledComponents.css)`
|
|
32
31
|
&:not(:last-of-type) {
|
|
@@ -42,16 +41,16 @@ const StyledNoteContent = _styledComponents.default.div`
|
|
|
42
41
|
div.public-DraftEditor-content {
|
|
43
42
|
min-height: inherit;
|
|
44
43
|
height: 100%;
|
|
45
|
-
background-color:
|
|
44
|
+
background-color: var(--colorsUtilityYang100);
|
|
46
45
|
line-height: 21px;
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
&:last-of-type:not(:first-of-type) {
|
|
50
|
-
border-top: solid 1px
|
|
49
|
+
border-top: solid 1px var(--colorsUtilityMajor050);
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
${hasPreview && `
|
|
54
|
-
margin-top:
|
|
53
|
+
margin-top: var(--spacing200);
|
|
55
54
|
`}
|
|
56
55
|
`}
|
|
57
56
|
`;
|
|
@@ -76,10 +75,9 @@ const StyledFooterContent = _styledComponents.default.div`
|
|
|
76
75
|
font-weight: bold;
|
|
77
76
|
|
|
78
77
|
${({
|
|
79
|
-
theme,
|
|
80
78
|
hasName
|
|
81
79
|
}) => (0, _styledComponents.css)`
|
|
82
|
-
margin-top:
|
|
80
|
+
margin-top: var(--spacing200);
|
|
83
81
|
|
|
84
82
|
${hasName && (0, _styledComponents.css)`
|
|
85
83
|
&:first-of-type {
|
|
@@ -88,29 +86,29 @@ const StyledFooterContent = _styledComponents.default.div`
|
|
|
88
86
|
|
|
89
87
|
&:nth-of-type(2) {
|
|
90
88
|
font-size: 12px;
|
|
91
|
-
color:
|
|
92
|
-
margin-left:
|
|
89
|
+
color: var(--colorsUtilityYin065);
|
|
90
|
+
margin-left: var(--spacing200);
|
|
93
91
|
}
|
|
94
92
|
|
|
95
93
|
&:last-of-type:not(:nth-of-type(2)) {
|
|
96
94
|
font-size: 12px;
|
|
97
|
-
color:
|
|
95
|
+
color: var(--colorsUtilityYin065);
|
|
98
96
|
cursor: pointer;
|
|
99
|
-
margin-left:
|
|
97
|
+
margin-left: var(--spacing300);
|
|
100
98
|
}
|
|
101
99
|
`}
|
|
102
100
|
|
|
103
101
|
${!hasName && (0, _styledComponents.css)`
|
|
104
102
|
&:first-of-type {
|
|
105
103
|
font-size: 12px;
|
|
106
|
-
color:
|
|
104
|
+
color: var(--colorsUtilityYin065);
|
|
107
105
|
}
|
|
108
106
|
|
|
109
107
|
&:last-of-type:not(:first-of-type) {
|
|
110
108
|
font-size: 12px;
|
|
111
|
-
color:
|
|
109
|
+
color: var(--colorsUtilityYin065);
|
|
112
110
|
cursor: pointer;
|
|
113
|
-
margin-left:
|
|
111
|
+
margin-left: var(--spacing300);
|
|
114
112
|
}
|
|
115
113
|
`}
|
|
116
114
|
`}
|
|
@@ -118,19 +116,16 @@ const StyledFooterContent = _styledComponents.default.div`
|
|
|
118
116
|
exports.StyledFooterContent = StyledFooterContent;
|
|
119
117
|
const StyledFooter = _styledComponents.default.div`
|
|
120
118
|
display: flex;
|
|
121
|
-
margin-bottom:
|
|
122
|
-
theme
|
|
123
|
-
}) => `${-theme.spacing}px;`}
|
|
119
|
+
margin-bottom: calc(-1 * var(--spacing100));
|
|
124
120
|
flex-wrap: wrap;
|
|
125
121
|
`;
|
|
126
122
|
exports.StyledFooter = StyledFooter;
|
|
127
123
|
const StyledNote = _styledComponents.default.div`
|
|
128
124
|
${({
|
|
129
|
-
theme,
|
|
130
125
|
width
|
|
131
126
|
}) => (0, _styledComponents.css)`
|
|
132
|
-
background-color:
|
|
133
|
-
border: 1px solid
|
|
127
|
+
background-color: var(--colorsUtilityYang100);
|
|
128
|
+
border: 1px solid var(--colorsUtilityMajor100);
|
|
134
129
|
display: flex;
|
|
135
130
|
flex-direction: column;
|
|
136
131
|
padding: 24px;
|
|
@@ -155,19 +150,10 @@ const StyledNote = _styledComponents.default.div`
|
|
|
155
150
|
${_styledSystem.margin}
|
|
156
151
|
`;
|
|
157
152
|
exports.StyledNote = StyledNote;
|
|
158
|
-
StyledNoteContent.defaultProps = {
|
|
159
|
-
theme: _base.default
|
|
160
|
-
};
|
|
161
153
|
StyledNote.propTypes = {
|
|
162
154
|
padding: _propTypes.default.string,
|
|
163
155
|
width: _propTypes.default.number
|
|
164
156
|
};
|
|
165
157
|
StyledNote.defaultProps = {
|
|
166
158
|
theme: _base.default
|
|
167
|
-
};
|
|
168
|
-
StyledFooter.defaultProps = {
|
|
169
|
-
theme: _base.default
|
|
170
|
-
};
|
|
171
|
-
StyledFooterContent.defaultProps = {
|
|
172
|
-
theme: _base.default
|
|
173
159
|
};
|