@altertable/data-app-examples 0.77.0 → 0.79.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.
Files changed (37) hide show
  1. package/dist/index.js +2 -2
  2. package/dist/index.js.map +1 -1
  3. package/dist/types/index.d.ts +2 -2
  4. package/package.json +1 -1
  5. package/templates/starter-data-app/index.tsx +76 -138
  6. package/templates/starter-finding-data-app/index.tsx +379 -117
  7. package/templates/starter-local-data-app/AGENTS.md +9 -9
  8. package/templates/starter-local-data-app/README.md +11 -5
  9. package/templates/starter-local-data-app/app.ts +25 -21
  10. package/templates/starter-local-data-app/package.json +5 -5
  11. package/templates/starter-local-data-app/src/App.tsx +54 -4
  12. package/templates/starter-local-data-app/src/data-context.ts +8 -13
  13. package/templates/starter-local-data-app/src/filters.ts +14 -0
  14. package/templates/starter-local-data-app/src/main.tsx +3 -3
  15. package/templates/starter-local-data-app/src/operations.ts +14 -5
  16. package/templates/starter-local-data-app/src/server.ts +1 -2
  17. package/templates/starter-local-finding-data-app/AGENTS.md +1 -1
  18. package/templates/starter-local-finding-data-app/README.md +3 -4
  19. package/templates/starter-local-finding-data-app/app.ts +29 -11
  20. package/templates/starter-local-finding-data-app/package.json +5 -5
  21. package/templates/starter-local-finding-data-app/src/App.tsx +237 -56
  22. package/templates/starter-local-finding-data-app/src/data-context.ts +14 -11
  23. package/templates/starter-local-finding-data-app/src/filters.ts +29 -11
  24. package/templates/starter-local-finding-data-app/src/main.tsx +3 -3
  25. package/templates/starter-local-finding-data-app/src/operations.ts +80 -34
  26. package/templates/starter-local-finding-data-app/src/server.ts +4 -2
  27. package/templates/starter-local-metric-data-app/AGENTS.md +1 -1
  28. package/templates/starter-local-metric-data-app/README.md +3 -4
  29. package/templates/starter-local-metric-data-app/app.ts +9 -6
  30. package/templates/starter-local-metric-data-app/package.json +5 -5
  31. package/templates/starter-local-metric-data-app/src/App.tsx +25 -30
  32. package/templates/starter-local-metric-data-app/src/data-context.ts +9 -9
  33. package/templates/starter-local-metric-data-app/src/filters.ts +2 -3
  34. package/templates/starter-local-metric-data-app/src/main.tsx +3 -3
  35. package/templates/starter-local-metric-data-app/src/operations.ts +6 -14
  36. package/templates/starter-local-metric-data-app/src/server.ts +4 -2
  37. package/templates/starter-metric-data-app/index.tsx +49 -63
