ng-primitives 0.41.0 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
1
  import { BooleanInput } from '@angular/cdk/coercion';
2
2
  import * as i0 from "@angular/core";
3
- import * as i1 from "ng-primitives/form-field";
4
3
  /**
5
4
  * Apply the `ngpCheckbox` directive to an element to that represents the checkbox, such as a `button`.
6
5
  */
@@ -42,5 +41,5 @@ export declare class NgpCheckbox {
42
41
  protected onEnter(event: KeyboardEvent): void;
43
42
  toggle(event?: Event): void;
44
43
  static ɵfac: i0.ɵɵFactoryDeclaration<NgpCheckbox, never>;
45
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgpCheckbox, "[ngpCheckbox]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "checked": { "alias": "ngpCheckboxChecked"; "required": false; "isSignal": true; }; "indeterminate": { "alias": "ngpCheckboxIndeterminate"; "required": false; "isSignal": true; }; "required": { "alias": "ngpCheckboxRequired"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpCheckboxDisabled"; "required": false; "isSignal": true; }; }, { "checkedChange": "ngpCheckboxCheckedChange"; "indeterminateChange": "ngpCheckboxIndeterminateChange"; }, never, never, true, [{ directive: typeof i1.NgpFormControl; inputs: {}; outputs: {}; }]>;
44
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgpCheckbox, "[ngpCheckbox]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "checked": { "alias": "ngpCheckboxChecked"; "required": false; "isSignal": true; }; "indeterminate": { "alias": "ngpCheckboxIndeterminate"; "required": false; "isSignal": true; }; "required": { "alias": "ngpCheckboxRequired"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpCheckboxDisabled"; "required": false; "isSignal": true; }; }, { "checkedChange": "ngpCheckboxCheckedChange"; "indeterminateChange": "ngpCheckboxIndeterminateChange"; }, never, never, true, never>;
46
45
  }
@@ -1,7 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { input, booleanAttribute, output, HostListener, Directive } from '@angular/core';
3
- import * as i1 from 'ng-primitives/form-field';
4
- import { syncFormControl, NgpFormControl } from 'ng-primitives/form-field';
3
+ import { setupFormControl } from 'ng-primitives/form-field';
5
4
  import { setupInteractions } from 'ng-primitives/internal';
6
5
  import { uniqueId } from 'ng-primitives/utils';
7
6
  import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
@@ -77,7 +76,7 @@ class NgpCheckbox {
77
76
  * The state of the checkbox.
78
77
  */
79
78
  this.state = checkboxState(this);
80
- syncFormControl({ disabled: this.state.disabled });
79
+ setupFormControl({ id: this.state.id, disabled: this.state.disabled });
81
80
  setupInteractions({
82
81
  hover: true,
83
82
  press: true,
@@ -104,14 +103,13 @@ class NgpCheckbox {
104
103
  }
105
104
  }
106
105
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpCheckbox, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
107
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpCheckbox, isStandalone: true, selector: "[ngpCheckbox]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "ngpCheckboxChecked", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "ngpCheckboxIndeterminate", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "ngpCheckboxRequired", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpCheckboxDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "ngpCheckboxCheckedChange", indeterminateChange: "ngpCheckboxIndeterminateChange" }, host: { attributes: { "role": "checkbox" }, listeners: { "keydown.enter": "onEnter($event)", "click": "toggle($event)", "keydown.space": "toggle($event)" }, properties: { "attr.aria-checked": "state.indeterminate() ? \"mixed\" : state.checked()", "attr.data-checked": "state.checked() ? \"\" : null", "attr.data-indeterminate": "state.indeterminate() ? \"\" : null", "attr.aria-disabled": "state.disabled()", "tabindex": "state.disabled() ? -1 : 0" } }, providers: [provideCheckboxState()], hostDirectives: [{ directive: i1.NgpFormControl }], ngImport: i0 }); }
106
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpCheckbox, isStandalone: true, selector: "[ngpCheckbox]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "ngpCheckboxChecked", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "ngpCheckboxIndeterminate", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "ngpCheckboxRequired", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpCheckboxDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "ngpCheckboxCheckedChange", indeterminateChange: "ngpCheckboxIndeterminateChange" }, host: { attributes: { "role": "checkbox" }, listeners: { "keydown.enter": "onEnter($event)", "click": "toggle($event)", "keydown.space": "toggle($event)" }, properties: { "attr.aria-checked": "state.indeterminate() ? \"mixed\" : state.checked()", "attr.data-checked": "state.checked() ? \"\" : null", "attr.data-indeterminate": "state.indeterminate() ? \"\" : null", "attr.aria-disabled": "state.disabled()", "tabindex": "state.disabled() ? -1 : 0" } }, providers: [provideCheckboxState()], ngImport: i0 }); }
108
107
  }
109
108
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpCheckbox, decorators: [{
110
109
  type: Directive,
111
110
  args: [{
112
111
  selector: '[ngpCheckbox]',
113
112
  providers: [provideCheckboxState()],
114
- hostDirectives: [NgpFormControl],
115
113
  host: {
116
114
  role: 'checkbox',
117
115
  '[attr.aria-checked]': 'state.indeterminate() ? "mixed" : state.checked()',
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-checkbox.mjs","sources":["../../../../packages/ng-primitives/checkbox/src/checkbox/checkbox-state.ts","../../../../packages/ng-primitives/checkbox/src/checkbox/checkbox.ts","../../../../packages/ng-primitives/checkbox/src/ng-primitives-checkbox.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpCheckbox } from './checkbox';\n\n/**\n * The state token for the Checkbox primitive.\n */\nexport const NgpCheckboxStateToken = createStateToken<NgpCheckbox>('Checkbox');\n\n/**\n * Provides the Checkbox state.\n */\nexport const provideCheckboxState = createStateProvider(NgpCheckboxStateToken);\n\n/**\n * Injects the Checkbox state.\n */\nexport const injectCheckboxState = createStateInjector(NgpCheckboxStateToken);\n\n/**\n * The Checkbox state registration function.\n */\nexport const checkboxState = createState(NgpCheckboxStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, HostListener, booleanAttribute, input, output } from '@angular/core';\nimport { NgpFormControl, syncFormControl } from 'ng-primitives/form-field';\nimport { setupInteractions } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { checkboxState, provideCheckboxState } from './checkbox-state';\n\n/**\n * Apply the `ngpCheckbox` directive to an element to that represents the checkbox, such as a `button`.\n */\n@Directive({\n selector: '[ngpCheckbox]',\n providers: [provideCheckboxState()],\n hostDirectives: [NgpFormControl],\n host: {\n role: 'checkbox',\n '[attr.aria-checked]': 'state.indeterminate() ? \"mixed\" : state.checked()',\n '[attr.data-checked]': 'state.checked() ? \"\" : null',\n '[attr.data-indeterminate]': 'state.indeterminate() ? \"\" : null',\n '[attr.aria-disabled]': 'state.disabled()',\n '[tabindex]': 'state.disabled() ? -1 : 0',\n },\n})\nexport class NgpCheckbox {\n /**\n * The id of the checkbox.\n * @internal\n */\n readonly id = input(uniqueId('ngp-checkbox'));\n\n /**\n * Defines whether the checkbox is checked.\n */\n readonly checked = input<boolean, BooleanInput>(false, {\n alias: 'ngpCheckboxChecked',\n transform: booleanAttribute,\n });\n\n /**\n * The event that is emitted when the checkbox value changes.\n */\n readonly checkedChange = output<boolean>({\n alias: 'ngpCheckboxCheckedChange',\n });\n\n /**\n * Defines whether the checkbox is indeterminate.\n */\n readonly indeterminate = input<boolean, BooleanInput>(false, {\n alias: 'ngpCheckboxIndeterminate',\n transform: booleanAttribute,\n });\n\n /**\n * The event that is emitted when the indeterminate value changes.\n */\n readonly indeterminateChange = output<boolean>({\n alias: 'ngpCheckboxIndeterminateChange',\n });\n\n /**\n * Whether the checkbox is required.\n */\n readonly required = input<boolean, BooleanInput>(false, {\n alias: 'ngpCheckboxRequired',\n transform: booleanAttribute,\n });\n\n /**\n * Defines whether the checkbox is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpCheckboxDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The state of the checkbox.\n */\n protected readonly state = checkboxState<NgpCheckbox>(this);\n\n constructor() {\n syncFormControl({ disabled: this.state.disabled });\n setupInteractions({\n hover: true,\n press: true,\n focusVisible: true,\n disabled: this.state.disabled,\n });\n }\n\n @HostListener('keydown.enter', ['$event'])\n protected onEnter(event: KeyboardEvent): void {\n // According to WAI ARIA, Checkboxes don't activate on enter keypress\n event.preventDefault();\n }\n\n @HostListener('click', ['$event'])\n @HostListener('keydown.space', ['$event'])\n toggle(event?: Event): void {\n if (this.state.disabled()) {\n return;\n }\n\n // prevent this firing twice in cases where the label is clicked and the checkbox is clicked by the one event\n event?.preventDefault();\n\n this.state.checked.set(this.state.indeterminate() ? true : !this.state.checked());\n this.checkedChange.emit(this.state.checked());\n\n // if the checkbox was indeterminate, it isn't anymore\n if (this.state.indeterminate()) {\n this.state.indeterminate.set(false);\n this.indeterminateChange.emit(false);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './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,EAAA,UAAA,EAAA,2BAAA,EAAA,EAAA,EAAA,SAAA,EAAA,CAAC,oBAAoB,EAAE,CAAC,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,cAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAWxB,WAAW,EAAA,UAAA,EAAA,CAAA;kBAbvB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,SAAS,EAAE,CAAC,oBAAoB,EAAE,CAAC;oBACnC,cAAc,EAAE,CAAC,cAAc,CAAC;AAChC,oBAAA,IAAI,EAAE;AACJ,wBAAA,IAAI,EAAE,UAAU;AAChB,wBAAA,qBAAqB,EAAE,mDAAmD;AAC1E,wBAAA,qBAAqB,EAAE,6BAA6B;AACpD,wBAAA,2BAA2B,EAAE,mCAAmC;AAChE,wBAAA,sBAAsB,EAAE,kBAAkB;AAC1C,wBAAA,YAAY,EAAE,2BAA2B;AAC1C,qBAAA;AACF,iBAAA;wDAsEW,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,eAAe,EAAE,CAAC,QAAQ,CAAC;gBAQzC,MAAM,EAAA,CAAA;sBAFL,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;;sBAChC,YAAY;uBAAC,eAAe,EAAE,CAAC,QAAQ,CAAC;;;AClG3C;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-checkbox.mjs","sources":["../../../../packages/ng-primitives/checkbox/src/checkbox/checkbox-state.ts","../../../../packages/ng-primitives/checkbox/src/checkbox/checkbox.ts","../../../../packages/ng-primitives/checkbox/src/ng-primitives-checkbox.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpCheckbox } from './checkbox';\n\n/**\n * The state token for the Checkbox primitive.\n */\nexport const NgpCheckboxStateToken = createStateToken<NgpCheckbox>('Checkbox');\n\n/**\n * Provides the Checkbox state.\n */\nexport const provideCheckboxState = createStateProvider(NgpCheckboxStateToken);\n\n/**\n * Injects the Checkbox state.\n */\nexport const injectCheckboxState = createStateInjector(NgpCheckboxStateToken);\n\n/**\n * The Checkbox state registration function.\n */\nexport const checkboxState = createState(NgpCheckboxStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, HostListener, booleanAttribute, input, output } from '@angular/core';\nimport { setupFormControl } from 'ng-primitives/form-field';\nimport { setupInteractions } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { checkboxState, provideCheckboxState } from './checkbox-state';\n\n/**\n * Apply the `ngpCheckbox` directive to an element to that represents the checkbox, such as a `button`.\n */\n@Directive({\n selector: '[ngpCheckbox]',\n providers: [provideCheckboxState()],\n host: {\n role: 'checkbox',\n '[attr.aria-checked]': 'state.indeterminate() ? \"mixed\" : state.checked()',\n '[attr.data-checked]': 'state.checked() ? \"\" : null',\n '[attr.data-indeterminate]': 'state.indeterminate() ? \"\" : null',\n '[attr.aria-disabled]': 'state.disabled()',\n '[tabindex]': 'state.disabled() ? -1 : 0',\n },\n})\nexport class NgpCheckbox {\n /**\n * The id of the checkbox.\n * @internal\n */\n readonly id = input(uniqueId('ngp-checkbox'));\n\n /**\n * Defines whether the checkbox is checked.\n */\n readonly checked = input<boolean, BooleanInput>(false, {\n alias: 'ngpCheckboxChecked',\n transform: booleanAttribute,\n });\n\n /**\n * The event that is emitted when the checkbox value changes.\n */\n readonly checkedChange = output<boolean>({\n alias: 'ngpCheckboxCheckedChange',\n });\n\n /**\n * Defines whether the checkbox is indeterminate.\n */\n readonly indeterminate = input<boolean, BooleanInput>(false, {\n alias: 'ngpCheckboxIndeterminate',\n transform: booleanAttribute,\n });\n\n /**\n * The event that is emitted when the indeterminate value changes.\n */\n readonly indeterminateChange = output<boolean>({\n alias: 'ngpCheckboxIndeterminateChange',\n });\n\n /**\n * Whether the checkbox is required.\n */\n readonly required = input<boolean, BooleanInput>(false, {\n alias: 'ngpCheckboxRequired',\n transform: booleanAttribute,\n });\n\n /**\n * Defines whether the checkbox is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpCheckboxDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The state of the checkbox.\n */\n protected readonly state = checkboxState<NgpCheckbox>(this);\n\n constructor() {\n setupFormControl({ id: this.state.id, disabled: this.state.disabled });\n setupInteractions({\n hover: true,\n press: true,\n focusVisible: true,\n disabled: this.state.disabled,\n });\n }\n\n @HostListener('keydown.enter', ['$event'])\n protected onEnter(event: KeyboardEvent): void {\n // According to WAI ARIA, Checkboxes don't activate on enter keypress\n event.preventDefault();\n }\n\n @HostListener('click', ['$event'])\n @HostListener('keydown.space', ['$event'])\n toggle(event?: Event): void {\n if (this.state.disabled()) {\n return;\n }\n\n // prevent this firing twice in cases where the label is clicked and the checkbox is clicked by the one event\n event?.preventDefault();\n\n this.state.checked.set(this.state.indeterminate() ? true : !this.state.checked());\n this.checkedChange.emit(this.state.checked());\n\n // if the checkbox was indeterminate, it isn't anymore\n if (this.state.indeterminate()) {\n this.state.indeterminate.set(false);\n this.indeterminateChange.emit(false);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAQA;;AAEG;AACI,MAAM,qBAAqB,GAAG,gBAAgB,CAAc,UAAU,CAAC;AAE9E;;AAEG;MACU,oBAAoB,GAAG,mBAAmB,CAAC,qBAAqB;AAE7E;;AAEG;MACU,mBAAmB,GAAG,mBAAmB,CAAC,qBAAqB;AAE5E;;AAEG;AACI,MAAM,aAAa,GAAG,WAAW,CAAC,qBAAqB,CAAC;;ACnB/D;;AAEG;MAaU,WAAW,CAAA;AA0DtB,IAAA,WAAA,GAAA;AAzDA;;;AAGG;QACM,IAAE,CAAA,EAAA,GAAG,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;AAE7C;;AAEG;AAC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AmD;AAC1E,wBAAA,qBAAqB,EAAE,6BAA6B;AACpD,wBAAA,2BAA2B,EAAE,mCAAmC;AAChE,wBAAA,sBAAsB,EAAE,kBAAkB;AAC1C,wBAAA,YAAY,EAAE,2BAA2B;AAC1C,qBAAA;AACF,iBAAA;wDAsEW,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,eAAe,EAAE,CAAC,QAAQ,CAAC;gBAQzC,MAAM,EAAA,CAAA;sBAFL,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;;sBAChC,YAAY;uBAAC,eAAe,EAAE,CAAC,QAAQ,CAAC;;;ACjG3C;;AAEG;;;;"}
@@ -1,8 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, effect, Directive, computed, booleanAttribute, signal, contentChild, inject, ElementRef, HostListener } from '@angular/core';
2
+ import { input, effect, Directive, computed, booleanAttribute, signal, afterRenderEffect, contentChild, inject, ElementRef, HostListener } from '@angular/core';
3
3
  import { uniqueId, onBooleanChange, onChange } from 'ng-primitives/utils';
4
4
  import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
5
- import { syncState } from 'ng-primitives/internal';
5
+ import { injectElementRef, explicitEffect } from 'ng-primitives/internal';
6
6
  import { NgControl } from '@angular/forms';
7
7
 
8
8
  /**
@@ -141,14 +141,6 @@ const injectFormControlState = createStateInjector(NgpFormControlStateToken);
141
141
  * The FormControl state registration function.
142
142
  */
143
143
  const formControlState = createState(NgpFormControlStateToken);
144
- /**
145
- * Sync the form control state with control state.
146
- * @param disabled The disabled state of the control.
147
- */
148
- function syncFormControl({ disabled }) {
149
- const formControl = injectFormControlState();
150
- syncState(disabled, formControl().disabled);
151
- }
152
144
 
153
145
  /**
154
146
  * Typically this primitive would be not be used directly, but instead a more specific form control primitive would be used (e.g. `ngpInput`). All of our form control primitives use `ngpFormControl` internally so they will have the same accessibility features as described below.
@@ -168,29 +160,15 @@ class NgpFormControl {
168
160
  alias: 'ngpFormControlDisabled',
169
161
  transform: booleanAttribute,
170
162
  });
171
- /**
172
- * Access the form field that the form control is associated with.
173
- */
174
- this.formField = injectFormFieldState({ optional: true });
175
- /**
176
- * Determine the aria-labelledby attribute value.
177
- */
178
- this.ariaLabelledBy = computed(() => this.formField()?.labels().join(' '));
179
- /**
180
- * Determine the aria-describedby attribute value.
181
- */
182
- this.ariaDescribedBy = computed(() => this.formField()?.descriptions().join(' '));
183
163
  /**
184
164
  * The state of the form control.
185
165
  */
186
166
  this.state = formControlState(this);
187
- effect(onCleanup => {
188
- this.formField()?.setFormControl(this.state.id());
189
- onCleanup(() => this.formField()?.removeFormControl());
190
- });
167
+ // Sync the form control state with the control state.
168
+ setupFormControl({ id: this.state.id, disabled: this.state.disabled });
191
169
  }
192
170
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpFormControl, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
193
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpFormControl, isStandalone: true, selector: "[ngpFormControl]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpFormControlDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "id": "id()", "attr.aria-labelledby": "ariaLabelledBy()", "attr.aria-describedby": "ariaDescribedBy()", "attr.data-invalid": "formField()?.invalid() ? \"\" : null", "attr.data-valid": "formField()?.valid() ? \"\" : null", "attr.data-touched": "formField()?.touched() ? \"\" : null", "attr.data-pristine": "formField()?.pristine() ? \"\" : null", "attr.data-dirty": "formField()?.dirty() ? \"\" : null", "attr.data-pending": "formField()?.pending() ? \"\" : null", "attr.data-disabled": "formField()?.disabled() || state.disabled() ? \"\" : null" } }, providers: [provideFormControlState()], exportAs: ["ngpFormControl"], ngImport: i0 }); }
171
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpFormControl, isStandalone: true, selector: "[ngpFormControl]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpFormControlDisabled", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideFormControlState()], exportAs: ["ngpFormControl"], ngImport: i0 }); }
194
172
  }
