@radix-ng/primitives 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/checkbox/src/checkbox.directive.d.ts +3 -2
- package/esm2022/alert-dialog/src/alert-dialog-cancel.directive.mjs +4 -4
- package/esm2022/alert-dialog/src/alert-dialog-content.directive.mjs +4 -4
- package/esm2022/alert-dialog/src/alert-dialog-root.directive.mjs +4 -4
- package/esm2022/alert-dialog/src/alert-dialog-title.directive.mjs +4 -4
- package/esm2022/alert-dialog/src/alert-dialog-trigger.directive.mjs +4 -4
- package/esm2022/alert-dialog/src/alert-dialog.service.mjs +4 -4
- package/esm2022/avatar/src/avatar-fallback.directive.mjs +4 -4
- package/esm2022/avatar/src/avatar-image.directive.mjs +4 -4
- package/esm2022/avatar/src/avatar-root.directive.mjs +4 -4
- package/esm2022/checkbox/src/checkbox-indicator.directive.mjs +4 -4
- package/esm2022/checkbox/src/checkbox.directive.mjs +16 -6
- package/esm2022/collapsible/src/collapsible-content.directive.mjs +4 -4
- package/esm2022/collapsible/src/collapsible-root.directive.mjs +4 -4
- package/esm2022/collapsible/src/collapsible-trigger.directive.mjs +4 -4
- package/esm2022/label/src/label-root.directive.mjs +4 -4
- package/esm2022/progress/src/progress-indicator.directive.mjs +4 -4
- package/esm2022/progress/src/progress-root.directive.mjs +4 -4
- package/esm2022/radio/src/radio-indicator.directive.mjs +4 -4
- package/esm2022/radio/src/radio-item.directive.mjs +4 -4
- package/esm2022/radio/src/radio-root.directive.mjs +14 -16
- package/esm2022/roving-focus/src/roving-focus-group.directive.mjs +4 -4
- package/esm2022/roving-focus/src/roving-focus-item.directive.mjs +4 -4
- package/esm2022/separator/src/separator.directive.mjs +4 -4
- package/esm2022/switch/index.mjs +2 -1
- package/esm2022/switch/src/switch-input.directive.mjs +30 -0
- package/esm2022/switch/src/switch-root.directive.mjs +14 -17
- package/esm2022/switch/src/switch-thumb.directive.mjs +5 -5
- package/esm2022/toggle/src/toggle-root.directive.mjs +9 -11
- package/esm2022/toggle-group/src/toggle-group-button.directive.mjs +9 -14
- package/esm2022/toggle-group/src/toggle-group-multi.directive.mjs +4 -4
- package/esm2022/toggle-group/src/toggle-group.directive.mjs +9 -12
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs +18 -18
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-avatar.mjs +9 -9
- package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-checkbox.mjs +18 -8
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-collapsible.mjs +9 -9
- package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-label.mjs +3 -3
- package/fesm2022/radix-ng-primitives-label.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-progress.mjs +6 -6
- package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-radio.mjs +18 -20
- package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-roving-focus.mjs +6 -6
- package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-separator.mjs +3 -3
- package/fesm2022/radix-ng-primitives-separator.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-switch.mjs +45 -21
- package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle-group.mjs +19 -27
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle.mjs +8 -10
- package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
- package/package.json +3 -3
- package/radio/src/radio-root.directive.d.ts +4 -5
- package/switch/index.d.ts +1 -0
- package/switch/src/switch-input.directive.d.ts +6 -0
- package/switch/src/switch-root.directive.d.ts +5 -6
- package/toggle/src/toggle-root.directive.d.ts +2 -2
- package/toggle-group/src/toggle-group-button.directive.d.ts +1 -4
- package/toggle-group/src/toggle-group.directive.d.ts +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-radio.mjs","sources":["../../../packages/primitives/radio/src/radio-root.directive.ts","../../../packages/primitives/radio/src/radio-item.directive.ts","../../../packages/primitives/radio/src/radio-indicator.directive.ts","../../../packages/primitives/radio/radix-ng-primitives-radio.ts"],"sourcesContent":["import {\n booleanAttribute,\n ChangeDetectorRef,\n Directive,\n EventEmitter,\n inject,\n InjectionToken,\n Input,\n Output\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { RdxRovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';\n\nexport const RdxRadioGroupToken = new InjectionToken<RdxRadioGroupDirective>('RdxRadioGroupToken');\n\nexport function injectRadioGroup(): RdxRadioGroupDirective {\n return inject(RdxRadioGroupToken);\n}\n\ninterface RadioGroupProps {\n name?: string;\n disabled?: boolean;\n // TODO: dir?: string;\n // TODO: loop?: string;\n defaultValue?: string;\n value?: string;\n onValueChange?: EventEmitter<string>;\n}\n\n@Directive({\n selector: 'div[RadioRoot]',\n exportAs: 'RadioRoot',\n standalone: true,\n providers: [\n { provide: RdxRadioGroupToken, useExisting: RdxRadioGroupDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: RdxRadioGroupDirective, multi: true }\n ],\n hostDirectives: [RdxRovingFocusGroupDirective],\n host: {\n role: 'radiogroup',\n '[attr.aria-orientation]': '_orientation',\n '[attr.data-disabled]': 'disabled ? \"\" : null',\n\n '(focusout)': '_onFocusout()'\n }\n})\nexport class RdxRadioGroupDirective implements RadioGroupProps, ControlValueAccessor {\n @Input('rdxValue') value?: string;\n\n @Input({ alias: 'rdxDisabled', transform: booleanAttribute }) disabled = false;\n\n /**\n * The orientation of the radio group only vertical.\n * Horizontal radio buttons can sometimes be challenging to scan and localize.\n * The horizontal arrangement of radio buttons may also lead to difficulties in determining which\n * label corresponds to which button: whether the label is above or below the button.\n * @default 'vertical'\n */\n readonly _orientation = 'vertical';\n\n /**\n * Event emitted when the value of the radio group changes.\n */\n @Output('rdxOnValueChange') readonly onValueChange = new EventEmitter<string>();\n\n /**\n * The callback function to call when the value of the radio group changes.\n * @internal\n */\n private onChange?: (value: string) => void;\n\n /**\n * The callback function to call when the radio group is touched.\n * @internal\n */\n private onTouched?: () => void;\n\n constructor(private readonly changeDetector: ChangeDetectorRef) {}\n\n /**\n * Select a radio item.\n * @param value The value of the radio item to select.\n */\n select(value: string): void {\n this.value = value;\n this.onValueChange.emit(value);\n this.onChange?.(value);\n }\n\n /**\n * Update the value of the radio group.\n * @param value The new value of the radio group.\n * @internal\n */\n writeValue(value: string): void {\n this.value = value;\n this.changeDetector.markForCheck();\n }\n\n /**\n * Register a callback function to call when the value of the radio group changes.\n * @param fn The callback function to call when the value of the radio group changes.\n * @internal\n */\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Set the disabled state of the radio group.\n * @param isDisabled Whether the radio group is disabled.\n * @internal\n */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this.changeDetector.markForCheck();\n }\n\n /**\n * When focus leaves the radio group.\n */\n _onFocusout(): void {\n this.onTouched?.();\n }\n}\n","import { booleanAttribute, Directive, inject, InjectionToken, Input } from '@angular/core';\n\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { RdxRovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';\n\nimport { injectRadioGroup } from './radio-root.directive';\n\nexport const RdxRadioItemToken = new InjectionToken<RdxRadioItemDirective>('RadioItemToken');\n\nexport function injectRadioItem(): RdxRadioItemDirective {\n return inject(RdxRadioItemToken);\n}\n\n// Increasing integer for generating unique ids for radio components.\nlet nextUniqueId = 0;\n\n@Directive({\n selector: '[RadioItem]',\n exportAs: 'RadioItem',\n standalone: true,\n hostDirectives: [RdxRovingFocusItemDirective],\n providers: [{ provide: RdxRadioItemToken, useExisting: RdxRadioItemDirective }],\n host: {\n type: 'button',\n role: 'radio',\n '[attr.id]': 'id',\n '[attr.aria-checked]': 'radioGroup.value === value ? \"true\" : \"false\"',\n '[attr.data-disabled]': 'disabled ? \"\" : null',\n '[attr.data-state]': 'radioGroup.value === value ? \"checked\" : \"unchecked\"',\n\n '(focus)': '_onFocus()',\n '(click)': '_onClick()',\n '(keydown)': '_onKeydown($event)'\n }\n})\nexport class RdxRadioItemDirective {\n protected readonly radioGroup = injectRadioGroup();\n\n @Input() id = `rdx-radio-${++nextUniqueId}`;\n\n @Input({ required: true }) value!: string;\n\n @Input({ transform: booleanAttribute }) disabled = false;\n\n _onKeydown(event: KeyboardEvent): void {\n // According to WAI ARIA, radio groups don't activate items on enter keypress\n if (event.key === 'Enter') {\n event.preventDefault();\n }\n }\n\n _onFocus(): void {\n this.radioGroup.select(this.value);\n }\n\n _onClick(): void {\n console.log('click');\n this.radioGroup.select(this.value);\n }\n}\n","import { Directive } from '@angular/core';\n\nimport { injectRadioItem } from './radio-item.directive';\nimport { injectRadioGroup } from './radio-root.directive';\n\n@Directive({\n selector: '[RadioIndicator]',\n exportAs: 'RadioIndicator',\n standalone: true,\n host: {\n '[attr.data-state]': 'radioGroup.value === this.radioItem.value ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'radioItem.disabled ? \"\" : null'\n }\n})\nexport class RdxRadioIndicatorDirective {\n protected readonly radioGroup = injectRadioGroup();\n\n protected readonly radioItem = injectRadioItem();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAea,kBAAkB,GAAG,IAAI,cAAc,CAAyB,oBAAoB,EAAE;SAEnF,gBAAgB,GAAA;AAC5B,IAAA,OAAO,MAAM,CAAC,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EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;4FAA1B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBATtC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,mBAAmB,EAAE,qEAAqE;AAC1F,wBAAA,sBAAsB,EAAE,gCAAgC;AAC3D,qBAAA;AACJ,iBAAA,CAAA;;;ACbD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"radix-ng-primitives-radio.mjs","sources":["../../../packages/primitives/radio/src/radio-root.directive.ts","../../../packages/primitives/radio/src/radio-item.directive.ts","../../../packages/primitives/radio/src/radio-indicator.directive.ts","../../../packages/primitives/radio/radix-ng-primitives-radio.ts"],"sourcesContent":["import {\n booleanAttribute,\n Directive,\n EventEmitter,\n inject,\n InjectionToken,\n Input,\n Output\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { RdxRovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';\n\nexport const RdxRadioGroupToken = new InjectionToken<RdxRadioGroupDirective>('RdxRadioGroupToken');\n\nexport function injectRadioGroup(): RdxRadioGroupDirective {\n return inject(RdxRadioGroupToken);\n}\n\ninterface RadioGroupProps {\n name?: string;\n disabled?: boolean;\n // TODO: dir?: string;\n // TODO: loop?: string;\n defaultValue?: string;\n value?: string;\n onValueChange?: EventEmitter<string>;\n}\n\n@Directive({\n selector: 'div[RadioRoot]',\n exportAs: 'RadioRoot',\n standalone: true,\n providers: [\n { provide: RdxRadioGroupToken, useExisting: RdxRadioGroupDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: RdxRadioGroupDirective, multi: true }\n ],\n hostDirectives: [RdxRovingFocusGroupDirective],\n host: {\n role: 'radiogroup',\n '[attr.aria-orientation]': '_orientation',\n '[attr.data-disabled]': 'disabled ? \"\" : null',\n '[attr.dir]': 'dir',\n\n '(focusout)': '_onFocusout()'\n }\n})\nexport class RdxRadioGroupDirective implements RadioGroupProps, ControlValueAccessor {\n @Input() value?: string;\n\n @Input({ transform: booleanAttribute }) disabled = false;\n\n @Input() dir?: string;\n\n /**\n * The orientation of the radio group only vertical.\n * Horizontal radio buttons can sometimes be challenging to scan and localize.\n * The horizontal arrangement of radio buttons may also lead to difficulties in determining which\n * label corresponds to which button: whether the label is above or below the button.\n * @default 'vertical'\n */\n readonly _orientation = 'vertical';\n\n /**\n * Event handler called when the value changes.\n */\n @Output() readonly onValueChange = new EventEmitter<string>();\n\n /**\n * The callback function to call when the value of the radio group changes.\n * @internal\n */\n private onChange?: (value: string) => void;\n\n /**\n * The callback function to call when the radio group is touched.\n * @internal\n */\n private onTouched?: () => void;\n\n /**\n * Select a radio item.\n * @param value The value of the radio item to select.\n */\n select(value: string): void {\n this.value = value;\n this.onValueChange.emit(value);\n this.onChange?.(value);\n }\n\n /**\n * Update the value of the radio group.\n * @param value The new value of the radio group.\n * @internal\n */\n writeValue(value: string): void {\n this.value = value;\n }\n\n /**\n * Register a callback function to call when the value of the radio group changes.\n * @param fn The callback function to call when the value of the radio group changes.\n * @internal\n */\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Set the disabled state of the radio group.\n * @param isDisabled Whether the radio group is disabled.\n * @internal\n */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n /**\n * When focus leaves the radio group.\n */\n _onFocusout(): void {\n this.onTouched?.();\n }\n}\n","import { booleanAttribute, Directive, inject, InjectionToken, Input } from '@angular/core';\n\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { RdxRovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';\n\nimport { injectRadioGroup } from './radio-root.directive';\n\nexport const RdxRadioItemToken = new InjectionToken<RdxRadioItemDirective>('RadioItemToken');\n\nexport function injectRadioItem(): RdxRadioItemDirective {\n return inject(RdxRadioItemToken);\n}\n\n// Increasing integer for generating unique ids for radio components.\nlet nextUniqueId = 0;\n\n@Directive({\n selector: '[RadioItem]',\n exportAs: 'RadioItem',\n standalone: true,\n hostDirectives: [RdxRovingFocusItemDirective],\n providers: [{ provide: RdxRadioItemToken, useExisting: RdxRadioItemDirective }],\n host: {\n type: 'button',\n role: 'radio',\n '[attr.id]': 'id',\n '[attr.aria-checked]': 'radioGroup.value === value ? \"true\" : \"false\"',\n '[attr.data-disabled]': 'disabled ? \"\" : null',\n '[attr.data-state]': 'radioGroup.value === value ? \"checked\" : \"unchecked\"',\n\n '(focus)': '_onFocus()',\n '(click)': '_onClick()',\n '(keydown)': '_onKeydown($event)'\n }\n})\nexport class RdxRadioItemDirective {\n protected readonly radioGroup = injectRadioGroup();\n\n @Input() id = `rdx-radio-${++nextUniqueId}`;\n\n @Input({ required: true }) value!: string;\n\n @Input({ transform: booleanAttribute }) disabled = false;\n\n _onKeydown(event: KeyboardEvent): void {\n // According to WAI ARIA, radio groups don't activate items on enter keypress\n if (event.key === 'Enter') {\n event.preventDefault();\n }\n }\n\n _onFocus(): void {\n this.radioGroup.select(this.value);\n }\n\n _onClick(): void {\n console.log('click');\n this.radioGroup.select(this.value);\n }\n}\n","import { Directive } from '@angular/core';\n\nimport { injectRadioItem } from './radio-item.directive';\nimport { injectRadioGroup } from './radio-root.directive';\n\n@Directive({\n selector: '[RadioIndicator]',\n exportAs: 'RadioIndicator',\n standalone: true,\n host: {\n '[attr.data-state]': 'radioGroup.value === this.radioItem.value ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'radioItem.disabled ? \"\" : null'\n }\n})\nexport class RdxRadioIndicatorDirective {\n protected readonly radioGroup = injectRadioGroup();\n\n protected readonly radioItem = injectRadioItem();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\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,EAAA,CAAA;kBATtC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,mBAAmB,EAAE,qEAAqE;AAC1F,wBAAA,sBAAsB,EAAE,gCAAgC;AAC3D,qBAAA;AACJ,iBAAA,CAAA;;;ACbD;;AAEG;;;;"}
|
@@ -90,10 +90,10 @@ class RdxRovingFocusGroupDirective {
|
|
90
90
|
this.keyManager.withVerticalOrientation();
|
91
91
|
}
|
92
92
|
}
|
93
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
94
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "
|
93
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxRovingFocusGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
94
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.0.4", type: RdxRovingFocusGroupDirective, isStandalone: true, selector: "[rdxRovingFocusGroup]", inputs: { orientation: ["rdxRovingFocusGroupOrientation", "orientation"], wrap: ["rdxRovingFocusGroupWrap", "wrap", booleanAttribute] }, providers: [{ provide: RdxRovingFocusGroupToken, useExisting: RdxRovingFocusGroupDirective }], usesOnChanges: true, ngImport: i0 }); }
|
95
95
|
}
|
96
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
96
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxRovingFocusGroupDirective, decorators: [{
|
97
97
|
type: Directive,
|
98
98
|
args: [{
|
99
99
|
selector: '[rdxRovingFocusGroup]',
|
@@ -168,10 +168,10 @@ class RdxRovingFocusItemDirective {
|
|
168
168
|
focus() {
|
169
169
|
this.elementRef?.nativeElement.focus();
|
170
170
|
}
|
171
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
172
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "
|
171
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxRovingFocusItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
172
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.0.4", type: RdxRovingFocusItemDirective, isStandalone: true, selector: "[rdxRovingFocusItem]", inputs: { order: ["order", "order", numberAttribute], disabled: ["disabled", "disabled", booleanAttribute] }, host: { listeners: { "onKeydown": "_onKeydown($event)" }, properties: { "attr.tabindex": "_tabindex()" } }, providers: [{ provide: RdxRovingFocusItemToken, useExisting: RdxRovingFocusItemDirective }], ngImport: i0 }); }
|
173
173
|
}
|
174
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxRovingFocusItemDirective, decorators: [{
|
175
175
|
type: Directive,
|
176
176
|
args: [{
|
177
177
|
selector: '[rdxRovingFocusItem]',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-roving-focus.mjs","sources":["../../../packages/primitives/roving-focus/src/roving-focus-group.directive.ts","../../../packages/primitives/roving-focus/src/roving-focus-item.directive.ts","../../../packages/primitives/roving-focus/radix-ng-primitives-roving-focus.ts"],"sourcesContent":["import { FocusKeyManager } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport {\n booleanAttribute,\n DestroyRef,\n Directive,\n inject,\n InjectionToken,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n QueryList,\n SimpleChanges\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { filter } from 'rxjs';\n\nimport type { RdxRovingFocusItemDirective } from './roving-focus-item.directive';\n\nexport type Orientation = 'horizontal' | 'vertical';\n\nconst RdxRovingFocusGroupToken = new InjectionToken<RdxRovingFocusGroupDirective>(\n 'RdxRovingFocusToken'\n);\n\nexport function injectRovingFocusGroup(): RdxRovingFocusGroupDirective {\n return inject(RdxRovingFocusGroupToken);\n}\n\n@Directive({\n selector: '[rdxRovingFocusGroup]',\n standalone: true,\n providers: [{ provide: RdxRovingFocusGroupToken, useExisting: RdxRovingFocusGroupDirective }]\n})\nexport class RdxRovingFocusGroupDirective implements OnInit, OnChanges, OnDestroy {\n private readonly directionality = inject(Directionality);\n\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * Create a query list of all the roving focus items.\n * We don't use ContentChildren as dynamically added items may not be in the correct order.\n */\n private readonly items = new QueryList<RdxRovingFocusItemDirective>();\n\n readonly keyManager = new FocusKeyManager<RdxRovingFocusItemDirective>(this.items);\n\n /**\n * Determine the orientation of the roving focus group.\n * @default vertical\n */\n @Input({ alias: 'rdxRovingFocusGroupOrientation' }) orientation: Orientation = 'vertical';\n\n /**\n * Determine if focus should wrap when the end or beginning is reached.\n * @default true\n */\n @Input({ alias: 'rdxRovingFocusGroupWrap', transform: booleanAttribute }) wrap = true;\n\n ngOnInit(): void {\n this.keyManager.withWrap(this.wrap);\n\n this.setOrientation(this.orientation);\n\n this.directionality.change\n .pipe(\n filter(() => this.orientation === 'horizontal'),\n takeUntilDestroyed(this.destroyRef)\n )\n .subscribe((direction) => this.keyManager.withHorizontalOrientation(direction));\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if ('orientation' in changes) {\n this.setOrientation(this.orientation);\n }\n\n if ('wrap' in changes) {\n this.keyManager.withWrap(this.wrap);\n }\n }\n\n ngOnDestroy(): void {\n this.keyManager.destroy();\n }\n\n /**\n * Register a roving focus item.\n * @param item The roving focus item to register.\n */\n register(item: RdxRovingFocusItemDirective): void {\n this.items.reset([...this.items.toArray(), item].sort((a, b) => a.order - b.order));\n\n if (this.items.length === 1) {\n this.keyManager.updateActiveItem(item);\n }\n }\n\n /**\n * Unregister a roving focus item.\n * @param item The roving focus item to unregister.\n */\n unregister(item: RdxRovingFocusItemDirective): void {\n const isActive = this.keyManager.activeItem === item;\n\n this.items.reset(this.items.toArray().filter((i) => i !== item));\n\n if (isActive) {\n this.keyManager.updateActiveItem(0);\n }\n }\n\n /**\n * Handle key events on the roving focus items.\n * @param event The key event.\n * @internal\n */\n onKeydown(event: KeyboardEvent): void {\n this.keyManager.onKeydown(event);\n }\n\n /**\n * Set the orientation of the roving focus group.\n * @param orientation The orientation of the roving focus group.\n */\n setOrientation(orientation: Orientation): void {\n this.orientation = orientation;\n\n if (orientation === 'horizontal') {\n this.keyManager.withHorizontalOrientation(this.directionality.value);\n } else {\n this.keyManager.withVerticalOrientation();\n }\n }\n}\n","import { FocusableOption } from '@angular/cdk/a11y';\nimport {\n booleanAttribute,\n ChangeDetectorRef,\n DestroyRef,\n Directive,\n ElementRef,\n inject,\n InjectionToken,\n Input,\n numberAttribute,\n OnDestroy,\n OnInit\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { injectRovingFocusGroup } from './roving-focus-group.directive';\n\nconst RdxRovingFocusItemToken = new InjectionToken<RdxRovingFocusItemDirective>(\n 'RdxRovingFocusItemToken'\n);\n\nexport function injectRovingFocusItem(): RdxRovingFocusItemDirective {\n return inject(RdxRovingFocusItemToken);\n}\n\n@Directive({\n selector: '[rdxRovingFocusItem]',\n standalone: true,\n host: {\n '(onKeydown)': '_onKeydown($event)',\n '[attr.tabindex]': '_tabindex()'\n },\n providers: [{ provide: RdxRovingFocusItemToken, useExisting: RdxRovingFocusItemDirective }]\n})\nexport class RdxRovingFocusItemDirective implements OnInit, OnDestroy, FocusableOption {\n /**\n * Access the group the roving focus item belongs to.\n */\n private readonly group = injectRovingFocusGroup();\n\n /**\n * Access the element reference of the roving focus item.\n */\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the destroyRef\n */\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * Access the change detector ref\n */\n private readonly changeDetectorRef = inject(ChangeDetectorRef);\n\n /**\n * Define the order of the roving focus item in the group.\n */\n @Input({ transform: numberAttribute }) order = 0;\n\n /**\n * Define if the item is disabled.\n */\n @Input({ transform: booleanAttribute }) disabled = false;\n\n ngOnInit(): void {\n this.group.register(this);\n\n this.group.keyManager.change\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.changeDetectorRef.markForCheck());\n }\n\n ngOnDestroy(): void {\n this.group.unregister(this);\n }\n\n /**\n * Handle key events on the roving focus item.\n * @param event The key event.\n */\n _onKeydown(event: KeyboardEvent): void {\n this.group.onKeydown(event);\n }\n\n /**\n * Derive the tabindex of the roving focus item.\n */\n _tabindex(): number {\n return this.group.keyManager.activeItem === this ? 0 : -1;\n }\n\n /**\n * Focus the roving focus item.\n * @internal\n */\n focus(): void {\n this.elementRef?.nativeElement.focus();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAsBA,MAAM,wBAAwB,GAAG,IAAI,cAAc,CAC/C,qBAAqB,CACxB,CAAC;SAEc,sBAAsB,GAAA;AAClC,IAAA,OAAO,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAC5C,CAAC;MAOY,4BAA4B,CAAA;AALzC,IAAA,WAAA,GAAA;AAMqB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAExC,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAEjD;;;AAGG;AACc,QAAA,IAAA,CAAA,KAAK,GAAG,IAAI,SAAS,EAA+B,CAAC;QAE7D,IAAU,CAAA,UAAA,GAAG,IAAI,eAAe,CAA8B,IAAI,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A,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,eAAe,CAKf,EAAA,QAAA,EAAA,CAAA,UAAA,EAAA,UAAA,EAAA,gBAAgB,4HA/BzB,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;4FAElF,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBATvC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,aAAa,EAAE,oBAAoB;AACnC,wBAAA,iBAAiB,EAAE,aAAa;AACnC,qBAAA;oBACD,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAA6B,2BAAA,EAAE,CAAC;AAC9F,iBAAA,CAAA;8BAyB0C,KAAK,EAAA,CAAA;sBAA3C,KAAK;uBAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;gBAKG,QAAQ,EAAA,CAAA;sBAA/C,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;;;AChE1C;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"radix-ng-primitives-roving-focus.mjs","sources":["../../../packages/primitives/roving-focus/src/roving-focus-group.directive.ts","../../../packages/primitives/roving-focus/src/roving-focus-item.directive.ts","../../../packages/primitives/roving-focus/radix-ng-primitives-roving-focus.ts"],"sourcesContent":["import { FocusKeyManager } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport {\n booleanAttribute,\n DestroyRef,\n Directive,\n inject,\n InjectionToken,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n QueryList,\n SimpleChanges\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { filter } from 'rxjs';\n\nimport type { RdxRovingFocusItemDirective } from './roving-focus-item.directive';\n\nexport type Orientation = 'horizontal' | 'vertical';\n\nconst RdxRovingFocusGroupToken = new InjectionToken<RdxRovingFocusGroupDirective>(\n 'RdxRovingFocusToken'\n);\n\nexport function injectRovingFocusGroup(): RdxRovingFocusGroupDirective {\n return inject(RdxRovingFocusGroupToken);\n}\n\n@Directive({\n selector: '[rdxRovingFocusGroup]',\n standalone: true,\n providers: [{ provide: RdxRovingFocusGroupToken, useExisting: RdxRovingFocusGroupDirective }]\n})\nexport class RdxRovingFocusGroupDirective implements OnInit, OnChanges, OnDestroy {\n private readonly directionality = inject(Directionality);\n\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * Create a query list of all the roving focus items.\n * We don't use ContentChildren as dynamically added items may not be in the correct order.\n */\n private readonly items = new QueryList<RdxRovingFocusItemDirective>();\n\n readonly keyManager = new FocusKeyManager<RdxRovingFocusItemDirective>(this.items);\n\n /**\n * Determine the orientation of the roving focus group.\n * @default vertical\n */\n @Input({ alias: 'rdxRovingFocusGroupOrientation' }) orientation: Orientation = 'vertical';\n\n /**\n * Determine if focus should wrap when the end or beginning is reached.\n * @default true\n */\n @Input({ alias: 'rdxRovingFocusGroupWrap', transform: booleanAttribute }) wrap = true;\n\n ngOnInit(): void {\n this.keyManager.withWrap(this.wrap);\n\n this.setOrientation(this.orientation);\n\n this.directionality.change\n .pipe(\n filter(() => this.orientation === 'horizontal'),\n takeUntilDestroyed(this.destroyRef)\n )\n .subscribe((direction) => this.keyManager.withHorizontalOrientation(direction));\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if ('orientation' in changes) {\n this.setOrientation(this.orientation);\n }\n\n if ('wrap' in changes) {\n this.keyManager.withWrap(this.wrap);\n }\n }\n\n ngOnDestroy(): void {\n this.keyManager.destroy();\n }\n\n /**\n * Register a roving focus item.\n * @param item The roving focus item to register.\n */\n register(item: RdxRovingFocusItemDirective): void {\n this.items.reset([...this.items.toArray(), item].sort((a, b) => a.order - b.order));\n\n if (this.items.length === 1) {\n this.keyManager.updateActiveItem(item);\n }\n }\n\n /**\n * Unregister a roving focus item.\n * @param item The roving focus item to unregister.\n */\n unregister(item: RdxRovingFocusItemDirective): void {\n const isActive = this.keyManager.activeItem === item;\n\n this.items.reset(this.items.toArray().filter((i) => i !== item));\n\n if (isActive) {\n this.keyManager.updateActiveItem(0);\n }\n }\n\n /**\n * Handle key events on the roving focus items.\n * @param event The key event.\n * @internal\n */\n onKeydown(event: KeyboardEvent): void {\n this.keyManager.onKeydown(event);\n }\n\n /**\n * Set the orientation of the roving focus group.\n * @param orientation The orientation of the roving focus group.\n */\n setOrientation(orientation: Orientation): void {\n this.orientation = orientation;\n\n if (orientation === 'horizontal') {\n this.keyManager.withHorizontalOrientation(this.directionality.value);\n } else {\n this.keyManager.withVerticalOrientation();\n }\n }\n}\n","import { FocusableOption } from '@angular/cdk/a11y';\nimport {\n booleanAttribute,\n ChangeDetectorRef,\n DestroyRef,\n Directive,\n ElementRef,\n inject,\n InjectionToken,\n Input,\n numberAttribute,\n OnDestroy,\n OnInit\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { injectRovingFocusGroup } from './roving-focus-group.directive';\n\nconst RdxRovingFocusItemToken = new InjectionToken<RdxRovingFocusItemDirective>(\n 'RdxRovingFocusItemToken'\n);\n\nexport function injectRovingFocusItem(): RdxRovingFocusItemDirective {\n return inject(RdxRovingFocusItemToken);\n}\n\n@Directive({\n selector: '[rdxRovingFocusItem]',\n standalone: true,\n host: {\n '(onKeydown)': '_onKeydown($event)',\n '[attr.tabindex]': '_tabindex()'\n },\n providers: [{ provide: RdxRovingFocusItemToken, useExisting: RdxRovingFocusItemDirective }]\n})\nexport class RdxRovingFocusItemDirective implements OnInit, OnDestroy, FocusableOption {\n /**\n * Access the group the roving focus item belongs to.\n */\n private readonly group = injectRovingFocusGroup();\n\n /**\n * Access the element reference of the roving focus item.\n */\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the destroyRef\n */\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * Access the change detector ref\n */\n private readonly changeDetectorRef = inject(ChangeDetectorRef);\n\n /**\n * Define the order of the roving focus item in the group.\n */\n @Input({ transform: numberAttribute }) order = 0;\n\n /**\n * Define if the item is disabled.\n */\n @Input({ transform: booleanAttribute }) disabled = false;\n\n ngOnInit(): void {\n this.group.register(this);\n\n this.group.keyManager.change\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.changeDetectorRef.markForCheck());\n }\n\n ngOnDestroy(): void {\n this.group.unregister(this);\n }\n\n /**\n * Handle key events on the roving focus item.\n * @param event The key event.\n */\n _onKeydown(event: KeyboardEvent): void {\n this.group.onKeydown(event);\n }\n\n /**\n * Derive the tabindex of the roving focus item.\n */\n _tabindex(): number {\n return this.group.keyManager.activeItem === this ? 0 : -1;\n }\n\n /**\n * Focus the roving focus item.\n * @internal\n */\n focus(): void {\n this.elementRef?.nativeElement.focus();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAsBA,MAAM,wBAAwB,GAAG,IAAI,cAAc,CAC/C,qBAAqB,CACxB,CAAC;SAEc,sBAAsB,GAAA;AAClC,IAAA,OAAO,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAC5C,CAAC;MAOY,4BAA4B,CAAA;AALzC,IAAA,WAAA,GAAA;AAMqB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAExC,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAEjD;;;AAGG;AACc,QAAA,IAAA,CAAA,KAAK,GAAG,IAAI,SAAS,EAA+B,CAAC;QAE7D,IAAU,CAAA,UAAA,GAAG,IAAI,eAAe,CAA8B,IAAI,CAAC,KAAK,CAAC,CAAC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AA,EAAA,sBAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,eAAe,CAKf,EAAA,QAAA,EAAA,CAAA,UAAA,EAAA,UAAA,EAAA,gBAAgB,4HA/BzB,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAElF,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBATvC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,aAAa,EAAE,oBAAoB;AACnC,wBAAA,iBAAiB,EAAE,aAAa;AACnC,qBAAA;oBACD,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAA6B,2BAAA,EAAE,CAAC;AAC9F,iBAAA,CAAA;8BAyB0C,KAAK,EAAA,CAAA;sBAA3C,KAAK;uBAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;gBAKG,QAAQ,EAAA,CAAA;sBAA/C,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;;;AChE1C;;AAEG;;;;"}
|
@@ -8,10 +8,10 @@ class RdxSeparatorRootDirective {
|
|
8
8
|
this.orientation = DEFAULT_ORIENTATION;
|
9
9
|
this.decorative = false;
|
10
10
|
}
|
11
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
12
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "
|
11
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxSeparatorRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
12
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.0.4", type: RdxSeparatorRootDirective, isStandalone: true, selector: "div[SeparatorRoot]", inputs: { orientation: ["rdxOrientation", "orientation"], decorative: ["rdxDecorative", "decorative", booleanAttribute] }, host: { properties: { "attr.role": "decorative ? \"none\" : \"separator\"", "attr.aria-orientation": "!decorative && orientation === \"vertical\" ? \"vertical\" : null", "attr.data-orientation": "orientation" } }, ngImport: i0 }); }
|
13
13
|
}
|
14
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
14
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxSeparatorRootDirective, decorators: [{
|
15
15
|
type: Directive,
|
16
16
|
args: [{
|
17
17
|
selector: 'div[SeparatorRoot]',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-separator.mjs","sources":["../../../packages/primitives/separator/src/separator.directive.ts","../../../packages/primitives/separator/radix-ng-primitives-separator.ts"],"sourcesContent":["import { booleanAttribute, Directive, Input } from '@angular/core';\n\nconst DEFAULT_ORIENTATION = 'horizontal';\nconst ORIENTATIONS = ['horizontal', 'vertical'] as const;\n\nexport type Orientation = (typeof ORIENTATIONS)[number];\n\nexport interface SeparatorProps {\n /**\n * Either `vertical` or `horizontal`. Defaults to `horizontal`.\n */\n orientation?: Orientation;\n /**\n * Whether the component is purely decorative. When true, accessibility-related attributes\n * are updated so that the rendered element is removed from the accessibility tree.\n */\n decorative?: boolean;\n}\n\n@Directive({\n selector: 'div[SeparatorRoot]',\n standalone: true,\n host: {\n '[attr.role]': 'decorative ? \"none\" : \"separator\"',\n // `aria-orientation` defaults to `horizontal` so we only need it if `orientation` is vertical\n '[attr.aria-orientation]': '!decorative && orientation === \"vertical\" ? \"vertical\" : null',\n '[attr.data-orientation]': 'orientation'\n }\n})\nexport class RdxSeparatorRootDirective implements SeparatorProps {\n @Input('rdxOrientation') orientation: Orientation = DEFAULT_ORIENTATION;\n\n @Input({ alias: 'rdxDecorative', transform: booleanAttribute }) decorative = false;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA,MAAM,mBAAmB,GAAG,YAAY,CAAC;AACzC,MAAM,YAAY,GAAG,CAAC,YAAY,EAAE,UAAU,CAAU,CAAC;MA0B5C,yBAAyB,CAAA;AAVtC,IAAA,WAAA,GAAA;QAW6B,IAAW,CAAA,WAAA,GAAgB,mBAAmB,CAAC;QAER,IAAU,CAAA,UAAA,GAAG,KAAK,CAAC;AACtF,KAAA
|
1
|
+
{"version":3,"file":"radix-ng-primitives-separator.mjs","sources":["../../../packages/primitives/separator/src/separator.directive.ts","../../../packages/primitives/separator/radix-ng-primitives-separator.ts"],"sourcesContent":["import { booleanAttribute, Directive, Input } from '@angular/core';\n\nconst DEFAULT_ORIENTATION = 'horizontal';\nconst ORIENTATIONS = ['horizontal', 'vertical'] as const;\n\nexport type Orientation = (typeof ORIENTATIONS)[number];\n\nexport interface SeparatorProps {\n /**\n * Either `vertical` or `horizontal`. Defaults to `horizontal`.\n */\n orientation?: Orientation;\n /**\n * Whether the component is purely decorative. When true, accessibility-related attributes\n * are updated so that the rendered element is removed from the accessibility tree.\n */\n decorative?: boolean;\n}\n\n@Directive({\n selector: 'div[SeparatorRoot]',\n standalone: true,\n host: {\n '[attr.role]': 'decorative ? \"none\" : \"separator\"',\n // `aria-orientation` defaults to `horizontal` so we only need it if `orientation` is vertical\n '[attr.aria-orientation]': '!decorative && orientation === \"vertical\" ? \"vertical\" : null',\n '[attr.data-orientation]': 'orientation'\n }\n})\nexport class RdxSeparatorRootDirective implements SeparatorProps {\n @Input('rdxOrientation') orientation: Orientation = DEFAULT_ORIENTATION;\n\n @Input({ alias: 'rdxDecorative', transform: booleanAttribute }) decorative = false;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA,MAAM,mBAAmB,G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,5 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { InjectionToken, inject, EventEmitter, booleanAttribute, Directive, Input, Output } from '@angular/core';
|
2
|
+
import { InjectionToken, inject, model, EventEmitter, booleanAttribute, Directive, Input, Output } from '@angular/core';
|
3
3
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
4
4
|
|
5
5
|
const RdxSwitchToken = new InjectionToken('RdxSwitchToken');
|
@@ -9,7 +9,7 @@ function injectSwitch() {
|
|
9
9
|
class RdxSwitchRootDirective {
|
10
10
|
constructor() {
|
11
11
|
this.required = false;
|
12
|
-
this.checked = false;
|
12
|
+
this.checked = model(false);
|
13
13
|
this.disabled = false;
|
14
14
|
this.onCheckedChange = new EventEmitter();
|
15
15
|
}
|
@@ -20,28 +20,27 @@ class RdxSwitchRootDirective {
|
|
20
20
|
this._onTouched = fn;
|
21
21
|
}
|
22
22
|
writeValue(checked) {
|
23
|
-
this.checked
|
23
|
+
this.checked.set(checked);
|
24
24
|
}
|
25
25
|
setDisabledState(isDisabled) {
|
26
26
|
this.disabled = isDisabled;
|
27
27
|
}
|
28
|
-
|
28
|
+
toggle() {
|
29
29
|
if (this.disabled) {
|
30
30
|
return;
|
31
31
|
}
|
32
|
-
this.checked
|
33
|
-
this._onChange?.(this.checked);
|
32
|
+
this.checked.set(!this.checked());
|
33
|
+
this._onChange?.(this.checked());
|
34
34
|
}
|
35
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
36
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
35
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxSwitchRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
36
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.0.4", type: RdxSwitchRootDirective, isStandalone: true, selector: "button[SwitchRoot]", inputs: { required: { classPropertyName: "required", publicName: "required", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: booleanAttribute } }, outputs: { checked: "checkedChange", onCheckedChange: "onCheckedChange" }, host: { attributes: { "role": "switch", "type": "button" }, listeners: { "focus": "_onTouched?.()", "click": "toggle()" }, properties: { "attr.aria-checked": "checked()", "attr.aria-required": "required", "attr.data-state": "checked() ? \"checked\" : \"unchecked\"", "attr.data-disabled": "disabled ? \"true\" : null", "attr.disabled": "disabled ? disabled : null" } }, providers: [
|
37
37
|
{ provide: RdxSwitchToken, useExisting: RdxSwitchRootDirective },
|
38
38
|
{ provide: NG_VALUE_ACCESSOR, useExisting: RdxSwitchRootDirective, multi: true }
|
39
39
|
], exportAs: ["SwitchRoot"], ngImport: i0 }); }
|
40
40
|
}
|
41
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxSwitchRootDirective, decorators: [{
|
42
42
|
type: Directive,
|
43
43
|
args: [{
|
44
|
-
// TODO: added Forms input
|
45
44
|
selector: 'button[SwitchRoot]',
|
46
45
|
exportAs: 'SwitchRoot',
|
47
46
|
standalone: true,
|
@@ -51,21 +50,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
51
50
|
],
|
52
51
|
host: {
|
53
52
|
role: 'switch',
|
54
|
-
|
53
|
+
type: 'button',
|
54
|
+
'[attr.aria-checked]': 'checked()',
|
55
55
|
'[attr.aria-required]': 'required',
|
56
|
-
'[attr.data-state]': 'checked ? "checked" : "unchecked"',
|
56
|
+
'[attr.data-state]': 'checked() ? "checked" : "unchecked"',
|
57
57
|
'[attr.data-disabled]': 'disabled ? "true" : null',
|
58
58
|
'[attr.disabled]': 'disabled ? disabled : null',
|
59
59
|
'(focus)': '_onTouched?.()',
|
60
|
-
'(click)': '
|
60
|
+
'(click)': 'toggle()'
|
61
61
|
}
|
62
62
|
}]
|
63
63
|
}], propDecorators: { required: [{
|
64
64
|
type: Input,
|
65
65
|
args: [{ transform: booleanAttribute }]
|
66
|
-
}], checked: [{
|
67
|
-
type: Input,
|
68
|
-
args: [{ transform: booleanAttribute }]
|
69
66
|
}], disabled: [{
|
70
67
|
type: Input,
|
71
68
|
args: [{ transform: booleanAttribute }]
|
@@ -77,10 +74,10 @@ class RdxSwitchThumbDirective {
|
|
77
74
|
constructor() {
|
78
75
|
this.switchRoot = injectSwitch();
|
79
76
|
}
|
80
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
81
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
77
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxSwitchThumbDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
78
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.4", type: RdxSwitchThumbDirective, isStandalone: true, selector: "span[SwitchThumb]", host: { properties: { "attr.data-disabled": "switchRoot.disabled ? \"true\" : null", "attr.data-state": "switchRoot.checked() ? \"checked\" : \"unchecked\"" } }, exportAs: ["SwitchThumb"], ngImport: i0 }); }
|
82
79
|
}
|
83
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
80
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxSwitchThumbDirective, decorators: [{
|
84
81
|
type: Directive,
|
85
82
|
args: [{
|
86
83
|
selector: 'span[SwitchThumb]',
|
@@ -88,7 +85,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
88
85
|
standalone: true,
|
89
86
|
host: {
|
90
87
|
'[attr.data-disabled]': 'switchRoot.disabled ? "true" : null',
|
91
|
-
'[attr.data-state]': 'switchRoot.checked ? "checked" : "unchecked"'
|
88
|
+
'[attr.data-state]': 'switchRoot.checked() ? "checked" : "unchecked"'
|
89
|
+
}
|
90
|
+
}]
|
91
|
+
}] });
|
92
|
+
|
93
|
+
class RdxSwitchInputDirective {
|
94
|
+
constructor() {
|
95
|
+
this.switchRoot = injectSwitch();
|
96
|
+
}
|
97
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxSwitchInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
98
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.4", type: RdxSwitchInputDirective, isStandalone: true, selector: "input[SwitchInput]", host: { attributes: { "type": "checkbox", "tabindex": "-1" }, properties: { "attr.aria-checked": "switchRoot.checked()", "attr.aria-hidden": "true", "attr.aria-required": "switchRoot.required", "attr.data-state": "switchRoot.checked() ? \"checked\" : \"unchecked\"", "attr.data-disabled": "switchRoot.disabled ? \"true\" : null", "attr.disabled": "switchRoot.disabled ? switchRoot.disabled : null" }, styleAttribute: "position: absolute; pointerEvents: none; opacity: 0; margin: 0;" }, exportAs: ["SwitchInput"], ngImport: i0 }); }
|
99
|
+
}
|
100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxSwitchInputDirective, decorators: [{
|
101
|
+
type: Directive,
|
102
|
+
args: [{
|
103
|
+
selector: 'input[SwitchInput]',
|
104
|
+
exportAs: 'SwitchInput',
|
105
|
+
standalone: true,
|
106
|
+
host: {
|
107
|
+
type: 'checkbox',
|
108
|
+
tabindex: '-1',
|
109
|
+
'[attr.aria-checked]': 'switchRoot.checked()',
|
110
|
+
'[attr.aria-hidden]': 'true',
|
111
|
+
'[attr.aria-required]': 'switchRoot.required',
|
112
|
+
'[attr.data-state]': 'switchRoot.checked() ? "checked" : "unchecked"',
|
113
|
+
'[attr.data-disabled]': 'switchRoot.disabled ? "true" : null',
|
114
|
+
'[attr.disabled]': 'switchRoot.disabled ? switchRoot.disabled : null',
|
115
|
+
style: 'position: absolute; pointerEvents: none; opacity: 0; margin: 0;'
|
92
116
|
}
|
93
117
|
}]
|
94
118
|
}] });
|
@@ -97,5 +121,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
97
121
|
* Generated bundle index. Do not edit.
|
98
122
|
*/
|
99
123
|
|
100
|
-
export { RdxSwitchRootDirective, RdxSwitchThumbDirective, RdxSwitchToken, injectSwitch };
|
124
|
+
export { RdxSwitchInputDirective, RdxSwitchRootDirective, RdxSwitchThumbDirective, RdxSwitchToken, injectSwitch };
|
101
125
|
//# sourceMappingURL=radix-ng-primitives-switch.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-switch.mjs","sources":["../../../packages/primitives/switch/src/switch-root.directive.ts","../../../packages/primitives/switch/src/switch-thumb.directive.ts","../../../packages/primitives/switch/radix-ng-primitives-switch.ts"],"sourcesContent":["import {\n booleanAttribute,\n Directive,\n EventEmitter,\n inject,\n InjectionToken,\n Input,\n Output\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nexport const RdxSwitchToken = new InjectionToken<RdxSwitchRootDirective>('RdxSwitchToken');\n\nexport function injectSwitch(): RdxSwitchRootDirective {\n return inject(RdxSwitchToken);\n}\n\nexport interface SwitchProps {\n checked?: boolean
|
1
|
+
{"version":3,"file":"radix-ng-primitives-switch.mjs","sources":["../../../packages/primitives/switch/src/switch-root.directive.ts","../../../packages/primitives/switch/src/switch-thumb.directive.ts","../../../packages/primitives/switch/src/switch-input.directive.ts","../../../packages/primitives/switch/radix-ng-primitives-switch.ts"],"sourcesContent":["import {\n booleanAttribute,\n Directive,\n EventEmitter,\n inject,\n InjectionToken,\n Input,\n model,\n ModelSignal,\n Output\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nexport const RdxSwitchToken = new InjectionToken<RdxSwitchRootDirective>('RdxSwitchToken');\n\nexport function injectSwitch(): RdxSwitchRootDirective {\n return inject(RdxSwitchToken);\n}\n\nexport interface SwitchProps {\n checked?: ModelSignal<boolean>;\n defaultChecked?: boolean;\n required?: boolean;\n onCheckedChange?: EventEmitter<boolean>;\n}\n\n@Directive({\n selector: 'button[SwitchRoot]',\n exportAs: 'SwitchRoot',\n standalone: true,\n providers: [\n { provide: RdxSwitchToken, useExisting: RdxSwitchRootDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: RdxSwitchRootDirective, multi: true }\n ],\n host: {\n role: 'switch',\n type: 'button',\n '[attr.aria-checked]': 'checked()',\n '[attr.aria-required]': 'required',\n '[attr.data-state]': 'checked() ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'disabled ? \"true\" : null',\n '[attr.disabled]': 'disabled ? disabled : null',\n\n '(focus)': '_onTouched?.()',\n '(click)': 'toggle()'\n }\n})\nexport class RdxSwitchRootDirective implements SwitchProps, ControlValueAccessor {\n @Input({ transform: booleanAttribute }) required = false;\n\n readonly checked = model<boolean>(false);\n\n @Input({ transform: booleanAttribute }) disabled = false;\n\n @Output() readonly onCheckedChange = new EventEmitter<boolean>();\n\n /**\n * The method to be called in order to update ngModel.\n */\n _onChange?: (checked: boolean) => void;\n\n /**\n * onTouch function registered via registerOnTouch (ControlValueAccessor).\n */\n _onTouched?: () => void;\n\n registerOnChange(fn: (checked: boolean) => void): void {\n this._onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this._onTouched = fn;\n }\n\n writeValue(checked: boolean): void {\n this.checked.set(checked);\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n protected toggle(): void {\n if (this.disabled) {\n return;\n }\n\n this.checked.set(!this.checked());\n this._onChange?.(this.checked());\n }\n}\n","import { Directive } from '@angular/core';\n\nimport { injectSwitch } from './switch-root.directive';\n\n@Directive({\n selector: 'span[SwitchThumb]',\n exportAs: 'SwitchThumb',\n standalone: true,\n host: {\n '[attr.data-disabled]': 'switchRoot.disabled ? \"true\" : null',\n '[attr.data-state]': 'switchRoot.checked() ? \"checked\" : \"unchecked\"'\n }\n})\nexport class RdxSwitchThumbDirective {\n protected readonly switchRoot = injectSwitch();\n}\n","import { Directive } from '@angular/core';\n\nimport { injectSwitch } from './switch-root.directive';\n\n@Directive({\n selector: 'input[SwitchInput]',\n exportAs: 'SwitchInput',\n standalone: true,\n host: {\n type: 'checkbox',\n tabindex: '-1',\n '[attr.aria-checked]': 'switchRoot.checked()',\n '[attr.aria-hidden]': 'true',\n '[attr.aria-required]': 'switchRoot.required',\n '[attr.data-state]': 'switchRoot.checked() ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'switchRoot.disabled ? \"true\" : null',\n '[attr.disabled]': 'switchRoot.disabled ? switchRoot.disabled : null',\n style: 'position: absolute; pointerEvents: none; opacity: 0; margin: 0;'\n }\n})\nexport class RdxSwitchInputDirective {\n protected readonly switchRoot = injectSwitch();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAaa,cAAc,GAAG,IAAI,cAAc,CAAyB,gBAAgB,EAAE;SAE3E,YAAY,GAAA;AACxB,IAAA,OAAO,MAAM,CAAC,cAAc,CAAC,CAAC;AAClC,CAAC;MA8BY,sBAAsB,CAAA;AArBnC,IAAA,WAAA,GAAA;QAsB4C,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;AAEhD,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAU,KAAK,CAAC,CAAC;QAED,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;AAEtC,QAAA,IAAA,CAAA,eAAe,GAAG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E,gDAAgD;AACrE,wBAAA,sBAAsB,EAAE,qCAAqC;AAC7D,wBAAA,iBAAiB,EAAE,kDAAkD;AACrE,wBAAA,KAAK,EAAE,iEAAiE;AAC3E,qBAAA;AACJ,iBAAA,CAAA;;;ACnBD;;AAEG;;;;"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { InjectionToken, inject, booleanAttribute, Directive, Input,
|
2
|
+
import { InjectionToken, inject, booleanAttribute, Directive, Input, EventEmitter, ContentChildren } from '@angular/core';
|
3
3
|
import * as i1 from '@radix-ng/primitives/roving-focus';
|
4
4
|
import { injectRovingFocusItem, RdxRovingFocusItemDirective, injectRovingFocusGroup, RdxRovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';
|
5
5
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
@@ -41,9 +41,6 @@ class RdxToggleGroupButtonDirective {
|
|
41
41
|
this.updateDisabled();
|
42
42
|
}
|
43
43
|
}
|
44
|
-
/**
|
45
|
-
* Toggle this toggle button.
|
46
|
-
*/
|
47
44
|
toggle() {
|
48
45
|
if (this.disabled) {
|
49
46
|
return;
|
@@ -57,10 +54,10 @@ class RdxToggleGroupButtonDirective {
|
|
57
54
|
updateDisabled() {
|
58
55
|
this.rovingFocusItem.disabled = this.disabled || this.toggleGroup.disabled;
|
59
56
|
}
|
60
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
61
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "
|
57
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxToggleGroupButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
58
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.0.4", type: RdxToggleGroupButtonDirective, isStandalone: true, selector: "button[rdxToggleGroupButton]", inputs: { value: "value", disabled: ["disabled", "disabled", booleanAttribute] }, host: { attributes: { "role": "radio" }, listeners: { "click": "toggle()" }, properties: { "attr.aria-checked": "checked", "attr.aria-disabled": "disabled || toggleGroup.disabled", "attr.data-disabled": "disabled || toggleGroup.disabled", "attr.data-state": "checked ? \"on\" : \"off\"", "attr.data-orientation": "toggleGroup.orientation" } }, providers: [{ provide: RdxToggleGroupButtonToken, useExisting: RdxToggleGroupButtonDirective }], usesOnChanges: true, hostDirectives: [{ directive: i1.RdxRovingFocusItemDirective }], ngImport: i0 }); }
|
62
59
|
}
|
63
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
60
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxToggleGroupButtonDirective, decorators: [{
|
64
61
|
type: Directive,
|
65
62
|
args: [{
|
66
63
|
selector: 'button[rdxToggleGroupButton]',
|
@@ -73,18 +70,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
73
70
|
'[attr.aria-disabled]': 'disabled || toggleGroup.disabled',
|
74
71
|
'[attr.data-disabled]': 'disabled || toggleGroup.disabled',
|
75
72
|
'[attr.data-state]': 'checked ? "on" : "off"',
|
76
|
-
'[attr.data-orientation]': 'toggleGroup.orientation'
|
73
|
+
'[attr.data-orientation]': 'toggleGroup.orientation',
|
74
|
+
'(click)': 'toggle()'
|
77
75
|
}
|
78
76
|
}]
|
79
77
|
}], propDecorators: { value: [{
|
80
78
|
type: Input,
|
81
|
-
args: [{
|
79
|
+
args: [{ required: true }]
|
82
80
|
}], disabled: [{
|
83
81
|
type: Input,
|
84
|
-
args: [{
|
85
|
-
}], toggle: [{
|
86
|
-
type: HostListener,
|
87
|
-
args: ['click']
|
82
|
+
args: [{ transform: booleanAttribute }]
|
88
83
|
}] } });
|
89
84
|
|
90
85
|
class RdxToggleGroupMultiDirective {
|
@@ -192,13 +187,13 @@ class RdxToggleGroupMultiDirective {
|
|
192
187
|
this.disabled = isDisabled;
|
193
188
|
this.buttons?.forEach((button) => button.updateDisabled());
|
194
189
|
}
|
195
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
196
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "
|
190
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxToggleGroupMultiDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
191
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.0.4", type: RdxToggleGroupMultiDirective, isStandalone: true, selector: "[rdxToggleGroupMulti]", inputs: { value: ["rdxToggleGroupMultiValue", "value"], orientation: ["rdxToggleGroupMultiOrientation", "orientation"], disabled: ["rdxToggleGroupMultiDisabled", "disabled", booleanAttribute], wrap: ["rdxToggleGroupMultiWrap", "wrap", booleanAttribute], valueChange: ["rdxToggleGroupMultiValueChange", "valueChange"] }, host: { attributes: { "role": "group" }, listeners: { "focusout": "onTouched?.()" }, properties: { "attr.data-orientation": "orientation" } }, providers: [
|
197
192
|
{ provide: RdxToggleGroupToken, useExisting: RdxToggleGroupMultiDirective },
|
198
193
|
{ provide: NG_VALUE_ACCESSOR, useExisting: RdxToggleGroupMultiDirective, multi: true }
|
199
194
|
], queries: [{ propertyName: "buttons", predicate: RdxToggleGroupButtonToken }], usesOnChanges: true, hostDirectives: [{ directive: i1.RdxRovingFocusGroupDirective, inputs: ["rdxRovingFocusGroupWrap", "wrap", "rdxRovingFocusGroupOrientation", "orientation"] }], ngImport: i0 }); }
|
200
195
|
}
|
201
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
196
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxToggleGroupMultiDirective, decorators: [{
|
202
197
|
type: Directive,
|
203
198
|
args: [{
|
204
199
|
selector: '[rdxToggleGroupMulti]',
|
@@ -342,13 +337,13 @@ class RdxToggleGroupDirective {
|
|
342
337
|
this.disabled = isDisabled;
|
343
338
|
this.buttons?.forEach((button) => button.updateDisabled());
|
344
339
|
}
|
345
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
346
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "
|
340
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxToggleGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
341
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.0.4", type: RdxToggleGroupDirective, isStandalone: true, selector: "[rdxToggleGroup]", inputs: { value: "value", orientation: "orientation", disabled: ["disabled", "disabled", booleanAttribute], wrap: ["wrap", "wrap", booleanAttribute], valueChange: "valueChange" }, host: { attributes: { "role": "group" }, listeners: { "focusout": "onTouched?.()" }, properties: { "attr.data-orientation": "orientation" } }, providers: [
|
347
342
|
{ provide: RdxToggleGroupToken, useExisting: RdxToggleGroupDirective },
|
348
343
|
{ provide: NG_VALUE_ACCESSOR, useExisting: RdxToggleGroupDirective, multi: true }
|
349
344
|
], queries: [{ propertyName: "buttons", predicate: RdxToggleGroupButtonToken }], usesOnChanges: true, hostDirectives: [{ directive: i1.RdxRovingFocusGroupDirective, inputs: ["rdxRovingFocusGroupWrap", "wrap", "rdxRovingFocusGroupOrientation", "orientation"] }], ngImport: i0 }); }
|
350
345
|
}
|
351
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
346
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxToggleGroupDirective, decorators: [{
|
352
347
|
type: Directive,
|
353
348
|
args: [{
|
354
349
|
selector: '[rdxToggleGroup]',
|
@@ -370,20 +365,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
370
365
|
}
|
371
366
|
}]
|
372
367
|
}], propDecorators: { value: [{
|
373
|
-
type: Input
|
374
|
-
args: ['rdxToggleGroupValue']
|
368
|
+
type: Input
|
375
369
|
}], orientation: [{
|
376
|
-
type: Input
|
377
|
-
args: ['rdxToggleGroupOrientation']
|
370
|
+
type: Input
|
378
371
|
}], disabled: [{
|
379
372
|
type: Input,
|
380
|
-
args: [{
|
373
|
+
args: [{ transform: booleanAttribute }]
|
381
374
|
}], wrap: [{
|
382
375
|
type: Input,
|
383
|
-
args: [{
|
376
|
+
args: [{ transform: booleanAttribute }]
|
384
377
|
}], valueChange: [{
|
385
|
-
type: Input
|
386
|
-
args: ['rdxToggleGroupValueChange']
|
378
|
+
type: Input
|
387
379
|
}], buttons: [{
|
388
380
|
type: ContentChildren,
|
389
381
|
args: [RdxToggleGroupButtonToken]
|