@radix-ng/primitives 0.5.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.
Files changed (183) hide show
  1. package/alert-dialog/README.md +1 -0
  2. package/alert-dialog/index.d.ts +6 -0
  3. package/alert-dialog/src/alert-dialog-cancel.directive.d.ts +7 -0
  4. package/alert-dialog/src/alert-dialog-content.directive.d.ts +8 -0
  5. package/alert-dialog/src/alert-dialog-root.directive.d.ts +9 -0
  6. package/alert-dialog/src/alert-dialog-title.directive.d.ts +5 -0
  7. package/alert-dialog/src/alert-dialog-trigger.directive.d.ts +7 -0
  8. package/alert-dialog/src/alert-dialog.service.d.ts +14 -0
  9. package/avatar/index.d.ts +3 -1
  10. package/avatar/src/avatar-fallback.directive.d.ts +10 -17
  11. package/avatar/src/avatar-image.directive.d.ts +10 -11
  12. package/avatar/src/avatar-root.directive.d.ts +21 -0
  13. package/avatar/src/avatar.config.d.ts +3 -2
  14. package/checkbox/src/checkbox.directive.d.ts +5 -3
  15. package/collapsible/README.md +1 -0
  16. package/collapsible/index.d.ts +3 -0
  17. package/collapsible/src/collapsible-content.directive.d.ts +11 -0
  18. package/collapsible/src/collapsible-root.directive.d.ts +52 -0
  19. package/collapsible/src/collapsible-trigger.directive.d.ts +26 -0
  20. package/esm2022/alert-dialog/index.mjs +7 -0
  21. package/esm2022/alert-dialog/radix-ng-primitives-alert-dialog.mjs +5 -0
  22. package/esm2022/alert-dialog/src/alert-dialog-cancel.directive.mjs +24 -0
  23. package/esm2022/alert-dialog/src/alert-dialog-content.directive.mjs +26 -0
  24. package/esm2022/alert-dialog/src/alert-dialog-root.directive.mjs +24 -0
  25. package/esm2022/alert-dialog/src/alert-dialog-title.directive.mjs +14 -0
  26. package/esm2022/alert-dialog/src/alert-dialog-trigger.directive.mjs +24 -0
  27. package/esm2022/alert-dialog/src/alert-dialog.service.mjs +45 -0
  28. package/esm2022/avatar/index.mjs +2 -2
  29. package/esm2022/avatar/src/avatar-fallback.directive.mjs +23 -30
  30. package/esm2022/avatar/src/avatar-image.directive.mjs +29 -31
  31. package/esm2022/avatar/src/avatar-root.directive.mjs +38 -0
  32. package/esm2022/avatar/src/avatar.config.mjs +2 -2
  33. package/esm2022/checkbox/src/checkbox-indicator.directive.mjs +3 -3
  34. package/esm2022/checkbox/src/checkbox.directive.mjs +16 -6
  35. package/esm2022/collapsible/index.mjs +4 -0
  36. package/esm2022/collapsible/radix-ng-primitives-collapsible.mjs +5 -0
  37. package/esm2022/collapsible/src/collapsible-content.directive.mjs +26 -0
  38. package/esm2022/collapsible/src/collapsible-root.directive.mjs +114 -0
  39. package/esm2022/collapsible/src/collapsible-trigger.directive.mjs +49 -0
  40. package/esm2022/label/index.mjs +2 -2
  41. package/esm2022/label/src/label-root.directive.mjs +48 -0
  42. package/esm2022/progress/index.mjs +2 -2
  43. package/esm2022/progress/src/progress-indicator.directive.mjs +11 -10
  44. package/esm2022/progress/src/progress-root.directive.mjs +71 -0
  45. package/esm2022/radio/index.mjs +2 -4
  46. package/esm2022/radio/src/radio-indicator.directive.mjs +8 -13
  47. package/esm2022/radio/src/radio-item.directive.mjs +27 -42
  48. package/esm2022/radio/src/radio-root.directive.mjs +104 -0
  49. package/esm2022/roving-focus/index.mjs +1 -3
  50. package/esm2022/roving-focus/src/roving-focus-group.directive.mjs +9 -16
  51. package/esm2022/roving-focus/src/roving-focus-item.directive.mjs +21 -26
  52. package/esm2022/separator/src/separator.directive.mjs +12 -17
  53. package/esm2022/switch/index.mjs +3 -3
  54. package/esm2022/switch/src/switch-input.directive.mjs +30 -0
  55. package/esm2022/switch/src/switch-root.directive.mjs +71 -0
  56. package/esm2022/switch/src/switch-thumb.directive.mjs +10 -12
  57. package/esm2022/toggle/index.mjs +2 -2
  58. package/esm2022/toggle/src/toggle-root.directive.mjs +49 -0
  59. package/esm2022/toggle-group/src/toggle-group-button.directive.mjs +9 -14
  60. package/esm2022/toggle-group/src/toggle-group-multi.directive.mjs +4 -4
  61. package/esm2022/toggle-group/src/toggle-group.directive.mjs +9 -12
  62. package/fesm2022/radix-ng-primitives-alert-dialog.mjs +150 -0
  63. package/fesm2022/radix-ng-primitives-alert-dialog.mjs.map +1 -0
  64. package/fesm2022/radix-ng-primitives-avatar.mjs +79 -90
  65. package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
  66. package/fesm2022/radix-ng-primitives-checkbox.mjs +18 -8
  67. package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
  68. package/fesm2022/radix-ng-primitives-collapsible.mjs +190 -0
  69. package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -0
  70. package/fesm2022/radix-ng-primitives-label.mjs +20 -32
  71. package/fesm2022/radix-ng-primitives-label.mjs.map +1 -1
  72. package/fesm2022/radix-ng-primitives-progress.mjs +55 -49
  73. package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
  74. package/fesm2022/radix-ng-primitives-radio.mjs +69 -101
  75. package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
  76. package/fesm2022/radix-ng-primitives-roving-focus.mjs +19 -42
  77. package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -1
  78. package/fesm2022/radix-ng-primitives-separator.mjs +12 -17
  79. package/fesm2022/radix-ng-primitives-separator.mjs.map +1 -1
  80. package/fesm2022/radix-ng-primitives-switch.mjs +77 -110
  81. package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
  82. package/fesm2022/radix-ng-primitives-toggle-group.mjs +19 -27
  83. package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
  84. package/fesm2022/radix-ng-primitives-toggle.mjs +16 -32
  85. package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
  86. package/label/index.d.ts +1 -1
  87. package/label/src/label-root.directive.d.ts +13 -0
  88. package/package.json +14 -21
  89. package/progress/index.d.ts +2 -1
  90. package/progress/src/progress-indicator.directive.d.ts +2 -2
  91. package/progress/src/progress-root.directive.d.ts +29 -0
  92. package/radio/index.d.ts +1 -3
  93. package/radio/src/radio-indicator.directive.d.ts +3 -9
  94. package/radio/src/radio-item.directive.d.ts +9 -28
  95. package/radio/src/{radio-group.directive.d.ts → radio-root.directive.d.ts} +24 -17
  96. package/roving-focus/index.d.ts +0 -2
  97. package/roving-focus/src/roving-focus-group.directive.d.ts +4 -6
  98. package/roving-focus/src/roving-focus-item.directive.d.ts +6 -8
  99. package/separator/src/separator.directive.d.ts +14 -8
  100. package/switch/index.d.ts +3 -2
  101. package/switch/src/switch-input.directive.d.ts +6 -0
  102. package/switch/src/switch-root.directive.d.ts +34 -0
  103. package/switch/src/switch-thumb.directive.d.ts +2 -5
  104. package/toggle/index.d.ts +2 -1
  105. package/toggle/src/toggle-root.directive.d.ts +32 -0
  106. package/toggle-group/src/toggle-group-button.directive.d.ts +1 -4
  107. package/toggle-group/src/toggle-group-multi.directive.d.ts +1 -1
  108. package/toggle-group/src/toggle-group.directive.d.ts +2 -2
  109. package/accordion/README.md +0 -3
  110. package/accordion/index.d.ts +0 -7
  111. package/accordion/src/accordion/accordion.directive.d.ts +0 -64
  112. package/accordion/src/accordion/accordion.token.d.ts +0 -4
  113. package/accordion/src/accordion-content/accordion-content.directive.d.ts +0 -44
  114. package/accordion/src/accordion-header/accordion-header.directive.d.ts +0 -6
  115. package/accordion/src/accordion-item/accordion-item.directive.d.ts +0 -42
  116. package/accordion/src/accordion-item/accordion-item.token.d.ts +0 -4
  117. package/accordion/src/accordion-state.directive.d.ts +0 -28
  118. package/accordion/src/accordion-trigger/accordion-trigger.directive.d.ts +0 -23
  119. package/accordion/src/accordion.config.d.ts +0 -25
  120. package/avatar/src/avatar.directive.d.ts +0 -22
  121. package/avatar/src/avatar.token.d.ts +0 -4
  122. package/esm2022/accordion/index.mjs +0 -8
  123. package/esm2022/accordion/radix-ng-primitives-accordion.mjs +0 -5
  124. package/esm2022/accordion/src/accordion/accordion.directive.mjs +0 -108
  125. package/esm2022/accordion/src/accordion/accordion.token.mjs +0 -6
  126. package/esm2022/accordion/src/accordion-content/accordion-content.directive.mjs +0 -75
  127. package/esm2022/accordion/src/accordion-header/accordion-header.directive.mjs +0 -17
  128. package/esm2022/accordion/src/accordion-item/accordion-item.directive.mjs +0 -81
  129. package/esm2022/accordion/src/accordion-item/accordion-item.token.mjs +0 -6
  130. package/esm2022/accordion/src/accordion-state.directive.mjs +0 -49
  131. package/esm2022/accordion/src/accordion-trigger/accordion-trigger.directive.mjs +0 -49
  132. package/esm2022/accordion/src/accordion.config.mjs +0 -27
  133. package/esm2022/avatar/src/avatar.directive.mjs +0 -38
  134. package/esm2022/avatar/src/avatar.token.mjs +0 -6
  135. package/esm2022/label/src/label.directive.mjs +0 -60
  136. package/esm2022/overlay/index.mjs +0 -5
  137. package/esm2022/overlay/radix-ng-primitives-overlay.mjs +0 -5
  138. package/esm2022/overlay/src/overlay-arrow.directive.mjs +0 -59
  139. package/esm2022/overlay/src/overlay-arrow.token.mjs +0 -3
  140. package/esm2022/overlay/src/overlay-trigger.directive.mjs +0 -279
  141. package/esm2022/overlay/src/overlay-trigger.token.mjs +0 -9
  142. package/esm2022/overlay/src/overlay.directive.mjs +0 -51
  143. package/esm2022/overlay/src/overlay.token.mjs +0 -3
  144. package/esm2022/progress/src/progress.directive.mjs +0 -62
  145. package/esm2022/progress/src/progress.token.mjs +0 -6
  146. package/esm2022/radio/src/radio-group.directive.mjs +0 -108
  147. package/esm2022/radio/src/radio-group.token.mjs +0 -6
  148. package/esm2022/radio/src/radio-item.token.mjs +0 -6
  149. package/esm2022/roving-focus/src/roving-focus-group.token.mjs +0 -9
  150. package/esm2022/roving-focus/src/roving-focus-item.token.mjs +0 -6
  151. package/esm2022/switch/src/switch.directive.mjs +0 -125
  152. package/esm2022/switch/src/switch.token.mjs +0 -6
  153. package/esm2022/toggle/src/toggle.directive.mjs +0 -65
  154. package/esm2022/visually-hidden/index.mjs +0 -2
  155. package/esm2022/visually-hidden/radix-ng-primitives-visually-hidden.mjs +0 -5
  156. package/esm2022/visually-hidden/src/visually-hidden.directive.mjs +0 -42
  157. package/fesm2022/radix-ng-primitives-accordion.mjs +0 -394
  158. package/fesm2022/radix-ng-primitives-accordion.mjs.map +0 -1
  159. package/fesm2022/radix-ng-primitives-overlay.mjs +0 -399
  160. package/fesm2022/radix-ng-primitives-overlay.mjs.map +0 -1
  161. package/fesm2022/radix-ng-primitives-visually-hidden.mjs +0 -49
  162. package/fesm2022/radix-ng-primitives-visually-hidden.mjs.map +0 -1
  163. package/label/src/label.directive.d.ts +0 -19
  164. package/overlay/README.md +0 -1
  165. package/overlay/index.d.ts +0 -4
  166. package/overlay/src/overlay-arrow.directive.d.ts +0 -29
  167. package/overlay/src/overlay-arrow.token.d.ts +0 -3
  168. package/overlay/src/overlay-trigger.directive.d.ts +0 -163
  169. package/overlay/src/overlay-trigger.token.d.ts +0 -7
  170. package/overlay/src/overlay.directive.d.ts +0 -29
  171. package/overlay/src/overlay.token.d.ts +0 -3
  172. package/progress/src/progress.directive.d.ts +0 -26
  173. package/progress/src/progress.token.d.ts +0 -4
  174. package/radio/src/radio-group.token.d.ts +0 -4
  175. package/radio/src/radio-item.token.d.ts +0 -4
  176. package/roving-focus/src/roving-focus-group.token.d.ts +0 -7
  177. package/roving-focus/src/roving-focus-item.token.d.ts +0 -4
  178. package/switch/src/switch.directive.d.ts +0 -73
  179. package/switch/src/switch.token.d.ts +0 -4
  180. package/toggle/src/toggle.directive.d.ts +0 -30
  181. package/visually-hidden/README.md +0 -3
  182. package/visually-hidden/index.d.ts +0 -1
  183. package/visually-hidden/src/visually-hidden.directive.d.ts +0 -11
