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

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 (107) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +76 -6
  3. package/fesm2022/radix-ng-primitives-accordion.mjs +2 -2
  4. package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
  5. package/fesm2022/radix-ng-primitives-alert-dialog.mjs +30 -24
  6. package/fesm2022/radix-ng-primitives-alert-dialog.mjs.map +1 -1
  7. package/fesm2022/radix-ng-primitives-autocomplete.mjs +1786 -0
  8. package/fesm2022/radix-ng-primitives-autocomplete.mjs.map +1 -0
  9. package/fesm2022/radix-ng-primitives-calendar.mjs +14 -1
  10. package/fesm2022/radix-ng-primitives-calendar.mjs.map +1 -1
  11. package/fesm2022/radix-ng-primitives-checkbox.mjs +2 -2
  12. package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
  13. package/fesm2022/radix-ng-primitives-collapsible.mjs +1 -1
  14. package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
  15. package/fesm2022/radix-ng-primitives-combobox.mjs +1983 -0
  16. package/fesm2022/radix-ng-primitives-combobox.mjs.map +1 -0
  17. package/fesm2022/radix-ng-primitives-context-menu.mjs +1 -1
  18. package/fesm2022/radix-ng-primitives-context-menu.mjs.map +1 -1
  19. package/fesm2022/radix-ng-primitives-core.mjs +480 -469
  20. package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
  21. package/fesm2022/radix-ng-primitives-cropper.mjs +1 -1
  22. package/fesm2022/radix-ng-primitives-cropper.mjs.map +1 -1
  23. package/fesm2022/radix-ng-primitives-date-field.mjs +11 -0
  24. package/fesm2022/radix-ng-primitives-date-field.mjs.map +1 -1
  25. package/fesm2022/radix-ng-primitives-dialog.mjs +44 -46
  26. package/fesm2022/radix-ng-primitives-dialog.mjs.map +1 -1
  27. package/fesm2022/radix-ng-primitives-drawer.mjs +154 -64
  28. package/fesm2022/radix-ng-primitives-drawer.mjs.map +1 -1
  29. package/fesm2022/radix-ng-primitives-editable.mjs +1 -1
  30. package/fesm2022/radix-ng-primitives-editable.mjs.map +1 -1
  31. package/fesm2022/radix-ng-primitives-field.mjs +86 -6
  32. package/fesm2022/radix-ng-primitives-field.mjs.map +1 -1
  33. package/fesm2022/radix-ng-primitives-fieldset.mjs +1 -1
  34. package/fesm2022/radix-ng-primitives-fieldset.mjs.map +1 -1
  35. package/fesm2022/radix-ng-primitives-focus-scope.mjs +1 -1
  36. package/fesm2022/radix-ng-primitives-focus-scope.mjs.map +1 -1
  37. package/fesm2022/radix-ng-primitives-form.mjs +207 -0
  38. package/fesm2022/radix-ng-primitives-form.mjs.map +1 -0
  39. package/fesm2022/radix-ng-primitives-input.mjs +85 -4
  40. package/fesm2022/radix-ng-primitives-input.mjs.map +1 -1
  41. package/fesm2022/radix-ng-primitives-menu.mjs +44 -24
  42. package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
  43. package/fesm2022/radix-ng-primitives-menubar.mjs +1 -1
  44. package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
  45. package/fesm2022/radix-ng-primitives-meter.mjs +1 -1
  46. package/fesm2022/radix-ng-primitives-meter.mjs.map +1 -1
  47. package/fesm2022/radix-ng-primitives-navigation-menu.mjs +39 -55
  48. package/fesm2022/radix-ng-primitives-navigation-menu.mjs.map +1 -1
  49. package/fesm2022/radix-ng-primitives-number-field.mjs +2 -2
  50. package/fesm2022/radix-ng-primitives-number-field.mjs.map +1 -1
  51. package/fesm2022/radix-ng-primitives-popover.mjs +36 -51
  52. package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
  53. package/fesm2022/radix-ng-primitives-popper.mjs +12 -6
  54. package/fesm2022/radix-ng-primitives-popper.mjs.map +1 -1
  55. package/fesm2022/radix-ng-primitives-portal.mjs +107 -17
  56. package/fesm2022/radix-ng-primitives-portal.mjs.map +1 -1
  57. package/fesm2022/radix-ng-primitives-presence.mjs +262 -79
  58. package/fesm2022/radix-ng-primitives-presence.mjs.map +1 -1
  59. package/fesm2022/radix-ng-primitives-preview-card.mjs +37 -51
  60. package/fesm2022/radix-ng-primitives-preview-card.mjs.map +1 -1
  61. package/fesm2022/radix-ng-primitives-progress.mjs +1 -1
  62. package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
  63. package/fesm2022/radix-ng-primitives-roving-focus.mjs +1 -1
  64. package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -1
  65. package/fesm2022/radix-ng-primitives-scroll-area.mjs +3 -3
  66. package/fesm2022/radix-ng-primitives-scroll-area.mjs.map +1 -1
  67. package/fesm2022/radix-ng-primitives-select.mjs +469 -258
  68. package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
  69. package/fesm2022/radix-ng-primitives-slider.mjs +1 -1
  70. package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
  71. package/fesm2022/radix-ng-primitives-switch.mjs +3 -2
  72. package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
  73. package/fesm2022/radix-ng-primitives-tabs.mjs +1 -1
  74. package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
  75. package/fesm2022/radix-ng-primitives-time-field.mjs +27 -3
  76. package/fesm2022/radix-ng-primitives-time-field.mjs.map +1 -1
  77. package/fesm2022/radix-ng-primitives-toast.mjs +1 -1
  78. package/fesm2022/radix-ng-primitives-toast.mjs.map +1 -1
  79. package/fesm2022/radix-ng-primitives-toggle-group.mjs +1 -1
  80. package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
  81. package/fesm2022/radix-ng-primitives-toolbar.mjs +2 -2
  82. package/fesm2022/radix-ng-primitives-toolbar.mjs.map +1 -1
  83. package/fesm2022/radix-ng-primitives-tooltip.mjs +39 -42
  84. package/fesm2022/radix-ng-primitives-tooltip.mjs.map +1 -1
  85. package/package.json +13 -1
  86. package/schematics/ng-add/index.js +57 -0
  87. package/schematics/ng-add/index.js.map +1 -1
  88. package/schematics/ng-add/schema.d.ts +1 -0
  89. package/schematics/ng-add/schema.json +6 -0
  90. package/types/radix-ng-primitives-alert-dialog.d.ts +17 -11
  91. package/types/radix-ng-primitives-autocomplete.d.ts +596 -0
  92. package/types/radix-ng-primitives-combobox.d.ts +1310 -0
  93. package/types/radix-ng-primitives-core.d.ts +148 -56
  94. package/types/radix-ng-primitives-dialog.d.ts +32 -25
  95. package/types/radix-ng-primitives-drawer.d.ts +49 -22
  96. package/types/radix-ng-primitives-field.d.ts +71 -2
  97. package/types/radix-ng-primitives-form.d.ts +124 -0
  98. package/types/radix-ng-primitives-input.d.ts +75 -5
  99. package/types/radix-ng-primitives-menu.d.ts +19 -10
  100. package/types/radix-ng-primitives-navigation-menu.d.ts +24 -26
  101. package/types/radix-ng-primitives-popover.d.ts +23 -23
  102. package/types/radix-ng-primitives-popper.d.ts +7 -1
  103. package/types/radix-ng-primitives-portal.d.ts +53 -8
  104. package/types/radix-ng-primitives-presence.d.ts +98 -17
  105. package/types/radix-ng-primitives-preview-card.d.ts +24 -23
  106. package/types/radix-ng-primitives-select.d.ts +294 -137
  107. package/types/radix-ng-primitives-tooltip.d.ts +26 -19
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, model, input, booleanAttribute, output, signal, computed, effect, untracked, Directive, ElementRef, DestroyRef, numberAttribute, PLATFORM_ID, afterNextRender, NgModule } from '@angular/core';
2
+ import { inject, model, input, booleanAttribute, output, signal, computed, effect, untracked, Directive, ElementRef, DestroyRef, isDevMode, numberAttribute, PLATFORM_ID, afterNextRender, NgModule } from '@angular/core';
3
3
  import * as i1 from '@radix-ng/primitives/popper';
