@plesk/ui-library 3.28.0 → 3.28.3
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 +6 -2
- package/cjs/components/Button/Button.js +13 -6
- package/cjs/components/Form/Form.js +3 -0
- package/cjs/components/FormField/FormField.js +8 -1
- package/cjs/components/FormFieldText/FormFieldText.js +13 -5
- package/cjs/components/InputFile/InputFile.js +4 -2
- package/cjs/components/List/List.js +1 -6
- package/cjs/components/Overlay/Overlay.js +0 -2
- package/cjs/components/Select/Select.js +3 -3
- package/cjs/components/index.js +10 -1
- 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 +61 -28
- package/dist/plesk-ui-library.js.map +1 -1
- package/dist/plesk-ui-library.min.js +2 -2
- package/dist/plesk-ui-library.min.js.map +1 -1
- package/esm/components/AutoClosable/AutoClosable.js +6 -2
- package/esm/components/Button/Button.js +14 -7
- package/esm/components/Form/Form.js +3 -0
- package/esm/components/FormField/FormField.js +8 -1
- package/esm/components/FormFieldText/FormFieldText.js +13 -5
- package/esm/components/InputFile/InputFile.js +4 -2
- package/esm/components/List/List.js +1 -6
- package/esm/components/Overlay/Overlay.js +0 -2
- package/esm/components/Select/Select.js +3 -3
- package/esm/components/index.js +2 -1
- package/esm/index.js +1 -1
- package/package.json +1 -1
- package/styleguide/build/bundle.3b7e4d37.js +2 -0
- package/styleguide/build/{bundle.24d5b0eb.js.LICENSE.txt → bundle.3b7e4d37.js.LICENSE.txt} +0 -0
- package/styleguide/index.html +2 -2
- package/types/src/components/Form/Form.d.ts +7 -136
- package/types/src/components/Form/FormContext.d.ts +2 -14
- package/types/src/components/Form/types.d.ts +125 -0
- package/types/src/components/FormFieldPassword/FormFieldPassword.d.ts +2 -2
- package/types/src/components/InputFile/InputFile.d.ts +6 -1
- package/types/src/components/TextArea/TextArea.d.ts +2 -2
- package/types/src/components/index.d.ts +1 -0
- package/styleguide/build/bundle.24d5b0eb.js +0 -2
|
@@ -67,7 +67,9 @@ class AutoClosable extends Component {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
componentDidMount() {
|
|
70
|
-
document.body.addEventListener('click', this.onOutsideClick
|
|
70
|
+
document.body.addEventListener('click', this.onOutsideClick, {
|
|
71
|
+
capture: true
|
|
72
|
+
});
|
|
71
73
|
|
|
72
74
|
if (this.context) {
|
|
73
75
|
this.context.addChild(this);
|
|
@@ -75,7 +77,9 @@ class AutoClosable extends Component {
|
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
componentWillUnmount() {
|
|
78
|
-
document.body.removeEventListener('click', this.onOutsideClick
|
|
80
|
+
document.body.removeEventListener('click', this.onOutsideClick, {
|
|
81
|
+
capture: true
|
|
82
|
+
});
|
|
79
83
|
|
|
80
84
|
if (this.context) {
|
|
81
85
|
this.context.removeChild(this);
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
// Copyright 1999-2020. Plesk International GmbH. All rights reserved.
|
|
3
3
|
|
|
4
4
|
/* eslint-disable react/no-deprecated */
|
|
5
|
-
import React, { cloneElement, isValidElement, useContext, useState } from 'react';
|
|
5
|
+
import React, { cloneElement, forwardRef, isValidElement, useContext, useState } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import { CLS_PREFIX } from '../../constants';
|
|
@@ -72,7 +72,7 @@ const renderCaret = ({
|
|
|
72
72
|
*/
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
const Button = ({
|
|
75
|
+
const Button = /*#__PURE__*/forwardRef(({
|
|
76
76
|
baseClassName,
|
|
77
77
|
className,
|
|
78
78
|
component: Tag,
|
|
@@ -90,7 +90,7 @@ const Button = ({
|
|
|
90
90
|
arrow,
|
|
91
91
|
disabled,
|
|
92
92
|
...props
|
|
93
|
-
}) => {
|
|
93
|
+
}, ref) => {
|
|
94
94
|
const [selectedState, setSelectedState] = useState(false);
|
|
95
95
|
|
|
96
96
|
const handleToggle = () => {
|
|
@@ -145,6 +145,7 @@ const Button = ({
|
|
|
145
145
|
const isArrowButton = arrow === 'forward' || arrow === 'backward';
|
|
146
146
|
const hasAriaDisabled = Tag === 'button' && disabled && tooltip;
|
|
147
147
|
let button = /*#__PURE__*/React.createElement(Tag, _extends({
|
|
148
|
+
ref: ref,
|
|
148
149
|
className: classNames(baseClassName, {
|
|
149
150
|
[`${baseClassName}--${size}`]: size,
|
|
150
151
|
[`${baseClassName}--${intent}`]: intent && !ghost,
|
|
@@ -184,8 +185,8 @@ const Button = ({
|
|
|
184
185
|
}
|
|
185
186
|
|
|
186
187
|
return button;
|
|
187
|
-
};
|
|
188
|
-
|
|
188
|
+
});
|
|
189
|
+
Button.displayName = 'Button';
|
|
189
190
|
Button.propTypes = {
|
|
190
191
|
/**
|
|
191
192
|
* Button size.
|
|
@@ -279,7 +280,12 @@ Button.propTypes = {
|
|
|
279
280
|
/**
|
|
280
281
|
* @ignore
|
|
281
282
|
*/
|
|
282
|
-
baseClassName: PropTypes.string
|
|
283
|
+
baseClassName: PropTypes.string,
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* @ignore
|
|
287
|
+
*/
|
|
288
|
+
onClick: PropTypes.func
|
|
283
289
|
};
|
|
284
290
|
Button.defaultProps = {
|
|
285
291
|
size: undefined,
|
|
@@ -297,6 +303,7 @@ Button.defaultProps = {
|
|
|
297
303
|
component: 'button',
|
|
298
304
|
className: undefined,
|
|
299
305
|
baseClassName: `${CLS_PREFIX}button`,
|
|
300
|
-
arrow: undefined
|
|
306
|
+
arrow: undefined,
|
|
307
|
+
onClick: undefined
|
|
301
308
|
};
|
|
302
309
|
export default Button;
|
|
@@ -26,6 +26,9 @@ class Form extends Component {
|
|
|
26
26
|
vertical: this.props.vertical || false,
|
|
27
27
|
requiredFields: [],
|
|
28
28
|
formContext: {
|
|
29
|
+
getValues: () => {
|
|
30
|
+
return this.state.values;
|
|
31
|
+
},
|
|
29
32
|
getValue: (name, def) => {
|
|
30
33
|
if (this.state.values) {
|
|
31
34
|
return getIn(this.state.values, name, def);
|
|
@@ -199,7 +199,7 @@ class FormField extends Component {
|
|
|
199
199
|
multi
|
|
200
200
|
} = this.props;
|
|
201
201
|
|
|
202
|
-
if (!description || multi && this.
|
|
202
|
+
if (!description || multi && this.fieldApi.getValue().length - 1 > index) {
|
|
203
203
|
return null;
|
|
204
204
|
}
|
|
205
205
|
|
|
@@ -311,6 +311,13 @@ class FormField extends Component {
|
|
|
311
311
|
return null;
|
|
312
312
|
},
|
|
313
313
|
getName: () => this.props.name,
|
|
314
|
+
getValues: () => {
|
|
315
|
+
if (this.props.form) {
|
|
316
|
+
return this.props.form.getValues();
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return null;
|
|
320
|
+
},
|
|
314
321
|
getValue: def => {
|
|
315
322
|
if (this.props.form && this.props.name) {
|
|
316
323
|
return this.props.form.getValue(this.props.name, def);
|
|
@@ -28,6 +28,7 @@ class FormFieldText extends Component {
|
|
|
28
28
|
autoFocus,
|
|
29
29
|
autoComplete,
|
|
30
30
|
autoheight,
|
|
31
|
+
inputProps,
|
|
31
32
|
...props
|
|
32
33
|
} = this.props;
|
|
33
34
|
return /*#__PURE__*/React.createElement(FormField, _extends({
|
|
@@ -40,7 +41,7 @@ class FormFieldText extends Component {
|
|
|
40
41
|
getValue,
|
|
41
42
|
setValue,
|
|
42
43
|
isDisabled
|
|
43
|
-
}) => multiline ? /*#__PURE__*/React.createElement(TextArea, {
|
|
44
|
+
}) => multiline ? /*#__PURE__*/React.createElement(TextArea, _extends({
|
|
44
45
|
id: getId(),
|
|
45
46
|
name: getName(),
|
|
46
47
|
value: getValue(''),
|
|
@@ -52,7 +53,7 @@ class FormFieldText extends Component {
|
|
|
52
53
|
autoFocus: autoFocus,
|
|
53
54
|
autoComplete: autoComplete,
|
|
54
55
|
autoheight: autoheight
|
|
55
|
-
}) : /*#__PURE__*/React.createElement(Input, {
|
|
56
|
+
}, inputProps)) : /*#__PURE__*/React.createElement(Input, _extends({
|
|
56
57
|
id: getId(),
|
|
57
58
|
name: getName(),
|
|
58
59
|
className: `${baseClassName}__input`,
|
|
@@ -63,7 +64,7 @@ class FormFieldText extends Component {
|
|
|
63
64
|
placeholder: placeholder,
|
|
64
65
|
autoFocus: autoFocus,
|
|
65
66
|
autoComplete: autoComplete
|
|
66
|
-
}));
|
|
67
|
+
}, inputProps)));
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
}
|
|
@@ -134,7 +135,13 @@ FormFieldText.propTypes = {
|
|
|
134
135
|
* Adjust height automatically when multiline option is set to true.
|
|
135
136
|
* @since 1.9.0
|
|
136
137
|
*/
|
|
137
|
-
autoheight: PropTypes.bool
|
|
138
|
+
autoheight: PropTypes.bool,
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Props of underlying input element.
|
|
142
|
+
* @since 3.28.1
|
|
143
|
+
*/
|
|
144
|
+
inputProps: PropTypes.object
|
|
138
145
|
};
|
|
139
146
|
FormFieldText.defaultProps = {
|
|
140
147
|
size: undefined,
|
|
@@ -147,6 +154,7 @@ FormFieldText.defaultProps = {
|
|
|
147
154
|
multi: undefined,
|
|
148
155
|
className: undefined,
|
|
149
156
|
baseClassName: `${CLS_PREFIX}form-field-text`,
|
|
150
|
-
autoheight: false
|
|
157
|
+
autoheight: false,
|
|
158
|
+
inputProps: undefined
|
|
151
159
|
};
|
|
152
160
|
export default FormFieldText;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
// Copyright 1999-
|
|
2
|
+
// Copyright 1999-2022. Plesk International GmbH. All rights reserved.
|
|
3
3
|
import React, { useState, useRef, useEffect } from 'react';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { CLS_PREFIX } from '../../constants';
|
|
@@ -24,6 +24,7 @@ const InputFile = ({
|
|
|
24
24
|
disabled = false,
|
|
25
25
|
locale,
|
|
26
26
|
testId,
|
|
27
|
+
accept,
|
|
27
28
|
...props
|
|
28
29
|
}) => {
|
|
29
30
|
const [file, setFile] = useState();
|
|
@@ -81,7 +82,8 @@ const InputFile = ({
|
|
|
81
82
|
ref: inputRef,
|
|
82
83
|
"data-test": testId && `${testId}--file-input`,
|
|
83
84
|
onFocus: handleFocus,
|
|
84
|
-
onBlur: handleBlur
|
|
85
|
+
onBlur: handleBlur,
|
|
86
|
+
accept: accept
|
|
85
87
|
}), /*#__PURE__*/React.createElement(Translate, {
|
|
86
88
|
namespace: "InputFile",
|
|
87
89
|
content: "browseButton",
|
|
@@ -875,14 +875,9 @@ class List extends Component {
|
|
|
875
875
|
|
|
876
876
|
if (totalRows && /*#__PURE__*/isValidElement(pagination)) {
|
|
877
877
|
const {
|
|
878
|
-
itemsPerPageOptions = ITEMS_PER_PAGE_OPTIONS
|
|
879
|
-
itemsPerPage
|
|
878
|
+
itemsPerPageOptions = ITEMS_PER_PAGE_OPTIONS
|
|
880
879
|
} = pagination.props;
|
|
881
880
|
|
|
882
|
-
if (Number.isInteger(itemsPerPage)) {
|
|
883
|
-
return totalRows > itemsPerPage;
|
|
884
|
-
}
|
|
885
|
-
|
|
886
881
|
if (Array.isArray(itemsPerPageOptions)) {
|
|
887
882
|
const numericOptions = itemsPerPageOptions.filter(v => Number(v) === v);
|
|
888
883
|
|
|
@@ -172,8 +172,8 @@ const Select = ({
|
|
|
172
172
|
|
|
173
173
|
if (filterValue) {
|
|
174
174
|
const lowerFilterValue = filterValue.toLowerCase();
|
|
175
|
-
groupFns.push(group => !!group.label && group.label.toLowerCase().
|
|
176
|
-
optionFns.push(option => option.label.toLowerCase().
|
|
175
|
+
groupFns.push(group => !!group.label && group.label.toLowerCase().includes(lowerFilterValue));
|
|
176
|
+
optionFns.push(option => option.label.toLowerCase().includes(lowerFilterValue));
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
if (groupFns.length || optionFns.length) {
|
|
@@ -253,7 +253,7 @@ const Select = ({
|
|
|
253
253
|
|
|
254
254
|
const handleHighlightSearch = query => {
|
|
255
255
|
const lowerQuery = query.toLowerCase();
|
|
256
|
-
const index = options.findIndex(o => !o.disabled && o.label.toLowerCase().
|
|
256
|
+
const index = options.findIndex(o => !o.disabled && o.label.toLowerCase().includes(lowerQuery));
|
|
257
257
|
|
|
258
258
|
if (index !== -1) {
|
|
259
259
|
setHighlightedIndex(index);
|
package/esm/components/index.js
CHANGED
|
@@ -98,4 +98,5 @@ export { default as Tour } from './Tour';
|
|
|
98
98
|
export { default as Translate } from './Translate';
|
|
99
99
|
export { default as Link } from './Link';
|
|
100
100
|
export { default as Skeleton } from './Skeleton';
|
|
101
|
-
export * from './Skeleton';
|
|
101
|
+
export * from './Skeleton';
|
|
102
|
+
export { PortalContext } from './Layer';
|
package/esm/index.js
CHANGED