@radix-ng/primitives 0.8.1 → 0.9.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 (179) hide show
  1. package/accordion/index.d.ts +3 -3
  2. package/accordion/src/accordion-content.directive.d.ts +1 -1
  3. package/accordion/src/accordion-header.directive.d.ts +1 -1
  4. package/accordion/src/accordion-item.directive.d.ts +1 -1
  5. package/accordion/src/accordion-root.directive.d.ts +1 -1
  6. package/accordion/src/accordion-trigger.directive.d.ts +1 -1
  7. package/alert-dialog/index.d.ts +2 -2
  8. package/avatar/index.d.ts +2 -2
  9. package/avatar/src/avatar-fallback.directive.d.ts +3 -3
  10. package/avatar/src/avatar-image.directive.d.ts +6 -6
  11. package/avatar/src/avatar-root.directive.d.ts +4 -4
  12. package/checkbox/index.d.ts +2 -0
  13. package/checkbox/src/checkbox-button.directive.d.ts +8 -0
  14. package/checkbox/src/checkbox-indicator.directive.d.ts +1 -1
  15. package/checkbox/src/checkbox-input.directive.d.ts +9 -0
  16. package/checkbox/src/checkbox.directive.d.ts +7 -5
  17. package/collapsible/index.d.ts +1 -1
  18. package/collapsible/src/collapsible-content.directive.d.ts +1 -1
  19. package/collapsible/src/collapsible-root.directive.d.ts +1 -1
  20. package/collapsible/src/collapsible-trigger.directive.d.ts +1 -1
  21. package/dropdown-menu/index.d.ts +8 -3
  22. package/dropdown-menu/src/dropdown-menu-content.directive.d.ts +12 -2
  23. package/dropdown-menu/src/dropdown-menu-item-checkbox.directive.d.ts +6 -0
  24. package/dropdown-menu/src/dropdown-menu-item-indicator.directive.d.ts +7 -0
  25. package/dropdown-menu/src/dropdown-menu-item-radio-group.directive.d.ts +12 -0
  26. package/dropdown-menu/src/dropdown-menu-item-radio.directive.d.ts +19 -0
  27. package/dropdown-menu/src/dropdown-menu-item-selectable.d.ts +14 -0
  28. package/dropdown-menu/src/dropdown-menu-item.directive.d.ts +13 -4
  29. package/dropdown-menu/src/dropdown-menu-label.directive.d.ts +1 -1
  30. package/dropdown-menu/src/dropdown-menu-separator.directive.d.ts +2 -2
  31. package/dropdown-menu/src/dropdown-menu-trigger.directive.d.ts +33 -2
  32. package/esm2022/accordion/index.mjs +4 -4
  33. package/esm2022/accordion/src/accordion-content.directive.mjs +7 -9
  34. package/esm2022/accordion/src/accordion-header.directive.mjs +5 -5
  35. package/esm2022/accordion/src/accordion-item.directive.mjs +17 -9
  36. package/esm2022/accordion/src/accordion-root.directive.mjs +5 -5
  37. package/esm2022/accordion/src/accordion-trigger.directive.mjs +5 -5
  38. package/esm2022/alert-dialog/index.mjs +3 -3
  39. package/esm2022/alert-dialog/src/alert-dialog-cancel.directive.mjs +4 -4
  40. package/esm2022/alert-dialog/src/alert-dialog-content.directive.mjs +3 -3
  41. package/esm2022/alert-dialog/src/alert-dialog-root.directive.mjs +5 -4
  42. package/esm2022/alert-dialog/src/alert-dialog-title.directive.mjs +3 -3
  43. package/esm2022/alert-dialog/src/alert-dialog-trigger.directive.mjs +4 -4
  44. package/esm2022/alert-dialog/src/alert-dialog.service.mjs +6 -9
  45. package/esm2022/avatar/index.mjs +1 -1
  46. package/esm2022/avatar/src/avatar-fallback.directive.mjs +6 -6
  47. package/esm2022/avatar/src/avatar-image.directive.mjs +6 -6
  48. package/esm2022/avatar/src/avatar-root.directive.mjs +6 -6
  49. package/esm2022/checkbox/index.mjs +3 -1
  50. package/esm2022/checkbox/src/checkbox-button.directive.mjs +33 -0
  51. package/esm2022/checkbox/src/checkbox-indicator.directive.mjs +6 -5
  52. package/esm2022/checkbox/src/checkbox-input.directive.mjs +41 -0
  53. package/esm2022/checkbox/src/checkbox.directive.mjs +18 -22
  54. package/esm2022/checkbox/src/checkbox.token.mjs +1 -1
  55. package/esm2022/collapsible/index.mjs +2 -2
  56. package/esm2022/collapsible/src/collapsible-content.directive.mjs +13 -7
  57. package/esm2022/collapsible/src/collapsible-root.directive.mjs +5 -5
  58. package/esm2022/collapsible/src/collapsible-trigger.directive.mjs +5 -5
  59. package/esm2022/dropdown-menu/index.mjs +9 -4
  60. package/esm2022/dropdown-menu/src/dropdown-menu-content.directive.mjs +36 -10
  61. package/esm2022/dropdown-menu/src/dropdown-menu-item-checkbox.directive.mjs +26 -0
  62. package/esm2022/dropdown-menu/src/dropdown-menu-item-indicator.directive.mjs +22 -0
  63. package/esm2022/dropdown-menu/src/dropdown-menu-item-radio-group.directive.mjs +37 -0
  64. package/esm2022/dropdown-menu/src/dropdown-menu-item-radio.directive.mjs +60 -0
  65. package/esm2022/dropdown-menu/src/dropdown-menu-item-selectable.mjs +40 -0
  66. package/esm2022/dropdown-menu/src/dropdown-menu-item.directive.mjs +45 -13
  67. package/esm2022/dropdown-menu/src/dropdown-menu-label.directive.mjs +5 -5
  68. package/esm2022/dropdown-menu/src/dropdown-menu-separator.directive.mjs +8 -8
  69. package/esm2022/dropdown-menu/src/dropdown-menu-trigger.directive.mjs +134 -12
  70. package/esm2022/label/index.mjs +2 -2
  71. package/esm2022/label/src/label.directive.mjs +54 -0
  72. package/esm2022/menu/index.mjs +7 -7
  73. package/esm2022/menu/src/menu-content.directive.mjs +3 -3
  74. package/esm2022/menu/src/menu-directive.mjs +3 -3
  75. package/esm2022/menu/src/menu-group.directive.mjs +3 -3
  76. package/esm2022/menu/src/menu-item.directive.mjs +8 -4
  77. package/esm2022/menu/src/menu-label.directive.mjs +3 -3
  78. package/esm2022/menu/src/menu-separator.directive.mjs +4 -4
  79. package/esm2022/menubar/index.mjs +7 -7
  80. package/esm2022/menubar/src/menubar-content.directive.mjs +3 -3
  81. package/esm2022/menubar/src/menubar-item-checkbox.directive.mjs +4 -4
  82. package/esm2022/menubar/src/menubar-item-indicator.directive.mjs +3 -3
  83. package/esm2022/menubar/src/menubar-item-radio.directive.mjs +4 -4
  84. package/esm2022/menubar/src/menubar-item.directive.mjs +4 -4
  85. package/esm2022/menubar/src/menubar-radio-group.directive.mjs +3 -3
  86. package/esm2022/menubar/src/menubar-root.directive.mjs +3 -3
  87. package/esm2022/menubar/src/menubar-separator.directive.mjs +4 -4
  88. package/esm2022/menubar/src/menubar-trigger.directive.mjs +4 -4
  89. package/esm2022/progress/src/progress-indicator.directive.mjs +19 -9
  90. package/esm2022/progress/src/progress-root.directive.mjs +63 -7
  91. package/esm2022/radio/src/radio-indicator.directive.mjs +4 -4
  92. package/esm2022/radio/src/radio-item.directive.mjs +4 -8
  93. package/esm2022/radio/src/radio-root.directive.mjs +5 -9
  94. package/esm2022/separator/src/separator.directive.mjs +3 -3
  95. package/esm2022/switch/index.mjs +29 -3
  96. package/esm2022/switch/src/switch-input.directive.mjs +12 -10
  97. package/esm2022/switch/src/switch-root.directive.mjs +47 -23
  98. package/esm2022/switch/src/switch-thumb.directive.mjs +7 -7
  99. package/esm2022/tabs/index.mjs +7 -7
  100. package/esm2022/tabs/src/tabs-content.directive.mjs +7 -5
  101. package/esm2022/tabs/src/tabs-context.service.mjs +3 -3
  102. package/esm2022/tabs/src/tabs-list.directive.mjs +5 -5
  103. package/esm2022/tabs/src/tabs-root.directive.mjs +5 -5
  104. package/esm2022/tabs/src/tabs-trigger.directive.mjs +5 -5
  105. package/esm2022/toggle/index.mjs +2 -2
  106. package/esm2022/toggle/src/toggle.directive.mjs +39 -0
  107. package/esm2022/toggle-group/src/toggle-group-button.directive.mjs +14 -13
  108. package/esm2022/toggle-group/src/toggle-group-button.token.mjs +1 -1
  109. package/esm2022/toggle-group/src/toggle-group-multi.directive.mjs +18 -34
  110. package/esm2022/toggle-group/src/toggle-group.directive.mjs +5 -25
  111. package/esm2022/toggle-group/src/toggle-group.token.mjs +1 -1
  112. package/fesm2022/radix-ng-primitives-accordion.mjs +73 -67
  113. package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
  114. package/fesm2022/radix-ng-primitives-alert-dialog.mjs +49 -51
  115. package/fesm2022/radix-ng-primitives-alert-dialog.mjs.map +1 -1
  116. package/fesm2022/radix-ng-primitives-avatar.mjs +15 -15
  117. package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
  118. package/fesm2022/radix-ng-primitives-checkbox.mjs +91 -26
  119. package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
  120. package/fesm2022/radix-ng-primitives-collapsible.mjs +20 -14
  121. package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
  122. package/fesm2022/radix-ng-primitives-dropdown-menu.mjs +386 -42
  123. package/fesm2022/radix-ng-primitives-dropdown-menu.mjs.map +1 -1
  124. package/fesm2022/radix-ng-primitives-label.mjs +22 -16
  125. package/fesm2022/radix-ng-primitives-label.mjs.map +1 -1
  126. package/fesm2022/radix-ng-primitives-menu.mjs +26 -22
  127. package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
  128. package/fesm2022/radix-ng-primitives-menubar.mjs +31 -31
  129. package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
  130. package/fesm2022/radix-ng-primitives-progress.mjs +80 -14
  131. package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
  132. package/fesm2022/radix-ng-primitives-radio.mjs +10 -14
  133. package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
  134. package/fesm2022/radix-ng-primitives-separator.mjs +3 -3
  135. package/fesm2022/radix-ng-primitives-switch.mjs +94 -46
  136. package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
  137. package/fesm2022/radix-ng-primitives-tabs.mjs +25 -23
  138. package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
  139. package/fesm2022/radix-ng-primitives-toggle-group.mjs +34 -65
  140. package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
  141. package/fesm2022/radix-ng-primitives-toggle.mjs +18 -28
  142. package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
  143. package/label/index.d.ts +1 -1
  144. package/label/src/label.directive.d.ts +23 -0
  145. package/menu/index.d.ts +2 -2
  146. package/menubar/index.d.ts +2 -2
  147. package/package.json +1 -7
  148. package/progress/src/progress-indicator.directive.d.ts +12 -2
  149. package/progress/src/progress-root.directive.d.ts +38 -4
  150. package/radio/src/radio-item.directive.d.ts +1 -2
  151. package/radio/src/radio-root.directive.d.ts +1 -2
  152. package/switch/index.d.ts +11 -2
  153. package/switch/src/switch-input.directive.d.ts +1 -1
  154. package/switch/src/switch-root.directive.d.ts +26 -9
  155. package/switch/src/switch-thumb.directive.d.ts +1 -1
  156. package/tabs/index.d.ts +2 -2
  157. package/tabs/src/tabs-content.directive.d.ts +1 -1
  158. package/tabs/src/tabs-list.directive.d.ts +1 -1
  159. package/tabs/src/tabs-root.directive.d.ts +1 -1
  160. package/tabs/src/tabs-trigger.directive.d.ts +1 -1
  161. package/toggle/index.d.ts +2 -2
  162. package/toggle/src/toggle.directive.d.ts +30 -0
  163. package/toggle-group/src/toggle-group-button.directive.d.ts +9 -6
  164. package/toggle-group/src/toggle-group-multi.directive.d.ts +18 -15
  165. package/toggle-group/src/toggle-group.directive.d.ts +3 -9
  166. package/esm2022/label/src/label-root.directive.mjs +0 -48
  167. package/esm2022/roving-focus/index.mjs +0 -3
  168. package/esm2022/roving-focus/radix-ng-primitives-roving-focus.mjs +0 -5
  169. package/esm2022/roving-focus/src/roving-focus-group.directive.mjs +0 -109
  170. package/esm2022/roving-focus/src/roving-focus-item.directive.mjs +0 -86
  171. package/esm2022/toggle/src/toggle-root.directive.mjs +0 -49
  172. package/fesm2022/radix-ng-primitives-roving-focus.mjs +0 -198
  173. package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +0 -1
  174. package/label/src/label-root.directive.d.ts +0 -13
  175. package/roving-focus/README.md +0 -1
  176. package/roving-focus/index.d.ts +0 -2
  177. package/roving-focus/src/roving-focus-group.directive.d.ts +0 -53
  178. package/roving-focus/src/roving-focus-item.directive.d.ts +0 -50
  179. package/toggle/src/toggle-root.directive.d.ts +0 -32
