@plesk/ui-library 3.34.0 → 3.34.2
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/Button/Button.js +17 -100
- package/cjs/components/ContentLoader/IconsLoader.js +2 -1
- package/cjs/components/Dialog/Dialog.js +4 -113
- package/cjs/components/Drawer/Drawer.js +10 -143
- package/cjs/components/Drawer/Header.js +5 -12
- package/cjs/components/Dropdown/Dropdown.js +4 -42
- package/cjs/components/Form/Form.js +2 -1
- package/cjs/components/FormFieldPassword/PasswordMeter.js +4 -4
- package/cjs/components/Overlay/Overlay.js +4 -3
- package/cjs/components/Section/Section.js +2 -1
- package/cjs/components/Skeleton/SkeletonText.js +1 -1
- package/cjs/index.js +1 -1
- package/cjs/utils/types/PolymorphicComponent.js +5 -0
- package/cjs/utils/types/index.js +5 -0
- package/dist/plesk-ui-library-rtl.css +1 -1
- package/dist/plesk-ui-library-rtl.css.map +1 -1
- package/dist/plesk-ui-library.css +1 -1
- package/dist/plesk-ui-library.css.map +1 -1
- package/dist/plesk-ui-library.js +128 -494
- package/dist/plesk-ui-library.js.map +1 -1
- package/dist/plesk-ui-library.min.js +5 -5
- package/dist/plesk-ui-library.min.js.map +1 -1
- package/esm/components/Button/Button.js +17 -98
- package/esm/components/ContentLoader/IconsLoader.js +2 -1
- package/esm/components/Dialog/Dialog.js +4 -113
- package/esm/components/Drawer/Drawer.js +10 -141
- package/esm/components/Drawer/Header.js +5 -10
- package/esm/components/Dropdown/Dropdown.js +4 -40
- package/esm/components/Form/Form.js +2 -1
- package/esm/components/FormFieldPassword/PasswordMeter.js +4 -4
- package/esm/components/Overlay/Overlay.js +4 -3
- package/esm/components/Section/Section.js +2 -1
- package/esm/components/Skeleton/SkeletonText.js +1 -1
- package/esm/index.js +1 -1
- package/esm/utils/types/PolymorphicComponent.js +1 -0
- package/esm/utils/types/index.js +1 -0
- package/package.json +24 -23
- package/styleguide/build/bundle.70f167a3.js +2 -0
- package/styleguide/index.html +2 -2
- package/types/src/components/AutoClosable/AutoClosable.d.ts +2 -2
- package/types/src/components/Button/Button.d.ts +105 -0
- package/types/src/components/Button/index.d.ts +2 -0
- package/types/src/components/Dialog/Dialog.d.ts +126 -0
- package/types/src/components/Dialog/index.d.ts +2 -0
- package/types/src/components/Drawer/Drawer.d.ts +108 -0
- package/types/src/components/Drawer/DrawerProgress.d.ts +1 -1
- package/types/src/components/Drawer/Header.d.ts +28 -0
- package/types/src/components/Drawer/index.d.ts +2 -0
- package/types/src/components/Dropdown/Dropdown.d.ts +54 -0
- package/types/src/components/Form/Form.d.ts +11 -11
- package/types/src/components/Icon/Icon.d.ts +1 -1
- package/types/src/components/Icon/index.d.ts +1 -0
- package/types/src/components/Overlay/Overlay.d.ts +1 -1
- package/types/src/components/Overlay/index.d.ts +1 -0
- package/types/src/components/index.d.ts +3 -0
- package/types/src/utils/types/PolymorphicComponent.d.ts +11 -0
- package/types/src/utils/types/index.d.ts +1 -0
- package/styleguide/build/bundle.ad46084d.js +0 -2
- /package/styleguide/build/{bundle.ad46084d.js.LICENSE.txt → bundle.70f167a3.js.LICENSE.txt} +0 -0
|
@@ -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, forwardRef, isValidElement, useContext, useState } from 'react';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
5
|
import { CLS_PREFIX } from '../../constants';
|
|
7
6
|
import Icon from '../Icon';
|
|
@@ -65,32 +64,27 @@ const renderCaret = _ref2 => {
|
|
|
65
64
|
}
|
|
66
65
|
return caretElement;
|
|
67
66
|
};
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* `Button` component is used for executing actions, changing the application state, opening forms or dialog windows, and submitting data.
|
|
71
|
-
* As a rule, you should not use buttons for navigation between individual pages (use `Link` instead).
|
|
72
|
-
* @since 0.0.37
|
|
73
|
-
*/
|
|
74
67
|
const Button = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
75
68
|
let {
|
|
76
|
-
baseClassName
|
|
69
|
+
baseClassName = `${CLS_PREFIX}button`,
|
|
77
70
|
className,
|
|
78
|
-
component
|
|
71
|
+
component,
|
|
79
72
|
size: propsSize,
|
|
80
73
|
intent,
|
|
81
|
-
ghost,
|
|
74
|
+
ghost = false,
|
|
82
75
|
selected: selectedProp,
|
|
83
76
|
onToggle,
|
|
84
77
|
state,
|
|
85
78
|
icon,
|
|
86
79
|
caret,
|
|
87
|
-
fill,
|
|
80
|
+
fill = false,
|
|
88
81
|
tooltip,
|
|
89
82
|
children,
|
|
90
83
|
arrow,
|
|
91
|
-
disabled,
|
|
84
|
+
disabled = false,
|
|
92
85
|
...props
|
|
93
86
|
} = _ref3;
|
|
87
|
+
const Tag = component || 'button';
|
|
94
88
|
const [selectedState, setSelectedState] = useState(false);
|
|
95
89
|
const handleToggle = () => {
|
|
96
90
|
setSelectedState(!selectedState);
|
|
@@ -130,7 +124,7 @@ const Button = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
130
124
|
}
|
|
131
125
|
const selected = selectedProp === undefined ? selectedState : selectedProp;
|
|
132
126
|
if (selectedProp !== undefined || onToggle) {
|
|
133
|
-
componentProps['aria-pressed'] =
|
|
127
|
+
componentProps['aria-pressed'] = `${selected}`;
|
|
134
128
|
}
|
|
135
129
|
const isArrowButton = arrow === 'forward' || arrow === 'backward';
|
|
136
130
|
const hasAriaDisabled = Tag === 'button' && disabled && tooltip;
|
|
@@ -182,90 +176,8 @@ const Button = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
182
176
|
return button;
|
|
183
177
|
});
|
|
184
178
|
Button.displayName = 'Button';
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
* Button size.
|
|
188
|
-
* @since 2.5.0
|
|
189
|
-
*/
|
|
190
|
-
size: PropTypes.oneOf(['md', 'lg']),
|
|
191
|
-
/**
|
|
192
|
-
* Visual intent color to apply to component.
|
|
193
|
-
* @since 0.0.42
|
|
194
|
-
*/
|
|
195
|
-
intent: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'info']),
|
|
196
|
-
/**
|
|
197
|
-
* Display button with transparent background.
|
|
198
|
-
* @since 2.1.0
|
|
199
|
-
*/
|
|
200
|
-
ghost: PropTypes.bool,
|
|
201
|
-
/**
|
|
202
|
-
* Arrow button.
|
|
203
|
-
* @since 2.6.0
|
|
204
|
-
*/
|
|
205
|
-
arrow: PropTypes.oneOf(['forward', 'backward']),
|
|
206
|
-
/**
|
|
207
|
-
* Selected state of toggle button. Used in controlled component mode.
|
|
208
|
-
* @since 0.0.68
|
|
209
|
-
*/
|
|
210
|
-
selected: PropTypes.bool,
|
|
211
|
-
/**
|
|
212
|
-
* Toggle button callback. Used in uncontrolled component mode.
|
|
213
|
-
* @since 0.0.68
|
|
214
|
-
*/
|
|
215
|
-
onToggle: PropTypes.func,
|
|
216
|
-
/**
|
|
217
|
-
* State of the button
|
|
218
|
-
* @since 0.0.42
|
|
219
|
-
*/
|
|
220
|
-
state: PropTypes.oneOf(['active', 'loading', 'hovered', 'focused']),
|
|
221
|
-
/**
|
|
222
|
-
* Is button disabled?
|
|
223
|
-
* @since 0.0.42
|
|
224
|
-
*/
|
|
225
|
-
disabled: PropTypes.bool,
|
|
226
|
-
/**
|
|
227
|
-
* Tooltip for component
|
|
228
|
-
* @since 0.0.42
|
|
229
|
-
*/
|
|
230
|
-
tooltip: PropTypes.node,
|
|
231
|
-
/**
|
|
232
|
-
* Name of icon or [Icon](#!/Icon) component
|
|
233
|
-
* @since 0.0.42
|
|
234
|
-
*/
|
|
235
|
-
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.element]),
|
|
236
|
-
/**
|
|
237
|
-
* Show caret
|
|
238
|
-
* @since 0.0.42
|
|
239
|
-
*/
|
|
240
|
-
caret: PropTypes.oneOfType([PropTypes.bool, PropTypes.element]),
|
|
241
|
-
/**
|
|
242
|
-
* Dynamically expand the button to fill out the whole available width of its parent container.
|
|
243
|
-
* @since 1.8.0
|
|
244
|
-
*/
|
|
245
|
-
fill: PropTypes.bool,
|
|
246
|
-
/**
|
|
247
|
-
* Content of the button
|
|
248
|
-
* @since 0.0.37
|
|
249
|
-
*/
|
|
250
|
-
children: PropTypes.node,
|
|
251
|
-
/**
|
|
252
|
-
* Component to render as the root element. Useful when rendering a `Button` as `<a>` or `<Link>`.
|
|
253
|
-
* @since 0.0.42
|
|
254
|
-
*/
|
|
255
|
-
component: PropTypes.elementType,
|
|
256
|
-
/**
|
|
257
|
-
* @ignore
|
|
258
|
-
*/
|
|
259
|
-
className: PropTypes.string,
|
|
260
|
-
/**
|
|
261
|
-
* @ignore
|
|
262
|
-
*/
|
|
263
|
-
baseClassName: PropTypes.string,
|
|
264
|
-
/**
|
|
265
|
-
* @ignore
|
|
266
|
-
*/
|
|
267
|
-
onClick: PropTypes.func
|
|
268
|
-
};
|
|
179
|
+
|
|
180
|
+
// For ToolbarMenu backward compatibility purposes
|
|
269
181
|
Button.defaultProps = {
|
|
270
182
|
size: undefined,
|
|
271
183
|
intent: undefined,
|
|
@@ -285,4 +197,11 @@ Button.defaultProps = {
|
|
|
285
197
|
arrow: undefined,
|
|
286
198
|
onClick: undefined
|
|
287
199
|
};
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* `Button` component is used for executing actions, changing the application state, opening forms or dialog windows, and submitting data.
|
|
203
|
+
* As a rule, you should not use buttons for navigation between individual pages (use `Link` instead).
|
|
204
|
+
*
|
|
205
|
+
* Since: 0.0.37
|
|
206
|
+
*/
|
|
288
207
|
export default Button;
|
|
@@ -30,6 +30,7 @@ const useIconCursor = (icons, initialCursor, isSync) => {
|
|
|
30
30
|
return [icons[cursor], targetRef];
|
|
31
31
|
};
|
|
32
32
|
const IconsLoader = _ref => {
|
|
33
|
+
var _icons;
|
|
33
34
|
let {
|
|
34
35
|
baseClassName = `${CLS_PREFIX}icons-loader`,
|
|
35
36
|
className,
|
|
@@ -39,7 +40,7 @@ const IconsLoader = _ref => {
|
|
|
39
40
|
...props
|
|
40
41
|
} = _ref;
|
|
41
42
|
const syncRef = useRef('icon1');
|
|
42
|
-
if (!icons
|
|
43
|
+
if (!((_icons = icons) !== null && _icons !== void 0 && _icons.length)) {
|
|
43
44
|
icons = DEFAULT_ICONS;
|
|
44
45
|
} else if (icons.length === 1) {
|
|
45
46
|
icons = [icons[0], icons[0]];
|
|
@@ -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 { isValidElement, cloneElement, useEffect, useState } from 'react';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
5
|
import { CLS_PREFIX } from '../../constants';
|
|
7
6
|
import Overlay from '../Overlay';
|
|
@@ -68,6 +67,7 @@ const Dialog = _ref => {
|
|
|
68
67
|
return /*#__PURE__*/_jsx("div", {
|
|
69
68
|
className: classPrefix,
|
|
70
69
|
children: /*#__PURE__*/_jsx("img", {
|
|
70
|
+
alt: "",
|
|
71
71
|
className: `${classPrefix}-inner`,
|
|
72
72
|
src: image
|
|
73
73
|
})
|
|
@@ -76,6 +76,7 @@ const Dialog = _ref => {
|
|
|
76
76
|
return /*#__PURE__*/_jsx("div", {
|
|
77
77
|
className: classPrefix,
|
|
78
78
|
children: /*#__PURE__*/_jsx("img", {
|
|
79
|
+
alt: "",
|
|
79
80
|
className: `${classPrefix}-inner`,
|
|
80
81
|
...image
|
|
81
82
|
})
|
|
@@ -165,7 +166,7 @@ const Dialog = _ref => {
|
|
|
165
166
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
166
167
|
className: `${baseClassName}__header-content`,
|
|
167
168
|
children: [isLikeText(title) ? /*#__PURE__*/_jsx(Heading, {
|
|
168
|
-
level:
|
|
169
|
+
level: 2,
|
|
169
170
|
className: `${baseClassName}__title`,
|
|
170
171
|
children: title
|
|
171
172
|
}) : /*#__PURE__*/_jsx("div", {
|
|
@@ -197,116 +198,6 @@ const Dialog = _ref => {
|
|
|
197
198
|
}), closingConfirmationDialog]
|
|
198
199
|
});
|
|
199
200
|
};
|
|
200
|
-
Dialog.propTypes = {
|
|
201
|
-
/**
|
|
202
|
-
* Toggles visibility.
|
|
203
|
-
* @since 0.0.68
|
|
204
|
-
*/
|
|
205
|
-
isOpen: PropTypes.bool,
|
|
206
|
-
/**
|
|
207
|
-
* Banner. Renders in front of content as wide as dialog.
|
|
208
|
-
* @since 0.0.68
|
|
209
|
-
*/
|
|
210
|
-
banner: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.element]),
|
|
211
|
-
/**
|
|
212
|
-
* Block with an image, placed at the side of the component
|
|
213
|
-
* @since 3.25.0
|
|
214
|
-
*/
|
|
215
|
-
sideBanner: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.element]),
|
|
216
|
-
/**
|
|
217
|
-
* Additional properties for the sideBanner
|
|
218
|
-
* @since 3.25.0
|
|
219
|
-
*/
|
|
220
|
-
sideBannerContainer: PropTypes.shape({
|
|
221
|
-
/**
|
|
222
|
-
* Values for css background property
|
|
223
|
-
*/
|
|
224
|
-
background: PropTypes.string,
|
|
225
|
-
/**
|
|
226
|
-
* One of: center, flex-start, flex-end
|
|
227
|
-
*/
|
|
228
|
-
align: PropTypes.oneOf(['center', 'flex-start', 'flex-end'])
|
|
229
|
-
}),
|
|
230
|
-
/**
|
|
231
|
-
* Image. Renders into content.
|
|
232
|
-
* @since 0.0.68
|
|
233
|
-
*/
|
|
234
|
-
image: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.element]),
|
|
235
|
-
/**
|
|
236
|
-
* Title
|
|
237
|
-
* @since 0.0.68
|
|
238
|
-
*/
|
|
239
|
-
title: PropTypes.node,
|
|
240
|
-
/**
|
|
241
|
-
* The subtitle of the `Dialog`.
|
|
242
|
-
* @since 4.0.0
|
|
243
|
-
*/
|
|
244
|
-
subtitle: PropTypes.node,
|
|
245
|
-
/**
|
|
246
|
-
* Title of "cancel" button
|
|
247
|
-
* @since 0.0.68
|
|
248
|
-
* @deprecated Use `cancelButton` instead.
|
|
249
|
-
*/
|
|
250
|
-
cancelTitle: PropTypes.node,
|
|
251
|
-
/**
|
|
252
|
-
* Cancel button visibility or custom configuration. It accepts all props of the `Button` component.
|
|
253
|
-
* @since 3.13.0
|
|
254
|
-
*/
|
|
255
|
-
cancelButton: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
|
|
256
|
-
/**
|
|
257
|
-
* Buttons except "cancel" button
|
|
258
|
-
* @since 0.0.68
|
|
259
|
-
*/
|
|
260
|
-
buttons: PropTypes.node,
|
|
261
|
-
/**
|
|
262
|
-
* Actions which will be shown in Dialog header
|
|
263
|
-
* @since 1.2.0
|
|
264
|
-
*/
|
|
265
|
-
actions: PropTypes.node,
|
|
266
|
-
/**
|
|
267
|
-
* Wraps children into [Form](#!/Form) if not empty.
|
|
268
|
-
* @since 0.0.68
|
|
269
|
-
*/
|
|
270
|
-
form: PropTypes.oneOfType([PropTypes.object, PropTypes.element]),
|
|
271
|
-
/**
|
|
272
|
-
* Dialog width
|
|
273
|
-
* @since 0.0.68
|
|
274
|
-
*/
|
|
275
|
-
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),
|
|
276
|
-
/**
|
|
277
|
-
* If the value is false, the dialog cannot be closed and the Close button is hidden.
|
|
278
|
-
* @since 1.2.0
|
|
279
|
-
*/
|
|
280
|
-
closable: PropTypes.bool,
|
|
281
|
-
/**
|
|
282
|
-
* Disable close dialog button
|
|
283
|
-
* @since 4.0.0
|
|
284
|
-
*/
|
|
285
|
-
canClose: PropTypes.bool,
|
|
286
|
-
/**
|
|
287
|
-
* On close event handler. Called immediately after dialog closed by "cancel" button or "Esc" key.
|
|
288
|
-
* @since 0.0.68
|
|
289
|
-
*/
|
|
290
|
-
onClose: PropTypes.func,
|
|
291
|
-
/**
|
|
292
|
-
* Whether show or not a confirmation dialog on close.
|
|
293
|
-
* @since 3.21.0
|
|
294
|
-
*/
|
|
295
|
-
closingConfirmation: PropTypes.bool,
|
|
296
|
-
/**
|
|
297
|
-
* Content of the `DialogWindow`.
|
|
298
|
-
* @since 0.0.68
|
|
299
|
-
*/
|
|
300
|
-
children: PropTypes.node,
|
|
301
|
-
/**
|
|
302
|
-
* @ignore
|
|
303
|
-
*/
|
|
304
|
-
className: PropTypes.string,
|
|
305
|
-
/**
|
|
306
|
-
* @ignore
|
|
307
|
-
*/
|
|
308
|
-
baseClassName: PropTypes.string
|
|
309
|
-
};
|
|
310
201
|
Dialog.defaultProps = {
|
|
311
202
|
isOpen: false,
|
|
312
203
|
banner: undefined,
|
|
@@ -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 { Fragment, isValidElement, cloneElement, useRef, useState } from 'react';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
5
|
import { CLS_PREFIX } from '../../constants';
|
|
7
6
|
import Overlay from '../Overlay';
|
|
@@ -14,153 +13,24 @@ import ScrollableElementFormContext from '../Form/ScrollableElementFormContext';
|
|
|
14
13
|
import DrawerProgress from './DrawerProgress';
|
|
15
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
const propTypes = {
|
|
18
|
-
/**
|
|
19
|
-
* Toggles visibility.
|
|
20
|
-
* @since 0.0.65
|
|
21
|
-
*/
|
|
22
|
-
isOpen: PropTypes.bool,
|
|
23
|
-
/**
|
|
24
|
-
* The title of the `Drawer`.
|
|
25
|
-
* @since 0.0.65
|
|
26
|
-
*/
|
|
27
|
-
title: PropTypes.node.isRequired,
|
|
28
|
-
/**
|
|
29
|
-
* The subtitle of the `Drawer`.
|
|
30
|
-
* @since 0.0.65
|
|
31
|
-
*/
|
|
32
|
-
subtitle: PropTypes.node,
|
|
33
|
-
/**
|
|
34
|
-
* Show the minimize button and the inactive close button.
|
|
35
|
-
* @since 1.4.1
|
|
36
|
-
*/
|
|
37
|
-
hideButton: PropTypes.bool,
|
|
38
|
-
/**
|
|
39
|
-
* Show back button in the header. If true the close button is not show.
|
|
40
|
-
* @deprecated Not recommended to use. Use default close button instead.
|
|
41
|
-
* @since 0.0.65
|
|
42
|
-
*/
|
|
43
|
-
backButton: PropTypes.bool,
|
|
44
|
-
/**
|
|
45
|
-
* A slot for `Tabs` component.
|
|
46
|
-
* @since 3.26.0
|
|
47
|
-
*/
|
|
48
|
-
tabs: PropTypes.node,
|
|
49
|
-
/**
|
|
50
|
-
* Overlay placement.
|
|
51
|
-
* @since 0.0.65
|
|
52
|
-
*/
|
|
53
|
-
placement: PropTypes.oneOf(['left', 'right']),
|
|
54
|
-
/**
|
|
55
|
-
* Overlay size.
|
|
56
|
-
* @since 0.0.65
|
|
57
|
-
*/
|
|
58
|
-
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),
|
|
59
|
-
/**
|
|
60
|
-
* onClose handler.
|
|
61
|
-
* @since 0.0.65
|
|
62
|
-
*/
|
|
63
|
-
onClose: PropTypes.func,
|
|
64
|
-
/**
|
|
65
|
-
* Whether show or not a confirmation dialog on close.
|
|
66
|
-
* @since 3.21.0
|
|
67
|
-
*/
|
|
68
|
-
closingConfirmation: PropTypes.bool,
|
|
69
|
-
/**
|
|
70
|
-
* Wraps children into [Form](#!/Form) if not empty.<br>
|
|
71
|
-
* **Note:** in case of *element* you should take care of providing additional form props from [Drawer](#!/Drawer) through your custom component. See example below for more details
|
|
72
|
-
*
|
|
73
|
-
* @since 0.0.66
|
|
74
|
-
*/
|
|
75
|
-
form: PropTypes.oneOfType([PropTypes.object, PropTypes.element]),
|
|
76
|
-
/**
|
|
77
|
-
* Block with an image, placed at the side of the component
|
|
78
|
-
* @since 3.25.0
|
|
79
|
-
*/
|
|
80
|
-
sideBanner: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.element]),
|
|
81
|
-
/**
|
|
82
|
-
* Additional properties for the sideBanner
|
|
83
|
-
* @since 3.25.0
|
|
84
|
-
*/
|
|
85
|
-
sideBannerContainer: PropTypes.shape({
|
|
86
|
-
/**
|
|
87
|
-
* Values for css background property
|
|
88
|
-
*/
|
|
89
|
-
background: PropTypes.string,
|
|
90
|
-
/**
|
|
91
|
-
* One of: center, flex-start, flex-end
|
|
92
|
-
*/
|
|
93
|
-
align: PropTypes.oneOf(['center', 'flex-start', 'flex-end'])
|
|
94
|
-
}),
|
|
95
|
-
/**
|
|
96
|
-
* Content of the `Drawer`.
|
|
97
|
-
* @since 0.0.65
|
|
98
|
-
*/
|
|
99
|
-
children: PropTypes.node,
|
|
100
|
-
/**
|
|
101
|
-
* Adds [Progress](#!/Progress) into footer.
|
|
102
|
-
* @since 1.11.0
|
|
103
|
-
*/
|
|
104
|
-
progress: PropTypes.shape({
|
|
105
|
-
/**
|
|
106
|
-
* A title for the progress.
|
|
107
|
-
*/
|
|
108
|
-
title: PropTypes.string,
|
|
109
|
-
/**
|
|
110
|
-
* An array of [ProgressStep](#!/ProgressStep) props.
|
|
111
|
-
*/
|
|
112
|
-
steps: PropTypes.arrayOf(PropTypes.shape({
|
|
113
|
-
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
114
|
-
status: PropTypes.string,
|
|
115
|
-
progress: PropTypes.number,
|
|
116
|
-
icon: PropTypes.string
|
|
117
|
-
})).isRequired,
|
|
118
|
-
/**
|
|
119
|
-
* An option that controls drawer closing ability.
|
|
120
|
-
*/
|
|
121
|
-
cancelable: PropTypes.bool,
|
|
122
|
-
/**
|
|
123
|
-
* On overall status event handler.
|
|
124
|
-
* @since 3.8.0
|
|
125
|
-
*/
|
|
126
|
-
onStatusChange: PropTypes.func,
|
|
127
|
-
/**
|
|
128
|
-
* @ignore
|
|
129
|
-
*/
|
|
130
|
-
onClose: PropTypes.func,
|
|
131
|
-
/**
|
|
132
|
-
* @ignore
|
|
133
|
-
*/
|
|
134
|
-
onClosableChange: PropTypes.func
|
|
135
|
-
}),
|
|
136
|
-
/**
|
|
137
|
-
* @ignore
|
|
138
|
-
*/
|
|
139
|
-
className: PropTypes.string,
|
|
140
|
-
/**
|
|
141
|
-
* @ignore
|
|
142
|
-
*/
|
|
143
|
-
baseClassName: PropTypes.string
|
|
144
|
-
};
|
|
145
16
|
const defaultProps = {
|
|
146
17
|
isOpen: false,
|
|
147
|
-
subtitle:
|
|
18
|
+
subtitle: undefined,
|
|
148
19
|
backButton: undefined,
|
|
149
20
|
hideButton: undefined,
|
|
150
21
|
tabs: undefined,
|
|
151
22
|
placement: 'left',
|
|
152
23
|
size: 'md',
|
|
153
|
-
onClose:
|
|
24
|
+
onClose: undefined,
|
|
154
25
|
closingConfirmation: undefined,
|
|
155
|
-
form:
|
|
26
|
+
form: undefined,
|
|
156
27
|
sideBanner: undefined,
|
|
157
28
|
sideBannerContainer: undefined,
|
|
158
|
-
progress:
|
|
29
|
+
progress: undefined,
|
|
159
30
|
children: null,
|
|
160
|
-
className:
|
|
31
|
+
className: undefined,
|
|
161
32
|
baseClassName: `${CLS_PREFIX}drawer`
|
|
162
33
|
};
|
|
163
|
-
|
|
164
34
|
/**
|
|
165
35
|
* `Drawer` component is used for working with properties of an object (or system) without leaving the context of the object.
|
|
166
36
|
* [Read more when to use Drawer](#!/Drawers%2C%20pages%2C%20popovers).
|
|
@@ -182,7 +52,7 @@ const Drawer = _ref => {
|
|
|
182
52
|
closingConfirmation,
|
|
183
53
|
...props
|
|
184
54
|
} = _ref;
|
|
185
|
-
const scrollableRef = useRef();
|
|
55
|
+
const scrollableRef = useRef(null);
|
|
186
56
|
const [isClosable, setIsClosable] = useState(true);
|
|
187
57
|
const {
|
|
188
58
|
onCloseWithConfirmation,
|
|
@@ -219,7 +89,7 @@ const Drawer = _ref => {
|
|
|
219
89
|
className: classNames(`${baseClassName}__form`, form.props.className),
|
|
220
90
|
cancelButton: form.props.cancelButton === false ? false : {
|
|
221
91
|
onClick: onCloseWithConfirmation,
|
|
222
|
-
...form.props.cancelButton
|
|
92
|
+
...(typeof form.props.cancelButton === 'object' && form.props.cancelButton)
|
|
223
93
|
},
|
|
224
94
|
render: _ref3 => {
|
|
225
95
|
let {
|
|
@@ -238,7 +108,7 @@ const Drawer = _ref => {
|
|
|
238
108
|
if (form.cancelButton !== false) {
|
|
239
109
|
form.cancelButton = {
|
|
240
110
|
onClick: onCloseWithConfirmation,
|
|
241
|
-
...form.cancelButton
|
|
111
|
+
...(typeof form.cancelButton === 'object' && form.cancelButton)
|
|
242
112
|
};
|
|
243
113
|
}
|
|
244
114
|
return /*#__PURE__*/_jsx(Form, {
|
|
@@ -283,7 +153,7 @@ const Drawer = _ref => {
|
|
|
283
153
|
onClose: onCloseWithConfirmation,
|
|
284
154
|
tabs: tabs,
|
|
285
155
|
children: [isLikeText(title) ? /*#__PURE__*/_jsx(Heading, {
|
|
286
|
-
level:
|
|
156
|
+
level: 2,
|
|
287
157
|
className: `${baseClassName}__title`,
|
|
288
158
|
children: title
|
|
289
159
|
}) : /*#__PURE__*/_jsx("div", {
|
|
@@ -311,6 +181,5 @@ const Drawer = _ref => {
|
|
|
311
181
|
}), closingConfirmationDialog]
|
|
312
182
|
});
|
|
313
183
|
};
|
|
314
|
-
Drawer.propTypes = propTypes;
|
|
315
184
|
Drawer.defaultProps = defaultProps;
|
|
316
185
|
export default Drawer;
|
|
@@ -2,8 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
3
3
|
|
|
4
4
|
import { isRtl } from '../../utils';
|
|
5
|
-
import
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
5
|
+
import { Component } from 'react';
|
|
7
6
|
import classNames from 'classnames';
|
|
8
7
|
import { CLS_PREFIX } from '../../constants';
|
|
9
8
|
import Button from '../Button';
|
|
@@ -11,6 +10,10 @@ import Icon from '../Icon';
|
|
|
11
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
12
|
export default class Header extends Component {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
_defineProperty(this, "isRtl", false);
|
|
16
|
+
}
|
|
14
17
|
componentDidMount() {
|
|
15
18
|
this.isRtl = isRtl();
|
|
16
19
|
}
|
|
@@ -119,14 +122,6 @@ export default class Header extends Component {
|
|
|
119
122
|
});
|
|
120
123
|
}
|
|
121
124
|
}
|
|
122
|
-
_defineProperty(Header, "propTypes", {
|
|
123
|
-
baseClassName: PropTypes.string,
|
|
124
|
-
onClose: PropTypes.func,
|
|
125
|
-
children: PropTypes.node.isRequired,
|
|
126
|
-
backButton: PropTypes.bool,
|
|
127
|
-
hideButton: PropTypes.bool,
|
|
128
|
-
tabs: PropTypes.node
|
|
129
|
-
});
|
|
130
125
|
_defineProperty(Header, "defaultProps", {
|
|
131
126
|
onClose: null,
|
|
132
127
|
baseClassName: `${CLS_PREFIX}drawer-header`,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
2
2
|
|
|
3
3
|
import { isRtl } from '../../utils';
|
|
4
|
-
import
|
|
4
|
+
import { cloneElement, isValidElement, useState, useEffect, useRef } from 'react';
|
|
5
5
|
import { wrapFunction } from '../utils';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
6
|
import classNames from 'classnames';
|
|
8
7
|
import { CLS_PREFIX, Z_INDEX_DROPDOWN, Z_INDEX_OVERLAY } from '../../constants';
|
|
9
8
|
import Button from '../Button';
|
|
@@ -13,6 +12,8 @@ import Layer from '../Layer';
|
|
|
13
12
|
import { MenuItem, MenuDivider } from '../Menu';
|
|
14
13
|
import Translate from '../Translate';
|
|
15
14
|
import localeFallback from './locale/en-US';
|
|
15
|
+
|
|
16
|
+
// TODO: move to Popover
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -21,7 +22,7 @@ const createTarget = (node, _ref) => {
|
|
|
21
22
|
onToggle,
|
|
22
23
|
targetRef
|
|
23
24
|
} = _ref;
|
|
24
|
-
if (
|
|
25
|
+
if (!( /*#__PURE__*/isValidElement(node) && node.type !== Translate)) {
|
|
25
26
|
node = /*#__PURE__*/_jsx(Button, {
|
|
26
27
|
caret: true,
|
|
27
28
|
children: node
|
|
@@ -202,43 +203,6 @@ const Dropdown = _ref3 => {
|
|
|
202
203
|
})
|
|
203
204
|
});
|
|
204
205
|
};
|
|
205
|
-
Dropdown.propTypes = {
|
|
206
|
-
/**
|
|
207
|
-
* Dropdown [menu](#!/Menu).
|
|
208
|
-
* @since 0.0.57
|
|
209
|
-
*/
|
|
210
|
-
menu: PropTypes.element.isRequired,
|
|
211
|
-
/**
|
|
212
|
-
* Menu placement.
|
|
213
|
-
* @since 0.0.60
|
|
214
|
-
*/
|
|
215
|
-
menuPlacement: PropTypes.string,
|
|
216
|
-
/**
|
|
217
|
-
* Content of the `Dropdown`.
|
|
218
|
-
* @since 0.0.57
|
|
219
|
-
*/
|
|
220
|
-
children: PropTypes.node,
|
|
221
|
-
/**
|
|
222
|
-
* Custom localization messages.
|
|
223
|
-
* @since 3.6.0
|
|
224
|
-
*/
|
|
225
|
-
locale: PropTypes.shape({
|
|
226
|
-
close: PropTypes.node
|
|
227
|
-
}),
|
|
228
|
-
/**
|
|
229
|
-
* Display menu as overlay.
|
|
230
|
-
* @ignore
|
|
231
|
-
*/
|
|
232
|
-
overlay: PropTypes.bool,
|
|
233
|
-
/**
|
|
234
|
-
* @ignore
|
|
235
|
-
*/
|
|
236
|
-
className: PropTypes.string,
|
|
237
|
-
/**
|
|
238
|
-
* @ignore
|
|
239
|
-
*/
|
|
240
|
-
baseClassName: PropTypes.string
|
|
241
|
-
};
|
|
242
206
|
Dropdown.defaultProps = {
|
|
243
207
|
menuPlacement: 'bottom-start',
|
|
244
208
|
children: undefined,
|
|
@@ -399,7 +399,8 @@ const RefForwardingForm = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
399
399
|
const innerRef = useRef(null);
|
|
400
400
|
useImperativeHandle(ref, () => ({
|
|
401
401
|
submit() {
|
|
402
|
-
|
|
402
|
+
var _innerRef$current;
|
|
403
|
+
(_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.dispatchEvent(new Event('submit', {
|
|
403
404
|
cancelable: true,
|
|
404
405
|
bubbles: true
|
|
405
406
|
}));
|
|
@@ -40,19 +40,19 @@ const PasswordMeter = _ref => {
|
|
|
40
40
|
canCloseOnOutsideClick: false,
|
|
41
41
|
canCloseOnEscapePress: false,
|
|
42
42
|
...props,
|
|
43
|
-
children: [result
|
|
43
|
+
children: [result !== null && result !== void 0 && result.strength ? /*#__PURE__*/_jsx(Translate, {
|
|
44
44
|
component: "div",
|
|
45
45
|
content: "FormFieldPassword.passwordStrength",
|
|
46
46
|
fallback: locale.passwordStrength,
|
|
47
47
|
params: {
|
|
48
48
|
strength: /*#__PURE__*/_jsx("b", {
|
|
49
49
|
children: /*#__PURE__*/_jsx(Translate, {
|
|
50
|
-
content: `FormFieldPassword.strength${result
|
|
51
|
-
fallback: locale[`strength${result
|
|
50
|
+
content: `FormFieldPassword.strength${result === null || result === void 0 ? void 0 : result.strength}`,
|
|
51
|
+
fallback: locale[`strength${result === null || result === void 0 ? void 0 : result.strength}`]
|
|
52
52
|
})
|
|
53
53
|
})
|
|
54
54
|
}
|
|
55
|
-
}) : null, result
|
|
55
|
+
}) : null, result !== null && result !== void 0 && result.suggestions.length ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
56
56
|
children: [/*#__PURE__*/_jsx(Translate, {
|
|
57
57
|
content: "FormFieldPassword.improvePassword",
|
|
58
58
|
fallback: locale.improvePassword
|