@iowas/toolpad 1.0.0 → 1.0.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/dist/nextjs.d.mts CHANGED
@@ -1,7 +1,161 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { a as AppProviderProps } from './AppProvider-CIyOzZv_.mjs';
3
- import 'react';
4
- import '@mui/material/styles';
2
+ import * as React from 'react';
3
+ import { Theme } from '@mui/material/styles';
4
+
5
+ /**
6
+ * @ignore - internal component.
7
+ */
8
+ interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
9
+ history?: 'auto' | 'push' | 'replace';
10
+ href: string;
11
+ }
12
+
13
+ interface LocaleText {
14
+ accountSignInLabel: string;
15
+ accountSignOutLabel: string;
16
+ accountPreviewIconButtonLabel: string;
17
+ accountPreviewTitle: string;
18
+ signInTitle: string | ((brandingTitle?: string) => string);
19
+ signInSubtitle: string;
20
+ providerSignInTitle: (provider: string) => string;
21
+ signInRememberMe: string;
22
+ email: string;
23
+ passkey: string;
24
+ username: string;
25
+ password: string;
26
+ or: string;
27
+ to: string;
28
+ with: string;
29
+ save: string;
30
+ cancel: string;
31
+ ok: string;
32
+ close: string;
33
+ delete: string;
34
+ alert: string;
35
+ confirm: string;
36
+ loading: string;
37
+ createNewButtonLabel: string;
38
+ reloadButtonLabel: string;
39
+ createLabel: string;
40
+ createSuccessMessage: string;
41
+ createErrorMessage: string;
42
+ editLabel: string;
43
+ editSuccessMessage: string;
44
+ editErrorMessage: string;
45
+ deleteLabel: string;
46
+ deleteConfirmTitle: string;
47
+ deleteConfirmMessage: string;
48
+ deleteConfirmLabel: string;
49
+ deleteCancelLabel: string;
50
+ deleteSuccessMessage: string;
51
+ deleteErrorMessage: string;
52
+ deletedItemMessage: string;
53
+ }
54
+
55
+ interface NavigateOptions {
56
+ history?: 'auto' | 'push' | 'replace';
57
+ }
58
+ interface Navigate {
59
+ (url: string | URL, options?: NavigateOptions): void;
60
+ }
61
+ /**
62
+ * Abstract router used by Toolpad components.
63
+ */
64
+ interface Router {
65
+ pathname: string;
66
+ searchParams: URLSearchParams;
67
+ navigate: Navigate;
68
+ Link?: React.ComponentType<LinkProps>;
69
+ }
70
+ interface Branding {
71
+ title?: string;
72
+ logo?: React.ReactNode;
73
+ homeUrl?: string;
74
+ }
75
+ interface NavigationPageItem {
76
+ kind?: 'page';
77
+ segment?: string;
78
+ title?: string;
79
+ icon?: React.ReactNode;
80
+ pattern?: string;
81
+ action?: React.ReactNode;
82
+ children?: Navigation;
83
+ }
84
+ interface NavigationSubheaderItem {
85
+ kind: 'header';
86
+ title: string;
87
+ }
88
+ interface NavigationDividerItem {
89
+ kind: 'divider';
90
+ }
91
+ type NavigationItem = NavigationPageItem | NavigationSubheaderItem | NavigationDividerItem;
92
+ type Navigation = NavigationItem[];
93
+ interface Session {
94
+ user?: {
95
+ id?: string | null;
96
+ name?: string | null;
97
+ image?: string | null;
98
+ email?: string | null;
99
+ };
100
+ }
101
+ interface Authentication {
102
+ signIn: () => void;
103
+ signOut: () => void;
104
+ }
105
+ type AppTheme = Theme | {
106
+ light: Theme;
107
+ dark: Theme;
108
+ };
109
+ interface AppProviderProps {
110
+ /**
111
+ * The content of the app provider.
112
+ */
113
+ children: React.ReactNode;
114
+ /**
115
+ * [Theme or themes](https://mui.com/toolpad/core/react-app-provider/#theming) to be used by the app in light/dark mode. A [CSS variables theme](https://mui.com/material-ui/customization/css-theme-variables/overview/) is recommended.
116
+ * @default createDefaultTheme()
117
+ */
118
+ theme?: AppTheme;
119
+ /**
120
+ * Branding options for the app.
121
+ * @default null
122
+ */
123
+ branding?: Branding | null;
124
+ /**
125
+ * Navigation definition for the app. [Find out more](https://mui.com/toolpad/core/react-app-provider/#navigation).
126
+ * @default []
127
+ */
128
+ navigation?: Navigation;
129
+ /**
130
+ * Router implementation used inside Toolpad components.
131
+ * @default null
132
+ */
133
+ router?: Router;
134
+ /**
135
+ * Locale text for components
136
+ */
137
+ localeText?: Partial<LocaleText>;
138
+ /**
139
+ * Session info about the current user.
140
+ * @default null
141
+ */
142
+ session?: Session | null;
143
+ /**
144
+ * Authentication methods.
145
+ * @default null
146
+ */
147
+ authentication?: Authentication | null;
148
+ /**
149
+ * The window where the application is rendered.
150
+ * This is needed when rendering the app inside an iframe, for example.
151
+ * @default window
152
+ */
153
+ window?: Window;
154
+ /**
155
+ * The nonce to be used for inline scripts.
156
+ */
157
+ nonce?: string;
158
+ }
5
159
 
