@spartan-ng/brain 0.0.1-alpha.510 → 0.0.1-alpha.512

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.
@@ -24,6 +24,8 @@ export declare class BrnCheckbox implements ControlValueAccessor, AfterContentIn
24
24
  * Can be bound with [(checked)] for two-way binding.
25
25
  */
26
26
  readonly checked: import("@angular/core").ModelSignal<BrnCheckboxValue>;
27
+ /** Emits when checked state changes. */
28
+ readonly checkedChange: import("@angular/core").OutputEmitterRef<BrnCheckboxValue>;
27
29
  /**
28
30
  * Read-only signal of current checkbox state.
29
31
  * Use this when you only need to read state without changing it.
@@ -150,7 +152,7 @@ export declare class BrnCheckbox implements ControlValueAccessor, AfterContentIn
150
152
  */
151
153
  setDisabledState(isDisabled: boolean): void;
152
154
  static ɵfac: i0.ɵɵFactoryDeclaration<BrnCheckbox, never>;
153
- static ɵcmp: i0.ɵɵComponentDeclaration<BrnCheckbox, "brn-checkbox", never, { "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "class": { "alias": "class"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "ariaDescribedby": { "alias": "aria-describedby"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "checked": "checkedChange"; "changed": "changed"; "touched": "touched"; }, never, ["*"], true, never>;
155
+ static ɵcmp: i0.ɵɵComponentDeclaration<BrnCheckbox, "brn-checkbox", never, { "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "class": { "alias": "class"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "ariaDescribedby": { "alias": "aria-describedby"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "checked": "checkedChange"; "checkedChange": "checkedChange"; "changed": "changed"; "touched": "touched"; }, never, ["*"], true, never>;
154
156
  }
155
157
  type BrnCheckboxValue = boolean | 'indeterminate';
156
158
  export {};
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { forwardRef, inject, DestroyRef, Renderer2, ElementRef, ChangeDetectorRef, PLATFORM_ID, signal, model, computed, input, linkedSignal, booleanAttribute, viewChild, output, effect, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
2
+ import { forwardRef, inject, DestroyRef, Renderer2, ElementRef, ChangeDetectorRef, PLATFORM_ID, signal, model, output, computed, input, linkedSignal, booleanAttribute, viewChild, effect, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
3
3
  import { FocusMonitor } from '@angular/cdk/a11y';
4
4
  import { DOCUMENT, isPlatformBrowser } from '@angular/common';
5
5
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@@ -28,6 +28,8 @@ class BrnCheckbox {
28
28
  * Can be bound with [(checked)] for two-way binding.
29
29
  */
30
30
  checked = model(false);
31
+ /** Emits when checked state changes. */
32
+ checkedChange = output();
31
33
  /**
32
34
  * Read-only signal of current checkbox state.
33
35
  * Use this when you only need to read state without changing it.
@@ -157,6 +159,7 @@ class BrnCheckbox {
157
159
  this.checked.set(previousChecked === 'indeterminate' ? true : !previousChecked);
158
160
  this._onChange(this.checked());
159
161
  this.changed.emit(this.checked());
162
+ this.checkedChange.emit(this.checked());
160
163
  }
161
164
  ngAfterContentInit() {
162
165
  this._focusMonitor
@@ -242,7 +245,7 @@ class BrnCheckbox {
242
245
  this._cdr.markForCheck();
243
246
  }
244
247
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCheckbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
245
- /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.8", type: BrnCheckbox, isStandalone: true, selector: "brn-checkbox", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", changed: "changed", touched: "touched" }, host: { properties: { "style": "{display: \"contents\"}", "attr.id": "_state().id", "attr.name": "_state().name", "attr.aria-labelledby": "null", "attr.aria-label": "null", "attr.aria-describedby": "null", "attr.data-state": "_dataState()", "attr.data-focus-visible": "_focusVisible()", "attr.data-focus": "_focused()", "attr.data-disabled": "_state().disabled()" } }, providers: [BRN_CHECKBOX_VALUE_ACCESSOR], viewQueries: [{ propertyName: "checkbox", first: true, predicate: ["checkBox"], descendants: true, isSignal: true }], ngImport: i0, template: `
248
+ /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.8", type: BrnCheckbox, isStandalone: true, selector: "brn-checkbox", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", checkedChange: "checkedChange", changed: "changed", touched: "touched" }, host: { properties: { "style": "{display: \"contents\"}", "attr.id": "_state().id", "attr.name": "_state().name", "attr.aria-labelledby": "null", "attr.aria-label": "null", "attr.aria-describedby": "null", "attr.data-state": "_dataState()", "attr.data-focus-visible": "_focusVisible()", "attr.data-focus": "_focused()", "attr.data-disabled": "_state().disabled()" } }, providers: [BRN_CHECKBOX_VALUE_ACCESSOR], viewQueries: [{ propertyName: "checkbox", first: true, predicate: ["checkBox"], descendants: true, isSignal: true }], ngImport: i0, template: `
246
249
  <button
247
250
  #checkBox
248
251
  role="checkbox"
@@ -1 +1 @@
1
- {"version":3,"file":"spartan-ng-brain-checkbox.mjs","sources":["../../../../libs/brain/checkbox/src/lib/brn-checkbox.ts","../../../../libs/brain/checkbox/src/index.ts","../../../../libs/brain/checkbox/src/spartan-ng-brain-checkbox.ts"],"sourcesContent":["import { FocusMonitor } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n\ttype AfterContentInit,\n\tChangeDetectionStrategy,\n\tChangeDetectorRef,\n\tComponent,\n\tDestroyRef,\n\tElementRef,\n\ttype OnDestroy,\n\tPLATFORM_ID,\n\tRenderer2,\n\tbooleanAttribute,\n\tcomputed,\n\teffect,\n\tforwardRef,\n\tinject,\n\tinput,\n\tlinkedSignal,\n\tmodel,\n\toutput,\n\tsignal,\n\tviewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';\n\nexport const BRN_CHECKBOX_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnCheckbox),\n\tmulti: true,\n};\n\nlet uniqueIdCounter = 0;\n\nconst CONTAINER_POST_FIX = '-checkbox';\n\n@Component({\n\tselector: 'brn-checkbox',\n\ttemplate: `\n\t\t<button\n\t\t\t#checkBox\n\t\t\trole=\"checkbox\"\n\t\t\ttype=\"button\"\n\t\t\t[id]=\"getCheckboxButtonId(_state().id) ?? ''\"\n\t\t\t[name]=\"getCheckboxButtonId(_state().name) ?? ''\"\n\t\t\t[class]=\"class()\"\n\t\t\t[attr.aria-checked]=\"_ariaChecked()\"\n\t\t\t[attr.aria-label]=\"ariaLabel() || null\"\n\t\t\t[attr.aria-labelledby]=\"mutableAriaLabelledby() || null\"\n\t\t\t[attr.aria-describedby]=\"ariaDescribedby() || null\"\n\t\t\t[attr.data-state]=\"_dataState()\"\n\t\t\t[attr.data-focus-visible]=\"_focusVisible()\"\n\t\t\t[attr.data-focus]=\"_focused()\"\n\t\t\t[attr.data-disabled]=\"_state().disabled()\"\n\t\t\t[disabled]=\"_state().disabled()\"\n\t\t\t[tabIndex]=\"_state().disabled() ? -1 : 0\"\n\t\t\t(click)=\"$event.preventDefault(); toggle()\"\n\t\t>\n\t\t\t<ng-content />\n\t\t</button>\n\t`,\n\thost: {\n\t\t'[style]': '{display: \"contents\"}',\n\t\t'[attr.id]': '_state().id',\n\t\t'[attr.name]': '_state().name',\n\t\t'[attr.aria-labelledby]': 'null',\n\t\t'[attr.aria-label]': 'null',\n\t\t'[attr.aria-describedby]': 'null',\n\t\t'[attr.data-state]': '_dataState()',\n\t\t'[attr.data-focus-visible]': '_focusVisible()',\n\t\t'[attr.data-focus]': '_focused()',\n\t\t'[attr.data-disabled]': '_state().disabled()',\n\t},\n\tproviders: [BRN_CHECKBOX_VALUE_ACCESSOR],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnCheckbox implements ControlValueAccessor, AfterContentInit, OnDestroy {\n\tprivate readonly _destroyRef = inject(DestroyRef);\n\tprivate readonly _renderer = inject(Renderer2);\n\tprivate readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\tprivate readonly _focusMonitor = inject(FocusMonitor);\n\tprivate readonly _cdr = inject(ChangeDetectorRef);\n\tprivate readonly _document = inject(DOCUMENT);\n\tprivate readonly _isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n\tprotected readonly _focusVisible = signal(false);\n\tprotected readonly _focused = signal(false);\n\n\t/**\n\t * Current checked state of checkbox.\n\t * Can be boolean (true/false) or 'indeterminate'.\n\t * Can be bound with [(checked)] for two-way binding.\n\t */\n\tpublic readonly checked = model<BrnCheckboxValue>(false);\n\n\t/**\n\t * Read-only signal of current checkbox state.\n\t * Use this when you only need to read state without changing it.\n\t */\n\tpublic readonly isChecked = this.checked.asReadonly();\n\n\t/**\n\t * Computed data-state attribute value based on checked state.\n\t * Returns 'checked', 'unchecked', or 'indeterminate'.\n\t */\n\tprotected readonly _dataState = computed(() => {\n\t\tconst checked = this.checked();\n\t\tif (checked === 'indeterminate') return 'indeterminate';\n\t\treturn checked ? 'checked' : 'unchecked';\n\t});\n\n\t/**\n\t * Computed aria-checked attribute value for accessibility.\n\t * Returns 'true', 'false', or 'mixed' (for indeterminate).\n\t */\n\tprotected readonly _ariaChecked = computed(() => {\n\t\tconst checked = this.checked();\n\t\tif (checked === 'indeterminate') return 'mixed';\n\t\treturn checked ? 'true' : 'false';\n\t});\n\n\t/**\n\t * Unique identifier for checkbox component.\n\t * When provided, inner button gets ID without '-checkbox' suffix.\n\t * Auto-generates ID if not provided.\n\t */\n\tpublic readonly id = input<string | null>(++uniqueIdCounter + '');\n\n\t/**\n\t * Form control name for checkbox.\n\t * When provided, inner button gets name without '-checkbox' suffix.\n\t */\n\tpublic readonly name = input<string | null>(null);\n\n\t/**\n\t * CSS classes applied to inner button element.\n\t */\n\tpublic readonly class = input<string | null>(null);\n\n\t/**\n\t * Accessibility label for screen readers.\n\t * Use when no visible label exists.\n\t */\n\tpublic readonly ariaLabel = input<string | null>(null, { alias: 'aria-label' });\n\n\t/**\n\t * ID of element that labels this checkbox for accessibility.\n\t * Auto-set when checkbox is inside label element.\n\t */\n\tpublic readonly ariaLabelledby = input<string | null>(null, { alias: 'aria-labelledby' });\n\tpublic readonly mutableAriaLabelledby = linkedSignal(() => this.ariaLabelledby());\n\n\t/**\n\t * ID of element that describes this checkbox for accessibility.\n\t */\n\tpublic readonly ariaDescribedby = input<string | null>(null, { alias: 'aria-describedby' });\n\n\t/**\n\t * Whether checkbox is required in a form.\n\t */\n\tpublic readonly required = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Whether checkbox is disabled.\n\t * Disabled checkboxes cannot be toggled and indicate disabled state through data-disabled attribute.\n\t */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Computed state for checkbox container and accessibility.\n\t * Manages ID, name, and disabled state.\n\t */\n\tprotected readonly _state = computed(() => {\n\t\tconst name = this.name();\n\t\tconst id = this.id();\n\t\treturn {\n\t\t\tdisabled: signal(this.disabled()),\n\t\t\tname: name ? name + CONTAINER_POST_FIX : null,\n\t\t\tid: id ? id + CONTAINER_POST_FIX : null,\n\t\t};\n\t});\n\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprotected _onChange: ChangeFn<BrnCheckboxValue> = () => {};\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprivate _onTouched: TouchFn = () => {};\n\n\t/**\n\t * Reference to the checkbox button element in the template.\n\t */\n\tpublic readonly checkbox = viewChild.required<ElementRef<HTMLButtonElement>>('checkBox');\n\n\t/**\n\t * Event emitted when checkbox value changes.\n\t * Emits new checked state (true/false/'indeterminate').\n\t */\n\tpublic readonly changed = output<BrnCheckboxValue>();\n\n\t/**\n\t * Event emitted when checkbox is blurred (loses focus).\n\t * Used for form validation.\n\t */\n\tpublic readonly touched = output<void>();\n\n\tconstructor() {\n\t\teffect(() => {\n\t\t\tconst state = this._state();\n\t\t\tconst isDisabled = state.disabled();\n\n\t\t\tif (!this._elementRef.nativeElement || !this._isBrowser) return;\n\n\t\t\tconst newLabelId = state.id + '-label';\n\t\t\tconst checkboxButtonId = this.getCheckboxButtonId(state.id);\n\t\t\tconst labelElement =\n\t\t\t\tthis._elementRef.nativeElement.closest('label') ??\n\t\t\t\tthis._document.querySelector(`label[for=\"${checkboxButtonId}\"]`);\n\n\t\t\tif (!labelElement) return;\n\t\t\tconst existingLabelId = labelElement.id;\n\n\t\t\tthis._renderer.setAttribute(labelElement, 'data-disabled', isDisabled ? 'true' : 'false');\n\t\t\tthis.mutableAriaLabelledby.set(existingLabelId || newLabelId);\n\n\t\t\tif (!existingLabelId || existingLabelId.length === 0) {\n\t\t\t\tthis._renderer.setAttribute(labelElement, 'id', newLabelId);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Toggles checkbox between checked/unchecked states.\n\t * If checkbox is indeterminate, sets to checked.\n\t * Does nothing if checkbox is disabled.\n\t */\n\ttoggle() {\n\t\tif (this._state().disabled()) return;\n\n\t\tthis._onTouched();\n\t\tthis.touched.emit();\n\n\t\tconst previousChecked = this.checked();\n\t\tthis.checked.set(previousChecked === 'indeterminate' ? true : !previousChecked);\n\t\tthis._onChange(this.checked());\n\t\tthis.changed.emit(this.checked());\n\t}\n\n\tngAfterContentInit() {\n\t\tthis._focusMonitor\n\t\t\t.monitor(this._elementRef, true)\n\t\t\t.pipe(takeUntilDestroyed(this._destroyRef))\n\t\t\t.subscribe((focusOrigin) => {\n\t\t\t\tif (focusOrigin) this._focused.set(true);\n\t\t\t\tif (focusOrigin === 'keyboard' || focusOrigin === 'program') {\n\t\t\t\t\tthis._focusVisible.set(true);\n\t\t\t\t\tthis._cdr.markForCheck();\n\t\t\t\t}\n\t\t\t\tif (!focusOrigin) {\n\t\t\t\t\t// When a focused element becomes disabled, the browser *immediately* fires a blur event.\n\t\t\t\t\t// Angular does not expect events to be raised during change detection, so any state\n\t\t\t\t\t// change (such as a form control's ng-touched) will cause a changed-after-checked error.\n\t\t\t\t\t// See https://github.com/angular/angular/issues/17793. To work around this, we defer\n\t\t\t\t\t// telling the form control it has been touched until the next tick.\n\t\t\t\t\tPromise.resolve().then(() => {\n\t\t\t\t\t\tthis._focusVisible.set(false);\n\t\t\t\t\t\tthis._focused.set(false);\n\t\t\t\t\t\tthis._onTouched();\n\t\t\t\t\t\tthis.touched.emit();\n\t\t\t\t\t\tthis._cdr.markForCheck();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\tngOnDestroy() {\n\t\tthis._focusMonitor.stopMonitoring(this._elementRef);\n\t}\n\n\t/**\n\t * Gets proper ID for inner button element.\n\t * Removes '-checkbox' suffix if present in container ID.\n\t *\n\t * @param idPassedToContainer - ID applied to container element\n\t * @returns ID to use for inner button or null\n\t */\n\tprotected getCheckboxButtonId(idPassedToContainer: string | null | undefined): string | null {\n\t\treturn idPassedToContainer ? idPassedToContainer.replace(CONTAINER_POST_FIX, '') : null;\n\t}\n\n\t/**\n\t * Updates internal state when control value changes from outside.\n\t * Handles boolean and 'indeterminate' values.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param value - New checkbox state (true/false/'indeterminate')\n\t */\n\twriteValue(value: BrnCheckboxValue): void {\n\t\tif (value === 'indeterminate') {\n\t\t\tthis.checked.set('indeterminate');\n\t\t} else {\n\t\t\tthis.checked.set(value);\n\t\t}\n\t}\n\n\t/**\n\t * Registers callback for value changes.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param fn - Function to call when value changes\n\t */\n\tregisterOnChange(fn: ChangeFn<BrnCheckboxValue>): void {\n\t\tthis._onChange = fn;\n\t}\n\n\t/**\n\t * Registers callback for touched events.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param fn - Function to call when control is touched\n\t */\n\tregisterOnTouched(fn: TouchFn): void {\n\t\tthis._onTouched = fn;\n\t}\n\n\t/**\n\t * Updates disabled state from form control.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param isDisabled - Whether checkbox should be disabled\n\t */\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis._state().disabled.set(isDisabled);\n\t\tthis._cdr.markForCheck();\n\t}\n}\n\ntype BrnCheckboxValue = boolean | 'indeterminate';\n","import { NgModule } from '@angular/core';\n\nimport { BrnCheckbox } from './lib/brn-checkbox';\n\nexport * from './lib/brn-checkbox';\n\nexport const BrnCheckboxImports = [BrnCheckbox] as const;\n\n@NgModule({\n\timports: [...BrnCheckboxImports],\n\texports: [...BrnCheckboxImports],\n})\nexport class BrnCheckboxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AA6BO,MAAM,2BAA2B,GAAG;AAC1C,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,WAAW,CAAC;AAC1C,IAAA,KAAK,EAAE,IAAI;;AAGZ,IAAI,eAAe,GAAG,CAAC;AAEvB,MAAM,kBAAkB,GAAG,WAAW;MA0CzB,WAAW,CAAA;AACN,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAChC,IAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC7B,IAAA,WAAW,GAAG,MAAM,CAA0B,UAAU,CAAC;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iB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;2HAAjB,iBAAiB,EAAA,OAAA,EAAA,CANK,WAAW,CAAA,EAAA,OAAA,EAAA,CAAX,WAAW,CAAA,EAAA,CAAA;2HAMjC,iBAAiB,EAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE,CAAC,GAAG,kBAAkB,CAAC;AAChC,oBAAA,OAAO,EAAE,CAAC,GAAG,kBAAkB,CAAC;AAChC,iBAAA;;;ACXD;;AAEG;;;;"}
1
+ {"version":3,"file":"spartan-ng-brain-checkbox.mjs","sources":["../../../../libs/brain/checkbox/src/lib/brn-checkbox.ts","../../../../libs/brain/checkbox/src/index.ts","../../../../libs/brain/checkbox/src/spartan-ng-brain-checkbox.ts"],"sourcesContent":["import { FocusMonitor } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n\ttype AfterContentInit,\n\tChangeDetectionStrategy,\n\tChangeDetectorRef,\n\tComponent,\n\tDestroyRef,\n\tElementRef,\n\ttype OnDestroy,\n\tPLATFORM_ID,\n\tRenderer2,\n\tbooleanAttribute,\n\tcomputed,\n\teffect,\n\tforwardRef,\n\tinject,\n\tinput,\n\tlinkedSignal,\n\tmodel,\n\toutput,\n\tsignal,\n\tviewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';\n\nexport const BRN_CHECKBOX_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnCheckbox),\n\tmulti: true,\n};\n\nlet uniqueIdCounter = 0;\n\nconst CONTAINER_POST_FIX = '-checkbox';\n\n@Component({\n\tselector: 'brn-checkbox',\n\ttemplate: `\n\t\t<button\n\t\t\t#checkBox\n\t\t\trole=\"checkbox\"\n\t\t\ttype=\"button\"\n\t\t\t[id]=\"getCheckboxButtonId(_state().id) ?? ''\"\n\t\t\t[name]=\"getCheckboxButtonId(_state().name) ?? ''\"\n\t\t\t[class]=\"class()\"\n\t\t\t[attr.aria-checked]=\"_ariaChecked()\"\n\t\t\t[attr.aria-label]=\"ariaLabel() || null\"\n\t\t\t[attr.aria-labelledby]=\"mutableAriaLabelledby() || null\"\n\t\t\t[attr.aria-describedby]=\"ariaDescribedby() || null\"\n\t\t\t[attr.data-state]=\"_dataState()\"\n\t\t\t[attr.data-focus-visible]=\"_focusVisible()\"\n\t\t\t[attr.data-focus]=\"_focused()\"\n\t\t\t[attr.data-disabled]=\"_state().disabled()\"\n\t\t\t[disabled]=\"_state().disabled()\"\n\t\t\t[tabIndex]=\"_state().disabled() ? -1 : 0\"\n\t\t\t(click)=\"$event.preventDefault(); toggle()\"\n\t\t>\n\t\t\t<ng-content />\n\t\t</button>\n\t`,\n\thost: {\n\t\t'[style]': '{display: \"contents\"}',\n\t\t'[attr.id]': '_state().id',\n\t\t'[attr.name]': '_state().name',\n\t\t'[attr.aria-labelledby]': 'null',\n\t\t'[attr.aria-label]': 'null',\n\t\t'[attr.aria-describedby]': 'null',\n\t\t'[attr.data-state]': '_dataState()',\n\t\t'[attr.data-focus-visible]': '_focusVisible()',\n\t\t'[attr.data-focus]': '_focused()',\n\t\t'[attr.data-disabled]': '_state().disabled()',\n\t},\n\tproviders: [BRN_CHECKBOX_VALUE_ACCESSOR],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnCheckbox implements ControlValueAccessor, AfterContentInit, OnDestroy {\n\tprivate readonly _destroyRef = inject(DestroyRef);\n\tprivate readonly _renderer = inject(Renderer2);\n\tprivate readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\tprivate readonly _focusMonitor = inject(FocusMonitor);\n\tprivate readonly _cdr = inject(ChangeDetectorRef);\n\tprivate readonly _document = inject(DOCUMENT);\n\tprivate readonly _isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n\tprotected readonly _focusVisible = signal(false);\n\tprotected readonly _focused = signal(false);\n\n\t/**\n\t * Current checked state of checkbox.\n\t * Can be boolean (true/false) or 'indeterminate'.\n\t * Can be bound with [(checked)] for two-way binding.\n\t */\n\tpublic readonly checked = model<BrnCheckboxValue>(false);\n\n\t/** Emits when checked state changes. */\n\tpublic readonly checkedChange = output<BrnCheckboxValue>();\n\n\t/**\n\t * Read-only signal of current checkbox state.\n\t * Use this when you only need to read state without changing it.\n\t */\n\tpublic readonly isChecked = this.checked.asReadonly();\n\n\t/**\n\t * Computed data-state attribute value based on checked state.\n\t * Returns 'checked', 'unchecked', or 'indeterminate'.\n\t */\n\tprotected readonly _dataState = computed(() => {\n\t\tconst checked = this.checked();\n\t\tif (checked === 'indeterminate') return 'indeterminate';\n\t\treturn checked ? 'checked' : 'unchecked';\n\t});\n\n\t/**\n\t * Computed aria-checked attribute value for accessibility.\n\t * Returns 'true', 'false', or 'mixed' (for indeterminate).\n\t */\n\tprotected readonly _ariaChecked = computed(() => {\n\t\tconst checked = this.checked();\n\t\tif (checked === 'indeterminate') return 'mixed';\n\t\treturn checked ? 'true' : 'false';\n\t});\n\n\t/**\n\t * Unique identifier for checkbox component.\n\t * When provided, inner button gets ID without '-checkbox' suffix.\n\t * Auto-generates ID if not provided.\n\t */\n\tpublic readonly id = input<string | null>(++uniqueIdCounter + '');\n\n\t/**\n\t * Form control name for checkbox.\n\t * When provided, inner button gets name without '-checkbox' suffix.\n\t */\n\tpublic readonly name = input<string | null>(null);\n\n\t/**\n\t * CSS classes applied to inner button element.\n\t */\n\tpublic readonly class = input<string | null>(null);\n\n\t/**\n\t * Accessibility label for screen readers.\n\t * Use when no visible label exists.\n\t */\n\tpublic readonly ariaLabel = input<string | null>(null, { alias: 'aria-label' });\n\n\t/**\n\t * ID of element that labels this checkbox for accessibility.\n\t * Auto-set when checkbox is inside label element.\n\t */\n\tpublic readonly ariaLabelledby = input<string | null>(null, { alias: 'aria-labelledby' });\n\tpublic readonly mutableAriaLabelledby = linkedSignal(() => this.ariaLabelledby());\n\n\t/**\n\t * ID of element that describes this checkbox for accessibility.\n\t */\n\tpublic readonly ariaDescribedby = input<string | null>(null, { alias: 'aria-describedby' });\n\n\t/**\n\t * Whether checkbox is required in a form.\n\t */\n\tpublic readonly required = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Whether checkbox is disabled.\n\t * Disabled checkboxes cannot be toggled and indicate disabled state through data-disabled attribute.\n\t */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Computed state for checkbox container and accessibility.\n\t * Manages ID, name, and disabled state.\n\t */\n\tprotected readonly _state = computed(() => {\n\t\tconst name = this.name();\n\t\tconst id = this.id();\n\t\treturn {\n\t\t\tdisabled: signal(this.disabled()),\n\t\t\tname: name ? name + CONTAINER_POST_FIX : null,\n\t\t\tid: id ? id + CONTAINER_POST_FIX : null,\n\t\t};\n\t});\n\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprotected _onChange: ChangeFn<BrnCheckboxValue> = () => {};\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprivate _onTouched: TouchFn = () => {};\n\n\t/**\n\t * Reference to the checkbox button element in the template.\n\t */\n\tpublic readonly checkbox = viewChild.required<ElementRef<HTMLButtonElement>>('checkBox');\n\n\t/**\n\t * Event emitted when checkbox value changes.\n\t * Emits new checked state (true/false/'indeterminate').\n\t */\n\tpublic readonly changed = output<BrnCheckboxValue>();\n\n\t/**\n\t * Event emitted when checkbox is blurred (loses focus).\n\t * Used for form validation.\n\t */\n\tpublic readonly touched = output<void>();\n\n\tconstructor() {\n\t\teffect(() => {\n\t\t\tconst state = this._state();\n\t\t\tconst isDisabled = state.disabled();\n\n\t\t\tif (!this._elementRef.nativeElement || !this._isBrowser) return;\n\n\t\t\tconst newLabelId = state.id + '-label';\n\t\t\tconst checkboxButtonId = this.getCheckboxButtonId(state.id);\n\t\t\tconst labelElement =\n\t\t\t\tthis._elementRef.nativeElement.closest('label') ??\n\t\t\t\tthis._document.querySelector(`label[for=\"${checkboxButtonId}\"]`);\n\n\t\t\tif (!labelElement) return;\n\t\t\tconst existingLabelId = labelElement.id;\n\n\t\t\tthis._renderer.setAttribute(labelElement, 'data-disabled', isDisabled ? 'true' : 'false');\n\t\t\tthis.mutableAriaLabelledby.set(existingLabelId || newLabelId);\n\n\t\t\tif (!existingLabelId || existingLabelId.length === 0) {\n\t\t\t\tthis._renderer.setAttribute(labelElement, 'id', newLabelId);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Toggles checkbox between checked/unchecked states.\n\t * If checkbox is indeterminate, sets to checked.\n\t * Does nothing if checkbox is disabled.\n\t */\n\ttoggle() {\n\t\tif (this._state().disabled()) return;\n\n\t\tthis._onTouched();\n\t\tthis.touched.emit();\n\n\t\tconst previousChecked = this.checked();\n\t\tthis.checked.set(previousChecked === 'indeterminate' ? true : !previousChecked);\n\t\tthis._onChange(this.checked());\n\t\tthis.changed.emit(this.checked());\n\t\tthis.checkedChange.emit(this.checked());\n\t}\n\n\tngAfterContentInit() {\n\t\tthis._focusMonitor\n\t\t\t.monitor(this._elementRef, true)\n\t\t\t.pipe(takeUntilDestroyed(this._destroyRef))\n\t\t\t.subscribe((focusOrigin) => {\n\t\t\t\tif (focusOrigin) this._focused.set(true);\n\t\t\t\tif (focusOrigin === 'keyboard' || focusOrigin === 'program') {\n\t\t\t\t\tthis._focusVisible.set(true);\n\t\t\t\t\tthis._cdr.markForCheck();\n\t\t\t\t}\n\t\t\t\tif (!focusOrigin) {\n\t\t\t\t\t// When a focused element becomes disabled, the browser *immediately* fires a blur event.\n\t\t\t\t\t// Angular does not expect events to be raised during change detection, so any state\n\t\t\t\t\t// change (such as a form control's ng-touched) will cause a changed-after-checked error.\n\t\t\t\t\t// See https://github.com/angular/angular/issues/17793. To work around this, we defer\n\t\t\t\t\t// telling the form control it has been touched until the next tick.\n\t\t\t\t\tPromise.resolve().then(() => {\n\t\t\t\t\t\tthis._focusVisible.set(false);\n\t\t\t\t\t\tthis._focused.set(false);\n\t\t\t\t\t\tthis._onTouched();\n\t\t\t\t\t\tthis.touched.emit();\n\t\t\t\t\t\tthis._cdr.markForCheck();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\tngOnDestroy() {\n\t\tthis._focusMonitor.stopMonitoring(this._elementRef);\n\t}\n\n\t/**\n\t * Gets proper ID for inner button element.\n\t * Removes '-checkbox' suffix if present in container ID.\n\t *\n\t * @param idPassedToContainer - ID applied to container element\n\t * @returns ID to use for inner button or null\n\t */\n\tprotected getCheckboxButtonId(idPassedToContainer: string | null | undefined): string | null {\n\t\treturn idPassedToContainer ? idPassedToContainer.replace(CONTAINER_POST_FIX, '') : null;\n\t}\n\n\t/**\n\t * Updates internal state when control value changes from outside.\n\t * Handles boolean and 'indeterminate' values.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param value - New checkbox state (true/false/'indeterminate')\n\t */\n\twriteValue(value: BrnCheckboxValue): void {\n\t\tif (value === 'indeterminate') {\n\t\t\tthis.checked.set('indeterminate');\n\t\t} else {\n\t\t\tthis.checked.set(value);\n\t\t}\n\t}\n\n\t/**\n\t * Registers callback for value changes.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param fn - Function to call when value changes\n\t */\n\tregisterOnChange(fn: ChangeFn<BrnCheckboxValue>): void {\n\t\tthis._onChange = fn;\n\t}\n\n\t/**\n\t * Registers callback for touched events.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param fn - Function to call when control is touched\n\t */\n\tregisterOnTouched(fn: TouchFn): void {\n\t\tthis._onTouched = fn;\n\t}\n\n\t/**\n\t * Updates disabled state from form control.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param isDisabled - Whether checkbox should be disabled\n\t */\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis._state().disabled.set(isDisabled);\n\t\tthis._cdr.markForCheck();\n\t}\n}\n\ntype BrnCheckboxValue = boolean | 'indeterminate';\n","import { NgModule } from '@angular/core';\n\nimport { BrnCheckbox } from './lib/brn-checkbox';\n\nexport * from './lib/brn-checkbox';\n\nexport const BrnCheckboxImports = [BrnCheckbox] as const;\n\n@NgModule({\n\timports: [...BrnCheckboxImports],\n\texports: [...BrnCheckboxImports],\n})\nexport class BrnCheckboxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AA6BO,MAAM,2BAA2B,GAAG;AAC1C,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,WAAW,CAAC;AAC1C,IAAA,KAAK,EAAE,IAAI;;AAGZ,IAAI,eAAe,GAAG,CAAC;AAEvB,MAAM,kBAAkB,GAAG,WAAW;MA0CzB,WAAW,CAAA;AACN,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAChC,IAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC7B,IAAA,WAAW,GAAG,MAAM,CAA0B,UAAU,CAAC;AACzD,IAAA,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC;AACpC,IAAA,IAAI,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAChC,IAAA,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC5B,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAEjD,IAAA,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC;AAC7B,IAAA,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC;AAE3C;;;;AAIG;AACa,IAAA,OAAO,GAAG,KAAK,CAAmB,KAAK,CAAC;;IAGxC,aAAa,GAA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7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE,CAAC,GAAG,kBAAkB,CAAC;AAChC,oBAAA,OAAO,EAAE,CAAC,GAAG,kBAAkB,CAAC;AAChC,iBAAA;;;ACXD;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, forwardRef, signal, input, booleanAttribute, numberAttribute, model, computed, output, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
2
+ import { InjectionToken, inject, forwardRef, signal, input, booleanAttribute, numberAttribute, model, output, computed, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
4
  import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
5
5
 
@@ -43,9 +43,11 @@ class BrnInputOtp {
43
43
  */
44
44
  transformPaste = input((text) => text);
45
45
  /** The value controlling the input */
46
- value = model('');
46
+ value = model(null);
47
+ /** Emits when the value changes. */
48
+ valueChange = output();
47
49
  context = computed(() => {
48
- const value = this.value();
50
+ const value = this.value() ?? '';
49
51
  const focused = this._focused();
50
52
  const maxLength = this.maxLength();
51
53
  const slots = Array.from({ length: this.maxLength() }).map((_, slotIndex) => {
@@ -85,10 +87,10 @@ class BrnInputOtp {
85
87
  }
86
88
  /** CONTROL VALUE ACCESSOR */
87
89
  writeValue(value) {
88
- // optional FormControl is initialized with null value
89
- if (value === null)
90
- return;
91
- this.updateValue(value, this.maxLength());
90
+ this.value.set(value);
91
+ if (value?.length === this.maxLength()) {
92
+ this.completed.emit(value ?? '');
93
+ }
92
94
  }
93
95
  registerOnChange(fn) {
94
96
  this._onChange = fn;
@@ -103,7 +105,7 @@ class BrnInputOtp {
103
105
  return newValue !== previousValue && previousValue.length < maxLength && newValue.length === maxLength;
104
106
  }
105
107
  updateValue(newValue, maxLength) {
106
- const previousValue = this.value();
108
+ const previousValue = this.value() ?? '';
107
109
  this.value.set(newValue);
108
110
  this._onChange?.(newValue);
109
111
  if (this.isCompleted(newValue, previousValue, maxLength)) {
@@ -111,7 +113,7 @@ class BrnInputOtp {
111
113
  }
112
114
  }
113
115
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnInputOtp, deps: [], target: i0.ɵɵFactoryTarget.Component });
114
- /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: BrnInputOtp, isStandalone: true, selector: "brn-input-otp", inputs: { hostStyles: { classPropertyName: "hostStyles", publicName: "hostStyles", isSignal: true, isRequired: false, transformFunction: null }, inputStyles: { classPropertyName: "inputStyles", publicName: "inputStyles", isSignal: true, isRequired: false, transformFunction: null }, containerStyles: { classPropertyName: "containerStyles", publicName: "containerStyles", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: true, transformFunction: null }, inputMode: { classPropertyName: "inputMode", publicName: "inputMode", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, transformPaste: { classPropertyName: "transformPaste", publicName: "transformPaste", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", completed: "completed" }, host: { attributes: { "data-input-otp-container": "true" }, properties: { "style": "hostStyles()" } }, providers: [BRN_INPUT_OTP_VALUE_ACCESSOR, provideBrnInputOtp(BrnInputOtp)], ngImport: i0, template: `
116
+ /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: BrnInputOtp, isStandalone: true, selector: "brn-input-otp", inputs: { hostStyles: { classPropertyName: "hostStyles", publicName: "hostStyles", isSignal: true, isRequired: false, transformFunction: null }, inputStyles: { classPropertyName: "inputStyles", publicName: "inputStyles", isSignal: true, isRequired: false, transformFunction: null }, containerStyles: { classPropertyName: "containerStyles", publicName: "containerStyles", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: true, transformFunction: null }, inputMode: { classPropertyName: "inputMode", publicName: "inputMode", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, transformPaste: { classPropertyName: "transformPaste", publicName: "transformPaste", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", valueChange: "valueChange", completed: "completed" }, host: { attributes: { "data-input-otp-container": "true" }, properties: { "style": "hostStyles()" } }, providers: [BRN_INPUT_OTP_VALUE_ACCESSOR, provideBrnInputOtp(BrnInputOtp)], ngImport: i0, template: `
115
117
  <ng-content />
116
118
  <div [style]="containerStyles()">
117
119
  <input
@@ -1 +1 @@
1
- {"version":3,"file":"spartan-ng-brain-input-otp.mjs","sources":["../../../../libs/brain/input-otp/src/lib/brn-input-otp.token.ts","../../../../libs/brain/input-otp/src/lib/brn-input-otp.ts","../../../../libs/brain/input-otp/src/lib/brn-input-otp-slot.ts","../../../../libs/brain/input-otp/src/index.ts","../../../../libs/brain/input-otp/src/spartan-ng-brain-input-otp.ts"],"sourcesContent":["import { ExistingProvider, inject, InjectionToken, Type } from '@angular/core';\nimport { BrnInputOtp } from './brn-input-otp';\n\nexport const BrnInputOtpToken = new InjectionToken<BrnInputOtp>('BrnInputOtpToken');\n\nexport function injectBrnInputOtp(): BrnInputOtp {\n\treturn inject(BrnInputOtpToken) as BrnInputOtp;\n}\n\nexport function provideBrnInputOtp(inputOtp: Type<BrnInputOtp>): ExistingProvider {\n\treturn { provide: BrnInputOtpToken, useExisting: inputOtp };\n}\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n\tbooleanAttribute,\n\tChangeDetectionStrategy,\n\tComponent,\n\tcomputed,\n\tforwardRef,\n\tinput,\n\tmodel,\n\tnumberAttribute,\n\toutput,\n\tsignal,\n} from '@angular/core';\nimport { type ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';\nimport { type ClassValue } from 'clsx';\nimport { provideBrnInputOtp } from './brn-input-otp.token';\n\nexport const BRN_INPUT_OTP_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnInputOtp),\n\tmulti: true,\n};\n\nexport type InputMode = 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n\n@Component({\n\tselector: 'brn-input-otp',\n\timports: [FormsModule],\n\ttemplate: `\n\t\t<ng-content />\n\t\t<div [style]=\"containerStyles()\">\n\t\t\t<input\n\t\t\t\t[class]=\"inputClass()\"\n\t\t\t\tautocomplete=\"one-time-code\"\n\t\t\t\tdata-slot=\"input-otp\"\n\t\t\t\t[style]=\"inputStyles()\"\n\t\t\t\t[disabled]=\"_state().disabled()\"\n\t\t\t\t[inputMode]=\"inputMode()\"\n\t\t\t\t[ngModel]=\"value()\"\n\t\t\t\t(input)=\"onInputChange($event)\"\n\t\t\t\t(paste)=\"onPaste($event)\"\n\t\t\t\t(focus)=\"_focused.set(true)\"\n\t\t\t\t(blur)=\"_focused.set(false)\"\n\t\t\t/>\n\t\t</div>\n\t`,\n\thost: {\n\t\t'[style]': 'hostStyles()',\n\t\t'data-input-otp-container': 'true',\n\t},\n\tproviders: [BRN_INPUT_OTP_VALUE_ACCESSOR, provideBrnInputOtp(BrnInputOtp)],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnInputOtp implements ControlValueAccessor {\n\t/** Whether the input has focus. */\n\tprotected readonly _focused = signal<boolean>(false);\n\n\t/** Styles applied to the host element. */\n\tpublic readonly hostStyles = input<string>(\n\t\t'position: relative; cursor: text; user-select: none; pointer-events: none;',\n\t);\n\n\t/** Styles applied to the input element to make it invisible and clickable. */\n\tpublic readonly inputStyles = input<string>(\n\t\t'position: absolute; inset: 0; width: 100%; height: 100%; display: flex; textAlign: left; opacity: 1; color: transparent; pointerEvents: all; background: transparent; caret-color: transparent; border: 0px solid transparent; outline: transparent solid 0px; box-shadow: none; line-height: 1; letter-spacing: -0.5em; font-family: monospace; font-variant-numeric: tabular-nums;',\n\t);\n\n\t/** Styles applied to the container element. */\n\tpublic readonly containerStyles = input<string>('position: absolute; inset: 0; pointer-events: none;');\n\n\t/** Determine if the date picker is disabled. */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/** The number of slots. */\n\tpublic readonly maxLength = input.required<number, NumberInput>({ transform: numberAttribute });\n\n\t/** Virtual keyboard appearance on mobile */\n\tpublic readonly inputMode = input<InputMode>('numeric');\n\n\tpublic readonly inputClass = input<ClassValue>('');\n\n\t/**\n\t * Defines how the pasted text should be transformed before saving to model/form.\n\t * Allows pasting text which contains extra characters like spaces, dashes, etc. and are longer than the maxLength.\n\t *\n\t * \"XXX-XXX\": (pastedText) => pastedText.replaceAll('-', '')\n\t * \"XXX XXX\": (pastedText) => pastedText.replaceAll(/\\s+/g, '')\n\t */\n\tpublic readonly transformPaste = input<(pastedText: string, maxLength: number) => string>((text) => text);\n\n\t/** The value controlling the input */\n\tpublic readonly value = model<string>('');\n\n\tpublic readonly context = computed(() => {\n\t\tconst value = this.value();\n\t\tconst focused = this._focused();\n\t\tconst maxLength = this.maxLength();\n\t\tconst slots = Array.from({ length: this.maxLength() }).map((_, slotIndex) => {\n\t\t\tconst char = value[slotIndex] !== undefined ? value[slotIndex] : null;\n\n\t\t\tconst isActive =\n\t\t\t\tfocused && (value.length === slotIndex || (value.length === maxLength && slotIndex === maxLength - 1));\n\n\t\t\treturn {\n\t\t\t\tchar,\n\t\t\t\tisActive,\n\t\t\t\thasFakeCaret: isActive && value.length === slotIndex,\n\t\t\t};\n\t\t});\n\n\t\treturn slots;\n\t});\n\n\t/** Emitted when the input is complete, triggered through input or paste. */\n\tpublic readonly completed = output<string>();\n\n\tprotected readonly _state = computed(() => ({\n\t\tdisabled: signal(this.disabled()),\n\t}));\n\n\tprotected _onChange?: ChangeFn<string>;\n\tprotected _onTouched?: TouchFn;\n\n\tprotected onInputChange(event: Event) {\n\t\tlet newValue = (event.target as HTMLInputElement).value;\n\t\tconst maxLength = this.maxLength();\n\n\t\tif (newValue.length > maxLength) {\n\t\t\t// Replace the last character when max length is exceeded\n\t\t\tnewValue = newValue.slice(0, maxLength - 1) + newValue.slice(-1);\n\t\t}\n\n\t\tthis.updateValue(newValue, maxLength);\n\t}\n\n\tprotected onPaste(event: ClipboardEvent) {\n\t\tevent.preventDefault();\n\t\tconst clipboardData = event.clipboardData?.getData('text/plain') || '';\n\n\t\tconst maxLength = this.maxLength();\n\n\t\tconst content = this.transformPaste()(clipboardData, maxLength);\n\t\tconst newValue = content.slice(0, maxLength);\n\n\t\tthis.updateValue(newValue, maxLength);\n\t}\n\n\t/** CONTROL VALUE ACCESSOR */\n\twriteValue(value: string | null): void {\n\t\t// optional FormControl is initialized with null value\n\t\tif (value === null) return;\n\n\t\tthis.updateValue(value, this.maxLength());\n\t}\n\n\tregisterOnChange(fn: ChangeFn<string>): void {\n\t\tthis._onChange = fn;\n\t}\n\n\tregisterOnTouched(fn: TouchFn): void {\n\t\tthis._onTouched = fn;\n\t}\n\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis._state().disabled.set(isDisabled);\n\t}\n\n\tprivate isCompleted(newValue: string, previousValue: string, maxLength: number) {\n\t\treturn newValue !== previousValue && previousValue.length < maxLength && newValue.length === maxLength;\n\t}\n\n\tprivate updateValue(newValue: string, maxLength: number) {\n\t\tconst previousValue = this.value();\n\n\t\tthis.value.set(newValue);\n\t\tthis._onChange?.(newValue);\n\n\t\tif (this.isCompleted(newValue, previousValue, maxLength)) {\n\t\t\tthis.completed.emit(newValue);\n\t\t}\n\t}\n}\n","import { NumberInput } from '@angular/cdk/coercion';\nimport { ChangeDetectionStrategy, Component, computed, input, numberAttribute } from '@angular/core';\nimport { injectBrnInputOtp } from './brn-input-otp.token';\n\n@Component({\n\tselector: 'brn-input-otp-slot',\n\ttemplate: `\n\t\t{{ _slot().char }}\n\n\t\t@if (_slot().hasFakeCaret) {\n\t\t\t<ng-content />\n\t\t}\n\t`,\n\thost: {\n\t\t'[attr.data-active]': '_slot().isActive',\n\t},\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnInputOtpSlot {\n\t/** Access the input-otp component */\n\tprotected readonly _inputOtp = injectBrnInputOtp();\n\n\t/** The index of the slot to render the char or a fake caret */\n\tpublic readonly index = input.required<number, NumberInput>({ transform: numberAttribute });\n\n\tprotected readonly _slot = computed(() => this._inputOtp.context()[this.index()]);\n}\n","import { NgModule } from '@angular/core';\nimport { BrnInputOtp } from './lib/brn-input-otp';\nimport { BrnInputOtpSlot } from './lib/brn-input-otp-slot';\n\nexport * from './lib/brn-input-otp';\nexport * from './lib/brn-input-otp-slot';\n\nexport const BrnInputOtpImports = [BrnInputOtp, BrnInputOtpSlot] as const;\n\n@NgModule({\n\timports: [...BrnInputOtpImports],\n\texports: [...BrnInputOtpImports],\n})\nexport class BrnInputOtpModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAGO,MAAM,gBAAgB,GAAG,IAAI,cAAc,CAAc,kBAAkB,CAAC;SAEnE,iBAAiB,GAAA;AAChC,IAAA,OAAO,MAAM,CAAC,gBAAgB,CAAgB;AAC/C;AAEM,SAAU,kBAAkB,CAAC,QAA2B,EAAA;IAC7D,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAA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../../libs/brain/input-otp/src/lib/brn-input-otp.token.ts","../../../../libs/brain/input-otp/src/lib/brn-input-otp.ts","../../../../libs/brain/input-otp/src/lib/brn-input-otp-slot.ts","../../../../libs/brain/input-otp/src/index.ts","../../../../libs/brain/input-otp/src/spartan-ng-brain-input-otp.ts"],"sourcesContent":["import { ExistingProvider, inject, InjectionToken, Type } from '@angular/core';\nimport { BrnInputOtp } from './brn-input-otp';\n\nexport const BrnInputOtpToken = new InjectionToken<BrnInputOtp>('BrnInputOtpToken');\n\nexport function injectBrnInputOtp(): BrnInputOtp {\n\treturn inject(BrnInputOtpToken) as BrnInputOtp;\n}\n\nexport function provideBrnInputOtp(inputOtp: Type<BrnInputOtp>): ExistingProvider {\n\treturn { provide: BrnInputOtpToken, useExisting: inputOtp };\n}\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n\tbooleanAttribute,\n\tChangeDetectionStrategy,\n\tComponent,\n\tcomputed,\n\tforwardRef,\n\tinput,\n\tmodel,\n\tnumberAttribute,\n\toutput,\n\tsignal,\n} from '@angular/core';\nimport { type ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';\nimport { type ClassValue } from 'clsx';\nimport { provideBrnInputOtp } from './brn-input-otp.token';\n\nexport const BRN_INPUT_OTP_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnInputOtp),\n\tmulti: true,\n};\n\nexport type InputMode = 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n\n@Component({\n\tselector: 'brn-input-otp',\n\timports: [FormsModule],\n\ttemplate: `\n\t\t<ng-content />\n\t\t<div [style]=\"containerStyles()\">\n\t\t\t<input\n\t\t\t\t[class]=\"inputClass()\"\n\t\t\t\tautocomplete=\"one-time-code\"\n\t\t\t\tdata-slot=\"input-otp\"\n\t\t\t\t[style]=\"inputStyles()\"\n\t\t\t\t[disabled]=\"_state().disabled()\"\n\t\t\t\t[inputMode]=\"inputMode()\"\n\t\t\t\t[ngModel]=\"value()\"\n\t\t\t\t(input)=\"onInputChange($event)\"\n\t\t\t\t(paste)=\"onPaste($event)\"\n\t\t\t\t(focus)=\"_focused.set(true)\"\n\t\t\t\t(blur)=\"_focused.set(false)\"\n\t\t\t/>\n\t\t</div>\n\t`,\n\thost: {\n\t\t'[style]': 'hostStyles()',\n\t\t'data-input-otp-container': 'true',\n\t},\n\tproviders: [BRN_INPUT_OTP_VALUE_ACCESSOR, provideBrnInputOtp(BrnInputOtp)],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnInputOtp implements ControlValueAccessor {\n\t/** Whether the input has focus. */\n\tprotected readonly _focused = signal<boolean>(false);\n\n\t/** Styles applied to the host element. */\n\tpublic readonly hostStyles = input<string>(\n\t\t'position: relative; cursor: text; user-select: none; pointer-events: none;',\n\t);\n\n\t/** Styles applied to the input element to make it invisible and clickable. */\n\tpublic readonly inputStyles = input<string>(\n\t\t'position: absolute; inset: 0; width: 100%; height: 100%; display: flex; textAlign: left; opacity: 1; color: transparent; pointerEvents: all; background: transparent; caret-color: transparent; border: 0px solid transparent; outline: transparent solid 0px; box-shadow: none; line-height: 1; letter-spacing: -0.5em; font-family: monospace; font-variant-numeric: tabular-nums;',\n\t);\n\n\t/** Styles applied to the container element. */\n\tpublic readonly containerStyles = input<string>('position: absolute; inset: 0; pointer-events: none;');\n\n\t/** Determine if the date picker is disabled. */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/** The number of slots. */\n\tpublic readonly maxLength = input.required<number, NumberInput>({ transform: numberAttribute });\n\n\t/** Virtual keyboard appearance on mobile */\n\tpublic readonly inputMode = input<InputMode>('numeric');\n\n\tpublic readonly inputClass = input<ClassValue>('');\n\n\t/**\n\t * Defines how the pasted text should be transformed before saving to model/form.\n\t * Allows pasting text which contains extra characters like spaces, dashes, etc. and are longer than the maxLength.\n\t *\n\t * \"XXX-XXX\": (pastedText) => pastedText.replaceAll('-', '')\n\t * \"XXX XXX\": (pastedText) => pastedText.replaceAll(/\\s+/g, '')\n\t */\n\tpublic readonly transformPaste = input<(pastedText: string, maxLength: number) => string>((text) => text);\n\n\t/** The value controlling the input */\n\tpublic readonly value = model<string | null>(null);\n\n\t/** Emits when the value changes. */\n\tpublic readonly valueChange = output<string>();\n\n\tpublic readonly context = computed(() => {\n\t\tconst value = this.value() ?? '';\n\t\tconst focused = this._focused();\n\t\tconst maxLength = this.maxLength();\n\t\tconst slots = Array.from({ length: this.maxLength() }).map((_, slotIndex) => {\n\t\t\tconst char = value[slotIndex] !== undefined ? value[slotIndex] : null;\n\n\t\t\tconst isActive =\n\t\t\t\tfocused && (value.length === slotIndex || (value.length === maxLength && slotIndex === maxLength - 1));\n\n\t\t\treturn {\n\t\t\t\tchar,\n\t\t\t\tisActive,\n\t\t\t\thasFakeCaret: isActive && value.length === slotIndex,\n\t\t\t};\n\t\t});\n\n\t\treturn slots;\n\t});\n\n\t/** Emitted when the input is complete, triggered through input or paste. */\n\tpublic readonly completed = output<string>();\n\n\tprotected readonly _state = computed(() => ({\n\t\tdisabled: signal(this.disabled()),\n\t}));\n\n\tprotected _onChange?: ChangeFn<string>;\n\tprotected _onTouched?: TouchFn;\n\n\tprotected onInputChange(event: Event) {\n\t\tlet newValue = (event.target as HTMLInputElement).value;\n\t\tconst maxLength = this.maxLength();\n\n\t\tif (newValue.length > maxLength) {\n\t\t\t// Replace the last character when max length is exceeded\n\t\t\tnewValue = newValue.slice(0, maxLength - 1) + newValue.slice(-1);\n\t\t}\n\n\t\tthis.updateValue(newValue, maxLength);\n\t}\n\n\tprotected onPaste(event: ClipboardEvent) {\n\t\tevent.preventDefault();\n\t\tconst clipboardData = event.clipboardData?.getData('text/plain') || '';\n\n\t\tconst maxLength = this.maxLength();\n\n\t\tconst content = this.transformPaste()(clipboardData, maxLength);\n\t\tconst newValue = content.slice(0, maxLength);\n\n\t\tthis.updateValue(newValue, maxLength);\n\t}\n\n\t/** CONTROL VALUE ACCESSOR */\n\twriteValue(value: string | null): void {\n\t\tthis.value.set(value);\n\t\tif (value?.length === this.maxLength()) {\n\t\t\tthis.completed.emit(value ?? '');\n\t\t}\n\t}\n\n\tregisterOnChange(fn: ChangeFn<string>): void {\n\t\tthis._onChange = fn;\n\t}\n\n\tregisterOnTouched(fn: TouchFn): void {\n\t\tthis._onTouched = fn;\n\t}\n\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis._state().disabled.set(isDisabled);\n\t}\n\n\tprivate isCompleted(newValue: string, previousValue: string, maxLength: number) {\n\t\treturn newValue !== previousValue && previousValue.length < maxLength && newValue.length === maxLength;\n\t}\n\n\tprivate updateValue(newValue: string, maxLength: number) {\n\t\tconst previousValue = this.value() ?? '';\n\n\t\tthis.value.set(newValue);\n\t\tthis._onChange?.(newValue);\n\n\t\tif (this.isCompleted(newValue, previousValue, maxLength)) {\n\t\t\tthis.completed.emit(newValue);\n\t\t}\n\t}\n}\n","import { NumberInput } from '@angular/cdk/coercion';\nimport { ChangeDetectionStrategy, Component, computed, input, numberAttribute } from '@angular/core';\nimport { injectBrnInputOtp } from './brn-input-otp.token';\n\n@Component({\n\tselector: 'brn-input-otp-slot',\n\ttemplate: `\n\t\t{{ _slot().char }}\n\n\t\t@if (_slot().hasFakeCaret) {\n\t\t\t<ng-content />\n\t\t}\n\t`,\n\thost: {\n\t\t'[attr.data-active]': '_slot().isActive',\n\t},\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnInputOtpSlot {\n\t/** Access the input-otp component */\n\tprotected readonly _inputOtp = injectBrnInputOtp();\n\n\t/** The index of the slot to render the char or a fake caret */\n\tpublic readonly index = input.required<number, NumberInput>({ transform: numberAttribute });\n\n\tprotected readonly _slot = computed(() => this._inputOtp.context()[this.index()]);\n}\n","import { NgModule } from '@angular/core';\nimport { BrnInputOtp } from './lib/brn-input-otp';\nimport { BrnInputOtpSlot } from './lib/brn-input-otp-slot';\n\nexport * from './lib/brn-input-otp';\nexport * from './lib/brn-input-otp-slot';\n\nexport const BrnInputOtpImports = [BrnInputOtp, BrnInputOtpSlot] as const;\n\n@NgModule({\n\timports: [...BrnInputOtpImports],\n\texports: [...BrnInputOtpImports],\n})\nexport class BrnInputOtpModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAGO,MAAM,gBAAgB,GAAG,IAAI,cAAc,CAAc,kBAAkB,CAAC;SAEnE,iBAAiB,GAAA;AAChC,IAAA,OAAO,MAAM,CAAC,gBAAgB,CAAgB;AAC/C;AAEM,SAAU,kBAAkB,CAAC,QAA2B,EAAA;IAC7D,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE;AAC5D;;ACOO,MAAM,4BAA4B,GAAG;AAC3C,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,WAAW,CAAC;AAC1C,IAAA,KAAK,EAAE,IAAI;;MAiCC,WAAW,CAAA;;AAEJ,IAAA,QAAQ,GAAG,MAAM,CAAU,KAAK,CAAC;;AAGpC,IAAA,UAAU,GAAG,KAAK,CACjC,4EAA4E,CAC5E;;AAGe,IAAA,WAAW,GAAG,KAAK,CAClC,sXAAsX,CACtX;;AAGe,IAAA,eAAe,GAAG,KAAK,CAAS,qDAAqD,CAAC;;AAGtF,IAAA,QAAQ,GAAG,KAAK,CAAwB,KAAK,EAAE;AAC9D,QAAA,SAAS,EAAE,gBAAgB;AAC3B,KAAA,CAAC;;IAGc,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAsB,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;;AAG/E,IAAA,SAAS,GAAG,KAAK,CAAY,SAAS,CAAC;AAEvC,IAAA,UAAU,GAAG,KAAK,CAAa,EAAE,CAAC;AAElD;;;;;;AAMG;IACa,cAAc,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AAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,YANK,WAAW,EAAE,eAAe,CAAA,EAAA,OAAA,EAAA,CAA5B,WAAW,EAAE,eAAe,CAAA,EAAA,CAAA;AAMlD,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,YANK,WAAW,CAAA,EAAA,CAAA;;2FAMjC,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE,CAAC,GAAG,kBAAkB,CAAC;AAChC,oBAAA,OAAO,EAAE,CAAC,GAAG,kBAAkB,CAAC;AAChC,iBAAA;;;ACZD;;AAEG;;;;"}
@@ -198,6 +198,8 @@ class BrnRadioGroup {
198
198
  * The value of the selected radio button.
199
199
  */
200
200
  value = model();
201
+ /** Emits when the value changes. */
202
+ valueChange = output();
201
203
  /**
202
204
  * Whether the radio group is disabled.
203
205
  */
@@ -249,11 +251,12 @@ class BrnRadioGroup {
249
251
  return;
250
252
  }
251
253
  this.value.set(value);
254
+ this.valueChange.emit(value);
252
255
  this.onChange(value);
253
256
  this.change.emit(new BrnRadioChange(radioButton, value));
254
257
  }
255
258
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnRadioGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
256
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnRadioGroup, isStandalone: true, selector: "[brnRadioGroup]", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", change: "change" }, host: { attributes: { "role": "radiogroup" }, listeners: { "focusout": "onTouched()" }, properties: { "dir": "direction()" } }, providers: [BRN_RADIO_GROUP_CONTROL_VALUE_ACCESSOR, provideBrnRadioGroupToken(BrnRadioGroup)], queries: [{ propertyName: "radioButtons", predicate: BrnRadio, descendants: true, isSignal: true }], ngImport: i0 });
259
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnRadioGroup, isStandalone: true, selector: "[brnRadioGroup]", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", valueChange: "valueChange", change: "change" }, host: { attributes: { "role": "radiogroup" }, listeners: { "focusout": "onTouched()" }, properties: { "dir": "direction()" } }, providers: [BRN_RADIO_GROUP_CONTROL_VALUE_ACCESSOR, provideBrnRadioGroupToken(BrnRadioGroup)], queries: [{ propertyName: "radioButtons", predicate: BrnRadio, descendants: true, isSignal: true }], ngImport: i0 });
257
260
  }
258
261
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnRadioGroup, decorators: [{
259
262
  type: Directive,
@@ -1 +1 @@
1
- {"version":3,"file":"spartan-ng-brain-radio-group.mjs","sources":["../../../../libs/brain/radio-group/src/lib/brn-radio-group.token.ts","../../../../libs/brain/radio-group/src/lib/brn-radio.ts","../../../../libs/brain/radio-group/src/lib/brn-radio-group.ts","../../../../libs/brain/radio-group/src/index.ts","../../../../libs/brain/radio-group/src/spartan-ng-brain-radio-group.ts"],"sourcesContent":["import { ExistingProvider, inject, InjectionToken, Type } from '@angular/core';\nimport type { BrnRadioGroup } from './brn-radio-group';\n\nconst BrnRadioGroupToken = new InjectionToken<BrnRadioGroup<unknown>>('BrnRadioGroupToken');\n\nexport function provideBrnRadioGroupToken<T>(directive: Type<BrnRadioGroup<T>>): ExistingProvider {\n\treturn { provide: BrnRadioGroupToken, useExisting: directive };\n}\n\nexport function injectBrnRadioGroup<T = unknown>(): BrnRadioGroup<T> {\n\treturn inject(BrnRadioGroupToken) as BrnRadioGroup<T>;\n}\n","import { FocusMonitor } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n\tChangeDetectionStrategy,\n\tComponent,\n\tElementRef,\n\ttype OnDestroy,\n\tViewEncapsulation,\n\tbooleanAttribute,\n\tcomputed,\n\tinject,\n\tinput,\n\toutput,\n\tviewChild,\n} from '@angular/core';\nimport { injectBrnRadioGroup } from './brn-radio-group.token';\n\nexport class BrnRadioChange<T> {\n\tconstructor(\n\t\tpublic source: BrnRadio<T>,\n\t\tpublic value: T,\n\t) {}\n}\n\nconst CONTAINER_POST_FIX = '-radio';\n\n@Component({\n\tselector: 'brn-radio',\n\thost: {\n\t\tclass: 'brn-radio',\n\t\t'[attr.id]': '_hostId()',\n\t\t'[class.brn-radio-checked]': '_checked()',\n\t\t'[class.brn-radio-disabled]': '_disabledState()',\n\t\t'[attr.data-checked]': '_checked()',\n\t\t'[attr.data-disabled]': '_disabledState()',\n\t\t'[attr.data-value]': 'value()',\n\t\t// Needs to be removed since it causes some a11y issues (see #21266).\n\t\t'[attr.tabindex]': 'null',\n\t\t'[attr.aria-label]': 'null',\n\t\t'[attr.aria-labelledby]': 'null',\n\t\t'[attr.aria-describedby]': 'null',\n\t\t// Note: under normal conditions focus shouldn't land on this element, however it may be\n\t\t// programmatically set, for example inside of a focus trap, in this case we want to forward\n\t\t// the focus to the native element.\n\t\t'(focus)': '_inputElement().nativeElement.focus()',\n\t},\n\texportAs: 'brnRadio',\n\tencapsulation: ViewEncapsulation.None,\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\ttemplate: `\n\t\t<div data-slot=\"indicator\" (click)=\"onTouchTargetClick($event)\">\n\t\t\t<ng-content select=\"[target],[indicator]\" />\n\t\t</div>\n\t\t<input\n\t\t\t#input\n\t\t\tstyle=\"position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0;\"\n\t\t\ttype=\"radio\"\n\t\t\t[id]=\"id()\"\n\t\t\t[checked]=\"_checked()\"\n\t\t\t[disabled]=\"_disabledState()\"\n\t\t\t[tabIndex]=\"_tabIndex()\"\n\t\t\t[attr.name]=\"_radioGroup.name()\"\n\t\t\t[attr.value]=\"value()\"\n\t\t\t[required]=\"required()\"\n\t\t\t[attr.aria-checked]=\"_checked()\"\n\t\t\t[attr.aria-label]=\"ariaLabel()\"\n\t\t\t[attr.aria-labelledby]=\"ariaLabelledby()\"\n\t\t\t[attr.aria-describedby]=\"ariaDescribedby()\"\n\t\t\t[attr.aria-disabled]=\"_disabledState()\"\n\t\t\t(change)=\"onInputInteraction($event)\"\n\t\t\t(click)=\"onInputClick($event)\"\n\t\t/>\n\t\t<ng-content />\n\t`,\n\tstyles: `\n\t\t[data-slot='indicator'] {\n\t\t\tdisplay: flex;\n\t\t\theight: fit-content;\n\t\t\twidth: fit-content;\n\t\t}\n\n\t\t[data-slot='indicator']:empty {\n\t\t\tdisplay: none;\n\t\t}\n\t`,\n})\nexport class BrnRadio<T = unknown> implements OnDestroy {\n\tprivate static _nextUniqueId = 0;\n\tprivate readonly _focusMonitor = inject(FocusMonitor);\n\tprivate readonly _elementRef = inject(ElementRef);\n\tprotected readonly _radioGroup = injectBrnRadioGroup<T>();\n\n\t/**\n\t * Whether the radio button is disabled.\n\t */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Whether the radio button is disabled or the radio group is disabled.\n\t */\n\tprotected readonly _disabledState = computed(() => this.disabled() || this._radioGroup.disabledState());\n\n\t/**\n\t * Whether the radio button is checked.\n\t */\n\tprotected readonly _checked = computed(() => this._radioGroup.value() === this.value());\n\n\tprotected readonly _tabIndex = computed(() => {\n\t\tconst disabled = this._disabledState();\n\t\tconst checked = this._checked();\n\t\tconst hasSelectedRadio = this._radioGroup.value() !== undefined;\n\t\tconst isFirstRadio = this._radioGroup.radioButtons()[0] === this;\n\n\t\tif (disabled || (!checked && (hasSelectedRadio || !isFirstRadio))) {\n\t\t\treturn -1;\n\t\t}\n\t\treturn 0;\n\t});\n\n\t/**\n\t * The unique ID for the radio button input. If none is supplied, it will be auto-generated.\n\t */\n\tpublic readonly id = input<string | undefined>(undefined);\n\n\tpublic readonly ariaLabel = input<string | undefined>(undefined, { alias: 'aria-label' });\n\n\tpublic readonly ariaLabelledby = input<string | undefined>(undefined, { alias: 'aria-labelledby' });\n\n\tpublic readonly ariaDescribedby = input<string | undefined>(undefined, { alias: 'aria-describedby' });\n\n\t/**\n\t * The value this radio button represents.\n\t */\n\tpublic readonly value = input.required<T>();\n\n\t/**\n\t * Whether the radio button is required.\n\t */\n\tpublic readonly required = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/**\n\t * Event emitted when the checked state of this radio button changes.\n\t */\n\tpublic readonly change = output<BrnRadioChange<T>>();\n\n\tprotected readonly _hostId = computed(() => {\n\t\treturn this.id() ? this.id() + CONTAINER_POST_FIX : `brn-radio-${++BrnRadio._nextUniqueId}`;\n\t});\n\n\tprotected readonly _inputElement = viewChild.required<ElementRef<HTMLInputElement>>('input');\n\n\tconstructor() {\n\t\tthis._focusMonitor.monitor(this._elementRef, true);\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis._focusMonitor.stopMonitoring(this._elementRef);\n\t}\n\n\t/** Dispatch change event with current value. */\n\tprivate emitChangeEvent(): void {\n\t\tthis.change.emit(new BrnRadioChange(this, this.value()));\n\t}\n\n\tprotected onInputClick(event: Event): void {\n\t\t// We have to stop propagation for click events on the visual hidden input element.\n\t\t// By default, when a user clicks on a label element, a generated click event will be\n\t\t// dispatched on the associated input element. Since we are using a label element as our\n\t\t// root container, the click event on the `radio-button` will be executed twice.\n\t\t// The real click event will bubble up, and the generated click event also tries to bubble up.\n\t\t// This will lead to multiple click events.\n\t\t// Preventing bubbling for the second event will solve that issue.\n\t\tevent.stopPropagation();\n\t}\n\n\tprotected onInputInteraction(event: Event): void {\n\t\t// We always have to stop propagation on the change event.\n\t\t// Otherwise the change event, from the input element, will bubble up and\n\t\t// emit its event object to the `change` output.\n\t\tevent.stopPropagation();\n\n\t\tif (!this._checked() && !this._disabledState()) {\n\t\t\tthis.emitChangeEvent();\n\t\t\tthis._radioGroup.select(this, this.value());\n\t\t}\n\t}\n\n\t/** Triggered when the user clicks on the touch target. */\n\tprotected onTouchTargetClick(event: Event): void {\n\t\tthis.onInputInteraction(event);\n\n\t\tif (!this._disabledState()) {\n\t\t\t// Normally the input should be focused already, but if the click\n\t\t\t// comes from the touch target, then we might have to focus it ourselves.\n\t\t\tthis._inputElement().nativeElement.focus();\n\t\t}\n\t}\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n\tbooleanAttribute,\n\tcontentChildren,\n\tDirective,\n\tforwardRef,\n\tinput,\n\tlinkedSignal,\n\tmodel,\n\toutput,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';\nimport { BrnRadio, BrnRadioChange } from './brn-radio';\nimport { provideBrnRadioGroupToken } from './brn-radio-group.token';\n\nexport const BRN_RADIO_GROUP_CONTROL_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnRadioGroup),\n\tmulti: true,\n};\n\n@Directive({\n\tselector: '[brnRadioGroup]',\n\tproviders: [BRN_RADIO_GROUP_CONTROL_VALUE_ACCESSOR, provideBrnRadioGroupToken(BrnRadioGroup)],\n\thost: {\n\t\trole: 'radiogroup',\n\t\t'[dir]': 'direction()',\n\t\t'(focusout)': 'onTouched()',\n\t},\n})\nexport class BrnRadioGroup<T = unknown> implements ControlValueAccessor {\n\tprivate static _nextUniqueId = 0;\n\n\tprotected onChange: ChangeFn<T> = () => {};\n\n\tprotected onTouched: TouchFn = () => {};\n\n\tpublic readonly name = input(`brn-radio-group-${++BrnRadioGroup._nextUniqueId}`);\n\n\t/**\n\t * The value of the selected radio button.\n\t */\n\tpublic readonly value = model<T>();\n\n\t/**\n\t * Whether the radio group is disabled.\n\t */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/**\n\t * Whether the radio group should be required.\n\t */\n\tpublic readonly required = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/**\n\t * The direction of the radio group.\n\t */\n\tpublic readonly direction = input<'ltr' | 'rtl' | null>('ltr');\n\n\t/**\n\t * Event emitted when the group value changes.\n\t */\n\tpublic readonly change = output<BrnRadioChange<T>>();\n\n\t/**\n\t * The internal disabled state of the radio group. This could be switched to a linkedSignal when we can drop v18 support.\n\t * @internal\n\t */\n\tpublic readonly disabledState = linkedSignal(() => this.disabled());\n\n\t/**\n\t * Access the radio buttons within the group.\n\t * @internal\n\t */\n\tpublic readonly radioButtons = contentChildren(BrnRadio, { descendants: true });\n\n\twriteValue(value: T): void {\n\t\tthis.value.set(value);\n\t}\n\n\tregisterOnChange(fn: ChangeFn<T>): void {\n\t\tthis.onChange = fn;\n\t}\n\n\tregisterOnTouched(fn: TouchFn): void {\n\t\tthis.onTouched = fn;\n\t}\n\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis.disabledState.set(isDisabled);\n\t}\n\n\t/**\n\t * Select a radio button.\n\t * @internal\n\t */\n\tselect(radioButton: BrnRadio<T>, value: T): void {\n\t\tif (this.value() === value) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.value.set(value);\n\t\tthis.onChange(value);\n\t\tthis.change.emit(new BrnRadioChange<T>(radioButton, value));\n\t}\n}\n","import { NgModule } from '@angular/core';\n\nimport { BrnRadio } from './lib/brn-radio';\nimport { BrnRadioGroup } from './lib/brn-radio-group';\n\nexport * from './lib/brn-radio';\nexport * from './lib/brn-radio-group';\n\nexport const BrnRadioGroupImports = [BrnRadioGroup, BrnRadio] as const;\n\n@NgModule({\n\timports: [...BrnRadioGroupImports],\n\texports: [...BrnRadioGroupImports],\n})\nexport class BrnRadioGroupModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAGA,MAAM,kBAAkB,GAAG,IAAI,cAAc,CAAyB,oBAAoB,CAAC;AAErF,SAAU,yBAAyB,CAAI,SAAiC,EAAA;IAC7E,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,SAAS,EAAE;AAC/D;SAEgB,mBAAmB,GAAA;AAClC,IAAA,OAAO,MAAM,CAAC,kBAAkB,CAAqB;AACtD;;MCMa,cAAc,CAAA;AAElB,IAAA,MAAA;AACA,IAAA,KAAA;IAFR,WAAA,CACQ,MAAmB,EACnB,KAAQ,EAAA;QADR,IAAA,CAAA,MAAM,GAAN,MAAM;QACN,IAAA,CAAA,KAAK,GAAL,KAAK;;AAEb;AAED,MAAM,kBAAkB,GAAG,QAAQ;MA8DtB,QAAQ,CAAA;AACZ,IAAA,OAAO,aAAa,GAAG,CAAC;AACf,IAAA,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC;AACpC,I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EAAA,CAAA;;2FAhD3C,aAAa,EAAA,UAAA,EAAA,CAAA;kBATzB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,SAAS,EAAE,CAAC,sCAAsC,EAAE,yBAAyB,eAAe,CAAC;AAC7F,oBAAA,IAAI,EAAE;AACL,wBAAA,IAAI,EAAE,YAAY;AAClB,wBAAA,OAAO,EAAE,aAAa;AACtB,wBAAA,YAAY,EAAE,aAAa;AAC3B,qBAAA;AACD,iBAAA;;;MCvBY,oBAAoB,GAAG,CAAC,aAAa,EAAE,QAAQ;MAM/C,mBAAmB,CAAA;0HAAnB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;AAAnB,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,YANK,aAAa,EAAE,QAAQ,CAAA,EAAA,OAAA,EAAA,CAAvB,aAAa,EAAE,QAAQ,CAAA,EAAA,CAAA;2HAM/C,mBAAmB,EAAA,CAAA;;2FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAJ/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE,CAAC,GAAG,oBAAoB,CAAC;AAClC,oBAAA,OAAO,EAAE,CAAC,GAAG,oBAAoB,CAAC;AAClC,iBAAA;;;ACbD;;AAEG;;;;"}
1
+ {"version":3,"file":"spartan-ng-brain-radio-group.mjs","sources":["../../../../libs/brain/radio-group/src/lib/brn-radio-group.token.ts","../../../../libs/brain/radio-group/src/lib/brn-radio.ts","../../../../libs/brain/radio-group/src/lib/brn-radio-group.ts","../../../../libs/brain/radio-group/src/index.ts","../../../../libs/brain/radio-group/src/spartan-ng-brain-radio-group.ts"],"sourcesContent":["import { ExistingProvider, inject, InjectionToken, Type } from '@angular/core';\nimport type { BrnRadioGroup } from './brn-radio-group';\n\nconst BrnRadioGroupToken = new InjectionToken<BrnRadioGroup<unknown>>('BrnRadioGroupToken');\n\nexport function provideBrnRadioGroupToken<T>(directive: Type<BrnRadioGroup<T>>): ExistingProvider {\n\treturn { provide: BrnRadioGroupToken, useExisting: directive };\n}\n\nexport function injectBrnRadioGroup<T = unknown>(): BrnRadioGroup<T> {\n\treturn inject(BrnRadioGroupToken) as BrnRadioGroup<T>;\n}\n","import { FocusMonitor } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n\tChangeDetectionStrategy,\n\tComponent,\n\tElementRef,\n\ttype OnDestroy,\n\tViewEncapsulation,\n\tbooleanAttribute,\n\tcomputed,\n\tinject,\n\tinput,\n\toutput,\n\tviewChild,\n} from '@angular/core';\nimport { injectBrnRadioGroup } from './brn-radio-group.token';\n\nexport class BrnRadioChange<T> {\n\tconstructor(\n\t\tpublic source: BrnRadio<T>,\n\t\tpublic value: T,\n\t) {}\n}\n\nconst CONTAINER_POST_FIX = '-radio';\n\n@Component({\n\tselector: 'brn-radio',\n\thost: {\n\t\tclass: 'brn-radio',\n\t\t'[attr.id]': '_hostId()',\n\t\t'[class.brn-radio-checked]': '_checked()',\n\t\t'[class.brn-radio-disabled]': '_disabledState()',\n\t\t'[attr.data-checked]': '_checked()',\n\t\t'[attr.data-disabled]': '_disabledState()',\n\t\t'[attr.data-value]': 'value()',\n\t\t// Needs to be removed since it causes some a11y issues (see #21266).\n\t\t'[attr.tabindex]': 'null',\n\t\t'[attr.aria-label]': 'null',\n\t\t'[attr.aria-labelledby]': 'null',\n\t\t'[attr.aria-describedby]': 'null',\n\t\t// Note: under normal conditions focus shouldn't land on this element, however it may be\n\t\t// programmatically set, for example inside of a focus trap, in this case we want to forward\n\t\t// the focus to the native element.\n\t\t'(focus)': '_inputElement().nativeElement.focus()',\n\t},\n\texportAs: 'brnRadio',\n\tencapsulation: ViewEncapsulation.None,\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\ttemplate: `\n\t\t<div data-slot=\"indicator\" (click)=\"onTouchTargetClick($event)\">\n\t\t\t<ng-content select=\"[target],[indicator]\" />\n\t\t</div>\n\t\t<input\n\t\t\t#input\n\t\t\tstyle=\"position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0;\"\n\t\t\ttype=\"radio\"\n\t\t\t[id]=\"id()\"\n\t\t\t[checked]=\"_checked()\"\n\t\t\t[disabled]=\"_disabledState()\"\n\t\t\t[tabIndex]=\"_tabIndex()\"\n\t\t\t[attr.name]=\"_radioGroup.name()\"\n\t\t\t[attr.value]=\"value()\"\n\t\t\t[required]=\"required()\"\n\t\t\t[attr.aria-checked]=\"_checked()\"\n\t\t\t[attr.aria-label]=\"ariaLabel()\"\n\t\t\t[attr.aria-labelledby]=\"ariaLabelledby()\"\n\t\t\t[attr.aria-describedby]=\"ariaDescribedby()\"\n\t\t\t[attr.aria-disabled]=\"_disabledState()\"\n\t\t\t(change)=\"onInputInteraction($event)\"\n\t\t\t(click)=\"onInputClick($event)\"\n\t\t/>\n\t\t<ng-content />\n\t`,\n\tstyles: `\n\t\t[data-slot='indicator'] {\n\t\t\tdisplay: flex;\n\t\t\theight: fit-content;\n\t\t\twidth: fit-content;\n\t\t}\n\n\t\t[data-slot='indicator']:empty {\n\t\t\tdisplay: none;\n\t\t}\n\t`,\n})\nexport class BrnRadio<T = unknown> implements OnDestroy {\n\tprivate static _nextUniqueId = 0;\n\tprivate readonly _focusMonitor = inject(FocusMonitor);\n\tprivate readonly _elementRef = inject(ElementRef);\n\tprotected readonly _radioGroup = injectBrnRadioGroup<T>();\n\n\t/**\n\t * Whether the radio button is disabled.\n\t */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/**\n\t * Whether the radio button is disabled or the radio group is disabled.\n\t */\n\tprotected readonly _disabledState = computed(() => this.disabled() || this._radioGroup.disabledState());\n\n\t/**\n\t * Whether the radio button is checked.\n\t */\n\tprotected readonly _checked = computed(() => this._radioGroup.value() === this.value());\n\n\tprotected readonly _tabIndex = computed(() => {\n\t\tconst disabled = this._disabledState();\n\t\tconst checked = this._checked();\n\t\tconst hasSelectedRadio = this._radioGroup.value() !== undefined;\n\t\tconst isFirstRadio = this._radioGroup.radioButtons()[0] === this;\n\n\t\tif (disabled || (!checked && (hasSelectedRadio || !isFirstRadio))) {\n\t\t\treturn -1;\n\t\t}\n\t\treturn 0;\n\t});\n\n\t/**\n\t * The unique ID for the radio button input. If none is supplied, it will be auto-generated.\n\t */\n\tpublic readonly id = input<string | undefined>(undefined);\n\n\tpublic readonly ariaLabel = input<string | undefined>(undefined, { alias: 'aria-label' });\n\n\tpublic readonly ariaLabelledby = input<string | undefined>(undefined, { alias: 'aria-labelledby' });\n\n\tpublic readonly ariaDescribedby = input<string | undefined>(undefined, { alias: 'aria-describedby' });\n\n\t/**\n\t * The value this radio button represents.\n\t */\n\tpublic readonly value = input.required<T>();\n\n\t/**\n\t * Whether the radio button is required.\n\t */\n\tpublic readonly required = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/**\n\t * Event emitted when the checked state of this radio button changes.\n\t */\n\tpublic readonly change = output<BrnRadioChange<T>>();\n\n\tprotected readonly _hostId = computed(() => {\n\t\treturn this.id() ? this.id() + CONTAINER_POST_FIX : `brn-radio-${++BrnRadio._nextUniqueId}`;\n\t});\n\n\tprotected readonly _inputElement = viewChild.required<ElementRef<HTMLInputElement>>('input');\n\n\tconstructor() {\n\t\tthis._focusMonitor.monitor(this._elementRef, true);\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis._focusMonitor.stopMonitoring(this._elementRef);\n\t}\n\n\t/** Dispatch change event with current value. */\n\tprivate emitChangeEvent(): void {\n\t\tthis.change.emit(new BrnRadioChange(this, this.value()));\n\t}\n\n\tprotected onInputClick(event: Event): void {\n\t\t// We have to stop propagation for click events on the visual hidden input element.\n\t\t// By default, when a user clicks on a label element, a generated click event will be\n\t\t// dispatched on the associated input element. Since we are using a label element as our\n\t\t// root container, the click event on the `radio-button` will be executed twice.\n\t\t// The real click event will bubble up, and the generated click event also tries to bubble up.\n\t\t// This will lead to multiple click events.\n\t\t// Preventing bubbling for the second event will solve that issue.\n\t\tevent.stopPropagation();\n\t}\n\n\tprotected onInputInteraction(event: Event): void {\n\t\t// We always have to stop propagation on the change event.\n\t\t// Otherwise the change event, from the input element, will bubble up and\n\t\t// emit its event object to the `change` output.\n\t\tevent.stopPropagation();\n\n\t\tif (!this._checked() && !this._disabledState()) {\n\t\t\tthis.emitChangeEvent();\n\t\t\tthis._radioGroup.select(this, this.value());\n\t\t}\n\t}\n\n\t/** Triggered when the user clicks on the touch target. */\n\tprotected onTouchTargetClick(event: Event): void {\n\t\tthis.onInputInteraction(event);\n\n\t\tif (!this._disabledState()) {\n\t\t\t// Normally the input should be focused already, but if the click\n\t\t\t// comes from the touch target, then we might have to focus it ourselves.\n\t\t\tthis._inputElement().nativeElement.focus();\n\t\t}\n\t}\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n\tbooleanAttribute,\n\tcontentChildren,\n\tDirective,\n\tforwardRef,\n\tinput,\n\tlinkedSignal,\n\tmodel,\n\toutput,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';\nimport { BrnRadio, BrnRadioChange } from './brn-radio';\nimport { provideBrnRadioGroupToken } from './brn-radio-group.token';\n\nexport const BRN_RADIO_GROUP_CONTROL_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnRadioGroup),\n\tmulti: true,\n};\n\n@Directive({\n\tselector: '[brnRadioGroup]',\n\tproviders: [BRN_RADIO_GROUP_CONTROL_VALUE_ACCESSOR, provideBrnRadioGroupToken(BrnRadioGroup)],\n\thost: {\n\t\trole: 'radiogroup',\n\t\t'[dir]': 'direction()',\n\t\t'(focusout)': 'onTouched()',\n\t},\n})\nexport class BrnRadioGroup<T = unknown> implements ControlValueAccessor {\n\tprivate static _nextUniqueId = 0;\n\n\tprotected onChange: ChangeFn<T> = () => {};\n\n\tprotected onTouched: TouchFn = () => {};\n\n\tpublic readonly name = input(`brn-radio-group-${++BrnRadioGroup._nextUniqueId}`);\n\n\t/**\n\t * The value of the selected radio button.\n\t */\n\tpublic readonly value = model<T>();\n\n\t/** Emits when the value changes. */\n\tpublic readonly valueChange = output<T>();\n\n\t/**\n\t * Whether the radio group is disabled.\n\t */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/**\n\t * Whether the radio group should be required.\n\t */\n\tpublic readonly required = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/**\n\t * The direction of the radio group.\n\t */\n\tpublic readonly direction = input<'ltr' | 'rtl' | null>('ltr');\n\n\t/**\n\t * Event emitted when the group value changes.\n\t */\n\tpublic readonly change = output<BrnRadioChange<T>>();\n\n\t/**\n\t * The internal disabled state of the radio group. This could be switched to a linkedSignal when we can drop v18 support.\n\t * @internal\n\t */\n\tpublic readonly disabledState = linkedSignal(() => this.disabled());\n\n\t/**\n\t * Access the radio buttons within the group.\n\t * @internal\n\t */\n\tpublic readonly radioButtons = contentChildren(BrnRadio, { descendants: true });\n\n\twriteValue(value: T): void {\n\t\tthis.value.set(value);\n\t}\n\n\tregisterOnChange(fn: ChangeFn<T>): void {\n\t\tthis.onChange = fn;\n\t}\n\n\tregisterOnTouched(fn: TouchFn): void {\n\t\tthis.onTouched = fn;\n\t}\n\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis.disabledState.set(isDisabled);\n\t}\n\n\t/**\n\t * Select a radio button.\n\t * @internal\n\t */\n\tselect(radioButton: BrnRadio<T>, value: T): void {\n\t\tif (this.value() === value) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.value.set(value);\n\t\tthis.valueChange.emit(value);\n\t\tthis.onChange(value);\n\t\tthis.change.emit(new BrnRadioChange<T>(radioButton, value));\n\t}\n}\n","import { NgModule } from '@angular/core';\n\nimport { BrnRadio } from './lib/brn-radio';\nimport { BrnRadioGroup } from './lib/brn-radio-group';\n\nexport * from './lib/brn-radio';\nexport * from './lib/brn-radio-group';\n\nexport const BrnRadioGroupImports = [BrnRadioGroup, BrnRadio] as const;\n\n@NgModule({\n\timports: [...BrnRadioGroupImports],\n\texports: [...BrnRadioGroupImports],\n})\nexport class BrnRadioGroupModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAGA,MAAM,kBAAkB,GAAG,IAAI,cAAc,CAAyB,oBAAoB,CAAC;AAErF,SAAU,yBAAyB,CAAI,SAAiC,EAAA;IAC7E,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,SAAS,EAAE;AAC/D;SAEgB,mBAAmB,GAAA;AAClC,IAAA,OAAO,MAAM,CAAC,kBAAkB,CAAqB;AACtD;;MCMa,cAAc,CAAA;AAElB,IAAA,MAAA;AACA,IAAA,KAAA;IAFR,WAAA,CACQ,MAAmB,EACnB,KAAQ,EAAA;QADR,IAAA,CAAA,MAAM,GAAN,MAAM;QACN,IAAA,CAAA,KAAK,GAAL,KAAK;;AAEb;AAED,MAAM,kBAAkB,GAAG,QAAQ;MA8DtB,QAAQ,CAAA;AACZ,IAAA,OAAO,aAAa,GAAG,CAAC;AACf,IAAA,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC;AACpC,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;IAC9B,WAAW,GAAG,mBAAmB,EAAK;AAEzD;;AAEG;IACa,QAAQ,GAAG,KAAK,CAAwB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EAAA,CAAA;;2FAnD3C,aAAa,EAAA,UAAA,EAAA,CAAA;kBATzB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,SAAS,EAAE,CAAC,sCAAsC,EAAE,yBAAyB,eAAe,CAAC;AAC7F,oBAAA,IAAI,EAAE;AACL,wBAAA,IAAI,EAAE,YAAY;AAClB,wBAAA,OAAO,EAAE,aAAa;AACtB,wBAAA,YAAY,EAAE,aAAa;AAC3B,qBAAA;AACD,iBAAA;;;MCvBY,oBAAoB,GAAG,CAAC,aAAa,EAAE,QAAQ;MAM/C,mBAAmB,CAAA;0HAAnB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;AAAnB,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,YANK,aAAa,EAAE,QAAQ,CAAA,EAAA,OAAA,EAAA,CAAvB,aAAa,EAAE,QAAQ,CAAA,EAAA,CAAA;2HAM/C,mBAAmB,EAAA,CAAA;;2FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAJ/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE,CAAC,GAAG,oBAAoB,CAAC;AAClC,oBAAA,OAAO,EAAE,CAAC,GAAG,oBAAoB,CAAC;AAClC,iBAAA;;;ACbD;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, ElementRef, input, booleanAttribute, computed, signal, Directive, DestroyRef, Injector, viewChild, contentChild, contentChildren, effect, afterNextRender, ChangeDetectionStrategy, Component, numberAttribute, model, forwardRef, TemplateRef, ChangeDetectorRef, PLATFORM_ID, NgModule } from '@angular/core';
2
+ import { InjectionToken, inject, ElementRef, input, booleanAttribute, computed, signal, Directive, DestroyRef, Injector, viewChild, contentChild, contentChildren, effect, afterNextRender, ChangeDetectionStrategy, Component, numberAttribute, model, output, forwardRef, TemplateRef, ChangeDetectorRef, PLATFORM_ID, NgModule } from '@angular/core';
3
3
  import { CdkListboxModule } from '@angular/cdk/listbox';
4
4
  import * as i1 from '@angular/cdk/overlay';
5
5
  import { CdkConnectedOverlay, OverlayModule } from '@angular/cdk/overlay';
@@ -331,6 +331,7 @@ class BrnSelect {
331
331
  });
332
332
  open = model(false);
333
333
  value = model();
334
+ valueChange = output();
334
335
  compareWith = input((o1, o2) => o1 === o2);
335
336
  formDisabled = signal(false);
336
337
  /** Label provided by the consumer. */
@@ -443,9 +444,11 @@ class BrnSelect {
443
444
  const currentValue = this.value();
444
445
  const newValue = currentValue ? [...currentValue, value] : [value];
445
446
  this.value.set(newValue);
447
+ this.valueChange.emit(newValue);
446
448
  }
447
449
  else {
448
450
  this.value.set(value);
451
+ this.valueChange.emit(value);
449
452
  }
450
453
  this._onChange?.(this.value());
451
454
  // if this is single select close the dropdown
@@ -456,10 +459,13 @@ class BrnSelect {
456
459
  deselectOption(value) {
457
460
  if (this.multiple()) {
458
461
  const currentValue = this.value();
459
- this.value.set(currentValue.filter((val) => !this.compareWith()(val, value)));
462
+ const newValue = currentValue.filter((val) => !this.compareWith()(val, value));
463
+ this.value.set(newValue);
464
+ this.valueChange.emit(newValue);
460
465
  }
461
466
  else {
462
467
  this.value.set(null);
468
+ this.valueChange.emit(null);
463
469
  }
464
470
  this._onChange?.(this.value());
465
471
  }
@@ -482,7 +488,7 @@ class BrnSelect {
482
488
  return false;
483
489
  }
484
490
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
485
- /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: BrnSelect, isStandalone: true, selector: "brn-select, hlm-select", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, dir: { classPropertyName: "dir", publicName: "dir", isSignal: true, isRequired: false, transformFunction: null }, closeDelay: { classPropertyName: "closeDelay", publicName: "closeDelay", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "compareWith", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", value: "valueChange" }, providers: [
491
+ /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: BrnSelect, isStandalone: true, selector: "brn-select, hlm-select", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, dir: { classPropertyName: "dir", publicName: "dir", isSignal: true, isRequired: false, transformFunction: null }, closeDelay: { classPropertyName: "closeDelay", publicName: "closeDelay", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "compareWith", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", value: "valueChange", valueChange: "valueChange" }, providers: [
486
492
  provideExposedSideProviderExisting((() => BrnSelect)),
487
493
  provideExposesStateProviderExisting((() => BrnSelect)),
488
494
  provideBrnSelect(BrnSelect),