@altertable/data-app-react 0.0.0-stage → 0.72.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/LICENSE +21 -0
- package/README.md +59 -2
- package/THIRD_PARTY_NOTICES +18 -0
- package/dist/chunks/index-xwy62xrb.js +16996 -0
- package/dist/chunks/index-xwy62xrb.js.map +120 -0
- package/dist/index.js +2888 -0
- package/dist/index.js.map +23 -0
- package/dist/types/actions.d.ts +53 -0
- package/dist/types/annotations/AnnotationBar.d.ts +30 -0
- package/dist/types/annotations/AnnotationControls.d.ts +10 -0
- package/dist/types/annotations/AnnotationEditor.d.ts +16 -0
- package/dist/types/annotations/AnnotationMarkers.d.ts +19 -0
- package/dist/types/annotations/AnnotationSelectionLayer.d.ts +12 -0
- package/dist/types/annotations/AnnotationTarget.d.ts +9 -0
- package/dist/types/annotations/AnnotationTooltip.d.ts +9 -0
- package/dist/types/annotations/AnnotationTrigger.d.ts +10 -0
- package/dist/types/annotations/annotation-editor-state.d.ts +58 -0
- package/dist/types/annotations/annotation-screenshot.d.ts +4 -0
- package/dist/types/annotations/annotation-targets.d.ts +34 -0
- package/dist/types/annotations/getAnnotationProps.d.ts +17 -0
- package/dist/types/annotations/styles.d.ts +3 -0
- package/dist/types/annotations/useAnnotationGeometry.d.ts +22 -0
- package/dist/types/annotations/useDataAppAnnotations.d.ts +22 -0
- package/dist/types/app-context.d.ts +3 -0
- package/dist/types/bindings.d.ts +169 -0
- package/dist/types/content.d.ts +36 -0
- package/dist/types/date-formatting.d.ts +12 -0
- package/dist/types/details.d.ts +46 -0
- package/dist/types/exploration.d.ts +44 -0
- package/dist/types/hooks.d.ts +114 -0
- package/dist/types/index.d.ts +78 -0
- package/dist/types/injectStyles.d.ts +7 -0
- package/dist/types/mount.d.ts +13 -0
- package/dist/types/search-suggestions.d.ts +8 -0
- package/dist/types/source-owner.d.ts +2 -0
- package/dist/types/style-contract.d.ts +88 -0
- package/dist/types/style-validation.d.ts +2 -0
- package/dist/types/styles.d.ts +8 -0
- package/dist/types/ui/AboutData.d.ts +73 -0
- package/dist/types/ui/AltertableLogo.d.ts +3 -0
- package/dist/types/ui/AppFooter.d.ts +6 -0
- package/dist/types/ui/AppHeader.d.ts +10 -0
- package/dist/types/ui/AppLayout.d.ts +10 -0
- package/dist/types/ui/AppScope.d.ts +7 -0
- package/dist/types/ui/AppToolbar.d.ts +30 -0
- package/dist/types/ui/AreaChart.d.ts +7 -0
- package/dist/types/ui/BarChart.d.ts +6 -0
- package/dist/types/ui/Breakdown.d.ts +13 -0
- package/dist/types/ui/Button.d.ts +12 -0
- package/dist/types/ui/ChartLegend.d.ts +32 -0
- package/dist/types/ui/Checkbox.d.ts +21 -0
- package/dist/types/ui/CheckboxGroup.d.ts +7 -0
- package/dist/types/ui/ChoicePicker.d.ts +39 -0
- package/dist/types/ui/Comparison.d.ts +14 -0
- package/dist/types/ui/ComposedChart.d.ts +41 -0
- package/dist/types/ui/ComposedChartLegend.d.ts +9 -0
- package/dist/types/ui/ContentSkeleton.d.ts +7 -0
- package/dist/types/ui/DataApp.d.ts +24 -0
- package/dist/types/ui/DataAppFrame.d.ts +52 -0
- package/dist/types/ui/DataBoundary.d.ts +14 -0
- package/dist/types/ui/DataSection.d.ts +14 -0
- package/dist/types/ui/DataSectionBoundary.d.ts +30 -0
- package/dist/types/ui/DataTable.d.ts +29 -0
- package/dist/types/ui/DataValue.d.ts +9 -0
- package/dist/types/ui/DataViewToast.d.ts +11 -0
- package/dist/types/ui/DataWidget.d.ts +37 -0
- package/dist/types/ui/DateDisplay.d.ts +9 -0
- package/dist/types/ui/DateRangePicker.d.ts +30 -0
- package/dist/types/ui/DateTimeTooltip.d.ts +10 -0
- package/dist/types/ui/DimensionPicker.d.ts +14 -0
- package/dist/types/ui/EmptyState.d.ts +6 -0
- package/dist/types/ui/ExplorationActionControl.d.ts +60 -0
- package/dist/types/ui/ExportControl.d.ts +4 -0
- package/dist/types/ui/FilterActions.d.ts +10 -0
- package/dist/types/ui/FilterBar.d.ts +3 -0
- package/dist/types/ui/FunnelChart.d.ts +20 -0
- package/dist/types/ui/GettingStarted.d.ts +6 -0
- package/dist/types/ui/GlossaryDefinition.d.ts +7 -0
- package/dist/types/ui/GlossaryExplanation.d.ts +16 -0
- package/dist/types/ui/GradientScroll.d.ts +23 -0
- package/dist/types/ui/Grid.d.ts +12 -0
- package/dist/types/ui/GridItem.d.ts +7 -0
- package/dist/types/ui/HelpPopover.d.ts +21 -0
- package/dist/types/ui/IconButton.d.ts +19 -0
- package/dist/types/ui/InspectionContext.d.ts +12 -0
- package/dist/types/ui/InspectionProvider.d.ts +29 -0
- package/dist/types/ui/JourneyChart.d.ts +10 -0
- package/dist/types/ui/Kbd.d.ts +7 -0
- package/dist/types/ui/LineChart.d.ts +7 -0
- package/dist/types/ui/LiveControl.d.ts +10 -0
- package/dist/types/ui/Menu.d.ts +13 -0
- package/dist/types/ui/MetricWidget.d.ts +51 -0
- package/dist/types/ui/NumberField.d.ts +27 -0
- package/dist/types/ui/NumberFilterPicker.d.ts +11 -0
- package/dist/types/ui/PeriodSummary.d.ts +17 -0
- package/dist/types/ui/PickerField.d.ts +23 -0
- package/dist/types/ui/PieChart.d.ts +11 -0
- package/dist/types/ui/PopoverSurface.d.ts +5 -0
- package/dist/types/ui/PresentStory.d.ts +30 -0
- package/dist/types/ui/QueryList.d.ts +14 -0
- package/dist/types/ui/RadioGroup.d.ts +18 -0
- package/dist/types/ui/Ranking.d.ts +13 -0
- package/dist/types/ui/RefreshControl.d.ts +9 -0
- package/dist/types/ui/RequestHint.d.ts +20 -0
- package/dist/types/ui/RetentionChart.d.ts +27 -0
- package/dist/types/ui/ScatterChart.d.ts +17 -0
- package/dist/types/ui/SearchField.d.ts +23 -0
- package/dist/types/ui/SearchInput.d.ts +10 -0
- package/dist/types/ui/SearchMatch.d.ts +6 -0
- package/dist/types/ui/SearchTypeahead.d.ts +15 -0
- package/dist/types/ui/SectionHeading.d.ts +8 -0
- package/dist/types/ui/Select.d.ts +22 -0
- package/dist/types/ui/SelectionMark.d.ts +5 -0
- package/dist/types/ui/Sheet.d.ts +21 -0
- package/dist/types/ui/Skeleton.d.ts +8 -0
- package/dist/types/ui/Stack.d.ts +7 -0
- package/dist/types/ui/StaticDataApp.d.ts +4 -0
- package/dist/types/ui/StatusPanel.d.ts +10 -0
- package/dist/types/ui/TableWidget.d.ts +67 -0
- package/dist/types/ui/Tabs.d.ts +10 -0
- package/dist/types/ui/TextContent.d.ts +4 -0
- package/dist/types/ui/TextWidget.d.ts +20 -0
- package/dist/types/ui/ThemeSelector.d.ts +12 -0
- package/dist/types/ui/Toast.d.ts +8 -0
- package/dist/types/ui/Tooltip.d.ts +23 -0
- package/dist/types/ui/TooltipSurface.d.ts +3 -0
- package/dist/types/ui/TrendChart.d.ts +5 -0
- package/dist/types/ui/UpdatedAt.d.ts +9 -0
- package/dist/types/ui/VariableBar.d.ts +6 -0
- package/dist/types/ui/VisualizationWidget.d.ts +43 -0
- package/dist/types/ui/WidgetDisclosure.d.ts +6 -0
- package/dist/types/ui/WidgetEvidence.d.ts +12 -0
- package/dist/types/ui/WidgetViewTabs.d.ts +16 -0
- package/dist/types/ui/chart-data.d.ts +36 -0
- package/dist/types/ui/chart-date-axis.d.ts +15 -0
- package/dist/types/ui/chart-interaction.d.ts +27 -0
- package/dist/types/ui/chart-primitives.d.ts +22 -0
- package/dist/types/ui/chart-time.d.ts +19 -0
- package/dist/types/ui/chartColor.d.ts +2 -0
- package/dist/types/ui/classNames.d.ts +1 -0
- package/dist/types/ui/csv-export.d.ts +19 -0
- package/dist/types/ui/data-context.d.ts +76 -0
- package/dist/types/ui/data-identifiers.d.ts +32 -0
- package/dist/types/ui/icons.d.ts +49 -0
- package/dist/types/ui/index.d.ts +111 -0
- package/dist/types/ui/journey-flow.d.ts +49 -0
- package/dist/types/ui/keyboard.d.ts +6 -0
- package/dist/types/ui/metric-comparison.d.ts +30 -0
- package/dist/types/ui/metric.d.ts +11 -0
- package/dist/types/ui/presentation.d.ts +25 -0
- package/dist/types/ui/search.d.ts +6 -0
- package/dist/types/ui/searchItems.d.ts +36 -0
- package/dist/types/ui/shortcuts.d.ts +45 -0
- package/dist/types/ui/story.d.ts +20 -0
- package/dist/types/ui/time-interval.d.ts +96 -0
- package/dist/types/ui/use-chart-scroll-to-end.d.ts +2 -0
- package/dist/types/ui/useAppAppearance.d.ts +3 -0
- package/dist/types/ui/useDataAppPresentation.d.ts +3 -0
- package/dist/types/ui/useSvgId.d.ts +2 -0
- package/dist/types/ui/variables.d.ts +36 -0
- package/dist/types/ui/widget-views.d.ts +3 -0
- package/dist/types/view-control-bar.d.ts +18 -0
- package/dist/types/view-controls.d.ts +20 -0
- package/dist/types/view-runtime.d.ts +34 -0
- package/dist/types/view.d.ts +87 -0
- package/dist/types/widgets.d.ts +90 -0
- package/dist/ui/index.js +3520 -0
- package/dist/ui/index.js.map +36 -0
- package/package.json +65 -4
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { type DetailNavigation } from './details.js';
|
|
2
|
+
import { type ActionBuilder, type ExplorationActions, type ActionDeclaration } from './actions.js';
|
|
3
|
+
import type { EvidenceDeclaration } from './ui/data-context.js';
|
|
4
|
+
import type { SearchSuggestion } from './ui/SearchTypeahead.js';
|
|
5
|
+
import { type ReactNode } from 'react';
|
|
6
|
+
import type { DateFormat } from '@altertable/data-app/format';
|
|
7
|
+
import type { DateRangeRequest } from '@altertable/data-app/contract';
|
|
8
|
+
import type { DataView, DisplayedSnapshot } from '@altertable/data-app/internal';
|
|
9
|
+
import type { MetricFormat } from '@altertable/data-app/format';
|
|
10
|
+
import type { DataReading, MetricValues } from '@altertable/data-app/internal';
|
|
11
|
+
import type { CsvCell, CsvTable, CsvExport } from './ui/csv-export.js';
|
|
12
|
+
import type { MetricDefinition } from './ui/metric.js';
|
|
13
|
+
import type { EmptyContent } from './ui/presentation.js';
|
|
14
|
+
import type { TableWidgetColumn } from './ui/TableWidget.js';
|
|
15
|
+
import type { WidgetEvidence } from './ui/WidgetEvidence.js';
|
|
16
|
+
import { DetailView } from './details.js';
|
|
17
|
+
/** Displayed data, or an initial loading reading. Pending filter values are never a source. */
|
|
18
|
+
export type ViewSource<Data, Input> = {
|
|
19
|
+
loading: true;
|
|
20
|
+
} | {
|
|
21
|
+
loading?: false;
|
|
22
|
+
data: Data;
|
|
23
|
+
input: Input;
|
|
24
|
+
};
|
|
25
|
+
type SourceReading<Source, Value> = Source extends {
|
|
26
|
+
loading: true;
|
|
27
|
+
} ? {
|
|
28
|
+
loading: true;
|
|
29
|
+
} : {
|
|
30
|
+
loading: false;
|
|
31
|
+
value: Value;
|
|
32
|
+
};
|
|
33
|
+
/** Keys supply IDs; accessors supply raw CSV values. Formats affect display only. */
|
|
34
|
+
export type DatasetColumn<Row> = {
|
|
35
|
+
label?: string;
|
|
36
|
+
} & ({
|
|
37
|
+
value: (row: Row) => CsvCell;
|
|
38
|
+
format?: (row: Row) => ReactNode;
|
|
39
|
+
} | {
|
|
40
|
+
value: (row: Row) => number | null | undefined;
|
|
41
|
+
format: MetricFormat;
|
|
42
|
+
} | {
|
|
43
|
+
value: (row: Row) => string | number | null | undefined;
|
|
44
|
+
format: Extract<DateFormat, {
|
|
45
|
+
kind: 'dateTime';
|
|
46
|
+
}>;
|
|
47
|
+
} | {
|
|
48
|
+
value: (row: Row) => string | null | undefined;
|
|
49
|
+
format: Extract<DateFormat, {
|
|
50
|
+
kind: 'date';
|
|
51
|
+
}>;
|
|
52
|
+
});
|
|
53
|
+
export type DatasetDefinition<Data, Input, Row, Evidence = WidgetEvidence> = {
|
|
54
|
+
name: string;
|
|
55
|
+
select: (data: Data, input: Input) => readonly Row[];
|
|
56
|
+
columns: Record<string, DatasetColumn<NoInfer<Row>>>;
|
|
57
|
+
rowKey: (row: NoInfer<Row>) => string | number;
|
|
58
|
+
evidence: Evidence;
|
|
59
|
+
emptyFallback?: EmptyContent;
|
|
60
|
+
/** Declare for records whose titles are useful query completions; omit for aggregate rows. */
|
|
61
|
+
suggestions?: DatasetSuggestionOptions<Row>;
|
|
62
|
+
};
|
|
63
|
+
export type DatasetSuggestionOptions<Row> = {
|
|
64
|
+
title: (row: Row) => string;
|
|
65
|
+
description?: (row: Row) => string;
|
|
66
|
+
/** Override query completion with an app action. */
|
|
67
|
+
onSelect?: (row: Row) => void;
|
|
68
|
+
};
|
|
69
|
+
/** Authoring references are registered by the owning view. */
|
|
70
|
+
export type DatasetDeclaration<Data, Input, Row> = DatasetDefinition<Data, Input, Row, EvidenceDeclaration>;
|
|
71
|
+
/** Real view ownership and registered references, shared by metrics and datasets. */
|
|
72
|
+
export declare class RegisteredBinding {
|
|
73
|
+
#private;
|
|
74
|
+
constructor(owner?: object, evidence?: WidgetEvidence);
|
|
75
|
+
/** @internal */
|
|
76
|
+
static owner(binding: RegisteredBinding): object | undefined;
|
|
77
|
+
protected assertSource(source: object): void;
|
|
78
|
+
static evidence(binding: RegisteredBinding, owner: object): WidgetEvidence;
|
|
79
|
+
}
|
|
80
|
+
export declare function registeredEvidence(binding: RegisteredBinding, owner: object): WidgetEvidence;
|
|
81
|
+
export declare class ExportDataset<Data, Input> extends RegisteredBinding {
|
|
82
|
+
#private;
|
|
83
|
+
readonly name: string;
|
|
84
|
+
/** @internal Undefined means this dataset declares no record suggestions. */
|
|
85
|
+
readSearchSuggestions(_source: ViewSource<Data, Input>): DataReading<readonly SearchSuggestion[]> | undefined;
|
|
86
|
+
constructor(name: string, csv: (snapshot: DisplayedSnapshot<Data, Input>) => CsvTable, owner?: object, evidence?: WidgetEvidence);
|
|
87
|
+
static csv<Data, Input>(dataset: ExportDataset<Data, Input>, snapshot: DisplayedSnapshot<Data, Input>): CsvTable;
|
|
88
|
+
}
|
|
89
|
+
export declare class Dataset<Data, Input, Row> extends ExportDataset<Data, Input> {
|
|
90
|
+
#private;
|
|
91
|
+
readonly evidence: WidgetEvidence;
|
|
92
|
+
constructor(definition: DatasetDefinition<Data, Input, Row>, owner?: object, timeZone?: string);
|
|
93
|
+
actions<const Actions extends Record<string, ActionDeclaration<Row, Input>>>(build: (action: ActionBuilder<Row, Input>) => Actions, options?: {
|
|
94
|
+
primary?: keyof Actions & string;
|
|
95
|
+
}): ExplorationActions<Row, Input>;
|
|
96
|
+
readSearchSuggestions(source: ViewSource<Data, Input>): DataReading<readonly SearchSuggestion[]> | undefined;
|
|
97
|
+
read: <Source extends ViewSource<Data, Input>>(source: Source) => SourceReading<Source, readonly Row[]>;
|
|
98
|
+
static table<Data, Input, Row>(dataset: Dataset<Data, Input, Row>, source: ViewSource<Data, Input>): {
|
|
99
|
+
title: string;
|
|
100
|
+
columns: [TableWidgetColumn<Row>, ...TableWidgetColumn<Row>[]];
|
|
101
|
+
rowKey: (row: Row) => string | number;
|
|
102
|
+
evidence: WidgetEvidence;
|
|
103
|
+
emptyFallback: EmptyContent;
|
|
104
|
+
reading: {
|
|
105
|
+
loading: true;
|
|
106
|
+
} | {
|
|
107
|
+
loading: false;
|
|
108
|
+
value: readonly Row[];
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
export declare function bindDataset<Data, Input, Row>(definition: DatasetDefinition<Data, Input, Row>, owner?: object, timeZone?: string): Dataset<Data, Input, Row>;
|
|
113
|
+
export declare function datasetTable<Data, Input, Row>(dataset: Dataset<Data, Input, Row>, source: ViewSource<Data, Input>): {
|
|
114
|
+
title: string;
|
|
115
|
+
columns: [TableWidgetColumn<Row>, ...TableWidgetColumn<Row>[]];
|
|
116
|
+
rowKey: (row: Row) => string | number;
|
|
117
|
+
evidence: WidgetEvidence;
|
|
118
|
+
emptyFallback: EmptyContent;
|
|
119
|
+
reading: {
|
|
120
|
+
loading: true;
|
|
121
|
+
} | {
|
|
122
|
+
loading: false;
|
|
123
|
+
value: readonly Row[];
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
export declare function datasetCsv<Data, Input>(dataset: ExportDataset<Data, Input>, snapshot: DisplayedSnapshot<Data, Input>): CsvTable;
|
|
127
|
+
export declare class Metric<Data, Input> extends RegisteredBinding {
|
|
128
|
+
#private;
|
|
129
|
+
readonly definition: MetricDefinition;
|
|
130
|
+
constructor(definition: MetricDefinition, select: (data: Data, input: Input) => MetricValues, date?: (input: Input) => DateRangeRequest, owner?: object);
|
|
131
|
+
read: <Source extends ViewSource<Data, Input>>(source: Source) => SourceReading<Source, MetricValues & {
|
|
132
|
+
period?: DateRangeRequest;
|
|
133
|
+
}>;
|
|
134
|
+
records<DetailData, DetailInput>(options: {
|
|
135
|
+
target: DetailView<DetailData, DetailInput>;
|
|
136
|
+
input: (displayedInput: Input) => DetailInput;
|
|
137
|
+
}): MetricRecords<Data, Input, DetailData, DetailInput>;
|
|
138
|
+
actions<const Actions extends Record<string, ActionDeclaration<void, Input>>>(build: (action: ActionBuilder<void, Input>) => Actions, options?: {
|
|
139
|
+
primary?: keyof Actions & string;
|
|
140
|
+
}): ExplorationActions<void, Input>;
|
|
141
|
+
}
|
|
142
|
+
/** A metric-owned record destination. It can only render from that metric's displayed source. */
|
|
143
|
+
export declare class MetricRecords<Data, Input, DetailData, DetailInput> {
|
|
144
|
+
#private;
|
|
145
|
+
constructor(metric: Metric<Data, Input>, target: DetailView<DetailData, DetailInput>, input: (displayedInput: Input) => DetailInput);
|
|
146
|
+
render(source: ViewSource<Data, Input>, navigation?: DetailNavigation): {
|
|
147
|
+
scope: string;
|
|
148
|
+
content: import("react").FunctionComponentElement<{
|
|
149
|
+
content: import("./details.js").DetailContent<any, any>;
|
|
150
|
+
input: any;
|
|
151
|
+
navigation?: DetailNavigation;
|
|
152
|
+
}>;
|
|
153
|
+
} | undefined;
|
|
154
|
+
static render<Data, Input, DetailData, DetailInput>(records: MetricRecords<Data, Input, DetailData, DetailInput>, metric: Metric<Data, Input>, source: ViewSource<Data, Input>, navigation?: DetailNavigation): {
|
|
155
|
+
scope: string;
|
|
156
|
+
content: import("react").FunctionComponentElement<{
|
|
157
|
+
content: import("./details.js").DetailContent<any, any>;
|
|
158
|
+
input: any;
|
|
159
|
+
navigation?: DetailNavigation;
|
|
160
|
+
}>;
|
|
161
|
+
} | undefined;
|
|
162
|
+
}
|
|
163
|
+
export declare function bindMetric<Data, Input>(definition: MetricDefinition, select: (data: Data, input: Input) => MetricValues, date?: (input: Input) => DateRangeRequest, owner?: object): Metric<Data, Input>;
|
|
164
|
+
export declare function displayedScope<Data, Input>(view: DataView<Data, Input>, describeInput: (input: Input) => string): DataReading<string>;
|
|
165
|
+
export declare function exportDatasets<Data, Input>(datasets: readonly [
|
|
166
|
+
ExportDataset<Data, Input>,
|
|
167
|
+
...ExportDataset<Data, Input>[]
|
|
168
|
+
], snapshot: DisplayedSnapshot<Data, Input>, scope: string, appTitle: string): CsvExport;
|
|
169
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type DeclaredView } from './view-runtime.js';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import { type DataReading } from '@altertable/data-app/internal';
|
|
4
|
+
export type DataContentState<Data, Input> = {
|
|
5
|
+
scope: DataReading<string>;
|
|
6
|
+
} & ({
|
|
7
|
+
loading: true;
|
|
8
|
+
data?: never;
|
|
9
|
+
input?: never;
|
|
10
|
+
} | {
|
|
11
|
+
loading: false;
|
|
12
|
+
data: Data;
|
|
13
|
+
input: Input;
|
|
14
|
+
});
|
|
15
|
+
/** Content receives only displayed data, its original input, and the derived scope. */
|
|
16
|
+
export declare function defineDataContent<Data, Input>(render: (state: DataContentState<Data, Input>) => ReactNode, options?: {
|
|
17
|
+
describeInput?: (input: Input) => string;
|
|
18
|
+
}): {
|
|
19
|
+
loadingFallback: ReactNode;
|
|
20
|
+
children(this: void, data: Data, input: Input): ReactNode;
|
|
21
|
+
};
|
|
22
|
+
/** A section's request owner and render layout are declared together. */
|
|
23
|
+
export declare class ViewContent<Data, Input> {
|
|
24
|
+
#private;
|
|
25
|
+
constructor(view: DeclaredView<Data, Input>, render: (source: DataContentState<Data, Input>) => ReactNode, describeInput: (input: Input) => string);
|
|
26
|
+
static section<Data, Input>(content: ViewContent<Data, Input>): {
|
|
27
|
+
loadingFallback: ReactNode;
|
|
28
|
+
children(this: void, data: Data, input: Input): ReactNode;
|
|
29
|
+
view: DeclaredView<Data, Input, unknown>;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export declare function sectionContent<Data, Input>(content: ViewContent<Data, Input>): {
|
|
33
|
+
loadingFallback: ReactNode;
|
|
34
|
+
children(this: void, data: Data, input: Input): ReactNode;
|
|
35
|
+
view: DeclaredView<Data, Input, unknown>;
|
|
36
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** The reporting zone belongs to the displayed view, not the browser. */
|
|
2
|
+
export declare const DateFormattingContext: import("react").Context<{
|
|
3
|
+
timeZone?: string;
|
|
4
|
+
}>;
|
|
5
|
+
/** Resolve date display defaults for custom charts and narrative. Explicit options override the view and app. */
|
|
6
|
+
export declare function useDateFormatting(options?: {
|
|
7
|
+
locale?: string;
|
|
8
|
+
timeZone?: string;
|
|
9
|
+
}): {
|
|
10
|
+
locale: string;
|
|
11
|
+
timeZone: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { EmptyContent } from './ui/presentation.js';
|
|
3
|
+
import type { ViewSource } from './bindings.js';
|
|
4
|
+
import type { ViewResult } from './view-runtime.js';
|
|
5
|
+
export type DetailViewDefinition<Data, Input> = {
|
|
6
|
+
id: string;
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
/** Validates untrusted navigation input before a detail operation can run. */
|
|
9
|
+
parseInput: (input: unknown) => Input;
|
|
10
|
+
describeInput: (input: Input) => string;
|
|
11
|
+
isEmpty: (data: Data) => boolean;
|
|
12
|
+
emptyFallback: EmptyContent;
|
|
13
|
+
};
|
|
14
|
+
/** A typed, query-backed destination. */
|
|
15
|
+
export declare class DetailView<Data, Input> {
|
|
16
|
+
#private;
|
|
17
|
+
readonly definition: DetailViewDefinition<Data, Input>;
|
|
18
|
+
readonly useResult: (input: Input) => ViewResult<Data, Input>;
|
|
19
|
+
constructor(definition: DetailViewDefinition<Data, Input>, useResult: (input: Input) => ViewResult<Data, Input>);
|
|
20
|
+
content(render: (source: ViewSource<Data, Input>) => ReactNode): DetailContent<Data, Input>;
|
|
21
|
+
static content<Data, Input>(target: DetailView<Data, Input>): DetailContent<Data, Input>;
|
|
22
|
+
}
|
|
23
|
+
/** Validate destination input before it enters either navigation or a lazy records query. */
|
|
24
|
+
export declare function parseDetailInput<Data, Input>(target: DetailView<Data, Input>, value: unknown): Input;
|
|
25
|
+
/** A destination’s rendered body. Pass these to DataApp.details. */
|
|
26
|
+
export declare class DetailContent<Data, Input> {
|
|
27
|
+
readonly target: DetailView<Data, Input>;
|
|
28
|
+
readonly render: (source: ViewSource<Data, Input>) => ReactNode;
|
|
29
|
+
constructor(target: DetailView<Data, Input>, render: (source: ViewSource<Data, Input>) => ReactNode);
|
|
30
|
+
}
|
|
31
|
+
export type DetailNavigation = {
|
|
32
|
+
open<Data, Input>(target: DetailView<Data, Input>, input: Input, trigger?: HTMLElement | SVGElement | null): void;
|
|
33
|
+
};
|
|
34
|
+
/** Resolve a detail target from an interaction. The destination validates input before fetching. */
|
|
35
|
+
export declare function useDetailNavigation(): DetailNavigation;
|
|
36
|
+
/** Mounts one replacement sheet for a stack of detail destinations. */
|
|
37
|
+
export declare function DetailRoutes({ details, children, }: {
|
|
38
|
+
details: readonly DetailContent<any, any>[];
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
}): import("react").JSX.Element;
|
|
41
|
+
/** Render a destination in an inspection tab. The query starts only when that tab mounts. */
|
|
42
|
+
export declare function DetailRecords({ content, input, navigation, }: {
|
|
43
|
+
content: DetailContent<any, any>;
|
|
44
|
+
input: any;
|
|
45
|
+
navigation?: DetailNavigation;
|
|
46
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { DateRangeRequest } from '@altertable/data-app/contract';
|
|
2
|
+
import type { AppVariableValues, VariableCollection } from '@altertable/data-app/internal';
|
|
3
|
+
import type { ChoiceVariable } from '@altertable/data-app/internal';
|
|
4
|
+
import { type ViewBindings } from './view.js';
|
|
5
|
+
declare const filterPatch: unique symbol;
|
|
6
|
+
declare const breakdownValue: unique symbol;
|
|
7
|
+
export declare class FilterTarget<Patch> {
|
|
8
|
+
readonly [filterPatch]: Patch;
|
|
9
|
+
}
|
|
10
|
+
export declare class BreakdownTarget<Value extends string> {
|
|
11
|
+
readonly [breakdownValue]: Value;
|
|
12
|
+
}
|
|
13
|
+
export type FilterPatch<Variables extends VariableCollection> = Partial<{
|
|
14
|
+
[Key in keyof Variables]: Extract<Variables[Key]['presentation'], {
|
|
15
|
+
group: 'display';
|
|
16
|
+
}> extends never ? AppVariableValues<Variables>[Key] : never;
|
|
17
|
+
}>;
|
|
18
|
+
type TargetDefinition = {
|
|
19
|
+
owner: object;
|
|
20
|
+
variables: VariableCollection;
|
|
21
|
+
input: (values: any) => unknown;
|
|
22
|
+
bindings?: ViewBindings<any, any>;
|
|
23
|
+
date?: {
|
|
24
|
+
variable: string;
|
|
25
|
+
input: (input: any) => DateRangeRequest;
|
|
26
|
+
};
|
|
27
|
+
key?: string;
|
|
28
|
+
};
|
|
29
|
+
export declare function createFilterTarget<Variables extends VariableCollection>(definition: TargetDefinition): FilterTarget<FilterPatch<Variables>>;
|
|
30
|
+
export declare function createBreakdownTarget<Value extends string>(definition: TargetDefinition): BreakdownTarget<Value>;
|
|
31
|
+
export declare function breakdownDefinition(target: BreakdownTarget<any>): TargetDefinition;
|
|
32
|
+
export declare function targetAvailable(target: object, displayedInput: unknown, owner: object): boolean;
|
|
33
|
+
/** Apply an explicit scope patch and optional chart choice in one history entry. */
|
|
34
|
+
export declare function applyFilter(target: object, patch: Record<string, unknown>, breakdown?: {
|
|
35
|
+
target: BreakdownTarget<any>;
|
|
36
|
+
value: string;
|
|
37
|
+
}): void;
|
|
38
|
+
export declare function breakdownState(target: BreakdownTarget<any>, owner: object | undefined, input?: unknown): {
|
|
39
|
+
variable: ChoiceVariable;
|
|
40
|
+
value: string;
|
|
41
|
+
options: readonly import("@altertable/data-app/internal").ChoiceOption[];
|
|
42
|
+
set(id: string): void;
|
|
43
|
+
};
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { CheckedVariableDeclarations } from '@altertable/data-app/internal';
|
|
2
|
+
import type { IsUnion } from '@altertable/data-app/internal';
|
|
3
|
+
import { type FacetVariable } from '@altertable/data-app/internal';
|
|
4
|
+
import { type FilterTarget, type BreakdownTarget, type FilterPatch } from './exploration.js';
|
|
5
|
+
import type { ChoiceVariable } from '@altertable/data-app/internal';
|
|
6
|
+
import { DeclaredView } from './view-runtime.js';
|
|
7
|
+
import { type DatasetDefinition, type Dataset, type Metric } from './bindings.js';
|
|
8
|
+
import type { AuthoringDataContext } from './ui/data-context.js';
|
|
9
|
+
import type { MetricValues } from '@altertable/data-app/internal';
|
|
10
|
+
import type { DisplayedSnapshot } from '@altertable/data-app/internal';
|
|
11
|
+
import { type ReactNode } from 'react';
|
|
12
|
+
import type { DataOperations, DateRangeRequest } from '@altertable/data-app/contract';
|
|
13
|
+
import type { DataClient } from '@altertable/data-app/client';
|
|
14
|
+
import type { InputOf, OutputOf } from '@altertable/data-app/client';
|
|
15
|
+
import { type VariableCollection, type CheckedFacetContexts } from '@altertable/data-app/internal';
|
|
16
|
+
import { dateRangeVariable, type DateRangeVariable, type DateRangeVariableOptions } from './ui/variables.js';
|
|
17
|
+
import { type DimensionFilterSettings, type DimensionValue } from '@altertable/data-app/internal';
|
|
18
|
+
import { type DimensionOption } from '@altertable/data-app/contract';
|
|
19
|
+
import type { EmptyContent } from './ui/presentation.js';
|
|
20
|
+
import { ViewContent, type DataContentState } from './content.js';
|
|
21
|
+
import { type DataViewDefinition, type ResolvedDataViewDefinition, type ResolvedVariables, type ViewBindingOptions, type ViewDate } from './view.js';
|
|
22
|
+
import { DetailView, type DetailViewDefinition } from './details.js';
|
|
23
|
+
type TimeVariables<Additional extends VariableCollection> = {
|
|
24
|
+
period: ReturnType<typeof dateRangeVariable>;
|
|
25
|
+
} & Additional;
|
|
26
|
+
type TimeInput<Additional extends VariableCollection> = keyof Additional extends never ? DateRangeRequest : ResolvedVariables<TimeVariables<Additional>>;
|
|
27
|
+
type TimeInputMapping<Additional extends VariableCollection, Input> = TimeInput<Additional> extends Input ? {
|
|
28
|
+
input?: (values: ResolvedVariables<TimeVariables<Additional>>) => Input;
|
|
29
|
+
} : {
|
|
30
|
+
input: (values: ResolvedVariables<TimeVariables<Additional>>) => Input;
|
|
31
|
+
};
|
|
32
|
+
/** Match the period reader's precedence for each possible operation input. */
|
|
33
|
+
type RequiredPeriodBinding<Input> = Input extends unknown ? 'period' extends keyof Input ? Input extends {
|
|
34
|
+
period: DateRangeRequest;
|
|
35
|
+
} ? never : 'period' : Input extends DateRangeRequest ? never : 'period' : never;
|
|
36
|
+
type NonEmptyColumns<Columns extends object> = keyof Columns extends never ? never : Columns;
|
|
37
|
+
type BoundDataView<Name extends string, Variables extends VariableCollection, Input, Data, Context extends AuthoringDataContext, HasDate extends boolean> = DeclaredView<Data, Input, ResolvedDataViewDefinition<Name, Variables, Input, Data> & {
|
|
38
|
+
describeInput: (input: Input) => string;
|
|
39
|
+
}> & {
|
|
40
|
+
filter(): FilterTarget<FilterPatch<Variables>>;
|
|
41
|
+
breakdown<Key extends keyof Variables & string>(key: Key & (Variables[Key] extends ChoiceVariable<any> ? Extract<Variables[Key]['presentation'], {
|
|
42
|
+
group: 'display';
|
|
43
|
+
}> extends never ? never : unknown : never)): Variables[Key] extends ChoiceVariable<infer Value> ? BreakdownTarget<Value> : never;
|
|
44
|
+
dataset<Row, const Columns extends Record<string, object> = Record<string, object>>(definition: DatasetDefinition<Data, Input, Row, Parameters<Context['evidence']>[0]> & {
|
|
45
|
+
columns: Columns & NonEmptyColumns<Columns>;
|
|
46
|
+
}): Dataset<Data, Input, Row>;
|
|
47
|
+
metric(definition: Parameters<Context['metric']>[0], select: (data: Data, input: Input) => HasDate extends true ? MetricValues : {
|
|
48
|
+
current: number;
|
|
49
|
+
previous?: never;
|
|
50
|
+
}): Metric<Data, Input>;
|
|
51
|
+
scope(snapshot: DisplayedSnapshot<Data, Input>): string;
|
|
52
|
+
content(render: (state: DataContentState<Data, Input>) => ReactNode): ViewContent<Data, Input>;
|
|
53
|
+
};
|
|
54
|
+
type FacetOperationName<Operations extends DataOperations, Value extends DimensionValue> = {
|
|
55
|
+
[Name in keyof Operations & string]: OutputOf<Operations[Name]> extends readonly DimensionOption<Value>[] ? Name : never;
|
|
56
|
+
}[keyof Operations & string];
|
|
57
|
+
type FacetConfig<Operations extends DataOperations, Value extends DimensionValue, Context extends VariableCollection, Name extends keyof Operations & string> = DimensionFilterSettings<Value> & {
|
|
58
|
+
facet: {
|
|
59
|
+
context: Context & CheckedVariableDeclarations<NoInfer<Context>> & (string extends keyof Context ? never : unknown);
|
|
60
|
+
operation: Name & (true extends IsUnion<NoInfer<Name>> ? never : unknown);
|
|
61
|
+
input: (values: ResolvedVariables<NoInfer<Context>>) => InputOf<Operations[NoInfer<Name>]>;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
type CheckedFacetSources<Operations extends DataOperations, Variables extends VariableCollection> = CheckedVariableDeclarations<Variables> & {
|
|
65
|
+
[Key in keyof Variables]: Variables[Key] extends FacetVariable<infer Value, infer _Context, infer Name, infer Input> ? Name extends keyof Operations ? Input extends InputOf<Operations[Name]> ? OutputOf<Operations[Name]> extends readonly DimensionOption<Value>[] ? Variables[Key] : never : never : never : Variables[Key];
|
|
66
|
+
};
|
|
67
|
+
type BoundDetailView<Data, Input, Context extends AuthoringDataContext> = DetailView<Data, Input> & {
|
|
68
|
+
dataset<Row, const Columns extends Record<string, object> = Record<string, object>>(definition: DatasetDefinition<Data, Input, Row, Parameters<Context['evidence']>[0]> & {
|
|
69
|
+
columns: Columns & NonEmptyColumns<Columns>;
|
|
70
|
+
}): Dataset<Data, Input, Row>;
|
|
71
|
+
metric(definition: Parameters<Context['metric']>[0], select: (data: Data, input: Input) => {
|
|
72
|
+
current: number;
|
|
73
|
+
previous?: never;
|
|
74
|
+
}): Metric<Data, Input>;
|
|
75
|
+
};
|
|
76
|
+
/** Bind declared operations to URL variables, displayed readings, and request feedback. */
|
|
77
|
+
export declare function createDataHooks<Operations extends DataOperations>(client: DataClient<Operations>): {
|
|
78
|
+
defineDataView: {
|
|
79
|
+
<Name extends keyof Operations & string, const Variables extends VariableCollection = {}, const Context extends AuthoringDataContext = AuthoringDataContext>(definition: DataViewDefinition<Name, Variables, InputOf<Operations[Name]>, OutputOf<Operations[Name]>> & {
|
|
80
|
+
operation: Name & (true extends IsUnion<NoInfer<Name>> ? never : unknown);
|
|
81
|
+
variables?: Variables & CheckedFacetSources<Operations, NoInfer<Variables>>;
|
|
82
|
+
} & {
|
|
83
|
+
dataContext: Context;
|
|
84
|
+
date: ViewDate<Variables, InputOf<Operations[Name]>>;
|
|
85
|
+
}): BoundDataView<Name, Variables, InputOf<Operations[Name]>, OutputOf<Operations[Name]>, Context, true>;
|
|
86
|
+
<Name extends keyof Operations & string, const Variables extends VariableCollection = {}, const Context extends AuthoringDataContext = AuthoringDataContext>(definition: DataViewDefinition<Name, Variables, InputOf<Operations[Name]>, OutputOf<Operations[Name]>> & {
|
|
87
|
+
operation: Name & (true extends IsUnion<NoInfer<Name>> ? never : unknown);
|
|
88
|
+
variables?: Variables & CheckedFacetSources<Operations, NoInfer<Variables>>;
|
|
89
|
+
} & {
|
|
90
|
+
dataContext: Context;
|
|
91
|
+
}): BoundDataView<Name, Variables, InputOf<Operations[Name]>, OutputOf<Operations[Name]>, Context, false>;
|
|
92
|
+
};
|
|
93
|
+
defineDetailView: <Name extends keyof Operations & string, const Context extends AuthoringDataContext = AuthoringDataContext>(definition: DetailViewDefinition<OutputOf<Operations[Name]>, InputOf<Operations[Name]>> & {
|
|
94
|
+
operation: Name;
|
|
95
|
+
dataContext: Context;
|
|
96
|
+
}) => BoundDetailView<OutputOf<Operations[Name]>, InputOf<Operations[Name]>, Context>;
|
|
97
|
+
defineTimeView: <Name extends keyof Operations & string, const Additional extends VariableCollection = {}, const Context extends AuthoringDataContext = AuthoringDataContext>(definition: {
|
|
98
|
+
operation: Name & (true extends IsUnion<NoInfer<Name>> ? never : unknown);
|
|
99
|
+
dataContext: Context;
|
|
100
|
+
time: Omit<DateRangeVariableOptions, 'key'>;
|
|
101
|
+
variables?: Additional & CheckedVariableDeclarations<NoInfer<Additional>> & {
|
|
102
|
+
period?: never;
|
|
103
|
+
} & Omit<CheckedFacetContexts<TimeVariables<NoInfer<Additional>>>, 'period'> & Omit<CheckedFacetSources<Operations, TimeVariables<NoInfer<Additional>>>, 'period'>;
|
|
104
|
+
isEmpty: (data: OutputOf<Operations[Name]>) => boolean;
|
|
105
|
+
emptyFallback: EmptyContent;
|
|
106
|
+
} & TimeInputMapping<NoInfer<Additional>, InputOf<Operations[Name]>> & ViewBindingOptions<TimeVariables<NoInfer<Additional>>, InputOf<Operations[Name]>, RequiredPeriodBinding<InputOf<Operations[Name]>>>) => BoundDataView<Name, {
|
|
107
|
+
period: DateRangeVariable;
|
|
108
|
+
} & Additional, InputOf<Operations[Name]>, OutputOf<Operations[Name]>, Context, true>;
|
|
109
|
+
defineFacetFilter: {
|
|
110
|
+
<const Context extends VariableCollection, const Name extends FacetOperationName<Operations, string>>(config: FacetConfig<Operations, string, Context, Name>): FacetVariable<string, Readonly<Context>, Name, InputOf<Operations[Name]>>;
|
|
111
|
+
<const Context extends VariableCollection, const Name extends FacetOperationName<Operations, number>>(config: FacetConfig<Operations, number, Context, Name>): FacetVariable<number, Readonly<Context>, Name, InputOf<Operations[Name]>>;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/** Declared views, bound widgets, and layouts for data-app authoring. */
|
|
2
|
+
export type { DatasetColumn, DatasetSuggestionOptions, DatasetDeclaration as DatasetDefinition, } from './bindings.js';
|
|
3
|
+
export type { MetricRecords } from './bindings.js';
|
|
4
|
+
export { injectDataAppStyles } from './styles.js';
|
|
5
|
+
export type { DataAppStylesOptions } from './styles.js';
|
|
6
|
+
export type { DataAppStyle, DataAppStyleToken, DataAppStyleHooks, } from './style-contract.js';
|
|
7
|
+
export { mountDataApp } from './mount.js';
|
|
8
|
+
export { createDataHooks } from './hooks.js';
|
|
9
|
+
export { DetailView, DetailContent, useDetailNavigation } from './details.js';
|
|
10
|
+
export type { DetailViewDefinition } from './details.js';
|
|
11
|
+
export type { CsvCell } from './ui/csv-export.js';
|
|
12
|
+
export { DataApp } from './ui/DataApp.js';
|
|
13
|
+
export type { DataAppProps } from './ui/DataApp.js';
|
|
14
|
+
export { Stack } from './ui/Stack.js';
|
|
15
|
+
export type { StackProps } from './ui/Stack.js';
|
|
16
|
+
export { Grid } from './ui/Grid.js';
|
|
17
|
+
export type { GridProps } from './ui/Grid.js';
|
|
18
|
+
export { GridItem } from './ui/GridItem.js';
|
|
19
|
+
export type { GridItemProps } from './ui/GridItem.js';
|
|
20
|
+
export type { WidgetEvidence } from './ui/WidgetEvidence.js';
|
|
21
|
+
export { TextContent } from './ui/TextContent.js';
|
|
22
|
+
export type { TextContentProps } from './ui/TextContent.js';
|
|
23
|
+
export { DataValue } from './widgets.js';
|
|
24
|
+
export type { DataValueProps } from './widgets.js';
|
|
25
|
+
export { TextWidget } from './widgets.js';
|
|
26
|
+
export type { TextWidgetProps } from './widgets.js';
|
|
27
|
+
export { VisualizationWidget } from './widgets.js';
|
|
28
|
+
export type { VisualizationWidgetProps } from './widgets.js';
|
|
29
|
+
export type { VisualizationWidgetView } from './widgets.js';
|
|
30
|
+
export { TableWidget } from './widgets.js';
|
|
31
|
+
export type { TableWidgetProps } from './widgets.js';
|
|
32
|
+
export type { TableWidgetSearch } from './ui/TableWidget.js';
|
|
33
|
+
export { chartColor } from './ui/chartColor.js';
|
|
34
|
+
export { Breakdown } from './ui/Breakdown.js';
|
|
35
|
+
export type { BreakdownItem, BreakdownProps } from './ui/Breakdown.js';
|
|
36
|
+
export { Ranking } from './ui/Ranking.js';
|
|
37
|
+
export type { RankingItem, RankingProps } from './ui/Ranking.js';
|
|
38
|
+
export { Comparison } from './ui/Comparison.js';
|
|
39
|
+
export type { ComparisonProps } from './ui/Comparison.js';
|
|
40
|
+
export { MetricWidget } from './widgets.js';
|
|
41
|
+
export type { MetricWidgetProps } from './widgets.js';
|
|
42
|
+
export { EmptyState } from './ui/EmptyState.js';
|
|
43
|
+
export type { EmptyStateProps } from './ui/EmptyState.js';
|
|
44
|
+
export { Skeleton } from './ui/Skeleton.js';
|
|
45
|
+
export type { SkeletonProps } from './ui/Skeleton.js';
|
|
46
|
+
export { DataSection } from './ui/DataSection.js';
|
|
47
|
+
export type { DataSectionProps } from './ui/DataSection.js';
|
|
48
|
+
export { UpdatedAt } from './ui/UpdatedAt.js';
|
|
49
|
+
export type { UpdatedAtProps } from './ui/UpdatedAt.js';
|
|
50
|
+
export { DateTimeTooltip } from './ui/DateTimeTooltip.js';
|
|
51
|
+
export type { DateTimeTooltipProps } from './ui/DateTimeTooltip.js';
|
|
52
|
+
export { searchVariable, choiceVariable, multiChoiceVariable, dateRangeVariable, } from './ui/variables.js';
|
|
53
|
+
export type { AppVariable, VariablePresentation, AppVariableValues, ChoiceOption, ChoiceVariable, MultiChoiceVariable, SearchVariable, DateRangeSelection, DateRangeVariable, DateRangeVariableOptions, } from './ui/variables.js';
|
|
54
|
+
export { PeriodSummary } from './ui/PeriodSummary.js';
|
|
55
|
+
export type { ReportingPeriod, PeriodComparison, PeriodSummaryProps, } from './ui/PeriodSummary.js';
|
|
56
|
+
export { createDataContext } from './ui/data-context.js';
|
|
57
|
+
export type { DataContext, GlossaryEntry } from './ui/data-context.js';
|
|
58
|
+
export { defineDataIdentifiers } from './ui/data-identifiers.js';
|
|
59
|
+
export type { DataIdentifierDefinition, TableIdentifier, ColumnIdentifier, } from './ui/data-identifiers.js';
|
|
60
|
+
export { IconButton } from './ui/IconButton.js';
|
|
61
|
+
export type { IconButtonProps } from './ui/IconButton.js';
|
|
62
|
+
export { Tooltip, TooltipProvider } from './ui/Tooltip.js';
|
|
63
|
+
export type { TooltipProps, TooltipProviderProps } from './ui/Tooltip.js';
|
|
64
|
+
export { Button } from './ui/Button.js';
|
|
65
|
+
export type { ButtonProps } from './ui/Button.js';
|
|
66
|
+
export type { MetricDefinition } from './ui/metric.js';
|
|
67
|
+
export type { MetricValues } from '@altertable/data-app/internal';
|
|
68
|
+
export { AnnotationTarget } from './annotations/AnnotationTarget.js';
|
|
69
|
+
export type { AnnotationTargetProps } from './annotations/AnnotationTarget.js';
|
|
70
|
+
export { useDataAppAnnotations } from './annotations/useDataAppAnnotations.js';
|
|
71
|
+
export { AnnotationBar } from './annotations/AnnotationBar.js';
|
|
72
|
+
export type { AnnotationBarHandle, AnnotationBarProps, } from './annotations/AnnotationBar.js';
|
|
73
|
+
export { injectDataAppAnnotationStyles } from './annotations/styles.js';
|
|
74
|
+
export { SectionHeading } from './ui/SectionHeading.js';
|
|
75
|
+
export type { SectionHeadingProps } from './ui/SectionHeading.js';
|
|
76
|
+
export { DateDisplay } from './ui/DateDisplay.js';
|
|
77
|
+
export type { DateDisplayProps } from './ui/DateDisplay.js';
|
|
78
|
+
export { useDateFormatting } from './date-formatting.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ComponentType, type ReactNode } from 'react';
|
|
2
|
+
import { type DataAppDefinition, type QueryDefinitions } from '@altertable/data-app/config';
|
|
3
|
+
/** Mount once per document; installs document identity and the shared request provider. */
|
|
4
|
+
export declare function mountDataApp<const Queries extends QueryDefinitions>({ app, component: Component, root, }: {
|
|
5
|
+
app: DataAppDefinition<Queries>;
|
|
6
|
+
component: ComponentType;
|
|
7
|
+
root?: HTMLElement | null;
|
|
8
|
+
}): void;
|
|
9
|
+
/** Provide one app identity and shared requests to a custom React root. */
|
|
10
|
+
export declare function DataAppProvider<const Queries extends QueryDefinitions>({ app, children, }: {
|
|
11
|
+
app: DataAppDefinition<Queries>;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type SearchSuggestion } from './ui/SearchTypeahead.js';
|
|
2
|
+
/** The primary view supplies suggestions from exactly the source displayed by its widgets. */
|
|
3
|
+
export declare const SearchSuggestionsContext: import("react").Context<{
|
|
4
|
+
groups: readonly (readonly SearchSuggestion[])[];
|
|
5
|
+
busy: boolean;
|
|
6
|
+
} | null>;
|
|
7
|
+
/** Share five slots across datasets, then prioritize title matches without filtering source rows. */
|
|
8
|
+
export declare function balanceSearchSuggestions(groups: readonly (readonly SearchSuggestion[])[], query?: string): SearchSuggestion[];
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
/** Public custom-property names for authoring types and validation. CSS owns their defaults. */
|
|
3
|
+
export declare const dataAppStyleTokens: readonly ['--atbl-control-text-size', '--atbl-annotation-accent', '--atbl-annotation-accent-hover', '--atbl-annotation-on-accent', '--atbl-annotation-highlight', '--atbl-background', '--atbl-surface', '--atbl-subtle', '--atbl-text', '--atbl-muted', '--atbl-border', '--atbl-accent', '--atbl-accent-subtle', '--atbl-on-accent', '--atbl-positive', '--atbl-negative', '--atbl-danger', '--atbl-danger-subtle', '--atbl-backdrop', '--atbl-code-surface', '--atbl-code-text', '--atbl-code-keyword', '--atbl-chart-fill', '--atbl-control-hover-border', '--atbl-focus-color', '--atbl-focus-outline', '--atbl-focus-ring-offset', '--atbl-focus-ring-inset', '--atbl-font', '--atbl-font-heading', '--atbl-mono-font', '--atbl-space-xs', '--atbl-space-sm', '--atbl-space-md', '--atbl-space-lg', '--atbl-space-xl', '--atbl-layout-gap', '--atbl-surface-padding', '--atbl-content-width', '--atbl-control-height', '--atbl-dropdown-padding', '--atbl-dropdown-item-padding-block', '--atbl-dropdown-item-padding-inline', '--atbl-dropdown-item-gap', '--atbl-radius-control', '--atbl-radius-surface', '--atbl-radius-overlay', '--atbl-shadow-surface', '--atbl-shadow-overlay', '--atbl-shadow-control', '--atbl-cursor-action', '--atbl-cursor-disabled', '--atbl-cursor-help', '--atbl-duration-fast', '--atbl-duration-normal', '--atbl-duration-slow', '--atbl-ease-standard', '--atbl-ease-enter', '--atbl-chart-1', '--atbl-chart-2', '--atbl-chart-3', '--atbl-chart-4', '--atbl-chart-5', '--atbl-chart-6', '--atbl-chart-7', '--atbl-chart-8', '--atbl-type-emphasis-weight', '--atbl-type-meta-weight', '--atbl-type-page-size', '--atbl-type-section-size', '--atbl-type-widget-size', '--atbl-type-body-size', '--atbl-type-label-size', '--atbl-type-meta-size', '--atbl-type-metric-size', '--atbl-type-heading-weight', '--atbl-type-label-weight', '--atbl-type-body-leading', '--atbl-type-label-leading', '--atbl-type-heading-leading', '--atbl-type-metric-leading', '--atbl-text-measure', '--atbl-control-compact-height', '--atbl-control-icon-size', '--atbl-control-padding-inline', '--atbl-control-padding-block', '--atbl-control-gap', '--atbl-control-disabled-opacity', '--atbl-cursor-busy', '--atbl-control-hover-surface', '--atbl-control-pressed-surface', '--atbl-control-open-surface', '--atbl-control-open-border', '--atbl-control-selected-surface', '--atbl-control-selected-text'];
|
|
4
|
+
/** Stable component roots for CSS customization; only utilities may be placed on native markup. */
|
|
5
|
+
export declare const dataAppStyleClasses: {
|
|
6
|
+
readonly 'altertable-app-layout': {
|
|
7
|
+
readonly component: 'AppLayout';
|
|
8
|
+
readonly kind: 'root';
|
|
9
|
+
};
|
|
10
|
+
readonly 'altertable-stack': {
|
|
11
|
+
readonly component: 'Stack';
|
|
12
|
+
readonly kind: 'root';
|
|
13
|
+
};
|
|
14
|
+
readonly 'altertable-grid': {
|
|
15
|
+
readonly component: 'Grid';
|
|
16
|
+
readonly kind: 'root';
|
|
17
|
+
};
|
|
18
|
+
readonly 'altertable-grid-item': {
|
|
19
|
+
readonly component: 'GridItem';
|
|
20
|
+
readonly kind: 'root';
|
|
21
|
+
};
|
|
22
|
+
readonly 'altertable-text-content': {
|
|
23
|
+
readonly component: 'TextContent';
|
|
24
|
+
readonly kind: 'root';
|
|
25
|
+
};
|
|
26
|
+
readonly 'altertable-button': {
|
|
27
|
+
readonly component: 'Button';
|
|
28
|
+
readonly kind: 'root';
|
|
29
|
+
};
|
|
30
|
+
readonly 'altertable-tabs': {
|
|
31
|
+
readonly component: 'Tabs';
|
|
32
|
+
readonly kind: 'root';
|
|
33
|
+
};
|
|
34
|
+
readonly 'altertable-data-widget': {
|
|
35
|
+
readonly component: 'DataWidget';
|
|
36
|
+
readonly kind: 'root';
|
|
37
|
+
};
|
|
38
|
+
readonly 'altertable-metric-widget': {
|
|
39
|
+
readonly component: 'MetricWidget';
|
|
40
|
+
readonly kind: 'root';
|
|
41
|
+
};
|
|
42
|
+
readonly 'altertable-chart-legend': {
|
|
43
|
+
readonly component: 'ChartLegend';
|
|
44
|
+
readonly kind: 'root';
|
|
45
|
+
};
|
|
46
|
+
readonly 'altertable-chart-legend-item': {
|
|
47
|
+
readonly component: 'ChartLegend.Item';
|
|
48
|
+
readonly kind: 'root';
|
|
49
|
+
};
|
|
50
|
+
readonly 'altertable-chart-legend-marker': {
|
|
51
|
+
readonly component: 'ChartLegend.Marker';
|
|
52
|
+
readonly kind: 'root';
|
|
53
|
+
};
|
|
54
|
+
readonly 'altertable-chart-legend-label': {
|
|
55
|
+
readonly component: 'ChartLegend.Label';
|
|
56
|
+
readonly kind: 'root';
|
|
57
|
+
};
|
|
58
|
+
readonly 'altertable-funnel-chart': {
|
|
59
|
+
readonly component: 'FunnelChart';
|
|
60
|
+
readonly kind: 'root';
|
|
61
|
+
};
|
|
62
|
+
readonly 'altertable-retention-chart': {
|
|
63
|
+
readonly component: 'RetentionChart';
|
|
64
|
+
readonly kind: 'root';
|
|
65
|
+
};
|
|
66
|
+
readonly 'altertable-journey-chart': {
|
|
67
|
+
readonly component: 'JourneyChart';
|
|
68
|
+
readonly kind: 'root';
|
|
69
|
+
};
|
|
70
|
+
readonly 'altertable-composed-chart': {
|
|
71
|
+
readonly component: 'ComposedChart';
|
|
72
|
+
readonly kind: 'root';
|
|
73
|
+
};
|
|
74
|
+
readonly 'altertable-sr-only': {
|
|
75
|
+
readonly component: null;
|
|
76
|
+
readonly kind: 'utility';
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export declare const dataAppStyleHooks: {
|
|
80
|
+
readonly 'data-atbl-focus': readonly ['ring', 'inset', 'group'];
|
|
81
|
+
readonly 'data-atbl-control': readonly ['default', 'action', 'help', 'text'];
|
|
82
|
+
};
|
|
83
|
+
export type DataAppStyleToken = (typeof dataAppStyleTokens)[number];
|
|
84
|
+
/** React style properties with checked public Altertable custom properties. */
|
|
85
|
+
export type DataAppStyle = CSSProperties & Partial<Record<DataAppStyleToken, string | number>>;
|
|
86
|
+
export type DataAppStyleHooks = {
|
|
87
|
+
[Name in keyof typeof dataAppStyleHooks]?: (typeof dataAppStyleHooks)[Name][number];
|
|
88
|
+
};
|