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