@@ -4,24 +4,60 @@ import { InjectionToken, inject, numberAttribute, Directive, Input } from '@angu
4
4
  let idIterator = 0;
5
5
  const MIN_PERCENT = 0;
6
6
  const DEFAULT_MAX = 100;
7
+ const PROGRESS_NAME = 'Radix Progress';
7
8
  const RdxProgressToken = new InjectionToken('RdxProgressDirective');
9
+ /**
10
+ * Injects the current instance of RdxProgressRootDirective.
11
+ * @returns The instance of RdxProgressRootDirective.
12
+ */
8
13
  function injectProgress() {
9
14
  return inject(RdxProgressToken);
10
15
  }
16
+ /**
17
+ * Directive to manage progress bar state and attributes.
18
+ *
19
+ * This directive provides a way to create a progress bar with customizable value and max attributes.
20
+ * It handles aria attributes for accessibility and provides different states like 'indeterminate', 'complete', and 'loading'.
21
+ */
11
22
  class RdxProgressRootDirective {
12
23
  constructor() {
24
+ /**
25
+ * The unique ID for the progress bar.
26
+ * @default 'rdx-progress-bar-{idIterator}'
27
+ */
13
28
  this.id = `rdx-progress-bar-${idIterator++}`;
29
+ /**
30
+ * The current value of the progress bar.
31
+ * @default 0
32
+ */
14
33
  this.value = MIN_PERCENT;
15
34
  /**
35
+ * The maximum value of the progress bar.
16
36
  * @default 100
17
37
  */
18
38
  this.max = DEFAULT_MAX;
39
+ /**
40
+ * Function to generate the value label.
41
+ */
19
42
  this.valueLabel = (value, max) => this.defaultGetValueLabel(value, max);
20
43
  }
44
+ /**
45
+ * Lifecycle hook that is called when any data-bound property of a directive changes.
46
+ * @param changes - The changed properties.
47
+ * @ignore
48
+ */
49
+ ngOnChanges(changes) {
50
+ if (changes['max'] && !this.isValidMaxNumber(this.max)) {
51
+ console.error(this.getInvalidMaxError(`${this.max}`, PROGRESS_NAME));
52
+ }
53
+ if (changes['value'] && this.value !== null && !this.isValidValueNumber(this.value, this.max)) {
54
+ console.error(this.getInvalidValueError(`${this.value}`, PROGRESS_NAME));
55
+ }
56
+ }
21
57
  /**
22
58
  * Get the state of the progress bar.
23
59
  * @returns 'indeterminate' | 'loading' | 'complete'
24
- * @internal
60
+ * @ignore
25
61
  */
26
62
  get state() {
27
63
  return this.getProgressState(this.value, this.max);
@@ -32,19 +68,39 @@ class RdxProgressRootDirective {
32
68
  defaultGetValueLabel(value, max) {
33
69
  return `${Math.round((value / max) * 100)}%`;
34
70
  }
35
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxProgressRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
36
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.0.4", type: RdxProgressRootDirective, isStandalone: true, selector: "div[ProgressRoot]", inputs: { id: "id", value: ["rdxValue", "value", numberAttribute], max: ["rdxMax", "max", numberAttribute], valueLabel: ["rdxValueLabel", "valueLabel"] }, host: { attributes: { "role": "progressbar", "tabindex": "-1" }, properties: { "attr.id": "id", "attr.aria-valuemax": "max", "attr.aria-valuemin": "0", "attr.aria-valuenow": "value", "attr.aria-valuetext": "valueLabel(value, max)", "attr.data-state": "state", "attr.data-value": "value", "attr.data-max": "max" } }, providers: [{ provide: RdxProgressToken, useExisting: RdxProgressRootDirective }], exportAs: ["ProgressRoot"], ngImport: i0 }); }
71
+ isValidMaxNumber(max) {
72
+ return this.isNumber(max) && !isNaN(max) && max > 0;
73
+ }
74
+ isNumber(value) {
75
+ return typeof value === 'number';
76
+ }
77
+ isValidValueNumber(value, max) {
78
+ return this.isNumber(value) && !isNaN(value) && value <= max && value >= 0;
79
+ }
80
+ getInvalidMaxError(propValue, componentName) {
81
+ return `Invalid prop \`max\` of value \`${propValue}\` supplied to \`${componentName}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${DEFAULT_MAX}\`.`;
82
+ }
83
+ getInvalidValueError(propValue, componentName) {
84
+ return `Invalid prop \`value\` of value \`${propValue}\` supplied to \`${componentName}\`. The \`value\` prop must be:
85
+ - a positive number
86
+ - less than the value passed to \`max\` (or ${DEFAULT_MAX} if no \`max\` prop is set)
87
+ - \`null\` or \`undefined\` if the progress is indeterminate.
88
+
89
+ Defaulting to \`null\`.`;
90
+ }
91
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxProgressRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
92
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.1.2", type: RdxProgressRootDirective, isStandalone: true, selector: "div[rdxProgressRoot]", inputs: { id: "id", value: ["rdxValue", "value", numberAttribute], max: ["rdxMax", "max", numberAttribute], valueLabel: ["rdxValueLabel", "valueLabel"] }, host: { attributes: { "role": "progressbar", "tabindex": "-1" }, properties: { "id": "id", "attr.aria-valuemax": "max", "attr.aria-valuemin": "0", "attr.aria-valuenow": "value", "attr.aria-valuetext": "valueLabel(value, max)", "attr.data-state": "state", "attr.data-value": "value", "attr.data-max": "max" } }, providers: [{ provide: RdxProgressToken, useExisting: RdxProgressRootDirective }], exportAs: ["ProgressRoot"], usesOnChanges: true, ngImport: i0 }); }
37
93
  }
38
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxProgressRootDirective, decorators: [{
94
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxProgressRootDirective, decorators: [{
39
95
  type: Directive,
40
96
  args: [{
41
- selector: 'div[ProgressRoot]',
97
+ selector: 'div[rdxProgressRoot]',
42
98
  exportAs: 'ProgressRoot',
43
99
  standalone: true,
44
100
  providers: [{ provide: RdxProgressToken, useExisting: RdxProgressRootDirective }],
45
101
  host: {
46
102
  role: 'progressbar',
47
- '[attr.id]': 'id',
103
+ '[id]': 'id',
48
104
  '[attr.aria-valuemax]': 'max',
49
105
  '[attr.aria-valuemin]': '0',
50
106
  '[attr.aria-valuenow]': 'value',
@@ -70,23 +126,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImpor
70
126
  args: ['rdxValueLabel']
71
127
  }] } });
72
128
 
129
+ /**
130
+ * Directive to manage progress indicator state and attributes.
131
+ *
132
+ * This directive is used to display the progress indicator inside the progress bar.
133
+ * It inherits the state and value from the `RdxProgressRootDirective`.
134
+ */
73
135
  class RdxProgressIndicatorDirective {
74
136
  constructor() {
75
- this._progress = injectProgress();
137
+ /**
138
+ *
139
+ * This allows the directive to access the progress bar state and values.
140
+ */
141
+ this.progress = injectProgress();
76
142
  }
77
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxProgressIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
78
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.4", type: RdxProgressIndicatorDirective, isStandalone: true, selector: "div[ProgressIndicator]", host: { properties: { "attr.data-state": "_progress.state", "attr.data-value": "_progress.value", "attr.data-max": "_progress.max" } }, exportAs: ["ProgressIndicator"], ngImport: i0 }); }
143
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxProgressIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
144
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.1.2", type: RdxProgressIndicatorDirective, isStandalone: true, selector: "div[rdxProgressIndicator]", host: { properties: { "attr.data-state": "progress.state", "attr.data-value": "progress.value", "attr.data-max": "progress.max" } }, exportAs: ["ProgressIndicator"], ngImport: i0 }); }
79
145
  }
80
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxProgressIndicatorDirective, decorators: [{
146
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxProgressIndicatorDirective, decorators: [{
81
147
  type: Directive,
82
148
  args: [{
83
- selector: 'div[ProgressIndicator]',
149
+ selector: 'div[rdxProgressIndicator]',
84
150
  exportAs: 'ProgressIndicator',
85
151
  standalone: true,
86
152
  host: {
87
- '[attr.data-state]': '_progress.state',
88
- '[attr.data-value]': '_progress.value',
89
- '[attr.data-max]': '_progress.max'
153
+ '[attr.data-state]': 'progress.state',
154
+ '[attr.data-value]': 'progress.value',
155
+ '[attr.data-max]': 'progress.max'
90
156
  }
91
157
  }]
92
158
  }] });
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-progress.mjs","sources":["../../../packages/primitives/progress/src/progress-root.directive.ts","../../../packages/primitives/progress/src/progress-indicator.directive.ts","../../../packages/primitives/progress/radix-ng-primitives-progress.ts"],"sourcesContent":["import { Directive, inject, InjectionToken, Input, numberAttribute } from '@angular/core';\n\nlet idIterator = 0;\n\nconst MIN_PERCENT = 0;\nconst DEFAULT_MAX = 100;\n\nconst RdxProgressToken = new InjectionToken<RdxProgressRootDirective>('RdxProgressDirective');\n\nexport function injectProgress(): RdxProgressRootDirective {\n return inject(RdxProgressToken);\n}\n\nexport type ProgressState = 'indeterminate' | 'loading' | 'complete';\n\nexport interface ProgressProps {\n value?: number | null | undefined;\n max?: number;\n getValueLabel?: string;\n}\n\n@Directive({\n selector: 'div[ProgressRoot]',\n exportAs: 'ProgressRoot',\n standalone: true,\n providers: [{ provide: RdxProgressToken, useExisting: RdxProgressRootDirective }],\n host: {\n role: 'progressbar',\n '[attr.id]': 'id',\n '[attr.aria-valuemax]': 'max',\n '[attr.aria-valuemin]': '0',\n '[attr.aria-valuenow]': 'value',\n '[attr.aria-valuetext]': 'valueLabel(value, max)',\n '[attr.data-state]': 'state',\n '[attr.data-value]': 'value',\n '[attr.data-max]': 'max',\n // set tab index to -1 so screen readers will read the aria-label\n // Note: there is a known issue with JAWS that does not read progressbar aria labels on FireFox\n tabindex: '-1'\n }\n})\nexport class RdxProgressRootDirective implements ProgressProps {\n @Input() id = `rdx-progress-bar-${idIterator++}`;\n\n @Input({ alias: 'rdxValue', transform: numberAttribute }) value = MIN_PERCENT;\n\n /**\n * @default 100\n */\n @Input({ alias: 'rdxMax', transform: numberAttribute }) max = DEFAULT_MAX;\n\n @Input('rdxValueLabel') valueLabel: (value: number, max: number) => string = (value, max) =>\n this.defaultGetValueLabel(value, max);\n\n /**\n * Get the state of the progress bar.\n * @returns 'indeterminate' | 'loading' | 'complete'\n * @internal\n */\n get state(): ProgressState {\n return this.getProgressState(this.value, this.max);\n }\n\n private getProgressState(value: number | undefined | null, maxValue: number): ProgressState {\n return value == null ? 'indeterminate' : value === maxValue ? 'complete' : 'loading';\n }\n\n private defaultGetValueLabel(value: number, max: number) {\n return `${Math.round((value / max) * 100)}%`;\n }\n}\n","import { Directive } from '@angular/core';\n\nimport { injectProgress } from './progress-root.directive';\n\n@Directive({\n selector: 'div[ProgressIndicator]',\n exportAs: 'ProgressIndicator',\n standalone: true,\n host: {\n '[attr.data-state]': '_progress.state',\n '[attr.data-value]': '_progress.value',\n '[attr.data-max]': '_progress.max'\n }\n})\nexport class RdxProgressIndicatorDirective {\n readonly _progress = injectProgress();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA,IAAI,UAAU,GAAG,CAAC,CAAC;AAEnB,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,MAAM,gBAAgB,GAAG,IAAI,cAAc,CAA2B,sBAAsB,CAAC,CAAC;SAE9E,cAAc,GAAA;AAC1B,IAAA,OAAO,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACpC,CAAC;MA8BY,wBAAwB,CAAA;AApBrC,IAAA,WAAA,GAAA;AAqBa,QAAA,IAAA,CAAA,EAAE,GAAG,CAAA,iBAAA,EAAoB,UAAU,EAAE,EAAE,CAAC;QAES,IAAK,CAAA,KAAA,GAAG,WAAW,CAAC;AAE9E;;AAEG;QACqD,IAAG,CAAA,GAAA,GAAG,WAAW,CAAC;AAElD,QAAA,IAAA,CAAA,UAAU,GAA2C,CAAC,KAAK,EAAE,GAAG,KACpF,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAkB7C,KAAA;AAhBG;;;;A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,EAAA,iBAAA,EAAA,iBAAA,EAAA,eAAA,EAAA,eAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAA7B,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBAVzC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,wBAAwB;AAClC,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,mBAAmB,EAAE,iBAAiB;AACtC,wBAAA,mBAAmB,EAAE,iBAAiB;AACtC,wBAAA,iBAAiB,EAAE,eAAe;AACrC,qBAAA;AACJ,iBAAA,CAAA;;;ACbD;;AAEG;;;;"}
1
+ {"version":3,"file":"radix-ng-primitives-progress.mjs","sources":["../../../packages/primitives/progress/src/progress-root.directive.ts","../../../packages/primitives/progress/src/progress-indicator.directive.ts","../../../packages/primitives/progress/radix-ng-primitives-progress.ts"],"sourcesContent":["import { Directive, inject, InjectionToken, Input, numberAttribute, OnChanges, SimpleChanges } from '@angular/core';\n\nlet idIterator = 0;\n\nconst MIN_PERCENT = 0;\nconst DEFAULT_MAX = 100;\nconst PROGRESS_NAME = 'Radix Progress';\n\nconst RdxProgressToken = new InjectionToken<RdxProgressRootDirective>('RdxProgressDirective');\n\n/**\n * Injects the current instance of RdxProgressRootDirective.\n * @returns The instance of RdxProgressRootDirective.\n */\nexport function injectProgress(): RdxProgressRootDirective {\n return inject(RdxProgressToken);\n}\n\nexport type ProgressState = 'indeterminate' | 'complete' | 'loading';\n\nexport interface ProgressProps {\n value?: number | null | undefined;\n max?: number;\n getValueLabel?: string;\n}\n\n/**\n * Directive to manage progress bar state and attributes.\n *\n * This directive provides a way to create a progress bar with customizable value and max attributes.\n * It handles aria attributes for accessibility and provides different states like 'indeterminate', 'complete', and 'loading'.\n */\n@Directive({\n selector: 'div[rdxProgressRoot]',\n exportAs: 'ProgressRoot',\n standalone: true,\n providers: [{ provide: RdxProgressToken, useExisting: RdxProgressRootDirective }],\n host: {\n role: 'progressbar',\n '[id]': 'id',\n '[attr.aria-valuemax]': 'max',\n '[attr.aria-valuemin]': '0',\n '[attr.aria-valuenow]': 'value',\n '[attr.aria-valuetext]': 'valueLabel(value, max)',\n '[attr.data-state]': 'state',\n '[attr.data-value]': 'value',\n '[attr.data-max]': 'max',\n // set tab index to -1 so screen readers will read the aria-label\n // Note: there is a known issue with JAWS that does not read progressbar aria labels on FireFox\n tabindex: '-1'\n }\n})\nexport class RdxProgressRootDirective implements ProgressProps, OnChanges {\n /**\n * The unique ID for the progress bar.\n * @default 'rdx-progress-bar-{idIterator}'\n */\n @Input() id = `rdx-progress-bar-${idIterator++}`;\n\n /**\n * The current value of the progress bar.\n * @default 0\n */\n @Input({ alias: 'rdxValue', transform: numberAttribute }) value = MIN_PERCENT;\n\n /**\n * The maximum value of the progress bar.\n * @default 100\n */\n @Input({ alias: 'rdxMax', transform: numberAttribute }) max = DEFAULT_MAX;\n\n /**\n * Function to generate the value label.\n */\n @Input('rdxValueLabel') valueLabel: (value: number, max: number) => string = (value, max) =>\n this.defaultGetValueLabel(value, max);\n\n /**\n * Lifecycle hook that is called when any data-bound property of a directive changes.\n * @param changes - The changed properties.\n * @ignore\n */\n ngOnChanges(changes: SimpleChanges) {\n if (changes['max'] && !this.isValidMaxNumber(this.max)) {\n console.error(this.getInvalidMaxError(`${this.max}`, PROGRESS_NAME));\n }\n\n if (changes['value'] && this.value !== null && !this.isValidValueNumber(this.value, this.max)) {\n console.error(this.getInvalidValueError(`${this.value}`, PROGRESS_NAME));\n }\n }\n\n /**\n * Get the state of the progress bar.\n * @returns 'indeterminate' | 'loading' | 'complete'\n * @ignore\n */\n get state(): ProgressState {\n return this.getProgressState(this.value, this.max);\n }\n\n private getProgressState(value: number | undefined | null, maxValue: number): ProgressState {\n return value == null ? 'indeterminate' : value === maxValue ? 'complete' : 'loading';\n }\n\n private defaultGetValueLabel(value: number, max: number) {\n return `${Math.round((value / max) * 100)}%`;\n }\n\n private isValidMaxNumber(max: unknown): max is number {\n return this.isNumber(max) && !isNaN(max) && max > 0;\n }\n\n private isNumber(value: unknown): value is number {\n return typeof value === 'number';\n }\n\n private isValidValueNumber(value: unknown, max: number): value is number {\n return this.isNumber(value) && !isNaN(value) && value <= max && value >= 0;\n }\n\n private getInvalidMaxError(propValue: string, componentName: string): string {\n return `Invalid prop \\`max\\` of value \\`${propValue}\\` supplied to \\`${componentName}\\`. Only numbers greater than 0 are valid max values. Defaulting to \\`${DEFAULT_MAX}\\`.`;\n }\n\n private getInvalidValueError(propValue: string, componentName: string): string {\n return `Invalid prop \\`value\\` of value \\`${propValue}\\` supplied to \\`${componentName}\\`. The \\`value\\` prop must be:\n - a positive number\n - less than the value passed to \\`max\\` (or ${DEFAULT_MAX} if no \\`max\\` prop is set)\n - \\`null\\` or \\`undefined\\` if the progress is indeterminate.\n\n Defaulting to \\`null\\`.`;\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectProgress } from './progress-root.directive';\n\n/**\n * Directive to manage progress indicator state and attributes.\n *\n * This directive is used to display the progress indicator inside the progress bar.\n * It inherits the state and value from the `RdxProgressRootDirective`.\n */\n@Directive({\n selector: 'div[rdxProgressIndicator]',\n exportAs: 'ProgressIndicator',\n standalone: true,\n host: {\n '[attr.data-state]': 'progress.state',\n '[attr.data-value]': 'progress.value',\n '[attr.data-max]': 'progress.max'\n }\n})\nexport class RdxProgressIndicatorDirective {\n /**\n *\n * This allows the directive to access the progress bar state and values.\n */\n protected readonly progress = injectProgress();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA,IAAI,UAAU,GAAG,CAAC,CAAC;AAEnB,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,MAAM,aAAa,GAAG,gBAAgB,CAA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E,gBAAgB;AACrC,wBAAA,iBAAiB,EAAE,cAAc;AACpC,qBAAA;AACJ,iBAAA,CAAA;;;AClBD;;AAEG;;;;"}
@@ -1,8 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, inject, EventEmitter, booleanAttribute, Directive, Input, Output } from '@angular/core';
3
3
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
- import * as i1 from '@radix-ng/primitives/roving-focus';
5
- import { RdxRovingFocusGroupDirective, RdxRovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';
6
4
 
7
5
  const RdxRadioGroupToken = new InjectionToken('RdxRadioGroupToken');
8
6
  function injectRadioGroup() {
@@ -66,13 +64,13 @@ class RdxRadioGroupDirective {
66
64
  _onFocusout() {
67
65
  this.onTouched?.();
68
66
  }
69
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxRadioGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
70
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.0.4", type: RdxRadioGroupDirective, isStandalone: true, selector: "div[RadioRoot]", inputs: { value: "value", disabled: ["disabled", "disabled", booleanAttribute], dir: "dir" }, outputs: { onValueChange: "onValueChange" }, host: { attributes: { "role": "radiogroup" }, listeners: { "focusout": "_onFocusout()" }, properties: { "attr.aria-orientation": "_orientation", "attr.data-disabled": "disabled ? \"\" : null", "attr.dir": "dir" } }, providers: [
67
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxRadioGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
68
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.1.2", type: RdxRadioGroupDirective, isStandalone: true, selector: "div[RadioRoot]", inputs: { value: "value", disabled: ["disabled", "disabled", booleanAttribute], dir: "dir" }, outputs: { onValueChange: "onValueChange" }, host: { attributes: { "role": "radiogroup" }, listeners: { "focusout": "_onFocusout()" }, properties: { "attr.aria-orientation": "_orientation", "attr.data-disabled": "disabled ? \"\" : null", "attr.dir": "dir" } }, providers: [
71
69
  { provide: RdxRadioGroupToken, useExisting: RdxRadioGroupDirective },
72
70
  { provide: NG_VALUE_ACCESSOR, useExisting: RdxRadioGroupDirective, multi: true }
73
- ], exportAs: ["RadioRoot"], hostDirectives: [{ directive: i1.RdxRovingFocusGroupDirective }], ngImport: i0 }); }
71
+ ], exportAs: ["RadioRoot"], ngImport: i0 }); }
74
72
  }
75
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxRadioGroupDirective, decorators: [{
73
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxRadioGroupDirective, decorators: [{
76
74
  type: Directive,
77
75
  args: [{
78
76
  selector: 'div[RadioRoot]',
@@ -82,7 +80,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImpor
82
80
  { provide: RdxRadioGroupToken, useExisting: RdxRadioGroupDirective },
83
81
  { provide: NG_VALUE_ACCESSOR, useExisting: RdxRadioGroupDirective, multi: true }
84
82
  ],
85
- hostDirectives: [RdxRovingFocusGroupDirective],
86
83
  host: {
87
84
  role: 'radiogroup',
88
85
  '[attr.aria-orientation]': '_orientation',
@@ -126,16 +123,15 @@ class RdxRadioItemDirective {
126
123
  _onClick() {
127
124
  this.radioGroup.select(this.value);
128
125
  }
129
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxRadioItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
130
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.0.4", type: RdxRadioItemDirective, isStandalone: true, selector: "[RadioItem]", inputs: { id: "id", value: "value", disabled: ["disabled", "disabled", booleanAttribute] }, host: { attributes: { "type": "button", "role": "radio" }, listeners: { "focus": "_onFocus()", "click": "_onClick()", "keydown": "_onKeydown($event)" }, properties: { "attr.id": "id", "attr.aria-checked": "radioGroup.value === value ? \"true\" : \"false\"", "attr.data-disabled": "disabled ? \"\" : null", "attr.data-state": "radioGroup.value === value ? \"checked\" : \"unchecked\"" } }, providers: [{ provide: RdxRadioItemToken, useExisting: RdxRadioItemDirective }], exportAs: ["RadioItem"], hostDirectives: [{ directive: i1.RdxRovingFocusItemDirective }], ngImport: i0 }); }
126
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxRadioItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
127
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.1.2", type: RdxRadioItemDirective, isStandalone: true, selector: "[RadioItem]", inputs: { id: "id", value: "value", disabled: ["disabled", "disabled", booleanAttribute] }, host: { attributes: { "type": "button", "role": "radio" }, listeners: { "focus": "_onFocus()", "click": "_onClick()", "keydown": "_onKeydown($event)" }, properties: { "attr.id": "id", "attr.aria-checked": "radioGroup.value === value ? \"true\" : \"false\"", "attr.data-disabled": "disabled ? \"\" : null", "attr.data-state": "radioGroup.value === value ? \"checked\" : \"unchecked\"" } }, providers: [{ provide: RdxRadioItemToken, useExisting: RdxRadioItemDirective }], exportAs: ["RadioItem"], ngImport: i0 }); }
131
128
  }
