@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.
- package/cjs/components/Button/Button.js +4 -22
- package/cjs/components/Card/CardButton.js +2 -3
- package/cjs/components/CardList/CardListToolbar.js +3 -8
- package/cjs/components/Dialog/Dialog.js +5 -27
- package/cjs/components/Drawer/Drawer.js +7 -20
- package/cjs/components/Dropdown/Dropdown.js +3 -11
- package/cjs/components/FormField/FormField.js +13 -26
- package/cjs/components/Icon/constants.js +2 -2
- package/cjs/components/Icon/images/symbols.svg +9 -1
- package/cjs/components/List/List.js +1 -14
- package/cjs/components/Progress/Progress.js +6 -5
- package/cjs/components/ProgressStep/ProgressStep.js +5 -14
- package/cjs/components/ProgressStep/index.js +6 -0
- package/cjs/components/Section/Section.js +11 -19
- package/cjs/components/SplitButton/SplitButton.js +2 -3
- package/cjs/components/TextArea/TextArea.js +49 -97
- package/cjs/components/TextArea/calculateNodeHeight.js +8 -8
- package/cjs/components/Toolbar/RegistryContextBeta.js +112 -0
- package/cjs/components/Toolbar/Toolbar.js +46 -2
- package/cjs/components/Toolbar/ToolbarBetaProvider.js +23 -0
- package/cjs/components/Toolbar/ToolbarGroup.js +66 -4
- package/cjs/components/Toolbar/ToolbarItem.js +27 -12
- package/cjs/components/Toolbar/ToolbarMenu.js +2 -1
- package/cjs/components/Toolbar/index.js +8 -1
- package/cjs/components/index.js +15 -1
- package/cjs/hooks/index.js +12 -0
- package/cjs/hooks/useResizeObserver.js +29 -0
- package/cjs/hooks/useSqueeze.js +48 -0
- package/cjs/index.js +1 -1
- package/dist/images/symbols.svg +9 -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 +591 -309
- 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 +3 -21
- package/esm/components/Card/CardButton.js +2 -3
- package/esm/components/CardList/CardListToolbar.js +3 -8
- package/esm/components/Dialog/Dialog.js +5 -27
- package/esm/components/Drawer/Drawer.js +7 -20
- package/esm/components/Dropdown/Dropdown.js +3 -11
- package/esm/components/FormField/FormField.js +13 -26
- package/esm/components/Icon/constants.js +2 -2
- package/esm/components/Icon/images/symbols.svg +9 -1
- package/esm/components/List/List.js +1 -14
- package/esm/components/Progress/Progress.js +7 -6
- package/esm/components/ProgressStep/ProgressStep.js +4 -13
- package/esm/components/ProgressStep/index.js +1 -1
- package/esm/components/Section/Section.js +11 -19
- package/esm/components/SplitButton/SplitButton.js +2 -3
- package/esm/components/TextArea/TextArea.js +50 -98
- package/esm/components/TextArea/calculateNodeHeight.js +8 -8
- package/esm/components/Toolbar/RegistryContextBeta.js +103 -0
- package/esm/components/Toolbar/Toolbar.js +47 -3
- package/esm/components/Toolbar/ToolbarBetaProvider.js +16 -0
- package/esm/components/Toolbar/ToolbarGroup.js +67 -5
- package/esm/components/Toolbar/ToolbarItem.js +27 -12
- package/esm/components/Toolbar/ToolbarMenu.js +2 -1
- package/esm/components/Toolbar/index.js +2 -1
- package/esm/components/index.js +2 -2
- package/esm/hooks/index.js +3 -0
- package/esm/hooks/useResizeObserver.js +22 -0
- package/esm/hooks/useSqueeze.js +41 -0
- package/esm/index.js +1 -1
- package/package.json +13 -13
- package/styleguide/build/bundle.8f00c54c.js +2 -0
- package/styleguide/images/symbols.svg +9 -1
- package/styleguide/index.html +2 -2
- package/types/src/components/Button/Button.d.ts +1 -0
- package/types/src/components/Dialog/Dialog.d.ts +1 -25
- package/types/src/components/Drawer/Drawer.d.ts +1 -4
- package/types/src/components/FormField/FormField.d.ts +1 -23
- package/types/src/components/Icon/constants.d.ts +1 -1
- package/types/src/components/ProgressStep/ProgressStep.d.ts +2 -13
- package/types/src/components/ProgressStep/index.d.ts +1 -1
- package/types/src/components/Section/Section.d.ts +2 -32
- package/types/src/components/TextArea/TextArea.d.ts +5 -32
- package/types/src/components/TextArea/calculateNodeHeight.d.ts +2 -6
- package/types/src/components/Toolbar/RegistryContextBeta.d.ts +25 -0
- package/types/src/components/Toolbar/Toolbar.d.ts +2 -22
- package/types/src/components/Toolbar/ToolbarBetaProvider.d.ts +5 -0
- package/types/src/components/Toolbar/ToolbarGroup.d.ts +2 -5
- package/types/src/components/Toolbar/ToolbarItem.d.ts +1 -1
- package/types/src/components/Toolbar/index.d.ts +1 -0
- package/types/src/components/index.d.ts +2 -2
- package/types/src/hooks/index.d.ts +1 -0
- package/types/src/hooks/useResizeObserver.d.ts +7 -0
- package/types/src/hooks/useSqueeze.d.ts +10 -0
- package/styleguide/build/bundle.42040fbd.js +0 -2
- /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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plesk/ui-library",
|
|
3
|
-
"version": "3.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
75
|
-
"@testing-library/react": "^14.
|
|
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.
|
|
85
|
-
"@types/react": "^18.
|
|
86
|
-
"@types/react-dom": "^18.
|
|
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.
|
|
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.
|
|
117
|
+
"react": "^18.3.1",
|
|
118
118
|
"react-docgen-typescript": "^2.2.2",
|
|
119
|
-
"react-dom": "^18.
|
|
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",
|