@telia-ace/widget-components-image-link 1.0.5 → 1.0.8
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.
- package/{lib-esm → dist}/image-link-component.d.ts +0 -0
- package/{lib-esm → dist}/image-link.d.ts +0 -0
- package/dist/image-link.js +68 -0
- package/dist/image-link.js.map +1 -0
- package/{lib-esm → dist}/index.d.ts +0 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/package.json +10 -11
- package/lib/image-link-component.d.ts +0 -9
- package/lib/image-link-component.js +0 -30
- package/lib/image-link.d.ts +0 -6
- package/lib/image-link.js +0 -46
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -7
- package/lib-esm/image-link-component.js +0 -5
- package/lib-esm/image-link.js +0 -41
- package/lib-esm/index.js +0 -2
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,68 @@
|
|
|
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, Link, borderTabStyle } from "@telia-ace/widget-ui";
|
|
33
|
+
import { appendClassNames } from "@telia-ace/widget-utilities";
|
|
34
|
+
import React from "react";
|
|
35
|
+
import styled from "styled-components";
|
|
36
|
+
const ImageLink = (_a) => {
|
|
37
|
+
var _b = _a, { className } = _b, other = __objRest(_b, ["className"]);
|
|
38
|
+
const { route, image, ariaLabel, altLabel } = useProperties();
|
|
39
|
+
return /* @__PURE__ */ React.createElement(Wrapper, __spreadProps(__spreadValues({}, other), {
|
|
40
|
+
className: appendClassNames(className, "humany-image-link")
|
|
41
|
+
}), route ? /* @__PURE__ */ React.createElement(Link, {
|
|
42
|
+
routeName: route,
|
|
43
|
+
"aria-label": ariaLabel
|
|
44
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
45
|
+
src: image,
|
|
46
|
+
alt: altLabel
|
|
47
|
+
})) : /* @__PURE__ */ React.createElement("img", {
|
|
48
|
+
src: image,
|
|
49
|
+
alt: altLabel,
|
|
50
|
+
"aria-label": ariaLabel
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
53
|
+
const Wrapper = styled.div`
|
|
54
|
+
a {
|
|
55
|
+
display: block;
|
|
56
|
+
&:focus {
|
|
57
|
+
${(p) => {
|
|
58
|
+
var _a;
|
|
59
|
+
return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && borderTabStyle;
|
|
60
|
+
}};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
img {
|
|
64
|
+
max-width: 100%;
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
export { ImageLink as default };
|
|
68
|
+
//# sourceMappingURL=image-link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-link.js","sources":["../src/image-link.tsx"],"sourcesContent":["import { borderTabStyle, Link, useProperties } from '@telia-ace/widget-ui';\r\nimport { appendClassNames } from '@telia-ace/widget-utilities';\r\nimport React from 'react';\r\nimport styled from 'styled-components';\r\nimport { ImageLinkComponentProps } from './image-link-component';\r\n\r\ntype Props = {\r\n className: string;\r\n};\r\n\r\nconst ImageLink: React.SFC<Props> = ({ className, ...other }) => {\r\n const { route, image, ariaLabel, altLabel } = useProperties<ImageLinkComponentProps>();\r\n\r\n // ariaLabel is used as alt text when no link is specified, else\r\n // used for aria-label on the link.\r\n\r\n return (\r\n <Wrapper {...other} className={appendClassNames(className, 'humany-image-link')}>\r\n {route ? (\r\n <Link routeName={route} aria-label={ariaLabel}>\r\n <img src={image} alt={altLabel} />\r\n </Link>\r\n ) : (\r\n <img src={image} alt={altLabel} aria-label={ariaLabel} />\r\n )}\r\n </Wrapper>\r\n );\r\n};\r\n\r\nconst Wrapper = styled.div`\r\n a {\r\n display: block;\r\n &:focus {\r\n ${(p: any) => p.theme.accessibility?.isTabbing && borderTabStyle};\r\n }\r\n }\r\n img {\r\n max-width: 100%;\r\n }\r\n`;\r\n\r\nexport default ImageLink;\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,YAA8B,CAAC,OAA4B;AAA5B,eAAE,gBAAF,IAAgB,kBAAhB,IAAgB,CAAd;AACnC,QAAM,EAAE,OAAO,OAAO,WAAW,aAAa;AAK9C,SACK,sBAAA,cAAA,SAAA,iCAAY,QAAZ;AAAA,IAAmB,WAAW,iBAAiB,WAAW,mBAAmB;AAAA,EAAA,IACzE,QACI,sBAAA,cAAA,MAAA;AAAA,IAAK,WAAW;AAAA,IAAO,cAAY;AAAA,EAAA,GAC/B,sBAAA,cAAA,OAAA;AAAA,IAAI,KAAK;AAAA,IAAO,KAAK;AAAA,EAAU,CAAA,CACpC,IAEC,sBAAA,cAAA,OAAA;AAAA,IAAI,KAAK;AAAA,IAAO,KAAK;AAAA,IAAU,cAAY;AAAA,EAAW,CAAA,CAE/D;AAER;AAEA,MAAM,UAAU,OAAO;AAAA;AAAA;AAAA;AAAA,cAIT,CAAC,MAAA;;AAAW,kBAAE,MAAM,kBAAR,mBAAuB,cAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;"}
|
|
File without changes
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createReactComponent } from "@telia-ace/widget-ui";
|
|
2
|
+
const ImageLinkComponent = (container) => {
|
|
3
|
+
return createReactComponent(container, "image-link", import("./image-link.js"));
|
|
4
|
+
};
|
|
5
|
+
export { ImageLinkComponent as default };
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/image-link-component.ts"],"sourcesContent":["import { createReactComponent } from '@telia-ace/widget-ui';\r\nimport { Container } from '@webprovisions/platform';\r\n\r\nexport type ImageLinkComponentProps = {\r\n route: string;\r\n image: string;\r\n ariaLabel: string;\r\n altLabel: string;\r\n};\r\n\r\nconst ImageLinkComponent = (container: Container) => {\r\n return createReactComponent(container, 'image-link', import('./image-link'));\r\n};\r\n\r\nexport default ImageLinkComponent;\r\n"],"names":[],"mappings":";AAUM,MAAA,qBAAqB,CAAC,cAAyB;AACjD,SAAO,qBAAqB,WAAW,cAAc,OAAO,kBAAe;AAC/E;;"}
|
package/package.json
CHANGED
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/widget-components-image-link",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Image 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
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"module": "dist/index.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
12
|
"files": [
|
|
13
13
|
"LICENSE.txt",
|
|
14
14
|
"README.md",
|
|
15
|
-
"
|
|
16
|
-
"lib-esm/"
|
|
15
|
+
"dist/"
|
|
17
16
|
],
|
|
18
17
|
"publishConfig": {
|
|
19
18
|
"access": "public"
|
|
20
19
|
},
|
|
21
20
|
"scripts": {
|
|
22
|
-
"clean": "
|
|
23
|
-
"
|
|
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-ui": "^1.0.
|
|
29
|
-
"@telia-ace/widget-utilities": "^1.0.
|
|
27
|
+
"@telia-ace/widget-ui": "^1.0.10",
|
|
28
|
+
"@telia-ace/widget-utilities": "^1.0.2",
|
|
30
29
|
"@webprovisions/platform": "^1.1.2"
|
|
31
30
|
},
|
|
32
31
|
"peerDependencies": {
|
|
@@ -39,5 +38,5 @@
|
|
|
39
38
|
"@types/react-dom": "^16.8.0",
|
|
40
39
|
"@types/styled-components": "^5.1.7"
|
|
41
40
|
},
|
|
42
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "8836020841672f7be61a89fff0cabaac570cd3f9"
|
|
43
42
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Container } from '@webprovisions/platform';
|
|
2
|
-
export declare type ImageLinkComponentProps = {
|
|
3
|
-
route: string;
|
|
4
|
-
image: string;
|
|
5
|
-
ariaLabel: string;
|
|
6
|
-
altLabel: string;
|
|
7
|
-
};
|
|
8
|
-
declare const ImageLinkComponent: (container: Container) => Promise<void>;
|
|
9
|
-
export default ImageLinkComponent;
|
|
@@ -1,30 +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
|
-
var widget_ui_1 = require("@telia-ace/widget-ui");
|
|
27
|
-
var ImageLinkComponent = function (container) {
|
|
28
|
-
return (0, widget_ui_1.createReactComponent)(container, 'image-link', Promise.resolve().then(function () { return __importStar(require('./image-link')); }));
|
|
29
|
-
};
|
|
30
|
-
exports.default = ImageLinkComponent;
|
package/lib/image-link.d.ts
DELETED
package/lib/image-link.js
DELETED
|
@@ -1,46 +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 __rest = (this && this.__rest) || function (s, e) {
|
|
18
|
-
var t = {};
|
|
19
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
20
|
-
t[p] = s[p];
|
|
21
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
22
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
23
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
24
|
-
t[p[i]] = s[p[i]];
|
|
25
|
-
}
|
|
26
|
-
return t;
|
|
27
|
-
};
|
|
28
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
-
};
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
var widget_ui_1 = require("@telia-ace/widget-ui");
|
|
33
|
-
var widget_utilities_1 = require("@telia-ace/widget-utilities");
|
|
34
|
-
var react_1 = __importDefault(require("react"));
|
|
35
|
-
var styled_components_1 = __importDefault(require("styled-components"));
|
|
36
|
-
var ImageLink = function (_a) {
|
|
37
|
-
var className = _a.className, other = __rest(_a, ["className"]);
|
|
38
|
-
var _b = (0, widget_ui_1.useProperties)(), route = _b.route, image = _b.image, ariaLabel = _b.ariaLabel, altLabel = _b.altLabel;
|
|
39
|
-
// ariaLabel is used as alt text when no link is specified, else
|
|
40
|
-
// used for aria-label on the link.
|
|
41
|
-
return (react_1.default.createElement(Wrapper, __assign({}, other, { className: (0, widget_utilities_1.appendClassNames)(className, 'humany-image-link') }), route ? (react_1.default.createElement(widget_ui_1.Link, { routeName: route, "aria-label": ariaLabel },
|
|
42
|
-
react_1.default.createElement("img", { src: image, alt: altLabel }))) : (react_1.default.createElement("img", { src: image, alt: altLabel, "aria-label": ariaLabel }))));
|
|
43
|
-
};
|
|
44
|
-
var Wrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n a {\n display: block;\n &:focus {\n ", ";\n }\n }\n img {\n max-width: 100%;\n }\n"], ["\n a {\n display: block;\n &:focus {\n ", ";\n }\n }\n img {\n max-width: 100%;\n }\n"])), function (p) { var _a; return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && widget_ui_1.borderTabStyle; });
|
|
45
|
-
exports.default = ImageLink;
|
|
46
|
-
var templateObject_1;
|
package/lib/index.d.ts
DELETED
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 image_link_component_1 = __importDefault(require("./image-link-component"));
|
|
7
|
-
exports.default = image_link_component_1.default;
|
package/lib-esm/image-link.js
DELETED
|
@@ -1,41 +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 { borderTabStyle, Link, useProperties } from '@telia-ace/widget-ui';
|
|
28
|
-
import { appendClassNames } from '@telia-ace/widget-utilities';
|
|
29
|
-
import React from 'react';
|
|
30
|
-
import styled from 'styled-components';
|
|
31
|
-
var ImageLink = function (_a) {
|
|
32
|
-
var className = _a.className, other = __rest(_a, ["className"]);
|
|
33
|
-
var _b = useProperties(), route = _b.route, image = _b.image, ariaLabel = _b.ariaLabel, altLabel = _b.altLabel;
|
|
34
|
-
// ariaLabel is used as alt text when no link is specified, else
|
|
35
|
-
// used for aria-label on the link.
|
|
36
|
-
return (React.createElement(Wrapper, __assign({}, other, { className: appendClassNames(className, 'humany-image-link') }), route ? (React.createElement(Link, { routeName: route, "aria-label": ariaLabel },
|
|
37
|
-
React.createElement("img", { src: image, alt: altLabel }))) : (React.createElement("img", { src: image, alt: altLabel, "aria-label": ariaLabel }))));
|
|
38
|
-
};
|
|
39
|
-
var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n a {\n display: block;\n &:focus {\n ", ";\n }\n }\n img {\n max-width: 100%;\n }\n"], ["\n a {\n display: block;\n &:focus {\n ", ";\n }\n }\n img {\n max-width: 100%;\n }\n"])), function (p) { var _a; return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && borderTabStyle; });
|
|
40
|
-
export default ImageLink;
|
|
41
|
-
var templateObject_1;
|
package/lib-esm/index.js
DELETED