@thalassic/ui 22.5.0 → 22.6.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": "@thalassic/ui",
3
- "version": "22.5.0",
3
+ "version": "22.6.0",
4
4
  "license": "MIT",
5
5
  "peerDependencies": {
6
6
  "@angular/aria": "^22.0.0",
@@ -35,6 +35,10 @@
35
35
  "./charts": {
36
36
  "types": "./types/thalassic-ui-charts.d.ts",
37
37
  "default": "./fesm2022/thalassic-ui-charts.mjs"
38
+ },
39
+ "./fontawesome": {
40
+ "types": "./types/thalassic-ui-fontawesome.d.ts",
41
+ "default": "./fesm2022/thalassic-ui-fontawesome.mjs"
38
42
  }
39
43
  },
40
44
  "type": "module",
@@ -0,0 +1,32 @@
1
+ import { EnvironmentProviders } from '@angular/core';
2
+ import { systemIcon } from '@thalassic/ui';
3
+
4
+ /**
5
+ * Structural shape of a FontAwesome `IconDefinition`, matched by its `icon`
6
+ * tuple `[width, height, ligatures, unicode, pathData]`.
7
+ */
8
+ type fontAwesomeIcon = {
9
+ icon: [number, number, unknown, unknown, string | string[]];
10
+ };
11
+
12
+ /**
13
+ * Override the library's built-in {@link systemIcon}s with FontAwesome icons.
14
+ * Each FontAwesome definition is converted to inline SVG (with
15
+ * `fill="currentColor"`, so it inherits color and box sizing like the defaults)
16
+ * and registered through `provideThalassicIcons`. Names left unset keep the
17
+ * library defaults.
18
+ *
19
+ * ```ts
20
+ * import { faXmark, faChevronDown } from '@fortawesome/free-solid-svg-icons';
21
+ * import { provideFontAwesomeIcons } from '@thalassic/ui/fontawesome';
22
+ *
23
+ * provideFontAwesomeIcons({
24
+ * close: faXmark,
25
+ * 'chevron-down': faChevronDown,
26
+ * });
27
+ * ```
28
+ */
29
+ declare function provideFontAwesomeIcons(icons: Partial<Record<systemIcon, fontAwesomeIcon>>): EnvironmentProviders;
30
+
31
+ export { provideFontAwesomeIcons };
32
+ export type { fontAwesomeIcon };
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { ModelSignal, InputSignal, WritableSignal, Signal, InputSignalWithTransform, InjectionToken, TemplateRef, OutputEmitterRef, ElementRef, OnInit, TrackByFunction, OnDestroy, EnvironmentProviders } from '@angular/core';
2
+ import { ModelSignal, InputSignal, WritableSignal, Signal, InputSignalWithTransform, InjectionToken, TemplateRef, OutputEmitterRef, ElementRef, Type, EnvironmentProviders, OnInit, TrackByFunction, OnDestroy } from '@angular/core';
3
3
  import { FormUiControl, WithOptionalFieldTree, ValidationError, FormValueControl, FormCheckboxControl, ReadonlyFieldTree } from '@angular/forms/signals';
4
4
  import { Day } from 'date-fns';
5
5
  import { Point } from '@thalassic/core';
@@ -247,7 +247,7 @@ type overlayPosition = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start'
247
247
  type size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
248
248
 
249
249
  type buttonType = 'submit' | 'reset' | 'button';
250
- type buttonVariant = 'filled' | 'outlined' | 'text' | 'elevated';
250
+ type buttonVariant = 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated';
251
251
  type buttonColor = color;
252
252
 
