@radix-ng/primitives 1.0.4 → 1.0.6

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 (126) hide show
  1. package/fesm2022/radix-ng-primitives-accordion.mjs +35 -27
  2. package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
  3. package/fesm2022/radix-ng-primitives-alert-dialog.mjs +34 -34
  4. package/fesm2022/radix-ng-primitives-arrow.mjs +3 -3
  5. package/fesm2022/radix-ng-primitives-aspect-ratio.mjs +5 -4
  6. package/fesm2022/radix-ng-primitives-aspect-ratio.mjs.map +1 -1
  7. package/fesm2022/radix-ng-primitives-autocomplete.mjs +175 -125
  8. package/fesm2022/radix-ng-primitives-autocomplete.mjs.map +1 -1
  9. package/fesm2022/radix-ng-primitives-avatar.mjs +25 -19
  10. package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
  11. package/fesm2022/radix-ng-primitives-button.mjs +11 -7
  12. package/fesm2022/radix-ng-primitives-button.mjs.map +1 -1
  13. package/fesm2022/radix-ng-primitives-calendar.mjs +140 -90
  14. package/fesm2022/radix-ng-primitives-calendar.mjs.map +1 -1
  15. package/fesm2022/radix-ng-primitives-checkbox.mjs +61 -40
  16. package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
  17. package/fesm2022/radix-ng-primitives-collapsible.mjs +35 -24
  18. package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
  19. package/fesm2022/radix-ng-primitives-combobox.mjs +278 -177
  20. package/fesm2022/radix-ng-primitives-combobox.mjs.map +1 -1
  21. package/fesm2022/radix-ng-primitives-composite.mjs +76 -35
  22. package/fesm2022/radix-ng-primitives-composite.mjs.map +1 -1
  23. package/fesm2022/radix-ng-primitives-config.mjs +7 -5
  24. package/fesm2022/radix-ng-primitives-config.mjs.map +1 -1
  25. package/fesm2022/radix-ng-primitives-context-menu.mjs +48 -22
  26. package/fesm2022/radix-ng-primitives-context-menu.mjs.map +1 -1
  27. package/fesm2022/radix-ng-primitives-core.mjs +44 -28
  28. package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
  29. package/fesm2022/radix-ng-primitives-cropper.mjs +73 -45
  30. package/fesm2022/radix-ng-primitives-cropper.mjs.map +1 -1
  31. package/fesm2022/radix-ng-primitives-date-field.mjs +70 -40
  32. package/fesm2022/radix-ng-primitives-date-field.mjs.map +1 -1
  33. package/fesm2022/radix-ng-primitives-dialog.mjs +93 -67
  34. package/fesm2022/radix-ng-primitives-dialog.mjs.map +1 -1
  35. package/fesm2022/radix-ng-primitives-direction-provider.mjs +5 -4
  36. package/fesm2022/radix-ng-primitives-direction-provider.mjs.map +1 -1
  37. package/fesm2022/radix-ng-primitives-dismissable-layer.mjs +20 -16
  38. package/fesm2022/radix-ng-primitives-dismissable-layer.mjs.map +1 -1
  39. package/fesm2022/radix-ng-primitives-drawer.mjs +107 -81
  40. package/fesm2022/radix-ng-primitives-drawer.mjs.map +1 -1
  41. package/fesm2022/radix-ng-primitives-editable.mjs +53 -39
  42. package/fesm2022/radix-ng-primitives-editable.mjs.map +1 -1
  43. package/fesm2022/radix-ng-primitives-field.mjs +69 -42
  44. package/fesm2022/radix-ng-primitives-field.mjs.map +1 -1
  45. package/fesm2022/radix-ng-primitives-fieldset.mjs +8 -7
  46. package/fesm2022/radix-ng-primitives-fieldset.mjs.map +1 -1
  47. package/fesm2022/radix-ng-primitives-floating-focus-manager.mjs +77 -40
  48. package/fesm2022/radix-ng-primitives-floating-focus-manager.mjs.map +1 -1
  49. package/fesm2022/radix-ng-primitives-focus-guards.mjs +3 -3
  50. package/fesm2022/radix-ng-primitives-focus-scope.mjs +7 -5
  51. package/fesm2022/radix-ng-primitives-focus-scope.mjs.map +1 -1
  52. package/fesm2022/radix-ng-primitives-form.mjs +25 -16
  53. package/fesm2022/radix-ng-primitives-form.mjs.map +1 -1
  54. package/fesm2022/radix-ng-primitives-input.mjs +41 -22
  55. package/fesm2022/radix-ng-primitives-input.mjs.map +1 -1
  56. package/fesm2022/radix-ng-primitives-label.mjs +7 -5
  57. package/fesm2022/radix-ng-primitives-label.mjs.map +1 -1
  58. package/fesm2022/radix-ng-primitives-menu.mjs +274 -154
  59. package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
  60. package/fesm2022/radix-ng-primitives-menubar.mjs +35 -17
  61. package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
  62. package/fesm2022/radix-ng-primitives-meter.mjs +41 -30
  63. package/fesm2022/radix-ng-primitives-meter.mjs.map +1 -1
  64. package/fesm2022/radix-ng-primitives-navigation-menu.mjs +220 -183
  65. package/fesm2022/radix-ng-primitives-navigation-menu.mjs.map +1 -1
  66. package/fesm2022/radix-ng-primitives-number-field.mjs +87 -59
  67. package/fesm2022/radix-ng-primitives-number-field.mjs.map +1 -1
  68. package/fesm2022/radix-ng-primitives-pagination.mjs +48 -38
  69. package/fesm2022/radix-ng-primitives-pagination.mjs.map +1 -1
  70. package/fesm2022/radix-ng-primitives-popover.mjs +150 -107
  71. package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
  72. package/fesm2022/radix-ng-primitives-popper.mjs +79 -47
  73. package/fesm2022/radix-ng-primitives-popper.mjs.map +1 -1
  74. package/fesm2022/radix-ng-primitives-portal.mjs +20 -13
  75. package/fesm2022/radix-ng-primitives-portal.mjs.map +1 -1
  76. package/fesm2022/radix-ng-primitives-presence.mjs +3 -3
  77. package/fesm2022/radix-ng-primitives-preview-card.mjs +119 -74
  78. package/fesm2022/radix-ng-primitives-preview-card.mjs.map +1 -1
  79. package/fesm2022/radix-ng-primitives-progress.mjs +43 -31
  80. package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
  81. package/fesm2022/radix-ng-primitives-radio.mjs +177 -168
  82. package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
  83. package/fesm2022/radix-ng-primitives-scroll-area.mjs +54 -38
  84. package/fesm2022/radix-ng-primitives-scroll-area.mjs.map +1 -1
  85. package/fesm2022/radix-ng-primitives-select.mjs +595 -102
  86. package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
  87. package/fesm2022/radix-ng-primitives-separator.mjs +7 -5
  88. package/fesm2022/radix-ng-primitives-separator.mjs.map +1 -1
  89. package/fesm2022/radix-ng-primitives-slider.mjs +101 -63
  90. package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
  91. package/fesm2022/radix-ng-primitives-stepper.mjs +53 -39
  92. package/fesm2022/radix-ng-primitives-stepper.mjs.map +1 -1
  93. package/fesm2022/radix-ng-primitives-switch.mjs +44 -25
  94. package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
  95. package/fesm2022/radix-ng-primitives-tabs.mjs +72 -47
  96. package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
  97. package/fesm2022/radix-ng-primitives-time-field.mjs +72 -41
  98. package/fesm2022/radix-ng-primitives-time-field.mjs.map +1 -1
  99. package/fesm2022/radix-ng-primitives-toast.mjs +75 -56
  100. package/fesm2022/radix-ng-primitives-toast.mjs.map +1 -1
  101. package/fesm2022/radix-ng-primitives-toggle-group.mjs +29 -19
  102. package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
  103. package/fesm2022/radix-ng-primitives-toggle.mjs +16 -11
  104. package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
  105. package/fesm2022/radix-ng-primitives-toolbar.mjs +38 -30
  106. package/fesm2022/radix-ng-primitives-toolbar.mjs.map +1 -1
  107. package/fesm2022/radix-ng-primitives-tooltip.mjs +118 -63
  108. package/fesm2022/radix-ng-primitives-tooltip.mjs.map +1 -1
  109. package/fesm2022/radix-ng-primitives-visually-hidden.mjs +31 -20
  110. package/fesm2022/radix-ng-primitives-visually-hidden.mjs.map +1 -1
  111. package/package.json +2 -2
  112. package/types/radix-ng-primitives-autocomplete.d.ts +3 -1
  113. package/types/radix-ng-primitives-combobox.d.ts +28 -9
  114. package/types/radix-ng-primitives-composite.d.ts +2 -0
  115. package/types/radix-ng-primitives-context-menu.d.ts +2 -0
  116. package/types/radix-ng-primitives-dialog.d.ts +6 -3
  117. package/types/radix-ng-primitives-floating-focus-manager.d.ts +11 -0
  118. package/types/radix-ng-primitives-menu.d.ts +47 -15
  119. package/types/radix-ng-primitives-menubar.d.ts +6 -1
  120. package/types/radix-ng-primitives-navigation-menu.d.ts +8 -6
  121. package/types/radix-ng-primitives-popover.d.ts +12 -4
  122. package/types/radix-ng-primitives-preview-card.d.ts +18 -5
  123. package/types/radix-ng-primitives-radio.d.ts +100 -65
  124. package/types/radix-ng-primitives-select.d.ts +186 -391
  125. package/types/radix-ng-primitives-switch.d.ts +3 -2
  126. package/types/radix-ng-primitives-tooltip.d.ts +17 -3
