@digigov/nextjs 1.1.5-rc.16 → 1.1.5-rc.17

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/index.js CHANGED
@@ -1,49 +1,33 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
4
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
7
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
8
- import React from 'react';
9
- import App from 'next/app';
10
- import Head from 'next/head';
11
- import { withTranslation } from 'react-i18next';
12
- import NextLink from '@digigov/nextjs/Link';
13
- import DigiGOVApp, { StaticApp } from '@digigov/ui/app/App';
14
- import { I18NProvider } from '@digigov/ui/i18n';
15
- import { LinkProvider } from '@digigov/ui/navigation/Link';
16
- var _ref = /*#__PURE__*/React.createElement(Head, null, /*#__PURE__*/React.createElement("meta", {
17
- name: "viewport",
18
- content: "minimum-scale=1, initial-scale=1, width=device-width"
19
- }));
20
- var DigiGOVNextApp = /*#__PURE__*/function (_App) {
21
- _inherits(DigiGOVNextApp, _App);
22
- function DigiGOVNextApp() {
23
- _classCallCheck(this, DigiGOVNextApp);
24
- return _callSuper(this, DigiGOVNextApp, arguments);
1
+ import React from "react";
2
+ import App from "next/app";
3
+ import Head from "next/head";
4
+ import { withTranslation } from "react-i18next";
5
+ import NextLink from "@digigov/nextjs/Link";
6
+ import DigiGOVApp, { StaticApp } from "@digigov/ui/app/App";
7
+ import { I18NProvider } from "@digigov/ui/i18n";
8
+ import { LinkProvider } from "@digigov/ui/navigation/Link";
9
+ class DigiGOVNextApp extends App {
10
+ render() {
11
+ const { Component, pageProps, t, i18n: i18n2, ssr = false } = this.props;
12
+ return /* @__PURE__ */ React.createElement(
13
+ I18NProvider,
14
+ {
15
+ t: (str) => typeof str === "string" ? t(str) : str,
16
+ i18n: i18n2
17
+ },
18
+ /* @__PURE__ */ React.createElement(LinkProvider, { component: NextLink }, /* @__PURE__ */ React.createElement(Head, null, /* @__PURE__ */ React.createElement(
19
+ "meta",
20
+ {
21
+ name: "viewport",
22
+ content: "minimum-scale=1, initial-scale=1, width=device-width"
23
+ }
24
+ )), ssr ? /* @__PURE__ */ React.createElement(DigiGOVApp, null, /* @__PURE__ */ React.createElement(Component, { ...pageProps })) : /* @__PURE__ */ React.createElement(StaticApp, null, /* @__PURE__ */ React.createElement(Component, { ...pageProps })))
25
+ );
25
26
  }
26
- _createClass(DigiGOVNextApp, [{
27
- key: "render",
28
- value: function render() {
29
- var _this$props = this.props,
30
- Component = _this$props.Component,
31
- pageProps = _this$props.pageProps,
32
- _t = _this$props.t,
33
- i18n = _this$props.i18n,
34
- _this$props$ssr = _this$props.ssr,
35
- ssr = _this$props$ssr === void 0 ? false : _this$props$ssr;
36
- return /*#__PURE__*/React.createElement(I18NProvider, {
37
- t: function t(str) {
38
- return typeof str === 'string' ? _t(str) : str;
39
- },
40
- i18n: i18n
41
- }, /*#__PURE__*/React.createElement(LinkProvider, {
42
- component: NextLink
43
- }, _ref, ssr ? /*#__PURE__*/React.createElement(DigiGOVApp, null, /*#__PURE__*/React.createElement(Component, pageProps)) : /*#__PURE__*/React.createElement(StaticApp, null, /*#__PURE__*/React.createElement(Component, pageProps))));
44
- }
45
- }]);
46
- return DigiGOVNextApp;
47
- }(App);
48
- var DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextApp);
49
- export default DigiGOVNextAppWithTranslation;
27
+ }
28
+ const DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextApp);
29
+ var App_default = DigiGOVNextAppWithTranslation;
30
+ export {
31
+ App_default as default
32
+ };
33
+ //# sourceMappingURL=App.js.map
package/App.js.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/App.tsx"],
4
+ "sourcesContent": ["import React from 'react';\nimport { i18n, TFunction } from 'i18next';\nimport App from 'next/app';\nimport Head from 'next/head';\nimport { withTranslation, WithTranslation } from 'react-i18next';\nimport NextLink from '@digigov/nextjs/Link';\nimport DigiGOVApp, { StaticApp } from '@digigov/ui/app/App';\nimport type { AppProps } from '@digigov/ui/app/App';\nimport { I18NProvider } from '@digigov/ui/i18n';\nimport { LinkProvider } from '@digigov/ui/navigation/Link';\n\nexport interface DigiGOVNextAppProps extends AppProps, WithTranslation {\n children?: React.ReactNode;\n t: TFunction;\n i18n: i18n;\n ssr: boolean;\n}\nclass DigiGOVNextApp extends App<DigiGOVNextAppProps> {\n render(): React.ReactElement {\n const { Component, pageProps, t, i18n, ssr = false } = this.props;\n return (\n <I18NProvider\n t={(str) => (typeof str === 'string' ? t(str) : str)}\n i18n={i18n}\n >\n <LinkProvider component={NextLink}>\n <Head>\n <meta\n name=\"viewport\"\n content=\"minimum-scale=1, initial-scale=1, width=device-width\"\n />\n </Head>\n {ssr ? (\n <DigiGOVApp>\n <Component {...pageProps} />\n </DigiGOVApp>\n ) : (\n <StaticApp>\n <Component {...pageProps} />\n </StaticApp>\n )}\n </LinkProvider>\n </I18NProvider>\n );\n }\n}\nconst DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextApp);\nexport default DigiGOVNextAppWithTranslation;\n"],
5
+ "mappings": "AAAA,OAAO,WAAW;AAElB,OAAO,SAAS;AAChB,OAAO,UAAU;AACjB,SAAS,uBAAwC;AACjD,OAAO,cAAc;AACrB,OAAO,cAAc,iBAAiB;AAEtC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAQ7B,MAAM,uBAAuB,IAAyB;AAAA,EACpD,SAA6B;AAC3B,UAAM,EAAE,WAAW,WAAW,GAAG,MAAAA,OAAM,MAAM,MAAM,IAAI,KAAK;AAC5D,WACE;AAAA,MAAC;AAAA;AAAA,QACC,GAAG,CAAC,QAAS,OAAO,QAAQ,WAAW,EAAE,GAAG,IAAI;AAAA,QAChD,MAAMA;AAAA;AAAA,MAEN,oCAAC,gBAAa,WAAW,YACvB,oCAAC,YACC;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAQ;AAAA;AAAA,MACV,CACF,GACC,MACC,oCAAC,kBACC,oCAAC,aAAW,GAAG,WAAW,CAC5B,IAEA,oCAAC,iBACC,oCAAC,aAAW,GAAG,WAAW,CAC5B,CAEJ;AAAA,IACF;AAAA,EAEJ;AACF;AACA,MAAM,gCAAgC,gBAAgB,EAAE,cAAc;AACtE,IAAO,cAAQ;",
6
+ "names": ["i18n"]
7
+ }
package/Document/index.js CHANGED
@@ -1,56 +1,27 @@
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 _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _inherits from "@babel/runtime/helpers/inherits";
9
- 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 e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
10
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
13
- import React from 'react';
14
- import Document, { Html, Head, Main, NextScript } from 'next/document';
15
- var _ref = /*#__PURE__*/React.createElement("body", null, /*#__PURE__*/React.createElement(Main, null), /*#__PURE__*/React.createElement(NextScript, null));
16
- var DigiGOVDocument = /*#__PURE__*/function (_Document) {
17
- _inherits(DigiGOVDocument, _Document);
18
- function DigiGOVDocument() {
19
- _classCallCheck(this, DigiGOVDocument);
20
- return _callSuper(this, DigiGOVDocument, arguments);
21
- }
22
- _createClass(DigiGOVDocument, [{
23
- key: "render",
24
- value: function render() {
25
- return /*#__PURE__*/React.createElement(Html, null, /*#__PURE__*/React.createElement(Head, null, /*#__PURE__*/React.createElement("script", {
1
+ import React from "react";
2
+ import Document, { Html, Head, Main, NextScript } from "next/document";
3
+ class DigiGOVDocument extends Document {
4
+ render() {
5
+ return /* @__PURE__ */ React.createElement(Html, null, /* @__PURE__ */ React.createElement(Head, null, /* @__PURE__ */ React.createElement(
6
+ "script",
7
+ {
26
8
  type: "text/javascript",
27
9
  dangerouslySetInnerHTML: {
28
- __html: "if (window.document.documentMode) alert('Internet Explorer is not supported. Please use a modern browser!');\n"
10
+ __html: `if (window.document.documentMode) alert('Internet Explorer is not supported. Please use a modern browser!');
11
+ `
29
12
  }
30
- })), _ref);
31
- }
32
- }]);
33
- return DigiGOVDocument;
34
- }(Document);
35
- export { DigiGOVDocument as default };
36
- DigiGOVDocument.getInitialProps = /*#__PURE__*/function () {
37
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(ctx) {
38
- var initialProps;
39
- return _regeneratorRuntime().wrap(function _callee$(_context) {
40
- while (1) switch (_context.prev = _context.next) {
41
- case 0:
42
- _context.next = 2;
43
- return Document.getInitialProps(ctx);
44
- case 2:
45
- initialProps = _context.sent;
46
- return _context.abrupt("return", _extends({}, initialProps));
47
- case 4:
48
- case "end":
49
- return _context.stop();
50
13
  }
51
- }, _callee);
52
- }));
53
- return function (_x) {
54
- return _ref2.apply(this, arguments);
14
+ )), /* @__PURE__ */ React.createElement("body", null, /* @__PURE__ */ React.createElement(Main, null), /* @__PURE__ */ React.createElement(NextScript, null)));
15
+ }
16
+ }
17
+ DigiGOVDocument.getInitialProps = async (ctx) => {
18
+ const initialProps = await Document.getInitialProps(ctx);
19
+ return {
20
+ ...initialProps
21
+ // Styles fragment is rendered after the app and page rendering finish.
55
22
  };
56
- }();
23
+ };
24
+ export {
25
+ DigiGOVDocument as default
26
+ };
27
+ //# sourceMappingURL=Document.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/Document.tsx"],
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport React from 'react';\nimport Document, { Html, Head, Main, NextScript } from 'next/document';\n\nexport default class DigiGOVDocument extends Document {\n render() {\n return (\n <Html>\n <Head>\n <script\n type=\"text/javascript\"\n dangerouslySetInnerHTML={{\n __html: `if (window.document.documentMode) alert('Internet Explorer is not supported. Please use a modern browser!');\n`,\n }}\n ></script>\n </Head>\n <body>\n <Main />\n <NextScript />\n </body>\n </Html>\n );\n }\n}\n\nDigiGOVDocument.getInitialProps = async (ctx) => {\n // Resolution order\n //\n // On the server:\n // 1. app.getInitialProps\n // 2. page.getInitialProps\n // 3. document.getInitialProps\n // 4. app.render\n // 5. page.render\n // 6. document.render\n //\n // On the server with error:\n // 1. document.getInitialProps\n // 2. app.render\n // 3. page.render\n // 4. document.render\n //\n // On the client\n // 1. app.getInitialProps\n // 2. page.getInitialProps\n // 3. app.render\n // 4. page.render\n\n // Render app and page and get the context of the page with collected side effects.\n const initialProps = await Document.getInitialProps(ctx);\n\n return {\n ...initialProps,\n // Styles fragment is rendered after the app and page rendering finish.\n };\n};\n"],
5
+ "mappings": "AACA,OAAO,WAAW;AAClB,OAAO,YAAY,MAAM,MAAM,MAAM,kBAAkB;AAEvD,MAAO,wBAAsC,SAAS;AAAA,EACpD,SAAS;AACP,WACE,oCAAC,YACC,oCAAC,YACC;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,yBAAyB;AAAA,UACvB,QAAQ;AAAA;AAAA,QAEV;AAAA;AAAA,IACD,CACH,GACA,oCAAC,cACC,oCAAC,UAAK,GACN,oCAAC,gBAAW,CACd,CACF;AAAA,EAEJ;AACF;AAEA,gBAAgB,kBAAkB,OAAO,QAAQ;AAwB/C,QAAM,eAAe,MAAM,SAAS,gBAAgB,GAAG;AAEvD,SAAO;AAAA,IACL,GAAG;AAAA;AAAA,EAEL;AACF;",
6
+ "names": []
7
+ }
package/Image/index.js CHANGED
@@ -1,15 +1,12 @@
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
- var Image = function Image(_ref) {
8
- var src = _ref.src,
9
- rest = _objectWithoutProperties(_ref, _excluded);
10
- var basePathSrc = useBasePath(src);
11
- return /*#__PURE__*/React.createElement(NextImage, _extends({
12
- src: basePathSrc
13
- }, rest));
1
+ import React from "react";
2
+ import NextImage from "next/image";
3
+ import { useBasePath } from "@digigov/nextjs/hooks";
4
+ const Image = ({ src, ...rest }) => {
5
+ const basePathSrc = useBasePath(src);
6
+ return /* @__PURE__ */ React.createElement(NextImage, { src: basePathSrc, ...rest });
14
7
  };
15
- export default Image;
8
+ var Image_default = Image;
9
+ export {
10
+ Image_default as default
11
+ };
12
+ //# sourceMappingURL=Image.js.map
package/Image.js.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/Image.tsx"],
4
+ "sourcesContent": ["import React from 'react';\nimport NextImage, { ImageProps } from 'next/image';\nimport { useBasePath } from '@digigov/nextjs/hooks';\n\nconst Image: React.FC<ImageProps> = ({ src, ...rest }) => {\n const basePathSrc = useBasePath(src);\n return <NextImage src={basePathSrc} {...rest} />;\n};\n\nexport default Image;\n"],
5
+ "mappings": "AAAA,OAAO,WAAW;AAClB,OAAO,eAA+B;AACtC,SAAS,mBAAmB;AAE5B,MAAM,QAA8B,CAAC,EAAE,KAAK,GAAG,KAAK,MAAM;AACxD,QAAM,cAAc,YAAY,GAAG;AACnC,SAAO,oCAAC,aAAU,KAAK,aAAc,GAAG,MAAM;AAChD;AAEA,IAAO,gBAAQ;",
6
+ "names": []
7
+ }
package/Link/index.js CHANGED
@@ -1,46 +1,38 @@
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 Link from 'next/link';
6
- import { useRouter } from 'next/router';
7
- import LinkBase from '@digigov/react-core/LinkBase';
8
- var NextLink = function NextLink(props, ref) {
9
- var href = props.href,
10
- other = _objectWithoutProperties(props, _excluded);
11
- var isExternalLink =
12
- //check if url has a file extension
13
- /^(?:[a-z]+:)?\/\/|.pdf|.docx?|.xlsx?/i.test(href || '') ||
14
- // 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
- if (path && path.includes('#')) {
20
- setTimeout(function () {
21
- var id = path.replace('#', '');
22
- var el = window.document.getElementById(id);
23
- var r = el === null || el === void 0 ? void 0 : el.getBoundingClientRect();
1
+ import React, { useEffect } from "react";
2
+ import Link from "next/link";
3
+ import { useRouter } from "next/router";
4
+ import LinkBase from "@digigov/react-core/LinkBase";
5
+ const NextLink = (props, ref) => {
6
+ const { href, ...other } = props;
7
+ const isExternalLink = (
8
+ //check if url has a file extension
9
+ /^(?:[a-z]+:)?\/\/|.pdf|.docx?|.xlsx?/i.test(href || "") || // or if props has a target or rel
10
+ other.target === "_blank"
11
+ );
12
+ const router = useRouter();
13
+ useEffect(() => {
14
+ const path = router.asPath;
15
+ if (path && path.includes("#")) {
16
+ setTimeout(() => {
17
+ const id = path.replace("#", "");
18
+ const el = window.document.getElementById(id);
19
+ const r = el?.getBoundingClientRect();
24
20
  if (r) {
25
- var _window$top;
26
- (_window$top = window.top) === null || _window$top === void 0 ? void 0 : _window$top.scroll({
21
+ window.top?.scroll({
27
22
  top: scrollY + r.top,
28
- behavior: 'smooth'
23
+ behavior: "smooth"
29
24
  });
30
25
  }
31
26
  }, 600);
32
27
  }
33
28
  }, [router.asPath]);
34
29
  if (isExternalLink) {
35
- return /*#__PURE__*/React.createElement(LinkBase, _extends({
36
- ref: ref,
37
- href: href || '#'
38
- }, other), props.children);
30
+ return /* @__PURE__ */ React.createElement(LinkBase, { ref, href: href || "#", ...other }, props.children);
39
31
  }
40
- return /*#__PURE__*/React.createElement(Link, _extends({
41
- href: href || '#'
42
- }, other), /*#__PURE__*/React.createElement(LinkBase, _extends({
43
- ref: ref
44
- }, other), props.children));
32
+ return /* @__PURE__ */ React.createElement(Link, { href: href || "#", ...other }, /* @__PURE__ */ React.createElement(LinkBase, { ref, ...other }, props.children));
45
33
  };
46
- export default /*#__PURE__*/React.forwardRef(NextLink);
34
+ var Link_default = React.forwardRef(NextLink);
35
+ export {
36
+ Link_default as default
37
+ };
38
+ //# sourceMappingURL=Link.js.map
package/Link.js.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/Link.tsx"],
4
+ "sourcesContent": ["import React, { useEffect } from 'react';\nimport Link from 'next/link';\nimport { useRouter } from 'next/router';\nimport LinkBase from '@digigov/react-core/LinkBase';\nimport { LinkProps } from '@digigov/ui/navigation/Link';\n\nconst NextLink: React.ForwardRefRenderFunction<HTMLAnchorElement, LinkProps> = (\n props,\n ref\n) => {\n const { href, ...other } = props;\n const isExternalLink =\n //check if url has a file extension\n /^(?:[a-z]+:)?\\/\\/|.pdf|.docx?|.xlsx?/i.test(href || '') ||\n // or if props has a target or rel\n other.target === '_blank';\n const router = useRouter();\n\n useEffect(() => {\n const path = router.asPath;\n if (path && path.includes('#')) {\n setTimeout(() => {\n const id = path.replace('#', '');\n const el = window.document.getElementById(id);\n const r = el?.getBoundingClientRect();\n if (r) {\n window.top?.scroll({\n top: scrollY + r.top,\n behavior: 'smooth',\n });\n }\n }, 600);\n }\n }, [router.asPath]);\n\n if (isExternalLink) {\n return (\n <LinkBase ref={ref} href={href || '#'} {...other}>\n {props.children}\n </LinkBase>\n );\n }\n return (\n <Link href={href || '#'} {...other}>\n <LinkBase ref={ref} {...other}>\n {props.children}\n </LinkBase>\n </Link>\n );\n};\n\nexport default React.forwardRef(NextLink);\n"],
5
+ "mappings": "AAAA,OAAO,SAAS,iBAAiB;AACjC,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,OAAO,cAAc;AAGrB,MAAM,WAAyE,CAC7E,OACA,QACG;AACH,QAAM,EAAE,MAAM,GAAG,MAAM,IAAI;AAC3B,QAAM;AAAA;AAAA,IAEJ,wCAAwC,KAAK,QAAQ,EAAE;AAAA,IAEvD,MAAM,WAAW;AAAA;AACnB,QAAM,SAAS,UAAU;AAEzB,YAAU,MAAM;AACd,UAAM,OAAO,OAAO;AACpB,QAAI,QAAQ,KAAK,SAAS,GAAG,GAAG;AAC9B,iBAAW,MAAM;AACf,cAAM,KAAK,KAAK,QAAQ,KAAK,EAAE;AAC/B,cAAM,KAAK,OAAO,SAAS,eAAe,EAAE;AAC5C,cAAM,IAAI,IAAI,sBAAsB;AACpC,YAAI,GAAG;AACL,iBAAO,KAAK,OAAO;AAAA,YACjB,KAAK,UAAU,EAAE;AAAA,YACjB,UAAU;AAAA,UACZ,CAAC;AAAA,QACH;AAAA,MACF,GAAG,GAAG;AAAA,IACR;AAAA,EACF,GAAG,CAAC,OAAO,MAAM,CAAC;AAElB,MAAI,gBAAgB;AAClB,WACE,oCAAC,YAAS,KAAU,MAAM,QAAQ,KAAM,GAAG,SACxC,MAAM,QACT;AAAA,EAEJ;AACA,SACE,oCAAC,QAAK,MAAM,QAAQ,KAAM,GAAG,SAC3B,oCAAC,YAAS,KAAW,GAAG,SACrB,MAAM,QACT,CACF;AAEJ;AAEA,IAAO,eAAQ,MAAM,WAAW,QAAQ;",
6
+ "names": []
7
+ }
package/cjs/App/index.js CHANGED
@@ -1,59 +1,62 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var App_exports = {};
29
+ __export(App_exports, {
30
+ default: () => App_default
7
31
  });
8
- exports["default"] = void 0;
9
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
13
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
- var _react = _interopRequireDefault(require("react"));
15
- var _app = _interopRequireDefault(require("next/app"));
16
- var _head = _interopRequireDefault(require("next/head"));
17
- var _reactI18next = require("react-i18next");
18
- var _Link = _interopRequireDefault(require("@digigov/nextjs/Link"));
19
- var _App2 = _interopRequireWildcard(require("@digigov/ui/cjs/app/App"));
20
- var _i18n = require("@digigov/ui/cjs/i18n");
21
- var _Link2 = require("@digigov/ui/cjs/navigation/Link");
22
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
23
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
24
- function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
25
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
26
- var _ref = /*#__PURE__*/_react["default"].createElement(_head["default"], null, /*#__PURE__*/_react["default"].createElement("meta", {
27
- name: "viewport",
28
- content: "minimum-scale=1, initial-scale=1, width=device-width"
29
- }));
30
- var DigiGOVNextApp = /*#__PURE__*/function (_App) {
31
- (0, _inherits2["default"])(DigiGOVNextApp, _App);
32
- function DigiGOVNextApp() {
33
- (0, _classCallCheck2["default"])(this, DigiGOVNextApp);
34
- return _callSuper(this, DigiGOVNextApp, arguments);
32
+ module.exports = __toCommonJS(App_exports);
33
+ var import_react = __toESM(require("react"));
34
+ var import_app = __toESM(require("next/app"));
35
+ var import_head = __toESM(require("next/head"));
36
+ var import_react_i18next = require("react-i18next");
37
+ var import_Link = __toESM(require("@digigov/nextjs/Link"));
38
+ var import_App = __toESM(require("@digigov/ui/app/App"));
39
+ var import_i18n = require("@digigov/ui/i18n");
40
+ var import_Link2 = require("@digigov/ui/navigation/Link");
41
+ class DigiGOVNextApp extends import_app.default {
42
+ render() {
43
+ const { Component, pageProps, t, i18n: i18n2, ssr = false } = this.props;
44
+ return /* @__PURE__ */ import_react.default.createElement(
45
+ import_i18n.I18NProvider,
46
+ {
47
+ t: (str) => typeof str === "string" ? t(str) : str,
48
+ i18n: i18n2
49
+ },
50
+ /* @__PURE__ */ import_react.default.createElement(import_Link2.LinkProvider, { component: import_Link.default }, /* @__PURE__ */ import_react.default.createElement(import_head.default, null, /* @__PURE__ */ import_react.default.createElement(
51
+ "meta",
52
+ {
53
+ name: "viewport",
54
+ content: "minimum-scale=1, initial-scale=1, width=device-width"
55
+ }
56
+ )), ssr ? /* @__PURE__ */ import_react.default.createElement(import_App.default, null, /* @__PURE__ */ import_react.default.createElement(Component, { ...pageProps })) : /* @__PURE__ */ import_react.default.createElement(import_App.StaticApp, null, /* @__PURE__ */ import_react.default.createElement(Component, { ...pageProps })))
57
+ );
35
58
  }
36
- (0, _createClass2["default"])(DigiGOVNextApp, [{
37
- key: "render",
38
- value: function render() {
39
- var _this$props = this.props,
40
- Component = _this$props.Component,
41
- pageProps = _this$props.pageProps,
42
- _t = _this$props.t,
43
- i18n = _this$props.i18n,
44
- _this$props$ssr = _this$props.ssr,
45
- ssr = _this$props$ssr === void 0 ? false : _this$props$ssr;
46
- return /*#__PURE__*/_react["default"].createElement(_i18n.I18NProvider, {
47
- t: function t(str) {
48
- return typeof str === 'string' ? _t(str) : str;
49
- },
50
- i18n: i18n
51
- }, /*#__PURE__*/_react["default"].createElement(_Link2.LinkProvider, {
52
- component: _Link["default"]
53
- }, _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))));
54
- }
55
- }]);
56
- return DigiGOVNextApp;
57
- }(_app["default"]);
58
- var DigiGOVNextAppWithTranslation = (0, _reactI18next.withTranslation)()(DigiGOVNextApp);
59
- var _default = exports["default"] = DigiGOVNextAppWithTranslation;
59
+ }
60
+ const DigiGOVNextAppWithTranslation = (0, import_react_i18next.withTranslation)()(DigiGOVNextApp);
61
+ var App_default = DigiGOVNextAppWithTranslation;
62
+ //# sourceMappingURL=App.js.map
package/cjs/App.js.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/App.tsx"],
4
+ "sourcesContent": ["import React from 'react';\nimport { i18n, TFunction } from 'i18next';\nimport App from 'next/app';\nimport Head from 'next/head';\nimport { withTranslation, WithTranslation } from 'react-i18next';\nimport NextLink from '@digigov/nextjs/Link';\nimport DigiGOVApp, { StaticApp } from '@digigov/ui/app/App';\nimport type { AppProps } from '@digigov/ui/app/App';\nimport { I18NProvider } from '@digigov/ui/i18n';\nimport { LinkProvider } from '@digigov/ui/navigation/Link';\n\nexport interface DigiGOVNextAppProps extends AppProps, WithTranslation {\n children?: React.ReactNode;\n t: TFunction;\n i18n: i18n;\n ssr: boolean;\n}\nclass DigiGOVNextApp extends App<DigiGOVNextAppProps> {\n render(): React.ReactElement {\n const { Component, pageProps, t, i18n, ssr = false } = this.props;\n return (\n <I18NProvider\n t={(str) => (typeof str === 'string' ? t(str) : str)}\n i18n={i18n}\n >\n <LinkProvider component={NextLink}>\n <Head>\n <meta\n name=\"viewport\"\n content=\"minimum-scale=1, initial-scale=1, width=device-width\"\n />\n </Head>\n {ssr ? (\n <DigiGOVApp>\n <Component {...pageProps} />\n </DigiGOVApp>\n ) : (\n <StaticApp>\n <Component {...pageProps} />\n </StaticApp>\n )}\n </LinkProvider>\n </I18NProvider>\n );\n }\n}\nconst DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextApp);\nexport default DigiGOVNextAppWithTranslation;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,iBAAgB;AAChB,kBAAiB;AACjB,2BAAiD;AACjD,kBAAqB;AACrB,iBAAsC;AAEtC,kBAA6B;AAC7B,IAAAA,eAA6B;AAQ7B,MAAM,uBAAuB,WAAAC,QAAyB;AAAA,EACpD,SAA6B;AAC3B,UAAM,EAAE,WAAW,WAAW,GAAG,MAAAC,OAAM,MAAM,MAAM,IAAI,KAAK;AAC5D,WACE,6BAAAC,QAAA;AAAA,MAAC;AAAA;AAAA,QACC,GAAG,CAAC,QAAS,OAAO,QAAQ,WAAW,EAAE,GAAG,IAAI;AAAA,QAChD,MAAMD;AAAA;AAAA,MAEN,6BAAAC,QAAA,cAAC,6BAAa,WAAW,YAAAC,WACvB,6BAAAD,QAAA,cAAC,YAAAE,SAAA,MACC,6BAAAF,QAAA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAQ;AAAA;AAAA,MACV,CACF,GACC,MACC,6BAAAA,QAAA,cAAC,WAAAG,SAAA,MACC,6BAAAH,QAAA,cAAC,aAAW,GAAG,WAAW,CAC5B,IAEA,6BAAAA,QAAA,cAAC,4BACC,6BAAAA,QAAA,cAAC,aAAW,GAAG,WAAW,CAC5B,CAEJ;AAAA,IACF;AAAA,EAEJ;AACF;AACA,MAAM,oCAAgC,sCAAgB,EAAE,cAAc;AACtE,IAAO,cAAQ;",
6
+ "names": ["import_Link", "App", "i18n", "React", "NextLink", "Head", "DigiGOVApp"]
7
+ }
@@ -1,63 +1,56 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
16
- var _react = _interopRequireDefault(require("react"));
17
- var _document = _interopRequireWildcard(require("next/document"));
18
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
19
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
20
- 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 e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
21
- function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
22
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @typescript-eslint/explicit-function-return-type */
23
- var _ref = /*#__PURE__*/_react["default"].createElement("body", null, /*#__PURE__*/_react["default"].createElement(_document.Main, null), /*#__PURE__*/_react["default"].createElement(_document.NextScript, null));
24
- var DigiGOVDocument = exports["default"] = /*#__PURE__*/function (_Document) {
25
- (0, _inherits2["default"])(DigiGOVDocument, _Document);
26
- function DigiGOVDocument() {
27
- (0, _classCallCheck2["default"])(this, DigiGOVDocument);
28
- return _callSuper(this, DigiGOVDocument, arguments);
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
29
16
  }
30
- (0, _createClass2["default"])(DigiGOVDocument, [{
31
- key: "render",
32
- value: function render() {
33
- return /*#__PURE__*/_react["default"].createElement(_document.Html, null, /*#__PURE__*/_react["default"].createElement(_document.Head, null, /*#__PURE__*/_react["default"].createElement("script", {
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var Document_exports = {};
29
+ __export(Document_exports, {
30
+ default: () => DigiGOVDocument
31
+ });
32
+ module.exports = __toCommonJS(Document_exports);
33
+ var import_react = __toESM(require("react"));
34
+ var import_document = __toESM(require("next/document"));
35
+ class DigiGOVDocument extends import_document.default {
36
+ render() {
37
+ return /* @__PURE__ */ import_react.default.createElement(import_document.Html, null, /* @__PURE__ */ import_react.default.createElement(import_document.Head, null, /* @__PURE__ */ import_react.default.createElement(
38
+ "script",
39
+ {
34
40
  type: "text/javascript",
35
41
  dangerouslySetInnerHTML: {
36
- __html: "if (window.document.documentMode) alert('Internet Explorer is not supported. Please use a modern browser!');\n"
42
+ __html: `if (window.document.documentMode) alert('Internet Explorer is not supported. Please use a modern browser!');
43
+ `
37
44
  }
38
- })), _ref);
39
- }
40
- }]);
41
- return DigiGOVDocument;
42
- }(_document["default"]);
43
- DigiGOVDocument.getInitialProps = /*#__PURE__*/function () {
44
- var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(ctx) {
45
- var initialProps;
46
- return _regeneratorRuntime().wrap(function _callee$(_context) {
47
- while (1) switch (_context.prev = _context.next) {
48
- case 0:
49
- _context.next = 2;
50
- return _document["default"].getInitialProps(ctx);
51
- case 2:
52
- initialProps = _context.sent;
53
- return _context.abrupt("return", (0, _extends2["default"])({}, initialProps));
54
- case 4:
55
- case "end":
56
- return _context.stop();
57
45
  }
58
- }, _callee);
59
- }));
60
- return function (_x) {
61
- return _ref2.apply(this, arguments);
46
+ )), /* @__PURE__ */ import_react.default.createElement("body", null, /* @__PURE__ */ import_react.default.createElement(import_document.Main, null), /* @__PURE__ */ import_react.default.createElement(import_document.NextScript, null)));
47
+ }
48
+ }
49
+ DigiGOVDocument.getInitialProps = async (ctx) => {
50
+ const initialProps = await import_document.default.getInitialProps(ctx);
51
+ return {
52
+ ...initialProps
53
+ // Styles fragment is rendered after the app and page rendering finish.
62
54
  };
63
- }();
55
+ };
56
+ //# sourceMappingURL=Document.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Document.tsx"],
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport React from 'react';\nimport Document, { Html, Head, Main, NextScript } from 'next/document';\n\nexport default class DigiGOVDocument extends Document {\n render() {\n return (\n <Html>\n <Head>\n <script\n type=\"text/javascript\"\n dangerouslySetInnerHTML={{\n __html: `if (window.document.documentMode) alert('Internet Explorer is not supported. Please use a modern browser!');\n`,\n }}\n ></script>\n </Head>\n <body>\n <Main />\n <NextScript />\n </body>\n </Html>\n );\n }\n}\n\nDigiGOVDocument.getInitialProps = async (ctx) => {\n // Resolution order\n //\n // On the server:\n // 1. app.getInitialProps\n // 2. page.getInitialProps\n // 3. document.getInitialProps\n // 4. app.render\n // 5. page.render\n // 6. document.render\n //\n // On the server with error:\n // 1. document.getInitialProps\n // 2. app.render\n // 3. page.render\n // 4. document.render\n //\n // On the client\n // 1. app.getInitialProps\n // 2. page.getInitialProps\n // 3. app.render\n // 4. page.render\n\n // Render app and page and get the context of the page with collected side effects.\n const initialProps = await Document.getInitialProps(ctx);\n\n return {\n ...initialProps,\n // Styles fragment is rendered after the app and page rendering finish.\n };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,sBAAuD;AAEvD,MAAO,wBAAsC,gBAAAA,QAAS;AAAA,EACpD,SAAS;AACP,WACE,6BAAAC,QAAA,cAAC,4BACC,6BAAAA,QAAA,cAAC,4BACC,6BAAAA,QAAA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,yBAAyB;AAAA,UACvB,QAAQ;AAAA;AAAA,QAEV;AAAA;AAAA,IACD,CACH,GACA,6BAAAA,QAAA,cAAC,cACC,6BAAAA,QAAA,cAAC,0BAAK,GACN,6BAAAA,QAAA,cAAC,gCAAW,CACd,CACF;AAAA,EAEJ;AACF;AAEA,gBAAgB,kBAAkB,OAAO,QAAQ;AAwB/C,QAAM,eAAe,MAAM,gBAAAD,QAAS,gBAAgB,GAAG;AAEvD,SAAO;AAAA,IACL,GAAG;AAAA;AAAA,EAEL;AACF;",
6
+ "names": ["Document", "React"]
7
+ }
@@ -1,22 +1,41 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var Image_exports = {};
29
+ __export(Image_exports, {
30
+ default: () => Image_default
6
31
  });
7
- exports["default"] = void 0;
8
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
- var _react = _interopRequireDefault(require("react"));
11
- var _image = _interopRequireDefault(require("next/image"));
12
- var _hooks = require("@digigov/nextjs/hooks");
13
- var _excluded = ["src"];
14
- var Image = function Image(_ref) {
15
- var src = _ref.src,
16
- rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
17
- var basePathSrc = (0, _hooks.useBasePath)(src);
18
- return /*#__PURE__*/_react["default"].createElement(_image["default"], (0, _extends2["default"])({
19
- src: basePathSrc
20
- }, rest));
32
+ module.exports = __toCommonJS(Image_exports);
33
+ var import_react = __toESM(require("react"));
34
+ var import_image = __toESM(require("next/image"));
35
+ var import_hooks = require("@digigov/nextjs/hooks");
36
+ const Image = ({ src, ...rest }) => {
37
+ const basePathSrc = (0, import_hooks.useBasePath)(src);
38
+ return /* @__PURE__ */ import_react.default.createElement(import_image.default, { src: basePathSrc, ...rest });
21
39
  };
22
- var _default = exports["default"] = Image;
40
+ var Image_default = Image;
41
+ //# sourceMappingURL=Image.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Image.tsx"],
4
+ "sourcesContent": ["import React from 'react';\nimport NextImage, { ImageProps } from 'next/image';\nimport { useBasePath } from '@digigov/nextjs/hooks';\n\nconst Image: React.FC<ImageProps> = ({ src, ...rest }) => {\n const basePathSrc = useBasePath(src);\n return <NextImage src={basePathSrc} {...rest} />;\n};\n\nexport default Image;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,mBAAsC;AACtC,mBAA4B;AAE5B,MAAM,QAA8B,CAAC,EAAE,KAAK,GAAG,KAAK,MAAM;AACxD,QAAM,kBAAc,0BAAY,GAAG;AACnC,SAAO,6BAAAA,QAAA,cAAC,aAAAC,SAAA,EAAU,KAAK,aAAc,GAAG,MAAM;AAChD;AAEA,IAAO,gBAAQ;",
6
+ "names": ["React", "NextImage"]
7
+ }
package/cjs/Link/index.js CHANGED
@@ -1,56 +1,67 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var Link_exports = {};
29
+ __export(Link_exports, {
30
+ default: () => Link_default
7
31
  });
8
- exports["default"] = void 0;
9
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
- var _react = _interopRequireWildcard(require("react"));
12
- var _link = _interopRequireDefault(require("next/link"));
13
- var _router = require("next/router");
14
- var _LinkBase = _interopRequireDefault(require("@digigov/react-core/cjs/LinkBase"));
15
- var _excluded = ["href"];
16
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
17
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
18
- var NextLink = function NextLink(props, ref) {
19
- var href = props.href,
20
- other = (0, _objectWithoutProperties2["default"])(props, _excluded);
21
- var isExternalLink =
22
- //check if url has a file extension
23
- /^(?:[a-z]+:)?\/\/|.pdf|.docx?|.xlsx?/i.test(href || '') ||
24
- // or if props has a target or rel
25
- other.target === '_blank';
26
- var router = (0, _router.useRouter)();
27
- (0, _react.useEffect)(function () {
28
- var path = router.asPath;
29
- if (path && path.includes('#')) {
30
- setTimeout(function () {
31
- var id = path.replace('#', '');
32
- var el = window.document.getElementById(id);
33
- var r = el === null || el === void 0 ? void 0 : el.getBoundingClientRect();
32
+ module.exports = __toCommonJS(Link_exports);
33
+ var import_react = __toESM(require("react"));
34
+ var import_link = __toESM(require("next/link"));
35
+ var import_router = require("next/router");
36
+ var import_LinkBase = __toESM(require("@digigov/react-core/LinkBase"));
37
+ const NextLink = (props, ref) => {
38
+ const { href, ...other } = props;
39
+ const isExternalLink = (
40
+ //check if url has a file extension
41
+ /^(?:[a-z]+:)?\/\/|.pdf|.docx?|.xlsx?/i.test(href || "") || // or if props has a target or rel
42
+ other.target === "_blank"
43
+ );
44
+ const router = (0, import_router.useRouter)();
45
+ (0, import_react.useEffect)(() => {
46
+ const path = router.asPath;
47
+ if (path && path.includes("#")) {
48
+ setTimeout(() => {
49
+ const id = path.replace("#", "");
50
+ const el = window.document.getElementById(id);
51
+ const r = el?.getBoundingClientRect();
34
52
  if (r) {
35
- var _window$top;
36
- (_window$top = window.top) === null || _window$top === void 0 ? void 0 : _window$top.scroll({
53
+ window.top?.scroll({
37
54
  top: scrollY + r.top,
38
- behavior: 'smooth'
55
+ behavior: "smooth"
39
56
  });
40
57
  }
41
58
  }, 600);
42
59
  }
43
60
  }, [router.asPath]);
44
61
  if (isExternalLink) {
45
- return /*#__PURE__*/_react["default"].createElement(_LinkBase["default"], (0, _extends2["default"])({
46
- ref: ref,
47
- href: href || '#'
48
- }, other), props.children);
62
+ return /* @__PURE__ */ import_react.default.createElement(import_LinkBase.default, { ref, href: href || "#", ...other }, props.children);
49
63
  }
50
- return /*#__PURE__*/_react["default"].createElement(_link["default"], (0, _extends2["default"])({
51
- href: href || '#'
52
- }, other), /*#__PURE__*/_react["default"].createElement(_LinkBase["default"], (0, _extends2["default"])({
53
- ref: ref
54
- }, other), props.children));
64
+ return /* @__PURE__ */ import_react.default.createElement(import_link.default, { href: href || "#", ...other }, /* @__PURE__ */ import_react.default.createElement(import_LinkBase.default, { ref, ...other }, props.children));
55
65
  };
56
- var _default = exports["default"] = /*#__PURE__*/_react["default"].forwardRef(NextLink);
66
+ var Link_default = import_react.default.forwardRef(NextLink);
67
+ //# sourceMappingURL=Link.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Link.tsx"],
4
+ "sourcesContent": ["import React, { useEffect } from 'react';\nimport Link from 'next/link';\nimport { useRouter } from 'next/router';\nimport LinkBase from '@digigov/react-core/LinkBase';\nimport { LinkProps } from '@digigov/ui/navigation/Link';\n\nconst NextLink: React.ForwardRefRenderFunction<HTMLAnchorElement, LinkProps> = (\n props,\n ref\n) => {\n const { href, ...other } = props;\n const isExternalLink =\n //check if url has a file extension\n /^(?:[a-z]+:)?\\/\\/|.pdf|.docx?|.xlsx?/i.test(href || '') ||\n // or if props has a target or rel\n other.target === '_blank';\n const router = useRouter();\n\n useEffect(() => {\n const path = router.asPath;\n if (path && path.includes('#')) {\n setTimeout(() => {\n const id = path.replace('#', '');\n const el = window.document.getElementById(id);\n const r = el?.getBoundingClientRect();\n if (r) {\n window.top?.scroll({\n top: scrollY + r.top,\n behavior: 'smooth',\n });\n }\n }, 600);\n }\n }, [router.asPath]);\n\n if (isExternalLink) {\n return (\n <LinkBase ref={ref} href={href || '#'} {...other}>\n {props.children}\n </LinkBase>\n );\n }\n return (\n <Link href={href || '#'} {...other}>\n <LinkBase ref={ref} {...other}>\n {props.children}\n </LinkBase>\n </Link>\n );\n};\n\nexport default React.forwardRef(NextLink);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AACjC,kBAAiB;AACjB,oBAA0B;AAC1B,sBAAqB;AAGrB,MAAM,WAAyE,CAC7E,OACA,QACG;AACH,QAAM,EAAE,MAAM,GAAG,MAAM,IAAI;AAC3B,QAAM;AAAA;AAAA,IAEJ,wCAAwC,KAAK,QAAQ,EAAE;AAAA,IAEvD,MAAM,WAAW;AAAA;AACnB,QAAM,aAAS,yBAAU;AAEzB,8BAAU,MAAM;AACd,UAAM,OAAO,OAAO;AACpB,QAAI,QAAQ,KAAK,SAAS,GAAG,GAAG;AAC9B,iBAAW,MAAM;AACf,cAAM,KAAK,KAAK,QAAQ,KAAK,EAAE;AAC/B,cAAM,KAAK,OAAO,SAAS,eAAe,EAAE;AAC5C,cAAM,IAAI,IAAI,sBAAsB;AACpC,YAAI,GAAG;AACL,iBAAO,KAAK,OAAO;AAAA,YACjB,KAAK,UAAU,EAAE;AAAA,YACjB,UAAU;AAAA,UACZ,CAAC;AAAA,QACH;AAAA,MACF,GAAG,GAAG;AAAA,IACR;AAAA,EACF,GAAG,CAAC,OAAO,MAAM,CAAC;AAElB,MAAI,gBAAgB;AAClB,WACE,6BAAAA,QAAA,cAAC,gBAAAC,SAAA,EAAS,KAAU,MAAM,QAAQ,KAAM,GAAG,SACxC,MAAM,QACT;AAAA,EAEJ;AACA,SACE,6BAAAD,QAAA,cAAC,YAAAE,SAAA,EAAK,MAAM,QAAQ,KAAM,GAAG,SAC3B,6BAAAF,QAAA,cAAC,gBAAAC,SAAA,EAAS,KAAW,GAAG,SACrB,MAAM,QACT,CACF;AAEJ;AAEA,IAAO,eAAQ,aAAAD,QAAM,WAAW,QAAQ;",
6
+ "names": ["React", "LinkBase", "Link"]
7
+ }
@@ -1,11 +1,32 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var hooks_exports = {};
19
+ __export(hooks_exports, {
20
+ useBasePath: () => useBasePath
5
21
  });
6
- exports.useBasePath = useBasePath;
7
- var _router = require("next/router");
22
+ module.exports = __toCommonJS(hooks_exports);
23
+ var import_router = require("next/router");
8
24
  function useBasePath(src) {
9
- var router = (0, _router.useRouter)();
25
+ const router = (0, import_router.useRouter)();
10
26
  return router.basePath + src;
11
- }
27
+ }
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ useBasePath
31
+ });
32
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/hooks.ts"],
4
+ "sourcesContent": ["import { useRouter } from 'next/router';\n\nexport function useBasePath(src: string): string {\n const router = useRouter();\n return router.basePath + src;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA0B;AAEnB,SAAS,YAAY,KAAqB;AAC/C,QAAM,aAAS,yBAAU;AACzB,SAAO,OAAO,WAAW;AAC3B;",
6
+ "names": []
7
+ }
package/cjs/i18n/index.js CHANGED
@@ -1,22 +1,47 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var i18n_exports = {};
29
+ __export(i18n_exports, {
30
+ default: () => initI18n
6
31
  });
7
- exports["default"] = initI18n;
8
- var _i18next = _interopRequireDefault(require("i18next"));
9
- var _reactI18next = require("react-i18next");
10
- function initI18n(resources) {
11
- var language = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'el';
12
- return _i18next["default"].use(_reactI18next.initReactI18next) // passes i18n down to react-i18next
13
- .init({
14
- resources: resources,
32
+ module.exports = __toCommonJS(i18n_exports);
33
+ var import_i18next = __toESM(require("i18next"));
34
+ var import_react_i18next = require("react-i18next");
35
+ function initI18n(resources, language = "el") {
36
+ return import_i18next.default.use(import_react_i18next.initReactI18next).init({
37
+ resources,
15
38
  lng: language,
16
- keySeparator: '.',
39
+ keySeparator: ".",
17
40
  // we use keys in form messages.welcome
18
41
  interpolation: {
19
- escapeValue: false // react already safes from xss
42
+ escapeValue: false
43
+ // react already safes from xss
20
44
  }
21
45
  });
22
- }
46
+ }
47
+ //# sourceMappingURL=i18n.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/i18n.tsx"],
4
+ "sourcesContent": ["import i18n, { Resource, TFunction } from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\nexport default function initI18n(\n resources: Resource,\n language = 'el'\n): Promise<TFunction> {\n return i18n\n .use(initReactI18next) // passes i18n down to react-i18next\n .init({\n resources: resources,\n lng: language,\n keySeparator: '.', // we use keys in form messages.welcome\n interpolation: {\n escapeValue: false, // react already safes from xss\n },\n });\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA0C;AAC1C,2BAAiC;AAElB,SAAR,SACL,WACA,WAAW,MACS;AACpB,SAAO,eAAAA,QACJ,IAAI,qCAAgB,EACpB,KAAK;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,cAAc;AAAA;AAAA,IACd,eAAe;AAAA,MACb,aAAa;AAAA;AAAA,IACf;AAAA,EACF,CAAC;AACL;",
6
+ "names": ["i18n"]
7
+ }
package/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";
1
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
package/hooks/index.js CHANGED
@@ -1,5 +1,9 @@
1
- import { useRouter } from 'next/router';
2
- export function useBasePath(src) {
3
- var router = useRouter();
1
+ import { useRouter } from "next/router";
2
+ function useBasePath(src) {
3
+ const router = useRouter();
4
4
  return router.basePath + src;
5
- }
5
+ }
6
+ export {
7
+ useBasePath
8
+ };
9
+ //# sourceMappingURL=hooks.js.map
package/hooks.js.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/hooks.ts"],
4
+ "sourcesContent": ["import { useRouter } from 'next/router';\n\nexport function useBasePath(src: string): string {\n const router = useRouter();\n return router.basePath + src;\n}\n"],
5
+ "mappings": "AAAA,SAAS,iBAAiB;AAEnB,SAAS,YAAY,KAAqB;AAC/C,QAAM,SAAS,UAAU;AACzB,SAAO,OAAO,WAAW;AAC3B;",
6
+ "names": []
7
+ }
package/i18n/index.js CHANGED
@@ -1,15 +1,18 @@
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,
1
+ import i18n from "i18next";
2
+ import { initReactI18next } from "react-i18next";
3
+ function initI18n(resources, language = "el") {
4
+ return i18n.use(initReactI18next).init({
5
+ resources,
8
6
  lng: language,
9
- keySeparator: '.',
7
+ keySeparator: ".",
10
8
  // we use keys in form messages.welcome
11
9
  interpolation: {
12
- escapeValue: false // react already safes from xss
10
+ escapeValue: false
11
+ // react already safes from xss
13
12
  }
14
13
  });
15
- }
14
+ }
15
+ export {
16
+ initI18n as default
17
+ };
18
+ //# sourceMappingURL=i18n.js.map
package/i18n.js.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/i18n.tsx"],
4
+ "sourcesContent": ["import i18n, { Resource, TFunction } from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\nexport default function initI18n(\n resources: Resource,\n language = 'el'\n): Promise<TFunction> {\n return i18n\n .use(initReactI18next) // passes i18n down to react-i18next\n .init({\n resources: resources,\n lng: language,\n keySeparator: '.', // we use keys in form messages.welcome\n interpolation: {\n escapeValue: false, // react already safes from xss\n },\n });\n}\n"],
5
+ "mappings": "AAAA,OAAO,UAAmC;AAC1C,SAAS,wBAAwB;AAElB,SAAR,SACL,WACA,WAAW,MACS;AACpB,SAAO,KACJ,IAAI,gBAAgB,EACpB,KAAK;AAAA,IACJ;AAAA,IACA,KAAK;AAAA,IACL,cAAc;AAAA;AAAA,IACd,eAAe;AAAA,MACb,aAAa;AAAA;AAAA,IACf;AAAA,EACF,CAAC;AACL;",
6
+ "names": []
7
+ }
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
- /** @license Digigov v1.1.5-rc.16
1
+ /** @license Digigov v1.1.5-rc.17
2
2
  *
3
3
  * This source code is licensed under the BSD-2-Clause license found in the
4
4
  * LICENSE file in the root directory of this source tree.
5
5
  */
6
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@digigov/nextjs",
3
- "version": "1.1.5-rc.16",
3
+ "version": "1.1.5-rc.17",
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": "./cjs/index.js",
8
8
  "module": "./index.js",
9
9
  "peerDependencies": {
10
- "@digigov/ui": "2.0.0-rc.16",
11
- "@digigov/react-core": "2.0.0-rc.16",
10
+ "@digigov/ui": "2.0.0-rc.17",
11
+ "@digigov/react-core": "2.0.0-rc.17",
12
12
  "clsx": "1.1.1",
13
13
  "i18next": "19.1.0",
14
14
  "react": "^16.8.0 || ^17.0.0",