4
4
  import { RdxPopper, RdxPopperContentWrapper, RdxPopperArrow, RdxPopperContent, provideRdxPopperContentConfig, RdxPopperAnchor } from '@radix-ng/primitives/popper';
5
5
  import { createContext, useTransitionStatus, getMaxTransitionDuration } from '@radix-ng/primitives/core';
@@ -9,10 +9,11 @@ import { RdxDismissableLayer, RdxDismissableLayersContextToken, provideRdxDismis
9
9
  import * as i3 from '@radix-ng/primitives/focus-scope';
10
10
  import { RdxFocusScope, provideRdxFocusScopeConfig } from '@radix-ng/primitives/focus-scope';
11
11
  import * as i1$1 from '@radix-ng/primitives/portal';
12
- import { RdxPortal } from '@radix-ng/primitives/portal';
12
+ import { RdxPortalPresence } from '@radix-ng/primitives/portal';
13
+ import { provideRdxPresenceContext } from '@radix-ng/primitives/presence';
13
14
  import { isPlatformBrowser } from '@angular/common';
14
15
 
15
- const [injectRdxMenuRootContext, provideRdxMenuRootContext] = createContext('RdxMenuRootContext');
16
+ const [injectRdxMenuRootContext, provideRdxMenuRootContext] = createContext('RdxMenuRootContext', 'components/menu');
16
17
  function buildContext(instance) {
17
18
  return {
18
19
  isOpen: instance.open,
@@ -254,7 +255,7 @@ function getCheckedState(checked) {
254
255
  return isIndeterminate(checked) ? 'indeterminate' : checked ? 'checked' : 'unchecked';
255
256
  }
256
257
 
257
- const [injectRdxMenuCheckboxItemContext, provideRdxMenuCheckboxItemContext] = createContext('RdxMenuCheckboxItemContext');
258
+ const [injectRdxMenuCheckboxItemContext, provideRdxMenuCheckboxItemContext] = createContext('RdxMenuCheckboxItemContext', 'components/menu');
258
259
  const checkboxItemContextFactory = () => {
259
260
  const instance = inject(RdxMenuCheckboxItem);
260
261
  return {
@@ -845,32 +846,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
845
846
  }], ctorParameters: () => [], propDecorators: { escapeKeyDown: [{ type: i0.Output, args: ["escapeKeyDown"] }], pointerDownOutside: [{ type: i0.Output, args: ["pointerDownOutside"] }], focusOutside: [{ type: i0.Output, args: ["focusOutside"] }], interactOutside: [{ type: i0.Output, args: ["interactOutside"] }], openAutoFocus: [{ type: i0.Output, args: ["openAutoFocus"] }], closeAutoFocus: [{ type: i0.Output, args: ["closeAutoFocus"] }] } });
846
847
 
847
848
  /**
848
- * Moves the menu to a different part of the DOM.
849
- * Applied on ng-template no host bindings (ng-template is not a real DOM node).
849
+ * Structural directive that teleports the menu popup into a container (default `document.body`) while
850
+ * the menu is open, and keeps it mounted until any CSS exit `@keyframes` finishes.
851
+ *
852
+ * This replaces the consumer-owned `@if (root.open())` mount: it adds both teleporting *and*
853
+ * exit-animation support. Apply it with the `*` microsyntax on the positioner —
854
+ * `<div *rdxMenuPortal rdxMenuPositioner>` — or as an explicit `<ng-template rdxMenuPortal>`. For a
855
+ * custom container, or a backdrop alongside the positioner (multi-root), use the explicit form.
850
856
  */
851
857
  class RdxMenuPortal {
852
- constructor() {
853
- /**
854
- * Optional container to portal the content into. Defaults to `document.body`.
855
- */
856
- this.container = input(...(ngDevMode ? [undefined, { debugName: "container" }] : /* istanbul ignore next */ []));
857
- }
858
858
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxMenuPortal, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
859
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxMenuPortal, isStandalone: true, selector: "[rdxMenuPortal]", inputs: { container: { classPropertyName: "container", publicName: "container", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["rdxMenuPortal"], hostDirectives: [{ directive: i1$1.RdxPortal, inputs: ["container", "container"] }], ngImport: i0 }); }
859
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxMenuPortal, isStandalone: true, selector: "ng-template[rdxMenuPortal]", providers: [provideRdxPresenceContext(() => ({ present: injectRdxMenuRootContext().isOpen }))], exportAs: ["rdxMenuPortal"], hostDirectives: [{ directive: i1$1.RdxPortalPresence, inputs: ["container", "container"] }], ngImport: i0 }); }
860
860
  }