@@ -37,8 +37,10 @@ class RdxAvatarFallbackDirective {
37
37
  * @group Props
38
38
  * @defaultValue 0
39
39
  */
40
- this.delayMs = input(this.config.delayMs, ...(ngDevMode ? [{ debugName: "delayMs" }] : /* istanbul ignore next */ []));
41
- this.canRender = signal(false, ...(ngDevMode ? [{ debugName: "canRender" }] : /* istanbul ignore next */ []));
40
+ this.delayMs = input(this.config.delayMs, /* @ts-ignore */
41
+ ...(ngDevMode ? [{ debugName: "delayMs" }] : /* istanbul ignore next */ []));
42
+ this.canRender = signal(false, /* @ts-ignore */
43
+ ...(ngDevMode ? [{ debugName: "canRender" }] : /* istanbul ignore next */ []));
42
44
  // Enable the fallback after an optional delay (so it only appears for
43
45
  // those on slower connections), independent of the image load status —
44
46
  // matches Radix/Base UI. The `display` binding then hides it once the
@@ -56,10 +58,10 @@ class RdxAvatarFallbackDirective {
56
58
  }
57
59
  });
58
60
  }
59
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxAvatarFallbackDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
60
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxAvatarFallbackDirective, isStandalone: true, selector: "span[rdxAvatarFallback]", inputs: { delayMs: { classPropertyName: "delayMs", publicName: "delayMs", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.display": "canRender() && rootContext.imageLoadingStatus() !== \"loaded\" ? null : \"none\"" } }, exportAs: ["rdxAvatarFallback"], ngImport: i0 }); }
61
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAvatarFallbackDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
62
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: RdxAvatarFallbackDirective, isStandalone: true, selector: "span[rdxAvatarFallback]", inputs: { delayMs: { classPropertyName: "delayMs", publicName: "delayMs", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.display": "canRender() && rootContext.imageLoadingStatus() !== \"loaded\" ? null : \"none\"" } }, exportAs: ["rdxAvatarFallback"], ngImport: i0 }); }
61
63
  }
