@bettercms-ai/kit 4.0.0 → 4.2.0-next.0

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.
Files changed (140) hide show
  1. package/dist/adapters/lossy.d.ts +4 -0
  2. package/dist/adapters/lossy.js +4 -0
  3. package/dist/adapters/lossy.js.map +1 -1
  4. package/dist/adapters/prod-types.d.ts +4 -0
  5. package/dist/adapters/prod-types.js +4 -1
  6. package/dist/adapters/prod-types.js.map +1 -1
  7. package/dist/adapters/schema.js +7 -0
  8. package/dist/adapters/schema.js.map +1 -1
  9. package/dist/context.d.ts +91 -0
  10. package/dist/context.js +58 -1
  11. package/dist/context.js.map +1 -1
  12. package/dist/controls/choice.d.ts +1 -1
  13. package/dist/controls/choice.js +21 -2
  14. package/dist/controls/choice.js.map +1 -1
  15. package/dist/controls/index.d.ts +1 -0
  16. package/dist/controls/index.js +3 -2
  17. package/dist/controls/index.js.map +1 -1
  18. package/dist/controls/link.d.ts +23 -2
  19. package/dist/controls/link.js +456 -4
  20. package/dist/controls/link.js.map +1 -1
  21. package/dist/controls/media-v16.d.ts +27 -0
  22. package/dist/controls/media-v16.js +261 -0
  23. package/dist/controls/media-v16.js.map +1 -0
  24. package/dist/controls/media.js +63 -1
  25. package/dist/controls/media.js.map +1 -1
  26. package/dist/controls/reference-services.d.ts +8 -0
  27. package/dist/controls/reference.js +78 -2
  28. package/dist/controls/reference.js.map +1 -1
  29. package/dist/controls/rich-text/ai-runs.d.ts +13 -0
  30. package/dist/controls/rich-text/ai-runs.js +71 -0
  31. package/dist/controls/rich-text/ai-runs.js.map +1 -0
  32. package/dist/controls/rich-text/block-tool.d.ts +31 -0
  33. package/dist/controls/rich-text/block-tool.js +62 -0
  34. package/dist/controls/rich-text/block-tool.js.map +1 -0
  35. package/dist/controls/rich-text/blocks.d.ts +6 -1
  36. package/dist/controls/rich-text/blocks.js +406 -24
  37. package/dist/controls/rich-text/blocks.js.map +1 -1
  38. package/dist/controls/rich-text/catalog.d.ts +45 -7
  39. package/dist/controls/rich-text/catalog.js +507 -37
  40. package/dist/controls/rich-text/catalog.js.map +1 -1
  41. package/dist/controls/rich-text/code-head.d.ts +30 -0
  42. package/dist/controls/rich-text/code-head.js +230 -0
  43. package/dist/controls/rich-text/code-head.js.map +1 -0
  44. package/dist/controls/rich-text/codec.d.ts +1 -1
  45. package/dist/controls/rich-text/codec.js +4 -1
  46. package/dist/controls/rich-text/codec.js.map +1 -1
  47. package/dist/controls/rich-text/dom.d.ts +27 -0
  48. package/dist/controls/rich-text/dom.js +77 -7
  49. package/dist/controls/rich-text/dom.js.map +1 -1
  50. package/dist/controls/rich-text/editor.js +243 -55
  51. package/dist/controls/rich-text/editor.js.map +1 -1
  52. package/dist/controls/rich-text/ops.js +1 -0
  53. package/dist/controls/rich-text/ops.js.map +1 -1
  54. package/dist/controls/rich-text/rewriteSelection.d.ts +25 -0
  55. package/dist/controls/rich-text/rewriteSelection.js +28 -0
  56. package/dist/controls/rich-text/rewriteSelection.js.map +1 -0
  57. package/dist/controls/rich-text/slash-preview.d.ts +8 -0
  58. package/dist/controls/rich-text/slash-preview.js +300 -0
  59. package/dist/controls/rich-text/slash-preview.js.map +1 -0
  60. package/dist/controls/rich-text/table-grid.d.ts +22 -0
  61. package/dist/controls/rich-text/table-grid.js +1057 -0
  62. package/dist/controls/rich-text/table-grid.js.map +1 -0
  63. package/dist/controls/rich-text/toolbar.js +61 -18
  64. package/dist/controls/rich-text/toolbar.js.map +1 -1
  65. package/dist/controls/text.d.ts +6 -0
  66. package/dist/controls/text.js +95 -5
  67. package/dist/controls/text.js.map +1 -1
  68. package/dist/core/facets.d.ts +1 -0
  69. package/dist/core/facets.js +1 -0
  70. package/dist/core/facets.js.map +1 -1
  71. package/dist/engine/array.d.ts +7 -0
  72. package/dist/engine/array.js +164 -45
  73. package/dist/engine/array.js.map +1 -1
  74. package/dist/engine/field-shell.d.ts +12 -0
  75. package/dist/engine/field-shell.js +222 -64
  76. package/dist/engine/field-shell.js.map +1 -1
  77. package/dist/engine/frame.js +42 -4
  78. package/dist/engine/frame.js.map +1 -1
  79. package/dist/engine/grouping.d.ts +71 -10
  80. package/dist/engine/grouping.js +227 -29
  81. package/dist/engine/grouping.js.map +1 -1
  82. package/dist/engine/item-list.js +2 -2
  83. package/dist/engine/item-list.js.map +1 -1
  84. package/dist/engine/kit-field.js +38 -4
  85. package/dist/engine/kit-field.js.map +1 -1
  86. package/dist/engine/schema-form.d.ts +2 -0
  87. package/dist/engine/schema-form.js +9 -2
  88. package/dist/engine/schema-form.js.map +1 -1
  89. package/dist/index.d.ts +1 -1
  90. package/dist/index.js +13 -6
  91. package/dist/index.js.map +1 -1
  92. package/dist/kit.css +59 -0
  93. package/dist/lib/reduced-motion.d.ts +1 -0
  94. package/dist/lib/reduced-motion.js +19 -0
  95. package/dist/lib/reduced-motion.js.map +1 -0
  96. package/dist/schema/table.d.ts +2 -1
  97. package/dist/schema/table.js +5 -0
  98. package/dist/schema/table.js.map +1 -1
  99. package/dist/schema/types.d.ts +6 -0
  100. package/dist/schema/types.js.map +1 -1
  101. package/dist/styles.css +1 -1
  102. package/dist/theme.css +215 -0
  103. package/dist/tokens.css +274 -0
  104. package/dist/ui/block-icon-picker.d.ts +38 -0
  105. package/dist/ui/block-icon-picker.js +141 -0
  106. package/dist/ui/block-icon-picker.js.map +1 -0
  107. package/dist/ui/button.js +1 -0
  108. package/dist/ui/button.js.map +1 -1
  109. package/dist/ui/code-language-menu.d.ts +24 -0
  110. package/dist/ui/code-language-menu.js +123 -0
  111. package/dist/ui/code-language-menu.js.map +1 -0
  112. package/dist/ui/content-fields.d.ts +47 -0
  113. package/dist/ui/content-fields.js +279 -0
  114. package/dist/ui/content-fields.js.map +1 -0
  115. package/dist/ui/controls.js +3 -2
  116. package/dist/ui/controls.js.map +1 -1
  117. package/dist/ui/floating-panel.js +3 -2
  118. package/dist/ui/floating-panel.js.map +1 -1
  119. package/dist/ui/foundations.d.ts +118 -0
  120. package/dist/ui/foundations.js +565 -0
  121. package/dist/ui/foundations.js.map +1 -0
  122. package/dist/ui/index.d.ts +6 -0
  123. package/dist/ui/index.js +7 -1
  124. package/dist/ui/inspector.d.ts +412 -0
  125. package/dist/ui/inspector.js +1218 -0
  126. package/dist/ui/inspector.js.map +1 -0
  127. package/dist/ui/overlay.d.ts +7 -2
  128. package/dist/ui/overlay.js +55 -20
  129. package/dist/ui/overlay.js.map +1 -1
  130. package/dist/ui/shortcut-hint.js +1 -1
  131. package/dist/ui/shortcut-hint.js.map +1 -1
  132. package/dist/ui/tab.js +3 -2
  133. package/dist/ui/tab.js.map +1 -1
  134. package/dist/ui/toast.d.ts +5 -3
  135. package/dist/ui/toast.js +83 -11
  136. package/dist/ui/toast.js.map +1 -1
  137. package/dist/ui/tooltip-card.d.ts +45 -0
  138. package/dist/ui/tooltip-card.js +135 -0
  139. package/dist/ui/tooltip-card.js.map +1 -0
  140. package/package.json +1 -1
