@plesk/ui-library 3.25.6 → 3.27.0
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/README.md +35 -35
- package/cjs/components/Action/Action.js +3 -3
- package/cjs/components/Button/Button.js +50 -50
- package/cjs/components/Checkbox/Checkbox.js +3 -3
- package/cjs/components/CodeEditor/CodeEditor.js +40 -40
- package/cjs/components/Dialog/Dialog.js +63 -63
- package/cjs/components/Drawer/Drawer.js +100 -90
- package/cjs/components/Drawer/DrawerProgress.js +17 -14
- package/cjs/components/Drawer/Header.js +11 -4
- package/cjs/components/Form/Form.js +4 -4
- package/cjs/components/FormField/FormField.js +87 -82
- package/cjs/components/FormFieldCheckbox/FormFieldCheckbox.js +26 -26
- package/cjs/components/FormFieldPassword/FormFieldPassword.js +34 -34
- package/cjs/components/FormFieldRadioButtons/FormFieldRadioButtons.js +32 -32
- package/cjs/components/FormFieldSelect/FormFieldSelect.js +1 -1
- package/cjs/components/Icon/Icon.js +6 -6
- package/cjs/components/Icon/constants.js +2 -2
- package/cjs/components/Icon/images/symbols.svg +1653 -1639
- package/cjs/components/InputNumber/InputNumber.js +3 -3
- package/cjs/components/Item/Item.js +50 -41
- package/cjs/components/ItemLink/ItemLink.js +1 -0
- package/cjs/components/ItemList/ItemList.js +43 -12
- package/cjs/components/ItemList/ItemList.stories.js +35 -3
- package/cjs/components/Layout/Layout.js +55 -55
- package/cjs/components/List/List.js +139 -134
- package/cjs/components/LocaleProvider/LocaleProvider.js +3 -3
- package/cjs/components/Menu/MenuBaseItem.js +19 -19
- package/cjs/components/Overlay/Overlay.js +34 -34
- package/cjs/components/Pagination/Pagination.js +3 -3
- package/cjs/components/Panel/Panel.js +14 -4
- package/cjs/components/Popper/Popper.js +30 -30
- package/cjs/components/ProgressStep/ProgressStep.js +16 -14
- package/cjs/components/Section/Section.js +128 -68
- package/cjs/components/Select/Select.js +9 -9
- package/cjs/components/Select/SelectControl.js +1 -1
- package/cjs/components/Tabs/Tab.js +28 -28
- package/cjs/components/Tabs/Tabs.js +33 -33
- package/cjs/components/Translate/Translate.js +25 -25
- package/cjs/index.js +1 -1
- package/dist/images/symbols.svg +1653 -1639
- 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 +1116 -970
- 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/Action/Action.js +3 -3
- package/esm/components/Button/Button.js +50 -50
- package/esm/components/Checkbox/Checkbox.js +3 -3
- package/esm/components/CodeEditor/CodeEditor.js +40 -40
- package/esm/components/Dialog/Dialog.js +63 -63
- package/esm/components/Drawer/Drawer.js +100 -89
- package/esm/components/Drawer/DrawerProgress.js +16 -15
- package/esm/components/Drawer/Header.js +11 -4
- package/esm/components/Form/Form.js +4 -4
- package/esm/components/FormField/FormField.js +87 -82
- package/esm/components/FormFieldCheckbox/FormFieldCheckbox.js +26 -26
- package/esm/components/FormFieldPassword/FormFieldPassword.js +34 -34
- package/esm/components/FormFieldRadioButtons/FormFieldRadioButtons.js +32 -32
- package/esm/components/FormFieldSelect/FormFieldSelect.js +1 -1
- package/esm/components/Icon/Icon.js +6 -6
- package/esm/components/Icon/constants.js +2 -2
- package/esm/components/Icon/images/symbols.svg +1653 -1639
- package/esm/components/InputNumber/InputNumber.js +3 -3
- package/esm/components/Item/Item.js +50 -41
- package/esm/components/ItemLink/ItemLink.js +1 -0
- package/esm/components/ItemList/ItemList.js +43 -12
- package/esm/components/ItemList/ItemList.stories.js +32 -2
- package/esm/components/Layout/Layout.js +55 -55
- package/esm/components/List/List.js +139 -134
- package/esm/components/LocaleProvider/LocaleProvider.js +3 -3
- package/esm/components/Menu/MenuBaseItem.js +19 -19
- package/esm/components/Overlay/Overlay.js +34 -34
- package/esm/components/Pagination/Pagination.js +3 -3
- package/esm/components/Panel/Panel.js +14 -5
- package/esm/components/Popper/Popper.js +30 -30
- package/esm/components/ProgressStep/ProgressStep.js +17 -15
- package/esm/components/Section/Section.js +129 -72
- package/esm/components/Select/Select.js +9 -9
- package/esm/components/Select/SelectControl.js +1 -1
- package/esm/components/Tabs/Tab.js +28 -28
- package/esm/components/Tabs/Tabs.js +33 -33
- package/esm/components/Translate/Translate.js +25 -25
- package/esm/index.js +1 -1
- package/package.json +146 -146
- package/styleguide/build/bundle.ff1f903a.js +2 -0
- package/styleguide/build/{bundle.b7db9339.js.LICENSE.txt → bundle.ff1f903a.js.LICENSE.txt} +0 -0
- package/styleguide/images/symbols.svg +1653 -1639
- package/styleguide/index.html +6 -6
- package/types/src/components/Drawer/DrawerProgress.d.ts +7 -2
- package/types/src/components/Icon/constants.d.ts +1 -1
- package/types/src/components/ItemLink/ItemLink.d.ts +4 -0
- package/types/src/components/ItemLink/ItemLink.stories.d.ts +1 -0
- package/types/src/components/ItemList/ItemList.d.ts +8 -0
- package/types/src/components/ItemList/ItemList.stories.d.ts +104 -0
- package/styleguide/build/bundle.b7db9339.js +0 -2
|
@@ -17,6 +17,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
17
17
|
|
|
18
18
|
var _constants = require("../../constants");
|
|
19
19
|
|
|
20
|
+
var _reactTransitionGroup = require("react-transition-group");
|
|
21
|
+
|
|
20
22
|
var _Translate = require("../Translate");
|
|
21
23
|
|
|
22
24
|
var _Heading = _interopRequireDefault(require("../Heading"));
|
|
@@ -29,7 +31,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
29
31
|
|
|
30
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
33
|
|
|
32
|
-
// Copyright 1999-
|
|
34
|
+
// Copyright 1999-2021. Plesk International GmbH. All rights reserved.
|
|
33
35
|
|
|
34
36
|
/* eslint-disable react/no-deprecated */
|
|
35
37
|
|
|
@@ -92,13 +94,21 @@ class Panel extends _react.Component {
|
|
|
92
94
|
collapsed
|
|
93
95
|
} = this.state;
|
|
94
96
|
const handleToggle = collapsible ? this.handleToggle : undefined;
|
|
95
|
-
|
|
97
|
+
const rootRef = /*#__PURE__*/(0, _react.createRef)();
|
|
98
|
+
return /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.CSSTransition, {
|
|
99
|
+
classNames: `${baseClassName}-`,
|
|
100
|
+
in: !collapsed,
|
|
101
|
+
timeout: 300,
|
|
102
|
+
nodeRef: rootRef
|
|
103
|
+
}, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
|
|
96
104
|
className: (0, _classnames.default)(baseClassName, {
|
|
97
105
|
[`${baseClassName}--collapsible`]: collapsible,
|
|
98
106
|
[`${baseClassName}--collapsed`]: collapsed,
|
|
99
107
|
[`${baseClassName}--expanded`]: !collapsed
|
|
100
108
|
}, className)
|
|
101
|
-
}, props
|
|
109
|
+
}, props, {
|
|
110
|
+
ref: rootRef
|
|
111
|
+
}), title && /*#__PURE__*/_react.default.createElement("div", {
|
|
102
112
|
className: `${baseClassName}__header`,
|
|
103
113
|
onClick: handleToggle
|
|
104
114
|
}, (0, _Translate.isLikeText)(title) ? /*#__PURE__*/_react.default.createElement(_Heading.default, {
|
|
@@ -117,7 +127,7 @@ class Panel extends _react.Component {
|
|
|
117
127
|
onClick: handleToggle
|
|
118
128
|
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
119
129
|
className: `${baseClassName}__content`
|
|
120
|
-
}, children));
|
|
130
|
+
}, children)));
|
|
121
131
|
}
|
|
122
132
|
|
|
123
133
|
}
|
|
@@ -33,8 +33,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
33
33
|
|
|
34
34
|
/* eslint-disable react/no-deprecated */
|
|
35
35
|
|
|
36
|
-
/**
|
|
37
|
-
* `Popper` component.
|
|
36
|
+
/**
|
|
37
|
+
* `Popper` component.
|
|
38
38
|
*/
|
|
39
39
|
class Popper extends _react.Component {
|
|
40
40
|
constructor(...args) {
|
|
@@ -209,75 +209,75 @@ class Popper extends _react.Component {
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
Popper.propTypes = {
|
|
212
|
-
/**
|
|
213
|
-
* Whether show popper content.
|
|
212
|
+
/**
|
|
213
|
+
* Whether show popper content.
|
|
214
214
|
*/
|
|
215
215
|
show: _propTypes.default.bool,
|
|
216
216
|
|
|
217
|
-
/**
|
|
218
|
-
* Content of the `Popper`.
|
|
217
|
+
/**
|
|
218
|
+
* Content of the `Popper`.
|
|
219
219
|
*/
|
|
220
220
|
children: _propTypes.default.node,
|
|
221
221
|
|
|
222
|
-
/**
|
|
223
|
-
* Target for popper.
|
|
222
|
+
/**
|
|
223
|
+
* Target for popper.
|
|
224
224
|
*/
|
|
225
225
|
target: _propTypes.default.any.isRequired,
|
|
226
226
|
|
|
227
|
-
/**
|
|
228
|
-
* A React reference to the DOM element that needs for calculating the position of the popup.
|
|
227
|
+
/**
|
|
228
|
+
* A React reference to the DOM element that needs for calculating the position of the popup.
|
|
229
229
|
*/
|
|
230
230
|
targetRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
|
|
231
231
|
current: _propTypes.default.instanceOf(HTMLElement)
|
|
232
232
|
})]),
|
|
233
233
|
|
|
234
|
-
/**
|
|
235
|
-
* Arrow element of popper
|
|
234
|
+
/**
|
|
235
|
+
* Arrow element of popper
|
|
236
236
|
*/
|
|
237
237
|
arrow: _propTypes.default.element,
|
|
238
238
|
|
|
239
|
-
/**
|
|
240
|
-
* Placement for popper.
|
|
239
|
+
/**
|
|
240
|
+
* Placement for popper.
|
|
241
241
|
*/
|
|
242
242
|
placement: _propTypes.default.oneOf(['auto', 'auto-start', 'auto-end', 'auto-top', 'auto-right', 'auto-bottom', 'auto-left', 'top', 'top-start', 'top-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end']),
|
|
243
243
|
|
|
244
|
-
/**
|
|
245
|
-
* The behavior used to change the popper's placement.
|
|
244
|
+
/**
|
|
245
|
+
* The behavior used to change the popper's placement.
|
|
246
246
|
*/
|
|
247
247
|
behavior: _propTypes.default.oneOfType([_propTypes.default.oneOf(['flip', 'clockwise', 'counterclockwise']), _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
248
248
|
|
|
249
|
-
/**
|
|
250
|
-
* Shift your popper on both axis.
|
|
249
|
+
/**
|
|
250
|
+
* Shift your popper on both axis.
|
|
251
251
|
*/
|
|
252
252
|
offset: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
253
253
|
|
|
254
|
-
/**
|
|
255
|
-
* Update callback function
|
|
254
|
+
/**
|
|
255
|
+
* Update callback function
|
|
256
256
|
*/
|
|
257
257
|
onUpdate: _propTypes.default.func,
|
|
258
258
|
|
|
259
|
-
/**
|
|
260
|
-
* @ignore
|
|
259
|
+
/**
|
|
260
|
+
* @ignore
|
|
261
261
|
*/
|
|
262
262
|
className: _propTypes.default.string,
|
|
263
263
|
|
|
264
|
-
/**
|
|
265
|
-
* @ignore
|
|
264
|
+
/**
|
|
265
|
+
* @ignore
|
|
266
266
|
*/
|
|
267
267
|
baseClassName: _propTypes.default.string,
|
|
268
268
|
|
|
269
|
-
/**
|
|
270
|
-
* zIndex value.
|
|
269
|
+
/**
|
|
270
|
+
* zIndex value.
|
|
271
271
|
*/
|
|
272
272
|
zIndex: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
273
273
|
|
|
274
|
-
/**
|
|
275
|
-
* Boundaries element for preventOverflow property.
|
|
274
|
+
/**
|
|
275
|
+
* Boundaries element for preventOverflow property.
|
|
276
276
|
*/
|
|
277
277
|
boundariesElement: _propTypes.default.oneOfType([_propTypes.default.oneOf(['scrollParent', 'window', 'viewport']), _propTypes.default.instanceOf(HTMLElement)]),
|
|
278
278
|
|
|
279
|
-
/**
|
|
280
|
-
* @ignore
|
|
279
|
+
/**
|
|
280
|
+
* @ignore
|
|
281
281
|
*/
|
|
282
282
|
style: _propTypes.default.object
|
|
283
283
|
};
|
|
@@ -29,7 +29,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
29
29
|
|
|
30
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
31
|
|
|
32
|
-
// Copyright 1999-
|
|
32
|
+
// Copyright 1999-2021. Plesk International GmbH. All rights reserved.
|
|
33
33
|
const STATUS_NOT_STARTED = 'not_started';
|
|
34
34
|
exports.STATUS_NOT_STARTED = STATUS_NOT_STARTED;
|
|
35
35
|
const STATUS_RUNNING = 'running';
|
|
@@ -64,39 +64,39 @@ const ProgressStep = ({
|
|
|
64
64
|
switch (status) {
|
|
65
65
|
case STATUS_NOT_STARTED:
|
|
66
66
|
intent = 'inactive';
|
|
67
|
-
icon =
|
|
67
|
+
icon = 'dot';
|
|
68
68
|
break;
|
|
69
69
|
|
|
70
70
|
case STATUS_RUNNING:
|
|
71
|
-
intent =
|
|
72
|
-
icon =
|
|
71
|
+
intent = false;
|
|
72
|
+
icon = 'dot';
|
|
73
73
|
break;
|
|
74
74
|
|
|
75
75
|
case STATUS_DONE:
|
|
76
76
|
intent = 'success';
|
|
77
|
-
icon = 'check-mark';
|
|
77
|
+
icon = 'check-mark-circle-filled';
|
|
78
78
|
break;
|
|
79
79
|
|
|
80
80
|
case STATUS_WARNING:
|
|
81
81
|
intent = 'warning';
|
|
82
|
-
icon = 'triangle-exclamation-mark';
|
|
82
|
+
icon = 'triangle-exclamation-mark-filled';
|
|
83
83
|
break;
|
|
84
84
|
|
|
85
85
|
case STATUS_ERROR:
|
|
86
86
|
intent = 'danger';
|
|
87
|
-
icon = 'exclamation-mark-circle';
|
|
87
|
+
icon = 'exclamation-mark-circle-filled';
|
|
88
88
|
break;
|
|
89
89
|
|
|
90
90
|
case STATUS_CANCELED:
|
|
91
91
|
progress = 0;
|
|
92
92
|
intent = 'inactive';
|
|
93
|
-
icon = 'cross-mark';
|
|
93
|
+
icon = 'cross-mark-circle-filled';
|
|
94
94
|
break;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
icon = _Icon.default.create(icon, {
|
|
98
98
|
className: `${baseClassName}__icon`,
|
|
99
|
-
size: _Icon.
|
|
99
|
+
size: _Icon.ICON_SIZE_16,
|
|
100
100
|
intent
|
|
101
101
|
});
|
|
102
102
|
|
|
@@ -114,19 +114,21 @@ const ProgressStep = ({
|
|
|
114
114
|
className: `${baseClassName}__media`
|
|
115
115
|
}, icon), /*#__PURE__*/_react.default.createElement("div", {
|
|
116
116
|
className: `${baseClassName}__body`
|
|
117
|
-
}, (title || statusText) && /*#__PURE__*/_react.default.createElement("div", {
|
|
117
|
+
}, (title || statusText || _react.Children.toArray(children).length > 0) && /*#__PURE__*/_react.default.createElement("div", {
|
|
118
118
|
className: `${baseClassName}__labels`
|
|
119
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
120
|
+
className: `${baseClassName}__labels-body`
|
|
119
121
|
}, title && /*#__PURE__*/_react.default.createElement("div", {
|
|
120
122
|
className: `${baseClassName}__title`
|
|
121
|
-
}, title),
|
|
123
|
+
}, title), _react.Children.toArray(children).length ? /*#__PURE__*/_react.default.createElement("div", {
|
|
124
|
+
className: `${baseClassName}__content`
|
|
125
|
+
}, children) : null), statusText && /*#__PURE__*/_react.default.createElement("div", {
|
|
122
126
|
className: `${baseClassName}__status`
|
|
123
127
|
}, statusText)), STATUS_RUNNING === status && /*#__PURE__*/_react.default.createElement(_ProgressBar.default, {
|
|
124
128
|
className: `${baseClassName}__progress`,
|
|
125
129
|
intent: "info",
|
|
126
130
|
progress: progress
|
|
127
|
-
})
|
|
128
|
-
className: `${baseClassName}__content`
|
|
129
|
-
}, children) : null));
|
|
131
|
+
})));
|
|
130
132
|
};
|
|
131
133
|
|
|
132
134
|
ProgressStep.propTypes = {
|
|
@@ -29,6 +29,8 @@ var _Button = _interopRequireDefault(require("../Button"));
|
|
|
29
29
|
|
|
30
30
|
var _VerticalContext = _interopRequireWildcard(require("../VerticalContext"));
|
|
31
31
|
|
|
32
|
+
var _FormContext = _interopRequireDefault(require("../Form/FormContext"));
|
|
33
|
+
|
|
32
34
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
35
|
|
|
34
36
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -36,23 +38,29 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
36
38
|
// Copyright 1999-2020. Plesk International GmbH. All rights reserved.
|
|
37
39
|
|
|
38
40
|
/* eslint-disable react/no-deprecated */
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
return props.vertical;
|
|
42
|
-
}
|
|
41
|
+
const getErrorsForChildren = (form, children) => {
|
|
42
|
+
let errors = {};
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
_react.Children.forEach(children, child => {
|
|
45
|
+
if (! /*#__PURE__*/(0, _react.isValidElement)(child)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
* @since 0.0.54
|
|
54
|
-
*/
|
|
49
|
+
if (child.props.name) {
|
|
50
|
+
errors = { ...errors,
|
|
51
|
+
...form.getErrors(child.props.name)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
55
54
|
|
|
55
|
+
if (child.props.children) {
|
|
56
|
+
errors = { ...errors,
|
|
57
|
+
...getErrorsForChildren(form, child.props.children)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return errors;
|
|
63
|
+
};
|
|
56
64
|
|
|
57
65
|
class Section extends _react.Component {
|
|
58
66
|
constructor(...args) {
|
|
@@ -63,9 +71,7 @@ class Section extends _react.Component {
|
|
|
63
71
|
(0, _defineProperty2.default)(this, "handleResize", ({
|
|
64
72
|
bounds
|
|
65
73
|
}) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (vertical !== undefined) {
|
|
74
|
+
if (this.props.vertical !== undefined) {
|
|
69
75
|
return;
|
|
70
76
|
}
|
|
71
77
|
|
|
@@ -82,16 +88,24 @@ class Section extends _react.Component {
|
|
|
82
88
|
collapsed
|
|
83
89
|
}) => ({
|
|
84
90
|
collapsed: !collapsed
|
|
85
|
-
}))
|
|
91
|
+
}), () => {
|
|
92
|
+
if (this.props.onToggle) {
|
|
93
|
+
this.props.onToggle(this.state.collapsed);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
86
96
|
});
|
|
87
97
|
}
|
|
88
98
|
|
|
89
99
|
static getDerivedStateFromProps(props, state) {
|
|
90
100
|
const {
|
|
91
|
-
|
|
101
|
+
collapsible,
|
|
102
|
+
collapsed,
|
|
103
|
+
form,
|
|
104
|
+
children
|
|
92
105
|
} = props;
|
|
93
106
|
const {
|
|
94
|
-
prevCollapsed
|
|
107
|
+
prevCollapsed,
|
|
108
|
+
prevErrors
|
|
95
109
|
} = state;
|
|
96
110
|
const nextState = {};
|
|
97
111
|
|
|
@@ -100,6 +114,17 @@ class Section extends _react.Component {
|
|
|
100
114
|
}
|
|
101
115
|
|
|
102
116
|
nextState.prevCollapsed = collapsed;
|
|
117
|
+
|
|
118
|
+
if (collapsible && form) {
|
|
119
|
+
const errors = getErrorsForChildren(form, children);
|
|
120
|
+
|
|
121
|
+
if (JSON.stringify(errors) !== JSON.stringify(prevErrors) && Object.keys(errors).length > 0) {
|
|
122
|
+
nextState.collapsed = false;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
nextState.prevErrors = errors;
|
|
126
|
+
}
|
|
127
|
+
|
|
103
128
|
return nextState;
|
|
104
129
|
}
|
|
105
130
|
|
|
@@ -178,13 +203,14 @@ class Section extends _react.Component {
|
|
|
178
203
|
collapsed,
|
|
179
204
|
onTitleChange,
|
|
180
205
|
onClose,
|
|
206
|
+
onToggle,
|
|
181
207
|
buttons,
|
|
182
208
|
vertical: verticalProp,
|
|
183
209
|
children,
|
|
210
|
+
form,
|
|
184
211
|
...props
|
|
185
212
|
} = this.props;
|
|
186
|
-
|
|
187
|
-
vertical = vertical === undefined ? this.state.vertical : vertical;
|
|
213
|
+
const vertical = verticalProp === undefined ? this.state.vertical : verticalProp;
|
|
188
214
|
return /*#__PURE__*/_react.default.createElement(_VerticalContext.default.Provider, {
|
|
189
215
|
value: vertical
|
|
190
216
|
}, /*#__PURE__*/_react.default.createElement(_reactMeasure.default, {
|
|
@@ -221,85 +247,119 @@ class Section extends _react.Component {
|
|
|
221
247
|
|
|
222
248
|
}
|
|
223
249
|
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Title of the section.
|
|
227
|
-
* @since 0.0.54
|
|
250
|
+
const propTypes = {
|
|
251
|
+
/**
|
|
252
|
+
* Title of the section.
|
|
253
|
+
* @since 0.0.54
|
|
228
254
|
*/
|
|
229
255
|
title: _propTypes.default.node,
|
|
230
256
|
|
|
231
|
-
/**
|
|
232
|
-
* Visual intent color to apply to component.
|
|
233
|
-
* @since 0.0.54
|
|
257
|
+
/**
|
|
258
|
+
* Visual intent color to apply to component.
|
|
259
|
+
* @since 0.0.54
|
|
234
260
|
*/
|
|
235
261
|
intent: _propTypes.default.oneOf(['danger', 'warning', 'success', 'inactive']),
|
|
236
262
|
|
|
237
|
-
/**
|
|
238
|
-
* Is section collapsible.
|
|
239
|
-
* @since 0.0.54
|
|
263
|
+
/**
|
|
264
|
+
* Is section collapsible.
|
|
265
|
+
* @since 0.0.54
|
|
240
266
|
*/
|
|
241
267
|
collapsible: _propTypes.default.bool,
|
|
242
268
|
|
|
243
|
-
/**
|
|
244
|
-
* Is section collapsed now.
|
|
245
|
-
* @since 0.0.54
|
|
269
|
+
/**
|
|
270
|
+
* Is section collapsed now.
|
|
271
|
+
* @since 0.0.54
|
|
246
272
|
*/
|
|
247
273
|
collapsed: _propTypes.default.bool,
|
|
248
274
|
|
|
249
|
-
/**
|
|
250
|
-
* Event handler of title change with inline editing form.
|
|
251
|
-
* @since 0.0.54
|
|
275
|
+
/**
|
|
276
|
+
* Event handler of title change with inline editing form.
|
|
277
|
+
* @since 0.0.54
|
|
252
278
|
*/
|
|
253
279
|
onTitleChange: _propTypes.default.func,
|
|
254
280
|
|
|
255
|
-
/**
|
|
256
|
-
* Event handler of closing section with X-sign at the right.
|
|
257
|
-
* @since 0.0.54
|
|
281
|
+
/**
|
|
282
|
+
* Event handler of closing section with X-sign at the right.
|
|
283
|
+
* @since 0.0.54
|
|
258
284
|
*/
|
|
259
285
|
onClose: _propTypes.default.func,
|
|
260
286
|
|
|
261
|
-
/**
|
|
262
|
-
*
|
|
263
|
-
* @since
|
|
287
|
+
/**
|
|
288
|
+
* A callback executed when the section collapsing.
|
|
289
|
+
* @since 3.26.0
|
|
290
|
+
*/
|
|
291
|
+
onToggle: _propTypes.default.func,
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Array of custom section action button at the right.
|
|
295
|
+
* @since 0.0.54
|
|
264
296
|
*/
|
|
265
297
|
buttons: _propTypes.default.arrayOf(_propTypes.default.element),
|
|
266
298
|
|
|
267
|
-
/**
|
|
268
|
-
* Vertical or horizontal section view.
|
|
269
|
-
* Section view will be automatically switched if this parameter is not specified explicitly.
|
|
270
|
-
* @since 0.3.0
|
|
299
|
+
/**
|
|
300
|
+
* Vertical or horizontal section view.
|
|
301
|
+
* Section view will be automatically switched if this parameter is not specified explicitly.
|
|
302
|
+
* @since 0.3.0
|
|
271
303
|
*/
|
|
272
304
|
vertical: _propTypes.default.bool,
|
|
273
305
|
|
|
274
|
-
/**
|
|
275
|
-
* Content of the `Section`.
|
|
276
|
-
* @since 0.0.54
|
|
306
|
+
/**
|
|
307
|
+
* Content of the `Section`.
|
|
308
|
+
* @since 0.0.54
|
|
277
309
|
*/
|
|
278
310
|
children: _propTypes.default.node,
|
|
279
311
|
|
|
280
|
-
/**
|
|
281
|
-
* @ignore
|
|
312
|
+
/**
|
|
313
|
+
* @ignore
|
|
282
314
|
*/
|
|
283
315
|
className: _propTypes.default.string,
|
|
284
316
|
|
|
285
|
-
/**
|
|
286
|
-
* @ignore
|
|
317
|
+
/**
|
|
318
|
+
* @ignore
|
|
319
|
+
*/
|
|
320
|
+
baseClassName: _propTypes.default.string,
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* @ignore
|
|
287
324
|
*/
|
|
288
|
-
|
|
325
|
+
form: _propTypes.default.object
|
|
289
326
|
};
|
|
290
|
-
|
|
291
|
-
title:
|
|
292
|
-
intent:
|
|
327
|
+
const defaultProps = {
|
|
328
|
+
title: undefined,
|
|
329
|
+
intent: undefined,
|
|
293
330
|
collapsible: false,
|
|
294
331
|
collapsed: false,
|
|
295
|
-
onTitleChange:
|
|
296
|
-
onClose:
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
332
|
+
onTitleChange: undefined,
|
|
333
|
+
onClose: undefined,
|
|
334
|
+
onToggle: undefined,
|
|
335
|
+
buttons: undefined,
|
|
336
|
+
vertical: undefined,
|
|
337
|
+
children: undefined,
|
|
338
|
+
className: undefined,
|
|
339
|
+
baseClassName: `${_constants.CLS_PREFIX}section`,
|
|
340
|
+
form: undefined
|
|
302
341
|
};
|
|
303
|
-
Section.
|
|
304
|
-
|
|
342
|
+
Section.propTypes = propTypes;
|
|
343
|
+
Section.defaultProps = defaultProps;
|
|
344
|
+
/**
|
|
345
|
+
* `Section` component is used for dividing of complex content into groups for better readability
|
|
346
|
+
* and comprehension of the presented information.
|
|
347
|
+
* @since 0.0.54
|
|
348
|
+
*/
|
|
349
|
+
|
|
350
|
+
const SectionWrapper = props => {
|
|
351
|
+
const form = (0, _react.useContext)(_FormContext.default);
|
|
352
|
+
const verticalContext = (0, _react.useContext)(_VerticalContext.default);
|
|
353
|
+
const vertical = props.vertical === undefined ? verticalContext : props.vertical;
|
|
354
|
+
return /*#__PURE__*/_react.default.createElement(Section, (0, _extends2.default)({}, props, {
|
|
355
|
+
form: form,
|
|
356
|
+
vertical: vertical
|
|
357
|
+
}));
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
SectionWrapper.displayName = 'Section';
|
|
361
|
+
SectionWrapper.propTypes = propTypes;
|
|
362
|
+
SectionWrapper.defaultProps = defaultProps;
|
|
363
|
+
SectionWrapper.WrappedComponent = Section;
|
|
364
|
+
var _default = SectionWrapper;
|
|
305
365
|
exports.default = _default;
|
|
@@ -60,12 +60,12 @@ const collect = (children, options = [], group) => {
|
|
|
60
60
|
...props
|
|
61
61
|
} = child.props;
|
|
62
62
|
|
|
63
|
-
if (typeof value !== 'string' && typeof value !== 'number'
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
if (typeof value !== 'string' && typeof value !== 'number') {
|
|
64
|
+
if (typeof children === 'string' && children) {
|
|
65
|
+
value = children;
|
|
66
|
+
} else {
|
|
67
|
+
throw new Error('The value can only be a number or a string.');
|
|
68
|
+
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
let label;
|
|
@@ -118,9 +118,9 @@ const getNextValue = (value, prevValue) => {
|
|
|
118
118
|
return value;
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
-
/**
|
|
122
|
-
* `Select` component is used for making a choice among a set of related options.
|
|
123
|
-
* @since 2.3.0
|
|
121
|
+
/**
|
|
122
|
+
* `Select` component is used for making a choice among a set of related options.
|
|
123
|
+
* @since 2.3.0
|
|
124
124
|
*/
|
|
125
125
|
const Select = ({
|
|
126
126
|
id,
|
|
@@ -248,7 +248,7 @@ const SelectControl = /*#__PURE__*/(0, _react.forwardRef)(function SelectControl
|
|
|
248
248
|
"aria-hidden": "true",
|
|
249
249
|
focusable: "false"
|
|
250
250
|
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
251
|
-
d: "M.85 7.854a.498.498 0 1 1-.704-.704L3.296 4 .146.85A.498.498 0 0 1 .85.146L4 3.296 7.15.146a.498.498 0 0 1 .704.704L4.704 4l3.15 3.15a.498.498 0 0 1-.704.704L4 4.704.85 7.854z"
|
|
251
|
+
d: "M.85 7.854a.498.498 0 1 1-.704-.704L3.296 4 .146.85A.498.498 0 0 1 .85.146L4 3.296 7.15.146a.498.498 0 0 1\r .704.704L4.704 4l3.15 3.15a.498.498 0 0 1-.704.704L4 4.704.85 7.854z"
|
|
252
252
|
})))), /*#__PURE__*/_react.default.createElement("button", {
|
|
253
253
|
type: "button",
|
|
254
254
|
className: (0, _classnames.default)(`${baseClassName}__indicator`, `${baseClassName}__indicator--dropdown`),
|
|
@@ -15,58 +15,58 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
15
15
|
|
|
16
16
|
/* eslint-disable react/no-unused-prop-types */
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* `Tab` is an individual element of the [Tabs](#!/Tabs) component.
|
|
20
|
-
*
|
|
21
|
-
* Each `Tab` can display an icon near the tab name for easier identification.
|
|
22
|
-
* It can also display a [Label](#!/Label) next to the tab name for showing additional information about its content.
|
|
23
|
-
* You can make `Tabs` closeable, for example, if you are using them for opening and displaying files.
|
|
24
|
-
* @since 0.0.35
|
|
18
|
+
/**
|
|
19
|
+
* `Tab` is an individual element of the [Tabs](#!/Tabs) component.
|
|
20
|
+
*
|
|
21
|
+
* Each `Tab` can display an icon near the tab name for easier identification.
|
|
22
|
+
* It can also display a [Label](#!/Label) next to the tab name for showing additional information about its content.
|
|
23
|
+
* You can make `Tabs` closeable, for example, if you are using them for opening and displaying files.
|
|
24
|
+
* @since 0.0.35
|
|
25
25
|
*/
|
|
26
26
|
const Tab = ({
|
|
27
27
|
children
|
|
28
28
|
}) => /*#__PURE__*/_react.default.createElement("div", null, children);
|
|
29
29
|
|
|
30
30
|
Tab.propTypes = {
|
|
31
|
-
/**
|
|
32
|
-
* Tab title
|
|
33
|
-
* @since 0.0.35
|
|
31
|
+
/**
|
|
32
|
+
* Tab title
|
|
33
|
+
* @since 0.0.35
|
|
34
34
|
*/
|
|
35
35
|
title: _propTypes.default.node.isRequired,
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
* Label in tab title
|
|
39
|
-
* @since 0.0.42
|
|
37
|
+
/**
|
|
38
|
+
* Label in tab title
|
|
39
|
+
* @since 0.0.42
|
|
40
40
|
*/
|
|
41
41
|
label: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.element]),
|
|
42
42
|
|
|
43
|
-
/**
|
|
44
|
-
* Name of icon or Icon component for tab
|
|
45
|
-
* @since 0.0.42
|
|
43
|
+
/**
|
|
44
|
+
* Name of icon or Icon component for tab
|
|
45
|
+
* @since 0.0.42
|
|
46
46
|
*/
|
|
47
47
|
icon: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object, _propTypes.default.element]),
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* Activate callback.
|
|
51
|
-
* @since 0.0.43
|
|
49
|
+
/**
|
|
50
|
+
* Activate callback.
|
|
51
|
+
* @since 0.0.43
|
|
52
52
|
*/
|
|
53
53
|
onActivate: _propTypes.default.func,
|
|
54
54
|
|
|
55
|
-
/**
|
|
56
|
-
* Close callback
|
|
57
|
-
* @since 0.0.58
|
|
55
|
+
/**
|
|
56
|
+
* Close callback
|
|
57
|
+
* @since 0.0.58
|
|
58
58
|
*/
|
|
59
59
|
onClose: _propTypes.default.func,
|
|
60
60
|
|
|
61
|
-
/**
|
|
62
|
-
* Component to render as the root element.
|
|
63
|
-
* @since 2.5.1
|
|
61
|
+
/**
|
|
62
|
+
* Component to render as the root element.
|
|
63
|
+
* @since 2.5.1
|
|
64
64
|
*/
|
|
65
65
|
component: _propTypes.default.elementType,
|
|
66
66
|
|
|
67
|
-
/**
|
|
68
|
-
* Tab content
|
|
69
|
-
* @since 0.0.47
|
|
67
|
+
/**
|
|
68
|
+
* Tab content
|
|
69
|
+
* @since 0.0.47
|
|
70
70
|
*/
|
|
71
71
|
children: _propTypes.default.node
|
|
72
72
|
};
|