@plesk/ui-library 3.40.8 → 3.40.10
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/Action/Action.js +1 -1
- package/cjs/components/Badge/Badge.js +1 -1
- package/cjs/components/Button/Button.js +1 -1
- package/cjs/components/Card/Card.js +3 -3
- package/cjs/components/CardList/CardListToolbar.js +1 -1
- package/cjs/components/CodeEditor/CodeEditor.js +1 -1
- package/cjs/components/ComboBox/ComboBox.js +1 -1
- package/cjs/components/ComboBoxDropdown/ComboBoxDropdown.js +2 -2
- package/cjs/components/Cuttable/Cuttable.js +59 -88
- package/cjs/components/Cuttable/useContentOverflow.js +35 -0
- package/cjs/components/Dialog/Dialog.js +2 -2
- package/cjs/components/Drawer/Drawer.js +1 -1
- package/cjs/components/Dropdown/Dropdown.js +1 -1
- package/cjs/components/Form/Form.js +1 -1
- package/cjs/components/Icon/utils.js +1 -1
- package/cjs/components/Item/Item.js +1 -1
- package/cjs/components/ItemList/ItemList.js +3 -3
- package/cjs/components/Layer/Layer.js +2 -2
- package/cjs/components/List/List.js +4 -4
- package/cjs/components/List/ListActions.js +2 -2
- package/cjs/components/LocaleProvider/LocaleProvider.js +1 -1
- package/cjs/components/Media/Media.js +1 -1
- package/cjs/components/Menu/Menu.js +1 -1
- package/cjs/components/Overlay/Overlay.js +1 -1
- package/cjs/components/Progress/Progress.js +1 -1
- package/cjs/components/SegmentedControl/ButtonGroupControl.js +65 -0
- package/cjs/components/SegmentedControl/DropdownControl.js +46 -0
- package/cjs/components/SegmentedControl/SegmentedControl.js +70 -265
- package/cjs/components/SegmentedControl/getSelectedValues.js +18 -0
- package/cjs/components/SegmentedControl/useResponsive.js +29 -0
- package/cjs/components/SegmentedControl/useSelected.js +55 -0
- package/cjs/components/Select/Select.js +2 -2
- package/cjs/components/Squeezer/Squeezer.js +10 -88
- package/cjs/components/Tabs/Tabs.js +1 -1
- package/cjs/components/Toaster/Toaster.js +1 -1
- package/cjs/components/Toolbar/ToolbarMenu.js +2 -2
- package/cjs/components/Tour/Tour.js +1 -1
- package/cjs/components/Translate/isLikeText.js +1 -1
- package/cjs/hooks/index.js +7 -0
- package/cjs/hooks/useSqueeze.js +2 -1
- package/cjs/index.js +1 -1
- 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 +506 -492
- package/dist/plesk-ui-library.js.map +1 -1
- package/dist/plesk-ui-library.min.js +4 -4
- package/dist/plesk-ui-library.min.js.map +1 -1
- package/esm/components/Action/Action.js +1 -1
- package/esm/components/Badge/Badge.js +1 -1
- package/esm/components/Button/Button.js +1 -1
- package/esm/components/Card/Card.js +3 -3
- package/esm/components/CardList/CardListToolbar.js +1 -1
- package/esm/components/CodeEditor/CodeEditor.js +1 -1
- package/esm/components/ComboBox/ComboBox.js +1 -1
- package/esm/components/ComboBoxDropdown/ComboBoxDropdown.js +2 -2
- package/esm/components/Cuttable/Cuttable.js +60 -89
- package/esm/components/Cuttable/useContentOverflow.js +28 -0
- package/esm/components/Dialog/Dialog.js +2 -2
- package/esm/components/Drawer/Drawer.js +1 -1
- package/esm/components/Dropdown/Dropdown.js +1 -1
- package/esm/components/Form/Form.js +1 -1
- package/esm/components/Icon/utils.js +1 -1
- package/esm/components/Item/Item.js +1 -1
- package/esm/components/ItemList/ItemList.js +3 -3
- package/esm/components/Layer/Layer.js +2 -2
- package/esm/components/List/List.js +4 -4
- package/esm/components/List/ListActions.js +2 -2
- package/esm/components/LocaleProvider/LocaleProvider.js +1 -1
- package/esm/components/Media/Media.js +1 -1
- package/esm/components/Menu/Menu.js +1 -1
- package/esm/components/Overlay/Overlay.js +1 -1
- package/esm/components/Progress/Progress.js +1 -1
- package/esm/components/SegmentedControl/ButtonGroupControl.js +58 -0
- package/esm/components/SegmentedControl/DropdownControl.js +37 -0
- package/esm/components/SegmentedControl/SegmentedControl.js +71 -264
- package/esm/components/SegmentedControl/getSelectedValues.js +11 -0
- package/esm/components/SegmentedControl/useResponsive.js +21 -0
- package/esm/components/SegmentedControl/useSelected.js +48 -0
- package/esm/components/Select/Select.js +2 -2
- package/esm/components/Squeezer/Squeezer.js +11 -88
- package/esm/components/Tabs/Tabs.js +1 -1
- package/esm/components/Toaster/Toaster.js +1 -1
- package/esm/components/Toolbar/ToolbarMenu.js +2 -2
- package/esm/components/Tour/Tour.js +1 -1
- package/esm/components/Translate/isLikeText.js +1 -1
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/useSqueeze.js +2 -1
- package/esm/index.js +1 -1
- package/package.json +16 -16
- package/styleguide/build/bundle.2d1a02e1.js +2 -0
- package/styleguide/index.html +2 -2
- package/types/src/components/Cuttable/Cuttable.d.ts +3 -25
- package/types/src/components/Cuttable/useContentOverflow.d.ts +8 -0
- package/types/src/components/List/List.d.ts +1 -0
- package/types/src/components/SegmentedControl/ButtonGroupControl.d.ts +12 -0
- package/types/src/components/SegmentedControl/DropdownControl.d.ts +8 -0
- package/types/src/components/SegmentedControl/SegmentedControl.d.ts +6 -50
- package/types/src/components/SegmentedControl/getSelectedValues.d.ts +1 -0
- package/types/src/components/SegmentedControl/index.d.ts +1 -1
- package/types/src/components/SegmentedControl/types.d.ts +11 -0
- package/types/src/components/SegmentedControl/useResponsive.d.ts +6 -0
- package/types/src/components/SegmentedControl/useSelected.d.ts +17 -0
- package/types/src/components/Squeezer/Squeezer.d.ts +5 -21
- package/types/src/components/index.d.ts +1 -1
- package/types/src/hooks/index.d.ts +2 -0
- package/types/src/hooks/useSqueeze.d.ts +1 -4
- package/styleguide/build/bundle.265c8e0c.js +0 -2
- /package/styleguide/build/{bundle.265c8e0c.js.LICENSE.txt → bundle.2d1a02e1.js.LICENSE.txt} +0 -0
|
@@ -45,7 +45,7 @@ const Action = _ref => {
|
|
|
45
45
|
size: _Icon.ICON_SIZE_16
|
|
46
46
|
});
|
|
47
47
|
let size = _Icon.ICON_SIZE_16;
|
|
48
|
-
if (
|
|
48
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(icon) && icon.props.size) {
|
|
49
49
|
({
|
|
50
50
|
size
|
|
51
51
|
} = icon.props);
|
|
@@ -35,7 +35,7 @@ const Badge = _ref => {
|
|
|
35
35
|
children: label
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
if (
|
|
38
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(label)) {
|
|
39
39
|
const cloneProps = {
|
|
40
40
|
className: (0, _classnames.default)(`${baseClassName}__value`, {
|
|
41
41
|
[`${baseClassName}__value--dot`]: isEmpty
|
|
@@ -62,7 +62,7 @@ const renderCaret = _ref2 => {
|
|
|
62
62
|
} else {
|
|
63
63
|
caretElement = caret;
|
|
64
64
|
}
|
|
65
|
-
if (
|
|
65
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(caretElement)) {
|
|
66
66
|
caretElement = /*#__PURE__*/(0, _react.cloneElement)(caretElement, {
|
|
67
67
|
className: (0, _classnames.default)(`${baseClassName}__caret`, caretElement.props.className)
|
|
68
68
|
});
|
|
@@ -202,13 +202,13 @@ class Card extends _react.Component {
|
|
|
202
202
|
const result = [];
|
|
203
203
|
if (!this.isRow()) {
|
|
204
204
|
buttons.forEach((btn, index) => {
|
|
205
|
-
result.push(
|
|
205
|
+
result.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CardButton.default, {
|
|
206
206
|
...btn
|
|
207
207
|
}, btn.key || index));
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
210
|
if (menu) {
|
|
211
|
-
result.push(
|
|
211
|
+
result.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default, {
|
|
212
212
|
menu: menu,
|
|
213
213
|
menuPlacement: 'bottom-end',
|
|
214
214
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardButton.default, {
|
|
@@ -217,7 +217,7 @@ class Card extends _react.Component {
|
|
|
217
217
|
}, "menu"));
|
|
218
218
|
}
|
|
219
219
|
if (rowContent && !this.isTile()) {
|
|
220
|
-
result.push(
|
|
220
|
+
result.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CardButton.default, {
|
|
221
221
|
icon: {
|
|
222
222
|
name: 'chevron-down',
|
|
223
223
|
flipVertical: this.isExtended()
|
|
@@ -134,7 +134,7 @@ const CardListToolbar = _ref2 => {
|
|
|
134
134
|
if (onViewChange && currentView !== _CardList.VIEW_RESPONSIVE) {
|
|
135
135
|
const hasExpander = groups.filter(isToolbarExpander).length > 0;
|
|
136
136
|
if (!hasExpander) {
|
|
137
|
-
toolbar.push(
|
|
137
|
+
toolbar.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Toolbar.ToolbarExpander, {}, "expander"));
|
|
138
138
|
}
|
|
139
139
|
toolbar.push(renderView(onViewChange, currentView));
|
|
140
140
|
}
|
|
@@ -88,7 +88,7 @@ class CodeEditor extends _react.Component {
|
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
componentDidMount() {
|
|
91
|
-
Promise.resolve().then(() => _interopRequireWildcard(require(
|
|
91
|
+
Promise.resolve().then(() => _interopRequireWildcard(require(/* webpackChunkName: "codemirror" */'./CodeMirror'))).then(_ref2 => {
|
|
92
92
|
let {
|
|
93
93
|
CodeMirror
|
|
94
94
|
} = _ref2;
|
|
@@ -21,7 +21,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
21
21
|
const collect = function (children) {
|
|
22
22
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
23
23
|
_react.Children.forEach(children, child => {
|
|
24
|
-
if (
|
|
24
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(child) && child.type === _ComboBoxOption.default) {
|
|
25
25
|
// eslint-disable-next-line prefer-const
|
|
26
26
|
let {
|
|
27
27
|
disabled,
|
|
@@ -123,7 +123,7 @@ const ComboBoxDropdown = _ref => {
|
|
|
123
123
|
className: `${baseClassName}__menu`,
|
|
124
124
|
children: [groups.reduce((acc, group) => {
|
|
125
125
|
if (group.label) {
|
|
126
|
-
acc.push(
|
|
126
|
+
acc.push(/*#__PURE__*/(0, _react.createElement)(_Menu.MenuHeader, {
|
|
127
127
|
...group.props,
|
|
128
128
|
key: `group_${group.label}`
|
|
129
129
|
}, group.label));
|
|
@@ -158,7 +158,7 @@ const ComboBoxDropdown = _ref => {
|
|
|
158
158
|
onMouseDown,
|
|
159
159
|
'data-index': optionIndex
|
|
160
160
|
};
|
|
161
|
-
acc.push(
|
|
161
|
+
acc.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Menu.MenuItem, {
|
|
162
162
|
...menuItemProps,
|
|
163
163
|
children: option.children
|
|
164
164
|
}, `option_${option.value}`));
|
|
@@ -5,13 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
8
|
var _react = require("react");
|
|
10
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _reactMeasure = _interopRequireDefault(require("react-measure"));
|
|
12
10
|
var _constants = require("../../constants");
|
|
13
11
|
var _Translate = _interopRequireDefault(require("../Translate"));
|
|
14
12
|
var _Link = _interopRequireDefault(require("../Link"));
|
|
13
|
+
var _useContentOverflow = require("./useContentOverflow");
|
|
15
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
15
|
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
17
16
|
|
|
@@ -19,92 +18,64 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
19
18
|
* `Cuttable` component is used for showing and hiding part of content.
|
|
20
19
|
* @since 0.0.42
|
|
21
20
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
(
|
|
42
|
-
if (!this.state.autofit) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const content = this.contentRef.current;
|
|
46
|
-
if (content && content.scrollHeight > content.clientHeight) {
|
|
47
|
-
this.setState({
|
|
48
|
-
collapsed: this.props.collapsed
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
});
|
|
21
|
+
const Cuttable = _ref => {
|
|
22
|
+
let {
|
|
23
|
+
children,
|
|
24
|
+
collapsed: externalCollapsed = true,
|
|
25
|
+
maxHeight = '7rem',
|
|
26
|
+
locale = {
|
|
27
|
+
showMore: 'Show more',
|
|
28
|
+
showLess: 'Show less'
|
|
29
|
+
},
|
|
30
|
+
className,
|
|
31
|
+
baseClassName = `${_constants.CLS_PREFIX}cuttable`,
|
|
32
|
+
...props
|
|
33
|
+
} = _ref;
|
|
34
|
+
const contentRef = (0, _react.useRef)(null);
|
|
35
|
+
const hiddenElementRef = (0, _react.useRef)(null);
|
|
36
|
+
const [collapsed, setCollapsed] = (0, _react.useState)(externalCollapsed);
|
|
37
|
+
const [prevExternalCollapsed, setPrevExternalCollapsed] = (0, _react.useState)(externalCollapsed);
|
|
38
|
+
if (prevExternalCollapsed !== externalCollapsed) {
|
|
39
|
+
setPrevExternalCollapsed(externalCollapsed);
|
|
40
|
+
setCollapsed(externalCollapsed);
|
|
52
41
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
}), this.state.collapsed !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
89
|
-
className: `${baseClassName}__action`,
|
|
90
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.default, {
|
|
91
|
-
onClick: this.handleToggle,
|
|
92
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Translate.default, {
|
|
93
|
-
content: `Cuttable.${showMoreLessKey}`,
|
|
94
|
-
fallback: locale[showMoreLessKey]
|
|
95
|
-
})
|
|
42
|
+
const actionLocaleKey = collapsed ? 'showMore' : 'showLess';
|
|
43
|
+
const isContentOverflowing = (0, _useContentOverflow.useContentOverflow)({
|
|
44
|
+
contentRef,
|
|
45
|
+
hiddenElementRef,
|
|
46
|
+
maxHeight
|
|
47
|
+
});
|
|
48
|
+
const toggle = () => setCollapsed(!collapsed);
|
|
49
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
50
|
+
className: (0, _classnames.default)(baseClassName, {
|
|
51
|
+
[`${baseClassName}--collapse`]: collapsed && isContentOverflowing,
|
|
52
|
+
[`${baseClassName}--expand`]: !collapsed
|
|
53
|
+
}, className),
|
|
54
|
+
...props,
|
|
55
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
56
|
+
ref: contentRef,
|
|
57
|
+
className: `${baseClassName}__content`,
|
|
58
|
+
style: {
|
|
59
|
+
maxHeight
|
|
60
|
+
},
|
|
61
|
+
children: children
|
|
62
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
63
|
+
ref: hiddenElementRef,
|
|
64
|
+
className: `${baseClassName}__height-meter `,
|
|
65
|
+
style: {
|
|
66
|
+
height: maxHeight
|
|
67
|
+
},
|
|
68
|
+
"aria-hidden": true
|
|
69
|
+
}), isContentOverflowing && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
70
|
+
className: `${baseClassName}__action`,
|
|
71
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.default, {
|
|
72
|
+
onClick: toggle,
|
|
73
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Translate.default, {
|
|
74
|
+
content: `Cuttable.${actionLocaleKey}`,
|
|
75
|
+
fallback: locale[actionLocaleKey]
|
|
96
76
|
})
|
|
97
|
-
})
|
|
98
|
-
})
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
(0, _defineProperty2.default)(Cuttable, "defaultProps", {
|
|
102
|
-
collapsed: true,
|
|
103
|
-
maxHeight: '7rem',
|
|
104
|
-
locale: {
|
|
105
|
-
showMore: 'Show more',
|
|
106
|
-
showLess: 'Show less'
|
|
107
|
-
},
|
|
108
|
-
baseClassName: `${_constants.CLS_PREFIX}cuttable`
|
|
109
|
-
});
|
|
77
|
+
})
|
|
78
|
+
})]
|
|
79
|
+
});
|
|
80
|
+
};
|
|
110
81
|
var _default = exports.default = Cuttable;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useContentOverflow = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _hooks = require("../../hooks");
|
|
9
|
+
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
10
|
+
|
|
11
|
+
const useContentOverflow = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
contentRef,
|
|
14
|
+
hiddenElementRef,
|
|
15
|
+
maxHeight
|
|
16
|
+
} = _ref;
|
|
17
|
+
const [isOverflowing, setIsOverflowing] = (0, _react.useState)(false);
|
|
18
|
+
const checkHeight = () => {
|
|
19
|
+
const contentElement = contentRef.current;
|
|
20
|
+
const hiddenElement = hiddenElementRef.current;
|
|
21
|
+
if (!contentElement || !hiddenElement) return;
|
|
22
|
+
setIsOverflowing(contentElement.scrollHeight > hiddenElement.getBoundingClientRect().height);
|
|
23
|
+
};
|
|
24
|
+
const checkHeightRef = (0, _react.useRef)(checkHeight);
|
|
25
|
+
checkHeightRef.current = checkHeight;
|
|
26
|
+
(0, _react.useLayoutEffect)(() => {
|
|
27
|
+
checkHeightRef.current();
|
|
28
|
+
}, [maxHeight]);
|
|
29
|
+
(0, _hooks.useResizeObserver)({
|
|
30
|
+
ref: contentRef,
|
|
31
|
+
onResize: checkHeight
|
|
32
|
+
});
|
|
33
|
+
return isOverflowing;
|
|
34
|
+
};
|
|
35
|
+
exports.useContentOverflow = useContentOverflow;
|
|
@@ -65,7 +65,7 @@ const Dialog = _ref => {
|
|
|
65
65
|
}, [isOpen]);
|
|
66
66
|
const renderImage = (image, block) => {
|
|
67
67
|
const classPrefix = `${baseClassName}__${block}`;
|
|
68
|
-
if (
|
|
68
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(image)) {
|
|
69
69
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
70
70
|
className: classPrefix,
|
|
71
71
|
children: image
|
|
@@ -140,7 +140,7 @@ const Dialog = _ref => {
|
|
|
140
140
|
};
|
|
141
141
|
let childrenElement;
|
|
142
142
|
if (form) {
|
|
143
|
-
if (
|
|
143
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(form)) {
|
|
144
144
|
childrenElement = /*#__PURE__*/(0, _react.cloneElement)(form, {
|
|
145
145
|
cancelButton: getCancelButtonProps(form.props),
|
|
146
146
|
footerClassName: (0, _classnames.default)(form.props.footerClassName, `${baseClassName}__form-footer`)
|
|
@@ -75,7 +75,7 @@ const Drawer = _ref => {
|
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
if (form) {
|
|
78
|
-
if (
|
|
78
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(form)) {
|
|
79
79
|
return /*#__PURE__*/(0, _react.cloneElement)(form, {
|
|
80
80
|
className: (0, _classnames.default)(`${baseClassName}__form`, form.props.className),
|
|
81
81
|
cancelButton: form.props.cancelButton === false ? false : {
|
|
@@ -25,7 +25,7 @@ const createTarget = (node, _ref) => {
|
|
|
25
25
|
onToggle,
|
|
26
26
|
targetRef
|
|
27
27
|
} = _ref;
|
|
28
|
-
if (!(
|
|
28
|
+
if (!(/*#__PURE__*/(0, _react.isValidElement)(node) && node.type !== _Translate.default)) {
|
|
29
29
|
node = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
30
30
|
caret: true,
|
|
31
31
|
children: node
|
|
@@ -349,7 +349,7 @@ class Form extends _react.Component {
|
|
|
349
349
|
} = this.props;
|
|
350
350
|
if (Array.isArray(additionalButtons)) {
|
|
351
351
|
return additionalButtons.map(element => {
|
|
352
|
-
if (
|
|
352
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(element)) {
|
|
353
353
|
const props = {
|
|
354
354
|
className: (0, _classnames.default)(element.props.className, `${baseClassName}__additional-button`)
|
|
355
355
|
};
|
|
@@ -63,7 +63,7 @@ const Item = _ref => {
|
|
|
63
63
|
children: title
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
if (
|
|
66
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(title)) {
|
|
67
67
|
title = /*#__PURE__*/(0, _react.cloneElement)(title, {
|
|
68
68
|
className: (0, _classnames.default)(`${baseClassName}__title`, title.props.className)
|
|
69
69
|
});
|
|
@@ -126,7 +126,7 @@ class ItemList extends _react.Component {
|
|
|
126
126
|
} = this.props;
|
|
127
127
|
if (reorderable) {
|
|
128
128
|
// @ts-ignore
|
|
129
|
-
Promise.resolve().then(() => _interopRequireWildcard(require(
|
|
129
|
+
Promise.resolve().then(() => _interopRequireWildcard(require(/* webpackChunkName: "react-sortable-hoc" */'react-sortable-hoc'))).then(_ref2 => {
|
|
130
130
|
let {
|
|
131
131
|
sortableContainer,
|
|
132
132
|
sortableElement
|
|
@@ -148,7 +148,7 @@ class ItemList extends _react.Component {
|
|
|
148
148
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
149
149
|
...props,
|
|
150
150
|
children: _react.Children.map(children, child => {
|
|
151
|
-
if (
|
|
151
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(child)) {
|
|
152
152
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridCol.default, {
|
|
153
153
|
className: (0, _classnames.default)(`${baseClassName}__col`),
|
|
154
154
|
children: /*#__PURE__*/(0, _react.cloneElement)(child, this.createItemProps(child))
|
|
@@ -217,7 +217,7 @@ class ItemList extends _react.Component {
|
|
|
217
217
|
onSortEnd: onReorderEnd,
|
|
218
218
|
...props,
|
|
219
219
|
children: _react.Children.map(children, (child, index) => {
|
|
220
|
-
if (
|
|
220
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(child)) {
|
|
221
221
|
const {
|
|
222
222
|
disabled
|
|
223
223
|
} = child.props;
|
|
@@ -29,7 +29,7 @@ const Layer = _ref => {
|
|
|
29
29
|
const parentLevel = (0, _react.useContext)(LevelContext);
|
|
30
30
|
const container = (0, _react.useContext)(PortalContext) || document.body;
|
|
31
31
|
const renderChildren = () => {
|
|
32
|
-
if (
|
|
32
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(children)) {
|
|
33
33
|
return /*#__PURE__*/(0, _react.cloneElement)(children, {
|
|
34
34
|
style: {
|
|
35
35
|
...children.props.style,
|
|
@@ -39,7 +39,7 @@ const Layer = _ref => {
|
|
|
39
39
|
}
|
|
40
40
|
return children;
|
|
41
41
|
};
|
|
42
|
-
return /*#__PURE__*/(0, _reactDom.createPortal)(
|
|
42
|
+
return /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/(0, _jsxRuntime.jsx)(LevelContext.Provider, {
|
|
43
43
|
value: parentLevel + level,
|
|
44
44
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
45
45
|
className: (0, _classnames.default)(baseClassName, className),
|
|
@@ -79,7 +79,7 @@ const getHumanTotalRows = _ref2 => {
|
|
|
79
79
|
});
|
|
80
80
|
switch (mode) {
|
|
81
81
|
case 'totalRows':
|
|
82
|
-
return wrapToText(
|
|
82
|
+
return wrapToText(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Translate.default, {
|
|
83
83
|
namespace: "List",
|
|
84
84
|
content: "totalRows",
|
|
85
85
|
fallback: "%%totalRows%% items total",
|
|
@@ -89,7 +89,7 @@ const getHumanTotalRows = _ref2 => {
|
|
|
89
89
|
translators: translators
|
|
90
90
|
}));
|
|
91
91
|
case 'selectedRows':
|
|
92
|
-
return wrapToText(
|
|
92
|
+
return wrapToText(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Translate.default, {
|
|
93
93
|
namespace: "List",
|
|
94
94
|
content: "selectedRows",
|
|
95
95
|
fallback: "%%selectedRows%% of %%totalRows%% items selected",
|
|
@@ -103,7 +103,7 @@ const getHumanTotalRows = _ref2 => {
|
|
|
103
103
|
translators: translators
|
|
104
104
|
}));
|
|
105
105
|
case 'selectedAllRows':
|
|
106
|
-
return wrapToText(
|
|
106
|
+
return wrapToText(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Translate.default, {
|
|
107
107
|
namespace: "List",
|
|
108
108
|
content: "selectedRows",
|
|
109
109
|
fallback: "%%selectedRows%% of %%totalRows%% items selected",
|
|
@@ -389,7 +389,7 @@ class List extends _react.Component {
|
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
applyReorderableList() {
|
|
392
|
-
Promise.resolve().then(() => _interopRequireWildcard(require(
|
|
392
|
+
Promise.resolve().then(() => _interopRequireWildcard(require(/* webpackChunkName: "react-movable" */'@plesk/react-movable'))).then(_ref6 => {
|
|
393
393
|
let {
|
|
394
394
|
List: ReorderableList
|
|
395
395
|
} = _ref6;
|
|
@@ -48,7 +48,7 @@ const ListActions = _ref => {
|
|
|
48
48
|
const secondaryItems = [];
|
|
49
49
|
let secondaryCount = 0;
|
|
50
50
|
_react.Children.toArray(children).forEach((node, index) => {
|
|
51
|
-
if (
|
|
51
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(node) && node.type === _ListAction.default) {
|
|
52
52
|
const {
|
|
53
53
|
primary,
|
|
54
54
|
hidden
|
|
@@ -61,7 +61,7 @@ const ListActions = _ref => {
|
|
|
61
61
|
} else {
|
|
62
62
|
secondaryCount++;
|
|
63
63
|
if (!hidden) {
|
|
64
|
-
secondaryItems.push(
|
|
64
|
+
secondaryItems.push(/*#__PURE__*/(0, _react.cloneElement)(node, {
|
|
65
65
|
primary: false
|
|
66
66
|
}));
|
|
67
67
|
}
|
|
@@ -27,7 +27,7 @@ const applyParams = function (message) {
|
|
|
27
27
|
if (param === undefined) {
|
|
28
28
|
result.push(m[0]);
|
|
29
29
|
} else if (typeof param === 'object' && /*#__PURE__*/(0, _react.isValidElement)(param)) {
|
|
30
|
-
result.push(
|
|
30
|
+
result.push(/*#__PURE__*/(0, _react.cloneElement)(param, {
|
|
31
31
|
key: m[1]
|
|
32
32
|
}));
|
|
33
33
|
hasElements = true;
|
|
@@ -61,7 +61,7 @@ const Media = _ref => {
|
|
|
61
61
|
children: title
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
if (
|
|
64
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(title)) {
|
|
65
65
|
return /*#__PURE__*/(0, _react.cloneElement)(title, {
|
|
66
66
|
className: (0, _classnames.default)(`${baseClassName}__title`, title.props.className)
|
|
67
67
|
});
|
|
@@ -17,7 +17,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
17
17
|
const hasIconItem = children => {
|
|
18
18
|
let result = false;
|
|
19
19
|
_react.Children.forEach(children, child => {
|
|
20
|
-
if (
|
|
20
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(child) && (child.type === _MenuSelectableItem.default || child.props.icon)) {
|
|
21
21
|
result = true;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
@@ -75,7 +75,7 @@ const OverlayCore = _ref => {
|
|
|
75
75
|
const renderImage = sideBanner => {
|
|
76
76
|
const classPrefix = `${baseClassName}__side`;
|
|
77
77
|
let element = null;
|
|
78
|
-
if (
|
|
78
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(sideBanner)) {
|
|
79
79
|
element = sideBanner;
|
|
80
80
|
} else if (typeof sideBanner === 'string') {
|
|
81
81
|
element = /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
@@ -35,7 +35,7 @@ class Progress extends _react.Component {
|
|
|
35
35
|
let isFailed = false;
|
|
36
36
|
if (children) {
|
|
37
37
|
_react.Children.forEach(children, child => {
|
|
38
|
-
if (
|
|
38
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(child)) {
|
|
39
39
|
const status = child.props.status ?? _ProgressStep.PROGRESS_STEP_DEFAULT_STATUS;
|
|
40
40
|
isNotStarted = isNotStarted && status === _ProgressStep.STATUS_NOT_STARTED;
|
|
41
41
|
isFinished = isFinished && status === _ProgressStep.STATUS_DONE;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _Button = _interopRequireDefault(require("../Button"));
|
|
11
|
+
var _ButtonGroup = _interopRequireDefault(require("../ButtonGroup"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
14
|
+
|
|
15
|
+
const ButtonGroupControl = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
buttons,
|
|
18
|
+
selectedValues,
|
|
19
|
+
onClick,
|
|
20
|
+
ghost,
|
|
21
|
+
monospaced,
|
|
22
|
+
isResponsive,
|
|
23
|
+
baseClassName
|
|
24
|
+
} = _ref;
|
|
25
|
+
const buttonsRef = (0, _react.useRef)([]);
|
|
26
|
+
const [monoWidth, setMonoWidth] = (0, _react.useState)(0);
|
|
27
|
+
(0, _react.useLayoutEffect)(() => {
|
|
28
|
+
if (!monospaced) return;
|
|
29
|
+
const widths = buttonsRef.current.map(button => button.getBoundingClientRect().width);
|
|
30
|
+
const maxWidth = Math.max(...widths);
|
|
31
|
+
if (monoWidth !== maxWidth) {
|
|
32
|
+
setMonoWidth(maxWidth);
|
|
33
|
+
}
|
|
34
|
+
}, [monospaced, monoWidth]);
|
|
35
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonGroup.default, {
|
|
36
|
+
className: `${baseClassName}__button-group`,
|
|
37
|
+
children: buttons.map((_ref2, index) => {
|
|
38
|
+
let {
|
|
39
|
+
value,
|
|
40
|
+
title,
|
|
41
|
+
style = {},
|
|
42
|
+
...buttonProps
|
|
43
|
+
} = _ref2;
|
|
44
|
+
const shouldApplyMonoWidth = !isResponsive && monospaced && monoWidth;
|
|
45
|
+
const buttonStyle = {
|
|
46
|
+
width: shouldApplyMonoWidth ? monoWidth : style.width,
|
|
47
|
+
...style
|
|
48
|
+
};
|
|
49
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
50
|
+
ref: node => {
|
|
51
|
+
index === 0 && (buttonsRef.current = []);
|
|
52
|
+
node && buttonsRef.current.push(node);
|
|
53
|
+
},
|
|
54
|
+
selected: selectedValues.includes(value),
|
|
55
|
+
ghost: ghost,
|
|
56
|
+
onClick: () => onClick(value),
|
|
57
|
+
...buttonProps,
|
|
58
|
+
className: (0, _classnames.default)(buttonProps.className, `${baseClassName}__button`),
|
|
59
|
+
style: buttonStyle,
|
|
60
|
+
children: title
|
|
61
|
+
}, `${value}`);
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
var _default = exports.default = ButtonGroupControl;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _Dropdown = _interopRequireDefault(require("../Dropdown"));
|
|
9
|
+
var _Menu = _interopRequireWildcard(require("../Menu"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
14
|
+
|
|
15
|
+
const DropdownControl = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
buttons,
|
|
18
|
+
selected,
|
|
19
|
+
onClick
|
|
20
|
+
} = _ref;
|
|
21
|
+
const {
|
|
22
|
+
title = ''
|
|
23
|
+
} = buttons.find(button => button.value === selected) || {};
|
|
24
|
+
const menu = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Menu.default, {
|
|
25
|
+
children: buttons.map(_ref2 => {
|
|
26
|
+
let {
|
|
27
|
+
title,
|
|
28
|
+
value,
|
|
29
|
+
...buttonProps
|
|
30
|
+
} = _ref2;
|
|
31
|
+
const handleClick = () => {
|
|
32
|
+
onClick(value);
|
|
33
|
+
};
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Menu.MenuItem, {
|
|
35
|
+
...buttonProps,
|
|
36
|
+
onClick: handleClick,
|
|
37
|
+
children: title
|
|
38
|
+
}, `${value}`);
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default, {
|
|
42
|
+
menu: menu,
|
|
43
|
+
children: title
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
var _default = exports.default = DropdownControl;
|