@@ -1,10 +1,12 @@
1
1
  import { isObj, keyStartsWith, pathKey } from "../lib/path.js";
2
2
  import { condCtx, isEmptyValue, isHidden } from "../lib/schema.js";
3
3
  import { cn } from "../lib/cn.js";
4
- import { KitSectionTitle, useForm, useKitEnv } from "../context.js";
4
+ import { KitSectionTitle, useForm, useKitEnv, useKitLook } from "../context.js";
5
5
  import { KitIcon } from "../lib/icons.js";
6
+ import { useKitReducedMotion } from "../lib/reduced-motion.js";
6
7
  import { Segmented } from "../ui/controls.js";
7
8
  import { Menu, MenuContent, MenuItem, MenuTrigger, Tooltip } from "../ui/overlay.js";
9
+ import { GroupHeader, InspectorCollapse, InspectorLocked, SectionHeader } from "../ui/inspector.js";
8
10
  import { IssueDot } from "./bits.js";
9
11
  import { PeerStack } from "./field-shell.js";
10
12
  import { groupSummary } from "./group-summary.js";
@@ -13,7 +15,7 @@ import { isIconImage } from "../lib/icon-image.js";
13
15
  import * as React from "react";
14
16
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
17
  import { IconChevronDown, IconChevronRight, IconDeviceDesktop, IconDeviceLaptop, IconDeviceMobile, IconDeviceTablet, IconMessage } from "@tabler/icons-react";
