@entifix/react-controls 0.23.10 → 0.23.11
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/i18n/catalog/en.d.ts.map +1 -1
- package/dist/i18n/catalog/en.js +3 -0
- package/dist/i18n/catalog/en.js.map +1 -1
- package/dist/i18n/catalog/es.d.ts +3 -0
- package/dist/i18n/catalog/es.d.ts.map +1 -1
- package/dist/i18n/catalog/es.js +3 -0
- package/dist/i18n/catalog/es.js.map +1 -1
- package/dist/i18n/catalog/index.d.ts +6 -0
- package/dist/i18n/catalog/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/ui/atoms/cell-value/cell-value.d.ts +12 -0
- package/dist/ui/atoms/cell-value/cell-value.d.ts.map +1 -1
- package/dist/ui/atoms/cell-value/cell-value.js +20 -2
- package/dist/ui/atoms/cell-value/cell-value.js.map +1 -1
- package/dist/ui/molecules/entity-link-input/entity-link-input.d.ts +9 -3
- package/dist/ui/molecules/entity-link-input/entity-link-input.d.ts.map +1 -1
- package/dist/ui/molecules/entity-link-input/entity-link-input.js +9 -5
- package/dist/ui/molecules/entity-link-input/entity-link-input.js.map +1 -1
- package/dist/ui/molecules/entity-link-multi-input/entity-link-multi-input.d.ts +32 -0
- package/dist/ui/molecules/entity-link-multi-input/entity-link-multi-input.d.ts.map +1 -0
- package/dist/ui/molecules/entity-link-multi-input/entity-link-multi-input.js +94 -0
- package/dist/ui/molecules/entity-link-multi-input/entity-link-multi-input.js.map +1 -0
- package/dist/ui/molecules/entity-link-multi-input/index.d.ts +2 -0
- package/dist/ui/molecules/entity-link-multi-input/index.d.ts.map +1 -0
- package/dist/ui/molecules/entity-link-multi-input/index.js +3 -0
- package/dist/ui/molecules/entity-link-multi-input/index.js.map +1 -0
- package/dist/ui/organisms/entity-form/entity-form.d.ts.map +1 -1
- package/dist/ui/organisms/entity-form/entity-form.js +19 -2
- package/dist/ui/organisms/entity-form/entity-form.js.map +1 -1
- package/dist/ui/utils/reference-labels.d.ts +7 -0
- package/dist/ui/utils/reference-labels.d.ts.map +1 -1
- package/dist/ui/utils/reference-labels.js +21 -2
- package/dist/ui/utils/reference-labels.js.map +1 -1
- package/package.json +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/ui/organisms/entity-form/entity-form.tsx"],"sourcesContent":["'use client';\n\nimport {\n cloneEntityDraft,\n describeEntityColumns,\n type Entity,\n type EntityAction,\n type EntityDraft,\n type EntityDraftValue,\n type EntityLinkSource,\n extractMetaEntity,\n type MetaAccessorType,\n readDraftString,\n readLocalizedDraft,\n readRowDrafts,\n type UseCaseDescriptor,\n} from '@entifix/core';\nimport { type ReactNode, useEffect, useId, useRef, useState } from 'react';\n\nimport {\n useEntityNoun,\n useLocalizedDescriptors,\n useT,\n useTranslateKey,\n} from '../../../i18n/index.js';\nimport {\n availableUseCases,\n renderAnchor,\n useCasesForSurface,\n} from '../../actions/index.js';\nimport { useVerbInvoker } from '../../actions/use-verb-invoker.js';\nimport { Alert } from '../../atoms/alert/index.js';\nimport { Button, button } from '../../atoms/button/index.js';\nimport { CellValue, useRecordLabel } from '../../atoms/cell-value/index.js';\nimport { FieldControl } from '../../atoms/field-control/index.js';\nimport { LocalizedFieldControl } from '../../atoms/localized-field-control/index.js';\nimport { Skeleton } from '../../atoms/skeleton/index.js';\nimport { Text } from '../../atoms/text/index.js';\nimport {\n ActionBar,\n type ActionBarItem,\n itemsForUseCases,\n} from '../../molecules/action-bar/index.js';\nimport { Card } from '../../molecules/card/index.js';\nimport { EntityLinkInput } from '../../molecules/entity-link-input/index.js';\nimport { LoadingBoundary } from '../../molecules/loading-boundary/index.js';\nimport { RegionState } from '../../molecules/region-state/index.js';\nimport { Stack } from '../../molecules/stack/index.js';\nimport { cn } from '../../utils/cn.js';\nimport { useLiveUpdates } from '../../utils/live-updates.js';\nimport {\n useFocusOnArrival,\n useFocusOnLoss,\n} from '../../utils/use-focus-on-arrival.js';\nimport { EntityDetailGrid } from '../entity-detail-grid/index.js';\nimport type {\n EntityFormField,\n EntityFormMode,\n EntityFormProps,\n} from './entity-form.types.js';\nimport { readEntityFormFields } from './entity-form-slots.js';\nimport { resolveEntityFormFields } from './use-entity-form-fields.js';\n\n/**\n * The member types a `linkSources` entry can actually produce an editor for.\n *\n * `link` is the obvious one. `string` is here because a foreign key does not\n * have to be a typed relation: when the target lives in **another slice's\n * store**, an `EntityLink` would be an illegal edge and a storage-layer join\n * across a store boundary, so the member is a plain id and the relation exists\n * only in the operator's head — a cross-store reference is an id, never a\n * link. Nothing about the editor cares which of the two it is —\n * `EntityLinkInput` writes `String(target.id)` into the draft either way, and\n * the *only* place `link`-ness still matters is `applyEntityLinks` at submit,\n * which skips a non-`link` descriptor and so leaves the id as the truth.\n *\n * Everything else is excluded on purpose rather than by omission: a `boolean`,\n * `enum`, `number` or `date` member cannot name another record, so a source\n * pointed at one is a wiring mistake — see {@link assertLinkSourcesAreEditable}.\n */\nconst PICKABLE_TYPES: ReadonlySet<MetaAccessorType> = new Set<MetaAccessorType>(\n ['link', 'string'],\n);\n\n/**\n * A form that builds itself from an entity's metadata: fields, labels and value\n * formatting all come from `@accessor()` declarations, so editing a new entity\n * needs no bespoke form. The read/edit toggle is the whole point — the same\n * component shows a record as text or as inputs.\n *\n * Two things layer on top of that default:\n * - **modes** — `read` renders each member through `CellValue`; `edit` renders\n * the matching `FieldControl`. A member in {@link PICKABLE_TYPES} with an\n * entry in `linkSources` gets the full picker instead — a to-one `link`, or a\n * `string` holding a foreign key into another slice's store. Without a source,\n * a relation stays read-only, and a `linkCollection` always does, the to-many\n * editor being a follow-up. A source aimed at a member that can render no\n * picker is a wiring mistake rather than a no-op, and throws.\n * - **slots** — `<EntityField>` children override one field's label, control or\n * read display, or add a computed field.\n *\n * It is presentational: the draft, its errors and the save/delete actions are\n * all props, so the same form hosts on a plain route and inside a workspace tab.\n */\n/** The key the built-in Delete runs under, which no declared verb can take. */\nconst DELETE_KEY = '$delete';\n\n/** Save, from anywhere in the form — the caret in a field included. */\nconst SAVE_SHORTCUT = 'Mod+S';\n/** The footer's declared primary, when it is not Save. */\nconst PRIMARY_SHORTCUT = 'Mod+Enter';\n\nexport function EntityForm<TEntity extends Entity>({\n entityConstructor,\n entity,\n values,\n onFieldChange,\n linkSources,\n onLinkChange,\n mode: modeProp,\n defaultMode,\n onModeChange,\n errors,\n formError,\n onSubmit,\n onDelete,\n deletePolicy = 'confirm',\n embedded = false,\n isLoading = false,\n skeleton = true,\n isSaving = false,\n isPending = false,\n isDeleting = false,\n error,\n onRetry,\n onKeepMine,\n onLoadCurrent,\n backHref,\n renderLink = renderAnchor,\n title,\n metadata,\n isMetadataLoading = false,\n onUseCase,\n verbForms,\n onClone,\n children,\n}: EntityFormProps<TEntity>) {\n const formId = useId();\n const slots = readEntityFormFields<TEntity>(children);\n // The *field* descriptors, which stay local and synchronous — a column is a\n // property of the class every caller holds. Only an action's availability is\n // a property of the caller, which is why that half arrives as `metadata`.\n // A member that presents as nothing (a `revision`) stays in the draft and is\n // never drawn.\n const columnDescriptors = describeEntityColumns(\n entityConstructor,\n entity,\n ).filter(descriptor => descriptor.presentation !== 'none') as Array<\n EntityFormField<TEntity>\n >;\n // Before slots resolve, so an `<EntityField label>` override still wins.\n const described = useLocalizedDescriptors(columnDescriptors);\n const resolved = resolveEntityFormFields(described, slots.fields);\n assertLinkSourcesAreEditable(resolved, linkSources);\n\n // **Form above, table below**, and it is a partition rather than an ordering\n // hint. A grid rendered between two labelled inputs reads as a field, which\n // it is not — it is a second record list — so every owned collection is\n // pulled out of the field stack whatever `order` it declared, and rendered\n // full width beneath it. A composition that named no child has nothing to\n // render and stays where it was, showing its row count as before.\n const fields = resolved.filter(field => !isOwnedCollection(field));\n const ownedCollections = resolved.filter(isOwnedCollection);\n\n /**\n * `true`/omitted → the built-in default, which draws one label+control pair\n * per resolved field; a node → that node; `false` → nothing. The field list\n * comes from the constructor's metadata, not from the record, so it is already\n * complete while the record is still in flight — which is what lets the\n * placeholder match the form it is standing in for.\n */\n const customSkeleton = typeof skeleton === 'boolean' ? undefined : skeleton;\n const showSkeleton = isLoading && skeleton !== false;\n\n const [internalMode, setInternalMode] = useState<EntityFormMode>(\n defaultMode ?? (entity ? 'read' : 'edit'),\n );\n const mode = modeProp ?? internalMode;\n const editing = mode === 'edit';\n\n const draft: EntityDraft = values ?? {};\n const setField = (name: string, value: EntityDraftValue) =>\n onFieldChange?.(name, value);\n\n const toggleMode = () => {\n const next: EntityFormMode = editing ? 'read' : 'edit';\n setInternalMode(next);\n onModeChange?.(next);\n };\n\n const t = useT();\n const translateKey = useTranslateKey();\n const entityNoun = useEntityNoun();\n const live = useLiveUpdates();\n // A form reached by a write — saved, handed off by a wizard — takes focus on\n // its heading, so it never rests on `<body>` (ADR 0028).\n const heading = useRef<HTMLHeadingElement>(null);\n useFocusOnArrival(heading);\n const busy = isSaving || isPending || isDeleting;\n\n // A draft restored from storage holds relation ids and no instances, so every\n // picker is resolving its target for a moment after mount. Saving inside that\n // window is exactly the case `applyEntityLinks` refuses: an `embedded` member\n // with an id and nothing to inline. Gating the save is the honest answer —\n // the form is still assembling itself, and the wait is one lookup long.\n //\n // Deliberately not narrowed to `embedded` members: a descriptor's\n // serialization is not what makes an in-flight lookup a bad moment to submit,\n // and a form that saves half-resolved is confusing whichever shape it writes.\n const resolvingLinks = Object.values(linkSources ?? {}).some(\n source => source.selected.isLoading,\n );\n\n // Absent metadata keeps the pre-ADR-0026 behaviour, so an un-migrated call\n // site renders exactly as before. Present metadata is authoritative: it is\n // what the service already decided this caller may do.\n const may = (action: EntityAction) =>\n metadata === undefined || metadata.actions.includes(action);\n\n // A single-record form shows the verbs that act on *this* record. Which cell\n // lands where is `action-surfaces`' business and nobody else's — a\n // `context-dependent` entity verb belongs to a row's overflow menu and a\n // `collection`-bound one to the bulk bar, and resolving that here as well is\n // how the two surfaces drifted apart in the first place.\n //\n // ⚠️ **Only when there is somewhere for them to go.** Every cell these two\n // surfaces render is `binding: 'entity'`, so without an `onUseCase` the\n // button has no handler and clicking it does nothing at all. That is not a\n // hypothetical: `makeEntityCrud` withholds the handler on a create, because\n // there is no record for a verb to act on — and Publish and Unpublish\n // rendered on a new `ProductOffering` and were inert, which reads as a broken\n // feature rather than an inapplicable one.\n //\n // The hooks are called unconditionally and their *results* are gated: React's\n // hook count must stay fixed across renders.\n const declaredHeaderUseCases = useCasesForSurface(\n 'form-header',\n metadata?.useCases,\n verbForms,\n );\n const declaredFooterUseCases = useCasesForSurface(\n 'form-footer',\n metadata?.useCases,\n verbForms,\n );\n // And only the verbs the record's state allows: a shipment awaiting dispatch\n // offers Dispatch, not every move a shipment can ever make.\n const headerUseCases = onUseCase\n ? availableUseCases(declaredHeaderUseCases, entity)\n : [];\n const footerUseCases = onUseCase\n ? availableUseCases(declaredFooterUseCases, entity)\n : [];\n // A verb that moved its record out of the states it applies to unmounts the\n // button the reader just pressed; focus goes to the heading, not `<body>`.\n useFocusOnLoss(\n () => heading.current,\n [...headerUseCases, ...footerUseCases].map(({ key }) => key).join(' '),\n );\n\n // Every verb on the form, and its own Delete, goes through one invoker: a\n // destructive verb asks, asks for the name, or runs and offers Undo, as it\n // declared — `revoke-sessions` ends every session a user holds.\n const verbs = useVerbInvoker<undefined>({\n run: key => (key === DELETE_KEY ? onDelete?.() : onUseCase?.(key)),\n busy,\n served: metadata?.useCases,\n });\n // What a confirmation names — the object in \"Delete {record}?\" and the text\n // the typed policy asks for — through the one derivation every surface\n // shares: the entity's `labelMember`, resolved if it is a reference.\n const metaEntity = extractMetaEntity(entityConstructor);\n const nameOf = useRecordLabel();\n const recordLabel = nameOf(entityConstructor, draft);\n const invoke = (descriptor: UseCaseDescriptor) =>\n verbs.invoke({\n descriptor,\n target: undefined,\n object: recordLabel,\n count: 1,\n });\n const requestDelete = () => {\n // Undo is the host's to offer: only it can put a deleted record back.\n if (deletePolicy === 'undo') {\n onDelete?.();\n return;\n }\n invoke({\n key: DELETE_KEY,\n binding: 'entity',\n placement: 'determining',\n labelKey: 'controls:form.delete',\n confirm: {\n tone: 'destructive',\n messageKey: 'controls:confirm.deleteMessage',\n },\n reversible: deletePolicy,\n });\n };\n\n const headerItems = itemsForUseCases(\n headerUseCases,\n translateKey,\n invoke,\n busy,\n );\n const footerItems = itemsForUseCases(\n footerUseCases,\n translateKey,\n invoke,\n busy,\n );\n /**\n * A save attempt. Counted, so a refused one moves focus to the error summary\n * once — not again on every keystroke that leaves an error standing.\n */\n const [attempt, setAttempt] = useState(0);\n const save = () => {\n setAttempt(current => current + 1);\n onSubmit?.(draft);\n };\n // A save refused because the record moved on. It is told apart by its code,\n // the one thing a failure decoded in a browser is sure to carry, and it is\n // not a retry: the fields keep what was typed and the person chooses.\n const conflicted = error?.code === 'staleRevision';\n const conflict = useRef<HTMLDivElement>(null);\n useEffect(() => {\n // Focus moves to the explanation, so a keyboard or screen-reader user is\n // not left on a Save that silently did nothing.\n if (conflicted) conflict.current?.focus();\n }, [conflicted, error]);\n const summary = useRef<HTMLDivElement>(null);\n const summaryId = useId();\n const invalid = editing\n ? fields.filter(field => errors?.[field.name] !== undefined)\n : [];\n const focusedAttempt = useRef(0);\n useEffect(() => {\n if (attempt === focusedAttempt.current || invalid.length === 0) return;\n focusedAttempt.current = attempt;\n summary.current?.focus();\n }, [attempt, invalid.length]);\n\n // Save is the footer's primary unless the entity declared one of its own — a\n // determining \"Publish\" is what that page is for, and Save steps aside.\n const declaresFooterPrimary = footerItems.some(\n item => item.emphasis === 'primary',\n );\n const footerActions: ActionBarItem[] = [\n ...(may('write')\n ? [\n {\n key: 'save',\n // A pending write waits on the push stream; while that is down\n // it says so, rather than waiting without a word.\n label: isPending\n ? t(live.connection === 'open' ? 'form.pending' : 'live.waiting')\n : isSaving\n ? t('form.saving')\n : t('form.save'),\n emphasis: declaresFooterPrimary\n ? ('default' as const)\n : ('primary' as const),\n disabled: busy || resolvingLinks,\n submit: true,\n shortcut: SAVE_SHORTCUT,\n onSelect: save,\n },\n ]\n : []),\n // The page's main act answers Mod+Enter, unless it declared its own.\n ...footerItems.map(item =>\n item.emphasis === 'primary' && item.shortcut === undefined\n ? { ...item, shortcut: PRIMARY_SHORTCUT }\n : item,\n ),\n // Clone is the CRUD triple's, not a declared verb's: every entity can be\n // copied, so giving it a `@useCase()` would mean declaring the same verb on\n // all 28 of them. It needs `write`, because what it produces is a create.\n ...(onClone && entity && may('write')\n ? [\n {\n key: 'clone',\n label: t('form.clone'),\n disabled: busy,\n onSelect: () => onClone(cloneEntityDraft(entityConstructor, draft)),\n },\n ]\n : []),\n ...(onDelete && may('delete')\n ? [\n {\n key: 'delete',\n label: isDeleting ? t('form.deleting') : t('form.delete'),\n destructive: true,\n disabled: busy,\n onSelect: requestDelete,\n },\n ]\n : []),\n ];\n\n // A real form while editing, so Enter in a field saves; an embedded one\n // belongs to its host's flow, and a caller who may not write has no Save.\n const asForm = editing && !embedded && may('write');\n const rows = fields.map(field => (\n <FieldRow\n key={field.name}\n field={field}\n entity={entity}\n draft={draft}\n value={readDraftString(draft, field.name)}\n editing={editing}\n error={editing ? errors?.[field.name] : undefined}\n setField={setField}\n linkSource={linkSources?.[field.name]}\n onLinkChange={onLinkChange}\n id={`${formId}-${field.name}`}\n />\n ));\n\n const body = (\n <Stack gap=\"s\">\n {/* An embedded form brings only its fields: the heading and the action\n row belong to whatever is hosting it — a wizard step sits under the\n wizard's own heading and advances with the wizard's own footer, so\n rendering a second of each is two controls for one job. */}\n {!embedded && (\n <Stack direction=\"row\" gap=\"xs\" align=\"center\">\n <Text\n as=\"h2\"\n ref={heading}\n tabIndex={-1}\n step={1}\n weight=\"semibold\"\n className=\"focus-ring\"\n >\n {/* `entity` is undefined while the record is still in flight, so\n testing it alone made a loading edit form announce itself as\n \"New\" for as long as the fetch took, then relabel when the\n record landed. A form that is loading is never a create. */}\n {title ?? (entity || isLoading ? t('form.details') : t('form.new'))}\n </Text>\n {/* The built-in toggle only appears when the form owns its mode and\n there is a record to view — a create form has nothing to read. */}\n {modeProp === undefined && entity && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={toggleMode}\n >\n {editing ? t('form.view') : t('form.edit')}\n </Button>\n )}\n <LoadingBoundary isLoading={isMetadataLoading} lines={0}>\n <>\n {headerItems.length > 0 && (\n <ActionBar surface=\"form-header\" items={headerItems} />\n )}\n {slots.headerActions}\n </>\n </LoadingBoundary>\n </Stack>\n )}\n\n {/* One announcement for the form; the shimmer below is aria-hidden. */}\n <span role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {isLoading ? t('form.loading') : ''}\n </span>\n\n {conflicted && (\n <div\n ref={conflict}\n tabIndex={-1}\n data-testid=\"entity-form-conflict\"\n className=\"rounded-lg focus-ring\"\n >\n <Alert\n tone=\"danger\"\n title={t('form.conflictTitle')}\n action={\n onKeepMine === undefined &&\n onLoadCurrent === undefined ? undefined : (\n <span className=\"flex flex-wrap gap-3xs\">\n {onKeepMine !== undefined && (\n <Button\n type=\"button\"\n variant=\"primary\"\n size=\"sm\"\n onClick={onKeepMine}\n >\n {t('form.conflictKeep')}\n </Button>\n )}\n {onLoadCurrent !== undefined && (\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n onClick={onLoadCurrent}\n >\n {t('form.conflictLoad')}\n </Button>\n )}\n </span>\n )\n }\n >\n {t('form.conflictBody')}\n {onKeepMine !== undefined && ` ${t('form.conflictKeepHint')}`}\n </Alert>\n </div>\n )}\n\n <RegionState\n plural={entityNoun(metaEntity, 'plural')}\n error={conflicted ? undefined : error}\n onRetry={onRetry}\n // Only a load that can be retried leaves an out-of-date record; a\n // failed save leaves what the reader typed, which is current.\n hasStaleData={entity !== undefined && onRetry !== undefined}\n />\n\n {/* A refused save, as one summary of links to what needs fixing: the\n only alert in the form, and where focus goes after the attempt. */}\n {invalid.length > 0 && (\n <div\n ref={summary}\n tabIndex={-1}\n role=\"alert\"\n aria-labelledby={summaryId}\n data-testid=\"entity-form-error-summary\"\n className=\"rounded-lg border-l-4 border-danger bg-danger-subtle px-s py-xs text-step-sm text-content focus-ring\"\n >\n <p id={summaryId} className=\"m-0 font-semibold\">\n {t('form.errorSummary', { count: invalid.length })}\n </p>\n <ul className=\"m-0 ps-s\">\n {invalid.map(field => (\n <li key={field.name}>\n <a\n href={`#${formId}-${field.name}`}\n // The content colour: primary on the danger surface misses\n // 4.5:1.\n className=\"font-medium text-content underline underline-offset-2 focus-ring\"\n onClick={event => {\n event.preventDefault();\n document.getElementById(`${formId}-${field.name}`)?.focus();\n }}\n >\n {errors?.[field.name]}\n </a>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {editing && fields.some(field => field.required && !field.readonly) && (\n <Text step={-1} tone=\"muted\">\n {t('form.requiredHint')}\n </Text>\n )}\n\n {/* The placeholder *replaces* the rows rather than sitting above them.\n Rendering both meant a shimmer stacked on a full set of empty fields,\n which is two loading signals for one region and twice the height the\n loaded form settles at. */}\n {showSkeleton\n ? (customSkeleton ??\n fields.map(field => (\n <Stack key={field.name} gap=\"3xs\">\n <Skeleton shape=\"line\" className=\"w-24\" />\n <Skeleton className=\"h-9 w-full\" />\n </Stack>\n )))\n : editing\n ? rows\n : // Read mode is a description list: a label points at nothing\n // when there is no control, and a term and its value is what\n // the pair is.\n rows.length > 0 && (\n <dl className=\"m-0 flex flex-col gap-s\">{rows}</dl>\n )}\n\n {/* The rows the record owns, full width and below every field. Each\n grid is handed the *whole* error map and picks out the keys naming\n its own member, so a record owning two collections needs no\n bookkeeping here. */}\n {ownedCollections.map(field => (\n <EntityDetailGrid\n key={field.name}\n descriptor={field}\n rows={readRowDrafts(draft[field.name])}\n onRowsChange={rows => setField(field.name, rows)}\n errors={editing ? errors : undefined}\n editing={editing}\n isLoading={isLoading}\n skeleton={skeleton}\n />\n ))}\n\n {/* A cross-field rule has no row to sit under, so it sits with the\n actions it blocks. */}\n {editing && formError && (\n <span role=\"alert\" className=\"text-step-sm text-danger\">\n {formError}\n </span>\n )}\n\n {editing && !embedded && (\n <Stack direction=\"row\" gap=\"xs\" align=\"center\">\n <ActionBar surface=\"form-footer\" size=\"md\" items={footerActions} />\n {slots.footerActions}\n {/* A link styled as a button, not a button inside a link: the old\n nesting was two interactive elements for one action, and its\n `disabled` stopped nothing, because the anchor around it still\n navigated. While busy the link is inert instead. */}\n {backHref &&\n renderLink({\n href: backHref,\n className: cn(\n button({ variant: 'ghost' }),\n busy && 'pointer-events-none opacity-50',\n ),\n children: t('form.back'),\n intent: { kind: 'back' },\n })}\n </Stack>\n )}\n\n {slots.rest}\n </Stack>\n );\n\n return (\n <Card>\n {asForm ? (\n <form\n noValidate\n // Enter submits through Save, the form's default button, which is\n // disabled while a save is in flight — so a busy form stays put.\n onSubmit={event => {\n event.preventDefault();\n save();\n }}\n >\n {body}\n </form>\n ) : (\n body\n )}\n\n {verbs.dialog}\n </Card>\n );\n}\n\n/**\n * A member the detail grid renders rather than the field stack.\n *\n * The `childType` half is not defensive: a `composition` that declared no child\n * has no columns, so there is nothing for a grid to draw. It keeps its place in\n * the field stack and reads as its row count, which is what it did before this\n * control existed — an honest \"some rows\" rather than an empty table implying\n * there are none.\n */\nfunction isOwnedCollection<TEntity extends Entity>(\n field: EntityFormField<TEntity>,\n): boolean {\n return field.type === 'composition' && field.childType !== undefined;\n}\n\n/**\n * Refuse a `linkSources` entry that names a member no picker can be built for.\n *\n * `FieldRow` asks for {@link PICKABLE_TYPES} before it builds an editor, so a\n * source handed to anything else used to fall through to the read-only display\n * or a plain `FieldControl` with nothing said: the caller wired a picker, no\n * picker appeared, and the field was indistinguishable from one the entity had\n * declared read-only. That is a wiring mistake rather than a state — the entry\n * is dead in *every* shape such a field can render, since an\n * `<EntityField render>` slot is handed the draft and never the source — so it\n * costs the render instead of a warning nobody reads. `useEntityLinkSource`\n * already throws at render for the sibling mistake (a search\n * property the target does not declare `filterable`); this is the same fault\n * caught one level up.\n *\n * Two messages, because the two faults are not the same thing. A\n * `linkCollection` is a member the editor has simply not been built for yet\n * (#26), so the fix is to wait or to point at the to-one you meant. Any other\n * type is a member that can never name another record at all, so the fix is to\n * remove the entry.\n *\n * Here rather than inside `FieldRow`, and that is the whole reason it is a\n * separate pass: a row only reaches its editor branch in **edit** mode, so a\n * per-row check would stay silent on a form that opens in `read` — the default\n * whenever there is a record — and then throw on a click, minutes later. One\n * pass over the registry fires on the first render either way.\n *\n * Against the resolved fields rather than the raw metadata: a slot may drop a\n * member, and a source left behind for a field that no longer renders is not\n * worth a page.\n */\nfunction assertLinkSourcesAreEditable<TEntity extends Entity>(\n fields: Array<EntityFormField<TEntity>>,\n // Same reason as the prop's own declaration: a source's target is another\n // entity entirely and cannot be expressed in terms of `TEntity`.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n linkSources: Record<string, EntityLinkSource<any>> | undefined,\n): void {\n if (linkSources === undefined) return;\n\n const sourced = fields.filter(\n field =>\n linkSources[field.name] !== undefined && !PICKABLE_TYPES.has(field.type),\n );\n if (sourced.length === 0) return;\n\n const toMany = sourced\n .filter(field => field.type === 'linkCollection')\n .map(field => field.name);\n if (toMany.length > 0) {\n throw new Error(\n `EntityForm was given a link source for a to-many member: ${toMany.join(', ')}. ` +\n 'A `linkCollection` has no editor yet, so the source can only be dropped ' +\n 'and the field would render read-only with no sign anything was wired. ' +\n 'Remove the entry, or point it at the to-one `link` you meant.',\n );\n }\n\n const owned = sourced\n .filter(field => field.type === 'composition')\n .map(field => field.name);\n if (owned.length > 0) {\n throw new Error(\n `EntityForm was given a link source for an owned collection: ${owned.join(', ')}. ` +\n 'A `composition` is not a reference — its rows have no life outside this ' +\n 'record and are never picked from existing ones, so there is nothing for a ' +\n 'picker to look up. The detail grid is what edits them.',\n );\n }\n\n const unpickable = sourced.map(field => `${field.name} (${field.type})`);\n throw new Error(\n `EntityForm was given a link source for a member that cannot hold one: ${unpickable.join(', ')}. ` +\n 'A picker writes the target’s id into the draft, so the member has to be a ' +\n '`link` or the `string` that carries a foreign key. Remove the entry, or ' +\n 'point it at the member that actually holds the reference.',\n );\n}\n\ninterface FieldRowProps<TEntity extends Entity> {\n field: EntityFormField<TEntity>;\n entity: TEntity | undefined;\n draft: EntityDraft;\n value: string;\n editing: boolean;\n error: string | undefined;\n setField: (name: string, value: EntityDraftValue) => void;\n // The target of a relation is a different entity than the form's own.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n linkSource: EntityLinkSource<any> | undefined;\n onLinkChange:\n ((name: string, entity: Entity | undefined) => void) | undefined;\n id: string;\n}\n\n/**\n * One label + control (or value) row. A `readonly` member renders its read\n * display even in edit mode, and so does a relation with no source; everything\n * else edits through `FieldControl` — or, when a source was supplied for a\n * member in {@link PICKABLE_TYPES}, through `EntityLinkInput`. A boolean edited\n * inline carries its own label, so the row does not add a second one.\n *\n * The source branch sits above the `virtual || isRelation` fallback and below\n * `field.render`, which is what lets a slot still override a picked field.\n */\nfunction FieldRow<TEntity extends Entity>({\n field,\n entity,\n draft,\n value,\n editing,\n error,\n setField,\n linkSource,\n onLinkChange,\n id,\n}: FieldRowProps<TEntity>) {\n const t = useT();\n const errorId = `${id}-error`;\n const readNode: ReactNode = field.readRender ? (\n field.readRender(entity)\n ) : (\n <CellValue\n value={\n entity ? (entity as Record<string, unknown>)[field.name] : undefined\n }\n descriptor={field}\n record={entity as Record<string, unknown> | undefined}\n />\n );\n\n // Members with no editor of their own here: a to-one `link` whose picker was\n // never wired, a `linkCollection` (#26) and a `composition`. All three\n // fall back to the read display, which is honest — a disabled text box\n // holding `[object Object]` is not.\n const isRelation =\n field.type === 'link' ||\n field.type === 'linkCollection' ||\n field.type === 'composition';\n\n let control: ReactNode;\n if (!editing) {\n control = readNode;\n } else if (field.render) {\n control = field.render({ draft, value, setField, id });\n } else if (linkSource && PICKABLE_TYPES.has(field.type)) {\n control = (\n <EntityLinkInput\n descriptor={field}\n value={value}\n source={linkSource}\n id={id}\n disabled={field.readonly}\n onSelect={target => {\n setField(field.name, target.id == null ? '' : String(target.id));\n onLinkChange?.(field.name, target);\n }}\n onClear={() => {\n setField(field.name, '');\n onLinkChange?.(field.name, undefined);\n }}\n />\n );\n } else if (field.type === 'localized' && !field.virtual) {\n control = (\n <LocalizedFieldControl\n descriptor={field}\n value={readLocalizedDraft(draft, field.name)}\n onChange={next => setField(field.name, next)}\n id={id}\n />\n );\n } else if (field.virtual || isRelation) {\n // A relation with no source has no input to offer, and a virtual field has\n // no member to edit unless a `render` was supplied — both fall back to the\n // read display.\n control = readNode;\n } else {\n control = (\n <FieldControl\n descriptor={field}\n value={value}\n onChange={next => setField(field.name, next)}\n id={id}\n record={draft}\n aria-invalid={error !== undefined || undefined}\n aria-describedby={error === undefined ? undefined : errorId}\n aria-required={field.required || undefined}\n />\n );\n }\n\n if (!editing)\n return (\n <div className=\"flex flex-col gap-3xs\">\n <dt className=\"text-step-sm text-content-muted\">{field.label}</dt>\n <dd className=\"m-0\">{control}</dd>\n </div>\n );\n\n const ownsLabel = field.type === 'boolean' && !field.render && !field.virtual;\n // Marked before anyone submits, not discovered after.\n const marked = field.required && !field.readonly;\n\n return (\n <Stack gap=\"3xs\">\n {!ownsLabel && (\n // The marker sits beside the label, not in it: the name stays the\n // field's own, and `aria-required` is what says it to a reader.\n <span className=\"flex items-baseline gap-3xs\">\n <label htmlFor={id} className=\"text-step-sm text-content-muted\">\n {field.label}\n </label>\n {marked && (\n <span aria-hidden=\"true\" className=\"text-step-sm text-danger\">\n {t('form.requiredMarker')}\n </span>\n )}\n </span>\n )}\n {control}\n {/* Not an alert of its own: the summary above the fields is the one\n announcement, and this is what the control's description reads. */}\n {error && (\n <span id={errorId} className=\"text-step-sm text-danger\">\n {error}\n </span>\n )}\n </Stack>\n );\n}\n"],"names":["cloneEntityDraft","describeEntityColumns","extractMetaEntity","readDraftString","readLocalizedDraft","readRowDrafts","useEffect","useId","useRef","useState","useEntityNoun","useLocalizedDescriptors","useT","useTranslateKey","availableUseCases","renderAnchor","useCasesForSurface","useVerbInvoker","Alert","Button","button","CellValue","useRecordLabel","FieldControl","LocalizedFieldControl","Skeleton","Text","ActionBar","itemsForUseCases","Card","EntityLinkInput","LoadingBoundary","RegionState","Stack","cn","useLiveUpdates","useFocusOnArrival","useFocusOnLoss","EntityDetailGrid","readEntityFormFields","resolveEntityFormFields","PICKABLE_TYPES","Set","DELETE_KEY","SAVE_SHORTCUT","PRIMARY_SHORTCUT","EntityForm","entityConstructor","entity","values","onFieldChange","linkSources","onLinkChange","mode","modeProp","defaultMode","onModeChange","errors","formError","onSubmit","onDelete","deletePolicy","embedded","isLoading","skeleton","isSaving","isPending","isDeleting","error","onRetry","onKeepMine","onLoadCurrent","backHref","renderLink","title","metadata","isMetadataLoading","onUseCase","verbForms","onClone","children","formId","slots","columnDescriptors","filter","descriptor","presentation","described","resolved","fields","assertLinkSourcesAreEditable","field","isOwnedCollection","ownedCollections","customSkeleton","undefined","showSkeleton","internalMode","setInternalMode","editing","draft","setField","name","value","toggleMode","next","t","translateKey","entityNoun","live","heading","busy","resolvingLinks","Object","some","source","selected","may","action","actions","includes","declaredHeaderUseCases","useCases","declaredFooterUseCases","headerUseCases","footerUseCases","current","map","key","join","verbs","run","served","metaEntity","nameOf","recordLabel","invoke","target","object","count","requestDelete","binding","placement","labelKey","confirm","tone","messageKey","reversible","headerItems","footerItems","attempt","setAttempt","save","conflicted","code","conflict","focus","summary","summaryId","invalid","focusedAttempt","length","declaresFooterPrimary","item","emphasis","footerActions","label","connection","disabled","submit","shortcut","onSelect","destructive","asForm","rows","FieldRow","linkSource","id","body","gap","direction","align","as","ref","tabIndex","step","weight","className","type","variant","size","onClick","lines","surface","items","headerActions","span","role","aria-live","div","data-testid","plural","hasStaleData","aria-labelledby","p","ul","li","a","href","event","document","preventDefault","getElementById","required","readonly","shape","dl","onRowsChange","intent","kind","rest","form","noValidate","dialog","childType","sourced","has","toMany","Error","owned","unpickable","errorId","readNode","readRender","record","isRelation","control","render","String","onClear","virtual","onChange","aria-invalid","aria-describedby","aria-required","dt","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wE,IAAIA;;IAGV,OAAO,IAAItF,MAAMqJ,OAAO,IAAIL,YAAY;QACtC,2EAA2E;QAC3E,2EAA2E;QAC3E,gBAAgB;QAChBC,UAAUJ;IACZ,OAAO;QACLI,wBACE,KAACrN;YACC8D,YAAYM;YACZY,OAAOA;YACP0I,UAAUxI,CAAAA,OAAQJ,SAASV,MAAMW,IAAI,EAAEG;YACvCwE,IAAIA;YACJyD,QAAQtI;YACR8I,gBAAc9K,UAAU2B,aAAaA;YACrCoJ,oBAAkB/K,UAAU2B,YAAYA,YAAYwI;YACpDa,iBAAezJ,MAAM0H,QAAQ,IAAItH;;IAGvC;IAEA,IAAI,CAACI,SACH,qBACE,MAACoG;QAAIZ,WAAU;;0BACb,KAAC0D;gBAAG1D,WAAU;0BAAmChG,MAAM2E,KAAK;;0BAC5D,KAACgF;gBAAG3D,WAAU;0BAAOiD;;;;IAI3B,MAAMW,YAAY5J,MAAMiG,IAAI,KAAK,aAAa,CAACjG,MAAMkJ,MAAM,IAAI,CAAClJ,MAAMqJ,OAAO;IAC7E,sDAAsD;IACtD,MAAMQ,SAAS7J,MAAM0H,QAAQ,IAAI,CAAC1H,MAAM2H,QAAQ;IAEhD,qBACE,MAACrL;QAAMkJ,KAAI;;YACR,CAACoE,aACA,kEAAkE;YAClE,gEAAgE;0BAChE,MAACnD;gBAAKT,WAAU;;kCACd,KAACrB;wBAAMmF,SAASxE;wBAAIU,WAAU;kCAC3BhG,MAAM2E,KAAK;;oBAEbkF,wBACC,KAACpD;wBAAKsD,eAAY;wBAAO/D,WAAU;kCAChCjF,EAAE;;;;YAKVkI;YAGAxK,uBACC,KAACgI;gBAAKnB,IAAIsD;gBAAS5C,WAAU;0BAC1BvH;;;;AAKX"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/ui/organisms/entity-form/entity-form.tsx"],"sourcesContent":["'use client';\n\nimport {\n cloneEntityDraft,\n describeEntityColumns,\n type Entity,\n type EntityAction,\n type EntityDraft,\n type EntityDraftValue,\n type EntityFieldDescriptor,\n type EntityLinkSource,\n extractMetaEntity,\n type MetaAccessorType,\n readDraftString,\n readLocalizedDraft,\n readRowDrafts,\n type UseCaseDescriptor,\n} from '@entifix/core';\nimport { type ReactNode, useEffect, useId, useRef, useState } from 'react';\n\nimport {\n useEntityNoun,\n useLocalizedDescriptors,\n useT,\n useTranslateKey,\n} from '../../../i18n/index.js';\nimport {\n availableUseCases,\n renderAnchor,\n useCasesForSurface,\n} from '../../actions/index.js';\nimport { useVerbInvoker } from '../../actions/use-verb-invoker.js';\nimport { Alert } from '../../atoms/alert/index.js';\nimport { Button, button } from '../../atoms/button/index.js';\nimport { CellValue, useRecordLabel } from '../../atoms/cell-value/index.js';\nimport { FieldControl } from '../../atoms/field-control/index.js';\nimport { LocalizedFieldControl } from '../../atoms/localized-field-control/index.js';\nimport { Skeleton } from '../../atoms/skeleton/index.js';\nimport { Text } from '../../atoms/text/index.js';\nimport {\n ActionBar,\n type ActionBarItem,\n itemsForUseCases,\n} from '../../molecules/action-bar/index.js';\nimport { Card } from '../../molecules/card/index.js';\nimport { EntityLinkInput } from '../../molecules/entity-link-input/index.js';\nimport { EntityLinkMultiInput } from '../../molecules/entity-link-multi-input/index.js';\nimport { LoadingBoundary } from '../../molecules/loading-boundary/index.js';\nimport { RegionState } from '../../molecules/region-state/index.js';\nimport { Stack } from '../../molecules/stack/index.js';\nimport { cn } from '../../utils/cn.js';\nimport { useLiveUpdates } from '../../utils/live-updates.js';\nimport {\n useFocusOnArrival,\n useFocusOnLoss,\n} from '../../utils/use-focus-on-arrival.js';\nimport { EntityDetailGrid } from '../entity-detail-grid/index.js';\nimport type {\n EntityFormField,\n EntityFormMode,\n EntityFormProps,\n} from './entity-form.types.js';\nimport { readEntityFormFields } from './entity-form-slots.js';\nimport { resolveEntityFormFields } from './use-entity-form-fields.js';\n\n/**\n * The member types a `linkSources` entry can actually produce an editor for.\n *\n * `link` is the obvious one. `string` is here because a foreign key does not\n * have to be a typed relation: when the target lives in **another slice's\n * store**, an `EntityLink` would be an illegal edge and a storage-layer join\n * across a store boundary, so the member is a plain id and the relation exists\n * only in the operator's head — a cross-store reference is an id, never a\n * link. Nothing about the editor cares which of the two it is —\n * `EntityLinkInput` writes `String(target.id)` into the draft either way, and\n * the *only* place `link`-ness still matters is `applyEntityLinks` at submit,\n * which skips a non-`link` descriptor and so leaves the id as the truth.\n *\n * A `scalarCollection` that declares `references` is the to-many form of the\n * same thing: each element is one target's id, and the editor is\n * `EntityLinkMultiInput`, which adds and removes ids by name. Without\n * `references` a list of values names no record, so a source on it is the\n * same wiring mistake as one on a `number`.\n *\n * Everything else is excluded on purpose rather than by omission: a `boolean`,\n * `enum`, `number` or `date` member cannot name another record, so a source\n * pointed at one is a wiring mistake — see {@link assertLinkSourcesAreEditable}.\n */\nconst PICKABLE_TYPES: ReadonlySet<MetaAccessorType> = new Set<MetaAccessorType>(\n ['link', 'string'],\n);\n\n/** A list of ids into another entity: a `scalarCollection` that declares `references`. */\nconst isReferenceList = (field: EntityFieldDescriptor): boolean =>\n field.type === 'scalarCollection' && field.references !== undefined;\n\n/**\n * A form that builds itself from an entity's metadata: fields, labels and value\n * formatting all come from `@accessor()` declarations, so editing a new entity\n * needs no bespoke form. The read/edit toggle is the whole point — the same\n * component shows a record as text or as inputs.\n *\n * Two things layer on top of that default:\n * - **modes** — `read` renders each member through `CellValue`; `edit` renders\n * the matching `FieldControl`. A member in {@link PICKABLE_TYPES} with an\n * entry in `linkSources` gets the full picker instead — a to-one `link`, or a\n * `string` holding a foreign key into another slice's store. Without a source,\n * a relation stays read-only, and a `linkCollection` always does, the to-many\n * editor being a follow-up. A source aimed at a member that can render no\n * picker is a wiring mistake rather than a no-op, and throws.\n * - **slots** — `<EntityField>` children override one field's label, control or\n * read display, or add a computed field.\n *\n * It is presentational: the draft, its errors and the save/delete actions are\n * all props, so the same form hosts on a plain route and inside a workspace tab.\n */\n/** The key the built-in Delete runs under, which no declared verb can take. */\nconst DELETE_KEY = '$delete';\n\n/** Save, from anywhere in the form — the caret in a field included. */\nconst SAVE_SHORTCUT = 'Mod+S';\n/** The footer's declared primary, when it is not Save. */\nconst PRIMARY_SHORTCUT = 'Mod+Enter';\n\nexport function EntityForm<TEntity extends Entity>({\n entityConstructor,\n entity,\n values,\n onFieldChange,\n linkSources,\n onLinkChange,\n mode: modeProp,\n defaultMode,\n onModeChange,\n errors,\n formError,\n onSubmit,\n onDelete,\n deletePolicy = 'confirm',\n embedded = false,\n isLoading = false,\n skeleton = true,\n isSaving = false,\n isPending = false,\n isDeleting = false,\n error,\n onRetry,\n onKeepMine,\n onLoadCurrent,\n backHref,\n renderLink = renderAnchor,\n title,\n metadata,\n isMetadataLoading = false,\n onUseCase,\n verbForms,\n onClone,\n children,\n}: EntityFormProps<TEntity>) {\n const formId = useId();\n const slots = readEntityFormFields<TEntity>(children);\n // The *field* descriptors, which stay local and synchronous — a column is a\n // property of the class every caller holds. Only an action's availability is\n // a property of the caller, which is why that half arrives as `metadata`.\n // A member that presents as nothing (a `revision`) stays in the draft and is\n // never drawn.\n const columnDescriptors = describeEntityColumns(\n entityConstructor,\n entity,\n ).filter(descriptor => descriptor.presentation !== 'none') as Array<\n EntityFormField<TEntity>\n >;\n // Before slots resolve, so an `<EntityField label>` override still wins.\n const described = useLocalizedDescriptors(columnDescriptors);\n const resolved = resolveEntityFormFields(described, slots.fields);\n assertLinkSourcesAreEditable(resolved, linkSources);\n\n // **Form above, table below**, and it is a partition rather than an ordering\n // hint. A grid rendered between two labelled inputs reads as a field, which\n // it is not — it is a second record list — so every owned collection is\n // pulled out of the field stack whatever `order` it declared, and rendered\n // full width beneath it. A composition that named no child has nothing to\n // render and stays where it was, showing its row count as before.\n const fields = resolved.filter(field => !isOwnedCollection(field));\n const ownedCollections = resolved.filter(isOwnedCollection);\n\n /**\n * `true`/omitted → the built-in default, which draws one label+control pair\n * per resolved field; a node → that node; `false` → nothing. The field list\n * comes from the constructor's metadata, not from the record, so it is already\n * complete while the record is still in flight — which is what lets the\n * placeholder match the form it is standing in for.\n */\n const customSkeleton = typeof skeleton === 'boolean' ? undefined : skeleton;\n const showSkeleton = isLoading && skeleton !== false;\n\n const [internalMode, setInternalMode] = useState<EntityFormMode>(\n defaultMode ?? (entity ? 'read' : 'edit'),\n );\n const mode = modeProp ?? internalMode;\n const editing = mode === 'edit';\n\n const draft: EntityDraft = values ?? {};\n const setField = (name: string, value: EntityDraftValue) =>\n onFieldChange?.(name, value);\n\n const toggleMode = () => {\n const next: EntityFormMode = editing ? 'read' : 'edit';\n setInternalMode(next);\n onModeChange?.(next);\n };\n\n const t = useT();\n const translateKey = useTranslateKey();\n const entityNoun = useEntityNoun();\n const live = useLiveUpdates();\n // A form reached by a write — saved, handed off by a wizard — takes focus on\n // its heading, so it never rests on `<body>` (ADR 0028).\n const heading = useRef<HTMLHeadingElement>(null);\n useFocusOnArrival(heading);\n const busy = isSaving || isPending || isDeleting;\n\n // A draft restored from storage holds relation ids and no instances, so every\n // picker is resolving its target for a moment after mount. Saving inside that\n // window is exactly the case `applyEntityLinks` refuses: an `embedded` member\n // with an id and nothing to inline. Gating the save is the honest answer —\n // the form is still assembling itself, and the wait is one lookup long.\n //\n // Deliberately not narrowed to `embedded` members: a descriptor's\n // serialization is not what makes an in-flight lookup a bad moment to submit,\n // and a form that saves half-resolved is confusing whichever shape it writes.\n const resolvingLinks = Object.values(linkSources ?? {}).some(\n source => source.selected.isLoading,\n );\n\n // Absent metadata keeps the pre-ADR-0026 behaviour, so an un-migrated call\n // site renders exactly as before. Present metadata is authoritative: it is\n // what the service already decided this caller may do.\n const may = (action: EntityAction) =>\n metadata === undefined || metadata.actions.includes(action);\n\n // A single-record form shows the verbs that act on *this* record. Which cell\n // lands where is `action-surfaces`' business and nobody else's — a\n // `context-dependent` entity verb belongs to a row's overflow menu and a\n // `collection`-bound one to the bulk bar, and resolving that here as well is\n // how the two surfaces drifted apart in the first place.\n //\n // ⚠️ **Only when there is somewhere for them to go.** Every cell these two\n // surfaces render is `binding: 'entity'`, so without an `onUseCase` the\n // button has no handler and clicking it does nothing at all. That is not a\n // hypothetical: `makeEntityCrud` withholds the handler on a create, because\n // there is no record for a verb to act on — and Publish and Unpublish\n // rendered on a new `ProductOffering` and were inert, which reads as a broken\n // feature rather than an inapplicable one.\n //\n // The hooks are called unconditionally and their *results* are gated: React's\n // hook count must stay fixed across renders.\n const declaredHeaderUseCases = useCasesForSurface(\n 'form-header',\n metadata?.useCases,\n verbForms,\n );\n const declaredFooterUseCases = useCasesForSurface(\n 'form-footer',\n metadata?.useCases,\n verbForms,\n );\n // And only the verbs the record's state allows: a shipment awaiting dispatch\n // offers Dispatch, not every move a shipment can ever make.\n const headerUseCases = onUseCase\n ? availableUseCases(declaredHeaderUseCases, entity)\n : [];\n const footerUseCases = onUseCase\n ? availableUseCases(declaredFooterUseCases, entity)\n : [];\n // A verb that moved its record out of the states it applies to unmounts the\n // button the reader just pressed; focus goes to the heading, not `<body>`.\n useFocusOnLoss(\n () => heading.current,\n [...headerUseCases, ...footerUseCases].map(({ key }) => key).join(' '),\n );\n\n // Every verb on the form, and its own Delete, goes through one invoker: a\n // destructive verb asks, asks for the name, or runs and offers Undo, as it\n // declared — `revoke-sessions` ends every session a user holds.\n const verbs = useVerbInvoker<undefined>({\n run: key => (key === DELETE_KEY ? onDelete?.() : onUseCase?.(key)),\n busy,\n served: metadata?.useCases,\n });\n // What a confirmation names — the object in \"Delete {record}?\" and the text\n // the typed policy asks for — through the one derivation every surface\n // shares: the entity's `labelMember`, resolved if it is a reference.\n const metaEntity = extractMetaEntity(entityConstructor);\n const nameOf = useRecordLabel();\n const recordLabel = nameOf(entityConstructor, draft);\n const invoke = (descriptor: UseCaseDescriptor) =>\n verbs.invoke({\n descriptor,\n target: undefined,\n object: recordLabel,\n count: 1,\n });\n const requestDelete = () => {\n // Undo is the host's to offer: only it can put a deleted record back.\n if (deletePolicy === 'undo') {\n onDelete?.();\n return;\n }\n invoke({\n key: DELETE_KEY,\n binding: 'entity',\n placement: 'determining',\n labelKey: 'controls:form.delete',\n confirm: {\n tone: 'destructive',\n messageKey: 'controls:confirm.deleteMessage',\n },\n reversible: deletePolicy,\n });\n };\n\n const headerItems = itemsForUseCases(\n headerUseCases,\n translateKey,\n invoke,\n busy,\n );\n const footerItems = itemsForUseCases(\n footerUseCases,\n translateKey,\n invoke,\n busy,\n );\n /**\n * A save attempt. Counted, so a refused one moves focus to the error summary\n * once — not again on every keystroke that leaves an error standing.\n */\n const [attempt, setAttempt] = useState(0);\n const save = () => {\n setAttempt(current => current + 1);\n onSubmit?.(draft);\n };\n // A save refused because the record moved on. It is told apart by its code,\n // the one thing a failure decoded in a browser is sure to carry, and it is\n // not a retry: the fields keep what was typed and the person chooses.\n const conflicted = error?.code === 'staleRevision';\n const conflict = useRef<HTMLDivElement>(null);\n useEffect(() => {\n // Focus moves to the explanation, so a keyboard or screen-reader user is\n // not left on a Save that silently did nothing.\n if (conflicted) conflict.current?.focus();\n }, [conflicted, error]);\n const summary = useRef<HTMLDivElement>(null);\n const summaryId = useId();\n const invalid = editing\n ? fields.filter(field => errors?.[field.name] !== undefined)\n : [];\n const focusedAttempt = useRef(0);\n useEffect(() => {\n if (attempt === focusedAttempt.current || invalid.length === 0) return;\n focusedAttempt.current = attempt;\n summary.current?.focus();\n }, [attempt, invalid.length]);\n\n // Save is the footer's primary unless the entity declared one of its own — a\n // determining \"Publish\" is what that page is for, and Save steps aside.\n const declaresFooterPrimary = footerItems.some(\n item => item.emphasis === 'primary',\n );\n const footerActions: ActionBarItem[] = [\n ...(may('write')\n ? [\n {\n key: 'save',\n // A pending write waits on the push stream; while that is down\n // it says so, rather than waiting without a word.\n label: isPending\n ? t(live.connection === 'open' ? 'form.pending' : 'live.waiting')\n : isSaving\n ? t('form.saving')\n : t('form.save'),\n emphasis: declaresFooterPrimary\n ? ('default' as const)\n : ('primary' as const),\n disabled: busy || resolvingLinks,\n submit: true,\n shortcut: SAVE_SHORTCUT,\n onSelect: save,\n },\n ]\n : []),\n // The page's main act answers Mod+Enter, unless it declared its own.\n ...footerItems.map(item =>\n item.emphasis === 'primary' && item.shortcut === undefined\n ? { ...item, shortcut: PRIMARY_SHORTCUT }\n : item,\n ),\n // Clone is the CRUD triple's, not a declared verb's: every entity can be\n // copied, so giving it a `@useCase()` would mean declaring the same verb on\n // all 28 of them. It needs `write`, because what it produces is a create.\n ...(onClone && entity && may('write')\n ? [\n {\n key: 'clone',\n label: t('form.clone'),\n disabled: busy,\n onSelect: () => onClone(cloneEntityDraft(entityConstructor, draft)),\n },\n ]\n : []),\n ...(onDelete && may('delete')\n ? [\n {\n key: 'delete',\n label: isDeleting ? t('form.deleting') : t('form.delete'),\n destructive: true,\n disabled: busy,\n onSelect: requestDelete,\n },\n ]\n : []),\n ];\n\n // A real form while editing, so Enter in a field saves; an embedded one\n // belongs to its host's flow, and a caller who may not write has no Save.\n const asForm = editing && !embedded && may('write');\n const rows = fields.map(field => (\n <FieldRow\n key={field.name}\n field={field}\n entity={entity}\n draft={draft}\n value={readDraftString(draft, field.name)}\n editing={editing}\n error={editing ? errors?.[field.name] : undefined}\n setField={setField}\n linkSource={linkSources?.[field.name]}\n onLinkChange={onLinkChange}\n id={`${formId}-${field.name}`}\n />\n ));\n\n const body = (\n <Stack gap=\"s\">\n {/* An embedded form brings only its fields: the heading and the action\n row belong to whatever is hosting it — a wizard step sits under the\n wizard's own heading and advances with the wizard's own footer, so\n rendering a second of each is two controls for one job. */}\n {!embedded && (\n <Stack direction=\"row\" gap=\"xs\" align=\"center\">\n <Text\n as=\"h2\"\n ref={heading}\n tabIndex={-1}\n step={1}\n weight=\"semibold\"\n className=\"focus-ring\"\n >\n {/* `entity` is undefined while the record is still in flight, so\n testing it alone made a loading edit form announce itself as\n \"New\" for as long as the fetch took, then relabel when the\n record landed. A form that is loading is never a create. */}\n {title ?? (entity || isLoading ? t('form.details') : t('form.new'))}\n </Text>\n {/* The built-in toggle only appears when the form owns its mode and\n there is a record to view — a create form has nothing to read. */}\n {modeProp === undefined && entity && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={toggleMode}\n >\n {editing ? t('form.view') : t('form.edit')}\n </Button>\n )}\n <LoadingBoundary isLoading={isMetadataLoading} lines={0}>\n <>\n {headerItems.length > 0 && (\n <ActionBar surface=\"form-header\" items={headerItems} />\n )}\n {slots.headerActions}\n </>\n </LoadingBoundary>\n </Stack>\n )}\n\n {/* One announcement for the form; the shimmer below is aria-hidden. */}\n <span role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {isLoading ? t('form.loading') : ''}\n </span>\n\n {conflicted && (\n <div\n ref={conflict}\n tabIndex={-1}\n data-testid=\"entity-form-conflict\"\n className=\"rounded-lg focus-ring\"\n >\n <Alert\n tone=\"danger\"\n title={t('form.conflictTitle')}\n action={\n onKeepMine === undefined &&\n onLoadCurrent === undefined ? undefined : (\n <span className=\"flex flex-wrap gap-3xs\">\n {onKeepMine !== undefined && (\n <Button\n type=\"button\"\n variant=\"primary\"\n size=\"sm\"\n onClick={onKeepMine}\n >\n {t('form.conflictKeep')}\n </Button>\n )}\n {onLoadCurrent !== undefined && (\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n onClick={onLoadCurrent}\n >\n {t('form.conflictLoad')}\n </Button>\n )}\n </span>\n )\n }\n >\n {t('form.conflictBody')}\n {onKeepMine !== undefined && ` ${t('form.conflictKeepHint')}`}\n </Alert>\n </div>\n )}\n\n <RegionState\n plural={entityNoun(metaEntity, 'plural')}\n error={conflicted ? undefined : error}\n onRetry={onRetry}\n // Only a load that can be retried leaves an out-of-date record; a\n // failed save leaves what the reader typed, which is current.\n hasStaleData={entity !== undefined && onRetry !== undefined}\n />\n\n {/* A refused save, as one summary of links to what needs fixing: the\n only alert in the form, and where focus goes after the attempt. */}\n {invalid.length > 0 && (\n <div\n ref={summary}\n tabIndex={-1}\n role=\"alert\"\n aria-labelledby={summaryId}\n data-testid=\"entity-form-error-summary\"\n className=\"rounded-lg border-l-4 border-danger bg-danger-subtle px-s py-xs text-step-sm text-content focus-ring\"\n >\n <p id={summaryId} className=\"m-0 font-semibold\">\n {t('form.errorSummary', { count: invalid.length })}\n </p>\n <ul className=\"m-0 ps-s\">\n {invalid.map(field => (\n <li key={field.name}>\n <a\n href={`#${formId}-${field.name}`}\n // The content colour: primary on the danger surface misses\n // 4.5:1.\n className=\"font-medium text-content underline underline-offset-2 focus-ring\"\n onClick={event => {\n event.preventDefault();\n document.getElementById(`${formId}-${field.name}`)?.focus();\n }}\n >\n {errors?.[field.name]}\n </a>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {editing && fields.some(field => field.required && !field.readonly) && (\n <Text step={-1} tone=\"muted\">\n {t('form.requiredHint')}\n </Text>\n )}\n\n {/* The placeholder *replaces* the rows rather than sitting above them.\n Rendering both meant a shimmer stacked on a full set of empty fields,\n which is two loading signals for one region and twice the height the\n loaded form settles at. */}\n {showSkeleton\n ? (customSkeleton ??\n fields.map(field => (\n <Stack key={field.name} gap=\"3xs\">\n <Skeleton shape=\"line\" className=\"w-24\" />\n <Skeleton className=\"h-9 w-full\" />\n </Stack>\n )))\n : editing\n ? rows\n : // Read mode is a description list: a label points at nothing\n // when there is no control, and a term and its value is what\n // the pair is.\n rows.length > 0 && (\n <dl className=\"m-0 flex flex-col gap-s\">{rows}</dl>\n )}\n\n {/* The rows the record owns, full width and below every field. Each\n grid is handed the *whole* error map and picks out the keys naming\n its own member, so a record owning two collections needs no\n bookkeeping here. */}\n {ownedCollections.map(field => (\n <EntityDetailGrid\n key={field.name}\n descriptor={field}\n rows={readRowDrafts(draft[field.name])}\n onRowsChange={rows => setField(field.name, rows)}\n errors={editing ? errors : undefined}\n editing={editing}\n isLoading={isLoading}\n skeleton={skeleton}\n />\n ))}\n\n {/* A cross-field rule has no row to sit under, so it sits with the\n actions it blocks. */}\n {editing && formError && (\n <span role=\"alert\" className=\"text-step-sm text-danger\">\n {formError}\n </span>\n )}\n\n {editing && !embedded && (\n <Stack direction=\"row\" gap=\"xs\" align=\"center\">\n <ActionBar surface=\"form-footer\" size=\"md\" items={footerActions} />\n {slots.footerActions}\n {/* A link styled as a button, not a button inside a link: the old\n nesting was two interactive elements for one action, and its\n `disabled` stopped nothing, because the anchor around it still\n navigated. While busy the link is inert instead. */}\n {backHref &&\n renderLink({\n href: backHref,\n className: cn(\n button({ variant: 'ghost' }),\n busy && 'pointer-events-none opacity-50',\n ),\n children: t('form.back'),\n intent: { kind: 'back' },\n })}\n </Stack>\n )}\n\n {slots.rest}\n </Stack>\n );\n\n return (\n <Card>\n {asForm ? (\n <form\n noValidate\n // Enter submits through Save, the form's default button, which is\n // disabled while a save is in flight — so a busy form stays put.\n onSubmit={event => {\n event.preventDefault();\n save();\n }}\n >\n {body}\n </form>\n ) : (\n body\n )}\n\n {verbs.dialog}\n </Card>\n );\n}\n\n/**\n * A member the detail grid renders rather than the field stack.\n *\n * The `childType` half is not defensive: a `composition` that declared no child\n * has no columns, so there is nothing for a grid to draw. It keeps its place in\n * the field stack and reads as its row count, which is what it did before this\n * control existed — an honest \"some rows\" rather than an empty table implying\n * there are none.\n */\nfunction isOwnedCollection<TEntity extends Entity>(\n field: EntityFormField<TEntity>,\n): boolean {\n return field.type === 'composition' && field.childType !== undefined;\n}\n\n/**\n * Refuse a `linkSources` entry that names a member no picker can be built for.\n *\n * `FieldRow` asks for {@link PICKABLE_TYPES} before it builds an editor, so a\n * source handed to anything else used to fall through to the read-only display\n * or a plain `FieldControl` with nothing said: the caller wired a picker, no\n * picker appeared, and the field was indistinguishable from one the entity had\n * declared read-only. That is a wiring mistake rather than a state — the entry\n * is dead in *every* shape such a field can render, since an\n * `<EntityField render>` slot is handed the draft and never the source — so it\n * costs the render instead of a warning nobody reads. `useEntityLinkSource`\n * already throws at render for the sibling mistake (a search\n * property the target does not declare `filterable`); this is the same fault\n * caught one level up.\n *\n * Two messages, because the two faults are not the same thing. A\n * `linkCollection` is a member the editor has simply not been built for yet\n * (#26), so the fix is to wait or to point at the to-one you meant. Any other\n * type is a member that can never name another record at all, so the fix is to\n * remove the entry.\n *\n * Here rather than inside `FieldRow`, and that is the whole reason it is a\n * separate pass: a row only reaches its editor branch in **edit** mode, so a\n * per-row check would stay silent on a form that opens in `read` — the default\n * whenever there is a record — and then throw on a click, minutes later. One\n * pass over the registry fires on the first render either way.\n *\n * Against the resolved fields rather than the raw metadata: a slot may drop a\n * member, and a source left behind for a field that no longer renders is not\n * worth a page.\n */\nfunction assertLinkSourcesAreEditable<TEntity extends Entity>(\n fields: Array<EntityFormField<TEntity>>,\n // Same reason as the prop's own declaration: a source's target is another\n // entity entirely and cannot be expressed in terms of `TEntity`.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n linkSources: Record<string, EntityLinkSource<any>> | undefined,\n): void {\n if (linkSources === undefined) return;\n\n const sourced = fields.filter(\n field =>\n linkSources[field.name] !== undefined &&\n !PICKABLE_TYPES.has(field.type) &&\n !isReferenceList(field),\n );\n if (sourced.length === 0) return;\n\n const toMany = sourced\n .filter(field => field.type === 'linkCollection')\n .map(field => field.name);\n if (toMany.length > 0) {\n throw new Error(\n `EntityForm was given a link source for a to-many member: ${toMany.join(', ')}. ` +\n 'A `linkCollection` has no editor yet, so the source can only be dropped ' +\n 'and the field would render read-only with no sign anything was wired. ' +\n 'Remove the entry, or point it at the to-one `link` you meant.',\n );\n }\n\n const owned = sourced\n .filter(field => field.type === 'composition')\n .map(field => field.name);\n if (owned.length > 0) {\n throw new Error(\n `EntityForm was given a link source for an owned collection: ${owned.join(', ')}. ` +\n 'A `composition` is not a reference — its rows have no life outside this ' +\n 'record and are never picked from existing ones, so there is nothing for a ' +\n 'picker to look up. The detail grid is what edits them.',\n );\n }\n\n const unpickable = sourced.map(field => `${field.name} (${field.type})`);\n throw new Error(\n `EntityForm was given a link source for a member that cannot hold one: ${unpickable.join(', ')}. ` +\n 'A picker writes the target’s id into the draft, so the member has to be a ' +\n '`link`, the `string` that carries a foreign key, or a `scalarCollection` ' +\n 'that declares `references`. Remove the entry, or point it at the member ' +\n 'that actually holds the reference.',\n );\n}\n\ninterface FieldRowProps<TEntity extends Entity> {\n field: EntityFormField<TEntity>;\n entity: TEntity | undefined;\n draft: EntityDraft;\n value: string;\n editing: boolean;\n error: string | undefined;\n setField: (name: string, value: EntityDraftValue) => void;\n // The target of a relation is a different entity than the form's own.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n linkSource: EntityLinkSource<any> | undefined;\n onLinkChange:\n ((name: string, entity: Entity | undefined) => void) | undefined;\n id: string;\n}\n\n/**\n * One label + control (or value) row. A `readonly` member renders its read\n * display even in edit mode, and so does a relation with no source; everything\n * else edits through `FieldControl` — or, when a source was supplied for a\n * member in {@link PICKABLE_TYPES}, through `EntityLinkInput`. A boolean edited\n * inline carries its own label, so the row does not add a second one.\n *\n * The source branch sits above the `virtual || isRelation` fallback and below\n * `field.render`, which is what lets a slot still override a picked field.\n */\nfunction FieldRow<TEntity extends Entity>({\n field,\n entity,\n draft,\n value,\n editing,\n error,\n setField,\n linkSource,\n onLinkChange,\n id,\n}: FieldRowProps<TEntity>) {\n const t = useT();\n const errorId = `${id}-error`;\n const readNode: ReactNode = field.readRender ? (\n field.readRender(entity)\n ) : (\n <CellValue\n value={\n entity ? (entity as Record<string, unknown>)[field.name] : undefined\n }\n descriptor={field}\n record={entity as Record<string, unknown> | undefined}\n />\n );\n\n // Members with no editor of their own here: a to-one `link` whose picker was\n // never wired, a `linkCollection` (#26) and a `composition`. All three\n // fall back to the read display, which is honest — a disabled text box\n // holding `[object Object]` is not.\n const isRelation =\n field.type === 'link' ||\n field.type === 'linkCollection' ||\n field.type === 'composition';\n\n let control: ReactNode;\n if (!editing) {\n control = readNode;\n } else if (field.render) {\n control = field.render({ draft, value, setField, id });\n } else if (linkSource && isReferenceList(field)) {\n control = (\n <EntityLinkMultiInput\n descriptor={field}\n value={value}\n source={linkSource}\n id={id}\n disabled={field.readonly}\n onChange={next => setField(field.name, next)}\n />\n );\n } else if (linkSource && PICKABLE_TYPES.has(field.type)) {\n control = (\n <EntityLinkInput\n descriptor={field}\n value={value}\n source={linkSource}\n id={id}\n disabled={field.readonly}\n onSelect={target => {\n setField(field.name, target.id == null ? '' : String(target.id));\n onLinkChange?.(field.name, target);\n }}\n onClear={() => {\n setField(field.name, '');\n onLinkChange?.(field.name, undefined);\n }}\n />\n );\n } else if (field.type === 'localized' && !field.virtual) {\n control = (\n <LocalizedFieldControl\n descriptor={field}\n value={readLocalizedDraft(draft, field.name)}\n onChange={next => setField(field.name, next)}\n id={id}\n />\n );\n } else if (field.virtual || isRelation) {\n // A relation with no source has no input to offer, and a virtual field has\n // no member to edit unless a `render` was supplied — both fall back to the\n // read display.\n control = readNode;\n } else {\n control = (\n <FieldControl\n descriptor={field}\n value={value}\n onChange={next => setField(field.name, next)}\n id={id}\n record={draft}\n aria-invalid={error !== undefined || undefined}\n aria-describedby={error === undefined ? undefined : errorId}\n aria-required={field.required || undefined}\n />\n );\n }\n\n if (!editing)\n return (\n <div className=\"flex flex-col gap-3xs\">\n <dt className=\"text-step-sm text-content-muted\">{field.label}</dt>\n <dd className=\"m-0\">{control}</dd>\n </div>\n );\n\n const ownsLabel = field.type === 'boolean' && !field.render && !field.virtual;\n // Marked before anyone submits, not discovered after.\n const marked = field.required && !field.readonly;\n\n return (\n <Stack gap=\"3xs\">\n {!ownsLabel && (\n // The marker sits beside the label, not in it: the name stays the\n // field's own, and `aria-required` is what says it to a reader.\n <span className=\"flex items-baseline gap-3xs\">\n <label htmlFor={id} className=\"text-step-sm text-content-muted\">\n {field.label}\n </label>\n {marked && (\n <span aria-hidden=\"true\" className=\"text-step-sm text-danger\">\n {t('form.requiredMarker')}\n </span>\n )}\n </span>\n )}\n {control}\n {/* Not an alert of its own: the summary above the fields is the one\n announcement, and this is what the control's description reads. */}\n {error && (\n <span id={errorId} className=\"text-step-sm text-danger\">\n {error}\n </span>\n )}\n </Stack>\n );\n}\n"],"names":["cloneEntityDraft","describeEntityColumns","extractMetaEntity","readDraftString","readLocalizedDraft","readRowDrafts","useEffect","useId","useRef","useState","useEntityNoun","useLocalizedDescriptors","useT","useTranslateKey","availableUseCases","renderAnchor","useCasesForSurface","useVerbInvoker","Alert","Button","button","CellValue","useRecordLabel","FieldControl","LocalizedFieldControl","Skeleton","Text","ActionBar","itemsForUseCases","Card","EntityLinkInput","EntityLinkMultiInput","LoadingBoundary","RegionState","Stack","cn","useLiveUpdates","useFocusOnArrival","useFocusOnLoss","EntityDetailGrid","readEntityFormFields","resolveEntityFormFields","PICKABLE_TYPES","Set","isReferenceList","field","type","references","undefined","DELETE_KEY","SAVE_SHORTCUT","PRIMARY_SHORTCUT","EntityForm","entityConstructor","entity","values","onFieldChange","linkSources","onLinkChange","mode","modeProp","defaultMode","onModeChange","errors","formError","onSubmit","onDelete","deletePolicy","embedded","isLoading","skeleton","isSaving","isPending","isDeleting","error","onRetry","onKeepMine","onLoadCurrent","backHref","renderLink","title","metadata","isMetadataLoading","onUseCase","verbForms","onClone","children","formId","slots","columnDescriptors","filter","descriptor","presentation","described","resolved","fields","assertLinkSourcesAreEditable","isOwnedCollection","ownedCollections","customSkeleton","showSkeleton","internalMode","setInternalMode","editing","draft","setField","name","value","toggleMode","next","t","translateKey","entityNoun","live","heading","busy","resolvingLinks","Object","some","source","selected","may","action","actions","includes","declaredHeaderUseCases","useCases","declaredFooterUseCases","headerUseCases","footerUseCases","current","map","key","join","verbs","run","served","metaEntity","nameOf","recordLabel","invoke","target","object","count","requestDelete","binding","placement","labelKey","confirm","tone","messageKey","reversible","headerItems","footerItems","attempt","setAttempt","save","conflicted","code","conflict","focus","summary","summaryId","invalid","focusedAttempt","length","declaresFooterPrimary","item","emphasis","footerActions","label","connection","disabled","submit","shortcut","onSelect","destructive","asForm","rows","FieldRow","linkSource","id","body","gap","direction","align","as","ref","tabIndex","step","weight","className","variant","size","onClick","lines","surface","items","headerActions","span","role","aria-live","div","data-testid","plural","hasStaleData","aria-labelledby","p","ul","li","a","href","event","document","preventDefault","getElementById","required","readonly","shape","dl","onRowsChange","intent","kind","rest","form","noValidate","dialog","childType","sourced","has","toMany","Error","owned","unpickable","errorId","readNode","readRender","record","isRelation","control","render","onChange","String","onClear","virtual","aria-invalid","aria-describedby","aria-required","dt","dd","ownsLabel","marked","htmlFor","aria-hidden"],"mappings":"AAAA;;;AAEA,SACEA,gBAAgB,EAChBC,qBAAqB,EAOrBC,iBAAiB,EAEjBC,eAAe,EACfC,kBAAkB,EAClBC,aAAa,QAER,gBAAgB;AACvB,SAAyBC,SAAS,EAAEC,KAAK,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAE3E,SACEC,aAAa,EACbC,uBAAuB,EACvBC,IAAI,EACJC,eAAe,QACV,yBAAyB;AAChC,SACEC,iBAAiB,EACjBC,YAAY,EACZC,kBAAkB,QACb,yBAAyB;AAChC,SAASC,cAAc,QAAQ,oCAAoC;AACnE,SAASC,KAAK,QAAQ,6BAA6B;AACnD,SAASC,MAAM,EAAEC,MAAM,QAAQ,8BAA8B;AAC7D,SAASC,SAAS,EAAEC,cAAc,QAAQ,kCAAkC;AAC5E,SAASC,YAAY,QAAQ,qCAAqC;AAClE,SAASC,qBAAqB,QAAQ,+CAA+C;AACrF,SAASC,QAAQ,QAAQ,gCAAgC;AACzD,SAASC,IAAI,QAAQ,4BAA4B;AACjD,SACEC,SAAS,EAETC,gBAAgB,QACX,sCAAsC;AAC7C,SAASC,IAAI,QAAQ,gCAAgC;AACrD,SAASC,eAAe,QAAQ,6CAA6C;AAC7E,SAASC,oBAAoB,QAAQ,mDAAmD;AACxF,SAASC,eAAe,QAAQ,4CAA4C;AAC5E,SAASC,WAAW,QAAQ,wCAAwC;AACpE,SAASC,KAAK,QAAQ,iCAAiC;AACvD,SAASC,EAAE,QAAQ,oBAAoB;AACvC,SAASC,cAAc,QAAQ,8BAA8B;AAC7D,SACEC,iBAAiB,EACjBC,cAAc,QACT,sCAAsC;AAC7C,SAASC,gBAAgB,QAAQ,iCAAiC;AAMlE,SAASC,oBAAoB,QAAQ,y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;IACtD,MAAMO,SAAS9M,MAAM2K,QAAQ,IAAI,CAAC3K,MAAM4K,QAAQ;IAEhD,qBACE,MAACvL;QAAMqJ,KAAI;;YACR,CAACmE,aACA,kEAAkE;YAClE,gEAAgE;0BAChE,MAACnD;gBAAKR,WAAU;;kCACd,KAACrB;wBAAMkF,SAASvE;wBAAIU,WAAU;kCAC3BlJ,MAAM6H,KAAK;;oBAEbiF,wBACC,KAACpD;wBAAKsD,eAAY;wBAAO9D,WAAU;kCAChCjF,EAAE;;;;YAKViI;YAGArK,uBACC,KAAC6H;gBAAKlB,IAAIqD;gBAAS3C,WAAU;0BAC1BrH;;;;AAKX"}
|
|
@@ -56,4 +56,11 @@ export declare function useReferenceLabel(entityKey: string, id: string): Refere
|
|
|
56
56
|
* something to quote. Never the whole id.
|
|
57
57
|
*/
|
|
58
58
|
export declare function useUnresolvedReference(): (entityKey: string, id: string) => string;
|
|
59
|
+
/**
|
|
60
|
+
* One referenced record as plain words — its name when read, otherwise the
|
|
61
|
+
* noun and short id, or the raw id when nothing is registered to read it. For
|
|
62
|
+
* the places that need text rather than an element: an accessible name, a
|
|
63
|
+
* button's label.
|
|
64
|
+
*/
|
|
65
|
+
export declare function useReferenceText(entityKey: string, id: string): string;
|
|
59
66
|
//# sourceMappingURL=reference-labels.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference-labels.d.ts","sourceRoot":"","sources":["../../../src/ui/utils/reference-labels.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"reference-labels.d.ts","sourceRoot":"","sources":["../../../src/ui/utils/reference-labels.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,aAAa,EAAW,MAAM,eAAe,CAAC;AACtE,OAAO,EAAiB,KAAK,SAAS,EAA2B,MAAM,OAAO,CAAC;AAE/E,OAAO,EACL,KAAK,gBAAgB,EAItB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;GAUG;AACH,MA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ortId } from '@entifix/core';
|
|
3
|
+
import { localize, shortId } from '@entifix/core';
|
|
4
4
|
import { createContext, useCallback, useContext } from 'react';
|
|
5
|
-
import { useEntityNoun, useT } from '../../i18n/index.js';
|
|
5
|
+
import { useEntityNoun, useLocale, useT } from '../../i18n/index.js';
|
|
6
6
|
const UNREGISTERED = {
|
|
7
7
|
status: 'unregistered'
|
|
8
8
|
};
|
|
@@ -45,5 +45,24 @@ const ReferenceLabelsContext = /*#__PURE__*/ createContext({
|
|
|
45
45
|
t
|
|
46
46
|
]);
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* One referenced record as plain words — its name when read, otherwise the
|
|
50
|
+
* noun and short id, or the raw id when nothing is registered to read it. For
|
|
51
|
+
* the places that need text rather than an element: an accessible name, a
|
|
52
|
+
* button's label.
|
|
53
|
+
*/ export function useReferenceText(entityKey, id) {
|
|
54
|
+
const state = useReferenceLabel(entityKey, id);
|
|
55
|
+
const unresolved = useUnresolvedReference();
|
|
56
|
+
const locale = useLocale();
|
|
57
|
+
switch(state.status){
|
|
58
|
+
case 'named':
|
|
59
|
+
var _localize;
|
|
60
|
+
return typeof state.label === 'string' ? state.label : (_localize = localize(state.label, locale)) != null ? _localize : id;
|
|
61
|
+
case 'unregistered':
|
|
62
|
+
return id;
|
|
63
|
+
default:
|
|
64
|
+
return unresolved(entityKey, id);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
48
67
|
|
|
49
68
|
//# sourceMappingURL=reference-labels.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/ui/utils/reference-labels.tsx"],"sourcesContent":["'use client';\n\nimport { type LocalizedText, shortId } from '@entifix/core';\nimport { createContext, type ReactNode, useCallback, useContext } from 'react';\n\nimport {\n type EntityNounSource,\n useEntityNoun,\n useT,\n} from '../../i18n/index.js';\n\n/**\n * Where the name of one referenced record stands\n * ([ADR 0030](../../../../../../docs/adr/0030-a-reference-names-its-target-through-the-owners-read-port.md)):\n *\n * - `resolving` — asked for and not here yet;\n * - `named` — read, as a text or a text per locale;\n * - `notFound` — read, and no record answered the id (deleted, or one the\n * reader may not read);\n * - `failed` — the read itself failed;\n * - `unregistered` — the host registered nothing that reads this entity.\n */\nexport type ReferenceLabelState =\n | { readonly status: 'resolving' }\n | { readonly status: 'named'; readonly label: string | LocalizedText }\n | { readonly status: 'notFound' }\n | { readonly status: 'failed' }\n | { readonly status: 'unregistered' };\n\n/**\n * How the controls ask what a referenced record is called. A host fills it —\n * batching what a render asks for into one read per target entity — and the\n * controls only read it, so this package imports neither TanStack nor the\n * integration layer.\n */\nexport interface ReferenceLabelLookup {\n /** The name of the record of `entityKey` (`domain:key`) whose id is `id`. */\n label(entityKey: string, id: string): ReferenceLabelState;\n /** How to call the entity itself, when a record's name could not be read. */\n noun?(entityKey: string): EntityNounSource | undefined;\n}\n\nconst UNREGISTERED: ReferenceLabelState = { status: 'unregistered' };\n\nconst ReferenceLabelsContext = createContext<ReferenceLabelLookup>({\n label: () => UNREGISTERED,\n});\n\n/**\n * Publishes a host's reference lookup to every control that renders a\n * reference — a cell, a card, a read form, a confirm dialog. Without one, a\n * reference reads as its raw id, muted, which is what tells a developer the\n * registry is missing.\n */\nexport function ReferenceLabelsProvider({\n lookup,\n children,\n}: {\n lookup: ReferenceLabelLookup;\n children: ReactNode;\n}) {\n return (\n <ReferenceLabelsContext.Provider value={lookup}>\n {children}\n </ReferenceLabelsContext.Provider>\n );\n}\n\n/** The nearest {@link ReferenceLabelsProvider}'s lookup. */\nexport const useReferenceLabels = (): ReferenceLabelLookup =>\n useContext(ReferenceLabelsContext);\n\n/** Where one referenced record's name stands. */\nexport function useReferenceLabel(\n entityKey: string,\n id: string,\n): ReferenceLabelState {\n return useReferenceLabels().label(entityKey, id);\n}\n\n/** `catalog:product-offering` → `product-offering`: the entity's key, when it has no noun. */\nconst keyOf = (entityKey: string) =>\n entityKey.slice(entityKey.indexOf(':') + 1);\n\n/**\n * Words for a referenced record that has no name to show — its entity's noun\n * and the id's short form (\"Offering product-…\"), so the reader still has\n * something to quote. Never the whole id.\n */\nexport function useUnresolvedReference(): (\n entityKey: string,\n id: string,\n) => string {\n const t = useT();\n const noun = useEntityNoun();\n const lookup = useReferenceLabels();\n return useCallback(\n (entityKey, id) => {\n const source = lookup.noun?.(entityKey);\n return t('reference.unresolved', {\n noun: source === undefined ? keyOf(entityKey) : noun(source),\n id: shortId(id),\n });\n },\n [lookup, noun, t],\n );\n}\n"],"names":["shortId","createContext","useCallback","useContext","useEntityNoun","useT","UNREGISTERED","status","ReferenceLabelsContext","label","ReferenceLabelsProvider","lookup","children","Provider","value","useReferenceLabels","useReferenceLabel","entityKey","id","keyOf","slice","indexOf","useUnresolvedReference","t","noun","source","undefined"],"mappings":"AAAA;;AAEA,
|
|
1
|
+
{"version":3,"sources":["../../../src/ui/utils/reference-labels.tsx"],"sourcesContent":["'use client';\n\nimport { localize, type LocalizedText, shortId } from '@entifix/core';\nimport { createContext, type ReactNode, useCallback, useContext } from 'react';\n\nimport {\n type EntityNounSource,\n useEntityNoun,\n useLocale,\n useT,\n} from '../../i18n/index.js';\n\n/**\n * Where the name of one referenced record stands\n * ([ADR 0030](../../../../../../docs/adr/0030-a-reference-names-its-target-through-the-owners-read-port.md)):\n *\n * - `resolving` — asked for and not here yet;\n * - `named` — read, as a text or a text per locale;\n * - `notFound` — read, and no record answered the id (deleted, or one the\n * reader may not read);\n * - `failed` — the read itself failed;\n * - `unregistered` — the host registered nothing that reads this entity.\n */\nexport type ReferenceLabelState =\n | { readonly status: 'resolving' }\n | { readonly status: 'named'; readonly label: string | LocalizedText }\n | { readonly status: 'notFound' }\n | { readonly status: 'failed' }\n | { readonly status: 'unregistered' };\n\n/**\n * How the controls ask what a referenced record is called. A host fills it —\n * batching what a render asks for into one read per target entity — and the\n * controls only read it, so this package imports neither TanStack nor the\n * integration layer.\n */\nexport interface ReferenceLabelLookup {\n /** The name of the record of `entityKey` (`domain:key`) whose id is `id`. */\n label(entityKey: string, id: string): ReferenceLabelState;\n /** How to call the entity itself, when a record's name could not be read. */\n noun?(entityKey: string): EntityNounSource | undefined;\n}\n\nconst UNREGISTERED: ReferenceLabelState = { status: 'unregistered' };\n\nconst ReferenceLabelsContext = createContext<ReferenceLabelLookup>({\n label: () => UNREGISTERED,\n});\n\n/**\n * Publishes a host's reference lookup to every control that renders a\n * reference — a cell, a card, a read form, a confirm dialog. Without one, a\n * reference reads as its raw id, muted, which is what tells a developer the\n * registry is missing.\n */\nexport function ReferenceLabelsProvider({\n lookup,\n children,\n}: {\n lookup: ReferenceLabelLookup;\n children: ReactNode;\n}) {\n return (\n <ReferenceLabelsContext.Provider value={lookup}>\n {children}\n </ReferenceLabelsContext.Provider>\n );\n}\n\n/** The nearest {@link ReferenceLabelsProvider}'s lookup. */\nexport const useReferenceLabels = (): ReferenceLabelLookup =>\n useContext(ReferenceLabelsContext);\n\n/** Where one referenced record's name stands. */\nexport function useReferenceLabel(\n entityKey: string,\n id: string,\n): ReferenceLabelState {\n return useReferenceLabels().label(entityKey, id);\n}\n\n/** `catalog:product-offering` → `product-offering`: the entity's key, when it has no noun. */\nconst keyOf = (entityKey: string) =>\n entityKey.slice(entityKey.indexOf(':') + 1);\n\n/**\n * Words for a referenced record that has no name to show — its entity's noun\n * and the id's short form (\"Offering product-…\"), so the reader still has\n * something to quote. Never the whole id.\n */\nexport function useUnresolvedReference(): (\n entityKey: string,\n id: string,\n) => string {\n const t = useT();\n const noun = useEntityNoun();\n const lookup = useReferenceLabels();\n return useCallback(\n (entityKey, id) => {\n const source = lookup.noun?.(entityKey);\n return t('reference.unresolved', {\n noun: source === undefined ? keyOf(entityKey) : noun(source),\n id: shortId(id),\n });\n },\n [lookup, noun, t],\n );\n}\n\n/**\n * One referenced record as plain words — its name when read, otherwise the\n * noun and short id, or the raw id when nothing is registered to read it. For\n * the places that need text rather than an element: an accessible name, a\n * button's label.\n */\nexport function useReferenceText(entityKey: string, id: string): string {\n const state = useReferenceLabel(entityKey, id);\n const unresolved = useUnresolvedReference();\n const locale = useLocale();\n switch (state.status) {\n case 'named':\n return typeof state.label === 'string'\n ? state.label\n : (localize(state.label, locale) ?? id);\n case 'unregistered':\n return id;\n default:\n return unresolved(entityKey, id);\n }\n}\n"],"names":["localize","shortId","createContext","useCallback","useContext","useEntityNoun","useLocale","useT","UNREGISTERED","status","ReferenceLabelsContext","label","ReferenceLabelsProvider","lookup","children","Provider","value","useReferenceLabels","useReferenceLabel","entityKey","id","keyOf","slice","indexOf","useUnresolvedReference","t","noun","source","undefined","useReferenceText","state","unresolved","locale"],"mappings":"AAAA;;AAEA,SAASA,QAAQ,EAAsBC,OAAO,QAAQ,gBAAgB;AACtE,SAASC,aAAa,EAAkBC,WAAW,EAAEC,UAAU,QAAQ,QAAQ;AAE/E,SAEEC,aAAa,EACbC,SAAS,EACTC,IAAI,QACC,sBAAsB;AAiC7B,MAAMC,eAAoC;IAAEC,QAAQ;AAAe;AAEnE,MAAMC,uCAAyBR,cAAoC;IACjES,OAAO,IAAMH;AACf;AAEA;;;;;CAKC,GACD,OAAO,SAASI,wBAAwB,EACtCC,MAAM,EACNC,QAAQ,EAIT;IACC,qBACE,KAACJ,uBAAuBK,QAAQ;QAACC,OAAOH;kBACrCC;;AAGP;AAEA,0DAA0D,GAC1D,OAAO,MAAMG,qBAAqB,IAChCb,WAAWM,wBAAwB;AAErC,+CAA+C,GAC/C,OAAO,SAASQ,kBACdC,SAAiB,EACjBC,EAAU;IAEV,OAAOH,qBAAqBN,KAAK,CAACQ,WAAWC;AAC/C;AAEA,4FAA4F,GAC5F,MAAMC,QAAQ,CAACF,YACbA,UAAUG,KAAK,CAACH,UAAUI,OAAO,CAAC,OAAO;AAE3C;;;;CAIC,GACD,OAAO,SAASC;IAId,MAAMC,IAAIlB;IACV,MAAMmB,OAAOrB;IACb,MAAMQ,SAASI;IACf,OAAOd,YACL,CAACgB,WAAWC;QACV,MAAMO,SAASd,OAAOa,IAAI,oBAAXb,OAAOa,IAAI,MAAXb,QAAcM;QAC7B,OAAOM,EAAE,wBAAwB;YAC/BC,MAAMC,WAAWC,YAAYP,MAAMF,aAAaO,KAAKC;YACrDP,IAAInB,QAAQmB;QACd;IACF,GACA;QAACP;QAAQa;QAAMD;KAAE;AAErB;AAEA;;;;;CAKC,GACD,OAAO,SAASI,iBAAiBV,SAAiB,EAAEC,EAAU;IAC5D,MAAMU,QAAQZ,kBAAkBC,WAAWC;IAC3C,MAAMW,aAAaP;IACnB,MAAMQ,SAAS1B;IACf,OAAQwB,MAAMrB,MAAM;QAClB,KAAK;gBAGET;YAFL,OAAO,OAAO8B,MAAMnB,KAAK,KAAK,WAC1BmB,MAAMnB,KAAK,IACVX,YAAAA,SAAS8B,MAAMnB,KAAK,EAAEqB,mBAAtBhC,YAAiCoB;QACxC,KAAK;YACH,OAAOA;QACT;YACE,OAAOW,WAAWZ,WAAWC;IACjC;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entifix/react-controls",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.11",
|
|
4
4
|
"description": "Entity-agnostic React UI — table, form, filters, wizard, command palette — rendered from entity metadata, plus layout primitives.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@headlessui/react": "^2.2.10",
|
|
20
20
|
"class-variance-authority": "^0.7.1",
|
|
21
21
|
"idb": "^8.0.4",
|
|
22
|
-
"@entifix/core": "0.23.
|
|
22
|
+
"@entifix/core": "0.23.11"
|
|
23
23
|
},
|
|
24
24
|
"exports": {
|
|
25
25
|
"./package.json": "./package.json",
|
|
@@ -45,18 +45,18 @@
|
|
|
45
45
|
"LICENSE"
|
|
46
46
|
],
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@storybook/addon-a11y": "^10.6.
|
|
49
|
-
"@storybook/addon-docs": "^10.6.
|
|
50
|
-
"@storybook/addon-themes": "^10.6.
|
|
51
|
-
"@storybook/addon-vitest": "^10.6.
|
|
52
|
-
"@storybook/react-vite": "^10.6.
|
|
48
|
+
"@storybook/addon-a11y": "^10.6.8",
|
|
49
|
+
"@storybook/addon-docs": "^10.6.8",
|
|
50
|
+
"@storybook/addon-themes": "^10.6.8",
|
|
51
|
+
"@storybook/addon-vitest": "^10.6.8",
|
|
52
|
+
"@storybook/react-vite": "^10.6.8",
|
|
53
53
|
"effect": "4.0.7",
|
|
54
54
|
"i18next": "27.1.1",
|
|
55
55
|
"react": "19.3.1",
|
|
56
56
|
"react-i18next": "18.0.1",
|
|
57
|
-
"storybook": "^10.6.
|
|
58
|
-
"@entifix/i18n": "0.23.
|
|
59
|
-
"@entifix/style": "0.23.
|
|
57
|
+
"storybook": "^10.6.8",
|
|
58
|
+
"@entifix/i18n": "0.23.11",
|
|
59
|
+
"@entifix/style": "0.23.11"
|
|
60
60
|
},
|
|
61
61
|
"nx": {
|
|
62
62
|
"tags": [
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"i18next": ">=26 <28",
|
|
112
112
|
"react": ">=19 <20",
|
|
113
113
|
"react-i18next": ">=17 <19",
|
|
114
|
-
"@entifix/i18n": "0.23.
|
|
114
|
+
"@entifix/i18n": "0.23.11"
|
|
115
115
|
},
|
|
116
116
|
"peerDependenciesMeta": {
|
|
117
117
|
"@entifix/i18n": {
|