@gearbox-protocol/permissionless-ui 1.22.0-next.16 → 1.22.0-next.18
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/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
- package/dist/cjs/components/client-adapters/index.cjs +1 -1
- package/dist/cjs/components/client-adapters/styled-button/styled-button.cjs +1 -1
- package/dist/cjs/components/client-adapters/styled-dialog-container/index.cjs +1 -0
- package/dist/cjs/components/client-adapters/styled-dialog-container/styled-dialog-container.cjs +1 -0
- package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
- package/dist/cjs/components/dialog/dialog-container.cjs +1 -1
- package/dist/cjs/components/dialog/dialog-modal-container.cjs +1 -1
- package/dist/cjs/components/dialog/index.cjs +1 -1
- package/dist/cjs/components/filter/filter-modal.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/modal/index.cjs +1 -0
- package/dist/cjs/components/modal/modal.cjs +1 -0
- package/dist/cjs/components/vertical-list/vertical-list.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/utils/z-index.cjs +1 -1
- package/dist/esm/components/checkbox/checkbox-labeled.js +2 -1
- package/dist/esm/components/client-adapters/index.js +4 -2
- package/dist/esm/components/client-adapters/styled-button/styled-button.js +22 -12
- package/dist/esm/components/client-adapters/styled-dialog-container/index.js +4 -0
- package/dist/esm/components/client-adapters/styled-dialog-container/styled-dialog-container.js +39 -0
- package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +2 -1
- package/dist/esm/components/dialog/dialog-container.js +55 -21
- package/dist/esm/components/dialog/dialog-modal-container.js +38 -17
- package/dist/esm/components/dialog/index.js +18 -18
- package/dist/esm/components/filter/filter-modal.js +1 -1
- package/dist/esm/components/index.js +458 -456
- package/dist/esm/components/modal/index.js +4 -0
- package/dist/esm/components/modal/modal.js +108 -0
- package/dist/esm/components/vertical-list/vertical-list.js +27 -27
- package/dist/esm/index.js +596 -594
- package/dist/esm/utils/z-index.js +1 -1
- package/dist/globals.css +1 -1
- package/dist/types/components/client-adapters/index.d.ts +1 -0
- package/dist/types/components/client-adapters/styled-dialog-container/index.d.ts +1 -0
- package/dist/types/components/client-adapters/styled-dialog-container/styled-dialog-container.d.ts +13 -0
- package/dist/types/components/dialog/dialog-container.d.ts +8 -3
- package/dist/types/components/dialog/dialog-modal-container.d.ts +9 -3
- package/dist/types/components/dialog/index.d.ts +1 -1
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/modal/index.d.ts +1 -0
- package/dist/types/components/modal/modal.d.ts +33 -0
- package/dist/types/components/skeleton/skeleton.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/z-index.d.ts +1 -1
- package/package.json +1 -1
- package/src/styles/base.css +9 -2
- package/src/styles/theme.css +19 -0
- package/dist/cjs/components/dialog/dialog-modal.cjs +0 -1
- package/dist/esm/components/dialog/dialog-modal.js +0 -70
- package/dist/types/components/dialog/dialog-modal.d.ts +0 -30
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from '../modal/modal';
|
|
1
2
|
export * from './dialog';
|
|
2
3
|
export * from './dialog-container';
|
|
3
4
|
export * from './dialog-content';
|
|
@@ -5,7 +6,6 @@ export * from './dialog-description';
|
|
|
5
6
|
export * from './dialog-footer';
|
|
6
7
|
export * from './dialog-form';
|
|
7
8
|
export * from './dialog-header';
|
|
8
|
-
export * from './dialog-modal';
|
|
9
9
|
export * from './dialog-modal-container';
|
|
10
10
|
export * from './dialog-overlay';
|
|
11
11
|
export * from './dialog-title';
|
|
@@ -64,6 +64,7 @@ export * from './legal-agreement';
|
|
|
64
64
|
export * from './liquidation';
|
|
65
65
|
export * from './loader-guard';
|
|
66
66
|
export * from './markdown-viewer';
|
|
67
|
+
export * from './modal';
|
|
67
68
|
export * from './navbar';
|
|
68
69
|
export * from './navbar-logo';
|
|
69
70
|
export * from './navitem';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './modal';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const dialogModalVariants: (props?: ({
|
|
4
|
+
colorTheme?: "default" | "dark" | "dark-transparent" | null | undefined;
|
|
5
|
+
backdrop?: "default" | "success" | "failure" | null | undefined;
|
|
6
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
export interface ModalProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof dialogModalVariants> {
|
|
8
|
+
/**
|
|
9
|
+
* Whether to show the dialog container
|
|
10
|
+
* When false, renders null
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
show?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Callback when clicking outside the container (on the overlay)
|
|
16
|
+
* Only works when used as a modal overlay
|
|
17
|
+
*/
|
|
18
|
+
onClickOutside?: () => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Modal component for responsive content width within dialogs
|
|
22
|
+
* Follows the same pattern as Container from layout/container
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* // With show/hide control
|
|
27
|
+
* <Modal show={isOpen} onClickOutside={handleClose}>
|
|
28
|
+
* <Content />
|
|
29
|
+
* </Modal>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
+
export { Modal };
|
|
@@ -3,7 +3,7 @@ import type * as React from "react";
|
|
|
3
3
|
declare const skeletonVariants: (props?: ({
|
|
4
4
|
variant?: "default" | "lighter" | "darker" | null | undefined;
|
|
5
5
|
speed?: "default" | "slow" | "fast" | null | undefined;
|
|
6
|
-
width?: "full" | "sm" | "lg" | "xs" | "md" | "xl" | "3/4" | "1/2" | "1/3" | "1/4" |
|
|
6
|
+
width?: "full" | "sm" | "lg" | "xs" | "md" | "xl" | "2xl" | "3/4" | "1/2" | "1/3" | "1/4" | null | undefined;
|
|
7
7
|
height?: "sm" | "lg" | "xs" | "md" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | null | undefined;
|
|
8
8
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
9
9
|
type WidthPreset = NonNullable<VariantProps<typeof skeletonVariants>["width"]>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ export * from './components/legal-agreement';
|
|
|
60
60
|
export * from './components/liquidation';
|
|
61
61
|
export * from './components/loader-guard';
|
|
62
62
|
export * from './components/markdown-viewer';
|
|
63
|
+
export * from './components/modal';
|
|
63
64
|
export * from './components/navbar';
|
|
64
65
|
export * from './components/navbar-logo';
|
|
65
66
|
export * from './components/navitem';
|
package/package.json
CHANGED
package/src/styles/base.css
CHANGED
|
@@ -45,6 +45,7 @@ html.dark {
|
|
|
45
45
|
--background: 225 15% 98%;
|
|
46
46
|
--foreground: 240 5% 12%;
|
|
47
47
|
--card: 0 0% 100%;
|
|
48
|
+
--modal: 0 0% 95%;
|
|
48
49
|
--card-foreground: 240 5% 12%;
|
|
49
50
|
--popover: 0 0% 100%;
|
|
50
51
|
--popover-foreground: 240 5% 12%;
|
|
@@ -90,7 +91,8 @@ html.dark {
|
|
|
90
91
|
|
|
91
92
|
--background: 240 3% 8%;
|
|
92
93
|
--foreground: 0 0% 100%;
|
|
93
|
-
--card: 240
|
|
94
|
+
--card: 240 3.85% 10.2%;
|
|
95
|
+
--modal: 240 4.92% 11.96%;
|
|
94
96
|
--card-foreground: 0 0% 100%;
|
|
95
97
|
--popover: 240 6% 12%;
|
|
96
98
|
--popover-foreground: 0 0% 100%;
|
|
@@ -127,7 +129,7 @@ html.dark {
|
|
|
127
129
|
--white: 0 0% 100%;
|
|
128
130
|
--white-foreground: 240 2.56% 7.65%;
|
|
129
131
|
--black: 0 0% 0%;
|
|
130
|
-
--border: 0 0% 100% / 0.
|
|
132
|
+
--border: 0 0% 100% / 0.07;
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
|
|
@@ -180,6 +182,11 @@ html.dark {
|
|
|
180
182
|
padding-right: 0 !important;
|
|
181
183
|
}
|
|
182
184
|
|
|
185
|
+
/* Lock page scroll when our Modal is open */
|
|
186
|
+
body.gb-modal-open {
|
|
187
|
+
overflow: hidden !important;
|
|
188
|
+
}
|
|
189
|
+
|
|
183
190
|
html.dark {
|
|
184
191
|
color-scheme: dark;
|
|
185
192
|
}
|
package/src/styles/theme.css
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
--color-background: hsl(var(--background));
|
|
28
28
|
--color-foreground: hsl(var(--foreground));
|
|
29
29
|
--color-card: hsl(var(--card));
|
|
30
|
+
--color-modal: hsl(var(--modal));
|
|
30
31
|
--color-card-foreground: hsl(var(--card-foreground));
|
|
31
32
|
--color-popover: hsl(var(--popover));
|
|
32
33
|
--color-popover-foreground: hsl(var(--popover-foreground));
|
|
@@ -97,4 +98,22 @@
|
|
|
97
98
|
height: 0;
|
|
98
99
|
}
|
|
99
100
|
}
|
|
101
|
+
|
|
102
|
+
@keyframes modalOverlayShow {
|
|
103
|
+
from {
|
|
104
|
+
opacity: 0;
|
|
105
|
+
}
|
|
106
|
+
to {
|
|
107
|
+
opacity: 1;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@keyframes modalContentShow {
|
|
112
|
+
from {
|
|
113
|
+
opacity: 0;
|
|
114
|
+
}
|
|
115
|
+
to {
|
|
116
|
+
opacity: 1;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
100
119
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),v=require("react"),u=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk");function j(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const n=j(v);let l=0,c=null;const x={default:"bg-black/30",dark:"bg-black/0","dark-transparent":"bg-black/85"},d=n.forwardRef(({show:e=!0,theme:r="default",onClickOutside:t,className:o,children:f,...m},b)=>{const[y,s]=n.useState(!1),p=n.useCallback(a=>{a.target===a.currentTarget&&t&&t()},[t]),g=n.useCallback(a=>{a.key==="Escape"&&t&&t()},[t]);return n.useEffect(()=>{if(!e||typeof document>"u")return;const a=document.body;return l===0&&(c=a.classList.contains("overflow-hidden")),l+=1,a.classList.add("overflow-hidden"),()=>{l=Math.max(0,l-1),l===0&&(c||a.classList.remove("overflow-hidden"),c=null)}},[e]),n.useEffect(()=>{if(!e)return;s(!1);const a=requestAnimationFrame(()=>s(!0));return()=>cancelAnimationFrame(a)},[e]),e?i.jsx("div",{className:u.cn("fixed inset-0 z-50",x[r]),children:i.jsx("div",{role:"dialog","aria-modal":"true",className:"overflow-y-auto h-full outline-none flex justify-center items-center",onClick:p,onKeyDown:g,children:i.jsx("div",{ref:b,className:u.cn("relative m-auto py-0 px-0 sm:py-5 transition-opacity duration-[225ms] ease-[cubic-bezier(0.4,0,0.2,1)]",y?"opacity-100":"opacity-0",o),...m,children:f})})}):null});d.displayName="DialogModal";exports.DialogModal=d;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import * as t from "react";
|
|
3
|
-
import { cn as c } from "../../utils/cn.js";
|
|
4
|
-
import "sonner";
|
|
5
|
-
import "@gearbox-protocol/sdk";
|
|
6
|
-
let n = 0, l = null;
|
|
7
|
-
const v = {
|
|
8
|
-
default: "bg-black/30",
|
|
9
|
-
dark: "bg-black/0",
|
|
10
|
-
"dark-transparent": "bg-black/85"
|
|
11
|
-
}, g = t.forwardRef(
|
|
12
|
-
({
|
|
13
|
-
show: r = !0,
|
|
14
|
-
theme: s = "default",
|
|
15
|
-
onClickOutside: a,
|
|
16
|
-
className: d,
|
|
17
|
-
children: f,
|
|
18
|
-
...u
|
|
19
|
-
}, m) => {
|
|
20
|
-
const [y, i] = t.useState(!1), p = t.useCallback(
|
|
21
|
-
(e) => {
|
|
22
|
-
e.target === e.currentTarget && a && a();
|
|
23
|
-
},
|
|
24
|
-
[a]
|
|
25
|
-
), b = t.useCallback(
|
|
26
|
-
(e) => {
|
|
27
|
-
e.key === "Escape" && a && a();
|
|
28
|
-
},
|
|
29
|
-
[a]
|
|
30
|
-
);
|
|
31
|
-
return t.useEffect(() => {
|
|
32
|
-
if (!r || typeof document > "u") return;
|
|
33
|
-
const e = document.body;
|
|
34
|
-
return n === 0 && (l = e.classList.contains("overflow-hidden")), n += 1, e.classList.add("overflow-hidden"), () => {
|
|
35
|
-
n = Math.max(0, n - 1), n === 0 && (l || e.classList.remove("overflow-hidden"), l = null);
|
|
36
|
-
};
|
|
37
|
-
}, [r]), t.useEffect(() => {
|
|
38
|
-
if (!r) return;
|
|
39
|
-
i(!1);
|
|
40
|
-
const e = requestAnimationFrame(() => i(!0));
|
|
41
|
-
return () => cancelAnimationFrame(e);
|
|
42
|
-
}, [r]), r ? /* @__PURE__ */ o("div", { className: c("fixed inset-0 z-50", v[s]), children: /* @__PURE__ */ o(
|
|
43
|
-
"div",
|
|
44
|
-
{
|
|
45
|
-
role: "dialog",
|
|
46
|
-
"aria-modal": "true",
|
|
47
|
-
className: "overflow-y-auto h-full outline-none flex justify-center items-center",
|
|
48
|
-
onClick: p,
|
|
49
|
-
onKeyDown: b,
|
|
50
|
-
children: /* @__PURE__ */ o(
|
|
51
|
-
"div",
|
|
52
|
-
{
|
|
53
|
-
ref: m,
|
|
54
|
-
className: c(
|
|
55
|
-
"relative m-auto py-0 px-0 sm:py-5 transition-opacity duration-[225ms] ease-[cubic-bezier(0.4,0,0.2,1)]",
|
|
56
|
-
y ? "opacity-100" : "opacity-0",
|
|
57
|
-
d
|
|
58
|
-
),
|
|
59
|
-
...u,
|
|
60
|
-
children: f
|
|
61
|
-
}
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
) }) : null;
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
g.displayName = "DialogModal";
|
|
68
|
-
export {
|
|
69
|
-
g as DialogModal
|
|
70
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
type Themes = "default" | "dark" | "dark-transparent";
|
|
3
|
-
export interface DialogModalProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
theme?: Themes;
|
|
5
|
-
/**
|
|
6
|
-
* Whether to show the dialog container
|
|
7
|
-
* When false, renders null
|
|
8
|
-
* @default true
|
|
9
|
-
*/
|
|
10
|
-
show?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Callback when clicking outside the container (on the overlay)
|
|
13
|
-
* Only works when used as a modal overlay
|
|
14
|
-
*/
|
|
15
|
-
onClickOutside: () => void;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* DialogModal component for responsive content width within dialogs
|
|
19
|
-
* Follows the same pattern as Container from layout/container
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```tsx
|
|
23
|
-
* // With show/hide control
|
|
24
|
-
* <DialogModal show={isOpen} onClickOutside={handleClose}>
|
|
25
|
-
* <Content />
|
|
26
|
-
* </DialogModal>
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
declare const DialogModal: React.ForwardRefExoticComponent<DialogModalProps & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
-
export { DialogModal };
|