@plesk/ui-library 3.38.2 → 3.40.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.
Files changed (93) hide show
  1. package/cjs/components/Button/Button.js +4 -22
  2. package/cjs/components/Card/CardButton.js +2 -3
  3. package/cjs/components/CardList/CardListToolbar.js +3 -8
  4. package/cjs/components/Dialog/Dialog.js +5 -27
  5. package/cjs/components/Drawer/Drawer.js +7 -20
  6. package/cjs/components/Dropdown/Dropdown.js +3 -11
  7. package/cjs/components/FormField/FormField.js +13 -26
  8. package/cjs/components/Icon/constants.js +2 -2
  9. package/cjs/components/Icon/images/symbols.svg +9 -1
  10. package/cjs/components/List/List.js +1 -14
  11. package/cjs/components/Progress/Progress.js +6 -5
  12. package/cjs/components/ProgressStep/ProgressStep.js +5 -14
  13. package/cjs/components/ProgressStep/index.js +6 -0
  14. package/cjs/components/Section/Section.js +11 -19
  15. package/cjs/components/SplitButton/SplitButton.js +2 -3
  16. package/cjs/components/TextArea/TextArea.js +49 -97
  17. package/cjs/components/TextArea/calculateNodeHeight.js +8 -8
  18. package/cjs/components/Toolbar/RegistryContextBeta.js +112 -0
  19. package/cjs/components/Toolbar/Toolbar.js +46 -2
  20. package/cjs/components/Toolbar/ToolbarBetaProvider.js +23 -0
  21. package/cjs/components/Toolbar/ToolbarGroup.js +66 -4
  22. package/cjs/components/Toolbar/ToolbarItem.js +27 -12
  23. package/cjs/components/Toolbar/ToolbarMenu.js +2 -1
  24. package/cjs/components/Toolbar/index.js +8 -1
  25. package/cjs/components/index.js +15 -1
  26. package/cjs/hooks/index.js +12 -0
  27. package/cjs/hooks/useResizeObserver.js +29 -0
  28. package/cjs/hooks/useSqueeze.js +48 -0
  29. package/cjs/index.js +1 -1
  30. package/dist/images/symbols.svg +9 -1
  31. package/dist/plesk-ui-library-rtl.css +1 -1
  32. package/dist/plesk-ui-library-rtl.css.map +1 -1
  33. package/dist/plesk-ui-library.css +1 -1
  34. package/dist/plesk-ui-library.css.map +1 -1
  35. package/dist/plesk-ui-library.js +591 -309
  36. package/dist/plesk-ui-library.js.map +1 -1
  37. package/dist/plesk-ui-library.min.js +5 -5
  38. package/dist/plesk-ui-library.min.js.map +1 -1
  39. package/esm/components/Button/Button.js +3 -21
  40. package/esm/components/Card/CardButton.js +2 -3
  41. package/esm/components/CardList/CardListToolbar.js +3 -8
  42. package/esm/components/Dialog/Dialog.js +5 -27
  43. package/esm/components/Drawer/Drawer.js +7 -20
  44. package/esm/components/Dropdown/Dropdown.js +3 -11
  45. package/esm/components/FormField/FormField.js +13 -26
  46. package/esm/components/Icon/constants.js +2 -2
  47. package/esm/components/Icon/images/symbols.svg +9 -1
  48. package/esm/components/List/List.js +1 -14
  49. package/esm/components/Progress/Progress.js +7 -6
  50. package/esm/components/ProgressStep/ProgressStep.js +4 -13
  51. package/esm/components/ProgressStep/index.js +1 -1
  52. package/esm/components/Section/Section.js +11 -19
  53. package/esm/components/SplitButton/SplitButton.js +2 -3
  54. package/esm/components/TextArea/TextArea.js +50 -98
  55. package/esm/components/TextArea/calculateNodeHeight.js +8 -8
  56. package/esm/components/Toolbar/RegistryContextBeta.js +103 -0
  57. package/esm/components/Toolbar/Toolbar.js +47 -3
  58. package/esm/components/Toolbar/ToolbarBetaProvider.js +16 -0
  59. package/esm/components/Toolbar/ToolbarGroup.js +67 -5
  60. package/esm/components/Toolbar/ToolbarItem.js +27 -12
  61. package/esm/components/Toolbar/ToolbarMenu.js +2 -1
  62. package/esm/components/Toolbar/index.js +2 -1
  63. package/esm/components/index.js +2 -2
  64. package/esm/hooks/index.js +3 -0
  65. package/esm/hooks/useResizeObserver.js +22 -0
  66. package/esm/hooks/useSqueeze.js +41 -0
  67. package/esm/index.js +1 -1
  68. package/package.json +13 -13
  69. package/styleguide/build/bundle.8f00c54c.js +2 -0
  70. package/styleguide/images/symbols.svg +9 -1
  71. package/styleguide/index.html +2 -2
  72. package/types/src/components/Button/Button.d.ts +1 -0
  73. package/types/src/components/Dialog/Dialog.d.ts +1 -25
  74. package/types/src/components/Drawer/Drawer.d.ts +1 -4
  75. package/types/src/components/FormField/FormField.d.ts +1 -23
  76. package/types/src/components/Icon/constants.d.ts +1 -1
  77. package/types/src/components/ProgressStep/ProgressStep.d.ts +2 -13
  78. package/types/src/components/ProgressStep/index.d.ts +1 -1
  79. package/types/src/components/Section/Section.d.ts +2 -32
  80. package/types/src/components/TextArea/TextArea.d.ts +5 -32
  81. package/types/src/components/TextArea/calculateNodeHeight.d.ts +2 -6
  82. package/types/src/components/Toolbar/RegistryContextBeta.d.ts +25 -0
  83. package/types/src/components/Toolbar/Toolbar.d.ts +2 -22
  84. package/types/src/components/Toolbar/ToolbarBetaProvider.d.ts +5 -0
  85. package/types/src/components/Toolbar/ToolbarGroup.d.ts +2 -5
  86. package/types/src/components/Toolbar/ToolbarItem.d.ts +1 -1
  87. package/types/src/components/Toolbar/index.d.ts +1 -0
  88. package/types/src/components/index.d.ts +2 -2
  89. package/types/src/hooks/index.d.ts +1 -0
  90. package/types/src/hooks/useResizeObserver.d.ts +7 -0
  91. package/types/src/hooks/useSqueeze.d.ts +10 -0
  92. package/styleguide/build/bundle.42040fbd.js +0 -2
  93. /package/styleguide/build/{bundle.42040fbd.js.LICENSE.txt → bundle.8f00c54c.js.LICENSE.txt} +0 -0
