@proteinjs/ui 1.0.7 → 1.0.8

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.0.8](https://github.com/proteinjs/ui/compare/@proteinjs/ui@1.0.7...@proteinjs/ui@1.0.8) (2024-04-30)
7
+
8
+ **Note:** Version bump only for package @proteinjs/ui
9
+
10
+
11
+
12
+
13
+
6
14
  ## [1.0.6](https://github.com/proteinjs/ui/compare/@proteinjs/ui@1.0.5...@proteinjs/ui@1.0.6) (2024-04-29)
7
15
 
8
16
 
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Brent Bahry
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -30,7 +30,7 @@ require("react-router");
30
30
  require("react-router-dom");
31
31
  require("string");
32
32
  /** Generate Source Graph */
33
- var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/ui/Page\",\"value\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":\"/Users/brentbahry/workspaces/n3xa/packages/proteinjs/packages/ui/packages/ui/src/router/Page.ts\",\"qualifiedName\":\"@proteinjs/ui/Page\",\"properties\":[{\"name\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"path\",\"type\":{\"packageName\":\"\",\"name\":\"string|string[]\",\"filePath\":null,\"qualifiedName\":\"/string|string[]\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"component\",\"type\":{\"packageName\":\"\",\"name\":\"React.ComponentType<PageComponentProps>\",\"filePath\":null,\"qualifiedName\":\"/React.ComponentType<PageComponentProps>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"noPageContainer\",\"type\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"auth\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"{\\n /** If true, the user does not need to be logged in or have any roles to access this page. If blank, defaults to false. */\\n public?: boolean;\\n /** If true, the user does not need to have any roles to access this page, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean,\\n /** The user must be logged in and have these roles to access this page. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[];\\n }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/{\\n /** If true, the user does not need to be logged in or have any roles to access this page. If blank, defaults to false. */\\n public?: boolean;\\n /** If true, the user does not need to have any roles to access this page, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean,\\n /** The user must be logged in and have these roles to access this page. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[];\\n }\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"pageContainerSxProps\",\"type\":{\"packageName\":\"\",\"name\":\"(theme: Theme) => SxProps\",\"filePath\":null,\"qualifiedName\":\"/(theme: Theme) => SxProps\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"/string | React.ComponentType\"},{\"v\":\"/React.FC\"},{\"v\":\"/Partial\"},{\"v\":\"/React.Component\"}],\"edges\":[{\"v\":\"@proteinjs/ui/Page\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"}]}";
33
+ var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/ui/Page\",\"value\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":\"/home/runner/work/ui/ui/packages/ui/src/router/Page.ts\",\"qualifiedName\":\"@proteinjs/ui/Page\",\"properties\":[{\"name\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"path\",\"type\":{\"packageName\":\"\",\"name\":\"string|string[]\",\"filePath\":null,\"qualifiedName\":\"/string|string[]\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"component\",\"type\":{\"packageName\":\"\",\"name\":\"React.ComponentType<PageComponentProps>\",\"filePath\":null,\"qualifiedName\":\"/React.ComponentType<PageComponentProps>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"noPageContainer\",\"type\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"auth\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"{\\n /** If true, the user does not need to be logged in or have any roles to access this page. If blank, defaults to false. */\\n public?: boolean;\\n /** If true, the user does not need to have any roles to access this page, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean,\\n /** The user must be logged in and have these roles to access this page. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[];\\n }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/{\\n /** If true, the user does not need to be logged in or have any roles to access this page. If blank, defaults to false. */\\n public?: boolean;\\n /** If true, the user does not need to have any roles to access this page, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean,\\n /** The user must be logged in and have these roles to access this page. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[];\\n }\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"pageContainerSxProps\",\"type\":{\"packageName\":\"\",\"name\":\"(theme: Theme) => SxProps\",\"filePath\":null,\"qualifiedName\":\"/(theme: Theme) => SxProps\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"/string | React.ComponentType\"},{\"v\":\"/React.FC\"},{\"v\":\"/Partial\"},{\"v\":\"/React.Component\"}],\"edges\":[{\"v\":\"@proteinjs/ui/Page\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"}]}";
34
34
  /** Generate Source Links */
35
35
  var sourceLinks = {};
