@cosmicdrift/kumiko-renderer 0.413.1 → 0.415.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-support.js +4 -0
- package/dist/app/content-previews.d.ts +39 -0
- package/dist/app/content-previews.js +28 -0
- package/dist/app/entity-edit-screen.js +2 -5
- package/dist/app/entity-list-screen.js +42 -59
- package/dist/app/form-schema.d.ts +1 -0
- package/dist/app/form-schema.js +24 -0
- package/dist/app/list-facets.d.ts +1 -0
- package/dist/app/list-facets.js +10 -1
- package/dist/app/list-sort-options.d.ts +4 -0
- package/dist/app/list-sort-options.js +11 -0
- package/dist/app/named-filter-facet.d.ts +16 -3
- package/dist/app/named-filter-facet.js +97 -5
- package/dist/app/projection-detail-body.d.ts +2 -4
- package/dist/app/projection-detail-body.js +7 -1
- package/dist/app/projection-detail-guidance-data.d.ts +7 -0
- package/dist/app/projection-detail-guidance-data.js +103 -0
- package/dist/app/projection-detail-guidance.d.ts +13 -0
- package/dist/app/projection-detail-guidance.js +197 -0
- package/dist/app/projection-detail-header-model.d.ts +1 -3
- package/dist/app/projection-detail-header-model.js +4 -8
- package/dist/app/projection-detail-header-region.d.ts +2 -1
- package/dist/app/projection-detail-header-region.js +63 -23
- package/dist/app/projection-detail-header.d.ts +6 -1
- package/dist/app/projection-detail-header.js +76 -18
- package/dist/app/projection-detail-navigation.d.ts +2 -0
- package/dist/app/projection-detail-navigation.js +13 -3
- package/dist/app/projection-detail-states.d.ts +3 -3
- package/dist/app/projection-list-body.js +4 -2
- package/dist/app/projection-list-render.js +3 -1
- package/dist/app/projection-list-shim.d.ts +4 -1
- package/dist/app/projection-list-shim.js +35 -8
- package/dist/app/reference-link.d.ts +3 -2
- package/dist/app/reference-link.js +19 -4
- package/dist/app/row-actions.js +3 -3
- package/dist/app/screen-access.d.ts +4 -0
- package/dist/app/screen-access.js +18 -0
- package/dist/app/screen-shared.js +3 -1
- package/dist/app/unique-label-keys.d.ts +1 -0
- package/dist/app/unique-label-keys.js +9 -0
- package/dist/app/use-entity-list-payload.d.ts +26 -0
- package/dist/app/use-entity-list-payload.js +59 -0
- package/dist/app/use-entity-range-facets.js +2 -3
- package/dist/app/use-facet-counts.d.ts +5 -0
- package/dist/app/use-facet-counts.js +7 -0
- package/dist/app/use-list-summary-row.d.ts +10 -0
- package/dist/app/use-list-summary-row.js +33 -0
- package/dist/app/use-named-filter-queue.d.ts +20 -0
- package/dist/app/use-named-filter-queue.js +9 -0
- package/dist/app/use-projection-detail-actions.d.ts +5 -4
- package/dist/app/use-projection-detail-actions.js +42 -1
- package/dist/app/use-projection-list-data.d.ts +5 -0
- package/dist/app/use-projection-list-data.js +35 -6
- package/dist/app/use-projection-list-query.d.ts +2 -0
- package/dist/app/use-projection-list-query.js +29 -16
- package/dist/app/use-related-list-tab-counts.js +5 -1
- package/dist/app/use-row-decoration.d.ts +13 -0
- package/dist/app/use-row-decoration.js +103 -0
- package/dist/app/use-screen-list-rows.d.ts +4 -1
- package/dist/app/use-screen-list-rows.js +14 -5
- package/dist/app/use-screen-list-table.d.ts +3 -1
- package/dist/app/use-screen-list-table.js +10 -1
- package/dist/app/write-failed-error.d.ts +1 -0
- package/dist/app/write-failed-error.js +10 -0
- package/dist/card-options.d.ts +25 -0
- package/dist/card-options.js +1 -0
- package/dist/compact-tap-classes.d.ts +1 -0
- package/dist/compact-tap-classes.js +3 -0
- package/dist/components/embedded-list-field.js +13 -12
- package/dist/components/list-empty-state.d.ts +13 -1
- package/dist/components/list-empty-state.js +20 -1
- package/dist/components/list-group-page-bridges.d.ts +1 -1
- package/dist/components/list-group-page-bridges.js +2 -2
- package/dist/components/related-list-section.js +4 -22
- package/dist/components/render-edit-action-button.d.ts +3 -1
- package/dist/components/render-edit-action-button.js +5 -3
- package/dist/components/render-edit-render-model.d.ts +2 -2
- package/dist/components/render-edit-types.d.ts +4 -2
- package/dist/components/render-edit.js +3 -1
- package/dist/components/render-list-hint-columns.d.ts +9 -0
- package/dist/components/render-list-hint-columns.js +87 -0
- package/dist/components/render-list-reference-columns.js +4 -2
- package/dist/components/render-list-row-tone.d.ts +3 -0
- package/dist/components/render-list-row-tone.js +10 -0
- package/dist/components/render-list-table-props.d.ts +9 -1
- package/dist/components/render-list-table-props.js +4 -1
- package/dist/components/render-list-toolbar-action.d.ts +1 -2
- package/dist/components/render-list-toolbar-model.d.ts +4 -1
- package/dist/components/render-list-toolbar-model.js +21 -6
- package/dist/components/render-list-toolbar.d.ts +3 -2
- package/dist/components/render-list-toolbar.js +8 -6
- package/dist/components/render-list-types.d.ts +6 -1
- package/dist/components/render-list.js +26 -7
- package/dist/components/use-render-edit-controlled-sync.js +3 -5
- package/dist/components/use-render-edit-draft-save.js +7 -9
- package/dist/components/use-render-edit-schema.d.ts +3 -0
- package/dist/components/use-render-edit-schema.js +15 -0
- package/dist/components/use-render-edit-state.d.ts +1 -0
- package/dist/components/use-render-edit-state.js +4 -1
- package/dist/components/use-render-edit-steps.js +2 -3
- package/dist/components/use-render-list-columns.d.ts +3 -1
- package/dist/components/use-render-list-columns.js +22 -10
- package/dist/context/screen-focus-context.d.ts +14 -0
- package/dist/context/screen-focus-context.js +28 -0
- package/dist/data-table-facet-types.d.ts +6 -0
- package/dist/data-table-view-types.d.ts +20 -1
- package/dist/headless/form/form-controller.js +3 -1
- package/dist/headless/form/zod-bridge.d.ts +7 -1
- package/dist/headless/form/zod-bridge.js +10 -0
- package/dist/headless/index.d.ts +2 -1
- package/dist/headless/index.js +1 -0
- package/dist/headless/pwa-service-worker-meta.d.ts +4 -0
- package/dist/headless/pwa-service-worker-meta.js +13 -0
- package/dist/headless/view-model/index.d.ts +1 -1
- package/dist/headless/view-model/list-file-display.js +3 -2
- package/dist/headless/view-model/list.js +16 -0
- package/dist/headless/view-model/types.d.ts +37 -0
- package/dist/hooks/list-column-layout.js +2 -1
- package/dist/hooks/list-server-groups.js +14 -1
- package/dist/hooks/list-state-schema.d.ts +1 -0
- package/dist/hooks/list-state-schema.js +9 -1
- package/dist/hooks/use-debounced-value.d.ts +1 -0
- package/dist/hooks/use-debounced-value.js +11 -0
- package/dist/hooks/use-list-aggregates.d.ts +5 -1
- package/dist/hooks/use-list-aggregates.js +9 -5
- package/dist/hooks/use-list-table.d.ts +2 -1
- package/dist/hooks/use-list-table.js +3 -9
- package/dist/hooks/use-list-url-state.d.ts +2 -0
- package/dist/hooks/use-list-url-state.js +12 -4
- package/dist/hooks/use-list-view-state.js +23 -3
- package/dist/hooks/use-reference-lookup.js +7 -2
- package/dist/hooks/use-remembered-list-params.d.ts +6 -2
- package/dist/hooks/use-remembered-list-params.js +18 -3
- package/dist/hooks/use-store.js +0 -1
- package/dist/i18n-defaults.js +39 -3
- package/dist/index.d.ts +7 -2
- package/dist/index.js +4 -1
- package/dist/live/dispatcher-live.js +2 -0
- package/dist/metric-types.d.ts +4 -0
- package/dist/primitives-record-guidance.d.ts +55 -0
- package/dist/primitives-record-guidance.js +1 -0
- package/dist/primitives.d.ts +47 -54
- package/dist/server-clock.d.ts +6 -0
- package/dist/server-clock.js +20 -0
- package/dist/session/session-ended.d.ts +1 -0
- package/dist/session/session-ended.js +2 -2
- package/dist/status-tone.d.ts +1 -0
- package/dist/status-tone.js +5 -0
- package/dist/web/app/browser-locale.js +1 -1
- package/dist/web/app/client-plugin.d.ts +6 -1
- package/dist/web/app/create-app.d.ts +2 -1
- package/dist/web/app/create-app.js +15 -5
- package/dist/web/app/dashboard-body.js +25 -11
- package/dist/web/app/dashboard-header.d.ts +2 -1
- package/dist/web/app/dashboard-header.js +19 -7
- package/dist/web/app/dashboard-list-panel.d.ts +12 -0
- package/dist/web/app/dashboard-list-panel.js +144 -0
- package/dist/web/app/dashboard-narrow-gate.d.ts +6 -0
- package/dist/web/app/dashboard-narrow-gate.js +6 -0
- package/dist/web/app/dashboard-narrow-order.d.ts +3 -0
- package/dist/web/app/dashboard-narrow-order.js +6 -0
- package/dist/web/app/dashboard-navigation-link.d.ts +12 -0
- package/dist/web/app/dashboard-navigation-link.js +21 -0
- package/dist/web/app/dashboard-panels.d.ts +7 -23
- package/dist/web/app/dashboard-panels.js +55 -123
- package/dist/web/app/dashboard-reference-list-table.d.ts +5 -1
- package/dist/web/app/dashboard-reference-list-table.js +13 -4
- package/dist/web/app/dashboard-shared.d.ts +23 -7
- package/dist/web/app/dashboard-shared.js +45 -17
- package/dist/web/app/dashboard-stat-group-panel.d.ts +14 -0
- package/dist/web/app/dashboard-stat-group-panel.js +74 -0
- package/dist/web/app/dashboard-text-panel.d.ts +12 -0
- package/dist/web/app/dashboard-text-panel.js +167 -0
- package/dist/web/app/dashboard-text.d.ts +2 -0
- package/dist/web/app/dashboard-text.js +1 -1
- package/dist/web/app/dashboard-visibility.js +1 -1
- package/dist/web/app/relative-time.js +2 -1
- package/dist/web/drawn-icons.d.ts +6 -0
- package/dist/web/drawn-icons.js +30 -0
- package/dist/web/editor/editor-footer.d.ts +28 -0
- package/dist/web/editor/editor-footer.js +23 -0
- package/dist/web/editor/editor-frame.d.ts +23 -0
- package/dist/web/editor/editor-frame.js +24 -0
- package/dist/web/editor/editor-header.d.ts +36 -0
- package/dist/web/editor/editor-header.js +30 -0
- package/dist/web/editor/editor-rail.d.ts +32 -0
- package/dist/web/editor/editor-rail.js +37 -0
- package/dist/web/editor/editor-workbench.d.ts +34 -0
- package/dist/web/editor/editor-workbench.js +19 -0
- package/dist/web/editor/index.d.ts +6 -0
- package/dist/web/editor/index.js +6 -0
- package/dist/web/editor/relative-when.d.ts +1 -0
- package/dist/web/editor/relative-when.js +18 -0
- package/dist/web/icons.js +6 -5
- package/dist/web/index.d.ts +9 -1
- package/dist/web/index.js +7 -1
- package/dist/web/layout/default-app-shell.js +6 -4
- package/dist/web/layout/focus-aware-sidebar.d.ts +4 -7
- package/dist/web/layout/focus-aware-sidebar.js +5 -7
- package/dist/web/layout/header-action-pinned.d.ts +8 -0
- package/dist/web/layout/header-action-pinned.js +25 -0
- package/dist/web/layout/nav-collapse-state.d.ts +7 -0
- package/dist/web/layout/nav-collapse-state.js +76 -0
- package/dist/web/layout/nav-tree.js +71 -28
- package/dist/web/layout/notification-bell.d.ts +7 -2
- package/dist/web/layout/notification-bell.js +16 -5
- 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.d.ts +8 -0
- package/dist/web/layout/screen-focus.js +42 -0
- package/dist/web/layout/shell-focus.d.ts +5 -4
- package/dist/web/layout/shell-focus.js +14 -7
- package/dist/web/layout/shell-header.d.ts +2 -1
- package/dist/web/layout/shell-header.js +84 -27
- package/dist/web/layout/shell-style.d.ts +3 -0
- package/dist/web/layout/shell-style.js +6 -0
- package/dist/web/layout/sidebar-open-state.d.ts +6 -0
- package/dist/web/layout/sidebar-open-state.js +28 -0
- package/dist/web/layout/uniform-bar-controls.d.ts +2 -2
- package/dist/web/layout/uniform-bar-controls.js +4 -3
- package/dist/web/layout/use-in-app-inbox.js +8 -1
- package/dist/web/layout/workspace-shell.d.ts +11 -1
- package/dist/web/layout/workspace-shell.js +9 -5
- package/dist/web/lib/upload-file-ref.d.ts +2 -2
- package/dist/web/lib/upload-file-ref.js +4 -9
- package/dist/web/presence/use-presence.js +7 -2
- package/dist/web/primitives/banner.d.ts +1 -1
- package/dist/web/primitives/banner.js +22 -9
- package/dist/web/primitives/calendar-day-picker.js +24 -5
- package/dist/web/primitives/card.js +18 -8
- package/dist/web/primitives/code-input.js +6 -1
- package/dist/web/primitives/data-table/actions-column.d.ts +2 -1
- package/dist/web/primitives/data-table/actions-column.js +7 -3
- package/dist/web/primitives/data-table/card-body.d.ts +6 -1
- package/dist/web/primitives/data-table/card-body.js +53 -6
- package/dist/web/primitives/data-table/card-frame.d.ts +8 -0
- package/dist/web/primitives/data-table/card-frame.js +9 -0
- package/dist/web/primitives/data-table/card-row.js +44 -7
- package/dist/web/primitives/data-table/card-sort-select.d.ts +6 -2
- package/dist/web/primitives/data-table/card-sort-select.js +10 -7
- package/dist/web/primitives/data-table/card-view.js +12 -2
- package/dist/web/primitives/data-table/column-picker-section.js +9 -2
- package/dist/web/primitives/data-table/column-resize-handle.js +3 -4
- package/dist/web/primitives/data-table/column-role.d.ts +1 -0
- package/dist/web/primitives/data-table/column-role.js +1 -0
- package/dist/web/primitives/data-table/data-cell-props.d.ts +5 -0
- package/dist/web/primitives/data-table/data-cell-props.js +5 -0
- package/dist/web/primitives/data-table/density.js +1 -0
- package/dist/web/primitives/data-table/facet-cluster.d.ts +2 -1
- package/dist/web/primitives/data-table/facet-cluster.js +2 -2
- package/dist/web/primitives/data-table/group-band.js +4 -0
- package/dist/web/primitives/data-table/hint-cell.d.ts +14 -0
- package/dist/web/primitives/data-table/hint-cell.js +68 -0
- package/dist/web/primitives/data-table/hint-column-width.d.ts +3 -0
- package/dist/web/primitives/data-table/hint-column-width.js +11 -0
- package/dist/web/primitives/data-table/measure-value.js +2 -3
- package/dist/web/primitives/data-table/row-action-column.d.ts +3 -0
- package/dist/web/primitives/data-table/row-action-column.js +4 -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 -2
- package/dist/web/primitives/data-table/sort-options-select.d.ts +22 -0
- package/dist/web/primitives/data-table/sort-options-select.js +46 -0
- package/dist/web/primitives/data-table/sortable-header.d.ts +3 -1
- package/dist/web/primitives/data-table/sortable-header.js +5 -3
- package/dist/web/primitives/data-table/table-body.d.ts +1 -1
- package/dist/web/primitives/data-table/table-body.js +5 -3
- package/dist/web/primitives/data-table/table-chrome.js +3 -1
- package/dist/web/primitives/data-table/table-content.js +12 -7
- package/dist/web/primitives/data-table/table-data-cell.js +9 -3
- package/dist/web/primitives/data-table/table-header-row.js +5 -2
- package/dist/web/primitives/data-table/table-view.js +22 -3
- package/dist/web/primitives/data-table/toolbar-end-cluster.js +1 -1
- package/dist/web/primitives/data-table/toolbar.d.ts +2 -0
- package/dist/web/primitives/data-table/toolbar.js +70 -7
- package/dist/web/primitives/data-table/totals-footer.d.ts +20 -0
- package/dist/web/primitives/data-table/totals-footer.js +41 -9
- package/dist/web/primitives/data-table/use-bulk-selection.js +2 -1
- package/dist/web/primitives/data-table/use-column-pins.js +4 -0
- package/dist/web/primitives/data-table/use-data-table-state.d.ts +1 -0
- package/dist/web/primitives/data-table/use-data-table-state.js +9 -5
- package/dist/web/primitives/data-table/use-measured-column-widths.js +5 -4
- package/dist/web/primitives/data-table/use-row-selection.js +22 -11
- package/dist/web/primitives/data-table/view-menu.js +7 -1
- package/dist/web/primitives/data-table-cell.d.ts +21 -2
- package/dist/web/primitives/data-table-cell.js +129 -26
- package/dist/web/primitives/embedded-file-cell.js +3 -2
- package/dist/web/primitives/embedded-list-cards.js +3 -4
- package/dist/web/primitives/facet-filter.d.ts +5 -3
- package/dist/web/primitives/facet-filter.js +36 -5
- package/dist/web/primitives/facet-search-filter.d.ts +2 -1
- package/dist/web/primitives/facet-search-filter.js +3 -2
- package/dist/web/primitives/facet-trigger-label.d.ts +8 -0
- package/dist/web/primitives/facet-trigger-label.js +9 -0
- package/dist/web/primitives/file-thumbnail.d.ts +6 -2
- package/dist/web/primitives/file-thumbnail.js +13 -6
- package/dist/web/primitives/file-upload.js +3 -2
- package/dist/web/primitives/file-view-action.d.ts +6 -0
- package/dist/web/primitives/file-view-action.js +22 -0
- package/dist/web/primitives/files-dropzone.js +20 -9
- package/dist/web/primitives/form-footer-parts.d.ts +0 -1
- package/dist/web/primitives/form.js +0 -1
- package/dist/web/primitives/hint-reason-row.d.ts +32 -0
- package/dist/web/primitives/hint-reason-row.js +45 -0
- package/dist/web/primitives/index.js +6 -0
- package/dist/web/primitives/layout-elements.d.ts +1 -1
- package/dist/web/primitives/layout-elements.js +3 -3
- package/dist/web/primitives/metric.js +20 -6
- package/dist/web/primitives/page-header.d.ts +1 -1
- package/dist/web/primitives/page-header.js +10 -2
- package/dist/web/primitives/pager.d.ts +3 -2
- package/dist/web/primitives/pager.js +31 -24
- package/dist/web/primitives/reason-box.d.ts +20 -0
- package/dist/web/primitives/reason-box.js +13 -0
- package/dist/web/primitives/record-breadcrumb.d.ts +3 -0
- package/dist/web/primitives/record-breadcrumb.js +11 -0
- package/dist/web/primitives/record-steps.d.ts +3 -0
- package/dist/web/primitives/record-steps.js +50 -0
- package/dist/web/primitives/record-summary.d.ts +3 -0
- package/dist/web/primitives/record-summary.js +18 -0
- package/dist/web/primitives/row-actions.d.ts +3 -1
- package/dist/web/primitives/row-actions.js +14 -5
- package/dist/web/primitives/segmented-select.js +10 -9
- package/dist/web/primitives/tabs.js +6 -1
- package/dist/web/pwa/pwa-support.d.ts +4 -0
- package/dist/web/pwa/pwa-support.js +131 -0
- package/dist/web/sse/live-events.js +2 -2
- package/dist/web/tokens.js +0 -3
- package/dist/web/ui/sidebar.d.ts +2 -1
- package/dist/web/ui/sidebar.js +4 -3
- package/dist/web/widgets/ai-text-field.js +3 -2
- package/dist/web/widgets/chart-parts.d.ts +7 -1
- package/dist/web/widgets/chart-parts.js +10 -4
- package/dist/web/widgets/collapsible-section.js +1 -1
- package/dist/web/widgets/dashboard-list-cards.d.ts +17 -0
- package/dist/web/widgets/dashboard-list-cards.js +46 -0
- package/dist/web/widgets/dashboard-list.d.ts +45 -5
- package/dist/web/widgets/dashboard-list.js +126 -25
- package/dist/web/widgets/drawer-panel-class.d.ts +1 -0
- package/dist/web/widgets/drawer-panel-class.js +9 -1
- package/dist/web/widgets/drawer-sizing.js +1 -1
- package/dist/web/widgets/drawer.js +2 -2
- package/dist/web/widgets/floating-panel.js +4 -2
- package/dist/web/widgets/index.d.ts +2 -0
- package/dist/web/widgets/index.js +2 -0
- package/dist/web/widgets/infinity-list.js +18 -11
- package/dist/web/widgets/pdf-viewer-toolbar.js +3 -2
- package/dist/web/widgets/preview-width-frame.d.ts +7 -0
- package/dist/web/widgets/preview-width-frame.js +10 -0
- package/dist/web/widgets/section-card.d.ts +1 -1
- package/dist/web/widgets/sheet-parts.js +3 -1
- package/dist/web/widgets/stacked-area-chrome.js +3 -3
- package/dist/web/widgets/stacked-area-tooltip.js +2 -10
- package/dist/web/widgets/stat-box-cell.d.ts +19 -0
- package/dist/web/widgets/stat-box-cell.js +10 -0
- package/dist/web/widgets/stat.d.ts +16 -1
- package/dist/web/widgets/stat.js +24 -7
- package/dist/web/widgets/status-badge.d.ts +7 -5
- package/dist/web/widgets/status-badge.js +2 -2
- package/dist/web/widgets/step-bar.d.ts +1 -1
- package/dist/web/widgets/step-bar.js +37 -7
- package/dist/web/widgets/step-list-row.d.ts +4 -0
- package/dist/web/widgets/step-list-row.js +22 -14
- package/dist/web/widgets/step-list.d.ts +12 -4
- package/dist/web/widgets/step-list.js +38 -20
- package/dist/web/widgets/upload-zone.d.ts +8 -1
- package/dist/web/widgets/upload-zone.js +13 -3
- package/package.json +5 -5
- package/src/changes.json +289 -0
- package/src/web/styles.css +15 -0
package/dist/web/widgets/stat.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowUpRight } from "lucide-react";
|
|
2
3
|
import { usePrimitives } from "../../index.js";
|
|
3
4
|
import { cn } from "../lib/cn.js";
|
|
4
5
|
// One grid for every row of StatCards (dashboard stat groups, detail metric tiles), so the
|
|
@@ -8,17 +9,24 @@ const TONE_CHIP = {
|
|
|
8
9
|
default: "bg-muted text-foreground",
|
|
9
10
|
positive: "bg-primary/10 text-primary",
|
|
10
11
|
ok: "bg-status-ok-surface text-status-ok",
|
|
11
|
-
warn: "bg-
|
|
12
|
+
warn: "bg-status-warn-surface text-status-warn",
|
|
12
13
|
negative: "bg-status-bad-surface text-status-bad",
|
|
13
14
|
};
|
|
14
|
-
const TONE_VALUE = {
|
|
15
|
+
export const TONE_VALUE = {
|
|
15
16
|
default: "text-foreground",
|
|
16
17
|
positive: "text-primary",
|
|
17
18
|
ok: "text-status-ok",
|
|
18
|
-
warn: "text-
|
|
19
|
+
warn: "text-status-warn",
|
|
19
20
|
negative: "text-status-bad",
|
|
20
21
|
};
|
|
21
|
-
|
|
22
|
+
const TONE_STRIPE = {
|
|
23
|
+
default: "",
|
|
24
|
+
positive: "border-l-[3px] border-l-primary",
|
|
25
|
+
ok: "border-l-[3px] border-l-status-ok",
|
|
26
|
+
warn: "border-l-[3px] border-l-status-warn",
|
|
27
|
+
negative: "border-l-[3px] border-l-status-bad",
|
|
28
|
+
};
|
|
29
|
+
export function StatLinkFrame({ link, testId, children, }) {
|
|
22
30
|
const { Link } = usePrimitives();
|
|
23
31
|
if (link === undefined)
|
|
24
32
|
return children;
|
|
@@ -51,21 +59,30 @@ function StatIconChip({ icon, tone, accentColor, }) {
|
|
|
51
59
|
backgroundColor: `color-mix(in srgb, ${accentColor} 12%, transparent)`,
|
|
52
60
|
}, children: icon }));
|
|
53
61
|
}
|
|
62
|
+
function StatDeltaChip({ delta, tone, }) {
|
|
63
|
+
return (_jsxs("span", { className: cn("inline-flex shrink-0 items-center gap-0.5 whitespace-nowrap rounded-full px-1.5 py-0.5 text-xs font-medium tabular-nums", TONE_CHIP[delta.tone ?? tone]), children: [delta.direction === "up" ? "↑" : "↓", delta.value] }));
|
|
64
|
+
}
|
|
65
|
+
function statTileSurface(inset, boardPadding) {
|
|
66
|
+
if (inset)
|
|
67
|
+
return "bg-background px-3 py-2.5 shadow-none";
|
|
68
|
+
return boardPadding ? "px-3.5 py-3 max-sm:px-3 max-sm:py-2.5" : "p-4";
|
|
69
|
+
}
|
|
54
70
|
/** Icon-bearing metric tile with an optional delta chip, trend line,
|
|
55
71
|
* and sparkline. `icon` is a ready-made node (the app supplies its SVG). */
|
|
56
|
-
export function StatCard({ icon, label, value, sub, tone = "default", accentColor, delta, trend, spark, testId, link, children, }) {
|
|
72
|
+
export function StatCard({ icon, label, value, sub, tone = "default", accentColor, delta, trend, spark, testId, link, navigable = false, inset = false, subBelow = false, boardPadding = false, children, }) {
|
|
57
73
|
const { Card } = usePrimitives();
|
|
74
|
+
const leadsSomewhere = navigable || link !== undefined;
|
|
58
75
|
// StatCard is a reusable small-tile widget (a metrics dashboard grid, not
|
|
59
76
|
// a whole-section frame) — an extension section mounting several of
|
|
60
77
|
// these renders a grid of tiles inside its own host Card, not a
|
|
61
78
|
// duplicate outer frame around the section's full content.
|
|
62
|
-
const tile = (_jsxs(Card, { options: { padded: false }, className: "
|
|
79
|
+
const tile = (_jsxs(Card, { options: { padded: false }, className: cn("relative", statTileSurface(inset, boardPadding), TONE_STRIPE[tone]), testId: testId, children: [leadsSomewhere && (_jsx(ArrowUpRight, { className: "absolute right-3 top-3 size-3.5 text-muted-foreground", "aria-hidden": "true", "data-kumiko-layout": "stat-card-arrow" })), _jsxs("div", { className: cn("flex flex-wrap items-start justify-between gap-x-2 gap-y-1", leadsSomewhere && "pr-5"), children: [_jsxs("div", { className: "flex min-w-0 flex-1 basis-[7rem] items-center gap-2 text-muted-foreground", children: [icon !== undefined && _jsx(StatIconChip, { icon: icon, tone: tone, accentColor: accentColor }), _jsx("span", { title: label, className: "min-w-0 line-clamp-2 text-xs font-medium", children: label })] }), delta !== undefined && _jsx(StatDeltaChip, { delta: delta, tone: tone })] }), _jsxs("div", { className: "mt-1.5 flex flex-wrap items-baseline gap-x-2", children: [_jsx("span", { className: cn("text-xl font-semibold tabular-nums", boardPadding && "max-sm:text-[17px]", TONE_VALUE[tone]), children: value }), sub !== undefined && !subBelow && (_jsx("span", { className: "text-xs text-muted-foreground", children: sub }))] }), sub !== undefined && subBelow && (_jsx("div", { "data-kumiko-layout": "stat-card-sub", className: "mt-0.5 text-xs text-muted-foreground", children: sub })), trend !== undefined && (_jsx("div", { className: "mt-0.5 text-xs font-medium text-foreground/80", children: trend })), spark !== undefined && (_jsx(Sparkline, { points: spark, className: cn("mt-2 h-7 w-full", TONE_VALUE[tone]) })), children !== undefined && _jsx("div", { className: "mt-3", children: children })] }));
|
|
63
80
|
return (_jsx(StatLinkFrame, { link: link, testId: testId, children: tile }));
|
|
64
81
|
}
|
|
65
82
|
/** Flat KPI cell for a strip (divider instead of card): label, value with
|
|
66
83
|
* sparkline beside it, sub line. */
|
|
67
84
|
export function StatStripCell({ icon, label, value, sub, tone = "default", accentColor, delta, spark, testId, link, }) {
|
|
68
|
-
return (_jsx(StatLinkFrame, { link: link, testId: testId, children: _jsxs("div", { "data-testid": testId, className: "flex min-w-0 flex-col gap-1 px-4 py-3", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-2 gap-y-1", children: [_jsxs("span", { className: "flex min-w-0 items-center gap-2 text-xs font-medium text-muted-foreground", children: [icon !== undefined && (_jsx(StatIconChip, { icon: icon, tone: tone, accentColor: accentColor })), _jsx("span", { children: label })] }), delta !== undefined && (_jsxs("span", { className: cn("inline-flex shrink-0 items-center gap-0.5 whitespace-nowrap rounded-full px-1.5 py-0.5 text-xs font-medium tabular-nums", TONE_CHIP[delta.tone ?? tone]), children: [delta.direction === "up" ? "↑" : "↓", delta.value] }))] }), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("span", { className: cn("text-xl font-semibold tabular-nums", TONE_VALUE[tone]), children: value }), spark !== undefined && (_jsx(Sparkline, { points: spark, className: cn("h-7 w-20 shrink-0", TONE_VALUE[tone]) }))] }), sub !== undefined && _jsx("div", { className: "text-xs text-muted-foreground", children: sub })] }) }));
|
|
85
|
+
return (_jsx(StatLinkFrame, { link: link, testId: testId, children: _jsxs("div", { "data-testid": testId, className: "flex min-w-0 flex-col gap-1 px-4 py-3", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-2 gap-y-1", children: [_jsxs("span", { className: "flex min-w-0 items-center gap-2 text-xs font-medium text-muted-foreground", children: [icon !== undefined && (_jsx(StatIconChip, { icon: icon, tone: tone, accentColor: accentColor })), _jsx("span", { children: label })] }), delta !== undefined && (_jsxs("span", { className: cn("inline-flex shrink-0 items-center gap-0.5 whitespace-nowrap rounded-full px-1.5 py-0.5 text-xs font-medium tabular-nums", TONE_CHIP[delta.tone ?? tone]), children: [delta.direction === "up" ? "↑" : "↓", delta.value] }))] }), _jsxs("div", { className: "flex shrink-0 items-center gap-3", children: [_jsx("span", { className: cn("text-xl font-semibold tabular-nums", TONE_VALUE[tone]), children: value }), spark !== undefined && (_jsx(Sparkline, { points: spark, className: cn("h-7 w-20 shrink-0", TONE_VALUE[tone]) }))] }), sub !== undefined && _jsx("div", { className: "text-xs text-muted-foreground", children: sub })] }) }));
|
|
69
86
|
}
|
|
70
87
|
/** Compact metric tile (without an icon) — for dense KPI grids.
|
|
71
88
|
* StatCard is the icon-bearing variant. */
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
|
|
2
|
+
import type { StatusBadgeOptionTone, StatusTone } from "../../status-tone.ts";
|
|
3
|
+
export type { StatusTone };
|
|
3
4
|
export declare const STATUS_TONE_TEXT: Record<StatusTone, string>;
|
|
4
|
-
/** `accent` is a brand
|
|
5
|
-
|
|
6
|
-
export type StatusBadgeTone = StatusTone | "accent";
|
|
5
|
+
/** `accent` is a brand tone select options can request; toasts only use `StatusTone`. */
|
|
6
|
+
export type StatusBadgeTone = StatusBadgeOptionTone;
|
|
7
7
|
export declare const TONE_PILL: Record<StatusBadgeTone, string>;
|
|
8
8
|
/** Pill badge with a status dot. Caller maps domain values to a tone
|
|
9
9
|
* (e.g. operational→ok, investigating→warn) and passes the translated
|
|
10
10
|
* label as children. */
|
|
11
|
-
export declare function StatusBadge({ tone, children, className, testId, }: {
|
|
11
|
+
export declare function StatusBadge({ tone, children, className, testId, dot, }: {
|
|
12
12
|
readonly tone: StatusBadgeTone;
|
|
13
|
+
/** `false` draws the pill without its leading dot. */
|
|
14
|
+
readonly dot?: boolean;
|
|
13
15
|
readonly children: ReactNode;
|
|
14
16
|
readonly className?: string;
|
|
15
17
|
readonly testId?: string;
|
|
@@ -19,8 +19,8 @@ export const TONE_PILL = {
|
|
|
19
19
|
/** Pill badge with a status dot. Caller maps domain values to a tone
|
|
20
20
|
* (e.g. operational→ok, investigating→warn) and passes the translated
|
|
21
21
|
* label as children. */
|
|
22
|
-
export function StatusBadge({ tone, children, className, testId, }) {
|
|
22
|
+
export function StatusBadge({ tone, children, className, testId, dot = true, }) {
|
|
23
23
|
return (_jsxs("span", { "data-testid": testId, className: cn(
|
|
24
24
|
// Px on phones: an app may shrink its root font for desktop density, the phone reading size stays.
|
|
25
|
-
"inline-flex h-5 items-center gap-1.5 whitespace-nowrap rounded-full px-2 text-xs font-medium max-md:h-[20px] max-md:text-[12px]", TONE_PILL[tone], className), children: [_jsx("span", { "aria-hidden": "true", "data-status-dot": true, className: "size-1.5 shrink-0 rounded-full bg-current" }), children] }));
|
|
25
|
+
"inline-flex h-5 items-center gap-1.5 whitespace-nowrap rounded-full px-2 text-xs font-medium max-md:h-[20px] max-md:text-[12px]", TONE_PILL[tone], className), children: [dot && (_jsx("span", { "aria-hidden": "true", "data-status-dot": true, className: "size-1.5 shrink-0 rounded-full bg-current" })), children] }));
|
|
26
26
|
}
|
|
@@ -21,7 +21,7 @@ export declare function StepBar({ steps, currentIndex, compactLabel, onStepSelec
|
|
|
21
21
|
readonly doneSteps?: readonly boolean[];
|
|
22
22
|
readonly selectableSteps?: "done" | "all";
|
|
23
23
|
readonly narrowLayout?: "label" | "steps";
|
|
24
|
-
readonly orientation?: "horizontal" | "vertical";
|
|
24
|
+
readonly orientation?: "horizontal" | "vertical" | "stacked";
|
|
25
25
|
readonly heading?: string;
|
|
26
26
|
readonly description?: string;
|
|
27
27
|
readonly subtitles?: readonly (string | undefined)[];
|
|
@@ -12,6 +12,34 @@ function StepRailRow({ index, label, subtitle, subtitleTestId, rowTestId, state:
|
|
|
12
12
|
const content = (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", className: cn("flex size-[22px] shrink-0 items-center justify-center rounded-full border text-xs font-semibold", isCurrent && "border-primary bg-primary text-primary-foreground", isDone && "border-status-ok-surface bg-status-ok-surface text-status-ok", !isCurrent && !isDone && "border-input bg-card text-foreground-secondary"), children: isDone ? _jsx(Check, { className: "size-3" }) : index + 1 }), isDone && _jsx("span", { className: "sr-only", children: doneLabel }), _jsxs("span", { className: "flex min-w-0 flex-col", children: [_jsx("span", { children: label }), subtitle !== undefined && (_jsx("span", { "data-testid": subtitleTestId, className: "text-xs font-normal text-foreground-secondary", children: subtitle }))] })] }));
|
|
13
13
|
return isSelectable ? (_jsx("button", { type: "button", onClick: () => onSelect?.(index), "data-testid": rowTestId, className: cn(rowClass, "hover:bg-muted-foreground/10"), children: content })) : (_jsx("span", { "aria-current": isCurrent ? "step" : undefined, "data-testid": rowTestId, className: rowClass, children: content }));
|
|
14
14
|
}
|
|
15
|
+
function RailHeading({ heading, description, }) {
|
|
16
|
+
return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-sm font-semibold text-foreground", children: heading }), description !== undefined && (_jsx("span", { className: "text-[13px] text-foreground-secondary", children: description }))] }));
|
|
17
|
+
}
|
|
18
|
+
function UpNextBox({ upNext, testId, }) {
|
|
19
|
+
return (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-up-next` : undefined, className: "mt-2 flex flex-col gap-1 rounded-md border border-border bg-card px-3 py-2.5", children: [_jsx("span", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: upNext.heading }), _jsx("span", { className: "text-sm font-medium text-foreground", children: upNext.title }), upNext.subtitle !== undefined && (_jsx("span", { className: "text-xs text-foreground-secondary", children: upNext.subtitle }))] }));
|
|
20
|
+
}
|
|
21
|
+
// `selectable` is false without an onStepSelect handler, else the selectableSteps mode.
|
|
22
|
+
function stepStateAt(index, { currentIndex, doneSteps, selectable, }) {
|
|
23
|
+
const isCurrent = index === currentIndex;
|
|
24
|
+
const isDone = !isCurrent && (doneSteps !== undefined ? doneSteps[index] === true : index < currentIndex);
|
|
25
|
+
const isSelectable = selectable !== false && !isCurrent && (selectable === "all" || isDone);
|
|
26
|
+
return { isCurrent, isDone, isSelectable };
|
|
27
|
+
}
|
|
28
|
+
function ChainMarker({ state }) {
|
|
29
|
+
const { isCurrent, isDone } = state;
|
|
30
|
+
return (_jsxs("span", { "aria-hidden": "true", className: cn("z-10 mt-0.5 flex size-[18px] shrink-0 items-center justify-center rounded-full border-2 bg-card", isDone && "border-status-ok bg-status-ok text-primary-foreground", isCurrent && "border-status-warn", !isDone && !isCurrent && "border-input"), children: [isDone && _jsx(Check, { className: "size-3", strokeWidth: 3 }), isCurrent && _jsx("span", { className: "size-2 rounded-full bg-status-warn" })] }));
|
|
31
|
+
}
|
|
32
|
+
// Chain look: a vertical connector joins the markers; done is a filled check, current a ring with
|
|
33
|
+
// a dot (title in the warn tone), open an empty ring. No numbers, no box around the current step.
|
|
34
|
+
function StackedStageList({ steps, subtitles, stepState, onSelect, doneLabel, testId, }) {
|
|
35
|
+
const keyed = steps.map((label, index) => ({ label, index, key: `${index}-${label}` }));
|
|
36
|
+
return (_jsx("ol", { "data-testid": testId, className: "m-0 flex list-none flex-col p-0", children: keyed.map(({ label, index, key }) => {
|
|
37
|
+
const state = stepState(index);
|
|
38
|
+
const subtitle = subtitles?.[index];
|
|
39
|
+
const body = (_jsxs(_Fragment, { children: [_jsxs("span", { className: "relative flex flex-col items-center self-stretch", children: [_jsx(ChainMarker, { state: state }), index < keyed.length - 1 && (_jsx("span", { "aria-hidden": "true", "data-kumiko-layout": "step-chain-connector", className: "absolute -bottom-0.5 left-1/2 top-5 w-px -translate-x-1/2 bg-input" }))] }), state.isDone && _jsx("span", { className: "sr-only", children: doneLabel }), _jsxs("span", { className: "flex min-w-0 flex-col pb-3", children: [_jsx("span", { className: cn("text-sm", state.isCurrent ? "font-semibold text-status-warn" : "text-foreground", !state.isCurrent && !state.isDone && "text-foreground-secondary"), children: label }), subtitle !== undefined && (_jsx("span", { "data-testid": testId !== undefined ? `${testId}-subtitle-${index}` : undefined, className: "text-xs text-foreground-secondary", children: subtitle }))] })] }));
|
|
40
|
+
return (_jsx("li", { children: state.isSelectable ? (_jsx("button", { type: "button", onClick: () => onSelect?.(index), "data-testid": chipTestId(testId, index), className: "flex w-full items-stretch gap-2.5 text-left hover:opacity-80", children: body })) : (_jsx("span", { "aria-current": state.isCurrent ? "step" : undefined, "data-testid": chipTestId(testId, index), className: "flex w-full items-stretch gap-2.5", children: body })) }, key));
|
|
41
|
+
}) }));
|
|
42
|
+
}
|
|
15
43
|
function CompactStepPicker({ steps, compactLabel, subtitles, stepState, onStepSelect, compactTestId, doneLabel, }) {
|
|
16
44
|
const [open, setOpen] = useState(false);
|
|
17
45
|
const listId = useId();
|
|
@@ -42,16 +70,18 @@ function CompactStepPicker({ steps, compactLabel, subtitles, stepState, onStepSe
|
|
|
42
70
|
* pattern as embedded-list-input.tsx's desktop/mobile split). */
|
|
43
71
|
export function StepBar({ steps, currentIndex, compactLabel, onStepSelect, doneSteps, selectableSteps = "done", narrowLayout = "label", orientation = "horizontal", heading, description, subtitles, upNext, testId, compactTestId, }) {
|
|
44
72
|
const t = useTranslation();
|
|
45
|
-
const stepState = (i) => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
73
|
+
const stepState = (i) => stepStateAt(i, {
|
|
74
|
+
currentIndex,
|
|
75
|
+
doneSteps,
|
|
76
|
+
selectable: onStepSelect !== undefined && selectableSteps,
|
|
77
|
+
});
|
|
51
78
|
const compactPicker = onStepSelect !== undefined && selectableSteps === "all";
|
|
52
79
|
const pickerElement = compactPicker ? (_jsx(CompactStepPicker, { steps: steps, compactLabel: compactLabel, subtitles: subtitles, stepState: stepState, onStepSelect: onStepSelect, compactTestId: compactTestId, doneLabel: t("kumiko.widget.step-bar.done") })) : null;
|
|
80
|
+
if (orientation === "stacked") {
|
|
81
|
+
return (_jsx(StackedStageList, { steps: steps, subtitles: subtitles, stepState: stepState, onSelect: onStepSelect, doneLabel: t("kumiko.widget.step-bar.done"), testId: testId }));
|
|
82
|
+
}
|
|
53
83
|
if (orientation === "vertical") {
|
|
54
|
-
return (_jsxs(_Fragment, { children: [_jsxs("nav", { className: "hidden w-[280px] shrink-0 flex-col gap-4 overflow-y-auto border-r border-border bg-muted px-6 py-7 lg:flex", children: [heading !== undefined &&
|
|
84
|
+
return (_jsxs(_Fragment, { children: [_jsxs("nav", { className: "hidden w-[280px] shrink-0 flex-col gap-4 overflow-y-auto border-r border-border bg-muted px-6 py-7 lg:flex", children: [heading !== undefined && _jsx(RailHeading, { heading: heading, description: description }), _jsx("ol", { "data-testid": testId, className: "m-0 flex list-none flex-col gap-0.5 p-0", children: steps.map((label, i) => (_jsx("li", { children: _jsx(StepRailRow, { index: i, label: label, subtitle: subtitles?.[i], subtitleTestId: testId !== undefined ? `${testId}-subtitle-${i}` : undefined, rowTestId: chipTestId(testId, i), state: stepState(i), onSelect: onStepSelect, doneLabel: t("kumiko.widget.step-bar.done") }) }, `${i}-${label}`))) }), upNext !== undefined && _jsx(UpNextBox, { upNext: upNext, testId: testId })] }), compactPicker ? (_jsx("div", { className: "px-4 pt-3 lg:hidden", children: pickerElement })) : (_jsx("p", { "data-testid": compactTestId, className: "px-4 pt-3 text-sm text-muted-foreground lg:hidden", children: compactLabel }))] }));
|
|
55
85
|
}
|
|
56
86
|
return (_jsxs(_Fragment, { children: [_jsx("ol", { "data-testid": testId, className: cn("items-center gap-2", narrowLayout === "steps" ? "flex flex-wrap" : "hidden sm:flex sm:flex-wrap"), children: steps.map((label, i) => {
|
|
57
87
|
const { isCurrent, isDone, isSelectable } = stepState(i);
|
|
@@ -14,6 +14,8 @@ export type StepTag = {
|
|
|
14
14
|
readonly tone?: "accent" | "muted" | "warn" | "ok" | "bad";
|
|
15
15
|
/** A note about the step's history (e.g. just changed) reads after what it waits for. */
|
|
16
16
|
readonly afterWaiting?: boolean;
|
|
17
|
+
/** Sits in the right column of the row, above a trailing link (e.g. a risk chip over "Preview"). */
|
|
18
|
+
readonly side?: true;
|
|
17
19
|
};
|
|
18
20
|
export type StepListItem = {
|
|
19
21
|
readonly id: string;
|
|
@@ -52,6 +54,8 @@ export declare function StepActionButton({ action, className, }: {
|
|
|
52
54
|
}): ReactNode;
|
|
53
55
|
export type StepRowSelection = {
|
|
54
56
|
readonly state: StepSelectionState;
|
|
57
|
+
/** The checkbox replaces the status icon of a selectable row. */
|
|
58
|
+
readonly compact?: true;
|
|
55
59
|
readonly onToggle: () => void;
|
|
56
60
|
};
|
|
57
61
|
export declare function StepRow({ step, phoneCard, selection, }: {
|
|
@@ -48,12 +48,12 @@ function StatusIcon({ step }) {
|
|
|
48
48
|
function tagTone(tone) {
|
|
49
49
|
return tone ?? "muted";
|
|
50
50
|
}
|
|
51
|
-
function StepLink({ link }) {
|
|
51
|
+
function StepLink({ link, compact = false, }) {
|
|
52
52
|
const { Link, Button } = usePrimitives();
|
|
53
53
|
if (link.href !== undefined) {
|
|
54
|
-
return (_jsx(Link, { href: link.href, onPress: link.onClick, className: "shrink-0 text-[13px] font-medium underline underline-offset-2", children: link.label }));
|
|
54
|
+
return (_jsx(Link, { href: link.href, onPress: link.onClick, className: cn("shrink-0 text-[13px] font-medium underline underline-offset-2", compact && "font-normal text-primary no-underline"), children: link.label }));
|
|
55
55
|
}
|
|
56
|
-
return (_jsx(Button, { variant: "link", size: "sm", onClick: link.onClick, className: "shrink-0 text-[13px]", children: link.label }));
|
|
56
|
+
return (_jsx(Button, { variant: "link", size: "sm", onClick: link.onClick, className: cn("shrink-0 text-[13px]", compact && "h-auto p-0 font-normal"), children: link.label }));
|
|
57
57
|
}
|
|
58
58
|
function StepBelowLink({ link }) {
|
|
59
59
|
const { Button } = usePrimitives();
|
|
@@ -64,8 +64,9 @@ export function StepActionButton({ action, className, }) {
|
|
|
64
64
|
return (_jsx(Button, { size: "sm", variant: action.variant ?? "secondary", disabled: action.disabled, loading: action.pending, onClick: action.onClick, testId: `step-action-${action.id}`, className: cn("max-md:text-[14px]", className), children: action.label }));
|
|
65
65
|
}
|
|
66
66
|
// A long reason ("Wartet auf: Whg. 3, Stellplatz 7, …") is cut at the column edge instead of running out of it.
|
|
67
|
-
function StepTagBadge({ tone, label, className, }) {
|
|
68
|
-
return (_jsx("span", { className: "flex min-w-0 max-w-full", title: label, children: _jsx(StatusBadge, { tone: tone, className: cn("min-w-0 max-w-full",
|
|
67
|
+
function StepTagBadge({ tone, label, className, chip, }) {
|
|
68
|
+
return (_jsx("span", { className: "flex min-w-0 max-w-full", title: label, children: _jsx(StatusBadge, { tone: tone, dot: chip !== true, className: cn("min-w-0 max-w-full", chip === true &&
|
|
69
|
+
"h-auto rounded px-1.5 py-0.5 text-[11px] max-md:h-auto max-md:text-[11px]", className), children: _jsx("span", { className: "truncate", children: label }) }) }));
|
|
69
70
|
}
|
|
70
71
|
// Sources and tags share one line: a source link and the step it waits for read as one fact.
|
|
71
72
|
// The phone card reads the waiting reason as a plain second line, not as a pill.
|
|
@@ -118,22 +119,29 @@ function StepSelectionCell({ step, selection, }) {
|
|
|
118
119
|
: state.kind === "blocked"
|
|
119
120
|
? t("kumiko.widget.step-list.prerequisiteNotSelectable", { title: state.blockedBy })
|
|
120
121
|
: undefined;
|
|
121
|
-
return (_jsxs("span", { className: "flex h-5 w-4 shrink-0 items-center",
|
|
122
|
+
return (_jsxs("span", { className: cn("flex h-5 w-4 shrink-0 items-center", selection.compact === true && "mt-px h-[18px] w-[18px]"), children: [_jsx(Checkbox, { className: cn(selection.compact === true &&
|
|
123
|
+
"size-[18px] border-[1.5px] border-border-strong data-[state=checked]:border-primary [&_svg]:size-3"), "aria-label": t("kumiko.widget.step-list.selectStep", { title: step.title }), checked: state.kind === "selectable" && state.checked, disabled: state.kind !== "selectable", onCheckedChange: selection.onToggle, "data-testid": `step-${step.id}-select`, ...(reason !== undefined && { title: reason, "aria-describedby": reasonId }) }), reason !== undefined && (_jsx("span", { id: reasonId, className: "sr-only", children: reason }))] }));
|
|
122
124
|
}
|
|
123
125
|
function isAutoSelected(selection) {
|
|
124
126
|
return selection?.state.kind === "selectable" && selection.state.neededFor !== undefined;
|
|
125
127
|
}
|
|
126
|
-
function stepRowClassName(step, autoSelected) {
|
|
127
|
-
return cn("flex gap-2.5 border-b border-border-row px-4 py-3", autoSelected &&
|
|
128
|
+
function stepRowClassName(step, autoSelected, compact) {
|
|
129
|
+
return cn("flex gap-2.5 border-b border-border-row px-4 py-3", compact && "px-3 py-[9px] text-[13px]", autoSelected &&
|
|
128
130
|
"relative before:absolute before:inset-y-0 before:left-0 before:w-[3px] before:bg-primary/60", step.status === "open" && "bg-card", step.highlighted === true && "bg-status-warn-surface");
|
|
129
131
|
}
|
|
130
|
-
function StepRowText({ step, shownStep, phoneCard, }) {
|
|
131
|
-
return (_jsxs("div", { className: "flex min-w-0 grow flex-col gap-1", children: [_jsx("span", { className: cn("font-medium", step.status === "rejected" && "text-muted-foreground line-through"), "data-testid": `step-${step.id}-title`, children: step.title }), step.description !== undefined && (_jsx("span", { className: "text-[13px] text-foreground-secondary", children: step.description })), _jsx(StepSourcesAndTags, { step: shownStep, phoneCard: phoneCard }), step.meta !== undefined && (_jsx("span", { className: "text-[13px] text-muted-foreground", children: step.meta })), step.link?.placement === "below" && _jsx(StepBelowLink, { link: step.link }), _jsx(StepActions, { step: step })] }));
|
|
132
|
+
function StepRowText({ step, shownStep, phoneCard, compact, }) {
|
|
133
|
+
return (_jsxs("div", { className: "flex min-w-0 grow flex-col gap-1", children: [_jsx("span", { className: cn("font-medium", step.status === "rejected" && "text-muted-foreground line-through"), "data-testid": `step-${step.id}-title`, children: step.title }), step.description !== undefined && (_jsx("span", { className: cn("text-[13px] text-foreground-secondary", compact && "text-xs text-muted-foreground"), children: step.description })), _jsx(StepSourcesAndTags, { step: shownStep, phoneCard: phoneCard }), step.meta !== undefined && (_jsx("span", { className: "text-[13px] text-muted-foreground", children: step.meta })), step.link?.placement === "below" && _jsx(StepBelowLink, { link: step.link }), _jsx(StepActions, { step: step })] }));
|
|
132
134
|
}
|
|
133
135
|
export function StepRow({ step, phoneCard = false, selection, }) {
|
|
134
136
|
const t = useTranslation();
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
const sideTags = (step.tags ?? []).filter((tag) => tag.side === true);
|
|
138
|
+
const bodyTags = (step.tags ?? []).filter((tag) => tag.side !== true);
|
|
139
|
+
const shownStep = {
|
|
140
|
+
...step,
|
|
141
|
+
tags: selection === undefined ? bodyTags : [...bodyTags, ...selectionTags(selection.state, t)],
|
|
142
|
+
};
|
|
143
|
+
const compact = selection?.compact === true;
|
|
144
|
+
const trailingLink = step.link !== undefined && step.link.placement !== "below" ? (_jsx(StepLink, { link: step.link, compact: compact })) : null;
|
|
145
|
+
const replacesStatusIcon = compact && selection.state.kind === "selectable";
|
|
146
|
+
return (_jsxs("li", { "data-testid": `step-${step.id}`, className: stepRowClassName(step, isAutoSelected(selection), compact), ...(step.highlighted === true && { "aria-current": "step" }), children: [selection !== undefined && _jsx(StepSelectionCell, { step: step, selection: selection }), !replacesStatusIcon && _jsx(StatusIcon, { step: step }), _jsx(StepRowText, { step: step, shownStep: shownStep, phoneCard: phoneCard, compact: compact }), sideTags.length > 0 ? (_jsxs("div", { className: "flex shrink-0 flex-col items-end gap-1", "data-testid": `step-${step.id}-side`, children: [sideTags.map((tag) => (_jsx(StepTagBadge, { tone: tagTone(tag.tone), label: tag.label, chip: true }, tag.label))), trailingLink] })) : (trailingLink)] }));
|
|
139
147
|
}
|
|
@@ -4,8 +4,12 @@ import { type StepAction, type StepListItem } from "./step-list-row.tsx";
|
|
|
4
4
|
export type { StepAction, StepListItem, StepSelectability, StepSource, StepStatus, StepTag, } from "./step-list-row.tsx";
|
|
5
5
|
export type StepSelectionAction = {
|
|
6
6
|
readonly id: string;
|
|
7
|
-
/** Without a number: the list appends " (n)" with the effective selection size. */
|
|
7
|
+
/** Without a number: the list appends " (n)" with the effective selection size (see `labelForCount`). */
|
|
8
8
|
readonly label: string;
|
|
9
|
+
/** Replaces the appended " (n)": the label for the effective selection size. The action is disabled at 0. */
|
|
10
|
+
readonly labelForCount?: (count: number) => string;
|
|
11
|
+
/** No counter, never disabled by an empty selection (e.g. "Review one by one"); `onClick` still gets the selection. */
|
|
12
|
+
readonly ignoresSelection?: true;
|
|
9
13
|
/** Receives the effective selection in list order, prerequisites included. */
|
|
10
14
|
readonly onClick: (stepIds: readonly string[]) => void;
|
|
11
15
|
readonly variant?: "primary" | "secondary" | "ghost";
|
|
@@ -18,6 +22,8 @@ export type StepListSelection = {
|
|
|
18
22
|
readonly onSelectionChange: (selectedIds: readonly string[]) => void;
|
|
19
23
|
/** Replace `footerActions` while at least one step is selected. */
|
|
20
24
|
readonly actions: readonly StepSelectionAction[];
|
|
25
|
+
/** Phone-card style: no select-all row, the actions stay visible at 0 selected (disabled unless `ignoresSelection`), a muted header and left-aligned footer. */
|
|
26
|
+
readonly compact?: true;
|
|
21
27
|
};
|
|
22
28
|
export type StepListProps = {
|
|
23
29
|
readonly title: string;
|
|
@@ -31,6 +37,8 @@ export type StepListProps = {
|
|
|
31
37
|
readonly steps: readonly StepListItem[];
|
|
32
38
|
/** Footer row: a ghost action for the whole list next to the primary next-step action. */
|
|
33
39
|
readonly footerActions?: readonly StepAction[];
|
|
40
|
+
/** Quiet line under the footer actions, e.g. "Nothing is saved without you." */
|
|
41
|
+
readonly footerNote?: string;
|
|
34
42
|
/** Show only the first n steps plus "und k weitere Schritte" (expands on click). */
|
|
35
43
|
readonly collapsedAfter?: number;
|
|
36
44
|
/** "always" (default) folds after `collapsedAfter`; "overflow" folds a `fill` list only when its steps do not fit its height, then shows as many as fit but at least `collapsedAfter`. */
|
|
@@ -39,8 +47,8 @@ export type StepListProps = {
|
|
|
39
47
|
readonly surface?: "ai" | "plain";
|
|
40
48
|
/** Stretch to the container height: steps scroll in the middle, the footer stays pinned at the bottom. */
|
|
41
49
|
readonly fill?: boolean;
|
|
42
|
-
/** "full" (default) = "x von y erledigt" plus bar, "count" = only the count, "none" = neither, e.g. when `status` already says the list is done. */
|
|
43
|
-
readonly progress?: "full" | "count" | "none";
|
|
50
|
+
/** "full" (default) = "x von y erledigt" plus bar, "count" = only the count, "total" = only "n steps" (rejected ones left out), "none" = neither, e.g. when `status` already says the list is done. */
|
|
51
|
+
readonly progress?: "full" | "count" | "total" | "none";
|
|
44
52
|
readonly emptyContent?: ReactNode;
|
|
45
53
|
/** Adds a checkbox per selectable step, a select-all row and selection footer actions. */
|
|
46
54
|
readonly selection?: StepListSelection;
|
|
@@ -49,4 +57,4 @@ export type StepListProps = {
|
|
|
49
57
|
readonly testId?: string;
|
|
50
58
|
};
|
|
51
59
|
/** Ordered plan of steps with status icons, progress header and per-step actions. */
|
|
52
|
-
export declare function StepList({ title, subtitle, status, steps, footerActions, collapsedAfter, collapseWhen, surface, fill, progress, emptyContent, selection, phoneCard, testId, }: StepListProps): ReactNode;
|
|
60
|
+
export declare function StepList({ title, subtitle, status, steps, footerActions, footerNote, collapsedAfter, collapseWhen, surface, fill, progress, emptyContent, selection, phoneCard, testId, }: StepListProps): ReactNode;
|
|
@@ -10,20 +10,26 @@ import { useStepFold } from "./step-list-fit.js";
|
|
|
10
10
|
import { StepActionButton, StepRow, } from "./step-list-row.js";
|
|
11
11
|
import { resolveStepSelection, toggleAllStepSelection, toggleStepSelection, } from "./step-list-selection.js";
|
|
12
12
|
function selectionFooterActions(selection, summary, t) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
const count = summary.selectedCount;
|
|
14
|
+
return selection.actions.map((action) => {
|
|
15
|
+
const ignoresSelection = action.ignoresSelection === true;
|
|
16
|
+
const label = ignoresSelection
|
|
17
|
+
? action.label
|
|
18
|
+
: action.labelForCount !== undefined
|
|
19
|
+
? action.labelForCount(count)
|
|
20
|
+
: t("kumiko.widget.step-list.actionWithCount", { label: action.label, count });
|
|
21
|
+
return {
|
|
22
|
+
id: action.id,
|
|
23
|
+
label,
|
|
24
|
+
onClick: () => action.onClick(summary.effectiveIds),
|
|
25
|
+
variant: action.variant,
|
|
26
|
+
disabled: action.disabled === true || (!ignoresSelection && count === 0),
|
|
27
|
+
pending: action.pending,
|
|
28
|
+
};
|
|
29
|
+
});
|
|
24
30
|
}
|
|
25
31
|
/** Ordered plan of steps with status icons, progress header and per-step actions. */
|
|
26
|
-
export function StepList({ title, subtitle, status, steps, footerActions, collapsedAfter, collapseWhen = "always", surface = "ai", fill = false, progress = "full", emptyContent, selection, phoneCard = false, testId = "step-list", }) {
|
|
32
|
+
export function StepList({ title, subtitle, status, steps, footerActions, footerNote, collapsedAfter, collapseWhen = "always", surface = "ai", fill = false, progress = "full", emptyContent, selection, phoneCard = false, testId = "step-list", }) {
|
|
27
33
|
const [expanded, setExpanded] = useState(false);
|
|
28
34
|
const { total, done } = countProgress(steps);
|
|
29
35
|
const { visibleSteps, hiddenCount, listRef } = useStepFolding({
|
|
@@ -36,7 +42,8 @@ export function StepList({ title, subtitle, status, steps, footerActions, collap
|
|
|
36
42
|
const { summary, footer, selectionFooterActive } = model;
|
|
37
43
|
return (_jsxs("section", { "aria-label": title, "data-testid": testId, className: cn(
|
|
38
44
|
// Px on phones: an app may shrink its root font for desktop density, the phone reading size stays.
|
|
39
|
-
"flex min-h-0 flex-col text-sm max-md:text-[14px]", fill && "h-full", surface === "ai" && "bg-ai-surface", phoneCard && "max-md:rounded-md max-md:p-3"
|
|
45
|
+
"flex min-h-0 flex-col text-sm max-md:text-[14px]", fill && "h-full", surface === "ai" && "bg-ai-surface", phoneCard && "max-md:rounded-md max-md:p-3", selection?.compact === true &&
|
|
46
|
+
"overflow-hidden rounded-lg border border-border bg-card max-md:p-0"), children: [_jsx(StepListHeader, { title: title, subtitle: subtitle, status: status, progress: progress, done: done, total: total, phoneCard: phoneCard, compact: selection?.compact === true, testId: testId }), _jsx(SelectAllSection, { steps: steps, selection: selection, summary: summary, phoneCard: phoneCard }), steps.length === 0 ? (emptyContent) : (_jsx(StepListRows, { steps: steps, visibleSteps: visibleSteps, hiddenCount: hiddenCount, listRef: listRef, selection: selection, summary: summary, phoneCard: phoneCard, onExpand: () => setExpanded(true), testId: testId })), _jsx(StepListFooter, { footer: footer, note: footerNote, selectionActive: selectionFooterActive, compact: selection?.compact === true })] }));
|
|
40
47
|
}
|
|
41
48
|
function countProgress(steps) {
|
|
42
49
|
return {
|
|
@@ -60,7 +67,9 @@ function useStepFolding(input) {
|
|
|
60
67
|
function useSelectionModel(steps, selection, footerActions) {
|
|
61
68
|
const t = useTranslation();
|
|
62
69
|
const summary = selection === undefined ? undefined : resolveStepSelection(steps, selection.selectedIds);
|
|
63
|
-
if (selection !== undefined &&
|
|
70
|
+
if (selection !== undefined &&
|
|
71
|
+
summary !== undefined &&
|
|
72
|
+
(summary.selectedCount > 0 || selection.compact === true)) {
|
|
64
73
|
return {
|
|
65
74
|
summary,
|
|
66
75
|
footer: selectionFooterActions(selection, summary, t),
|
|
@@ -72,12 +81,15 @@ function useSelectionModel(steps, selection, footerActions) {
|
|
|
72
81
|
function SelectAllSection({ steps, selection, summary, phoneCard, }) {
|
|
73
82
|
if (selection === undefined || summary === undefined || steps.length === 0)
|
|
74
83
|
return null;
|
|
84
|
+
if (selection.compact === true)
|
|
85
|
+
return null;
|
|
75
86
|
return (_jsx(SelectAllRow, { summary: summary, phoneCard: phoneCard, onToggle: () => selection.onSelectionChange(toggleAllStepSelection(steps, selection.selectedIds)) }));
|
|
76
87
|
}
|
|
77
88
|
function rowSelectionFor(step, steps, selection, summary) {
|
|
78
89
|
if (selection === undefined || summary === undefined)
|
|
79
90
|
return undefined;
|
|
80
91
|
return {
|
|
92
|
+
...(selection.compact === true && { compact: true }),
|
|
81
93
|
state: summary.states.get(step.id) ?? { kind: "none" },
|
|
82
94
|
onToggle: () => selection.onSelectionChange(toggleStepSelection(steps, selection.selectedIds, step.id)),
|
|
83
95
|
};
|
|
@@ -86,18 +98,22 @@ function StepListRows({ steps, visibleSteps, hiddenCount, listRef, selection, su
|
|
|
86
98
|
const t = useTranslation();
|
|
87
99
|
const { Button } = usePrimitives();
|
|
88
100
|
return (_jsxs("ol", { ref: listRef, className: cn("m-0 min-h-0 grow list-none overflow-y-auto p-0", phoneCard &&
|
|
89
|
-
"max-md:rounded-md max-md:border max-md:border-border max-md:bg-card max-md:[&>li:last-child]:border-b-0 max-md:[&>li]:px-3 max-md:[&>li]:py-2.5", selection !== undefined && phoneCard && "max-md:rounded-t-none"), children: [visibleSteps.map((step) => {
|
|
101
|
+
"max-md:rounded-md max-md:border max-md:border-border max-md:bg-card max-md:[&>li:last-child]:border-b-0 max-md:[&>li]:px-3 max-md:[&>li]:py-2.5", selection !== undefined && phoneCard && "max-md:rounded-t-none", selection?.compact === true && "border-t border-border-row [&>li:last-child]:border-b-0"), children: [visibleSteps.map((step) => {
|
|
90
102
|
const rowSelection = rowSelectionFor(step, steps, selection, summary);
|
|
91
103
|
return (_jsx(StepRow, { step: step, phoneCard: phoneCard, ...(rowSelection !== undefined && { selection: rowSelection }) }, step.id));
|
|
92
104
|
}), hiddenCount > 0 && (_jsx("li", { className: "px-4 py-3", children: _jsx(Button, { variant: "link", size: "sm", className: "text-[13px] font-normal text-foreground-secondary hover:text-foreground", onClick: onExpand, testId: `${testId}-more`, children: t("kumiko.widget.step-list.moreSteps", { count: hiddenCount }) }) }))] }));
|
|
93
105
|
}
|
|
94
|
-
function StepListFooter({ footer, selectionActive, }) {
|
|
95
|
-
if (footer.length === 0)
|
|
106
|
+
function StepListFooter({ footer, note, selectionActive, compact, }) {
|
|
107
|
+
if (footer.length === 0 && note === undefined)
|
|
96
108
|
return null;
|
|
109
|
+
const noteLine = note !== undefined && (_jsx("p", { className: "m-0 w-full text-[11.5px] text-muted-foreground", "data-testid": "step-list-note", children: note }));
|
|
110
|
+
if (compact) {
|
|
111
|
+
return (_jsxs("div", { className: "flex shrink-0 flex-wrap items-center gap-2 border-t border-border px-3 py-2.5", children: [footer.map((action) => (_jsx(StepActionButton, { action: action, className: "h-[26px] px-[9px] text-[12.5px] max-md:text-[12.5px]" }, action.id))), noteLine] }));
|
|
112
|
+
}
|
|
97
113
|
const leading = footer.filter((action) => action.variant === "ghost");
|
|
98
114
|
const trailing = footer.filter((action) => action.variant !== "ghost");
|
|
99
115
|
const phoneHeight = selectionActive ? "max-md:h-11" : undefined;
|
|
100
|
-
return (_jsxs("div", { className: "flex shrink-0 items-center gap-2 border-t border-border px-4 py-2.5", children: [leading.map((action) => (_jsx(StepActionButton, { action: action, className: phoneHeight }, action.id))), _jsx("div", { className: cn("grow", selectionActive && "max-md:hidden") }), trailing.map((action) => (_jsx(StepActionButton, { action: action, className: cn(phoneHeight, selectionActive && "max-md:grow max-md:justify-center") }, action.id)))] }));
|
|
116
|
+
return (_jsxs("div", { className: cn("flex shrink-0 items-center gap-2 border-t border-border px-4 py-2.5", note !== undefined && "flex-wrap"), children: [leading.map((action) => (_jsx(StepActionButton, { action: action, className: phoneHeight }, action.id))), _jsx("div", { className: cn("grow", selectionActive && "max-md:hidden") }), trailing.map((action) => (_jsx(StepActionButton, { action: action, className: cn(phoneHeight, selectionActive && "max-md:grow max-md:justify-center") }, action.id))), noteLine] }));
|
|
101
117
|
}
|
|
102
118
|
function SelectAllRow({ summary, phoneCard, onToggle, }) {
|
|
103
119
|
const t = useTranslation();
|
|
@@ -115,7 +131,9 @@ function SelectAllRow({ summary, phoneCard, onToggle, }) {
|
|
|
115
131
|
return (_jsxs("div", { className: cn("flex shrink-0 items-center gap-2.5 border-b border-border bg-card/60 px-4 py-2", phoneCard &&
|
|
116
132
|
"max-md:rounded-t-md max-md:border max-md:border-b-0 max-md:bg-card max-md:px-3"), "data-testid": "step-list-select-all", children: [_jsx(Checkbox, { "aria-label": t("kumiko.widget.step-list.selectAll"), checked: checked, disabled: !summary.hasSelectableSteps, onCheckedChange: onToggle }), _jsx("span", { className: "text-[13px] font-medium", children: t("kumiko.widget.step-list.selectAll") }), _jsxs("span", { className: "grow text-right text-[13px] text-muted-foreground", children: [countText, missingText] })] }));
|
|
117
133
|
}
|
|
118
|
-
function StepListHeader({ title, subtitle, status, progress, done, total, phoneCard, testId, }) {
|
|
134
|
+
function StepListHeader({ title, subtitle, status, progress, done, total, phoneCard, compact, testId, }) {
|
|
119
135
|
const t = useTranslation();
|
|
120
|
-
return (_jsxs("div", { className: cn("flex shrink-0 flex-col gap-2 border-b border-border px-4 pb-3 pt-3.5", phoneCard && "max-md:border-b-0 max-md:px-0 max-md:pb-1.5 max-md:pt-0"), children: [_jsxs("div", { className: "flex items-baseline gap-2", children: [_jsx("h3", { className: "m-0 grow text-[15px] font-semibold", children: title }), status !== undefined && (_jsx(StatusBadge, { tone: status.tone, testId: `${testId}-status`, children: status.label })), progress !== "none" && (_jsx("span", { className: "text-[13px] text-muted-foreground",
|
|
136
|
+
return (_jsxs("div", { className: cn("flex shrink-0 flex-col gap-2 border-b border-border px-4 pb-3 pt-3.5", phoneCard && "max-md:border-b-0 max-md:px-0 max-md:pb-1.5 max-md:pt-0", compact && "border-b-0 bg-muted px-3 py-2.5 max-md:px-3 max-md:py-2.5"), children: [_jsxs("div", { className: "flex items-baseline gap-2", children: [_jsx("h3", { className: cn("m-0 grow text-[15px] font-semibold", compact && "text-[13px]"), children: title }), status !== undefined && (_jsx(StatusBadge, { tone: status.tone, testId: `${testId}-status`, children: status.label })), progress !== "none" && (_jsx("span", { className: cn("text-[13px] text-muted-foreground", compact && "text-xs"), "data-testid": `${testId}-progress`, children: progress === "total"
|
|
137
|
+
? t(pluralKey("kumiko.widget.step-list.total", total), { count: total })
|
|
138
|
+
: t("kumiko.widget.step-list.progress", { done, total }) }))] }), subtitle !== undefined && (_jsx("p", { className: "m-0 text-[13px] text-foreground-secondary", "data-testid": `${testId}-subtitle`, children: subtitle })), progress === "full" && (_jsx("div", { className: cn(phoneCard && "max-md:hidden"), children: _jsx(ProgressBar, { size: "thin", value: total === 0 ? 0 : done / total, ariaLabel: t("kumiko.widget.step-list.progressLabel") }) }))] }));
|
|
121
139
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
+
import type { TrackFormUpload } from "../../components/form-pending-uploads.tsx";
|
|
2
3
|
export type UploadZoneProps = {
|
|
3
4
|
/** Uploads a single file (POST + optional follow-up mutation). Throws on
|
|
4
5
|
* failure — the message ends up in the row's error line. Runs in
|
|
@@ -23,6 +24,12 @@ export type UploadZoneProps = {
|
|
|
23
24
|
/** The values the owner currently holds. Done rows whose value left the list disappear, and
|
|
24
25
|
* going from some to none (an external reset) clears every row, error rows included. */
|
|
25
26
|
readonly doneValues?: readonly string[];
|
|
27
|
+
/** Wraps the whole per-file work, image resize included, so a surrounding form can hold
|
|
28
|
+
* back submit while the file is still being prepared. */
|
|
29
|
+
readonly trackUpload?: TrackFormUpload;
|
|
30
|
+
/** Row label of a value the owner already held (e.g. a FileRef id resolved to its file name).
|
|
31
|
+
* Default: the value itself. */
|
|
32
|
+
readonly labelForValue?: (value: string) => ReactNode;
|
|
26
33
|
};
|
|
27
34
|
export declare function matchesAccept(file: File, accept?: readonly string[]): boolean;
|
|
28
35
|
/** Drop zone + multi-file picker with a per-file status row (uploading/done/
|
|
@@ -30,4 +37,4 @@ export declare function matchesAccept(file: File, accept?: readonly string[]): b
|
|
|
30
37
|
* independently — unlike `FileField` (single file, FileRef value inside a
|
|
31
38
|
* form field). `onUpload` decides what "upload" means (storage POST, ingest
|
|
32
39
|
* mutation, or both); the zone only tracks uploading/done/error. */
|
|
33
|
-
export declare function UploadZone({ onUpload, title, hint, accept, multiple, capture, disabled, testId, describeError, onRemove, doneValues, }: UploadZoneProps): ReactNode;
|
|
40
|
+
export declare function UploadZone({ onUpload, title, hint, accept, multiple, capture, disabled, testId, describeError, onRemove, doneValues, trackUpload, labelForValue, }: UploadZoneProps): ReactNode;
|
|
@@ -44,7 +44,7 @@ function partitionByAccept(files, accept) {
|
|
|
44
44
|
* independently — unlike `FileField` (single file, FileRef value inside a
|
|
45
45
|
* form field). `onUpload` decides what "upload" means (storage POST, ingest
|
|
46
46
|
* mutation, or both); the zone only tracks uploading/done/error. */
|
|
47
|
-
export function UploadZone({ onUpload, title, hint, accept, multiple = true, capture, disabled, testId, describeError, onRemove, doneValues, }) {
|
|
47
|
+
export function UploadZone({ onUpload, title, hint, accept, multiple = true, capture, disabled, testId, describeError, onRemove, doneValues, trackUpload, labelForValue, }) {
|
|
48
48
|
const t = useTranslation();
|
|
49
49
|
const inputId = useId();
|
|
50
50
|
const inputRef = useRef(null);
|
|
@@ -63,7 +63,12 @@ export function UploadZone({ onUpload, title, hint, accept, multiple = true, cap
|
|
|
63
63
|
setRows([]);
|
|
64
64
|
previousDoneCount.current = doneCount;
|
|
65
65
|
}, [doneCount]);
|
|
66
|
-
|
|
66
|
+
function uploadOne(file) {
|
|
67
|
+
return trackUpload === undefined
|
|
68
|
+
? uploadUntracked(file)
|
|
69
|
+
: trackUpload(() => uploadUntracked(file));
|
|
70
|
+
}
|
|
71
|
+
async function uploadUntracked(file) {
|
|
67
72
|
const rowId = String(nextRowId.current++);
|
|
68
73
|
const uploadFile = await resizeImageBeforeUpload(file);
|
|
69
74
|
setRows((prev) => [...prev, { id: rowId, fileName: uploadFile.name, status: "uploading" }]);
|
|
@@ -121,7 +126,12 @@ export function UploadZone({ onUpload, title, hint, accept, multiple = true, cap
|
|
|
121
126
|
? []
|
|
122
127
|
: doneValues
|
|
123
128
|
.filter((value) => !rows.some((row) => row.value === value))
|
|
124
|
-
.map((value) => ({
|
|
129
|
+
.map((value) => ({
|
|
130
|
+
id: `existing:${value}`,
|
|
131
|
+
fileName: labelForValue?.(value) ?? value,
|
|
132
|
+
status: "done",
|
|
133
|
+
value,
|
|
134
|
+
}));
|
|
125
135
|
const visibleRows = [
|
|
126
136
|
...existingRows,
|
|
127
137
|
...rows.filter((row) => row.value === undefined || doneValues === undefined || doneValues.includes(row.value)),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.415.0",
|
|
4
4
|
"description": "React renderer for Kumiko screens. The root export holds the platform-agnostic logic (primitives contract, hooks, KumikoScreen, navigation and SSE abstractions); ./headless the DOM-free UI logic, ./live the HTTP dispatcher, ./web the browser bindings (HTML primitives, history navigation, EventSource live events, createKumikoApp).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
52
|
-
"@cosmicdrift/kumiko-types": "0.
|
|
51
|
+
"@cosmicdrift/kumiko-framework": "0.415.0",
|
|
52
|
+
"@cosmicdrift/kumiko-types": "0.415.0",
|
|
53
53
|
"@types/qrcode": "^1.5.6",
|
|
54
54
|
"class-variance-authority": "^0.7.1",
|
|
55
55
|
"clsx": "^2.1.1",
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@cosmicdrift/kumiko-locale-de": "0.
|
|
83
|
-
"@cosmicdrift/kumiko-testing": "0.
|
|
82
|
+
"@cosmicdrift/kumiko-locale-de": "0.415.0",
|
|
83
|
+
"@cosmicdrift/kumiko-testing": "0.415.0",
|
|
84
84
|
"@tailwindcss/cli": "^4.3.3",
|
|
85
85
|
"@testing-library/react": "^16.3.3",
|
|
86
86
|
"@testing-library/user-event": "^14.6.8",
|