package/dist/index.js CHANGED
@@ -8,13 +8,13 @@ const dataAppExamples = [
8
8
  {
9
9
  id: "starter-data-app",
10
10
  title: "Hosted data app",
11
- description: "A single-file React app for hosted execution.",
11
+ description: "One query, view, and chart in a single file for hosted execution.",
12
12
  mode: "hosted"
13
13
  },
14
14
  {
15
15
  id: "starter-local-data-app",
16
16
  title: "Local data app",
17
- description: "A Bun and React project with server-side lakehouse access.",
17
+ description: "One query, view, and chart in a Bun project with server-side lakehouse access.",
18
18
  mode: "local"
19
19
  },
20
20
  {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { cp, mkdir, readdir, rename, rm } from 'node:fs/promises';\nimport { join, relative, sep } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst templateFileRenames = new Map([['_gitignore', '.gitignore']]);\n\n/** Canonical starters available to scaffolding tools. IDs are stable across releases. */\nexport const dataAppExamples = [\n {\n id: 'starter-data-app',\n title: 'Hosted data app',\n description: 'A single-file React app for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-local-data-app',\n title: 'Local data app',\n description: 'A Bun and React project with server-side lakehouse access.',\n mode: 'local',\n },\n {\n id: 'starter-metric-data-app',\n title: 'Hosted metric illustration',\n description: 'A focused metric app for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-finding-data-app',\n title: 'Hosted Finding exploration',\n description:\n 'An interactive companion to a Finding’s text for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-local-metric-data-app',\n title: 'Local metric illustration',\n description: 'A focused metric app for local execution.',\n mode: 'local',\n },\n {\n id: 'starter-local-finding-data-app',\n title: 'Local Finding exploration',\n description:\n 'An interactive companion to a Finding’s text for local execution.',\n mode: 'local',\n },\n] as const;\n\n/** Stable identifier for a canonical starter. */\nexport type DataAppExampleId = (typeof dataAppExamples)[number]['id'];\n\n/** Absolute source directory. Use copyExample() to restore npm-excluded filenames. */\nexport function getExampleDirectory(id: DataAppExampleId): string {\n const example = dataAppExamples.find(example => example.id === id);\n if (!example) throw new Error(`Unknown data app example: ${id}`);\n return fileURLToPath(new URL(`../templates/${example.id}/`, import.meta.url));\n}\n\n/** Copy a starter into a new directory; reject existing destinations. */\nexport async function copyExample(\n id: DataAppExampleId,\n destination: string\n): Promise<void> {\n const source = getExampleDirectory(id);\n await mkdir(destination);\n try {\n await cp(source, destination, {\n recursive: true,\n filter: path =>\n relative(source, path)\n .split(sep)\n .every(\n part =>\n part !== 'node_modules' &&\n part !== 'dist' &&\n !part.startsWith('.env')\n ),\n });\n for (const filename of await readdir(destination)) {\n const target = templateFileRenames.get(filename);\n if (target)\n await rename(join(destination, filename), join(destination, target));\n }\n } catch (error) {\n await rm(destination, { recursive: true, force: true });\n throw error;\n }\n}\n"],"mappings":";;;;AAIA,MAAM,sCAAsB,IAAI,IAAI,CAAC,CAAC,cAAc,YAAY,CAAC,CAAC;;AAGlE,MAAa,kBAAkB;CAC7B;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;CACR;AACF;;AAMA,SAAgB,oBAAoB,IAA8B;CAChE,MAAM,UAAU,gBAAgB,MAAK,YAAW,QAAQ,OAAO,EAAE;CACjE,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,6BAA6B,IAAI;CAC/D,OAAO,cAAc,IAAI,IAAI,gBAAgB,QAAQ,GAAG,IAAI,YAAY,GAAG,CAAC;AAC9E;;AAGA,eAAsB,YACpB,IACA,aACe;CACf,MAAM,SAAS,oBAAoB,EAAE;CACrC,MAAM,MAAM,WAAW;CACvB,IAAI;EACF,MAAM,GAAG,QAAQ,aAAa;GAC5B,WAAW;GACX,SAAQ,SACN,SAAS,QAAQ,IAAI,CAAC,CACnB,MAAM,GAAG,CAAC,CACV,OACC,SACE,SAAS,kBACT,SAAS,UACT,CAAC,KAAK,WAAW,MAAM,CAC3B;EACN,CAAC;EACD,KAAK,MAAM,YAAY,MAAM,QAAQ,WAAW,GAAG;GACjD,MAAM,SAAS,oBAAoB,IAAI,QAAQ;GAC/C,IAAI,QACF,MAAM,OAAO,KAAK,aAAa,QAAQ,GAAG,KAAK,aAAa,MAAM,CAAC;EACvE;CACF,SAAS,OAAO;EACd,MAAM,GAAG,aAAa;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;EACtD,MAAM;CACR;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { cp, mkdir, readdir, rename, rm } from 'node:fs/promises';\nimport { join, relative, sep } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst templateFileRenames = new Map([['_gitignore', '.gitignore']]);\n\n/** Canonical starters available to scaffolding tools. IDs are stable across releases. */\nexport const dataAppExamples = [\n {\n id: 'starter-data-app',\n title: 'Hosted data app',\n description:\n 'One query, view, and chart in a single file for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-local-data-app',\n title: 'Local data app',\n description:\n 'One query, view, and chart in a Bun project with server-side lakehouse access.',\n mode: 'local',\n },\n {\n id: 'starter-metric-data-app',\n title: 'Hosted metric illustration',\n description: 'A focused metric app for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-finding-data-app',\n title: 'Hosted Finding exploration',\n description:\n 'An interactive companion to a Finding’s text for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-local-metric-data-app',\n title: 'Local metric illustration',\n description: 'A focused metric app for local execution.',\n mode: 'local',\n },\n {\n id: 'starter-local-finding-data-app',\n title: 'Local Finding exploration',\n description:\n 'An interactive companion to a Finding’s text for local execution.',\n mode: 'local',\n },\n] as const;\n\n/** Stable identifier for a canonical starter. */\nexport type DataAppExampleId = (typeof dataAppExamples)[number]['id'];\n\n/** Absolute source directory. Use copyExample() to restore npm-excluded filenames. */\nexport function getExampleDirectory(id: DataAppExampleId): string {\n const example = dataAppExamples.find(example => example.id === id);\n if (!example) throw new Error(`Unknown data app example: ${id}`);\n return fileURLToPath(new URL(`../templates/${example.id}/`, import.meta.url));\n}\n\n/** Copy a starter into a new directory; reject existing destinations. */\nexport async function copyExample(\n id: DataAppExampleId,\n destination: string\n): Promise<void> {\n const source = getExampleDirectory(id);\n await mkdir(destination);\n try {\n await cp(source, destination, {\n recursive: true,\n filter: path =>\n relative(source, path)\n .split(sep)\n .every(\n part =>\n part !== 'node_modules' &&\n part !== 'dist' &&\n !part.startsWith('.env')\n ),\n });\n for (const filename of await readdir(destination)) {\n const target = templateFileRenames.get(filename);\n if (target)\n await rename(join(destination, filename), join(destination, target));\n }\n } catch (error) {\n await rm(destination, { recursive: true, force: true });\n throw error;\n }\n}\n"],"mappings":";;;;AAIA,MAAM,sCAAsB,IAAI,IAAI,CAAC,CAAC,cAAc,YAAY,CAAC,CAAC;;AAGlE,MAAa,kBAAkB;CAC7B;EACE,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;CACR;AACF;;AAMA,SAAgB,oBAAoB,IAA8B;CAChE,MAAM,UAAU,gBAAgB,MAAK,YAAW,QAAQ,OAAO,EAAE;CACjE,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,6BAA6B,IAAI;CAC/D,OAAO,cAAc,IAAI,IAAI,gBAAgB,QAAQ,GAAG,IAAI,YAAY,GAAG,CAAC;AAC9E;;AAGA,eAAsB,YACpB,IACA,aACe;CACf,MAAM,SAAS,oBAAoB,EAAE;CACrC,MAAM,MAAM,WAAW;CACvB,IAAI;EACF,MAAM,GAAG,QAAQ,aAAa;GAC5B,WAAW;GACX,SAAQ,SACN,SAAS,QAAQ,IAAI,CAAC,CACnB,MAAM,GAAG,CAAC,CACV,OACC,SACE,SAAS,kBACT,SAAS,UACT,CAAC,KAAK,WAAW,MAAM,CAC3B;EACN,CAAC;EACD,KAAK,MAAM,YAAY,MAAM,QAAQ,WAAW,GAAG;GACjD,MAAM,SAAS,oBAAoB,IAAI,QAAQ;GAC/C,IAAI,QACF,MAAM,OAAO,KAAK,aAAa,QAAQ,GAAG,KAAK,aAAa,MAAM,CAAC;EACvE;CACF,SAAS,OAAO;EACd,MAAM,GAAG,aAAa;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;EACtD,MAAM;CACR;AACF"}
@@ -3,12 +3,12 @@
3
3
  export declare const dataAppExamples: readonly [{
4
4
  readonly id: 'starter-data-app';
5
5
  readonly title: 'Hosted data app';
6
- readonly description: 'A single-file React app for hosted execution.';
6
+ readonly description: 'One query, view, and chart in a single file for hosted execution.';
7
7
  readonly mode: 'hosted';
8
8
  }, {
9
9
  readonly id: 'starter-local-data-app';
10
10
  readonly title: 'Local data app';
11
- readonly description: 'A Bun and React project with server-side lakehouse access.';
11
+ readonly description: 'One query, view, and chart in a Bun project with server-side lakehouse access.';
12
12
  readonly mode: 'local';
13
13
  }, {
14
14
  readonly id: 'starter-metric-data-app';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altertable/data-app-examples",
3
- "version": "0.77.0",
3
+ "version": "0.79.0",
4
4
  "description": "Canonical starter templates for Altertable data apps.",
5
5
  "keywords": [
6
6
  "altertable",
@@ -4,193 +4,131 @@ import {
4
4
  createDataHooks,
5
5
  DataApp,
6
6
  DataSection,
7
- DataValue,
8
- TableWidget,
9
- Stack,
10
- TextContent,
11
- injectDataAppStyles,
12
7
  mountDataApp,
13
- MetricWidget,
8
+ VisualizationWidget,
14
9
  } from '@altertable/data-app-react';
15
- import { createDataClient } from '@altertable/data-app/client';
16
- import { parseCount, searchFilter } from '@altertable/data-app/contract';
17
- import { formatMetric } from '@altertable/data-app/format';
10
+ import { BarChart } from '@altertable/data-app-react/ui';
11
+ import { choiceFilter } from '@altertable/data-app/contract';
18
12
 
19
- const dataApp = defineDataApp({
13
+ export const dataApp = defineDataApp({
14
+ // Replace the demo title, description, and scope labels with the app's identity.
20
15
  title: 'Sample counts',
21
- description: 'Explore sample counts by group.',
16
+ description: 'Compare fictional sample counts across groups.',
22
17
  scope: { organization: 'demo', environment: 'sample' },
23
18
  appearance: { theme: 'system' },
24
19
  queries: {
25
20
  sampleCountsByGroup: {
26
- projections: {
27
- group_name: { type: 'string' },
28
- sample_count: { type: 'number' },
29
- },
21
+ // Fictional rows. Replace the CTE with an inspected source.
30
22
  statement: `
31
- WITH sample_counts(group_name, sample_count) AS (VALUES ('Alpha', 2200000), ('Beta', 0))
32
- SELECT group_name, sample_count FROM sample_counts
33
- WHERE $groupName = '' OR group_name = $groupName
34
- ORDER BY group_name LIMIT $limit`,
23
+ WITH sample_counts(group_name, sample_count) AS (
24
+ VALUES ('Alpha', 1200), ('Alpha', 800), ('Beta', 450), ('Gamma', 0)
25
+ )
26
+ SELECT group_name, CAST(SUM(sample_count) AS BIGINT) AS sample_count
27
+ FROM sample_counts
28
+ WHERE $groupName = 'all' OR group_name = $groupName
29
+ GROUP BY group_name
30
+ ORDER BY sample_count DESC, group_name
31
+ LIMIT $limit`,
35
32
  params: {
36
- groupName: { type: 'string', defaultValue: '' },
33
+ groupName: { type: 'string', defaultValue: 'all' },
37
34
  limit: { type: 'number', defaultValue: 10 },
38
35
  },
39
- },
40
- sampleTotal: {
41
- projections: { sample_count: { type: 'number' } },
42
- statement: `
43
- WITH sample_counts(group_name, sample_count) AS (VALUES ('Alpha', 2200000), ('Beta', 0))
44
- SELECT CAST(COALESCE(SUM(sample_count), 0) AS BIGINT) AS sample_count FROM sample_counts
45
- WHERE $groupName = '' OR group_name = $groupName`,
46
- params: { groupName: { type: 'string', defaultValue: '' } },
36
+ projections: {
37
+ group_name: { type: 'string' },
38
+ sample_count: { type: 'number' },
39
+ },
47
40
  },
48
41
  },
49
42
  });
50
- // Declare each filter once; operations list the filters they read, and views,
51
- // controls, and scope derive from them.
52
- const groupName = searchFilter({ key: 'group', label: 'Group' });
53
- const operations = {
43
+
44
+ // The options match the fictional rows; the query treats 'all' as every group.
45
+ const groupName = choiceFilter({
46
+ key: 'group',
47
+ label: 'Group',
48
+ defaultValue: 'all',
49
+ options: [
50
+ { id: 'all', label: 'All groups' },
51
+ { id: 'Alpha', label: 'Alpha' },
52
+ { id: 'Beta', label: 'Beta' },
53
+ { id: 'Gamma', label: 'Gamma' },
54
+ ],
55
+ });
56
+
57
+ export const operations = dataApp.defineOperations({
54
58
  sampleCountsByGroup: dataApp.defineOperation({
55
59
  filters: { groupName },
56
- policy: { maxQueryRows: 10, maxDurationMs: 15000 },
60
+ policy: { maxQueryRows: 10 },
57
61
  async run({ query }, { groupName }) {
58
- const queryResult = await query('sampleCountsByGroup', { groupName });
59
- return queryResult.rows.map(row => ({
62
+ const { rows } = await query('sampleCountsByGroup', { groupName });
63
+ return rows.map(row => ({
60
64
  groupName: row.group_name,
61
- sampleCount: parseCount(row.sample_count),
65
+ sampleCount: row.sample_count,
62
66
  }));
63
67
  },
64
68
  }),
65
- sampleTotal: dataApp.defineOperation({
66
- filters: { groupName },
67
- policy: { maxQueryRows: 1, maxDurationMs: 15000 },
68
- async run({ query }, { groupName }) {
69
- const queryResult = await query('sampleTotal', { groupName });
70
- return { sampleCount: parseCount(queryResult.rows[0]?.sample_count) };
71
- },
72
- }),
73
- };
74
- const queryNames = {
75
- ...operations.sampleCountsByGroup.queryNames,
76
- ...operations.sampleTotal.queryNames,
77
- };
78
- const sampleDataContext = createDataContext(queryNames)({
69
+ });
70
+
71
+ // Replace the description and definitions with verified source metadata.
72
+ const dataContext = createDataContext(dataApp.queryNames)({
79
73
  description:
80
- 'Two SQL VALUES rows demonstrate the host query path. Replace them with inspected source data before publishing findings.',
74
+ 'Fictional sample counts by group. Gamma has a recorded count of zero.',
81
75
  glossary: {
82
76
  sampleCount: {
83
77
  term: 'Sample count',
84
78
  definition:
85
- 'A fixture value: Alpha is 2,200,000 and Beta is a measured zero.',
86
- queryNames: [queryNames.sampleCountsByGroup, queryNames.sampleTotal],
79
+ 'Sum of recorded samples in the selected group scope. Additive across groups.',
80
+ queryNames: [dataApp.queryNames.sampleCountsByGroup],
87
81
  },
88
82
  },
89
83
  });
90
- const { defineView } = createDataHooks(createDataClient({ operations }));
84
+
85
+ const { defineView } = createDataHooks(operations.createDataClient());
91
86
  const sampleCountsView = defineView({
92
- dataContext: sampleDataContext,
87
+ dataContext,
93
88
  operation: 'sampleCountsByGroup',
94
- isEmpty: sampleCounts => sampleCounts.length === 0,
95
89
  emptyFallback: {
96
90
  title: 'No matching groups',
97
- description: 'Try Alpha, Beta, or clear the group filter.',
91
+ description: 'Choose another group.',
98
92
  },
99
93
  });
100
94
  const sampleCounts = sampleCountsView.dataset({
101
95
  name: 'Sample counts',
102
- select: rows => rows,
103
96
  rowKey: row => row.groupName,
104
97
  columns: {
105
- groupName: { label: 'Group', value: row => row.groupName },
106
- sampleCount: { value: row => row.sampleCount, format: { kind: 'count' } },
98
+ groupName: { label: 'Group' },
99
+ sampleCount: { format: { kind: 'count' } },
107
100
  },
108
- evidence: {
109
- id: 'counts-by-group',
110
- glossaryIds: ['sampleCount'],
111
- },
112
- });
113
- const sampleTotalView = defineView({
114
- dataContext: sampleDataContext,
115
- operation: 'sampleTotal',
101
+ evidence: { id: 'counts-by-group', glossaryIds: ['sampleCount'] },
116
102
  });
117
- const totalSamples = sampleTotalView.metric(
118
- {
119
- id: 'total-samples',
120
- glossaryId: 'sampleCount',
121
- label: 'Total samples',
122
- format: { kind: 'count', compact: true },
123
- },
124
- total => ({ current: total.sampleCount })
125
- );
126
- const totalContent = sampleTotalView.content(result => (
127
- <Stack>
128
- <TextContent>
129
- <p>
130
- Showing <DataValue scope={result.scope} />
131
- </p>
132
- </TextContent>
133
- <MetricWidget
134
- metric={totalSamples}
135
- source={result}
136
- description="Sum of the fixture counts in the selected groups."
137
- />
138
- </Stack>
139
- ));
140
103
  const countsContent = sampleCountsView.content(result => (
141
- <TableWidget
104
+ <VisualizationWidget
142
105
  dataset={sampleCounts}
143
106
  source={result}
144
- title="Counts by group"
145
- description="Alpha and Beta demonstrate measured values, including zero."
146
- pagination={false}
147
- />
107
+ title="Samples by group"
108
+ >
109
+ {rows => (
110
+ <BarChart
111
+ ariaLabel="Sample counts by group"
112
+ unit="samples"
113
+ valueFormat={{ kind: 'count' }}
114
+ showYAxis
115
+ scrollToEnd={false}
116
+ items={rows.map(row => ({
117
+ id: row.groupName,
118
+ label: row.groupName,
119
+ value: row.sampleCount,
120
+ }))}
121
+ />
122
+ )}
123
+ </VisualizationWidget>
148
124
  ));
125
+
149
126
  function App() {
150
127
  return (
151
- <DataApp
152
- view={sampleCountsView}
153
- summaryViews={[sampleTotalView]}
154
- datasets={[sampleCounts]}
155
- story={(countsSnapshot, totalSnapshot) => {
156
- const total = totalSamples.read(totalSnapshot);
157
- const scope = sampleCountsView.scope(countsSnapshot);
158
- return [
159
- {
160
- id: 'total-samples',
161
- headline: `Total samples: ${formatMetric(total.value.current, totalSamples.definition.format)}`,
162
- context: `Demonstration values for ${scope}.`,
163
- visual: (
164
- <MetricWidget metric={totalSamples} source={totalSnapshot} />
165
- ),
166
- visualKind: 'metric',
167
- evidence: totalSamples,
168
- },
169
- {
170
- id: 'counts-by-group',
171
- headline: 'Counts by group',
172
- context: `Demonstration values for ${scope}.`,
173
- visual: (
174
- <TableWidget
175
- dataset={sampleCounts}
176
- source={countsSnapshot}
177
- pagination={false}
178
- />
179
- ),
180
- evidence: sampleCounts,
181
- },
182
- ];
183
- }}
184
- >
185
- <Stack>
186
- <TextContent>
187
- <h2>Sample counts</h2>
188
- </TextContent>
189
- <DataSection content={totalContent} label="Sample total" />
190
- <DataSection content={countsContent} label="Group counts" />
191
- </Stack>
128
+ <DataApp view={sampleCountsView} datasets={[sampleCounts]}>
129
+ <DataSection content={countsContent} />
192
130
  </DataApp>
193
131
  );
194
132
  }
195
- injectDataAppStyles();
133
+
196
134
  mountDataApp({ app: dataApp, component: App });