@telia-ace/knowledge-widget-components-related-tag-list 1.0.6 → 1.0.11

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.
File without changes
package/dist/index.js ADDED
@@ -0,0 +1,73 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import { createEventSubscriber, extendComponent } from "@telia-ace/knowledge-widget-core";
21
+ import { DataType } from "@telia-ace/knowledge-widget-types-grid";
22
+ import { createReactComponent } from "@telia-ace/knowledge-widget-ui";
23
+ const RelatedTagListComponent = (container) => {
24
+ return createReactComponent(container, "related-tag-list", import("./related-tag-list.js"), (component) => {
25
+ const { events } = container.get("$widget");
26
+ const [subscribe, unsubscribe] = createEventSubscriber(events);
27
+ const fetch = (params) => {
28
+ component.writeProperties({ loading: true, error: void 0 });
29
+ component.actions.dispatch("fetch", { params });
30
+ };
31
+ component.actions.create("fetch", ({ items = [] }) => {
32
+ return component.actions.dispatch("fetched", {
33
+ items,
34
+ loading: true
35
+ });
36
+ });
37
+ component.actions.create("fetched", (input) => {
38
+ return component.writeProperties(__spreadProps(__spreadValues({}, input), { loading: false }));
39
+ });
40
+ container.getAsync("router").then((router) => {
41
+ const { params } = router.getRouteData();
42
+ fetch(params);
43
+ });
44
+ subscribe("router:changed", (_, { current }) => {
45
+ fetch(current.routeData.params);
46
+ });
47
+ return () => {
48
+ unsubscribe();
49
+ };
50
+ }).then(() => {
51
+ return extendComponent(container, "related-tag-list", (component) => {
52
+ component.actions.watch("related-tag-list.fetch", (input, next) => {
53
+ const {
54
+ params: { guide, connection }
55
+ } = input;
56
+ if (typeof guide !== "undefined") {
57
+ return container.getAsync("dataClient").then((dataClient) => {
58
+ return dataClient.fetch(DataType.Guide, {
59
+ connection,
60
+ guideId: guide
61
+ }).then(({ tags }) => {
62
+ return next(__spreadProps(__spreadValues({}, input), { items: tags || [] }));
63
+ }).catch((e) => {
64
+ return next(input);
65
+ });
66
+ });
67
+ }
68
+ });
69
+ });
70
+ });
71
+ };
72
+ export { RelatedTagListComponent as default };
73
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/related-tag-list-component.ts"],"sourcesContent":["import { createEventSubscriber, extendComponent } from '@telia-ace/knowledge-widget-core';\r\nimport { DataClient, DataType } from '@telia-ace/knowledge-widget-types-grid';\r\nimport { createReactComponent } from '@telia-ace/knowledge-widget-ui';\r\nimport { Container } from '@webprovisions/platform';\r\n\r\nexport type RelatedTagListComponentProps = {\r\n header: string;\r\n route?: string;\r\n items?: any[]; // internal\r\n showIcons?: boolean;\r\n};\r\n\r\nconst RelatedTagListComponent = (container: Container) => {\r\n return createReactComponent(\r\n container,\r\n 'related-tag-list',\r\n import('./related-tag-list'),\r\n (component) => {\r\n const { events } = container.get('$widget');\r\n const [subscribe, unsubscribe] = createEventSubscriber(events);\r\n\r\n const fetch = (params: { [key: string]: string }) => {\r\n component.writeProperties({ loading: true, error: undefined });\r\n component.actions.dispatch('fetch', { params });\r\n };\r\n\r\n component.actions.create('fetch', ({ items = [] }) => {\r\n return component.actions.dispatch('fetched', {\r\n items,\r\n loading: true,\r\n });\r\n });\r\n\r\n component.actions.create('fetched', (input) => {\r\n return component.writeProperties({ ...input, loading: false });\r\n });\r\n\r\n container.getAsync('router').then((router) => {\r\n const { params } = router.getRouteData();\r\n fetch(params);\r\n });\r\n subscribe('router:changed', (_, { current }) => {\r\n fetch(current.routeData.params);\r\n });\r\n return () => {\r\n unsubscribe();\r\n };\r\n }\r\n ).then(() => {\r\n return extendComponent(container, 'related-tag-list', (component) => {\r\n component.actions.watch('related-tag-list.fetch', (input, next) => {\r\n const {\r\n params: { guide, connection },\r\n } = input;\r\n\r\n if (typeof guide !== 'undefined') {\r\n return container.getAsync('dataClient').then((dataClient: DataClient) => {\r\n return dataClient\r\n .fetch(DataType.Guide, {\r\n connection,\r\n guideId: guide,\r\n })\r\n .then(({ tags }) => {\r\n return next({ ...input, items: tags || [] });\r\n })\r\n .catch((e: any) => {\r\n return next(input);\r\n });\r\n });\r\n }\r\n });\r\n });\r\n });\r\n};\r\nexport default RelatedTagListComponent;\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAYM,MAAA,0BAA0B,CAAC,cAAyB;AACtD,SAAO,qBACH,WACA,oBACA,OAAO,0BACP,CAAC,cAAc;AACX,UAAM,EAAE,WAAW,UAAU,IAAI,SAAS;AAC1C,UAAM,CAAC,WAAW,eAAe,sBAAsB,MAAM;AAEvD,UAAA,QAAQ,CAAC,WAAsC;AACjD,gBAAU,gBAAgB,EAAE,SAAS,MAAM,OAAO,QAAW;AAC7D,gBAAU,QAAQ,SAAS,SAAS,EAAE,OAAQ,CAAA;AAAA,IAAA;AAGlD,cAAU,QAAQ,OAAO,SAAS,CAAC,EAAE,QAAQ,CAAA,QAAS;AAC3C,aAAA,UAAU,QAAQ,SAAS,WAAW;AAAA,QACzC;AAAA,QACA,SAAS;AAAA,MAAA,CACZ;AAAA,IAAA,CACJ;AAED,cAAU,QAAQ,OAAO,WAAW,CAAC,UAAU;AAC3C,aAAO,UAAU,gBAAgB,iCAAK,QAAL,EAAY,SAAS,QAAO;AAAA,IAAA,CAChE;AAED,cAAU,SAAS,QAAQ,EAAE,KAAK,CAAC,WAAW;AACpC,YAAA,EAAE,WAAW,OAAO,aAAa;AACvC,YAAM,MAAM;AAAA,IAAA,CACf;AACD,cAAU,kBAAkB,CAAC,GAAG,EAAE,cAAc;AACtC,YAAA,QAAQ,UAAU,MAAM;AAAA,IAAA,CACjC;AACD,WAAO,MAAM;AACG;IAAA;AAAA,EAChB,CAER,EAAE,KAAK,MAAM;AACT,WAAO,gBAAgB,WAAW,oBAAoB,CAAC,cAAc;AACjE,gBAAU,QAAQ,MAAM,0BAA0B,CAAC,OAAO,SAAS;AACzD,cAAA;AAAA,UACF,QAAQ,EAAE,OAAO;AAAA,YACjB;AAEA,YAAA,OAAO,UAAU,aAAa;AAC9B,iBAAO,UAAU,SAAS,YAAY,EAAE,KAAK,CAAC,eAA2B;AAC9D,mBAAA,WACF,MAAM,SAAS,OAAO;AAAA,cACnB;AAAA,cACA,SAAS;AAAA,YACZ,CAAA,EACA,KAAK,CAAC,EAAE,WAAW;AACT,qBAAA,KAAK,iCAAK,QAAL,EAAY,OAAO,QAAQ,KAAI;AAAA,YAAA,CAC9C,EACA,MAAM,CAAC,MAAW;AACf,qBAAO,KAAK,KAAK;AAAA,YAAA,CACpB;AAAA,UAAA,CACR;AAAA,QACL;AAAA,MAAA,CACH;AAAA,IAAA,CACJ;AAAA,EAAA,CACJ;AACL;;"}
File without changes
@@ -0,0 +1,167 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ import { useContainer, useProperties, useRouteData, createEmptyComponent, SymbolBadge, ItemList, itemList, contentBox, TextLink, borderTabStyle } from "@telia-ace/knowledge-widget-ui";
33
+ import { appendClassNames, createParams } from "@telia-ace/widget-utilities";
34
+ import React from "react";
35
+ import styled, { css } from "styled-components";
36
+ const getIcon = (selected, defaultIcon, activeIcon) => {
37
+ if (selected && activeIcon) {
38
+ return /* @__PURE__ */ React.createElement(StyledSymbolBadge, {
39
+ symbol: activeIcon,
40
+ size: 18
41
+ });
42
+ }
43
+ if (defaultIcon) {
44
+ return /* @__PURE__ */ React.createElement(StyledSymbolBadge, {
45
+ symbol: defaultIcon,
46
+ size: 18
47
+ });
48
+ }
49
+ return null;
50
+ };
51
+ const RelatedTagList = (_a) => {
52
+ var _b = _a, { className, embedded = false } = _b, other = __objRest(_b, ["className", "embedded"]);
53
+ const container = useContainer();
54
+ const {
55
+ route = "search",
56
+ header,
57
+ items = [],
58
+ showIcons
59
+ } = useProperties();
60
+ const { params } = useRouteData();
61
+ if (!items.length) {
62
+ return createEmptyComponent(container, __spreadProps(__spreadValues({}, other), {
63
+ className: appendClassNames(className, "humany-tag-list", "humany-related-tag-list")
64
+ }));
65
+ }
66
+ return /* @__PURE__ */ React.createElement(StyledItemList, __spreadProps(__spreadValues({
67
+ embedded: embedded ? "true" : "false"
68
+ }, other), {
69
+ className: appendClassNames(className, "humany-tag-list", "humany-related-tag-list"),
70
+ header,
71
+ items,
72
+ renderItem: (item) => {
73
+ const { id, title, defaultIcon, activeIcon } = item;
74
+ const selected = params.tag === item.id || !params.tag && item.id === "0";
75
+ return /* @__PURE__ */ React.createElement("li", {
76
+ key: id,
77
+ "data-tag": id
78
+ }, /* @__PURE__ */ React.createElement(StyledLink, {
79
+ routeName: route,
80
+ selected,
81
+ params: createParams({
82
+ tag: id
83
+ }),
84
+ text: title
85
+ }, showIcons && getIcon(selected, defaultIcon, activeIcon)));
86
+ }
87
+ }));
88
+ };
89
+ const StyledSymbolBadge = styled(SymbolBadge)`
90
+ margin-right: ${(p) => {
91
+ var _a;
92
+ return (_a = p.theme.sizes) == null ? void 0 : _a.small;
93
+ }};
94
+ ${(p) => {
95
+ if (p.symbol.type === "Uri") {
96
+ return `
97
+ width: ${p.size}px;
98
+ height: ${p.size}px;
99
+ `;
100
+ }
101
+ if (p.symbol.type === "FontAwesome") {
102
+ return `
103
+ font-size: ${p.size}px;
104
+ `;
105
+ }
106
+ }}
107
+ `;
108
+ const StyledItemList = styled(ItemList)`
109
+ ${itemList}
110
+ ${(p) => p.embedded === "false" && contentBox}
111
+ ${(p) => {
112
+ var _a;
113
+ return `padding: ${(_a = p.theme.sizes) == null ? void 0 : _a.large};`;
114
+ }}
115
+ justify-content: flex-start;
116
+
117
+ ul {
118
+ display: flex;
119
+ flex-wrap: wrap;
120
+ li {
121
+ margin: 0 ${(p) => {
122
+ var _a, _b;
123
+ return `${(_a = p.theme.sizes) == null ? void 0 : _a.small} ${(_b = p.theme.sizes) == null ? void 0 : _b.small}`;
124
+ }} 0;
125
+
126
+ a {
127
+ color: #fff;
128
+ }
129
+ }
130
+ }
131
+ `;
132
+ const StyledLink = styled(TextLink)`
133
+ padding: 8px 15px;
134
+ background-color: ${(p) => {
135
+ var _a, _b;
136
+ return p.selected ? (_a = p.theme.colors) == null ? void 0 : _a.text : (_b = p.theme.colors) == null ? void 0 : _b.primary;
137
+ }};
138
+ font-weight: 300;
139
+ border-radius: ${(p) => p.theme.borderRadius};
140
+ display: block;
141
+ font-size: ${(p) => {
142
+ var _a;
143
+ return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
144
+ }};
145
+
146
+ &:focus {
147
+ ${(p) => {
148
+ var _a;
149
+ return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && css`
150
+ ${borderTabStyle}
151
+ padding: 6px 15px;
152
+ background-color: transparent;
153
+ `;
154
+ }};
155
+ }
156
+
157
+ @media (hover: hover) {
158
+ &:hover {
159
+ background-color: ${(p) => {
160
+ var _a, _b;
161
+ return p.selected ? (_a = p.theme.colors) == null ? void 0 : _a.primary : (_b = p.theme.colors) == null ? void 0 : _b.text;
162
+ }};
163
+ }
164
+ }
165
+ `;
166
+ export { RelatedTagList as default };
167
+ //# sourceMappingURL=related-tag-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"related-tag-list.js","sources":["../src/related-tag-list.tsx"],"sourcesContent":["import { Symbol, Tag } from '@telia-ace/knowledge-widget-core';\r\nimport {\r\n borderTabStyle,\r\n contentBox,\r\n createEmptyComponent,\r\n ItemList,\r\n itemList,\r\n SymbolBadge,\r\n TextLink,\r\n useContainer,\r\n useProperties,\r\n useRouteData,\r\n} from '@telia-ace/knowledge-widget-ui';\r\nimport { appendClassNames, createParams } from '@telia-ace/widget-utilities';\r\nimport React from 'react';\r\nimport styled, { css } from 'styled-components';\r\nimport { RelatedTagListComponentProps } from './related-tag-list-component';\r\n\r\nconst getIcon = (selected: boolean, defaultIcon?: Symbol, activeIcon?: Symbol) => {\r\n if (selected && activeIcon) {\r\n return <StyledSymbolBadge symbol={activeIcon} size={18} />;\r\n }\r\n if (defaultIcon) {\r\n return <StyledSymbolBadge symbol={defaultIcon} size={18} />;\r\n }\r\n return null;\r\n};\r\n\r\ntype Props = {\r\n className: string;\r\n embedded?: boolean;\r\n};\r\n\r\nconst RelatedTagList: React.FC<Props> = ({ className, embedded = false, ...other }) => {\r\n const container = useContainer();\r\n const {\r\n route = 'search',\r\n header,\r\n items = [],\r\n showIcons,\r\n } = useProperties<RelatedTagListComponentProps>();\r\n const { params } = useRouteData();\r\n\r\n if (!items.length) {\r\n return createEmptyComponent(container, {\r\n ...other,\r\n className: appendClassNames(className, 'humany-tag-list', 'humany-related-tag-list'),\r\n });\r\n }\r\n\r\n return (\r\n <StyledItemList\r\n embedded={embedded ? 'true' : 'false'}\r\n {...other}\r\n className={appendClassNames(className, 'humany-tag-list', 'humany-related-tag-list')}\r\n header={header}\r\n items={items}\r\n renderItem={(item: Tag) => {\r\n const { id, title, defaultIcon, activeIcon } = item;\r\n const selected = params.tag === item.id || (!params.tag && item.id === '0');\r\n\r\n return (\r\n <li key={id} data-tag={id}>\r\n <StyledLink\r\n routeName={route}\r\n selected={selected}\r\n params={createParams({\r\n tag: id,\r\n })}\r\n text={title}\r\n >\r\n {showIcons && getIcon(selected, defaultIcon, activeIcon)}\r\n </StyledLink>\r\n </li>\r\n );\r\n }}\r\n />\r\n );\r\n};\r\n\r\nexport default RelatedTagList;\r\n\r\nconst StyledSymbolBadge = styled(SymbolBadge)<{ size: number; symbol: Symbol }>`\r\n margin-right: ${(p) => p.theme.sizes?.small};\r\n ${(p: any) => {\r\n if (p.symbol.type === 'Uri') {\r\n return `\r\n width: ${p.size}px;\r\n height: ${p.size}px;\r\n `;\r\n }\r\n\r\n if (p.symbol.type === 'FontAwesome') {\r\n return `\r\n font-size: ${p.size}px;\r\n `;\r\n }\r\n }}\r\n`;\r\n\r\nconst StyledItemList = styled(ItemList)<any>`\r\n ${itemList}\r\n ${(p) => p.embedded === 'false' && contentBox}\r\n ${(p) => `padding: ${p.theme.sizes?.large};`}\r\n justify-content: flex-start;\r\n\r\n ul {\r\n display: flex;\r\n flex-wrap: wrap;\r\n li {\r\n margin: 0 ${(p) => `${p.theme.sizes?.small} ${p.theme.sizes?.small}`} 0;\r\n\r\n a {\r\n color: #fff;\r\n }\r\n }\r\n }\r\n`;\r\n\r\nconst StyledLink = styled(TextLink)<any>`\r\n padding: 8px 15px;\r\n background-color: ${(p) => (p.selected ? p.theme.colors?.text : p.theme.colors?.primary)};\r\n font-weight: 300;\r\n border-radius: ${(p) => p.theme.borderRadius};\r\n display: block;\r\n font-size: ${(p) => p.theme.fonts?.normal};\r\n\r\n &:focus {\r\n ${(p) =>\r\n p.theme.accessibility?.isTabbing &&\r\n css`\r\n ${borderTabStyle}\r\n padding: 6px 15px;\r\n background-color: transparent;\r\n `};\r\n }\r\n\r\n @media (hover: hover) {\r\n &:hover {\r\n background-color: ${(p) =>\r\n p.selected ? p.theme.colors?.primary : p.theme.colors?.text};\r\n }\r\n }\r\n`;\r\n"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,34 +1,33 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-widget-components-related-tag-list",
3
- "version": "1.0.6",
3
+ "version": "1.0.11",
4
4
  "description": "Related tag list component for ACE Knowledge Widgets.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Telia Company AB",
7
7
  "keywords": [
8
8
  "telia"
9
9
  ],
10
- "main": "lib/index.js",
11
- "module": "lib-esm/index.js",
10
+ "module": "dist/index.js",
11
+ "types": "dist/index.d.ts",
12
12
  "files": [
13
13
  "LICENSE.txt",
14
14
  "README.md",
15
- "lib/",
16
- "lib-esm/"
15
+ "dist/"
17
16
  ],
18
17
  "publishConfig": {
19
18
  "access": "public"
20
19
  },
21
20
  "scripts": {
22
- "clean": "cleandir lib && cleandir lib-esm",
23
- "compile": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json"
21
+ "clean": "rimraf ./dist",
22
+ "precompile": "tsc -emitDeclarationOnly",
23
+ "compile": "vite build"
24
24
  },
25
25
  "sideEffects": false,
26
- "typings": "lib/index.d.ts",
27
26
  "dependencies": {
28
- "@telia-ace/knowledge-widget-core": "^1.0.6",
29
- "@telia-ace/knowledge-widget-types-grid": "^1.0.13",
30
- "@telia-ace/knowledge-widget-ui": "^1.0.10",
31
- "@telia-ace/widget-utilities": "^1.0.1",
27
+ "@telia-ace/knowledge-widget-core": "^1.0.10",
28
+ "@telia-ace/knowledge-widget-types-grid": "^1.0.17",
29
+ "@telia-ace/knowledge-widget-ui": "^1.0.14",
30
+ "@telia-ace/widget-utilities": "^1.0.2",
32
31
  "@webprovisions/platform": "^1.1.2"
33
32
  },
34
33
  "peerDependencies": {
@@ -41,5 +40,5 @@
41
40
  "@types/react-dom": "^16.8.0",
42
41
  "@types/styled-components": "^5.1.7"
43
42
  },
44
- "gitHead": "141db586e3989e54f2671aa2079c62a250a00557"
43
+ "gitHead": "3821c16ef534210308ecca6b2e16d098ddde37a4"
45
44
  }
