@cfasim-ui/charts 0.1.9 → 0.2.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.
@@ -0,0 +1,9 @@
1
+ export interface ChartMenuItem {
2
+ label: string;
3
+ action: () => void;
4
+ }
5
+ type __VLS_Props = {
6
+ items: ChartMenuItem[];
7
+ };
8
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
9
+ export default _default;
@@ -0,0 +1,4 @@
1
+ export declare function downloadBlob(blob: Blob, name: string): void;
2
+ export declare function saveSvg(svg: SVGSVGElement, filename: string): void;
3
+ export declare function savePng(svg: SVGSVGElement, filename: string): void;
4
+ export declare function downloadCsv(csv: string, filename: string): void;
@@ -0,0 +1,37 @@
1
+ type __VLS_Props = {
2
+ /** Pixel x-coordinate relative to the positioned parent container */
3
+ x: number;
4
+ /** Pixel y-coordinate relative to the positioned parent container */
5
+ y: number;
6
+ /** Whether the tooltip is visible */
7
+ open: boolean;
8
+ /** Interaction mode. Default: 'hover' */
9
+ mode?: "hover" | "click";
10
+ /** Offset from anchor in pixels. Default: 8 */
11
+ sideOffset?: number;
12
+ };
13
+ declare function __VLS_template(): {
14
+ attrs: Partial<{}>;
15
+ slots: {
16
+ default?(_: {}): any;
17
+ default?(_: {}): any;
18
+ };
19
+ refs: {};
20
+ rootEl: any;
21
+ };
22
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
23
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
24
+ close: () => any;
25
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
26
+ onClose?: (() => any) | undefined;
27
+ }>, {
28
+ sideOffset: number;
29
+ mode: "hover" | "click";
30
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
31
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
32
+ export default _default;
33
+ type __VLS_WithTemplateSlots<T, S> = T & {
34
+ new (): {
35
+ $slots: S;
36
+ };
37
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,91 @@
1
+ export type GeoType = "states" | "counties" | "hsas";
2
+ export interface StateData {
3
+ /** FIPS code (e.g. "06" for California, "04015" for a county) or name */
4
+ id: string;
5
+ value: number | string;
6
+ }
7
+ export interface ChoroplethColorScale {
8
+ /** Minimum color (CSS color string). Default: "#e5f0fa" */
9
+ min?: string;
10
+ /** Maximum color (CSS color string). Default: "#08519c" */
11
+ max?: string;
12
+ }
13
+ export interface ThresholdStop {
14
+ /** Lower bound (inclusive). Values at or above this threshold get this color. */
15
+ min: number;
16
+ color: string;
17
+ /** Optional label for the legend (defaults to the min value) */
18
+ label?: string;
19
+ }
20
+ export interface CategoricalStop {
21
+ /** The categorical value to match */
22
+ value: string;
23
+ /** CSS color string */
24
+ color: string;
25
+ }
26
+ type __VLS_Props = {
27
+ data?: StateData[];
28
+ /** Geographic type: "states" (default), "counties", or "hsas" (Health Service Areas) */
29
+ geoType?: GeoType;
30
+ width?: number;
31
+ height?: number;
32
+ colorScale?: ChoroplethColorScale | ThresholdStop[] | CategoricalStop[];
33
+ title?: string;
34
+ noDataColor?: string;
35
+ strokeColor?: string;
36
+ strokeWidth?: number;
37
+ menu?: boolean | string;
38
+ /** Show legend. Default: true */
39
+ legend?: boolean;
40
+ /** Title displayed next to the legend */
41
+ legendTitle?: string;
42
+ /** Enable mouse-wheel zooming. Default: false */
43
+ zoom?: boolean;
44
+ /** Enable click-and-drag panning. Default: false */
45
+ pan?: boolean;
46
+ /** Tooltip activation mode */
47
+ tooltipTrigger?: "hover" | "click";
48
+ /** Custom tooltip formatter. Receives { id, name, value } and returns HTML string. */
49
+ tooltipFormat?: (data: {
50
+ id: string;
51
+ name: string;
52
+ value?: number | string;
53
+ }) => string;
54
+ };
55
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
56
+ stateClick: (state: {
57
+ id: string;
58
+ name: string;
59
+ value?: number | string;
60
+ }) => any;
61
+ stateHover: (state: {
62
+ id: string;
63
+ name: string;
64
+ value?: number | string;
65
+ } | null) => any;
66
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
67
+ onStateClick?: ((state: {
68
+ id: string;
69
+ name: string;
70
+ value?: number | string;
71
+ }) => any) | undefined;
72
+ onStateHover?: ((state: {
73
+ id: string;
74
+ name: string;
75
+ value?: number | string;
76
+ } | null) => any) | undefined;
77
+ }>, {
78
+ legend: boolean;
79
+ menu: boolean | string;
80
+ geoType: GeoType;
81
+ noDataColor: string;
82
+ strokeColor: string;
83
+ strokeWidth: number;
84
+ zoom: boolean;
85
+ pan: boolean;
86
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
87
+ containerRef: HTMLDivElement;
88
+ svgRef: SVGSVGElement;
89
+ mapGroupRef: SVGGElement;
90
+ }, HTMLDivElement>;
91
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ /** County FIPS code to HSA code mapping */
2
+ export declare const fipsToHsa: Record<string, string>;
3
+ /** HSA code to HSA name mapping */
4
+ export declare const hsaNames: Record<string, string>;
@@ -0,0 +1,21 @@
1
+ import { ModelOutput } from '@cfasim-ui/shared';
2
+ export type TableRecord = Record<string, ArrayLike<number | string | boolean>>;
3
+ export type TableData = TableRecord | ModelOutput;
4
+ export type ColumnWidth = "small" | "medium" | "large";
5
+ export type ColumnAlign = "left" | "center" | "right";
6
+ export interface ColumnConfig {
7
+ label?: string;
8
+ width?: ColumnWidth | number;
9
+ align?: ColumnAlign;
10
+ cellClass?: string;
11
+ }
12
+ type __VLS_Props = {
13
+ data: TableData;
14
+ maxRows?: number;
15
+ columnConfig?: Record<string, ColumnConfig>;
16
+ menu?: boolean | string;
17
+ };
18
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
19
+ menu: boolean | string;
20
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
21
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,96 @@
1
+ export interface Series {
2
+ data: number[];
3
+ color?: string;
4
+ dashed?: boolean;
5
+ strokeWidth?: number;
6
+ opacity?: number;
7
+ line?: boolean;
8
+ dots?: boolean;
9
+ dotRadius?: number;
10
+ dotFill?: string;
11
+ dotStroke?: string;
12
+ }
13
+ export interface Area {
14
+ upper: number[];
15
+ lower: number[];
16
+ color?: string;
17
+ opacity?: number;
18
+ }
19
+ type __VLS_Props = {
20
+ data?: number[];
21
+ series?: Series[];
22
+ areas?: Area[];
23
+ width?: number;
24
+ height?: number;
25
+ lineOpacity?: number;
26
+ title?: string;
27
+ xLabel?: string;
28
+ yLabel?: string;
29
+ yMin?: number;
30
+ xMin?: number;
31
+ xLabels?: string[];
32
+ debounce?: number;
33
+ menu?: boolean | string;
34
+ xGrid?: boolean;
35
+ yGrid?: boolean;
36
+ /** Custom per-index data passed to the tooltip slot */
37
+ tooltipData?: unknown[];
38
+ /** Tooltip activation mode. Default: 'hover' */
39
+ tooltipTrigger?: "hover" | "click";
40
+ };
41
+ declare function __VLS_template(): {
42
+ attrs: Partial<{}>;
43
+ slots: Readonly<{
44
+ tooltip?(props: {
45
+ index: number;
46
+ xLabel?: string;
47
+ values: {
48
+ value: number;
49
+ color: string;
50
+ seriesIndex: number;
51
+ }[];
52
+ data: unknown;
53
+ }): unknown;
54
+ }> & {
55
+ tooltip?(props: {
56
+ index: number;
57
+ xLabel?: string;
58
+ values: {
59
+ value: number;
60
+ color: string;
61
+ seriesIndex: number;
62
+ }[];
63
+ data: unknown;
64
+ }): unknown;
65
+ };
66
+ refs: {
67
+ containerRef: HTMLDivElement;
68
+ svgRef: SVGSVGElement;
69
+ tooltipRef: HTMLDivElement;
70
+ };
71
+ rootEl: HTMLDivElement;
72
+ };
73
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
74
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
75
+ hover: (payload: {
76
+ index: number;
77
+ } | null) => any;
78
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
79
+ onHover?: ((payload: {
80
+ index: number;
81
+ } | null) => any) | undefined;
82
+ }>, {
83
+ menu: boolean | string;
84
+ lineOpacity: number;
85
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
86
+ containerRef: HTMLDivElement;
87
+ svgRef: SVGSVGElement;
88
+ tooltipRef: HTMLDivElement;
89
+ }, HTMLDivElement>;
90
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
91
+ export default _default;
92
+ type __VLS_WithTemplateSlots<T, S> = T & {
93
+ new (): {
94
+ $slots: S;
95
+ };
96
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.css ADDED
@@ -0,0 +1,2 @@
1
+ .chart-menu-trigger-area[data-v-fe2f6904]{z-index:1;position:absolute;top:0;right:0}.chart-menu-button[data-v-fe2f6904]{border:1px solid var(--color-border);background:var(--color-bg-0,#fff);width:28px;height:28px;color:var(--color-text-secondary);cursor:pointer;opacity:0;border-radius:.25em;justify-content:center;align-items:center;transition:opacity .15s;display:flex}.chart-menu-button[data-state=open][data-v-fe2f6904]{opacity:1}.chart-menu-button[data-v-fe2f6904]:hover{background:var(--color-bg-1,#0000000d);color:var(--color-text)}.chart-menu-content{z-index:100;background:var(--color-bg-0);border:1px solid var(--color-border);border-radius:.25em;min-width:140px;padding:.25em;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a}.chart-menu-item{font-size:var(--font-size-sm);cursor:pointer;-webkit-user-select:none;user-select:none;white-space:nowrap;border-radius:.25em;outline:none;align-items:center;padding:.375em .5em;display:flex}.chart-menu-item[data-highlighted]{background:var(--color-primary);color:#fff}.line-chart-wrapper[data-v-55a24433]{width:100%;position:relative}.line-chart-wrapper[data-v-55a24433]:hover .chart-menu-button{opacity:1}.line-chart-tooltip-label[data-v-55a24433]{margin-bottom:.25em;font-weight:600}.line-chart-tooltip-row[data-v-55a24433]{align-items:center;gap:.375em;display:flex}.line-chart-tooltip-swatch[data-v-55a24433]{border-radius:50%;flex-shrink:0;width:.625em;height:.625em;display:inline-block}.choropleth-wrapper[data-v-7f5b0832]{width:100%;position:relative}.choropleth-wrapper.pannable svg[data-v-7f5b0832]{cursor:grab}.choropleth-wrapper.pannable svg[data-v-7f5b0832]:active{cursor:grabbing}.choropleth-wrapper[data-v-7f5b0832]:hover .chart-menu-button{opacity:1}.state-path[data-v-7f5b0832]{cursor:pointer}.chart-tooltip-anchor[data-v-44377f70]{pointer-events:none;width:1px;height:1px;position:absolute}.chart-tooltip-content{z-index:100;background:var(--color-bg-0,#fff);border:1px solid var(--color-border,#e5e7eb);font-size:var(--font-size-sm,.875rem);pointer-events:none;border-radius:.375em;padding:.5em .75em;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a}.TableOuter[data-v-dbfb7c84]{display:inline-block;position:relative}.TableOuter.has-menu[data-v-dbfb7c84]{padding-top:32px}.TableOuter[data-v-dbfb7c84]:hover .chart-menu-button{opacity:1}.TableWrapper[data-v-dbfb7c84]{font-size:var(--font-size-sm);overflow-x:auto}.Table[data-v-dbfb7c84]{border-collapse:collapse;font-variant-numeric:tabular-nums;border:1px solid var(--color-border)}.Table tr[data-v-dbfb7c84],.Table th[data-v-dbfb7c84],.Table td[data-v-dbfb7c84]{background:0 0;border:none}.Table th[data-v-dbfb7c84],.Table td[data-v-dbfb7c84]{white-space:nowrap;padding:.75em 1.25em}.Table th[data-v-dbfb7c84]{border-bottom:1px solid var(--color-border-header);font-weight:600;position:sticky;top:0}.Table tbody td[data-v-dbfb7c84]{border-bottom:1px solid var(--color-border)}.Table tbody tr:last-child td[data-v-dbfb7c84]{border-bottom:none}
2
+ /*$vite$:1*/
@@ -0,0 +1,4 @@
1
+ export { default as LineChart, type Series, type Area, } from './LineChart/LineChart';
2
+ export { default as ChoroplethMap, type GeoType, type StateData, type ChoroplethColorScale, type ThresholdStop, type CategoricalStop, } from './ChoroplethMap/ChoroplethMap';
3
+ export { default as ChartTooltip } from './ChartTooltip/ChartTooltip';
4
+ export { default as DataTable, type TableData, type TableRecord, type ColumnAlign, type ColumnConfig, type ColumnWidth, } from './DataTable/DataTable';