@linzjs/windows 9.2.0 → 9.4.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 +3 -2
- package/dist/common/debug.ts +1 -1
- package/dist/panel/PanelHeader.tsx +3 -1
- package/dist/ribbon/RibbonButton.tsx +8 -1
- package/package.json +8 -9
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
|
|
|
@@ -103,13 +103,14 @@ export const LuiModalPrefab = (props: PropsWithChildren<LuiModalAsyncPrefabProps
|
|
|
103
103
|
|
|
104
104
|
// If there are two options, option 1 is secondary, option 2 is primary
|
|
105
105
|
// Otherwise all options are secondary
|
|
106
|
-
buttons.length === 2
|
|
106
|
+
if (buttons.length === 2) {
|
|
107
107
|
buttons.forEach((b, i) => {
|
|
108
108
|
if (!b.level) {
|
|
109
109
|
// Last button is primary all others are secondary
|
|
110
110
|
b.level = i === buttons.length - 1 ? 'primary' : 'secondary';
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
|
+
}
|
|
113
114
|
|
|
114
115
|
/**
|
|
115
116
|
* When dialog closes save the "don't show" property
|
|
@@ -188,7 +189,7 @@ export const useLuiModalPrefab = () => {
|
|
|
188
189
|
const { showModal, modalOwnerRef } = useShowAsyncModal();
|
|
189
190
|
|
|
190
191
|
const showPrefabModal = useCallback(
|
|
191
|
-
<RT = string
|
|
192
|
+
<RT = string>(props: PropsWithChildren<useLuiModalPrefabProps<RT>>): PromiseWithResolve<RT> => {
|
|
192
193
|
debugLog(`Show '${props.level}' prefab-modal '${props.title}'`, props);
|
|
193
194
|
if (typeof props.children === 'string') {
|
|
194
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 (
|
|
@@ -21,6 +21,7 @@ export interface RibbonButtonProps {
|
|
|
21
21
|
selected?: boolean;
|
|
22
22
|
loading?: boolean;
|
|
23
23
|
processing?: boolean;
|
|
24
|
+
processingMessage?: string;
|
|
24
25
|
className?: string;
|
|
25
26
|
testId?: string;
|
|
26
27
|
onClick?: () => void;
|
|
@@ -39,6 +40,7 @@ export const RibbonButton = forwardRef<HTMLButtonElement, RibbonButtonProps>(fun
|
|
|
39
40
|
selected,
|
|
40
41
|
loading,
|
|
41
42
|
processing,
|
|
43
|
+
processingMessage = `Loading ${title}`,
|
|
42
44
|
disabled,
|
|
43
45
|
testId,
|
|
44
46
|
onClick,
|
|
@@ -63,7 +65,12 @@ export const RibbonButton = forwardRef<HTMLButtonElement, RibbonButtonProps>(fun
|
|
|
63
65
|
|
|
64
66
|
if (processing) {
|
|
65
67
|
return (
|
|
66
|
-
<div
|
|
68
|
+
<div
|
|
69
|
+
className={'RibbonButtonProcessing'}
|
|
70
|
+
role={'status'}
|
|
71
|
+
title={processingMessage}
|
|
72
|
+
aria-label={processingMessage}
|
|
73
|
+
>
|
|
67
74
|
<LuiMiniSpinner size={20} />
|
|
68
75
|
</div>
|
|
69
76
|
);
|
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.4.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",
|
|
@@ -80,11 +79,11 @@
|
|
|
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",
|
|
@@ -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
|
}
|