@telia-ace/widget-types-grid 1.0.15 → 1.0.18

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.8763910e.js","sources":["../src/ui/use-router.ts","../src/ui/wrapper.tsx","../src/ui/render.tsx"],"sourcesContent":["import { RoutingService } from '@telia-ace/widget-routing';\r\nimport { useIsMounted } from '@telia-ace/widget-ui';\r\nimport { Container } from '@webprovisions/platform';\r\nimport { useEffect, useState } from 'react';\r\n\r\nexport default (container: Container): RoutingService | null => {\r\n const [router, setRouter] = useState<RoutingService | null>(null);\r\n const isMounted = useIsMounted();\r\n\r\n useEffect(() => {\r\n container.getAsync('router').then((router: RoutingService) => {\r\n if (isMounted.current) {\r\n setRouter(router);\r\n }\r\n });\r\n }, [container, isMounted]);\r\n\r\n return router;\r\n};\r\n","import { ContainerContext, RoutingContext, useComponentPlatform } from '@telia-ace/widget-ui';\r\nimport { appendClassNames } from '@telia-ace/widget-utilities';\r\nimport { Container } from '@webprovisions/platform';\r\nimport React, { useEffect, useState } from 'react';\r\nimport { Router } from 'react-router-dom';\r\nimport Component from './component';\r\nimport useRouter from './use-router';\r\n\r\nconst keyNavigationKeys = ['Tab', 'ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft'];\r\n\r\ntype Props = {\r\n container: Container;\r\n};\r\n\r\nconst Wrapper: React.SFC<Props> = ({ container }) => {\r\n const components = useComponentPlatform(container);\r\n const router = useRouter(container);\r\n const env = container.get('$environment');\r\n const [isTabbing, setIsTabbing] = useState(env?.container.get('isTabbing') || false);\r\n const [entry, setEntry] = useState<string | null>(null);\r\n\r\n useEffect(() => {\r\n const keydown = (event: KeyboardEvent) => {\r\n if (keyNavigationKeys.indexOf(event.key) > -1) {\r\n if (!isTabbing) {\r\n env?.container.register('isTabbing', true);\r\n }\r\n setIsTabbing(true);\r\n }\r\n };\r\n const click = (event: any) => {\r\n if (event.screenX === 0 && event.screenY === 0) {\r\n return;\r\n }\r\n if (isTabbing) {\r\n env?.container.register('isTabbing', false);\r\n }\r\n setIsTabbing(false);\r\n };\r\n window.addEventListener('keydown', keydown);\r\n window.addEventListener('click', click);\r\n return () => {\r\n window.removeEventListener('keydown', keydown);\r\n window.removeEventListener('click', click);\r\n };\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (components) {\r\n setEntry(components.nodes.root.children.default[0].id || null);\r\n const unsubscribe = components.events.subscribe(\r\n 'components:root-children-changed',\r\n (event, { node }) => {\r\n if (node.parent && node.parent.type === 'root') {\r\n const entry = node.parent.children.default[0].id;\r\n setEntry(entry);\r\n }\r\n }\r\n );\r\n\r\n return unsubscribe;\r\n }\r\n }, [components]);\r\n\r\n if (!router || !router.history || !components) {\r\n return null;\r\n }\r\n\r\n if (!entry) {\r\n return null;\r\n }\r\n\r\n return (\r\n <Router history={router.history}>\r\n <ContainerContext.Provider value={container}>\r\n <RoutingContext.Provider value={router}>\r\n <Component\r\n className={appendClassNames([isTabbing, 'humany-is-tabbing'])}\r\n isTabbing={isTabbing}\r\n id={entry}\r\n branch=\"default\"\r\n />\r\n </RoutingContext.Provider>\r\n </ContainerContext.Provider>\r\n </Router>\r\n );\r\n};\r\n\r\nexport default Wrapper;\r\n","import { Container } from '@webprovisions/platform';\r\nimport React from 'react';\r\nimport { render } from 'react-dom';\r\nimport Wrapper from './wrapper';\r\n\r\nexport default (container: Container, element: HTMLElement) =>\r\n render(<Wrapper container={container} />, element);\r\n"],"names":["render","Wrapper"],"mappings":";;;;;;;;;;;;;;AAKA,MAAe,IAAA,CAAC,MAAgD;AAC5D,QAAM,CAAC,GAAQ,KAAa,EAAgC,IAAI,GAC1D,IAAY;AAElB,WAAU,MAAM;AACZ,MAAU,SAAS,QAAQ,EAAE,KAAK,CAAC,MAA2B;AAC1D,MAAI,EAAU,WACV,EAAU,CAAM;AAAA,IACpB,CACH;AAAA,EAAA,GACF,CAAC,GAAW,CAAS,CAAC,GAElB;AAC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AAA,cAAC,EAAiB,UAAjB;AAAA,IAA0B,OAAO;AAAA,EAC9B,GAAA,kBAAA,cAAC,EAAe,UAAf;AAAA,IAAwB,OAAO;AAAA,EAAA,GAC3B,kBAAA,cAAA,GAAA;AAAA,IACG,WAAW,EAAiB,CAAC,GAAW,mBAAmB,CAAC;AAAA,IAC5D;AAAA,IACA,IAAI;AAAA,IACJ,QAAO;AAAA,EAAA,CACX,CACJ,CACJ,CACJ;AAER,GAEA,IAAe,GCnFf,IAAe,CAAC,GAAsB,MAClCA,EAAQ,kBAAA,cAAAC,GAAA;AAAA,EAAQ;AAAA,CAAsB,GAAI,CAAO;"}
@@ -0,0 +1,6 @@
1
+ import { unmountComponentAtNode as t } from "react-dom";
2
+ const m = (o) => t(o);
3
+ export {
4
+ m as default
5
+ };
6
+ //# sourceMappingURL=unmount.b0816844.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unmount.b0816844.js","sources":["../src/ui/unmount.tsx"],"sourcesContent":["import { unmountComponentAtNode } from 'react-dom';\r\n\r\nexport default (element: HTMLElement) => unmountComponentAtNode(element);\r\n"],"names":[],"mappings":";AAEA,MAAA,IAAe,CAAC,MAAyB,EAAuB,CAAO;"}
package/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "@telia-ace/widget-types-grid",
3
- "version": "1.0.15",
3
+ "version": "1.0.18",
4
4
  "description": "Type definition for Grid widget.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Telia Company AB",
