@webiny/app-admin-rmwc 5.21.0-beta.0

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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -0
  3. package/index.d.ts +2 -0
  4. package/index.js +12 -0
  5. package/modules/Brand/index.d.ts +2 -0
  6. package/modules/Brand/index.js +46 -0
  7. package/modules/Brand/webiny-logo.svg +20 -0
  8. package/modules/Dashboard/Welcome.d.ts +3 -0
  9. package/modules/Dashboard/Welcome.js +256 -0
  10. package/modules/Dashboard/icons/github.svg +1 -0
  11. package/modules/Dashboard/icons/laptop.svg +1 -0
  12. package/modules/Dashboard/icons/slack.svg +1 -0
  13. package/modules/Dashboard/icons/textbook.svg +1 -0
  14. package/modules/Dashboard/icons/twitter.svg +1 -0
  15. package/modules/Dashboard/icons/youtube.svg +1 -0
  16. package/modules/Dashboard/index.d.ts +2 -0
  17. package/modules/Dashboard/index.js +18 -0
  18. package/modules/Layout.d.ts +2 -0
  19. package/modules/Layout.js +41 -0
  20. package/modules/Navigation/Hamburger.d.ts +3 -0
  21. package/modules/Navigation/Hamburger.js +28 -0
  22. package/modules/Navigation/Styled.d.ts +7 -0
  23. package/modules/Navigation/Styled.js +47 -0
  24. package/modules/Navigation/icons/hamburger.svg +4 -0
  25. package/modules/Navigation/icons/round-keyboard_arrow_down-24px.svg +16 -0
  26. package/modules/Navigation/icons/round-keyboard_arrow_up-24px.svg +16 -0
  27. package/modules/Navigation/icons/webiny-orange-logo.svg +20 -0
  28. package/modules/Navigation/index.d.ts +10 -0
  29. package/modules/Navigation/index.js +131 -0
  30. package/modules/Navigation/renderers/MenuElementRenderer.d.ts +2 -0
  31. package/modules/Navigation/renderers/MenuElementRenderer.js +10 -0
  32. package/modules/Navigation/renderers/MenuGroupRenderer.d.ts +2 -0
  33. package/modules/Navigation/renderers/MenuGroupRenderer.js +139 -0
  34. package/modules/Navigation/renderers/MenuLinkRenderer.d.ts +2 -0
  35. package/modules/Navigation/renderers/MenuLinkRenderer.js +51 -0
  36. package/modules/Navigation/renderers/MenuSectionItemRenderer.d.ts +2 -0
  37. package/modules/Navigation/renderers/MenuSectionItemRenderer.js +64 -0
  38. package/modules/Navigation/renderers/MenuSectionRenderer.d.ts +2 -0
  39. package/modules/Navigation/renderers/MenuSectionRenderer.js +41 -0
  40. package/modules/NotFound/SecureRouteError.svg +1 -0
  41. package/modules/NotFound/index.d.ts +2 -0
  42. package/modules/NotFound/index.js +58 -0
  43. package/modules/Overlays/Dialog.d.ts +2 -0
  44. package/modules/Overlays/Dialog.js +40 -0
  45. package/modules/Overlays/Snackbar.d.ts +3 -0
  46. package/modules/Overlays/Snackbar.js +28 -0
  47. package/modules/Overlays/index.d.ts +2 -0
  48. package/modules/Overlays/index.js +27 -0
  49. package/modules/Search/index.d.ts +2 -0
  50. package/modules/Search/index.js +18 -0
  51. package/modules/UserMenu/account.svg +1 -0
  52. package/modules/UserMenu/index.d.ts +2 -0
  53. package/modules/UserMenu/index.js +116 -0
  54. package/package.json +59 -0
