@radix-ng/primitives 1.0.0-beta.5 → 1.0.2

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 (62) hide show
  1. package/composite/README.md +3 -0
  2. package/fesm2022/radix-ng-primitives-accordion.mjs +20 -44
  3. package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
  4. package/fesm2022/radix-ng-primitives-checkbox.mjs +134 -58
  5. package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
  6. package/fesm2022/radix-ng-primitives-composite.mjs +599 -0
  7. package/fesm2022/radix-ng-primitives-composite.mjs.map +1 -0
  8. package/fesm2022/radix-ng-primitives-drawer.mjs +442 -2
  9. package/fesm2022/radix-ng-primitives-drawer.mjs.map +1 -1
  10. package/fesm2022/radix-ng-primitives-menu.mjs +315 -68
  11. package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
  12. package/fesm2022/radix-ng-primitives-menubar.mjs +91 -36
  13. package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
  14. package/fesm2022/radix-ng-primitives-navigation-menu.mjs +281 -88
  15. package/fesm2022/radix-ng-primitives-navigation-menu.mjs.map +1 -1
  16. package/fesm2022/radix-ng-primitives-popover.mjs +40 -15
  17. package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
  18. package/fesm2022/radix-ng-primitives-popper.mjs +73 -65
  19. package/fesm2022/radix-ng-primitives-popper.mjs.map +1 -1
  20. package/fesm2022/radix-ng-primitives-radio.mjs +63 -27
  21. package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
  22. package/fesm2022/radix-ng-primitives-scroll-area.mjs +56 -25
  23. package/fesm2022/radix-ng-primitives-scroll-area.mjs.map +1 -1
  24. package/fesm2022/radix-ng-primitives-select.mjs +59 -29
  25. package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
  26. package/fesm2022/radix-ng-primitives-slider.mjs +57 -13
  27. package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
  28. package/fesm2022/radix-ng-primitives-tabs.mjs +335 -73
  29. package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
  30. package/fesm2022/radix-ng-primitives-toggle-group.mjs +66 -21
  31. package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
  32. package/fesm2022/radix-ng-primitives-toggle.mjs +29 -11
  33. package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
  34. package/fesm2022/radix-ng-primitives-toolbar.mjs +68 -36
  35. package/fesm2022/radix-ng-primitives-toolbar.mjs.map +1 -1
  36. package/navigation-menu/README.md +5 -2
  37. package/package.json +6 -10
  38. package/types/radix-ng-primitives-accordion.d.ts +12 -16
  39. package/types/radix-ng-primitives-checkbox.d.ts +98 -70
  40. package/types/radix-ng-primitives-composite.d.ts +195 -0
  41. package/types/radix-ng-primitives-drawer.d.ts +40 -2
  42. package/types/radix-ng-primitives-menu.d.ts +46 -16
  43. package/types/radix-ng-primitives-menubar.d.ts +12 -5
  44. package/types/radix-ng-primitives-navigation-menu.d.ts +65 -33
  45. package/types/radix-ng-primitives-popover.d.ts +9 -5
  46. package/types/radix-ng-primitives-popper.d.ts +1 -0
  47. package/types/radix-ng-primitives-radio.d.ts +11 -9
  48. package/types/radix-ng-primitives-scroll-area.d.ts +4 -1
  49. package/types/radix-ng-primitives-select.d.ts +46 -32
  50. package/types/radix-ng-primitives-slider.d.ts +19 -4
  51. package/types/radix-ng-primitives-tabs.d.ts +69 -14
  52. package/types/radix-ng-primitives-toggle-group.d.ts +27 -16
  53. package/types/radix-ng-primitives-toggle.d.ts +5 -5
  54. package/types/radix-ng-primitives-toolbar.d.ts +84 -69
  55. package/collection/README.md +0 -1
  56. package/fesm2022/radix-ng-primitives-collection.mjs +0 -72
  57. package/fesm2022/radix-ng-primitives-collection.mjs.map +0 -1
  58. package/fesm2022/radix-ng-primitives-roving-focus.mjs +0 -388
  59. package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +0 -1
  60. package/roving-focus/README.md +0 -3
  61. package/types/radix-ng-primitives-collection.d.ts +0 -44
  62. package/types/radix-ng-primitives-roving-focus.d.ts +0 -187
