@radix-ng/primitives 0.20.1 → 0.21.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.
Files changed (65) hide show
  1. package/avatar/src/avatar-fallback.directive.d.ts +1 -1
  2. package/avatar/src/avatar-image.directive.d.ts +3 -3
  3. package/compodoc/documentation.json +6022 -1655
  4. package/core/index.d.ts +1 -0
  5. package/core/src/id-generator.d.ts +12 -0
  6. package/esm2022/avatar/src/avatar-fallback.directive.mjs +6 -8
  7. package/esm2022/avatar/src/avatar-image.directive.mjs +4 -3
  8. package/esm2022/core/index.mjs +2 -1
  9. package/esm2022/core/src/create-inject-context/index.mjs +2 -2
  10. package/esm2022/core/src/id-generator.mjs +43 -0
  11. package/esm2022/popover/index.mjs +14 -4
  12. package/esm2022/popover/src/popover-anchor.directive.mjs +70 -0
  13. package/esm2022/popover/src/popover-anchor.token.mjs +3 -0
  14. package/esm2022/popover/src/popover-arrow.directive.mjs +12 -7
  15. package/esm2022/popover/src/popover-close.directive.mjs +17 -5
  16. package/esm2022/popover/src/popover-close.token.mjs +3 -0
  17. package/esm2022/popover/src/popover-content-attributes.component.mjs +70 -0
  18. package/esm2022/popover/src/popover-content-attributes.token.mjs +3 -0
  19. package/esm2022/popover/src/popover-content.directive.mjs +120 -92
  20. package/esm2022/popover/src/popover-root.directive.mjs +234 -61
  21. package/esm2022/popover/src/popover-root.inject.mjs +4 -4
  22. package/esm2022/popover/src/popover-trigger.directive.mjs +10 -11
  23. package/esm2022/popover/src/popover.constants.mjs +2 -2
  24. package/esm2022/popover/src/popover.types.mjs +18 -1
  25. package/esm2022/popover/src/popover.utils.mjs +4 -6
  26. package/esm2022/switch/src/switch-input.directive.mjs +16 -7
  27. package/esm2022/switch/src/switch-root.directive.mjs +59 -14
  28. package/esm2022/switch/src/switch-thumb.directive.mjs +3 -3
  29. package/esm2022/toggle/index.mjs +2 -2
  30. package/esm2022/toggle/src/toggle-visually-hidden-input.directive.mjs +31 -0
  31. package/esm2022/toggle/src/toggle.directive.mjs +37 -8
  32. package/fesm2022/radix-ng-primitives-avatar.mjs +8 -9
  33. package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
  34. package/fesm2022/radix-ng-primitives-core.mjs +44 -3
  35. package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
  36. package/fesm2022/radix-ng-primitives-popover.mjs +679 -312
  37. package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
  38. package/fesm2022/radix-ng-primitives-switch.mjs +76 -22
  39. package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
  40. package/fesm2022/radix-ng-primitives-toggle.mjs +45 -15
  41. package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
  42. package/package.json +1 -1
  43. package/popover/index.d.ts +5 -1
  44. package/popover/src/popover-anchor.directive.d.ts +28 -0
  45. package/popover/src/popover-anchor.token.d.ts +3 -0
  46. package/popover/src/popover-arrow.directive.d.ts +8 -5
  47. package/popover/src/popover-close.directive.d.ts +2 -2
  48. package/popover/src/popover-close.token.d.ts +3 -0
  49. package/popover/src/popover-content-attributes.component.d.ts +17 -0
  50. package/popover/src/popover-content-attributes.token.d.ts +3 -0
  51. package/popover/src/popover-content.directive.d.ts +35 -24
  52. package/popover/src/popover-root.directive.d.ts +91 -18
  53. package/popover/src/popover-root.inject.d.ts +2 -1
  54. package/popover/src/popover-trigger.directive.d.ts +5 -5
  55. package/popover/src/popover.constants.d.ts +1 -1
  56. package/popover/src/popover.types.d.ts +14 -3
  57. package/switch/src/switch-input.directive.d.ts +2 -0
  58. package/switch/src/switch-root.directive.d.ts +33 -5
  59. package/toggle/index.d.ts +2 -2
  60. package/toggle/src/toggle-visually-hidden-input.directive.d.ts +6 -0
  61. package/toggle/src/toggle.directive.d.ts +19 -2
  62. package/esm2022/popover/src/popover-root.token.mjs +0 -3
  63. package/esm2022/toggle/src/toggle-input.directive.mjs +0 -30
  64. package/popover/src/popover-root.token.d.ts +0 -3
  65. package/toggle/src/toggle-input.directive.d.ts +0 -6
