@plesk/ui-library 3.34.2 → 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.
Files changed (119) hide show
  1. package/cjs/components/ContentLoader/IconsLoader.js +1 -2
  2. package/cjs/components/Dropdown/Dropdown.js +0 -2
  3. package/cjs/components/Dropdown/index.js +15 -2
  4. package/cjs/components/Figure/Figure.js +1 -33
  5. package/cjs/components/Figure/index.js +15 -2
  6. package/cjs/components/Form/Form.js +3 -3
  7. package/cjs/components/Form/ScrollableElementFormContext.js +1 -1
  8. package/cjs/components/Form/index.js +19 -3
  9. package/cjs/components/FormFieldPassword/PasswordMeter.js +4 -4
  10. package/cjs/components/Icon/constants.js +2 -2
  11. package/cjs/components/Icon/images/symbols.svg +23 -1
  12. package/cjs/components/Link/Link.js +11 -18
  13. package/cjs/components/Overlay/Overlay.js +3 -4
  14. package/cjs/components/Popper/Popper.js +14 -79
  15. package/cjs/components/Popper/index.js +15 -2
  16. package/cjs/components/Progress/Progress.js +8 -28
  17. package/cjs/components/ProgressStep/ProgressStep.js +4 -46
  18. package/cjs/components/ProgressStep/index.js +36 -12
  19. package/cjs/components/Section/Section.js +1 -2
  20. package/cjs/components/Skeleton/SkeletonText.js +1 -1
  21. package/cjs/components/SplitButton/SplitButton.js +10 -49
  22. package/cjs/components/SplitButton/index.js +15 -2
  23. package/cjs/components/Switch/Switch.js +43 -118
  24. package/cjs/components/Tooltip/Tooltip.js +35 -64
  25. package/cjs/components/Translate/Translate.js +10 -78
  26. package/cjs/components/Translate/index.js +4 -4
  27. package/cjs/components/Translate/isLikeText.js +27 -0
  28. package/cjs/components/utils.js +1 -1
  29. package/cjs/index.js +1 -1
  30. package/cjs/tests/index.js +13 -0
  31. package/cjs/tests/renderer.js +27 -0
  32. package/dist/.DS_Store +0 -0
  33. package/dist/images/default.svg +1 -0
  34. package/dist/images/filtered.svg +1 -0
  35. package/dist/images/symbols.svg +23 -1
  36. package/dist/plesk-ui-library-rtl.css +1 -1
  37. package/dist/plesk-ui-library-rtl.css.map +1 -1
  38. package/dist/plesk-ui-library.css +1 -1
  39. package/dist/plesk-ui-library.css.map +1 -1
  40. package/dist/plesk-ui-library.js +472 -725
  41. package/dist/plesk-ui-library.js.map +1 -1
  42. package/dist/plesk-ui-library.min.js +5 -5
  43. package/dist/plesk-ui-library.min.js.map +1 -1
  44. package/esm/components/ContentLoader/IconsLoader.js +1 -2
  45. package/esm/components/Dropdown/Dropdown.js +0 -2
  46. package/esm/components/Dropdown/index.js +2 -1
  47. package/esm/components/Figure/Figure.js +1 -33
  48. package/esm/components/Figure/index.js +2 -1
  49. package/esm/components/Form/Form.js +3 -3
  50. package/esm/components/Form/ScrollableElementFormContext.js +1 -1
  51. package/esm/components/Form/index.js +1 -0
  52. package/esm/components/FormFieldPassword/PasswordMeter.js +4 -4
  53. package/esm/components/Icon/constants.js +2 -2
  54. package/esm/components/Icon/images/symbols.svg +23 -1
  55. package/esm/components/Link/Link.js +11 -18
  56. package/esm/components/Overlay/Overlay.js +3 -4
  57. package/esm/components/Popper/Popper.js +14 -79
  58. package/esm/components/Popper/index.js +2 -1
  59. package/esm/components/Progress/Progress.js +8 -26
  60. package/esm/components/ProgressStep/ProgressStep.js +6 -48
  61. package/esm/components/ProgressStep/index.js +1 -2
  62. package/esm/components/Section/Section.js +1 -2
  63. package/esm/components/Skeleton/SkeletonText.js +1 -1
  64. package/esm/components/SplitButton/SplitButton.js +10 -47
  65. package/esm/components/SplitButton/index.js +2 -1
  66. package/esm/components/Switch/Switch.js +43 -116
  67. package/esm/components/Tooltip/Tooltip.js +36 -62
  68. package/esm/components/Translate/Translate.js +9 -73
  69. package/esm/components/Translate/index.js +2 -1
  70. package/esm/components/Translate/isLikeText.js +19 -0
  71. package/esm/components/utils.js +1 -1
  72. package/esm/index.js +1 -1
  73. package/esm/tests/index.js +3 -0
  74. package/esm/tests/renderer.js +19 -0
  75. package/package.json +19 -18
  76. package/styleguide/build/bundle.edc3f2a1.js +2 -0
  77. package/styleguide/images/symbols.svg +23 -1
  78. package/styleguide/index.html +2 -2
  79. package/types/src/components/ButtonGroup/ButtonGroup.d.ts +2 -2
  80. package/types/src/components/Dialog/Dialog.d.ts +29 -9
  81. package/types/src/components/Drawer/Drawer.d.ts +10 -12
  82. package/types/src/components/Drawer/DrawerProgress.d.ts +3 -3
  83. package/types/src/components/Dropdown/Dropdown.d.ts +3 -4
  84. package/types/src/components/Dropdown/index.d.ts +2 -0
  85. package/types/src/components/Figure/Figure.d.ts +28 -0
  86. package/types/src/components/Figure/index.d.ts +2 -0
  87. package/types/src/components/Form/Form.d.ts +8 -103
  88. package/types/src/components/Form/ScrollableElementFormContext.d.ts +2 -0
  89. package/types/src/components/Form/index.d.ts +1 -0
  90. package/types/src/components/Form/types.d.ts +5 -3
  91. package/types/src/components/Icon/constants.d.ts +1 -1
  92. package/types/src/components/ItemList/index.d.ts +1 -0
  93. package/types/src/components/Link/Link.d.ts +14 -12
  94. package/types/src/components/Link/index.d.ts +1 -0
  95. package/types/src/components/Overlay/Overlay.d.ts +1 -1
  96. package/types/src/components/Pagination/index.d.ts +1 -0
  97. package/types/src/components/Panel/index.d.ts +1 -0
  98. package/types/src/components/Popper/Popper.d.ts +96 -0
  99. package/types/src/components/Popper/index.d.ts +2 -0
  100. package/types/src/components/Progress/Progress.d.ts +49 -0
  101. package/types/src/components/Progress/index.d.ts +2 -0
  102. package/types/src/components/ProgressStep/ProgressStep.d.ts +69 -0
  103. package/types/src/components/ProgressStep/index.d.ts +2 -0
  104. package/types/src/components/SplitButton/SplitButton.d.ts +53 -0
  105. package/types/src/components/SplitButton/index.d.ts +2 -0
  106. package/types/src/components/Switch/Switch.d.ts +58 -0
  107. package/types/src/components/Switch/index.d.ts +2 -0
  108. package/types/src/components/TextArea/index.d.ts +1 -0
  109. package/types/src/components/Tooltip/Tooltip.d.ts +61 -0
  110. package/types/src/components/Tooltip/index.d.ts +2 -0
  111. package/types/src/components/Translate/Translate.d.ts +56 -0
  112. package/types/src/components/Translate/index.d.ts +3 -0
  113. package/types/src/components/Translate/isLikeText.d.ts +2 -0
  114. package/types/src/components/index.d.ts +11 -0
  115. package/types/src/components/utils.d.ts +6 -4
  116. package/types/src/tests/index.d.ts +1 -0
  117. package/types/src/tests/renderer.d.ts +23 -0
  118. package/styleguide/build/bundle.70f167a3.js +0 -2
  119. /package/styleguide/build/{bundle.70f167a3.js.LICENSE.txt → bundle.edc3f2a1.js.LICENSE.txt} +0 -0
@@ -1,4 +1,3 @@
1
1
  // Copyright 1999-2023. Plesk International GmbH. All rights reserved.
2
2
 
3
- export { default } from './ProgressStep';
4
- export * from './ProgressStep';
3
+ export { default, STATUS_RUNNING, STATUS_DONE, STATUS_ERROR, STATUS_WARNING, STATUS_CANCELED, STATUS_NOT_STARTED } from './ProgressStep';
@@ -139,8 +139,7 @@ class Section extends Component {
139
139
  value: title,
140
140
  onChange: onTitleChange,
141
141
  onClick: e => {
142
- var _e$target$closest$que;
143
- (_e$target$closest$que = e.target.closest(`.${baseClassName}__header`).querySelector(`.${baseClassName}__control-button`)) === null || _e$target$closest$que === void 0 ? void 0 : _e$target$closest$que.click();
142
+ e.target.closest(`.${baseClassName}__header`).querySelector(`.${baseClassName}__control-button`)?.click();
144
143
  }
145
144
  });
146
145
  }
@@ -26,7 +26,7 @@ const SkeletonText = _ref => {
26
26
  // eslint-disable-next-line react/no-array-index-key
27
27
  , {
28
28
  ...lineProps,
29
- className: classNames(`${baseClassName}__line`, lineProps === null || lineProps === void 0 ? void 0 : lineProps.className)
29
+ className: classNames(`${baseClassName}__line`, lineProps?.className)
30
30
  }, key))
