@lidofinance/next-ui-primitives 0.37.1 → 0.38.0

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/dist/index.cjs CHANGED
@@ -70,7 +70,9 @@ const $abd0d426949c0843$export$d97afdf95912bfad = (props)=>{
70
70
  }
71
71
  // Code below is only executed on the client side (due to conditions 'if (!mounted)...' above)
72
72
  const url = new URL(href, window.location.origin);
73
- if (url.origin !== window.location.origin) return /*#__PURE__*/ (0, $93xws$reactjsxruntime.jsx)((0, ($parcel$interopDefault($93xws$nextlinkjs))), {
73
+ if (url.origin !== window.location.origin) // For Next >= 13 we can use <Link ...> (import Link from 'next/link.js')
74
+ // For Next 12 we should use <a ...>
75
+ return /*#__PURE__*/ (0, $93xws$reactjsxruntime.jsx)("a", {
74
76
  target: "_blank",
75
77
  rel: "noreferrer",
76
78
  ...rest,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEIA,MAAM,2CAAqB,CAAC;IAC1B,IAAI;QACF,gBAAgB;QAChB,IAAI,IAAI;QACR,OAAO;IACT,EAAE,OAAM;QACN,aAAa;QACb,OAAO;IACT;AACF;AAIO,MAAM,4CAAuD,CAAC;IACnE,MAAM,QAAE,IAAI,EAAE,GAAG,MAAM,GAAG;IAE1B,MAAM,EACJ,uCAAuC;IACvC,gFAAgF;IAChF,OAAO,OAAE,GAAG,SAAE,KAAK,EAAE,EACtB,GAAG,CAAA,GAAA,6BAAQ;IAEZ,2EAA2E;IAC3E,gFAAgF;IAChF,gFAAgF;IAChF,MAAM,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,qBAAO,EAAE;IACvC,CAAA,GAAA,sBAAQ,EAAE,IAAM,WAAW,OAAO,EAAE;IACpC,IAAI,CAAC,SAAS;QACZ,cAAc;QAEd,IAAI,yCAAmB,OACrB,gBAAgB;QAChB,qBAAO,gCAAC;YAAE,QAAQ;YAAU,KAAI;YAAc,GAAG,IAAI;YAAE,MAAM;;QAG/D,aAAa;QACb,qBAAO,gCAAC;YAAG,GAAG,IAAI;YAAE,MAAM;;IAC5B;IACA,8FAA8F;IAE9F,MAAM,MAAM,IAAI,IAAI,MAAM,OAAO,SAAS;IAE1C,IAAI,IAAI,WAAW,OAAO,SAAS,QACjC,qBAAO,gCAAC,CAAA,GAAA,2CAAG;QAAE,QAAQ;QAAU,KAAI;QAAc,GAAG,IAAI;QAAE,MAAM,IAAI;;IAGtE,IAAI,KAAK,IAAI,cAAc,IAAI,OAAO;IACtC,IAAI,OAAO,IAAI,cAAc,IAAI,SAAS;IAE1C,qBAAO,gCAAC,CAAA,GAAA,2CAAG;QAAG,GAAG,IAAI;QAAE,MAAM,IAAI;;AACnC","sources":["packages/next/ui-primitives/src/index.ts","packages/next/ui-primitives/src/components/index.ts","packages/next/ui-primitives/src/components/lidoLink/index.tsx"],"sourcesContent":["export * from './components'\n","export * from './lidoLink'\n","import React, { FC, useState, useEffect } from 'react'\nimport { useRouter } from 'next/router.js'\nimport Link, { LinkProps } from 'next/link.js'\n\nconst isValidAbsoluteUrl = (href: string) => {\n try {\n // External link\n new URL(href)\n return true\n } catch {\n // Local link\n return false\n }\n}\n\nexport type LidoLinkProps = Omit<LinkProps, 'as'> & { href: string }\n\nexport const LidoLink: FC<React.PropsWithChildren<LidoLinkProps>> = (props) => {\n const { href, ...rest } = props\n\n const {\n // `ref` is needed for referral program\n // `embed` is needed for support of `staking widget` via iframe in `ledger-live`\n query: { ref, embed },\n } = useRouter()\n\n // Fix `Hydration failed...` when using `styled-component` with `next/link`\n // https://github.com/vercel/next.js/discussions/35773#discussioncomment-2622885\n // https://github.com/vercel/next.js/discussions/35773#discussioncomment-4166807\n const [mounted, setMounted] = useState(false)\n useEffect(() => setMounted(true), [])\n if (!mounted) {\n // Fix for SEO\n\n if (isValidAbsoluteUrl(href)) {\n // External link\n return <a target={'_blank'} rel=\"noreferrer\" {...rest} href={href} />\n }\n\n // Local link\n return <a {...rest} href={href} />\n }\n // Code below is only executed on the client side (due to conditions 'if (!mounted)...' above)\n\n const url = new URL(href, window.location.origin)\n\n if (url.origin !== window.location.origin) {\n return <Link target={'_blank'} rel=\"noreferrer\" {...rest} href={url.href} />\n }\n\n if (ref) url.searchParams?.set('ref', ref as string)\n if (embed) url.searchParams?.set('embed', embed as string)\n\n return <Link {...rest} href={url.href} />\n}\n"],"names":[],"version":3,"file":"index.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEIA,MAAM,2CAAqB,CAAC;IAC1B,IAAI;QACF,gBAAgB;QAChB,IAAI,IAAI;QACR,OAAO;IACT,EAAE,OAAM;QACN,aAAa;QACb,OAAO;IACT;AACF;AAIO,MAAM,4CAAuD,CAAC;IACnE,MAAM,QAAE,IAAI,EAAE,GAAG,MAAM,GAAG;IAE1B,MAAM,EACJ,uCAAuC;IACvC,gFAAgF;IAChF,OAAO,OAAE,GAAG,SAAE,KAAK,EAAE,EACtB,GAAG,CAAA,GAAA,6BAAQ;IAEZ,2EAA2E;IAC3E,gFAAgF;IAChF,gFAAgF;IAChF,MAAM,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,qBAAO,EAAE;IACvC,CAAA,GAAA,sBAAQ,EAAE,IAAM,WAAW,OAAO,EAAE;IACpC,IAAI,CAAC,SAAS;QACZ,cAAc;QAEd,IAAI,yCAAmB,OACrB,gBAAgB;QAChB,qBAAO,gCAAC;YAAE,QAAQ;YAAU,KAAI;YAAc,GAAG,IAAI;YAAE,MAAM;;QAG/D,aAAa;QACb,qBAAO,gCAAC;YAAG,GAAG,IAAI;YAAE,MAAM;;IAC5B;IACA,8FAA8F;IAE9F,MAAM,MAAM,IAAI,IAAI,MAAM,OAAO,SAAS;IAE1C,IAAI,IAAI,WAAW,OAAO,SAAS,QACjC,yEAAyE;IACzE,oCAAoC;IACpC,qBAAO,gCAAC;QAAE,QAAQ;QAAU,KAAI;QAAc,GAAG,IAAI;QAAE,MAAM,IAAI;;IAGnE,IAAI,KAAK,IAAI,cAAc,IAAI,OAAO;IACtC,IAAI,OAAO,IAAI,cAAc,IAAI,SAAS;IAE1C,qBAAO,gCAAC,CAAA,GAAA,2CAAG;QAAG,GAAG,IAAI;QAAE,MAAM,IAAI;;AACnC","sources":["packages/next/ui-primitives/src/index.ts","packages/next/ui-primitives/src/components/index.ts","packages/next/ui-primitives/src/components/lidoLink/index.tsx"],"sourcesContent":["export * from './components'\n","export * from './lidoLink'\n","import React, { FC, useState, useEffect } from 'react'\nimport { useRouter } from 'next/router.js'\nimport Link, { LinkProps } from 'next/link.js'\n\nconst isValidAbsoluteUrl = (href: string) => {\n try {\n // External link\n new URL(href)\n return true\n } catch {\n // Local link\n return false\n }\n}\n\nexport type LidoLinkProps = Omit<LinkProps, 'as'> & { href: string }\n\nexport const LidoLink: FC<React.PropsWithChildren<LidoLinkProps>> = (props) => {\n const { href, ...rest } = props\n\n const {\n // `ref` is needed for referral program\n // `embed` is needed for support of `staking widget` via iframe in `ledger-live`\n query: { ref, embed },\n } = useRouter()\n\n // Fix `Hydration failed...` when using `styled-component` with `next/link`\n // https://github.com/vercel/next.js/discussions/35773#discussioncomment-2622885\n // https://github.com/vercel/next.js/discussions/35773#discussioncomment-4166807\n const [mounted, setMounted] = useState(false)\n useEffect(() => setMounted(true), [])\n if (!mounted) {\n // Fix for SEO\n\n if (isValidAbsoluteUrl(href)) {\n // External link\n return <a target={'_blank'} rel=\"noreferrer\" {...rest} href={href} />\n }\n\n // Local link\n return <a {...rest} href={href} />\n }\n // Code below is only executed on the client side (due to conditions 'if (!mounted)...' above)\n\n const url = new URL(href, window.location.origin)\n\n if (url.origin !== window.location.origin) {\n // For Next >= 13 we can use <Link ...> (import Link from 'next/link.js')\n // For Next 12 we should use <a ...>\n return <a target={'_blank'} rel=\"noreferrer\" {...rest} href={url.href} />\n }\n\n if (ref) url.searchParams?.set('ref', ref as string)\n if (embed) url.searchParams?.set('embed', embed as string)\n\n return <Link {...rest} href={url.href} />\n}\n"],"names":[],"version":3,"file":"index.cjs.map"}
@@ -1 +1 @@
1
- {"mappings":";;AAeA,4BAA4B,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpE,OAAO,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,aAAa,CAAC,CAqC/D,CAAA","sources":["packages/next/ui-primitives/src/src/components/lidoLink/index.tsx","packages/next/ui-primitives/src/src/components/index.ts","packages/next/ui-primitives/src/src/index.ts","packages/next/ui-primitives/src/index.ts"],"sourcesContent":[null,null,null,"export * from './components'\n"],"names":[],"version":3,"file":"index.d.ts.map"}
1
+ {"mappings":";;AAeA,4BAA4B,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpE,OAAO,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,aAAa,CAAC,CAuC/D,CAAA","sources":["packages/next/ui-primitives/src/src/components/lidoLink/index.tsx","packages/next/ui-primitives/src/src/components/index.ts","packages/next/ui-primitives/src/src/index.ts","packages/next/ui-primitives/src/index.ts"],"sourcesContent":[null,null,null,"export * from './components'\n"],"names":[],"version":3,"file":"index.d.ts.map"}
@@ -67,7 +67,9 @@ const $f4b56e66ba788353$export$d97afdf95912bfad = (props)=>{
67
67
  }
68
68
  // Code below is only executed on the client side (due to conditions 'if (!mounted)...' above)
69
69
  const url = new URL(href, window.location.origin);
70
- if (url.origin !== window.location.origin) return /*#__PURE__*/ (0, $7zhEJ$jsx)((0, $7zhEJ$nextlinkjs), {
70
+ if (url.origin !== window.location.origin) // For Next >= 13 we can use <Link ...> (import Link from 'next/link.js')
71
+ // For Next 12 we should use <a ...>
72
+ return /*#__PURE__*/ (0, $7zhEJ$jsx)("a", {
71
73
  target: "_blank",
72
74
  rel: "noreferrer",
73
75
  ...rest,
@@ -88,4 +90,4 @@ $parcel$exportWildcard($748bcbb776d77e87$exports, $f4b56e66ba788353$exports);
88
90
 
89
91
 
90
92
  export {$f4b56e66ba788353$export$d97afdf95912bfad as LidoLink};
91
- //# sourceMappingURL=index.mjs.map
93
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEIA,MAAM,2CAAqB,CAAC;IAC1B,IAAI;QACF,gBAAgB;QAChB,IAAI,IAAI;QACR,OAAO;IACT,EAAE,OAAM;QACN,aAAa;QACb,OAAO;IACT;AACF;AAIO,MAAM,4CAAuD,CAAC;IACnE,MAAM,QAAE,IAAI,EAAE,GAAG,MAAM,GAAG;IAE1B,MAAM,EACJ,uCAAuC;IACvC,gFAAgF;IAChF,OAAO,OAAE,GAAG,SAAE,KAAK,EAAE,EACtB,GAAG,CAAA,GAAA,gBAAQ;IAEZ,2EAA2E;IAC3E,gFAAgF;IAChF,gFAAgF;IAChF,MAAM,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE;IACvC,CAAA,GAAA,gBAAQ,EAAE,IAAM,WAAW,OAAO,EAAE;IACpC,IAAI,CAAC,SAAS;QACZ,cAAc;QAEd,IAAI,yCAAmB,OACrB,gBAAgB;QAChB,qBAAO,gBAAC;YAAE,QAAQ;YAAU,KAAI;YAAc,GAAG,IAAI;YAAE,MAAM;;QAG/D,aAAa;QACb,qBAAO,gBAAC;YAAG,GAAG,IAAI;YAAE,MAAM;;IAC5B;IACA,8FAA8F;IAE9F,MAAM,MAAM,IAAI,IAAI,MAAM,OAAO,SAAS;IAE1C,IAAI,IAAI,WAAW,OAAO,SAAS,QACjC,yEAAyE;IACzE,oCAAoC;IACpC,qBAAO,gBAAC;QAAE,QAAQ;QAAU,KAAI;QAAc,GAAG,IAAI;QAAE,MAAM,IAAI;;IAGnE,IAAI,KAAK,IAAI,cAAc,IAAI,OAAO;IACtC,IAAI,OAAO,IAAI,cAAc,IAAI,SAAS;IAE1C,qBAAO,gBAAC,CAAA,GAAA,iBAAG;QAAG,GAAG,IAAI;QAAE,MAAM,IAAI;;AACnC","sources":["packages/next/ui-primitives/src/index.ts","packages/next/ui-primitives/src/components/index.ts","packages/next/ui-primitives/src/components/lidoLink/index.tsx"],"sourcesContent":["export * from './components'\n","export * from './lidoLink'\n","import React, { FC, useState, useEffect } from 'react'\nimport { useRouter } from 'next/router.js'\nimport Link, { LinkProps } from 'next/link.js'\n\nconst isValidAbsoluteUrl = (href: string) => {\n try {\n // External link\n new URL(href)\n return true\n } catch {\n // Local link\n return false\n }\n}\n\nexport type LidoLinkProps = Omit<LinkProps, 'as'> & { href: string }\n\nexport const LidoLink: FC<React.PropsWithChildren<LidoLinkProps>> = (props) => {\n const { href, ...rest } = props\n\n const {\n // `ref` is needed for referral program\n // `embed` is needed for support of `staking widget` via iframe in `ledger-live`\n query: { ref, embed },\n } = useRouter()\n\n // Fix `Hydration failed...` when using `styled-component` with `next/link`\n // https://github.com/vercel/next.js/discussions/35773#discussioncomment-2622885\n // https://github.com/vercel/next.js/discussions/35773#discussioncomment-4166807\n const [mounted, setMounted] = useState(false)\n useEffect(() => setMounted(true), [])\n if (!mounted) {\n // Fix for SEO\n\n if (isValidAbsoluteUrl(href)) {\n // External link\n return <a target={'_blank'} rel=\"noreferrer\" {...rest} href={href} />\n }\n\n // Local link\n return <a {...rest} href={href} />\n }\n // Code below is only executed on the client side (due to conditions 'if (!mounted)...' above)\n\n const url = new URL(href, window.location.origin)\n\n if (url.origin !== window.location.origin) {\n // For Next >= 13 we can use <Link ...> (import Link from 'next/link.js')\n // For Next 12 we should use <a ...>\n return <a target={'_blank'} rel=\"noreferrer\" {...rest} href={url.href} />\n }\n\n if (ref) url.searchParams?.set('ref', ref as string)\n if (embed) url.searchParams?.set('embed', embed as string)\n\n return <Link {...rest} href={url.href} />\n}\n"],"names":[],"version":3,"file":"index.js.map"}
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://github.com/lidofinance/warehouse/issues"
8
8
  },
9
9
  "license": "MIT",
10
- "version": "0.37.1",
10
+ "version": "0.38.0",
11
11
  "files": [
12
12
  "dist"
13
13
  ],
@@ -17,11 +17,11 @@
17
17
  },
18
18
  "source": "./src/index.ts",
19
19
  "main": "dist/index.cjs",
20
- "module": "dist/index.mjs",
20
+ "module": "dist/index.js",
21
21
  "types": "dist/index.d.ts",
22
22
  "exports": {
23
23
  ".": {
24
- "import": "./dist/index.mjs",
24
+ "import": "./dist/index.js",
25
25
  "require": "./dist/index.cjs"
26
26
  }
27
27
  },
@@ -36,7 +36,7 @@
36
36
  "react": "17 || 18"
37
37
  },
38
38
  "devDependencies": {
39
- "@lidofinance/config-prettier": "~0.37.1",
39
+ "@lidofinance/config-prettier": "~0.38.0",
40
40
  "@types/react": "^18.0.25",
41
41
  "next": "^12.3.0"
42
42
  }
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEIA,MAAM,2CAAqB,CAAC;IAC1B,IAAI;QACF,gBAAgB;QAChB,IAAI,IAAI;QACR,OAAO;IACT,EAAE,OAAM;QACN,aAAa;QACb,OAAO;IACT;AACF;AAIO,MAAM,4CAAuD,CAAC;IACnE,MAAM,QAAE,IAAI,EAAE,GAAG,MAAM,GAAG;IAE1B,MAAM,EACJ,uCAAuC;IACvC,gFAAgF;IAChF,OAAO,OAAE,GAAG,SAAE,KAAK,EAAE,EACtB,GAAG,CAAA,GAAA,gBAAQ;IAEZ,2EAA2E;IAC3E,gFAAgF;IAChF,gFAAgF;IAChF,MAAM,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE;IACvC,CAAA,GAAA,gBAAQ,EAAE,IAAM,WAAW,OAAO,EAAE;IACpC,IAAI,CAAC,SAAS;QACZ,cAAc;QAEd,IAAI,yCAAmB,OACrB,gBAAgB;QAChB,qBAAO,gBAAC;YAAE,QAAQ;YAAU,KAAI;YAAc,GAAG,IAAI;YAAE,MAAM;;QAG/D,aAAa;QACb,qBAAO,gBAAC;YAAG,GAAG,IAAI;YAAE,MAAM;;IAC5B;IACA,8FAA8F;IAE9F,MAAM,MAAM,IAAI,IAAI,MAAM,OAAO,SAAS;IAE1C,IAAI,IAAI,WAAW,OAAO,SAAS,QACjC,qBAAO,gBAAC,CAAA,GAAA,iBAAG;QAAE,QAAQ;QAAU,KAAI;QAAc,GAAG,IAAI;QAAE,MAAM,IAAI;;IAGtE,IAAI,KAAK,IAAI,cAAc,IAAI,OAAO;IACtC,IAAI,OAAO,IAAI,cAAc,IAAI,SAAS;IAE1C,qBAAO,gBAAC,CAAA,GAAA,iBAAG;QAAG,GAAG,IAAI;QAAE,MAAM,IAAI;;AACnC","sources":["packages/next/ui-primitives/src/index.ts","packages/next/ui-primitives/src/components/index.ts","packages/next/ui-primitives/src/components/lidoLink/index.tsx"],"sourcesContent":["export * from './components'\n","export * from './lidoLink'\n","import React, { FC, useState, useEffect } from 'react'\nimport { useRouter } from 'next/router.js'\nimport Link, { LinkProps } from 'next/link.js'\n\nconst isValidAbsoluteUrl = (href: string) => {\n try {\n // External link\n new URL(href)\n return true\n } catch {\n // Local link\n return false\n }\n}\n\nexport type LidoLinkProps = Omit<LinkProps, 'as'> & { href: string }\n\nexport const LidoLink: FC<React.PropsWithChildren<LidoLinkProps>> = (props) => {\n const { href, ...rest } = props\n\n const {\n // `ref` is needed for referral program\n // `embed` is needed for support of `staking widget` via iframe in `ledger-live`\n query: { ref, embed },\n } = useRouter()\n\n // Fix `Hydration failed...` when using `styled-component` with `next/link`\n // https://github.com/vercel/next.js/discussions/35773#discussioncomment-2622885\n // https://github.com/vercel/next.js/discussions/35773#discussioncomment-4166807\n const [mounted, setMounted] = useState(false)\n useEffect(() => setMounted(true), [])\n if (!mounted) {\n // Fix for SEO\n\n if (isValidAbsoluteUrl(href)) {\n // External link\n return <a target={'_blank'} rel=\"noreferrer\" {...rest} href={href} />\n }\n\n // Local link\n return <a {...rest} href={href} />\n }\n // Code below is only executed on the client side (due to conditions 'if (!mounted)...' above)\n\n const url = new URL(href, window.location.origin)\n\n if (url.origin !== window.location.origin) {\n return <Link target={'_blank'} rel=\"noreferrer\" {...rest} href={url.href} />\n }\n\n if (ref) url.searchParams?.set('ref', ref as string)\n if (embed) url.searchParams?.set('embed', embed as string)\n\n return <Link {...rest} href={url.href} />\n}\n"],"names":[],"version":3,"file":"index.mjs.map"}