@cosmicdrift/kumiko-renderer 0.415.0 → 0.417.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.d.ts +2 -5
- package/dist/app/action-form-body.js +50 -22
- package/dist/app/action-form-support.d.ts +4 -1
- package/dist/app/action-form-support.js +8 -4
- package/dist/app/client-actions.js +6 -4
- package/dist/app/config-edit-body.js +83 -82
- package/dist/app/entity-list-screen.js +1 -1
- package/dist/app/extension-sections.d.ts +2 -0
- package/dist/app/header-actions-bar.d.ts +3 -1
- package/dist/app/header-actions-bar.js +12 -4
- package/dist/app/locked-screen-header.d.ts +2 -0
- package/dist/app/locked-screen-header.js +8 -1
- package/dist/app/projection-detail-body.js +29 -8
- package/dist/app/projection-detail-guidance.d.ts +2 -1
- package/dist/app/projection-detail-guidance.js +45 -30
- package/dist/app/projection-detail-header-model.d.ts +1 -1
- package/dist/app/projection-detail-header-model.js +14 -6
- package/dist/app/projection-detail-header-region.js +25 -9
- package/dist/app/projection-detail-header.d.ts +2 -0
- package/dist/app/projection-detail-header.js +31 -4
- package/dist/app/projection-detail-navigation.d.ts +4 -0
- package/dist/app/projection-detail-navigation.js +5 -1
- package/dist/app/projection-list-shim.js +1 -0
- package/dist/app/row-actions.d.ts +4 -0
- package/dist/app/row-actions.js +19 -3
- package/dist/app/screen-shared.d.ts +1 -0
- package/dist/app/screen-shared.js +23 -3
- package/dist/app/use-projection-detail-actions.d.ts +16 -1
- package/dist/app/use-projection-detail-actions.js +23 -3
- package/dist/app/use-projection-detail-data.d.ts +2 -0
- package/dist/app/use-projection-detail-data.js +53 -10
- package/dist/app/use-projection-list-data.js +1 -1
- package/dist/card-options.d.ts +2 -0
- package/dist/components/ai-assist-payload.d.ts +2 -0
- package/dist/components/ai-assist-payload.js +8 -0
- package/dist/components/choice-chip-class.d.ts +1 -0
- package/dist/components/choice-chip-class.js +9 -0
- package/dist/components/edit-mounts.d.ts +3 -2
- package/dist/components/edit-mounts.js +2 -2
- package/dist/components/grid-cell-for-field.js +1 -1
- package/dist/components/multi-select-chips.d.ts +10 -0
- package/dist/components/multi-select-chips.js +19 -0
- package/dist/components/narrow-description.d.ts +3 -0
- package/dist/components/narrow-description.js +12 -0
- package/dist/components/related-list-section.d.ts +5 -3
- package/dist/components/related-list-section.js +52 -35
- package/dist/components/related-photo-grid.d.ts +11 -0
- package/dist/components/related-photo-grid.js +54 -0
- package/dist/components/render-edit-action-button.d.ts +2 -2
- package/dist/components/render-edit-field-grid.d.ts +12 -3
- package/dist/components/render-edit-field-grid.js +60 -18
- package/dist/components/render-edit-fields-section.js +45 -11
- package/dist/components/render-edit-header-actions.d.ts +2 -1
- package/dist/components/render-edit-header-actions.js +18 -1
- package/dist/components/render-edit-layout.js +5 -3
- package/dist/components/render-edit-logic.js +1 -0
- package/dist/components/render-edit-section-kinds.js +59 -10
- package/dist/components/render-edit-titles.js +1 -1
- package/dist/components/render-edit-types.d.ts +22 -1
- package/dist/components/render-field-ai-assist.d.ts +13 -0
- package/dist/components/render-field-ai-assist.js +90 -0
- package/dist/components/render-field-choice-inputs.js +4 -0
- package/dist/components/render-field-control.d.ts +1 -1
- package/dist/components/render-field-control.js +19 -9
- package/dist/components/render-field-value-chips.d.ts +9 -0
- package/dist/components/render-field-value-chips.js +47 -0
- package/dist/components/render-field-write-only.js +12 -4
- package/dist/components/render-list-hint-columns.d.ts +2 -0
- package/dist/components/render-list-hint-columns.js +43 -5
- package/dist/components/render-list-reference-columns.js +2 -4
- package/dist/components/render-list-row-tone.d.ts +2 -0
- package/dist/components/render-list-row-tone.js +6 -0
- package/dist/components/render-list-table-props.d.ts +13 -2
- package/dist/components/render-list-table-props.js +9 -3
- package/dist/components/render-list-types.d.ts +4 -0
- package/dist/components/render-list.js +12 -4
- package/dist/components/use-render-edit-sections.js +5 -1
- package/dist/components/use-render-list-columns.js +3 -3
- package/dist/components/write-form-registry.d.ts +13 -0
- package/dist/components/write-form-registry.js +6 -0
- package/dist/components/write-form-section.d.ts +5 -1
- package/dist/components/write-form-section.js +55 -16
- package/dist/headless/form/form-controller.d.ts +1 -0
- package/dist/headless/form/form-controller.js +1 -1
- package/dist/headless/format/index.d.ts +1 -0
- package/dist/headless/format/index.js +21 -0
- package/dist/headless/format/phone.d.ts +1 -0
- package/dist/headless/format/phone.js +8 -0
- package/dist/headless/format/relative-time.d.ts +15 -0
- package/dist/headless/format/relative-time.js +63 -0
- package/dist/headless/format/safe-locale.d.ts +1 -0
- package/dist/headless/format/safe-locale.js +13 -0
- package/dist/headless/index.d.ts +2 -2
- package/dist/headless/index.js +2 -2
- package/dist/headless/view-model/edit.d.ts +3 -2
- package/dist/headless/view-model/edit.js +162 -36
- package/dist/headless/view-model/field-text.d.ts +9 -0
- package/dist/headless/view-model/field-text.js +19 -0
- package/dist/headless/view-model/index.d.ts +1 -0
- package/dist/headless/view-model/index.js +1 -0
- package/dist/headless/view-model/list.js +6 -0
- package/dist/headless/view-model/types.d.ts +76 -5
- package/dist/hooks/use-list-table.js +11 -6
- package/dist/i18n-defaults.js +9 -2
- package/dist/index.d.ts +1 -1
- package/dist/primitives-record-guidance.d.ts +32 -1
- package/dist/primitives-share-types.d.ts +82 -0
- package/dist/primitives-share-types.js +1 -0
- package/dist/primitives.d.ts +44 -86
- package/dist/web/app/bold-markup.d.ts +3 -0
- package/dist/web/app/bold-markup.js +14 -0
- package/dist/web/app/dashboard-body.js +8 -3
- package/dist/web/app/dashboard-list-panel.js +8 -4
- package/dist/web/app/dashboard-panel-columns.d.ts +9 -0
- package/dist/web/app/dashboard-panel-columns.js +14 -0
- package/dist/web/app/dashboard-panels.js +31 -3
- package/dist/web/app/dashboard-shared.d.ts +3 -1
- package/dist/web/app/dashboard-shared.js +4 -4
- package/dist/web/app/dashboard-stat-group-panel.d.ts +1 -1
- package/dist/web/app/dashboard-stat-group-panel.js +24 -3
- package/dist/web/app/dashboard-text-panel.d.ts +1 -0
- package/dist/web/app/dashboard-text-panel.js +18 -11
- package/dist/web/app/relative-time.d.ts +0 -5
- package/dist/web/app/relative-time.js +11 -21
- package/dist/web/components/config-cascade.d.ts +2 -1
- package/dist/web/components/config-cascade.js +16 -4
- package/dist/web/drawn-icons.js +2 -1
- package/dist/web/layout/header-action-pinned.d.ts +4 -2
- package/dist/web/layout/header-action-pinned.js +13 -4
- package/dist/web/layout/header-overflow-menu.d.ts +2 -0
- package/dist/web/layout/header-overflow-menu.js +2 -0
- package/dist/web/layout/notification-bell.js +12 -3
- package/dist/web/layout/page-header-slot.d.ts +2 -0
- package/dist/web/layout/page-header-slot.js +4 -0
- package/dist/web/layout/screen-focus.js +4 -1
- package/dist/web/layout/shell-header.js +13 -5
- package/dist/web/primitives/banner.js +24 -8
- package/dist/web/primitives/card.js +5 -3
- package/dist/web/primitives/combobox.js +2 -2
- package/dist/web/primitives/data-table/actions-column.js +1 -1
- package/dist/web/primitives/data-table/card-body.d.ts +1 -1
- package/dist/web/primitives/data-table/card-body.js +37 -14
- package/dist/web/primitives/data-table/card-frame.d.ts +2 -0
- package/dist/web/primitives/data-table/card-frame.js +3 -0
- package/dist/web/primitives/data-table/card-row.js +34 -10
- package/dist/web/primitives/data-table/card-sort-select.js +1 -1
- package/dist/web/primitives/data-table/card-view.js +1 -1
- package/dist/web/primitives/data-table/data-cell-props.d.ts +4 -1
- package/dist/web/primitives/data-table/data-cell-props.js +3 -0
- package/dist/web/primitives/data-table/density.d.ts +3 -1
- package/dist/web/primitives/data-table/density.js +11 -4
- package/dist/web/primitives/data-table/row-click-guard.d.ts +2 -0
- package/dist/web/primitives/data-table/row-click-guard.js +19 -0
- package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
- package/dist/web/primitives/data-table/row-render-parts.js +3 -5
- package/dist/web/primitives/data-table/sort-options-select.js +2 -2
- package/dist/web/primitives/data-table/sortable-header.js +4 -4
- package/dist/web/primitives/data-table/table-body.js +3 -1
- package/dist/web/primitives/data-table/table-chrome.js +1 -3
- package/dist/web/primitives/data-table/table-content.js +6 -6
- package/dist/web/primitives/data-table/table-data-cell.js +31 -17
- package/dist/web/primitives/data-table/table-header-row.js +1 -1
- package/dist/web/primitives/data-table/table-view.js +1 -1
- package/dist/web/primitives/data-table/toolbar.js +6 -7
- package/dist/web/primitives/data-table/use-data-table-state.d.ts +6 -1
- package/dist/web/primitives/data-table/use-data-table-state.js +12 -2
- package/dist/web/primitives/data-table-cell.d.ts +17 -3
- package/dist/web/primitives/data-table-cell.js +130 -36
- package/dist/web/primitives/data-table.js +1 -1
- package/dist/web/primitives/default-form.d.ts +1 -1
- package/dist/web/primitives/default-form.js +15 -11
- package/dist/web/primitives/drawer.js +2 -3
- package/dist/web/primitives/facet-filter.d.ts +1 -1
- package/dist/web/primitives/facet-filter.js +2 -5
- package/dist/web/primitives/facet-search-filter.js +1 -1
- package/dist/web/primitives/facet-trigger-label.d.ts +1 -4
- package/dist/web/primitives/facet-trigger-label.js +4 -7
- package/dist/web/primitives/field.js +15 -8
- package/dist/web/primitives/form-footer-parts.js +6 -3
- package/dist/web/primitives/form.js +6 -8
- package/dist/web/primitives/index.js +4 -0
- package/dist/web/primitives/inline-suffix.d.ts +2 -0
- package/dist/web/primitives/inline-suffix.js +5 -0
- package/dist/web/primitives/input-choice-kinds.js +12 -2
- package/dist/web/primitives/input-number-kinds.js +2 -2
- package/dist/web/primitives/input-text-kinds.js +1 -1
- package/dist/web/primitives/layout-elements.d.ts +4 -4
- package/dist/web/primitives/layout-elements.js +50 -13
- package/dist/web/primitives/layout.d.ts +1 -1
- package/dist/web/primitives/layout.js +1 -1
- package/dist/web/primitives/locale-number.d.ts +0 -1
- package/dist/web/primitives/locale-number.js +1 -13
- package/dist/web/primitives/money-input.js +10 -8
- package/dist/web/primitives/narrow-pinned-footer.js +7 -3
- package/dist/web/primitives/number-input.d.ts +2 -1
- package/dist/web/primitives/number-input.js +11 -5
- package/dist/web/primitives/page-header.d.ts +1 -1
- package/dist/web/primitives/page-header.js +8 -1
- package/dist/web/primitives/pager.js +12 -21
- package/dist/web/primitives/photo-grid.d.ts +3 -0
- package/dist/web/primitives/photo-grid.js +6 -0
- package/dist/web/primitives/record-steps.d.ts +1 -1
- package/dist/web/primitives/record-steps.js +7 -16
- package/dist/web/primitives/record-summary.d.ts +1 -1
- package/dist/web/primitives/record-summary.js +8 -3
- package/dist/web/primitives/row-actions.js +38 -24
- package/dist/web/primitives/step-list.d.ts +3 -0
- package/dist/web/primitives/step-list.js +11 -0
- package/dist/web/primitives/use-container-narrow.d.ts +12 -0
- package/dist/web/primitives/use-container-narrow.js +42 -0
- package/dist/web/ui/input.js +1 -1
- package/dist/web/ui/textarea.js +1 -1
- package/dist/web/widgets/dashboard-list-cards.js +6 -3
- package/dist/web/widgets/dashboard-list.d.ts +6 -1
- package/dist/web/widgets/dashboard-list.js +12 -7
- package/dist/web/widgets/drawer-panel-class.js +1 -1
- package/dist/web/widgets/progress-list.js +1 -1
- package/dist/web/widgets/stat-box-cell.js +1 -1
- package/package.json +5 -5
- package/src/changes.json +105 -0
- package/src/web/styles.css +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ export { InsideDrawerProvider, useInsideDrawer } from "./inside-drawer.ts";
|
|
|
94
94
|
export { hasUnsavedInput, registerUnsavedInputSource, requestLeave, setLeaveConfirmer, useUnsavedInputSource, } from "./leave-guard.ts";
|
|
95
95
|
export { LeaveGuardDialog } from "./leave-guard-dialog.tsx";
|
|
96
96
|
export { PageHeaderCompactProvider, PageHeaderSlotAvailableProvider, usePageHeaderCompact, usePageHeaderSlotAvailable, } from "./page-header-slot.ts";
|
|
97
|
-
export type { ActionMenuItemSpec, ActionOverflowMenuProps, AppPrimitives, BannerProps, BulkRowOutcome, ButtonProps, CardOptions, CardProps, CardSlots, CopyButtonProps, CorePrimitives, DataTableBulk, DataTableBulkAction, DataTableDateRangeFacet, DataTableFacet, DataTableFacetChip, DataTableProps, DataTableRowAction, DataTableRowActionMode, DataTableSort, DataTableSortDir, DialogProps, DrawerProps, EmbeddedListCellType, EmbeddedListColumn, EmbeddedListInputProps, EmbeddedListTotal, FieldCellWidth, FieldProps, FileValueListProps, FillContainerProps, FooterActionMarker, FooterActionRole, FormProps, FormSectionNavItem, FormWidth, GridCellProps, GridProps, HeadingProps, InputEndAction, InputFillAction, InputProps, JsonViewProps, LightboxImage, LightboxProps, LinkProps, MetricBandProps, MetricProps, ModalProps, PageHeaderProps, PickedFile, PrimitivesProviderProps, PrimitivesRegistry, ProgressProps, ProgressTone, PromoPanelAction, PromoPanelProps, RecordBreadcrumbProps, RecordStepsProps, RecordSummaryProps, RuntimeRenderer, SecretRevealProps, SecretRevealValue, SectionProps, ShareButtonProps, StatusBadgeProps, StatusTone, StepBarProps, StickyActionBarProps, StickyPrimaryActionMarker, TabsProps, TextProps, TrailingInputAction, WizardStepGroupProps, } from "./primitives.tsx";
|
|
97
|
+
export type { ActionMenuItemSpec, ActionOverflowMenuProps, AppPrimitives, BannerProps, BulkRowOutcome, ButtonProps, CardOptions, CardProps, CardSlots, CopyButtonProps, CorePrimitives, DataTableBulk, DataTableBulkAction, DataTableDateRangeFacet, DataTableFacet, DataTableFacetChip, DataTableProps, DataTableRowAction, DataTableRowActionMode, DataTableSort, DataTableSortDir, DialogProps, DrawerProps, EmbeddedListCellType, EmbeddedListColumn, EmbeddedListInputProps, EmbeddedListTotal, FieldCellWidth, FieldProps, FileValueListProps, FillContainerProps, FooterActionMarker, FooterActionRole, FormProps, FormSectionNavItem, FormWidth, GridCellProps, GridProps, HeadingProps, InputEndAction, InputFillAction, InputProps, JsonViewProps, LightboxImage, LightboxProps, LinkProps, MetricBandProps, MetricProps, ModalProps, PageHeaderProps, PhotoGridProps, PickedFile, PrimitivesProviderProps, PrimitivesRegistry, ProgressProps, ProgressTone, PromoPanelAction, PromoPanelProps, RecordBreadcrumbProps, RecordStepsProps, RecordSummaryProps, RuntimeRenderer, SecretRevealProps, SecretRevealValue, SectionProps, ShareButtonProps, StatusBadgeProps, StatusTone, StepBarProps, StepListProps, StickyActionBarProps, StickyPrimaryActionMarker, TabsProps, TextProps, TrailingInputAction, WizardStepGroupProps, } from "./primitives.tsx";
|
|
98
98
|
export { FOOTER_ACTION_ROLE_PROP, NARROW_LABEL_PROP, PrimitivesProvider, STICKY_PRIMARY_ACTION_PROP, shouldRenderActionsIconOnly, statusToneForOptionTone, statusToneForValue, useOptionalPrimitives, usePrimitives, } from "./primitives.tsx";
|
|
99
99
|
export type { SessionEndedSignal, SessionEndedSignalProviderProps, } from "./session/session-ended.tsx";
|
|
100
100
|
export { createSessionEndedSignal, isSessionEndedError, SESSION_ENDED_ERROR_CODES, SessionEndedSignalProvider, useSessionEndedSignal, withSessionEndedDetection, } from "./session/session-ended.tsx";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
1
|
+
import type { NavIconKey, SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import type { CellLink } from "./headless/index.ts";
|
|
4
4
|
/** Path above a record header; an item with a `link` is a link, the last item without one names the current record. */
|
|
@@ -16,6 +16,35 @@ export type RecordSummaryProps = {
|
|
|
16
16
|
/** Shown instead of `text` below the sm breakpoint. */
|
|
17
17
|
readonly narrowText?: string;
|
|
18
18
|
readonly tone?: SelectOptionTone;
|
|
19
|
+
/** Leads the sentence; the sentence then has no bordered box. */
|
|
20
|
+
readonly icon?: NavIconKey;
|
|
21
|
+
readonly testId?: string;
|
|
22
|
+
};
|
|
23
|
+
/** Grid of image tiles; each tile shows a stored file and its own action buttons underneath. */
|
|
24
|
+
export type PhotoGridProps = {
|
|
25
|
+
readonly tiles: readonly {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
/** FileRef id of the image; a tile without one shows a placeholder. */
|
|
28
|
+
readonly imageId?: string;
|
|
29
|
+
readonly caption?: string;
|
|
30
|
+
/** Short text shown as a warn badge on the image's top left. */
|
|
31
|
+
readonly badge?: string;
|
|
32
|
+
/** Moves the tile to the front on a phone (below `sm`); the DOM order stays. */
|
|
33
|
+
readonly leadsOnNarrow?: true;
|
|
34
|
+
readonly actions?: ReactNode;
|
|
35
|
+
}[];
|
|
36
|
+
readonly testId?: string;
|
|
37
|
+
};
|
|
38
|
+
/** Vertical numbered steps joined by a line; each step has a title, an optional status pill and
|
|
39
|
+
* a description line. */
|
|
40
|
+
export type StepListProps = {
|
|
41
|
+
readonly items: readonly {
|
|
42
|
+
readonly id: string;
|
|
43
|
+
readonly title: string;
|
|
44
|
+
readonly status?: string;
|
|
45
|
+
readonly statusTone?: SelectOptionTone;
|
|
46
|
+
readonly description?: string;
|
|
47
|
+
}[];
|
|
19
48
|
readonly testId?: string;
|
|
20
49
|
};
|
|
21
50
|
/** "Next steps" panel; an item's `reason` sits behind a toggle labelled `reasonLabel`. */
|
|
@@ -30,6 +59,8 @@ export type RecordStepsProps = {
|
|
|
30
59
|
/** Toggle label for the hidden steps; receives their count. */
|
|
31
60
|
readonly moreLabel?: (hiddenCount: number) => string;
|
|
32
61
|
readonly lessLabel?: string;
|
|
62
|
+
/** Label before the further actions of each item. */
|
|
63
|
+
readonly moreActionsLabel?: string;
|
|
33
64
|
readonly items: readonly {
|
|
34
65
|
readonly id: string;
|
|
35
66
|
readonly title: string;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** One revealed value on a `secretMint` screen's confirm phase. */
|
|
3
|
+
export type SecretRevealValue = {
|
|
4
|
+
readonly label: string;
|
|
5
|
+
readonly value: string;
|
|
6
|
+
readonly copyable: boolean;
|
|
7
|
+
readonly multiline: boolean;
|
|
8
|
+
/** Render `value` as a scannable QR code instead of monospaced text — for
|
|
9
|
+
* an otpauth://-style enrollment URI. Platforms without a QR-capable
|
|
10
|
+
* SecretReveal primitive fall back to the monospaced display. */
|
|
11
|
+
readonly qr?: boolean;
|
|
12
|
+
};
|
|
13
|
+
/** One-time secret reveal — mint-form confirm phase. Renders each value
|
|
14
|
+
* monospaced (multiline splits it one line per entry, for recovery codes),
|
|
15
|
+
* with a per-value copy control when `copyable`. */
|
|
16
|
+
export type SecretRevealProps = {
|
|
17
|
+
readonly values: readonly SecretRevealValue[];
|
|
18
|
+
readonly copyLabel: string;
|
|
19
|
+
readonly copiedLabel: string;
|
|
20
|
+
readonly testId?: string;
|
|
21
|
+
};
|
|
22
|
+
/** Thumb-reach action row for custom screens: pinned to the bottom edge on
|
|
23
|
+
* narrow viewports (above the device's safe-area inset), inline otherwise.
|
|
24
|
+
* `children` are the forward actions and share the remaining width; `back`
|
|
25
|
+
* renders an icon-only back control in front of them. */
|
|
26
|
+
export type StickyActionBarProps = {
|
|
27
|
+
readonly children: ReactNode;
|
|
28
|
+
readonly back?: {
|
|
29
|
+
readonly onBack: () => void;
|
|
30
|
+
readonly label: string;
|
|
31
|
+
};
|
|
32
|
+
readonly testId?: string;
|
|
33
|
+
};
|
|
34
|
+
/** Copies `text` to the clipboard; the label flips to `copiedLabel` once
|
|
35
|
+
* the platform confirmed the write. */
|
|
36
|
+
export type CopyButtonProps = {
|
|
37
|
+
readonly text: string;
|
|
38
|
+
readonly label: string;
|
|
39
|
+
readonly copiedLabel: string;
|
|
40
|
+
readonly variant?: "primary" | "secondary";
|
|
41
|
+
/** Layout extras, merged via cn(). */
|
|
42
|
+
readonly className?: string;
|
|
43
|
+
readonly testId?: string;
|
|
44
|
+
};
|
|
45
|
+
/** Hands `text` to another app. "whatsapp" opens a WhatsApp chat prefilled
|
|
46
|
+
* with the text (to `phone` when given, otherwise the contact picker);
|
|
47
|
+
* "system" opens the platform share sheet and renders nothing where the
|
|
48
|
+
* platform has none. */
|
|
49
|
+
export type ShareButtonProps = {
|
|
50
|
+
readonly text: string;
|
|
51
|
+
readonly label: string;
|
|
52
|
+
readonly variant?: "primary" | "secondary";
|
|
53
|
+
/** Layout extras, merged via cn(). */
|
|
54
|
+
readonly className?: string;
|
|
55
|
+
readonly testId?: string;
|
|
56
|
+
} & ({
|
|
57
|
+
readonly target: "whatsapp";
|
|
58
|
+
readonly phone?: string;
|
|
59
|
+
} | {
|
|
60
|
+
readonly target: "system";
|
|
61
|
+
readonly title?: string;
|
|
62
|
+
readonly url?: string;
|
|
63
|
+
});
|
|
64
|
+
export type PromoPanelAction = {
|
|
65
|
+
readonly label: string;
|
|
66
|
+
readonly href: string;
|
|
67
|
+
readonly testId?: string;
|
|
68
|
+
} | {
|
|
69
|
+
readonly label: string;
|
|
70
|
+
readonly onClick: () => void;
|
|
71
|
+
readonly testId?: string;
|
|
72
|
+
};
|
|
73
|
+
/** Offer surface for upsells (e.g. "create an account"): its own tinted
|
|
74
|
+
* panel with eyebrow, headline, benefit content and one call to action, so
|
|
75
|
+
* an offer never reads like an info or error banner. */
|
|
76
|
+
export type PromoPanelProps = {
|
|
77
|
+
readonly title: string;
|
|
78
|
+
readonly eyebrow?: string;
|
|
79
|
+
readonly children?: ReactNode;
|
|
80
|
+
readonly action?: PromoPanelAction;
|
|
81
|
+
readonly testId?: string;
|
|
82
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/primitives.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { DataTableTableBlock } from "./data-table-view-types.ts";
|
|
|
8
8
|
import type { EmbeddedListInputProps } from "./embedded-list-types.ts";
|
|
9
9
|
import type { FieldIssue, ListColumnViewModel, ListRowViewModel, RuntimeRenderer } from "./headless/index.ts";
|
|
10
10
|
import type { MetricBandProps, MetricProps } from "./metric-types.ts";
|
|
11
|
-
import type { RecordBreadcrumbProps, RecordStepsProps, RecordSummaryProps } from "./primitives-record-guidance.ts";
|
|
11
|
+
import type { PhotoGridProps, RecordBreadcrumbProps, RecordStepsProps, RecordSummaryProps, StepListProps } from "./primitives-record-guidance.ts";
|
|
12
12
|
import type { StatusBadgeOptionTone, StatusTone } from "./status-tone.ts";
|
|
13
13
|
export type { EmbeddedListCellType, EmbeddedListColumn, EmbeddedListInputProps, EmbeddedListTotal, } from "./embedded-list-types.ts";
|
|
14
14
|
export type { RuntimeRenderer };
|
|
@@ -23,7 +23,8 @@ export type DataAttributes = Readonly<Record<`data-${string}`, string>>;
|
|
|
23
23
|
* split can't inspect (see `ScreenSlots.footerPrimary`). */
|
|
24
24
|
export declare const STICKY_PRIMARY_ACTION_PROP: "kumikoStickyPrimaryAction";
|
|
25
25
|
export type StickyPrimaryActionMarker = Partial<Record<typeof STICKY_PRIMARY_ACTION_PROP, boolean>>;
|
|
26
|
-
|
|
26
|
+
/** "inline" keeps a non-primary action as a visible button in the phone footer instead of the "…" menu. */
|
|
27
|
+
export type FooterActionRole = "back" | "primary" | "inline";
|
|
27
28
|
/** Tells the pinned phone footer which node is Back and which is the primary
|
|
28
29
|
* action, for buttons that are not `type="submit"` (e.g. the wizard Back). */
|
|
29
30
|
export declare const FOOTER_ACTION_ROLE_PROP: "kumikoFooterActionRole";
|
|
@@ -117,8 +118,9 @@ export type BannerProps = {
|
|
|
117
118
|
* notice (e.g. secretMint's "this is shown only once"), "primary" for a call-to-action
|
|
118
119
|
* notice (neutral background, accent in the primary color; pair it with `title` and
|
|
119
120
|
* `actions`), "hint" for a quiet aside on a muted background (e.g. per-entry results of a
|
|
120
|
-
* submit, with an "Open" link in `actions`), "ok" for a completed state (e.g. "Done")
|
|
121
|
-
|
|
121
|
+
* submit, with an "Open" link in `actions`), "ok" for a completed state (e.g. "Done"),
|
|
122
|
+
* "assist" for an AI hint: soft primary surface, primary text, no border. */
|
|
123
|
+
readonly variant?: "error" | "info" | "loading" | "warning" | "primary" | "hint" | "ok" | "assist";
|
|
122
124
|
/** Title and text run on one line (text right behind the bold title); the text is dropped below sm, so a phone shows title and actions only. */
|
|
123
125
|
readonly inline?: boolean;
|
|
124
126
|
/** "compact" is one line: the title reads inline before the text. */
|
|
@@ -696,12 +698,14 @@ export declare function shouldRenderActionsIconOnly(actions: readonly {
|
|
|
696
698
|
export type { BulkRowOutcome, DataTableBulk, DataTableBulkAction, } from "./data-table-bulk-types.ts";
|
|
697
699
|
export type { DataTableDateRangeFacet, DataTableFacet, DataTableFacetChip, } from "./data-table-facet-types.ts";
|
|
698
700
|
export type { MetricBandProps, MetricProps } from "./metric-types.ts";
|
|
699
|
-
export type { RecordBreadcrumbProps, RecordStepsProps, RecordSummaryProps, } from "./primitives-record-guidance.ts";
|
|
701
|
+
export type { PhotoGridProps, RecordBreadcrumbProps, RecordStepsProps, RecordSummaryProps, StepListProps, } from "./primitives-record-guidance.ts";
|
|
700
702
|
export type DataTableProps = {
|
|
701
703
|
readonly columns: readonly ListColumnViewModel[];
|
|
702
704
|
readonly rows: readonly ListRowViewModel[];
|
|
703
705
|
/** Tints a row. Renderers without row tinting ignore it. */
|
|
704
706
|
readonly rowTone?: (row: ListRowViewModel) => SelectOptionTone | undefined;
|
|
707
|
+
/** Draws the whole row in the muted text colour. */
|
|
708
|
+
readonly rowMuted?: (row: ListRowViewModel) => boolean;
|
|
705
709
|
readonly onRowClick?: (row: ListRowViewModel) => void;
|
|
706
710
|
/** Current sorting, or null when unsorted. If columns contain a
|
|
707
711
|
* `sortable: true` field and `onSortChange` is set, the renderer makes
|
|
@@ -821,6 +825,11 @@ export type DataTableProps = {
|
|
|
821
825
|
* Default false: unchanged document-flow table that grows with its
|
|
822
826
|
* content, pager below the last row. */
|
|
823
827
|
readonly scrollBody?: boolean;
|
|
828
|
+
/** Drops the "n entries" footer of a `scrollBody` table (a pager stays). */
|
|
829
|
+
readonly hideCountFooter?: boolean;
|
|
830
|
+
/** Phone cards as a plain feed: no sort line, the above-title meta joined with commas, the last meta line in
|
|
831
|
+
* the text colour. Default false. */
|
|
832
|
+
readonly plainPhoneCards?: boolean;
|
|
824
833
|
/** Uses the shared screen padding (wider bottom inset) instead of the
|
|
825
834
|
* table's symmetric embedded inset — for a table that IS the screen body
|
|
826
835
|
* (entityList/projectionList), so a list screen ends at the same footer
|
|
@@ -918,6 +927,8 @@ export type FormProps = {
|
|
|
918
927
|
readonly title: string;
|
|
919
928
|
readonly subtitle?: string;
|
|
920
929
|
};
|
|
930
|
+
/** Rendered above everything else in the form body (above `summary`), e.g. the submit error. */
|
|
931
|
+
readonly topBanner?: ReactNode;
|
|
921
932
|
/** Titled sections for the "on this page" navigation next to a
|
|
922
933
|
* `screenForm`. The web impl shows it only with three or more entries. */
|
|
923
934
|
readonly sectionNav?: readonly FormSectionNavItem[];
|
|
@@ -953,6 +964,14 @@ export type SectionProps = {
|
|
|
953
964
|
* deletion, restrict processing) — border color only, no content change.
|
|
954
965
|
* Default "default" (normal card border). */
|
|
955
966
|
readonly variant?: "default" | "destructive";
|
|
967
|
+
/** "label": the title is a small uppercase muted label and the section has no separator line above it. Default "heading". */
|
|
968
|
+
readonly titleStyle?: "heading" | "label";
|
|
969
|
+
/** Small muted note under the section content on `sm` and up, above it on a phone. `textNarrow` is the phone wording; without it the first sentence is bold. */
|
|
970
|
+
readonly hint?: {
|
|
971
|
+
readonly text: string;
|
|
972
|
+
readonly textNarrow?: string;
|
|
973
|
+
readonly testId: string;
|
|
974
|
+
};
|
|
956
975
|
readonly testId?: string;
|
|
957
976
|
/** Rendered left of the title, `text-muted-foreground`, same optical
|
|
958
977
|
* size as the title. No effect without a `title` — an icon alone would
|
|
@@ -1006,6 +1025,10 @@ export type GridProps = {
|
|
|
1006
1025
|
* a `role="group"` so a Field whose control is a set of inputs (checkbox
|
|
1007
1026
|
* group) still gives screen readers a group name. */
|
|
1008
1027
|
readonly ariaLabelledBy?: string;
|
|
1028
|
+
/** With `columns: "auto"`: the small gap of a chip row instead of the tile gap. */
|
|
1029
|
+
readonly tight?: boolean;
|
|
1030
|
+
/** Read-only label/value facts: a true `columns`-wide grid with a tight gap, at most 2 columns below `sm`. Wins over `flow`. */
|
|
1031
|
+
readonly facts?: boolean;
|
|
1009
1032
|
};
|
|
1010
1033
|
/** Width class of a field cell inside a `flow` grid: sized by what the field holds. */
|
|
1011
1034
|
export type FieldCellWidth = "text" | "number" | "money" | "date" | "timestamp" | "select" | "full" | "toggle";
|
|
@@ -1015,6 +1038,8 @@ export type GridCellProps = {
|
|
|
1015
1038
|
readonly span?: number;
|
|
1016
1039
|
/** Only read inside a `flow` grid. */
|
|
1017
1040
|
readonly width?: FieldCellWidth;
|
|
1041
|
+
/** Hidden below the `sm` breakpoint. */
|
|
1042
|
+
readonly hideOnNarrow?: boolean;
|
|
1018
1043
|
readonly children: ReactNode;
|
|
1019
1044
|
};
|
|
1020
1045
|
/** Semantic text. Variants map to standard typography roles: `body` is
|
|
@@ -1026,6 +1051,10 @@ export type TextProps = {
|
|
|
1026
1051
|
readonly variant?: "body" | "small" | "code" | "required-mark" | "muted";
|
|
1027
1052
|
/** Pure ornament (e.g. a separator glyph): hidden from assistive tech. */
|
|
1028
1053
|
readonly decorative?: boolean;
|
|
1054
|
+
/** A value the viewer may not see: drawn muted with a lock icon before it. */
|
|
1055
|
+
readonly concealed?: boolean;
|
|
1056
|
+
/** Phone wording: `children` show from `sm` up, this text below it. */
|
|
1057
|
+
readonly narrow?: string;
|
|
1029
1058
|
readonly children: ReactNode;
|
|
1030
1059
|
readonly testId?: string;
|
|
1031
1060
|
};
|
|
@@ -1155,6 +1184,8 @@ export type ConfigCascadeViewProps = {
|
|
|
1155
1184
|
/** Display form of a level value (e.g. a select's label instead of its raw
|
|
1156
1185
|
* value). Absent = the raw value; a missing value keeps the no-value text. */
|
|
1157
1186
|
readonly renderValue?: (value: string | number | boolean) => ReactNode;
|
|
1187
|
+
/** Origin shown as an info icon with a tooltip instead of text lines; the level disclosure is dropped. */
|
|
1188
|
+
readonly compact?: boolean;
|
|
1158
1189
|
};
|
|
1159
1190
|
/** Card slots are named content regions, all optional. Adding slots is
|
|
1160
1191
|
* additive, so consumers do not need migration. `header` is an escape hatch:
|
|
@@ -1313,6 +1344,8 @@ export type PageHeaderProps = {
|
|
|
1313
1344
|
readonly title?: string;
|
|
1314
1345
|
/** Name of the loaded record; shown as an extra breadcrumb before the last one. */
|
|
1315
1346
|
readonly recordTitle?: string;
|
|
1347
|
+
/** Short record title for the phone top bar; wins over `recordTitle` there. */
|
|
1348
|
+
readonly narrowRecordTitle?: string;
|
|
1316
1349
|
readonly status?: ReactNode;
|
|
1317
1350
|
readonly actions?: ReactNode;
|
|
1318
1351
|
/** Screen renders its own h1: the shell header shows only the parent crumb, as text. */
|
|
@@ -1342,87 +1375,8 @@ export type ActionOverflowMenuProps = {
|
|
|
1342
1375
|
readonly label: string;
|
|
1343
1376
|
readonly testId?: string;
|
|
1344
1377
|
};
|
|
1345
|
-
|
|
1346
|
-
export type SecretRevealValue
|
|
1347
|
-
readonly label: string;
|
|
1348
|
-
readonly value: string;
|
|
1349
|
-
readonly copyable: boolean;
|
|
1350
|
-
readonly multiline: boolean;
|
|
1351
|
-
/** Render `value` as a scannable QR code instead of monospaced text — for
|
|
1352
|
-
* an otpauth://-style enrollment URI. Platforms without a QR-capable
|
|
1353
|
-
* SecretReveal primitive fall back to the monospaced display. */
|
|
1354
|
-
readonly qr?: boolean;
|
|
1355
|
-
};
|
|
1356
|
-
/** One-time secret reveal — mint-form confirm phase. Renders each value
|
|
1357
|
-
* monospaced (multiline splits it one line per entry, for recovery codes),
|
|
1358
|
-
* with a per-value copy control when `copyable`. */
|
|
1359
|
-
export type SecretRevealProps = {
|
|
1360
|
-
readonly values: readonly SecretRevealValue[];
|
|
1361
|
-
readonly copyLabel: string;
|
|
1362
|
-
readonly copiedLabel: string;
|
|
1363
|
-
readonly testId?: string;
|
|
1364
|
-
};
|
|
1365
|
-
/** Thumb-reach action row for custom screens: pinned to the bottom edge on
|
|
1366
|
-
* narrow viewports (above the device's safe-area inset), inline otherwise.
|
|
1367
|
-
* `children` are the forward actions and share the remaining width; `back`
|
|
1368
|
-
* renders an icon-only back control in front of them. */
|
|
1369
|
-
export type StickyActionBarProps = {
|
|
1370
|
-
readonly children: ReactNode;
|
|
1371
|
-
readonly back?: {
|
|
1372
|
-
readonly onBack: () => void;
|
|
1373
|
-
readonly label: string;
|
|
1374
|
-
};
|
|
1375
|
-
readonly testId?: string;
|
|
1376
|
-
};
|
|
1377
|
-
/** Copies `text` to the clipboard; the label flips to `copiedLabel` once
|
|
1378
|
-
* the platform confirmed the write. */
|
|
1379
|
-
export type CopyButtonProps = {
|
|
1380
|
-
readonly text: string;
|
|
1381
|
-
readonly label: string;
|
|
1382
|
-
readonly copiedLabel: string;
|
|
1383
|
-
readonly variant?: "primary" | "secondary";
|
|
1384
|
-
/** Layout extras, merged via cn(). */
|
|
1385
|
-
readonly className?: string;
|
|
1386
|
-
readonly testId?: string;
|
|
1387
|
-
};
|
|
1388
|
-
/** Hands `text` to another app. "whatsapp" opens a WhatsApp chat prefilled
|
|
1389
|
-
* with the text (to `phone` when given, otherwise the contact picker);
|
|
1390
|
-
* "system" opens the platform share sheet and renders nothing where the
|
|
1391
|
-
* platform has none. */
|
|
1392
|
-
export type ShareButtonProps = {
|
|
1393
|
-
readonly text: string;
|
|
1394
|
-
readonly label: string;
|
|
1395
|
-
readonly variant?: "primary" | "secondary";
|
|
1396
|
-
/** Layout extras, merged via cn(). */
|
|
1397
|
-
readonly className?: string;
|
|
1398
|
-
readonly testId?: string;
|
|
1399
|
-
} & ({
|
|
1400
|
-
readonly target: "whatsapp";
|
|
1401
|
-
readonly phone?: string;
|
|
1402
|
-
} | {
|
|
1403
|
-
readonly target: "system";
|
|
1404
|
-
readonly title?: string;
|
|
1405
|
-
readonly url?: string;
|
|
1406
|
-
});
|
|
1407
|
-
export type PromoPanelAction = {
|
|
1408
|
-
readonly label: string;
|
|
1409
|
-
readonly href: string;
|
|
1410
|
-
readonly testId?: string;
|
|
1411
|
-
} | {
|
|
1412
|
-
readonly label: string;
|
|
1413
|
-
readonly onClick: () => void;
|
|
1414
|
-
readonly testId?: string;
|
|
1415
|
-
};
|
|
1416
|
-
/** Offer surface for upsells (e.g. "create an account"): its own tinted
|
|
1417
|
-
* panel with eyebrow, headline, benefit content and one call to action, so
|
|
1418
|
-
* an offer never reads like an info or error banner. */
|
|
1419
|
-
export type PromoPanelProps = {
|
|
1420
|
-
readonly title: string;
|
|
1421
|
-
readonly eyebrow?: string;
|
|
1422
|
-
readonly children?: ReactNode;
|
|
1423
|
-
readonly action?: PromoPanelAction;
|
|
1424
|
-
readonly testId?: string;
|
|
1425
|
-
};
|
|
1378
|
+
import type { CopyButtonProps, PromoPanelProps, SecretRevealProps, ShareButtonProps, StickyActionBarProps } from "./primitives-share-types.ts";
|
|
1379
|
+
export type { CopyButtonProps, PromoPanelAction, PromoPanelProps, SecretRevealProps, SecretRevealValue, ShareButtonProps, StickyActionBarProps, } from "./primitives-share-types.ts";
|
|
1426
1380
|
export type CorePrimitives = {
|
|
1427
1381
|
readonly Button: ComponentType<ButtonProps>;
|
|
1428
1382
|
readonly Banner: ComponentType<BannerProps>;
|
|
@@ -1495,6 +1449,10 @@ export type CorePrimitives = {
|
|
|
1495
1449
|
readonly RecordBreadcrumb?: ComponentType<RecordBreadcrumbProps>;
|
|
1496
1450
|
/** Optional — without it the summary renders as plain text. */
|
|
1497
1451
|
readonly RecordSummary?: ComponentType<RecordSummaryProps>;
|
|
1452
|
+
/** Optional — without it a relatedList with `photoGrid` falls back to its table. */
|
|
1453
|
+
readonly PhotoGrid?: ComponentType<PhotoGridProps>;
|
|
1454
|
+
/** Optional — without it a stepList section renders nothing. */
|
|
1455
|
+
readonly StepList?: ComponentType<StepListProps>;
|
|
1498
1456
|
/** Optional — without it the steps render as a plain card. */
|
|
1499
1457
|
readonly RecordSteps?: ComponentType<RecordStepsProps>;
|
|
1500
1458
|
/** Optional: without an implementation, callers with >2 header/row
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/** Renders `**bold**` runs of a plain text as <strong>; text without markers stays a single string. */
|
|
3
|
+
export function renderBoldMarkup(text) {
|
|
4
|
+
const pieces = text.split("**");
|
|
5
|
+
// An unpaired marker is literal text, not the start of a bold run up to the end.
|
|
6
|
+
if (pieces.length === 1 || pieces.length % 2 === 0)
|
|
7
|
+
return text;
|
|
8
|
+
let offset = 0;
|
|
9
|
+
return pieces.map((piece, pieceIndex) => {
|
|
10
|
+
const key = offset;
|
|
11
|
+
offset += piece.length + 2;
|
|
12
|
+
return pieceIndex % 2 === 1 ? (_jsx("strong", { className: "font-semibold", children: piece }, key)) : (_jsx("span", { children: piece }, key));
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -6,6 +6,7 @@ import { buildScopeBadge, dashboardDescription, recordTitleText, renderActionErr
|
|
|
6
6
|
import { ListPanelBody } from "./dashboard-list-panel.js";
|
|
7
7
|
import { HiddenOnNarrow } from "./dashboard-narrow-gate.js";
|
|
8
8
|
import { panelsInNarrowOrder } from "./dashboard-narrow-order.js";
|
|
9
|
+
import { DashboardPanelGrid } from "./dashboard-panel-columns.js";
|
|
9
10
|
import { ChartPanelBody, CustomPanelBody, FeedPanelBody, ProgressListPanelBody, StatPanelBody, } from "./dashboard-panels.js";
|
|
10
11
|
import { ScreenPanelTile } from "./dashboard-screen-tiles.js";
|
|
11
12
|
import { DashboardQueryContext, HALF_PANEL, PanelLoadedContext, STAT_PANEL, THIRD_PANEL, TWO_THIRDS_PANEL, useDashboardFormats, WIDE_PANEL, } from "./dashboard-shared.js";
|
|
@@ -54,7 +55,7 @@ function PanelBody({ panel, label, featureName, screenId, screenParams, translat
|
|
|
54
55
|
return (_jsx(FeedPanelBody, { panel: panel, label: text, screenParams: screenParams, translate: translate }));
|
|
55
56
|
}
|
|
56
57
|
if (panel.kind === "text") {
|
|
57
|
-
return (_jsx(TextPanelBody, { panel: panel, label: label, screenParams: screenParams, translate: translate }));
|
|
58
|
+
return (_jsx(TextPanelBody, { screenId: screenId, panel: panel, label: label, screenParams: screenParams, translate: translate }));
|
|
58
59
|
}
|
|
59
60
|
return (_jsx(ProgressListPanelBody, { panel: panel, label: text, screenParams: screenParams, translate: translate }));
|
|
60
61
|
}
|
|
@@ -62,7 +63,11 @@ function renderDashboardPanel(panel, featureName, screenId, screenParams, transl
|
|
|
62
63
|
if (panel.kind === "screen") {
|
|
63
64
|
return (_jsx(HiddenOnNarrow, { hide: panel.hideOnNarrow === true, children: _jsx(ScreenPanelTile, { panel: panel, featureName: featureName, recordId: screenParams.recordId, translate: translate }) }, panel.id));
|
|
64
65
|
}
|
|
65
|
-
const label = panel.kind === "custom" || panel.label === undefined
|
|
66
|
+
const label = panel.kind === "custom" || panel.label === undefined
|
|
67
|
+
? undefined
|
|
68
|
+
: translate(panel.label, panel.kind === "progress-list" && panel.labelParams !== undefined
|
|
69
|
+
? Object.fromEntries(Object.keys(panel.labelParams).map((param) => [param, ""]))
|
|
70
|
+
: undefined);
|
|
66
71
|
return (_jsx(HiddenOnNarrow, { hide: panel.hideOnNarrow === true, children: _jsx(GatedGridCell, { panel: panel, screenParams: screenParams, label: label ?? panel.id, className: panelSpanClassName(panel), children: _jsx(PanelBody, { panel: panel, label: label, featureName: featureName, screenId: screenId, screenParams: screenParams, translate: translate }) }) }, panel.id));
|
|
67
72
|
}
|
|
68
73
|
export function WebDashboardBody({ featureName, screen, translate, }) {
|
|
@@ -106,5 +111,5 @@ export function WebDashboardBody({ featureName, screen, translate, }) {
|
|
|
106
111
|
const headerActionsBar = renderHeaderActionsBar(model);
|
|
107
112
|
// The shell header owns the title; the badge and the actions sit in it there.
|
|
108
113
|
const badgeInHeader = scopeBadge !== null && usesPageHeaderSlot;
|
|
109
|
-
return (_jsx(PanelLoadedContext.Provider, { value: params.reportLoaded, children: _jsx(DashboardQueryContext.Provider, { value: record.queryRuntime, children: _jsxs(PageSection, { className: "flex flex-col gap-4", testId: `dashboard-${screen.id}`, children: [renderPageHeaderSlot(model, headerActionsBar, badgeInHeader), renderTitleRow(model, headerActionsBar, badgeInHeader), renderActionErrorBanner(primitives, actionError), renderRecordError(model, recordQuery.error, recordRow, refetchRecord), renderDescriptionAndNotice(model, description), _jsxs(VisibilityQueryContext.Provider, { value: visibility.gateResultsWithPending, children: [_jsx(VisibilityGateQueries, { gates: visibility.visibilityGates, onResult: visibility.gateResults.report, onForget: visibility.gateResults.forget }), _jsx(
|
|
114
|
+
return (_jsx(PanelLoadedContext.Provider, { value: params.reportLoaded, children: _jsx(DashboardQueryContext.Provider, { value: record.queryRuntime, children: _jsxs(PageSection, { className: "flex flex-col gap-4", testId: `dashboard-${screen.id}`, children: [renderPageHeaderSlot(model, headerActionsBar, badgeInHeader), renderTitleRow(model, headerActionsBar, badgeInHeader), renderActionErrorBanner(primitives, actionError), renderRecordError(model, recordQuery.error, recordRow, refetchRecord), renderDescriptionAndNotice(model, description), _jsxs(VisibilityQueryContext.Provider, { value: visibility.gateResultsWithPending, children: [_jsx(VisibilityGateQueries, { gates: visibility.visibilityGates, onResult: visibility.gateResults.report, onForget: visibility.gateResults.forget }), _jsx(DashboardPanelGrid, { layout: screen.layout, panels: panelsInNarrowOrder(screen.panels, belowSm), belowSm: belowSm, renderPanel: (panel) => renderDashboardPanel(panel, featureName, screen.id, screenParams, effectiveTranslate) })] })] }) }) }));
|
|
110
115
|
}
|
|
@@ -51,11 +51,12 @@ function ListFooter({ link, data, narrow, translate, }) {
|
|
|
51
51
|
const userRoles = useUserRoles();
|
|
52
52
|
const total = knownTotal(data);
|
|
53
53
|
const remaining = total === undefined ? 0 : total - (data.rows ?? []).length;
|
|
54
|
-
const allowed =
|
|
54
|
+
const allowed = link.label !== undefined &&
|
|
55
|
+
navigateTargetAllows({ screen: link.screen }, appFeatures, userRoles) &&
|
|
55
56
|
namedFilterNavigateAllows(link, appFeatures, userRoles);
|
|
56
57
|
const target = dashboardNavigationLink(nav, link);
|
|
57
|
-
return (_jsxs(_Fragment, { children: [remaining > 0 && (_jsxs("span", { "data-testid": "dashboard-list-more", children: [translate((narrow ? (link.narrowMoreText ?? link.moreText) : link.moreText) ??
|
|
58
|
-
"kumiko.dashboard.list.more", { count: remaining }), allowed && " · "] })), allowed && (_jsx(Link, { href: target.href, onPress: target.onPress, testId: "dashboard-list-footer-link", className: "font-medium", children: translate(link.label) }))] }));
|
|
58
|
+
return (_jsxs(_Fragment, { children: [remaining > 0 && (_jsxs("span", { "data-testid": "dashboard-list-more", className: link.label === undefined && !narrow ? "text-muted-foreground" : undefined, children: [translate((narrow ? (link.narrowMoreText ?? link.moreText) : link.moreText) ??
|
|
59
|
+
"kumiko.dashboard.list.more", { count: remaining }), allowed && " · "] })), allowed && link.label !== undefined && (_jsx(Link, { href: target.href, onPress: target.onPress, testId: "dashboard-list-footer-link", className: "font-medium text-primary", children: translate(link.label) }))] }));
|
|
59
60
|
}
|
|
60
61
|
function rowLinkResolverOf(rowLink, resolveScreenLink) {
|
|
61
62
|
if (rowLink.screenField !== undefined) {
|
|
@@ -88,7 +89,7 @@ function NarrowCardsPanel({ panel, label, data, columns, featureName, translate,
|
|
|
88
89
|
const { formatPercent, formatNumber, formatDateTime } = useDashboardFormats();
|
|
89
90
|
const { footerLink } = panel;
|
|
90
91
|
const totalLabel = totalText(panel, data, true, translate);
|
|
91
|
-
return (_jsxs("section", { "data-testid": `dashboard-panel-${panel.id}`, className: "flex flex-col gap-2", children: [_jsxs("header", { className: "flex items-baseline justify-between gap-3", children: [_jsx("h2", { className: "text-sm font-semibold", children: label }), totalLabel !== undefined && (_jsx("span", { className: "text-xs text-muted-foreground", children: totalLabel }))] }), _jsx(DashboardReferenceListTable, { columns: columns, rows: data.rows ?? [], featureName: featureName, formatPercent: formatPercent, formatNumber: formatNumber, formatDateTime: formatDateTime, translate: translate, narrowCards: true, ...(panel.narrow?.titleField !== undefined && { titleField: panel.narrow.titleField }), ...(panel.rowToneField !== undefined && { rowToneField: panel.rowToneField }) }), footerLink !== undefined && (_jsx("footer", { className: "flex flex-wrap items-center gap-x-1 text-
|
|
92
|
+
return (_jsxs("section", { "data-testid": `dashboard-panel-${panel.id}`, className: "flex flex-col gap-2", children: [_jsxs("header", { className: "flex items-baseline justify-between gap-3", children: [_jsx("h2", { className: "text-sm font-semibold", children: label }), totalLabel !== undefined && (_jsx("span", { className: "text-xs text-muted-foreground", children: totalLabel }))] }), _jsx(DashboardReferenceListTable, { columns: columns, rows: data.rows ?? [], featureName: featureName, formatPercent: formatPercent, formatNumber: formatNumber, formatDateTime: formatDateTime, translate: translate, narrowCards: true, ...(panel.narrow?.titleField !== undefined && { titleField: panel.narrow.titleField }), ...(panel.rowToneField !== undefined && { rowToneField: panel.rowToneField }) }), footerLink !== undefined && (_jsx("footer", { "data-testid": "dashboard-list-more-bar", className: "flex flex-wrap items-center justify-center gap-x-1 text-sm font-medium text-primary", children: _jsx(ListFooter, { link: footerLink, data: data, narrow: true, translate: translate }) }))] }));
|
|
92
93
|
}
|
|
93
94
|
export function ListPanelBody({ panel, label, featureName, screenId, screenParams, translate, }) {
|
|
94
95
|
const { formatPercent, formatNumber, formatDateTime } = useDashboardFormats();
|
|
@@ -103,10 +104,12 @@ export function ListPanelBody({ panel, label, featureName, screenId, screenParam
|
|
|
103
104
|
field: normalized.field,
|
|
104
105
|
label: translate(normalized.label ?? normalized.field),
|
|
105
106
|
...(normalized.display !== undefined && { display: normalized.display }),
|
|
107
|
+
...(normalized.variant !== undefined && { buttonVariant: normalized.variant }),
|
|
106
108
|
...(normalized.badgeToneField !== undefined && {
|
|
107
109
|
badgeToneField: normalized.badgeToneField,
|
|
108
110
|
}),
|
|
109
111
|
...(normalized.badgeDot !== undefined && { badgeDot: normalized.badgeDot }),
|
|
112
|
+
...(normalized.badgeIcon !== undefined && { badgeIcon: normalized.badgeIcon }),
|
|
110
113
|
...(normalized.emptyPlaceholder !== undefined && {
|
|
111
114
|
emptyPlaceholder: normalized.emptyPlaceholder,
|
|
112
115
|
}),
|
|
@@ -122,6 +125,7 @@ export function ListPanelBody({ panel, label, featureName, screenId, screenParam
|
|
|
122
125
|
linkFor: screenLinkFor(resolveScreenLink, normalized.linkScreenField, normalized.linkParamsField),
|
|
123
126
|
}),
|
|
124
127
|
...(normalized.showOnNarrowOnly === true && { narrowOnly: true }),
|
|
128
|
+
...(normalized.hideOnNarrow === true && { hiddenInCards: true }),
|
|
125
129
|
...(hint !== undefined && { hint: hintViewModel(hint, panel.rowToneField, translate) }),
|
|
126
130
|
};
|
|
127
131
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DashboardPanelDefinition } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
/** Panel grid, or the main/side columns of `layout: "main-side"`; below sm everything is one list in `narrowOrder`. */
|
|
4
|
+
export declare function DashboardPanelGrid({ layout, panels, belowSm, renderPanel, }: {
|
|
5
|
+
readonly layout: "main-side" | undefined;
|
|
6
|
+
readonly panels: readonly DashboardPanelDefinition[];
|
|
7
|
+
readonly belowSm: boolean;
|
|
8
|
+
readonly renderPanel: (panel: DashboardPanelDefinition) => ReactNode;
|
|
9
|
+
}): ReactNode;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const GRID_CLASS = "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-12";
|
|
3
|
+
const COLUMNS_CLASS = "grid grid-cols-1 gap-4 lg:grid-cols-3";
|
|
4
|
+
const COLUMN_CLASS = "flex min-w-0 flex-col gap-4";
|
|
5
|
+
/** Panel grid, or the main/side columns of `layout: "main-side"`; below sm everything is one list in `narrowOrder`. */
|
|
6
|
+
export function DashboardPanelGrid({ layout, panels, belowSm, renderPanel, }) {
|
|
7
|
+
if (layout !== "main-side" || belowSm) {
|
|
8
|
+
return (_jsx("div", { className: layout === "main-side" ? COLUMN_CLASS : GRID_CLASS, children: panels.map(renderPanel) }));
|
|
9
|
+
}
|
|
10
|
+
const topPanels = panels.filter((panel) => panel.column === "top");
|
|
11
|
+
return (_jsxs("div", { className: COLUMN_CLASS, children: [topPanels.length > 0 && (_jsx("div", { className: COLUMN_CLASS, "data-testid": "dashboard-column-top", children: topPanels.map(renderPanel) })), _jsxs("div", { className: COLUMNS_CLASS, "data-testid": "dashboard-columns", children: [_jsx("div", { className: `${COLUMN_CLASS} lg:col-span-2`, "data-testid": "dashboard-column-main", children: panels
|
|
12
|
+
.filter((panel) => panel.column !== "side" && panel.column !== "top")
|
|
13
|
+
.map(renderPanel) }), _jsx("div", { className: COLUMN_CLASS, "data-testid": "dashboard-column-side", children: panels.filter((panel) => panel.column === "side").map(renderPanel) })] })] }));
|
|
14
|
+
}
|
|
@@ -6,6 +6,7 @@ import { namedFilterNavigateAllows, navigateTargetAllows } from "../../app/scree
|
|
|
6
6
|
import { rendererWarn } from "../../dev-console.js";
|
|
7
7
|
import { EMPTY_VALUE_PLACEHOLDER } from "../../headless/index.js";
|
|
8
8
|
import { extensionSectionName, useAppFeatures, useExtensionSectionComponent, useNav, useTranslation, useUserRoles, } from "../../index.js";
|
|
9
|
+
import { useIsBelowSmViewport } from "../primitives/use-narrow-viewport.js";
|
|
9
10
|
import { initialWindowSelection, } from "../widgets/chart-window.js";
|
|
10
11
|
import { chartToneColor, SegmentBarChart, StackedAreaChart, StackedBarChart, TimeseriesChart, } from "../widgets/charts.js";
|
|
11
12
|
import { FeedList } from "../widgets/feed-list.js";
|
|
@@ -55,6 +56,7 @@ export function StatPanelBody(props) {
|
|
|
55
56
|
}
|
|
56
57
|
function StatPanelContent({ panel, label, screenId, screenParams, translate, variant, }) {
|
|
57
58
|
const formats = useDashboardFormats();
|
|
59
|
+
const belowSm = useIsBelowSmViewport();
|
|
58
60
|
const nav = useNav();
|
|
59
61
|
const link = optionalDashboardNavigationLink(nav, panel.navigate);
|
|
60
62
|
// Resolved HERE (not in a separate always-rendered child) so `icon` on
|
|
@@ -86,7 +88,10 @@ function StatPanelContent({ panel, label, screenId, screenParams, translate, var
|
|
|
86
88
|
(rawValue === 0 ? undefined : panel.tone);
|
|
87
89
|
const sub = panel.subField !== undefined ? record[panel.subField] : undefined;
|
|
88
90
|
const dynamicLabel = panel.labelField !== undefined ? record[panel.labelField] : undefined;
|
|
89
|
-
const
|
|
91
|
+
const staticLabel = belowSm && panel.labelNarrow !== undefined
|
|
92
|
+
? translate(panel.labelNarrow, typeof rawValue === "number" ? { count: rawValue } : {})
|
|
93
|
+
: label;
|
|
94
|
+
const shownLabel = typeof dynamicLabel === "string" && dynamicLabel !== "" ? dynamicLabel : staticLabel;
|
|
90
95
|
const delta = readDelta(panel, record);
|
|
91
96
|
const value = statValueText(rawValue, panel.valueFormat, translate, formats);
|
|
92
97
|
const spark = readSparkline(panel, record);
|
|
@@ -250,8 +255,16 @@ export function ChartPanelBody({ panel, label, screenParams, translate, }) {
|
|
|
250
255
|
}), ariaLabel: label, testId: testId }));
|
|
251
256
|
} }));
|
|
252
257
|
}
|
|
258
|
+
function feedTotalText(showTotal, data, translate) {
|
|
259
|
+
const shown = (data.rows ?? []).length;
|
|
260
|
+
const total = typeof data.total === "number" && Number.isFinite(data.total) ? data.total : shown;
|
|
261
|
+
const key = showTotal === true ? undefined : showTotal.text;
|
|
262
|
+
return translate(key ?? "kumiko.dashboard.list.shown-of-total", { shown, total });
|
|
263
|
+
}
|
|
253
264
|
export function FeedPanelBody({ panel, label, screenParams, translate, }) {
|
|
254
|
-
return (_jsx(QueryPanel, { panel: panel, label: label, screenParams: screenParams, translate: translate, skeleton: "rows", isEmpty: (data) => (data.rows ?? []).length === 0,
|
|
265
|
+
return (_jsx(QueryPanel, { panel: panel, label: label, screenParams: screenParams, translate: translate, skeleton: "rows", isEmpty: (data) => (data.rows ?? []).length === 0, ...(panel.showTotal !== undefined && {
|
|
266
|
+
subtitle: (data) => feedTotalText(panel.showTotal ?? true, data, translate),
|
|
267
|
+
}), children: (data, formats) => {
|
|
255
268
|
const rows = (data.rows ?? []).map((row, i) => {
|
|
256
269
|
const trailing = resolveDashboardText(row.trailing, translate, formats);
|
|
257
270
|
return {
|
|
@@ -263,6 +276,12 @@ export function FeedPanelBody({ panel, label, screenParams, translate, }) {
|
|
|
263
276
|
return _jsx(FeedList, { rows: rows });
|
|
264
277
|
} }));
|
|
265
278
|
}
|
|
279
|
+
function labelParamsFrom(labelParams, data) {
|
|
280
|
+
return Object.fromEntries(Object.entries(labelParams).map(([param, field]) => {
|
|
281
|
+
const value = data[field];
|
|
282
|
+
return [param, typeof value === "string" || typeof value === "number" ? String(value) : ""];
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
266
285
|
function isFiniteNumber(value) {
|
|
267
286
|
return typeof value === "number" && Number.isFinite(value);
|
|
268
287
|
}
|
|
@@ -310,7 +329,16 @@ function toProgressListRow(row, index, translate, formats) {
|
|
|
310
329
|
};
|
|
311
330
|
}
|
|
312
331
|
export function ProgressListPanelBody({ panel, label, screenParams, translate, }) {
|
|
313
|
-
return (_jsx(QueryPanel, { panel: panel, label: label,
|
|
332
|
+
return (_jsx(QueryPanel, { panel: panel, label: label, ...(panel.labelParams !== undefined && {
|
|
333
|
+
titleFrom: (data) => panel.labelParams === undefined
|
|
334
|
+
? undefined
|
|
335
|
+
: translate(panel.label, labelParamsFrom(panel.labelParams, data)),
|
|
336
|
+
}), ...(panel.subtitleField !== undefined && {
|
|
337
|
+
subtitle: (data) => {
|
|
338
|
+
const value = panel.subtitleField === undefined ? undefined : data[panel.subtitleField];
|
|
339
|
+
return typeof value === "string" && value !== "" ? value : undefined;
|
|
340
|
+
},
|
|
341
|
+
}), screenParams: screenParams, translate: translate, skeleton: "rows", isEmpty: (data) => (data.rows ?? []).length === 0, children: (data, formats) => {
|
|
314
342
|
const rows = (data.rows ?? []).map((row, i) => toProgressListRow(row, i, translate, formats));
|
|
315
343
|
return _jsx(ProgressList, { rows: rows });
|
|
316
344
|
} }));
|
|
@@ -82,6 +82,8 @@ type QueryPanelProps<TData> = {
|
|
|
82
82
|
readonly query: string;
|
|
83
83
|
};
|
|
84
84
|
readonly label: string;
|
|
85
|
+
/** Title derived from the loaded data; `label` stands in until then. */
|
|
86
|
+
readonly titleFrom?: (data: TData) => string | undefined;
|
|
85
87
|
/** A function derives the line from the loaded data (e.g. "n of m"); `staticSubtitle` stands in until then. */
|
|
86
88
|
readonly subtitle?: string | ((data: TData) => string | undefined);
|
|
87
89
|
readonly staticSubtitle?: string;
|
|
@@ -98,7 +100,7 @@ type QueryPanelProps<TData> = {
|
|
|
98
100
|
* redraws this panel and nothing else. */
|
|
99
101
|
readonly children: (data: TData, formats: DashboardFormats) => ReactNode;
|
|
100
102
|
};
|
|
101
|
-
export declare function QueryPanel<TData>({ panel, label, subtitle, staticSubtitle, action, footer, replaceShell, screenParams, translate, skeleton, isEmpty, children, }: QueryPanelProps<TData>): ReactNode;
|
|
103
|
+
export declare function QueryPanel<TData>({ panel, label, titleFrom, subtitle, staticSubtitle, action, footer, replaceShell, screenParams, translate, skeleton, isEmpty, children, }: QueryPanelProps<TData>): ReactNode;
|
|
102
104
|
export declare function useLoadedAt(screenParams: ScreenParams): {
|
|
103
105
|
readonly loadedAtMs: number;
|
|
104
106
|
readonly reportLoaded: (atMs: number) => void;
|