@cfasim-ui/docs 0.6.4 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/charts/ChoroplethMap/ChoroplethMap.md +105 -29
- package/charts/ChoroplethMap/ChoroplethMap.vue +528 -161
- package/charts/DataTable/DataTable.vue +1 -7
- package/charts/_shared/ChartZoomControls.vue +138 -0
- 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
|
@@ -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,28 @@ 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.
|
|
484
|
+
|
|
485
|
+
Each focus target's outline can be styled by passing a `FocusItem` object:
|
|
486
|
+
`style` picks the dash pattern (`"solid" | "dashed" | "dotted"`), `stroke`
|
|
487
|
+
the color, and `strokeWidth` the width in CSS px. In-place highlights
|
|
488
|
+
default to pure black/white following the theme (`light-dark(#000, #fff)`);
|
|
489
|
+
cross-geoType overlays default to white.
|
|
421
490
|
|
|
422
491
|
Set `:focus-zoom="false"` to highlight (and draw cross-geoType overlays)
|
|
423
492
|
**without** panning or zooming — useful for a click-to-select interaction
|
|
424
493
|
where the map should stay put while a side panel shows the details.
|
|
425
494
|
|
|
426
|
-
|
|
427
|
-
`stateClick` and toggles focus
|
|
428
|
-
|
|
495
|
+
On touch, selection happens inside the tap-to-expand view: a single-finger
|
|
496
|
+
**tap** on a feature there emits `stateClick` and toggles focus. (With
|
|
497
|
+
`:zoom="false"` a tap selects directly on the inline map instead.) Hover
|
|
498
|
+
tooltips stay off on touch for performance.
|
|
499
|
+
|
|
500
|
+
Click-to-focus interactions usually pair best with `:touch-expand="false"`,
|
|
501
|
+
as in the demos below — the first tap zooms in place and the next tap
|
|
502
|
+
selects, so the map stays in your layout instead of taking over the window.
|
|
429
503
|
|
|
430
504
|
Counties are tiny without a zoom — focus is a natural fit for drill-down.
|
|
431
505
|
|
|
@@ -435,6 +509,8 @@ Counties are tiny without a zoom — focus is a natural fit for drill-down.
|
|
|
435
509
|
geo-type="counties"
|
|
436
510
|
v-model:focus="focused"
|
|
437
511
|
:focus-zoom-level="8"
|
|
512
|
+
zoom
|
|
513
|
+
:touch-expand="false"
|
|
438
514
|
:data="[
|
|
439
515
|
{ id: '06037', value: 100 },
|
|
440
516
|
{ id: '06073', value: 80 },
|
|
@@ -469,6 +545,8 @@ const focused = ref(null);
|
|
|
469
545
|
geo-type="counties"
|
|
470
546
|
v-model:focus="focused"
|
|
471
547
|
:focus-zoom-level="8"
|
|
548
|
+
zoom
|
|
549
|
+
:touch-expand="false"
|
|
472
550
|
:data="data"
|
|
473
551
|
title="Click a county to focus"
|
|
474
552
|
>
|
|
@@ -496,8 +574,8 @@ on top with a `FocusItem`.
|
|
|
496
574
|
:topology="countiesTopo"
|
|
497
575
|
geo-type="counties"
|
|
498
576
|
data-geo-type="hsas"
|
|
499
|
-
|
|
500
|
-
:
|
|
577
|
+
zoom
|
|
578
|
+
:touch-expand="false"
|
|
501
579
|
:data="[
|
|
502
580
|
{ id: '060737', value: 80 },
|
|
503
581
|
{ id: '060723', value: 60 },
|
|
@@ -523,6 +601,8 @@ on top with a `FocusItem`.
|
|
|
523
601
|
:topology="countiesTopo"
|
|
524
602
|
geo-type="counties"
|
|
525
603
|
data-geo-type="hsas"
|
|
604
|
+
zoom
|
|
605
|
+
:touch-expand="false"
|
|
526
606
|
:data="hsaData"
|
|
527
607
|
:focus="[{ id: '06043' }, { id: '060737', geoType: 'hsas', style: 'dashed' }]"
|
|
528
608
|
title="HSA-keyed data on a county map"
|
|
@@ -549,8 +629,8 @@ subpath so consumers that don't need HSA lookups don't pay for the
|
|
|
549
629
|
:topology="countiesTopo"
|
|
550
630
|
geo-type="counties"
|
|
551
631
|
data-geo-type="hsas"
|
|
552
|
-
|
|
553
|
-
:
|
|
632
|
+
zoom
|
|
633
|
+
:touch-expand="false"
|
|
554
634
|
:focus="parentFocus"
|
|
555
635
|
@update:focus="focusedCounty = typeof $event === 'string' ? $event : null"
|
|
556
636
|
:data="[
|
|
@@ -595,6 +675,8 @@ const focus = computed(() => {
|
|
|
595
675
|
:topology="countiesTopo"
|
|
596
676
|
geo-type="counties"
|
|
597
677
|
data-geo-type="hsas"
|
|
678
|
+
zoom
|
|
679
|
+
:touch-expand="false"
|
|
598
680
|
:data="hsaData"
|
|
599
681
|
:focus="focus"
|
|
600
682
|
@update:focus="focusedCounty = typeof $event === 'string' ? $event : null"
|
|
@@ -654,8 +736,7 @@ Renders every US county with a value and a custom tooltip slot.
|
|
|
654
736
|
:topology="countiesTopo"
|
|
655
737
|
geo-type="counties"
|
|
656
738
|
:data="denseCountyData"
|
|
657
|
-
|
|
658
|
-
:zoom="true"
|
|
739
|
+
zoom
|
|
659
740
|
:color-scale="{ min: '#f0f5ff', max: '#08306b' }"
|
|
660
741
|
title="All US counties — tooltip perf demo"
|
|
661
742
|
:height="500"
|
|
@@ -680,13 +761,7 @@ const data = countiesTopo.objects.counties.geometries.map((g, i) => ({
|
|
|
680
761
|
}));
|
|
681
762
|
</script>
|
|
682
763
|
|
|
683
|
-
<ChoroplethMap
|
|
684
|
-
:topology="countiesTopo"
|
|
685
|
-
geo-type="counties"
|
|
686
|
-
:data="data"
|
|
687
|
-
pan
|
|
688
|
-
zoom
|
|
689
|
-
>
|
|
764
|
+
<ChoroplethMap :topology="countiesTopo" geo-type="counties" :data="data" zoom>
|
|
690
765
|
<template #tooltip="{ id, name, value }">
|
|
691
766
|
<div style="font-weight: 600">{{ name }}</div>
|
|
692
767
|
<div style="opacity: 0.7; font-size: 0.85em">FIPS {{ id }}</div>
|
|
@@ -793,8 +868,9 @@ tech).
|
|
|
793
868
|
| `legend` | `boolean` | No | `true` |
|
|
794
869
|
| `legendTitle` | `string` | No | — |
|
|
795
870
|
| `zoom` | `boolean` | No | `false` |
|
|
796
|
-
| `
|
|
797
|
-
| `
|
|
871
|
+
| `zoomMode` | `"activate" \| "scroll"` | No | `"activate"` |
|
|
872
|
+
| `touchExpand` | `boolean` | No | `true` |
|
|
873
|
+
| `zoomHint` | `boolean` | No | `true` |
|
|
798
874
|
| `tooltipTrigger` | `"hover" \| "click"` | No | — |
|
|
799
875
|
| `tooltipFormat` | `(data: {
|
|
800
876
|
id: string` | No | — |
|