@gardenfi/garden-book 0.3.1 → 0.3.3
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/BottomSheet/BottomSheet.d.ts +8 -0
- package/dist/BottomSheet/index.js +49 -15
- package/dist/Checkbox/Checkbox.d.ts +1 -0
- package/dist/Checkbox/Checkbox.js +33 -5
- package/dist/CookieConsent/CookieConsent.d.ts +25 -0
- package/dist/CookieConsent/CookieConsent.js +75 -0
- package/dist/CookieConsent/CookieConsentNotice.d.ts +8 -0
- package/dist/CookieConsent/CookieConsentNotice.js +55 -0
- package/dist/CookieConsent/CookieConsentPreferences.d.ts +10 -0
- package/dist/CookieConsent/CookieConsentPreferences.js +75 -0
- package/dist/CookieConsent/index.d.ts +5 -0
- package/dist/CookieConsent/index.js +8 -0
- package/dist/CookieConsent/store.d.ts +19 -0
- package/dist/CookieConsent/store.js +42 -0
- package/dist/CookieConsent/useCookieConsent.d.ts +23 -0
- package/dist/CookieConsent/useCookieConsent.js +31 -0
- package/dist/CookieConsent/utils.d.ts +66 -0
- package/dist/CookieConsent/utils.js +150 -0
- package/dist/DashboardLayout/DashboardSidebar.js +5 -5
- package/dist/DashboardLayout/MobileMenu.js +74 -66
- package/dist/Modal/Modal.d.ts +3 -0
- package/dist/Modal/index.js +21 -21
- package/dist/ResponsiveModal/ResponsiveModal.d.ts +29 -1
- package/dist/ResponsiveModal/index.js +75 -53
- package/dist/index.d.ts +44 -43
- package/dist/index.js +197 -191
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
const g = [
|
|
2
|
+
{
|
|
3
|
+
id: "essential",
|
|
4
|
+
title: "Essential",
|
|
5
|
+
description: "Blocks DDoS attacks and prevents abuse.",
|
|
6
|
+
locked: !0
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
id: "analytics",
|
|
10
|
+
title: "Analytics & Customization",
|
|
11
|
+
description: "Session behaviour and product analytics to help us improve the app."
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: "functional",
|
|
15
|
+
title: "Performance & Functional",
|
|
16
|
+
description: "Traffic sources to help us understand how people discover Garden."
|
|
17
|
+
}
|
|
18
|
+
], u = "garden:consentchange", i = "garden_consent", o = {
|
|
19
|
+
cookieDomain: ".garden.finance",
|
|
20
|
+
storageVersion: 1,
|
|
21
|
+
expiryMonths: 13,
|
|
22
|
+
cookieMaxAgeDays: 400
|
|
23
|
+
};
|
|
24
|
+
function y(n) {
|
|
25
|
+
n && Object.assign(o, n);
|
|
26
|
+
}
|
|
27
|
+
const d = "2026-06-12", l = 60;
|
|
28
|
+
function _() {
|
|
29
|
+
const n = new Date(d).getTime();
|
|
30
|
+
return Number.isNaN(n) ? !1 : Date.now() < n + l * 24 * 60 * 60 * 1e3;
|
|
31
|
+
}
|
|
32
|
+
function w() {
|
|
33
|
+
try {
|
|
34
|
+
const n = document.cookie.match(
|
|
35
|
+
new RegExp("(?:^|; )" + i + "=([^;]*)")
|
|
36
|
+
);
|
|
37
|
+
return n ? JSON.parse(decodeURIComponent(n[1])) : null;
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function h(n) {
|
|
43
|
+
return !n || n.version !== o.storageVersion ? !1 : Date.now() - (n.timestamp || 0) <= o.expiryMonths * 30 * 24 * 60 * 60 * 1e3;
|
|
44
|
+
}
|
|
45
|
+
function f(n) {
|
|
46
|
+
const t = encodeURIComponent(JSON.stringify(n)), e = o.cookieMaxAgeDays * 24 * 60 * 60;
|
|
47
|
+
document.cookie = i + "=" + t + "; domain=" + o.cookieDomain + "; path=/; max-age=" + e + "; SameSite=Lax; Secure";
|
|
48
|
+
}
|
|
49
|
+
function C(n) {
|
|
50
|
+
const t = {
|
|
51
|
+
essential: !0,
|
|
52
|
+
analytics: !!n.analytics,
|
|
53
|
+
functional: !!n.functional,
|
|
54
|
+
timestamp: Date.now(),
|
|
55
|
+
version: o.storageVersion
|
|
56
|
+
};
|
|
57
|
+
return f(t), t;
|
|
58
|
+
}
|
|
59
|
+
const s = [
|
|
60
|
+
/^_ga(_.*)?$/,
|
|
61
|
+
// GA4: _ga and _ga_<measurementId>
|
|
62
|
+
/^original_referrer$/,
|
|
63
|
+
// Garden telemetry
|
|
64
|
+
/^original_landing_url$/
|
|
65
|
+
// Garden telemetry
|
|
66
|
+
], c = [
|
|
67
|
+
/^ph_.*$/,
|
|
68
|
+
// PostHog
|
|
69
|
+
/^_clck$/,
|
|
70
|
+
// MS Clarity
|
|
71
|
+
/^_clsk$/
|
|
72
|
+
// MS Clarity
|
|
73
|
+
];
|
|
74
|
+
function r() {
|
|
75
|
+
return typeof document > "u" || !document.cookie ? [] : document.cookie.split(";").map((n) => n.split("=")[0].trim());
|
|
76
|
+
}
|
|
77
|
+
function E() {
|
|
78
|
+
const n = [
|
|
79
|
+
...s,
|
|
80
|
+
...c
|
|
81
|
+
];
|
|
82
|
+
return r().some((t) => n.some((e) => e.test(t)));
|
|
83
|
+
}
|
|
84
|
+
function p(n) {
|
|
85
|
+
[
|
|
86
|
+
"",
|
|
87
|
+
"; domain=" + o.cookieDomain,
|
|
88
|
+
typeof location < "u" ? "; domain=" + location.hostname : ""
|
|
89
|
+
].forEach((e) => {
|
|
90
|
+
document.cookie = n + "=; path=/; max-age=0" + e;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function k(n) {
|
|
94
|
+
const t = [];
|
|
95
|
+
n.analytics || t.push(...s), n.functional || t.push(...c), t.length && r().forEach((e) => {
|
|
96
|
+
t.some((a) => a.test(e)) && p(e);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function D(n) {
|
|
100
|
+
const t = n.analytics ? "granted" : "denied", e = n.functional ? "granted" : "denied", a = window;
|
|
101
|
+
typeof a.gtag == "function" && a.gtag("consent", "update", {
|
|
102
|
+
analytics_storage: t,
|
|
103
|
+
personalization_storage: t,
|
|
104
|
+
functionality_storage: e,
|
|
105
|
+
ad_storage: "denied",
|
|
106
|
+
ad_user_data: "denied",
|
|
107
|
+
ad_personalization: "denied"
|
|
108
|
+
}), a.dataLayer = a.dataLayer || [], a.dataLayer.push({
|
|
109
|
+
event: "consent_update",
|
|
110
|
+
analytics_consent: t,
|
|
111
|
+
functional_consent: e
|
|
112
|
+
});
|
|
113
|
+
try {
|
|
114
|
+
window.dispatchEvent(
|
|
115
|
+
new CustomEvent(u, {
|
|
116
|
+
detail: { analytics: n.analytics, functional: n.functional }
|
|
117
|
+
})
|
|
118
|
+
);
|
|
119
|
+
} catch {
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function m() {
|
|
123
|
+
if (typeof window > "u") return "www";
|
|
124
|
+
const n = window.location.hostname;
|
|
125
|
+
return n.includes("localhost") || n.includes("127.0.0.1") ? "localhost" : n === "app.garden.finance" ? "app" : "www";
|
|
126
|
+
}
|
|
127
|
+
function O(n) {
|
|
128
|
+
return n.analytics && n.functional ? "accept_all" : !n.analytics && !n.functional ? "reject_all" : "partial";
|
|
129
|
+
}
|
|
130
|
+
function A(n, t = {}) {
|
|
131
|
+
if (typeof window > "u") return;
|
|
132
|
+
const e = window;
|
|
133
|
+
e.dataLayer = e.dataLayer || [], e.dataLayer.push({ event: n, consent_surface: m(), ...t });
|
|
134
|
+
}
|
|
135
|
+
export {
|
|
136
|
+
u as CONSENT_EVENT,
|
|
137
|
+
g as DEFAULT_COOKIE_CATEGORIES,
|
|
138
|
+
D as applyConsent,
|
|
139
|
+
k as clearDeniedCookies,
|
|
140
|
+
o as config,
|
|
141
|
+
y as configure,
|
|
142
|
+
O as consentDecision,
|
|
143
|
+
m as consentSurface,
|
|
144
|
+
E as hasTrackingCookies,
|
|
145
|
+
h as isValidConsent,
|
|
146
|
+
_ as isWithinAutoConsentWindow,
|
|
147
|
+
w as readRaw,
|
|
148
|
+
A as trackConsentEvent,
|
|
149
|
+
C as writeConsent
|
|
150
|
+
};
|
|
@@ -19,9 +19,9 @@ const T = (t, i) => /* @__PURE__ */ e("a", { href: t, children: i }), Q = ({
|
|
|
19
19
|
renderLink: h = T,
|
|
20
20
|
className: N
|
|
21
21
|
}) => {
|
|
22
|
-
const [p, u] = v(!1), [w, l] = v(!1),
|
|
22
|
+
const [p, u] = v(!1), [w, l] = v(!1), k = () => {
|
|
23
23
|
u(!1), y ? l(!0) : m();
|
|
24
|
-
},
|
|
24
|
+
}, I = () => {
|
|
25
25
|
l(!1), s == null || s();
|
|
26
26
|
};
|
|
27
27
|
return /* @__PURE__ */ r(F, { children: [
|
|
@@ -95,7 +95,7 @@ const T = (t, i) => /* @__PURE__ */ e("a", { href: t, children: i }), Q = ({
|
|
|
95
95
|
children: /* @__PURE__ */ r(
|
|
96
96
|
O,
|
|
97
97
|
{
|
|
98
|
-
onSelect:
|
|
98
|
+
onSelect: k,
|
|
99
99
|
className: "gf-flex gf-items-center gf-gap-1 gf-p-1 gf-cursor-pointer hover:gf-bg-[#EDF6FC] focus:gf-bg-[#EDF6FC] data-[highlighted]:gf-bg-[#EDF6FC] gf-rounded-md gf-transition-colors focus:gf-outline-none",
|
|
100
100
|
children: [
|
|
101
101
|
/* @__PURE__ */ e("div", { className: "gf-rounded-lg gf-flex gf-items-center gf-justify-center gf-shrink-0", children: /* @__PURE__ */ e(U, { className: "gf-h-4 gf-w-4 gf-text-primaryIris gf-ml-[14px] gf-mr-2" }) }),
|
|
@@ -113,9 +113,9 @@ const T = (t, i) => /* @__PURE__ */ e("a", { href: t, children: i }), Q = ({
|
|
|
113
113
|
S,
|
|
114
114
|
{
|
|
115
115
|
open: w,
|
|
116
|
-
onClose:
|
|
116
|
+
onClose: I,
|
|
117
117
|
label: "Ready to sign out?",
|
|
118
|
-
className: "gf-max-w-sm",
|
|
118
|
+
desktopModal: { className: "gf-max-w-sm" },
|
|
119
119
|
children: [
|
|
120
120
|
/* @__PURE__ */ e(o, { size: "h5", weight: "regular", children: "You'll be signed out and redirected to the login page." }),
|
|
121
121
|
/* @__PURE__ */ e(
|
|
@@ -1,117 +1,125 @@
|
|
|
1
|
-
import { jsxs as a, Fragment as
|
|
1
|
+
import { jsxs as a, Fragment as O, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useState as m } from "react";
|
|
3
|
-
import { HamburgerIcon as
|
|
3
|
+
import { HamburgerIcon as C } from "../HamburgerIcon/index.js";
|
|
4
4
|
import { ResponsiveModal as w } from "../ResponsiveModal/index.js";
|
|
5
5
|
import { Typography as t } from "../Typography/index.js";
|
|
6
|
-
import { Button as
|
|
6
|
+
import { Button as S } from "../Button/index.js";
|
|
7
7
|
import { cn as j } from "../utils/index.js";
|
|
8
8
|
import I from "../node_modules/lucide-react/dist/esm/icons/log-out.js";
|
|
9
|
-
const R = ({ title: i, isOpen:
|
|
10
|
-
/* @__PURE__ */ e("span", { onClick:
|
|
9
|
+
const R = ({ title: i, isOpen: s, onToggle: f, children: n }) => /* @__PURE__ */ a("div", { children: [
|
|
10
|
+
/* @__PURE__ */ e("span", { onClick: f, className: "gf-block gf-cursor-pointer", children: /* @__PURE__ */ e(t, { size: "h3", weight: "medium", children: i }) }),
|
|
11
11
|
/* @__PURE__ */ e(
|
|
12
12
|
"div",
|
|
13
13
|
{
|
|
14
14
|
className: j(
|
|
15
15
|
"gf-grid gf-transition-[grid-template-rows,opacity] gf-duration-500 gf-ease-[cubic-bezier(0.22,1,0.36,1)]",
|
|
16
|
-
|
|
16
|
+
s ? "gf-grid-rows-[1fr] gf-opacity-100" : "gf-grid-rows-[0fr] gf-opacity-0"
|
|
17
17
|
),
|
|
18
|
-
children: /* @__PURE__ */ e("div", { className: "gf-overflow-hidden", children: /* @__PURE__ */ e("div", { className: "gf-ml-6 gf-flex gf-flex-col", children:
|
|
18
|
+
children: /* @__PURE__ */ e("div", { className: "gf-overflow-hidden", children: /* @__PURE__ */ e("div", { className: "gf-ml-6 gf-flex gf-flex-col", children: n }) })
|
|
19
19
|
}
|
|
20
20
|
)
|
|
21
21
|
] }), A = ({
|
|
22
22
|
navGroups: i,
|
|
23
|
-
activePath:
|
|
24
|
-
onNavigate:
|
|
25
|
-
onLogout:
|
|
23
|
+
activePath: s,
|
|
24
|
+
onNavigate: f,
|
|
25
|
+
onLogout: n,
|
|
26
26
|
showLogoutConfirm: N = !1,
|
|
27
27
|
onLogoutConfirmClose: c
|
|
28
28
|
}) => {
|
|
29
29
|
var b;
|
|
30
|
-
const [
|
|
30
|
+
const [p, h] = m(!1), [y, g] = m(!1), [k, u] = m(
|
|
31
31
|
((b = i[0]) == null ? void 0 : b.label) ?? "group-0"
|
|
32
32
|
), d = () => {
|
|
33
33
|
var l;
|
|
34
|
-
|
|
34
|
+
h(!1), u(((l = i[0]) == null ? void 0 : l.label) ?? "group-0");
|
|
35
35
|
}, v = () => {
|
|
36
|
-
d(), N ? g(!0) :
|
|
36
|
+
d(), N ? g(!0) : n();
|
|
37
37
|
}, z = () => {
|
|
38
38
|
g(!1), c == null || c();
|
|
39
39
|
};
|
|
40
|
-
return /* @__PURE__ */ a(
|
|
40
|
+
return /* @__PURE__ */ a(O, { children: [
|
|
41
41
|
/* @__PURE__ */ e(
|
|
42
42
|
"button",
|
|
43
43
|
{
|
|
44
44
|
type: "button",
|
|
45
|
-
onClick: () =>
|
|
45
|
+
onClick: () => h((l) => !l),
|
|
46
46
|
"aria-label": "Open menu",
|
|
47
47
|
className: "gf-shrink-0",
|
|
48
|
-
children: /* @__PURE__ */ e(
|
|
48
|
+
children: /* @__PURE__ */ e(C, { isOpen: p })
|
|
49
49
|
}
|
|
50
50
|
),
|
|
51
|
-
/* @__PURE__ */ a(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
t,
|
|
51
|
+
/* @__PURE__ */ a(
|
|
52
|
+
w,
|
|
53
|
+
{
|
|
54
|
+
open: p,
|
|
55
|
+
onClose: d,
|
|
56
|
+
desktopModal: { className: "gf-w-full" },
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ e("nav", { className: "gf-flex gf-flex-col gf-gap-4 gf-p-6 gf-bg-white/30 gf-rounded-xl", children: i.map((l, M) => {
|
|
59
|
+
const o = l.label ?? `group-${M}`;
|
|
60
|
+
return /* @__PURE__ */ e(
|
|
61
|
+
R,
|
|
62
|
+
{
|
|
63
|
+
title: l.label ?? "Navigation",
|
|
64
|
+
isOpen: k === o,
|
|
65
|
+
onToggle: () => u((r) => r === o ? "" : o),
|
|
66
|
+
children: l.items.map((r) => {
|
|
67
|
+
const x = s === r.href || s === `${r.href}/`;
|
|
68
|
+
return /* @__PURE__ */ e(
|
|
69
|
+
"div",
|
|
71
70
|
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
71
|
+
className: "gf-cursor-pointer gf-pt-4",
|
|
72
|
+
onClick: () => {
|
|
73
|
+
f(r.href), d();
|
|
74
|
+
},
|
|
75
|
+
children: /* @__PURE__ */ e(
|
|
76
|
+
t,
|
|
77
|
+
{
|
|
78
|
+
size: "h3",
|
|
79
|
+
weight: x ? "medium" : "regular",
|
|
80
|
+
className: x ? "gf-text-primaryIris" : "gf-text-dark-grey",
|
|
81
|
+
children: r.title
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
},
|
|
85
|
+
r.href
|
|
86
|
+
);
|
|
87
|
+
})
|
|
88
|
+
},
|
|
89
|
+
o
|
|
90
|
+
);
|
|
91
|
+
}) }),
|
|
92
|
+
/* @__PURE__ */ e("nav", { className: "gf-py-5 gf-px-6 gf-bg-white/30 gf-rounded-xl", children: /* @__PURE__ */ a(
|
|
93
|
+
"button",
|
|
94
|
+
{
|
|
95
|
+
type: "button",
|
|
96
|
+
onClick: v,
|
|
97
|
+
className: "gf-flex gf-w-full gf-cursor-pointer gf-items-center gf-gap-2 focus:gf-outline-none",
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ e(I, { className: "gf-h-5 gf-w-5" }),
|
|
100
|
+
/* @__PURE__ */ e(t, { size: "h3", weight: "medium", children: "Log out" })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
) })
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
),
|
|
99
107
|
/* @__PURE__ */ a(
|
|
100
108
|
w,
|
|
101
109
|
{
|
|
102
110
|
open: y,
|
|
103
111
|
onClose: z,
|
|
104
112
|
label: "Ready to sign out?",
|
|
105
|
-
className: "gf-max-w-sm",
|
|
113
|
+
desktopModal: { className: "gf-max-w-sm" },
|
|
106
114
|
children: [
|
|
107
115
|
/* @__PURE__ */ e("div", { className: "gf-flex gf-flex-col gf-gap-2", children: /* @__PURE__ */ e(t, { size: "h5", weight: "regular", children: "You'll be signed out and redirected to the login page." }) }),
|
|
108
116
|
/* @__PURE__ */ e(
|
|
109
|
-
|
|
117
|
+
S,
|
|
110
118
|
{
|
|
111
119
|
variant: "primary",
|
|
112
120
|
className: "gf-w-full",
|
|
113
121
|
onClick: () => {
|
|
114
|
-
g(!1),
|
|
122
|
+
g(!1), n();
|
|
115
123
|
},
|
|
116
124
|
children: "Sign out"
|
|
117
125
|
}
|
package/dist/Modal/Modal.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ type ModalProps = VariantProps<typeof modalStyles> & {
|
|
|
9
9
|
onClose?: () => void;
|
|
10
10
|
children: React.ReactNode;
|
|
11
11
|
disableScrollLock?: boolean;
|
|
12
|
+
/** Extra classes for the full-screen overlay — use to change alignment
|
|
13
|
+
* (e.g. `!gf-items-end !gf-justify-start` to dock the card bottom-left). */
|
|
14
|
+
overlayClassName?: string;
|
|
12
15
|
};
|
|
13
16
|
declare const Modal: React.FC<ModalProps> & {
|
|
14
17
|
Children: React.FC<ChildrenProps>;
|
package/dist/Modal/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { cva as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { Opacity as
|
|
5
|
-
import { RemoveScroll as
|
|
6
|
-
import { ClientOnly as
|
|
7
|
-
const
|
|
2
|
+
import { cva as c } from "class-variance-authority";
|
|
3
|
+
import { useState as g, useEffect as m } from "react";
|
|
4
|
+
import { Opacity as d } from "../Opacity/index.js";
|
|
5
|
+
import { RemoveScroll as p } from "react-remove-scroll";
|
|
6
|
+
import { ClientOnly as u } from "../ClientOnly/index.js";
|
|
7
|
+
const h = c(
|
|
8
8
|
[
|
|
9
9
|
"gf-fixed gf-inset-0 gf-z-50 gf-flex gf-items-center gf-justify-center gf-min-h-screen gf-transition-all"
|
|
10
10
|
],
|
|
@@ -19,37 +19,37 @@ const u = s(
|
|
|
19
19
|
open: !1
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
),
|
|
23
|
-
const [
|
|
24
|
-
|
|
25
|
-
e &&
|
|
22
|
+
), v = ({ open: e, onClose: a, disableScrollLock: r, overlayClassName: o, children: i }) => {
|
|
23
|
+
const [n, f] = g(!1);
|
|
24
|
+
m(() => {
|
|
25
|
+
e && f(!0);
|
|
26
26
|
}, [e]);
|
|
27
|
-
const
|
|
28
|
-
a && (
|
|
27
|
+
const l = (s) => {
|
|
28
|
+
a && (s.stopPropagation(), a());
|
|
29
29
|
};
|
|
30
|
-
return /* @__PURE__ */ t(
|
|
30
|
+
return /* @__PURE__ */ t(u, { children: /* @__PURE__ */ t(p, { removeScrollBar: !1, enabled: !!e && !r, children: /* @__PURE__ */ t(
|
|
31
31
|
"div",
|
|
32
32
|
{
|
|
33
|
-
className: `gf-bg-dark-grey gf-bg-opacity-40 ${
|
|
33
|
+
className: `gf-bg-dark-grey gf-bg-opacity-40 ${h({
|
|
34
34
|
open: e
|
|
35
|
-
})} ${
|
|
36
|
-
onClick:
|
|
35
|
+
})} ${n ? e ? "gf-animate-fade-in " : "gf-animate-fade-out" : ""} ${o ?? ""}`,
|
|
36
|
+
onClick: l,
|
|
37
37
|
children: /* @__PURE__ */ t(
|
|
38
38
|
"div",
|
|
39
39
|
{
|
|
40
40
|
className: `gf-transform gf-transition-transform ${e ? "gf-animate-scale-in" : "gf-animate-scale-out"}`,
|
|
41
|
-
children:
|
|
41
|
+
children: i
|
|
42
42
|
}
|
|
43
43
|
)
|
|
44
44
|
}
|
|
45
45
|
) }) });
|
|
46
|
-
},
|
|
46
|
+
}, y = ({
|
|
47
47
|
children: e,
|
|
48
48
|
className: a,
|
|
49
49
|
opacityLevel: r,
|
|
50
50
|
...o
|
|
51
51
|
}) => /* @__PURE__ */ t(
|
|
52
|
-
|
|
52
|
+
d,
|
|
53
53
|
{
|
|
54
54
|
level: r,
|
|
55
55
|
onClick: (n) => {
|
|
@@ -60,7 +60,7 @@ const u = s(
|
|
|
60
60
|
children: e
|
|
61
61
|
}
|
|
62
62
|
);
|
|
63
|
-
|
|
63
|
+
v.Children = y;
|
|
64
64
|
export {
|
|
65
|
-
|
|
65
|
+
v as Modal
|
|
66
66
|
};
|
|
@@ -1,13 +1,41 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
type OpacityVariants = "extra-light" | "light" | "medium" | "semi-dark" | "full";
|
|
4
|
+
/** Desktop Modal config. Defaults: dimmed overlay, closes on outside
|
|
5
|
+
* click, X shown, page scroll-locked. */
|
|
6
|
+
export type DesktopModalConfig = {
|
|
7
|
+
/** Classes for the modal card. */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Classes for the full-screen overlay */
|
|
10
|
+
overlayClassName?: string;
|
|
11
|
+
/** When `true`, force a choice — hide the close (X) button AND don't close on
|
|
12
|
+
* outside click. */
|
|
13
|
+
preventClose?: boolean;
|
|
14
|
+
/** When `true`, the page is NOT scroll-locked while open. */
|
|
15
|
+
disableScrollLock?: boolean;
|
|
16
|
+
};
|
|
17
|
+
/** Mobile BottomSheet config. Defaults: dim backdrop, dismissible
|
|
18
|
+
* by tap-outside / drag, page behind blocked, scroll-locked. */
|
|
19
|
+
export type MobileBottomSheetConfig = {
|
|
20
|
+
/** Classes for the sheet content panel. */
|
|
21
|
+
className?: string;
|
|
22
|
+
/** Classes for the backdrop */
|
|
23
|
+
overlayClassName?: string;
|
|
24
|
+
/** When `true`, the sheet can't be dismissed by tap-outside / drag — force a choice. */
|
|
25
|
+
preventClose?: boolean;
|
|
26
|
+
/** When `true`, the page behind the sheet stays interactive. */
|
|
27
|
+
allowBackgroundInteraction?: boolean;
|
|
28
|
+
/** When `true`, the page is NOT scroll-locked while open. */
|
|
29
|
+
disableScrollLock?: boolean;
|
|
30
|
+
};
|
|
4
31
|
export type ResponsiveModalProps = {
|
|
5
32
|
open: boolean;
|
|
6
33
|
onClose: () => void;
|
|
7
34
|
label?: string;
|
|
8
35
|
children: ReactNode;
|
|
9
36
|
opacityLevel?: OpacityVariants;
|
|
10
|
-
|
|
37
|
+
desktopModal?: DesktopModalConfig;
|
|
38
|
+
mobileBottomSheet?: MobileBottomSheetConfig;
|
|
11
39
|
};
|
|
12
40
|
/** Modal on desktop, vaul BottomSheet on mobile. Reads viewport from `ViewportProvider`. Portals into `document.body`. */
|
|
13
41
|
export declare const ResponsiveModal: FC<ResponsiveModalProps>;
|
|
@@ -1,62 +1,84 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { Modal as
|
|
5
|
-
import { BottomSheet as
|
|
6
|
-
import { Typography as
|
|
7
|
-
import { CloseIcon as
|
|
8
|
-
import { useViewport as
|
|
9
|
-
import { cn as
|
|
10
|
-
const
|
|
11
|
-
open:
|
|
12
|
-
onClose:
|
|
13
|
-
label:
|
|
14
|
-
children:
|
|
15
|
-
opacityLevel:
|
|
16
|
-
|
|
1
|
+
import { jsx as c, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import { useState as l, useEffect as L } from "react";
|
|
3
|
+
import { createPortal as a } from "react-dom";
|
|
4
|
+
import { Modal as v } from "../Modal/index.js";
|
|
5
|
+
import { BottomSheet as j } from "../BottomSheet/index.js";
|
|
6
|
+
import { Typography as I } from "../Typography/index.js";
|
|
7
|
+
import { CloseIcon as C } from "../Icons/CloseIcon.js";
|
|
8
|
+
import { useViewport as z } from "../Viewport/index.js";
|
|
9
|
+
import { cn as E } from "../utils/index.js";
|
|
10
|
+
const H = ({
|
|
11
|
+
open: i,
|
|
12
|
+
onClose: n,
|
|
13
|
+
label: s,
|
|
14
|
+
children: g,
|
|
15
|
+
opacityLevel: N = "medium",
|
|
16
|
+
desktopModal: r,
|
|
17
|
+
mobileBottomSheet: f
|
|
17
18
|
}) => {
|
|
18
|
-
const
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
}, []),
|
|
22
|
-
/* @__PURE__ */
|
|
19
|
+
const w = z() === "mobile", [x, y] = l(!1);
|
|
20
|
+
return L(() => {
|
|
21
|
+
y(!0);
|
|
22
|
+
}, []), x ? w ? i ? a(
|
|
23
|
+
/* @__PURE__ */ c(
|
|
24
|
+
j,
|
|
25
|
+
{
|
|
26
|
+
open: i,
|
|
27
|
+
onOpenChange: n,
|
|
28
|
+
className: f == null ? void 0 : f.className,
|
|
29
|
+
overlayClassName: f == null ? void 0 : f.overlayClassName,
|
|
30
|
+
dismissible: !(f != null && f.preventClose),
|
|
31
|
+
modal: !(f != null && f.allowBackgroundInteraction),
|
|
32
|
+
disableScrollLock: f == null ? void 0 : f.disableScrollLock,
|
|
33
|
+
children: g
|
|
34
|
+
}
|
|
35
|
+
),
|
|
23
36
|
document.body
|
|
24
|
-
) : null :
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
|
|
37
|
+
) : null : a(
|
|
38
|
+
/* @__PURE__ */ c(
|
|
39
|
+
v,
|
|
27
40
|
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
41
|
+
open: i,
|
|
42
|
+
onClose: r != null && r.preventClose ? void 0 : n,
|
|
43
|
+
overlayClassName: r == null ? void 0 : r.overlayClassName,
|
|
44
|
+
disableScrollLock: r == null ? void 0 : r.disableScrollLock,
|
|
45
|
+
children: /* @__PURE__ */ u(
|
|
46
|
+
v.Children,
|
|
47
|
+
{
|
|
48
|
+
opacityLevel: N,
|
|
49
|
+
className: E(
|
|
50
|
+
"gf-relative gf-flex gf-w-[500px] gf-flex-col gf-gap-4 gf-rounded-2xl gf-p-4",
|
|
51
|
+
r == null ? void 0 : r.className
|
|
52
|
+
),
|
|
53
|
+
children: [
|
|
54
|
+
s && /* @__PURE__ */ u("div", { className: "gf-flex gf-items-center gf-justify-between", children: [
|
|
55
|
+
/* @__PURE__ */ c(I, { size: "h4", weight: "medium", children: s }),
|
|
56
|
+
!(r != null && r.preventClose) && /* @__PURE__ */ c(
|
|
57
|
+
C,
|
|
58
|
+
{
|
|
59
|
+
className: "gf-h-3 gf-w-3 gf-fill-primaryIris gf-cursor-pointer",
|
|
60
|
+
onClick: n
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] }),
|
|
64
|
+
!s && !(r != null && r.preventClose) && /* @__PURE__ */ c(
|
|
65
|
+
"button",
|
|
66
|
+
{
|
|
67
|
+
onClick: n,
|
|
68
|
+
className: "gf-absolute gf-right-4 gf-top-4 gf-cursor-pointer gf-text-white/50 gf-transition-colors hover:gf-text-white",
|
|
69
|
+
"aria-label": "Close",
|
|
70
|
+
children: /* @__PURE__ */ c(C, { className: "gf-h-4 gf-w-4" })
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
g
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
)
|
|
55
77
|
}
|
|
56
|
-
)
|
|
78
|
+
),
|
|
57
79
|
document.body
|
|
58
80
|
) : null;
|
|
59
81
|
};
|
|
60
82
|
export {
|
|
61
|
-
|
|
83
|
+
H as ResponsiveModal
|
|
62
84
|
};
|