@cfasim-ui/docs 0.6.3 → 0.7.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/charts/BarChart/BarChart.md +7 -8
- package/charts/BarChart/BarChart.vue +13 -7
- package/charts/ChoroplethMap/ChoroplethMap.md +99 -29
- package/charts/ChoroplethMap/ChoroplethMap.vue +456 -127
- package/charts/DataTable/DataTable.vue +1 -7
- package/charts/LineChart/LineChart.md +7 -8
- package/charts/LineChart/LineChart.vue +13 -7
- package/charts/_shared/ChartZoomControls.vue +138 -0
- package/charts/_shared/chartProps.ts +7 -7
- package/charts/_shared/index.ts +4 -15
- package/charts/_shared/seriesCsv.ts +2 -2
- package/charts/_shared/touch.ts +8 -0
- package/charts/_shared/useChartFoundation.ts +0 -1
- package/components/MultiSelect/MultiSelect.md +1 -1
- package/components/MultiSelect/MultiSelect.vue +24 -83
- package/components/NumberInput/NumberInput.md +5 -5
- package/components/NumberInput/NumberInput.vue +12 -59
- package/components/SelectBox/SelectBox.md +1 -0
- package/components/SelectBox/SelectBox.vue +34 -125
- package/components/TextInput/TextInput.md +2 -1
- package/components/TextInput/TextInput.vue +11 -51
- package/components/ToggleGroup/ToggleGroup.md +2 -2
- package/components/ToggleGroup/ToggleGroup.vue +21 -26
- package/components/_internal/FieldLabel.vue +27 -0
- package/components/_internal/field.ts +27 -0
- package/components/_internal/input.css +54 -0
- package/components/_internal/listbox.css +53 -0
- package/components/env.d.ts +4 -0
- package/index.json +8 -8
- package/package.json +1 -1
- package/pyodide/messages.ts +23 -0
- package/pyodide/pyodide.worker.ts +2 -21
- package/pyodide/pyodideWorkerApi.ts +7 -44
- package/shared/index.ts +1 -0
- package/shared/workerError.ts +17 -0
- package/wasm/messages.ts +6 -0
- package/wasm/wasm.worker.ts +1 -7
- package/wasm/wasmWorkerApi.ts +8 -26
|
@@ -701,11 +701,11 @@ anchor. `lineColor`, `lineWidth`, and `lineDash` style the line.
|
|
|
701
701
|
|
|
702
702
|
## Accessibility
|
|
703
703
|
|
|
704
|
-
The chart's
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
704
|
+
The chart's `<svg>` is exposed as a single labeled image so screen readers
|
|
705
|
+
announce one accessible name instead of wandering through the individual bars.
|
|
706
|
+
When the chart has a `title`, the `<svg>` gets `role="img"` and an `aria-label`
|
|
707
|
+
set to the title. The menu and download controls live outside the `<svg>`, so
|
|
708
|
+
they stay reachable regardless.
|
|
709
709
|
|
|
710
710
|
Set `ariaLabel` to give screen readers a fuller summary than the visible title
|
|
711
711
|
(it overrides `title` for the accessible name only):
|
|
@@ -719,9 +719,8 @@ Set `ariaLabel` to give screen readers a fuller summary than the visible title
|
|
|
719
719
|
/>
|
|
720
720
|
```
|
|
721
721
|
|
|
722
|
-
Pass `role` to override the default
|
|
723
|
-
|
|
724
|
-
tech).
|
|
722
|
+
Pass `role` to override the default `"img"` (e.g. `role="figure"`, or a role of
|
|
723
|
+
your own).
|
|
725
724
|
|
|
726
725
|
## API
|
|
727
726
|
|
|
@@ -286,12 +286,14 @@ const props = withDefaults(defineProps<BarChartProps>(), {
|
|
|
286
286
|
valueAxis: true,
|
|
287
287
|
});
|
|
288
288
|
|
|
289
|
-
// Accessible name for the
|
|
289
|
+
// Accessible name for the chart; falls back to the visible title.
|
|
290
290
|
const chartAriaLabel = computed(() => props.ariaLabel ?? props.title);
|
|
291
|
-
//
|
|
292
|
-
//
|
|
291
|
+
// Expose the <svg> as a single labeled image so screen readers announce the
|
|
292
|
+
// name instead of wandering through the individual bars. The menu/download
|
|
293
|
+
// controls live outside the <svg>, so they stay reachable. An explicit `role`
|
|
294
|
+
// prop always wins.
|
|
293
295
|
const chartRole = computed(
|
|
294
|
-
() => props.role ?? (chartAriaLabel.value ? "
|
|
296
|
+
() => props.role ?? (chartAriaLabel.value ? "img" : undefined),
|
|
295
297
|
);
|
|
296
298
|
|
|
297
299
|
// The template root is a <Teleport>, so fallthrough attrs (class, style,
|
|
@@ -1483,8 +1485,6 @@ const columnHeaders = computed<ColumnHeader[]>(() => {
|
|
|
1483
1485
|
class="bar-chart-wrapper"
|
|
1484
1486
|
:class="{ 'is-fullscreen': isFullscreen }"
|
|
1485
1487
|
:style="fullscreenStyle"
|
|
1486
|
-
:role="chartRole || undefined"
|
|
1487
|
-
:aria-label="chartAriaLabel || undefined"
|
|
1488
1488
|
>
|
|
1489
1489
|
<ChartMenu
|
|
1490
1490
|
v-if="menu"
|
|
@@ -1495,7 +1495,13 @@ const columnHeaders = computed<ColumnHeader[]>(() => {
|
|
|
1495
1495
|
<div class="chart-sr-only" aria-live="polite">
|
|
1496
1496
|
{{ isFullscreen ? "Chart expanded to fill window" : "" }}
|
|
1497
1497
|
</div>
|
|
1498
|
-
<svg
|
|
1498
|
+
<svg
|
|
1499
|
+
ref="svgRef"
|
|
1500
|
+
:width="width"
|
|
1501
|
+
:height="height"
|
|
1502
|
+
:role="chartRole || undefined"
|
|
1503
|
+
:aria-label="chartAriaLabel || undefined"
|
|
1504
|
+
>
|
|
1499
1505
|
<!-- title -->
|
|
1500
1506
|
<text
|
|
1501
1507
|
v-if="title"
|
|
@@ -254,18 +254,73 @@ Use an array of `CategoricalStop` objects to map string values to colors. Each s
|
|
|
254
254
|
</template>
|
|
255
255
|
</ComponentDemo>
|
|
256
256
|
|
|
257
|
-
###
|
|
257
|
+
### Pan and zoom
|
|
258
|
+
|
|
259
|
+
Maps are **fully static by default** — tooltips, hover, click-select, and
|
|
260
|
+
programmatic `focus` zoom all work, but there are no zoom gestures and no
|
|
261
|
+
controls. That's the right mode when clicks mean navigation instead of
|
|
262
|
+
exploration (see the state-map pattern below); a parent driving `focus`
|
|
263
|
+
provides its own way back (e.g. a "Back" button that clears the focus).
|
|
264
|
+
|
|
265
|
+
Add the `zoom` prop to enable the interaction. The map is then **static
|
|
266
|
+
until activated** — the scroll wheel never zooms inline, so the map can't
|
|
267
|
+
hijack page scrolling. A grey hint overlaid on the top of the map ("Double
|
|
268
|
+
click to zoom" / "Tap to zoom") advertises the gesture until it's been
|
|
269
|
+
used; pass `:zoom-hint="false"` to hide it.
|
|
270
|
+
|
|
271
|
+
- **Desktop:** double-click zooms in place (shift+double-click zooms out),
|
|
272
|
+
or press **+** in the always-present **+ / − / reset** control stack in
|
|
273
|
+
the top-left corner. Any of these — or clicking a feature — starts the
|
|
274
|
+
pan/zoom mode; from then on, drag pans the map. The reset button (a
|
|
275
|
+
counterclockwise arrow) animates back to the full extent (clearing any
|
|
276
|
+
`focus`); − and reset are disabled while the map is at its full extent.
|
|
277
|
+
- **Touch:** a tap expands the map to fill the window, zoomed in on the
|
|
278
|
+
tapped point. Inside, one finger pans, a pinch zooms, and a tap selects a
|
|
279
|
+
feature; the +/−/reset controls sit top-left and a close (✕) button
|
|
280
|
+
top-right returns to the inline map at full extent. The inline map ignores
|
|
281
|
+
touch gestures entirely, so the page always scrolls freely.
|
|
282
|
+
|
|
283
|
+
Filling the window is always an activated state: whether entered via the
|
|
284
|
+
menu's **Fullscreen** item or a tap, pan/zoom works immediately and the
|
|
285
|
+
controls are present — no double-click needed first. The scroll wheel (and
|
|
286
|
+
trackpad pinch) zooms there too, since page scrolling is locked while the
|
|
287
|
+
map fills the window.
|
|
288
|
+
|
|
289
|
+
Prefer in-place zooming on touch? Set `:touch-expand="false"` — the first
|
|
290
|
+
tap zooms the inline map in on the tapped point (the touch analogue of a
|
|
291
|
+
desktop double-click) instead of expanding it. From there one finger pans,
|
|
292
|
+
a pinch zooms, and taps select; the +/−/reset controls render inline, and
|
|
293
|
+
reset restores the original static, page-scrollable state. Fullscreen is
|
|
294
|
+
unaffected: that view stays continuously interactive and its reset only
|
|
295
|
+
recenters.
|
|
296
|
+
|
|
297
|
+
#### Full-page mode (`zoom-mode="scroll"`)
|
|
298
|
+
|
|
299
|
+
When the map _is_ the page — a dedicated map route, a dashboard panel, a
|
|
300
|
+
kiosk — the activation step just gets in the way, and there's no page
|
|
301
|
+
scroll to protect. Pair `zoom` with `zoom-mode="scroll"` to make the map
|
|
302
|
+
immediately interactive: the wheel (and trackpad pinch) zooms, dragging
|
|
303
|
+
pans, and touch gestures work inline with no tap-to-expand step. The
|
|
304
|
+
+/−/reset controls are always shown and the hint is suppressed.
|
|
258
305
|
|
|
259
|
-
|
|
306
|
+
```vue
|
|
307
|
+
<ChoroplethMap
|
|
308
|
+
:topology="statesTopo"
|
|
309
|
+
:data="stateData"
|
|
310
|
+
zoom
|
|
311
|
+
zoom-mode="scroll"
|
|
312
|
+
/>
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### County-level map
|
|
260
316
|
|
|
261
|
-
|
|
317
|
+
Set `geoType="counties"` to render county-level data using 5-digit FIPS codes. State borders are drawn on top for context. Double-click (or tap on touch) to explore — useful for dense county data.
|
|
262
318
|
|
|
263
319
|
<ComponentDemo>
|
|
264
320
|
<ChoroplethMap
|
|
265
321
|
:topology="countiesTopo"
|
|
266
322
|
geo-type="counties"
|
|
267
|
-
|
|
268
|
-
:zoom="true"
|
|
323
|
+
zoom
|
|
269
324
|
:data="[
|
|
270
325
|
{ id: '06037', value: 100 },
|
|
271
326
|
{ id: '06073', value: 80 },
|
|
@@ -289,7 +344,6 @@ On touch devices, add `two-finger-pan` so a single finger scrolls the page (the
|
|
|
289
344
|
<ChoroplethMap
|
|
290
345
|
:topology="countiesTopo"
|
|
291
346
|
geo-type="counties"
|
|
292
|
-
pan
|
|
293
347
|
zoom
|
|
294
348
|
:data="[
|
|
295
349
|
{ id: '06037', value: 100 },
|
|
@@ -315,8 +369,7 @@ Set `geoType="hsas"` to render Health Service Area boundaries. HSAs are dissolve
|
|
|
315
369
|
<ChoroplethMap
|
|
316
370
|
:topology="countiesTopo"
|
|
317
371
|
geo-type="hsas"
|
|
318
|
-
|
|
319
|
-
:zoom="true"
|
|
372
|
+
zoom
|
|
320
373
|
:data="[
|
|
321
374
|
{ id: '010259', value: 100 },
|
|
322
375
|
{ id: '060766', value: 90 },
|
|
@@ -340,7 +393,6 @@ Set `geoType="hsas"` to render Health Service Area boundaries. HSAs are dissolve
|
|
|
340
393
|
<ChoroplethMap
|
|
341
394
|
:topology="countiesTopo"
|
|
342
395
|
geo-type="hsas"
|
|
343
|
-
pan
|
|
344
396
|
zoom
|
|
345
397
|
:data="[
|
|
346
398
|
{ id: '010259', value: 100 },
|
|
@@ -367,11 +419,18 @@ This needs a counties topology (the same `us-atlas/counties-10m.json`). `data`
|
|
|
367
419
|
can stay national; only features inside the selected state are drawn and
|
|
368
420
|
colored.
|
|
369
421
|
|
|
422
|
+
This demo also opts for the quieter touch flow: `:touch-expand="false"` makes
|
|
423
|
+
a tap zoom in place instead of expanding to fill the window, and
|
|
424
|
+
`:zoom-hint="false"` drops the grey gesture hint.
|
|
425
|
+
|
|
370
426
|
<ComponentDemo>
|
|
371
427
|
<ChoroplethMap
|
|
372
428
|
:topology="countiesTopo"
|
|
373
429
|
geo-type="counties"
|
|
374
430
|
state="California"
|
|
431
|
+
zoom
|
|
432
|
+
:touch-expand="false"
|
|
433
|
+
:zoom-hint="false"
|
|
375
434
|
:data="[
|
|
376
435
|
{ id: '06037', value: 100 },
|
|
377
436
|
{ id: '06073', value: 80 },
|
|
@@ -392,6 +451,9 @@ colored.
|
|
|
392
451
|
:topology="countiesTopo"
|
|
393
452
|
geo-type="counties"
|
|
394
453
|
state="California"
|
|
454
|
+
zoom
|
|
455
|
+
:touch-expand="false"
|
|
456
|
+
:zoom-hint="false"
|
|
395
457
|
:data="[
|
|
396
458
|
{ id: '06037', value: 100 }, // Los Angeles
|
|
397
459
|
{ id: '06073', value: 80 }, // San Diego
|
|
@@ -416,16 +478,22 @@ Bind the `focus` prop to pan and zoom to a specific feature. Pass a feature
|
|
|
416
478
|
id (FIPS code, HSA code, or name) — or an array of ids to focus on a region.
|
|
417
479
|
With `v-model:focus`, clicking an unfocused feature focuses it and clicking
|
|
418
480
|
the focused feature toggles back off. If a tooltip is configured, focusing
|
|
419
|
-
shows that feature's tooltip. Users can
|
|
420
|
-
area; the built-in **
|
|
481
|
+
shows that feature's tooltip. Users can keep exploring around the focused
|
|
482
|
+
area; the built-in **reset** button clears focus and snaps back to the full
|
|
483
|
+
extent.
|
|
421
484
|
|
|
422
485
|
Set `:focus-zoom="false"` to highlight (and draw cross-geoType overlays)
|
|
423
486
|
**without** panning or zooming — useful for a click-to-select interaction
|
|
424
487
|
where the map should stay put while a side panel shows the details.
|
|
425
488
|
|
|
426
|
-
|
|
427
|
-
`stateClick` and toggles focus
|
|
428
|
-
|
|
489
|
+
On touch, selection happens inside the tap-to-expand view: a single-finger
|
|
490
|
+
**tap** on a feature there emits `stateClick` and toggles focus. (With
|
|
491
|
+
`:zoom="false"` a tap selects directly on the inline map instead.) Hover
|
|
492
|
+
tooltips stay off on touch for performance.
|
|
493
|
+
|
|
494
|
+
Click-to-focus interactions usually pair best with `:touch-expand="false"`,
|
|
495
|
+
as in the demos below — the first tap zooms in place and the next tap
|
|
496
|
+
selects, so the map stays in your layout instead of taking over the window.
|
|
429
497
|
|
|
430
498
|
Counties are tiny without a zoom — focus is a natural fit for drill-down.
|
|
431
499
|
|
|
@@ -435,6 +503,8 @@ Counties are tiny without a zoom — focus is a natural fit for drill-down.
|
|
|
435
503
|
geo-type="counties"
|
|
436
504
|
v-model:focus="focused"
|
|
437
505
|
:focus-zoom-level="8"
|
|
506
|
+
zoom
|
|
507
|
+
:touch-expand="false"
|
|
438
508
|
:data="[
|
|
439
509
|
{ id: '06037', value: 100 },
|
|
440
510
|
{ id: '06073', value: 80 },
|
|
@@ -469,6 +539,8 @@ const focused = ref(null);
|
|
|
469
539
|
geo-type="counties"
|
|
470
540
|
v-model:focus="focused"
|
|
471
541
|
:focus-zoom-level="8"
|
|
542
|
+
zoom
|
|
543
|
+
:touch-expand="false"
|
|
472
544
|
:data="data"
|
|
473
545
|
title="Click a county to focus"
|
|
474
546
|
>
|
|
@@ -496,8 +568,8 @@ on top with a `FocusItem`.
|
|
|
496
568
|
:topology="countiesTopo"
|
|
497
569
|
geo-type="counties"
|
|
498
570
|
data-geo-type="hsas"
|
|
499
|
-
|
|
500
|
-
:
|
|
571
|
+
zoom
|
|
572
|
+
:touch-expand="false"
|
|
501
573
|
:data="[
|
|
502
574
|
{ id: '060737', value: 80 },
|
|
503
575
|
{ id: '060723', value: 60 },
|
|
@@ -523,6 +595,8 @@ on top with a `FocusItem`.
|
|
|
523
595
|
:topology="countiesTopo"
|
|
524
596
|
geo-type="counties"
|
|
525
597
|
data-geo-type="hsas"
|
|
598
|
+
zoom
|
|
599
|
+
:touch-expand="false"
|
|
526
600
|
:data="hsaData"
|
|
527
601
|
:focus="[{ id: '06043' }, { id: '060737', geoType: 'hsas', style: 'dashed' }]"
|
|
528
602
|
title="HSA-keyed data on a county map"
|
|
@@ -549,8 +623,8 @@ subpath so consumers that don't need HSA lookups don't pay for the
|
|
|
549
623
|
:topology="countiesTopo"
|
|
550
624
|
geo-type="counties"
|
|
551
625
|
data-geo-type="hsas"
|
|
552
|
-
|
|
553
|
-
:
|
|
626
|
+
zoom
|
|
627
|
+
:touch-expand="false"
|
|
554
628
|
:focus="parentFocus"
|
|
555
629
|
@update:focus="focusedCounty = typeof $event === 'string' ? $event : null"
|
|
556
630
|
:data="[
|
|
@@ -595,6 +669,8 @@ const focus = computed(() => {
|
|
|
595
669
|
:topology="countiesTopo"
|
|
596
670
|
geo-type="counties"
|
|
597
671
|
data-geo-type="hsas"
|
|
672
|
+
zoom
|
|
673
|
+
:touch-expand="false"
|
|
598
674
|
:data="hsaData"
|
|
599
675
|
:focus="focus"
|
|
600
676
|
@update:focus="focusedCounty = typeof $event === 'string' ? $event : null"
|
|
@@ -654,8 +730,7 @@ Renders every US county with a value and a custom tooltip slot.
|
|
|
654
730
|
:topology="countiesTopo"
|
|
655
731
|
geo-type="counties"
|
|
656
732
|
:data="denseCountyData"
|
|
657
|
-
|
|
658
|
-
:zoom="true"
|
|
733
|
+
zoom
|
|
659
734
|
:color-scale="{ min: '#f0f5ff', max: '#08306b' }"
|
|
660
735
|
title="All US counties — tooltip perf demo"
|
|
661
736
|
:height="500"
|
|
@@ -680,13 +755,7 @@ const data = countiesTopo.objects.counties.geometries.map((g, i) => ({
|
|
|
680
755
|
}));
|
|
681
756
|
</script>
|
|
682
757
|
|
|
683
|
-
<ChoroplethMap
|
|
684
|
-
:topology="countiesTopo"
|
|
685
|
-
geo-type="counties"
|
|
686
|
-
:data="data"
|
|
687
|
-
pan
|
|
688
|
-
zoom
|
|
689
|
-
>
|
|
758
|
+
<ChoroplethMap :topology="countiesTopo" geo-type="counties" :data="data" zoom>
|
|
690
759
|
<template #tooltip="{ id, name, value }">
|
|
691
760
|
<div style="font-weight: 600">{{ name }}</div>
|
|
692
761
|
<div style="opacity: 0.7; font-size: 0.85em">FIPS {{ id }}</div>
|
|
@@ -793,8 +862,9 @@ tech).
|
|
|
793
862
|
| `legend` | `boolean` | No | `true` |
|
|
794
863
|
| `legendTitle` | `string` | No | — |
|
|
795
864
|
| `zoom` | `boolean` | No | `false` |
|
|
796
|
-
| `
|
|
797
|
-
| `
|
|
865
|
+
| `zoomMode` | `"activate" \| "scroll"` | No | `"activate"` |
|
|
866
|
+
| `touchExpand` | `boolean` | No | `true` |
|
|
867
|
+
| `zoomHint` | `boolean` | No | `true` |
|
|
798
868
|
| `tooltipTrigger` | `"hover" \| "click"` | No | — |
|
|
799
869
|
| `tooltipFormat` | `(data: {
|
|
800
870
|
id: string` | No | — |
|