7
7
  "keywords": [
8
8
  "telia"
9
9
  ],
10
- "module": "dist/index.js",
10
+ "exports": {
11
+ "development": "./src/index.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "type": "module",
11
15
  "types": "dist/index.d.ts",
12
16
  "files": [
13
17
  "LICENSE.txt",
@@ -24,12 +28,12 @@
24
28
  },
25
29
  "sideEffects": false,
26
30
  "dependencies": {
27
- "@telia-ace/knowledge-serviceclient": "^1.0.5",
28
- "@telia-ace/widget-core": "^1.0.9",
29
- "@telia-ace/widget-forms": "^1.0.15",
30
- "@telia-ace/widget-routing": "^1.0.10",
31
- "@telia-ace/widget-services": "^1.0.9",
32
- "@telia-ace/widget-ui": "^1.0.15",
31
+ "@telia-ace/knowledge-serviceclient": "^1.0.6",
32
+ "@telia-ace/widget-core": "^1.0.11",
33
+ "@telia-ace/widget-forms": "^1.0.18",
34
+ "@telia-ace/widget-routing": "^1.0.12",
35
+ "@telia-ace/widget-services": "^1.0.11",
36
+ "@telia-ace/widget-ui": "^1.0.18",
33
37
  "@telia-ace/widget-utilities": "^1.0.2",
34
38
  "@webprovisions/bootstrapping": "^1.0.12",
35
39
  "@webprovisions/platform": "^1.1.2"
@@ -49,5 +53,5 @@
49
53
  "@types/react-transition-group": "^4.4.4",
50
54
  "@types/styled-components": "^5.1.7"
51
55
  },
52
- "gitHead": "75d8add8f05d11769c75c6f3f5794dbf164f5b4a"
56
+ "gitHead": "e69713b9f623ea5e83d8d9d4d8d9b315f2677721"
53
57
  }