@@ -1,55 +1,11 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { Signal } from '@angular/core';
3
- import * as i1 from '@radix-ng/primitives/separator';
4
- import * as _radix_ng_primitives_core from '@radix-ng/primitives/core';
5
- import { DataOrientation, BooleanInput } from '@radix-ng/primitives/core';
6
- import * as i1$1 from '@radix-ng/primitives/roving-focus';
7
- import { Direction } from '@radix-ng/primitives/roving-focus';
8
3
  import * as _radix_ng_primitives_toolbar from '@radix-ng/primitives/toolbar';
9
-
10
- /**
11
- * A separator between toolbar items or groups.
12
- *
13
- * @see https://base-ui.com/react/components/toolbar
14
- */
15
- declare class RdxToolbarSeparator {
16
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxToolbarSeparator, never>;
17
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxToolbarSeparator, "[rdxToolbarSeparator]", ["rdxToolbarSeparator"], {}, {}, never, never, true, [{ directive: typeof i1.RdxSeparatorRootDirective; inputs: { "orientation": "orientation"; }; outputs: {}; }]>;
18
- }
19
-
20
- /**
21
- * A container for grouping a set of controls, such as buttons, toggle groups or menus.
22
- * Owns roving keyboard focus over its items.
23
- *
24
- * @see https://base-ui.com/react/components/toolbar
25
- */
26
- declare class RdxToolbarRoot {
27
- /**
28
- * The orientation of the toolbar.
29
- *
30
- * @default 'horizontal'
31
- */
32
- readonly orientation: _angular_core.InputSignal<DataOrientation>;
33
- /** Text direction for arrow-key navigation. */
34
- readonly dirInput: _angular_core.InputSignal<Direction | undefined>;
35
- readonly dir: _angular_core.Signal<_radix_ng_primitives_core.Direction>;
36
- /**
37
- * Whether keyboard navigation should loop from the last item back to the first.
38
- *
39
- * @default true
40
- */
41
- readonly loopFocus: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
42
- /**
43
- * Whether the whole toolbar is disabled.
44
- *
45
- * @default false
46
- */
47
- readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
48
- private readonly rovingFocusGroup;
49
- constructor();
50
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxToolbarRoot, never>;
51
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxToolbarRoot, "[rdxToolbarRoot]", ["rdxToolbarRoot"], { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "dirInput": { "alias": "dir"; "required": false; "isSignal": true; }; "loopFocus": { "alias": "loopFocus"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1$1.RdxRovingFocusGroupDirective; inputs: {}; outputs: {}; }]>;
52
- }
4
+ import * as _radix_ng_primitives_core from '@radix-ng/primitives/core';
5
+ import { BooleanInput, DataOrientation, Direction } from '@radix-ng/primitives/core';
6
+ import * as i1 from '@radix-ng/primitives/composite';
7
+ import * as i1$1 from '@radix-ng/primitives/separator';
8
+ import { Orientation } from '@radix-ng/primitives/separator';
53
9
 
54
10
  /**
55
11
  * A button within a toolbar.
@@ -59,7 +15,7 @@ declare class RdxToolbarRoot {
59
15
  declare class RdxToolbarButton {
60
16
  protected readonly rootContext: _radix_ng_primitives_toolbar.RdxToolbarRootContext;
61
17
  private readonly groupContext;
62
- private readonly rovingItem;
18
+ private readonly compositeItem;
63
19
  /**
64
20
  * Whether the button is disabled.
65
21
  *
@@ -85,24 +41,30 @@ declare class RdxToolbarButton {
85
41
  /** @ignore */
86
42
  protected onClick(event: Event): void;
