@linzjs/windows 3.2.4 → 3.3.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.
package/README.md
CHANGED
|
@@ -9,8 +9,8 @@ React state based modals/windows are painful because they require:
|
|
|
9
9
|
- shared states for open/closed.
|
|
10
10
|
- callbacks/states for return values.
|
|
11
11
|
- inline modal/window includes, which prevent you from closing the invoking component before the modal/window has completed.
|
|
12
|
-
- multi-window dialogs
|
|
13
|
-
- html5 dialog based
|
|
12
|
+
- multi-window dialogs.
|
|
13
|
+
- html5 dialog based.
|
|
14
14
|
|
|
15
15
|
This module gives you promise based modals/windows which don't require all the state
|
|
16
16
|
based boilerplate / inline-components.
|
|
@@ -118,9 +118,15 @@ export const LuiModalAsyncContextProvider = ({ children }: PropsWithChildren<unk
|
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
}).then((result) => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
return new Promise((resolve) => {
|
|
122
|
+
// Close modal
|
|
123
|
+
setModals((modals) => {
|
|
124
|
+
// Defer resolving to give react a chance to update the view allowing the async event model to run.
|
|
125
|
+
// Just in case the task following this is long-running with non IO code, which will block the event queue.
|
|
126
|
+
setTimeout(() => resolve(result), 10);
|
|
127
|
+
return modals.filter((e) => e.uuid !== uuid);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
124
130
|
}) as PromiseWithResolve<any>;
|
|
125
131
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
126
132
|
promise.resolve = extResolve!;
|
package/dist/panel/Panel.scss
CHANGED
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
display: flex;
|
|
92
92
|
align-items: center;
|
|
93
93
|
|
|
94
|
-
a.lui-button,
|
|
95
|
-
button.lui-button {
|
|
94
|
+
a.lui-button,
|
|
95
|
+
button.lui-button {
|
|
96
96
|
display: flex;
|
|
97
97
|
align-items: center;
|
|
98
98
|
|
|
@@ -118,4 +118,4 @@
|
|
|
118
118
|
flex: 1;
|
|
119
119
|
overflow: auto;
|
|
120
120
|
display: flex;
|
|
121
|
-
}
|
|
121
|
+
}
|
package/dist/panel/Panel.tsx
CHANGED
|
@@ -13,7 +13,7 @@ import { Rnd } from "react-rnd";
|
|
|
13
13
|
|
|
14
14
|
export interface PanelProps {
|
|
15
15
|
title: string;
|
|
16
|
-
position?: PanelPosition;
|
|
16
|
+
position?: PanelPosition | "tile" | "center";
|
|
17
17
|
size?: PanelSize;
|
|
18
18
|
className?: string;
|
|
19
19
|
children: ReactNode;
|
|
@@ -21,16 +21,18 @@ export interface PanelProps {
|
|
|
21
21
|
maxWidth?: number;
|
|
22
22
|
minHeight?: number;
|
|
23
23
|
minWidth?: number;
|
|
24
|
+
modal?: boolean;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export const Panel = ({
|
|
27
28
|
title,
|
|
28
|
-
position,
|
|
29
|
+
position = "tile",
|
|
29
30
|
size = { width: 320, height: 200 },
|
|
30
31
|
maxHeight,
|
|
31
32
|
maxWidth,
|
|
32
33
|
minHeight = 100,
|
|
33
34
|
minWidth = 100,
|
|
35
|
+
modal,
|
|
34
36
|
className,
|
|
35
37
|
children,
|
|
36
38
|
}: PanelProps): ReactElement => {
|
|
@@ -38,7 +40,20 @@ export const Panel = ({
|
|
|
38
40
|
const { panelPoppedOut, bounds, zIndex, bringPanelToFront, uniqueId, setTitle, dockId, docked } =
|
|
39
41
|
useContext(PanelInstanceContext);
|
|
40
42
|
|
|
41
|
-
const [panelPosition, setPanelPosition] = useState(() =>
|
|
43
|
+
const [panelPosition, setPanelPosition] = useState(() => {
|
|
44
|
+
switch (position) {
|
|
45
|
+
case "center":
|
|
46
|
+
return {
|
|
47
|
+
x: (window.innerWidth - size.width) / 2,
|
|
48
|
+
y: (window.innerHeight - size.height) / 2,
|
|
49
|
+
};
|
|
50
|
+
case "tile":
|
|
51
|
+
return nextStackPosition();
|
|
52
|
+
default:
|
|
53
|
+
return position ?? nextStackPosition();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
42
57
|
const [panelSize, setPanelSize] = useState(size ?? { width: 320, height: 200 });
|
|
43
58
|
|
|
44
59
|
const resizePanel = (newPanelSize: Partial<PanelSize>) => {
|
|
@@ -74,40 +89,55 @@ export const Panel = ({
|
|
|
74
89
|
</div>
|
|
75
90
|
</PopoutWindow>
|
|
76
91
|
) : (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
92
|
+
<>
|
|
93
|
+
{modal && (
|
|
94
|
+
<div
|
|
95
|
+
style={{
|
|
96
|
+
position: "absolute",
|
|
97
|
+
top: 0,
|
|
98
|
+
left: 0,
|
|
99
|
+
bottom: 0,
|
|
100
|
+
right: 0,
|
|
101
|
+
backgroundColor: "rgb(0,0,0,0.1)",
|
|
102
|
+
zIndex,
|
|
103
|
+
}}
|
|
104
|
+
/>
|
|
105
|
+
)}
|
|
106
|
+
<Rnd
|
|
107
|
+
className={clsx("WindowPanel", className)}
|
|
108
|
+
dragHandleClassName={"draggable-handle"}
|
|
109
|
+
maxHeight={maxHeight}
|
|
110
|
+
maxWidth={maxWidth}
|
|
111
|
+
minWidth={minWidth}
|
|
112
|
+
minHeight={minHeight}
|
|
113
|
+
position={panelPosition}
|
|
114
|
+
size={panelSize}
|
|
115
|
+
style={{ zIndex }}
|
|
116
|
+
bounds={bounds ?? document.body}
|
|
117
|
+
onDragStop={(_evt, data) => {
|
|
118
|
+
setPanelPosition({ x: data.x, y: data.y });
|
|
119
|
+
}}
|
|
120
|
+
onResizeStop={(_evt, _dir, ref, _delta, position) => {
|
|
121
|
+
setPanelPosition(position);
|
|
122
|
+
setPanelSize({
|
|
123
|
+
width: parseInt(ref.style.width),
|
|
124
|
+
height: parseInt(ref.style.height),
|
|
125
|
+
});
|
|
106
126
|
}}
|
|
127
|
+
onMouseDown={bringPanelToFront}
|
|
107
128
|
>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
129
|
+
<div
|
|
130
|
+
style={{
|
|
131
|
+
display: "flex",
|
|
132
|
+
flexDirection: "column",
|
|
133
|
+
width: "100%",
|
|
134
|
+
height: "100%",
|
|
135
|
+
}}
|
|
136
|
+
>
|
|
137
|
+
{children}
|
|
138
|
+
</div>
|
|
139
|
+
</Rnd>
|
|
140
|
+
</>
|
|
111
141
|
)}
|
|
112
142
|
</PanelContext.Provider>
|
|
113
143
|
);
|
|
@@ -12,9 +12,20 @@ export interface PanelHeaderProps {
|
|
|
12
12
|
helpUrl?: string;
|
|
13
13
|
onHelpClick?: () => void;
|
|
14
14
|
dockTo?: string;
|
|
15
|
+
disableClose?: boolean;
|
|
16
|
+
disablePopout?: boolean;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
export const PanelHeader = ({
|
|
19
|
+
export const PanelHeader = ({
|
|
20
|
+
icon,
|
|
21
|
+
extraLeft,
|
|
22
|
+
extraRight,
|
|
23
|
+
helpUrl,
|
|
24
|
+
onHelpClick,
|
|
25
|
+
dockTo,
|
|
26
|
+
disableClose,
|
|
27
|
+
disablePopout,
|
|
28
|
+
}: PanelHeaderProps) => {
|
|
18
29
|
const { panelClose, panelTogglePopout, panelPoppedOut, title, dock, undock, docked } =
|
|
19
30
|
useContext(PanelInstanceContext);
|
|
20
31
|
const [cursor, setCursor] = useState<"grab" | "grabbing">("grab");
|
|
@@ -42,7 +53,7 @@ export const PanelHeader = ({ icon, extraLeft, extraRight, helpUrl, onHelpClick,
|
|
|
42
53
|
<PanelHeaderButton aria-label={"Help"} href={helpUrl} onClick={onHelpClick} icon={"ic_help_outline"} />
|
|
43
54
|
)}
|
|
44
55
|
</div>
|
|
45
|
-
<div className={"WindowPanel-divider-right"} />
|
|
56
|
+
{(dockTo || !disablePopout || !disableClose) && <div className={"WindowPanel-divider-right"} />}
|
|
46
57
|
<div className={"WindowPanel-buttons"}>
|
|
47
58
|
{dockTo &&
|
|
48
59
|
(docked ? (
|
|
@@ -50,12 +61,14 @@ export const PanelHeader = ({ icon, extraLeft, extraRight, helpUrl, onHelpClick,
|
|
|
50
61
|
) : (
|
|
51
62
|
<PanelHeaderButton aria-label={"Undock"} onClick={() => dock(dockTo)} icon={"ic_left_col"} />
|
|
52
63
|
))}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
{!disablePopout && (
|
|
65
|
+
<PanelHeaderButton
|
|
66
|
+
aria-label={panelPoppedOut ? "Pop-in" : "Pop-out"}
|
|
67
|
+
onClick={panelTogglePopout}
|
|
68
|
+
icon={panelPoppedOut ? "ic_pop_back" : "ic_launch_new window_open"}
|
|
69
|
+
/>
|
|
70
|
+
)}
|
|
71
|
+
{!disableClose && <PanelHeaderButton aria-label={"Close"} onClick={panelClose} icon={"ic_clear"} />}
|
|
59
72
|
</div>
|
|
60
73
|
</div>
|
|
61
74
|
);
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"popout"
|
|
14
14
|
],
|
|
15
15
|
"main": "./dist/index.ts",
|
|
16
|
-
"version": "3.
|
|
16
|
+
"version": "3.3.1",
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@linzjs/lui": "^21",
|
|
19
19
|
"lodash-es": ">=4",
|
|
@@ -47,59 +47,59 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@emotion/cache": "^11.13.1",
|
|
50
|
-
"@emotion/react": "^11.13.
|
|
50
|
+
"@emotion/react": "^11.13.3",
|
|
51
51
|
"@emotion/styled": "^11.13.0",
|
|
52
52
|
"lodash-es": ">=4",
|
|
53
|
-
"react-rnd": "^10.4.
|
|
53
|
+
"react-rnd": "^10.4.13",
|
|
54
54
|
"usehooks-ts": "^3.1.0",
|
|
55
55
|
"uuid": "^10.0.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@chromatic-com/storybook": "^
|
|
58
|
+
"@chromatic-com/storybook": "^2.0.2",
|
|
59
59
|
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
|
60
60
|
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
|
|
61
|
-
"@linzjs/lui": "^21.
|
|
62
|
-
"@linzjs/step-ag-grid": "^
|
|
63
|
-
"@rollup/plugin-commonjs": "^
|
|
61
|
+
"@linzjs/lui": "^21.49.0",
|
|
62
|
+
"@linzjs/step-ag-grid": "^22.2.3",
|
|
63
|
+
"@rollup/plugin-commonjs": "^28.0.1",
|
|
64
64
|
"@rollup/plugin-json": "^6.1.0",
|
|
65
|
-
"@rollup/plugin-node-resolve": "^15.
|
|
66
|
-
"@storybook/addon-docs": "^8.
|
|
67
|
-
"@storybook/addon-essentials": "^8.
|
|
68
|
-
"@storybook/addon-interactions": "^8.
|
|
69
|
-
"@storybook/addon-links": "^8.
|
|
70
|
-
"@storybook/addon-mdx-gfm": "^8.
|
|
71
|
-
"@storybook/blocks": "^8.
|
|
72
|
-
"@storybook/react": "^8.
|
|
73
|
-
"@storybook/react-vite": "^8.
|
|
74
|
-
"@storybook/test": "^8.
|
|
65
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
66
|
+
"@storybook/addon-docs": "^8.3.5",
|
|
67
|
+
"@storybook/addon-essentials": "^8.3.5",
|
|
68
|
+
"@storybook/addon-interactions": "^8.3.5",
|
|
69
|
+
"@storybook/addon-links": "^8.3.5",
|
|
70
|
+
"@storybook/addon-mdx-gfm": "^8.3.5",
|
|
71
|
+
"@storybook/blocks": "^8.3.5",
|
|
72
|
+
"@storybook/react": "^8.3.5",
|
|
73
|
+
"@storybook/react-vite": "^8.3.5",
|
|
74
|
+
"@storybook/test": "^8.3.5",
|
|
75
75
|
"@storybook/test-runner": "^0.19.1",
|
|
76
|
-
"@testing-library/jest-dom": "^6.
|
|
77
|
-
"@testing-library/react": "^16.0.
|
|
76
|
+
"@testing-library/jest-dom": "^6.6.1",
|
|
77
|
+
"@testing-library/react": "^16.0.1",
|
|
78
78
|
"@testing-library/user-event": "^14.5.2",
|
|
79
79
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
80
|
-
"@types/jest": "^29.5.
|
|
80
|
+
"@types/jest": "^29.5.13",
|
|
81
81
|
"@types/lodash-es": "^4.17.12",
|
|
82
|
-
"@types/node": "^
|
|
83
|
-
"@types/react": "^18.3.
|
|
84
|
-
"@types/react-dom": "^18.3.
|
|
82
|
+
"@types/node": "^22.7.6",
|
|
83
|
+
"@types/react": "^18.3.11",
|
|
84
|
+
"@types/react-dom": "^18.3.1",
|
|
85
85
|
"@types/uuid": "^10.0.0",
|
|
86
86
|
"@typescript-eslint/eslint-plugin": "^7.17.0",
|
|
87
87
|
"@typescript-eslint/parser": "^7.17.0",
|
|
88
|
-
"ag-grid-community": "^
|
|
89
|
-
"ag-grid-react": "^
|
|
90
|
-
"esbuild": "^0.
|
|
88
|
+
"ag-grid-community": "^32.2.2",
|
|
89
|
+
"ag-grid-react": "^32.2.2",
|
|
90
|
+
"esbuild": "^0.24.0",
|
|
91
91
|
"eslint": "^8.57.0",
|
|
92
92
|
"eslint-config-prettier": "^9.1.0",
|
|
93
93
|
"eslint-config-react-app": "^7.0.1",
|
|
94
94
|
"eslint-plugin-deprecation": "^3.0.0",
|
|
95
|
-
"eslint-plugin-import": "^2.
|
|
96
|
-
"eslint-plugin-jest": "^28.
|
|
97
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
98
|
-
"eslint-plugin-prettier": "^5.1
|
|
99
|
-
"eslint-plugin-react": "^7.
|
|
95
|
+
"eslint-plugin-import": "^2.31.0",
|
|
96
|
+
"eslint-plugin-jest": "^28.8.3",
|
|
97
|
+
"eslint-plugin-jsx-a11y": "^6.10.0",
|
|
98
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
99
|
+
"eslint-plugin-react": "^7.37.1",
|
|
100
100
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
101
101
|
"eslint-plugin-storybook": "^0.8.0",
|
|
102
|
-
"eslint-plugin-testing-library": "^6.
|
|
102
|
+
"eslint-plugin-testing-library": "^6.3.0",
|
|
103
103
|
"jest": "^29.7.0",
|
|
104
104
|
"jest-canvas-mock": "^2.5.2",
|
|
105
105
|
"jest-environment-jsdom": "^29.7.0",
|
|
@@ -110,21 +110,21 @@
|
|
|
110
110
|
"react": "^18.3.1",
|
|
111
111
|
"react-app-polyfill": "^3.0.0",
|
|
112
112
|
"react-dom": "^18.3.1",
|
|
113
|
-
"rollup": "^4.
|
|
113
|
+
"rollup": "^4.24.0",
|
|
114
114
|
"rollup-plugin-copy": "^3.5.0",
|
|
115
|
-
"sass": "^1.
|
|
115
|
+
"sass": "^1.80.0",
|
|
116
116
|
"sass-loader": "^14.2.1",
|
|
117
117
|
"semantic-release": "^22.0.12",
|
|
118
|
-
"storybook": "^8.
|
|
118
|
+
"storybook": "^8.3.5",
|
|
119
119
|
"style-loader": "^4.0.0",
|
|
120
|
-
"stylelint": "^16.
|
|
120
|
+
"stylelint": "^16.10.0",
|
|
121
121
|
"stylelint-config-recommended": "^14.0.1",
|
|
122
122
|
"stylelint-config-recommended-scss": "^14.1.0",
|
|
123
123
|
"stylelint-config-standard": "^36.0.1",
|
|
124
124
|
"stylelint-prettier": "5.0.2",
|
|
125
|
-
"stylelint-scss": "6.
|
|
126
|
-
"typescript": "^5.
|
|
127
|
-
"vite": "^5.
|
|
125
|
+
"stylelint-scss": "6.8.0",
|
|
126
|
+
"typescript": "^5.6.3",
|
|
127
|
+
"vite": "^5.4.9"
|
|
128
128
|
},
|
|
129
129
|
"eslintConfig": {
|
|
130
130
|
"extends": [
|