@lifecorner/angular-ui-kit 3.17.0 → 3.19.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.
@@ -1,4 +1,5 @@
1
1
  import { compile } from 'sass';
2
+ import { readFileSync } from 'fs';
2
3
  import { resolve } from 'path';
3
4
 
4
5
  /**
@@ -359,3 +360,71 @@ describe('Component pairings of 3.17 (request 021)', () => {
359
360
  });
360
361
  });
361
362
  });
363
+
364
+ // Request 024 (3.19): the lc-menu danger item (020 review S2: --color-error was
365
+ // 2.06:1 on the dark menu) and the restyled lc-table pager. The token names
366
+ // come from the compiled stylesheets, the values from the themes.
367
+ describe('Component pairings of 3.19 (request 024)', () => {
368
+ const menuScss = readFileSync(resolve(__dirname, '../lib/menu/menu.component.scss'), 'utf8');
369
+ const menuCss = compile(resolve(__dirname, '../lib/menu/menu.component.scss')).css;
370
+ const tableCss = compile(resolve(__dirname, '../lib/table/table.component.scss')).css;
371
+ const body = (css: string, selector: string) => {
372
+ const at = css.indexOf(`\n${selector} {`);
373
+ expect(at).toBeGreaterThan(-1);
374
+ return css.slice(at, css.indexOf('}', at));
375
+ };
376
+
377
+ it('AC-8: the danger item reads --color-text-error, its hover --color-error-subtle; no raw colour', () => {
378
+ expect(body(menuCss, '.lc-menu__item--danger')).toMatch(/\scolor: var\(--color-text-error\);/);
379
+ expect(body(menuCss, '.lc-menu__item--danger:hover:not(.lc-menu__item--disabled)')).toMatch(
380
+ /background-color: var\(--color-error-subtle\);/,
381
+ );
382
+ expect(menuCss).not.toMatch(/--danger--disabled/);
383
+ expect(menuScss).not.toMatch(/rgba\(|#[0-9a-f]{3,8}\b/i);
384
+ });
385
+
386
+ it('AC-4: the pager reads the field border, the second surface and the kit ring', () => {
387
+ const btn = body(tableCss, '.lc-table-pagination__btn');
388
+ expect(btn).toMatch(/border: 1px solid var\(--color-field-border\);/);
389
+ expect(btn).toMatch(/background-color: var\(--color-surface-2\);/);
390
+ expect(btn).toMatch(/\scolor: var\(--color-text-primary\);/);
391
+ expect(body(tableCss, '.lc-table-pagination__btn:focus-visible')).toMatch(/outline: 2px solid var\(--color-primary-500\);/);
392
+ });
393
+
394
+ /** Design 024 §5, per palette [light, dark]: the minimum over both panel ends. */
395
+ const expected = { dangerRest: [12.05, 7.21], dangerHover: [10.98, 7.21], dangerFocus: [11.44, 6.37] };
396
+
397
+ describe.each(palettes.map(([name, tokens], i) => [name, tokens, i] as const))('%s palette', (_palette, tokens, i) => {
398
+ const page = color(tokens, '--color-background');
399
+ /** A token over `base` (translucent ones composited), on the opaque page. */
400
+ const on = (name: string, base: Rgba = page) => over(color(tokens, name), base);
401
+ /** The menu panel's ends: --color-surface and --color-surface-2 (its gradient runs between them). */
402
+ const panels = [on('--color-surface'), on('--color-surface-2', on('--color-surface'))];
403
+ const ink = (fill: Rgba) => ratio(on('--color-text-error', fill), fill);
404
+
405
+ it('AC-8: danger text at rest, on hover and on focus reaches 4.5:1 on the menu', () => {
406
+ const rest = Math.min(...panels.map(ink));
407
+ const hover = Math.min(...panels.map((p) => ink(on('--color-error-subtle', p))));
408
+ const focus = Math.min(...panels.map((p) => ink(on('--color-surface-hover', p))));
409
+ expect(rest).toBeCloseTo(expected.dangerRest[i], 2);
410
+ expect(hover).toBeCloseTo(expected.dangerHover[i], 2);
411
+ expect(focus).toBeCloseTo(expected.dangerFocus[i], 2);
412
+ expect(Math.min(rest, hover, focus)).toBeGreaterThanOrEqual(4.5);
413
+ });
414
+
415
+ it('AC-8: the focus ring (--color-primary-500) reaches 3:1 on the focused danger item', () => {
416
+ for (const p of panels) {
417
+ const fill = on('--color-surface-hover', p);
418
+ expect(ratio(on('--color-primary-500', fill), fill)).toBeGreaterThanOrEqual(3);
419
+ }
420
+ });
421
+
422
+ it.each(['--color-background', '--color-surface'])('AC-4: pager border 3:1, ring 3:1 and glyph 4.5:1 on %s', (ground) => {
423
+ const g = on(ground);
424
+ expect(ratio(on('--color-field-border', g), g)).toBeGreaterThanOrEqual(3);
425
+ expect(ratio(on('--color-primary-500', g), g)).toBeGreaterThanOrEqual(3);
426
+ const fill = on('--color-surface-2', g);
427
+ expect(ratio(on('--color-text-primary', fill), fill)).toBeGreaterThanOrEqual(4.5);
428
+ });
429
+ });
430
+ });
@@ -47,6 +47,8 @@ interface BottomNavEntry {
47
47
  * - More than `maxItems` destinations: the first `maxItems − 1` stay, the
48
48
  * rest move behind a "More" entry (`moreLabel`, `moreIcon`, `moreRoute`);
49
49
  * without `moreRoute` the entry is a button that emits `moreClick`.
50
+ * - `showMore`: "More" on request, also when every destination fits (fixed
51
+ * slots); it takes one of the `maxItems` entries.
50
52
  * - Tapping the current item emits `reselect` (scroll the page to the top).
51
53
  * - `variant="floating"`: an inset pill 16 px from the sides and 16 px above
52
54
  * the safe-area inset, radius 28 px, elevated. `docked` (default) spans the
@@ -89,17 +91,41 @@ export declare class BottomNavComponent {
89
91
  */
90
92
  readonly fixed: import("@angular/core").InputSignal<boolean>;
91
93
  /**
92
- * Most entries the bar shows. With more destinations the first
93
- * `maxItems − 1` stay and the rest go behind the "More" entry.
94
+ * Most entries the bar shows, "More" included. With more destinations, or
95
+ * with `showMore`, the first `maxItems − 1` stay and the rest go behind the
96
+ * "More" entry.
97
+ *
98
+ * @default 5
94
99
  */
95
100
  readonly maxItems: import("@angular/core").InputSignal<number>;
96
- /** Label of the overflow entry. */
101
+ /**
102
+ * Always end the bar with the "More" entry (`moreLabel`, `moreIcon`, and
103
+ * `moreRoute` or `moreClick`), even when every destination fits: for a bar
104
+ * with fixed slots, such as two destinations plus "More". "More" takes one
105
+ * of the `maxItems` entries, so the first `maxItems − 1` destinations stay
106
+ * and any others move behind it, as on overflow.
107
+ *
108
+ * @default false
109
+ */
110
+ readonly showMore: import("@angular/core").InputSignal<boolean>;
111
+ /**
112
+ * Label of the "More" entry (on overflow or with `showMore`).
113
+ *
114
+ * @default 'More'
115
+ */
97
116
  readonly moreLabel: import("@angular/core").InputSignal<string>;
98
- /** Icon of the overflow entry. */
117
+ /**
118
+ * Icon of the "More" entry (on overflow or with `showMore`).
119
+ *
120
+ * @default 'dots'
121
+ */
99
122
  readonly moreIcon: import("@angular/core").InputSignal<string>;
100
123
  /**
101
- * Route of the overflow entry (a page that lists the remaining
102
- * destinations). Empty renders the entry as a button that emits `moreClick`.
124
+ * Route of the "More" entry (on overflow or with `showMore`): a page that
125
+ * lists the remaining destinations. Empty renders the entry as a button that
126
+ * emits `moreClick`.
127
+ *
128
+ * @default ''
103
129
  */
104
130
  readonly moreRoute: import("@angular/core").InputSignal<string>;
105
131
  /**
@@ -109,13 +135,16 @@ export declare class BottomNavComponent {
109
135
  readonly badgeAriaLabel: import("@angular/core").InputSignal<string>;
110
136
  /** The current item was tapped again (e.g. scroll the page to the top). */
111
137
  readonly reselect: import("@angular/core").OutputEmitterRef<BottomNavItem>;
112
- /** The overflow entry was tapped while it has no `moreRoute`. */
138
+ /** The "More" entry was tapped while it has no `moreRoute`. */
113
139
  readonly moreClick: import("@angular/core").OutputEmitterRef<void>;
114
140
  /** Destinations in display order. */
115
141
  private readonly sortedItems;
116
142
  /** Path of `activeRoute` without query and fragment. */
117
143
  private readonly activePath;
118
- /** Entries as rendered: destinations plus, on overflow, the "More" entry. */
144
+ /**
145
+ * Entries as rendered: destinations plus, on overflow or with `showMore`,
146
+ * the "More" entry, which then takes one of the `maxItems` entries.
147
+ */
119
148
  protected readonly entries: import("@angular/core").Signal<BottomNavEntry[]>;
120
149
  protected readonly navClasses: import("@angular/core").Signal<string>;
121
150
  /** Visually hidden badge text for screen readers. */
@@ -156,6 +185,11 @@ export declare class BottomNavComponent {
156
185
  "required": false;
157
186
  "isSignal": true;
158
187
  };
188
+ "showMore": {
189
+ "alias": "showMore";
190
+ "required": false;
191
+ "isSignal": true;
192
+ };
159
193
  "moreLabel": {
160
194
  "alias": "moreLabel";
161
195
  "required": false;
@@ -39,8 +39,8 @@ export interface TableColumn {
39
39
  cssClass?: string;
40
40
  /**
41
41
  * Optional CSS class(es) for td cells only (string or resolver callback).
42
- * A class colour or font size loses to the kit's cell rule; set them with
43
- * `cellStyle`.
42
+ * Since 3.19 a class colour or font size wins over the kit's cell defaults;
43
+ * `cellStyle` still wins over the class.
44
44
  */
45
45
  cellClass?: TableCellClass;
46
46
  /** Optional inline styles for td cells only (object or resolver callback) */
@@ -274,6 +274,12 @@ export declare class TableComponent {
274
274
  pageSize: import("@angular/core").InputSignal<number>;
275
275
  /** Available page size options */
276
276
  pageSizeOptions: import("@angular/core").InputSignal<number[]>;
277
+ /**
278
+ * Pagination: the text after the number in each page-size option
279
+ * (`10 / page`). German: `'/ Seite'`. (3.19)
280
+ * @default '/ page'
281
+ */
282
+ pageSizeLabel: import("@angular/core").InputSignal<string>;
277
283
  /** Enable row selection checkboxes */
278
284
  selectable: import("@angular/core").InputSignal<boolean>;
279
285
  /** Enable per-column text filters */
@@ -418,6 +424,11 @@ export declare class TableComponent {
418
424
  value: number;
419
425
  label: string;
420
426
  }[]>;
427
+ /**
428
+ * Size of the pagination controls: the page-size select's `size` and the
429
+ * `lc-table-pagination--<size>` class that sizes prev/next to match it.
430
+ */
431
+ protected readonly paginationSize: import("@angular/core").Signal<TableSize>;
421
432
  /**
422
433
  * Computed CSS classes for the table element
423
434
  */
@@ -608,6 +619,11 @@ export declare class TableComponent {
608
619
  "required": false;
609
620
  "isSignal": true;
610
621
  };
622
+ "pageSizeLabel": {
623
+ "alias": "pageSizeLabel";
624
+ "required": false;
625
+ "isSignal": true;
626
+ };
611
627
  "selectable": {
612
628
  "alias": "selectable";
613
629
  "required": false;