@telia-ace/widget-components-back-link 1.1.1-rc.2 → 1.1.1-rc.3

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,100 @@
1
+ import { jsx as n, jsxs as o } from "react/jsx-runtime";
2
+ import c from "@emotion/styled";
3
+ import { linkTabStyle as f, useDispatch as w, useRouteData as x, useContainer as y, useProperties as k, createEmptyComponent as g, Button as b } from "@telia-ace/widget-ui";
4
+ import { appendClassNames as l } from "@telia-ace/widget-utilities";
5
+ const a = c.div`
6
+ font-weight: 300;
7
+ button {
8
+ color: ${(t) => {
9
+ var e;
10
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
11
+ }};
12
+ text-decoration: underline;
13
+ font-size: ${(t) => {
14
+ var e;
15
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
16
+ }};
17
+ span {
18
+ font-weight: 300;
19
+ }
20
+ &:focus-visible {
21
+ ${f}
22
+ padding: ${(t) => {
23
+ var e, i;
24
+ return `calc(${(e = t.theme.sizes) == null ? void 0 : e.small} / 2) ${(i = t.theme.sizes) == null ? void 0 : i.small}`;
25
+ }};
26
+ }
27
+ }
28
+ `, v = c.svg`
29
+ margin-right: ${(t) => {
30
+ var e;
31
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
32
+ }};
33
+ line {
34
+ stroke: ${(t) => {
35
+ var e;
36
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
37
+ }};
38
+ }
39
+ `, D = ({ className: t, ...e }) => {
40
+ const i = w(), { params: m } = x(), h = y(), { conditions: r = [], label: s = "" } = k();
41
+ if (!(r && r.length ? r.reduce((p, u) => m[u] ? !0 : p, !1) : !0))
42
+ return g(h, {
43
+ ...e,
44
+ className: l(t, "humany-back-link")
45
+ });
46
+ const d = () => {
47
+ i("click");
48
+ };
49
+ return s ? /* @__PURE__ */ n(a, { ...e, className: l(t, "humany-back-link"), children: /* @__PURE__ */ o(b, { "aria-label": s, onClick: d, children: [
50
+ /* @__PURE__ */ o(
51
+ v,
52
+ {
53
+ width: "7",
54
+ height: "13",
55
+ viewBox: "0 0 7 13",
56
+ fill: "none",
57
+ xmlns: "http://www.w3.org/2000/svg",
58
+ children: [
59
+ /* @__PURE__ */ n("line", { x1: "6.64645", y1: "12.5513", x2: "0.648357", y2: "6.55319" }),
60
+ /* @__PURE__ */ n("line", { x1: "0.646447", y1: "6.64455", x2: "6.64454", y2: "0.646465" })
61
+ ]
62
+ }
63
+ ),
64
+ s && /* @__PURE__ */ n("span", { children: s })
65
+ ] }) }) : /* @__PURE__ */ n(a, { ...e, className: l(t, "humany-back-link"), children: /* @__PURE__ */ o(
66
+ "svg",
67
+ {
68
+ width: "8",
69
+ height: "16",
70
+ viewBox: "0 0 8 16",
71
+ fill: "none",
72
+ xmlns: "http://www.w3.org/2000/svg",
73
+ children: [
74
+ /* @__PURE__ */ n(
75
+ "line",
76
+ {
77
+ y1: "-0.5",
78
+ x2: "10.2585",
79
+ y2: "-0.5",
80
+ transform: "matrix(-0.682358 -0.731018 0.682358 -0.731018 8 14.9999)",
81
+ stroke: "white"
82
+ }
83
+ ),
84
+ /* @__PURE__ */ n(
85
+ "line",
86
+ {
87
+ y1: "-0.5",
88
+ x2: "10.2585",
89
+ y2: "-0.5",
90
+ transform: "matrix(0.682359 -0.731018 0.682358 0.731018 1 8.49915)",
91
+ stroke: "white"
92
+ }
93
+ )
94
+ ]
95
+ }
96
+ ) });
97
+ };
98
+ export {
99
+ D as default
100
+ };
@@ -0,0 +1,20 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),c=require("@emotion/styled"),n=require("@telia-ace/widget-ui"),l=require("@telia-ace/widget-utilities"),o=c.div`
2
+ font-weight: 300;
3
+ button {
4
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
5
+ text-decoration: underline;
6
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
7
+ span {
8
+ font-weight: 300;
9
+ }
10
+ &:focus-visible {
11
+ ${n.linkTabStyle}
12
+ padding: ${t=>{var e,i;return`calc(${(e=t.theme.sizes)==null?void 0:e.small} / 2) ${(i=t.theme.sizes)==null?void 0:i.small}`}};
13
+ }
14
+ }
15
+ `,p=c.svg`
16
+ margin-right: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
17
+ line {
18
+ stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
19
+ }
20
+ `,g=({className:t,...e})=>{const i=n.useDispatch(),{params:m}=n.useRouteData(),h=n.useContainer(),{conditions:a=[],label:r=""}=n.useProperties();if(!(a&&a.length?a.reduce((u,x)=>m[x]?!0:u,!1):!0))return n.createEmptyComponent(h,{...e,className:l.appendClassNames(t,"humany-back-link")});const d=()=>{i("click")};return r?s.jsx(o,{...e,className:l.appendClassNames(t,"humany-back-link"),children:s.jsxs(n.Button,{"aria-label":r,onClick:d,children:[s.jsxs(p,{width:"7",height:"13",viewBox:"0 0 7 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("line",{x1:"6.64645",y1:"12.5513",x2:"0.648357",y2:"6.55319"}),s.jsx("line",{x1:"0.646447",y1:"6.64455",x2:"6.64454",y2:"0.646465"})]}),r&&s.jsx("span",{children:r})]})}):s.jsx(o,{...e,className:l.appendClassNames(t,"humany-back-link"),children:s.jsxs("svg",{width:"8",height:"16",viewBox:"0 0 8 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("line",{y1:"-0.5",x2:"10.2585",y2:"-0.5",transform:"matrix(-0.682358 -0.731018 0.682358 -0.731018 8 14.9999)",stroke:"white"}),s.jsx("line",{y1:"-0.5",x2:"10.2585",y2:"-0.5",transform:"matrix(0.682359 -0.731018 0.682358 0.731018 1 8.49915)",stroke:"white"})]})})};exports.default=g;
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";const e=require("./index-33c6a46f.js");require("@emotion/react");require("react/jsx-runtime");require("react");require("@emotion/styled");require("react-transition-group");require("react-dom");require("react-router-dom");module.exports=e.BackLinkComponent;
1
+ "use strict";const c=require("@telia-ace/widget-ui"),o=e=>c.createReactComponent(e,"back-link",Promise.resolve().then(()=>require("./back-link-a81d3661.js")),t=>{t.actions.create("click",(i,r)=>{if(!r.preventDefault)return e.getAsync("router").then(n=>{n.goBack()})})});module.exports=o;
package/index.mjs CHANGED
@@ -1,11 +1,12 @@
1
- import { h as d } from "./index-ad1d2389.mjs";
2
- import "@emotion/react";
3
- import "react/jsx-runtime";
4
- import "react";
5
- import "@emotion/styled";
6
- import "react-transition-group";
7
- import "react-dom";
8
- import "react-router-dom";
1
+ import { createReactComponent as a } from "@telia-ace/widget-ui";
2
+ const i = (t) => a(t, "back-link", import("./back-link-406bc5a8.mjs"), (e) => {
3
+ e.actions.create("click", (o, r) => {
4
+ if (!r.preventDefault)
5
+ return t.getAsync("router").then((n) => {
6
+ n.goBack();
7
+ });
8
+ });
9
+ });
9
10
  export {
10
- d as default
11
+ i as default
11
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/widget-components-back-link",
3
- "version": "1.1.1-rc.2",
3
+ "version": "1.1.1-rc.3",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -10,10 +10,10 @@
10
10
  }
11
11
  },
12
12
  "dependencies": {
13
- "@telia-ace/widget-routing": "^1.1.1-rc.2",
14
- "@telia-ace/widget-ui": "^1.1.1-rc.2",
15
- "@telia-ace/widget-utilities": "^1.1.1-rc.2",
16
- "@telia-ace/widget-core": "^1.1.1-rc.2",
13
+ "@telia-ace/widget-routing": "^1.1.1-rc.3",
14
+ "@telia-ace/widget-ui": "^1.1.1-rc.3",
15
+ "@telia-ace/widget-utilities": "^1.1.1-rc.3",
16
+ "@telia-ace/widget-core": "^1.1.1-rc.3",
17
17
  "@webprovisions/platform": "^1.1.4"
18
18
  },
19
19
  "peerDependencies": {
@@ -1,142 +0,0 @@
1
- import { jsx as c, jsxs as p } from "react/jsx-runtime";
2
- import x from "@emotion/styled";
3
- import "@emotion/react";
4
- import { E as v, C as $, u as D, a as E, b as B, c as z, d as C, e as M, f as N, l as P, g as d, B as R } from "./index-ad1d2389.mjs";
5
- import { useContext as k, useState as h, useEffect as f } from "react";
6
- import "react-dom";
7
- import "react-transition-group";
8
- import "react-router-dom";
9
- const w = (e = {}) => (Object.keys(e).forEach((t) => {
10
- (e[t] === null || typeof e[t] > "u") && delete e[t];
11
- }), e), A = (e, t) => e.get("seoConfiguration") ? /* @__PURE__ */ c(v, { ...t }) : null, I = () => k($), Q = () => {
12
- const e = D(), t = I(), [n, l] = h([]), [u, r] = h();
13
- return f(() => {
14
- if (e && t) {
15
- const s = new E(e).withId(t.id), i = e.actions(s, t.type || B());
16
- r(i), n !== null && (n.forEach((o) => {
17
- i.dispatch(o.key, o.data).then((a) => o.resolve(a)).catch((a) => o.reject(a));
18
- }), l(null));
19
- }
20
- }, [e, t.id]), (s, i) => n !== null ? new Promise((o, a) => {
21
- n.push({
22
- key: s,
23
- data: i,
24
- resolve: o,
25
- reject: a
26
- });
27
- }) : u.dispatch(s, i);
28
- }, S = () => k(z), q = (e) => {
29
- const t = C(), n = M(), [l, u] = h({ name: "", params: {} }), r = N();
30
- return f(() => {
31
- const s = (e || t).get("$widget");
32
- if (!s)
33
- return;
34
- const { events: i } = s;
35
- return i.subscribe("router:change", (a, { next: { routeData: m } }) => {
36
- if (r.current) {
37
- const { name: b, params: g } = m;
38
- w(g), u({ name: b, params: g });
39
- }
40
- });
41
- }, [r, e, t]), f(() => {
42
- if (n && n.history && r.current) {
43
- const s = n.getRouteData(), { name: i, params: o } = s;
44
- w(o), u({ name: i, params: o });
45
- }
46
- }, [n, r]), l;
47
- }, y = x.div`
48
- font-weight: 300;
49
- button {
50
- color: ${(e) => {
51
- var t;
52
- return (t = e.theme.colors) == null ? void 0 : t.primary;
53
- }};
54
- text-decoration: underline;
55
- font-size: ${(e) => {
56
- var t;
57
- return (t = e.theme.fonts) == null ? void 0 : t.normal;
58
- }};
59
- span {
60
- font-weight: 300;
61
- }
62
- &:focus-visible {
63
- ${P}
64
- padding: ${(e) => {
65
- var t, n;
66
- return `calc(${(t = e.theme.sizes) == null ? void 0 : t.small} / 2) ${(n = e.theme.sizes) == null ? void 0 : n.small}`;
67
- }};
68
- }
69
- }
70
- `, L = x.svg`
71
- margin-right: ${(e) => {
72
- var t;
73
- return (t = e.theme.sizes) == null ? void 0 : t.small;
74
- }};
75
- line {
76
- stroke: ${(e) => {
77
- var t;
78
- return (t = e.theme.colors) == null ? void 0 : t.primary;
79
- }};
80
- }
81
- `, H = ({ className: e, ...t }) => {
82
- const n = Q(), { params: l } = q(), u = C(), { conditions: r = [], label: s = "" } = S();
83
- if (!(r && r.length ? r.reduce((a, m) => l[m] ? !0 : a, !1) : !0))
84
- return A(u, {
85
- ...t,
86
- className: d(e, "humany-back-link")
87
- });
88
- const o = () => {
89
- n("click");
90
- };
91
- return s ? /* @__PURE__ */ c(y, { ...t, className: d(e, "humany-back-link"), children: /* @__PURE__ */ p(R, { "aria-label": s, onClick: o, children: [
92
- /* @__PURE__ */ p(
93
- L,
94
- {
95
- width: "7",
96
- height: "13",
97
- viewBox: "0 0 7 13",
98
- fill: "none",
99
- xmlns: "http://www.w3.org/2000/svg",
100
- children: [
101
- /* @__PURE__ */ c("line", { x1: "6.64645", y1: "12.5513", x2: "0.648357", y2: "6.55319" }),
102
- /* @__PURE__ */ c("line", { x1: "0.646447", y1: "6.64455", x2: "6.64454", y2: "0.646465" })
103
- ]
104
- }
105
- ),
106
- s && /* @__PURE__ */ c("span", { children: s })
107
- ] }) }) : /* @__PURE__ */ c(y, { ...t, className: d(e, "humany-back-link"), children: /* @__PURE__ */ p(
108
- "svg",
109
- {
110
- width: "8",
111
- height: "16",
112
- viewBox: "0 0 8 16",
113
- fill: "none",
114
- xmlns: "http://www.w3.org/2000/svg",
115
- children: [
116
- /* @__PURE__ */ c(
117
- "line",
118
- {
119
- y1: "-0.5",
120
- x2: "10.2585",
121
- y2: "-0.5",
122
- transform: "matrix(-0.682358 -0.731018 0.682358 -0.731018 8 14.9999)",
123
- stroke: "white"
124
- }
125
- ),
126
- /* @__PURE__ */ c(
127
- "line",
128
- {
129
- y1: "-0.5",
130
- x2: "10.2585",
131
- y2: "-0.5",
132
- transform: "matrix(0.682359 -0.731018 0.682358 0.731018 1 8.49915)",
133
- stroke: "white"
134
- }
135
- )
136
- ]
137
- }
138
- ) });
139
- };
140
- export {
141
- H as default
142
- };
@@ -1,20 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),g=require("@emotion/styled");require("@emotion/react");const n=require("./index-33c6a46f.js"),l=require("react");require("react-dom");require("react-transition-group");require("react-router-dom");const f=(t={})=>(Object.keys(t).forEach(e=>{(t[e]===null||typeof t[e]>"u")&&delete t[e]}),t),w=(t,e)=>t.get("seoConfiguration")?i.jsx(n.Empty,{...e}):null,C=()=>l.useContext(n.ComponentNodeContext),k=()=>{const t=n.useComponentPlatform(),e=C(),[s,d]=l.useState([]),[m,c]=l.useState();return l.useEffect(()=>{if(t&&e){const r=new n.ComponentQuery(t).withId(e.id),a=t.actions(r,e.type||n.uuid());c(a),s!==null&&(s.forEach(o=>{a.dispatch(o.key,o.data).then(u=>o.resolve(u)).catch(u=>o.reject(u))}),d(null))}},[t,e.id]),(r,a)=>s!==null?new Promise((o,u)=>{s.push({key:r,data:a,resolve:o,reject:u})}):m.dispatch(r,a)},b=()=>l.useContext(n.ComponentPropertyContext),v=t=>{const e=n.useContainer(),s=n.useRouter(),[d,m]=l.useState({name:"",params:{}}),c=n.useIsMounted();return l.useEffect(()=>{const r=(t||e).get("$widget");if(!r)return;const{events:a}=r;return a.subscribe("router:change",(u,{next:{routeData:p}})=>{if(c.current){const{name:y,params:h}=p;f(h),m({name:y,params:h})}})},[c,t,e]),l.useEffect(()=>{if(s&&s.history&&c.current){const r=s.getRouteData(),{name:a,params:o}=r;f(o),m({name:a,params:o})}},[s,c]),d},x=g.div`
2
- font-weight: 300;
3
- button {
4
- color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
5
- text-decoration: underline;
6
- font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
7
- span {
8
- font-weight: 300;
9
- }
10
- &:focus-visible {
11
- ${n.linkTabStyle}
12
- padding: ${t=>{var e,s;return`calc(${(e=t.theme.sizes)==null?void 0:e.small} / 2) ${(s=t.theme.sizes)==null?void 0:s.small}`}};
13
- }
14
- }
15
- `,j=g.svg`
16
- margin-right: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
17
- line {
18
- stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
19
- }
20
- `,q=({className:t,...e})=>{const s=k(),{params:d}=v(),m=n.useContainer(),{conditions:c=[],label:r=""}=b();if(!(c&&c.length?c.reduce((u,p)=>d[p]?!0:u,!1):!0))return w(m,{...e,className:n.appendClassNames(t,"humany-back-link")});const o=()=>{s("click")};return r?i.jsx(x,{...e,className:n.appendClassNames(t,"humany-back-link"),children:i.jsxs(n.Button,{"aria-label":r,onClick:o,children:[i.jsxs(j,{width:"7",height:"13",viewBox:"0 0 7 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("line",{x1:"6.64645",y1:"12.5513",x2:"0.648357",y2:"6.55319"}),i.jsx("line",{x1:"0.646447",y1:"6.64455",x2:"6.64454",y2:"0.646465"})]}),r&&i.jsx("span",{children:r})]})}):i.jsx(x,{...e,className:n.appendClassNames(t,"humany-back-link"),children:i.jsxs("svg",{width:"8",height:"16",viewBox:"0 0 8 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("line",{y1:"-0.5",x2:"10.2585",y2:"-0.5",transform:"matrix(-0.682358 -0.731018 0.682358 -0.731018 8 14.9999)",stroke:"white"}),i.jsx("line",{y1:"-0.5",x2:"10.2585",y2:"-0.5",transform:"matrix(0.682359 -0.731018 0.682358 0.731018 1 8.49915)",stroke:"white"})]})})};exports.default=q;