@area8975/ui 0.1.0 → 0.1.1-dev.11

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": "@area8975/ui",
3
- "version": "0.1.0",
3
+ "version": "0.1.1-dev.11",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^22.0.0",
6
6
  "@angular/core": "^22.0.0",
@@ -33,4 +33,4 @@
33
33
  "module": "fesm2022/area8975-ui.mjs",
34
34
  "typings": "types/area8975-ui.d.ts",
35
35
  "type": "module"
36
- }
36
+ }
@@ -1,8 +1,26 @@
1
- import ApexCharts$1 from "apexcharts";
2
1
  import * as i0 from "@angular/core";
3
- import { ElementRef, OnDestroy, OnInit, TemplateRef, WritableSignal } from "@angular/core";
2
+ import { ElementRef, OnDestroy, OnInit, Signal, TemplateRef, WritableSignal } from "@angular/core";
3
+ import ApexCharts$1 from "apexcharts";
4
4
  import { Placement } from "@floating-ui/dom";
5
5
  import { Observable } from "rxjs";
6
+ /** One entry in a legend, the colour ties it to its marks. */
7
+ export interface ChartLegendItem {
8
+ name: string;
9
+ colour: string;
10
+ /** Shows the key as a dashed line, for series told apart by line style. */
11
+ dashed?: boolean;
12
+ }
13
+ /** Anything a legend can be linked to with `for`, every chart is one. */
14
+ export interface ChartLegendSource {
15
+ readonly legendItems: Signal<ChartLegendItem[]>;
16
+ readonly legendNote: Signal<string>;
17
+ /** Series switched off from the legend. */
18
+ readonly hiddenSeries: WritableSignal<string[]>;
19
+ /** The series the legend is pointing at, the others fade while it's set. */
20
+ readonly emphasis: WritableSignal<string | null>;
21
+ }
22
+ /** Where a chart draws its own legend, `none` when one is linked elsewhere. */
23
+ export type ChartLegendPosition = 'auto' | 'none';
6
24
  /**
7
25
  * Categorical colours for chart series, in a fixed order that was checked for
8
26
  * colour blindness (adjacent pairs stay apart for protan, deutan and tritan).
@@ -43,7 +61,7 @@ export interface ChartSeries {
43
61
  /** Turns a raw value into what the axis, tooltip and table show, e.g. money. */
44
62
  export type ChartValueFormatter = (value: number) => string;
45
63
  /** Inputs every chart with categories along one axis and values up the other shares. */
