@radix-ng/primitives 0.1.1 → 0.3.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 (94) hide show
  1. package/avatar/README.md +1 -0
  2. package/avatar/index.d.ts +4 -0
  3. package/avatar/src/avatar-fallback.directive.d.ts +34 -0
  4. package/avatar/src/avatar-image.directive.d.ts +17 -0
  5. package/avatar/src/avatar.config.d.ts +12 -0
  6. package/avatar/src/avatar.directive.d.ts +22 -0
  7. package/avatar/src/avatar.token.d.ts +4 -0
  8. package/checkbox/index.d.ts +1 -1
  9. package/esm2022/avatar/index.mjs +5 -0
  10. package/esm2022/avatar/radix-ng-primitives-avatar.mjs +5 -0
  11. package/esm2022/avatar/src/avatar-fallback.directive.mjs +61 -0
  12. package/esm2022/avatar/src/avatar-image.directive.mjs +50 -0
  13. package/esm2022/avatar/src/avatar.config.mjs +17 -0
  14. package/esm2022/avatar/src/avatar.directive.mjs +38 -0
  15. package/esm2022/avatar/src/avatar.token.mjs +6 -0
  16. package/esm2022/checkbox/index.mjs +2 -2
  17. package/esm2022/checkbox/src/checkbox-indicator.directive.mjs +1 -1
  18. package/esm2022/checkbox/src/checkbox.directive.mjs +2 -2
  19. package/esm2022/checkbox/src/checkbox.token.mjs +2 -2
  20. package/esm2022/overlay/index.mjs +5 -0
  21. package/esm2022/overlay/radix-ng-primitives-overlay.mjs +5 -0
  22. package/esm2022/overlay/src/overlay-arrow.directive.mjs +59 -0
  23. package/esm2022/overlay/src/overlay-arrow.token.mjs +3 -0
  24. package/esm2022/overlay/src/overlay-trigger.directive.mjs +279 -0
  25. package/esm2022/overlay/src/overlay-trigger.token.mjs +9 -0
  26. package/esm2022/overlay/src/overlay.directive.mjs +51 -0
  27. package/esm2022/overlay/src/overlay.token.mjs +3 -0
  28. package/esm2022/progress/src/progress-indicator.directive.mjs +1 -1
  29. package/esm2022/progress/src/progress.directive.mjs +1 -1
  30. package/esm2022/progress/src/progress.token.mjs +2 -2
  31. package/esm2022/radio/index.mjs +6 -0
  32. package/esm2022/radio/radix-ng-primitives-radio.mjs +5 -0
  33. package/esm2022/radio/src/radio-group.directive.mjs +108 -0
  34. package/esm2022/radio/src/radio-group.token.mjs +6 -0
  35. package/esm2022/radio/src/radio-indicator.directive.mjs +30 -0
  36. package/esm2022/radio/src/radio-item.directive.mjs +79 -0
  37. package/esm2022/radio/src/radio-item.token.mjs +6 -0
  38. package/esm2022/roving-focus/src/roving-focus-group.directive.mjs +2 -2
  39. package/esm2022/roving-focus/src/roving-focus-group.token.mjs +2 -2
  40. package/esm2022/roving-focus/src/roving-focus-item.directive.mjs +2 -2
  41. package/esm2022/roving-focus/src/roving-focus-item.token.mjs +2 -2
  42. package/esm2022/separator/src/separator.directive.mjs +2 -2
  43. package/esm2022/switch/index.mjs +2 -2
  44. package/esm2022/switch/src/switch-thumb.directive.mjs +1 -1
  45. package/esm2022/switch/src/switch.directive.mjs +2 -2
  46. package/esm2022/switch/src/switch.token.mjs +2 -2
  47. package/esm2022/tooltip/index.mjs +5 -0
  48. package/esm2022/tooltip/radix-ng-primitives-tooltip.mjs +5 -0
  49. package/esm2022/tooltip/src/tooltip-arrow.directive.mjs +17 -0
  50. package/esm2022/tooltip/src/tooltip-trigger.directive.mjs +148 -0
  51. package/esm2022/tooltip/src/tooltip-trigger.token.mjs +6 -0
  52. package/esm2022/tooltip/src/tooltip.config.mjs +31 -0
  53. package/esm2022/tooltip/src/tooltip.directive.mjs +46 -0
  54. package/esm2022/visually-hidden/src/visually-hidden.directive.mjs +1 -1
  55. package/fesm2022/radix-ng-primitives-avatar.mjs +167 -0
  56. package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -0
  57. package/fesm2022/radix-ng-primitives-checkbox.mjs +21 -21
  58. package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
  59. package/fesm2022/radix-ng-primitives-overlay.mjs +399 -0
  60. package/fesm2022/radix-ng-primitives-overlay.mjs.map +1 -0
  61. package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
  62. package/fesm2022/radix-ng-primitives-radio.mjs +221 -0
  63. package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -0
  64. package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -1
  65. package/fesm2022/radix-ng-primitives-separator.mjs.map +1 -1
  66. package/fesm2022/radix-ng-primitives-switch.mjs +23 -23
  67. package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
  68. package/fesm2022/radix-ng-primitives-tooltip.mjs +242 -0
  69. package/fesm2022/radix-ng-primitives-tooltip.mjs.map +1 -0
  70. package/fesm2022/radix-ng-primitives-visually-hidden.mjs.map +1 -1
  71. package/overlay/README.md +1 -0
  72. package/overlay/index.d.ts +4 -0
  73. package/overlay/src/overlay-arrow.directive.d.ts +29 -0
  74. package/overlay/src/overlay-arrow.token.d.ts +3 -0
  75. package/overlay/src/overlay-trigger.directive.d.ts +163 -0
  76. package/overlay/src/overlay-trigger.token.d.ts +7 -0
  77. package/overlay/src/overlay.directive.d.ts +29 -0
  78. package/overlay/src/overlay.token.d.ts +3 -0
  79. package/package.json +29 -4
  80. package/radio/README.md +1 -0
  81. package/radio/index.d.ts +5 -0
  82. package/radio/src/radio-group.directive.d.ts +65 -0
  83. package/radio/src/radio-group.token.d.ts +4 -0
  84. package/radio/src/radio-indicator.directive.d.ts +13 -0
  85. package/radio/src/radio-item.directive.d.ts +36 -0
  86. package/radio/src/radio-item.token.d.ts +4 -0
  87. package/switch/index.d.ts +1 -1
  88. package/tooltip/README.md +1 -0
  89. package/tooltip/index.d.ts +4 -0
  90. package/tooltip/src/tooltip-arrow.directive.d.ts +6 -0
  91. package/tooltip/src/tooltip-trigger.directive.d.ts +79 -0
  92. package/tooltip/src/tooltip-trigger.token.d.ts +4 -0
  93. package/tooltip/src/tooltip.config.d.ts +46 -0
  94. package/tooltip/src/tooltip.directive.d.ts +17 -0
