@digigov/nextjs 1.1.5-rc.29 → 1.1.5-rc.30

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.
Files changed (62) hide show
  1. package/App/index.js +42 -0
  2. package/App/package.json +6 -0
  3. package/App.d.ts +14 -0
  4. package/App.js.map +7 -0
  5. package/Document/index.js +27 -0
  6. package/Document/package.json +6 -0
  7. package/Document.d.ts +5 -0
  8. package/Document.js.map +7 -0
  9. package/Image/index.js +12 -0
  10. package/Image/package.json +6 -0
  11. package/Image.d.ts +4 -0
  12. package/Image.js.map +7 -0
  13. package/LICENSE +0 -0
  14. package/Link/index.js +33 -0
  15. package/Link/package.json +6 -0
  16. package/Link.d.ts +4 -0
  17. package/Link.js.map +7 -0
  18. package/cjs/App/index.js +71 -0
  19. package/cjs/App.js.map +7 -0
  20. package/cjs/Document/index.js +56 -0
  21. package/cjs/Document.js.map +7 -0
  22. package/cjs/Image/index.js +41 -0
  23. package/cjs/Image.js.map +7 -0
  24. package/cjs/Link/index.js +62 -0
  25. package/cjs/Link.js.map +7 -0
  26. package/cjs/hooks/index.js +32 -0
  27. package/cjs/hooks.js.map +7 -0
  28. package/cjs/i18n/index.js +47 -0
  29. package/cjs/i18n.js.map +7 -0
  30. package/cjs/index.js +1 -0
  31. package/cjs/index.js.map +7 -0
  32. package/hooks/index.js +9 -0
  33. package/hooks/package.json +6 -0
  34. package/hooks.d.ts +1 -0
  35. package/hooks.js.map +7 -0
  36. package/i18n/index.js +18 -0
  37. package/i18n/package.json +6 -0
  38. package/i18n.d.ts +2 -0
  39. package/i18n.js.map +7 -0
  40. package/index.d.ts +0 -0
  41. package/index.js +6 -0
  42. package/index.js.map +7 -0
  43. package/package.json +7 -22
  44. package/src/Link.tsx +14 -19
  45. package/.prettierrc.js +0 -1
  46. package/.rush/temp/chunked-rush-logs/nextjs.build.chunks.jsonl +0 -6
  47. package/.rush/temp/chunked-rush-logs/nextjs.lint.chunks.jsonl +0 -14
  48. package/.rush/temp/chunked-rush-logs/nextjs.publint.chunks.jsonl +0 -3
  49. package/.rush/temp/chunked-rush-logs/nextjs.test.chunks.jsonl +0 -2
  50. package/.rush/temp/package-deps_build.json +0 -21
  51. package/.rush/temp/package-deps_lint.json +0 -21
  52. package/.rush/temp/package-deps_publint.json +0 -21
  53. package/.rush/temp/package-deps_test.json +0 -21
  54. package/.rush/temp/shrinkwrap-deps.json +0 -14
  55. package/CHANGELOG.json +0 -1195
  56. package/eslint.config.mjs +0 -3
  57. package/nextjs.build.log +0 -9
  58. package/rush-logs/nextjs.build.log +0 -6
  59. package/rush-logs/nextjs.lint.log +0 -14
  60. package/rush-logs/nextjs.publint.log +0 -3
  61. package/rush-logs/nextjs.test.log +0 -2
  62. package/tsconfig.json +0 -44
