@spartan-ng/brain 1.11.0 → 1.11.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, forwardRef, signal, input, booleanAttribute, linkedSignal, numberAttribute, untracked, output, computed, afterNextRender, Directive, DestroyRef, ElementRef, ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { InjectionToken, inject, forwardRef, input, booleanAttribute, computed, signal, linkedSignal, numberAttribute, untracked, output, afterNextRender, Directive, DestroyRef, ElementRef, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
4
  import * as i1 from '@spartan-ng/brain/field';
5
- import { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';
5
+ import { BrnFieldControl, provideBrnLabelable, BrnFieldControlDescribedBy } from '@spartan-ng/brain/field';
6
6
 
7
7
  const BrnInputOtpToken = new InjectionToken('BrnInputOtpToken');
8
8
  function injectBrnInputOtp() {
@@ -23,7 +23,9 @@ class BrnInputOtp {
23
23
  invalid = this._fieldControl?.invalid;
24
24
  touched = this._fieldControl?.touched;
25
25
  dirty = this._fieldControl?.dirty;
26
- spartanInvalid = this._fieldControl?.spartanInvalid;
26
+ /** Whether to force the OTP into an invalid state. */
27
+ forceInvalid = input(false, { ...(ngDevMode ? { debugName: "forceInvalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
28
+ spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid(), ...(ngDevMode ? [{ debugName: "spartanInvalid" }] : /* istanbul ignore next */ []));
27
29
  /** Whether the input has focus. */
28
30
  _focused = signal(false, ...(ngDevMode ? [{ debugName: "_focused" }] : /* istanbul ignore next */ []));
29
31
  /** Styles applied to the host element. */
@@ -168,7 +170,7 @@ class BrnInputOtp {
168
170
  }
169
171
  }
170
172
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnInputOtp, deps: [], target: i0.ɵɵFactoryTarget.Directive });
171
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.16", type: BrnInputOtp, isStandalone: true, selector: "brn-input-otp, [brnInputOtp]", inputs: { hostStyles: { classPropertyName: "hostStyles", publicName: "hostStyles", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, length: { classPropertyName: "length", publicName: "length", isSignal: true, isRequired: true, transformFunction: null }, slotPattern: { classPropertyName: "slotPattern", publicName: "slotPattern", isSignal: true, isRequired: false, transformFunction: null }, mask: { classPropertyName: "mask", publicName: "mask", isSignal: true, isRequired: false, transformFunction: null }, maskChar: { classPropertyName: "maskChar", publicName: "maskChar", isSignal: true, isRequired: false, transformFunction: null }, autofocus: { classPropertyName: "autofocus", publicName: "autofocus", isSignal: true, isRequired: false, transformFunction: null }, transformPaste: { classPropertyName: "transformPaste", publicName: "transformPaste", isSignal: true, isRequired: false, transformFunction: null }, valueInput: { classPropertyName: "valueInput", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", completed: "completed" }, host: { attributes: { "data-input-otp-container": "true" }, properties: { "style": "hostStyles()" } }, providers: [BRN_INPUT_OTP_VALUE_ACCESSOR, provideBrnInputOtp(BrnInputOtp), provideBrnLabelable(BrnInputOtp)], exportAs: ["brnInputOtp"], hostDirectives: [{ directive: i1.BrnFieldControl }], ngImport: i0 });
173
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.16", type: BrnInputOtp, isStandalone: true, selector: "brn-input-otp, [brnInputOtp]", inputs: { forceInvalid: { classPropertyName: "forceInvalid", publicName: "forceInvalid", isSignal: true, isRequired: false, transformFunction: null }, hostStyles: { classPropertyName: "hostStyles", publicName: "hostStyles", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, length: { classPropertyName: "length", publicName: "length", isSignal: true, isRequired: true, transformFunction: null }, slotPattern: { classPropertyName: "slotPattern", publicName: "slotPattern", isSignal: true, isRequired: false, transformFunction: null }, mask: { classPropertyName: "mask", publicName: "mask", isSignal: true, isRequired: false, transformFunction: null }, maskChar: { classPropertyName: "maskChar", publicName: "maskChar", isSignal: true, isRequired: false, transformFunction: null }, autofocus: { classPropertyName: "autofocus", publicName: "autofocus", isSignal: true, isRequired: false, transformFunction: null }, transformPaste: { classPropertyName: "transformPaste", publicName: "transformPaste", isSignal: true, isRequired: false, transformFunction: null }, valueInput: { classPropertyName: "valueInput", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", completed: "completed" }, host: { attributes: { "data-input-otp-container": "true" }, properties: { "style": "hostStyles()" } }, providers: [BRN_INPUT_OTP_VALUE_ACCESSOR, provideBrnInputOtp(BrnInputOtp), provideBrnLabelable(BrnInputOtp)], exportAs: ["brnInputOtp"], hostDirectives: [{ directive: i1.BrnFieldControl }], ngImport: i0 });
172
174
  }
173
175
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnInputOtp, decorators: [{
174
176
  type: Directive,
@@ -182,7 +184,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
182
184
  'data-input-otp-container': 'true',
183
185
  },
184
186
  }]