@@ -1,36 +1,17 @@
1
+ import { InjectionToken } from '@angular/core';
1
2
  import * as i0 from "@angular/core";
2
3
  import * as i1 from "@radix-ng/primitives/roving-focus";
4
+ export declare const RdxRadioItemToken: InjectionToken<RdxRadioItemDirective>;
5
+ export declare function injectRadioItem(): RdxRadioItemDirective;
3
6
  export declare class RdxRadioItemDirective {
4
- /**
5
- * Access the radio group.
6
- */
7
- protected readonly radioGroup: import("@radix-ng/primitives/radio").RdxRadioGroupDirective;
8
- /**
9
- * The value of the radio item.
10
- */
7
+ protected readonly radioGroup: import("./radio-root.directive").RdxRadioGroupDirective;
8
+ id: string;
11
9
  value: string;
12
- /**
13
- * Whether the radio item is disabled.
14
- * @default false
15
- */
16
10
  disabled: boolean;
17
- /**
18
- * Handle keydown events.
19
- * @param event The keydown event.
20
- * @internal
21
- */
22
- protected onKeydown(event: KeyboardEvent): void;
23
- /**
24
- * When the item receives focus, select it.
25
- * @internal
26
- */
27
- protected onFocus(): void;
28
- /**
29
- * When the item receives a click, select it.
30
- * @internal
31
- */
32
- protected onClick(): void;
11
+ _onKeydown(event: KeyboardEvent): void;
12
+ _onFocus(): void;
13
+ _onClick(): void;
33
14
  static ɵfac: i0.ɵɵFactoryDeclaration<RdxRadioItemDirective, never>;
34
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxRadioItemDirective, "button[rdxRadioItem]", never, { "value": { "alias": "value"; "required": true; }; "disabled": { "alias": "disabled"; "required": false; }; }, {}, never, never, true, [{ directive: typeof i1.RdxRovingFocusItemDirective; inputs: {}; outputs: {}; }]>;
15
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxRadioItemDirective, "[RadioItem]", ["RadioItem"], { "id": { "alias": "id"; "required": false; }; "value": { "alias": "value"; "required": true; }; "disabled": { "alias": "disabled"; "required": false; }; }, {}, never, never, true, [{ directive: typeof i1.RdxRovingFocusItemDirective; inputs: {}; outputs: {}; }]>;
35
16
  static ngAcceptInputType_disabled: unknown;
36
17
  }
