@telia-ace/knowledge-widget-components-contact-link 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
File without changes
@@ -0,0 +1,200 @@
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 { useProperties, Text, Link, WidgetLink, SymbolBadge, linkTabStyle, contentBox, borderTabStyle } from "@telia-ace/knowledge-widget-ui";
33
+ import { appendClassNames } from "@telia-ace/widget-utilities";
34
+ import React from "react";
35
+ import styled, { css } from "styled-components";
36
+ const ContactLink = (_a) => {
37
+ var _b = _a, { className } = _b, other = __objRest(_b, ["className"]);
38
+ const {
39
+ widget,
40
+ route,
41
+ mode = "large",
42
+ iconSize = "large",
43
+ symbol,
44
+ descriptionLabel,
45
+ label,
46
+ textAlign
47
+ } = useProperties();
48
+ const align = textAlign ? textAlign : mode === "large" ? "center" : "right";
49
+ const iconSizePx = iconSize === "large" ? "64" : "48";
50
+ const activationOptions = {
51
+ apiNotificationPriorityBy: "contacts"
52
+ };
53
+ if (mode === "compact") {
54
+ return /* @__PURE__ */ React.createElement(CompactWrapper, __spreadProps(__spreadValues({}, other), {
55
+ className: appendClassNames(className, "humany-contact-link", "humany-contact-link-compact"),
56
+ textAlign: align
57
+ }), descriptionLabel && /* @__PURE__ */ React.createElement(Text, null, descriptionLabel), route ? /* @__PURE__ */ React.createElement(Link, {
58
+ routeName: route
59
+ }, label) : /* @__PURE__ */ React.createElement(WidgetLink, {
60
+ "aria-haspopup": "dialog",
61
+ role: "button",
62
+ activationOptions,
63
+ widgetName: widget
64
+ }, label));
65
+ }
66
+ const children = /* @__PURE__ */ React.createElement(React.Fragment, null, symbol ? /* @__PURE__ */ React.createElement(SymbolBadge, {
67
+ symbol
68
+ }) : /* @__PURE__ */ React.createElement(ContactIcon, {
69
+ width: iconSizePx,
70
+ viewBox: "0 0 63 37",
71
+ fill: "none",
72
+ xmlns: "http://www.w3.org/2000/svg"
73
+ }, /* @__PURE__ */ React.createElement("path", {
74
+ d: "M1 1H62M1 1L24.7579 15.6328M1 1V36M62 1V36M62 1L38.8842 15.5402M1 36H62M1 36L24.7579 15.6328M62 36L38.8842 15.5402M38.8842 15.5402L37.0898 16.6689C33.8642 18.6979 29.7658 18.7172 26.5212 16.7188L24.7579 15.6328",
75
+ stroke: "#990AE3"
76
+ })), label && /* @__PURE__ */ React.createElement(Heading, null, label), descriptionLabel && /* @__PURE__ */ React.createElement(Description, null, descriptionLabel));
77
+ return route ? /* @__PURE__ */ React.createElement(StyledLink, __spreadProps(__spreadValues({}, other), {
78
+ className: appendClassNames(className, "humany-contact-link", "humany-contact-link-large"),
79
+ routeName: route
80
+ }), children) : /* @__PURE__ */ React.createElement(StyledWidgetLink, __spreadProps(__spreadValues({}, other), {
81
+ "aria-haspopup": "dialog",
82
+ role: "button",
83
+ className: appendClassNames(className, "humany-contact-link", "humany-contact-link-large"),
84
+ textAlign: align,
85
+ widgetName: widget,
86
+ activationOptions
87
+ }), children);
88
+ };
89
+ const CompactWrapper = styled.div`
90
+ text-align: ${(p) => p.textAlign};
91
+ font-weight: 300;
92
+
93
+ span,
94
+ a {
95
+ display: inline-block;
96
+ font-size: ${(p) => {
97
+ var _a;
98
+ return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
99
+ }};
100
+ }
101
+
102
+ span {
103
+ margin: 0 ${(p) => {
104
+ var _a;
105
+ return (_a = p.theme.sizes) == null ? void 0 : _a.small;
106
+ }} 0 0;
107
+ }
108
+ a {
109
+ text-decoration: underline;
110
+ color: ${(p) => {
111
+ var _a;
112
+ return (_a = p.theme.colors) == null ? void 0 : _a.primary;
113
+ }};
114
+ &:focus {
115
+ ${(p) => {
116
+ var _a;
117
+ return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && css`
118
+ ${linkTabStyle}
119
+ padding: ${(p2) => {
120
+ var _a2, _b;
121
+ return `calc(${(_a2 = p2.theme.sizes) == null ? void 0 : _a2.small} / 2) ${(_b = p2.theme.sizes) == null ? void 0 : _b.small}`;
122
+ }};
123
+ `;
124
+ }};
125
+ }
126
+ }
127
+ `;
128
+ const styling = css`
129
+ ${contentBox}
130
+ padding: ${(p) => {
131
+ var _a;
132
+ return (_a = p.theme.sizes) == null ? void 0 : _a.large;
133
+ }};
134
+ text-align: center;
135
+ cursor: pointer;
136
+ text-decoration: none;
137
+ i {
138
+ font-size: ${(p) => {
139
+ var _a;
140
+ return (_a = p.theme.fonts) == null ? void 0 : _a.huge;
141
+ }};
142
+ min-width: 1em;
143
+ min-height: 1em;
144
+ color: ${(p) => {
145
+ var _a;
146
+ return (_a = p.theme.colors) == null ? void 0 : _a.primary;
147
+ }};
148
+ }
149
+ span {
150
+ color: ${(p) => {
151
+ var _a;
152
+ return (_a = p.theme.colors) == null ? void 0 : _a.text;
153
+ }};
154
+ }
155
+ &:focus {
156
+ ${(p) => {
157
+ var _a;
158
+ return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && borderTabStyle;
159
+ }};
160
+ }
161
+ `;
162
+ const StyledWidgetLink = styled(WidgetLink)`
163
+ ${styling}
164
+ text-align: ${(p) => p.textAlign};
165
+ `;
166
+ const StyledLink = styled(Link)`
167
+ ${styling}
168
+ `;
169
+ const Description = styled(Text)`
170
+ line-height: 1.6em;
171
+ font-weight: 300;
172
+ font-size: ${(p) => {
173
+ var _a;
174
+ return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
175
+ }};
176
+ `;
177
+ const Heading = styled(Text)`
178
+ display: block;
179
+ font-size: ${(p) => {
180
+ var _a;
181
+ return (_a = p.theme.fonts) == null ? void 0 : _a.medium;
182
+ }};
183
+ margin: ${(p) => {
184
+ var _a;
185
+ return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
186
+ }} 0;
187
+ `;
188
+ const ContactIcon = styled.svg`
189
+ align-self: center;
190
+
191
+ path {
192
+ vector-effect: non-scaling-stroke;
193
+ stroke: ${(p) => {
194
+ var _a;
195
+ return (_a = p.theme.colors) == null ? void 0 : _a.primary;
196
+ }};
197
+ }
198
+ `;
199
+ export { ContactLink as default };
200
+ //# sourceMappingURL=contact-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contact-link.js","sources":["../src/contact-link.tsx"],"sourcesContent":["import {\r\n borderTabStyle,\r\n contentBox,\r\n Link,\r\n linkTabStyle,\r\n SymbolBadge,\r\n Text,\r\n useProperties,\r\n WidgetLink,\r\n} from '@telia-ace/knowledge-widget-ui';\r\nimport { appendClassNames } from '@telia-ace/widget-utilities';\r\nimport React from 'react';\r\nimport styled, { css } from 'styled-components';\r\nimport { ContactLinkComponentProps } from './contact-link-component';\r\n\r\ntype Props = {\r\n className: string;\r\n};\r\n\r\nconst ContactLink: React.FC<Props> = ({ className, ...other }) => {\r\n const {\r\n widget,\r\n route,\r\n mode = 'large',\r\n iconSize = 'large',\r\n symbol,\r\n descriptionLabel,\r\n label,\r\n textAlign,\r\n } = useProperties<ContactLinkComponentProps>();\r\n\r\n const align = textAlign ? textAlign : mode === 'large' ? 'center' : 'right';\r\n const iconSizePx = iconSize === 'large' ? '64' : '48';\r\n const activationOptions = {\r\n apiNotificationPriorityBy: 'contacts',\r\n };\r\n\r\n if (mode === 'compact') {\r\n return (\r\n <CompactWrapper\r\n {...other}\r\n className={appendClassNames(\r\n className,\r\n 'humany-contact-link',\r\n 'humany-contact-link-compact'\r\n )}\r\n textAlign={align}\r\n >\r\n {descriptionLabel && <Text>{descriptionLabel}</Text>}\r\n {route ? (\r\n <Link routeName={route}>{label}</Link>\r\n ) : (\r\n <WidgetLink\r\n aria-haspopup=\"dialog\"\r\n role=\"button\"\r\n activationOptions={activationOptions}\r\n widgetName={widget}\r\n >\r\n {label}\r\n </WidgetLink>\r\n )}\r\n </CompactWrapper>\r\n );\r\n }\r\n\r\n const children = (\r\n <>\r\n {symbol ? (\r\n <SymbolBadge symbol={symbol} />\r\n ) : (\r\n <ContactIcon\r\n width={iconSizePx}\r\n viewBox=\"0 0 63 37\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n d=\"M1 1H62M1 1L24.7579 15.6328M1 1V36M62 1V36M62 1L38.8842 15.5402M1 36H62M1 36L24.7579 15.6328M62 36L38.8842 15.5402M38.8842 15.5402L37.0898 16.6689C33.8642 18.6979 29.7658 18.7172 26.5212 16.7188L24.7579 15.6328\"\r\n stroke=\"#990AE3\"\r\n />\r\n </ContactIcon>\r\n )}\r\n {label && <Heading>{label}</Heading>}\r\n {descriptionLabel && <Description>{descriptionLabel}</Description>}\r\n </>\r\n );\r\n\r\n return route ? (\r\n <StyledLink\r\n {...other}\r\n className={appendClassNames(\r\n className,\r\n 'humany-contact-link',\r\n 'humany-contact-link-large'\r\n )}\r\n routeName={route}\r\n >\r\n {children}\r\n </StyledLink>\r\n ) : (\r\n <StyledWidgetLink\r\n {...other}\r\n aria-haspopup=\"dialog\"\r\n role=\"button\"\r\n className={appendClassNames(\r\n className,\r\n 'humany-contact-link',\r\n 'humany-contact-link-large'\r\n )}\r\n textAlign={align}\r\n widgetName={widget}\r\n activationOptions={activationOptions}\r\n >\r\n {children}\r\n </StyledWidgetLink>\r\n );\r\n};\r\n\r\nconst CompactWrapper = styled.div<{ textAlign: string } & any>`\r\n text-align: ${(p) => p.textAlign};\r\n font-weight: 300;\r\n\r\n span,\r\n a {\r\n display: inline-block;\r\n font-size: ${(p) => p.theme.fonts?.normal};\r\n }\r\n\r\n span {\r\n margin: 0 ${(p) => p.theme.sizes?.small} 0 0;\r\n }\r\n a {\r\n text-decoration: underline;\r\n color: ${(p) => p.theme.colors?.primary};\r\n &:focus {\r\n ${(p) =>\r\n p.theme.accessibility?.isTabbing &&\r\n css`\r\n ${linkTabStyle}\r\n padding: ${(p) => `calc(${p.theme.sizes?.small} / 2) ${p.theme.sizes?.small}`};\r\n `};\r\n }\r\n }\r\n`;\r\n\r\nconst styling = css`\r\n ${contentBox}\r\n padding: ${(p) => p.theme.sizes?.large};\r\n text-align: center;\r\n cursor: pointer;\r\n text-decoration: none;\r\n i {\r\n font-size: ${(p) => p.theme.fonts?.huge};\r\n min-width: 1em;\r\n min-height: 1em;\r\n color: ${(p) => p.theme.colors?.primary};\r\n }\r\n span {\r\n color: ${(p) => p.theme.colors?.text};\r\n }\r\n &:focus {\r\n ${(p) => p.theme.accessibility?.isTabbing && borderTabStyle};\r\n }\r\n`;\r\n\r\nconst StyledWidgetLink = styled(WidgetLink)<any>`\r\n ${styling}\r\n text-align: ${(p) => p.textAlign};\r\n`;\r\n\r\nconst StyledLink = styled(Link)<any>`\r\n ${styling}\r\n`;\r\n\r\nconst Description = styled(Text)`\r\n line-height: 1.6em;\r\n font-weight: 300;\r\n font-size: ${(p) => p.theme.fonts?.normal};\r\n`;\r\n\r\nconst Heading = styled(Text)`\r\n display: block;\r\n font-size: ${(p) => p.theme.fonts?.medium};\r\n margin: ${(p) => p.theme.sizes?.normal} 0;\r\n`;\r\n\r\nconst ContactIcon = styled.svg`\r\n align-self: center;\r\n\r\n path {\r\n vector-effect: non-scaling-stroke;\r\n stroke: ${(p) => p.theme.colors?.primary};\r\n }\r\n`;\r\n\r\nexport default ContactLink;\r\n"],"names":[],"mappings":"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"}
File without changes
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import { createReactComponent } from "@telia-ace/knowledge-widget-ui";
2
+ const ContactLinkComponent = (container) => {
3
+ return createReactComponent(container, "contact-link", import("./contact-link.js"));
4
+ };
5
+ export { ContactLinkComponent as default };
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/contact-link-component.ts"],"sourcesContent":["import { Symbol } from '@telia-ace/knowledge-widget-core';\r\nimport { createReactComponent } from '@telia-ace/knowledge-widget-ui';\r\nimport { Container } from '@webprovisions/platform';\r\n\r\nexport type ContactLinkComponentProps = {\r\n widget: string;\r\n route: string;\r\n mode: 'large' | 'compact';\r\n iconSize: 'large' | 'small';\r\n symbol?: Symbol;\r\n label: string;\r\n descriptionLabel: string;\r\n textAlign: string;\r\n};\r\n\r\nconst ContactLinkComponent = (container: Container) => {\r\n return createReactComponent(container, 'contact-link', import('./contact-link'));\r\n};\r\n\r\nexport default ContactLinkComponent;\r\n"],"names":[],"mappings":";AAeM,MAAA,uBAAuB,CAAC,cAAyB;AACnD,SAAO,qBAAqB,WAAW,gBAAgB,OAAO,oBAAiB;AACnF;;"}
package/package.json CHANGED
@@ -1,33 +1,32 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-widget-components-contact-link",
3
- "version": "1.0.6",
3
+ "version": "1.0.11",
4
4
  "description": "Contact link 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-ui": "^1.0.10",