36
36
  /** Load Source Graph and Links */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,0BAAwB;AACxB,2BAAyB;AACzB,+BAA6B;AAC7B,yBAAuB;AACvB,iCAA+B;AAC/B,2BAAyB;AACzB,mBAAiB;AACjB,kBAAgB;AAChB,wBAAsB;AACtB,iBAAe;AACf,qBAAmB;AACnB,wBAAsB;AACtB,4BAA0B;AAC1B,kBAAgB;AAGhB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,4hHAA4hH,CAAC;AAGjjH,4BAA4B;AAG5B,IAAM,WAAW,GAAG,EACnB,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,0BAAwB;AACxB,2BAAyB;AACzB,+BAA6B;AAC7B,yBAAuB;AACvB,iCAA+B;AAC/B,2BAAyB;AACzB,mBAAiB;AACjB,kBAAgB;AAChB,wBAAsB;AACtB,iBAAe;AACf,qBAAmB;AACnB,wBAAsB;AACtB,4BAA0B;AAC1B,kBAAgB;AAGhB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,m/GAAm/G,CAAC;AAGxgH,4BAA4B;AAG5B,IAAM,WAAW,GAAG,EACnB,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
@@ -12,8 +12,8 @@ export type AccountIconButtonProps = {
12
12
  logout: () => Promise<string>;
13
13
  };
14
14
  profileMenuItems?: {
15
- name: string;
16
- action: LinkOrDialog;
15
+ menuItemChildren: React.ReactNode;
16
+ action: LinkOrDialog | (() => void);
17
17
  }[];
18
18
  };
19
19
  export declare const AccountIconButton: ({ loginClicked, setLoginClicked, auth, profileMenuItems }: AccountIconButtonProps) => React.JSX.Element | null;
@@ -1 +1 @@
1
- {"version":3,"file":"AccountIconButton.d.ts","sourceRoot":"","sources":["../../../src/container/AccountIconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/D,IAAI,CAAC,EAAE;QACL,UAAU,EAAE,OAAO,CAAC;QACpB,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;QACrC,+DAA+D;QAC/D,KAAK,EAAE,YAAY,CAAC;QACpB,MAAM,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;KAC9B,CAAC;IACF,gBAAgB,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,YAAY,CAAA;KAAE,EAAE,CAAC;CAC7D,CAAA;AAED,eAAO,MAAM,iBAAiB,8DAA+D,sBAAsB,6BAiGlH,CAAA"}
1
+ {"version":3,"file":"AccountIconButton.d.ts","sourceRoot":"","sources":["../../../src/container/AccountIconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/D,IAAI,CAAC,EAAE;QACL,UAAU,EAAE,OAAO,CAAC;QACpB,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;QACrC,+DAA+D;QAC/D,KAAK,EAAE,YAAY,CAAC;QACpB,MAAM,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;KAC9B,CAAC;IACF,gBAAgB,CAAC,EAAE;QAAE,gBAAgB,EAAE,KAAK,CAAC,SAAS,CAAC;QAAC,MAAM,EAAE,YAAY,GAAG,CAAC,MAAM,IAAI,CAAC,CAAA;KAAE,EAAE,CAAC;CACjG,CAAA;AAED,eAAO,MAAM,iBAAiB,8DAA+D,sBAAsB,6BAiHlH,CAAA"}
@@ -44,6 +44,7 @@ var react_1 = __importDefault(require("react"));
44
44
  var material_1 = require("@mui/material");
45
45
  var AccountCircle_1 = __importDefault(require("@mui/icons-material/AccountCircle"));
46
46
  var react_router_dom_1 = require("react-router-dom");
47
+ var Logout_1 = __importDefault(require("@mui/icons-material/Logout"));
47
48
  var AccountIconButton = function (_a) {
48
49
  var loginClicked = _a.loginClicked, setLoginClicked = _a.setLoginClicked, auth = _a.auth, profileMenuItems = _a.profileMenuItems;
49
50
  var navigate = (0, react_router_dom_1.useNavigate)();
@@ -70,8 +71,14 @@ var AccountIconButton = function (_a) {
70
71
  navigate(qualifiedPath(profileMenuItem.action));
71
72
  return;
72
73
  }
73
- setSelectedIndex(index);
74
- }, selected: selectedIndex === index }, profileMenuItem.name)); }),
74
+ else if (isFunction(profileMenuItem.action)) {
75
+ setAccountMenuAnchorEl(null);
76
+ profileMenuItem.action();
77
+ }
78
+ else {
79
+ setSelectedIndex(index);
80
+ }
81
+ }, selected: selectedIndex === index }, profileMenuItem.menuItemChildren)); }),
75
82
  react_1.default.createElement(material_1.MenuItem, { onClick: function (event) { return __awaiter(void 0, void 0, void 0, function () {
76
83
  var redirectPath;
77
84
  return __generator(this, function (_a) {
@@ -83,7 +90,10 @@ var AccountIconButton = function (_a) {
83
90
  return [2 /*return*/];
84
91
  }
85
92
  });
86
- }); } }, "Logout")),
93
+ }); } },
94
+ react_1.default.createElement(material_1.ListItemIcon, null,
95
+ react_1.default.createElement(Logout_1.default, null)),
96
+ react_1.default.createElement(material_1.Typography, null, "Logout"))),
87
97
  react_1.default.createElement(ProfileMenuItemAction, null)));
