@linzjs/windows 7.0.0 → 7.0.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.
@@ -3,7 +3,7 @@ import '@linzjs/lui/dist/scss/base.scss';
3
3
  import '@linzjs/lui/dist/fonts';
4
4
 
5
5
  import clsx from 'clsx';
6
- import { delay } from 'lodash';
6
+ import { delay } from 'lodash-es';
7
7
  import React, { CSSProperties, PropsWithChildren, ReactElement, useContext, useEffect, useRef } from 'react';
8
8
 
9
9
  import { LuiModalAsyncInstanceContext } from './LuiModalAsyncInstanceContext';
@@ -2,8 +2,7 @@ import { LuiButton, LuiCheckboxInput, LuiMiniSpinner } from '@linzjs/lui';
2
2
  import { LuiButtonProps } from '@linzjs/lui/dist/components/LuiButton/LuiButton';
3
3
  import { IconName } from '@linzjs/lui/dist/components/LuiIcon/LuiIcon';
4
4
  import clsx from 'clsx';
5
- import { flatMap } from 'lodash';
6
- import { omit, pick } from 'lodash-es';
5
+ import { flatMap, omit, pick } from 'lodash-es';
7
6
  import React, { PropsWithChildren, ReactElement, useCallback, useMemo, useState } from 'react';
8
7
 
9
8
  import { debugLog } from '../common/debug';
@@ -67,14 +67,30 @@ export const Panel = (props: PanelProps): ReactElement => {
67
67
  return nextStackPosition();
68
68
  });
69
69
 
