@radix-ng/primitives 1.0.0-beta.4 → 1.0.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.
- package/composite/README.md +3 -0
- package/fesm2022/radix-ng-primitives-accordion.mjs +12 -36
- package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-checkbox.mjs +33 -18
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-composite.mjs +515 -0
- package/fesm2022/radix-ng-primitives-composite.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-core.mjs +7 -0
- package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-dialog.mjs +54 -12
- package/fesm2022/radix-ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-drawer.mjs +442 -2
- package/fesm2022/radix-ng-primitives-drawer.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-editable.mjs +12 -7
- package/fesm2022/radix-ng-primitives-editable.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-floating-focus-manager.mjs +294 -8
- package/fesm2022/radix-ng-primitives-floating-focus-manager.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-focus-scope.mjs +9 -0
- package/fesm2022/radix-ng-primitives-focus-scope.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menu.mjs +71 -20
- package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menubar.mjs +68 -36
- package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-navigation-menu.mjs +281 -88
- package/fesm2022/radix-ng-primitives-navigation-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-number-field.mjs +7 -2
- package/fesm2022/radix-ng-primitives-number-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-popover.mjs +117 -35
- package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-popper.mjs +73 -65
- package/fesm2022/radix-ng-primitives-popper.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-radio.mjs +77 -36
- package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-roving-focus.mjs +40 -8
- package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-scroll-area.mjs +56 -25
- package/fesm2022/radix-ng-primitives-scroll-area.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-select.mjs +62 -37
- package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-slider.mjs +259 -28
- package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-stepper.mjs +11 -7
- package/fesm2022/radix-ng-primitives-stepper.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-switch.mjs +10 -5
- package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tabs.mjs +64 -30
- package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle-group.mjs +69 -19
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle.mjs +37 -13
- package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toolbar.mjs +50 -24
- package/fesm2022/radix-ng-primitives-toolbar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tooltip.mjs +180 -35
- package/fesm2022/radix-ng-primitives-tooltip.mjs.map +1 -1
- package/navigation-menu/README.md +5 -2
- package/package.json +5 -1
- package/types/radix-ng-primitives-accordion.d.ts +9 -13
- package/types/radix-ng-primitives-checkbox.d.ts +27 -15
- package/types/radix-ng-primitives-composite.d.ts +152 -0
- package/types/radix-ng-primitives-core.d.ts +2 -0
- package/types/radix-ng-primitives-dialog.d.ts +13 -2
- package/types/radix-ng-primitives-drawer.d.ts +40 -2
- package/types/radix-ng-primitives-editable.d.ts +11 -5
- package/types/radix-ng-primitives-floating-focus-manager.d.ts +113 -16
- package/types/radix-ng-primitives-menu.d.ts +13 -5
- package/types/radix-ng-primitives-menubar.d.ts +10 -5
- package/types/radix-ng-primitives-navigation-menu.d.ts +65 -33
- package/types/radix-ng-primitives-number-field.d.ts +8 -3
- package/types/radix-ng-primitives-popover.d.ts +26 -10
- package/types/radix-ng-primitives-popper.d.ts +1 -0
- package/types/radix-ng-primitives-radio.d.ts +22 -13
- package/types/radix-ng-primitives-roving-focus.d.ts +15 -1
- package/types/radix-ng-primitives-scroll-area.d.ts +4 -1
- package/types/radix-ng-primitives-select.d.ts +16 -20
- package/types/radix-ng-primitives-slider.d.ts +60 -9
- package/types/radix-ng-primitives-stepper.d.ts +11 -4
- package/types/radix-ng-primitives-switch.d.ts +10 -4
- package/types/radix-ng-primitives-tabs.d.ts +20 -11
- package/types/radix-ng-primitives-toggle-group.d.ts +34 -17
- package/types/radix-ng-primitives-toggle.d.ts +14 -7
- package/types/radix-ng-primitives-toolbar.d.ts +22 -14
- package/types/radix-ng-primitives-tooltip.d.ts +38 -14
|
@@ -2,8 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Directive, inject, ElementRef, input, booleanAttribute, model, output, computed, effect, signal, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@radix-ng/primitives/collapsible';
|
|
4
4
|
import { RdxCollapsiblePanelPresenceDirective, injectCollapsibleRootContext, RdxCollapsibleRootDirective, RdxCollapsiblePanelDirective } from '@radix-ng/primitives/collapsible';
|
|
5
|
-
import { createContext, injectId
|
|
6
|
-
import { injectDirection } from '@radix-ng/primitives/direction-provider';
|
|
5
|
+
import { createContext, injectId } from '@radix-ng/primitives/core';
|
|
7
6
|
|
|
8
7
|
class RdxAccordionContentPresenceDirective {
|
|
9
8
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxAccordionContentPresenceDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
@@ -22,13 +21,11 @@ const rootContext = () => {
|
|
|
22
21
|
const instance = inject(RdxAccordionRootDirective);
|
|
23
22
|
return {
|
|
24
23
|
disabled: instance.disabled,
|
|
25
|
-
direction: instance.dir,
|
|
26
24
|
collapsible: instance.collapsible,
|
|
27
25
|
orientation: instance.orientation,
|
|
28
26
|
elementRef: instance.elementRef,
|
|
29
27
|
value: instance.value,
|
|
30
28
|
isSingle: instance.isSingle,
|
|
31
|
-
loopFocus: instance.loopFocus,
|
|
32
29
|
keepMounted: instance.keepMounted,
|
|
33
30
|
changeModelValue: instance.changeModelValue
|
|
34
31
|
};
|
|
@@ -40,13 +37,6 @@ class RdxAccordionRootDirective {
|
|
|
40
37
|
constructor() {
|
|
41
38
|
this.elementRef = inject(ElementRef);
|
|
42
39
|
this.id = input(injectId('rdx-accordion-'), ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
43
|
-
/**
|
|
44
|
-
* The reading direction of the accordion when applicable. If omitted, assumes LTR (left-to-right) reading mode.
|
|
45
|
-
*
|
|
46
|
-
* @group Props
|
|
47
|
-
*/
|
|
48
|
-
this.dirInput = input(undefined, { ...(ngDevMode ? { debugName: "dirInput" } : /* istanbul ignore next */ {}), alias: 'dir' });
|
|
49
|
-
this.dir = injectDirection(this.dirInput);
|
|
50
40
|
/** Whether the Accordion is disabled.
|
|
51
41
|
* @defaultValue false
|
|
52
42
|
* @group Props
|
|
@@ -55,8 +45,12 @@ class RdxAccordionRootDirective {
|
|
|
55
45
|
/**
|
|
56
46
|
* The orientation of the accordion.
|
|
57
47
|
*
|
|
48
|
+
* Deprecated following the APG guidance update to remove roving focus.
|
|
49
|
+
* This prop no longer affects keyboard focus behavior.
|
|
50
|
+
*
|
|
58
51
|
* @defaultValue 'vertical'
|
|
59
52
|
* @group Props
|
|
53
|
+
* @deprecated
|
|
60
54
|
*/
|
|
61
55
|
this.orientation = input('vertical', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
62
56
|
/**
|
|
@@ -96,10 +90,12 @@ class RdxAccordionRootDirective {
|
|
|
96
90
|
*/
|
|
97
91
|
this.multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
98
92
|
/**
|
|
99
|
-
*
|
|
93
|
+
* Deprecated following the APG guidance update to remove roving focus.
|
|
94
|
+
* This prop no longer affects keyboard focus behavior.
|
|
100
95
|
*
|
|
101
96
|
* @defaultValue true
|
|
102
97
|
* @group Props
|
|
98
|
+
* @deprecated
|
|
103
99
|
*/
|
|
104
100
|
this.loopFocus = input(true, { ...(ngDevMode ? { debugName: "loopFocus" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
105
101
|
/**
|
|
@@ -158,7 +154,7 @@ class RdxAccordionRootDirective {
|
|
|
158
154
|
return JSON.stringify(a) === JSON.stringify(b);
|
|
159
155
|
}
|
|
160
156
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxAccordionRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
161
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxAccordionRootDirective, isStandalone: true, selector: "[rdxAccordionRoot]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null },
|
|
157
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxAccordionRootDirective, isStandalone: true, selector: "[rdxAccordionRoot]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, collapsible: { classPropertyName: "collapsible", publicName: "collapsible", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, loopFocus: { classPropertyName: "loopFocus", publicName: "loopFocus", isSignal: true, isRequired: false, transformFunction: null }, keepMounted: { classPropertyName: "keepMounted", publicName: "keepMounted", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", onValueChange: "onValueChange" }, host: { properties: { "attr.data-orientation": "orientation()", "attr.data-disabled": "disabled() ? \"\" : undefined" } }, providers: [provideAccordionRootContext(rootContext)], exportAs: ["rdxAccordionRoot"], ngImport: i0 }); }
|
|
162
158
|
}
|
|
163
159
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxAccordionRootDirective, decorators: [{
|
|
164
160
|
type: Directive,
|
|
@@ -171,7 +167,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
171
167
|
'[attr.data-disabled]': 'disabled() ? "" : undefined'
|
|
172
168
|
}
|
|
173
169
|
}]
|
|
174
|
-
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }],
|
|
170
|
+
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], defaultValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValue", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], collapsible: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsible", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], loopFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "loopFocus", required: false }] }], keepMounted: [{ type: i0.Input, args: [{ isSignal: true, alias: "keepMounted", required: false }] }], onValueChange: [{ type: i0.Output, args: ["onValueChange"] }] } });
|
|
175
171
|
|
|
176
172
|
const [injectAccordionItemContext, provideAccordionItemContext] = createContext('AccordionItemContext', 'components/accordion');
|
|
177
173
|
const itemContext = () => {
|
|
@@ -250,22 +246,8 @@ class RdxAccordionItemDirective {
|
|
|
250
246
|
this.onOpenChange.emit(isOpen);
|
|
251
247
|
});
|
|
252
248
|
}
|
|
253
|
-
handleArrowKey(event) {
|
|
254
|
-
const keyEvent = event;
|
|
255
|
-
const target = event.target;
|
|
256
|
-
const allCollectionItems = Array.from(this.rootContext.elementRef.nativeElement?.querySelectorAll('[data-rdx-collection-item]') ?? []);
|
|
257
|
-
const collectionItemIndex = allCollectionItems.findIndex((item) => item === target);
|
|
258
|
-
if (collectionItemIndex === -1)
|
|
259
|
-
return;
|
|
260
|
-
useArrowNavigation(keyEvent, this.elementRef.nativeElement.querySelector('[data-rdx-collection-item]'), this.rootContext.elementRef.nativeElement, {
|
|
261
|
-
arrowKeyOptions: this.rootContext.orientation(),
|
|
262
|
-
dir: this.rootContext.direction(),
|
|
263
|
-
loop: this.rootContext.loopFocus(),
|
|
264
|
-
focus: true
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
249
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxAccordionItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
268
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxAccordionItemDirective, isStandalone: true, selector: "[rdxAccordionItem]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onOpenChange: "onOpenChange" }, host: {
|
|
250
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxAccordionItemDirective, isStandalone: true, selector: "[rdxAccordionItem]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onOpenChange: "onOpenChange" }, host: { properties: { "attr.data-orientation": "rootContext.orientation()", "attr.data-disabled": "isDisabled() ? \"\" : undefined", "attr.data-state": "dataState()", "attr.data-index": "index()" } }, providers: [provideAccordionItemContext(itemContext)], exportAs: ["rdxAccordionItem"], hostDirectives: [{ directive: i1.RdxCollapsibleRootDirective, inputs: ["disabled", "disabled", "open", "open"] }], ngImport: i0 }); }
|
|
269
251
|
}
|
|
270
252
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxAccordionItemDirective, decorators: [{
|
|
271
253
|
type: Directive,
|
|
@@ -283,13 +265,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
283
265
|
'[attr.data-orientation]': 'rootContext.orientation()',
|
|
284
266
|
'[attr.data-disabled]': 'isDisabled() ? "" : undefined',
|
|
285
267
|
'[attr.data-state]': 'dataState()',
|
|
286
|
-
'[attr.data-index]': 'index()'
|
|
287
|
-
'(keydown.arrowDown)': 'handleArrowKey($event)',
|
|
288
|
-
'(keydown.arrowUp)': 'handleArrowKey($event)',
|
|
289
|
-
'(keydown.arrowLeft)': 'handleArrowKey($event)',
|
|
290
|
-
'(keydown.arrowRight)': 'handleArrowKey($event)',
|
|
291
|
-
'(keydown.home)': 'handleArrowKey($event)',
|
|
292
|
-
'(keydown.end)': 'handleArrowKey($event)'
|
|
268
|
+
'[attr.data-index]': 'index()'
|
|
293
269
|
}
|
|
294
270
|
}]
|
|
295
271
|
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], onOpenChange: [{ type: i0.Output, args: ["onOpenChange"] }] } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-accordion.mjs","sources":["../../../packages/primitives/accordion/src/accordion-content-presence.directive.ts","../../../packages/primitives/accordion/src/accordion-root.directive.ts","../../../packages/primitives/accordion/src/accordion-item.directive.ts","../../../packages/primitives/accordion/src/accordion-content.directive.ts","../../../packages/primitives/accordion/src/accordion-header.directive.ts","../../../packages/primitives/accordion/src/accordion-trigger.directive.ts","../../../packages/primitives/accordion/index.ts","../../../packages/primitives/accordion/radix-ng-primitives-accordion.ts"],"sourcesContent":["import { Directive } from '@angular/core';\nimport { RdxCollapsiblePanelPresenceDirective } from '@radix-ng/primitives/collapsible';\n\n@Directive({\n selector: 'ng-template[rdxAccordionContentPresence]',\n hostDirectives: [RdxCollapsiblePanelPresenceDirective]\n})\nexport class RdxAccordionContentPresenceDirective {}\n","import {\n booleanAttribute,\n computed,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n InputSignal,\n InputSignalWithTransform,\n model,\n ModelSignal,\n output,\n Signal\n} from '@angular/core';\nimport {\n AcceptableValue,\n BooleanInput,\n createContext,\n DataOrientation,\n Direction,\n injectId\n} from '@radix-ng/primitives/core';\nimport { injectDirection } from '@radix-ng/primitives/direction-provider';\n\nexport type AccordionRootContext = {\n disabled: InputSignalWithTransform<boolean, BooleanInput>;\n direction: Signal<Direction>;\n orientation: InputSignal<DataOrientation>;\n value: ModelSignal<AcceptableValue | AcceptableValue[] | undefined>;\n collapsible: Signal<boolean>;\n isSingle: Signal<boolean>;\n loopFocus: InputSignalWithTransform<boolean, BooleanInput>;\n keepMounted: InputSignalWithTransform<boolean, BooleanInput>;\n elementRef: ElementRef<HTMLElement>;\n changeModelValue: (value: string) => void;\n};\n\nexport const [injectAccordionRootContext, provideAccordionRootContext] = createContext<AccordionRootContext>(\n 'AccordionRootContext',\n 'components/accordion'\n);\n\nconst rootContext = (): AccordionRootContext => {\n const instance = inject(RdxAccordionRootDirective);\n\n return {\n disabled: instance.disabled,\n direction: instance.dir,\n collapsible: instance.collapsible,\n orientation: instance.orientation,\n elementRef: instance.elementRef,\n value: instance.value,\n isSingle: instance.isSingle,\n loopFocus: instance.loopFocus,\n keepMounted: instance.keepMounted,\n changeModelValue: instance.changeModelValue\n };\n};\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxAccordionRoot]',\n exportAs: 'rdxAccordionRoot',\n providers: [provideAccordionRootContext(rootContext)],\n host: {\n '[attr.data-orientation]': 'orientation()',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined'\n }\n})\nexport class RdxAccordionRootDirective {\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n readonly id = input<string>(injectId('rdx-accordion-'));\n\n /**\n * The reading direction of the accordion when applicable. If omitted, assumes LTR (left-to-right) reading mode.\n *\n * @group Props\n */\n readonly dirInput = input<Direction | undefined>(undefined, { alias: 'dir' });\n readonly dir: Signal<Direction> = injectDirection(this.dirInput);\n\n /** Whether the Accordion is disabled.\n * @defaultValue false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * The orientation of the accordion.\n *\n * @defaultValue 'vertical'\n * @group Props\n */\n readonly orientation = input<DataOrientation>('vertical');\n\n /**\n * The default active value of the item(s).\n *\n * Use when you do not need to control the state of the item(s).\n * @group Props\n */\n readonly defaultValue = input<string | string[]>();\n\n /**\n * The controlled value of the item to expand.\n *\n * @group Props\n */\n readonly value = model<AcceptableValue | AcceptableValue[]>();\n\n /**\n * When type is \"single\", allows closing content when clicking trigger for an open item.\n * When type is \"multiple\", this prop has no effect.\n *\n * @defaultValue false\n * @group Props\n */\n readonly collapsible = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Determines whether a \"single\" or \"multiple\" items can be selected at a time.\n *\n * @defaultValue 'single'\n * @group Props\n */\n readonly type = input<'multiple' | 'single'>('single');\n\n /**\n * Allow multiple panels to be open simultaneously.\n * Takes precedence over `type` when `true`.\n *\n * @defaultValue false\n * @group Props\n */\n readonly multiple = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether keyboard focus wraps from the last item to the first and vice versa.\n *\n * @defaultValue true\n * @group Props\n */\n readonly loopFocus = input<boolean, BooleanInput>(true, { transform: booleanAttribute });\n\n /**\n * Whether to keep the content of collapsed items mounted in the DOM.\n * When `true`, closed panels keep their element in the DOM instead of\n * receiving a `hidden` attribute. Applies to the always-mounted\n * `rdxAccordionContent`; the `rdxAccordionContentPresence` variant always\n * unmounts.\n *\n * @defaultValue false\n * @group Props\n */\n readonly keepMounted = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Event handler called when the expanded state of an item changes.\n * @group Emits\n */\n readonly onValueChange = output<AcceptableValue | AcceptableValue[] | undefined>();\n\n readonly isSingle = computed(() => !this.multiple() && this.type() !== 'multiple');\n\n constructor() {\n effect(() => {\n if (this.defaultValue() !== undefined) {\n this.value.set(this.defaultValue());\n }\n });\n }\n\n changeModelValue = (newValue: string) => {\n if (this.isSingle()) {\n this.value.set(this.isEqual(newValue, this.value()) ? undefined : newValue);\n } else {\n const currentValue = this.value();\n let modelValueArray: AcceptableValue[] = [];\n\n if (Array.isArray(currentValue)) {\n modelValueArray = [...currentValue];\n } else if (currentValue !== undefined && currentValue !== null) {\n modelValueArray = [currentValue];\n }\n\n if (this.isValueEqualOrExist(modelValueArray, newValue)) {\n const index = modelValueArray.findIndex((item) => this.isEqual(item, newValue));\n if (index !== -1) {\n modelValueArray.splice(index, 1);\n }\n } else {\n modelValueArray.push(newValue);\n }\n\n this.value.set(modelValueArray);\n }\n\n this.onValueChange.emit(this.value());\n };\n\n private isValueEqualOrExist(arr: AcceptableValue[], value: AcceptableValue): boolean {\n return arr.some((item) => this.isEqual(item, value));\n }\n\n private isEqual(a: any, b: any): boolean {\n return JSON.stringify(a) === JSON.stringify(b);\n }\n}\n","import {\n booleanAttribute,\n computed,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n output,\n signal,\n Signal,\n WritableSignal\n} from '@angular/core';\nimport { injectCollapsibleRootContext, RdxCollapsibleRootDirective } from '@radix-ng/primitives/collapsible';\nimport { BooleanInput, createContext, useArrowNavigation } from '@radix-ng/primitives/core';\nimport { injectAccordionRootContext } from './accordion-root.directive';\n\nexport type RdxAccordionItemState = 'open' | 'closed';\n\nexport type AccordionItemContext = {\n open: Signal<boolean>;\n disabled: Signal<boolean>;\n triggerId: WritableSignal<string>;\n dataState: Signal<RdxAccordionItemState>;\n dataDisabled: Signal<boolean>;\n currentElement: ElementRef<HTMLElement>;\n value: Signal<string | undefined>;\n updateOpen: () => void;\n index: Signal<number>;\n};\n\nexport const [injectAccordionItemContext, provideAccordionItemContext] = createContext<AccordionItemContext>(\n 'AccordionItemContext',\n 'components/accordion'\n);\n\nconst itemContext = (): AccordionItemContext => {\n const instance = inject(RdxAccordionItemDirective);\n\n return {\n open: instance.open,\n dataState: instance.dataState,\n disabled: instance.disabled,\n dataDisabled: instance.isDisabled,\n triggerId: instance.triggerId,\n currentElement: instance.elementRef,\n value: computed(() => instance.value()),\n updateOpen: instance.updateOpen,\n index: instance.index\n };\n};\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxAccordionItem]',\n exportAs: 'rdxAccordionItem',\n providers: [provideAccordionItemContext(itemContext)],\n hostDirectives: [\n {\n directive: RdxCollapsibleRootDirective,\n inputs: ['disabled: disabled', 'open: open']\n }\n ],\n host: {\n '[attr.data-orientation]': 'rootContext.orientation()',\n '[attr.data-disabled]': 'isDisabled() ? \"\" : undefined',\n '[attr.data-state]': 'dataState()',\n '[attr.data-index]': 'index()',\n\n '(keydown.arrowDown)': 'handleArrowKey($event)',\n '(keydown.arrowUp)': 'handleArrowKey($event)',\n '(keydown.arrowLeft)': 'handleArrowKey($event)',\n '(keydown.arrowRight)': 'handleArrowKey($event)',\n '(keydown.home)': 'handleArrowKey($event)',\n '(keydown.end)': 'handleArrowKey($event)'\n }\n})\nexport class RdxAccordionItemDirective {\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n private readonly collapsibleContext = injectCollapsibleRootContext();\n\n protected readonly rootContext = injectAccordionRootContext();\n\n /**\n * A string value for the accordion item. All items within an accordion should use a unique value.\n * @group Props\n */\n readonly value = input<string>();\n\n /**\n * Whether or not an accordion item is disabled from user interaction.\n * When `true`, prevents the user from interacting with the item.\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Event handler called when the panel open state changes.\n * @group Emits\n */\n readonly onOpenChange = output<boolean>();\n\n readonly isDisabled = computed(() => {\n return this.rootContext.disabled() || this.disabled();\n });\n\n readonly open = computed(() => {\n const rootValue = this.rootContext.value();\n\n return this.rootContext.isSingle()\n ? this.value() === rootValue\n : Array.isArray(rootValue) && rootValue.includes(this.value()!);\n });\n\n readonly dataState = computed((): RdxAccordionItemState => (this.open() ? 'open' : 'closed'));\n\n /** Set by the trigger; links the content's `aria-labelledby` to the trigger `id`. */\n readonly triggerId = signal('');\n\n readonly index = computed(() => {\n const allItems = Array.from(this.rootContext.elementRef.nativeElement.querySelectorAll('[rdxAccordionItem]'));\n return allItems.indexOf(this.elementRef.nativeElement);\n });\n\n constructor() {\n // Collapsed accordion panels stay findable by the browser's in-page search; opening one\n // via find-in-page expands the item. (The standalone Collapsible defaults to plain `hidden`.)\n this.collapsibleContext.hiddenUntilFound.set(true);\n\n effect(() => {\n this.updateOpen();\n });\n\n effect(() => {\n this.collapsibleContext.keepMounted.set(this.rootContext.keepMounted());\n });\n\n let initialized = false;\n effect(() => {\n const isOpen = this.open();\n if (!initialized) {\n initialized = true;\n return;\n }\n this.onOpenChange.emit(isOpen);\n });\n }\n\n updateOpen = () => {\n this.collapsibleContext.open.set(this.open());\n };\n\n handleArrowKey(event: Event) {\n const keyEvent = event as KeyboardEvent;\n const target = event.target as HTMLElement;\n const allCollectionItems: HTMLElement[] = Array.from(\n this.rootContext.elementRef.nativeElement?.querySelectorAll('[data-rdx-collection-item]') ?? []\n );\n\n const collectionItemIndex = allCollectionItems.findIndex((item) => item === target);\n if (collectionItemIndex === -1) return;\n\n useArrowNavigation(\n keyEvent,\n this.elementRef.nativeElement.querySelector('[data-rdx-collection-item]')!,\n this.rootContext.elementRef.nativeElement,\n {\n arrowKeyOptions: this.rootContext.orientation(),\n dir: this.rootContext.direction(),\n loop: this.rootContext.loopFocus(),\n focus: true\n }\n );\n }\n}\n","import { Directive } from '@angular/core';\nimport { RdxCollapsiblePanelDirective } from '@radix-ng/primitives/collapsible';\nimport { injectAccordionItemContext } from './accordion-item.directive';\nimport { injectAccordionRootContext } from './accordion-root.directive';\n\n@Directive({\n selector: '[rdxAccordionContent]',\n hostDirectives: [RdxCollapsiblePanelDirective],\n host: {\n role: 'region',\n '[attr.aria-labelledby]': 'itemContext.triggerId()',\n '[attr.data-state]': 'itemContext.dataState()',\n '[attr.data-disabled]': 'itemContext.dataDisabled() ? \"\" : undefined',\n '[attr.data-orientation]': 'rootContext.orientation()',\n '[attr.data-index]': 'itemContext.index()',\n '[style]': `{\n '--radix-accordion-content-height': 'var(--collapsible-panel-height)',\n '--radix-accordion-content-width': 'var(--collapsible-panel-width)',\n }`\n }\n})\nexport class RdxAccordionContentDirective {\n protected readonly rootContext = injectAccordionRootContext();\n protected readonly itemContext = injectAccordionItemContext();\n}\n","import { Directive } from '@angular/core';\nimport { injectAccordionItemContext } from './accordion-item.directive';\nimport { injectAccordionRootContext } from './accordion-root.directive';\n\n@Directive({\n selector: '[rdxAccordionHeader]',\n host: {\n '[attr.data-state]': 'itemContext.dataState()',\n '[attr.data-disabled]': 'itemContext.dataDisabled() ? \"\" : undefined',\n '[attr.data-orientation]': 'rootContext.orientation()',\n '[attr.data-index]': 'itemContext.index()'\n }\n})\nexport class RdxAccordionHeaderDirective {\n protected readonly rootContext = injectAccordionRootContext();\n protected readonly itemContext = injectAccordionItemContext();\n}\n","import { Directive } from '@angular/core';\nimport { injectId } from '@radix-ng/primitives/core';\nimport { injectAccordionItemContext } from './accordion-item.directive';\nimport { injectAccordionRootContext } from './accordion-root.directive';\n\n@Directive({\n selector: '[rdxAccordionTrigger]',\n host: {\n '[id]': 'itemContext.triggerId()',\n '[attr.data-rdx-collection-item]': '\"\"',\n '[attr.role]': '\"button\"',\n '[attr.aria-expanded]': 'itemContext.open()',\n '[attr.aria-disabled]': 'itemContext.open() && !rootContext.collapsible() ? \"true\" : undefined',\n '[attr.data-orientation]': 'rootContext.orientation()',\n '[attr.data-state]': 'itemContext.dataState()',\n '[attr.disabled]': 'itemContext.dataDisabled() ? \"\" : undefined',\n '[attr.data-panel-open]': 'itemContext.open() ? \"\" : undefined',\n '[attr.data-index]': 'itemContext.index()',\n\n '(click)': 'changeItem()'\n }\n})\nexport class RdxAccordionTriggerDirective {\n protected readonly rootContext = injectAccordionRootContext();\n protected readonly itemContext = injectAccordionItemContext();\n\n constructor() {\n this.itemContext.triggerId.set(injectId('rdx-accordion-trigger-'));\n }\n\n changeItem() {\n // In single mode an open item stays open (unless `collapsible`), so a click on it is a no-op.\n const lockedOpen = this.rootContext.isSingle() && this.itemContext.open() && !this.rootContext.collapsible();\n\n // `dataDisabled` is the effective disabled state (accordion-root OR item level).\n if (this.itemContext.dataDisabled() || lockedOpen) {\n return;\n }\n\n this.rootContext.changeModelValue(this.itemContext.value()!);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { RdxAccordionContentPresenceDirective } from './src/accordion-content-presence.directive';\nimport { RdxAccordionContentDirective } from './src/accordion-content.directive';\nimport { RdxAccordionHeaderDirective } from './src/accordion-header.directive';\nimport { RdxAccordionItemDirective } from './src/accordion-item.directive';\nimport { RdxAccordionRootDirective } from './src/accordion-root.directive';\nimport { RdxAccordionTriggerDirective } from './src/accordion-trigger.directive';\n\nexport * from './src/accordion-content-presence.directive';\nexport * from './src/accordion-content.directive';\nexport * from './src/accordion-header.directive';\nexport * from './src/accordion-item.directive';\nexport * from './src/accordion-root.directive';\nexport * from './src/accordion-trigger.directive';\n\nconst _imports = [\n RdxAccordionContentDirective,\n RdxAccordionHeaderDirective,\n RdxAccordionItemDirective,\n RdxAccordionRootDirective,\n RdxAccordionTriggerDirective,\n RdxAccordionContentPresenceDirective\n];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxAccordionModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAOa,oCAAoC,CAAA;8GAApC,oCAAoC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAApC,oCAAoC,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,0CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,oCAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAApC,oCAAoC,EAAA,UAAA,EAAA,CAAA;kBAJhD,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,0CAA0C;oBACpD,cAAc,EAAE,CAAC,oCAAoC;AACxD,iBAAA;;;ACgCM,MAAM,CAAC,0BAA0B,EAAE,2BAA2B,CAAC,GAAG,aAAa,CAClF,sBAAsB,EACtB,sBAAsB;AAG1B,M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,oCAAoC,aALpC,4BAA4B;YAC5B,2BAA2B;YAC3B,yBAAyB;YACzB,yBAAyB;YACzB,4BAA4B;YAC5B,oCAAoC,CAAA,EAAA,CAAA,CAAA;+GAO3B,kBAAkB,EAAA,CAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;AC3BD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"radix-ng-primitives-accordion.mjs","sources":["../../../packages/primitives/accordion/src/accordion-content-presence.directive.ts","../../../packages/primitives/accordion/src/accordion-root.directive.ts","../../../packages/primitives/accordion/src/accordion-item.directive.ts","../../../packages/primitives/accordion/src/accordion-content.directive.ts","../../../packages/primitives/accordion/src/accordion-header.directive.ts","../../../packages/primitives/accordion/src/accordion-trigger.directive.ts","../../../packages/primitives/accordion/index.ts","../../../packages/primitives/accordion/radix-ng-primitives-accordion.ts"],"sourcesContent":["import { Directive } from '@angular/core';\nimport { RdxCollapsiblePanelPresenceDirective } from '@radix-ng/primitives/collapsible';\n\n@Directive({\n selector: 'ng-template[rdxAccordionContentPresence]',\n hostDirectives: [RdxCollapsiblePanelPresenceDirective]\n})\nexport class RdxAccordionContentPresenceDirective {}\n","import {\n booleanAttribute,\n computed,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n InputSignal,\n InputSignalWithTransform,\n model,\n ModelSignal,\n output,\n Signal\n} from '@angular/core';\nimport { AcceptableValue, BooleanInput, createContext, DataOrientation, injectId } from '@radix-ng/primitives/core';\n\nexport type AccordionRootContext = {\n disabled: InputSignalWithTransform<boolean, BooleanInput>;\n orientation: InputSignal<DataOrientation>;\n value: ModelSignal<AcceptableValue | AcceptableValue[] | undefined>;\n collapsible: Signal<boolean>;\n isSingle: Signal<boolean>;\n keepMounted: InputSignalWithTransform<boolean, BooleanInput>;\n elementRef: ElementRef<HTMLElement>;\n changeModelValue: (value: string) => void;\n};\n\nexport const [injectAccordionRootContext, provideAccordionRootContext] = createContext<AccordionRootContext>(\n 'AccordionRootContext',\n 'components/accordion'\n);\n\nconst rootContext = (): AccordionRootContext => {\n const instance = inject(RdxAccordionRootDirective);\n\n return {\n disabled: instance.disabled,\n collapsible: instance.collapsible,\n orientation: instance.orientation,\n elementRef: instance.elementRef,\n value: instance.value,\n isSingle: instance.isSingle,\n keepMounted: instance.keepMounted,\n changeModelValue: instance.changeModelValue\n };\n};\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxAccordionRoot]',\n exportAs: 'rdxAccordionRoot',\n providers: [provideAccordionRootContext(rootContext)],\n host: {\n '[attr.data-orientation]': 'orientation()',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined'\n }\n})\nexport class RdxAccordionRootDirective {\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n readonly id = input<string>(injectId('rdx-accordion-'));\n\n /** Whether the Accordion is disabled.\n * @defaultValue false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * The orientation of the accordion.\n *\n * Deprecated following the APG guidance update to remove roving focus.\n * This prop no longer affects keyboard focus behavior.\n *\n * @defaultValue 'vertical'\n * @group Props\n * @deprecated\n */\n readonly orientation = input<DataOrientation>('vertical');\n\n /**\n * The default active value of the item(s).\n *\n * Use when you do not need to control the state of the item(s).\n * @group Props\n */\n readonly defaultValue = input<string | string[]>();\n\n /**\n * The controlled value of the item to expand.\n *\n * @group Props\n */\n readonly value = model<AcceptableValue | AcceptableValue[]>();\n\n /**\n * When type is \"single\", allows closing content when clicking trigger for an open item.\n * When type is \"multiple\", this prop has no effect.\n *\n * @defaultValue false\n * @group Props\n */\n readonly collapsible = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Determines whether a \"single\" or \"multiple\" items can be selected at a time.\n *\n * @defaultValue 'single'\n * @group Props\n */\n readonly type = input<'multiple' | 'single'>('single');\n\n /**\n * Allow multiple panels to be open simultaneously.\n * Takes precedence over `type` when `true`.\n *\n * @defaultValue false\n * @group Props\n */\n readonly multiple = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Deprecated following the APG guidance update to remove roving focus.\n * This prop no longer affects keyboard focus behavior.\n *\n * @defaultValue true\n * @group Props\n * @deprecated\n */\n readonly loopFocus = input<boolean, BooleanInput>(true, { transform: booleanAttribute });\n\n /**\n * Whether to keep the content of collapsed items mounted in the DOM.\n * When `true`, closed panels keep their element in the DOM instead of\n * receiving a `hidden` attribute. Applies to the always-mounted\n * `rdxAccordionContent`; the `rdxAccordionContentPresence` variant always\n * unmounts.\n *\n * @defaultValue false\n * @group Props\n */\n readonly keepMounted = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Event handler called when the expanded state of an item changes.\n * @group Emits\n */\n readonly onValueChange = output<AcceptableValue | AcceptableValue[] | undefined>();\n\n readonly isSingle = computed(() => !this.multiple() && this.type() !== 'multiple');\n\n constructor() {\n effect(() => {\n if (this.defaultValue() !== undefined) {\n this.value.set(this.defaultValue());\n }\n });\n }\n\n changeModelValue = (newValue: string) => {\n if (this.isSingle()) {\n this.value.set(this.isEqual(newValue, this.value()) ? undefined : newValue);\n } else {\n const currentValue = this.value();\n let modelValueArray: AcceptableValue[] = [];\n\n if (Array.isArray(currentValue)) {\n modelValueArray = [...currentValue];\n } else if (currentValue !== undefined && currentValue !== null) {\n modelValueArray = [currentValue];\n }\n\n if (this.isValueEqualOrExist(modelValueArray, newValue)) {\n const index = modelValueArray.findIndex((item) => this.isEqual(item, newValue));\n if (index !== -1) {\n modelValueArray.splice(index, 1);\n }\n } else {\n modelValueArray.push(newValue);\n }\n\n this.value.set(modelValueArray);\n }\n\n this.onValueChange.emit(this.value());\n };\n\n private isValueEqualOrExist(arr: AcceptableValue[], value: AcceptableValue): boolean {\n return arr.some((item) => this.isEqual(item, value));\n }\n\n private isEqual(a: any, b: any): boolean {\n return JSON.stringify(a) === JSON.stringify(b);\n }\n}\n","import {\n booleanAttribute,\n computed,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n output,\n signal,\n Signal,\n WritableSignal\n} from '@angular/core';\nimport { injectCollapsibleRootContext, RdxCollapsibleRootDirective } from '@radix-ng/primitives/collapsible';\nimport { BooleanInput, createContext } from '@radix-ng/primitives/core';\nimport { injectAccordionRootContext } from './accordion-root.directive';\n\nexport type RdxAccordionItemState = 'open' | 'closed';\n\nexport type AccordionItemContext = {\n open: Signal<boolean>;\n disabled: Signal<boolean>;\n triggerId: WritableSignal<string>;\n dataState: Signal<RdxAccordionItemState>;\n dataDisabled: Signal<boolean>;\n currentElement: ElementRef<HTMLElement>;\n value: Signal<string | undefined>;\n updateOpen: () => void;\n index: Signal<number>;\n};\n\nexport const [injectAccordionItemContext, provideAccordionItemContext] = createContext<AccordionItemContext>(\n 'AccordionItemContext',\n 'components/accordion'\n);\n\nconst itemContext = (): AccordionItemContext => {\n const instance = inject(RdxAccordionItemDirective);\n\n return {\n open: instance.open,\n dataState: instance.dataState,\n disabled: instance.disabled,\n dataDisabled: instance.isDisabled,\n triggerId: instance.triggerId,\n currentElement: instance.elementRef,\n value: computed(() => instance.value()),\n updateOpen: instance.updateOpen,\n index: instance.index\n };\n};\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxAccordionItem]',\n exportAs: 'rdxAccordionItem',\n providers: [provideAccordionItemContext(itemContext)],\n hostDirectives: [\n {\n directive: RdxCollapsibleRootDirective,\n inputs: ['disabled: disabled', 'open: open']\n }\n ],\n host: {\n '[attr.data-orientation]': 'rootContext.orientation()',\n '[attr.data-disabled]': 'isDisabled() ? \"\" : undefined',\n '[attr.data-state]': 'dataState()',\n '[attr.data-index]': 'index()'\n }\n})\nexport class RdxAccordionItemDirective {\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n private readonly collapsibleContext = injectCollapsibleRootContext();\n\n protected readonly rootContext = injectAccordionRootContext();\n\n /**\n * A string value for the accordion item. All items within an accordion should use a unique value.\n * @group Props\n */\n readonly value = input<string>();\n\n /**\n * Whether or not an accordion item is disabled from user interaction.\n * When `true`, prevents the user from interacting with the item.\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Event handler called when the panel open state changes.\n * @group Emits\n */\n readonly onOpenChange = output<boolean>();\n\n readonly isDisabled = computed(() => {\n return this.rootContext.disabled() || this.disabled();\n });\n\n readonly open = computed(() => {\n const rootValue = this.rootContext.value();\n\n return this.rootContext.isSingle()\n ? this.value() === rootValue\n : Array.isArray(rootValue) && rootValue.includes(this.value()!);\n });\n\n readonly dataState = computed((): RdxAccordionItemState => (this.open() ? 'open' : 'closed'));\n\n /** Set by the trigger; links the content's `aria-labelledby` to the trigger `id`. */\n readonly triggerId = signal('');\n\n readonly index = computed(() => {\n const allItems = Array.from(this.rootContext.elementRef.nativeElement.querySelectorAll('[rdxAccordionItem]'));\n return allItems.indexOf(this.elementRef.nativeElement);\n });\n\n constructor() {\n // Collapsed accordion panels stay findable by the browser's in-page search; opening one\n // via find-in-page expands the item. (The standalone Collapsible defaults to plain `hidden`.)\n this.collapsibleContext.hiddenUntilFound.set(true);\n\n effect(() => {\n this.updateOpen();\n });\n\n effect(() => {\n this.collapsibleContext.keepMounted.set(this.rootContext.keepMounted());\n });\n\n let initialized = false;\n effect(() => {\n const isOpen = this.open();\n if (!initialized) {\n initialized = true;\n return;\n }\n this.onOpenChange.emit(isOpen);\n });\n }\n\n updateOpen = () => {\n this.collapsibleContext.open.set(this.open());\n };\n}\n","import { Directive } from '@angular/core';\nimport { RdxCollapsiblePanelDirective } from '@radix-ng/primitives/collapsible';\nimport { injectAccordionItemContext } from './accordion-item.directive';\nimport { injectAccordionRootContext } from './accordion-root.directive';\n\n@Directive({\n selector: '[rdxAccordionContent]',\n hostDirectives: [RdxCollapsiblePanelDirective],\n host: {\n role: 'region',\n '[attr.aria-labelledby]': 'itemContext.triggerId()',\n '[attr.data-state]': 'itemContext.dataState()',\n '[attr.data-disabled]': 'itemContext.dataDisabled() ? \"\" : undefined',\n '[attr.data-orientation]': 'rootContext.orientation()',\n '[attr.data-index]': 'itemContext.index()',\n '[style]': `{\n '--radix-accordion-content-height': 'var(--collapsible-panel-height)',\n '--radix-accordion-content-width': 'var(--collapsible-panel-width)',\n }`\n }\n})\nexport class RdxAccordionContentDirective {\n protected readonly rootContext = injectAccordionRootContext();\n protected readonly itemContext = injectAccordionItemContext();\n}\n","import { Directive } from '@angular/core';\nimport { injectAccordionItemContext } from './accordion-item.directive';\nimport { injectAccordionRootContext } from './accordion-root.directive';\n\n@Directive({\n selector: '[rdxAccordionHeader]',\n host: {\n '[attr.data-state]': 'itemContext.dataState()',\n '[attr.data-disabled]': 'itemContext.dataDisabled() ? \"\" : undefined',\n '[attr.data-orientation]': 'rootContext.orientation()',\n '[attr.data-index]': 'itemContext.index()'\n }\n})\nexport class RdxAccordionHeaderDirective {\n protected readonly rootContext = injectAccordionRootContext();\n protected readonly itemContext = injectAccordionItemContext();\n}\n","import { Directive } from '@angular/core';\nimport { injectId } from '@radix-ng/primitives/core';\nimport { injectAccordionItemContext } from './accordion-item.directive';\nimport { injectAccordionRootContext } from './accordion-root.directive';\n\n@Directive({\n selector: '[rdxAccordionTrigger]',\n host: {\n '[id]': 'itemContext.triggerId()',\n '[attr.data-rdx-collection-item]': '\"\"',\n '[attr.role]': '\"button\"',\n '[attr.aria-expanded]': 'itemContext.open()',\n '[attr.aria-disabled]': 'itemContext.open() && !rootContext.collapsible() ? \"true\" : undefined',\n '[attr.data-orientation]': 'rootContext.orientation()',\n '[attr.data-state]': 'itemContext.dataState()',\n '[attr.disabled]': 'itemContext.dataDisabled() ? \"\" : undefined',\n '[attr.data-panel-open]': 'itemContext.open() ? \"\" : undefined',\n '[attr.data-index]': 'itemContext.index()',\n\n '(click)': 'changeItem()'\n }\n})\nexport class RdxAccordionTriggerDirective {\n protected readonly rootContext = injectAccordionRootContext();\n protected readonly itemContext = injectAccordionItemContext();\n\n constructor() {\n this.itemContext.triggerId.set(injectId('rdx-accordion-trigger-'));\n }\n\n changeItem() {\n // In single mode an open item stays open (unless `collapsible`), so a click on it is a no-op.\n const lockedOpen = this.rootContext.isSingle() && this.itemContext.open() && !this.rootContext.collapsible();\n\n // `dataDisabled` is the effective disabled state (accordion-root OR item level).\n if (this.itemContext.dataDisabled() || lockedOpen) {\n return;\n }\n\n this.rootContext.changeModelValue(this.itemContext.value()!);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { RdxAccordionContentPresenceDirective } from './src/accordion-content-presence.directive';\nimport { RdxAccordionContentDirective } from './src/accordion-content.directive';\nimport { RdxAccordionHeaderDirective } from './src/accordion-header.directive';\nimport { RdxAccordionItemDirective } from './src/accordion-item.directive';\nimport { RdxAccordionRootDirective } from './src/accordion-root.directive';\nimport { RdxAccordionTriggerDirective } from './src/accordion-trigger.directive';\n\nexport * from './src/accordion-content-presence.directive';\nexport * from './src/accordion-content.directive';\nexport * from './src/accordion-header.directive';\nexport * from './src/accordion-item.directive';\nexport * from './src/accordion-root.directive';\nexport * from './src/accordion-trigger.directive';\n\nconst _imports = [\n RdxAccordionContentDirective,\n RdxAccordionHeaderDirective,\n RdxAccordionItemDirective,\n RdxAccordionRootDirective,\n RdxAccordionTriggerDirective,\n RdxAccordionContentPresenceDirective\n];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxAccordionModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAOa,oCAAoC,CAAA;8GAApC,oCAAoC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAApC,oCAAoC,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,0CAAA,EAAA,cAA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,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAlB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,YAZ3B,4BAA4B;YAC5B,2BAA2B;YAC3B,yBAAyB;YACzB,yBAAyB;YACzB,4BAA4B;AAC5B,YAAA,oCAAoC,aALpC,4BAA4B;YAC5B,2BAA2B;YAC3B,yBAAyB;YACzB,yBAAyB;YACzB,4BAA4B;YAC5B,oCAAoC,CAAA,EAAA,CAAA,CAAA;+GAO3B,kBAAkB,EAAA,CAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;AC3BD;;AAEG;;;;"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, model, input, booleanAttribute, output, signal, computed, effect, Directive, ElementRef, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@radix-ng/primitives/core';
|
|
4
|
-
import { createContext, provideValueAccessor, RdxControlValueAccessor } from '@radix-ng/primitives/core';
|
|
5
|
-
import { outputFromObservable, outputToObservable } from '@angular/core/rxjs-interop';
|
|
4
|
+
import { createContext, createCancelableChangeEventDetails, provideValueAccessor, RdxControlValueAccessor } from '@radix-ng/primitives/core';
|
|
6
5
|
import * as i1$1 from '@radix-ng/primitives/presence';
|
|
7
6
|
import { provideRdxPresenceContext, RdxPresenceDirective } from '@radix-ng/primitives/presence';
|
|
8
7
|
|
|
@@ -16,8 +15,8 @@ const groupContext = () => {
|
|
|
16
15
|
parentState: group.parentState,
|
|
17
16
|
controlledIds: group.controlledIds,
|
|
18
17
|
controlId: (name) => group.controlId(name),
|
|
19
|
-
toggleValue: (name) => group.toggleValue(name),
|
|
20
|
-
toggleAll: () => group.toggleAll(),
|
|
18
|
+
toggleValue: (name, event) => group.toggleValue(name, event),
|
|
19
|
+
toggleAll: (event) => group.toggleAll(event),
|
|
21
20
|
registerChild: (name, disabled) => group.registerChild(name, disabled),
|
|
22
21
|
registerControl: (name, id) => group.registerControl(name, id)
|
|
23
22
|
};
|
|
@@ -117,13 +116,15 @@ class RdxCheckboxGroupDirective {
|
|
|
117
116
|
};
|
|
118
117
|
}
|
|
119
118
|
/** Add/remove a single child name from the value (a direct child change). */
|
|
120
|
-
toggleValue(name) {
|
|
119
|
+
toggleValue(name, event) {
|
|
121
120
|
if (this.disabledState()) {
|
|
122
121
|
return;
|
|
123
122
|
}
|
|
124
123
|
const current = this.value();
|
|
125
124
|
const next = current.includes(name) ? current.filter((v) => v !== name) : [...current, name];
|
|
126
|
-
this.emit(next)
|
|
125
|
+
if (!this.emit(next, 'child-press', event)) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
127
128
|
// A direct child change becomes the new "remembered" selection and resets the parent cycle.
|
|
128
129
|
this.seeded = true;
|
|
129
130
|
this.uncontrolledState = next;
|
|
@@ -138,7 +139,7 @@ class RdxCheckboxGroupDirective {
|
|
|
138
139
|
*
|
|
139
140
|
* Disabled-but-checked children are always preserved (they cannot be toggled programmatically).
|
|
140
141
|
*/
|
|
141
|
-
toggleAll() {
|
|
142
|
+
toggleAll(event) {
|
|
142
143
|
if (this.disabledState()) {
|
|
143
144
|
return;
|
|
144
145
|
}
|
|
@@ -150,7 +151,7 @@ class RdxCheckboxGroupDirective {
|
|
|
150
151
|
const all = allValues.filter((name) => !this.isNameDisabled(name) || remembered.includes(name));
|
|
151
152
|
const rememberedIsAllOrNone = remembered.length === all.length || remembered.length === 0;
|
|
152
153
|
if (rememberedIsAllOrNone) {
|
|
153
|
-
this.emit(this.value().length === all.length ? none : all);
|
|
154
|
+
this.emit(this.value().length === all.length ? none : all, 'parent-press', event);
|
|
154
155
|
return;
|
|
155
156
|
}
|
|
156
157
|
let nextStatus = 'mixed';
|
|
@@ -163,7 +164,9 @@ class RdxCheckboxGroupDirective {
|
|
|
163
164
|
nextStatus = 'off';
|
|
164
165
|
nextValue = none;
|
|
165
166
|
}
|
|
166
|
-
this.emit(nextValue)
|
|
167
|
+
if (!this.emit(nextValue, 'parent-press', event)) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
167
170
|
this.parentStatus = nextStatus;
|
|
168
171
|
}
|
|
169
172
|
isNameDisabled(name) {
|
|
@@ -176,11 +179,17 @@ class RdxCheckboxGroupDirective {
|
|
|
176
179
|
this.uncontrolledState = this.value();
|
|
177
180
|
}
|
|
178
181
|
}
|
|
179
|
-
emit(next) {
|
|
182
|
+
emit(next, reason, event) {
|
|
183
|
+
const trigger = event?.currentTarget instanceof HTMLElement ? event.currentTarget : undefined;
|
|
184
|
+
const { eventDetails } = createCancelableChangeEventDetails(reason, event ?? new Event('checkbox-group.value-change'), trigger);
|
|
185
|
+
this.onValueChange.emit({ value: next, eventDetails });
|
|
186
|
+
if (eventDetails.isCanceled()) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
180
189
|
this.value.set(next);
|
|
181
|
-
this.onValueChange.emit(next);
|
|
182
190
|
this.onChange(next);
|
|
183
191
|
this.onTouched();
|
|
192
|
+
return true;
|
|
184
193
|
}
|
|
185
194
|
/** @ignore */
|
|
186
195
|
writeValue(value) {
|
|
@@ -235,8 +244,8 @@ const rootContext = () => {
|
|
|
235
244
|
form: checkbox.form,
|
|
236
245
|
readonly: checkbox.readonly,
|
|
237
246
|
state: checkbox.state,
|
|
238
|
-
toggle() {
|
|
239
|
-
checkbox.toggle();
|
|
247
|
+
toggle(event) {
|
|
248
|
+
checkbox.toggle(event);
|
|
240
249
|
}
|
|
241
250
|
};
|
|
242
251
|
};
|
|
@@ -318,7 +327,7 @@ class RdxCheckboxRootDirective {
|
|
|
318
327
|
* Event emitted when the checkbox checked state changes.
|
|
319
328
|
* @group Emits
|
|
320
329
|
*/
|
|
321
|
-
this.onCheckedChange =
|
|
330
|
+
this.onCheckedChange = output();
|
|
322
331
|
/**
|
|
323
332
|
* @ignore
|
|
324
333
|
* The effective checked state as a `boolean`. Inside a `rdxCheckboxGroup` it is derived from the
|
|
@@ -363,16 +372,16 @@ class RdxCheckboxRootDirective {
|
|
|
363
372
|
}
|
|
364
373
|
});
|
|
365
374
|
}
|
|
366
|
-
toggle() {
|
|
375
|
+
toggle(event) {
|
|
367
376
|
const group = this.group;
|
|
368
377
|
if (group) {
|
|
369
378
|
if (this.parent()) {
|
|
370
|
-
group.toggleAll();
|
|
379
|
+
group.toggleAll(event);
|
|
371
380
|
return;
|
|
372
381
|
}
|
|
373
382
|
const name = this.name();
|
|
374
383
|
if (name !== undefined) {
|
|
375
|
-
group.toggleValue(name);
|
|
384
|
+
group.toggleValue(name, event);
|
|
376
385
|
return;
|
|
377
386
|
}
|
|
378
387
|
}
|
|
@@ -381,6 +390,12 @@ class RdxCheckboxRootDirective {
|
|
|
381
390
|
// onCheckedChange fires once; the `checked`/`indeterminate` models are
|
|
382
391
|
// kept in sync so `[(checked)]` / `[(indeterminate)]` reflect the change.
|
|
383
392
|
const next = this.indeterminateState() ? true : !this.checkedState();
|
|
393
|
+
const trigger = event?.currentTarget instanceof HTMLElement ? event.currentTarget : undefined;
|
|
394
|
+
const { eventDetails } = createCancelableChangeEventDetails(event ? 'trigger-press' : 'none', event ?? new Event('checkbox.checked-change'), trigger);
|
|
395
|
+
this.onCheckedChange.emit({ checked: next, eventDetails });
|
|
396
|
+
if (eventDetails.isCanceled()) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
384
399
|
this.indeterminate.set(false);
|
|
385
400
|
this.checked.set(next);
|
|
386
401
|
this.controlValueAccessor.setValue(next);
|
|
@@ -440,7 +455,7 @@ class RdxCheckboxButtonDirective {
|
|
|
440
455
|
if (event.defaultPrevented || this.rootContext.readonly()) {
|
|
441
456
|
return;
|
|
442
457
|
}
|
|
443
|
-
this.rootContext.toggle();
|
|
458
|
+
this.rootContext.toggle(event);
|
|
444
459
|
if (this.rootContext.form() || this.elementRef.nativeElement.closest('form')) {
|
|
445
460
|
// if checkbox is in a form, stop propagation from the button so that we only propagate
|
|
446
461
|
// one click event (from the input). We propagate changes from an input so that native
|