@telia-ace/widget-components-back-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,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;
@@ -0,0 +1,114 @@
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(
50
+ a,
51
+ {
52
+ ...e,
53
+ className: l(t, "humany-back-link"),
54
+ children: /* @__PURE__ */ o(b, { "aria-label": s, onClick: d, children: [
55
+ /* @__PURE__ */ o(
56
+ v,
57
+ {
58
+ width: "7",
59
+ height: "13",
60
+ viewBox: "0 0 7 13",
61
+ fill: "none",
62
+ xmlns: "http://www.w3.org/2000/svg",
63
+ children: [
64
+ /* @__PURE__ */ n("line", { x1: "6.64645", y1: "12.5513", x2: "0.648357", y2: "6.55319" }),
65
+ /* @__PURE__ */ n("line", { x1: "0.646447", y1: "6.64455", x2: "6.64454", y2: "0.646465" })
66
+ ]
67
+ }
68
+ ),
69
+ s && /* @__PURE__ */ n("span", { children: s })
70
+ ] })
71
+ }
72
+ ) : /* @__PURE__ */ n(
73
+ a,
74
+ {
75
+ ...e,
76
+ className: l(t, "humany-back-link"),
77
+ children: /* @__PURE__ */ o(
78
+ "svg",
79
+ {
80
+ width: "8",
81
+ height: "16",
82
+ viewBox: "0 0 8 16",
83
+ fill: "none",
84
+ xmlns: "http://www.w3.org/2000/svg",
85
+ children: [
86
+ /* @__PURE__ */ n(
87
+ "line",
88
+ {
89
+ y1: "-0.5",
90
+ x2: "10.2585",
91
+ y2: "-0.5",
92
+ transform: "matrix(-0.682358 -0.731018 0.682358 -0.731018 8 14.9999)",
93
+ stroke: "white"
94
+ }
95
+ ),
96
+ /* @__PURE__ */ n(
97
+ "line",
98
+ {
99
+ y1: "-0.5",
100
+ x2: "10.2585",
101
+ y2: "-0.5",
102
+ transform: "matrix(0.682359 -0.731018 0.682358 0.731018 1 8.49915)",
103
+ stroke: "white"
104
+ }
105
+ )
106
+ ]
107
+ }
108
+ )
109
+ }
110
+ );
111
+ };
112
+ export {
113
+ D as default
114
+ };
@@ -0,0 +1,8 @@
1
+ import { Container } from '@webprovisions/platform';
2
+
3
+ export type BackLinkComponentProps = {
4
+ conditions?: string[];
5
+ label?: string;
6
+ };
7
+ export declare const BackLinkComponent: (container: Container) => Promise<void>;
8
+ export default BackLinkComponent;
package/back-link.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+
3
+ type Props = {
4
+ className: string;
5
+ };
6
+ declare const BackLink: React.FC<Props>;
7
+ export default BackLink;
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { default as BackLinkComponent } from './back-link-component';
2
+
3
+ export default BackLinkComponent;
package/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";const c=require("@telia-ace/widget-ui"),o=e=>c.createReactComponent(e,"back-link",Promise.resolve().then(()=>require("./back-link-210e4ce8.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 ADDED
@@ -0,0 +1,17 @@
1
+ import { createReactComponent as a } from "@telia-ace/widget-ui";
2
+ const i = (t) => a(
3
+ t,
4
+ "back-link",
5
+ import("./back-link-837b2382.mjs"),
6
+ (e) => {
7
+ e.actions.create("click", (o, r) => {
8
+ if (!r.preventDefault)
9
+ return t.getAsync("router").then((n) => {
10
+ n.goBack();
11
+ });
12
+ });
13
+ }
14
+ );
15
+ export {
16
+ i as default
17
+ };
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@telia-ace/widget-components-back-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/widget-routing": "*",
14
+ "@telia-ace/widget-ui": "*",
15
+ "@telia-ace/widget-utilities": "*",
16
+ "@telia-ace/widget-core": "*",
17
+ "@webprovisions/platform": "^1.1.4"
18
+ },
19
+ "peerDependencies": {
20
+ "@emotion/styled": "11.11.0",
21
+ "react": "18.2.0",
22
+ "@emotion/react": "11.11.1"
23
+ }
24
+ }