@gardenfi/garden-book 0.3.2 → 0.3.4

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,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';