62
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxAvatarFallbackDirective, decorators: [{
64
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAvatarFallbackDirective, decorators: [{
63
65
  type: Directive,
64
66
  args: [{
65
67
  selector: 'span[rdxAvatarFallback]',
@@ -80,8 +82,10 @@ class RdxAvatarImageDirective {
80
82
  /**
81
83
  * @group Props
82
84
  */
83
- this.src = input(...(ngDevMode ? [undefined, { debugName: "src" }] : /* istanbul ignore next */ []));
84
- this.referrerPolicy = input(...(ngDevMode ? [undefined, { debugName: "referrerPolicy" }] : /* istanbul ignore next */ []));
85
+ this.src = input(/* @ts-ignore */
86
+ ...(ngDevMode ? [undefined, { debugName: "src" }] : /* istanbul ignore next */ []));
87
+ this.referrerPolicy = input(/* @ts-ignore */
88
+ ...(ngDevMode ? [undefined, { debugName: "referrerPolicy" }] : /* istanbul ignore next */ []));
85
89
  /**
86
90
  * A callback providing information about the loading status of the image.
87
91
  * This is useful in case you want to control more precisely what to render as the image is loading.
@@ -89,7 +93,8 @@ class RdxAvatarImageDirective {
89
93
  * @group Emits
90
94
  */
91
95
  this.onLoadingStatusChange = output();
92
- this.loadingStatus = signal('idle', ...(ngDevMode ? [{ debugName: "loadingStatus" }] : /* istanbul ignore next */ []));
96
+ this.loadingStatus = signal('idle', /* @ts-ignore */
97
+ ...(ngDevMode ? [{ debugName: "loadingStatus" }] : /* istanbul ignore next */ []));
93
98
  // Loading is browser-only; on the server the status stays 'idle'.
94
99
  if (!isPlatformBrowser(this.platformId)) {
95
100
  return;
@@ -122,10 +127,10 @@ class RdxAvatarImageDirective {
122
127
  }
123
128
  });
124
129
  }
125
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxAvatarImageDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
126
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxAvatarImageDirective, isStandalone: true, selector: "img[rdxAvatarImage]", inputs: { src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: false, transformFunction: null }, referrerPolicy: { classPropertyName: "referrerPolicy", publicName: "referrerPolicy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onLoadingStatusChange: "onLoadingStatusChange" }, host: { attributes: { "role": "img" }, properties: { "attr.src": "src()", "attr.referrerpolicy": "referrerPolicy()", "style.display": "(rootContext.imageLoadingStatus() === \"loaded\") ? null : \"none\"" } }, exportAs: ["rdxAvatarImage"], ngImport: i0 }); }
130
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAvatarImageDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
131
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: RdxAvatarImageDirective, isStandalone: true, selector: "img[rdxAvatarImage]", inputs: { src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: false, transformFunction: null }, referrerPolicy: { classPropertyName: "referrerPolicy", publicName: "referrerPolicy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onLoadingStatusChange: "onLoadingStatusChange" }, host: { attributes: { "role": "img" }, properties: { "attr.src": "src()", "attr.referrerpolicy": "referrerPolicy()", "style.display": "(rootContext.imageLoadingStatus() === \"loaded\") ? null : \"none\"" } }, exportAs: ["rdxAvatarImage"], ngImport: i0 }); }
127
132
  }
128
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxAvatarImageDirective, decorators: [{
133
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAvatarImageDirective, decorators: [{
129
134
  type: Directive,
130
135
  args: [{
131
136
  selector: 'img[rdxAvatarImage]',
@@ -141,12 +146,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
141
146
 
142
147
  class RdxAvatarRootDirective {
143
148
  constructor() {
144
- this.imageLoadingStatus = signal('idle', ...(ngDevMode ? [{ debugName: "imageLoadingStatus" }] : /* istanbul ignore next */ []));
149
+ this.imageLoadingStatus = signal('idle', /* @ts-ignore */
150
+ ...(ngDevMode ? [{ debugName: "imageLoadingStatus" }] : /* istanbul ignore next */ []));
145
151
  }
146
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxAvatarRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
147
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxAvatarRootDirective, isStandalone: true, selector: "span[rdxAvatarRoot]", providers: [provideToken(AVATAR_ROOT_CONTEXT, RdxAvatarRootDirective)], exportAs: ["rdxAvatarRoot"], ngImport: i0 }); }
152
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAvatarRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
153
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.2", type: RdxAvatarRootDirective, isStandalone: true, selector: "span[rdxAvatarRoot]", providers: [provideToken(AVATAR_ROOT_CONTEXT, RdxAvatarRootDirective)], exportAs: ["rdxAvatarRoot"], ngImport: i0 }); }
148
154
  }
149
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxAvatarRootDirective, decorators: [{
155
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAvatarRootDirective, decorators: [{
150
156
  type: Directive,
151
157
  args: [{
152
158
  selector: 'span[rdxAvatarRoot]',
@@ -157,11 +163,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
157
163
 
158
164
  const _imports = [RdxAvatarRootDirective, RdxAvatarFallbackDirective, RdxAvatarImageDirective];
159
165
  class RdxAvatarModule {
160
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxAvatarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
161
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: RdxAvatarModule, imports: [RdxAvatarRootDirective, RdxAvatarFallbackDirective, RdxAvatarImageDirective], exports: [RdxAvatarRootDirective, RdxAvatarFallbackDirective, RdxAvatarImageDirective] }); }
162
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxAvatarModule }); }
166
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAvatarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
167
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.2", ngImport: i0, type: RdxAvatarModule, imports: [RdxAvatarRootDirective, RdxAvatarFallbackDirective, RdxAvatarImageDirective], exports: [RdxAvatarRootDirective, RdxAvatarFallbackDirective, RdxAvatarImageDirective] }); }
168
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAvatarModule }); }
163
169
  }
