@nivaro/react 0.3.35 → 0.3.36

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.
@@ -42,7 +42,7 @@ function T({
42
42
  {
43
43
  "data-panel-body": "",
44
44
  ...n ? { role: "tabpanel", id: n.id, "aria-labelledby": n.labelledBy } : {},
45
- className: d("min-h-0 flex-1 space-y-5 overflow-y-auto px-4 pb-8 pt-4", r),
45
+ className: d("relative min-h-0 flex-1 space-y-5 overflow-y-auto px-4 pb-8 pt-4", r),
46
46
  children: e
47
47
  }
48
48
  );
@@ -0,0 +1,40 @@
1
+ import { useMemo as f } from "react";
2
+ const i = (t, e) => `${e ?? ""}\0${t}`;
3
+ function c(t) {
4
+ if (typeof t == "string")
5
+ try {
6
+ const e = JSON.parse(t);
7
+ return e && typeof e == "object" ? e : {};
8
+ } catch {
9
+ return {};
10
+ }
11
+ return t && typeof t == "object" ? t : {};
12
+ }
13
+ function l(t) {
14
+ const e = /* @__PURE__ */ new Set();
15
+ for (const n of t.placements)
16
+ c(n.overrides).personal_default === !0 && e.add(i(n.field, n.group_key));
17
+ return e;
18
+ }
19
+ const u = {
20
+ text: "Personal default",
21
+ tone: "slate",
22
+ icon: "person",
23
+ kind: "personal",
24
+ tip: "People can save their own starting value for this field on this form. New records start with it."
25
+ };
26
+ function a(t, e) {
27
+ const n = t.placements;
28
+ return f(() => {
29
+ const r = l({ placements: n });
30
+ return r.size === 0 ? e : (o) => {
31
+ const s = (e == null ? void 0 : e(o)) ?? [];
32
+ return o.kind !== "field" || !r.has(i(o.field, o.group_key)) ? s : [...s, u];
33
+ };
34
+ }, [n, e]);
35
+ }
36
+ export {
37
+ u as PERSONAL_DEFAULT_MARK,
38
+ l as personalDefaultPlacements,
39
+ a as usePersonalDefaultMarks
40
+ };
@@ -162,7 +162,7 @@ function ve({
162
162
  "div",
163
163
  {
164
164
  "data-preview-device": a.device,
165
- className: "mx-auto w-full border-x border-dashed border-slate-300 bg-white dark:border-slate-600 dark:bg-background",
165
+ className: "mx-auto flex min-h-0 w-full flex-1 flex-col border-x border-dashed border-slate-300 bg-white dark:border-slate-600 dark:bg-background",
166
166
  style: { maxWidth: A },
167
167
  children: e
168
168
  }
@@ -227,7 +227,7 @@ function ve({
227
227
  overlay: V,
228
228
  noDnd: t
229
229
  });
230
- return /* @__PURE__ */ o("div", { className: "flex min-h-full flex-col", children: [
230
+ return /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col", children: [
231
231
  x.length > 0 && /* @__PURE__ */ l(
232
232
  "div",
233
233
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.35",
3
+ "version": "0.3.36",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",