@radix-ng/primitives 0.39.3 → 0.39.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-toggle-group.mjs","sources":["../../../packages/primitives/toggle-group/src/toggle-group-item.token.ts","../../../packages/primitives/toggle-group/src/toggle-group.token.ts","../../../packages/primitives/toggle-group/src/toggle-group-item.directive.ts","../../../packages/primitives/toggle-group/src/toggle-group-without-focus.directive.ts","../../../packages/primitives/toggle-group/src/toggle-group.directive.ts","../../../packages/primitives/toggle-group/radix-ng-primitives-toggle-group.ts"],"sourcesContent":["import { inject, InjectionToken } from '@angular/core';\nimport type { RdxToggleGroupItemDirective } from './toggle-group-item.directive';\n\nexport const RdxToggleGroupItemToken = new InjectionToken<RdxToggleGroupItemDirective>('RdxToggleGroupItemToken');\n\nexport function injectToggleGroupItem(): RdxToggleGroupItemDirective {\n return inject(RdxToggleGroupItemToken);\n}\n","import { inject, InjectionToken } from '@angular/core';\n\nexport interface IRdxToggleGroup {\n toggle(value: string): void;\n disabled: any;\n value: any;\n type: any;\n}\n\nexport const RdxToggleGroupToken = new InjectionToken<IRdxToggleGroup>('RdxToggleGroupToken');\n\nexport function injectToggleGroup(): IRdxToggleGroup {\n return inject(RdxToggleGroupToken);\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, effect, inject, input } from '@angular/core';\nimport { RdxRovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';\nimport { RdxToggleDirective } from '@radix-ng/primitives/toggle';\nimport { RdxToggleGroupItemToken } from './toggle-group-item.token';\nimport { injectToggleGroup } from './toggle-group.token';\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxToggleGroupItem]',\n exportAs: 'rdxToggleGroupItem',\n providers: [{ provide: RdxToggleGroupItemToken, useExisting: RdxToggleGroupItemDirective }],\n hostDirectives: [\n {\n directive: RdxRovingFocusItemDirective,\n inputs: ['focusable', 'active', 'allowShiftKey']\n },\n {\n directive: RdxToggleDirective,\n inputs: ['pressed', 'disabled']\n }\n ],\n host: {\n '(click)': 'toggle()'\n }\n})\nexport class RdxToggleGroupItemDirective {\n private readonly rdxToggleDirective = inject(RdxToggleDirective);\n\n private readonly rdxRovingFocusItemDirective = inject(RdxRovingFocusItemDirective);\n\n /**\n * Access the toggle group.\n * @ignore\n */\n protected readonly rootContext = injectToggleGroup();\n\n /**\n * The value of this toggle button.\n *\n * @group Props\n */\n readonly value = input.required<string>();\n\n /**\n * Whether this toggle button is disabled.\n * @defaultValue false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n private readonly isPressed = computed(() => {\n return this.rootContext.type() === 'single'\n ? this.rootContext.value() === this.value()\n : this.rootContext.value()?.includes(this.value());\n });\n\n private readonly isDisabled = computed(() => this.rootContext.disabled() || this.disabled());\n\n constructor() {\n effect(() => {\n this.rdxToggleDirective.pressed.set(!!this.isPressed());\n this.rdxToggleDirective.disabledModel.set(this.isDisabled());\n\n this.rdxRovingFocusItemDirective.active = !!this.isPressed();\n });\n }\n\n /**\n * @ignore\n */\n toggle(): void {\n if (this.disabled()) {\n return;\n }\n\n this.rootContext.toggle(this.value());\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, model, output, signal } from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { provideValueAccessor } from '@radix-ng/primitives/core';\nimport { RdxToggleGroupToken } from './toggle-group.token';\n\nlet nextId = 0;\n\n@Directive({\n selector: '[rdxToggleGroupWithoutFocus]',\n exportAs: 'rdxToggleGroupWithoutFocus',\n providers: [\n { provide: RdxToggleGroupToken, useExisting: RdxToggleGroupWithoutFocusDirective },\n provideValueAccessor(RdxToggleGroupWithoutFocusDirective)\n ],\n host: {\n role: 'group',\n '(focusout)': 'onTouched?.()'\n }\n})\nexport class RdxToggleGroupWithoutFocusDirective implements ControlValueAccessor {\n /**\n * @ignore\n */\n readonly id: string = `rdx-toggle-group-${nextId++}`;\n\n /**\n * @group Props\n */\n readonly value = model<string | string[] | undefined>(undefined);\n\n /**\n * @group Props\n */\n readonly type = input<'single' | 'multiple'>('single');\n\n /**\n * Whether the toggle group is disabled.\n * @defaultValue false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Event emitted when the selected toggle button changes.\n * @group Emits\n */\n readonly onValueChange = output<string[] | string | undefined>();\n\n /**\n * The value change callback.\n */\n private onChange?: (value: string | string[] | undefined) => void;\n\n /**\n * onTouch function registered via registerOnTouch (ControlValueAccessor).\n */\n protected onTouched?: () => void;\n\n /**\n * Toggle a value.\n * @param value The value to toggle.\n * @ignore\n */\n toggle(value: string): void {\n if (this.disabled()) {\n return;\n }\n\n if (this.type() === 'single') {\n this.value.set(value);\n } else {\n this.value.set(\n ((currentValue) =>\n currentValue && Array.isArray(currentValue)\n ? currentValue.includes(value)\n ? currentValue.filter((v) => v !== value) // delete\n : [...currentValue, value] // update\n : [value])(this.value())\n );\n }\n\n this.onValueChange.emit(this.value());\n this.onChange?.(this.value());\n }\n\n /**\n * Select a value from Angular forms.\n * @param value The value to select.\n * @ignore\n */\n writeValue(value: string): void {\n this.value.set(value);\n }\n\n /**\n * Register a callback to be called when the value changes.\n * @param fn The callback to register.\n * @ignore\n */\n registerOnChange(fn: (value: string | string[] | undefined) => void): void {\n this.onChange = fn;\n }\n\n /**\n * Register a callback to be called when the toggle group is touched.\n * @param fn The callback to register.\n * @ignore\n */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n private readonly accessorDisabled = signal(false);\n\n /**\n * Set the disabled state of the toggle group.\n * @param isDisabled Whether the toggle group is disabled.\n * @ignore\n */\n setDisabledState(isDisabled: boolean): void {\n this.accessorDisabled.set(isDisabled);\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, model, output, signal } from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport {\n AcceptableValue,\n isEqual,\n isValueEqualOrExist,\n provideToken,\n provideValueAccessor\n} from '@radix-ng/primitives/core';\nimport { RdxRovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';\nimport { RdxToggleGroupToken } from './toggle-group.token';\n\nlet nextId = 0;\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxToggleGroup]',\n exportAs: 'rdxToggleGroup',\n providers: [\n provideToken(RdxToggleGroupToken, RdxToggleGroupDirective),\n provideValueAccessor(RdxToggleGroupDirective)\n ],\n hostDirectives: [{ directive: RdxRovingFocusGroupDirective, inputs: ['dir', 'orientation', 'loop'] }],\n host: {\n role: 'group',\n\n '(focusout)': 'onTouched?.()'\n }\n})\nexport class RdxToggleGroupDirective implements ControlValueAccessor {\n /**\n * @ignore\n */\n readonly id: string = `rdx-toggle-group-${nextId++}`;\n\n /**\n * @group Props\n */\n readonly value = model<AcceptableValue | AcceptableValue[] | undefined>(undefined);\n\n /**\n * @group Props\n */\n readonly type = input<'single' | 'multiple'>('single');\n\n /**\n * Whether the toggle group is disabled.\n * @defaultValue false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Event emitted when the selected toggle button changes.\n * @group Emits\n */\n readonly onValueChange = output<AcceptableValue | AcceptableValue[] | undefined>();\n\n /**\n * The value change callback.\n */\n private onChange?: (value: AcceptableValue | AcceptableValue[] | undefined) => void;\n\n /**\n * onTouch function registered via registerOnTouch (ControlValueAccessor).\n */\n protected onTouched?: () => void;\n\n /**\n * Toggle a value.\n * @param value The value to toggle.\n * @ignore\n */\n toggle(value: AcceptableValue): void {\n if (this.disabled()) {\n return;\n }\n\n if (this.type() === 'single') {\n this.value.set(isEqual(value, this.value()) ? undefined : value);\n } else {\n const modelValueArray = Array.isArray(this.value())\n ? [...((this.value() as AcceptableValue[]) || [])]\n : [this.value()].filter(Boolean);\n if (isValueEqualOrExist(modelValueArray, value)) {\n const index = modelValueArray.findIndex((i) => isEqual(i, value));\n modelValueArray.splice(index, 1);\n } else {\n modelValueArray.push(value);\n }\n this.value.set(modelValueArray);\n }\n\n this.onValueChange.emit(this.value());\n this.onChange?.(this.value());\n }\n\n /**\n * Select a value from Angular forms.\n * @param value The value to select.\n * @ignore\n */\n writeValue(value: string): void {\n this.value.set(value);\n }\n\n /**\n * Register a callback to be called when the value changes.\n * @param fn The callback to register.\n * @ignore\n */\n registerOnChange(fn: (value: AcceptableValue | AcceptableValue[] | undefined) => void): void {\n this.onChange = fn;\n }\n\n /**\n * Register a callback to be called when the toggle group is touched.\n * @param fn The callback to register.\n * @ignore\n */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n private readonly accessorDisabled = signal(false);\n /**\n * Set the disabled state of the toggle group.\n * @param isDisabled Whether the toggle group is disabled.\n * @ignore\n */\n setDisabledState(isDisabled: boolean): void {\n this.accessorDisabled.set(isDisabled);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["nextId"],"mappings":";;;;;;;;MAGa,uBAAuB,GAAG,IAAI,cAAc,CAA8B,yBAAyB;SAEhG,qBAAqB,GAAA;AACjC,IAAA,OAAO,MAAM,CAAC,uBAAuB,CAAC;AAC1C;;MCEa,mBAAmB,GAAG,IAAI,cAAc,CAAkB,qBAAqB;SAE5E,iBAAiB,GAAA;AAC7B,IAAA,OAAO,MAAM,CAAC,mBAAmB,CAAC;AACtC;;ACNA;;AAEG;MAmBU,2BAA2B,CAAA;AAiCpC,IAAA,WAAA,GAAA;AAhCiB,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;AAE/C,QAAA,IAAA,CAAA,2BAA2B,GAAG,MAAM,CAAC,2BAA2B,CAAC;AAElF;;;AAGG;QACgB,IAAW,CAAA,WAAA,GAAG,iBAAiB,EAAE;AAEpD;;;;AAIG;AACM,QAAA,IAAA,CAAA,KAAK,GAAG,KAA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le-group/src/toggle-group-item.token.ts","../../../packages/primitives/toggle-group/src/toggle-group.token.ts","../../../packages/primitives/toggle-group/src/toggle-group-item.directive.ts","../../../packages/primitives/toggle-group/src/toggle-group-without-focus.directive.ts","../../../packages/primitives/toggle-group/src/toggle-group.directive.ts","../../../packages/primitives/toggle-group/radix-ng-primitives-toggle-group.ts"],"sourcesContent":["import { inject, InjectionToken } from '@angular/core';\nimport type { RdxToggleGroupItemDirective } from './toggle-group-item.directive';\n\nexport const RdxToggleGroupItemToken = new InjectionToken<RdxToggleGroupItemDirective>('RdxToggleGroupItemToken');\n\nexport function injectToggleGroupItem(): RdxToggleGroupItemDirective {\n return inject(RdxToggleGroupItemToken);\n}\n","import { inject, InjectionToken } from '@angular/core';\n\nexport interface IRdxToggleGroup {\n toggle(value: string): void;\n disabled: any;\n value: any;\n type: any;\n accessorDisabled: any;\n}\n\nexport const RdxToggleGroupToken = new InjectionToken<IRdxToggleGroup>('RdxToggleGroupToken');\n\nexport function injectToggleGroup(): IRdxToggleGroup {\n return inject(RdxToggleGroupToken);\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, effect, inject, input } from '@angular/core';\nimport { RdxRovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';\nimport { RdxToggleDirective } from '@radix-ng/primitives/toggle';\nimport { RdxToggleGroupItemToken } from './toggle-group-item.token';\nimport { injectToggleGroup } from './toggle-group.token';\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxToggleGroupItem]',\n exportAs: 'rdxToggleGroupItem',\n providers: [{ provide: RdxToggleGroupItemToken, useExisting: RdxToggleGroupItemDirective }],\n hostDirectives: [\n {\n directive: RdxRovingFocusItemDirective,\n inputs: ['focusable', 'active', 'allowShiftKey']\n },\n {\n directive: RdxToggleDirective,\n inputs: ['pressed', 'disabled']\n }\n ],\n host: {\n '(click)': 'toggle()'\n }\n})\nexport class RdxToggleGroupItemDirective {\n private readonly rdxToggleDirective = inject(RdxToggleDirective);\n\n private readonly rdxRovingFocusItemDirective = inject(RdxRovingFocusItemDirective);\n\n /**\n * Access the toggle group.\n * @ignore\n */\n protected readonly rootContext = injectToggleGroup();\n\n /**\n * The value of this toggle button.\n *\n * @group Props\n */\n readonly value = input.required<string>();\n\n /**\n * Whether this toggle button is disabled.\n * @defaultValue false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n private readonly isPressed = computed(() => {\n return this.rootContext.type() === 'single'\n ? this.rootContext.value() === this.value()\n : this.rootContext.value()?.includes(this.value());\n });\n\n private readonly isDisabled = computed(\n () => this.rootContext.disabled() || this.rootContext.accessorDisabled() || this.disabled()\n );\n\n constructor() {\n effect(() => {\n this.rdxToggleDirective.cva.writeValue(!!this.isPressed());\n this.rdxToggleDirective.cva.setValue(!!this.isPressed());\n this.rdxToggleDirective.cva.setDisabledState(this.isDisabled());\n\n this.rdxRovingFocusItemDirective.active = !!this.isPressed();\n });\n }\n\n /**\n * @ignore\n */\n toggle(): void {\n if (this.disabled()) {\n return;\n }\n\n this.rootContext.toggle(this.value());\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, model, output, signal } from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { provideValueAccessor } from '@radix-ng/primitives/core';\nimport { RdxToggleGroupToken } from './toggle-group.token';\n\nlet nextId = 0;\n\n@Directive({\n selector: '[rdxToggleGroupWithoutFocus]',\n exportAs: 'rdxToggleGroupWithoutFocus',\n providers: [\n { provide: RdxToggleGroupToken, useExisting: RdxToggleGroupWithoutFocusDirective },\n provideValueAccessor(RdxToggleGroupWithoutFocusDirective)\n ],\n host: {\n role: 'group',\n '(focusout)': 'onTouched?.()'\n }\n})\nexport class RdxToggleGroupWithoutFocusDirective implements ControlValueAccessor {\n /**\n * @ignore\n */\n readonly id: string = `rdx-toggle-group-${nextId++}`;\n\n /**\n * @group Props\n */\n readonly value = model<string | string[] | undefined>(undefined);\n\n /**\n * @group Props\n */\n readonly type = input<'single' | 'multiple'>('single');\n\n /**\n * Whether the toggle group is disabled.\n * @defaultValue false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Event emitted when the selected toggle button changes.\n * @group Emits\n */\n readonly onValueChange = output<string[] | string | undefined>();\n\n /**\n * The value change callback.\n */\n private onChange?: (value: string | string[] | undefined) => void;\n\n /**\n * onTouch function registered via registerOnTouch (ControlValueAccessor).\n */\n protected onTouched?: () => void;\n\n /**\n * Toggle a value.\n * @param value The value to toggle.\n * @ignore\n */\n toggle(value: string): void {\n if (this.disabled()) {\n return;\n }\n\n if (this.type() === 'single') {\n this.value.set(value);\n } else {\n this.value.set(\n ((currentValue) =>\n currentValue && Array.isArray(currentValue)\n ? currentValue.includes(value)\n ? currentValue.filter((v) => v !== value) // delete\n : [...currentValue, value] // update\n : [value])(this.value())\n );\n }\n\n this.onValueChange.emit(this.value());\n this.onChange?.(this.value());\n }\n\n /**\n * Select a value from Angular forms.\n * @param value The value to select.\n * @ignore\n */\n writeValue(value: string): void {\n this.value.set(value);\n }\n\n /**\n * Register a callback to be called when the value changes.\n * @param fn The callback to register.\n * @ignore\n */\n registerOnChange(fn: (value: string | string[] | undefined) => void): void {\n this.onChange = fn;\n }\n\n /**\n * Register a callback to be called when the toggle group is touched.\n * @param fn The callback to register.\n * @ignore\n */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n private readonly accessorDisabled = signal(false);\n\n /**\n * Set the disabled state of the toggle group.\n * @param isDisabled Whether the toggle group is disabled.\n * @ignore\n */\n setDisabledState(isDisabled: boolean): void {\n this.accessorDisabled.set(isDisabled);\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, model, output, signal } from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport {\n AcceptableValue,\n isEqual,\n isValueEqualOrExist,\n provideToken,\n provideValueAccessor\n} from '@radix-ng/primitives/core';\nimport { RdxRovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';\nimport { RdxToggleGroupToken } from './toggle-group.token';\n\nlet nextId = 0;\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxToggleGroup]',\n exportAs: 'rdxToggleGroup',\n providers: [\n provideToken(RdxToggleGroupToken, RdxToggleGroupDirective),\n provideValueAccessor(RdxToggleGroupDirective)\n ],\n hostDirectives: [{ directive: RdxRovingFocusGroupDirective, inputs: ['dir', 'orientation', 'loop'] }],\n host: {\n role: 'group',\n\n '(focusout)': 'onTouched?.()'\n }\n})\nexport class RdxToggleGroupDirective implements ControlValueAccessor {\n /**\n * @ignore\n */\n readonly id: string = `rdx-toggle-group-${nextId++}`;\n\n /**\n * @group Props\n */\n readonly value = model<AcceptableValue | AcceptableValue[] | undefined>(undefined);\n\n /**\n * @group Props\n */\n readonly type = input<'single' | 'multiple'>('single');\n\n /**\n * Whether the toggle group is disabled.\n * @defaultValue false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Event emitted when the selected toggle button changes.\n * @group Emits\n */\n readonly onValueChange = output<AcceptableValue | AcceptableValue[] | undefined>();\n\n /**\n * The value change callback.\n */\n private onChange?: (value: AcceptableValue | AcceptableValue[] | undefined) => void;\n\n /**\n * onTouch function registered via registerOnTouch (ControlValueAccessor).\n */\n protected onTouched?: () => void;\n\n /**\n * Toggle a value.\n * @param value The value to toggle.\n * @ignore\n */\n toggle(value: AcceptableValue): void {\n if (this.disabled()) {\n return;\n }\n\n if (this.type() === 'single') {\n this.value.set(isEqual(value, this.value()) ? undefined : value);\n } else {\n const modelValueArray = Array.isArray(this.value())\n ? [...((this.value() as AcceptableValue[]) || [])]\n : [this.value()].filter(Boolean);\n if (isValueEqualOrExist(modelValueArray, value)) {\n const index = modelValueArray.findIndex((i) => isEqual(i, value));\n modelValueArray.splice(index, 1);\n } else {\n modelValueArray.push(value);\n }\n this.value.set(modelValueArray);\n }\n\n this.onValueChange.emit(this.value());\n this.onChange?.(this.value());\n }\n\n /**\n * Select a value from Angular forms.\n * @param value The value to select.\n * @ignore\n */\n writeValue(value: string): void {\n this.value.set(value);\n }\n\n /**\n * Register a callback to be called when the value changes.\n * @param fn The callback to register.\n * @ignore\n */\n registerOnChange(fn: (value: AcceptableValue | AcceptableValue[] | undefined) => void): void {\n this.onChange = fn;\n }\n\n /**\n * Register a callback to be called when the toggle group is touched.\n * @param fn The callback to register.\n * @ignore\n */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n readonly accessorDisabled = signal(false);\n /**\n * Set the disabled state of the toggle group.\n * @param isDisabled Whether the toggle group is disabled.\n * @ignore\n */\n setDisabledState(isDisabled: boolean): void {\n this.accessorDisabled.set(isDisabled);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["nextId"],"mappings":";;;;;;;;MAGa,uBAAuB,GAAG,IAAI,cAAc,CAA8B,yBAAyB;SAEhG,qBAAqB,GAAA;AACjC,IAAA,OAAO,MAAM,CAAC,uBAAuB,CAAC;AAC1C;;MCGa,mBAAmB,GAAG,IAAI,cAAc,CAAkB,qBAAqB;SAE5E,iBAAiB,GAAA;AAC7B,IAAA,OAAO,MAAM,CAAC,mBAAmB,CAAC;AACtC;;ACPA;;AAEG;MAmBU,2BAA2B,CAAA;AAmCpC,IAAA,WAAA,GAAA;AAlCiB,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;AAE/C,QAAA,IAAA,CAAA,2BAA2B,GAAG,MAAM,CAAC,2BAA2B,CAAC;AAElF;;;AAGG;QACgB,IAAW,CAAA,WAAA,GAAG,iBAAiB,EAAE;AAEpD;;;;AAIG;AACM,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAU;AAEzC;;;;AAIG;QACM,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAwB,KAAK,EAAE,EAAE,SAAS,E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1
1
  import * as i0 from '@angular/core';
2
- import { Directive, input, booleanAttribute, model, computed, output, signal } from '@angular/core';
2
+ import { Directive, inject, input, booleanAttribute, model } from '@angular/core';
3
3
  import * as i1 from '@radix-ng/primitives/visually-hidden';
4
4
  import { RdxVisuallyHiddenInputDirective } from '@radix-ng/primitives/visually-hidden';
5
- import { provideValueAccessor } from '@radix-ng/primitives/core';
5
+ import { outputFromObservable, outputToObservable } from '@angular/core/rxjs-interop';
6
+ import * as i1$1 from '@radix-ng/primitives/core';
7
+ import { RdxControlValueAccessor } from '@radix-ng/primitives/core';
6
8
 
7
9
  class RdxToggleVisuallyHiddenInputDirective {
8
10
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxToggleVisuallyHiddenInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
@@ -30,6 +32,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
30
32
  */
31
33
  class RdxToggleDirective {
32
34
  constructor() {
35
+ /**
36
+ * @ignore
37
+ */
38
+ this.cva = inject(RdxControlValueAccessor);
33
39
  /**
34
40
  * The pressed state of the toggle when it is initially rendered.
35
41
  * Use when you do not need to control its pressed state.
@@ -50,60 +56,41 @@ class RdxToggleDirective {
50
56
  * @group Props
51
57
  */
52
58
  this.disabled = input(false, { transform: booleanAttribute });
53
- /** @ignore */
54
- this.disabledModel = model(this.disabled());
55
- /** @ignore */
56
- this.disabledState = computed(() => this.disabled() || this.disabledModel() || this.accessorDisabled());
57
- this.dataState = computed(() => {
58
- return this.pressed() ? 'on' : 'off';
59
- });
60
59
  /**
61
60
  * Event handler called when the pressed state of the toggle changes.
62
61
  *
63
62
  * @group Emits
64
63
  */
65
- this.onPressedChange = output();
66
- this.accessorDisabled = signal(false);
67
- this.onChange = () => { };
64
+ this.onPressedChange = outputFromObservable(outputToObservable(this.cva.valueChange));
68
65
  }
69
- togglePressed() {
66
+ onClick() {
70
67
  if (!this.disabled()) {
71
68
  this.pressed.set(!this.pressed());
72
- this.onChange(this.pressed());
73
- this.onPressedChange.emit(this.pressed());
69
+ this.cva.writeValue(this.pressed());
70
+ this.cva.setValue(this.pressed());
74
71
  }
75
72
  }
76
- /** @ignore */
77
- writeValue(value) {
78
- this.pressed.set(value);
79
- }
80
- /** @ignore */
81
- registerOnChange(fn) {
82
- this.onChange = fn;
83
- }
84
- /** @ignore */
85
- registerOnTouched(fn) {
86
- this.onTouched = fn;
87
- }
88
- /** @ignore */
89
- setDisabledState(isDisabled) {
90
- this.accessorDisabled.set(isDisabled);
91
- }
92
73
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxToggleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
93
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxToggleDirective, isStandalone: true, selector: "[rdxToggle]", inputs: { defaultPressed: { classPropertyName: "defaultPressed", publicName: "defaultPressed", isSignal: true, isRequired: false, transformFunction: null }, pressed: { classPropertyName: "pressed", publicName: "pressed", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disabledModel: { classPropertyName: "disabledModel", publicName: "disabledModel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pressed: "pressedChange", disabledModel: "disabledModelChange", onPressedChange: "onPressedChange" }, host: { listeners: { "click": "togglePressed()" }, properties: { "attr.aria-pressed": "pressed()", "attr.data-state": "dataState()", "attr.data-disabled": "disabledState() ? \"\" : undefined", "disabled": "disabledState()" } }, providers: [provideValueAccessor(RdxToggleDirective)], exportAs: ["rdxToggle"], ngImport: i0 }); }
74
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxToggleDirective, isStandalone: true, selector: "[rdxToggle]", inputs: { defaultPressed: { classPropertyName: "defaultPressed", publicName: "defaultPressed", isSignal: true, isRequired: false, transformFunction: null }, pressed: { classPropertyName: "pressed", publicName: "pressed", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pressed: "pressedChange", onPressedChange: "onPressedChange" }, host: { attributes: { "type": "button" }, listeners: { "click": "onClick()" }, properties: { "attr.aria-pressed": "cva.value()", "attr.data-state": "cva.value() ? \"on\" : \"off\"", "attr.data-disabled": "cva.disabled() ? \"\" : undefined", "disabled": "cva.disabled()" } }, exportAs: ["rdxToggle"], hostDirectives: [{ directive: i1$1.RdxControlValueAccessor, inputs: ["value", "pressed", "disabled", "disabled"] }], ngImport: i0 }); }
94
75
  }
95
76
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxToggleDirective, decorators: [{
96
77
  type: Directive,
97
78
  args: [{
98
79
  selector: '[rdxToggle]',
99
80
  exportAs: 'rdxToggle',
100
- providers: [provideValueAccessor(RdxToggleDirective)],
81
+ hostDirectives: [
82
+ {
83
+ directive: RdxControlValueAccessor,
84
+ inputs: ['value: pressed', 'disabled']
85
+ }
86
+ ],
101
87
  host: {
102
- '[attr.aria-pressed]': 'pressed()',
103
- '[attr.data-state]': 'dataState()',
104
- '[attr.data-disabled]': 'disabledState() ? "" : undefined',
105
- '[disabled]': 'disabledState()',
106
- '(click)': 'togglePressed()'
88
+ type: 'button',
89
+ '[attr.aria-pressed]': 'cva.value()',
90
+ '[attr.data-state]': 'cva.value() ? "on" : "off"',
91
+ '[attr.data-disabled]': 'cva.disabled() ? "" : undefined',
92
+ '[disabled]': 'cva.disabled()',
93
+ '(click)': 'onClick()'
107
94
  }
108
95
  }]
109
96
  }] });
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-toggle.mjs","sources":["../../../packages/primitives/toggle/src/toggle-visually-hidden-input.directive.ts","../../../packages/primitives/toggle/src/toggle.directive.ts","../../../packages/primitives/toggle/radix-ng-primitives-toggle.ts"],"sourcesContent":["import { Directive } from '@angular/core';\nimport { RdxVisuallyHiddenInputDirective } from '@radix-ng/primitives/visually-hidden';\n\n@Directive({\n selector: 'input[rdxToggleVisuallyHiddenInput]',\n exportAs: 'rdxToggleVisuallyHiddenInput',\n hostDirectives: [\n {\n directive: RdxVisuallyHiddenInputDirective,\n inputs: ['name', 'required', 'value', 'disabled']\n }\n ],\n host: {\n type: 'checkbox'\n }\n})\nexport class RdxToggleVisuallyHiddenInputDirective {}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, input, model, output, OutputEmitterRef, signal } from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { provideValueAccessor } from '@radix-ng/primitives/core';\n\nexport interface ToggleProps {\n /**\n * The controlled state of the toggle.\n */\n pressed?: boolean;\n\n /**\n * The state of the toggle when initially rendered. Use `defaultPressed`\n * if you do not need to control the state of the toggle.\n * @defaultValue false\n */\n defaultPressed?: boolean;\n\n /**\n * The callback that fires when the state of the toggle changes.\n */\n onPressedChange?: OutputEmitterRef<boolean>;\n\n /**\n * Whether the toggle is disabled.\n * @defaultValue false\n */\n disabled?: boolean;\n}\n\nexport type DataState = 'on' | 'off';\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxToggle]',\n exportAs: 'rdxToggle',\n providers: [provideValueAccessor(RdxToggleDirective)],\n host: {\n '[attr.aria-pressed]': 'pressed()',\n '[attr.data-state]': 'dataState()',\n '[attr.data-disabled]': 'disabledState() ? \"\" : undefined',\n '[disabled]': 'disabledState()',\n\n '(click)': 'togglePressed()'\n }\n})\nexport class RdxToggleDirective implements ControlValueAccessor {\n /**\n * The pressed state of the toggle when it is initially rendered.\n * Use when you do not need to control its pressed state.\n *\n * @group Props\n */\n readonly defaultPressed = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * The controlled pressed state of the toggle.\n * Must be used in conjunction with `onPressedChange`.\n *\n * @group Props\n */\n readonly pressed = model<boolean>(this.defaultPressed());\n\n /**\n * When true, prevents the user from interacting with the toggle.\n *\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /** @ignore */\n readonly disabledModel = model<boolean>(this.disabled());\n\n /** @ignore */\n readonly disabledState = computed(() => this.disabled() || this.disabledModel() || this.accessorDisabled());\n\n protected readonly dataState = computed<DataState>(() => {\n return this.pressed() ? 'on' : 'off';\n });\n\n /**\n * Event handler called when the pressed state of the toggle changes.\n *\n * @group Emits\n */\n readonly onPressedChange = output<boolean>();\n\n protected togglePressed(): void {\n if (!this.disabled()) {\n this.pressed.set(!this.pressed());\n this.onChange(this.pressed());\n this.onPressedChange.emit(this.pressed());\n }\n }\n\n private readonly accessorDisabled = signal(false);\n\n private onChange: (value: any) => void = () => {};\n\n /** @ignore */\n onTouched: (() => void) | undefined;\n\n /** @ignore */\n writeValue(value: any): void {\n this.pressed.set(value);\n }\n\n /** @ignore */\n registerOnChange(fn: (value: any) => void): void {\n this.onChange = fn;\n }\n\n /** @ignore */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /** @ignore */\n setDisabledState(isDisabled: boolean): void {\n this.accessorDisabled.set(isDisabled);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAgBa,qCAAqC,CAAA;8GAArC,qCAAqC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAArC,qCAAqC,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,qCAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,MAAA,EAAA,UAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,8BAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,+BAAA,EAAA,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EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAU5C,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAb9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,SAAS,EAAE,CAAC,oBAAoB,CAAA,kBAAA,CAAoB,CAAC;AACrD,oBAAA,IAAI,EAAE;AACF,wBAAA,qBAAqB,EAAE,WAAW;AAClC,wBAAA,mBAAmB,EAAE,aAAa;AAClC,wBAAA,sBAAsB,EAAE,kCAAkC;AAC1D,wBAAA,YAAY,EAAE,iBAAiB;AAE/B,wBAAA,SAAS,EAAE;AACd;AACJ,iBAAA;;;AC/CD;;AAEG;;;;"}
1
+ {"version":3,"file":"radix-ng-primitives-toggle.mjs","sources":["../../../packages/primitives/toggle/src/toggle-visually-hidden-input.directive.ts","../../../packages/primitives/toggle/src/toggle.directive.ts","../../../packages/primitives/toggle/radix-ng-primitives-toggle.ts"],"sourcesContent":["import { Directive } from '@angular/core';\nimport { RdxVisuallyHiddenInputDirective } from '@radix-ng/primitives/visually-hidden';\n\n@Directive({\n selector: 'input[rdxToggleVisuallyHiddenInput]',\n exportAs: 'rdxToggleVisuallyHiddenInput',\n hostDirectives: [\n {\n directive: RdxVisuallyHiddenInputDirective,\n inputs: ['name', 'required', 'value', 'disabled']\n }\n ],\n host: {\n type: 'checkbox'\n }\n})\nexport class RdxToggleVisuallyHiddenInputDirective {}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, inject, input, model, OutputEmitterRef } from '@angular/core';\nimport { outputFromObservable, outputToObservable } from '@angular/core/rxjs-interop';\nimport { RdxControlValueAccessor } from '@radix-ng/primitives/core';\n\nexport interface ToggleProps {\n /**\n * The controlled state of the toggle.\n */\n pressed?: boolean;\n\n /**\n * The state of the toggle when initially rendered. Use `defaultPressed`\n * if you do not need to control the state of the toggle.\n * @defaultValue false\n */\n defaultPressed?: boolean;\n\n /**\n * The callback that fires when the state of the toggle changes.\n */\n onPressedChange?: OutputEmitterRef<boolean>;\n\n /**\n * Whether the toggle is disabled.\n * @defaultValue false\n */\n disabled?: boolean;\n}\n\nexport type DataState = 'on' | 'off';\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxToggle]',\n exportAs: 'rdxToggle',\n hostDirectives: [\n {\n directive: RdxControlValueAccessor,\n inputs: ['value: pressed', 'disabled']\n }\n ],\n host: {\n type: 'button',\n '[attr.aria-pressed]': 'cva.value()',\n '[attr.data-state]': 'cva.value() ? \"on\" : \"off\"',\n '[attr.data-disabled]': 'cva.disabled() ? \"\" : undefined',\n '[disabled]': 'cva.disabled()',\n\n '(click)': 'onClick()'\n }\n})\nexport class RdxToggleDirective {\n /**\n * @ignore\n */\n readonly cva = inject(RdxControlValueAccessor);\n\n /**\n * The pressed state of the toggle when it is initially rendered.\n * Use when you do not need to control its pressed state.\n *\n * @group Props\n */\n readonly defaultPressed = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * The controlled pressed state of the toggle.\n * Must be used in conjunction with `onPressedChange`.\n *\n * @group Props\n */\n readonly pressed = model<boolean>(this.defaultPressed());\n\n /**\n * When true, prevents the user from interacting with the toggle.\n *\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Event handler called when the pressed state of the toggle changes.\n *\n * @group Emits\n */\n readonly onPressedChange = outputFromObservable(outputToObservable(this.cva.valueChange));\n\n protected onClick(): void {\n if (!this.disabled()) {\n this.pressed.set(!this.pressed());\n this.cva.writeValue(this.pressed());\n this.cva.setValue(this.pressed());\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;MAgBa,qCAAqC,CAAA;8GAArC,qCAAqC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA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,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,WAAA,EAAA,EAAA,UAAA,EAAA,EAAA,mBAAA,EAAA,aAAA,EAAA,iBAAA,EAAA,gCAAA,EAAA,oBAAA,EAAA,mCAAA,EAAA,UAAA,EAAA,gBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAAA,IAAA,CAAA,uBAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,SAAA,EAAA,UAAA,EAAA,UAAA,CAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAnB9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,cAAc,EAAE;AACZ,wBAAA;AACI,4BAAA,SAAS,EAAE,uBAAuB;AAClC,4BAAA,MAAM,EAAE,CAAC,gBAAgB,EAAE,UAAU;AACxC;AACJ,qBAAA;AACD,oBAAA,IAAI,EAAE;AACF,wBAAA,IAAI,EAAE,QAAQ;AACd,wBAAA,qBAAqB,EAAE,aAAa;AACpC,wBAAA,mBAAmB,EAAE,4BAA4B;AACjD,wBAAA,sBAAsB,EAAE,iCAAiC;AACzD,wBAAA,YAAY,EAAE,gBAAgB;AAE9B,wBAAA,SAAS,EAAE;AACd;AACJ,iBAAA;;;ACrDD;;AAEG;;;;"}
@@ -1,6 +1,9 @@
1
1
  import { NumberInput } from '@angular/cdk/coercion';
2
2
  import { ElementRef } from '@angular/core';
3
3
  import * as i0 from "@angular/core";
4
+ /**
5
+ * @group Components
6
+ */
4
7
  export declare class RdxHoverCardArrowDirective {
5
8
  /** @ignore */
6
9
  private readonly renderer;
@@ -9,13 +12,15 @@ export declare class RdxHoverCardArrowDirective {
9
12
  /** @ignore */
10
13
  readonly elementRef: ElementRef<any>;
11
14
  /**
12
- * @description The width of the arrow in pixels.
13
- * @default 10
15
+ * The width of the arrow in pixels.
16
+ * @group Props
17
+ * @defaultValue 10
14
18
  */
15
19
  readonly width: import("@angular/core").InputSignalWithTransform<number, NumberInput>;
16
20
  /**
17
- * @description The height of the arrow in pixels.
18
- * @default 5
21
+ * The height of the arrow in pixels.
22
+ * @group Props
23
+ * @defaultValue 5
19
24
  */
20
25
  readonly height: import("@angular/core").InputSignalWithTransform<number, NumberInput>;
21
26
  /** @ignore */
@@ -3,6 +3,9 @@ import { OnInit } from '@angular/core';
3
3
  import { RdxPositionAlign, RdxPositionSide } from '@radix-ng/primitives/core';
4
4
  import * as i0 from "@angular/core";
5
5
  import * as i1 from "@angular/cdk/overlay";
6
+ /**
7
+ * @group Components
8
+ */
6
9
  export declare class RdxHoverCardContentDirective implements OnInit {
7
10
  /** @ignore */
8
11
  private readonly rootDirective;
@@ -17,54 +20,67 @@ export declare class RdxHoverCardContentDirective implements OnInit {
17
20
  /** @ignore */
18
21
  readonly name: import("@angular/core").Signal<string>;
19
22
  /**
20
- * @description The preferred side of the trigger to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled.
21
- * @default top
23
+ * The preferred side of the trigger to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled.
24
+ * @group Props
25
+ * @defaultValue top
22
26
  */
23
27
  readonly side: import("@angular/core").InputSignal<RdxPositionSide>;
24
28
  /**
25
- * @description The distance in pixels from the trigger.
26
- * @default undefined
29
+ * The distance in pixels from the trigger.
30
+ * @group Props
31
+ * @defaultValue undefined
27
32
  */
28
33
  readonly sideOffset: import("@angular/core").InputSignalWithTransform<number, NumberInput>;
29
34
  /**
30
- * @description The preferred alignment against the trigger. May change when collisions occur.
31
- * @default center
35
+ * The preferred alignment against the trigger. May change when collisions occur.
36
+ * @group Props
37
+ * @defaultValue center
32
38
  */
33
39
  readonly align: import("@angular/core").InputSignal<RdxPositionAlign>;
34
40
  /**
35
- * @description An offset in pixels from the "start" or "end" alignment options.
36
- * @default undefined
41
+ * An offset in pixels from the "start" or "end" alignment options.
42
+ * @group Props
43
+ * @defaultValue undefined
37
44
  */
38
45
  readonly alignOffset: import("@angular/core").InputSignalWithTransform<number, NumberInput>;
39
46
  /**
40
- * @description Whether to add some alternate positions of the content.
41
- * @default false
47
+ * Whether to add some alternate positions of the content.
48
+ * @group Props
49
+ * @defaultValue false
42
50
  */
43
51
  readonly alternatePositionsDisabled: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
44
- /** @description Whether to prevent `onOverlayEscapeKeyDown` handler from calling.
45
- * @default false
52
+ /**
53
+ * Whether to prevent `onOverlayEscapeKeyDown` handler from calling.
54
+ * @group Props
55
+ * @defaultValue false
46
56
  */
47
57
  readonly onOverlayEscapeKeyDownDisabled: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
48
- /** @description Whether to prevent `onOverlayOutsideClick` handler from calling.
49
- * @default false
58
+ /**
59
+ * Whether to prevent `onOverlayOutsideClick` handler from calling.
60
+ * @group Props
61
+ * @defaultValue false
50
62
  */
51
63
  readonly onOverlayOutsideClickDisabled: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
52
64
  /**
53
- * @description Event handler called when the escape key is down.
65
+ * Event handler called when the escape key is down.
54
66
  * It can be prevented by setting `onOverlayEscapeKeyDownDisabled` input to `true`.
67
+ * @group Emits
55
68
  */
56
69
  readonly onOverlayEscapeKeyDown: import("@angular/core").OutputEmitterRef<KeyboardEvent>;
57
70
  /**
58
- * @description Event handler called when a pointer event occurs outside the bounds of the component.
71
+ * Event handler called when a pointer event occurs outside the bounds of the component.
59
72
  * It can be prevented by setting `onOverlayOutsideClickDisabled` input to `true`.
73
+ * @group Emits
60
74
  */
61
75
  readonly onOverlayOutsideClick: import("@angular/core").OutputEmitterRef<MouseEvent>;
62
76
  /**
63
- * @description Event handler called after the overlay is open
77
+ * Event handler called after the overlay is open
78
+ * @group Emits
64
79
  */
65
80
  readonly onOpen: import("@angular/core").OutputEmitterRef<void>;
66
81
  /**
67
- * @description Event handler called after the overlay is closed
82
+ * Event handler called after the overlay is closed
83
+ * @group Emits
68
84
  */
69
85
  readonly onClosed: import("@angular/core").OutputEmitterRef<void>;
70
86
  /** @ingore */
@@ -6,54 +6,66 @@ import { RdxHoverCardContentDirective } from './hover-card-content.directive';
6
6
  import { RdxHoverCardTriggerDirective } from './hover-card-trigger.directive';
7
7
  import { RdxHoverCardAction, RdxHoverCardAnimationStatus, RdxHoverCardAttachDetachEvent, RdxHoverCardState } from './hover-card.types';
8
8
  import * as i0 from "@angular/core";
9
+ /**
10
+ * @group Components
11
+ */
9
12
  export declare class RdxHoverCardRootDirective {
10
13
  /** @ignore */
11
14
  readonly uniqueId: import("@angular/core").WritableSignal<number>;
12
15
  /** @ignore */
13
16
  readonly name: import("@angular/core").Signal<string>;
14
17
  /**
15
- * @description The anchor directive that comes from outside the hover-card rootDirective
16
- * @default undefined
18
+ * The anchor directive that comes from outside the hover-card rootDirective
19
+ * @group Props
20
+ * @defaultValue undefined
17
21
  */
18
22
  readonly anchor: import("@angular/core").InputSignal<RdxHoverCardAnchorDirective | undefined>;
19
23
  /**
20
- * @description The open state of the hover-card when it is initially rendered. Use when you do not need to control its open state.
21
- * @default false
24
+ * The open state of the hover-card when it is initially rendered. Use when you do not need to control its open state.
25
+ * @group Props
26
+ * @defaultValue false
22
27
  */
23
28
  readonly defaultOpen: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
24
29
  /**
25
- * @description The controlled state of the hover-card. `open` input takes precedence over `defaultOpen` input.
26
- * @default undefined
30
+ * The controlled state of the hover-card. `open` input takes precedence over `defaultOpen` input.
31
+ * @group Props
32
+ * @defaultValue undefined
27
33
  */
28
34
  readonly open: import("@angular/core").InputSignalWithTransform<boolean | undefined, BooleanInput>;
29
35
  /**
30
- * @description The delay in milliseconds before the hover-card opens.
31
- * @default 500
36
+ * The delay in milliseconds before the hover-card opens.
37
+ * @group Props
38
+ * @defaultValue 500
32
39
  */
33
40
  readonly openDelay: import("@angular/core").InputSignalWithTransform<number, NumberInput>;
34
41
  /**
35
- * @description The delay in milliseconds before the hover-card closes.
36
- * @default 200
42
+ * The delay in milliseconds before the hover-card closes.
43
+ * @group Props
44
+ * @defaultValue 200
37
45
  */
38
46
  readonly closeDelay: import("@angular/core").InputSignalWithTransform<number, NumberInput>;
39
47
  /**
40
- * @description Whether to control the state of the hover-card from outside. Use in conjunction with `open` input.
41
- * @default undefined
48
+ * Whether to control the state of the hover-card from outside. Use in conjunction with `open` input.
49
+ * @group Props
50
+ * @defaultValue undefined
42
51
  */
43
52
  readonly externalControl: import("@angular/core").InputSignalWithTransform<boolean | undefined, BooleanInput>;
44
53
  /**
45
- * @description Whether to take into account CSS opening/closing animations.
46
- * @default false
54
+ * Whether to take into account CSS opening/closing animations.
55
+ * @group Props
56
+ * @defaultValue false
47
57
  */
48
58
  readonly cssAnimation: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
49
59
  /**
50
- * @description Whether to take into account CSS opening animations. `cssAnimation` input must be set to 'true'
51
- * @default false
60
+ * Whether to take into account CSS opening animations. `cssAnimation` input must be set to 'true'
61
+ * @group Props
62
+ * @defaultValue false
52
63
  */
53
64
  readonly cssOpeningAnimation: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
54
65
  /**
55
- * @description Whether to take into account CSS closing animations. `cssAnimation` input must be set to 'true'
56
- * @default false
66
+ * Whether to take into account CSS closing animations. `cssAnimation` input must be set to 'true'
67
+ * @group Props
68
+ * @defaultValue false
57
69
  */
58
70
  readonly cssClosingAnimation: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
59
71
  /** @ignore */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ng/primitives",
3
- "version": "0.39.3",
3
+ "version": "0.39.4",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,7 +1,8 @@
1
1
  import { BooleanInput } from '@angular/cdk/coercion';
2
2
  import { OutputEmitterRef } from '@angular/core';
3
- import { ControlValueAccessor } from '@angular/forms';
3
+ import { RdxControlValueAccessor } from '@radix-ng/primitives/core';
4
4
  import * as i0 from "@angular/core";
5
+ import * as i1 from "@radix-ng/primitives/core";
5
6
  export interface ToggleProps {
6
7
  /**
7
8
  * The controlled state of the toggle.
@@ -27,7 +28,11 @@ export type DataState = 'on' | 'off';
27
28
  /**
28
29
  * @group Components
29
30
  */
30
- export declare class RdxToggleDirective implements ControlValueAccessor {
31
+ export declare class RdxToggleDirective {
32
+ /**
33
+ * @ignore
34
+ */
35
+ readonly cva: RdxControlValueAccessor<any>;
31
36
  /**
32
37
  * The pressed state of the toggle when it is initially rendered.
33
38
  * Use when you do not need to control its pressed state.
@@ -48,30 +53,13 @@ export declare class RdxToggleDirective implements ControlValueAccessor {
48
53
  * @group Props
49
54
  */
50
55
  readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
51
- /** @ignore */
52
- readonly disabledModel: import("@angular/core").ModelSignal<boolean>;
53
- /** @ignore */
54
- readonly disabledState: import("@angular/core").Signal<boolean>;
55
- protected readonly dataState: import("@angular/core").Signal<DataState>;
56
56
  /**
57
57
  * Event handler called when the pressed state of the toggle changes.
58
58
  *
59
59
  * @group Emits
60
60
  */
61
- readonly onPressedChange: OutputEmitterRef<boolean>;
62
- protected togglePressed(): void;
63
- private readonly accessorDisabled;
64
- private onChange;
65
- /** @ignore */
66
- onTouched: (() => void) | undefined;
67
- /** @ignore */
68
- writeValue(value: any): void;
69
- /** @ignore */
70
- registerOnChange(fn: (value: any) => void): void;
71
- /** @ignore */
72
- registerOnTouched(fn: () => void): void;
73
- /** @ignore */
74
- setDisabledState(isDisabled: boolean): void;
61
+ readonly onPressedChange: import("@angular/core").OutputRef<any>;
62
+ protected onClick(): void;
75
63
  static ɵfac: i0.ɵɵFactoryDeclaration<RdxToggleDirective, never>;
76
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxToggleDirective, "[rdxToggle]", ["rdxToggle"], { "defaultPressed": { "alias": "defaultPressed"; "required": false; "isSignal": true; }; "pressed": { "alias": "pressed"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "disabledModel": { "alias": "disabledModel"; "required": false; "isSignal": true; }; }, { "pressed": "pressedChange"; "disabledModel": "disabledModelChange"; "onPressedChange": "onPressedChange"; }, never, never, true, never>;
64
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxToggleDirective, "[rdxToggle]", ["rdxToggle"], { "defaultPressed": { "alias": "defaultPressed"; "required": false; "isSignal": true; }; "pressed": { "alias": "pressed"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "pressed": "pressedChange"; "onPressedChange": "onPressedChange"; }, never, never, true, [{ directive: typeof i1.RdxControlValueAccessor; inputs: { "value": "pressed"; "disabled": "disabled"; }; outputs: {}; }]>;
77
65
  }
@@ -62,7 +62,7 @@ export declare class RdxToggleGroupDirective implements ControlValueAccessor {
62
62
  * @ignore
63
63
  */
64
64
  registerOnTouched(fn: () => void): void;
65
- private readonly accessorDisabled;
65
+ readonly accessorDisabled: import("@angular/core").WritableSignal<boolean>;
66
66
  /**
67
67
  * Set the disabled state of the toggle group.
68
68
  * @param isDisabled Whether the toggle group is disabled.
@@ -4,6 +4,7 @@ export interface IRdxToggleGroup {
4
4
  disabled: any;
5
5
  value: any;
6
6
  type: any;
7
+ accessorDisabled: any;
7
8
  }
8
9
  export declare const RdxToggleGroupToken: InjectionToken<IRdxToggleGroup>;
9
10
  export declare function injectToggleGroup(): IRdxToggleGroup;
@@ -79,7 +79,7 @@ export declare class RdxTooltipRootDirective {
79
79
  window: Window & typeof globalThis;
80
80
  primitiveConfigs?: import("./utils/types").PrimitiveConfigs;
81
81
  onDestroyCallbacks: Set<() => void>;
82
- "__#22439@#clickDomRootEventCallbacks": Set<(event: MouseEvent) => void>;
82
+ "__#22420@#clickDomRootEventCallbacks": Set<(event: MouseEvent) => void>;
83
83
  registerPrimitive<T extends object>(primitiveInstance: T): void;
84
84
  deregisterPrimitive<T extends object>(primitiveInstance: T): void;
85
85
  preventPrimitiveFromCdkEvent<T extends object>(primitiveInstance: T, eventType: import("./utils/types").EventType): void;
@@ -90,9 +90,9 @@ export declare class RdxTooltipRootDirective {
90
90
  primitivePreventedFromCdkEvent<T extends object>(primitiveInstance: T, eventType: import("./utils/types").EventType): boolean | undefined;
91
91
  addClickDomRootEventCallback(callback: (event: MouseEvent) => void): void;
92
92
  removeClickDomRootEventCallback(callback: (event: MouseEvent) => void): boolean;
93
- "__#22439@#setPreventPrimitiveFromCdkEvent"<T extends object, R extends import("./utils/types").EventType, K extends import("./utils/types").PrimitiveConfig[`prevent${Capitalize<R>}`]>(primitiveInstance: T, eventType: R, value: K): void;
94
- "__#22439@#registerOnDestroyCallbacks"(): void;
95
- "__#22439@#listenToClickDomRootEvent"(): void;
93
+ "__#22420@#setPreventPrimitiveFromCdkEvent"<T extends object, R extends import("./utils/types").EventType, K extends import("./utils/types").PrimitiveConfig[`prevent${Capitalize<R>}`]>(primitiveInstance: T, eventType: R, value: K): void;
94
+ "__#22420@#registerOnDestroyCallbacks"(): void;
95
+ "__#22420@#listenToClickDomRootEvent"(): void;
96
96
  } | null;
97
97
  /** @ignore */
98
98
  readonly destroyRef: DestroyRef;