@@ -1,21 +1,52 @@
1
- import { OnInit, ViewContainerRef } from '@angular/core';
1
+ import { BooleanInput } from '@angular/cdk/coercion';
2
+ import { DestroyRef, ViewContainerRef } from '@angular/core';
3
+ import { RdxPopoverAnchorDirective } from './popover-anchor.directive';
2
4
  import { RdxPopoverContentDirective } from './popover-content.directive';
3
5
  import { RdxPopoverTriggerDirective } from './popover-trigger.directive';
4
- import { RdxPopoverState } from './popover.types';
6
+ import { RdxPopoverAnimationStatus, RdxPopoverAttachDetachEvent, RdxPopoverState } from './popover.types';
5
7
  import * as i0 from "@angular/core";
6
- export declare class RdxPopoverRootDirective implements OnInit {
8
+ export declare class RdxPopoverRootDirective {
9
+ /** @ignore */
10
+ readonly uniqueId: import("@angular/core").WritableSignal<number>;
11
+ /** @ignore */
12
+ readonly name: import("@angular/core").Signal<string>;
13
+ /**
14
+ * @description The anchor directive that comes form outside the popover root
15
+ * @default undefined
16
+ */
17
+ readonly anchor: import("@angular/core").InputSignal<RdxPopoverAnchorDirective | undefined>;
7
18
  /**
8
- * The open state of the popover when it is initially rendered. Use when you do not need to control its open state.
19
+ * @description The open state of the popover when it is initially rendered. Use when you do not need to control its open state.
20
+ * @default false
9
21
  */
10
22
  readonly defaultOpen: import("@angular/core").InputSignal<boolean>;
11
23
  /**
12
- * The controlled open state of the popover. Must be used in conjunction with onOpenChange.
24
+ * @description The controlled state of the popover. `open` input take precedence of `defaultOpen` input.
25
+ * @default undefined
13
26
  */
14
27
  readonly open: import("@angular/core").InputSignal<boolean | undefined>;
15
28
  /**
16
- * Event handler called when the open state of the popover changes.
29
+ * @description Whether to control the state of the popover from external. Use in conjunction with `open` input.
30
+ * @default undefined
31
+ */
32
+ readonly externalControl: import("@angular/core").InputSignal<boolean | undefined>;
33
+ /**
34
+ * @description Whether to take into account CSS opening/closing animations.
35
+ * @default false
36
+ */
37
+ readonly cssAnimation: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
38
+ /**
39
+ * @description Whether to take into account CSS opening animations. `cssAnimation` input must be set to 'true'
40
+ * @default false
41
+ */
42
+ readonly cssOpeningAnimation: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
43
+ /**
44
+ * @description Whether to take into account CSS closing animations. `cssAnimation` input must be set to 'true'
45
+ * @default false
17
46
  */
18
- readonly onOpenChange: import("@angular/core").OutputEmitterRef<boolean>;
47
+ readonly cssClosingAnimation: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
48
+ /** @ignore */
49
+ readonly cssAnimationStatus: import("@angular/core").WritableSignal<RdxPopoverAnimationStatus | null>;
19
50
  /** @ignore */
20
51
  readonly popoverContentDirective: import("@angular/core").Signal<RdxPopoverContentDirective>;
21
52
  /** @ignore */
@@ -23,20 +54,38 @@ export declare class RdxPopoverRootDirective implements OnInit {
23
54
  /** @ignore */
24
55
  readonly popoverArrowDirective: import("@angular/core").Signal<import("@radix-ng/primitives/popover").RdxPopoverArrowDirective | undefined>;
25
56
  /** @ignore */
57
+ readonly popoverCloseDirective: import("@angular/core").Signal<import("@radix-ng/primitives/popover").RdxPopoverCloseDirective | undefined>;
58
+ /** @ignore */
59
+ readonly popoverContentAttributesComponent: import("@angular/core").Signal<import("@radix-ng/primitives/popover").RdxPopoverContentAttributesComponent | undefined>;
60
+ /** @ignore */
61
+ private readonly internalPopoverAnchorDirective;
62
+ /** @ignore */
26
63
  readonly viewContainerRef: ViewContainerRef;
27
64
  /** @ignore */
28
- private readonly document;
65
+ readonly destroyRef: DestroyRef;
29
66
  /** @ignore */
30
- readonly isOpen: import("@angular/core").WritableSignal<boolean>;
67
+ readonly state: import("@angular/core").WritableSignal<RdxPopoverState>;
31
68
  /** @ignore */
32
- readonly state: import("@angular/core").Signal<RdxPopoverState>;
69
+ readonly attachDetachEvent: import("@angular/core").WritableSignal<RdxPopoverAttachDetachEvent>;
33
70
  /** @ignore */
34
- private isControlledExternally;
71
+ private isFirstDefaultOpen;
72
+ /** @ignore */
73
+ readonly popoverAnchorDirective: import("@angular/core").Signal<RdxPopoverAnchorDirective | undefined>;
35
74
  constructor();
36
75
  /** @ignore */
37
- ngOnInit(): void;
76
+ getAnimationParamsSnapshot(): {
77
+ cssAnimation: boolean;
78
+ cssOpeningAnimation: boolean;
79
+ cssClosingAnimation: boolean;
80
+ cssAnimationStatus: RdxPopoverAnimationStatus | null;
81
+ attachDetachEvent: RdxPopoverAttachDetachEvent;
82
+ state: RdxPopoverState;
83
+ canEmitOnOpenOrOnClosed: boolean;
84
+ };
85
+ /** @ignore */
86
+ controlledExternally(): import("@angular/core").InputSignal<boolean | undefined>;
38
87
  /** @ignore */
39
- controlledExternally(): import("@angular/core").Signal<boolean>;
88
+ firstDefaultOpen(): boolean;
40
89
  /** @ignore */
41
90
  handleOpen(): void;
42
91
  /** @ignore */
@@ -44,15 +93,39 @@ export declare class RdxPopoverRootDirective implements OnInit {
44
93
  /** @ignore */
45
94
  handleToggle(): void;
46
95
  /** @ignore */
47
- private setOpen;
96
+ isOpen(state?: RdxPopoverState): boolean;
97
+ /** @ignore */
98
+ private setState;
99
+ /** @ignore */
100
+ private openContent;
101
+ /** @ignore */
102
+ private closeContent;
103
+ /** @ignore */
104
+ private emitOnOpen;
105
+ /** @ignore */
106
+ private emitOnClosed;
48
107
  /** @ignore */
49
- private show;
108
+ private ifOpenOrCloseWithoutAnimations;
50
109
  /** @ignore */
51
- private hide;
110
+ private ifOpenOrCloseWithAnimations;
52
111
  /** @ignore */
53
- private onIsOpenChangeEffect;
112
+ private openOrClose;
113
+ /** @ignore */
114
+ private emitOnOpenOrOnClosed;
115
+ /** @ignore */
116
+ private canEmitOnOpenOrOnClosed;
117
+ /** @ignore */
118
+ private onStateChangeEffect;
119
+ /** @ignore */
120
+ private onCssAnimationStatusChangeChangeEffect;
121
+ /** @ignore */
122
+ private emitOpenOrClosedEventEffect;
54
123
  /** @ignore */
55
124
  private onOpenChangeEffect;
125
+ /** @ignore */
126
+ private onIsFirstDefaultOpenChangeEffect;
127
+ /** @ignore */
128
+ private onAnchorChangeEffect;
56
129
  static ɵfac: i0.ɵɵFactoryDeclaration<RdxPopoverRootDirective, never>;
57
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxPopoverRootDirective, "[rdxPopoverRoot]", ["rdxPopoverRoot"], { "defaultOpen": { "alias": "defaultOpen"; "required": false; "isSignal": true; }; "open": { "alias": "open"; "required": false; "isSignal": true; }; }, { "onOpenChange": "onOpenChange"; }, ["popoverContentDirective", "popoverTriggerDirective", "popoverArrowDirective"], never, true, never>;
130
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxPopoverRootDirective, "[rdxPopoverRoot]", ["rdxPopoverRoot"], { "anchor": { "alias": "anchor"; "required": false; "isSignal": true; }; "defaultOpen": { "alias": "defaultOpen"; "required": false; "isSignal": true; }; "open": { "alias": "open"; "required": false; "isSignal": true; }; "externalControl": { "alias": "externalControl"; "required": false; "isSignal": true; }; "cssAnimation": { "alias": "cssAnimation"; "required": false; "isSignal": true; }; "cssOpeningAnimation": { "alias": "cssOpeningAnimation"; "required": false; "isSignal": true; }; "cssClosingAnimation": { "alias": "cssClosingAnimation"; "required": false; "isSignal": true; }; }, {}, ["popoverContentDirective", "popoverTriggerDirective", "popoverArrowDirective", "popoverCloseDirective", "popoverContentAttributesComponent", "internalPopoverAnchorDirective"], never, true, never>;
58
131
  }
@@ -1,2 +1,3 @@
1
1
  import { RdxPopoverRootDirective } from './popover-root.directive';
2
- export declare function injectPopoverRoot(): RdxPopoverRootDirective;
2
+ export declare function injectPopoverRoot(optional?: false): RdxPopoverRootDirective;
3
+ export declare function injectPopoverRoot(optional: true): RdxPopoverRootDirective | null;
@@ -3,16 +3,16 @@ import { ElementRef } from '@angular/core';
3
3
  import * as i0 from "@angular/core";
4
4
  import * as i1 from "@angular/cdk/overlay";
5
5
  export declare class RdxPopoverTriggerDirective {
6
- readonly id: import("@angular/core").InputSignal<string>;
7
- readonly popoverId: import("@angular/core").Signal<string>;
8
6
  /** @ignore */
9
- readonly popoverRoot: import("@radix-ng/primitives/popover").RdxPopoverRootDirective;
7
+ protected readonly popoverRoot: import("@radix-ng/primitives/popover").RdxPopoverRootDirective;
10
8
  /** @ignore */
11
9
  readonly elementRef: ElementRef<HTMLElement>;
12
10
  /** @ignore */
13
11
  readonly overlayOrigin: CdkOverlayOrigin;
14
12
  /** @ignore */
15
- onClick(): void;
13
+ readonly name: import("@angular/core").Signal<string>;
14
+ /** @ignore */
15
+ click(): void;
16
16
  static ɵfac: i0.ɵɵFactoryDeclaration<RdxPopoverTriggerDirective, never>;
17
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxPopoverTriggerDirective, "[rdxPopoverTrigger]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.CdkOverlayOrigin; inputs: {}; outputs: {}; }]>;
17
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxPopoverTriggerDirective, "[rdxPopoverTrigger]", never, {}, {}, never, never, true, [{ directive: typeof i1.CdkOverlayOrigin; inputs: {}; outputs: {}; }]>;
18
18
  }
@@ -3,6 +3,6 @@ export declare const POPOVER_POSITIONS: RdxPopoverPositions;
3
3
  export declare const DEFAULTS: {
4
4
  readonly offsets: {
5
5
  readonly side: 10;
6
- readonly align: 10;
6
+ readonly align: 0;
7
7
  };
8
8
  };
@@ -10,7 +10,20 @@ export declare enum RdxPopoverAlign {
10
10
  Center = "center",
11
11
  End = "end"
12
12
  }
13
- export type RdxPopoverState = 'open' | 'closed';
13
+ export declare enum RdxPopoverState {
14
+ OPEN = "open",
15
+ CLOSED = "closed"
16
+ }
17
+ export declare enum RdxPopoverAttachDetachEvent {
18
+ ATTACH = "attach",
19
+ DETACH = "detach"
20
+ }
21
+ export declare enum RdxPopoverAnimationStatus {
22
+ OPEN_STARTED = "open_started",
23
+ OPEN_ENDED = "open_ended",
24
+ CLOSED_STARTED = "closed_started",
25
+ CLOSED_ENDED = "closed_ended"
26
+ }
14
27
  export type RdxSideAndAlign = {
15
28
  side: RdxPopoverSide;
16
29
  align: RdxPopoverAlign;
@@ -27,8 +40,6 @@ export type RdxPopoverPositions = {
27
40
  export type RdxAllPossibleConnectedPositions = ReadonlyMap<`${RdxPopoverSide}|${RdxPopoverAlign}`, ConnectionPositionPair>;
28
41
  export type RdxArrowPositionParams = {
29
42
  top: string;
30
- bottom: string;
31
43
  left: string;
32
- right: string;
33
44
  transform: string;
34
45
  };
@@ -1,6 +1,8 @@
1
1
  import * as i0 from "@angular/core";
2
2
  export declare class RdxSwitchInputDirective {
3
3
  protected readonly switchRoot: import("./switch-root.directive").RdxSwitchRootDirective;
4
+ /** @ignore */
5
+ protected onBlur(): void;
4
6
  static ɵfac: i0.ɵɵFactoryDeclaration<RdxSwitchInputDirective, never>;
5
7
  static ɵdir: i0.ɵɵDirectiveDeclaration<RdxSwitchInputDirective, "input[rdxSwitchInput]", ["rdxSwitchInput"], {}, {}, never, never, true, never>;
6
8
  }
@@ -1,39 +1,67 @@
1
1
  import { BooleanInput } from '@angular/cdk/coercion';
2
2
  import { InjectionToken, InputSignalWithTransform, ModelSignal, OutputEmitterRef } from '@angular/core';
3
+ import { ControlValueAccessor } from '@angular/forms';
3
4
  import * as i0 from "@angular/core";
4
5
  export declare const RdxSwitchToken: InjectionToken<RdxSwitchRootDirective>;
5
6
  export declare function injectSwitch(): RdxSwitchRootDirective;
7
+ export declare const SWITCH_VALUE_ACCESSOR: any;
6
8
  export interface SwitchProps {
7
9
  checked?: ModelSignal<boolean>;
8
- defaultChecked?: boolean;
10
+ defaultChecked?: InputSignalWithTransform<boolean, BooleanInput>;
9
11
  required?: InputSignalWithTransform<boolean, BooleanInput>;
10
12
  onCheckedChange?: OutputEmitterRef<boolean>;
11
13
  }
12
- export declare class RdxSwitchRootDirective implements SwitchProps {
13
- readonly id: import("@angular/core").InputSignal<string>;
14
+ export declare class RdxSwitchRootDirective implements SwitchProps, ControlValueAccessor {
15
+ readonly id: import("@angular/core").InputSignal<string | null>;
14
16
  protected readonly elementId: import("@angular/core").Signal<string | null>;
17
+ readonly inputId: import("@angular/core").InputSignal<string | null>;
15
18
  /**
16
19
  * When true, indicates that the user must check the switch before the owning form can be submitted.
17
20
  */
18
21
  readonly required: InputSignalWithTransform<boolean, BooleanInput>;
22
+ readonly ariaLabelledBy: import("@angular/core").InputSignal<string | null>;
23
+ readonly ariaLabel: import("@angular/core").InputSignal<string | null>;
19
24
  /**
20
25
  * The controlled state of the switch. Must be used in conjunction with onCheckedChange.
21
26
  */
22
27
  readonly checked: ModelSignal<boolean>;
28
+ readonly defaultChecked: InputSignalWithTransform<boolean, BooleanInput>;
29
+ /**
30
+ * The state of the switch.
31
+ * If `defaultChecked` is provided, it takes precedence over the `checked` state.
32
+ * @ignore
33
+ */
34
+ readonly checkedState: import("@angular/core").Signal<boolean>;
23
35
  /**
24
36
  * When true, prevents the user from interacting with the switch.
25
37
  */
26
38
  readonly disabled: InputSignalWithTransform<boolean, BooleanInput>;
39
+ /** @ignore */
27
40
  readonly disabledState: import("@angular/core").Signal<boolean>;
28
41
  /**
29
42
  * Event handler called when the state of the switch changes.
30
43
  */
31
44
  readonly onCheckedChange: OutputEmitterRef<boolean>;
45
+ private readonly defaultCheckedUsed;
46
+ constructor();
32
47
  /**
33
48
  * Toggles the checked state of the switch.
34
49
  * If the switch is disabled, the function returns early.
50
+ * @ignore
35
51
  */
36
- protected toggle(): void;
52
+ toggle(): void;
53
+ private readonly accessorDisabled;
54
+ private onChange;
55
+ /** @ignore */
56
+ onTouched: (() => void) | undefined;
57
+ /** @ignore */
58
+ writeValue(value: any): void;
59
+ /** @ignore */
60
+ registerOnChange(fn: (value: any) => void): void;
61
+ /** @ignore */
62
+ registerOnTouched(fn: () => void): void;
63
+ /** @ignore */
64
+ setDisabledState(isDisabled: boolean): void;
37
65
  static ɵfac: i0.ɵɵFactoryDeclaration<RdxSwitchRootDirective, never>;
38
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxSwitchRootDirective, "button[rdxSwitchRoot]", ["rdxSwitchRoot"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "checked": "checkedChange"; "onCheckedChange": "onCheckedChange"; }, never, never, true, never>;
66
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxSwitchRootDirective, "button[rdxSwitchRoot]", ["rdxSwitchRoot"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "defaultChecked": { "alias": "defaultChecked"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "checked": "checkedChange"; "onCheckedChange": "onCheckedChange"; }, never, never, true, never>;
39
67
  }
package/toggle/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './src/toggle-input.directive';
1
+ export * from './src/toggle-visually-hidden-input.directive';
2
2
  export * from './src/toggle.directive';
3
- export type { ToggleProps } from './src/toggle.directive';
3
+ export type { DataState, ToggleProps } from './src/toggle.directive';
@@ -0,0 +1,6 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "@radix-ng/primitives/visually-hidden";
3
+ export declare class RdxToggleVisuallyHiddenInputDirective {
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<RdxToggleVisuallyHiddenInputDirective, never>;
5
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxToggleVisuallyHiddenInputDirective, "input[rdxToggleVisuallyHiddenInput]", ["rdxToggleVisuallyHiddenInput"], {}, {}, never, never, true, [{ directive: typeof i1.RdxVisuallyHiddenInputDirective; inputs: { "name": "name"; "required": "required"; "value": "value"; "disabled": "disabled"; }; outputs: {}; }]>;
6
+ }
@@ -1,5 +1,6 @@
1
1
  import { BooleanInput } from '@angular/cdk/coercion';
2
2
  import { OutputEmitterRef } from '@angular/core';
3
+ import { ControlValueAccessor } from '@angular/forms';
3
4
  import * as i0 from "@angular/core";
4
5
  export interface ToggleProps {
5
6
  /**
@@ -22,7 +23,9 @@ export interface ToggleProps {
22
23
  */
23
24
  disabled?: boolean;
24
25
  }
25
- export declare class RdxToggleDirective {
26
+ export type DataState = 'on' | 'off';
27
+ export declare const TOGGLE_VALUE_ACCESSOR: any;
28
+ export declare class RdxToggleDirective implements ControlValueAccessor {
26
29
  /**
27
30
  * The pressed state of the toggle when it is initially rendered.
28
31
  * Use when you do not need to control its pressed state.
@@ -37,11 +40,25 @@ export declare class RdxToggleDirective {
37
40
  * When true, prevents the user from interacting with the toggle.
38
41
  */
39
42
  readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
43
+ /** @ignore */
44
+ readonly disabledState: import("@angular/core").Signal<boolean>;
45
+ protected readonly dataState: import("@angular/core").Signal<DataState>;
40
46
  /**
41
47
  * Event handler called when the pressed state of the toggle changes.
42
48
  */
43
49
  readonly onPressedChange: OutputEmitterRef<boolean>;
44
- protected toggle(): void;
50
+ protected togglePressed(): void;
51
+ private readonly accessorDisabled;
52
+ private onChange;
53
+ private onTouched;
54
+ /** @ignore */
55
+ writeValue(value: any): void;
56
+ /** @ignore */
57
+ registerOnChange(fn: (value: any) => void): void;
58
+ /** @ignore */
59
+ registerOnTouched(fn: () => void): void;
60
+ /** @ignore */
61
+ setDisabledState(isDisabled: boolean): void;
45
62
  static ɵfac: i0.ɵɵFactoryDeclaration<RdxToggleDirective, never>;
46
63
  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, never>;
47
64
  }
@@ -1,3 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- export const RdxPopoverRootToken = new InjectionToken('RdxPopoverRootToken');
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9wb3Zlci1yb290LnRva2VuLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvcHJpbWl0aXZlcy9wb3BvdmVyL3NyYy9wb3BvdmVyLXJvb3QudG9rZW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUcvQyxNQUFNLENBQUMsTUFBTSxtQkFBbUIsR0FBRyxJQUFJLGNBQWMsQ0FBMEIscUJBQXFCLENBQUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEluamVjdGlvblRva2VuIH0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5pbXBvcnQgeyBSZHhQb3BvdmVyUm9vdERpcmVjdGl2ZSB9IGZyb20gJy4vcG9wb3Zlci1yb290LmRpcmVjdGl2ZSc7XG5cbmV4cG9ydCBjb25zdCBSZHhQb3BvdmVyUm9vdFRva2VuID0gbmV3IEluamVjdGlvblRva2VuPFJkeFBvcG92ZXJSb290RGlyZWN0aXZlPignUmR4UG9wb3ZlclJvb3RUb2tlbicpO1xuIl19
@@ -1,30 +0,0 @@
1
- import { Directive } from '@angular/core';
2
- import { RdxVisuallyHiddenInputDirective } from '@radix-ng/primitives/visually-hidden';
3
- import * as i0 from "@angular/core";
4
- import * as i1 from "@radix-ng/primitives/visually-hidden";
5
- export class RdxToggleInputDirective {
6
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: RdxToggleInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
7
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.11", type: RdxToggleInputDirective, isStandalone: true, selector: "[rdxToggleInput]", host: { attributes: { "type": "checkbox" } }, exportAs: ["rdxToggleInput"], hostDirectives: [{ directive: i1.RdxVisuallyHiddenInputDirective, inputs: ["name", "name", "required", "required", "value", "value"] }], ngImport: i0 }); }
8
- }
9
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: RdxToggleInputDirective, decorators: [{
10
- type: Directive,
11
- args: [{
12
- selector: '[rdxToggleInput]',
13
- exportAs: 'rdxToggleInput',
14
- standalone: true,
15
- hostDirectives: [
16
- {
17
- directive: RdxVisuallyHiddenInputDirective,
18
- inputs: [
19
- 'name',
20
- 'required',
21
- 'value'
22
- ]
23
- }
24
- ],
25
- host: {
26
- type: 'checkbox'
27
- }
28
- }]
29
- }] });
30
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9nZ2xlLWlucHV0LmRpcmVjdGl2ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3ByaW1pdGl2ZXMvdG9nZ2xlL3NyYy90b2dnbGUtaW5wdXQuZGlyZWN0aXZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDMUMsT0FBTyxFQUFFLCtCQUErQixFQUFFLE1BQU0sc0NBQXNDLENBQUM7OztBQW9CdkYsTUFBTSxPQUFPLHVCQUF1QjsrR0FBdkIsdUJBQXVCO21HQUF2Qix1QkFBdUI7OzRGQUF2Qix1QkFBdUI7a0JBbEJuQyxTQUFTO21CQUFDO29CQUNQLFFBQVEsRUFBRSxrQkFBa0I7b0JBQzVCLFFBQVEsRUFBRSxnQkFBZ0I7b0JBQzFCLFVBQVUsRUFBRSxJQUFJO29CQUNoQixjQUFjLEVBQUU7d0JBQ1o7NEJBQ0ksU0FBUyxFQUFFLCtCQUErQjs0QkFDMUMsTUFBTSxFQUFFO2dDQUNKLE1BQU07Z0NBQ04sVUFBVTtnQ0FDVixPQUFPOzZCQUNWO3lCQUNKO3FCQUNKO29CQUNELElBQUksRUFBRTt3QkFDRixJQUFJLEVBQUUsVUFBVTtxQkFDbkI7aUJBQ0oiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBEaXJlY3RpdmUgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCB7IFJkeFZpc3VhbGx5SGlkZGVuSW5wdXREaXJlY3RpdmUgfSBmcm9tICdAcmFkaXgtbmcvcHJpbWl0aXZlcy92aXN1YWxseS1oaWRkZW4nO1xuXG5ARGlyZWN0aXZlKHtcbiAgICBzZWxlY3RvcjogJ1tyZHhUb2dnbGVJbnB1dF0nLFxuICAgIGV4cG9ydEFzOiAncmR4VG9nZ2xlSW5wdXQnLFxuICAgIHN0YW5kYWxvbmU6IHRydWUsXG4gICAgaG9zdERpcmVjdGl2ZXM6IFtcbiAgICAgICAge1xuICAgICAgICAgICAgZGlyZWN0aXZlOiBSZHhWaXN1YWxseUhpZGRlbklucHV0RGlyZWN0aXZlLFxuICAgICAgICAgICAgaW5wdXRzOiBbXG4gICAgICAgICAgICAgICAgJ25hbWUnLFxuICAgICAgICAgICAgICAgICdyZXF1aXJlZCcsXG4gICAgICAgICAgICAgICAgJ3ZhbHVlJ1xuICAgICAgICAgICAgXVxuICAgICAgICB9XG4gICAgXSxcbiAgICBob3N0OiB7XG4gICAgICAgIHR5cGU6ICdjaGVja2JveCdcbiAgICB9XG59KVxuZXhwb3J0IGNsYXNzIFJkeFRvZ2dsZUlucHV0RGlyZWN0aXZlIHt9XG4iXX0=
@@ -1,3 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import { RdxPopoverRootDirective } from './popover-root.directive';
3
- export declare const RdxPopoverRootToken: InjectionToken<RdxPopoverRootDirective>;
@@ -1,6 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- import * as i1 from "@radix-ng/primitives/visually-hidden";
3
- export declare class RdxToggleInputDirective {
4
- static ɵfac: i0.ɵɵFactoryDeclaration<RdxToggleInputDirective, never>;
5
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxToggleInputDirective, "[rdxToggleInput]", ["rdxToggleInput"], {}, {}, never, never, true, [{ directive: typeof i1.RdxVisuallyHiddenInputDirective; inputs: { "name": "name"; "required": "required"; "value": "value"; }; outputs: {}; }]>;
6
- }