@@ -0,0 +1,41 @@
1
+ // Copyright 1999-2023. Plesk International GmbH. All rights reserved.
2
+
3
+ import { useRef, useLayoutEffect, useState } from 'react';
4
+ import { useResizeObserver } from './useResizeObserver';
5
+ export const useSqueeze = _ref => {
6
+ let {
7
+ ref,
8
+ compact,
9
+ expand
10
+ } = _ref;
11
+ const minWidth = useRef(0);
12
+ const lastAction = useRef(null);
13
+ const [recheck, setRecheck] = useState(false);
14
+ const checkRef = useRef();
15
+ const check = () => {
16
+ if (!ref.current) return;
17
+ const root = ref.current;
18
+ const width = Math.ceil(root.getBoundingClientRect().width);
19
+ const scrollWidth = Math.floor(root.scrollWidth);
20
+ let isCompactChanged = false;
21
+ if (scrollWidth > width) {
22
+ isCompactChanged = compact();
23
+ minWidth.current = scrollWidth;
24
+ lastAction.current = 'compact';
25
+ } else if (minWidth.current && width > minWidth.current || lastAction.current === 'expand') {
26
+ isCompactChanged = expand();
27
+ lastAction.current = 'expand';
28
+ }
29
+ if (isCompactChanged) {
30
+ setRecheck(c => !c);
31
+ }
32
+ };
33
+ checkRef.current = check;
34
+ useLayoutEffect(() => {
35
+ checkRef.current?.();
36
+ }, [recheck]);
37
+ useResizeObserver({
38
+ ref,
39
+ onResize: check
40
+ });
41
+ };
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.38.2";
3
+ const version = "3.40.0";
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.38.2",
3
+ "version": "3.40.0",
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.4",
46
+ "@babel/runtime": "^7.24.5",
47
47
  "@plesk/react-movable": "^2.7.1",
48
48
  "classnames": "^2.5.1",
49
49
  "codemirror": "5.58.2",
@@ -59,20 +59,20 @@
59
59
  "use-focus-visible": "^1.0.2"
60
60
  },
61
61
  "devDependencies": {
62
- "@babel/core": "^7.24.4",
62
+ "@babel/core": "^7.24.5",
63
63
  "@babel/plugin-proposal-class-properties": "^7.18.6",
64
64
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
65
65
  "@babel/plugin-transform-runtime": "^7.24.3",
66
- "@babel/preset-env": "^7.24.4",
66
+ "@babel/preset-env": "^7.24.5",
67
67
  "@babel/preset-react": "^7.24.1",
68
68
  "@babel/preset-typescript": "^7.24.1",
69
- "@babel/types": "^7.24.0",
69
+ "@babel/types": "^7.24.5",
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.2",
75
- "@testing-library/react": "^14.2.2",
74
+ "@testing-library/jest-dom": "^6.4.5",
75
+ "@testing-library/react": "^14.3.1",
76
76
  "@testing-library/user-event": "^14.5.2",
77
77
  "@types/buble": "^0.20.5",
78
78
  "@types/classnames": "2.3.1",
@@ -81,9 +81,9 @@
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.95",
85
- "@types/react": "^18.2.74",
86
- "@types/react-dom": "^18.2.24",
84
+ "@types/node": "^16.18.96",
85
+ "@types/react": "^18.3.1",
86
+ "@types/react-dom": "^18.3.0",
87
87
  "@types/react-measure": "2.0.9",
88
88
  "@types/react-transition-group": "^4.4.10",
89
89
  "@types/svg4everybody": "2.1.2",
@@ -107,16 +107,16 @@
107
107
  "jest-image-snapshot": "^6.4.0",
108
108
  "less": "^4.2.0",
109
109
  "less-loader": "^11.1.4",
110
- "mini-css-extract-plugin": "^2.8.1",
110
+ "mini-css-extract-plugin": "^2.9.0",
111
111
  "postcss": "^8.4.38",
112
112
  "postcss-less": "^6.0.0",
113
113
  "postcss-loader": "^7.3.4",
114
114
  "postcss-logical": "^6.2.0",
115
115
  "prettier": "^2.8.8",
116
116
  "puppeteer-core": "21.7.0",
117
- "react": "^18.2.0",
117
+ "react": "^18.3.1",
118
118
  "react-docgen-typescript": "^2.2.2",
119
- "react-dom": "^18.2.0",
119
+ "react-dom": "^18.3.1",
120
120
  "react-styleguidist": "^13.1.2",
121
121
  "rimraf": "^5.0.5",
122
122
  "rtlcss": "^4.1.1",