ng-primitives 0.36.0 → 0.37.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/accordion/accordion-trigger/accordion-trigger.d.ts +4 -0
- package/dialog/dialog-overlay/dialog-overlay.d.ts +7 -1
- package/dialog/dialog-trigger/dialog-trigger.d.ts +0 -2
- package/example-theme/index.css +2 -0
- package/fesm2022/ng-primitives-a11y.mjs +3 -3
- package/fesm2022/ng-primitives-accordion.mjs +18 -13
- package/fesm2022/ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/ng-primitives-autofill.mjs +4 -4
- package/fesm2022/ng-primitives-avatar.mjs +9 -9
- package/fesm2022/ng-primitives-button.mjs +3 -3
- package/fesm2022/ng-primitives-checkbox.mjs +4 -4
- package/fesm2022/ng-primitives-common.mjs +3 -3
- package/fesm2022/ng-primitives-date-picker.mjs +27 -27
- package/fesm2022/ng-primitives-dialog.mjs +30 -22
- package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/ng-primitives-file-upload.mjs +12 -8
- package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
- package/fesm2022/ng-primitives-focus-trap.mjs +31 -8
- package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -1
- package/fesm2022/ng-primitives-form-field.mjs +15 -15
- package/fesm2022/ng-primitives-input.mjs +3 -3
- package/fesm2022/ng-primitives-interactions.mjs +15 -15
- package/fesm2022/ng-primitives-internal.mjs +20 -47
- package/fesm2022/ng-primitives-internal.mjs.map +1 -1
- package/fesm2022/ng-primitives-listbox.mjs +12 -12
- package/fesm2022/ng-primitives-menu.mjs +13 -13
- package/fesm2022/ng-primitives-meter.mjs +164 -0
- package/fesm2022/ng-primitives-meter.mjs.map +1 -0
- package/fesm2022/ng-primitives-pagination.mjs +19 -19
- package/fesm2022/ng-primitives-popover.mjs +25 -15
- package/fesm2022/ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/ng-primitives-progress.mjs +6 -6
- package/fesm2022/ng-primitives-radio.mjs +9 -9
- package/fesm2022/ng-primitives-resize.mjs +3 -3
- package/fesm2022/ng-primitives-roving-focus.mjs +6 -6
- package/fesm2022/ng-primitives-search.mjs +7 -7
- package/fesm2022/ng-primitives-select.mjs +3 -3
- package/fesm2022/ng-primitives-separator.mjs +3 -3
- package/fesm2022/ng-primitives-slider.mjs +12 -12
- package/fesm2022/ng-primitives-switch.mjs +6 -6
- package/fesm2022/ng-primitives-tabs.mjs +21 -29
- package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/ng-primitives-textarea.mjs +3 -3
- package/fesm2022/ng-primitives-toast.mjs +3 -3
- package/fesm2022/ng-primitives-toggle-group.mjs +9 -14
- package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/ng-primitives-toggle.mjs +4 -4
- package/fesm2022/ng-primitives-toolbar.mjs +38 -14
- package/fesm2022/ng-primitives-toolbar.mjs.map +1 -1
- package/fesm2022/ng-primitives-tooltip.mjs +25 -19
- package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
- package/focus-trap/focus-trap/focus-trap-state.d.ts +41 -0
- package/focus-trap/focus-trap/focus-trap.d.ts +4 -0
- package/focus-trap/index.d.ts +1 -0
- package/form-field/form-control/form-control-state.d.ts +23 -23
- package/listbox/listbox/listbox-state.d.ts +2 -2
- package/meter/README.md +3 -0
- package/meter/index.d.ts +6 -0
- package/meter/meter/meter-state.d.ts +25 -0
- package/meter/meter/meter.d.ts +27 -0
- package/meter/meter-indicator/meter-indicator.d.ts +15 -0
- package/meter/meter-label/meter-label.d.ts +18 -0
- package/meter/meter-track/meter-track.d.ts +5 -0
- package/meter/meter-value/meter-value.d.ts +5 -0
- package/package.json +9 -5
- package/pagination/pagination/pagination-state.d.ts +2 -2
- package/pagination/pagination-first/pagination-first.d.ts +2 -2
- package/pagination/pagination-next/pagination-next.d.ts +2 -2
- package/pagination/pagination-previous/pagination-previous.d.ts +2 -2
- package/popover/popover/popover.d.ts +31 -1
- package/progress/progress/progress-state.d.ts +2 -2
- package/progress/progress-indicator/progress-indicator.d.ts +2 -2
- package/roving-focus/roving-focus-group/roving-focus-group-state.d.ts +6 -6
- package/schematics/ng-generate/schema.d.ts +2 -1
- package/schematics/ng-generate/schema.json +1 -0
- package/schematics/ng-generate/templates/meter/meter.__fileSuffix@dasherize__.ts.template +78 -0
- package/schematics/ng-generate/templates/pagination/pagination.__fileSuffix@dasherize__.ts.template +11 -11
- package/schematics/ng-generate/templates/slider/slider.__fileSuffix@dasherize__.ts.template +8 -3
- package/schematics/ng-generate/templates/toolbar/toolbar.__fileSuffix@dasherize__.ts.template +10 -2
- package/slider/slider/slider-state.d.ts +4 -4
- package/slider/slider-range/slider-range.d.ts +4 -4
- package/slider/slider-thumb/slider-thumb.d.ts +4 -4
- package/slider/slider-track/slider-track.d.ts +4 -4
- package/tabs/tab-button/tab-button.d.ts +7 -8
- package/tabs/tab-list/tab-list.d.ts +6 -7
- package/tabs/tab-panel/tab-panel.d.ts +11 -9
- package/tabs/tabset/tabset-state.d.ts +6 -7
- package/tabs/tabset/tabset.d.ts +3 -4
- package/toggle-group/toggle-group/toggle-group-state.d.ts +6 -6
- package/toggle-group/toggle-group/toggle-group.d.ts +1 -1
- package/toggle-group/toggle-group-item/toggle-group-item-state.d.ts +12 -12
- package/toolbar/index.d.ts +1 -0
- package/toolbar/toolbar/toolbar-state.d.ts +39 -0
- package/toolbar/toolbar/toolbar.d.ts +10 -1
- package/tooltip/tooltip-trigger/tooltip-trigger.d.ts +6 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, ElementRef, ViewContainerRef, Injector, input, booleanAttribute, numberAttribute,
|
|
2
|
+
import { InjectionToken, inject, ElementRef, ViewContainerRef, Injector, input, booleanAttribute, numberAttribute, signal, computed, TemplateRef, Type, ComponentRef, Directive, PLATFORM_ID, isDevMode } from '@angular/core';
|
|
3
3
|
import { TemplatePortal, ComponentPortal, DomPortalOutlet } from '@angular/cdk/portal';
|
|
4
4
|
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
5
5
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
@@ -175,7 +175,7 @@ class NgpTooltipTrigger {
|
|
|
175
175
|
/**
|
|
176
176
|
* Store the tooltip view ref.
|
|
177
177
|
*/
|
|
178
|
-
this.viewRef = null;
|
|
178
|
+
this.viewRef = signal(null);
|
|
179
179
|
/**
|
|
180
180
|
* Derive the tooltip middleware from the provided configuration.
|
|
181
181
|
*/
|
|
@@ -199,6 +199,11 @@ class NgpTooltipTrigger {
|
|
|
199
199
|
* Store the trigger width.
|
|
200
200
|
*/
|
|
201
201
|
this.width = signal(null);
|
|
202
|
+
/**
|
|
203
|
+
* @internal
|
|
204
|
+
* Whether the tooltip is open or not.
|
|
205
|
+
*/
|
|
206
|
+
this.open = computed(() => this.viewRef() !== null);
|
|
202
207
|
/**
|
|
203
208
|
* Store the state of the tooltip.
|
|
204
209
|
* @internal
|
|
@@ -226,7 +231,7 @@ class NgpTooltipTrigger {
|
|
|
226
231
|
return;
|
|
227
232
|
}
|
|
228
233
|
// if the tooltip exists in the DOM then do not create it again
|
|
229
|
-
if (this.viewRef) {
|
|
234
|
+
if (this.viewRef()) {
|
|
230
235
|
return;
|
|
231
236
|
}
|
|
232
237
|
this.openTimeout = this.disposables.setTimeout(() => this.createTooltip(), this.state.showDelay());
|
|
@@ -265,15 +270,16 @@ class NgpTooltipTrigger {
|
|
|
265
270
|
throw new Error('Tooltip must be either a TemplateRef or a ComponentType');
|
|
266
271
|
}
|
|
267
272
|
const domOutlet = new DomPortalOutlet(this.state.container() ?? this.document.body, undefined, undefined, injector);
|
|
268
|
-
|
|
273
|
+
const viewRef = domOutlet.attach(portal);
|
|
274
|
+
this.viewRef.set(viewRef);
|
|
269
275
|
let outletElement = null;
|
|
270
|
-
if (
|
|
271
|
-
|
|
272
|
-
outletElement =
|
|
276
|
+
if (viewRef instanceof ComponentRef) {
|
|
277
|
+
viewRef.changeDetectorRef.detectChanges();
|
|
278
|
+
outletElement = viewRef.location.nativeElement;
|
|
273
279
|
}
|
|
274
|
-
else if (
|
|
275
|
-
|
|
276
|
-
outletElement =
|
|
280
|
+
else if (viewRef) {
|
|
281
|
+
viewRef.detectChanges();
|
|
282
|
+
outletElement = viewRef.rootNodes[0];
|
|
277
283
|
}
|
|
278
284
|
if (!outletElement) {
|
|
279
285
|
throw new Error('Outlet element is not available.');
|
|
@@ -293,21 +299,21 @@ class NgpTooltipTrigger {
|
|
|
293
299
|
async destroyTooltip() {
|
|
294
300
|
this.closeTimeout = undefined;
|
|
295
301
|
await this.exitAnimationManager.exit();
|
|
296
|
-
this.viewRef?.destroy();
|
|
297
|
-
this.viewRef
|
|
302
|
+
this.viewRef()?.destroy();
|
|
303
|
+
this.viewRef.set(null);
|
|
298
304
|
this.dispose?.();
|
|
299
305
|
}
|
|
300
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
301
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.
|
|
306
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpTooltipTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
307
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpTooltipTrigger, isStandalone: true, selector: "[ngpTooltipTrigger]", inputs: { tooltip: { classPropertyName: "tooltip", publicName: "ngpTooltipTrigger", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpTooltipTriggerDisabled", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "ngpTooltipTriggerPlacement", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "ngpTooltipTriggerOffset", isSignal: true, isRequired: false, transformFunction: null }, showDelay: { classPropertyName: "showDelay", publicName: "ngpTooltipTriggerShowDelay", isSignal: true, isRequired: false, transformFunction: null }, hideDelay: { classPropertyName: "hideDelay", publicName: "ngpTooltipTriggerHideDelay", isSignal: true, isRequired: false, transformFunction: null }, flip: { classPropertyName: "flip", publicName: "ngpTooltipTriggerFlip", isSignal: true, isRequired: false, transformFunction: null }, container: { classPropertyName: "container", publicName: "ngpTooltipTriggerContainer", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "ngpTooltipTriggerContext", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mouseenter": "show()", "mouseleave": "hide()", "focus": "show()", "blur": "hide()" }, properties: { "attr.data-open": "open() ? \"\" : null", "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideTooltipTriggerState(), provideExitAnimationManager()], exportAs: ["ngpTooltipTrigger"], ngImport: i0 }); }
|
|
302
308
|
}
|
|
303
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
309
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpTooltipTrigger, decorators: [{
|
|
304
310
|
type: Directive,
|
|
305
311
|
args: [{
|
|
306
312
|
selector: '[ngpTooltipTrigger]',
|
|
307
313
|
exportAs: 'ngpTooltipTrigger',
|
|
308
314
|
providers: [provideTooltipTriggerState(), provideExitAnimationManager()],
|
|
309
315
|
host: {
|
|
310
|
-
'[attr.data-open]': '
|
|
316
|
+
'[attr.data-open]': 'open() ? "" : null',
|
|
311
317
|
'[attr.data-disabled]': 'state.disabled() ? "" : null',
|
|
312
318
|
'(mouseenter)': 'show()',
|
|
313
319
|
'(mouseleave)': 'hide()',
|
|
@@ -356,10 +362,10 @@ class NgpTooltip {
|
|
|
356
362
|
}
|
|
357
363
|
}
|
|
358
364
|
}
|
|
359
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
360
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.
|
|
365
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpTooltip, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
366
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: NgpTooltip, isStandalone: true, selector: "[ngpTooltip]", host: { attributes: { "role": "tooltip" }, properties: { "style.left.px": "x()", "style.top.px": "y()", "style.--ngp-tooltip-trigger-width.px": "trigger().width()", "style.--ngp-tooltip-transform-origin": "transformOrigin()" } }, exportAs: ["ngpTooltip"], hostDirectives: [{ directive: i1.NgpExitAnimation }], ngImport: i0 }); }
|
|
361
367
|
}
|
|
362
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
368
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpTooltip, decorators: [{
|
|
363
369
|
type: Directive,
|
|
364
370
|
args: [{
|
|
365
371
|
selector: '[ngpTooltip]',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-tooltip.mjs","sources":["../../../../packages/ng-primitives/tooltip/src/config/tooltip-config.ts","../../../../packages/ng-primitives/tooltip/src/tooltip/tooltip-token.ts","../../../../packages/ng-primitives/tooltip/src/tooltip-trigger/tooltip-trigger-state.ts","../../../../packages/ng-primitives/tooltip/src/tooltip-trigger/tooltip-trigger.ts","../../../../packages/ng-primitives/tooltip/src/tooltip/tooltip.ts","../../../../packages/ng-primitives/tooltip/src/ng-primitives-tooltip.ts"],"sourcesContent":["import { InjectionToken, Provider, inject } from '@angular/core';\nimport { type Placement } from '@floating-ui/dom';\n\nexport interface NgpTooltipConfig {\n /**\n * Define the offset of the tooltip relative to the trigger.\n * @default 4\n */\n offset: number;\n\n /**\n * Define the placement of the tooltip relative to the trigger.\n * @default 'top'\n */\n placement: Placement;\n\n /**\n * Define the delay before the tooltip is shown.\n * @default 0\n */\n showDelay: number;\n\n /**\n * Define the delay before the tooltip is hidden.\n * @default 0\n */\n hideDelay: number;\n\n /**\n * Define whether the tooltip should flip when there is not enough space for the tooltip.\n * @default true\n */\n flip: boolean;\n\n /**\n * Define the container in to which the tooltip should be attached.\n * @default document.body\n */\n container: HTMLElement | null;\n}\n\nexport const defaultTooltipConfig: NgpTooltipConfig = {\n offset: 4,\n placement: 'top',\n showDelay: 0,\n hideDelay: 0,\n flip: true,\n container: null,\n};\n\nexport const NgpTooltipConfigToken = new InjectionToken<NgpTooltipConfig>('NgpTooltipConfigToken');\n\n/**\n * Provide the default Tooltip configuration\n * @param config The Tooltip configuration\n * @returns The provider\n */\nexport function provideTooltipConfig(config: Partial<NgpTooltipConfig>): Provider[] {\n return [\n {\n provide: NgpTooltipConfigToken,\n useValue: { ...defaultTooltipConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the Tooltip configuration\n * @returns The global Tooltip configuration\n */\nexport function injectTooltipConfig(): NgpTooltipConfig {\n return inject(NgpTooltipConfigToken, { optional: true }) ?? defaultTooltipConfig;\n}\n","import { inject, InjectionToken, ValueProvider } from '@angular/core';\n\nexport const NgpTooltipContextToken = new InjectionToken<unknown>('NgpTooltipContextToken');\n\n/**\n * Inject the Tooltip context\n */\nexport function injectTooltipContext<T>(): T {\n return inject(NgpTooltipContextToken) as T;\n}\n\n/**\n * Provide the Tooltip directive instance\n */\nexport function provideTooltipContext<T>(context: T): ValueProvider {\n return { provide: NgpTooltipContextToken, useValue: context };\n}\n","import { Signal } from '@angular/core';\nimport {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n State,\n} from 'ng-primitives/state';\nimport type { NgpTooltipTrigger } from './tooltip-trigger';\n\n/**\n * The state token for the TooltipTrigger primitive.\n */\nexport const NgpTooltipTriggerStateToken =\n createStateToken<NgpTooltipTrigger<unknown>>('TooltipTrigger');\n\n/**\n * Provides the TooltipTrigger state.\n */\nexport const provideTooltipTriggerState = createStateProvider(NgpTooltipTriggerStateToken);\n\n/**\n * Injects the TooltipTrigger state.\n */\nexport const injectTooltipTriggerState = createStateInjector(NgpTooltipTriggerStateToken) as <\n T,\n>() => Signal<State<NgpTooltipTrigger<T>>>;\n\n/**\n * The TooltipTrigger state registration function.\n */\nexport const tooltipTriggerState = createState(NgpTooltipTriggerStateToken);\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport { ComponentPortal, DomPortalOutlet, TemplatePortal } from '@angular/cdk/portal';\nimport { DOCUMENT } from '@angular/common';\nimport {\n ComponentRef,\n Directive,\n ElementRef,\n EmbeddedViewRef,\n Injector,\n OnDestroy,\n TemplateRef,\n Type,\n ViewContainerRef,\n booleanAttribute,\n computed,\n inject,\n input,\n numberAttribute,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n Middleware,\n Placement,\n autoUpdate,\n computePosition,\n flip,\n offset,\n shift,\n} from '@floating-ui/dom';\nimport { injectExitAnimationManager, provideExitAnimationManager } from 'ng-primitives/internal';\nimport { fromResizeEvent } from 'ng-primitives/resize';\nimport { injectDisposables } from 'ng-primitives/utils';\nimport { injectTooltipConfig } from '../config/tooltip-config';\nimport { provideTooltipContext } from '../tooltip/tooltip-token';\nimport { provideTooltipTriggerState, tooltipTriggerState } from './tooltip-trigger-state';\n\n/**\n * Apply the `ngpTooltipTrigger` directive to an element that triggers the tooltip to show.\n */\n@Directive({\n selector: '[ngpTooltipTrigger]',\n exportAs: 'ngpTooltipTrigger',\n providers: [provideTooltipTriggerState(), provideExitAnimationManager()],\n host: {\n '[attr.data-open]': 'viewRef !== null ? \"\" : null',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '(mouseenter)': 'show()',\n '(mouseleave)': 'hide()',\n '(focus)': 'show()',\n '(blur)': 'hide()',\n },\n})\nexport class NgpTooltipTrigger<T = null> implements OnDestroy {\n /**\n * Access the exit animation manager.\n */\n private readonly exitAnimationManager = injectExitAnimationManager();\n\n /**\n * Access the trigger element\n */\n private readonly trigger = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the view container ref.\n */\n private readonly viewContainerRef = inject(ViewContainerRef);\n\n /**\n * Access the document.\n */\n private readonly document = inject(DOCUMENT);\n\n /**\n * Access the injector.\n */\n private readonly injector = inject(Injector);\n\n /**\n * Access the global tooltip configuration.\n */\n private readonly config = injectTooltipConfig();\n\n /**\n * Access the disposable utilities\n */\n private readonly disposables = injectDisposables();\n\n /**\n * Access the tooltip template ref.\n */\n readonly tooltip = input<NgpTooltipContent<T> | null>(null, {\n alias: 'ngpTooltipTrigger',\n });\n\n /**\n * Define if the trigger should be disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpTooltipTriggerDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Define the placement of the tooltip relative to the trigger.\n * @default 'top'\n */\n readonly placement = input<Placement>(this.config.placement, {\n alias: 'ngpTooltipTriggerPlacement',\n });\n\n /**\n * Define the offset of the tooltip relative to the trigger.\n * @default 0\n */\n readonly offset = input<number, NumberInput>(this.config.offset, {\n alias: 'ngpTooltipTriggerOffset',\n transform: numberAttribute,\n });\n\n /**\n * Define the delay before the tooltip is displayed.\n * @default 0\n */\n readonly showDelay = input<number, NumberInput>(this.config.showDelay, {\n alias: 'ngpTooltipTriggerShowDelay',\n transform: numberAttribute,\n });\n\n /**\n * Define the delay before the tooltip is hidden.\n * @default 0\n */\n readonly hideDelay = input<number, NumberInput>(this.config.hideDelay, {\n alias: 'ngpTooltipTriggerHideDelay',\n transform: numberAttribute,\n });\n\n /**\n * Define whether the tooltip should flip when there is not enough space for the tooltip.\n * @default true\n */\n readonly flip = input<boolean, BooleanInput>(this.config.flip, {\n alias: 'ngpTooltipTriggerFlip',\n transform: booleanAttribute,\n });\n\n /**\n * Define the container in which the tooltip should be attached.\n * @default document.body\n */\n readonly container = input<HTMLElement | null>(this.config.container, {\n alias: 'ngpTooltipTriggerContainer',\n });\n\n /**\n * Provide context to the tooltip.\n * @default null\n */\n readonly context = input<T | null>(null, {\n alias: 'ngpTooltipTriggerContext',\n });\n\n /**\n * Store the tooltip view ref.\n */\n protected viewRef: ComponentRef<unknown> | EmbeddedViewRef<T> | null = null;\n\n /**\n * Derive the tooltip middleware from the provided configuration.\n */\n private readonly middleware = computed(() => {\n const middleware: Middleware[] = [offset(this.state.offset()), shift()];\n\n if (this.state.flip()) {\n middleware.push(flip());\n }\n\n return middleware;\n });\n\n /**\n * Store the computed position of the tooltip.\n * @internal\n */\n readonly position = signal<{ x: number; y: number }>({\n x: 0,\n y: 0,\n });\n\n /**\n * The dispose function to stop computing the position of the tooltip.\n */\n private dispose?: () => void;\n\n /**\n * @internal\n * Store the trigger width.\n */\n readonly width = signal<number | null>(null);\n\n /**\n * @internal\n * The timeout to open the tooltip.\n */\n private openTimeout?: () => void;\n\n /**\n * @internal\n * The timeout to close the tooltip.\n */\n private closeTimeout?: () => void;\n\n /**\n * Store the state of the tooltip.\n * @internal\n */\n readonly state = tooltipTriggerState<NgpTooltipTrigger<T>>(this);\n\n constructor() {\n // update the width of the trigger when it resizes\n fromResizeEvent(this.trigger.nativeElement)\n .pipe(takeUntilDestroyed())\n .subscribe(() => this.width.set(this.trigger.nativeElement.offsetWidth));\n }\n\n ngOnDestroy(): void {\n this.destroyTooltip();\n }\n\n /**\n * Show the tooltip.\n */\n show(): void {\n // if closing is in progress then clear the timeout to stop the popover from closing\n if (this.closeTimeout) {\n this.closeTimeout();\n this.closeTimeout = undefined;\n }\n\n // if the trigger is disabled or the tooltip is already open then do not show the tooltip\n if (this.state.disabled() || this.openTimeout) {\n return;\n }\n\n // if the tooltip exists in the DOM then do not create it again\n if (this.viewRef) {\n return;\n }\n\n this.openTimeout = this.disposables.setTimeout(\n () => this.createTooltip(),\n this.state.showDelay(),\n );\n }\n\n /**\n * Hide the tooltip.\n */\n hide(): void {\n // if closing is in progress then clear the timeout to stop the popover from opening\n if (this.openTimeout) {\n this.openTimeout();\n this.openTimeout = undefined;\n }\n\n // if the trigger is disabled or the tooltip is already closed then do not hide the tooltip\n if (this.state.disabled() || this.closeTimeout) {\n return;\n }\n\n this.closeTimeout = this.disposables.setTimeout(\n () => this.destroyTooltip(),\n this.state.hideDelay(),\n );\n }\n\n private createTooltip(): void {\n this.openTimeout = undefined;\n const tooltip = this.state.tooltip();\n\n let portal: TemplatePortal | ComponentPortal<unknown>;\n\n // Create a new inject with the tooltip context\n const injector = Injector.create({\n parent: this.injector,\n providers: [provideTooltipContext(this.state.context())],\n });\n\n if (tooltip instanceof TemplateRef) {\n portal = new TemplatePortal<NgpTooltipTemplateContext<T>>(\n tooltip,\n this.viewContainerRef,\n { $implicit: this.state.context() } as NgpTooltipTemplateContext<T>,\n injector,\n );\n } else if (tooltip instanceof Type) {\n portal = new ComponentPortal(tooltip, this.viewContainerRef, injector);\n } else {\n throw new Error('Tooltip must be either a TemplateRef or a ComponentType');\n }\n\n const domOutlet = new DomPortalOutlet(\n this.state.container() ?? this.document.body,\n undefined,\n undefined,\n injector,\n );\n\n this.viewRef = domOutlet.attach(portal);\n\n let outletElement: HTMLElement | null = null;\n\n if (this.viewRef instanceof ComponentRef) {\n this.viewRef.changeDetectorRef.detectChanges();\n outletElement = this.viewRef.location.nativeElement;\n } else if (this.viewRef) {\n this.viewRef.detectChanges();\n outletElement = this.viewRef.rootNodes[0] as HTMLElement;\n }\n\n if (!outletElement) {\n throw new Error('Outlet element is not available.');\n }\n\n // we want to determine the strategy to use. If the tooltip has position: fixed then we want to use\n // fixed positioning. Otherwise we want to use absolute positioning.\n const strategy = getComputedStyle(outletElement).position === 'fixed' ? 'fixed' : 'absolute';\n\n this.dispose = autoUpdate(this.trigger.nativeElement, outletElement, async () => {\n const position = await computePosition(this.trigger.nativeElement, outletElement, {\n placement: this.state.placement(),\n middleware: this.middleware(),\n strategy,\n });\n\n this.position.set({ x: position.x, y: position.y });\n });\n }\n\n private async destroyTooltip(): Promise<void> {\n this.closeTimeout = undefined;\n await this.exitAnimationManager.exit();\n\n this.viewRef?.destroy();\n this.viewRef = null;\n this.dispose?.();\n }\n}\n\ntype NgpTooltipTemplateContext<T> = {\n $implicit: T;\n};\ntype NgpTooltipContent<T> = TemplateRef<NgpTooltipTemplateContext<T>> | Type<unknown>;\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n Directive,\n ElementRef,\n OnInit,\n PLATFORM_ID,\n computed,\n inject,\n isDevMode,\n} from '@angular/core';\nimport { NgpExitAnimation } from 'ng-primitives/internal';\nimport { getTransformOrigin } from 'ng-primitives/popover';\nimport { injectTooltipTriggerState } from '../tooltip-trigger/tooltip-trigger-state';\n\n/**\n * Apply the `ngpTooltip` directive to an element that represents the tooltip. This typically would be a `div` inside an `ng-template`.\n */\n@Directive({\n selector: '[ngpTooltip]',\n exportAs: 'ngpTooltip',\n hostDirectives: [NgpExitAnimation],\n host: {\n role: 'tooltip',\n '[style.left.px]': 'x()',\n '[style.top.px]': 'y()',\n '[style.--ngp-tooltip-trigger-width.px]': 'trigger().width()',\n '[style.--ngp-tooltip-transform-origin]': 'transformOrigin()',\n },\n})\nexport class NgpTooltip implements OnInit {\n /**\n * Access the tooltip element.\n */\n private readonly tooltip = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the platform.\n */\n private readonly platform = inject(PLATFORM_ID);\n\n /**\n * Access the trigger instance.\n */\n private readonly trigger = injectTooltipTriggerState();\n\n /**\n * Compute the x position of the tooltip.\n */\n protected readonly x = computed(() => this.trigger().position().x);\n\n /**\n * Compute the y position of the tooltip.\n */\n protected readonly y = computed(() => this.trigger().position().y);\n\n /**\n * Derive the transform origin of the popover.\n */\n protected readonly transformOrigin = computed(() =>\n getTransformOrigin(this.trigger().placement()),\n );\n\n ngOnInit(): void {\n // if the element does not have a fixed position then throw a warning in dev mode\n if (isDevMode() && isPlatformBrowser(this.platform)) {\n const { position } = getComputedStyle(this.tooltip.nativeElement);\n\n if (position !== 'absolute' && position !== 'fixed') {\n console.warn(\n `The tooltip element must have an absolute or fixed position. The current position is ${position}.`,\n );\n }\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAyCO,MAAM,oBAAoB,GAAqB;AACpD,IAAA,MAAM,EAAE,CAAC;AACT,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,SAAS,EAAE,IAAI;CAChB;AAEM,MAAM,qBAAqB,GAAG,IAAI,cAAc,CAAmB,uBAAuB,CAAC;AAElG;;;;AAIG;AACG,SAAU,oBAAoB,CAAC,MAAiC,EAAA;IACpE,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,qBAAqB;AAC9B,YAAA,QAAQ,EAAE,EAAE,GAAG,oBAAoB,EAAE,GAAG,MAAM,EAAE;AACjD,SAAA;KACF;AACH;AAEA;;;AAGG;SACa,mBAAmB,GAAA;AACjC,IAAA,OAAO,MAAM,CAAC,qBAAqB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,oBAAoB;AAClF;;MCtEa,sBAAsB,GAAG,IAAI,cAAc,CAAU,wBAAwB;AAE1F;;AAEG;SACa,oBAAoB,GAAA;AAClC,IAAA,OAAO,MAAM,CAAC,sBAAsB,CAAM;AAC5C;AAEA;;AAEG;AACG,SAAU,qBAAqB,CAAI,OAAU,EAAA;IACjD,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,OAAO,EAAE;AAC/D;;ACNA;;AAEG;AACI,MAAM,2BAA2B,GACtC,gBAAgB,CAA6B,gBAAgB,CAAC;AAEhE;;AAEG;MACU,0BAA0B,GAAG,mBAAmB,CAAC,2BAA2B;AAEzF;;AAEG;MACU,yBAAyB,GAA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AY;oBACtB,cAAc,EAAE,CAAC,gBAAgB,CAAC;AAClC,oBAAA,IAAI,EAAE;AACJ,wBAAA,IAAI,EAAE,SAAS;AACf,wBAAA,iBAAiB,EAAE,KAAK;AACxB,wBAAA,gBAAgB,EAAE,KAAK;AACvB,wBAAA,wCAAwC,EAAE,mBAAmB;AAC7D,wBAAA,wCAAwC,EAAE,mBAAmB;AAC9D,qBAAA;AACF,iBAAA;;;AC5BD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-primitives-tooltip.mjs","sources":["../../../../packages/ng-primitives/tooltip/src/config/tooltip-config.ts","../../../../packages/ng-primitives/tooltip/src/tooltip/tooltip-token.ts","../../../../packages/ng-primitives/tooltip/src/tooltip-trigger/tooltip-trigger-state.ts","../../../../packages/ng-primitives/tooltip/src/tooltip-trigger/tooltip-trigger.ts","../../../../packages/ng-primitives/tooltip/src/tooltip/tooltip.ts","../../../../packages/ng-primitives/tooltip/src/ng-primitives-tooltip.ts"],"sourcesContent":["import { InjectionToken, Provider, inject } from '@angular/core';\nimport { type Placement } from '@floating-ui/dom';\n\nexport interface NgpTooltipConfig {\n /**\n * Define the offset of the tooltip relative to the trigger.\n * @default 4\n */\n offset: number;\n\n /**\n * Define the placement of the tooltip relative to the trigger.\n * @default 'top'\n */\n placement: Placement;\n\n /**\n * Define the delay before the tooltip is shown.\n * @default 0\n */\n showDelay: number;\n\n /**\n * Define the delay before the tooltip is hidden.\n * @default 0\n */\n hideDelay: number;\n\n /**\n * Define whether the tooltip should flip when there is not enough space for the tooltip.\n * @default true\n */\n flip: boolean;\n\n /**\n * Define the container in to which the tooltip should be attached.\n * @default document.body\n */\n container: HTMLElement | null;\n}\n\nexport const defaultTooltipConfig: NgpTooltipConfig = {\n offset: 4,\n placement: 'top',\n showDelay: 0,\n hideDelay: 0,\n flip: true,\n container: null,\n};\n\nexport const NgpTooltipConfigToken = new InjectionToken<NgpTooltipConfig>('NgpTooltipConfigToken');\n\n/**\n * Provide the default Tooltip configuration\n * @param config The Tooltip configuration\n * @returns The provider\n */\nexport function provideTooltipConfig(config: Partial<NgpTooltipConfig>): Provider[] {\n return [\n {\n provide: NgpTooltipConfigToken,\n useValue: { ...defaultTooltipConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the Tooltip configuration\n * @returns The global Tooltip configuration\n */\nexport function injectTooltipConfig(): NgpTooltipConfig {\n return inject(NgpTooltipConfigToken, { optional: true }) ?? defaultTooltipConfig;\n}\n","import { inject, InjectionToken, ValueProvider } from '@angular/core';\n\nexport const NgpTooltipContextToken = new InjectionToken<unknown>('NgpTooltipContextToken');\n\n/**\n * Inject the Tooltip context\n */\nexport function injectTooltipContext<T>(): T {\n return inject(NgpTooltipContextToken) as T;\n}\n\n/**\n * Provide the Tooltip directive instance\n */\nexport function provideTooltipContext<T>(context: T): ValueProvider {\n return { provide: NgpTooltipContextToken, useValue: context };\n}\n","import { Signal } from '@angular/core';\nimport {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n State,\n} from 'ng-primitives/state';\nimport type { NgpTooltipTrigger } from './tooltip-trigger';\n\n/**\n * The state token for the TooltipTrigger primitive.\n */\nexport const NgpTooltipTriggerStateToken =\n createStateToken<NgpTooltipTrigger<unknown>>('TooltipTrigger');\n\n/**\n * Provides the TooltipTrigger state.\n */\nexport const provideTooltipTriggerState = createStateProvider(NgpTooltipTriggerStateToken);\n\n/**\n * Injects the TooltipTrigger state.\n */\nexport const injectTooltipTriggerState = createStateInjector(NgpTooltipTriggerStateToken) as <\n T,\n>() => Signal<State<NgpTooltipTrigger<T>>>;\n\n/**\n * The TooltipTrigger state registration function.\n */\nexport const tooltipTriggerState = createState(NgpTooltipTriggerStateToken);\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport { ComponentPortal, DomPortalOutlet, TemplatePortal } from '@angular/cdk/portal';\nimport { DOCUMENT } from '@angular/common';\nimport {\n ComponentRef,\n Directive,\n ElementRef,\n EmbeddedViewRef,\n Injector,\n OnDestroy,\n TemplateRef,\n Type,\n ViewContainerRef,\n booleanAttribute,\n computed,\n inject,\n input,\n numberAttribute,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n Middleware,\n Placement,\n autoUpdate,\n computePosition,\n flip,\n offset,\n shift,\n} from '@floating-ui/dom';\nimport { injectExitAnimationManager, provideExitAnimationManager } from 'ng-primitives/internal';\nimport { fromResizeEvent } from 'ng-primitives/resize';\nimport { injectDisposables } from 'ng-primitives/utils';\nimport { injectTooltipConfig } from '../config/tooltip-config';\nimport { provideTooltipContext } from '../tooltip/tooltip-token';\nimport { provideTooltipTriggerState, tooltipTriggerState } from './tooltip-trigger-state';\n\n/**\n * Apply the `ngpTooltipTrigger` directive to an element that triggers the tooltip to show.\n */\n@Directive({\n selector: '[ngpTooltipTrigger]',\n exportAs: 'ngpTooltipTrigger',\n providers: [provideTooltipTriggerState(), provideExitAnimationManager()],\n host: {\n '[attr.data-open]': 'open() ? \"\" : null',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '(mouseenter)': 'show()',\n '(mouseleave)': 'hide()',\n '(focus)': 'show()',\n '(blur)': 'hide()',\n },\n})\nexport class NgpTooltipTrigger<T = null> implements OnDestroy {\n /**\n * Access the exit animation manager.\n */\n private readonly exitAnimationManager = injectExitAnimationManager();\n\n /**\n * Access the trigger element\n */\n private readonly trigger = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the view container ref.\n */\n private readonly viewContainerRef = inject(ViewContainerRef);\n\n /**\n * Access the document.\n */\n private readonly document = inject(DOCUMENT);\n\n /**\n * Access the injector.\n */\n private readonly injector = inject(Injector);\n\n /**\n * Access the global tooltip configuration.\n */\n private readonly config = injectTooltipConfig();\n\n /**\n * Access the disposable utilities\n */\n private readonly disposables = injectDisposables();\n\n /**\n * Access the tooltip template ref.\n */\n readonly tooltip = input<NgpTooltipContent<T> | null>(null, {\n alias: 'ngpTooltipTrigger',\n });\n\n /**\n * Define if the trigger should be disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpTooltipTriggerDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Define the placement of the tooltip relative to the trigger.\n * @default 'top'\n */\n readonly placement = input<Placement>(this.config.placement, {\n alias: 'ngpTooltipTriggerPlacement',\n });\n\n /**\n * Define the offset of the tooltip relative to the trigger.\n * @default 0\n */\n readonly offset = input<number, NumberInput>(this.config.offset, {\n alias: 'ngpTooltipTriggerOffset',\n transform: numberAttribute,\n });\n\n /**\n * Define the delay before the tooltip is displayed.\n * @default 0\n */\n readonly showDelay = input<number, NumberInput>(this.config.showDelay, {\n alias: 'ngpTooltipTriggerShowDelay',\n transform: numberAttribute,\n });\n\n /**\n * Define the delay before the tooltip is hidden.\n * @default 0\n */\n readonly hideDelay = input<number, NumberInput>(this.config.hideDelay, {\n alias: 'ngpTooltipTriggerHideDelay',\n transform: numberAttribute,\n });\n\n /**\n * Define whether the tooltip should flip when there is not enough space for the tooltip.\n * @default true\n */\n readonly flip = input<boolean, BooleanInput>(this.config.flip, {\n alias: 'ngpTooltipTriggerFlip',\n transform: booleanAttribute,\n });\n\n /**\n * Define the container in which the tooltip should be attached.\n * @default document.body\n */\n readonly container = input<HTMLElement | null>(this.config.container, {\n alias: 'ngpTooltipTriggerContainer',\n });\n\n /**\n * Provide context to the tooltip.\n * @default null\n */\n readonly context = input<T | null>(null, {\n alias: 'ngpTooltipTriggerContext',\n });\n\n /**\n * Store the tooltip view ref.\n */\n protected viewRef = signal<ComponentRef<unknown> | EmbeddedViewRef<T> | null>(null);\n\n /**\n * Derive the tooltip middleware from the provided configuration.\n */\n private readonly middleware = computed(() => {\n const middleware: Middleware[] = [offset(this.state.offset()), shift()];\n\n if (this.state.flip()) {\n middleware.push(flip());\n }\n\n return middleware;\n });\n\n /**\n * Store the computed position of the tooltip.\n * @internal\n */\n readonly position = signal<{ x: number; y: number }>({\n x: 0,\n y: 0,\n });\n\n /**\n * The dispose function to stop computing the position of the tooltip.\n */\n private dispose?: () => void;\n\n /**\n * @internal\n * Store the trigger width.\n */\n readonly width = signal<number | null>(null);\n\n /**\n * @internal\n * The timeout to open the tooltip.\n */\n private openTimeout?: () => void;\n\n /**\n * @internal\n * The timeout to close the tooltip.\n */\n private closeTimeout?: () => void;\n\n /**\n * @internal\n * Whether the tooltip is open or not.\n */\n readonly open = computed(() => this.viewRef() !== null);\n\n /**\n * Store the state of the tooltip.\n * @internal\n */\n readonly state = tooltipTriggerState<NgpTooltipTrigger<T>>(this);\n\n constructor() {\n // update the width of the trigger when it resizes\n fromResizeEvent(this.trigger.nativeElement)\n .pipe(takeUntilDestroyed())\n .subscribe(() => this.width.set(this.trigger.nativeElement.offsetWidth));\n }\n\n ngOnDestroy(): void {\n this.destroyTooltip();\n }\n\n /**\n * Show the tooltip.\n */\n show(): void {\n // if closing is in progress then clear the timeout to stop the popover from closing\n if (this.closeTimeout) {\n this.closeTimeout();\n this.closeTimeout = undefined;\n }\n\n // if the trigger is disabled or the tooltip is already open then do not show the tooltip\n if (this.state.disabled() || this.openTimeout) {\n return;\n }\n\n // if the tooltip exists in the DOM then do not create it again\n if (this.viewRef()) {\n return;\n }\n\n this.openTimeout = this.disposables.setTimeout(\n () => this.createTooltip(),\n this.state.showDelay(),\n );\n }\n\n /**\n * Hide the tooltip.\n */\n hide(): void {\n // if closing is in progress then clear the timeout to stop the popover from opening\n if (this.openTimeout) {\n this.openTimeout();\n this.openTimeout = undefined;\n }\n\n // if the trigger is disabled or the tooltip is already closed then do not hide the tooltip\n if (this.state.disabled() || this.closeTimeout) {\n return;\n }\n\n this.closeTimeout = this.disposables.setTimeout(\n () => this.destroyTooltip(),\n this.state.hideDelay(),\n );\n }\n\n private createTooltip(): void {\n this.openTimeout = undefined;\n const tooltip = this.state.tooltip();\n\n let portal: TemplatePortal | ComponentPortal<unknown>;\n\n // Create a new inject with the tooltip context\n const injector = Injector.create({\n parent: this.injector,\n providers: [provideTooltipContext(this.state.context())],\n });\n\n if (tooltip instanceof TemplateRef) {\n portal = new TemplatePortal<NgpTooltipTemplateContext<T>>(\n tooltip,\n this.viewContainerRef,\n { $implicit: this.state.context() } as NgpTooltipTemplateContext<T>,\n injector,\n );\n } else if (tooltip instanceof Type) {\n portal = new ComponentPortal(tooltip, this.viewContainerRef, injector);\n } else {\n throw new Error('Tooltip must be either a TemplateRef or a ComponentType');\n }\n\n const domOutlet = new DomPortalOutlet(\n this.state.container() ?? this.document.body,\n undefined,\n undefined,\n injector,\n );\n\n const viewRef = domOutlet.attach(portal);\n this.viewRef.set(viewRef);\n\n let outletElement: HTMLElement | null = null;\n\n if (viewRef instanceof ComponentRef) {\n viewRef.changeDetectorRef.detectChanges();\n outletElement = viewRef.location.nativeElement;\n } else if (viewRef) {\n viewRef.detectChanges();\n outletElement = viewRef.rootNodes[0] as HTMLElement;\n }\n\n if (!outletElement) {\n throw new Error('Outlet element is not available.');\n }\n\n // we want to determine the strategy to use. If the tooltip has position: fixed then we want to use\n // fixed positioning. Otherwise we want to use absolute positioning.\n const strategy = getComputedStyle(outletElement).position === 'fixed' ? 'fixed' : 'absolute';\n\n this.dispose = autoUpdate(this.trigger.nativeElement, outletElement, async () => {\n const position = await computePosition(this.trigger.nativeElement, outletElement, {\n placement: this.state.placement(),\n middleware: this.middleware(),\n strategy,\n });\n\n this.position.set({ x: position.x, y: position.y });\n });\n }\n\n private async destroyTooltip(): Promise<void> {\n this.closeTimeout = undefined;\n await this.exitAnimationManager.exit();\n\n this.viewRef()?.destroy();\n this.viewRef.set(null);\n this.dispose?.();\n }\n}\n\ntype NgpTooltipTemplateContext<T> = {\n $implicit: T;\n};\ntype NgpTooltipContent<T> = TemplateRef<NgpTooltipTemplateContext<T>> | Type<unknown>;\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n Directive,\n ElementRef,\n OnInit,\n PLATFORM_ID,\n computed,\n inject,\n isDevMode,\n} from '@angular/core';\nimport { NgpExitAnimation } from 'ng-primitives/internal';\nimport { getTransformOrigin } from 'ng-primitives/popover';\nimport { injectTooltipTriggerState } from '../tooltip-trigger/tooltip-trigger-state';\n\n/**\n * Apply the `ngpTooltip` directive to an element that represents the tooltip. This typically would be a `div` inside an `ng-template`.\n */\n@Directive({\n selector: '[ngpTooltip]',\n exportAs: 'ngpTooltip',\n hostDirectives: [NgpExitAnimation],\n host: {\n role: 'tooltip',\n '[style.left.px]': 'x()',\n '[style.top.px]': 'y()',\n '[style.--ngp-tooltip-trigger-width.px]': 'trigger().width()',\n '[style.--ngp-tooltip-transform-origin]': 'transformOrigin()',\n },\n})\nexport class NgpTooltip implements OnInit {\n /**\n * Access the tooltip element.\n */\n private readonly tooltip = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the platform.\n */\n private readonly platform = inject(PLATFORM_ID);\n\n /**\n * Access the trigger instance.\n */\n private readonly trigger = injectTooltipTriggerState();\n\n /**\n * Compute the x position of the tooltip.\n */\n protected readonly x = computed(() => this.trigger().position().x);\n\n /**\n * Compute the y position of the tooltip.\n */\n protected readonly y = computed(() => this.trigger().position().y);\n\n /**\n * Derive the transform origin of the popover.\n */\n protected readonly transformOrigin = computed(() =>\n getTransformOrigin(this.trigger().placement()),\n );\n\n ngOnInit(): void {\n // if the element does not have a fixed position then throw a warning in dev mode\n if (isDevMode() && isPlatformBrowser(this.platform)) {\n const { position } = getComputedStyle(this.tooltip.nativeElement);\n\n if (position !== 'absolute' && position !== 'fixed') {\n console.warn(\n `The tooltip element must have an absolute or fixed position. The current position is ${position}.`,\n );\n }\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAyCO,MAAM,oBAAoB,GAAqB;AACpD,IAAA,MAAM,EAAE,CAAC;AACT,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,SAAS,EAAE,IAAI;CAChB;AAEM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;AAEG;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { NgpFocusTrap } from './focus-trap';
|
|
2
|
+
/**
|
|
3
|
+
* The state token for the FocusTrap primitive.
|
|
4
|
+
*/
|
|
5
|
+
export declare const NgpFocusTrapStateToken: import("@angular/core").InjectionToken<NgpFocusTrap>;
|
|
6
|
+
/**
|
|
7
|
+
* Provides the FocusTrap state.
|
|
8
|
+
*/
|
|
9
|
+
export declare const provideFocusTrapState: (options?: import("ng-primitives/state").CreateStateProviderOptions) => import("@angular/core").FactoryProvider;
|
|
10
|
+
/**
|
|
11
|
+
* Injects the FocusTrap state.
|
|
12
|
+
*/
|
|
13
|
+
export declare const injectFocusTrapState: <U = {
|
|
14
|
+
readonly focusTrap: {
|
|
15
|
+
active: boolean;
|
|
16
|
+
activate(): void;
|
|
17
|
+
deactivate(): void;
|
|
18
|
+
};
|
|
19
|
+
readonly interactivityChecker: import("@angular/cdk/a11y-module.d-DrV0SO0k").InteractivityChecker;
|
|
20
|
+
readonly elementRef: import("@angular/core").ElementRef<HTMLElement>;
|
|
21
|
+
readonly ngZone: import("@angular/core").NgZone;
|
|
22
|
+
mutationObserver: MutationObserver | null;
|
|
23
|
+
lastFocusedElement: HTMLElement | null;
|
|
24
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
25
|
+
readonly state: import("ng-primitives/state").CreatedState<NgpFocusTrap>;
|
|
26
|
+
ngOnInit: () => void;
|
|
27
|
+
ngOnDestroy: () => void;
|
|
28
|
+
handleFocusIn: (event: FocusEvent) => void;
|
|
29
|
+
handleFocusOut: (event: FocusEvent) => void;
|
|
30
|
+
handleMutations: (mutations: MutationRecord[]) => void;
|
|
31
|
+
handleKeyDown: (event: KeyboardEvent) => void;
|
|
32
|
+
getTabbableEdges: (container: HTMLElement) => readonly [HTMLElement | null, HTMLElement | null];
|
|
33
|
+
getTabbableCandidates: (container: HTMLElement) => HTMLElement[];
|
|
34
|
+
findVisible: (elements: HTMLElement[]) => HTMLElement | null;
|
|
35
|
+
focus: (element?: HTMLElement | null) => void;
|
|
36
|
+
focusFirst: () => void;
|
|
37
|
+
}>(injectOptions?: import("@angular/core").InjectOptions) => import("@angular/core").Signal<import("ng-primitives/state").State<U>>;
|
|
38
|
+
/**
|
|
39
|
+
* The FocusTrap state registration function.
|
|
40
|
+
*/
|
|
41
|
+
export declare const focusTrapState: <U>(state: U) => import("ng-primitives/state").CreatedState<U>;
|
|
@@ -33,6 +33,10 @@ export declare class NgpFocusTrap implements OnInit, OnDestroy {
|
|
|
33
33
|
* Whether the focus trap is disabled.
|
|
34
34
|
*/
|
|
35
35
|
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
|
|
36
|
+
/**
|
|
37
|
+
* The focus trap state.
|
|
38
|
+
*/
|
|
39
|
+
protected readonly state: import("ng-primitives/state").CreatedState<NgpFocusTrap>;
|
|
36
40
|
ngOnInit(): void;
|
|
37
41
|
ngOnDestroy(): void;
|
|
38
42
|
private handleFocusIn;
|
package/focus-trap/index.d.ts
CHANGED
|
@@ -15,29 +15,29 @@ export declare const injectFormControlState: <U = {
|
|
|
15
15
|
readonly id: import("@angular/core").InputSignal<string>;
|
|
16
16
|
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
17
17
|
readonly formField: Signal<import("ng-primitives/state").State<{
|
|
18
|
-
readonly labels: any;
|
|
19
|
-
readonly descriptions: any;
|
|
20
|
-
readonly formControl: any;
|
|
21
|
-
readonly ngControl: any;
|
|
22
|
-
readonly errors: any;
|
|
23
|
-
readonly pristine: any;
|
|
24
|
-
readonly touched: any;
|
|
25
|
-
readonly dirty: any;
|
|
26
|
-
readonly valid: any;
|
|
27
|
-
readonly invalid: any;
|
|
28
|
-
readonly pending: any;
|
|
29
|
-
readonly disabled: any;
|
|
30
|
-
subscription?: any;
|
|
31
|
-
readonly state: any;
|
|
32
|
-
ngOnDestroy: any;
|
|
33
|
-
setupSubscriptions: any;
|
|
34
|
-
updateStatus: any;
|
|
35
|
-
setFormControl: any;
|
|
36
|
-
addLabel: any;
|
|
37
|
-
addDescription: any;
|
|
38
|
-
removeFormControl: any;
|
|
39
|
-
removeLabel: any;
|
|
40
|
-
removeDescription: any;
|
|
18
|
+
readonly labels: /*elided*/ any;
|
|
19
|
+
readonly descriptions: /*elided*/ any;
|
|
20
|
+
readonly formControl: /*elided*/ any;
|
|
21
|
+
readonly ngControl: /*elided*/ any;
|
|
22
|
+
readonly errors: /*elided*/ any;
|
|
23
|
+
readonly pristine: /*elided*/ any;
|
|
24
|
+
readonly touched: /*elided*/ any;
|
|
25
|
+
readonly dirty: /*elided*/ any;
|
|
26
|
+
readonly valid: /*elided*/ any;
|
|
27
|
+
readonly invalid: /*elided*/ any;
|
|
28
|
+
readonly pending: /*elided*/ any;
|
|
29
|
+
readonly disabled: /*elided*/ any;
|
|
30
|
+
subscription?: /*elided*/ any;
|
|
31
|
+
readonly state: /*elided*/ any;
|
|
32
|
+
ngOnDestroy: /*elided*/ any;
|
|
33
|
+
setupSubscriptions: /*elided*/ any;
|
|
34
|
+
updateStatus: /*elided*/ any;
|
|
35
|
+
setFormControl: /*elided*/ any;
|
|
36
|
+
addLabel: /*elided*/ any;
|
|
37
|
+
addDescription: /*elided*/ any;
|
|
38
|
+
removeFormControl: /*elided*/ any;
|
|
39
|
+
removeLabel: /*elided*/ any;
|
|
40
|
+
removeDescription: /*elided*/ any;
|
|
41
41
|
}>>;
|
|
42
42
|
readonly ariaLabelledBy: Signal<string>;
|
|
43
43
|
readonly ariaDescribedBy: Signal<string>;
|
|
@@ -22,14 +22,14 @@ export declare const injectListboxState: <U = {
|
|
|
22
22
|
readonly compareWith: import("@angular/core").InputSignal<(a: unknown, b: unknown) => boolean>;
|
|
23
23
|
readonly tabindex: import("@angular/core").Signal<-1 | 0>;
|
|
24
24
|
readonly options: import("@angular/core").WritableSignal<import("ng-primitives/listbox").NgpListboxOption<unknown>[]>;
|
|
25
|
-
readonly keyManager: import("@angular/cdk/
|
|
25
|
+
readonly keyManager: import("@angular/cdk/activedescendant-key-manager.d-DSYvyoT0").ActiveDescendantKeyManager<import("ng-primitives/listbox").NgpListboxOption<unknown>>;
|
|
26
26
|
readonly activeDescendant: import("@angular/core").WritableSignal<string | undefined>;
|
|
27
27
|
readonly isFocused: import("@angular/core").WritableSignal<boolean>;
|
|
28
28
|
readonly state: import("ng-primitives/state").CreatedState<NgpListbox<unknown>>;
|
|
29
29
|
ngAfterContentInit: () => void;
|
|
30
30
|
updateActiveItem: () => void;
|
|
31
31
|
onKeydown: (event: KeyboardEvent) => void;
|
|
32
|
-
selectOption: (value: unknown, origin: import("@angular/cdk/
|
|
32
|
+
selectOption: (value: unknown, origin: import("@angular/cdk/focus-monitor.d-BBkiOKUH").FocusOrigin) => void;
|
|
33
33
|
isSelected: (value: unknown) => boolean;
|
|
34
34
|
activateOption: (value: unknown) => void;
|
|
35
35
|
addOption: (option: import("ng-primitives/listbox").NgpListboxOption<unknown>) => void;
|
package/meter/README.md
ADDED
package/meter/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { NgpMeter } from './meter/meter';
|
|
2
|
+
export { provideMeterState, injectMeterState } from './meter/meter-state';
|
|
3
|
+
export { NgpMeterTrack } from './meter-track/meter-track';
|
|
4
|
+
export { NgpMeterIndicator } from './meter-indicator/meter-indicator';
|
|
5
|
+
export { NgpMeterValue } from './meter-value/meter-value';
|
|
6
|
+
export { NgpMeterLabel } from './meter-label/meter-label';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { NgpMeter } from './meter';
|
|
2
|
+
/**
|
|
3
|
+
* The state token for the Meter primitive.
|
|
4
|
+
*/
|
|
5
|
+
export declare const NgpMeterStateToken: import("@angular/core").InjectionToken<NgpMeter>;
|
|
6
|
+
/**
|
|
7
|
+
* Provides the Meter state.
|
|
8
|
+
*/
|
|
9
|
+
export declare const provideMeterState: (options?: import("ng-primitives/state").CreateStateProviderOptions) => import("@angular/core").FactoryProvider;
|
|
10
|
+
/**
|
|
11
|
+
* Injects the Meter state.
|
|
12
|
+
*/
|
|
13
|
+
export declare const injectMeterState: <U = {
|
|
14
|
+
readonly value: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
15
|
+
readonly min: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
16
|
+
readonly max: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
17
|
+
readonly valueLabel: import("@angular/core").InputSignal<import("./meter").NgpMeterValueTextFn>;
|
|
18
|
+
readonly label: import("@angular/core").WritableSignal<import("ng-primitives/meter").NgpMeterLabel | null>;
|
|
19
|
+
readonly percentage: import("@angular/core").Signal<number>;
|
|
20
|
+
readonly state: import("ng-primitives/state").CreatedState<NgpMeter>;
|
|
21
|
+
}>(injectOptions?: import("@angular/core").InjectOptions) => import("@angular/core").Signal<import("ng-primitives/state").State<U>>;
|
|
22
|
+
/**
|
|
23
|
+
* The Meter state registration function.
|
|
24
|
+
*/
|
|
25
|
+
export declare const meterState: <U>(state: U) => import("ng-primitives/state").CreatedState<U>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { NumberInput } from '@angular/cdk/coercion';
|
|
2
|
+
import type { NgpMeterLabel } from '../meter-label/meter-label';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class NgpMeter {
|
|
5
|
+
/** The value of the meter. */
|
|
6
|
+
readonly value: import("@angular/core").InputSignalWithTransform<number, NumberInput>;
|
|
7
|
+
/** The minimum value of the meter. */
|
|
8
|
+
readonly min: import("@angular/core").InputSignalWithTransform<number, NumberInput>;
|
|
9
|
+
/** The maximum value of the meter. */
|
|
10
|
+
readonly max: import("@angular/core").InputSignalWithTransform<number, NumberInput>;
|
|
11
|
+
/**
|
|
12
|
+
* Define a function that returns the meter value label.
|
|
13
|
+
* @param value The current value
|
|
14
|
+
* @param max The maximum value
|
|
15
|
+
* @returns The value label
|
|
16
|
+
*/
|
|
17
|
+
readonly valueLabel: import("@angular/core").InputSignal<NgpMeterValueTextFn>;
|
|
18
|
+
/** @internal Store the label instance */
|
|
19
|
+
readonly label: import("@angular/core").WritableSignal<NgpMeterLabel | null>;
|
|
20
|
+
/** @internal The percentage of the meter. */
|
|
21
|
+
readonly percentage: import("@angular/core").Signal<number>;
|
|
22
|
+
/** The state of the meter. */
|
|
23
|
+
private readonly state;
|
|
24
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgpMeter, never>;
|
|
25
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpMeter, "[ngpMeter]", ["ngpMeter"], { "value": { "alias": "ngpMeterValue"; "required": false; "isSignal": true; }; "min": { "alias": "ngpMeterMin"; "required": false; "isSignal": true; }; "max": { "alias": "ngpMeterMax"; "required": false; "isSignal": true; }; "valueLabel": { "alias": "ngpMeterValueLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
26
|
+
}
|
|
27
|
+
export type NgpMeterValueTextFn = (value: number, max: number) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class NgpMeterIndicator {
|
|
3
|
+
/** Access the meter */
|
|
4
|
+
protected readonly meter: import("@angular/core").Signal<import("ng-primitives/state").State<{
|
|
5
|
+
readonly value: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
6
|
+
readonly min: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
7
|
+
readonly max: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
8
|
+
readonly valueLabel: import("@angular/core").InputSignal<import("../meter/meter").NgpMeterValueTextFn>;
|
|
9
|
+
readonly label: import("@angular/core").WritableSignal<import("ng-primitives/meter").NgpMeterLabel | null>;
|
|
10
|
+
readonly percentage: import("@angular/core").Signal<number>;
|
|
11
|
+
readonly state: import("ng-primitives/state").CreatedState<import("ng-primitives/meter").NgpMeter>;
|
|
12
|
+
}>>;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgpMeterIndicator, never>;
|
|
14
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpMeterIndicator, "[ngpMeterIndicator]", ["ngpMeterIndicator"], {}, {}, never, never, true, never>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class NgpMeterLabel {
|
|
3
|
+
/** Access the meter */
|
|
4
|
+
protected readonly meter: import("@angular/core").Signal<import("ng-primitives/state").State<{
|
|
5
|
+
readonly value: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
6
|
+
readonly min: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
7
|
+
readonly max: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
8
|
+
readonly valueLabel: import("@angular/core").InputSignal<import("../meter/meter").NgpMeterValueTextFn>;
|
|
9
|
+
readonly label: import("@angular/core").WritableSignal<NgpMeterLabel | null>;
|
|
10
|
+
readonly percentage: import("@angular/core").Signal<number>;
|
|
11
|
+
readonly state: import("ng-primitives/state").CreatedState<import("ng-primitives/meter").NgpMeter>;
|
|
12
|
+
}>>;
|
|
13
|
+
/** The id of the meter label */
|
|
14
|
+
readonly id: import("@angular/core").InputSignal<string>;
|
|
15
|
+
constructor();
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgpMeterLabel, never>;
|
|
17
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpMeterLabel, "[ngpMeterLabel]", ["ngpMeterLabel"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "ng-primitives",
|
|
3
3
|
"description": "Angular Primitives is a low-level headless UI component library with a focus on accessibility, customization, and developer experience. ",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.37.0",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"angular",
|
|
8
8
|
"primitives",
|
|
@@ -87,14 +87,14 @@
|
|
|
87
87
|
"types": "./checkbox/index.d.ts",
|
|
88
88
|
"default": "./fesm2022/ng-primitives-checkbox.mjs"
|
|
89
89
|
},
|
|
90
|
-
"./date-picker": {
|
|
91
|
-
"types": "./date-picker/index.d.ts",
|
|
92
|
-
"default": "./fesm2022/ng-primitives-date-picker.mjs"
|
|
93
|
-
},
|
|
94
90
|
"./common": {
|
|
95
91
|
"types": "./common/index.d.ts",
|
|
96
92
|
"default": "./fesm2022/ng-primitives-common.mjs"
|
|
97
93
|
},
|
|
94
|
+
"./date-picker": {
|
|
95
|
+
"types": "./date-picker/index.d.ts",
|
|
96
|
+
"default": "./fesm2022/ng-primitives-date-picker.mjs"
|
|
97
|
+
},
|
|
98
98
|
"./date-time": {
|
|
99
99
|
"types": "./date-time/index.d.ts",
|
|
100
100
|
"default": "./fesm2022/ng-primitives-date-time.mjs"
|
|
@@ -139,6 +139,10 @@
|
|
|
139
139
|
"types": "./menu/index.d.ts",
|
|
140
140
|
"default": "./fesm2022/ng-primitives-menu.mjs"
|
|
141
141
|
},
|
|
142
|
+
"./meter": {
|
|
143
|
+
"types": "./meter/index.d.ts",
|
|
144
|
+
"default": "./fesm2022/ng-primitives-meter.mjs"
|
|
145
|
+
},
|
|
142
146
|
"./pagination": {
|
|
143
147
|
"types": "./pagination/index.d.ts",
|
|
144
148
|
"default": "./fesm2022/ng-primitives-pagination.mjs"
|
|
@@ -11,9 +11,9 @@ export declare const providePaginationState: (options?: import("ng-primitives/st
|
|
|
11
11
|
* Injects the Pagination state.
|
|
12
12
|
*/
|
|
13
13
|
export declare const injectPaginationState: <U = {
|
|
14
|
-
readonly page: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/
|
|
14
|
+
readonly page: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
15
15
|
readonly pageChange: import("@angular/core").OutputEmitterRef<number>;
|
|
16
|
-
readonly pageCount: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/
|
|
16
|
+
readonly pageCount: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
17
17
|
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
18
18
|
readonly firstPage: import("@angular/core").Signal<boolean>;
|
|
19
19
|
readonly lastPage: import("@angular/core").Signal<boolean>;
|
|
@@ -9,9 +9,9 @@ export declare class NgpPaginationFirst {
|
|
|
9
9
|
* Access the pagination state.
|
|
10
10
|
*/
|
|
11
11
|
protected readonly paginationState: import("@angular/core").Signal<import("ng-primitives/state").State<{
|
|
12
|
-
readonly page: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/
|
|
12
|
+
readonly page: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
13
13
|
readonly pageChange: import("@angular/core").OutputEmitterRef<number>;
|
|
14
|
-
readonly pageCount: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/
|
|
14
|
+
readonly pageCount: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
15
15
|
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
|
|
16
16
|
readonly firstPage: import("@angular/core").Signal<boolean>;
|
|
17
17
|
readonly lastPage: import("@angular/core").Signal<boolean>;
|
|
@@ -9,9 +9,9 @@ export declare class NgpPaginationNext {
|
|
|
9
9
|
* Access the pagination state.
|
|
10
10
|
*/
|
|
11
11
|
protected readonly paginationState: import("@angular/core").Signal<import("ng-primitives/state").State<{
|
|
12
|
-
readonly page: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/
|
|
12
|
+
readonly page: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
13
13
|
readonly pageChange: import("@angular/core").OutputEmitterRef<number>;
|
|
14
|
-
readonly pageCount: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/
|
|
14
|
+
readonly pageCount: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
15
15
|
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
|
|
16
16
|
readonly firstPage: import("@angular/core").Signal<boolean>;
|
|
17
17
|
readonly lastPage: import("@angular/core").Signal<boolean>;
|
|
@@ -9,9 +9,9 @@ export declare class NgpPaginationPrevious {
|
|
|
9
9
|
* Access the pagination state.
|
|
10
10
|
*/
|
|
11
11
|
protected readonly paginationState: import("@angular/core").Signal<import("ng-primitives/state").State<{
|
|
12
|
-
readonly page: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/
|
|
12
|
+
readonly page: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
13
13
|
readonly pageChange: import("@angular/core").OutputEmitterRef<number>;
|
|
14
|
-
readonly pageCount: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/
|
|
14
|
+
readonly pageCount: import("@angular/core").InputSignalWithTransform<number, import("@angular/cdk/number-property.d-BzBQchZ2").NumberInput>;
|
|
15
15
|
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
|
|
16
16
|
readonly firstPage: import("@angular/core").Signal<boolean>;
|
|
17
17
|
readonly lastPage: import("@angular/core").Signal<boolean>;
|