@digigov/nextjs 1.0.0-21c8c3dc → 1.0.0-23c81d9f

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.
@@ -12,15 +12,10 @@ import React from 'react';
12
12
  import App from 'next/app';
13
13
  import Head from 'next/head';
14
14
  import { LinkProvider } from '@digigov/ui/navigation/Link';
15
- import NextLink from '@digigov/nextjs/Link';
16
- import dynamic from 'next/dynamic';
15
+ import NextLink from "./Link";
16
+ import DigiGOVApp, { StaticApp } from '@digigov/ui/app/App';
17
17
  import { I18NProvider } from '@digigov/ui/i18n';
18
18
  import { withTranslation } from 'react-i18next';
19
- var DigiGOVApp = dynamic(function () {
20
- return import('@digigov/ui/app/App');
21
- }, {
22
- ssr: false
23
- });
24
19
 
25
20
  var _ref = /*#__PURE__*/React.createElement(Head, null, /*#__PURE__*/React.createElement("meta", {
26
21
  name: "viewport",
@@ -39,35 +34,15 @@ var DigiGOVNextApp = /*#__PURE__*/function (_App) {
39
34
  }
40
35
 
41
36
  _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
37
  key: "render",
65
38
  value: function render() {
66
39
  var _this$props = this.props,
67
40
  Component = _this$props.Component,
68
41
  pageProps = _this$props.pageProps,
69
42
  _t = _this$props.t,
70
- i18n = _this$props.i18n;
43
+ i18n = _this$props.i18n,
44
+ _this$props$ssr = _this$props.ssr,
45
+ ssr = _this$props$ssr === void 0 ? false : _this$props$ssr;
71
46
  return /*#__PURE__*/React.createElement(I18NProvider, {
72
47
  t: function t(str) {
73
48
  return typeof str === 'string' ? _t(str) : str;
@@ -75,7 +50,7 @@ var DigiGOVNextApp = /*#__PURE__*/function (_App) {
75
50
  i18n: i18n
76
51
  }, /*#__PURE__*/React.createElement(LinkProvider, {
77
52
  component: NextLink
78
- }, _ref, /*#__PURE__*/React.createElement(DigiGOVApp, null, /*#__PURE__*/React.createElement(Component, pageProps))));
53
+ }, _ref, ssr ? /*#__PURE__*/React.createElement(DigiGOVApp, null, /*#__PURE__*/React.createElement(Component, pageProps)) : /*#__PURE__*/React.createElement(StaticApp, null, /*#__PURE__*/React.createElement(Component, pageProps))));
79
54
  }
80
55
  }]);
81
56
 
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../cjs/App/index.js"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../cjs/Document/index.js"
6
+ }
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
3
3
  var _excluded = ["src"];
4
4
  import React from 'react';
5
5
  import NextImage from 'next/image';
6
- import { useBasePath } from '@digigov/nextjs/hooks';
6
+ import { useBasePath } from "./hooks";
7
7
 
8
8
  var Image = function Image(_ref) {
9
9
  var src = _ref.src,
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../cjs/Image/index.js"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../cjs/Link/index.js"
6
+ }
@@ -2,13 +2,13 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
8
10
  exports["default"] = void 0;
9
11
 
10
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
-
12
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
13
 
14
14
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -25,31 +25,23 @@ var _app = _interopRequireDefault(require("next/app"));
25
25
 
26
26
  var _head = _interopRequireDefault(require("next/head"));
27
27
 
28
- var _Link = require("@digigov/ui/navigation/Link");
28
+ var _Link = require("@digigov/ui/cjs/navigation/Link");
29
29
 
30
- var _Link2 = _interopRequireDefault(require("@digigov/nextjs/Link"));
30
+ var _Link2 = _interopRequireDefault(require("./Link"));
31
31
 
32
- var _dynamic = _interopRequireDefault(require("next/dynamic"));
32
+ var _App2 = _interopRequireWildcard(require("@digigov/ui/cjs/app/App"));
33
33
 
34
- var _i18n = require("@digigov/ui/i18n");
34
+ var _i18n = require("@digigov/ui/cjs/i18n");
35
35
 
36
36
  var _reactI18next = require("react-i18next");
37
37
 
38
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
39
-
40
- 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; } }
41
-
42
38
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
43
39
 
