@altertable/data-app 0.72.0 → 0.73.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/AGENTS.md +5 -61
- package/CONTRIBUTING.md +93 -180
- package/README.md +3 -4
- package/REFERENCE.md +30 -345
- package/dist/chunks/contract-BeLPJwlO.js +558 -0
- package/dist/chunks/contract-BeLPJwlO.js.map +1 -0
- package/dist/chunks/contract-Di8SP74I.js +462 -0
- package/dist/chunks/contract-Di8SP74I.js.map +1 -0
- package/dist/chunks/format-BdFlv_xa.js +148 -0
- package/dist/chunks/format-BdFlv_xa.js.map +1 -0
- package/dist/chunks/iframe-C3uCZEXh.js +809 -0
- package/dist/chunks/iframe-C3uCZEXh.js.map +1 -0
- package/dist/chunks/operation-CBxhjNhK.js +131 -0
- package/dist/chunks/operation-CBxhjNhK.js.map +1 -0
- package/dist/chunks/request-body-H1qPmmTN.js +50 -0
- package/dist/chunks/request-body-H1qPmmTN.js.map +1 -0
- package/dist/client/index.js +253 -285
- package/dist/client/index.js.map +1 -13
- package/dist/core/appearance.js +171 -162
- package/dist/core/appearance.js.map +1 -10
- package/dist/core/config.js +49 -11
- package/dist/core/config.js.map +1 -9
- package/dist/core/contract.js +3 -73
- package/dist/core/format.js +1 -26
- package/dist/index.js +1 -12
- package/dist/internal.js +352 -397
- package/dist/internal.js.map +1 -15
- package/dist/server/index.js +85 -97
- package/dist/server/index.js.map +1 -10
- package/dist/types/chunks/appearance.d.ts +45 -0
- package/dist/types/chunks/contract.d.ts +720 -0
- package/dist/types/chunks/index.d.ts +189 -0
- package/dist/types/client/index.d.ts +3 -13
- package/dist/types/core/appearance.d.ts +2 -42
- package/dist/types/core/config.d.ts +36 -39
- package/dist/types/core/contract.d.ts +2 -114
- package/dist/types/core/format.d.ts +44 -17
- package/dist/types/index.d.ts +3 -3
- package/dist/types/internal.d.ts +312 -22
- package/dist/types/server/index.d.ts +15 -4
- package/docs/app-authoring.md +72 -128
- package/docs/client.md +29 -63
- package/docs/composition.md +44 -75
- package/docs/contract.md +60 -100
- package/docs/data-context.md +35 -61
- package/docs/embed.md +83 -55
- package/docs/formatting-and-appearance.md +17 -38
- package/docs/hosted-apps.md +7 -14
- package/docs/layout.md +30 -47
- package/docs/local-data-apps.md +7 -7
- package/docs/react-embed.md +20 -26
- package/docs/react.md +10 -27
- package/docs/server-bun.md +2 -27
- package/docs/server.md +6 -12
- package/docs/stories-and-export.md +38 -40
- package/docs/styling.md +14 -22
- package/docs/ui-quality.md +5 -5
- package/docs/ui.md +68 -70
- package/docs/variables.md +142 -254
- package/docs/views.md +85 -116
- package/docs/widgets.md +100 -153
- package/docs/worker.md +15 -27
- package/package.json +3 -2
- package/dist/chunks/index-5a27erdg.js +0 -54
- package/dist/chunks/index-5a27erdg.js.map +0 -10
- package/dist/chunks/index-9yxr7nmm.js +0 -742
- package/dist/chunks/index-9yxr7nmm.js.map +0 -17
- package/dist/chunks/index-j5q5n3ra.js +0 -151
- package/dist/chunks/index-j5q5n3ra.js.map +0 -10
- package/dist/chunks/index-q75zm3a7.js +0 -153
- package/dist/chunks/index-q75zm3a7.js.map +0 -11
- package/dist/chunks/index-vhaec7m5.js +0 -30
- package/dist/chunks/index-vhaec7m5.js.map +0 -10
- package/dist/chunks/index-zp78caex.js +0 -1047
- package/dist/chunks/index-zp78caex.js.map +0 -19
- package/dist/core/contract.js.map +0 -9
- package/dist/core/format.js.map +0 -9
- package/dist/index.js.map +0 -9
- package/dist/types/client/annotations.d.ts +0 -27
- package/dist/types/client/data-client.d.ts +0 -43
- package/dist/types/client/download.d.ts +0 -5
- package/dist/types/client/iframe.d.ts +0 -59
- package/dist/types/client/location.d.ts +0 -13
- package/dist/types/client/logger.d.ts +0 -14
- package/dist/types/client/messages.d.ts +0 -7
- package/dist/types/client/navigation.d.ts +0 -15
- package/dist/types/client/transport.d.ts +0 -15
- package/dist/types/core/annotations.d.ts +0 -99
- package/dist/types/core/bridge-endpoint.d.ts +0 -21
- package/dist/types/core/bridge.d.ts +0 -172
- package/dist/types/core/data-view.d.ts +0 -46
- package/dist/types/core/date-format.d.ts +0 -24
- package/dist/types/core/date-range.d.ts +0 -20
- package/dist/types/core/dimension-source.d.ts +0 -64
- package/dist/types/core/dimension.d.ts +0 -71
- package/dist/types/core/facets.d.ts +0 -13
- package/dist/types/core/filters.d.ts +0 -45
- package/dist/types/core/invariant.d.ts +0 -2
- package/dist/types/core/keys.d.ts +0 -2
- package/dist/types/core/logger.d.ts +0 -12
- package/dist/types/core/messages.d.ts +0 -62
- package/dist/types/core/navigation.d.ts +0 -11
- package/dist/types/core/operation-types.d.ts +0 -80
- package/dist/types/core/operation.d.ts +0 -20
- package/dist/types/core/presentation.d.ts +0 -9
- package/dist/types/core/queries.d.ts +0 -84
- package/dist/types/core/reading.d.ts +0 -17
- package/dist/types/core/uuid.d.ts +0 -2
- package/dist/types/core/variables.d.ts +0 -133
- package/dist/types/server/handler.d.ts +0 -13
- package/dist/types/server/request-body.d.ts +0 -4
|
@@ -1,52 +1,50 @@
|
|
|
1
1
|
# Stories and CSV export
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
the displayed snapshot
|
|
5
|
-
Setup and static screens use `<DataApp>` from
|
|
6
|
-
or pass a direct `CsvExport` object.
|
|
3
|
+
Supply `story` and `datasets` on `<DataApp>` from `@altertable/data-app-react`.
|
|
4
|
+
Both use the displayed snapshot, including during refresh or failure.
|
|
5
|
+
Setup and static screens use `<DataApp>` from `/ui` and may omit both.
|
|
7
6
|
|
|
8
7
|
## Present data with stories
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
Continue the starter's `totalSamples` binding. Return one to four findings with a
|
|
10
|
+
headline, visual, and registered dataset or
|
|
11
|
+
metric as `evidence`. Reuse bindings and derive scope from the snapshot:
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
```tsx
|
|
14
|
+
// ... sampleCountsView, sampleCounts, totalSamples, and sampleContent
|
|
15
|
+
function App() {
|
|
16
|
+
return (
|
|
17
|
+
<DataApp
|
|
18
|
+
view={sampleCountsView}
|
|
19
|
+
datasets={[sampleCounts]}
|
|
20
|
+
story={snapshot => {
|
|
21
|
+
const total = totalSamples.read(snapshot);
|
|
22
|
+
return [
|
|
23
|
+
{
|
|
24
|
+
id: 'total-samples',
|
|
25
|
+
headline: `Total samples: ${formatMetric(total.value.current, totalSamples.definition.format)}`,
|
|
26
|
+
context: sampleCountsView.scope(snapshot),
|
|
27
|
+
visual: <MetricWidget metric={totalSamples} source={snapshot} />,
|
|
28
|
+
evidence: totalSamples,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
<DataSection content={sampleContent} />
|
|
34
|
+
</DataApp>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
16
38
|
|
|
17
|
-
|
|
18
|
-
during refresh or failure. Derive the story from that snapshot so it agrees with
|
|
19
|
-
the visible exploration. Initial loading, empty results, and initial errors have
|
|
20
|
-
no story to present; the toolbar keeps its story action visible and disabled.
|
|
39
|
+
Keep the starter's `formatMetric()` import for formatted headlines.
|
|
21
40
|
|
|
22
41
|
## Export displayed data as CSV
|
|
23
42
|
|
|
24
|
-
Select all distinct named datasets from the displayed snapshot. One dataset downloads directly as CSV. Multiple
|
|
25
|
-
datasets offer individual CSV downloads and **Export all** as a ZIP archive.
|
|
26
|
-
While no displayed snapshot is available, the export action stays visible and disabled.
|
|
27
|
-
|
|
28
43
|
Declare [datasets](widgets.md#declare-datasets-and-metrics) once and pass
|
|
29
|
-
`datasets={[
|
|
30
|
-
|
|
31
|
-
displayed scope. List every distinct dataset the app shows.
|
|
32
|
-
|
|
33
|
-
Reuse bound metrics in story visuals:
|
|
34
|
-
|
|
35
|
-
```tsx
|
|
36
|
-
story={snapshot => {
|
|
37
|
-
const totalReading = total.read(snapshot);
|
|
38
|
-
return [{
|
|
39
|
-
id: 'total',
|
|
40
|
-
headline: `Tracked identities: ${formatMetric(totalReading.value.current, total.definition.format)}`,
|
|
41
|
-
context: activityView.scope(snapshot),
|
|
42
|
-
visual: <MetricWidget metric={total} source={snapshot} />,
|
|
43
|
-
evidence: total,
|
|
44
|
-
}];
|
|
45
|
-
}}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Use the [format helpers](formatting-and-appearance.md) for story prose.
|
|
44
|
+
`datasets={[sampleCounts]}`. Include every distinct displayed dataset
|
|
45
|
+
at its displayed grain; reuse a dataset for visuals sharing the same rows.
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
One dataset downloads as CSV; multiple datasets offer individual downloads and
|
|
48
|
+
**Export all** as ZIP. Filenames use the displayed scope. Accessors must return
|
|
49
|
+
raw values: null and undefined export as empty cells, and measured zero stays
|
|
50
|
+
zero. Export handles quoting and spreadsheet formula protection.
|
package/docs/styling.md
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
# Styling
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Configure theme, palette, accent, typography, density, radius, and elevation through
|
|
8
|
-
`app.appearance`; see [appearance](formatting-and-appearance.md). Call
|
|
9
|
-
`injectDataAppStyles()` before mounting. Use one `<DataApp>` per document.
|
|
3
|
+
Keep default appearance unless customization is requested. Use components and
|
|
4
|
+
typed props first. Configure appearance once through
|
|
5
|
+
`dataApp.appearance`; see [formatting and appearance](formatting-and-appearance.md).
|
|
6
|
+
Call `injectDataAppStyles()` before mounting and use one `<DataApp>` per document.
|
|
10
7
|
|
|
11
8
|
## Customize
|
|
12
9
|
|
|
13
|
-
Add app-owned classes through `className
|
|
14
|
-
|
|
15
|
-
are listed in the [
|
|
10
|
+
Add app-owned classes through `className` and override public tokens. Render
|
|
11
|
+
package components; do not copy their classes or select private descendants.
|
|
12
|
+
Public hooks are listed in the [style contract](https://github.com/altertable-ai/data-app/blob/main/packages/data-app-react/src/style-contract.ts).
|
|
16
13
|
|
|
17
14
|
```css
|
|
18
15
|
.app-action {
|
|
@@ -21,18 +18,14 @@ are listed in the [typed contract](https://github.com/altertable-ai/data-app/blo
|
|
|
21
18
|
}
|
|
22
19
|
```
|
|
23
20
|
|
|
24
|
-
Type inline
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Menus and selection dropdowns share `--atbl-dropdown-padding`,
|
|
30
|
-
`--atbl-dropdown-item-padding-block`, `--atbl-dropdown-item-padding-inline`, and
|
|
31
|
-
`--atbl-dropdown-item-gap`. Their default padding follows the control density.
|
|
21
|
+
Type inline overrides with `DataAppStyle`. Give optional tokens a `var()` fallback.
|
|
22
|
+
Use `:root` for overrides shared with menus and overlays. Prefer `dataApp.appearance`
|
|
23
|
+
for brand and chart colors; pair accent overrides with a contrasting foreground.
|
|
24
|
+
Keep text inputs at least 16px on mobile.
|
|
32
25
|
|
|
33
26
|
## Native controls
|
|
34
27
|
|
|
35
|
-
|
|
28
|
+
Prefer package controls. For a custom native control:
|
|
36
29
|
|
|
37
30
|
```tsx
|
|
38
31
|
<button type="button" data-atbl-control="action" data-atbl-focus="ring">
|
|
@@ -40,6 +33,5 @@ Use package controls when possible. For a custom native control:
|
|
|
40
33
|
</button>
|
|
41
34
|
```
|
|
42
35
|
|
|
43
|
-
These hooks
|
|
44
|
-
|
|
45
|
-
[UI quality](ui-quality.md) for rendered verification.
|
|
36
|
+
These hooks style cursor and focus. Supply accessible names, disabled state, and
|
|
37
|
+
keyboard behavior, then verify [UI quality](ui-quality.md).
|
package/docs/ui-quality.md
CHANGED
|
@@ -13,8 +13,8 @@ Keep static context visible during loading. Skeletonize only dynamic content;
|
|
|
13
13
|
refresh, errors, and retry retain the displayed result and scope. Loading
|
|
14
14
|
geometry should match ready content.
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
and
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
The SDK owns standard theme handling, responsive components, and keyboard/focus
|
|
17
|
+
behavior for its controls. Review app-owned content at its intended width with realistic labels
|
|
18
|
+
and values. When adding custom layout or CSS, check narrow and wide widths for
|
|
19
|
+
clipping and overflow; check custom colors in both themes and custom controls
|
|
20
|
+
with the keyboard.
|
package/docs/ui.md
CHANGED
|
@@ -10,21 +10,16 @@ frame for deliberately custom content. Use `<GettingStarted>` for
|
|
|
10
10
|
connection setup. Fetched data belongs to a declared view; avoid inventing
|
|
11
11
|
request states to populate a shell.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Direct `<DateRangePicker>`, `<DimensionPicker>`, and `useAppVariables()` support
|
|
17
|
-
custom control ownership. The caller supplies values and change handlers.
|
|
18
|
-
Custom tables use `<DataTable>` and its cell helpers; controls and overlays
|
|
19
|
-
include `<SearchField>`, `<ChoicePicker>`, `<Tabs>`, `<Sheet>`, and `<HelpPopover>`.
|
|
20
|
-
Horizontal `<TabList>` content scrolls with gradient cues at overflowing edges.
|
|
13
|
+
Custom controls own values and change handlers; use `useAppVariables()` for
|
|
14
|
+
custom URL state. Use `<DataTable>` for custom tables and `<Tabs>`, `<Sheet>`,
|
|
15
|
+
and `<HelpPopover>` for navigation and overlays.
|
|
21
16
|
|
|
22
17
|
Standalone `<AboutData>`, glossary components, and `<PresentStory>` support
|
|
23
18
|
custom inspection and presentation. Supply registered context and evidence, and
|
|
24
19
|
derive findings from the displayed data. Standard widgets and `<DataApp>`
|
|
25
20
|
already own these experiences.
|
|
26
21
|
|
|
27
|
-
For framework mounting, `<DataAppProvider app={
|
|
22
|
+
For framework mounting, `<DataAppProvider app={dataApp}>` supplies app identity, shared requests and one inspection sheet. Wrap custom shells in it; app components inherit identity and appearance.
|
|
28
23
|
Call `injectDataAppStyles()` before mounting either entry; imports do not install
|
|
29
24
|
styles.
|
|
30
25
|
|
|
@@ -34,12 +29,20 @@ Use `isPlainKeyEvent()` from `@altertable/data-app-react/ui` in custom key handl
|
|
|
34
29
|
leave shortcut modifiers and IME composition untouched:
|
|
35
30
|
|
|
36
31
|
```tsx
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
function SearchInput() {
|
|
33
|
+
// ... submit handler
|
|
34
|
+
return (
|
|
35
|
+
<input
|
|
36
|
+
aria-label="Search"
|
|
37
|
+
onKeyDown={event => {
|
|
38
|
+
if (event.key === 'Enter' && isPlainKeyEvent(event.nativeEvent)) {
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
submit();
|
|
41
|
+
}
|
|
42
|
+
}}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
43
46
|
```
|
|
44
47
|
|
|
45
48
|
Pass `{ allowShift: true }` when the handler also supports Shift gestures.
|
|
@@ -47,17 +50,13 @@ Pass `{ allowShift: true }` when the handler also supports Shift gestures.
|
|
|
47
50
|
## Choose a selection control
|
|
48
51
|
|
|
49
52
|
Use `<DimensionPicker>` for typed field filters and `<ChoicePicker>` for searchable
|
|
50
|
-
values.
|
|
51
|
-
values use checkbox indicators and keep the popup open. These pickers expose
|
|
52
|
-
listbox options, including search and loading feedback.
|
|
53
|
+
values.
|
|
53
54
|
|
|
54
55
|
Use `<MenuTrigger>`, `<MenuButton>`, `<MenuPopover>`, `<Menu>`, and `<MenuItem>`
|
|
55
56
|
for commands or short choice menus
|
|
56
57
|
such as sort order or display mode. Actions use `onAction`. Set
|
|
57
58
|
`selectionMode="single"` for mutually exclusive choices (radio menu items), or
|
|
58
|
-
`selectionMode="multiple"` for independent toggles (checkbox menu items).
|
|
59
|
-
support arrow keys, typeahead, Escape, and focus return to their trigger. Keep
|
|
60
|
-
search fields and other form inputs outside menus.
|
|
59
|
+
`selectionMode="multiple"` for independent toggles (checkbox menu items). Keep search fields and form inputs outside menus.
|
|
61
60
|
|
|
62
61
|
```tsx
|
|
63
62
|
<MenuTrigger>
|
|
@@ -81,11 +80,8 @@ search fields and other form inputs outside menus.
|
|
|
81
80
|
`<MenuButton>` accepts text or icons; give icon-only buttons an accessible name.
|
|
82
81
|
`<MenuPopover>` owns placement and popup styling.
|
|
83
82
|
|
|
84
|
-
Use `<MenuSection>`
|
|
85
|
-
|
|
86
|
-
by default; set `shouldCloseOnSelect={false}` for repeated toggles. Selection
|
|
87
|
-
indicators derive from the menu or section's selection mode; do not add checkbox
|
|
88
|
-
markup to single-choice items.
|
|
83
|
+
Use `<MenuSection>` for grouped choices and `<MenuSeparator>` between groups.
|
|
84
|
+
Selection indicators derive from `selectionMode`; do not add checkbox markup.
|
|
89
85
|
|
|
90
86
|
## Charts
|
|
91
87
|
|
|
@@ -97,10 +93,9 @@ so rows, loading state, evidence, and inspection come from that dataset.
|
|
|
97
93
|
Pass ordered items with unique, nonblank IDs and finite numbers. Bar and pie
|
|
98
94
|
values must be nonnegative. Use `formatValue` for domain formatting.
|
|
99
95
|
|
|
100
|
-
Line and area charts
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
the samples. Pie slices represent mutually exclusive parts of one total; shares
|
|
96
|
+
Line and area charts space samples equally; include missing periods and use
|
|
97
|
+
composed charts for irregular intervals. Distinguish missing observations from zero.
|
|
98
|
+
Pie slices represent mutually exclusive parts of one total; shares
|
|
104
99
|
use the sum of supplied items, so include Other when showing a subset of the
|
|
105
100
|
whole. Scatter points represent independent X/Y observations.
|
|
106
101
|
|
|
@@ -134,22 +129,28 @@ standalone charts' themed series primitives; axes, scatter, tooltip, and referen
|
|
|
134
129
|
primitives are also available.
|
|
135
130
|
|
|
136
131
|
```tsx
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
<ComposedChart
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
132
|
+
// ... revenueView and its revenue dataset
|
|
133
|
+
const revenueContent = revenueView.content(result => (
|
|
134
|
+
<VisualizationWidget dataset={revenue} source={result}>
|
|
135
|
+
{rows => (
|
|
136
|
+
<ComposedChart
|
|
137
|
+
data={rows}
|
|
138
|
+
ariaLabel="Monthly revenue and target in euros"
|
|
139
|
+
>
|
|
140
|
+
<ComposedChart.XAxis dataKey="month" />
|
|
141
|
+
<ComposedChart.YAxis />
|
|
142
|
+
<ComposedChart.Tooltip />
|
|
143
|
+
<ComposedChart.Legend />
|
|
144
|
+
<ComposedChart.Bar dataKey="revenue" name="Revenue (€)" />
|
|
145
|
+
<ComposedChart.Line
|
|
146
|
+
dataKey="target"
|
|
147
|
+
name="Target (€)"
|
|
148
|
+
stroke="var(--atbl-chart-2)"
|
|
149
|
+
/>
|
|
150
|
+
</ComposedChart>
|
|
151
|
+
)}
|
|
152
|
+
</VisualizationWidget>
|
|
153
|
+
));
|
|
153
154
|
```
|
|
154
155
|
|
|
155
156
|
For irregular time intervals, use `<ComposedChart.XAxis>` with ISO dates, zoned
|
|
@@ -169,10 +170,7 @@ its columns aligned with the displayed measures.
|
|
|
169
170
|
Include `<ComposedChart.Legend />` to derive labels and colored square markers from the series;
|
|
170
171
|
omit it when no legend is needed. For any chart, compose `<ChartLegend>` with
|
|
171
172
|
`<ChartLegend.Item>`, `<ChartLegend.Marker>`, and `<ChartLegend.Label>` using the
|
|
172
|
-
same names and colors as the plot.
|
|
173
|
-
shared with chart tooltips and funnel summaries. Pass `kind="square"` explicitly
|
|
174
|
-
when composing a marker.
|
|
175
|
-
`<PieChart>` includes a legend by default; `showLegend={false}` omits it.
|
|
173
|
+
same names and colors as the plot. `<PieChart>` includes a legend by default; `showLegend={false}` omits it.
|
|
176
174
|
|
|
177
175
|
Legends describe series; authored toggles or a composed legend's `onClick`
|
|
178
176
|
leave series visibility to the app.
|
|
@@ -196,33 +194,33 @@ filter declarations own URL state, validation, and operation meaning.
|
|
|
196
194
|
| `<DimensionPicker>` | Typed categorical predicates with fixed or facet options |
|
|
197
195
|
|
|
198
196
|
```tsx
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
<
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
197
|
+
function FilterChoices() {
|
|
198
|
+
// ... metric, statuses, and their change handlers
|
|
199
|
+
return (
|
|
200
|
+
<>
|
|
201
|
+
<RadioGroup label="Metric" value={metric} onChange={setMetric}>
|
|
202
|
+
<Radio value="orders">Orders</Radio>
|
|
203
|
+
<Radio value="revenue">Revenue</Radio>
|
|
204
|
+
</RadioGroup>
|
|
205
|
+
|
|
206
|
+
<CheckboxGroup label="Statuses" values={statuses} onChange={setStatuses}>
|
|
207
|
+
<Checkbox value="paid" label="Paid" />
|
|
208
|
+
<Checkbox value="pending" label="Pending" />
|
|
209
|
+
</CheckboxGroup>
|
|
210
|
+
</>
|
|
211
|
+
);
|
|
212
|
+
}
|
|
208
213
|
```
|
|
209
214
|
|
|
210
|
-
A standalone `<Checkbox>` uses `checked` and `onChange`;
|
|
211
|
-
`value`. `<SegmentedControl>` accepts the same labeled options as `<Select>` and
|
|
212
|
-
keeps radio-group semantics. Numeric range controls retain invalid draft bounds
|
|
213
|
-
and emit only valid intervals. Numeric input and compact selects respect the
|
|
214
|
-
shared mobile text-size minimum.
|
|
215
|
+
A standalone `<Checkbox>` uses `checked` and `onChange`; group items use `value`.
|
|
215
216
|
|
|
216
217
|
Use `<FilterBar>` to arrange predicates and `<VariableBar>` for mixed app
|
|
217
218
|
parameters. Use `<FilterActions>` for Clear or paired Apply/Cancel actions on
|
|
218
219
|
app-owned drafts; provide the handlers for your applied state.
|
|
219
220
|
|
|
220
|
-
`<NumberFilterPicker>`
|
|
221
|
-
|
|
222
|
-
and `<NumberRangeField>` as inline input primitives when composing forms.
|
|
221
|
+
Use `<NumberFilterPicker>` for a numeric predicate popover or numeric fields
|
|
222
|
+
for inline forms.
|
|
223
223
|
|
|
224
224
|
Use `<Button variant="primary">` for the main committing action, such as Apply.
|
|
225
225
|
Use outline and ghost buttons for secondary actions.
|
|
226
|
-
Use `<Button variant="inline">` for actions within text or table cells.
|
|
227
|
-
control padding or background and underlines on hover. Keep button semantics for
|
|
228
|
-
opening a sheet; use links for navigation to a URL.
|
|
226
|
+
Use `<Button variant="inline">` for actions within text or table cells. Use buttons for opening sheets and links for URL navigation.
|