@telia-ace/widget-components-grid 1.0.31-next.3 → 1.0.31-next.5
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/{grid.522492da.js → grid-7f65dd18.js} +2 -2
- package/dist/{grid.522492da.js.map → grid-7f65dd18.js.map} +1 -1
- package/dist/{index.d20eda4d.js → index-a4b48ced.js} +3 -3
- package/dist/{index.d20eda4d.js.map → index-a4b48ced.js.map} +1 -1
- package/dist/index.js +1 -1
- package/package.json +7 -7
|
@@ -4,7 +4,7 @@ import { css as s } from "@emotion/react";
|
|
|
4
4
|
import l from "@emotion/styled";
|
|
5
5
|
import { Component as g } from "@telia-ace/widget-types-grid";
|
|
6
6
|
import { appendClassNames as u } from "@telia-ace/widget-utilities";
|
|
7
|
-
import { i as f } from "./index.
|
|
7
|
+
import { i as f } from "./index-a4b48ced.js";
|
|
8
8
|
import "@telia-ace/widget-core";
|
|
9
9
|
const $ = (e) => {
|
|
10
10
|
const r = e.map((t) => "min-content").join(" "), n = e[0].split(" ").map((t) => "1fr").join(" "), a = e.map((t) => `'${t}'`).join(" ");
|
|
@@ -76,4 +76,4 @@ const $ = (e) => {
|
|
|
76
76
|
export {
|
|
77
77
|
w as default
|
|
78
78
|
};
|
|
79
|
-
//# sourceMappingURL=grid.
|
|
79
|
+
//# sourceMappingURL=grid-7f65dd18.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.
|
|
1
|
+
{"version":3,"file":"grid-7f65dd18.js","sources":["../src/utils.ts","../src/nested-grid-area.tsx","../src/grid.tsx"],"sourcesContent":["import { css } from '@emotion/react';\n\nexport const generateGridTemplateAreasValue = (template: string[]) => {\n const rows = template.map((_) => 'min-content').join(' ');\n const columns = template[0]\n .split(' ')\n .map((_) => '1fr')\n .join(' ');\n const areas = template.map((value) => `'${value}'`).join(' ');\n\n return css`\n grid-template-columns: ${columns};\n grid-template-rows: ${rows};\n grid-template-areas: ${areas};\n `;\n};\n","import { css } from '@emotion/react';\nimport styled from '@emotion/styled';\nimport { Component } from '@telia-ace/widget-types-grid';\nimport { useChildren } from '@telia-ace/widget-ui';\nimport { appendClassNames } from '@telia-ace/widget-utilities';\nimport React, { useMemo } from 'react';\nimport { GridAreaProps, isNestedGrid, NestedArea } from './grid-component';\nimport { generateGridTemplateAreasValue } from './utils';\n\ntype Props = {\n className?: string;\n gridArea?: string;\n} & NestedArea;\nconst NestedGridArea: React.FC<Props> = (props) => {\n const children = useChildren();\n\n const areas = useMemo<(GridAreaProps & { name: string })[]>(() => {\n return Object.entries(props.areas).map(([key, area]) => {\n const componentDef = children.find((child) => child.name === key);\n\n if (!isNestedGrid(area)) {\n return {\n name: key,\n componentDef,\n areaSettings: area.areaSettings,\n child: area.child,\n context: area.context,\n };\n }\n return {\n name: key,\n componentDef,\n context: area.context,\n areaSettings: area.areaSettings,\n template: area.template,\n areas: area.areas,\n gap: area.gap,\n };\n });\n }, [props, children]);\n\n return (\n <Wrapper\n data-grid-area={props.gridArea}\n gridArea={props.gridArea}\n gap={props.gap}\n template={props.template}\n className={appendClassNames(props.className, 'humany-grid')}\n >\n {areas.map((area) => {\n if (!(area as any).componentDef) {\n return null;\n }\n return (\n <Component\n key={(area as any).componentDef.id}\n id={(area as any).componentDef.id}\n branch=\"default\"\n context={{}}\n />\n );\n })}\n </Wrapper>\n );\n};\n\nexport default NestedGridArea;\n\nconst Wrapper = styled.div<{\n template: string[];\n gridArea?: string;\n gap?: number;\n}>`\n display: grid;\n ${(p) =>\n p.gridArea &&\n css`\n grid-area: ${p.gridArea};\n `}\n ${(p) => generateGridTemplateAreasValue(p.template)}\n ${(p) =>\n p.gap &&\n css`\n grid-gap: ${p.gap}rem;\n `}\n`;\n","import { useProperties } from '@telia-ace/widget-ui';\nimport React from 'react';\nimport { GridComponentProps } from './grid-component';\nimport NestedGridArea from './nested-grid-area';\n\ntype Props = { className?: string };\nconst Grid: React.FC<Props> = ({ className }) => {\n const properties = useProperties<GridComponentProps>();\n return (\n <NestedGridArea\n template={properties.template}\n areas={properties.areas}\n gap={properties.gap}\n areaSettings={properties.areaSettings}\n context={properties.context}\n />\n );\n};\n\nexport default Grid;\n"],"names":["generateGridTemplateAreasValue","template","rows","_","columns","areas","value","css","NestedGridArea","props","children","useChildren","useMemo","key","area","componentDef","child","isNestedGrid","React","Wrapper","appendClassNames","Component","NestedGridArea$1","styled","p","Grid","className","properties","useProperties"],"mappings":";;;;;;;;AAEa,MAAAA,IAAiC,CAACC,MAAuB;AAC5D,QAAAC,IAAOD,EAAS,IAAI,CAACE,MAAM,aAAa,EAAE,KAAK,GAAG,GAClDC,IAAUH,EAAS,CAAC,EACrB,MAAM,GAAG,EACT,IAAI,CAACE,MAAM,KAAK,EAChB,KAAK,GAAG,GACPE,IAAQJ,EAAS,IAAI,CAACK,MAAU,IAAIA,IAAQ,EAAE,KAAK,GAAG;AAErD,SAAAC;AAAA,iCACsBH;AAAA,8BACHF;AAAA,+BACCG;AAAA;AAE/B,GCFMG,IAAkC,CAACC,MAAU;AAC/C,QAAMC,IAAWC,KAEXN,IAAQO,EAA8C,MACjD,OAAO,QAAQH,EAAM,KAAK,EAAE,IAAI,CAAC,CAACI,GAAKC,CAAI,MAAM;AACpD,UAAMC,IAAeL,EAAS,KAAK,CAACM,MAAUA,EAAM,SAASH,CAAG;AAE5D,WAACI,EAAaH,CAAI,IASf;AAAA,MACH,MAAMD;AAAA,MACN,cAAAE;AAAA,MACA,SAASD,EAAK;AAAA,MACd,cAAcA,EAAK;AAAA,MACnB,UAAUA,EAAK;AAAA,MACf,OAAOA,EAAK;AAAA,MACZ,KAAKA,EAAK;AAAA,IAAA,IAfH;AAAA,MACH,MAAMD;AAAA,MACN,cAAAE;AAAA,MACA,cAAcD,EAAK;AAAA,MACnB,OAAOA,EAAK;AAAA,MACZ,SAASA,EAAK;AAAA,IAAA;AAAA,EAWtB,CACH,GACF,CAACL,GAAOC,CAAQ,CAAC;AAGhB,SAAA,gBAAAQ,EAAA;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,kBAAgBV,EAAM;AAAA,MACtB,UAAUA,EAAM;AAAA,MAChB,KAAKA,EAAM;AAAA,MACX,UAAUA,EAAM;AAAA,MAChB,WAAWW,EAAiBX,EAAM,WAAW,aAAa;AAAA,IAAA;AAAA,IAEzDJ,EAAM,IAAI,CAACS,MACFA,EAAa,eAIf,gBAAAI,EAAA;AAAA,MAACG;AAAA,MAAA;AAAA,QACG,KAAMP,EAAa,aAAa;AAAA,QAChC,IAAKA,EAAa,aAAa;AAAA,QAC/B,QAAO;AAAA,QACP,SAAS,CAAC;AAAA,MAAA;AAAA,IAAA,IAPP,IAUd;AAAA,EAAA;AAGb,GAEAQ,IAAed,GAETW,IAAUI,EAAO;AAAA;AAAA,MAMjB,CAACC,MACCA,EAAE,YACFjB;AAAA,yBACiBiB,EAAE;AAAA;AAAA,MAErB,CAACA,MAAMxB,EAA+BwB,EAAE,QAAQ;AAAA,IAClD,CAACA,MACGA,EAAE,OACFjB;AAAA,wBACgBiB,EAAE;AAAA;AAAA,GC7EpBC,IAAwB,CAAC,EAAE,WAAAC,QAAgB;AAC7C,QAAMC,IAAaC;AAEf,SAAA,gBAAAV,EAAA;AAAA,IAACV;AAAAA,IAAA;AAAA,MACG,UAAUmB,EAAW;AAAA,MACrB,OAAOA,EAAW;AAAA,MAClB,KAAKA,EAAW;AAAA,MAChB,cAAcA,EAAW;AAAA,MACzB,SAASA,EAAW;AAAA,IAAA;AAAA,EAAA;AAGhC;"}
|
|
@@ -12,7 +12,7 @@ var u = (t, o, r) => o in t ? j(t, o, { enumerable: !0, configurable: !0, writab
|
|
|
12
12
|
import { createReactComponent as I } from "@telia-ace/widget-ui";
|
|
13
13
|
import { createChildren as b } from "@telia-ace/widget-core";
|
|
14
14
|
import { Logger as L } from "@telia-ace/widget-utilities";
|
|
15
|
-
const V = (t) => !!t.template, P = (t) => I(t, "grid", import("./grid.
|
|
15
|
+
const V = (t) => !!t.template, P = (t) => I(t, "grid", import("./grid-7f65dd18.js"), (o) => {
|
|
16
16
|
}), _ = P, q = (t, o) => {
|
|
17
17
|
var m, g, x, l;
|
|
18
18
|
const { platform: r, node: w, references: $, definitions: a, views: f, branch: N } = o, e = a[t.definitionId];
|
|
@@ -24,7 +24,7 @@ const V = (t) => !!t.template, P = (t) => I(t, "grid", import("./grid.522492da.j
|
|
|
24
24
|
if (i.name = t.definitionId, i.tags = e.tags || [], e.properties && i.writeProperties(e.properties), e.context && i.writeContext(e.context), e.layout && i.writeLayout(e.layout), w.appendChild(i, N), t.overrides.forEach((n) => {
|
|
25
25
|
const p = { breakpoints: n.breakpoints };
|
|
26
26
|
n.properties && i.writeProperties(n.properties, p), n.context && i.writeContext(n.context, p), n.layout && i.writeLayout(n.layout, p);
|
|
27
|
-
}), (
|
|
27
|
+
}), (m = e.properties) != null && m.areas && ((g = e.properties) != null && g.areas)) {
|
|
28
28
|
const n = Object.entries(e.properties.areas).reduce(
|
|
29
29
|
(p, [c, s]) => {
|
|
30
30
|
if (s.child) {
|
|
@@ -71,4 +71,4 @@ export {
|
|
|
71
71
|
q as g,
|
|
72
72
|
V as i
|
|
73
73
|
};
|
|
74
|
-
//# sourceMappingURL=index.
|
|
74
|
+
//# sourceMappingURL=index-a4b48ced.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.
|
|
1
|
+
{"version":3,"file":"index-a4b48ced.js","sources":["../src/grid-component.ts","../src/handler.ts"],"sourcesContent":["import { createReactComponent } from '@telia-ace/widget-ui';\nimport { Container } from '@webprovisions/platform';\n\ntype AreaWithChild = {\n child: string;\n areaSettings: { [key: string]: string };\n context: { [key: string]: any };\n};\n\nexport type NestedArea = {\n context: { [key: string]: any };\n template: string[];\n areaSettings: { [key: string]: string };\n gap: number;\n areas: {\n [key: string]: GridAreaProps;\n };\n};\n\nexport type GridAreaProps = NestedArea | AreaWithChild;\n\nexport const isNestedGrid = (area: GridAreaProps): area is NestedArea => {\n return !!(area as NestedArea).template;\n};\n\nexport type GridComponentProps = {\n gap: number;\n template: string[];\n areaSettings: { [key: string]: string };\n areas: {\n [key: string]: GridAreaProps;\n };\n child: string;\n context: { [key: string]: any };\n};\n\nexport const GridComponent = (container: Container) => {\n return createReactComponent(container, 'grid', import('./grid'), (component) => {});\n};\n\nexport default GridComponent;\n","import {\n ComponentHandlerOptions,\n createChildren,\n NormalizedComponentReference,\n} from '@telia-ace/widget-core';\nimport { Logger } from '@telia-ace/widget-utilities';\n\nexport const gridComponentHandler = (\n childRef: NormalizedComponentReference,\n options: ComponentHandlerOptions\n) => {\n const { platform, node, references, definitions, views, branch } = options;\n\n const childDef = definitions[childRef.definitionId];\n if (process.env.NODE_ENV !== 'production') {\n if (!childDef) {\n Logger.error(`No definition found for component type '${childRef.definitionId}'.`);\n return;\n }\n }\n const childNode = platform.createNode(childDef.type);\n childNode.name = childRef.definitionId;\n childNode.tags = childDef.tags || [];\n if (childDef.properties) {\n childNode.writeProperties(childDef.properties);\n }\n if (childDef.context) {\n childNode.writeContext(childDef.context);\n }\n if (childDef.layout) {\n childNode.writeLayout(childDef.layout);\n }\n node.appendChild(childNode, branch);\n\n childRef.overrides.forEach((override) => {\n const options = { breakpoints: override.breakpoints };\n if (override.properties) {\n childNode.writeProperties(override.properties, options);\n }\n if (override.context) {\n childNode.writeContext(override.context, options);\n }\n if (override.layout) {\n childNode.writeLayout(override.layout, options);\n }\n });\n\n if (childDef.properties?.areas && !!childDef.properties?.areas) {\n const mergedDefinitons: any = Object.entries(childDef.properties.areas).reduce<any>(\n (acc, [key, value]: any) => {\n if (value.child) {\n const cssProps = Object.entries<string>(value.areaSettings || {}).reduce<{\n [key: string]: string;\n }>((acc, [key, value]) => {\n acc[`css-${key}`] = value;\n\n return acc;\n }, {});\n acc[key] = {\n type: 'area',\n context: value.context || {},\n children: [value.child],\n properties: {\n 'css-grid-area': key,\n ...cssProps,\n },\n };\n } else {\n const subgrid = {\n type: 'grid',\n context: {},\n properties: {\n areaSettings: {},\n areas: value.areas,\n context: value.context,\n gap: value.gap,\n gridArea: value.gridArea,\n template: value.template,\n },\n };\n acc[key] = subgrid;\n }\n return acc;\n },\n definitions\n );\n createChildren(\n platform,\n childNode,\n Object.keys(childDef.properties.areas),\n mergedDefinitons,\n views\n );\n } else if (childDef.properties?.child) {\n createChildren(platform, childNode, [childDef.properties?.child], definitions, views);\n }\n};\n"],"names":["isNestedGrid","area","GridComponent","container","createReactComponent","component","GridComponent$1","gridComponentHandler","childRef","options","platform","node","references","definitions","views","branch","childDef","Logger","childNode","override","_a","_b","mergedDefinitons","acc","key","value","cssProps","__spreadValues","subgrid","createChildren","_c","_d"],"mappings":";;;;;;;;;;;;;;AAqBa,MAAAA,IAAe,CAACC,MAClB,CAAC,CAAEA,EAAoB,UAcrBC,IAAgB,CAACC,MACnBC,EAAqBD,GAAW,QAAQ,OAAO,oBAAQ,GAAG,CAACE,MAAc;AAAA,CAAE,GAGtFC,IAAeJ,GCjCFK,IAAuB,CAChCC,GACAC,MACC;;AACD,QAAM,EAAE,UAAAC,GAAU,MAAAC,GAAM,YAAAC,GAAY,aAAAC,GAAa,OAAAC,GAAO,QAAAC,EAAW,IAAAN,GAE7DO,IAAWH,EAAYL,EAAS,YAAY;AAC9C,MAAA,QAAQ,IAAI,aAAa,gBACrB,CAACQ,GAAU;AACJ,IAAAC,EAAA,MAAM,2CAA2CT,EAAS,gBAAgB;AACjF;AAAA;AAGR,QAAMU,IAAYR,EAAS,WAAWM,EAAS,IAAI;AA2BnD,MA1BAE,EAAU,OAAOV,EAAS,cAChBU,EAAA,OAAOF,EAAS,QAAQ,CAAA,GAC9BA,EAAS,cACCE,EAAA,gBAAgBF,EAAS,UAAU,GAE7CA,EAAS,WACCE,EAAA,aAAaF,EAAS,OAAO,GAEvCA,EAAS,UACCE,EAAA,YAAYF,EAAS,MAAM,GAEpCL,EAAA,YAAYO,GAAWH,CAAM,GAEzBP,EAAA,UAAU,QAAQ,CAACW,MAAa;AACrC,UAAMV,I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R;AAAA,IAAA;AAAA;AAER,KAAWgB,IAAAd,EAAS,eAAT,QAAAc,EAAqB,SACbD,EAAAnB,GAAUQ,GAAW,EAACa,IAAAf,EAAS,eAAT,gBAAAe,EAAqB,KAAK,GAAGlB,GAAaC,CAAK;AAE5F;"}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/widget-components-grid",
|
|
3
|
-
"version": "1.0.31-next.
|
|
3
|
+
"version": "1.0.31-next.5",
|
|
4
4
|
"description": "Grid component for ACE Widgets.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
},
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@telia-ace/widget-core": "1.0.26-next.
|
|
25
|
-
"@telia-ace/widget-types-grid": "1.0.35-next.
|
|
26
|
-
"@telia-ace/widget-ui": "1.0.33-next.
|
|
27
|
-
"@telia-ace/widget-utilities": "1.0.15-next.
|
|
28
|
-
"@webprovisions/platform": "^1.1.
|
|
24
|
+
"@telia-ace/widget-core": "1.0.26-next.5",
|
|
25
|
+
"@telia-ace/widget-types-grid": "1.0.35-next.5",
|
|
26
|
+
"@telia-ace/widget-ui": "1.0.33-next.5",
|
|
27
|
+
"@telia-ace/widget-utilities": "1.0.15-next.5",
|
|
28
|
+
"@webprovisions/platform": "^1.1.3-rc.3"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@emotion/react": "^11.10.5",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@emotion/react": "^11.10.5",
|
|
38
38
|
"@emotion/styled": "^11.10.5",
|
|
39
|
-
"@telia-ace/widget-developer-tools": "1.0.21-next.
|
|
39
|
+
"@telia-ace/widget-developer-tools": "1.0.21-next.5",
|
|
40
40
|
"@types/react": "^18.0.27",
|
|
41
41
|
"@types/react-dom": "^18.0.10",
|
|
42
42
|
"react": "^18.2.0",
|