132
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxRadioItemDirective, decorators: [{
129
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxRadioItemDirective, decorators: [{
133
130
  type: Directive,
134
131
  args: [{
135
132
  selector: '[RadioItem]',
136
133
  exportAs: 'RadioItem',
137
134
  standalone: true,
138
- hostDirectives: [RdxRovingFocusItemDirective],
139
135
  providers: [{ provide: RdxRadioItemToken, useExisting: RdxRadioItemDirective }],
140
136
  host: {
141
137
  type: 'button',
@@ -164,10 +160,10 @@ class RdxRadioIndicatorDirective {
164
160
  this.radioGroup = injectRadioGroup();
165
161
  this.radioItem = injectRadioItem();
166
162
  }
167
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxRadioIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
168
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.4", type: RdxRadioIndicatorDirective, isStandalone: true, selector: "[RadioIndicator]", host: { properties: { "attr.data-state": "radioGroup.value === this.radioItem.value ? \"checked\" : \"unchecked\"", "attr.data-disabled": "radioItem.disabled ? \"\" : null" } }, exportAs: ["RadioIndicator"], ngImport: i0 }); }
163
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxRadioIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
164
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.1.2", type: RdxRadioIndicatorDirective, isStandalone: true, selector: "[RadioIndicator]", host: { properties: { "attr.data-state": "radioGroup.value === this.radioItem.value ? \"checked\" : \"unchecked\"", "attr.data-disabled": "radioItem.disabled ? \"\" : null" } }, exportAs: ["RadioIndicator"], ngImport: i0 }); }
169
165
  }