195
173
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpFormControl, decorators: [{
196
174
  type: Directive,
@@ -198,20 +176,65 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
198
176
  selector: '[ngpFormControl]',
199
177
  exportAs: 'ngpFormControl',
200
178
  providers: [provideFormControlState()],
201
- host: {
202
- '[id]': 'id()',
203
- '[attr.aria-labelledby]': 'ariaLabelledBy()',
204
- '[attr.aria-describedby]': 'ariaDescribedBy()',
205
- '[attr.data-invalid]': 'formField()?.invalid() ? "" : null',
206
- '[attr.data-valid]': 'formField()?.valid() ? "" : null',
207
- '[attr.data-touched]': 'formField()?.touched() ? "" : null',
208
- '[attr.data-pristine]': 'formField()?.pristine() ? "" : null',
209
- '[attr.data-dirty]': 'formField()?.dirty() ? "" : null',
210
- '[attr.data-pending]': 'formField()?.pending() ? "" : null',
211
- '[attr.data-disabled]': 'formField()?.disabled() || state.disabled() ? "" : null',
212
- },
213
179
  }]
214
180
  }], ctorParameters: () => [] });
181
+ function setupFormControl({ id = signal(uniqueId('ngp-form-control')), disabled = signal(false), }) {
182
+ const element = injectElementRef().nativeElement;
183
+ // Access the form field that the form control is associated with.
184
+ const formField = injectFormFieldState({ optional: true });
185
+ // Determine the aria-labelledby attribute value.
186
+ const ariaLabelledBy = computed(() => formField()?.labels().join(' '));
187
+ // Determine the aria-describedby attribute value.
188
+ const ariaDescribedBy = computed(() => formField()?.descriptions().join(' '));
189
+ explicitEffect([id], ([id], onCleanup) => {
190
+ formField()?.setFormControl(id);
191
+ onCleanup(() => formField()?.removeFormControl());
192
+ });
193
+ afterRenderEffect({
194
+ write: () => {
195
+ setAttribute(element, 'id', id());
196
+ setAttribute(element, 'aria-labelledby', ariaLabelledBy());
197
+ setAttribute(element, 'aria-describedby', ariaDescribedBy());
198
+ setStateAttribute(element, formField()?.invalid(), 'data-invalid');
199
+ setStateAttribute(element, formField()?.valid(), 'data-valid');
200
+ setStateAttribute(element, formField()?.touched(), 'data-touched');
201
+ setStateAttribute(element, formField()?.pristine(), 'data-pristine');
202
+ setStateAttribute(element, formField()?.dirty(), 'data-dirty');
203
+ setStateAttribute(element, formField()?.pending(), 'data-pending');
204
+ setStateAttribute(element, disabled() || formField()?.disabled(), 'data-disabled');
205
+ },
206
+ });
207
+ }
208
+ /**
209
+ * Sets the attribute on the element. If the value is not empty, the attribute is set to the value.
210
+ * If the value is empty, the attribute is removed.
211
+ * @param element The element to set the attribute on.
212
+ * @param attribute The attribute to set on the element.
213
+ * @param value The value to set on the attribute.
214
+ */
215
+ function setAttribute(element, attribute, value) {
216
+ if (value && value.length > 0) {
217
+ element.setAttribute(attribute, value);
218
+ }
219
+ else {
220
+ element.removeAttribute(attribute);
221
+ }
222
+ }
223
+ /**
224
+ * Sets the attribute on the element based on the state. If the state is true, the attribute
225
+ * is set to an empty string. If the state is false, the attribute is removed.
226
+ * @param element The element to set the attribute on.
227
+ * @param state The state to set the attribute based on.
228
+ * @param attribute The attribute to set on the element.
229
+ */
230
+ function setStateAttribute(element, state, attribute) {
231
+ if (state) {
232
+ element.setAttribute(attribute, '');
233
+ }
234
+ else {
235
+ element.removeAttribute(attribute);
236
+ }
237
+ }
215
238
 
216
239
  /**
217
240
  * The `NgpFormField` directive is a container for form field elements. Any labels, form controls, or descriptions should be placed within this directive.
@@ -476,5 +499,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
476
499
  * Generated bundle index. Do not edit.
477
500
  */
478
501
 