185
- }], ctorParameters: () => [], propDecorators: { hostStyles: [{ type: i0.Input, args: [{ isSignal: true, alias: "hostStyles", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], length: [{ type: i0.Input, args: [{ isSignal: true, alias: "length", required: true }] }], slotPattern: [{ type: i0.Input, args: [{ isSignal: true, alias: "slotPattern", required: false }] }], mask: [{ type: i0.Input, args: [{ isSignal: true, alias: "mask", required: false }] }], maskChar: [{ type: i0.Input, args: [{ isSignal: true, alias: "maskChar", required: false }] }], autofocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autofocus", required: false }] }], transformPaste: [{ type: i0.Input, args: [{ isSignal: true, alias: "transformPaste", required: false }] }], valueInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], completed: [{ type: i0.Output, args: ["completed"] }] } });
187
+ }], ctorParameters: () => [], propDecorators: { forceInvalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "forceInvalid", required: false }] }], hostStyles: [{ type: i0.Input, args: [{ isSignal: true, alias: "hostStyles", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], length: [{ type: i0.Input, args: [{ isSignal: true, alias: "length", required: true }] }], slotPattern: [{ type: i0.Input, args: [{ isSignal: true, alias: "slotPattern", required: false }] }], mask: [{ type: i0.Input, args: [{ isSignal: true, alias: "mask", required: false }] }], maskChar: [{ type: i0.Input, args: [{ isSignal: true, alias: "maskChar", required: false }] }], autofocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autofocus", required: false }] }], transformPaste: [{ type: i0.Input, args: [{ isSignal: true, alias: "transformPaste", required: false }] }], valueInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], completed: [{ type: i0.Output, args: ["completed"] }] } });
186
188
  function toCharRegex(pattern) {
187
189
  if (pattern instanceof RegExp) {
188
190
  // Strip stateful flags so repeated .test() calls remain deterministic.
@@ -202,6 +204,10 @@ class BrnInputOtpInput {
202
204
  inputMode = input('numeric', ...(ngDevMode ? [{ debugName: "inputMode" }] : /* istanbul ignore next */ []));
203
205
  /** Styles applied to the input element to make it invisible and clickable. */
204
206
  inputStyles = input(undefined, ...(ngDevMode ? [{ debugName: "inputStyles" }] : /* istanbul ignore next */ []));
207
+ /** Overrides the error state matcher and forceInvalid for aria-invalid. */
208
+ ariaInvalidInput = input(undefined, { ...(ngDevMode ? { debugName: "ariaInvalidInput" } : /* istanbul ignore next */ {}), transform: (v) => (v === '' || v === undefined ? undefined : booleanAttribute(v)),
209
+ alias: 'aria-invalid' });
210
+ _ariaInvalid = computed(() => this.ariaInvalidInput() ?? this._otp.spartanInvalid(), ...(ngDevMode ? [{ debugName: "_ariaInvalid" }] : /* istanbul ignore next */ []));
205
211
  _inputStyles = computed(() => this.inputStyles() ?? DEFAULT_INPUT_STYLES, ...(ngDevMode ? [{ debugName: "_inputStyles" }] : /* istanbul ignore next */ []));
206
212
  constructor() {
207
213
  this._otp.registerInput(this);
@@ -247,18 +253,20 @@ class BrnInputOtpInput {
247
253
  input.setSelectionRange(start, end);
248
254
  }
249
255
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnInputOtpInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
250
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.16", type: BrnInputOtpInput, isStandalone: true, selector: "input[brnInputOtpInput]", inputs: { autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, inputMode: { classPropertyName: "inputMode", publicName: "inputMode", isSignal: true, isRequired: false, transformFunction: null }, inputStyles: { classPropertyName: "inputStyles", publicName: "inputStyles", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "input-otp" }, listeners: { "input": "onInputChange()", "paste": "onPaste($event)", "focus": "_otp.onFocus()", "blur": "_otp.onBlur()" }, properties: { "id": "_otp.inputId()", "attr.autocomplete": "autocomplete()", "attr.inputmode": "inputMode()", "disabled": "_otp.disabledState()", "value": "_otp.value() ?? \"\"", "style": "_inputStyles()" } }, exportAs: ["brnInputOtpInput"], ngImport: i0 });
256
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.16", type: BrnInputOtpInput, isStandalone: true, selector: "input[brnInputOtpInput]", inputs: { autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, inputMode: { classPropertyName: "inputMode", publicName: "inputMode", isSignal: true, isRequired: false, transformFunction: null }, inputStyles: { classPropertyName: "inputStyles", publicName: "inputStyles", isSignal: true, isRequired: false, transformFunction: null }, ariaInvalidInput: { classPropertyName: "ariaInvalidInput", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "input-otp" }, listeners: { "input": "onInputChange()", "paste": "onPaste($event)", "focus": "_otp.onFocus()", "blur": "_otp.onBlur()" }, properties: { "id": "_otp.inputId()", "attr.autocomplete": "autocomplete()", "attr.inputmode": "inputMode()", "attr.aria-invalid": "_ariaInvalid() ? \"true\" : null", "disabled": "_otp.disabledState()", "value": "_otp.value() ?? \"\"", "style": "_inputStyles()" } }, exportAs: ["brnInputOtpInput"], hostDirectives: [{ directive: i1.BrnFieldControlDescribedBy, inputs: ["aria-describedby", "aria-describedby"] }], ngImport: i0 });
251
257
  }
252
258
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnInputOtpInput, decorators: [{
253
259
  type: Directive,
254
260
  args: [{
255
261
  selector: 'input[brnInputOtpInput]',
256
262
  exportAs: 'brnInputOtpInput',
263
+ hostDirectives: [{ directive: BrnFieldControlDescribedBy, inputs: ['aria-describedby'] }],
257
264
  host: {
258
265
  'data-slot': 'input-otp',
259
266
  '[id]': '_otp.inputId()',
260
267
  '[attr.autocomplete]': 'autocomplete()',
261
268
  '[attr.inputmode]': 'inputMode()',
269
+ '[attr.aria-invalid]': '_ariaInvalid() ? "true" : null',
262
270
  '[disabled]': '_otp.disabledState()',
263
271
  '[value]': '_otp.value() ?? ""',
264
272
  '[style]': '_inputStyles()',
@@ -268,7 +276,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
268
276
  '(blur)': '_otp.onBlur()',
269
277
  },
270
278
  }]
271
- }], ctorParameters: () => [], propDecorators: { autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocomplete", required: false }] }], inputMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputMode", required: false }] }], inputStyles: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputStyles", required: false }] }] } });
279
+ }], ctorParameters: () => [], propDecorators: { autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocomplete", required: false }] }], inputMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputMode", required: false }] }], inputStyles: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputStyles", required: false }] }], ariaInvalidInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-invalid", required: false }] }] } });
272
280
 
273
281
  class BrnInputOtpSlot {
274
282
  /** Access the input-otp component */
@@ -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-input.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 { type ExistingProvider, inject, InjectionToken, type Type } from '@angular/core';\nimport type { 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 type { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n\tafterNextRender,\n\tbooleanAttribute,\n\tcomputed,\n\tDirective,\n\tforwardRef,\n\tinject,\n\tinput,\n\tlinkedSignal,\n\tnumberAttribute,\n\toutput,\n\tsignal,\n\tuntracked,\n} from '@angular/core';\nimport { type ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';\nimport type { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';\nimport type { BrnInputOtpInput } from './brn-input-otp-input';\nimport { provideBrnInputOtp } from './brn-input-otp.token';\n\nexport type { InputMode } from './brn-input-otp-input';\n\nexport const BRN_INPUT_OTP_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnInputOtp),\n\tmulti: true,\n};\n\n@Directive({\n\tselector: 'brn-input-otp, [brnInputOtp]',\n\texportAs: 'brnInputOtp',\n\tproviders: [BRN_INPUT_OTP_VALUE_ACCESSOR, provideBrnInputOtp(BrnInputOtp), provideBrnLabelable(BrnInputOtp)],\n\thostDirectives: [BrnFieldControl],\n\thost: {\n\t\t'[style]': 'hostStyles()',\n\t\t'data-input-otp-container': 'true',\n\t},\n})\nexport class BrnInputOtp implements ControlValueAccessor {\n\tprivate static _id = 0;\n\n\tprivate readonly _fieldControl = inject(BrnFieldControl, { optional: true });\n\n\tpublic readonly invalid = this._fieldControl?.invalid;\n\tpublic readonly touched = this._fieldControl?.touched;\n\tpublic readonly dirty = this._fieldControl?.dirty;\n\tpublic readonly spartanInvalid = this._fieldControl?.spartanInvalid;\n\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/** Custom id applied to the input element */\n\tpublic readonly inputId = input<string>(`brn-input-otp-${++BrnInputOtp._id}`);\n\n\tpublic readonly labelableId = this.inputId;\n\n\t/** Determine if the input is disabled. */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\tprotected readonly _disabled = linkedSignal(this.disabled);\n\n\t/** @internal The disabled state as a readonly signal */\n\tpublic readonly disabledState = this._disabled.asReadonly();\n\n\t/** The number of slots. */\n\tpublic readonly length = input.required<number, NumberInput>({ transform: numberAttribute });\n\n\t/**\n\t * Optional per-character pattern. Each typed or pasted character must match this\n\t * pattern. Strings are treated as a single-character regular expression.\n\t *\n\t * Examples: '[0-9]', '[A-Za-z0-9]'\n\t */\n\tpublic readonly slotPattern = input<string | RegExp | null>(null);\n\n\t/** Whether entered characters should be visually masked. */\n\tpublic readonly mask = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/** The character used to mask entered characters. */\n\tpublic readonly maskChar = input<string>('•');\n\n\t/** If true, the element is focused automatically on init **/\n\tpublic readonly autofocus = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\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 length.\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, length: number) => string>((text) => text);\n\n\t/** The value controlling the input */\n\tpublic readonly valueInput = input<string | null>(null, { alias: 'value' });\n\tpublic readonly value = linkedSignal(() => {\n\t\tconst valueInput = this.valueInput();\n\n\t\t// Keep configuration changes from resetting the current value.\n\t\treturn untracked(() => this.sanitizeValue(valueInput));\n\t});\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 length = this.length();\n\t\tconst mask = this.mask();\n\t\tconst maskChar = this.maskChar();\n\t\tconst slots = Array.from({ length: this.length() }).map((_, slotIndex) => {\n\t\t\tconst char = value[slotIndex] !== undefined ? value[slotIndex] : null;\n\n\t\t\tconst isActive = focused && (value.length === slotIndex || (value.length === length && slotIndex === length - 1));\n\n\t\t\treturn {\n\t\t\t\tchar,\n\t\t\t\tdisplayChar: char !== null && mask ? maskChar : char,\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 _onChange?: ChangeFn<string>;\n\tprotected _onTouched?: TouchFn;\n\n\t/** The registered hidden input element. */\n\tprivate readonly _input = signal<BrnInputOtpInput | null>(null);\n\n\tconstructor() {\n\t\tafterNextRender(() => {\n\t\t\tif (this.autofocus()) {\n\t\t\t\tthis.focus();\n\t\t\t}\n\t\t});\n\t}\n\n\t/** @internal */\n\tpublic sanitizeValue(value: string | null | undefined, clamp = true): string {\n\t\tconst length = this.length();\n\t\tconst text = value ?? '';\n\t\tconst pattern = this.slotPattern();\n\t\tconst regex = pattern ? toCharRegex(pattern) : null;\n\t\tconst filtered = regex\n\t\t\t? Array.from(text)\n\t\t\t\t\t.filter((char) => regex.test(char))\n\t\t\t\t\t.join('')\n\t\t\t: text;\n\n\t\treturn clamp ? filtered.slice(0, length) : filtered;\n\t}\n\n\t/** Focus the underlying input element. */\n\tpublic focus(): void {\n\t\tthis._input()?.focus();\n\t}\n\n\t/** @internal */\n\tpublic registerInput(input: BrnInputOtpInput): void {\n\t\tthis._input.set(input);\n\t}\n\n\t/** @internal */\n\tpublic unregisterInput(input: BrnInputOtpInput): void {\n\t\tif (this._input() === input) {\n\t\t\tthis._input.set(null);\n\t\t}\n\t}\n\n\t/** @internal */\n\tpublic onFocus(): void {\n\t\tthis._focused.set(true);\n\t}\n\n\t/** @internal */\n\tpublic onBlur(): void {\n\t\tthis._focused.set(false);\n\t\tthis._onTouched?.();\n\t}\n\n\t/** CONTROL VALUE ACCESSOR */\n\twriteValue(value: string | null): void {\n\t\tconst sanitizedValue = this.sanitizeValue(value);\n\n\t\tthis.value.set(sanitizedValue);\n\n\t\tif (sanitizedValue.length === this.length()) {\n\t\t\tthis.completed.emit(sanitizedValue);\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._disabled.set(isDisabled);\n\t}\n\n\tprivate isCompleted(newValue: string, previousValue: string, length: number) {\n\t\treturn newValue !== previousValue && previousValue.length < length && newValue.length === length;\n\t}\n\n\t/** @internal */\n\tpublic updateValue(newValue: string): void {\n\t\tconst previousValue = this.value() ?? '';\n\t\tconst length = this.length();\n\t\tconst sanitizedValue = this.sanitizeValue(newValue);\n\n\t\tthis.value.set(sanitizedValue);\n\t\tthis.valueChange.emit(sanitizedValue);\n\t\tthis._onChange?.(sanitizedValue);\n\n\t\tif (this.isCompleted(sanitizedValue, previousValue, length)) {\n\t\t\tthis.completed.emit(sanitizedValue);\n\t\t}\n\t}\n}\n\nfunction toCharRegex(pattern: string | RegExp): RegExp {\n\tif (pattern instanceof RegExp) {\n\t\t// Strip stateful flags so repeated .test() calls remain deterministic.\n\t\treturn new RegExp(`^(?:${pattern.source})$`, pattern.flags.replace(/[gy]/g, ''));\n\t}\n\n\treturn new RegExp(`^(?:${pattern})$`);\n}\n","import { computed, DestroyRef, Directive, ElementRef, inject, input } from '@angular/core';\nimport { injectBrnInputOtp } from './brn-input-otp.token';\n\nexport type InputMode = 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n\nconst DEFAULT_INPUT_STYLES =\n\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\n@Directive({\n\tselector: 'input[brnInputOtpInput]',\n\texportAs: 'brnInputOtpInput',\n\thost: {\n\t\t'data-slot': 'input-otp',\n\t\t'[id]': '_otp.inputId()',\n\t\t'[attr.autocomplete]': 'autocomplete()',\n\t\t'[attr.inputmode]': 'inputMode()',\n\t\t'[disabled]': '_otp.disabledState()',\n\t\t'[value]': '_otp.value() ?? \"\"',\n\t\t'[style]': '_inputStyles()',\n\t\t'(input)': 'onInputChange()',\n\t\t'(paste)': 'onPaste($event)',\n\t\t'(focus)': '_otp.onFocus()',\n\t\t'(blur)': '_otp.onBlur()',\n\t},\n})\nexport class BrnInputOtpInput {\n\tprivate readonly _destroyRef = inject(DestroyRef);\n\tprivate readonly _elementRef = inject<ElementRef<HTMLInputElement>>(ElementRef);\n\n\tprotected readonly _otp = injectBrnInputOtp();\n\n\t/** Custom autocomplete attribute applied to the input element */\n\tpublic readonly autocomplete = input<'one-time-code' | 'off'>('one-time-code');\n\n\t/** Virtual keyboard appearance on mobile */\n\tpublic readonly inputMode = input<InputMode>('numeric');\n\n\t/** Styles applied to the input element to make it invisible and clickable. */\n\tpublic readonly inputStyles = input<string | undefined>(undefined);\n\n\tprotected readonly _inputStyles = computed(() => this.inputStyles() ?? DEFAULT_INPUT_STYLES);\n\n\tconstructor() {\n\t\tthis._otp.registerInput(this);\n\t\tthis._destroyRef.onDestroy(() => this._otp.unregisterInput(this));\n\t}\n\n\t/** Focus the underlying input element. */\n\tpublic focus(): void {\n\t\tthis._elementRef.nativeElement.focus();\n\t}\n\n\tprotected onInputChange(): void {\n\t\tconst input = this._elementRef.nativeElement;\n\t\tconst length = this._otp.length();\n\n\t\t// Do not clamp here so that typing when the input is full replaces the\n\t\t// last character instead of dropping the newly typed character.\n\t\tlet sanitized = this._otp.sanitizeValue(input.value, false);\n\n\t\tif (sanitized.length > length) {\n\t\t\tsanitized = sanitized.slice(0, length - 1) + sanitized.slice(-1);\n\t\t}\n\n\t\tsanitized = sanitized.slice(0, length);\n\n\t\tif (input.value !== sanitized) {\n\t\t\tinput.value = sanitized;\n\t\t\tthis.setSelectionRange(sanitized.length, sanitized.length);\n\t\t}\n\n\t\tthis._otp.updateValue(sanitized);\n\t}\n\n\tprotected onPaste(event: ClipboardEvent): void {\n\t\tevent.preventDefault();\n\t\tconst input = this._elementRef.nativeElement;\n\t\tconst clipboardData = event.clipboardData?.getData('text/plain') || '';\n\t\tconst length = this._otp.length();\n\n\t\tconst content = this._otp.transformPaste()(clipboardData, length);\n\t\tconst sanitized = this._otp.sanitizeValue(content);\n\n\t\tinput.value = sanitized;\n\t\tthis.setSelectionRange(sanitized.length, sanitized.length);\n\t\tthis._otp.updateValue(sanitized);\n\t}\n\n\tprivate setSelectionRange(start: number, end: number): void {\n\t\tconst input = this._elementRef.nativeElement;\n\n\t\t// Number/date/email inputs throw when setSelectionRange is called.\n\t\tif (!['text', 'search', 'url', 'tel', 'password'].includes(input.type)) {\n\t\t\treturn;\n\t\t}\n\n\t\tinput.setSelectionRange(start, end);\n\t}\n}\n","import type { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, 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\texportAs: 'brnInputOtpSlot',\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\thost: {\n\t\t'[attr.data-active]': '_slot().isActive',\n\t\t'[attr.data-invalid]': '_ariaInvalid?.() ? \"true\" : null',\n\t\t'[attr.data-touched]': '_touched?.() ? \"true\" : null',\n\t\t'[attr.data-dirty]': '_dirty?.() ? \"true\" : null',\n\t\t'[attr.data-matches-spartan-invalid]': '_spartanInvalid() ? \"true\" : null',\n\t},\n\ttemplate: `\n\t\t{{ _slot().displayChar }}\n\n\t\t@if (_slot().hasFakeCaret) {\n\t\t\t<ng-content />\n\t\t}\n\t`,\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\t/** Whether to force the input into an invalid state. */\n\tpublic readonly forceInvalid = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\tprotected readonly _slot = computed(\n\t\t() =>\n\t\t\tthis._inputOtp.context()[this.index()] ?? {\n\t\t\t\tchar: null,\n\t\t\t\tdisplayChar: null,\n\t\t\t\tisActive: false,\n\t\t\t\thasFakeCaret: false,\n\t\t\t},\n\t);\n\n\tprotected readonly _ariaInvalid = this._inputOtp.invalid;\n\tprotected readonly _touched = this._inputOtp.touched;\n\tprotected readonly _dirty = this._inputOtp.dirty;\n\tprotected readonly _spartanInvalid = computed(() => this.forceInvalid() || this._inputOtp.spartanInvalid?.());\n}\n","import { BrnInputOtp } from './lib/brn-input-otp';\nimport { BrnInputOtpInput } from './lib/brn-input-otp-input';\nimport { BrnInputOtpSlot } from './lib/brn-input-otp-slot';\n\nexport * from './lib/brn-input-otp';\nexport * from './lib/brn-input-otp-input';\nexport * from './lib/brn-input-otp-slot';\nexport * from './lib/brn-input-otp.token';\n\nexport const BrnInputOtpImports = [BrnInputOtp, BrnInputOtpInput, BrnInputOtpSlot] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAGa,gBAAgB,GAAG,IAAI,cAAc,CAAc,kBAAkB;SAElE,iBAAiB,GAAA;AAChC,IAAA,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MAAM;AAC/C,oBAAA,IAAI,EAAE;AACL,wBAAA,oBAAoB,EAAE,kBAAkB;AACxC,wBAAA,qBAAqB,EAAE,kCAAkC;AACzD,wBAAA,qBAAqB,EAAE,8BAA8B;AACrD,wBAAA,mBAAmB,EAAE,4BAA4B;AACjD,wBAAA,qCAAqC,EAAE,mCAAmC;AAC1E,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;AAMT,CAAA,CAAA;AACD,iBAAA;;;ACbM,MAAM,kBAAkB,GAAG,CAAC,WAAW,EAAE,gBAAgB,EAAE,eAAe;;ACTjF;;AAEG;;;;"}
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-input.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 { type ExistingProvider, inject, InjectionToken, type Type } from '@angular/core';\nimport type { 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 type { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n\tafterNextRender,\n\tbooleanAttribute,\n\tcomputed,\n\tDirective,\n\tforwardRef,\n\tinject,\n\tinput,\n\tlinkedSignal,\n\tnumberAttribute,\n\toutput,\n\tsignal,\n\tuntracked,\n} from '@angular/core';\nimport { type ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';\nimport type { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';\nimport type { BrnInputOtpInput } from './brn-input-otp-input';\nimport { provideBrnInputOtp } from './brn-input-otp.token';\n\nexport type { InputMode } from './brn-input-otp-input';\n\nexport const BRN_INPUT_OTP_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnInputOtp),\n\tmulti: true,\n};\n\n@Directive({\n\tselector: 'brn-input-otp, [brnInputOtp]',\n\texportAs: 'brnInputOtp',\n\tproviders: [BRN_INPUT_OTP_VALUE_ACCESSOR, provideBrnInputOtp(BrnInputOtp), provideBrnLabelable(BrnInputOtp)],\n\thostDirectives: [BrnFieldControl],\n\thost: {\n\t\t'[style]': 'hostStyles()',\n\t\t'data-input-otp-container': 'true',\n\t},\n})\nexport class BrnInputOtp implements ControlValueAccessor {\n\tprivate static _id = 0;\n\n\tprivate readonly _fieldControl = inject(BrnFieldControl, { optional: true });\n\n\tpublic readonly invalid = this._fieldControl?.invalid;\n\tpublic readonly touched = this._fieldControl?.touched;\n\tpublic readonly dirty = this._fieldControl?.dirty;\n\n\t/** Whether to force the OTP into an invalid state. */\n\tpublic readonly forceInvalid = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\tpublic readonly spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid());\n\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/** Custom id applied to the input element */\n\tpublic readonly inputId = input<string>(`brn-input-otp-${++BrnInputOtp._id}`);\n\n\tpublic readonly labelableId = this.inputId;\n\n\t/** Determine if the input is disabled. */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\tprotected readonly _disabled = linkedSignal(this.disabled);\n\n\t/** @internal The disabled state as a readonly signal */\n\tpublic readonly disabledState = this._disabled.asReadonly();\n\n\t/** The number of slots. */\n\tpublic readonly length = input.required<number, NumberInput>({ transform: numberAttribute });\n\n\t/**\n\t * Optional per-character pattern. Each typed or pasted character must match this\n\t * pattern. Strings are treated as a single-character regular expression.\n\t *\n\t * Examples: '[0-9]', '[A-Za-z0-9]'\n\t */\n\tpublic readonly slotPattern = input<string | RegExp | null>(null);\n\n\t/** Whether entered characters should be visually masked. */\n\tpublic readonly mask = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\t/** The character used to mask entered characters. */\n\tpublic readonly maskChar = input<string>('•');\n\n\t/** If true, the element is focused automatically on init **/\n\tpublic readonly autofocus = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\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 length.\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, length: number) => string>((text) => text);\n\n\t/** The value controlling the input */\n\tpublic readonly valueInput = input<string | null>(null, { alias: 'value' });\n\tpublic readonly value = linkedSignal(() => {\n\t\tconst valueInput = this.valueInput();\n\n\t\t// Keep configuration changes from resetting the current value.\n\t\treturn untracked(() => this.sanitizeValue(valueInput));\n\t});\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 length = this.length();\n\t\tconst mask = this.mask();\n\t\tconst maskChar = this.maskChar();\n\t\tconst slots = Array.from({ length: this.length() }).map((_, slotIndex) => {\n\t\t\tconst char = value[slotIndex] !== undefined ? value[slotIndex] : null;\n\n\t\t\tconst isActive = focused && (value.length === slotIndex || (value.length === length && slotIndex === length - 1));\n\n\t\t\treturn {\n\t\t\t\tchar,\n\t\t\t\tdisplayChar: char !== null && mask ? maskChar : char,\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 _onChange?: ChangeFn<string>;\n\tprotected _onTouched?: TouchFn;\n\n\t/** The registered hidden input element. */\n\tprivate readonly _input = signal<BrnInputOtpInput | null>(null);\n\n\tconstructor() {\n\t\tafterNextRender(() => {\n\t\t\tif (this.autofocus()) {\n\t\t\t\tthis.focus();\n\t\t\t}\n\t\t});\n\t}\n\n\t/** @internal */\n\tpublic sanitizeValue(value: string | null | undefined, clamp = true): string {\n\t\tconst length = this.length();\n\t\tconst text = value ?? '';\n\t\tconst pattern = this.slotPattern();\n\t\tconst regex = pattern ? toCharRegex(pattern) : null;\n\t\tconst filtered = regex\n\t\t\t? Array.from(text)\n\t\t\t\t\t.filter((char) => regex.test(char))\n\t\t\t\t\t.join('')\n\t\t\t: text;\n\n\t\treturn clamp ? filtered.slice(0, length) : filtered;\n\t}\n\n\t/** Focus the underlying input element. */\n\tpublic focus(): void {\n\t\tthis._input()?.focus();\n\t}\n\n\t/** @internal */\n\tpublic registerInput(input: BrnInputOtpInput): void {\n\t\tthis._input.set(input);\n\t}\n\n\t/** @internal */\n\tpublic unregisterInput(input: BrnInputOtpInput): void {\n\t\tif (this._input() === input) {\n\t\t\tthis._input.set(null);\n\t\t}\n\t}\n\n\t/** @internal */\n\tpublic onFocus(): void {\n\t\tthis._focused.set(true);\n\t}\n\n\t/** @internal */\n\tpublic onBlur(): void {\n\t\tthis._focused.set(false);\n\t\tthis._onTouched?.();\n\t}\n\n\t/** CONTROL VALUE ACCESSOR */\n\twriteValue(value: string | null): void {\n\t\tconst sanitizedValue = this.sanitizeValue(value);\n\n\t\tthis.value.set(sanitizedValue);\n\n\t\tif (sanitizedValue.length === this.length()) {\n\t\t\tthis.completed.emit(sanitizedValue);\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._disabled.set(isDisabled);\n\t}\n\n\tprivate isCompleted(newValue: string, previousValue: string, length: number) {\n\t\treturn newValue !== previousValue && previousValue.length < length && newValue.length === length;\n\t}\n\n\t/** @internal */\n\tpublic updateValue(newValue: string): void {\n\t\tconst previousValue = this.value() ?? '';\n\t\tconst length = this.length();\n\t\tconst sanitizedValue = this.sanitizeValue(newValue);\n\n\t\tthis.value.set(sanitizedValue);\n\t\tthis.valueChange.emit(sanitizedValue);\n\t\tthis._onChange?.(sanitizedValue);\n\n\t\tif (this.isCompleted(sanitizedValue, previousValue, length)) {\n\t\t\tthis.completed.emit(sanitizedValue);\n\t\t}\n\t}\n}\n\nfunction toCharRegex(pattern: string | RegExp): RegExp {\n\tif (pattern instanceof RegExp) {\n\t\t// Strip stateful flags so repeated .test() calls remain deterministic.\n\t\treturn new RegExp(`^(?:${pattern.source})$`, pattern.flags.replace(/[gy]/g, ''));\n\t}\n\n\treturn new RegExp(`^(?:${pattern})$`);\n}\n","import type { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, DestroyRef, Directive, ElementRef, inject, input } from '@angular/core';\nimport { BrnFieldControlDescribedBy } from '@spartan-ng/brain/field';\nimport { injectBrnInputOtp } from './brn-input-otp.token';\n\nexport type InputMode = 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n\nconst DEFAULT_INPUT_STYLES =\n\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\n@Directive({\n\tselector: 'input[brnInputOtpInput]',\n\texportAs: 'brnInputOtpInput',\n\thostDirectives: [{ directive: BrnFieldControlDescribedBy, inputs: ['aria-describedby'] }],\n\thost: {\n\t\t'data-slot': 'input-otp',\n\t\t'[id]': '_otp.inputId()',\n\t\t'[attr.autocomplete]': 'autocomplete()',\n\t\t'[attr.inputmode]': 'inputMode()',\n\t\t'[attr.aria-invalid]': '_ariaInvalid() ? \"true\" : null',\n\t\t'[disabled]': '_otp.disabledState()',\n\t\t'[value]': '_otp.value() ?? \"\"',\n\t\t'[style]': '_inputStyles()',\n\t\t'(input)': 'onInputChange()',\n\t\t'(paste)': 'onPaste($event)',\n\t\t'(focus)': '_otp.onFocus()',\n\t\t'(blur)': '_otp.onBlur()',\n\t},\n})\nexport class BrnInputOtpInput {\n\tprivate readonly _destroyRef = inject(DestroyRef);\n\tprivate readonly _elementRef = inject<ElementRef<HTMLInputElement>>(ElementRef);\n\n\tprotected readonly _otp = injectBrnInputOtp();\n\n\t/** Custom autocomplete attribute applied to the input element */\n\tpublic readonly autocomplete = input<'one-time-code' | 'off'>('one-time-code');\n\n\t/** Virtual keyboard appearance on mobile */\n\tpublic readonly inputMode = input<InputMode>('numeric');\n\n\t/** Styles applied to the input element to make it invisible and clickable. */\n\tpublic readonly inputStyles = input<string | undefined>(undefined);\n\n\t/** Overrides the error state matcher and forceInvalid for aria-invalid. */\n\tpublic readonly ariaInvalidInput = input<boolean | undefined, BooleanInput>(undefined, {\n\t\ttransform: (v: BooleanInput) => (v === '' || v === undefined ? undefined : booleanAttribute(v)),\n\t\talias: 'aria-invalid',\n\t});\n\n\tprotected readonly _ariaInvalid = computed(() => this.ariaInvalidInput() ?? this._otp.spartanInvalid());\n\tprotected readonly _inputStyles = computed(() => this.inputStyles() ?? DEFAULT_INPUT_STYLES);\n\n\tconstructor() {\n\t\tthis._otp.registerInput(this);\n\t\tthis._destroyRef.onDestroy(() => this._otp.unregisterInput(this));\n\t}\n\n\t/** Focus the underlying input element. */\n\tpublic focus(): void {\n\t\tthis._elementRef.nativeElement.focus();\n\t}\n\n\tprotected onInputChange(): void {\n\t\tconst input = this._elementRef.nativeElement;\n\t\tconst length = this._otp.length();\n\n\t\t// Do not clamp here so that typing when the input is full replaces the\n\t\t// last character instead of dropping the newly typed character.\n\t\tlet sanitized = this._otp.sanitizeValue(input.value, false);\n\n\t\tif (sanitized.length > length) {\n\t\t\tsanitized = sanitized.slice(0, length - 1) + sanitized.slice(-1);\n\t\t}\n\n\t\tsanitized = sanitized.slice(0, length);\n\n\t\tif (input.value !== sanitized) {\n\t\t\tinput.value = sanitized;\n\t\t\tthis.setSelectionRange(sanitized.length, sanitized.length);\n\t\t}\n\n\t\tthis._otp.updateValue(sanitized);\n\t}\n\n\tprotected onPaste(event: ClipboardEvent): void {\n\t\tevent.preventDefault();\n\t\tconst input = this._elementRef.nativeElement;\n\t\tconst clipboardData = event.clipboardData?.getData('text/plain') || '';\n\t\tconst length = this._otp.length();\n\n\t\tconst content = this._otp.transformPaste()(clipboardData, length);\n\t\tconst sanitized = this._otp.sanitizeValue(content);\n\n\t\tinput.value = sanitized;\n\t\tthis.setSelectionRange(sanitized.length, sanitized.length);\n\t\tthis._otp.updateValue(sanitized);\n\t}\n\n\tprivate setSelectionRange(start: number, end: number): void {\n\t\tconst input = this._elementRef.nativeElement;\n\n\t\t// Number/date/email inputs throw when setSelectionRange is called.\n\t\tif (!['text', 'search', 'url', 'tel', 'password'].includes(input.type)) {\n\t\t\treturn;\n\t\t}\n\n\t\tinput.setSelectionRange(start, end);\n\t}\n}\n","import type { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, 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\texportAs: 'brnInputOtpSlot',\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\thost: {\n\t\t'[attr.data-active]': '_slot().isActive',\n\t\t'[attr.data-invalid]': '_ariaInvalid?.() ? \"true\" : null',\n\t\t'[attr.data-touched]': '_touched?.() ? \"true\" : null',\n\t\t'[attr.data-dirty]': '_dirty?.() ? \"true\" : null',\n\t\t'[attr.data-matches-spartan-invalid]': '_spartanInvalid() ? \"true\" : null',\n\t},\n\ttemplate: `\n\t\t{{ _slot().displayChar }}\n\n\t\t@if (_slot().hasFakeCaret) {\n\t\t\t<ng-content />\n\t\t}\n\t`,\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\t/** Whether to force the input into an invalid state. */\n\tpublic readonly forceInvalid = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\tprotected readonly _slot = computed(\n\t\t() =>\n\t\t\tthis._inputOtp.context()[this.index()] ?? {\n\t\t\t\tchar: null,\n\t\t\t\tdisplayChar: null,\n\t\t\t\tisActive: false,\n\t\t\t\thasFakeCaret: false,\n\t\t\t},\n\t);\n\n\tprotected readonly _ariaInvalid = this._inputOtp.invalid;\n\tprotected readonly _touched = this._inputOtp.touched;\n\tprotected readonly _dirty = this._inputOtp.dirty;\n\tprotected readonly _spartanInvalid = computed(() => this.forceInvalid() || this._inputOtp.spartanInvalid?.());\n}\n","import { BrnInputOtp } from './lib/brn-input-otp';\nimport { BrnInputOtpInput } from './lib/brn-input-otp-input';\nimport { BrnInputOtpSlot } from './lib/brn-input-otp-slot';\n\nexport * from './lib/brn-input-otp';\nexport * from './lib/brn-input-otp-input';\nexport * from './lib/brn-input-otp-slot';\nexport * from './lib/brn-input-otp.token';\n\nexport const BrnInputOtpImports = [BrnInputOtp, BrnInputOtpInput, BrnInputOtpSlot] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAGa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C/C,oBAAA,IAAI,EAAE;AACL,wBAAA,oBAAoB,EAAE,kBAAkB;AACxC,wBAAA,qBAAqB,EAAE,kCAAkC;AACzD,wBAAA,qBAAqB,EAAE,8BAA8B;AACrD,wBAAA,mBAAmB,EAAE,4BAA4B;AACjD,wBAAA,qCAAqC,EAAE,mCAAmC;AAC1E,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;AAMT,CAAA,CAAA;AACD,iBAAA;;;ACbM,MAAM,kBAAkB,GAAG,CAAC,WAAW,EAAE,gBAAgB,EAAE,eAAe;;ACTjF;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spartan-ng/brain",
3
- "version": "1.11.0",
3
+ "version": "1.11.1-beta.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/spartan-ng/spartan.git"
@@ -17,6 +17,9 @@ declare class BrnInputOtpInput {
17
17
  readonly inputMode: _angular_core.InputSignal<InputMode>;
18
18
  /** Styles applied to the input element to make it invisible and clickable. */
19
19
  readonly inputStyles: _angular_core.InputSignal<string | undefined>;
20
+ /** Overrides the error state matcher and forceInvalid for aria-invalid. */
21
+ readonly ariaInvalidInput: _angular_core.InputSignalWithTransform<boolean | undefined, BooleanInput>;
22
+ protected readonly _ariaInvalid: _angular_core.Signal<boolean | null | undefined>;
20
23
  protected readonly _inputStyles: _angular_core.Signal<string>;
21
24
  constructor();
22
25
  /** Focus the underlying input element. */
@@ -25,7 +28,7 @@ declare class BrnInputOtpInput {
25
28
  protected onPaste(event: ClipboardEvent): void;
26
29
  private setSelectionRange;
27
30
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnInputOtpInput, never>;
28
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnInputOtpInput, "input[brnInputOtpInput]", ["brnInputOtpInput"], { "autocomplete": { "alias": "autocomplete"; "required": false; "isSignal": true; }; "inputMode": { "alias": "inputMode"; "required": false; "isSignal": true; }; "inputStyles": { "alias": "inputStyles"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
31
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnInputOtpInput, "input[brnInputOtpInput]", ["brnInputOtpInput"], { "autocomplete": { "alias": "autocomplete"; "required": false; "isSignal": true; }; "inputMode": { "alias": "inputMode"; "required": false; "isSignal": true; }; "inputStyles": { "alias": "inputStyles"; "required": false; "isSignal": true; }; "ariaInvalidInput": { "alias": "aria-invalid"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.BrnFieldControlDescribedBy; inputs: { "aria-describedby": "aria-describedby"; }; outputs: {}; }]>;
29
32
  }
30
33
 
31
34
  declare const BRN_INPUT_OTP_VALUE_ACCESSOR: {
@@ -39,7 +42,9 @@ declare class BrnInputOtp implements ControlValueAccessor {
39
42
  readonly invalid: _angular_core.Signal<boolean | null> | undefined;
40
43
  readonly touched: _angular_core.Signal<boolean | null> | undefined;
41
44
  readonly dirty: _angular_core.Signal<boolean | null> | undefined;
42
- readonly spartanInvalid: _angular_core.Signal<boolean | null> | undefined;
45
+ /** Whether to force the OTP into an invalid state. */
46
+ readonly forceInvalid: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
47
+ readonly spartanInvalid: _angular_core.Signal<boolean | null | undefined>;
43
48
  /** Whether the input has focus. */
44
49
  protected readonly _focused: _angular_core.WritableSignal<boolean>;
45
50
  /** Styles applied to the host element. */
@@ -114,7 +119,7 @@ declare class BrnInputOtp implements ControlValueAccessor {
114
119
  /** @internal */
115
120
  updateValue(newValue: string): void;
116
121
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnInputOtp, never>;
117
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnInputOtp, "brn-input-otp, [brnInputOtp]", ["brnInputOtp"], { "hostStyles": { "alias": "hostStyles"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "length": { "alias": "length"; "required": true; "isSignal": true; }; "slotPattern": { "alias": "slotPattern"; "required": false; "isSignal": true; }; "mask": { "alias": "mask"; "required": false; "isSignal": true; }; "maskChar": { "alias": "maskChar"; "required": false; "isSignal": true; }; "autofocus": { "alias": "autofocus"; "required": false; "isSignal": true; }; "transformPaste": { "alias": "transformPaste"; "required": false; "isSignal": true; }; "valueInput": { "alias": "value"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; "completed": "completed"; }, never, never, true, [{ directive: typeof i1.BrnFieldControl; inputs: {}; outputs: {}; }]>;
122
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnInputOtp, "brn-input-otp, [brnInputOtp]", ["brnInputOtp"], { "forceInvalid": { "alias": "forceInvalid"; "required": false; "isSignal": true; }; "hostStyles": { "alias": "hostStyles"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "length": { "alias": "length"; "required": true; "isSignal": true; }; "slotPattern": { "alias": "slotPattern"; "required": false; "isSignal": true; }; "mask": { "alias": "mask"; "required": false; "isSignal": true; }; "maskChar": { "alias": "maskChar"; "required": false; "isSignal": true; }; "autofocus": { "alias": "autofocus"; "required": false; "isSignal": true; }; "transformPaste": { "alias": "transformPaste"; "required": false; "isSignal": true; }; "valueInput": { "alias": "value"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; "completed": "completed"; }, never, never, true, [{ directive: typeof i1.BrnFieldControl; inputs: {}; outputs: {}; }]>;
118
123
  }
119
124
 
120
125
  declare class BrnInputOtpSlot {