ng-primitives 0.0.7 → 0.2.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/README.md +14 -4
- package/accordion/accordion-trigger/accordion-trigger.directive.d.ts +2 -1
- package/autofill/README.md +3 -0
- package/autofill/autofill/autofill.directive.d.ts +19 -0
- package/{select/select-button/select-button.token.d.ts → autofill/autofill/autofill.token.d.ts} +4 -4
- package/autofill/index.d.ts +9 -0
- package/avatar/avatar/avatar.directive.d.ts +2 -1
- package/button/README.md +3 -0
- package/button/button/button.directive.d.ts +27 -0
- package/{select/select-option/select-option.token.d.ts → button/button/button.token.d.ts} +4 -4
- package/button/index.d.ts +9 -0
- package/checkbox/checkbox/checkbox.directive.d.ts +11 -61
- package/checkbox/index.d.ts +0 -4
- package/esm2022/a11y/visually-hidden/visually-hidden.directive.mjs +3 -3
- package/esm2022/accordion/accordion/accordion.directive.mjs +5 -4
- package/esm2022/accordion/accordion-content/accordion-content.directive.mjs +5 -6
- package/esm2022/accordion/accordion-item/accordion-item.directive.mjs +5 -5
- package/esm2022/accordion/accordion-trigger/accordion-trigger.directive.mjs +8 -5
- package/esm2022/autofill/autofill/autofill.directive.mjs +71 -0
- package/esm2022/autofill/autofill/autofill.token.mjs +16 -0
- package/esm2022/autofill/index.mjs +10 -0
- package/esm2022/autofill/ng-primitives-autofill.mjs +5 -0
- package/esm2022/avatar/avatar/avatar.directive.mjs +7 -4
- package/esm2022/avatar/avatar-fallback/avatar-fallback.directive.mjs +3 -3
- package/esm2022/avatar/avatar-image/avatar-image.directive.mjs +3 -3
- package/esm2022/button/button/button.directive.mjs +47 -0
- package/esm2022/button/button/button.token.mjs +16 -0
- package/esm2022/button/index.mjs +10 -0
- package/esm2022/button/ng-primitives-button.mjs +5 -0
- package/esm2022/checkbox/checkbox/checkbox.directive.mjs +29 -79
- package/esm2022/checkbox/index.mjs +1 -5
- package/esm2022/file-upload/file-upload/file-upload.directive.mjs +7 -4
- package/esm2022/focus-trap/focus-trap/focus-trap.directive.mjs +262 -0
- package/esm2022/focus-trap/focus-trap/focus-trap.token.mjs +16 -0
- package/esm2022/focus-trap/index.mjs +10 -0
- package/esm2022/focus-trap/ng-primitives-focus-trap.mjs +5 -0
- package/esm2022/form-field/description/description.directive.mjs +14 -14
- package/esm2022/form-field/error/error.directive.mjs +27 -29
- package/esm2022/form-field/form-control/form-control.directive.mjs +22 -16
- package/esm2022/form-field/form-field/form-field.directive.mjs +3 -3
- package/esm2022/form-field/form-field/form-field.token.mjs +3 -7
- package/esm2022/form-field/label/label.directive.mjs +56 -17
- package/esm2022/input/index.mjs +10 -0
- package/esm2022/input/input/input.directive.mjs +55 -0
- package/esm2022/input/input/input.token.mjs +16 -0
- package/esm2022/input/ng-primitives-input.mjs +5 -0
- package/esm2022/interactions/focus/focus.directive.mjs +15 -10
- package/esm2022/interactions/focus-visible/focus-visible.directive.mjs +12 -7
- package/esm2022/interactions/hover/hover.directive.mjs +16 -11
- package/esm2022/interactions/index.mjs +5 -1
- package/esm2022/interactions/move/move.directive.mjs +216 -0
- package/esm2022/interactions/move/move.token.mjs +16 -0
- package/esm2022/interactions/press/press.directive.mjs +118 -0
- package/esm2022/interactions/press/press.token.mjs +16 -0
- package/esm2022/internal/disabled/disabled.mjs +19 -0
- package/esm2022/internal/index.mjs +11 -0
- package/esm2022/internal/ng-primitives-internal.mjs +5 -0
- package/esm2022/internal/orientation/orientation.mjs +19 -0
- package/esm2022/internal/style-injector/style-injector.mjs +81 -0
- package/esm2022/progress/progress/progress.directive.mjs +3 -3
- package/esm2022/progress/progress-indicator/progress-indicator.directive.mjs +3 -3
- package/esm2022/radio/radio-group/radio-group.directive.mjs +14 -54
- package/esm2022/radio/radio-indicator/radio-indicator.directive.mjs +8 -5
- package/esm2022/radio/radio-item/radio-item.directive.mjs +8 -6
- package/esm2022/resize/resize/resize.directive.mjs +3 -3
- package/esm2022/roving-focus/roving-focus-group/roving-focus-group.directive.mjs +14 -9
- package/esm2022/roving-focus/roving-focus-item/roving-focus-item.directive.mjs +3 -3
- package/esm2022/search/index.mjs +10 -0
- package/esm2022/search/ng-primitives-search.mjs +5 -0
- package/esm2022/search/search-field/search-field.directive.mjs +47 -0
- package/esm2022/search/search-field/search-field.token.mjs +16 -0
- package/esm2022/select/index.mjs +1 -7
- package/esm2022/select/select/select.directive.mjs +23 -36
- package/esm2022/select/select/select.token.mjs +1 -1
- package/esm2022/slider/slider/slider.directive.mjs +18 -5
- package/esm2022/slider/slider-range/slider-range.directive.mjs +6 -5
- package/esm2022/slider/slider-thumb/slider-thumb.directive.mjs +7 -4
- package/esm2022/slider/slider-track/slider-track.directive.mjs +8 -4
- package/esm2022/switch/switch/switch.directive.mjs +18 -58
- package/esm2022/switch/switch-thumb/switch-thumb.directive.mjs +9 -6
- package/esm2022/tabs/tab-button/tab-button.directive.mjs +8 -6
- package/esm2022/tabs/tab-list/tab-list.directive.mjs +3 -3
- package/esm2022/tabs/tab-panel/tab-panel.directive.mjs +5 -6
- package/esm2022/tabs/tabset/tabset.directive.mjs +14 -18
- package/esm2022/textarea/index.mjs +10 -0
- package/esm2022/textarea/ng-primitives-textarea.mjs +5 -0
- package/esm2022/textarea/textarea/textarea.directive.mjs +37 -0
- package/esm2022/textarea/textarea/textarea.token.mjs +16 -0
- package/esm2022/toggle/toggle/toggle.directive.mjs +33 -13
- package/esm2022/tooltip/tooltip/tooltip.directive.mjs +3 -3
- package/esm2022/tooltip/tooltip-trigger/tooltip-trigger.directive.mjs +7 -7
- package/esm2022/utils/helpers/focus-manager.mjs +3 -3
- package/esm2022/utils/index.mjs +2 -2
- package/esm2022/utils/signals/async.mjs +11 -17
- package/fesm2022/ng-primitives-a11y.mjs +3 -3
- package/fesm2022/ng-primitives-accordion.mjs +19 -16
- package/fesm2022/ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/ng-primitives-autofill.mjs +100 -0
- package/fesm2022/ng-primitives-autofill.mjs.map +1 -0
- package/fesm2022/ng-primitives-avatar.mjs +13 -10
- package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
- package/fesm2022/ng-primitives-button.mjs +76 -0
- package/fesm2022/ng-primitives-button.mjs.map +1 -0
- package/fesm2022/ng-primitives-checkbox.mjs +25 -203
- package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-file-upload.mjs +6 -3
- package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
- package/fesm2022/ng-primitives-focus-trap.mjs +291 -0
- package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -0
- package/fesm2022/ng-primitives-form-field.mjs +119 -80
- package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
- package/fesm2022/ng-primitives-input.mjs +84 -0
- package/fesm2022/ng-primitives-input.mjs.map +1 -0
- package/fesm2022/ng-primitives-interactions.mjs +394 -26
- package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
- package/fesm2022/ng-primitives-internal.mjs +132 -0
- package/fesm2022/ng-primitives-internal.mjs.map +1 -0
- package/fesm2022/ng-primitives-progress.mjs +6 -6
- package/fesm2022/ng-primitives-radio.mjs +25 -62
- package/fesm2022/ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/ng-primitives-resize.mjs +3 -3
- package/fesm2022/ng-primitives-roving-focus.mjs +15 -10
- package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
- package/fesm2022/ng-primitives-search.mjs +76 -0
- package/fesm2022/ng-primitives-search.mjs.map +1 -0
- package/fesm2022/ng-primitives-select.mjs +23 -395
- package/fesm2022/ng-primitives-select.mjs.map +1 -1
- package/fesm2022/ng-primitives-slider.mjs +35 -14
- package/fesm2022/ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/ng-primitives-switch.mjs +23 -62
- package/fesm2022/ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/ng-primitives-tabs.mjs +27 -30
- package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/ng-primitives-textarea.mjs +66 -0
- package/fesm2022/ng-primitives-textarea.mjs.map +1 -0
- package/fesm2022/ng-primitives-toggle.mjs +32 -12
- package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/ng-primitives-tooltip.mjs +9 -9
- package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
- package/fesm2022/ng-primitives-utils.mjs +14 -20
- package/fesm2022/ng-primitives-utils.mjs.map +1 -1
- package/file-upload/file-upload/file-upload.directive.d.ts +2 -1
- package/focus-trap/README.md +3 -0
- package/focus-trap/focus-trap/focus-trap.directive.d.ts +64 -0
- package/{select/select-options/select-options.token.d.ts → focus-trap/focus-trap/focus-trap.token.d.ts} +4 -4
- package/focus-trap/index.d.ts +9 -0
- package/form-field/description/description.directive.d.ts +1 -1
- package/form-field/error/error.directive.d.ts +9 -5
- package/form-field/form-control/form-control.directive.d.ts +7 -3
- package/form-field/form-field/form-field.token.d.ts +1 -1
- package/form-field/label/label.directive.d.ts +3 -2
- package/input/README.md +3 -0
- package/input/index.d.ts +9 -0
- package/input/input/input.directive.d.ts +33 -0
- package/input/input/input.token.d.ts +14 -0
- package/interactions/focus/focus.directive.d.ts +6 -2
- package/interactions/focus-visible/focus-visible.directive.d.ts +5 -1
- package/interactions/hover/hover.directive.d.ts +5 -1
- package/interactions/index.d.ts +4 -0
- package/interactions/move/move.directive.d.ts +126 -0
- package/interactions/move/move.token.d.ts +14 -0
- package/interactions/press/press.directive.d.ts +59 -0
- package/interactions/press/press.token.d.ts +14 -0
- package/internal/README.md +3 -0
- package/internal/disabled/disabled.d.ts +21 -0
- package/internal/index.d.ts +10 -0
- package/internal/orientation/orientation.d.ts +22 -0
- package/internal/style-injector/style-injector.d.ts +36 -0
- package/package.json +49 -7
- package/radio/radio-group/radio-group.directive.d.ts +4 -41
- package/radio/radio-indicator/radio-indicator.directive.d.ts +2 -1
- package/radio/radio-item/radio-item.directive.d.ts +2 -1
- package/roving-focus/roving-focus-group/roving-focus-group.directive.d.ts +7 -2
- package/search/README.md +3 -0
- package/search/index.d.ts +9 -0
- package/search/search-field/search-field.directive.d.ts +15 -0
- package/search/search-field/search-field.token.d.ts +14 -0
- package/select/index.d.ts +0 -6
- package/select/select/select.directive.d.ts +7 -22
- package/select/select/select.token.d.ts +2 -2
- package/slider/slider/slider.directive.d.ts +4 -2
- package/slider/slider-thumb/slider-thumb.directive.d.ts +2 -1
- package/slider/slider-track/slider-track.directive.d.ts +1 -1
- package/switch/switch/switch.directive.d.ts +5 -45
- package/switch/switch-thumb/switch-thumb.directive.d.ts +2 -1
- package/tabs/tab-button/tab-button.directive.d.ts +2 -1
- package/tabs/tabset/tabset.directive.d.ts +3 -9
- package/textarea/README.md +3 -0
- package/textarea/index.d.ts +9 -0
- package/textarea/textarea/textarea.directive.d.ts +20 -0
- package/textarea/textarea/textarea.token.d.ts +14 -0
- package/toggle/toggle/toggle.directive.d.ts +16 -4
- package/utils/index.d.ts +1 -1
- package/utils/signals/async.d.ts +10 -12
- package/checkbox/checkbox-indicator/checkbox-indicator.directive.d.ts +0 -19
- package/checkbox/checkbox-indicator/checkbox-indicator.token.d.ts +0 -15
- package/checkbox/checkbox-input/checkbox-input.directive.d.ts +0 -10
- package/checkbox/checkbox-label/checkbox-label.directive.d.ts +0 -9
- package/esm2022/checkbox/checkbox-indicator/checkbox-indicator.directive.mjs +0 -51
- package/esm2022/checkbox/checkbox-indicator/checkbox-indicator.token.mjs +0 -17
- package/esm2022/checkbox/checkbox-input/checkbox-input.directive.mjs +0 -40
- package/esm2022/checkbox/checkbox-label/checkbox-label.directive.mjs +0 -32
- package/esm2022/select/select-button/select-button.directive.mjs +0 -84
- package/esm2022/select/select-button/select-button.token.mjs +0 -16
- package/esm2022/select/select-option/select-option.directive.mjs +0 -90
- package/esm2022/select/select-option/select-option.token.mjs +0 -16
- package/esm2022/select/select-options/select-options.directive.mjs +0 -157
- package/esm2022/select/select-options/select-options.token.mjs +0 -16
- package/select/select-button/select-button.directive.d.ts +0 -51
- package/select/select-option/select-option.directive.d.ts +0 -57
- package/select/select-options/select-options.directive.d.ts +0 -65
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, inject, Directive, HostListener, ElementRef, model, input, numberAttribute, booleanAttribute, contentChild, computed } from '@angular/core';
|
|
3
|
+
import * as i1 from 'ng-primitives/interactions';
|
|
4
|
+
import { NgpHover, NgpFocusVisible, NgpPress } from 'ng-primitives/interactions';
|
|
5
|
+
import * as i1$1 from 'ng-primitives/form-field';
|
|
6
|
+
import { NgpFormControl } from 'ng-primitives/form-field';
|
|
7
|
+
import { NgpDisabledToken } from 'ng-primitives/internal';
|
|
3
8
|
|
|
4
9
|
/**
|
|
5
10
|
* Copyright © 2024 Angular Primitives.
|
|
@@ -45,10 +50,10 @@ class NgpSliderRange {
|
|
|
45
50
|
*/
|
|
46
51
|
this.slider = injectSlider();
|
|
47
52
|
}
|
|
48
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
49
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.
|
|
53
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpSliderRange, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
54
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.1.1", type: NgpSliderRange, isStandalone: true, selector: "[ngpSliderRange]", host: { properties: { "attr.data-orientation": "slider.orientation()", "attr.data-disabled": "slider.disabled()", "style.width.%": "slider.orientation() === \"horizontal\" ? slider.percentage() : undefined", "style.height.%": "slider.orientation() === \"vertical\" ? slider.percentage() : undefined" } }, providers: [{ provide: NgpSliderRangeToken, useExisting: NgpSliderRange }], exportAs: ["ngpSliderRange"], ngImport: i0 }); }
|
|
50
55
|
}
|
|
51
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
56
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpSliderRange, decorators: [{
|
|
52
57
|
type: Directive,
|
|
53
58
|
args: [{
|
|
54
59
|
standalone: true,
|
|
@@ -56,7 +61,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
56
61
|
exportAs: 'ngpSliderRange',
|
|
57
62
|
providers: [{ provide: NgpSliderRangeToken, useExisting: NgpSliderRange }],
|
|
58
63
|
host: {
|
|
59
|
-
|
|
64
|
+
'[attr.data-orientation]': 'slider.orientation()',
|
|
65
|
+
'[attr.data-disabled]': 'slider.disabled()',
|
|
60
66
|
'[style.width.%]': 'slider.orientation() === "horizontal" ? slider.percentage() : undefined',
|
|
61
67
|
'[style.height.%]': 'slider.orientation() === "vertical" ? slider.percentage() : undefined',
|
|
62
68
|
},
|
|
@@ -146,10 +152,10 @@ class NgpSliderThumb {
|
|
|
146
152
|
break;
|
|
147
153
|
}
|
|
148
154
|
}
|
|
149
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
150
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.
|
|
155
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpSliderThumb, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
156
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.1.1", type: NgpSliderThumb, isStandalone: true, selector: "[ngpSliderThumb]", host: { attributes: { "role": "slider" }, listeners: { "pointerdown": "handlePointerDown($event)", "document:pointerup": "handlePointerUp()", "document:pointermove": "handlePointerMove($event)", "keydown": "handleKeydown($event)" }, properties: { "attr.aria-valuemin": "slider.min()", "attr.aria-valuemax": "slider.max()", "attr.aria-valuenow": "slider.value()", "attr.aria-orientation": "slider.orientation()", "tabindex": "slider.disabled() ? -1 : 0", "attr.data-orientation": "slider.orientation()", "attr.data-disabled": "slider.disabled()", "style.inset-inline-start.%": "slider.orientation() === \"horizontal\" ? slider.percentage() : undefined", "style.inset-block-start.%": "slider.orientation() === \"vertical\" ? slider.percentage() : undefined" } }, providers: [{ provide: NgpSliderThumbToken, useExisting: NgpSliderThumb }], exportAs: ["ngpSliderThumb"], hostDirectives: [{ directive: i1.NgpHover }, { directive: i1.NgpFocusVisible }, { directive: i1.NgpPress }], ngImport: i0 }); }
|
|
151
157
|
}
|
|
152
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
158
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpSliderThumb, decorators: [{
|
|
153
159
|
type: Directive,
|
|
154
160
|
args: [{
|
|
155
161
|
standalone: true,
|
|
@@ -168,6 +174,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
168
174
|
'[style.inset-inline-start.%]': 'slider.orientation() === "horizontal" ? slider.percentage() : undefined',
|
|
169
175
|
'[style.inset-block-start.%]': 'slider.orientation() === "vertical" ? slider.percentage() : undefined',
|
|
170
176
|
},
|
|
177
|
+
hostDirectives: [NgpHover, NgpFocusVisible, NgpPress],
|
|
171
178
|
}]
|
|
172
179
|
}], propDecorators: { handlePointerDown: [{
|
|
173
180
|
type: HostListener,
|
|
@@ -232,16 +239,20 @@ class NgpSliderTrack {
|
|
|
232
239
|
// update the value based on the position
|
|
233
240
|
this.slider.value.set(this.slider.min() + (this.slider.max() - this.slider.min()) * percentage);
|
|
234
241
|
}
|
|
235
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
236
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.
|
|
242
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpSliderTrack, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
243
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.1.1", type: NgpSliderTrack, isStandalone: true, selector: "[ngpSliderTrack]", host: { listeners: { "pointerdown": "handlePointerDown($event)" }, properties: { "attr.data-orientation": "slider.orientation()", "attr.data-disabled": "slider.disabled()" } }, providers: [{ provide: NgpSliderTrackToken, useExisting: NgpSliderTrack }], exportAs: ["ngpSliderTrack"], ngImport: i0 }); }
|
|
237
244
|
}
|
|
238
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
245
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpSliderTrack, decorators: [{
|
|
239
246
|
type: Directive,
|
|
240
247
|
args: [{
|
|
241
248
|
standalone: true,
|
|
242
249
|
selector: '[ngpSliderTrack]',
|
|
243
250
|
exportAs: 'ngpSliderTrack',
|
|
244
251
|
providers: [{ provide: NgpSliderTrackToken, useExisting: NgpSliderTrack }],
|
|
252
|
+
host: {
|
|
253
|
+
'[attr.data-orientation]': 'slider.orientation()',
|
|
254
|
+
'[attr.data-disabled]': 'slider.disabled()',
|
|
255
|
+
},
|
|
245
256
|
}]
|
|
246
257
|
}], propDecorators: { handlePointerDown: [{
|
|
247
258
|
type: HostListener,
|
|
@@ -299,16 +310,26 @@ class NgpSlider {
|
|
|
299
310
|
*/
|
|
300
311
|
this.percentage = computed(() => ((this.value() - this.min()) / (this.max() - this.min())) * 100);
|
|
301
312
|
}
|
|
302
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
303
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "18.
|
|
313
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpSlider, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
314
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "18.1.1", type: NgpSlider, isStandalone: true, selector: "[ngpSlider]", inputs: { value: { classPropertyName: "value", publicName: "ngpSliderValue", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "ngpSliderMin", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "ngpSliderMax", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "ngpSliderStep", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "ngpSliderOrientation", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpSliderDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "ngpSliderValueChange" }, host: { properties: { "attr.data-orientation": "orientation()" } }, providers: [
|
|
315
|
+
{ provide: NgpSliderToken, useExisting: NgpSlider },
|
|
316
|
+
{ provide: NgpDisabledToken, useExisting: NgpSlider },
|
|
317
|
+
], queries: [{ propertyName: "track", first: true, predicate: NgpSliderTrackToken, descendants: true, isSignal: true }], exportAs: ["ngpSlider"], hostDirectives: [{ directive: i1$1.NgpFormControl }], ngImport: i0 }); }
|
|
304
318
|
}
|
|
305
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
319
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpSlider, decorators: [{
|
|
306
320
|
type: Directive,
|
|
307
321
|
args: [{
|
|
308
322
|
standalone: true,
|
|
309
323
|
selector: '[ngpSlider]',
|
|
310
324
|
exportAs: 'ngpSlider',
|
|
311
|
-
providers: [
|
|
325
|
+
providers: [
|
|
326
|
+
{ provide: NgpSliderToken, useExisting: NgpSlider },
|
|
327
|
+
{ provide: NgpDisabledToken, useExisting: NgpSlider },
|
|
328
|
+
],
|
|
329
|
+
hostDirectives: [NgpFormControl],
|
|
330
|
+
host: {
|
|
331
|
+
'[attr.data-orientation]': 'orientation()',
|
|
332
|
+
},
|
|
312
333
|
}]
|
|
313
334
|
}] });
|
|
314
335
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-slider.mjs","sources":["../../../../packages/ng-primitives/slider/src/slider/slider.token.ts","../../../../packages/ng-primitives/slider/src/slider-range/slider-range.token.ts","../../../../packages/ng-primitives/slider/src/slider-range/slider-range.directive.ts","../../../../packages/ng-primitives/slider/src/slider-thumb/slider-thumb.token.ts","../../../../packages/ng-primitives/slider/src/slider-thumb/slider-thumb.directive.ts","../../../../packages/ng-primitives/slider/src/slider-track/slider-track.token.ts","../../../../packages/ng-primitives/slider/src/slider-track/slider-track.directive.ts","../../../../packages/ng-primitives/slider/src/slider/slider.directive.ts","../../../../packages/ng-primitives/slider/src/index.ts","../../../../packages/ng-primitives/slider/src/ng-primitives-slider.ts"],"sourcesContent":["/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpSlider } from './slider.directive';\n\nexport const NgpSliderToken = new InjectionToken<NgpSlider>('NgpSliderToken');\n\n/**\n * Inject the Slider directive instance\n */\nexport function injectSlider(): NgpSlider {\n return inject(NgpSliderToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpSliderRange } from './slider-range.directive';\n\nexport const NgpSliderRangeToken = new InjectionToken<NgpSliderRange>('NgpSliderRangeToken');\n\n/**\n * Inject the SliderRange directive instance\n */\nexport function injectSliderRange(): NgpSliderRange {\n return inject(NgpSliderRangeToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive } from '@angular/core';\nimport { injectSlider } from '../slider/slider.token';\nimport { NgpSliderRangeToken } from './slider-range.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpSliderRange]',\n exportAs: 'ngpSliderRange',\n providers: [{ provide: NgpSliderRangeToken, useExisting: NgpSliderRange }],\n host: {\n class: 'absolute h-full rounded-full bg-white',\n '[style.width.%]': 'slider.orientation() === \"horizontal\" ? slider.percentage() : undefined',\n '[style.height.%]': 'slider.orientation() === \"vertical\" ? slider.percentage() : undefined',\n },\n})\nexport class NgpSliderRange {\n /**\n * Access the slider.\n */\n protected readonly slider = injectSlider();\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpSliderThumb } from './slider-thumb.directive';\n\nexport const NgpSliderThumbToken = new InjectionToken<NgpSliderThumb>('NgpSliderThumbToken');\n\n/**\n * Inject the SliderThumb directive instance\n */\nexport function injectSliderThumb(): NgpSliderThumb {\n return inject(NgpSliderThumbToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive, HostListener } from '@angular/core';\nimport { injectSlider } from '../slider/slider.token';\nimport { NgpSliderThumbToken } from './slider-thumb.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpSliderThumb]',\n exportAs: 'ngpSliderThumb',\n providers: [{ provide: NgpSliderThumbToken, useExisting: NgpSliderThumb }],\n host: {\n role: 'slider',\n '[attr.aria-valuemin]': 'slider.min()',\n '[attr.aria-valuemax]': 'slider.max()',\n '[attr.aria-valuenow]': 'slider.value()',\n '[attr.aria-orientation]': 'slider.orientation()',\n '[tabindex]': 'slider.disabled() ? -1 : 0',\n '[attr.data-orientation]': 'slider.orientation()',\n '[attr.data-disabled]': 'slider.disabled()',\n '[style.inset-inline-start.%]':\n 'slider.orientation() === \"horizontal\" ? slider.percentage() : undefined',\n '[style.inset-block-start.%]':\n 'slider.orientation() === \"vertical\" ? slider.percentage() : undefined',\n },\n})\nexport class NgpSliderThumb {\n /**\n * Access the slider.\n */\n protected readonly slider = injectSlider();\n\n /**\n * Store the dragging state.\n */\n protected dragging = false;\n\n @HostListener('pointerdown', ['$event'])\n protected handlePointerDown(event: PointerEvent): void {\n event.preventDefault();\n\n if (this.slider.disabled()) {\n return;\n }\n\n this.dragging = true;\n }\n\n @HostListener('document:pointerup')\n protected handlePointerUp(): void {\n if (this.slider.disabled()) {\n return;\n }\n\n this.dragging = false;\n }\n\n @HostListener('document:pointermove', ['$event'])\n protected handlePointerMove(event: PointerEvent): void {\n if (this.slider.disabled() || !this.dragging) {\n return;\n }\n\n const rect = this.slider.track()?.element.nativeElement.getBoundingClientRect();\n\n if (!rect) {\n return;\n }\n\n const percentage =\n this.slider.orientation() === 'horizontal'\n ? (event.clientX - rect.left) / rect.width\n : 1 - (event.clientY - rect.top) / rect.height;\n\n this.slider.value.set(\n this.slider.min() +\n (this.slider.max() - this.slider.min()) * Math.max(0, Math.min(1, percentage)),\n );\n }\n\n /**\n * Handle keyboard events.\n * @param event\n */\n @HostListener('keydown', ['$event'])\n protected handleKeydown(event: KeyboardEvent): void {\n const multiplier = event.shiftKey ? 10 : 1;\n\n switch (event.key) {\n case 'ArrowLeft':\n case 'ArrowDown':\n this.slider.value.update(value =>\n Math.max(value - this.slider.step() * multiplier, this.slider.min()),\n );\n break;\n case 'ArrowRight':\n case 'ArrowUp':\n this.slider.value.update(value =>\n Math.min(value + this.slider.step() * multiplier, this.slider.max()),\n );\n break;\n case 'Home':\n this.slider.value.set(this.slider.min());\n break;\n case 'End':\n this.slider.value.set(this.slider.max());\n break;\n }\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpSliderTrack } from './slider-track.directive';\n\nexport const NgpSliderTrackToken = new InjectionToken<NgpSliderTrack>('NgpSliderTrackToken');\n\n/**\n * Inject the SliderTrack directive instance\n */\nexport function injectSliderTrack(): NgpSliderTrack {\n return inject(NgpSliderTrackToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive, ElementRef, HostListener, inject } from '@angular/core';\nimport { injectSlider } from '../slider/slider.token';\nimport { NgpSliderTrackToken } from './slider-track.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpSliderTrack]',\n exportAs: 'ngpSliderTrack',\n providers: [{ provide: NgpSliderTrackToken, useExisting: NgpSliderTrack }],\n})\nexport class NgpSliderTrack {\n /**\n * Access the slider.\n */\n private readonly slider = injectSlider();\n\n /**\n * The element that represents the slider track.\n */\n readonly element = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * When the slider track is clicked, update the value.\n * @param event The click event.\n */\n @HostListener('pointerdown', ['$event'])\n protected handlePointerDown(event: PointerEvent): void {\n if (this.slider.disabled()) {\n return;\n }\n\n // get the position the click occurred within the slider track\n const position = this.slider.orientation() === 'horizontal' ? event.clientX : event.clientY;\n const rect = this.element.nativeElement.getBoundingClientRect();\n const percentage =\n (position - (this.slider.orientation() === 'horizontal' ? rect.left : rect.top)) /\n (this.slider.orientation() === 'horizontal' ? rect.width : rect.height);\n\n // update the value based on the position\n this.slider.value.set(this.slider.min() + (this.slider.max() - this.slider.min()) * percentage);\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n Directive,\n booleanAttribute,\n computed,\n contentChild,\n input,\n model,\n numberAttribute,\n} from '@angular/core';\nimport { NgpSliderTrackToken } from '../slider-track/slider-track.token';\nimport { NgpSliderToken } from './slider.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpSlider]',\n exportAs: 'ngpSlider',\n providers: [{ provide: NgpSliderToken, useExisting: NgpSlider }],\n})\nexport class NgpSlider {\n /**\n * The value of the slider.\n */\n readonly value = model<number>(0, {\n alias: 'ngpSliderValue',\n });\n\n /**\n * The minimum value of the slider.\n */\n readonly min = input<number, NumberInput>(0, {\n alias: 'ngpSliderMin',\n transform: numberAttribute,\n });\n\n /**\n * The maximum value of the slider.\n */\n readonly max = input<number, NumberInput>(100, {\n alias: 'ngpSliderMax',\n transform: numberAttribute,\n });\n\n /**\n * The step value of the slider.\n */\n readonly step = input<number, NumberInput>(1, {\n alias: 'ngpSliderStep',\n transform: numberAttribute,\n });\n\n /**\n * The orientation of the slider.\n */\n readonly orientation = input<'horizontal' | 'vertical'>('horizontal', {\n alias: 'ngpSliderOrientation',\n });\n\n /**\n * The disabled state of the slider.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpSliderDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Access the slider track.\n */\n readonly track = contentChild(NgpSliderTrackToken);\n\n /**\n * The value as a percentage based on the min and max values.\n */\n protected readonly percentage = computed(\n () => ((this.value() - this.min()) / (this.max() - this.min())) * 100,\n );\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nexport { NgpSliderRange } from './slider-range/slider-range.directive';\nexport { NgpSliderRangeToken } from './slider-range/slider-range.token';\nexport { NgpSliderThumb } from './slider-thumb/slider-thumb.directive';\nexport { NgpSliderThumbToken } from './slider-thumb/slider-thumb.token';\nexport { NgpSliderTrack } from './slider-track/slider-track.directive';\nexport { NgpSliderTrackToken } from './slider-track/slider-track.token';\nexport { NgpSlider } from './slider/slider.directive';\nexport { NgpSliderToken } from './slider/slider.token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAAA;;;;;;AAMG;MAIU,cAAc,GAAG,IAAI,cAAc,CAAY,gBAAgB,EAAE;AAE9E;;AAEG;SACa,YAAY,GAAA;AAC1B,IAAA,OAAO,MAAM,CAAC,cAAc,CAAC,CAAC;AAChC;;ACjBA;;;;;;AAMG;MAIU,mBAAmB,GAAG,IAAI,cAAc,CAAiB,qBAAqB,EAAE;AAE7F;;AAEG;SACa,iBAAiB,GAAA;AAC/B,IAAA,OAAO,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACrC;;ACjBA;;;;;;AAMG;MAgBU,cAAc,CAAA;AAX3B,IAAA,WAAA,GAAA;AAYE;;AAEG;QACgB,IAAM,CAAA,MAAA,GAAG,YAAY,EAAE,CAAC;AAC5C,KAAA;8GALY,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;kGAAd,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,eAAA,EAAA,2EAAA,EAAA,gBAAA,EAAA,yEAAA,EAAA,EAAA,cAAA,EAAA,uCAAA,EAAA,EAAA,SAAA,EAPd,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,QAAA,EAAA,E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AE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;oBACrB,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAW,SAAA,EAAE,CAAC;AACjE,iBAAA,CAAA;;;ACzBD;;;;;;AAMG;;ACNH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-primitives-slider.mjs","sources":["../../../../packages/ng-primitives/slider/src/slider/slider.token.ts","../../../../packages/ng-primitives/slider/src/slider-range/slider-range.token.ts","../../../../packages/ng-primitives/slider/src/slider-range/slider-range.directive.ts","../../../../packages/ng-primitives/slider/src/slider-thumb/slider-thumb.token.ts","../../../../packages/ng-primitives/slider/src/slider-thumb/slider-thumb.directive.ts","../../../../packages/ng-primitives/slider/src/slider-track/slider-track.token.ts","../../../../packages/ng-primitives/slider/src/slider-track/slider-track.directive.ts","../../../../packages/ng-primitives/slider/src/slider/slider.directive.ts","../../../../packages/ng-primitives/slider/src/index.ts","../../../../packages/ng-primitives/slider/src/ng-primitives-slider.ts"],"sourcesContent":["/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpSlider } from './slider.directive';\n\nexport const NgpSliderToken = new InjectionToken<NgpSlider>('NgpSliderToken');\n\n/**\n * Inject the Slider directive instance\n */\nexport function injectSlider(): NgpSlider {\n return inject(NgpSliderToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpSliderRange } from './slider-range.directive';\n\nexport const NgpSliderRangeToken = new InjectionToken<NgpSliderRange>('NgpSliderRangeToken');\n\n/**\n * Inject the SliderRange directive instance\n */\nexport function injectSliderRange(): NgpSliderRange {\n return inject(NgpSliderRangeToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive } from '@angular/core';\nimport { injectSlider } from '../slider/slider.token';\nimport { NgpSliderRangeToken } from './slider-range.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpSliderRange]',\n exportAs: 'ngpSliderRange',\n providers: [{ provide: NgpSliderRangeToken, useExisting: NgpSliderRange }],\n host: {\n '[attr.data-orientation]': 'slider.orientation()',\n '[attr.data-disabled]': 'slider.disabled()',\n '[style.width.%]': 'slider.orientation() === \"horizontal\" ? slider.percentage() : undefined',\n '[style.height.%]': 'slider.orientation() === \"vertical\" ? slider.percentage() : undefined',\n },\n})\nexport class NgpSliderRange {\n /**\n * Access the slider.\n */\n protected readonly slider = injectSlider();\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpSliderThumb } from './slider-thumb.directive';\n\nexport const NgpSliderThumbToken = new InjectionToken<NgpSliderThumb>('NgpSliderThumbToken');\n\n/**\n * Inject the SliderThumb directive instance\n */\nexport function injectSliderThumb(): NgpSliderThumb {\n return inject(NgpSliderThumbToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive, HostListener } from '@angular/core';\nimport { NgpFocusVisible, NgpHover, NgpPress } from 'ng-primitives/interactions';\nimport { injectSlider } from '../slider/slider.token';\nimport { NgpSliderThumbToken } from './slider-thumb.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpSliderThumb]',\n exportAs: 'ngpSliderThumb',\n providers: [{ provide: NgpSliderThumbToken, useExisting: NgpSliderThumb }],\n host: {\n role: 'slider',\n '[attr.aria-valuemin]': 'slider.min()',\n '[attr.aria-valuemax]': 'slider.max()',\n '[attr.aria-valuenow]': 'slider.value()',\n '[attr.aria-orientation]': 'slider.orientation()',\n '[tabindex]': 'slider.disabled() ? -1 : 0',\n '[attr.data-orientation]': 'slider.orientation()',\n '[attr.data-disabled]': 'slider.disabled()',\n '[style.inset-inline-start.%]':\n 'slider.orientation() === \"horizontal\" ? slider.percentage() : undefined',\n '[style.inset-block-start.%]':\n 'slider.orientation() === \"vertical\" ? slider.percentage() : undefined',\n },\n hostDirectives: [NgpHover, NgpFocusVisible, NgpPress],\n})\nexport class NgpSliderThumb {\n /**\n * Access the slider.\n */\n protected readonly slider = injectSlider();\n\n /**\n * Store the dragging state.\n */\n protected dragging = false;\n\n @HostListener('pointerdown', ['$event'])\n protected handlePointerDown(event: PointerEvent): void {\n event.preventDefault();\n\n if (this.slider.disabled()) {\n return;\n }\n\n this.dragging = true;\n }\n\n @HostListener('document:pointerup')\n protected handlePointerUp(): void {\n if (this.slider.disabled()) {\n return;\n }\n\n this.dragging = false;\n }\n\n @HostListener('document:pointermove', ['$event'])\n protected handlePointerMove(event: PointerEvent): void {\n if (this.slider.disabled() || !this.dragging) {\n return;\n }\n\n const rect = this.slider.track()?.element.nativeElement.getBoundingClientRect();\n\n if (!rect) {\n return;\n }\n\n const percentage =\n this.slider.orientation() === 'horizontal'\n ? (event.clientX - rect.left) / rect.width\n : 1 - (event.clientY - rect.top) / rect.height;\n\n this.slider.value.set(\n this.slider.min() +\n (this.slider.max() - this.slider.min()) * Math.max(0, Math.min(1, percentage)),\n );\n }\n\n /**\n * Handle keyboard events.\n * @param event\n */\n @HostListener('keydown', ['$event'])\n protected handleKeydown(event: KeyboardEvent): void {\n const multiplier = event.shiftKey ? 10 : 1;\n\n switch (event.key) {\n case 'ArrowLeft':\n case 'ArrowDown':\n this.slider.value.update(value =>\n Math.max(value - this.slider.step() * multiplier, this.slider.min()),\n );\n break;\n case 'ArrowRight':\n case 'ArrowUp':\n this.slider.value.update(value =>\n Math.min(value + this.slider.step() * multiplier, this.slider.max()),\n );\n break;\n case 'Home':\n this.slider.value.set(this.slider.min());\n break;\n case 'End':\n this.slider.value.set(this.slider.max());\n break;\n }\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpSliderTrack } from './slider-track.directive';\n\nexport const NgpSliderTrackToken = new InjectionToken<NgpSliderTrack>('NgpSliderTrackToken');\n\n/**\n * Inject the SliderTrack directive instance\n */\nexport function injectSliderTrack(): NgpSliderTrack {\n return inject(NgpSliderTrackToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive, ElementRef, HostListener, inject } from '@angular/core';\nimport { injectSlider } from '../slider/slider.token';\nimport { NgpSliderTrackToken } from './slider-track.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpSliderTrack]',\n exportAs: 'ngpSliderTrack',\n providers: [{ provide: NgpSliderTrackToken, useExisting: NgpSliderTrack }],\n host: {\n '[attr.data-orientation]': 'slider.orientation()',\n '[attr.data-disabled]': 'slider.disabled()',\n },\n})\nexport class NgpSliderTrack {\n /**\n * Access the slider.\n */\n protected readonly slider = injectSlider();\n\n /**\n * The element that represents the slider track.\n */\n readonly element = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * When the slider track is clicked, update the value.\n * @param event The click event.\n */\n @HostListener('pointerdown', ['$event'])\n protected handlePointerDown(event: PointerEvent): void {\n if (this.slider.disabled()) {\n return;\n }\n\n // get the position the click occurred within the slider track\n const position = this.slider.orientation() === 'horizontal' ? event.clientX : event.clientY;\n const rect = this.element.nativeElement.getBoundingClientRect();\n const percentage =\n (position - (this.slider.orientation() === 'horizontal' ? rect.left : rect.top)) /\n (this.slider.orientation() === 'horizontal' ? rect.width : rect.height);\n\n // update the value based on the position\n this.slider.value.set(this.slider.min() + (this.slider.max() - this.slider.min()) * percentage);\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n Directive,\n booleanAttribute,\n computed,\n contentChild,\n input,\n model,\n numberAttribute,\n} from '@angular/core';\nimport { NgpFormControl } from 'ng-primitives/form-field';\nimport { NgpCanDisable, NgpDisabledToken } from 'ng-primitives/internal';\nimport { NgpSliderTrackToken } from '../slider-track/slider-track.token';\nimport { NgpSliderToken } from './slider.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpSlider]',\n exportAs: 'ngpSlider',\n providers: [\n { provide: NgpSliderToken, useExisting: NgpSlider },\n { provide: NgpDisabledToken, useExisting: NgpSlider },\n ],\n hostDirectives: [NgpFormControl],\n host: {\n '[attr.data-orientation]': 'orientation()',\n },\n})\nexport class NgpSlider implements NgpCanDisable {\n /**\n * The value of the slider.\n */\n readonly value = model<number>(0, {\n alias: 'ngpSliderValue',\n });\n\n /**\n * The minimum value of the slider.\n */\n readonly min = input<number, NumberInput>(0, {\n alias: 'ngpSliderMin',\n transform: numberAttribute,\n });\n\n /**\n * The maximum value of the slider.\n */\n readonly max = input<number, NumberInput>(100, {\n alias: 'ngpSliderMax',\n transform: numberAttribute,\n });\n\n /**\n * The step value of the slider.\n */\n readonly step = input<number, NumberInput>(1, {\n alias: 'ngpSliderStep',\n transform: numberAttribute,\n });\n\n /**\n * The orientation of the slider.\n */\n readonly orientation = input<'horizontal' | 'vertical'>('horizontal', {\n alias: 'ngpSliderOrientation',\n });\n\n /**\n * The disabled state of the slider.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpSliderDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Access the slider track.\n */\n readonly track = contentChild(NgpSliderTrackToken);\n\n /**\n * The value as a percentage based on the min and max values.\n */\n protected readonly percentage = computed(\n () => ((this.value() - this.min()) / (this.max() - this.min())) * 100,\n );\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nexport { NgpSliderRange } from './slider-range/slider-range.directive';\nexport { NgpSliderRangeToken } from './slider-range/slider-range.token';\nexport { NgpSliderThumb } from './slider-thumb/slider-thumb.directive';\nexport { NgpSliderThumbToken } from './slider-thumb/slider-thumb.token';\nexport { NgpSliderTrack } from './slider-track/slider-track.directive';\nexport { NgpSliderTrackToken } from './slider-track/slider-track.token';\nexport { NgpSlider } from './slider/slider.directive';\nexport { NgpSliderToken } from './slider/slider.token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;AAAA;;;;;;AAMG;MAIU,cAAc,GAAG,IAAI,cAAc,CAAY,gBAAgB,EAAE;AAE9E;;AAEG;SACa,YAAY,GAAA;AAC1B,IAAA,OAAO,MAAM,CAAC,cAAc,CAAC,CAAC;AAChC;;ACjBA;;;;;;AAMG;MAIU,mBAAmB,GAAG,IAAI,cAAc,CAAiB,qBAAqB,EAAE;AAE7F;;AAEG;SACa,iBAAiB,GAAA;AAC/B,IAAA,OAAO,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACrC;;ACjBA;;;;;;AAMG;MAiBU,cAAc,CAAA;AAZ3B,IAAA,WAAA,GAAA;AAaE;;AAEG;QACgB,IAAM,CAAA,MAAA,GAAG,YAAY,EAAE,CAAC;AAC5C,KAAA;8GALY,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eA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AS,EAAE;AACT,wBAAA,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,WAAW,EAAE;AACnD,wBAAA,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,WAAW,EAAE;AACtD,qBAAA;oBACD,cAAc,EAAE,CAAC,cAAc,CAAC;AAChC,oBAAA,IAAI,EAAE;AACJ,wBAAA,yBAAyB,EAAE,eAAe;AAC3C,qBAAA;AACF,iBAAA,CAAA;;;AClCD;;;;;;AAMG;;ACNH;;AAEG;;;;"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, Directive, ElementRef, model, input, booleanAttribute,
|
|
3
|
-
import
|
|
2
|
+
import { InjectionToken, inject, Directive, ElementRef, model, input, booleanAttribute, HostListener } from '@angular/core';
|
|
3
|
+
import * as i1 from 'ng-primitives/interactions';
|
|
4
|
+
import { NgpHover, NgpFocusVisible, NgpPress } from 'ng-primitives/interactions';
|
|
5
|
+
import * as i1$1 from 'ng-primitives/form-field';
|
|
6
|
+
import { NgpFormControl } from 'ng-primitives/form-field';
|
|
7
|
+
import { NgpDisabledToken } from 'ng-primitives/internal';
|
|
4
8
|
|
|
5
9
|
/**
|
|
6
10
|
* Copyright © 2024 Angular Primitives.
|
|
@@ -32,18 +36,19 @@ class NgpSwitchThumb {
|
|
|
32
36
|
*/
|
|
33
37
|
this.switch = injectSwitch();
|
|
34
38
|
}
|
|
35
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
36
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.
|
|
39
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpSwitchThumb, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
40
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.1.1", type: NgpSwitchThumb, isStandalone: true, selector: "[ngpSwitchThumb]", host: { properties: { "attr.data-checked": "switch.checked()", "attr.data-disabled": "switch.disabled() ? \"true\" : null" } }, hostDirectives: [{ directive: i1.NgpHover }, { directive: i1.NgpFocusVisible }, { directive: i1.NgpPress }], ngImport: i0 }); }
|
|
37
41
|
}
|
|
38
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
42
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpSwitchThumb, decorators: [{
|
|
39
43
|
type: Directive,
|
|
40
44
|
args: [{
|
|
41
45
|
selector: '[ngpSwitchThumb]',
|
|
42
46
|
standalone: true,
|
|
43
47
|
host: {
|
|
44
|
-
'[attr.data-
|
|
45
|
-
'[attr.data-disabled]': 'switch.
|
|
48
|
+
'[attr.data-checked]': 'switch.checked()',
|
|
49
|
+
'[attr.data-disabled]': 'switch.disabled() ? "true" : null',
|
|
46
50
|
},
|
|
51
|
+
hostDirectives: [NgpHover, NgpFocusVisible, NgpPress],
|
|
47
52
|
}]
|
|
48
53
|
}] });
|
|
49
54
|
|
|
@@ -72,58 +77,15 @@ class NgpSwitch {
|
|
|
72
77
|
alias: 'ngpSwitchDisabled',
|
|
73
78
|
transform: booleanAttribute,
|
|
74
79
|
});
|
|
75
|
-
/**
|
|
76
|
-
* Store the form disabled state.
|
|
77
|
-
* @internal
|
|
78
|
-
*/
|
|
79
|
-
this.formDisabled = signal(false);
|
|
80
|
-
/**
|
|
81
|
-
* Derive the disabled state based on the input and form disabled state.
|
|
82
|
-
* @internal
|
|
83
|
-
*/
|
|
84
|
-
this.disabledState = computed(() => this.disabled() || this.formDisabled());
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Register the onChange callback.
|
|
88
|
-
* @param fn The onChange callback.
|
|
89
|
-
* @internal
|
|
90
|
-
*/
|
|
91
|
-
registerOnChange(fn) {
|
|
92
|
-
this.onChange = fn;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Register the onTouched callback.
|
|
96
|
-
* @param fn The onTouched callback.
|
|
97
|
-
* @internal
|
|
98
|
-
*/
|
|
99
|
-
registerOnTouched(fn) {
|
|
100
|
-
this.onTouched = fn;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Write the value to the checked state.
|
|
104
|
-
* @param checked The checked state.
|
|
105
|
-
* @internal
|
|
106
|
-
*/
|
|
107
|
-
writeValue(checked) {
|
|
108
|
-
this.checked.set(checked);
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Set the disabled state.
|
|
112
|
-
* @param isDisabled The disabled state.
|
|
113
|
-
* @internal
|
|
114
|
-
*/
|
|
115
|
-
setDisabledState(isDisabled) {
|
|
116
|
-
this.formDisabled.set(isDisabled);
|
|
117
80
|
}
|
|
118
81
|
/**
|
|
119
82
|
* Toggle the checked state.
|
|
120
83
|
*/
|
|
121
84
|
toggle() {
|
|
122
|
-
if (this.
|
|
85
|
+
if (this.disabled()) {
|
|
123
86
|
return;
|
|
124
87
|
}
|
|
125
|
-
this.checked.
|
|
126
|
-
this.onChange?.(this.checked());
|
|
88
|
+
this.checked.update(checked => !checked);
|
|
127
89
|
}
|
|
128
90
|
/**
|
|
129
91
|
* Handle the keydown event.
|
|
@@ -135,13 +97,13 @@ class NgpSwitch {
|
|
|
135
97
|
this.toggle();
|
|
136
98
|
}
|
|
137
99
|
}
|
|
138
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
139
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.
|
|
100
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpSwitch, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
101
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.1", type: NgpSwitch, isStandalone: true, selector: "[ngpSwitch]", inputs: { checked: { classPropertyName: "checked", publicName: "ngpSwitchChecked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpSwitchDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "ngpSwitchCheckedChange" }, host: { attributes: { "role": "switch" }, listeners: { "click": "toggle()", "keydown.space": "onKeyDown()" }, properties: { "attr.type": "isButton ? \"button\" : null", "attr.aria-checked": "checked()", "attr.data-checked": "checked()", "attr.disabled": "isButton && disabled() ? disabled() : null" } }, providers: [
|
|
140
102
|
{ provide: NgpSwitchToken, useExisting: NgpSwitch },
|
|
141
|
-
{ provide:
|
|
142
|
-
], exportAs: ["ngpSwitch"], ngImport: i0 }); }
|
|
103
|
+
{ provide: NgpDisabledToken, useExisting: NgpSwitch },
|
|
104
|
+
], exportAs: ["ngpSwitch"], hostDirectives: [{ directive: i1$1.NgpFormControl }, { directive: i1.NgpHover }, { directive: i1.NgpPress }, { directive: i1.NgpFocusVisible }], ngImport: i0 }); }
|
|
143
105
|
}
|
|
144
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
106
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpSwitch, decorators: [{
|
|
145
107
|
type: Directive,
|
|
146
108
|
args: [{
|
|
147
109
|
standalone: true,
|
|
@@ -149,16 +111,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
149
111
|
exportAs: 'ngpSwitch',
|
|
150
112
|
providers: [
|
|
151
113
|
{ provide: NgpSwitchToken, useExisting: NgpSwitch },
|
|
152
|
-
{ provide:
|
|
114
|
+
{ provide: NgpDisabledToken, useExisting: NgpSwitch },
|
|
153
115
|
],
|
|
116
|
+
hostDirectives: [NgpFormControl, NgpHover, NgpPress, NgpFocusVisible],
|
|
154
117
|
host: {
|
|
155
118
|
role: 'switch',
|
|
156
119
|
'[attr.type]': 'isButton ? "button" : null',
|
|
157
120
|
'[attr.aria-checked]': 'checked()',
|
|
158
|
-
'[attr.data-
|
|
159
|
-
'[attr.
|
|
160
|
-
'[attr.disabled]': 'isButton && disabledState() ? disabledState() : null',
|
|
161
|
-
'(focus)': 'onTouched?.()',
|
|
121
|
+
'[attr.data-checked]': 'checked()',
|
|
122
|
+
'[attr.disabled]': 'isButton && disabled() ? disabled() : null',
|
|
162
123
|
},
|
|
163
124
|
}]
|
|
164
125
|
}], propDecorators: { toggle: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-switch.mjs","sources":["../../../../packages/ng-primitives/switch/src/switch/switch.token.ts","../../../../packages/ng-primitives/switch/src/switch-thumb/switch-thumb.directive.ts","../../../../packages/ng-primitives/switch/src/switch/switch.directive.ts","../../../../packages/ng-primitives/switch/src/index.ts","../../../../packages/ng-primitives/switch/src/ng-primitives-switch.ts"],"sourcesContent":["/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpSwitch } from './switch.directive';\n\nexport const NgpSwitchToken = new InjectionToken<NgpSwitch>('NgpSwitchToken');\n\n/**\n * Inject the Switch directive instance\n * @returns The switch directive instance\n */\nexport function injectSwitch(): NgpSwitch {\n return inject(NgpSwitchToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive } from '@angular/core';\nimport { injectSwitch } from '../switch/switch.token';\n\n@Directive({\n selector: '[ngpSwitchThumb]',\n standalone: true,\n host: {\n '[attr.data-
|
|
1
|
+
{"version":3,"file":"ng-primitives-switch.mjs","sources":["../../../../packages/ng-primitives/switch/src/switch/switch.token.ts","../../../../packages/ng-primitives/switch/src/switch-thumb/switch-thumb.directive.ts","../../../../packages/ng-primitives/switch/src/switch/switch.directive.ts","../../../../packages/ng-primitives/switch/src/index.ts","../../../../packages/ng-primitives/switch/src/ng-primitives-switch.ts"],"sourcesContent":["/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpSwitch } from './switch.directive';\n\nexport const NgpSwitchToken = new InjectionToken<NgpSwitch>('NgpSwitchToken');\n\n/**\n * Inject the Switch directive instance\n * @returns The switch directive instance\n */\nexport function injectSwitch(): NgpSwitch {\n return inject(NgpSwitchToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive } from '@angular/core';\nimport { NgpFocusVisible, NgpHover, NgpPress } from 'ng-primitives/interactions';\nimport { injectSwitch } from '../switch/switch.token';\n\n@Directive({\n selector: '[ngpSwitchThumb]',\n standalone: true,\n host: {\n '[attr.data-checked]': 'switch.checked()',\n '[attr.data-disabled]': 'switch.disabled() ? \"true\" : null',\n },\n hostDirectives: [NgpHover, NgpFocusVisible, NgpPress],\n})\nexport class NgpSwitchThumb {\n /**\n * Access the switch directive.\n */\n protected readonly switch = injectSwitch();\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n HostListener,\n booleanAttribute,\n inject,\n input,\n model,\n} from '@angular/core';\nimport { NgpFormControl } from 'ng-primitives/form-field';\nimport { NgpFocusVisible, NgpHover, NgpPress } from 'ng-primitives/interactions';\nimport { NgpCanDisable, NgpDisabledToken } from 'ng-primitives/internal';\nimport { NgpSwitchToken } from './switch.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpSwitch]',\n exportAs: 'ngpSwitch',\n providers: [\n { provide: NgpSwitchToken, useExisting: NgpSwitch },\n { provide: NgpDisabledToken, useExisting: NgpSwitch },\n ],\n hostDirectives: [NgpFormControl, NgpHover, NgpPress, NgpFocusVisible],\n host: {\n role: 'switch',\n '[attr.type]': 'isButton ? \"button\" : null',\n '[attr.aria-checked]': 'checked()',\n '[attr.data-checked]': 'checked()',\n '[attr.disabled]': 'isButton && disabled() ? disabled() : null',\n },\n})\nexport class NgpSwitch implements NgpCanDisable {\n /**\n * Access the element ref.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Determine if the switch is a button\n */\n protected isButton = this.elementRef.nativeElement.tagName === 'BUTTON';\n\n /**\n * Determine if the switch is checked.\n * @default false\n */\n readonly checked = model<boolean>(false, {\n alias: 'ngpSwitchChecked',\n });\n\n /**\n * Determine if the switch is disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpSwitchDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Toggle the checked state.\n */\n @HostListener('click')\n toggle(): void {\n if (this.disabled()) {\n return;\n }\n\n this.checked.update(checked => !checked);\n }\n\n /**\n * Handle the keydown event.\n */\n @HostListener('keydown.space')\n protected onKeyDown(): void {\n // If the switch is not a button then the space key will not toggle the checked state automatically,\n // so we need to do it manually.\n if (!this.isButton) {\n this.toggle();\n }\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nexport { NgpSwitchThumb } from './switch-thumb/switch-thumb.directive';\nexport { NgpSwitch } from './switch/switch.directive';\nexport { NgpSwitchToken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;AACT,wBAAA,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,WAAW,EAAE;AACnD,wBAAA,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,WAAW,EAAE;AACtD,qBAAA;oBACD,cAAc,EAAE,CAAC,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,CAAC;AACrE,oBAAA,IAAI,EAAE;AACJ,wBAAA,IAAI,EAAE,QAAQ;AACd,wBAAA,aAAa,EAAE,4BAA4B;AAC3C,wBAAA,qBAAqB,EAAE,WAAW;AAClC,wBAAA,qBAAqB,EAAE,WAAW;AAClC,wBAAA,iBAAiB,EAAE,4CAA4C;AAChE,qBAAA;AACF,iBAAA,CAAA;8BAiCC,MAAM,EAAA,CAAA;sBADL,YAAY;uBAAC,OAAO,CAAA;gBAaX,SAAS,EAAA,CAAA;sBADlB,YAAY;uBAAC,eAAe,CAAA;;;AClF/B;;;;;;AAMG;;ACNH;;AAEG;;;;"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, inject, input, booleanAttribute, computed, Directive, HostListener, model, contentChildren } from '@angular/core';
|
|
3
|
+
import * as i2 from 'ng-primitives/interactions';
|
|
4
|
+
import { NgpHover, NgpFocusVisible, NgpPress } from 'ng-primitives/interactions';
|
|
3
5
|
import * as i1 from 'ng-primitives/roving-focus';
|
|
4
|
-
import { NgpRovingFocusItem,
|
|
6
|
+
import { NgpRovingFocusItem, NgpRovingFocusGroup } from 'ng-primitives/roving-focus';
|
|
7
|
+
import { NgpOrientationToken } from 'ng-primitives/internal';
|
|
5
8
|
import { uniqueId } from 'ng-primitives/utils';
|
|
6
9
|
|
|
7
10
|
/**
|
|
@@ -106,10 +109,10 @@ class NgpTabButton {
|
|
|
106
109
|
this.select();
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
110
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.
|
|
112
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpTabButton, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
113
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.1", type: NgpTabButton, isStandalone: true, selector: "[ngpTabButton]", inputs: { value: { classPropertyName: "value", publicName: "ngpTabButtonValue", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpTabButtonDisabled", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "tab" }, listeners: { "click": "select()", "focus": "activateOnFocus()" }, properties: { "attr.id": "id() ?? defaultId()", "attr.aria-controls": "ariaControls()", "attr.data-active": "active()", "attr.data-disabled": "disabled()", "attr.data-orientation": "tabset.orientation()" } }, exportAs: ["ngpTabButton"], hostDirectives: [{ directive: i1.NgpRovingFocusItem }, { directive: i2.NgpHover }, { directive: i2.NgpFocusVisible }, { directive: i2.NgpPress }], ngImport: i0 }); }
|
|
111
114
|
}
|
|
112
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
115
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpTabButton, decorators: [{
|
|
113
116
|
type: Directive,
|
|
114
117
|
args: [{
|
|
115
118
|
standalone: true,
|
|
@@ -119,11 +122,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
119
122
|
role: 'tab',
|
|
120
123
|
'[attr.id]': 'id() ?? defaultId()',
|
|
121
124
|
'[attr.aria-controls]': 'ariaControls()',
|
|
122
|
-
'[attr.data-
|
|
125
|
+
'[attr.data-active]': 'active()',
|
|
123
126
|
'[attr.data-disabled]': 'disabled()',
|
|
124
127
|
'[attr.data-orientation]': 'tabset.orientation()',
|
|
125
128
|
},
|
|
126
|
-
hostDirectives: [NgpRovingFocusItem],
|
|
129
|
+
hostDirectives: [NgpRovingFocusItem, NgpHover, NgpFocusVisible, NgpPress],
|
|
127
130
|
}]
|
|
128
131
|
}], propDecorators: { select: [{
|
|
129
132
|
type: HostListener,
|
|
@@ -147,10 +150,10 @@ class NgpTabList {
|
|
|
147
150
|
*/
|
|
148
151
|
this.tabset = injectTabset();
|
|
149
152
|
}
|
|
150
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
151
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.
|
|
153
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpTabList, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
154
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.1.1", type: NgpTabList, isStandalone: true, selector: "[ngpTabList]", host: { attributes: { "role": "tablist" }, properties: { "attr.aria-orientation": "tabset.orientation()", "attr.data-orientation": "tabset.orientation()" } }, exportAs: ["ngpTabList"], ngImport: i0 }); }
|
|
152
155
|
}
|
|
153
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
156
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpTabList, decorators: [{
|
|
154
157
|
type: Directive,
|
|
155
158
|
args: [{
|
|
156
159
|
standalone: true,
|
|
@@ -217,10 +220,10 @@ class NgpTabPanel {
|
|
|
217
220
|
*/
|
|
218
221
|
this.active = computed(() => this.tabset.selectedTab() === this.value());
|
|
219
222
|
}
|
|
220
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
221
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.
|
|
223
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpTabPanel, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
224
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.1", type: NgpTabPanel, isStandalone: true, selector: "[ngpTabPanel]", inputs: { value: { classPropertyName: "value", publicName: "ngpTabPanelValue", isSignal: true, isRequired: true, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "tabpanel", "tabIndex": "0" }, properties: { "attr.aria-labelledby": "labelledBy()", "attr.data-active": "active()", "attr.data-orientation": "tabset.orientation()" } }, providers: [{ provide: NgpTabPanelToken, useExisting: NgpTabPanel }], exportAs: ["ngpTabPanel"], ngImport: i0 }); }
|
|
222
225
|
}
|
|
223
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
226
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpTabPanel, decorators: [{
|
|
224
227
|
type: Directive,
|
|
225
228
|
args: [{
|
|
226
229
|
standalone: true,
|
|
@@ -231,9 +234,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
231
234
|
role: 'tabpanel',
|
|
232
235
|
tabIndex: '0',
|
|
233
236
|
'[attr.aria-labelledby]': 'labelledBy()',
|
|
234
|
-
'[attr.data-
|
|
237
|
+
'[attr.data-active]': 'active()',
|
|
235
238
|
'[attr.data-orientation]': 'tabset.orientation()',
|
|
236
|
-
'[hidden]': '!active()',
|
|
237
239
|
},
|
|
238
240
|
}]
|
|
239
241
|
}] });
|
|
@@ -244,10 +246,6 @@ class NgpTabset {
|
|
|
244
246
|
* Access the global tabset configuration
|
|
245
247
|
*/
|
|
246
248
|
this.config = injectTabsConfig();
|
|
247
|
-
/**
|
|
248
|
-
* Access the roving focus group directive
|
|
249
|
-
*/
|
|
250
|
-
this.rovingFocusGroup = injectRovingFocusGroup();
|
|
251
249
|
/**
|
|
252
250
|
* Define the id for the tabset
|
|
253
251
|
*/
|
|
@@ -288,13 +286,6 @@ class NgpTabset {
|
|
|
288
286
|
// otherwise return the first tab
|
|
289
287
|
return panels[0]?.value();
|
|
290
288
|
});
|
|
291
|
-
// default the orientation to horizontal
|
|
292
|
-
this.rovingFocusGroup.orientation.set(this.orientation());
|
|
293
|
-
}
|
|
294
|
-
ngOnChanges(changes) {
|
|
295
|
-
if ('orientation' in changes) {
|
|
296
|
-
this.rovingFocusGroup.orientation.set(this.orientation());
|
|
297
|
-
}
|
|
298
289
|
}
|
|
299
290
|
/**
|
|
300
291
|
* Select a tab by its value
|
|
@@ -303,23 +294,29 @@ class NgpTabset {
|
|
|
303
294
|
select(value) {
|
|
304
295
|
this.value.set(value);
|
|
305
296
|
}
|
|
306
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
307
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "18.
|
|
297
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpTabset, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
298
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "18.1.1", type: NgpTabset, isStandalone: true, selector: "[ngpTabset]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "ngpTabsetValue", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "ngpTabsetOrientation", isSignal: true, isRequired: false, transformFunction: null }, activateOnFocus: { classPropertyName: "activateOnFocus", publicName: "ngpTabsetActivateOnFocus", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "ngpTabsetValueChange" }, host: { properties: { "attr.id": "id()", "attr.data-orientation": "orientation()" } }, providers: [
|
|
299
|
+
{ provide: NgpTabsetToken, useExisting: NgpTabset },
|
|
300
|
+
{ provide: NgpOrientationToken, useExisting: NgpTabset },
|
|
301
|
+
], queries: [{ propertyName: "panels", predicate: NgpTabPanelToken, descendants: true, isSignal: true }], exportAs: ["ngpTabset"], hostDirectives: [{ directive: i1.NgpRovingFocusGroup }], ngImport: i0 }); }
|
|
308
302
|
}
|
|
309
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
303
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpTabset, decorators: [{
|
|
310
304
|
type: Directive,
|
|
311
305
|
args: [{
|
|
312
306
|
standalone: true,
|
|
313
307
|
selector: '[ngpTabset]',
|
|
314
308
|
exportAs: 'ngpTabset',
|
|
315
|
-
providers: [
|
|
309
|
+
providers: [
|
|
310
|
+
{ provide: NgpTabsetToken, useExisting: NgpTabset },
|
|
311
|
+
{ provide: NgpOrientationToken, useExisting: NgpTabset },
|
|
312
|
+
],
|
|
316
313
|
hostDirectives: [NgpRovingFocusGroup],
|
|
317
314
|
host: {
|
|
318
315
|
'[attr.id]': 'id()',
|
|
319
316
|
'[attr.data-orientation]': 'orientation()',
|
|
320
317
|
},
|
|
321
318
|
}]
|
|
322
|
-
}]
|
|
319
|
+
}] });
|
|
323
320
|
|
|
324
321
|
/**
|
|
325
322
|
* Copyright © 2024 Angular Primitives.
|