16
- import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
18
+ import { AnimatePresence, motion } from "framer-motion";
17
19
  //#region src/engine/grouping.tsx
18
20
  /**
19
21
  * GROUPING (CPO D45; V2 HEAD 9829bf1 kit/engine/grouping.tsx + the layout half of kit/engine/field-list.tsx) — the four
@@ -28,9 +30,14 @@ import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
28
30
  * <FieldUnit> ┌ Shop cookware Primary › ┐ ONE compound control (button = label + link, image + alt)
29
31
  * └ /products ┘
30
32
  * Drill row [▣] Desktop › anything bigger, or anything one level deeper
33
+ * <ObjectGroup> SEO / "How this page appears in search" fields that feed one object outside the page (search,
34
+ * (◎)─────── social card, form, image): header, marker, violet line,
35
+ * │ fields, 20px in fields 20px in (INSPECTOR-FRAMEWORK §3 "Object group")
36
+ * <SubGroup> │ Rating │ Count fields that only matter while another is on: a flush
37
+ * --kit-subgroup-rail, 12px in, 12px apart (§3 "Sub-group")
31
38
  *
32
39
  * Nesting: section (level 1, spacing only) → inset (level 2, the inset line) → level 3+ always drills. Never two
33
- * containers in one level. Rhythm: field gap 16 · group gap 24, the same gap inside an inset; dense (form width ≤ 360px)
40
+ * containers in one level. Rhythm: field gap 16 · group gap 24, 12 inside an inset (sub-group); dense (form width ≤ 360px)
34
41
  * 12 · 20; document 20 · 32.
35
42
  * Columns (D63, `columnSpans`): side by side only for genuinely short fields (number, switch, select, date, colour, icon,
36
43
  * rating, text with max ≤ 24) AND only when the form is at least 420px wide (a container query). Everything else is full
@@ -43,7 +50,7 @@ import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
43
50
  * engine has no grouping ↔ kit-field import cycle.
44
51
  */