861
861
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxMenuPortal, decorators: [{
862
862
  type: Directive,
863
863
  args: [{
864
- selector: '[rdxMenuPortal]',
864
+ selector: 'ng-template[rdxMenuPortal]',
865
865
  exportAs: 'rdxMenuPortal',
866
- hostDirectives: [
867
- {
868
- directive: RdxPortal,
869
- inputs: ['container']
870
- }
871
- ]
866
+ hostDirectives: [{ directive: RdxPortalPresence, inputs: ['container'] }],
867
+ providers: [provideRdxPresenceContext(() => ({ present: injectRdxMenuRootContext().isOpen }))]
872
868
  }]
873
- }], propDecorators: { container: [{ type: i0.Input, args: [{ isSignal: true, alias: "container", required: false }] }] } });
869
+ }] });
870
+ /**
871
+ * Dev-mode guard: `rdxMenuPortal` is a structural directive. The old `<div rdxMenuPortal>` markup
872
+ * would silently stop portaling — fail loudly instead.
873
+ */
874
+ class RdxMenuPortalMisuseGuard {
875
+ constructor() {
876
+ if (isDevMode()) {
877
+ throw new Error('[rdxMenuPortal] is a structural directive. ' +
878
+ 'Use `*rdxMenuPortal` on the positioner element or `<ng-template rdxMenuPortal>`. ' +
879
+ 'See https://radix-ng.com/components/menu.md');
880
+ }
881
+ }
882
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxMenuPortalMisuseGuard, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
883
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxMenuPortalMisuseGuard, isStandalone: true, selector: "[rdxMenuPortal]:not(ng-template)", ngImport: i0 }); }
884
+ }
885
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxMenuPortalMisuseGuard, decorators: [{
886
+ type: Directive,
887
+ args: [{
888
+ selector: '[rdxMenuPortal]:not(ng-template)'
889
+ }]
890
+ }], ctorParameters: () => [] });
874
891
 