87
43
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxToolbarButton, never>;
88
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxToolbarButton, "[rdxToolbarButton]", ["rdxToolbarButton"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "focusableWhenDisabled": { "alias": "focusableWhenDisabled"; "required": false; "isSignal": true; }; "nativeButton": { "alias": "nativeButton"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1$1.RdxRovingFocusItemDirective; inputs: {}; outputs: {}; }]>;
44
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxToolbarButton, "[rdxToolbarButton]", ["rdxToolbarButton"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "focusableWhenDisabled": { "alias": "focusableWhenDisabled"; "required": false; "isSignal": true; }; "nativeButton": { "alias": "nativeButton"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.RdxCompositeItem; inputs: {}; outputs: {}; }]>;
89
45
  }
90
46
 
91
47
  /**
92
- * A link within a toolbar.
48
+ * Groups several toolbar items together. Disabling the group disables all of its items.
93
49
  *
94
50
  * @see https://base-ui.com/react/components/toolbar
95
51
  */
96
- declare class RdxToolbarLink {
52
+ declare class RdxToolbarGroup {
97
53
  protected readonly rootContext: _radix_ng_primitives_toolbar.RdxToolbarRootContext;
98
- /** @ignore Space activates a link, matching native button behavior in a toolbar. */
99
- protected onKeyDown(event: KeyboardEvent): void;
100
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxToolbarLink, never>;
101
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxToolbarLink, "[rdxToolbarLink]", ["rdxToolbarLink"], {}, {}, never, never, true, [{ directive: typeof i1$1.RdxRovingFocusItemDirective; inputs: {}; outputs: {}; }]>;
54
+ /**
55
+ * Whether the group is disabled.
56
+ *
57
+ * @default false
58
+ */
59
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
60
+ /** @ignore Effective disabled state, combining the group and the toolbar. */
61
+ readonly isDisabled: _angular_core.Signal<boolean>;
62
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxToolbarGroup, never>;
63
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxToolbarGroup, "[rdxToolbarGroup]", ["rdxToolbarGroup"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
102
64
  }
103
65
 
104
66
  /**
105
- * A native input within a toolbar. Participates in the toolbar's roving focus while keeping native
67
+ * A native input within a toolbar. Participates in the toolbar's composite focus while keeping native
106
68
  * text-editing: the arrow keys move the caret within the text and only move focus to the
107
69
  * neighbouring toolbar item once the caret is at the corresponding edge (Base UI "composite" input).
108
70
  *
@@ -111,7 +73,7 @@ declare class RdxToolbarLink {
111
73
  declare class RdxToolbarInput {
112
74
  protected readonly rootContext: _radix_ng_primitives_toolbar.RdxToolbarRootContext;
113
75
  private readonly groupContext;
114
- private readonly rovingItem;
76
+ private readonly compositeItem;
115
77
  private readonly elementRef;
116
78
  private readonly isBrowser;
117
79
  /** The initial value of the uncontrolled input. */
@@ -134,26 +96,79 @@ declare class RdxToolbarInput {
134
96
  constructor();
135
97
  private handleCaretKeydown;
136
98
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxToolbarInput, never>;
137
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxToolbarInput, "input[rdxToolbarInput]", ["rdxToolbarInput"], { "defaultValue": { "alias": "defaultValue"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "focusableWhenDisabled": { "alias": "focusableWhenDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1$1.RdxRovingFocusItemDirective; inputs: {}; outputs: {}; }]>;
99
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxToolbarInput, "input[rdxToolbarInput]", ["rdxToolbarInput"], { "defaultValue": { "alias": "defaultValue"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "focusableWhenDisabled": { "alias": "focusableWhenDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.RdxCompositeItem; inputs: {}; outputs: {}; }]>;
138
100
  }
139
101
 
140
102
  /**
141
- * Groups several toolbar items together. Disabling the group disables all of its items.
103
+ * A link within a toolbar.
142
104
  *
143
105
  * @see https://base-ui.com/react/components/toolbar
144
106
  */
145
- declare class RdxToolbarGroup {
107
+ declare class RdxToolbarLink {
146
108
  protected readonly rootContext: _radix_ng_primitives_toolbar.RdxToolbarRootContext;
109
+ private readonly compositeItem;
110
+ constructor();
111
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxToolbarLink, never>;
112
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxToolbarLink, "[rdxToolbarLink]", ["rdxToolbarLink"], {}, {}, never, never, true, [{ directive: typeof i1.RdxCompositeItem; inputs: {}; outputs: {}; }]>;
113
+ }
114
+
115
+ /**
116
+ * A container for grouping a set of controls, such as buttons, toggle groups or menus.
117
+ * Owns composite keyboard focus over its items.
118
+ *
119
+ * @see https://base-ui.com/react/components/toolbar
120
+ */
121
+ declare class RdxToolbarRoot {
147
122
  /**
148
- * Whether the group is disabled.
123
+ * The orientation of the toolbar.
124
+ *
125
+ * @default 'horizontal'
126
+ */
127
+ readonly orientation: _angular_core.InputSignal<DataOrientation>;
128
+ /** Text direction for arrow-key navigation. */
129
+ readonly dirInput: _angular_core.InputSignal<Direction | undefined>;
130
+ readonly dir: _angular_core.Signal<Direction>;
131
+ /**
132
+ * Whether keyboard navigation should loop from the last item back to the first.
133
+ *
134
+ * @default true
135
+ */
136
+ readonly loopFocus: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
137
+ /**
138
+ * Whether the whole toolbar is disabled.
149
139
  *
150
140
  * @default false
151
141
  */
152
142
  readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
153
- /** @ignore Effective disabled state, combining the group and the toolbar. */
154
- readonly isDisabled: _angular_core.Signal<boolean>;
155
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxToolbarGroup, never>;
156
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxToolbarGroup, "[rdxToolbarGroup]", ["rdxToolbarGroup"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
143
+ private readonly compositeRoot;
144
+ private readonly itemMetadata;
145
+ private readonly disabledIndices;
146
+ constructor();
147
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxToolbarRoot, never>;
148
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxToolbarRoot, "[rdxToolbarRoot]", ["rdxToolbarRoot"], { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "dirInput": { "alias": "dir"; "required": false; "isSignal": true; }; "loopFocus": { "alias": "loopFocus"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.RdxCompositeRoot; inputs: {}; outputs: {}; }]>;
149
+ }
150
+ interface RdxToolbarItemMetadata {
151
+ [key: string]: unknown;
152
+ disabled: boolean;
153
+ focusableWhenDisabled: boolean;
154
+ }
155
+
156
+ /**
157
+ * A separator between toolbar items or groups.
158
+ *
159
+ * @see https://base-ui.com/react/components/toolbar
160
+ */
161
+ declare class RdxToolbarSeparator {
162
+ protected readonly rootContext: _radix_ng_primitives_toolbar.RdxToolbarRootContext;
163
+ private readonly separator;
164
+ /**
165
+ * The separator orientation. Defaults to the opposite of the toolbar orientation.
166
+ */
167
+ readonly orientation: _angular_core.InputSignal<Orientation | undefined>;
168
+ constructor();
169
+ private defaultOrientation;
170
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxToolbarSeparator, never>;
171
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxToolbarSeparator, "[rdxToolbarSeparator]", ["rdxToolbarSeparator"], { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1$1.RdxSeparatorRootDirective; inputs: {}; outputs: {}; }]>;
157
172
  }
158
173
 
159
174
  interface RdxToolbarRootContext {
@@ -171,7 +186,7 @@ interface RdxToolbarGroupContext {
171
186
  declare const injectToolbarGroupContext: _radix_ng_primitives_core.InjectContext<RdxToolbarGroupContext>;
172
187
  declare const provideToolbarGroupContext: (useFactory: () => RdxToolbarGroupContext) => _angular_core.Provider;
173
188
 
174
- declare const toolbarImports: (typeof RdxToolbarSeparator)[];
189
+ declare const toolbarImports: (typeof RdxToolbarButton | typeof RdxToolbarGroup | typeof RdxToolbarInput | typeof RdxToolbarLink | typeof RdxToolbarRoot | typeof RdxToolbarSeparator)[];
175
190
  declare class RdxToolbarModule {
176
191
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxToolbarModule, never>;
177
192
  static ɵmod: _angular_core.ɵɵNgModuleDeclaration<RdxToolbarModule, never, [typeof RdxToolbarRoot, typeof RdxToolbarButton, typeof RdxToolbarLink, typeof RdxToolbarInput, typeof RdxToolbarGroup, typeof RdxToolbarSeparator], [typeof RdxToolbarRoot, typeof RdxToolbarButton, typeof RdxToolbarLink, typeof RdxToolbarInput, typeof RdxToolbarGroup, typeof RdxToolbarSeparator]>;
@@ -179,4 +194,4 @@ declare class RdxToolbarModule {
179
194
  }
180
195
 
181
196
  export { RdxToolbarButton, RdxToolbarGroup, RdxToolbarInput, RdxToolbarLink, RdxToolbarModule, RdxToolbarRoot, RdxToolbarSeparator, injectToolbarGroupContext, injectToolbarRootContext, provideToolbarGroupContext, provideToolbarRootContext, toolbarImports };
182
- export type { RdxToolbarGroupContext, RdxToolbarRootContext };
197
+ export type { RdxToolbarGroupContext, RdxToolbarItemMetadata, RdxToolbarRootContext };
@@ -1 +0,0 @@
1
- # @radix-ng/primitives/collection
@@ -1,72 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { inject, ElementRef, input, booleanAttribute, Directive, contentChildren, computed } from '@angular/core';
3
-
4
- /**
5
- * Marks an element as a member of a collection. Items are discovered by the
6
- * {@link RdxCollectionProvider} via `contentChildren`, so registration is automatic — no manual
7
- * book-keeping or marker attributes are needed.
8
- *
9
- * @group Components
10
- */
11
- class RdxCollectionItem {
12
- constructor() {
13
- /** The host element of the item, read straight off the instance. */
14
- this.element = inject((ElementRef)).nativeElement;
15
- /** Arbitrary data associated with the item. */
16
- this.value = input(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
17
- /** Whether the item is disabled. Disabled items are excluded from {@link RdxCollectionProvider.enabledItems}. */
18
- this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
19
- }
20
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCollectionItem, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
21
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxCollectionItem, isStandalone: true, selector: "[rdxCollectionItem]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["rdxCollectionItem"], ngImport: i0 }); }
22
- }
23
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCollectionItem, decorators: [{
24
- type: Directive,
25
- args: [{
26
- selector: '[rdxCollectionItem]',
27
- exportAs: 'rdxCollectionItem'
28
- }]
29
- }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
30
-
31
- /**
32
- * Collects {@link RdxCollectionItem} descendants in DOM order, reactively, using Angular's
33
- * `contentChildren`. Matches host directives too, so items composed via `hostDirectives` are found.
34
- *
35
- * @group Components
36
- */
37
- class RdxCollectionProvider {
38
- constructor() {
39
- /** All items, in DOM order. */
40
- this.items = contentChildren(RdxCollectionItem, { ...(ngDevMode ? { debugName: "items" } : /* istanbul ignore next */ {}), descendants: true });
41
- /** Items that are not disabled. Recomputes when an item's `disabled` flag changes. */
42
- this.enabledItems = computed(() => this.items().filter((item) => !item.disabled()), ...(ngDevMode ? [{ debugName: "enabledItems" }] : /* istanbul ignore next */ []));
43
- }
44
- /** Returns the collection items, excluding disabled ones unless `includeDisabled` is `true`. */
45
- getItems(includeDisabled = false) {
46
- return includeDisabled ? this.items() : this.enabledItems();
47
- }
48
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCollectionProvider, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
49
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.9", type: RdxCollectionProvider, isStandalone: true, selector: "[rdxCollectionProvider]", queries: [{ propertyName: "items", predicate: RdxCollectionItem, descendants: true, isSignal: true }], exportAs: ["rdxCollectionProvider"], ngImport: i0 }); }
50
- }
51
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCollectionProvider, decorators: [{
52
- type: Directive,
53
- args: [{
54
- selector: '[rdxCollectionProvider]',
55
- exportAs: 'rdxCollectionProvider'
56
- }]
57
- }], propDecorators: { items: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => RdxCollectionItem), { ...{ descendants: true }, isSignal: true }] }] } });
58
-
59
- /**
60
- * Convenience accessor for the nearest {@link RdxCollectionProvider}. Equivalent to
61
- * `inject(RdxCollectionProvider)`; returns the provider with its reactive `items`/`enabledItems`.
62
- */
63
- function useCollection() {
64
- return inject(RdxCollectionProvider);
65
- }
66
-
67
- /**
68
- * Generated bundle index. Do not edit.
69
- */
70
-
71
- export { RdxCollectionItem, RdxCollectionProvider, useCollection };
72
- //# sourceMappingURL=radix-ng-primitives-collection.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"radix-ng-primitives-collection.mjs","sources":["../../../packages/primitives/collection/src/collection-item.ts","../../../packages/primitives/collection/src/collection-provider.ts","../../../packages/primitives/collection/src/use-collection.ts","../../../packages/primitives/collection/radix-ng-primitives-collection.ts"],"sourcesContent":["import { booleanAttribute, Directive, ElementRef, inject, input } from '@angular/core';\n\n/**\n * Marks an element as a member of a collection. Items are discovered by the\n * {@link RdxCollectionProvider} via `contentChildren`, so registration is automatic — no manual\n * book-keeping or marker attributes are needed.\n *\n * @group Components\n */\n@Directive({\n selector: '[rdxCollectionItem]',\n exportAs: 'rdxCollectionItem'\n})\nexport class RdxCollectionItem<T = unknown> {\n /** The host element of the item, read straight off the instance. */\n readonly element = inject(ElementRef<HTMLElement>).nativeElement as HTMLElement;\n\n /** Arbitrary data associated with the item. */\n readonly value = input<T>();\n\n /** Whether the item is disabled. Disabled items are excluded from {@link RdxCollectionProvider.enabledItems}. */\n readonly disabled = input(false, { transform: booleanAttribute });\n}\n","import { computed, contentChildren, Directive } from '@angular/core';\nimport { RdxCollectionItem } from './collection-item';\n\n/**\n * Collects {@link RdxCollectionItem} descendants in DOM order, reactively, using Angular's\n * `contentChildren`. Matches host directives too, so items composed via `hostDirectives` are found.\n *\n * @group Components\n */\n@Directive({\n selector: '[rdxCollectionProvider]',\n exportAs: 'rdxCollectionProvider'\n})\nexport class RdxCollectionProvider {\n /** All items, in DOM order. */\n readonly items = contentChildren(RdxCollectionItem, { descendants: true });\n\n /** Items that are not disabled. Recomputes when an item's `disabled` flag changes. */\n readonly enabledItems = computed(() => this.items().filter((item) => !item.disabled()));\n\n /** Returns the collection items, excluding disabled ones unless `includeDisabled` is `true`. */\n getItems(includeDisabled = false): readonly RdxCollectionItem[] {\n return includeDisabled ? this.items() : this.enabledItems();\n }\n}\n","import { inject } from '@angular/core';\nimport { RdxCollectionProvider } from './collection-provider';\n\n/**\n * Convenience accessor for the nearest {@link RdxCollectionProvider}. Equivalent to\n * `inject(RdxCollectionProvider)`; returns the provider with its reactive `items`/`enabledItems`.\n */\nexport function useCollection(): RdxCollectionProvider {\n return inject(RdxCollectionProvider);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;;;;;AAMG;MAKU,iBAAiB,CAAA;AAJ9B,IAAA,WAAA,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