@telia-ace/widget-components-not-found 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-not-found`
2
+
3
+ Not found component for ACE Widgets.
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import NotFoundComponent from './not-found-component';
2
+ export default NotFoundComponent;
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 not_found_component_1 = __importDefault(require("./not-found-component"));
7
+ exports.default = not_found_component_1.default;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ declare type Props = {
3
+ header?: string;
4
+ link?: string;
5
+ suggestionHeader?: string;
6
+ suggestion?: string;
7
+ };
8
+ declare const NotFoundBase: React.FC<Props>;
9
+ export default NotFoundBase;
@@ -0,0 +1,54 @@
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || function (mod) {
23
+ if (mod && mod.__esModule) return mod;
24
+ var result = {};
25
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26
+ __setModuleDefault(result, mod);
27
+ return result;
28
+ };
29
+ var __importDefault = (this && this.__importDefault) || function (mod) {
30
+ return (mod && mod.__esModule) ? mod : { "default": mod };
31
+ };
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ var widget_ui_1 = require("@telia-ace/widget-ui");
34
+ var react_1 = __importDefault(require("react"));
35
+ var styled_components_1 = __importStar(require("styled-components"));
36
+ var NotFoundBase = function (_a) {
37
+ var _b = _a.header, header = _b === void 0 ? '' : _b, _c = _a.link, link = _c === void 0 ? '' : _c, _d = _a.suggestionHeader, suggestionHeader = _d === void 0 ? '' : _d, _e = _a.suggestion, suggestion = _e === void 0 ? '' : _e;
38
+ return (react_1.default.createElement(Wrapper, null,
39
+ react_1.default.createElement(Status, null,
40
+ react_1.default.createElement(widget_ui_1.Typography, { variant: "h2" }, "404")),
41
+ react_1.default.createElement(Header, null,
42
+ react_1.default.createElement(widget_ui_1.Typography, { variant: "h3" }, header),
43
+ react_1.default.createElement(widget_ui_1.TextLink, { routeName: "index", "aria-label": link, text: link })),
44
+ react_1.default.createElement(Content, null,
45
+ react_1.default.createElement("span", null, suggestionHeader),
46
+ react_1.default.createElement("ul", null,
47
+ react_1.default.createElement("li", null, suggestion)))));
48
+ };
49
+ exports.default = NotFoundBase;
50
+ var Wrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n justify-content: flex-start;\n padding: ", ";\n"], ["\n ", "\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n justify-content: flex-start;\n padding: ", ";\n"])), widget_ui_1.contentBox, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; });
51
+ var Status = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), (0, widget_ui_1.headingElement)('h2', (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 0;\n margin: 0;\n color: gray;\n font-size: ", ";\n "], ["\n padding: 0;\n margin: 0;\n color: gray;\n font-size: ", ";\n "])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.huge; })));
52
+ var Header = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-left: ", ";\n\n ", "\n\n a {\n color: ", ";\n font-size: ", ";\n }\n"], ["\n margin-left: ", ";\n\n ", "\n\n a {\n color: ", ";\n font-size: ", ";\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; }, (0, widget_ui_1.headingElement)('h3', (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n text-transform: uppercase;\n font-size: ", ";\n "], ["\n text-transform: uppercase;\n font-size: ", ";\n "])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.normal; })), function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.link; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.small; });
53
+ var Content = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-top: ", ";\n min-width: 100%;\n\n span {\n font-weight: bold;\n }\n"], ["\n margin-top: ", ";\n min-width: 100%;\n\n span {\n font-weight: bold;\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; });
54
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
@@ -0,0 +1,10 @@
1
+ import { Container } from '@webprovisions/platform';
2
+ export declare type NotFoundComponentProps = {
3
+ header?: string;
4
+ linkLabel?: string;
5
+ suggestionHeader?: string;
6
+ suggestionLabel?: string;
7
+ showSearch?: boolean;
8
+ };
9
+ declare const NotFoundComponent: (container: Container) => Promise<void>;
10
+ export default NotFoundComponent;
@@ -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 NotFoundComponent = function (container) {
28
+ return (0, widget_ui_1.createReactComponent)(container, 'not-found', Promise.resolve().then(function () { return __importStar(require('./not-found')); }));
29
+ };
30
+ exports.default = NotFoundComponent;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ declare type Props = {};
3
+ declare const NotFound: React.FC<Props>;
4
+ export default NotFound;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ var widget_types_grid_1 = require("@telia-ace/widget-types-grid");
41
+ var widget_ui_1 = require("@telia-ace/widget-ui");
42
+ var react_1 = __importStar(require("react"));
43
+ var styled_components_1 = require("styled-components");
44
+ var not_found_base_1 = __importDefault(require("./not-found-base"));
45
+ var NotFound = function () {
46
+ var _a = (0, widget_ui_1.useProperties)(), header = _a.header, linkLabel = _a.linkLabel, suggestionHeader = _a.suggestionHeader, suggestionLabel = _a.suggestionLabel, showSearch = _a.showSearch;
47
+ var container = (0, widget_ui_1.useContainer)();
48
+ var themeContext = (0, react_1.useContext)(styled_components_1.ThemeContext);
49
+ return (react_1.default.createElement(react_1.default.Fragment, null,
50
+ showSearch && (react_1.default.createElement(widget_types_grid_1.DetachedComponent, { builder: function (components) {
51
+ return container.get('settings').then(function (settings) {
52
+ var _a;
53
+ var searchComponentProps = Object.keys(settings.components).reduce(function (acc, key) {
54
+ if (settings.components[key].type === 'search') {
55
+ return settings.components[key].properties;
56
+ }
57
+ return acc;
58
+ }, {});
59
+ var searchNode = components.createNode('search', { detached: true });
60
+ searchNode.writeLayout({ size: 'full' });
61
+ searchNode.writeProperties(__assign({ 'css-margin-bottom': ((_a = themeContext === null || themeContext === void 0 ? void 0 : themeContext.sizes) === null || _a === void 0 ? void 0 : _a.normal) || '15px' }, searchComponentProps));
62
+ return searchNode;
63
+ });
64
+ } })),
65
+ react_1.default.createElement(not_found_base_1.default, { header: header, link: linkLabel, suggestionHeader: suggestionHeader, suggestion: suggestionLabel })));
66
+ };
67
+ exports.default = NotFound;
@@ -0,0 +1,2 @@
1
+ import NotFoundComponent from './not-found-component';
2
+ export default NotFoundComponent;
@@ -0,0 +1,2 @@
1
+ import NotFoundComponent from './not-found-component';
2
+ export default NotFoundComponent;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ declare type Props = {
3
+ header?: string;
4
+ link?: string;
5
+ suggestionHeader?: string;
6
+ suggestion?: string;
7
+ };
8
+ declare const NotFoundBase: React.FC<Props>;
9
+ export default NotFoundBase;
@@ -0,0 +1,26 @@
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
+ import { contentBox, headingElement, TextLink, Typography } from '@telia-ace/widget-ui';
6
+ import React from 'react';
7
+ import styled, { css } from 'styled-components';
8
+ var NotFoundBase = function (_a) {
9
+ var _b = _a.header, header = _b === void 0 ? '' : _b, _c = _a.link, link = _c === void 0 ? '' : _c, _d = _a.suggestionHeader, suggestionHeader = _d === void 0 ? '' : _d, _e = _a.suggestion, suggestion = _e === void 0 ? '' : _e;
10
+ return (React.createElement(Wrapper, null,
11
+ React.createElement(Status, null,
12
+ React.createElement(Typography, { variant: "h2" }, "404")),
13
+ React.createElement(Header, null,
14
+ React.createElement(Typography, { variant: "h3" }, header),
15
+ React.createElement(TextLink, { routeName: "index", "aria-label": link, text: link })),
16
+ React.createElement(Content, null,
17
+ React.createElement("span", null, suggestionHeader),
18
+ React.createElement("ul", null,
19
+ React.createElement("li", null, suggestion)))));
20
+ };
21
+ export default NotFoundBase;
22
+ var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n justify-content: flex-start;\n padding: ", ";\n"], ["\n ", "\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n justify-content: flex-start;\n padding: ", ";\n"])), contentBox, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; });
23
+ var Status = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), headingElement('h2', css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 0;\n margin: 0;\n color: gray;\n font-size: ", ";\n "], ["\n padding: 0;\n margin: 0;\n color: gray;\n font-size: ", ";\n "])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.huge; })));
24
+ var Header = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-left: ", ";\n\n ", "\n\n a {\n color: ", ";\n font-size: ", ";\n }\n"], ["\n margin-left: ", ";\n\n ", "\n\n a {\n color: ", ";\n font-size: ", ";\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; }, headingElement('h3', css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n text-transform: uppercase;\n font-size: ", ";\n "], ["\n text-transform: uppercase;\n font-size: ", ";\n "])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.normal; })), function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.link; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.small; });
25
+ var Content = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-top: ", ";\n min-width: 100%;\n\n span {\n font-weight: bold;\n }\n"], ["\n margin-top: ", ";\n min-width: 100%;\n\n span {\n font-weight: bold;\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; });
26
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
@@ -0,0 +1,10 @@
1
+ import { Container } from '@webprovisions/platform';
2
+ export declare type NotFoundComponentProps = {
3
+ header?: string;
4
+ linkLabel?: string;
5
+ suggestionHeader?: string;
6
+ suggestionLabel?: string;
7
+ showSearch?: boolean;
8
+ };
9
+ declare const NotFoundComponent: (container: Container) => Promise<void>;
10
+ export default NotFoundComponent;
@@ -0,0 +1,5 @@
1
+ import { createReactComponent } from '@telia-ace/widget-ui';
2
+ var NotFoundComponent = function (container) {
3
+ return createReactComponent(container, 'not-found', import('./not-found'));
4
+ };
5
+ export default NotFoundComponent;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ declare type Props = {};
3
+ declare const NotFound: React.FC<Props>;
4
+ export default NotFound;
@@ -0,0 +1,39 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { DetachedComponent } from '@telia-ace/widget-types-grid';
13
+ import { useContainer, useProperties } from '@telia-ace/widget-ui';
14
+ import React, { useContext } from 'react';
15
+ import { ThemeContext } from 'styled-components';
16
+ import NotFoundBase from './not-found-base';
17
+ var NotFound = function () {
18
+ var _a = useProperties(), header = _a.header, linkLabel = _a.linkLabel, suggestionHeader = _a.suggestionHeader, suggestionLabel = _a.suggestionLabel, showSearch = _a.showSearch;
19
+ var container = useContainer();
20
+ var themeContext = useContext(ThemeContext);
21
+ return (React.createElement(React.Fragment, null,
22
+ showSearch && (React.createElement(DetachedComponent, { builder: function (components) {
23
+ return container.get('settings').then(function (settings) {
24
+ var _a;
25
+ var searchComponentProps = Object.keys(settings.components).reduce(function (acc, key) {
26
+ if (settings.components[key].type === 'search') {
27
+ return settings.components[key].properties;
28
+ }
29
+ return acc;
30
+ }, {});
31
+ var searchNode = components.createNode('search', { detached: true });
32
+ searchNode.writeLayout({ size: 'full' });
33
+ searchNode.writeProperties(__assign({ 'css-margin-bottom': ((_a = themeContext === null || themeContext === void 0 ? void 0 : themeContext.sizes) === null || _a === void 0 ? void 0 : _a.normal) || '15px' }, searchComponentProps));
34
+ return searchNode;
35
+ });
36
+ } })),
37
+ React.createElement(NotFoundBase, { header: header, link: linkLabel, suggestionHeader: suggestionHeader, suggestion: suggestionLabel })));
38
+ };
39
+ export default NotFound;
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@telia-ace/widget-components-not-found",
3
+ "version": "1.0.0",
4
+ "description": "Not found 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-core": "^1.0.0",
29
+ "@telia-ace/widget-types-grid": "^1.0.0",
30
+ "@telia-ace/widget-ui": "^1.0.0",
31
+ "@webprovisions/platform": "^1.1.2",
32
+ "react": "^17.0.2",
33
+ "react-dom": "^17.0.2",
34
+ "styled-components": "^4.3.2"
35
+ },
36
+ "devDependencies": {
37
+ "@types/react": "^17.0.39",
38
+ "@types/react-dom": "^17.0.13",
39
+ "@types/styled-components": "^5.1.7"
40
+ },
41
+ "gitHead": "26a4f73e6b1811cf60ca62a274b54b15127a83f6"
42
+ }