45
52
  /** Gaps per host. `stack` = between sibling fields; `group` = before a section / after one; `gridY` = rows of a column grid.
46
- * An inset uses the same field gap as everything else (D63: one rhythm). */
53
+ * Inside an inset (sub-group) a panel uses 12 (INSPECTOR-FRAMEWORK §3). */
47
54
  var RHYTHM = {
48
55
  panel: {
49
56
  tabs: "pb-4 @max-[360px]:pb-3",
@@ -60,7 +67,59 @@ var RHYTHM = {
60
67
  gridY: "gap-y-5"
61
68
  }
62
69
  };
63
- var useRhythm = () => RHYTHM[useKitEnv().variant];
70
+ /** Inside a sub-group (FieldInset) the panel's fields sit 12px apart (INSPECTOR-FRAMEWORK §3, editor-v16 .subg2 gap). */
71
+ var SUB_RHYTHM = {
72
+ ...RHYTHM.panel,
73
+ stack: "gap-3",
74
+ field: "pt-3",
75
+ gridY: "gap-y-3"
76
+ };
77
+ /** Look "v16" (prototype kit.css:6-11): fields 20 apart, 32 before a group (its rule sits 20 under the group before it). */
78
+ var V16_RHYTHM = {
79
+ tabs: "pb-4",
80
+ stack: "gap-5",
81
+ field: "pt-5",
82
+ group: "pt-8",
83
+ gridY: "gap-y-5"
84
+ };
85
+ var SubRhythm = React.createContext(false);
86
+ var useRhythm = () => {
87
+ const variant = useKitEnv().variant;
88
+ const sub = React.useContext(SubRhythm);
89
+ const look = useKitLook();
90
+ if (sub && variant === "panel") return SUB_RHYTHM;
91
+ return look === "v16" && variant === "panel" ? V16_RHYTHM : RHYTHM[variant];
92
+ };
93
+ /**
94
+ * Look "v16", INSPECTOR-FRAMEWORK §3 "Sub-group" (prototype inspector.jsx:372-373): the names of the fields that only
95
+ * matter while the switch directly above them is on, i.e. a run of fields whose "show only when" reads that boolean.
96
+ * They draw behind one rail, 12 in and 12 apart, under the switch. Pass the schema's fields in order (hidden ones too).
97
+ */
98
+ function dependentFields(fields) {
99
+ const out = /* @__PURE__ */ new Set();
100
+ let toggle = null;
101
+ for (const f of fields) {
102
+ const c = f.hidden;
103
+ if (toggle && c && typeof c === "object" && c.field === toggle && c.scope !== "root") {
104
+ out.add(f.name);
105
+ continue;
106
+ }
107
+ toggle = f.type === "boolean" ? f.name : null;
108
+ }
109
+ return out;
110
+ }
111
+ /** One dependent field's wrapper: the rail runs through the 12 gap to the dependent above it, never up to the switch. */
112
+ function Dependent({ first, children }) {
113
+ return /* @__PURE__ */ jsx(SubRhythm.Provider, {
114
+ value: true,
115
+ children: /* @__PURE__ */ jsx("div", {
116
+ "data-group": "inset",
117
+ "data-slot": "kit-subgroup-row",
118
+ className: cn(INSET_LINE, !first && "pt-3"),
119
+ children
120
+ })
121
+ });
122
+ }
64
123
  var InsetDepth = React.createContext(0);
65
124
  /** 0 at a frame's top level and inside sections; 1 inside an inset (or an expanded array row). */
66
125
  var useInsetDepth = () => React.useContext(InsetDepth);
@@ -102,7 +161,7 @@ function useGroupStatus(paths) {
102
161
  /** A field that animates its height in and out when a condition shows or hides it (D45). `space` = its top spacing. */
103
162
  var Appear = React.forwardRef(({ children, space, className }, ref) => {
104
163
  const t = {
105
- duration: useReducedMotion() ? 0 : .2,
164
+ duration: useKitReducedMotion() ? 0 : .2,
106
165
  ease: [
107
166
  .22,
108
167
  1,
@@ -146,12 +205,20 @@ Appear.displayName = "Appear";
146
205
  /** Sibling fields that appear / disappear smoothly. `gapless`: the parent draws the gaps (grid, inset). */
147
206
  function AnimatedFields({ fields, render, gapless, space }) {
148
207
  const rhythm = useRhythm();
208
+ const deps = useKitLook() === "v16" ? dependentFields(fields) : null;
149
209
  return /* @__PURE__ */ jsx(AnimatePresence, {
150
210
  initial: false,
151
- children: fields.map((f, i) => /* @__PURE__ */ jsx(Appear, {
152
- space: gapless || i === 0 ? void 0 : space ?? rhythm.field,
153
- children: render(f)
154
- }, f.name))
211
+ children: fields.map((f, i) => {
212
+ const dep = !!deps?.has(f.name);
213
+ const first = dep && !deps.has(fields[i - 1]?.name ?? "");
214
+ return /* @__PURE__ */ jsx(Appear, {
215
+ space: gapless || i === 0 || dep && !first ? void 0 : space ?? rhythm.field,
216
+ children: dep ? /* @__PURE__ */ jsx(Dependent, {
217
+ first,
218
+ children: render(f)
219
+ }) : render(f)
220
+ }, f.name);
221
+ })
155
222
  });
156
223
  }
157
224
  function GroupBadges({ status }) {
@@ -272,7 +339,8 @@ function IconGroup({ fields, render }) {
272
339
  })]
273
340
  });
274
341
  }
275
- function FieldSection({ title, description, collapsible = true, defaultOpen = true, open: openProp, onOpenChange, summary, status, divider = true, revealWhen, disabled, actions, lead, columns, icon, adornment, className, bodyClassName, children }) {
342
+ function FieldSection({ title, description, collapsible = true, defaultOpen = true, open: openProp, onOpenChange, summary, status, divider = true, revealWhen, disabled, actions, lead, columns, icon, adornment, className, bodyClassName, onReset, locked, rule, header, children }) {
343
+ const look = useKitLook();
276
344
  const rhythm = useRhythm();
277
345
  const { variant } = useKitEnv();
278
346
  const id = React.useId();
@@ -308,6 +376,53 @@ function FieldSection({ title, description, collapsible = true, defaultOpen = tr
308
376
  }) : children
309
377
  ]
310
378
  });
379
+ if (look === "v16") {
380
+ const inner = /* @__PURE__ */ jsxs(InspectorLocked, {
381
+ on: locked,
382
+ children: [lead, columns === 2 ? /* @__PURE__ */ jsx("div", {
383
+ className: "grid grid-cols-1 gap-x-3 gap-y-5 @[420px]:grid-cols-2",
384
+ children
385
+ }) : children]
386
+ });
387
+ return /* @__PURE__ */ jsxs("section", {
388
+ role: "group",
389
+ "aria-labelledby": `${id}-title`,
390
+ "data-group": "section",
391
+ "data-look": "v16",
392
+ "data-slot": "kit-insp-group",
393
+ "data-state": open ? "open" : "closed",
394
+ className: cn("flex min-w-0 flex-col gap-4", rule === void 0 ? "[&:not(:last-child)]:border-b [&:not(:last-child)]:border-kit-insp-divider [&:not(:last-child)]:pb-5" : rule && "border-b border-kit-insp-divider pb-5", className),
395
+ children: [header === "content" && !collapsible ? /* @__PURE__ */ jsx(GroupHeader, {
396
+ title: /* @__PURE__ */ jsxs(Fragment, { children: [title, adornment] }),
397
+ titleId: `${id}-title`,
398
+ sub: description,
399
+ actions
400
+ }) : /* @__PURE__ */ jsx(SectionHeader, {
401
+ icon,
402
+ title: /* @__PURE__ */ jsxs(Fragment, { children: [title, adornment] }),
403
+ titleId: `${id}-title`,
404
+ desc: description,
405
+ trailing: collapsible ? "collapse" : locked ? "locked" : onReset ? "reset" : void 0,
406
+ onReset,
407
+ open,
408
+ onToggle: () => !disabled && setOpen(!open),
409
+ controls: open ? `${id}-body` : void 0,
410
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [collapsible && !open ? /* @__PURE__ */ jsx(GroupBadges, { status: st }) : null, actions] })
411
+ }), /* @__PURE__ */ jsx(KitSectionTitle.Provider, {
412
+ value: title,
413
+ children: collapsible ? /* @__PURE__ */ jsx(InspectorCollapse, {
414
+ open,
415
+ id: `${id}-body`,
416
+ className: bodyClassName,
417
+ children: inner
418
+ }) : /* @__PURE__ */ jsx("div", {
419
+ id: `${id}-body`,
420
+ className: cn("flex min-w-0 flex-col gap-5", bodyClassName),
421
+ children: inner
422
+ })
423
+ })]
424
+ });
425
+ }
311
426
  return /* @__PURE__ */ jsxs("section", {
312
427
  role: "group",
313
428
  "aria-labelledby": `${id}-title`,
@@ -393,7 +508,7 @@ function SummaryChips({ chips }) {
393
508
  * nothing snaps when the clip comes off; no opacity flash on the content; instant with reduced motion.
394
509
  */
395
510
  function SectionBody({ open, children }) {
396
- const reduce = useReducedMotion();
511
+ const reduce = useKitReducedMotion();
397
512
  const el = React.useRef(null);
398
513
  const clip = (on) => {
399
514
  if (el.current) el.current.style.overflow = on ? "hidden" : "";
@@ -422,22 +537,94 @@ function SectionBody({ open, children }) {
422
537
  });
423
538
  }
424
539
  /**
425
- * D63: the ONE way to show "these fields belong together" inside a form. The object's label sits above (the field shell);
426
- * the children sit behind a single 1px --line inset line, `ml-1.5 pl-3`. No tint, no ring, no radius, no padding box.
427
- * Children keep the form's own field gap. Short neighbours pair up on wide forms through `FieldRun`.
540
+ * D63 + INSPECTOR-FRAMEWORK §3 "Sub-group" (editor-v16 kit.jsx:100, kit.css:40 .subg2): the ONE way to show "these fields
541
+ * belong to the one above" inside a form: a small object's own fields (its label sits above, in the field shell) and the
542
+ * fields that only matter while another is on (a badge → its rating and count, billing → its period). A 1px
543
+ * --kit-subgroup-rail flush with the field edge, the children 12px in and 12px apart (a dense panel rhythm: fields drawn
544
+ * inside through FieldRun use it too; the document scale keeps its own). No tint, no ring, no radius, no padding box.
545
+ * `SubGroup` is the framework's name for the same component.
428
546
  */
429
547
  function FieldInset({ children, labelledBy, label, className }) {
430
- return /* @__PURE__ */ jsx(InsetScope, { children: /* @__PURE__ */ jsx("div", {
431
- role: "group",
432
- "aria-labelledby": labelledBy,
433
- "aria-label": labelledBy ? void 0 : label,
434
- "data-group": "inset",
435
- className: cn(INSET_LINE, "flex flex-col", className),
436
- children
548
+ return /* @__PURE__ */ jsx(InsetScope, { children: /* @__PURE__ */ jsx(SubRhythm.Provider, {
549
+ value: true,
550
+ children: /* @__PURE__ */ jsx("div", {
551
+ role: "group",
552
+ "aria-labelledby": labelledBy,
553
+ "aria-label": labelledBy ? void 0 : label,
554
+ "data-group": "inset",
555
+ className: cn(INSET_LINE, "flex flex-col gap-3", className),
556
+ children
557
+ })
437
558
  }) });
438
559
  }
439
- /** The inset line every nested group uses (inline objects, expanded array rows). */
440
- var INSET_LINE = "ml-1.5 min-w-0 border-l border-kit-line pl-3";
560
+ /** INSPECTOR-FRAMEWORK §3 "Sub-group": the framework's name for <FieldInset>. */
561
+ var SubGroup = FieldInset;
562
+ /** The inset line every nested group uses (inline objects, sub-groups, expanded array rows): flush rail, 12px in. */
563
+ var INSET_LINE = "min-w-0 border-l border-kit-subgroup-rail pl-3";
564
+ /**
565
+ * INSPECTOR-FRAMEWORK §3 "Object group" (editor-v16 kit.jsx:66 GroupHeader + :103 DestGroup, kit.css:9-19, 43-47): fields
566
+ * that feed one object outside the page (search result, social card, a form, an image). The header (14/20 medium, -0.2px;
567
+ * its sub-line 13/18, -0.16px), then a round marker with the object's glyph, a violet-to-grey line down and one across, and
568
+ * the fields 20px in (24px below the marker, 20px apart). The marker and lines are decoration (aria-hidden); the group is a
569
+ * region named by its title. Nothing in it is focusable but the fields.
570
+ */
571
+ function ObjectGroup({ icon: Glyph, title, sub, id, className, actions, children }) {
572
+ const titleId = React.useId();
573
+ return /* @__PURE__ */ jsxs("section", {
574
+ id,
575
+ "aria-labelledby": titleId,
576
+ "data-group": "object",
577
+ className: cn("flex min-w-0 flex-col gap-4", className),
578
+ children: [/* @__PURE__ */ jsxs("div", {
579
+ "data-slot": "kit-group-header",
580
+ className: "flex items-start gap-2",
581
+ children: [/* @__PURE__ */ jsxs("div", {
582
+ className: "flex min-w-0 flex-1 flex-col gap-0.5",
583
+ children: [/* @__PURE__ */ jsx("h3", {
584
+ id: titleId,
585
+ className: "text-kit-base font-medium tracking-[-0.2px] text-kit-group-title",
586
+ children: title
587
+ }), sub ? /* @__PURE__ */ jsx("p", {
588
+ className: "text-kit-sm tracking-[-0.16px] text-kit-group-sub",
589
+ children: sub
590
+ }) : null]
591
+ }), actions ? /* @__PURE__ */ jsx("span", {
592
+ className: "flex shrink-0 items-center gap-0.5",
593
+ children: actions
594
+ }) : null]
595
+ }), /* @__PURE__ */ jsxs("div", {
596
+ "data-slot": "kit-object-body",
597
+ className: "relative min-w-0 pl-5",
598
+ children: [
599
+ /* @__PURE__ */ jsx("span", {
600
+ "aria-hidden": true,
601
+ "data-slot": "kit-object-line",
602
+ className: "pointer-events-none absolute bottom-0 left-[7px] top-3.5 w-px bg-linear-to-b/srgb from-kit-object-line to-kit-object-line-end"
603
+ }),
604
+ /* @__PURE__ */ jsx("span", {
605
+ "aria-hidden": true,
606
+ "data-slot": "kit-object-rule",
607
+ className: "pointer-events-none absolute left-[18px] right-0 top-2 h-px bg-linear-to-r/srgb from-kit-object-line to-kit-object-line-end"
608
+ }),
609
+ /* @__PURE__ */ jsx("span", {
610
+ "aria-hidden": true,
611
+ "data-slot": "kit-object-mark",
612
+ className: "absolute -left-1 -top-[3px] z-[1] -m-[3px] box-content grid size-[22px] place-items-center rounded-full border-[3px] border-kit-object-mark-ring bg-kit-object-mark text-kit-object-mark-fg",
613
+ children: /* @__PURE__ */ jsx(Glyph, {
614
+ size: 14,
615
+ stroke: 1.6,
616
+ "aria-hidden": true
617
+ })
618
+ }),
619
+ /* @__PURE__ */ jsx("div", {
620
+ "data-slot": "kit-object-box",
621
+ className: "flex min-w-0 flex-col gap-5 pt-6",
622
+ children
623
+ })
624
+ ]
625
+ })]
626
+ });
627
+ }
441
628
  /**
442
629
  * Reads as ONE input: the field border, radius 6, the input focus treatment on the whole unit; rows inside are split by a
443
630
  * hairline and have no borders of their own. Use for values that only make sense together (founder rule: a button's
@@ -697,6 +884,8 @@ function FieldList({ fields, fieldsets, groups, basePath, memoryKey, renderField
697
884
  const groupErrors = (g) => visible.filter((f) => (f.group ?? defaultGroup(groups)?.name) === g).reduce((n, f) => n + form.rollup([...basePath, f.name]).errors, 0);
698
885
  const items = gatherIcons(arrangeFields(visible.filter(inTab), fieldsets), obj);
699
886
  const rhythm = useRhythm();
887
+ const v16 = useKitLook() === "v16";
888
+ const deps = v16 ? dependentFields(fields) : null;
700
889
  const review = env.review;
701
890
  const [openRuns, setOpenRuns] = React.useState(() => /* @__PURE__ */ new Set());
702
891
  const itemChanged = (it) => !review || (it.kind === "field" ? review.count([...basePath, it.field.name]) > 0 : it.fields.some((f) => review.count([...basePath, f.name]) > 0));
@@ -780,10 +969,16 @@ function FieldList({ fields, fieldsets, groups, basePath, memoryKey, renderField
780
969
  }
781
970
  const it = row.it;
782
971
  const prev = rows[i - 1];
783
- const space = i === 0 ? void 0 : it.kind === "set" ? prev?.kind === "item" && prev.it.kind === "set" ? void 0 : rhythm.group : rhythm.field;
972
+ const prevSet = prev?.kind === "item" && prev.it.kind === "set";
973
+ const dep = it.kind === "field" && !!deps?.has(it.field.name);
974
+ const firstDep = dep && !(prev?.kind === "item" && prev.it.kind === "field" && deps.has(prev.it.field.name));
975
+ const space = i === 0 ? void 0 : v16 ? dep && !firstDep ? void 0 : it.kind === "set" || prevSet ? rhythm.group : rhythm.field : it.kind === "set" ? prevSet ? void 0 : rhythm.group : rhythm.field;
784
976
  return it.kind === "field" ? /* @__PURE__ */ jsx(Appear, {
785
977
  space,
786
- children: renderField(it.field, [...basePath, it.field.name], obj)
978
+ children: dep ? /* @__PURE__ */ jsx(Dependent, {
979
+ first: firstDep,
980
+ children: renderField(it.field, [...basePath, it.field.name], obj)
981
+ }) : renderField(it.field, [...basePath, it.field.name], obj)
787
982
  }, it.field.name) : it.kind === "icons" ? /* @__PURE__ */ jsx(Appear, {
788
983
  space,
789
984
  children: /* @__PURE__ */ jsx(IconGroup, {
@@ -799,7 +994,8 @@ function FieldList({ fields, fieldsets, groups, basePath, memoryKey, renderField
799
994
  obj,
800
995
  memoryKey: `${memoryKey}:fs:${it.set.name}`,
801
996
  divider: i > 0,
802
- renderField
997
+ renderField,
998
+ last: v16 ? i === rows.length - 1 : void 0
803
999
  })
804
1000
  }, `set:${it.set.name}`);
805
1001
  })
@@ -941,7 +1137,7 @@ function GroupTabs({ id, value, onChange, items }) {
941
1137
  ]
942
1138
  });
943
1139
  }
944
- function FieldsetSection({ set, fields, basePath, obj, memoryKey, divider, renderField }) {
1140
+ function FieldsetSection({ set, fields, basePath, obj, memoryKey, divider, renderField, last }) {
945
1141
  const form = useForm();
946
1142
  const env = useKitEnv();
947
1143
  const breakpoints = set.layout === "breakpoints" && fields.length >= 2 && fields.every((f) => f.type === "object");
@@ -968,6 +1164,8 @@ function FieldsetSection({ set, fields, basePath, obj, memoryKey, divider, rende
968
1164
  summary: env.sectionSummary?.(set, obj) ?? (groupSummary(fields, obj) || "Nothing set yet"),
969
1165
  status,
970
1166
  divider,
1167
+ rule: last === void 0 ? void 0 : !last,
1168
+ header: set.collapsible === false ? "content" : "section",
971
1169
  revealWhen: form.showAllErrors && status.errors > 0,
972
1170
  children: /* @__PURE__ */ jsx(FieldRun, {
973
1171
  fields,
@@ -991,6 +1189,6 @@ var isShort = (f) => [
991
1189
  "rating"
992
1190
  ].includes(f.type) && !(f.type === "select" && (f.layout === "cards" || f.layout === "radio")) && !(f.type === "number" && (f.scale || f.layout === "slider"));
993
1191
  //#endregion
994
- export { AnimatedFields, Appear, BreakpointGroup, FieldInset, FieldList, FieldRun, FieldSection, FieldUnit, FieldUnitRow, FieldsetSection, GroupTabs, INSET_LINE, IconGroup, InsetScope, RHYTHM, SHORT_TEXT_MAX, arrangeFields, columnSpans, defaultGroup, groupSummary, isBreakpointName, isColumnField, isShort, splitIcons, useGroupStatus, useInsetDepth, useRhythm };
1192
+ export { AnimatedFields, Appear, BreakpointGroup, FieldInset, FieldList, FieldRun, FieldSection, FieldUnit, FieldUnitRow, FieldsetSection, GroupTabs, INSET_LINE, IconGroup, InsetScope, ObjectGroup, RHYTHM, SHORT_TEXT_MAX, SubGroup, arrangeFields, columnSpans, defaultGroup, dependentFields, groupSummary, isBreakpointName, isColumnField, isShort, splitIcons, useGroupStatus, useInsetDepth, useRhythm };
995
1193
 
996
1194
  //# sourceMappingURL=grouping.js.map