@plesk/ui-library 3.35.0 → 3.35.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/Button/Button.js +1 -2
- package/cjs/components/Carousel/Carousel.js +25 -39
- package/cjs/components/Drawer/Header.js +71 -108
- package/cjs/components/Form/Form.js +5 -7
- package/cjs/components/FormFieldCheckbox/FormFieldCheckbox.js +8 -67
- package/cjs/components/Grid/Grid.js +9 -71
- package/cjs/components/GridCol/GridCol.js +3 -54
- package/cjs/components/Icon/constants.js +2 -2
- package/cjs/components/Icon/images/symbols.svg +15 -1
- package/cjs/components/Link/Link.js +1 -2
- package/cjs/components/List/List.js +11 -8
- package/cjs/components/Progress/Progress.js +8 -28
- package/cjs/components/ProgressDialog/ProgressDialog.js +12 -85
- package/cjs/components/ProgressStep/ProgressStep.js +4 -46
- package/cjs/components/ProgressStep/index.js +36 -12
- package/cjs/components/Rating/Rating.js +5 -36
- package/cjs/components/Skeleton/index.js +2 -2
- package/cjs/components/SplitButton/SplitButton.js +1 -2
- package/cjs/components/Switch/Switch.js +43 -118
- package/cjs/components/SwitchesPanel/SwitchesPanel.js +3 -26
- package/cjs/components/SwitchesPanelItem/SwitchesPanelItem.js +3 -57
- package/cjs/components/Toaster/Toaster.js +3 -3
- package/cjs/components/Tooltip/Tooltip.js +35 -64
- package/cjs/components/Translate/Translate.js +10 -78
- package/cjs/components/Translate/index.js +4 -4
- package/cjs/components/Translate/isLikeText.js +27 -0
- package/cjs/components/index.js +14 -11
- package/cjs/index.js +1 -1
- package/cjs/tests/index.js +13 -0
- package/cjs/tests/renderer.js +33 -0
- package/dist/images/symbols.svg +15 -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 +567 -1139
- 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/Button/Button.js +1 -2
- package/esm/components/Carousel/Carousel.js +25 -37
- package/esm/components/Drawer/Header.js +70 -107
- package/esm/components/Form/Form.js +5 -7
- package/esm/components/FormFieldCheckbox/FormFieldCheckbox.js +8 -65
- package/esm/components/Grid/Grid.js +9 -69
- package/esm/components/GridCol/GridCol.js +2 -55
- package/esm/components/Icon/constants.js +2 -2
- package/esm/components/Icon/images/symbols.svg +15 -1
- package/esm/components/Link/Link.js +1 -2
- package/esm/components/List/List.js +11 -8
- package/esm/components/Progress/Progress.js +8 -26
- package/esm/components/ProgressDialog/ProgressDialog.js +12 -83
- package/esm/components/ProgressStep/ProgressStep.js +6 -48
- package/esm/components/ProgressStep/index.js +1 -2
- package/esm/components/Rating/Rating.js +5 -36
- package/esm/components/Skeleton/index.js +2 -2
- package/esm/components/SplitButton/SplitButton.js +1 -2
- package/esm/components/Switch/Switch.js +43 -116
- package/esm/components/SwitchesPanel/SwitchesPanel.js +3 -24
- package/esm/components/SwitchesPanelItem/SwitchesPanelItem.js +3 -55
- package/esm/components/Toaster/Toaster.js +3 -1
- package/esm/components/Tooltip/Tooltip.js +36 -62
- package/esm/components/Translate/Translate.js +9 -73
- package/esm/components/Translate/index.js +2 -1
- package/esm/components/Translate/isLikeText.js +19 -0
- package/esm/components/index.js +1 -2
- package/esm/index.js +1 -1
- package/esm/tests/index.js +3 -0
- package/esm/tests/renderer.js +25 -0
- package/package.json +25 -22
- package/styleguide/build/bundle.6318f4a5.js +2 -0
- package/styleguide/images/symbols.svg +15 -1
- package/styleguide/index.html +2 -2
- package/types/src/components/Button/Button.d.ts +2 -3
- package/types/src/components/Carousel/Carousel.d.ts +58 -0
- package/types/src/components/Carousel/index.d.ts +2 -0
- package/types/src/components/Dialog/Dialog.d.ts +1 -1
- package/types/src/components/Dialog/index.d.ts +1 -1
- package/types/src/components/Drawer/DrawerProgress.d.ts +3 -3
- package/types/src/components/Drawer/Header.d.ts +4 -20
- package/types/src/components/Form/Form.d.ts +5 -0
- package/types/src/components/FormFieldCheckbox/FormFieldCheckbox.d.ts +53 -0
- package/types/src/components/FormFieldCheckbox/index.d.ts +2 -0
- package/types/src/components/FormFieldPassword/generatePassword.d.ts +2 -0
- package/types/src/components/Grid/Grid.d.ts +97 -0
- package/types/src/components/Grid/index.d.ts +2 -0
- package/types/src/components/GridCol/GridCol.d.ts +53 -0
- package/types/src/components/GridCol/index.d.ts +2 -0
- package/types/src/components/Icon/constants.d.ts +1 -1
- package/types/src/components/ItemList/index.d.ts +1 -0
- package/types/src/components/Link/Link.d.ts +1 -2
- package/types/src/components/LocaleProvider/LocaleProvider.d.ts +1 -1
- package/types/src/components/Pagination/index.d.ts +1 -0
- package/types/src/components/Panel/index.d.ts +1 -0
- package/types/src/components/Progress/Progress.d.ts +49 -0
- package/types/src/components/Progress/index.d.ts +2 -0
- package/types/src/components/ProgressDialog/ProgressDialog.d.ts +125 -0
- package/types/src/components/ProgressDialog/index.d.ts +2 -0
- package/types/src/components/ProgressStep/ProgressStep.d.ts +69 -0
- package/types/src/components/ProgressStep/index.d.ts +2 -0
- package/types/src/components/Rating/Rating.d.ts +27 -0
- package/types/src/components/Rating/index.d.ts +2 -0
- package/types/src/components/Skeleton/Skeleton.d.ts +3 -5
- package/types/src/components/Skeleton/SkeletonTabs.d.ts +4 -4
- package/types/src/components/Skeleton/SkeletonText.d.ts +2 -2
- package/types/src/components/Skeleton/index.d.ts +4 -1
- package/types/src/components/SplitButton/SplitButton.d.ts +1 -2
- package/types/src/components/Switch/Switch.d.ts +58 -0
- package/types/src/components/Switch/index.d.ts +2 -0
- package/types/src/components/SwitchesPanel/SwitchesPanel.d.ts +24 -0
- package/types/src/components/SwitchesPanel/index.d.ts +2 -0
- package/types/src/components/SwitchesPanelItem/SwitchesPanelItem.d.ts +78 -0
- package/types/src/components/SwitchesPanelItem/index.d.ts +2 -0
- package/types/src/components/TextArea/index.d.ts +1 -0
- package/types/src/components/Tooltip/Tooltip.d.ts +61 -0
- package/types/src/components/Tooltip/index.d.ts +2 -0
- package/types/src/components/Translate/Translate.d.ts +56 -0
- package/types/src/components/Translate/index.d.ts +3 -0
- package/types/src/components/Translate/isLikeText.d.ts +2 -0
- package/types/src/components/index.d.ts +15 -2
- package/types/src/components/utils.d.ts +1 -1
- package/cjs/components/Alert/Alert.stories.js +0 -34
- package/cjs/components/Button/Button.stories.js +0 -109
- package/cjs/components/Cuttable/Cuttable.stories.js +0 -46
- package/cjs/components/Dialog/Dialog.stories.js +0 -49
- package/cjs/components/Drawer/Drawer.stories.js +0 -65
- package/cjs/components/Form/Form.stories.js +0 -35
- package/cjs/components/FormFieldCheckbox/FormFieldCheckbox.stories.js +0 -32
- package/cjs/components/Icon/Icon.stories.js +0 -32
- package/cjs/components/ItemLink/ItemLink.stories.js +0 -20
- package/cjs/components/ItemList/ItemList.stories.js +0 -122
- package/cjs/components/List/List.stories.js +0 -152
- package/cjs/components/Markdown/Markdown.stories.js +0 -51
- package/cjs/components/Menu/Menu.stories.js +0 -77
- package/cjs/components/Popover/Popover.stories.js +0 -60
- package/cjs/components/Select/Select.stories.js +0 -57
- package/cjs/components/Skeleton/Skeleton.stories.js +0 -24
- package/cjs/components/Skeleton/SkeletonTabs.stories.js +0 -15
- package/cjs/components/Skeleton/SkeletonText.stories.js +0 -33
- package/cjs/components/Status/Status.stories.js +0 -19
- package/cjs/components/Tabs/Tabs.stories.js +0 -24
- package/esm/components/Alert/Alert.stories.js +0 -27
- package/esm/components/Button/Button.stories.js +0 -99
- package/esm/components/Cuttable/Cuttable.stories.js +0 -39
- package/esm/components/Dialog/Dialog.stories.js +0 -42
- package/esm/components/Drawer/Drawer.stories.js +0 -56
- package/esm/components/Form/Form.stories.js +0 -27
- package/esm/components/FormFieldCheckbox/FormFieldCheckbox.stories.js +0 -23
- package/esm/components/Icon/Icon.stories.js +0 -23
- package/esm/components/ItemLink/ItemLink.stories.js +0 -12
- package/esm/components/ItemList/ItemList.stories.js +0 -109
- package/esm/components/List/List.stories.js +0 -139
- package/esm/components/Markdown/Markdown.stories.js +0 -43
- package/esm/components/Menu/Menu.stories.js +0 -65
- package/esm/components/Popover/Popover.stories.js +0 -52
- package/esm/components/Select/Select.stories.js +0 -48
- package/esm/components/Skeleton/Skeleton.stories.js +0 -15
- package/esm/components/Skeleton/SkeletonTabs.stories.js +0 -7
- package/esm/components/Skeleton/SkeletonText.stories.js +0 -23
- package/esm/components/Status/Status.stories.js +0 -11
- package/esm/components/Tabs/Tabs.stories.js +0 -16
- package/styleguide/build/bundle.2a886a79.js +0 -2
- package/types/src/components/Alert/Alert.stories.d.ts +0 -11
- package/types/src/components/Button/Button.stories.d.ts +0 -17
- package/types/src/components/Cuttable/Cuttable.stories.d.ts +0 -17
- package/types/src/components/Dialog/Dialog.stories.d.ts +0 -25
- package/types/src/components/Drawer/Drawer.stories.d.ts +0 -43
- package/types/src/components/Form/Form.stories.d.ts +0 -13
- package/types/src/components/FormFieldCheckbox/FormFieldCheckbox.stories.d.ts +0 -20
- package/types/src/components/Icon/Icon.stories.d.ts +0 -7
- package/types/src/components/ItemLink/ItemLink.stories.d.ts +0 -12
- package/types/src/components/ItemList/ItemList.stories.d.ts +0 -172
- package/types/src/components/List/List.stories.d.ts +0 -30
- package/types/src/components/Markdown/Markdown.stories.d.ts +0 -10
- package/types/src/components/Menu/Menu.stories.d.ts +0 -20
- package/types/src/components/Popover/Popover.stories.d.ts +0 -25
- package/types/src/components/Select/Select.stories.d.ts +0 -12
- package/types/src/components/Skeleton/Skeleton.stories.d.ts +0 -15
- package/types/src/components/Skeleton/SkeletonTabs.stories.d.ts +0 -5
- package/types/src/components/Skeleton/SkeletonText.stories.d.ts +0 -23
- package/types/src/components/Status/Status.stories.d.ts +0 -11
- package/types/src/components/Tabs/Tabs.stories.d.ts +0 -10
- /package/styleguide/build/{bundle.2a886a79.js.LICENSE.txt → bundle.6318f4a5.js.LICENSE.txt} +0 -0
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
3
2
|
|
|
4
|
-
import React, { Component } from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
3
|
import classNames from 'classnames';
|
|
7
4
|
import { CLS_PREFIX } from '../../constants';
|
|
8
5
|
import Tooltip from '../Tooltip';
|
|
@@ -13,120 +10,50 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
10
|
* It provides immediate results that is why it should not be used in Form.
|
|
14
11
|
* @since 0.0.42
|
|
15
12
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
children,
|
|
34
|
-
onChange,
|
|
35
|
-
tooltip,
|
|
36
|
-
intent,
|
|
37
|
-
checked,
|
|
38
|
-
defaultChecked,
|
|
39
|
-
disabled,
|
|
40
|
-
loading,
|
|
41
|
-
...props
|
|
42
|
-
} = this.props;
|
|
43
|
-
let result = /*#__PURE__*/_jsxs("label", {
|
|
44
|
-
className: classNames(baseClassName, {
|
|
45
|
-
[`${baseClassName}--${intent}`]: intent,
|
|
46
|
-
[`${baseClassName}--loading`]: loading
|
|
47
|
-
}, className),
|
|
48
|
-
...props,
|
|
49
|
-
children: [children ? /*#__PURE__*/_jsx("span", {
|
|
50
|
-
className: `${baseClassName}__label`,
|
|
51
|
-
children: children
|
|
52
|
-
}) : null, /*#__PURE__*/_jsx("input", {
|
|
53
|
-
type: "checkbox",
|
|
54
|
-
onChange: this.handleChange,
|
|
55
|
-
checked: checked,
|
|
56
|
-
defaultChecked: checked === null || checked === undefined ? defaultChecked : undefined,
|
|
57
|
-
disabled: disabled || loading
|
|
58
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
59
|
-
className: `${baseClassName}__indicator`
|
|
60
|
-
})]
|
|
61
|
-
});
|
|
62
|
-
if (tooltip) {
|
|
63
|
-
result = /*#__PURE__*/_jsx(Tooltip, {
|
|
64
|
-
title: tooltip,
|
|
65
|
-
children: result
|
|
66
|
-
});
|
|
13
|
+
const Switch = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
className,
|
|
16
|
+
children,
|
|
17
|
+
onChange,
|
|
18
|
+
tooltip,
|
|
19
|
+
intent,
|
|
20
|
+
checked,
|
|
21
|
+
defaultChecked,
|
|
22
|
+
baseClassName = `${CLS_PREFIX}switch`,
|
|
23
|
+
disabled = false,
|
|
24
|
+
loading = false,
|
|
25
|
+
...props
|
|
26
|
+
} = _ref;
|
|
27
|
+
const handleChange = event => {
|
|
28
|
+
if (!disabled && onChange) {
|
|
29
|
+
onChange(event.target.checked);
|
|
67
30
|
}
|
|
68
|
-
|
|
31
|
+
};
|
|
32
|
+
const result = /*#__PURE__*/_jsxs("label", {
|
|
33
|
+
className: classNames(baseClassName, {
|
|
34
|
+
[`${baseClassName}--${intent}`]: intent,
|
|
35
|
+
[`${baseClassName}--loading`]: loading
|
|
36
|
+
}, className),
|
|
37
|
+
...props,
|
|
38
|
+
children: [children ? /*#__PURE__*/_jsx("span", {
|
|
39
|
+
className: `${baseClassName}__label`,
|
|
40
|
+
children: children
|
|
41
|
+
}) : null, /*#__PURE__*/_jsx("input", {
|
|
42
|
+
type: "checkbox",
|
|
43
|
+
onChange: handleChange,
|
|
44
|
+
checked: checked,
|
|
45
|
+
defaultChecked: checked === null || checked === undefined ? defaultChecked : undefined,
|
|
46
|
+
disabled: disabled || loading
|
|
47
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
48
|
+
className: `${baseClassName}__indicator`
|
|
49
|
+
})]
|
|
50
|
+
});
|
|
51
|
+
if (tooltip) {
|
|
52
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
|
53
|
+
title: tooltip,
|
|
54
|
+
children: result
|
|
55
|
+
});
|
|
69
56
|
}
|
|
70
|
-
|
|
71
|
-
Switch.propTypes = {
|
|
72
|
-
/**
|
|
73
|
-
* Determine whether the `Switch` is checked.
|
|
74
|
-
* @since 0.0.42
|
|
75
|
-
*/
|
|
76
|
-
checked: PropTypes.bool,
|
|
77
|
-
/**
|
|
78
|
-
* @ignore
|
|
79
|
-
*/
|
|
80
|
-
defaultChecked: PropTypes.bool,
|
|
81
|
-
/**
|
|
82
|
-
* A callback function, can be executed when the checked state is changing.
|
|
83
|
-
* @since 0.0.42
|
|
84
|
-
*/
|
|
85
|
-
onChange: PropTypes.func,
|
|
86
|
-
/**
|
|
87
|
-
* Tooltip for component
|
|
88
|
-
* @since 0.0.42
|
|
89
|
-
*/
|
|
90
|
-
tooltip: PropTypes.any,
|
|
91
|
-
/**
|
|
92
|
-
* Visual intent color to apply to component.
|
|
93
|
-
* @since 0.3.0
|
|
94
|
-
*/
|
|
95
|
-
intent: PropTypes.oneOf(['warning', 'danger']),
|
|
96
|
-
/**
|
|
97
|
-
* Is `Switch` disabled?
|
|
98
|
-
* @since 0.0.42
|
|
99
|
-
*/
|
|
100
|
-
disabled: PropTypes.bool,
|
|
101
|
-
/**
|
|
102
|
-
* Loading indication
|
|
103
|
-
* @since 0.3.0
|
|
104
|
-
*/
|
|
105
|
-
loading: PropTypes.bool,
|
|
106
|
-
/**
|
|
107
|
-
* Label of the `Switch`
|
|
108
|
-
* @since 0.0.42
|
|
109
|
-
*/
|
|
110
|
-
children: PropTypes.node,
|
|
111
|
-
/**
|
|
112
|
-
* @ignore
|
|
113
|
-
*/
|
|
114
|
-
className: PropTypes.string,
|
|
115
|
-
/**
|
|
116
|
-
* @ignore
|
|
117
|
-
*/
|
|
118
|
-
baseClassName: PropTypes.string
|
|
119
|
-
};
|
|
120
|
-
Switch.defaultProps = {
|
|
121
|
-
checked: undefined,
|
|
122
|
-
defaultChecked: undefined,
|
|
123
|
-
onChange: undefined,
|
|
124
|
-
tooltip: undefined,
|
|
125
|
-
intent: undefined,
|
|
126
|
-
disabled: false,
|
|
127
|
-
loading: false,
|
|
128
|
-
children: undefined,
|
|
129
|
-
className: undefined,
|
|
130
|
-
baseClassName: `${CLS_PREFIX}switch`
|
|
57
|
+
return result;
|
|
131
58
|
};
|
|
132
59
|
export default Switch;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
3
|
+
import { Children, cloneElement } from 'react';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
5
|
import { CLS_PREFIX } from '../../constants';
|
|
7
6
|
import Section from '../Section';
|
|
@@ -12,7 +11,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
12
11
|
*/
|
|
13
12
|
const SwitchesPanel = _ref => {
|
|
14
13
|
let {
|
|
15
|
-
baseClassName
|
|
14
|
+
baseClassName = `${CLS_PREFIX}switches-panel`,
|
|
16
15
|
className,
|
|
17
16
|
children,
|
|
18
17
|
...props
|
|
@@ -22,30 +21,10 @@ const SwitchesPanel = _ref => {
|
|
|
22
21
|
...props,
|
|
23
22
|
children: /*#__PURE__*/_jsx("div", {
|
|
24
23
|
className: `${baseClassName}__items`,
|
|
25
|
-
children: Children.map(children, child => /*#__PURE__*/cloneElement(child, {
|
|
24
|
+
children: children && Children.map(children, child => /*#__PURE__*/cloneElement(child, {
|
|
26
25
|
className: classNames(child.props.className, `${baseClassName}__item`)
|
|
27
26
|
}))
|
|
28
27
|
})
|
|
29
28
|
});
|
|
30
29
|
};
|
|
31
|
-
SwitchesPanel.propTypes = {
|
|
32
|
-
/**
|
|
33
|
-
* Content of the `SwitchesPanel`. Recommended to use [SwitchesPanelItem](#!/SwitchesPanelItem) components.
|
|
34
|
-
* @since 0.3.0
|
|
35
|
-
*/
|
|
36
|
-
children: PropTypes.node,
|
|
37
|
-
/**
|
|
38
|
-
* @ignore
|
|
39
|
-
*/
|
|
40
|
-
className: PropTypes.string,
|
|
41
|
-
/**
|
|
42
|
-
* @ignore
|
|
43
|
-
*/
|
|
44
|
-
baseClassName: PropTypes.string
|
|
45
|
-
};
|
|
46
|
-
SwitchesPanel.defaultProps = {
|
|
47
|
-
children: null,
|
|
48
|
-
className: null,
|
|
49
|
-
baseClassName: `${CLS_PREFIX}switches-panel`
|
|
50
|
-
};
|
|
51
30
|
export default SwitchesPanel;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
4
|
+
import { Component } from 'react';
|
|
6
5
|
import classNames from 'classnames';
|
|
7
6
|
import { CLS_PREFIX } from '../../constants';
|
|
8
7
|
import Switch from '../Switch';
|
|
@@ -82,58 +81,7 @@ class SwitchesPanelItem extends Component {
|
|
|
82
81
|
});
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
|
-
SwitchesPanelItem
|
|
86
|
-
/**
|
|
87
|
-
* A callback function, can be executed when the checked state is changing.
|
|
88
|
-
* @since 0.3.0
|
|
89
|
-
*/
|
|
90
|
-
onChange: PropTypes.func.isRequired,
|
|
91
|
-
/**
|
|
92
|
-
* @ignore
|
|
93
|
-
*/
|
|
94
|
-
defaultChecked: PropTypes.bool,
|
|
95
|
-
/**
|
|
96
|
-
* Visual intent color to apply to component.
|
|
97
|
-
* @since 0.3.0
|
|
98
|
-
*/
|
|
99
|
-
intent: PropTypes.oneOf(['warning', 'danger']),
|
|
100
|
-
/**
|
|
101
|
-
* Title of the `SwitchesPanelItem`. Must be no longer than two lines.
|
|
102
|
-
* @since 0.3.0
|
|
103
|
-
*/
|
|
104
|
-
title: PropTypes.node.isRequired,
|
|
105
|
-
/**
|
|
106
|
-
* `SwitchesPanelItem` description. Must be no longer than three lines.
|
|
107
|
-
* @since 0.3.0
|
|
108
|
-
*/
|
|
109
|
-
description: PropTypes.node,
|
|
110
|
-
/**
|
|
111
|
-
* Rich full description of the `SwitchesPanelItem`.
|
|
112
|
-
* Adds control button with question mark that shows `Popover` on click.
|
|
113
|
-
* @since 0.3.0
|
|
114
|
-
*/
|
|
115
|
-
fullDescription: PropTypes.node,
|
|
116
|
-
/**
|
|
117
|
-
* Props of underlying [Switch](#!/Switch) component.
|
|
118
|
-
* @since 0.5.0
|
|
119
|
-
*/
|
|
120
|
-
switchProps: PropTypes.object,
|
|
121
|
-
/**
|
|
122
|
-
* Content of the control actions.
|
|
123
|
-
* Don't place here more than three buttons (with the one from 'fullDescription' property) or one link and one button.
|
|
124
|
-
* @since 0.3.0
|
|
125
|
-
*/
|
|
126
|
-
children: PropTypes.node,
|
|
127
|
-
/**
|
|
128
|
-
* @ignore
|
|
129
|
-
*/
|
|
130
|
-
className: PropTypes.string,
|
|
131
|
-
/**
|
|
132
|
-
* @ignore
|
|
133
|
-
*/
|
|
134
|
-
baseClassName: PropTypes.string
|
|
135
|
-
};
|
|
136
|
-
SwitchesPanelItem.defaultProps = {
|
|
84
|
+
_defineProperty(SwitchesPanelItem, "defaultProps", {
|
|
137
85
|
defaultChecked: false,
|
|
138
86
|
intent: null,
|
|
139
87
|
description: null,
|
|
@@ -142,5 +90,5 @@ SwitchesPanelItem.defaultProps = {
|
|
|
142
90
|
children: null,
|
|
143
91
|
className: null,
|
|
144
92
|
baseClassName: `${CLS_PREFIX}switches-panel-item`
|
|
145
|
-
};
|
|
93
|
+
});
|
|
146
94
|
export default SwitchesPanelItem;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
var _class;
|
|
2
3
|
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
3
4
|
|
|
4
5
|
import { render } from 'react-dom';
|
|
@@ -184,6 +185,7 @@ export default class Toaster extends Component {
|
|
|
184
185
|
});
|
|
185
186
|
}
|
|
186
187
|
}
|
|
188
|
+
_class = Toaster;
|
|
187
189
|
// eslint-disable-next-line react/sort-comp
|
|
188
190
|
_defineProperty(Toaster, "defaultProps", {
|
|
189
191
|
position: 'top-end',
|
|
@@ -194,7 +196,7 @@ _defineProperty(Toaster, "create", function () {
|
|
|
194
196
|
let container = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.body;
|
|
195
197
|
const containerElement = document.createElement('div');
|
|
196
198
|
container.appendChild(containerElement);
|
|
197
|
-
return render( /*#__PURE__*/_jsx(
|
|
199
|
+
return render( /*#__PURE__*/_jsx(_class, {
|
|
198
200
|
...props
|
|
199
201
|
}), containerElement);
|
|
200
202
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
3
3
|
|
|
4
|
-
import React, { cloneElement, Component, Fragment } from 'react';
|
|
5
4
|
import Layer from '../Layer';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
5
|
import classNames from 'classnames';
|
|
8
6
|
import { CLS_PREFIX, Z_INDEX_TOOLTIP } from '../../constants';
|
|
9
7
|
import { wrapFunction } from '../utils';
|
|
8
|
+
import { cloneElement, Component, createRef } from 'react';
|
|
10
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
12
|
const createRectFactory = (width, height) => (left, top) => ({
|
|
13
13
|
top,
|
|
@@ -84,7 +84,6 @@ const determinePosition = _ref => {
|
|
|
84
84
|
left: targetRect.left + X_EXTRA_SPACE
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
|
-
|
|
88
87
|
/**
|
|
89
88
|
* `Tooltip` component is used for providing information about an interface element
|
|
90
89
|
* while user hovers the pointer over the element.
|
|
@@ -99,42 +98,44 @@ class Tooltip extends Component {
|
|
|
99
98
|
ready: false,
|
|
100
99
|
visible: false
|
|
101
100
|
});
|
|
102
|
-
_defineProperty(this, "
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
_defineProperty(this, "timer", null);
|
|
102
|
+
_defineProperty(this, "tooltipRef", /*#__PURE__*/createRef());
|
|
103
|
+
_defineProperty(this, "clearTimer", () => {
|
|
104
|
+
if (this.timer) {
|
|
105
|
+
clearTimeout(this.timer);
|
|
106
|
+
this.timer = null;
|
|
106
107
|
}
|
|
108
|
+
});
|
|
109
|
+
_defineProperty(this, "handleShow", () => {
|
|
110
|
+
this.clearTimer();
|
|
107
111
|
this.setState({
|
|
108
112
|
visible: true
|
|
109
113
|
});
|
|
110
114
|
});
|
|
111
115
|
_defineProperty(this, "handleHide", () => {
|
|
112
|
-
|
|
113
|
-
clearTimeout(this.showTimer);
|
|
114
|
-
this.showTimer = null;
|
|
115
|
-
}
|
|
116
|
+
this.clearTimer();
|
|
116
117
|
this.setState({
|
|
117
118
|
visible: false,
|
|
118
119
|
ready: false
|
|
119
120
|
});
|
|
120
121
|
});
|
|
121
122
|
_defineProperty(this, "handleMouseEnter", () => {
|
|
122
|
-
if (this.
|
|
123
|
+
if (this.timer) {
|
|
123
124
|
return;
|
|
124
125
|
}
|
|
125
126
|
this.setState({
|
|
126
127
|
ready: true
|
|
127
128
|
});
|
|
128
|
-
this.
|
|
129
|
+
this.timer = setTimeout(() => this.handleShow(), this.props.delay);
|
|
129
130
|
});
|
|
130
131
|
_defineProperty(this, "handleMouseMove", e => {
|
|
131
132
|
// TODO: try to add throttle
|
|
132
|
-
if (this.
|
|
133
|
-
const targetRect = e.
|
|
133
|
+
if (this.tooltipRef.current) {
|
|
134
|
+
const targetRect = e.currentTarget.getBoundingClientRect();
|
|
134
135
|
const {
|
|
135
136
|
width: tooltipWidth,
|
|
136
137
|
height: tooltipHeight
|
|
137
|
-
} = this.
|
|
138
|
+
} = this.tooltipRef.current.getBoundingClientRect();
|
|
138
139
|
const position = determinePosition({
|
|
139
140
|
clientX: e.clientX,
|
|
140
141
|
clientY: e.clientY,
|
|
@@ -149,9 +150,14 @@ class Tooltip extends Component {
|
|
|
149
150
|
});
|
|
150
151
|
}
|
|
151
152
|
componentWillUnmount() {
|
|
152
|
-
|
|
153
|
+
this.clearTimer();
|
|
153
154
|
}
|
|
154
155
|
renderTooltip() {
|
|
156
|
+
const {
|
|
157
|
+
left,
|
|
158
|
+
top,
|
|
159
|
+
visible
|
|
160
|
+
} = this.state;
|
|
155
161
|
const {
|
|
156
162
|
baseClassName,
|
|
157
163
|
className,
|
|
@@ -161,17 +167,10 @@ class Tooltip extends Component {
|
|
|
161
167
|
delay,
|
|
162
168
|
...props
|
|
163
169
|
} = this.props;
|
|
164
|
-
const {
|
|
165
|
-
left,
|
|
166
|
-
top,
|
|
167
|
-
visible
|
|
168
|
-
} = this.state;
|
|
169
170
|
return /*#__PURE__*/_jsx(Layer, {
|
|
170
171
|
level: Z_INDEX_TOOLTIP,
|
|
171
172
|
children: /*#__PURE__*/_jsx("span", {
|
|
172
|
-
ref:
|
|
173
|
-
this.tooltipEl = el;
|
|
174
|
-
},
|
|
173
|
+
ref: this.tooltipRef,
|
|
175
174
|
className: classNames(baseClassName, className),
|
|
176
175
|
style: {
|
|
177
176
|
...style,
|
|
@@ -188,49 +187,24 @@ class Tooltip extends Component {
|
|
|
188
187
|
const {
|
|
189
188
|
ready
|
|
190
189
|
} = this.state;
|
|
191
|
-
|
|
192
|
-
children
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
190
|
+
const {
|
|
191
|
+
children
|
|
192
|
+
} = this.props;
|
|
193
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
194
|
+
children: [/*#__PURE__*/cloneElement(children, {
|
|
195
|
+
onMouseEnter: wrapFunction(children.props.onMouseEnter, this.handleMouseEnter),
|
|
196
|
+
onMouseMove: wrapFunction(children.props.onMouseMove, this.handleMouseMove),
|
|
197
|
+
onMouseLeave: wrapFunction(children.props.onMouseLeave, this.handleHide),
|
|
198
|
+
onMouseDown: wrapFunction(children.props.onMouseDown, this.handleHide)
|
|
197
199
|
}), ready && this.renderTooltip()]
|
|
198
200
|
});
|
|
199
201
|
}
|
|
200
202
|
}
|
|
201
|
-
Tooltip
|
|
202
|
-
|
|
203
|
-
* Content of the tooltip
|
|
204
|
-
* @since 0.0.42
|
|
205
|
-
*/
|
|
206
|
-
title: PropTypes.node.isRequired,
|
|
207
|
-
/**
|
|
208
|
-
* Show delay (ms)
|
|
209
|
-
* @since 0.0.50
|
|
210
|
-
*/
|
|
211
|
-
delay: PropTypes.number,
|
|
212
|
-
/**
|
|
213
|
-
* Element with tooltip
|
|
214
|
-
* @since 0.0.42
|
|
215
|
-
*/
|
|
216
|
-
children: PropTypes.element.isRequired,
|
|
217
|
-
/**
|
|
218
|
-
* @ignore
|
|
219
|
-
*/
|
|
220
|
-
style: PropTypes.object,
|
|
221
|
-
/**
|
|
222
|
-
* @ignore
|
|
223
|
-
*/
|
|
224
|
-
className: PropTypes.string,
|
|
225
|
-
/**
|
|
226
|
-
* @ignore
|
|
227
|
-
*/
|
|
228
|
-
baseClassName: PropTypes.string
|
|
229
|
-
};
|
|
230
|
-
Tooltip.defaultProps = {
|
|
203
|
+
_defineProperty(Tooltip, "defaultProps", {
|
|
204
|
+
// in ms.
|
|
231
205
|
delay: 550,
|
|
232
206
|
style: undefined,
|
|
233
207
|
className: undefined,
|
|
234
208
|
baseClassName: `${CLS_PREFIX}tooltip`
|
|
235
|
-
};
|
|
209
|
+
});
|
|
236
210
|
export default Tooltip;
|
|
@@ -1,32 +1,14 @@
|
|
|
1
1
|
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
2
2
|
|
|
3
|
-
import React, { isValidElement } from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
3
|
import { useTranslate } from '../LocaleProvider';
|
|
6
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
export const isLikeText = node => {
|
|
8
|
-
if (typeof node === 'string') {
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
if ( /*#__PURE__*/isValidElement(node) && node.type === Translate) {
|
|
12
|
-
const {
|
|
13
|
-
component,
|
|
14
|
-
children
|
|
15
|
-
} = node.props;
|
|
16
|
-
if (component === 'span' && (typeof children === 'string' || typeof children === 'undefined' || children === null)) {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return false;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
5
|
/**
|
|
24
6
|
* `Translate` component.
|
|
25
7
|
* @since 0.0.42
|
|
26
8
|
*/
|
|
27
9
|
const Translate = _ref => {
|
|
28
10
|
let {
|
|
29
|
-
component
|
|
11
|
+
component,
|
|
30
12
|
content,
|
|
31
13
|
children,
|
|
32
14
|
params,
|
|
@@ -36,8 +18,9 @@ const Translate = _ref => {
|
|
|
36
18
|
translators,
|
|
37
19
|
...props
|
|
38
20
|
} = _ref;
|
|
21
|
+
const Tag = component || 'span';
|
|
39
22
|
const translate = useTranslate(namespace);
|
|
40
|
-
const key = content || children;
|
|
23
|
+
const key = content || children || '';
|
|
41
24
|
const translator = translators && translators[key];
|
|
42
25
|
if (translator) {
|
|
43
26
|
if (typeof translator === 'function') {
|
|
@@ -46,65 +29,18 @@ const Translate = _ref => {
|
|
|
46
29
|
return translator;
|
|
47
30
|
}
|
|
48
31
|
const message = translate(key, params, fallback);
|
|
32
|
+
const tagProps = {
|
|
33
|
+
...props
|
|
34
|
+
};
|
|
49
35
|
if (unsafe) {
|
|
50
|
-
|
|
36
|
+
tagProps.dangerouslySetInnerHTML = {
|
|
51
37
|
__html: message
|
|
52
38
|
};
|
|
53
39
|
} else {
|
|
54
|
-
|
|
40
|
+
tagProps.children = message;
|
|
55
41
|
}
|
|
56
42
|
return /*#__PURE__*/_jsx(Tag, {
|
|
57
|
-
...
|
|
43
|
+
...tagProps
|
|
58
44
|
});
|
|
59
45
|
};
|
|
60
|
-
Translate.propTypes = {
|
|
61
|
-
/**
|
|
62
|
-
* A some prefix for the message key.
|
|
63
|
-
* @since 2.6.0
|
|
64
|
-
*/
|
|
65
|
-
namespace: PropTypes.string,
|
|
66
|
-
/**
|
|
67
|
-
* Translatable content or message key.
|
|
68
|
-
* @since 0.0.42
|
|
69
|
-
*/
|
|
70
|
-
content: PropTypes.string,
|
|
71
|
-
/**
|
|
72
|
-
* Message params
|
|
73
|
-
* @since 0.0.42
|
|
74
|
-
*/
|
|
75
|
-
params: PropTypes.object,
|
|
76
|
-
/**
|
|
77
|
-
* Fallback translation value.
|
|
78
|
-
* @since 0.0.47
|
|
79
|
-
*/
|
|
80
|
-
fallback: PropTypes.string,
|
|
81
|
-
/**
|
|
82
|
-
* Component to render as the root element. Useful when rendering a `Translate` as `<option>`.
|
|
83
|
-
* @since 0.0.42
|
|
84
|
-
*/
|
|
85
|
-
component: PropTypes.elementType,
|
|
86
|
-
/**
|
|
87
|
-
* A set of translation messages. If the set contains a message key, the component uses an item from the set for rendering.
|
|
88
|
-
* @ignore
|
|
89
|
-
*/
|
|
90
|
-
translators: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.func, PropTypes.node])),
|
|
91
|
-
/**
|
|
92
|
-
* @ignore
|
|
93
|
-
*/
|
|
94
|
-
unsafe: PropTypes.bool,
|
|
95
|
-
/**
|
|
96
|
-
* @ignore
|
|
97
|
-
*/
|
|
98
|
-
children: PropTypes.string
|
|
99
|
-
};
|
|
100
|
-
Translate.defaultProps = {
|
|
101
|
-
namespace: undefined,
|
|
102
|
-
content: undefined,
|
|
103
|
-
params: undefined,
|
|
104
|
-
component: 'span',
|
|
105
|
-
unsafe: undefined,
|
|
106
|
-
fallback: undefined,
|
|
107
|
-
children: undefined,
|
|
108
|
-
translators: undefined
|
|
109
|
-
};
|
|
110
46
|
export default Translate;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
2
|
+
|
|
3
|
+
import { isValidElement } from 'react';
|
|
4
|
+
import Translate from './Translate';
|
|
5
|
+
export const isLikeText = node => {
|
|
6
|
+
if (typeof node === 'string') {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
if ( /*#__PURE__*/isValidElement(node) && node.type === Translate) {
|
|
10
|
+
const {
|
|
11
|
+
component,
|
|
12
|
+
children
|
|
13
|
+
} = node.props;
|
|
14
|
+
if (typeof component === 'undefined' && (typeof children === 'string' || typeof children === 'undefined' || children === null)) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
};
|
package/esm/components/index.js
CHANGED
|
@@ -98,6 +98,5 @@ export { default as Tooltip } from './Tooltip';
|
|
|
98
98
|
export { default as Tour } from './Tour';
|
|
99
99
|
export { default as Translate } from './Translate';
|
|
100
100
|
export { default as Link } from './Link';
|
|
101
|
-
export { default as Skeleton } from './Skeleton';
|
|
102
|
-
export * from './Skeleton';
|
|
101
|
+
export { default as Skeleton, SkeletonTabs, SkeletonText } from './Skeleton';
|
|
103
102
|
export { PortalContext } from './Layer';
|
package/esm/index.js
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright 2023. Plesk International GmbH. All rights reserved.
|
|
2
|
+
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const renderer = (Component, baseProps) => propOverrides => {
|
|
7
|
+
const {
|
|
8
|
+
asFragment,
|
|
9
|
+
rerender
|
|
10
|
+
} = render( /*#__PURE__*/_jsx(Component, {
|
|
11
|
+
...baseProps,
|
|
12
|
+
...propOverrides
|
|
13
|
+
}));
|
|
14
|
+
return {
|
|
15
|
+
asFragment,
|
|
16
|
+
user: userEvent,
|
|
17
|
+
rerender: rerenderPropsOverrides => rerender( /*#__PURE__*/_jsx(Component, {
|
|
18
|
+
...baseProps,
|
|
19
|
+
...propOverrides,
|
|
20
|
+
...rerenderPropsOverrides
|
|
21
|
+
})),
|
|
22
|
+
...baseProps
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export default renderer;
|