875
892
  /**
876
893
  * Positions the menu against its trigger.
@@ -993,7 +1010,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
993
1010
  }]
994
1011
  }], propDecorators: { anchor: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchor", required: false }] }], side: [{ type: i0.Input, args: [{ isSignal: true, alias: "side", required: false }] }], sideOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "sideOffset", required: false }] }], align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }], alignOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignOffset", required: false }] }], arrowPadding: [{ type: i0.Input, args: [{ isSignal: true, alias: "arrowPadding", required: false }] }], avoidCollisions: [{ type: i0.Input, args: [{ isSignal: true, alias: "avoidCollisions", required: false }] }], collisionBoundary: [{ type: i0.Input, args: [{ isSignal: true, alias: "collisionBoundary", required: false }] }], collisionPadding: [{ type: i0.Input, args: [{ isSignal: true, alias: "collisionPadding", required: false }] }], sticky: [{ type: i0.Input, args: [{ isSignal: true, alias: "sticky", required: false }] }], hideWhenDetached: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideWhenDetached", required: false }] }], positionStrategy: [{ type: i0.Input, args: [{ isSignal: true, alias: "positionStrategy", required: false }] }], updatePositionStrategy: [{ type: i0.Input, args: [{ isSignal: true, alias: "updatePositionStrategy", required: false }] }], placed: [{ type: i0.Output, args: ["placed"] }] } });
995
1012
 
996
- const [injectRdxMenuRadioGroupContext, provideRdxMenuRadioGroupContext] = createContext('RdxMenuRadioGroupContext');
1013
+ const [injectRdxMenuRadioGroupContext, provideRdxMenuRadioGroupContext] = createContext('RdxMenuRadioGroupContext', 'components/menu');
997
1014
  const radioGroupContextFactory = () => {
998
1015
  const instance = inject(RdxMenuRadioGroup);
999
1016
  return {
@@ -1034,7 +1051,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
1034
1051
  }]
1035
1052
  }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], onValueChange: [{ type: i0.Output, args: ["onValueChange"] }] } });
1036
1053
 
1037
- const [injectRdxMenuRadioItemContext, provideRdxMenuRadioItemContext] = createContext('RdxMenuRadioItemContext');
1054
+ const [injectRdxMenuRadioItemContext, provideRdxMenuRadioItemContext] = createContext('RdxMenuRadioItemContext', 'components/menu');
1038
1055
  const radioItemContextFactory = () => {
1039
1056
  const instance = inject(RdxMenuRadioItem);
1040
1057
  return {
@@ -1991,6 +2008,7 @@ const menuImports = [
1991
2008
  RdxMenuTrigger,
1992
2009
  RdxMenuSubTrigger,
1993
2010
  RdxMenuPortal,
2011
+ RdxMenuPortalMisuseGuard,
1994
2012
  RdxMenuPositioner,
1995
2013
  RdxMenuPopup,
1996
2014
  RdxMenuViewport,
@@ -2013,6 +2031,7 @@ class RdxMenuModule {
2013
2031
  RdxMenuTrigger,
2014
2032
  RdxMenuSubTrigger,
2015
2033
  RdxMenuPortal,
2034
+ RdxMenuPortalMisuseGuard,
2016
2035
  RdxMenuPositioner,
2017
2036
  RdxMenuPopup,
2018
2037
  RdxMenuViewport,
@@ -2031,6 +2050,7 @@ class RdxMenuModule {
2031
2050
  RdxMenuTrigger,
2032
2051
  RdxMenuSubTrigger,
2033
2052
  RdxMenuPortal,
2053
+ RdxMenuPortalMisuseGuard,
2034
2054
  RdxMenuPositioner,
2035
2055
  RdxMenuPopup,
2036
2056
  RdxMenuViewport,
@@ -2060,5 +2080,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
2060
2080
  * Generated bundle index. Do not edit.
2061
2081
  */