70
- const [panelSize, setPanelSize] = useState<NumberSize>(() => {
70
+ const cropSizeToWindow = useCallback((size: NumberSize) => {
71
+ return typeof window !== 'undefined' && window.innerWidth && window.innerHeight
72
+ ? {
73
+ width: Math.min(window.document.body?.clientWidth ?? window.innerWidth, size.width),
74
+ height: Math.min(window.document.body?.clientHeight ?? window.innerHeight, size.height),
75
+ }
76
+ : size;
77
+ }, []);
78
+
79
+ const [panelSize, _setPanelSize] = useState<NumberSize>(() => {
71
80
  if (savedState?.panelSize) {
72
- return savedState.panelSize;
81
+ return cropSizeToWindow(savedState.panelSize);
73
82
  }
74
83
 
75
84
  return size ?? { width: 320, height: 200 };
76
85
  });
77
86
 
87
+ const setPanelSize = useCallback(
88
+ (size: NumberSize) => {
89
+ _setPanelSize(cropSizeToWindow(size));
90
+ },
91
+ [cropSizeToWindow],
92
+ );
93
+
78
94
  const setInitialPanelSize = useCallback(
79
95
  (size: NumberSize) => {
80
96
  // If panel was already sized from state, then don't resize
@@ -84,7 +100,7 @@ export const Panel = (props: PanelProps): ReactElement => {
84
100
 
85
101
  setPanelSize(size);
86
102
  },
87
- [savedState?.panelSize],
103
+ [savedState?.panelSize, setPanelSize],
88
104
  );
89
105
 
90
106
  const dockElement = docked && dockId && dockElements[dockId];
package/package.json CHANGED
@@ -13,12 +13,12 @@
13
13
  "popout"
14
14
  ],
15
15
  "main": "./dist/index.ts",
16
- "version": "7.0.0",
16
+ "version": "7.0.1",
17
17
  "peerDependencies": {
18
18
  "@linzjs/lui": ">=21",
19
19
  "lodash-es": ">=4",
20
- "react": ">=19",
21
- "react-dom": ">=19"
20
+ "react": ">=18",
21
+ "react-dom": ">=18"
22
22
  },
23
23
  "files": [
24
24
  "dist"
@@ -59,16 +59,16 @@
59
59
  "uuid": "^13.0.0"
60
60
  },
61
61
  "devDependencies": {
62
- "@chromatic-com/storybook": "^4.1.1",
63
- "@linzjs/lui": "^23.14.3",
62
+ "@chromatic-com/storybook": "^4.1.2",
63
+ "@linzjs/lui": "^23.14.4",
64
64
  "@linzjs/step-ag-grid": "^29.5.1",
65
65
  "@linzjs/style": "^5.4.0",
66
- "@rollup/plugin-commonjs": "^28.0.8",
66
+ "@rollup/plugin-commonjs": "^28.0.9",
67
67
  "@rollup/plugin-json": "^6.1.0",
68
68
  "@rollup/plugin-node-resolve": "^16.0.3",
69
- "@storybook/addon-docs": "^9.1.13",
70
- "@storybook/addon-links": "^9.1.13",
71
- "@storybook/react-vite": "^9.1.13",
69
+ "@storybook/addon-docs": "^9.1.16",
70
+ "@storybook/addon-links": "^9.1.16",
71
+ "@storybook/react-vite": "^9.1.16",
72
72
  "@testing-library/dom": "^10.4.1",
73
73
  "@testing-library/react": "^16.3.0",
74
74
  "@testing-library/user-event": "^14.6.1",
@@ -76,24 +76,24 @@
76
76
  "@types/node": "^22.18.12",
77
77
  "@types/react": "^19.2.2",
78
78
  "@types/react-dom": "^19.2.2",
79
- "@vitejs/plugin-react-swc": "^4.1.0",
80
- "@vitest/ui": "^4.0.1",
81
- "ag-grid-community": "^34.3.0",
82
- "ag-grid-react": "^34.3.0",
79
+ "@vitejs/plugin-react-swc": "^4.2.0",
80
+ "@vitest/ui": "^4.0.5",
81
+ "ag-grid-community": "^34.3.1",
82
+ "ag-grid-react": "^34.3.1",
83
83
  "eslint-plugin-react": "^7.37.5",
84
- "eslint-plugin-storybook": "9.1.13",
84
+ "eslint-plugin-storybook": "^9.1.16",
85
85
  "jsdom": "^27.0.1",
86
86
  "mkdirp": "^3.0.1",
87
87
  "npm-run-all": "^4.1.5",
88
- "react": "^19.2.0",
88
+ "react": "18.3.1",
89
89
  "react-app-polyfill": "^3.0.0",
90
- "react-dom": "^19.2.0",
90
+ "react-dom": "18.3.1",
91
91
  "rollup": "^4.52.5",
92
92
  "rollup-plugin-copy": "^3.5.0",
93
93
  "sass": "^1.93.2",
94
- "sass-loader": "^16.0.5",
94
+ "sass-loader": "^16.0.6",
95
95
  "semantic-release": "^24.2.9",
96
- "storybook": "^9.1.13",
96
+ "storybook": "^9.1.16",
97
97
  "style-loader": "^4.0.0",
98
98
  "stylelint": "^16.25.0",
99
99
  "stylelint-config-recommended": "^17.0.0",
@@ -102,14 +102,14 @@
102
102
  "stylelint-prettier": "5.0.3",
103
103
  "stylelint-scss": "6.12.1",
104
104
  "typescript": "^5.9.3",
105
- "vite": "^7.1.11",
105
+ "vite": "^7.1.12",
106
106
  "vite-plugin-html": "^3.2.2",
107
107
  "vite-tsconfig-paths": "^5.1.4",
108
- "vitest": "^4.0.1"
108
+ "vitest": "^4.0.5"
109
109
  },
110
110
  "optionalDependencies": {
111
111
  "@rollup/rollup-linux-x64-gnu": "^4.52.5",
112
- "@swc/core-linux-x64-gnu": "^1.13.20"
112
+ "@swc/core-linux-x64-gnu": "^1.14.0"
113
113
  },
114
114
  "browserslist": {
115
115
  "production": [