@@ -0,0 +1,221 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, EventEmitter, booleanAttribute, Directive, Input, Output, HostListener } from '@angular/core';
3
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
+ import * as i1 from '@radix-ng/primitives/roving-focus';
5
+ import { RovingFocusGroupDirective, RovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';
6
+
7
+ const RadioGroupToken = new InjectionToken('RadioGroupToken');
8
+ function injectRadioGroup() {
9
+ return inject(RadioGroupToken);
10
+ }
11
+
12
+ class RadioGroupDirective {
13
+ constructor() {
14
+ /**
15
+ * Whether the radio group is disabled.
16
+ */
17
+ this.disabled = false;
18
+ /**
19
+ * The orientation of the radio group.
20
+ * @default 'horizontal'
21
+ */
22
+ this.orientation = 'horizontal';
23
+ /**
24
+ * Event emitted when the value of the radio group changes.
25
+ */
26
+ this.valueChange = new EventEmitter();
27
+ }
28
+ /**
29
+ * Select a radio item.
30
+ * @param value The value of the radio item to select.
31
+ */
32
+ select(value) {
33
+ this.value = value;
34
+ this.valueChange.emit(value);
35
+ this.onChange?.(value);
36
+ }
37
+ /**
38
+ * Update the value of the radio group.
39
+ * @param value The new value of the radio group.
40
+ * @internal
41
+ */
42
+ writeValue(value) {
43
+ this.value = value;
44
+ }
45
+ /**
46
+ * Register a callback function to call when the value of the radio group changes.
47
+ * @param fn The callback function to call when the value of the radio group changes.
48
+ * @internal
49
+ */
50
+ registerOnChange(fn) {
51
+ this.onChange = fn;
52
+ }
53
+ registerOnTouched(fn) {
54
+ this.onTouched = fn;
55
+ }
56
+ /**
57
+ * Set the disabled state of the radio group.
58
+ * @param isDisabled Whether the radio group is disabled.
59
+ * @internal
60
+ */
61
+ setDisabledState(isDisabled) {
62
+ this.disabled = isDisabled;
63
+ }
64
+ /**
65
+ * When focus leaves the radio group, mark it as touched.
66
+ * @internal
67
+ */
68
+ onFocusout() {
69
+ this.onTouched?.();
70
+ }
71
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RadioGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
72
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.3", type: RadioGroupDirective, isStandalone: true, selector: "[rdxRadioGroup]", inputs: { value: ["rdxRadioGroupValue", "value"], disabled: ["rdxRadioGroupDisabled", "disabled", booleanAttribute], orientation: ["rdxRadioGroupOrientation", "orientation"] }, outputs: { valueChange: "rdxRadioGroupValueChange" }, host: { attributes: { "role": "radiogroup" }, listeners: { "focusout": "onFocusout()" }, properties: { "attr.aria-orientation": "orientation", "attr.data-disabled": "disabled ? \"\" : null" } }, providers: [
73
+ { provide: RadioGroupToken, useExisting: RadioGroupDirective },
74
+ { provide: NG_VALUE_ACCESSOR, useExisting: RadioGroupDirective, multi: true }
75
+ ], hostDirectives: [{ directive: i1.RovingFocusGroupDirective }], ngImport: i0 }); }
76
+ }
77
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RadioGroupDirective, decorators: [{
78
+ type: Directive,
79
+ args: [{
80
+ selector: '[rdxRadioGroup]',
81
+ standalone: true,
82
+ providers: [
83
+ { provide: RadioGroupToken, useExisting: RadioGroupDirective },
84
+ { provide: NG_VALUE_ACCESSOR, useExisting: RadioGroupDirective, multi: true }
85
+ ],
86
+ hostDirectives: [RovingFocusGroupDirective],
87
+ host: {
88
+ role: 'radiogroup',
89
+ '[attr.aria-orientation]': 'orientation',
90
+ '[attr.data-disabled]': 'disabled ? "" : null'
91
+ }
92
+ }]
93
+ }], propDecorators: { value: [{
94
+ type: Input,
95
+ args: ['rdxRadioGroupValue']
96
+ }], disabled: [{
97
+ type: Input,
98
+ args: [{
99
+ alias: 'rdxRadioGroupDisabled',
100
+ transform: booleanAttribute
101
+ }]
102
+ }], orientation: [{
103
+ type: Input,
104
+ args: ['rdxRadioGroupOrientation']
105
+ }], valueChange: [{
106
+ type: Output,
107
+ args: ['rdxRadioGroupValueChange']
108
+ }], onFocusout: [{
109
+ type: HostListener,
110
+ args: ['focusout']
111
+ }] } });
112
+
113
+ const RadioItemToken = new InjectionToken('RadioItemToken');
114
+ function injectRadioItem() {
115
+ return inject(RadioItemToken);
116
+ }
117
+
118
+ class RadioIndicatorDirective {
119
+ constructor() {
120
+ /**
121
+ * Access the radio group.
122
+ */
123
+ this.radioGroup = injectRadioGroup();
124
+ /**
125
+ * Access the radio group item.
126
+ */
127
+ this.radioItem = injectRadioItem();
128
+ }
129
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RadioIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
130
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.3", type: RadioIndicatorDirective, isStandalone: true, selector: "[rdxRadioIndicator]", host: { properties: { "attr.data-state": "radioGroup.value === this.radioItem.value ? \"checked\" : \"unchecked\"", "attr.data-disabled": "radioItem.disabled ? \"\" : null" } }, ngImport: i0 }); }
131
+ }
132
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RadioIndicatorDirective, decorators: [{
133
+ type: Directive,
134
+ args: [{
135
+ selector: '[rdxRadioIndicator]',
136
+ standalone: true,
137
+ host: {
138
+ '[attr.data-state]': 'radioGroup.value === this.radioItem.value ? "checked" : "unchecked"',
139
+ '[attr.data-disabled]': 'radioItem.disabled ? "" : null'
140
+ }
141
+ }]
142
+ }] });
143
+
144
+ class RadioItemDirective {
145
+ constructor() {
146
+ /**
147
+ * Access the radio group.
148
+ */
149
+ this.radioGroup = injectRadioGroup();
150
+ /**
151
+ * Whether the radio item is disabled.
152
+ * @default false
153
+ */
154
+ this.disabled = false;
155
+ }
156
+ /**
157
+ * Handle keydown events.
158
+ * @param event The keydown event.
159
+ * @internal
160
+ */
161
+ onKeydown(event) {
162
+ // According to WAI ARIA, radio groups don't activate items on enter keypress
163
+ if (event.key === 'Enter') {
164
+ event.preventDefault();
165
+ }
166
+ }
167
+ /**
168
+ * When the item receives focus, select it.
169
+ * @internal
170
+ */
171
+ onFocus() {
172
+ this.radioGroup.select(this.value);
173
+ }
174
+ /**
175
+ * When the item receives a click, select it.
176
+ * @internal
177
+ */
178
+ onClick() {
179
+ this.radioGroup.select(this.value);
180
+ }
181
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RadioItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
182
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.3", type: RadioItemDirective, isStandalone: true, selector: "button[rdxRadioItem]", inputs: { value: "value", disabled: ["disabled", "disabled", booleanAttribute] }, host: { attributes: { "type": "button", "role": "radio" }, listeners: { "keydown": "onKeydown($event)", "focus": "onFocus()", "click": "onClick()" }, properties: { "attr.aria-checked": "radioGroup.value === value ? \"true\" : \"false\"", "attr.data-disabled": "disabled ? \"\" : null", "attr.data-state": "radioGroup.value === value ? \"checked\" : \"unchecked\"" } }, providers: [{ provide: RadioItemToken, useExisting: RadioItemDirective }], hostDirectives: [{ directive: i1.RovingFocusItemDirective }], ngImport: i0 }); }
183
+ }
184
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RadioItemDirective, decorators: [{
185
+ type: Directive,
186
+ args: [{
187
+ selector: 'button[rdxRadioItem]',
188
+ standalone: true,
189
+ hostDirectives: [RovingFocusItemDirective],
190
+ providers: [{ provide: RadioItemToken, useExisting: RadioItemDirective }],
191
+ host: {
192
+ type: 'button',
193
+ role: 'radio',
194
+ '[attr.aria-checked]': 'radioGroup.value === value ? "true" : "false"',
195
+ '[attr.data-disabled]': 'disabled ? "" : null',
196
+ '[attr.data-state]': 'radioGroup.value === value ? "checked" : "unchecked"'
197
+ }
198
+ }]
199
+ }], propDecorators: { value: [{
200
+ type: Input,
201
+ args: [{ required: true }]
202
+ }], disabled: [{
203
+ type: Input,
204
+ args: [{ transform: booleanAttribute }]
205
+ }], onKeydown: [{
206
+ type: HostListener,
207
+ args: ['keydown', ['$event']]
208
+ }], onFocus: [{
209
+ type: HostListener,
210
+ args: ['focus']
211
+ }], onClick: [{
212
+ type: HostListener,
213
+ args: ['click']
214
+ }] } });
215
+
216
+ /**
217
+ * Generated bundle index. Do not edit.
218
+ */
219
+
220
+ export { RadioGroupDirective, RadioGroupToken, RadioIndicatorDirective, RadioItemDirective, RadioItemToken, injectRadioGroup, injectRadioItem };
221
+ //# sourceMappingURL=radix-ng-primitives-radio.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radix-ng-primitives-radio.mjs","sources":["../../../packages/primitives/radio/src/radio-group.token.ts","../../../packages/primitives/radio/src/radio-group.directive.ts","../../../packages/primitives/radio/src/radio-item.token.ts","../../../packages/primitives/radio/src/radio-indicator.directive.ts","../../../packages/primitives/radio/src/radio-item.directive.ts","../../../packages/primitives/radio/radix-ng-primitives-radio.ts"],"sourcesContent":["import { inject, InjectionToken } from '@angular/core';\n\nimport type { RadioGroupDirective } from './radio-group.directive';\n\nexport const RadioGroupToken = new InjectionToken<RadioGroupDirective>('RadioGroupToken');\n\nexport function injectRadioGroup(): RadioGroupDirective {\n return inject(RadioGroupToken);\n}\n","import {\n booleanAttribute,\n Directive,\n EventEmitter,\n HostListener,\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 { RovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';\n\nimport { RadioGroupToken } from './radio-group.token';\n\n@Directive({\n selector: '[rdxRadioGroup]',\n standalone: true,\n providers: [\n { provide: RadioGroupToken, useExisting: RadioGroupDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: RadioGroupDirective, multi: true }\n ],\n hostDirectives: [RovingFocusGroupDirective],\n host: {\n role: 'radiogroup',\n '[attr.aria-orientation]': 'orientation',\n '[attr.data-disabled]': 'disabled ? \"\" : null'\n }\n})\nexport class RadioGroupDirective implements ControlValueAccessor {\n /**\n * The value of the radio group.\n */\n @Input('rdxRadioGroupValue') value?: string;\n\n /**\n * Whether the radio group is disabled.\n */\n @Input({\n alias: 'rdxRadioGroupDisabled',\n transform: booleanAttribute\n })\n disabled = false;\n\n /**\n * The orientation of the radio group.\n * @default 'horizontal'\n */\n @Input('rdxRadioGroupOrientation') orientation: 'horizontal' | 'vertical' = 'horizontal';\n\n /**\n * Event emitted when the value of the radio group changes.\n */\n @Output('rdxRadioGroupValueChange') readonly valueChange = 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.valueChange.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, mark it as touched.\n * @internal\n */\n @HostListener('focusout')\n protected onFocusout(): void {\n this.onTouched?.();\n }\n}\n","import { inject, InjectionToken } from '@angular/core';\n\nimport type { RadioItemDirective } from './radio-item.directive';\n\nexport const RadioItemToken = new InjectionToken<RadioItemDirective>('RadioItemToken');\n\nexport function injectRadioItem(): RadioItemDirective {\n return inject(RadioItemToken);\n}\n","import { Directive } from '@angular/core';\n\nimport { injectRadioGroup } from './radio-group.token';\nimport { injectRadioItem } from './radio-item.token';\n\n@Directive({\n selector: '[rdxRadioIndicator]',\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 RadioIndicatorDirective {\n /**\n * Access the radio group.\n */\n protected readonly radioGroup = injectRadioGroup();\n\n /**\n * Access the radio group item.\n */\n protected readonly radioItem = injectRadioItem();\n}\n","import { booleanAttribute, Directive, HostListener, Input } from '@angular/core';\n\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { RovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';\n\nimport { injectRadioGroup } from './radio-group.token';\nimport { RadioItemToken } from './radio-item.token';\n\n@Directive({\n selector: 'button[rdxRadioItem]',\n standalone: true,\n hostDirectives: [RovingFocusItemDirective],\n providers: [{ provide: RadioItemToken, useExisting: RadioItemDirective }],\n host: {\n type: 'button',\n role: 'radio',\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})\nexport class RadioItemDirective {\n /**\n * Access the radio group.\n */\n protected readonly radioGroup = injectRadioGroup();\n\n /**\n * The value of the radio item.\n */\n @Input({ required: true }) value!: string;\n\n /**\n * Whether the radio item is disabled.\n * @default false\n */\n @Input({ transform: booleanAttribute }) disabled = false;\n\n /**\n * Handle keydown events.\n * @param event The keydown event.\n * @internal\n */\n @HostListener('keydown', ['$event'])\n protected 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 /**\n * When the item receives focus, select it.\n * @internal\n */\n @HostListener('focus')\n protected onFocus(): void {\n this.radioGroup.select(this.value);\n }\n\n /**\n * When the item receives a click, select it.\n * @internal\n */\n @HostListener('click')\n protected onClick(): void {\n this.radioGroup.select(this.value);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAIa,eAAe,GAAG,IAAI,cAAc,CAAsB,iBAAiB,EAAE;SAE1E,gBAAgB,GAAA;AAC5B,IAAA,OAAO,MAAM,CAAC,eAAe,CAAC,CAAC;AACnC;;MCqBa,mBAAmB,CAAA;AAdhC,IAAA,WAAA,GAAA;AAoBI;;AAEG;QAKH,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;AAEjB;;;AAGG;QACgC,IAAW,CAAA,WAAA,GAA8B,YAAY,CAAC;AAEzF;;AAEG;AAC0C,QAAA,IAAA,CAAA,WAAW,GAAG,IAAI,YAAY,EAAU,CAAC;AA+DzF,KAAA;AAjDG;;;AAGG;AACH,IAAA,MAAM,CAAC,KAAa,EAAA;AAChB,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,QAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC7B,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,EAAE,CAAC;KACtB;AAED,IAAA,iBAAiB,CAAC,EAAc,EAAA;AAC5B,QAAA,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;KACvB;AAED;;;;AAIG;AACH,IAAA,gBAAgB,CAAC,UAAmB,EAAA;AAChC,QAAA,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC;KAC9B;AAED;;;AAGG;IAEO,UAAU,GAAA;AAChB,QAAA,IAAI,CAAC,SAAS,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K;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;gBAQ5B,SAAS,EAAA,CAAA;sBADlB,YAAY;uBAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAA;gBAazB,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,OAAO,CAAA;gBAUX,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,OAAO,CAAA;;;AChEzB;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-roving-focus.mjs","sources":["../../../packages/primitives/roving-focus/src/roving-focus-group.token.ts","../../../packages/primitives/roving-focus/src/roving-focus-group.directive.ts","../../../packages/primitives/roving-focus/src/roving-focus-item.token.ts","../../../packages/primitives/roving-focus/src/roving-focus-item.directive.ts","../../../packages/primitives/roving-focus/radix-ng-primitives-roving-focus.ts"],"sourcesContent":["import { InjectionToken, inject } from '@angular/core';\nimport type { RovingFocusGroupDirective } from './roving-focus-group.directive';\n\nexport const RovingFocusGroupToken = new InjectionToken<RovingFocusGroupDirective>(\n 'RovingFocusToken'\n);\n\n/**\n * Inject the roving focus directive instance.\n */\nexport function injectRovingFocusGroup(): RovingFocusGroupDirective {\n return inject(RovingFocusGroupToken);\n}\n","import { FocusKeyManager } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport {\n DestroyRef,\n Directive,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n QueryList,\n SimpleChanges,\n booleanAttribute,\n inject\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { filter } from 'rxjs';\nimport type { RovingFocusItemDirective } from './roving-focus-item.directive';\nimport { RovingFocusGroupToken } from './roving-focus-group.token';\n\n@Directive({\n selector: '[rdxRovingFocusGroup]',\n standalone: true,\n providers: [{ provide: RovingFocusGroupToken, useExisting: RovingFocusGroupDirective }]\n})\nexport class RovingFocusGroupDirective implements OnInit, OnChanges, OnDestroy {\n private readonly directionality = inject(Directionality);\n\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * Create a query list of all the roving focus items.\n * We don't use ContentChildren as dynamically added items may not be in the correct order.\n */\n private readonly items = new QueryList<RovingFocusItemDirective>();\n\n /**\n * Create the focus key manager instance.\n * @internal\n */\n readonly keyManager = new FocusKeyManager<RovingFocusItemDirective>(this.items);\n\n /**\n * Determine the orientation of the roving focus group.\n * @default vertical\n */\n @Input() orientation: 'horizontal' | 'vertical' = 'vertical';\n\n /**\n * Determine if focus should wrap when the end or beginning is reached.\n * @default true\n */\n @Input({ transform: booleanAttribute }) wrap = true;\n\n ngOnInit(): void {\n this.keyManager.withWrap(this.wrap);\n\n this.setOrientation(this.orientation);\n\n // update the key manager orientation if the document direction changes\n this.directionality.change\n .pipe(\n filter(() => this.orientation === 'horizontal'),\n takeUntilDestroyed(this.destroyRef)\n )\n .subscribe((direction) => this.keyManager.withHorizontalOrientation(direction));\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if ('orientation' in changes) {\n this.setOrientation(this.orientation);\n }\n\n if ('wrap' in changes) {\n this.keyManager.withWrap(this.wrap);\n }\n }\n\n ngOnDestroy(): void {\n this.keyManager.destroy();\n }\n\n /**\n * Register a roving focus item.\n * @param item The roving focus item to register.\n */\n register(item: RovingFocusItemDirective): void {\n // add the item to the query list by sort the items based on their order\n this.items.reset([...this.items.toArray(), item].sort((a, b) => a.order - b.order));\n\n // if this is the first item, make it the active item\n if (this.items.length === 1) {\n this.keyManager.updateActiveItem(item);\n }\n }\n\n /**\n * Unregister a roving focus item.\n * @param item The roving focus item to unregister.\n */\n unregister(item: RovingFocusItemDirective): void {\n // determine if the item being removed is the active item\n const isActive = this.keyManager.activeItem === item;\n\n // remove the item from the query list\n this.items.reset(this.items.toArray().filter((i) => i !== item));\n\n // if the item being removed is the active item, make the first item the active item\n if (isActive) {\n this.keyManager.updateActiveItem(0);\n }\n }\n\n /**\n * Handle key events on the roving focus items.\n * @param event The key event.\n * @internal\n */\n onKeydown(event: KeyboardEvent): void {\n this.keyManager.onKeydown(event);\n }\n\n /**\n * Set the orientation of the roving focus group.\n * @param orientation The orientation of the roving focus group.\n */\n setOrientation(orientation: 'horizontal' | 'vertical'): void {\n this.orientation = orientation;\n\n if (orientation === 'horizontal') {\n this.keyManager.withHorizontalOrientation(this.directionality.value);\n } else {\n this.keyManager.withVerticalOrientation();\n }\n }\n}\n","import { InjectionToken, inject } from '@angular/core';\nimport type { RovingFocusItemDirective } from './roving-focus-item.directive';\n\nexport const RovingFocusItemToken = new InjectionToken<RovingFocusItemDirective>(\n 'RovingFocusItemToken'\n);\n\nexport function injectRovingFocusItem(): RovingFocusItemDirective {\n return inject(RovingFocusItemToken);\n}\n","import { FocusableOption } from '@angular/cdk/a11y';\nimport {\n ChangeDetectorRef,\n DestroyRef,\n Directive,\n ElementRef,\n HostBinding,\n HostListener,\n Input,\n OnDestroy,\n OnInit,\n booleanAttribute,\n inject,\n numberAttribute\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { injectRovingFocusGroup } from './roving-focus-group.token';\nimport { RovingFocusItemToken } from './roving-focus-item.token';\n\n@Directive({\n selector: '[rdxRovingFocusItem]',\n standalone: true,\n providers: [{ provide: RovingFocusItemToken, useExisting: RovingFocusItemDirective }]\n})\nexport class RovingFocusItemDirective implements OnInit, OnDestroy, FocusableOption {\n /**\n * Access the group the roving focus item belongs to.\n */\n private readonly group = injectRovingFocusGroup();\n\n /**\n * Access the element reference of the roving focus item.\n */\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the destroyRef\n */\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * Access the change detector ref\n */\n private readonly changeDetectorRef = inject(ChangeDetectorRef);\n\n /**\n * Define the order of the roving focus item in the group.\n */\n @Input({ transform: numberAttribute }) order = 0;\n\n /**\n * Define if the item is disabled.\n */\n @Input({ transform: booleanAttribute }) disabled = false;\n\n /**\n * Derive the tabindex of the roving focus item.\n * @internal\n */\n @HostBinding('attr.tabindex')\n get tabindex(): number {\n return this.group.keyManager.activeItem === this ? 0 : -1;\n }\n\n ngOnInit(): void {\n // register the roving focus item with the group\n this.group.register(this);\n\n // listen for changes to the active item and run change detection\n this.group.keyManager.change\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.changeDetectorRef.markForCheck());\n }\n\n ngOnDestroy(): void {\n // unregister the roving focus item with the group\n this.group.unregister(this);\n }\n\n /**\n * Handle key events on the roving focus item.\n * @param event The key event.\n * @internal\n */\n @HostListener('keydown', ['$event'])\n onKeydown(event: KeyboardEvent): void {\n this.group.onKeydown(event);\n }\n\n /**\n * Focus the roving focus item.\n * @param origin The origin of the focus request.\n * @internal\n */\n focus(): void {\n this.elementRef?.nativeElement.focus();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAGa,qBAAqB,GAAG,IAAI,cAAc,CACnD,kBAAkB,EACpB;AAEF;;AAEG;SACa,sBAAsB,GAAA;AAClC,IAAA,OAAO,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACzC;;MCYa,yBAAyB,CAAA;AALtC,IAAA,WAAA,GAAA;AAMqB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAExC,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAEjD;;;AAGG;AACc,QAAA,IAAA,CAAA,KAAK,GAAG,IAAI,SAAS,EAA4B,CAAC;AAEnE;;;AAGG;QACM,IAAU,CAAA,UAAA,GAAG,IAAI,eAAe,CAA2B,IAAI,CAAC,KAAK,CAAC,CAAC;AAEhF;;;AAGG;QACM,IAAW,CAAA,WAAA,GAA8B,UAAU,CAAC;AAE7D;;;AAGG;QACqC,IAAI,CAAA,IAAA,GAAG,IAAI,CAAC;AAmFvD,KAAA;IAjFG,QAAQ,GAAA;QACJ,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,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CAAA;kBALpC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,UAAU,EAAE,IAAI;oBAChB,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAA0B,wBAAA,EAAE,CAAC;AACxF,iBAAA,CAAA;8BAyB0C,KAAK,EAAA,CAAA;sBAA3C,KAAK;uBAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;gBAKG,QAAQ,EAAA,CAAA;sBAA/C,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;gBAOlC,QAAQ,EAAA,CAAA;sBADX,WAAW;uBAAC,eAAe,CAAA;gBA0B5B,SAAS,EAAA,CAAA;sBADR,YAAY;uBAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAA;;;ACpFvC;;AAEG;;;;"}
1
+ {"version":3,"file":"radix-ng-primitives-roving-focus.mjs","sources":["../../../packages/primitives/roving-focus/src/roving-focus-group.token.ts","../../../packages/primitives/roving-focus/src/roving-focus-group.directive.ts","../../../packages/primitives/roving-focus/src/roving-focus-item.token.ts","../../../packages/primitives/roving-focus/src/roving-focus-item.directive.ts","../../../packages/primitives/roving-focus/radix-ng-primitives-roving-focus.ts"],"sourcesContent":["import { inject, InjectionToken } from '@angular/core';\n\nimport type { RovingFocusGroupDirective } from './roving-focus-group.directive';\n\nexport const RovingFocusGroupToken = new InjectionToken<RovingFocusGroupDirective>(\n 'RovingFocusToken'\n);\n\n/**\n * Inject the roving focus directive instance.\n */\nexport function injectRovingFocusGroup(): RovingFocusGroupDirective {\n return inject(RovingFocusGroupToken);\n}\n","import { FocusKeyManager } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport {\n booleanAttribute,\n DestroyRef,\n Directive,\n inject,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n QueryList,\n SimpleChanges\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { filter } from 'rxjs';\n\nimport { RovingFocusGroupToken } from './roving-focus-group.token';\nimport type { RovingFocusItemDirective } from './roving-focus-item.directive';\n\n@Directive({\n selector: '[rdxRovingFocusGroup]',\n standalone: true,\n providers: [{ provide: RovingFocusGroupToken, useExisting: RovingFocusGroupDirective }]\n})\nexport class RovingFocusGroupDirective implements OnInit, OnChanges, OnDestroy {\n private readonly directionality = inject(Directionality);\n\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * Create a query list of all the roving focus items.\n * We don't use ContentChildren as dynamically added items may not be in the correct order.\n */\n private readonly items = new QueryList<RovingFocusItemDirective>();\n\n /**\n * Create the focus key manager instance.\n * @internal\n */\n readonly keyManager = new FocusKeyManager<RovingFocusItemDirective>(this.items);\n\n /**\n * Determine the orientation of the roving focus group.\n * @default vertical\n */\n @Input() orientation: 'horizontal' | 'vertical' = 'vertical';\n\n /**\n * Determine if focus should wrap when the end or beginning is reached.\n * @default true\n */\n @Input({ transform: booleanAttribute }) wrap = true;\n\n ngOnInit(): void {\n this.keyManager.withWrap(this.wrap);\n\n this.setOrientation(this.orientation);\n\n // update the key manager orientation if the document direction changes\n this.directionality.change\n .pipe(\n filter(() => this.orientation === 'horizontal'),\n takeUntilDestroyed(this.destroyRef)\n )\n .subscribe((direction) => this.keyManager.withHorizontalOrientation(direction));\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if ('orientation' in changes) {\n this.setOrientation(this.orientation);\n }\n\n if ('wrap' in changes) {\n this.keyManager.withWrap(this.wrap);\n }\n }\n\n ngOnDestroy(): void {\n this.keyManager.destroy();\n }\n\n /**\n * Register a roving focus item.\n * @param item The roving focus item to register.\n */\n register(item: RovingFocusItemDirective): void {\n // add the item to the query list by sort the items based on their order\n this.items.reset([...this.items.toArray(), item].sort((a, b) => a.order - b.order));\n\n // if this is the first item, make it the active item\n if (this.items.length === 1) {\n this.keyManager.updateActiveItem(item);\n }\n }\n\n /**\n * Unregister a roving focus item.\n * @param item The roving focus item to unregister.\n */\n unregister(item: RovingFocusItemDirective): void {\n // determine if the item being removed is the active item\n const isActive = this.keyManager.activeItem === item;\n\n // remove the item from the query list\n this.items.reset(this.items.toArray().filter((i) => i !== item));\n\n // if the item being removed is the active item, make the first item the active item\n if (isActive) {\n this.keyManager.updateActiveItem(0);\n }\n }\n\n /**\n * Handle key events on the roving focus items.\n * @param event The key event.\n * @internal\n */\n onKeydown(event: KeyboardEvent): void {\n this.keyManager.onKeydown(event);\n }\n\n /**\n * Set the orientation of the roving focus group.\n * @param orientation The orientation of the roving focus group.\n */\n setOrientation(orientation: 'horizontal' | 'vertical'): void {\n this.orientation = orientation;\n\n if (orientation === 'horizontal') {\n this.keyManager.withHorizontalOrientation(this.directionality.value);\n } else {\n this.keyManager.withVerticalOrientation();\n }\n }\n}\n","import { inject, InjectionToken } from '@angular/core';\n\nimport type { RovingFocusItemDirective } from './roving-focus-item.directive';\n\nexport const RovingFocusItemToken = new InjectionToken<RovingFocusItemDirective>(\n 'RovingFocusItemToken'\n);\n\nexport function injectRovingFocusItem(): RovingFocusItemDirective {\n return inject(RovingFocusItemToken);\n}\n","import { FocusableOption } from '@angular/cdk/a11y';\nimport {\n booleanAttribute,\n ChangeDetectorRef,\n DestroyRef,\n Directive,\n ElementRef,\n HostBinding,\n HostListener,\n inject,\n Input,\n numberAttribute,\n OnDestroy,\n OnInit\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { injectRovingFocusGroup } from './roving-focus-group.token';\nimport { RovingFocusItemToken } from './roving-focus-item.token';\n\n@Directive({\n selector: '[rdxRovingFocusItem]',\n standalone: true,\n providers: [{ provide: RovingFocusItemToken, useExisting: RovingFocusItemDirective }]\n})\nexport class RovingFocusItemDirective implements OnInit, OnDestroy, FocusableOption {\n /**\n * Access the group the roving focus item belongs to.\n */\n private readonly group = injectRovingFocusGroup();\n\n /**\n * Access the element reference of the roving focus item.\n */\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the destroyRef\n */\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * Access the change detector ref\n */\n private readonly changeDetectorRef = inject(ChangeDetectorRef);\n\n /**\n * Define the order of the roving focus item in the group.\n */\n @Input({ transform: numberAttribute }) order = 0;\n\n /**\n * Define if the item is disabled.\n */\n @Input({ transform: booleanAttribute }) disabled = false;\n\n /**\n * Derive the tabindex of the roving focus item.\n * @internal\n */\n @HostBinding('attr.tabindex')\n get tabindex(): number {\n return this.group.keyManager.activeItem === this ? 0 : -1;\n }\n\n ngOnInit(): void {\n // register the roving focus item with the group\n this.group.register(this);\n\n // listen for changes to the active item and run change detection\n this.group.keyManager.change\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.changeDetectorRef.markForCheck());\n }\n\n ngOnDestroy(): void {\n // unregister the roving focus item with the group\n this.group.unregister(this);\n }\n\n /**\n * Handle key events on the roving focus item.\n * @param event The key event.\n * @internal\n */\n @HostListener('keydown', ['$event'])\n onKeydown(event: KeyboardEvent): void {\n this.group.onKeydown(event);\n }\n\n /**\n * Focus the roving focus item.\n * @param origin The origin of the focus request.\n * @internal\n */\n focus(): void {\n this.elementRef?.nativeElement.focus();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAIa,qBAAqB,GAAG,IAAI,cAAc,CACnD,kBAAkB,EACpB;AAEF;;AAEG;SACa,sBAAsB,GAAA;AAClC,IAAA,OAAO,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACzC;;MCYa,yBAAyB,CAAA;AALtC,IAAA,WAAA,GAAA;AAMqB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAExC,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAEjD;;;AAGG;AACc,QAAA,IAAA,CAAA,KAAK,GAAG,IAAI,SAAS,EAA4B,CAAC;AAEnE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EAAA,EAAA,KAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,eAAe,CAKf,EAAA,QAAA,EAAA,CAAA,UAAA,EAAA,UAAA,EAAA,gBAAgB,2HA/BzB,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAE5E,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBALpC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,UAAU,EAAE,IAAI;oBAChB,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAA0B,wBAAA,EAAE,CAAC;AACxF,iBAAA,CAAA;8BAyB0C,KAAK,EAAA,CAAA;sBAA3C,KAAK;uBAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;gBAKG,QAAQ,EAAA,CAAA;sBAA/C,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;gBAOlC,QAAQ,EAAA,CAAA;sBADX,WAAW;uBAAC,eAAe,CAAA;gBA0B5B,SAAS,EAAA,CAAA;sBADR,YAAY;uBAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAA;;;ACrFvC;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-separator.mjs","sources":["../../../packages/primitives/separator/src/separator.directive.ts","../../../packages/primitives/separator/radix-ng-primitives-separator.ts"],"sourcesContent":["import { Directive, Input, booleanAttribute } from '@angular/core';\n\n@Directive({\n selector: '[rdxSeparator]',\n standalone: true,\n host: {\n '[attr.role]': 'decorative ? \"none\" : \"separator\"',\n '[attr.aria-orientation]': '!decorative && orientation === \"vertical\" ? \"vertical\" : null',\n '[attr.data-orientation]': 'orientation'\n }\n})\nexport class SeparatorDirective {\n /**\n * The orientation of the separator.\n * @default 'horizontal'\n */\n @Input('rdxSeparatorOrientation') orientation: 'horizontal' | 'vertical' = 'horizontal';\n\n /**\n * Whether the separator is for decoration purposes. If true, the separator will not be included in the accessibility tree.\n * @default false\n */\n @Input({ alias: 'rdxSeparatorDecorative', transform: booleanAttribute }) decorative = false;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAWa,kBAAkB,CAAA;AAT/B,IAAA,WAAA,GAAA;AAUI;;;AAGG;QAC+B,IAAW,CAAA,WAAA,GAA8B,YAAY,CAAC;AAExF;;;AAGG;QACsE,IAAU,CAAA,UAAA,GAAG,KAAK,CAAC;AAC/F,KAAA;8GAZY,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAAlB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,kBAAkB,0KAW0B,gBAAgB,CAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,WAAA,EAAA,uCAAA,EAAA,uBAAA,EAAA,mEAAA,EAAA,uBAAA,EAAA,aAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAX5D,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAT9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,aAAa,EAAE,mCAAmC;AAClD,wBAAA,yBAAyB,EAAE,+DAA+D;AAC1F,wBAAA,yBAAyB,EAAE,aAAa;AAC3C,qBAAA;AACJ,iBAAA,CAAA;8BAMqC,WAAW,EAAA,CAAA;sBAA5C,KAAK;uBAAC,yBAAyB,CAAA;gBAMyC,UAAU,EAAA,CAAA;sBAAlF,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA,EAAE,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;;;ACtB3E;;AAEG;;;;"}
1
+ {"version":3,"file":"radix-ng-primitives-separator.mjs","sources":["../../../packages/primitives/separator/src/separator.directive.ts","../../../packages/primitives/separator/radix-ng-primitives-separator.ts"],"sourcesContent":["import { booleanAttribute, Directive, Input } from '@angular/core';\n\n@Directive({\n selector: '[rdxSeparator]',\n standalone: true,\n host: {\n '[attr.role]': 'decorative ? \"none\" : \"separator\"',\n '[attr.aria-orientation]': '!decorative && orientation === \"vertical\" ? \"vertical\" : null',\n '[attr.data-orientation]': 'orientation'\n }\n})\nexport class SeparatorDirective {\n /**\n * The orientation of the separator.\n * @default 'horizontal'\n */\n @Input('rdxSeparatorOrientation') orientation: 'horizontal' | 'vertical' = 'horizontal';\n\n /**\n * Whether the separator is for decoration purposes. If true, the separator will not be included in the accessibility tree.\n * @default false\n */\n @Input({ alias: 'rdxSeparatorDecorative', transform: booleanAttribute }) decorative = false;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAWa,kBAAkB,CAAA;AAT/B,IAAA,WAAA,GAAA;AAUI;;;AAGG;QAC+B,IAAW,CAAA,WAAA,GAA8B,YAAY,CAAC;AAExF;;;AAGG;QACsE,IAAU,CAAA,UAAA,GAAG,KAAK,CAAC;AAC/F,KAAA;8GAZY,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAAlB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,kBAAkB,0KAW0B,gBAAgB,CAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,WAAA,EAAA,uCAAA,EAAA,uBAAA,EAAA,mEAAA,EAAA,uBAAA,EAAA,aAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAX5D,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAT9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,aAAa,EAAE,mCAAmC;AAClD,wBAAA,yBAAyB,EAAE,+DAA+D;AAC1F,wBAAA,yBAAyB,EAAE,aAAa;AAC3C,qBAAA;AACJ,iBAAA,CAAA;8BAMqC,WAAW,EAAA,CAAA;sBAA5C,KAAK;uBAAC,yBAAyB,CAAA;gBAMyC,UAAU,EAAA,CAAA;sBAAlF,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA,EAAE,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;;;ACtB3E;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, ElementRef, EventEmitter, booleanAttribute, Directive, Input, Output, HostListener } from '@angular/core';
2
+ import { InjectionToken, inject, Directive, ElementRef, EventEmitter, booleanAttribute, Input, Output, HostListener } from '@angular/core';
3
3
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
4
 
5
5
  const SwitchToken = new InjectionToken('SwitchToken');
@@ -7,6 +7,28 @@ function injectSwitch() {
7
7
  return inject(SwitchToken);
8
8
  }
9
9
 
10
+ class SwitchThumbDirective {
11
+ constructor() {
12
+ /**
13
+ * Access the switch directive.
14
+ */
15
+ this.switch = injectSwitch();
16
+ }
17
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SwitchThumbDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
18
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.3", type: SwitchThumbDirective, isStandalone: true, selector: "[rdxSwitchThumb]", host: { properties: { "attr.data-state": "switch.checked ? \"checked\" : \"unchecked\"", "attr.data-disabled": "switch.disabled ? \"true\" : null" } }, ngImport: i0 }); }
19
+ }
20
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SwitchThumbDirective, decorators: [{
21
+ type: Directive,
22
+ args: [{
23
+ selector: '[rdxSwitchThumb]',
24
+ standalone: true,
25
+ host: {
26
+ '[attr.data-state]': 'switch.checked ? "checked" : "unchecked"',
27
+ '[attr.data-disabled]': 'switch.disabled ? "true" : null'
28
+ }
29
+ }]
30
+ }] });
31
+
10
32
  class SwitchDirective {
11
33
  constructor() {
12
34
  /**
@@ -128,28 +150,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
128
150
  args: ['keydown.space']
129
151
  }] } });
130
152
 
131
- class SwitchThumbDirective {
132
- constructor() {
133
- /**
134
- * Access the switch directive.
135
- */
136
- this.switch = injectSwitch();
137
- }
138
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SwitchThumbDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
139
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.3", type: SwitchThumbDirective, isStandalone: true, selector: "[rdxSwitchThumb]", host: { properties: { "attr.data-state": "switch.checked ? \"checked\" : \"unchecked\"", "attr.data-disabled": "switch.disabled ? \"true\" : null" } }, ngImport: i0 }); }
140
- }
141
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SwitchThumbDirective, decorators: [{
142
- type: Directive,
143
- args: [{
144
- selector: '[rdxSwitchThumb]',
145
- standalone: true,
146
- host: {
147
- '[attr.data-state]': 'switch.checked ? "checked" : "unchecked"',
148
- '[attr.data-disabled]': 'switch.disabled ? "true" : null'
149
- }
150
- }]
151
- }] });
152
-
153
153
  /**
154
154
  * Generated bundle index. Do not edit.
155
155
  */
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-switch.mjs","sources":["../../../packages/primitives/switch/src/switch.token.ts","../../../packages/primitives/switch/src/switch.directive.ts","../../../packages/primitives/switch/src/switch-thumb.directive.ts","../../../packages/primitives/switch/radix-ng-primitives-switch.ts"],"sourcesContent":["import { InjectionToken, inject } from '@angular/core';\nimport type { SwitchDirective } from './switch.directive';\n\nexport const SwitchToken = new InjectionToken<SwitchDirective>('SwitchToken');\n\nexport function injectSwitch(): SwitchDirective {\n return inject(SwitchToken);\n}\n","import {\n Directive,\n ElementRef,\n EventEmitter,\n HostListener,\n Input,\n Output,\n booleanAttribute,\n inject\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { SwitchToken } from './switch.token';\n\n@Directive({\n selector: '[rdxSwitch]',\n standalone: true,\n providers: [\n { provide: SwitchToken, useExisting: SwitchDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: SwitchDirective, multi: true }\n ],\n host: {\n role: 'switch',\n '[attr.type]': 'isButton ? \"button\" : null',\n '[attr.aria-checked]': 'checked',\n '[attr.data-state]': 'checked ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'disabled ? \"true\" : null',\n '[attr.disabled]': 'isButton && disabled ? disabled : null',\n '(focus)': 'onTouched?.()'\n }\n})\nexport class SwitchDirective implements ControlValueAccessor {\n /**\n * Access the element ref.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Determine if the switch is a button\n */\n protected isButton = this.elementRef.nativeElement.tagName === 'BUTTON';\n\n /**\n * Determine if the switch is checked.\n * The controlled state of the switch.\n * @default false\n */\n @Input({ transform: booleanAttribute }) checked = false;\n\n /**\n * Determine if the switch is disabled.\n * When true, prevents the user from interacting with the switch.\n * @default false\n */\n @Input({ transform: booleanAttribute }) disabled = false;\n\n /**\n * Event emitted when the checked state changes.\n */\n @Output() readonly checkedChange = new EventEmitter<boolean>();\n\n /**\n * Store the onChange callback.\n */\n private onChange?: (checked: boolean) => void;\n\n /**\n * Store the onTouched callback.\n */\n protected onTouched?: () => void;\n\n /**\n * Register the onChange callback.\n * @param fn The onChange callback.\n * @internal\n */\n registerOnChange(fn: (checked: boolean) => void): void {\n this.onChange = fn;\n }\n\n /**\n * Register the onTouched callback.\n * @param fn The onTouched callback.\n * @internal\n */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Write the value to the checked state.\n * @param checked The checked state.\n * @internal\n */\n writeValue(checked: boolean): void {\n this.checked = checked;\n }\n\n /**\n * Set the disabled state.\n * @param isDisabled The disabled state.\n * @internal\n */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n /**\n * Toggle the checked state.\n */\n @HostListener('click')\n toggle(): void {\n if (this.disabled) {\n return;\n }\n\n this.checked = !this.checked;\n this.checkedChange.emit(this.checked);\n this.onChange?.(this.checked);\n }\n\n /**\n * Handle the keydown event.\n */\n @HostListener('keydown.space')\n protected onKeyDown(): void {\n // If the switch is not a button then the space key will not toggle the checked state automatically,\n // so we need to do it manually.\n if (!this.isButton) {\n this.toggle();\n }\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectSwitch } from './switch.token';\n\n@Directive({\n selector: '[rdxSwitchThumb]',\n standalone: true,\n host: {\n '[attr.data-state]': 'switch.checked ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'switch.disabled ? \"true\" : null'\n }\n})\nexport class SwitchThumbDirective {\n /**\n * Access the switch directive.\n */\n protected readonly switch = injectSwitch();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAGa,WAAW,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AAA,QAAA,EAAA,kBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,8CAAA,EAAA,oBAAA,EAAA,mCAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBARhC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,mBAAmB,EAAE,0CAA0C;AAC/D,wBAAA,sBAAsB,EAAE,iCAAiC;AAC5D,qBAAA;AACJ,iBAAA,CAAA;;;ACVD;;AAEG;;;;"}
1
+ {"version":3,"file":"radix-ng-primitives-switch.mjs","sources":["../../../packages/primitives/switch/src/switch.token.ts","../../../packages/primitives/switch/src/switch-thumb.directive.ts","../../../packages/primitives/switch/src/switch.directive.ts","../../../packages/primitives/switch/radix-ng-primitives-switch.ts"],"sourcesContent":["import { inject, InjectionToken } from '@angular/core';\n\nimport type { SwitchDirective } from './switch.directive';\n\nexport const SwitchToken = new InjectionToken<SwitchDirective>('SwitchToken');\n\nexport function injectSwitch(): SwitchDirective {\n return inject(SwitchToken);\n}\n","import { Directive } from '@angular/core';\n\nimport { injectSwitch } from './switch.token';\n\n@Directive({\n selector: '[rdxSwitchThumb]',\n standalone: true,\n host: {\n '[attr.data-state]': 'switch.checked ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'switch.disabled ? \"true\" : null'\n }\n})\nexport class SwitchThumbDirective {\n /**\n * Access the switch directive.\n */\n protected readonly switch = injectSwitch();\n}\n","import {\n booleanAttribute,\n Directive,\n ElementRef,\n EventEmitter,\n HostListener,\n inject,\n Input,\n Output\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nimport { SwitchToken } from './switch.token';\n\n@Directive({\n selector: '[rdxSwitch]',\n standalone: true,\n providers: [\n { provide: SwitchToken, useExisting: SwitchDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: SwitchDirective, multi: true }\n ],\n host: {\n role: 'switch',\n '[attr.type]': 'isButton ? \"button\" : null',\n '[attr.aria-checked]': 'checked',\n '[attr.data-state]': 'checked ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'disabled ? \"true\" : null',\n '[attr.disabled]': 'isButton && disabled ? disabled : null',\n '(focus)': 'onTouched?.()'\n }\n})\nexport class SwitchDirective implements ControlValueAccessor {\n /**\n * Access the element ref.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Determine if the switch is a button\n */\n protected isButton = this.elementRef.nativeElement.tagName === 'BUTTON';\n\n /**\n * Determine if the switch is checked.\n * The controlled state of the switch.\n * @default false\n */\n @Input({ transform: booleanAttribute }) checked = false;\n\n /**\n * Determine if the switch is disabled.\n * When true, prevents the user from interacting with the switch.\n * @default false\n */\n @Input({ transform: booleanAttribute }) disabled = false;\n\n /**\n * Event emitted when the checked state changes.\n */\n @Output() readonly checkedChange = new EventEmitter<boolean>();\n\n /**\n * Store the onChange callback.\n */\n private onChange?: (checked: boolean) => void;\n\n /**\n * Store the onTouched callback.\n */\n protected onTouched?: () => void;\n\n /**\n * Register the onChange callback.\n * @param fn The onChange callback.\n * @internal\n */\n registerOnChange(fn: (checked: boolean) => void): void {\n this.onChange = fn;\n }\n\n /**\n * Register the onTouched callback.\n * @param fn The onTouched callback.\n * @internal\n */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Write the value to the checked state.\n * @param checked The checked state.\n * @internal\n */\n writeValue(checked: boolean): void {\n this.checked = checked;\n }\n\n /**\n * Set the disabled state.\n * @param isDisabled The disabled state.\n * @internal\n */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n /**\n * Toggle the checked state.\n */\n @HostListener('click')\n toggle(): void {\n if (this.disabled) {\n return;\n }\n\n this.checked = !this.checked;\n this.checkedChange.emit(this.checked);\n this.onChange?.(this.checked);\n }\n\n /**\n * Handle the keydown event.\n */\n @HostListener('keydown.space')\n protected onKeyDown(): void {\n // If the switch is not a button then the space key will not toggle the checked state automatically,\n // so we need to do it manually.\n if (!this.isButton) {\n this.toggle();\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAIa,WAAW,GAAG,IAAI,cAAc,CAAkB,aAAa,EAAE;SAE9D,YAAY,GAAA;AACxB,IAAA,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC;AAC/B;;MCIa,oBAAoB,CAAA;AARjC,IAAA,WAAA,GAAA;AASI;;AAEG;QACgB,IAAM,CAAA,MAAA,GAAG,YAAY,EAAE,CAAC;AAC9C,KAAA;8GALY,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;kGAApB,oBAAoB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,8CAAA,EAAA,oBAAA,EAAA,mCAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBARhC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,mBAAmB,EAAE,0CAA0C;AAC/D,wBAAA,sBAAsB,EAAE,iCAAiC;AAC5D,qBAAA;AACJ,iBAAA,CAAA;;;MCoBY,eAAe,CAAA;AAjB5B,IAAA,WAAA,GAAA;AAkBI;;AAEG;AACc,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAA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