88
98
  }
89
99
  return (react_1.default.createElement("div", null,
@@ -95,7 +105,10 @@ var AccountIconButton = function (_a) {
95
105
  var menuItem = profileMenuItems[selectedProfileMenuItem];
96
106
  if (typeof menuItem.action === 'string')
97
107
  return null;
98
- return react_1.default.createElement(menuItem.action, { onClose: function () { return setSelectedProfileMenuItem(-1); } });
108
+ if (isDialog(menuItem.action)) {
109
+ return react_1.default.createElement(menuItem.action, { onClose: function () { return setSelectedProfileMenuItem(-1); } });
110
+ }
111
+ return null;
99
112
  }
100
113
  function Login() {
101
114
  if (!loginClicked || !auth || typeof auth.login === 'string')
@@ -109,4 +122,10 @@ var AccountIconButton = function (_a) {
109
122
  }
110
123
  };
111
124
  exports.AccountIconButton = AccountIconButton;
125
+ function isDialog(prop) {
126
+ return typeof prop === 'function' && 'onClose' in prop.prototype;
127
+ }
128
+ function isFunction(prop) {
129
+ return typeof prop === 'function';
130
+ }
112
131
  //# sourceMappingURL=AccountIconButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AccountIconButton.js","sourceRoot":"","sources":["../../../src/container/AccountIconButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,0CAAmE;AACnE,oFAA8D;AAC9D,qDAA+C;AAiBxC,IAAM,iBAAiB,GAAG,UAAC,EAAiF;QAA/E,YAAY,kBAAA,EAAE,eAAe,qBAAA,EAAE,IAAI,UAAA,EAAE,gBAAgB,sBAAA;IACvF,IAAM,QAAQ,GAAG,IAAA,8BAAW,GAAE,CAAC;IACzB,IAAA,KAAwD,eAAK,CAAC,QAAQ,CAAS,CAAC,CAAC,CAAC,EAAjF,uBAAuB,QAAA,EAAE,0BAA0B,QAA8B,CAAC;IACnF,IAAA,KAAoC,eAAK,CAAC,QAAQ,CAAS,CAAC,CAAC,EAA5D,aAAa,QAAA,EAAE,gBAAgB,QAA6B,CAAC;IAC9D,IAAA,KAAqC,eAAK,CAAC,QAAQ,CAAmB,IAAI,CAAC,EAA1E,QAAQ,QAAA,EAAE,sBAAsB,QAA0C,CAAC;IAClF,IAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE/B,IAAI,CAAC,IAAI;QACL,OAAO,IAAI,CAAC;IAEhB,IAAI,IAAI,CAAC,UAAU,EAAE;QACjB,OAAO,CACH;YACI,8BAAC,qBAAU,IACP,EAAE,EAAE;oBACA,SAAS,EAAE;wBACP,KAAK,EAAE,MAAM;wBACb,eAAe,EAAE,aAAa;qBACjC;oBACD,eAAe,EAAE,aAAa;iBACjC,EACD,OAAO,EAAE,UAAA,KAAK,IAAI,OAAA,sBAAsB,CAAC,KAAK,CAAC,aAAa,CAAC,EAA3C,CAA2C;gBAE7D,8BAAC,uBAAa,OAAG,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E,cAAM,OAAA,0BAA0B,CAAC,CAAC,CAAC,CAAC,EAA9B,CAA8B,GAAI,CAAC;SAC7E;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,KAAK;QACZ,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;YACxD,OAAO,IAAI,CAAC;QAEhB,OAAO,8BAAC,IAAI,CAAC,KAAK,IAAC,OAAO,EAAE,cAAM,OAAA,eAAe,CAAC,KAAK,CAAC,EAAtB,CAAsB,GAAI,CAAC;IAC/D,CAAC;IAED,SAAS,aAAa,CAAC,IAAY;QACjC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YACpB,OAAO,IAAI,CAAC;QAEhB,OAAO,WAAI,IAAI,CAAE,CAAC;IACpB,CAAC;AACH,CAAC,CAAA;AAjHY,QAAA,iBAAiB,qBAiH7B;AAED,SAAS,QAAQ,CAAC,IAAS;IACvB,OAAO,OAAO,IAAI,KAAK,UAAU,IAAI,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC;AACrE,CAAC;AAED,SAAS,UAAU,CAAC,IAAS;IACzB,OAAO,OAAO,IAAI,KAAK,UAAU,CAAC;AACtC,CAAC"}
@@ -1,23 +1,25 @@
1
1
  import React from 'react';
2
+ import { AppBarProps, ToolbarProps } from '@mui/material';
2
3
  import { NavigateFunction } from 'react-router-dom';
3
4
  import { Page } from '../router/Page';
4
5
  import { LinkOrDialog, NavMenuItem } from './NavMenu';
5
6
  export type PageContainerProps = {
6
- appName: string;
7
7
  page: Page;
8
- toolbarChildren?: React.ReactNode;
9
8
  auth?: {
10
9
  isLoggedIn: boolean;
11
10
  canViewPage: (page: Page) => boolean;
12
- /** Either a dialog component, or a path to be redirected to */
13
11
  login: LinkOrDialog;
14
12
  logout: () => Promise<string>;
15
13
  };
14
+ appName?: string;
15
+ toolbarChildren?: React.ReactNode;
16
16
  profileMenuItems?: {
17
- name: string;
18
- action: LinkOrDialog;
17
+ menuItemChildren: React.ReactNode;
18
+ action: LinkOrDialog | (() => void);
19
19
  }[];
20
20
  navMenuItems?: NavMenuItem[];
21
+ appBarProps?: AppBarProps;
22
+ toolbarProps?: ToolbarProps;
21
23
  };
22
24
  declare const Page: React.MemoExoticComponent<({ auth, page, navigate, loginClicked, setLoginClicked }: {
23
25
  auth: PageContainerProps['auth'];
@@ -1 +1 @@
1
- {"version":3,"file":"PageContainer.d.ts","sourceRoot":"","sources":["../../../src/container/PageContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,gBAAgB,EAAe,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAW,WAAW,EAAE,MAAM,WAAW,CAAC;AAG/D,MAAM,MAAM,kBAAkB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC;IACX,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,IAAI,CAAC,EAAE;QACH,UAAU,EAAE,OAAO,CAAC;QACpB,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;QACrC,+DAA+D;QAC/D,KAAK,EAAE,YAAY,CAAC;QACpB,MAAM,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;KAChC,CAAC;IACF,gBAAgB,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,YAAY,CAAA;KAAE,EAAE,CAAC;IAC5D,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;CAChC,CAAA;AAED,QAAA,MAAM,IAAI;UAAgF,kBAAkB,CAAC,MAAM,CAAC;UAAQ,kBAAkB,CAAC,MAAM,CAAC;cAAY,gBAAgB;kBAAgB,OAAO;oCAAkC,OAAO,KAAK,IAAI;+BAazP,CAAC;AAEH,wBAA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,qBA0DtD"}
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
@@ -11,6 +22,11 @@ var react_router_dom_1 = require("react-router-dom");
11
22
  var createUrlParams_1 = require("../router/createUrlParams");
12
23
  var NavMenu_1 = require("./NavMenu");
13
24
  var AccountIconButton_1 = require("./AccountIconButton");
25
+ function qualifiedPath(path) {
26
+ if (path.startsWith('/'))
27
+ return path;
28
+ return "/".concat(path);
29
+ }
14
30
  var Page = react_1.default.memo(function (_a) {
15
31
  var auth = _a.auth, page = _a.page, navigate = _a.navigate, loginClicked = _a.loginClicked, setLoginClicked = _a.setLoginClicked;
16
32
  if (auth === null || auth === void 0 ? void 0 : auth.canViewPage(page))
@@ -25,7 +41,7 @@ var Page = react_1.default.memo(function (_a) {
25
41
  });
26
42
  function PageContainer(props) {
27
43
  var navigate = (0, react_router_dom_1.useNavigate)();
28
- var appName = props.appName, page = props.page, toolbarChildren = props.toolbarChildren, auth = props.auth, profileMenuItems = props.profileMenuItems, navMenuItems = props.navMenuItems;
44
+ var page = props.page, auth = props.auth, navMenuItems = props.navMenuItems, appName = props.appName, toolbarChildren = props.toolbarChildren, profileMenuItems = props.profileMenuItems, appBarProps = props.appBarProps, toolbarProps = props.toolbarProps;
29
45
  var _a = react_1.default.useState(false), loginClicked = _a[0], setLoginClicked = _a[1];
30
46
  var _b = react_1.default.useState(false), navMenuOpen = _b[0], setNavMenuOpen = _b[1];
31
47
  react_1.default.useEffect(function () {
@@ -46,26 +62,21 @@ function PageContainer(props) {
46
62
  var resolvedStyles = Object.assign({}, defaultStyles, page.pageContainerSxProps(theme));
47
63
  return resolvedStyles;
48
64
  } },
49
- react_1.default.createElement(material_1.AppBar, { position: 'static' },
50
- react_1.default.createElement(material_1.Toolbar, null,
51
- navMenuItems &&
52
- react_1.default.createElement(material_1.IconButton, { "aria-label": 'menu', onClick: function (event) { return setNavMenuOpen(!navMenuOpen); }, sx: function (theme) { return ({
53
- marginRight: theme.spacing(2),
54
- '&:hover': {
55
- color: '#fff',
56
- },
57
- }); }, style: { backgroundColor: 'transparent' } },
58
- react_1.default.createElement(Menu_1.default, null)),
59
- react_1.default.createElement(material_1.Typography, { variant: 'h5', sx: { flexGrow: 1, color: 'common.white', } }, appName),
65
+ react_1.default.createElement(material_1.AppBar, __assign({ position: 'static' }, appBarProps),
66
+ react_1.default.createElement(material_1.Toolbar, __assign({}, toolbarProps),
67
+ navMenuItems && (react_1.default.createElement(material_1.IconButton, { "aria-label": 'menu', onClick: function () { return setNavMenuOpen(!navMenuOpen); }, sx: function (theme) { return ({
68
+ marginRight: theme.spacing(2),
69
+ '&:hover': {
70
+ color: '#fff',
71
+ },
72
+ }); }, style: { backgroundColor: 'transparent' } },
73
+ react_1.default.createElement(Menu_1.default, null))),
74
+ appName && react_1.default.createElement(material_1.Typography, { variant: 'h5', sx: { flexGrow: 1, color: 'common.white' } }, appName),
60
75
  toolbarChildren,
61
- react_1.default.createElement(AccountIconButton_1.AccountIconButton, { loginClicked: loginClicked, setLoginClicked: setLoginClicked, auth: auth, profileMenuItems: profileMenuItems }))),
62
- react_1.default.createElement(NavMenu_1.NavMenu, { navMenuItems: navMenuItems, navMenuOpen: navMenuOpen, setNavMenuOpen: setNavMenuOpen }),
76
+ react_1.default.createElement("div", { style: { flexGrow: 1 } }),
77
+ react_1.default.createElement(AccountIconButton_1.AccountIconButton, __assign({ loginClicked: loginClicked, setLoginClicked: setLoginClicked, auth: auth }, (profileMenuItems ? { profileMenuItems: profileMenuItems } : {}))))),
78
+ navMenuItems && react_1.default.createElement(NavMenu_1.NavMenu, { navMenuItems: navMenuItems, navMenuOpen: navMenuOpen, setNavMenuOpen: setNavMenuOpen }),
63
79
  react_1.default.createElement(Page, { auth: auth, page: page, navigate: navigate, loginClicked: loginClicked, setLoginClicked: setLoginClicked })));
64
- function qualifiedPath(path) {
65
- if (path.startsWith('/'))
66
- return path;
67
- return "/".concat(path);
68
- }
69
80
  }
70
81
  exports.PageContainer = PageContainer;
71
82
  //# sourceMappingURL=PageContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PageContainer.js","sourceRoot":"","sources":["../../../src/container/PageContainer.tsx"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AAC1B,0CAA6E;AAC7E,kEAAgD;AAChD,qDAAiE;AAEjE,6DAA4D;AAC5D,qCAA+D;AAC/D,yDAAwD;AAiBxD,IAAM,IAAI,GAAG,eAAK,CAAC,IAAI,CAAC,UAAC,EAAoO;QAAlO,IAAI,UAAA,EAAE,IAAI,UAAA,EAAE,QAAQ,cAAA,EAAE,YAAY,kBAAA,EAAE,eAAe,qBAAA;IAC1E,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAC,IAAI,CAAC;QACvB,OAAO,8BAAC,IAAI,CAAC,SAAS,IAAC,SAAS,EAAE,IAAA,iCAAe,GAAE,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;IAEhF,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,CAAA,EAAE;QACnB,IAAI,CAAC,YAAY;YACb,eAAe,CAAC,IAAI,CAAC,CAAC;QAE1B,OAAO,IAAI,CAAC;KACf;IAED,QAAQ,CAAC,GAAG,CAAC,CAAC;IACd,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC,CAAC;AAEH,SAAgB,aAAa,CAAC,KAAyB;IACnD,IAAM,QAAQ,GAAG,IAAA,8BAAW,GAAE,CAAC;IACvB,IAAA,OAAO,GAAkE,KAAK,QA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AC,CAAC,WAAW,CAAC,EAA5B,CAA4B,EAC3C,EAAE,EAAE,UAAC,KAAK,IAAK,OAAA,CAAC;wBACZ,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;wBAC7B,SAAS,EAAE;4BACP,KAAK,EAAE,MAAM;yBAChB;qBACJ,CAAC,EALa,CAKb,EACF,KAAK,EAAE,EAAE,eAAe,EAAE,aAAa,EAAE;oBAEzC,8BAAC,cAAQ,OAAG,CACH,CAChB;gBACA,OAAO,IAAI,8BAAC,qBAAU,IAAC,OAAO,EAAC,IAAI,EAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,IAC1E,OAAO,CACC;gBACZ,eAAe;gBAChB,uCAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAQ;gBACnC,8BAAC,qCAAiB,aAAC,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,IAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,kBAAA,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAI,CAC7I,CACL;QACR,YAAY,IAAI,8BAAC,iBAAO,IAAC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,GAAI;QAClH,8BAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,GAAI,CAChH,CACT,CAAC;AACN,CAAC;AA1DD,sCA0DC"}
@@ -18,7 +18,7 @@ import 'string';
18
18
 
19
19
  /** Generate Source Graph */
20
20
 
21
- const sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/ui/Page\",\"value\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":\"/Users/brentbahry/workspaces/n3xa/packages/proteinjs/packages/ui/packages/ui/src/router/Page.ts\",\"qualifiedName\":\"@proteinjs/ui/Page\",\"properties\":[{\"name\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"path\",\"type\":{\"packageName\":\"\",\"name\":\"string|string[]\",\"filePath\":null,\"qualifiedName\":\"/string|string[]\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"component\",\"type\":{\"packageName\":\"\",\"name\":\"React.ComponentType<PageComponentProps>\",\"filePath\":null,\"qualifiedName\":\"/React.ComponentType<PageComponentProps>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"noPageContainer\",\"type\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"auth\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"{\\n /** If true, the user does not need to be logged in or have any roles to access this page. If blank, defaults to false. */\\n public?: boolean;\\n /** If true, the user does not need to have any roles to access this page, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean,\\n /** The user must be logged in and have these roles to access this page. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[];\\n }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/{\\n /** If true, the user does not need to be logged in or have any roles to access this page. If blank, defaults to false. */\\n public?: boolean;\\n /** If true, the user does not need to have any roles to access this page, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean,\\n /** The user must be logged in and have these roles to access this page. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[];\\n }\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"pageContainerSxProps\",\"type\":{\"packageName\":\"\",\"name\":\"(theme: Theme) => SxProps\",\"filePath\":null,\"qualifiedName\":\"/(theme: Theme) => SxProps\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"/string | React.ComponentType\"},{\"v\":\"/React.FC\"},{\"v\":\"/Partial\"},{\"v\":\"/React.Component\"}],\"edges\":[{\"v\":\"@proteinjs/ui/Page\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"}]}";
21
+ const sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/ui/Page\",\"value\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":\"/home/runner/work/ui/ui/packages/ui/src/router/Page.ts\",\"qualifiedName\":\"@proteinjs/ui/Page\",\"properties\":[{\"name\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"path\",\"type\":{\"packageName\":\"\",\"name\":\"string|string[]\",\"filePath\":null,\"qualifiedName\":\"/string|string[]\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"component\",\"type\":{\"packageName\":\"\",\"name\":\"React.ComponentType<PageComponentProps>\",\"filePath\":null,\"qualifiedName\":\"/React.ComponentType<PageComponentProps>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"noPageContainer\",\"type\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"auth\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"{\\n /** If true, the user does not need to be logged in or have any roles to access this page. If blank, defaults to false. */\\n public?: boolean;\\n /** If true, the user does not need to have any roles to access this page, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean,\\n /** The user must be logged in and have these roles to access this page. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[];\\n }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/{\\n /** If true, the user does not need to be logged in or have any roles to access this page. If blank, defaults to false. */\\n public?: boolean;\\n /** If true, the user does not need to have any roles to access this page, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean,\\n /** The user must be logged in and have these roles to access this page. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[];\\n }\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"pageContainerSxProps\",\"type\":{\"packageName\":\"\",\"name\":\"(theme: Theme) => SxProps\",\"filePath\":null,\"qualifiedName\":\"/(theme: Theme) => SxProps\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"/string | React.ComponentType\"},{\"v\":\"/React.FC\"},{\"v\":\"/Partial\"},{\"v\":\"/React.Component\"}],\"edges\":[{\"v\":\"@proteinjs/ui/Page\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"}]}";
22
22
 
