@devtools-ui/stacked-view 0.0.2--canary.11.588
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/dist/cjs/index.cjs +85 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/index.legacy-esm.js +47 -0
- package/dist/index.mjs +47 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +40 -0
- package/src/component/index.tsx +20 -0
- package/src/dsl/__tests__/index.test.tsx +54 -0
- package/src/dsl/index.tsx +51 -0
- package/src/index.ts +3 -0
- package/src/types/index.ts +10 -0
- package/types/component/index.d.ts +4 -0
- package/types/dsl/index.d.ts +19 -0
- package/types/index.d.ts +4 -0
- package/types/types/index.d.ts +10 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/stacked-view/src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
StackedView: () => StackedView,
|
|
34
|
+
StackedViewComponent: () => StackedViewComponent
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(src_exports);
|
|
37
|
+
|
|
38
|
+
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/stacked-view/src/component/index.tsx
|
|
39
|
+
var import_react = require("@chakra-ui/react");
|
|
40
|
+
var import_react2 = require("@player-ui/react");
|
|
41
|
+
var import_react3 = __toESM(require("react"));
|
|
42
|
+
var StackedViewComponent = (props) => {
|
|
43
|
+
const { header, main, footer } = props;
|
|
44
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_react.Grid, { h: "100%", w: "100%", gap: "1", templateAreas: '"header" "main" "footer"' }, /* @__PURE__ */ import_react3.default.createElement(import_react.GridItem, { area: "header" }, header && /* @__PURE__ */ import_react3.default.createElement(import_react2.ReactAsset, { ...header })), /* @__PURE__ */ import_react3.default.createElement(import_react.GridItem, { area: "main" }, main && /* @__PURE__ */ import_react3.default.createElement(import_react2.ReactAsset, { ...main })), /* @__PURE__ */ import_react3.default.createElement(import_react.GridItem, { area: "footer" }, footer && /* @__PURE__ */ import_react3.default.createElement(import_react2.ReactAsset, { ...footer })));
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/stacked-view/src/dsl/index.tsx
|
|
48
|
+
var import_react4 = __toESM(require("react"));
|
|
49
|
+
var import_dsl = require("@player-tools/dsl");
|
|
50
|
+
var import_collection = require("@devtools-ui/collection");
|
|
51
|
+
var import_text = require("@devtools-ui/text");
|
|
52
|
+
var StackedView = (props) => {
|
|
53
|
+
const { children, ...rest } = props;
|
|
54
|
+
return /* @__PURE__ */ import_react4.default.createElement(import_dsl.Asset, { type: "stacked-view", ...rest }, children);
|
|
55
|
+
};
|
|
56
|
+
var CollectionComp = (props) => {
|
|
57
|
+
return /* @__PURE__ */ import_react4.default.createElement(import_collection.Collection, null, /* @__PURE__ */ import_react4.default.createElement(import_collection.Collection.Values, null, props.children));
|
|
58
|
+
};
|
|
59
|
+
StackedView.Header = (0, import_dsl.createSlot)({
|
|
60
|
+
name: "header",
|
|
61
|
+
TextComp: import_text.Text,
|
|
62
|
+
CollectionComp,
|
|
63
|
+
isArray: false,
|
|
64
|
+
wrapInAsset: true
|
|
65
|
+
});
|
|
66
|
+
StackedView.Main = (0, import_dsl.createSlot)({
|
|
67
|
+
name: "main",
|
|
68
|
+
TextComp: import_text.Text,
|
|
69
|
+
CollectionComp,
|
|
70
|
+
isArray: false,
|
|
71
|
+
wrapInAsset: true
|
|
72
|
+
});
|
|
73
|
+
StackedView.Footer = (0, import_dsl.createSlot)({
|
|
74
|
+
name: "footer",
|
|
75
|
+
TextComp: import_text.Text,
|
|
76
|
+
CollectionComp,
|
|
77
|
+
isArray: false,
|
|
78
|
+
wrapInAsset: true
|
|
79
|
+
});
|
|
80
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
81
|
+
0 && (module.exports = {
|
|
82
|
+
StackedView,
|
|
83
|
+
StackedViewComponent
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/stacked-view/src/index.ts","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/stacked-view/src/component/index.tsx","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/stacked-view/src/dsl/index.tsx"],"sourcesContent":["export * from \"./types\";\nexport * from \"./component\";\nexport * from \"./dsl\";\n","import { Grid, GridItem } from \"@chakra-ui/react\";\nimport { ReactAsset } from \"@player-ui/react\";\nimport React from \"react\";\nimport type { StackedViewView } from \"../types\";\n\nexport const StackedViewComponent = (props: StackedViewView) => {\n const { header, main, footer } = props;\n\n return (\n <Grid h=\"100%\" w=\"100%\" gap=\"1\" templateAreas={'\"header\" \"main\" \"footer\"'}>\n <GridItem area={\"header\"}>\n {header && <ReactAsset {...header} />}\n </GridItem>\n <GridItem area={\"main\"}>{main && <ReactAsset {...main} />}</GridItem>\n <GridItem area={\"footer\"}>\n {footer && <ReactAsset {...footer} />}\n </GridItem>\n </Grid>\n );\n};\n","import React from \"react\";\nimport { AssetPropsWithChildren, Asset, createSlot } from \"@player-tools/dsl\";\nimport type { Asset as AssetType } from \"@player-ui/player\";\nimport { Collection } from \"@devtools-ui/collection\";\nimport { Text } from \"@devtools-ui/text\";\nimport type { StackedViewView } from \"../types\";\n\n/**\n * Defines the component DSL representation for the StackedView view.\n */\nexport const StackedView = (props: AssetPropsWithChildren<StackedViewView>) => {\n const { children, ...rest } = props;\n\n return (\n <Asset type=\"stacked-view\" {...rest}>\n {children}\n </Asset>\n );\n};\n\nconst CollectionComp = (props: AssetPropsWithChildren<AssetType>) => {\n return (\n <Collection>\n <Collection.Values>{props.children}</Collection.Values>\n </Collection>\n );\n};\n\nStackedView.Header = createSlot({\n name: \"header\",\n TextComp: Text,\n CollectionComp,\n isArray: false,\n wrapInAsset: true,\n});\n\nStackedView.Main = createSlot({\n name: \"main\",\n TextComp: Text,\n CollectionComp,\n isArray: false,\n wrapInAsset: true,\n});\n\nStackedView.Footer = createSlot({\n name: \"footer\",\n TextComp: Text,\n CollectionComp,\n isArray: false,\n wrapInAsset: true,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA+B;AAC/B,IAAAA,gBAA2B;AAC3B,IAAAA,gBAAkB;AAGX,IAAM,uBAAuB,CAAC,UAA2B;AAC9D,QAAM,EAAE,QAAQ,MAAM,OAAO,IAAI;AAEjC,SACE,8BAAAC,QAAA,cAAC,qBAAK,GAAE,QAAO,GAAE,QAAO,KAAI,KAAI,eAAe,8BAC7C,8BAAAA,QAAA,cAAC,yBAAS,MAAM,YACb,UAAU,8BAAAA,QAAA,cAAC,4BAAY,GAAG,QAAQ,CACrC,GACA,8BAAAA,QAAA,cAAC,yBAAS,MAAM,UAAS,QAAQ,8BAAAA,QAAA,cAAC,4BAAY,GAAG,MAAM,CAAG,GAC1D,8BAAAA,QAAA,cAAC,yBAAS,MAAM,YACb,UAAU,8BAAAA,QAAA,cAAC,4BAAY,GAAG,QAAQ,CACrC,CACF;AAEJ;;;ACnBA,IAAAC,gBAAkB;AAClB,iBAA0D;AAE1D,wBAA2B;AAC3B,kBAAqB;AAMd,IAAM,cAAc,CAAC,UAAmD;AAC7E,QAAM,EAAE,UAAU,GAAG,KAAK,IAAI;AAE9B,SACE,8BAAAC,QAAA,cAAC,oBAAM,MAAK,gBAAgB,GAAG,QAC5B,QACH;AAEJ;AAEA,IAAM,iBAAiB,CAAC,UAA6C;AACnE,SACE,8BAAAA,QAAA,cAAC,oCACC,8BAAAA,QAAA,cAAC,6BAAW,QAAX,MAAmB,MAAM,QAAS,CACrC;AAEJ;AAEA,YAAY,aAAS,uBAAW;AAAA,EAC9B,MAAM;AAAA,EACN,UAAU;AAAA,EACV;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AACf,CAAC;AAED,YAAY,WAAO,uBAAW;AAAA,EAC5B,MAAM;AAAA,EACN,UAAU;AAAA,EACV;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AACf,CAAC;AAED,YAAY,aAAS,uBAAW;AAAA,EAC9B,MAAM;AAAA,EACN,UAAU;AAAA,EACV;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AACf,CAAC;","names":["import_react","React","import_react","React"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/stacked-view/src/component/index.tsx
|
|
2
|
+
import { Grid, GridItem } from "@chakra-ui/react";
|
|
3
|
+
import { ReactAsset } from "@player-ui/react";
|
|
4
|
+
import React from "react";
|
|
5
|
+
var StackedViewComponent = (props) => {
|
|
6
|
+
const { header, main, footer } = props;
|
|
7
|
+
return /* @__PURE__ */ React.createElement(Grid, { h: "100%", w: "100%", gap: "1", templateAreas: '"header" "main" "footer"' }, /* @__PURE__ */ React.createElement(GridItem, { area: "header" }, header && /* @__PURE__ */ React.createElement(ReactAsset, { ...header })), /* @__PURE__ */ React.createElement(GridItem, { area: "main" }, main && /* @__PURE__ */ React.createElement(ReactAsset, { ...main })), /* @__PURE__ */ React.createElement(GridItem, { area: "footer" }, footer && /* @__PURE__ */ React.createElement(ReactAsset, { ...footer })));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/stacked-view/src/dsl/index.tsx
|
|
11
|
+
import React2 from "react";
|
|
12
|
+
import { Asset, createSlot } from "@player-tools/dsl";
|
|
13
|
+
import { Collection } from "@devtools-ui/collection";
|
|
14
|
+
import { Text } from "@devtools-ui/text";
|
|
15
|
+
var StackedView = (props) => {
|
|
16
|
+
const { children, ...rest } = props;
|
|
17
|
+
return /* @__PURE__ */ React2.createElement(Asset, { type: "stacked-view", ...rest }, children);
|
|
18
|
+
};
|
|
19
|
+
var CollectionComp = (props) => {
|
|
20
|
+
return /* @__PURE__ */ React2.createElement(Collection, null, /* @__PURE__ */ React2.createElement(Collection.Values, null, props.children));
|
|
21
|
+
};
|
|
22
|
+
StackedView.Header = createSlot({
|
|
23
|
+
name: "header",
|
|
24
|
+
TextComp: Text,
|
|
25
|
+
CollectionComp,
|
|
26
|
+
isArray: false,
|
|
27
|
+
wrapInAsset: true
|
|
28
|
+
});
|
|
29
|
+
StackedView.Main = createSlot({
|
|
30
|
+
name: "main",
|
|
31
|
+
TextComp: Text,
|
|
32
|
+
CollectionComp,
|
|
33
|
+
isArray: false,
|
|
34
|
+
wrapInAsset: true
|
|
35
|
+
});
|
|
36
|
+
StackedView.Footer = createSlot({
|
|
37
|
+
name: "footer",
|
|
38
|
+
TextComp: Text,
|
|
39
|
+
CollectionComp,
|
|
40
|
+
isArray: false,
|
|
41
|
+
wrapInAsset: true
|
|
42
|
+
});
|
|
43
|
+
export {
|
|
44
|
+
StackedView,
|
|
45
|
+
StackedViewComponent
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/stacked-view/src/component/index.tsx
|
|
2
|
+
import { Grid, GridItem } from "@chakra-ui/react";
|
|
3
|
+
import { ReactAsset } from "@player-ui/react";
|
|
4
|
+
import React from "react";
|
|
5
|
+
var StackedViewComponent = (props) => {
|
|
6
|
+
const { header, main, footer } = props;
|
|
7
|
+
return /* @__PURE__ */ React.createElement(Grid, { h: "100%", w: "100%", gap: "1", templateAreas: '"header" "main" "footer"' }, /* @__PURE__ */ React.createElement(GridItem, { area: "header" }, header && /* @__PURE__ */ React.createElement(ReactAsset, { ...header })), /* @__PURE__ */ React.createElement(GridItem, { area: "main" }, main && /* @__PURE__ */ React.createElement(ReactAsset, { ...main })), /* @__PURE__ */ React.createElement(GridItem, { area: "footer" }, footer && /* @__PURE__ */ React.createElement(ReactAsset, { ...footer })));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/stacked-view/src/dsl/index.tsx
|
|
11
|
+
import React2 from "react";
|
|
12
|
+
import { Asset, createSlot } from "@player-tools/dsl";
|
|
13
|
+
import { Collection } from "@devtools-ui/collection";
|
|
14
|
+
import { Text } from "@devtools-ui/text";
|
|
15
|
+
var StackedView = (props) => {
|
|
16
|
+
const { children, ...rest } = props;
|
|
17
|
+
return /* @__PURE__ */ React2.createElement(Asset, { type: "stacked-view", ...rest }, children);
|
|
18
|
+
};
|
|
19
|
+
var CollectionComp = (props) => {
|
|
20
|
+
return /* @__PURE__ */ React2.createElement(Collection, null, /* @__PURE__ */ React2.createElement(Collection.Values, null, props.children));
|
|
21
|
+
};
|
|
22
|
+
StackedView.Header = createSlot({
|
|
23
|
+
name: "header",
|
|
24
|
+
TextComp: Text,
|
|
25
|
+
CollectionComp,
|
|
26
|
+
isArray: false,
|
|
27
|
+
wrapInAsset: true
|
|
28
|
+
});
|
|
29
|
+
StackedView.Main = createSlot({
|
|
30
|
+
name: "main",
|
|
31
|
+
TextComp: Text,
|
|
32
|
+
CollectionComp,
|
|
33
|
+
isArray: false,
|
|
34
|
+
wrapInAsset: true
|
|
35
|
+
});
|
|
36
|
+
StackedView.Footer = createSlot({
|
|
37
|
+
name: "footer",
|
|
38
|
+
TextComp: Text,
|
|
39
|
+
CollectionComp,
|
|
40
|
+
isArray: false,
|
|
41
|
+
wrapInAsset: true
|
|
42
|
+
});
|
|
43
|
+
export {
|
|
44
|
+
StackedView,
|
|
45
|
+
StackedViewComponent
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/stacked-view/src/component/index.tsx","../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/stacked-view/src/dsl/index.tsx"],"sourcesContent":["import { Grid, GridItem } from \"@chakra-ui/react\";\nimport { ReactAsset } from \"@player-ui/react\";\nimport React from \"react\";\nimport type { StackedViewView } from \"../types\";\n\nexport const StackedViewComponent = (props: StackedViewView) => {\n const { header, main, footer } = props;\n\n return (\n <Grid h=\"100%\" w=\"100%\" gap=\"1\" templateAreas={'\"header\" \"main\" \"footer\"'}>\n <GridItem area={\"header\"}>\n {header && <ReactAsset {...header} />}\n </GridItem>\n <GridItem area={\"main\"}>{main && <ReactAsset {...main} />}</GridItem>\n <GridItem area={\"footer\"}>\n {footer && <ReactAsset {...footer} />}\n </GridItem>\n </Grid>\n );\n};\n","import React from \"react\";\nimport { AssetPropsWithChildren, Asset, createSlot } from \"@player-tools/dsl\";\nimport type { Asset as AssetType } from \"@player-ui/player\";\nimport { Collection } from \"@devtools-ui/collection\";\nimport { Text } from \"@devtools-ui/text\";\nimport type { StackedViewView } from \"../types\";\n\n/**\n * Defines the component DSL representation for the StackedView view.\n */\nexport const StackedView = (props: AssetPropsWithChildren<StackedViewView>) => {\n const { children, ...rest } = props;\n\n return (\n <Asset type=\"stacked-view\" {...rest}>\n {children}\n </Asset>\n );\n};\n\nconst CollectionComp = (props: AssetPropsWithChildren<AssetType>) => {\n return (\n <Collection>\n <Collection.Values>{props.children}</Collection.Values>\n </Collection>\n );\n};\n\nStackedView.Header = createSlot({\n name: \"header\",\n TextComp: Text,\n CollectionComp,\n isArray: false,\n wrapInAsset: true,\n});\n\nStackedView.Main = createSlot({\n name: \"main\",\n TextComp: Text,\n CollectionComp,\n isArray: false,\n wrapInAsset: true,\n});\n\nStackedView.Footer = createSlot({\n name: \"footer\",\n TextComp: Text,\n CollectionComp,\n isArray: false,\n wrapInAsset: true,\n});\n"],"mappings":";AAAA,SAAS,MAAM,gBAAgB;AAC/B,SAAS,kBAAkB;AAC3B,OAAO,WAAW;AAGX,IAAM,uBAAuB,CAAC,UAA2B;AAC9D,QAAM,EAAE,QAAQ,MAAM,OAAO,IAAI;AAEjC,SACE,oCAAC,QAAK,GAAE,QAAO,GAAE,QAAO,KAAI,KAAI,eAAe,8BAC7C,oCAAC,YAAS,MAAM,YACb,UAAU,oCAAC,cAAY,GAAG,QAAQ,CACrC,GACA,oCAAC,YAAS,MAAM,UAAS,QAAQ,oCAAC,cAAY,GAAG,MAAM,CAAG,GAC1D,oCAAC,YAAS,MAAM,YACb,UAAU,oCAAC,cAAY,GAAG,QAAQ,CACrC,CACF;AAEJ;;;ACnBA,OAAOA,YAAW;AAClB,SAAiC,OAAO,kBAAkB;AAE1D,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AAMd,IAAM,cAAc,CAAC,UAAmD;AAC7E,QAAM,EAAE,UAAU,GAAG,KAAK,IAAI;AAE9B,SACE,gBAAAA,OAAA,cAAC,SAAM,MAAK,gBAAgB,GAAG,QAC5B,QACH;AAEJ;AAEA,IAAM,iBAAiB,CAAC,UAA6C;AACnE,SACE,gBAAAA,OAAA,cAAC,kBACC,gBAAAA,OAAA,cAAC,WAAW,QAAX,MAAmB,MAAM,QAAS,CACrC;AAEJ;AAEA,YAAY,SAAS,WAAW;AAAA,EAC9B,MAAM;AAAA,EACN,UAAU;AAAA,EACV;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AACf,CAAC;AAED,YAAY,OAAO,WAAW;AAAA,EAC5B,MAAM;AAAA,EACN,UAAU;AAAA,EACV;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AACf,CAAC;AAED,YAAY,SAAS,WAAW;AAAA,EAC9B,MAAM;AAAA,EACN,UAAU;AAAA,EACV;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AACf,CAAC;","names":["React"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@devtools-ui/stacked-view",
|
|
3
|
+
"version": "0.0.2--canary.11.588",
|
|
4
|
+
"main": "dist/cjs/index.cjs",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@devtools-ui/text": "0.0.2--canary.11.588",
|
|
7
|
+
"@devtools-ui/collection": "0.0.2--canary.11.588",
|
|
8
|
+
"@chakra-ui/react": "^2.8.2",
|
|
9
|
+
"@emotion/react": "^11.11.4",
|
|
10
|
+
"@emotion/styled": "^11.11.0",
|
|
11
|
+
"@player-tools/dsl": "0.5.2--canary.87.2261",
|
|
12
|
+
"@player-ui/asset-transform-plugin": "^0.7.1",
|
|
13
|
+
"@player-ui/player": "0.7.1",
|
|
14
|
+
"@player-ui/react": "^0.7.1",
|
|
15
|
+
"@player-ui/types": "0.7.1",
|
|
16
|
+
"@types/react": "^18.2.51",
|
|
17
|
+
"dlv": "^1.1.3",
|
|
18
|
+
"eslint-plugin-storybook": "^0.8.0",
|
|
19
|
+
"framer-motion": "^11.0.8",
|
|
20
|
+
"react": "^18.2.0",
|
|
21
|
+
"tslib": "^2.6.2"
|
|
22
|
+
},
|
|
23
|
+
"module": "dist/index.legacy-esm.js",
|
|
24
|
+
"types": "types/index.d.ts",
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"exports": {
|
|
27
|
+
"./package.json": "./package.json",
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./types/index.d.ts",
|
|
30
|
+
"import": "./dist/index.mjs",
|
|
31
|
+
"default": "./dist/cjs/index.cjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"src",
|
|
37
|
+
"types"
|
|
38
|
+
],
|
|
39
|
+
"peerDependencies": {}
|
|
40
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Grid, GridItem } from "@chakra-ui/react";
|
|
2
|
+
import { ReactAsset } from "@player-ui/react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import type { StackedViewView } from "../types";
|
|
5
|
+
|
|
6
|
+
export const StackedViewComponent = (props: StackedViewView) => {
|
|
7
|
+
const { header, main, footer } = props;
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<Grid h="100%" w="100%" gap="1" templateAreas={'"header" "main" "footer"'}>
|
|
11
|
+
<GridItem area={"header"}>
|
|
12
|
+
{header && <ReactAsset {...header} />}
|
|
13
|
+
</GridItem>
|
|
14
|
+
<GridItem area={"main"}>{main && <ReactAsset {...main} />}</GridItem>
|
|
15
|
+
<GridItem area={"footer"}>
|
|
16
|
+
{footer && <ReactAsset {...footer} />}
|
|
17
|
+
</GridItem>
|
|
18
|
+
</Grid>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe, expect, test } from "vitest";
|
|
3
|
+
import { render, Asset } from "@player-tools/dsl";
|
|
4
|
+
import { StackedView } from "../";
|
|
5
|
+
|
|
6
|
+
describe("DSL: StackedView", () => {
|
|
7
|
+
test("Renders stacked-view view", async () => {
|
|
8
|
+
const rendered = await render(
|
|
9
|
+
<StackedView>
|
|
10
|
+
<StackedView.Header>
|
|
11
|
+
<Asset type="text">
|
|
12
|
+
<property name="value">Header</property>
|
|
13
|
+
</Asset>
|
|
14
|
+
</StackedView.Header>
|
|
15
|
+
<StackedView.Main>
|
|
16
|
+
<Asset type="text">
|
|
17
|
+
<property name="value">Main</property>
|
|
18
|
+
</Asset>
|
|
19
|
+
</StackedView.Main>
|
|
20
|
+
<StackedView.Footer>
|
|
21
|
+
<Asset type="text">
|
|
22
|
+
<property name="value">Footer</property>
|
|
23
|
+
</Asset>
|
|
24
|
+
</StackedView.Footer>
|
|
25
|
+
</StackedView>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
expect(rendered.jsonValue).toStrictEqual({
|
|
29
|
+
id: "root",
|
|
30
|
+
type: "stacked-view",
|
|
31
|
+
header: {
|
|
32
|
+
asset: {
|
|
33
|
+
id: "header",
|
|
34
|
+
type: "text",
|
|
35
|
+
value: "Header",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
main: {
|
|
39
|
+
asset: {
|
|
40
|
+
id: "main",
|
|
41
|
+
type: "text",
|
|
42
|
+
value: "Main",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
footer: {
|
|
46
|
+
asset: {
|
|
47
|
+
id: "footer",
|
|
48
|
+
type: "text",
|
|
49
|
+
value: "Footer",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AssetPropsWithChildren, Asset, createSlot } from "@player-tools/dsl";
|
|
3
|
+
import type { Asset as AssetType } from "@player-ui/player";
|
|
4
|
+
import { Collection } from "@devtools-ui/collection";
|
|
5
|
+
import { Text } from "@devtools-ui/text";
|
|
6
|
+
import type { StackedViewView } from "../types";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Defines the component DSL representation for the StackedView view.
|
|
10
|
+
*/
|
|
11
|
+
export const StackedView = (props: AssetPropsWithChildren<StackedViewView>) => {
|
|
12
|
+
const { children, ...rest } = props;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Asset type="stacked-view" {...rest}>
|
|
16
|
+
{children}
|
|
17
|
+
</Asset>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const CollectionComp = (props: AssetPropsWithChildren<AssetType>) => {
|
|
22
|
+
return (
|
|
23
|
+
<Collection>
|
|
24
|
+
<Collection.Values>{props.children}</Collection.Values>
|
|
25
|
+
</Collection>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
StackedView.Header = createSlot({
|
|
30
|
+
name: "header",
|
|
31
|
+
TextComp: Text,
|
|
32
|
+
CollectionComp,
|
|
33
|
+
isArray: false,
|
|
34
|
+
wrapInAsset: true,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
StackedView.Main = createSlot({
|
|
38
|
+
name: "main",
|
|
39
|
+
TextComp: Text,
|
|
40
|
+
CollectionComp,
|
|
41
|
+
isArray: false,
|
|
42
|
+
wrapInAsset: true,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
StackedView.Footer = createSlot({
|
|
46
|
+
name: "footer",
|
|
47
|
+
TextComp: Text,
|
|
48
|
+
CollectionComp,
|
|
49
|
+
isArray: false,
|
|
50
|
+
wrapInAsset: true,
|
|
51
|
+
});
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AssetPropsWithChildren } from "@player-tools/dsl";
|
|
3
|
+
import type { StackedViewView } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Defines the component DSL representation for the StackedView view.
|
|
6
|
+
*/
|
|
7
|
+
export declare const StackedView: {
|
|
8
|
+
(props: AssetPropsWithChildren<StackedViewView>): React.JSX.Element;
|
|
9
|
+
Header: (props: {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}) => React.JSX.Element;
|
|
12
|
+
Main: (props: {
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
}) => React.JSX.Element;
|
|
15
|
+
Footer: (props: {
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
}) => React.JSX.Element;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Asset, AssetWrapper, View } from "@player-ui/types";
|
|
2
|
+
export interface StackedViewView extends View<Asset<"info">> {
|
|
3
|
+
/** Header */
|
|
4
|
+
header?: AssetWrapper;
|
|
5
|
+
/** Main */
|
|
6
|
+
main?: AssetWrapper;
|
|
7
|
+
/** Footer */
|
|
8
|
+
footer?: AssetWrapper;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|