2062
2082
 
2063
- export { RdxMenuArrow, RdxMenuBackdrop, RdxMenuCheckboxItem, RdxMenuCheckboxItemIndicator, RdxMenuGroup, RdxMenuGroupLabel, RdxMenuItem, RdxMenuLinkItem, RdxMenuModule, RdxMenuPopup, RdxMenuPortal, RdxMenuPositioner, RdxMenuRadioGroup, RdxMenuRadioItem, RdxMenuRadioItemIndicator, RdxMenuRoot, RdxMenuSeparator, RdxMenuSubTrigger, RdxMenuTrigger, RdxMenuViewport, getCheckedState, injectRdxMenuCheckboxItemContext, injectRdxMenuRadioGroupContext, injectRdxMenuRadioItemContext, injectRdxMenuRootContext, isIndeterminate, provideRdxMenuCheckboxItemContext, provideRdxMenuRadioGroupContext, provideRdxMenuRadioItemContext, provideRdxMenuRootContext };
2083
+ export { RdxMenuArrow, RdxMenuBackdrop, RdxMenuCheckboxItem, RdxMenuCheckboxItemIndicator, RdxMenuGroup, RdxMenuGroupLabel, RdxMenuItem, RdxMenuLinkItem, RdxMenuModule, RdxMenuPopup, RdxMenuPortal, RdxMenuPortalMisuseGuard, RdxMenuPositioner, RdxMenuRadioGroup, RdxMenuRadioItem, RdxMenuRadioItemIndicator, RdxMenuRoot, RdxMenuSeparator, RdxMenuSubTrigger, RdxMenuTrigger, RdxMenuViewport, getCheckedState, injectRdxMenuCheckboxItemContext, injectRdxMenuRadioGroupContext, injectRdxMenuRadioItemContext, injectRdxMenuRootContext, isIndeterminate, provideRdxMenuCheckboxItemContext, provideRdxMenuRadioGroupContext, provideRdxMenuRadioItemContext, provideRdxMenuRootContext };
2064
2084
  //# sourceMappingURL=radix-ng-primitives-menu.mjs.map