479
- export { NgpDescription, NgpError, NgpFormControl, NgpFormField, NgpLabel, injectFormControlState, injectFormFieldState, provideFormControlState, provideFormFieldState, syncFormControl };
502
+ export { NgpDescription, NgpError, NgpFormControl, NgpFormField, NgpLabel, injectFormControlState, injectFormFieldState, provideFormControlState, provideFormFieldState, setupFormControl };
480
503
  //# sourceMappingURL=ng-primitives-form-field.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-form-field.mjs","sources":["../../../../packages/ng-primitives/form-field/src/form-field/form-field-state.ts","../../../../packages/ng-primitives/form-field/src/description/description.ts","../../../../packages/ng-primitives/form-field/src/error/error.ts","../../../../packages/ng-primitives/form-field/src/form-control/form-control-state.ts","../../../../packages/ng-primitives/form-field/src/form-control/form-control.ts","../../../../packages/ng-primitives/form-field/src/form-field/form-field.ts","../../../../packages/ng-primitives/form-field/src/label/label.ts","../../../../packages/ng-primitives/form-field/src/ng-primitives-form-field.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFormField } from './form-field';\n\n/**\n * The state token for the FormField primitive.\n */\nexport const NgpFormFieldStateToken = createStateToken<NgpFormField>('FormField');\n\n/**\n * Provides the FormField state.\n */\nexport const provideFormFieldState = createStateProvider(NgpFormFieldStateToken);\n\n/**\n * Injects the FormField state.\n */\nexport const injectFormFieldState = createStateInjector(NgpFormFieldStateToken);\n\n/**\n * The FormField state registration function.\n */\nexport const formFieldState = createState(NgpFormFieldStateToken);\n","import { Directive, effect, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\n\n/**\n * The `NgpDescription` directive is used to mark a description element within a form field. There may be multiple descriptions associated with a form control.\n */\n@Directive({\n selector: '[ngpDescription]',\n exportAs: 'ngpDescription',\n host: {\n '[attr.id]': 'id()',\n '[attr.data-invalid]': 'formField()?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField()?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField()?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField()?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField()?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField()?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField()?.disabled() ? \"\" : null',\n },\n})\nexport class NgpDescription {\n /**\n * The id of the description. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-description'));\n /**\n * Access the form field that the description is associated with.\n */\n protected readonly formField = injectFormFieldState({ optional: true });\n\n constructor() {\n effect(onCleanup => {\n this.formField()?.addDescription(this.id());\n onCleanup(() => this.formField()?.removeDescription(this.id()));\n });\n }\n}\n","import { Directive, OnChanges, OnDestroy, SimpleChanges, computed, input } from '@angular/core';\nimport { onBooleanChange, uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\n\n/**\n * The `NgpError` directive is used to mark an error message element within a form field. There may be multiple error messages associated with a form control.\n */\n@Directive({\n selector: '[ngpError]',\n exportAs: 'ngpError',\n host: {\n '[attr.id]': 'id()',\n '[attr.data-invalid]': 'formField()?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField()?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField()?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField()?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField()?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField()?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField()?.disabled() ? \"\" : null',\n '[attr.data-validator]': 'state()',\n },\n})\nexport class NgpError implements OnChanges, OnDestroy {\n /**\n * Access the form field that the description is associated with.\n */\n protected readonly formField = injectFormFieldState({ optional: true });\n\n /**\n * The id of the error message. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-error'));\n\n /**\n * The validator associated with the error message.\n */\n readonly validator = input<string | null>(null, {\n alias: 'ngpErrorValidator',\n });\n\n /**\n * Determine if there is an error message.\n */\n protected readonly hasError = computed(() => {\n const errors = this.formField()?.errors() ?? [];\n const validator = this.validator();\n\n return validator ? errors?.includes(validator) : errors?.length > 0;\n });\n\n /**\n * Determine whether the validator associated with this error is failing.\n */\n protected readonly state = computed(() => (this.hasError() ? 'fail' : 'pass'));\n\n constructor() {\n // add or remove the error message when the error state changes\n onBooleanChange(\n this.hasError,\n () => this.formField()?.addDescription(this.id()),\n () => this.formField()?.removeDescription(this.id()),\n );\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if ('id' in changes) {\n this.formField()?.removeDescription(changes['id'].previousValue);\n }\n }\n\n ngOnDestroy(): void {\n this.formField()?.removeDescription(this.id());\n }\n}\n","import { Signal } from '@angular/core';\nimport { syncState } from 'ng-primitives/internal';\nimport {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFormControl } from './form-control';\n\n/**\n * The state token for the FormControl primitive.\n */\nexport const NgpFormControlStateToken = createStateToken<NgpFormControl>('FormControl');\n\n/**\n * Provides the FormControl state.\n */\nexport const provideFormControlState = createStateProvider(NgpFormControlStateToken);\n\n/**\n * Injects the FormControl state.\n */\nexport const injectFormControlState = createStateInjector(NgpFormControlStateToken);\n\n/**\n * The FormControl state registration function.\n */\nexport const formControlState = createState(NgpFormControlStateToken);\n\ninterface SyncFormControl {\n disabled: Signal<boolean>;\n}\n\n/**\n * Sync the form control state with control state.\n * @param disabled The disabled state of the control.\n */\nexport function syncFormControl({ disabled }: SyncFormControl) {\n const formControl = injectFormControlState();\n syncState(disabled, formControl().disabled);\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, effect, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\nimport { formControlState, provideFormControlState } from './form-control-state';\n\n/**\n * Typically this primitive would be not be used directly, but instead a more specific form control primitive would be used (e.g. `ngpInput`). All of our form control primitives use `ngpFormControl` internally so they will have the same accessibility features as described below.\n *\n * The `NgpFormControl` directive is used to mark a form control element within a form field. This element will have an `aria-labelledby` attribute set to the ID of the label element within the form field and an `aria-describedby` attribute set to the ID of the description elements within the form field.\n */\n@Directive({\n selector: '[ngpFormControl]',\n exportAs: 'ngpFormControl',\n providers: [provideFormControlState()],\n host: {\n '[id]': 'id()',\n '[attr.aria-labelledby]': 'ariaLabelledBy()',\n '[attr.aria-describedby]': 'ariaDescribedBy()',\n '[attr.data-invalid]': 'formField()?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField()?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField()?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField()?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField()?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField()?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField()?.disabled() || state.disabled() ? \"\" : null',\n },\n})\nexport class NgpFormControl {\n /**\n * The id of the form control. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-form-control'));\n\n /**\n * Whether the form control is disabled by a parent.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpFormControlDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Access the form field that the form control is associated with.\n */\n protected readonly formField = injectFormFieldState({ optional: true });\n /**\n * Determine the aria-labelledby attribute value.\n */\n protected readonly ariaLabelledBy = computed(() => this.formField()?.labels().join(' '));\n\n /**\n * Determine the aria-describedby attribute value.\n */\n protected readonly ariaDescribedBy = computed(() => this.formField()?.descriptions().join(' '));\n\n /**\n * The state of the form control.\n */\n private readonly state = formControlState<NgpFormControl>(this);\n\n constructor() {\n effect(onCleanup => {\n this.formField()?.setFormControl(this.state.id());\n onCleanup(() => this.formField()?.removeFormControl());\n });\n }\n}\n","import { Directive, OnDestroy, contentChild, signal } from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { onChange } from 'ng-primitives/utils';\nimport { Subscription } from 'rxjs';\nimport { formFieldState, provideFormFieldState } from './form-field-state';\n\n/**\n * The `NgpFormField` directive is a container for form field elements. Any labels, form controls, or descriptions should be placed within this directive.\n */\n@Directive({\n selector: '[ngpFormField]',\n exportAs: 'ngpFormField',\n providers: [provideFormFieldState()],\n host: {\n '[attr.data-invalid]': 'invalid() ? \"\" : null',\n '[attr.data-valid]': 'valid() ? \"\" : null',\n '[attr.data-touched]': 'touched() ? \"\" : null',\n '[attr.data-pristine]': 'pristine() ? \"\" : null',\n '[attr.data-dirty]': 'dirty() ? \"\" : null',\n '[attr.data-pending]': 'pending() ? \"\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n },\n})\nexport class NgpFormField implements OnDestroy {\n /**\n * Store the form label.\n * @internal\n */\n readonly labels = signal<string[]>([]);\n\n /**\n * Store the form descriptions.\n * @internal\n */\n readonly descriptions = signal<string[]>([]);\n\n /**\n * Store the id of the associated form control.\n * @internal\n */\n readonly formControl = signal<string | null>(null);\n\n /**\n * Find any NgControl within the form field.\n * @internal\n */\n private readonly ngControl = contentChild(NgControl);\n\n /**\n * Store the validation error messages.\n * @internal\n */\n readonly errors = signal<string[]>([]);\n\n /**\n * Whether the control is pristine.\n * @internal\n */\n readonly pristine = signal<boolean | null>(null);\n\n /**\n * Whether the control is touched.\n * @internal\n */\n readonly touched = signal<boolean | null>(null);\n\n /**\n * Whether the control is dirty.\n * @internal\n */\n readonly dirty = signal<boolean | null>(null);\n\n /**\n * Whether the control is valid.\n */\n readonly valid = signal<boolean | null>(null);\n\n /**\n * Whether the control is invalid.\n * @internal\n */\n readonly invalid = signal<boolean | null>(null);\n\n /**\n * Whether the control is pending.\n * @internal\n */\n readonly pending = signal<boolean | null>(null);\n\n /**\n * Whether the control is disabled.\n * @internal\n */\n readonly disabled = signal<boolean | null>(null);\n\n /**\n * Store the current status subscription.\n */\n private subscription?: Subscription;\n\n /**\n * The form field state.\n */\n protected readonly state = formFieldState<NgpFormField>(this);\n\n constructor() {\n // any time the ngControl changes, setup the subscriptions.\n onChange(this.ngControl, this.setupSubscriptions.bind(this));\n }\n\n ngOnDestroy(): void {\n this.subscription?.unsubscribe();\n }\n\n /**\n * Setup a listener for the form control status.\n * @param control\n */\n private setupSubscriptions(control: NgControl | null | undefined): void {\n // Unsubscribe from the previous subscriptions.\n this.subscription?.unsubscribe();\n\n // set the initial values\n this.updateStatus();\n\n // Listen for changes to the form control.\n this.subscription = control?.valueChanges?.subscribe(this.updateStatus.bind(this));\n }\n\n private updateStatus(): void {\n const control = this.ngControl();\n\n if (!control) {\n return;\n }\n\n this.pristine.set(control.pristine);\n this.touched.set(control.touched);\n this.dirty.set(control.dirty);\n this.valid.set(control.valid);\n this.invalid.set(control.invalid);\n this.pending.set(control.pending);\n this.disabled.set(control.disabled);\n this.errors.set(control?.errors ? Object.keys(control.errors) : []);\n }\n\n /**\n * Register the id of the associated form control.\n * @param id\n * @internal\n */\n setFormControl(id: string): void {\n this.formControl.set(id);\n }\n\n /**\n * Register a label with the form field.\n * @param label\n * @internal\n */\n addLabel(label: string): void {\n this.labels.update(labels => [...labels, label]);\n }\n\n /**\n * Register a description with the form field.\n * @param description\n * @internal\n */\n addDescription(description: string): void {\n this.descriptions.update(descriptions => [...descriptions, description]);\n }\n\n /**\n * Remove the associated form control.\n * @internal\n */\n removeFormControl(): void {\n this.formControl.set(null);\n }\n\n /**\n * Remove a label from the form field.\n * @param label\n * @internal\n */\n removeLabel(label: string): void {\n this.labels.update(labels => labels.filter(l => l !== label));\n }\n\n /**\n * Remove a description from the form field.\n * @param description\n * @internal\n */\n removeDescription(description: string): void {\n this.descriptions.update(descriptions => descriptions.filter(d => d !== description));\n }\n}\n","import {\n computed,\n Directive,\n effect,\n ElementRef,\n HostListener,\n inject,\n input,\n} from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\n\n/**\n * The `NgpLabel` directive is used to mark a label element within a form field. Preferably, there should use an HTML `<label>` element.\n */\n@Directive({\n selector: '[ngpLabel]',\n exportAs: 'ngpLabel',\n host: {\n '[attr.id]': 'id()',\n '[attr.for]': 'htmlFor()',\n '[attr.data-invalid]': 'formField()?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField()?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField()?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField()?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField()?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField()?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField()?.disabled() ? \"\" : null',\n },\n})\nexport class NgpLabel {\n /**\n * The id of the label. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-label'));\n /**\n * Access the form field that the label is associated with.\n */\n protected readonly formField = injectFormFieldState({ optional: true });\n /**\n * Derive the for attribute value if the label is an HTML label element.\n */\n protected readonly htmlFor = computed(() => this.formField()?.formControl());\n /**\n * Access the element that the label is associated with.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n /**\n * Determine if the label is an HTML label element.\n */\n protected readonly isLabel = this.elementRef.nativeElement instanceof HTMLLabelElement;\n\n constructor() {\n effect(onCleanup => {\n this.formField()?.addLabel(this.id());\n onCleanup(() => this.formField()?.removeLabel(this.id()));\n });\n }\n\n @HostListener('click', ['$event'])\n protected onClick(event: MouseEvent): void {\n // by default a label will perform a click on the associated form control, however\n // this only works if the associated form control is an input element which may not always\n // be the case, so we prevent the default behavior and handle the click event ourselves.\n // This was inspired by the HeadlessUI approach:\n // https://github.com/tailwindlabs/headlessui/blob/main/packages/%40headlessui-react/src/components/label/label.tsx#L58\n if (this.isLabel) {\n event.preventDefault();\n }\n\n // to find the associated form control we can lookup via the known id\n const targetId = this.htmlFor();\n\n if (!targetId) {\n return;\n }\n\n const target = document.getElementById(targetId);\n\n if (!target) {\n return;\n }\n\n // if the target is disabled then do nothing\n const disabled = target.getAttribute('disabled');\n const ariaDisabled = target.getAttribute('aria-disabled');\n\n if (disabled === '' || disabled === 'true' || ariaDisabled === 'true') {\n return;\n }\n\n // radio buttons, checkboxes and switches should all be clicked immediately as they require state changes\n if (\n (target instanceof HTMLInputElement &&\n (target.type === 'radio' || target.type === 'checkbox')) ||\n target.role === 'radio' ||\n target.role === 'checkbox' ||\n target.role === 'switch'\n ) {\n target.click();\n }\n\n // Move focus to the element, this allows you to start using keyboard shortcuts since the\n // bound element is now focused.\n target.focus({ preventScroll: true });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAQA;;AAEG;AACI,MAAM,sBAAsB,GAAG,gBAAgB,CAAe,WAAW,CAAC;AAEjF;;AAEG;MACU,qBAAqB,GAAG,mBAAmB,CAAC,sBAAsB;AAE/E;;AAEG;MACU,oBAAoB,GAAG,mBAAmB,CAAC,sBAAsB;AAE9E;;AAEG;AACI,MAAM,cAAc,GAAG,WAAW,CAAC,sBAAsB,CAAC;;ACtBjE;;AAEG;MAeU,cAAc,CAAA;AAUzB,IAAA,WAAA,GAAA;AATA;;AAEG;QACM,IAAE,CAAA,EAAA,GAAG,KAAK,CAAS,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AACxD;;AAEG;QACgB,IAAS,CAAA,SAAA,GAAG,oBAAoB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAGrE,MAAM,CAAC,SAAS,IAAG;YACjB,IAAI,CAAC,SAAS,EAAE,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;AAC3C,YAAA,SAAS,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;AACjE,SAAC,CAAC;;8GAdO,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAd,cAAc,EAAA,YAAA,EAAA,I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,mBAAmB,EAAE,kCAAkC;AACvD,wBAAA,qBAAqB,EAAE,oCAAoC;AAC3D,wBAAA,sBAAsB,EAAE,qCAAqC;AAC7D,wBAAA,mBAAmB,EAAE,kCAAkC;AACvD,wBAAA,qBAAqB,EAAE,oCAAoC;AAC3D,wBAAA,sBAAsB,EAAE,qCAAqC;AAC9D,qBAAA;AACF,iBAAA;wDA+BW,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;;;AC3DnC;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-form-field.mjs","sources":["../../../../packages/ng-primitives/form-field/src/form-field/form-field-state.ts","../../../../packages/ng-primitives/form-field/src/description/description.ts","../../../../packages/ng-primitives/form-field/src/error/error.ts","../../../../packages/ng-primitives/form-field/src/form-control/form-control-state.ts","../../../../packages/ng-primitives/form-field/src/form-control/form-control.ts","../../../../packages/ng-primitives/form-field/src/form-field/form-field.ts","../../../../packages/ng-primitives/form-field/src/label/label.ts","../../../../packages/ng-primitives/form-field/src/ng-primitives-form-field.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFormField } from './form-field';\n\n/**\n * The state token for the FormField primitive.\n */\nexport const NgpFormFieldStateToken = createStateToken<NgpFormField>('FormField');\n\n/**\n * Provides the FormField state.\n */\nexport const provideFormFieldState = createStateProvider(NgpFormFieldStateToken);\n\n/**\n * Injects the FormField state.\n */\nexport const injectFormFieldState = createStateInjector(NgpFormFieldStateToken);\n\n/**\n * The FormField state registration function.\n */\nexport const formFieldState = createState(NgpFormFieldStateToken);\n","import { Directive, effect, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\n\n/**\n * The `NgpDescription` directive is used to mark a description element within a form field. There may be multiple descriptions associated with a form control.\n */\n@Directive({\n selector: '[ngpDescription]',\n exportAs: 'ngpDescription',\n host: {\n '[attr.id]': 'id()',\n '[attr.data-invalid]': 'formField()?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField()?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField()?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField()?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField()?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField()?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField()?.disabled() ? \"\" : null',\n },\n})\nexport class NgpDescription {\n /**\n * The id of the description. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-description'));\n /**\n * Access the form field that the description is associated with.\n */\n protected readonly formField = injectFormFieldState({ optional: true });\n\n constructor() {\n effect(onCleanup => {\n this.formField()?.addDescription(this.id());\n onCleanup(() => this.formField()?.removeDescription(this.id()));\n });\n }\n}\n","import { Directive, OnChanges, OnDestroy, SimpleChanges, computed, input } from '@angular/core';\nimport { onBooleanChange, uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\n\n/**\n * The `NgpError` directive is used to mark an error message element within a form field. There may be multiple error messages associated with a form control.\n */\n@Directive({\n selector: '[ngpError]',\n exportAs: 'ngpError',\n host: {\n '[attr.id]': 'id()',\n '[attr.data-invalid]': 'formField()?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField()?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField()?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField()?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField()?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField()?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField()?.disabled() ? \"\" : null',\n '[attr.data-validator]': 'state()',\n },\n})\nexport class NgpError implements OnChanges, OnDestroy {\n /**\n * Access the form field that the description is associated with.\n */\n protected readonly formField = injectFormFieldState({ optional: true });\n\n /**\n * The id of the error message. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-error'));\n\n /**\n * The validator associated with the error message.\n */\n readonly validator = input<string | null>(null, {\n alias: 'ngpErrorValidator',\n });\n\n /**\n * Determine if there is an error message.\n */\n protected readonly hasError = computed(() => {\n const errors = this.formField()?.errors() ?? [];\n const validator = this.validator();\n\n return validator ? errors?.includes(validator) : errors?.length > 0;\n });\n\n /**\n * Determine whether the validator associated with this error is failing.\n */\n protected readonly state = computed(() => (this.hasError() ? 'fail' : 'pass'));\n\n constructor() {\n // add or remove the error message when the error state changes\n onBooleanChange(\n this.hasError,\n () => this.formField()?.addDescription(this.id()),\n () => this.formField()?.removeDescription(this.id()),\n );\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if ('id' in changes) {\n this.formField()?.removeDescription(changes['id'].previousValue);\n }\n }\n\n ngOnDestroy(): void {\n this.formField()?.removeDescription(this.id());\n }\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFormControl } from './form-control';\n\n/**\n * The state token for the FormControl primitive.\n */\nexport const NgpFormControlStateToken = createStateToken<NgpFormControl>('FormControl');\n\n/**\n * Provides the FormControl state.\n */\nexport const provideFormControlState = createStateProvider(NgpFormControlStateToken);\n\n/**\n * Injects the FormControl state.\n */\nexport const injectFormControlState = createStateInjector(NgpFormControlStateToken);\n\n/**\n * The FormControl state registration function.\n */\nexport const formControlState = createState(NgpFormControlStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n afterRenderEffect,\n booleanAttribute,\n computed,\n Directive,\n input,\n signal,\n Signal,\n} from '@angular/core';\nimport { explicitEffect, injectElementRef } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\nimport { formControlState, provideFormControlState } from './form-control-state';\n\n/**\n * Typically this primitive would be not be used directly, but instead a more specific form control primitive would be used (e.g. `ngpInput`). All of our form control primitives use `ngpFormControl` internally so they will have the same accessibility features as described below.\n *\n * The `NgpFormControl` directive is used to mark a form control element within a form field. This element will have an `aria-labelledby` attribute set to the ID of the label element within the form field and an `aria-describedby` attribute set to the ID of the description elements within the form field.\n */\n@Directive({\n selector: '[ngpFormControl]',\n exportAs: 'ngpFormControl',\n providers: [provideFormControlState()],\n})\nexport class NgpFormControl {\n /**\n * The id of the form control. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-form-control'));\n\n /**\n * Whether the form control is disabled by a parent.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpFormControlDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The state of the form control.\n */\n private readonly state = formControlState<NgpFormControl>(this);\n\n constructor() {\n // Sync the form control state with the control state.\n setupFormControl({ id: this.state.id, disabled: this.state.disabled });\n }\n}\n\ninterface FormControlState {\n id?: Signal<string>;\n disabled?: Signal<boolean>;\n}\n\nexport function setupFormControl({\n id = signal(uniqueId('ngp-form-control')),\n disabled = signal(false),\n}: FormControlState) {\n const element = injectElementRef().nativeElement;\n // Access the form field that the form control is associated with.\n const formField = injectFormFieldState({ optional: true });\n // Determine the aria-labelledby attribute value.\n const ariaLabelledBy = computed(() => formField()?.labels().join(' '));\n // Determine the aria-describedby attribute value.\n const ariaDescribedBy = computed(() => formField()?.descriptions().join(' '));\n\n explicitEffect([id], ([id], onCleanup) => {\n formField()?.setFormControl(id);\n onCleanup(() => formField()?.removeFormControl());\n });\n\n afterRenderEffect({\n write: () => {\n setAttribute(element, 'id', id());\n setAttribute(element, 'aria-labelledby', ariaLabelledBy());\n setAttribute(element, 'aria-describedby', ariaDescribedBy());\n\n setStateAttribute(element, formField()?.invalid(), 'data-invalid');\n setStateAttribute(element, formField()?.valid(), 'data-valid');\n setStateAttribute(element, formField()?.touched(), 'data-touched');\n setStateAttribute(element, formField()?.pristine(), 'data-pristine');\n setStateAttribute(element, formField()?.dirty(), 'data-dirty');\n setStateAttribute(element, formField()?.pending(), 'data-pending');\n setStateAttribute(element, disabled() || formField()?.disabled(), 'data-disabled');\n },\n });\n}\n\n/**\n * Sets the attribute on the element. If the value is not empty, the attribute is set to the value.\n * If the value is empty, the attribute is removed.\n * @param element The element to set the attribute on.\n * @param attribute The attribute to set on the element.\n * @param value The value to set on the attribute.\n */\nfunction setAttribute(element: HTMLElement, attribute: string, value: string) {\n if (value && value.length > 0) {\n element.setAttribute(attribute, value);\n } else {\n element.removeAttribute(attribute);\n }\n}\n\n/**\n * Sets the attribute on the element based on the state. If the state is true, the attribute\n * is set to an empty string. If the state is false, the attribute is removed.\n * @param element The element to set the attribute on.\n * @param state The state to set the attribute based on.\n * @param attribute The attribute to set on the element.\n */\nfunction setStateAttribute(element: HTMLElement, state: boolean | null, attribute: string) {\n if (state) {\n element.setAttribute(attribute, '');\n } else {\n element.removeAttribute(attribute);\n }\n}\n","import { Directive, OnDestroy, contentChild, signal } from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { onChange } from 'ng-primitives/utils';\nimport { Subscription } from 'rxjs';\nimport { formFieldState, provideFormFieldState } from './form-field-state';\n\n/**\n * The `NgpFormField` directive is a container for form field elements. Any labels, form controls, or descriptions should be placed within this directive.\n */\n@Directive({\n selector: '[ngpFormField]',\n exportAs: 'ngpFormField',\n providers: [provideFormFieldState()],\n host: {\n '[attr.data-invalid]': 'invalid() ? \"\" : null',\n '[attr.data-valid]': 'valid() ? \"\" : null',\n '[attr.data-touched]': 'touched() ? \"\" : null',\n '[attr.data-pristine]': 'pristine() ? \"\" : null',\n '[attr.data-dirty]': 'dirty() ? \"\" : null',\n '[attr.data-pending]': 'pending() ? \"\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n },\n})\nexport class NgpFormField implements OnDestroy {\n /**\n * Store the form label.\n * @internal\n */\n readonly labels = signal<string[]>([]);\n\n /**\n * Store the form descriptions.\n * @internal\n */\n readonly descriptions = signal<string[]>([]);\n\n /**\n * Store the id of the associated form control.\n * @internal\n */\n readonly formControl = signal<string | null>(null);\n\n /**\n * Find any NgControl within the form field.\n * @internal\n */\n private readonly ngControl = contentChild(NgControl);\n\n /**\n * Store the validation error messages.\n * @internal\n */\n readonly errors = signal<string[]>([]);\n\n /**\n * Whether the control is pristine.\n * @internal\n */\n readonly pristine = signal<boolean | null>(null);\n\n /**\n * Whether the control is touched.\n * @internal\n */\n readonly touched = signal<boolean | null>(null);\n\n /**\n * Whether the control is dirty.\n * @internal\n */\n readonly dirty = signal<boolean | null>(null);\n\n /**\n * Whether the control is valid.\n */\n readonly valid = signal<boolean | null>(null);\n\n /**\n * Whether the control is invalid.\n * @internal\n */\n readonly invalid = signal<boolean | null>(null);\n\n /**\n * Whether the control is pending.\n * @internal\n */\n readonly pending = signal<boolean | null>(null);\n\n /**\n * Whether the control is disabled.\n * @internal\n */\n readonly disabled = signal<boolean | null>(null);\n\n /**\n * Store the current status subscription.\n */\n private subscription?: Subscription;\n\n /**\n * The form field state.\n */\n protected readonly state = formFieldState<NgpFormField>(this);\n\n constructor() {\n // any time the ngControl changes, setup the subscriptions.\n onChange(this.ngControl, this.setupSubscriptions.bind(this));\n }\n\n ngOnDestroy(): void {\n this.subscription?.unsubscribe();\n }\n\n /**\n * Setup a listener for the form control status.\n * @param control\n */\n private setupSubscriptions(control: NgControl | null | undefined): void {\n // Unsubscribe from the previous subscriptions.\n this.subscription?.unsubscribe();\n\n // set the initial values\n this.updateStatus();\n\n // Listen for changes to the form control.\n this.subscription = control?.valueChanges?.subscribe(this.updateStatus.bind(this));\n }\n\n private updateStatus(): void {\n const control = this.ngControl();\n\n if (!control) {\n return;\n }\n\n this.pristine.set(control.pristine);\n this.touched.set(control.touched);\n this.dirty.set(control.dirty);\n this.valid.set(control.valid);\n this.invalid.set(control.invalid);\n this.pending.set(control.pending);\n this.disabled.set(control.disabled);\n this.errors.set(control?.errors ? Object.keys(control.errors) : []);\n }\n\n /**\n * Register the id of the associated form control.\n * @param id\n * @internal\n */\n setFormControl(id: string): void {\n this.formControl.set(id);\n }\n\n /**\n * Register a label with the form field.\n * @param label\n * @internal\n */\n addLabel(label: string): void {\n this.labels.update(labels => [...labels, label]);\n }\n\n /**\n * Register a description with the form field.\n * @param description\n * @internal\n */\n addDescription(description: string): void {\n this.descriptions.update(descriptions => [...descriptions, description]);\n }\n\n /**\n * Remove the associated form control.\n * @internal\n */\n removeFormControl(): void {\n this.formControl.set(null);\n }\n\n /**\n * Remove a label from the form field.\n * @param label\n * @internal\n */\n removeLabel(label: string): void {\n this.labels.update(labels => labels.filter(l => l !== label));\n }\n\n /**\n * Remove a description from the form field.\n * @param description\n * @internal\n */\n removeDescription(description: string): void {\n this.descriptions.update(descriptions => descriptions.filter(d => d !== description));\n }\n}\n","import {\n computed,\n Directive,\n effect,\n ElementRef,\n HostListener,\n inject,\n input,\n} from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\n\n/**\n * The `NgpLabel` directive is used to mark a label element within a form field. Preferably, there should use an HTML `<label>` element.\n */\n@Directive({\n selector: '[ngpLabel]',\n exportAs: 'ngpLabel',\n host: {\n '[attr.id]': 'id()',\n '[attr.for]': 'htmlFor()',\n '[attr.data-invalid]': 'formField()?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField()?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField()?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField()?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField()?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField()?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField()?.disabled() ? \"\" : null',\n },\n})\nexport class NgpLabel {\n /**\n * The id of the label. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-label'));\n /**\n * Access the form field that the label is associated with.\n */\n protected readonly formField = injectFormFieldState({ optional: true });\n /**\n * Derive the for attribute value if the label is an HTML label element.\n */\n protected readonly htmlFor = computed(() => this.formField()?.formControl());\n /**\n * Access the element that the label is associated with.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n /**\n * Determine if the label is an HTML label element.\n */\n protected readonly isLabel = this.elementRef.nativeElement instanceof HTMLLabelElement;\n\n constructor() {\n effect(onCleanup => {\n this.formField()?.addLabel(this.id());\n onCleanup(() => this.formField()?.removeLabel(this.id()));\n });\n }\n\n @HostListener('click', ['$event'])\n protected onClick(event: MouseEvent): void {\n // by default a label will perform a click on the associated form control, however\n // this only works if the associated form control is an input element which may not always\n // be the case, so we prevent the default behavior and handle the click event ourselves.\n // This was inspired by the HeadlessUI approach:\n // https://github.com/tailwindlabs/headlessui/blob/main/packages/%40headlessui-react/src/components/label/label.tsx#L58\n if (this.isLabel) {\n event.preventDefault();\n }\n\n // to find the associated form control we can lookup via the known id\n const targetId = this.htmlFor();\n\n if (!targetId) {\n return;\n }\n\n const target = document.getElementById(targetId);\n\n if (!target) {\n return;\n }\n\n // if the target is disabled then do nothing\n const disabled = target.getAttribute('disabled');\n const ariaDisabled = target.getAttribute('aria-disabled');\n\n if (disabled === '' || disabled === 'true' || ariaDisabled === 'true') {\n return;\n }\n\n // radio buttons, checkboxes and switches should all be clicked immediately as they require state changes\n if (\n (target instanceof HTMLInputElement &&\n (target.type === 'radio' || target.type === 'checkbox')) ||\n target.role === 'radio' ||\n target.role === 'checkbox' ||\n target.role === 'switch'\n ) {\n target.click();\n }\n\n // Move focus to the element, this allows you to start using keyboard shortcuts since the\n // bound element is now focused.\n target.focus({ preventScroll: true });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAQA;;AAEG;AACI,MAAM,sBAAsB,GAAG,gBAAgB,CAAe,WAAW,CAAC;AAEjF;;AAEG;MACU,qBAAqB,GAAG,mBAAmB,CAAC,sBAAsB;AAE/E;;AAEG;MACU,oBAAoB,GAAG,mBAAmB,CAAC,sBAAsB;AAE9E;;AAEG;AACI,MAAM,cAAc,GAAG,WAAW,CAAC,sBAAsB,CAAC;;ACtBjE;;AAEG;MAeU,c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EAAE,MAAM;AACnB,wBAAA,YAAY,EAAE,WAAW;AACzB,wBAAA,qBAAqB,EAAE,oCAAoC;AAC3D,wBAAA,mBAAmB,EAAE,kCAAkC;AACvD,wBAAA,qBAAqB,EAAE,oCAAoC;AAC3D,wBAAA,sBAAsB,EAAE,qCAAqC;AAC7D,wBAAA,mBAAmB,EAAE,kCAAkC;AACvD,wBAAA,qBAAqB,EAAE,oCAAoC;AAC3D,wBAAA,sBAAsB,EAAE,qCAAqC;AAC9D,qBAAA;AACF,iBAAA;wDA+BW,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;;;AC3DnC;;AAEG;;;;"}
