@cosmicdrift/kumiko-renderer 0.418.0 → 0.420.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 +17 -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/editor/editor-rail.js +1 -1
- package/dist/web/editor/editor-toolbar-pill.d.ts +4 -0
- package/dist/web/editor/editor-toolbar-pill.js +5 -0
- package/dist/web/editor/index.d.ts +1 -0
- package/dist/web/editor/index.js +1 -0
- package/dist/web/icons.d.ts +1 -0
- package/dist/web/icons.js +2 -1
- package/dist/web/index.d.ts +1 -1
- package/dist/web/index.js +1 -1
- package/dist/web/primitives/action-menu.d.ts +2 -0
- package/dist/web/primitives/action-menu.js +1 -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/modal.d.ts +1 -1
- package/dist/web/primitives/modal.js +2 -2
- package/dist/web/primitives/page-header.d.ts +1 -1
- package/dist/web/primitives/page-header.js +5 -5
- package/dist/web/primitives/row-actions.d.ts +1 -1
- package/dist/web/primitives/row-actions.js +3 -3
- package/package.json +5 -5
- package/src/changes.json +24 -0
|
@@ -8,6 +8,7 @@ import { useTranslation } from "../i18n.js";
|
|
|
8
8
|
import { usePrimitives } from "../primitives.js";
|
|
9
9
|
import { useAiAssistPayload } from "./ai-assist-payload.js";
|
|
10
10
|
import { choiceChipClass } from "./choice-chip-class.js";
|
|
11
|
+
import { documentHtmlToText, textToDocumentHtml } from "./document-text.js";
|
|
11
12
|
// Mounted only with a dispatcher; without one the field stays a plain input.
|
|
12
13
|
export function AiAssistControl(props) {
|
|
13
14
|
const dispatcher = useOptionalDispatcher();
|
|
@@ -26,7 +27,16 @@ function AiAssistChips({ field, aiAssist, onChange, input, row }) {
|
|
|
26
27
|
const [failed, setFailed] = useState(false);
|
|
27
28
|
const [note, setNote] = useState(undefined);
|
|
28
29
|
const activeRun = useRef(null);
|
|
29
|
-
const
|
|
30
|
+
const isDocument = field.editor === "document";
|
|
31
|
+
const contextValues = Object.fromEntries((aiAssist.contextFields ?? []).map((name) => {
|
|
32
|
+
const value = row?.[name];
|
|
33
|
+
return [
|
|
34
|
+
name,
|
|
35
|
+
typeof value === "string" && field.contextDocumentFields?.includes(name)
|
|
36
|
+
? documentHtmlToText(value)
|
|
37
|
+
: value,
|
|
38
|
+
];
|
|
39
|
+
}));
|
|
30
40
|
// Changed context (e.g. another selection) replaces an empty or AI-written text; the first render never fetches.
|
|
31
41
|
// Debounced so a text context field does not fire one server-side LLM query per keystroke.
|
|
32
42
|
const contextKey = useDebouncedValue(JSON.stringify(contextValues), REFERENCE_SEARCH_DEBOUNCE_MS);
|
|
@@ -71,16 +81,20 @@ function AiAssistChips({ field, aiAssist, onChange, input, row }) {
|
|
|
71
81
|
setFailed(true);
|
|
72
82
|
return;
|
|
73
83
|
}
|
|
74
|
-
|
|
75
|
-
|
|
84
|
+
const written = isDocument ? textToDocumentHtml(text) : text;
|
|
85
|
+
lastGeneratedText.current = written;
|
|
86
|
+
onChange(written);
|
|
76
87
|
};
|
|
77
88
|
// The effect reads the latest run/active through a ref so it only fires when the context changes.
|
|
78
89
|
const rerunWithCurrentChips = useRef(() => { });
|
|
79
90
|
rerunWithCurrentChips.current = () => void run(active, undefined);
|
|
80
91
|
const hasHandWrittenText = useRef(false);
|
|
81
|
-
|
|
92
|
+
const isFieldEmpty = field.value === "" || field.value === null || field.value === undefined;
|
|
93
|
+
hasHandWrittenText.current = !isFieldEmpty && field.value !== lastGeneratedText.current;
|
|
82
94
|
useEffect(() => {
|
|
83
95
|
// skip: nothing changed since the last run (or since mount).
|
|
96
|
+
if (aiAssist.autoRun === false)
|
|
97
|
+
return;
|
|
84
98
|
if (seenContextKey.current === contextKey)
|
|
85
99
|
return;
|
|
86
100
|
seenContextKey.current = contextKey;
|
|
@@ -88,7 +102,7 @@ function AiAssistChips({ field, aiAssist, onChange, input, row }) {
|
|
|
88
102
|
if (hasHandWrittenText.current)
|
|
89
103
|
return;
|
|
90
104
|
rerunWithCurrentChips.current();
|
|
91
|
-
}, [contextKey]);
|
|
105
|
+
}, [contextKey, aiAssist.autoRun]);
|
|
92
106
|
const toggle = (index) => {
|
|
93
107
|
const next = new Set(active);
|
|
94
108
|
if (!next.delete(index))
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { telHref } from "../headless/index.js";
|
|
3
3
|
import { AvailabilityOptionsSelect } from "./availability-options-select.js";
|
|
4
|
+
import { DocumentFieldEditor } from "./document-field-editor.js";
|
|
5
|
+
import { documentHtmlToText } from "./document-text.js";
|
|
4
6
|
import { EmbeddedListField } from "./embedded-list-field.js";
|
|
5
7
|
import { QueryOptionsSelect } from "./query-options-select.js";
|
|
6
8
|
import { AiAssistControl } from "./render-field-ai-assist.js";
|
|
@@ -10,6 +12,7 @@ import { isComplexFieldType, isFileFieldType } from "./render-field-meta.js";
|
|
|
10
12
|
import { FieldRendererOutput, readOnlyDisplayText } from "./render-field-read-only.js";
|
|
11
13
|
import { ReadOnlyReferenceValue, ReferenceInput } from "./render-field-reference.js";
|
|
12
14
|
import { ValueChipsControl } from "./render-field-value-chips.js";
|
|
15
|
+
import { stringValue } from "./render-field-values.js";
|
|
13
16
|
import { WriteOnlyTextInput } from "./render-field-write-only.js";
|
|
14
17
|
function rowOf({ field, row }) {
|
|
15
18
|
return row ?? { [field.field]: field.value };
|
|
@@ -69,15 +72,21 @@ function contactHref(field) {
|
|
|
69
72
|
}
|
|
70
73
|
return undefined;
|
|
71
74
|
}
|
|
75
|
+
function displayTextOf(field, appLocale, t) {
|
|
76
|
+
const plain = field.editor === "document" && typeof field.value === "string"
|
|
77
|
+
? { ...field, value: documentHtmlToText(field.value) }
|
|
78
|
+
: field;
|
|
79
|
+
return readOnlyDisplayText(plain, appLocale, t);
|
|
80
|
+
}
|
|
72
81
|
const readOnlyTextRule = ({ field, Text, Link, appLocale, t, readOnlyText }) => {
|
|
73
82
|
if (!readOnlyText || isComplexFieldType(field.type) || isFileFieldType(field.type)) {
|
|
74
83
|
return undefined;
|
|
75
84
|
}
|
|
76
85
|
const href = contactHref(field);
|
|
77
86
|
if (href !== undefined) {
|
|
78
|
-
return (_jsx(Link, { href: href, className: "underline", testId: `field-value-${field.field}`, children:
|
|
87
|
+
return (_jsx(Link, { href: href, className: "underline", testId: `field-value-${field.field}`, children: displayTextOf(field, appLocale, t) }));
|
|
79
88
|
}
|
|
80
|
-
return (_jsx(Text, { testId: `field-value-${field.field}`, ...(field.concealed === true && { concealed: true }), children:
|
|
89
|
+
return (_jsx(Text, { testId: `field-value-${field.field}`, ...(field.concealed === true && { concealed: true }), children: displayTextOf(field, appLocale, t) }));
|
|
81
90
|
};
|
|
82
91
|
const writeOnlyRule = ({ field, id, hasError, onChange, changed, readOnlyText }) => {
|
|
83
92
|
if (field.type !== "text" || field.writeOnly !== true || readOnlyText)
|
|
@@ -91,11 +100,23 @@ const fillActionRule = (ctx) => {
|
|
|
91
100
|
return undefined;
|
|
92
101
|
return (_jsx(FillActionControl, { field: field, fillAction: fillAction, row: rowOf(ctx), onChange: onChange, disabled: fillDisabled === true, Banner: Banner, renderControl: (fill) => renderInput({ ...ctx, fill }) }));
|
|
93
102
|
};
|
|
103
|
+
// Without a registered "document" editor useContentEditor falls back to a textarea.
|
|
104
|
+
function documentEditorInput({ field, id, onChange }) {
|
|
105
|
+
if (field.editor !== "document" || field.type !== "longText")
|
|
106
|
+
return undefined;
|
|
107
|
+
return (_jsx(DocumentFieldEditor, { id: id, value: stringValue(field.value), readOnly: field.readOnly, onChange: onChange }));
|
|
108
|
+
}
|
|
109
|
+
const documentEditorRule = (ctx) => {
|
|
110
|
+
// skip: the assist rule wraps this same editor
|
|
111
|
+
if (ctx.field.aiAssist !== undefined && !ctx.field.readOnly)
|
|
112
|
+
return undefined;
|
|
113
|
+
return documentEditorInput(ctx);
|
|
114
|
+
};
|
|
94
115
|
const aiAssistRule = (ctx) => {
|
|
95
116
|
const { field, onChange } = ctx;
|
|
96
117
|
if (field.aiAssist === undefined || field.readOnly)
|
|
97
118
|
return undefined;
|
|
98
|
-
return (_jsx(AiAssistControl, { field: field, row: rowOf(ctx), aiAssist: field.aiAssist, onChange: onChange, input: renderInput(ctx) }));
|
|
119
|
+
return (_jsx(AiAssistControl, { field: field, row: rowOf(ctx), aiAssist: field.aiAssist, onChange: onChange, input: documentEditorInput(ctx) ?? renderInput(ctx) }));
|
|
99
120
|
};
|
|
100
121
|
const valueChipsRule = (ctx) => {
|
|
101
122
|
const { field, onChange } = ctx;
|
|
@@ -111,6 +132,7 @@ const CONTROL_RULES = [
|
|
|
111
132
|
selectAvailabilityRule,
|
|
112
133
|
readOnlyTextRule,
|
|
113
134
|
writeOnlyRule,
|
|
135
|
+
documentEditorRule,
|
|
114
136
|
fillActionRule,
|
|
115
137
|
aiAssistRule,
|
|
116
138
|
valueChipsRule,
|
|
@@ -34,6 +34,6 @@ type EmptyStateModel = {
|
|
|
34
34
|
readonly effectiveCreateLabel: string;
|
|
35
35
|
};
|
|
36
36
|
export declare function composeEmptyState(model: EmptyStateModel): ReactNode;
|
|
37
|
-
export declare function renderPageHeader(PageHeader: NonNullable<Primitives["PageHeader"]>, headerActions: ReactNode, promotedInOverflowMenu: boolean, promotedMenuItems: readonly ActionMenuItemSpec[]): ReactNode;
|
|
37
|
+
export declare function renderPageHeader(PageHeader: NonNullable<Primitives["PageHeader"]>, headerActions: ReactNode, help: ReactNode, promotedInOverflowMenu: boolean, promotedMenuItems: readonly ActionMenuItemSpec[]): ReactNode;
|
|
38
38
|
export declare function renderMenuActionError(Banner: Primitives["Banner"], menuActionError: string): ReactNode;
|
|
39
39
|
export {};
|
|
@@ -34,8 +34,8 @@ export function composeEmptyState(model) {
|
|
|
34
34
|
return (emptyState ??
|
|
35
35
|
(onCreate !== undefined || emptyContent !== undefined || narrowed || defaultFilterActive ? (_jsx(ListEmptyStateBody, { content: emptyContent, narrowed: narrowed, namedFilterEmpty: namedFilterEmpty, defaultFilterActive: defaultFilterActive, ...(onFilterReset !== undefined && { onShowAll: onFilterReset }), translate: translate, createButton: onCreate !== undefined && !narrowed && !defaultFilterActive && !createInPageHeader ? (_jsx(Button, { variant: "primary", icon: "plus", onClick: onCreate, testId: "render-list-empty-create", children: effectiveCreateLabel })) : undefined })) : undefined));
|
|
36
36
|
}
|
|
37
|
-
export function renderPageHeader(PageHeader, headerActions, promotedInOverflowMenu, promotedMenuItems) {
|
|
38
|
-
return (_jsx(PageHeader, { actions: headerActions, ...(promotedInOverflowMenu && { overflowItems: promotedMenuItems }) }));
|
|
37
|
+
export function renderPageHeader(PageHeader, headerActions, help, promotedInOverflowMenu, promotedMenuItems) {
|
|
38
|
+
return (_jsx(PageHeader, { actions: headerActions, ...(help !== undefined && { help }), ...(promotedInOverflowMenu && { overflowItems: promotedMenuItems }) }));
|
|
39
39
|
}
|
|
40
40
|
export function renderMenuActionError(Banner, menuActionError) {
|
|
41
41
|
return (_jsx(Banner, { variant: "error", testId: "render-list-toolbar-action-error", children: menuActionError }));
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useState } from "react";
|
|
3
|
+
import { useAppFeatures } from "../app/app-features-context.js";
|
|
3
4
|
import { useIsStandInScreen } from "../app/locked-screen-header.js";
|
|
4
5
|
import { useTranslation } from "../i18n.js";
|
|
5
6
|
import { usePageHeaderCompact, usePageHeaderSlotAvailable } from "../page-header-slot.js";
|
|
6
7
|
import { usePrimitives } from "../primitives.js";
|
|
8
|
+
import { pageHelpButtonOf } from "./page-help-button.js";
|
|
7
9
|
import { renderReferenceLookupBridges } from "./render-list-reference-bridge.js";
|
|
8
10
|
import { rowMutedFromField, rowToneFromField } from "./render-list-row-tone.js";
|
|
9
11
|
import { tableChromeProps, tableFilterProps, tableLayoutProps, tableRowProps, tableSortPagingProps, } from "./render-list-table-props.js";
|
|
@@ -16,6 +18,7 @@ export function RenderList(props) {
|
|
|
16
18
|
// As in RenderEdit, fall back to the i18next context for translation;
|
|
17
19
|
// otherwise column headers would display raw i18n keys.
|
|
18
20
|
const t = useTranslation();
|
|
21
|
+
const appFeatures = useAppFeatures();
|
|
19
22
|
const translate = translateProp ?? t;
|
|
20
23
|
const isStandIn = useIsStandInScreen();
|
|
21
24
|
const { DataTable, Button, Dialog, Input, Banner, PageHeader } = usePrimitives();
|
|
@@ -85,6 +88,13 @@ export function RenderList(props) {
|
|
|
85
88
|
setMenuActionBusyId,
|
|
86
89
|
setMenuActionError,
|
|
87
90
|
});
|
|
91
|
+
const pageHelp = pageHelpButtonOf([{ spec: screen.pageHelp, defaultEntity: screen.entity }], {
|
|
92
|
+
featureName,
|
|
93
|
+
screenId: screen.id,
|
|
94
|
+
ownEntities: { [screen.entity]: entity },
|
|
95
|
+
translate,
|
|
96
|
+
appFeatures,
|
|
97
|
+
});
|
|
88
98
|
const headerActions = renderHeaderActions(toolbarModel, createButton);
|
|
89
99
|
const toolbarEnd = renderToolbarEnd(toolbarModel, createButton);
|
|
90
100
|
const composedEmptyState = composeEmptyState({
|
|
@@ -101,9 +111,9 @@ export function RenderList(props) {
|
|
|
101
111
|
effectiveCreateLabel,
|
|
102
112
|
});
|
|
103
113
|
const toolbarTitle = resolveToolbarTitle(screen, translate);
|
|
104
|
-
return (_jsxs(_Fragment, { children: [(headerActions !== undefined || split.promotedInOverflowMenu) &&
|
|
114
|
+
return (_jsxs(_Fragment, { children: [(headerActions !== undefined || pageHelp !== undefined || split.promotedInOverflowMenu) &&
|
|
105
115
|
PageHeader !== undefined &&
|
|
106
|
-
renderPageHeader(PageHeader, headerActions, split.promotedInOverflowMenu, promotedMenuItems), split.promotedInOverflowMenu &&
|
|
116
|
+
renderPageHeader(PageHeader, headerActions, pageHelp, split.promotedInOverflowMenu, promotedMenuItems), split.promotedInOverflowMenu &&
|
|
107
117
|
menuActionError !== null &&
|
|
108
118
|
renderMenuActionError(Banner, menuActionError), renderReferenceLookupBridges(referenceRequests, handleLookupMap), _jsx(DataTable, { columns: enrichedVm.columns, rows: enrichedVm.rows, toolbarTitle: toolbarTitle, ...tableChromeProps({
|
|
109
119
|
onRowClick,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createFormController } from "./form-controller.ts";
|
|
1
|
+
export { createFormController, isCurrencyOnlyMoney } from "./form-controller.ts";
|
|
2
2
|
export type { FieldConditionPredicate, FieldConditions, FieldConditionValue, FieldState, FormController, FormControllerOptions, FormSnapshot, FormValues, SubmitConfig, SubmitPayloadMode, SubmitResult, } from "./types.ts";
|
|
3
3
|
export { groupIssuesByPath, I18N_KEY_PARAM, relevantFieldIssues, zodErrorToFieldIssues, } from "./zod-bridge.ts";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createFormController } from "./form-controller.js";
|
|
1
|
+
export { createFormController, isCurrencyOnlyMoney } from "./form-controller.js";
|
|
2
2
|
export { groupIssuesByPath, I18N_KEY_PARAM, relevantFieldIssues, zodErrorToFieldIssues, } from "./zod-bridge.js";
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export declare const DOCUMENT_FALLBACK_CURRENCY = "EUR";
|
|
2
2
|
export declare function formatDocumentMoney(value: unknown, tenantCurrency: string, locale: string): string;
|
|
3
|
+
/** "long" is "15. Januar 2026", "short" the numeric "15.01.2026" of the locale. */
|
|
4
|
+
export type DocumentDateStyle = "short" | "long";
|
|
3
5
|
export type DocumentDateOptions = {
|
|
6
|
+
readonly dateStyle?: DocumentDateStyle;
|
|
4
7
|
/** Append the time of day. Only instants and offset date-times carry one; a
|
|
5
8
|
* date-only value prints just the date. */
|
|
6
9
|
readonly time?: boolean;
|
|
@@ -21,16 +21,27 @@ export function formatDocumentMoney(value, tenantCurrency, locale) {
|
|
|
21
21
|
}
|
|
22
22
|
return value === undefined || value === null ? "" : String(value);
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
const SHORT_DATE_FIELDS = { day: "2-digit", month: "2-digit", year: "numeric" };
|
|
25
|
+
function dateFields(style) {
|
|
26
|
+
return style === "short" ? SHORT_DATE_FIELDS : { dateStyle: "long" };
|
|
27
|
+
}
|
|
28
|
+
function formatOffsetDateTime(value, locale, withTime, dateStyle) {
|
|
25
29
|
const wallClock = Temporal.PlainDateTime.from(value);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
if (!withTime)
|
|
31
|
+
return wallClock.toPlainDate().toLocaleString(locale, dateFields(dateStyle));
|
|
32
|
+
return wallClock.toLocaleString(locale, timeFields(dateStyle));
|
|
33
|
+
}
|
|
34
|
+
// Intl rejects dateStyle and individual date fields in one call, so a short date with a time
|
|
35
|
+
// spells the time as fields too.
|
|
36
|
+
function timeFields(dateStyle) {
|
|
37
|
+
return dateStyle === "short"
|
|
38
|
+
? { ...SHORT_DATE_FIELDS, hour: "2-digit", minute: "2-digit" }
|
|
39
|
+
: { dateStyle: "long", timeStyle: "short" };
|
|
29
40
|
}
|
|
30
41
|
function instantFormatOptions(options) {
|
|
31
42
|
if (options.time !== true)
|
|
32
|
-
return { dateStyle
|
|
33
|
-
return { dateStyle
|
|
43
|
+
return { ...dateFields(options.dateStyle), timeZone: "UTC" };
|
|
44
|
+
return { ...timeFields(options.dateStyle), timeZone: options.timeZone ?? "UTC" };
|
|
34
45
|
}
|
|
35
46
|
// The long date a rendered mail or PDF prints for a `date` placeholder; the editor's
|
|
36
47
|
// sample values use it too, so both show the same text.
|
|
@@ -43,12 +54,12 @@ export function formatDocumentDate(value, locale, options = {}) {
|
|
|
43
54
|
// A date-only string has no zone; going through an instant would show the
|
|
44
55
|
// previous day west of UTC.
|
|
45
56
|
if (typeof value === "string" && DATE_ONLY.test(value)) {
|
|
46
|
-
return Temporal.PlainDate.from(value).toLocaleString(safeLocale,
|
|
57
|
+
return Temporal.PlainDate.from(value).toLocaleString(safeLocale, dateFields(options.dateStyle));
|
|
47
58
|
}
|
|
48
59
|
// An explicit offset names the sender's zone: the calendar date is the wall-clock
|
|
49
60
|
// date of the string, not the date at UTC.
|
|
50
61
|
if (typeof value === "string" && DATE_TIME_WITH_OFFSET.test(value)) {
|
|
51
|
-
return formatOffsetDateTime(value, safeLocale, options.time === true);
|
|
62
|
+
return formatOffsetDateTime(value, safeLocale, options.time === true, options.dateStyle);
|
|
52
63
|
}
|
|
53
64
|
const instant = typeof value === "number"
|
|
54
65
|
? Temporal.Instant.fromEpochMilliseconds(value)
|
|
@@ -3,7 +3,7 @@ export declare const EMPTY_VALUE_PLACEHOLDER = "\u2014";
|
|
|
3
3
|
export declare function toInstant(raw: string): Temporal.Instant;
|
|
4
4
|
/** Exported for UnitKey parity tests against @cosmicdrift/kumiko-types/screen. */
|
|
5
5
|
export declare const UNIT_FORMAT_KEYS: readonly string[];
|
|
6
|
-
export { DOCUMENT_FALLBACK_CURRENCY, type DocumentDateOptions, formatDocumentDate, formatDocumentMoney, formatDocumentPercent, } from "./document-values.ts";
|
|
6
|
+
export { DOCUMENT_FALLBACK_CURRENCY, type DocumentDateOptions, type DocumentDateStyle, formatDocumentDate, formatDocumentMoney, formatDocumentPercent, } from "./document-values.ts";
|
|
7
7
|
export { escapeHtml, escapeHtmlAttr, escapeXml, isSafeHref, stripControlChars } from "./escape.ts";
|
|
8
8
|
export { type HtmlValue, html, RawHtml, raw } from "./html-template.ts";
|
|
9
9
|
export { currencyDecimals, formatMoney, formatMoneyValue, moneyAmountToMinor, resolveSafeMoneyLocale, } from "./money.ts";
|
package/dist/headless/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export type { AssetResolution, AssetResolveContext, AssetResolver, BadgeProps, B
|
|
|
4
4
|
export type { BatchResult, Command, Dispatcher, DispatcherError, DispatcherStatus, FieldIssue, PendingFile, PendingWrite, QueryOpts, QueryResult, StreamOpts, WriteOpts, WriteResult, } from "./dispatcher/index.ts";
|
|
5
5
|
export { generateRequestId, StreamFrame, type StreamFrameEvent } from "./dispatcher/index.ts";
|
|
6
6
|
export type { FieldConditionPredicate, FieldConditions, FieldConditionValue, FieldState, FormController, FormControllerOptions, FormSnapshot, FormValues, SubmitConfig, SubmitPayloadMode, SubmitResult, } from "./form/index.ts";
|
|
7
|
-
export { createFormController, groupIssuesByPath, I18N_KEY_PARAM, relevantFieldIssues, zodErrorToFieldIssues, } from "./form/index.ts";
|
|
8
|
-
export { applyFormatSpec, currencyDecimals, DOCUMENT_FALLBACK_CURRENCY, EMPTY_VALUE_PLACEHOLDER, escapeHtml, escapeHtmlAttr, escapeXml, formatDocumentDate, formatDocumentMoney, formatDocumentPercent, formatMoney, formatMoneyValue, type HtmlValue, html, isSafeHref, moneyAmountToMinor, RawHtml, raw, resolveSafeMoneyLocale, stripControlChars, telHref, toInstant, } from "./format/index.ts";
|
|
7
|
+
export { createFormController, groupIssuesByPath, I18N_KEY_PARAM, isCurrencyOnlyMoney, relevantFieldIssues, zodErrorToFieldIssues, } from "./form/index.ts";
|
|
8
|
+
export { applyFormatSpec, currencyDecimals, DOCUMENT_FALLBACK_CURRENCY, type DocumentDateStyle, EMPTY_VALUE_PLACEHOLDER, escapeHtml, escapeHtmlAttr, escapeXml, formatDocumentDate, formatDocumentMoney, formatDocumentPercent, formatMoney, formatMoneyValue, type HtmlValue, html, isSafeHref, moneyAmountToMinor, RawHtml, raw, resolveSafeMoneyLocale, stripControlChars, telHref, toInstant, } from "./format/index.ts";
|
|
9
9
|
export type { NavDefinition, NavNode, NavRegistrySlice, NavTree, ResolveNavigationOptions, } from "./nav/index.ts";
|
|
10
10
|
export { resolveNavigation } from "./nav/index.ts";
|
|
11
11
|
export { pluralKey } from "./plural-key.ts";
|
|
@@ -13,4 +13,4 @@ export { PWA_CACHE_NAME_PREFIX, PWA_CACHE_SCOPE_HASH_LENGTH, PWA_SERVICE_WORKER_
|
|
|
13
13
|
export type { Store, WritableStore } from "./store/index.ts";
|
|
14
14
|
export { createStore, shallowEqual } from "./store/index.ts";
|
|
15
15
|
export type { CellLink, CellLinkItem, ComputeEditViewModelInput, ComputeListViewModelInput, DerivedCellRoundingTarget, EditExtensionSectionViewModel, EditFieldSpec, EditFieldsSectionViewModel, EditFieldViewModel, EditFormMode, EditRelatedListSectionViewModel, EditSectionSpec, EditSectionViewModel, EditViewModel, EditWriteFormSectionViewModel, EmbeddedDerivedOp, EmbeddedListCellViewModel, EmbeddedListIssueGroups, FieldConditionCtx, FieldRenderer, ListColumnCellDisplay, ListColumnFileDisplay, ListColumnHintViewModel, ListColumnSpec, ListColumnViewModel, ListRowViewModel, ListViewModel, RuntimeCellLink, RuntimeCellLinkItems, RuntimeRenderer, ScreenSlots, Translate, } from "./view-model/index.ts";
|
|
16
|
-
export { buildOptionLabels, computeDerivedCellValue, computeEditViewModel, computeListViewModel, computeRelatedListSectionViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, fieldTextKey, groupEmbeddedListIssues, resolveFieldText, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./view-model/index.ts";
|
|
16
|
+
export { buildOptionLabels, computeDerivedCellValue, computeEditViewModel, computeListViewModel, computeRelatedListSectionViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionHelpKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, fieldTextKey, groupEmbeddedListIssues, resolveFieldText, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./view-model/index.ts";
|
package/dist/headless/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// parser as the server boot validator (cross-feature references).
|
|
3
3
|
export { parseRefTarget } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
4
4
|
export { generateRequestId, StreamFrame } from "./dispatcher/index.js";
|
|
5
|
-
export { createFormController, groupIssuesByPath, I18N_KEY_PARAM, relevantFieldIssues, zodErrorToFieldIssues, } from "./form/index.js";
|
|
5
|
+
export { createFormController, groupIssuesByPath, I18N_KEY_PARAM, isCurrencyOnlyMoney, relevantFieldIssues, zodErrorToFieldIssues, } from "./form/index.js";
|
|
6
6
|
export { applyFormatSpec, currencyDecimals, DOCUMENT_FALLBACK_CURRENCY, EMPTY_VALUE_PLACEHOLDER, escapeHtml, escapeHtmlAttr, escapeXml, formatDocumentDate, formatDocumentMoney, formatDocumentPercent, formatMoney, formatMoneyValue, html, isSafeHref, moneyAmountToMinor, RawHtml, raw, resolveSafeMoneyLocale, stripControlChars, telHref, toInstant, } from "./format/index.js";
|
|
7
7
|
export { resolveNavigation } from "./nav/index.js";
|
|
8
8
|
export { pluralKey } from "./plural-key.js";
|
|
9
9
|
export { PWA_CACHE_NAME_PREFIX, PWA_CACHE_SCOPE_HASH_LENGTH, PWA_SERVICE_WORKER_META_NAME, pwaCacheScopePrefixOf, } from "./pwa-service-worker-meta.js";
|
|
10
10
|
export { createStore, shallowEqual } from "./store/index.js";
|
|
11
|
-
export { buildOptionLabels, computeDerivedCellValue, computeEditViewModel, computeListViewModel, computeRelatedListSectionViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, fieldTextKey, groupEmbeddedListIssues, resolveFieldText, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./view-model/index.js";
|
|
11
|
+
export { buildOptionLabels, computeDerivedCellValue, computeEditViewModel, computeListViewModel, computeRelatedListSectionViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionHelpKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, fieldTextKey, groupEmbeddedListIssues, resolveFieldText, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./view-model/index.js";
|
|
@@ -129,6 +129,7 @@ export function computeRelatedListSectionViewModel(sectionSpec, translate) {
|
|
|
129
129
|
}
|
|
130
130
|
function relatedListQueryProps(sectionSpec) {
|
|
131
131
|
return {
|
|
132
|
+
...(sectionSpec.pageHelp !== undefined && { pageHelp: sectionSpec.pageHelp }),
|
|
132
133
|
...(sectionSpec.parentParam !== undefined && { parentParam: sectionSpec.parentParam }),
|
|
133
134
|
...(sectionSpec.parentFilter !== undefined && { parentFilter: sectionSpec.parentFilter }),
|
|
134
135
|
...(sectionSpec.entity !== undefined && { entity: sectionSpec.entity }),
|
|
@@ -181,6 +182,10 @@ function relatedListEmptyStateProps(sectionSpec, translate) {
|
|
|
181
182
|
function translateAffix(affix, translate) {
|
|
182
183
|
return typeof affix === "string" ? translate(affix) : affix;
|
|
183
184
|
}
|
|
185
|
+
function contextDocumentHints(normalized, documentFieldNames) {
|
|
186
|
+
const names = (normalized.aiAssist?.contextFields ?? []).filter((name) => documentFieldNames.has(name));
|
|
187
|
+
return names.length > 0 ? { contextDocumentFields: names } : {};
|
|
188
|
+
}
|
|
184
189
|
function deriveFieldAffixHints(normalized, translate) {
|
|
185
190
|
return {
|
|
186
191
|
...(normalized.placeholder !== undefined && { placeholder: translate(normalized.placeholder) }),
|
|
@@ -203,6 +208,9 @@ function deriveFieldAffixHints(normalized, translate) {
|
|
|
203
208
|
...(normalized.aiAssist.contextFields !== undefined && {
|
|
204
209
|
contextFields: normalized.aiAssist.contextFields,
|
|
205
210
|
}),
|
|
211
|
+
...(normalized.aiAssist.autoRun !== undefined && {
|
|
212
|
+
autoRun: normalized.aiAssist.autoRun,
|
|
213
|
+
}),
|
|
206
214
|
...(normalized.aiAssist.chips !== undefined && {
|
|
207
215
|
chips: normalized.aiAssist.chips.map((chip) => ({
|
|
208
216
|
...chip,
|
|
@@ -219,6 +227,7 @@ function deriveFieldAffixHints(normalized, translate) {
|
|
|
219
227
|
}),
|
|
220
228
|
},
|
|
221
229
|
}),
|
|
230
|
+
...(normalized.editor !== undefined && { editor: normalized.editor }),
|
|
222
231
|
...(normalized.valueChips !== undefined && { valueChips: normalized.valueChips }),
|
|
223
232
|
...(normalized.concealed === true && { concealed: true }),
|
|
224
233
|
...(normalized.badge !== undefined && {
|
|
@@ -499,6 +508,10 @@ export function computeEditViewModel(input) {
|
|
|
499
508
|
const { screen, entity, values, translate, featureName, mode, entityId, derivation, actionFormScreenQn, } = input;
|
|
500
509
|
const excludedFields = new Set(mode === undefined ? [] : screen.writeExcludedFields?.[mode]);
|
|
501
510
|
const isHiddenByExclusion = (fieldSpec) => mode === "create" && excludedFields.has(normalizeEditField(fieldSpec).field);
|
|
511
|
+
const documentFieldNames = new Set(screen.layout.sections.filter(isFieldsEditSection).flatMap((sectionSpec) => sectionFieldSpecs(sectionSpec)
|
|
512
|
+
.map(normalizeEditField)
|
|
513
|
+
.filter((n) => n.editor === "document")
|
|
514
|
+
.map((n) => n.field)));
|
|
502
515
|
const baseSections = screen.layout.sections.map((sectionSpec) => {
|
|
503
516
|
if (!isFieldsEditSection(sectionSpec)) {
|
|
504
517
|
return computeNonFieldsSectionViewModel(sectionSpec, screen.id, values, translate, featureName);
|
|
@@ -573,6 +586,7 @@ export function computeEditViewModel(input) {
|
|
|
573
586
|
...fileHints,
|
|
574
587
|
...(normalized.icon !== undefined && { icon: normalized.icon }),
|
|
575
588
|
...deriveFieldAffixHints(normalized, translate),
|
|
589
|
+
...contextDocumentHints(normalized, documentFieldNames),
|
|
576
590
|
...embeddedListHints,
|
|
577
591
|
};
|
|
578
592
|
return view;
|
|
@@ -613,6 +627,7 @@ export function computeEditViewModel(input) {
|
|
|
613
627
|
...(sectionSpec.summaryField !== undefined && { summaryField: sectionSpec.summaryField }),
|
|
614
628
|
columns: sectionSpec.columns ?? defaultColumns,
|
|
615
629
|
...(sectionSpec.columns !== undefined && { columnsDeclared: true }),
|
|
630
|
+
...(sectionSpec.flow === false && { flow: false }),
|
|
616
631
|
fields,
|
|
617
632
|
...(groups !== undefined && { groups }),
|
|
618
633
|
...(sectionSpec.icon !== undefined && { icon: sectionSpec.icon }),
|
|
@@ -4,5 +4,5 @@ export type { DerivedCellRoundingTarget, EmbeddedDerivedOp, EmbeddedListIssueGro
|
|
|
4
4
|
export { computeDerivedCellValue, groupEmbeddedListIssues, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./embedded-list.ts";
|
|
5
5
|
export { fieldTextKey, resolveFieldText } from "./field-text.ts";
|
|
6
6
|
export type { ComputeListViewModelInput } from "./list.ts";
|
|
7
|
-
export { buildOptionLabels, computeListViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, } from "./list.ts";
|
|
7
|
+
export { buildOptionLabels, computeListViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionHelpKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, } from "./list.ts";
|
|
8
8
|
export type { CellLink, CellLinkItem, EditExtensionSectionViewModel, EditFieldSpec, EditFieldsSectionViewModel, EditFieldViewModel, EditRelatedListSectionViewModel, EditSectionSpec, EditSectionViewModel, EditViewModel, EditWriteFormSectionViewModel, EmbeddedListCellViewModel, FieldConditionCtx, FieldRenderer, ListColumnCellDisplay, ListColumnFileDisplay, ListColumnHintViewModel, ListColumnSpec, ListColumnViewModel, ListRowViewModel, ListViewModel, RuntimeCellLink, RuntimeCellLinkItems, RuntimeRenderer, ScreenSlots, Translate, } from "./types.ts";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { computeEditViewModel, computeRelatedListSectionViewModel } from "./edit.js";
|
|
2
2
|
export { computeDerivedCellValue, groupEmbeddedListIssues, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./embedded-list.js";
|
|
3
3
|
export { fieldTextKey, resolveFieldText } from "./field-text.js";
|
|
4
|
-
export { buildOptionLabels, computeListViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, } from "./list.js";
|
|
4
|
+
export { buildOptionLabels, computeListViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionHelpKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, } from "./list.js";
|
|
@@ -11,6 +11,7 @@ export declare function computeListViewModel(input: ComputeListViewModelInput):
|
|
|
11
11
|
export declare function fieldLabelKey(featureName: string, entityName: string, fieldName: string): string;
|
|
12
12
|
export declare function fieldOptionLabelKeyPrefix(featureName: string, entityName: string, fieldName: string): string;
|
|
13
13
|
export declare function fieldOptionLabelKey(featureName: string, entityName: string, fieldName: string, value: string): string;
|
|
14
|
+
export declare function fieldOptionHelpKey(featureName: string, entityName: string, fieldName: string, value: string): string;
|
|
14
15
|
export declare function embeddedCellLabelKey(featureName: string, entityName: string, fieldName: string, subFieldName: string): string;
|
|
15
16
|
export declare function embeddedCellOptionLabelKey(featureName: string, entityName: string, fieldName: string, subFieldName: string, value: string): string;
|
|
16
17
|
export declare function buildOptionLabels(translate: (key: string, params?: Readonly<Record<string, unknown>>) => string, keyFor: (value: string) => string, options: readonly string[]): Readonly<Record<string, string>>;
|
|
@@ -241,6 +241,9 @@ export function fieldOptionLabelKeyPrefix(featureName, entityName, fieldName) {
|
|
|
241
241
|
export function fieldOptionLabelKey(featureName, entityName, fieldName, value) {
|
|
242
242
|
return `${fieldOptionLabelKeyPrefix(featureName, entityName, fieldName)}${value}`;
|
|
243
243
|
}
|
|
244
|
+
export function fieldOptionHelpKey(featureName, entityName, fieldName, value) {
|
|
245
|
+
return `${fieldOptionLabelKey(featureName, entityName, fieldName, value)}:help`;
|
|
246
|
+
}
|
|
244
247
|
// Embedded-list cell label key — one level deeper than fieldLabelKey,
|
|
245
248
|
// keyed by the sub-field name inside an embedded-LIST field's `schema`
|
|
246
249
|
// (invoice-positions-style tables built via createEmbeddedListField()).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EditFieldSpec, EditSectionSpec, EmbeddedDerivedCellDef, FieldAffix, FieldAiAssist, FieldBadge, FieldCondition, FieldFillAction, FieldIconKey, FieldRenderer, FieldValueChips, IconKey, ListBulkAction, ListColumnSpec, ListFacetSpec, ListSortSpec, ListTableOptions, OptionsQueryPayload, PlatformComponent, RelatedListEmptyStateVariant, RelatedListRowTone, RelatedListToolbarAction, RowAction, RowActionMode, ScreenSlots, SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
1
|
+
import type { EditFieldSpec, EditSectionSpec, EmbeddedDerivedCellDef, FieldAffix, FieldAiAssist, FieldBadge, FieldCondition, FieldFillAction, FieldIconKey, FieldRenderer, FieldValueChips, IconKey, ListBulkAction, ListColumnSpec, ListFacetSpec, ListSortSpec, ListTableOptions, OptionsQueryPayload, PageHelpSpec, PlatformComponent, RelatedListEmptyStateVariant, RelatedListRowTone, RelatedListToolbarAction, RowAction, RowActionMode, ScreenSlots, SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
2
|
export type RuntimeRenderer = (value: unknown, row?: Readonly<Record<string, unknown>>) => string;
|
|
3
3
|
/** Where a cell's text links to. `href` comes from NavApi.hrefFor (new-tab and
|
|
4
4
|
* copy-link work); `onPress` is the in-app navigation for a plain click. */
|
|
@@ -311,6 +311,10 @@ export type EditFieldViewModel = {
|
|
|
311
311
|
readonly fillAction?: FieldFillAction;
|
|
312
312
|
/** From EditFieldSpec.aiAssist, chip labels and the prompt placeholder already translated. */
|
|
313
313
|
readonly aiAssist?: FieldAiAssist;
|
|
314
|
+
/** From EditFieldSpec.editor. */
|
|
315
|
+
readonly editor?: "document";
|
|
316
|
+
/** aiAssist.contextFields that name a document-editor field of the same form (their HTML is sent as text). */
|
|
317
|
+
readonly contextDocumentFields?: readonly string[];
|
|
314
318
|
/** From EditFieldSpec.valueChips. */
|
|
315
319
|
readonly valueChips?: FieldValueChips;
|
|
316
320
|
/** From EditFieldSpec.concealed. */
|
|
@@ -404,6 +408,8 @@ export type EditFieldsSectionViewModel = {
|
|
|
404
408
|
/** True when the author declared `columns` (section or group); only then may a read-only
|
|
405
409
|
* section draw a label/value grid. */
|
|
406
410
|
readonly columnsDeclared?: true;
|
|
411
|
+
/** From `EditFieldsSection.flow`; only `false` is carried. */
|
|
412
|
+
readonly flow?: false;
|
|
407
413
|
readonly fields: readonly EditFieldViewModel[];
|
|
408
414
|
/** From `EditFieldsSection.groups` — each entry's `fields` are the same
|
|
409
415
|
* view-model objects as `fields` above, re-grouped (not recomputed). */
|
|
@@ -458,6 +464,7 @@ export type EditRelatedListSectionViewModel = {
|
|
|
458
464
|
readonly kind: "relatedList";
|
|
459
465
|
readonly id?: string;
|
|
460
466
|
readonly title: string;
|
|
467
|
+
readonly pageHelp?: PageHelpSpec;
|
|
461
468
|
readonly query: string;
|
|
462
469
|
readonly parentParam?: string;
|
|
463
470
|
readonly parentFilter?: {
|
package/dist/i18n-defaults.js
CHANGED
|
@@ -349,6 +349,9 @@ export const kumikoDefaultTranslations = {
|
|
|
349
349
|
"kumiko.dialog.confirm": "Confirm",
|
|
350
350
|
"kumiko.dialog.cancel": "Cancel",
|
|
351
351
|
"kumiko.dialog.close": "Close",
|
|
352
|
+
"kumiko.pageHelp.button": "Help for this page",
|
|
353
|
+
"kumiko.pageHelp.buttonLabel": "Explanations",
|
|
354
|
+
"kumiko.pageHelp.statusIntro": "What the statuses mean",
|
|
352
355
|
"kumiko.lightbox.previous": "Previous image",
|
|
353
356
|
"kumiko.lightbox.next": "Next image",
|
|
354
357
|
"kumiko.lightbox.position": "{current} / {total}",
|
package/dist/primitives.d.ts
CHANGED
|
@@ -68,6 +68,8 @@ type ButtonBaseProps = {
|
|
|
68
68
|
readonly ariaLabel?: string;
|
|
69
69
|
/** Tooltip — rendered as the `title` attribute. */
|
|
70
70
|
readonly title?: string;
|
|
71
|
+
/** Below the `sm` breakpoint only the icon shows (in a square), the label stays the accessible name. */
|
|
72
|
+
readonly collapseLabel?: boolean;
|
|
71
73
|
/** Toggle state for toggle buttons — web sets `aria-pressed`; leave unset for plain buttons. */
|
|
72
74
|
readonly pressed?: boolean;
|
|
73
75
|
/** Disclosure state for buttons that open a menu or panel — web sets `aria-expanded`. */
|
|
@@ -1029,6 +1031,12 @@ export type GridProps = {
|
|
|
1029
1031
|
readonly tight?: boolean;
|
|
1030
1032
|
/** Read-only label/value facts: a true `columns`-wide grid with a tight gap, at most 2 columns below `sm`. Wins over `flow`. */
|
|
1031
1033
|
readonly facts?: boolean;
|
|
1034
|
+
/** Legend rows as flat child pairs (term, explanation): the first column is as wide as its widest
|
|
1035
|
+
* term and never wraps, the second takes the rest, with a fixed gap between them. Wins over `columns`/`flow`. */
|
|
1036
|
+
readonly legend?: boolean;
|
|
1037
|
+
/** With `legend`: the term column is a fixed 13rem (12rem plus gap) in every grid (sentences start at one x across
|
|
1038
|
+
* cards) and the rows are separated by hairlines. */
|
|
1039
|
+
readonly ruled?: boolean;
|
|
1032
1040
|
};
|
|
1033
1041
|
/** Width class of a field cell inside a `flow` grid: sized by what the field holds. */
|
|
1034
1042
|
export type FieldCellWidth = "text" | "number" | "money" | "date" | "timestamp" | "select" | "full" | "toggle";
|
|
@@ -1088,6 +1096,8 @@ export type DialogProps = {
|
|
|
1088
1096
|
readonly confirmLabel?: string;
|
|
1089
1097
|
/** Cancel-Button-Label. Default `kumiko.dialog.cancel`. */
|
|
1090
1098
|
readonly cancelLabel?: string;
|
|
1099
|
+
/** Leaves out the cancel button, for an information dialog whose only button closes it. */
|
|
1100
|
+
readonly hideCancel?: boolean;
|
|
1091
1101
|
/** `default` = Confirm primary, `danger` = Confirm danger. */
|
|
1092
1102
|
readonly variant?: "default" | "danger";
|
|
1093
1103
|
/** Which button takes focus on open. Default: Confirm for a bare dialog
|
|
@@ -1116,6 +1126,8 @@ export type ModalProps = {
|
|
|
1116
1126
|
readonly title: string;
|
|
1117
1127
|
readonly children: ReactNode;
|
|
1118
1128
|
readonly testId?: string;
|
|
1129
|
+
/** "wide" suits content with lists beside actions; web caps it at the viewport. */
|
|
1130
|
+
readonly size?: "default" | "wide";
|
|
1119
1131
|
};
|
|
1120
1132
|
/** Side panel for hosting an existing self-contained form/widget (own
|
|
1121
1133
|
* submit/cancel buttons) without leaving the underlying screen — e.g. a
|
|
@@ -1311,7 +1323,7 @@ export type TabsProps = {
|
|
|
1311
1323
|
readonly appearance?: "pill" | "plain" | "filter";
|
|
1312
1324
|
readonly testId?: string;
|
|
1313
1325
|
};
|
|
1314
|
-
export { type StatusBadgeOptionTone, type StatusTone, statusToneForOptionTone, statusToneForValue, } from "./status-tone.ts";
|
|
1326
|
+
export { type StatusBadgeOptionTone, type StatusTone, statusToneForOption, statusToneForOptionTone, statusToneForValue, } from "./status-tone.ts";
|
|
1315
1327
|
/** Status pill. `value` is the raw column value — tone-mapping is the app's job. */
|
|
1316
1328
|
export type StatusBadgeProps = {
|
|
1317
1329
|
readonly value: string;
|
|
@@ -1347,6 +1359,8 @@ export type PageHeaderProps = {
|
|
|
1347
1359
|
/** Short record title for the phone top bar; wins over `recordTitle` there. */
|
|
1348
1360
|
readonly narrowRecordTitle?: string;
|
|
1349
1361
|
readonly status?: ReactNode;
|
|
1362
|
+
/** Page help trigger, shown at the end of the shell header actions. */
|
|
1363
|
+
readonly help?: ReactNode;
|
|
1350
1364
|
readonly actions?: ReactNode;
|
|
1351
1365
|
/** Screen renders its own h1: the shell header shows only the parent crumb, as text. */
|
|
1352
1366
|
readonly bodyTitle?: boolean;
|
|
@@ -1373,6 +1387,8 @@ export type ActionOverflowMenuProps = {
|
|
|
1373
1387
|
readonly items: readonly ActionMenuItemSpec[];
|
|
1374
1388
|
/** aria-label for the three-dots trigger. */
|
|
1375
1389
|
readonly label: string;
|
|
1390
|
+
/** Renders a labelled button (plus icon, text, chevron) instead of the three-dots icon. */
|
|
1391
|
+
readonly triggerLabel?: string;
|
|
1376
1392
|
readonly testId?: string;
|
|
1377
1393
|
};
|
|
1378
1394
|
import type { CopyButtonProps, PromoPanelProps, SecretRevealProps, ShareButtonProps, StickyActionBarProps } from "./primitives-share-types.ts";
|
package/dist/primitives.js
CHANGED
|
@@ -18,7 +18,7 @@ export const NARROW_LABEL_PROP = "kumikoNarrowLabel";
|
|
|
18
18
|
export function shouldRenderActionsIconOnly(actions) {
|
|
19
19
|
return actions.length > 2 && actions.every((a) => a.icon !== undefined);
|
|
20
20
|
}
|
|
21
|
-
export { statusToneForOptionTone, statusToneForValue, } from "./status-tone.js";
|
|
21
|
+
export { statusToneForOption, statusToneForOptionTone, statusToneForValue, } from "./status-tone.js";
|
|
22
22
|
// ---- Context + Provider + Hook ----
|
|
23
23
|
const PrimitivesContext = createContext(undefined);
|
|
24
24
|
export function PrimitivesProvider({ children, value }) {
|
package/dist/status-tone.d.ts
CHANGED
|
@@ -5,3 +5,7 @@ export type StatusBadgeOptionTone = StatusTone | "accent";
|
|
|
5
5
|
export declare function statusToneForOptionTone(tone: SelectOptionTone): StatusBadgeOptionTone | undefined;
|
|
6
6
|
export declare function statusToneForValue(value: string): StatusTone | undefined;
|
|
7
7
|
export declare function isSelectOptionTone(value: unknown): value is SelectOptionTone;
|
|
8
|
+
/** Tone of one select value: the declared option tone, else the value heuristic. */
|
|
9
|
+
export declare function statusToneForOption(value: string, optionTones: {
|
|
10
|
+
readonly [value: string]: SelectOptionTone | undefined;
|
|
11
|
+
} | undefined): StatusBadgeOptionTone | undefined;
|
package/dist/status-tone.js
CHANGED
|
@@ -54,3 +54,9 @@ export function statusToneForValue(value) {
|
|
|
54
54
|
export function isSelectOptionTone(value) {
|
|
55
55
|
return isOneOf(SELECT_OPTION_TONES, value);
|
|
56
56
|
}
|
|
57
|
+
/** Tone of one select value: the declared option tone, else the value heuristic. */
|
|
58
|
+
export function statusToneForOption(value, optionTones) {
|
|
59
|
+
const declared = optionTones !== undefined && Object.hasOwn(optionTones, value) ? optionTones[value] : undefined;
|
|
60
|
+
const declaredTone = declared !== undefined ? statusToneForOptionTone(declared) : undefined;
|
|
61
|
+
return declaredTone ?? statusToneForValue(value);
|
|
62
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
3
|
export function RailSection({ title, action, testId, children, }) {
|
|
4
|
-
return (_jsxs("section", { className: "flex flex-col border-b pb-1", "data-testid": testId, children: [_jsxs("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1 px-3.5 pt-2.5 pb-1", children: [_jsx("span", { className: "min-w-0 text-xs font-medium uppercase tracking-wider text-muted-foreground", children: title }), action !== undefined && _jsx("div", { className: "ml-auto", children: action })] }), children] }));
|
|
4
|
+
return (_jsxs("section", { className: "flex flex-col border-b pb-1", "data-testid": testId, children: [_jsxs("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1 px-3.5 pt-2.5 pb-1", children: [_jsx("span", { className: "min-w-0 text-xs font-medium uppercase tracking-wider text-muted-foreground", children: title }), action !== undefined && _jsx("div", { className: "ml-auto whitespace-nowrap", children: action })] }), children] }));
|
|
5
5
|
}
|
|
6
6
|
export function RailField({ children }) {
|
|
7
7
|
return _jsx("div", { className: "flex flex-col gap-3 px-3.5 py-2", children: children });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// A compact outlined pill for a second toolbar row; a select button inside stays flat and fills the pill.
|
|
3
|
+
export function EditorToolbarPill({ children }) {
|
|
4
|
+
return (_jsx("span", { className: "inline-flex h-7 shrink-0 items-center rounded-md border border-input bg-background [&_button]:h-full [&_button]:min-h-0 [&_button[aria-haspopup=listbox]]:h-full [&_button[aria-haspopup=listbox]]:min-h-0 [&_button[aria-haspopup=listbox]]:w-auto [&_button[aria-haspopup=listbox]]:px-2 [&_button[aria-haspopup=listbox]]:py-0 [&_button[aria-haspopup=listbox]]:text-xs", children: children }));
|
|
5
|
+
}
|
|
@@ -2,5 +2,6 @@ export { type EditorActionTestIds, EditorFooter, type FooterTone } from "./edito
|
|
|
2
2
|
export { EditorBody, EditorFrame, EditorInfoBar, type InfoBarTone } from "./editor-frame.tsx";
|
|
3
3
|
export { EditorHeader, type EditorHeaderTestIds, EditorLocaleSwitch, type EditorMode, EditorModeSwitch, type EditorSaveActions, } from "./editor-header.tsx";
|
|
4
4
|
export { RailField, RailHint, RailRow, RailSection } from "./editor-rail.tsx";
|
|
5
|
+
export { EditorToolbarPill } from "./editor-toolbar-pill.tsx";
|
|
5
6
|
export { EditorWorkbench, type EditorWorkbenchProps, type WorkbenchSave, } from "./editor-workbench.tsx";
|
|
6
7
|
export { formatRelativeWhen } from "./relative-when.ts";
|
package/dist/web/editor/index.js
CHANGED
|
@@ -2,5 +2,6 @@ export { EditorFooter } from "./editor-footer.js";
|
|
|
2
2
|
export { EditorBody, EditorFrame, EditorInfoBar } from "./editor-frame.js";
|
|
3
3
|
export { EditorHeader, EditorLocaleSwitch, EditorModeSwitch, } from "./editor-header.js";
|
|
4
4
|
export { RailField, RailHint, RailRow, RailSection } from "./editor-rail.js";
|
|
5
|
+
export { EditorToolbarPill } from "./editor-toolbar-pill.js";
|
|
5
6
|
export { EditorWorkbench, } from "./editor-workbench.js";
|
|
6
7
|
export { formatRelativeWhen } from "./relative-when.js";
|
package/dist/web/icons.d.ts
CHANGED
|
@@ -82,6 +82,7 @@ export declare const NAV_ICONS: {
|
|
|
82
82
|
readonly "alert-triangle": import("lucide-react").LucideIcon;
|
|
83
83
|
readonly info: import("lucide-react").LucideIcon;
|
|
84
84
|
readonly "check-circle": import("lucide-react").LucideIcon;
|
|
85
|
+
readonly "help-circle": import("lucide-react").LucideIcon;
|
|
85
86
|
readonly "x-circle": import("lucide-react").LucideIcon;
|
|
86
87
|
readonly loader: import("lucide-react").LucideIcon;
|
|
87
88
|
readonly mic: import("lucide-react").LucideIcon;
|