@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.
- 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 +91 -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 +406 -24
- package/dist/controls/rich-text/blocks.js.map +1 -1
- package/dist/controls/rich-text/catalog.d.ts +45 -7
- package/dist/controls/rich-text/catalog.js +507 -37
- 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 +4 -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 +77 -7
- package/dist/controls/rich-text/dom.js.map +1 -1
- package/dist/controls/rich-text/editor.js +243 -55
- 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/rewriteSelection.d.ts +25 -0
- package/dist/controls/rich-text/rewriteSelection.js +28 -0
- package/dist/controls/rich-text/rewriteSelection.js.map +1 -0
- package/dist/controls/rich-text/slash-preview.d.ts +8 -0
- package/dist/controls/rich-text/slash-preview.js +300 -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 +1057 -0
- package/dist/controls/rich-text/table-grid.js.map +1 -0
- package/dist/controls/rich-text/toolbar.js +61 -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 +222 -64
- package/dist/engine/field-shell.js.map +1 -1
- package/dist/engine/frame.js +42 -4
- package/dist/engine/frame.js.map +1 -1
- package/dist/engine/grouping.d.ts +71 -10
- package/dist/engine/grouping.js +227 -29
- package/dist/engine/grouping.js.map +1 -1
- package/dist/engine/item-list.js +2 -2
- package/dist/engine/item-list.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.d.ts +2 -0
- package/dist/engine/schema-form.js +9 -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 +59 -0
- package/dist/lib/reduced-motion.d.ts +1 -0
- package/dist/lib/reduced-motion.js +19 -0
- package/dist/lib/reduced-motion.js.map +1 -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 +215 -0
- package/dist/tokens.css +274 -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 +279 -0
- package/dist/ui/content-fields.js.map +1 -0
- package/dist/ui/controls.js +3 -2
- package/dist/ui/controls.js.map +1 -1
- package/dist/ui/floating-panel.js +3 -2
- package/dist/ui/floating-panel.js.map +1 -1
- package/dist/ui/foundations.d.ts +118 -0
- package/dist/ui/foundations.js +565 -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 +412 -0
- package/dist/ui/inspector.js +1218 -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/tab.js +3 -2
- package/dist/ui/tab.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,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
|
|
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,
|
|
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
|
-
*
|
|
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
|
-
|
|
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:
|
|
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) =>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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 =
|
|
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
|
|
426
|
-
* the
|
|
427
|
-
*
|
|
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(
|
|
431
|
-
|
|
432
|
-
"
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
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
|
-
/**
|
|
440
|
-
var
|
|
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
|
|
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:
|
|
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
|