@linzjs/windows 6.0.0 → 7.0.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/dist/common/useConstFunction.ts +8 -2
- package/dist/panel/OpenPanelIcon.tsx +3 -3
- package/dist/panel/PanelHeader.tsx +3 -3
- package/dist/panel/PanelInstanceContextProvider.tsx +3 -4
- package/dist/panel/PopinWIndow.tsx +2 -2
- package/dist/panel/PopoutWindow.tsx +4 -3
- package/dist/panel/types/PanelProps.ts +4 -3
- package/package.json +19 -20
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
2
|
|
|
3
|
+
const VoidFn = () => {
|
|
4
|
+
// empty
|
|
5
|
+
};
|
|
6
|
+
|
|
3
7
|
/**
|
|
4
8
|
* When calling external non-react components, and you can't update the function when state changes,
|
|
5
9
|
* use this to proxy the dynamic function with a static function.
|
|
6
10
|
*/
|
|
7
|
-
export const useConstFunction = <Args extends never[], R, TFn extends (...args: Args) => R
|
|
11
|
+
export const useConstFunction = <Args extends never[], R, TFn extends ((...args: Args) => R) | null | undefined>(
|
|
12
|
+
fn: TFn = VoidFn as TFn,
|
|
13
|
+
): TFn => {
|
|
8
14
|
const functionRef = useRef<TFn>(fn);
|
|
9
|
-
const proxyRef = useRef<TFn>(((...args: Args) => functionRef.current(...args)) as TFn);
|
|
15
|
+
const proxyRef = useRef<TFn>(((...args: Args) => functionRef.current?.(...args)) as TFn);
|
|
10
16
|
|
|
11
17
|
useEffect(() => {
|
|
12
18
|
functionRef.current = fn;
|
|
@@ -3,17 +3,17 @@ import './OpenPanelIcon.scss';
|
|
|
3
3
|
import { LuiIcon } from '@linzjs/lui';
|
|
4
4
|
import { IconName } from '@linzjs/lui/dist/components/LuiIcon/LuiIcon';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import {
|
|
6
|
+
import { PropsWithChildren, useContext } from 'react';
|
|
7
7
|
|
|
8
8
|
import { OpenPanelOptions, PanelsContext } from './PanelsContext';
|
|
9
9
|
|
|
10
|
-
export const ButtonIconHorizontalGroup = ({ children }:
|
|
10
|
+
export const ButtonIconHorizontalGroup = ({ children }: PropsWithChildren) => (
|
|
11
11
|
<div>
|
|
12
12
|
<div className={'OpenPanelIcon-horizontalGroup'}>{children}</div>
|
|
13
13
|
</div>
|
|
14
14
|
);
|
|
15
15
|
|
|
16
|
-
export const ButtonIconVerticalGroup = ({ children }:
|
|
16
|
+
export const ButtonIconVerticalGroup = ({ children }: PropsWithChildren) => (
|
|
17
17
|
<div>
|
|
18
18
|
<div className={'OpenPanelIcon-verticalGroup'}>{children}</div>
|
|
19
19
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LuiIcon } from '@linzjs/lui';
|
|
2
2
|
import { LuiIconName } from '@linzjs/lui/dist/assets/svg-content';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import {
|
|
4
|
+
import { ReactElement, useContext, useState } from 'react';
|
|
5
5
|
|
|
6
6
|
import { PanelContext } from './PanelContext';
|
|
7
7
|
import { PanelHeaderButton } from './PanelHeaderButton';
|
|
@@ -9,8 +9,8 @@ import { PanelInstanceContext } from './PanelInstanceContext';
|
|
|
9
9
|
|
|
10
10
|
export interface PanelHeaderProps {
|
|
11
11
|
icon?: LuiIconName;
|
|
12
|
-
extraLeft?:
|
|
13
|
-
extraRight?:
|
|
12
|
+
extraLeft?: ReactElement;
|
|
13
|
+
extraRight?: ReactElement;
|
|
14
14
|
helpUrl?: string;
|
|
15
15
|
onHelpClick?: () => void;
|
|
16
16
|
onDockClick?: () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PropsWithChildren, ReactElement, useCallback, useContext, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { PanelInstanceContext } from './PanelInstanceContext';
|
|
4
4
|
import { PanelInstance, PanelsContext } from './PanelsContext';
|
|
@@ -11,11 +11,10 @@ export const PanelInstanceContextProvider = ({
|
|
|
11
11
|
panelInstance,
|
|
12
12
|
bounds,
|
|
13
13
|
children,
|
|
14
|
-
}: {
|
|
14
|
+
}: PropsWithChildren<{
|
|
15
15
|
bounds: string | Element | undefined;
|
|
16
16
|
panelInstance: PanelInstance;
|
|
17
|
-
|
|
18
|
-
}): ReactElement => {
|
|
17
|
+
}>): ReactElement => {
|
|
19
18
|
const { closePanel, bringPanelToFront, dockElements } = useContext(PanelsContext);
|
|
20
19
|
const [title, setTitle] = useState('');
|
|
21
20
|
const [dockId, setDockId] = useState<string>();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
-
import { Dispatch,
|
|
2
|
+
import { Dispatch, ReactElement, useCallback, useContext, useEffect, useRef } from 'react';
|
|
3
3
|
import { Rnd } from 'react-rnd';
|
|
4
4
|
|
|
5
5
|
import { PanelContext } from './PanelContext';
|
|
@@ -30,7 +30,7 @@ export function PopinWindow({
|
|
|
30
30
|
panelSize: PanelSize;
|
|
31
31
|
setPanelSize: Dispatch<PanelSize>;
|
|
32
32
|
setInitialPanelSize: Dispatch<PanelSize>;
|
|
33
|
-
}):
|
|
33
|
+
}): ReactElement {
|
|
34
34
|
const panelRef = useRef<Rnd>(null);
|
|
35
35
|
|
|
36
36
|
const { bounds, zIndex, bringPanelToFront, uniqueId } = useContext(PanelInstanceContext);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import createCache from '@emotion/cache';
|
|
2
2
|
import { CacheProvider } from '@emotion/react';
|
|
3
|
-
import {
|
|
3
|
+
import { PropsWithChildren, ReactElement, useContext, useEffect, useState } from 'react';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
5
|
|
|
6
6
|
import { makePopoutId } from './generateId';
|
|
@@ -9,10 +9,9 @@ import { PanelInstanceContext } from './PanelInstanceContext';
|
|
|
9
9
|
import { PanelPosition, PanelSize } from './types';
|
|
10
10
|
import { useRestoreStateFrom, useSaveStateIn } from './usePanelStateHandler';
|
|
11
11
|
|
|
12
|
-
interface
|
|
12
|
+
interface _PopoutWindowProps {
|
|
13
13
|
name: string;
|
|
14
14
|
title?: string; // The title of the popout window
|
|
15
|
-
children: ReactNode; // what to render inside the window
|
|
16
15
|
size: PanelSize;
|
|
17
16
|
popInPanelPosition: PanelPosition;
|
|
18
17
|
popInPanelSize: PanelSize;
|
|
@@ -26,6 +25,8 @@ interface PopoutWindowProps {
|
|
|
26
25
|
className?: string;
|
|
27
26
|
}
|
|
28
27
|
|
|
28
|
+
export type PopoutWindowProps = PropsWithChildren<_PopoutWindowProps>;
|
|
29
|
+
|
|
29
30
|
export const PopoutWindow = ({
|
|
30
31
|
name,
|
|
31
32
|
title = name,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
2
|
|
|
3
3
|
import { PanelPosition } from './PanelPosition';
|
|
4
4
|
import { PanelSize } from './PanelSize';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
children: ReactNode;
|
|
6
|
+
interface _PanelProps {
|
|
8
7
|
className?: string;
|
|
9
8
|
maxHeight?: number | string;
|
|
10
9
|
maxWidth?: number | string;
|
|
@@ -16,3 +15,5 @@ export interface PanelProps {
|
|
|
16
15
|
size?: PanelSize;
|
|
17
16
|
title: string;
|
|
18
17
|
}
|
|
18
|
+
|
|
19
|
+
export type PanelProps = PropsWithChildren<_PanelProps>;
|
package/package.json
CHANGED
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"popout"
|
|
14
14
|
],
|
|
15
15
|
"main": "./dist/index.ts",
|
|
16
|
-
"version": "
|
|
16
|
+
"version": "7.0.0",
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@linzjs/lui": ">=21",
|
|
19
19
|
"lodash-es": ">=4",
|
|
20
|
-
"react": ">=
|
|
21
|
-
"react-dom": ">=
|
|
20
|
+
"react": ">=19",
|
|
21
|
+
"react-dom": ">=19"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"dist"
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@chromatic-com/storybook": "^4.1.1",
|
|
63
|
-
"@linzjs/lui": "^23.14.
|
|
64
|
-
"@linzjs/step-ag-grid": "^
|
|
63
|
+
"@linzjs/lui": "^23.14.3",
|
|
64
|
+
"@linzjs/step-ag-grid": "^29.5.1",
|
|
65
65
|
"@linzjs/style": "^5.4.0",
|
|
66
66
|
"@rollup/plugin-commonjs": "^28.0.8",
|
|
67
67
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -73,22 +73,21 @@
|
|
|
73
73
|
"@testing-library/react": "^16.3.0",
|
|
74
74
|
"@testing-library/user-event": "^14.6.1",
|
|
75
75
|
"@types/lodash-es": "^4.17.12",
|
|
76
|
-
"@types/node": "^22.18.
|
|
77
|
-
"@types/react": "^
|
|
78
|
-
"@types/react-dom": "^
|
|
79
|
-
"@vitejs/plugin-react-swc": "^
|
|
80
|
-
"@vitest/ui": "^
|
|
81
|
-
"ag-grid-community": "^34.
|
|
82
|
-
"ag-grid-react": "^34.
|
|
83
|
-
"babel-preset-react-app": "^10.1.0",
|
|
76
|
+
"@types/node": "^22.18.12",
|
|
77
|
+
"@types/react": "^19.2.2",
|
|
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",
|
|
84
83
|
"eslint-plugin-react": "^7.37.5",
|
|
85
84
|
"eslint-plugin-storybook": "9.1.13",
|
|
86
|
-
"jsdom": "^
|
|
85
|
+
"jsdom": "^27.0.1",
|
|
87
86
|
"mkdirp": "^3.0.1",
|
|
88
87
|
"npm-run-all": "^4.1.5",
|
|
89
|
-
"react": "^
|
|
88
|
+
"react": "^19.2.0",
|
|
90
89
|
"react-app-polyfill": "^3.0.0",
|
|
91
|
-
"react-dom": "^
|
|
90
|
+
"react-dom": "^19.2.0",
|
|
92
91
|
"rollup": "^4.52.5",
|
|
93
92
|
"rollup-plugin-copy": "^3.5.0",
|
|
94
93
|
"sass": "^1.93.2",
|
|
@@ -97,16 +96,16 @@
|
|
|
97
96
|
"storybook": "^9.1.13",
|
|
98
97
|
"style-loader": "^4.0.0",
|
|
99
98
|
"stylelint": "^16.25.0",
|
|
100
|
-
"stylelint-config-recommended": "^
|
|
101
|
-
"stylelint-config-recommended-scss": "^
|
|
102
|
-
"stylelint-config-standard": "^
|
|
99
|
+
"stylelint-config-recommended": "^17.0.0",
|
|
100
|
+
"stylelint-config-recommended-scss": "^16.0.2",
|
|
101
|
+
"stylelint-config-standard": "^39.0.1",
|
|
103
102
|
"stylelint-prettier": "5.0.3",
|
|
104
103
|
"stylelint-scss": "6.12.1",
|
|
105
104
|
"typescript": "^5.9.3",
|
|
106
105
|
"vite": "^7.1.11",
|
|
107
106
|
"vite-plugin-html": "^3.2.2",
|
|
108
107
|
"vite-tsconfig-paths": "^5.1.4",
|
|
109
|
-
"vitest": "^
|
|
108
|
+
"vitest": "^4.0.1"
|
|
110
109
|
},
|
|
111
110
|
"optionalDependencies": {
|
|
112
111
|
"@rollup/rollup-linux-x64-gnu": "^4.52.5",
|