@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
|
@@ -3,7 +3,6 @@ import { useRef } from "react";
|
|
|
3
3
|
import { statusToneForOptionTone } from "../../index.js";
|
|
4
4
|
import { cn } from "../lib/cn.js";
|
|
5
5
|
import { TONE_PILL } from "../widgets/status-badge.js";
|
|
6
|
-
const EQUAL_WIDTH_MAX_SEGMENTS = 4;
|
|
7
6
|
// WAI-ARIA radiogroup pattern (role="radiogroup" + role="radio" children):
|
|
8
7
|
// arrow keys move focus AND selection in the same step, only the checked
|
|
9
8
|
// segment (or the first when none is checked) sits in the tab order.
|
|
@@ -39,17 +38,16 @@ export function SegmentedControl({ id, name, value, onChange, options, disabled,
|
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
40
|
return (_jsxs("div", { role: "radiogroup", ...labelProps, "aria-required": required, "aria-invalid": hasError === true ? true : undefined, "data-testid": `segmented-${id}`, className: cn(
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
: "inline-flex w-fit flex-wrap", size === "touch" ? "min-h-11" : "min-h-9", "overflow-hidden rounded-md border", hasError === true ? "border-destructive" : "border-input"), children: [_jsx("input", { type: "hidden", name: name, value: value }), options.map((opt, index) => {
|
|
41
|
+
// Labels stay whole (nowrap on the segment, whose min-content is then the full
|
|
42
|
+
// label); when the column is too narrow the segment moves to the next row
|
|
43
|
+
// instead of breaking a word or spilling into its neighbour.
|
|
44
|
+
"inline-flex w-fit max-w-full flex-wrap", size === "touch" ? "min-h-11" : "min-h-9", "overflow-hidden rounded-md border", hasError === true ? "border-destructive" : "border-input"), children: [_jsx("input", { type: "hidden", name: name, value: value }), options.map((opt, index) => {
|
|
47
45
|
const checked = opt.value === value;
|
|
48
46
|
const declaredTone = tones !== undefined && Object.hasOwn(tones, opt.value) ? tones[opt.value] : undefined;
|
|
49
47
|
const badgeTone = declaredTone !== undefined ? statusToneForOptionTone(declaredTone) : undefined;
|
|
50
48
|
return (_jsx("button", { ref: (node) => {
|
|
51
49
|
buttonRefs.current[index] = node;
|
|
52
|
-
}, type: "button", role: "radio", "aria-checked": checked, tabIndex: index === tabStopIndex ? 0 : -1, disabled: disabled === true || opt.disabled === true, "data-testid": `segmented-${id}-${opt.value}`, onClick: () => onChange(opt.value), onKeyDown: (e) => handleKeyDown(e, index), className: cn(
|
|
50
|
+
}, type: "button", role: "radio", "aria-checked": checked, tabIndex: index === tabStopIndex ? 0 : -1, disabled: disabled === true || opt.disabled === true, "data-testid": `segmented-${id}-${opt.value}`, onClick: () => onChange(opt.value), onKeyDown: (e) => handleKeyDown(e, index), title: opt.label, className: cn(
|
|
53
51
|
// Per-segment top/left border instead of the container's
|
|
54
52
|
// `divide-x`: divide-x only draws verticals between siblings
|
|
55
53
|
// in source order, which misplaces borders the moment a
|
|
@@ -65,8 +63,11 @@ export function SegmentedControl({ id, name, value, onChange, options, disabled,
|
|
|
65
63
|
// and the next row's top border cut a notch into the row above.
|
|
66
64
|
// Harmless on a single-row layout: there's no leftover space to
|
|
67
65
|
// grow into, so `w-fit` on the container still holds.
|
|
68
|
-
|
|
66
|
+
//
|
|
67
|
+
// The ellipsis sits on the inner span: overflow on the segment itself
|
|
68
|
+
// would drop its automatic min-width to 0 and segments would stop wrapping.
|
|
69
|
+
"-ml-px -mt-px max-w-full grow basis-0 whitespace-nowrap border-l border-t px-3 py-1.5 text-center text-sm transition-colors", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", "disabled:pointer-events-none disabled:opacity-50", hasError === true ? "border-destructive/50" : "border-border", size === "touch" && "min-h-11", checked
|
|
69
70
|
? cn("font-semibold", badgeTone !== undefined ? TONE_PILL[badgeTone] : "bg-primary/10 text-primary")
|
|
70
|
-
: "bg-transparent font-medium text-foreground hover:bg-accent"), children: opt.label }, opt.value));
|
|
71
|
+
: "bg-transparent font-medium text-foreground hover:bg-accent"), children: _jsx("span", { className: "block truncate", children: opt.label }) }, opt.value));
|
|
71
72
|
})] }));
|
|
72
73
|
}
|
|
@@ -10,7 +10,12 @@ const TAB_TRIGGER_CLASS = "h-full shrink-0 flex-none whitespace-nowrap rounded-n
|
|
|
10
10
|
// tab's hover and underline span its label plus 10px; "filter" insets the strip so its first label
|
|
11
11
|
// lines up with a list pane's search field, "plain" sits flush with the content it switches.
|
|
12
12
|
const STRIP_SPACING = {
|
|
13
|
-
pill: {
|
|
13
|
+
pill: {
|
|
14
|
+
scroller: "px-1.5 @lg:px-6 max-sm:px-0",
|
|
15
|
+
list: "h-11 gap-2 @lg:gap-6 max-sm:gap-0.5",
|
|
16
|
+
// Phone viewport, not pane width: four counted tabs must still fit a 400px pane on a desktop.
|
|
17
|
+
trigger: "max-sm:px-2.5 max-sm:text-[13px]",
|
|
18
|
+
},
|
|
14
19
|
plain: { scroller: "px-0", list: "h-10 gap-1", trigger: "px-2.5 font-normal" },
|
|
15
20
|
filter: { scroller: "px-1.5", list: "h-10 gap-0", trigger: "px-2.5 font-normal" },
|
|
16
21
|
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { PWA_SERVICE_WORKER_META_NAME, pwaCacheScopePrefixOf, } from "../../headless/pwa-service-worker-meta.js";
|
|
4
|
+
import { useTranslation } from "../../index.js";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
export const PWA_INSTALL_HINT_DISMISSED_KEY = "kumiko:pwa-install-hint-dismissed";
|
|
7
|
+
function isBeforeInstallPromptEvent(event) {
|
|
8
|
+
return "prompt" in event && typeof event.prompt === "function";
|
|
9
|
+
}
|
|
10
|
+
export function readPwaServiceWorkerUrl() {
|
|
11
|
+
if (typeof document === "undefined")
|
|
12
|
+
return undefined;
|
|
13
|
+
const content = document
|
|
14
|
+
.querySelector(`meta[name="${PWA_SERVICE_WORKER_META_NAME}"]`)
|
|
15
|
+
?.getAttribute("content");
|
|
16
|
+
return content ? content : undefined;
|
|
17
|
+
}
|
|
18
|
+
function isRunningStandalone() {
|
|
19
|
+
if (typeof window.matchMedia === "function") {
|
|
20
|
+
if (window.matchMedia("(display-mode: standalone)").matches)
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return "standalone" in navigator && navigator.standalone === true;
|
|
24
|
+
}
|
|
25
|
+
// iPadOS reports a desktop Mac user agent; the touch points tell it apart.
|
|
26
|
+
function isIosDevice() {
|
|
27
|
+
const userAgent = navigator.userAgent;
|
|
28
|
+
if (/iPhone|iPad|iPod/.test(userAgent))
|
|
29
|
+
return true;
|
|
30
|
+
return /Macintosh/.test(userAgent) && navigator.maxTouchPoints > 1;
|
|
31
|
+
}
|
|
32
|
+
// Storage can throw (Safari private mode, blocked site data); the hint then just shows again.
|
|
33
|
+
function isInstallHintDismissed() {
|
|
34
|
+
try {
|
|
35
|
+
return window.localStorage.getItem(PWA_INSTALL_HINT_DISMISSED_KEY) === "1";
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function rememberInstallHintDismissed() {
|
|
42
|
+
try {
|
|
43
|
+
window.localStorage.setItem(PWA_INSTALL_HINT_DISMISSED_KEY, "1");
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
// Not remembered: the hint comes back on the next visit.
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function registerServiceWorker(serviceWorkerUrl) {
|
|
50
|
+
if (!("serviceWorker" in navigator))
|
|
51
|
+
return;
|
|
52
|
+
// Fails on insecure origins and in some private modes; the app works without the worker.
|
|
53
|
+
// The worker may only control its own directory, so the scope follows the worker's URL.
|
|
54
|
+
const scope = new URL("./", new URL(serviceWorkerUrl, window.location.href)).pathname;
|
|
55
|
+
navigator.serviceWorker
|
|
56
|
+
.register(serviceWorkerUrl, { scope, updateViaCache: "none" })
|
|
57
|
+
.catch(() => undefined);
|
|
58
|
+
}
|
|
59
|
+
// Only the registration for this document's scope is touched. A worker counts as the
|
|
60
|
+
// framework's own when it is served as /sw.js and left a cache with this scope's kumiko-pwa-
|
|
61
|
+
// prefix; app-owned workers and other apps on the origin have no such marker.
|
|
62
|
+
async function retireStaleServiceWorker() {
|
|
63
|
+
if (!("serviceWorker" in navigator) || typeof caches === "undefined")
|
|
64
|
+
return;
|
|
65
|
+
const registration = await navigator.serviceWorker.getRegistration();
|
|
66
|
+
if (!registration?.active?.scriptURL.endsWith("/sw.js"))
|
|
67
|
+
return;
|
|
68
|
+
const cachePrefix = await pwaCacheScopePrefixOf(new URL(registration.scope).pathname);
|
|
69
|
+
const pwaCacheNames = (await caches.keys()).filter((name) => name.startsWith(cachePrefix));
|
|
70
|
+
if (pwaCacheNames.length === 0)
|
|
71
|
+
return;
|
|
72
|
+
await registration.unregister();
|
|
73
|
+
await Promise.all(pwaCacheNames.map((name) => caches.delete(name)));
|
|
74
|
+
}
|
|
75
|
+
function useInstallHint(enabled) {
|
|
76
|
+
const [hint, setHint] = useState({ kind: "none" });
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (!enabled || isRunningStandalone() || isInstallHintDismissed())
|
|
79
|
+
return;
|
|
80
|
+
if (isIosDevice()) {
|
|
81
|
+
setHint({ kind: "ios" });
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const onBeforeInstallPrompt = (event) => {
|
|
85
|
+
if (!isBeforeInstallPromptEvent(event))
|
|
86
|
+
return;
|
|
87
|
+
// Keeps the browser's own mini-infobar away; the hint offers the prompt instead.
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
setHint({ kind: "prompt", event });
|
|
90
|
+
};
|
|
91
|
+
const onAppInstalled = () => {
|
|
92
|
+
rememberInstallHintDismissed();
|
|
93
|
+
setHint({ kind: "none" });
|
|
94
|
+
};
|
|
95
|
+
window.addEventListener("beforeinstallprompt", onBeforeInstallPrompt);
|
|
96
|
+
window.addEventListener("appinstalled", onAppInstalled);
|
|
97
|
+
return () => {
|
|
98
|
+
window.removeEventListener("beforeinstallprompt", onBeforeInstallPrompt);
|
|
99
|
+
window.removeEventListener("appinstalled", onAppInstalled);
|
|
100
|
+
};
|
|
101
|
+
}, [enabled]);
|
|
102
|
+
const dismiss = () => {
|
|
103
|
+
rememberInstallHintDismissed();
|
|
104
|
+
setHint({ kind: "none" });
|
|
105
|
+
};
|
|
106
|
+
return [hint, dismiss];
|
|
107
|
+
}
|
|
108
|
+
const HINT_BUTTON_CLASSES = cn("rounded-md px-3 py-1 text-xs font-medium", "hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-ring");
|
|
109
|
+
export function PwaSupport() {
|
|
110
|
+
const t = useTranslation();
|
|
111
|
+
const serviceWorkerUrl = readPwaServiceWorkerUrl();
|
|
112
|
+
const [hint, dismiss] = useInstallHint(serviceWorkerUrl !== undefined);
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (serviceWorkerUrl !== undefined)
|
|
115
|
+
registerServiceWorker(serviceWorkerUrl);
|
|
116
|
+
else
|
|
117
|
+
retireStaleServiceWorker().catch(() => undefined);
|
|
118
|
+
}, [serviceWorkerUrl]);
|
|
119
|
+
if (hint.kind === "none")
|
|
120
|
+
return null;
|
|
121
|
+
const install = async (event) => {
|
|
122
|
+
dismiss();
|
|
123
|
+
try {
|
|
124
|
+
await event.prompt();
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
// prompt() rejects when the browser already used this event; nothing left to offer.
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
return (_jsxs("div", { role: "status", className: cn("fixed inset-x-0 bottom-0 z-[150] flex flex-wrap items-center justify-center gap-3", "border-t bg-background px-4 py-3 text-sm text-foreground shadow-md", "pb-[max(0.75rem,env(safe-area-inset-bottom))]"), children: [_jsx("span", { children: hint.kind === "ios" ? t("kumiko.pwa.install-hint-ios") : t("kumiko.pwa.install-hint") }), hint.kind === "prompt" && (_jsx("button", { type: "button", onClick: () => void install(hint.event), className: cn(HINT_BUTTON_CLASSES, "bg-primary text-primary-foreground"), children: t("kumiko.pwa.install") })), _jsx("button", { type: "button", onClick: dismiss, className: cn(HINT_BUTTON_CLASSES, "border bg-background"), children: t("kumiko.pwa.dismiss") })] }));
|
|
131
|
+
}
|
|
@@ -45,7 +45,6 @@ function hasErrorCode(body) {
|
|
|
45
45
|
async function isSessionEndedRejection(url) {
|
|
46
46
|
const controller = new AbortController();
|
|
47
47
|
try {
|
|
48
|
-
// kumiko-lint-ignore direct-fetch url is the app's own SSE endpoint, probed with same-origin credentials
|
|
49
48
|
const res = await fetch(url, {
|
|
50
49
|
credentials: "same-origin",
|
|
51
50
|
headers: { Accept: "text/event-stream" },
|
|
@@ -166,7 +165,8 @@ export function createEventSourceLiveEvents(options = {}) {
|
|
|
166
165
|
sessionEndedSignalled = true;
|
|
167
166
|
onSessionEnded?.();
|
|
168
167
|
};
|
|
169
|
-
|
|
168
|
+
// Armed on `open`, not here: a scale-from-zero cold start can hold the handshake longer
|
|
169
|
+
// than the stall timeout, and aborting it would restart the cold start on every retry.
|
|
170
170
|
connection.addEventListener("ping", () => armStallWatchdog(connection));
|
|
171
171
|
connection.addEventListener("open", () => {
|
|
172
172
|
armStallWatchdog(connection);
|
package/dist/web/tokens.js
CHANGED
|
@@ -83,11 +83,9 @@ function readCurrentPreference() {
|
|
|
83
83
|
}
|
|
84
84
|
return currentPreference;
|
|
85
85
|
}
|
|
86
|
-
// @wrapper-known semantic-alias
|
|
87
86
|
function notifyThemeChange() {
|
|
88
87
|
themeTick.setState((t) => t + 1);
|
|
89
88
|
}
|
|
90
|
-
// @wrapper-known semantic-alias
|
|
91
89
|
function persistPreference(preference) {
|
|
92
90
|
try {
|
|
93
91
|
window.localStorage.setItem(THEME_STORAGE_KEY, preference);
|
|
@@ -147,7 +145,6 @@ export function useBrowserTokensApi() {
|
|
|
147
145
|
});
|
|
148
146
|
const mode = useSyncExternalStore(themeTick.subscribe, readCurrentMode, () => "dark");
|
|
149
147
|
const preference = useSyncExternalStore(themeTick.subscribe, readCurrentPreference, () => "dark");
|
|
150
|
-
// kumiko-lint-ignore no-raw-hooks listener lifecycle, no data fetching
|
|
151
148
|
useEffect(() => {
|
|
152
149
|
// skip: without matchMedia, auto keeps the mode resolved at apply time
|
|
153
150
|
if (typeof window.matchMedia !== "function")
|
package/dist/web/ui/sidebar.d.ts
CHANGED
|
@@ -26,8 +26,9 @@ declare function Sidebar({ side, variant, collapsible, mobileTitle, mobileDescri
|
|
|
26
26
|
mobileTitle?: string;
|
|
27
27
|
mobileDescription?: string;
|
|
28
28
|
}): React.JSX.Element;
|
|
29
|
-
declare function SidebarTrigger({ className, onClick, label, ...props }: React.ComponentProps<typeof Button> & {
|
|
29
|
+
declare function SidebarTrigger({ className, onClick, label, icon, ...props }: React.ComponentProps<typeof Button> & {
|
|
30
30
|
label?: string;
|
|
31
|
+
icon?: "panel" | "panel-all-widths";
|
|
31
32
|
}): React.JSX.Element;
|
|
32
33
|
declare function SidebarRail({ className, ...props }: React.ComponentProps<"button">): React.JSX.Element;
|
|
33
34
|
declare function SidebarInset({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
package/dist/web/ui/sidebar.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// @ts-nocheck — vendored shadcn, regenerate via scripts/sync-shadcn.ts
|
|
2
2
|
"use client";
|
|
3
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { cva } from "class-variance-authority";
|
|
6
6
|
import { MenuIcon, PanelLeftIcon } from "lucide-react";
|
|
7
|
+
import { DrawnPanel } from "../drawn-icons.js";
|
|
7
8
|
import { Slot } from "radix-ui";
|
|
8
9
|
import { useIsMobile } from "./use-mobile.js";
|
|
9
10
|
import { cn } from "../lib/cn.js";
|
|
@@ -100,12 +101,12 @@ function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas"
|
|
|
100
101
|
? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
|
|
101
102
|
: "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l", className), ...props, children: _jsx("div", { "data-sidebar": "sidebar", "data-slot": "sidebar-inner", className: "flex h-full w-full flex-col bg-sidebar px-2 py-3 group-data-[collapsible=icon]:px-2 group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm", children: children }) })] }));
|
|
102
103
|
}
|
|
103
|
-
function SidebarTrigger({ className, onClick, label = "Toggle Sidebar", ...props }) {
|
|
104
|
+
function SidebarTrigger({ className, onClick, label = "Toggle Sidebar", icon = "panel", ...props }) {
|
|
104
105
|
const { toggleSidebar } = useSidebar();
|
|
105
106
|
return (_jsxs(Button, { "data-sidebar": "trigger", "data-slot": "sidebar-trigger", variant: "ghost", size: "icon", className: cn("size-8 max-md:size-11", className), onClick: (event) => {
|
|
106
107
|
onClick?.(event);
|
|
107
108
|
toggleSidebar();
|
|
108
|
-
}, ...props, children: [_jsx(PanelLeftIcon, { className: "max-md:hidden" }), _jsx(MenuIcon, { className: "md:hidden" }), _jsx("span", { className: "sr-only", children: label })] }));
|
|
109
|
+
}, ...props, children: [icon === "panel-all-widths" ? (_jsx(DrawnPanel, {})) : (_jsxs(_Fragment, { children: [_jsx(PanelLeftIcon, { className: "max-md:hidden" }), _jsx(MenuIcon, { className: "md:hidden" })] })), _jsx("span", { className: "sr-only", children: label })] }));
|
|
109
110
|
}
|
|
110
111
|
function SidebarRail({ className, ...props }) {
|
|
111
112
|
const { toggleSidebar } = useSidebar();
|
|
@@ -21,9 +21,10 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
21
21
|
// with a transparent background so the suggestion shows through past the
|
|
22
22
|
// typed text. Both elements MUST share identical typography/box classes
|
|
23
23
|
// or the suggestion won't align with the caret.
|
|
24
|
-
import { Check, Languages
|
|
24
|
+
import { Check, Languages } from "lucide-react";
|
|
25
25
|
import { useLayoutEffect, useRef, useState } from "react";
|
|
26
26
|
import { useAiTextAction, useCompletion, usePrimitives, useTranslation } from "../../index.js";
|
|
27
|
+
import { DrawnWand } from "../drawn-icons.js";
|
|
27
28
|
import { cn } from "../lib/cn.js";
|
|
28
29
|
import { AiTextEndActionButton, endActionPaddingClass, } from "./ai-text-end-action.js";
|
|
29
30
|
import { ModeSwitch } from "./mode-switch.js";
|
|
@@ -118,7 +119,7 @@ function AiTextCore({ multiline, label, id, name, value, onChange, required, dis
|
|
|
118
119
|
}, id: id, name: name, type: "text", value: value, required: required, disabled: disabled === true || unavailable, placeholder: placeholder, onChange: (e) => handleChange(e.target.value), onKeyDown: handleKeyDown, onBlur: clearCompletion, onScroll: (e) => {
|
|
119
120
|
if (overlayRef.current)
|
|
120
121
|
overlayRef.current.scrollLeft = e.currentTarget.scrollLeft;
|
|
121
|
-
}, className: cn(sharedTextClass, singleLineWrapClass, "relative bg-transparent", endActionPaddingClass(endAction)), "data-testid": testId !== undefined ? `${testId}-input` : undefined })), endAction !== undefined && (_jsx(AiTextEndActionButton, { action: endAction, multiline: multiline, disabled: disabled === true || unavailable, testId: testId }))] }), showGhost && _jsx(Text, { variant: "muted", children: t("kumiko.aiText.acceptHint") }), capExceeded && _jsx(Text, { variant: "muted", children: t("kumiko.aiText.capExceeded") }), showToolbar && (_jsxs("div", { className: "mt-1 flex gap-1", children: [actions.includes("correct") && (_jsx(Button, { variant: "secondary", size: "sm", disabled: value.length === 0, ariaLabel: t("kumiko.aiText.correct"), onClick: () => openDialog("correct"), children: _jsx(Check, { className: "size-3.5", "aria-hidden": "true" }) })), actions.includes("translate") && (_jsx(Button, { variant: "secondary", size: "sm", disabled: value.length === 0, ariaLabel: t("kumiko.aiText.translate"), onClick: () => openDialog("translate"), children: _jsx(Languages, { className: "size-3.5", "aria-hidden": "true" }) })), actions.includes("rewrite") && (_jsx(Button, { variant: "secondary", size: "sm", disabled: value.length === 0, ariaLabel: t("kumiko.aiText.rewrite"), onClick: () => openDialog("rewrite"), children: _jsx(
|
|
122
|
+
}, className: cn(sharedTextClass, singleLineWrapClass, "relative bg-transparent", endActionPaddingClass(endAction)), "data-testid": testId !== undefined ? `${testId}-input` : undefined })), endAction !== undefined && (_jsx(AiTextEndActionButton, { action: endAction, multiline: multiline, disabled: disabled === true || unavailable, testId: testId }))] }), showGhost && _jsx(Text, { variant: "muted", children: t("kumiko.aiText.acceptHint") }), capExceeded && _jsx(Text, { variant: "muted", children: t("kumiko.aiText.capExceeded") }), showToolbar && (_jsxs("div", { className: "mt-1 flex gap-1", children: [actions.includes("correct") && (_jsx(Button, { variant: "secondary", size: "sm", disabled: value.length === 0, ariaLabel: t("kumiko.aiText.correct"), onClick: () => openDialog("correct"), children: _jsx(Check, { className: "size-3.5", "aria-hidden": "true" }) })), actions.includes("translate") && (_jsx(Button, { variant: "secondary", size: "sm", disabled: value.length === 0, ariaLabel: t("kumiko.aiText.translate"), onClick: () => openDialog("translate"), children: _jsx(Languages, { className: "size-3.5", "aria-hidden": "true" }) })), actions.includes("rewrite") && (_jsx(Button, { variant: "secondary", size: "sm", disabled: value.length === 0, ariaLabel: t("kumiko.aiText.rewrite"), onClick: () => openDialog("rewrite"), children: _jsx(DrawnWand, { className: "size-3.5", "aria-hidden": "true" }) }))] }))] }), _jsxs(Dialog, { open: dialogMode !== null, onOpenChange: (open) => {
|
|
122
123
|
if (!open)
|
|
123
124
|
closeDialog();
|
|
124
125
|
}, title: dialogMode !== null ? t(`kumiko.aiText.${dialogMode}`) : "", onConfirm: applyResult, testId: testId !== undefined ? `${testId}-dialog` : undefined, children: [dialogMode === "translate" && needsConfig && (_jsxs("div", { className: "mb-3 flex flex-col gap-2", children: [_jsx(ModeSwitch, { value: targetLanguage, options: translateLanguages.map((l) => ({ value: l, label: l.toUpperCase() })), onChange: setTargetLanguage }), _jsx(Button, { variant: "primary", size: "sm", onClick: runConfiguredAction, children: t(`kumiko.aiText.${dialogMode}`) })] })), dialogMode === "rewrite" && needsConfig && (_jsxs("div", { className: "mb-3 flex flex-col gap-2", children: [_jsx(ModeSwitch, { value: rewriteStyle, options: REWRITE_STYLES.map((s) => ({
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
export type ChartSwatchKind = "area" | "line" | "dashed-line";
|
|
3
|
+
export declare function ChartSwatch({ color, swatch, className, }: {
|
|
4
|
+
readonly color: string;
|
|
5
|
+
readonly swatch: ChartSwatchKind;
|
|
6
|
+
readonly className?: string;
|
|
7
|
+
}): ReactNode;
|
|
2
8
|
export declare function ChartLegend({ items, formatValue, }: {
|
|
3
9
|
readonly items: readonly {
|
|
4
10
|
readonly key: string;
|
|
@@ -8,7 +14,7 @@ export declare function ChartLegend({ items, formatValue, }: {
|
|
|
8
14
|
readonly color: string;
|
|
9
15
|
/** Omitted: no sum next to the label. */
|
|
10
16
|
readonly total?: number;
|
|
11
|
-
readonly swatch?:
|
|
17
|
+
readonly swatch?: ChartSwatchKind;
|
|
12
18
|
}[];
|
|
13
19
|
readonly formatValue: (value: number) => string;
|
|
14
20
|
}): ReactNode;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
|
+
export function ChartSwatch({ color, swatch, className, }) {
|
|
4
|
+
if (swatch === "area") {
|
|
5
|
+
return (_jsx("span", { "aria-hidden": "true", className: cn("size-2 rounded-[2px]", className), style: { backgroundColor: color } }));
|
|
6
|
+
}
|
|
7
|
+
return (_jsx("span", { "aria-hidden": "true", className: cn("w-3 border-t-2", className), style: {
|
|
8
|
+
borderColor: color,
|
|
9
|
+
borderTopStyle: swatch === "dashed-line" ? "dashed" : "solid",
|
|
10
|
+
} }));
|
|
11
|
+
}
|
|
3
12
|
export function ChartLegend({ items, formatValue, }) {
|
|
4
|
-
return (_jsx("ul", { className: "flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground", children: items.map((item) => (_jsxs("li", { "data-testid": `chart-legend-${item.testIdKey ?? item.key}`, className: "flex items-center gap-1.5", children: [item.swatch
|
|
5
|
-
borderColor: item.color,
|
|
6
|
-
borderTopStyle: item.swatch === "dashed-line" ? "dashed" : "solid",
|
|
7
|
-
} })), _jsx("span", { children: item.label }), item.total !== undefined && (_jsx("span", { className: "tabular-nums text-foreground", children: formatValue(item.total) }))] }, item.key))) }));
|
|
13
|
+
return (_jsx("ul", { className: "flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground", children: items.map((item) => (_jsxs("li", { "data-testid": `chart-legend-${item.testIdKey ?? item.key}`, className: "flex items-center gap-1.5", children: [_jsx(ChartSwatch, { color: item.color, swatch: item.swatch ?? "area" }), _jsx("span", { children: item.label }), item.total !== undefined && (_jsx("span", { className: "tabular-nums text-foreground", children: formatValue(item.total) }))] }, item.key))) }));
|
|
8
14
|
}
|
|
9
15
|
const Y_TICK_COUNT = 3;
|
|
10
16
|
export function evenYTickValues(max) {
|
|
@@ -13,5 +13,5 @@ export function CollapsibleSection({ title, defaultOpen = false, children, testI
|
|
|
13
13
|
if (defaultOpen)
|
|
14
14
|
setOpen(true);
|
|
15
15
|
}, [defaultOpen]);
|
|
16
|
-
return (_jsxs("details", { "data-testid": testId, className: "group rounded-lg border bg-card", open: open, onToggle: (e) => setOpen(e.currentTarget.open), children: [_jsxs("summary", { className: "flex h-9 cursor-pointer select-none items-center justify-between gap-2 rounded-lg px-4 text-sm font-medium hover:bg-muted/50 [&::-webkit-details-marker]:hidden", children: [_jsx("span", { children: title }), _jsx(ChevronRight, { "aria-hidden": "true", className: "size-4 text-muted-foreground transition-transform group-open:rotate-90" })] }), _jsx("div", { className: "border-t px-4 py-3", children: children })] }));
|
|
16
|
+
return (_jsxs("details", { "data-testid": testId, className: "group rounded-lg border bg-card", open: open, onToggle: (e) => setOpen(e.currentTarget.open), children: [_jsxs("summary", { className: "flex min-h-9 py-1.5 cursor-pointer select-none items-center justify-between gap-2 rounded-lg px-4 text-sm font-medium hover:bg-muted/50 [&::-webkit-details-marker]:hidden", children: [_jsx("span", { children: title }), _jsx(ChevronRight, { "aria-hidden": "true", className: "size-4 text-muted-foreground transition-transform group-open:rotate-90" })] }), _jsx("div", { className: "border-t px-4 py-3", children: children })] }));
|
|
17
17
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type DashboardListColumn, type DashboardListRow } from "./dashboard-list.tsx";
|
|
3
|
+
type CardsProps = {
|
|
4
|
+
readonly columns: readonly DashboardListColumn[];
|
|
5
|
+
readonly rows: readonly DashboardListRow[];
|
|
6
|
+
readonly formatPercent: (fraction: number) => string;
|
|
7
|
+
readonly formatNumber: (value: number) => string;
|
|
8
|
+
readonly formatDateTime: (atMs: number) => string;
|
|
9
|
+
readonly translate: (key: string) => string;
|
|
10
|
+
readonly testId?: string;
|
|
11
|
+
readonly rowToneField?: string;
|
|
12
|
+
/** Row field replacing the hint sentence as card title. */
|
|
13
|
+
readonly titleField?: string;
|
|
14
|
+
};
|
|
15
|
+
/** One card per row for the phone layout of a dashboard list. Row 1: badges and a one-line detail, row 2: the hint sentence, row 3: `showOnNarrowOnly` columns left and the small buttons right. */
|
|
16
|
+
export declare function DashboardListCards({ columns, rows, testId, rowToneField, titleField, ...cellProps }: CardsProps): ReactNode;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { isSelectOptionTone } from "../../status-tone.js";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { hintSentenceClass } from "../primitives/data-table/hint-cell.js";
|
|
5
|
+
import { cardToneClass } from "../primitives/data-table-cell.js";
|
|
6
|
+
import { nonEmptyText } from "../primitives/hint-reason-row.js";
|
|
7
|
+
import { DashboardListCell, rowToneOf, } from "./dashboard-list.js";
|
|
8
|
+
function hasValue(value) {
|
|
9
|
+
return value !== undefined && value !== null && value !== "";
|
|
10
|
+
}
|
|
11
|
+
// The reason toggle of the table is left out on purpose: a phone card shows its facts, not a hidden explanation.
|
|
12
|
+
function CardHeadline({ column, row, titleField, }) {
|
|
13
|
+
const { hint } = column;
|
|
14
|
+
const sentence = (titleField === undefined ? undefined : nonEmptyText(row[titleField])) ??
|
|
15
|
+
nonEmptyText(row[column.field]);
|
|
16
|
+
const toneValue = hint.toneField === undefined ? undefined : row[hint.toneField];
|
|
17
|
+
const tone = isSelectOptionTone(toneValue) ? toneValue : undefined;
|
|
18
|
+
if (sentence === undefined) {
|
|
19
|
+
return (_jsx("span", { "data-hint-empty": "true", className: "text-sm text-muted-foreground", children: hint.emptyLabel }));
|
|
20
|
+
}
|
|
21
|
+
return (_jsx("span", { className: cn("text-sm", hintSentenceClass(tone, hint.plainSentence, "font-semibold")), children: sentence }));
|
|
22
|
+
}
|
|
23
|
+
function detailOf(hint, row) {
|
|
24
|
+
if (hint === undefined)
|
|
25
|
+
return undefined;
|
|
26
|
+
const field = hint.narrowDetailField ?? hint.detailField;
|
|
27
|
+
return field === undefined ? undefined : nonEmptyText(row[field]);
|
|
28
|
+
}
|
|
29
|
+
/** One card per row for the phone layout of a dashboard list. Row 1: badges and a one-line detail, row 2: the hint sentence, row 3: `showOnNarrowOnly` columns left and the small buttons right. */
|
|
30
|
+
export function DashboardListCards({ columns, rows, testId, rowToneField, titleField, ...cellProps }) {
|
|
31
|
+
const hintColumn = columns.find((column) => column.hint !== undefined);
|
|
32
|
+
const plain = columns.filter((column) => column.hint === undefined);
|
|
33
|
+
const badgeColumns = plain.filter((column) => column.display === "badge");
|
|
34
|
+
const buttonColumns = plain.filter((column) => column.display === "button");
|
|
35
|
+
const otherColumns = plain.filter((column) => column.display !== "badge" && column.display !== "button");
|
|
36
|
+
const cell = (column, row) => (_jsx(DashboardListCell, { column: column, row: row, ...cellProps }, column.field));
|
|
37
|
+
return (_jsx("ul", { "data-testid": testId, className: "m-0 flex list-none flex-col gap-2 p-0", children: rows.map((row, index) => {
|
|
38
|
+
const detail = detailOf(hintColumn?.hint, row);
|
|
39
|
+
const badges = badgeColumns.filter((column) => hasValue(row[column.field]));
|
|
40
|
+
const buttons = buttonColumns.filter((column) => hasValue(row[column.field]));
|
|
41
|
+
const others = otherColumns.filter((column) => hasValue(row[column.field]));
|
|
42
|
+
return (_jsxs("li", { "data-testid": "dashboard-list-card", className: cn("flex flex-col gap-1 rounded-lg border border-border bg-card px-3 py-2.5", cardToneClass(rowToneField === undefined
|
|
43
|
+
? undefined
|
|
44
|
+
: (rowToneOf(row, rowToneField) ?? "neutral"))), children: [(badges.length > 0 || detail !== undefined) && (_jsxs("div", { className: "flex min-w-0 items-center gap-2 text-xs text-muted-foreground", children: [badges.map((column) => cell(column, row)), detail !== undefined && (_jsx("small", { "data-testid": "dashboard-list-card-detail", className: "min-w-0 truncate text-xs", children: detail }))] })), hintColumn !== undefined && (_jsx(CardHeadline, { column: hintColumn, row: row, titleField: titleField })), (others.length > 0 || buttons.length > 0) && (_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("div", { className: "flex min-w-0 flex-col text-xs text-muted-foreground", children: others.map((column) => (_jsx("span", { className: "truncate", children: cell(column, row) }, column.field))) }), buttons.length > 0 && (_jsx("div", { className: "flex shrink-0 flex-wrap justify-end gap-2 [&_a]:relative [&_a]:h-8 [&_a]:px-2.5 [&_a]:text-xs [&_a]:max-md:min-h-0 [&_a]:before:absolute [&_a]:before:inset-x-0 [&_a]:before:-inset-y-1.5 [&_a]:before:content-['']", children: buttons.map((column) => cell(column, row)) }))] }))] }, typeof row["id"] === "string" ? row["id"] : index));
|
|
45
|
+
}) }));
|
|
46
|
+
}
|
|
@@ -1,17 +1,46 @@
|
|
|
1
|
+
import type { DashboardListRowToneMarker, SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
1
2
|
import type { ReactNode } from "react";
|
|
3
|
+
import { type CellLink, type ListColumnHintViewModel, type RuntimeCellLink } from "../../headless/index.ts";
|
|
2
4
|
export type DashboardListColumn = {
|
|
3
5
|
readonly field: string;
|
|
4
6
|
/** Translated by the caller. */
|
|
5
7
|
readonly label: string;
|
|
6
|
-
readonly display?: "bar" | "badge" | "datetime";
|
|
8
|
+
readonly display?: "bar" | "badge" | "datetime" | "button";
|
|
7
9
|
readonly badgeToneField?: string;
|
|
10
|
+
readonly badgeDot?: false;
|
|
11
|
+
/** `false` leaves an empty cell blank instead of drawing the placeholder. */
|
|
12
|
+
readonly emptyPlaceholder?: false;
|
|
8
13
|
/** Resolves the raw cell value to display text, e.g. a reference id to its label. */
|
|
9
14
|
readonly renderValue?: (value: unknown, row: Readonly<Record<string, unknown>>) => string;
|
|
15
|
+
/** Links the rendered text to its target, e.g. a reference cell to the record's detail. */
|
|
16
|
+
readonly linkFor?: RuntimeCellLink;
|
|
17
|
+
/** "To do" cell; owns the rendering, `toneField` already defaulted by the caller. */
|
|
18
|
+
readonly hint?: ListColumnHintViewModel;
|
|
19
|
+
/** `showOnNarrowOnly`: drawn in the phone cards only, never as a table column. */
|
|
20
|
+
readonly narrowOnly?: true;
|
|
10
21
|
};
|
|
11
|
-
type
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export declare function
|
|
22
|
+
export type DashboardListRow = Readonly<Record<string, unknown>>;
|
|
23
|
+
type Row = DashboardListRow;
|
|
24
|
+
/** Plain-text form of a cell value, for places that cannot render the cell itself (phone line). */
|
|
25
|
+
export declare function dashboardListCellText(column: Pick<DashboardListColumn, "display" | "renderValue">, row: Row, field: string, formats: {
|
|
26
|
+
readonly formatPercent: (fraction: number) => string;
|
|
27
|
+
readonly formatNumber: (value: number) => string;
|
|
28
|
+
readonly formatDateTime: (atMs: number) => string;
|
|
29
|
+
}, translate: (key: string) => string): string | undefined;
|
|
30
|
+
export declare function DashboardListCell({ column, row, formatPercent, formatNumber, formatDateTime, translate, leading, }: {
|
|
31
|
+
/** Only a `hint` column takes it: it stands on the sentence's line, in front of it. */
|
|
32
|
+
readonly leading?: ReactNode;
|
|
33
|
+
readonly column: DashboardListColumn;
|
|
34
|
+
readonly row: Row;
|
|
35
|
+
readonly formatPercent: (fraction: number) => string;
|
|
36
|
+
readonly formatNumber: (value: number) => string;
|
|
37
|
+
readonly formatDateTime: (atMs: number) => string;
|
|
38
|
+
readonly translate: (key: string) => string;
|
|
39
|
+
}): ReactNode;
|
|
40
|
+
export declare function rowToneOf(row: Row, rowToneField: string | undefined): SelectOptionTone | undefined;
|
|
41
|
+
/** Compact table for dashboard lists with optional bar/badge columns. Badge columns in front of a
|
|
42
|
+
* `hint` column join the hint's first line; rows with a tone get 12px of padding above and below. */
|
|
43
|
+
export declare function DashboardListTable({ columns: allColumns, rows, formatPercent, formatNumber, formatDateTime, translate, testId, rowToneField, rowToneMarker, showHeader, rowLink, }: {
|
|
15
44
|
readonly columns: readonly DashboardListColumn[];
|
|
16
45
|
readonly rows: readonly Row[];
|
|
17
46
|
readonly formatPercent: (fraction: number) => string;
|
|
@@ -19,5 +48,16 @@ export declare function DashboardListTable({ columns, rows, formatPercent, forma
|
|
|
19
48
|
readonly formatDateTime: (atMs: number) => string;
|
|
20
49
|
readonly translate: (key: string) => string;
|
|
21
50
|
readonly testId?: string;
|
|
51
|
+
/** Row field holding a SelectOptionTone; tints the row. */
|
|
52
|
+
readonly rowToneField?: string;
|
|
53
|
+
/** "bar" (default): stripe at the row's left edge; "dot": small dot in front of the first cell. */
|
|
54
|
+
readonly rowToneMarker?: DashboardListRowToneMarker;
|
|
55
|
+
/** `false` drops the column header row. */
|
|
56
|
+
readonly showHeader?: boolean;
|
|
57
|
+
/** Row is a link: `linkFor` resolves the target per row, the icon sits in an extra last cell. */
|
|
58
|
+
readonly rowLink?: {
|
|
59
|
+
readonly linkFor: (row: Row) => CellLink | undefined;
|
|
60
|
+
readonly icon: "arrow" | "chevron";
|
|
61
|
+
};
|
|
22
62
|
}): ReactNode;
|
|
23
63
|
export {};
|