package/App/index.js ADDED
@@ -0,0 +1,42 @@
1
+ import React from "react";
2
+ import App from "next/app";
3
+ import Head from "next/head";
4
+ import { useRouter } from "next/router";
5
+ import { withTranslation } from "react-i18next";
6
+ import NextLink from "@digigov/nextjs/Link";
7
+ import DigiGOVApp, { StaticApp } from "@digigov/ui/app/App";
8
+ import { I18NProvider } from "@digigov/ui/i18n";
9
+ import { LinkProvider } from "@digigov/ui/navigation/Link";
10
+ class DigiGOVNextAppClass extends App {
11
+ render() {
12
+ const { Component, pageProps, t, i18n: i18n2, ssr = false, router } = this.props;
13
+ const { locale } = router;
14
+ if (locale && i18n2.language != locale) {
15
+ i18n2.changeLanguage(locale);
16
+ }
17
+ return /* @__PURE__ */ React.createElement(
18
+ I18NProvider,
19
+ {
20
+ t: (str) => typeof str === "string" ? t(str) : str,
21
+ i18n: i18n2
22
+ },
23
+ /* @__PURE__ */ React.createElement(LinkProvider, { component: NextLink }, /* @__PURE__ */ React.createElement(Head, null, /* @__PURE__ */ React.createElement(
24
+ "meta",
25
+ {
26
+ name: "viewport",
27
+ content: "minimum-scale=1, initial-scale=1, width=device-width"
28
+ }
29
+ )), ssr ? /* @__PURE__ */ React.createElement(DigiGOVApp, null, /* @__PURE__ */ React.createElement(Component, { ...pageProps })) : /* @__PURE__ */ React.createElement(StaticApp, null, /* @__PURE__ */ React.createElement(Component, { ...pageProps })))
30
+ );
31
+ }
32
+ }
33
+ const DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextAppClass);
34
+ const DigiGOVNextApp = (props) => {
35
+ const router = useRouter();
36
+ return /* @__PURE__ */ React.createElement(DigiGOVNextAppWithTranslation, { ...props, router });
37
+ };
38
+ var App_default = DigiGOVNextApp;
39
+ export {
40
+ App_default as default
41
+ };
42
+ //# sourceMappingURL=App.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../cjs/App/index.js"
6
+ }
package/App.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { i18n, TFunction } from 'i18next';
3
+ import { NextRouter } from 'next/router';
4
+ import { WithTranslation } from 'react-i18next';
5
+ import type { AppProps } from '@digigov/ui/app/App';
6
+ export interface DigiGOVNextAppProps extends AppProps, WithTranslation {
7
+ children?: React.ReactNode;
8
+ t: TFunction;
9
+ i18n: i18n;
10
+ ssr: boolean;
11
+ router: NextRouter;
12
+ }
13
+ declare const DigiGOVNextApp: (props: any) => React.JSX.Element;
14
+ export default DigiGOVNextApp;
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 { NextRouter, useRouter } from 'next/router';\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 router: NextRouter;\n}\nclass DigiGOVNextAppClass extends App<DigiGOVNextAppProps> {\n render(): React.ReactElement {\n const { Component, pageProps, t, i18n, ssr = false, router } = this.props;\n const { locale } = router;\n\n if (locale && i18n.language != locale) {\n i18n.changeLanguage(locale);\n }\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}\n\nconst DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextAppClass);\nconst DigiGOVNextApp = (props) => {\n const router = useRouter();\n return <DigiGOVNextAppWithTranslation {...props} router={router} />;\n};\nexport default DigiGOVNextApp;\n"],
5
+ "mappings": "AAAA,OAAO,WAAW;AAElB,OAAO,SAAS;AAChB,OAAO,UAAU;AACjB,SAAqB,iBAAiB;AACtC,SAAS,uBAAwC;AACjD,OAAO,cAAc;AACrB,OAAO,cAAc,iBAAiB;AAEtC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAS7B,MAAM,4BAA4B,IAAyB;AAAA,EACzD,SAA6B;AAC3B,UAAM,EAAE,WAAW,WAAW,GAAG,MAAAA,OAAM,MAAM,OAAO,OAAO,IAAI,KAAK;AACpE,UAAM,EAAE,OAAO,IAAI;AAEnB,QAAI,UAAUA,MAAK,YAAY,QAAQ;AACrC,MAAAA,MAAK,eAAe,MAAM;AAAA,IAC5B;AACA,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;AAEA,MAAM,gCAAgC,gBAAgB,EAAE,mBAAmB;AAC3E,MAAM,iBAAiB,CAAC,UAAU;AAChC,QAAM,SAAS,UAAU;AACzB,SAAO,oCAAC,iCAA+B,GAAG,OAAO,QAAgB;AACnE;AACA,IAAO,cAAQ;",
6
+ "names": ["i18n"]
7
+ }
@@ -0,0 +1,27 @@
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
+ {
8
+ type: "text/javascript",
9
+ dangerouslySetInnerHTML: {
10
+ __html: `if (window.document.documentMode) alert('Internet Explorer is not supported. Please use a modern browser!');
11
+ `
12
+ }
13
+ }
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.
22
+ };
23
+ };
24
+ export {
25
+ DigiGOVDocument as default
26
+ };
27
+ //# sourceMappingURL=Document.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../cjs/Document/index.js"
6
+ }
package/Document.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import Document from 'next/document';
3
+ export default class DigiGOVDocument extends Document {
4
+ render(): React.JSX.Element;
5
+ }
@@ -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 ADDED
@@ -0,0 +1,12 @@
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(typeof src === "string" ? src : "");
6
+ return /* @__PURE__ */ React.createElement(NextImage, { src: typeof src === "string" ? basePathSrc : src, ...rest });
7
+ };
8
+ var Image_default = Image;
9
+ export {
10
+ Image_default as default
11
+ };
12
+ //# sourceMappingURL=Image.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../cjs/Image/index.js"
6
+ }
package/Image.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ImageProps } from 'next/image';
3
+ declare const Image: React.FC<ImageProps>;
4
+ export default Image;
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(typeof src === 'string' ? src : '');\n return (\n <NextImage src={typeof src === 'string' ? basePathSrc : src} {...rest} />\n );\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,OAAO,QAAQ,WAAW,MAAM,EAAE;AAClE,SACE,oCAAC,aAAU,KAAK,OAAO,QAAQ,WAAW,cAAc,KAAM,GAAG,MAAM;AAE3E;AAEA,IAAO,gBAAQ;",
6
+ "names": []
7
+ }
package/LICENSE ADDED
File without changes
package/Link/index.js ADDED
@@ -0,0 +1,33 @@
1
+ import React, { useEffect } from "react";
2
+ import NextRouterLink from "next/link";
3
+ import { useRouter } from "next/router";
4
+ import { Link } from "@digigov/ui/navigation/Link";
5
+ const NextLink = (props, ref) => {
6
+ const { href, as, ...other } = props;
7
+ const isExternalLink = /^(?:[a-z]+:)?\/\/|\.pdf|\.docx?|\.xlsx?|^mailto:/i.test(href || "") || other.target === "_blank";
8
+ const router = useRouter();
9
+ useEffect(() => {
10
+ const path = router.asPath;
11
+ if (path.includes("#")) {
12
+ setTimeout(() => {
13
+ const id = path.replace("#", "");
14
+ const el = document.getElementById(id);
15
+ if (el) {
16
+ window.scroll({
17
+ top: scrollY + el.getBoundingClientRect().top,
18
+ behavior: "smooth"
19
+ });
20
+ }
21
+ }, 600);
22
+ }
23
+ }, [router.asPath]);
24
+ if (isExternalLink) {
25
+ return /* @__PURE__ */ React.createElement(Link, { ref, href: href || "#", ...other }, props.children);
26
+ }
27
+ return /* @__PURE__ */ React.createElement(NextRouterLink, { href: href || "#", as: void 0, ...other }, /* @__PURE__ */ React.createElement(Link, { ref, ...other, as }, props.children));
28
+ };
29
+ var Link_default = React.forwardRef(NextLink);
30
+ export {
31
+ Link_default as default
32
+ };
33
+ //# sourceMappingURL=Link.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../cjs/Link/index.js"
6
+ }
package/Link.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { LinkProps } from '@digigov/ui/navigation/Link';
3
+ declare const _default: React.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
4
+ export default _default;
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 NextRouterLink from 'next/link';\nimport { useRouter } from 'next/router';\nimport { Link, LinkProps } from '@digigov/ui/navigation/Link';\n\nconst NextLink: React.ForwardRefRenderFunction<HTMLAnchorElement, LinkProps> = (\n props,\n ref\n) => {\n const { href, as, ...other } = props;\n const isExternalLink =\n /^(?:[a-z]+:)?\\/\\/|\\.pdf|\\.docx?|\\.xlsx?|^mailto:/i.test(href || '') ||\n other.target === '_blank';\n\n const router = useRouter();\n\n useEffect(() => {\n const path = router.asPath;\n if (path.includes('#')) {\n setTimeout(() => {\n const id = path.replace('#', '');\n const el = document.getElementById(id);\n if (el) {\n window.scroll({\n top: scrollY + el.getBoundingClientRect().top,\n behavior: 'smooth',\n });\n }\n }, 600);\n }\n }, [router.asPath]);\n\n if (isExternalLink) {\n return (\n <Link ref={ref} href={href || '#'} {...other}>\n {props.children}\n </Link>\n );\n }\n\n return (\n <NextRouterLink href={href || '#'} as={undefined} {...other}>\n <Link ref={ref} {...other} as={as}>\n {props.children}\n </Link>\n </NextRouterLink>\n );\n};\n\nexport default React.forwardRef(NextLink);\n"],
5
+ "mappings": "AAAA,OAAO,SAAS,iBAAiB;AACjC,OAAO,oBAAoB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,YAAuB;AAEhC,MAAM,WAAyE,CAC7E,OACA,QACG;AACH,QAAM,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;AAC/B,QAAM,iBACJ,oDAAoD,KAAK,QAAQ,EAAE,KACnE,MAAM,WAAW;AAEnB,QAAM,SAAS,UAAU;AAEzB,YAAU,MAAM;AACd,UAAM,OAAO,OAAO;AACpB,QAAI,KAAK,SAAS,GAAG,GAAG;AACtB,iBAAW,MAAM;AACf,cAAM,KAAK,KAAK,QAAQ,KAAK,EAAE;AAC/B,cAAM,KAAK,SAAS,eAAe,EAAE;AACrC,YAAI,IAAI;AACN,iBAAO,OAAO;AAAA,YACZ,KAAK,UAAU,GAAG,sBAAsB,EAAE;AAAA,YAC1C,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,QAAK,KAAU,MAAM,QAAQ,KAAM,GAAG,SACpC,MAAM,QACT;AAAA,EAEJ;AAEA,SACE,oCAAC,kBAAe,MAAM,QAAQ,KAAK,IAAI,QAAY,GAAG,SACpD,oCAAC,QAAK,KAAW,GAAG,OAAO,MACxB,MAAM,QACT,CACF;AAEJ;AAEA,IAAO,eAAQ,MAAM,WAAW,QAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,71 @@
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
31
+ });
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_router = require("next/router");
37
+ var import_react_i18next = require("react-i18next");
38
+ var import_Link = __toESM(require("@digigov/nextjs/Link"));
39
+ var import_App = __toESM(require("@digigov/ui/app/App"));
40
+ var import_i18n = require("@digigov/ui/i18n");
41
+ var import_Link2 = require("@digigov/ui/navigation/Link");
42
+ class DigiGOVNextAppClass extends import_app.default {
43
+ render() {
44
+ const { Component, pageProps, t, i18n: i18n2, ssr = false, router } = this.props;
45
+ const { locale } = router;
46
+ if (locale && i18n2.language != locale) {
47
+ i18n2.changeLanguage(locale);
48
+ }
49
+ return /* @__PURE__ */ import_react.default.createElement(
50
+ import_i18n.I18NProvider,
51
+ {
52
+ t: (str) => typeof str === "string" ? t(str) : str,
53
+ i18n: i18n2
54
+ },
55
+ /* @__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(
56
+ "meta",
57
+ {
58
+ name: "viewport",
59
+ content: "minimum-scale=1, initial-scale=1, width=device-width"
60
+ }
61
+ )), 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 })))
62
+ );
63
+ }
64
+ }
65
+ const DigiGOVNextAppWithTranslation = (0, import_react_i18next.withTranslation)()(DigiGOVNextAppClass);
66
+ const DigiGOVNextApp = (props) => {
67
+ const router = (0, import_router.useRouter)();
68
+ return /* @__PURE__ */ import_react.default.createElement(DigiGOVNextAppWithTranslation, { ...props, router });
69
+ };
70
+ var App_default = DigiGOVNextApp;
71
+ //# 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 { NextRouter, useRouter } from 'next/router';\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 router: NextRouter;\n}\nclass DigiGOVNextAppClass extends App<DigiGOVNextAppProps> {\n render(): React.ReactElement {\n const { Component, pageProps, t, i18n, ssr = false, router } = this.props;\n const { locale } = router;\n\n if (locale && i18n.language != locale) {\n i18n.changeLanguage(locale);\n }\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}\n\nconst DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextAppClass);\nconst DigiGOVNextApp = (props) => {\n const router = useRouter();\n return <DigiGOVNextAppWithTranslation {...props} router={router} />;\n};\nexport default DigiGOVNextApp;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,iBAAgB;AAChB,kBAAiB;AACjB,oBAAsC;AACtC,2BAAiD;AACjD,kBAAqB;AACrB,iBAAsC;AAEtC,kBAA6B;AAC7B,IAAAA,eAA6B;AAS7B,MAAM,4BAA4B,WAAAC,QAAyB;AAAA,EACzD,SAA6B;AAC3B,UAAM,EAAE,WAAW,WAAW,GAAG,MAAAC,OAAM,MAAM,OAAO,OAAO,IAAI,KAAK;AACpE,UAAM,EAAE,OAAO,IAAI;AAEnB,QAAI,UAAUA,MAAK,YAAY,QAAQ;AACrC,MAAAA,MAAK,eAAe,MAAM;AAAA,IAC5B;AACA,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;AAEA,MAAM,oCAAgC,sCAAgB,EAAE,mBAAmB;AAC3E,MAAM,iBAAiB,CAAC,UAAU;AAChC,QAAM,aAAS,yBAAU;AACzB,SAAO,6BAAAA,QAAA,cAAC,iCAA+B,GAAG,OAAO,QAAgB;AACnE;AACA,IAAO,cAAQ;",
6
+ "names": ["import_Link", "App", "i18n", "React", "NextLink", "Head", "DigiGOVApp"]
7
+ }
@@ -0,0 +1,56 @@
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 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
+ {
40
+ type: "text/javascript",
41
+ dangerouslySetInnerHTML: {
42
+ __html: `if (window.document.documentMode) alert('Internet Explorer is not supported. Please use a modern browser!');
43
+ `
44
+ }
45
+ }
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.
54
+ };
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
+ }
@@ -0,0 +1,41 @@
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
31
+ });
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)(typeof src === "string" ? src : "");
38
+ return /* @__PURE__ */ import_react.default.createElement(import_image.default, { src: typeof src === "string" ? basePathSrc : src, ...rest });
39
+ };
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(typeof src === 'string' ? src : '');\n return (\n <NextImage src={typeof src === 'string' ? basePathSrc : src} {...rest} />\n );\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,OAAO,QAAQ,WAAW,MAAM,EAAE;AAClE,SACE,6BAAAA,QAAA,cAAC,aAAAC,SAAA,EAAU,KAAK,OAAO,QAAQ,WAAW,cAAc,KAAM,GAAG,MAAM;AAE3E;AAEA,IAAO,gBAAQ;",
6
+ "names": ["React", "NextImage"]
7
+ }
@@ -0,0 +1,62 @@
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
31
+ });
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_Link = require("@digigov/ui/navigation/Link");
37
+ const NextLink = (props, ref) => {
38
+ const { href, as, ...other } = props;
39
+ const isExternalLink = /^(?:[a-z]+:)?\/\/|\.pdf|\.docx?|\.xlsx?|^mailto:/i.test(href || "") || other.target === "_blank";
40
+ const router = (0, import_router.useRouter)();
41
+ (0, import_react.useEffect)(() => {
42
+ const path = router.asPath;
43
+ if (path.includes("#")) {
44
+ setTimeout(() => {
45
+ const id = path.replace("#", "");
46
+ const el = document.getElementById(id);
47
+ if (el) {
48
+ window.scroll({
49
+ top: scrollY + el.getBoundingClientRect().top,
50
+ behavior: "smooth"
51
+ });
52
+ }
53
+ }, 600);
54
+ }
55
+ }, [router.asPath]);
56
+ if (isExternalLink) {
57
+ return /* @__PURE__ */ import_react.default.createElement(import_Link.Link, { ref, href: href || "#", ...other }, props.children);
58
+ }
59
+ return /* @__PURE__ */ import_react.default.createElement(import_link.default, { href: href || "#", as: void 0, ...other }, /* @__PURE__ */ import_react.default.createElement(import_Link.Link, { ref, ...other, as }, props.children));
60
+ };
61
+ var Link_default = import_react.default.forwardRef(NextLink);
62
+ //# 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 NextRouterLink from 'next/link';\nimport { useRouter } from 'next/router';\nimport { Link, LinkProps } from '@digigov/ui/navigation/Link';\n\nconst NextLink: React.ForwardRefRenderFunction<HTMLAnchorElement, LinkProps> = (\n props,\n ref\n) => {\n const { href, as, ...other } = props;\n const isExternalLink =\n /^(?:[a-z]+:)?\\/\\/|\\.pdf|\\.docx?|\\.xlsx?|^mailto:/i.test(href || '') ||\n other.target === '_blank';\n\n const router = useRouter();\n\n useEffect(() => {\n const path = router.asPath;\n if (path.includes('#')) {\n setTimeout(() => {\n const id = path.replace('#', '');\n const el = document.getElementById(id);\n if (el) {\n window.scroll({\n top: scrollY + el.getBoundingClientRect().top,\n behavior: 'smooth',\n });\n }\n }, 600);\n }\n }, [router.asPath]);\n\n if (isExternalLink) {\n return (\n <Link ref={ref} href={href || '#'} {...other}>\n {props.children}\n </Link>\n );\n }\n\n return (\n <NextRouterLink href={href || '#'} as={undefined} {...other}>\n <Link ref={ref} {...other} as={as}>\n {props.children}\n </Link>\n </NextRouterLink>\n );\n};\n\nexport default React.forwardRef(NextLink);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AACjC,kBAA2B;AAC3B,oBAA0B;AAC1B,kBAAgC;AAEhC,MAAM,WAAyE,CAC7E,OACA,QACG;AACH,QAAM,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;AAC/B,QAAM,iBACJ,oDAAoD,KAAK,QAAQ,EAAE,KACnE,MAAM,WAAW;AAEnB,QAAM,aAAS,yBAAU;AAEzB,8BAAU,MAAM;AACd,UAAM,OAAO,OAAO;AACpB,QAAI,KAAK,SAAS,GAAG,GAAG;AACtB,iBAAW,MAAM;AACf,cAAM,KAAK,KAAK,QAAQ,KAAK,EAAE;AAC/B,cAAM,KAAK,SAAS,eAAe,EAAE;AACrC,YAAI,IAAI;AACN,iBAAO,OAAO;AAAA,YACZ,KAAK,UAAU,GAAG,sBAAsB,EAAE;AAAA,YAC1C,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,oBAAK,KAAU,MAAM,QAAQ,KAAM,GAAG,SACpC,MAAM,QACT;AAAA,EAEJ;AAEA,SACE,6BAAAA,QAAA,cAAC,YAAAC,SAAA,EAAe,MAAM,QAAQ,KAAK,IAAI,QAAY,GAAG,SACpD,6BAAAD,QAAA,cAAC,oBAAK,KAAW,GAAG,OAAO,MACxB,MAAM,QACT,CACF;AAEJ;AAEA,IAAO,eAAQ,aAAAA,QAAM,WAAW,QAAQ;",
6
+ "names": ["React", "NextRouterLink"]
7
+ }
@@ -0,0 +1,32 @@
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
21
+ });
22
+ module.exports = __toCommonJS(hooks_exports);
23
+ var import_router = require("next/router");
24
+ function useBasePath(src) {
25
+ const router = (0, import_router.useRouter)();
26
+ return router.basePath + src;
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
+ }
@@ -0,0 +1,47 @@
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
31
+ });
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,
38
+ lng: language,
39
+ keySeparator: ".",
40
+ // we use keys in form messages.welcome
41
+ interpolation: {
42
+ escapeValue: false
43
+ // react already safes from xss
44
+ }
45
+ });
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 ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }