@eagami/ui 5.51.0 → 5.52.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eagami/ui",
3
- "version": "5.51.0",
3
+ "version": "5.52.0",
4
4
  "description": "Lightweight, accessible, themeable Angular UI component library and icon set built on CSS custom properties",
5
5
  "author": "Michal Wiraszka <michal@eagami.com>",
6
6
  "license": "MIT",
@@ -621,6 +621,8 @@ export declare class AccordionItemComponent implements OnInit, OnDestroy {
621
621
  private readonly accordion;
622
622
  readonly value: import("@angular/core").InputSignal<string>;
623
623
  readonly label: import("@angular/core").InputSignal<string>;
624
+ /** Optional icon component rendered before the label in the header button. */
625
+ readonly icon: import("@angular/core").InputSignal<Type<unknown> | undefined>;
624
626
  readonly disabled: import("@angular/core").InputSignal<boolean>;
625
627
  readonly id: import("@angular/core").InputSignal<string>;
626
628
  readonly isExpanded: import("@angular/core").Signal<boolean>;
@@ -641,6 +643,11 @@ export declare class AccordionItemComponent implements OnInit, OnDestroy {
641
643
  "required": true;
642
644
  "isSignal": true;
643
645
  };
646
+ "icon": {
647
+ "alias": "icon";
648
+ "required": false;
649
+ "isSignal": true;
650
+ };
644
651
  "disabled": {
645
652
  "alias": "disabled";
646
653
  "required": false;
@@ -1338,6 +1345,37 @@ declare function injectChartViewport(size: Signal<ChartSize>): ChartViewport;
1338
1345
  declare function injectChartFormatter(formatValue: Signal<((value: number) => string) | null>): Signal<(value: number) => string>;
1339
1346
  /** Keeps a value inside `[min, max]`. */
1340
1347
  declare function clamp(value: number, min: number, max: number): number;
1348
+ /**
1349
+ * How category or x-axis labels are set: level, at 45 degrees, at 90 degrees, or
1350
+ * `auto`, which stays level while the labels fit and turns them 45 then 90 degrees
1351
+ * as they crowd.
1352
+ */
1353
+ type ChartLabelOrientation = 'horizontal' | 'diagonal' | 'vertical' | 'auto';
1354
+ declare const CHART_LABEL_ANGLES: Record<Exclude<ChartLabelOrientation, 'auto'>, number>;
1355
+ declare const TICK_EXTRA_PX = 2;
1356
+ declare const TICK_LABEL_GAP_PX = 2;
1357
+ declare const BREAK_CLEARANCE = 6;
1358
+ declare const BREAK_HEIGHT = 2.5;
1359
+ /** Length of a tick mark below the axis. */
1360
+ declare function tickLength(axisPx: number): number;
1361
+ /** Room along the axis a label needs: its width when level, a line's height when turned. */
1362
+ declare function labelRoom(text: string, angle: number, axisPx: number): number;
1363
+ /** Space below the plot for the axis labels, turned to `angle` degrees, and their ticks. */
1364
+ declare function labelBand(widest: number, angle: number, axisPx: number, height: number): number;
1365
+ /** Baseline of the axis labels below an axis at `axisY`. */
1366
+ declare function labelLine(axisY: number, angle: number, axisPx: number): number;
1367
+ interface AxisBreak {
1368
+ axis: string;
1369
+ slashes: string;
1370
+ gap: {
1371
+ x: number;
1372
+ y: number;
1373
+ width: number;
1374
+ height: number;
1375
+ };
1376
+ }
1377
+ /** A y-axis line up the plot's left edge, cut where two parallel slashes cross it. */
1378
+ declare function axisBreak(x: number, top: number, bottom: number, y: number, axisPx: number): AxisBreak;
1341
1379
  /** Direction the bars extend from the baseline. */
1342
1380
  export type BarChartOrientation = 'vertical' | 'horizontal';
1343
1381
  /**
@@ -1387,6 +1425,13 @@ export declare class BarChartComponent {
1387
1425
  readonly showLegend: import("@angular/core").InputSignal<boolean>;
1388
1426
  /** Prints each bar's value at its end, or each stack's total when stacked. */
1389
1427
  readonly showValues: import("@angular/core").InputSignal<boolean>;
1428
+ /** How the category labels under a vertical chart are set; `auto` turns them as they run out of room. */
1429
+ readonly xLabelOrientation: import("@angular/core").InputSignal<ChartLabelOrientation>;
1430
+ /**
1431
+ * Starts the value axis of a vertical chart near its shortest bar instead of at
1432
+ * zero, when every value is positive, and marks the cut with a break symbol.
1433
+ */
1434
+ readonly showAxisBreak: import("@angular/core").InputSignal<boolean>;
1390
1435
  /** Height of the plot in pixels; the width fills the container. */
1391
1436
  readonly height: import("@angular/core").InputSignal<number>;
1392
1437
  /** Visual size; scales the axis, legend, and tooltip text and the bar thickness cap. */
@@ -1440,6 +1485,11 @@ export declare class BarChartComponent {
1440
1485
  bars: PlotBar[];
1441
1486
  valueLabels: PlotValueLabel[];
1442
1487
  valuePos: (v: number) => number;
1488
+ axisY: number;
1489
+ tickEndY: number;
1490
+ labelAngle: number;
1491
+ labelY: number;
1492
+ axisBreak: AxisBreak | null;
1443
1493
  }>;
1444
1494
  protected readonly tooltip: import("@angular/core").Signal<{
1445
1495
  x: number;
@@ -1518,6 +1568,16 @@ export declare class BarChartComponent {
1518
1568
  "required": false;
1519
1569
  "isSignal": true;
1520
1570
  };
1571
+ "xLabelOrientation": {
1572
+ "alias": "xLabelOrientation";
1573
+ "required": false;
1574
+ "isSignal": true;
1575
+ };
1576
+ "showAxisBreak": {
1577
+ "alias": "showAxisBreak";
1578
+ "required": false;
1579
+ "isSignal": true;
1580
+ };
1521
1581
  "height": {
1522
1582
  "alias": "height";
1523
1583
  "required": false;
@@ -4281,6 +4341,16 @@ export type LineChartCurve = 'linear' | 'smooth' | 'step';
4281
4341
  * right, `fade` fades the plot in, and `rise` grows it up from the baseline.
4282
4342
  */
4283
4343
  export type LineChartAnimation = 'draw' | 'reveal' | 'fade' | 'rise' | 'none';
4344
+ /** A labelled mark along the x-axis, placed on the same scale as `xValues`. */
4345
+ export interface LineChartTick {
4346
+ value: number;
4347
+ label: string;
4348
+ }
4349
+ /** The stretch of the x scale a windowed line chart currently shows. */
4350
+ export interface LineChartVisibleRange {
4351
+ start: number;
4352
+ end: number;
4353
+ }
4284
4354
  interface PlotPoint {
4285
4355
  x: number;
4286
4356
  y: number;
@@ -4298,18 +4368,61 @@ interface ActivePoint {
4298
4368
  series: number;
4299
4369
  index: number;
4300
4370
  }
4371
+ interface XLabel {
4372
+ key: number;
4373
+ text: string;
4374
+ x: number;
4375
+ }
4376
+ interface PlacedXLabel extends XLabel {
4377
+ textX: number;
4378
+ }
4379
+ interface XDomain {
4380
+ /** First and last positions on the x scale. */
4381
+ first: number;
4382
+ last: number;
4383
+ /** Positions at the plot's left and right edges. */
4384
+ start: number;
4385
+ end: number;
4386
+ /** Width of the visible window, set only when the data outgrows it. */
4387
+ span: number | null;
4388
+ }
4301
4389
  /**
4302
- * Plots one or more series of values across shared labels as lines, with
4303
- * optional points and area fills. Hovering or arrowing through the chart
4304
- * reveals each label's values in a tooltip, and a visually hidden table
4305
- * carries the full data for screen readers.
4390
+ * Plots one or more series of values as lines, with optional points and area
4391
+ * fills. Points are spaced evenly by default, or placed along a numeric scale
4392
+ * by `xValues`, with the x-axis labelled per point or by `xTicks`. A
4393
+ * `visibleXSpan` window makes a long run of data pannable. Hovering or
4394
+ * arrowing through the chart reveals each point's values in a tooltip, and a
4395
+ * visually hidden table carries the full data for screen readers.
4306
4396
  */
4307
4397
  export declare class LineChartComponent {
4308
4398
  protected readonly i18n: EagamiI18nService;
4309
- /** Category labels along the x-axis, one per value. */
4399
+ /**
4400
+ * Each point's name, one per value, titling its tooltip and its row in the
4401
+ * data table. Also labels the x-axis, unless `xTicks` is set.
4402
+ */
4310
4403
  readonly labels: import("@angular/core").InputSignal<string[]>;
4311
4404
  /** The series to plot. */
4312
4405
  readonly series: import("@angular/core").InputSignal<ChartSeries[]>;
4406
+ /**
4407
+ * Position of each point along the x-axis, one per value in ascending
4408
+ * order, so points sit proportionally apart. Spaced evenly by index when
4409
+ * unset.
4410
+ */
4411
+ readonly xValues: import("@angular/core").InputSignal<readonly number[] | null>;
4412
+ /**
4413
+ * Marks drawn along the x-axis in place of the per-point labels, each at its
4414
+ * value on the x scale (`xValues`, or the index when unset). They need not
4415
+ * line up with any point, and the axis widens to take in any beyond the points.
4416
+ */
4417
+ readonly xTicks: import("@angular/core").InputSignal<readonly LineChartTick[] | null>;
4418
+ /**
4419
+ * Width of the x range shown at once, in the units of `xValues` (or of
4420
+ * indices when unset). When the data spans more, the chart opens on its
4421
+ * latest stretch and pans by trackpad, Shift + wheel, drag, or the arrow
4422
+ * keys, and a trackpad pinch or Ctrl + wheel widens or narrows the window,
4423
+ * fitting the y-axis to the points in view. `null` shows everything.
4424
+ */
4425
+ readonly visibleXSpan: import("@angular/core").InputSignal<number | null>;
4313
4426
  /** How the line bends between points. */
4314
4427
  readonly curve: import("@angular/core").InputSignal<LineChartCurve>;
4315
4428
  /** Fills the area beneath each line with a light wash of its color. */
@@ -4324,6 +4437,10 @@ export declare class LineChartComponent {
4324
4437
  readonly yMin: import("@angular/core").InputSignal<number | undefined>;
4325
4438
  /** Upper bound of the y-axis; derived from the data when unset. */
4326
4439
  readonly yMax: import("@angular/core").InputSignal<number | undefined>;
4440
+ /** How the x-axis labels are set; `auto` turns them as they run out of room. */
4441
+ readonly xLabelOrientation: import("@angular/core").InputSignal<ChartLabelOrientation>;
4442
+ /** Marks the foot of a y-axis that stops short of zero with a break symbol. */
4443
+ readonly showAxisBreak: import("@angular/core").InputSignal<boolean>;
4327
4444
  /** Height of the plot in pixels; the width fills the container. */
4328
4445
  readonly height: import("@angular/core").InputSignal<number>;
4329
4446
  /** Visual size; scales the axis, legend, and tooltip text. */
@@ -4340,16 +4457,33 @@ export declare class LineChartComponent {
4340
4457
  readonly pointClick: import("@angular/core").OutputEmitterRef<ChartPointEvent>;
4341
4458
  /** Fires when the highlighted point changes by pointer or keyboard, with `null` once cleared. */
4342
4459
  readonly activePointChange: import("@angular/core").OutputEmitterRef<ChartPointEvent | null>;
4460
+ /** Fires with the newly visible x range whenever a windowed chart pans or zooms. */
4461
+ readonly visibleRangeChange: import("@angular/core").OutputEmitterRef<LineChartVisibleRange>;
4343
4462
  private readonly viewport;
4344
4463
  private readonly format;
4345
4464
  protected readonly active: import("@angular/core").WritableSignal<ActivePoint | null>;
4465
+ protected readonly clipId: string;
4466
+ protected readonly breakMaskId: string;
4467
+ private readonly panEnd;
4468
+ private readonly zoomSpan;
4469
+ private gestureSpan;
4470
+ protected readonly panning: import("@angular/core").WritableSignal<boolean>;
4471
+ private drag;
4472
+ private suppressClick;
4346
4473
  protected readonly label: import("@angular/core").Signal<string>;
4347
4474
  protected readonly count: import("@angular/core").Signal<number>;
4348
4475
  protected readonly hasData: import("@angular/core").Signal<boolean>;
4476
+ private readonly positions;
4477
+ protected readonly domain: import("@angular/core").Signal<XDomain>;
4478
+ protected readonly windowed: import("@angular/core").Signal<boolean>;
4349
4479
  protected readonly renderPass: import("@angular/core").Signal<{}[]>;
4350
4480
  protected readonly hostClasses: import("@angular/core").Signal<{
4351
4481
  [x: string]: boolean;
4482
+ 'ea-line-chart--pannable': boolean;
4483
+ 'ea-line-chart--panning': boolean;
4352
4484
  }>;
4485
+ private readonly runs;
4486
+ private readonly visibleValues;
4353
4487
  protected readonly layout: import("@angular/core").Signal<{
4354
4488
  width: number;
4355
4489
  height: number;
@@ -4358,6 +4492,11 @@ export declare class LineChartComponent {
4358
4492
  plotWidth: number;
4359
4493
  plotHeight: number;
4360
4494
  baselineY: number;
4495
+ windowed: boolean;
4496
+ axisBreak: AxisBreak | null;
4497
+ axisY: number;
4498
+ tickEndY: number;
4499
+ labelAngle: number;
4361
4500
  labelY: number;
4362
4501
  tickX: number;
4363
4502
  ticks: {
@@ -4365,15 +4504,12 @@ export declare class LineChartComponent {
4365
4504
  value: number;
4366
4505
  text: string;
4367
4506
  }[];
4368
- xLabels: {
4369
- text: string;
4370
- index: number;
4371
- x: number;
4372
- }[];
4507
+ xLabels: PlacedXLabel[];
4373
4508
  series: PlotSeries[];
4374
4509
  x: (i: number) => number;
4375
4510
  y: (v: number) => number;
4376
4511
  }>;
4512
+ private plotArea;
4377
4513
  protected readonly tooltip: import("@angular/core").Signal<{
4378
4514
  x: number;
4379
4515
  y: number;
@@ -4404,12 +4540,32 @@ export declare class LineChartComponent {
4404
4540
  protected isDimmed(index: number): boolean;
4405
4541
  protected isActivePoint(seriesIndex: number, index: number): boolean;
4406
4542
  protected tableValue(value: number | null | undefined): string;
4543
+ protected onPointerDown(event: PointerEvent): void;
4407
4544
  protected onPointerMove(event: PointerEvent): void;
4545
+ protected onPointerUp(event: PointerEvent): void;
4408
4546
  protected onPointerLeave(): void;
4547
+ protected onWheel(event: WheelEvent): void;
4409
4548
  protected onClick(): void;
4410
4549
  protected onFocus(): void;
4411
4550
  protected onBlur(): void;
4412
4551
  protected onKeydown(event: KeyboardEvent): void;
4552
+ private isValue;
4553
+ private yScale;
4554
+ private atPosition;
4555
+ private xLabelCandidates;
4556
+ private labelsFit;
4557
+ private xLabels;
4558
+ private widestXLabel;
4559
+ protected onGestureStart(event: Event): void;
4560
+ protected onGestureChange(event: Event): void;
4561
+ protected onGestureEnd(): void;
4562
+ private zoomTo;
4563
+ private minSpan;
4564
+ private unitsPerPx;
4565
+ private panTo;
4566
+ private endDrag;
4567
+ private reveal;
4568
+ private indexAt;
4413
4569
  private valueAt;
4414
4570
  private firstPoint;
4415
4571
  private nearestValid;
@@ -4427,6 +4583,21 @@ export declare class LineChartComponent {
4427
4583
  "required": false;
4428
4584
  "isSignal": true;
4429
4585
  };
4586
+ "xValues": {
4587
+ "alias": "xValues";
4588
+ "required": false;
4589
+ "isSignal": true;
4590
+ };
4591
+ "xTicks": {
4592
+ "alias": "xTicks";
4593
+ "required": false;
4594
+ "isSignal": true;
4595
+ };
4596
+ "visibleXSpan": {
4597
+ "alias": "visibleXSpan";
4598
+ "required": false;
4599
+ "isSignal": true;
4600
+ };
4430
4601
  "curve": {
4431
4602
  "alias": "curve";
4432
4603
  "required": false;
@@ -4462,6 +4633,16 @@ export declare class LineChartComponent {
4462
4633
  "required": false;
4463
4634
  "isSignal": true;
4464
4635
  };
4636
+ "xLabelOrientation": {
4637
+ "alias": "xLabelOrientation";
4638
+ "required": false;
4639
+ "isSignal": true;
4640
+ };
4641
+ "showAxisBreak": {
4642
+ "alias": "showAxisBreak";
4643
+ "required": false;
4644
+ "isSignal": true;
4645
+ };
4465
4646
  "height": {
4466
4647
  "alias": "height";
4467
4648
  "required": false;
@@ -4495,6 +4676,7 @@ export declare class LineChartComponent {
4495
4676
  }, {
4496
4677
  "pointClick": "pointClick";
4497
4678
  "activePointChange": "activePointChange";
4679
+ "visibleRangeChange": "visibleRangeChange";
4498
4680
  }, never, never, true, never>;
4499
4681
  }
4500
4682
  /** Placement of the menu list relative to its trigger. */
@@ -12058,4 +12240,4 @@ export declare class ZoomOutIconComponent extends IconComponentBase {
12058
12240
  static ɵfac: i0.ɵɵFactoryDeclaration<ZoomOutIconComponent, never>;
12059
12241
  static ɵcmp: i0.ɵɵComponentDeclaration<ZoomOutIconComponent, "ea-icon-zoom-out", never, {}, {}, never, never, true, never>;
12060
12242
  }
12061
- export type { ChartPointEvent, ChartSeries, ChartSize, EaErrorMessages, EaValidationErrorKey };
12243
+ export type { ChartLabelOrientation, ChartPointEvent, ChartSeries, ChartSize, EaErrorMessages, EaValidationErrorKey };