@columenlabs/lumen-ui 0.0.0-stage → 0.2.1
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/LICENSE +21 -0
- package/NOTICE +12 -0
- package/README.md +4 -2
- package/dist/add-column.d.ts +23 -0
- package/dist/add-column.js +62 -0
- package/dist/api-fetch.d.ts +9 -0
- package/dist/api-fetch.js +60 -0
- package/dist/app-switcher.d.ts +21 -0
- package/dist/app-switcher.js +12 -0
- package/dist/app-views.d.ts +18 -0
- package/dist/app-views.js +41 -0
- package/dist/assistant-context.d.ts +72 -0
- package/dist/assistant-context.js +30 -0
- package/dist/assistant-panel.d.ts +58 -0
- package/dist/assistant-panel.js +244 -0
- package/dist/assistant-screen.d.ts +124 -0
- package/dist/assistant-screen.js +252 -0
- package/dist/card-switch.d.ts +16 -0
- package/dist/card-switch.js +16 -0
- package/dist/color-dot.d.ts +14 -0
- package/dist/color-dot.js +19 -0
- package/dist/confirm.d.ts +18 -0
- package/dist/confirm.js +5 -0
- package/dist/connections.d.ts +45 -0
- package/dist/connections.js +275 -0
- package/dist/coverage-calendar-map.d.ts +27 -0
- package/dist/coverage-calendar-map.js +84 -0
- package/dist/coverage-cells.d.ts +55 -0
- package/dist/coverage-cells.js +85 -0
- package/dist/coverage-map.d.ts +112 -0
- package/dist/coverage-map.js +428 -0
- package/dist/details-table.d.ts +20 -0
- package/dist/details-table.js +13 -0
- package/dist/drawer-section.d.ts +27 -0
- package/dist/drawer-section.js +23 -0
- package/dist/floating-head.d.ts +2 -0
- package/dist/floating-head.js +57 -0
- package/dist/fold.d.ts +16 -0
- package/dist/fold.js +70 -0
- package/dist/form-issues.d.ts +32 -0
- package/dist/form-issues.js +60 -0
- package/dist/formula-input.d.ts +17 -0
- package/dist/formula-input.js +104 -0
- package/dist/frame-script.d.ts +7 -0
- package/dist/frame-script.js +103 -0
- package/dist/freshness.d.ts +24 -0
- package/dist/freshness.js +99 -0
- package/dist/group-button.d.ts +33 -0
- package/dist/group-button.js +67 -0
- package/dist/growth-chart.d.ts +77 -0
- package/dist/growth-chart.js +195 -0
- package/dist/hooks/use-keyboard-fit.d.ts +15 -0
- package/dist/hooks/use-keyboard-fit.js +29 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +15 -0
- package/dist/icon-button.d.ts +21 -0
- package/dist/icon-button.js +22 -0
- package/dist/icon-picker.d.ts +14 -0
- package/dist/icon-picker.js +36 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.js +90 -0
- package/dist/integrations.d.ts +57 -0
- package/dist/integrations.js +73 -0
- package/dist/joins.d.ts +128 -0
- package/dist/joins.js +767 -0
- package/dist/kit-config.d.ts +13 -0
- package/dist/kit-config.js +15 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +5 -0
- package/dist/lumen-boundary.d.ts +7 -0
- package/dist/lumen-boundary.js +10 -0
- package/dist/lumen-code-editor-impl.d.ts +2 -0
- package/dist/lumen-code-editor-impl.js +16 -0
- package/dist/lumen-code-editor.d.ts +11 -0
- package/dist/lumen-code-editor.js +11 -0
- package/dist/lumen-code.d.ts +22 -0
- package/dist/lumen-code.js +75 -0
- package/dist/lumen-drawer.d.ts +30 -0
- package/dist/lumen-drawer.js +27 -0
- package/dist/lumen-echart.d.ts +58 -0
- package/dist/lumen-echart.js +129 -0
- package/dist/lumen-filter.d.ts +75 -0
- package/dist/lumen-filter.js +546 -0
- package/dist/lumen-finder.d.ts +62 -0
- package/dist/lumen-finder.js +275 -0
- package/dist/lumen-form.d.ts +34 -0
- package/dist/lumen-form.js +81 -0
- package/dist/lumen-geo-map.d.ts +9 -0
- package/dist/lumen-geo-map.js +135 -0
- package/dist/lumen-grid.d.ts +49 -0
- package/dist/lumen-grid.js +203 -0
- package/dist/lumen-layout.d.ts +150 -0
- package/dist/lumen-layout.js +661 -0
- package/dist/lumen-links.d.ts +96 -0
- package/dist/lumen-links.js +213 -0
- package/dist/lumen-page-state.d.ts +20 -0
- package/dist/lumen-page-state.js +15 -0
- package/dist/lumen-selector.d.ts +139 -0
- package/dist/lumen-selector.js +308 -0
- package/dist/lumen-source.d.ts +137 -0
- package/dist/lumen-source.js +327 -0
- package/dist/lumen-tab-drawer.d.ts +27 -0
- package/dist/lumen-tab-drawer.js +26 -0
- package/dist/lumen-tabs.d.ts +21 -0
- package/dist/lumen-tabs.js +6 -0
- package/dist/lumen-toast.d.ts +11 -0
- package/dist/lumen-toast.js +16 -0
- package/dist/lumen-trend.d.ts +18 -0
- package/dist/lumen-trend.js +157 -0
- package/dist/lumen-view-card.d.ts +35 -0
- package/dist/lumen-view-card.js +50 -0
- package/dist/lumen-view.d.ts +172 -0
- package/dist/lumen-view.js +645 -0
- package/dist/lumen-widget-charts.d.ts +57 -0
- package/dist/lumen-widget-charts.js +69 -0
- package/dist/lumen-widget.d.ts +720 -0
- package/dist/lumen-widget.js +609 -0
- package/dist/market/compare-chart.d.ts +34 -0
- package/dist/market/compare-chart.js +292 -0
- package/dist/market/indicator-picker.d.ts +29 -0
- package/dist/market/indicator-picker.js +125 -0
- package/dist/market/indicators.d.ts +63 -0
- package/dist/market/indicators.js +314 -0
- package/dist/market/live.d.ts +120 -0
- package/dist/market/live.js +444 -0
- package/dist/market/lumen-chart.d.ts +88 -0
- package/dist/market/lumen-chart.js +645 -0
- package/dist/market/market-widget.d.ts +45 -0
- package/dist/market/market-widget.js +346 -0
- package/dist/market/option-chain.d.ts +19 -0
- package/dist/market/option-chain.js +53 -0
- package/dist/market/price-chart.d.ts +128 -0
- package/dist/market/price-chart.js +619 -0
- package/dist/mcp-settings.d.ts +20 -0
- package/dist/mcp-settings.js +65 -0
- package/dist/nav.d.ts +77 -0
- package/dist/nav.js +73 -0
- package/dist/note-line.d.ts +13 -0
- package/dist/note-line.js +5 -0
- package/dist/notifications.d.ts +9 -0
- package/dist/notifications.js +166 -0
- package/dist/origin-legend.d.ts +14 -0
- package/dist/origin-legend.js +38 -0
- package/dist/overview.d.ts +84 -0
- package/dist/overview.js +105 -0
- package/dist/page-inputs.d.ts +14 -0
- package/dist/page-inputs.js +16 -0
- package/dist/page.d.ts +32 -0
- package/dist/page.js +45 -0
- package/dist/pager.d.ts +10 -0
- package/dist/pager.js +14 -0
- package/dist/prefs.d.ts +71 -0
- package/dist/prefs.js +126 -0
- package/dist/query-client.d.ts +7 -0
- package/dist/query-client.js +19 -0
- package/dist/refresh.d.ts +4 -0
- package/dist/refresh.js +19 -0
- package/dist/rename-field.d.ts +11 -0
- package/dist/rename-field.js +26 -0
- package/dist/reset-button.d.ts +9 -0
- package/dist/reset-button.js +10 -0
- package/dist/route-error.d.ts +42 -0
- package/dist/route-error.js +229 -0
- package/dist/schedules.d.ts +88 -0
- package/dist/schedules.js +221 -0
- package/dist/settings.d.ts +51 -0
- package/dist/settings.js +181 -0
- package/dist/shell.d.ts +99 -0
- package/dist/shell.js +137 -0
- package/dist/source-health.d.ts +12 -0
- package/dist/source-health.js +58 -0
- package/dist/sourced-card.d.ts +10 -0
- package/dist/sourced-card.js +69 -0
- package/dist/spotlight.d.ts +23 -0
- package/dist/spotlight.js +138 -0
- package/dist/status-health.d.ts +16 -0
- package/dist/status-health.js +41 -0
- package/dist/status.d.ts +9 -0
- package/dist/status.js +12 -0
- package/dist/summary-cards.d.ts +56 -0
- package/dist/summary-cards.js +270 -0
- package/dist/symbol-sheet-context.d.ts +4 -0
- package/dist/symbol-sheet-context.js +5 -0
- package/dist/symbol-sheet.d.ts +9 -0
- package/dist/symbol-sheet.js +24 -0
- package/dist/tasks.d.ts +29 -0
- package/dist/tasks.js +278 -0
- package/dist/theme.css +606 -0
- package/dist/tile.d.ts +37 -0
- package/dist/tile.js +23 -0
- package/dist/ui/alert-dialog.d.ts +18 -0
- package/dist/ui/alert-dialog.js +41 -0
- package/dist/ui/alert.d.ts +10 -0
- package/dist/ui/alert.js +27 -0
- package/dist/ui/avatar.d.ts +11 -0
- package/dist/ui/avatar.js +22 -0
- package/dist/ui/badge.d.ts +9 -0
- package/dist/ui/badge.js +27 -0
- package/dist/ui/breadcrumb.d.ts +11 -0
- package/dist/ui/breadcrumb.js +27 -0
- package/dist/ui/button-group.d.ts +11 -0
- package/dist/ui/button-group.js +27 -0
- package/dist/ui/button.d.ts +10 -0
- package/dist/ui/button.js +38 -0
- package/dist/ui/card.d.ts +11 -0
- package/dist/ui/card.js +24 -0
- package/dist/ui/chart.d.ts +44 -0
- package/dist/ui/chart.js +117 -0
- package/dist/ui/checkbox.d.ts +4 -0
- package/dist/ui/checkbox.js +8 -0
- package/dist/ui/collapsible.d.ts +5 -0
- package/dist/ui/collapsible.js +12 -0
- package/dist/ui/combobox.d.ts +24 -0
- package/dist/ui/combobox.js +60 -0
- package/dist/ui/command.d.ts +18 -0
- package/dist/ui/command.js +34 -0
- package/dist/ui/dialog.d.ts +23 -0
- package/dist/ui/dialog.js +50 -0
- package/dist/ui/dropdown-menu.d.ts +29 -0
- package/dist/ui/dropdown-menu.js +50 -0
- package/dist/ui/emoji-picker.d.ts +6 -0
- package/dist/ui/emoji-picker.js +28 -0
- package/dist/ui/empty.d.ts +11 -0
- package/dist/ui/empty.js +33 -0
- package/dist/ui/field.d.ts +24 -0
- package/dist/ui/field.js +65 -0
- package/dist/ui/hover-card.d.ts +6 -0
- package/dist/ui/hover-card.js +13 -0
- package/dist/ui/input-group.d.ts +16 -0
- package/dist/ui/input-group.js +56 -0
- package/dist/ui/input.d.ts +3 -0
- package/dist/ui/input.js +6 -0
- package/dist/ui/item.d.ts +23 -0
- package/dist/ui/item.js +67 -0
- package/dist/ui/kbd.d.ts +3 -0
- package/dist/ui/kbd.js +9 -0
- package/dist/ui/label.d.ts +4 -0
- package/dist/ui/label.js +7 -0
- package/dist/ui/popover.d.ts +10 -0
- package/dist/ui/popover.js +25 -0
- package/dist/ui/progress.d.ts +4 -0
- package/dist/ui/progress.js +9 -0
- package/dist/ui/resizable.d.ts +7 -0
- package/dist/ui/resizable.js +13 -0
- package/dist/ui/scroll-area.d.ts +5 -0
- package/dist/ui/scroll-area.js +10 -0
- package/dist/ui/select.d.ts +15 -0
- package/dist/ui/select.js +36 -0
- package/dist/ui/separator.d.ts +4 -0
- package/dist/ui/separator.js +7 -0
- package/dist/ui/sheet.d.ts +14 -0
- package/dist/ui/sheet.js +54 -0
- package/dist/ui/sidebar.d.ts +69 -0
- package/dist/ui/sidebar.js +206 -0
- package/dist/ui/skeleton.d.ts +2 -0
- package/dist/ui/skeleton.js +6 -0
- package/dist/ui/slider.d.ts +4 -0
- package/dist/ui/slider.js +9 -0
- package/dist/ui/sonner.d.ts +3 -0
- package/dist/ui/sonner.js +24 -0
- package/dist/ui/spinner.d.ts +2 -0
- package/dist/ui/spinner.js +7 -0
- package/dist/ui/switch.d.ts +6 -0
- package/dist/ui/switch.js +7 -0
- package/dist/ui/table.d.ts +10 -0
- package/dist/ui/table.js +31 -0
- package/dist/ui/tabs.d.ts +7 -0
- package/dist/ui/tabs.js +22 -0
- package/dist/ui/textarea.d.ts +3 -0
- package/dist/ui/textarea.js +6 -0
- package/dist/ui/toggle-group.d.ts +10 -0
- package/dist/ui/toggle-group.js +22 -0
- package/dist/ui/toggle.d.ts +9 -0
- package/dist/ui/toggle.js +25 -0
- package/dist/ui/tooltip.d.ts +7 -0
- package/dist/ui/tooltip.js +16 -0
- package/dist/view-edit-cell.d.ts +49 -0
- package/dist/view-edit-cell.js +198 -0
- package/dist/view-editor.d.ts +52 -0
- package/dist/view-editor.js +1081 -0
- package/dist/view-formulas.d.ts +61 -0
- package/dist/view-formulas.js +247 -0
- package/dist/view-icons.d.ts +20 -0
- package/dist/view-icons.js +70 -0
- package/dist/view-model.d.ts +390 -0
- package/dist/view-model.js +316 -0
- package/dist/whats-new.d.ts +3 -0
- package/dist/whats-new.js +53 -0
- package/dist/widget-controls.d.ts +9 -0
- package/dist/widget-controls.js +26 -0
- package/dist/widget-data.d.ts +4 -0
- package/dist/widget-data.js +32 -0
- package/dist/widget-settings.d.ts +516 -0
- package/dist/widget-settings.js +290 -0
- package/dist/widget-thumbs.d.ts +3 -0
- package/dist/widget-thumbs.js +29 -0
- package/dist/workspace-keys.d.ts +12 -0
- package/dist/workspace-keys.js +13 -0
- package/dist/workspaces.d.ts +57 -0
- package/dist/workspaces.js +473 -0
- package/package.json +82 -4
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ViewCard } from '@columenlabs/lumen-ui-types/views';
|
|
2
|
+
import type { RowData } from '@tanstack/react-table';
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
import { type FilterToken } from './lumen-filter.js';
|
|
5
|
+
import type { LumenLoad } from './lumen-source.js';
|
|
6
|
+
import { type CustomViewConfig, type ViewDomain } from './lumen-view.js';
|
|
7
|
+
import { type CardControls } from './lumen-widget.js';
|
|
8
|
+
export interface LumenViewCardProps<T> {
|
|
9
|
+
/** Its card id on the page (its fold is kept per id); left out, its name. */
|
|
10
|
+
id?: string;
|
|
11
|
+
domain: ViewDomain<T>;
|
|
12
|
+
/** The view's columns, filters and pagination; the Columns picker changes them for this visit. */
|
|
13
|
+
config: CustomViewConfig;
|
|
14
|
+
rows: T[];
|
|
15
|
+
load?: LumenLoad;
|
|
16
|
+
title?: string;
|
|
17
|
+
/** Buttons in the card's header before the pager. */
|
|
18
|
+
tools?: ReactNode;
|
|
19
|
+
/** A short subtitle after the title (a repo path). */
|
|
20
|
+
note?: ReactNode;
|
|
21
|
+
/** Shown in place of the table (an empty state). */
|
|
22
|
+
state?: ReactNode;
|
|
23
|
+
/** A row click (pick a version, open a drawer). */
|
|
24
|
+
onDetails?: (row: T) => void;
|
|
25
|
+
/** Its place in the layout: the layout's `frame` hands these over. */
|
|
26
|
+
controls?: CardControls;
|
|
27
|
+
/** Its saved controls (Edit widget ▸ Controls), on a saved page's table. */
|
|
28
|
+
shown?: ViewCard['controls'];
|
|
29
|
+
/** Saves a Columns change; left out, it lasts the visit. */
|
|
30
|
+
onColumns?: (columns: string[]) => void;
|
|
31
|
+
/** Chips it shares with the cards of its colour besides its filter's: what a control in its
|
|
32
|
+
* header picked (`{key: 'book', value: 'Live'}`), like a code card's `publishes`. */
|
|
33
|
+
publishes?: FilterToken[];
|
|
34
|
+
}
|
|
35
|
+
export declare function LumenViewCard<T extends RowData>({ id, domain: base, config: saved, rows, load, title, tools, note, state, onDetails, controls, shown: savedControls, onColumns, publishes, }: LumenViewCardProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { controlOn } from '@columenlabs/lumen-ui-types/views';
|
|
3
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { useGroup } from './group-button.js';
|
|
5
|
+
import { useJoins } from './joins.js';
|
|
6
|
+
import { LumenTokenizedFilter, filterByTokens, useLumenFilter, } from './lumen-filter.js';
|
|
7
|
+
import { followedBy, followsText, keyFilterFields, useLinks, usePublishLinks, useRowPick, } from './lumen-links.js';
|
|
8
|
+
import { LumenView } from './lumen-view.js';
|
|
9
|
+
import { cardFilterFields } from './lumen-widget.js';
|
|
10
|
+
import { filterFieldsOf } from './view-model.js';
|
|
11
|
+
export function LumenViewCard({ id, domain: base, config: saved, rows, load, title, tools, note, state, onDetails, controls, shown: savedControls, onColumns, publishes, }) {
|
|
12
|
+
const [config, setConfig] = useState(saved);
|
|
13
|
+
// A saved layout that changes (an edit, the assistant move) is drawn at once.
|
|
14
|
+
const savedKey = JSON.stringify(saved);
|
|
15
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: keyed on the saved config's content.
|
|
16
|
+
useEffect(() => setConfig(saved), [savedKey]);
|
|
17
|
+
// The registry's join fields for the keys the rows carry.
|
|
18
|
+
const { domain } = useJoins(base, rows, config);
|
|
19
|
+
const fields = useMemo(() => cardFilterFields(filterFieldsOf(domain.fields, config.filters.fields)), [domain.fields, config.filters.fields]);
|
|
20
|
+
const filter = useLumenFilter(rows, fields, {
|
|
21
|
+
text: domain.text,
|
|
22
|
+
initial: config.filters.default,
|
|
23
|
+
});
|
|
24
|
+
const group = useGroup(domain, config);
|
|
25
|
+
const cardId = id ?? config.name;
|
|
26
|
+
const links = useLinks();
|
|
27
|
+
const color = links?.colorOf(cardId) ?? null;
|
|
28
|
+
const pick = useRowPick(domain, color);
|
|
29
|
+
const sharedKey = JSON.stringify(publishes ?? []);
|
|
30
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: keyed on what its header shares.
|
|
31
|
+
const published = useMemo(() => [...filter.tokens, ...pick.token, ...(publishes ?? [])], [filter.tokens, pick.token, sharedKey]);
|
|
32
|
+
usePublishLinks(cardId, published);
|
|
33
|
+
// What it follows from the page's other cards of its colour, read on any of its fields.
|
|
34
|
+
const all = useMemo(() => [...cardFilterFields(domain.fields), ...keyFilterFields(domain.keys)], [domain.fields, domain.keys]);
|
|
35
|
+
const follows = followedBy(links?.follows(cardId) ?? [], all, domain.keys);
|
|
36
|
+
const followKey = JSON.stringify(follows);
|
|
37
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: keyed on what it follows.
|
|
38
|
+
const shown = useMemo(() => follows.length ? filterByTokens(filter.results, all, follows, domain.text) : filter.results, [filter.results, all, followKey, domain.text]);
|
|
39
|
+
const link = links && {
|
|
40
|
+
color,
|
|
41
|
+
onPick: (c) => links.setColor(cardId, c),
|
|
42
|
+
follows: followsText(follows),
|
|
43
|
+
linked: color ? filter.tokens.length : 0,
|
|
44
|
+
};
|
|
45
|
+
const on = (k) => controlOn({ kind: 'table', controls: savedControls }, k);
|
|
46
|
+
return (_jsx(LumenView, { domain: domain, config: config, rows: shown, total: rows.length, groupBy: group.groupField, pivot: group.pivot, subgroup: group.sub, load: load, state: state, onDetails: pick.onTap ?? onDetails, tapped: pick.tapped, title: title ?? config.name, inLayout: true, cardId: cardId, controls: controls, tools: tools, note: note, filter: _jsxs(_Fragment, { children: [on('filter') && (_jsx(LumenTokenizedFilter, { filter: filter, label: `Filter ${config.name}`, className: "min-w-0 flex-1", link: link || undefined })), on('group') && group.button] }), filterCount: filter.tokens.length, link: link || undefined, shown: savedControls, onColumns: (columns) => {
|
|
47
|
+
setConfig((c) => ({ ...c, columns }));
|
|
48
|
+
onColumns?.(columns);
|
|
49
|
+
} }));
|
|
50
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { type CustomViewConfig, type ViewCard, type ViewChip, type ViewFormat } from '@columenlabs/lumen-ui-types/views';
|
|
2
|
+
import { type RowData } from '@tanstack/react-table';
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
import { type LumenLoad } from './lumen-source.js';
|
|
5
|
+
import { type CardControls, type CardLink } from './lumen-widget.js';
|
|
6
|
+
import { type ViewCellValue, type ViewChipTone, type ViewDomain, type ViewField, type ViewSubgroup } from './view-model.js';
|
|
7
|
+
export type { ViewCellValue, ViewChipTone, ViewDomain, ViewField, ViewFieldGroup, ViewSource, } from './view-model.js';
|
|
8
|
+
export { CHIP_TONE, FORMULAS_GROUP, RUN_STATE_TONE } from './view-model.js';
|
|
9
|
+
export { rollUp } from './view-model.js';
|
|
10
|
+
export type { ViewEditorSection } from './view-editor.js';
|
|
11
|
+
/**
|
|
12
|
+
* Rows that share the domain's merge key, folded into one row each: within each group, or across
|
|
13
|
+
* every row when nothing is grouped (no duplicate rows in the flat table).
|
|
14
|
+
*/
|
|
15
|
+
export declare function mergeRows<T>(domain: ViewDomain<T>, rows: T[], groupBy: ViewField<T> | null): T[];
|
|
16
|
+
/** A saved view (`@columenlabs/lumen-ui-types/views`); agents write the same shape through MCP. */
|
|
17
|
+
export type { CustomViewConfig };
|
|
18
|
+
/** A value as its field's format reads: tabular figures, a true minus, gain/loss on signed values. */
|
|
19
|
+
export declare function ViewValueCell({ value, format, chip, tone, color, amount, compact, empty, }: {
|
|
20
|
+
value: ViewCellValue;
|
|
21
|
+
format: ViewFormat;
|
|
22
|
+
/** Text shown as a chip (a view's `chips` setting). */
|
|
23
|
+
chip?: boolean;
|
|
24
|
+
/** The chip's colour (a field's `tone`). */
|
|
25
|
+
tone?: ViewChipTone;
|
|
26
|
+
/** A dot of this colour before text (a field's `color`). */
|
|
27
|
+
color?: string;
|
|
28
|
+
/** A holding amount: shown as `•••••` while Hide amounts is on. */
|
|
29
|
+
amount?: boolean;
|
|
30
|
+
/** Large numbers in short form: $283.1B, 6.1M. */
|
|
31
|
+
compact?: boolean;
|
|
32
|
+
/** What an empty cell says; left out: a dash. */
|
|
33
|
+
empty?: string;
|
|
34
|
+
}): import("react").JSX.Element;
|
|
35
|
+
export declare const VIEW_SCROLL = "@container h-[calc(100svh-var(--shell-header-height)-var(--shell-status-height)-var(--shell-gutter))] overflow-auto px-[max(var(--shell-gutter),calc((100%-var(--shell-max-width))/2+var(--shell-gutter)))] pb-(--shell-gutter) [--view-w:calc(100cqw-var(--view-sb,0px))]";
|
|
36
|
+
/** The page body around `VIEW_SCROLL`: the scroller draws the side and bottom gutter and max width. */
|
|
37
|
+
export declare const VIEW_PAGE = "max-w-none px-0 pb-0";
|
|
38
|
+
/** The details: a folded row's own rows as a table, then the domain's sections. */
|
|
39
|
+
export declare function DetailsBody<T extends RowData>({ domain, row, columns, chips, }: {
|
|
40
|
+
domain: ViewDomain<T>;
|
|
41
|
+
row: T;
|
|
42
|
+
columns: ViewField<T>[];
|
|
43
|
+
chips: ViewChip[];
|
|
44
|
+
}): import("react").JSX.Element;
|
|
45
|
+
export interface LumenViewProps<T> {
|
|
46
|
+
/** The view's domain, its formula columns included (`withViewFields`). */
|
|
47
|
+
domain: ViewDomain<T>;
|
|
48
|
+
config: CustomViewConfig;
|
|
49
|
+
/** The rows the view shows: its page's filter already applied. */
|
|
50
|
+
rows: T[];
|
|
51
|
+
/** Every row before the filter, for "12 of 40 rows"; left out: `rows`. */
|
|
52
|
+
total?: number;
|
|
53
|
+
/** The grouping the page picked (its Group by switch); null: flat rows. */
|
|
54
|
+
groupBy?: ViewField<T> | null;
|
|
55
|
+
/** Shows the view's pivot instead of its rows. */
|
|
56
|
+
pivot?: boolean;
|
|
57
|
+
/** What each row opens, by the domain's sub-group key (the page's Group button); null: none,
|
|
58
|
+
* left out: the view's saved pick. */
|
|
59
|
+
subgroup?: string | null;
|
|
60
|
+
/** The rows' loading state (`useLumenLoad`): the view shows its skeleton, progress bar, ↻, a
|
|
61
|
+
* failure with Retry and, with Observability details on, its load time. */
|
|
62
|
+
load?: LumenLoad;
|
|
63
|
+
/** Shown in place of the table instead of the rows, e.g. an empty state ("No accounts yet"). */
|
|
64
|
+
state?: ReactNode;
|
|
65
|
+
/** The card's title; left out: the view's name. */
|
|
66
|
+
title?: string;
|
|
67
|
+
/** Row checkboxes (strategy lab): the checked row keys and their setter; the
|
|
68
|
+
* header box checks every shown row. */
|
|
69
|
+
selection?: {
|
|
70
|
+
keys: Set<string>;
|
|
71
|
+
onChange: (keys: Set<string>) => void;
|
|
72
|
+
};
|
|
73
|
+
/** A row click: opens the details drawer, or the row's own page. */
|
|
74
|
+
onDetails?: (row: T) => void;
|
|
75
|
+
/** Rows picked by a tap (a linked table's row filter): a muted fill, no border. */
|
|
76
|
+
tapped?: (row: T) => boolean;
|
|
77
|
+
/** Buttons at the end of a group row's label (pin a group), given its key and rows. */
|
|
78
|
+
groupActions?: (key: string, rows: T[]) => ReactNode;
|
|
79
|
+
/** Its place in a LumenLayout: the layout's edit state and the card's ⋯ menu. */
|
|
80
|
+
controls?: CardControls;
|
|
81
|
+
/** In a LumenLayout's scroller: the table scrolls with the page, its header pinned. */
|
|
82
|
+
inLayout?: boolean;
|
|
83
|
+
/** The card's id on its page (its fold is kept per id); a page's second table passes its own. */
|
|
84
|
+
cardId?: string;
|
|
85
|
+
/** Buttons in the card's header before the pager ("+ Add time"). */
|
|
86
|
+
tools?: ReactNode;
|
|
87
|
+
/** The view's own filter and Group in its header (the filter is the table's,
|
|
88
|
+
* not the page's), and how many tokens it holds. */
|
|
89
|
+
filter?: ReactNode;
|
|
90
|
+
filterCount?: number;
|
|
91
|
+
/** A line under the filter: the card's Link offer. */
|
|
92
|
+
strip?: ReactNode;
|
|
93
|
+
/** Its link colour on the layout. */
|
|
94
|
+
link?: CardLink;
|
|
95
|
+
/** A short subtitle after the title (a repo path). */
|
|
96
|
+
note?: ReactNode;
|
|
97
|
+
/** The Columns picker in the header: turns any of the domain's fields on
|
|
98
|
+
* or off and hands back the view's new columns. Left out: no picker. */
|
|
99
|
+
onColumns?: (keys: string[]) => void;
|
|
100
|
+
/** The + at the end of the header (Edits in place): Field (the Columns
|
|
101
|
+
* picker, at the +), Formula, Your data and Ask the assistant; each left out is not offered. */
|
|
102
|
+
onAddColumn?: AddColumn;
|
|
103
|
+
/** The sort shown, when the page holds it (rule C); left out: the view's saved sort. */
|
|
104
|
+
sort?: CustomViewConfig['sort'];
|
|
105
|
+
/** Told when a header click changes the sort. */
|
|
106
|
+
onSort?: (sort: CustomViewConfig['sort']) => void;
|
|
107
|
+
/** Its controls from its card (Edit widget ▸ Controls); missing keys take the Table defaults. */
|
|
108
|
+
shown?: ViewCard['controls'];
|
|
109
|
+
}
|
|
110
|
+
/** What the header's + offers. */
|
|
111
|
+
export interface AddColumn {
|
|
112
|
+
/** Formula: a column computed from the others; `disabled` says why it is not offered here. */
|
|
113
|
+
formula?: (() => void) | {
|
|
114
|
+
disabled: string;
|
|
115
|
+
};
|
|
116
|
+
/** Your data: a column the person types; `disabled` says why it is not offered here. */
|
|
117
|
+
yours?: (() => void) | {
|
|
118
|
+
disabled: string;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* LumenView (a card of its own): a data
|
|
123
|
+
* view over one domain, as a card. Its header has the view's name, the row count and pager, its ↻
|
|
124
|
+
* and ⋯, and its own filter and Group (they narrow this table only); its body
|
|
125
|
+
* the table (grouped one level, or the pivot) with the loading states.
|
|
126
|
+
*/
|
|
127
|
+
export declare function LumenView<T extends RowData>({ domain, config, rows, total, groupBy, pivot, subgroup, load: sourceLoad, state, title, selection, onDetails, tapped, groupActions, controls, inLayout: inScroller, cardId, tools, filter, filterCount, strip, link, note, onColumns, onAddColumn, sort, onSort, shown, }: LumenViewProps<T>): import("react").JSX.Element;
|
|
128
|
+
/** A field's colour for its header: its topic's source (a broker green, an app brown) where
|
|
129
|
+
* the group names one, else its group's (Holding, Symbol, Account, Formulas). */
|
|
130
|
+
export declare function colorOf<T>(domain: ViewDomain<T>, f: ViewField<T> | undefined): string | null;
|
|
131
|
+
/** The plain table LumenView draws, also standalone for lists that are not a whole view; with
|
|
132
|
+
* `load` it shows its own skeleton, progress bar and failure. */
|
|
133
|
+
export declare function LumenTable<T extends RowData>({ load, ...props }: LumenTableProps<T> & {
|
|
134
|
+
load?: LumenLoad;
|
|
135
|
+
}): import("react").JSX.Element;
|
|
136
|
+
export interface LumenTableProps<T> {
|
|
137
|
+
domain: ViewDomain<T>;
|
|
138
|
+
/** The fields shown, in order; every field of the domain when left out. */
|
|
139
|
+
columns?: ViewField<T>[];
|
|
140
|
+
rows: T[];
|
|
141
|
+
groupBy?: ViewField<T> | null;
|
|
142
|
+
chips?: ViewChip[];
|
|
143
|
+
/** The page a flat table shows; null shows every row. */
|
|
144
|
+
page?: {
|
|
145
|
+
index: number;
|
|
146
|
+
size: number;
|
|
147
|
+
} | null;
|
|
148
|
+
/** The view page's own table, which scrolls with the page rather than in its card. */
|
|
149
|
+
inView?: boolean;
|
|
150
|
+
/** Text cells wrap so the table fits the width there is, rather than scrolling sideways. */
|
|
151
|
+
fit?: boolean;
|
|
152
|
+
onDetails?: (row: T) => void;
|
|
153
|
+
tapped?: LumenViewProps<T>['tapped'];
|
|
154
|
+
selection?: LumenViewProps<T>['selection'];
|
|
155
|
+
groupActions?: LumenViewProps<T>['groupActions'];
|
|
156
|
+
/** The view's default sort; a header click changes it for the visit. */
|
|
157
|
+
sort?: CustomViewConfig['sort'];
|
|
158
|
+
/** Told the sort a header click sets, so a page can hold or save it (rule C). */
|
|
159
|
+
onSort?: (sort: CustomViewConfig['sort']) => void;
|
|
160
|
+
/** The + Add column head at the end of the header. */
|
|
161
|
+
add?: AddColumn & {
|
|
162
|
+
field?: {
|
|
163
|
+
domain: ViewDomain<T>;
|
|
164
|
+
columns: ViewField<T>[];
|
|
165
|
+
onColumns: (keys: string[]) => void;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
/** Draws the Total row under the rows; the view's `total: false` leaves it out. */
|
|
169
|
+
total?: boolean;
|
|
170
|
+
/** What each row opens under it (`subgroupOf`); null: rows open nothing but their panel. */
|
|
171
|
+
subgroup?: ViewSubgroup<T> | null;
|
|
172
|
+
}
|