164
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxAvatarModule, decorators: [{
170
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAvatarModule, decorators: [{
165
171
  type: NgModule,
166
172
  args: [{
167
173
  imports: [..._imports],
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-avatar.mjs","sources":["../../../packages/primitives/avatar/src/avatar-context.token.ts","../../../packages/primitives/avatar/src/avatar.config.ts","../../../packages/primitives/avatar/src/avatar-fallback.directive.ts","../../../packages/primitives/avatar/src/avatar-image.directive.ts","../../../packages/primitives/avatar/src/avatar-root.directive.ts","../../../packages/primitives/avatar/index.ts","../../../packages/primitives/avatar/radix-ng-primitives-avatar.ts"],"sourcesContent":["import { inject, InjectionToken, WritableSignal } from '@angular/core';\nimport { RdxImageLoadingStatus } from './types';\n\nexport interface AvatarContextToken {\n imageLoadingStatus: WritableSignal<RdxImageLoadingStatus>;\n}\n\nexport const AVATAR_ROOT_CONTEXT = new InjectionToken<AvatarContextToken>('AVATAR_ROOT_CONTEXT');\n\nexport function injectAvatarRootContext(): AvatarContextToken {\n return inject(AVATAR_ROOT_CONTEXT);\n}\n","import { inject, InjectionToken, Provider } from '@angular/core';\n\nexport interface RdxAvatarConfig {\n /**\n * Define a delay before the fallback is shown.\n * This is useful to only show the fallback for those with slower connections.\n * @default 0\n */\n delayMs: number;\n}\n\nexport const defaultAvatarConfig: RdxAvatarConfig = {\n delayMs: 0\n};\n\nexport const RdxAvatarConfigToken = new InjectionToken<RdxAvatarConfig>('RdxAvatarConfigToken');\n\nexport function provideRdxAvatarConfig(config: Partial<RdxAvatarConfig>): Provider[] {\n return [\n {\n provide: RdxAvatarConfigToken,\n useValue: { ...defaultAvatarConfig, ...config }\n }\n ];\n}\n\nexport function injectAvatarConfig(): RdxAvatarConfig {\n return inject(RdxAvatarConfigToken, { optional: true }) ?? defaultAvatarConfig;\n}\n","import { Directive, input, signal } from '@angular/core';\nimport { watch } from '@radix-ng/primitives/core';\nimport { injectAvatarRootContext } from './avatar-context.token';\nimport { injectAvatarConfig } from './avatar.config';\n\n/**\n * @group Components\n */\n@Directive({\n selector: 'span[rdxAvatarFallback]',\n exportAs: 'rdxAvatarFallback',\n host: {\n '[style.display]': 'canRender() && rootContext.imageLoadingStatus() !== \"loaded\" ? null : \"none\"'\n }\n})\nexport class RdxAvatarFallbackDirective {\n private readonly config = injectAvatarConfig();\n\n protected readonly rootContext = injectAvatarRootContext();\n\n /**\n * Useful for delaying rendering so it only appears for those with slower connections.\n *\n * @group Props\n * @defaultValue 0\n */\n readonly delayMs = input<number>(this.config.delayMs);\n\n protected readonly canRender = signal(false);\n\n constructor() {\n // Enable the fallback after an optional delay (so it only appears for\n // those on slower connections), independent of the image load status —\n // matches Radix/Base UI. The `display` binding then hides it once the\n // image has loaded.\n watch([this.delayMs], ([delayMs], onCleanup) => {\n this.canRender.set(false);\n\n if (delayMs) {\n const timeout = setTimeout(() => this.canRender.set(true), delayMs);\n // Cancel a pending delay if delayMs changes or the directive is\n // destroyed before it fires.\n onCleanup(() => clearTimeout(timeout));\n } else {\n this.canRender.set(true);\n }\n });\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport { Directive, inject, input, output, PLATFORM_ID, signal } from '@angular/core';\nimport { watch } from '@radix-ng/primitives/core';\nimport { injectAvatarRootContext } from './avatar-context.token';\nimport { HTMLAttributeReferrerPolicy, RdxImageLoadingStatus } from './types';\n\n/**\n * @group Components\n */\n@Directive({\n selector: 'img[rdxAvatarImage]',\n exportAs: 'rdxAvatarImage',\n host: {\n role: 'img',\n '[attr.src]': 'src()',\n '[attr.referrerpolicy]': 'referrerPolicy()',\n '[style.display]': '(rootContext.imageLoadingStatus() === \"loaded\") ? null : \"none\"'\n }\n})\nexport class RdxAvatarImageDirective {\n private readonly platformId = inject(PLATFORM_ID);\n\n protected readonly rootContext = injectAvatarRootContext();\n\n /**\n * @group Props\n */\n readonly src = input<string>();\n\n readonly referrerPolicy = input<HTMLAttributeReferrerPolicy>();\n\n /**\n * A callback providing information about the loading status of the image.\n * This is useful in case you want to control more precisely what to render as the image is loading.\n *\n * @group Emits\n */\n readonly onLoadingStatusChange = output<RdxImageLoadingStatus>();\n\n private readonly loadingStatus = signal<RdxImageLoadingStatus>('idle');\n\n constructor() {\n // Loading is browser-only; on the server the status stays 'idle'.\n if (!isPlatformBrowser(this.platformId)) {\n return;\n }\n\n watch([this.src, this.referrerPolicy], ([src, referrer], onCleanup) => {\n if (!src) {\n this.loadingStatus.set('error');\n return;\n }\n\n const image = new window.Image();\n this.loadingStatus.set('loading');\n image.onload = () => this.loadingStatus.set('loaded');\n image.onerror = () => this.loadingStatus.set('error');\n // Set referrerPolicy before src so it applies to the fetch.\n if (referrer) {\n image.referrerPolicy = referrer;\n }\n image.src = src;\n\n // Drop handlers for a stale src (or on destroy) so a late load/error\n // can't overwrite the status for the current one.\n onCleanup(() => {\n image.onload = null;\n image.onerror = null;\n });\n });\n\n watch([this.loadingStatus], ([value]) => {\n this.onLoadingStatusChange.emit(value);\n if (value !== 'idle') {\n this.rootContext.imageLoadingStatus.set(value);\n }\n });\n }\n}\n","import { Directive, signal } from '@angular/core';\nimport { provideToken } from '@radix-ng/primitives/core';\nimport { AVATAR_ROOT_CONTEXT, AvatarContextToken } from './avatar-context.token';\nimport { RdxImageLoadingStatus } from './types';\n\n@Directive({\n selector: 'span[rdxAvatarRoot]',\n exportAs: 'rdxAvatarRoot',\n providers: [provideToken(AVATAR_ROOT_CONTEXT, RdxAvatarRootDirective)]\n})\nexport class RdxAvatarRootDirective implements AvatarContextToken {\n readonly imageLoadingStatus = signal<RdxImageLoadingStatus>('idle');\n}\n","import { NgModule } from '@angular/core';\nimport { RdxAvatarFallbackDirective } from './src/avatar-fallback.directive';\nimport { RdxAvatarImageDirective } from './src/avatar-image.directive';\nimport { RdxAvatarRootDirective } from './src/avatar-root.directive';\n\nexport * from './src/avatar-fallback.directive';\nexport * from './src/avatar-image.directive';\nexport * from './src/avatar-root.directive';\nexport * from './src/avatar.config';\nexport type { RdxImageLoadingStatus } from './src/types';\n\nconst _imports = [RdxAvatarRootDirective, RdxAvatarFallbackDirective, RdxAvatarImageDirective];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxAvatarModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAOO,MAAM,mBAAmB,GAAG,IAAI,cAAc,CAAqB,qBAAqB,CAAC;SAEhF,uBAAuB,GAAA;AACnC,IAAA,OAAO,MAAM,CAAC,mBAAmB,CAAC;AACtC;;ACAO,MAAM,mBAAmB,GAAoB;AAChD,IAAA,OAAO,EAAE;;MAGA,oBAAoB,GAAG,IAAI,cAAc,CAAkB,sBAAsB;AAExF,SAAU,sBAAsB,CAAC,MAAgC,EAAA;IACnE,OAAO;AACH,QAAA;AACI,YAAA,OAAO,EAAE,oBAAoB;AAC7B,YAAA,QAAQ,EAAE,EAAE,GAAG,mBAAmB,EAAE,GAAG,MAAM;AAChD;KACJ;AACL;SAEgB,kBAAkB,GAAA;AAC9B,IAAA,OAAO,MAAM,CAAC,oBAAoB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,mBAAmB;AAClF;;ACvBA;;AAEG;MAQU,0BAA0B,CAAA;AAenC,IAAA,WAAA,GA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CAAA;kBALlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,qBAAqB;AAC/B,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,SAAS,EAAE,CAAC,YAAY,CAAC,mBAAmB,yBAAyB;AACxE,iBAAA;;;ACED,MAAM,QAAQ,GAAG,CAAC,sBAAsB,EAAE,0BAA0B,EAAE,uBAAuB,CAAC;MAMjF,eAAe,CAAA;8GAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAf,eAAe,EAAA,OAAA,EAAA,CANV,sBAAsB,EAAE,0BAA0B,EAAE,uBAAuB,CAAA,EAAA,OAAA,EAAA,CAA3E,sBAAsB,EAAE,0BAA0B,EAAE,uBAAuB,CAAA,EAAA,CAAA,CAAA;+GAMhF,eAAe,EAAA,CAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;AChBD;;AAEG;;;;"}
1
+ {"version":3,"file":"radix-ng-primitives-avatar.mjs","sources":["../../../packages/primitives/avatar/src/avatar-context.token.ts","../../../packages/primitives/avatar/src/avatar.config.ts","../../../packages/primitives/avatar/src/avatar-fallback.directive.ts","../../../packages/primitives/avatar/src/avatar-image.directive.ts","../../../packages/primitives/avatar/src/avatar-root.directive.ts","../../../packages/primitives/avatar/index.ts","../../../packages/primitives/avatar/radix-ng-primitives-avatar.ts"],"sourcesContent":["import { inject, InjectionToken, WritableSignal } from '@angular/core';\nimport { RdxImageLoadingStatus } from './types';\n\nexport interface AvatarContextToken {\n imageLoadingStatus: WritableSignal<RdxImageLoadingStatus>;\n}\n\nexport const AVATAR_ROOT_CONTEXT = new InjectionToken<AvatarContextToken>('AVATAR_ROOT_CONTEXT');\n\nexport function injectAvatarRootContext(): AvatarContextToken {\n return inject(AVATAR_ROOT_CONTEXT);\n}\n","import { inject, InjectionToken, Provider } from '@angular/core';\n\nexport interface RdxAvatarConfig {\n /**\n * Define a delay before the fallback is shown.\n * This is useful to only show the fallback for those with slower connections.\n * @default 0\n */\n delayMs: number;\n}\n\nexport const defaultAvatarConfig: RdxAvatarConfig = {\n delayMs: 0\n};\n\nexport const RdxAvatarConfigToken = new InjectionToken<RdxAvatarConfig>('RdxAvatarConfigToken');\n\nexport function provideRdxAvatarConfig(config: Partial<RdxAvatarConfig>): Provider[] {\n return [\n {\n provide: RdxAvatarConfigToken,\n useValue: { ...defaultAvatarConfig, ...config }\n }\n ];\n}\n\nexport function injectAvatarConfig(): RdxAvatarConfig {\n return inject(RdxAvatarConfigToken, { optional: true }) ?? defaultAvatarConfig;\n}\n","import { Directive, input, signal } from '@angular/core';\nimport { watch } from '@radix-ng/primitives/core';\nimport { injectAvatarRootContext } from './avatar-context.token';\nimport { injectAvatarConfig } from './avatar.config';\n\n/**\n * @group Components\n */\n@Directive({\n selector: 'span[rdxAvatarFallback]',\n exportAs: 'rdxAvatarFallback',\n host: {\n '[style.display]': 'canRender() && rootContext.imageLoadingStatus() !== \"loaded\" ? null : \"none\"'\n }\n})\nexport class RdxAvatarFallbackDirective {\n private readonly config = injectAvatarConfig();\n\n protected readonly rootContext = injectAvatarRootContext();\n\n /**\n * Useful for delaying rendering so it only appears for those with slower connections.\n *\n * @group Props\n * @defaultValue 0\n */\n readonly delayMs = input<number>(this.config.delayMs);\n\n protected readonly canRender = signal(false);\n\n constructor() {\n // Enable the fallback after an optional delay (so it only appears for\n // those on slower connections), independent of the image load status —\n // matches Radix/Base UI. The `display` binding then hides it once the\n // image has loaded.\n watch([this.delayMs], ([delayMs], onCleanup) => {\n this.canRender.set(false);\n\n if (delayMs) {\n const timeout = setTimeout(() => this.canRender.set(true), delayMs);\n // Cancel a pending delay if delayMs changes or the directive is\n // destroyed before it fires.\n onCleanup(() => clearTimeout(timeout));\n } else {\n this.canRender.set(true);\n }\n });\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport { Directive, inject, input, output, PLATFORM_ID, signal } from '@angular/core';\nimport { watch } from '@radix-ng/primitives/core';\nimport { injectAvatarRootContext } from './avatar-context.token';\nimport { HTMLAttributeReferrerPolicy, RdxImageLoadingStatus } from './types';\n\n/**\n * @group Components\n */\n@Directive({\n selector: 'img[rdxAvatarImage]',\n exportAs: 'rdxAvatarImage',\n host: {\n role: 'img',\n '[attr.src]': 'src()',\n '[attr.referrerpolicy]': 'referrerPolicy()',\n '[style.display]': '(rootContext.imageLoadingStatus() === \"loaded\") ? null : \"none\"'\n }\n})\nexport class RdxAvatarImageDirective {\n private readonly platformId = inject(PLATFORM_ID);\n\n protected readonly rootContext = injectAvatarRootContext();\n\n /**\n * @group Props\n */\n readonly src = input<string>();\n\n readonly referrerPolicy = input<HTMLAttributeReferrerPolicy>();\n\n /**\n * A callback providing information about the loading status of the image.\n * This is useful in case you want to control more precisely what to render as the image is loading.\n *\n * @group Emits\n */\n readonly onLoadingStatusChange = output<RdxImageLoadingStatus>();\n\n private readonly loadingStatus = signal<RdxImageLoadingStatus>('idle');\n\n constructor() {\n // Loading is browser-only; on the server the status stays 'idle'.\n if (!isPlatformBrowser(this.platformId)) {\n return;\n }\n\n watch([this.src, this.referrerPolicy], ([src, referrer], onCleanup) => {\n if (!src) {\n this.loadingStatus.set('error');\n return;\n }\n\n const image = new window.Image();\n this.loadingStatus.set('loading');\n image.onload = () => this.loadingStatus.set('loaded');\n image.onerror = () => this.loadingStatus.set('error');\n // Set referrerPolicy before src so it applies to the fetch.\n if (referrer) {\n image.referrerPolicy = referrer;\n }\n image.src = src;\n\n // Drop handlers for a stale src (or on destroy) so a late load/error\n // can't overwrite the status for the current one.\n onCleanup(() => {\n image.onload = null;\n image.onerror = null;\n });\n });\n\n watch([this.loadingStatus], ([value]) => {\n this.onLoadingStatusChange.emit(value);\n if (value !== 'idle') {\n this.rootContext.imageLoadingStatus.set(value);\n }\n });\n }\n}\n","import { Directive, signal } from '@angular/core';\nimport { provideToken } from '@radix-ng/primitives/core';\nimport { AVATAR_ROOT_CONTEXT, AvatarContextToken } from './avatar-context.token';\nimport { RdxImageLoadingStatus } from './types';\n\n@Directive({\n selector: 'span[rdxAvatarRoot]',\n exportAs: 'rdxAvatarRoot',\n providers: [provideToken(AVATAR_ROOT_CONTEXT, RdxAvatarRootDirective)]\n})\nexport class RdxAvatarRootDirective implements AvatarContextToken {\n readonly imageLoadingStatus = signal<RdxImageLoadingStatus>('idle');\n}\n","import { NgModule } from '@angular/core';\nimport { RdxAvatarFallbackDirective } from './src/avatar-fallback.directive';\nimport { RdxAvatarImageDirective } from './src/avatar-image.directive';\nimport { RdxAvatarRootDirective } from './src/avatar-root.directive';\n\nexport * from './src/avatar-fallback.directive';\nexport * from './src/avatar-image.directive';\nexport * from './src/avatar-root.directive';\nexport * from './src/avatar.config';\nexport type { RdxImageLoadingStatus } from './src/types';\n\nconst _imports = [RdxAvatarRootDirective, RdxAvatarFallbackDirective, RdxAvatarImageDirective];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxAvatarModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAOO,MAAM,mBAAmB,GAAG,IAAI,cAAc,CAAqB,qBAAqB,CAAC;SAEhF,uBAAuB,GAAA;AACnC,IAAA,OAAO,MAAM,CAAC,mBAAmB,CAAC;AACtC;;ACAO,MAAM,mBAAmB,GAAoB;AAChD,IAAA,OAAO,EAAE;;MAGA,oBAAoB,GAAG,IAAI,cAAc,CAAkB,sBAAsB;AAExF,SAAU,sBAAsB,CAAC,MAAgC,EAAA;IACnE,OAAO;AACH,QAAA;AACI,YAAA,OAAO,EAAE,oBAAoB;AAC7B,YAAA,QAAQ,EAAE,EAAE,GAAG,mB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BAAA,QAAQ,EAAE,qBAAqB;AAC/B,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,SAAS,EAAE,CAAC,YAAY,CAAC,mBAAmB,yBAAyB;AACxE,iBAAA;;;ACED,MAAM,QAAQ,GAAG,CAAC,sBAAsB,EAAE,0BAA0B,EAAE,uBAAuB,CAAC;MAMjF,eAAe,CAAA;8GAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAf,eAAe,EAAA,OAAA,EAAA,CANV,sBAAsB,EAAE,0BAA0B,EAAE,uBAAuB,CAAA,EAAA,OAAA,EAAA,CAA3E,sBAAsB,EAAE,0BAA0B,EAAE,uBAAuB,CAAA,EAAA,CAAA,CAAA;+GAMhF,eAAe,EAAA,CAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;AChBD;;AAEG;;;;"}
@@ -27,11 +27,13 @@ class RdxButtonDirective {
27
27
  * The `type` attribute applied to native `<button>` hosts.
28
28
  * @group Props
29
29
  */
30
- this.type = input('button', ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
30
+ this.type = input('button', /* @ts-ignore */
31
+ ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
31
32
  /**
32
33
  * @ignore
33
34
  */
34
- this.isNativeButton = computed(() => this.elementRef.nativeElement.tagName === 'BUTTON', ...(ngDevMode ? [{ debugName: "isNativeButton" }] : /* istanbul ignore next */ []));
35
+ this.isNativeButton = computed(() => this.elementRef.nativeElement.tagName === 'BUTTON', /* @ts-ignore */
36
+ ...(ngDevMode ? [{ debugName: "isNativeButton" }] : /* istanbul ignore next */ []));
35
37
  /**
36
38
  * @ignore
37
39
  * Express disabled via `aria-disabled` on non-button hosts, or whenever the
@@ -42,7 +44,8 @@ class RdxButtonDirective {
42
44
  return undefined;
43
45
  }
44
46
  return !this.isNativeButton() || this.focusableWhenDisabled() ? 'true' : undefined;
45
- }, ...(ngDevMode ? [{ debugName: "ariaDisabled" }] : /* istanbul ignore next */ []));
47
+ }, /* @ts-ignore */
48
+ ...(ngDevMode ? [{ debugName: "ariaDisabled" }] : /* istanbul ignore next */ []));
46
49
  /**
47
50
  * @ignore
48
51
  */
@@ -51,7 +54,8 @@ class RdxButtonDirective {
51
54
  return undefined;
52
55
  }
53
56
  return this.disabled() && !this.focusableWhenDisabled() ? -1 : 0;
54
- }, ...(ngDevMode ? [{ debugName: "tabIndex" }] : /* istanbul ignore next */ []));
57
+ }, /* @ts-ignore */
58
+ ...(ngDevMode ? [{ debugName: "tabIndex" }] : /* istanbul ignore next */ []));
55
59
  const element = this.elementRef.nativeElement;
56
60
  // Capture-phase listeners registered here run before any consumer
57
61
  // `(click)`/`(keydown)` binding on the same element, so a disabled
@@ -93,10 +97,10 @@ class RdxButtonDirective {
93
97
  this.elementRef.nativeElement.click();
94
98
  }
95
99
  }
96
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
97
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxButtonDirective, isStandalone: true, selector: "[rdxButton]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, focusableWhenDisabled: { classPropertyName: "focusableWhenDisabled", publicName: "focusableWhenDisabled", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-disabled": "disabled() ? \"\" : undefined", "attr.disabled": "isNativeButton() && disabled() && !focusableWhenDisabled() ? \"\" : undefined", "attr.aria-disabled": "ariaDisabled()", "attr.type": "isNativeButton() ? type() : undefined", "attr.role": "isNativeButton() ? undefined : \"button\"", "attr.tabindex": "tabIndex()" } }, exportAs: ["rdxButton"], ngImport: i0 }); }
100
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
101
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: RdxButtonDirective, isStandalone: true, selector: "[rdxButton]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, focusableWhenDisabled: { classPropertyName: "focusableWhenDisabled", publicName: "focusableWhenDisabled", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-disabled": "disabled() ? \"\" : undefined", "attr.disabled": "isNativeButton() && disabled() && !focusableWhenDisabled() ? \"\" : undefined", "attr.aria-disabled": "ariaDisabled()", "attr.type": "isNativeButton() ? type() : undefined", "attr.role": "isNativeButton() ? undefined : \"button\"", "attr.tabindex": "tabIndex()" } }, exportAs: ["rdxButton"], ngImport: i0 }); }
98
102
  }
