@forgeroute/ui 0.4.2 → 0.4.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgeroute/ui",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=22.0.0",
6
6
  "@angular/core": ">=22.0.0",
@@ -45,6 +45,14 @@
45
45
  "types": "./types/forgeroute-ui-charts.d.ts",
46
46
  "default": "./fesm2022/forgeroute-ui-charts.mjs"
47
47
  },
48
+ "./maps": {
49
+ "types": "./types/forgeroute-ui-maps.d.ts",
50
+ "default": "./fesm2022/forgeroute-ui-maps.mjs"
51
+ },
52
+ "./messaging": {
53
+ "types": "./types/forgeroute-ui-messaging.d.ts",
54
+ "default": "./fesm2022/forgeroute-ui-messaging.mjs"
55
+ },
48
56
  "./pdf": {
49
57
  "types": "./types/forgeroute-ui-pdf.d.ts",
50
58
  "default": "./fesm2022/forgeroute-ui-pdf.mjs"
@@ -0,0 +1,162 @@
1
+ import * as i0 from "@angular/core";
2
+ interface StateView {
3
+ id: string;
4
+ name: string;
5
+ path: string;
6
+ value: number;
7
+ /** "12 pickups" (or just "12"). */
8
+ valueText: string;
9
+ /** "Texas, 12 pickups": the accessible name, the tooltip text and the hidden-list entry. */
10
+ label: string;
11
+ fill: string;
12
+ }
13
+ /**
14
+ * US choropleth map: the 50 states plus Washington, DC, each coloured from `colorLow` (value 0) to `colorHigh` (the largest
15
+ * value) by its number in `data`.
16
+ *
17
+ * Interaction and accessibility
18
+ * - Every state is a button (`role="button"`, name "Texas, 12 pickups", `aria-pressed` for the selected one). The group has a
19
+ * single tab stop (roving tabindex: last focused state, else the selected one, else Alabama); arrow keys,
20
+ * Home and End move between states in alphabetical order, Enter / Space emit `stateClick` with the abbreviation.
21
+ * - The tooltip (state name + value) shows on hover AND on keyboard focus; it is real text, `aria-hidden` because the
22
+ * state's accessible name already says the same. Colour is never the only signal: values are in names, tooltip and the
23
+ * visually hidden list of all states.
24
+ * - A selected state gets an orange outline and the others are dimmed; the focus ring is drawn as an overlay outline
25
+ * (works the same in Chrome, Edge, Firefox and Safari) and only for keyboard focus.
26
+ * - `prefers-reduced-motion` turns the transitions off. Strokes use `vector-effect: non-scaling-stroke`, so outlines keep
27
+ * their pixel width when `focusState` zooms in.
28
+ *
29
+ * Known limitation: the very small states (CT, DC, DE, HI, MA, MD, NH, NJ, RI, VT) are tiny touch targets on a phone. They
30
+ * are reachable by keyboard and screen reader like any other; set `showSmallStateButtons` for a row of 44px buttons for them.
31
+ * Territories are not on the map.
32
+ */
33
+ export declare class UsStateMapComponent {
34
+ /** State abbreviation -> value. Keys are case-insensitive; unknown keys are ignored; numbers and numeric strings (`'5'`) are read as numbers, anything else (negative, NaN, Infinity, text, booleans, null) counts as 0; repeated keys (`tx` and `TX`) are added up. */
35
+ readonly data: import("@angular/core").InputSignal<Record<string, number>>;
36
+ /** Abbreviation of the selected state (orange outline, the others are dimmed). Unknown / null = none. */
37
+ readonly selectedState: import("@angular/core").InputSignal<string | null>;
38
+ /** Abbreviation of a state to zoom the map to (bounding box plus 15% padding). Unknown / null = the whole map. */
39
+ readonly focusState: import("@angular/core").InputSignal<string | null>;
40
+ /** Unit for one, e.g. "pickup": "Texas, 1 pickup". Empty = just the number. */
41
+ readonly unitSingular: import("@angular/core").InputSignal<string>;
42
+ /** Unit for other counts, e.g. "pickups". Empty = the singular text is used for every count. */
43
+ readonly unitPlural: import("@angular/core").InputSignal<string>;
44
+ /** Colour of a value of 0 (CSS hex or rgb()). Invalid values fall back to #e5e7eb. */
45
+ readonly colorLow: import("@angular/core").InputSignal<string>;
46
+ /** Colour of the largest value (CSS hex or rgb()). Invalid values fall back to #1e40af. */
47
+ readonly colorHigh: import("@angular/core").InputSignal<string>;
48
+ /** Shows the colour scale (0 to the largest value). */
49
+ readonly showLegend: import("@angular/core").InputSignal<boolean>;
50
+ /** Shows a row of buttons for the very small states (touch friendly, 44px). Off by default. */
51
+ readonly showSmallStateButtons: import("@angular/core").InputSignal<boolean>;
52
+ /** Accessible name of the whole map. */
53
+ readonly ariaLabel: import("@angular/core").InputSignal<string>;
54
+ /** CSS maximum width of the map (it always shrinks to its container). */
55
+ readonly maxWidth: import("@angular/core").InputSignal<string>;
56
+ /** Optional CSS height of the map, e.g. "420px". Empty = follows the width (aspect ratio of the map). */
57
+ readonly height: import("@angular/core").InputSignal<string>;
58
+ /** Emits the state's abbreviation (upper case) on click, tap, Enter or Space. */
59
+ readonly stateClick: import("@angular/core").OutputEmitterRef<string>;
60
+ private readonly host;
61
+ /** True between a pointer press and the click that follows: a mouse / touch focus must not draw the keyboard ring. */
62
+ protected pointerDown: boolean;
63
+ private readonly hoveredId;
64
+ private readonly focusedId;
65
+ private readonly lastFocusedId;
66
+ private readonly ringVisible;
67
+ protected readonly tipPos: import("@angular/core").WritableSignal<{
68
+ x: number;
69
+ y: number;
70
+ } | null>;
71
+ private readonly low;
72
+ private readonly high;
73
+ private readonly values;
74
+ private readonly max;
75
+ private unit;
76
+ private valueText;
77
+ protected readonly views: import("@angular/core").Signal<StateView[]>;
78
+ protected readonly smallViews: import("@angular/core").Signal<StateView[]>;
79
+ protected readonly selectedId: import("@angular/core").Signal<string | null>;
80
+ protected readonly selectedView: import("@angular/core").Signal<StateView | null>;
81
+ protected readonly focusRingView: import("@angular/core").Signal<StateView | null>;
82
+ protected readonly viewBox: import("@angular/core").Signal<string>;
83
+ /** The one state in the tab order: last focused, else selected, else the first. */
84
+ protected readonly tabStop: import("@angular/core").Signal<string>;
85
+ protected readonly tip: import("@angular/core").Signal<StateView | null>;
86
+ protected readonly gradient: import("@angular/core").Signal<string>;
87
+ protected readonly maxText: import("@angular/core").Signal<string>;
88
+ protected readonly legendLabel: import("@angular/core").Signal<string>;
89
+ protected opacityOf(id: string): string | null;
90
+ protected onHover(ev: PointerEvent, id: string): void;
91
+ protected onLeave(id: string): void;
92
+ protected clearHover(): void;
93
+ protected onClick(id: string): void;
94
+ protected onFocus(id: string): void;
95
+ protected onBlur(id: string): void;
96
+ protected onKey(ev: KeyboardEvent, id: string): void;
97
+ static ɵfac: i0.ɵɵFactoryDeclaration<UsStateMapComponent, never>;
98
+ static ɵcmp: i0.ɵɵComponentDeclaration<UsStateMapComponent, "ui-us-state-map", never, {
99
+ "data": {
100
+ "alias": "data";
101
+ "required": false;
102
+ "isSignal": true;
103
+ };
104
+ "selectedState": {
105
+ "alias": "selectedState";
106
+ "required": false;
107
+ "isSignal": true;
108
+ };
109
+ "focusState": {
110
+ "alias": "focusState";
111
+ "required": false;
112
+ "isSignal": true;
113
+ };
114
+ "unitSingular": {
115
+ "alias": "unitSingular";
116
+ "required": false;
117
+ "isSignal": true;
118
+ };
119
+ "unitPlural": {
120
+ "alias": "unitPlural";
121
+ "required": false;
122
+ "isSignal": true;
123
+ };
124
+ "colorLow": {
125
+ "alias": "colorLow";
126
+ "required": false;
127
+ "isSignal": true;
128
+ };
129
+ "colorHigh": {
130
+ "alias": "colorHigh";
131
+ "required": false;
132
+ "isSignal": true;
133
+ };
134
+ "showLegend": {
135
+ "alias": "showLegend";
136
+ "required": false;
137
+ "isSignal": true;
138
+ };
139
+ "showSmallStateButtons": {
140
+ "alias": "showSmallStateButtons";
141
+ "required": false;
142
+ "isSignal": true;
143
+ };
144
+ "ariaLabel": {
145
+ "alias": "ariaLabel";
146
+ "required": false;
147
+ "isSignal": true;
148
+ };
149
+ "maxWidth": {
150
+ "alias": "maxWidth";
151
+ "required": false;
152
+ "isSignal": true;
153
+ };
154
+ "height": {
155
+ "alias": "height";
156
+ "required": false;
157
+ "isSignal": true;
158
+ };
159
+ }, {
160
+ "stateClick": "stateClick";
161
+ }, never, never, true, never>;
162
+ }