44
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || (0, _typeof2["default"])(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
40
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
45
41
 
46
- var DigiGOVApp = (0, _dynamic["default"])(function () {
47
- return Promise.resolve().then(function () {
48
- return _interopRequireWildcard(require('@digigov/ui/app/App'));
49
- });
50
- }, {
51
- ssr: false
52
- });
42
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
43
+
44
+ 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; } }
53
45
 
54
46
  var _ref = /*#__PURE__*/_react["default"].createElement(_head["default"], null, /*#__PURE__*/_react["default"].createElement("meta", {
55
47
  name: "viewport",
@@ -67,35 +59,15 @@ var DigiGOVNextApp = /*#__PURE__*/function (_App) {
67
59
  }
68
60
 
69
61
  (0, _createClass2["default"])(DigiGOVNextApp, [{
70
- key: "componentDidMount",
71
- value: function componentDidMount() {
72
- // Remove the server-side injected CSS.
73
- var jssStyles = document.querySelector('#jss-server-side');
74
-
75
- if (jssStyles && jssStyles.parentElement) {
76
- jssStyles.parentElement.removeChild(jssStyles);
77
- }
78
-
79
- this.updateHtmlLang();
80
- }
81
- }, {
82
- key: "componentDidUpdate",
83
- value: function componentDidUpdate() {
84
- this.updateHtmlLang();
85
- }
86
- }, {
87
- key: "updateHtmlLang",
88
- value: function updateHtmlLang() {
89
- document.documentElement.lang = this.props.i18n.language;
90
- }
91
- }, {
92
62
  key: "render",
93
63
  value: function render() {
94
64
  var _this$props = this.props,
95
65
  Component = _this$props.Component,
96
66
  pageProps = _this$props.pageProps,
97
67
  _t = _this$props.t,
98
- i18n = _this$props.i18n;
68
+ i18n = _this$props.i18n,
69
+ _this$props$ssr = _this$props.ssr,
70
+ ssr = _this$props$ssr === void 0 ? false : _this$props$ssr;
99
71
  return /*#__PURE__*/_react["default"].createElement(_i18n.I18NProvider, {
100
72
  t: function t(str) {
101
73
  return typeof str === 'string' ? _t(str) : str;
@@ -103,7 +75,7 @@ var DigiGOVNextApp = /*#__PURE__*/function (_App) {
103
75
  i18n: i18n
104
76
  }, /*#__PURE__*/_react["default"].createElement(_Link.LinkProvider, {
105
77
  component: _Link2["default"]
106
- }, _ref, /*#__PURE__*/_react["default"].createElement(DigiGOVApp, null, /*#__PURE__*/_react["default"].createElement(Component, pageProps))));
78
+ }, _ref, ssr ? /*#__PURE__*/_react["default"].createElement(_App2["default"], null, /*#__PURE__*/_react["default"].createElement(Component, pageProps)) : /*#__PURE__*/_react["default"].createElement(_App2.StaticApp, null, /*#__PURE__*/_react["default"].createElement(Component, pageProps))));
107
79
  }
108
80
  }]);
109
81
  return DigiGOVNextApp;
@@ -15,7 +15,7 @@ var _react = _interopRequireDefault(require("react"));
15
15
 
16
16
  var _image = _interopRequireDefault(require("next/image"));
17
17
 
18
- var _hooks = require("@digigov/nextjs/hooks");
18
+ var _hooks = require("./hooks");
19
19
 
20
20
  var _excluded = ["src"];
21
21
 
package/cjs/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../cjs/hooks/index.js"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../cjs/i18n/index.js"
6
+ }
package/index.js CHANGED
@@ -1 +1,5 @@
1
- "use strict";
1
+ /** @license Digigov v1.0.0-23c81d9f
2
+ *
3
+ * This source code is licensed under the BSD-2-Clause license found in the
4
+ * LICENSE file in the root directory of this source tree.
5
+ */
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
2
  import type { AppProps } from '@digigov/ui/app/App';
3
3
  import { WithTranslation } from 'react-i18next';
4
- import { i18n } from 'i18next';
4
+ import { i18n, TFunction } from 'i18next';
5
5
  export interface DigiGOVNextAppProps extends AppProps, WithTranslation {
6
6
  children?: React.ReactNode;
7
- t: (string: any) => string;
7
+ t: TFunction;
8
8
  i18n: i18n;
9
+ ssr: boolean;
9
10
  }
10
11
  declare const DigiGOVNextAppWithTranslation: React.ComponentType<import("react-i18next").Omit<DigiGOVNextAppProps & import("next/app").AppInitialProps & {
11
12
  Component: import("next").NextComponentType<import("next").NextPageContext, any, {}>;
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  email: string;
14
14
  afm: string;
15
15
  file_size: string;
16
+ image_size: string;
16
17
  mobile_phone: string;
17
18
  phone_number: string;
18
19
  landline: string;
@@ -34,6 +35,9 @@ declare const _default: {
34
35
  invalid: string;
35
36
  less_than: string;
36
37
  };
38
+ image: {
39
+ image_dimension_size: string;
40
+ };
37
41
  text: {
38
42
  more_than: string;
39
43
  less_than: string;
@@ -94,6 +98,10 @@ declare const _default: {
94
98
  change_file: string;
95
99
  no_file: string;
96
100
  reset_file: string;
101
+ image: string;
102
+ no_image: string;
103
+ change_image: string;
104
+ choose_image: string;
97
105
  };
98
106
  'copy-to-clipboard': {
99
107
  message: string;
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@digigov/nextjs",
3
- "version": "1.0.0-21c8c3dc",
3
+ "version": "1.0.0-23c81d9f",
4
4
  "description": "next specific utilities for @digigov apps",
5
5
  "author": "GRNET Developers <devs@lists.grnet.gr>",
6
6
  "license": "BSD-2-Clause",
7
7
  "main": "dist/index.js",
8
- "module": "./esm/index.js",
8
+ "module": "./index.js",
9
9
  "publishConfig": {
10
10
  "main": "dist/index.js"
11
11
  },
12
12
  "peerDependencies": {
13
- "@digigov/ui": "1.0.0-21c8c3dc",
13
+ "@digigov/ui": "1.0.0-23c81d9f",
14
14
  "@material-ui/core": "4.11.3",
15
15
  "@material-ui/icons": "4.11.2",
16
16
  "clsx": "1.1.1",
@@ -21,6 +21,14 @@
21
21
  "react-i18next": "11.3.3"
22
22
  },
23
23
  "gitHead": "7237a2d58c6b30979837579e51251543aff0c240",
24
+ "exports": {
25
+ ".": {
26
+ "require": "./index.js"
27
+ },
28
+ "./*": {
29
+ "require": "./cjs/*"
30
+ }
31
+ },
24
32
  "private": false,
25
33
  "typings": "./index.d.ts"
26
34
  }
package/src/App.tsx CHANGED
@@ -3,40 +3,21 @@ import App from 'next/app';
3
3
  import Head from 'next/head';
4
4
  import { LinkProvider } from '@digigov/ui/navigation/Link';
5
5
  import NextLink from '@digigov/nextjs/Link';
6
- import dynamic from 'next/dynamic';
6
+ import DigiGOVApp, { StaticApp } from '@digigov/ui/app/App';
7
7
  import type { AppProps } from '@digigov/ui/app/App';
8
8
  import { I18NProvider } from '@digigov/ui/i18n';
9
9
  import { withTranslation, WithTranslation } from 'react-i18next';
10
- import { i18n } from 'i18next';
10
+ import { i18n, TFunction } from 'i18next';
11
11
 
12
- const DigiGOVApp = dynamic(() => import('@digigov/ui/app/App'), {
13
- ssr: false,
14
- }) as React.FC<AppProps>;
15
12
  export interface DigiGOVNextAppProps extends AppProps, WithTranslation {
16
13
  children?: React.ReactNode;
17
- t: (string) => string;
14
+ t: TFunction;
18
15
  i18n: i18n;
16
+ ssr: boolean;
19
17
  }
20
18
  class DigiGOVNextApp extends App<DigiGOVNextAppProps> {
21
- componentDidMount(): void {
22
- // Remove the server-side injected CSS.
23
- const jssStyles = document.querySelector('#jss-server-side');
24
- if (jssStyles && jssStyles.parentElement) {
25
- jssStyles.parentElement.removeChild(jssStyles);
26
- }
27
- this.updateHtmlLang();
28
- }
29
-
30
- componentDidUpdate(): void {
31
- this.updateHtmlLang();
32
- }
33
-
34
- updateHtmlLang(): void {
35
- document.documentElement.lang = this.props.i18n.language;
36
- }
37
-
38
19
  render(): React.ReactElement {
39
- const { Component, pageProps, t, i18n } = this.props;
20
+ const { Component, pageProps, t, i18n, ssr = false } = this.props;
40
21
  return (
41
22
  <I18NProvider
42
23
  t={(str) => (typeof str === 'string' ? t(str) : str)}
@@ -49,9 +30,16 @@ class DigiGOVNextApp extends App<DigiGOVNextAppProps> {
49
30
  content="minimum-scale=1, initial-scale=1, width=device-width"
50
31
  />
51
32
  </Head>
52
- <DigiGOVApp>
53
- <Component {...pageProps} />
54
- </DigiGOVApp>
33
+ {
34
+ ssr ?
35
+ <DigiGOVApp>
36
+ <Component {...pageProps} />
37
+ </DigiGOVApp>
38
+ : <StaticApp>
39
+ <Component {...pageProps} />
40
+ </StaticApp>
41
+
42
+ }
55
43
  </LinkProvider>
56
44
  </I18NProvider>
57
45
  );
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/Document.js DELETED
@@ -1,91 +0,0 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
- import _extends from "@babel/runtime/helpers/extends";
3
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
- import _createClass from "@babel/runtime/helpers/createClass";
6
- import _inherits from "@babel/runtime/helpers/inherits";
7
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
-
10
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
11
-
12
- 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); }; }
13
-
14
- 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; } }
15
-
16
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
17
- import React from 'react';
18
- import Document, { Html, Head, Main, NextScript } from 'next/document';
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 initialProps;
69
- return _regeneratorRuntime().wrap(function _callee$(_context) {
70
- while (1) {
71
- switch (_context.prev = _context.next) {
72
- case 0:
73
- _context.next = 2;
74
- return Document.getInitialProps(ctx);
75
-
76
- case 2:
77
- initialProps = _context.sent;
78
- return _context.abrupt("return", _extends({}, initialProps));
79
-
80
- case 4:
81
- case "end":
82
- return _context.stop();
83
- }
84
- }
85
- }, _callee);
86
- }));
87
-
88
- return function (_x) {
89
- return _ref5.apply(this, arguments);
90
- };
91
- }();
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,52 +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, { useEffect } from 'react';
5
- import { useRouter } from 'next/router';
6
- import Link from 'next/link';
7
- import LinkBase from '@digigov/react-core/LinkBase';
8
-
9
- var NextLink = function NextLink(props, ref) {
10
- var href = props.href,
11
- other = _objectWithoutProperties(props, _excluded);
12
-
13
- var isExternalLink = //check if url has a file extension
14
- /^(?:[a-z]+:)?\/\/|.pdf|.docx?|.xlsx?/i.test(href || '') || // or if props has a target or rel
15
- other.target === '_blank';
16
- var router = useRouter();
17
- useEffect(function () {
18
- var path = router.asPath;
19
-
20
- if (path && path.includes('#')) {
21
- setTimeout(function () {
22
- var id = path.replace("#", "");
23
- var el = window.document.getElementById(id);
24
- var r = el === null || el === void 0 ? void 0 : el.getBoundingClientRect();
25
-
26
- if (r) {
27
- var _window$top;
28
-
29
- (_window$top = window.top) === null || _window$top === void 0 ? void 0 : _window$top.scroll({
30
- top: scrollY + r.top,
31
- behavior: "smooth"
32
- });
33
- }
34
- }, 600);
35
- }
36
- }, [router.asPath]);
37
-
38
- if (isExternalLink) {
39
- return /*#__PURE__*/React.createElement(LinkBase, _extends({
40
- ref: ref,
41
- href: href || '#'
42
- }, other), props.children);
43
- }
44
-
45
- return /*#__PURE__*/React.createElement(Link, _extends({
46
- href: href || '#'
47
- }, other), /*#__PURE__*/React.createElement(LinkBase, _extends({
48
- ref: ref
49
- }, other), props.children));
50
- };
51
-
52
- export default /*#__PURE__*/React.forwardRef(NextLink);
package/esm/hooks.js DELETED
@@ -1,5 +0,0 @@
1
- import { useRouter } from 'next/router';
2
- export function useBasePath(src) {
3
- var router = useRouter();
4
- return router.basePath + src;
5
- }
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
@@ -1,5 +0,0 @@
1
- /** @license Digigov v1.0.0-21c8c3dc
2
- *
3
- * This source code is licensed under the BSD-2-Clause license found in the
4
- * LICENSE file in the root directory of this source tree.
5
- */
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes