@iowas/toolpad 1.0.0 → 1.0.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 CHANGED
@@ -28,7 +28,7 @@ import { NextAppProvider } from '@iowas/toolpad/nextjs';
28
28
 
29
29
  ```bash
30
30
  pnpm install
31
- pnpm build
31
+ pnpm run build
32
32
  ```
33
33
 
34
34
  Build output is generated in `dist/`.
@@ -38,7 +38,7 @@ Build output is generated in `dist/`.
38
38
  From this repository:
39
39
 
40
40
  ```bash
41
- pnpm build
41
+ pnpm run build
42
42
  pnpm pack
43
43
  ```
44
44
 
@@ -55,3 +55,10 @@ pnpm add /absolute/path/to/@iowas%2ftoolpad-1.0.0.tgz
55
55
  - `@iowas/toolpad/utils`
56
56
  - `@iowas/toolpad/nextjs`
57
57
 
58
+ ```bash
59
+ npm login
60
+ ```
61
+
62
+ ```bash
63
+ pnpm publish
64
+ ```
@@ -32,6 +32,28 @@ function equalProperties(obj1, obj2, subset) {
32
32
  return Array.from(keysToCheck).every((key) => Object.is(obj1[key], obj2[key]));
33
33
  }
34
34
 
35
+ // src/toolpad-utils/hooks/useBoolean.ts
36
+ import * as React from "react";
37
+ function useBoolean(initialValue) {
38
+ const [value, setValue] = React.useState(initialValue);
39
+ const toggle = React.useCallback(() => setValue((existing) => !existing), []);
40
+ const setTrue = React.useCallback(() => setValue(true), []);
41
+ const setFalse = React.useCallback(() => setValue(false), []);
42
+ return { value, setValue, toggle, setTrue, setFalse };
43
+ }
44
+
45
+ // src/toolpad-utils/hooks/usePageTitle.ts
46
+ import * as React2 from "react";
47
+ function usePageTitle(title) {
48
+ React2.useEffect(() => {
49
+ const original = document.title;
50
+ document.title = title;
51
+ return () => {
52
+ document.title = original;
53
+ };
54
+ }, [title]);
55
+ }
56
+
35
57
  export {
36
58
  asArray,
37
59
  hasOwnProperty,
@@ -40,5 +62,7 @@ export {
40
62
  mapValues,
41
63
  filterValues,
42
64
  filterKeys,
43
- equalProperties
65
+ equalProperties,
66
+ useBoolean,
67
+ usePageTitle
44
68
  };
package/dist/index.mjs CHANGED
@@ -34,13 +34,6 @@ import {
34
34
  useStorageState,
35
35
  useStorageStateServer
36
36
  } from "./chunk-LUTZBKSG.mjs";
37
- import {
38
- useBoolean,
39
- usePageTitle
40
- } from "./chunk-CENJI4RY.mjs";
41
- import {
42
- warnOnce
43
- } from "./chunk-F6JD4MSY.mjs";
44
37
  import {
45
38
  asArray,
46
39
  equalProperties,
@@ -49,8 +42,13 @@ import {
49
42
  hasOwnProperty,
50
43
  mapKeys,
51
44
  mapProperties,
52
- mapValues
53
- } from "./chunk-UNVYOWC2.mjs";
45
+ mapValues,
46
+ useBoolean,
47
+ usePageTitle
48
+ } from "./chunk-PMIWCP25.mjs";
49
+ import {
50
+ warnOnce
51
+ } from "./chunk-F6JD4MSY.mjs";
54
52
  import {
55
53
  createGlobalState,
56
54
  createProvidedContext,
package/dist/nextjs.js CHANGED
@@ -63,9 +63,6 @@ __export(nextjs_exports, {
63
63
  });
64
64
  module.exports = __toCommonJS(nextjs_exports);
65
65
 
66
- // src/toolpad-core/nextjs/NextAppProvider.tsx
67
- var import_router2 = require("next/compat/router.js");
68
-
69
66
  // src/toolpad-core/nextjs/NextAppProviderApp.tsx
70
67
  var React11 = __toESM(require("react"));
71
68
  var import_link = __toESM(require("next/link.js"));
@@ -793,64 +790,11 @@ function NextAppProviderApp(props) {
793
790
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AppProvider, __spreadValues({ router: routerImpl }, props));
794
791
  }
795
792
 
796
- // src/toolpad-core/nextjs/NextAppProviderPages.tsx
797
- var React12 = __toESM(require("react"));
798
- var import_link2 = __toESM(require("next/link.js"));
799
- var import_router = require("next/router.js");
800
-
801
- // src/toolpad-utils/collections.ts
802
- function asArray(maybeArray) {
803
- return Array.isArray(maybeArray) ? maybeArray : [maybeArray];
804
- }
805
-
806
- // src/toolpad-core/nextjs/NextAppProviderPages.tsx
807
- var import_jsx_runtime8 = require("react/jsx-runtime");
808
- var Link2 = React12.forwardRef((props, ref) => {
809
- const _a = props, { href, history } = _a, rest = __objRest(_a, ["href", "history"]);
810
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_link2.default, __spreadValues({ ref, href, replace: history === "replace" }, rest));
811
- });
812
- function NextAppProviderPages(props) {
813
- const { push, replace, asPath, query } = (0, import_router.useRouter)();
814
- const search = React12.useMemo(() => {
815
- const params = new URLSearchParams();
816
- Object.entries(query != null ? query : {}).forEach(([key, value]) => {
817
- asArray(value != null ? value : []).forEach((v) => {
818
- params.append(key, v);
819
- });
820
- });
821
- return params.toString();
822
- }, [query]);
823
- const searchParams = React12.useMemo(() => new URLSearchParams(search), [search]);
824
- const navigate = React12.useCallback(
825
- (url, { history = "auto" } = {}) => {
826
- if (history === "auto" || history === "push") {
827
- return push(String(url));
828
- }
829
- if (history === "replace") {
830
- return replace(String(url));
831
- }
832
- throw new Error(`Invalid history option: ${history}`);
833
- },
834
- [push, replace]
835
- );
836
- const routerImpl = React12.useMemo(
837
- () => ({
838
- pathname: asPath.split("?")[0],
839
- searchParams,
840
- navigate,
841
- Link: Link2
842
- }),
843
- [asPath, navigate, searchParams]
844
- );
845
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AppProvider, __spreadValues({ router: routerImpl }, props));
846
- }
847
-
848
793
  // src/toolpad-core/nextjs/NextAppProvider.tsx
849
- var import_jsx_runtime9 = require("react/jsx-runtime");
794
+ var import_jsx_runtime8 = require("react/jsx-runtime");
850
795
  function NextAppProvider(props) {
851
- const router = (0, import_router2.useRouter)();
852
- const AppProvider2 = router ? NextAppProviderPages : NextAppProviderApp;
853
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AppProvider2, __spreadValues({}, props));
796
+ const AppProvider2 = NextAppProviderApp;
797
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AppProvider2, __spreadValues({}, props));
854
798
  }
855
799
  // Annotate the CommonJS export names for ESM import in node:
856
800
  0 && (module.exports = {
package/dist/nextjs.mjs CHANGED
@@ -1,17 +1,11 @@
1
1
  import {
2
2
  AppProvider
3
3
  } from "./chunk-LUTZBKSG.mjs";
4
- import {
5
- asArray
6
- } from "./chunk-UNVYOWC2.mjs";
7
4
  import {
8
5
  __objRest,
9
6
  __spreadValues
10
7
  } from "./chunk-3JWXE2JW.mjs";
11
8
 
12
- // src/toolpad-core/nextjs/NextAppProvider.tsx
13
- import { useRouter as useRouter3 } from "next/compat/router.js";
14
-
15
9
  // src/toolpad-core/nextjs/NextAppProviderApp.tsx
16
10
  import * as React from "react";
17
11
  import NextLink from "next/link.js";
@@ -49,57 +43,11 @@ function NextAppProviderApp(props) {
49
43
  return /* @__PURE__ */ jsx(AppProvider, __spreadValues({ router: routerImpl }, props));
50
44
  }
51
45
 
52
- // src/toolpad-core/nextjs/NextAppProviderPages.tsx
53
- import * as React2 from "react";
54
- import NextLink2 from "next/link.js";
55
- import { useRouter as useRouter2 } from "next/router.js";
56
- import { jsx as jsx2 } from "react/jsx-runtime";
57
- var Link2 = React2.forwardRef((props, ref) => {
58
- const _a = props, { href, history } = _a, rest = __objRest(_a, ["href", "history"]);
59
- return /* @__PURE__ */ jsx2(NextLink2, __spreadValues({ ref, href, replace: history === "replace" }, rest));
60
- });
61
- function NextAppProviderPages(props) {
62
- const { push, replace, asPath, query } = useRouter2();
63
- const search = React2.useMemo(() => {
64
- const params = new URLSearchParams();
65
- Object.entries(query != null ? query : {}).forEach(([key, value]) => {
66
- asArray(value != null ? value : []).forEach((v) => {
67
- params.append(key, v);
68
- });
69
- });
70
- return params.toString();
71
- }, [query]);
72
- const searchParams = React2.useMemo(() => new URLSearchParams(search), [search]);
73
- const navigate = React2.useCallback(
74
- (url, { history = "auto" } = {}) => {
75
- if (history === "auto" || history === "push") {
76
- return push(String(url));
77
- }
78
- if (history === "replace") {
79
- return replace(String(url));
80
- }
81
- throw new Error(`Invalid history option: ${history}`);
82
- },
83
- [push, replace]
84
- );
85
- const routerImpl = React2.useMemo(
86
- () => ({
87
- pathname: asPath.split("?")[0],
88
- searchParams,
89
- navigate,
90
- Link: Link2
91
- }),
92
- [asPath, navigate, searchParams]
93
- );
94
- return /* @__PURE__ */ jsx2(AppProvider, __spreadValues({ router: routerImpl }, props));
95
- }
96
-
97
46
  // src/toolpad-core/nextjs/NextAppProvider.tsx
98
- import { jsx as jsx3 } from "react/jsx-runtime";
47
+ import { jsx as jsx2 } from "react/jsx-runtime";
99
48
  function NextAppProvider(props) {
100
- const router = useRouter3();
101
- const AppProvider2 = router ? NextAppProviderPages : NextAppProviderApp;
102
- return /* @__PURE__ */ jsx3(AppProvider2, __spreadValues({}, props));
49
+ const AppProvider2 = NextAppProviderApp;
50
+ return /* @__PURE__ */ jsx2(AppProvider2, __spreadValues({}, props));
103
51
  }
104
52
  export {
105
53
  NextAppProvider
package/dist/utils.mjs CHANGED
@@ -1,10 +1,3 @@
1
- import {
2
- useBoolean,
3
- usePageTitle
4
- } from "./chunk-CENJI4RY.mjs";
5
- import {
6
- warnOnce
7
- } from "./chunk-F6JD4MSY.mjs";
8
1
  import {
9
2
  asArray,
10
3
  equalProperties,
@@ -13,8 +6,13 @@ import {
13
6
  hasOwnProperty,
14
7
  mapKeys,
15
8
  mapProperties,
16
- mapValues
17
- } from "./chunk-UNVYOWC2.mjs";
9
+ mapValues,
10
+ useBoolean,
11
+ usePageTitle
12
+ } from "./chunk-PMIWCP25.mjs";
13
+ import {
14
+ warnOnce
15
+ } from "./chunk-F6JD4MSY.mjs";
18
16
  import {
19
17
  createGlobalState,
20
18
  createProvidedContext,
package/package.json CHANGED
@@ -1,87 +1,102 @@
1
- {
2
- "name": "@iowas/toolpad",
3
- "version": "1.0.0",
4
- "description": "Custom mui-toolpad",
5
- "main": "./dist/index.js",
6
- "module": "./dist/index.mjs",
7
- "types": "./dist/index.d.ts",
8
- "files": [
9
- "dist",
10
- "README.md"
11
- ],
12
- "sideEffects": false,
13
- "exports": {
14
- ".": {
15
- "types": "./dist/index.d.ts",
16
- "import": "./dist/index.mjs",
17
- "require": "./dist/index.js"
18
- },
19
- "./core": {
20
- "types": "./dist/core.d.ts",
21
- "import": "./dist/core.mjs",
22
- "require": "./dist/core.js"
23
- },
24
- "./utils": {
25
- "types": "./dist/utils.d.ts",
26
- "import": "./dist/utils.mjs",
27
- "require": "./dist/utils.js"
28
- },
29
- "./nextjs": {
30
- "types": "./dist/nextjs.d.ts",
31
- "import": "./dist/nextjs.mjs",
32
- "require": "./dist/nextjs.js"
33
- }
34
- },
35
- "dependencies": {
36
- "invariant": "2.2.4",
37
- "path-to-regexp": "8.4.1",
38
- "prop-types": "15.8.1",
39
- "react-is": "^19.2.4"
40
- },
41
- "peerDependencies": {
42
- "@emotion/cache": "^11.14.0",
43
- "@emotion/react": "^11.14.0",
44
- "@emotion/styled": "^11.14.1",
45
- "@mui/icons-material": "^7.3.9",
46
- "@mui/material": "^7.3.9",
47
- "@mui/material-nextjs": "^7.3.9",
48
- "@mui/utils": "^7.3.9",
49
- "next": "^16.2.2",
50
- "react": "^19.2.4",
51
- "react-dom": "^19.2.4"
52
- },
53
- "peerDependenciesMeta": {
54
- "next": {
55
- "optional": true
56
- },
57
- "@mui/material-nextjs": {
58
- "optional": true
59
- }
60
- },
61
- "devDependencies": {
62
- "@eslint/js": "^9.39.4",
63
- "@types/invariant": "^2.2.37",
64
- "@types/node": "^25.5.0",
65
- "@types/prop-types": "^15.7.15",
66
- "@types/react": "^19.2.14",
67
- "@types/react-is": "^19.2.0",
68
- "@types/react-dom": "^19.2.3",
69
- "eslint": "^9.39.4",
70
- "eslint-config-next": "^16.2.2",
71
- "husky": "^9.1.7",
72
- "lint-staged": "^16.4.0",
73
- "prettier": "3.8.1",
74
- "pretty-quick": "^4.2.2",
75
- "tsup": "^8.5.0",
76
- "typescript": "^6.0.2"
77
- },
78
- "publishConfig": {
79
- "access": "public"
80
- },
81
- "keywords": [],
82
- "author": "Peter Kudela",
83
- "scripts": {
84
- "build": "tsup src/index.ts src/core.ts src/utils.ts src/nextjs.ts --format esm,cjs --dts --clean --out-dir dist --tsconfig tsconfig.build.json",
85
- "test": "echo \"No tests configured\""
86
- }
87
- }
1
+ {
2
+ "name": "@iowas/toolpad",
3
+ "version": "1.0.2",
4
+ "license": "MIT",
5
+ "repository": "https://github.com/iowa/toolpad",
6
+ "description": "Custom mui-toolpad",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.mjs",
9
+ "types": "./dist/index.d.ts",
10
+ "files": [
11
+ "dist",
12
+ "README.md"
13
+ ],
14
+ "sideEffects": false,
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.mjs",
19
+ "require": "./dist/index.js"
20
+ },
21
+ "./core": {
22
+ "types": "./dist/core.d.ts",
23
+ "import": "./dist/core.mjs",
24
+ "require": "./dist/core.js"
25
+ },
26
+ "./utils": {
27
+ "types": "./dist/utils.d.ts",
28
+ "import": "./dist/utils.mjs",
29
+ "require": "./dist/utils.js"
30
+ },
31
+ "./nextjs": {
32
+ "types": "./dist/nextjs.d.ts",
33
+ "import": "./dist/nextjs.mjs",
34
+ "require": "./dist/nextjs.js"
35
+ }
36
+ },
37
+ "scripts": {
38
+ "build": "tsup --config tsup.config.ts",
39
+ "prepack": "pnpm build",
40
+ "format": "pretty-quick",
41
+ "format:check": "prettier --check src",
42
+ "format:fix": "prettier --check --write src",
43
+ "prepare": "husky"
44
+ },
45
+ "lint-staged": {
46
+ "src/**/*.{js,jsx,ts,tsx,json,css,md}": "pnpm run format"
47
+ },
48
+ "dependencies": {
49
+ "invariant": "2.2.4",
50
+ "path-to-regexp": "8.4.1",
51
+ "prop-types": "15.8.1",
52
+ "react-is": "^19.2.4"
53
+ },
54
+ "peerDependencies": {
55
+ "@emotion/cache": "^11.14.0",
56
+ "@emotion/react": "^11.14.0",
57
+ "@emotion/styled": "^11.14.1",
58
+ "@mui/icons-material": "^7.3.9",
59
+ "@mui/material": "^7.3.9",
60
+ "@mui/material-nextjs": "^7.3.9",
61
+ "@mui/utils": "^7.3.9",
62
+ "next": "^16.2.2",
63
+ "react": "^19.2.4",
64
+ "react-dom": "^19.2.4"
65
+ },
66
+ "peerDependenciesMeta": {
67
+ "next": {
68
+ "optional": true
69
+ },
70
+ "@mui/material-nextjs": {
71
+ "optional": true
72
+ }
73
+ },
74
+ "devDependencies": {
75
+ "@types/invariant": "^2.2.37",
76
+ "@types/node": "^25.5.0",
77
+ "@types/prop-types": "^15.7.15",
78
+ "@types/react": "^19.2.14",
79
+ "@types/react-is": "^19.2.0",
80
+ "@types/react-dom": "^19.2.3",
81
+ "husky": "^9.1.7",
82
+ "lint-staged": "^16.4.0",
83
+ "prettier": "3.8.1",
84
+ "pretty-quick": "^4.2.2",
85
+ "tsup": "^8.5.0",
86
+ "typescript": "^6.0.2"
87
+ },
88
+ "publishConfig": {
89
+ "access": "public"
90
+ },
91
+ "keywords": [
92
+ "react",
93
+ "mui",
94
+ "toolpad",
95
+ "internal tools",
96
+ "crud",
97
+ "admin",
98
+ "dashboard"
99
+ ],
100
+ "author": "Peter Kudela",
101
+ "packageManager": "pnpm@10.33.0"
102
+ }
@@ -1,26 +0,0 @@
1
- // src/toolpad-utils/hooks/useBoolean.ts
2
- import * as React from "react";
3
- function useBoolean(initialValue) {
4
- const [value, setValue] = React.useState(initialValue);
5
- const toggle = React.useCallback(() => setValue((existing) => !existing), []);
6
- const setTrue = React.useCallback(() => setValue(true), []);
7
- const setFalse = React.useCallback(() => setValue(false), []);
8
- return { value, setValue, toggle, setTrue, setFalse };
9
- }
10
-
11
- // src/toolpad-utils/hooks/usePageTitle.ts
12
- import * as React2 from "react";
13
- function usePageTitle(title) {
14
- React2.useEffect(() => {
15
- const original = document.title;
16
- document.title = title;
17
- return () => {
18
- document.title = original;
19
- };
20
- }, [title]);
21
- }
22
-
23
- export {
24
- useBoolean,
25
- usePageTitle
26
- };