6
160
  declare function NextAppProvider(props: AppProviderProps): react_jsx_runtime.JSX.Element;
7
161
 
package/dist/nextjs.d.ts CHANGED
@@ -1,7 +1,161 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { a as AppProviderProps } from './AppProvider-CIyOzZv_.js';
3
- import 'react';
4
- import '@mui/material/styles';
2
+ import * as React from 'react';
3
+ import { Theme } from '@mui/material/styles';
4
+
5
+ /**
6
+ * @ignore - internal component.
7
+ */
8
+ interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
9
+ history?: 'auto' | 'push' | 'replace';
10
+ href: string;
11
+ }
12
+
13
+ interface LocaleText {
14
+ accountSignInLabel: string;
15
+ accountSignOutLabel: string;
16
+ accountPreviewIconButtonLabel: string;
17
+ accountPreviewTitle: string;
18
+ signInTitle: string | ((brandingTitle?: string) => string);
19
+ signInSubtitle: string;
20
+ providerSignInTitle: (provider: string) => string;
21
+ signInRememberMe: string;
22
+ email: string;
23
+ passkey: string;
24
+ username: string;
25
+ password: string;
26
+ or: string;
27
+ to: string;
28
+ with: string;
29
+ save: string;
30
+ cancel: string;
31
+ ok: string;
32
+ close: string;
33
+ delete: string;
34
+ alert: string;
35
+ confirm: string;
36
+ loading: string;
37
+ createNewButtonLabel: string;
38
+ reloadButtonLabel: string;
39
+ createLabel: string;
40
+ createSuccessMessage: string;
41
+ createErrorMessage: string;
42
+ editLabel: string;
43
+ editSuccessMessage: string;
44
+ editErrorMessage: string;
45
+ deleteLabel: string;
46
+ deleteConfirmTitle: string;
47
+ deleteConfirmMessage: string;
48
+ deleteConfirmLabel: string;
49
+ deleteCancelLabel: string;
50
+ deleteSuccessMessage: string;
51
+ deleteErrorMessage: string;
52
+ deletedItemMessage: string;
53
+ }
54
+
55
+ interface NavigateOptions {
56
+ history?: 'auto' | 'push' | 'replace';
57
+ }
58
+ interface Navigate {
59
+ (url: string | URL, options?: NavigateOptions): void;
60
+ }
61
+ /**
62
+ * Abstract router used by Toolpad components.
63
+ */
64
+ interface Router {
65
+ pathname: string;
66
+ searchParams: URLSearchParams;
67
+ navigate: Navigate;
68
+ Link?: React.ComponentType<LinkProps>;
69
+ }
70
+ interface Branding {
71
+ title?: string;
72
+ logo?: React.ReactNode;
73
+ homeUrl?: string;
74
+ }
75
+ interface NavigationPageItem {
76
+ kind?: 'page';
77
+ segment?: string;
78
+ title?: string;
79
+ icon?: React.ReactNode;
80
+ pattern?: string;
81
+ action?: React.ReactNode;
82
+ children?: Navigation;
83
+ }
84
+ interface NavigationSubheaderItem {
85
+ kind: 'header';
86
+ title: string;
87
+ }
88
+ interface NavigationDividerItem {
89
+ kind: 'divider';
90
+ }
91
+ type NavigationItem = NavigationPageItem | NavigationSubheaderItem | NavigationDividerItem;
92
+ type Navigation = NavigationItem[];
93
+ interface Session {
94
+ user?: {
95
+ id?: string | null;
96
+ name?: string | null;
97
+ image?: string | null;
98
+ email?: string | null;
99
+ };
100
+ }
101
+ interface Authentication {
102
+ signIn: () => void;
103
+ signOut: () => void;
104
+ }
105
+ type AppTheme = Theme | {
106
+ light: Theme;
107
+ dark: Theme;
108
+ };
109
+ interface AppProviderProps {
110
+ /**
111
+ * The content of the app provider.
112
+ */
113
+ children: React.ReactNode;
114
+ /**
115
+ * [Theme or themes](https://mui.com/toolpad/core/react-app-provider/#theming) to be used by the app in light/dark mode. A [CSS variables theme](https://mui.com/material-ui/customization/css-theme-variables/overview/) is recommended.
116
+ * @default createDefaultTheme()
117
+ */
118
+ theme?: AppTheme;
119
+ /**
120
+ * Branding options for the app.
121
+ * @default null
122
+ */
123
+ branding?: Branding | null;
124
+ /**
125
+ * Navigation definition for the app. [Find out more](https://mui.com/toolpad/core/react-app-provider/#navigation).
126
+ * @default []
127
+ */
128
+ navigation?: Navigation;
129
+ /**
130
+ * Router implementation used inside Toolpad components.
131
+ * @default null
132
+ */
133
+ router?: Router;
134
+ /**
135
+ * Locale text for components
136
+ */
137
+ localeText?: Partial<LocaleText>;
138
+ /**
139
+ * Session info about the current user.
140
+ * @default null
141
+ */
142
+ session?: Session | null;
143
+ /**
144
+ * Authentication methods.
145
+ * @default null
146
+ */
147
+ authentication?: Authentication | null;
148
+ /**
149
+ * The window where the application is rendered.
150
+ * This is needed when rendering the app inside an iframe, for example.
151
+ * @default window
152
+ */
153
+ window?: Window;
154
+ /**
155
+ * The nonce to be used for inline scripts.
156
+ */
157
+ nonce?: string;
158
+ }
5
159
 