@@ -1,25 +1,32 @@
1
- import { EventEmitter } from '@angular/core';
1
+ import { EventEmitter, InjectionToken } from '@angular/core';
2
2
  import { ControlValueAccessor } from '@angular/forms';
3
3
  import * as i0 from "@angular/core";
4
4
  import * as i1 from "@radix-ng/primitives/roving-focus";
5
- export declare class RdxRadioGroupDirective implements ControlValueAccessor {
6
- /**
7
- * The value of the radio group.
8
- */
5
+ export declare const RdxRadioGroupToken: InjectionToken<RdxRadioGroupDirective>;
6
+ export declare function injectRadioGroup(): RdxRadioGroupDirective;
7
+ interface RadioGroupProps {
8
+ name?: string;
9
+ disabled?: boolean;
10
+ defaultValue?: string;
11
+ value?: string;
12
+ onValueChange?: EventEmitter<string>;
13
+ }
14
+ export declare class RdxRadioGroupDirective implements RadioGroupProps, ControlValueAccessor {
9
15
  value?: string;
10
- /**
11
- * Whether the radio group is disabled.
12
- */
13
16
  disabled: boolean;
17
+ dir?: string;
14
18
  /**
15
- * The orientation of the radio group.
16
- * @default 'horizontal'
19
+ * The orientation of the radio group only vertical.
20
+ * Horizontal radio buttons can sometimes be challenging to scan and localize.
21
+ * The horizontal arrangement of radio buttons may also lead to difficulties in determining which
22
+ * label corresponds to which button: whether the label is above or below the button.
23
+ * @default 'vertical'
17
24
  */
18
- orientation: 'horizontal' | 'vertical';
25
+ readonly _orientation = "vertical";
19
26
  /**
20
- * Event emitted when the value of the radio group changes.
27
+ * Event handler called when the value changes.
21
28
  */
22
- readonly valueChange: EventEmitter<string>;
29
+ readonly onValueChange: EventEmitter<string>;
23
30
  /**
24
31
  * The callback function to call when the value of the radio group changes.
25
32
  * @internal
@@ -55,11 +62,11 @@ export declare class RdxRadioGroupDirective implements ControlValueAccessor {
55
62
  */
56
63
  setDisabledState(isDisabled: boolean): void;
57
64
  /**
58
- * When focus leaves the radio group, mark it as touched.
59
- * @internal
65
+ * When focus leaves the radio group.
60
66
  */
61
- protected onFocusout(): void;
67
+ _onFocusout(): void;
62
68
  static ɵfac: i0.ɵɵFactoryDeclaration<RdxRadioGroupDirective, never>;
63
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxRadioGroupDirective, "[rdxRadioGroup]", never, { "value": { "alias": "rdxRadioGroupValue"; "required": false; }; "disabled": { "alias": "rdxRadioGroupDisabled"; "required": false; }; "orientation": { "alias": "rdxRadioGroupOrientation"; "required": false; }; }, { "valueChange": "rdxRadioGroupValueChange"; }, never, never, true, [{ directive: typeof i1.RdxRovingFocusGroupDirective; inputs: {}; outputs: {}; }]>;
69
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxRadioGroupDirective, "div[RadioRoot]", ["RadioRoot"], { "value": { "alias": "value"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "dir": { "alias": "dir"; "required": false; }; }, { "onValueChange": "onValueChange"; }, never, never, true, [{ directive: typeof i1.RdxRovingFocusGroupDirective; inputs: {}; outputs: {}; }]>;
64
70
  static ngAcceptInputType_disabled: unknown;
65
71
  }
72
+ export {};
@@ -1,4 +1,2 @@
1
1
  export * from './src/roving-focus-group.directive';
2
- export * from './src/roving-focus-group.token';
3
2
  export * from './src/roving-focus-item.directive';
4
- export * from './src/roving-focus-item.token';
@@ -2,6 +2,8 @@ import { FocusKeyManager } from '@angular/cdk/a11y';
2
2
  import { OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
3
3
  import type { RdxRovingFocusItemDirective } from './roving-focus-item.directive';
4
4
  import * as i0 from "@angular/core";
5
+ export type Orientation = 'horizontal' | 'vertical';
6
+ export declare function injectRovingFocusGroup(): RdxRovingFocusGroupDirective;
5
7
  export declare class RdxRovingFocusGroupDirective implements OnInit, OnChanges, OnDestroy {
6
8
  private readonly directionality;
7
9
  private readonly destroyRef;
@@ -10,16 +12,12 @@ export declare class RdxRovingFocusGroupDirective implements OnInit, OnChanges,
10
12
  * We don't use ContentChildren as dynamically added items may not be in the correct order.
11
13
  */
12
14
  private readonly items;
13
- /**
14
- * Create the focus key manager instance.
15
- * @internal
16
- */
17
15
  readonly keyManager: FocusKeyManager<RdxRovingFocusItemDirective>;
18
16
  /**
19
17
  * Determine the orientation of the roving focus group.
20
18
  * @default vertical
21
19
  */
22
- orientation: 'horizontal' | 'vertical';
20
+ orientation: Orientation;
23
21
  /**
24
22
  * Determine if focus should wrap when the end or beginning is reached.
25
23
  * @default true
@@ -48,7 +46,7 @@ export declare class RdxRovingFocusGroupDirective implements OnInit, OnChanges,
48
46
  * Set the orientation of the roving focus group.
49
47
  * @param orientation The orientation of the roving focus group.
50
48
  */
51
- setOrientation(orientation: 'horizontal' | 'vertical'): void;
49
+ setOrientation(orientation: Orientation): void;
52
50
  static ɵfac: i0.ɵɵFactoryDeclaration<RdxRovingFocusGroupDirective, never>;
53
51
  static ɵdir: i0.ɵɵDirectiveDeclaration<RdxRovingFocusGroupDirective, "[rdxRovingFocusGroup]", never, { "orientation": { "alias": "rdxRovingFocusGroupOrientation"; "required": false; }; "wrap": { "alias": "rdxRovingFocusGroupWrap"; "required": false; }; }, {}, never, never, true, never>;
54
52
  static ngAcceptInputType_wrap: unknown;
@@ -1,6 +1,7 @@
1
1
  import { FocusableOption } from '@angular/cdk/a11y';
2
2
  import { OnDestroy, OnInit } from '@angular/core';
3
3
  import * as i0 from "@angular/core";
4
+ export declare function injectRovingFocusItem(): RdxRovingFocusItemDirective;
4
5
  export declare class RdxRovingFocusItemDirective implements OnInit, OnDestroy, FocusableOption {
5
6
  /**
6
7
  * Access the group the roving focus item belongs to.
@@ -26,22 +27,19 @@ export declare class RdxRovingFocusItemDirective implements OnInit, OnDestroy, F
26
27
  * Define if the item is disabled.
27
28
  */
28
29
  disabled: boolean;
29
- /**
30
- * Derive the tabindex of the roving focus item.
31
- * @internal
32
- */
33
- get tabindex(): number;
34
30
  ngOnInit(): void;
35
31
  ngOnDestroy(): void;
36
32
  /**
37
33
  * Handle key events on the roving focus item.
38
34
  * @param event The key event.
39
- * @internal
40
35
  */
41
- onKeydown(event: KeyboardEvent): void;
36
+ _onKeydown(event: KeyboardEvent): void;
37
+ /**
38
+ * Derive the tabindex of the roving focus item.
39
+ */
40
+ _tabindex(): number;
42
41
  /**
43
42
  * Focus the roving focus item.
44
- * @param origin The origin of the focus request.
45
43
  * @internal
46
44
  */
47
45
  focus(): void;
@@ -1,16 +1,22 @@
1
1
  import * as i0 from "@angular/core";
2
- export declare class RdxSeparatorDirective {
2
+ declare const ORIENTATIONS: readonly ["horizontal", "vertical"];
3
+ export type Orientation = (typeof ORIENTATIONS)[number];
4
+ export interface SeparatorProps {
3
5
  /**
4
- * The orientation of the separator.
5
- * @default 'horizontal'
6
+ * Either `vertical` or `horizontal`. Defaults to `horizontal`.
6
7
  */
7
- orientation: 'horizontal' | 'vertical';
8
+ orientation?: Orientation;
8
9
  /**
9
- * Whether the separator is for decoration purposes. If true, the separator will not be included in the accessibility tree.
10
- * @default false
10
+ * Whether the component is purely decorative. When true, accessibility-related attributes
11
+ * are updated so that the rendered element is removed from the accessibility tree.
11
12
  */
13
+ decorative?: boolean;
14
+ }
15
+ export declare class RdxSeparatorRootDirective implements SeparatorProps {
16
+ orientation: Orientation;
12
17
  decorative: boolean;
13
- static ɵfac: i0.ɵɵFactoryDeclaration<RdxSeparatorDirective, never>;
14
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxSeparatorDirective, "[rdxSeparator]", never, { "orientation": { "alias": "rdxSeparatorOrientation"; "required": false; }; "decorative": { "alias": "rdxSeparatorDecorative"; "required": false; }; }, {}, never, never, true, never>;
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<RdxSeparatorRootDirective, never>;
19
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxSeparatorRootDirective, "div[SeparatorRoot]", never, { "orientation": { "alias": "rdxOrientation"; "required": false; }; "decorative": { "alias": "rdxDecorative"; "required": false; }; }, {}, never, never, true, never>;
15
20
  static ngAcceptInputType_decorative: unknown;
16
21
  }
22
+ export {};
package/switch/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './src/switch-thumb.directive';
2
- export * from './src/switch.directive';
3
- export * from './src/switch.token';
2
+ export * from './src/switch-root.directive';
3
+ export * from './src/switch-input.directive';
4
+ export type { SwitchProps } from './src/switch-root.directive';
@@ -0,0 +1,6 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class RdxSwitchInputDirective {
3
+ protected readonly switchRoot: import("./switch-root.directive").RdxSwitchRootDirective;
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<RdxSwitchInputDirective, never>;
5
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxSwitchInputDirective, "input[SwitchInput]", ["SwitchInput"], {}, {}, never, never, true, never>;
6
+ }
@@ -0,0 +1,34 @@
1
+ import { EventEmitter, InjectionToken, ModelSignal } from '@angular/core';
2
+ import { ControlValueAccessor } from '@angular/forms';
3
+ import * as i0 from "@angular/core";
4
+ export declare const RdxSwitchToken: InjectionToken<RdxSwitchRootDirective>;
5
+ export declare function injectSwitch(): RdxSwitchRootDirective;
6
+ export interface SwitchProps {
7
+ checked?: ModelSignal<boolean>;
8
+ defaultChecked?: boolean;
9
+ required?: boolean;
10
+ onCheckedChange?: EventEmitter<boolean>;
11
+ }
12
+ export declare class RdxSwitchRootDirective implements SwitchProps, ControlValueAccessor {
13
+ required: boolean;
14
+ readonly checked: ModelSignal<boolean>;
15
+ disabled: boolean;
16
+ readonly onCheckedChange: EventEmitter<boolean>;
17
+ /**
18
+ * The method to be called in order to update ngModel.
19
+ */
20
+ _onChange?: (checked: boolean) => void;
21
+ /**
22
+ * onTouch function registered via registerOnTouch (ControlValueAccessor).
23
+ */
24
+ _onTouched?: () => void;
25
+ registerOnChange(fn: (checked: boolean) => void): void;
26
+ registerOnTouched(fn: () => void): void;
27
+ writeValue(checked: boolean): void;
28
+ setDisabledState(isDisabled: boolean): void;
29
+ protected toggle(): void;
30
+ static ɵfac: i0.ɵɵFactoryDeclaration<RdxSwitchRootDirective, never>;
31
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxSwitchRootDirective, "button[SwitchRoot]", ["SwitchRoot"], { "required": { "alias": "required"; "required": false; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "checked": "checkedChange"; "onCheckedChange": "onCheckedChange"; }, never, never, true, never>;
32
+ static ngAcceptInputType_required: unknown;
33
+ static ngAcceptInputType_disabled: unknown;
34
+ }
@@ -1,9 +1,6 @@
1
1
  import * as i0 from "@angular/core";
2
2
  export declare class RdxSwitchThumbDirective {
3
- /**
4
- * Access the switch directive.
5
- */
6
- protected readonly switch: import("@radix-ng/primitives/switch").RdxSwitchDirective;
3
+ protected readonly switchRoot: import("./switch-root.directive").RdxSwitchRootDirective;
7
4
  static ɵfac: i0.ɵɵFactoryDeclaration<RdxSwitchThumbDirective, never>;
8
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxSwitchThumbDirective, "[rdxSwitchThumb]", never, {}, {}, never, never, true, never>;
5
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxSwitchThumbDirective, "span[SwitchThumb]", ["SwitchThumb"], {}, {}, never, never, true, never>;
9
6
  }
package/toggle/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- export * from './src/toggle.directive';
1
+ export * from './src/toggle-root.directive';
2
+ export type { ToggleProps } from './src/toggle-root.directive';
@@ -0,0 +1,32 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export interface ToggleProps {
4
+ /**
5
+ * The controlled state of the toggle.
6
+ */
7
+ pressed?: boolean;
8
+ /**
9
+ * The state of the toggle when initially rendered. Use `defaultPressed`
10
+ * if you do not need to control the state of the toggle.
11
+ * @defaultValue false
12
+ */
13
+ defaultPressed?: boolean;
14
+ /**
15
+ * The callback that fires when the state of the toggle changes.
16
+ */
17
+ onPressedChange?: EventEmitter<boolean>;
18
+ }
19
+ export declare class RdxToggleRootDirective implements ToggleProps {
20
+ pressed: boolean;
21
+ disabled: boolean;
22
+ id: string;
23
+ /**
24
+ * Event emitted when the toggle is pressed.
25
+ */
26
+ readonly onPressedChange: EventEmitter<boolean>;
27
+ protected toggle(): void;
28
+ static ɵfac: i0.ɵɵFactoryDeclaration<RdxToggleRootDirective, never>;
29
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxToggleRootDirective, "button[ToggleRoot]", ["ToggleRoot"], { "pressed": { "alias": "pressed"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "id": { "alias": "id"; "required": false; }; }, { "onPressedChange": "onPressedChange"; }, never, never, true, never>;
30
+ static ngAcceptInputType_pressed: unknown;
31
+ static ngAcceptInputType_disabled: unknown;
32
+ }
@@ -24,9 +24,6 @@ export declare class RdxToggleGroupButtonDirective implements OnChanges {
24
24
  */
25
25
  protected get checked(): boolean;
26
26
  ngOnChanges(changes: SimpleChanges): void;
27
- /**
28
- * Toggle this toggle button.
29
- */
30
27
  toggle(): void;
31
28
  /**
32
29
  * Ensure the disabled state is propagated to the roving focus item.
@@ -34,6 +31,6 @@ export declare class RdxToggleGroupButtonDirective implements OnChanges {
34
31
  */
35
32
  updateDisabled(): void;
36
33
  static ɵfac: i0.ɵɵFactoryDeclaration<RdxToggleGroupButtonDirective, never>;
37
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxToggleGroupButtonDirective, "button[rdxToggleGroupButton]", never, { "value": { "alias": "rdxToggleGroupButtonValue"; "required": true; }; "disabled": { "alias": "rdxToggleGroupButtonDisabled"; "required": false; }; }, {}, never, never, true, [{ directive: typeof i1.RdxRovingFocusItemDirective; inputs: {}; outputs: {}; }]>;
34
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxToggleGroupButtonDirective, "button[rdxToggleGroupButton]", never, { "value": { "alias": "value"; "required": true; }; "disabled": { "alias": "disabled"; "required": false; }; }, {}, never, never, true, [{ directive: typeof i1.RdxRovingFocusItemDirective; inputs: {}; outputs: {}; }]>;
38
35
  static ngAcceptInputType_disabled: unknown;
39
36
  }
@@ -40,7 +40,7 @@ export declare class RdxToggleGroupMultiDirective implements OnInit, OnChanges,
40
40
  */
41
41
  private onChange?;
42
42
  /**
43
- * The touched callback.
43
+ * onTouch function registered via registerOnTouch (ControlValueAccessor).
44
44
  */
45
45
  protected onTouched?: () => void;
46
46
  ngOnInit(): void;
@@ -40,7 +40,7 @@ export declare class RdxToggleGroupDirective implements OnInit, OnChanges, After
40
40
  */
41
41
  private onChange?;
42
42
  /**
43
- * The touched callback.
43
+ * onTouch function registered via registerOnTouch (ControlValueAccessor).
44
44
  */
45
45
  protected onTouched?: () => void;
46
46
  ngOnInit(): void;
@@ -84,7 +84,7 @@ export declare class RdxToggleGroupDirective implements OnInit, OnChanges, After
84
84
  */
85
85
  setDisabledState(isDisabled: boolean): void;
86
86
  static ɵfac: i0.ɵɵFactoryDeclaration<RdxToggleGroupDirective, never>;
87
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxToggleGroupDirective, "[rdxToggleGroup]", never, { "value": { "alias": "rdxToggleGroupValue"; "required": false; }; "orientation": { "alias": "rdxToggleGroupOrientation"; "required": false; }; "disabled": { "alias": "rdxToggleGroupDisabled"; "required": false; }; "wrap": { "alias": "rdxToggleGroupWrap"; "required": false; }; "valueChange": { "alias": "rdxToggleGroupValueChange"; "required": false; }; }, {}, ["buttons"], never, true, [{ directive: typeof i1.RdxRovingFocusGroupDirective; inputs: { "rdxRovingFocusGroupWrap": "wrap"; "rdxRovingFocusGroupOrientation": "orientation"; }; outputs: {}; }]>;
87
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxToggleGroupDirective, "[rdxToggleGroup]", never, { "value": { "alias": "value"; "required": false; }; "orientation": { "alias": "orientation"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "wrap": { "alias": "wrap"; "required": false; }; "valueChange": { "alias": "valueChange"; "required": false; }; }, {}, ["buttons"], never, true, [{ directive: typeof i1.RdxRovingFocusGroupDirective; inputs: { "rdxRovingFocusGroupWrap": "wrap"; "rdxRovingFocusGroupOrientation": "orientation"; }; outputs: {}; }]>;
88
88
  static ngAcceptInputType_disabled: unknown;
89
89
  static ngAcceptInputType_wrap: unknown;
90
90
  }
@@ -1,3 +0,0 @@
1
- # @ng-primitives/ng-primitives/accordion
2
-
3
- Secondary entry point of `@ng-primitives/ng-primitives`. It can be used by importing from `@ng-primitives/ng-primitives/accordion`.
@@ -1,7 +0,0 @@
1
- export * from './src/accordion-content/accordion-content.directive';
2
- export * from './src/accordion-header/accordion-header.directive';
3
- export * from './src/accordion-item/accordion-item.directive';
4
- export * from './src/accordion-trigger/accordion-trigger.directive';
5
- export * from './src/accordion/accordion.directive';
6
- export * from './src/accordion-state.directive';
7
- export * from './src/accordion.config';
@@ -1,64 +0,0 @@
1
- import { OnInit } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- import * as i1 from "@radix-ng/primitives/roving-focus";
4
- /**
5
- * The root accordion directive that all parts should be placed within.
6
- */
7
- export declare class RdxAccordionDirective implements OnInit {
8
- /**
9
- * Access the global accordion configuration.
10
- */
11
- private readonly config;
12
- /**
13
- * Access the roving focus group
14
- */
15
- private readonly rovingFocusGroup;
16
- /**
17
- * Determines whether multiple items can be open simultaneously.
18
- * @default false
19
- */
20
- multiple: boolean;
21
- /**
22
- * The orientation of the accordion.
23
- * @default 'vertical'
24
- */
25
- orientation: 'horizontal' | 'vertical';
26
- /**
27
- * Determines whether the accordion should be disabled.
28
- * @default false
29
- */
30
- disabled: boolean;
31
- /**
32
- * Store the currently expanded item(s).
33
- * @internal
34
- */
35
- readonly expanded: import("@angular/core").WritableSignal<string[]>;
36
- /**
37
- * The touched callback.
38
- */
39
- protected onTouched?: () => void;
40
- ngOnInit(): void;
41
- /**
42
- * Expand an item.
43
- * @param id The id of the item to expand.
44
- */
45
- expand(id: string): void;
46
- /**
47
- * Collapse an Item.
48
- * @param id The id of the Item to collapse.
49
- */
50
- collapse(id: string): void;
51
- /**
52
- * Toggle an item.
53
- * @param id The id of the item to toggle.
54
- */
55
- toggle(id: string): void;
56
- /**
57
- * Collapse all items.
58
- */
59
- collapseAll(): void;
60
- static ɵfac: i0.ɵɵFactoryDeclaration<RdxAccordionDirective, never>;
61
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxAccordionDirective, "[rdxAccordion]", never, { "multiple": { "alias": "rdxAccordionMultiple"; "required": false; }; "orientation": { "alias": "rdxAccordionOrientation"; "required": false; }; "disabled": { "alias": "rdxAccordionDisabled"; "required": false; }; }, {}, never, never, true, [{ directive: typeof i1.RdxRovingFocusGroupDirective; inputs: { "rdxRovingFocusGroupOrientation": "orientation"; }; outputs: {}; }]>;
62
- static ngAcceptInputType_multiple: unknown;
63
- static ngAcceptInputType_disabled: unknown;
64
- }
@@ -1,4 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import type { RdxAccordionDirective } from './accordion.directive';
3
- export declare const RdxAccordionToken: InjectionToken<RdxAccordionDirective>;
4
- export declare function injectAccordion(): RdxAccordionDirective;
@@ -1,44 +0,0 @@
1
- import { AfterViewInit } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- import * as i1 from "../accordion-state.directive";
4
- export declare class RdxAccordionContentDirective implements AfterViewInit {
5
- /**
6
- * Access the element ref.
7
- */
8
- private readonly elementRef;
9
- /**
10
- * Access the change detector ref.
11
- */
12
- private readonly changeDetectorRef;
13
- /**
14
- * Access the item the content belongs to.
15
- */
16
- protected readonly item: import("@radix-ng/primitives/accordion").RdxAccordionItemDirective;
17
- /**
18
- * Derive the id of the content.
19
- * @internal
20
- */
21
- readonly id: string;
22
- /**
23
- * Derive the id of the trigger.
24
- * @internal
25
- */
26
- readonly labelledby: string;
27
- /**
28
- * Define the width of the content as a CSS variable, so it can be used in animations.
29
- * @internal
30
- */
31
- protected width: number;
32
- /**
33
- * Define the height of the content as a CSS variable, so it can be used in animations.
34
- * @internal
35
- */
36
- protected height: number;
37
- ngAfterViewInit(): void;
38
- /**
39
- * Update the size of the content.
40
- */
41
- private updateContentSize;
42
- static ɵfac: i0.ɵɵFactoryDeclaration<RdxAccordionContentDirective, never>;
43
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxAccordionContentDirective, "[rdxAccordionContent]", never, {}, {}, never, never, true, [{ directive: typeof i1.RdxAccordionStateDirective; inputs: {}; outputs: {}; }]>;
44
- }
@@ -1,6 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- import * as i1 from "../accordion-state.directive";
3
- export declare class RdxAccordionHeaderDirective {
4
- static ɵfac: i0.ɵɵFactoryDeclaration<RdxAccordionHeaderDirective, never>;
5
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxAccordionHeaderDirective, "[rdxAccordionHeader]", never, {}, {}, never, never, true, [{ directive: typeof i1.RdxAccordionStateDirective; inputs: {}; outputs: {}; }]>;
6
- }
@@ -1,42 +0,0 @@
1
- import { EventEmitter } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- import * as i1 from "../accordion-state.directive";
4
- import * as i2 from "@radix-ng/primitives/roving-focus";
5
- export declare class RdxAccordionItemDirective {
6
- /**
7
- * Access the accordion the item belongs to.
8
- */
9
- private readonly accordion;
10
- /**
11
- * Determines whether the item should be expanded.
12
- * @default false
13
- */
14
- expanded: boolean;
15
- /**
16
- * Determines whether the Item should be disabled.
17
- * @default false
18
- */
19
- disabled: boolean;
20
- /**
21
- * Event emitted when the Item is expanded.
22
- */
23
- readonly expandedChange: EventEmitter<boolean>;
24
- /**
25
- * The unique id of the Item.
26
- * @internal
27
- */
28
- readonly id: string;
29
- /**
30
- * Determine if this item is expanded.
31
- * @internal
32
- */
33
- readonly isExpanded: import("@angular/core").Signal<boolean>;
34
- /**
35
- * Toggle the expanded state of the Item.
36
- */
37
- toggle(): void;
38
- static ɵfac: i0.ɵɵFactoryDeclaration<RdxAccordionItemDirective, never>;
39
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxAccordionItemDirective, "[rdxAccordionItem]", never, { "expanded": { "alias": "rdxAccordionItemExpanded"; "required": false; }; "disabled": { "alias": "rdxAccordionItemDisabled"; "required": false; }; }, { "expandedChange": "rdxAccordionItemExpandedChange"; }, never, never, true, [{ directive: typeof i1.RdxAccordionStateDirective; inputs: {}; outputs: {}; }, { directive: typeof i2.RdxRovingFocusItemDirective; inputs: {}; outputs: {}; }]>;
40
- static ngAcceptInputType_expanded: unknown;
41
- static ngAcceptInputType_disabled: unknown;
42
- }
@@ -1,4 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import type { RdxAccordionItemDirective } from './accordion-item.directive';
3
- export declare const RdxAccordionItemToken: InjectionToken<RdxAccordionItemDirective>;
4
- export declare function injectAccordionItem(): RdxAccordionItemDirective;
@@ -1,28 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- export declare class RdxAccordionStateDirective {
3
- /**
4
- * Access the accordion the trigger belongs to.
5
- */
6
- private readonly accordion;
7
- /**
8
- * Access the item the trigger belongs to.
9
- */
10
- private readonly item;
11
- /**
12
- * Determine the expanded state of the item.
13
- * @internal
14
- */
15
- readonly state: import("@angular/core").Signal<"open" | "closed">;
16
- /**
17
- * Determine the disabled state of the item.
18
- * @internal
19
- */
20
- get isDisabled(): boolean;
21
- /**
22
- * Determine the orientation of the accordion.
23
- * @internal
24
- */
25
- get orientation(): 'horizontal' | 'vertical';
26
- static ɵfac: i0.ɵɵFactoryDeclaration<RdxAccordionStateDirective, never>;
27
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxAccordionStateDirective, never, never, {}, {}, never, never, true, never>;
28
- }
@@ -1,23 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- import * as i1 from "../accordion-state.directive";
3
- export declare class RdxAccordionTriggerDirective {
4
- /**
5
- * Access the item the trigger belongs to.
6
- */
7
- protected readonly item: import("@radix-ng/primitives/accordion").RdxAccordionItemDirective;
8
- /**
9
- * Derive the id of the trigger.
10
- */
11
- protected get triggerId(): string;
12
- /**
13
- * Get the id of the item content.
14
- * @internal
15
- */
16
- protected readonly contentId: string;
17
- /**
18
- * Toggle the expanded state of the item.
19
- */
20
- toggle(): void;
21
- static ɵfac: i0.ɵɵFactoryDeclaration<RdxAccordionTriggerDirective, never>;
22
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxAccordionTriggerDirective, "[rdxAccordionTrigger]", never, {}, {}, never, never, true, [{ directive: typeof i1.RdxAccordionStateDirective; inputs: {}; outputs: {}; }]>;
23
- }
@@ -1,25 +0,0 @@
1
- import { InjectionToken, Provider } from '@angular/core';
2
- export declare const RdxAccordionConfigToken: InjectionToken<RdxAccordionConfig>;
3
- export interface RdxAccordionConfig {
4
- /**
5
- * Determines whether multiple items can be open simultaneously.
6
- * @default false
7
- */
8
- multiple: boolean;
9
- /**
10
- * The orientation of the accordion.
11
- * @default 'vertical'
12
- */
13
- orientation: 'horizontal' | 'vertical';
14
- }
15
- /**
16
- * Provide the default accordion configuration
17
- * @param config The accordion configuration
18
- * @returns The provider
19
- */
20
- export declare function provideAccordionConfig(config: Partial<RdxAccordionConfig>): Provider[];
21
- /**
22
- * Inject the accordion configuration
23
- * @returns The global accordion configuration
24
- */
25
- export declare function injectAccordionConfig(): RdxAccordionConfig;