99
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxButtonDirective, decorators: [{
103
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxButtonDirective, decorators: [{
100
104
  type: Directive,
101
105
  args: [{
102
106
  selector: '[rdxButton]',
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-button.mjs","sources":["../../../packages/primitives/button/src/button.directive.ts","../../../packages/primitives/button/radix-ng-primitives-button.ts"],"sourcesContent":["import { booleanAttribute, computed, DestroyRef, Directive, ElementRef, inject, input } from '@angular/core';\nimport { BooleanInput } from '@radix-ng/primitives/core';\n\nexport type RdxButtonType = 'button' | 'submit' | 'reset';\n\nexport interface RdxButtonProps {\n /**\n * Whether the button is disabled.\n * @defaultValue false\n */\n disabled?: boolean;\n\n /**\n * Whether the button should remain focusable when disabled. When `true`,\n * the disabled state is expressed with `aria-disabled` (instead of the\n * native `disabled` attribute) so the control stays in the tab order while\n * its activation is suppressed.\n * @defaultValue false\n */\n focusableWhenDisabled?: boolean;\n\n /**\n * The `type` attribute applied to native `<button>` hosts.\n * @defaultValue 'button'\n */\n type?: RdxButtonType;\n}\n\n/**\n * Headless button behavior, modeled on Base UI's `useButton`.\n *\n * Renders accessible button semantics on a native `<button>` or on any other\n * element (e.g. `<a>`, `<span>`). Carries no styles — state is exposed via\n * `data-disabled` for consumers to style.\n *\n * @group Components\n */\n@Directive({\n selector: '[rdxButton]',\n exportAs: 'rdxButton',\n host: {\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined',\n\n // Native disabled only when we do NOT need it focusable; otherwise we\n // keep it focusable and express the state via aria-disabled below.\n '[attr.disabled]': 'isNativeButton() && disabled() && !focusableWhenDisabled() ? \"\" : undefined',\n '[attr.aria-disabled]': 'ariaDisabled()',\n\n // Native buttons get their type; non-button hosts get button semantics.\n '[attr.type]': 'isNativeButton() ? type() : undefined',\n '[attr.role]': 'isNativeButton() ? undefined : \"button\"',\n '[attr.tabindex]': 'tabIndex()'\n }\n})\nexport class RdxButtonDirective {\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n\n /**\n * Whether the button is disabled.\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Keep the button focusable while disabled (uses `aria-disabled`).\n * @group Props\n */\n readonly focusableWhenDisabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * The `type` attribute applied to native `<button>` hosts.\n * @group Props\n */\n readonly type = input<RdxButtonType>('button');\n\n /**\n * @ignore\n */\n protected readonly isNativeButton = computed(() => this.elementRef.nativeElement.tagName === 'BUTTON');\n\n /**\n * @ignore\n * Express disabled via `aria-disabled` on non-button hosts, or whenever the\n * control must stay focusable.\n */\n protected readonly ariaDisabled = computed(() => {\n if (!this.disabled()) {\n return undefined;\n }\n return !this.isNativeButton() || this.focusableWhenDisabled() ? 'true' : undefined;\n });\n\n /**\n * @ignore\n */\n protected readonly tabIndex = computed(() => {\n if (this.isNativeButton()) {\n return undefined;\n }\n return this.disabled() && !this.focusableWhenDisabled() ? -1 : 0;\n });\n\n constructor() {\n const element = this.elementRef.nativeElement;\n\n // Capture-phase listeners registered here run before any consumer\n // `(click)`/`(keydown)` binding on the same element, so a disabled\n // button reliably suppresses activation (the native `disabled`\n // attribute can't be used when the control must stay focusable).\n const onClick = (event: MouseEvent): void => this.handleClick(event);\n const onKeydown = (event: KeyboardEvent): void => this.handleKeydown(event);\n\n element.addEventListener('click', onClick, true);\n element.addEventListener('keydown', onKeydown, true);\n\n inject(DestroyRef).onDestroy(() => {\n element.removeEventListener('click', onClick, true);\n element.removeEventListener('keydown', onKeydown, true);\n });\n }\n\n private handleClick(event: MouseEvent): void {\n if (this.disabled()) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n private handleKeydown(event: KeyboardEvent): void {\n const isActivationKey = event.key === 'Enter' || event.key === ' ';\n if (!isActivationKey) {\n return;\n }\n\n if (this.disabled()) {\n // Native buttons fire a click on Enter/Space; the capture click\n // handler stops it. Non-button hosts never do, so just block here.\n event.preventDefault();\n if (!this.isNativeButton()) {\n event.stopImmediatePropagation();\n }\n return;\n }\n\n // Non-button hosts have no native activation; synthesize a click.\n // Space must not scroll the page.\n if (!this.isNativeButton()) {\n event.preventDefault();\n this.elementRef.nativeElement.click();\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AA4BA;;;;;;;;AAQG;MAkBU,kBAAkB,CAAA;AAgD3B,IAAA,WAAA,GAAA;AA/Ci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version":3,"file":"radix-ng-primitives-button.mjs","sources":["../../../packages/primitives/button/src/button.directive.ts","../../../packages/primitives/button/radix-ng-primitives-button.ts"],"sourcesContent":["import { booleanAttribute, computed, DestroyRef, Directive, ElementRef, inject, input } from '@angular/core';\nimport { BooleanInput } from '@radix-ng/primitives/core';\n\nexport type RdxButtonType = 'button' | 'submit' | 'reset';\n\nexport interface RdxButtonProps {\n /**\n * Whether the button is disabled.\n * @defaultValue false\n */\n disabled?: boolean;\n\n /**\n * Whether the button should remain focusable when disabled. When `true`,\n * the disabled state is expressed with `aria-disabled` (instead of the\n * native `disabled` attribute) so the control stays in the tab order while\n * its activation is suppressed.\n * @defaultValue false\n */\n focusableWhenDisabled?: boolean;\n\n /**\n * The `type` attribute applied to native `<button>` hosts.\n * @defaultValue 'button'\n */\n type?: RdxButtonType;\n}\n\n/**\n * Headless button behavior, modeled on Base UI's `useButton`.\n *\n * Renders accessible button semantics on a native `<button>` or on any other\n * element (e.g. `<a>`, `<span>`). Carries no styles — state is exposed via\n * `data-disabled` for consumers to style.\n *\n * @group Components\n */\n@Directive({\n selector: '[rdxButton]',\n exportAs: 'rdxButton',\n host: {\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined',\n\n // Native disabled only when we do NOT need it focusable; otherwise we\n // keep it focusable and express the state via aria-disabled below.\n '[attr.disabled]': 'isNativeButton() && disabled() && !focusableWhenDisabled() ? \"\" : undefined',\n '[attr.aria-disabled]': 'ariaDisabled()',\n\n // Native buttons get their type; non-button hosts get button semantics.\n '[attr.type]': 'isNativeButton() ? type() : undefined',\n '[attr.role]': 'isNativeButton() ? undefined : \"button\"',\n '[attr.tabindex]': 'tabIndex()'\n }\n})\nexport class RdxButtonDirective {\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n\n /**\n * Whether the button is disabled.\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Keep the button focusable while disabled (uses `aria-disabled`).\n * @group Props\n */\n readonly focusableWhenDisabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * The `type` attribute applied to native `<button>` hosts.\n * @group Props\n */\n readonly type = input<RdxButtonType>('button');\n\n /**\n * @ignore\n */\n protected readonly isNativeButton = computed(() => this.elementRef.nativeElement.tagName === 'BUTTON');\n\n /**\n * @ignore\n * Express disabled via `aria-disabled` on non-button hosts, or whenever the\n * control must stay focusable.\n */\n protected readonly ariaDisabled = computed(() => {\n if (!this.disabled()) {\n return undefined;\n }\n return !this.isNativeButton() || this.focusableWhenDisabled() ? 'true' : undefined;\n });\n\n /**\n * @ignore\n */\n protected readonly tabIndex = computed(() => {\n if (this.isNativeButton()) {\n return undefined;\n }\n return this.disabled() && !this.focusableWhenDisabled() ? -1 : 0;\n });\n\n constructor() {\n const element = this.elementRef.nativeElement;\n\n // Capture-phase listeners registered here run before any consumer\n // `(click)`/`(keydown)` binding on the same element, so a disabled\n // button reliably suppresses activation (the native `disabled`\n // attribute can't be used when the control must stay focusable).\n const onClick = (event: MouseEvent): void => this.handleClick(event);\n const onKeydown = (event: KeyboardEvent): void => this.handleKeydown(event);\n\n element.addEventListener('click', onClick, true);\n element.addEventListener('keydown', onKeydown, true);\n\n inject(DestroyRef).onDestroy(() => {\n element.removeEventListener('click', onClick, true);\n element.removeEventListener('keydown', onKeydown, true);\n });\n }\n\n private handleClick(event: MouseEvent): void {\n if (this.disabled()) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n private handleKeydown(event: KeyboardEvent): void {\n const isActivationKey = event.key === 'Enter' || event.key === ' ';\n if (!isActivationKey) {\n return;\n }\n\n if (this.disabled()) {\n // Native buttons fire a click on Enter/Space; the capture click\n // handler stops it. Non-button hosts never do, so just block here.\n event.preventDefault();\n if (!this.isNativeButton()) {\n event.stopImmediatePropagation();\n }\n return;\n }\n\n // Non-button hosts have no native activation; synthesize a click.\n // Space must not scroll the page.\n if (!this.isNativeButton()) {\n event.preventDefault();\n this.elementRef.nativeElement.click();\n }\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