@digigov/nextjs 1.0.0-8ae63a77 → 1.0.0-8b33e4c8
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/App.js +29 -57
- package/Document.js +30 -49
- package/Image.js +10 -24
- package/Link.js +33 -26
- package/cjs/App.js +114 -0
- package/{esm → cjs}/Document.js +49 -30
- package/cjs/Image.js +32 -0
- package/cjs/Link.js +74 -0
- package/cjs/hooks.js +13 -0
- package/cjs/i18n.js +27 -0
- package/cjs/index.js +1 -0
- package/hooks.js +3 -11
- package/i18n.js +4 -15
- package/index.js +5 -1
- package/libs/ui/src/navigation/Link/index.d.ts +1 -1
- package/package.json +3 -3
- package/src/Link.tsx +20 -1
- package/es/App.js +0 -86
- package/es/Document.js +0 -91
- package/es/Image.js +0 -18
- package/es/Link.js +0 -30
- package/es/hooks.js +0 -5
- package/es/i18n.js +0 -16
- package/es/index.js +0 -0
- package/esm/App.js +0 -86
- package/esm/Image.js +0 -18
- package/esm/Link.js +0 -30
- package/esm/hooks.js +0 -5
- package/esm/i18n.js +0 -16
- package/esm/index.js +0 -5
package/es/Link.js
DELETED
|
@@ -1,30 +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 LinkBase from '@digigov/react-core/LinkBase';
|
|
7
|
-
|
|
8
|
-
var NextLink = function NextLink(props, ref) {
|
|
9
|
-
var href = props.href,
|
|
10
|
-
other = _objectWithoutProperties(props, _excluded);
|
|
11
|
-
|
|
12
|
-
var isExternalLink = //check if url has a file extension
|
|
13
|
-
/^(?:[a-z]+:)?\/\/|.pdf|.docx?|.xlsx?/i.test(href || '') || // or if props has a target or rel
|
|
14
|
-
other.target === '_blank';
|
|
15
|
-
|
|
16
|
-
if (isExternalLink) {
|
|
17
|
-
return /*#__PURE__*/React.createElement(LinkBase, _extends({
|
|
18
|
-
ref: ref,
|
|
19
|
-
href: href || '#'
|
|
20
|
-
}, other), props.children);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return /*#__PURE__*/React.createElement(Link, _extends({
|
|
24
|
-
href: href || '#'
|
|
25
|
-
}, other), /*#__PURE__*/React.createElement(LinkBase, _extends({
|
|
26
|
-
ref: ref
|
|
27
|
-
}, other), props.children));
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default /*#__PURE__*/React.forwardRef(NextLink);
|
package/es/hooks.js
DELETED
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,86 +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/navigation/Link';
|
|
15
|
-
import NextLink from '@digigov/nextjs/Link';
|
|
16
|
-
import dynamic from 'next/dynamic';
|
|
17
|
-
import { I18NProvider } from '@digigov/ui/i18n';
|
|
18
|
-
import { withTranslation } from 'react-i18next';
|
|
19
|
-
var DigiGOVApp = dynamic(function () {
|
|
20
|
-
return import('@digigov/ui/app/App');
|
|
21
|
-
}, {
|
|
22
|
-
ssr: false
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
var _ref = /*#__PURE__*/React.createElement(Head, null, /*#__PURE__*/React.createElement("meta", {
|
|
26
|
-
name: "viewport",
|
|
27
|
-
content: "minimum-scale=1, initial-scale=1, width=device-width"
|
|
28
|
-
}));
|
|
29
|
-
|
|
30
|
-
var DigiGOVNextApp = /*#__PURE__*/function (_App) {
|
|
31
|
-
_inherits(DigiGOVNextApp, _App);
|
|
32
|
-
|
|
33
|
-
var _super = _createSuper(DigiGOVNextApp);
|
|
34
|
-
|
|
35
|
-
function DigiGOVNextApp() {
|
|
36
|
-
_classCallCheck(this, DigiGOVNextApp);
|
|
37
|
-
|
|
38
|
-
return _super.apply(this, arguments);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
_createClass(DigiGOVNextApp, [{
|
|
42
|
-
key: "componentDidMount",
|
|
43
|
-
value: function componentDidMount() {
|
|
44
|
-
// Remove the server-side injected CSS.
|
|
45
|
-
var jssStyles = document.querySelector('#jss-server-side');
|
|
46
|
-
|
|
47
|
-
if (jssStyles && jssStyles.parentElement) {
|
|
48
|
-
jssStyles.parentElement.removeChild(jssStyles);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
this.updateHtmlLang();
|
|
52
|
-
}
|
|
53
|
-
}, {
|
|
54
|
-
key: "componentDidUpdate",
|
|
55
|
-
value: function componentDidUpdate() {
|
|
56
|
-
this.updateHtmlLang();
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
key: "updateHtmlLang",
|
|
60
|
-
value: function updateHtmlLang() {
|
|
61
|
-
document.documentElement.lang = this.props.i18n.language;
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: "render",
|
|
65
|
-
value: function render() {
|
|
66
|
-
var _this$props = this.props,
|
|
67
|
-
Component = _this$props.Component,
|
|
68
|
-
pageProps = _this$props.pageProps,
|
|
69
|
-
_t = _this$props.t,
|
|
70
|
-
i18n = _this$props.i18n;
|
|
71
|
-
return /*#__PURE__*/React.createElement(I18NProvider, {
|
|
72
|
-
t: function t(str) {
|
|
73
|
-
return typeof str === 'string' ? _t(str) : str;
|
|
74
|
-
},
|
|
75
|
-
i18n: i18n
|
|
76
|
-
}, /*#__PURE__*/React.createElement(LinkProvider, {
|
|
77
|
-
component: NextLink
|
|
78
|
-
}, _ref, /*#__PURE__*/React.createElement(DigiGOVApp, null, /*#__PURE__*/React.createElement(Component, pageProps))));
|
|
79
|
-
}
|
|
80
|
-
}]);
|
|
81
|
-
|
|
82
|
-
return DigiGOVNextApp;
|
|
83
|
-
}(App);
|
|
84
|
-
|
|
85
|
-
var DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextApp);
|
|
86
|
-
export default DigiGOVNextAppWithTranslation;
|
package/esm/Image.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["src"];
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import NextImage from 'next/image';
|
|
6
|
-
import { useBasePath } from '@digigov/nextjs/hooks';
|
|
7
|
-
|
|
8
|
-
var Image = function Image(_ref) {
|
|
9
|
-
var src = _ref.src,
|
|
10
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
11
|
-
|
|
12
|
-
var basePathSrc = useBasePath(src);
|
|
13
|
-
return /*#__PURE__*/React.createElement(NextImage, _extends({
|
|
14
|
-
src: basePathSrc
|
|
15
|
-
}, rest));
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default Image;
|
package/esm/Link.js
DELETED
|
@@ -1,30 +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 LinkBase from '@digigov/react-core/LinkBase';
|
|
7
|
-
|
|
8
|
-
var NextLink = function NextLink(props, ref) {
|
|
9
|
-
var href = props.href,
|
|
10
|
-
other = _objectWithoutProperties(props, _excluded);
|
|
11
|
-
|
|
12
|
-
var isExternalLink = //check if url has a file extension
|
|
13
|
-
/^(?:[a-z]+:)?\/\/|.pdf|.docx?|.xlsx?/i.test(href || '') || // or if props has a target or rel
|
|
14
|
-
other.target === '_blank';
|
|
15
|
-
|
|
16
|
-
if (isExternalLink) {
|
|
17
|
-
return /*#__PURE__*/React.createElement(LinkBase, _extends({
|
|
18
|
-
ref: ref,
|
|
19
|
-
href: href || '#'
|
|
20
|
-
}, other), props.children);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return /*#__PURE__*/React.createElement(Link, _extends({
|
|
24
|
-
href: href || '#'
|
|
25
|
-
}, other), /*#__PURE__*/React.createElement(LinkBase, _extends({
|
|
26
|
-
ref: ref
|
|
27
|
-
}, other), props.children));
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default /*#__PURE__*/React.forwardRef(NextLink);
|
package/esm/hooks.js
DELETED
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
|
-
}
|