46
- declare abstract class UiAxisChartBase {
64
+ declare abstract class UiAxisChartBase implements ChartLegendSource {
47
65
  readonly series: import("@angular/core").InputSignal<ChartSeries[]>;
48
66
  readonly categories: import("@angular/core").InputSignal<string[]>;
49
67
  /** Says what the chart shows, e.g. "Spending by month". */
@@ -64,8 +82,12 @@ declare abstract class UiAxisChartBase {
64
82
  * matter stand out. The way to show more series than there are colours.
65
83
  */
66
84
  readonly highlight: import("@angular/core").InputSignal<string[] | null>;
85
+ /** `none` leaves the legend out, for when a `ui-chart-legend` is linked with `for`. */
86
+ readonly legend: import("@angular/core").InputSignal<ChartLegendPosition>;
67
87
  /** Series switched off in the legend. */
68
- protected readonly hiddenSeries: import("@angular/core").WritableSignal<string[]>;
88
+ readonly hiddenSeries: import("@angular/core").WritableSignal<string[]>;
89
+ /** The series the legend is pointing at, the others fade while it's set. */
90
+ readonly emphasis: import("@angular/core").WritableSignal<string | null>;
69
91
  /** Charts that draw lines can tell series apart by dashes too, bars can't. */
70
92
  protected readonly supportsDashes: boolean;
71
93
  protected readonly isEmpty: import("@angular/core").Signal<boolean>;
@@ -74,12 +96,8 @@ declare abstract class UiAxisChartBase {
74
96
  protected readonly colours: import("@angular/core").Signal<string[]>;
75
97
  protected readonly dashed: import("@angular/core").Signal<boolean[]>;
76
98
  /** Grey context series stay out of the legend, the note says how many there are. */
77
- protected readonly legendItems: import("@angular/core").Signal<{
78
- colour: string;
79
- dashed: boolean;
80
- name: string;
81
- }[]>;
82
- protected readonly legendNote: import("@angular/core").Signal<string>;
99
+ readonly legendItems: import("@angular/core").Signal<ChartLegendItem[]>;
100
+ readonly legendNote: import("@angular/core").Signal<string>;
83
101
  protected formatValue(value: number | null | undefined): string;
84
102
  static ɵfac: i0.ɵɵFactoryDeclaration<UiAxisChartBase, never>;
85
103
  static ɵdir: i0.ɵɵDirectiveDeclaration<UiAxisChartBase, never, never, {
@@ -138,6 +156,11 @@ declare abstract class UiAxisChartBase {
138
156
  "required": false;
139
157
  "isSignal": true;
140
158
  };
159
+ "legend": {
160
+ "alias": "legend";
161
+ "required": false;
162
+ "isSignal": true;
163
+ };
141
164
  }, {}, never, never, true, never>;
142
165
  }
143
166
  /**
@@ -209,13 +232,6 @@ export declare class UiChartComponent {
209
232
  };
210
233
  }, {}, never, never, true, never>;
211
234
  }
212
- /** One entry in a legend, the colour ties it to its marks. */
213
- export interface ChartLegendItem {
214
- name: string;
215
- colour: string;
216
- /** Shows the key as a dashed line, for series told apart by line style. */
217
- dashed?: boolean;
218
- }
219
235
  /** The loading, empty and data table states around a chart, shared by every chart type. */
220
236
  export declare class UiChartFrameComponent {
221
237
  readonly options: import("@angular/core").InputSignal<ApexCharts.ApexOptions>;
@@ -232,8 +248,9 @@ export declare class UiChartFrameComponent {
232
248
  readonly loading: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
233
249
  readonly empty: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
234
250
  readonly showTable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
251
+ readonly showLegend: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
235
252
  /** The series the legend is pointing at, the others fade while it's set. */
236
- protected readonly emphasis: import("@angular/core").WritableSignal<string | null>;
253
+ readonly emphasis: import("@angular/core").ModelSignal<string | null>;
237
254
  static ɵfac: i0.ɵɵFactoryDeclaration<UiChartFrameComponent, never>;
238
255
  static ɵcmp: i0.ɵɵComponentDeclaration<UiChartFrameComponent, "ui-chart-frame", never, {
239
256
  "options": {
@@ -306,8 +323,19 @@ export declare class UiChartFrameComponent {
306
323
  "required": false;
307
324
  "isSignal": true;
308
325
  };
326
+ "showLegend": {
327
+ "alias": "showLegend";
328
+ "required": false;
329
+ "isSignal": true;
330
+ };
331
+ "emphasis": {
332
+ "alias": "emphasis";
333
+ "required": false;
334
+ "isSignal": true;
335
+ };
309
336
  }, {
310
337
  "hiddenSeries": "hiddenSeriesChange";
338
+ "emphasis": "emphasisChange";
311
339
  }, never, never, true, never>;
312
340
  }
313
341
  /**
@@ -357,11 +385,15 @@ export declare class UiChartTableComponent {
357
385
  }, {}, never, never, true, never>;
358
386
  }
359
387
  /**
360
- * A row of colour keys naming what each colour means. Charts use it above
361
- * the plot, but it works next to anything coloured by series.
388
+ * A row of colour keys naming what each colour means. Link it to a chart
389
+ * with `for`, or pass `items` to use it next to anything coloured by series.
362
390
  */
363
391
  export declare class UiChartLegendComponent {
364
392
  readonly items: import("@angular/core").InputSignal<ChartLegendItem[]>;
393
+ /** Small text after the items, e.g. how many series aren't listed. */
394
+ readonly note: import("@angular/core").InputSignal<string>;
395
+ /** A chart to take items from and hide or fade series on, set its `legend` to `none`. */
396
+ readonly for: import("@angular/core").InputSignal<ChartLegendSource | null>;
365
397
  /** Names of items switched off, bound two-way when `toggleable`. */
366
398
  readonly hidden: import("@angular/core").ModelSignal<string[]>;
367
399
  /** Lets each item be clicked to hide or show its series. */
@@ -371,6 +403,9 @@ export declare class UiChartLegendComponent {
371
403
  private readonly hovered;
372
404
  private readonly focused;
373
405
  private readonly pointedAt;
406
+ protected readonly shownItems: import("@angular/core").Signal<ChartLegendItem[]>;
407
+ protected readonly shownNote: import("@angular/core").Signal<string>;
408
+ private readonly hiddenNames;
374
409
  protected readonly visibleCount: import("@angular/core").Signal<number>;
375
410
  constructor();
376
411
  protected hover(name: string | null): void;
@@ -382,7 +417,17 @@ export declare class UiChartLegendComponent {
382
417
  static ɵcmp: i0.ɵɵComponentDeclaration<UiChartLegendComponent, "ui-chart-legend", never, {
383
418
  "items": {
384
419
  "alias": "items";
385
- "required": true;
420
+ "required": false;
421
+ "isSignal": true;
422
+ };
423
+ "note": {
424
+ "alias": "note";
425
+ "required": false;
426
+ "isSignal": true;
427
+ };
428
+ "for": {
429
+ "alias": "for";
430
+ "required": false;
386
431
  "isSignal": true;
387
432
  };
388
433
  "hidden": {
@@ -429,6 +474,44 @@ export declare class UiLineChartComponent extends UiAxisChartBase {
429
474
  export declare const LineChartCurves: readonly ["straight", "smooth", "stepline"];
430
475
  /** @see {@link LineChartCurves} */
431
476
  export type LineChartCurve = typeof LineChartCurves[number];
477
+ /**
478
+ * Slices for showing how a whole splits into parts. Each category is a
479
+ * slice, only the first series is drawn. Best kept to a handful of slices,
480
+ * fold the small ones into "Other".
481
+ */
482
+ export declare class UiPieChartComponent extends UiAxisChartBase {
483
+ readonly variant: import("@angular/core").InputSignal<"pie" | "donut">;
484
+ /** Shown above the total in the middle of a donut. */
485
+ readonly totalLabel: import("@angular/core").InputSignal<string>;
486
+ protected readonly values: import("@angular/core").Signal<(number | null)[]>;
487
+ protected readonly isEmpty: import("@angular/core").Signal<boolean>;
488
+ protected readonly isMuted: import("@angular/core").Signal<boolean[]>;
489
+ protected readonly styles: import("@angular/core").Signal<ChartSeriesStyle[]>;
490
+ readonly legendItems: import("@angular/core").Signal<{
491
+ colour: string;
492
+ dashed: boolean;
493
+ name: string;
494
+ }[]>;
495
+ private readonly slices;
496
+ protected readonly chartOptions: import("@angular/core").Signal<ApexCharts.ApexOptions>;
497
+ static ɵfac: i0.ɵɵFactoryDeclaration<UiPieChartComponent, never>;
498
+ static ɵcmp: i0.ɵɵComponentDeclaration<UiPieChartComponent, "ui-pie-chart", never, {
499
+ "variant": {
500
+ "alias": "variant";
501
+ "required": false;
502
+ "isSignal": true;
503
+ };
504
+ "totalLabel": {
505
+ "alias": "totalLabel";
506
+ "required": false;
507
+ "isSignal": true;
508
+ };
509
+ }, {}, never, never, true, never>;
510
+ }
511
+ /** pie fills the whole circle, donut leaves a hole with the total in it. */
512
+ export declare const PieChartVariants: readonly ["pie", "donut"];
513
+ /** @see {@link PieChartVariants} */
514
+ export type PieChartVariant = typeof PieChartVariants[number];
432
515
  /** Native type values ui-input supports. File/checkbox/radio/range need their own components. */
433
516
  export declare const InputTypes: readonly ["text", "email", "tel", "url", "search", "password", "number", "date", "time", "datetime-local", "month", "week", "color"];
434
517
  /** @see {@link InputTypes} */
@@ -676,7 +759,7 @@ export declare class UiInputComponent<ValueType = string> {
676
759
  readonly name: import("@angular/core").InputSignal<string>;
677
760
  readonly placeholder: import("@angular/core").InputSignal<string>;
678
761
  readonly autocomplete: import("@angular/core").InputSignal<string>;
679
- readonly inputmode: import("@angular/core").InputSignal<"" | "none" | "text" | "search" | "numeric" | "email" | "tel" | "url" | "decimal">;
762
+ readonly inputmode: import("@angular/core").InputSignal<"" | "none" | "text" | "search" | "numeric" | "decimal" | "email" | "tel" | "url">;
680
763
  readonly required: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
681
764
  readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
682
765
  readonly readonly: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
@@ -953,6 +1036,10 @@ export interface UiOverlayOptions {
953
1036
  offset: number;
954
1037
  viewportPadding: number;
955
1038
  }
1039
+ export interface UiOverlayStackEntry {
1040
+ onDocumentClick: (event: MouseEvent) => void;
1041
+ onKeyDown: (event: KeyboardEvent) => void;
1042
+ }
956
1043
  export interface SelectDataSourceParameters {
957
1044
  query: string;
958
1045
  page: number;
@@ -1424,7 +1511,7 @@ export type BadgeSize = typeof BadgeSizes[number];
1424
1511
  * A general-purpose button.
1425
1512
  */
1426
1513
  export declare class UiButtonComponent {
1427
- readonly appearance: import("@angular/core").InputSignal<"solid" | "none" | "link" | "outline" | "ghost" | "white">;
1514
+ readonly appearance: import("@angular/core").InputSignal<"none" | "solid" | "link" | "outline" | "ghost" | "white">;
1428
1515
  readonly intent: import("@angular/core").InputSignal<"none" | "primary" | "secondary" | "success" | "warning" | "danger">;
1429
1516
  readonly size: import("@angular/core").InputSignal<"sm" | "md" | "lg">;
1430
1517
  readonly classes: import("@angular/core").InputSignal<string>;
@@ -1722,6 +1809,7 @@ export declare class UiKpiComponent {
1722
1809
  readonly value: import("@angular/core").InputSignal<string>;
1723
1810
  readonly hint: import("@angular/core").InputSignal<string>;
1724
1811
  readonly icon: import("@angular/core").InputSignal<string | undefined>;
1812
+ readonly iconPosition: import("@angular/core").InputSignal<"right" | "left">;
1725
1813
  static ɵfac: i0.ɵɵFactoryDeclaration<UiKpiComponent, never>;
1726
1814
  static ɵcmp: i0.ɵɵComponentDeclaration<UiKpiComponent, "ui-kpi", never, {
1727
1815
  "title": {
@@ -1744,6 +1832,11 @@ export declare class UiKpiComponent {
1744
1832
  "required": false;
1745
1833
  "isSignal": true;
1746
1834
  };
1835
+ "iconPosition": {
1836
+ "alias": "iconPosition";
1837
+ "required": false;
1838
+ "isSignal": true;
1839
+ };
1747
1840
  }, {}, never, ["[kpi-value]", "[kpi-badge]"], true, never>;
1748
1841
  }
1749
1842
  export declare class UiLoadingComponent {
@@ -1761,10 +1854,12 @@ export declare class UiLoadingComponent {
1761
1854
  }
1762
1855
  export declare const UI_LOADING_TYPES: ["spinner", "throbber", "pulse-ring", "pulse-dot", "wave", "equaliser", "terminal", "blinking-caret", "shimmer-text", "loading-dots", "bouncing-dots", "fading-dots"];
1763
1856
  export type UiLoadingType = typeof UI_LOADING_TYPES[number];
1857
+ type ModalSize = 'sm' | 'md' | 'lg';
1764
1858
  export declare class UiModalComponent {
1765
1859
  readonly isOpen: import("@angular/core").ModelSignal<boolean>;
1766
1860
  readonly closeBehaviour: import("@angular/core").InputSignal<UiOverlayCloseBehaviour>;
1767
1861
  readonly title: import("@angular/core").InputSignal<string>;
1862
+ readonly size: import("@angular/core").InputSignal<ModalSize>;
1768
1863
  readonly classes: import("@angular/core").InputSignal<string>;
1769
1864
  readonly headerElement: import("@angular/core").Signal<TemplateRef<unknown> | undefined>;
1770
1865
  readonly footerElement: import("@angular/core").Signal<TemplateRef<unknown> | undefined>;
@@ -1787,6 +1882,11 @@ export declare class UiModalComponent {
1787
1882
  "required": false;
1788
1883
  "isSignal": true;
1789
1884
  };
1885
+ "size": {
1886
+ "alias": "size";
1887
+ "required": false;
1888
+ "isSignal": true;
1889
+ };
1790
1890
  "classes": {
1791
1891
  "alias": "classes";
1792
1892
  "required": false;
@@ -1940,7 +2040,7 @@ export declare class UiProgressComponent {
1940
2040
  readonly shape: import("@angular/core").InputSignal<"square" | "straight" | "rounded">;
1941
2041
  readonly orientation: import("@angular/core").InputSignal<"vertical" | "horizontal">;
1942
2042
  readonly title: import("@angular/core").InputSignal<string>;
1943
- readonly labelPosition: import("@angular/core").InputSignal<"top" | "none" | "end" | "floating" | "inside">;
2043
+ readonly labelPosition: import("@angular/core").InputSignal<"none" | "top" | "end" | "floating" | "inside">;
1944
2044
  readonly labelWith: import("@angular/core").InputSignal<(value: number, max: number) => string>;
1945
2045
  /** Splits the bar into this many blocks. */
1946
2046
  readonly steps: import("@angular/core").InputSignal<number | null>;
@@ -2531,8 +2631,9 @@ export declare class UiLayoutComponent {
2531
2631
  static ɵfac: i0.ɵɵFactoryDeclaration<UiLayoutComponent, never>;
2532
2632
  static ɵcmp: i0.ɵɵComponentDeclaration<UiLayoutComponent, "ui-layout", never, {}, {}, ["sidebar"], ["*"], true, never>;
2533
2633
  }
2534
- export declare class UiOverlayComponent {
2634
+ export declare class UiOverlayComponent implements UiOverlayStackEntry {
2535
2635
  private readonly positioner;
2636
+ private readonly stack;
2536
2637
  readonly content: import("@angular/core").InputSignal<ElementRef<HTMLInputElement> | undefined>;
2537
2638
  readonly anchor: import("@angular/core").InputSignal<ElementRef<HTMLElement> | undefined>;
2538
2639
  readonly closeBehaviour: import("@angular/core").InputSignal<UiOverlayCloseBehaviour>;
@@ -2544,8 +2645,8 @@ export declare class UiOverlayComponent {
2544
2645
  readonly matchWidth: import("@angular/core").InputSignal<DropdownMatchWidth | null>;
2545
2646
  constructor();
2546
2647
  private readonly close;
2547
- private onDocumentClick;
2548
- private onKeyDown;
2648
+ readonly onDocumentClick: (event: MouseEvent) => void;
2649
+ readonly onKeyDown: (event: KeyboardEvent) => void;
2549
2650
  static ɵfac: i0.ɵɵFactoryDeclaration<UiOverlayComponent, never>;
2550
2651
  static ɵcmp: i0.ɵɵComponentDeclaration<UiOverlayComponent, "ui-overlay", ["uiOverlay"], {
2551
2652
  "content": {
@@ -2946,7 +3047,7 @@ export declare class UiDatepickerComponent {
2946
3047
  }
2947
3048
  export declare class UiDropdownButtonComponent {
2948
3049
  readonly intent: import("@angular/core").InputSignal<"none" | "primary" | "secondary" | "success" | "warning" | "danger">;
2949
- readonly appearance: import("@angular/core").InputSignal<"solid" | "none" | "link" | "outline" | "ghost" | "white">;
3050
+ readonly appearance: import("@angular/core").InputSignal<"none" | "solid" | "link" | "outline" | "ghost" | "white">;
2950
3051
  readonly icon: import("@angular/core").InputSignal<string>;
2951
3052
  readonly isOpen: import("@angular/core").ModelSignal<boolean>;
2952
3053
  static ɵfac: i0.ɵɵFactoryDeclaration<UiDropdownButtonComponent, never>;