@iowas/toolpad 1.0.4 → 1.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iowas/toolpad",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "license": "MIT",
5
5
  "repository": "https://github.com/iowa/toolpad",
6
6
  "description": "Custom mui-toolpad",
@@ -22,20 +22,10 @@
22
22
  "types": "./dist/core.d.ts",
23
23
  "import": "./dist/core.mjs",
24
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
25
  }
36
26
  },
37
27
  "scripts": {
38
- "build": "tsup --config tsup.config.ts",
28
+ "build": "tsup --config tsup.config.ts && node scripts/add-use-client.js",
39
29
  "prepack": "pnpm build",
40
30
  "format": "pretty-quick",
41
31
  "format:check": "prettier --check src",
@@ -1,201 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
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
- interface LocalizationProviderProps {
55
- children?: React.ReactNode;
56
- /**
57
- * Locale for components texts
58
- */
59
- localeText?: Partial<LocaleText>;
60
- }
61
- declare const LocalizationContext: React.Context<Partial<LocaleText>>;
62
- declare const LocalizationProvider: {
63
- (props: LocalizationProviderProps): react_jsx_runtime.JSX.Element;
64
- propTypes: any;
65
- };
66
-
67
- /**
68
- *
69
- * Demos:
70
- *
71
- * - [Sign-in Page](https://mui.com/toolpad/core/react-sign-in-page/)
72
- *
73
- * API:
74
- *
75
- * - [LocalizationProvider API](https://mui.com/toolpad/core/api/localization-provider)
76
- */
77
- declare function useLocaleText(): Partial<LocaleText>;
78
-
79
- interface NavigateOptions {
80
- history?: 'auto' | 'push' | 'replace';
81
- }
82
- interface Navigate {
83
- (url: string | URL, options?: NavigateOptions): void;
84
- }
85
- /**
86
- * Abstract router used by Toolpad components.
87
- */
88
- interface Router {
89
- pathname: string;
90
- searchParams: URLSearchParams;
91
- navigate: Navigate;
92
- Link?: React.ComponentType<LinkProps>;
93
- }
94
- interface Branding {
95
- title?: string;
96
- logo?: React.ReactNode;
97
- homeUrl?: string;
98
- }
99
- interface NavigationPageItem {
100
- kind?: 'page';
101
- segment?: string;
102
- title?: string;
103
- icon?: React.ReactNode;
104
- pattern?: string;
105
- action?: React.ReactNode;
106
- children?: Navigation;
107
- }
108
- interface NavigationSubheaderItem {
109
- kind: 'header';
110
- title: string;
111
- }
112
- interface NavigationDividerItem {
113
- kind: 'divider';
114
- }
115
- type NavigationItem = NavigationPageItem | NavigationSubheaderItem | NavigationDividerItem;
116
- type Navigation = NavigationItem[];
117
- interface Session {
118
- user?: {
119
- id?: string | null;
120
- name?: string | null;
121
- image?: string | null;
122
- email?: string | null;
123
- };
124
- }
125
- interface Authentication {
126
- signIn: () => void;
127
- signOut: () => void;
128
- }
129
- declare const AuthenticationContext: React.Context<Authentication | null>;
130
- declare const SessionContext: React.Context<Session | null>;
131
- type AppTheme = Theme | {
132
- light: Theme;
133
- dark: Theme;
134
- };
135
- interface AppProviderProps {
136
- /**
137
- * The content of the app provider.
138
- */
139
- children: React.ReactNode;
140
- /**
141
- * [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.
142
- * @default createDefaultTheme()
143
- */
144
- theme?: AppTheme;
145
- /**
146
- * Branding options for the app.
147
- * @default null
148
- */
149
- branding?: Branding | null;
150
- /**
151
- * Navigation definition for the app. [Find out more](https://mui.com/toolpad/core/react-app-provider/#navigation).
152
- * @default []
153
- */
154
- navigation?: Navigation;
155
- /**
156
- * Router implementation used inside Toolpad components.
157
- * @default null
158
- */
159
- router?: Router;
160
- /**
161
- * Locale text for components
162
- */
163
- localeText?: Partial<LocaleText>;
164
- /**
165
- * Session info about the current user.
166
- * @default null
167
- */
168
- session?: Session | null;
169
- /**
170
- * Authentication methods.
171
- * @default null
172
- */
173
- authentication?: Authentication | null;
174
- /**
175
- * The window where the application is rendered.
176
- * This is needed when rendering the app inside an iframe, for example.
177
- * @default window
178
- */
179
- window?: Window;
180
- /**
181
- * The nonce to be used for inline scripts.
182
- */
183
- nonce?: string;
184
- }
185
- /**
186
- *
187
- * Demos:
188
- *
189
- * - [App Provider](https://mui.com/toolpad/core/react-app-provider/)
190
- * - [Dashboard Layout](https://mui.com/toolpad/core/react-dashboard-layout/)
191
- *
192
- * API:
193
- *
194
- * - [AppProvider API](https://mui.com/toolpad/core/api/app-provider)
195
- */
196
- declare function AppProvider(props: AppProviderProps): react_jsx_runtime.JSX.Element;
197
- declare namespace AppProvider {
198
- var propTypes: any;
199
- }
200
-
201
- export { AppProvider as A, type Branding as B, type LocaleText as L, type Navigate as N, type Router as R, type Session as S, type AppProviderProps as a, type AppTheme as b, type Authentication as c, AuthenticationContext as d, LocalizationContext as e, LocalizationProvider as f, type LocalizationProviderProps as g, type NavigateOptions as h, type Navigation as i, type NavigationDividerItem as j, type NavigationItem as k, type NavigationPageItem as l, type NavigationSubheaderItem as m, SessionContext as n, useLocaleText as u };
@@ -1,201 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
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
- interface LocalizationProviderProps {
55
- children?: React.ReactNode;
56
- /**
57
- * Locale for components texts
58
- */
59
- localeText?: Partial<LocaleText>;
60
- }
61
- declare const LocalizationContext: React.Context<Partial<LocaleText>>;
62
- declare const LocalizationProvider: {
63
- (props: LocalizationProviderProps): react_jsx_runtime.JSX.Element;
64
- propTypes: any;
65
- };
66
-
67
- /**
68
- *
69
- * Demos:
70
- *
71
- * - [Sign-in Page](https://mui.com/toolpad/core/react-sign-in-page/)
72
- *
73
- * API:
74
- *
75
- * - [LocalizationProvider API](https://mui.com/toolpad/core/api/localization-provider)
76
- */
77
- declare function useLocaleText(): Partial<LocaleText>;
78
-
79
- interface NavigateOptions {
80
- history?: 'auto' | 'push' | 'replace';
81
- }
82
- interface Navigate {
83
- (url: string | URL, options?: NavigateOptions): void;
84
- }
85
- /**
86
- * Abstract router used by Toolpad components.
87
- */
88
- interface Router {
89
- pathname: string;
90
- searchParams: URLSearchParams;
91
- navigate: Navigate;
92
- Link?: React.ComponentType<LinkProps>;
93
- }
94
- interface Branding {
95
- title?: string;
96
- logo?: React.ReactNode;
97
- homeUrl?: string;
98
- }
99
- interface NavigationPageItem {
100
- kind?: 'page';
101
- segment?: string;
102
- title?: string;
103
- icon?: React.ReactNode;
104
- pattern?: string;
105
- action?: React.ReactNode;
106
- children?: Navigation;
107
- }
108
- interface NavigationSubheaderItem {
109
- kind: 'header';
110
- title: string;
111
- }
112
- interface NavigationDividerItem {
113
- kind: 'divider';
114
- }
115
- type NavigationItem = NavigationPageItem | NavigationSubheaderItem | NavigationDividerItem;
116
- type Navigation = NavigationItem[];
117
- interface Session {
118
- user?: {
119
- id?: string | null;
120
- name?: string | null;
121
- image?: string | null;
122
- email?: string | null;
123
- };
124
- }
125
- interface Authentication {
126
- signIn: () => void;
127
- signOut: () => void;
128
- }
129
- declare const AuthenticationContext: React.Context<Authentication | null>;
130
- declare const SessionContext: React.Context<Session | null>;
131
- type AppTheme = Theme | {
132
- light: Theme;
133
- dark: Theme;
134
- };
135
- interface AppProviderProps {
136
- /**
137
- * The content of the app provider.
138
- */
139
- children: React.ReactNode;
140
- /**
141
- * [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.
142
- * @default createDefaultTheme()
143
- */
144
- theme?: AppTheme;
145
- /**
146
- * Branding options for the app.
147
- * @default null
148
- */
149
- branding?: Branding | null;
150
- /**
151
- * Navigation definition for the app. [Find out more](https://mui.com/toolpad/core/react-app-provider/#navigation).
152
- * @default []
153
- */
154
- navigation?: Navigation;
155
- /**
156
- * Router implementation used inside Toolpad components.
157
- * @default null
158
- */
159
- router?: Router;
160
- /**
161
- * Locale text for components
162
- */
163
- localeText?: Partial<LocaleText>;
164
- /**
165
- * Session info about the current user.
166
- * @default null
167
- */
168
- session?: Session | null;
169
- /**
170
- * Authentication methods.
171
- * @default null
172
- */
173
- authentication?: Authentication | null;
174
- /**
175
- * The window where the application is rendered.
176
- * This is needed when rendering the app inside an iframe, for example.
177
- * @default window
178
- */
179
- window?: Window;
180
- /**
181
- * The nonce to be used for inline scripts.
182
- */
183
- nonce?: string;
184
- }
185
- /**
186
- *
187
- * Demos:
188
- *
189
- * - [App Provider](https://mui.com/toolpad/core/react-app-provider/)
190
- * - [Dashboard Layout](https://mui.com/toolpad/core/react-dashboard-layout/)
191
- *
192
- * API:
193
- *
194
- * - [AppProvider API](https://mui.com/toolpad/core/api/app-provider)
195
- */
196
- declare function AppProvider(props: AppProviderProps): react_jsx_runtime.JSX.Element;
197
- declare namespace AppProvider {
198
- var propTypes: any;
199
- }
200
-
201
- export { AppProvider as A, type Branding as B, type LocaleText as L, type Navigate as N, type Router as R, type Session as S, type AppProviderProps as a, type AppTheme as b, type Authentication as c, AuthenticationContext as d, LocalizationContext as e, LocalizationProvider as f, type LocalizationProviderProps as g, type NavigateOptions as h, type Navigation as i, type NavigationDividerItem as j, type NavigationItem as k, type NavigationPageItem as l, type NavigationSubheaderItem as m, SessionContext as n, useLocaleText as u };
@@ -1,125 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
-
33
- // src/toolpad-utils/react.tsx
34
- import * as React from "react";
35
- import * as ReactIs from "react-is";
36
- import { jsx } from "react/jsx-runtime";
37
- function interleave(items, separator) {
38
- const result = [];
39
- for (let i = 0; i < items.length; i += 1) {
40
- if (i > 0) {
41
- if (ReactIs.isElement(separator)) {
42
- result.push(React.cloneElement(separator, { key: `separator-${i}` }));
43
- } else {
44
- result.push(separator);
45
- }
46
- }
47
- const item = items[i];
48
- result.push(item);
49
- }
50
- return /* @__PURE__ */ jsx(React.Fragment, { children: result });
51
- }
52
- function useNonNullableContext(context, name) {
53
- const maybeContext = React.useContext(context);
54
- if (maybeContext === null || maybeContext === void 0) {
55
- throw new Error(`context "${name}" was used without a Provider`);
56
- }
57
- return maybeContext;
58
- }
59
- function createProvidedContext(name) {
60
- const context = React.createContext(void 0);
61
- const useContext2 = () => useNonNullableContext(context, name);
62
- return [useContext2, context.Provider];
63
- }
64
- function useAssertedContext(context) {
65
- const value = React.useContext(context);
66
- if (value === void 0) {
67
- throw new Error("context was used without a Provider");
68
- }
69
- return value;
70
- }
71
- function useTraceUpdates(prefix, props) {
72
- const prev = React.useRef(props);
73
- React.useEffect(() => {
74
- const changedProps = {};
75
- for (const key of Object.keys(props)) {
76
- if (!Object.is(prev.current[key], props[key])) {
77
- changedProps[key] = props[key];
78
- }
79
- }
80
- if (Object.keys(changedProps).length > 0) {
81
- console.log(`${prefix} changed props:`, changedProps);
82
- }
83
- prev.current = props;
84
- });
85
- }
86
- function createGlobalState(initialState) {
87
- let state = initialState;
88
- const listeners = [];
89
- const subscribe = (cb) => {
90
- listeners.push(cb);
91
- return () => {
92
- const index = listeners.indexOf(cb);
93
- listeners.splice(index, 1);
94
- };
95
- };
96
- const getState = () => state;
97
- const setState = (newState) => {
98
- state = typeof newState === "function" ? newState(state) : newState;
99
- listeners.forEach((cb) => cb(state));
100
- };
101
- const useValue = () => React.useSyncExternalStore(subscribe, getState, getState);
102
- const useState = () => {
103
- const value = useValue();
104
- return [value, setState];
105
- };
106
- return {
107
- getState,
108
- setState,
109
- useValue,
110
- useState,
111
- subscribe
112
- };
113
- }
114
-
115
- export {
116
- __spreadValues,
117
- __spreadProps,
118
- __objRest,
119
- interleave,
120
- useNonNullableContext,
121
- createProvidedContext,
122
- useAssertedContext,
123
- useTraceUpdates,
124
- createGlobalState
125
- };
@@ -1,12 +0,0 @@
1
- // src/toolpad-utils/warnOnce.ts
2
- var history = /* @__PURE__ */ new Set();
3
- function warnOnce(msg) {
4
- if (!history.has(msg)) {
5
- history.add(msg);
6
- console.warn(msg);
7
- }
8
- }
9
-
10
- export {
11
- warnOnce
12
- };