@lidofinance/next-ui-primitives 0.23.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/README.md +71 -0
- package/README.mdx +4 -0
- package/dist/index.cjs +95 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +92 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# @lidofinance/next-ui-primitives
|
|
2
|
+
|
|
3
|
+
Next UI primitives: components, constants, hooks etc.
|
|
4
|
+
|
|
5
|
+
This component abstracted from the blockchain network,
|
|
6
|
+
other words you can use it for any widgets for any blockchains.
|
|
7
|
+
|
|
8
|
+
This component based on Next.js.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
```bash
|
|
12
|
+
yarn add @lidofinance/next-ui-primitives
|
|
13
|
+
|
|
14
|
+
# and react 17
|
|
15
|
+
yarn add react@^17.0.0
|
|
16
|
+
|
|
17
|
+
# or react 18
|
|
18
|
+
yarn add react@^18.0.0
|
|
19
|
+
|
|
20
|
+
# and additional
|
|
21
|
+
yarn add next@^12.3.0
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Using
|
|
25
|
+
|
|
26
|
+
### Components
|
|
27
|
+
|
|
28
|
+
#### LidoLink:
|
|
29
|
+
|
|
30
|
+
Should use for **external** (https://lido.fi/) or **local links** (`/example-page?ref=SOME_REF&embed=SOME_EMBED`).
|
|
31
|
+
|
|
32
|
+
You can pass a `ref` and `embed` query string parameters between **local links**:
|
|
33
|
+
|
|
34
|
+
- `ref` is needed for referral program;
|
|
35
|
+
- `embed` is needed for support of `staking widget` via iframe in `ledger live`.
|
|
36
|
+
|
|
37
|
+
Below an example how to make custom styles of **LidoLink**:
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import React, { FC } from 'react'
|
|
41
|
+
import { useRouter } from 'next/router'
|
|
42
|
+
import styled from 'styled-components'
|
|
43
|
+
import { LidoLink, LidoLinkProps } from '@lidofinance/next-ui-primitives'
|
|
44
|
+
|
|
45
|
+
export type NavigationLinkProps = LidoLinkProps & {
|
|
46
|
+
icon: React.ReactNode
|
|
47
|
+
title: string
|
|
48
|
+
href: string
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const NavigationLinkStyle = styled(LidoLink)<{ $active: boolean }>`
|
|
52
|
+
// Some custom styles...
|
|
53
|
+
`
|
|
54
|
+
|
|
55
|
+
export const Component: FC<NavigationLinkProps> = ({ icon, title, href, ...rest }) => {
|
|
56
|
+
const { pathname } = useRouter()
|
|
57
|
+
|
|
58
|
+
// compare without query string
|
|
59
|
+
const active = pathname === href.split('?')[0]
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<NavigationLinkStyle {...rest} href={href} $active={active}>
|
|
63
|
+
|
|
64
|
+
<React.Fragment>
|
|
65
|
+
{icon}
|
|
66
|
+
<span>{title}</span>
|
|
67
|
+
</React.Fragment>
|
|
68
|
+
</NavigationLinkStyle>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
```
|
package/README.mdx
ADDED
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
var $93xws$reactjsxruntime = require("react/jsx-runtime");
|
|
2
|
+
var $93xws$react = require("react");
|
|
3
|
+
var $93xws$nextrouter = require("next/router");
|
|
4
|
+
var $93xws$nextlink = require("next/link");
|
|
5
|
+
|
|
6
|
+
function $parcel$exportWildcard(dest, source) {
|
|
7
|
+
Object.keys(source).forEach(function(key) {
|
|
8
|
+
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
Object.defineProperty(dest, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return source[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return dest;
|
|
21
|
+
}
|
|
22
|
+
function $parcel$interopDefault(a) {
|
|
23
|
+
return a && a.__esModule ? a.default : a;
|
|
24
|
+
}
|
|
25
|
+
function $parcel$export(e, n, v, s) {
|
|
26
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
27
|
+
}
|
|
28
|
+
var $9eb49ab02efff021$exports = {};
|
|
29
|
+
var $abd0d426949c0843$exports = {};
|
|
30
|
+
|
|
31
|
+
$parcel$export($abd0d426949c0843$exports, "LidoLink", function () { return $abd0d426949c0843$export$d97afdf95912bfad; });
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
const $abd0d426949c0843$var$isValidAbsoluteUrl = (href)=>{
|
|
37
|
+
try {
|
|
38
|
+
// External link
|
|
39
|
+
new URL(href);
|
|
40
|
+
return true;
|
|
41
|
+
} catch {
|
|
42
|
+
// Local link
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const $abd0d426949c0843$export$d97afdf95912bfad = (props)=>{
|
|
47
|
+
var _url_searchParams, _url_searchParams1;
|
|
48
|
+
const { href: href , ...rest } = props;
|
|
49
|
+
const { // `ref` is needed for referral program
|
|
50
|
+
// `embed` is needed for support of `staking widget` via iframe in `ledger-live`
|
|
51
|
+
query: { ref: ref , embed: embed } } = (0, $93xws$nextrouter.useRouter)();
|
|
52
|
+
// Fix `Hydration failed...` when using `styled-component` with `next/link`
|
|
53
|
+
// https://github.com/vercel/next.js/discussions/35773#discussioncomment-2622885
|
|
54
|
+
// https://github.com/vercel/next.js/discussions/35773#discussioncomment-4166807
|
|
55
|
+
const [mounted, setMounted] = (0, $93xws$react.useState)(false);
|
|
56
|
+
(0, $93xws$react.useEffect)(()=>setMounted(true), []);
|
|
57
|
+
if (!mounted) {
|
|
58
|
+
// Fix for SEO
|
|
59
|
+
if ($abd0d426949c0843$var$isValidAbsoluteUrl(href)) // External link
|
|
60
|
+
return /*#__PURE__*/ (0, $93xws$reactjsxruntime.jsx)("a", {
|
|
61
|
+
target: "_blank",
|
|
62
|
+
rel: "noreferrer",
|
|
63
|
+
...rest,
|
|
64
|
+
href: href
|
|
65
|
+
});
|
|
66
|
+
// Local link
|
|
67
|
+
return /*#__PURE__*/ (0, $93xws$reactjsxruntime.jsx)("a", {
|
|
68
|
+
...rest,
|
|
69
|
+
href: href
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
// Code below is only executed on the client side (due to conditions 'if (!mounted)...' above)
|
|
73
|
+
const url = new URL(href, window.location.origin);
|
|
74
|
+
if (url.origin !== window.location.origin) return /*#__PURE__*/ (0, $93xws$reactjsxruntime.jsx)((0, ($parcel$interopDefault($93xws$nextlink))), {
|
|
75
|
+
target: "_blank",
|
|
76
|
+
rel: "noreferrer",
|
|
77
|
+
...rest,
|
|
78
|
+
href: url.href
|
|
79
|
+
});
|
|
80
|
+
if (ref) (_url_searchParams = url.searchParams) === null || _url_searchParams === void 0 ? void 0 : _url_searchParams.set("ref", ref);
|
|
81
|
+
if (embed) (_url_searchParams1 = url.searchParams) === null || _url_searchParams1 === void 0 ? void 0 : _url_searchParams1.set("embed", embed);
|
|
82
|
+
return /*#__PURE__*/ (0, $93xws$reactjsxruntime.jsx)((0, ($parcel$interopDefault($93xws$nextlink))), {
|
|
83
|
+
...rest,
|
|
84
|
+
href: url.href
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
$parcel$exportWildcard($9eb49ab02efff021$exports, $abd0d426949c0843$exports);
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
$parcel$exportWildcard(module.exports, $9eb49ab02efff021$exports);
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA;;;;AAIA,MAAM,2CAAqB,CAAC,OAAiB;IAC3C,IAAI;QACF,gBAAgB;QAChB,IAAI,IAAI;QACR,OAAO,IAAI;IACb,EAAE,OAAM;QACN,aAAa;QACb,OAAO,KAAK;IACd;AACF;AAIO,MAAM,4CAAuD,CAAC,QAAU;QAiCpE,mBACE;IAjCX,MAAM,QAAE,KAAI,EAAE,GAAG,MAAM,GAAG;IAE1B,MAAM,EACJ,uCAAuC;IACvC,gFAAgF;IAChF,OAAO,OAAE,IAAG,SAAE,MAAK,EAAE,CAAA,EACtB,GAAG,CAAA,GAAA,2BAAQ;IAEZ,2EAA2E;IAC3E,gFAAgF;IAChF,gFAAgF;IAChF,MAAM,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,qBAAO,EAAE,KAAK;IAC5C,CAAA,GAAA,sBAAQ,EAAE,IAAM,WAAW,IAAI,GAAG,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,CAAC;IACD,8FAA8F;IAE9F,MAAM,MAAM,IAAI,IAAI,MAAM,OAAO,QAAQ,CAAC,MAAM;IAEhD,IAAI,IAAI,MAAM,KAAK,OAAO,QAAQ,CAAC,MAAM,EACvC,qBAAO,gCAAC,CAAA,GAAA,yCAAI,AAAD;QAAE,QAAQ;QAAU,KAAI;QAAc,GAAG,IAAI;QAAE,MAAM,IAAI,IAAI;;IAG1E,IAAI,KAAK,CAAA,oBAAA,IAAI,YAAY,cAAhB,+BAAA,KAAA,IAAA,kBAAkB,IAAI,OAAO;IACtC,IAAI,OAAO,CAAA,qBAAA,IAAI,YAAY,cAAhB,gCAAA,KAAA,IAAA,mBAAkB,IAAI,SAAS;IAE1C,qBAAO,gCAAC,CAAA,GAAA,yCAAI,AAAD;QAAG,GAAG,IAAI;QAAE,MAAM,IAAI,IAAI;;AACvC;;ADtDA;;;ADAA","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'\nimport Link, { LinkProps } from 'next/link'\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 = LinkProps & { 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
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;AAeA,4BAA4B,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAExD,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"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {jsx as $7zhEJ$jsx} from "react/jsx-runtime";
|
|
2
|
+
import {useState as $7zhEJ$useState, useEffect as $7zhEJ$useEffect} from "react";
|
|
3
|
+
import {useRouter as $7zhEJ$useRouter} from "next/router";
|
|
4
|
+
import $7zhEJ$nextlink from "next/link";
|
|
5
|
+
|
|
6
|
+
function $parcel$exportWildcard(dest, source) {
|
|
7
|
+
Object.keys(source).forEach(function(key) {
|
|
8
|
+
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
Object.defineProperty(dest, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return source[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return dest;
|
|
21
|
+
}
|
|
22
|
+
function $parcel$export(e, n, v, s) {
|
|
23
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
24
|
+
}
|
|
25
|
+
var $748bcbb776d77e87$exports = {};
|
|
26
|
+
var $f4b56e66ba788353$exports = {};
|
|
27
|
+
|
|
28
|
+
$parcel$export($f4b56e66ba788353$exports, "LidoLink", function () { return $f4b56e66ba788353$export$d97afdf95912bfad; });
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
const $f4b56e66ba788353$var$isValidAbsoluteUrl = (href)=>{
|
|
34
|
+
try {
|
|
35
|
+
// External link
|
|
36
|
+
new URL(href);
|
|
37
|
+
return true;
|
|
38
|
+
} catch {
|
|
39
|
+
// Local link
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const $f4b56e66ba788353$export$d97afdf95912bfad = (props)=>{
|
|
44
|
+
var _url_searchParams, _url_searchParams1;
|
|
45
|
+
const { href: href , ...rest } = props;
|
|
46
|
+
const { // `ref` is needed for referral program
|
|
47
|
+
// `embed` is needed for support of `staking widget` via iframe in `ledger-live`
|
|
48
|
+
query: { ref: ref , embed: embed } } = (0, $7zhEJ$useRouter)();
|
|
49
|
+
// Fix `Hydration failed...` when using `styled-component` with `next/link`
|
|
50
|
+
// https://github.com/vercel/next.js/discussions/35773#discussioncomment-2622885
|
|
51
|
+
// https://github.com/vercel/next.js/discussions/35773#discussioncomment-4166807
|
|
52
|
+
const [mounted, setMounted] = (0, $7zhEJ$useState)(false);
|
|
53
|
+
(0, $7zhEJ$useEffect)(()=>setMounted(true), []);
|
|
54
|
+
if (!mounted) {
|
|
55
|
+
// Fix for SEO
|
|
56
|
+
if ($f4b56e66ba788353$var$isValidAbsoluteUrl(href)) // External link
|
|
57
|
+
return /*#__PURE__*/ (0, $7zhEJ$jsx)("a", {
|
|
58
|
+
target: "_blank",
|
|
59
|
+
rel: "noreferrer",
|
|
60
|
+
...rest,
|
|
61
|
+
href: href
|
|
62
|
+
});
|
|
63
|
+
// Local link
|
|
64
|
+
return /*#__PURE__*/ (0, $7zhEJ$jsx)("a", {
|
|
65
|
+
...rest,
|
|
66
|
+
href: href
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
// Code below is only executed on the client side (due to conditions 'if (!mounted)...' above)
|
|
70
|
+
const url = new URL(href, window.location.origin);
|
|
71
|
+
if (url.origin !== window.location.origin) return /*#__PURE__*/ (0, $7zhEJ$jsx)((0, $7zhEJ$nextlink), {
|
|
72
|
+
target: "_blank",
|
|
73
|
+
rel: "noreferrer",
|
|
74
|
+
...rest,
|
|
75
|
+
href: url.href
|
|
76
|
+
});
|
|
77
|
+
if (ref) (_url_searchParams = url.searchParams) === null || _url_searchParams === void 0 ? void 0 : _url_searchParams.set("ref", ref);
|
|
78
|
+
if (embed) (_url_searchParams1 = url.searchParams) === null || _url_searchParams1 === void 0 ? void 0 : _url_searchParams1.set("embed", embed);
|
|
79
|
+
return /*#__PURE__*/ (0, $7zhEJ$jsx)((0, $7zhEJ$nextlink), {
|
|
80
|
+
...rest,
|
|
81
|
+
href: url.href
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
$parcel$exportWildcard($748bcbb776d77e87$exports, $f4b56e66ba788353$exports);
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
export {$f4b56e66ba788353$export$d97afdf95912bfad as LidoLink};
|
|
92
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA;;;;AAIA,MAAM,2CAAqB,CAAC,OAAiB;IAC3C,IAAI;QACF,gBAAgB;QAChB,IAAI,IAAI;QACR,OAAO,IAAI;IACb,EAAE,OAAM;QACN,aAAa;QACb,OAAO,KAAK;IACd;AACF;AAIO,MAAM,4CAAuD,CAAC,QAAU;QAiCpE,mBACE;IAjCX,MAAM,QAAE,KAAI,EAAE,GAAG,MAAM,GAAG;IAE1B,MAAM,EACJ,uCAAuC;IACvC,gFAAgF;IAChF,OAAO,OAAE,IAAG,SAAE,MAAK,EAAE,CAAA,EACtB,GAAG,CAAA,GAAA,gBAAQ;IAEZ,2EAA2E;IAC3E,gFAAgF;IAChF,gFAAgF;IAChF,MAAM,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE,KAAK;IAC5C,CAAA,GAAA,gBAAQ,EAAE,IAAM,WAAW,IAAI,GAAG,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,CAAC;IACD,8FAA8F;IAE9F,MAAM,MAAM,IAAI,IAAI,MAAM,OAAO,QAAQ,CAAC,MAAM;IAEhD,IAAI,IAAI,MAAM,KAAK,OAAO,QAAQ,CAAC,MAAM,EACvC,qBAAO,gBAAC,CAAA,GAAA,eAAI,AAAD;QAAE,QAAQ;QAAU,KAAI;QAAc,GAAG,IAAI;QAAE,MAAM,IAAI,IAAI;;IAG1E,IAAI,KAAK,CAAA,oBAAA,IAAI,YAAY,cAAhB,+BAAA,KAAA,IAAA,kBAAkB,IAAI,OAAO;IACtC,IAAI,OAAO,CAAA,qBAAA,IAAI,YAAY,cAAhB,gCAAA,KAAA,IAAA,mBAAkB,IAAI,SAAS;IAE1C,qBAAO,gBAAC,CAAA,GAAA,eAAI,AAAD;QAAG,GAAG,IAAI;QAAE,MAAM,IAAI,IAAI;;AACvC;;ADtDA;;;ADAA","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'\nimport Link, { LinkProps } from 'next/link'\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 = LinkProps & { 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
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lidofinance/next-ui-primitives",
|
|
3
|
+
"description": "Next UI primitives (client-side: components, constants, hooks)",
|
|
4
|
+
"repository": "git@github.com:lidofinance/warehouse.git",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"version": "0.23.0",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">= 16",
|
|
12
|
+
"browsers": "> 0.5%, last 2 versions, not dead"
|
|
13
|
+
},
|
|
14
|
+
"source": "./src/index.ts",
|
|
15
|
+
"main": "dist/index.cjs",
|
|
16
|
+
"module": "dist/index.mjs",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "parcel build",
|
|
20
|
+
"lint": "eslint . && prettier --check src",
|
|
21
|
+
"lint:fix": "eslint --fix . && prettier --check src --write",
|
|
22
|
+
"types": "tsc --noEmit"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"next": "^12.3.0",
|
|
26
|
+
"react": "17 || 18"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@lidofinance/config-prettier": "~0.23.0",
|
|
30
|
+
"@types/react": "^18.0.25",
|
|
31
|
+
"next": "^12.3.0"
|
|
32
|
+
}
|
|
33
|
+
}
|