@webiny/app-headless-cms 6.4.0-beta.3 → 6.4.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ContentEntryEditorConfig.d.ts +8 -8
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.d.ts +8 -8
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.js +55 -4
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.js.map +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateGridItem.d.ts +25 -0
- package/admin/plugins/fieldRenderers/dynamicZone/{TemplateItem.js → TemplateGridItem.js} +3 -3
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateGridItem.js.map +1 -0
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateListItem.d.ts +7 -0
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateListItem.js +36 -0
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateListItem.js.map +1 -0
- package/package.json +28 -26
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateItem.d.ts +0 -25
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateItem.js.map +0 -1
|
@@ -432,27 +432,27 @@ export declare const ContentEntryEditorConfig: (({ priority, children }: import(
|
|
|
432
432
|
displayName: string;
|
|
433
433
|
}>) => (props: import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.js").ShouldRender) => React.JSX.Element;
|
|
434
434
|
};
|
|
435
|
-
Item: (({ template, onTemplate }: import("./admin/plugins/fieldRenderers/dynamicZone/
|
|
436
|
-
original: ({ template, onTemplate }: import("./admin/plugins/fieldRenderers/dynamicZone/
|
|
435
|
+
Item: (({ template, onTemplate }: import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGridItem.js").TemplateGridItemProps) => import("react").JSX.Element) & {
|
|
436
|
+
original: ({ template, onTemplate }: import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGridItem.js").TemplateGridItemProps) => import("react").JSX.Element;
|
|
437
437
|
originalName: string;
|
|
438
438
|
displayName: string;
|
|
439
439
|
} & {
|
|
440
|
-
original: (({ template, onTemplate }: import("./admin/plugins/fieldRenderers/dynamicZone/
|
|
441
|
-
original: ({ template, onTemplate }: import("./admin/plugins/fieldRenderers/dynamicZone/
|
|
440
|
+
original: (({ template, onTemplate }: import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGridItem.js").TemplateGridItemProps) => import("react").JSX.Element) & {
|
|
441
|
+
original: ({ template, onTemplate }: import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGridItem.js").TemplateGridItemProps) => import("react").JSX.Element;
|
|
442
442
|
originalName: string;
|
|
443
443
|
displayName: string;
|
|
444
444
|
};
|
|
445
445
|
originalName: string;
|
|
446
446
|
displayName: string;
|
|
447
447
|
} & {
|
|
448
|
-
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ template, onTemplate }: import("./admin/plugins/fieldRenderers/dynamicZone/
|
|
449
|
-
original: ({ template, onTemplate }: import("./admin/plugins/fieldRenderers/dynamicZone/
|
|
448
|
+
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ template, onTemplate }: import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGridItem.js").TemplateGridItemProps) => import("react").JSX.Element) & {
|
|
449
|
+
original: ({ template, onTemplate }: import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGridItem.js").TemplateGridItemProps) => import("react").JSX.Element;
|
|
450
450
|
originalName: string;
|
|
451
451
|
displayName: string;
|
|
452
452
|
}>) => (props: unknown) => React.JSX.Element;
|
|
453
453
|
} & {
|
|
454
|
-
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ template, onTemplate }: import("./admin/plugins/fieldRenderers/dynamicZone/
|
|
455
|
-
original: ({ template, onTemplate }: import("./admin/plugins/fieldRenderers/dynamicZone/
|
|
454
|
+
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ template, onTemplate }: import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGridItem.js").TemplateGridItemProps) => import("react").JSX.Element) & {
|
|
455
|
+
original: ({ template, onTemplate }: import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGridItem.js").TemplateGridItemProps) => import("react").JSX.Element;
|
|
456
456
|
originalName: string;
|
|
457
457
|
displayName: string;
|
|
458
458
|
}>) => (props: import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.js").ShouldRender) => React.JSX.Element;
|
|
@@ -93,27 +93,27 @@ export declare const TemplateGallery: ((props: TemplateGalleryProps) => React.JS
|
|
|
93
93
|
displayName: string;
|
|
94
94
|
}>) => (props: ShouldRender) => React.JSX.Element;
|
|
95
95
|
};
|
|
96
|
-
Item: (({ template, onTemplate }: import("./
|
|
97
|
-
original: ({ template, onTemplate }: import("./
|
|
96
|
+
Item: (({ template, onTemplate }: import("./TemplateGridItem.js").TemplateGridItemProps) => React.JSX.Element) & {
|
|
97
|
+
original: ({ template, onTemplate }: import("./TemplateGridItem.js").TemplateGridItemProps) => React.JSX.Element;
|
|
98
98
|
originalName: string;
|
|
99
99
|
displayName: string;
|
|
100
100
|
} & {
|
|
101
|
-
original: (({ template, onTemplate }: import("./
|
|
102
|
-
original: ({ template, onTemplate }: import("./
|
|
101
|
+
original: (({ template, onTemplate }: import("./TemplateGridItem.js").TemplateGridItemProps) => React.JSX.Element) & {
|
|
102
|
+
original: ({ template, onTemplate }: import("./TemplateGridItem.js").TemplateGridItemProps) => React.JSX.Element;
|
|
103
103
|
originalName: string;
|
|
104
104
|
displayName: string;
|
|
105
105
|
};
|
|
106
106
|
originalName: string;
|
|
107
107
|
displayName: string;
|
|
108
108
|
} & {
|
|
109
|
-
createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<(({ template, onTemplate }: import("./
|
|
110
|
-
original: ({ template, onTemplate }: import("./
|
|
109
|
+
createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<(({ template, onTemplate }: import("./TemplateGridItem.js").TemplateGridItemProps) => React.JSX.Element) & {
|
|
110
|
+
original: ({ template, onTemplate }: import("./TemplateGridItem.js").TemplateGridItemProps) => React.JSX.Element;
|
|
111
111
|
originalName: string;
|
|
112
112
|
displayName: string;
|
|
113
113
|
}>) => (props: unknown) => React.JSX.Element;
|
|
114
114
|
} & {
|
|
115
|
-
createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<(({ template, onTemplate }: import("./
|
|
116
|
-
original: ({ template, onTemplate }: import("./
|
|
115
|
+
createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<(({ template, onTemplate }: import("./TemplateGridItem.js").TemplateGridItemProps) => React.JSX.Element) & {
|
|
116
|
+
original: ({ template, onTemplate }: import("./TemplateGridItem.js").TemplateGridItemProps) => React.JSX.Element;
|
|
117
117
|
originalName: string;
|
|
118
118
|
displayName: string;
|
|
119
119
|
}>) => (props: ShouldRender) => React.JSX.Element;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import react from "react";
|
|
1
|
+
import react, { useState } from "react";
|
|
2
2
|
import { makeDecoratable, withDecoratorFactory } from "@webiny/app-admin";
|
|
3
3
|
import { useModel, useModelField } from "../../../hooks/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { TemplateGridItem } from "./TemplateGridItem.js";
|
|
5
|
+
import { TemplateListItem } from "./TemplateListItem.js";
|
|
6
|
+
import { DelayedOnChange, Icon, Input, ToggleGroup } from "@webiny/admin-ui";
|
|
7
|
+
import { ReactComponent } from "@webiny/icons/search.svg";
|
|
8
|
+
import { ReactComponent as grid_view_svg_ReactComponent } from "@webiny/icons/grid_view.svg";
|
|
9
|
+
import { ReactComponent as list_svg_ReactComponent } from "@webiny/icons/list.svg";
|
|
5
10
|
const GalleryContainer = makeDecoratable("TemplateGalleryContainer", (props)=>/*#__PURE__*/ react.createElement(react.Fragment, null, props.children));
|
|
6
11
|
const GalleryList = makeDecoratable("TemplateGalleryList", (props)=>/*#__PURE__*/ react.createElement("div", {
|
|
7
12
|
className: "gap-md flex flex-wrap mb-xs"
|
|
@@ -9,7 +14,53 @@ const GalleryList = makeDecoratable("TemplateGalleryList", (props)=>/*#__PURE__*
|
|
|
9
14
|
const Gallery = makeDecoratable("TemplateGallery", (props)=>{
|
|
10
15
|
const { field } = useModelField();
|
|
11
16
|
const templates = props.templates || field.settings?.templates || [];
|
|
12
|
-
|
|
17
|
+
const [viewMode, setViewMode] = useState("grid");
|
|
18
|
+
const [search, setSearch] = useState("");
|
|
19
|
+
const filteredTemplates = templates.filter((t)=>t.name.toLowerCase().includes(search.toLowerCase()));
|
|
20
|
+
return /*#__PURE__*/ react.createElement(GalleryContainer, null, /*#__PURE__*/ react.createElement("div", {
|
|
21
|
+
className: "flex items-center gap-sm pb-md pt-xs"
|
|
22
|
+
}, /*#__PURE__*/ react.createElement("div", {
|
|
23
|
+
className: "flex-1 min-w-0"
|
|
24
|
+
}, /*#__PURE__*/ react.createElement(DelayedOnChange, {
|
|
25
|
+
value: search,
|
|
26
|
+
onChange: setSearch
|
|
27
|
+
}, ({ value, onChange })=>/*#__PURE__*/ react.createElement(Input, {
|
|
28
|
+
autoFocus: true,
|
|
29
|
+
value: value,
|
|
30
|
+
onChange: onChange,
|
|
31
|
+
placeholder: "Search templates...",
|
|
32
|
+
startIcon: /*#__PURE__*/ react.createElement(Icon, {
|
|
33
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
34
|
+
label: "Search"
|
|
35
|
+
}),
|
|
36
|
+
size: "md",
|
|
37
|
+
variant: "primary"
|
|
38
|
+
}))), /*#__PURE__*/ react.createElement("div", {
|
|
39
|
+
className: "shrink-0"
|
|
40
|
+
}, /*#__PURE__*/ react.createElement(ToggleGroup, {
|
|
41
|
+
type: "single",
|
|
42
|
+
value: viewMode,
|
|
43
|
+
onChange: (value)=>setViewMode(value),
|
|
44
|
+
items: [
|
|
45
|
+
{
|
|
46
|
+
id: "grid",
|
|
47
|
+
value: "grid",
|
|
48
|
+
icon: /*#__PURE__*/ react.createElement(grid_view_svg_ReactComponent, null)
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "list",
|
|
52
|
+
value: "list",
|
|
53
|
+
icon: /*#__PURE__*/ react.createElement(list_svg_ReactComponent, null)
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
variant: "ghost"
|
|
57
|
+
}))), "grid" === viewMode ? /*#__PURE__*/ react.createElement(GalleryList, null, filteredTemplates.map((template)=>/*#__PURE__*/ react.createElement(TemplateGridItem, {
|
|
58
|
+
key: template.id,
|
|
59
|
+
template: template,
|
|
60
|
+
onTemplate: props.onTemplate
|
|
61
|
+
}))) : /*#__PURE__*/ react.createElement("div", {
|
|
62
|
+
className: "flex flex-col gap-y-sm"
|
|
63
|
+
}, filteredTemplates.map((template)=>/*#__PURE__*/ react.createElement(TemplateListItem, {
|
|
13
64
|
key: template.id,
|
|
14
65
|
template: template,
|
|
15
66
|
onTemplate: props.onTemplate
|
|
@@ -25,7 +76,7 @@ function withShouldRender(Component) {
|
|
|
25
76
|
const TemplateGallery = Object.assign(withShouldRender(Gallery), {
|
|
26
77
|
Container: withShouldRender(GalleryContainer),
|
|
27
78
|
List: withShouldRender(GalleryList),
|
|
28
|
-
Item: withShouldRender(
|
|
79
|
+
Item: withShouldRender(TemplateGridItem)
|
|
29
80
|
});
|
|
30
81
|
export { TemplateGallery };
|
|
31
82
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.js","sources":["../../../../../src/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.tsx"],"sourcesContent":["import React from \"react\";\nimport type { DecoratableComponent } from \"@webiny/app-admin\";\nimport { makeDecoratable, withDecoratorFactory } from \"@webiny/app-admin\";\nimport type { CmsDynamicZoneTemplate } from \"~/types.js\";\nimport { useModel, useModelField } from \"~/admin/hooks/index.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.js","sources":["../../../../../src/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport type { DecoratableComponent } from \"@webiny/app-admin\";\nimport { makeDecoratable, withDecoratorFactory } from \"@webiny/app-admin\";\nimport type { CmsDynamicZoneTemplate } from \"~/types.js\";\nimport { useModel, useModelField } from \"~/admin/hooks/index.js\";\nimport { TemplateGridItem } from \"./TemplateGridItem.js\";\nimport { TemplateListItem } from \"./TemplateListItem.js\";\nimport { Input, Icon, DelayedOnChange, ToggleGroup } from \"@webiny/admin-ui\";\nimport { ReactComponent as SearchIcon } from \"@webiny/icons/search.svg\";\nimport { ReactComponent as GridIcon } from \"@webiny/icons/grid_view.svg\";\nimport { ReactComponent as ListIcon } from \"@webiny/icons/list.svg\";\n\nexport interface TemplateGalleryContainerProps {\n children: React.ReactNode;\n}\n\nconst GalleryContainer = makeDecoratable(\n \"TemplateGalleryContainer\",\n (props: TemplateGalleryContainerProps) => {\n return <>{props.children}</>;\n }\n);\n\nexport interface TemplateGalleryListProps {\n children: React.ReactNode;\n}\n\nconst GalleryList = makeDecoratable(\"TemplateGalleryList\", (props: TemplateGalleryListProps) => {\n return <div className={\"gap-md flex flex-wrap mb-xs\"}>{props.children}</div>;\n});\n\nexport interface TemplateGalleryProps {\n onTemplate: (template: CmsDynamicZoneTemplate) => void;\n onClose: () => void;\n templates?: CmsDynamicZoneTemplate[];\n}\n\nconst Gallery = makeDecoratable(\"TemplateGallery\", (props: TemplateGalleryProps) => {\n const { field } = useModelField();\n const templates = props.templates || field.settings?.templates || [];\n\n const [viewMode, setViewMode] = useState<\"grid\" | \"list\">(\"grid\");\n const [search, setSearch] = useState(\"\");\n\n const filteredTemplates = templates.filter(t =>\n t.name.toLowerCase().includes(search.toLowerCase())\n );\n\n return (\n <GalleryContainer>\n <div className={\"flex items-center gap-sm pb-md pt-xs\"}>\n <div className={\"flex-1 min-w-0\"}>\n <DelayedOnChange value={search} onChange={setSearch}>\n {({ value, onChange }) => (\n <Input\n autoFocus={true}\n value={value}\n onChange={onChange}\n placeholder={\"Search templates...\"}\n startIcon={<Icon icon={<SearchIcon />} label={\"Search\"} />}\n size={\"md\"}\n variant={\"primary\"}\n />\n )}\n </DelayedOnChange>\n </div>\n <div className={\"shrink-0\"}>\n <ToggleGroup\n type=\"single\"\n value={viewMode}\n onChange={value => setViewMode(value as \"grid\" | \"list\")}\n items={[\n { id: \"grid\", value: \"grid\", icon: <GridIcon /> },\n { id: \"list\", value: \"list\", icon: <ListIcon /> }\n ]}\n variant=\"ghost\"\n />\n </div>\n </div>\n {viewMode === \"grid\" ? (\n <GalleryList>\n {filteredTemplates.map(template => (\n <TemplateGridItem\n key={template.id}\n template={template}\n onTemplate={props.onTemplate}\n />\n ))}\n </GalleryList>\n ) : (\n <div className={\"flex flex-col gap-y-sm\"}>\n {filteredTemplates.map(template => (\n <TemplateListItem\n key={template.id}\n template={template}\n onTemplate={props.onTemplate}\n />\n ))}\n </div>\n )}\n </GalleryContainer>\n );\n});\n\nexport type ShouldRender = { modelIds?: string[] };\n\nfunction withShouldRender<T extends DecoratableComponent>(Component: T) {\n return withDecoratorFactory<ShouldRender>()(Component, decoratorProps => {\n const { model } = useModel();\n\n if (decoratorProps?.modelIds?.length && !decoratorProps.modelIds.includes(model.modelId)) {\n return false;\n }\n\n return true;\n });\n}\n\n/**\n * We're wrapping each component with `withShouldRender`, because they're all decoratable, and `withShouldRender` attaches a\n * conditional decorator, which optionally takes a `modelIds` prop, so you can control on which models that component will be decorated.\n */\nexport const TemplateGallery = Object.assign(withShouldRender(Gallery), {\n Container: withShouldRender(GalleryContainer),\n List: withShouldRender(GalleryList),\n Item: withShouldRender(TemplateGridItem)\n});\n"],"names":["GalleryContainer","makeDecoratable","props","GalleryList","Gallery","field","useModelField","templates","viewMode","setViewMode","useState","search","setSearch","filteredTemplates","t","DelayedOnChange","value","onChange","Input","Icon","SearchIcon","ToggleGroup","GridIcon","ListIcon","template","TemplateGridItem","TemplateListItem","withShouldRender","Component","withDecoratorFactory","decoratorProps","model","useModel","TemplateGallery","Object"],"mappings":";;;;;;;;;AAgBA,MAAMA,mBAAmBC,gBACrB,4BACA,CAACC,QACU,WAAP,GAAO,0CAAGA,MAAM,QAAQ;AAQhC,MAAMC,cAAcF,gBAAgB,uBAAuB,CAACC,QACjD,WAAP,GAAO,oBAAC;QAAI,WAAW;OAAgCA,MAAM,QAAQ;AASzE,MAAME,UAAUH,gBAAgB,mBAAmB,CAACC;IAChD,MAAM,EAAEG,KAAK,EAAE,GAAGC;IAClB,MAAMC,YAAYL,MAAM,SAAS,IAAIG,MAAM,QAAQ,EAAE,aAAa,EAAE;IAEpE,MAAM,CAACG,UAAUC,YAAY,GAAGC,SAA0B;IAC1D,MAAM,CAACC,QAAQC,UAAU,GAAGF,SAAS;IAErC,MAAMG,oBAAoBN,UAAU,MAAM,CAACO,CAAAA,IACvCA,EAAE,IAAI,CAAC,WAAW,GAAG,QAAQ,CAACH,OAAO,WAAW;IAGpD,OAAO,WAAP,GACI,oBAACX,kBAAgBA,MAAAA,WAAAA,GACb,oBAAC;QAAI,WAAW;qBACZ,oBAAC;QAAI,WAAW;qBACZ,oBAACe,iBAAeA;QAAC,OAAOJ;QAAQ,UAAUC;OACrC,CAAC,EAAEI,KAAK,EAAEC,QAAQ,EAAE,iBACjB,oBAACC,OAAKA;YACF,WAAW;YACX,OAAOF;YACP,UAAUC;YACV,aAAa;YACb,yBAAW,oBAACE,MAAIA;gBAAC,oBAAM,oBAACC,gBAAUA;gBAAK,OAAO;;YAC9C,MAAM;YACN,SAAS;4BAKzB,oBAAC;QAAI,WAAW;qBACZ,oBAACC,aAAWA;QACR,MAAK;QACL,OAAOb;QACP,UAAUQ,CAAAA,QAASP,YAAYO;QAC/B,OAAO;YACH;gBAAE,IAAI;gBAAQ,OAAO;gBAAQ,MAAM,WAAN,GAAM,oBAACM,8BAAQA;YAAI;YAChD;gBAAE,IAAI;gBAAQ,OAAO;gBAAQ,MAAM,WAAN,GAAM,oBAACC,yBAAQA;YAAI;SACnD;QACD,SAAQ;UAInBf,AAAa,WAAbA,WAAsB,WAAT,GACV,oBAACL,aAAWA,MACPU,kBAAkB,GAAG,CAACW,CAAAA,WAAAA,WAAAA,GACnB,oBAACC,kBAAgBA;YACb,KAAKD,SAAS,EAAE;YAChB,UAAUA;YACV,YAAYtB,MAAM,UAAU;6BAKxC,oBAAC;QAAI,WAAW;OACXW,kBAAkB,GAAG,CAACW,CAAAA,WAAAA,WAAAA,GACnB,oBAACE,kBAAgBA;YACb,KAAKF,SAAS,EAAE;YAChB,UAAUA;YACV,YAAYtB,MAAM,UAAU;;AAOxD;AAIA,SAASyB,iBAAiDC,SAAY;IAClE,OAAOC,uBAAqCD,WAAWE,CAAAA;QACnD,MAAM,EAAEC,KAAK,EAAE,GAAGC;QAElB,IAAIF,gBAAgB,UAAU,UAAU,CAACA,eAAe,QAAQ,CAAC,QAAQ,CAACC,MAAM,OAAO,GACnF,OAAO;QAGX,OAAO;IACX;AACJ;AAMO,MAAME,kBAAkBC,OAAO,MAAM,CAACP,iBAAiBvB,UAAU;IACpE,WAAWuB,iBAAiB3B;IAC5B,MAAM2B,iBAAiBxB;IACvB,MAAMwB,iBAAiBF;AAC3B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { CmsDynamicZoneTemplate } from "../../../../types.js";
|
|
3
|
+
export interface TemplateGridItemProps {
|
|
4
|
+
template: CmsDynamicZoneTemplate;
|
|
5
|
+
onTemplate: (template: CmsDynamicZoneTemplate) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const TemplateGridItem: (({ template, onTemplate }: TemplateGridItemProps) => React.JSX.Element) & {
|
|
8
|
+
original: ({ template, onTemplate }: TemplateGridItemProps) => React.JSX.Element;
|
|
9
|
+
originalName: string;
|
|
10
|
+
displayName: string;
|
|
11
|
+
} & {
|
|
12
|
+
original: (({ template, onTemplate }: TemplateGridItemProps) => React.JSX.Element) & {
|
|
13
|
+
original: ({ template, onTemplate }: TemplateGridItemProps) => React.JSX.Element;
|
|
14
|
+
originalName: string;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
originalName: string;
|
|
18
|
+
displayName: string;
|
|
19
|
+
} & {
|
|
20
|
+
createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<(({ template, onTemplate }: TemplateGridItemProps) => React.JSX.Element) & {
|
|
21
|
+
original: ({ template, onTemplate }: TemplateGridItemProps) => React.JSX.Element;
|
|
22
|
+
originalName: string;
|
|
23
|
+
displayName: string;
|
|
24
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
25
|
+
};
|
|
@@ -3,7 +3,7 @@ import { makeDecoratable } from "@webiny/app-admin";
|
|
|
3
3
|
import { TemplateIcon } from "./TemplateIcon.js";
|
|
4
4
|
import { Button, Dialog, Text } from "@webiny/admin-ui";
|
|
5
5
|
import { ReactComponent } from "@webiny/icons/add_circle_outline.svg";
|
|
6
|
-
const
|
|
6
|
+
const TemplateGridItem = makeDecoratable("TemplateGridItem", ({ template, onTemplate })=>{
|
|
7
7
|
const [isHovered, setIsHovered] = useState(false);
|
|
8
8
|
return /*#__PURE__*/ react.createElement("div", {
|
|
9
9
|
onMouseEnter: ()=>setIsHovered(true),
|
|
@@ -37,6 +37,6 @@ const TemplateItem = makeDecoratable("TemplateItem", ({ template, onTemplate })=
|
|
|
37
37
|
icon: /*#__PURE__*/ react.createElement(ReactComponent, null)
|
|
38
38
|
}, "Insert"))));
|
|
39
39
|
});
|
|
40
|
-
export {
|
|
40
|
+
export { TemplateGridItem };
|
|
41
41
|
|
|
42
|
-
//# sourceMappingURL=
|
|
42
|
+
//# sourceMappingURL=TemplateGridItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/plugins/fieldRenderers/dynamicZone/TemplateGridItem.js","sources":["../../../../../src/admin/plugins/fieldRenderers/dynamicZone/TemplateGridItem.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\nimport type { CmsDynamicZoneTemplate } from \"~/types.js\";\nimport { TemplateIcon } from \"~/admin/plugins/fieldRenderers/dynamicZone/TemplateIcon.js\";\nimport { Text, Button } from \"@webiny/admin-ui\";\nimport { Dialog } from \"@webiny/admin-ui\";\nimport { ReactComponent as PlusIcon } from \"@webiny/icons/add_circle_outline.svg\";\n\nexport interface TemplateGridItemProps {\n template: CmsDynamicZoneTemplate;\n onTemplate: (template: CmsDynamicZoneTemplate) => void;\n}\n\nexport const TemplateGridItem = makeDecoratable(\n \"TemplateGridItem\",\n ({ template, onTemplate }: TemplateGridItemProps) => {\n const [isHovered, setIsHovered] = useState(false);\n\n return (\n <div\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n className={\n \"flex flex-col justify-between bg-neutral-base overflow-hidden rounded-lg w-[173px] relative shadow-sm\"\n }\n >\n <div>\n <div\n className={\n \"flex items-center justify-center py-xxl w-full bg-neutral-dimmed\"\n }\n >\n <TemplateIcon icon={template.icon} style={{ width: 40, height: 40 }} />\n </div>\n <div className={\"py-sm-extra px-md\"}>\n <Text size={\"md\"} className={\"mb-xs text-neutral-primary font-semibold\"}>\n {template.name}\n </Text>\n <Text size={\"sm\"} as={\"div\"} className={\"text-neutral-muted\"}>\n {template.description}\n </Text>\n </div>\n </div>\n\n {isHovered && (\n <Dialog.Close asChild>\n <div\n className=\"absolute inset-0 flex items-center justify-center bg-white/80 cursor-pointer\"\n onClick={() => onTemplate(template)}\n >\n <Button size={\"lg\"} variant=\"primary\" icon={<PlusIcon />}>\n Insert\n </Button>\n </div>\n </Dialog.Close>\n )}\n </div>\n );\n }\n);\n"],"names":["TemplateGridItem","makeDecoratable","template","onTemplate","isHovered","setIsHovered","useState","TemplateIcon","Text","Dialog","Button","PlusIcon"],"mappings":";;;;;AAaO,MAAMA,mBAAmBC,gBAC5B,oBACA,CAAC,EAAEC,QAAQ,EAAEC,UAAU,EAAyB;IAC5C,MAAM,CAACC,WAAWC,aAAa,GAAGC,SAAS;IAE3C,OAAO,WAAP,GACI,oBAAC;QACG,cAAc,IAAMD,aAAa;QACjC,cAAc,IAAMA,aAAa;QACjC,WACI;qBAGJ,oBAAC,2BACG,oBAAC;QACG,WACI;qBAGJ,oBAACE,cAAYA;QAAC,MAAML,SAAS,IAAI;QAAE,OAAO;YAAE,OAAO;YAAI,QAAQ;QAAG;uBAEtE,oBAAC;QAAI,WAAW;qBACZ,oBAACM,MAAIA;QAAC,MAAM;QAAM,WAAW;OACxBN,SAAS,IAAI,iBAElB,oBAACM,MAAIA;QAAC,MAAM;QAAM,IAAI;QAAO,WAAW;OACnCN,SAAS,WAAW,KAKhCE,aAAa,WAAbA,GACG,oBAACK,OAAO,KAAK;QAAC;qBACV,oBAAC;QACG,WAAU;QACV,SAAS,IAAMN,WAAWD;qBAE1B,oBAACQ,QAAMA;QAAC,MAAM;QAAM,SAAQ;QAAU,oBAAM,oBAACC,gBAAQA;OAAK;AAQlF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { CmsDynamicZoneTemplate } from "../../../../types.js";
|
|
3
|
+
export interface TemplateListItemProps {
|
|
4
|
+
template: CmsDynamicZoneTemplate;
|
|
5
|
+
onTemplate: (template: CmsDynamicZoneTemplate) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const TemplateListItem: ({ template, onTemplate }: TemplateListItemProps) => React.JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { TemplateIcon } from "./TemplateIcon.js";
|
|
3
|
+
import { Button, Dialog, Text } from "@webiny/admin-ui";
|
|
4
|
+
import { ReactComponent } from "@webiny/icons/add.svg";
|
|
5
|
+
const TemplateListItem = ({ template, onTemplate })=>/*#__PURE__*/ react.createElement(Dialog.Close, {
|
|
6
|
+
asChild: true
|
|
7
|
+
}, /*#__PURE__*/ react.createElement("div", {
|
|
8
|
+
onClick: ()=>onTemplate(template),
|
|
9
|
+
className: "group flex items-center gap-y-md py-sm-extra px-md rounded-lg bg-neutral-light hover:bg-[#f1f2f4] cursor-pointer"
|
|
10
|
+
}, /*#__PURE__*/ react.createElement("div", {
|
|
11
|
+
className: "flex items-center justify-center shrink-0 pr-md"
|
|
12
|
+
}, /*#__PURE__*/ react.createElement(TemplateIcon, {
|
|
13
|
+
icon: template.icon,
|
|
14
|
+
style: {
|
|
15
|
+
width: 24,
|
|
16
|
+
height: 24
|
|
17
|
+
}
|
|
18
|
+
})), /*#__PURE__*/ react.createElement("div", {
|
|
19
|
+
className: "flex-1 min-w-0"
|
|
20
|
+
}, /*#__PURE__*/ react.createElement(Text, {
|
|
21
|
+
size: "md",
|
|
22
|
+
className: "text-neutral-primary font-semibold truncate"
|
|
23
|
+
}, template.name), template.description && /*#__PURE__*/ react.createElement(Text, {
|
|
24
|
+
size: "sm",
|
|
25
|
+
as: "div",
|
|
26
|
+
className: "text-neutral-muted truncate"
|
|
27
|
+
}, template.description)), /*#__PURE__*/ react.createElement("div", {
|
|
28
|
+
className: "hidden group-hover:block"
|
|
29
|
+
}, /*#__PURE__*/ react.createElement(Button, {
|
|
30
|
+
size: "md",
|
|
31
|
+
variant: "primary",
|
|
32
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null)
|
|
33
|
+
}, "Insert"))));
|
|
34
|
+
export { TemplateListItem };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=TemplateListItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/plugins/fieldRenderers/dynamicZone/TemplateListItem.js","sources":["../../../../../src/admin/plugins/fieldRenderers/dynamicZone/TemplateListItem.tsx"],"sourcesContent":["import React from \"react\";\nimport type { CmsDynamicZoneTemplate } from \"~/types.js\";\nimport { TemplateIcon } from \"~/admin/plugins/fieldRenderers/dynamicZone/TemplateIcon.js\";\nimport { Text, Button } from \"@webiny/admin-ui\";\nimport { Dialog } from \"@webiny/admin-ui\";\nimport { ReactComponent as PlusIcon } from \"@webiny/icons/add.svg\";\n\nexport interface TemplateListItemProps {\n template: CmsDynamicZoneTemplate;\n onTemplate: (template: CmsDynamicZoneTemplate) => void;\n}\n\n// Used #f1f2f4 b/c in Figma, the color was result of multiple colors combined.\nexport const TemplateListItem = ({ template, onTemplate }: TemplateListItemProps) => {\n return (\n <Dialog.Close asChild>\n <div\n onClick={() => onTemplate(template)}\n className={\n \"group flex items-center gap-y-md py-sm-extra px-md rounded-lg bg-neutral-light hover:bg-[#f1f2f4] cursor-pointer\"\n }\n >\n <div className={\"flex items-center justify-center shrink-0 pr-md\"}>\n <TemplateIcon icon={template.icon} style={{ width: 24, height: 24 }} />\n </div>\n <div className={\"flex-1 min-w-0\"}>\n <Text size={\"md\"} className={\"text-neutral-primary font-semibold truncate\"}>\n {template.name}\n </Text>\n {template.description && (\n <Text size={\"sm\"} as={\"div\"} className={\"text-neutral-muted truncate\"}>\n {template.description}\n </Text>\n )}\n </div>\n <div className={\"hidden group-hover:block\"}>\n <Button size={\"md\"} variant={\"primary\"} icon={<PlusIcon />}>\n Insert\n </Button>\n </div>\n </div>\n </Dialog.Close>\n );\n};\n"],"names":["TemplateListItem","template","onTemplate","Dialog","TemplateIcon","Text","Button","PlusIcon"],"mappings":";;;;AAaO,MAAMA,mBAAmB,CAAC,EAAEC,QAAQ,EAAEC,UAAU,EAAyB,GACrE,WAAP,GACI,oBAACC,OAAO,KAAK;QAAC;qBACV,oBAAC;QACG,SAAS,IAAMD,WAAWD;QAC1B,WACI;qBAGJ,oBAAC;QAAI,WAAW;qBACZ,oBAACG,cAAYA;QAAC,MAAMH,SAAS,IAAI;QAAE,OAAO;YAAE,OAAO;YAAI,QAAQ;QAAG;uBAEtE,oBAAC;QAAI,WAAW;qBACZ,oBAACI,MAAIA;QAAC,MAAM;QAAM,WAAW;OACxBJ,SAAS,IAAI,GAEjBA,SAAS,WAAW,IAAI,WAAJ,GACjB,oBAACI,MAAIA;QAAC,MAAM;QAAM,IAAI;QAAO,WAAW;OACnCJ,SAAS,WAAW,kBAIjC,oBAAC;QAAI,WAAW;qBACZ,oBAACK,QAAMA;QAAC,MAAM;QAAM,SAAS;QAAW,oBAAM,oBAACC,gBAAQA;OAAK"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-headless-cms",
|
|
3
|
-
"version": "6.4.0-beta.
|
|
3
|
+
"version": "6.4.0-beta.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -30,26 +30,26 @@
|
|
|
30
30
|
"@fortawesome/react-fontawesome": "3.3.1",
|
|
31
31
|
"@lexical/utils": "0.44.0",
|
|
32
32
|
"@svgr/webpack": "8.1.0",
|
|
33
|
-
"@types/react": "18.3.
|
|
34
|
-
"@webiny/admin-ui": "6.4.0-beta.
|
|
35
|
-
"@webiny/app": "6.4.0-beta.
|
|
36
|
-
"@webiny/app-aco": "6.4.0-beta.
|
|
37
|
-
"@webiny/app-admin": "6.4.0-beta.
|
|
38
|
-
"@webiny/app-graphql-playground": "6.4.0-beta.
|
|
39
|
-
"@webiny/app-headless-cms-common": "6.4.0-beta.
|
|
40
|
-
"@webiny/app-trash-bin": "6.4.0-beta.
|
|
41
|
-
"@webiny/error": "6.4.0-beta.
|
|
42
|
-
"@webiny/feature": "6.4.0-beta.
|
|
43
|
-
"@webiny/form": "6.4.0-beta.
|
|
44
|
-
"@webiny/icons": "6.4.0-beta.
|
|
45
|
-
"@webiny/lexical-converter": "6.4.0-beta.
|
|
46
|
-
"@webiny/lexical-editor": "6.4.0-beta.
|
|
47
|
-
"@webiny/lexical-nodes": "6.4.0-beta.
|
|
48
|
-
"@webiny/plugins": "6.4.0-beta.
|
|
49
|
-
"@webiny/react-composition": "6.4.0-beta.
|
|
50
|
-
"@webiny/react-properties": "6.4.0-beta.
|
|
51
|
-
"@webiny/utils": "6.4.0-beta.
|
|
52
|
-
"@webiny/validation": "6.4.0-beta.
|
|
33
|
+
"@types/react": "18.3.29",
|
|
34
|
+
"@webiny/admin-ui": "6.4.0-beta.4",
|
|
35
|
+
"@webiny/app": "6.4.0-beta.4",
|
|
36
|
+
"@webiny/app-aco": "6.4.0-beta.4",
|
|
37
|
+
"@webiny/app-admin": "6.4.0-beta.4",
|
|
38
|
+
"@webiny/app-graphql-playground": "6.4.0-beta.4",
|
|
39
|
+
"@webiny/app-headless-cms-common": "6.4.0-beta.4",
|
|
40
|
+
"@webiny/app-trash-bin": "6.4.0-beta.4",
|
|
41
|
+
"@webiny/error": "6.4.0-beta.4",
|
|
42
|
+
"@webiny/feature": "6.4.0-beta.4",
|
|
43
|
+
"@webiny/form": "6.4.0-beta.4",
|
|
44
|
+
"@webiny/icons": "6.4.0-beta.4",
|
|
45
|
+
"@webiny/lexical-converter": "6.4.0-beta.4",
|
|
46
|
+
"@webiny/lexical-editor": "6.4.0-beta.4",
|
|
47
|
+
"@webiny/lexical-nodes": "6.4.0-beta.4",
|
|
48
|
+
"@webiny/plugins": "6.4.0-beta.4",
|
|
49
|
+
"@webiny/react-composition": "6.4.0-beta.4",
|
|
50
|
+
"@webiny/react-properties": "6.4.0-beta.4",
|
|
51
|
+
"@webiny/utils": "6.4.0-beta.4",
|
|
52
|
+
"@webiny/validation": "6.4.0-beta.4",
|
|
53
53
|
"apollo-cache": "1.3.5",
|
|
54
54
|
"apollo-client": "2.6.10",
|
|
55
55
|
"apollo-link": "1.2.14",
|
|
@@ -71,14 +71,13 @@
|
|
|
71
71
|
"zod": "4.4.3"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@webiny/build-tools": "6.4.0-beta.
|
|
74
|
+
"@webiny/build-tools": "6.4.0-beta.4",
|
|
75
75
|
"rimraf": "6.1.3",
|
|
76
76
|
"typescript": "6.0.3",
|
|
77
|
-
"vitest": "4.1.
|
|
77
|
+
"vitest": "4.1.7"
|
|
78
78
|
},
|
|
79
79
|
"publishConfig": {
|
|
80
|
-
"access": "public"
|
|
81
|
-
"directory": "dist"
|
|
80
|
+
"access": "public"
|
|
82
81
|
},
|
|
83
82
|
"adio": {
|
|
84
83
|
"ignore": {
|
|
@@ -95,5 +94,8 @@
|
|
|
95
94
|
]
|
|
96
95
|
}
|
|
97
96
|
},
|
|
98
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "8476da73b653c89cc1474d968baf55c1b0ae0e5f",
|
|
98
|
+
"webiny": {
|
|
99
|
+
"publishFrom": "dist"
|
|
100
|
+
}
|
|
99
101
|
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { CmsDynamicZoneTemplate } from "../../../../types.js";
|
|
3
|
-
export interface TemplateCardProps {
|
|
4
|
-
template: CmsDynamicZoneTemplate;
|
|
5
|
-
onTemplate: (template: CmsDynamicZoneTemplate) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare const TemplateItem: (({ template, onTemplate }: TemplateCardProps) => React.JSX.Element) & {
|
|
8
|
-
original: ({ template, onTemplate }: TemplateCardProps) => React.JSX.Element;
|
|
9
|
-
originalName: string;
|
|
10
|
-
displayName: string;
|
|
11
|
-
} & {
|
|
12
|
-
original: (({ template, onTemplate }: TemplateCardProps) => React.JSX.Element) & {
|
|
13
|
-
original: ({ template, onTemplate }: TemplateCardProps) => React.JSX.Element;
|
|
14
|
-
originalName: string;
|
|
15
|
-
displayName: string;
|
|
16
|
-
};
|
|
17
|
-
originalName: string;
|
|
18
|
-
displayName: string;
|
|
19
|
-
} & {
|
|
20
|
-
createDecorator: (decorator: import("@webiny/app-admin").ComponentDecorator<(({ template, onTemplate }: TemplateCardProps) => React.JSX.Element) & {
|
|
21
|
-
original: ({ template, onTemplate }: TemplateCardProps) => React.JSX.Element;
|
|
22
|
-
originalName: string;
|
|
23
|
-
displayName: string;
|
|
24
|
-
}>) => (props: unknown) => React.JSX.Element;
|
|
25
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin/plugins/fieldRenderers/dynamicZone/TemplateItem.js","sources":["../../../../../src/admin/plugins/fieldRenderers/dynamicZone/TemplateItem.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\nimport type { CmsDynamicZoneTemplate } from \"~/types.js\";\nimport { TemplateIcon } from \"~/admin/plugins/fieldRenderers/dynamicZone/TemplateIcon.js\";\nimport { Text, Button } from \"@webiny/admin-ui\";\nimport { Dialog } from \"@webiny/admin-ui\";\nimport { ReactComponent as PlusIcon } from \"@webiny/icons/add_circle_outline.svg\";\n\nexport interface TemplateCardProps {\n template: CmsDynamicZoneTemplate;\n onTemplate: (template: CmsDynamicZoneTemplate) => void;\n}\n\nexport const TemplateItem = makeDecoratable(\n \"TemplateItem\",\n ({ template, onTemplate }: TemplateCardProps) => {\n const [isHovered, setIsHovered] = useState(false);\n\n return (\n <div\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n className={\n \"flex flex-col justify-between bg-neutral-base overflow-hidden rounded-lg w-[173px] relative shadow-sm\"\n }\n >\n <div>\n <div\n className={\n \"flex items-center justify-center py-xxl w-full bg-neutral-dimmed\"\n }\n >\n <TemplateIcon icon={template.icon} style={{ width: 40, height: 40 }} />\n </div>\n <div className={\"py-sm-extra px-md\"}>\n <Text size={\"md\"} className={\"mb-xs text-neutral-primary font-semibold\"}>\n {template.name}\n </Text>\n <Text size={\"sm\"} as={\"div\"} className={\"text-neutral-muted\"}>\n {template.description}\n </Text>\n </div>\n </div>\n\n {isHovered && (\n <Dialog.Close asChild>\n <div\n className=\"absolute inset-0 flex items-center justify-center bg-white/80 cursor-pointer\"\n onClick={() => onTemplate(template)}\n >\n <Button size={\"lg\"} variant=\"primary\" icon={<PlusIcon />}>\n Insert\n </Button>\n </div>\n </Dialog.Close>\n )}\n </div>\n );\n }\n);\n"],"names":["TemplateItem","makeDecoratable","template","onTemplate","isHovered","setIsHovered","useState","TemplateIcon","Text","Dialog","Button","PlusIcon"],"mappings":";;;;;AAaO,MAAMA,eAAeC,gBACxB,gBACA,CAAC,EAAEC,QAAQ,EAAEC,UAAU,EAAqB;IACxC,MAAM,CAACC,WAAWC,aAAa,GAAGC,SAAS;IAE3C,OAAO,WAAP,GACI,oBAAC;QACG,cAAc,IAAMD,aAAa;QACjC,cAAc,IAAMA,aAAa;QACjC,WACI;qBAGJ,oBAAC,2BACG,oBAAC;QACG,WACI;qBAGJ,oBAACE,cAAYA;QAAC,MAAML,SAAS,IAAI;QAAE,OAAO;YAAE,OAAO;YAAI,QAAQ;QAAG;uBAEtE,oBAAC;QAAI,WAAW;qBACZ,oBAACM,MAAIA;QAAC,MAAM;QAAM,WAAW;OACxBN,SAAS,IAAI,iBAElB,oBAACM,MAAIA;QAAC,MAAM;QAAM,IAAI;QAAO,WAAW;OACnCN,SAAS,WAAW,KAKhCE,aAAa,WAAbA,GACG,oBAACK,OAAO,KAAK;QAAC;qBACV,oBAAC;QACG,WAAU;QACV,SAAS,IAAMN,WAAWD;qBAE1B,oBAACQ,QAAMA;QAAC,MAAM;QAAM,SAAQ;QAAU,oBAAM,oBAACC,gBAAQA;OAAK;AAQlF"}
|