170
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxRadioIndicatorDirective, decorators: [{
166
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxRadioIndicatorDirective, decorators: [{
171
167
  type: Directive,
172
168
  args: [{
173
169
  selector: '[RadioIndicator]',
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-radio.mjs","sources":["../../../packages/primitives/radio/src/radio-root.directive.ts","../../../packages/primitives/radio/src/radio-item.directive.ts","../../../packages/primitives/radio/src/radio-indicator.directive.ts","../../../packages/primitives/radio/radix-ng-primitives-radio.ts"],"sourcesContent":["import {\n booleanAttribute,\n Directive,\n EventEmitter,\n inject,\n InjectionToken,\n Input,\n Output\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { RdxRovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';\n\nexport const RdxRadioGroupToken = new InjectionToken<RdxRadioGroupDirective>('RdxRadioGroupToken');\n\nexport function injectRadioGroup(): RdxRadioGroupDirective {\n return inject(RdxRadioGroupToken);\n}\n\ninterface RadioGroupProps {\n name?: string;\n disabled?: boolean;\n // TODO: dir?: string;\n // TODO: loop?: string;\n defaultValue?: string;\n value?: string;\n onValueChange?: EventEmitter<string>;\n}\n\n@Directive({\n selector: 'div[RadioRoot]',\n exportAs: 'RadioRoot',\n standalone: true,\n providers: [\n { provide: RdxRadioGroupToken, useExisting: RdxRadioGroupDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: RdxRadioGroupDirective, multi: true }\n ],\n hostDirectives: [RdxRovingFocusGroupDirective],\n host: {\n role: 'radiogroup',\n '[attr.aria-orientation]': '_orientation',\n '[attr.data-disabled]': 'disabled ? \"\" : null',\n '[attr.dir]': 'dir',\n\n '(focusout)': '_onFocusout()'\n }\n})\nexport class RdxRadioGroupDirective implements RadioGroupProps, ControlValueAccessor {\n @Input() value?: string;\n\n @Input({ transform: booleanAttribute }) disabled = false;\n\n @Input() dir?: string;\n\n /**\n * The orientation of the radio group only vertical.\n * Horizontal radio buttons can sometimes be challenging to scan and localize.\n * The horizontal arrangement of radio buttons may also lead to difficulties in determining which\n * label corresponds to which button: whether the label is above or below the button.\n * @default 'vertical'\n */\n readonly _orientation = 'vertical';\n\n /**\n * Event handler called when the value changes.\n */\n @Output() readonly onValueChange = new EventEmitter<string>();\n\n /**\n * The callback function to call when the value of the radio group changes.\n * @internal\n */\n private onChange?: (value: string) => void;\n\n /**\n * The callback function to call when the radio group is touched.\n * @internal\n */\n private onTouched?: () => void;\n\n /**\n * Select a radio item.\n * @param value The value of the radio item to select.\n */\n select(value: string): void {\n this.value = value;\n this.onValueChange.emit(value);\n this.onChange?.(value);\n }\n\n /**\n * Update the value of the radio group.\n * @param value The new value of the radio group.\n * @internal\n */\n writeValue(value: string): void {\n this.value = value;\n }\n\n /**\n * Register a callback function to call when the value of the radio group changes.\n * @param fn The callback function to call when the value of the radio group changes.\n * @internal\n */\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Set the disabled state of the radio group.\n * @param isDisabled Whether the radio group is disabled.\n * @internal\n */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n /**\n * When focus leaves the radio group.\n */\n _onFocusout(): void {\n this.onTouched?.();\n }\n}\n","import { booleanAttribute, Directive, inject, InjectionToken, Input } from '@angular/core';\n\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { RdxRovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';\n\nimport { injectRadioGroup } from './radio-root.directive';\n\nexport const RdxRadioItemToken = new InjectionToken<RdxRadioItemDirective>('RadioItemToken');\n\nexport function injectRadioItem(): RdxRadioItemDirective {\n return inject(RdxRadioItemToken);\n}\n\n// Increasing integer for generating unique ids for radio components.\nlet nextUniqueId = 0;\n\n@Directive({\n selector: '[RadioItem]',\n exportAs: 'RadioItem',\n standalone: true,\n hostDirectives: [RdxRovingFocusItemDirective],\n providers: [{ provide: RdxRadioItemToken, useExisting: RdxRadioItemDirective }],\n host: {\n type: 'button',\n role: 'radio',\n '[attr.id]': 'id',\n '[attr.aria-checked]': 'radioGroup.value === value ? \"true\" : \"false\"',\n '[attr.data-disabled]': 'disabled ? \"\" : null',\n '[attr.data-state]': 'radioGroup.value === value ? \"checked\" : \"unchecked\"',\n\n '(focus)': '_onFocus()',\n '(click)': '_onClick()',\n '(keydown)': '_onKeydown($event)'\n }\n})\nexport class RdxRadioItemDirective {\n protected readonly radioGroup = injectRadioGroup();\n\n @Input() id = `rdx-radio-${++nextUniqueId}`;\n\n @Input({ required: true }) value!: string;\n\n @Input({ transform: booleanAttribute }) disabled = false;\n\n _onKeydown(event: KeyboardEvent): void {\n // According to WAI ARIA, radio groups don't activate items on enter keypress\n if (event.key === 'Enter') {\n event.preventDefault();\n }\n }\n\n _onFocus(): void {\n this.radioGroup.select(this.value);\n }\n\n _onClick(): void {\n this.radioGroup.select(this.value);\n }\n}\n","import { Directive } from '@angular/core';\n\nimport { injectRadioItem } from './radio-item.directive';\nimport { injectRadioGroup } from './radio-root.directive';\n\n@Directive({\n selector: '[RadioIndicator]',\n exportAs: 'RadioIndicator',\n standalone: true,\n host: {\n '[attr.data-state]': 'radioGroup.value === this.radioItem.value ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'radioItem.disabled ? \"\" : null'\n }\n})\nexport class RdxRadioIndicatorDirective {\n protected readonly radioGroup = injectRadioGroup();\n\n protected readonly radioItem = injectRadioItem();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAca,kBAAkB,GAAG,IAAI,cAAc,CAAyB,oBAAoB,EAAE;SAEnF,gBAAgB,GAAA;AAC5B,IAAA,OAAO,MAAM,CAAC,kBAAkB,CAAC,CAAC;AACtC,CAAC;MA8BY,sBAAsB,CAAA;AAlBnC,IAAA,WAAA,GAAA;QAqB4C,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;AAIzD;;;;;;AAMG;QACM,IAAY,CAAA,YAAA,GAAG,UAAU,CAAC;AAEnC;;AAEG;AACgB,QAAA,IAAA,CAAA,aAAa,GAAG,IAAI,YAAY,EAAU,CAAC;AA6DjE,KAAA;AA/CG;;;AAGG;AACH,IAAA,MAAM,CAAC,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EqB,KAAK,EAAA,CAAA;sBAA/B,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;gBAEe,QAAQ,EAAA,CAAA;sBAA/C,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;;;MC5B7B,0BAA0B,CAAA;AATvC,IAAA,WAAA,GAAA;QAUuB,IAAU,CAAA,UAAA,GAAG,gBAAgB,EAAE,CAAC;QAEhC,IAAS,CAAA,SAAA,GAAG,eAAe,EAAE,CAAC;AACpD,KAAA;8GAJY,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;kGAA1B,0BAA0B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,yEAAA,EAAA,oBAAA,EAAA,kCAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAA1B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBATtC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,mBAAmB,EAAE,qEAAqE;AAC1F,wBAAA,sBAAsB,EAAE,gCAAgC;AAC3D,qBAAA;AACJ,iBAAA,CAAA;;;ACbD;;AAEG;;;;"}
1
+ {"version":3,"file":"radix-ng-primitives-radio.mjs","sources":["../../../packages/primitives/radio/src/radio-root.directive.ts","../../../packages/primitives/radio/src/radio-item.directive.ts","../../../packages/primitives/radio/src/radio-indicator.directive.ts","../../../packages/primitives/radio/radix-ng-primitives-radio.ts"],"sourcesContent":["import { booleanAttribute, Directive, EventEmitter, inject, InjectionToken, Input, Output } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nexport const RdxRadioGroupToken = new InjectionToken<RdxRadioGroupDirective>('RdxRadioGroupToken');\n\nexport function injectRadioGroup(): RdxRadioGroupDirective {\n return inject(RdxRadioGroupToken);\n}\n\ninterface RadioGroupProps {\n name?: string;\n disabled?: boolean;\n // TODO: dir?: string;\n // TODO: loop?: string;\n defaultValue?: string;\n value?: string;\n onValueChange?: EventEmitter<string>;\n}\n\n@Directive({\n selector: 'div[RadioRoot]',\n exportAs: 'RadioRoot',\n standalone: true,\n providers: [\n { provide: RdxRadioGroupToken, useExisting: RdxRadioGroupDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: RdxRadioGroupDirective, multi: true }\n ],\n host: {\n role: 'radiogroup',\n '[attr.aria-orientation]': '_orientation',\n '[attr.data-disabled]': 'disabled ? \"\" : null',\n '[attr.dir]': 'dir',\n\n '(focusout)': '_onFocusout()'\n }\n})\nexport class RdxRadioGroupDirective implements RadioGroupProps, ControlValueAccessor {\n @Input() value?: string;\n\n @Input({ transform: booleanAttribute }) disabled = false;\n\n @Input() dir?: string;\n\n /**\n * The orientation of the radio group only vertical.\n * Horizontal radio buttons can sometimes be challenging to scan and localize.\n * The horizontal arrangement of radio buttons may also lead to difficulties in determining which\n * label corresponds to which button: whether the label is above or below the button.\n * @default 'vertical'\n */\n readonly _orientation = 'vertical';\n\n /**\n * Event handler called when the value changes.\n */\n @Output() readonly onValueChange = new EventEmitter<string>();\n\n /**\n * The callback function to call when the value of the radio group changes.\n * @internal\n */\n private onChange?: (value: string) => void;\n\n /**\n * The callback function to call when the radio group is touched.\n * @internal\n */\n private onTouched?: () => void;\n\n /**\n * Select a radio item.\n * @param value The value of the radio item to select.\n */\n select(value: string): void {\n this.value = value;\n this.onValueChange.emit(value);\n this.onChange?.(value);\n }\n\n /**\n * Update the value of the radio group.\n * @param value The new value of the radio group.\n * @internal\n */\n writeValue(value: string): void {\n this.value = value;\n }\n\n /**\n * Register a callback function to call when the value of the radio group changes.\n * @param fn The callback function to call when the value of the radio group changes.\n * @internal\n */\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Set the disabled state of the radio group.\n * @param isDisabled Whether the radio group is disabled.\n * @internal\n */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n /**\n * When focus leaves the radio group.\n */\n _onFocusout(): void {\n this.onTouched?.();\n }\n}\n","import { booleanAttribute, Directive, inject, InjectionToken, Input } from '@angular/core';\nimport { injectRadioGroup } from './radio-root.directive';\n\nexport const RdxRadioItemToken = new InjectionToken<RdxRadioItemDirective>('RadioItemToken');\n\nexport function injectRadioItem(): RdxRadioItemDirective {\n return inject(RdxRadioItemToken);\n}\n\n// Increasing integer for generating unique ids for radio components.\nlet nextUniqueId = 0;\n\n@Directive({\n selector: '[RadioItem]',\n exportAs: 'RadioItem',\n standalone: true,\n providers: [{ provide: RdxRadioItemToken, useExisting: RdxRadioItemDirective }],\n host: {\n type: 'button',\n role: 'radio',\n '[attr.id]': 'id',\n '[attr.aria-checked]': 'radioGroup.value === value ? \"true\" : \"false\"',\n '[attr.data-disabled]': 'disabled ? \"\" : null',\n '[attr.data-state]': 'radioGroup.value === value ? \"checked\" : \"unchecked\"',\n\n '(focus)': '_onFocus()',\n '(click)': '_onClick()',\n '(keydown)': '_onKeydown($event)'\n }\n})\nexport class RdxRadioItemDirective {\n protected readonly radioGroup = injectRadioGroup();\n\n @Input() id = `rdx-radio-${++nextUniqueId}`;\n\n @Input({ required: true }) value!: string;\n\n @Input({ transform: booleanAttribute }) disabled = false;\n\n _onKeydown(event: KeyboardEvent): void {\n // According to WAI ARIA, radio groups don't activate items on enter keypress\n if (event.key === 'Enter') {\n event.preventDefault();\n }\n }\n\n _onFocus(): void {\n this.radioGroup.select(this.value);\n }\n\n _onClick(): void {\n this.radioGroup.select(this.value);\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectRadioItem } from './radio-item.directive';\nimport { injectRadioGroup } from './radio-root.directive';\n\n@Directive({\n selector: '[RadioIndicator]',\n exportAs: 'RadioIndicator',\n standalone: true,\n host: {\n '[attr.data-state]': 'radioGroup.value === this.radioItem.value ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'radioItem.disabled ? \"\" : null'\n }\n})\nexport class RdxRadioIndicatorDirective {\n protected readonly radioGroup = injectRadioGroup();\n\n protected readonly radioItem = injectRadioItem();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAGa,kBAAkB,GAAG,IAAI,cAAc,CAAyB,oBAAoB,EAAE;SAEnF,gBAAgB,GAAA;AAC5B,IAAA,OAAO,MAAM,CAAC,kBAAkB,CAAC,CAAC;AACtC,CAAC;MA6BY,sBAAsB,CAAA;AAjBnC,IAAA,WAAA,GAAA;QAoB4C,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;AAIzD;;;;;;AAMG;QACM,IAAY,CAAA,YAAA,GAAG,UAAU,CAAC;AAEnC;;AAEG;AACgB,QAAA,IAAA,CAAA,aAAa,GAAG,IAAI,YAAY,EAAU,CAAC;AA6DjE,KAAA;AA/CG;;;AAGG;AACH,IAAA,MAAM,CAAC,KAAa,EAAA;AAChB,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,QAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/B,QAAA,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC;KAC1B;AAED;;;;AAIG;AACH,IAAA,UAAU,CAAC,KAAa,EAAA;AACpB,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;KACtB;AAED;;;;AAIG;AACH,IAAA,gBAAgB,CAAC,EAA2B,EAAA;AACxC,QAAA,IAAI,CAAC,QAAQ,GAAG,E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A,QAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAA1B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBATtC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,mBAAmB,EAAE,qEAAqE;AAC1F,wBAAA,sBAAsB,EAAE,gCAAgC;AAC3D,qBAAA;AACJ,iBAAA,CAAA;;;ACZD;;AAEG;;;;"}
@@ -8,10 +8,10 @@ class RdxSeparatorRootDirective {
8
8
  this.orientation = DEFAULT_ORIENTATION;
9
9
  this.decorative = false;
10
10
  }
11
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxSeparatorRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
12
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.0.4", type: RdxSeparatorRootDirective, isStandalone: true, selector: "div[SeparatorRoot]", inputs: { orientation: ["rdxOrientation", "orientation"], decorative: ["rdxDecorative", "decorative", booleanAttribute] }, host: { properties: { "attr.role": "decorative ? \"none\" : \"separator\"", "attr.aria-orientation": "!decorative && orientation === \"vertical\" ? \"vertical\" : null", "attr.data-orientation": "orientation" } }, ngImport: i0 }); }
11
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxSeparatorRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
12
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.1.2", type: RdxSeparatorRootDirective, isStandalone: true, selector: "div[SeparatorRoot]", inputs: { orientation: ["rdxOrientation", "orientation"], decorative: ["rdxDecorative", "decorative", booleanAttribute] }, host: { properties: { "attr.role": "decorative ? \"none\" : \"separator\"", "attr.aria-orientation": "!decorative && orientation === \"vertical\" ? \"vertical\" : null", "attr.data-orientation": "orientation" } }, ngImport: i0 }); }
13
13
  }