package/dist/render.js DELETED
@@ -1,95 +0,0 @@
1
- import React, { useState, useEffect } from "react";
2
- import { render as render$1 } from "react-dom";
3
- import { useIsMounted, useComponentPlatform, ContainerContext, RoutingContext } from "@telia-ace/widget-ui";
4
- import { appendClassNames } from "@telia-ace/widget-utilities";
5
- import { Router } from "react-router-dom";
6
- import { Component } from "./index.js";
7
- import "@telia-ace/widget-core";
8
- import "styled-components";
9
- import "react-transition-group";
10
- import "react-router";
11
- import "@telia-ace/widget-routing";
12
- import "@telia-ace/widget-services";
13
- import "@webprovisions/bootstrapping";
14
- import "@webprovisions/platform";
15
- var useRouter = (container) => {
16
- const [router, setRouter] = useState(null);
17
- const isMounted = useIsMounted();
18
- useEffect(() => {
19
- container.getAsync("router").then((router2) => {
20
- if (isMounted.current) {
21
- setRouter(router2);
22
- }
23
- });
24
- }, [container, isMounted]);
25
- return router;
26
- };
27
- const keyNavigationKeys = ["Tab", "ArrowDown", "ArrowUp", "ArrowRight", "ArrowLeft"];
28
- const Wrapper = ({ container }) => {
29
- const components = useComponentPlatform(container);
30
- const router = useRouter(container);
31
- const env = container.get("$environment");
32
- const [isTabbing, setIsTabbing] = useState((env == null ? void 0 : env.container.get("isTabbing")) || false);
33
- const [entry, setEntry] = useState(null);
34
- useEffect(() => {
35
- const keydown = (event) => {
36
- if (keyNavigationKeys.indexOf(event.key) > -1) {
37
- if (!isTabbing) {
38
- env == null ? void 0 : env.container.register("isTabbing", true);
39
- }
40
- setIsTabbing(true);
41
- }
42
- };
43
- const click = (event) => {
44
- if (event.screenX === 0 && event.screenY === 0) {
45
- return;
46
- }
47
- if (isTabbing) {
48
- env == null ? void 0 : env.container.register("isTabbing", false);
49
- }
50
- setIsTabbing(false);
51
- };
52
- window.addEventListener("keydown", keydown);
53
- window.addEventListener("click", click);
54
- return () => {
55
- window.removeEventListener("keydown", keydown);
56
- window.removeEventListener("click", click);
57
- };
58
- }, []);
59
- useEffect(() => {
60
- if (components) {
61
- setEntry(components.nodes.root.children.default[0].id || null);
62
- const unsubscribe = components.events.subscribe("components:root-children-changed", (event, { node }) => {
63
- if (node.parent && node.parent.type === "root") {
64
- const entry2 = node.parent.children.default[0].id;
65
- setEntry(entry2);
66
- }
67
- });
68
- return unsubscribe;
69
- }
70
- }, [components]);
71
- if (!router || !router.history || !components) {
72
- return null;
73
- }
74
- if (!entry) {
75
- return null;
76
- }
77
- return /* @__PURE__ */ React.createElement(Router, {
78
- history: router.history
79
- }, /* @__PURE__ */ React.createElement(ContainerContext.Provider, {
80
- value: container
81
- }, /* @__PURE__ */ React.createElement(RoutingContext.Provider, {
82
- value: router
83
- }, /* @__PURE__ */ React.createElement(Component, {
84
- className: appendClassNames([isTabbing, "humany-is-tabbing"]),
85
- isTabbing,
86
- id: entry,
87
- branch: "default"
88
- }))));
89
- };
90
- var Wrapper$1 = Wrapper;
91
- var render = (container, element) => render$1(/* @__PURE__ */ React.createElement(Wrapper$1, {
92
- container
93
- }), element);
94
- export { render as default };
95
- //# sourceMappingURL=render.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render.js","sources":["../src/ui/use-router.ts","../src/ui/wrapper.tsx","../src/ui/render.tsx"],"sourcesContent":["import { RoutingService } from '@telia-ace/widget-routing';\r\nimport { useIsMounted } from '@telia-ace/widget-ui';\r\nimport { Container } from '@webprovisions/platform';\r\nimport { useEffect, useState } from 'react';\r\n\r\nexport default (container: Container): RoutingService | null => {\r\n const [router, setRouter] = useState<RoutingService | null>(null);\r\n const isMounted = useIsMounted();\r\n\r\n useEffect(() => {\r\n container.getAsync('router').then((router: RoutingService) => {\r\n if (isMounted.current) {\r\n setRouter(router);\r\n }\r\n });\r\n }, [container, isMounted]);\r\n\r\n return router;\r\n};\r\n","import { ContainerContext, RoutingContext, useComponentPlatform } from '@telia-ace/widget-ui';\r\nimport { appendClassNames } from '@telia-ace/widget-utilities';\r\nimport { Container } from '@webprovisions/platform';\r\nimport React, { useEffect, useState } from 'react';\r\nimport { Router } from 'react-router-dom';\r\nimport Component from './component';\r\nimport useRouter from './use-router';\r\n\r\nconst keyNavigationKeys = ['Tab', 'ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft'];\r\n\r\ntype Props = {\r\n container: Container;\r\n};\r\n\r\nconst Wrapper: React.SFC<Props> = ({ container }) => {\r\n const components = useComponentPlatform(container);\r\n const router = useRouter(container);\r\n const env = container.get('$environment');\r\n const [isTabbing, setIsTabbing] = useState(env?.container.get('isTabbing') || false);\r\n const [entry, setEntry] = useState<string | null>(null);\r\n\r\n useEffect(() => {\r\n const keydown = (event: KeyboardEvent) => {\r\n if (keyNavigationKeys.indexOf(event.key) > -1) {\r\n if (!isTabbing) {\r\n env?.container.register('isTabbing', true);\r\n }\r\n setIsTabbing(true);\r\n }\r\n };\r\n const click = (event: any) => {\r\n if (event.screenX === 0 && event.screenY === 0) {\r\n return;\r\n }\r\n if (isTabbing) {\r\n env?.container.register('isTabbing', false);\r\n }\r\n setIsTabbing(false);\r\n };\r\n window.addEventListener('keydown', keydown);\r\n window.addEventListener('click', click);\r\n return () => {\r\n window.removeEventListener('keydown', keydown);\r\n window.removeEventListener('click', click);\r\n };\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (components) {\r\n setEntry(components.nodes.root.children.default[0].id || null);\r\n const unsubscribe = components.events.subscribe(\r\n 'components:root-children-changed',\r\n (event, { node }) => {\r\n if (node.parent && node.parent.type === 'root') {\r\n const entry = node.parent.children.default[0].id;\r\n setEntry(entry);\r\n }\r\n }\r\n );\r\n\r\n return unsubscribe;\r\n }\r\n }, [components]);\r\n\r\n if (!router || !router.history || !components) {\r\n return null;\r\n }\r\n\r\n if (!entry) {\r\n return null;\r\n }\r\n\r\n return (\r\n <Router history={router.history}>\r\n <ContainerContext.Provider value={container}>\r\n <RoutingContext.Provider value={router}>\r\n <Component\r\n className={appendClassNames([isTabbing, 'humany-is-tabbing'])}\r\n isTabbing={isTabbing}\r\n id={entry}\r\n branch=\"default\"\r\n />\r\n </RoutingContext.Provider>\r\n </ContainerContext.Provider>\r\n </Router>\r\n );\r\n};\r\n\r\nexport default Wrapper;\r\n","import { Container } from '@webprovisions/platform';\r\nimport React from 'react';\r\nimport { render } from 'react-dom';\r\nimport Wrapper from './wrapper';\r\n\r\nexport default (container: Container, element: HTMLElement) =>\r\n render(<Wrapper container={container} />, element);\r\n"],"names":["render","Wrapper"],"mappings":";;;;;;;;;;;;;;AAKA,IAAe,YAAA,CAAC,cAAgD;AAC5D,QAAM,CAAC,QAAQ,aAAa,SAAgC,IAAI;AAChE,QAAM,YAAY;AAElB,YAAU,MAAM;AACZ,cAAU,SAAS,QAAQ,EAAE,KAAK,CAAC,YAA2B;AAC1D,UAAI,UAAU,SAAS;AACnB,kBAAU,OAAM;AAAA,MACpB;AAAA,IAAA,CACH;AAAA,EAAA,GACF,CAAC,WAAW,SAAS,CAAC;AAElB,SAAA;AACX;ACVA,MAAM,oBAAoB,CAAC,OAAO,aAAa,WAAW,cAAc,WAAW;AAMnF,MAAM,UA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AC,OAAO,WAAW,CAAC,YAAY;AACpC,WAAA;AAAA,EACX;AAEA,MAAI,CAAC,OAAO;AACD,WAAA;AAAA,EACX;AAEA,SACK,sBAAA,cAAA,QAAA;AAAA,IAAO,SAAS,OAAO;AAAA,EACpB,GAAA,sBAAA,cAAC,iBAAiB,UAAjB;AAAA,IAA0B,OAAO;AAAA,EAC9B,GAAA,sBAAA,cAAC,eAAe,UAAf;AAAA,IAAwB,OAAO;AAAA,EAAA,GAC3B,sBAAA,cAAA,WAAA;AAAA,IACG,WAAW,iBAAiB,CAAC,WAAW,mBAAmB,CAAC;AAAA,IAC5D;AAAA,IACA,IAAI;AAAA,IACJ,QAAO;AAAA,EAAA,CACX,CACJ,CACJ,CACJ;AAER;AAEA,IAAA,YAAe;ACnFf,IAAA,SAAe,CAAC,WAAsB,YAClCA,SAAQ,sBAAA,cAAAC,WAAA;AAAA,EAAQ;AAAA,CAAsB,GAAI,OAAO;;"}
package/dist/unmount.js DELETED
@@ -1,4 +0,0 @@
1
- import { unmountComponentAtNode } from "react-dom";
2
- var unmount = (element) => unmountComponentAtNode(element);
3
- export { unmount as default };
4
- //# sourceMappingURL=unmount.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unmount.js","sources":["../src/ui/unmount.tsx"],"sourcesContent":["import { unmountComponentAtNode } from 'react-dom';\r\n\r\nexport default (element: HTMLElement) => unmountComponentAtNode(element);\r\n"],"names":[],"mappings":";AAEA,IAAA,UAAe,CAAC,YAAyB,uBAAuB,OAAO;;"}