@gardenfi/garden-book 0.3.0-beta.2 → 0.3.0-beta.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.
@@ -30,7 +30,7 @@ export type SelectDropdownProps<V extends string> = {
30
30
  triggerIcon?: ReactNode;
31
31
  /** Typography size for trigger + item labels. Default `"h5"`. */
32
32
  labelSize?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
33
- /** Tailwind `from-*` class for the scroll-overflow gradient fades. Default `"gf-from-white"`. */
33
+ /** CSS color value for the scroll-overflow gradient fades. Default `"white"`. */
34
34
  scrollGradientColor?: string;
35
35
  };
36
36
  /**
@@ -1,33 +1,33 @@
1
- import { jsxs as c, jsx as t } from "react/jsx-runtime";
2
- import { useState as m, useRef as w, useCallback as J, useLayoutEffect as M, useEffect as B, Fragment as Q } from "react";
1
+ import { jsxs as g, jsx as t } from "react/jsx-runtime";
2
+ import { useState as m, useRef as w, useCallback as J, useLayoutEffect as M, useEffect as j, Fragment as Q } from "react";
3
3
  import { AnimatePresence as U, motion as V } from "framer-motion";
4
4
  import { Typography as E } from "../Typography/index.js";
5
5
  import { Portal as X } from "../Portal/index.js";
6
- import { cn as f } from "../utils/index.js";
6
+ import { cn as c } from "../utils/index.js";
7
7
  import Y from "../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
8
8
  const ie = ({
9
9
  items: d,
10
10
  value: b,
11
11
  onChange: L,
12
- placeholder: H = "",
12
+ placeholder: B = "",
13
13
  separatorsAfter: v,
14
14
  clearAction: u,
15
15
  align: x = "start",
16
- disabled: $,
16
+ disabled: H,
17
17
  contentClassName: D,
18
18
  triggerClassName: O,
19
19
  wrapperClassName: W,
20
20
  triggerIcon: z,
21
21
  labelSize: R = "h5",
22
- scrollGradientColor: S = "gf-from-white"
22
+ scrollGradientColor: S = "rgba(255,255,255,0.5)"
23
23
  }) => {
24
- const [n, l] = m(!1), T = w(null), P = w(null), a = w(null), C = w(null), [p, F] = m({ top: 0, width: 0 }), [K, G] = m(!1), [q, _] = m(!1), y = d.find((e) => e.value === b) ?? null, I = (y == null ? void 0 : y.label) ?? H, h = J(() => {
24
+ const [n, l] = m(!1), T = w(null), P = w(null), f = w(null), C = w(null), [p, F] = m({ top: 0, width: 0 }), [K, $] = m(!1), [q, G] = m(!1), y = d.find((e) => e.value === b) ?? null, I = (y == null ? void 0 : y.label) ?? B, h = J(() => {
25
25
  const e = C.current;
26
- e && (G(e.scrollTop > 0), _(e.scrollTop + e.clientHeight < e.scrollHeight - 1));
26
+ e && ($(e.scrollTop > 0), G(e.scrollTop + e.clientHeight < e.scrollHeight - 1));
27
27
  }, []);
28
28
  return M(() => {
29
29
  if (!n) return;
30
- const e = (g = !1) => {
30
+ const e = (a = !1) => {
31
31
  const s = P.current;
32
32
  if (!s) return;
33
33
  const r = s.getBoundingClientRect();
@@ -35,45 +35,45 @@ const ie = ({
35
35
  l(!1);
36
36
  return;
37
37
  }
38
- const j = r.bottom + 6, N = x === "end" ? void 0 : r.left, k = x === "end" ? window.innerWidth - r.right : void 0;
39
- g && a.current ? (a.current.style.top = `${j}px`, N !== void 0 && (a.current.style.left = `${N}px`), k !== void 0 && (a.current.style.right = `${k}px`)) : F({ top: j, left: N, right: k, width: r.width });
38
+ const _ = r.bottom + 6, k = x === "end" ? void 0 : r.left, N = x === "end" ? window.innerWidth - r.right : void 0;
39
+ a && f.current ? (f.current.style.top = `${_}px`, k !== void 0 && (f.current.style.left = `${k}px`), N !== void 0 && (f.current.style.right = `${N}px`)) : F({ top: _, left: k, right: N, width: r.width });
40
40
  };
41
41
  e();
42
42
  const i = () => e(!1), o = () => e(!0);
43
43
  return window.addEventListener("resize", i), window.addEventListener("scroll", o, !0), () => {
44
44
  window.removeEventListener("resize", i), window.removeEventListener("scroll", o, !0);
45
45
  };
46
- }, [n, x]), B(() => {
46
+ }, [n, x]), j(() => {
47
47
  if (!n) {
48
- G(!1), _(!1);
48
+ $(!1), G(!1);
49
49
  return;
50
50
  }
51
51
  h();
52
52
  const e = setTimeout(h, 50);
53
53
  return () => clearTimeout(e);
54
- }, [n, d, h]), B(() => {
54
+ }, [n, d, h]), j(() => {
55
55
  if (!n) return;
56
56
  const e = (o) => {
57
57
  var s, r;
58
- const g = o.target;
59
- (s = T.current) != null && s.contains(g) || (r = a.current) != null && r.contains(g) || l(!1);
58
+ const a = o.target;
59
+ (s = T.current) != null && s.contains(a) || (r = f.current) != null && r.contains(a) || l(!1);
60
60
  }, i = (o) => {
61
61
  o.key === "Escape" && l(!1);
62
62
  };
63
63
  return document.addEventListener("mousedown", e), document.addEventListener("keydown", i), () => {
64
64
  document.removeEventListener("mousedown", e), document.removeEventListener("keydown", i);
65
65
  };
66
- }, [n]), /* @__PURE__ */ c("div", { ref: T, className: f("gf-relative gf-inline-block", W), children: [
67
- /* @__PURE__ */ c(
66
+ }, [n]), /* @__PURE__ */ g("div", { ref: T, className: c("gf-relative gf-inline-block", W), children: [
67
+ /* @__PURE__ */ g(
68
68
  "button",
69
69
  {
70
70
  ref: P,
71
71
  type: "button",
72
- disabled: $,
72
+ disabled: H,
73
73
  onClick: () => l((e) => !e),
74
74
  "aria-haspopup": "listbox",
75
75
  "aria-expanded": n,
76
- className: f(
76
+ className: c(
77
77
  "gf-flex gf-items-center gf-gap-1.5 gf-py-2 gf-px-3 gf-rounded-full gf-bg-white/70 focus:gf-outline-none gf-transition-colors disabled:gf-cursor-not-allowed",
78
78
  O
79
79
  ),
@@ -91,7 +91,7 @@ const ie = ({
91
91
  /* @__PURE__ */ t(
92
92
  Y,
93
93
  {
94
- className: f(
94
+ className: c(
95
95
  "gf-h-3.5 gf-w-3.5 gf-text-primaryIris gf-flex-shrink-0 gf-transition-transform",
96
96
  n && "gf-rotate-180"
97
97
  )
@@ -103,7 +103,7 @@ const ie = ({
103
103
  /* @__PURE__ */ t(X, { children: /* @__PURE__ */ t(U, { children: n && /* @__PURE__ */ t(
104
104
  V.div,
105
105
  {
106
- ref: a,
106
+ ref: f,
107
107
  role: "listbox",
108
108
  initial: { opacity: 0, y: -4 },
109
109
  animate: { opacity: 1, y: 0 },
@@ -117,24 +117,25 @@ const ie = ({
117
117
  minWidth: p.width || void 0
118
118
  },
119
119
  className: "gf-z-[60] gf-rounded-xl gf-min-w-28 gf-bg-white/30 gf-backdrop-blur-lg [-webkit-backdrop-filter:blur(12px)] gf-overflow-hidden gf-shadow-[0_8px_24px_-12px_rgba(71,60,117,0.2)]",
120
- children: /* @__PURE__ */ c("div", { className: "gf-relative", children: [
120
+ children: /* @__PURE__ */ g("div", { className: "gf-relative", children: [
121
121
  K && /* @__PURE__ */ t(
122
122
  "div",
123
123
  {
124
- className: f("gf-absolute gf-top-0 gf-left-0 gf-right-0 gf-h-8 gf-pointer-events-none gf-z-10 gf-bg-gradient-to-b gf-to-transparent", S)
124
+ className: "gf-absolute gf-top-0 gf-left-0 gf-right-0 gf-h-8 gf-pointer-events-none gf-z-10",
125
+ style: { background: `linear-gradient(to bottom, ${S}, transparent)` }
125
126
  }
126
127
  ),
127
- /* @__PURE__ */ c("div", { className: "gf-relative", children: [
128
+ /* @__PURE__ */ g("div", { className: "gf-relative", children: [
128
129
  /* @__PURE__ */ t(
129
130
  "div",
130
131
  {
131
132
  ref: C,
132
133
  onScroll: h,
133
- className: f("gf-py-2 gf-overflow-y-auto gf-max-h-96 [scrollbar-width:none] [&::-webkit-scrollbar]:gf-hidden", D),
134
+ className: c("gf-py-2 gf-overflow-y-auto gf-max-h-96 [scrollbar-width:none] [&::-webkit-scrollbar]:gf-hidden", D),
134
135
  children: d.map((e, i) => {
135
- const o = e.value === b, g = i === d.length - 1, s = (v == null ? void 0 : v.includes(e.value)) && !g;
136
- return /* @__PURE__ */ c(Q, { children: [
137
- /* @__PURE__ */ c(
136
+ const o = e.value === b, a = i === d.length - 1, s = (v == null ? void 0 : v.includes(e.value)) && !a;
137
+ return /* @__PURE__ */ g(Q, { children: [
138
+ /* @__PURE__ */ g(
138
139
  "button",
139
140
  {
140
141
  type: "button",
@@ -144,7 +145,7 @@ const ie = ({
144
145
  onClick: () => {
145
146
  e.disabled || (L(e.value), l(!1));
146
147
  },
147
- className: f(
148
+ className: c(
148
149
  "gf-w-full gf-flex gf-items-center gf-gap-3 gf-px-4 gf-py-2 gf-text-sm gf-transition-colors",
149
150
  e.disabled ? "gf-opacity-35 gf-cursor-default gf-pointer-events-none" : "hover:gf-bg-white/50 gf-cursor-pointer"
150
151
  ),
@@ -170,11 +171,12 @@ const ie = ({
170
171
  q && /* @__PURE__ */ t(
171
172
  "div",
172
173
  {
173
- className: f("gf-absolute gf-bottom-0 gf-left-0 gf-right-0 gf-h-8 gf-pointer-events-none gf-z-10 gf-bg-gradient-to-t gf-to-transparent", S)
174
+ className: "gf-absolute gf-bottom-0 gf-left-0 gf-right-0 gf-h-8 gf-pointer-events-none gf-z-10",
175
+ style: { background: `linear-gradient(to top, ${S}, transparent)` }
174
176
  }
175
177
  )
176
178
  ] }),
177
- u && b !== u.value && /* @__PURE__ */ t("div", { className: "gf-px-2.5 gf-pb-2 gf-pt-1", children: /* @__PURE__ */ t(
179
+ u && b !== u.value && /* @__PURE__ */ t("div", { className: "gf-px-2.5 gf-pb-2 gf-pt-1 gf-bg-white/50", children: /* @__PURE__ */ t(
178
180
  "button",
179
181
  {
180
182
  type: "button",