@telia-ace/knowledge-widget-components-contact-link 1.0.16 → 1.0.19

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,181 @@
1
+ var C = Object.defineProperty, T = Object.defineProperties;
2
+ var B = Object.getOwnPropertyDescriptors;
3
+ var m = Object.getOwnPropertySymbols;
4
+ var E = Object.prototype.hasOwnProperty, w = Object.prototype.propertyIsEnumerable;
5
+ var x = (t, e, n) => e in t ? C(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, g = (t, e) => {
6
+ for (var n in e || (e = {}))
7
+ E.call(e, n) && x(t, n, e[n]);
8
+ if (m)
9
+ for (var n of m(e))
10
+ w.call(e, n) && x(t, n, e[n]);
11
+ return t;
12
+ }, p = (t, e) => T(t, B(e));
13
+ var L = (t, e) => {
14
+ var n = {};
15
+ for (var i in t)
16
+ E.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
17
+ if (t != null && m)
18
+ for (var i of m(t))
19
+ e.indexOf(i) < 0 && w.call(t, i) && (n[i] = t[i]);
20
+ return n;
21
+ };
22
+ import { useProperties as H, Text as d, Link as z, WidgetLink as M, SymbolBadge as P, linkTabStyle as W, contentBox as V, borderTabStyle as D } from "@telia-ace/knowledge-widget-ui";
23
+ import { appendClassNames as h } from "@telia-ace/widget-utilities";
24
+ import o from "react";
25
+ import a, { css as N } from "styled-components";
26
+ const X = (n) => {
27
+ var i = n, { className: t } = i, e = L(i, ["className"]);
28
+ const {
29
+ widget: l,
30
+ route: c,
31
+ mode: u = "large",
32
+ iconSize: v = "large",
33
+ symbol: f,
34
+ descriptionLabel: r,
35
+ label: s,
36
+ textAlign: y
37
+ } = H(), $ = y || (u === "large" ? "center" : "right"), A = v === "large" ? "64" : "48", b = {
38
+ apiNotificationPriorityBy: "contacts"
39
+ };
40
+ if (u === "compact")
41
+ return /* @__PURE__ */ o.createElement(F, p(g({}, e), {
42
+ className: h(t, "humany-contact-link", "humany-contact-link-compact"),
43
+ textAlign: $
44
+ }), r && /* @__PURE__ */ o.createElement(d, null, r), c ? /* @__PURE__ */ o.createElement(z, {
45
+ routeName: c
46
+ }, s) : /* @__PURE__ */ o.createElement(M, {
47
+ "aria-haspopup": "dialog",
48
+ role: "button",
49
+ activationOptions: b,
50
+ widgetName: l
51
+ }, s));
52
+ const k = /* @__PURE__ */ o.createElement(o.Fragment, null, f ? /* @__PURE__ */ o.createElement(P, {
53
+ symbol: f
54
+ }) : /* @__PURE__ */ o.createElement(q, {
55
+ width: A,
56
+ viewBox: "0 0 63 37",
57
+ fill: "none",
58
+ xmlns: "http://www.w3.org/2000/svg"
59
+ }, /* @__PURE__ */ o.createElement("path", {
60
+ 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",
61
+ stroke: "#990AE3"
62
+ })), s && /* @__PURE__ */ o.createElement(j, null, s), r && /* @__PURE__ */ o.createElement(R, null, r));
63
+ return c ? /* @__PURE__ */ o.createElement(O, p(g({}, e), {
64
+ className: h(t, "humany-contact-link", "humany-contact-link-large"),
65
+ routeName: c
66
+ }), k) : /* @__PURE__ */ o.createElement(I, p(g({}, e), {
67
+ "aria-haspopup": "dialog",
68
+ role: "button",
69
+ className: h(t, "humany-contact-link", "humany-contact-link-large"),
70
+ textAlign: $,
71
+ widgetName: l,
72
+ activationOptions: b
73
+ }), k);
74
+ }, F = a.div`
75
+ text-align: ${(t) => t.textAlign};
76
+ font-weight: 300;
77
+
78
+ span,
79
+ a {
80
+ display: inline-block;
81
+ font-size: ${(t) => {
82
+ var e;
83
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
84
+ }};
85
+ }
86
+
87
+ span {
88
+ margin: 0 ${(t) => {
89
+ var e;
90
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
91
+ }} 0 0;
92
+ }
93
+ a {
94
+ text-decoration: underline;
95
+ color: ${(t) => {
96
+ var e;
97
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
98
+ }};
99
+ &:focus {
100
+ ${(t) => {
101
+ var e;
102
+ return ((e = t.theme.accessibility) == null ? void 0 : e.isTabbing) && N`
103
+ ${W}
104
+ padding: ${(n) => {
105
+ var i, l;
106
+ return `calc(${(i = n.theme.sizes) == null ? void 0 : i.small} / 2) ${(l = n.theme.sizes) == null ? void 0 : l.small}`;
107
+ }};
108
+ `;
109
+ }};
110
+ }
111
+ }
112
+ `, S = N`
113
+ ${V}
114
+ padding: ${(t) => {
115
+ var e;
116
+ return (e = t.theme.sizes) == null ? void 0 : e.large;
117
+ }};
118
+ text-align: center;
119
+ cursor: pointer;
120
+ text-decoration: none;
121
+ i {
122
+ font-size: ${(t) => {
123
+ var e;
124
+ return (e = t.theme.fonts) == null ? void 0 : e.huge;
125
+ }};
126
+ min-width: 1em;
127
+ min-height: 1em;
128
+ color: ${(t) => {
129
+ var e;
130
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
131
+ }};
132
+ }
133
+ span {
134
+ color: ${(t) => {
135
+ var e;
136
+ return (e = t.theme.colors) == null ? void 0 : e.text;
137
+ }};
138
+ }
139
+ &:focus {
140
+ ${(t) => {
141
+ var e;
142
+ return ((e = t.theme.accessibility) == null ? void 0 : e.isTabbing) && D;
143
+ }};
144
+ }
145
+ `, I = a(M)`
146
+ ${S}
147
+ text-align: ${(t) => t.textAlign};
148
+ `, O = a(z)`
149
+ ${S}
150
+ `, R = a(d)`
151
+ line-height: 1.6em;
152
+ font-weight: 300;
153
+ font-size: ${(t) => {
154
+ var e;
155
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
156
+ }};
157
+ `, j = a(d)`
158
+ display: block;
159
+ font-size: ${(t) => {
160
+ var e;
161
+ return (e = t.theme.fonts) == null ? void 0 : e.medium;
162
+ }};
163
+ margin: ${(t) => {
164
+ var e;
165
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
166
+ }} 0;
167
+ `, q = a.svg`
168
+ align-self: center;
169
+
170
+ path {
171
+ vector-effect: non-scaling-stroke;
172
+ stroke: ${(t) => {
173
+ var e;
174
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
175
+ }};
176
+ }
177
+ `;
178
+ export {
179
+ X as default
180
+ };
181
+ //# sourceMappingURL=contact-link.df5d10eb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contact-link.df5d10eb.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":";;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,IAA+B,CAAC,MAA4B;AAA5B,aAAE,mBAAF,GAAgB,MAAhB,GAAgB,CAAd;AAC9B,QAAA;AAAA,IACF;AAAA,IACA;AAAA,IACA,UAAO;AAAA,IACP,cAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACA,EAAyC,GAEvC,IAAQ,KAAwB,OAAS,UAAU,WAAW,UAC9D,IAAa,M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,kBAAe;AAAA;AAAA,GAG9B,IAAc,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,kBAKT,CAAC,MAAM;;AAAA,gBAAE,MAAM,WAAR,kBAAgB;AAAA;AAAA;AAAA;"}
package/dist/index.js CHANGED
@@ -1,6 +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"));
1
+ import { createReactComponent as o } from "@telia-ace/knowledge-widget-ui";
2
+ const e = (t) => o(t, "contact-link", import("./contact-link.df5d10eb.js"));
3
+ export {
4
+ e as default
4
5
  };
5
- export { ContactLinkComponent as default };
6
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +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;;"}
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,IAAuB,CAAC,MACnB,EAAqB,GAAW,gBAAgB,OAAO,6BAAiB;"}
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-widget-components-contact-link",
3
- "version": "1.0.16",
3
+ "version": "1.0.19",
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
- "source": "src/index.ts",
11
- "module": "dist/index.js",
10
+ "main": "dist/index.js",
11
+ "type": "module",
12
12
  "types": "dist/index.d.ts",
13
13
  "files": [
14
14
  "LICENSE.txt",
@@ -25,8 +25,8 @@
25
25
  },
26
26
  "sideEffects": false,
27
27
  "dependencies": {
28
- "@telia-ace/knowledge-widget-core": "^1.0.13",
29
- "@telia-ace/knowledge-widget-ui": "^1.0.19",
28
+ "@telia-ace/knowledge-widget-core": "^1.0.17",
29
+ "@telia-ace/knowledge-widget-ui": "^1.0.23",
30
30
  "@telia-ace/widget-utilities": "^1.0.2",
31
31
  "@webprovisions/platform": "^1.1.2"
32
32
  },
@@ -40,5 +40,5 @@
40
40
  "@types/react-dom": "^16.8.0",
41
41
  "@types/styled-components": "^5.1.7"
42
42
  },
43
- "gitHead": "43581cc2553504251c952d927cc6c6743d2412ec"
43
+ "gitHead": "44efbdca7f57d6997132792020922c89b013c44d"
44
44
  }
@@ -1,200 +0,0 @@
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
@@ -1 +0,0 @@
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,cAA+B,CAAC,OAA4B;AAA5B,eAAE,gBAAF,IAAgB,kBAAhB,IAAgB,CAAd;AAC9B,QAAA;AAAA,IACF;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,WAAW;AAAA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