@radix-ng/primitives 0.51.0 → 1.0.0-beta.1

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 (186) hide show
  1. package/fesm2022/radix-ng-primitives-accordion.mjs +105 -38
  2. package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
  3. package/fesm2022/radix-ng-primitives-alert-dialog.mjs +221 -129
  4. package/fesm2022/radix-ng-primitives-alert-dialog.mjs.map +1 -1
  5. package/fesm2022/radix-ng-primitives-arrow.mjs +20 -4
  6. package/fesm2022/radix-ng-primitives-arrow.mjs.map +1 -1
  7. package/fesm2022/radix-ng-primitives-aspect-ratio.mjs.map +1 -1
  8. package/fesm2022/radix-ng-primitives-avatar.mjs +54 -61
  9. package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
  10. package/fesm2022/radix-ng-primitives-button.mjs +123 -0
  11. package/fesm2022/radix-ng-primitives-button.mjs.map +1 -0
  12. package/fesm2022/radix-ng-primitives-calendar.mjs +95 -83
  13. package/fesm2022/radix-ng-primitives-calendar.mjs.map +1 -1
  14. package/fesm2022/radix-ng-primitives-checkbox.mjs +378 -54
  15. package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
  16. package/fesm2022/radix-ng-primitives-collapsible.mjs +182 -81
  17. package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
  18. package/fesm2022/radix-ng-primitives-collection.mjs +40 -57
  19. package/fesm2022/radix-ng-primitives-collection.mjs.map +1 -1
  20. package/fesm2022/radix-ng-primitives-config.mjs.map +1 -1
  21. package/fesm2022/radix-ng-primitives-context-menu.mjs +140 -424
  22. package/fesm2022/radix-ng-primitives-context-menu.mjs.map +1 -1
  23. package/fesm2022/radix-ng-primitives-core.mjs +845 -744
  24. package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
  25. package/fesm2022/radix-ng-primitives-cropper.mjs +288 -308
  26. package/fesm2022/radix-ng-primitives-cropper.mjs.map +1 -1
  27. package/fesm2022/radix-ng-primitives-date-field.mjs +104 -58
  28. package/fesm2022/radix-ng-primitives-date-field.mjs.map +1 -1
  29. package/fesm2022/radix-ng-primitives-dialog.mjs +655 -327
  30. package/fesm2022/radix-ng-primitives-dialog.mjs.map +1 -1
  31. package/fesm2022/radix-ng-primitives-dismissable-layer.mjs +70 -46
  32. package/fesm2022/radix-ng-primitives-dismissable-layer.mjs.map +1 -1
  33. package/fesm2022/radix-ng-primitives-drawer.mjs +960 -0
  34. package/fesm2022/radix-ng-primitives-drawer.mjs.map +1 -0
  35. package/fesm2022/radix-ng-primitives-editable.mjs +304 -23
  36. package/fesm2022/radix-ng-primitives-editable.mjs.map +1 -1
  37. package/fesm2022/radix-ng-primitives-field.mjs +363 -0
  38. package/fesm2022/radix-ng-primitives-field.mjs.map +1 -0
  39. package/fesm2022/radix-ng-primitives-fieldset.mjs +79 -0
  40. package/fesm2022/radix-ng-primitives-fieldset.mjs.map +1 -0
  41. package/fesm2022/radix-ng-primitives-focus-scope.mjs +23 -8
  42. package/fesm2022/radix-ng-primitives-focus-scope.mjs.map +1 -1
  43. package/fesm2022/radix-ng-primitives-input.mjs +172 -0
  44. package/fesm2022/radix-ng-primitives-input.mjs.map +1 -0
  45. package/fesm2022/radix-ng-primitives-label.mjs +6 -6
  46. package/fesm2022/radix-ng-primitives-label.mjs.map +1 -1
  47. package/fesm2022/radix-ng-primitives-menu.mjs +1907 -363
  48. package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
  49. package/fesm2022/radix-ng-primitives-menubar.mjs +290 -162
  50. package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
  51. package/fesm2022/radix-ng-primitives-meter.mjs +271 -0
  52. package/fesm2022/radix-ng-primitives-meter.mjs.map +1 -0
  53. package/fesm2022/radix-ng-primitives-navigation-menu.mjs +1052 -1553
  54. package/fesm2022/radix-ng-primitives-navigation-menu.mjs.map +1 -1
  55. package/fesm2022/radix-ng-primitives-number-field.mjs +1102 -367
  56. package/fesm2022/radix-ng-primitives-number-field.mjs.map +1 -1
  57. package/fesm2022/radix-ng-primitives-pagination.mjs.map +1 -1
  58. package/fesm2022/radix-ng-primitives-popover.mjs +978 -989
  59. package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
  60. package/fesm2022/radix-ng-primitives-popper.mjs +111 -44
  61. package/fesm2022/radix-ng-primitives-popper.mjs.map +1 -1
  62. package/fesm2022/radix-ng-primitives-portal.mjs +34 -10
  63. package/fesm2022/radix-ng-primitives-portal.mjs.map +1 -1
  64. package/fesm2022/radix-ng-primitives-presence.mjs +134 -246
  65. package/fesm2022/radix-ng-primitives-presence.mjs.map +1 -1
  66. package/fesm2022/radix-ng-primitives-preview-card.mjs +997 -0
  67. package/fesm2022/radix-ng-primitives-preview-card.mjs.map +1 -0
  68. package/fesm2022/radix-ng-primitives-progress.mjs +223 -84
  69. package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
  70. package/fesm2022/radix-ng-primitives-radio.mjs +191 -51
  71. package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
  72. package/fesm2022/radix-ng-primitives-roving-focus.mjs +96 -50
  73. package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -1
  74. package/fesm2022/radix-ng-primitives-scroll-area.mjs +923 -0
  75. package/fesm2022/radix-ng-primitives-scroll-area.mjs.map +1 -0
  76. package/fesm2022/radix-ng-primitives-select.mjs +791 -509
  77. package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
  78. package/fesm2022/radix-ng-primitives-separator.mjs +12 -35
  79. package/fesm2022/radix-ng-primitives-separator.mjs.map +1 -1
  80. package/fesm2022/radix-ng-primitives-slider.mjs +969 -717
  81. package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
  82. package/fesm2022/radix-ng-primitives-stepper.mjs +15 -19
  83. package/fesm2022/radix-ng-primitives-stepper.mjs.map +1 -1
  84. package/fesm2022/radix-ng-primitives-switch.mjs +125 -113
  85. package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
  86. package/fesm2022/radix-ng-primitives-tabs.mjs +390 -108
  87. package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
  88. package/fesm2022/radix-ng-primitives-time-field.mjs +55 -46
  89. package/fesm2022/radix-ng-primitives-time-field.mjs.map +1 -1
  90. package/fesm2022/radix-ng-primitives-toast.mjs +839 -0
  91. package/fesm2022/radix-ng-primitives-toast.mjs.map +1 -0
  92. package/fesm2022/radix-ng-primitives-toggle-group.mjs +121 -247
  93. package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
  94. package/fesm2022/radix-ng-primitives-toggle.mjs +98 -61
  95. package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
  96. package/fesm2022/radix-ng-primitives-toolbar.mjs +303 -92
  97. package/fesm2022/radix-ng-primitives-toolbar.mjs.map +1 -1
  98. package/fesm2022/radix-ng-primitives-tooltip.mjs +699 -1072
  99. package/fesm2022/radix-ng-primitives-tooltip.mjs.map +1 -1
  100. package/fesm2022/radix-ng-primitives-visually-hidden.mjs +25 -66
  101. package/fesm2022/radix-ng-primitives-visually-hidden.mjs.map +1 -1
  102. package/meter/README.md +3 -0
  103. package/navigation-menu/README.md +2 -1
  104. package/package.json +39 -18
  105. package/portal/README.md +2 -0
  106. package/preview-card/README.md +3 -0
  107. package/schematics/collection.json +1 -0
  108. package/schematics/ng-add/index.d.ts +3 -2
  109. package/schematics/ng-add/index.js +62 -31
  110. package/schematics/ng-add/index.js.map +1 -1
  111. package/schematics/ng-add/package-config.d.ts +4 -2
  112. package/schematics/ng-add/package-config.js +10 -2
  113. package/schematics/ng-add/package-config.js.map +1 -1
  114. package/schematics/ng-add/schema.d.ts +3 -0
  115. package/schematics/ng-add/schema.js +3 -0
  116. package/schematics/ng-add/schema.js.map +1 -0
  117. package/schematics/ng-add/schema.json +14 -0
  118. package/select/README.md +2 -0
  119. package/types/radix-ng-primitives-accordion.d.ts +51 -16
  120. package/types/radix-ng-primitives-alert-dialog.d.ts +95 -38
  121. package/types/radix-ng-primitives-arrow.d.ts +1 -1
  122. package/types/radix-ng-primitives-aspect-ratio.d.ts +1 -1
  123. package/types/radix-ng-primitives-avatar.d.ts +7 -11
  124. package/types/radix-ng-primitives-button.d.ts +73 -0
  125. package/types/radix-ng-primitives-calendar.d.ts +39 -20
  126. package/types/radix-ng-primitives-checkbox.d.ts +204 -35
  127. package/types/radix-ng-primitives-collapsible.d.ts +114 -40
  128. package/types/radix-ng-primitives-collection.d.ts +38 -34
  129. package/types/radix-ng-primitives-config.d.ts +1 -1
  130. package/types/radix-ng-primitives-context-menu.d.ts +61 -116
  131. package/types/radix-ng-primitives-core.d.ts +345 -235
  132. package/types/radix-ng-primitives-cropper.d.ts +89 -56
  133. package/types/radix-ng-primitives-date-field.d.ts +49 -28
  134. package/types/radix-ng-primitives-dialog.d.ts +283 -165
  135. package/types/radix-ng-primitives-dismissable-layer.d.ts +15 -7
  136. package/types/radix-ng-primitives-drawer.d.ts +426 -0
  137. package/types/radix-ng-primitives-editable.d.ts +91 -14
  138. package/types/radix-ng-primitives-field.d.ts +374 -0
  139. package/types/radix-ng-primitives-fieldset.d.ts +49 -0
  140. package/types/radix-ng-primitives-focus-scope.d.ts +15 -6
  141. package/types/radix-ng-primitives-input.d.ts +87 -0
  142. package/types/radix-ng-primitives-label.d.ts +0 -1
  143. package/types/radix-ng-primitives-menu.d.ts +584 -99
  144. package/types/radix-ng-primitives-menubar.d.ts +61 -50
  145. package/types/radix-ng-primitives-meter.d.ts +194 -0
  146. package/types/radix-ng-primitives-navigation-menu.d.ts +422 -340
  147. package/types/radix-ng-primitives-number-field.d.ts +405 -145
  148. package/types/radix-ng-primitives-pagination.d.ts +2 -2
  149. package/types/radix-ng-primitives-popover.d.ts +366 -351
  150. package/types/radix-ng-primitives-popper.d.ts +68 -11
  151. package/types/radix-ng-primitives-portal.d.ts +14 -6
  152. package/types/radix-ng-primitives-presence.d.ts +28 -76
  153. package/types/radix-ng-primitives-preview-card.d.ts +359 -0
  154. package/types/radix-ng-primitives-progress.d.ts +175 -48
  155. package/types/radix-ng-primitives-radio.d.ts +55 -25
  156. package/types/radix-ng-primitives-roving-focus.d.ts +33 -23
  157. package/types/radix-ng-primitives-scroll-area.d.ts +253 -0
  158. package/types/radix-ng-primitives-select.d.ts +475 -177
  159. package/types/radix-ng-primitives-separator.d.ts +7 -32
  160. package/types/radix-ng-primitives-slider.d.ts +315 -201
  161. package/types/radix-ng-primitives-stepper.d.ts +5 -7
  162. package/types/radix-ng-primitives-switch.d.ts +86 -71
  163. package/types/radix-ng-primitives-tabs.d.ts +213 -79
  164. package/types/radix-ng-primitives-time-field.d.ts +42 -27
  165. package/types/radix-ng-primitives-toast.d.ts +378 -0
  166. package/types/radix-ng-primitives-toggle-group.d.ts +86 -164
  167. package/types/radix-ng-primitives-toggle.d.ts +43 -53
  168. package/types/radix-ng-primitives-toolbar.d.ts +164 -38
  169. package/types/radix-ng-primitives-tooltip.d.ts +348 -384
  170. package/types/radix-ng-primitives-visually-hidden.d.ts +19 -19
  171. package/dropdown-menu/README.md +0 -1
  172. package/fesm2022/radix-ng-primitives-dropdown-menu.mjs +0 -581
  173. package/fesm2022/radix-ng-primitives-dropdown-menu.mjs.map +0 -1
  174. package/fesm2022/radix-ng-primitives-hover-card.mjs +0 -1238
  175. package/fesm2022/radix-ng-primitives-hover-card.mjs.map +0 -1
  176. package/fesm2022/radix-ng-primitives-select2.mjs +0 -897
  177. package/fesm2022/radix-ng-primitives-select2.mjs.map +0 -1
  178. package/fesm2022/radix-ng-primitives-tooltip2.mjs +0 -735
  179. package/fesm2022/radix-ng-primitives-tooltip2.mjs.map +0 -1
  180. package/hover-card/README.md +0 -3
  181. package/select2/README.md +0 -3
  182. package/tooltip2/README.md +0 -3
  183. package/types/radix-ng-primitives-dropdown-menu.d.ts +0 -171
  184. package/types/radix-ng-primitives-hover-card.d.ts +0 -471
  185. package/types/radix-ng-primitives-select2.d.ts +0 -511
  186. package/types/radix-ng-primitives-tooltip2.d.ts +0 -325
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radix-ng-primitives-fieldset.mjs","sources":["../../../packages/primitives/fieldset/src/fieldset-root.ts","../../../packages/primitives/fieldset/src/fieldset-legend.ts","../../../packages/primitives/fieldset/radix-ng-primitives-fieldset.ts"],"sourcesContent":["import { booleanAttribute, computed, Directive, inject, input } from '@angular/core';\nimport { BooleanInput, createContext } from '@radix-ng/primitives/core';\n\nconst attr = (value: boolean) => (value ? '' : undefined);\n\nconst fieldsetRootContext = () => {\n const root = injectFieldsetRoot();\n\n return {\n disabledState: root.disabledState\n };\n};\n\nexport type RdxFieldsetRootContext = ReturnType<typeof fieldsetRootContext>;\n\nexport const [injectFieldsetRootContext, provideFieldsetRootContext] =\n createContext<RdxFieldsetRootContext>('RdxFieldsetRoot');\n\n/**\n * Groups related form controls and disables them as a set.\n *\n * @group Components\n */\n@Directive({\n selector: 'fieldset[rdxFieldsetRoot]',\n exportAs: 'rdxFieldsetRoot',\n providers: [provideFieldsetRootContext(fieldsetRootContext)],\n host: {\n '[attr.disabled]': 'disabledState() ? \"\" : undefined',\n '[attr.data-disabled]': 'dataAttr(disabledState())'\n }\n})\nexport class RdxFieldsetRoot {\n /**\n * Whether all controls in the fieldset are disabled.\n *\n * @group Props\n * @defaultValue false\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly disabledState = computed(() => this.disabled());\n\n protected readonly dataAttr = attr;\n}\n\nfunction injectFieldsetRoot(): RdxFieldsetRoot {\n return inject(RdxFieldsetRoot);\n}\n","import { Directive } from '@angular/core';\nimport { injectFieldsetRootContext } from './fieldset-root';\n\nconst attr = (value: boolean) => (value ? '' : undefined);\n\n/**\n * Labels the fieldset.\n *\n * @group Components\n */\n@Directive({\n selector: 'legend[rdxFieldsetLegend]',\n exportAs: 'rdxFieldsetLegend',\n host: {\n '[attr.data-disabled]': 'dataAttr(rootContext.disabledState())'\n }\n})\nexport class RdxFieldsetLegend {\n protected readonly rootContext = injectFieldsetRootContext();\n protected readonly dataAttr = attr;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["attr"],"mappings":";;;;AAGA,MAAMA,MAAI,GAAG,CAAC,KAAc,MAAM,KAAK,GAAG,EAAE,GAAG,SAAS,CAAC;AAEzD,MAAM,mBAAmB,GAAG,MAAK;AAC7B,IAAA,MAAM,IAAI,GAAG,kBAAkB,EAAE;IAEjC,OAAO;QACH,aAAa,EAAE,IAAI,CAAC;KACvB;AACL,CAAC;AAIM,MAAM,CAAC,yBAAyB,EAAE,0BAA0B,CAAC,GAChE,aAAa,CAAyB,iBAAiB;AAE3D;;;;AAIG;MAUU,eAAe,CAAA;AAT5B,IAAA,WAAA,GAAA;AAUI;;;;;AAKG;QACM,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAwB,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;QAE/E,IAAA,CAAA,aAAa,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,eAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAC;QAErC,IAAA,CAAA,QAAQ,GAAGA,MAAI;AACrC,IAAA;8GAZY,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAf,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,eAAe,yVANb,CAAC,0BAA0B,CAAC,mBAAmB,CAAC,CAAC,EAAA,QAAA,EAAA,CAAA,iBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAMnD,eAAe,EAAA,UAAA,EAAA,CAAA;kBAT3B,SAAS;AAAC,YAAA,IAAA,EAAA,CA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afterNextRender, effect, Directive } from '@angular/core';
2
+ import { InjectionToken, signal, inject, Injector, DestroyRef, ElementRef, input, booleanAttribute, computed, output, afterNextRender, effect, Directive } from '@angular/core';
3
3
  import { getActiveElement, createContext } from '@radix-ng/primitives/core';
4
4
 
5
+ const RdxFocusScopeConfigToken = new InjectionToken('RdxFocusScopeConfig', {
6
+ factory: () => ({
7
+ trapped: signal(false)
8
+ })
9
+ });
10
+ function provideRdxFocusScopeConfig(factory) {
11
+ return { provide: RdxFocusScopeConfigToken, useFactory: factory };
12
+ }
13
+
5
14
  function createGlobalState(factory) {
6
15
  const state = factory();
7
16
  return () => state;
@@ -142,7 +151,7 @@ const rootContext = () => {
142
151
  const context = inject(RdxFocusScope);
143
152
  return {
144
153
  loop: context.loop,
145
- trapped: context.trapped
154
+ trapped: context.isTrapped
146
155
  };
147
156
  };
148
157
  /**
@@ -153,6 +162,7 @@ class RdxFocusScope {
153
162
  this.injector = inject(Injector);
154
163
  this.destroyRef = inject(DestroyRef);
155
164
  this.elementRef = inject(ElementRef);
165
+ this.config = inject(RdxFocusScopeConfigToken);
156
166
  /**
157
167
  * When `true`, tabbing from last item will focus first tabbable
158
168
  * and shift+tab from first item will focus last tababble.
@@ -168,7 +178,8 @@ class RdxFocusScope {
168
178
  * @group Props
169
179
  * @defaultValue false
170
180
  */
171
- this.trapped = input(false, { ...(ngDevMode ? { debugName: "trapped" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
181
+ this.trapped = input(undefined, { ...(ngDevMode ? { debugName: "trapped" } : /* istanbul ignore next */ {}), transform: (value) => (value === undefined ? undefined : booleanAttribute(value)) });
182
+ this.isTrapped = computed(() => this.trapped() ?? this.config.trapped(), ...(ngDevMode ? [{ debugName: "isTrapped" }] : /* istanbul ignore next */ []));
172
183
  /**
173
184
  * Event handler called when auto-focusing on mount.
174
185
  * Can be prevented.
@@ -197,7 +208,7 @@ class RdxFocusScope {
197
208
  afterNextRender(() => {
198
209
  effect((onCleanup) => {
199
210
  const container = this.elementRef.nativeElement;
200
- if (this.trapped()) {
211
+ if (this.isTrapped()) {
201
212
  const handleFocusIn = (event) => {
202
213
  if (this.focusScope.paused() || !container) {
203
214
  return;
@@ -255,15 +266,19 @@ class RdxFocusScope {
255
266
  effect(async (onCleanup) => {
256
267
  const container = this.elementRef.nativeElement;
257
268
  await Promise.resolve();
258
- if (!container) {
269
+ if (!container || !this.alive) {
259
270
  return;
260
271
  }
261
272
  this.focusScopesStack.add(this.focusScope);
262
273
  const previouslyFocusedElement = getActiveElement();
263
274
  const hasFocusedCandidate = container.contains(previouslyFocusedElement);
275
+ const mountEventHandler = (ev) => {
276
+ if (this.alive)
277
+ this.mountAutoFocus.emit(ev);
278
+ };
264
279
  if (!hasFocusedCandidate) {
265
280
  const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
266
- container.addEventListener(AUTOFOCUS_ON_MOUNT, (ev) => this.mountAutoFocus.emit(ev));
281
+ container.addEventListener(AUTOFOCUS_ON_MOUNT, mountEventHandler);
267
282
  container.dispatchEvent(mountEvent);
268
283
  if (!mountEvent.defaultPrevented) {
269
284
  focusFirst(removeLinks(getTabbableCandidates(container)), {
@@ -279,7 +294,7 @@ class RdxFocusScope {
279
294
  };
280
295
  container.addEventListener(AUTOFOCUS_ON_UNMOUNT, unmountEventHandler);
281
296
  onCleanup(() => {
282
- container.removeEventListener(AUTOFOCUS_ON_MOUNT, (ev) => this.mountAutoFocus.emit(ev));
297
+ container.removeEventListener(AUTOFOCUS_ON_MOUNT, mountEventHandler);
283
298
  const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
284
299
  container.dispatchEvent(unmountEvent);
285
300
  setTimeout(() => {
@@ -340,5 +355,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
340
355
  * Generated bundle index. Do not edit.
341
356
  */
342
357
 
343
- export { RdxFocusScope, injectFocusScopeContext, provideFocusScopeContext };
358
+ export { RdxFocusScope, RdxFocusScopeConfigToken, injectFocusScopeContext, provideFocusScopeContext, provideRdxFocusScopeConfig };
344
359
  //# sourceMappingURL=radix-ng-primitives-focus-scope.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-focus-scope.mjs","sources":["../../../packages/primitives/focus-scope/src/stack.ts","../../../packages/primitives/focus-scope/src/utils.ts","../../../packages/primitives/focus-scope/src/focus-scope.ts","../../../packages/primitives/focus-scope/radix-ng-primitives-focus-scope.ts"],"sourcesContent":["import { signal, WritableSignal } from '@angular/core';\n\nexport function createGlobalState<T>(factory: () => T): () => T {\n const state = factory();\n return () => state;\n}\n\nexport interface FocusScopeAPI {\n paused: WritableSignal<boolean>;\n pause(): void;\n resume(): void;\n}\n\nconst useFocusStackState = createGlobalState(() => signal<FocusScopeAPI[]>([]));\n\nexport function createFocusScopesStack() {\n /** A stack of focus scopes, with the active one at the top */\n const stack = useFocusStackState();\n\n return {\n add(focusScope: FocusScopeAPI) {\n const current = stack();\n const active = current[0];\n if (focusScope !== active) {\n active?.pause();\n }\n const updated = arrayRemove(current, focusScope);\n updated.unshift(focusScope);\n stack.set(updated);\n },\n\n remove(focusScope: FocusScopeAPI) {\n const current = stack();\n const updated = arrayRemove(current, focusScope);\n stack.set(updated);\n // после удаления «возобновляем» новый верхний\n stack()[0]?.resume();\n }\n };\n}\n\nexport function arrayRemove<T>(array: T[], item: T): T[] {\n const copy = [...array];\n const idx = copy.indexOf(item);\n if (idx !== -1) {\n copy.splice(idx, 1);\n }\n return copy;\n}\n\nexport function removeLinks(items: HTMLElement[]): HTMLElement[] {\n return items.filter((el) => el.tagName !== 'A');\n}\n","import { getActiveElement } from '@radix-ng/primitives/core';\n\nexport const AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';\nexport const AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';\nexport const EVENT_OPTIONS = { bubbles: false, cancelable: true };\n\ntype FocusableTarget = HTMLElement | { focus: () => void };\n\n/**\n * Attempts focusing the first element in a list of candidates.\n * Stops when focus has actually moved.\n */\nexport function focusFirst(candidates: HTMLElement[], { select = false } = {}) {\n const previouslyFocusedElement = getActiveElement();\n for (const candidate of candidates) {\n focus(candidate, { select });\n if (getActiveElement() !== previouslyFocusedElement) return true;\n }\n\n return;\n}\n\n/**\n * Returns a list of potential tabbable candidates.\n *\n * NOTE: This is only a close approximation. For example it doesn't take into account cases like when\n * elements are not visible. This cannot be worked out easily by just reading a property, but rather\n * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1\n */\nexport function getTabbableCandidates(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: any) => {\n const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';\n if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;\n // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n }\n });\n while (walker.nextNode()) nodes.push(walker.currentNode as HTMLElement);\n // we do not take into account the order of nodes with positive `tabIndex` as it\n // hinders accessibility to have tab order different from visual order.\n return nodes;\n}\n\nexport function isHidden(node: HTMLElement, { upTo }: { upTo?: HTMLElement }) {\n if (getComputedStyle(node).visibility === 'hidden') return true;\n while (node) {\n // we stop at `upTo` (excluding it)\n if (upTo !== undefined && node === upTo) return false;\n if (getComputedStyle(node).display === 'none') return true;\n node = node.parentElement as HTMLElement;\n }\n return false;\n}\n\n/**\n * Returns the first visible element in a list.\n * NOTE: Only checks visibility up to the `container`.\n */\nexport function findVisible(elements: HTMLElement[], container: HTMLElement): HTMLElement | undefined {\n for (const element of elements) {\n // we stop checking if it's hidden at the `container` level (excluding)\n if (!isHidden(element, { upTo: container })) return element;\n }\n return undefined;\n}\n\n/**\n * Returns the first and last tabbable elements inside a container.\n */\nexport function getTabbableEdges(container: HTMLElement) {\n const candidates = getTabbableCandidates(container);\n const first = findVisible(candidates, container);\n const last = findVisible(candidates.reverse(), container);\n return [first, last] as const;\n}\n\nexport function isSelectableInput(element: any): element is FocusableTarget & { select: () => void } {\n return element instanceof HTMLInputElement && 'select' in element;\n}\n\nexport function focus(element?: FocusableTarget | null, { select = false } = {}) {\n // only focus if that element is focusable\n if (element && element.focus) {\n const previouslyFocusedElement = getActiveElement();\n // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users\n element.focus({ preventScroll: true });\n // only select if its not the same element, it supports selection and we need to select\n if (element !== previouslyFocusedElement && isSelectableInput(element) && select) {\n element.select();\n }\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n afterNextRender,\n booleanAttribute,\n DestroyRef,\n Directive,\n effect,\n ElementRef,\n inject,\n Injector,\n input,\n output,\n Signal,\n signal\n} from '@angular/core';\nimport { createContext, getActiveElement } from '@radix-ng/primitives/core';\nimport { createFocusScopesStack, FocusScopeAPI, removeLinks } from './stack';\nimport {\n AUTOFOCUS_ON_MOUNT,\n AUTOFOCUS_ON_UNMOUNT,\n EVENT_OPTIONS,\n focus,\n focusFirst,\n getTabbableCandidates,\n getTabbableEdges\n} from './utils';\n\nexport interface FocusScopeContext {\n loop?: Signal<boolean>;\n\n trapped?: Signal<boolean>;\n}\n\nexport const [injectFocusScopeContext, provideFocusScopeContext] =\n createContext<FocusScopeContext>('FocusScope Context');\n\nconst rootContext = (): FocusScopeContext => {\n const context = inject(RdxFocusScope);\n\n return {\n loop: context.loop,\n trapped: context.trapped\n };\n};\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxFocusScope]',\n providers: [provideFocusScopeContext(rootContext)],\n host: {\n tabindex: '-1',\n '(keydown)': 'handleKeyDown($event)'\n }\n})\nexport class RdxFocusScope {\n private readonly injector = inject(Injector);\n private readonly destroyRef = inject(DestroyRef);\n\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * When `true`, tabbing from last item will focus first tabbable\n * and shift+tab from first item will focus last tababble.\n *\n * @group Props\n * @defaultValue false\n */\n readonly loop = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * When `true`, focus cannot escape the focus scope via keyboard,\n * pointer, or a programmatic focus.\n *\n * @group Props\n * @defaultValue false\n */\n readonly trapped = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Event handler called when auto-focusing on mount.\n * Can be prevented.\n *\n * @group Emits\n */\n readonly mountAutoFocus = output<Event>();\n\n /**\n * Event handler called when auto-focusing on unmount.\n * Can be prevented.\n *\n * @group Emits\n */\n readonly unmountAutoFocus = output<Event>();\n\n readonly lastFocusedElement = signal<HTMLElement | null>(null);\n\n private readonly focusScopesStack = createFocusScopesStack();\n\n readonly focusScope: FocusScopeAPI = {\n paused: signal(false),\n pause: () => this.focusScope.paused.set(true),\n resume: () => this.focusScope.paused.set(false)\n };\n\n private alive = true;\n\n constructor() {\n this.destroyRef.onDestroy(() => {\n this.alive = false;\n });\n\n afterNextRender(() => {\n effect(\n (onCleanup) => {\n const container = this.elementRef.nativeElement;\n\n if (this.trapped()) {\n const handleFocusIn = (event: FocusEvent) => {\n if (this.focusScope.paused() || !container) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n if (this.elementRef.nativeElement.contains(target)) {\n this.lastFocusedElement.set(target);\n } else {\n focus(this.lastFocusedElement(), { select: true });\n }\n };\n\n const handleFocusOut = (event: FocusEvent) => {\n if (this.focusScope.paused() || !container) {\n return;\n }\n const relatedTarget = event.relatedTarget as HTMLElement | null;\n\n // A `focusout` event with a `null` `relatedTarget` will happen in at least two cases:\n //\n // 1. When the user switches app/tabs/windows/the browser itself loses focus.\n // 2. In Google Chrome, when the focused element is removed from the DOM.\n //\n // We let the browser do its thing here because:\n //\n // 1. The browser already keeps a memory of what's focused for when the page gets refocused.\n // 2. In Google Chrome, if we try to focus the deleted focused element (as per below), it\n // throws the CPU to 100%, so we avoid doing anything for this reason here too.\n if (relatedTarget === null) return;\n\n // If the focus has moved to an actual legitimate element (`relatedTarget !== null`)\n // that is outside the container, we move focus to the last valid focused element inside.\n if (!container.contains(relatedTarget)) {\n focus(this.lastFocusedElement(), { select: true });\n }\n };\n\n const handleMutations = () => {\n const isLastFocusedElementExist = container.contains(this.lastFocusedElement());\n\n if (!isLastFocusedElementExist) {\n focus(container);\n }\n };\n\n const mutationObserver = new MutationObserver(handleMutations);\n if (container) {\n mutationObserver.observe(container, { childList: true, subtree: true });\n }\n\n document.addEventListener('focusin', handleFocusIn);\n document.addEventListener('focusout', handleFocusOut);\n\n onCleanup(() => {\n document.removeEventListener('focusin', handleFocusIn);\n document.removeEventListener('focusout', handleFocusOut);\n mutationObserver.disconnect();\n });\n }\n },\n { injector: this.injector }\n );\n\n effect(\n async (onCleanup) => {\n const container = this.elementRef.nativeElement;\n\n await Promise.resolve();\n if (!container) {\n return;\n }\n\n this.focusScopesStack.add(this.focusScope);\n\n const previouslyFocusedElement = getActiveElement() as HTMLElement | null;\n const hasFocusedCandidate = container.contains(previouslyFocusedElement);\n\n if (!hasFocusedCandidate) {\n const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);\n container.addEventListener(AUTOFOCUS_ON_MOUNT, (ev: Event) => this.mountAutoFocus.emit(ev));\n container.dispatchEvent(mountEvent);\n\n if (!mountEvent.defaultPrevented) {\n focusFirst(removeLinks(getTabbableCandidates(container)), {\n select: true\n });\n if (getActiveElement() === previouslyFocusedElement) focus(container);\n }\n }\n\n const unmountEventHandler = (ev: Event) => {\n if (this.alive) this.unmountAutoFocus.emit(ev);\n };\n container.addEventListener(AUTOFOCUS_ON_UNMOUNT, unmountEventHandler);\n\n onCleanup(() => {\n container.removeEventListener(AUTOFOCUS_ON_MOUNT, (ev: Event) => this.mountAutoFocus.emit(ev));\n\n const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);\n container.dispatchEvent(unmountEvent);\n\n setTimeout(() => {\n if (!unmountEvent.defaultPrevented)\n focus(previouslyFocusedElement ?? document.body, { select: true });\n\n // we need to remove the listener after we `dispatchEvent`\n container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, unmountEventHandler);\n\n this.focusScopesStack.remove(this.focusScope);\n }, 0);\n });\n },\n { injector: this.injector }\n );\n });\n }\n\n handleKeyDown(event: KeyboardEvent) {\n const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;\n\n const focusedElement = getActiveElement() as HTMLElement | null;\n\n if (isTabKey && focusedElement) {\n const container = event.currentTarget as HTMLElement;\n\n const [first, last] = getTabbableEdges(container);\n const hasTabbableElementsInside = first && last;\n\n // we can only wrap focus if we have tabbable edges\n if (!hasTabbableElementsInside) {\n if (focusedElement === container) event.preventDefault();\n } else {\n if (!event.shiftKey && focusedElement === last) {\n event.preventDefault();\n if (this.loop()) {\n focus(first, { select: true });\n }\n } else if (event.shiftKey && focusedElement === first) {\n event.preventDefault();\n if (this.loop()) {\n focus(last, { select: true });\n }\n }\n }\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAEM,SAAU,iBAAiB,CAAI,OAAgB,EAAA;AACjD,IAAA,MAAM,KAAK,GAAG,OAAO,EAAE;AACvB,IAAA,OAAO,MAAM,KAAK;AACtB;AAQA,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,MAAM,MAAM,CAAkB,EAAE,CAAC,CAAC;SAE/D,sBAAsB,GAAA;;AAElC,IAAA,MAAM,KAAK,GAAG,kBAAkB,EAAE;IAElC,OAAO;AACH,QAAA,GAAG,CAAC,UAAyB,EAAA;AACzB,YAAA,MAAM,OAAO,GAAG,KAAK,EAAE;AACv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;IACJ;8GAjNS,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAb,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,aAAa,ifANX,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAMzC,aAAa,EAAA,UAAA,EAAA,CAAA;kBARzB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,SAAS,EAAE,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC;AAClD,oBAAA,IAAI,EAAE;AACF,wBAAA,QAAQ,EAAE,IAAI;AACd,wBAAA,WAAW,EAAE;AAChB;AACJ,iBAAA;;;ACvDD;;AAEG;;;;"}
1
+ {"version":3,"file":"radix-ng-primitives-focus-scope.mjs","sources":["../../../packages/primitives/focus-scope/src/focus-scope.config.ts","../../../packages/primitives/focus-scope/src/stack.ts","../../../packages/primitives/focus-scope/src/utils.ts","../../../packages/primitives/focus-scope/src/focus-scope.ts","../../../packages/primitives/focus-scope/radix-ng-primitives-focus-scope.ts"],"sourcesContent":["import { InjectionToken, Provider, Signal, signal } from '@angular/core';\n\nexport type RdxFocusScopeConfig = {\n trapped: Signal<boolean>;\n};\n\nexport const RdxFocusScopeConfigToken = new InjectionToken<RdxFocusScopeConfig>('RdxFocusScopeConfig', {\n factory: () => ({\n trapped: signal(false)\n })\n});\n\nexport function provideRdxFocusScopeConfig(factory: () => RdxFocusScopeConfig): Provider {\n return { provide: RdxFocusScopeConfigToken, useFactory: factory };\n}\n","import { signal, WritableSignal } from '@angular/core';\n\nexport function createGlobalState<T>(factory: () => T): () => T {\n const state = factory();\n return () => state;\n}\n\nexport interface FocusScopeAPI {\n paused: WritableSignal<boolean>;\n pause(): void;\n resume(): void;\n}\n\nconst useFocusStackState = createGlobalState(() => signal<FocusScopeAPI[]>([]));\n\nexport function createFocusScopesStack() {\n /** A stack of focus scopes, with the active one at the top */\n const stack = useFocusStackState();\n\n return {\n add(focusScope: FocusScopeAPI) {\n const current = stack();\n const active = current[0];\n if (focusScope !== active) {\n active?.pause();\n }\n const updated = arrayRemove(current, focusScope);\n updated.unshift(focusScope);\n stack.set(updated);\n },\n\n remove(focusScope: FocusScopeAPI) {\n const current = stack();\n const updated = arrayRemove(current, focusScope);\n stack.set(updated);\n // после удаления «возобновляем» новый верхний\n stack()[0]?.resume();\n }\n };\n}\n\nexport function arrayRemove<T>(array: T[], item: T): T[] {\n const copy = [...array];\n const idx = copy.indexOf(item);\n if (idx !== -1) {\n copy.splice(idx, 1);\n }\n return copy;\n}\n\nexport function removeLinks(items: HTMLElement[]): HTMLElement[] {\n return items.filter((el) => el.tagName !== 'A');\n}\n","import { getActiveElement } from '@radix-ng/primitives/core';\n\nexport const AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';\nexport const AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';\nexport const EVENT_OPTIONS = { bubbles: false, cancelable: true };\n\ntype FocusableTarget = HTMLElement | { focus: () => void };\n\n/**\n * Attempts focusing the first element in a list of candidates.\n * Stops when focus has actually moved.\n */\nexport function focusFirst(candidates: HTMLElement[], { select = false } = {}) {\n const previouslyFocusedElement = getActiveElement();\n for (const candidate of candidates) {\n focus(candidate, { select });\n if (getActiveElement() !== previouslyFocusedElement) return true;\n }\n\n return;\n}\n\n/**\n * Returns a list of potential tabbable candidates.\n *\n * NOTE: This is only a close approximation. For example it doesn't take into account cases like when\n * elements are not visible. This cannot be worked out easily by just reading a property, but rather\n * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1\n */\nexport function getTabbableCandidates(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: any) => {\n const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';\n if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;\n // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n }\n });\n while (walker.nextNode()) nodes.push(walker.currentNode as HTMLElement);\n // we do not take into account the order of nodes with positive `tabIndex` as it\n // hinders accessibility to have tab order different from visual order.\n return nodes;\n}\n\nexport function isHidden(node: HTMLElement, { upTo }: { upTo?: HTMLElement }) {\n if (getComputedStyle(node).visibility === 'hidden') return true;\n while (node) {\n // we stop at `upTo` (excluding it)\n if (upTo !== undefined && node === upTo) return false;\n if (getComputedStyle(node).display === 'none') return true;\n node = node.parentElement as HTMLElement;\n }\n return false;\n}\n\n/**\n * Returns the first visible element in a list.\n * NOTE: Only checks visibility up to the `container`.\n */\nexport function findVisible(elements: HTMLElement[], container: HTMLElement): HTMLElement | undefined {\n for (const element of elements) {\n // we stop checking if it's hidden at the `container` level (excluding)\n if (!isHidden(element, { upTo: container })) return element;\n }\n return undefined;\n}\n\n/**\n * Returns the first and last tabbable elements inside a container.\n */\nexport function getTabbableEdges(container: HTMLElement) {\n const candidates = getTabbableCandidates(container);\n const first = findVisible(candidates, container);\n const last = findVisible(candidates.reverse(), container);\n return [first, last] as const;\n}\n\nexport function isSelectableInput(element: any): element is FocusableTarget & { select: () => void } {\n return element instanceof HTMLInputElement && 'select' in element;\n}\n\nexport function focus(element?: FocusableTarget | null, { select = false } = {}) {\n // only focus if that element is focusable\n if (element && element.focus) {\n const previouslyFocusedElement = getActiveElement();\n // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users\n element.focus({ preventScroll: true });\n // only select if its not the same element, it supports selection and we need to select\n if (element !== previouslyFocusedElement && isSelectableInput(element) && select) {\n element.select();\n }\n }\n}\n","import {\n afterNextRender,\n booleanAttribute,\n computed,\n DestroyRef,\n Directive,\n effect,\n ElementRef,\n inject,\n Injector,\n input,\n output,\n Signal,\n signal\n} from '@angular/core';\nimport { BooleanInput, createContext, getActiveElement } from '@radix-ng/primitives/core';\nimport { RdxFocusScopeConfigToken } from './focus-scope.config';\nimport { createFocusScopesStack, FocusScopeAPI, removeLinks } from './stack';\nimport {\n AUTOFOCUS_ON_MOUNT,\n AUTOFOCUS_ON_UNMOUNT,\n EVENT_OPTIONS,\n focus,\n focusFirst,\n getTabbableCandidates,\n getTabbableEdges\n} from './utils';\n\nexport interface FocusScopeContext {\n loop?: Signal<boolean>;\n\n trapped?: Signal<boolean>;\n}\n\nexport const [injectFocusScopeContext, provideFocusScopeContext] =\n createContext<FocusScopeContext>('FocusScope Context');\n\nconst rootContext = (): FocusScopeContext => {\n const context = inject(RdxFocusScope);\n\n return {\n loop: context.loop,\n trapped: context.isTrapped\n };\n};\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxFocusScope]',\n providers: [provideFocusScopeContext(rootContext)],\n host: {\n tabindex: '-1',\n '(keydown)': 'handleKeyDown($event)'\n }\n})\nexport class RdxFocusScope {\n private readonly injector = inject(Injector);\n private readonly destroyRef = inject(DestroyRef);\n\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly config = inject(RdxFocusScopeConfigToken);\n\n /**\n * When `true`, tabbing from last item will focus first tabbable\n * and shift+tab from first item will focus last tababble.\n *\n * @group Props\n * @defaultValue false\n */\n readonly loop = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * When `true`, focus cannot escape the focus scope via keyboard,\n * pointer, or a programmatic focus.\n *\n * @group Props\n * @defaultValue false\n */\n readonly trapped = input<boolean | undefined, BooleanInput | undefined>(undefined, {\n transform: (value) => (value === undefined ? undefined : booleanAttribute(value))\n });\n\n readonly isTrapped = computed(() => this.trapped() ?? this.config.trapped());\n\n /**\n * Event handler called when auto-focusing on mount.\n * Can be prevented.\n *\n * @group Emits\n */\n readonly mountAutoFocus = output<Event>();\n\n /**\n * Event handler called when auto-focusing on unmount.\n * Can be prevented.\n *\n * @group Emits\n */\n readonly unmountAutoFocus = output<Event>();\n\n readonly lastFocusedElement = signal<HTMLElement | null>(null);\n\n private readonly focusScopesStack = createFocusScopesStack();\n\n readonly focusScope: FocusScopeAPI = {\n paused: signal(false),\n pause: () => this.focusScope.paused.set(true),\n resume: () => this.focusScope.paused.set(false)\n };\n\n private alive = true;\n\n constructor() {\n this.destroyRef.onDestroy(() => {\n this.alive = false;\n });\n\n afterNextRender(() => {\n effect(\n (onCleanup) => {\n const container = this.elementRef.nativeElement;\n\n if (this.isTrapped()) {\n const handleFocusIn = (event: FocusEvent) => {\n if (this.focusScope.paused() || !container) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n if (this.elementRef.nativeElement.contains(target)) {\n this.lastFocusedElement.set(target);\n } else {\n focus(this.lastFocusedElement(), { select: true });\n }\n };\n\n const handleFocusOut = (event: FocusEvent) => {\n if (this.focusScope.paused() || !container) {\n return;\n }\n const relatedTarget = event.relatedTarget as HTMLElement | null;\n\n // A `focusout` event with a `null` `relatedTarget` will happen in at least two cases:\n //\n // 1. When the user switches app/tabs/windows/the browser itself loses focus.\n // 2. In Google Chrome, when the focused element is removed from the DOM.\n //\n // We let the browser do its thing here because:\n //\n // 1. The browser already keeps a memory of what's focused for when the page gets refocused.\n // 2. In Google Chrome, if we try to focus the deleted focused element (as per below), it\n // throws the CPU to 100%, so we avoid doing anything for this reason here too.\n if (relatedTarget === null) return;\n\n // If the focus has moved to an actual legitimate element (`relatedTarget !== null`)\n // that is outside the container, we move focus to the last valid focused element inside.\n if (!container.contains(relatedTarget)) {\n focus(this.lastFocusedElement(), { select: true });\n }\n };\n\n const handleMutations = () => {\n const isLastFocusedElementExist = container.contains(this.lastFocusedElement());\n\n if (!isLastFocusedElementExist) {\n focus(container);\n }\n };\n\n const mutationObserver = new MutationObserver(handleMutations);\n if (container) {\n mutationObserver.observe(container, { childList: true, subtree: true });\n }\n\n document.addEventListener('focusin', handleFocusIn);\n document.addEventListener('focusout', handleFocusOut);\n\n onCleanup(() => {\n document.removeEventListener('focusin', handleFocusIn);\n document.removeEventListener('focusout', handleFocusOut);\n mutationObserver.disconnect();\n });\n }\n },\n { injector: this.injector }\n );\n\n effect(\n async (onCleanup) => {\n const container = this.elementRef.nativeElement;\n\n await Promise.resolve();\n if (!container || !this.alive) {\n return;\n }\n\n this.focusScopesStack.add(this.focusScope);\n\n const previouslyFocusedElement = getActiveElement() as HTMLElement | null;\n const hasFocusedCandidate = container.contains(previouslyFocusedElement);\n const mountEventHandler = (ev: Event) => {\n if (this.alive) this.mountAutoFocus.emit(ev);\n };\n\n if (!hasFocusedCandidate) {\n const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);\n container.addEventListener(AUTOFOCUS_ON_MOUNT, mountEventHandler);\n container.dispatchEvent(mountEvent);\n\n if (!mountEvent.defaultPrevented) {\n focusFirst(removeLinks(getTabbableCandidates(container)), {\n select: true\n });\n if (getActiveElement() === previouslyFocusedElement) focus(container);\n }\n }\n\n const unmountEventHandler = (ev: Event) => {\n if (this.alive) this.unmountAutoFocus.emit(ev);\n };\n container.addEventListener(AUTOFOCUS_ON_UNMOUNT, unmountEventHandler);\n\n onCleanup(() => {\n container.removeEventListener(AUTOFOCUS_ON_MOUNT, mountEventHandler);\n\n const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);\n container.dispatchEvent(unmountEvent);\n\n setTimeout(() => {\n if (!unmountEvent.defaultPrevented)\n focus(previouslyFocusedElement ?? document.body, { select: true });\n\n // we need to remove the listener after we `dispatchEvent`\n container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, unmountEventHandler);\n\n this.focusScopesStack.remove(this.focusScope);\n }, 0);\n });\n },\n { injector: this.injector }\n );\n });\n }\n\n handleKeyDown(event: KeyboardEvent) {\n const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;\n\n const focusedElement = getActiveElement() as HTMLElement | null;\n\n if (isTabKey && focusedElement) {\n const container = event.currentTarget as HTMLElement;\n\n const [first, last] = getTabbableEdges(container);\n const hasTabbableElementsInside = first && last;\n\n // we can only wrap focus if we have tabbable edges\n if (!hasTabbableElementsInside) {\n if (focusedElement === container) event.preventDefault();\n } else {\n if (!event.shiftKey && focusedElement === last) {\n event.preventDefault();\n if (this.loop()) {\n focus(first, { select: true });\n }\n } else if (event.shiftKey && focusedElement === first) {\n event.preventDefault();\n if (this.loop()) {\n focus(last, { select: true });\n }\n }\n }\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAMa,wBAAwB,GAAG,IAAI,cAAc,CAAsB,qBAAqB,EAAE;AACnG,IAAA,OAAO,EAAE,OAAO;AACZ,QAAA,OAAO,EAAE,MAAM,CAAC,KAAK;KACxB;AACJ,CAAA;AAEK,SAAU,0BAA0B,CAAC,OAAkC,EAAA;IACzE,OAAO,EAAE,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,OAAO,EAAE;AACrE;;ACZM,SAAU,iBAAiB,CAAI,OAAgB,EAAA;AACjD,IAAA,MAAM,KAAK,GAAG,OAAO,EAAE;AACvB,IAAA,OAAO,MAAM,KAAK;AACtB;AAQA,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,MAAM,MAAM,CAAkB,EAAE,CAAC,CAAC;SAE/D,sBAAsB,GAAA;;AAElC,IAAA,MAAM,KAAK,GAAG,kBAAkB,EAAE;IAElC,OAAO;AACH,QAAA,GAAG,CAAC,UAAyB,EAAA;AACzB,YAAA,MAAM,OAAO,GAAG,KAAK,EAAE;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,IAAI,cAAc,KAAK,IAAI,EAAE;oBAC5C,KAAK,CAAC,cAAc,EAAE;AACtB,oBAAA,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE;wBACb,KAAK,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;oBAClC;gBACJ;qBAAO,IAAI,KAAK,CAAC,QAAQ,IAAI,cAAc,KAAK,KAAK,EAAE;oBACnD,KAAK,CAAC,cAAc,EAAE;AACtB,oBAAA,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE;wBACb,KAAK,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;oBACjC;gBACJ;YACJ;QACJ;IACJ;8GAzNS,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAb,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,aAAa,ifANX,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAMzC,aAAa,EAAA,UAAA,EAAA,CAAA;kBARzB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,SAAS,EAAE,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC;AAClD,oBAAA,IAAI,EAAE;AACF,wBAAA,QAAQ,EAAE,IAAI;AACd,wBAAA,WAAW,EAAE;AAChB;AACJ,iBAAA;;;ACxDD;;AAEG;;;;"}
@@ -0,0 +1,172 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ElementRef, signal, input, model, booleanAttribute, output, computed, effect, afterNextRender, Directive } from '@angular/core';
3
+ import { injectFieldRootContext } from '@radix-ng/primitives/field';
4
+
5
+ let inputId = 0;
6
+ const attr = (value) => (value ? '' : undefined);
7
+ /**
8
+ * A headless text input that can integrate with Field for accessible labeling,
9
+ * descriptions, validation state, and data attributes.
10
+ *
11
+ * @group Components
12
+ */
13
+ class RdxInputDirective {
14
+ constructor() {
15
+ this.element = inject(ElementRef).nativeElement;
16
+ this.fieldRootContext = injectFieldRootContext(true);
17
+ this.initialValue = '';
18
+ this.defaultValueApplied = false;
19
+ this.filledValue = signal(false, ...(ngDevMode ? [{ debugName: "filledValue" }] : /* istanbul ignore next */ []));
20
+ this.focusedValue = signal(false, ...(ngDevMode ? [{ debugName: "focusedValue" }] : /* istanbul ignore next */ []));
21
+ /**
22
+ * The input id. Field labels and descriptions use this value for accessible relationships.
23
+ *
24
+ * @group Props
25
+ */
26
+ this.id = input(`rdx-input-${inputId++}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
27
+ /**
28
+ * The controlled input value.
29
+ *
30
+ * @group Props
31
+ */
32
+ this.value = model(undefined, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
33
+ /**
34
+ * The initial value when the input is uncontrolled.
35
+ *
36
+ * @group Props
37
+ */
38
+ this.defaultValue = input(undefined, ...(ngDevMode ? [{ debugName: "defaultValue" }] : /* istanbul ignore next */ []));
39
+ /**
40
+ * Whether the input is disabled.
41
+ *
42
+ * @group Props
43
+ */
44
+ this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
45
+ /**
46
+ * Whether the input is required.
47
+ *
48
+ * @group Props
49
+ */
50
+ this.required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
51
+ /**
52
+ * Whether the input is invalid.
53
+ *
54
+ * @group Props
55
+ */
56
+ this.invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
57
+ /**
58
+ * Emits when the input value changes.
59
+ *
60
+ * @group Emits
61
+ */
62
+ this.onValueChange = output();
63
+ this.invalidState = computed(() => this.invalid() || Boolean(this.fieldRootContext?.invalidState()), ...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
64
+ this.disabledState = computed(() => this.disabled() || Boolean(this.fieldRootContext?.disabledState()), ...(ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []));
65
+ this.requiredState = computed(() => this.required() || Boolean(this.fieldRootContext?.requiredState()), ...(ngDevMode ? [{ debugName: "requiredState" }] : /* istanbul ignore next */ []));
66
+ this.filledState = computed(() => this.filledValue() || Boolean(this.fieldRootContext?.filledState()), ...(ngDevMode ? [{ debugName: "filledState" }] : /* istanbul ignore next */ []));
67
+ this.focusedState = computed(() => this.focusedValue() || Boolean(this.fieldRootContext?.focusedState()), ...(ngDevMode ? [{ debugName: "focusedState" }] : /* istanbul ignore next */ []));
68
+ this.describedBy = computed(() => {
69
+ if (!this.fieldRootContext) {
70
+ return undefined;
71
+ }
72
+ const ids = [
73
+ ...this.fieldRootContext.descriptionIds(),
74
+ ...(this.fieldRootContext.invalidState() ? this.fieldRootContext.errorIds() : [])
75
+ ];
76
+ return ids.length ? ids.join(' ') : undefined;
77
+ }, ...(ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []));
78
+ this.dataAttr = attr;
79
+ effect(() => {
80
+ const value = this.value();
81
+ if (value !== undefined) {
82
+ this.writeValue(value);
83
+ }
84
+ });
85
+ effect(() => {
86
+ const defaultValue = this.defaultValue();
87
+ if (this.value() === undefined && defaultValue !== undefined && !this.defaultValueApplied) {
88
+ this.defaultValueApplied = true;
89
+ this.writeValue(defaultValue);
90
+ }
91
+ });
92
+ effect(() => {
93
+ this.fieldRootContext?.setControlId(this.id());
94
+ });
95
+ afterNextRender(() => {
96
+ this.initialValue = this.element.value;
97
+ this.syncFieldState();
98
+ });
99
+ }
100
+ onFocus() {
101
+ this.focusedValue.set(true);
102
+ this.fieldRootContext?.setFocused(true);
103
+ }
104
+ onBlur() {
105
+ this.focusedValue.set(false);
106
+ this.fieldRootContext?.setFocused(false);
107
+ this.fieldRootContext?.setTouched(true);
108
+ }
109
+ onInput(event) {
110
+ const nextValue = this.element.value;
111
+ let canceled = false;
112
+ const eventDetails = {
113
+ event,
114
+ cancel: () => {
115
+ canceled = true;
116
+ },
117
+ isCanceled: () => canceled
118
+ };
119
+ this.onValueChange.emit({ value: nextValue, eventDetails });
120
+ if (canceled) {
121
+ this.writeValue(this.value() ?? this.defaultValue() ?? '');
122
+ return;
123
+ }
124
+ this.value.set(nextValue);
125
+ this.syncFieldState();
126
+ }
127
+ syncFieldState() {
128
+ const value = this.element.value;
129
+ this.filledValue.set(value !== '');
130
+ this.fieldRootContext?.setFilled(value !== '');
131
+ this.fieldRootContext?.setDirty(value !== this.initialValue);
132
+ }
133
+ writeValue(value) {
134
+ this.element.value = Array.isArray(value) ? value.join(',') : String(value);
135
+ this.syncFieldState();
136
+ }
137
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
138
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxInputDirective, isStandalone: true, selector: "input[rdxInput]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", onValueChange: "onValueChange" }, host: { listeners: { "focus": "onFocus()", "blur": "onBlur()", "input": "onInput($event)", "change": "syncFieldState()" }, properties: { "attr.id": "id()", "attr.aria-describedby": "describedBy()", "attr.aria-invalid": "invalidState() ? \"true\" : undefined", "attr.aria-required": "requiredState() ? \"true\" : undefined", "attr.aria-disabled": "disabledState() ? \"true\" : undefined", "attr.disabled": "disabledState() ? \"\" : undefined", "attr.required": "requiredState() ? \"\" : undefined", "attr.data-invalid": "dataAttr(invalidState())", "attr.data-valid": "dataAttr(!invalidState())", "attr.data-disabled": "dataAttr(disabledState())", "attr.data-required": "dataAttr(requiredState())", "attr.data-filled": "dataAttr(filledState())", "attr.data-focused": "dataAttr(focusedState())" } }, exportAs: ["rdxInput"], ngImport: i0 }); }
139
+ }
140
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxInputDirective, decorators: [{
141
+ type: Directive,
142
+ args: [{
143
+ selector: 'input[rdxInput]',
144
+ exportAs: 'rdxInput',
145
+ host: {
146
+ '[attr.id]': 'id()',
147
+ '[attr.aria-describedby]': 'describedBy()',
148
+ '[attr.aria-invalid]': 'invalidState() ? "true" : undefined',
149
+ '[attr.aria-required]': 'requiredState() ? "true" : undefined',
150
+ '[attr.aria-disabled]': 'disabledState() ? "true" : undefined',
151
+ '[attr.disabled]': 'disabledState() ? "" : undefined',
152
+ '[attr.required]': 'requiredState() ? "" : undefined',
153
+ '[attr.data-invalid]': 'dataAttr(invalidState())',
154
+ '[attr.data-valid]': 'dataAttr(!invalidState())',
155
+ '[attr.data-disabled]': 'dataAttr(disabledState())',
156
+ '[attr.data-required]': 'dataAttr(requiredState())',
157
+ '[attr.data-filled]': 'dataAttr(filledState())',
158
+ '[attr.data-focused]': 'dataAttr(focusedState())',
159
+ '(focus)': 'onFocus()',
160
+ '(blur)': 'onBlur()',
161
+ '(input)': 'onInput($event)',
162
+ '(change)': 'syncFieldState()'
163
+ }
164
+ }]
165
+ }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], defaultValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValue", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], onValueChange: [{ type: i0.Output, args: ["onValueChange"] }] } });
166
+
167
+ /**
168
+ * Generated bundle index. Do not edit.
169
+ */
170
+
171
+ export { RdxInputDirective };
172
+ //# sourceMappingURL=radix-ng-primitives-input.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radix-ng-primitives-input.mjs","sources":["../../../packages/primitives/input/src/input.directive.ts","../../../packages/primitives/input/radix-ng-primitives-input.ts"],"sourcesContent":["import {\n afterNextRender,\n booleanAttribute,\n computed,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n model,\n output,\n signal\n} from '@angular/core';\nimport { BooleanInput, RdxFormValueControl } from '@radix-ng/primitives/core';\nimport { injectFieldRootContext } from '@radix-ng/primitives/field';\n\nlet inputId = 0;\n\nconst attr = (value: boolean) => (value ? '' : undefined);\n\nexport type RdxInputValue = string | number | readonly string[];\n\nexport interface RdxInputValueChangeEventDetails {\n event: Event;\n cancel: () => void;\n isCanceled: () => boolean;\n}\n\nexport interface RdxInputValueChangeEvent {\n value: string;\n eventDetails: RdxInputValueChangeEventDetails;\n}\n\n/**\n * A headless text input that can integrate with Field for accessible labeling,\n * descriptions, validation state, and data attributes.\n *\n * @group Components\n */\n@Directive({\n selector: 'input[rdxInput]',\n exportAs: 'rdxInput',\n host: {\n '[attr.id]': 'id()',\n '[attr.aria-describedby]': 'describedBy()',\n '[attr.aria-invalid]': 'invalidState() ? \"true\" : undefined',\n '[attr.aria-required]': 'requiredState() ? \"true\" : undefined',\n '[attr.aria-disabled]': 'disabledState() ? \"true\" : undefined',\n '[attr.disabled]': 'disabledState() ? \"\" : undefined',\n '[attr.required]': 'requiredState() ? \"\" : undefined',\n '[attr.data-invalid]': 'dataAttr(invalidState())',\n '[attr.data-valid]': 'dataAttr(!invalidState())',\n '[attr.data-disabled]': 'dataAttr(disabledState())',\n '[attr.data-required]': 'dataAttr(requiredState())',\n '[attr.data-filled]': 'dataAttr(filledState())',\n '[attr.data-focused]': 'dataAttr(focusedState())',\n '(focus)': 'onFocus()',\n '(blur)': 'onBlur()',\n '(input)': 'onInput($event)',\n '(change)': 'syncFieldState()'\n }\n})\nexport class RdxInputDirective implements RdxFormValueControl<RdxInputValue | undefined> {\n private readonly element = inject<ElementRef<HTMLInputElement>>(ElementRef).nativeElement;\n private readonly fieldRootContext = injectFieldRootContext(true);\n private initialValue = '';\n private defaultValueApplied = false;\n private readonly filledValue = signal(false);\n private readonly focusedValue = signal(false);\n\n /**\n * The input id. Field labels and descriptions use this value for accessible relationships.\n *\n * @group Props\n */\n readonly id = input(`rdx-input-${inputId++}`);\n\n /**\n * The controlled input value.\n *\n * @group Props\n */\n readonly value = model<RdxInputValue | undefined>(undefined);\n\n /**\n * The initial value when the input is uncontrolled.\n *\n * @group Props\n */\n readonly defaultValue = input<RdxInputValue | undefined>(undefined);\n\n /**\n * Whether the input is disabled.\n *\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether the input is required.\n *\n * @group Props\n */\n readonly required = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether the input is invalid.\n *\n * @group Props\n */\n readonly invalid = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Emits when the input value changes.\n *\n * @group Emits\n */\n readonly onValueChange = output<RdxInputValueChangeEvent>();\n\n protected readonly invalidState = computed(() => this.invalid() || Boolean(this.fieldRootContext?.invalidState()));\n protected readonly disabledState = computed(\n () => this.disabled() || Boolean(this.fieldRootContext?.disabledState())\n );\n protected readonly requiredState = computed(\n () => this.required() || Boolean(this.fieldRootContext?.requiredState())\n );\n protected readonly filledState = computed(\n () => this.filledValue() || Boolean(this.fieldRootContext?.filledState())\n );\n protected readonly focusedState = computed(\n () => this.focusedValue() || Boolean(this.fieldRootContext?.focusedState())\n );\n\n protected readonly describedBy = computed(() => {\n if (!this.fieldRootContext) {\n return undefined;\n }\n\n const ids = [\n ...this.fieldRootContext.descriptionIds(),\n ...(this.fieldRootContext.invalidState() ? this.fieldRootContext.errorIds() : [])\n ];\n\n return ids.length ? ids.join(' ') : undefined;\n });\n\n constructor() {\n effect(() => {\n const value = this.value();\n\n if (value !== undefined) {\n this.writeValue(value);\n }\n });\n\n effect(() => {\n const defaultValue = this.defaultValue();\n\n if (this.value() === undefined && defaultValue !== undefined && !this.defaultValueApplied) {\n this.defaultValueApplied = true;\n this.writeValue(defaultValue);\n }\n });\n\n effect(() => {\n this.fieldRootContext?.setControlId(this.id());\n });\n\n afterNextRender(() => {\n this.initialValue = this.element.value;\n this.syncFieldState();\n });\n }\n\n onFocus(): void {\n this.focusedValue.set(true);\n this.fieldRootContext?.setFocused(true);\n }\n\n onBlur(): void {\n this.focusedValue.set(false);\n this.fieldRootContext?.setFocused(false);\n this.fieldRootContext?.setTouched(true);\n }\n\n onInput(event: Event): void {\n const nextValue = this.element.value;\n let canceled = false;\n\n const eventDetails: RdxInputValueChangeEventDetails = {\n event,\n cancel: () => {\n canceled = true;\n },\n isCanceled: () => canceled\n };\n\n this.onValueChange.emit({ value: nextValue, eventDetails });\n\n if (canceled) {\n this.writeValue(this.value() ?? this.defaultValue() ?? '');\n return;\n }\n\n this.value.set(nextValue);\n this.syncFieldState();\n }\n\n syncFieldState(): void {\n const value = this.element.value;\n\n this.filledValue.set(value !== '');\n this.fieldRootContext?.setFilled(value !== '');\n this.fieldRootContext?.setDirty(value !== this.initialValue);\n }\n\n private writeValue(value: RdxInputValue): void {\n this.element.value = Array.isArray(value) ? value.join(',') : String(value);\n this.syncFieldState();\n }\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BAA2B;AAChD,wBAAA,sBAAsB,EAAE,2BAA2B;AACnD,wBAAA,sBAAsB,EAAE,2BAA2B;AACnD,wBAAA,oBAAoB,EAAE,yBAAyB;AAC/C,wBAAA,qBAAqB,EAAE,0BAA0B;AACjD,wBAAA,SAAS,EAAE,WAAW;AACtB,wBAAA,QAAQ,EAAE,UAAU;AACpB,wBAAA,SAAS,EAAE,iBAAiB;AAC5B,wBAAA,UAAU,EAAE;AACf;AACJ,iBAAA;;;AC7DD;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ElementRef, input, computed, Directive } from '@angular/core';
2
+ import { inject, ElementRef, input, Directive } from '@angular/core';
3
3
 
4
4
  let idIterator = 0;
5
5
  /**
@@ -18,7 +18,6 @@ class RdxLabelDirective {
18
18
  * @defaultValue false
19
19
  */
20
20
  this.htmlFor = input(...(ngDevMode ? [undefined, { debugName: "htmlFor" }] : /* istanbul ignore next */ []));
21
- this.elementId = computed(() => (this.id() ? this.id() : null), ...(ngDevMode ? [{ debugName: "elementId" }] : /* istanbul ignore next */ []));
22
21
  }
23
22
  // prevent text selection when double-clicking label
24
23
  // The main problem with double-clicks in a web app is that
@@ -28,8 +27,9 @@ class RdxLabelDirective {
28
27
  */
29
28
  onMouseDown(event) {
30
29
  const target = event.target;
31
- // only prevent text selection if clicking inside the label itself
32
- if (['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA'].includes(target.tagName)) {
30
+ // only prevent text selection if not clicking inside an interactive control (or its
31
+ // descendants), so clicks still focus/activate the associated control.
32
+ if (target.closest('button, input, select, textarea')) {
33
33
  return;
34
34
  }
35
35
  // prevent text selection when double-clicking label
@@ -38,7 +38,7 @@ class RdxLabelDirective {
38
38
  }
39
39
  }
40
40
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxLabelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
41
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxLabelDirective, isStandalone: true, selector: "label[rdxLabel]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, htmlFor: { classPropertyName: "htmlFor", publicName: "htmlFor", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mousedown": "onMouseDown($event)" }, properties: { "attr.id": "elementId()", "attr.for": "htmlFor() ? htmlFor() : undefined" } }, exportAs: ["rdxLabel"], ngImport: i0 }); }
41
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxLabelDirective, isStandalone: true, selector: "label[rdxLabel]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, htmlFor: { classPropertyName: "htmlFor", publicName: "htmlFor", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mousedown": "onMouseDown($event)" }, properties: { "attr.id": "id()", "attr.for": "htmlFor() ? htmlFor() : undefined" } }, exportAs: ["rdxLabel"], ngImport: i0 }); }
42
42
  }
43
43
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxLabelDirective, decorators: [{
44
44
  type: Directive,
@@ -46,7 +46,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
46
46
  selector: 'label[rdxLabel]',
47
47
  exportAs: 'rdxLabel',
48
48
  host: {
49
- '[attr.id]': 'elementId()',
49
+ '[attr.id]': 'id()',
50
50
  '[attr.for]': 'htmlFor() ? htmlFor() : undefined',
51
51
  '(mousedown)': 'onMouseDown($event)'
52
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"radix-ng-primitives-label.mjs","sources":["../../../packages/primitives/label/src/label.directive.ts","../../../packages/primitives/label/radix-ng-primitives-label.ts"],"sourcesContent":["import { computed, Directive, ElementRef, inject, input } from '@angular/core';\n\nlet idIterator = 0;\n\n/**\n * @group Components\n */\n@Directive({\n selector: 'label[rdxLabel]',\n exportAs: 'rdxLabel',\n host: {\n '[attr.id]': 'elementId()',\n '[attr.for]': 'htmlFor() ? htmlFor() : undefined',\n '(mousedown)': 'onMouseDown($event)'\n }\n})\nexport class RdxLabelDirective {\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n\n /**\n * @default 'rdx-label-{idIterator}'\n */\n readonly id = input<string>(`rdx-label-${idIterator++}`);\n\n /**\n * The id of the element the label is associated with.\n * @group Props\n * @defaultValue false\n */\n readonly htmlFor = input<string>();\n\n protected readonly elementId = computed(() => (this.id() ? this.id() : null));\n\n // prevent text selection when double-clicking label\n // The main problem with double-clicks in a web app is that\n // you will have to create special code to handle this on touch enabled devices.\n /**\n * @ignore\n */\n onMouseDown(event: MouseEvent): void {\n const target = event.target as HTMLElement;\n\n // only prevent text selection if clicking inside the label itself\n if (['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA'].includes(target.tagName)) {\n return;\n }\n\n // prevent text selection when double-clicking label\n if (this.elementRef.nativeElement.contains(target) && !event.defaultPrevented && event.detail > 1) {\n event.preventDefault();\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA,IAAI,UAAU,GAAG,CAAC;AAElB;;AAEG;MAUU,iBAAiB,CAAA;AAT9B,IAAA,WAAA,GAAA;AAUqB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,EAAC,UAAuB,EAAC;AAE7D;;AAEG;QACM,IAAA,CAAA,EAAE,GAAG,KAAK,CAAS,CAAA,UAAA,EAAa,UAAU,EAAE,CAAA,CAAE,yEAAC;AAExD;;;;AAIG;QACM,IAAA,CAAA,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;QAEf,IAAA,CAAA,SAAS,GAAG,QAAQ,CAAC,OA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AA,mCAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,UAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAT7B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,QAAQ,EAAE,UAAU;AACpB,oBAAA,IAAI,EAAE;AACF,wBAAA,WAAW,EAAE,aAAa;AAC1B,wBAAA,YAAY,EAAE,mCAAmC;AACjD,wBAAA,aAAa,EAAE;AAClB;AACJ,iBAAA;;;ACfD;;AAEG;;;;"}
1
+ {"version":3,"file":"radix-ng-primitives-label.mjs","sources":["../../../packages/primitives/label/src/label.directive.ts","../../../packages/primitives/label/radix-ng-primitives-label.ts"],"sourcesContent":["import { Directive, ElementRef, inject, input } from '@angular/core';\n\nlet idIterator = 0;\n\n/**\n * @group Components\n */\n@Directive({\n selector: 'label[rdxLabel]',\n exportAs: 'rdxLabel',\n host: {\n '[attr.id]': 'id()',\n '[attr.for]': 'htmlFor() ? htmlFor() : undefined',\n '(mousedown)': 'onMouseDown($event)'\n }\n})\nexport class RdxLabelDirective {\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n\n /**\n * @default 'rdx-label-{idIterator}'\n */\n readonly id = input<string>(`rdx-label-${idIterator++}`);\n\n /**\n * The id of the element the label is associated with.\n * @group Props\n * @defaultValue false\n */\n readonly htmlFor = input<string>();\n\n // prevent text selection when double-clicking label\n // The main problem with double-clicks in a web app is that\n // you will have to create special code to handle this on touch enabled devices.\n /**\n * @ignore\n */\n onMouseDown(event: MouseEvent): void {\n const target = event.target as HTMLElement;\n\n // only prevent text selection if not clicking inside an interactive control (or its\n // descendants), so clicks still focus/activate the associated control.\n if (target.closest('button, input, select, textarea')) {\n return;\n }\n\n // prevent text selection when double-clicking label\n if (this.elementRef.nativeElement.contains(target) && !event.defaultPrevented && event.detail > 1) {\n event.preventDefault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