@telia-ace/widget-components-back-link 1.0.3 → 1.0.6

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,141 @@
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 { linkTabStyle, useDispatch, useRouteData, useContainer, useProperties, createEmptyComponent, Button } from "@telia-ace/widget-ui";
33
+ import { appendClassNames } from "@telia-ace/widget-utilities";
34
+ import React from "react";
35
+ import styled, { css } from "styled-components";
36
+ const Wrapper = styled.div`
37
+ font-weight: 300;
38
+ button {
39
+ color: ${(p) => {
40
+ var _a;
41
+ return (_a = p.theme.colors) == null ? void 0 : _a.primary;
42
+ }};
43
+ text-decoration: underline;
44
+ font-size: ${(p) => {
45
+ var _a;
46
+ return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
47
+ }};
48
+ span {
49
+ font-weight: 300;
50
+ }
51
+ &:focus {
52
+ ${(p) => {
53
+ var _a;
54
+ return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && css`
55
+ ${linkTabStyle}
56
+ padding: ${(p2) => {
57
+ var _a2, _b;
58
+ return `calc(${(_a2 = p2.theme.sizes) == null ? void 0 : _a2.small} / 2) ${(_b = p2.theme.sizes) == null ? void 0 : _b.small}`;
59
+ }};
60
+ `;
61
+ }};
62
+ }
63
+ }
64
+ `;
65
+ const Caret = styled.svg`
66
+ margin-right: ${(p) => {
67
+ var _a;
68
+ return (_a = p.theme.sizes) == null ? void 0 : _a.small;
69
+ }};
70
+ line {
71
+ stroke: ${(p) => {
72
+ var _a;
73
+ return (_a = p.theme.colors) == null ? void 0 : _a.primary;
74
+ }};
75
+ }
76
+ `;
77
+ const BackLink = (_a) => {
78
+ var _b = _a, { className } = _b, other = __objRest(_b, ["className"]);
79
+ const dispatch = useDispatch();
80
+ const { params } = useRouteData();
81
+ const container = useContainer();
82
+ const { conditions = [], label = "" } = useProperties();
83
+ const conditionsMet = conditions && conditions.length ? conditions.reduce((acc, condition) => {
84
+ return params[condition] ? true : acc;
85
+ }, false) : true;
86
+ if (!conditionsMet) {
87
+ return createEmptyComponent(container, __spreadProps(__spreadValues({}, other), {
88
+ className: appendClassNames(className, "humany-back-link")
89
+ }));
90
+ }
91
+ const handleClick = () => {
92
+ dispatch("click");
93
+ };
94
+ if (!label) {
95
+ return /* @__PURE__ */ React.createElement(Wrapper, __spreadProps(__spreadValues({}, other), {
96
+ className: appendClassNames(className, "humany-back-link")
97
+ }), /* @__PURE__ */ React.createElement("svg", {
98
+ width: "8",
99
+ height: "16",
100
+ viewBox: "0 0 8 16",
101
+ fill: "none",
102
+ xmlns: "http://www.w3.org/2000/svg"
103
+ }, /* @__PURE__ */ React.createElement("line", {
104
+ y1: "-0.5",
105
+ x2: "10.2585",
106
+ y2: "-0.5",
107
+ transform: "matrix(-0.682358 -0.731018 0.682358 -0.731018 8 14.9999)",
108
+ stroke: "white"
109
+ }), /* @__PURE__ */ React.createElement("line", {
110
+ y1: "-0.5",
111
+ x2: "10.2585",
112
+ y2: "-0.5",
113
+ transform: "matrix(0.682359 -0.731018 0.682358 0.731018 1 8.49915)",
114
+ stroke: "white"
115
+ })));
116
+ }
117
+ return /* @__PURE__ */ React.createElement(Wrapper, __spreadProps(__spreadValues({}, other), {
118
+ className: appendClassNames(className, "humany-back-link")
119
+ }), /* @__PURE__ */ React.createElement(Button, {
120
+ "aria-label": label,
121
+ onClick: handleClick
122
+ }, /* @__PURE__ */ React.createElement(Caret, {
123
+ width: "7",
124
+ height: "13",
125
+ viewBox: "0 0 7 13",
126
+ fill: "none",
127
+ xmlns: "http://www.w3.org/2000/svg"
128
+ }, /* @__PURE__ */ React.createElement("line", {
129
+ x1: "6.64645",
130
+ y1: "12.5513",
131
+ x2: "0.648357",
132
+ y2: "6.55319"
133
+ }), /* @__PURE__ */ React.createElement("line", {
134
+ x1: "0.646447",
135
+ y1: "6.64455",
136
+ x2: "6.64454",
137
+ y2: "0.646465"
138
+ })), label && /* @__PURE__ */ React.createElement("span", null, label)));
139
+ };
140
+ export { BackLink as default };
141
+ //# sourceMappingURL=back-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"back-link.js","sources":["../src/back-link.tsx"],"sourcesContent":["import {\r\n Button,\r\n createEmptyComponent,\r\n linkTabStyle,\r\n useContainer,\r\n useDispatch,\r\n useProperties,\r\n useRouteData,\r\n} from '@telia-ace/widget-ui';\r\nimport { appendClassNames } from '@telia-ace/widget-utilities';\r\nimport React from 'react';\r\nimport styled, { css } from 'styled-components';\r\nimport { BackLinkComponentProps } from './back-link-component';\r\n\r\ntype Props = {\r\n className: string;\r\n};\r\n\r\nconst Wrapper = styled.div`\r\n font-weight: 300;\r\n button {\r\n color: ${(p) => p.theme.colors?.primary};\r\n text-decoration: underline;\r\n font-size: ${(p) => p.theme.fonts?.normal};\r\n span {\r\n font-weight: 300;\r\n }\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 Caret = styled.svg`\r\n margin-right: ${(p) => p.theme.sizes?.small};\r\n line {\r\n stroke: ${(p) => p.theme.colors?.primary};\r\n }\r\n`;\r\n\r\nconst BackLink: React.FC<Props> = ({ className, ...other }) => {\r\n const dispatch = useDispatch();\r\n const { params } = useRouteData();\r\n const container = useContainer();\r\n const { conditions = [], label = '' } = useProperties<BackLinkComponentProps>();\r\n\r\n const conditionsMet =\r\n conditions && conditions.length\r\n ? conditions.reduce((acc: boolean, condition: string) => {\r\n return params[condition] ? true : acc;\r\n }, false)\r\n : true;\r\n\r\n if (!conditionsMet) {\r\n return createEmptyComponent(container, {\r\n ...other,\r\n className: appendClassNames(className, 'humany-back-link'),\r\n });\r\n }\r\n\r\n const handleClick = () => {\r\n dispatch('click');\r\n };\r\n\r\n if (!label) {\r\n return (\r\n <Wrapper {...other} className={appendClassNames(className, 'humany-back-link')}>\r\n <svg\r\n width=\"8\"\r\n height=\"16\"\r\n viewBox=\"0 0 8 16\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <line\r\n y1=\"-0.5\"\r\n x2=\"10.2585\"\r\n y2=\"-0.5\"\r\n transform=\"matrix(-0.682358 -0.731018 0.682358 -0.731018 8 14.9999)\"\r\n stroke=\"white\"\r\n />\r\n <line\r\n y1=\"-0.5\"\r\n x2=\"10.2585\"\r\n y2=\"-0.5\"\r\n transform=\"matrix(0.682359 -0.731018 0.682358 0.731018 1 8.49915)\"\r\n stroke=\"white\"\r\n />\r\n </svg>\r\n </Wrapper>\r\n );\r\n }\r\n\r\n return (\r\n <Wrapper {...other} className={appendClassNames(className, 'humany-back-link')}>\r\n <Button aria-label={label} onClick={handleClick}>\r\n <Caret\r\n width=\"7\"\r\n height=\"13\"\r\n viewBox=\"0 0 7 13\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <line x1=\"6.64645\" y1=\"12.5513\" x2=\"0.648357\" y2=\"6.55319\" />\r\n <line x1=\"0.646447\" y1=\"6.64455\" x2=\"6.64454\" y2=\"0.646465\" />\r\n </Caret>\r\n {label && <span>{label}</span>}\r\n </Button>\r\n </Wrapper>\r\n );\r\n};\r\n\r\nexport default BackLink;\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,UAAU,OAAO;AAAA;AAAA;AAAA,iBAGN,CAAC,MAAM;;AAAA,iBAAE,MAAM,WAAR,mBAAgB;AAAA;AAAA;AAAA,qBAEnB,CAAC,MAAM;;AAAA,iBAAE,MAAM,UAAR,mBAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAK7B,CAAC,MAAA;;AACC,kBAAE,MAAM,kBAAR,mBAAuB,cACvB;AAAA,sBACM;AAAA,+BACS,CAAC,OAAM;;AAAA,mBAAQ,UAAE,MAAM,UAAR,oBAAe,cAAc,SAAE,MAAM,UAAR,mBAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAM1F,MAAM,QAAQ,OAAO;AAAA,oBACD,CAAC,MAAM;;AAAA,iBAAE,MAAM,UAAR,mBAAe;AAAA;AAAA;AAAA,kBAExB,CAAC,MAAM;;AAAA,iBAAE,MAAM,WAAR,mBAAgB;AAAA;AAAA;AAAA;AAIzC,MAAM,WAA4B,CAAC,OAA4B;AAA5B,eAAE,gBAAF,IAAgB,kBAAhB,IAAgB,CAAd;AACjC,QAAM,WAAW;AACX,QAAA,EAAE,WAAW;AACnB,QAAM,YAAY;AAClB,QAAM,EAAE,aAAa,CAAI,GAAA,QAAQ,OAAO;AAElC,QAAA,gBACF,cAAc,WAAW,SACnB,WAAW,OAAO,CAAC,KAAc,cAAsB;AAC5C,WAAA,OAAO,aAAa,OAAO;AAAA,EAAA,GACnC,KAAK,IACR;AAEV,MAAI,CAAC,eAAe;AAChB,WAAO,qBAAqB,WAAW,iCAChC,QADgC;AAAA,MAEnC,WAAW,iBAAiB,WAAW,kBAAkB;AAAA,IAAA,EAC5D;AAAA,EACL;AAEA,QAAM,cAAc,MAAM;AACtB,aAAS,OAAO;AAAA,EAAA;AAGpB,MAAI,CAAC,OAAO;AACR,WACK,sBAAA,cAAA,SAAA,iCAAY,QAAZ;AAAA,MAAmB,WAAW,iBAAiB,WAAW,kBAAkB;AAAA,IAAA,IACxE,sBAAA,cAAA,OAAA;AAAA,MACG,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,OAAM;AAAA,IAAA,GAEL,sBAAA,cAAA,QAAA;AAAA,MACG,IAAG;AAAA,MACH,IAAG;AAAA,MACH,IAAG;AAAA,MACH,WAAU;AAAA,MACV,QAAO;AAAA,IAAA,CACX,GACC,sBAAA,cAAA,QAAA;AAAA,MACG,IAAG;AAAA,MACH,IAAG;AAAA,MACH,IAAG;AAAA,MACH,WAAU;AAAA,MACV,QAAO;AAAA,IACX,CAAA,CACJ,CACJ;AAAA,EAER;AAEA,SACK,sBAAA,cAAA,SAAA,iCAAY,QAAZ;AAAA,IAAmB,WAAW,iBAAiB,WAAW,kBAAkB;AAAA,EAAA,IACxE,sBAAA,cAAA,QAAA;AAAA,IAAO,cAAY;AAAA,IAAO,SAAS;AAAA,EAAA,GAC/B,sBAAA,cAAA,OAAA;AAAA,IACG,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,OAAM;AAAA,EAAA,GAEL,sBAAA,cAAA,QAAA;AAAA,IAAK,IAAG;AAAA,IAAU,IAAG;AAAA,IAAU,IAAG;AAAA,IAAW,IAAG;AAAA,EAAA,CAAU,GAC1D,sBAAA,cAAA,QAAA;AAAA,IAAK,IAAG;AAAA,IAAW,IAAG;AAAA,IAAU,IAAG;AAAA,IAAU,IAAG;AAAA,EAAA,CAAW,CAChE,GACC,6CAAU,QAAM,MAAA,KAAM,CAC3B,CACJ;AAER;;"}
File without changes
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ import { createReactComponent } from "@telia-ace/widget-ui";
2
+ const BackLinkComponent = (container) => {
3
+ return createReactComponent(container, "back-link", import("./back-link.js"), (component) => {
4
+ component.actions.create("click", (data, options) => {
5
+ if (options.preventDefault) {
6
+ return;
7
+ }
8
+ return container.getAsync("router").then((router) => {
9
+ router.goBack();
10
+ });
11
+ });
12
+ });
13
+ };
14
+ export { BackLinkComponent as default };
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/back-link-component.ts"],"sourcesContent":["import { RoutingService } from '@telia-ace/widget-routing';\r\nimport { createReactComponent } from '@telia-ace/widget-ui';\r\nimport { Container } from '@webprovisions/platform';\r\n\r\nexport type BackLinkComponentProps = {\r\n conditions?: string[];\r\n label?: string;\r\n};\r\n\r\nexport const BackLinkComponent = (container: Container) => {\r\n return createReactComponent(container, 'back-link', import('./back-link'), (component) => {\r\n // Action: 'click'\r\n component.actions.create('click', (data, options) => {\r\n if (options.preventDefault) {\r\n return;\r\n }\r\n\r\n return container.getAsync('router').then((router: RoutingService) => {\r\n router.goBack();\r\n });\r\n });\r\n });\r\n};\r\n\r\nexport default BackLinkComponent;\r\n"],"names":[],"mappings":";AASa,MAAA,oBAAoB,CAAC,cAAyB;AACvD,SAAO,qBAAqB,WAAW,aAAa,OAAO,mBAAgB,CAAC,cAAc;AAEtF,cAAU,QAAQ,OAAO,SAAS,CAAC,MAAM,YAAY;AACjD,UAAI,QAAQ,gBAAgB;AACxB;AAAA,MACJ;AAEA,aAAO,UAAU,SAAS,QAAQ,EAAE,KAAK,CAAC,WAA2B;AACjE,eAAO,OAAO;AAAA,MAAA,CACjB;AAAA,IAAA,CACJ;AAAA,EAAA,CACJ;AACL;;"}
package/package.json CHANGED
@@ -1,34 +1,35 @@
1
1
  {
2
2
  "name": "@telia-ace/widget-components-back-link",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "description": "Back link component for ACE 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/widget-routing": "^1.0.2",
29
- "@telia-ace/widget-ui": "^1.0.3",
27
+ "@telia-ace/widget-routing": "^1.0.6",
28
+ "@telia-ace/widget-ui": "^1.0.9",
30
29
  "@telia-ace/widget-utilities": "^1.0.1",
31
- "@webprovisions/platform": "^1.1.2",
30
+ "@webprovisions/platform": "^1.1.2"
31
+ },
32
+ "peerDependencies": {
32
33
  "react": "^16.8.0",
33
34
  "react-dom": "^16.8.0",
34
35
  "styled-components": "^4.3.2"
@@ -38,5 +39,5 @@
38
39
  "@types/react-dom": "^16.8.0",
39
40
  "@types/styled-components": "^5.1.7"
40
41
  },
41
- "gitHead": "5440857927191297b8094bdfef392876e9cf0cef"
42
+ "gitHead": "2cb095d784f90b8a0783f02898c67ca3c46169cf"
42
43
  }
@@ -1,7 +0,0 @@
1
- import { Container } from '@webprovisions/platform';
2
- export declare type BackLinkComponentProps = {
3
- conditions?: string[];
4
- label?: string;
5
- };
6
- export declare const BackLinkComponent: (container: Container) => Promise<void>;
7
- export default BackLinkComponent;
@@ -1,42 +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
- exports.BackLinkComponent = void 0;
27
- var widget_ui_1 = require("@telia-ace/widget-ui");
28
- var BackLinkComponent = function (container) {
29
- return (0, widget_ui_1.createReactComponent)(container, 'back-link', Promise.resolve().then(function () { return __importStar(require('./back-link')); }), function (component) {
30
- // Action: 'click'
31
- component.actions.create('click', function (data, options) {
32
- if (options.preventDefault) {
33
- return;
34
- }
35
- return container.getAsync('router').then(function (router) {
36
- router.goBack();
37
- });
38
- });
39
- });
40
- };
41
- exports.BackLinkComponent = BackLinkComponent;
42
- exports.default = exports.BackLinkComponent;
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- declare type Props = {
3
- className: string;
4
- };
5
- declare const BackLink: React.FC<Props>;
6
- export default BackLink;
package/lib/back-link.js DELETED
@@ -1,95 +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 widget_ui_1 = require("@telia-ace/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 Wrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-weight: 300;\n button {\n color: ", ";\n text-decoration: underline;\n font-size: ", ";\n span {\n font-weight: 300;\n }\n &:focus {\n ", ";\n }\n }\n"], ["\n font-weight: 300;\n button {\n color: ", ";\n text-decoration: underline;\n font-size: ", ";\n span {\n font-weight: 300;\n }\n &:focus {\n ", ";\n }\n }\n"])), 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.fonts) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) {
60
- var _a;
61
- 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 "])), 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); });
62
- });
63
- var Caret = styled_components_1.default.svg(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n margin-right: ", ";\n line {\n stroke: ", ";\n }\n"], ["\n margin-right: ", ";\n line {\n stroke: ", ";\n }\n"])), 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; });
64
- var BackLink = function (_a) {
65
- var className = _a.className, other = __rest(_a, ["className"]);
66
- var dispatch = (0, widget_ui_1.useDispatch)();
67
- var params = (0, widget_ui_1.useRouteData)().params;
68
- var container = (0, widget_ui_1.useContainer)();
69
- var _b = (0, widget_ui_1.useProperties)(), _c = _b.conditions, conditions = _c === void 0 ? [] : _c, _d = _b.label, label = _d === void 0 ? '' : _d;
70
- var conditionsMet = conditions && conditions.length
71
- ? conditions.reduce(function (acc, condition) {
72
- return params[condition] ? true : acc;
73
- }, false)
74
- : true;
75
- if (!conditionsMet) {
76
- return (0, widget_ui_1.createEmptyComponent)(container, __assign(__assign({}, other), { className: (0, widget_utilities_1.appendClassNames)(className, 'humany-back-link') }));
77
- }
78
- var handleClick = function () {
79
- dispatch('click');
80
- };
81
- if (!label) {
82
- return (react_1.default.createElement(Wrapper, __assign({}, other, { className: (0, widget_utilities_1.appendClassNames)(className, 'humany-back-link') }),
83
- react_1.default.createElement("svg", { width: "8", height: "16", viewBox: "0 0 8 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
84
- react_1.default.createElement("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" }),
85
- react_1.default.createElement("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" }))));
86
- }
87
- return (react_1.default.createElement(Wrapper, __assign({}, other, { className: (0, widget_utilities_1.appendClassNames)(className, 'humany-back-link') }),
88
- react_1.default.createElement(widget_ui_1.Button, { "aria-label": label, onClick: handleClick },
89
- react_1.default.createElement(Caret, { width: "7", height: "13", viewBox: "0 0 7 13", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
90
- react_1.default.createElement("line", { x1: "6.64645", y1: "12.5513", x2: "0.648357", y2: "6.55319" }),
91
- react_1.default.createElement("line", { x1: "0.646447", y1: "6.64455", x2: "6.64454", y2: "0.646465" })),
92
- label && react_1.default.createElement("span", null, label))));
93
- };
94
- exports.default = BackLink;
95
- var templateObject_1, templateObject_2, templateObject_3;
package/lib/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import BackLinkComponent from './back-link-component';
2
- export default BackLinkComponent;
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 back_link_component_1 = __importDefault(require("./back-link-component"));
7
- exports.default = back_link_component_1.default;
@@ -1,15 +0,0 @@
1
- import { createReactComponent } from '@telia-ace/widget-ui';
2
- export var BackLinkComponent = function (container) {
3
- return createReactComponent(container, 'back-link', import('./back-link'), function (component) {
4
- // Action: 'click'
5
- component.actions.create('click', function (data, options) {
6
- if (options.preventDefault) {
7
- return;
8
- }
9
- return container.getAsync('router').then(function (router) {
10
- router.goBack();
11
- });
12
- });
13
- });
14
- };
15
- export default BackLinkComponent;
@@ -1,67 +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 { Button, createEmptyComponent, linkTabStyle, useContainer, useDispatch, useProperties, useRouteData, } from '@telia-ace/widget-ui';
28
- import { appendClassNames } from '@telia-ace/widget-utilities';
29
- import React from 'react';
30
- import styled, { css } from 'styled-components';
31
- var Wrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-weight: 300;\n button {\n color: ", ";\n text-decoration: underline;\n font-size: ", ";\n span {\n font-weight: 300;\n }\n &:focus {\n ", ";\n }\n }\n"], ["\n font-weight: 300;\n button {\n color: ", ";\n text-decoration: underline;\n font-size: ", ";\n span {\n font-weight: 300;\n }\n &:focus {\n ", ";\n }\n }\n"])), 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.fonts) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) {
32
- var _a;
33
- 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); });
34
- });
35
- var Caret = styled.svg(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n margin-right: ", ";\n line {\n stroke: ", ";\n }\n"], ["\n margin-right: ", ";\n line {\n stroke: ", ";\n }\n"])), 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; });
36
- var BackLink = function (_a) {
37
- var className = _a.className, other = __rest(_a, ["className"]);
38
- var dispatch = useDispatch();
39
- var params = useRouteData().params;
40
- var container = useContainer();
41
- var _b = useProperties(), _c = _b.conditions, conditions = _c === void 0 ? [] : _c, _d = _b.label, label = _d === void 0 ? '' : _d;
42
- var conditionsMet = conditions && conditions.length
43
- ? conditions.reduce(function (acc, condition) {
44
- return params[condition] ? true : acc;
45
- }, false)
46
- : true;
47
- if (!conditionsMet) {
48
- return createEmptyComponent(container, __assign(__assign({}, other), { className: appendClassNames(className, 'humany-back-link') }));
49
- }
50
- var handleClick = function () {
51
- dispatch('click');
52
- };
53
- if (!label) {
54
- return (React.createElement(Wrapper, __assign({}, other, { className: appendClassNames(className, 'humany-back-link') }),
55
- React.createElement("svg", { width: "8", height: "16", viewBox: "0 0 8 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
56
- React.createElement("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" }),
57
- React.createElement("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" }))));
58
- }
59
- return (React.createElement(Wrapper, __assign({}, other, { className: appendClassNames(className, 'humany-back-link') }),
60
- React.createElement(Button, { "aria-label": label, onClick: handleClick },
61
- React.createElement(Caret, { width: "7", height: "13", viewBox: "0 0 7 13", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
62
- React.createElement("line", { x1: "6.64645", y1: "12.5513", x2: "0.648357", y2: "6.55319" }),
63
- React.createElement("line", { x1: "0.646447", y1: "6.64455", x2: "6.64454", y2: "0.646465" })),
64
- label && React.createElement("span", null, label))));
65
- };
66
- export default BackLink;
67
- var templateObject_1, templateObject_2, templateObject_3;
package/lib-esm/index.js DELETED
@@ -1,2 +0,0 @@
1
- import BackLinkComponent from './back-link-component';
2
- export default BackLinkComponent;