6
160
  declare function NextAppProvider(props: AppProviderProps): react_jsx_runtime.JSX.Element;
7
161
 
package/dist/nextjs.js CHANGED
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
@@ -63,9 +64,6 @@ __export(nextjs_exports, {
63
64
  });
64
65
  module.exports = __toCommonJS(nextjs_exports);
65
66
 
66
- // src/toolpad-core/nextjs/NextAppProvider.tsx
67
- var import_router2 = require("next/compat/router.js");
68
-
69
67
  // src/toolpad-core/nextjs/NextAppProviderApp.tsx
70
68
  var React11 = __toESM(require("react"));
71
69
  var import_link = __toESM(require("next/link.js"));
@@ -793,64 +791,11 @@ function NextAppProviderApp(props) {
793
791
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AppProvider, __spreadValues({ router: routerImpl }, props));
794
792
  }
795
793
 
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
794
  // src/toolpad-core/nextjs/NextAppProvider.tsx
849
- var import_jsx_runtime9 = require("react/jsx-runtime");
795
+ var import_jsx_runtime8 = require("react/jsx-runtime");
850
796
  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));
797
+ const AppProvider2 = NextAppProviderApp;
798
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AppProvider2, __spreadValues({}, props));
854
799
  }
855
800
  // Annotate the CommonJS export names for ESM import in node:
856
801
  0 && (module.exports = {