@linzjs/windows 3.2.0 → 3.2.2
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 +12 -6
- package/dist/LuiModalAsync/useLuiModalPrefab.tsx +5 -2
- package/package.json +35 -36
package/README.md
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
# @linzjs/windows
|
|
2
2
|
|
|
3
|
-
[](https://github.com/semantic-release/semantic-release)
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
> Reusable promise based windowing component for LINZ / Toitū te whenua.
|
|
7
7
|
|
|
8
|
-
|
|
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
|
-
- inline modal/window includes, which prevent you from closing the invoking component before the modal/window has
|
|
12
|
-
|
|
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
|
|
13
14
|
|
|
14
15
|
This module gives you promise based modals/windows which don't require all the state
|
|
15
|
-
based
|
|
16
|
+
based boilerplate / inline-components.
|
|
17
|
+
|
|
18
|
+
So you can simply do this in your react-app:
|
|
19
|
+
```
|
|
20
|
+
const result = await showModal(TestModal)
|
|
21
|
+
```
|
|
16
22
|
|
|
17
23
|
## Features
|
|
18
24
|
- Async HTML dialog based Modals.
|
|
19
|
-
- Draggable and resizeable, pop-in/out Windows.
|
|
25
|
+
- Draggable and resizeable, pop-in/out Panels/Windows.
|
|
20
26
|
|
|
21
27
|
## Install
|
|
22
28
|
```
|
|
@@ -178,14 +178,17 @@ export const useLuiModalPrefab = () => {
|
|
|
178
178
|
const { showModal, modalOwnerRef } = useShowAsyncModal();
|
|
179
179
|
|
|
180
180
|
const showPrefabModal = useCallback(
|
|
181
|
-
<RT extends any = string>(props: PropsWithChildren<useLuiModalPrefabProps<RT>>) => {
|
|
181
|
+
<RT extends any = string>(props: PropsWithChildren<useLuiModalPrefabProps<RT>>): PromiseWithResolve<RT> => {
|
|
182
182
|
if (typeof props.children === "string") {
|
|
183
183
|
// Convert \n to <br/>
|
|
184
184
|
const split = props.children.split("\n");
|
|
185
185
|
props.children = flatMap(split.map((part, i) => (i !== split.length - 1 ? [part, <br key={i} />] : part)));
|
|
186
186
|
}
|
|
187
187
|
if (props.dontShowAgainSessionKey && LuiModalDontShowSessionCheck(props.dontShowAgainSessionKey)) {
|
|
188
|
-
|
|
188
|
+
// Add resolve method to make the signature of showPrefabModal consistent
|
|
189
|
+
const prom = Promise.resolve(undefined) as PromiseWithResolve<RT>;
|
|
190
|
+
prom.resolve = (_val: RT | undefined) => {};
|
|
191
|
+
return prom;
|
|
189
192
|
}
|
|
190
193
|
return showModal(LuiModalPrefab, props, { showOnAllWindows: props.showOnAllWindows }) as PromiseWithResolve<RT>;
|
|
191
194
|
},
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"popout"
|
|
14
14
|
],
|
|
15
15
|
"main": "./dist/index.ts",
|
|
16
|
-
"version": "3.2.
|
|
16
|
+
"version": "3.2.2",
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@linzjs/lui": "^21",
|
|
19
19
|
"lodash-es": ">=4",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "run-s clean stylelint lint lint-circular-deps bundle",
|
|
35
|
-
"yalc": "run-s clean
|
|
35
|
+
"yalc": "run-s clean bundle && yalc publish",
|
|
36
36
|
"clean": "rimraf dist && mkdirp ./dist",
|
|
37
37
|
"bundle": "rollup -c",
|
|
38
38
|
"test": "jest",
|
|
@@ -52,51 +52,51 @@
|
|
|
52
52
|
"lodash-es": ">=4",
|
|
53
53
|
"react-rnd": "^10.4.11",
|
|
54
54
|
"usehooks-ts": "^3.1.0",
|
|
55
|
-
"uuid": "^
|
|
55
|
+
"uuid": "^10.0.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@chromatic-com/storybook": "^1.
|
|
58
|
+
"@chromatic-com/storybook": "^1.6.1",
|
|
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": "^21.1
|
|
63
|
-
"@rollup/plugin-commonjs": "^
|
|
61
|
+
"@linzjs/lui": "^21.39.1",
|
|
62
|
+
"@linzjs/step-ag-grid": "^21.2.1",
|
|
63
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
64
64
|
"@rollup/plugin-json": "^6.1.0",
|
|
65
65
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
66
|
-
"@storybook/addon-docs": "^8.1.
|
|
67
|
-
"@storybook/addon-essentials": "^8.1.
|
|
68
|
-
"@storybook/addon-interactions": "^8.1.
|
|
69
|
-
"@storybook/addon-links": "^8.1.
|
|
70
|
-
"@storybook/addon-mdx-gfm": "^8.1.
|
|
71
|
-
"@storybook/blocks": "^8.1.
|
|
72
|
-
"@storybook/react": "^8.1.
|
|
73
|
-
"@storybook/react-vite": "^8.1.
|
|
74
|
-
"@storybook/test": "^8.1.
|
|
75
|
-
"@storybook/test-runner": "^0.
|
|
76
|
-
"@testing-library/jest-dom": "^6.
|
|
66
|
+
"@storybook/addon-docs": "^8.1.11",
|
|
67
|
+
"@storybook/addon-essentials": "^8.1.11",
|
|
68
|
+
"@storybook/addon-interactions": "^8.1.11",
|
|
69
|
+
"@storybook/addon-links": "^8.1.11",
|
|
70
|
+
"@storybook/addon-mdx-gfm": "^8.1.11",
|
|
71
|
+
"@storybook/blocks": "^8.1.11",
|
|
72
|
+
"@storybook/react": "^8.1.11",
|
|
73
|
+
"@storybook/react-vite": "^8.1.11",
|
|
74
|
+
"@storybook/test": "^8.1.11",
|
|
75
|
+
"@storybook/test-runner": "^0.19.0",
|
|
76
|
+
"@testing-library/jest-dom": "^6.4.6",
|
|
77
77
|
"@testing-library/react": "^16.0.0",
|
|
78
|
-
"@testing-library/user-event": "^14.5.
|
|
78
|
+
"@testing-library/user-event": "^14.5.2",
|
|
79
79
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
80
80
|
"@types/jest": "^29.5.12",
|
|
81
81
|
"@types/lodash-es": "^4.17.12",
|
|
82
|
-
"@types/node": "^20.14.
|
|
82
|
+
"@types/node": "^20.14.10",
|
|
83
83
|
"@types/react": "^18.3.3",
|
|
84
84
|
"@types/react-dom": "^18.3.0",
|
|
85
|
-
"@types/uuid": "^
|
|
86
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
87
|
-
"@typescript-eslint/parser": "^7.
|
|
85
|
+
"@types/uuid": "^10.0.0",
|
|
86
|
+
"@typescript-eslint/eslint-plugin": "^7.16.0",
|
|
87
|
+
"@typescript-eslint/parser": "^7.16.0",
|
|
88
88
|
"ag-grid-community": "^31.3.2",
|
|
89
89
|
"ag-grid-react": "^31.3.2",
|
|
90
|
-
"esbuild": "^0.
|
|
90
|
+
"esbuild": "^0.23.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
95
|
"eslint-plugin-import": "^2.29.1",
|
|
96
|
-
"eslint-plugin-jest": "^28.
|
|
97
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
96
|
+
"eslint-plugin-jest": "^28.6.0",
|
|
97
|
+
"eslint-plugin-jsx-a11y": "^6.9.0",
|
|
98
98
|
"eslint-plugin-prettier": "^5.1.3",
|
|
99
|
-
"eslint-plugin-react": "^7.34.
|
|
99
|
+
"eslint-plugin-react": "^7.34.3",
|
|
100
100
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
101
101
|
"eslint-plugin-storybook": "^0.8.0",
|
|
102
102
|
"eslint-plugin-testing-library": "^6.2.2",
|
|
@@ -106,26 +106,25 @@
|
|
|
106
106
|
"jest-expect-message": "^1.1.3",
|
|
107
107
|
"mkdirp": "^3.0.1",
|
|
108
108
|
"npm-run-all": "^4.1.5",
|
|
109
|
-
"prettier": "^3.3.
|
|
110
|
-
"prop-types": "^15.8.1",
|
|
109
|
+
"prettier": "^3.3.2",
|
|
111
110
|
"react": "^18.3.1",
|
|
112
111
|
"react-app-polyfill": "^3.0.0",
|
|
113
112
|
"react-dom": "^18.3.1",
|
|
114
|
-
"rollup": "^4.18.
|
|
113
|
+
"rollup": "^4.18.1",
|
|
115
114
|
"rollup-plugin-copy": "^3.5.0",
|
|
116
|
-
"sass": "^1.77.
|
|
115
|
+
"sass": "^1.77.6",
|
|
117
116
|
"sass-loader": "^14.2.1",
|
|
118
117
|
"semantic-release": "^22.0.12",
|
|
119
|
-
"storybook": "^8.1.
|
|
118
|
+
"storybook": "^8.1.11",
|
|
120
119
|
"style-loader": "^4.0.0",
|
|
121
120
|
"stylelint": "^16.6.1",
|
|
122
|
-
"stylelint-config-recommended": "^14.0.
|
|
121
|
+
"stylelint-config-recommended": "^14.0.1",
|
|
123
122
|
"stylelint-config-recommended-scss": "^14.0.0",
|
|
124
|
-
"stylelint-config-standard": "^36.0.
|
|
123
|
+
"stylelint-config-standard": "^36.0.1",
|
|
125
124
|
"stylelint-prettier": "5.0.0",
|
|
126
|
-
"stylelint-scss": "6.3.
|
|
125
|
+
"stylelint-scss": "6.3.2",
|
|
127
126
|
"typescript": "^5.4.5",
|
|
128
|
-
"vite": "^5.
|
|
127
|
+
"vite": "^5.3.3"
|
|
129
128
|
},
|
|
130
129
|
"eslintConfig": {
|
|
131
130
|
"extends": [
|