@digigov/nextjs 1.1.7 → 1.1.9

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/Link/index.js CHANGED
@@ -29,7 +29,10 @@ const NextLink = (props, ref) => {
29
29
  if (isExternalLink) {
30
30
  return /* @__PURE__ */ React.createElement(LinkBase, { ref, href: href || "#", ...other }, props.children);
31
31
  }
32
- return /* @__PURE__ */ React.createElement(Link, { href: href || "#", ...other }, /* @__PURE__ */ React.createElement(LinkBase, { ref, ...other }, props.children));
32
+ return (
33
+ //@ts-ignore
34
+ /* @__PURE__ */ React.createElement(LinkBase, { as: Link, href, ref, ...other }, props.children)
35
+ );
33
36
  };
34
37
  var Link_default = React.forwardRef(NextLink);
35
38
  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 <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,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,SACE,oCAAC,QAAK,MAAM,QAAQ,KAAM,GAAG,SAC3B,oCAAC,YAAS,KAAW,GAAG,SACrB,MAAM,QACT,CACF;AAEJ;AAEA,IAAO,eAAQ,MAAM,WAAW,QAAQ;",
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;",
6
6
  "names": []
7
7
  }
package/cjs/Link/index.js CHANGED
@@ -61,7 +61,10 @@ const NextLink = (props, ref) => {
61
61
  if (isExternalLink) {
62
62
  return /* @__PURE__ */ import_react.default.createElement(import_Link.LinkBase, { ref, href: href || "#", ...other }, props.children);
63
63
  }
64
- return /* @__PURE__ */ import_react.default.createElement(import_link.default, { href: href || "#", ...other }, /* @__PURE__ */ import_react.default.createElement(import_Link.LinkBase, { ref, ...other }, props.children));
64
+ return (
65
+ //@ts-ignore
66
+ /* @__PURE__ */ import_react.default.createElement(import_Link.LinkBase, { as: import_link.default, href, ref, ...other }, props.children)
67
+ );
65
68
  };
66
69
  var Link_default = import_react.default.forwardRef(NextLink);
67
70
  //# 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 <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,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,SACE,6BAAAA,QAAA,cAAC,YAAAC,SAAA,EAAK,MAAM,QAAQ,KAAM,GAAG,SAC3B,6BAAAD,QAAA,cAAC,wBAAS,KAAW,GAAG,SACrB,MAAM,QACT,CACF;AAEJ;AAEA,IAAO,eAAQ,aAAAA,QAAM,WAAW,QAAQ;",
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
6
  "names": ["React", "Link"]
7
7
  }
package/cjs/index.js CHANGED
@@ -1 +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 __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
+ });
1
32
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
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;",
6
6
  "names": []
7
7
  }
package/index.d.ts CHANGED
@@ -0,0 +1,6 @@
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
@@ -3,4 +3,10 @@
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";
6
12
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
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;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digigov/nextjs",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "next specific utilities for @digigov apps",
5
5
  "author": "GRNET Developers <devs@lists.grnet.gr>",
6
6
  "license": "BSD-2-Clause",
@@ -17,14 +17,6 @@
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
- },
28
20
  "private": false,
29
21
  "typings": "./index.d.ts"
30
22
  }
package/src/Link.tsx CHANGED
@@ -41,11 +41,10 @@ const NextLink: React.ForwardRefRenderFunction<HTMLAnchorElement, LinkProps> = (
41
41
  );
42
42
  }
43
43
  return (
44
- <Link href={href || '#'} {...other}>
45
- <LinkBase ref={ref} {...other}>
46
- {props.children}
47
- </LinkBase>
48
- </Link>
44
+ //@ts-ignore
45
+ <LinkBase as={Link} href={href} ref={ref} {...other}>
46
+ {props.children}
47
+ </LinkBase>
49
48
  );
50
49
  };
51
50
 
package/src/index.ts CHANGED
@@ -0,0 +1,6 @@
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";