@plesk/ui-library 3.40.3 → 3.40.5

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 (87) hide show
  1. package/cjs/components/Badge/Badge.js +3 -1
  2. package/cjs/components/ItemList/ItemList.js +1 -0
  3. package/cjs/components/LocaleProvider/LocaleProvider.js +2 -2
  4. package/cjs/components/SwitchesPanelItem/SwitchesPanelItem.js +48 -77
  5. package/cjs/hooks/useMutationObserver.js +30 -0
  6. package/cjs/hooks/useSqueeze.js +10 -0
  7. package/cjs/index.js +1 -1
  8. package/dist/plesk-ui-library-rtl.css +1 -1
  9. package/dist/plesk-ui-library-rtl.css.map +1 -1
  10. package/dist/plesk-ui-library.css +1 -1
  11. package/dist/plesk-ui-library.css.map +1 -1
  12. package/dist/plesk-ui-library.js +107 -83
  13. package/dist/plesk-ui-library.js.map +1 -1
  14. package/dist/plesk-ui-library.min.js +6 -6
  15. package/dist/plesk-ui-library.min.js.map +1 -1
  16. package/esm/components/Badge/Badge.js +3 -1
  17. package/esm/components/ItemList/ItemList.js +1 -0
  18. package/esm/components/LocaleProvider/LocaleProvider.js +1 -1
  19. package/esm/components/SwitchesPanelItem/SwitchesPanelItem.js +48 -77
  20. package/esm/hooks/useMutationObserver.js +23 -0
  21. package/esm/hooks/useSqueeze.js +10 -0
  22. package/esm/index.js +1 -1
  23. package/package.json +11 -11
  24. package/styleguide/build/bundle.f0d21187.js +2 -0
  25. package/styleguide/index.html +2 -2
  26. package/types/src/components/AutoClosable/AutoClosable.d.ts +2 -2
  27. package/types/src/components/CodeEditor/CodeEditor.d.ts +6 -4
  28. package/types/src/components/Drawer/DrawerProgress.d.ts +1 -1
  29. package/types/src/components/ExtendedStatusMessage/ExtendedStatusMessage.d.ts +1 -1
  30. package/types/src/components/ExtendedStatusMessage/ExtendedStatusMessageActions.d.ts +1 -1
  31. package/types/src/components/ExtendedStatusMessage/ExtendedStatusMessageDescription.d.ts +1 -1
  32. package/types/src/components/ExtendedStatusMessage/ExtendedStatusMessageSeparator.d.ts +1 -1
  33. package/types/src/components/ExtendedStatusMessage/ExtendedStatusMessageTitle.d.ts +1 -1
  34. package/types/src/components/ExtendedStatusMessage/index.d.ts +5 -0
  35. package/types/src/components/FormField/FormField.d.ts +2 -2
  36. package/types/src/components/FormFieldPassword/index.d.ts +1 -0
  37. package/types/src/components/Grid/Grid.d.ts +3 -3
  38. package/types/src/components/Heading/Heading.d.ts +1 -1
  39. package/types/src/components/Heading/index.d.ts +1 -0
  40. package/types/src/components/Hint/Hint.d.ts +1 -1
  41. package/types/src/components/Hint/index.d.ts +1 -0
  42. package/types/src/components/InputNumber/InputNumber.d.ts +5 -0
  43. package/types/src/components/ItemLink/ItemLink.d.ts +1 -1
  44. package/types/src/components/ItemLink/index.d.ts +1 -0
  45. package/types/src/components/ItemList/ItemList.d.ts +4 -4
  46. package/types/src/components/ItemList/index.d.ts +1 -0
  47. package/types/src/components/Label/Label.d.ts +3 -2
  48. package/types/src/components/Label/index.d.ts +1 -0
  49. package/types/src/components/Layout/Layout.d.ts +1 -1
  50. package/types/src/components/List/List.d.ts +27 -27
  51. package/types/src/components/LocaleProvider/LocaleProvider.d.ts +6 -1
  52. package/types/src/components/Markdown/index.d.ts +1 -0
  53. package/types/src/components/Menu/index.d.ts +1 -0
  54. package/types/src/components/PageHeader/PageHeader.d.ts +1 -1
  55. package/types/src/components/PageHeader/index.d.ts +1 -0
  56. package/types/src/components/Paragraph/Paragraph.d.ts +1 -1
  57. package/types/src/components/Paragraph/index.d.ts +1 -0
  58. package/types/src/components/Popover/Popover.d.ts +6 -4
  59. package/types/src/components/Popper/Popper.d.ts +3 -2
  60. package/types/src/components/Progress/Progress.d.ts +1 -1
  61. package/types/src/components/ProgressBar/ProgressBar.d.ts +1 -1
  62. package/types/src/components/ProgressBar/index.d.ts +1 -0
  63. package/types/src/components/ProgressDialog/ProgressDialog.d.ts +2 -2
  64. package/types/src/components/Section/Section.d.ts +1 -1
  65. package/types/src/components/SegmentedControl/SegmentedControl.d.ts +2 -1
  66. package/types/src/components/Select/Select.d.ts +1 -1
  67. package/types/src/components/Select/SelectOption.d.ts +1 -1
  68. package/types/src/components/Select/SelectOptionGroup.d.ts +1 -1
  69. package/types/src/components/Select/index.d.ts +3 -0
  70. package/types/src/components/Status/Status.d.ts +3 -3
  71. package/types/src/components/Status/index.d.ts +2 -0
  72. package/types/src/components/StatusMessage/index.d.ts +1 -0
  73. package/types/src/components/SwitchesPanelItem/SwitchesPanelItem.d.ts +5 -20
  74. package/types/src/components/Tabs/Tabs.d.ts +1 -1
  75. package/types/src/components/Text/Text.d.ts +1 -1
  76. package/types/src/components/Text/index.d.ts +1 -0
  77. package/types/src/components/Toaster/Toaster.d.ts +1 -1
  78. package/types/src/components/Toaster/index.d.ts +1 -0
  79. package/types/src/components/Toolbar/ToolbarExpander.d.ts +1 -1
  80. package/types/src/components/Toolbar/ToolbarItem.d.ts +1 -1
  81. package/types/src/components/Toolbar/index.d.ts +1 -0
  82. package/types/src/components/Tour/index.d.ts +1 -0
  83. package/types/src/components/Translate/Translate.d.ts +1 -1
  84. package/types/src/components/index.d.ts +21 -4
  85. package/types/src/hooks/useMutationObserver.d.ts +8 -0
  86. package/styleguide/build/bundle.bbdb5666.js +0 -2
  87. /package/styleguide/build/{bundle.bbdb5666.js.LICENSE.txt → bundle.f0d21187.js.LICENSE.txt} +0 -0
