@plesk/ui-library 3.35.6 → 3.35.7
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/cjs/components/AutoClosable/AutoClosable.js +1 -0
- package/cjs/components/InputNumber/InputNumber.js +2 -2
- package/cjs/components/Item/Item.js +64 -153
- package/cjs/components/Overlay/Overlay.js +29 -27
- package/cjs/components/Popover/Popover.js +1 -1
- package/cjs/components/SegmentedControl/SegmentedControl.js +1 -0
- package/cjs/components/Tabs/SearchBar.js +40 -147
- package/cjs/components/Tabs/Tab.js +2 -49
- package/cjs/components/Tabs/Tabs.js +48 -99
- package/cjs/components/Toolbar/ToolbarItem.js +1 -0
- package/cjs/components/index.js +14 -11
- package/cjs/index.js +1 -1
- package/dist/plesk-ui-library.js +435 -628
- package/dist/plesk-ui-library.js.map +1 -1
- package/dist/plesk-ui-library.min.js +8 -12
- package/dist/plesk-ui-library.min.js.map +1 -1
- package/esm/components/AutoClosable/AutoClosable.js +1 -0
- package/esm/components/InputNumber/InputNumber.js +2 -2
- package/esm/components/Item/Item.js +64 -153
- package/esm/components/Overlay/Overlay.js +29 -27
- package/esm/components/Popover/Popover.js +1 -1
- package/esm/components/SegmentedControl/SegmentedControl.js +1 -0
- package/esm/components/Tabs/SearchBar.js +40 -147
- package/esm/components/Tabs/Tab.js +1 -49
- package/esm/components/Tabs/Tabs.js +49 -99
- package/esm/components/Toolbar/ToolbarItem.js +1 -0
- package/esm/components/index.js +1 -2
- package/esm/index.js +1 -1
- package/package.json +28 -33
- package/styleguide/build/bundle.a2d3190d.js +2 -0
- package/styleguide/build/{bundle.8a07b2dd.js.LICENSE.txt → bundle.a2d3190d.js.LICENSE.txt} +27 -23
- package/styleguide/index.html +2 -2
- package/types/src/components/Action/Action.d.ts +1 -1
- package/types/src/components/Alert/Alert.d.ts +1 -1
- package/types/src/components/AutoClosable/AutoClosable.d.ts +23 -21
- package/types/src/components/AuxiliaryActions/AuxiliaryActions.d.ts +1 -1
- package/types/src/components/Badge/Badge.d.ts +1 -1
- package/types/src/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/types/src/components/Button/Button.d.ts +2 -2
- package/types/src/components/Button/ButtonContext.d.ts +1 -1
- package/types/src/components/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/types/src/components/Card/PreviewPanel.d.ts +2 -2
- package/types/src/components/Carousel/Carousel.d.ts +1 -1
- package/types/src/components/Checkbox/Checkbox.d.ts +1 -1
- package/types/src/components/ClosingConfirmation/useClosingConfirmation.d.ts +1 -1
- package/types/src/components/ComboBox/ComboBox.d.ts +2 -2
- package/types/src/components/ComboBox/ComboBoxOption.d.ts +1 -1
- package/types/src/components/ComboBoxDropdown/ComboBoxDropdown.d.ts +5 -5
- package/types/src/components/ConsoleOutput/ConsoleOutput.d.ts +2 -2
- package/types/src/components/ContentLoader/ContentLoader.d.ts +2 -2
- package/types/src/components/ContentLoader/IconsLoader.d.ts +2 -2
- package/types/src/components/Cuttable/Cuttable.d.ts +3 -3
- package/types/src/components/Dialog/Dialog.d.ts +3 -3
- package/types/src/components/DistractionFreeModeContext/DistractionFreeModeContext.d.ts +1 -1
- package/types/src/components/Drawer/Drawer.d.ts +1 -1
- package/types/src/components/Drawer/DrawerProgress.d.ts +4 -4
- package/types/src/components/Drawer/Header.d.ts +1 -1
- package/types/src/components/Dropdown/Dropdown.d.ts +1 -1
- package/types/src/components/ExtendedStatusMessage/ExtendedStatusMessage.d.ts +1 -1
- package/types/src/components/ExtendedStatusMessage/ExtendedStatusMessageActions.d.ts +1 -1
- package/types/src/components/ExtendedStatusMessage/ExtendedStatusMessageDescription.d.ts +1 -1
- package/types/src/components/ExtendedStatusMessage/ExtendedStatusMessageSeparator.d.ts +1 -1
- package/types/src/components/ExtendedStatusMessage/ExtendedStatusMessageTitle.d.ts +1 -1
- package/types/src/components/Figure/Figure.d.ts +1 -1
- package/types/src/components/Form/Form.d.ts +2 -2
- package/types/src/components/Form/types.d.ts +7 -7
- package/types/src/components/Form/utils.d.ts +3 -3
- package/types/src/components/FormFieldCheckbox/FormFieldCheckbox.d.ts +1 -1
- package/types/src/components/FormFieldPassword/FormFieldPassword.d.ts +4 -4
- package/types/src/components/FormFieldPassword/PasswordMeter.d.ts +1 -1
- package/types/src/components/FormFieldPassword/estimatePassword.d.ts +2 -2
- package/types/src/components/FormFieldSelect/FormFieldSelect.d.ts +2 -2
- package/types/src/components/FormFieldText/FormFieldText.d.ts +4 -4
- package/types/src/components/Grid/Grid.d.ts +4 -4
- package/types/src/components/GridCol/GridCol.d.ts +2 -2
- package/types/src/components/Heading/Heading.d.ts +1 -1
- package/types/src/components/Hint/Hint.d.ts +1 -1
- package/types/src/components/Icon/Icon.d.ts +3 -3
- package/types/src/components/Icon/constants.d.ts +1 -1
- package/types/src/components/InPlaceEdit/InPlaceEdit.d.ts +2 -2
- package/types/src/components/Input/Input.d.ts +4 -3
- package/types/src/components/InputFile/InputFile.d.ts +1 -1
- package/types/src/components/Item/Item.d.ts +79 -0
- package/types/src/components/Item/index.d.ts +2 -0
- package/types/src/components/ItemLink/ItemLink.d.ts +1 -1
- package/types/src/components/ItemList/ItemList.d.ts +7 -7
- package/types/src/components/Label/Label.d.ts +3 -3
- package/types/src/components/Layer/Layer.d.ts +1 -1
- package/types/src/components/Layout/Layout.d.ts +9 -9
- package/types/src/components/Link/Link.d.ts +3 -3
- package/types/src/components/List/ListAction.d.ts +3 -3
- package/types/src/components/List/ListActions.d.ts +2 -2
- package/types/src/components/List/ListActionsDivider.d.ts +2 -2
- package/types/src/components/List/ListEmptyView.d.ts +1 -1
- package/types/src/components/List/ListOperation.d.ts +9 -5
- package/types/src/components/List/ListOperationContext.d.ts +1 -1
- package/types/src/components/LocaleProvider/LocaleProvider.d.ts +5 -5
- package/types/src/components/Markdown/Markdown.d.ts +2 -2
- package/types/src/components/Media/Media.d.ts +1 -1
- package/types/src/components/Media/MediaSection.d.ts +1 -1
- package/types/src/components/Menu/Menu.d.ts +1 -1
- package/types/src/components/Menu/MenuBaseItem.d.ts +3 -3
- package/types/src/components/Menu/MenuDivider.d.ts +1 -1
- package/types/src/components/Menu/MenuHeader.d.ts +1 -1
- package/types/src/components/Menu/MenuItem.d.ts +2 -2
- package/types/src/components/Menu/MenuSelectableItem.d.ts +2 -2
- package/types/src/components/Overlay/Overlay.d.ts +2 -2
- package/types/src/components/PageHeader/PageHeader.d.ts +1 -1
- package/types/src/components/Pagination/Pagination.d.ts +2 -2
- package/types/src/components/Panel/Panel.d.ts +3 -3
- package/types/src/components/Paragraph/Paragraph.d.ts +1 -1
- package/types/src/components/Plaintext/Plaintext.d.ts +1 -1
- package/types/src/components/Popover/Popover.d.ts +5 -3
- package/types/src/components/Popper/Popper.d.ts +2 -2
- package/types/src/components/Progress/Progress.d.ts +2 -2
- package/types/src/components/ProgressBar/ProgressBar.d.ts +1 -1
- package/types/src/components/ProgressBar/ProgressIndicator.d.ts +1 -1
- package/types/src/components/ProgressDialog/ProgressDialog.d.ts +2 -2
- package/types/src/components/ProgressStep/ProgressStep.d.ts +2 -2
- package/types/src/components/Radio/Radio.d.ts +1 -1
- package/types/src/components/Rating/Rating.d.ts +1 -1
- package/types/src/components/Section/Section.d.ts +5 -5
- package/types/src/components/Section/SectionItem.d.ts +1 -1
- package/types/src/components/SegmentedControl/SegmentedControl.d.ts +16 -12
- package/types/src/components/Select/MultiValue.d.ts +1 -1
- package/types/src/components/Select/Select.d.ts +1 -1
- package/types/src/components/Select/SelectControl.d.ts +1 -1
- package/types/src/components/Select/SelectOption.d.ts +1 -1
- package/types/src/components/Select/SelectOptionGroup.d.ts +1 -1
- package/types/src/components/Select/structures.d.ts +3 -3
- package/types/src/components/Skeleton/Skeleton.d.ts +1 -1
- package/types/src/components/Spinner/Spinner.d.ts +1 -1
- package/types/src/components/SplitButton/SplitButton.d.ts +1 -1
- package/types/src/components/Spot/Spot.d.ts +1 -1
- package/types/src/components/Spot/SpotPopup.d.ts +5 -3
- package/types/src/components/Squeezer/Squeezer.d.ts +2 -2
- package/types/src/components/Status/Status.d.ts +3 -3
- package/types/src/components/StatusMessage/StatusMessage.d.ts +1 -1
- package/types/src/components/Subnav/Subnav.d.ts +1 -1
- package/types/src/components/Switch/Switch.d.ts +3 -2
- package/types/src/components/SwitchesPanel/SwitchesPanel.d.ts +1 -1
- package/types/src/components/SwitchesPanelItem/SwitchesPanelItem.d.ts +1 -1
- package/types/src/components/Tabs/SearchBar.d.ts +107 -0
- package/types/src/components/Tabs/Tab.d.ts +62 -0
- package/types/src/components/Tabs/Tabs.d.ts +111 -0
- package/types/src/components/Tabs/index.d.ts +6 -0
- package/types/src/components/Text/Text.d.ts +1 -1
- package/types/src/components/TextArea/TextArea.d.ts +4 -4
- package/types/src/components/Toast/Toast.d.ts +2 -2
- package/types/src/components/Toaster/Toaster.d.ts +4 -4
- package/types/src/components/Toolbar/RegistryContext.d.ts +2 -2
- package/types/src/components/Toolbar/Toolbar.d.ts +2 -2
- package/types/src/components/Toolbar/ToolbarExpander.d.ts +2 -2
- package/types/src/components/Toolbar/ToolbarGroup.d.ts +1 -1
- package/types/src/components/Toolbar/ToolbarItem.d.ts +1 -1
- package/types/src/components/Toolbar/ToolbarMenu.d.ts +1 -1
- package/types/src/components/Tooltip/Tooltip.d.ts +2 -2
- package/types/src/components/Tour/Tour.d.ts +2 -2
- package/types/src/components/Translate/Translate.d.ts +5 -3
- package/types/src/components/index.d.ts +3 -2
- package/types/src/components/utils.d.ts +5 -5
- package/types/src/utils/types/PolymorphicComponent.d.ts +5 -5
- package/styleguide/build/bundle.8a07b2dd.js +0 -2
|
@@ -12,6 +12,7 @@ const AutoClosableContext = /*#__PURE__*/createContext(null);
|
|
|
12
12
|
class AutoClosable extends Component {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
|
+
_defineProperty(this, "context", void 0);
|
|
15
16
|
_defineProperty(this, "children", []);
|
|
16
17
|
_defineProperty(this, "addChild", child => {
|
|
17
18
|
this.children.push(child);
|
|
@@ -35,8 +35,8 @@ const toNumber = value => {
|
|
|
35
35
|
}
|
|
36
36
|
return value;
|
|
37
37
|
};
|
|
38
|
-
const isMinDisabled = (value, min) => min !== undefined && value !== '' && value <= min;
|
|
39
|
-
const isMaxDisabled = (value, max) => max !== undefined && value !== '' && value >= max;
|
|
38
|
+
const isMinDisabled = (value, min) => min !== undefined && value !== '' && +value <= min;
|
|
39
|
+
const isMaxDisabled = (value, max) => max !== undefined && value !== '' && +value >= max;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* `InputNumber` component is used for entering integer numbers.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
3
|
+
import { cloneElement, isValidElement, Children } from 'react';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
5
|
import { CLS_PREFIX } from '../../constants';
|
|
7
6
|
import Icon, { NAMES, ICON_SIZE_32 } from '../Icon';
|
|
@@ -11,23 +10,33 @@ import Tooltip from '../Tooltip';
|
|
|
11
10
|
import { createProxyProps, wrapFunction } from '../utils';
|
|
12
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
const VIEW_SIMPLE = 'simple';
|
|
15
|
-
const VIEW_CARD = 'card';
|
|
16
|
-
|
|
17
13
|
/**
|
|
18
14
|
* `Item` component is element of [ItemList](#!/ItemList) and it is presented as
|
|
19
15
|
* a combination of icon, text title and content (similar to [Media](#!/Media)).
|
|
20
16
|
* @since 0.0.48
|
|
21
17
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const Item = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
children,
|
|
21
|
+
baseClassName = `${CLS_PREFIX}item`,
|
|
22
|
+
component,
|
|
23
|
+
view = 'simple',
|
|
24
|
+
className,
|
|
25
|
+
icon,
|
|
26
|
+
title,
|
|
27
|
+
description,
|
|
28
|
+
footer,
|
|
29
|
+
value,
|
|
30
|
+
tooltip,
|
|
31
|
+
disabled,
|
|
32
|
+
hoverable,
|
|
33
|
+
...props
|
|
34
|
+
} = _ref;
|
|
35
|
+
const Tag = component || 'div';
|
|
36
|
+
const renderTitle = () => {
|
|
24
37
|
if (!title) {
|
|
25
38
|
return null;
|
|
26
39
|
}
|
|
27
|
-
const {
|
|
28
|
-
baseClassName,
|
|
29
|
-
view
|
|
30
|
-
} = this.props;
|
|
31
40
|
let wrappable = false;
|
|
32
41
|
if (typeof title === 'string') {
|
|
33
42
|
title = /*#__PURE__*/_jsx("span", {
|
|
@@ -52,8 +61,8 @@ class Item extends Component {
|
|
|
52
61
|
});
|
|
53
62
|
}
|
|
54
63
|
return title;
|
|
55
|
-
}
|
|
56
|
-
renderIcon(
|
|
64
|
+
};
|
|
65
|
+
const renderIcon = () => {
|
|
57
66
|
if (!icon) {
|
|
58
67
|
return null;
|
|
59
68
|
}
|
|
@@ -66,147 +75,49 @@ class Item extends Component {
|
|
|
66
75
|
return Icon.create(icon, {
|
|
67
76
|
size: ICON_SIZE_32
|
|
68
77
|
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
value,
|
|
82
|
-
tooltip,
|
|
83
|
-
disabled,
|
|
84
|
-
hoverable,
|
|
85
|
-
...props
|
|
86
|
-
} = this.props;
|
|
87
|
-
if (props.onClick) {
|
|
88
|
-
if (disabled) {
|
|
89
|
-
props.onClick = e => e.preventDefault();
|
|
90
|
-
} else {
|
|
91
|
-
props.tabIndex = 0;
|
|
92
|
-
props.onKeyDown = wrapFunction(props.onKeyDown, e => {
|
|
93
|
-
if (e.key === 'Enter') {
|
|
94
|
-
e.preventDefault();
|
|
95
|
-
e.currentTarget.click();
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
const item = /*#__PURE__*/_jsxs(Tag, {
|
|
101
|
-
className: classNames(baseClassName, {
|
|
102
|
-
[`${baseClassName}--card`]: view === 'card',
|
|
103
|
-
[`${baseClassName}--disabled`]: disabled,
|
|
104
|
-
[`${baseClassName}--hoverable`]: hoverable
|
|
105
|
-
}, className),
|
|
106
|
-
...props,
|
|
107
|
-
children: [/*#__PURE__*/_jsxs(Media, {
|
|
108
|
-
image: this.renderIcon(icon),
|
|
109
|
-
title: this.renderTitle(title),
|
|
110
|
-
className: `${baseClassName}__media`,
|
|
111
|
-
children: [description && /*#__PURE__*/_jsx("div", {
|
|
112
|
-
className: `${baseClassName}__description`,
|
|
113
|
-
children: description
|
|
114
|
-
}), Children.toArray(children).length ? /*#__PURE__*/_jsx("div", {
|
|
115
|
-
className: `${baseClassName}__content`,
|
|
116
|
-
children: children
|
|
117
|
-
}) : null]
|
|
118
|
-
}), footer && /*#__PURE__*/_jsx("footer", {
|
|
119
|
-
className: `${baseClassName}__footer`,
|
|
120
|
-
children: footer
|
|
121
|
-
})]
|
|
122
|
-
});
|
|
123
|
-
if (tooltip) {
|
|
124
|
-
return createProxyProps(props => /*#__PURE__*/_jsx(Tooltip, {
|
|
125
|
-
title: tooltip,
|
|
126
|
-
children: /*#__PURE__*/cloneElement(item, props)
|
|
127
|
-
}));
|
|
78
|
+
};
|
|
79
|
+
if (props.onClick) {
|
|
80
|
+
if (disabled) {
|
|
81
|
+
props.onClick = e => e.preventDefault();
|
|
82
|
+
} else {
|
|
83
|
+
props.tabIndex = 0;
|
|
84
|
+
props.onKeyDown = wrapFunction(props.onKeyDown, e => {
|
|
85
|
+
if (e.key === 'Enter') {
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
e.currentTarget.click();
|
|
88
|
+
}
|
|
89
|
+
});
|
|
128
90
|
}
|
|
129
|
-
return item;
|
|
130
91
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
*/
|
|
162
|
-
description: PropTypes.node,
|
|
163
|
-
/**
|
|
164
|
-
* Content of the `Item`.
|
|
165
|
-
* @since 0.0.48
|
|
166
|
-
*/
|
|
167
|
-
children: PropTypes.node,
|
|
168
|
-
/**
|
|
169
|
-
* An unique value. It needs only in ItemList with selectable view.
|
|
170
|
-
* @since 2.3.0
|
|
171
|
-
*/
|
|
172
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
173
|
-
/**
|
|
174
|
-
* Tooltip for component.
|
|
175
|
-
* @since 2.5.1
|
|
176
|
-
*/
|
|
177
|
-
tooltip: PropTypes.node,
|
|
178
|
-
/**
|
|
179
|
-
* @ignore
|
|
180
|
-
*/
|
|
181
|
-
className: PropTypes.string,
|
|
182
|
-
/**
|
|
183
|
-
* @ignore
|
|
184
|
-
*/
|
|
185
|
-
baseClassName: PropTypes.string,
|
|
186
|
-
/**
|
|
187
|
-
* Whether disabled or not.
|
|
188
|
-
* @since 3.15.0
|
|
189
|
-
*/
|
|
190
|
-
disabled: PropTypes.bool,
|
|
191
|
-
/**
|
|
192
|
-
* Add hover shadow and pointer cursor.
|
|
193
|
-
* @since 3.26.0
|
|
194
|
-
*/
|
|
195
|
-
hoverable: PropTypes.bool
|
|
196
|
-
};
|
|
197
|
-
Item.defaultProps = {
|
|
198
|
-
component: 'div',
|
|
199
|
-
view: VIEW_SIMPLE,
|
|
200
|
-
hoverable: undefined,
|
|
201
|
-
title: undefined,
|
|
202
|
-
description: undefined,
|
|
203
|
-
icon: undefined,
|
|
204
|
-
footer: undefined,
|
|
205
|
-
children: undefined,
|
|
206
|
-
value: undefined,
|
|
207
|
-
tooltip: undefined,
|
|
208
|
-
className: undefined,
|
|
209
|
-
disabled: undefined,
|
|
210
|
-
baseClassName: `${CLS_PREFIX}item`
|
|
92
|
+
const item = /*#__PURE__*/_jsxs(Tag, {
|
|
93
|
+
className: classNames(baseClassName, {
|
|
94
|
+
[`${baseClassName}--card`]: view === 'card',
|
|
95
|
+
[`${baseClassName}--disabled`]: disabled,
|
|
96
|
+
[`${baseClassName}--hoverable`]: hoverable
|
|
97
|
+
}, className),
|
|
98
|
+
...props,
|
|
99
|
+
children: [/*#__PURE__*/_jsxs(Media, {
|
|
100
|
+
image: renderIcon(),
|
|
101
|
+
title: renderTitle(),
|
|
102
|
+
className: `${baseClassName}__media`,
|
|
103
|
+
children: [description && /*#__PURE__*/_jsx("div", {
|
|
104
|
+
className: `${baseClassName}__description`,
|
|
105
|
+
children: description
|
|
106
|
+
}), Children.toArray(children).length ? /*#__PURE__*/_jsx("div", {
|
|
107
|
+
className: `${baseClassName}__content`,
|
|
108
|
+
children: children
|
|
109
|
+
}) : null]
|
|
110
|
+
}), footer && /*#__PURE__*/_jsx("footer", {
|
|
111
|
+
className: `${baseClassName}__footer`,
|
|
112
|
+
children: footer
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
115
|
+
if (tooltip) {
|
|
116
|
+
return createProxyProps(props => /*#__PURE__*/_jsx(Tooltip, {
|
|
117
|
+
title: tooltip,
|
|
118
|
+
children: /*#__PURE__*/cloneElement(item, props)
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
return item;
|
|
211
122
|
};
|
|
212
123
|
export default Item;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { disableDocumentScroll, enableDocumentScroll } from '../../utils';
|
|
4
4
|
import { isValidElement, useRef, useState, useLayoutEffect, useCallback, useEffect } from 'react';
|
|
5
|
+
import { CSSTransition } from 'react-transition-group';
|
|
5
6
|
import { safeInvoke } from '../utils';
|
|
6
7
|
import classNames from 'classnames';
|
|
7
8
|
import { CLS_PREFIX, Z_INDEX_OVERLAY } from '../../constants';
|
|
@@ -31,18 +32,8 @@ const OverlayCore = _ref => {
|
|
|
31
32
|
onAnimationExited,
|
|
32
33
|
...props
|
|
33
34
|
} = _ref;
|
|
34
|
-
const
|
|
35
|
+
const overlayRef = useRef(null);
|
|
35
36
|
const contentRef = useRef(null);
|
|
36
|
-
const prevIsOpen = useRef(externalIsOpen);
|
|
37
|
-
if (prevIsOpen.current !== externalIsOpen) {
|
|
38
|
-
prevIsOpen.current = externalIsOpen;
|
|
39
|
-
if (externalIsOpen) {
|
|
40
|
-
clearTimeout(animationTimeoutRef.current);
|
|
41
|
-
} else {
|
|
42
|
-
animationTimeoutRef.current = window.setTimeout(onAnimationExited, 300);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
useEffect(() => () => clearTimeout(animationTimeoutRef.current), []);
|
|
46
37
|
const [isOpen, setIsOpen] = useState(false);
|
|
47
38
|
useEffect(() => setIsOpen(externalIsOpen), [externalIsOpen]);
|
|
48
39
|
const focus = () => {
|
|
@@ -99,28 +90,39 @@ const OverlayCore = _ref => {
|
|
|
99
90
|
};
|
|
100
91
|
return /*#__PURE__*/_jsx(Layer, {
|
|
101
92
|
level: Z_INDEX_OVERLAY,
|
|
102
|
-
children: /*#__PURE__*/
|
|
103
|
-
|
|
93
|
+
children: /*#__PURE__*/_jsx(CSSTransition, {
|
|
94
|
+
in: isOpen,
|
|
95
|
+
timeout: 300,
|
|
96
|
+
classNames: {
|
|
97
|
+
enterActive: `${baseClassName}--open`,
|
|
98
|
+
enterDone: `${baseClassName}--open`
|
|
99
|
+
},
|
|
100
|
+
onExited: onAnimationExited,
|
|
101
|
+
nodeRef: overlayRef,
|
|
104
102
|
style: {
|
|
105
103
|
'--overlay-side-banner-background': sideBannerContainer?.background,
|
|
106
104
|
'--overlay-side-banner-align': sideBannerContainer?.align,
|
|
107
105
|
...style
|
|
108
106
|
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
className: `${baseClassName}
|
|
112
|
-
|
|
113
|
-
}), /*#__PURE__*/_jsxs(FocusTrap, {
|
|
114
|
-
className: `${baseClassName}__content`,
|
|
115
|
-
onKeyUp: canCloseOnEscapePress ? handleContentKeyUp : undefined,
|
|
116
|
-
ref: contentRef,
|
|
117
|
-
role: "dialog",
|
|
118
|
-
"aria-modal": "true",
|
|
107
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
108
|
+
ref: overlayRef,
|
|
109
|
+
className: classNames(baseClassName, `${baseClassName}--${placement}`, `${baseClassName}--${size}`, sideBanner && `${baseClassName}--side`, className),
|
|
110
|
+
...props,
|
|
119
111
|
children: [/*#__PURE__*/_jsx("div", {
|
|
120
|
-
className: `${baseClassName}
|
|
121
|
-
|
|
122
|
-
}),
|
|
123
|
-
|
|
112
|
+
className: `${baseClassName}__backdrop`,
|
|
113
|
+
onClick: handleBackdropClick
|
|
114
|
+
}), /*#__PURE__*/_jsxs(FocusTrap, {
|
|
115
|
+
className: `${baseClassName}__content`,
|
|
116
|
+
onKeyUp: canCloseOnEscapePress ? handleContentKeyUp : undefined,
|
|
117
|
+
ref: contentRef,
|
|
118
|
+
role: "dialog",
|
|
119
|
+
"aria-modal": "true",
|
|
120
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
121
|
+
className: `${baseClassName}__body`,
|
|
122
|
+
children: children
|
|
123
|
+
}), sideBanner && renderImage(sideBanner)]
|
|
124
|
+
})]
|
|
125
|
+
})
|
|
124
126
|
})
|
|
125
127
|
});
|
|
126
128
|
};
|
|
@@ -27,6 +27,7 @@ class SegmentedControl extends Component {
|
|
|
27
27
|
selected: this.props.selected,
|
|
28
28
|
monoWidth: 0
|
|
29
29
|
});
|
|
30
|
+
_defineProperty(this, "context", void 0);
|
|
30
31
|
_defineProperty(this, "isCompact", false);
|
|
31
32
|
_defineProperty(this, "rootRef", /*#__PURE__*/createRef());
|
|
32
33
|
_defineProperty(this, "adjustMonospaced", () => {
|