package/lib/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import RelatedTagListComponent from './related-tag-list-component';
2
- export default RelatedTagListComponent;
package/lib/index.js DELETED
@@ -1,7 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var related_tag_list_component_1 = __importDefault(require("./related-tag-list-component"));
7
- exports.default = related_tag_list_component_1.default;
@@ -1,9 +0,0 @@
1
- import { Container } from '@webprovisions/platform';
2
- export declare type RelatedTagListComponentProps = {
3
- header: string;
4
- route?: string;
5
- items?: any[];
6
- showIcons?: boolean;
7
- };
8
- declare const RelatedTagListComponent: (container: Container) => Promise<void>;
9
- export default RelatedTagListComponent;
@@ -1,109 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
- var __read = (this && this.__read) || function (o, n) {
37
- var m = typeof Symbol === "function" && o[Symbol.iterator];
38
- if (!m) return o;
39
- var i = m.call(o), r, ar = [], e;
40
- try {
41
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
42
- }
43
- catch (error) { e = { error: error }; }
44
- finally {
45
- try {
46
- if (r && !r.done && (m = i["return"])) m.call(i);
47
- }
48
- finally { if (e) throw e.error; }
49
- }
50
- return ar;
51
- };
52
- Object.defineProperty(exports, "__esModule", { value: true });
53
- var knowledge_widget_core_1 = require("@telia-ace/knowledge-widget-core");
54
- var knowledge_widget_types_grid_1 = require("@telia-ace/knowledge-widget-types-grid");
55
- var knowledge_widget_ui_1 = require("@telia-ace/knowledge-widget-ui");
56
- var RelatedTagListComponent = function (container) {
57
- return (0, knowledge_widget_ui_1.createReactComponent)(container, 'related-tag-list', Promise.resolve().then(function () { return __importStar(require('./related-tag-list')); }), function (component) {
58
- var events = container.get('$widget').events;
59
- var _a = __read((0, knowledge_widget_core_1.createEventSubscriber)(events), 2), subscribe = _a[0], unsubscribe = _a[1];
60
- var fetch = function (params) {
61
- component.writeProperties({ loading: true, error: undefined });
62
- component.actions.dispatch('fetch', { params: params });
63
- };
64
- component.actions.create('fetch', function (_a) {
65
- var _b = _a.items, items = _b === void 0 ? [] : _b;
66
- return component.actions.dispatch('fetched', {
67
- items: items,
68
- loading: true,
69
- });
70
- });
71
- component.actions.create('fetched', function (input) {
72
- return component.writeProperties(__assign(__assign({}, input), { loading: false }));
73
- });
74
- container.getAsync('router').then(function (router) {
75
- var params = router.getRouteData().params;
76
- fetch(params);
77
- });
78
- subscribe('router:changed', function (_, _a) {
79
- var current = _a.current;
80
- fetch(current.routeData.params);
81
- });
82
- return function () {
83
- unsubscribe();
84
- };
85
- }).then(function () {
86
- return (0, knowledge_widget_core_1.extendComponent)(container, 'related-tag-list', function (component) {
87
- component.actions.watch('related-tag-list.fetch', function (input, next) {
88
- var _a = input.params, guide = _a.guide, connection = _a.connection;
89
- if (typeof guide !== 'undefined') {
90
- return container.getAsync('dataClient').then(function (dataClient) {
91
- return dataClient
92
- .fetch(knowledge_widget_types_grid_1.DataType.Guide, {
93
- connection: connection,
94
- guideId: guide,
95
- })
96
- .then(function (_a) {
97
- var tags = _a.tags;
98
- return next(__assign(__assign({}, input), { items: tags || [] }));
99
- })
100
- .catch(function (e) {
101
- return next(input);
102
- });
103
- });
104
- }
105
- });
106
- });
107
- });
108
- };
109
- exports.default = RelatedTagListComponent;
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- declare type Props = {
3
- className: string;
4
- embedded?: boolean;
5
- };
6
- declare const RelatedTagList: React.FC<Props>;
7
- export default RelatedTagList;
@@ -1,99 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __assign = (this && this.__assign) || function () {
7
- __assign = Object.assign || function(t) {
8
- for (var s, i = 1, n = arguments.length; i < n; i++) {
9
- s = arguments[i];
10
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
- t[p] = s[p];
12
- }
13
- return t;
14
- };
15
- return __assign.apply(this, arguments);
16
- };
17
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- var desc = Object.getOwnPropertyDescriptor(m, k);
20
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
- desc = { enumerable: true, get: function() { return m[k]; } };
22
- }
23
- Object.defineProperty(o, k2, desc);
24
- }) : (function(o, m, k, k2) {
25
- if (k2 === undefined) k2 = k;
26
- o[k2] = m[k];
27
- }));
28
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
- Object.defineProperty(o, "default", { enumerable: true, value: v });
30
- }) : function(o, v) {
31
- o["default"] = v;
32
- });
33
- var __importStar = (this && this.__importStar) || function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- var __rest = (this && this.__rest) || function (s, e) {
41
- var t = {};
42
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
43
- t[p] = s[p];
44
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
45
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
46
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
47
- t[p[i]] = s[p[i]];
48
- }
49
- return t;
50
- };
51
- var __importDefault = (this && this.__importDefault) || function (mod) {
52
- return (mod && mod.__esModule) ? mod : { "default": mod };
53
- };
54
- Object.defineProperty(exports, "__esModule", { value: true });
55
- var knowledge_widget_ui_1 = require("@telia-ace/knowledge-widget-ui");
56
- var widget_utilities_1 = require("@telia-ace/widget-utilities");
57
- var react_1 = __importDefault(require("react"));
58
- var styled_components_1 = __importStar(require("styled-components"));
59
- var getIcon = function (selected, defaultIcon, activeIcon) {
60
- if (selected && activeIcon) {
61
- return react_1.default.createElement(StyledSymbolBadge, { symbol: activeIcon, size: 18 });
62
- }
63
- if (defaultIcon) {
64
- return react_1.default.createElement(StyledSymbolBadge, { symbol: defaultIcon, size: 18 });
65
- }
66
- return null;
67
- };
68
- var RelatedTagList = function (_a) {
69
- var className = _a.className, _b = _a.embedded, embedded = _b === void 0 ? false : _b, other = __rest(_a, ["className", "embedded"]);
70
- var container = (0, knowledge_widget_ui_1.useContainer)();
71
- var _c = (0, knowledge_widget_ui_1.useProperties)(), _d = _c.route, route = _d === void 0 ? 'search' : _d, header = _c.header, _e = _c.items, items = _e === void 0 ? [] : _e, showIcons = _c.showIcons;
72
- var params = (0, knowledge_widget_ui_1.useRouteData)().params;
73
- if (!items.length) {
74
- return (0, knowledge_widget_ui_1.createEmptyComponent)(container, __assign(__assign({}, other), { className: (0, widget_utilities_1.appendClassNames)(className, 'humany-tag-list', 'humany-related-tag-list') }));
75
- }
76
- return (react_1.default.createElement(StyledItemList, __assign({ embedded: embedded ? 'true' : 'false' }, other, { className: (0, widget_utilities_1.appendClassNames)(className, 'humany-tag-list', 'humany-related-tag-list'), header: header, items: items, renderItem: function (item) {
77
- var id = item.id, title = item.title, defaultIcon = item.defaultIcon, activeIcon = item.activeIcon;
78
- var selected = params.tag === item.id || (!params.tag && item.id === '0');
79
- return (react_1.default.createElement("li", { key: id, "data-tag": id },
80
- react_1.default.createElement(StyledLink, { routeName: route, selected: selected, params: (0, widget_utilities_1.createParams)({
81
- tag: id,
82
- }), text: title }, showIcons && getIcon(selected, defaultIcon, activeIcon))));
83
- } })));
84
- };
85
- exports.default = RelatedTagList;
86
- var StyledSymbolBadge = (0, styled_components_1.default)(knowledge_widget_ui_1.SymbolBadge)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-right: ", ";\n ", "\n"], ["\n margin-right: ", ";\n ", "\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; }, function (p) {
87
- if (p.symbol.type === 'Uri') {
88
- return "\n width: ".concat(p.size, "px;\n height: ").concat(p.size, "px;\n ");
89
- }
90
- if (p.symbol.type === 'FontAwesome') {
91
- return "\n font-size: ".concat(p.size, "px;\n ");
92
- }
93
- });
94
- var StyledItemList = (0, styled_components_1.default)(knowledge_widget_ui_1.ItemList)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n ", "\n ", "\n justify-content: flex-start;\n\n ul {\n display: flex;\n flex-wrap: wrap;\n li {\n margin: 0 ", " 0;\n\n a {\n color: #fff;\n }\n }\n }\n"], ["\n ", "\n ", "\n ", "\n justify-content: flex-start;\n\n ul {\n display: flex;\n flex-wrap: wrap;\n li {\n margin: 0 ", " 0;\n\n a {\n color: #fff;\n }\n }\n }\n"])), knowledge_widget_ui_1.itemList, function (p) { return p.embedded === 'false' && knowledge_widget_ui_1.contentBox; }, function (p) { var _a; return "padding: ".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.large, ";"); }, function (p) { var _a, _b; return "".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small, " ").concat((_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.small); });
95
- var StyledLink = (0, styled_components_1.default)(knowledge_widget_ui_1.TextLink)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding: 8px 15px;\n background-color: ", ";\n font-weight: 300;\n border-radius: ", ";\n display: block;\n font-size: ", ";\n\n &:focus {\n ", ";\n }\n\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n }\n }\n"], ["\n padding: 8px 15px;\n background-color: ", ";\n font-weight: 300;\n border-radius: ", ";\n display: block;\n font-size: ", ";\n\n &:focus {\n ", ";\n }\n\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n }\n }\n"])), function (p) { var _a, _b; return (p.selected ? (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text : (_b = p.theme.colors) === null || _b === void 0 ? void 0 : _b.primary); }, function (p) { return p.theme.borderRadius; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) {
96
- var _a;
97
- return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n padding: 6px 15px;\n background-color: transparent;\n "], ["\n ", "\n padding: 6px 15px;\n background-color: transparent;\n "])), knowledge_widget_ui_1.borderTabStyle);
98
- }, function (p) { var _a, _b; return p.selected ? (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary : (_b = p.theme.colors) === null || _b === void 0 ? void 0 : _b.text; });
99
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
package/lib-esm/index.js DELETED
@@ -1,2 +0,0 @@
1
- import RelatedTagListComponent from './related-tag-list-component';
2
- export default RelatedTagListComponent;
@@ -1,84 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __read = (this && this.__read) || function (o, n) {
13
- var m = typeof Symbol === "function" && o[Symbol.iterator];
14
- if (!m) return o;
15
- var i = m.call(o), r, ar = [], e;
16
- try {
17
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
18
- }
19
- catch (error) { e = { error: error }; }
20
- finally {
21
- try {
22
- if (r && !r.done && (m = i["return"])) m.call(i);
23
- }
24
- finally { if (e) throw e.error; }
25
- }
26
- return ar;
27
- };
28
- import { createEventSubscriber, extendComponent } from '@telia-ace/knowledge-widget-core';
29
- import { DataType } from '@telia-ace/knowledge-widget-types-grid';
30
- import { createReactComponent } from '@telia-ace/knowledge-widget-ui';
31
- var RelatedTagListComponent = function (container) {
32
- return createReactComponent(container, 'related-tag-list', import('./related-tag-list'), function (component) {
33
- var events = container.get('$widget').events;
34
- var _a = __read(createEventSubscriber(events), 2), subscribe = _a[0], unsubscribe = _a[1];
35
- var fetch = function (params) {
36
- component.writeProperties({ loading: true, error: undefined });
37
- component.actions.dispatch('fetch', { params: params });
38
- };
39
- component.actions.create('fetch', function (_a) {
40
- var _b = _a.items, items = _b === void 0 ? [] : _b;
41
- return component.actions.dispatch('fetched', {
42
- items: items,
43
- loading: true,
44
- });
45
- });
46
- component.actions.create('fetched', function (input) {
47
- return component.writeProperties(__assign(__assign({}, input), { loading: false }));
48
- });
49
- container.getAsync('router').then(function (router) {
50
- var params = router.getRouteData().params;
51
- fetch(params);
52
- });
53
- subscribe('router:changed', function (_, _a) {
54
- var current = _a.current;
55
- fetch(current.routeData.params);
56
- });
57
- return function () {
58
- unsubscribe();
59
- };
60
- }).then(function () {
61
- return extendComponent(container, 'related-tag-list', function (component) {
62
- component.actions.watch('related-tag-list.fetch', function (input, next) {
63
- var _a = input.params, guide = _a.guide, connection = _a.connection;
64
- if (typeof guide !== 'undefined') {
65
- return container.getAsync('dataClient').then(function (dataClient) {
66
- return dataClient
67
- .fetch(DataType.Guide, {
68
- connection: connection,
69
- guideId: guide,
70
- })
71
- .then(function (_a) {
72
- var tags = _a.tags;
73
- return next(__assign(__assign({}, input), { items: tags || [] }));
74
- })
75
- .catch(function (e) {
76
- return next(input);
77
- });
78
- });
79
- }
80
- });
81
- });
82
- });
83
- };
84
- export default RelatedTagListComponent;
@@ -1,71 +0,0 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
- var __assign = (this && this.__assign) || function () {
6
- __assign = Object.assign || function(t) {
7
- for (var s, i = 1, n = arguments.length; i < n; i++) {
8
- s = arguments[i];
9
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
- t[p] = s[p];
11
- }
12
- return t;
13
- };
14
- return __assign.apply(this, arguments);
15
- };
16
- var __rest = (this && this.__rest) || function (s, e) {
17
- var t = {};
18
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
19
- t[p] = s[p];
20
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
21
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
22
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
23
- t[p[i]] = s[p[i]];
24
- }
25
- return t;
26
- };
27
- import { borderTabStyle, contentBox, createEmptyComponent, ItemList, itemList, SymbolBadge, TextLink, useContainer, useProperties, useRouteData, } from '@telia-ace/knowledge-widget-ui';
28
- import { appendClassNames, createParams } from '@telia-ace/widget-utilities';
29
- import React from 'react';
30
- import styled, { css } from 'styled-components';
31
- var getIcon = function (selected, defaultIcon, activeIcon) {
32
- if (selected && activeIcon) {
33
- return React.createElement(StyledSymbolBadge, { symbol: activeIcon, size: 18 });
34
- }
35
- if (defaultIcon) {
36
- return React.createElement(StyledSymbolBadge, { symbol: defaultIcon, size: 18 });
37
- }
38
- return null;
39
- };
40
- var RelatedTagList = function (_a) {
41
- var className = _a.className, _b = _a.embedded, embedded = _b === void 0 ? false : _b, other = __rest(_a, ["className", "embedded"]);
42
- var container = useContainer();
43
- var _c = useProperties(), _d = _c.route, route = _d === void 0 ? 'search' : _d, header = _c.header, _e = _c.items, items = _e === void 0 ? [] : _e, showIcons = _c.showIcons;
44
- var params = useRouteData().params;
45
- if (!items.length) {
46
- return createEmptyComponent(container, __assign(__assign({}, other), { className: appendClassNames(className, 'humany-tag-list', 'humany-related-tag-list') }));
47
- }
48
- return (React.createElement(StyledItemList, __assign({ embedded: embedded ? 'true' : 'false' }, other, { className: appendClassNames(className, 'humany-tag-list', 'humany-related-tag-list'), header: header, items: items, renderItem: function (item) {
49
- var id = item.id, title = item.title, defaultIcon = item.defaultIcon, activeIcon = item.activeIcon;
50
- var selected = params.tag === item.id || (!params.tag && item.id === '0');
51
- return (React.createElement("li", { key: id, "data-tag": id },
52
- React.createElement(StyledLink, { routeName: route, selected: selected, params: createParams({
53
- tag: id,
54
- }), text: title }, showIcons && getIcon(selected, defaultIcon, activeIcon))));
55
- } })));
56
- };
57
- export default RelatedTagList;
58
- var StyledSymbolBadge = styled(SymbolBadge)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-right: ", ";\n ", "\n"], ["\n margin-right: ", ";\n ", "\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; }, function (p) {
59
- if (p.symbol.type === 'Uri') {
60
- return "\n width: ".concat(p.size, "px;\n height: ").concat(p.size, "px;\n ");
61
- }
62
- if (p.symbol.type === 'FontAwesome') {
63
- return "\n font-size: ".concat(p.size, "px;\n ");
64
- }
65
- });
66
- var StyledItemList = styled(ItemList)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n ", "\n ", "\n justify-content: flex-start;\n\n ul {\n display: flex;\n flex-wrap: wrap;\n li {\n margin: 0 ", " 0;\n\n a {\n color: #fff;\n }\n }\n }\n"], ["\n ", "\n ", "\n ", "\n justify-content: flex-start;\n\n ul {\n display: flex;\n flex-wrap: wrap;\n li {\n margin: 0 ", " 0;\n\n a {\n color: #fff;\n }\n }\n }\n"])), itemList, function (p) { return p.embedded === 'false' && contentBox; }, function (p) { var _a; return "padding: ".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.large, ";"); }, function (p) { var _a, _b; return "".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small, " ").concat((_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.small); });
67
- var StyledLink = styled(TextLink)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding: 8px 15px;\n background-color: ", ";\n font-weight: 300;\n border-radius: ", ";\n display: block;\n font-size: ", ";\n\n &:focus {\n ", ";\n }\n\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n }\n }\n"], ["\n padding: 8px 15px;\n background-color: ", ";\n font-weight: 300;\n border-radius: ", ";\n display: block;\n font-size: ", ";\n\n &:focus {\n ", ";\n }\n\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n }\n }\n"])), function (p) { var _a, _b; return (p.selected ? (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text : (_b = p.theme.colors) === null || _b === void 0 ? void 0 : _b.primary); }, function (p) { return p.theme.borderRadius; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) {
68
- var _a;
69
- return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n padding: 6px 15px;\n background-color: transparent;\n "], ["\n ", "\n padding: 6px 15px;\n background-color: transparent;\n "])), borderTabStyle);
70
- }, function (p) { var _a, _b; return p.selected ? (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary : (_b = p.theme.colors) === null || _b === void 0 ? void 0 : _b.text; });
71
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4;