@linzjs/windows 9.1.4 → 9.3.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/README.md +1 -0
- package/dist/LuiModalAsync/LuiModalAsync.tsx +3 -1
- package/dist/LuiModalAsync/LuiModalAsyncContextProvider.tsx +6 -2
- package/dist/LuiModalAsync/useLuiModalPrefab.tsx +7 -3
- package/dist/common/debug.ts +1 -1
- package/dist/panel/PanelHeader.tsx +3 -1
- package/package.json +12 -13
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/semantic-release/semantic-release)
|
|
4
4
|
|
|
5
|
+
**Note: Make sure to install oxc plugin in Intellij/VSCode for development.**
|
|
5
6
|
|
|
6
7
|
> Reusable promise based windowing component for LINZ / Toitū te whenua.
|
|
7
8
|
|
|
@@ -33,7 +33,9 @@ export const LuiModalAsync = ({
|
|
|
33
33
|
// The only way to create a modal dialog is to call showModal, open attribute will not work
|
|
34
34
|
useEffect(() => {
|
|
35
35
|
// Check if it's open already to support .vite hot deploys
|
|
36
|
-
!dialogRef.current?.open
|
|
36
|
+
if (!dialogRef.current?.open) {
|
|
37
|
+
dialogRef.current?.showModal?.();
|
|
38
|
+
}
|
|
37
39
|
}, []);
|
|
38
40
|
|
|
39
41
|
useEffect(() => {
|
|
@@ -85,7 +85,9 @@ export const LuiModalAsyncContextProvider = ({ children }: PropsWithChildren<unk
|
|
|
85
85
|
const r = oldWindowOpen(...props);
|
|
86
86
|
// We don't want to track non app-windows, e.g. help screens
|
|
87
87
|
if (!props[0]) {
|
|
88
|
-
|
|
88
|
+
if (r) {
|
|
89
|
+
openWindowsRef.current.push(r as typeof window);
|
|
90
|
+
}
|
|
89
91
|
}
|
|
90
92
|
return r;
|
|
91
93
|
};
|
|
@@ -175,7 +177,9 @@ export const LuiModalAsyncContextProvider = ({ children }: PropsWithChildren<unk
|
|
|
175
177
|
*/
|
|
176
178
|
useInterval(() => {
|
|
177
179
|
const newModals = modals.filter(modalHasView);
|
|
178
|
-
newModals.length !== modals.length
|
|
180
|
+
if (newModals.length !== modals.length) {
|
|
181
|
+
setModals(newModals);
|
|
182
|
+
}
|
|
179
183
|
// We could do this with window close listeners, but they are unreliable
|
|
180
184
|
openWindowsRef.current = openWindowsRef.current.filter((w) => !w.closed);
|
|
181
185
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LuiButton, LuiCheckboxInput, LuiMiniSpinner } from '@linzjs/lui';
|
|
1
|
+
import { LuiButton, LuiCheckboxInput, LuiIcon, 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';
|
|
@@ -20,6 +20,7 @@ export interface LuiModalAsyncPrefabButton<RT> {
|
|
|
20
20
|
default?: boolean;
|
|
21
21
|
level?: LuiButtonProps['level'];
|
|
22
22
|
title: string;
|
|
23
|
+
icon?: IconName;
|
|
23
24
|
value?: RT;
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -102,13 +103,14 @@ export const LuiModalPrefab = (props: PropsWithChildren<LuiModalAsyncPrefabProps
|
|
|
102
103
|
|
|
103
104
|
// If there are two options, option 1 is secondary, option 2 is primary
|
|
104
105
|
// Otherwise all options are secondary
|
|
105
|
-
buttons.length === 2
|
|
106
|
+
if (buttons.length === 2) {
|
|
106
107
|
buttons.forEach((b, i) => {
|
|
107
108
|
if (!b.level) {
|
|
108
109
|
// Last button is primary all others are secondary
|
|
109
110
|
b.level = i === buttons.length - 1 ? 'primary' : 'secondary';
|
|
110
111
|
}
|
|
111
112
|
});
|
|
113
|
+
}
|
|
112
114
|
|
|
113
115
|
/**
|
|
114
116
|
* When dialog closes save the "don't show" property
|
|
@@ -148,12 +150,14 @@ export const LuiModalPrefab = (props: PropsWithChildren<LuiModalAsyncPrefabProps
|
|
|
148
150
|
<LuiButton
|
|
149
151
|
key={i}
|
|
150
152
|
level={pf.level ?? 'secondary'}
|
|
153
|
+
className={clsx(pf.icon && 'lui-button-icon')}
|
|
151
154
|
onClick={() => {
|
|
152
155
|
setDontShow();
|
|
153
156
|
resolve(pf.value);
|
|
154
157
|
}}
|
|
155
158
|
buttonProps={pf.default ? { 'data-autofocus': true } : undefined}
|
|
156
159
|
>
|
|
160
|
+
{pf.icon && <LuiIcon name={pf.icon} alt={pf.title} size={'md'} />}
|
|
157
161
|
{pf.title}
|
|
158
162
|
</LuiButton>
|
|
159
163
|
))}
|
|
@@ -185,7 +189,7 @@ export const useLuiModalPrefab = () => {
|
|
|
185
189
|
const { showModal, modalOwnerRef } = useShowAsyncModal();
|
|
186
190
|
|
|
187
191
|
const showPrefabModal = useCallback(
|
|
188
|
-
<RT = string
|
|
192
|
+
<RT = string>(props: PropsWithChildren<useLuiModalPrefabProps<RT>>): PromiseWithResolve<RT> => {
|
|
189
193
|
debugLog(`Show '${props.level}' prefab-modal '${props.title}'`, props);
|
|
190
194
|
if (typeof props.children === 'string') {
|
|
191
195
|
// Convert \n to <br/>
|
package/dist/common/debug.ts
CHANGED
|
@@ -40,7 +40,9 @@ export const PanelHeader = ({
|
|
|
40
40
|
const [cursor, setCursor] = useState<'grab' | 'grabbing'>('grab');
|
|
41
41
|
|
|
42
42
|
const headerMouseDown = () => {
|
|
43
|
-
!panelPoppedOut
|
|
43
|
+
if (!panelPoppedOut) {
|
|
44
|
+
setCursor('grabbing');
|
|
45
|
+
}
|
|
44
46
|
};
|
|
45
47
|
|
|
46
48
|
return (
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"popout"
|
|
14
14
|
],
|
|
15
15
|
"main": "./dist/index.ts",
|
|
16
|
-
"version": "9.
|
|
16
|
+
"version": "9.3.0",
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@linzjs/lui": ">=23",
|
|
19
19
|
"lodash-es": ">=4",
|
|
@@ -37,11 +37,10 @@
|
|
|
37
37
|
"bundle": "tsc --noEmit && rollup -c",
|
|
38
38
|
"test": "vitest run",
|
|
39
39
|
"test:watch": "vitest --watch",
|
|
40
|
-
"lintall": "run-s lint:style lint:
|
|
40
|
+
"lintall": "run-s lint:style lint:oxlint",
|
|
41
41
|
"lint:style": "stylelint src/**/*.scss src/**/*.css --fix",
|
|
42
|
-
"lint:
|
|
43
|
-
"lint:fix": "
|
|
44
|
-
"lint:circular-deps": "npx madge --circular --extensions ts,tsx ./",
|
|
42
|
+
"lint:oxlint": "oxlint ./src",
|
|
43
|
+
"lint:fix": "oxlint --fix ./src",
|
|
45
44
|
"storybook": "storybook dev -p 6006",
|
|
46
45
|
"build-storybook": "storybook build",
|
|
47
46
|
"chromatic": "chromatic --exit-zero-on-changes",
|
|
@@ -52,7 +51,7 @@
|
|
|
52
51
|
"@emotion/react": "^11.14.0",
|
|
53
52
|
"@emotion/styled": "11.14.1",
|
|
54
53
|
"@types/uuid": "^11.0.0",
|
|
55
|
-
"lodash-es": "
|
|
54
|
+
"lodash-es": ">=4",
|
|
56
55
|
"react-loading-skeleton": "^3.5.0",
|
|
57
56
|
"react-rnd": "^10.5.3",
|
|
58
57
|
"usehooks-ts": "^3.1.1",
|
|
@@ -60,7 +59,7 @@
|
|
|
60
59
|
},
|
|
61
60
|
"devDependencies": {
|
|
62
61
|
"@chromatic-com/storybook": "^4.1.3",
|
|
63
|
-
"@linzjs/lui": "^24.
|
|
62
|
+
"@linzjs/lui": "^24.11.0",
|
|
64
63
|
"@linzjs/step-ag-grid": "^29.14.1",
|
|
65
64
|
"@linzjs/style": "^5.4.0",
|
|
66
65
|
"@rollup/plugin-commonjs": "^28.0.9",
|
|
@@ -80,15 +79,15 @@
|
|
|
80
79
|
"@vitest/ui": "^4.1.0",
|
|
81
80
|
"ag-grid-community": "34.2.0",
|
|
82
81
|
"ag-grid-react": "34.2.0",
|
|
83
|
-
"eslint-plugin-react": "^7.37.5",
|
|
84
|
-
"eslint-plugin-storybook": "^9.1.20",
|
|
85
82
|
"jsdom": "^27.3.0",
|
|
86
83
|
"mkdirp": "^3.0.1",
|
|
87
84
|
"npm-run-all": "^4.1.5",
|
|
85
|
+
"oxlint": "^1.56.0",
|
|
86
|
+
"oxfmt": "^0.41.0",
|
|
88
87
|
"react": "^18.3.1",
|
|
89
88
|
"react-app-polyfill": "^3.0.0",
|
|
90
89
|
"react-dom": "18.3.1",
|
|
91
|
-
"rollup": "^4.
|
|
90
|
+
"rollup": "^4.60.0",
|
|
92
91
|
"rollup-plugin-copy": "^3.5.0",
|
|
93
92
|
"sass": "^1.98.0",
|
|
94
93
|
"sass-loader": "^16.0.7",
|
|
@@ -107,8 +106,8 @@
|
|
|
107
106
|
"vitest": "^4.1.0"
|
|
108
107
|
},
|
|
109
108
|
"optionalDependencies": {
|
|
110
|
-
"@rollup/rollup-linux-x64-gnu": "^4.
|
|
111
|
-
"@swc/core-linux-x64-gnu": "^1.15.
|
|
109
|
+
"@rollup/rollup-linux-x64-gnu": "^4.60.0",
|
|
110
|
+
"@swc/core-linux-x64-gnu": "^1.15.21"
|
|
112
111
|
},
|
|
113
112
|
"browserslist": {
|
|
114
113
|
"production": [
|
|
@@ -124,7 +123,7 @@
|
|
|
124
123
|
},
|
|
125
124
|
"husky": {
|
|
126
125
|
"hooks": {
|
|
127
|
-
"pre-commit": "npm run
|
|
126
|
+
"pre-commit": "npm run lintall"
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
129
|
}
|