@digigov/nextjs 1.1.9 → 1.2.0-rc.31

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,12 +1,12 @@
1
1
  import React from "react";
2
2
  import App from "next/app";
3
3
  import Head from "next/head";
4
+ import { useRouter } from "next/router";
4
5
  import { withTranslation } from "react-i18next";
5
6
  import NextLink from "@digigov/nextjs/Link";
6
7
  import DigiGOVApp, { StaticApp } from "@digigov/ui/app/App";
7
8
  import { I18NProvider } from "@digigov/ui/i18n";
8
9
  import { LinkProvider } from "@digigov/ui/navigation/Link";
9
- import { useRouter } from "next/router";
10
10
  class DigiGOVNextAppClass extends App {
11
11
  render() {
12
12
  const { Component, pageProps, t, i18n: i18n2, ssr = false, router } = this.props;
package/App.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { i18n, TFunction } from 'i18next';
3
+ import { NextRouter } from 'next/router';
3
4
  import { WithTranslation } from 'react-i18next';
4
5
  import type { AppProps } from '@digigov/ui/app/App';
5
- import { NextRouter } from 'next/router';
6
6
  export interface DigiGOVNextAppProps extends AppProps, WithTranslation {
7
7
  children?: React.ReactNode;
8
8
  t: TFunction;
package/App.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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';\nimport { NextRouter, useRouter } from 'next/router';\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,SAAS,uBAAwC;AACjD,OAAO,cAAc;AACrB,OAAO,cAAc,iBAAiB;AAEtC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAqB,iBAAiB;AAStC,MAAM,4BAA4B,IAAyB;AAAA,EACzD,SAA6B;AAC3B,UAAM,EAAE,WAAW,WAAW,GAAG,MAAAA,OAAM,MAAM,OAAO,OAAO,IAAI,KAAK;AACpE,UAAM,EAAC,OAAM,IAAI;AAEjB,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;",
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
6
  "names": ["i18n"]
7
7
  }
package/Link/index.js CHANGED
@@ -1,25 +1,20 @@
1
1
  import React, { useEffect } from "react";
2
- import Link from "next/link";
2
+ import NextRouterLink from "next/link";
3
3
  import { useRouter } from "next/router";
4
- import { LinkBase } from "@digigov/ui/navigation/Link";
4
+ import { Link } from "@digigov/ui/navigation/Link";
5
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
- );
6
+ const { href, as, ...other } = props;
7
+ const isExternalLink = /^(?:[a-z]+:)?\/\/|\.pdf|\.docx?|\.xlsx?|^mailto:/i.test(href || "") || other.target === "_blank";
12
8
  const router = useRouter();
13
9
  useEffect(() => {
14
10
  const path = router.asPath;
15
- if (path && path.includes("#")) {
11
+ if (path.includes("#")) {
16
12
  setTimeout(() => {
17
13
  const id = path.replace("#", "");
18
- const el = window.document.getElementById(id);
19
- const r = el?.getBoundingClientRect();
20
- if (r) {
21
- window.top?.scroll({
22
- top: scrollY + r.top,
14
+ const el = document.getElementById(id);
15
+ if (el) {
16
+ window.scroll({
17
+ top: scrollY + el.getBoundingClientRect().top,
23
18
  behavior: "smooth"
24
19
  });
25
20
  }
@@ -27,12 +22,9 @@ const NextLink = (props, ref) => {
27
22
  }
28
23
  }, [router.asPath]);
29
24
  if (isExternalLink) {
30
- return /* @__PURE__ */ React.createElement(LinkBase, { ref, href: href || "#", ...other }, props.children);
25
+ return /* @__PURE__ */ React.createElement(Link, { ref, href: href || "#", ...other }, props.children);
31
26
  }
32
- return (
33
- //@ts-ignore
34
- /* @__PURE__ */ React.createElement(LinkBase, { as: Link, href, ref, ...other }, props.children)
35
- );
27
+ return /* @__PURE__ */ React.createElement(NextRouterLink, { href: href || "#", as: void 0, ...other }, /* @__PURE__ */ React.createElement(Link, { ref, ...other, as }, props.children));
36
28
  };
37
29
  var Link_default = React.forwardRef(NextLink);
38
30
  export {
package/Link.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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/ui/navigation/Link';\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 //@ts-ignore\n <LinkBase as={Link} href={href} ref={ref} {...other}>\n {props.children}\n </LinkBase>\n );\n};\n\nexport default React.forwardRef(NextLink);\n"],
5
- "mappings": "AAAA,OAAO,SAAS,iBAAiB;AACjC,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAQ,gBAAe;AAGvB,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;AAAA;AAAA,IAEE,oCAAC,YAAS,IAAI,MAAM,MAAY,KAAW,GAAG,SAC3C,MAAM,QACT;AAAA;AAEJ;AAEA,IAAO,eAAQ,MAAM,WAAW,QAAQ;",
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
6
  "names": []
7
7
  }
package/cjs/App/index.js CHANGED
@@ -33,12 +33,12 @@ module.exports = __toCommonJS(App_exports);
33
33
  var import_react = __toESM(require("react"));
34
34
  var import_app = __toESM(require("next/app"));
35
35
  var import_head = __toESM(require("next/head"));
36
+ var import_router = require("next/router");
36
37
  var import_react_i18next = require("react-i18next");
37
38
  var import_Link = __toESM(require("@digigov/nextjs/Link"));
38
39
  var import_App = __toESM(require("@digigov/ui/app/App"));
39
40
  var import_i18n = require("@digigov/ui/i18n");
40
41
  var import_Link2 = require("@digigov/ui/navigation/Link");
41
- var import_router = require("next/router");
42
42
  class DigiGOVNextAppClass extends import_app.default {
43
43
  render() {
44
44
  const { Component, pageProps, t, i18n: i18n2, ssr = false, router } = this.props;
package/cjs/App.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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';\nimport { NextRouter, useRouter } from 'next/router';\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,2BAAiD;AACjD,kBAAqB;AACrB,iBAAsC;AAEtC,kBAA6B;AAC7B,IAAAA,eAA6B;AAC7B,oBAAsC;AAStC,MAAM,4BAA4B,WAAAC,QAAyB;AAAA,EACzD,SAA6B;AAC3B,UAAM,EAAE,WAAW,WAAW,GAAG,MAAAC,OAAM,MAAM,OAAO,OAAO,IAAI,KAAK;AACpE,UAAM,EAAC,OAAM,IAAI;AAEjB,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;",
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
6
  "names": ["import_Link", "App", "i18n", "React", "NextLink", "Head", "DigiGOVApp"]
7
7
  }
package/cjs/Link/index.js CHANGED
@@ -35,23 +35,18 @@ var import_link = __toESM(require("next/link"));
35
35
  var import_router = require("next/router");
36
36
  var import_Link = require("@digigov/ui/navigation/Link");
37
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
- );
38
+ const { href, as, ...other } = props;
39
+ const isExternalLink = /^(?:[a-z]+:)?\/\/|\.pdf|\.docx?|\.xlsx?|^mailto:/i.test(href || "") || other.target === "_blank";
44
40
  const router = (0, import_router.useRouter)();
45
41
  (0, import_react.useEffect)(() => {
46
42
  const path = router.asPath;
47
- if (path && path.includes("#")) {
43
+ if (path.includes("#")) {
48
44
  setTimeout(() => {
49
45
  const id = path.replace("#", "");
50
- const el = window.document.getElementById(id);
51
- const r = el?.getBoundingClientRect();
52
- if (r) {
53
- window.top?.scroll({
54
- top: scrollY + r.top,
46
+ const el = document.getElementById(id);
47
+ if (el) {
48
+ window.scroll({
49
+ top: scrollY + el.getBoundingClientRect().top,
55
50
  behavior: "smooth"
56
51
  });
57
52
  }
@@ -59,12 +54,9 @@ const NextLink = (props, ref) => {
59
54
  }
60
55
  }, [router.asPath]);
61
56
  if (isExternalLink) {
62
- return /* @__PURE__ */ import_react.default.createElement(import_Link.LinkBase, { ref, href: href || "#", ...other }, props.children);
57
+ return /* @__PURE__ */ import_react.default.createElement(import_Link.Link, { ref, href: href || "#", ...other }, props.children);
63
58
  }
64
- return (
65
- //@ts-ignore
66
- /* @__PURE__ */ import_react.default.createElement(import_Link.LinkBase, { as: import_link.default, href, ref, ...other }, props.children)
67
- );
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));
68
60
  };
69
61
  var Link_default = import_react.default.forwardRef(NextLink);
70
62
  //# sourceMappingURL=Link.js.map
package/cjs/Link.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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/ui/navigation/Link';\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 //@ts-ignore\n <LinkBase as={Link} href={href} ref={ref} {...other}>\n {props.children}\n </LinkBase>\n );\n};\n\nexport default React.forwardRef(NextLink);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AACjC,kBAAiB;AACjB,oBAA0B;AAC1B,kBAAuB;AAGvB,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,wBAAS,KAAU,MAAM,QAAQ,KAAM,GAAG,SACxC,MAAM,QACT;AAAA,EAEJ;AACA;AAAA;AAAA,IAEE,6BAAAA,QAAA,cAAC,wBAAS,IAAI,YAAAC,SAAM,MAAY,KAAW,GAAG,SAC3C,MAAM,QACT;AAAA;AAEJ;AAEA,IAAO,eAAQ,aAAAD,QAAM,WAAW,QAAQ;",
6
- "names": ["React", "Link"]
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
7
  }
package/cjs/index.js CHANGED
@@ -1,32 +1 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var src_exports = {};
16
- module.exports = __toCommonJS(src_exports);
17
- __reExport(src_exports, require("@digigov/nextjs/App"), module.exports);
18
- __reExport(src_exports, require("@digigov/nextjs/Document"), module.exports);
19
- __reExport(src_exports, require("@digigov/nextjs/hooks"), module.exports);
20
- __reExport(src_exports, require("@digigov/nextjs/i18n"), module.exports);
21
- __reExport(src_exports, require("@digigov/nextjs/Image"), module.exports);
22
- __reExport(src_exports, require("@digigov/nextjs/Link"), module.exports);
23
- // Annotate the CommonJS export names for ESM import in node:
24
- 0 && (module.exports = {
25
- ...require("@digigov/nextjs/App"),
26
- ...require("@digigov/nextjs/Document"),
27
- ...require("@digigov/nextjs/hooks"),
28
- ...require("@digigov/nextjs/i18n"),
29
- ...require("@digigov/nextjs/Image"),
30
- ...require("@digigov/nextjs/Link")
31
- });
32
1
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["export * from \"@digigov/nextjs/App\";\nexport * from \"@digigov/nextjs/Document\";\nexport * from \"@digigov/nextjs/hooks\";\nexport * from \"@digigov/nextjs/i18n\";\nexport * from \"@digigov/nextjs/Image\";\nexport * from \"@digigov/nextjs/Link\";"],
5
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,gCAAd;AACA,wBAAc,qCADd;AAEA,wBAAc,kCAFd;AAGA,wBAAc,iCAHd;AAIA,wBAAc,kCAJd;AAKA,wBAAc,iCALd;",
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
6
  "names": []
7
7
  }
package/index.d.ts CHANGED
@@ -1,6 +0,0 @@
1
- export * from "@digigov/nextjs/App";
2
- export * from "@digigov/nextjs/Document";
3
- export * from "@digigov/nextjs/hooks";
4
- export * from "@digigov/nextjs/i18n";
5
- export * from "@digigov/nextjs/Image";
6
- export * from "@digigov/nextjs/Link";
package/index.js CHANGED
@@ -1,12 +1,6 @@
1
- /** @license Digigov v1.1.4
1
+ /** @license Digigov v1.2.0-rc.31
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
- export * from "@digigov/nextjs/App";
7
- export * from "@digigov/nextjs/Document";
8
- export * from "@digigov/nextjs/hooks";
9
- export * from "@digigov/nextjs/i18n";
10
- export * from "@digigov/nextjs/Image";
11
- export * from "@digigov/nextjs/Link";
12
6
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/index.ts"],
4
- "sourcesContent": ["export * from \"@digigov/nextjs/App\";\nexport * from \"@digigov/nextjs/Document\";\nexport * from \"@digigov/nextjs/hooks\";\nexport * from \"@digigov/nextjs/i18n\";\nexport * from \"@digigov/nextjs/Image\";\nexport * from \"@digigov/nextjs/Link\";"],
5
- "mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,22 +1,30 @@
1
1
  {
2
2
  "name": "@digigov/nextjs",
3
- "version": "1.1.9",
3
+ "version": "1.2.0-rc.31",
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": "workspace:*",
11
- "@digigov/react-core": "workspace:*",
10
+ "@digigov/ui": "2.0.0-rc.31",
11
+ "@digigov/react-core": "2.0.0-rc.31",
12
12
  "clsx": "1.1.1",
13
13
  "i18next": "19.1.0",
14
- "react": ">=16.8.0 <19.0.0",
15
- "react-dom": ">=16.8.0 <19.0.0",
14
+ "react": "^18.3.0 || ^19.1.0",
15
+ "react-dom": "^18.3.0 || ^19.1.0",
16
16
  "next": "13.1.1",
17
17
  "react-i18next": "11.3.3"
18
18
  },
19
19
  "gitHead": "7237a2d58c6b30979837579e51251543aff0c240",
20
+ "exports": {
21
+ ".": {
22
+ "require": "./index.js"
23
+ },
24
+ "./*": {
25
+ "require": "./cjs/*"
26
+ }
27
+ },
20
28
  "private": false,
21
29
  "typings": "./index.d.ts"
22
30
  }
package/src/App.tsx CHANGED
@@ -2,13 +2,13 @@ import React from 'react';
2
2
  import { i18n, TFunction } from 'i18next';
3
3
  import App from 'next/app';
4
4
  import Head from 'next/head';
5
+ import { NextRouter, useRouter } from 'next/router';
5
6
  import { withTranslation, WithTranslation } from 'react-i18next';
6
7
  import NextLink from '@digigov/nextjs/Link';
7
8
  import DigiGOVApp, { StaticApp } from '@digigov/ui/app/App';
8
9
  import type { AppProps } from '@digigov/ui/app/App';
9
10
  import { I18NProvider } from '@digigov/ui/i18n';
10
11
  import { LinkProvider } from '@digigov/ui/navigation/Link';
11
- import { NextRouter, useRouter } from 'next/router';
12
12
 
13
13
  export interface DigiGOVNextAppProps extends AppProps, WithTranslation {
14
14
  children?: React.ReactNode;
@@ -20,9 +20,9 @@ export interface DigiGOVNextAppProps extends AppProps, WithTranslation {
20
20
  class DigiGOVNextAppClass extends App<DigiGOVNextAppProps> {
21
21
  render(): React.ReactElement {
22
22
  const { Component, pageProps, t, i18n, ssr = false, router } = this.props;
23
- const {locale} = router;
24
-
25
- if (locale && i18n.language != locale) {
23
+ const { locale } = router;
24
+
25
+ if (locale && i18n.language != locale) {
26
26
  i18n.changeLanguage(locale);
27
27
  }
28
28
  return (
@@ -54,7 +54,7 @@ class DigiGOVNextAppClass extends App<DigiGOVNextAppProps> {
54
54
 
55
55
  const DigiGOVNextAppWithTranslation = withTranslation()(DigiGOVNextAppClass);
56
56
  const DigiGOVNextApp = (props) => {
57
- const router = useRouter()
58
- return <DigiGOVNextAppWithTranslation {...props} router={router} />
59
- }
57
+ const router = useRouter();
58
+ return <DigiGOVNextAppWithTranslation {...props} router={router} />;
59
+ };
60
60
  export default DigiGOVNextApp;
package/src/Link.tsx CHANGED
@@ -1,31 +1,28 @@
1
1
  import React, { useEffect } from 'react';
2
- import Link from 'next/link';
2
+ import NextRouterLink from 'next/link';
3
3
  import { useRouter } from 'next/router';
4
- import {LinkBase} from '@digigov/ui/navigation/Link';
5
- import { LinkProps } from '@digigov/ui/navigation/Link';
4
+ import { Link, LinkProps } from '@digigov/ui/navigation/Link';
6
5
 
7
6
  const NextLink: React.ForwardRefRenderFunction<HTMLAnchorElement, LinkProps> = (
8
7
  props,
9
8
  ref
10
9
  ) => {
11
- const { href, ...other } = props;
10
+ const { href, as, ...other } = props;
12
11
  const isExternalLink =
13
- //check if url has a file extension
14
- /^(?:[a-z]+:)?\/\/|.pdf|.docx?|.xlsx?/i.test(href || '') ||
15
- // or if props has a target or rel
12
+ /^(?:[a-z]+:)?\/\/|\.pdf|\.docx?|\.xlsx?|^mailto:/i.test(href || '') ||
16
13
  other.target === '_blank';
14
+
17
15
  const router = useRouter();
18
16
 
19
17
  useEffect(() => {
20
18
  const path = router.asPath;
21
- if (path && path.includes('#')) {
19
+ if (path.includes('#')) {
22
20
  setTimeout(() => {
23
21
  const id = path.replace('#', '');
24
- const el = window.document.getElementById(id);
25
- const r = el?.getBoundingClientRect();
26
- if (r) {
27
- window.top?.scroll({
28
- top: scrollY + r.top,
22
+ const el = document.getElementById(id);
23
+ if (el) {
24
+ window.scroll({
25
+ top: scrollY + el.getBoundingClientRect().top,
29
26
  behavior: 'smooth',
30
27
  });
31
28
  }
@@ -35,16 +32,18 @@ const NextLink: React.ForwardRefRenderFunction<HTMLAnchorElement, LinkProps> = (
35
32
 
36
33
  if (isExternalLink) {
37
34
  return (
38
- <LinkBase ref={ref} href={href || '#'} {...other}>
35
+ <Link ref={ref} href={href || '#'} {...other}>
39
36
  {props.children}
40
- </LinkBase>
37
+ </Link>
41
38
  );
42
39
  }
40
+
43
41
  return (
44
- //@ts-ignore
45
- <LinkBase as={Link} href={href} ref={ref} {...other}>
46
- {props.children}
47
- </LinkBase>
42
+ <NextRouterLink href={href || '#'} as={undefined} {...other}>
43
+ <Link ref={ref} {...other} as={as}>
44
+ {props.children}
45
+ </Link>
46
+ </NextRouterLink>
48
47
  );
49
48
  };
50
49
 
package/src/index.ts CHANGED
@@ -1,6 +0,0 @@
1
- export * from "@digigov/nextjs/App";
2
- export * from "@digigov/nextjs/Document";
3
- export * from "@digigov/nextjs/hooks";
4
- export * from "@digigov/nextjs/i18n";
5
- export * from "@digigov/nextjs/Image";
6
- export * from "@digigov/nextjs/Link";