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

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.
@@ -5,7 +5,7 @@ import { forwardRef, inject, DestroyRef, Renderer2, PLATFORM_ID, ElementRef, Cha
5
5
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
6
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
7
7
  import * as i1 from '@spartan-ng/brain/field';
8
- import { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';
8
+ import { BrnFieldControl, BrnFieldControlDescribedBy, provideBrnLabelable } from '@spartan-ng/brain/field';
9
9
 
10
10
  const BRN_SWITCH_VALUE_ACCESSOR = {
11
11
  provide: NG_VALUE_ACCESSOR,
@@ -36,9 +36,10 @@ class BrnSwitch {
36
36
  /**
37
37
  * Unique identifier for switch component.
38
38
  * When provided, inner button gets ID without '-switch' suffix.
39
- * Auto-generates ID if not provided.
39
+ * Auto-generates ID when omitted or `null`, so wrappers can forward an optional id.
40
40
  */
41
- id = input(++uniqueIdCounter + '', ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
41
+ id = input(null, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
42
+ _autoId = `brn-switch-${++uniqueIdCounter}`;
42
43
  /**
43
44
  * Form control name for switch.
44
45
  * When provided, inner button gets name without '-switch' suffix.
@@ -105,7 +106,7 @@ class BrnSwitch {
105
106
  switch = viewChild.required('switch');
106
107
  _state = computed(() => {
107
108
  const name = this.name();
108
- const id = this.id();
109
+ const id = this.id() ?? this._autoId;
109
110
  return {
110
111
  disabled: signal(this.disabled()),
111
112
  name: name ? name + CONTAINER_POST_FIX : null,
@@ -236,6 +237,7 @@ class BrnSwitch {
236
237
  /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.16", type: BrnSwitch, isStandalone: true, selector: "brn-switch", inputs: { checkedInput: { classPropertyName: "checkedInput", 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 }, hostStyles: { classPropertyName: "hostStyles", publicName: "hostStyles", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, forceInvalid: { classPropertyName: "forceInvalid", publicName: "forceInvalid", 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 }, requiredInput: { classPropertyName: "requiredInput", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "checkedChange", touched: "touched" }, host: { properties: { "style": "hostStyles()", "attr.id": "_state().id", "attr.name": "_state().name", "attr.aria-labelledby": "null", "attr.aria-label": "null", "attr.aria-describedby": "null", "attr.data-dirty": "_dirty?.() ? \"true\": null", "attr.data-touched": "_touched?.() ? \"true\" : null", "attr.data-matches-spartan-invalid": "_spartanInvalid?.() ? \"true\" : null", "attr.data-state": "checked() ? \"checked\" : \"unchecked\"", "attr.data-focus-visible": "_focusVisible()", "attr.data-focus": "_focused()", "attr.data-disabled": "_state().disabled()" } }, providers: [BRN_SWITCH_VALUE_ACCESSOR, provideBrnLabelable(BrnSwitch)], viewQueries: [{ propertyName: "switch", first: true, predicate: ["switch"], descendants: true, isSignal: true }], exportAs: ["brnSwitch"], hostDirectives: [{ directive: i1.BrnFieldControl }], ngImport: i0, template: `
237
238
  <button
238
239
  #switch
240
+ brnFieldControlDescribedBy
239
241
  role="switch"
240
242
  type="button"
241
243
  [attr.data-size]="size()"
@@ -247,7 +249,7 @@ class BrnSwitch {
247
249
  [attr.aria-required]="required() ? 'true' : null"
248
250
  [attr.aria-label]="ariaLabel() || null"
249
251
  [attr.aria-labelledby]="mutableAriaLabelledby() || null"
250
- [attr.aria-describedby]="ariaDescribedby() || null"
252
+ [aria-describedby]="ariaDescribedby()"
251
253
  [attr.aria-invalid]="_spartanInvalid() ? 'true' : null"
252
254
  [attr.data-dirty]="_dirty?.() ? 'true' : null"
253
255
  [attr.data-touched]="_touched?.() ? 'true' : null"
@@ -262,13 +264,14 @@ class BrnSwitch {
262
264
  >
263
265
  <ng-content />
264
266
  </button>
265
- `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
267
+ `, isInline: true, dependencies: [{ kind: "directive", type: BrnFieldControlDescribedBy, selector: "[brnFieldControlDescribedBy]", inputs: ["aria-describedby"], exportAs: ["brnFieldControlDescribedBy"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
266
268
  }
267
269
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnSwitch, decorators: [{
268
270
  type: Component,
269
271
  args: [{
270
272
  selector: 'brn-switch',
271
273
  exportAs: 'brnSwitch',
274
+ imports: [BrnFieldControlDescribedBy],
272
275
  providers: [BRN_SWITCH_VALUE_ACCESSOR, provideBrnLabelable(BrnSwitch)],
273
276
  changeDetection: ChangeDetectionStrategy.OnPush,
274
277
  hostDirectives: [BrnFieldControl],
@@ -290,6 +293,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
290
293
  template: `
291
294
  <button
292
295
  #switch
296
+ brnFieldControlDescribedBy
293
297
  role="switch"
294
298
  type="button"
295
299
  [attr.data-size]="size()"
@@ -301,7 +305,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
301
305
  [attr.aria-required]="required() ? 'true' : null"
302
306
  [attr.aria-label]="ariaLabel() || null"
303
307
  [attr.aria-labelledby]="mutableAriaLabelledby() || null"
304
- [attr.aria-describedby]="ariaDescribedby() || null"
308
+ [aria-describedby]="ariaDescribedby()"
305
309
  [attr.aria-invalid]="_spartanInvalid() ? 'true' : null"
306
310
  [attr.data-dirty]="_dirty?.() ? 'true' : null"
307
311
  [attr.data-touched]="_touched?.() ? 'true' : null"
@@ -1 +1 @@
1
- {"version":3,"file":"spartan-ng-brain-switch.mjs","sources":["../../../../libs/brain/switch/src/lib/brn-switch.ts","../../../../libs/brain/switch/src/lib/brn-switch-thumb.ts","../../../../libs/brain/switch/src/index.ts","../../../../libs/brain/switch/src/spartan-ng-brain-switch.ts"],"sourcesContent":["import { FocusMonitor } from '@angular/cdk/a11y';\nimport type { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n\ttype AfterContentInit,\n\tafterRenderEffect,\n\tbooleanAttribute,\n\tChangeDetectionStrategy,\n\tChangeDetectorRef,\n\tComponent,\n\tcomputed,\n\tDestroyRef,\n\tDOCUMENT,\n\tElementRef,\n\tforwardRef,\n\tinject,\n\tinput,\n\tlinkedSignal,\n\tnumberAttribute,\n\ttype OnDestroy,\n\toutput,\n\tPLATFORM_ID,\n\tRenderer2,\n\tsignal,\n\tviewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\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';\n\nexport const BRN_SWITCH_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnSwitch),\n\tmulti: true,\n};\n\nexport type BrnSwitchSize = 'default' | 'sm';\n\nconst CONTAINER_POST_FIX = '-switch';\n\nlet uniqueIdCounter = 0;\n\n@Component({\n\tselector: 'brn-switch',\n\texportAs: 'brnSwitch',\n\tproviders: [BRN_SWITCH_VALUE_ACCESSOR, provideBrnLabelable(BrnSwitch)],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\thostDirectives: [BrnFieldControl],\n\thost: {\n\t\t'[style]': 'hostStyles()',\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-dirty]': '_dirty?.() ? \"true\": null',\n\t\t'[attr.data-touched]': '_touched?.() ? \"true\" : null',\n\t\t'[attr.data-matches-spartan-invalid]': '_spartanInvalid?.() ? \"true\" : null',\n\t\t'[attr.data-state]': 'checked() ? \"checked\" : \"unchecked\"',\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\ttemplate: `\n\t\t<button\n\t\t\t#switch\n\t\t\trole=\"switch\"\n\t\t\ttype=\"button\"\n\t\t\t[attr.data-size]=\"size()\"\n\t\t\t[class]=\"class()\"\n\t\t\t[id]=\"getSwitchButtonId(_state().id) ?? ''\"\n\t\t\t[name]=\"getSwitchButtonId(_state().name) ?? ''\"\n\t\t\t[value]=\"checked() ? 'on' : 'off'\"\n\t\t\t[attr.aria-checked]=\"checked()\"\n\t\t\t[attr.aria-required]=\"required() ? 'true' : null\"\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.aria-invalid]=\"_spartanInvalid() ? 'true' : null\"\n\t\t\t[attr.data-dirty]=\"_dirty?.() ? 'true' : null\"\n\t\t\t[attr.data-touched]=\"_touched?.() ? 'true' : null\"\n\t\t\t[attr.data-matches-spartan-invalid]=\"_spartanInvalid() ? 'true' : null\"\n\t\t\t[attr.data-state]=\"checked() ? 'checked' : 'unchecked'\"\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]=\"tabIndex()\"\n\t\t\t(click)=\"$event.preventDefault(); toggle()\"\n\t\t>\n\t\t\t<ng-content />\n\t\t</button>\n\t`,\n})\nexport class BrnSwitch implements AfterContentInit, OnDestroy, ControlValueAccessor {\n\tprivate readonly _destroyRef = inject(DestroyRef);\n\tprivate readonly _renderer = inject(Renderer2);\n\tprivate readonly _isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\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 _fieldControl = inject(BrnFieldControl, { optional: true });\n\n\tprotected readonly _focusVisible = signal(false);\n\tprotected readonly _focused = signal(false);\n\n\t/**\n\t * Whether switch is checked/toggled on.\n\t * Can be bound with [(checked)] for two-way binding.\n\t */\n\tpublic readonly checkedInput = input<boolean, BooleanInput>(false, { alias: 'checked', transform: booleanAttribute });\n\tpublic readonly checked = linkedSignal(this.checkedInput);\n\n\t/** Emits when checked state changes. */\n\tpublic readonly checkedChange = output<boolean>();\n\n\t/**\n\t * Unique identifier for switch component.\n\t * When provided, inner button gets ID without '-switch' 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 switch.\n\t * When provided, inner button gets name without '-switch' 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 * Styles applied to the host element. Bound via `[style]` so they apply through the CSSOM and are\n\t * not blocked by a strict Content-Security-Policy.\n\t */\n\tpublic readonly hostStyles = input<string>('display: contents');\n\n\t/**\n\t * Size of the switch.\n\t * Drives the size-keyed registry style rules via the `data-size` attribute.\n\t * @default 'default'\n\t */\n\tpublic readonly size = input<BrnSwitchSize>('default');\n\n\t/** Whether to force the input into an invalid state. */\n\tpublic readonly forceInvalid = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\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 switch for accessibility.\n\t * Auto-set when switch 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 switch for accessibility.\n\t */\n\tpublic readonly ariaDescribedby = input<string | null>(null, { alias: 'aria-describedby' });\n\n\t/**\n\t * Whether switch is required in a form.\n\t */\n\tpublic readonly requiredInput = input<boolean, BooleanInput>(false, {\n\t\talias: 'required',\n\t\ttransform: booleanAttribute,\n\t});\n\tprivate readonly _hostRequired = this._elementRef.nativeElement.hasAttribute('required');\n\tpublic readonly required = computed(() => this._hostRequired || this.requiredInput());\n\n\t/**\n\t * Whether switch is disabled.\n\t * Disabled switches cannot be toggled and indicate disabled state with data attribute.\n\t */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/**\n\t * Keyboard tab order for switch.\n\t * @default 0\n\t */\n\tpublic readonly tabIndex = input<number, NumberInput>(0, { transform: numberAttribute });\n\n\t/**\n\t * Event emitted when switch is blurred (loses focus).\n\t * Used for form validation.\n\t */\n\tpublic readonly touched = output<void>();\n\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprotected _onChange: ChangeFn<boolean> = () => {};\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprivate _onTouched: TouchFn = () => {};\n\n\tpublic readonly switch = viewChild.required<ElementRef<HTMLInputElement>>('switch');\n\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\tpublic readonly controlState = this._fieldControl?.controlState;\n\n\tprotected readonly _invalid = this._fieldControl?.invalid;\n\tprotected readonly _touched = this._fieldControl?.touched;\n\tprotected readonly _dirty = this._fieldControl?.dirty;\n\tprotected readonly _spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid());\n\n\tpublic readonly labelableId = computed(() => this.getSwitchButtonId(this._state().id));\n\n\tconstructor() {\n\t\tafterRenderEffect(() => {\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 switchButtonId = this.getSwitchButtonId(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=\"${switchButtonId}\"]`);\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 switch between checked/unchecked states.\n\t * Does nothing if switch is disabled.\n\t */\n\tprotected toggle(): void {\n\t\tif (this._state().disabled()) return;\n\n\t\tthis._onTouched();\n\t\tthis.touched.emit();\n\n\t\tthis.checked.update((checked) => !checked);\n\t\tthis._onChange(this.checked());\n\t\tthis.checkedChange.emit(this.checked());\n\t}\n\n\tpublic ngAfterContentInit(): void {\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\n\t\tif (!this.switch()) return;\n\t\tthis.switch().nativeElement.value = this.checked() ? 'on' : 'off';\n\t\tthis.switch().nativeElement.dispatchEvent(new Event('change'));\n\t}\n\n\tpublic ngOnDestroy() {\n\t\tthis._focusMonitor.stopMonitoring(this._elementRef);\n\t}\n\n\t/**\n\t * Gets proper ID for inner button element.\n\t * Removes '-switch' 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 getSwitchButtonId(idPassedToContainer: string | null | undefined): string | null {\n\t\treturn idPassedToContainer ? idPassedToContainer.replace(new RegExp(CONTAINER_POST_FIX + '$'), '') : null;\n\t}\n\n\t/**\n\t * Updates internal state when control value changes from outside.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param value - New checked state\n\t */\n\tpublic writeValue(value: boolean): void {\n\t\tthis.checked.set(Boolean(value));\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\tpublic registerOnChange(fn: ChangeFn<boolean>): 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\tpublic registerOnTouched(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 switch should be disabled\n\t */\n\tpublic setDisabledState(isDisabled: boolean): void {\n\t\tthis._state().disabled.set(isDisabled);\n\t\tthis._cdr.markForCheck();\n\t}\n}\n","import { Directive, inject } from '@angular/core';\nimport { BrnSwitch } from './brn-switch';\n\n@Directive({\n\tselector: '[brnSwitchThumb],brn-switch-thumb',\n\texportAs: 'brnSwitchThumb',\n\thost: {\n\t\trole: 'presentation',\n\t\t'[attr.data-state]': \"_switch.checked() ? 'checked' : 'unchecked'\",\n\t\t'(click)': '$event.preventDefault()',\n\t},\n})\nexport class BrnSwitchThumb {\n\tprotected readonly _switch = inject(BrnSwitch);\n}\n","import { BrnSwitch } from './lib/brn-switch';\nimport { BrnSwitchThumb } from './lib/brn-switch-thumb';\n\nexport * from './lib/brn-switch';\nexport * from './lib/brn-switch-thumb';\n\nexport const BrnSwitchImports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ADlC,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;+GAAd,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mCAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,MAAA,EAAA,cAAA,EAAA,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,yBAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,6CAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAT1B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,mCAAmC;AAC7C,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,IAAI,EAAE;AACL,wBAAA,IAAI,EAAE,cAAc;AACpB,wBAAA,mBAAmB,EAAE,6CAA6C;AAClE,wBAAA,SAAS,EAAE,yBAAyB;AACpC,qBAAA;AACD,iBAAA;;;MCLY,gBAAgB,GAAG,CAAC,SAAS,EAAE,cAAc;;ACN1D;;AAEG;;;;"}
1
+ {"version":3,"file":"spartan-ng-brain-switch.mjs","sources":["../../../../libs/brain/switch/src/lib/brn-switch.ts","../../../../libs/brain/switch/src/lib/brn-switch-thumb.ts","../../../../libs/brain/switch/src/index.ts","../../../../libs/brain/switch/src/spartan-ng-brain-switch.ts"],"sourcesContent":["import { FocusMonitor } from '@angular/cdk/a11y';\nimport type { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n\ttype AfterContentInit,\n\tafterRenderEffect,\n\tbooleanAttribute,\n\tChangeDetectionStrategy,\n\tChangeDetectorRef,\n\tComponent,\n\tcomputed,\n\tDestroyRef,\n\tDOCUMENT,\n\tElementRef,\n\tforwardRef,\n\tinject,\n\tinput,\n\tlinkedSignal,\n\tnumberAttribute,\n\ttype OnDestroy,\n\toutput,\n\tPLATFORM_ID,\n\tRenderer2,\n\tsignal,\n\tviewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { type ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BrnFieldControl, BrnFieldControlDescribedBy, provideBrnLabelable } from '@spartan-ng/brain/field';\nimport type { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';\n\nexport const BRN_SWITCH_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnSwitch),\n\tmulti: true,\n};\n\nexport type BrnSwitchSize = 'default' | 'sm';\n\nconst CONTAINER_POST_FIX = '-switch';\n\nlet uniqueIdCounter = 0;\n\n@Component({\n\tselector: 'brn-switch',\n\texportAs: 'brnSwitch',\n\timports: [BrnFieldControlDescribedBy],\n\tproviders: [BRN_SWITCH_VALUE_ACCESSOR, provideBrnLabelable(BrnSwitch)],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\thostDirectives: [BrnFieldControl],\n\thost: {\n\t\t'[style]': 'hostStyles()',\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-dirty]': '_dirty?.() ? \"true\": null',\n\t\t'[attr.data-touched]': '_touched?.() ? \"true\" : null',\n\t\t'[attr.data-matches-spartan-invalid]': '_spartanInvalid?.() ? \"true\" : null',\n\t\t'[attr.data-state]': 'checked() ? \"checked\" : \"unchecked\"',\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\ttemplate: `\n\t\t<button\n\t\t\t#switch\n\t\t\tbrnFieldControlDescribedBy\n\t\t\trole=\"switch\"\n\t\t\ttype=\"button\"\n\t\t\t[attr.data-size]=\"size()\"\n\t\t\t[class]=\"class()\"\n\t\t\t[id]=\"getSwitchButtonId(_state().id) ?? ''\"\n\t\t\t[name]=\"getSwitchButtonId(_state().name) ?? ''\"\n\t\t\t[value]=\"checked() ? 'on' : 'off'\"\n\t\t\t[attr.aria-checked]=\"checked()\"\n\t\t\t[attr.aria-required]=\"required() ? 'true' : null\"\n\t\t\t[attr.aria-label]=\"ariaLabel() || null\"\n\t\t\t[attr.aria-labelledby]=\"mutableAriaLabelledby() || null\"\n\t\t\t[aria-describedby]=\"ariaDescribedby()\"\n\t\t\t[attr.aria-invalid]=\"_spartanInvalid() ? 'true' : null\"\n\t\t\t[attr.data-dirty]=\"_dirty?.() ? 'true' : null\"\n\t\t\t[attr.data-touched]=\"_touched?.() ? 'true' : null\"\n\t\t\t[attr.data-matches-spartan-invalid]=\"_spartanInvalid() ? 'true' : null\"\n\t\t\t[attr.data-state]=\"checked() ? 'checked' : 'unchecked'\"\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]=\"tabIndex()\"\n\t\t\t(click)=\"$event.preventDefault(); toggle()\"\n\t\t>\n\t\t\t<ng-content />\n\t\t</button>\n\t`,\n})\nexport class BrnSwitch implements AfterContentInit, OnDestroy, ControlValueAccessor {\n\tprivate readonly _destroyRef = inject(DestroyRef);\n\tprivate readonly _renderer = inject(Renderer2);\n\tprivate readonly _isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\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 _fieldControl = inject(BrnFieldControl, { optional: true });\n\n\tprotected readonly _focusVisible = signal(false);\n\tprotected readonly _focused = signal(false);\n\n\t/**\n\t * Whether switch is checked/toggled on.\n\t * Can be bound with [(checked)] for two-way binding.\n\t */\n\tpublic readonly checkedInput = input<boolean, BooleanInput>(false, { alias: 'checked', transform: booleanAttribute });\n\tpublic readonly checked = linkedSignal(this.checkedInput);\n\n\t/** Emits when checked state changes. */\n\tpublic readonly checkedChange = output<boolean>();\n\n\t/**\n\t * Unique identifier for switch component.\n\t * When provided, inner button gets ID without '-switch' suffix.\n\t * Auto-generates ID when omitted or `null`, so wrappers can forward an optional id.\n\t */\n\tpublic readonly id = input<string | null>(null);\n\tprivate readonly _autoId = `brn-switch-${++uniqueIdCounter}`;\n\n\t/**\n\t * Form control name for switch.\n\t * When provided, inner button gets name without '-switch' 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 * Styles applied to the host element. Bound via `[style]` so they apply through the CSSOM and are\n\t * not blocked by a strict Content-Security-Policy.\n\t */\n\tpublic readonly hostStyles = input<string>('display: contents');\n\n\t/**\n\t * Size of the switch.\n\t * Drives the size-keyed registry style rules via the `data-size` attribute.\n\t * @default 'default'\n\t */\n\tpublic readonly size = input<BrnSwitchSize>('default');\n\n\t/** Whether to force the input into an invalid state. */\n\tpublic readonly forceInvalid = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\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 switch for accessibility.\n\t * Auto-set when switch 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 switch for accessibility.\n\t */\n\tpublic readonly ariaDescribedby = input<string | null>(null, { alias: 'aria-describedby' });\n\n\t/**\n\t * Whether switch is required in a form.\n\t */\n\tpublic readonly requiredInput = input<boolean, BooleanInput>(false, {\n\t\talias: 'required',\n\t\ttransform: booleanAttribute,\n\t});\n\tprivate readonly _hostRequired = this._elementRef.nativeElement.hasAttribute('required');\n\tpublic readonly required = computed(() => this._hostRequired || this.requiredInput());\n\n\t/**\n\t * Whether switch is disabled.\n\t * Disabled switches cannot be toggled and indicate disabled state with data attribute.\n\t */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/**\n\t * Keyboard tab order for switch.\n\t * @default 0\n\t */\n\tpublic readonly tabIndex = input<number, NumberInput>(0, { transform: numberAttribute });\n\n\t/**\n\t * Event emitted when switch is blurred (loses focus).\n\t * Used for form validation.\n\t */\n\tpublic readonly touched = output<void>();\n\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprotected _onChange: ChangeFn<boolean> = () => {};\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprivate _onTouched: TouchFn = () => {};\n\n\tpublic readonly switch = viewChild.required<ElementRef<HTMLInputElement>>('switch');\n\n\tprotected readonly _state = computed(() => {\n\t\tconst name = this.name();\n\t\tconst id = this.id() ?? this._autoId;\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\tpublic readonly controlState = this._fieldControl?.controlState;\n\n\tprotected readonly _invalid = this._fieldControl?.invalid;\n\tprotected readonly _touched = this._fieldControl?.touched;\n\tprotected readonly _dirty = this._fieldControl?.dirty;\n\tprotected readonly _spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid());\n\n\tpublic readonly labelableId = computed(() => this.getSwitchButtonId(this._state().id));\n\n\tconstructor() {\n\t\tafterRenderEffect(() => {\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 switchButtonId = this.getSwitchButtonId(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=\"${switchButtonId}\"]`);\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 switch between checked/unchecked states.\n\t * Does nothing if switch is disabled.\n\t */\n\tprotected toggle(): void {\n\t\tif (this._state().disabled()) return;\n\n\t\tthis._onTouched();\n\t\tthis.touched.emit();\n\n\t\tthis.checked.update((checked) => !checked);\n\t\tthis._onChange(this.checked());\n\t\tthis.checkedChange.emit(this.checked());\n\t}\n\n\tpublic ngAfterContentInit(): void {\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\n\t\tif (!this.switch()) return;\n\t\tthis.switch().nativeElement.value = this.checked() ? 'on' : 'off';\n\t\tthis.switch().nativeElement.dispatchEvent(new Event('change'));\n\t}\n\n\tpublic ngOnDestroy() {\n\t\tthis._focusMonitor.stopMonitoring(this._elementRef);\n\t}\n\n\t/**\n\t * Gets proper ID for inner button element.\n\t * Removes '-switch' 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 getSwitchButtonId(idPassedToContainer: string | null | undefined): string | null {\n\t\treturn idPassedToContainer ? idPassedToContainer.replace(new RegExp(CONTAINER_POST_FIX + '$'), '') : null;\n\t}\n\n\t/**\n\t * Updates internal state when control value changes from outside.\n\t * Part of ControlValueAccessor interface.\n\t *\n\t * @param value - New checked state\n\t */\n\tpublic writeValue(value: boolean): void {\n\t\tthis.checked.set(Boolean(value));\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\tpublic registerOnChange(fn: ChangeFn<boolean>): 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\tpublic registerOnTouched(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 switch should be disabled\n\t */\n\tpublic setDisabledState(isDisabled: boolean): void {\n\t\tthis._state().disabled.set(isDisabled);\n\t\tthis._cdr.markForCheck();\n\t}\n}\n","import { Directive, inject } from '@angular/core';\nimport { BrnSwitch } from './brn-switch';\n\n@Directive({\n\tselector: '[brnSwitchThumb],brn-switch-thumb',\n\texportAs: 'brnSwitchThumb',\n\thost: {\n\t\trole: 'presentation',\n\t\t'[attr.data-state]': \"_switch.checked() ? 'checked' : 'unchecked'\",\n\t\t'(click)': '$event.preventDefault()',\n\t},\n})\nexport class BrnSwitchThumb {\n\tprotected readonly _switch = inject(BrnSwitch);\n}\n","import { BrnSwitch } from './lib/brn-switch';\nimport { BrnSwitchThumb } from './lib/brn-switch-thumb';\n\nexport * from './lib/brn-switch';\nexport * from './lib/brn-switch-thumb';\n\nexport const BrnSwitchImports = [BrnSwitch, BrnSwitchThumb] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AA+BO,MAAM,yBAAyB,GAAG;AACxC,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,SAAS,CAAC;AACxC,IAAA,KAAK,EAAE,IAAI;;AAKZ,MAAM,kBAAkB,GAAG,SAAS;AAEpC,IAAI,eAAe,GAAG,CAAC;MAwDV,SAAS,CAAA;AACJ,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAChC,IAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;IAC7B,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AACnD,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,aAAa,GAAG,MAAM,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,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AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,mCAAmC;AAC7C,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,IAAI,EAAE;AACL,wBAAA,IAAI,EAAE,cAAc;AACpB,wBAAA,mBAAmB,EAAE,6CAA6C;AAClE,wBAAA,SAAS,EAAE,yBAAyB;AACpC,qBAAA;AACD,iBAAA;;;MCLY,gBAAgB,GAAG,CAAC,SAAS,EAAE,cAAc;;ACN1D;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spartan-ng/brain",
3
- "version": "1.11.1-beta.1",
3
+ "version": "1.11.1-beta.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/spartan-ng/spartan.git"
@@ -48,9 +48,10 @@ declare class BrnCheckbox implements ControlValueAccessor, AfterContentInit, OnD
48
48
  /**
49
49
  * Unique identifier for checkbox component.
50
50
  * When provided, inner button gets ID without '-checkbox' suffix.
51
- * Auto-generates ID if not provided.
51
+ * Auto-generates ID when omitted or `null`, so wrappers can forward an optional id.
52
52
  */
53
53
  readonly id: _angular_core.InputSignal<string | null>;
54
+ private readonly _autoId;
54
55
  /**
55
56
  * Form control name for checkbox.
56
57
  * When provided, inner button gets name without '-checkbox' suffix.
@@ -52,7 +52,6 @@ declare class BrnOverlay<TResult = unknown, TContext extends Record<string, unkn
52
52
  private readonly _scrollStrategies;
53
53
  private readonly _injector;
54
54
  private readonly _directionality;
55
- private readonly _document;
56
55
  protected readonly _defaultOptions: BrnOverlayDefaultOptions;
57
56
  private readonly _overlayRef;
58
57
  private readonly _origin;
@@ -97,8 +96,8 @@ declare class BrnOverlay<TResult = unknown, TContext extends Record<string, unkn
97
96
  protected getAttachPositions(): BrnOverlayOptions['attachPositions'];
98
97
  protected getPositionStrategy(): BrnOverlayOptions['positionStrategy'];
99
98
  private getScrollStrategy;
100
- private _restoreFocus;
101
99
  private _syncPanelClass;
100
+ private _syncRestoreFocus;
102
101
  private _syncBackdropClass;
103
102
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnOverlay<any, any>, never>;
104
103
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnOverlay<any, any>, "[brnOverlay],brn-overlay", ["brnOverlay"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "role": { "alias": "role"; "required": false; "isSignal": true; }; "ariaModal": { "alias": "aria-modal"; "required": false; "isSignal": true; }; "hasBackdrop": { "alias": "hasBackdrop"; "required": false; "isSignal": true; }; "positionStrategy": { "alias": "positionStrategy"; "required": false; "isSignal": true; }; "scrollStrategy": { "alias": "scrollStrategy"; "required": false; "isSignal": true; }; "closeOnOutsidePointerEvents": { "alias": "closeOnOutsidePointerEvents"; "required": false; "isSignal": true; }; "attachTo": { "alias": "attachTo"; "required": false; "isSignal": true; }; "attachPositions": { "alias": "attachPositions"; "required": false; "isSignal": true; }; "disableClose": { "alias": "disableClose"; "required": false; "isSignal": true; }; "autoFocus": { "alias": "autoFocus"; "required": false; "isSignal": true; }; "restoreFocus": { "alias": "restoreFocus"; "required": false; "isSignal": true; }; }, { "closed": "closed"; "stateChanged": "stateChanged"; }, never, never, true, never>;
@@ -156,7 +155,10 @@ declare class BrnOverlayRef<OverlayResult = unknown> {
156
155
  private _closeGeneration;
157
156
  private _panelClasses;
158
157
  private _backdropClasses;
158
+ private _restoreFocus;
159
159
  get open(): boolean;
160
+ /** Whether focus is restored to the previously focused element when the overlay closes. */
161
+ get restoreFocus(): boolean;
160
162
  get id(): string;
161
163
  constructor(_overlayRef: OverlayRef, _injector: Injector, overlayId: number, initialOptions: BrnOverlayOptions, _onDisposed: () => void);
162
164
  close(result?: OverlayResult): void;
@@ -167,6 +169,7 @@ declare class BrnOverlayRef<OverlayResult = unknown> {
167
169
  forceClose(result?: OverlayResult): void;
168
170
  setPanelClass(panelClass: string | string[] | null | undefined): void;
169
171
  setBackdropClass(backdropClass: string | string[] | null | undefined): void;
172
+ setRestoreFocus(restoreFocus: boolean): void;
170
173
  updatePosition(): void;
171
174
  private _finishClose;
172
175
  private _dispose;
@@ -185,6 +188,7 @@ declare class BrnOverlayService {
185
188
  private readonly _interactivityChecker;
186
189
  private readonly _scrollDispatcher;
187
190
  private readonly _ngZone;
191
+ private readonly _document;
188
192
  private readonly _isBrowser;
189
193
  private readonly _defaultOptions;
190
194
  private readonly _openOverlayIds;
@@ -204,6 +208,11 @@ declare class BrnOverlayService {
204
208
  * trigger keeps it - this is what keeps the `aria-activedescendant` keyboard model working.
205
209
  */
206
210
  private _focusInitialElement;
211
+ /**
212
+ * Moves focus back to `element` if focus was lost (`body`, null or disconnected) while the
213
+ * overlay closed. Focus that moved elsewhere on purpose is left alone.
214
+ */
215
+ private _restoreFocus;
207
216
  private _firstTabbableElement;
208
217
  private _createProviders;
209
218
  private _configureElement;
@@ -17,6 +17,10 @@ declare class BrnProgress implements OnChanges {
17
17
  */
18
18
  readonly getValueLabel: _angular_core.InputSignal<BrnProgressLabelFn>;
19
19
  protected readonly _label: _angular_core.Signal<string | undefined>;
20
+ /**
21
+ * The current progress value as a percentage of the max, or `null` when indeterminate.
22
+ */
23
+ readonly percentage: _angular_core.Signal<number | null>;
20
24
  readonly state: _angular_core.Signal<"indeterminate" | "complete" | "loading">;
21
25
  ngOnChanges(changes: SimpleChanges): void;
22
26
  private validate;
@@ -27,6 +31,7 @@ type BrnProgressLabelFn = (value: number, max: number) => string;
27
31
 
28
32
  declare class BrnProgressIndicator {
29
33
  protected readonly _progress: _spartan_ng_brain_progress.BrnProgress;
34
+ protected readonly _width: _angular_core.Signal<string>;
30
35
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnProgressIndicator, never>;
31
36
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnProgressIndicator, "brn-progress-indicator", ["brnProgressIndicator"], {}, {}, never, never, true, never>;
32
37
  }
@@ -34,9 +34,10 @@ declare class BrnSwitch implements AfterContentInit, OnDestroy, ControlValueAcce
34
34
  /**
35
35
  * Unique identifier for switch component.
36
36
  * When provided, inner button gets ID without '-switch' suffix.
37
- * Auto-generates ID if not provided.
37
+ * Auto-generates ID when omitted or `null`, so wrappers can forward an optional id.
38
38
  */
39
39
  readonly id: _angular_core.InputSignal<string | null>;
40
+ private readonly _autoId;
40
41
  /**
41
42
  * Form control name for switch.
42
43
  * When provided, inner button gets name without '-switch' suffix.