30
- "@telia-ace/widget-utilities": "^1.0.1",
27
+ "@telia-ace/knowledge-widget-core": "^1.0.10",
28
+ "@telia-ace/knowledge-widget-ui": "^1.0.14",
29
+ "@telia-ace/widget-utilities": "^1.0.2",
31
30
  "@webprovisions/platform": "^1.1.2"
32
31
  },
33
32
  "peerDependencies": {
@@ -40,5 +39,5 @@
40
39
  "@types/react-dom": "^16.8.0",
41
40
  "@types/styled-components": "^5.1.7"
42
41
  },
43
- "gitHead": "141db586e3989e54f2671aa2079c62a250a00557"
42
+ "gitHead": "3821c16ef534210308ecca6b2e16d098ddde37a4"
44
43
  }
@@ -1,14 +0,0 @@
1
- import { Symbol } from '@telia-ace/knowledge-widget-core';
2
- import { Container } from '@webprovisions/platform';
3
- export declare type ContactLinkComponentProps = {
4
- widget: string;
5
- route: string;
6
- mode: 'large' | 'compact';
7
- iconSize: 'large' | 'small';
8
- symbol?: Symbol;
9
- label: string;
10
- descriptionLabel: string;
11
- textAlign: string;
12
- };
13
- declare const ContactLinkComponent: (container: Container) => Promise<void>;
14
- export default ContactLinkComponent;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- var knowledge_widget_ui_1 = require("@telia-ace/knowledge-widget-ui");
27
- var ContactLinkComponent = function (container) {
28
- return (0, knowledge_widget_ui_1.createReactComponent)(container, 'contact-link', Promise.resolve().then(function () { return __importStar(require('./contact-link')); }));
29
- };
30
- exports.default = ContactLinkComponent;
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- declare type Props = {
3
- className: string;
4
- };
5
- declare const ContactLink: React.FC<Props>;
6
- export default ContactLink;
@@ -1,90 +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 ContactLink = function (_a) {
60
- var className = _a.className, other = __rest(_a, ["className"]);
61
- var _b = (0, knowledge_widget_ui_1.useProperties)(), widget = _b.widget, route = _b.route, _c = _b.mode, mode = _c === void 0 ? 'large' : _c, _d = _b.iconSize, iconSize = _d === void 0 ? 'large' : _d, symbol = _b.symbol, descriptionLabel = _b.descriptionLabel, label = _b.label, textAlign = _b.textAlign;
62
- var align = textAlign ? textAlign : mode === 'large' ? 'center' : 'right';
63
- var iconSizePx = iconSize === 'large' ? '64' : '48';
64
- var activationOptions = {
65
- apiNotificationPriorityBy: 'contacts',
66
- };
67
- if (mode === 'compact') {
68
- return (react_1.default.createElement(CompactWrapper, __assign({}, other, { className: (0, widget_utilities_1.appendClassNames)(className, 'humany-contact-link', 'humany-contact-link-compact'), textAlign: align }),
69
- descriptionLabel && react_1.default.createElement(knowledge_widget_ui_1.Text, null, descriptionLabel),
70
- route ? (react_1.default.createElement(knowledge_widget_ui_1.Link, { routeName: route }, label)) : (react_1.default.createElement(knowledge_widget_ui_1.WidgetLink, { "aria-haspopup": "dialog", role: "button", activationOptions: activationOptions, widgetName: widget }, label))));
71
- }
72
- var children = (react_1.default.createElement(react_1.default.Fragment, null,
73
- symbol ? (react_1.default.createElement(knowledge_widget_ui_1.SymbolBadge, { symbol: symbol })) : (react_1.default.createElement(ContactIcon, { width: iconSizePx, viewBox: "0 0 63 37", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
74
- react_1.default.createElement("path", { d: "M1 1H62M1 1L24.7579 15.6328M1 1V36M62 1V36M62 1L38.8842 15.5402M1 36H62M1 36L24.7579 15.6328M62 36L38.8842 15.5402M38.8842 15.5402L37.0898 16.6689C33.8642 18.6979 29.7658 18.7172 26.5212 16.7188L24.7579 15.6328", stroke: "#990AE3" }))),
75
- label && react_1.default.createElement(Heading, null, label),
76
- descriptionLabel && react_1.default.createElement(Description, null, descriptionLabel)));
77
- return route ? (react_1.default.createElement(StyledLink, __assign({}, other, { className: (0, widget_utilities_1.appendClassNames)(className, 'humany-contact-link', 'humany-contact-link-large'), routeName: route }), children)) : (react_1.default.createElement(StyledWidgetLink, __assign({}, other, { "aria-haspopup": "dialog", role: "button", className: (0, widget_utilities_1.appendClassNames)(className, 'humany-contact-link', 'humany-contact-link-large'), textAlign: align, widgetName: widget, activationOptions: activationOptions }), children));
78
- };
79
- var CompactWrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n text-align: ", ";\n font-weight: 300;\n\n span,\n a {\n display: inline-block;\n font-size: ", ";\n }\n\n span {\n margin: 0 ", " 0 0;\n }\n a {\n text-decoration: underline;\n color: ", ";\n &:focus {\n ", ";\n }\n }\n"], ["\n text-align: ", ";\n font-weight: 300;\n\n span,\n a {\n display: inline-block;\n font-size: ", ";\n }\n\n span {\n margin: 0 ", " 0 0;\n }\n a {\n text-decoration: underline;\n color: ", ";\n &:focus {\n ", ";\n }\n }\n"])), function (p) { return p.textAlign; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary; }, function (p) {
80
- var _a;
81
- return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n padding: ", ";\n "], ["\n ", "\n padding: ", ";\n "])), knowledge_widget_ui_1.linkTabStyle, function (p) { var _a, _b; return "calc(".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small, " / 2) ").concat((_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.small); });
82
- });
83
- var styling = (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n padding: ", ";\n text-align: center;\n cursor: pointer;\n text-decoration: none;\n i {\n font-size: ", ";\n min-width: 1em;\n min-height: 1em;\n color: ", ";\n }\n span {\n color: ", ";\n }\n &:focus {\n ", ";\n }\n"], ["\n ", "\n padding: ", ";\n text-align: center;\n cursor: pointer;\n text-decoration: none;\n i {\n font-size: ", ";\n min-width: 1em;\n min-height: 1em;\n color: ", ";\n }\n span {\n color: ", ";\n }\n &:focus {\n ", ";\n }\n"])), knowledge_widget_ui_1.contentBox, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.large; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.huge; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text; }, function (p) { var _a; return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && knowledge_widget_ui_1.borderTabStyle; });
84
- var StyledWidgetLink = (0, styled_components_1.default)(knowledge_widget_ui_1.WidgetLink)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", "\n text-align: ", ";\n"], ["\n ", "\n text-align: ", ";\n"])), styling, function (p) { return p.textAlign; });
85
- var StyledLink = (0, styled_components_1.default)(knowledge_widget_ui_1.Link)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), styling);
86
- var Description = (0, styled_components_1.default)(knowledge_widget_ui_1.Text)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n line-height: 1.6em;\n font-weight: 300;\n font-size: ", ";\n"], ["\n line-height: 1.6em;\n font-weight: 300;\n font-size: ", ";\n"])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.normal; });
87
- var Heading = (0, styled_components_1.default)(knowledge_widget_ui_1.Text)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: block;\n font-size: ", ";\n margin: ", " 0;\n"], ["\n display: block;\n font-size: ", ";\n margin: ", " 0;\n"])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.medium; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; });
88
- var ContactIcon = styled_components_1.default.svg(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n align-self: center;\n\n path {\n vector-effect: non-scaling-stroke;\n stroke: ", ";\n }\n"], ["\n align-self: center;\n\n path {\n vector-effect: non-scaling-stroke;\n stroke: ", ";\n }\n"])), function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary; });
89
- exports.default = ContactLink;
90
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
package/lib/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import ContactLinkComponent from './contact-link-component';
2
- export default ContactLinkComponent;
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 contact_link_component_1 = __importDefault(require("./contact-link-component"));
7
- exports.default = contact_link_component_1.default;
@@ -1,5 +0,0 @@
1
- import { createReactComponent } from '@telia-ace/knowledge-widget-ui';
2
- var ContactLinkComponent = function (container) {
3
- return createReactComponent(container, 'contact-link', import('./contact-link'));
4
- };
5
- export default ContactLinkComponent;
@@ -1,62 +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, Link, linkTabStyle, SymbolBadge, Text, useProperties, WidgetLink, } from '@telia-ace/knowledge-widget-ui';
28
- import { appendClassNames } from '@telia-ace/widget-utilities';
29
- import React from 'react';
30
- import styled, { css } from 'styled-components';
31
- var ContactLink = function (_a) {
32
- var className = _a.className, other = __rest(_a, ["className"]);
33
- var _b = useProperties(), widget = _b.widget, route = _b.route, _c = _b.mode, mode = _c === void 0 ? 'large' : _c, _d = _b.iconSize, iconSize = _d === void 0 ? 'large' : _d, symbol = _b.symbol, descriptionLabel = _b.descriptionLabel, label = _b.label, textAlign = _b.textAlign;
34
- var align = textAlign ? textAlign : mode === 'large' ? 'center' : 'right';
35
- var iconSizePx = iconSize === 'large' ? '64' : '48';
36
- var activationOptions = {
37
- apiNotificationPriorityBy: 'contacts',
38
- };
39
- if (mode === 'compact') {
40
- return (React.createElement(CompactWrapper, __assign({}, other, { className: appendClassNames(className, 'humany-contact-link', 'humany-contact-link-compact'), textAlign: align }),
41
- descriptionLabel && React.createElement(Text, null, descriptionLabel),
42
- route ? (React.createElement(Link, { routeName: route }, label)) : (React.createElement(WidgetLink, { "aria-haspopup": "dialog", role: "button", activationOptions: activationOptions, widgetName: widget }, label))));
43
- }
44
- var children = (React.createElement(React.Fragment, null,
45
- symbol ? (React.createElement(SymbolBadge, { symbol: symbol })) : (React.createElement(ContactIcon, { width: iconSizePx, viewBox: "0 0 63 37", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
46
- React.createElement("path", { d: "M1 1H62M1 1L24.7579 15.6328M1 1V36M62 1V36M62 1L38.8842 15.5402M1 36H62M1 36L24.7579 15.6328M62 36L38.8842 15.5402M38.8842 15.5402L37.0898 16.6689C33.8642 18.6979 29.7658 18.7172 26.5212 16.7188L24.7579 15.6328", stroke: "#990AE3" }))),
47
- label && React.createElement(Heading, null, label),
48
- descriptionLabel && React.createElement(Description, null, descriptionLabel)));
49
- return route ? (React.createElement(StyledLink, __assign({}, other, { className: appendClassNames(className, 'humany-contact-link', 'humany-contact-link-large'), routeName: route }), children)) : (React.createElement(StyledWidgetLink, __assign({}, other, { "aria-haspopup": "dialog", role: "button", className: appendClassNames(className, 'humany-contact-link', 'humany-contact-link-large'), textAlign: align, widgetName: widget, activationOptions: activationOptions }), children));
50
- };
51
- var CompactWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n text-align: ", ";\n font-weight: 300;\n\n span,\n a {\n display: inline-block;\n font-size: ", ";\n }\n\n span {\n margin: 0 ", " 0 0;\n }\n a {\n text-decoration: underline;\n color: ", ";\n &:focus {\n ", ";\n }\n }\n"], ["\n text-align: ", ";\n font-weight: 300;\n\n span,\n a {\n display: inline-block;\n font-size: ", ";\n }\n\n span {\n margin: 0 ", " 0 0;\n }\n a {\n text-decoration: underline;\n color: ", ";\n &:focus {\n ", ";\n }\n }\n"])), function (p) { return p.textAlign; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary; }, function (p) {
52
- var _a;
53
- return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n padding: ", ";\n "], ["\n ", "\n padding: ", ";\n "])), linkTabStyle, function (p) { var _a, _b; return "calc(".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small, " / 2) ").concat((_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.small); });
54
- });
55
- var styling = css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n padding: ", ";\n text-align: center;\n cursor: pointer;\n text-decoration: none;\n i {\n font-size: ", ";\n min-width: 1em;\n min-height: 1em;\n color: ", ";\n }\n span {\n color: ", ";\n }\n &:focus {\n ", ";\n }\n"], ["\n ", "\n padding: ", ";\n text-align: center;\n cursor: pointer;\n text-decoration: none;\n i {\n font-size: ", ";\n min-width: 1em;\n min-height: 1em;\n color: ", ";\n }\n span {\n color: ", ";\n }\n &:focus {\n ", ";\n }\n"])), contentBox, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.large; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.huge; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text; }, function (p) { var _a; return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && borderTabStyle; });
56
- var StyledWidgetLink = styled(WidgetLink)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", "\n text-align: ", ";\n"], ["\n ", "\n text-align: ", ";\n"])), styling, function (p) { return p.textAlign; });
57
- var StyledLink = styled(Link)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), styling);
58
- var Description = styled(Text)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n line-height: 1.6em;\n font-weight: 300;\n font-size: ", ";\n"], ["\n line-height: 1.6em;\n font-weight: 300;\n font-size: ", ";\n"])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.normal; });
59
- var Heading = styled(Text)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: block;\n font-size: ", ";\n margin: ", " 0;\n"], ["\n display: block;\n font-size: ", ";\n margin: ", " 0;\n"])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.medium; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; });
60
- var ContactIcon = styled.svg(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n align-self: center;\n\n path {\n vector-effect: non-scaling-stroke;\n stroke: ", ";\n }\n"], ["\n align-self: center;\n\n path {\n vector-effect: non-scaling-stroke;\n stroke: ", ";\n }\n"])), function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary; });
61
- export default ContactLink;
62
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
package/lib-esm/index.js DELETED
@@ -1,2 +0,0 @@
1
- import ContactLinkComponent from './contact-link-component';
2
- export default ContactLinkComponent;