@gardenfi/garden-book 0.3.2 → 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.
@@ -1,117 +1,125 @@
1
- import { jsxs as a, Fragment as C, jsx as e } from "react/jsx-runtime";
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 S } from "../HamburgerIcon/index.js";
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 M } from "../Button/index.js";
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: n, onToggle: o, children: s }) => /* @__PURE__ */ a("div", { children: [
10
- /* @__PURE__ */ e("span", { onClick: o, className: "gf-block gf-cursor-pointer", children: /* @__PURE__ */ e(t, { size: "h3", weight: "medium", children: i }) }),
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
- n ? "gf-grid-rows-[1fr] gf-opacity-100" : "gf-grid-rows-[0fr] gf-opacity-0"
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: s }) })
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: n,
24
- onNavigate: o,
25
- onLogout: s,
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 [h, p] = m(!1), [y, g] = m(!1), [k, u] = m(
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
- p(!1), u(((l = i[0]) == null ? void 0 : l.label) ?? "group-0");
34
+ h(!1), u(((l = i[0]) == null ? void 0 : l.label) ?? "group-0");
35
35
  }, v = () => {
36
- d(), N ? g(!0) : s();
36
+ d(), N ? g(!0) : n();
37
37
  }, z = () => {
38
38
  g(!1), c == null || c();
39
39
  };