23
23
 
24
24
  /** Generate Source Links */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proteinjs/ui",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "UI libs",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -47,5 +47,6 @@
47
47
  "typescript": "5.2.2"
48
48
  },
49
49
  "main": "./dist/generated/index.js",
50
- "types": "./dist/generated/index.d.ts"
51
- }
50
+ "types": "./dist/generated/index.d.ts",
51
+ "gitHead": "99e507190a3f74d6015a30c81fb439a013d2201c"
52
+ }
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
- import { Button, IconButton, Menu, MenuItem } from '@mui/material';
2
+ import { Button, IconButton, ListItemIcon, Menu, MenuItem, Typography } from '@mui/material';
3
3
  import AccountCircle from '@mui/icons-material/AccountCircle';
4
4
  import { useNavigate } from 'react-router-dom';
5
5
  import { LinkOrDialog } from './NavMenu';
6
6
  import { Page } from '../router/Page';
7
+ import LogoutIcon from '@mui/icons-material/Logout';
7
8
 
8
9
  export type AccountIconButtonProps = {
9
10
  loginClicked: boolean,
@@ -15,7 +16,7 @@ export type AccountIconButtonProps = {
15
16
  login: LinkOrDialog,
16
17
  logout: () => Promise<string>
17
18
  },
18
- profileMenuItems?: { name: string, action: LinkOrDialog }[],
19
+ profileMenuItems?: { menuItemChildren: React.ReactNode, action: LinkOrDialog | (() => void) }[],
19
20
  }
