@lidofinance/next-ui-primitives 0.36.0 → 0.37.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 +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -2
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var $93xws$reactjsxruntime = require("react/jsx-runtime");
|
|
2
2
|
var $93xws$react = require("react");
|
|
3
|
-
var $93xws$
|
|
4
|
-
var $93xws$
|
|
3
|
+
var $93xws$nextrouterjs = require("next/router.js");
|
|
4
|
+
var $93xws$nextlinkjs = require("next/link.js");
|
|
5
5
|
|
|
6
6
|
function $parcel$exportWildcard(dest, source) {
|
|
7
7
|
Object.keys(source).forEach(function(key) {
|
|
@@ -47,7 +47,7 @@ const $abd0d426949c0843$export$d97afdf95912bfad = (props)=>{
|
|
|
47
47
|
const { href: href, ...rest } = props;
|
|
48
48
|
const { // `ref` is needed for referral program
|
|
49
49
|
// `embed` is needed for support of `staking widget` via iframe in `ledger-live`
|
|
50
|
-
query: { ref: ref, embed: embed } } = (0, $93xws$
|
|
50
|
+
query: { ref: ref, embed: embed } } = (0, $93xws$nextrouterjs.useRouter)();
|
|
51
51
|
// Fix `Hydration failed...` when using `styled-component` with `next/link`
|
|
52
52
|
// https://github.com/vercel/next.js/discussions/35773#discussioncomment-2622885
|
|
53
53
|
// https://github.com/vercel/next.js/discussions/35773#discussioncomment-4166807
|
|
@@ -70,7 +70,7 @@ 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$
|
|
73
|
+
if (url.origin !== window.location.origin) return /*#__PURE__*/ (0, $93xws$reactjsxruntime.jsx)((0, ($parcel$interopDefault($93xws$nextlinkjs))), {
|
|
74
74
|
target: "_blank",
|
|
75
75
|
rel: "noreferrer",
|
|
76
76
|
...rest,
|
|
@@ -78,7 +78,7 @@ const $abd0d426949c0843$export$d97afdf95912bfad = (props)=>{
|
|
|
78
78
|
});
|
|
79
79
|
if (ref) url.searchParams?.set("ref", ref);
|
|
80
80
|
if (embed) url.searchParams?.set("embed", embed);
|
|
81
|
-
return /*#__PURE__*/ (0, $93xws$reactjsxruntime.jsx)((0, ($parcel$interopDefault($93xws$
|
|
81
|
+
return /*#__PURE__*/ (0, $93xws$reactjsxruntime.jsx)((0, ($parcel$interopDefault($93xws$nextlinkjs))), {
|
|
82
82
|
...rest,
|
|
83
83
|
href: url.href
|
|
84
84
|
});
|
package/dist/index.cjs.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {jsx as $7zhEJ$jsx} from "react/jsx-runtime";
|
|
2
2
|
import {useState as $7zhEJ$useState, useEffect as $7zhEJ$useEffect} from "react";
|
|
3
|
-
import {useRouter as $7zhEJ$useRouter} from "next/router";
|
|
4
|
-
import $7zhEJ$
|
|
3
|
+
import {useRouter as $7zhEJ$useRouter} from "next/router.js";
|
|
4
|
+
import $7zhEJ$nextlinkjs from "next/link.js";
|
|
5
5
|
|
|
6
6
|
function $parcel$exportWildcard(dest, source) {
|
|
7
7
|
Object.keys(source).forEach(function(key) {
|
|
@@ -67,7 +67,7 @@ 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$
|
|
70
|
+
if (url.origin !== window.location.origin) return /*#__PURE__*/ (0, $7zhEJ$jsx)((0, $7zhEJ$nextlinkjs), {
|
|
71
71
|
target: "_blank",
|
|
72
72
|
rel: "noreferrer",
|
|
73
73
|
...rest,
|
|
@@ -75,7 +75,7 @@ const $f4b56e66ba788353$export$d97afdf95912bfad = (props)=>{
|
|
|
75
75
|
});
|
|
76
76
|
if (ref) url.searchParams?.set("ref", ref);
|
|
77
77
|
if (embed) url.searchParams?.set("embed", embed);
|
|
78
|
-
return /*#__PURE__*/ (0, $7zhEJ$jsx)((0, $7zhEJ$
|
|
78
|
+
return /*#__PURE__*/ (0, $7zhEJ$jsx)((0, $7zhEJ$nextlinkjs), {
|
|
79
79
|
...rest,
|
|
80
80
|
href: url.href
|
|
81
81
|
});
|
package/dist/index.mjs.map
CHANGED
|
@@ -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,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,I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I;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"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Next UI primitives (client-side: components, constants, hooks)",
|
|
4
4
|
"repository": "git@github.com:lidofinance/warehouse.git",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.37.0",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
"main": "dist/index.cjs",
|
|
16
16
|
"module": "dist/index.mjs",
|
|
17
17
|
"types": "dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": "./dist/index.mjs",
|
|
21
|
+
"require": "./dist/index.cjs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
18
24
|
"scripts": {
|
|
19
25
|
"build": "parcel build",
|
|
20
26
|
"lint": "eslint . && prettier --check src",
|
|
@@ -26,7 +32,7 @@
|
|
|
26
32
|
"react": "17 || 18"
|
|
27
33
|
},
|
|
28
34
|
"devDependencies": {
|
|
29
|
-
"@lidofinance/config-prettier": "~0.
|
|
35
|
+
"@lidofinance/config-prettier": "~0.37.0",
|
|
30
36
|
"@types/react": "^18.0.25",
|
|
31
37
|
"next": "^12.3.0"
|
|
32
38
|
}
|