@plesk/ui-library 3.35.0 → 3.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/Icon/constants.js +2 -2
- package/cjs/components/Icon/images/symbols.svg +15 -1
- package/cjs/components/Progress/Progress.js +8 -28
- package/cjs/components/ProgressStep/ProgressStep.js +4 -46
- package/cjs/components/ProgressStep/index.js +36 -12
- package/cjs/components/Switch/Switch.js +43 -118
- 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/index.js +1 -1
- package/cjs/tests/index.js +13 -0
- package/cjs/tests/renderer.js +27 -0
- package/dist/.DS_Store +0 -0
- package/dist/images/default.svg +1 -0
- package/dist/images/filtered.svg +1 -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 +295 -468
- 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/Icon/constants.js +2 -2
- package/esm/components/Icon/images/symbols.svg +15 -1
- package/esm/components/Progress/Progress.js +8 -26
- package/esm/components/ProgressStep/ProgressStep.js +6 -48
- package/esm/components/ProgressStep/index.js +1 -2
- package/esm/components/Switch/Switch.js +43 -116
- 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/index.js +1 -1
- package/esm/tests/index.js +3 -0
- package/esm/tests/renderer.js +19 -0
- package/package.json +13 -9
- package/styleguide/build/bundle.edc3f2a1.js +2 -0
- package/styleguide/images/symbols.svg +15 -1
- package/styleguide/index.html +2 -2
- package/types/src/components/Drawer/DrawerProgress.d.ts +3 -3
- package/types/src/components/Icon/constants.d.ts +1 -1
- package/types/src/components/ItemList/index.d.ts +1 -0
- 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/ProgressStep/ProgressStep.d.ts +69 -0
- package/types/src/components/ProgressStep/index.d.ts +2 -0
- package/types/src/components/Switch/Switch.d.ts +58 -0
- package/types/src/components/Switch/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 +5 -0
- package/types/src/tests/index.d.ts +1 -0
- package/types/src/tests/renderer.d.ts +23 -0
- package/styleguide/build/bundle.2a886a79.js +0 -2
- /package/styleguide/build/{bundle.2a886a79.js.LICENSE.txt → bundle.edc3f2a1.js.LICENSE.txt} +0 -0
|
@@ -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/index.js
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
} = render( /*#__PURE__*/_jsx(Component, {
|
|
10
|
+
...baseProps,
|
|
11
|
+
...propOverrides
|
|
12
|
+
}));
|
|
13
|
+
return {
|
|
14
|
+
asFragment,
|
|
15
|
+
user: userEvent,
|
|
16
|
+
...baseProps
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default renderer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plesk/ui-library",
|
|
3
|
-
"version": "3.35.
|
|
3
|
+
"version": "3.35.1",
|
|
4
4
|
"description": "Plesk UI Library",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -69,6 +69,10 @@
|
|
|
69
69
|
"@csstools/postcss-logical-float-and-clear": "^1.0.1",
|
|
70
70
|
"@plesk/eslint-config": "^3.0.0",
|
|
71
71
|
"@plesk/stylelint-config": "^2.0.0",
|
|
72
|
+
"@testing-library/dom": "^9.3.1",
|
|
73
|
+
"@testing-library/jest-dom": "^5.17.0",
|
|
74
|
+
"@testing-library/react": "^12.1.5",
|
|
75
|
+
"@testing-library/user-event": "^12.8.3",
|
|
72
76
|
"@types/buble": "^0.20.1",
|
|
73
77
|
"@types/classnames": "2.3.1",
|
|
74
78
|
"@types/doctrine": "^0.0.5",
|
|
@@ -76,7 +80,7 @@
|
|
|
76
80
|
"@types/jest": "^24.9.1",
|
|
77
81
|
"@types/jest-image-snapshot": "^6.1.0",
|
|
78
82
|
"@types/marked": "^4.3.1",
|
|
79
|
-
"@types/node": "^16.18.
|
|
83
|
+
"@types/node": "^16.18.39",
|
|
80
84
|
"@types/react": "^17.0.62",
|
|
81
85
|
"@types/react-dom": "^17.0.20",
|
|
82
86
|
"@types/react-measure": "2.0.8",
|
|
@@ -94,20 +98,20 @@
|
|
|
94
98
|
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
95
99
|
"enzyme": "^3.11.0",
|
|
96
100
|
"enzyme-to-json": "^3.6.2",
|
|
97
|
-
"eslint": "^8.
|
|
98
|
-
"eslint-config-prettier": "^8.
|
|
99
|
-
"eslint-plugin-markdown": "^3.0.
|
|
101
|
+
"eslint": "^8.46.0",
|
|
102
|
+
"eslint-config-prettier": "^8.9.0",
|
|
103
|
+
"eslint-plugin-markdown": "^3.0.1",
|
|
100
104
|
"eslint-plugin-prettier": "^4.2.1",
|
|
101
105
|
"fs-extra": "^7.0.1",
|
|
102
106
|
"html-webpack-plugin": "^5.5.3",
|
|
103
107
|
"inquirer": "^3.3.0",
|
|
104
108
|
"jest": "^24.9.0",
|
|
105
109
|
"jest-dev-server": "^9.0.0",
|
|
106
|
-
"jest-image-snapshot": "^6.
|
|
110
|
+
"jest-image-snapshot": "^6.2.0",
|
|
107
111
|
"less": "^4.1.3",
|
|
108
112
|
"less-loader": "^11.1.3",
|
|
109
113
|
"mini-css-extract-plugin": "^2.7.6",
|
|
110
|
-
"postcss": "^8.4.
|
|
114
|
+
"postcss": "^8.4.27",
|
|
111
115
|
"postcss-less": "^6.0.0",
|
|
112
116
|
"postcss-loader": "^7.3.3",
|
|
113
117
|
"postcss-logical": "^6.2.0",
|
|
@@ -120,7 +124,7 @@
|
|
|
120
124
|
"rimraf": "^5.0.1",
|
|
121
125
|
"rtlcss": "^4.1.0",
|
|
122
126
|
"style-loader": "^3.3.3",
|
|
123
|
-
"stylelint": "^15.10.
|
|
127
|
+
"stylelint": "^15.10.2",
|
|
124
128
|
"stylelint-declaration-block-no-ignored-properties": "^2.7.0",
|
|
125
129
|
"stylelint-no-unsupported-browser-features": "^6.1.0",
|
|
126
130
|
"stylelint-prettier": "^3.0.0",
|
|
@@ -128,7 +132,7 @@
|
|
|
128
132
|
"svg-mixer": "^2.3.14",
|
|
129
133
|
"terser-webpack-plugin": "^5.3.9",
|
|
130
134
|
"typescript": "4.5.5",
|
|
131
|
-
"webpack": "^5.88.
|
|
135
|
+
"webpack": "^5.88.2",
|
|
132
136
|
"webpack-cli": "^5.1.4"
|
|
133
137
|
},
|
|
134
138
|
"peerDependencies": {
|