20
21
 
21
22
  export const AccountIconButton = ({ loginClicked, setLoginClicked, auth, profileMenuItems }: AccountIconButtonProps) => {
@@ -57,11 +58,19 @@ export const AccountIconButton = ({ loginClicked, setLoginClicked, auth, profile
57
58
  navigate(qualifiedPath(profileMenuItem.action));
58
59
  return;
59
60
  }
60
- setSelectedIndex(index);
61
+
62
+ else if (isFunction(profileMenuItem.action)) {
63
+ setAccountMenuAnchorEl(null);
64
+ profileMenuItem.action();
65
+ }
66
+
67
+ else {
68
+ setSelectedIndex(index);
69
+ }
61
70
  }}
62
71
  selected={selectedIndex === index}
63
72
  >
64
- {profileMenuItem.name}
73
+ {profileMenuItem.menuItemChildren}
65
74
  </MenuItem>
66
75
  ))
67
76
  }
@@ -71,7 +80,11 @@ export const AccountIconButton = ({ loginClicked, setLoginClicked, auth, profile
71
80
  navigate(qualifiedPath(redirectPath));
72
81
  }}
73
82
  >
74
- Logout
83
+
84
+ <ListItemIcon>
85
+ <LogoutIcon />
86
+ </ListItemIcon>
87
+ <Typography>Logout</Typography>
75
88
  </MenuItem>