@@ -1,9 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { input, booleanAttribute, Directive } from '@angular/core';
3
- import * as i2 from 'ng-primitives/autofill';
3
+ import * as i1 from 'ng-primitives/autofill';
4
4
  import { NgpAutofill } from 'ng-primitives/autofill';
5
- import * as i1 from 'ng-primitives/form-field';
6
- import { syncFormControl, NgpFormControl } from 'ng-primitives/form-field';
5
+ import { setupFormControl } from 'ng-primitives/form-field';
7
6
  import { injectElementRef, setupInteractions } from 'ng-primitives/internal';
8
7
  import { injectSearchState } from 'ng-primitives/search';
9
8
  import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
@@ -51,11 +50,11 @@ class NgpInput {
51
50
  focus: true,
52
51
  disabled: this.state.disabled,
53
52
  });
54
- syncFormControl({ disabled: this.state.disabled });
53
+ setupFormControl({ disabled: this.state.disabled });
55
54
  this.searchState()?.registerInput(this.elementRef.nativeElement);
56
55
  }
57
56
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpInput, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
58
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpInput, isStandalone: true, selector: "input[ngpInput]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideInputState()], exportAs: ["ngpInput"], hostDirectives: [{ directive: i1.NgpFormControl }, { directive: i2.NgpAutofill }], ngImport: i0 }); }
57
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpInput, isStandalone: true, selector: "input[ngpInput]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideInputState()], exportAs: ["ngpInput"], hostDirectives: [{ directive: i1.NgpAutofill }], ngImport: i0 }); }
59
58
  }
60
59
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpInput, decorators: [{
61
60
  type: Directive,
@@ -63,7 +62,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
63
62
  selector: 'input[ngpInput]',
64
63
  exportAs: 'ngpInput',
65
64
  providers: [provideInputState()],
66
- hostDirectives: [NgpFormControl, NgpAutofill],
65
+ hostDirectives: [NgpAutofill],
67
66
  }]
68
67
  }], ctorParameters: () => [] });
69
68
 
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-input.mjs","sources":["../../../../packages/ng-primitives/input/src/input/input-state.ts","../../../../packages/ng-primitives/input/src/input/input.ts","../../../../packages/ng-primitives/input/src/ng-primitives-input.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpInput } from './input';\n\n/**\n * The state token for the Input primitive.\n */\nexport const NgpInputStateToken = createStateToken<NgpInput>('Input');\n\n/**\n * Provides the Input state.\n */\nexport const provideInputState = createStateProvider(NgpInputStateToken);\n\n/**\n * Injects the Input state.\n */\nexport const injectInputState = createStateInjector(NgpInputStateToken);\n\n/**\n * The Input state registration function.\n */\nexport const inputState = createState(NgpInputStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input } from '@angular/core';\nimport { NgpAutofill } from 'ng-primitives/autofill';\nimport { NgpFormControl, syncFormControl } from 'ng-primitives/form-field';\nimport { injectElementRef, setupInteractions } from 'ng-primitives/internal';\nimport { injectSearchState } from 'ng-primitives/search';\nimport { inputState, provideInputState } from './input-state';\n\n@Directive({\n selector: 'input[ngpInput]',\n exportAs: 'ngpInput',\n providers: [provideInputState()],\n hostDirectives: [NgpFormControl, NgpAutofill],\n})\nexport class NgpInput {\n /**\n * The input may be used within a search field, if so we need to register it.\n */\n private readonly searchState = injectSearchState({ optional: true });\n\n /**\n * Access the element reference.\n */\n private readonly elementRef = injectElementRef<HTMLInputElement>();\n\n /**\n * Whether the element is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n transform: booleanAttribute,\n });\n\n /**\n * The input state.\n */\n protected readonly state = inputState<NgpInput>(this);\n\n constructor() {\n setupInteractions({\n hover: true,\n press: true,\n focus: true,\n disabled: this.state.disabled,\n });\n syncFormControl({ disabled: this.state.disabled });\n\n this.searchState()?.registerInput(this.elementRef.nativeElement);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAQA;;AAEG;AACI,MAAM,kBAAkB,GAAG,gBAAgB,CAAW,OAAO,CAAC;AAErE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,CAAC,kBAAkB;AAEvE;;AAEG;MACU,gBAAgB,GAAG,mBAAmB,CAAC,kBAAkB;AAEtE;;AAEG;AACI,MAAM,UAAU,GAAG,WAAW,CAAC,kBAAkB,CAAC;;MCZ5C,QAAQ,CAAA;AAuBnB,IAAA,WAAA,GAAA;AAtBA;;AAEG;QACc,IAAW,CAAA,WAAA,GAAG,iBAAiB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAEpE;;AAEG;QACc,IAAU,CAAA,UAAA,GAAG,gBAAgB,EAAoB;AAElE;;AA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EAAA,EAAA,EAAA,CAAA,CAAA;;2FAGrB,QAAQ,EAAA,UAAA,EAAA,CAAA;kBANpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,QAAQ,EAAE,UAAU;AACpB,oBAAA,SAAS,EAAE,CAAC,iBAAiB,EAAE,CAAC;AAChC,oBAAA,cAAc,EAAE,CAAC,cAAc,EAAE,WAAW,CAAC;AAC9C,iBAAA;;;ACbD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-input.mjs","sources":["../../../../packages/ng-primitives/input/src/input/input-state.ts","../../../../packages/ng-primitives/input/src/input/input.ts","../../../../packages/ng-primitives/input/src/ng-primitives-input.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpInput } from './input';\n\n/**\n * The state token for the Input primitive.\n */\nexport const NgpInputStateToken = createStateToken<NgpInput>('Input');\n\n/**\n * Provides the Input state.\n */\nexport const provideInputState = createStateProvider(NgpInputStateToken);\n\n/**\n * Injects the Input state.\n */\nexport const injectInputState = createStateInjector(NgpInputStateToken);\n\n/**\n * The Input state registration function.\n */\nexport const inputState = createState(NgpInputStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input } from '@angular/core';\nimport { NgpAutofill } from 'ng-primitives/autofill';\nimport { setupFormControl } from 'ng-primitives/form-field';\nimport { injectElementRef, setupInteractions } from 'ng-primitives/internal';\nimport { injectSearchState } from 'ng-primitives/search';\nimport { inputState, provideInputState } from './input-state';\n\n@Directive({\n selector: 'input[ngpInput]',\n exportAs: 'ngpInput',\n providers: [provideInputState()],\n hostDirectives: [NgpAutofill],\n})\nexport class NgpInput {\n /**\n * The input may be used within a search field, if so we need to register it.\n */\n private readonly searchState = injectSearchState({ optional: true });\n\n /**\n * Access the element reference.\n */\n private readonly elementRef = injectElementRef<HTMLInputElement>();\n\n /**\n * Whether the element is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n transform: booleanAttribute,\n });\n\n /**\n * The input state.\n */\n protected readonly state = inputState<NgpInput>(this);\n\n constructor() {\n setupInteractions({\n hover: true,\n press: true,\n focus: true,\n disabled: this.state.disabled,\n });\n setupFormControl({ disabled: this.state.disabled });\n\n this.searchState()?.registerInput(this.elementRef.nativeElement);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAQA;;AAEG;AACI,MAAM,kBAAkB,GAAG,gBAAgB,CAAW,OAAO,CAAC;AAErE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,CAAC,kBAAkB;AAEvE;;AAEG;MACU,gBAAgB,GAAG,mBAAmB,CAAC,kBAAkB;AAEtE;;AAEG;AACI,MAAM,UAAU,GAAG,WAAW,CAAC,kBAAkB,CAAC;;MCZ5C,QAAQ,CAAA;AAuBnB,IAAA,WAAA,GAAA;AAtBA;;AAEG;QACc,IAAW,CAAA,WAAA,GAAG,iBAAiB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAEpE;;AAEG;QACc,IAAU,CAAA,UAAA,GAAG,gBAAgB,EAAoB;AAElE;;AAEG;AACM,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAwB,KAAK,EAAE;AACtD,YAAA,SAAS,EAAE,gBAAgB;AAC5B,SAAA,CAAC;AAEF;;AAEG;AACgB,QAAA,IAAA,CAAA,KAAK,GAAG,UAAU,CAAW,IAAI,CAAC;AAGnD,QAAA,iBAAiB,CAAC;AAChB,YAAA,KAAK,EAAE,IAAI;AACX,YAAA,KAAK,EAAE,IAAI;AACX,YAAA,KAAK,EAAE,IAAI;AACX,YAAA,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ;AAC9B,SAAA,CAAC;QACF,gBAAgB,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;AAEnD,QAAA,IAAI,CAAC,WAAW,EAAE,EAAE,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;;8GAhCvD,QAAQ,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAR,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,QAAQ,EAHR,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,SAAA,EAAA,CAAC,iBAAiB,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,UAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,WAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAGrB,QAAQ,EAAA,UAAA,EAAA,CAAA;kBANpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,QAAQ,EAAE,UAAU;AACpB,oBAAA,SAAS,EAAE,CAAC,iBAAiB,EAAE,CAAC;oBAChC,cAAc,EAAE,CAAC,WAAW,CAAC;AAC9B,iBAAA;;;ACbD;;AAEG;;;;"}
@@ -1,11 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { input, output, booleanAttribute, Directive, computed, HostListener } from '@angular/core';
3
- import * as i2 from 'ng-primitives/form-field';
4
- import { syncFormControl, NgpFormControl } from 'ng-primitives/form-field';
3
+ import { setupFormControl } from 'ng-primitives/form-field';
5
4
  import * as i1 from 'ng-primitives/roving-focus';
6
5
  import { injectRovingFocusGroupState, NgpRovingFocusGroup, NgpRovingFocusItem } from 'ng-primitives/roving-focus';
7
6
  import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
8
- import * as i2$1 from 'ng-primitives/interactions';
7
+ import * as i2 from 'ng-primitives/interactions';
9
8
  import { NgpHover, NgpPress, NgpFocusVisible } from 'ng-primitives/interactions';
10
9
 
11
10
  /**
@@ -70,7 +69,7 @@ class NgpRadioGroup {
70
69
  * @internal
71
70
  */
72
71
  this.state = radioGroupState(this);
73
- syncFormControl({ disabled: this.state.disabled });
72
+ setupFormControl({ disabled: this.state.disabled });
74
73
  }
75
74
  ngOnInit() {
76
75
  // the roving focus group defaults to vertical orientation whereas we want to default to vertical
@@ -89,7 +88,7 @@ class NgpRadioGroup {
89
88
  this.valueChange.emit(value);
90
89
  }
91
90
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpRadioGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
92
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpRadioGroup, isStandalone: true, selector: "[ngpRadioGroup]", inputs: { value: { classPropertyName: "value", publicName: "ngpRadioGroupValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpRadioGroupDisabled", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "ngpRadioGroupOrientation", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "ngpRadioGroupCompareWith", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "ngpRadioGroupValueChange" }, host: { attributes: { "role": "radiogroup" }, properties: { "attr.aria-orientation": "state.orientation()", "attr.data-orientation": "state.orientation()", "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideRadioGroupState()], hostDirectives: [{ directive: i1.NgpRovingFocusGroup, inputs: ["ngpRovingFocusGroupOrientation", "ngpRadioGroupOrientation", "ngpRovingFocusGroupDisabled", "ngpRadioGroupDisabled"] }, { directive: i2.NgpFormControl }], ngImport: i0 }); }
91
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpRadioGroup, isStandalone: true, selector: "[ngpRadioGroup]", inputs: { value: { classPropertyName: "value", publicName: "ngpRadioGroupValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpRadioGroupDisabled", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "ngpRadioGroupOrientation", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "ngpRadioGroupCompareWith", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "ngpRadioGroupValueChange" }, host: { attributes: { "role": "radiogroup" }, properties: { "attr.aria-orientation": "state.orientation()", "attr.data-orientation": "state.orientation()", "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideRadioGroupState()], hostDirectives: [{ directive: i1.NgpRovingFocusGroup, inputs: ["ngpRovingFocusGroupOrientation", "ngpRadioGroupOrientation", "ngpRovingFocusGroupDisabled", "ngpRadioGroupDisabled"] }], ngImport: i0 }); }
93
92
  }
94
93
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpRadioGroup, decorators: [{
95
94
  type: Directive,
@@ -104,7 +103,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
104
103
  'ngpRovingFocusGroupDisabled:ngpRadioGroupDisabled',
105
104
  ],
106
105
  },
107
- NgpFormControl,
108
106
  ],
109
107
  host: {
110
108
  role: 'radiogroup',
@@ -151,7 +149,7 @@ class NgpRadioIndicator {
151
149
  this.checked = computed(() => this.radioGroupState().value() === this.radioItemState().value());
152
150
  }
153
151
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpRadioIndicator, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
154
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: NgpRadioIndicator, isStandalone: true, selector: "[ngpRadioIndicator]", host: { properties: { "attr.data-checked": "checked() ? \"\" : null", "attr.data-disabled": "radioItemState().disabled() ? \"\" : null" } }, hostDirectives: [{ directive: i2$1.NgpHover }, { directive: i2$1.NgpPress }], ngImport: i0 }); }
152
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: NgpRadioIndicator, isStandalone: true, selector: "[ngpRadioIndicator]", host: { properties: { "attr.data-checked": "checked() ? \"\" : null", "attr.data-disabled": "radioItemState().disabled() ? \"\" : null" } }, hostDirectives: [{ directive: i2.NgpHover }, { directive: i2.NgpPress }], ngImport: i0 }); }
155
153
  }
156
154
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpRadioIndicator, decorators: [{
157
155
  type: Directive,
@@ -210,7 +208,7 @@ class NgpRadioItem {
210
208
  this.radioGroupState().select(this.value());
211
209
  }
212
210
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpRadioItem, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
213
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpRadioItem, isStandalone: true, selector: "[ngpRadioItem]", inputs: { value: { classPropertyName: "value", publicName: "ngpRadioItemValue", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpRadioItemDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "radio" }, listeners: { "focus": "onFocus()", "click": "onClick()" }, properties: { "attr.aria-checked": "checked() ? \"true\" : \"false\"", "attr.data-disabled": "state.disabled() ? \"\" : null", "attr.data-checked": "checked() ? \"\" : null" } }, providers: [provideRadioItemState()], hostDirectives: [{ directive: i1.NgpRovingFocusItem }, { directive: i2$1.NgpHover }, { directive: i2$1.NgpFocusVisible }, { directive: i2$1.NgpPress }], ngImport: i0 }); }
211
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpRadioItem, isStandalone: true, selector: "[ngpRadioItem]", inputs: { value: { classPropertyName: "value", publicName: "ngpRadioItemValue", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpRadioItemDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "radio" }, listeners: { "focus": "onFocus()", "click": "onClick()" }, properties: { "attr.aria-checked": "checked() ? \"true\" : \"false\"", "attr.data-disabled": "state.disabled() ? \"\" : null", "attr.data-checked": "checked() ? \"\" : null" } }, providers: [provideRadioItemState()], hostDirectives: [{ directive: i1.NgpRovingFocusItem }, { directive: i2.NgpHover }, { directive: i2.NgpFocusVisible }, { directive: i2.NgpPress }], ngImport: i0 }); }
214
212
  }
215
213
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpRadioItem, decorators: [{
216
214
  type: Directive,
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-radio.mjs","sources":["../../../../packages/ng-primitives/radio/src/radio-group/radio-group-state.ts","../../../../packages/ng-primitives/radio/src/radio-group/radio-group.ts","../../../../packages/ng-primitives/radio/src/radio-item/radio-item-state.ts","../../../../packages/ng-primitives/radio/src/radio-indicator/radio-indicator.ts","../../../../packages/ng-primitives/radio/src/radio-item/radio-item.ts","../../../../packages/ng-primitives/radio/src/ng-primitives-radio.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n InjectedState,\n} from 'ng-primitives/state';\nimport type { NgpRadioGroup } from './radio-group';\n\n/**\n * The state token for the RadioGroup primitive.\n */\nexport const NgpRadioGroupStateToken = createStateToken<NgpRadioGroup<unknown>>('RadioGroup');\n\n/**\n * Provides the RadioGroup state.\n */\nexport const provideRadioGroupState = createStateProvider(NgpRadioGroupStateToken);\n\n/**\n * Injects the RadioGroup state.\n */\nexport const injectRadioGroupState = createStateInjector(NgpRadioGroupStateToken) as <\n T,\n>() => InjectedState<NgpRadioGroup<T>>;\n\n/**\n * The RadioGroup state registration function.\n */\nexport const radioGroupState = createState(NgpRadioGroupStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, OnInit, output } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { NgpFormControl, syncFormControl } from 'ng-primitives/form-field';\nimport { injectRovingFocusGroupState, NgpRovingFocusGroup } from 'ng-primitives/roving-focus';\nimport { provideRadioGroupState, radioGroupState } from './radio-group-state';\n\n/**\n * Apply the `ngpRadioGroup` directive to an element that represents the group of radio items.\n */\n@Directive({\n selector: '[ngpRadioGroup]',\n providers: [provideRadioGroupState()],\n hostDirectives: [\n {\n directive: NgpRovingFocusGroup,\n inputs: [\n 'ngpRovingFocusGroupOrientation:ngpRadioGroupOrientation',\n 'ngpRovingFocusGroupDisabled:ngpRadioGroupDisabled',\n ],\n },\n NgpFormControl,\n ],\n host: {\n role: 'radiogroup',\n '[attr.aria-orientation]': 'state.orientation()',\n '[attr.data-orientation]': 'state.orientation()',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n },\n})\nexport class NgpRadioGroup<T> implements OnInit {\n /**\n * Access the roving focus group state.\n */\n private readonly rovingFocusGroupState = injectRovingFocusGroupState();\n\n /**\n * The value of the radio group.\n */\n readonly value = input<T | null>(null, { alias: 'ngpRadioGroupValue' });\n\n /**\n * Event emitted when the radio group value changes.\n */\n readonly valueChange = output<T | null>({\n alias: 'ngpRadioGroupValueChange',\n });\n\n /**\n * Whether the radio group is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRadioGroupDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The orientation of the radio group.\n * @default 'horizontal'\n */\n readonly orientation = input<NgpOrientation>('horizontal', {\n alias: 'ngpRadioGroupOrientation',\n });\n\n /**\n * The comparator function for the radio group. This is useful if values are objects and you want to compare them by value, not by reference.\n * @default (a, b) => a === b\n */\n readonly compareWith = input<(a: T | null, b: T | null) => boolean>((a, b) => a === b, {\n alias: 'ngpRadioGroupCompareWith',\n });\n\n /**\n * The state of the radio group.\n * @internal\n */\n protected readonly state = radioGroupState<NgpRadioGroup<T>>(this);\n\n constructor() {\n syncFormControl({ disabled: this.state.disabled });\n }\n\n ngOnInit(): void {\n // the roving focus group defaults to vertical orientation whereas we want to default to vertical\n this.rovingFocusGroupState().orientation.set(this.state.orientation());\n }\n\n /**\n * Select a radio item.\n * @param value The value of the radio item to select.\n */\n select(value: T): void {\n // if the value is already selected, do nothing\n if (this.state.compareWith()(this.state.value(), value)) {\n return;\n }\n\n this.state.value.set(value);\n this.valueChange.emit(value);\n }\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n InjectedState,\n} from 'ng-primitives/state';\nimport type { NgpRadioItem } from './radio-item';\n\n/**\n * The state token for the RadioItem primitive.\n */\nexport const NgpRadioItemStateToken = createStateToken<NgpRadioItem<unknown>>('RadioItem');\n\n/**\n * Provides the RadioItem state.\n */\nexport const provideRadioItemState = createStateProvider(NgpRadioItemStateToken);\n\n/**\n * Injects the RadioItem state.\n */\nexport const injectRadioItemState = createStateInjector(NgpRadioItemStateToken) as <\n T,\n>() => InjectedState<NgpRadioItem<T>>;\n\n/**\n * The RadioItem state registration function.\n */\nexport const radioItemState = createState(NgpRadioItemStateToken);\n","import { Directive, computed } from '@angular/core';\nimport { NgpHover, NgpPress } from 'ng-primitives/interactions';\nimport { injectRadioGroupState } from '../radio-group/radio-group-state';\nimport { injectRadioItemState } from '../radio-item/radio-item-state';\n\n/**\n * Apply the `ngpRadioIndicator` directive to an element that represents the radio indicator (i.e. the dot).\n */\n@Directive({\n selector: '[ngpRadioIndicator]',\n host: {\n '[attr.data-checked]': 'checked() ? \"\" : null',\n '[attr.data-disabled]': 'radioItemState().disabled() ? \"\" : null',\n },\n hostDirectives: [NgpHover, NgpPress],\n})\nexport class NgpRadioIndicator<T> {\n /**\n * Access the radio group state.\n */\n protected readonly radioGroupState = injectRadioGroupState<T>();\n\n /**\n * Access the radio group item state\n */\n protected readonly radioItemState = injectRadioItemState<T>();\n\n /**\n * Determine if the radio indicator is checked.\n */\n protected readonly checked = computed(\n () => this.radioGroupState().value() === this.radioItemState().value(),\n );\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, HostListener, booleanAttribute, computed, input } from '@angular/core';\nimport { NgpFocusVisible, NgpHover, NgpPress } from 'ng-primitives/interactions';\nimport { NgpRovingFocusItem } from 'ng-primitives/roving-focus';\nimport { injectRadioGroupState } from '../radio-group/radio-group-state';\nimport { provideRadioItemState, radioItemState } from './radio-item-state';\n\n/**\n * Apply the `ngpRadioItem` directive to an element that represents a radio item. This would typically be a `button` element.\n */\n@Directive({\n selector: '[ngpRadioItem]',\n hostDirectives: [NgpRovingFocusItem, NgpHover, NgpFocusVisible, NgpPress],\n providers: [provideRadioItemState()],\n host: {\n role: 'radio',\n '[attr.aria-checked]': 'checked() ? \"true\" : \"false\"',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '[attr.data-checked]': 'checked() ? \"\" : null',\n },\n})\nexport class NgpRadioItem<T> {\n /**\n * Access the radio group state.\n */\n private readonly radioGroupState = injectRadioGroupState<T>();\n\n /**\n * The value of the radio item.\n */\n readonly value = input.required<T>({ alias: 'ngpRadioItemValue' });\n\n /**\n * Whether the radio item is disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRadioItemDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Whether the radio item is checked.\n */\n readonly checked = computed(() =>\n this.radioGroupState().compareWith()(this.radioGroupState().value(), this.value()),\n );\n\n /**\n * The state of the radio item.\n */\n protected readonly state = radioItemState<NgpRadioItem<T>>(this);\n\n /**\n * When the item receives focus, select it.\n * @internal\n */\n @HostListener('focus')\n protected onFocus(): void {\n this.radioGroupState().select(this.value());\n }\n\n /**\n * When the item receives a click, select it.\n * @internal\n */\n @HostListener('click')\n protected onClick(): void {\n this.radioGroupState().select(this.value());\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1","i2"],"mappings":";;;;;;;;;;AASA;;AAEG;AACI,MAAM,uBAAuB,GAAG,gBAAgB,CAAyB,YAAY,CAAC;AAE7F;;AAEG;MACU,sBAAsB,GAAG,mBAAmB,CAAC,uBAAuB;AAEjF;;AAEG;MACU,qBAAqB,GAAG,mBAAmB,CAAC,uBAAuB;AAIhF;;AAEG;AACI,MAAM,eAAe,GAAG,WAAW,CAAC,uBAAuB,CAAC;;ACtBnE;;AAEG;MAqBU,aAAa,CAAA;AAgDxB,IAAA,WAAA,GAAA;AA/CA;;AAEG;QACc,IAAqB,CAAA,qBAAA,GAAG,2BAA2B,EAAE;AAEtE;;AAEG;QACM,IAAK,CAAA,KAAA,GAAG,KAAK,CAAW,IAAI,EAAE,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC;AAEvE;;AAEG;QACM,IAAW,CAAA,WAAA,GAAG,MAAM,CAAW;AACtC,YAAA,KAAK,EAAE,0BAA0B;AAClC,SAAA,CAAC;AAEF;;AAEG;AACM,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAwB,KAAK,EAAE;AACtD,YAAA,KAAK,EAAE,uBAAuB;AAC9B,YAAA,SAAS,EAAE,gBAAgB;AAC5B,SAAA,CAAC;AAEF;;;AAGG;AACM,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAiB,YAAY,EAAE;AACzD,YAAA,KAAK,EAAE,0BAA0B;AAClC,SAA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,CAAA;kBAXxB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,gBAAgB;oBAC1B,cAAc,EAAE,CAAC,kBAAkB,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,CAAC;AACzE,oBAAA,SAAS,EAAE,CAAC,qBAAqB,EAAE,CAAC;AACpC,oBAAA,IAAI,EAAE;AACJ,wBAAA,IAAI,EAAE,OAAO;AACb,wBAAA,qBAAqB,EAAE,8BAA8B;AACrD,wBAAA,sBAAsB,EAAE,8BAA8B;AACtD,wBAAA,qBAAqB,EAAE,uBAAuB;AAC/C,qBAAA;AACF,iBAAA;8BAsCW,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,OAAO;gBAUX,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,OAAO;;;AClEvB;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-radio.mjs","sources":["../../../../packages/ng-primitives/radio/src/radio-group/radio-group-state.ts","../../../../packages/ng-primitives/radio/src/radio-group/radio-group.ts","../../../../packages/ng-primitives/radio/src/radio-item/radio-item-state.ts","../../../../packages/ng-primitives/radio/src/radio-indicator/radio-indicator.ts","../../../../packages/ng-primitives/radio/src/radio-item/radio-item.ts","../../../../packages/ng-primitives/radio/src/ng-primitives-radio.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n InjectedState,\n} from 'ng-primitives/state';\nimport type { NgpRadioGroup } from './radio-group';\n\n/**\n * The state token for the RadioGroup primitive.\n */\nexport const NgpRadioGroupStateToken = createStateToken<NgpRadioGroup<unknown>>('RadioGroup');\n\n/**\n * Provides the RadioGroup state.\n */\nexport const provideRadioGroupState = createStateProvider(NgpRadioGroupStateToken);\n\n/**\n * Injects the RadioGroup state.\n */\nexport const injectRadioGroupState = createStateInjector(NgpRadioGroupStateToken) as <\n T,\n>() => InjectedState<NgpRadioGroup<T>>;\n\n/**\n * The RadioGroup state registration function.\n */\nexport const radioGroupState = createState(NgpRadioGroupStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, OnInit, output } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { setupFormControl } from 'ng-primitives/form-field';\nimport { injectRovingFocusGroupState, NgpRovingFocusGroup } from 'ng-primitives/roving-focus';\nimport { provideRadioGroupState, radioGroupState } from './radio-group-state';\n\n/**\n * Apply the `ngpRadioGroup` directive to an element that represents the group of radio items.\n */\n@Directive({\n selector: '[ngpRadioGroup]',\n providers: [provideRadioGroupState()],\n hostDirectives: [\n {\n directive: NgpRovingFocusGroup,\n inputs: [\n 'ngpRovingFocusGroupOrientation:ngpRadioGroupOrientation',\n 'ngpRovingFocusGroupDisabled:ngpRadioGroupDisabled',\n ],\n },\n ],\n host: {\n role: 'radiogroup',\n '[attr.aria-orientation]': 'state.orientation()',\n '[attr.data-orientation]': 'state.orientation()',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n },\n})\nexport class NgpRadioGroup<T> implements OnInit {\n /**\n * Access the roving focus group state.\n */\n private readonly rovingFocusGroupState = injectRovingFocusGroupState();\n\n /**\n * The value of the radio group.\n */\n readonly value = input<T | null>(null, { alias: 'ngpRadioGroupValue' });\n\n /**\n * Event emitted when the radio group value changes.\n */\n readonly valueChange = output<T | null>({\n alias: 'ngpRadioGroupValueChange',\n });\n\n /**\n * Whether the radio group is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRadioGroupDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The orientation of the radio group.\n * @default 'horizontal'\n */\n readonly orientation = input<NgpOrientation>('horizontal', {\n alias: 'ngpRadioGroupOrientation',\n });\n\n /**\n * The comparator function for the radio group. This is useful if values are objects and you want to compare them by value, not by reference.\n * @default (a, b) => a === b\n */\n readonly compareWith = input<(a: T | null, b: T | null) => boolean>((a, b) => a === b, {\n alias: 'ngpRadioGroupCompareWith',\n });\n\n /**\n * The state of the radio group.\n * @internal\n */\n protected readonly state = radioGroupState<NgpRadioGroup<T>>(this);\n\n constructor() {\n setupFormControl({ disabled: this.state.disabled });\n }\n\n ngOnInit(): void {\n // the roving focus group defaults to vertical orientation whereas we want to default to vertical\n this.rovingFocusGroupState().orientation.set(this.state.orientation());\n }\n\n /**\n * Select a radio item.\n * @param value The value of the radio item to select.\n */\n select(value: T): void {\n // if the value is already selected, do nothing\n if (this.state.compareWith()(this.state.value(), value)) {\n return;\n }\n\n this.state.value.set(value);\n this.valueChange.emit(value);\n }\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n InjectedState,\n} from 'ng-primitives/state';\nimport type { NgpRadioItem } from './radio-item';\n\n/**\n * The state token for the RadioItem primitive.\n */\nexport const NgpRadioItemStateToken = createStateToken<NgpRadioItem<unknown>>('RadioItem');\n\n/**\n * Provides the RadioItem state.\n */\nexport const provideRadioItemState = createStateProvider(NgpRadioItemStateToken);\n\n/**\n * Injects the RadioItem state.\n */\nexport const injectRadioItemState = createStateInjector(NgpRadioItemStateToken) as <\n T,\n>() => InjectedState<NgpRadioItem<T>>;\n\n/**\n * The RadioItem state registration function.\n */\nexport const radioItemState = createState(NgpRadioItemStateToken);\n","import { Directive, computed } from '@angular/core';\nimport { NgpHover, NgpPress } from 'ng-primitives/interactions';\nimport { injectRadioGroupState } from '../radio-group/radio-group-state';\nimport { injectRadioItemState } from '../radio-item/radio-item-state';\n\n/**\n * Apply the `ngpRadioIndicator` directive to an element that represents the radio indicator (i.e. the dot).\n */\n@Directive({\n selector: '[ngpRadioIndicator]',\n host: {\n '[attr.data-checked]': 'checked() ? \"\" : null',\n '[attr.data-disabled]': 'radioItemState().disabled() ? \"\" : null',\n },\n hostDirectives: [NgpHover, NgpPress],\n})\nexport class NgpRadioIndicator<T> {\n /**\n * Access the radio group state.\n */\n protected readonly radioGroupState = injectRadioGroupState<T>();\n\n /**\n * Access the radio group item state\n */\n protected readonly radioItemState = injectRadioItemState<T>();\n\n /**\n * Determine if the radio indicator is checked.\n */\n protected readonly checked = computed(\n () => this.radioGroupState().value() === this.radioItemState().value(),\n );\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, HostListener, booleanAttribute, computed, input } from '@angular/core';\nimport { NgpFocusVisible, NgpHover, NgpPress } from 'ng-primitives/interactions';\nimport { NgpRovingFocusItem } from 'ng-primitives/roving-focus';\nimport { injectRadioGroupState } from '../radio-group/radio-group-state';\nimport { provideRadioItemState, radioItemState } from './radio-item-state';\n\n/**\n * Apply the `ngpRadioItem` directive to an element that represents a radio item. This would typically be a `button` element.\n */\n@Directive({\n selector: '[ngpRadioItem]',\n hostDirectives: [NgpRovingFocusItem, NgpHover, NgpFocusVisible, NgpPress],\n providers: [provideRadioItemState()],\n host: {\n role: 'radio',\n '[attr.aria-checked]': 'checked() ? \"true\" : \"false\"',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '[attr.data-checked]': 'checked() ? \"\" : null',\n },\n})\nexport class NgpRadioItem<T> {\n /**\n * Access the radio group state.\n */\n private readonly radioGroupState = injectRadioGroupState<T>();\n\n /**\n * The value of the radio item.\n */\n readonly value = input.required<T>({ alias: 'ngpRadioItemValue' });\n\n /**\n * Whether the radio item is disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRadioItemDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Whether the radio item is checked.\n */\n readonly checked = computed(() =>\n this.radioGroupState().compareWith()(this.radioGroupState().value(), this.value()),\n );\n\n /**\n * The state of the radio item.\n */\n protected readonly state = radioItemState<NgpRadioItem<T>>(this);\n\n /**\n * When the item receives focus, select it.\n * @internal\n */\n @HostListener('focus')\n protected onFocus(): void {\n this.radioGroupState().select(this.value());\n }\n\n /**\n * When the item receives a click, select it.\n * @internal\n */\n @HostListener('click')\n protected onClick(): void {\n this.radioGroupState().select(this.value());\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],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AAA,CAAA;sBADhB,YAAY;uBAAC,OAAO;gBAUX,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,OAAO;;;AClEvB;;AAEG;;;;"}
@@ -1,7 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { input, booleanAttribute, Directive } from '@angular/core';
3
- import * as i1 from 'ng-primitives/form-field';
4
- import { syncFormControl, NgpFormControl } from 'ng-primitives/form-field';
3
+ import { setupFormControl } from 'ng-primitives/form-field';
5
4
  import { setupInteractions } from 'ng-primitives/internal';
6
5
  import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
7
6
 
@@ -45,10 +44,10 @@ class NgpSelect {
45
44
  focusVisible: true,
46
45
  disabled: this.state.disabled,
47
46
  });
48
- syncFormControl({ disabled: this.state.disabled });
47
+ setupFormControl({ disabled: this.state.disabled });
49
48
  }
50
49
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpSelect, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
51
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpSelect, isStandalone: true, selector: "select[ngpSelect]", inputs: { disabled: { classPropertyName: "disabled", publicName: "ngpSelectDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.disabled": "disabled() || null" } }, providers: [provideSelectState()], exportAs: ["ngpSelect"], hostDirectives: [{ directive: i1.NgpFormControl }], ngImport: i0 }); }
50
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpSelect, isStandalone: true, selector: "select[ngpSelect]", inputs: { disabled: { classPropertyName: "disabled", publicName: "ngpSelectDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.disabled": "disabled() || null" } }, providers: [provideSelectState()], exportAs: ["ngpSelect"], ngImport: i0 }); }
52
51
  }
