@cosmicdrift/kumiko-renderer 0.414.0 → 0.416.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/action-form-body.d.ts +1 -1
- package/dist/app/action-form-body.js +43 -16
- package/dist/app/action-form-support.d.ts +4 -1
- package/dist/app/action-form-support.js +8 -4
- package/dist/app/client-actions.js +6 -4
- package/dist/app/config-edit-body.js +13 -4
- package/dist/app/entity-list-screen.js +12 -9
- package/dist/app/extension-sections.d.ts +2 -0
- package/dist/app/list-facets.d.ts +1 -0
- package/dist/app/list-facets.js +10 -1
- package/dist/app/named-filter-facet.d.ts +0 -1
- package/dist/app/named-filter-facet.js +19 -10
- package/dist/app/projection-detail-body.js +8 -6
- package/dist/app/projection-detail-guidance-data.js +3 -1
- package/dist/app/projection-detail-guidance.d.ts +1 -1
- package/dist/app/projection-detail-guidance.js +45 -33
- package/dist/app/projection-detail-header-model.d.ts +1 -1
- package/dist/app/projection-detail-header-model.js +10 -5
- package/dist/app/projection-detail-header.js +5 -4
- package/dist/app/projection-detail-navigation.d.ts +6 -0
- package/dist/app/projection-detail-navigation.js +18 -4
- package/dist/app/screen-access.js +1 -2
- package/dist/app/screen-shared.d.ts +1 -0
- package/dist/app/screen-shared.js +23 -3
- package/dist/app/use-entity-list-payload.d.ts +2 -1
- package/dist/app/use-entity-list-payload.js +4 -2
- package/dist/app/use-projection-detail-actions.d.ts +14 -0
- package/dist/app/use-projection-detail-actions.js +40 -16
- package/dist/app/use-projection-detail-data.d.ts +2 -0
- package/dist/app/use-projection-detail-data.js +37 -10
- package/dist/app/use-row-decoration.d.ts +6 -4
- package/dist/app/use-row-decoration.js +67 -19
- package/dist/app/use-screen-list-rows.js +1 -1
- package/dist/card-options.d.ts +25 -0
- package/dist/card-options.js +1 -0
- package/dist/components/ai-assist-payload.d.ts +2 -0
- package/dist/components/ai-assist-payload.js +8 -0
- package/dist/components/edit-mounts.d.ts +3 -2
- package/dist/components/edit-mounts.js +2 -2
- package/dist/components/list-empty-state.d.ts +5 -0
- package/dist/components/list-empty-state.js +17 -1
- package/dist/components/multi-select-chips.d.ts +10 -0
- package/dist/components/multi-select-chips.js +18 -0
- package/dist/components/related-list-section.js +44 -32
- package/dist/components/related-photo-grid.d.ts +11 -0
- package/dist/components/related-photo-grid.js +40 -0
- package/dist/components/render-edit-action-button.d.ts +2 -2
- package/dist/components/render-edit-field-grid.js +3 -3
- package/dist/components/render-edit-header-actions.d.ts +2 -1
- package/dist/components/render-edit-header-actions.js +18 -1
- package/dist/components/render-edit-layout.js +2 -2
- package/dist/components/render-edit-logic.js +1 -0
- package/dist/components/render-edit-section-kinds.js +11 -0
- package/dist/components/render-edit-types.d.ts +11 -1
- package/dist/components/render-field-ai-assist.d.ts +13 -0
- package/dist/components/render-field-ai-assist.js +89 -0
- package/dist/components/render-field-choice-inputs.js +4 -0
- package/dist/components/render-field-control.d.ts +1 -1
- package/dist/components/render-field-control.js +18 -8
- package/dist/components/render-field-value-chips.d.ts +9 -0
- package/dist/components/render-field-value-chips.js +45 -0
- package/dist/components/render-field-write-only.js +12 -4
- package/dist/components/render-list-hint-columns.d.ts +2 -0
- package/dist/components/render-list-hint-columns.js +23 -0
- package/dist/components/render-list-toolbar-model.d.ts +2 -2
- package/dist/components/use-render-edit-sections.js +5 -1
- package/dist/components/use-render-list-columns.js +3 -3
- package/dist/context/screen-focus-context.d.ts +1 -1
- package/dist/context/screen-focus-context.js +3 -3
- package/dist/data-table-facet-types.d.ts +4 -0
- package/dist/headless/format/index.d.ts +1 -0
- package/dist/headless/format/index.js +20 -0
- package/dist/headless/format/phone.d.ts +1 -0
- package/dist/headless/format/phone.js +8 -0
- package/dist/headless/format/relative-time.d.ts +13 -0
- package/dist/headless/format/relative-time.js +60 -0
- package/dist/headless/format/safe-locale.d.ts +1 -0
- package/dist/headless/format/safe-locale.js +13 -0
- package/dist/headless/index.d.ts +3 -3
- package/dist/headless/index.js +3 -3
- package/dist/headless/pwa-service-worker-meta.d.ts +3 -0
- package/dist/headless/pwa-service-worker-meta.js +10 -0
- package/dist/headless/view-model/edit.d.ts +3 -2
- package/dist/headless/view-model/edit.js +78 -2
- package/dist/headless/view-model/field-text.d.ts +9 -0
- package/dist/headless/view-model/field-text.js +19 -0
- package/dist/headless/view-model/index.d.ts +1 -0
- package/dist/headless/view-model/index.js +1 -0
- package/dist/headless/view-model/types.d.ts +33 -3
- package/dist/i18n-defaults.js +4 -1
- package/dist/index.d.ts +1 -1
- package/dist/metric-types.d.ts +2 -0
- package/dist/primitives-record-guidance.d.ts +30 -1
- package/dist/primitives.d.ts +17 -27
- package/dist/web/app/dashboard-body.js +3 -2
- package/dist/web/app/dashboard-header.js +1 -1
- package/dist/web/app/dashboard-list-panel.js +9 -13
- package/dist/web/app/dashboard-panel-columns.d.ts +9 -0
- package/dist/web/app/dashboard-panel-columns.js +14 -0
- package/dist/web/app/dashboard-panels.d.ts +1 -0
- package/dist/web/app/dashboard-panels.js +9 -7
- package/dist/web/app/dashboard-reference-list-table.js +1 -0
- package/dist/web/app/dashboard-shared.js +3 -2
- package/dist/web/app/dashboard-stat-group-panel.d.ts +1 -0
- package/dist/web/app/dashboard-stat-group-panel.js +22 -8
- package/dist/web/app/dashboard-text-panel.d.ts +1 -0
- package/dist/web/app/dashboard-text-panel.js +18 -12
- package/dist/web/app/relative-time.d.ts +0 -5
- package/dist/web/app/relative-time.js +1 -20
- package/dist/web/drawn-icons.d.ts +6 -0
- package/dist/web/drawn-icons.js +30 -0
- package/dist/web/icons.js +6 -5
- package/dist/web/index.d.ts +2 -0
- package/dist/web/index.js +2 -0
- package/dist/web/layout/default-app-shell.js +3 -3
- package/dist/web/layout/nav-collapse-state.d.ts +2 -0
- package/dist/web/layout/nav-collapse-state.js +10 -0
- package/dist/web/layout/nav-tree.js +46 -23
- package/dist/web/layout/notification-bell.d.ts +7 -2
- package/dist/web/layout/notification-bell.js +16 -5
- package/dist/web/layout/shell-focus.d.ts +2 -2
- package/dist/web/layout/shell-focus.js +7 -3
- package/dist/web/layout/shell-header.d.ts +2 -1
- package/dist/web/layout/shell-header.js +56 -27
- package/dist/web/layout/shell-style.d.ts +3 -0
- package/dist/web/layout/shell-style.js +6 -0
- package/dist/web/layout/workspace-shell.d.ts +11 -1
- package/dist/web/layout/workspace-shell.js +6 -4
- package/dist/web/primitives/banner.d.ts +1 -1
- package/dist/web/primitives/banner.js +19 -9
- package/dist/web/primitives/card.js +18 -8
- package/dist/web/primitives/data-table/actions-column.d.ts +1 -1
- package/dist/web/primitives/data-table/actions-column.js +3 -1
- package/dist/web/primitives/data-table/card-body.d.ts +1 -1
- package/dist/web/primitives/data-table/card-body.js +11 -6
- package/dist/web/primitives/data-table/card-row.js +27 -18
- package/dist/web/primitives/data-table/data-cell-props.d.ts +2 -0
- package/dist/web/primitives/data-table/data-cell-props.js +2 -0
- package/dist/web/primitives/data-table/hint-cell.d.ts +1 -3
- package/dist/web/primitives/data-table/hint-cell.js +4 -10
- package/dist/web/primitives/data-table/row-click-guard.d.ts +2 -0
- package/dist/web/primitives/data-table/row-click-guard.js +19 -0
- package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
- package/dist/web/primitives/data-table/row-render-parts.js +3 -2
- package/dist/web/primitives/data-table/sort-options-select.js +3 -3
- package/dist/web/primitives/data-table/table-body.js +2 -1
- package/dist/web/primitives/data-table/table-content.js +10 -6
- package/dist/web/primitives/data-table/table-view.js +8 -3
- package/dist/web/primitives/data-table/toolbar.d.ts +2 -0
- package/dist/web/primitives/data-table/toolbar.js +44 -9
- package/dist/web/primitives/data-table/totals-footer.js +4 -3
- package/dist/web/primitives/data-table-cell.d.ts +4 -1
- package/dist/web/primitives/data-table-cell.js +60 -20
- package/dist/web/primitives/default-form.js +6 -3
- package/dist/web/primitives/drawer.js +5 -1
- package/dist/web/primitives/facet-filter.d.ts +1 -1
- package/dist/web/primitives/facet-filter.js +16 -8
- 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-view-action.js +4 -1
- package/dist/web/primitives/form-footer-parts.js +4 -1
- package/dist/web/primitives/form.js +6 -8
- package/dist/web/primitives/index.js +4 -0
- package/dist/web/primitives/layout-elements.d.ts +1 -1
- package/dist/web/primitives/layout-elements.js +3 -3
- package/dist/web/primitives/locale-number.d.ts +0 -1
- package/dist/web/primitives/locale-number.js +1 -13
- package/dist/web/primitives/metric.js +17 -5
- package/dist/web/primitives/money-input.js +2 -1
- package/dist/web/primitives/narrow-pinned-footer.js +7 -3
- package/dist/web/primitives/number-input.js +2 -1
- package/dist/web/primitives/page-header.js +3 -2
- package/dist/web/primitives/pager.d.ts +3 -2
- package/dist/web/primitives/pager.js +16 -20
- package/dist/web/primitives/photo-grid.d.ts +3 -0
- package/dist/web/primitives/photo-grid.js +5 -0
- package/dist/web/primitives/record-breadcrumb.js +1 -1
- package/dist/web/primitives/record-steps.d.ts +1 -1
- package/dist/web/primitives/record-steps.js +11 -6
- package/dist/web/primitives/record-summary.d.ts +1 -1
- package/dist/web/primitives/record-summary.js +8 -3
- package/dist/web/primitives/segmented-select.js +6 -3
- package/dist/web/primitives/step-list.d.ts +3 -0
- package/dist/web/primitives/step-list.js +11 -0
- package/dist/web/primitives/tabs.js +6 -1
- package/dist/web/pwa/pwa-support.js +19 -1
- 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/dashboard-list-cards.js +6 -14
- package/dist/web/widgets/dashboard-list.d.ts +10 -0
- package/dist/web/widgets/dashboard-list.js +36 -10
- 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.js +2 -2
- package/dist/web/widgets/pdf-viewer-toolbar.js +3 -2
- package/dist/web/widgets/sheet-parts.js +3 -1
- package/dist/web/widgets/stat-box-cell.js +1 -1
- package/dist/web/widgets/stat.d.ts +7 -1
- package/dist/web/widgets/stat.js +12 -4
- 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/package.json +5 -5
- package/src/changes.json +126 -0
- package/src/web/styles.css +6 -0
|
@@ -8,6 +8,7 @@ import { hintViewModel } from "../../components/render-list-hint-columns.js";
|
|
|
8
8
|
import { screenLinkFor } from "../../components/use-render-list-columns.js";
|
|
9
9
|
import { extensionSectionName, useAppFeatures, useExtensionSectionComponent, usePrimitives, useUserRoles, } from "../../index.js";
|
|
10
10
|
import { useIsBelowSmViewport } from "../primitives/use-narrow-viewport.js";
|
|
11
|
+
import { dashboardListCellText } from "../widgets/dashboard-list.js";
|
|
11
12
|
import { dashboardNavigationLink } from "./dashboard-navigation-link.js";
|
|
12
13
|
import { DashboardReferenceListTable, } from "./dashboard-reference-list-table.js";
|
|
13
14
|
import { QueryPanel, useDashboardFormats } from "./dashboard-shared.js";
|
|
@@ -64,16 +65,6 @@ function rowLinkResolverOf(rowLink, resolveScreenLink) {
|
|
|
64
65
|
const { paramField, screen } = rowLink;
|
|
65
66
|
return (row) => resolveScreenLink(screen, paramField === undefined ? undefined : row[paramField]);
|
|
66
67
|
}
|
|
67
|
-
// The same number and date formatting the list cells use, so the phone line agrees with the table.
|
|
68
|
-
function lineValueText(raw, display, formats) {
|
|
69
|
-
if (display === "datetime") {
|
|
70
|
-
const atMs = typeof raw === "number" ? raw : typeof raw === "string" ? Date.parse(raw) : Number.NaN;
|
|
71
|
-
return Number.isFinite(atMs) ? formats.formatDateTime(atMs) : undefined;
|
|
72
|
-
}
|
|
73
|
-
if (typeof raw === "number")
|
|
74
|
-
return formats.formatNumber(raw);
|
|
75
|
-
return typeof raw === "string" && raw !== "" ? raw : undefined;
|
|
76
|
-
}
|
|
77
68
|
function ListLine({ panel, label, data, link, translate, screenId, screenParams, }) {
|
|
78
69
|
const { Link } = usePrimitives();
|
|
79
70
|
const nav = useNav();
|
|
@@ -84,9 +75,10 @@ function ListLine({ panel, label, data, link, translate, screenId, screenParams,
|
|
|
84
75
|
const lineField = panel.narrow?.field ??
|
|
85
76
|
columns.find((column) => column.display === undefined && typeof firstRow?.[column.field] === "string")?.field;
|
|
86
77
|
const formats = useDashboardFormats();
|
|
87
|
-
const
|
|
78
|
+
const lineColumn = columns.find((column) => column.field === lineField);
|
|
79
|
+
const firstText = lineField === undefined || firstRow === undefined
|
|
88
80
|
? undefined
|
|
89
|
-
:
|
|
81
|
+
: dashboardListCellText(lineColumn ?? {}, firstRow, lineField, formats, translate);
|
|
90
82
|
const more = (knownTotal(data) ?? rows.length) - 1;
|
|
91
83
|
const target = dashboardNavigationLink(nav, link);
|
|
92
84
|
return (_jsxs(Link, { href: target.href, onPress: target.onPress, testId: `dashboard-panel-${panel.id}`, className: "flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-3 text-sm text-card-foreground", children: [Icon !== undefined && (_jsx("span", { className: "flex shrink-0 items-center", children: _jsx(Icon, { entityName: screenId, entityId: null, screenId: screenId, filterParams: screenParams.filterParams }) })), _jsxs("span", { className: "min-w-0 flex-1 truncate", children: [_jsx("span", { className: "font-semibold", children: label }), firstText !== undefined && ` · ${firstText}`, more > 0 &&
|
|
@@ -96,7 +88,7 @@ function NarrowCardsPanel({ panel, label, data, columns, featureName, translate,
|
|
|
96
88
|
const { formatPercent, formatNumber, formatDateTime } = useDashboardFormats();
|
|
97
89
|
const { footerLink } = panel;
|
|
98
90
|
const totalLabel = totalText(panel, data, true, translate);
|
|
99
|
-
return (_jsxs("section", { "data-testid": `dashboard-panel-${panel.id}`, className: "flex flex-col gap-2", children: [_jsxs("header", { className: "flex items-baseline justify-between gap-3", children: [_jsx("h2", { className: "text-sm font-semibold", children: label }), totalLabel !== undefined && (_jsx("span", { className: "text-xs text-muted-foreground", children: totalLabel }))] }), _jsx(DashboardReferenceListTable, { columns: columns, rows: data.rows ?? [], featureName: featureName, formatPercent: formatPercent, formatNumber: formatNumber, formatDateTime: formatDateTime, translate: translate, narrowCards: true, ...(panel.narrow?.titleField !== undefined && { titleField: panel.narrow.titleField }), ...(panel.rowToneField !== undefined && { rowToneField: panel.rowToneField }) }), footerLink !== undefined && (_jsx("footer", { className: "flex flex-wrap items-center gap-x-1 text-
|
|
91
|
+
return (_jsxs("section", { "data-testid": `dashboard-panel-${panel.id}`, className: "flex flex-col gap-2", children: [_jsxs("header", { className: "flex items-baseline justify-between gap-3", children: [_jsx("h2", { className: "text-sm font-semibold", children: label }), totalLabel !== undefined && (_jsx("span", { className: "text-xs text-muted-foreground", children: totalLabel }))] }), _jsx(DashboardReferenceListTable, { columns: columns, rows: data.rows ?? [], featureName: featureName, formatPercent: formatPercent, formatNumber: formatNumber, formatDateTime: formatDateTime, translate: translate, narrowCards: true, ...(panel.narrow?.titleField !== undefined && { titleField: panel.narrow.titleField }), ...(panel.rowToneField !== undefined && { rowToneField: panel.rowToneField }) }), footerLink !== undefined && (_jsx("footer", { className: "flex flex-wrap items-center gap-x-1 text-[12.5px] text-muted-foreground", children: _jsx(ListFooter, { link: footerLink, data: data, narrow: true, translate: translate }) }))] }));
|
|
100
92
|
}
|
|
101
93
|
export function ListPanelBody({ panel, label, featureName, screenId, screenParams, translate, }) {
|
|
102
94
|
const { formatPercent, formatNumber, formatDateTime } = useDashboardFormats();
|
|
@@ -111,10 +103,14 @@ export function ListPanelBody({ panel, label, featureName, screenId, screenParam
|
|
|
111
103
|
field: normalized.field,
|
|
112
104
|
label: translate(normalized.label ?? normalized.field),
|
|
113
105
|
...(normalized.display !== undefined && { display: normalized.display }),
|
|
106
|
+
...(normalized.variant !== undefined && { buttonVariant: normalized.variant }),
|
|
114
107
|
...(normalized.badgeToneField !== undefined && {
|
|
115
108
|
badgeToneField: normalized.badgeToneField,
|
|
116
109
|
}),
|
|
117
110
|
...(normalized.badgeDot !== undefined && { badgeDot: normalized.badgeDot }),
|
|
111
|
+
...(normalized.emptyPlaceholder !== undefined && {
|
|
112
|
+
emptyPlaceholder: normalized.emptyPlaceholder,
|
|
113
|
+
}),
|
|
118
114
|
...(normalized.refEntity !== undefined && {
|
|
119
115
|
reference: {
|
|
120
116
|
refEntity: normalized.refEntity,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DashboardPanelDefinition } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
/** Panel grid, or the main/side columns of `layout: "main-side"`; below sm everything is one list in `narrowOrder`. */
|
|
4
|
+
export declare function DashboardPanelGrid({ layout, panels, belowSm, renderPanel, }: {
|
|
5
|
+
readonly layout: "main-side" | undefined;
|
|
6
|
+
readonly panels: readonly DashboardPanelDefinition[];
|
|
7
|
+
readonly belowSm: boolean;
|
|
8
|
+
readonly renderPanel: (panel: DashboardPanelDefinition) => ReactNode;
|
|
9
|
+
}): ReactNode;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const GRID_CLASS = "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-12";
|
|
3
|
+
const COLUMNS_CLASS = "grid grid-cols-1 gap-4 lg:grid-cols-3";
|
|
4
|
+
const COLUMN_CLASS = "flex min-w-0 flex-col gap-4";
|
|
5
|
+
/** Panel grid, or the main/side columns of `layout: "main-side"`; below sm everything is one list in `narrowOrder`. */
|
|
6
|
+
export function DashboardPanelGrid({ layout, panels, belowSm, renderPanel, }) {
|
|
7
|
+
if (layout !== "main-side" || belowSm) {
|
|
8
|
+
return (_jsx("div", { className: layout === "main-side" ? COLUMN_CLASS : GRID_CLASS, children: panels.map(renderPanel) }));
|
|
9
|
+
}
|
|
10
|
+
const topPanels = panels.filter((panel) => panel.column === "top");
|
|
11
|
+
return (_jsxs("div", { className: COLUMN_CLASS, children: [topPanels.length > 0 && (_jsx("div", { className: COLUMN_CLASS, "data-testid": "dashboard-column-top", children: topPanels.map(renderPanel) })), _jsxs("div", { className: COLUMNS_CLASS, "data-testid": "dashboard-columns", children: [_jsx("div", { className: `${COLUMN_CLASS} lg:col-span-2`, "data-testid": "dashboard-column-main", children: panels
|
|
12
|
+
.filter((panel) => panel.column !== "side" && panel.column !== "top")
|
|
13
|
+
.map(renderPanel) }), _jsx("div", { className: COLUMN_CLASS, "data-testid": "dashboard-column-side", children: panels.filter((panel) => panel.column === "side").map(renderPanel) })] })] }));
|
|
14
|
+
}
|
|
@@ -10,6 +10,7 @@ type StatPanelBodyProps = {
|
|
|
10
10
|
readonly translate: Translate;
|
|
11
11
|
readonly variant: "card" | "strip" | "strip-compact";
|
|
12
12
|
};
|
|
13
|
+
export declare function useStatNavigateAllowed(): (panel: StatPanelBodyProps["panel"]) => boolean;
|
|
13
14
|
export declare function StatPanelBody(props: StatPanelBodyProps): ReactNode;
|
|
14
15
|
export declare function ChartPanelBody({ panel, label, screenParams, translate, }: {
|
|
15
16
|
readonly panel: DashboardChartPanel;
|
|
@@ -40,15 +40,17 @@ function fallbackText(raw, placeholder) {
|
|
|
40
40
|
return String(raw);
|
|
41
41
|
}
|
|
42
42
|
// Hidden before any query hook runs: the tile's own count query would be refused for this user.
|
|
43
|
-
export function
|
|
43
|
+
export function useStatNavigateAllowed() {
|
|
44
44
|
const appFeatures = useAppFeatures();
|
|
45
45
|
const userRoles = useUserRoles();
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
return ({ navigate }) => navigate === undefined ||
|
|
47
|
+
(navigateTargetAllows({ screen: navigate.screen }, appFeatures, userRoles) &&
|
|
48
|
+
namedFilterNavigateAllows(navigate, appFeatures, userRoles));
|
|
49
|
+
}
|
|
50
|
+
export function StatPanelBody(props) {
|
|
51
|
+
const navigateAllowed = useStatNavigateAllowed();
|
|
52
|
+
if (!navigateAllowed(props.panel))
|
|
50
53
|
return null;
|
|
51
|
-
}
|
|
52
54
|
return _jsx(StatPanelContent, { ...props });
|
|
53
55
|
}
|
|
54
56
|
function StatPanelContent({ panel, label, screenId, screenParams, translate, variant, }) {
|
|
@@ -112,7 +114,7 @@ function StatVariantCell({ variant, cell, }) {
|
|
|
112
114
|
return _jsx(StatBoxCell, { ...boxCell });
|
|
113
115
|
}
|
|
114
116
|
const { narrowLabel: _narrow, ...tileCell } = cell;
|
|
115
|
-
return variant === "strip" ? _jsx(StatStripCell, { ...tileCell }) : _jsx(StatCard, { ...tileCell });
|
|
117
|
+
return variant === "strip" ? _jsx(StatStripCell, { ...tileCell }) : _jsx(StatCard, { ...tileCell, inset: true });
|
|
116
118
|
}
|
|
117
119
|
function statValueText(rawValue, valueFormat, translate, formats) {
|
|
118
120
|
if (typeof rawValue !== "number") {
|
|
@@ -19,6 +19,7 @@ function toReferenceViewColumn(column, featureName) {
|
|
|
19
19
|
refEntity: target.entityName,
|
|
20
20
|
refFeature: target.featureName,
|
|
21
21
|
refLabelField: column.reference.refLabelField ?? "id",
|
|
22
|
+
...(column.emptyPlaceholder !== undefined && { emptyPlaceholder: column.emptyPlaceholder }),
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
25
|
// Dashboard list rows carry raw ids; reference columns resolve them to the target's label
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useCallback, useContext, useEffect, useRef, useState, } from "react";
|
|
3
|
+
import { resolveSafeLocale } from "../../headless/format/safe-locale.js";
|
|
3
4
|
import { currencyDecimals } from "../../headless/index.js";
|
|
4
5
|
import { dispatcherErrorText, useLocale, usePrimitives, useQuery, useTranslation, } from "../../index.js";
|
|
5
6
|
import { serverNowMs } from "../../server-clock.js";
|
|
6
|
-
import {
|
|
7
|
+
import { cn } from "../lib/cn.js";
|
|
7
8
|
import { formatMoney } from "../primitives/money-input.js";
|
|
8
9
|
import { Skeleton } from "../ui/skeleton.js";
|
|
9
10
|
import { EmptyState, LoadingState } from "../widgets/states.js";
|
|
@@ -118,7 +119,7 @@ export function useDashboardFormats() {
|
|
|
118
119
|
};
|
|
119
120
|
}
|
|
120
121
|
export function PanelShell({ testId, title, subtitle, action, footer, children, }) {
|
|
121
|
-
return (_jsxs("section", { "data-testid": testId, className: "flex h-full flex-col rounded-lg border border-border bg-card text-card-foreground", children: [(title !== undefined || action !== undefined) && (_jsxs("header", { className: "flex
|
|
122
|
+
return (_jsxs("section", { "data-testid": testId, className: "flex h-full flex-col rounded-lg border border-border bg-card text-card-foreground shadow-[var(--card-shadow)]", children: [(title !== undefined || action !== undefined) && (_jsxs("header", { className: "flex shrink-0 flex-wrap items-baseline justify-between gap-x-3 gap-y-2 px-4 pt-3.5", children: [_jsxs("div", { className: "flex min-w-0 flex-col gap-0.5 sm:flex-row sm:flex-wrap sm:items-baseline sm:gap-x-2.5", children: [title !== undefined && _jsx("h2", { className: "text-sm font-semibold break-words", children: title }), subtitle !== undefined && (_jsx("p", { className: "text-[12.5px] text-muted-foreground", children: subtitle }))] }), action !== undefined && _jsx("div", { className: "shrink-0", children: action })] })), _jsx("div", { className: cn("grow px-4 pt-3", footer === undefined && "pb-4"), children: children }), footer !== undefined && (_jsx("footer", { className: "mx-4 mb-4 mt-2.5 flex shrink-0 flex-wrap items-center gap-x-1 border-t border-border-row pt-2.5 text-[12.5px] text-muted-foreground", children: footer }))] }));
|
|
122
123
|
}
|
|
123
124
|
export function PanelError({ label, error, onRetry, testId, }) {
|
|
124
125
|
const { Button } = usePrimitives();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DashboardStatGroupPanel } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import type { Translate } from "../../headless/index.ts";
|
|
4
|
+
import "../react-css-custom-properties.ts";
|
|
4
5
|
import { type ScreenParams } from "./dashboard-shared.tsx";
|
|
5
6
|
type StatGroupProps = {
|
|
6
7
|
readonly panel: DashboardStatGroupPanel;
|
|
@@ -4,9 +4,11 @@ import { useNav } from "../../app/nav.js";
|
|
|
4
4
|
import { navigateTargetAllows } from "../../app/screen-access.js";
|
|
5
5
|
import { extensionSectionName, useAppFeatures, useExtensionSectionComponent, usePrimitives, useUserRoles, } from "../../index.js";
|
|
6
6
|
import { cn } from "../lib/cn.js";
|
|
7
|
+
import { useIsBelowSmViewport } from "../primitives/use-narrow-viewport.js";
|
|
8
|
+
import "../react-css-custom-properties.js";
|
|
7
9
|
import { STAT_CARD_GRID_CLASSES } from "../widgets/stat.js";
|
|
8
10
|
import { dashboardNavigationLink } from "./dashboard-navigation-link.js";
|
|
9
|
-
import { StatPanelBody } from "./dashboard-panels.js";
|
|
11
|
+
import { StatPanelBody, useStatNavigateAllowed } from "./dashboard-panels.js";
|
|
10
12
|
import { PanelShell } from "./dashboard-shared.js";
|
|
11
13
|
// Literal class strings: Tailwind only emits classes it can read in the source.
|
|
12
14
|
const STAT_CARD_COLUMN_CLASSES = {
|
|
@@ -16,11 +18,11 @@ const STAT_CARD_COLUMN_CLASSES = {
|
|
|
16
18
|
};
|
|
17
19
|
// Literal class strings: Tailwind only emits classes it can read in the source.
|
|
18
20
|
const PHONE_STRIP_TONE_CLASS = {
|
|
19
|
-
accent: "max-sm:border-
|
|
20
|
-
ok: "max-sm:border-
|
|
21
|
-
warn: "max-sm:border-
|
|
22
|
-
bad: "max-sm:border-
|
|
23
|
-
critical: "max-sm:border-
|
|
21
|
+
accent: "max-sm:border-transparent max-sm:bg-primary/10",
|
|
22
|
+
ok: "max-sm:border-transparent max-sm:bg-status-ok-surface",
|
|
23
|
+
warn: "max-sm:border-transparent max-sm:bg-status-warn-surface",
|
|
24
|
+
bad: "max-sm:border-transparent max-sm:bg-status-bad-surface",
|
|
25
|
+
critical: "max-sm:border-transparent max-sm:bg-status-critical-surface",
|
|
24
26
|
neutral: "",
|
|
25
27
|
};
|
|
26
28
|
function StatGroupLink({ link, translate, stretchOnNarrow, }) {
|
|
@@ -35,8 +37,13 @@ function StatGroupLink({ link, translate, stretchOnNarrow, }) {
|
|
|
35
37
|
? "ml-auto flex shrink-0 items-center gap-1 text-sm font-medium max-sm:after:absolute max-sm:after:inset-0"
|
|
36
38
|
: "ml-auto flex shrink-0 items-center gap-1 text-sm font-medium", children: [_jsx("span", { className: stretchOnNarrow ? "max-sm:sr-only" : undefined, children: translate(link.label) }), _jsx(ChevronRight, { className: "size-4", "aria-hidden": "true" })] }));
|
|
37
39
|
}
|
|
40
|
+
/** A child with `hideOnNarrow` is not mounted on a phone, so it runs no query and leaves no gap. */
|
|
41
|
+
function statsForViewport(stats, belowSm) {
|
|
42
|
+
return belowSm ? stats.filter((stat) => stat.hideOnNarrow !== true) : stats;
|
|
43
|
+
}
|
|
38
44
|
function StatCells({ panel, screenId, screenParams, translate, variant, }) {
|
|
39
|
-
|
|
45
|
+
const belowSm = useIsBelowSmViewport();
|
|
46
|
+
return statsForViewport(panel.stats, belowSm).map((stat) => (_jsx(StatPanelBody, { panel: stat, label: translate(stat.label), screenId: screenId, screenParams: screenParams, translate: translate, variant: variant }, stat.id)));
|
|
40
47
|
}
|
|
41
48
|
function FlatStatStrip(props) {
|
|
42
49
|
const { panel, translate } = props;
|
|
@@ -50,7 +57,14 @@ function PhoneStripIcon({ panel, screenId, screenParams, }) {
|
|
|
50
57
|
}
|
|
51
58
|
function TitledStatStrip(props) {
|
|
52
59
|
const { panel, label, translate } = props;
|
|
53
|
-
|
|
60
|
+
const navigateAllowed = useStatNavigateAllowed();
|
|
61
|
+
const belowSm = useIsBelowSmViewport();
|
|
62
|
+
const stats = statsForViewport(panel.stats, belowSm).filter(navigateAllowed);
|
|
63
|
+
return (_jsxs("div", { "data-testid": `dashboard-panel-${panel.id}`, "data-narrow-tone": panel.narrow?.tone, style: { "--stat-count": stats.length }, className: cn(
|
|
64
|
+
// Board grid: title column, one equal column per stat, link column.
|
|
65
|
+
panel.link === undefined
|
|
66
|
+
? "sm:[grid-template-columns:190px_repeat(var(--stat-count),minmax(0,1fr))]"
|
|
67
|
+
: "sm:[grid-template-columns:190px_repeat(var(--stat-count),minmax(0,1fr))_auto]", "relative flex items-center gap-x-4 rounded-lg border border-border bg-card px-4 py-3 shadow-[var(--card-shadow)] sm:grid sm:gap-x-3 max-sm:items-baseline max-sm:gap-x-2 max-sm:overflow-hidden max-sm:py-2 max-sm:font-medium", panel.narrow?.tone !== undefined && PHONE_STRIP_TONE_CLASS[panel.narrow.tone]), children: [_jsx(PhoneStripIcon, { panel: panel, screenId: props.screenId, screenParams: props.screenParams }), _jsxs("div", { className: "flex min-w-0 shrink-0 flex-col max-sm:flex-row max-sm:items-baseline", children: [_jsx("h2", { className: "text-sm font-semibold max-sm:after:ml-2 max-sm:after:font-normal max-sm:after:text-muted-foreground max-sm:after:content-['\u00B7']", children: label }), panel.subtitle !== undefined && (_jsx("p", { className: "text-xs text-muted-foreground max-sm:hidden", children: translate(panel.subtitle) }))] }), _jsx("div", { className: "flex min-w-0 items-stretch gap-3 sm:contents max-sm:block max-sm:grow max-sm:truncate max-sm:text-sm", children: stats.map((stat) => (_jsx("div", { className: `flex min-w-0 max-sm:inline max-sm:[&_a]:inline max-sm:[&:not(:last-child)]:after:mx-1.5 max-sm:[&:not(:last-child)]:after:text-muted-foreground max-sm:[&:not(:last-child)]:after:content-['·'] [&>*]:min-w-0${stat.navigate !== undefined ? " max-sm:relative max-sm:z-10" : ""}`, children: _jsx(StatPanelBody, { panel: stat, label: translate(stat.label), screenId: props.screenId, screenParams: props.screenParams, translate: translate, variant: "strip-compact" }) }, stat.id))) }), panel.link !== undefined && (_jsx(StatGroupLink, { link: panel.link, translate: translate, stretchOnNarrow: true }))] }));
|
|
54
68
|
}
|
|
55
69
|
export function StatGroupPanelBody(props) {
|
|
56
70
|
const { panel, label, translate } = props;
|
|
@@ -5,6 +5,7 @@ import { type ScreenParams } from "./dashboard-shared.tsx";
|
|
|
5
5
|
type TextPanelBodyProps = {
|
|
6
6
|
readonly panel: DashboardTextPanel;
|
|
7
7
|
readonly label: string | undefined;
|
|
8
|
+
readonly screenId: string;
|
|
8
9
|
readonly screenParams: ScreenParams;
|
|
9
10
|
readonly translate: Translate;
|
|
10
11
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { navigateTargetAllows } from "../../app/screen-access.js";
|
|
3
|
-
import { lastSegment, useAppFeatures, useNav, usePrimitives, useUserRoles } from "../../index.js";
|
|
3
|
+
import { extensionSectionName, lastSegment, useAppFeatures, useExtensionSectionComponent, useNav, usePrimitives, useUserRoles, } from "../../index.js";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
4
5
|
import { useIsBelowSmViewport } from "../primitives/use-narrow-viewport.js";
|
|
5
6
|
import { PanelError, PanelShell, PanelSkeleton, panelPayload, useDashboardFormats, useDashboardQuery, useReportPanelLoaded, } from "./dashboard-shared.js";
|
|
6
7
|
import { isDashboardI18nText, isRecord, resolveDashboardText } from "./dashboard-text.js";
|
|
@@ -63,7 +64,10 @@ const PARAGRAPH_CLASS_NAMES = {
|
|
|
63
64
|
strong: "text-sm font-medium text-foreground",
|
|
64
65
|
lead: "font-heading text-[15.5px] leading-[1.5] sm:text-[17px] sm:leading-relaxed text-foreground",
|
|
65
66
|
};
|
|
66
|
-
function
|
|
67
|
+
function isLeadParagraph(block) {
|
|
68
|
+
return block?.kind === "paragraph" && block.emphasis === "lead";
|
|
69
|
+
}
|
|
70
|
+
function TextBlockView({ block, translate, followsLead = false, }) {
|
|
67
71
|
const formats = useDashboardFormats();
|
|
68
72
|
const resolve = (text) => resolveBlockText(text, translate, formats);
|
|
69
73
|
switch (block.kind) {
|
|
@@ -76,7 +80,7 @@ function TextBlockView({ block, translate, }) {
|
|
|
76
80
|
case "code":
|
|
77
81
|
return (_jsx("pre", { "data-block": "code", className: "overflow-x-auto rounded-md bg-muted p-3 text-xs", children: _jsx("code", { children: block.code }) }));
|
|
78
82
|
case "hint":
|
|
79
|
-
return (_jsx("p", { "data-block": "hint", className: "text-xs text-muted-foreground", children: resolve(block.text) }));
|
|
83
|
+
return (_jsx("p", { "data-block": "hint", className: cn("text-xs text-muted-foreground", followsLead && "-mt-1 text-[11.5px]"), children: resolve(block.text) }));
|
|
80
84
|
case "link":
|
|
81
85
|
return _jsx(TextBlockLink, { block: block, resolve: resolve });
|
|
82
86
|
}
|
|
@@ -117,27 +121,29 @@ function textBlockKey(block) {
|
|
|
117
121
|
return `${block.kind}:${textKey(block.text)}`;
|
|
118
122
|
}
|
|
119
123
|
}
|
|
120
|
-
function TextPanelFrame({ panel, label, children, }) {
|
|
124
|
+
function TextPanelFrame({ panel, label, screenId, screenParams, children, }) {
|
|
121
125
|
const testId = `dashboard-panel-${panel.id}`;
|
|
126
|
+
const Icon = useExtensionSectionComponent(panel.icon !== undefined ? extensionSectionName(panel.icon) : undefined);
|
|
127
|
+
const content = Icon === undefined ? (children) : (_jsxs("div", { className: "flex items-start gap-3", children: [_jsx("span", { "data-testid": `${testId}-icon`, className: "flex shrink-0 items-center pt-0.5", children: _jsx(Icon, { entityName: screenId, entityId: null, screenId: screenId, filterParams: screenParams.filterParams }) }), _jsx("div", { className: "min-w-0 grow", children: children })] }));
|
|
122
128
|
if (label !== undefined) {
|
|
123
|
-
return (_jsx(PanelShell, { testId: testId, title: label, children:
|
|
129
|
+
return (_jsx(PanelShell, { testId: testId, title: label, children: content }));
|
|
124
130
|
}
|
|
125
|
-
return (_jsx("section", { "data-testid": testId, className: "h-full rounded-lg border border-border bg-card p-4 text-card-foreground", children:
|
|
131
|
+
return (_jsx("section", { "data-testid": testId, className: "h-full rounded-lg border border-border bg-card p-4 text-card-foreground max-sm:px-3.5 max-sm:py-3", children: content }));
|
|
126
132
|
}
|
|
127
133
|
function TextBlockList({ blocks, translate, }) {
|
|
128
|
-
return (_jsx("div", { className: "flex flex-col gap-3", children: withOccurrenceKeys(blocks, textBlockKey).map(({ entry, key }) => (_jsx(TextBlockView, { block: entry, translate: translate }, key))) }));
|
|
134
|
+
return (_jsx("div", { className: "flex flex-col gap-3", children: withOccurrenceKeys(blocks, textBlockKey).map(({ entry, key }, index) => (_jsx(TextBlockView, { block: entry, translate: translate, followsLead: isLeadParagraph(blocks[index - 1]) }, key))) }));
|
|
129
135
|
}
|
|
130
136
|
export function TextPanelBody(props) {
|
|
131
|
-
const { panel, label, translate } = props;
|
|
137
|
+
const { panel, label, translate, screenId, screenParams } = props;
|
|
132
138
|
const narrow = useIsBelowSmViewport();
|
|
133
139
|
if (panel.query === undefined) {
|
|
134
|
-
return (_jsx(TextPanelFrame, { panel: panel, label: label, children: _jsx(TextBlockList, { blocks: (narrow ? panel.narrowBlocks : undefined) ?? panel.blocks ?? [], translate: translate }) }));
|
|
140
|
+
return (_jsx(TextPanelFrame, { panel: panel, label: label, screenId: screenId, screenParams: screenParams, children: _jsx(TextBlockList, { blocks: (narrow ? panel.narrowBlocks : undefined) ?? panel.blocks ?? [], translate: translate }) }));
|
|
135
141
|
}
|
|
136
142
|
return _jsx(QueryTextPanelBody, { ...props, query: panel.query });
|
|
137
143
|
}
|
|
138
144
|
// Not QueryPanel: that shell shows a skeleton/error/empty state instead of content, but the
|
|
139
145
|
// static blocks are the fallback here and must stay visible while the query loads, fails or is empty.
|
|
140
|
-
function QueryTextPanelBody({ panel, query, label, screenParams, translate, }) {
|
|
146
|
+
function QueryTextPanelBody({ panel, query, label, screenId, screenParams, translate, }) {
|
|
141
147
|
const { data, error, loading, refetch } = useDashboardQuery(query, panelPayload(panel, screenParams));
|
|
142
148
|
useReportPanelLoaded(data, loading);
|
|
143
149
|
const narrow = useIsBelowSmViewport();
|
|
@@ -159,5 +165,5 @@ function QueryTextPanelBody({ panel, query, label, screenParams, translate, }) {
|
|
|
159
165
|
else {
|
|
160
166
|
body = null;
|
|
161
167
|
}
|
|
162
|
-
return (_jsx(TextPanelFrame, { panel: panel, label: label, children: body }));
|
|
168
|
+
return (_jsx(TextPanelFrame, { panel: panel, label: label, screenId: screenId, screenParams: screenParams, children: body }));
|
|
163
169
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/** "5 minutes ago" / "in 30 seconds" in the given locale. The unit grows with the
|
|
2
|
-
* distance (seconds below a minute, minutes below an hour, hours below a day,
|
|
3
|
-
* days beyond); each step is chosen on the already rounded value so 59.6 minutes
|
|
4
|
-
* reads "1 hour" instead of "60 minutes". `numeric: "auto"` yields "now" and "yesterday". */
|
|
5
|
-
export declare function formatRelativeTime(atMs: number, nowMs: number, locale: string): string;
|
|
6
1
|
/** Interval at which a relative text at `distanceMs` from now needs a redraw. */
|
|
7
2
|
export declare function relativeTickIntervalMs(distanceMs: number): number;
|
|
8
3
|
/** Returns a formatter for relative times that redraws its component on a timer, but
|
|
@@ -1,26 +1,7 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { formatRelativeTime } from "../../headless/format/relative-time.js";
|
|
2
3
|
import { serverNowMs } from "../../server-clock.js";
|
|
3
|
-
import { resolveSafeLocale } from "../primitives/locale-number.js";
|
|
4
4
|
const SECONDS_PER_MINUTE = 60;
|
|
5
|
-
const MINUTES_PER_HOUR = 60;
|
|
6
|
-
const HOURS_PER_DAY = 24;
|
|
7
|
-
/** "5 minutes ago" / "in 30 seconds" in the given locale. The unit grows with the
|
|
8
|
-
* distance (seconds below a minute, minutes below an hour, hours below a day,
|
|
9
|
-
* days beyond); each step is chosen on the already rounded value so 59.6 minutes
|
|
10
|
-
* reads "1 hour" instead of "60 minutes". `numeric: "auto"` yields "now" and "yesterday". */
|
|
11
|
-
export function formatRelativeTime(atMs, nowMs, locale) {
|
|
12
|
-
const formatter = new Intl.RelativeTimeFormat(resolveSafeLocale(locale), { numeric: "auto" });
|
|
13
|
-
const seconds = Math.round((atMs - nowMs) / 1000);
|
|
14
|
-
if (Math.abs(seconds) < SECONDS_PER_MINUTE)
|
|
15
|
-
return formatter.format(seconds, "second");
|
|
16
|
-
const minutes = Math.round(seconds / SECONDS_PER_MINUTE);
|
|
17
|
-
if (Math.abs(minutes) < MINUTES_PER_HOUR)
|
|
18
|
-
return formatter.format(minutes, "minute");
|
|
19
|
-
const hours = Math.round(minutes / MINUTES_PER_HOUR);
|
|
20
|
-
if (Math.abs(hours) < HOURS_PER_DAY)
|
|
21
|
-
return formatter.format(hours, "hour");
|
|
22
|
-
return formatter.format(Math.round(hours / HOURS_PER_DAY), "day");
|
|
23
|
-
}
|
|
24
5
|
const SECOND_TICK_MS = 1000;
|
|
25
6
|
// Above a minute the text changes at most once per minute; half a minute keeps it
|
|
26
7
|
// at most 30 s late without waking the page every second for a "5 minutes ago".
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const DrawnSearch: import("lucide-react").LucideIcon;
|
|
2
|
+
export declare const DrawnSparkles: import("lucide-react").LucideIcon;
|
|
3
|
+
export declare const DrawnPencil: import("lucide-react").LucideIcon;
|
|
4
|
+
export declare const DrawnFilter: import("lucide-react").LucideIcon;
|
|
5
|
+
export declare const DrawnWand: import("lucide-react").LucideIcon;
|
|
6
|
+
export declare const DrawnPanel: import("lucide-react").LucideIcon;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Icons drawn to match the KI-first boards; lucide's stock glyphs differ in stroke detail.
|
|
2
|
+
import { createLucideIcon } from "lucide-react";
|
|
3
|
+
export const DrawnSearch = createLucideIcon("drawn-search", [
|
|
4
|
+
["circle", { cx: "11", cy: "11", r: "7", key: "drawn-search-lens" }],
|
|
5
|
+
["path", { d: "m20 20-3.5-3.5", key: "drawn-search-handle" }],
|
|
6
|
+
]);
|
|
7
|
+
export const DrawnSparkles = createLucideIcon("drawn-sparkles", [
|
|
8
|
+
["path", { d: "M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9z", key: "large" }],
|
|
9
|
+
["path", { d: "M19 15.5l.9 2.6 2.6.9-2.6.9-.9 2.6-.9-2.6-2.6-.9 2.6-.9z", key: "small" }],
|
|
10
|
+
]);
|
|
11
|
+
export const DrawnPencil = createLucideIcon("drawn-pencil", [
|
|
12
|
+
["path", { d: "M4 20h4L19 9l-4-4L4 16z", key: "body" }],
|
|
13
|
+
["path", { d: "m13 7 4 4", key: "tip" }],
|
|
14
|
+
]);
|
|
15
|
+
export const DrawnFilter = createLucideIcon("drawn-filter", [
|
|
16
|
+
["path", { d: "M4 6h16l-6 7v5l-4 2v-7z", key: "funnel" }],
|
|
17
|
+
]);
|
|
18
|
+
export const DrawnWand = createLucideIcon("drawn-wand", [
|
|
19
|
+
[
|
|
20
|
+
"path",
|
|
21
|
+
{
|
|
22
|
+
d: "m4 20 10-10M14 4l1 2 2 1-2 1-1 2-1-2-2-1 2-1zM19 11l.7 1.3 1.3.7-1.3.7-.7 1.3-.7-1.3-1.3-.7 1.3-.7z",
|
|
23
|
+
key: "wand",
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
]);
|
|
27
|
+
export const DrawnPanel = createLucideIcon("drawn-panel", [
|
|
28
|
+
["rect", { x: "3", y: "4", width: "18", height: "16", rx: "2", key: "frame" }],
|
|
29
|
+
["path", { d: "M9 4v16", key: "divider" }],
|
|
30
|
+
]);
|
package/dist/web/icons.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { AlertTriangle, Archive, ArrowLeft, ArrowRight, BarChart3, Bell, BookOpen, Building, Calculator, CalendarDays, Camera, Check, CheckCircle2, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, CircleStop, ClipboardList, Clock, Coins, Copy, CreditCard, Download, Euro, ExternalLink, Eye, EyeOff, FileText, Filter, Flag, Folder, FolderOpen, Gauge, Hash, Headphones, Home, ImageIcon, Info, KeyRound, Languages, Layers, LayoutDashboard, LayoutGrid, LineChart, Link, List, Loader2, Lock, Mail, MapPin, Mic, MoreHorizontal, MoreVertical, Package, Palette,
|
|
2
|
+
import { AlertTriangle, Archive, ArrowLeft, ArrowRight, BarChart3, Bell, BookOpen, Building, Calculator, CalendarDays, Camera, Check, CheckCircle2, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, CircleStop, ClipboardList, Clock, Coins, Copy, CreditCard, Download, Euro, ExternalLink, Eye, EyeOff, FileText, Filter, Flag, Folder, FolderOpen, Gauge, Hash, Headphones, Home, ImageIcon, Info, KeyRound, Languages, Layers, LayoutDashboard, LayoutGrid, LineChart, Link, List, Loader2, Lock, Mail, MapPin, Mic, MoreHorizontal, MoreVertical, Package, Palette, Phone, PiggyBank, Plus, Printer, Receipt, RefreshCw, Rocket, Save, Send, Server, Settings, Share2, Shield, ShieldCheck, Star, Table, Tag, Trash2, TrendingUp, Undo2, Upload, User, Users, Wallet, Warehouse, X, XCircle, } from "lucide-react";
|
|
3
|
+
import { DrawnPencil, DrawnSearch, DrawnSparkles, DrawnWand } from "./drawn-icons.js";
|
|
3
4
|
import { cn } from "./lib/cn.js";
|
|
4
5
|
export const NAV_ICONS = {
|
|
5
6
|
dashboard: LayoutDashboard,
|
|
@@ -23,8 +24,8 @@ export const NAV_ICONS = {
|
|
|
23
24
|
chart: LineChart,
|
|
24
25
|
"bar-chart": BarChart3,
|
|
25
26
|
trending: TrendingUp,
|
|
26
|
-
sparkles:
|
|
27
|
-
wand:
|
|
27
|
+
sparkles: DrawnSparkles,
|
|
28
|
+
wand: DrawnWand,
|
|
28
29
|
calendar: CalendarDays,
|
|
29
30
|
file: FileText,
|
|
30
31
|
folder: Folder,
|
|
@@ -37,7 +38,7 @@ export const NAV_ICONS = {
|
|
|
37
38
|
settings: Settings,
|
|
38
39
|
users: Users,
|
|
39
40
|
user: User,
|
|
40
|
-
search:
|
|
41
|
+
search: DrawnSearch,
|
|
41
42
|
tag: Tag,
|
|
42
43
|
key: KeyRound,
|
|
43
44
|
link: Link,
|
|
@@ -58,7 +59,7 @@ export const NAV_ICONS = {
|
|
|
58
59
|
"arrow-left": ArrowLeft,
|
|
59
60
|
"arrow-right": ArrowRight,
|
|
60
61
|
copy: Copy,
|
|
61
|
-
pencil:
|
|
62
|
+
pencil: DrawnPencil,
|
|
62
63
|
eye: Eye,
|
|
63
64
|
"eye-off": EyeOff,
|
|
64
65
|
filter: Filter,
|
package/dist/web/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { KumikoLink, useBrowserNavApi } from "./app/nav.tsx";
|
|
|
13
13
|
export { PlainContentEditor } from "./app/plain-content-editor.tsx";
|
|
14
14
|
export { useResolvers } from "./app/resolvers-context.tsx";
|
|
15
15
|
export { clearRememberedListState } from "./app/session-list-state-store.ts";
|
|
16
|
+
export { DrawnFilter, DrawnPanel, DrawnPencil, DrawnSearch, DrawnSparkles, DrawnWand, } from "./drawn-icons.ts";
|
|
16
17
|
export type { EditorActionTestIds, EditorHeaderTestIds, EditorMode, EditorSaveActions, EditorWorkbenchProps, FooterTone, InfoBarTone, WorkbenchSave, } from "./editor/index.ts";
|
|
17
18
|
export { EditorBody, EditorFooter, EditorFrame, EditorHeader, EditorInfoBar, EditorLocaleSwitch, EditorModeSwitch, EditorWorkbench, formatRelativeWhen, RailField, RailHint, RailRow, RailSection, } from "./editor/index.ts";
|
|
18
19
|
export type { NavIconKey } from "./icons.tsx";
|
|
@@ -34,6 +35,7 @@ export type { LanguageMenuItemsProps } from "./layout/language-menu-items.tsx";
|
|
|
34
35
|
export { LanguageMenuItems } from "./layout/language-menu-items.tsx";
|
|
35
36
|
export type { LanguageSwitcherProps, LocaleOption } from "./layout/language-switcher.tsx";
|
|
36
37
|
export { LanguageSwitcher } from "./layout/language-switcher.tsx";
|
|
38
|
+
export { clearNavCollapseState } from "./layout/nav-collapse-state.ts";
|
|
37
39
|
export type { NavTreeProps } from "./layout/nav-tree.tsx";
|
|
38
40
|
export { buildNavRegistrySlice, buildNavRegistrySliceForApp, NavTree } from "./layout/nav-tree.tsx";
|
|
39
41
|
export type { ProfileMenuItem, ProfileMenuProps } from "./layout/profile-menu.tsx";
|
package/dist/web/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export { KumikoLink, useBrowserNavApi } from "./app/nav.js";
|
|
|
12
12
|
export { PlainContentEditor } from "./app/plain-content-editor.js";
|
|
13
13
|
export { useResolvers } from "./app/resolvers-context.js";
|
|
14
14
|
export { clearRememberedListState } from "./app/session-list-state-store.js";
|
|
15
|
+
export { DrawnFilter, DrawnPanel, DrawnPencil, DrawnSearch, DrawnSparkles, DrawnWand, } from "./drawn-icons.js";
|
|
15
16
|
export { EditorBody, EditorFooter, EditorFrame, EditorHeader, EditorInfoBar, EditorLocaleSwitch, EditorModeSwitch, EditorWorkbench, formatRelativeWhen, RailField, RailHint, RailRow, RailSection, } from "./editor/index.js";
|
|
16
17
|
export { Icon } from "./icons.js";
|
|
17
18
|
export { AppLayout } from "./layout/app-layout.js";
|
|
@@ -23,6 +24,7 @@ export { HeaderActionGroup } from "./layout/header-action-group.js";
|
|
|
23
24
|
export { HeaderActionPinned } from "./layout/header-action-pinned.js";
|
|
24
25
|
export { LanguageMenuItems } from "./layout/language-menu-items.js";
|
|
25
26
|
export { LanguageSwitcher } from "./layout/language-switcher.js";
|
|
27
|
+
export { clearNavCollapseState } from "./layout/nav-collapse-state.js";
|
|
26
28
|
export { buildNavRegistrySlice, buildNavRegistrySliceForApp, NavTree } from "./layout/nav-tree.js";
|
|
27
29
|
export { ProfileMenu } from "./layout/profile-menu.js";
|
|
28
30
|
export { useShellFocusMode } from "./layout/shell-focus.js";
|
|
@@ -5,7 +5,7 @@ import { fillClasses } from "./fill-classes.js";
|
|
|
5
5
|
import { FocusAwareSidebarBody, sidebarProviderProps } from "./focus-aware-sidebar.js";
|
|
6
6
|
import { NavTree } from "./nav-tree.js";
|
|
7
7
|
import { PageHeaderSlotProvider } from "./page-header-slot.js";
|
|
8
|
-
import { ShellFocusProvider, useShellFocusHost } from "./shell-focus.js";
|
|
8
|
+
import { ShellFocusProvider, ShellTopbarActionsProvider, useShellFocusHost, } from "./shell-focus.js";
|
|
9
9
|
import { ShellHeader } from "./shell-header.js";
|
|
10
10
|
import { usePersistedSidebarOpen } from "./sidebar-open-state.js";
|
|
11
11
|
import { SidebarPanelProvider, useSidebarPanelHost } from "./sidebar-panel.js";
|
|
@@ -15,7 +15,7 @@ export function DefaultAppShell({ brand, schema, user, sidebarActions, headerAct
|
|
|
15
15
|
// Second column only when a screen fills it (sidebar-09 pattern) — otherwise
|
|
16
16
|
// every other screen would carry an empty strip next to the navigation.
|
|
17
17
|
const panel = useSidebarPanelHost();
|
|
18
|
-
const focus = useShellFocusHost(
|
|
18
|
+
const focus = useShellFocusHost();
|
|
19
19
|
const sidebarOpen = usePersistedSidebarOpen();
|
|
20
|
-
return (_jsx(ScreenFocusProvider, { children: _jsx(SidebarProvider, { ...fillCls.provider, ...sidebarProviderProps(focus, sidebarOpen), children: _jsx(ShellFocusProvider, { value: focus.value, children: _jsxs(SidebarPanelProvider, { value: panel.value, children: [_jsxs(Sidebar, { collapsible: "icon", mobileTitle: t("kumiko.sidebar.title"), mobileDescription: t("kumiko.sidebar.description"), children: [_jsxs(FocusAwareSidebarBody, { focused: focus.focused, brand: brand, schema: schema, user: user, railNavQns: focusRailNavQns, footer: sidebarFooter, children: [_jsx(SidebarHeader, { "data-kumiko-layout": "sidebar-header", children: brand }), sidebarActions !== undefined && (_jsx(SidebarGroup, { "data-kumiko-layout": "sidebar-actions", className: "flex-row flex-wrap items-center gap-1 py-0", children: sidebarActions })), _jsx(SidebarContent, { "data-kumiko-layout": "sidebar-nav", children: _jsx(NavTree, { schema: schema, ...(user !== undefined && { user }), ...(navBadges !== undefined && { navBadges }) }) }), sidebarFooter !== undefined && (_jsx(SidebarFooter, { "data-kumiko-layout": "sidebar-footer", className: "border-t border-sidebar-border", children: sidebarFooter }))] }), _jsx(SidebarRail, { "aria-label": t("kumiko.sidebar.toggle"), title: t("kumiko.sidebar.toggle") })] }), _jsx("div", { ref: panel.ref, "data-kumiko-layout": "sidebar-panel", className: panel.occupied ? "flex h-svh shrink-0 flex-col" : "hidden" }), _jsx(SidebarInset, { className: fillCls.inset, children: _jsxs(PageHeaderSlotProvider, { children: [_jsx(ShellHeader, { schema: schema, ...(user !== undefined && { user }), ...(headerActions !== undefined && { headerActions }) }), _jsx("main", { className: fillCls.main, children: _jsx(UserRolesProvider, { roles: user?.roles, children: children }) })] }) })] }) }) }) }));
|
|
20
|
+
return (_jsx(ScreenFocusProvider, { children: _jsx(SidebarProvider, { ...fillCls.provider, ...sidebarProviderProps(focus, sidebarOpen), children: _jsx(ShellFocusProvider, { value: focus.value, children: _jsx(ShellTopbarActionsProvider, { value: headerActions, children: _jsxs(SidebarPanelProvider, { value: panel.value, children: [_jsxs(Sidebar, { collapsible: "icon", mobileTitle: t("kumiko.sidebar.title"), mobileDescription: t("kumiko.sidebar.description"), children: [_jsxs(FocusAwareSidebarBody, { focused: focus.focused, brand: brand, schema: schema, user: user, railNavQns: focusRailNavQns, footer: sidebarFooter, children: [_jsx(SidebarHeader, { "data-kumiko-layout": "sidebar-header", children: brand }), sidebarActions !== undefined && (_jsx(SidebarGroup, { "data-kumiko-layout": "sidebar-actions", className: "flex-row flex-wrap items-center gap-1 py-0", children: sidebarActions })), _jsx(SidebarContent, { "data-kumiko-layout": "sidebar-nav", children: _jsx(NavTree, { schema: schema, ...(user !== undefined && { user }), ...(navBadges !== undefined && { navBadges }) }) }), sidebarFooter !== undefined && (_jsx(SidebarFooter, { "data-kumiko-layout": "sidebar-footer", className: "border-t border-sidebar-border", children: sidebarFooter }))] }), _jsx(SidebarRail, { "aria-label": t("kumiko.sidebar.toggle"), title: t("kumiko.sidebar.toggle") })] }), _jsx("div", { ref: panel.ref, "data-kumiko-layout": "sidebar-panel", className: panel.occupied ? "flex h-svh shrink-0 flex-col" : "hidden" }), _jsx(SidebarInset, { className: fillCls.inset, children: _jsxs(PageHeaderSlotProvider, { children: [_jsx(ShellHeader, { schema: schema, ...(user !== undefined && { user }), ...(headerActions !== undefined && { headerActions }) }), _jsx("main", { className: fillCls.main, children: _jsx(UserRolesProvider, { roles: user?.roles, children: children }) })] }) })] }) }) }) }) }));
|
|
21
21
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Forgets the collapsed containers and the revealed screen; logout calls it so the next user starts expanded. */
|
|
2
|
+
export declare function clearNavCollapseState(): void;
|
|
1
3
|
export declare function usePersistedNavCollapse(): {
|
|
2
4
|
readonly collapsed: ReadonlySet<string>;
|
|
3
5
|
readonly toggle: (qualifiedName: string) => void;
|
|
@@ -42,6 +42,16 @@ function writeRevealedScreen(screenId) {
|
|
|
42
42
|
// storage unavailable: a remount may reveal the active path once more
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
/** Forgets the collapsed containers and the revealed screen; logout calls it so the next user starts expanded. */
|
|
46
|
+
export function clearNavCollapseState() {
|
|
47
|
+
try {
|
|
48
|
+
window.sessionStorage.removeItem(STORAGE_KEY);
|
|
49
|
+
window.sessionStorage.removeItem(REVEALED_SCREEN_KEY);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// storage unavailable: nothing was persisted
|
|
53
|
+
}
|
|
54
|
+
}
|
|
45
55
|
// The sidebar body remounts when the shell swaps it (focus mode, mobile sheet),
|
|
46
56
|
// so the explicitly collapsed qualified names live in sessionStorage, not in
|
|
47
57
|
// component state alone.
|