@plesk/ui-library 3.39.0 → 3.40.1
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 +4 -22
- package/cjs/components/Card/CardButton.js +2 -3
- package/cjs/components/CardList/CardListToolbar.js +3 -8
- package/cjs/components/Dialog/Dialog.js +5 -27
- package/cjs/components/Drawer/Drawer.js +7 -20
- package/cjs/components/Dropdown/Dropdown.js +3 -11
- package/cjs/components/FormField/FormField.js +13 -26
- package/cjs/components/List/List.js +1 -14
- package/cjs/components/Progress/Progress.js +6 -5
- package/cjs/components/ProgressStep/ProgressStep.js +5 -14
- package/cjs/components/ProgressStep/index.js +6 -0
- package/cjs/components/Section/Section.js +11 -19
- package/cjs/components/TextArea/TextArea.js +49 -97
- package/cjs/components/TextArea/calculateNodeHeight.js +8 -8
- package/cjs/components/Toolbar/RegistryContextBeta.js +112 -0
- package/cjs/components/Toolbar/Toolbar.js +46 -2
- package/cjs/components/Toolbar/ToolbarBetaProvider.js +23 -0
- package/cjs/components/Toolbar/ToolbarGroup.js +66 -4
- package/cjs/components/Toolbar/ToolbarItem.js +27 -12
- package/cjs/components/Toolbar/ToolbarMenu.js +2 -1
- package/cjs/components/Toolbar/index.js +8 -1
- package/cjs/components/index.js +15 -1
- package/cjs/hooks/index.js +12 -0
- package/cjs/hooks/useResizeObserver.js +29 -0
- package/cjs/hooks/useSqueeze.js +48 -0
- package/cjs/index.js +1 -1
- package/dist/plesk-ui-library.js +586 -303
- package/dist/plesk-ui-library.js.map +1 -1
- package/dist/plesk-ui-library.min.js +6 -6
- package/dist/plesk-ui-library.min.js.map +1 -1
- package/esm/components/Button/Button.js +3 -21
- package/esm/components/Card/CardButton.js +2 -3
- package/esm/components/CardList/CardListToolbar.js +3 -8
- package/esm/components/Dialog/Dialog.js +5 -27
- package/esm/components/Drawer/Drawer.js +7 -20
- package/esm/components/Dropdown/Dropdown.js +3 -11
- package/esm/components/FormField/FormField.js +13 -26
- package/esm/components/List/List.js +1 -14
- package/esm/components/Progress/Progress.js +7 -6
- package/esm/components/ProgressStep/ProgressStep.js +4 -13
- package/esm/components/ProgressStep/index.js +1 -1
- package/esm/components/Section/Section.js +11 -19
- package/esm/components/TextArea/TextArea.js +50 -98
- package/esm/components/TextArea/calculateNodeHeight.js +8 -8
- package/esm/components/Toolbar/RegistryContextBeta.js +103 -0
- package/esm/components/Toolbar/Toolbar.js +47 -3
- package/esm/components/Toolbar/ToolbarBetaProvider.js +16 -0
- package/esm/components/Toolbar/ToolbarGroup.js +67 -5
- package/esm/components/Toolbar/ToolbarItem.js +27 -12
- package/esm/components/Toolbar/ToolbarMenu.js +2 -1
- package/esm/components/Toolbar/index.js +2 -1
- package/esm/components/index.js +2 -2
- package/esm/hooks/index.js +3 -0
- package/esm/hooks/useResizeObserver.js +22 -0
- package/esm/hooks/useSqueeze.js +41 -0
- package/esm/index.js +1 -1
- package/package.json +10 -10
- package/styleguide/build/bundle.505bc865.js +2 -0
- package/styleguide/index.html +2 -2
- package/types/src/components/Button/Button.d.ts +1 -0
- package/types/src/components/Dialog/Dialog.d.ts +1 -25
- package/types/src/components/Drawer/Drawer.d.ts +2 -5
- package/types/src/components/FormField/FormField.d.ts +1 -23
- package/types/src/components/ProgressStep/ProgressStep.d.ts +2 -13
- package/types/src/components/ProgressStep/index.d.ts +1 -1
- package/types/src/components/Section/Section.d.ts +2 -32
- package/types/src/components/TextArea/TextArea.d.ts +5 -32
- package/types/src/components/TextArea/calculateNodeHeight.d.ts +2 -6
- package/types/src/components/Toolbar/RegistryContextBeta.d.ts +25 -0
- package/types/src/components/Toolbar/Toolbar.d.ts +2 -22
- package/types/src/components/Toolbar/ToolbarBetaProvider.d.ts +5 -0
- package/types/src/components/Toolbar/ToolbarGroup.d.ts +2 -5
- package/types/src/components/Toolbar/ToolbarItem.d.ts +1 -1
- package/types/src/components/Toolbar/index.d.ts +1 -0
- package/types/src/components/index.d.ts +2 -2
- package/types/src/hooks/index.d.ts +1 -0
- package/types/src/hooks/useResizeObserver.d.ts +7 -0
- package/types/src/hooks/useSqueeze.d.ts +10 -0
- package/styleguide/build/bundle.c34e3753.js +0 -2
- /package/styleguide/build/{bundle.c34e3753.js.LICENSE.txt → bundle.505bc865.js.LICENSE.txt} +0 -0
|
@@ -63,6 +63,9 @@ const renderCaret = _ref2 => {
|
|
|
63
63
|
}
|
|
64
64
|
return caretElement;
|
|
65
65
|
};
|
|
66
|
+
|
|
67
|
+
// For ToolbarMenu backward compatibility purposes
|
|
68
|
+
export const BUTTON_PROP_NAMES = ['size', 'intent', 'ghost', 'selected', 'onToggle', 'state', 'disabled', 'tooltip', 'icon', 'caret', 'fill', 'children', 'component', 'className', 'baseClassName', 'arrow', 'onClick'];
|
|
66
69
|
const Button = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
67
70
|
let {
|
|
68
71
|
baseClassName = `${CLS_PREFIX}button`,
|
|
@@ -176,27 +179,6 @@ const Button = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
176
179
|
});
|
|
177
180
|
Button.displayName = 'Button';
|
|
178
181
|
|
|
179
|
-
// For ToolbarMenu backward compatibility purposes
|
|
180
|
-
Button.defaultProps = {
|
|
181
|
-
size: undefined,
|
|
182
|
-
intent: undefined,
|
|
183
|
-
ghost: false,
|
|
184
|
-
selected: undefined,
|
|
185
|
-
onToggle: undefined,
|
|
186
|
-
state: undefined,
|
|
187
|
-
disabled: false,
|
|
188
|
-
tooltip: undefined,
|
|
189
|
-
icon: undefined,
|
|
190
|
-
caret: undefined,
|
|
191
|
-
fill: false,
|
|
192
|
-
children: undefined,
|
|
193
|
-
component: 'button',
|
|
194
|
-
className: undefined,
|
|
195
|
-
baseClassName: `${CLS_PREFIX}button`,
|
|
196
|
-
arrow: undefined,
|
|
197
|
-
onClick: undefined
|
|
198
|
-
};
|
|
199
|
-
|
|
200
182
|
/**
|
|
201
183
|
* `Button` component is used for executing actions, changing the application state, opening forms or dialog windows, and submitting data.
|
|
202
184
|
* As a rule, you should not use buttons for navigation between individual pages (use `Link` instead).
|
|
@@ -9,10 +9,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
9
9
|
const CardButton = _ref => {
|
|
10
10
|
let {
|
|
11
11
|
icon,
|
|
12
|
+
baseClassName = `${CLS_PREFIX}card-button`,
|
|
12
13
|
...props
|
|
13
14
|
} = _ref;
|
|
14
15
|
return /*#__PURE__*/_jsx(Button, {
|
|
15
16
|
icon: Icon.create(icon),
|
|
17
|
+
baseClassName: baseClassName,
|
|
16
18
|
...props
|
|
17
19
|
});
|
|
18
20
|
};
|
|
@@ -23,7 +25,4 @@ CardButton.propTypes = {
|
|
|
23
25
|
baseClassName: PropTypes.string,
|
|
24
26
|
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.element]).isRequired
|
|
25
27
|
};
|
|
26
|
-
CardButton.defaultProps = {
|
|
27
|
-
baseClassName: `${CLS_PREFIX}card-button`
|
|
28
|
-
};
|
|
29
28
|
export default CardButton;
|
|
@@ -111,9 +111,9 @@ const renderView = (onViewChange, currentView) => {
|
|
|
111
111
|
const isToolbarExpander = element => /*#__PURE__*/isValidElement(element) && element.type === ToolbarExpander;
|
|
112
112
|
const CardListToolbar = _ref2 => {
|
|
113
113
|
let {
|
|
114
|
-
baseClassName
|
|
115
|
-
selection,
|
|
116
|
-
onViewChange,
|
|
114
|
+
baseClassName = `${CLS_PREFIX}card-list__toolbar`,
|
|
115
|
+
selection = null,
|
|
116
|
+
onViewChange = null,
|
|
117
117
|
currentView,
|
|
118
118
|
groups
|
|
119
119
|
} = _ref2;
|
|
@@ -144,9 +144,4 @@ CardListToolbar.propTypes = {
|
|
|
144
144
|
currentView: PropTypes.string.isRequired,
|
|
145
145
|
baseClassName: PropTypes.string
|
|
146
146
|
};
|
|
147
|
-
CardListToolbar.defaultProps = {
|
|
148
|
-
selection: null,
|
|
149
|
-
onViewChange: null,
|
|
150
|
-
baseClassName: `${CLS_PREFIX}card-list__toolbar`
|
|
151
|
-
};
|
|
152
147
|
export default CardListToolbar;
|
|
@@ -20,11 +20,14 @@ const isProps = value => value && typeof value === 'object' && ! /*#__PURE__*/is
|
|
|
20
20
|
*/
|
|
21
21
|
const Dialog = _ref => {
|
|
22
22
|
let {
|
|
23
|
-
baseClassName
|
|
23
|
+
baseClassName = `${CLS_PREFIX}dialog`,
|
|
24
|
+
isOpen = false,
|
|
25
|
+
size = 'md',
|
|
26
|
+
closable = true,
|
|
27
|
+
canClose = true,
|
|
24
28
|
className,
|
|
25
29
|
children,
|
|
26
30
|
actions,
|
|
27
|
-
isOpen,
|
|
28
31
|
banner,
|
|
29
32
|
image,
|
|
30
33
|
title,
|
|
@@ -33,11 +36,8 @@ const Dialog = _ref => {
|
|
|
33
36
|
cancelButton,
|
|
34
37
|
buttons,
|
|
35
38
|
form,
|
|
36
|
-
size,
|
|
37
|
-
closable,
|
|
38
39
|
onClose,
|
|
39
40
|
closingConfirmation,
|
|
40
|
-
canClose,
|
|
41
41
|
...props
|
|
42
42
|
} = _ref;
|
|
43
43
|
const [isVisible, setIsVisible] = useState(isOpen);
|
|
@@ -197,26 +197,4 @@ const Dialog = _ref => {
|
|
|
197
197
|
}), closingConfirmationDialog]
|
|
198
198
|
});
|
|
199
199
|
};
|
|
200
|
-
Dialog.defaultProps = {
|
|
201
|
-
isOpen: false,
|
|
202
|
-
banner: undefined,
|
|
203
|
-
sideBanner: undefined,
|
|
204
|
-
sideBannerContainer: undefined,
|
|
205
|
-
image: undefined,
|
|
206
|
-
title: undefined,
|
|
207
|
-
subtitle: undefined,
|
|
208
|
-
cancelTitle: undefined,
|
|
209
|
-
cancelButton: undefined,
|
|
210
|
-
buttons: undefined,
|
|
211
|
-
actions: undefined,
|
|
212
|
-
form: undefined,
|
|
213
|
-
size: 'md',
|
|
214
|
-
closable: true,
|
|
215
|
-
canClose: true,
|
|
216
|
-
onClose: undefined,
|
|
217
|
-
closingConfirmation: undefined,
|
|
218
|
-
children: undefined,
|
|
219
|
-
className: undefined,
|
|
220
|
-
baseClassName: `${CLS_PREFIX}dialog`
|
|
221
|
-
};
|
|
222
200
|
export default Dialog;
|
|
@@ -12,24 +12,6 @@ import { isLikeText } from '../Translate';
|
|
|
12
12
|
import ScrollableElementFormContext from '../Form/ScrollableElementFormContext';
|
|
13
13
|
import DrawerProgress from './DrawerProgress';
|
|
14
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
const defaultProps = {
|
|
16
|
-
isOpen: false,
|
|
17
|
-
subtitle: undefined,
|
|
18
|
-
backButton: undefined,
|
|
19
|
-
hideButton: undefined,
|
|
20
|
-
tabs: undefined,
|
|
21
|
-
placement: 'left',
|
|
22
|
-
size: 'md',
|
|
23
|
-
onClose: undefined,
|
|
24
|
-
closingConfirmation: undefined,
|
|
25
|
-
form: undefined,
|
|
26
|
-
sideBanner: undefined,
|
|
27
|
-
sideBannerContainer: undefined,
|
|
28
|
-
progress: undefined,
|
|
29
|
-
children: null,
|
|
30
|
-
className: undefined,
|
|
31
|
-
baseClassName: `${CLS_PREFIX}drawer`
|
|
32
|
-
};
|
|
33
15
|
/**
|
|
34
16
|
* `Drawer` component is used for working with properties of an object (or system) without leaving the context of the object.
|
|
35
17
|
* [Read more when to use Drawer](#!/Drawers%2C%20pages%2C%20popovers).
|
|
@@ -37,7 +19,10 @@ const defaultProps = {
|
|
|
37
19
|
*/
|
|
38
20
|
const Drawer = _ref => {
|
|
39
21
|
let {
|
|
40
|
-
baseClassName
|
|
22
|
+
baseClassName = `${CLS_PREFIX}drawer`,
|
|
23
|
+
isOpen = false,
|
|
24
|
+
placement = 'left',
|
|
25
|
+
size = 'md',
|
|
41
26
|
className,
|
|
42
27
|
children,
|
|
43
28
|
title,
|
|
@@ -139,6 +124,9 @@ const Drawer = _ref => {
|
|
|
139
124
|
}, className),
|
|
140
125
|
onClose: onCloseWithConfirmation,
|
|
141
126
|
canCloseOnBackdropClick: true,
|
|
127
|
+
isOpen: isOpen,
|
|
128
|
+
placement: placement,
|
|
129
|
+
size: size,
|
|
142
130
|
...props,
|
|
143
131
|
children: [takeApart(_ref5 => {
|
|
144
132
|
let {
|
|
@@ -180,5 +168,4 @@ const Drawer = _ref => {
|
|
|
180
168
|
}), closingConfirmationDialog]
|
|
181
169
|
});
|
|
182
170
|
};
|
|
183
|
-
Drawer.defaultProps = defaultProps;
|
|
184
171
|
export default Drawer;
|
|
@@ -125,12 +125,12 @@ const useEnhancedMenu = (menu, _ref2) => {
|
|
|
125
125
|
*/
|
|
126
126
|
const Dropdown = _ref3 => {
|
|
127
127
|
let {
|
|
128
|
-
baseClassName
|
|
128
|
+
baseClassName = `${CLS_PREFIX}dropdown`,
|
|
129
129
|
className,
|
|
130
130
|
children,
|
|
131
131
|
menu,
|
|
132
|
-
menuPlacement,
|
|
133
|
-
overlay,
|
|
132
|
+
menuPlacement = 'bottom-start',
|
|
133
|
+
overlay = false,
|
|
134
134
|
locale,
|
|
135
135
|
...props
|
|
136
136
|
} = _ref3;
|
|
@@ -199,12 +199,4 @@ const Dropdown = _ref3 => {
|
|
|
199
199
|
})
|
|
200
200
|
});
|
|
201
201
|
};
|
|
202
|
-
Dropdown.defaultProps = {
|
|
203
|
-
menuPlacement: 'bottom-start',
|
|
204
|
-
children: undefined,
|
|
205
|
-
overlay: false,
|
|
206
|
-
className: undefined,
|
|
207
|
-
baseClassName: `${CLS_PREFIX}dropdown`,
|
|
208
|
-
locale: undefined
|
|
209
|
-
};
|
|
210
202
|
export default Dropdown;
|
|
@@ -21,28 +21,6 @@ import DisabledContext from '../Form/DisabledContext';
|
|
|
21
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
22
|
export const BASE_FORM_FIELD_CLASS_NAME = `${CLS_PREFIX}form-field`;
|
|
23
23
|
const defaultValue = undefined;
|
|
24
|
-
const defaultProps = {
|
|
25
|
-
id: undefined,
|
|
26
|
-
name: undefined,
|
|
27
|
-
value: defaultValue,
|
|
28
|
-
onChange: null,
|
|
29
|
-
label: undefined,
|
|
30
|
-
description: undefined,
|
|
31
|
-
errors: {},
|
|
32
|
-
required: false,
|
|
33
|
-
children: undefined,
|
|
34
|
-
multi: undefined,
|
|
35
|
-
disabled: undefined,
|
|
36
|
-
locale: undefined,
|
|
37
|
-
addMoreValidator: undefined,
|
|
38
|
-
onRemoveRow: null,
|
|
39
|
-
fullDescription: undefined,
|
|
40
|
-
className: undefined,
|
|
41
|
-
baseClassName: BASE_FORM_FIELD_CLASS_NAME,
|
|
42
|
-
form: undefined,
|
|
43
|
-
vertical: undefined,
|
|
44
|
-
scrollableElement: undefined
|
|
45
|
-
};
|
|
46
24
|
|
|
47
25
|
/**
|
|
48
26
|
* Simple helper to handle situations when we're expecting only array
|
|
@@ -448,8 +426,14 @@ class FormField extends Component {
|
|
|
448
426
|
* * [FormFieldSelect](#!/FormFieldSelect), [FormFieldCheckbox](#!/FormFieldCheckbox),
|
|
449
427
|
* [FormFieldRadioButtons](#!/FormFieldRadioButtons) for selecting options.
|
|
450
428
|
*/
|
|
451
|
-
|
|
452
|
-
|
|
429
|
+
const FormFieldWrapper = _ref => {
|
|
430
|
+
let {
|
|
431
|
+
value = defaultValue,
|
|
432
|
+
errors = {},
|
|
433
|
+
required = false,
|
|
434
|
+
baseClassName = BASE_FORM_FIELD_CLASS_NAME,
|
|
435
|
+
...props
|
|
436
|
+
} = _ref;
|
|
453
437
|
const form = useContext(FormContext);
|
|
454
438
|
const verticalContext = useContext(VerticalContext);
|
|
455
439
|
const vertical = props.vertical === undefined ? verticalContext : props.vertical;
|
|
@@ -460,9 +444,12 @@ const FormFieldWrapper = props => {
|
|
|
460
444
|
form: form,
|
|
461
445
|
vertical: vertical,
|
|
462
446
|
scrollableElement: scrollableElement,
|
|
463
|
-
disabled: props.disabled || disabled
|
|
447
|
+
disabled: props.disabled || disabled,
|
|
448
|
+
value: value,
|
|
449
|
+
errors: errors,
|
|
450
|
+
required: required,
|
|
451
|
+
baseClassName: baseClassName
|
|
464
452
|
});
|
|
465
453
|
};
|
|
466
454
|
FormFieldWrapper.displayName = 'FormField';
|
|
467
|
-
FormFieldWrapper.defaultProps = defaultProps;
|
|
468
455
|
export default FormFieldWrapper;
|
|
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
3
3
|
|
|
4
4
|
import { Fragment, cloneElement, isValidElement, createRef, Component, createElement as _createElement } from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
5
|
import classNames from 'classnames';
|
|
7
6
|
import { CSSTransition } from 'react-transition-group';
|
|
8
7
|
import memoize from 'memoize-one';
|
|
@@ -34,7 +33,7 @@ function getRowKey(row, props) {
|
|
|
34
33
|
}
|
|
35
34
|
const Tbody = _ref => {
|
|
36
35
|
let {
|
|
37
|
-
baseClassName
|
|
36
|
+
baseClassName = `${CLS_PREFIX}list__wrapper`,
|
|
38
37
|
className,
|
|
39
38
|
...props
|
|
40
39
|
} = _ref;
|
|
@@ -52,18 +51,6 @@ const Tbody = _ref => {
|
|
|
52
51
|
})
|
|
53
52
|
});
|
|
54
53
|
};
|
|
55
|
-
Tbody.propTypes = {
|
|
56
|
-
onFocus: PropTypes.func,
|
|
57
|
-
onBlur: PropTypes.func,
|
|
58
|
-
className: PropTypes.string,
|
|
59
|
-
baseClassName: PropTypes.string
|
|
60
|
-
};
|
|
61
|
-
Tbody.defaultProps = {
|
|
62
|
-
onFocus: undefined,
|
|
63
|
-
onBlur: undefined,
|
|
64
|
-
className: undefined,
|
|
65
|
-
baseClassName: `${CLS_PREFIX}list__wrapper`
|
|
66
|
-
};
|
|
67
54
|
const getHumanTotalRows = _ref2 => {
|
|
68
55
|
let {
|
|
69
56
|
selectedRows,
|
|
@@ -5,7 +5,7 @@ import { Component, Children, isValidElement } from 'react';
|
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { CLS_PREFIX } from '../../constants';
|
|
7
7
|
import { safeInvoke } from '../utils';
|
|
8
|
-
import { STATUS_NOT_STARTED, STATUS_RUNNING, STATUS_DONE, STATUS_ERROR, STATUS_WARNING } from '../ProgressStep';
|
|
8
|
+
import { STATUS_NOT_STARTED, STATUS_RUNNING, STATUS_DONE, STATUS_ERROR, STATUS_WARNING, PROGRESS_STEP_DEFAULT_STATUS } from '../ProgressStep';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
/**
|
|
11
11
|
* `Progress` is used for showing progress of performing long operations.
|
|
@@ -28,11 +28,12 @@ class Progress extends Component {
|
|
|
28
28
|
let isFailed = false;
|
|
29
29
|
if (children) {
|
|
30
30
|
Children.forEach(children, child => {
|
|
31
|
-
if ( /*#__PURE__*/isValidElement(child)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
if ( /*#__PURE__*/isValidElement(child)) {
|
|
32
|
+
const status = child.props.status ?? PROGRESS_STEP_DEFAULT_STATUS;
|
|
33
|
+
isNotStarted = isNotStarted && status === STATUS_NOT_STARTED;
|
|
34
|
+
isFinished = isFinished && status === STATUS_DONE;
|
|
35
|
+
isFinishedWithWarnings = isFinishedWithWarnings && [STATUS_DONE, STATUS_WARNING].includes(status);
|
|
36
|
+
isFailed = isFailed || status === STATUS_ERROR;
|
|
36
37
|
}
|
|
37
38
|
});
|
|
38
39
|
}
|
|
@@ -14,6 +14,7 @@ export const STATUS_DONE = 'done';
|
|
|
14
14
|
export const STATUS_WARNING = 'warning';
|
|
15
15
|
export const STATUS_ERROR = 'error';
|
|
16
16
|
export const STATUS_CANCELED = 'canceled';
|
|
17
|
+
export const PROGRESS_STEP_DEFAULT_STATUS = STATUS_NOT_STARTED;
|
|
17
18
|
/**
|
|
18
19
|
* `ProgressStep` is a part of the [Progress](#!/Progress) component.
|
|
19
20
|
* @since 1.10.0
|
|
@@ -25,9 +26,9 @@ const ProgressStep = _ref => {
|
|
|
25
26
|
icon,
|
|
26
27
|
title,
|
|
27
28
|
statusText,
|
|
28
|
-
progress,
|
|
29
|
-
status,
|
|
30
|
-
baseClassName
|
|
29
|
+
progress = -1,
|
|
30
|
+
status = PROGRESS_STEP_DEFAULT_STATUS,
|
|
31
|
+
baseClassName = `${CLS_PREFIX}progress-step`,
|
|
31
32
|
...props
|
|
32
33
|
} = _ref;
|
|
33
34
|
let intent = null;
|
|
@@ -103,14 +104,4 @@ const ProgressStep = _ref => {
|
|
|
103
104
|
})]
|
|
104
105
|
});
|
|
105
106
|
};
|
|
106
|
-
ProgressStep.defaultProps = {
|
|
107
|
-
icon: null,
|
|
108
|
-
title: null,
|
|
109
|
-
status: STATUS_NOT_STARTED,
|
|
110
|
-
statusText: null,
|
|
111
|
-
progress: -1,
|
|
112
|
-
children: null,
|
|
113
|
-
className: null,
|
|
114
|
-
baseClassName: `${CLS_PREFIX}progress-step`
|
|
115
|
-
};
|
|
116
107
|
export default ProgressStep;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
2
2
|
|
|
3
|
-
export { default, STATUS_RUNNING, STATUS_DONE, STATUS_ERROR, STATUS_WARNING, STATUS_CANCELED, STATUS_NOT_STARTED } from './ProgressStep';
|
|
3
|
+
export { default, STATUS_RUNNING, STATUS_DONE, STATUS_ERROR, STATUS_WARNING, STATUS_CANCELED, STATUS_NOT_STARTED, PROGRESS_STEP_DEFAULT_STATUS } from './ProgressStep';
|
|
@@ -33,21 +33,6 @@ const getErrorsForChildren = (form, children) => {
|
|
|
33
33
|
return errors;
|
|
34
34
|
};
|
|
35
35
|
export const SECTION_BASE_CLASS_NAME = `${CLS_PREFIX}section`;
|
|
36
|
-
const DEFAULT_PROPS = {
|
|
37
|
-
title: undefined,
|
|
38
|
-
intent: undefined,
|
|
39
|
-
collapsible: false,
|
|
40
|
-
collapsed: false,
|
|
41
|
-
onTitleChange: undefined,
|
|
42
|
-
onClose: undefined,
|
|
43
|
-
onToggle: undefined,
|
|
44
|
-
buttons: undefined,
|
|
45
|
-
vertical: undefined,
|
|
46
|
-
children: undefined,
|
|
47
|
-
className: undefined,
|
|
48
|
-
baseClassName: SECTION_BASE_CLASS_NAME,
|
|
49
|
-
form: undefined
|
|
50
|
-
};
|
|
51
36
|
class Section extends Component {
|
|
52
37
|
constructor() {
|
|
53
38
|
super(...arguments);
|
|
@@ -235,18 +220,25 @@ class Section extends Component {
|
|
|
235
220
|
* and comprehension of the presented information.
|
|
236
221
|
* @since 0.0.54
|
|
237
222
|
*/
|
|
238
|
-
|
|
239
|
-
|
|
223
|
+
const SectionWrapper = _ref8 => {
|
|
224
|
+
let {
|
|
225
|
+
collapsible = false,
|
|
226
|
+
collapsed = false,
|
|
227
|
+
baseClassName = SECTION_BASE_CLASS_NAME,
|
|
228
|
+
...props
|
|
229
|
+
} = _ref8;
|
|
240
230
|
const form = useContext(FormContext);
|
|
241
231
|
const verticalContext = useContext(VerticalContext);
|
|
242
232
|
const vertical = props.vertical === undefined ? verticalContext : props.vertical;
|
|
243
233
|
return /*#__PURE__*/_jsx(Section, {
|
|
244
234
|
...props,
|
|
245
235
|
form: form,
|
|
246
|
-
vertical: vertical
|
|
236
|
+
vertical: vertical,
|
|
237
|
+
collapsible: collapsible,
|
|
238
|
+
collapsed: collapsed,
|
|
239
|
+
baseClassName: baseClassName
|
|
247
240
|
});
|
|
248
241
|
};
|
|
249
242
|
SectionWrapper.displayName = 'Section';
|
|
250
|
-
SectionWrapper.defaultProps = DEFAULT_PROPS;
|
|
251
243
|
SectionWrapper.WrappedComponent = Section;
|
|
252
244
|
export default SectionWrapper;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
3
2
|
|
|
4
3
|
import classNames from 'classnames';
|
|
5
|
-
import {
|
|
4
|
+
import { useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
6
5
|
import { CLS_PREFIX } from '../../constants';
|
|
7
6
|
import calculateNodeHeight from './calculateNodeHeight';
|
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -17,109 +16,62 @@ const getMinMax = rows => {
|
|
|
17
16
|
maxRows: rows.max
|
|
18
17
|
};
|
|
19
18
|
}
|
|
20
|
-
return
|
|
19
|
+
return {};
|
|
21
20
|
};
|
|
22
|
-
const AVAILABLE_SIZES = ['sm', 'md', 'lg', 'xl', 'fill'];
|
|
21
|
+
const AVAILABLE_SIZES = new Set(['sm', 'md', 'lg', 'xl', 'fill']);
|
|
23
22
|
|
|
24
23
|
/**
|
|
25
24
|
* `TextArea` is used for entering long text (like email body, descriptions, comments).
|
|
26
25
|
* @since 1.9.0
|
|
27
26
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
static getDerivedStateFromProps(_ref) {
|
|
50
|
-
let {
|
|
51
|
-
rows
|
|
52
|
-
} = _ref;
|
|
53
|
-
if (rows) {
|
|
54
|
-
return getMinMax(rows);
|
|
55
|
-
}
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
componentDidMount() {
|
|
59
|
-
this.adjustHeight();
|
|
60
|
-
}
|
|
61
|
-
componentDidUpdate(prevProps) {
|
|
62
|
-
const {
|
|
63
|
-
autoheight
|
|
64
|
-
} = this.props;
|
|
65
|
-
if (autoheight !== prevProps.autoheight) {
|
|
66
|
-
this.adjustHeight();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
adjustHeight() {
|
|
70
|
-
const {
|
|
71
|
-
autoheight
|
|
72
|
-
} = this.props;
|
|
73
|
-
if (!autoheight) {
|
|
74
|
-
this.setState({
|
|
75
|
-
textareaStyles: null
|
|
76
|
-
});
|
|
27
|
+
const TextArea = _ref => {
|
|
28
|
+
let {
|
|
29
|
+
baseClassName = `${CLS_PREFIX}textarea`,
|
|
30
|
+
className,
|
|
31
|
+
rows = 4,
|
|
32
|
+
size = 'md',
|
|
33
|
+
autoheight = false,
|
|
34
|
+
onChange,
|
|
35
|
+
style,
|
|
36
|
+
...props
|
|
37
|
+
} = _ref;
|
|
38
|
+
const rootRef = useRef(null);
|
|
39
|
+
const useSizeModifier = size && AVAILABLE_SIZES.has(size);
|
|
40
|
+
const {
|
|
41
|
+
minRows,
|
|
42
|
+
maxRows
|
|
43
|
+
} = getMinMax(rows);
|
|
44
|
+
const [heightStyle, setHeightStyle] = useState();
|
|
45
|
+
const adjustHeight = useCallback(() => {
|
|
46
|
+
if (!autoheight || !rootRef.current) {
|
|
47
|
+
setHeightStyle(undefined);
|
|
77
48
|
return;
|
|
78
49
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
});
|
|
50
|
+
setHeightStyle(calculateNodeHeight(rootRef.current, false, minRows, maxRows));
|
|
51
|
+
}, [autoheight, maxRows, minRows]);
|
|
52
|
+
useLayoutEffect(() => {
|
|
53
|
+
adjustHeight();
|
|
54
|
+
}, [adjustHeight]);
|
|
55
|
+
const handleChange = e => {
|
|
56
|
+
if (autoheight) {
|
|
57
|
+
adjustHeight();
|
|
88
58
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
[`${baseClassName}--size-${size}`]: useSizeModifier
|
|
108
|
-
}, className),
|
|
109
|
-
ref: this.rootRef,
|
|
110
|
-
style: textareaStyles,
|
|
111
|
-
onChange: this.handleChange,
|
|
112
|
-
rows: minRows,
|
|
113
|
-
...other
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
_defineProperty(TextArea, "defaultProps", {
|
|
118
|
-
baseClassName: `${CLS_PREFIX}textarea`,
|
|
119
|
-
className: null,
|
|
120
|
-
rows: 4,
|
|
121
|
-
size: 'md',
|
|
122
|
-
autoheight: false,
|
|
123
|
-
onChange: null
|
|
124
|
-
});
|
|
59
|
+
if (typeof onChange === 'function') {
|
|
60
|
+
onChange(e);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
return /*#__PURE__*/_jsx("textarea", {
|
|
64
|
+
ref: rootRef,
|
|
65
|
+
className: classNames(baseClassName, {
|
|
66
|
+
[`${baseClassName}--size-${size}`]: useSizeModifier
|
|
67
|
+
}, className),
|
|
68
|
+
style: {
|
|
69
|
+
...style,
|
|
70
|
+
...heightStyle
|
|
71
|
+
},
|
|
72
|
+
onChange: handleChange,
|
|
73
|
+
rows: minRows,
|
|
74
|
+
...props
|
|
75
|
+
});
|
|
76
|
+
};
|
|
125
77
|
export default TextArea;
|
|
@@ -41,8 +41,8 @@ const calculateNodeStyling = function (node) {
|
|
|
41
41
|
// eslint-disable-next-line max-params
|
|
42
42
|
export default function calculateNodeHeight(uiTextNode) {
|
|
43
43
|
let useCache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
44
|
-
let minRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] :
|
|
45
|
-
let maxRows = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] :
|
|
44
|
+
let minRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
45
|
+
let maxRows = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
|
|
46
46
|
if (!hiddenTextarea) {
|
|
47
47
|
hiddenTextarea = document.createElement('textarea');
|
|
48
48
|
document.body.appendChild(hiddenTextarea);
|
|
@@ -64,8 +64,8 @@ export default function calculateNodeHeight(uiTextNode) {
|
|
|
64
64
|
// Need to have the overflow attribute to hide the scrollbar otherwise text-lines will not calculated properly as the shadow will technically be narrower for content
|
|
65
65
|
hiddenTextarea.setAttribute('style', `${sizingStyle};${HIDDEN_TEXTAREA_STYLE}`);
|
|
66
66
|
hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || '';
|
|
67
|
-
let minHeight =
|
|
68
|
-
let maxHeight =
|
|
67
|
+
let minHeight = undefined;
|
|
68
|
+
let maxHeight = undefined;
|
|
69
69
|
let height = hiddenTextarea.scrollHeight;
|
|
70
70
|
let overflowY;
|
|
71
71
|
if (boxSizing === 'border-box') {
|
|
@@ -75,23 +75,23 @@ export default function calculateNodeHeight(uiTextNode) {
|
|
|
75
75
|
// remove padding, since height = content
|
|
76
76
|
height = height - paddingSize;
|
|
77
77
|
}
|
|
78
|
-
if (minRows !==
|
|
78
|
+
if (minRows !== undefined || maxRows !== undefined) {
|
|
79
79
|
// measure height of a textarea with a single row
|
|
80
80
|
hiddenTextarea.value = ' ';
|
|
81
81
|
const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
|
|
82
|
-
if (minRows !==
|
|
82
|
+
if (minRows !== undefined) {
|
|
83
83
|
minHeight = singleRowHeight * minRows;
|
|
84
84
|
if (boxSizing === 'border-box') {
|
|
85
85
|
minHeight = minHeight + paddingSize + borderSize;
|
|
86
86
|
}
|
|
87
87
|
height = Math.max(minHeight, height);
|
|
88
88
|
}
|
|
89
|
-
if (maxRows !==
|
|
89
|
+
if (maxRows !== undefined) {
|
|
90
90
|
maxHeight = singleRowHeight * maxRows;
|
|
91
91
|
if (boxSizing === 'border-box') {
|
|
92
92
|
maxHeight = maxHeight + paddingSize + borderSize;
|
|
93
93
|
}
|
|
94
|
-
overflowY = height > maxHeight ?
|
|
94
|
+
overflowY = height > maxHeight ? undefined : 'hidden';
|
|
95
95
|
height = Math.min(maxHeight, height);
|
|
96
96
|
}
|
|
97
97
|
}
|