@digigov/nextjs 0.4.3 → 0.4.4
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/.eslintrc.js +3 -0
- package/.prettierrc.js +3 -0
- package/.rush/temp/shrinkwrap-deps.json +263 -0
- package/CHANGELOG.json +753 -0
- package/CHANGELOG.md +8 -1
- package/{libs → dist/libs}/nextjs/src/App.d.ts +0 -0
- package/{libs → dist/libs}/nextjs/src/Document.d.ts +0 -0
- package/{libs → dist/libs}/nextjs/src/Link.d.ts +0 -0
- package/{libs → dist/libs}/nextjs/src/i18n.d.ts +0 -0
- package/{libs → dist/libs}/nextjs/src/index.d.ts +0 -0
- package/{libs → dist/libs}/ui/src/app/App.d.ts +0 -0
- package/{libs → dist/libs}/ui/src/app/i18n.d.ts +0 -0
- package/{libs → dist/libs}/ui/src/core/Link/index.d.ts +0 -0
- package/{libs → dist/libs}/ui/src/locales/el.d.ts +6 -0
- package/{libs → dist/libs}/ui/src/themes/govgr.d.ts +0 -0
- package/{libs-ui → dist/libs-ui}/react-core/src/Link/index.d.ts +0 -0
- package/dist/node_modules/.pnpm-debug.log +16 -0
- package/nextjs.build.error.log +3 -0
- package/nextjs.build.log +16 -0
- package/package.json +38 -25
- package/src/App.tsx +55 -0
- package/src/Document.tsx +86 -0
- package/src/Link.tsx +30 -0
- package/src/i18n.tsx +18 -0
- package/{LICENSE → src/index.ts} +0 -0
- package/tsconfig.json +14 -0
- package/App.js +0 -108
- package/Document.js +0 -152
- package/Link.js +0 -44
- package/es/App.js +0 -79
- package/es/Document.js +0 -129
- package/es/Link.js +0 -29
- package/es/i18n.js +0 -16
- package/es/index.js +0 -0
- package/esm/App.js +0 -79
- package/esm/Document.js +0 -129
- package/esm/Link.js +0 -29
- package/esm/i18n.js +0 -16
- package/esm/index.js +0 -5
- package/i18n.js +0 -27
- package/index.js +0 -1
package/Link.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
|
-
var _link = _interopRequireDefault(require("next/link"));
|
|
17
|
-
|
|
18
|
-
var _Link = _interopRequireDefault(require("@digigov/react-core/Link"));
|
|
19
|
-
|
|
20
|
-
var _excluded = ["href"];
|
|
21
|
-
|
|
22
|
-
var NextLink = function NextLink(props, ref) {
|
|
23
|
-
var href = props.href,
|
|
24
|
-
other = (0, _objectWithoutProperties2["default"])(props, _excluded); //check if url has a domain
|
|
25
|
-
|
|
26
|
-
var isExternalLink = /^(?:[a-z]+:)?\/\//i.test(href || '');
|
|
27
|
-
|
|
28
|
-
if (isExternalLink) {
|
|
29
|
-
return /*#__PURE__*/_react["default"].createElement(_Link["default"], (0, _extends2["default"])({
|
|
30
|
-
ref: ref,
|
|
31
|
-
href: href || '#'
|
|
32
|
-
}, other), props.children);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return /*#__PURE__*/_react["default"].createElement(_link["default"], (0, _extends2["default"])({
|
|
36
|
-
href: href || '#'
|
|
37
|
-
}, other), /*#__PURE__*/_react["default"].createElement(_Link["default"], (0, _extends2["default"])({
|
|
38
|
-
ref: ref
|
|
39
|
-
}, other), props.children));
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
var _default = /*#__PURE__*/_react["default"].forwardRef(NextLink);
|
|
43
|
-
|
|
44
|
-
exports["default"] = _default;
|
package/es/App.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
|
|
7
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
-
|
|
9
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
-
|
|
11
|
-
import React from 'react';
|
|
12
|
-
import App from 'next/app';
|
|
13
|
-
import Head from 'next/head';
|
|
14
|
-
import { LinkProvider } from '@digigov/ui/core/Link';
|
|
15
|
-
import NextLink from '@digigov/nextjs/Link';
|
|
16
|
-
import GovGRTheme from '@digigov/ui/themes/govgr';
|
|
17
|
-
import dynamic from 'next/dynamic';
|
|
18
|
-
import { I18NProvider } from '@digigov/ui/app/i18n';
|
|
19
|
-
import { withTranslation } from 'react-i18next';
|
|
20
|
-
var DigiGOVApp = dynamic(function () {
|
|
21
|
-
return import('@digigov/ui/app/App');
|
|
22
|
-
}, {
|
|
23
|
-
ssr: false
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
var _ref = /*#__PURE__*/React.createElement(Head, null, /*#__PURE__*/React.createElement("meta", {
|
|
27
|
-
name: "viewport",
|
|
28
|
-
content: "minimum-scale=1, initial-scale=1, width=device-width"
|
|
29
|
-
}));
|
|
30
|
-
|
|
31
|
-
var DigiGOVNextApp = /*#__PURE__*/function (_App) {
|
|
32
|
-
_inherits(DigiGOVNextApp, _App);
|
|
33
|
-
|
|
34
|
-
var _super = _createSuper(DigiGOVNextApp);
|
|
35
|
-
|
|
36
|
-
function DigiGOVNextApp() {
|
|
37
|
-
_classCallCheck(this, DigiGOVNextApp);
|
|
38
|
-
|
|
39
|
-
return _super.apply(this, arguments);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
_createClass(DigiGOVNextApp, [{
|
|
43
|
-
key: "componentDidMount",
|
|
44
|
-
value: function componentDidMount() {
|
|
45
|
-
// Remove the server-side injected CSS.
|
|
46
|
-
var jssStyles = document.querySelector('#jss-server-side');
|
|
47
|
-
|
|
48
|
-
if (jssStyles && jssStyles.parentElement) {
|
|
49
|
-
jssStyles.parentElement.removeChild(jssStyles);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}, {
|
|
53
|
-
key: "render",
|
|
54
|
-
value: function render() {
|
|
55
|
-
var _this$props = this.props,
|
|
56
|
-
Component = _this$props.Component,
|
|
57
|
-
pageProps = _this$props.pageProps,
|
|
58
|
-
theme = _this$props.theme,
|
|
59
|
-
t = _this$props.t,
|
|
60
|
-
i18n = _this$props.i18n;
|
|
61
|
-
return /*#__PURE__*/React.createElement(I18NProvider, {
|
|
62
|
-
t: t,
|
|
63
|
-
i18n: i18n
|
|
64
|
-
}, /*#__PURE__*/React.createElement(LinkProvider, {
|
|
65
|
-
component: NextLink
|
|
66
|
-
}, _ref, /*#__PURE__*/React.createElement(DigiGOVApp, {
|
|
67
|
-
theme: theme
|
|
68
|
-
}, /*#__PURE__*/React.createElement(Component, pageProps))));
|
|
69
|
-
}
|
|
70
|
-
}]);
|
|
71
|
-
|
|
72
|
-
return DigiGOVNextApp;
|
|
73
|
-
}(App);
|
|
74
|
-
|
|
75
|
-
var DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextApp);
|
|
76
|
-
DigiGOVNextAppWithTranslation.defaultProps = {
|
|
77
|
-
theme: GovGRTheme
|
|
78
|
-
};
|
|
79
|
-
export default DigiGOVNextAppWithTranslation;
|
package/es/Document.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
4
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
6
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
7
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
9
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
10
|
-
|
|
11
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
|
|
13
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
14
|
-
|
|
15
|
-
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
16
|
-
import React from 'react';
|
|
17
|
-
import Document, { Html, Head, Main, NextScript } from 'next/document';
|
|
18
|
-
import { ServerStyleSheets } from '@material-ui/core/styles';
|
|
19
|
-
|
|
20
|
-
var _ref = /*#__PURE__*/React.createElement("link", {
|
|
21
|
-
rel: "stylesheet",
|
|
22
|
-
href: "https://fonts.googleapis.com/icon?family=Material+Icons"
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
var _ref2 = /*#__PURE__*/React.createElement("link", {
|
|
26
|
-
rel: "stylesheet",
|
|
27
|
-
href: "https://fonts.googleapis.com/css?family=Roboto:300,400,500"
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
export function Fonts() {
|
|
31
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, _ref, _ref2);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
var _ref3 = /*#__PURE__*/React.createElement(Fonts, null);
|
|
35
|
-
|
|
36
|
-
var _ref4 = /*#__PURE__*/React.createElement("body", null, /*#__PURE__*/React.createElement(Main, null), /*#__PURE__*/React.createElement(NextScript, null));
|
|
37
|
-
|
|
38
|
-
var DigiGOVDocument = /*#__PURE__*/function (_Document) {
|
|
39
|
-
_inherits(DigiGOVDocument, _Document);
|
|
40
|
-
|
|
41
|
-
var _super = _createSuper(DigiGOVDocument);
|
|
42
|
-
|
|
43
|
-
function DigiGOVDocument() {
|
|
44
|
-
_classCallCheck(this, DigiGOVDocument);
|
|
45
|
-
|
|
46
|
-
return _super.apply(this, arguments);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
_createClass(DigiGOVDocument, [{
|
|
50
|
-
key: "render",
|
|
51
|
-
value: function render() {
|
|
52
|
-
return /*#__PURE__*/React.createElement(Html, null, /*#__PURE__*/React.createElement(Head, null, /*#__PURE__*/React.createElement("script", {
|
|
53
|
-
type: "text/javascript",
|
|
54
|
-
dangerouslySetInnerHTML: {
|
|
55
|
-
__html: "if (window.document.documentMode) alert('Internet Explorer is not supported. Please use a modern browser!');\n"
|
|
56
|
-
}
|
|
57
|
-
}), _ref3), _ref4);
|
|
58
|
-
}
|
|
59
|
-
}]);
|
|
60
|
-
|
|
61
|
-
return DigiGOVDocument;
|
|
62
|
-
}(Document);
|
|
63
|
-
|
|
64
|
-
export { DigiGOVDocument as default };
|
|
65
|
-
|
|
66
|
-
DigiGOVDocument.getInitialProps = /*#__PURE__*/function () {
|
|
67
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(ctx) {
|
|
68
|
-
var sheets, originalRenderPage, initialProps;
|
|
69
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
70
|
-
while (1) {
|
|
71
|
-
switch (_context.prev = _context.next) {
|
|
72
|
-
case 0:
|
|
73
|
-
// Resolution order
|
|
74
|
-
//
|
|
75
|
-
// On the server:
|
|
76
|
-
// 1. app.getInitialProps
|
|
77
|
-
// 2. page.getInitialProps
|
|
78
|
-
// 3. document.getInitialProps
|
|
79
|
-
// 4. app.render
|
|
80
|
-
// 5. page.render
|
|
81
|
-
// 6. document.render
|
|
82
|
-
//
|
|
83
|
-
// On the server with error:
|
|
84
|
-
// 1. document.getInitialProps
|
|
85
|
-
// 2. app.render
|
|
86
|
-
// 3. page.render
|
|
87
|
-
// 4. document.render
|
|
88
|
-
//
|
|
89
|
-
// On the client
|
|
90
|
-
// 1. app.getInitialProps
|
|
91
|
-
// 2. page.getInitialProps
|
|
92
|
-
// 3. app.render
|
|
93
|
-
// 4. page.render
|
|
94
|
-
// Render app and page and get the context of the page with collected side effects.
|
|
95
|
-
sheets = new ServerStyleSheets();
|
|
96
|
-
originalRenderPage = ctx.renderPage;
|
|
97
|
-
|
|
98
|
-
ctx.renderPage = function () {
|
|
99
|
-
return originalRenderPage({
|
|
100
|
-
enhanceApp: function enhanceApp(App) {
|
|
101
|
-
return function (props) {
|
|
102
|
-
return sheets.collect( /*#__PURE__*/React.createElement(App, props));
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
_context.next = 5;
|
|
109
|
-
return Document.getInitialProps(ctx);
|
|
110
|
-
|
|
111
|
-
case 5:
|
|
112
|
-
initialProps = _context.sent;
|
|
113
|
-
return _context.abrupt("return", _extends({}, initialProps, {
|
|
114
|
-
// Styles fragment is rendered after the app and page rendering finish.
|
|
115
|
-
styles: [].concat(_toConsumableArray(React.Children.toArray(initialProps.styles)), [sheets.getStyleElement()])
|
|
116
|
-
}));
|
|
117
|
-
|
|
118
|
-
case 7:
|
|
119
|
-
case "end":
|
|
120
|
-
return _context.stop();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}, _callee);
|
|
124
|
-
}));
|
|
125
|
-
|
|
126
|
-
return function (_x) {
|
|
127
|
-
return _ref5.apply(this, arguments);
|
|
128
|
-
};
|
|
129
|
-
}();
|
package/es/Link.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["href"];
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import Link from 'next/link';
|
|
6
|
-
import CoreLink from '@digigov/react-core/Link';
|
|
7
|
-
|
|
8
|
-
var NextLink = function NextLink(props, ref) {
|
|
9
|
-
var href = props.href,
|
|
10
|
-
other = _objectWithoutProperties(props, _excluded); //check if url has a domain
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var isExternalLink = /^(?:[a-z]+:)?\/\//i.test(href || '');
|
|
14
|
-
|
|
15
|
-
if (isExternalLink) {
|
|
16
|
-
return /*#__PURE__*/React.createElement(CoreLink, _extends({
|
|
17
|
-
ref: ref,
|
|
18
|
-
href: href || '#'
|
|
19
|
-
}, other), props.children);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return /*#__PURE__*/React.createElement(Link, _extends({
|
|
23
|
-
href: href || '#'
|
|
24
|
-
}, other), /*#__PURE__*/React.createElement(CoreLink, _extends({
|
|
25
|
-
ref: ref
|
|
26
|
-
}, other), props.children));
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default /*#__PURE__*/React.forwardRef(NextLink);
|
package/es/i18n.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import i18n from 'i18next';
|
|
2
|
-
import { initReactI18next } from 'react-i18next';
|
|
3
|
-
export default function initI18n(resources) {
|
|
4
|
-
var language = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'el';
|
|
5
|
-
return i18n.use(initReactI18next) // passes i18n down to react-i18next
|
|
6
|
-
.init({
|
|
7
|
-
resources: resources,
|
|
8
|
-
lng: language,
|
|
9
|
-
keySeparator: '.',
|
|
10
|
-
// we use keys in form messages.welcome
|
|
11
|
-
interpolation: {
|
|
12
|
-
escapeValue: false // react already safes from xss
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
package/es/index.js
DELETED
|
File without changes
|
package/esm/App.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
|
|
7
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
-
|
|
9
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
-
|
|
11
|
-
import React from 'react';
|
|
12
|
-
import App from 'next/app';
|
|
13
|
-
import Head from 'next/head';
|
|
14
|
-
import { LinkProvider } from '@digigov/ui/core/Link';
|
|
15
|
-
import NextLink from '@digigov/nextjs/Link';
|
|
16
|
-
import GovGRTheme from '@digigov/ui/themes/govgr';
|
|
17
|
-
import dynamic from 'next/dynamic';
|
|
18
|
-
import { I18NProvider } from '@digigov/ui/app/i18n';
|
|
19
|
-
import { withTranslation } from 'react-i18next';
|
|
20
|
-
var DigiGOVApp = dynamic(function () {
|
|
21
|
-
return import('@digigov/ui/app/App');
|
|
22
|
-
}, {
|
|
23
|
-
ssr: false
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
var _ref = /*#__PURE__*/React.createElement(Head, null, /*#__PURE__*/React.createElement("meta", {
|
|
27
|
-
name: "viewport",
|
|
28
|
-
content: "minimum-scale=1, initial-scale=1, width=device-width"
|
|
29
|
-
}));
|
|
30
|
-
|
|
31
|
-
var DigiGOVNextApp = /*#__PURE__*/function (_App) {
|
|
32
|
-
_inherits(DigiGOVNextApp, _App);
|
|
33
|
-
|
|
34
|
-
var _super = _createSuper(DigiGOVNextApp);
|
|
35
|
-
|
|
36
|
-
function DigiGOVNextApp() {
|
|
37
|
-
_classCallCheck(this, DigiGOVNextApp);
|
|
38
|
-
|
|
39
|
-
return _super.apply(this, arguments);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
_createClass(DigiGOVNextApp, [{
|
|
43
|
-
key: "componentDidMount",
|
|
44
|
-
value: function componentDidMount() {
|
|
45
|
-
// Remove the server-side injected CSS.
|
|
46
|
-
var jssStyles = document.querySelector('#jss-server-side');
|
|
47
|
-
|
|
48
|
-
if (jssStyles && jssStyles.parentElement) {
|
|
49
|
-
jssStyles.parentElement.removeChild(jssStyles);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}, {
|
|
53
|
-
key: "render",
|
|
54
|
-
value: function render() {
|
|
55
|
-
var _this$props = this.props,
|
|
56
|
-
Component = _this$props.Component,
|
|
57
|
-
pageProps = _this$props.pageProps,
|
|
58
|
-
theme = _this$props.theme,
|
|
59
|
-
t = _this$props.t,
|
|
60
|
-
i18n = _this$props.i18n;
|
|
61
|
-
return /*#__PURE__*/React.createElement(I18NProvider, {
|
|
62
|
-
t: t,
|
|
63
|
-
i18n: i18n
|
|
64
|
-
}, /*#__PURE__*/React.createElement(LinkProvider, {
|
|
65
|
-
component: NextLink
|
|
66
|
-
}, _ref, /*#__PURE__*/React.createElement(DigiGOVApp, {
|
|
67
|
-
theme: theme
|
|
68
|
-
}, /*#__PURE__*/React.createElement(Component, pageProps))));
|
|
69
|
-
}
|
|
70
|
-
}]);
|
|
71
|
-
|
|
72
|
-
return DigiGOVNextApp;
|
|
73
|
-
}(App);
|
|
74
|
-
|
|
75
|
-
var DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextApp);
|
|
76
|
-
DigiGOVNextAppWithTranslation.defaultProps = {
|
|
77
|
-
theme: GovGRTheme
|
|
78
|
-
};
|
|
79
|
-
export default DigiGOVNextAppWithTranslation;
|
package/esm/Document.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
4
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
6
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
7
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
9
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
10
|
-
|
|
11
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
|
|
13
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
14
|
-
|
|
15
|
-
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
16
|
-
import React from 'react';
|
|
17
|
-
import Document, { Html, Head, Main, NextScript } from 'next/document';
|
|
18
|
-
import { ServerStyleSheets } from '@material-ui/core/styles';
|
|
19
|
-
|
|
20
|
-
var _ref = /*#__PURE__*/React.createElement("link", {
|
|
21
|
-
rel: "stylesheet",
|
|
22
|
-
href: "https://fonts.googleapis.com/icon?family=Material+Icons"
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
var _ref2 = /*#__PURE__*/React.createElement("link", {
|
|
26
|
-
rel: "stylesheet",
|
|
27
|
-
href: "https://fonts.googleapis.com/css?family=Roboto:300,400,500"
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
export function Fonts() {
|
|
31
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, _ref, _ref2);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
var _ref3 = /*#__PURE__*/React.createElement(Fonts, null);
|
|
35
|
-
|
|
36
|
-
var _ref4 = /*#__PURE__*/React.createElement("body", null, /*#__PURE__*/React.createElement(Main, null), /*#__PURE__*/React.createElement(NextScript, null));
|
|
37
|
-
|
|
38
|
-
var DigiGOVDocument = /*#__PURE__*/function (_Document) {
|
|
39
|
-
_inherits(DigiGOVDocument, _Document);
|
|
40
|
-
|
|
41
|
-
var _super = _createSuper(DigiGOVDocument);
|
|
42
|
-
|
|
43
|
-
function DigiGOVDocument() {
|
|
44
|
-
_classCallCheck(this, DigiGOVDocument);
|
|
45
|
-
|
|
46
|
-
return _super.apply(this, arguments);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
_createClass(DigiGOVDocument, [{
|
|
50
|
-
key: "render",
|
|
51
|
-
value: function render() {
|
|
52
|
-
return /*#__PURE__*/React.createElement(Html, null, /*#__PURE__*/React.createElement(Head, null, /*#__PURE__*/React.createElement("script", {
|
|
53
|
-
type: "text/javascript",
|
|
54
|
-
dangerouslySetInnerHTML: {
|
|
55
|
-
__html: "if (window.document.documentMode) alert('Internet Explorer is not supported. Please use a modern browser!');\n"
|
|
56
|
-
}
|
|
57
|
-
}), _ref3), _ref4);
|
|
58
|
-
}
|
|
59
|
-
}]);
|
|
60
|
-
|
|
61
|
-
return DigiGOVDocument;
|
|
62
|
-
}(Document);
|
|
63
|
-
|
|
64
|
-
export { DigiGOVDocument as default };
|
|
65
|
-
|
|
66
|
-
DigiGOVDocument.getInitialProps = /*#__PURE__*/function () {
|
|
67
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(ctx) {
|
|
68
|
-
var sheets, originalRenderPage, initialProps;
|
|
69
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
70
|
-
while (1) {
|
|
71
|
-
switch (_context.prev = _context.next) {
|
|
72
|
-
case 0:
|
|
73
|
-
// Resolution order
|
|
74
|
-
//
|
|
75
|
-
// On the server:
|
|
76
|
-
// 1. app.getInitialProps
|
|
77
|
-
// 2. page.getInitialProps
|
|
78
|
-
// 3. document.getInitialProps
|
|
79
|
-
// 4. app.render
|
|
80
|
-
// 5. page.render
|
|
81
|
-
// 6. document.render
|
|
82
|
-
//
|
|
83
|
-
// On the server with error:
|
|
84
|
-
// 1. document.getInitialProps
|
|
85
|
-
// 2. app.render
|
|
86
|
-
// 3. page.render
|
|
87
|
-
// 4. document.render
|
|
88
|
-
//
|
|
89
|
-
// On the client
|
|
90
|
-
// 1. app.getInitialProps
|
|
91
|
-
// 2. page.getInitialProps
|
|
92
|
-
// 3. app.render
|
|
93
|
-
// 4. page.render
|
|
94
|
-
// Render app and page and get the context of the page with collected side effects.
|
|
95
|
-
sheets = new ServerStyleSheets();
|
|
96
|
-
originalRenderPage = ctx.renderPage;
|
|
97
|
-
|
|
98
|
-
ctx.renderPage = function () {
|
|
99
|
-
return originalRenderPage({
|
|
100
|
-
enhanceApp: function enhanceApp(App) {
|
|
101
|
-
return function (props) {
|
|
102
|
-
return sheets.collect( /*#__PURE__*/React.createElement(App, props));
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
_context.next = 5;
|
|
109
|
-
return Document.getInitialProps(ctx);
|
|
110
|
-
|
|
111
|
-
case 5:
|
|
112
|
-
initialProps = _context.sent;
|
|
113
|
-
return _context.abrupt("return", _extends({}, initialProps, {
|
|
114
|
-
// Styles fragment is rendered after the app and page rendering finish.
|
|
115
|
-
styles: [].concat(_toConsumableArray(React.Children.toArray(initialProps.styles)), [sheets.getStyleElement()])
|
|
116
|
-
}));
|
|
117
|
-
|
|
118
|
-
case 7:
|
|
119
|
-
case "end":
|
|
120
|
-
return _context.stop();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}, _callee);
|
|
124
|
-
}));
|
|
125
|
-
|
|
126
|
-
return function (_x) {
|
|
127
|
-
return _ref5.apply(this, arguments);
|
|
128
|
-
};
|
|
129
|
-
}();
|
package/esm/Link.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["href"];
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import Link from 'next/link';
|
|
6
|
-
import CoreLink from '@digigov/react-core/Link';
|
|
7
|
-
|
|
8
|
-
var NextLink = function NextLink(props, ref) {
|
|
9
|
-
var href = props.href,
|
|
10
|
-
other = _objectWithoutProperties(props, _excluded); //check if url has a domain
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var isExternalLink = /^(?:[a-z]+:)?\/\//i.test(href || '');
|
|
14
|
-
|
|
15
|
-
if (isExternalLink) {
|
|
16
|
-
return /*#__PURE__*/React.createElement(CoreLink, _extends({
|
|
17
|
-
ref: ref,
|
|
18
|
-
href: href || '#'
|
|
19
|
-
}, other), props.children);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return /*#__PURE__*/React.createElement(Link, _extends({
|
|
23
|
-
href: href || '#'
|
|
24
|
-
}, other), /*#__PURE__*/React.createElement(CoreLink, _extends({
|
|
25
|
-
ref: ref
|
|
26
|
-
}, other), props.children));
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default /*#__PURE__*/React.forwardRef(NextLink);
|
package/esm/i18n.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import i18n from 'i18next';
|
|
2
|
-
import { initReactI18next } from 'react-i18next';
|
|
3
|
-
export default function initI18n(resources) {
|
|
4
|
-
var language = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'el';
|
|
5
|
-
return i18n.use(initReactI18next) // passes i18n down to react-i18next
|
|
6
|
-
.init({
|
|
7
|
-
resources: resources,
|
|
8
|
-
lng: language,
|
|
9
|
-
keySeparator: '.',
|
|
10
|
-
// we use keys in form messages.welcome
|
|
11
|
-
interpolation: {
|
|
12
|
-
escapeValue: false // react already safes from xss
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
package/esm/index.js
DELETED
package/i18n.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = initI18n;
|
|
9
|
-
|
|
10
|
-
var _i18next = _interopRequireDefault(require("i18next"));
|
|
11
|
-
|
|
12
|
-
var _reactI18next = require("react-i18next");
|
|
13
|
-
|
|
14
|
-
function initI18n(resources) {
|
|
15
|
-
var language = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'el';
|
|
16
|
-
return _i18next["default"].use(_reactI18next.initReactI18next) // passes i18n down to react-i18next
|
|
17
|
-
.init({
|
|
18
|
-
resources: resources,
|
|
19
|
-
lng: language,
|
|
20
|
-
keySeparator: '.',
|
|
21
|
-
// we use keys in form messages.welcome
|
|
22
|
-
interpolation: {
|
|
23
|
-
escapeValue: false // react already safes from xss
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|