253
253
  declare class Alert {
@@ -273,6 +273,41 @@ declare const DEFAULT_ALERT_CONFIG: AlertConfig;
273
273
 
274
274
  declare const ALERT_CONFIG: InjectionToken<AlertConfig>;
275
275
 
276
+ type badgeColor = color;
277
+ type badgeVariant = 'filled' | 'tonal';
278
+ type badgePosition = 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
279
+
280
+ declare class Badge {
281
+ private readonly _config;
282
+ readonly value: InputSignal<string | number | undefined>;
283
+ readonly max: InputSignal<number>;
284
+ readonly color: InputSignal<badgeColor>;
285
+ readonly variant: InputSignal<badgeVariant>;
286
+ readonly position: InputSignal<badgePosition>;
287
+ readonly size: InputSignal<controlSize>;
288
+ readonly dot: InputSignalWithTransform<boolean, unknown>;
289
+ readonly showZero: InputSignalWithTransform<boolean, unknown>;
290
+ readonly hidden: InputSignalWithTransform<boolean, unknown>;
291
+ readonly ariaLabel: InputSignal<string | undefined>;
292
+ protected readonly visible: i0.Signal<boolean>;
293
+ protected readonly displayValue: i0.Signal<string>;
294
+ protected readonly decorative: i0.Signal<boolean>;
295
+ protected readonly hostClasses: i0.Signal<string[]>;
296
+ static ɵfac: i0.ɵɵFactoryDeclaration<Badge, never>;
297
+ static ɵcmp: i0.ɵɵComponentDeclaration<Badge, "tls-badge", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "dot": { "alias": "dot"; "required": false; "isSignal": true; }; "showZero": { "alias": "showZero"; "required": false; "isSignal": true; }; "hidden": { "alias": "hidden"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
298
+ }
299
+
300
+ interface BadgeConfig {
301
+ color: badgeColor;
302
+ variant: badgeVariant;
303
+ position: badgePosition;
304
+ size: controlSize;
305
+ max: number;
306
+ }
307
+ declare const DEFAULT_BADGE_CONFIG: BadgeConfig;
308
+
309
+ declare const BADGE_CONFIG: InjectionToken<BadgeConfig>;
310
+
276
311
  declare abstract class ButtonBase {
277
312
  protected _config: _thalassic_ui.ButtonConfig;
278
313
  protected APPLY_HOST_CLASSES: boolean;
@@ -568,7 +603,7 @@ declare const DEFAULT_CALENDAR_CONFIG: CalendarConfig;
568
603
  declare const CALENDAR_CONFIG: InjectionToken<CalendarConfig>;
569
604
 
570
605
  type chipColor = color;
571
- type chipVariant = 'filled' | 'outlined' | 'text';
606
+ type chipVariant = 'filled' | 'tonal' | 'outlined' | 'text';
572
607
  interface ChipContext {
573
608
  checked: boolean;
574
609
  disabled: boolean;
@@ -1443,6 +1478,8 @@ declare class Textarea extends ValueFormControl<string> {
1443
1478
 
1444
1479
  declare const TEXTAREA_CONFIG: InjectionToken<TextareaConfig>;
1445
1480
 
1481
+ type toggleGroupVariant = 'filled' | 'tonal';
1482
+
1446
1483
  declare class ToggleGroup<T, V = unknown> extends SelectionGroup<T, V> {
1447
1484
  private readonly _config;
1448
1485
  protected CLASS_NAME: string;
@@ -1450,18 +1487,20 @@ declare class ToggleGroup<T, V = unknown> extends SelectionGroup<T, V> {
1450
1487
  readonly unselectable: InputSignalWithTransform<boolean, unknown>;
1451
1488
  readonly size: InputSignal<controlSize>;
1452
1489
  readonly color: InputSignal<color>;
1490
+ readonly variant: InputSignal<toggleGroupVariant>;
1453
1491
  readonly orientation: InputSignal<orientation>;
1454
1492
  /** Whether the group stretches to fill its container's width with equal-width options. */
1455
1493
  readonly fluid: InputSignalWithTransform<boolean, unknown>;
1456
1494
  protected readonly optionTemplate: Signal<TemplateRef<selectionGroupTemplateContext<T, V>> | undefined>;
1457
1495
  protected readonly classes: Signal<string[]>;
1458
1496
  static ɵfac: i0.ɵɵFactoryDeclaration<ToggleGroup<any, any>, never>;
1459
- static ɵcmp: i0.ɵɵComponentDeclaration<ToggleGroup<any, any>, "tls-toggle-group", never, { "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "unselectable": { "alias": "unselectable"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "fluid": { "alias": "fluid"; "required": false; "isSignal": true; }; }, {}, ["optionTemplate"], never, true, never>;
1497
+ static ɵcmp: i0.ɵɵComponentDeclaration<ToggleGroup<any, any>, "tls-toggle-group", never, { "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "unselectable": { "alias": "unselectable"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "fluid": { "alias": "fluid"; "required": false; "isSignal": true; }; }, {}, ["optionTemplate"], never, true, never>;
1460
1498
  }
1461
1499
 
1462
1500
  interface ToggleGroupConfig {
1463
1501
  size: controlSize;
1464
1502
  color: color;
1503
+ variant: toggleGroupVariant;
1465
1504
  orientation: orientation;
1466
1505
  multiple: boolean;
1467
1506
  unselectable: boolean;
@@ -1471,17 +1510,32 @@ declare const DEFAULT_TOGGLE_GROUP_CONFIG: ToggleGroupConfig;
1471
1510
 
1472
1511
  declare const TOGGLE_GROUP_CONFIG: InjectionToken<ToggleGroupConfig>;
1473
1512
 
1513
+ /**
1514
+ * Semantic names for the icons the library renders internally (checkbox tick,
1515
+ * select chevron, dialog close, toast status glyphs, …). Consumers swap any of
1516
+ * them for their own kit via `provideThalassicIcons`, so this list is the icon
1517
+ * contract between the library and the app.
1518
+ */
1519
+ type systemIcon = 'check' | 'indeterminate' | 'chevron-up' | 'chevron-down' | 'chevron-left' | 'chevron-right' | 'chevrons-left' | 'chevrons-right' | 'close' | 'success' | 'warning' | 'error' | 'info';
1520
+
1474
1521
  declare class Icon {
1475
- private _iconService;
1476
- private _config;
1477
- iconSrc: InputSignal<string>;
1478
- alt: InputSignal<string>;
1479
- allowedSources: InputSignal<string[]>;
1480
- protected isSvg: Signal<boolean>;
1481
- private _svgContentResource;
1522
+ private readonly _iconService;
1523
+ private readonly _iconRegistry;
1524
+ private readonly _config;
1525
+ /** A semantic icon from the registry — overridable via `provideThalassicIcons`. */
1526
+ name: i0.InputSignal<systemIcon | undefined>;
1527
+ /** A URL to an SVG or image for arbitrary content icons. Ignored when `name` is set. */
1528
+ iconSrc: i0.InputSignal<string | undefined>;
1529
+ alt: i0.InputSignal<string>;
1530
+ allowedSources: i0.InputSignal<string[]>;
1531
+ private readonly _renderer;
1532
+ protected readonly registryComponent: Signal<Type<unknown> | null>;
1533
+ protected readonly registrySvg: Signal<SafeHtml | null>;
1534
+ protected readonly isSvgSrc: Signal<boolean>;
1535
+ private readonly _svgContentResource;
1482
1536
  get svgContent(): Signal<SafeHtml>;
1483
1537
  static ɵfac: i0.ɵɵFactoryDeclaration<Icon, never>;
1484
- static ɵcmp: i0.ɵɵComponentDeclaration<Icon, "tls-icon", never, { "iconSrc": { "alias": "iconSrc"; "required": true; "isSignal": true; }; "alt": { "alias": "alt"; "required": false; "isSignal": true; }; "allowedSources": { "alias": "allowedSources"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1538
+ static ɵcmp: i0.ɵɵComponentDeclaration<Icon, "tls-icon", never, { "name": { "alias": "name"; "required": false; "isSignal": true; }; "iconSrc": { "alias": "iconSrc"; "required": false; "isSignal": true; }; "alt": { "alias": "alt"; "required": false; "isSignal": true; }; "allowedSources": { "alias": "allowedSources"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1485
1539
  }
1486
1540
 
1487
1541
  interface IconConfig {
@@ -1491,6 +1545,72 @@ declare const DEFAULT_ICON_CONFIG: IconConfig;
1491
1545
 
1492
1546
  declare const ICON_CONFIG: InjectionToken<IconConfig>;
1493
1547
 
1548
+ declare class IconService {
1549
+ private readonly _http;
1550
+ private readonly _sanitizer;
1551
+ private readonly _cache;
1552
+ getSvgContent(url: string, allowedSources: string[]): Observable<SafeHtml>;
1553
+ sanitizeSvg(svg: string): SafeHtml;
1554
+ private _isUrlAllowed;
1555
+ private _sanitizeSvg;
1556
+ private _makeSafe;
1557
+ static ɵfac: i0.ɵɵFactoryDeclaration<IconService, never>;
1558
+ static ɵprov: i0.ɵɵInjectableDeclaration<IconService>;
1559
+ }
1560
+
1561
+ /**
1562
+ * A registry entry for a {@link systemIcon}. Either raw SVG markup (sanitized
1563
+ * before it is rendered) or a component class that renders the icon itself —
1564
+ * the escape hatch for plugging in a third-party icon kit
1565
+ */
1566
+ type iconRenderer = string | Type<unknown>;
1567
+
1568
+ /**
1569
+ * A partial override map: any subset of {@link systemIcon} names mapped to a
1570
+ * {@link iconRenderer}. Names left unset fall back to the library defaults.
1571
+ */
1572
+ type iconRegistry = Partial<Record<systemIcon, iconRenderer>>;
1573
+
1574
+ /**
1575
+ * Consumer-supplied overrides for the built-in {@link systemIcon} set, merged
1576
+ * over {@link DEFAULT_ICONS} by {@link IconRegistry}. Provide it with
1577
+ * `provideThalassicIcons`.
1578
+ */
1579
+ declare const ICON_REGISTRY: InjectionToken<Partial<Record<_thalassic_ui.systemIcon, _thalassic_ui.iconRenderer>>>;
1580
+
1581
+ /**
1582
+ * Resolves a {@link systemIcon} name to its {@link iconRenderer}, applying any
1583
+ * consumer overrides from {@link ICON_REGISTRY} over {@link DEFAULT_ICONS}.
1584
+ */
1585
+ declare class IconRegistry {
1586
+ private readonly _overrides;
1587
+ private readonly _icons;
1588
+ resolve(name: systemIcon): iconRenderer;
1589
+ static ɵfac: i0.ɵɵFactoryDeclaration<IconRegistry, never>;
1590
+ static ɵprov: i0.ɵɵInjectableDeclaration<IconRegistry>;
1591
+ }
1592
+
1593
+ /**
1594
+ * Built-in SVG for every {@link systemIcon}. A coherent 24×24 stroked set drawn
1595
+ * with `currentColor`, no intrinsic width/height so each icon scales to its
1596
+ * host box. Consumers override individual entries via `provideThalassicIcons`.
1597
+ */
1598
+ declare const DEFAULT_ICONS: Record<systemIcon, string>;
1599
+
1600
+ /**
1601
+ * Override any of the library's built-in {@link systemIcon}s with your own kit.
1602
+ * Each entry is raw SVG markup or a component class; names left unset keep the
1603
+ * library defaults. Register once in the application config:
1604
+ *
1605
+ * ```ts
1606
+ * provideThalassicIcons({
1607
+ * close: '<svg>…</svg>',
1608
+ * 'chevron-down': MyChevronComponent,
1609
+ * })
1610
+ * ```
1611
+ */
1612
+ declare function provideThalassicIcons(icons: iconRegistry): EnvironmentProviders;
1613
+
1494
1614
  type loaderSize = size | number;
1495
1615
 
1496
1616
  /**
@@ -1748,7 +1868,7 @@ declare const PAGINATION_QUERY_SYNC_CONFIG: InjectionToken<PaginationQuerySyncCo
1748
1868
  declare class PaginationQuerySyncDirective extends QuerySyncDirective implements OnInit {
1749
1869
  private readonly _pagination;
1750
1870
  private readonly _config;
1751
- readonly tlsPaginationQuerySync: i0.InputSignal<string>;
1871
+ readonly tlsPaginationQuerySync: i0.InputSignalWithTransform<string, string>;
1752
1872
  constructor();
1753
1873
  ngOnInit(): void;
1754
1874
  static ɵfac: i0.ɵɵFactoryDeclaration<PaginationQuerySyncDirective, never>;
@@ -1931,12 +2051,13 @@ type tabValue = string;
1931
2051
 
1932
2052
  declare class Tab {
1933
2053
  private readonly _tabPanel;
2054
+ readonly headerTemplateRef: Signal<TemplateRef<unknown> | undefined>;
1934
2055
  readonly value: Signal<tabValue>;
1935
2056
  readonly label: InputSignal<string>;
1936
2057
  readonly disabled: InputSignalWithTransform<boolean, unknown>;
1937
2058
  protected hostClasses: Signal<string[]>;
1938
2059
  static ɵfac: i0.ɵɵFactoryDeclaration<Tab, never>;
1939
- static ɵcmp: i0.ɵɵComponentDeclaration<Tab, "tls-tab", never, { "label": { "alias": "label"; "required": true; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, [{ directive: typeof i1.TabPanel; inputs: { "value": "value"; }; outputs: {}; }]>;
2060
+ static ɵcmp: i0.ɵɵComponentDeclaration<Tab, "tls-tab", never, { "label": { "alias": "label"; "required": true; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, ["headerTemplateRef"], ["*"], true, [{ directive: typeof i1.TabPanel; inputs: { "value": "value"; }; outputs: {}; }]>;
1940
2061
  }
1941
2062
 
1942
2063
  declare class Tabs {
@@ -1974,13 +2095,218 @@ declare const TABS_QUERY_SYNC_CONFIG: InjectionToken<TabsQuerySyncConfig>;
1974
2095
  declare class TabsQuerySyncDirective extends QuerySyncDirective implements OnInit {
1975
2096
  private readonly _tabs;
1976
2097
  private readonly _config;
1977
- readonly tlsTabsQuerySync: i0.InputSignal<string>;
2098
+ readonly tlsTabsQuerySync: i0.InputSignalWithTransform<string, string>;
1978
2099
  constructor();
1979
2100
  ngOnInit(): void;
1980
2101
  static ɵfac: i0.ɵɵFactoryDeclaration<TabsQuerySyncDirective, never>;
1981
2102
  static ɵdir: i0.ɵɵDirectiveDeclaration<TabsQuerySyncDirective, "tls-tabs[tlsTabsQuerySync]", never, { "tlsTabsQuerySync": { "alias": "tlsTabsQuerySync"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1982
2103
  }
1983
2104
 
2105
+ type toastColor = color;
2106
+ /**
2107
+ * Semantic intents exposed by the `ToastService` convenience methods
2108
+ * (`success` / `info` / `warning` / `danger`). Each maps to a `toastColor`
2109
+ * through the config, so a consumer can retheme what color an intent renders as.
2110
+ */
2111
+ type toastSeverity = 'success' | 'info' | 'warning' | 'danger';
2112
+ /**
2113
+ * Corner of the viewport toasts are anchored to. `start`/`end` are
2114
+ * direction-aware (resolved through CSS logical properties), so they follow the
2115
+ * layout direction and flip under RTL.
2116
+ */
2117
+ type toastPosition = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';
2118
+ /**
2119
+ * How multiple toasts are laid out.
2120
+ *
2121
+ * - `collapsed`: newest toast in front, older ones piled behind it in the z
2122
+ * direction (scaled down and peeking); hovering or focusing the stack expands
2123
+ * it into a full list.
2124
+ * - `expanded`: every toast is always laid out as a full vertical list.
2125
+ */
2126
+ type toastStacking = 'collapsed' | 'expanded';
2127
+ /**
2128
+ * Optional action button rendered inside a toast (e.g. an "Undo"). The handler
2129
+ * runs on click; the toast dismisses itself afterwards.
2130
+ */
2131
+ type toastAction = {
2132
+ label: string;
2133
+ handler: () => void;
2134
+ };
2135
+
2136
+ /**
2137
+ * Presentational contents of a single toast: an optional leading status icon,
2138
+ * a title and message, an optional action button, and an optional close button.
2139
+ * Owns no timing or stacking logic — the host element is positioned by
2140
+ * `ToastOutlet`, and dismissal is reported through the `dismissed` output.
2141
+ */
2142
+ declare class Toast {
2143
+ readonly message: i0.InputSignal<string>;
2144
+ readonly title: i0.InputSignal<string | undefined>;
2145
+ readonly color: i0.InputSignal<_thalassic_ui.color>;
2146
+ readonly closable: i0.InputSignal<boolean>;
2147
+ readonly showIcon: i0.InputSignal<boolean>;
2148
+ readonly showProgress: i0.InputSignal<boolean>;
2149
+ /** Auto-dismiss delay in ms driving the countdown bar; `0` renders no bar. */
2150
+ readonly duration: i0.InputSignal<number>;
2151
+ /** Freezes the countdown bar, kept in lockstep with the paused auto-dismiss timer. */
2152
+ readonly paused: i0.InputSignal<boolean>;
2153
+ readonly action: i0.InputSignal<toastAction | undefined>;
2154
+ readonly ariaLabel: i0.InputSignal<string | undefined>;
2155
+ readonly dismissed: i0.OutputEmitterRef<void>;
2156
+ readonly actionTriggered: i0.OutputEmitterRef<void>;
2157
+ protected readonly hostClasses: i0.Signal<string[]>;
2158
+ protected readonly icon: i0.Signal<systemIcon>;
2159
+ protected readonly progressVisible: i0.Signal<boolean>;
2160
+ protected readonly progressDuration: i0.Signal<string>;
2161
+ protected readonly role: i0.Signal<"alert" | "status">;
2162
+ protected onAction(): void;
2163
+ protected onClose(): void;
2164
+ static ɵfac: i0.ɵɵFactoryDeclaration<Toast, never>;
2165
+ static ɵcmp: i0.ɵɵComponentDeclaration<Toast, "tls-toast", never, { "message": { "alias": "message"; "required": true; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": true; "isSignal": true; }; "closable": { "alias": "closable"; "required": false; "isSignal": true; }; "showIcon": { "alias": "showIcon"; "required": false; "isSignal": true; }; "showProgress": { "alias": "showProgress"; "required": false; "isSignal": true; }; "duration": { "alias": "duration"; "required": false; "isSignal": true; }; "paused": { "alias": "paused"; "required": false; "isSignal": true; }; "action": { "alias": "action"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; }, { "dismissed": "dismissed"; "actionTriggered": "actionTriggered"; }, never, never, true, never>;
2166
+ }
2167
+
2168
+ /** Options accepted by {@link ToastService.show}. */
2169
+ interface ToastOptions {
2170
+ message: string;
2171
+ title?: string;
2172
+ color?: toastColor;
2173
+ /** Auto-dismiss delay in ms; `0` keeps it open until dismissed. Falls back to the config. */
2174
+ duration?: number;
2175
+ /** Whether to render a close button. Falls back to the config. */
2176
+ closable?: boolean;
2177
+ /** Whether to render the leading status icon. Falls back to the config. */
2178
+ showIcon?: boolean;
2179
+ /** Whether to render the auto-dismiss countdown progress bar. Falls back to the config. */
2180
+ showProgress?: boolean;
2181
+ /** Optional action button. */
2182
+ action?: toastAction;
2183
+ /** Accessible name for the toast, when the message alone is not descriptive enough. */
2184
+ ariaLabel?: string;
2185
+ }
2186
+ /** A live toast, rendered in the stack. */
2187
+ interface ToastState {
2188
+ readonly id: number;
2189
+ readonly message: string;
2190
+ readonly title: string | undefined;
2191
+ readonly color: toastColor;
2192
+ /** Resolved auto-dismiss delay in ms; `0` keeps it open until dismissed. Drives the progress bar. */
2193
+ readonly duration: number;
2194
+ readonly closable: boolean;
2195
+ readonly showIcon: boolean;
2196
+ readonly showProgress: boolean;
2197
+ readonly action: toastAction | undefined;
2198
+ readonly ariaLabel: string | undefined;
2199
+ }
2200
+ /** Handle returned by {@link ToastService.show} for dismissing a specific toast. */
2201
+ interface ToastRef {
2202
+ readonly id: number;
2203
+ dismiss(): void;
2204
+ }
2205
+ /**
2206
+ * Imperative toast (snackbar) API. Enqueues transient notifications into a single
2207
+ * globally-positioned stack rendered by {@link ToastOutlet}. The newest toast sits
2208
+ * in front; older ones pile behind it (or list out, per the configured stacking).
2209
+ * Auto-dismiss timers are paused while the stack is hovered or focused.
2210
+ */
2211
+ declare class ToastService {
2212
+ private readonly _overlay;
2213
+ private readonly _config;
2214
+ private readonly _toasts;
2215
+ private readonly _timers;
2216
+ private _overlayRef;
2217
+ private _paused;
2218
+ private _counter;
2219
+ /** The live toasts, newest first. Consumed by {@link ToastOutlet}. */
2220
+ readonly toasts: i0.Signal<ToastState[]>;
2221
+ /** Resolved toast configuration. Consumed by {@link ToastOutlet}. */
2222
+ get config(): _thalassic_ui.ToastConfig;
2223
+ show(options: ToastOptions): ToastRef;
2224
+ success(message: string, options?: Omit<ToastOptions, 'message' | 'color'>): ToastRef;
2225
+ info(message: string, options?: Omit<ToastOptions, 'message' | 'color'>): ToastRef;
2226
+ warning(message: string, options?: Omit<ToastOptions, 'message' | 'color'>): ToastRef;
2227
+ danger(message: string, options?: Omit<ToastOptions, 'message' | 'color'>): ToastRef;
2228
+ dismiss(id: number): void;
2229
+ clear(): void;
2230
+ /** Freezes every auto-dismiss timer, preserving each toast's remaining time. */
2231
+ pause(): void;
2232
+ /** Resumes every paused auto-dismiss timer from its remaining time. */
2233
+ resume(): void;
2234
+ private _startTimer;
2235
+ private _clearTimer;
2236
+ private _pruneOrphanTimers;
2237
+ private _ensureOutlet;
2238
+ static ɵfac: i0.ɵɵFactoryDeclaration<ToastService, never>;
2239
+ static ɵprov: i0.ɵɵInjectableDeclaration<ToastService>;
2240
+ }
2241
+
2242
+ interface ToastLayout {
2243
+ transform: string;
2244
+ /** Depth fade applied to the toast surface; deep toasts in the collapsed pile fade out. */
2245
+ depthOpacity: string;
2246
+ zIndex: string;
2247
+ }
2248
+ /**
2249
+ * Single instance rendered into a global CDK overlay by {@link ToastService}. Lays
2250
+ * every live toast out as one anchored stack: collapsed into a hover-to-expand
2251
+ * pile, or an always-open list, per the resolved config. Each toast's host is the
2252
+ * stacking layer, positioned here via transform / scale / z-index computed from
2253
+ * the toasts' measured heights; hovering or focusing the region expands the pile
2254
+ * and pauses the auto-dismiss timers.
2255
+ */
2256
+ declare class ToastOutlet {
2257
+ private readonly _service;
2258
+ private readonly _destroyRef;
2259
+ protected readonly toasts: i0.Signal<ToastState[]>;
2260
+ private readonly _pointerInside;
2261
+ private readonly _focusInside;
2262
+ private readonly _heights;
2263
+ private readonly _toastElements;
2264
+ private readonly _resizeObserver;
2265
+ protected readonly position: i0.Signal<_thalassic_ui.toastPosition>;
2266
+ protected readonly expanded: i0.Signal<boolean>;
2267
+ protected readonly paused: i0.Signal<boolean>;
2268
+ protected readonly regionClasses: i0.Signal<string[]>;
2269
+ protected readonly regionHeight: i0.Signal<number>;
2270
+ protected readonly layouts: i0.Signal<ToastLayout[]>;
2271
+ private readonly _interacting;
2272
+ constructor();
2273
+ protected onDismiss(id: number): void;
2274
+ protected onAction(toast: ToastState): void;
2275
+ protected onPointerEnter(): void;
2276
+ protected onPointerLeave(): void;
2277
+ protected onFocusIn(): void;
2278
+ protected onFocusOut(): void;
2279
+ private _measure;
2280
+ static ɵfac: i0.ɵɵFactoryDeclaration<ToastOutlet, never>;
2281
+ static ɵcmp: i0.ɵɵComponentDeclaration<ToastOutlet, "tls-toast-outlet", never, {}, {}, never, never, true, never>;
2282
+ }
2283
+
2284
+ interface ToastConfig {
2285
+ /** Corner of the viewport toasts are anchored to. */
2286
+ position: toastPosition;
2287
+ /** Layout of multiple toasts: a hover-to-expand pile, or an always-open list. */
2288
+ stacking: toastStacking;
2289
+ /** Auto-dismiss delay in milliseconds. `0` keeps the toast until dismissed explicitly. */
2290
+ duration: number;
2291
+ /** Maximum number of toasts kept at once; showing more dismisses the oldest. */
2292
+ max: number;
2293
+ /** Default color when a toast does not specify one. */
2294
+ color: toastColor;
2295
+ /** Color each semantic convenience method (`success`/`info`/`warning`/`danger`) renders as. */
2296
+ severityColors: Record<toastSeverity, toastColor>;
2297
+ /** Whether toasts render a close button by default. */
2298
+ closable: boolean;
2299
+ /** Whether toasts render a leading, color-coded status icon by default. */
2300
+ showIcon: boolean;
2301
+ /** Whether auto-dismissing toasts render a countdown progress bar of their remaining time. */
2302
+ showProgress: boolean;
2303
+ /** Whether hovering / focusing the stack pauses every toast's auto-dismiss timer. */
2304
+ pauseOnHover: boolean;
2305
+ }
2306
+ declare const DEFAULT_TOAST_CONFIG: ToastConfig;
2307
+
2308
+ declare const TOAST_CONFIG: InjectionToken<ToastConfig>;
2309
+
1984
2310
  type tooltipOrigin = 'cursor' | 'element';
1985
2311
  type tooltipPosition = overlayPosition;
1986
2312
  type tooltipColor = color;
@@ -2061,6 +2387,9 @@ interface tlsUiConfigProvider {
2061
2387
  querySync?: Partial<TabsQuerySyncConfig>;
2062
2388
  };
2063
2389
  textarea?: Partial<TextareaConfig>;
2390
+ toast?: Partial<Omit<ToastConfig, 'severityColors'>> & {
2391
+ severityColors?: Partial<Record<toastSeverity, toastColor>>;
2392
+ };
2064
2393
  toggleGroup?: Partial<ToggleGroupConfig>;
2065
2394
  tooltip?: Partial<TooltipConfig>;
2066
2395
  };
@@ -2126,5 +2455,5 @@ declare abstract class QuerySyncDirective {
2126
2455
 
2127
2456
  declare const provideThalassicUIConfig: (config: tlsUiConfigProvider) => EnvironmentProviders;
2128
2457
 
2129
- export { ALERT_CONFIG, Alert, BUTTON_CONFIG, Button, ButtonDirective, CALENDAR_CONFIG, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_GROUP_CONFIG, CHIP_INPUT_CONFIG, CONFIRM_CONFIG, Calendar, CalendarAgendaView, CalendarEventItem, CalendarMonthView, CalendarTimeGrid, Checkbox, CheckboxFormControl, Chip, ChipControl, ChipGroup, ChipInput, Confirm, ConfirmPanel, ConfirmService, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CALENDAR_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_GROUP_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_CONFIRM_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_DRAWER_CONFIG, DEFAULT_FILE_INPUT_CONFIG, DEFAULT_FORM_CONTROL_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_INPUT_NUMBER_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_MULTI_SELECT_CONFIG, DEFAULT_ODOMETER_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PAGINATION_QUERY_SYNC_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TABS_QUERY_SYNC_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DRAWER_CONFIG, DateTimePicker, Dialog, DialogService, Divider, Drawer, DrawerRef, DrawerService, FILE_INPUT_CONFIG, FORM_CONTROL_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FileInput, FormControl, FormControlAddon, FormControlGroup, FormItem, ICON_CONFIG, INPUT_CONFIG, INPUT_NUMBER_CONFIG, Icon, Input, InputDirective, InputNumber, LOADER_CONFIG, Loader, MENU_CONFIG, MULTI_SELECT_CONFIG, Menu, MenuItemComponent, MenuTriggerDirective, MultiSelect, ODOMETER_CONFIG, Odometer, PAGINATION_CONFIG, PAGINATION_QUERY_SYNC_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, PaginationQuerySyncDirective, Password, PinInput, Popover, RADIO_BUTTON_CONFIG, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TABS_QUERY_SYNC_CONFIG, TEXTAREA_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, TabsQuerySyncDirective, Textarea, ToggleGroup, TooltipDirective, ValueFormControl, provideThalassicUIConfig };
2130
- export type { AlertConfig, ButtonConfig, CalendarConfig, CalendarEvent, CalendarEventContext, CalendarRange, CheckboxConfig, ChipConfig, ChipContext, ChipControlConfig, ChipGroupConfig, ChipInputConfig, ConfirmConfig, ConfirmOptions, DateTimePickerConfig, DialogConfig, DialogOpenConfig, DividerConfig, DrawerConfig, DrawerOpenConfig, FileInputConfig, FileInputDropZoneContext, FileInputFileContext, FormControlConfig, FormControlGroupConfig, FormItemConfig, IconConfig, InputConfig, InputNumberConfig, LoaderConfig, MenuActionItem, MenuConfig, MenuCustomItem, MenuDivider, MenuItemDefinition, MenuLabel, MultiSelectConfig, OdometerConfig, OdometerToken, PaginationConfig, PaginationQuerySyncConfig, PasswordConfig, PinInputConfig, PopoverConfig, RadioButtonConfig, SelectConfig, SkeletonConfig, StepConfig, StepperConfig, StepperSelectEvent, SwitchConfig, TableColumnDefinition, TableConfig, TableData, TableTrackBy, TabsConfig, TabsQuerySyncConfig, TextareaConfig, ToggleGroupConfig, TooltipConfig, acceptInput, alertColor, buttonColor, buttonType, buttonVariant, calendarView, chipColor, chipTemplateContext, chipVariant, color, confirmActionsAlign, confirmButton, controlSize, dateTimePickerMode, dialogSize, dividerContentPosition, dividerOrientation, dividerVariant, drawerSide, drawerSize, errorTrigger, fileInputDragState, fileInputVariant, labelPosition, loaderSize, menuItemType, menuPosition, orientation, overlayPosition, paginationItem, pinInputType, resolvedConfirmButton, size, stepperColor, stepperOrientation, stepperValue, switchColor, tabValue, tableColumnAlignment, tabsHeaderPosition, tabsOrientation, tabsVariant, textareaResize, tlsUiConfigProvider, tooltipColor, tooltipOrigin, tooltipPosition };
2458
+ export { ALERT_CONFIG, Alert, BADGE_CONFIG, BUTTON_CONFIG, Badge, Button, ButtonDirective, CALENDAR_CONFIG, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_GROUP_CONFIG, CHIP_INPUT_CONFIG, CONFIRM_CONFIG, Calendar, CalendarAgendaView, CalendarEventItem, CalendarMonthView, CalendarTimeGrid, Checkbox, CheckboxFormControl, Chip, ChipControl, ChipGroup, ChipInput, Confirm, ConfirmPanel, ConfirmService, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_BADGE_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CALENDAR_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_GROUP_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_CONFIRM_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_DRAWER_CONFIG, DEFAULT_FILE_INPUT_CONFIG, DEFAULT_FORM_CONTROL_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICONS, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_INPUT_NUMBER_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_MULTI_SELECT_CONFIG, DEFAULT_ODOMETER_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PAGINATION_QUERY_SYNC_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TABS_QUERY_SYNC_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOAST_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DRAWER_CONFIG, DateTimePicker, Dialog, DialogService, Divider, Drawer, DrawerRef, DrawerService, FILE_INPUT_CONFIG, FORM_CONTROL_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FileInput, FormControl, FormControlAddon, FormControlGroup, FormItem, ICON_CONFIG, ICON_REGISTRY, INPUT_CONFIG, INPUT_NUMBER_CONFIG, Icon, IconRegistry, IconService, Input, InputDirective, InputNumber, LOADER_CONFIG, Loader, MENU_CONFIG, MULTI_SELECT_CONFIG, Menu, MenuItemComponent, MenuTriggerDirective, MultiSelect, ODOMETER_CONFIG, Odometer, PAGINATION_CONFIG, PAGINATION_QUERY_SYNC_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, PaginationQuerySyncDirective, Password, PinInput, Popover, RADIO_BUTTON_CONFIG, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TABS_QUERY_SYNC_CONFIG, TEXTAREA_CONFIG, TOAST_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, TabsQuerySyncDirective, Textarea, Toast, ToastOutlet, ToastService, ToggleGroup, TooltipDirective, ValueFormControl, provideThalassicIcons, provideThalassicUIConfig };
2459
+ export type { AlertConfig, BadgeConfig, ButtonConfig, CalendarConfig, CalendarEvent, CalendarEventContext, CalendarRange, CheckboxConfig, ChipConfig, ChipContext, ChipControlConfig, ChipGroupConfig, ChipInputConfig, ConfirmConfig, ConfirmOptions, DateTimePickerConfig, DialogConfig, DialogOpenConfig, DividerConfig, DrawerConfig, DrawerOpenConfig, FileInputConfig, FileInputDropZoneContext, FileInputFileContext, FormControlConfig, FormControlGroupConfig, FormItemConfig, IconConfig, InputConfig, InputNumberConfig, LoaderConfig, MenuActionItem, MenuConfig, MenuCustomItem, MenuDivider, MenuItemDefinition, MenuLabel, MultiSelectConfig, OdometerConfig, OdometerToken, PaginationConfig, PaginationQuerySyncConfig, PasswordConfig, PinInputConfig, PopoverConfig, RadioButtonConfig, SelectConfig, SkeletonConfig, StepConfig, StepperConfig, StepperSelectEvent, SwitchConfig, TableColumnDefinition, TableConfig, TableData, TableTrackBy, TabsConfig, TabsQuerySyncConfig, TextareaConfig, ToastConfig, ToastOptions, ToastRef, ToastState, ToggleGroupConfig, TooltipConfig, acceptInput, alertColor, badgeColor, badgePosition, badgeVariant, buttonColor, buttonType, buttonVariant, calendarView, chipColor, chipTemplateContext, chipVariant, color, confirmActionsAlign, confirmButton, controlSize, dateTimePickerMode, dialogSize, dividerContentPosition, dividerOrientation, dividerVariant, drawerSide, drawerSize, errorTrigger, fileInputDragState, fileInputVariant, iconRegistry, iconRenderer, labelPosition, loaderSize, menuItemType, menuPosition, orientation, overlayPosition, paginationItem, pinInputType, resolvedConfirmButton, size, stepperColor, stepperOrientation, stepperValue, switchColor, systemIcon, tabValue, tableColumnAlignment, tabsHeaderPosition, tabsOrientation, tabsVariant, textareaResize, tlsUiConfigProvider, toastAction, toastColor, toastPosition, toastSeverity, toastStacking, toggleGroupVariant, tooltipColor, tooltipOrigin, tooltipPosition };