14
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxSeparatorRootDirective, decorators: [{
14
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxSeparatorRootDirective, decorators: [{
15
15
  type: Directive,
16
16
  args: [{
17
17
  selector: 'div[SeparatorRoot]',
@@ -1,48 +1,77 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, model, EventEmitter, booleanAttribute, Directive, Input, Output } from '@angular/core';
2
+ import { InjectionToken, inject, input, computed, booleanAttribute, model, EventEmitter, Directive, Output, NgModule } from '@angular/core';
3
3
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
4
 
5
5
  const RdxSwitchToken = new InjectionToken('RdxSwitchToken');
6
6
  function injectSwitch() {
7
7
  return inject(RdxSwitchToken);
8
8
  }
9
+ let idIterator = 0;
9
10
  class RdxSwitchRootDirective {
10
11
  constructor() {
11
- this.required = false;
12
+ this.id = input(`rdx-switch-${idIterator++}`);
13
+ this.elementId = computed(() => (this.id() ? this.id() : null));
14
+ // When true, indicates that the user must check
15
+ // the switch before the owning form can be submitted.
16
+ this.required = input(false, {
17
+ transform: booleanAttribute
18
+ });
19
+ // The controlled state of the switch
12
20
  this.checked = model(false);
13
- this.disabled = false;
21
+ // When true, prevents the user from interacting with the switch.
22
+ this.disabled = input(false, {
23
+ transform: booleanAttribute
24
+ });
25
+ /*
26
+ * @ignore
27
+ */
28
+ this.disabledState = computed(() => this.disabled());
14
29
  this.onCheckedChange = new EventEmitter();
15
30
  }
31
+ /**
32
+ * Registers a function to call when the checked state changes.
33
+ * @param fn Function to call on change.
34
+ */
16
35
  registerOnChange(fn) {
17
36
  this._onChange = fn;
18
37
  }
38
+ /**
39
+ * Registers a function to call when the component is touched.
40
+ * @param fn Function to call on touch.
41
+ */
19
42
  registerOnTouched(fn) {
20
43
  this._onTouched = fn;
21
44
  }
45
+ /**
46
+ * Writes a new value to the model.
47
+ * @param checked The new checked value.
48
+ */
22
49
  writeValue(checked) {
23
50
  this.checked.set(checked);
24
51
  }
25
- setDisabledState(isDisabled) {
26
- this.disabled = isDisabled;
27
- }
52
+ /**
53
+ * Toggles the checked state of the switch.
54
+ * If the switch is disabled, the function returns early.
55
+ */
28
56
  toggle() {
29
- if (this.disabled) {
57
+ if (this.disabledState()) {
30
58
  return;
31
59
  }
32
60
  this.checked.set(!this.checked());
33
61
  this._onChange?.(this.checked());
62
+ this.onCheckedChange.emit(this.checked());
34
63
  }
35
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxSwitchRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
36
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.0.4", type: RdxSwitchRootDirective, isStandalone: true, selector: "button[SwitchRoot]", inputs: { required: { classPropertyName: "required", publicName: "required", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: booleanAttribute } }, outputs: { checked: "checkedChange", onCheckedChange: "onCheckedChange" }, host: { attributes: { "role": "switch", "type": "button" }, listeners: { "focus": "_onTouched?.()", "click": "toggle()" }, properties: { "attr.aria-checked": "checked()", "attr.aria-required": "required", "attr.data-state": "checked() ? \"checked\" : \"unchecked\"", "attr.data-disabled": "disabled ? \"true\" : null", "attr.disabled": "disabled ? disabled : null" } }, providers: [
64
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxSwitchRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
65
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.2", type: RdxSwitchRootDirective, isStandalone: true, selector: "button[rdxSwitchRoot]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", onCheckedChange: "onCheckedChange" }, host: { attributes: { "role": "switch", "type": "button" }, listeners: { "focus": "_onTouched?.()", "click": "toggle()" }, properties: { "id": "elementId()", "attr.aria-checked": "checked()", "attr.aria-required": "required", "attr.data-state": "checked() ? \"checked\" : \"unchecked\"", "attr.data-disabled": "disabledState() ? \"true\" : null", "attr.disabled": "disabledState() ? disabledState() : null" } }, providers: [
37
66
  { provide: RdxSwitchToken, useExisting: RdxSwitchRootDirective },
38
67
  { provide: NG_VALUE_ACCESSOR, useExisting: RdxSwitchRootDirective, multi: true }
39
- ], exportAs: ["SwitchRoot"], ngImport: i0 }); }
68
+ ], exportAs: ["rdxSwitchRoot"], ngImport: i0 }); }
40
69
  }
