@webiny/app-admin 5.39.0 → 5.39.1-beta.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.
Files changed (47) hide show
  1. package/base/ui/Brand.d.ts +3 -9
  2. package/base/ui/Brand.js +2 -2
  3. package/base/ui/Brand.js.map +1 -1
  4. package/base/ui/CenteredView.d.ts +2 -4
  5. package/base/ui/CenteredView.js +1 -1
  6. package/base/ui/CenteredView.js.map +1 -1
  7. package/base/ui/Dashboard.d.ts +3 -9
  8. package/base/ui/Dashboard.js +2 -2
  9. package/base/ui/Dashboard.js.map +1 -1
  10. package/base/ui/FileManager.d.ts +1 -4
  11. package/base/ui/FileManager.js +1 -1
  12. package/base/ui/FileManager.js.map +1 -1
  13. package/base/ui/Layout.d.ts +2 -8
  14. package/base/ui/Layout.js +2 -2
  15. package/base/ui/Layout.js.map +1 -1
  16. package/base/ui/LocaleSelector.d.ts +3 -9
  17. package/base/ui/LocaleSelector.js +2 -2
  18. package/base/ui/LocaleSelector.js.map +1 -1
  19. package/base/ui/LoginScreen.d.ts +1 -4
  20. package/base/ui/LoginScreen.js +1 -1
  21. package/base/ui/LoginScreen.js.map +1 -1
  22. package/base/ui/Logo.d.ts +3 -9
  23. package/base/ui/Logo.js +2 -2
  24. package/base/ui/Logo.js.map +1 -1
  25. package/base/ui/Navigation.d.ts +3 -12
  26. package/base/ui/Navigation.js +3 -3
  27. package/base/ui/Navigation.js.map +1 -1
  28. package/base/ui/NotFound.d.ts +3 -9
  29. package/base/ui/NotFound.js +2 -2
  30. package/base/ui/NotFound.js.map +1 -1
  31. package/base/ui/Search.d.ts +2 -8
  32. package/base/ui/Search.js +2 -2
  33. package/base/ui/Search.js.map +1 -1
  34. package/base/ui/UserMenu.d.ts +7 -28
  35. package/base/ui/UserMenu.js +7 -7
  36. package/base/ui/UserMenu.js.map +1 -1
  37. package/components/OptionsMenu/OptionsMenu.styled.d.ts +1 -1
  38. package/hooks/createGenericContext.d.ts +13 -0
  39. package/hooks/createGenericContext.js +34 -0
  40. package/hooks/createGenericContext.js.map +1 -0
  41. package/hooks/index.d.ts +1 -0
  42. package/hooks/index.js +11 -0
  43. package/hooks/index.js.map +1 -1
  44. package/package.json +18 -18
  45. package/plugins/globalSearch/SearchBar.d.ts +2 -5
  46. package/plugins/globalSearch/SearchBar.js +1 -1
  47. package/plugins/globalSearch/SearchBar.js.map +1 -1
