@cosmicdrift/kumiko-renderer 0.419.0 → 0.421.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/app/action-form-body.js +7 -3
- package/dist/app/action-form-preview.d.ts +1 -1
- package/dist/app/action-form-preview.js +1 -1
- package/dist/app/action-form-support.d.ts +2 -0
- package/dist/app/action-form-support.js +16 -2
- package/dist/app/content-editors.d.ts +2 -0
- package/dist/app/entity-edit-prefill.js +24 -26
- package/dist/app/projection-detail-body.js +22 -1
- package/dist/app/projection-detail-header-model.js +2 -6
- package/dist/app/projection-detail-header-region.js +32 -21
- package/dist/app/projection-detail-header.d.ts +1 -0
- package/dist/app/use-projection-detail-layout.d.ts +2 -0
- package/dist/app/use-projection-detail-layout.js +2 -2
- package/dist/components/document-field-editor.d.ts +7 -0
- package/dist/components/document-field-editor.js +9 -0
- package/dist/components/document-text.d.ts +3 -0
- package/dist/components/document-text.js +32 -0
- package/dist/components/page-help-button.d.ts +43 -0
- package/dist/components/page-help-button.js +84 -0
- package/dist/components/render-edit-field-grid.js +10 -6
- package/dist/components/render-edit-section-kinds.js +8 -2
- package/dist/components/render-edit-types.d.ts +2 -0
- package/dist/components/render-field-ai-assist.js +19 -5
- package/dist/components/render-field-control.js +25 -3
- package/dist/components/render-list-toolbar.d.ts +1 -1
- package/dist/components/render-list-toolbar.js +2 -2
- package/dist/components/render-list.js +12 -2
- package/dist/headless/form/index.d.ts +1 -1
- package/dist/headless/form/index.js +1 -1
- package/dist/headless/format/document-values.d.ts +3 -0
- package/dist/headless/format/document-values.js +19 -8
- package/dist/headless/format/index.d.ts +1 -1
- package/dist/headless/index.d.ts +3 -3
- package/dist/headless/index.js +2 -2
- package/dist/headless/view-model/edit.js +15 -0
- package/dist/headless/view-model/index.d.ts +1 -1
- package/dist/headless/view-model/index.js +1 -1
- package/dist/headless/view-model/list.d.ts +1 -0
- package/dist/headless/view-model/list.js +3 -0
- package/dist/headless/view-model/types.d.ts +8 -1
- package/dist/i18n-defaults.js +3 -0
- package/dist/primitives.d.ts +13 -1
- package/dist/primitives.js +1 -1
- package/dist/status-tone.d.ts +4 -0
- package/dist/status-tone.js +6 -0
- package/dist/web/icons.d.ts +1 -0
- package/dist/web/icons.js +2 -1
- package/dist/web/primitives/button.d.ts +1 -1
- package/dist/web/primitives/button.js +3 -3
- package/dist/web/primitives/dialog.d.ts +1 -1
- package/dist/web/primitives/dialog.js +2 -2
- package/dist/web/primitives/layout-elements.d.ts +1 -1
- package/dist/web/primitives/layout-elements.js +8 -1
- package/dist/web/primitives/page-header.d.ts +1 -1
- package/dist/web/primitives/page-header.js +5 -5
- package/package.json +5 -5
- package/src/changes.json +24 -0
|
@@ -7,7 +7,7 @@ import { useRef, useState } from "react";
|
|
|
7
7
|
import { useTranslation } from "../../index.js";
|
|
8
8
|
import { cn } from "../lib/cn.js";
|
|
9
9
|
import { ModalShell } from "./modal-shell.js";
|
|
10
|
-
export function DefaultDialog({ open, onOpenChange, title, description, confirmLabel, cancelLabel, variant = "default", initialFocus, onConfirm, children, testId, }) {
|
|
10
|
+
export function DefaultDialog({ open, onOpenChange, title, description, confirmLabel, cancelLabel, hideCancel = false, variant = "default", initialFocus, onConfirm, children, testId, }) {
|
|
11
11
|
const t = useTranslation();
|
|
12
12
|
const [loading, setLoading] = useState(false);
|
|
13
13
|
const confirmButtonRef = useRef(null);
|
|
@@ -38,5 +38,5 @@ export function DefaultDialog({ open, onOpenChange, title, description, confirmL
|
|
|
38
38
|
event.preventDefault();
|
|
39
39
|
(focusTarget === "cancel" ? cancelButtonRef : confirmButtonRef).current?.focus();
|
|
40
40
|
},
|
|
41
|
-
}), children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(DialogPrimitive.Title, { className: "text-lg font-semibold tracking-tight", children: title }), description !== undefined && (_jsx(DialogPrimitive.Description, { className: "text-sm text-muted-foreground", children: description }))] }), children !== undefined && _jsx("div", { children: children }), _jsxs("div", { className: "flex items-center justify-end gap-2", children: [_jsx(DialogPrimitive.Close, { asChild: true, children: _jsx("button", { ref: cancelButtonRef, type: "button", disabled: loading, "data-testid": testId !== undefined ? `${testId}-cancel` : undefined, className: "inline-flex h-9 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50", children: effectiveCancelLabel }) }), _jsxs("button", { ref: confirmButtonRef, type: "button", onClick: () => void handleConfirm(), disabled: loading, "data-testid": testId !== undefined ? `${testId}-confirm` : undefined, className: cn("inline-flex h-9 items-center justify-center gap-2 rounded-md px-4 py-2 text-sm font-medium", "disabled:pointer-events-none disabled:opacity-50", confirmClass), children: [loading && _jsx(Loader2, { className: "size-4 animate-spin", "aria-hidden": "true" }), effectiveConfirmLabel] })] })] }));
|
|
41
|
+
}), children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(DialogPrimitive.Title, { className: "text-lg font-semibold tracking-tight", children: title }), description !== undefined && (_jsx(DialogPrimitive.Description, { className: "text-sm text-muted-foreground", children: description }))] }), children !== undefined && _jsx("div", { children: children }), _jsxs("div", { className: "flex items-center justify-end gap-2", children: [!hideCancel && (_jsx(DialogPrimitive.Close, { asChild: true, children: _jsx("button", { ref: cancelButtonRef, type: "button", disabled: loading, "data-testid": testId !== undefined ? `${testId}-cancel` : undefined, className: "inline-flex h-9 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50", children: effectiveCancelLabel }) })), _jsxs("button", { ref: confirmButtonRef, type: "button", onClick: () => void handleConfirm(), disabled: loading, "data-testid": testId !== undefined ? `${testId}-confirm` : undefined, className: cn("inline-flex h-9 items-center justify-center gap-2 rounded-md px-4 py-2 text-sm font-medium", "disabled:pointer-events-none disabled:opacity-50", confirmClass), children: [loading && _jsx(Loader2, { className: "size-4 animate-spin", "aria-hidden": "true" }), effectiveConfirmLabel] })] })] }));
|
|
42
42
|
}
|
|
@@ -3,7 +3,7 @@ import type { FillContainerProps, GridCellProps, GridProps, HeadingProps, LinkPr
|
|
|
3
3
|
import "../react-css-custom-properties.ts";
|
|
4
4
|
export declare function DefaultSection({ id, title, subtitle, subtitleBelowLgOnly, children, actions, variant, layout, titleStyle, hint, testId, icon, }: SectionProps): ReactNode;
|
|
5
5
|
export declare function DefaultFillContainer({ children, testId, grow, className, }: FillContainerProps): ReactNode;
|
|
6
|
-
export declare function DefaultGrid({ columns, children, testId, maxRows, flow, list, ariaLabelledBy, tight, facts, }: GridProps): ReactNode;
|
|
6
|
+
export declare function DefaultGrid({ columns, children, testId, maxRows, flow, list, ariaLabelledBy, tight, facts, legend, ruled, }: GridProps): ReactNode;
|
|
7
7
|
export declare function DefaultGridCell({ span, width, hideOnNarrow, children }: GridCellProps): ReactNode;
|
|
8
8
|
export declare function DefaultText({ variant, decorative, concealed, narrow, children, testId, }: TextProps): ReactNode;
|
|
9
9
|
export declare function isPlainPrimaryClick(event: MouseEvent): boolean;
|
|
@@ -92,7 +92,7 @@ const FIELD_CELL_WIDTH_CLASS = {
|
|
|
92
92
|
// switch (1.15rem) gets (h-9 input − switch) / 2 margin to sit on the input line.
|
|
93
93
|
toggle: "w-auto min-w-40 shrink-0 self-start [&_[data-slot=switch]]:my-[0.55rem]",
|
|
94
94
|
};
|
|
95
|
-
export function DefaultGrid({ columns, children, testId, maxRows, flow, list, ariaLabelledBy, tight, facts, }) {
|
|
95
|
+
export function DefaultGrid({ columns, children, testId, maxRows, flow, list, ariaLabelledBy, tight, facts, legend, ruled, }) {
|
|
96
96
|
const insideDrawerBody = useContext(DrawerBodyContext);
|
|
97
97
|
const groupProps = ariaLabelledBy !== undefined
|
|
98
98
|
? { role: "group", "aria-labelledby": ariaLabelledBy }
|
|
@@ -100,6 +100,13 @@ export function DefaultGrid({ columns, children, testId, maxRows, flow, list, ar
|
|
|
100
100
|
if (list === true) {
|
|
101
101
|
return (_jsx("div", { ...groupProps, "data-testid": testId, className: "flex flex-col divide-y divide-border", children: children }));
|
|
102
102
|
}
|
|
103
|
+
if (legend === true) {
|
|
104
|
+
return (_jsx("div", { ...groupProps, "data-testid": testId, "data-legend": "", className: cn("grid items-start [&>:nth-child(odd)]:whitespace-nowrap", ruled === true
|
|
105
|
+
? "grid-cols-[13rem_minmax(0,1fr)]"
|
|
106
|
+
: "grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-3"), children: ruled === true
|
|
107
|
+
? Children.map(children, (child, index) => (_jsx("div", { className: cn("flex flex-wrap items-baseline border-t border-border py-3", index % 2 === 0 ? "pr-4" : "", index < 2 ? "border-t-0" : ""), children: child })))
|
|
108
|
+
: children }));
|
|
109
|
+
}
|
|
103
110
|
if (facts === true && typeof columns === "number") {
|
|
104
111
|
const factStyle = {
|
|
105
112
|
"--grid-cols": `repeat(${columns}, minmax(0, 1fr))`,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import type { PageHeaderProps } from "../../index.ts";
|
|
3
|
-
export declare function DefaultPageHeader({ title, recordTitle, narrowRecordTitle, status, actions, bodyTitle, overflowItems, hideBreadcrumb, breadcrumbScreenId, }: PageHeaderProps): ReactNode;
|
|
3
|
+
export declare function DefaultPageHeader({ title, recordTitle, narrowRecordTitle, status, help, actions, bodyTitle, overflowItems, hideBreadcrumb, breadcrumbScreenId, }: PageHeaderProps): ReactNode;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Fragment as _Fragment,
|
|
1
|
+
import { Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useLayoutEffect } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import { usePageHeaderSlot } from "../layout/page-header-slot.js";
|
|
5
5
|
import { UNIFORM_BAR_CONTROLS_CLASSES } from "../layout/uniform-bar-controls.js";
|
|
6
6
|
import { cn } from "../lib/cn.js";
|
|
7
|
-
export function DefaultPageHeader({ title, recordTitle, narrowRecordTitle, status, actions, bodyTitle, overflowItems, hideBreadcrumb, breadcrumbScreenId, }) {
|
|
7
|
+
export function DefaultPageHeader({ title, recordTitle, narrowRecordTitle, status, help, actions, bodyTitle, overflowItems, hideBreadcrumb, breadcrumbScreenId, }) {
|
|
8
8
|
const slot = usePageHeaderSlot();
|
|
9
9
|
const setOverflowItems = slot?.setOverflowItems;
|
|
10
10
|
const setTitle = slot?.setTitle;
|
|
@@ -59,11 +59,11 @@ export function DefaultPageHeader({ title, recordTitle, narrowRecordTitle, statu
|
|
|
59
59
|
return () => setOverflowItems(undefined);
|
|
60
60
|
}, [setOverflowItems, overflowItems]);
|
|
61
61
|
if (slot === null) {
|
|
62
|
-
return (_jsxs("div", { "data-kumiko-layout": "page-header-inline", className: "flex items-center gap-2 px-4 py-2", children: [status,
|
|
62
|
+
return (_jsxs("div", { "data-kumiko-layout": "page-header-inline", className: "flex items-center gap-2 px-4 py-2", children: [status, _jsxs("div", { className: cn("ml-auto flex items-center gap-2", UNIFORM_BAR_CONTROLS_CLASSES), children: [actions, help] })] }));
|
|
63
63
|
}
|
|
64
64
|
return (_jsxs(_Fragment, { children: [status !== undefined &&
|
|
65
65
|
slot.statusElement !== null &&
|
|
66
|
-
createPortal(status, slot.statusElement), actions !== undefined &&
|
|
66
|
+
createPortal(status, slot.statusElement), (actions !== undefined || help !== undefined) &&
|
|
67
67
|
slot.actionsElement !== null &&
|
|
68
|
-
createPortal(actions, slot.actionsElement)] }));
|
|
68
|
+
createPortal(_jsxs(_Fragment, { children: [actions, help] }), slot.actionsElement)] }));
|
|
69
69
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.421.0",
|
|
4
4
|
"description": "React renderer for Kumiko screens. The root export holds the platform-agnostic logic (primitives contract, hooks, KumikoScreen, navigation and SSE abstractions); ./headless the DOM-free UI logic, ./live the HTTP dispatcher, ./web the browser bindings (HTML primitives, history navigation, EventSource live events, createKumikoApp).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
52
|
-
"@cosmicdrift/kumiko-types": "0.
|
|
51
|
+
"@cosmicdrift/kumiko-framework": "0.421.0",
|
|
52
|
+
"@cosmicdrift/kumiko-types": "0.421.0",
|
|
53
53
|
"@types/qrcode": "^1.5.6",
|
|
54
54
|
"class-variance-authority": "^0.7.1",
|
|
55
55
|
"clsx": "^2.1.1",
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@cosmicdrift/kumiko-locale-de": "0.
|
|
83
|
-
"@cosmicdrift/kumiko-testing": "0.
|
|
82
|
+
"@cosmicdrift/kumiko-locale-de": "0.421.0",
|
|
83
|
+
"@cosmicdrift/kumiko-testing": "0.421.0",
|
|
84
84
|
"@tailwindcss/cli": "^4.3.3",
|
|
85
85
|
"@testing-library/react": "^16.3.3",
|
|
86
86
|
"@testing-library/user-event": "^14.6.8",
|
package/src/changes.json
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.420.0",
|
|
4
|
+
"type": "improvement",
|
|
5
|
+
"title": "Action-form facts can show a stored file",
|
|
6
|
+
"detail": "A preview or success fact with type \"file\" reads a FileRef id or an array of ids from the result and renders the file list with name, download link and inline PDF preview."
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"version": "0.420.0",
|
|
10
|
+
"type": "improvement",
|
|
11
|
+
"title": "Document editor for longText fields, preview inside a section",
|
|
12
|
+
"detail": "Field option `editor: \"document\"` (longText only; works with `aiAssist`: the text is inserted as paragraphs) renders the registered document editor instead of a textarea; boot rule `form/editor-field-type`. New fields-section option `flow: false` gives a screen form or drawer section a grid of `columns` equal cells; without it the flow layout (field width by type) stays as before. `ActionFormPreview.section` places the preview panel at the end of a fields section with that id (boot rule `action-form-preview/section-unknown`); without it the panel stays below the form, and without `title` it has no title row."
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"version": "0.420.0",
|
|
16
|
+
"type": "improvement",
|
|
17
|
+
"title": "General page help",
|
|
18
|
+
"detail": "Set `pageHelp: { sections: [{ kind: \"status\", field: \"status\" }] }` on an entityList or a projectionDetail (with `entity` on the detail) and the page gets an \"Explanations\" button in the shell header. Its drawer shows each option of the select field with the same badge as the list and a sentence from the i18n key `<option label key>:help`; `{ kind: \"text\", title, text }` adds free text. relatedList sections contribute their sections to the page's help instead of rendering a button. Boot fails when a status field is not a select field or an option has no help text in a locale its label has. New `PageHeader.help`, `Dialog.hideCancel` and icon key `help-circle`."
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"version": "0.420.0",
|
|
22
|
+
"type": "fix",
|
|
23
|
+
"title": "A null field value no longer blocks AI-assist regeneration",
|
|
24
|
+
"detail": "A `null` field value no longer blocks AI-assist regeneration. `isCurrencyOnlyMoney` is exported from the renderer headless barrel."
|
|
25
|
+
},
|
|
2
26
|
{
|
|
3
27
|
"version": "0.417.0",
|
|
4
28
|
"type": "breaking",
|