@@ -45,7 +45,9 @@ const Badge = _ref => {
45
45
  return /*#__PURE__*/_jsxs("div", {
46
46
  className: classNames(baseClassName, className),
47
47
  ...props,
48
- children: [children, label]
48
+ children: [/*#__PURE__*/_jsx("div", {
49
+ children: children
50
+ }), label]
49
51
  });
50
52
  };
51
53
  export default Badge;
@@ -135,6 +135,7 @@ class ItemList extends Component {
135
135
  let {
136
136
  baseClassName,
137
137
  children,
138
+ onSelect,
138
139
  ...props
139
140
  } = _ref3;
140
141
  return /*#__PURE__*/_jsx(Grid, {
@@ -56,7 +56,7 @@ function (key) {
56
56
  }
57
57
  return applyParams(message, params);
58
58
  };
59
- const LocaleContext = /*#__PURE__*/createContext(undefined);
59
+ export const LocaleContext = /*#__PURE__*/createContext(undefined);
60
60
  export const useTranslate = namespace => {
61
61
  const context = useContext(LocaleContext);
62
62
  return useCallback((key, params, fallback) => {
@@ -1,7 +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 { Component } from 'react';
5
3
  import classNames from 'classnames';
6
4
  import { CLS_PREFIX } from '../../constants';
7
5
  import Switch from '../Switch';
@@ -13,81 +11,54 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
11
  * Used in [SwitchesPanel](#!/SwitchesPanel).
14
12
  * @since 0.3.0
15
13
  */
16
- class SwitchesPanelItem extends Component {
17
- constructor() {
18
- super(...arguments);
19
- _defineProperty(this, "state", {
20
- checked: this.props.defaultChecked
21
- });
22
- _defineProperty(this, "handleChange", checked => {
23
- this.setState({
24
- checked
25
- });
26
- this.props.onChange(checked);
27
- });
28
- }
29
- render() {
30
- const {
31
- onChange,
32
- defaultChecked,
33
- intent,
34
- title,
35
- description,
36
- fullDescription,
37
- baseClassName,
38
- className,
39
- switchProps,
40
- children,
41
- ...props
42
- } = this.props;
43
- const {
44
- checked
45
- } = this.state;
46
- return /*#__PURE__*/_jsxs("div", {
47
- className: classNames(baseClassName, {
48
- [`${baseClassName}--${intent}`]: intent && checked
49
- }, className),
50
- ...props,
51
- children: [/*#__PURE__*/_jsx("h5", {
52
- className: `${baseClassName}__title`,
53
- children: title
54
- }), description && /*#__PURE__*/_jsx("p", {
55
- className: `${baseClassName}__description`,
56
- children: description
57
- }), /*#__PURE__*/_jsxs("div", {
58
- className: `${baseClassName}__actions`,
59
- children: [/*#__PURE__*/_jsx(Switch, {
60
- className: `${baseClassName}__switch`,
61
- intent: intent,
62
- onChange: this.handleChange,
63
- defaultChecked: defaultChecked,
64
- ...switchProps
65
- }), (fullDescription || children) && /*#__PURE__*/_jsxs("div", {
66
- className: `${baseClassName}__controls`,
67
- children: [children, fullDescription && /*#__PURE__*/_jsx(Popover, {
68
- intent: "info",
69
- target: /*#__PURE__*/_jsx(Action, {
70
- icon: "question-mark-circle",
71
- outerProps: {
72
- className: `${baseClassName}__full-description-toggle`
73
- }
74
- }),
75
- placement: "bottom",
76
- children: fullDescription
77
- })]
14
+ const SwitchesPanelItem = _ref => {
15
+ let {
16
+ onChange,
17
+ defaultChecked = false,
18
+ intent,
19
+ title,
20
+ description,
21
+ fullDescription,
22
+ className,
23
+ switchProps = {},
24
+ children,
25
+ baseClassName = `${CLS_PREFIX}switches-panel-item`,
26
+ ...props
27
+ } = _ref;
28
+ return /*#__PURE__*/_jsxs("div", {
29
+ className: classNames(baseClassName, {
30
+ [`${baseClassName}--${intent}`]: intent
31
+ }, className),
32
+ ...props,
33
+ children: [/*#__PURE__*/_jsx("h5", {
34
+ className: `${baseClassName}__title`,
35
+ children: title
36
+ }), description && /*#__PURE__*/_jsx("p", {
37
+ className: `${baseClassName}__description`,
38
+ children: description
39
+ }), /*#__PURE__*/_jsxs("div", {
40
+ className: `${baseClassName}__actions`,
41
+ children: [/*#__PURE__*/_jsx(Switch, {
42
+ className: `${baseClassName}__switch`,
43
+ intent: intent,
44
+ onChange: onChange,
45
+ defaultChecked: defaultChecked,
46
+ ...switchProps
47
+ }), (fullDescription || children) && /*#__PURE__*/_jsxs("div", {
48
+ className: `${baseClassName}__controls`,
49
+ children: [children, fullDescription && /*#__PURE__*/_jsx(Popover, {
50
+ intent: "info",
51
+ target: /*#__PURE__*/_jsx(Action, {
52
+ icon: "question-mark-circle",
53
+ outerProps: {
54
+ className: `${baseClassName}__full-description-toggle`
55
+ }
56
+ }),
57
+ placement: "bottom",
58
+ children: fullDescription
78
59
  })]
79
60
  })]
80
- });
81
- }
82
- }
83
- _defineProperty(SwitchesPanelItem, "defaultProps", {
84
- defaultChecked: false,
85
- intent: null,
86
- description: null,
87
- fullDescription: null,
88
- switchProps: {},
89
- children: null,
90
- className: null,
91
- baseClassName: `${CLS_PREFIX}switches-panel-item`
92
- });
61
+ })]
62
+ });
63
+ };
93
64
  export default SwitchesPanelItem;
@@ -0,0 +1,23 @@
1
+ // Copyright 1999-2023. Plesk International GmbH. All rights reserved.
2
+
3
+ import { useEffect, useRef } from 'react';
4
+ export const useMutationObserver = _ref => {
5
+ let {
6
+ ref,
7
+ onMutate,
8
+ options
9
+ } = _ref;
10
+ const onMutateRef = useRef(undefined);
11
+ onMutateRef.current = onMutate;
12
+ useEffect(() => {
13
+ if (!ref.current) return undefined;
14
+ if (typeof window === 'undefined' || !('MutationObserver' in window)) return undefined;
15
+ const observer = new MutationObserver(() => {
16
+ onMutateRef.current?.();
17
+ });
18
+ observer.observe(ref.current, options);
19
+ return () => {
20
+ observer.disconnect();
21
+ };
22
+ }, [ref, options]);
23
+ };
@@ -2,6 +2,11 @@
2
2
 
3
3
  import { useRef, useLayoutEffect, useState } from 'react';
4
4
  import { useResizeObserver } from './useResizeObserver';
5
+ import { useMutationObserver } from './useMutationObserver';
6
+ const MUTATION_OBSERVER_OPTIONS = {
7
+ subtree: true,
8
+ childList: true
9
+ };
5
10
  export const useSqueeze = _ref => {
6
11
  let {
7
12
  ref,
@@ -38,4 +43,9 @@ export const useSqueeze = _ref => {
38
43
  ref,
39
44
  onResize: check
40
45
  });
46
+ useMutationObserver({
47
+ ref,
48
+ onMutate: check,
49
+ options: MUTATION_OBSERVER_OPTIONS
50
+ });
41
51
  };
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.40.3";
3
+ const version = "3.40.5";
4
4
  export * from './publicPath';
5
5
  export { version };
6
6
  export * from './utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plesk/ui-library",
3
- "version": "3.40.3",
3
+ "version": "3.40.5",
4
4
  "description": "Plesk UI Library",
5
5
  "main": "index.js",
6
6
  "module": "esm/index.js",
@@ -43,7 +43,7 @@
43
43
  "/index.js"
44
44
  ],
45
45
  "dependencies": {
46
- "@babel/runtime": "^7.24.6",
46
+ "@babel/runtime": "^7.24.7",
47
47
  "@plesk/react-movable": "^2.7.1",
48
48
  "classnames": "^2.5.1",
49
49
  "codemirror": "5.58.2",
@@ -59,19 +59,19 @@
59
59
  "use-focus-visible": "^1.0.2"
60
60
  },
61
61
  "devDependencies": {
62
- "@babel/core": "^7.24.6",
62
+ "@babel/core": "^7.24.7",
63
63
  "@babel/plugin-proposal-class-properties": "^7.18.6",
64
64
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
65
- "@babel/plugin-transform-runtime": "^7.24.6",
66
- "@babel/preset-env": "^7.24.6",
67
- "@babel/preset-react": "^7.24.6",
68
- "@babel/preset-typescript": "^7.24.6",
69
- "@babel/types": "^7.24.6",
65
+ "@babel/plugin-transform-runtime": "^7.24.7",
66
+ "@babel/preset-env": "^7.24.7",
67
+ "@babel/preset-react": "^7.24.7",
68
+ "@babel/preset-typescript": "^7.24.7",
69
+ "@babel/types": "^7.24.7",
70
70
  "@csstools/postcss-logical-float-and-clear": "^1.0.1",
71
71
  "@plesk/eslint-config": "^3.0.0",
72
72
  "@plesk/stylelint-config": "^2.0.0",
73
73
  "@testing-library/dom": "^9.3.4",
74
- "@testing-library/jest-dom": "^6.4.5",
74
+ "@testing-library/jest-dom": "^6.4.6",
75
75
  "@testing-library/react": "^14.3.1",
76
76
  "@testing-library/user-event": "^14.5.2",
77
77
  "@types/buble": "^0.20.5",
@@ -81,7 +81,7 @@
81
81
  "@types/jest": "^29.5.12",
82
82
  "@types/jest-image-snapshot": "^6.4.0",
83
83
  "@types/marked": "^4.3.2",
84
- "@types/node": "^16.18.97",
84
+ "@types/node": "^16.18.98",
85
85
  "@types/react": "^18.3.3",
86
86
  "@types/react-dom": "^18.3.0",
87
87
  "@types/react-measure": "2.0.9",
@@ -129,7 +129,7 @@
129
129
  "svg-mixer": "^2.3.14",
130
130
  "terser-webpack-plugin": "^5.3.10",
131
131
  "typescript": "5.2.2",
132
- "webpack": "^5.91.0",
132
+ "webpack": "^5.92.0",
133
133
  "webpack-cli": "^5.1.4"
134
134
  },
135
135
  "peerDependencies": {