53
52
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpSelect, decorators: [{
54
53
  type: Directive,
@@ -56,7 +55,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
56
55
  selector: 'select[ngpSelect]',
57
56
  exportAs: 'ngpSelect',
58
57
  providers: [provideSelectState()],
59
- hostDirectives: [NgpFormControl],
60
58
  host: {
61
59
  '[attr.disabled]': 'disabled() || null',
62
60
  },
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-select.mjs","sources":["../../../../packages/ng-primitives/select/src/select/select-state.ts","../../../../packages/ng-primitives/select/src/select/select.ts","../../../../packages/ng-primitives/select/src/ng-primitives-select.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpSelect } from './select';\n\n/**\n * The state token for the Select primitive.\n */\nexport const NgpSelectStateToken = createStateToken<NgpSelect>('Select');\n\n/**\n * Provides the Select state.\n */\nexport const provideSelectState = createStateProvider(NgpSelectStateToken);\n\n/**\n * Injects the Select state.\n */\nexport const injectSelectState = createStateInjector(NgpSelectStateToken);\n\n/**\n * The Select state registration function.\n */\nexport const selectState = createState(NgpSelectStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input } from '@angular/core';\nimport { NgpFormControl, syncFormControl } from 'ng-primitives/form-field';\nimport { setupInteractions } from 'ng-primitives/internal';\nimport { provideSelectState, selectState } from './select-state';\n\n/**\n * Apply the `ngpSelect` directive to a select element that you want to enhance.\n */\n@Directive({\n selector: 'select[ngpSelect]',\n exportAs: 'ngpSelect',\n providers: [provideSelectState()],\n hostDirectives: [NgpFormControl],\n host: {\n '[attr.disabled]': 'disabled() || null',\n },\n})\nexport class NgpSelect {\n /**\n * Whether the select is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpSelectDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The select state.\n */\n private readonly state = selectState<NgpSelect>(this);\n\n constructor() {\n setupInteractions({\n hover: true,\n press: true,\n focus: true,\n focusVisible: true,\n disabled: this.state.disabled,\n });\n syncFormControl({ disabled: this.state.disabled });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAQA;;AAEG;AACI,MAAM,mBAAmB,GAAG,gBAAgB,CAAY,QAAQ,CAAC;AAExE;;AAEG;MACU,kBAAkB,GAAG,mBAAmB,CAAC,mBAAmB;AAEzE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,CAAC,mBAAmB;AAExE;;AAEG;AACI,MAAM,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC;;ACpB3D;;AAEG;MAUU,SAAS,CAAA;AAcpB,IAAA,WAAA,GAAA;AAbA;;AAEG;AACM,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAwB,KAAK,EAAE;AACtD,YAAA,KAAK,EAAE,mBAAmB;AAC1B,YAAA,SAAS,EAAE,gBAAgB;AAC5B,SAAA,CAAC;AAEF;;AAEG;AACc,QAAA,IAAA,CAAA,KAAK,GAAG,WAAW,CAAY,IAAI,CAAC;AAGnD,QAAA,iBAAiB,CAAC;AAChB,YAAA,KAAK,EAAE,IAAI;AACX,YAAA,KAAK,EAAE,IAAI;AACX,YAAA,KAAK,EAAE,IAAI;AACX,YAAA,YAAY,EAAE,IAAI;AAClB,YAAA,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ;AAC9B,SAAA,CAAC;QACF,eAAe,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;;8GAtBzC,SAAS,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAT,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,SAAS,EANT,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,mBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,eAAA,EAAA,oBAAA,EAAA,EAAA,EAAA,SAAA,EAAA,CAAC,kBAAkB,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,cAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAMtB,SAAS,EAAA,UAAA,EAAA,CAAA;kBATrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,SAAS,EAAE,CAAC,kBAAkB,EAAE,CAAC;oBACjC,cAAc,EAAE,CAAC,cAAc,CAAC;AAChC,oBAAA,IAAI,EAAE;AACJ,wBAAA,iBAAiB,EAAE,oBAAoB;AACxC,qBAAA;AACF,iBAAA;;;ACjBD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-select.mjs","sources":["../../../../packages/ng-primitives/select/src/select/select-state.ts","../../../../packages/ng-primitives/select/src/select/select.ts","../../../../packages/ng-primitives/select/src/ng-primitives-select.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpSelect } from './select';\n\n/**\n * The state token for the Select primitive.\n */\nexport const NgpSelectStateToken = createStateToken<NgpSelect>('Select');\n\n/**\n * Provides the Select state.\n */\nexport const provideSelectState = createStateProvider(NgpSelectStateToken);\n\n/**\n * Injects the Select state.\n */\nexport const injectSelectState = createStateInjector(NgpSelectStateToken);\n\n/**\n * The Select state registration function.\n */\nexport const selectState = createState(NgpSelectStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input } from '@angular/core';\nimport { setupFormControl } from 'ng-primitives/form-field';\nimport { setupInteractions } from 'ng-primitives/internal';\nimport { provideSelectState, selectState } from './select-state';\n\n/**\n * Apply the `ngpSelect` directive to a select element that you want to enhance.\n */\n@Directive({\n selector: 'select[ngpSelect]',\n exportAs: 'ngpSelect',\n providers: [provideSelectState()],\n host: {\n '[attr.disabled]': 'disabled() || null',\n },\n})\nexport class NgpSelect {\n /**\n * Whether the select is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpSelectDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The select state.\n */\n private readonly state = selectState<NgpSelect>(this);\n\n constructor() {\n setupInteractions({\n hover: true,\n press: true,\n focus: true,\n focusVisible: true,\n disabled: this.state.disabled,\n });\n setupFormControl({ disabled: this.state.disabled });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAQA;;AAEG;AACI,MAAM,mBAAmB,GAAG,gBAAgB,CAAY,QAAQ,CAAC;AAExE;;AAEG;MACU,kBAAkB,GAAG,mBAAmB,CAAC,mBAAmB;AAEzE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,CAAC,mBAAmB;AAExE;;AAEG;AACI,MAAM,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC;;ACpB3D;;AAEG;MASU,SAAS,CAAA;AAcpB,IAAA,WAAA,GAAA;AAbA;;AAEG;AACM,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAwB,KAAK,EAAE;AACtD,YAAA,KAAK,EAAE,mBAAmB;AAC1B,YAAA,SAAS,EAAE,gBAAgB;AAC5B,SAAA,CAAC;AAEF;;AAE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C,oBAAA,IAAI,EAAE;AACJ,wBAAA,iBAAiB,EAAE,oBAAoB;AACxC,qBAAA;AACF,iBAAA;;;AChBD;;AAEG;;;;"}
@@ -2,8 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { Directive, HostListener, input, numberAttribute, output, booleanAttribute, signal, computed } from '@angular/core';
3
3
  import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
4
4
  import { setupInteractions, injectElementRef } from 'ng-primitives/internal';
5
- import * as i1 from 'ng-primitives/form-field';
6
- import { syncFormControl, NgpFormControl } from 'ng-primitives/form-field';
5
+ import { setupFormControl } from 'ng-primitives/form-field';
7
6
 
8
7
  /**
9
8
  * The state token for the Slider primitive.
@@ -281,10 +280,10 @@ class NgpSlider {
281
280
  * @internal
282
281
  */
283
282
  this.state = sliderState(this);
284
- syncFormControl({ disabled: this.state.disabled });
283
+ setupFormControl({ disabled: this.state.disabled });
285
284
  }
286
285
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpSlider, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
287
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", 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: { valueChange: "ngpSliderValueChange" }, host: { properties: { "attr.data-orientation": "state.orientation()" } }, providers: [provideSliderState()], exportAs: ["ngpSlider"], hostDirectives: [{ directive: i1.NgpFormControl }], ngImport: i0 }); }
286
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", 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: { valueChange: "ngpSliderValueChange" }, host: { properties: { "attr.data-orientation": "state.orientation()" } }, providers: [provideSliderState()], exportAs: ["ngpSlider"], ngImport: i0 }); }
288
287
  }
289
288
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpSlider, decorators: [{
290
289
  type: Directive,
@@ -292,7 +291,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
292
291
  selector: '[ngpSlider]',
293
292
  exportAs: 'ngpSlider',
294
293
  providers: [provideSliderState()],
295
- hostDirectives: [NgpFormControl],
296
294
  host: {
297
295
  '[attr.data-orientation]': 'state.orientation()',
298
296
  },
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-slider.mjs","sources":["../../../../packages/ng-primitives/slider/src/slider/slider-state.ts","../../../../packages/ng-primitives/slider/src/slider-range/slider-range.ts","../../../../packages/ng-primitives/slider/src/slider-thumb/slider-thumb.ts","../../../../packages/ng-primitives/slider/src/slider-track/slider-track.ts","../../../../packages/ng-primitives/slider/src/slider/slider.ts","../../../../packages/ng-primitives/slider/src/ng-primitives-slider.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpSlider } from './slider';\n\n/**\n * The state token for the Slider primitive.\n */\nexport const NgpSliderStateToken = createStateToken<NgpSlider>('Slider');\n\n/**\n * Provides the Slider state.\n */\nexport const provideSliderState = createStateProvider(NgpSliderStateToken);\n\n/**\n * Injects the Slider state.\n */\nexport const injectSliderState = createStateInjector(NgpSliderStateToken);\n\n/**\n * The Slider state registration function.\n */\nexport const sliderState = createState(NgpSliderStateToken);\n","import { Directive } from '@angular/core';\nimport { injectSliderState } from '../slider/slider-state';\n\n/**\n * Apply the `ngpSliderRange` directive to an element that represents the range of the slider.\n */\n@Directive({\n selector: '[ngpSliderRange]',\n exportAs: 'ngpSliderRange',\n host: {\n '[attr.data-orientation]': 'sliderState().orientation()',\n '[attr.data-disabled]': 'sliderState().disabled() ? \"\" : null',\n '[style.width.%]':\n 'sliderState().orientation() === \"horizontal\" ? sliderState().percentage() : undefined',\n '[style.height.%]':\n 'sliderState().orientation() === \"vertical\" ? sliderState().percentage() : undefined',\n },\n})\nexport class NgpSliderRange {\n /**\n * Access the slider state.\n */\n protected readonly sliderState = injectSliderState();\n}\n","import { Directive, HostListener } from '@angular/core';\nimport { setupInteractions } from 'ng-primitives/internal';\nimport { injectSliderState } from '../slider/slider-state';\n\n/**\n * Apply the `ngpSliderThumb` directive to an element that represents the thumb of the slider.\n */\n@Directive({\n selector: '[ngpSliderThumb]',\n exportAs: 'ngpSliderThumb',\n host: {\n role: 'slider',\n '[attr.aria-valuemin]': 'sliderState().min()',\n '[attr.aria-valuemax]': 'sliderState().max()',\n '[attr.aria-valuenow]': 'sliderState().value()',\n '[attr.aria-orientation]': 'sliderState().orientation()',\n '[tabindex]': 'sliderState().disabled() ? -1 : 0',\n '[attr.data-orientation]': 'sliderState().orientation()',\n '[attr.data-disabled]': 'sliderState().disabled() ? \"\" : null',\n '[style.inset-inline-start.%]':\n 'sliderState().orientation() === \"horizontal\" ? sliderState().percentage() : undefined',\n '[style.inset-block-start.%]':\n 'sliderState().orientation() === \"vertical\" ? sliderState().percentage() : undefined',\n },\n})\nexport class NgpSliderThumb {\n /**\n * Access the slider state.\n */\n protected readonly sliderState = injectSliderState();\n\n /**\n * Store the dragging state.\n */\n protected dragging = false;\n\n constructor() {\n setupInteractions({\n hover: true,\n focusVisible: true,\n press: true,\n disabled: this.sliderState().disabled,\n });\n }\n\n @HostListener('pointerdown', ['$event'])\n protected handlePointerDown(event: PointerEvent): void {\n event.preventDefault();\n\n if (this.sliderState().disabled()) {\n return;\n }\n\n this.dragging = true;\n }\n\n @HostListener('document:pointerup')\n protected handlePointerUp(): void {\n if (this.sliderState().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.sliderState().disabled() || !this.dragging) {\n return;\n }\n\n const rect = this.sliderState().track()?.element.nativeElement.getBoundingClientRect();\n\n if (!rect) {\n return;\n }\n\n const percentage =\n this.sliderState().orientation() === 'horizontal'\n ? (event.clientX - rect.left) / rect.width\n : 1 - (event.clientY - rect.top) / rect.height;\n\n this.sliderState().value.set(\n this.sliderState().min() +\n (this.sliderState().max() - this.sliderState().min()) *\n Math.max(0, Math.min(1, percentage)),\n );\n this.sliderState().valueChange.emit(this.sliderState().value());\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 const value = this.sliderState().value();\n\n switch (event.key) {\n case 'ArrowLeft':\n case 'ArrowDown':\n this.sliderState().value.set(\n Math.max(value - this.sliderState().step() * multiplier, this.sliderState().min()),\n );\n this.sliderState().valueChange.emit(this.sliderState().value());\n event.preventDefault();\n break;\n case 'ArrowRight':\n case 'ArrowUp':\n this.sliderState().value.set(\n Math.min(value + this.sliderState().step() * multiplier, this.sliderState().max()),\n );\n this.sliderState().valueChange.emit(this.sliderState().value());\n event.preventDefault();\n break;\n case 'Home':\n this.sliderState().value.set(this.sliderState().min());\n this.sliderState().valueChange.emit(this.sliderState().value());\n event.preventDefault();\n break;\n case 'End':\n this.sliderState().value.set(this.sliderState().max());\n this.sliderState().valueChange.emit(this.sliderState().value());\n event.preventDefault();\n break;\n }\n }\n}\n","import { Directive, HostListener } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { injectSliderState } from '../slider/slider-state';\n\n/**\n * Apply the `ngpSliderTrack` directive to an element that represents the track of the slider.\n */\n@Directive({\n selector: '[ngpSliderTrack]',\n exportAs: 'ngpSliderTrack',\n host: {\n '[attr.data-orientation]': 'sliderState().orientation()',\n '[attr.data-disabled]': 'sliderState().disabled() ? \"\" : null',\n },\n})\nexport class NgpSliderTrack {\n /**\n * Access the slider state.\n */\n protected readonly sliderState = injectSliderState();\n\n /**\n * The element that represents the slider track.\n */\n readonly element = injectElementRef<HTMLElement>();\n\n constructor() {\n this.sliderState().track.set(this);\n }\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.sliderState().disabled()) {\n return;\n }\n\n // get the position the click occurred within the slider track\n const position =\n this.sliderState().orientation() === 'horizontal' ? event.clientX : event.clientY;\n const rect = this.element.nativeElement.getBoundingClientRect();\n const percentage =\n (position - (this.sliderState().orientation() === 'horizontal' ? rect.left : rect.top)) /\n (this.sliderState().orientation() === 'horizontal' ? rect.width : rect.height);\n\n // update the value based on the position\n this.sliderState().value.set(\n this.sliderState().min() + (this.sliderState().max() - this.sliderState().min()) * percentage,\n );\n this.sliderState().valueChange.emit(this.sliderState().value());\n }\n}\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n Directive,\n booleanAttribute,\n computed,\n input,\n numberAttribute,\n output,\n signal,\n} from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { NgpFormControl, syncFormControl } from 'ng-primitives/form-field';\nimport type { NgpSliderTrack } from '../slider-track/slider-track';\nimport { provideSliderState, sliderState } from './slider-state';\n\n/**\n * Apply the `ngpSlider` directive to an element that represents the slider and contains the track, range, and thumb.\n */\n@Directive({\n selector: '[ngpSlider]',\n exportAs: 'ngpSlider',\n providers: [provideSliderState()],\n hostDirectives: [NgpFormControl],\n host: {\n '[attr.data-orientation]': 'state.orientation()',\n },\n})\nexport class NgpSlider {\n /**\n * The value of the slider.\n */\n readonly value = input<number, NumberInput>(0, {\n alias: 'ngpSliderValue',\n transform: numberAttribute,\n });\n\n /**\n * Emits when the value changes.\n */\n readonly valueChange = output<number>({\n alias: 'ngpSliderValueChange',\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<NgpOrientation>('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 * @internal\n */\n readonly track = signal<NgpSliderTrack | undefined>(undefined);\n\n /**\n * The value as a percentage based on the min and max values.\n */\n protected readonly percentage = computed(\n () => ((this.state.value() - this.state.min()) / (this.state.max() - this.state.min())) * 100,\n );\n\n /**\n * The state of the slider. We use this for the slider state rather than relying on the inputs.\n * @internal\n */\n protected readonly state = sliderState<NgpSlider>(this);\n\n constructor() {\n syncFormControl({ disabled: this.state.disabled });\n }\n}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A,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAMtB,SAAS,EAAA,UAAA,EAAA,CAAA;kBATrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,SAAS,EAAE,CAAC,kBAAkB,EAAE,CAAC;oBACjC,cAAc,EAAE,CAAC,cAAc,CAAC;AAChC,oBAAA,IAAI,EAAE;AACJ,wBAAA,yBAAyB,EAAE,qBAAqB;AACjD,qBAAA;AACF,iBAAA;;;AC1BD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-slider.mjs","sources":["../../../../packages/ng-primitives/slider/src/slider/slider-state.ts","../../../../packages/ng-primitives/slider/src/slider-range/slider-range.ts","../../../../packages/ng-primitives/slider/src/slider-thumb/slider-thumb.ts","../../../../packages/ng-primitives/slider/src/slider-track/slider-track.ts","../../../../packages/ng-primitives/slider/src/slider/slider.ts","../../../../packages/ng-primitives/slider/src/ng-primitives-slider.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpSlider } from './slider';\n\n/**\n * The state token for the Slider primitive.\n */\nexport const NgpSliderStateToken = createStateToken<NgpSlider>('Slider');\n\n/**\n * Provides the Slider state.\n */\nexport const provideSliderState = createStateProvider(NgpSliderStateToken);\n\n/**\n * Injects the Slider state.\n */\nexport const injectSliderState = createStateInjector(NgpSliderStateToken);\n\n/**\n * The Slider state registration function.\n */\nexport const sliderState = createState(NgpSliderStateToken);\n","import { Directive } from '@angular/core';\nimport { injectSliderState } from '../slider/slider-state';\n\n/**\n * Apply the `ngpSliderRange` directive to an element that represents the range of the slider.\n */\n@Directive({\n selector: '[ngpSliderRange]',\n exportAs: 'ngpSliderRange',\n host: {\n '[attr.data-orientation]': 'sliderState().orientation()',\n '[attr.data-disabled]': 'sliderState().disabled() ? \"\" : null',\n '[style.width.%]':\n 'sliderState().orientation() === \"horizontal\" ? sliderState().percentage() : undefined',\n '[style.height.%]':\n 'sliderState().orientation() === \"vertical\" ? sliderState().percentage() : undefined',\n },\n})\nexport class NgpSliderRange {\n /**\n * Access the slider state.\n */\n protected readonly sliderState = injectSliderState();\n}\n","import { Directive, HostListener } from '@angular/core';\nimport { setupInteractions } from 'ng-primitives/internal';\nimport { injectSliderState } from '../slider/slider-state';\n\n/**\n * Apply the `ngpSliderThumb` directive to an element that represents the thumb of the slider.\n */\n@Directive({\n selector: '[ngpSliderThumb]',\n exportAs: 'ngpSliderThumb',\n host: {\n role: 'slider',\n '[attr.aria-valuemin]': 'sliderState().min()',\n '[attr.aria-valuemax]': 'sliderState().max()',\n '[attr.aria-valuenow]': 'sliderState().value()',\n '[attr.aria-orientation]': 'sliderState().orientation()',\n '[tabindex]': 'sliderState().disabled() ? -1 : 0',\n '[attr.data-orientation]': 'sliderState().orientation()',\n '[attr.data-disabled]': 'sliderState().disabled() ? \"\" : null',\n '[style.inset-inline-start.%]':\n 'sliderState().orientation() === \"horizontal\" ? sliderState().percentage() : undefined',\n '[style.inset-block-start.%]':\n 'sliderState().orientation() === \"vertical\" ? sliderState().percentage() : undefined',\n },\n})\nexport class NgpSliderThumb {\n /**\n * Access the slider state.\n */\n protected readonly sliderState = injectSliderState();\n\n /**\n * Store the dragging state.\n */\n protected dragging = false;\n\n constructor() {\n setupInteractions({\n hover: true,\n focusVisible: true,\n press: true,\n disabled: this.sliderState().disabled,\n });\n }\n\n @HostListener('pointerdown', ['$event'])\n protected handlePointerDown(event: PointerEvent): void {\n event.preventDefault();\n\n if (this.sliderState().disabled()) {\n return;\n }\n\n this.dragging = true;\n }\n\n @HostListener('document:pointerup')\n protected handlePointerUp(): void {\n if (this.sliderState().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.sliderState().disabled() || !this.dragging) {\n return;\n }\n\n const rect = this.sliderState().track()?.element.nativeElement.getBoundingClientRect();\n\n if (!rect) {\n return;\n }\n\n const percentage =\n this.sliderState().orientation() === 'horizontal'\n ? (event.clientX - rect.left) / rect.width\n : 1 - (event.clientY - rect.top) / rect.height;\n\n this.sliderState().value.set(\n this.sliderState().min() +\n (this.sliderState().max() - this.sliderState().min()) *\n Math.max(0, Math.min(1, percentage)),\n );\n this.sliderState().valueChange.emit(this.sliderState().value());\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 const value = this.sliderState().value();\n\n switch (event.key) {\n case 'ArrowLeft':\n case 'ArrowDown':\n this.sliderState().value.set(\n Math.max(value - this.sliderState().step() * multiplier, this.sliderState().min()),\n );\n this.sliderState().valueChange.emit(this.sliderState().value());\n event.preventDefault();\n break;\n case 'ArrowRight':\n case 'ArrowUp':\n this.sliderState().value.set(\n Math.min(value + this.sliderState().step() * multiplier, this.sliderState().max()),\n );\n this.sliderState().valueChange.emit(this.sliderState().value());\n event.preventDefault();\n break;\n case 'Home':\n this.sliderState().value.set(this.sliderState().min());\n this.sliderState().valueChange.emit(this.sliderState().value());\n event.preventDefault();\n break;\n case 'End':\n this.sliderState().value.set(this.sliderState().max());\n this.sliderState().valueChange.emit(this.sliderState().value());\n event.preventDefault();\n break;\n }\n }\n}\n","import { Directive, HostListener } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { injectSliderState } from '../slider/slider-state';\n\n/**\n * Apply the `ngpSliderTrack` directive to an element that represents the track of the slider.\n */\n@Directive({\n selector: '[ngpSliderTrack]',\n exportAs: 'ngpSliderTrack',\n host: {\n '[attr.data-orientation]': 'sliderState().orientation()',\n '[attr.data-disabled]': 'sliderState().disabled() ? \"\" : null',\n },\n})\nexport class NgpSliderTrack {\n /**\n * Access the slider state.\n */\n protected readonly sliderState = injectSliderState();\n\n /**\n * The element that represents the slider track.\n */\n readonly element = injectElementRef<HTMLElement>();\n\n constructor() {\n this.sliderState().track.set(this);\n }\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.sliderState().disabled()) {\n return;\n }\n\n // get the position the click occurred within the slider track\n const position =\n this.sliderState().orientation() === 'horizontal' ? event.clientX : event.clientY;\n const rect = this.element.nativeElement.getBoundingClientRect();\n const percentage =\n (position - (this.sliderState().orientation() === 'horizontal' ? rect.left : rect.top)) /\n (this.sliderState().orientation() === 'horizontal' ? rect.width : rect.height);\n\n // update the value based on the position\n this.sliderState().value.set(\n this.sliderState().min() + (this.sliderState().max() - this.sliderState().min()) * percentage,\n );\n this.sliderState().valueChange.emit(this.sliderState().value());\n }\n}\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n Directive,\n booleanAttribute,\n computed,\n input,\n numberAttribute,\n output,\n signal,\n} from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { setupFormControl } from 'ng-primitives/form-field';\nimport type { NgpSliderTrack } from '../slider-track/slider-track';\nimport { provideSliderState, sliderState } from './slider-state';\n\n/**\n * Apply the `ngpSlider` directive to an element that represents the slider and contains the track, range, and thumb.\n */\n@Directive({\n selector: '[ngpSlider]',\n exportAs: 'ngpSlider',\n providers: [provideSliderState()],\n host: {\n '[attr.data-orientation]': 'state.orientation()',\n },\n})\nexport class NgpSlider {\n /**\n * The value of the slider.\n */\n readonly value = input<number, NumberInput>(0, {\n alias: 'ngpSliderValue',\n transform: numberAttribute,\n });\n\n /**\n * Emits when the value changes.\n */\n readonly valueChange = output<number>({\n alias: 'ngpSliderValueChange',\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<NgpOrientation>('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 * @internal\n */\n readonly track = signal<NgpSliderTrack | undefined>(undefined);\n\n /**\n * The value as a percentage based on the min and max values.\n */\n protected readonly percentage = computed(\n () => ((this.state.value() - this.state.min()) / (this.state.max() - this.state.min())) * 100,\n );\n\n /**\n * The state of the slider. We use this for the slider state rather than relying on the inputs.\n * @internal\n */\n protected readonly state = sliderState<NgpSlider>(this);\n\n constructor() {\n setupFormControl({ disabled: this.state.disabled });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAQA;;AAEG;AACI,MAAM,mBAAmB,GAAG,gBAAgB,CAAY,QAAQ,CAAC;AAExE;;AAEG;MACU,kBAAkB,GAAG,mBAAmB,CAAC,mBAAmB;AAEzE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,CAAC,mBAAmB;AAExE;;AAEG;AACI,MAAM,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC;;ACvB3D;;AAEG;MAaU,cAAc,CAAA;AAZ3B,IAAA,WAAA,GAAA;AAaE;;AAEG;QACgB,IAAW,CAAA,WAAA,GAAG,iBAAiB,EAAE;AACrD;8GALY,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAd,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,uBAAA,EAAA,6BAAA,EAAA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A,EAAA,EAAA,iBAAA,EAAA,aAAA,EAAA,UAAA,EAAA,sBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,mBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,WAAA,EAAA,sBAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,uBAAA,EAAA,qBAAA,EAAA,EAAA,EAAA,SAAA,EAAA,CAAC,kBAAkB,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAKtB,SAAS,EAAA,UAAA,EAAA,CAAA;kBARrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,SAAS,EAAE,CAAC,kBAAkB,EAAE,CAAC;AACjC,oBAAA,IAAI,EAAE;AACJ,wBAAA,yBAAyB,EAAE,qBAAqB;AACjD,qBAAA;AACF,iBAAA;;;ACzBD;;AAEG;;;;"}
@@ -1,7 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { input, booleanAttribute, Directive } from '@angular/core';
3
- import * as i1 from 'ng-primitives/form-field';
4
- import { syncFormControl, NgpFormControl } from 'ng-primitives/form-field';
3
+ import { setupFormControl } from 'ng-primitives/form-field';
5
4
  import { setupInteractions } from 'ng-primitives/internal';
6
5
  import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
7
6
 
@@ -40,10 +39,10 @@ class NgpTextarea {
40
39
  focus: true,
41
40
  disabled: this.state.disabled,
42
41
  });
43
- syncFormControl({ disabled: this.state.disabled });
42
+ setupFormControl({ disabled: this.state.disabled });
44
43
  }
45
44
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpTextarea, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
46
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpTextarea, isStandalone: true, selector: "[ngpTextarea]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideTextareaState()], exportAs: ["ngpTextarea"], hostDirectives: [{ directive: i1.NgpFormControl }], ngImport: i0 }); }
45
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpTextarea, isStandalone: true, selector: "[ngpTextarea]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideTextareaState()], exportAs: ["ngpTextarea"], ngImport: i0 }); }
47
46
  }
