@plesk/ui-library 3.34.1 → 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/Drawer/Drawer.js +10 -143
- package/cjs/components/Drawer/Header.js +5 -12
- package/cjs/components/index.js +2 -30
- package/cjs/index.js +1 -1
- package/dist/plesk-ui-library-rtl.css.map +1 -1
- package/dist/plesk-ui-library.css.map +1 -1
- package/dist/plesk-ui-library.js +33 -201
- 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/Drawer/Drawer.js +10 -141
- package/esm/components/Drawer/Header.js +5 -10
- package/esm/components/index.js +2 -2
- package/esm/index.js +1 -1
- package/package.json +1 -1
- package/styleguide/build/bundle.70f167a3.js +2 -0
- package/styleguide/index.html +2 -2
- package/types/src/components/Button/Button.d.ts +4 -1
- package/types/src/components/Dialog/Dialog.d.ts +4 -1
- 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/Form/Form.d.ts +3 -3
- package/types/src/components/index.d.ts +5 -2
- package/dist/.DS_Store +0 -0
- package/dist/images/default.svg +0 -1
- package/dist/images/filtered.svg +0 -1
- package/styleguide/build/bundle.c6ebacd7.js +0 -2
- /package/styleguide/build/{bundle.c6ebacd7.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 { 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`,
|
package/esm/components/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export { default as AutoClosable } from './AutoClosable';
|
|
|
6
6
|
export { default as AuxiliaryActions } from './AuxiliaryActions';
|
|
7
7
|
export { default as Badge } from './Badge';
|
|
8
8
|
export { default as Breadcrumbs } from './Breadcrumbs';
|
|
9
|
-
export { default as Button
|
|
9
|
+
export { default as Button } from './Button';
|
|
10
10
|
export { default as ButtonGroup } from './ButtonGroup';
|
|
11
11
|
export { default as Card } from './Card';
|
|
12
12
|
export * from './Card';
|
|
@@ -42,7 +42,7 @@ export { default as Grid } from './Grid';
|
|
|
42
42
|
export { default as GridCol } from './GridCol';
|
|
43
43
|
export { default as Heading } from './Heading';
|
|
44
44
|
export { default as Hint } from './Hint';
|
|
45
|
-
export { default as Icon
|
|
45
|
+
export { default as Icon } from './Icon';
|
|
46
46
|
export { default as Input } from './Input';
|
|
47
47
|
export { default as InputFile } from './InputFile';
|
|
48
48
|
export { default as InputNumber } from './InputNumber';
|
package/esm/index.js
CHANGED