@@ -0,0 +1,40 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import _get from "lodash/get";
3
+ import React, { useCallback } from "react";
4
+ import { useUi } from "@webiny/app/hooks/useUi";
5
+ import { Dialog, DialogAccept, DialogTitle, DialogActions, DialogContent } from "@webiny/ui/Dialog";
6
+ export var DialogContainer = function DialogContainer() {
7
+ var ui = useUi();
8
+
9
+ var message = _get(ui, "dialog.message");
10
+
11
+ var _get2 = _get(ui, "dialog.options", {}),
12
+ dataTestId = _get2.dataTestId,
13
+ title = _get2.title,
14
+ _get2$actions = _get2.actions,
15
+ actions = _get2$actions === void 0 ? {
16
+ cancel: null,
17
+ accept: {
18
+ label: "OK"
19
+ }
20
+ } : _get2$actions,
21
+ style = _get2.style;
22
+
23
+ var hideDialog = useCallback(function () {
24
+ ui.setState(function (ui) {
25
+ return _objectSpread(_objectSpread({}, ui), {}, {
26
+ dialog: null
27
+ });
28
+ });
29
+ }, [ui]);
30
+ return /*#__PURE__*/React.createElement(Dialog, {
31
+ open: !!message,
32
+ onClose: hideDialog,
33
+ "data-testid": dataTestId,
34
+ style: style
35
+ }, title && /*#__PURE__*/React.createElement(DialogTitle, null, title), /*#__PURE__*/React.createElement(DialogContent, null, message), /*#__PURE__*/React.createElement(DialogActions, null, actions.cancel && /*#__PURE__*/React.createElement(DialogAccept, {
36
+ onClick: actions.cancel.onClick
37
+ }, actions.cancel.label), actions.accept && /*#__PURE__*/React.createElement(DialogAccept, {
38
+ onClick: actions.accept.onClick
39
+ }, actions.accept.label)));
40
+ };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const SnackbarMain: () => JSX.Element;
3
+ export default SnackbarMain;
@@ -0,0 +1,28 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import _get from "lodash/get";
3
+ import React, { useCallback } from "react";
4
+ import { Snackbar } from "@webiny/ui/Snackbar";
5
+ import { useUi } from "@webiny/app/hooks/useUi";
6
+
7
+ var SnackbarMain = function SnackbarMain() {
8
+ var ui = useUi();
9
+
10
+ var message = _get(ui, "snackbar.message");
11
+
12
+ var options = _get(ui, "snackbar.options", {});
13
+
14
+ var hideSnackbar = useCallback(function () {
15
+ ui.setState(function (ui) {
16
+ return _objectSpread(_objectSpread({}, ui), {}, {
17
+ snackbar: null
18
+ });
19
+ });
20
+ }, [ui]);
21
+ return /*#__PURE__*/React.createElement(Snackbar, Object.assign({
22
+ open: !!message,
23
+ onClose: hideSnackbar,
24
+ message: message
25
+ }, options));
26
+ };
27
+
28
+ export default SnackbarMain;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const Overlays: () => JSX.Element;
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import { Provider } from "@webiny/app-admin/";
3
+ import Snackbar from "./Snackbar";
4
+ import { DialogContainer } from "./Dialog";
5
+ /**
6
+ * Dialogs and Snackbars require a container to be rendered, and we want to place it outside of
7
+ * any other views that are constructed by developers. We need these 2 containers to always be
8
+ * present, even if there is no <Layout> mounted.
9
+ */
10
+
11
+ var OverlaysHOC = function OverlaysHOC(Component) {
12
+ return function Overlays(_ref) {
13
+ var children = _ref.children;
14
+ return /*#__PURE__*/React.createElement(Component, null, children, /*#__PURE__*/React.createElement("div", {
15
+ style: {
16
+ zIndex: 30,
17
+ position: "absolute"
18
+ }
19
+ }, /*#__PURE__*/React.createElement(Snackbar, null)), /*#__PURE__*/React.createElement(DialogContainer, null));
20
+ };
21
+ };
22
+
23
+ export var Overlays = function Overlays() {
24
+ return /*#__PURE__*/React.createElement(Provider, {
25
+ hoc: OverlaysHOC
26
+ });
27
+ };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const Search: () => JSX.Element;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { Compose, SearchRenderer as SearchSpec } from "@webiny/app-admin"; // For the time being, import the existing component.
3
+ // TODO: implement a new SearchBar component
4
+
5
+ import SearchBar from "@webiny/app-admin/plugins/globalSearch/SearchBar";
6
+
7
+ var SearchRenderer = function SearchRenderer() {
8
+ return function Search() {
9
+ return /*#__PURE__*/React.createElement(SearchBar, null);
10
+ };
11
+ };
12
+
13
+ export var Search = function Search() {
14
+ return /*#__PURE__*/React.createElement(Compose, {
15
+ component: SearchSpec,
16
+ with: SearchRenderer
17
+ });
18
+ };
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"/></svg>
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const UserMenu: () => JSX.Element;
@@ -0,0 +1,116 @@
1
+ import React, { Fragment } from "react";
2
+ import { css } from "emotion";
3
+ import { Compose, UserMenuHandle, UserMenuHandleRenderer as UserMenuHandleRendererSpec, UserMenuRenderer as UserMenuRendererSpec, UserMenuItems, UserMenuItemRenderer as UserMenuItemRendererSpec, useUserMenuItem, useUserMenu } from "@webiny/app-admin";
4
+ import { Menu } from "@webiny/ui/Menu";
5
+ import { List, ListItem, ListItemGraphic } from "@webiny/ui/List";
6
+ import { Icon } from "@webiny/ui/Icon";
7
+ import { Link } from "react-router-dom";
8
+ import { useSecurity } from "@webiny/app-security";
9
+ import { Avatar } from "@webiny/ui/Avatar";
10
+ import { Image } from "@webiny/app/components";
11
+ import { TopAppBarActionItem } from "@webiny/ui/TopAppBar";
12
+
13
+ var UserMenuRendererImpl = function UserMenuRendererImpl() {
14
+ return function UserMenu() {
15
+ var security = useSecurity();
16
+
17
+ var _useUserMenu = useUserMenu(),
18
+ menuItems = _useUserMenu.menuItems;
19
+
20
+ if (!security || !security.identity) {
21
+ return null;
22
+ }
23
+
24
+ return /*#__PURE__*/React.createElement(Menu, {
25
+ anchor: "topEnd",
26
+ handle: /*#__PURE__*/React.createElement(TopAppBarActionItem, {
27
+ icon: /*#__PURE__*/React.createElement(UserMenuHandle, null)
28
+ })
29
+ }, /*#__PURE__*/React.createElement(List, {
30
+ "data-testid": "logged-in-user-menu-list"
31
+ }, /*#__PURE__*/React.createElement(UserMenuItems, {
32
+ menuItems: menuItems
33
+ })));
34
+ };
35
+ };
36
+
37
+ var UserMenuHandleRendererImpl = function UserMenuHandleRendererImpl() {
38
+ return function UserMenuHandle() {
39
+ var _useSecurity = useSecurity(),
40
+ identity = _useSecurity.identity;
41
+
42
+ if (!identity) {
43
+ return null;
44
+ }
45
+
46
+ var _ref = identity.profile || {},
47
+ firstName = _ref.firstName,
48
+ lastName = _ref.lastName,
49
+ avatar = _ref.avatar,
50
+ gravatar = _ref.gravatar;
51
+
52
+ var fullName = "".concat(firstName, " ").concat(lastName);
53
+ return /*#__PURE__*/React.createElement(Avatar, {
54
+ "data-testid": "logged-in-user-menu-avatar",
55
+ src: avatar ? avatar.src : gravatar,
56
+ alt: fullName,
57
+ fallbackText: fullName,
58
+ renderImage: function renderImage(props) {
59
+ return /*#__PURE__*/React.createElement(Image, Object.assign({}, props, {
60
+ transform: {
61
+ width: 100
62
+ }
63
+ }));
64
+ }
65
+ });
66
+ };
67
+ };
68
+
69
+ var linkStyles = /*#__PURE__*/css({
70
+ "&:hover": {
71
+ textDecoration: "none"
72
+ }
73
+ }, "label:linkStyles;");
74
+
75
+ var UserMenuItemRendererImpl = function UserMenuItemRendererImpl() {
76
+ return function UserMenuItemRenderer() {
77
+ var _useUserMenuItem = useUserMenuItem(),
78
+ label = _useUserMenuItem.label,
79
+ path = _useUserMenuItem.path,
80
+ icon = _useUserMenuItem.icon,
81
+ onClick = _useUserMenuItem.onClick,
82
+ element = _useUserMenuItem.element;
83
+
84
+ if (element) {
85
+ return element;
86
+ }
87
+
88
+ if (path) {
89
+ return /*#__PURE__*/React.createElement(Link, {
90
+ to: path,
91
+ className: linkStyles
92
+ }, /*#__PURE__*/React.createElement(ListItem, null, /*#__PURE__*/React.createElement(ListItemGraphic, null, icon ? /*#__PURE__*/React.createElement(Icon, {
93
+ icon: icon
94
+ }) : null), label));
95
+ }
96
+
97
+ return /*#__PURE__*/React.createElement(ListItem, {
98
+ onClick: onClick
99
+ }, /*#__PURE__*/React.createElement(ListItemGraphic, null, icon ? /*#__PURE__*/React.createElement(Icon, {
100
+ icon: icon
101
+ }) : null), label);
102
+ };
103
+ };
104
+
105
+ export var UserMenu = function UserMenu() {
106
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Compose, {
107
+ component: UserMenuHandleRendererSpec,
108
+ with: UserMenuHandleRendererImpl
109
+ }), /*#__PURE__*/React.createElement(Compose, {
110
+ component: UserMenuRendererSpec,
111
+ with: UserMenuRendererImpl
112
+ }), /*#__PURE__*/React.createElement(Compose, {
113
+ component: UserMenuItemRendererSpec,
114
+ with: UserMenuItemRendererImpl
115
+ }));
116
+ };
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@webiny/app-admin-rmwc",
3
+ "version": "5.21.0-beta.0",
4
+ "main": "index.js",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/webiny/webiny-js.git"
8
+ },
9
+ "author": "Webiny Ltd.",
10
+ "license": "MIT",
11
+ "dependencies": {
12
+ "@babel/runtime": "7.16.3",
13
+ "@emotion/styled": "10.0.27",
14
+ "@types/react": "16.14.2",
15
+ "@webiny/app": "5.21.0-beta.0",
16
+ "@webiny/app-admin": "5.21.0-beta.0",
17
+ "@webiny/app-security": "5.21.0-beta.0",
18
+ "@webiny/plugins": "5.21.0-beta.0",
19
+ "@webiny/react-router": "5.21.0-beta.0",
20
+ "@webiny/ui": "5.21.0-beta.0",
21
+ "classnames": "2.3.1",
22
+ "emotion": "10.0.27",
23
+ "lodash": "4.17.21",
24
+ "react": "16.14.0",
25
+ "react-dom": "16.14.0",
26
+ "react-helmet": "6.1.0",
27
+ "react-router-dom": "5.3.0",
28
+ "react-transition-group": "4.4.2",
29
+ "store": "2.0.12"
30
+ },
31
+ "devDependencies": {
32
+ "@babel/cli": "^7.5.5",
33
+ "@babel/core": "^7.5.5",
34
+ "@babel/preset-env": "^7.5.5",
35
+ "@babel/preset-react": "^7.0.0",
36
+ "@babel/preset-typescript": "^7.8.3",
37
+ "@webiny/cli": "^5.21.0-beta.0",
38
+ "@webiny/project-utils": "^5.21.0-beta.0",
39
+ "babel-plugin-emotion": "^9.2.8",
40
+ "babel-plugin-named-asset-import": "^1.0.0-next.3e165448",
41
+ "rimraf": "^3.0.2",
42
+ "ttypescript": "^1.5.12",
43
+ "typescript": "^4.1.3"
44
+ },
45
+ "publishConfig": {
46
+ "access": "public",
47
+ "directory": "dist"
48
+ },
49
+ "scripts": {
50
+ "build": "yarn webiny run build",
51
+ "watch": "yarn webiny run watch"
52
+ },
53
+ "svgo": {
54
+ "plugins": {
55
+ "removeViewBox": false
56
+ }
57
+ },
58
+ "gitHead": "cad155812edbdd577a1cc858b41038fdd7a6d2d9"
59
+ }