40
- return /* @__PURE__ */ a(C, { children: [
40
+ return /* @__PURE__ */ a(O, { children: [
41
41
  /* @__PURE__ */ e(
42
42
  "button",
43
43
  {
44
44
  type: "button",
45
- onClick: () => p((l) => !l),
45
+ onClick: () => h((l) => !l),
46
46
  "aria-label": "Open menu",
47
47
  className: "gf-shrink-0",
48
- children: /* @__PURE__ */ e(S, { isOpen: h })
48
+ children: /* @__PURE__ */ e(C, { isOpen: p })
49
49
  }
50
50
  ),
51
- /* @__PURE__ */ a(w, { open: h, onClose: d, className: "gf-w-full", children: [
52
- /* @__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, O) => {
53
- const f = l.label ?? `group-${O}`;
54
- return /* @__PURE__ */ e(
55
- R,
56
- {
57
- title: l.label ?? "Navigation",
58
- isOpen: k === f,
59
- onToggle: () => u((r) => r === f ? "" : f),
60
- children: l.items.map((r) => {
61
- const x = n === r.href || n === `${r.href}/`;
62
- return /* @__PURE__ */ e(
63
- "div",
64
- {
65
- className: "gf-cursor-pointer gf-pt-4",
66
- onClick: () => {
67
- o(r.href), d();
68
- },
69
- children: /* @__PURE__ */ e(
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
- size: "h3",
73
- weight: x ? "medium" : "regular",
74
- className: x ? "gf-text-primaryIris" : "gf-text-dark-grey",
75
- children: r.title
76
- }
77
- )
78
- },
79
- r.href
80
- );
81
- })
82
- },
83
- f
84
- );
85
- }) }),
86
- /* @__PURE__ */ e("nav", { className: "gf-py-5 gf-px-6 gf-bg-white/30 gf-rounded-xl", children: /* @__PURE__ */ a(
87
- "button",
88
- {
89
- type: "button",
90
- onClick: v,
91
- className: "gf-flex gf-w-full gf-cursor-pointer gf-items-center gf-gap-2 focus:gf-outline-none",
92
- children: [
93
- /* @__PURE__ */ e(I, { className: "gf-h-5 gf-w-5" }),
94
- /* @__PURE__ */ e(t, { size: "h3", weight: "medium", children: "Log out" })
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
- M,
117
+ S,
110
118
  {
111
119
  variant: "primary",
112
120
  className: "gf-w-full",
113
121
  onClick: () => {
114
- g(!1), s();
122
+ g(!1), n();
115
123
  },
116
124
  children: "Sign out"
117
125
  }
@@ -1,23 +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
- className?: string;
11
- /** Hide the close (X) button — for modals that must force a choice. Also makes
12
- * the mobile BottomSheet non-dismissible (no tap-outside / drag-to-close). */
13
- hideCloseBtn?: boolean;
14
- /** Extra classes for the overlay/backdrop — desktop Modal and mobile
15
- * BottomSheet alike */
16
- overlayClassName?: string;
17
- /** Mobile BottomSheet only. When `true`, the page behind stays interactive. Default `false`. */
18
- bottomSheetAllowBackgroundInteraction?: boolean;
19
- /** When `true`, the page is NOT scroll-locked while open. */
20
- disableScrollLock?: boolean;
37
+ desktopModal?: DesktopModalConfig;
38
+ mobileBottomSheet?: MobileBottomSheetConfig;
21
39
  };
22
40
  /** Modal on desktop, vaul BottomSheet on mobile. Reads viewport from `ViewportProvider`. Portals into `document.body`. */
23
41
  export declare const ResponsiveModal: FC<ResponsiveModalProps>;
@@ -1,77 +1,76 @@
1
- import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
- import { useState as x, useEffect as b } from "react";
3
- import { createPortal as g } from "react-dom";
4
- import { Modal as n } from "../Modal/index.js";
5
- import { BottomSheet as v } from "../BottomSheet/index.js";
6
- import { Typography as y } from "../Typography/index.js";
7
- import { CloseIcon as l } from "../Icons/CloseIcon.js";
8
- import { useViewport as M } from "../Viewport/index.js";
9
- import { cn as N } from "../utils/index.js";
10
- const V = ({
11
- open: t,
12
- onClose: r,
13
- label: o,
14
- children: f,
15
- opacityLevel: c = "medium",
16
- className: a,
17
- hideCloseBtn: i,
18
- overlayClassName: m,
19
- bottomSheetAllowBackgroundInteraction: p,
20
- disableScrollLock: u
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
21
18
  }) => {
22
- const d = M() === "mobile", [h, w] = x(!1);
23
- return b(() => {
24
- w(!0);
25
- }, []), h ? d ? t ? g(
26
- /* @__PURE__ */ e(
27
- v,
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,
28
25
  {
29
- open: t,
30
- onOpenChange: r,
31
- overlayClassName: m,
32
- dismissible: !i,
33
- modal: !p,
34
- children: f
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
35
34
  }
36
35
  ),
37
36
  document.body
38
- ) : null : g(
39
- /* @__PURE__ */ e(
40
- n,
37
+ ) : null : a(
38
+ /* @__PURE__ */ c(
39
+ v,
41
40
  {
42
- open: t,
43
- onClose: r,
44
- overlayClassName: m,
45
- disableScrollLock: u,
46
- children: /* @__PURE__ */ s(
47
- n.Children,
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,
48
47
  {
49
- opacityLevel: c,
50
- className: N(
48
+ opacityLevel: N,
49
+ className: E(
51
50
  "gf-relative gf-flex gf-w-[500px] gf-flex-col gf-gap-4 gf-rounded-2xl gf-p-4",
52
- a
51
+ r == null ? void 0 : r.className
53
52
  ),
54
53
  children: [
55
- o && /* @__PURE__ */ s("div", { className: "gf-flex gf-items-center gf-justify-between", children: [
56
- /* @__PURE__ */ e(y, { size: "h4", weight: "medium", children: o }),
57
- !i && /* @__PURE__ */ e(
58
- l,
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,
59
58
  {
60
59
  className: "gf-h-3 gf-w-3 gf-fill-primaryIris gf-cursor-pointer",
61
- onClick: r
60
+ onClick: n
62
61
  }
63
62
  )
64
63
  ] }),
65
- !o && !i && /* @__PURE__ */ e(
64
+ !s && !(r != null && r.preventClose) && /* @__PURE__ */ c(
66
65
  "button",
67
66
  {
68
- onClick: r,
67
+ onClick: n,
69
68
  className: "gf-absolute gf-right-4 gf-top-4 gf-cursor-pointer gf-text-white/50 gf-transition-colors hover:gf-text-white",
70
69
  "aria-label": "Close",
71
- children: /* @__PURE__ */ e(l, { className: "gf-h-4 gf-w-4" })
70
+ children: /* @__PURE__ */ c(C, { className: "gf-h-4 gf-w-4" })
72
71
  }
73
72
  ),
74
- f
73
+ g
75
74
  ]
76
75
  }
77
76
  )
@@ -81,5 +80,5 @@ const V = ({
81
80
  ) : null;
82
81
  };
83
82
  export {
84
- V as ResponsiveModal
83
+ H as ResponsiveModal
85
84
  };
package/dist/index.d.ts CHANGED
@@ -1,46 +1,46 @@
1
1
 
2
2
  export * from './animations';
3
- export * from './components/atoms/Typography';
4
- export * from './components/atoms/Button';
5
- export * from './components/atoms/Checkbox';
6
- export * from './components/atoms/BottomSheet';
7
- export * from './components/atoms/Container';
8
- export * from './components/atoms/Icons';
9
- export * from './components/atoms/Logo';
10
- export * from './components/atoms/Modal';
11
- export * from './components/atoms/Opacity';
12
- export * from './components/atoms/Sidebar';
13
- export * from './components/atoms/ClientOnly';
14
- export * from './components/atoms/Input';
15
- export * from './components/atoms/Field';
16
- export * from './components/atoms/StatCard';
17
- export * from './components/atoms/ToggleGroup';
18
- export * from './components/atoms/Pagination';
19
- export * from './components/atoms/HamburgerIcon';
20
- export * from './components/atoms/BulletList';
21
- export * from './components/atoms/Portal';
22
- export * from './components/atoms/Viewport';
23
- export * from './components/molecules/Chip';
24
- export * from './components/molecules/GradientScroll';
25
- export * from './components/molecules/InfoBadge';
26
- export * from './components/molecules/TokenInfo';
27
- export * from './components/molecules/TokenNetworkLogos';
28
- export * from './components/molecules/StatusChip';
29
- export * from './components/molecules/StateContainer';
30
- export * from './components/molecules/EmptyState';
31
- export * from './components/molecules/ErrorState';
32
- export * from './components/molecules/InfoTooltip';
33
- export * from './components/molecules/SelectDropdown';
34
- export * from './components/molecules/ResponsiveModal';
35
- export * from './components/molecules/Toast';
36
- export * from './components/organisms/BlogCard';
37
- export * from './components/organisms/Footer';
38
- export * from './components/organisms/QuestCard';
39
- export * from './components/organisms/DataTable';
40
- export * from './components/organisms/CardList';
41
- export * from './components/organisms/DashboardLayout';
42
- export * from './components/organisms/CookieConsent';
43
- export * from './components/atoms/OTPInput';
44
- export * from './components/atoms/DirectionalIconHover';
45
- export * from './components/atoms/Skeleton';
46
- export * from './components/atoms/Switch';
3
+ export * from './Typography';
4
+ export * from './Button';
5
+ export * from './Checkbox';
6
+ export * from './BottomSheet';
7
+ export * from './Container';
8
+ export * from './Icons';
9
+ export * from './Logo';
10
+ export * from './Modal';
11
+ export * from './Opacity';
12
+ export * from './Sidebar';
13
+ export * from './ClientOnly';
14
+ export * from './Input';
15
+ export * from './Field';
16
+ export * from './StatCard';
17
+ export * from './ToggleGroup';
18
+ export * from './Pagination';
19
+ export * from './HamburgerIcon';
20
+ export * from './BulletList';
21
+ export * from './Portal';
22
+ export * from './Viewport';
23
+ export * from './Chip';
24
+ export * from './GradientScroll';
25
+ export * from './InfoBadge';
26
+ export * from './TokenInfo';
27
+ export * from './TokenNetworkLogos';
28
+ export * from './StatusChip';
29
+ export * from './StateContainer';
30
+ export * from './EmptyState';
31
+ export * from './ErrorState';
32
+ export * from './InfoTooltip';
33
+ export * from './SelectDropdown';
34
+ export * from './ResponsiveModal';
35
+ export * from './Toast';
36
+ export * from './BlogCard';
37
+ export * from './Footer';
38
+ export * from './QuestCard';
39
+ export * from './DataTable';
40
+ export * from './CardList';
41
+ export * from './DashboardLayout';
42
+ export * from './CookieConsent';
43
+ export * from './OTPInput';
44
+ export * from './DirectionalIconHover';
45
+ export * from './Skeleton';
46
+ export * from './Switch';