76
89
  </Menu>
77
90
  <ProfileMenuItemAction />
@@ -99,7 +112,11 @@ export const AccountIconButton = ({ loginClicked, setLoginClicked, auth, profile
99
112
  if (typeof menuItem.action === 'string')
100
113
  return null;
101
114
 
102
- return <menuItem.action onClose={() => setSelectedProfileMenuItem(-1)} />;
115
+ if (isDialog(menuItem.action)) {
116
+ return <menuItem.action onClose={() => setSelectedProfileMenuItem(-1)} />;
117
+ }
118
+
119
+ return null;
103
120
  }
104
121
 
105
122
  function Login() {
@@ -115,4 +132,12 @@ export const AccountIconButton = ({ loginClicked, setLoginClicked, auth, profile
115
132
 
116
133
  return `/${path}`;
117
134
  }
135
+ }
136
+
137
+ function isDialog(prop: any): prop is React.ComponentType<{ onClose: () => void }> {
138
+ return typeof prop === 'function' && 'onClose' in prop.prototype;
139
+ }
140
+
141
+ function isFunction(prop: any): prop is () => void {
142
+ return typeof prop === 'function';
118
143
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { AppBar, Toolbar, Box, IconButton, Typography } from '@mui/material';
2
+ import { AppBar, Toolbar, Box, IconButton, Typography, Theme, SxProps, AppBarProps, ToolbarProps } from '@mui/material';
3
3
  import MenuIcon from '@mui/icons-material/Menu';
4
4
  import { NavigateFunction, useNavigate } from 'react-router-dom';
5
5
  import { Page } from '../router/Page';
@@ -7,19 +7,27 @@ import { createUrlParams } from '../router/createUrlParams';
7
7
  import { LinkOrDialog, NavMenu, NavMenuItem } from './NavMenu';
8
8
  import { AccountIconButton } from './AccountIconButton';
9
9
 
10
+ function qualifiedPath(path: string) {
11
+ if (path.startsWith('/'))
12
+ return path;
13
+
14
+ return `/${path}`;
15
+ }
16
+
10
17
  export type PageContainerProps = {
11
- appName: string,
12
18
  page: Page,
13
- toolbarChildren?: React.ReactNode,
14
19
  auth?: {
15
20
  isLoggedIn: boolean,
16
21
  canViewPage: (page: Page) => boolean,
17
- /** Either a dialog component, or a path to be redirected to */
18
22
  login: LinkOrDialog,
19
23
  logout: () => Promise<string>
20
24
  },
21
- profileMenuItems?: { name: string, action: LinkOrDialog }[],
25
+ appName?: string,
26
+ toolbarChildren?: React.ReactNode,
27
+ profileMenuItems?: { menuItemChildren: React.ReactNode, action: LinkOrDialog | (() => void) }[],
22
28
  navMenuItems?: NavMenuItem[],
29
+ appBarProps?: AppBarProps,
30
+ toolbarProps?: ToolbarProps,
23
31
  }
24
32
 
25
33
  const Page = React.memo(({ auth, page, navigate, loginClicked, setLoginClicked }: { auth: PageContainerProps['auth'], page: PageContainerProps['page'], navigate: NavigateFunction, loginClicked: boolean, setLoginClicked: (loginClicked: boolean) => void }) => {
@@ -39,7 +47,7 @@ const Page = React.memo(({ auth, page, navigate, loginClicked, setLoginClicked }
39
47
 
40
48
  export function PageContainer(props: PageContainerProps) {
41
49
  const navigate = useNavigate();
42
- const { appName, page, toolbarChildren, auth, profileMenuItems, navMenuItems } = props;
50
+ const { page, auth, navMenuItems, appName, toolbarChildren, profileMenuItems, appBarProps, toolbarProps } = props;
43
51
  const [loginClicked, setLoginClicked] = React.useState(false);
44
52
  const [navMenuOpen, setNavMenuOpen] = React.useState(false);
45
53
 
@@ -66,39 +74,33 @@ export function PageContainer(props: PageContainerProps) {
66
74
 
67
75
  return resolvedStyles;
68
76
  }}>
69
- <AppBar position='static'>
70
- <Toolbar>
71
- { navMenuItems &&
77
+ <AppBar position='static' {...appBarProps}>
78
+ <Toolbar {...toolbarProps}>
79
+ {navMenuItems && (
72
80
  <IconButton
73
81
  aria-label='menu'
74
- onClick={event => setNavMenuOpen(!navMenuOpen)}
82
+ onClick={() => setNavMenuOpen(!navMenuOpen)}
75
83
  sx={(theme) => ({
76
84
  marginRight: theme.spacing(2),
77
85
  '&:hover': {
78
86
  color: '#fff',
79
87
  },
80
- })}
88
+ })}
81
89
  style={{ backgroundColor: 'transparent' }}
82
90
  >
83
91
  <MenuIcon />
84
92
  </IconButton>
85
- }
86
- <Typography variant='h5' sx={{ flexGrow: 1, color: 'common.white', }}>
93
+ )}
94
+ {appName && <Typography variant='h5' sx={{ flexGrow: 1, color: 'common.white' }}>
87
95
  {appName}
88
- </Typography>
96
+ </Typography>}
89
97
  {toolbarChildren}
90
- <AccountIconButton loginClicked={loginClicked} setLoginClicked={setLoginClicked} auth={auth} profileMenuItems={profileMenuItems} />
98
+ <div style={{ flexGrow: 1 }}></div>
99
+ <AccountIconButton loginClicked={loginClicked} setLoginClicked={setLoginClicked} auth={auth} {...(profileMenuItems ? { profileMenuItems } : {})} />
91
100
  </Toolbar>
92
101
  </AppBar>
93
- <NavMenu navMenuItems={navMenuItems} navMenuOpen={navMenuOpen} setNavMenuOpen={setNavMenuOpen} />
102
+ {navMenuItems && <NavMenu navMenuItems={navMenuItems} navMenuOpen={navMenuOpen} setNavMenuOpen={setNavMenuOpen} />}
94
103
  <Page auth={auth} page={page} navigate={navigate} loginClicked={loginClicked} setLoginClicked={setLoginClicked} />
95
104
  </Box>
96
105
  );
97
-
98
- function qualifiedPath(path: string) {
99
- if (path.startsWith('/'))
100
- return path;
101
-
102
- return `/${path}`;
103
- }
104
106
  }