41
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxSwitchRootDirective, decorators: [{
70
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxSwitchRootDirective, decorators: [{
42
71
  type: Directive,
43
72
  args: [{
44
- selector: 'button[SwitchRoot]',
45
- exportAs: 'SwitchRoot',
73
+ selector: 'button[rdxSwitchRoot]',
74
+ exportAs: 'rdxSwitchRoot',
46
75
  standalone: true,
47
76
  providers: [
48
77
  { provide: RdxSwitchToken, useExisting: RdxSwitchRootDirective },
@@ -51,75 +80,94 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImpor
51
80
  host: {
52
81
  role: 'switch',
53
82
  type: 'button',
83
+ '[id]': 'elementId()',
54
84
  '[attr.aria-checked]': 'checked()',
55
85
  '[attr.aria-required]': 'required',
56
86
  '[attr.data-state]': 'checked() ? "checked" : "unchecked"',
57
- '[attr.data-disabled]': 'disabled ? "true" : null',
58
- '[attr.disabled]': 'disabled ? disabled : null',
87
+ '[attr.data-disabled]': 'disabledState() ? "true" : null',
88
+ '[attr.disabled]': 'disabledState() ? disabledState() : null',
59
89
  '(focus)': '_onTouched?.()',
60
90
  '(click)': 'toggle()'
61
91
  }
62
92
  }]
63
- }], propDecorators: { required: [{
64
- type: Input,
65
- args: [{ transform: booleanAttribute }]
66
- }], disabled: [{
67
- type: Input,
68
- args: [{ transform: booleanAttribute }]
69
- }], onCheckedChange: [{
93
+ }], propDecorators: { onCheckedChange: [{
70
94
  type: Output
71
95
  }] } });
72
96
 
73
- class RdxSwitchThumbDirective {
97
+ class RdxSwitchInputDirective {
74
98
  constructor() {
75
99
  this.switchRoot = injectSwitch();
76
100
  }
77
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxSwitchThumbDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
78
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.4", type: RdxSwitchThumbDirective, isStandalone: true, selector: "span[SwitchThumb]", host: { properties: { "attr.data-disabled": "switchRoot.disabled ? \"true\" : null", "attr.data-state": "switchRoot.checked() ? \"checked\" : \"unchecked\"" } }, exportAs: ["SwitchThumb"], ngImport: i0 }); }
101
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxSwitchInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
102
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.1.2", type: RdxSwitchInputDirective, isStandalone: true, selector: "input[rdxSwitchInput]", host: { attributes: { "type": "checkbox", "tabindex": "-1" }, properties: { "attr.defaultChecked": "switchRoot.checked()", "attr.aria-checked": "switchRoot.checked()", "attr.aria-hidden": "true", "attr.aria-required": "switchRoot.required()", "attr.data-state": "switchRoot.checked() ? \"checked\" : \"unchecked\"", "attr.data-disabled": "switchRoot.disabledState() ? \"true\" : null", "attr.disabled": "switchRoot.disabledState() ? switchRoot.disabledState() : null", "attr.value": "switchRoot.checked() ? \"on\" : \"off\"" }, styleAttribute: "transform: translateX(-100%); position: absolute; overflow: hidden; pointerEvents: none; opacity: 0; margin: 0;" }, exportAs: ["rdxSwitchInput"], ngImport: i0 }); }
79
103
  }