31
31
  });
32
32
  };
@@ -1,7 +1,6 @@
1
1
  // Copyright 1999-2023. Plesk International GmbH. All rights reserved.
2
2
 
3
- import React, { useRef } from 'react';
4
- import PropTypes from 'prop-types';
3
+ import { useRef } from 'react';
5
4
  import classNames from 'classnames';
6
5
  import { CLS_PREFIX } from '../../constants';
7
6
  import Button from '../Button';
@@ -32,25 +31,26 @@ const focusStrategy = {
32
31
  return container.children[1].querySelector('button');
33
32
  }
34
33
  };
35
-
36
34
  /**
37
35
  * `Split Button` is a combination of a standard [Button](#!/Button) with a [Dropdown](#!/Dropdown) menu.
38
36
  * It is used for grouping several related actions when one of the actions should be accessible immediately
39
37
  * because it is used more often than others.
40
- * @since 0.0.40
38
+ *
39
+ * Since: 0.0.40
41
40
  */
42
41
  const SplitButton = _ref => {
43
42
  let {
44
- baseClassName,
43
+ baseClassName = `${CLS_PREFIX}split-button`,
45
44
  className,
46
45
  menu,
47
46
  children,
48
- opened,
49
47
  onClick,
50
48
  onKeyDown,
49
+ icon,
50
+ size,
51
51
  ...props
52
52
  } = _ref;
53
- const rootRef = useRef();
53
+ const rootRef = useRef(null);
54
54
  const {
55
55
  focusNext,
56
56
  focusPrev
@@ -74,6 +74,8 @@ const SplitButton = _ref => {
74
74
  onKeyDown: handleKeyDown,
75
75
  ...props,
76
76
  children: [/*#__PURE__*/_jsx(Button, {
77
+ icon: icon,
78
+ size: size,
77
79
  tabIndex: 0,
78
80
  onClick: onClick,
79
81
  children: children
@@ -82,50 +84,11 @@ const SplitButton = _ref => {
82
84
  menu: menu,
83
85
  menuPlacement: "bottom-end",
84
86
  children: /*#__PURE__*/_jsx(Button, {
87
+ size: size,
85
88
  caret: true,
86
89
  tabIndex: -1
87
90
  })
88
91
  })]
89
92
  });
90
93
  };
91
- SplitButton.propTypes = {
92
- /**
93
- * @since 0.0.47
94
- */
95
- menu: PropTypes.any,
96
- /**
97
- * @since 0.0.47
98
- */
99
- opened: PropTypes.bool,
100
- /**
101
- * Content of the button group
102
- * @since 0.0.40
103
- */
104
- children: PropTypes.node,
105
- /**
106
- * @ignore
107
- */
108
- className: PropTypes.string,
109
- /**
110
- * @ignore
111
- */
112
- baseClassName: PropTypes.string,
113
- /**
114
- * @ignore
115
- */
116
- onClick: PropTypes.func,
117
- /**
118
- * @ignore
119
- */
120
- onKeyDown: PropTypes.func
121
- };
122
- SplitButton.defaultProps = {
123
- menu: null,
124
- opened: false,
125
- children: null,
126
- className: null,
127
- baseClassName: `${CLS_PREFIX}split-button`,
128
- onClick: undefined,
129
- onKeyDown: undefined
130
- };
131
94
  export default SplitButton;
@@ -1,3 +1,4 @@
1
1
  // Copyright 1999-2023. Plesk International GmbH. All rights reserved.
2
2
 
3
- export { default } from './SplitButton';
3
+ export { default } from './SplitButton';
4
+ export * from './SplitButton';
@@ -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
- class Switch extends Component {
17
- constructor() {
18
- super(...arguments);
19
- _defineProperty(this, "handleChange", event => {
20
- const {
21
- disabled,
22
- onChange
23
- } = this.props;
24
- if (!disabled && onChange) {
25
- onChange(event.target.checked);
26
- }
27
- });
28
- }
29
- render() {
30
- const {
31
- baseClassName,
32
- className,
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
- return result;
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,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, "handleShow", () => {
103
- if (this.showTimer) {
104
- clearTimeout(this.showTimer);
105
- this.showTimer = null;
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
- if (this.showTimer) {
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.showTimer) {
123
+ if (this.timer) {
123
124
  return;
124
125
  }
125
126
  this.setState({
126
127
  ready: true
127
128
  });
128
- this.showTimer = setTimeout(() => this.handleShow(), this.props.delay);
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.tooltipEl) {
133
- const targetRect = e.target.getBoundingClientRect();
133
+ if (this.tooltipRef.current) {
134
+ const targetRect = e.currentTarget.getBoundingClientRect();
134
135
  const {
135
136
  width: tooltipWidth,
136
137
  height: tooltipHeight
137
- } = this.tooltipEl.getBoundingClientRect();
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
- clearTimeout(this.showTimer);
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: el => {
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
- return /*#__PURE__*/_jsxs(Fragment, {
192
- children: [/*#__PURE__*/cloneElement(this.props.children, {
193
- onMouseEnter: wrapFunction(this.props.children.props.onMouseEnter, this.handleMouseEnter),
194
- onMouseMove: wrapFunction(this.props.children.props.onMouseMove, this.handleMouseMove),
195
- onMouseLeave: wrapFunction(this.props.children.props.onMouseLeave, this.handleHide),
196
- onMouseDown: wrapFunction(this.props.children.props.onMouseDown, this.handleHide)
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.propTypes = {
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: Tag,
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
- props.dangerouslySetInnerHTML = {
36
+ tagProps.dangerouslySetInnerHTML = {
51
37
  __html: message
52
38
  };
53
39
  } else {
54
- props.children = message;
40
+ tagProps.children = message;
55
41
  }
56
42
  return /*#__PURE__*/_jsx(Tag, {
57
- ...props
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;
@@ -1,3 +1,4 @@
1
1
  // Copyright 1999-2023. Plesk International GmbH. All rights reserved.
2
2
 
3
- export { default, isLikeText } from './Translate';
3
+ export { default } from './Translate';
4
+ export { isLikeText } from './isLikeText';
@@ -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
+ };
@@ -109,7 +109,7 @@ const createStrategy = () => {
109
109
  };
110
110
  };
111
111
  export const createFocusManager = function (containerRef) {
112
- let isFitForFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _node => true;
112
+ let isFitForFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => true;
113
113
  let strategy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createStrategy();
114
114
  const tryFocus = node => {
115
115
  if (isFitForFocus(node) && node instanceof HTMLElement) {
package/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Copyright 1999-2023. Plesk International GmbH. All rights reserved.
2
2
  import svg4everybody from 'svg4everybody';
3
- const version = "3.34.2";
3
+ const version = "3.35.1";
4
4
  export * from './publicPath';
5
5
  export { version };
6
6
  export * from './utils';
@@ -0,0 +1,3 @@
1
+ // Copyright 2023. Plesk International GmbH. All rights reserved.
2
+
3
+ export { default } from './renderer';
@@ -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;