@telia-ace/knowledge-widget-components-contact-link 0.0.1

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,60 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),w=require("@telia-ace/widget-ui"),b=require("@emotion/react"),c=require("@emotion/styled"),i=require("@telia-ace/knowledge-widget-ui"),m=require("@telia-ace/widget-utilities"),j=({className:e,...t})=>{const{widget:o,route:s,mode:a="large",iconSize:y="large",symbol:g,descriptionLabel:l,label:r,textAlign:h}=i.useProperties(),$=w.useContainer(),{events:d}=$.get("$widget"),p=h||(a==="large"?"center":"right"),f=y==="large"?"64":"48",u={apiNotificationPriorityBy:"contacts"};if(a==="compact")return n.jsxs(L,{...t,className:m.appendClassNames(e,"humany-contact-link","humany-contact-link-compact"),onClick:()=>{d.dispatch("tracking:contact-link-clicked",{})},textAlign:p,children:[l&&n.jsx(i.Text,{children:l}),s?n.jsx(i.Link,{routeName:s,children:r}):n.jsx(i.WidgetLink,{"aria-haspopup":"dialog",role:"button",activationOptions:u,widgetName:o,children:r})]});const k=n.jsxs(n.Fragment,{children:[g?n.jsx(i.SymbolBadge,{symbol:g}):n.jsx(N,{width:f,viewBox:"0 0 63 37",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.jsx("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"})}),r&&n.jsx(M,{children:r}),l&&n.jsx(v,{children:l})]});return s?n.jsx(C,{...t,className:m.appendClassNames(e,"humany-contact-link","humany-contact-link-large"),onClick:()=>{d.dispatch("tracking:contact-link-clicked",{})},routeName:s,children:k}):n.jsx(z,{...t,"aria-haspopup":"dialog",role:"button",className:m.appendClassNames(e,"humany-contact-link","humany-contact-link-large"),onClick:()=>{d.dispatch("tracking:contact-link-clicked",{})},textAlign:p,widgetName:o,activationOptions:u,children:k})},L=c.div`
2
+ text-align: ${e=>e.textAlign};
3
+ font-weight: 300;
4
+
5
+ span,
6
+ a {
7
+ display: inline-block;
8
+ font-size: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.normal}};
9
+ }
10
+
11
+ span {
12
+ margin: 0 ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.small}} 0 0;
13
+ }
14
+ a {
15
+ text-decoration: underline;
16
+ color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.primary}};
17
+ &:focus-visible {
18
+ ${i.linkTabStyle}
19
+ padding: ${e=>{var t,o;return`calc(${(t=e.theme.sizes)==null?void 0:t.small} / 2) ${(o=e.theme.sizes)==null?void 0:o.small}`}};
20
+ }
21
+ }
22
+ `,x=e=>{var t,o,s,a;return b.css`
23
+ ${i.contentBox(e)}
24
+ padding: ${(t=e.theme.sizes)==null?void 0:t.large};
25
+ text-align: center;
26
+ cursor: pointer;
27
+ text-decoration: none;
28
+ i {
29
+ font-size: ${(o=e.theme.fonts)==null?void 0:o.huge};
30
+ min-width: 1em;
31
+ min-height: 1em;
32
+ color: ${(s=e.theme.colors)==null?void 0:s.primary};
33
+ }
34
+ span {
35
+ color: ${(a=e.theme.colors)==null?void 0:a.text};
36
+ }
37
+ &:focus-visible {
38
+ ${i.borderTabStyle(e)};
39
+ }
40
+ `},z=c(i.WidgetLink)`
41
+ ${x}
42
+ text-align: ${e=>e.textAlign};
43
+ `,C=c(i.Link)`
44
+ ${x}
45
+ `,v=c(i.Text)`
46
+ line-height: 1.6em;
47
+ font-weight: 300;
48
+ font-size: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.normal}};
49
+ `,M=c(i.Text)`
50
+ display: block;
51
+ font-size: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.medium}};
52
+ margin: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.normal}} 0;
53
+ `,N=c.svg`
54
+ align-self: center;
55
+
56
+ path {
57
+ vector-effect: non-scaling-stroke;
58
+ stroke: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.primary}};
59
+ }
60
+ `;exports.default=j;
@@ -0,0 +1,193 @@
1
+ import { jsxs as u, jsx as n, Fragment as z } from "react/jsx-runtime";
2
+ import { useContainer as v } from "@telia-ace/widget-ui";
3
+ import { css as C } from "@emotion/react";
4
+ import c from "@emotion/styled";
5
+ import { useProperties as M, Text as d, Link as $, WidgetLink as y, SymbolBadge as N, linkTabStyle as S, contentBox as A, borderTabStyle as B } from "@telia-ace/knowledge-widget-ui";
6
+ import { appendClassNames as m } from "@telia-ace/widget-utilities";
7
+ const G = ({ className: t, ...e }) => {
8
+ const {
9
+ widget: i,
10
+ route: o,
11
+ mode: a = "large",
12
+ iconSize: b = "large",
13
+ symbol: g,
14
+ descriptionLabel: l,
15
+ label: r,
16
+ textAlign: h
17
+ } = M(), w = v(), { events: s } = w.get("$widget"), p = h || (a === "large" ? "center" : "right"), L = b === "large" ? "64" : "48", k = {
18
+ apiNotificationPriorityBy: "contacts"
19
+ };
20
+ if (a === "compact")
21
+ return /* @__PURE__ */ u(
22
+ H,
23
+ {
24
+ ...e,
25
+ className: m(
26
+ t,
27
+ "humany-contact-link",
28
+ "humany-contact-link-compact"
29
+ ),
30
+ onClick: () => {
31
+ s.dispatch("tracking:contact-link-clicked", {});
32
+ },
33
+ textAlign: p,
34
+ children: [
35
+ l && /* @__PURE__ */ n(d, { children: l }),
36
+ o ? /* @__PURE__ */ n($, { routeName: o, children: r }) : /* @__PURE__ */ n(
37
+ y,
38
+ {
39
+ "aria-haspopup": "dialog",
40
+ role: "button",
41
+ activationOptions: k,
42
+ widgetName: i,
43
+ children: r
44
+ }
45
+ )
46
+ ]
47
+ }
48
+ );
49
+ const f = /* @__PURE__ */ u(z, { children: [
50
+ g ? /* @__PURE__ */ n(N, { symbol: g }) : /* @__PURE__ */ n(
51
+ V,
52
+ {
53
+ width: L,
54
+ viewBox: "0 0 63 37",
55
+ fill: "none",
56
+ xmlns: "http://www.w3.org/2000/svg",
57
+ children: /* @__PURE__ */ n(
58
+ "path",
59
+ {
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
+ }
63
+ )
64
+ }
65
+ ),
66
+ r && /* @__PURE__ */ n(j, { children: r }),
67
+ l && /* @__PURE__ */ n(W, { children: l })
68
+ ] });
69
+ return o ? /* @__PURE__ */ n(
70
+ T,
71
+ {
72
+ ...e,
73
+ className: m(
74
+ t,
75
+ "humany-contact-link",
76
+ "humany-contact-link-large"
77
+ ),
78
+ onClick: () => {
79
+ s.dispatch("tracking:contact-link-clicked", {});
80
+ },
81
+ routeName: o,
82
+ children: f
83
+ }
84
+ ) : /* @__PURE__ */ n(
85
+ P,
86
+ {
87
+ ...e,
88
+ "aria-haspopup": "dialog",
89
+ role: "button",
90
+ className: m(
91
+ t,
92
+ "humany-contact-link",
93
+ "humany-contact-link-large"
94
+ ),
95
+ onClick: () => {
96
+ s.dispatch("tracking:contact-link-clicked", {});
97
+ },
98
+ textAlign: p,
99
+ widgetName: i,
100
+ activationOptions: k,
101
+ children: f
102
+ }
103
+ );
104
+ }, H = c.div`
105
+ text-align: ${(t) => t.textAlign};
106
+ font-weight: 300;
107
+
108
+ span,
109
+ a {
110
+ display: inline-block;
111
+ font-size: ${(t) => {
112
+ var e;
113
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
114
+ }};
115
+ }
116
+
117
+ span {
118
+ margin: 0 ${(t) => {
119
+ var e;
120
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
121
+ }} 0 0;
122
+ }
123
+ a {
124
+ text-decoration: underline;
125
+ color: ${(t) => {
126
+ var e;
127
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
128
+ }};
129
+ &:focus-visible {
130
+ ${S}
131
+ padding: ${(t) => {
132
+ var e, i;
133
+ return `calc(${(e = t.theme.sizes) == null ? void 0 : e.small} / 2) ${(i = t.theme.sizes) == null ? void 0 : i.small}`;
134
+ }};
135
+ }
136
+ }
137
+ `, x = (t) => {
138
+ var e, i, o, a;
139
+ return C`
140
+ ${A(t)}
141
+ padding: ${(e = t.theme.sizes) == null ? void 0 : e.large};
142
+ text-align: center;
143
+ cursor: pointer;
144
+ text-decoration: none;
145
+ i {
146
+ font-size: ${(i = t.theme.fonts) == null ? void 0 : i.huge};
147
+ min-width: 1em;
148
+ min-height: 1em;
149
+ color: ${(o = t.theme.colors) == null ? void 0 : o.primary};
150
+ }
151
+ span {
152
+ color: ${(a = t.theme.colors) == null ? void 0 : a.text};
153
+ }
154
+ &:focus-visible {
155
+ ${B(t)};
156
+ }
157
+ `;
158
+ }, P = c(y)`
159
+ ${x}
160
+ text-align: ${(t) => t.textAlign};
161
+ `, T = c($)`
162
+ ${x}
163
+ `, W = c(d)`
164
+ line-height: 1.6em;
165
+ font-weight: 300;
166
+ font-size: ${(t) => {
167
+ var e;
168
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
169
+ }};
170
+ `, j = c(d)`
171
+ display: block;
172
+ font-size: ${(t) => {
173
+ var e;
174
+ return (e = t.theme.fonts) == null ? void 0 : e.medium;
175
+ }};
176
+ margin: ${(t) => {
177
+ var e;
178
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
179
+ }} 0;
180
+ `, V = c.svg`
181
+ align-self: center;
182
+
183
+ path {
184
+ vector-effect: non-scaling-stroke;
185
+ stroke: ${(t) => {
186
+ var e;
187
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
188
+ }};
189
+ }
190
+ `;
191
+ export {
192
+ G as default
193
+ };
@@ -0,0 +1,15 @@
1
+ import { Symbol } from '../../../knowledge/core/src/index.ts';
2
+ import { Container } from '@webprovisions/platform';
3
+
4
+ export type ContactLinkComponentProps = {
5
+ widget: string;
6
+ route: string;
7
+ mode: 'large' | 'compact';
8
+ iconSize: 'large' | 'small';
9
+ symbol?: Symbol;
10
+ label: string;
11
+ descriptionLabel: string;
12
+ textAlign: string;
13
+ };
14
+ declare const ContactLinkComponent: (container: Container) => Promise<void>;
15
+ export default ContactLinkComponent;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+
3
+ type Props = {
4
+ className: string;
5
+ };
6
+ declare const ContactLink: React.FC<Props>;
7
+ export default ContactLink;
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { default as ContactLinkComponent } from './contact-link-component';
2
+
3
+ export default ContactLinkComponent;
package/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";const t=require("@telia-ace/knowledge-widget-ui"),n=e=>t.createReactComponent(e,"contact-link",Promise.resolve().then(()=>require("./contact-link-44666ccd.js")));module.exports=n;
package/index.mjs ADDED
@@ -0,0 +1,9 @@
1
+ import { createReactComponent as o } from "@telia-ace/knowledge-widget-ui";
2
+ const e = (t) => o(
3
+ t,
4
+ "contact-link",
5
+ import("./contact-link-bf35f02f.mjs")
6
+ );
7
+ export {
8
+ e as default
9
+ };
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@telia-ace/knowledge-widget-components-contact-link",
3
+ "version": "0.0.1",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./index.mjs",
9
+ "require": "./index.js"
10
+ }
11
+ },
12
+ "dependencies": {
13
+ "@telia-ace/knowledge-widget-core": "*",
14
+ "@telia-ace/knowledge-widget-ui": "*",
15
+ "@telia-ace/widget-utilities": "*",
16
+ "@webprovisions/platform": "^1.1.4",
17
+ "@telia-ace/widget-ui": "*"
18
+ },
19
+ "peerDependencies": {
20
+ "@emotion/react": "11.11.1",
21
+ "@emotion/styled": "11.11.0",
22
+ "react": "18.2.0"
23
+ }
24
+ }