@telia-ace/widget-components-image-link 1.0.0

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/LICENSE.txt ADDED
@@ -0,0 +1,6 @@
1
+ Copyright © 2021, Telia Company AB. All rights reserved.
2
+
3
+ THIS PACKAGE AND CONTAINING SOFTWARE IS PART OF
4
+ THE HUMANY SERVICE. BY USING THIS SOFTWARE YOU
5
+ AGREE TO THE FOLLOWING TERMS AND CONDITIONS:
6
+ http://www.humany.com/legal
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # `@telia-ace/widget-components-image-link`
2
+
3
+ Image link component for ACE Widgets.
@@ -0,0 +1,9 @@
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;
@@ -0,0 +1,30 @@
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;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ declare type Props = {
3
+ className: string;
4
+ };
5
+ declare const ImageLink: React.SFC<Props>;
6
+ export default ImageLink;
@@ -0,0 +1,46 @@
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 ADDED
@@ -0,0 +1,2 @@
1
+ import ImageLinkComponent from './image-link-component';
2
+ export default ImageLinkComponent;
package/lib/index.js ADDED
@@ -0,0 +1,7 @@
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;
@@ -0,0 +1,9 @@
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;
@@ -0,0 +1,5 @@
1
+ import { createReactComponent } from '@telia-ace/widget-ui';
2
+ var ImageLinkComponent = function (container) {
3
+ return createReactComponent(container, 'image-link', import('./image-link'));
4
+ };
5
+ export default ImageLinkComponent;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ declare type Props = {
3
+ className: string;
4
+ };
5
+ declare const ImageLink: React.SFC<Props>;
6
+ export default ImageLink;
@@ -0,0 +1,41 @@
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;
@@ -0,0 +1,2 @@
1
+ import ImageLinkComponent from './image-link-component';
2
+ export default ImageLinkComponent;
@@ -0,0 +1,2 @@
1
+ import ImageLinkComponent from './image-link-component';
2
+ export default ImageLinkComponent;
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@telia-ace/widget-components-image-link",
3
+ "version": "1.0.0",
4
+ "description": "Image link component for ACE Widgets.",
5
+ "license": "SEE LICENSE IN LICENSE.txt",
6
+ "author": "Telia Company AB",
7
+ "keywords": [
8
+ "telia"
9
+ ],
10
+ "main": "lib/index.js",
11
+ "module": "lib-esm/index.js",
12
+ "files": [
13
+ "LICENSE.txt",
14
+ "README.md",
15
+ "lib/",
16
+ "lib-esm/"
17
+ ],
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "scripts": {
22
+ "clean": "cleandir lib && cleandir lib-esm",
23
+ "compile": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json"
24
+ },
25
+ "sideEffects": false,
26
+ "typings": "lib/index.d.ts",
27
+ "dependencies": {
28
+ "@telia-ace/widget-ui": "^1.0.0",
29
+ "@telia-ace/widget-utilities": "^1.0.1",
30
+ "@webprovisions/platform": "^1.1.2",
31
+ "react": "^17.0.2",
32
+ "react-dom": "^17.0.2",
33
+ "styled-components": "^4.3.2"
34
+ },
35
+ "devDependencies": {
36
+ "@types/react": "^17.0.39",
37
+ "@types/react-dom": "^17.0.13",
38
+ "@types/styled-components": "^5.1.7"
39
+ },
40
+ "gitHead": "26a4f73e6b1811cf60ca62a274b54b15127a83f6"
41
+ }