80
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxSwitchThumbDirective, decorators: [{
104
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxSwitchInputDirective, decorators: [{
81
105
  type: Directive,
82
106
  args: [{
83
- selector: 'span[SwitchThumb]',
84
- exportAs: 'SwitchThumb',
107
+ selector: 'input[rdxSwitchInput]',
108
+ exportAs: 'rdxSwitchInput',
85
109
  standalone: true,
86
110
  host: {
87
- '[attr.data-disabled]': 'switchRoot.disabled ? "true" : null',
88
- '[attr.data-state]': 'switchRoot.checked() ? "checked" : "unchecked"'
111
+ type: 'checkbox',
112
+ tabindex: '-1',
113
+ '[attr.defaultChecked]': 'switchRoot.checked()',
114
+ '[attr.aria-checked]': 'switchRoot.checked()',
115
+ '[attr.aria-hidden]': 'true',
116
+ '[attr.aria-required]': 'switchRoot.required()',
117
+ '[attr.data-state]': 'switchRoot.checked() ? "checked" : "unchecked"',
118
+ '[attr.data-disabled]': 'switchRoot.disabledState() ? "true" : null',
119
+ '[attr.disabled]': 'switchRoot.disabledState() ? switchRoot.disabledState() : null',
120
+ '[attr.value]': 'switchRoot.checked() ? "on" : "off"',
121
+ style: 'transform: translateX(-100%); position: absolute; overflow: hidden; pointerEvents: none; opacity: 0; margin: 0;'
89
122
  }
90
123
  }]
91
124
  }] });
92
125
 
93
- class RdxSwitchInputDirective {
126
+ class RdxSwitchThumbDirective {
94
127
  constructor() {
95
128
  this.switchRoot = injectSwitch();
96
129
  }
97
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxSwitchInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
98
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.4", type: RdxSwitchInputDirective, isStandalone: true, selector: "input[SwitchInput]", host: { attributes: { "type": "checkbox", "tabindex": "-1" }, properties: { "attr.aria-checked": "switchRoot.checked()", "attr.aria-hidden": "true", "attr.aria-required": "switchRoot.required", "attr.data-state": "switchRoot.checked() ? \"checked\" : \"unchecked\"", "attr.data-disabled": "switchRoot.disabled ? \"true\" : null", "attr.disabled": "switchRoot.disabled ? switchRoot.disabled : null" }, styleAttribute: "position: absolute; pointerEvents: none; opacity: 0; margin: 0;" }, exportAs: ["SwitchInput"], ngImport: i0 }); }
130
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxSwitchThumbDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
131
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.1.2", type: RdxSwitchThumbDirective, isStandalone: true, selector: "span[rdxSwitchThumb]", host: { properties: { "attr.data-disabled": "switchRoot.disabledState() ? \"true\" : null", "attr.data-state": "switchRoot.checked() ? \"checked\" : \"unchecked\"" } }, exportAs: ["rdxSwitchThumb"], ngImport: i0 }); }
99
132
  }
100
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RdxSwitchInputDirective, decorators: [{
133
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxSwitchThumbDirective, decorators: [{
101
134
  type: Directive,
102
135
  args: [{
103
- selector: 'input[SwitchInput]',
104
- exportAs: 'SwitchInput',
136
+ selector: 'span[rdxSwitchThumb]',
137
+ exportAs: 'rdxSwitchThumb',
105
138
  standalone: true,
106
139
  host: {
107
- type: 'checkbox',
108
- tabindex: '-1',
109
- '[attr.aria-checked]': 'switchRoot.checked()',
110
- '[attr.aria-hidden]': 'true',
111
- '[attr.aria-required]': 'switchRoot.required',
112
- '[attr.data-state]': 'switchRoot.checked() ? "checked" : "unchecked"',
113
- '[attr.data-disabled]': 'switchRoot.disabled ? "true" : null',
114
- '[attr.disabled]': 'switchRoot.disabled ? switchRoot.disabled : null',
115
- style: 'position: absolute; pointerEvents: none; opacity: 0; margin: 0;'
140
+ '[attr.data-disabled]': 'switchRoot.disabledState() ? "true" : null',
141
+ '[attr.data-state]': 'switchRoot.checked() ? "checked" : "unchecked"'
116
142
  }
117
143
  }]
118
144
  }] });
119
145
 
146
+ const switchImports = [
147
+ RdxSwitchRootDirective,
148
+ RdxSwitchInputDirective,
149
+ RdxSwitchThumbDirective
150
+ ];
151
+ class RdxSwitchModule {
152
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxSwitchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
153
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.2", ngImport: i0, type: RdxSwitchModule, imports: [RdxSwitchRootDirective,
154
+ RdxSwitchInputDirective,
155
+ RdxSwitchThumbDirective], exports: [RdxSwitchRootDirective,
156
+ RdxSwitchInputDirective,
157
+ RdxSwitchThumbDirective] }); }
158
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxSwitchModule }); }
159
+ }
160
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.2", ngImport: i0, type: RdxSwitchModule, decorators: [{
161
+ type: NgModule,
162
+ args: [{
163
+ imports: [...switchImports],
164
+ exports: [...switchImports]
165
+ }]
166
+ }] });
167
+
120
168
  /**
121
169
  * Generated bundle index. Do not edit.
122
170
  */
123
171
 
124
- export { RdxSwitchInputDirective, RdxSwitchRootDirective, RdxSwitchThumbDirective, RdxSwitchToken, injectSwitch };
172
+ export { RdxSwitchInputDirective, RdxSwitchModule, RdxSwitchRootDirective, RdxSwitchThumbDirective, RdxSwitchToken, injectSwitch };
125
173
  //# sourceMappingURL=radix-ng-primitives-switch.mjs.map