@thalassic/ui 22.24.0 → 22.25.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/fesm2022/thalassic-ui.mjs +351 -67
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/thalassic-ui.d.ts +167 -29
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, ElementRef, model, input, signal, computed, booleanAttribute, Directive, PLATFORM_ID, DestroyRef, numberAttribute, output, viewChild, contentChild, Component, ViewContainerRef, afterNextRender, DOCUMENT, afterRenderEffect, linkedSignal, Injectable, makeEnvironmentProviders, Renderer2, contentChildren, Service, effect, TemplateRef, forwardRef, ChangeDetectorRef, Injector, untracked, isDevMode, RendererStyleFlags2, viewChildren, provideEnvironmentInitializer } from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, ElementRef, model, input, signal, computed, booleanAttribute, Directive, PLATFORM_ID, DestroyRef, numberAttribute, output, viewChild, contentChild, Component, ViewContainerRef, afterNextRender, DOCUMENT, afterRenderEffect, linkedSignal, Injectable, makeEnvironmentProviders, Renderer2, contentChildren, Service, effect, TemplateRef, forwardRef, ChangeDetectorRef, Injector, untracked, isDevMode, RendererStyleFlags2, LOCALE_ID, viewChildren, provideEnvironmentInitializer } from '@angular/core';
|
|
3
3
|
import { CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf, ViewportRuler } from '@angular/cdk/scrolling';
|
|
4
4
|
import { eachDayOfInterval, endOfWeek, endOfMonth, startOfWeek, startOfMonth, startOfDay, isSameMonth, format, isSameDay, addDays, subMonths, subWeeks, isBefore, isAfter, differenceInCalendarDays, addHours, differenceInMinutes, isSameWeek, addMonths, addWeeks, endOfDay, setMonth, subYears, addYears, getYear, getMonth, getHours, getMinutes, setMinutes, setHours, setYear } from 'date-fns';
|
|
5
5
|
import { isPlatformBrowser, NgComponentOutlet, NgTemplateOutlet, LocationStrategy, DOCUMENT as DOCUMENT$1 } from '@angular/common';
|
|
@@ -12,10 +12,10 @@ import { AccordionGroup, AccordionTrigger, AccordionPanel, AccordionContent } fr
|
|
|
12
12
|
import { HttpClient } from '@angular/common/http';
|
|
13
13
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
14
14
|
import * as i1 from '@thalassic/core';
|
|
15
|
-
import { MOTION_ATTRIBUTE, SwipeDirective, MotionService, resolvePagingStep, resistPagingDrag, PanDirective, ViewportService, SWIPE_DEFAULT_MIN_VELOCITY, DRAG_DISMISS_RATIO, PAN_CONFIG, DRAG_DISMISS_POINTER_TYPES, DEFAULT_PAN_CONFIG, deepMerge } from '@thalassic/core';
|
|
15
|
+
import { MOTION_ATTRIBUTE, SwipeDirective, MotionService, resolvePagingStep, resistPagingDrag, PanDirective, ViewportService, SWIPE_DEFAULT_MIN_VELOCITY, DRAG_DISMISS_RATIO, PAN_CONFIG, DRAG_DISMISS_POINTER_TYPES, DEFAULT_PAN_CONFIG, HAPTIC_FEEDBACK, deepMerge } from '@thalassic/core';
|
|
16
16
|
import { Grid, GridRow, GridCell } from '@angular/aria/grid';
|
|
17
|
+
import { InputModalityDetector, ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';
|
|
17
18
|
import { Directionality } from '@angular/cdk/bidi';
|
|
18
|
-
import { ConfigurableFocusTrapFactory, InputModalityDetector } from '@angular/cdk/a11y';
|
|
19
19
|
import { filter as filter$1 } from 'rxjs/operators';
|
|
20
20
|
import { CdkDialogContainer, DialogRef as DialogRef$1, Dialog as Dialog$1, DIALOG_DATA } from '@angular/cdk/dialog';
|
|
21
21
|
import { Menu as Menu$1, MenuItem } from '@angular/aria/menu';
|
|
@@ -26,7 +26,8 @@ import { TabPanel, TabList, Tab as Tab$1, Tabs as Tabs$1, TabContent } from '@an
|
|
|
26
26
|
import { CdkTable, CdkHeaderCell, CdkCell, CdkCellDef, CdkHeaderCellDef, CdkColumnDef, CdkHeaderRow, CdkHeaderRowDef, CdkRow, CdkRowDef } from '@angular/cdk/table';
|
|
27
27
|
|
|
28
28
|
const DEFAULT_ACCESSIBILITY_CONFIG = {
|
|
29
|
-
expandTouchTargets:
|
|
29
|
+
expandTouchTargets: false,
|
|
30
|
+
enlargeTouchControls: false,
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
const ACCESSIBILITY_CONFIG = new InjectionToken('ACCESSIBILITY_CONFIG', {
|
|
@@ -684,9 +685,41 @@ const createNowSignal = (intervalMs) => {
|
|
|
684
685
|
return now.asReadonly();
|
|
685
686
|
};
|
|
686
687
|
|
|
688
|
+
/**
|
|
689
|
+
* How many digits a number carries after its decimal point, read from its
|
|
690
|
+
* shortest round-trip form, so `0.1` has one even though its binary value does
|
|
691
|
+
* not end there.
|
|
692
|
+
*
|
|
693
|
+
* @example
|
|
694
|
+
* decimalPlaces(5); // 0
|
|
695
|
+
* decimalPlaces(0.25); // 2
|
|
696
|
+
* decimalPlaces(1e-7); // 7 — exponent notation, not the "1e-7" text
|
|
697
|
+
*/
|
|
698
|
+
const decimalPlaces = (value) => {
|
|
699
|
+
const [mantissa, exponent] = String(Math.abs(value)).split('e');
|
|
700
|
+
const [, fraction = ''] = mantissa.split('.');
|
|
701
|
+
return Math.max(0, fraction.length - Number(exponent ?? 0));
|
|
702
|
+
};
|
|
703
|
+
|
|
687
704
|
/** Escapes RegExp metacharacters so the string matches literally inside a pattern. */
|
|
688
705
|
const escapeRegularExpression = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
689
706
|
|
|
707
|
+
/**
|
|
708
|
+
* `booleanAttribute` for an input whose absence means something: an unwritten
|
|
709
|
+
* input stays `undefined` instead of collapsing to `false`, so the component can
|
|
710
|
+
* fall back to a configured default only where the template said nothing.
|
|
711
|
+
*
|
|
712
|
+
* @example
|
|
713
|
+
* optionalBooleanAttribute(undefined); // undefined — not written
|
|
714
|
+
* optionalBooleanAttribute(''); // true — the bare attribute
|
|
715
|
+
* optionalBooleanAttribute(false); // false — an explicit binding
|
|
716
|
+
*/
|
|
717
|
+
const optionalBooleanAttribute = (value) => {
|
|
718
|
+
if (value === undefined)
|
|
719
|
+
return undefined;
|
|
720
|
+
return booleanAttribute(value);
|
|
721
|
+
};
|
|
722
|
+
|
|
690
723
|
/**
|
|
691
724
|
* Drops `id` from `element`'s `aria-describedby`, leaving the consumer's own descriptions in
|
|
692
725
|
* place and removing the attribute only once nothing is left in it.
|
|
@@ -1019,6 +1052,21 @@ function disposeAfterLeaveAnimation(overlayRef) {
|
|
|
1019
1052
|
});
|
|
1020
1053
|
}
|
|
1021
1054
|
|
|
1055
|
+
/**
|
|
1056
|
+
* Fades a modal overlay's backdrop out alongside the surface's own exit, rather
|
|
1057
|
+
* than leaving it at full strength until the overlay is disposed and it vanishes
|
|
1058
|
+
* in a single frame. The fade is the stylesheet's backdrop transition, so it
|
|
1059
|
+
* follows the motion level like the rest of the exit. Written inline because a
|
|
1060
|
+
* drag may already have left an inline opacity on the backdrop, which no
|
|
1061
|
+
* stylesheet rule could override, and may have suspended its transition inline.
|
|
1062
|
+
*/
|
|
1063
|
+
function fadeOutBackdrop(backdrop, renderer) {
|
|
1064
|
+
if (backdrop === null)
|
|
1065
|
+
return;
|
|
1066
|
+
renderer.removeStyle(backdrop, 'transition');
|
|
1067
|
+
renderer.setStyle(backdrop, 'opacity', '0');
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1022
1070
|
/**
|
|
1023
1071
|
* Dimmed backdrop behind any modal-grade surface — a centered confirm, a
|
|
1024
1072
|
* bottom sheet. Shared with `tls-dialog` so every modal surface renders an
|
|
@@ -2663,6 +2711,7 @@ class TooltipTrigger {
|
|
|
2663
2711
|
_tooltipService = inject(TooltipService);
|
|
2664
2712
|
_renderer = inject(Renderer2);
|
|
2665
2713
|
_config = inject(TOOLTIP_CONFIG);
|
|
2714
|
+
_inputModalityDetector = inject(InputModalityDetector);
|
|
2666
2715
|
// Inputs
|
|
2667
2716
|
tooltipDisabled = input(false, /* @ts-ignore */
|
|
2668
2717
|
...(ngDevMode ? [{ debugName: "tooltipDisabled" }] : /* istanbul ignore next */ []));
|
|
@@ -2769,6 +2818,20 @@ class TooltipTrigger {
|
|
|
2769
2818
|
_followsPointer() {
|
|
2770
2819
|
return Date.now() - this._lastPointerAt < TOUCH_HANDOVER_WINDOW_MS;
|
|
2771
2820
|
}
|
|
2821
|
+
/**
|
|
2822
|
+
* Whether a focus arriving now came from the keyboard — the one reader the
|
|
2823
|
+
* focus trigger serves. Focus handed over by a press on the control is not it:
|
|
2824
|
+
* a tap's tooltip was already told not to claim the activation, and a click's
|
|
2825
|
+
* would outlive the hover that click just retired. Neither is focus a script
|
|
2826
|
+
* moves while a pointer is in use, such as a closing dialog returning it to its
|
|
2827
|
+
* opener after a tap on the backdrop: the latest input says which it was.
|
|
2828
|
+
*/
|
|
2829
|
+
_isKeyboardFocus() {
|
|
2830
|
+
if (this._followsPointer())
|
|
2831
|
+
return false;
|
|
2832
|
+
const modality = this._inputModalityDetector.mostRecentModality;
|
|
2833
|
+
return modality !== 'mouse' && modality !== 'touch';
|
|
2834
|
+
}
|
|
2772
2835
|
/** Whether the element is, or wraps, a control a tap activates. */
|
|
2773
2836
|
_isInteractive(element) {
|
|
2774
2837
|
const interactiveSelector = 'button, a[href], input, select, textarea, [role="button"]';
|
|
@@ -3003,11 +3066,7 @@ class TooltipDelegateDirective extends TooltipTrigger {
|
|
|
3003
3066
|
const item = this._resolveItem(event.target);
|
|
3004
3067
|
if (!item)
|
|
3005
3068
|
return;
|
|
3006
|
-
|
|
3007
|
-
// focus handed over by a tap or a click is not that reader — a tap's
|
|
3008
|
-
// tooltip was already told not to claim the activation, and a click's
|
|
3009
|
-
// would outlive the hover that click just retired.
|
|
3010
|
-
if (this._followsPointer())
|
|
3069
|
+
if (!this._isKeyboardFocus())
|
|
3011
3070
|
return;
|
|
3012
3071
|
// No cursor to anchor to; a focus-triggered tooltip always anchors to the item. An item that
|
|
3013
3072
|
// is a composite holds the control focus actually landed on, and that is what it describes.
|
|
@@ -3140,11 +3199,7 @@ class TooltipDirective extends TooltipTrigger {
|
|
|
3140
3199
|
// whose <button> is inside the template — would never hear about the focus its own tooltip
|
|
3141
3200
|
// is for. `focusin` does, and the control that took focus is what the tooltip describes.
|
|
3142
3201
|
const focused = event.target;
|
|
3143
|
-
|
|
3144
|
-
// focus handed over by a tap or a click is not that reader — a tap's
|
|
3145
|
-
// tooltip was already told not to claim the activation, and a click's
|
|
3146
|
-
// would outlive the hover that click just retired.
|
|
3147
|
-
if (this._followsPointer())
|
|
3202
|
+
if (!this._isKeyboardFocus())
|
|
3148
3203
|
return;
|
|
3149
3204
|
// No cursor to anchor to; a focus-triggered tooltip always anchors to the element.
|
|
3150
3205
|
this._showHost('focus', null, focused instanceof HTMLElement ? focused : null);
|
|
@@ -3672,6 +3727,13 @@ class Badge {
|
|
|
3672
3727
|
hidden = input(false, { ...(ngDevMode ? { debugName: "hidden" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3673
3728
|
inset = input(false, { ...(ngDevMode ? { debugName: "inset" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3674
3729
|
bordered = input(false, { ...(ngDevMode ? { debugName: "bordered" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3730
|
+
/**
|
|
3731
|
+
* Sets the indicator in the flow of the content instead of over a corner of
|
|
3732
|
+
* it — a standalone count, such as one at the end of a list row or beside a
|
|
3733
|
+
* label, where there is no element for it to decorate. `position` and
|
|
3734
|
+
* `inset` have nothing to place it against then and are ignored.
|
|
3735
|
+
*/
|
|
3736
|
+
inline = input(false, { ...(ngDevMode ? { debugName: "inline" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3675
3737
|
ariaLabel = input(undefined, /* @ts-ignore */
|
|
3676
3738
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
3677
3739
|
// Computed
|
|
@@ -3718,18 +3780,20 @@ class Badge {
|
|
|
3718
3780
|
array.push(`${className}--inset`);
|
|
3719
3781
|
if (this.bordered())
|
|
3720
3782
|
array.push(`${className}--bordered`);
|
|
3783
|
+
if (this.inline())
|
|
3784
|
+
array.push(`${className}--inline`);
|
|
3721
3785
|
return array;
|
|
3722
3786
|
}, /* @ts-ignore */
|
|
3723
3787
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
3724
3788
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Badge, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3725
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Badge, isStandalone: true, selector: "tls-badge", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, dot: { classPropertyName: "dot", publicName: "dot", isSignal: true, isRequired: false, transformFunction: null }, showZero: { classPropertyName: "showZero", publicName: "showZero", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, inset: { classPropertyName: "inset", publicName: "inset", isSignal: true, isRequired: false, transformFunction: null }, bordered: { classPropertyName: "bordered", publicName: "bordered", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0, template: "<ng-content />\n\n@if (visible()) {\n <span\n class=\"tls-badge__indicator\"\n role=\"status\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-hidden]=\"decorative() ? 'true' : null\"\n animate.enter=\"tls-badge__indicator--enter\"\n animate.leave=\"tls-badge__indicator--leave\"\n >\n @if (!dot()) {\n {{ displayValue() }}\n }\n </span>\n}\n" });
|
|
3789
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Badge, isStandalone: true, selector: "tls-badge", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, dot: { classPropertyName: "dot", publicName: "dot", isSignal: true, isRequired: false, transformFunction: null }, showZero: { classPropertyName: "showZero", publicName: "showZero", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, inset: { classPropertyName: "inset", publicName: "inset", isSignal: true, isRequired: false, transformFunction: null }, bordered: { classPropertyName: "bordered", publicName: "bordered", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0, template: "<ng-content />\n\n@if (visible()) {\n <span\n class=\"tls-badge__indicator\"\n role=\"status\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-hidden]=\"decorative() ? 'true' : null\"\n animate.enter=\"tls-badge__indicator--enter\"\n animate.leave=\"tls-badge__indicator--leave\"\n >\n @if (!dot()) {\n {{ displayValue() }}\n }\n </span>\n}\n" });
|
|
3726
3790
|
}
|
|
3727
3791
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Badge, decorators: [{
|
|
3728
3792
|
type: Component,
|
|
3729
3793
|
args: [{ selector: 'tls-badge', imports: [], host: {
|
|
3730
3794
|
'[class]': 'hostClasses()',
|
|
3731
3795
|
}, template: "<ng-content />\n\n@if (visible()) {\n <span\n class=\"tls-badge__indicator\"\n role=\"status\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-hidden]=\"decorative() ? 'true' : null\"\n animate.enter=\"tls-badge__indicator--enter\"\n animate.leave=\"tls-badge__indicator--leave\"\n >\n @if (!dot()) {\n {{ displayValue() }}\n }\n </span>\n}\n" }]
|
|
3732
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], dot: [{ type: i0.Input, args: [{ isSignal: true, alias: "dot", required: false }] }], showZero: [{ type: i0.Input, args: [{ isSignal: true, alias: "showZero", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], inset: [{ type: i0.Input, args: [{ isSignal: true, alias: "inset", required: false }] }], bordered: [{ type: i0.Input, args: [{ isSignal: true, alias: "bordered", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
3796
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], dot: [{ type: i0.Input, args: [{ isSignal: true, alias: "dot", required: false }] }], showZero: [{ type: i0.Input, args: [{ isSignal: true, alias: "showZero", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], inset: [{ type: i0.Input, args: [{ isSignal: true, alias: "inset", required: false }] }], bordered: [{ type: i0.Input, args: [{ isSignal: true, alias: "bordered", required: false }] }], inline: [{ type: i0.Input, args: [{ isSignal: true, alias: "inline", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
3733
3797
|
|
|
3734
3798
|
const DEFAULT_BREADCRUMBS_CONFIG = {
|
|
3735
3799
|
separatorIcon: 'chevron-right',
|
|
@@ -3897,6 +3961,7 @@ const DEFAULT_BUTTON_CONFIG = {
|
|
|
3897
3961
|
size: 'md',
|
|
3898
3962
|
type: 'button',
|
|
3899
3963
|
fluid: false,
|
|
3964
|
+
iconRounded: false,
|
|
3900
3965
|
};
|
|
3901
3966
|
|
|
3902
3967
|
const BUTTON_CONFIG = new InjectionToken('BUTTON_CONFIG', {
|
|
@@ -3941,7 +4006,12 @@ class ButtonBase {
|
|
|
3941
4006
|
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
3942
4007
|
size = input(this._config.size, /* @ts-ignore */
|
|
3943
4008
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
3944
|
-
|
|
4009
|
+
/**
|
|
4010
|
+
* Rounds the button's ends fully: a pill for a labelled button, a circle for an icon-only
|
|
4011
|
+
* one. Left unset, an icon-only button takes the configured `iconRounded` and any other
|
|
4012
|
+
* keeps its corners; an explicit `[rounded]="false"` keeps them on an icon-only button too.
|
|
4013
|
+
*/
|
|
4014
|
+
rounded = input(undefined, { ...(ngDevMode ? { debugName: "rounded" } : /* istanbul ignore next */ {}), transform: optionalBooleanAttribute });
|
|
3945
4015
|
/** Whether the button stretches to fill its container's width. */
|
|
3946
4016
|
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3947
4017
|
/**
|
|
@@ -3958,6 +4028,9 @@ class ButtonBase {
|
|
|
3958
4028
|
...(ngDevMode ? [{ debugName: "unavailable" }] : /* istanbul ignore next */ []));
|
|
3959
4029
|
ariaDisabled = computed(() => (this.unavailable() ? 'true' : null), /* @ts-ignore */
|
|
3960
4030
|
...(ngDevMode ? [{ debugName: "ariaDisabled" }] : /* istanbul ignore next */ []));
|
|
4031
|
+
/** The shape in force: the input where written, otherwise the configured default. */
|
|
4032
|
+
isRounded = computed(() => this.rounded() ?? (this.icon() && this._config.iconRounded), /* @ts-ignore */
|
|
4033
|
+
...(ngDevMode ? [{ debugName: "isRounded" }] : /* istanbul ignore next */ []));
|
|
3961
4034
|
classes = computed(() => {
|
|
3962
4035
|
const className = 'tls-button';
|
|
3963
4036
|
const array = [className];
|
|
@@ -3975,7 +4048,7 @@ class ButtonBase {
|
|
|
3975
4048
|
array.push(`${className}--fluid`);
|
|
3976
4049
|
if (this.stretch())
|
|
3977
4050
|
array.push(`${className}--stretch`);
|
|
3978
|
-
if (this.
|
|
4051
|
+
if (this.isRounded())
|
|
3979
4052
|
array.push(`${className}--rounded`);
|
|
3980
4053
|
return array;
|
|
3981
4054
|
}, /* @ts-ignore */
|
|
@@ -5851,7 +5924,7 @@ class ConfirmPanel {
|
|
|
5851
5924
|
variant: source.variant ?? slotDefault.variant ?? this._buttonConfig.variant,
|
|
5852
5925
|
size: source.size ?? slotDefault.size ?? this._buttonConfig.size,
|
|
5853
5926
|
icon: source.icon ?? slotDefault.icon ?? false,
|
|
5854
|
-
rounded: source.rounded ?? slotDefault.rounded
|
|
5927
|
+
rounded: source.rounded ?? slotDefault.rounded,
|
|
5855
5928
|
fluid: source.fluid ?? slotDefault.fluid ?? false,
|
|
5856
5929
|
disabled: source.disabled ?? slotDefault.disabled ?? false,
|
|
5857
5930
|
};
|
|
@@ -6233,6 +6306,8 @@ class Dialog extends CdkDialogContainer {
|
|
|
6233
6306
|
// Injections
|
|
6234
6307
|
_tlsConfig = inject(DIALOG_CONFIG);
|
|
6235
6308
|
_dialogRef = inject(DialogRef$1);
|
|
6309
|
+
/** Named apart from the CDK container's own `_renderer`, which is private to it. */
|
|
6310
|
+
_renderer2 = inject(Renderer2);
|
|
6236
6311
|
// State
|
|
6237
6312
|
_state = signal('enter', /* @ts-ignore */
|
|
6238
6313
|
...(ngDevMode ? [{ debugName: "_state" }] : /* istanbul ignore next */ []));
|
|
@@ -6259,6 +6334,7 @@ class Dialog extends CdkDialogContainer {
|
|
|
6259
6334
|
return;
|
|
6260
6335
|
this._closing = true;
|
|
6261
6336
|
this._state.set('leave');
|
|
6337
|
+
fadeOutBackdrop(this._dialogRef.overlayRef.backdropElement, this._renderer2);
|
|
6262
6338
|
afterLeaveAnimation(this._elementRef.nativeElement, () => this._dialogRef.close(result));
|
|
6263
6339
|
}
|
|
6264
6340
|
// Protected methods
|
|
@@ -6669,10 +6745,12 @@ class SheetMotion {
|
|
|
6669
6745
|
*/
|
|
6670
6746
|
const DRAWER_NAMED_SIZES = ['sm', 'md', 'lg', 'full', 'auto'];
|
|
6671
6747
|
/**
|
|
6672
|
-
*
|
|
6673
|
-
*
|
|
6748
|
+
* Tokens the slide from an origin is timed by — the same the plain slide uses,
|
|
6749
|
+
* so a drawer moves alike whichever way it opened. The durations are the
|
|
6750
|
+
* drawer's own, since a side may set a pace of its own.
|
|
6674
6751
|
*/
|
|
6675
|
-
const
|
|
6752
|
+
const DRAWER_SLIDE_ENTER_DURATION_TOKEN = '--tls-drawer-enter-duration';
|
|
6753
|
+
const DRAWER_SLIDE_LEAVE_DURATION_TOKEN = '--tls-drawer-leave-duration';
|
|
6676
6754
|
const DRAWER_SLIDE_ENTER_EASING_TOKEN = '--motion-ease-out';
|
|
6677
6755
|
const DRAWER_SLIDE_LEAVE_EASING_TOKEN = '--motion-ease-in';
|
|
6678
6756
|
/**
|
|
@@ -6738,12 +6816,14 @@ function offscreenOffset(panel, side, isRtl) {
|
|
|
6738
6816
|
}
|
|
6739
6817
|
}
|
|
6740
6818
|
/**
|
|
6741
|
-
* The slide's timing in one direction, from the
|
|
6742
|
-
*
|
|
6819
|
+
* The slide's timing in one direction, from the panel's slide tokens as it
|
|
6820
|
+
* resolves them — its side may set a pace of its own: easing out on the way
|
|
6821
|
+
* in, in on the way out.
|
|
6743
6822
|
*/
|
|
6744
6823
|
function readSlideTiming(panel, direction) {
|
|
6745
6824
|
const style = getComputedStyle(panel);
|
|
6746
|
-
const
|
|
6825
|
+
const durationToken = direction === 'enter' ? DRAWER_SLIDE_ENTER_DURATION_TOKEN : DRAWER_SLIDE_LEAVE_DURATION_TOKEN;
|
|
6826
|
+
const duration = style.getPropertyValue(durationToken).trim();
|
|
6747
6827
|
const easingToken = direction === 'enter' ? DRAWER_SLIDE_ENTER_EASING_TOKEN : DRAWER_SLIDE_LEAVE_EASING_TOKEN;
|
|
6748
6828
|
const easing = style.getPropertyValue(easingToken).trim();
|
|
6749
6829
|
return {
|
|
@@ -7109,6 +7189,9 @@ class Drawer extends CdkDialogContainer {
|
|
|
7109
7189
|
}
|
|
7110
7190
|
this._closing = true;
|
|
7111
7191
|
const host = this._elementRef.nativeElement;
|
|
7192
|
+
// Every exit from here on — reversing an entrance, sliding off-screen or
|
|
7193
|
+
// back into the origin — takes the dimming with it.
|
|
7194
|
+
fadeOutBackdrop(this._dialogRef.overlayRef.backdropElement, this._dragRenderer);
|
|
7112
7195
|
const running = this._entrance.filter(animation => animation.playState === 'running');
|
|
7113
7196
|
if (running.length) {
|
|
7114
7197
|
this._reverseEntrance(running, result);
|
|
@@ -8241,6 +8324,10 @@ class FormItem {
|
|
|
8241
8324
|
if (this.spread())
|
|
8242
8325
|
array.push(`${className}--spread`);
|
|
8243
8326
|
}
|
|
8327
|
+
// Set by whether a hint is configured, never by what the footer shows now: an
|
|
8328
|
+
// error taking the hint's place must not change the row's layout.
|
|
8329
|
+
if (this.hint())
|
|
8330
|
+
array.push(`${className}--has-hint`);
|
|
8244
8331
|
if (this.reserveErrorSpace())
|
|
8245
8332
|
array.push(`${className}--error-space-reserved`);
|
|
8246
8333
|
if (this.reserveLabelSpace())
|
|
@@ -10609,16 +10696,65 @@ const DEFAULT_INPUT_NUMBER_CONFIG = {
|
|
|
10609
10696
|
placeholder: '',
|
|
10610
10697
|
fluid: false,
|
|
10611
10698
|
step: 1,
|
|
10612
|
-
hideArrows: true,
|
|
10613
10699
|
};
|
|
10614
10700
|
|
|
10615
10701
|
const INPUT_NUMBER_CONFIG = new InjectionToken('INPUT_NUMBER_CONFIG', {
|
|
10616
10702
|
factory: () => DEFAULT_INPUT_NUMBER_CONFIG,
|
|
10617
10703
|
});
|
|
10618
10704
|
|
|
10705
|
+
/**
|
|
10706
|
+
* Whether `text` is a number on its way to being typed — empty, a lone sign,
|
|
10707
|
+
* digits with or without a trailing separator — that the field may hold.
|
|
10708
|
+
*
|
|
10709
|
+
* Both `.` and `,` count as the decimal separator in every locale. The field
|
|
10710
|
+
* never groups digits, so a comma cannot be a thousands separator in it; and
|
|
10711
|
+
* the separator a virtual keypad offers follows the device's region, not the
|
|
10712
|
+
* page's language, so either may arrive.
|
|
10713
|
+
*
|
|
10714
|
+
* @example
|
|
10715
|
+
* isPartialNumberText('-', { allowsNegative: true, allowsFraction: true }); // true
|
|
10716
|
+
* isPartialNumberText('62,', { allowsNegative: false, allowsFraction: true }); // true
|
|
10717
|
+
* isPartialNumberText('6.2', { allowsNegative: false, allowsFraction: false }); // false — whole numbers only
|
|
10718
|
+
* isPartialNumberText('1.2.3', { allowsNegative: true, allowsFraction: true }); // false — two separators
|
|
10719
|
+
*/
|
|
10720
|
+
const isPartialNumberText = (text, rules) => {
|
|
10721
|
+
const sign = rules.allowsNegative ? '-?' : '';
|
|
10722
|
+
const fraction = rules.allowsFraction ? '(?:[.,]\\d*)?' : '';
|
|
10723
|
+
return new RegExp(`^${sign}\\d*${fraction}$`).test(text);
|
|
10724
|
+
};
|
|
10725
|
+
/**
|
|
10726
|
+
* The number partial text stands for, or null while it holds no digit yet.
|
|
10727
|
+
*
|
|
10728
|
+
* @example
|
|
10729
|
+
* parseNumberText('62,5'); // 62.5
|
|
10730
|
+
* parseNumberText('-'); // null
|
|
10731
|
+
* parseNumberText('3.'); // 3
|
|
10732
|
+
*/
|
|
10733
|
+
const parseNumberText = (text) => {
|
|
10734
|
+
if (!/\d/.test(text))
|
|
10735
|
+
return null;
|
|
10736
|
+
const parsed = Number(text.replace(',', '.'));
|
|
10737
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
10738
|
+
};
|
|
10739
|
+
|
|
10740
|
+
/**
|
|
10741
|
+
* A field for a number, typed as text the field reads itself — the model React
|
|
10742
|
+
* Aria's and Base UI's number fields follow — rather than a native
|
|
10743
|
+
* `type="number"`, which reads the decimal separator by its own rules: WebKit
|
|
10744
|
+
* drops a typed comma, turning `62,5` into `625`, and Chromium rejects it,
|
|
10745
|
+
* while the decimal keypad of a device set to a comma region offers nothing
|
|
10746
|
+
* else. Here either separator reads as the decimal point, the value is shown
|
|
10747
|
+
* in the page's locale, and the virtual keyboard is the one the number needs.
|
|
10748
|
+
*
|
|
10749
|
+
* The step sets the precision: a whole step takes whole numbers, a fractional
|
|
10750
|
+
* one decimals. A minimum below zero, or none, admits a sign. ArrowUp and
|
|
10751
|
+
* ArrowDown move the value by a step, as a native number field's do; a typed
|
|
10752
|
+
* value is clamped into `[min, max]` once committed.
|
|
10753
|
+
*/
|
|
10619
10754
|
class InputNumber extends ValueFormControl {
|
|
10620
10755
|
// Injections
|
|
10621
10756
|
_config = inject(INPUT_NUMBER_CONFIG);
|
|
10757
|
+
_localeId = inject(LOCALE_ID);
|
|
10622
10758
|
supportsLabelFor = true;
|
|
10623
10759
|
// Inputs
|
|
10624
10760
|
value = model(null, /* @ts-ignore */
|
|
@@ -10635,7 +10771,28 @@ class InputNumber extends ValueFormControl {
|
|
|
10635
10771
|
max = input(undefined, /* @ts-ignore */
|
|
10636
10772
|
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
10637
10773
|
step = input(this._config.step, { ...(ngDevMode ? { debugName: "step" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
10638
|
-
|
|
10774
|
+
/**
|
|
10775
|
+
* The virtual keyboard to ask for. Left unset, it follows what the field
|
|
10776
|
+
* accepts: `decimal` for a fractional step, `numeric` for a whole one, and
|
|
10777
|
+
* `text` for a minimum below zero, since iOS's number keypads have no minus
|
|
10778
|
+
* key. A field with no minimum gets a number keypad all the same: most never
|
|
10779
|
+
* take a negative, and a form library that owns the bounds may not hand them
|
|
10780
|
+
* to the control — a field that does take negatives says so with its minimum.
|
|
10781
|
+
*/
|
|
10782
|
+
inputMode = input(undefined, /* @ts-ignore */
|
|
10783
|
+
...(ngDevMode ? [{ debugName: "inputMode" }] : /* istanbul ignore next */ []));
|
|
10784
|
+
// State
|
|
10785
|
+
/**
|
|
10786
|
+
* The field's text. Follows the value whenever the value changes to one the
|
|
10787
|
+
* text does not already say, so a number still being typed — `62,` on its
|
|
10788
|
+
* way to `62,5` — is kept as typed instead of being rewritten as `62`.
|
|
10789
|
+
*/
|
|
10790
|
+
text = linkedSignal({ ...(ngDevMode ? { debugName: "text" } : /* istanbul ignore next */ {}), source: this.value,
|
|
10791
|
+
computation: (value, previous) => {
|
|
10792
|
+
if (previous && parseNumberText(previous.value) === value)
|
|
10793
|
+
return previous.value;
|
|
10794
|
+
return this._format(value);
|
|
10795
|
+
} });
|
|
10639
10796
|
// Computed
|
|
10640
10797
|
classes = computed(() => {
|
|
10641
10798
|
const array = [this.CLASS_NAME, 'tls-input-number'];
|
|
@@ -10643,45 +10800,139 @@ class InputNumber extends ValueFormControl {
|
|
|
10643
10800
|
array.push(`${this.CLASS_NAME}--${this.variant()}`);
|
|
10644
10801
|
if (this.fluid())
|
|
10645
10802
|
array.push(`${this.CLASS_NAME}--fluid`);
|
|
10646
|
-
if (this.hideArrows())
|
|
10647
|
-
array.push('tls-input-number--no-arrows');
|
|
10648
10803
|
return array.concat(this.controlClasses());
|
|
10649
10804
|
}, /* @ts-ignore */
|
|
10650
10805
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
10806
|
+
effectiveInputMode = computed(() => {
|
|
10807
|
+
const inputMode = this.inputMode();
|
|
10808
|
+
if (inputMode)
|
|
10809
|
+
return inputMode;
|
|
10810
|
+
const min = this.min();
|
|
10811
|
+
if (min !== undefined && min < 0)
|
|
10812
|
+
return 'text';
|
|
10813
|
+
return this._rules().allowsFraction ? 'decimal' : 'numeric';
|
|
10814
|
+
}, /* @ts-ignore */
|
|
10815
|
+
...(ngDevMode ? [{ debugName: "effectiveInputMode" }] : /* istanbul ignore next */ []));
|
|
10816
|
+
/** What may be typed, from the bounds and the step. */
|
|
10817
|
+
_rules = computed(() => {
|
|
10818
|
+
const min = this.min();
|
|
10819
|
+
return {
|
|
10820
|
+
allowsNegative: min === undefined || min < 0,
|
|
10821
|
+
allowsFraction: !Number.isInteger(this.step()),
|
|
10822
|
+
};
|
|
10823
|
+
}, /* @ts-ignore */
|
|
10824
|
+
...(ngDevMode ? [{ debugName: "_rules" }] : /* istanbul ignore next */ []));
|
|
10825
|
+
/**
|
|
10826
|
+
* Writes a value in the page's locale, in the form the field reads back:
|
|
10827
|
+
* ungrouped, so a comma can only be the decimal point, and in Latin digits,
|
|
10828
|
+
* which are the only ones typing accepts — a locale that writes its own
|
|
10829
|
+
* (`ar-EG`, `fa`, `bn`) would otherwise show a figure no edit could follow.
|
|
10830
|
+
*/
|
|
10831
|
+
_formatter = computed(() => new Intl.NumberFormat(this._localeId, {
|
|
10832
|
+
useGrouping: false,
|
|
10833
|
+
maximumFractionDigits: 20,
|
|
10834
|
+
numberingSystem: 'latn',
|
|
10835
|
+
}), /* @ts-ignore */
|
|
10836
|
+
...(ngDevMode ? [{ debugName: "_formatter" }] : /* istanbul ignore next */ []));
|
|
10651
10837
|
// Protected methods
|
|
10838
|
+
/**
|
|
10839
|
+
* Refuses an insertion that would leave the text no number could become, so
|
|
10840
|
+
* a stray letter or a second separator never appears at all. A deletion
|
|
10841
|
+
* always leaves a part of a valid number, which is still valid.
|
|
10842
|
+
*/
|
|
10843
|
+
onBeforeInput(event) {
|
|
10844
|
+
if (!event.inputType.startsWith('insert'))
|
|
10845
|
+
return;
|
|
10846
|
+
const target = event.target;
|
|
10847
|
+
const pasted = event.dataTransfer ? event.dataTransfer.getData('text/plain') : '';
|
|
10848
|
+
const inserted = event.data ?? pasted;
|
|
10849
|
+
const start = target.selectionStart ?? target.value.length;
|
|
10850
|
+
const end = target.selectionEnd ?? start;
|
|
10851
|
+
const next = target.value.slice(0, start) + inserted + target.value.slice(end);
|
|
10852
|
+
if (!isPartialNumberText(next, this._rules()))
|
|
10853
|
+
event.preventDefault();
|
|
10854
|
+
}
|
|
10855
|
+
/**
|
|
10856
|
+
* Takes the text as the new value. Text that reached the field past
|
|
10857
|
+
* `beforeinput` — an IME composition, which cannot be refused before it
|
|
10858
|
+
* lands — and is no number is put back to what the field held.
|
|
10859
|
+
*/
|
|
10652
10860
|
onInput(event) {
|
|
10653
10861
|
const target = event.target;
|
|
10654
|
-
|
|
10655
|
-
|
|
10862
|
+
if (!isPartialNumberText(target.value, this._rules())) {
|
|
10863
|
+
target.value = this.text();
|
|
10864
|
+
return;
|
|
10865
|
+
}
|
|
10866
|
+
this.text.set(target.value);
|
|
10867
|
+
this.value.set(parseNumberText(target.value));
|
|
10656
10868
|
}
|
|
10657
10869
|
/**
|
|
10658
10870
|
* Clamps a typed value into `[min, max]` once editing is committed (`change`
|
|
10659
|
-
* fires on blur/Enter)
|
|
10660
|
-
*
|
|
10871
|
+
* fires on blur/Enter) and rewrites the text in the field's own form, so
|
|
10872
|
+
* `62,` reads `62`. Clamping only here keeps mid-typing values ("1" on the
|
|
10873
|
+
* way to "10") intact.
|
|
10661
10874
|
*/
|
|
10662
|
-
onChange(
|
|
10663
|
-
const
|
|
10664
|
-
if (
|
|
10875
|
+
onChange() {
|
|
10876
|
+
const value = this.value();
|
|
10877
|
+
if (value === null) {
|
|
10878
|
+
this.text.set('');
|
|
10665
10879
|
return;
|
|
10880
|
+
}
|
|
10881
|
+
this._commit(this._clamp(value));
|
|
10882
|
+
}
|
|
10883
|
+
/** ArrowUp and ArrowDown step the value, as they do in a native number field. */
|
|
10884
|
+
onKeydown(event) {
|
|
10885
|
+
if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown')
|
|
10886
|
+
return;
|
|
10887
|
+
event.preventDefault();
|
|
10888
|
+
if (this.readonly())
|
|
10889
|
+
return;
|
|
10890
|
+
this._stepBy(event.key === 'ArrowUp' ? 1 : -1);
|
|
10891
|
+
}
|
|
10892
|
+
// Private methods
|
|
10893
|
+
/**
|
|
10894
|
+
* Moves the value by one step in `direction`, rounded to the precision of the
|
|
10895
|
+
* step and the value so repeated steps never collect float error
|
|
10896
|
+
* (`0.1 + 0.2`). An empty field starts from the minimum, or zero.
|
|
10897
|
+
*/
|
|
10898
|
+
_stepBy(direction) {
|
|
10899
|
+
const value = this.value();
|
|
10900
|
+
if (value === null) {
|
|
10901
|
+
this._commit(this._clamp(this.min() ?? 0));
|
|
10902
|
+
return;
|
|
10903
|
+
}
|
|
10904
|
+
const step = this.step();
|
|
10905
|
+
const precision = Math.max(decimalPlaces(step), decimalPlaces(value));
|
|
10906
|
+
this._commit(this._clamp(Number((value + direction * step).toFixed(precision))));
|
|
10907
|
+
}
|
|
10908
|
+
/** Sets a value the field produced itself, and shows it in the field's own form. */
|
|
10909
|
+
_commit(value) {
|
|
10910
|
+
this.value.set(value);
|
|
10911
|
+
this.text.set(this._format(value));
|
|
10912
|
+
}
|
|
10913
|
+
/** Keeps `value` within `[min, max]`, where either is set. */
|
|
10914
|
+
_clamp(value) {
|
|
10666
10915
|
const min = this.min();
|
|
10667
10916
|
const max = this.max();
|
|
10668
|
-
|
|
10669
|
-
|
|
10670
|
-
|
|
10671
|
-
|
|
10672
|
-
|
|
10673
|
-
|
|
10674
|
-
|
|
10675
|
-
|
|
10676
|
-
|
|
10917
|
+
if (min !== undefined && value < min)
|
|
10918
|
+
return min;
|
|
10919
|
+
if (max !== undefined && value > max)
|
|
10920
|
+
return max;
|
|
10921
|
+
return value;
|
|
10922
|
+
}
|
|
10923
|
+
/** The text the field shows for `value`: empty for none. */
|
|
10924
|
+
_format(value) {
|
|
10925
|
+
if (value === null)
|
|
10926
|
+
return '';
|
|
10927
|
+
return this._formatter().format(value);
|
|
10677
10928
|
}
|
|
10678
10929
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: InputNumber, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
10679
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: InputNumber, isStandalone: true, selector: "tls-input-number", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null },
|
|
10930
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: InputNumber, isStandalone: true, selector: "tls-input-number", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, inputMode: { classPropertyName: "inputMode", publicName: "inputMode", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => InputNumber) }], usesInheritance: true, ngImport: i0, template: "<!-- Text rather than `type=\"number\"`: the field reads the number itself (see\n the component's documentation). `autocorrect` and `spellcheck` are off so\n the keyboard never rewrites a figure as a word. -->\n<input\n type=\"text\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"effectiveInputId()\"\n [attr.inputmode]=\"effectiveInputMode()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"text()\"\n (beforeinput)=\"onBeforeInput($event)\"\n (input)=\"onInput($event)\"\n (change)=\"onChange()\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"touched.set(true)\"\n/>\n@if (pending()) {\n <tls-loader class=\"tls-form-control__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n", styles: [":host{--tls-input-number-width: 200px;position:relative;display:inline-block;width:var(--tls-input-number-width)}:host .tls-form-control{width:100%}:host .tls-form-control__spinner{position:absolute;inset-block:0;inset-inline-end:var(--spacing-3);margin-block:auto;pointer-events:none}:host .tls-form-control--pending{padding-inline-end:var(--spacing-8)}:host:has(.tls-form-control--fluid){--tls-input-number-width: 100%}\n"], dependencies: [{ kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }] });
|
|
10680
10931
|
}
|
|
10681
10932
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: InputNumber, decorators: [{
|
|
10682
10933
|
type: Component,
|
|
10683
|
-
args: [{ selector: 'tls-input-number', imports: [Loader], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => InputNumber) }], template: "<input\n type=\"
|
|
10684
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }],
|
|
10934
|
+
args: [{ selector: 'tls-input-number', imports: [Loader], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => InputNumber) }], template: "<!-- Text rather than `type=\"number\"`: the field reads the number itself (see\n the component's documentation). `autocorrect` and `spellcheck` are off so\n the keyboard never rewrites a figure as a word. -->\n<input\n type=\"text\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"effectiveInputId()\"\n [attr.inputmode]=\"effectiveInputMode()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"text()\"\n (beforeinput)=\"onBeforeInput($event)\"\n (input)=\"onInput($event)\"\n (change)=\"onChange()\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"touched.set(true)\"\n/>\n@if (pending()) {\n <tls-loader class=\"tls-form-control__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n", styles: [":host{--tls-input-number-width: 200px;position:relative;display:inline-block;width:var(--tls-input-number-width)}:host .tls-form-control{width:100%}:host .tls-form-control__spinner{position:absolute;inset-block:0;inset-inline-end:var(--spacing-3);margin-block:auto;pointer-events:none}:host .tls-form-control--pending{padding-inline-end:var(--spacing-8)}:host:has(.tls-form-control--fluid){--tls-input-number-width: 100%}\n"] }]
|
|
10935
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], inputMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputMode", required: false }] }] } });
|
|
10685
10936
|
|
|
10686
10937
|
/**
|
|
10687
10938
|
* Token characters recognised inside a mask pattern; every other character is a
|
|
@@ -13097,6 +13348,8 @@ const DEFAULT_INFINITE_SCROLL_CONFIG = {
|
|
|
13097
13348
|
loading: 'Loading more items',
|
|
13098
13349
|
complete: 'No more items',
|
|
13099
13350
|
loadMore: 'Load more',
|
|
13351
|
+
failed: "Couldn't load more items",
|
|
13352
|
+
retry: 'Try again',
|
|
13100
13353
|
},
|
|
13101
13354
|
};
|
|
13102
13355
|
|
|
@@ -13130,10 +13383,12 @@ const INFINITE_SCROLL_CONFIG = new InjectionToken('INFINITE_SCROLL_CONFIG', { fa
|
|
|
13130
13383
|
*
|
|
13131
13384
|
* Content that grows without end leaves anything below it unreachable, so the automatic
|
|
13132
13385
|
* loads are rationed: after `autoLoadLimit` of them in a row the component stops watching
|
|
13133
|
-
* and renders a button, and the allowance is renewed each time that button is used.
|
|
13134
|
-
*
|
|
13135
|
-
*
|
|
13136
|
-
* —
|
|
13386
|
+
* and renders a button, and the allowance is renewed each time that button is used. A page
|
|
13387
|
+
* that fails to arrive is reported through `failed`, which renders a notice and a button to
|
|
13388
|
+
* try again in place of loading on approach. The four states each accept replacement
|
|
13389
|
+
* content — `[tlsInfiniteScrollLoading]`, `[tlsInfiniteScrollComplete]`,
|
|
13390
|
+
* `[tlsInfiniteScrollTrigger]`, `[tlsInfiniteScrollFailed]` — projected in place of the
|
|
13391
|
+
* loader, the end notice, the button and the failure notice with its button:
|
|
13137
13392
|
*
|
|
13138
13393
|
* ```html
|
|
13139
13394
|
* <tls-infinite-scroll [loading]="loading()" (loadMore)="loadNextPage()">
|
|
@@ -13147,8 +13402,9 @@ const INFINITE_SCROLL_CONFIG = new InjectionToken('INFINITE_SCROLL_CONFIG', { fa
|
|
|
13147
13402
|
* Left unset inside a panel, the next page is therefore requested only as the sentinel
|
|
13148
13403
|
* reaches the panel's edge; pass that panel as `root` to get the margin back.
|
|
13149
13404
|
*
|
|
13150
|
-
* The end
|
|
13151
|
-
* replacement content belongs with a label that says the
|
|
13405
|
+
* The end and failure notices are announced from `labels.complete` and `labels.failed`,
|
|
13406
|
+
* whatever stands in their slots, so replacement content belongs with a label that says the
|
|
13407
|
+
* same thing.
|
|
13152
13408
|
*/
|
|
13153
13409
|
class InfiniteScroll {
|
|
13154
13410
|
// Injections
|
|
@@ -13170,6 +13426,13 @@ class InfiniteScroll {
|
|
|
13170
13426
|
* everything ends silently.
|
|
13171
13427
|
*/
|
|
13172
13428
|
complete = input(false, { ...(ngDevMode ? { debugName: "complete" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
13429
|
+
/**
|
|
13430
|
+
* Whether the last page asked for failed to arrive. Stops loading on approach — retrying a
|
|
13431
|
+
* failure every time the sentinel comes into view would hammer whatever is failing — and
|
|
13432
|
+
* renders the failure notice with a button that asks for the page again. Lowering it, as
|
|
13433
|
+
* the next attempt starts, resumes the cycle.
|
|
13434
|
+
*/
|
|
13435
|
+
failed = input(false, { ...(ngDevMode ? { debugName: "failed" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
13173
13436
|
/**
|
|
13174
13437
|
* Suspends the whole trigger without ending it: nothing is watched, nothing is rendered,
|
|
13175
13438
|
* and the automatic allowance is kept for when it is lifted.
|
|
@@ -13232,6 +13495,8 @@ class InfiniteScroll {
|
|
|
13232
13495
|
return this._hasRequested() ? 'complete' : 'settled';
|
|
13233
13496
|
if (this.loading())
|
|
13234
13497
|
return 'loading';
|
|
13498
|
+
if (this.failed())
|
|
13499
|
+
return 'failed';
|
|
13235
13500
|
const limit = this.autoLoadLimit();
|
|
13236
13501
|
if (this.manual() || (limit > 0 && this._automaticLoads() >= limit))
|
|
13237
13502
|
return 'manual';
|
|
@@ -13245,6 +13510,8 @@ class InfiniteScroll {
|
|
|
13245
13510
|
return this.labels.loading;
|
|
13246
13511
|
if (state === 'complete')
|
|
13247
13512
|
return this.labels.complete;
|
|
13513
|
+
if (state === 'failed')
|
|
13514
|
+
return this.labels.failed;
|
|
13248
13515
|
return '';
|
|
13249
13516
|
}, /* @ts-ignore */
|
|
13250
13517
|
...(ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []));
|
|
@@ -13297,12 +13564,13 @@ class InfiniteScroll {
|
|
|
13297
13564
|
}
|
|
13298
13565
|
// Public methods
|
|
13299
13566
|
/**
|
|
13300
|
-
* Requests the next page as the button does, renewing the automatic allowance
|
|
13301
|
-
* while a page is in flight, once the collection is
|
|
13567
|
+
* Requests the next page as the button does, renewing the automatic allowance — after a
|
|
13568
|
+
* failure, the page that failed. Ignored while a page is in flight, once the collection is
|
|
13569
|
+
* exhausted and while suspended.
|
|
13302
13570
|
*/
|
|
13303
13571
|
load() {
|
|
13304
13572
|
const state = this.state();
|
|
13305
|
-
if (state !== 'idle' && state !== 'manual')
|
|
13573
|
+
if (state !== 'idle' && state !== 'manual' && state !== 'failed')
|
|
13306
13574
|
return;
|
|
13307
13575
|
this._automaticLoads.set(0);
|
|
13308
13576
|
this._emit();
|
|
@@ -13332,14 +13600,14 @@ class InfiniteScroll {
|
|
|
13332
13600
|
this.loadMore.emit();
|
|
13333
13601
|
}
|
|
13334
13602
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: InfiniteScroll, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
13335
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: InfiniteScroll, isStandalone: true, selector: "tls-infinite-scroll", inputs: { loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, complete: { classPropertyName: "complete", publicName: "complete", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, manual: { classPropertyName: "manual", publicName: "manual", isSignal: true, isRequired: false, transformFunction: null }, rootMargin: { classPropertyName: "rootMargin", publicName: "rootMargin", isSignal: true, isRequired: false, transformFunction: null }, autoLoadLimit: { classPropertyName: "autoLoadLimit", publicName: "autoLoadLimit", isSignal: true, isRequired: false, transformFunction: null }, root: { classPropertyName: "root", publicName: "root", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { loadMore: "loadMore" }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0, template: "<!--\n A live region is only announced reliably when it is already in the DOM before its text\n changes, so the region is permanent and the states write into it. The visual side of\n those states is hidden from assistive technology to keep the notice from being read twice.\n-->\n<div class=\"announcement\" role=\"status\">{{ announcement() }}</div>\n\n@switch (state()) {\n @case ('loading') {\n <div class=\"state\" aria-hidden=\"true\">\n <ng-content select=\"[tlsInfiniteScrollLoading]\">\n <tls-loader size=\"sm\" />\n </ng-content>\n </div>\n }\n @case ('complete') {\n <div class=\"state\" aria-hidden=\"true\">\n <ng-content select=\"[tlsInfiniteScrollComplete]\">\n <span class=\"notice\">{{ labels.complete }}</span>\n </ng-content>\n </div>\n }\n @case ('manual') {\n <div class=\"state\">\n <ng-content select=\"[tlsInfiniteScrollTrigger]\">\n <tls-button variant=\"tonal\" [label]=\"labels.loadMore\" (click)=\"load()\" />\n </ng-content>\n </div>\n }\n}\n", styles: [":host{min-height:1px;display:block}:host .announcement{position:absolute;inset-block-start:0;inset-inline-start:0;width:1px;height:1px;margin:-1px;padding:0;border:0;white-space:nowrap;overflow:hidden;clip-path:inset(50%)}:host .state{padding-block:var(--spacing-4);display:flex;align-items:center;justify-content:center}:host .notice{font-size:var(--font-body-small-size);line-height:var(--font-body-small-line-height);letter-spacing:var(--font-body-small-letter-spacing);color:var(--color-on-surface-variant)}\n"], dependencies: [{ kind: "component", type: Button, selector: "tls-button", inputs: ["busy", "label", "ariaLabel", "ariaLabelledby", "type", "href", "tabindex"] }, { kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }] });
|
|
13603
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: InfiniteScroll, isStandalone: true, selector: "tls-infinite-scroll", inputs: { loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, complete: { classPropertyName: "complete", publicName: "complete", isSignal: true, isRequired: false, transformFunction: null }, failed: { classPropertyName: "failed", publicName: "failed", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, manual: { classPropertyName: "manual", publicName: "manual", isSignal: true, isRequired: false, transformFunction: null }, rootMargin: { classPropertyName: "rootMargin", publicName: "rootMargin", isSignal: true, isRequired: false, transformFunction: null }, autoLoadLimit: { classPropertyName: "autoLoadLimit", publicName: "autoLoadLimit", isSignal: true, isRequired: false, transformFunction: null }, root: { classPropertyName: "root", publicName: "root", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { loadMore: "loadMore" }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0, template: "<!--\n A live region is only announced reliably when it is already in the DOM before its text\n changes, so the region is permanent and the states write into it. The visual side of\n those states is hidden from assistive technology to keep the notice from being read twice.\n-->\n<div class=\"announcement\" role=\"status\">{{ announcement() }}</div>\n\n@switch (state()) {\n @case ('loading') {\n <div class=\"state\" aria-hidden=\"true\">\n <ng-content select=\"[tlsInfiniteScrollLoading]\">\n <tls-loader size=\"sm\" />\n </ng-content>\n </div>\n }\n @case ('complete') {\n <div class=\"state\" aria-hidden=\"true\">\n <ng-content select=\"[tlsInfiniteScrollComplete]\">\n <span class=\"notice\">{{ labels.complete }}</span>\n </ng-content>\n </div>\n }\n @case ('failed') {\n <!-- Hidden from assistive technology like the end notice: the live region above\n announces the failure, and the button stays reachable on its own. -->\n <div class=\"state state--failed\">\n <ng-content select=\"[tlsInfiniteScrollFailed]\">\n <span class=\"notice\" aria-hidden=\"true\">{{ labels.failed }}</span>\n <tls-button variant=\"tonal\" [label]=\"labels.retry\" (click)=\"load()\" />\n </ng-content>\n </div>\n }\n @case ('manual') {\n <div class=\"state\">\n <ng-content select=\"[tlsInfiniteScrollTrigger]\">\n <tls-button variant=\"tonal\" [label]=\"labels.loadMore\" (click)=\"load()\" />\n </ng-content>\n </div>\n }\n}\n", styles: [":host{min-height:1px;display:block}:host .announcement{position:absolute;inset-block-start:0;inset-inline-start:0;width:1px;height:1px;margin:-1px;padding:0;border:0;white-space:nowrap;overflow:hidden;clip-path:inset(50%)}:host .state{padding-block:var(--spacing-4);display:flex;align-items:center;justify-content:center}:host .state--failed{flex-direction:column;gap:var(--spacing-2)}:host .notice{font-size:var(--font-body-small-size);line-height:var(--font-body-small-line-height);letter-spacing:var(--font-body-small-letter-spacing);color:var(--color-on-surface-variant)}\n"], dependencies: [{ kind: "component", type: Button, selector: "tls-button", inputs: ["busy", "label", "ariaLabel", "ariaLabelledby", "type", "href", "tabindex"] }, { kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }] });
|
|
13336
13604
|
}
|
|
13337
13605
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: InfiniteScroll, decorators: [{
|
|
13338
13606
|
type: Component,
|
|
13339
13607
|
args: [{ selector: 'tls-infinite-scroll', imports: [Button, Loader], host: {
|
|
13340
13608
|
'[class]': 'hostClasses()',
|
|
13341
|
-
}, template: "<!--\n A live region is only announced reliably when it is already in the DOM before its text\n changes, so the region is permanent and the states write into it. The visual side of\n those states is hidden from assistive technology to keep the notice from being read twice.\n-->\n<div class=\"announcement\" role=\"status\">{{ announcement() }}</div>\n\n@switch (state()) {\n @case ('loading') {\n <div class=\"state\" aria-hidden=\"true\">\n <ng-content select=\"[tlsInfiniteScrollLoading]\">\n <tls-loader size=\"sm\" />\n </ng-content>\n </div>\n }\n @case ('complete') {\n <div class=\"state\" aria-hidden=\"true\">\n <ng-content select=\"[tlsInfiniteScrollComplete]\">\n <span class=\"notice\">{{ labels.complete }}</span>\n </ng-content>\n </div>\n }\n @case ('manual') {\n <div class=\"state\">\n <ng-content select=\"[tlsInfiniteScrollTrigger]\">\n <tls-button variant=\"tonal\" [label]=\"labels.loadMore\" (click)=\"load()\" />\n </ng-content>\n </div>\n }\n}\n", styles: [":host{min-height:1px;display:block}:host .announcement{position:absolute;inset-block-start:0;inset-inline-start:0;width:1px;height:1px;margin:-1px;padding:0;border:0;white-space:nowrap;overflow:hidden;clip-path:inset(50%)}:host .state{padding-block:var(--spacing-4);display:flex;align-items:center;justify-content:center}:host .notice{font-size:var(--font-body-small-size);line-height:var(--font-body-small-line-height);letter-spacing:var(--font-body-small-letter-spacing);color:var(--color-on-surface-variant)}\n"] }]
|
|
13342
|
-
}], ctorParameters: () => [], propDecorators: { loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], complete: [{ type: i0.Input, args: [{ isSignal: true, alias: "complete", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], manual: [{ type: i0.Input, args: [{ isSignal: true, alias: "manual", required: false }] }], rootMargin: [{ type: i0.Input, args: [{ isSignal: true, alias: "rootMargin", required: false }] }], autoLoadLimit: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoLoadLimit", required: false }] }], root: [{ type: i0.Input, args: [{ isSignal: true, alias: "root", required: false }] }], loadMore: [{ type: i0.Output, args: ["loadMore"] }] } });
|
|
13609
|
+
}, template: "<!--\n A live region is only announced reliably when it is already in the DOM before its text\n changes, so the region is permanent and the states write into it. The visual side of\n those states is hidden from assistive technology to keep the notice from being read twice.\n-->\n<div class=\"announcement\" role=\"status\">{{ announcement() }}</div>\n\n@switch (state()) {\n @case ('loading') {\n <div class=\"state\" aria-hidden=\"true\">\n <ng-content select=\"[tlsInfiniteScrollLoading]\">\n <tls-loader size=\"sm\" />\n </ng-content>\n </div>\n }\n @case ('complete') {\n <div class=\"state\" aria-hidden=\"true\">\n <ng-content select=\"[tlsInfiniteScrollComplete]\">\n <span class=\"notice\">{{ labels.complete }}</span>\n </ng-content>\n </div>\n }\n @case ('failed') {\n <!-- Hidden from assistive technology like the end notice: the live region above\n announces the failure, and the button stays reachable on its own. -->\n <div class=\"state state--failed\">\n <ng-content select=\"[tlsInfiniteScrollFailed]\">\n <span class=\"notice\" aria-hidden=\"true\">{{ labels.failed }}</span>\n <tls-button variant=\"tonal\" [label]=\"labels.retry\" (click)=\"load()\" />\n </ng-content>\n </div>\n }\n @case ('manual') {\n <div class=\"state\">\n <ng-content select=\"[tlsInfiniteScrollTrigger]\">\n <tls-button variant=\"tonal\" [label]=\"labels.loadMore\" (click)=\"load()\" />\n </ng-content>\n </div>\n }\n}\n", styles: [":host{min-height:1px;display:block}:host .announcement{position:absolute;inset-block-start:0;inset-inline-start:0;width:1px;height:1px;margin:-1px;padding:0;border:0;white-space:nowrap;overflow:hidden;clip-path:inset(50%)}:host .state{padding-block:var(--spacing-4);display:flex;align-items:center;justify-content:center}:host .state--failed{flex-direction:column;gap:var(--spacing-2)}:host .notice{font-size:var(--font-body-small-size);line-height:var(--font-body-small-line-height);letter-spacing:var(--font-body-small-letter-spacing);color:var(--color-on-surface-variant)}\n"] }]
|
|
13610
|
+
}], ctorParameters: () => [], propDecorators: { loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], complete: [{ type: i0.Input, args: [{ isSignal: true, alias: "complete", required: false }] }], failed: [{ type: i0.Input, args: [{ isSignal: true, alias: "failed", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], manual: [{ type: i0.Input, args: [{ isSignal: true, alias: "manual", required: false }] }], rootMargin: [{ type: i0.Input, args: [{ isSignal: true, alias: "rootMargin", required: false }] }], autoLoadLimit: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoLoadLimit", required: false }] }], root: [{ type: i0.Input, args: [{ isSignal: true, alias: "root", required: false }] }], loadMore: [{ type: i0.Output, args: ["loadMore"] }] } });
|
|
13343
13611
|
|
|
13344
13612
|
const DEFAULT_KBD_CONFIG = {
|
|
13345
13613
|
size: 'md',
|
|
@@ -15777,6 +16045,7 @@ class SwipeActions {
|
|
|
15777
16045
|
// Injections
|
|
15778
16046
|
_config = inject(SWIPE_ACTIONS_CONFIG);
|
|
15779
16047
|
_directionality = inject(Directionality);
|
|
16048
|
+
_hapticFeedback = inject(HAPTIC_FEEDBACK);
|
|
15780
16049
|
// View children
|
|
15781
16050
|
contentElement = viewChild.required('content');
|
|
15782
16051
|
startPanel = viewChild('startPanel', /* @ts-ignore */
|
|
@@ -15930,8 +16199,10 @@ class SwipeActions {
|
|
|
15930
16199
|
}
|
|
15931
16200
|
/**
|
|
15932
16201
|
* Tracks whether releasing at this reveal would commit, mirroring the answer
|
|
15933
|
-
* onto the panels as a class and onto `armedChanged
|
|
15934
|
-
*
|
|
16202
|
+
* onto the panels as a class and onto `armedChanged`, and marking the moment
|
|
16203
|
+
* it arms with a light haptic tap, as a native list's full swipe does. The
|
|
16204
|
+
* writes bypass bindings: this runs on the move stream, outside the Angular
|
|
16205
|
+
* zone.
|
|
15935
16206
|
*/
|
|
15936
16207
|
_updateArmed(offset) {
|
|
15937
16208
|
const armed = Math.abs(offset) >= this.commitThreshold();
|
|
@@ -15948,6 +16219,8 @@ class SwipeActions {
|
|
|
15948
16219
|
if (endPanel) {
|
|
15949
16220
|
endPanel.nativeElement.classList.toggle('tls-swipe-actions__panel--armed', armed && offset < 0);
|
|
15950
16221
|
}
|
|
16222
|
+
if (armed)
|
|
16223
|
+
this._hapticFeedback.impact('light');
|
|
15951
16224
|
this.armedChanged.emit(armed);
|
|
15952
16225
|
}
|
|
15953
16226
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SwipeActions, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -16981,15 +17254,26 @@ const provideThalassicUIConfig = (config = {}) => {
|
|
|
16981
17254
|
provide: RIPPLE_CONFIG,
|
|
16982
17255
|
useValue: deepMerge(DEFAULT_RIPPLE_CONFIG, config.ripple),
|
|
16983
17256
|
},
|
|
16984
|
-
// Reflect the touch-target opt-
|
|
16985
|
-
//
|
|
16986
|
-
//
|
|
17257
|
+
// Reflect the touch-target opt-in onto the document root, where the expansion reads
|
|
17258
|
+
// it. The overflow is transparent, so a late (browser-only) reflection causes no
|
|
17259
|
+
// visual flash.
|
|
17260
|
+
provideEnvironmentInitializer(() => {
|
|
17261
|
+
if (!accessibility.expandTouchTargets)
|
|
17262
|
+
return;
|
|
17263
|
+
if (!isPlatformBrowser(inject(PLATFORM_ID)))
|
|
17264
|
+
return;
|
|
17265
|
+
inject(DOCUMENT).documentElement.setAttribute('data-touch-targets', 'expanded');
|
|
17266
|
+
}),
|
|
17267
|
+
// Reflect the touch-control opt-in onto the document root, where the control height
|
|
17268
|
+
// scale reads it. Unlike the transparent hit area, the larger controls change layout,
|
|
17269
|
+
// so a page rendered on the server keeps the base heights until the browser reflects
|
|
17270
|
+
// the attribute.
|
|
16987
17271
|
provideEnvironmentInitializer(() => {
|
|
16988
|
-
if (accessibility.
|
|
17272
|
+
if (!accessibility.enlargeTouchControls)
|
|
16989
17273
|
return;
|
|
16990
17274
|
if (!isPlatformBrowser(inject(PLATFORM_ID)))
|
|
16991
17275
|
return;
|
|
16992
|
-
inject(DOCUMENT).documentElement.setAttribute('data-touch-
|
|
17276
|
+
inject(DOCUMENT).documentElement.setAttribute('data-touch-controls', 'large');
|
|
16993
17277
|
}),
|
|
16994
17278
|
// Cross-cutting form defaults
|
|
16995
17279
|
{
|