48
47
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpTextarea, decorators: [{
49
48
  type: Directive,
@@ -51,7 +50,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
51
50
  selector: '[ngpTextarea]',
52
51
  exportAs: 'ngpTextarea',
53
52
  providers: [provideTextareaState()],
54
- hostDirectives: [NgpFormControl],
55
53
  }]
56
54
  }], ctorParameters: () => [] });
57
55
 
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-textarea.mjs","sources":["../../../../packages/ng-primitives/textarea/src/textarea/textarea-state.ts","../../../../packages/ng-primitives/textarea/src/textarea/textarea.ts","../../../../packages/ng-primitives/textarea/src/ng-primitives-textarea.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpTextarea } from './textarea';\n\n/**\n * The state token for the Textarea primitive.\n */\nexport const NgpTextareaStateToken = createStateToken<NgpTextarea>('Textarea');\n\n/**\n * Provides the Textarea state.\n */\nexport const provideTextareaState = createStateProvider(NgpTextareaStateToken);\n\n/**\n * Injects the Textarea state.\n */\nexport const injectTextareaState = createStateInjector(NgpTextareaStateToken);\n\n/**\n * The Textarea state registration function.\n */\nexport const textareaState = createState(NgpTextareaStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input } from '@angular/core';\nimport { NgpFormControl, syncFormControl } from 'ng-primitives/form-field';\nimport { setupInteractions } from 'ng-primitives/internal';\nimport { provideTextareaState, textareaState } from './textarea-state';\n\n@Directive({\n selector: '[ngpTextarea]',\n exportAs: 'ngpTextarea',\n providers: [provideTextareaState()],\n hostDirectives: [NgpFormControl],\n})\nexport class NgpTextarea {\n /**\n * Whether the element is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n transform: booleanAttribute,\n });\n\n /**\n * The state of the textarea.\n */\n protected readonly state = textareaState<NgpTextarea>(this);\n\n constructor() {\n setupInteractions({\n hover: true,\n press: true,\n focus: true,\n disabled: this.state.disabled,\n });\n syncFormControl({ disabled: this.state.disabled });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAQA;;AAEG;AACI,MAAM,qBAAqB,GAAG,gBAAgB,CAAc,UAAU,CAAC;AAE9E;;AAEG;MACU,oBAAoB,GAAG,mBAAmB,CAAC,qBAAqB;AAE7E;;AAEG;MACU,mBAAmB,GAAG,mBAAmB,CAAC,qBAAqB;AAE5E;;AAEG;AACI,MAAM,aAAa,GAAG,WAAW,CAAC,qBAAqB,CAAC;;MCdlD,WAAW,CAAA;AAatB,IAAA,WAAA,GAAA;AAZA;;AAEG;AACM,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAwB,KAAK,EAAE;AACtD,YAAA,SAAS,EAAE,gBAAgB;AAC5B,SAAA,CAAC;AAEF;;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ACjC,iBAAA;;;ACXD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-textarea.mjs","sources":["../../../../packages/ng-primitives/textarea/src/textarea/textarea-state.ts","../../../../packages/ng-primitives/textarea/src/textarea/textarea.ts","../../../../packages/ng-primitives/textarea/src/ng-primitives-textarea.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpTextarea } from './textarea';\n\n/**\n * The state token for the Textarea primitive.\n */\nexport const NgpTextareaStateToken = createStateToken<NgpTextarea>('Textarea');\n\n/**\n * Provides the Textarea state.\n */\nexport const provideTextareaState = createStateProvider(NgpTextareaStateToken);\n\n/**\n * Injects the Textarea state.\n */\nexport const injectTextareaState = createStateInjector(NgpTextareaStateToken);\n\n/**\n * The Textarea state registration function.\n */\nexport const textareaState = createState(NgpTextareaStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input } from '@angular/core';\nimport { setupFormControl } from 'ng-primitives/form-field';\nimport { setupInteractions } from 'ng-primitives/internal';\nimport { provideTextareaState, textareaState } from './textarea-state';\n\n@Directive({\n selector: '[ngpTextarea]',\n exportAs: 'ngpTextarea',\n providers: [provideTextareaState()],\n})\nexport class NgpTextarea {\n /**\n * Whether the element is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n transform: booleanAttribute,\n });\n\n /**\n * The state of the textarea.\n */\n protected readonly state = textareaState<NgpTextarea>(this);\n\n constructor() {\n setupInteractions({\n hover: true,\n press: true,\n focus: true,\n disabled: this.state.disabled,\n });\n setupFormControl({ disabled: this.state.disabled });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAQA;;AAEG;AACI,MAAM,qBAAqB,GAAG,gBAAgB,CAAc,UAAU,CAAC;AAE9E;;AAEG;MACU,oBAAoB,GAAG,mBAAmB,CAAC,qBAAqB;AAE7E;;AAEG;MACU,mBA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CAAA;kBALvB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,SAAS,EAAE,CAAC,oBAAoB,EAAE,CAAC;AACpC,iBAAA;;;ACVD;;AAEG;;;;"}
@@ -1,4 +1,3 @@
1
- import { Signal } from '@angular/core';
2
1
  import type { NgpFormControl } from './form-control';
3
2
  /**
4
3
  * The state token for the FormControl primitive.
@@ -14,45 +13,9 @@ export declare const provideFormControlState: (options?: import("ng-primitives/s
14
13
  export declare const injectFormControlState: <U = {
15
14
  readonly id: import("@angular/core").InputSignal<string>;
16
15
  readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
17
- readonly formField: Signal<import("ng-primitives/state").State<{
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
- }>>;
42
- readonly ariaLabelledBy: Signal<string>;
43
- readonly ariaDescribedBy: Signal<string>;
44
16
  readonly state: import("ng-primitives/state").CreatedState<NgpFormControl>;
45
- }>(injectOptions?: import("@angular/core").InjectOptions) => Signal<import("ng-primitives/state").State<U>>;
17
+ }>(injectOptions?: import("@angular/core").InjectOptions) => import("@angular/core").Signal<import("ng-primitives/state").State<U>>;
46
18
  /**
47
19
  * The FormControl state registration function.
48
20
  */
49
21
  export declare const formControlState: <U>(state: U) => import("ng-primitives/state").CreatedState<U>;
50
- interface SyncFormControl {
51
- disabled: Signal<boolean>;
52
- }
53
- /**
54
- * Sync the form control state with control state.
55
- * @param disabled The disabled state of the control.
56
- */
57
- export declare function syncFormControl({ disabled }: SyncFormControl): void;
58
- export {};
@@ -1,4 +1,5 @@
1
1
  import { BooleanInput } from '@angular/cdk/coercion';
2
+ import { Signal } from '@angular/core';
2
3
  import * as i0 from "@angular/core";
3
4
  /**
4
5
  * Typically this primitive would be not be used directly, but instead a more specific form control primitive would be used (e.g. `ngpInput`). All of our form control primitives use `ngpFormControl` internally so they will have the same accessibility features as described below.
@@ -14,42 +15,6 @@ export declare class NgpFormControl {
14
15
  * Whether the form control is disabled by a parent.
15
16
  */
16
17
  readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
17
- /**
18
- * Access the form field that the form control is associated with.
19
- */
20
- protected readonly formField: import("@angular/core").Signal<import("ng-primitives/state").State<{
21
- readonly labels: import("@angular/core").WritableSignal<string[]>;
22
- readonly descriptions: import("@angular/core").WritableSignal<string[]>;
23
- readonly formControl: import("@angular/core").WritableSignal<string | null>;
24
- readonly ngControl: import("@angular/core").Signal<import("@angular/forms").NgControl | undefined>;
25
- readonly errors: import("@angular/core").WritableSignal<string[]>;
26
- readonly pristine: import("@angular/core").WritableSignal<boolean | null>;
27
- readonly touched: import("@angular/core").WritableSignal<boolean | null>;
28
- readonly dirty: import("@angular/core").WritableSignal<boolean | null>;
29
- readonly valid: import("@angular/core").WritableSignal<boolean | null>;
30
- readonly invalid: import("@angular/core").WritableSignal<boolean | null>;
31
- readonly pending: import("@angular/core").WritableSignal<boolean | null>;
32
- readonly disabled: import("@angular/core").WritableSignal<boolean | null>;
33
- subscription?: import("rxjs").Subscription | undefined;
34
- readonly state: import("ng-primitives/state").CreatedState<import("ng-primitives/form-field").NgpFormField>;
35
- ngOnDestroy: () => void;
36
- setupSubscriptions: (control: import("@angular/forms").NgControl | null | undefined) => void;
37
- updateStatus: () => void;
38
- setFormControl: (id: string) => void;
39
- addLabel: (label: string) => void;
40
- addDescription: (description: string) => void;
41
- removeFormControl: () => void;
42
- removeLabel: (label: string) => void;
43
- removeDescription: (description: string) => void;
44
- }>>;
45
- /**
46
- * Determine the aria-labelledby attribute value.
47
- */
48
- protected readonly ariaLabelledBy: import("@angular/core").Signal<string>;
49
- /**
50
- * Determine the aria-describedby attribute value.
51
- */
52
- protected readonly ariaDescribedBy: import("@angular/core").Signal<string>;
53
18
  /**
54
19
  * The state of the form control.
55
20
  */
@@ -58,3 +23,9 @@ export declare class NgpFormControl {
58
23
  static ɵfac: i0.ɵɵFactoryDeclaration<NgpFormControl, never>;
59
24
  static ɵdir: i0.ɵɵDirectiveDeclaration<NgpFormControl, "[ngpFormControl]", ["ngpFormControl"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpFormControlDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
60
25
  }
26
+ interface FormControlState {
27
+ id?: Signal<string>;
28
+ disabled?: Signal<boolean>;
29
+ }
30
+ export declare function setupFormControl({ id, disabled, }: FormControlState): void;
31
+ export {};
@@ -1,7 +1,7 @@
1
1
  export { NgpDescription } from './description/description';
2
2
  export { NgpError } from './error/error';
3
- export { NgpFormControl } from './form-control/form-control';
4
- export { injectFormControlState, provideFormControlState, syncFormControl, } from './form-control/form-control-state';
3
+ export { NgpFormControl, setupFormControl } from './form-control/form-control';
4
+ export { injectFormControlState, provideFormControlState } from './form-control/form-control-state';
5
5
  export { NgpFormField } from './form-field/form-field';
6
6
  export { injectFormFieldState, provideFormFieldState } from './form-field/form-field-state';
7
7
  export { NgpLabel } from './label/label';
@@ -1,7 +1,6 @@
1
1
  import { BooleanInput } from '@angular/cdk/coercion';
2
2
  import * as i0 from "@angular/core";
3
- import * as i1 from "ng-primitives/form-field";
4
- import * as i2 from "ng-primitives/autofill";
3
+ import * as i1 from "ng-primitives/autofill";
5
4
  export declare class NgpInput {
6
5
  /**
7
6
  * The input may be used within a search field, if so we need to register it.
@@ -21,5 +20,5 @@ export declare class NgpInput {
21
20
  protected readonly state: import("ng-primitives/state").CreatedState<NgpInput>;
22
21
  constructor();
23
22
  static ɵfac: i0.ɵɵFactoryDeclaration<NgpInput, never>;
24
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgpInput, "input[ngpInput]", ["ngpInput"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.NgpFormControl; inputs: {}; outputs: {}; }, { directive: typeof i2.NgpAutofill; inputs: {}; outputs: {}; }]>;
23
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgpInput, "input[ngpInput]", ["ngpInput"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.NgpAutofill; inputs: {}; outputs: {}; }]>;
25
24
  }
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.41.0",
5
+ "version": "0.42.0",
6
6
  "keywords": [
7
7
  "angular",
8
8
  "primitives",
@@ -3,7 +3,6 @@ import { OnInit } from '@angular/core';
3
3
  import { NgpOrientation } from 'ng-primitives/common';
4
4
  import * as i0 from "@angular/core";
5
5
  import * as i1 from "ng-primitives/roving-focus";
6
- import * as i2 from "ng-primitives/form-field";
7
6
  /**
8
7
  * Apply the `ngpRadioGroup` directive to an element that represents the group of radio items.
9
8
  */
@@ -47,5 +46,5 @@ export declare class NgpRadioGroup<T> implements OnInit {
47
46
  */
48
47
  select(value: T): void;
49
48
  static ɵfac: i0.ɵɵFactoryDeclaration<NgpRadioGroup<any>, never>;
50
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgpRadioGroup<any>, "[ngpRadioGroup]", never, { "value": { "alias": "ngpRadioGroupValue"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpRadioGroupDisabled"; "required": false; "isSignal": true; }; "orientation": { "alias": "ngpRadioGroupOrientation"; "required": false; "isSignal": true; }; "compareWith": { "alias": "ngpRadioGroupCompareWith"; "required": false; "isSignal": true; }; }, { "valueChange": "ngpRadioGroupValueChange"; }, never, never, true, [{ directive: typeof i1.NgpRovingFocusGroup; inputs: { "ngpRovingFocusGroupOrientation": "ngpRadioGroupOrientation"; "ngpRovingFocusGroupDisabled": "ngpRadioGroupDisabled"; }; outputs: {}; }, { directive: typeof i2.NgpFormControl; inputs: {}; outputs: {}; }]>;
49
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgpRadioGroup<any>, "[ngpRadioGroup]", never, { "value": { "alias": "ngpRadioGroupValue"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpRadioGroupDisabled"; "required": false; "isSignal": true; }; "orientation": { "alias": "ngpRadioGroupOrientation"; "required": false; "isSignal": true; }; "compareWith": { "alias": "ngpRadioGroupCompareWith"; "required": false; "isSignal": true; }; }, { "valueChange": "ngpRadioGroupValueChange"; }, never, never, true, [{ directive: typeof i1.NgpRovingFocusGroup; inputs: { "ngpRovingFocusGroupOrientation": "ngpRadioGroupOrientation"; "ngpRovingFocusGroupDisabled": "ngpRadioGroupDisabled"; }; outputs: {}; }]>;
51
50
  }
@@ -1,6 +1,5 @@
1
1
  import { BooleanInput } from '@angular/cdk/coercion';
2
2
  import * as i0 from "@angular/core";
3
- import * as i1 from "ng-primitives/form-field";
4
3
  /**
5
4
  * Apply the `ngpSelect` directive to a select element that you want to enhance.
6
5
  */
@@ -15,5 +14,5 @@ export declare class NgpSelect {
15
14
  private readonly state;
16
15
  constructor();
17
16
  static ɵfac: i0.ɵɵFactoryDeclaration<NgpSelect, never>;
18
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgpSelect, "select[ngpSelect]", ["ngpSelect"], { "disabled": { "alias": "ngpSelectDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.NgpFormControl; inputs: {}; outputs: {}; }]>;
17
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgpSelect, "select[ngpSelect]", ["ngpSelect"], { "disabled": { "alias": "ngpSelectDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
19
18
  }
@@ -2,7 +2,6 @@ import { BooleanInput, NumberInput } from '@angular/cdk/coercion';
2
2
  import { NgpOrientation } from 'ng-primitives/common';
3
3
  import type { NgpSliderTrack } from '../slider-track/slider-track';
4
4
  import * as i0 from "@angular/core";
5
- import * as i1 from "ng-primitives/form-field";
6
5
  /**
7
6
  * Apply the `ngpSlider` directive to an element that represents the slider and contains the track, range, and thumb.
8
7
  */
@@ -51,5 +50,5 @@ export declare class NgpSlider {
51
50
  protected readonly state: import("ng-primitives/state").CreatedState<NgpSlider>;
52
51
  constructor();
53
52
  static ɵfac: i0.ɵɵFactoryDeclaration<NgpSlider, never>;
54
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgpSlider, "[ngpSlider]", ["ngpSlider"], { "value": { "alias": "ngpSliderValue"; "required": false; "isSignal": true; }; "min": { "alias": "ngpSliderMin"; "required": false; "isSignal": true; }; "max": { "alias": "ngpSliderMax"; "required": false; "isSignal": true; }; "step": { "alias": "ngpSliderStep"; "required": false; "isSignal": true; }; "orientation": { "alias": "ngpSliderOrientation"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpSliderDisabled"; "required": false; "isSignal": true; }; }, { "valueChange": "ngpSliderValueChange"; }, never, never, true, [{ directive: typeof i1.NgpFormControl; inputs: {}; outputs: {}; }]>;
53
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgpSlider, "[ngpSlider]", ["ngpSlider"], { "value": { "alias": "ngpSliderValue"; "required": false; "isSignal": true; }; "min": { "alias": "ngpSliderMin"; "required": false; "isSignal": true; }; "max": { "alias": "ngpSliderMax"; "required": false; "isSignal": true; }; "step": { "alias": "ngpSliderStep"; "required": false; "isSignal": true; }; "orientation": { "alias": "ngpSliderOrientation"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpSliderDisabled"; "required": false; "isSignal": true; }; }, { "valueChange": "ngpSliderValueChange"; }, never, never, true, never>;
55
54
  }
@@ -1,6 +1,5 @@
1
1
  import { BooleanInput } from '@angular/cdk/coercion';
2
2
  import * as i0 from "@angular/core";
3
- import * as i1 from "ng-primitives/form-field";
4
3
  export declare class NgpTextarea {
5
4
  /**
6
5
  * Whether the element is disabled.
@@ -12,5 +11,5 @@ export declare class NgpTextarea {
12
11
  protected readonly state: import("ng-primitives/state").CreatedState<NgpTextarea>;
13
12
  constructor();
14
13
  static ɵfac: i0.ɵɵFactoryDeclaration<NgpTextarea, never>;
15
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgpTextarea, "[ngpTextarea]", ["ngpTextarea"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.NgpFormControl; inputs: {}; outputs: {}; }]>;
14
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgpTextarea, "[ngpTextarea]", ["ngpTextarea"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
16
15
  }