@@ -1,9 +1,3 @@
1
- import React from "react";
2
- export declare const Brand: React.FunctionComponent<unknown> & {
3
- original: React.ComponentType<unknown>;
4
- originalName: string;
5
- };
6
- export declare const BrandRenderer: React.FunctionComponent<unknown> & {
7
- original: React.ComponentType<unknown>;
8
- originalName: string;
9
- };
1
+ /// <reference types="react" />
2
+ export declare const Brand: import("@webiny/app").DecoratableComponent<() => JSX.Element | null>;
3
+ export declare const BrandRenderer: import("@webiny/app").DecoratableComponent<(props: unknown) => JSX.Element | null>;
package/base/ui/Brand.js CHANGED
@@ -7,11 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.BrandRenderer = exports.Brand = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _app = require("@webiny/app");
10
- var Brand = (0, _app.makeComposable)("Brand", function () {
10
+ var Brand = (0, _app.makeDecoratable)("Brand", function () {
11
11
  return /*#__PURE__*/_react.default.createElement(BrandRenderer, null);
12
12
  });
13
13
  exports.Brand = Brand;
14
- var BrandRenderer = (0, _app.makeComposable)("BrandRenderer");
14
+ var BrandRenderer = (0, _app.makeDecoratable)("BrandRenderer", (0, _app.createVoidComponent)());
15
15
  exports.BrandRenderer = BrandRenderer;
16
16
 
17
17
  //# sourceMappingURL=Brand.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_app","Brand","makeComposable","default","createElement","BrandRenderer","exports"],"sources":["Brand.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeComposable } from \"@webiny/app\";\n\nexport const Brand = makeComposable(\"Brand\", () => {\n return <BrandRenderer />;\n});\n\nexport const BrandRenderer = makeComposable(\"BrandRenderer\");\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEO,IAAME,KAAK,GAAG,IAAAC,mBAAc,EAAC,OAAO,EAAE,YAAM;EAC/C,oBAAOL,MAAA,CAAAM,OAAA,CAAAC,aAAA,CAACC,aAAa,MAAE,CAAC;AAC5B,CAAC,CAAC;AAACC,OAAA,CAAAL,KAAA,GAAAA,KAAA;AAEI,IAAMI,aAAa,GAAG,IAAAH,mBAAc,EAAC,eAAe,CAAC;AAACI,OAAA,CAAAD,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_app","Brand","makeDecoratable","default","createElement","BrandRenderer","exports","createVoidComponent"],"sources":["Brand.tsx"],"sourcesContent":["import React from \"react\";\nimport { createVoidComponent, makeDecoratable } from \"@webiny/app\";\n\nexport const Brand = makeDecoratable(\"Brand\", () => {\n return <BrandRenderer />;\n});\n\nexport const BrandRenderer = makeDecoratable(\"BrandRenderer\", createVoidComponent());\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEO,IAAME,KAAK,GAAG,IAAAC,oBAAe,EAAC,OAAO,EAAE,YAAM;EAChD,oBAAOL,MAAA,CAAAM,OAAA,CAAAC,aAAA,CAACC,aAAa,MAAE,CAAC;AAC5B,CAAC,CAAC;AAACC,OAAA,CAAAL,KAAA,GAAAA,KAAA;AAEI,IAAMI,aAAa,GAAG,IAAAH,oBAAe,EAAC,eAAe,EAAE,IAAAK,wBAAmB,EAAC,CAAC,CAAC;AAACD,OAAA,CAAAD,aAAA,GAAAA,aAAA"}
@@ -1,8 +1,6 @@
1
1
  import React from "react";
2
2
  export interface CenteredViewProps {
3
+ children: React.ReactNode;
3
4
  maxWidth?: number | string;
4
5
  }
5
- export declare const CenteredView: React.FunctionComponent<CenteredViewProps> & {
6
- original: React.ComponentType<CenteredViewProps>;
7
- originalName: string;
8
- };
6
+ export declare const CenteredView: import("../../index").DecoratableComponent<(args_0: CenteredViewProps) => JSX.Element | null>;
@@ -24,7 +24,7 @@ var Width = /*#__PURE__*/(0, _styled.default)("div", {
24
24
  width: "100%"
25
25
  };
26
26
  });
27
- var CenteredView = (0, _.makeComposable)("CenteredView", function (_ref) {
27
+ var CenteredView = (0, _.makeDecoratable)("CenteredView", function (_ref) {
28
28
  var _ref$maxWidth = _ref.maxWidth,
29
29
  maxWidth = _ref$maxWidth === void 0 ? 700 : _ref$maxWidth,
30
30
  children = _ref.children;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_styled","_","Container","styled","target","label","display","justifyContent","Width","props","maxWidth","width","CenteredView","makeComposable","_ref","_ref$maxWidth","children","default","createElement","exports"],"sources":["CenteredView.tsx"],"sourcesContent":["import React from \"react\";\nimport styled from \"@emotion/styled\";\nimport { makeComposable } from \"~/index\";\n\nexport interface CenteredViewProps {\n maxWidth?: number | string;\n}\n\nconst Container = styled.div({\n display: \"flex\",\n justifyContent: \"center\"\n});\n\ninterface Props {\n maxWidth: string | number;\n}\n\nconst Width = styled.div((props: Props) => ({\n maxWidth: props.maxWidth,\n width: \"100%\"\n}));\n\nexport const CenteredView = makeComposable<CenteredViewProps>(\n \"CenteredView\",\n ({ maxWidth = 700, children }) => {\n return (\n <Container>\n <Width maxWidth={maxWidth}>{children}</Width>\n </Container>\n );\n }\n);\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,CAAA,GAAAF,OAAA;AAMA,IAAMG,SAAS,oBAAGC,eAAM;EAAAC,MAAA;EAAAC,KAAA;AAAA,GAAK;EACzBC,OAAO,EAAE,MAAM;EACfC,cAAc,EAAE;AACpB,CAAC,CAAC;AAMF,IAAMC,KAAK,oBAAGL,eAAM;EAAAC,MAAA;EAAAC,KAAA;AAAA,GAAK,UAACI,KAAY;EAAA,OAAM;IACxCC,QAAQ,EAAED,KAAK,CAACC,QAAQ;IACxBC,KAAK,EAAE;EACX,CAAC;AAAA,CAAC,CAAC;AAEI,IAAMC,YAAY,GAAG,IAAAC,gBAAc,EACtC,cAAc,EACd,UAAAC,IAAA,EAAkC;EAAA,IAAAC,aAAA,GAAAD,IAAA,CAA/BJ,QAAQ;IAARA,QAAQ,GAAAK,aAAA,cAAG,GAAG,GAAAA,aAAA;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;EACvB,oBACInB,MAAA,CAAAoB,OAAA,CAAAC,aAAA,CAAChB,SAAS,qBACNL,MAAA,CAAAoB,OAAA,CAAAC,aAAA,CAACV,KAAK;IAACE,QAAQ,EAAEA;EAAS,GAAEM,QAAgB,CACrC,CAAC;AAEpB,CACJ,CAAC;AAACG,OAAA,CAAAP,YAAA,GAAAA,YAAA"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_styled","_","Container","styled","target","label","display","justifyContent","Width","props","maxWidth","width","CenteredView","makeDecoratable","_ref","_ref$maxWidth","children","default","createElement","exports"],"sources":["CenteredView.tsx"],"sourcesContent":["import React from \"react\";\nimport styled from \"@emotion/styled\";\nimport { makeDecoratable } from \"~/index\";\n\nexport interface CenteredViewProps {\n children: React.ReactNode;\n maxWidth?: number | string;\n}\n\nconst Container = styled.div({\n display: \"flex\",\n justifyContent: \"center\"\n});\n\ninterface Props {\n maxWidth: string | number;\n}\n\nconst Width = styled.div((props: Props) => ({\n maxWidth: props.maxWidth,\n width: \"100%\"\n}));\n\nexport const CenteredView = makeDecoratable(\n \"CenteredView\",\n ({ maxWidth = 700, children }: CenteredViewProps) => {\n return (\n <Container>\n <Width maxWidth={maxWidth}>{children}</Width>\n </Container>\n );\n }\n);\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,CAAA,GAAAF,OAAA;AAOA,IAAMG,SAAS,oBAAGC,eAAM;EAAAC,MAAA;EAAAC,KAAA;AAAA,GAAK;EACzBC,OAAO,EAAE,MAAM;EACfC,cAAc,EAAE;AACpB,CAAC,CAAC;AAMF,IAAMC,KAAK,oBAAGL,eAAM;EAAAC,MAAA;EAAAC,KAAA;AAAA,GAAK,UAACI,KAAY;EAAA,OAAM;IACxCC,QAAQ,EAAED,KAAK,CAACC,QAAQ;IACxBC,KAAK,EAAE;EACX,CAAC;AAAA,CAAC,CAAC;AAEI,IAAMC,YAAY,GAAG,IAAAC,iBAAe,EACvC,cAAc,EACd,UAAAC,IAAA,EAAqD;EAAA,IAAAC,aAAA,GAAAD,IAAA,CAAlDJ,QAAQ;IAARA,QAAQ,GAAAK,aAAA,cAAG,GAAG,GAAAA,aAAA;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;EACvB,oBACInB,MAAA,CAAAoB,OAAA,CAAAC,aAAA,CAAChB,SAAS,qBACNL,MAAA,CAAAoB,OAAA,CAAAC,aAAA,CAACV,KAAK;IAACE,QAAQ,EAAEA;EAAS,GAAEM,QAAgB,CACrC,CAAC;AAEpB,CACJ,CAAC;AAACG,OAAA,CAAAP,YAAA,GAAAA,YAAA"}
@@ -1,9 +1,3 @@
1
- import React from "react";
2
- export declare const Dashboard: React.FunctionComponent<unknown> & {
3
- original: React.ComponentType<unknown>;
4
- originalName: string;
5
- };
6
- export declare const DashboardRenderer: React.FunctionComponent<unknown> & {
7
- original: React.ComponentType<unknown>;
8
- originalName: string;
9
- };
1
+ /// <reference types="react" />
2
+ export declare const Dashboard: import("@webiny/app").DecoratableComponent<() => JSX.Element | null>;
3
+ export declare const DashboardRenderer: import("@webiny/app").DecoratableComponent<(props: unknown) => JSX.Element | null>;
@@ -7,11 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.DashboardRenderer = exports.Dashboard = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _app = require("@webiny/app");
10
- var Dashboard = (0, _app.makeComposable)("Dashboard", function () {
10
+ var Dashboard = (0, _app.makeDecoratable)("Dashboard", function () {
11
11
  return /*#__PURE__*/_react.default.createElement(DashboardRenderer, null);
12
12
  });
13
13
  exports.Dashboard = Dashboard;
14
- var DashboardRenderer = (0, _app.makeComposable)("DashboardRenderer");
14
+ var DashboardRenderer = (0, _app.makeDecoratable)("DashboardRenderer", (0, _app.createVoidComponent)());
15
15
  exports.DashboardRenderer = DashboardRenderer;
16
16
 
17
17
  //# sourceMappingURL=Dashboard.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_app","Dashboard","makeComposable","default","createElement","DashboardRenderer","exports"],"sources":["Dashboard.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeComposable } from \"@webiny/app\";\n\nexport const Dashboard = makeComposable(\"Dashboard\", () => {\n return <DashboardRenderer />;\n});\n\nexport const DashboardRenderer = makeComposable(\"DashboardRenderer\");\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEO,IAAME,SAAS,GAAG,IAAAC,mBAAc,EAAC,WAAW,EAAE,YAAM;EACvD,oBAAOL,MAAA,CAAAM,OAAA,CAAAC,aAAA,CAACC,iBAAiB,MAAE,CAAC;AAChC,CAAC,CAAC;AAACC,OAAA,CAAAL,SAAA,GAAAA,SAAA;AAEI,IAAMI,iBAAiB,GAAG,IAAAH,mBAAc,EAAC,mBAAmB,CAAC;AAACI,OAAA,CAAAD,iBAAA,GAAAA,iBAAA"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_app","Dashboard","makeDecoratable","default","createElement","DashboardRenderer","exports","createVoidComponent"],"sources":["Dashboard.tsx"],"sourcesContent":["import React from \"react\";\nimport { createVoidComponent, makeDecoratable } from \"@webiny/app\";\n\nexport const Dashboard = makeDecoratable(\"Dashboard\", () => {\n return <DashboardRenderer />;\n});\n\nexport const DashboardRenderer = makeDecoratable(\"DashboardRenderer\", createVoidComponent());\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEO,IAAME,SAAS,GAAG,IAAAC,oBAAe,EAAC,WAAW,EAAE,YAAM;EACxD,oBAAOL,MAAA,CAAAM,OAAA,CAAAC,aAAA,CAACC,iBAAiB,MAAE,CAAC;AAChC,CAAC,CAAC;AAACC,OAAA,CAAAL,SAAA,GAAAA,SAAA;AAEI,IAAMI,iBAAiB,GAAG,IAAAH,oBAAe,EAAC,mBAAmB,EAAE,IAAAK,wBAAmB,EAAC,CAAC,CAAC;AAACD,OAAA,CAAAD,iBAAA,GAAAA,iBAAA"}
@@ -63,9 +63,6 @@ export declare type FileManagerProps = {
63
63
  } & MultipleProps;
64
64
  declare type DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never;
65
65
  export declare type FileManagerRendererProps = DistributiveOmit<FileManagerProps, "render" | "children">;
66
- export declare const FileManagerRenderer: React.FunctionComponent<FileManagerRendererProps> & {
67
- original: React.ComponentType<FileManagerRendererProps>;
68
- originalName: string;
69
- };
66
+ export declare const FileManagerRenderer: import("@webiny/react-composition").DecoratableComponent<(props: FileManagerRendererProps) => JSX.Element | null>;
70
67
  export declare const FileManager: ({ children, render, onChange, ...rest }: FileManagerProps) => JSX.Element;
71
68
  export {};
@@ -32,7 +32,7 @@ function getPortalTarget() {
32
32
 
33
33
  // This jewel was taken from https://davidgomes.com/pick-omit-over-union-types-in-typescript/. Massive thanks, David!
34
34
 
35
- var FileManagerRenderer = (0, _reactComposition.makeComposable)("FileManagerRenderer");
35
+ var FileManagerRenderer = (0, _reactComposition.makeDecoratable)("FileManagerRenderer", (0, _reactComposition.createVoidComponent)());
36
36
  exports.FileManagerRenderer = FileManagerRenderer;
37
37
  var FileManager = function FileManager(_ref) {
38
38
  var children = _ref.children,
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactDom","_interopRequireDefault","_reactComposition","_excluded","getPortalTarget","target","window","document","getElementById","createElement","setAttribute","body","appendChild","FileManagerRenderer","makeComposable","exports","FileManager","_ref","children","render","onChange","rest","_objectWithoutProperties2","default","containerRef","useRef","_useState","useState","show","_useState2","_slicedToArray2","setShow","onChangeRef","useEffect","current","showFileManager","useCallback","Fragment","ReactDOM","createPortal","Object","assign","onClose"],"sources":["FileManager.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { makeComposable } from \"@webiny/react-composition\";\n\nexport interface FileManagerOnChange<T> {\n (value: T): void;\n}\n\n/**\n * Represents a file object managed by the File Manager.\n */\nexport interface FileManagerFileItem {\n id: string;\n src: string;\n meta?: Array<FileManagerFileItemMetaItem>;\n}\n\n/**\n * With this we allow developers to add any value to file's meta via component composition, thus the `value: any`.\n */\nexport interface FileManagerFileItemMetaItem {\n key: string;\n value: any;\n}\n\nexport type DeprecatedFileManagerRenderPropParams = {\n showFileManager: (\n onChange?: FileManagerOnChange<FileManagerFileItem | FileManagerFileItem[]>\n ) => void;\n};\n\nexport type FileManagerRenderPropParams<TValue> = {\n showFileManager: (onChange?: FileManagerOnChange<TValue>) => void;\n};\n\ninterface SingleFileRenderProp {\n (params: FileManagerRenderPropParams<FileManagerFileItem>): React.ReactNode;\n}\n\ninterface MultiFileRenderProp {\n (params: FileManagerRenderPropParams<FileManagerFileItem[]>): React.ReactNode;\n}\n\nexport type MultipleProps =\n | {\n multiple?: never;\n multipleMaxCount?: never;\n multipleMaxSize?: never;\n onChange?: FileManagerOnChange<FileManagerFileItem>;\n render?: SingleFileRenderProp;\n }\n | {\n multiple: true;\n multipleMaxCount?: number;\n multipleMaxSize?: number | string;\n onChange?: FileManagerOnChange<FileManagerFileItem[]>;\n render?: MultiFileRenderProp;\n };\n\nexport type FileManagerProps = {\n accept?: string[];\n images?: boolean;\n maxSize?: number | string;\n /**\n * @deprecated This prop is no longer used. The file structure was reduced to a bare minimum so picking is no longer necessary.\n */\n onChangePick?: string[];\n onClose?: () => void;\n onUploadCompletion?: (files: FileManagerFileItem[]) => void;\n own?: boolean;\n scope?: string;\n tags?: string[];\n show?: boolean;\n /**\n * @deprecated This prop is no longer used. Use the `render` prop to get better TS autocomplete.\n */\n children?: (params: DeprecatedFileManagerRenderPropParams) => React.ReactNode;\n} & MultipleProps;\n\nfunction getPortalTarget() {\n let target = window.document.getElementById(\"file-manager-container\");\n if (!target) {\n target = document.createElement(\"div\");\n target.setAttribute(\"id\", \"file-manager-container\");\n document.body && document.body.appendChild(target);\n }\n return target;\n}\n\n// This jewel was taken from https://davidgomes.com/pick-omit-over-union-types-in-typescript/. Massive thanks, David!\ntype DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never;\n\nexport type FileManagerRendererProps = DistributiveOmit<FileManagerProps, \"render\" | \"children\">;\n\nexport const FileManagerRenderer = makeComposable<FileManagerRendererProps>(\"FileManagerRenderer\");\n\nexport const FileManager = ({ children, render, onChange, ...rest }: FileManagerProps) => {\n const containerRef = useRef<HTMLElement>(getPortalTarget());\n const [show, setShow] = useState(rest.show ?? false);\n const onChangeRef = useRef(onChange);\n\n useEffect(() => {\n onChangeRef.current = onChange;\n }, [onChange]);\n\n const showFileManager = useCallback(onChange => {\n if (typeof onChange === \"function\") {\n onChangeRef.current = onChange;\n }\n setShow(true);\n }, []);\n\n return (\n <>\n {show &&\n ReactDOM.createPortal(\n /**\n * TODO @pavel\n */\n // @ts-expect-error\n <FileManagerRenderer\n onClose={() => setShow(false)}\n onChange={\n /* TODO: figure out how to create a conditional type based on the value of `rest.multiple` */\n onChangeRef.current\n }\n {...rest}\n />,\n containerRef.current\n )}\n {children ? children({ showFileManager }) : render ? render({ showFileManager }) : null}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;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QAAQ,CAAC;EAEpC,IAAAa,gBAAS,EAAC,YAAM;IACZD,WAAW,CAACE,OAAO,GAAGd,QAAQ;EAClC,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;EAEd,IAAMe,eAAe,GAAG,IAAAC,kBAAW,EAAC,UAAAhB,QAAQ,EAAI;IAC5C,IAAI,OAAOA,QAAQ,KAAK,UAAU,EAAE;MAChCY,WAAW,CAACE,OAAO,GAAGd,QAAQ;IAClC;IACAW,OAAO,CAAC,IAAI,CAAC;EACjB,CAAC,EAAE,EAAE,CAAC;EAEN,oBACIlC,MAAA,CAAA0B,OAAA,CAAAd,aAAA,CAAAZ,MAAA,CAAA0B,OAAA,CAAAc,QAAA,QACKT,IAAI,iBACDU,iBAAQ,CAACC,YAAY;EAAA;EACjB;AACpB;AACA;EACoB;EACA1C,MAAA,CAAA0B,OAAA,CAAAd,aAAA,CAACI,mBAAmB,EAAA2B,MAAA,CAAAC,MAAA;IAChBC,OAAO,EAAE,SAAAA,QAAA;MAAA,OAAMX,OAAO,CAAC,KAAK,CAAC;IAAA,CAAC;IAC9BX,QAAQ,EACJ;IACAY,WAAW,CAACE;EACf,GACGb,IAAI,CACX,CAAC,EACFG,YAAY,CAACU,OACjB,CAAC,EACJhB,QAAQ,GAAGA,QAAQ,CAAC;IAAEiB,eAAe,EAAfA;EAAgB,CAAC,CAAC,GAAGhB,MAAM,GAAGA,MAAM,CAAC;IAAEgB,eAAe,EAAfA;EAAgB,CAAC,CAAC,GAAG,IACrF,CAAC;AAEX,CAAC;AAACpB,OAAA,CAAAC,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactDom","_interopRequireDefault","_reactComposition","_excluded","getPortalTarget","target","window","document","getElementById","createElement","setAttribute","body","appendChild","FileManagerRenderer","makeDecoratable","createVoidComponent","exports","FileManager","_ref","children","render","onChange","rest","_objectWithoutProperties2","default","containerRef","useRef","_useState","useState","show","_useState2","_slicedToArray2","setShow","onChangeRef","useEffect","current","showFileManager","useCallback","Fragment","ReactDOM","createPortal","Object","assign","onClose"],"sources":["FileManager.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { createVoidComponent, makeDecoratable } from \"@webiny/react-composition\";\n\nexport interface FileManagerOnChange<T> {\n (value: T): void;\n}\n\n/**\n * Represents a file object managed by the File Manager.\n */\nexport interface FileManagerFileItem {\n id: string;\n src: string;\n meta?: Array<FileManagerFileItemMetaItem>;\n}\n\n/**\n * With this we allow developers to add any value to file's meta via component composition, thus the `value: any`.\n */\nexport interface FileManagerFileItemMetaItem {\n key: string;\n value: any;\n}\n\nexport type DeprecatedFileManagerRenderPropParams = {\n showFileManager: (\n onChange?: FileManagerOnChange<FileManagerFileItem | FileManagerFileItem[]>\n ) => void;\n};\n\nexport type FileManagerRenderPropParams<TValue> = {\n showFileManager: (onChange?: FileManagerOnChange<TValue>) => void;\n};\n\ninterface SingleFileRenderProp {\n (params: FileManagerRenderPropParams<FileManagerFileItem>): React.ReactNode;\n}\n\ninterface MultiFileRenderProp {\n (params: FileManagerRenderPropParams<FileManagerFileItem[]>): React.ReactNode;\n}\n\nexport type MultipleProps =\n | {\n multiple?: never;\n multipleMaxCount?: never;\n multipleMaxSize?: never;\n onChange?: FileManagerOnChange<FileManagerFileItem>;\n render?: SingleFileRenderProp;\n }\n | {\n multiple: true;\n multipleMaxCount?: number;\n multipleMaxSize?: number | string;\n onChange?: FileManagerOnChange<FileManagerFileItem[]>;\n render?: MultiFileRenderProp;\n };\n\nexport type FileManagerProps = {\n accept?: string[];\n images?: boolean;\n maxSize?: number | string;\n /**\n * @deprecated This prop is no longer used. The file structure was reduced to a bare minimum so picking is no longer necessary.\n */\n onChangePick?: string[];\n onClose?: () => void;\n onUploadCompletion?: (files: FileManagerFileItem[]) => void;\n own?: boolean;\n scope?: string;\n tags?: string[];\n show?: boolean;\n /**\n * @deprecated This prop is no longer used. Use the `render` prop to get better TS autocomplete.\n */\n children?: (params: DeprecatedFileManagerRenderPropParams) => React.ReactNode;\n} & MultipleProps;\n\nfunction getPortalTarget() {\n let target = window.document.getElementById(\"file-manager-container\");\n if (!target) {\n target = document.createElement(\"div\");\n target.setAttribute(\"id\", \"file-manager-container\");\n document.body && document.body.appendChild(target);\n }\n return target;\n}\n\n// This jewel was taken from https://davidgomes.com/pick-omit-over-union-types-in-typescript/. Massive thanks, David!\ntype DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never;\n\nexport type FileManagerRendererProps = DistributiveOmit<FileManagerProps, \"render\" | \"children\">;\n\nexport const FileManagerRenderer = makeDecoratable(\n \"FileManagerRenderer\",\n createVoidComponent<FileManagerRendererProps>()\n);\n\nexport const FileManager = ({ children, render, onChange, ...rest }: FileManagerProps) => {\n const containerRef = useRef<HTMLElement>(getPortalTarget());\n const [show, setShow] = useState(rest.show ?? false);\n const onChangeRef = useRef(onChange);\n\n useEffect(() => {\n onChangeRef.current = onChange;\n }, [onChange]);\n\n const showFileManager = useCallback(onChange => {\n if (typeof onChange === \"function\") {\n onChangeRef.current = onChange;\n }\n setShow(true);\n }, []);\n\n return (\n <>\n {show &&\n ReactDOM.createPortal(\n /**\n * TODO @pavel\n */\n // @ts-expect-error\n <FileManagerRenderer\n onClose={() => setShow(false)}\n onChange={\n /* TODO: figure out how to create a conditional type based on the value of `rest.multiple` */\n onChangeRef.current\n }\n {...rest}\n />,\n containerRef.current\n )}\n {children ? children({ showFileManager }) : render ? render({ showFileManager }) : null}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAAiF,IAAAI,SAAA;AAMjF;AACA;AACA;;AAOA;AACA;AACA;;AA4DA,SAASC,eAAeA,CAAA,EAAG;EACvB,IAAIC,MAAM,GAAGC,MAAM,CAACC,QAAQ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AAK,UAAU,EAAE;MAChCY,WAAW,CAACE,OAAO,GAAGd,QAAQ;IAClC;IACAW,OAAO,CAAC,IAAI,CAAC;EACjB,CAAC,EAAE,EAAE,CAAC;EAEN,oBACInC,MAAA,CAAA2B,OAAA,CAAAf,aAAA,CAAAZ,MAAA,CAAA2B,OAAA,CAAAc,QAAA,QACKT,IAAI,iBACDU,iBAAQ,CAACC,YAAY;EAAA;EACjB;AACpB;AACA;EACoB;EACA3C,MAAA,CAAA2B,OAAA,CAAAf,aAAA,CAACI,mBAAmB,EAAA4B,MAAA,CAAAC,MAAA;IAChBC,OAAO,EAAE,SAAAA,QAAA;MAAA,OAAMX,OAAO,CAAC,KAAK,CAAC;IAAA,CAAC;IAC9BX,QAAQ,EACJ;IACAY,WAAW,CAACE;EACf,GACGb,IAAI,CACX,CAAC,EACFG,YAAY,CAACU,OACjB,CAAC,EACJhB,QAAQ,GAAGA,QAAQ,CAAC;IAAEiB,eAAe,EAAfA;EAAgB,CAAC,CAAC,GAAGhB,MAAM,GAAGA,MAAM,CAAC;IAAEgB,eAAe,EAAfA;EAAgB,CAAC,CAAC,GAAG,IACrF,CAAC;AAEX,CAAC;AAACpB,OAAA,CAAAC,WAAA,GAAAA,WAAA"}
@@ -3,11 +3,5 @@ export interface LayoutProps {
3
3
  title?: string;
4
4
  children: React.ReactNode;
5
5
  }
6
- export declare const Layout: React.FunctionComponent<LayoutProps> & {
7
- original: React.ComponentType<LayoutProps>;
8
- originalName: string;
9
- };
10
- export declare const LayoutRenderer: React.FunctionComponent<LayoutProps> & {
11
- original: React.ComponentType<LayoutProps>;
12
- originalName: string;
13
- };
6
+ export declare const Layout: import("@webiny/app").DecoratableComponent<(args_0: LayoutProps) => JSX.Element | null>;
7
+ export declare const LayoutRenderer: import("@webiny/app").DecoratableComponent<(props: LayoutProps) => JSX.Element | null>;
package/base/ui/Layout.js CHANGED
@@ -9,13 +9,13 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _app = require("@webiny/app");
11
11
  var _excluded = ["children"];
12
- var Layout = (0, _app.makeComposable)("Layout", function (_ref) {
12
+ var Layout = (0, _app.makeDecoratable)("Layout", function (_ref) {
13
13
  var children = _ref.children,
14
14
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
15
15
  return /*#__PURE__*/_react.default.createElement(LayoutRenderer, props, children);
16
16
  });
17
17
  exports.Layout = Layout;
18
- var LayoutRenderer = (0, _app.makeComposable)("LayoutRenderer");
18
+ var LayoutRenderer = (0, _app.makeDecoratable)("LayoutRenderer", (0, _app.createVoidComponent)());
19
19
  exports.LayoutRenderer = LayoutRenderer;
20
20
 
21
21
  //# sourceMappingURL=Layout.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_app","_excluded","Layout","makeComposable","_ref","children","props","_objectWithoutProperties2","default","createElement","LayoutRenderer","exports"],"sources":["Layout.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeComposable } from \"@webiny/app\";\n\nexport interface LayoutProps {\n title?: string;\n children: React.ReactNode;\n}\n\nexport const Layout = makeComposable<LayoutProps>(\"Layout\", ({ children, ...props }) => {\n return <LayoutRenderer {...props}>{children}</LayoutRenderer>;\n});\n\nexport const LayoutRenderer = makeComposable<LayoutProps>(\"LayoutRenderer\");\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAA6C,IAAAE,SAAA;AAOtC,IAAMC,MAAM,GAAG,IAAAC,mBAAc,EAAc,QAAQ,EAAE,UAAAC,IAAA,EAA4B;EAAA,IAAzBC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAKC,KAAK,OAAAC,yBAAA,CAAAC,OAAA,EAAAJ,IAAA,EAAAH,SAAA;EAC7E,oBAAOJ,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACC,cAAc,EAAKJ,KAAK,EAAGD,QAAyB,CAAC;AACjE,CAAC,CAAC;AAACM,OAAA,CAAAT,MAAA,GAAAA,MAAA;AAEI,IAAMQ,cAAc,GAAG,IAAAP,mBAAc,EAAc,gBAAgB,CAAC;AAACQ,OAAA,CAAAD,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_app","_excluded","Layout","makeDecoratable","_ref","children","props","_objectWithoutProperties2","default","createElement","LayoutRenderer","exports","createVoidComponent"],"sources":["Layout.tsx"],"sourcesContent":["import React from \"react\";\nimport { createVoidComponent, makeDecoratable } from \"@webiny/app\";\n\nexport interface LayoutProps {\n title?: string;\n children: React.ReactNode;\n}\n\nexport const Layout = makeDecoratable(\"Layout\", ({ children, ...props }: LayoutProps) => {\n return <LayoutRenderer {...props}>{children}</LayoutRenderer>;\n});\n\nexport const LayoutRenderer = makeDecoratable(\"LayoutRenderer\", createVoidComponent<LayoutProps>());\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAAmE,IAAAE,SAAA;AAO5D,IAAMC,MAAM,GAAG,IAAAC,oBAAe,EAAC,QAAQ,EAAE,UAAAC,IAAA,EAAyC;EAAA,IAAtCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAKC,KAAK,OAAAC,yBAAA,CAAAC,OAAA,EAAAJ,IAAA,EAAAH,SAAA;EACjE,oBAAOJ,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACC,cAAc,EAAKJ,KAAK,EAAGD,QAAyB,CAAC;AACjE,CAAC,CAAC;AAACM,OAAA,CAAAT,MAAA,GAAAA,MAAA;AAEI,IAAMQ,cAAc,GAAG,IAAAP,oBAAe,EAAC,gBAAgB,EAAE,IAAAS,wBAAmB,EAAc,CAAC,CAAC;AAACD,OAAA,CAAAD,cAAA,GAAAA,cAAA"}
@@ -1,9 +1,3 @@
1
- import React from "react";
2
- export declare const LocaleSelector: React.FunctionComponent<unknown> & {
3
- original: React.ComponentType<unknown>;
4
- originalName: string;
5
- };
6
- export declare const LocaleSelectorRenderer: React.FunctionComponent<unknown> & {
7
- original: React.ComponentType<unknown>;
8
- originalName: string;
9
- };
1
+ /// <reference types="react" />
2
+ export declare const LocaleSelector: import("@webiny/app").DecoratableComponent<() => JSX.Element | null>;
3
+ export declare const LocaleSelectorRenderer: import("@webiny/app").DecoratableComponent<(props: unknown) => JSX.Element | null>;
@@ -7,11 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.LocaleSelectorRenderer = exports.LocaleSelector = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _app = require("@webiny/app");
10
- var LocaleSelector = (0, _app.makeComposable)("LocaleSelector", function () {
10
+ var LocaleSelector = (0, _app.makeDecoratable)("LocaleSelector", function () {
11
11
  return /*#__PURE__*/_react.default.createElement(LocaleSelectorRenderer, null);
12
12
  });
13
13
  exports.LocaleSelector = LocaleSelector;
14
- var LocaleSelectorRenderer = (0, _app.makeComposable)("LocaleSelectorRenderer");
14
+ var LocaleSelectorRenderer = (0, _app.makeDecoratable)("LocaleSelectorRenderer", (0, _app.createVoidComponent)());
15
15
  exports.LocaleSelectorRenderer = LocaleSelectorRenderer;
16
16
 
17
17
  //# sourceMappingURL=LocaleSelector.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_app","LocaleSelector","makeComposable","default","createElement","LocaleSelectorRenderer","exports"],"sources":["LocaleSelector.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeComposable } from \"@webiny/app\";\n\nexport const LocaleSelector = makeComposable(\"LocaleSelector\", () => {\n return <LocaleSelectorRenderer />;\n});\n\nexport const LocaleSelectorRenderer = makeComposable(\"LocaleSelectorRenderer\");\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEO,IAAME,cAAc,GAAG,IAAAC,mBAAc,EAAC,gBAAgB,EAAE,YAAM;EACjE,oBAAOL,MAAA,CAAAM,OAAA,CAAAC,aAAA,CAACC,sBAAsB,MAAE,CAAC;AACrC,CAAC,CAAC;AAACC,OAAA,CAAAL,cAAA,GAAAA,cAAA;AAEI,IAAMI,sBAAsB,GAAG,IAAAH,mBAAc,EAAC,wBAAwB,CAAC;AAACI,OAAA,CAAAD,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_app","LocaleSelector","makeDecoratable","default","createElement","LocaleSelectorRenderer","exports","createVoidComponent"],"sources":["LocaleSelector.tsx"],"sourcesContent":["import React from \"react\";\nimport { createVoidComponent, makeDecoratable } from \"@webiny/app\";\n\nexport const LocaleSelector = makeDecoratable(\"LocaleSelector\", () => {\n return <LocaleSelectorRenderer />;\n});\n\nexport const LocaleSelectorRenderer = makeDecoratable(\n \"LocaleSelectorRenderer\",\n createVoidComponent()\n);\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEO,IAAME,cAAc,GAAG,IAAAC,oBAAe,EAAC,gBAAgB,EAAE,YAAM;EAClE,oBAAOL,MAAA,CAAAM,OAAA,CAAAC,aAAA,CAACC,sBAAsB,MAAE,CAAC;AACrC,CAAC,CAAC;AAACC,OAAA,CAAAL,cAAA,GAAAA,cAAA;AAEI,IAAMI,sBAAsB,GAAG,IAAAH,oBAAe,EACjD,wBAAwB,EACxB,IAAAK,wBAAmB,EAAC,CACxB,CAAC;AAACD,OAAA,CAAAD,sBAAA,GAAAA,sBAAA"}
@@ -3,7 +3,4 @@ export interface LoginScreenProps {
3
3
  children: React.ReactNode;
4
4
  }
5
5
  export declare const LoginScreen: ({ children }: LoginScreenProps) => JSX.Element;
6
- export declare const LoginScreenRenderer: React.FunctionComponent<LoginScreenProps> & {
7
- original: React.ComponentType<LoginScreenProps>;
8
- originalName: string;
9
- };
6
+ export declare const LoginScreenRenderer: import("@webiny/app").DecoratableComponent<(props: LoginScreenProps) => JSX.Element | null>;
@@ -17,7 +17,7 @@ var LoginScreen = function LoginScreen(_ref) {
17
17
  }, /*#__PURE__*/_react.default.createElement(LoginScreenRenderer, null, children));
18
18
  };
19
19
  exports.LoginScreen = LoginScreen;
20
- var LoginScreenRenderer = (0, _app.makeComposable)("LoginScreenRenderer");
20
+ var LoginScreenRenderer = (0, _app.makeDecoratable)("LoginScreenRenderer", (0, _app.createVoidComponent)());
21
21
  exports.LoginScreenRenderer = LoginScreenRenderer;
22
22
 
23
23
  //# sourceMappingURL=LoginScreen.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_app","_Tags","LoginScreen","_ref","children","default","createElement","Tags","tags","location","LoginScreenRenderer","exports","makeComposable"],"sources":["LoginScreen.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeComposable } from \"@webiny/app\";\nimport { Tags } from \"./Tags\";\n\nexport interface LoginScreenProps {\n children: React.ReactNode;\n}\n\nexport const LoginScreen = ({ children }: LoginScreenProps) => {\n return (\n <Tags tags={{ location: \"loginScreen\" }}>\n <LoginScreenRenderer>{children}</LoginScreenRenderer>\n </Tags>\n );\n};\n\nexport const LoginScreenRenderer = makeComposable<LoginScreenProps>(\"LoginScreenRenderer\");\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAMO,IAAMG,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAAuC;EAAA,IAAjCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EAClC,oBACIP,MAAA,CAAAQ,OAAA,CAAAC,aAAA,CAACL,KAAA,CAAAM,IAAI;IAACC,IAAI,EAAE;MAAEC,QAAQ,EAAE;IAAc;EAAE,gBACpCZ,MAAA,CAAAQ,OAAA,CAAAC,aAAA,CAACI,mBAAmB,QAAEN,QAA8B,CAClD,CAAC;AAEf,CAAC;AAACO,OAAA,CAAAT,WAAA,GAAAA,WAAA;AAEK,IAAMQ,mBAAmB,GAAG,IAAAE,mBAAc,EAAmB,qBAAqB,CAAC;AAACD,OAAA,CAAAD,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_app","_Tags","LoginScreen","_ref","children","default","createElement","Tags","tags","location","LoginScreenRenderer","exports","makeDecoratable","createVoidComponent"],"sources":["LoginScreen.tsx"],"sourcesContent":["import React from \"react\";\nimport { createVoidComponent, makeDecoratable } from \"@webiny/app\";\nimport { Tags } from \"./Tags\";\n\nexport interface LoginScreenProps {\n children: React.ReactNode;\n}\n\nexport const LoginScreen = ({ children }: LoginScreenProps) => {\n return (\n <Tags tags={{ location: \"loginScreen\" }}>\n <LoginScreenRenderer>{children}</LoginScreenRenderer>\n </Tags>\n );\n};\n\nexport const LoginScreenRenderer = makeDecoratable(\n \"LoginScreenRenderer\",\n createVoidComponent<LoginScreenProps>()\n);\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAMO,IAAMG,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAAuC;EAAA,IAAjCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EAClC,oBACIP,MAAA,CAAAQ,OAAA,CAAAC,aAAA,CAACL,KAAA,CAAAM,IAAI;IAACC,IAAI,EAAE;MAAEC,QAAQ,EAAE;IAAc;EAAE,gBACpCZ,MAAA,CAAAQ,OAAA,CAAAC,aAAA,CAACI,mBAAmB,QAAEN,QAA8B,CAClD,CAAC;AAEf,CAAC;AAACO,OAAA,CAAAT,WAAA,GAAAA,WAAA;AAEK,IAAMQ,mBAAmB,GAAG,IAAAE,oBAAe,EAC9C,qBAAqB,EACrB,IAAAC,wBAAmB,EAAmB,CAC1C,CAAC;AAACF,OAAA,CAAAD,mBAAA,GAAAA,mBAAA"}
package/base/ui/Logo.d.ts CHANGED
@@ -1,12 +1,6 @@
1
- import React from "react";
2
- export declare const Logo: React.FunctionComponent<unknown> & {
3
- original: React.ComponentType<unknown>;
4
- originalName: string;
5
- };
6
- export declare const LogoRenderer: React.FunctionComponent<unknown> & {
7
- original: React.ComponentType<unknown>;
8
- originalName: string;
9
- };
1
+ /// <reference types="react" />
2
+ export declare const Logo: import("@webiny/app").DecoratableComponent<() => JSX.Element | null>;
3
+ export declare const LogoRenderer: import("@webiny/app").DecoratableComponent<(props: unknown) => JSX.Element | null>;
10
4
  interface AddLogoProps {
11
5
  logo: JSX.Element;
12
6
  }
package/base/ui/Logo.js CHANGED
@@ -7,11 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.LogoRenderer = exports.Logo = exports.AddLogo = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _app = require("@webiny/app");
10
- var Logo = (0, _app.makeComposable)("Logo", function () {
10
+ var Logo = (0, _app.makeDecoratable)("Logo", function () {
11
11
  return /*#__PURE__*/_react.default.createElement(LogoRenderer, null);
12
12
  });
13
13
  exports.Logo = Logo;
14
- var LogoRenderer = (0, _app.makeComposable)("LogoRenderer");
14
+ var LogoRenderer = (0, _app.makeDecoratable)("LogoRenderer", (0, _app.createVoidComponent)());
15
15
  exports.LogoRenderer = LogoRenderer;
16
16
  var AddLogo = function AddLogo(_ref) {
17
17
  var logo = _ref.logo;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_app","Logo","makeComposable","default","createElement","LogoRenderer","exports","AddLogo","_ref","logo","LogoHOC","useMemo","Compose","component","with"],"sources":["Logo.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { Compose, makeComposable } from \"@webiny/app\";\n\nexport const Logo = makeComposable(\"Logo\", () => {\n return <LogoRenderer />;\n});\n\nexport const LogoRenderer = makeComposable(\"LogoRenderer\");\n\ninterface AddLogoProps {\n logo: JSX.Element;\n}\n\nexport const AddLogo = ({ logo }: AddLogoProps) => {\n const LogoHOC = useMemo(() => {\n return () => {\n return function Logo() {\n return logo;\n };\n };\n }, []);\n\n return <Compose component={LogoRenderer} with={LogoHOC} />;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEO,IAAME,IAAI,GAAG,IAAAC,mBAAc,EAAC,MAAM,EAAE,YAAM;EAC7C,oBAAOL,MAAA,CAAAM,OAAA,CAAAC,aAAA,CAACC,YAAY,MAAE,CAAC;AAC3B,CAAC,CAAC;AAACC,OAAA,CAAAL,IAAA,GAAAA,IAAA;AAEI,IAAMI,YAAY,GAAG,IAAAH,mBAAc,EAAC,cAAc,CAAC;AAACI,OAAA,CAAAD,YAAA,GAAAA,YAAA;AAMpD,IAAME,OAAO,GAAG,SAAVA,OAAOA,CAAAC,IAAA,EAA+B;EAAA,IAAzBC,IAAI,GAAAD,IAAA,CAAJC,IAAI;EAC1B,IAAMC,OAAO,GAAG,IAAAC,cAAO,EAAC,YAAM;IAC1B,OAAO,YAAM;MACT,OAAO,SAASV,IAAIA,CAAA,EAAG;QACnB,OAAOQ,IAAI;MACf,CAAC;IACL,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,oBAAOZ,MAAA,CAAAM,OAAA,CAAAC,aAAA,CAACJ,IAAA,CAAAY,OAAO;IAACC,SAAS,EAAER,YAAa;IAACS,IAAI,EAAEJ;EAAQ,CAAE,CAAC;AAC9D,CAAC;AAACJ,OAAA,CAAAC,OAAA,GAAAA,OAAA"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_app","Logo","makeDecoratable","default","createElement","LogoRenderer","exports","createVoidComponent","AddLogo","_ref","logo","LogoHOC","useMemo","Compose","component","with"],"sources":["Logo.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { Compose, createVoidComponent, makeDecoratable } from \"@webiny/app\";\n\nexport const Logo = makeDecoratable(\"Logo\", () => {\n return <LogoRenderer />;\n});\n\nexport const LogoRenderer = makeDecoratable(\"LogoRenderer\", createVoidComponent());\n\ninterface AddLogoProps {\n logo: JSX.Element;\n}\n\nexport const AddLogo = ({ logo }: AddLogoProps) => {\n const LogoHOC = useMemo(() => {\n return () => {\n return function Logo() {\n return logo;\n };\n };\n }, []);\n\n return <Compose component={LogoRenderer} with={LogoHOC} />;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEO,IAAME,IAAI,GAAG,IAAAC,oBAAe,EAAC,MAAM,EAAE,YAAM;EAC9C,oBAAOL,MAAA,CAAAM,OAAA,CAAAC,aAAA,CAACC,YAAY,MAAE,CAAC;AAC3B,CAAC,CAAC;AAACC,OAAA,CAAAL,IAAA,GAAAA,IAAA;AAEI,IAAMI,YAAY,GAAG,IAAAH,oBAAe,EAAC,cAAc,EAAE,IAAAK,wBAAmB,EAAC,CAAC,CAAC;AAACD,OAAA,CAAAD,YAAA,GAAAA,YAAA;AAM5E,IAAMG,OAAO,GAAG,SAAVA,OAAOA,CAAAC,IAAA,EAA+B;EAAA,IAAzBC,IAAI,GAAAD,IAAA,CAAJC,IAAI;EAC1B,IAAMC,OAAO,GAAG,IAAAC,cAAO,EAAC,YAAM;IAC1B,OAAO,YAAM;MACT,OAAO,SAASX,IAAIA,CAAA,EAAG;QACnB,OAAOS,IAAI;MACf,CAAC;IACL,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,oBAAOb,MAAA,CAAAM,OAAA,CAAAC,aAAA,CAACJ,IAAA,CAAAa,OAAO;IAACC,SAAS,EAAET,YAAa;IAACU,IAAI,EAAEJ;EAAQ,CAAE,CAAC;AAC9D,CAAC;AAACL,OAAA,CAAAE,OAAA,GAAAA,OAAA"}
@@ -11,10 +11,7 @@ interface NavigationProviderProps {
11
11
  }
12
12
  export declare const NavigationProvider: (Component: React.ComponentType<unknown>) => ({ children }: NavigationProviderProps) => JSX.Element;
13
13
  export declare const Navigation: () => JSX.Element;
14
- export declare const NavigationRenderer: React.FunctionComponent<unknown> & {
15
- original: React.ComponentType<unknown>;
16
- originalName: string;
17
- };
14
+ export declare const NavigationRenderer: import("@webiny/app").DecoratableComponent<(props: unknown) => JSX.Element | null>;
18
15
  interface MenuItemContext {
19
16
  menuItem?: MenuData;
20
17
  depth: number;
@@ -24,13 +21,7 @@ export declare function useMenuItem(): MenuItemContext;
24
21
  export interface MenuItemsProps {
25
22
  menuItems: MenuData[];
26
23
  }
27
- export declare const MenuItems: React.FunctionComponent<MenuItemsProps> & {
28
- original: React.ComponentType<MenuItemsProps>;
29
- originalName: string;
30
- };
24
+ export declare const MenuItems: import("@webiny/app").DecoratableComponent<(args_0: MenuItemsProps) => JSX.Element | null>;
31
25
  export declare const MenuItem: () => JSX.Element;
32
- export declare const MenuItemRenderer: React.FunctionComponent<unknown> & {
33
- original: React.ComponentType<unknown>;
34
- originalName: string;
35
- };
26
+ export declare const MenuItemRenderer: import("@webiny/app").DecoratableComponent<(props: unknown) => JSX.Element | null>;
36
27
  export {};
@@ -120,7 +120,7 @@ var Navigation = function Navigation() {
120
120
  }, /*#__PURE__*/_react.default.createElement(NavigationRenderer, null));
121
121
  };
122
122
  exports.Navigation = Navigation;
123
- var NavigationRenderer = (0, _app.makeComposable)("NavigationRenderer");
123
+ var NavigationRenderer = (0, _app.makeDecoratable)("NavigationRenderer", (0, _app.createVoidComponent)());
124
124
  exports.NavigationRenderer = NavigationRenderer;
125
125
  var MenuItemContext = /*#__PURE__*/_react.default.createContext({
126
126
  menuItem: undefined,
@@ -130,7 +130,7 @@ MenuItemContext.displayName = "MenuItemContext";
130
130
  function useMenuItem() {
131
131
  return _react.default.useContext(MenuItemContext);
132
132
  }
133
- var MenuItems = (0, _app.makeComposable)("MenuItems", function (_ref2) {
133
+ var MenuItems = (0, _app.makeDecoratable)("MenuItems", function (_ref2) {
134
134
  var menuItems = _ref2.menuItems;
135
135
  var menuItem = useMenuItem();
136
136
  var depth = menuItem ? menuItem.depth : -1;
@@ -149,7 +149,7 @@ var MenuItem = function MenuItem() {
149
149
  return /*#__PURE__*/_react.default.createElement(MenuItemRenderer, null);
150
150
  };
151
151
  exports.MenuItem = MenuItem;
152
- var MenuItemRenderer = (0, _app.makeComposable)("MenuItemRenderer");
152
+ var MenuItemRenderer = (0, _app.makeDecoratable)("MenuItemRenderer", (0, _app.createVoidComponent)());
153
153
  exports.MenuItemRenderer = MenuItemRenderer;
154
154
 
155
155
  //# sourceMappingURL=Navigation.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_utils","_app","_","_plugins","NavigationContext","createContext","menuItems","setMenu","removeMenu","displayName","useNavigation","useContext","LegacyMenu","props","default","createElement","AddMenu","Object","assign","name","generateId","label","children","LegacyMenuPlugins","_useState","useState","_useState2","_slicedToArray2","menus","setMenus","useEffect","menuPlugins","plugins","byType","menuElements","map","plugin","Plugins","key","render","Menu","Item","Section","NavigationProvider","Component","_ref","_useState3","_useState4","setState","id","updater","state","index","findIndex","m","newMenu","createEmptyMenu","_toConsumableArray2","concat","slice","useCallback","context","useMemo","Provider","value","exports","Navigation","Tags","tags","location","NavigationRenderer","makeComposable","MenuItemContext","React","menuItem","undefined","depth","useMenuItem","MenuItems","_ref2","Fragment","MenuItem","MenuItemRenderer"],"sources":["Navigation.tsx"],"sourcesContent":["import React, {\n createContext,\n Fragment,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState\n} from \"react\";\nimport { generateId } from \"@webiny/utils\";\nimport { makeComposable, Plugins } from \"@webiny/app\";\nimport { AddMenu as Menu, createEmptyMenu, MenuData, MenuProps, MenuUpdater, Tags } from \"~/index\";\nimport { plugins } from \"@webiny/plugins\";\nimport { AdminMenuPlugin } from \"~/types\";\nimport { ItemProps, SectionProps } from \"~/plugins/MenuPlugin\";\n\nexport interface NavigationContext {\n menuItems: MenuData[];\n setMenu(id: string, update: MenuUpdater): void;\n removeMenu(id: string): void;\n}\n\nconst NavigationContext = createContext<NavigationContext>({\n menuItems: [],\n setMenu: () => {\n return void 0;\n },\n removeMenu: () => {\n return void 0;\n }\n});\nNavigationContext.displayName = \"NavigationContext\";\n\nexport function useNavigation() {\n return useContext(NavigationContext);\n}\n\ntype LegacyMenuProps = MenuProps | SectionProps | ItemProps;\n\n// IMPORTANT! The following component is for BACKWARDS COMPATIBILITY purposes only!\n// It is not a public component, and is not even exported from this file. We need it to take care of\n// scaffolded plugins in users' projects, as well as our own applications (Page Builder and Form Builder).\nconst LegacyMenu = (props: LegacyMenuProps & { children: React.ReactNode }) => {\n return (\n <Menu\n {...props}\n name={(props as MenuProps).name || generateId()}\n label={props.label as string}\n >\n {props.children}\n </Menu>\n );\n};\n\nconst LegacyMenuPlugins = () => {\n // IMPORTANT! The following piece of code is for BACKWARDS COMPATIBILITY purposes only!\n const [menus, setMenus] = useState<JSX.Element | null>(null);\n\n useEffect(() => {\n const menuPlugins = plugins.byType<AdminMenuPlugin>(\"admin-menu\");\n if (!menuPlugins) {\n return;\n }\n\n const menuElements = menuPlugins.map(plugin => {\n // TODO @ts-refactor figure out correct types or write a comment to leave as React.FC\n return (\n <Plugins key={plugin.name}>\n {plugin.render({\n Menu: LegacyMenu as React.FC,\n Item: LegacyMenu as React.FC,\n Section: LegacyMenu as React.FC\n })}\n </Plugins>\n );\n });\n /**\n * TODO Figure out correct types for the menus.\n */\n // @ts-expect-error\n setMenus(menuElements);\n }, []);\n\n return menus;\n};\n\ninterface NavigationProviderProps {\n children: React.ReactNode;\n}\n\nexport const NavigationProvider = (Component: React.ComponentType<unknown>) => {\n return function NavigationProvider({ children }: NavigationProviderProps) {\n const [menuItems, setState] = useState<MenuData[]>([]);\n\n const setMenu = (id: string, updater: MenuUpdater): void => {\n setState(state => {\n const index = state.findIndex(m => m.name === id);\n\n const newMenu = index > -1 ? updater(state[index]) : updater(createEmptyMenu(id));\n if (!newMenu) {\n return [...state];\n }\n if (!newMenu.children) {\n newMenu.children = [];\n }\n\n return index > -1\n ? [...state.slice(0, index), newMenu, ...state.slice(index + 1)]\n : [...state, newMenu];\n });\n };\n const removeMenu = useCallback(\n id => {\n setState(state => {\n const index = state.findIndex(m => m.name === id);\n\n if (index < 0) {\n return state;\n }\n\n return [...state.slice(0, index), ...state.slice(index + 1)];\n });\n },\n [setState]\n );\n\n const context = useMemo<NavigationContext>(\n () => ({\n menuItems,\n setMenu,\n removeMenu\n }),\n [menuItems, setMenu, removeMenu]\n );\n\n return (\n <NavigationContext.Provider value={context}>\n <LegacyMenuPlugins />\n <Component>{children}</Component>\n </NavigationContext.Provider>\n );\n };\n};\n\nexport const Navigation = () => {\n return (\n <Tags tags={{ location: \"navigation\" }}>\n <NavigationRenderer />\n </Tags>\n );\n};\n\nexport const NavigationRenderer = makeComposable(\"NavigationRenderer\");\n\ninterface MenuItemContext {\n menuItem?: MenuData;\n depth: number;\n}\n\nconst MenuItemContext = React.createContext<MenuItemContext>({\n menuItem: undefined,\n depth: -1\n});\nMenuItemContext.displayName = \"MenuItemContext\";\n\nexport function useMenuItem() {\n return React.useContext(MenuItemContext);\n}\n\nexport interface MenuItemsProps {\n menuItems: MenuData[];\n}\n\nexport const MenuItems = makeComposable<MenuItemsProps>(\"MenuItems\", ({ menuItems }) => {\n const menuItem = useMenuItem();\n\n const depth = menuItem ? menuItem.depth : -1;\n\n return (\n <Fragment>\n {menuItems.map(menuItem => (\n <MenuItemContext.Provider\n key={menuItem.name}\n value={{ menuItem, depth: depth + 1 }}\n >\n <MenuItem />\n </MenuItemContext.Provider>\n ))}\n </Fragment>\n );\n});\n\nexport const MenuItem = () => {\n return <MenuItemRenderer />;\n};\n\nexport const MenuItemRenderer = makeComposable(\"MenuItemRenderer\");\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAA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,MAAA,CAAAmF,QAAQ,QACJ1E,SAAS,CAAC6B,GAAG,CAAC,UAAAuC,QAAQ;IAAA,oBACnB7E,MAAA,CAAAiB,OAAA,CAAAC,aAAA,CAACyD,eAAe,CAACT,QAAQ;MACrBzB,GAAG,EAAEoC,QAAQ,CAACvD,IAAK;MACnB6C,KAAK,EAAE;QAAEU,QAAQ,EAARA,QAAQ;QAAEE,KAAK,EAAEA,KAAK,GAAG;MAAE;IAAE,gBAEtC/E,MAAA,CAAAiB,OAAA,CAAAC,aAAA,CAACkE,QAAQ,MAAE,CACW,CAAC;EAAA,CAC9B,CACK,CAAC;AAEnB,CAAC,CAAC;AAAChB,OAAA,CAAAa,SAAA,GAAAA,SAAA;AAEI,IAAMG,QAAQ,GAAG,SAAXA,QAAQA,CAAA,EAAS;EAC1B,oBAAOpF,MAAA,CAAAiB,OAAA,CAAAC,aAAA,CAACmE,gBAAgB,MAAE,CAAC;AAC/B,CAAC;AAACjB,OAAA,CAAAgB,QAAA,GAAAA,QAAA;AAEK,IAAMC,gBAAgB,GAAG,IAAAX,mBAAc,EAAC,kBAAkB,CAAC;AAACN,OAAA,CAAAiB,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_utils","_app","_","_plugins","NavigationContext","createContext","menuItems","setMenu","removeMenu","displayName","useNavigation","useContext","LegacyMenu","props","default","createElement","AddMenu","Object","assign","name","generateId","label","children","LegacyMenuPlugins","_useState","useState","_useState2","_slicedToArray2","menus","setMenus","useEffect","menuPlugins","plugins","byType","menuElements","map","plugin","Plugins","key","render","Menu","Item","Section","NavigationProvider","Component","_ref","_useState3","_useState4","setState","id","updater","state","index","findIndex","m","newMenu","createEmptyMenu","_toConsumableArray2","concat","slice","useCallback","context","useMemo","Provider","value","exports","Navigation","Tags","tags","location","NavigationRenderer","makeDecoratable","createVoidComponent","MenuItemContext","React","menuItem","undefined","depth","useMenuItem","MenuItems","_ref2","Fragment","MenuItem","MenuItemRenderer"],"sources":["Navigation.tsx"],"sourcesContent":["import React, {\n createContext,\n Fragment,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState\n} from \"react\";\nimport { generateId } from \"@webiny/utils\";\nimport { createVoidComponent, makeDecoratable, Plugins } from \"@webiny/app\";\nimport { AddMenu as Menu, createEmptyMenu, MenuData, MenuProps, MenuUpdater, Tags } from \"~/index\";\nimport { plugins } from \"@webiny/plugins\";\nimport { AdminMenuPlugin } from \"~/types\";\nimport { ItemProps, SectionProps } from \"~/plugins/MenuPlugin\";\n\nexport interface NavigationContext {\n menuItems: MenuData[];\n setMenu(id: string, update: MenuUpdater): void;\n removeMenu(id: string): void;\n}\n\nconst NavigationContext = createContext<NavigationContext>({\n menuItems: [],\n setMenu: () => {\n return void 0;\n },\n removeMenu: () => {\n return void 0;\n }\n});\nNavigationContext.displayName = \"NavigationContext\";\n\nexport function useNavigation() {\n return useContext(NavigationContext);\n}\n\ntype LegacyMenuProps = MenuProps | SectionProps | ItemProps;\n\n// IMPORTANT! The following component is for BACKWARDS COMPATIBILITY purposes only!\n// It is not a public component, and is not even exported from this file. We need it to take care of\n// scaffolded plugins in users' projects, as well as our own applications (Page Builder and Form Builder).\nconst LegacyMenu = (props: LegacyMenuProps & { children: React.ReactNode }) => {\n return (\n <Menu\n {...props}\n name={(props as MenuProps).name || generateId()}\n label={props.label as string}\n >\n {props.children}\n </Menu>\n );\n};\n\nconst LegacyMenuPlugins = () => {\n // IMPORTANT! The following piece of code is for BACKWARDS COMPATIBILITY purposes only!\n const [menus, setMenus] = useState<JSX.Element | null>(null);\n\n useEffect(() => {\n const menuPlugins = plugins.byType<AdminMenuPlugin>(\"admin-menu\");\n if (!menuPlugins) {\n return;\n }\n\n const menuElements = menuPlugins.map(plugin => {\n // TODO @ts-refactor figure out correct types or write a comment to leave as React.FC\n return (\n <Plugins key={plugin.name}>\n {plugin.render({\n Menu: LegacyMenu as React.FC,\n Item: LegacyMenu as React.FC,\n Section: LegacyMenu as React.FC\n })}\n </Plugins>\n );\n });\n /**\n * TODO Figure out correct types for the menus.\n */\n // @ts-expect-error\n setMenus(menuElements);\n }, []);\n\n return menus;\n};\n\ninterface NavigationProviderProps {\n children: React.ReactNode;\n}\n\nexport const NavigationProvider = (Component: React.ComponentType<unknown>) => {\n return function NavigationProvider({ children }: NavigationProviderProps) {\n const [menuItems, setState] = useState<MenuData[]>([]);\n\n const setMenu = (id: string, updater: MenuUpdater): void => {\n setState(state => {\n const index = state.findIndex(m => m.name === id);\n\n const newMenu = index > -1 ? updater(state[index]) : updater(createEmptyMenu(id));\n if (!newMenu) {\n return [...state];\n }\n if (!newMenu.children) {\n newMenu.children = [];\n }\n\n return index > -1\n ? [...state.slice(0, index), newMenu, ...state.slice(index + 1)]\n : [...state, newMenu];\n });\n };\n const removeMenu = useCallback(\n id => {\n setState(state => {\n const index = state.findIndex(m => m.name === id);\n\n if (index < 0) {\n return state;\n }\n\n return [...state.slice(0, index), ...state.slice(index + 1)];\n });\n },\n [setState]\n );\n\n const context = useMemo<NavigationContext>(\n () => ({\n menuItems,\n setMenu,\n removeMenu\n }),\n [menuItems, setMenu, removeMenu]\n );\n\n return (\n <NavigationContext.Provider value={context}>\n <LegacyMenuPlugins />\n <Component>{children}</Component>\n </NavigationContext.Provider>\n );\n };\n};\n\nexport const Navigation = () => {\n return (\n <Tags tags={{ location: \"navigation\" }}>\n <NavigationRenderer />\n </Tags>\n );\n};\n\nexport const NavigationRenderer = makeDecoratable(\"NavigationRenderer\", createVoidComponent());\n\ninterface MenuItemContext {\n menuItem?: MenuData;\n depth: number;\n}\n\nconst MenuItemContext = React.createContext<MenuItemContext>({\n menuItem: undefined,\n depth: -1\n});\nMenuItemContext.displayName = \"MenuItemContext\";\n\nexport function useMenuItem() {\n return React.useContext(MenuItemContext);\n}\n\nexport interface MenuItemsProps {\n menuItems: MenuData[];\n}\n\nexport const MenuItems = makeDecoratable(\"MenuItems\", ({ menuItems }: MenuItemsProps) => {\n const menuItem = useMenuItem();\n\n const depth = menuItem ? menuItem.depth : -1;\n\n return (\n <Fragment>\n {menuItems.map(menuItem => (\n <MenuItemContext.Provider\n key={menuItem.name}\n value={{ menuItem, depth: depth + 1 }}\n >\n <MenuItem />\n </MenuItemContext.Provider>\n ))}\n </Fragment>\n );\n});\n\nexport const MenuItem = () => {\n return <MenuItemRenderer />;\n};\n\nexport const MenuItemRenderer = makeDecoratable(\"MenuItemRenderer\", createVoidComponent());\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,CAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAUA,IAAMK,iBAAiB,gBAAG,IAAAC,oBAAa,EAAoB;EACvDC,SAAS,EAAE,EAAE;EACbC,OAAO,EAAE,SAAAA,QAAA,EAAM;IACX,OAAO,KAAK,CAAC;EACjB,CAAC;EACDC,UAAU,EAAE,SAAAA,WAAA,EAAM;IACd,OAAO,KAAK,CAAC;EACjB;AACJ,CAAC,CAAC;AACFJ,iBAAiB,CAACK,WAAW,GAAG,mBAAmB;AAE5C,SAASC,aAAaA,CAAA,EAAG;EAC5B,OAAO,IAAAC,iBAAU,EAACP,iBAAiB,CAAC;AACxC;AAIA;AACA;AACA;AACA,IAAMQ,UAAU,GAAG,SAAbA,UAAUA,CAAIC,KAAsD,EAAK;EAC3E,oBACIhB,MAAA,CAAAiB,OAAA,CAAAC,aAAA,CAACb,CAAA,CAAAc,OAAI,EAAAC,MAAA,CAAAC,MAAA,KACGL,KAAK;IACTM,IAAI,EAAGN,KAAK,CAAeM,IAAI,IAAI,IAAAC,iBAAU,EAAC,CAAE;IAChDC,KAAK,EAAER,KAAK,CAACQ;EAAgB,IAE5BR,KAAK,CAACS,QACL,CAAC;AAEf,CAAC;AAED,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAA,EAAS;EAC5B;EACA,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Component<unknown> & {
3
- original: React.ComponentType<unknown>;
4
- originalName: string;
5
- };
6
- export declare const NotFoundRenderer: React.FunctionComponent<unknown> & {
7
- original: React.ComponentType<unknown>;
8
- originalName: string;
9
- };
1
+ /// <reference types="react" />
2
+ export declare const NotFound: import("@webiny/app").DecoratableComponent<() => JSX.Element | null>;
3
+ export declare const NotFoundRenderer: import("@webiny/app").DecoratableComponent<(props: unknown) => JSX.Element | null>;
@@ -7,11 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.NotFoundRenderer = exports.NotFound = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _app = require("@webiny/app");
10
- var NotFound = (0, _app.makeComposable)("NotFound", function () {
10
+ var NotFound = (0, _app.makeDecoratable)("NotFound", function () {
11
11
  return /*#__PURE__*/_react.default.createElement(NotFoundRenderer, null);
12
12
  });
13
13
  exports.NotFound = NotFound;
14
- var NotFoundRenderer = (0, _app.makeComposable)("NotFoundRenderer");
14
+ var NotFoundRenderer = (0, _app.makeDecoratable)("NotFoundRenderer", (0, _app.createVoidComponent)());
15
15
  exports.NotFoundRenderer = NotFoundRenderer;
16
16
 
17
17
  //# sourceMappingURL=NotFound.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_app","NotFound","makeComposable","default","createElement","NotFoundRenderer","exports"],"sources":["NotFound.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeComposable } from \"@webiny/app\";\n\nexport const NotFound = makeComposable(\"NotFound\", () => {\n return <NotFoundRenderer />;\n});\n\nexport const NotFoundRenderer = makeComposable(\"NotFoundRenderer\");\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEO,IAAME,QAAQ,GAAG,IAAAC,mBAAc,EAAC,UAAU,EAAE,YAAM;EACrD,oBAAOL,MAAA,CAAAM,OAAA,CAAAC,aAAA,CAACC,gBAAgB,MAAE,CAAC;AAC/B,CAAC,CAAC;AAACC,OAAA,CAAAL,QAAA,GAAAA,QAAA;AAEI,IAAMI,gBAAgB,GAAG,IAAAH,mBAAc,EAAC,kBAAkB,CAAC;AAACI,OAAA,CAAAD,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_app","NotFound","makeDecoratable","default","createElement","NotFoundRenderer","exports","createVoidComponent"],"sources":["NotFound.tsx"],"sourcesContent":["import React from \"react\";\nimport { createVoidComponent, makeDecoratable } from \"@webiny/app\";\n\nexport const NotFound = makeDecoratable(\"NotFound\", () => {\n return <NotFoundRenderer />;\n});\n\nexport const NotFoundRenderer = makeDecoratable(\"NotFoundRenderer\", createVoidComponent());\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEO,IAAME,QAAQ,GAAG,IAAAC,oBAAe,EAAC,UAAU,EAAE,YAAM;EACtD,oBAAOL,MAAA,CAAAM,OAAA,CAAAC,aAAA,CAACC,gBAAgB,MAAE,CAAC;AAC/B,CAAC,CAAC;AAACC,OAAA,CAAAL,QAAA,GAAAA,QAAA;AAEI,IAAMI,gBAAgB,GAAG,IAAAH,oBAAe,EAAC,kBAAkB,EAAE,IAAAK,wBAAmB,EAAC,CAAC,CAAC;AAACD,OAAA,CAAAD,gBAAA,GAAAA,gBAAA"}
@@ -17,14 +17,8 @@ interface SearchProviderProps {
17
17
  [key: string]: any;
18
18
  }
19
19
  export declare const SearchProvider: (Component: React.ComponentType) => ({ children, ...props }: SearchProviderProps) => JSX.Element;
20
- export declare const Search: React.FunctionComponent<unknown> & {
21
- original: React.ComponentType<unknown>;
22
- originalName: string;
23
- };
24
- export declare const SearchRenderer: React.FunctionComponent<unknown> & {
25
- original: React.ComponentType<unknown>;
26
- originalName: string;
27
- };
20
+ export declare const Search: import("@webiny/app").DecoratableComponent<() => JSX.Element | null>;
21
+ export declare const SearchRenderer: import("@webiny/app").DecoratableComponent<(props: unknown) => JSX.Element | null>;
28
22
  export declare type SearchOptionProps = SearchOptionData;
29
23
  export declare const SearchOption: (props: SearchOptionProps) => null;
30
24
  export {};
package/base/ui/Search.js CHANGED
@@ -46,11 +46,11 @@ var SearchProvider = function SearchProvider(Component) {
46
46
  };
47
47
  };
48
48
  exports.SearchProvider = SearchProvider;
49
- var Search = (0, _app.makeComposable)("Search", function () {
49
+ var Search = (0, _app.makeDecoratable)("Search", function () {
50
50
  return /*#__PURE__*/_react.default.createElement(SearchRenderer, null);
51
51
  });
52
52
  exports.Search = Search;
53
- var SearchRenderer = (0, _app.makeComposable)("SearchRenderer");
53
+ var SearchRenderer = (0, _app.makeDecoratable)("SearchRenderer", (0, _app.createVoidComponent)());
54
54
  exports.SearchRenderer = SearchRenderer;
55
55
  var SearchOption = function SearchOption(props) {
56
56
  var _useSearch = useSearch(),
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_app","_excluded","SearchContext","React","createContext","options","addOption","displayName","useSearch","useContext","SearchProvider","Component","_ref","children","props","_objectWithoutProperties2","default","_useState","useState","_useState2","_slicedToArray2","setOptions","useCallback","option","concat","_toConsumableArray2","context","createElement","Provider","value","exports","Search","makeComposable","SearchRenderer","SearchOption","_useSearch","useEffect"],"sources":["Search.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from \"react\";\nimport { makeComposable } from \"@webiny/app\";\n\nexport interface SearchOptionData {\n route: string;\n label: string;\n search?: {\n operator?: \"and\" | \"or\";\n fields?: Array<string>;\n };\n}\n\nexport interface SearchContext {\n options: SearchOptionData[];\n addOption(option: SearchOptionData): void;\n}\n\nconst SearchContext = React.createContext<SearchContext>({\n options: [],\n addOption: () => {\n return void 0;\n }\n});\nSearchContext.displayName = \"SearchContext\";\n\nexport function useSearch() {\n return React.useContext(SearchContext);\n}\n\ninterface SearchProviderProps {\n children: React.ReactNode;\n [key: string]: any;\n}\n\nexport const SearchProvider = (Component: React.ComponentType) => {\n return function SearchProvider({ children, ...props }: SearchProviderProps) {\n const [options, setOptions] = useState<SearchOptionData[]>([]);\n\n const addOption = useCallback<SearchContext[\"addOption\"]>(\n option => setOptions(options => [...options, option]),\n [setOptions]\n );\n\n const context = {\n options,\n addOption\n };\n\n return (\n <SearchContext.Provider value={context}>\n <Component {...props}>{children}</Component>\n </SearchContext.Provider>\n );\n };\n};\n\nexport const Search = makeComposable(\"Search\", () => {\n return <SearchRenderer />;\n});\n\nexport const SearchRenderer = makeComposable(\"SearchRenderer\");\n\nexport type SearchOptionProps = SearchOptionData;\n\nexport const SearchOption = (props: SearchOptionProps) => {\n const { addOption } = useSearch();\n\n useEffect(() => {\n addOption(props);\n }, []);\n\n return null;\n};\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAA6C,IAAAE,SAAA;AAgB7C,IAAMC,aAAa,gBAAGC,cAAK,CAACC,aAAa,CAAgB;EACrDC,OAAO,EAAE,EAAE;EACXC,SAAS,EAAE,SAAAA,UAAA,EAAM;IACb,OAAO,KAAK,CAAC;EACjB;AACJ,CAAC,CAAC;AACFJ,aAAa,CAACK,WAAW,GAAG,eAAe;AAEpC,SAASC,SAASA,CAAA,EAAG;EACxB,OAAOL,cAAK,CAACM,UAAU,CAACP,aAAa,CAAC;AAC1C;AAOO,IAAMQ,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,SAA8B,EAAK;EAC9D,OAAO,SAASD,cAAcA,CAAAE,IAAA,EAA8C;IAAA,IAA3CC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;MAAKC,KAAK,OAAAC,yBAAA,CAAAC,OAAA,EAAAJ,IAAA,EAAAX,SAAA;IAC/C,IAAAgB,SAAA,GAA8B,IAAAC,eAAQ,EAAqB,EAAE,CAAC;MAAAC,UAAA,OAAAC,eAAA,CAAAJ,OAAA,EAAAC,SAAA;MAAvDZ,OAAO,GAAAc,UA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"names":["_react","_interopRequireWildcard","require","_app","_excluded","SearchContext","React","createContext","options","addOption","displayName","useSearch","useContext","SearchProvider","Component","_ref","children","props","_objectWithoutProperties2","default","_useState","useState","_useState2","_slicedToArray2","setOptions","useCallback","option","concat","_toConsumableArray2","context","createElement","Provider","value","exports","Search","makeDecoratable","SearchRenderer","createVoidComponent","SearchOption","_useSearch","useEffect"],"sources":["Search.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from \"react\";\nimport { createVoidComponent, makeDecoratable } from \"@webiny/app\";\n\nexport interface SearchOptionData {\n route: string;\n label: string;\n search?: {\n operator?: \"and\" | \"or\";\n fields?: Array<string>;\n };\n}\n\nexport interface SearchContext {\n options: SearchOptionData[];\n addOption(option: SearchOptionData): void;\n}\n\nconst SearchContext = React.createContext<SearchContext>({\n options: [],\n addOption: () => {\n return void 0;\n }\n});\nSearchContext.displayName = \"SearchContext\";\n\nexport function useSearch() {\n return React.useContext(SearchContext);\n}\n\ninterface SearchProviderProps {\n children: React.ReactNode;\n [key: string]: any;\n}\n\nexport const SearchProvider = (Component: React.ComponentType) => {\n return function SearchProvider({ children, ...props }: SearchProviderProps) {\n const [options, setOptions] = useState<SearchOptionData[]>([]);\n\n const addOption = useCallback<SearchContext[\"addOption\"]>(\n option => setOptions(options => [...options, option]),\n [setOptions]\n );\n\n const context = {\n options,\n addOption\n };\n\n return (\n <SearchContext.Provider value={context}>\n <Component {...props}>{children}</Component>\n </SearchContext.Provider>\n );\n };\n};\n\nexport const Search = makeDecoratable(\"Search\", () => {\n return <SearchRenderer />;\n});\n\nexport const SearchRenderer = makeDecoratable(\"SearchRenderer\", createVoidComponent());\n\nexport type SearchOptionProps = SearchOptionData;\n\nexport const SearchOption = (props: SearchOptionProps) => {\n const { addOption } = useSearch();\n\n useEffect(() => {\n addOption(props);\n }, []);\n\n return null;\n};\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,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EjC,CAAC;AACL,CAAC;AAACiB,OAAA,CAAApB,cAAA,GAAAA,cAAA;AAEK,IAAMqB,MAAM,GAAG,IAAAC,oBAAe,EAAC,QAAQ,EAAE,YAAM;EAClD,oBAAOnC,MAAA,CAAAmB,OAAA,CAAAW,aAAA,CAACM,cAAc,MAAE,CAAC;AAC7B,CAAC,CAAC;AAACH,OAAA,CAAAC,MAAA,GAAAA,MAAA;AAEI,IAAME,cAAc,GAAG,IAAAD,oBAAe,EAAC,gBAAgB,EAAE,IAAAE,wBAAmB,EAAC,CAAC,CAAC;AAACJ,OAAA,CAAAG,cAAA,GAAAA,cAAA;AAIhF,IAAME,YAAY,GAAG,SAAfA,YAAYA,CAAIrB,KAAwB,EAAK;EACtD,IAAAsB,UAAA,GAAsB5B,SAAS,CAAC,CAAC;IAAzBF,SAAS,GAAA8B,UAAA,CAAT9B,SAAS;EAEjB,IAAA+B,gBAAS,EAAC,YAAM;IACZ/B,SAAS,CAACQ,KAAK,CAAC;EACpB,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACf,CAAC;AAACgB,OAAA,CAAAK,YAAA,GAAAA,YAAA"}
@@ -16,41 +16,20 @@ interface UserMenuProviderProps {
16
16
  [key: string]: any;
17
17
  }
18
18
  export declare const UserMenuProvider: (Component: React.ComponentType) => ({ children, ...props }: UserMenuProviderProps) => JSX.Element;
19
- export declare const UserMenu: React.FunctionComponent<unknown> & {
20
- original: React.ComponentType<unknown>;
21
- originalName: string;
22
- };
23
- export declare const UserMenuRenderer: React.FunctionComponent<unknown> & {
24
- original: React.ComponentType<unknown>;
25
- originalName: string;
26
- };
27
- export declare const UserMenuHandle: React.FunctionComponent<unknown> & {
28
- original: React.ComponentType<unknown>;
29
- originalName: string;
30
- };
31
- export declare const UserMenuHandleRenderer: React.FunctionComponent<unknown> & {
32
- original: React.ComponentType<unknown>;
33
- originalName: string;
34
- };
19
+ export declare const UserMenu: import("@webiny/app").DecoratableComponent<() => JSX.Element | null>;
20
+ export declare const UserMenuRenderer: import("@webiny/app").DecoratableComponent<(props: unknown) => JSX.Element | null>;
21
+ export declare const UserMenuHandle: import("@webiny/app").DecoratableComponent<() => JSX.Element | null>;
22
+ export declare const UserMenuHandleRenderer: import("@webiny/app").DecoratableComponent<(props: unknown) => JSX.Element | null>;
35
23
  export interface UserMenuItemProps {
36
24
  menuItem: UserMenuItemData;
37
25
  }
38
- export declare const UserMenuItem: React.FunctionComponent<UserMenuItemProps> & {
39
- original: React.ComponentType<UserMenuItemProps>;
40
- originalName: string;
41
- };
42
- export declare const UserMenuItemRenderer: React.FunctionComponent<unknown> & {
43
- original: React.ComponentType<unknown>;
44
- originalName: string;
45
- };
26
+ export declare const UserMenuItem: import("@webiny/app").DecoratableComponent<(args_0: UserMenuItemProps) => JSX.Element | null>;
27
+ export declare const UserMenuItemRenderer: import("@webiny/app").DecoratableComponent<(props: unknown) => JSX.Element | null>;
46
28
  export declare const AddUserMenuItem: (props: UserMenuItemProps["menuItem"]) => null;
47
29
  export declare type UserMenuItemContext = UserMenuItemData;
48
30
  export declare function useUserMenuItem(): UserMenuItemData;
49
31
  export interface UserMenuItemsProps {
50
32
  menuItems: UserMenuItemData[];
51
33
  }
52
- export declare const UserMenuItems: React.FunctionComponent<UserMenuItemsProps> & {
53
- original: React.ComponentType<UserMenuItemsProps>;
54
- originalName: string;
55
- };
34
+ export declare const UserMenuItems: import("@webiny/app").DecoratableComponent<(args_0: UserMenuItemsProps) => JSX.Element | null>;
56
35
  export {};
@@ -58,26 +58,26 @@ var UserMenuProvider = function UserMenuProvider(Component) {
58
58
  };
59
59
  };
60
60
  exports.UserMenuProvider = UserMenuProvider;
61
- var UserMenu = (0, _app.makeComposable)("UserMenu", function () {
61
+ var UserMenu = (0, _app.makeDecoratable)("UserMenu", function () {
62
62
  return /*#__PURE__*/_react.default.createElement(UserMenuRenderer, null);
63
63
  });
64
64
  exports.UserMenu = UserMenu;
65
- var UserMenuRenderer = (0, _app.makeComposable)("UserMenuRenderer");
65
+ var UserMenuRenderer = (0, _app.makeDecoratable)("UserMenuRenderer", (0, _app.createVoidComponent)());
66
66
  exports.UserMenuRenderer = UserMenuRenderer;
67
- var UserMenuHandle = (0, _app.makeComposable)("UserMenuHandle", function () {
67
+ var UserMenuHandle = (0, _app.makeDecoratable)("UserMenuHandle", function () {
68
68
  return /*#__PURE__*/_react.default.createElement(UserMenuHandleRenderer, null);
69
69
  });
70
70
  exports.UserMenuHandle = UserMenuHandle;
71
- var UserMenuHandleRenderer = (0, _app.makeComposable)("UserMenuHandleRenderer");
71
+ var UserMenuHandleRenderer = (0, _app.makeDecoratable)("UserMenuHandleRenderer", (0, _app.createVoidComponent)());
72
72
  exports.UserMenuHandleRenderer = UserMenuHandleRenderer;
73
- var UserMenuItem = (0, _app.makeComposable)("UserMenuItem", function (_ref2) {
73
+ var UserMenuItem = (0, _app.makeDecoratable)("UserMenuItem", function (_ref2) {
74
74
  var menuItem = _ref2.menuItem;
75
75
  return /*#__PURE__*/_react.default.createElement(UserMenuItemContext.Provider, {
76
76
  value: menuItem
77
77
  }, /*#__PURE__*/_react.default.createElement(UserMenuItemRenderer, null));
78
78
  });
79
79
  exports.UserMenuItem = UserMenuItem;
80
- var UserMenuItemRenderer = (0, _app.makeComposable)("UserMenuItemRenderer");
80
+ var UserMenuItemRenderer = (0, _app.makeDecoratable)("UserMenuItemRenderer", (0, _app.createVoidComponent)());
81
81
  exports.UserMenuItemRenderer = UserMenuItemRenderer;
82
82
  var AddUserMenuItem = function AddUserMenuItem(props) {
83
83
  var _useUserMenu = useUserMenu(),
@@ -101,7 +101,7 @@ UserMenuItemContext.displayName = "UserMenuItemContext";
101
101
  function useUserMenuItem() {
102
102
  return _react.default.useContext(UserMenuItemContext);
103
103
  }
104
- var UserMenuItems = (0, _app.makeComposable)("UserMenuItems", function (_ref3) {
104
+ var UserMenuItems = (0, _app.makeDecoratable)("UserMenuItems", function (_ref3) {
105
105
  var menuItems = _ref3.menuItems;
106
106
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, menuItems.map(function (item, index) {
107
107
  return /*#__PURE__*/_react.default.createElement(UserMenuItem, {
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_app","_excluded","UserMenuContext","React","createContext","addMenuItem","menuItems","displayName","useUserMenu","useContext","UserMenuProvider","Component","_ref","children","props","_objectWithoutProperties2","default","_useState","useState","_useState2","_slicedToArray2","setItems","useCallback","item","items","concat","_toConsumableArray2","index","findIndex","i","slice","context","createElement","Provider","value","exports","UserMenu","makeComposable","UserMenuRenderer","UserMenuHandle","UserMenuHandleRenderer","UserMenuItem","_ref2","menuItem","UserMenuItemContext","UserMenuItemRenderer","AddUserMenuItem","_useUserMenu","useEffect","element","undefined","icon","label","onClick","path","useUserMenuItem","UserMenuItems","_ref3","Fragment","map","key"],"sources":["UserMenu.tsx"],"sourcesContent":["import React, { Fragment, useCallback, useEffect, useState } from \"react\";\nimport { makeComposable } from \"@webiny/app\";\n\nexport interface UserMenuItemData {\n label?: string;\n icon?: JSX.Element;\n path?: string;\n onClick?: () => void;\n element?: JSX.Element;\n}\n\nexport interface UserMenuContext {\n menuItems: UserMenuItemData[];\n addMenuItem(item: UserMenuItemData): void;\n}\n\nconst UserMenuContext = React.createContext<UserMenuContext>({\n addMenuItem: () => {\n return void 0;\n },\n menuItems: []\n});\nUserMenuContext.displayName = \"UserMenuContext\";\n\nexport function useUserMenu() {\n return React.useContext(UserMenuContext);\n}\n\ninterface UserMenuProviderProps {\n children: React.ReactNode;\n [key: string]: any;\n}\n\nexport const UserMenuProvider = (Component: React.ComponentType) => {\n return function UserMenuProvider({ children, ...props }: UserMenuProviderProps) {\n const [menuItems, setItems] = useState<UserMenuItemData[]>([]);\n\n const addMenuItem = useCallback<UserMenuContext[\"addMenuItem\"]>(\n item => {\n setItems(items => [...items, item]);\n\n return () => {\n setItems(items => {\n const index = items.findIndex(i => i === item);\n if (index < 0) {\n return items;\n }\n\n return [...items.slice(0, index), ...items.slice(index + 1)];\n });\n };\n },\n [setItems]\n );\n\n const context = {\n menuItems,\n addMenuItem\n };\n\n return (\n <UserMenuContext.Provider value={context}>\n <Component {...props}>{children}</Component>\n </UserMenuContext.Provider>\n );\n };\n};\n\nexport const UserMenu = makeComposable(\"UserMenu\", () => {\n return <UserMenuRenderer />;\n});\n\nexport const UserMenuRenderer = makeComposable(\"UserMenuRenderer\");\n\nexport const UserMenuHandle = makeComposable(\"UserMenuHandle\", () => {\n return <UserMenuHandleRenderer />;\n});\n\nexport const UserMenuHandleRenderer = makeComposable(\"UserMenuHandleRenderer\");\n\nexport interface UserMenuItemProps {\n menuItem: UserMenuItemData;\n}\n\nexport const UserMenuItem = makeComposable<UserMenuItemProps>(\"UserMenuItem\", ({ menuItem }) => {\n return (\n <UserMenuItemContext.Provider value={menuItem}>\n <UserMenuItemRenderer />\n </UserMenuItemContext.Provider>\n );\n});\n\nexport const UserMenuItemRenderer = makeComposable(\"UserMenuItemRenderer\");\n\nexport const AddUserMenuItem = (props: UserMenuItemProps[\"menuItem\"]) => {\n const { addMenuItem } = useUserMenu();\n\n useEffect(() => {\n return addMenuItem(props);\n }, []);\n\n return null;\n};\n\nexport type UserMenuItemContext = UserMenuItemData;\n\nconst UserMenuItemContext = React.createContext<UserMenuItemContext>({\n element: undefined,\n icon: undefined,\n label: undefined,\n onClick: () => {\n return void 0;\n },\n path: undefined\n});\nUserMenuItemContext.displayName = \"UserMenuItemContext\";\n\nexport function useUserMenuItem() {\n return React.useContext(UserMenuItemContext);\n}\n\nexport interface UserMenuItemsProps {\n menuItems: UserMenuItemData[];\n}\n\nexport const UserMenuItems = makeComposable<UserMenuItemsProps>(\n \"UserMenuItems\",\n ({ menuItems }) => {\n return (\n <Fragment>\n {menuItems.map((item, index) => (\n <UserMenuItem key={index} menuItem={item} />\n ))}\n </Fragment>\n );\n }\n);\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAA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A,CAAAgB,aAAA,CAACnC,MAAA,CAAA6D,QAAQ,QACJpD,SAAS,CAACqD,GAAG,CAAC,UAACpC,IAAI,EAAEI,KAAK;IAAA,oBACvB9B,MAAA,CAAAmB,OAAA,CAAAgB,aAAA,CAACS,YAAY;MAACmB,GAAG,EAAEjC,KAAM;MAACgB,QAAQ,EAAEpB;IAAK,CAAE,CAAC;EAAA,CAC/C,CACK,CAAC;AAEnB,CACJ,CAAC;AAACY,OAAA,CAAAqB,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_app","_excluded","UserMenuContext","React","createContext","addMenuItem","menuItems","displayName","useUserMenu","useContext","UserMenuProvider","Component","_ref","children","props","_objectWithoutProperties2","default","_useState","useState","_useState2","_slicedToArray2","setItems","useCallback","item","items","concat","_toConsumableArray2","index","findIndex","i","slice","context","createElement","Provider","value","exports","UserMenu","makeDecoratable","UserMenuRenderer","createVoidComponent","UserMenuHandle","UserMenuHandleRenderer","UserMenuItem","_ref2","menuItem","UserMenuItemContext","UserMenuItemRenderer","AddUserMenuItem","_useUserMenu","useEffect","element","undefined","icon","label","onClick","path","useUserMenuItem","UserMenuItems","_ref3","Fragment","map","key"],"sources":["UserMenu.tsx"],"sourcesContent":["import React, { Fragment, useCallback, useEffect, useState } from \"react\";\nimport { createVoidComponent, makeDecoratable } from \"@webiny/app\";\n\nexport interface UserMenuItemData {\n label?: string;\n icon?: JSX.Element;\n path?: string;\n onClick?: () => void;\n element?: JSX.Element;\n}\n\nexport interface UserMenuContext {\n menuItems: UserMenuItemData[];\n addMenuItem(item: UserMenuItemData): void;\n}\n\nconst UserMenuContext = React.createContext<UserMenuContext>({\n addMenuItem: () => {\n return void 0;\n },\n menuItems: []\n});\nUserMenuContext.displayName = \"UserMenuContext\";\n\nexport function useUserMenu() {\n return React.useContext(UserMenuContext);\n}\n\ninterface UserMenuProviderProps {\n children: React.ReactNode;\n [key: string]: any;\n}\n\nexport const UserMenuProvider = (Component: React.ComponentType) => {\n return function UserMenuProvider({ children, ...props }: UserMenuProviderProps) {\n const [menuItems, setItems] = useState<UserMenuItemData[]>([]);\n\n const addMenuItem = useCallback<UserMenuContext[\"addMenuItem\"]>(\n item => {\n setItems(items => [...items, item]);\n\n return () => {\n setItems(items => {\n const index = items.findIndex(i => i === item);\n if (index < 0) {\n return items;\n }\n\n return [...items.slice(0, index), ...items.slice(index + 1)];\n });\n };\n },\n [setItems]\n );\n\n const context = {\n menuItems,\n addMenuItem\n };\n\n return (\n <UserMenuContext.Provider value={context}>\n <Component {...props}>{children}</Component>\n </UserMenuContext.Provider>\n );\n };\n};\n\nexport const UserMenu = makeDecoratable(\"UserMenu\", () => {\n return <UserMenuRenderer />;\n});\n\nexport const UserMenuRenderer = makeDecoratable(\"UserMenuRenderer\", createVoidComponent());\n\nexport const UserMenuHandle = makeDecoratable(\"UserMenuHandle\", () => {\n return <UserMenuHandleRenderer />;\n});\n\nexport const UserMenuHandleRenderer = makeDecoratable(\n \"UserMenuHandleRenderer\",\n createVoidComponent()\n);\n\nexport interface UserMenuItemProps {\n menuItem: UserMenuItemData;\n}\n\nexport const UserMenuItem = makeDecoratable(\"UserMenuItem\", ({ menuItem }: UserMenuItemProps) => {\n return (\n <UserMenuItemContext.Provider value={menuItem}>\n <UserMenuItemRenderer />\n </UserMenuItemContext.Provider>\n );\n});\n\nexport const UserMenuItemRenderer = makeDecoratable(\"UserMenuItemRenderer\", createVoidComponent());\n\nexport const AddUserMenuItem = (props: UserMenuItemProps[\"menuItem\"]) => {\n const { addMenuItem } = useUserMenu();\n\n useEffect(() => {\n return addMenuItem(props);\n }, []);\n\n return null;\n};\n\nexport type UserMenuItemContext = UserMenuItemData;\n\nconst UserMenuItemContext = React.createContext<UserMenuItemContext>({\n element: undefined,\n icon: undefined,\n label: undefined,\n onClick: () => {\n return void 0;\n },\n path: undefined\n});\nUserMenuItemContext.displayName = \"UserMenuItemContext\";\n\nexport function useUserMenuItem() {\n return React.useContext(UserMenuItemContext);\n}\n\nexport interface UserMenuItemsProps {\n menuItems: UserMenuItemData[];\n}\n\nexport const UserMenuItems = makeDecoratable(\n \"UserMenuItems\",\n ({ menuItems }: UserMenuItemsProps) => {\n return (\n <Fragment>\n {menuItems.map((item, index) => (\n <UserMenuItem key={index} menuItem={item} />\n ))}\n </Fragment>\n );\n }\n);\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAAmE,IAAAE,SAAA;AAenE,IAAMC,eAAe,gBAAGC,cAAK,CAACC,aAAa,CAAkB;EACzDC,WAAW,EAAE,SAAAA,YAAA,EAAM;IACf,OAAO,KAAK,CAAC;EACjB,CAAC;EACDC,SAAS,EAAE;AACf,CAAC,CAAC;AACFJ,eAAe,CAACK,WAAW,GAAG,iBAAiB;AAExC,SAASC,WAAWA,CAAA,EAAG;EAC1B,OAAOL,cAAK,CAACM,UAAU,CAACP,eAAe,CAAC;AAC5C;AAOO,IAAMQ,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,SAA8B,EAAK;EAChE,OAAO,SAASD,gBAAgBA,CAAAE,IAAA,EAAgD;IAAA,IAA7CC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;MAAKC,KAAK,OAAAC,yBAAA,CAAAC,OAAA,EAAAJ,IAAA,EAAAX,SAAA;IACjD,IAAAgB,SAAA,GAA8B,IAAAC,eAAQ,EAAqB,EAAE,CAAC;MAAAC,UAAA,OAAAC,eAAA,CAAAJ,OAAA,EAAAC,SAAA;MAAvDX,SAAS,GAAAa,UAAA;MAAEE,QAAQ,GAAAF,UAAA;IAE1B,IAAMd,WAAW,GAAG,IAAAiB,kBAAW,EAC3B,UAAAC,IAAI,EAAI;MACJF,QAAQ,CAAC,UAAAG,KAAK;QAAA,UAAAC,MAAA,KAAAC,mBAAA,CAAAV,OAAA,EAAQQ,KAAK,IAAED,IAAI;MAAA,CAAC,CAAC;MAEnC,OAAO,Y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ChBG,OAAO,EAAE,SAAAA,QAAA,EAAM;IACX,OAAO,KAAK,CAAC;EACjB,CAAC;EACDC,IAAI,EAAEJ;AACV,CAAC,CAAC;AACFN,mBAAmB,CAACtC,WAAW,GAAG,qBAAqB;AAEhD,SAASiD,eAAeA,CAAA,EAAG;EAC9B,OAAOrD,cAAK,CAACM,UAAU,CAACoC,mBAAmB,CAAC;AAChD;AAMO,IAAMY,aAAa,GAAG,IAAApB,oBAAe,EACxC,eAAe,EACf,UAAAqB,KAAA,EAAuC;EAAA,IAApCpD,SAAS,GAAAoD,KAAA,CAATpD,SAAS;EACR,oBACIT,MAAA,CAAAmB,OAAA,CAAAgB,aAAA,CAACnC,MAAA,CAAA8D,QAAQ,QACJrD,SAAS,CAACsD,GAAG,CAAC,UAACrC,IAAI,EAAEI,KAAK;IAAA,oBACvB9B,MAAA,CAAAmB,OAAA,CAAAgB,aAAA,CAACU,YAAY;MAACmB,GAAG,EAAElC,KAAM;MAACiB,QAAQ,EAAErB;IAAK,CAAE,CAAC;EAAA,CAC/C,CACK,CAAC;AAEnB,CACJ,CAAC;AAACY,OAAA,CAAAsB,aAAA,GAAAA,aAAA"}
@@ -18,7 +18,7 @@ export declare const Menu: import("@emotion/styled").StyledComponent<Pick<import
18
18
  onOpen?: (() => void) | undefined;
19
19
  onClose?: (() => void) | undefined;
20
20
  "data-testid"?: string | undefined;
21
- }, "anchor" | "className" | "disabled" | "data-testid" | "handle" | keyof import("@rmwc/menu").MenuProps>> & Partial<Pick<Partial<import("@rmwc/menu").MenuProps & {
21
+ }, "anchor" | "className" | "disabled" | "data-testid" | keyof import("@rmwc/menu").MenuProps | "handle">> & Partial<Pick<Partial<import("@rmwc/menu").MenuProps & {
22
22
  children: import("react").ReactNode;
23
23
  handle?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
24
24
  anchor?: "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "bottomEnd" | "bottomStart" | "topEnd" | "topStart" | undefined;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ export declare type CreateGenericContext<T = any> = T;
3
+ declare type GenericContextProviderProps<T> = T & {
4
+ children: React.ReactNode;
5
+ };
6
+ export declare function createGenericContext<T>(name: string): {
7
+ Provider: {
8
+ ({ children, ...props }: GenericContextProviderProps<T>): JSX.Element;
9
+ displayName: string;
10
+ };
11
+ useHook: () => T;
12
+ };
13
+ export {};
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.createGenericContext = createGenericContext;
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _excluded = ["children"];
12
+ function createGenericContext(name) {
13
+ var GenericContext = /*#__PURE__*/(0, _react.createContext)(undefined);
14
+ function Provider(_ref) {
15
+ var children = _ref.children,
16
+ props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
17
+ return /*#__PURE__*/_react.default.createElement(GenericContext.Provider, {
18
+ value: props
19
+ }, children);
20
+ }
21
+ Provider.displayName = "".concat(name, "Provider");
22
+ return {
23
+ Provider: Provider,
24
+ useHook: function useHook() {
25
+ var context = _react.default.useContext(GenericContext);
26
+ if (!context) {
27
+ throw Error("Context provider for \"".concat(name, "\" is missing in the component tree!"));
28
+ }
29
+ return context;
30
+ }
31
+ };
32
+ }
33
+
34
+ //# sourceMappingURL=createGenericContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_excluded","createGenericContext","name","GenericContext","createContext","undefined","Provider","_ref","children","props","_objectWithoutProperties2","default","createElement","value","displayName","concat","useHook","context","React","useContext","Error"],"sources":["createGenericContext.tsx"],"sourcesContent":["import React, { createContext } from \"react\";\n\nexport type CreateGenericContext<T = any> = T;\n\ntype GenericContextProviderProps<T> = T & {\n children: React.ReactNode;\n};\n\nexport function createGenericContext<T>(name: string) {\n const GenericContext = createContext<CreateGenericContext | undefined>(undefined);\n\n function Provider({ children, ...props }: GenericContextProviderProps<T>) {\n return <GenericContext.Provider value={props}>{children}</GenericContext.Provider>;\n }\n\n Provider.displayName = `${name}Provider`;\n\n return {\n Provider,\n useHook: () => {\n const context = React.useContext<CreateGenericContext<T>>(\n GenericContext as unknown as React.Context<CreateGenericContext<T>>\n );\n\n if (!context) {\n throw Error(`Context provider for \"${name}\" is missing in the component tree!`);\n }\n\n return context;\n }\n };\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA6C,IAAAC,SAAA;AAQtC,SAASC,oBAAoBA,CAAIC,IAAY,EAAE;EAClD,IAAMC,cAAc,gBAAG,IAAAC,oBAAa,EAAmCC,SAAS,CAAC;EAEjF,SAASC,QAAQA,CAAAC,IAAA,EAAyD;IAAA,IAAtDC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;MAAKC,KAAK,OAAAC,yBAAA,CAAAC,OAAA,EAAAJ,IAAA,EAAAP,SAAA;IAClC,oBAAOH,MAAA,CAAAc,OAAA,CAAAC,aAAA,CAACT,cAAc,CAACG,QAAQ;MAACO,KAAK,EAAEJ;IAAM,GAAED,QAAkC,CAAC;EACtF;EAEAF,QAAQ,CAACQ,WAAW,MAAAC,MAAA,CAAMb,IAAI,aAAU;EAExC,OAAO;IACHI,QAAQ,EAARA,QAAQ;IACRU,OAAO,EAAE,SAAAA,QAAA,EAAM;MACX,IAAMC,OAAO,GAAGC,cAAK,CAACC,UAAU,CAC5BhB,cACJ,CAAC;MAED,IAAI,CAACc,OAAO,EAAE;QACV,MAAMG,KAAK,2BAAAL,MAAA,CAA0Bb,IAAI,yCAAqC,CAAC;MACnF;MAEA,OAAOe,OAAO;IAClB;EACJ,CAAC;AACL"}
package/hooks/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export * from "./useKeyHandler";
5
5
  export * from "./useShiftKey";
6
6
  export * from "./useModKey";
7
7
  export * from "./useIsMounted";
8
+ export * from "./createGenericContext";
package/hooks/index.js CHANGED
@@ -80,5 +80,16 @@ Object.keys(_useIsMounted).forEach(function (key) {
80
80
  }
81
81
  });
82
82
  });
83
+ var _createGenericContext = require("./createGenericContext");
84
+ Object.keys(_createGenericContext).forEach(function (key) {
85
+ if (key === "default" || key === "__esModule") return;
86
+ if (key in exports && exports[key] === _createGenericContext[key]) return;
87
+ Object.defineProperty(exports, key, {
88
+ enumerable: true,
89
+ get: function get() {
90
+ return _createGenericContext[key];
91
+ }
92
+ });
93
+ });
83
94
 
84
95
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_useConfirmationDialog","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_useDialog","_useSnackbar","_useKeyHandler","_useShiftKey","_useModKey","_useIsMounted"],"sources":["index.ts"],"sourcesContent":["export * from \"./useConfirmationDialog\";\nexport * from \"./useDialog\";\nexport * from \"./useSnackbar\";\nexport * from \"./useKeyHandler\";\nexport * from \"./useShiftKey\";\nexport * from \"./useModKey\";\nexport * from \"./useIsMounted\";\n"],"mappings":";;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,sBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,sBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAT,sBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,UAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,UAAA,EAAAN,OAAA,W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AK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAI,YAAA,CAAAR,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,UAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,UAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAS,UAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAK,UAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,aAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,aAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAU,aAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAM,aAAA,CAAAV,GAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":["_useConfirmationDialog","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_useDialog","_useSnackbar","_useKeyHandler","_useShiftKey","_useModKey","_useIsMounted","_createGenericContext"],"sources":["index.ts"],"sourcesContent":["export * from \"./useConfirmationDialog\";\nexport * from \"./useDialog\";\nexport * from \"./useSnackbar\";\nexport * from \"./useKeyHandler\";\nexport * from \"./useShiftKey\";\nexport * from \"./useModKey\";\nexport * from \"./useIsMounted\";\nexport * from \"./createGenericContext\";\n"],"mappings":";;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAA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;EAAA;AAAA;AACA,IAAAW,qBAAA,GAAAf,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAa,qBAAA,EAAAZ,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAW,qBAAA,CAAAX,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAO,qBAAA,CAAAX,GAAA;IAAA;EAAA;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/app-admin",
3
- "version": "5.39.0",
3
+ "version": "5.39.1-beta.1",
4
4
  "main": "index.js",
5
5
  "description": "A collection of plugins that together form a complete admin interface, customizable and extensible with Webiny apps and plugins.",
6
6
  "repository": {
@@ -20,20 +20,20 @@
20
20
  "@svgr/webpack": "6.5.1",
21
21
  "@types/mime": "2.0.3",
22
22
  "@types/react": "17.0.39",
23
- "@webiny/app": "5.39.0",
24
- "@webiny/app-security": "5.39.0",
25
- "@webiny/app-theme": "5.39.0",
26
- "@webiny/app-wcp": "5.39.0",
27
- "@webiny/form": "5.39.0",
28
- "@webiny/lexical-editor": "5.39.0",
29
- "@webiny/plugins": "5.39.0",
30
- "@webiny/react-composition": "5.39.0",
31
- "@webiny/react-router": "5.39.0",
32
- "@webiny/telemetry": "5.39.0",
33
- "@webiny/ui": "5.39.0",
34
- "@webiny/ui-composer": "5.39.0",
35
- "@webiny/utils": "5.39.0",
36
- "@webiny/validation": "5.39.0",
23
+ "@webiny/app": "5.39.1-beta.1",
24
+ "@webiny/app-security": "5.39.1-beta.1",
25
+ "@webiny/app-theme": "5.39.1-beta.1",
26
+ "@webiny/app-wcp": "5.39.1-beta.1",
27
+ "@webiny/form": "5.39.1-beta.1",
28
+ "@webiny/lexical-editor": "5.39.1-beta.1",
29
+ "@webiny/plugins": "5.39.1-beta.1",
30
+ "@webiny/react-composition": "5.39.1-beta.1",
31
+ "@webiny/react-router": "5.39.1-beta.1",
32
+ "@webiny/telemetry": "5.39.1-beta.1",
33
+ "@webiny/ui": "5.39.1-beta.1",
34
+ "@webiny/ui-composer": "5.39.1-beta.1",
35
+ "@webiny/utils": "5.39.1-beta.1",
36
+ "@webiny/validation": "5.39.1-beta.1",
37
37
  "apollo-cache": "1.3.5",
38
38
  "apollo-client": "2.6.10",
39
39
  "apollo-link": "1.2.14",
@@ -65,8 +65,8 @@
65
65
  "@types/graphlib": "2.1.8",
66
66
  "@types/is-hotkey": "0.1.7",
67
67
  "@types/store": "2.0.2",
68
- "@webiny/cli": "5.39.0",
69
- "@webiny/project-utils": "5.39.0",
68
+ "@webiny/cli": "5.39.1-beta.1",
69
+ "@webiny/project-utils": "5.39.1-beta.1",
70
70
  "babel-plugin-emotion": "9.2.11",
71
71
  "rimraf": "3.0.2",
72
72
  "ttypescript": "1.5.15",
@@ -92,5 +92,5 @@
92
92
  ]
93
93
  }
94
94
  },
95
- "gitHead": "3846541fd9c1764e6a8041f0b4208d720eb9c314"
95
+ "gitHead": "6fc74b45740bd4123dcf9b5890bfacee594208bf"
96
96
  }
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ /// <reference types="react" />
2
2
  import { AdminGlobalSearchPlugin, AdminGlobalSearchPreventHotkeyPlugin } from "../../types";
3
3
  export interface SearchBarState {
4
4
  active: boolean;
@@ -12,8 +12,5 @@ export interface SearchBarState {
12
12
  current?: AdminGlobalSearchPlugin;
13
13
  };
14
14
  }
15
- declare const _default: React.FunctionComponent<unknown> & {
16
- original: React.ComponentType<unknown>;
17
- originalName: string;
18
- };
15
+ declare const _default: import("../../index").DecoratableComponent<() => JSX.Element | null>;
19
16
  export default _default;
@@ -223,7 +223,7 @@ var SearchBarContainer = function SearchBarContainer() {
223
223
  var routerProps = (0, _reactRouter.useRouter)();
224
224
  return /*#__PURE__*/React.createElement(SearchBar, routerProps);
225
225
  };
226
- var _default = (0, _.makeComposable)("SearchBarContainer", SearchBarContainer);
226
+ var _default = (0, _.makeDecoratable)("SearchBarContainer", SearchBarContainer);
227
227
  exports.default = _default;
228
228
 
229
229
  //# sourceMappingURL=SearchBar.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","_interopRequireWildcard","require","_dotPropImmutable","_reactRouter","_downshift","_interopRequireDefault","_plugins","_classnames","_reactHotkeyz","_Icon","_Elevation","_SearchBarDropdown","_search","_styled","_","SearchBar","_React$Component","_inherits2","default","_super","_createSuper2","props","_this","_classCallCheck2","call","_defineProperty2","_assertThisInitialized2","active","searchTerm","previous","current","plugins","list","byType","hotKeys","undefined","createRef","e","i","state","length","hotKey","preventOpen","preventDefault","input","focus","plugin","setState","newState","set","query","URLSearchParams","search","JSON","stringify","_objectSpread2","history","push","pathname","route","toString","find","p","location","parse","get","_createClass2","key","value","render","_this2","createElement","ref","downshift","itemToString","item","label","downshiftProps","isOpen","openMenu","closeMenu","getInputProps","style","width","Hotkeys","zIndex","keys","esc","document","activeElement","blur","handleOpenHotkey","disabled","cancelSearchTerm","enter","setTimeout","selectedItem","submitSearchTerm","Elevation","className","classnames","searchWrapper","z","SearchBarWrapper","SearchBarInputWrapper","Icon","icon","ReactComponent","Fragment","placeholder","searchBarInput","onClick","onBlur","onFocus","onChange","target","SearchShortcut","context","Component","SearchBarContainer","routerProps","useRouter","_default","makeComposable","exports"],"sources":["SearchBar.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { set } from \"dot-prop-immutable\";\nimport { useRouter, UseRouter } from \"@webiny/react-router\";\nimport Downshift from \"downshift\";\nimport { plugins } from \"@webiny/plugins\";\nimport { AdminGlobalSearchPlugin, AdminGlobalSearchPreventHotkeyPlugin } from \"~/types\";\nimport classnames from \"classnames\";\n/**\n * Package react-hotkeyz does not have types.\n */\n// @ts-expect-error\nimport { Hotkeys } from \"react-hotkeyz\";\n\n// UI components\nimport { Icon } from \"@webiny/ui/Icon\";\nimport { Elevation } from \"@webiny/ui/Elevation\";\nimport SearchBarDropdown from \"./SearchBarDropdown\";\n\n// Icons\nimport { ReactComponent as SearchIcon } from \"@material-design-icons/svg/outlined/search.svg\";\n\n// Local components\nimport {\n icon,\n searchBarInput,\n SearchBarInputWrapper,\n SearchBarWrapper,\n SearchShortcut,\n searchWrapper\n} from \"./styled\";\nimport { makeComposable } from \"~/index\";\n\ntype SearchBarProps = UseRouter;\n\nexport interface SearchBarState {\n active: boolean;\n searchTerm: { previous: string; current: string };\n plugins: {\n list: ReadonlyArray<AdminGlobalSearchPlugin>;\n hotKeys: ReadonlyArray<AdminGlobalSearchPreventHotkeyPlugin>;\n current?: AdminGlobalSearchPlugin;\n };\n}\n\nclass SearchBar extends React.Component<SearchBarProps, SearchBarState> {\n public override state: SearchBarState = {\n active: false,\n searchTerm: {\n previous: \"\",\n current: \"\"\n },\n plugins: {\n // List of all registered \"admin-global-search\" plugins.\n get list() {\n return plugins.byType<AdminGlobalSearchPlugin>(\"admin-global-search\");\n },\n hotKeys: plugins.byType<AdminGlobalSearchPreventHotkeyPlugin>(\n \"admin-global-search-prevent-hotkey\"\n ),\n // Current plugin - set by examining current route and its query params (on construct).\n current: undefined\n }\n };\n\n /**\n * Helps us trigger some of the downshift's methods (eg. clearSelection) and helps us to avoid adding state.\n */\n public readonly downshift: any = React.createRef();\n\n /**\n * At some point we must programmatically focus the input.\n */\n private readonly input = React.createRef<HTMLInputElement>();\n\n /**\n * Let's check if current route is defined in one of the registered plugins.\n * If so, then check current route query for search term and set it as default value of search input.\n * @param props\n */\n constructor(props: SearchBarProps) {\n super(props);\n this.state.plugins.current = this.state.plugins.list.find(\n p => p.route === props.location.pathname\n );\n\n if (this.state.plugins.current) {\n let search;\n const query = new URLSearchParams(props.location.search);\n try {\n search = JSON.parse(query.get(\"search\") || \"\").query;\n } catch (e) {\n search = query.get(\"search\");\n }\n\n this.state.searchTerm.current = search || \"\";\n this.state.searchTerm.previous = this.state.searchTerm.current;\n }\n }\n\n private readonly handleOpenHotkey = (e: React.KeyboardEvent): void => {\n for (let i = 0; i < this.state.plugins.hotKeys.length; i++) {\n const hotKey = this.state.plugins.hotKeys[i];\n if (hotKey.preventOpen(e)) {\n return;\n }\n }\n\n e.preventDefault();\n if (!this.input.current) {\n return;\n }\n this.input.current.focus();\n };\n\n /**\n * Re-routes to given route (provided by the plugin) with needed search query params.\n * It also manages previous and current search terms and automatically highlighted item in dropdown.\n * @param plugin\n */\n public readonly submitSearchTerm = (plugin: AdminGlobalSearchPlugin): void => {\n this.setState(\n state => {\n const newState = set(state, \"searchTerm.previous\", state.searchTerm.current);\n return set(newState, \"plugins.current\", plugin);\n },\n () => {\n const query = new URLSearchParams();\n\n if (this.state.searchTerm.current) {\n // If \"search\" key in the plugin was defined, it means SearchInput values were set. Otherwise,\n // we need to send the plain string into the \"search\" query param. This behavior was needed\n // eg. for pages, since Page entity doesn't use regular SearchInput type, but plain string.\n if (plugin.search) {\n query.set(\n \"search\",\n JSON.stringify({\n query: this.state.searchTerm.current,\n ...plugin.search\n })\n );\n } else {\n query.set(\"search\", this.state.searchTerm.current);\n }\n }\n\n this.props.history.push({\n pathname: plugin.route,\n search: query.toString()\n });\n }\n );\n };\n\n private readonly cancelSearchTerm = (): void => {\n this.setState(state => {\n state.searchTerm.current = state.searchTerm.previous;\n return state;\n });\n };\n\n public override render() {\n return (\n <Downshift ref={this.downshift} itemToString={item => item && item.label}>\n {downshiftProps => {\n const { isOpen, openMenu, closeMenu, getInputProps } = downshiftProps;\n\n return (\n <div style={{ width: \"100%\" }}>\n <Hotkeys\n zIndex={10}\n keys={{\n // @ts-expect-error\n esc: () => document.activeElement.blur(),\n \"/\": this.handleOpenHotkey\n }}\n />\n\n <Hotkeys\n zIndex={11}\n disabled={!isOpen}\n keys={{\n esc: () => {\n this.cancelSearchTerm();\n closeMenu();\n },\n enter: () =>\n setTimeout(() => {\n const { selectedItem } = this.downshift.current.state;\n if (selectedItem) {\n closeMenu();\n this.submitSearchTerm(selectedItem);\n }\n })\n }}\n />\n\n <Elevation\n className={classnames(searchWrapper, { active: this.state.active })}\n z={0}\n >\n <SearchBarWrapper>\n <SearchBarInputWrapper>\n <Icon className={icon} icon={<SearchIcon />} />\n\n <React.Fragment>\n <input\n {...getInputProps({\n placeholder: \"Search...\",\n className: classnames(\n \"mdc-text-field__input\",\n searchBarInput\n ),\n ref: this.input,\n value: this.state.searchTerm.current,\n onClick: openMenu,\n onBlur: () => {\n this.cancelSearchTerm();\n this.setState({ active: false });\n },\n onFocus: () => {\n this.setState({ active: true });\n openMenu();\n },\n onChange: (\n e: React.ChangeEvent<HTMLInputElement>\n ) => {\n const value = e.target.value || \"\";\n this.setState(state => {\n state.searchTerm.current = value;\n return state;\n });\n }\n })}\n />\n </React.Fragment>\n\n <SearchShortcut>/</SearchShortcut>\n </SearchBarInputWrapper>\n </SearchBarWrapper>\n {isOpen && <SearchBarDropdown context={this} />}\n </Elevation>\n </div>\n );\n }}\n </Downshift>\n );\n }\n}\n\nconst SearchBarContainer = () => {\n const routerProps = useRouter();\n\n return <SearchBar {...routerProps} />;\n};\n\nexport default makeComposable(\"SearchBarContainer\", SearchBarContainer);\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAEA,IAAAM,WAAA,GAAAF,sBAAA,CAAAJ,OAAA;AAKA,IAAAO,aAAA,GAAAP,OAAA;AAGA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AACA,IAAAU,kBAAA,GAAAN,sBAAA,CAAAJ,OAAA;AAGA,IAAAW,OAAA,GAAAX,OAAA;AAGA,IAAAY,OAAA,GAAAZ,OAAA;AAQA,IAAAa,CAAA,GAAAb,OAA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vBvB,MAAI,CAACvB,QAAQ,CAAC;cAAEpB,MAAM,EAAE;YAAM,CAAC,CAAC;UACpC,CAAC;UACDsF,OAAO,EAAE,SAAAA,QAAA,EAAM;YACX3C,MAAI,CAACvB,QAAQ,CAAC;cAAEpB,MAAM,EAAE;YAAK,CAAC,CAAC;YAC/BoD,QAAQ,CAAC,CAAC;UACd,CAAC;UACDmC,QAAQ,EAAE,SAAAA,SACN7E,CAAsC,EACrC;YACD,IAAM+B,KAAK,GAAG/B,CAAC,CAAC8E,MAAM,CAAC/C,KAAK,IAAI,EAAE;YAClCE,MAAI,CAACvB,QAAQ,CAAC,UAAAR,KAAK,EAAI;cACnBA,KAAK,CAACX,UAAU,CAACE,OAAO,GAAGsC,KAAK;cAChC,OAAO7B,KAAK;YAChB,CAAC,CAAC;UACN;QACJ,CAAC,CACJ,CACW,CAAC,eAEjBxC,KAAA,CAAAwE,aAAA,CAAC1D,OAAA,CAAAuG,cAAc,QAAC,GAAiB,CACd,CACT,CAAC,EAClBtC,MAAM,iBAAI/E,KAAA,CAAAwE,aAAA,CAAC5D,kBAAA,CAAAO,OAAiB;UAACmG,OAAO,EAAE/C;QAAK,CAAE,CACvC,CACV,CAAC;MAEd,CACO,CAAC;IAEpB;EAAC;EAAA,OAAAvD,SAAA;AAAA,EA1MmBhB,KAAK,CAACuH,SAAS;AA6MvC,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAA,EAAS;EAC7B,IAAMC,WAAW,GAAG,IAAAC,sBAAS,EAAC,CAAC;EAE/B,oBAAO1H,KAAA,CAAAwE,aAAA,CAACxD,SAAS,EAAKyG,WAAc,CAAC;AACzC,CAAC;AAAC,IAAAE,QAAA,GAEa,IAAAC,gBAAc,EAAC,oBAAoB,EAAEJ,kBAAkB,CAAC;AAAAK,OAAA,CAAA1G,OAAA,GAAAwG,QAAA"}
1
+ {"version":3,"names":["React","_interopRequireWildcard","require","_dotPropImmutable","_reactRouter","_downshift","_interopRequireDefault","_plugins","_classnames","_reactHotkeyz","_Icon","_Elevation","_SearchBarDropdown","_search","_styled","_","SearchBar","_React$Component","_inherits2","default","_super","_createSuper2","props","_this","_classCallCheck2","call","_defineProperty2","_assertThisInitialized2","active","searchTerm","previous","current","plugins","list","byType","hotKeys","undefined","createRef","e","i","state","length","hotKey","preventOpen","preventDefault","input","focus","plugin","setState","newState","set","query","URLSearchParams","search","JSON","stringify","_objectSpread2","history","push","pathname","route","toString","find","p","location","parse","get","_createClass2","key","value","render","_this2","createElement","ref","downshift","itemToString","item","label","downshiftProps","isOpen","openMenu","closeMenu","getInputProps","style","width","Hotkeys","zIndex","keys","esc","document","activeElement","blur","handleOpenHotkey","disabled","cancelSearchTerm","enter","setTimeout","selectedItem","submitSearchTerm","Elevation","className","classnames","searchWrapper","z","SearchBarWrapper","SearchBarInputWrapper","Icon","icon","ReactComponent","Fragment","placeholder","searchBarInput","onClick","onBlur","onFocus","onChange","target","SearchShortcut","context","Component","SearchBarContainer","routerProps","useRouter","_default","makeDecoratable","exports"],"sources":["SearchBar.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { set } from \"dot-prop-immutable\";\nimport { useRouter, UseRouter } from \"@webiny/react-router\";\nimport Downshift from \"downshift\";\nimport { plugins } from \"@webiny/plugins\";\nimport { AdminGlobalSearchPlugin, AdminGlobalSearchPreventHotkeyPlugin } from \"~/types\";\nimport classnames from \"classnames\";\n/**\n * Package react-hotkeyz does not have types.\n */\n// @ts-expect-error\nimport { Hotkeys } from \"react-hotkeyz\";\n\n// UI components\nimport { Icon } from \"@webiny/ui/Icon\";\nimport { Elevation } from \"@webiny/ui/Elevation\";\nimport SearchBarDropdown from \"./SearchBarDropdown\";\n\n// Icons\nimport { ReactComponent as SearchIcon } from \"@material-design-icons/svg/outlined/search.svg\";\n\n// Local components\nimport {\n icon,\n searchBarInput,\n SearchBarInputWrapper,\n SearchBarWrapper,\n SearchShortcut,\n searchWrapper\n} from \"./styled\";\nimport { makeDecoratable } from \"~/index\";\n\ntype SearchBarProps = UseRouter;\n\nexport interface SearchBarState {\n active: boolean;\n searchTerm: { previous: string; current: string };\n plugins: {\n list: ReadonlyArray<AdminGlobalSearchPlugin>;\n hotKeys: ReadonlyArray<AdminGlobalSearchPreventHotkeyPlugin>;\n current?: AdminGlobalSearchPlugin;\n };\n}\n\nclass SearchBar extends React.Component<SearchBarProps, SearchBarState> {\n public override state: SearchBarState = {\n active: false,\n searchTerm: {\n previous: \"\",\n current: \"\"\n },\n plugins: {\n // List of all registered \"admin-global-search\" plugins.\n get list() {\n return plugins.byType<AdminGlobalSearchPlugin>(\"admin-global-search\");\n },\n hotKeys: plugins.byType<AdminGlobalSearchPreventHotkeyPlugin>(\n \"admin-global-search-prevent-hotkey\"\n ),\n // Current plugin - set by examining current route and its query params (on construct).\n current: undefined\n }\n };\n\n /**\n * Helps us trigger some of the downshift's methods (eg. clearSelection) and helps us to avoid adding state.\n */\n public readonly downshift: any = React.createRef();\n\n /**\n * At some point we must programmatically focus the input.\n */\n private readonly input = React.createRef<HTMLInputElement>();\n\n /**\n * Let's check if current route is defined in one of the registered plugins.\n * If so, then check current route query for search term and set it as default value of search input.\n * @param props\n */\n constructor(props: SearchBarProps) {\n super(props);\n this.state.plugins.current = this.state.plugins.list.find(\n p => p.route === props.location.pathname\n );\n\n if (this.state.plugins.current) {\n let search;\n const query = new URLSearchParams(props.location.search);\n try {\n search = JSON.parse(query.get(\"search\") || \"\").query;\n } catch (e) {\n search = query.get(\"search\");\n }\n\n this.state.searchTerm.current = search || \"\";\n this.state.searchTerm.previous = this.state.searchTerm.current;\n }\n }\n\n private readonly handleOpenHotkey = (e: React.KeyboardEvent): void => {\n for (let i = 0; i < this.state.plugins.hotKeys.length; i++) {\n const hotKey = this.state.plugins.hotKeys[i];\n if (hotKey.preventOpen(e)) {\n return;\n }\n }\n\n e.preventDefault();\n if (!this.input.current) {\n return;\n }\n this.input.current.focus();\n };\n\n /**\n * Re-routes to given route (provided by the plugin) with needed search query params.\n * It also manages previous and current search terms and automatically highlighted item in dropdown.\n * @param plugin\n */\n public readonly submitSearchTerm = (plugin: AdminGlobalSearchPlugin): void => {\n this.setState(\n state => {\n const newState = set(state, \"searchTerm.previous\", state.searchTerm.current);\n return set(newState, \"plugins.current\", plugin);\n },\n () => {\n const query = new URLSearchParams();\n\n if (this.state.searchTerm.current) {\n // If \"search\" key in the plugin was defined, it means SearchInput values were set. Otherwise,\n // we need to send the plain string into the \"search\" query param. This behavior was needed\n // eg. for pages, since Page entity doesn't use regular SearchInput type, but plain string.\n if (plugin.search) {\n query.set(\n \"search\",\n JSON.stringify({\n query: this.state.searchTerm.current,\n ...plugin.search\n })\n );\n } else {\n query.set(\"search\", this.state.searchTerm.current);\n }\n }\n\n this.props.history.push({\n pathname: plugin.route,\n search: query.toString()\n });\n }\n );\n };\n\n private readonly cancelSearchTerm = (): void => {\n this.setState(state => {\n state.searchTerm.current = state.searchTerm.previous;\n return state;\n });\n };\n\n public override render() {\n return (\n <Downshift ref={this.downshift} itemToString={item => item && item.label}>\n {downshiftProps => {\n const { isOpen, openMenu, closeMenu, getInputProps } = downshiftProps;\n\n return (\n <div style={{ width: \"100%\" }}>\n <Hotkeys\n zIndex={10}\n keys={{\n // @ts-expect-error\n esc: () => document.activeElement.blur(),\n \"/\": this.handleOpenHotkey\n }}\n />\n\n <Hotkeys\n zIndex={11}\n disabled={!isOpen}\n keys={{\n esc: () => {\n this.cancelSearchTerm();\n closeMenu();\n },\n enter: () =>\n setTimeout(() => {\n const { selectedItem } = this.downshift.current.state;\n if (selectedItem) {\n closeMenu();\n this.submitSearchTerm(selectedItem);\n }\n })\n }}\n />\n\n <Elevation\n className={classnames(searchWrapper, { active: this.state.active })}\n z={0}\n >\n <SearchBarWrapper>\n <SearchBarInputWrapper>\n <Icon className={icon} icon={<SearchIcon />} />\n\n <React.Fragment>\n <input\n {...getInputProps({\n placeholder: \"Search...\",\n className: classnames(\n \"mdc-text-field__input\",\n searchBarInput\n ),\n ref: this.input,\n value: this.state.searchTerm.current,\n onClick: openMenu,\n onBlur: () => {\n this.cancelSearchTerm();\n this.setState({ active: false });\n },\n onFocus: () => {\n this.setState({ active: true });\n openMenu();\n },\n onChange: (\n e: React.ChangeEvent<HTMLInputElement>\n ) => {\n const value = e.target.value || \"\";\n this.setState(state => {\n state.searchTerm.current = value;\n return state;\n });\n }\n })}\n />\n </React.Fragment>\n\n <SearchShortcut>/</SearchShortcut>\n </SearchBarInputWrapper>\n </SearchBarWrapper>\n {isOpen && <SearchBarDropdown context={this} />}\n </Elevation>\n </div>\n );\n }}\n </Downshift>\n );\n }\n}\n\nconst SearchBarContainer = () => {\n const routerProps = useRouter();\n\n return <SearchBar {...routerProps} />;\n};\n\nexport default makeDecoratable(\"SearchBarContainer\", SearchBarContainer);\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAEA,IAAAM,WAAA,GAAAF,sBAAA,CAAAJ,OAAA;AAKA,IAAAO,aAAA,GAAAP,OAAA;AAGA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AACA,IAAAU,kBAAA,GAAAN,sBAAA,CAAAJ,OAAA;AAGA,IAAAW,OAAA,GAAAX,OAAA;AAGA,IAAAY,OAAA,GAAAZ,OAAA;AAQA,IAAAa,CAAA,GAAAb,OAAA;AAvBA;AACA;AACA;AACA;AAGA;AAKA;AAGA;AAAA,IAuBMc,SAAS,0BAAAC,gBAAA;EAAA,IAAAC,UAAA,CAAAC,OAAA,EAAAH,SAAA,EAAAC,gBAAA;EAAA,IAAAG,MAAA,OAAAC,aAAA,CAAAF,OAAA,EAAAH,SAAA;EA8BX;AACJ;AACA;AACA;AACA;EACI,SAAAA,UAAYM,KAAqB,EAAE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