@radix-ng/primitives 0.37.0 → 0.38.0
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/accordion/index.d.ts +3 -1
- package/accordion/src/accordion-content-presence.directive.d.ts +6 -0
- package/accordion/src/accordion-content.directive.d.ts +4 -7
- package/accordion/src/accordion-header.directive.d.ts +2 -2
- package/accordion/src/accordion-item.directive.d.ts +24 -83
- package/accordion/src/accordion-root.directive.d.ts +33 -87
- package/accordion/src/accordion-trigger.directive.d.ts +5 -11
- package/collapsible/index.d.ts +11 -0
- package/collapsible/src/collapsible-content-presence.directive.d.ts +6 -0
- package/collapsible/src/collapsible-content.directive.d.ts +10 -9
- package/collapsible/src/collapsible-root.directive.d.ts +19 -37
- package/collapsible/src/collapsible-trigger.directive.d.ts +1 -21
- package/core/index.d.ts +5 -0
- package/core/src/accessor/control-value-accessor.d.ts +67 -0
- package/core/src/create-context.d.ts +10 -0
- package/core/src/date-time/comparators.d.ts +7 -1
- package/core/src/date-time/useDateField.d.ts +2 -2
- package/core/src/types.d.ts +24 -0
- package/{stepper/src/utils → core/src}/useArrowNavigation.d.ts +2 -2
- package/core/src/useResizeObserver.d.ts +15 -0
- package/fesm2022/radix-ng-primitives-accordion.mjs +196 -408
- package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-avatar.mjs +2 -10
- package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-calendar.mjs +3 -14
- package/fesm2022/radix-ng-primitives-calendar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-collapsible.mjs +138 -143
- package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-core.mjs +248 -7
- package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-hover-card.mjs +1 -3
- package/fesm2022/radix-ng-primitives-hover-card.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menubar.mjs +1 -8
- package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-pagination.mjs +2 -6
- package/fesm2022/radix-ng-primitives-pagination.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-popover.mjs +2 -6
- package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-presence.mjs +34 -1
- package/fesm2022/radix-ng-primitives-presence.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-progress.mjs +2 -7
- package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-radio.mjs +1 -3
- package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-select.mjs +75 -33
- package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-stepper.mjs +1 -84
- package/fesm2022/radix-ng-primitives-stepper.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-switch.mjs +61 -100
- package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tabs.mjs +4 -19
- package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-time-field.mjs +351 -0
- package/fesm2022/radix-ng-primitives-time-field.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle.mjs +1 -6
- package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tooltip.mjs +1 -3
- package/fesm2022/radix-ng-primitives-tooltip.mjs.map +1 -1
- package/hover-card/src/hover-card-root.directive.d.ts +4 -4
- package/package.json +5 -1
- package/popover/src/popover-root.directive.d.ts +4 -4
- package/presence/index.d.ts +1 -0
- package/presence/src/presence.directive.d.ts +27 -0
- package/select/src/select-trigger.directive.d.ts +8 -2
- package/select/src/select.component.d.ts +23 -6
- package/switch/index.d.ts +0 -1
- package/switch/src/switch-input.directive.d.ts +1 -1
- package/switch/src/switch-root.directive.d.ts +23 -46
- package/switch/src/switch-thumb.directive.d.ts +1 -1
- package/time-field/README.md +1 -0
- package/time-field/index.d.ts +11 -0
- package/time-field/src/time-field-context.token.d.ts +19 -0
- package/time-field/src/time-field-input.directive.d.ts +53 -0
- package/time-field/src/time-field-root.directive.d.ts +125 -0
- package/tooltip/src/tooltip-root.directive.d.ts +4 -4
- package/collapsible/src/collapsible-content.token.d.ts +0 -3
@@ -1,4 +1,6 @@
|
|
1
1
|
import { Observable, EMPTY, of, Subject, endWith, fromEvent, filter, takeUntil, timer, race } from 'rxjs';
|
2
|
+
import * as i0 from '@angular/core';
|
3
|
+
import { InjectionToken, inject, ViewContainerRef, TemplateRef, effect, Directive } from '@angular/core';
|
2
4
|
|
3
5
|
/**
|
4
6
|
* Ensures that the observable stream runs inside Angular's NgZone.
|
@@ -146,6 +148,37 @@ const completeTransition = (element) => {
|
|
146
148
|
TransitionsMap.get(element)?.complete();
|
147
149
|
};
|
148
150
|
|
151
|
+
const RDX_PRESENCE_CONTEXT = new InjectionToken('RdxPresenceContext');
|
152
|
+
/**
|
153
|
+
* Factory provider helper.
|
154
|
+
* In your parent component/directive you can write:
|
155
|
+
*
|
156
|
+
* providers: [
|
157
|
+
* provideRdxPresenceContext(() => ({ present: myBooleanSignal }))
|
158
|
+
* ]
|
159
|
+
*/
|
160
|
+
function provideRdxPresenceContext(contextFactory) {
|
161
|
+
return { provide: RDX_PRESENCE_CONTEXT, useFactory: contextFactory };
|
162
|
+
}
|
163
|
+
class RdxPresenceDirective {
|
164
|
+
constructor() {
|
165
|
+
this.context = inject(RDX_PRESENCE_CONTEXT);
|
166
|
+
this.viewContainerRef = inject(ViewContainerRef);
|
167
|
+
this.templateRef = inject((TemplateRef));
|
168
|
+
this.effectRef = effect((onCleanup) => {
|
169
|
+
if (this.context.present()) {
|
170
|
+
const view = this.viewContainerRef.createEmbeddedView(this.templateRef, { $implicit: this.context });
|
171
|
+
onCleanup(() => view.destroy());
|
172
|
+
}
|
173
|
+
});
|
174
|
+
}
|
175
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxPresenceDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
176
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.4", type: RdxPresenceDirective, isStandalone: true, ngImport: i0 }); }
|
177
|
+
}
|
178
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxPresenceDirective, decorators: [{
|
179
|
+
type: Directive
|
180
|
+
}] });
|
181
|
+
|
149
182
|
// Define constants for class names
|
150
183
|
const COLLAPSE_CLASS = 'collapse';
|
151
184
|
const COLLAPSING_CLASS = 'collapsing';
|
@@ -246,5 +279,5 @@ const toastFadeOutTransition = ({ classList }) => {
|
|
246
279
|
* Generated bundle index. Do not edit.
|
247
280
|
*/
|
248
281
|
|
249
|
-
export { completeTransition, toastFadeInTransition, toastFadeOutTransition, transitionCollapsing, usePresence };
|
282
|
+
export { RDX_PRESENCE_CONTEXT, RdxPresenceDirective, completeTransition, provideRdxPresenceContext, toastFadeInTransition, toastFadeOutTransition, transitionCollapsing, usePresence };
|
250
283
|
//# sourceMappingURL=radix-ng-primitives-presence.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-presence.mjs","sources":["../../../packages/primitives/presence/src/utils.ts","../../../packages/primitives/presence/src/presence.ts","../../../packages/primitives/presence/src/transitions/transition.collapse.ts","../../../packages/primitives/presence/src/transitions/transition.toast.ts","../../../packages/primitives/presence/radix-ng-primitives-presence.ts"],"sourcesContent":["import { NgZone } from '@angular/core';\nimport { Observable } from 'rxjs';\n\n/**\n * Ensures that the observable stream runs inside Angular's NgZone.\n *\n * This function is a higher-order function that takes an observable stream as input and ensures\n * that all emissions, errors, and completion notifications are run inside Angular's NgZone. This\n * is particularly useful for ensuring that change detection is triggered properly in Angular\n * applications.\n *\n * @template T - The type of the items emitted by the observable.\n * @param {NgZone} zone - The Angular zone to control the change detection context.\n * @returns {(source: Observable<T>) => Observable<T>} - A function that takes an observable as input\n * and returns an observable that runs inside Angular's NgZone.\n *\n * Example usage:\n *\n * const source$ = of('some value');\n * const zoned$ = source$.pipe(runInZone(zone));\n * zoned$.subscribe(value => {\n * console.log('Value:', value);\n * });\n */\nfunction runInZone<T>(zone: NgZone): (source: Observable<T>) => Observable<T> {\n return (source: Observable<T>) =>\n new Observable((observer) =>\n source.subscribe({\n next: (value) => zone.run(() => observer.next(value)),\n error: (err) => zone.run(() => observer.error(err)),\n complete: () => zone.run(() => observer.complete())\n })\n );\n}\n\n/**\n * Calculates the total transition duration in milliseconds for a given HTML element.\n *\n * This function retrieves the computed style of the specified element and extracts the\n * transition duration and delay properties. It then converts these values from seconds\n * to milliseconds and returns their sum, representing the total transition duration.\n *\n * @param {HTMLElement} element - The HTML element for which to calculate the transition duration.\n * @returns {number} - The total transition duration in milliseconds.\n *\n * Example usage:\n *\n * const durationMs = getTransitionDurationMs(element);\n * console.log(`Transition duration: ${durationMs} ms`);\n */\nfunction getTransitionDurationMs(element: HTMLElement): number {\n const { transitionDelay, transitionDuration } = window.getComputedStyle(element);\n const transitionDelaySec = parseFloat(transitionDelay);\n const transitionDurationSec = parseFloat(transitionDuration);\n\n return (transitionDelaySec + transitionDurationSec) * 1000;\n}\n\nexport { getTransitionDurationMs, runInZone };\n\nexport function triggerReflow(element: HTMLElement) {\n return (element || document.body).getBoundingClientRect();\n}\n","import { NgZone } from '@angular/core';\nimport { EMPTY, endWith, filter, fromEvent, Observable, of, race, Subject, takeUntil, timer } from 'rxjs';\nimport { TransitionContext, TransitionEndFn, TransitionOptions, TransitionStartFn } from './types';\nimport { getTransitionDurationMs, runInZone } from './utils';\n\nconst noopFn: TransitionEndFn = () => {\n /* Noop */\n};\nconst TransitionsMap = new Map<HTMLElement, TransitionContext<any>>();\n\n/**\n * Manages the presence of an element with optional transition animation.\n *\n * @template T - The type of the context object used in the transition.\n * @param {NgZone} zone - The Angular zone to control the change detection context.\n * @param {HTMLElement} element - The target HTML element to apply the transition.\n * @param {TransitionOptions<T>} options - Options for controlling the transition behavior.\n * @param {T} [options.context] - An optional context object to pass through the transition.\n * @param {boolean} options.animation - A flag indicating if the transition should be animated.\n * @param {'start' | 'continue' | 'stop'} options.state - The desired state of the transition.\n * @param {TransitionStartFn<T>} startFn - A function to start the transition.\n * @returns {Observable<void>} - An observable that emits when the transition completes.\n *\n * The `usePresence` function is designed to manage the presence and visibility of an HTML element,\n * optionally applying a transition animation. It utilizes Angular's NgZone for efficient change\n * detection management and allows for different states of transitions ('start', 'continue', 'stop').\n * The function takes a start function to handle the beginning of the transition and returns an\n * observable that completes when the transition ends.\n *\n * Example usage:\n *\n * const options: TransitionOptions<MyContext> = {\n * context: {}, // your context object\n * animation: true,\n * state: 'start'\n * };\n *\n * const startFn: TransitionStartFn<MyContext> = (el, animation, context) => {\n * el.classList.add('active');\n * return () => el.classList.remove('active');\n * };\n *\n * usePresence(zone, element, startFn, options).subscribe(() => {\n * console.log('Transition completed');\n * });\n */\nconst usePresence = <T>(\n zone: NgZone,\n element: HTMLElement,\n startFn: TransitionStartFn<T>,\n options: TransitionOptions<T>\n): Observable<void> => {\n let context = options.context || <T>{};\n\n const transitionTimerDelayMs = options.transitionTimerDelayMs ?? 5;\n const state = options.state ?? 'stop';\n\n const running = TransitionsMap.get(element);\n\n if (running) {\n switch (state) {\n case 'continue':\n return EMPTY;\n case 'stop':\n zone.run(() => running.transition$.complete());\n context = { ...running.context, ...context };\n TransitionsMap.delete(element);\n break;\n }\n }\n const endFn = startFn(element, options.animation, context) || noopFn;\n\n if (!options.animation || window.getComputedStyle(element).transitionProperty === 'none') {\n zone.run(() => endFn());\n return of(undefined).pipe(runInZone(zone));\n }\n\n const transition$ = new Subject<void>();\n const finishTransition$ = new Subject<void>();\n const stop$ = transition$.pipe(endWith(true));\n\n TransitionsMap.set(element, {\n transition$,\n complete: () => {\n finishTransition$.next();\n finishTransition$.complete();\n },\n context\n });\n\n const transitionDurationMs = getTransitionDurationMs(element);\n\n zone.runOutsideAngular(() => {\n const transitionEnd$ = fromEvent<TransitionEvent>(element, 'transitionend').pipe(\n filter(({ target }) => target === element),\n takeUntil(stop$)\n );\n const timer$ = timer(transitionDurationMs + transitionTimerDelayMs).pipe(takeUntil(stop$));\n\n race(timer$, transitionEnd$, finishTransition$)\n .pipe(takeUntil(stop$))\n .subscribe(() => {\n TransitionsMap.delete(element);\n zone.run(() => {\n endFn();\n transition$.next();\n transition$.complete();\n });\n });\n });\n\n return transition$.asObservable();\n};\n\nconst completeTransition = (element: HTMLElement) => {\n TransitionsMap.get(element)?.complete();\n};\n\nexport { completeTransition, usePresence };\n","import { TransitionStartFn } from '../types';\nimport { triggerReflow } from '../utils';\n\nexport type CollapseContext = {\n direction: 'show' | 'hide';\n dimension: 'width' | 'height';\n maxSize?: string;\n};\n\n// Define constants for class names\nconst COLLAPSE_CLASS = 'collapse';\nconst COLLAPSING_CLASS = 'collapsing';\nconst SHOW_CLASS = 'show';\n/**\n * Function to handle the start of a collapsing transition.\n *\n * @param element - The HTML element to animate.\n * @param animation - Whether to use animation or not.\n * @param context - The context containing direction and dimension information.\n * @returns A function to clean up the animation.\n */\nexport const transitionCollapsing: TransitionStartFn<CollapseContext> = (\n element: HTMLElement,\n animation: boolean,\n context: CollapseContext\n) => {\n const { direction, dimension } = context;\n let { maxSize } = context;\n const { classList } = element;\n\n /**\n * Sets initial classes based on the direction.\n */\n function setInitialClasses() {\n classList.add(COLLAPSE_CLASS);\n if (direction === 'show') {\n classList.add(SHOW_CLASS);\n } else {\n classList.remove(SHOW_CLASS);\n }\n }\n\n if (!animation) {\n setInitialClasses();\n return;\n }\n\n if (!maxSize) {\n maxSize = measureCollapsingElementDimensionPx(element, dimension);\n context.maxSize = maxSize;\n\n // Fix the height before starting the animation\n element.style[dimension] = direction !== 'show' ? maxSize : '0px';\n\n classList.remove(COLLAPSE_CLASS, COLLAPSING_CLASS, 'show');\n\n triggerReflow(element);\n\n // Start the animation\n classList.add(COLLAPSING_CLASS);\n }\n\n element.style[dimension] = direction === 'show' ? maxSize : '0px';\n\n return () => {\n setInitialClasses();\n classList.remove(COLLAPSING_CLASS);\n element.style[dimension] = '';\n };\n};\n\n/**\n * Measures the dimension of the collapsing element in pixels.\n *\n * @param element - The HTML element to measure.\n * @param dimension - The dimension ('width' or 'height') to measure.\n * @returns The size of the dimension in pixels.\n */\nfunction measureCollapsingElementDimensionPx(element: HTMLElement, dimension: 'width' | 'height'): string {\n // SSR fix\n if (typeof navigator === 'undefined') {\n return '0px';\n }\n\n const { classList } = element;\n const hasShownClass = classList.contains(SHOW_CLASS);\n if (!hasShownClass) {\n classList.add(SHOW_CLASS);\n }\n\n element.style[dimension] = '';\n const dimensionSize = element.getBoundingClientRect()[dimension] + 'px';\n\n if (!hasShownClass) {\n classList.remove(SHOW_CLASS);\n }\n\n return dimensionSize;\n}\n","import { TransitionStartFn } from '../types';\nimport { triggerReflow } from '../utils';\n\nexport const toastFadeInTransition: TransitionStartFn = (element: HTMLElement, animation: boolean) => {\n const { classList } = element;\n\n if (animation) {\n classList.add('fade');\n } else {\n classList.add('show');\n return;\n }\n\n triggerReflow(element);\n classList.add('show', 'showing');\n\n return () => {\n classList.remove('showing');\n };\n};\n\nexport const toastFadeOutTransition: TransitionStartFn = ({ classList }: HTMLElement) => {\n classList.add('showing');\n return () => {\n classList.remove('show', 'showing');\n };\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAGA;;;;;;;;;;;;;;;;;;;;AAoBG;AACH,SAAS,SAAS,CAAI,IAAY,EAAA;AAC9B,IAAA,OAAO,CAAC,MAAqB,KACz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CAAC,aAAa,EAAE;AAChB,QAAA,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC;;AAG7B,IAAA,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;IAC7B,MAAM,aAAa,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC,SAAS,CAAC,GAAG,IAAI;IAEvE,IAAI,CAAC,aAAa,EAAE;AAChB,QAAA,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC;;AAGhC,IAAA,OAAO,aAAa;AACxB;;MC/Fa,qBAAqB,GAAsB,CAAC,OAAoB,EAAE,SAAkB,KAAI;AACjG,IAAA,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO;IAE7B,IAAI,SAAS,EAAE;AACX,QAAA,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC;;SAClB;AACH,QAAA,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC;QACrB;;IAGJ,aAAa,CAAC,OAAO,CAAC;AACtB,IAAA,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC;AAEhC,IAAA,OAAO,MAAK;AACR,QAAA,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC;AAC/B,KAAC;AACL;MAEa,sBAAsB,GAAsB,CAAC,EAAE,SAAS,EAAe,KAAI;AACpF,IAAA,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC;AACxB,IAAA,OAAO,MAAK;AACR,QAAA,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC;AACvC,KAAC;AACL;;AC1BA;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"radix-ng-primitives-presence.mjs","sources":["../../../packages/primitives/presence/src/utils.ts","../../../packages/primitives/presence/src/presence.ts","../../../packages/primitives/presence/src/presence.directive.ts","../../../packages/primitives/presence/src/transitions/transition.collapse.ts","../../../packages/primitives/presence/src/transitions/transition.toast.ts","../../../packages/primitives/presence/radix-ng-primitives-presence.ts"],"sourcesContent":["import { NgZone } from '@angular/core';\nimport { Observable } from 'rxjs';\n\n/**\n * Ensures that the observable stream runs inside Angular's NgZone.\n *\n * This function is a higher-order function that takes an observable stream as input and ensures\n * that all emissions, errors, and completion notifications are run inside Angular's NgZone. This\n * is particularly useful for ensuring that change detection is triggered properly in Angular\n * applications.\n *\n * @template T - The type of the items emitted by the observable.\n * @param {NgZone} zone - The Angular zone to control the change detection context.\n * @returns {(source: Observable<T>) => Observable<T>} - A function that takes an observable as input\n * and returns an observable that runs inside Angular's NgZone.\n *\n * Example usage:\n *\n * const source$ = of('some value');\n * const zoned$ = source$.pipe(runInZone(zone));\n * zoned$.subscribe(value => {\n * console.log('Value:', value);\n * });\n */\nfunction runInZone<T>(zone: NgZone): (source: Observable<T>) => Observable<T> {\n return (source: Observable<T>) =>\n new Observable((observer) =>\n source.subscribe({\n next: (value) => zone.run(() => observer.next(value)),\n error: (err) => zone.run(() => observer.error(err)),\n complete: () => zone.run(() => observer.complete())\n })\n );\n}\n\n/**\n * Calculates the total transition duration in milliseconds for a given HTML element.\n *\n * This function retrieves the computed style of the specified element and extracts the\n * transition duration and delay properties. It then converts these values from seconds\n * to milliseconds and returns their sum, representing the total transition duration.\n *\n * @param {HTMLElement} element - The HTML element for which to calculate the transition duration.\n * @returns {number} - The total transition duration in milliseconds.\n *\n * Example usage:\n *\n * const durationMs = getTransitionDurationMs(element);\n * console.log(`Transition duration: ${durationMs} ms`);\n */\nfunction getTransitionDurationMs(element: HTMLElement): number {\n const { transitionDelay, transitionDuration } = window.getComputedStyle(element);\n const transitionDelaySec = parseFloat(transitionDelay);\n const transitionDurationSec = parseFloat(transitionDuration);\n\n return (transitionDelaySec + transitionDurationSec) * 1000;\n}\n\nexport { getTransitionDurationMs, runInZone };\n\nexport function triggerReflow(element: HTMLElement) {\n return (element || document.body).getBoundingClientRect();\n}\n","import { NgZone } from '@angular/core';\nimport { EMPTY, endWith, filter, fromEvent, Observable, of, race, Subject, takeUntil, timer } from 'rxjs';\nimport { TransitionContext, TransitionEndFn, TransitionOptions, TransitionStartFn } from './types';\nimport { getTransitionDurationMs, runInZone } from './utils';\n\nconst noopFn: TransitionEndFn = () => {\n /* Noop */\n};\nconst TransitionsMap = new Map<HTMLElement, TransitionContext<any>>();\n\n/**\n * Manages the presence of an element with optional transition animation.\n *\n * @template T - The type of the context object used in the transition.\n * @param {NgZone} zone - The Angular zone to control the change detection context.\n * @param {HTMLElement} element - The target HTML element to apply the transition.\n * @param {TransitionOptions<T>} options - Options for controlling the transition behavior.\n * @param {T} [options.context] - An optional context object to pass through the transition.\n * @param {boolean} options.animation - A flag indicating if the transition should be animated.\n * @param {'start' | 'continue' | 'stop'} options.state - The desired state of the transition.\n * @param {TransitionStartFn<T>} startFn - A function to start the transition.\n * @returns {Observable<void>} - An observable that emits when the transition completes.\n *\n * The `usePresence` function is designed to manage the presence and visibility of an HTML element,\n * optionally applying a transition animation. It utilizes Angular's NgZone for efficient change\n * detection management and allows for different states of transitions ('start', 'continue', 'stop').\n * The function takes a start function to handle the beginning of the transition and returns an\n * observable that completes when the transition ends.\n *\n * Example usage:\n *\n * const options: TransitionOptions<MyContext> = {\n * context: {}, // your context object\n * animation: true,\n * state: 'start'\n * };\n *\n * const startFn: TransitionStartFn<MyContext> = (el, animation, context) => {\n * el.classList.add('active');\n * return () => el.classList.remove('active');\n * };\n *\n * usePresence(zone, element, startFn, options).subscribe(() => {\n * console.log('Transition completed');\n * });\n */\nconst usePresence = <T>(\n zone: NgZone,\n element: HTMLElement,\n startFn: TransitionStartFn<T>,\n options: TransitionOptions<T>\n): Observable<void> => {\n let context = options.context || <T>{};\n\n const transitionTimerDelayMs = options.transitionTimerDelayMs ?? 5;\n const state = options.state ?? 'stop';\n\n const running = TransitionsMap.get(element);\n\n if (running) {\n switch (state) {\n case 'continue':\n return EMPTY;\n case 'stop':\n zone.run(() => running.transition$.complete());\n context = { ...running.context, ...context };\n TransitionsMap.delete(element);\n break;\n }\n }\n const endFn = startFn(element, options.animation, context) || noopFn;\n\n if (!options.animation || window.getComputedStyle(element).transitionProperty === 'none') {\n zone.run(() => endFn());\n return of(undefined).pipe(runInZone(zone));\n }\n\n const transition$ = new Subject<void>();\n const finishTransition$ = new Subject<void>();\n const stop$ = transition$.pipe(endWith(true));\n\n TransitionsMap.set(element, {\n transition$,\n complete: () => {\n finishTransition$.next();\n finishTransition$.complete();\n },\n context\n });\n\n const transitionDurationMs = getTransitionDurationMs(element);\n\n zone.runOutsideAngular(() => {\n const transitionEnd$ = fromEvent<TransitionEvent>(element, 'transitionend').pipe(\n filter(({ target }) => target === element),\n takeUntil(stop$)\n );\n const timer$ = timer(transitionDurationMs + transitionTimerDelayMs).pipe(takeUntil(stop$));\n\n race(timer$, transitionEnd$, finishTransition$)\n .pipe(takeUntil(stop$))\n .subscribe(() => {\n TransitionsMap.delete(element);\n zone.run(() => {\n endFn();\n transition$.next();\n transition$.complete();\n });\n });\n });\n\n return transition$.asObservable();\n};\n\nconst completeTransition = (element: HTMLElement) => {\n TransitionsMap.get(element)?.complete();\n};\n\nexport { completeTransition, usePresence };\n","import {\n Directive,\n effect,\n inject,\n InjectionToken,\n Provider,\n Signal,\n TemplateRef,\n ViewContainerRef\n} from '@angular/core';\n\n/**\n * Context interface for RdxPresence directive\n * Contains a Signal that indicates whether the content should be present in the DOM\n */\nexport type RdxPresenceContext = {\n present: Signal<boolean>;\n};\n\nexport const RDX_PRESENCE_CONTEXT = new InjectionToken<RdxPresenceContext>('RdxPresenceContext');\n\n/**\n * Factory provider helper.\n * In your parent component/directive you can write:\n *\n * providers: [\n * provideRdxPresenceContext(() => ({ present: myBooleanSignal }))\n * ]\n */\nexport function provideRdxPresenceContext(contextFactory: () => RdxPresenceContext): Provider {\n return { provide: RDX_PRESENCE_CONTEXT, useFactory: contextFactory };\n}\n\n@Directive()\nexport class RdxPresenceDirective {\n private readonly context = inject(RDX_PRESENCE_CONTEXT);\n private readonly viewContainerRef = inject(ViewContainerRef);\n private readonly templateRef = inject(TemplateRef<RdxPresenceContext>);\n\n private effectRef = effect((onCleanup) => {\n if (this.context.present()) {\n const view = this.viewContainerRef.createEmbeddedView(this.templateRef, { $implicit: this.context });\n\n onCleanup(() => view.destroy());\n }\n });\n}\n","import { TransitionStartFn } from '../types';\nimport { triggerReflow } from '../utils';\n\nexport type CollapseContext = {\n direction: 'show' | 'hide';\n dimension: 'width' | 'height';\n maxSize?: string;\n};\n\n// Define constants for class names\nconst COLLAPSE_CLASS = 'collapse';\nconst COLLAPSING_CLASS = 'collapsing';\nconst SHOW_CLASS = 'show';\n/**\n * Function to handle the start of a collapsing transition.\n *\n * @param element - The HTML element to animate.\n * @param animation - Whether to use animation or not.\n * @param context - The context containing direction and dimension information.\n * @returns A function to clean up the animation.\n */\nexport const transitionCollapsing: TransitionStartFn<CollapseContext> = (\n element: HTMLElement,\n animation: boolean,\n context: CollapseContext\n) => {\n const { direction, dimension } = context;\n let { maxSize } = context;\n const { classList } = element;\n\n /**\n * Sets initial classes based on the direction.\n */\n function setInitialClasses() {\n classList.add(COLLAPSE_CLASS);\n if (direction === 'show') {\n classList.add(SHOW_CLASS);\n } else {\n classList.remove(SHOW_CLASS);\n }\n }\n\n if (!animation) {\n setInitialClasses();\n return;\n }\n\n if (!maxSize) {\n maxSize = measureCollapsingElementDimensionPx(element, dimension);\n context.maxSize = maxSize;\n\n // Fix the height before starting the animation\n element.style[dimension] = direction !== 'show' ? maxSize : '0px';\n\n classList.remove(COLLAPSE_CLASS, COLLAPSING_CLASS, 'show');\n\n triggerReflow(element);\n\n // Start the animation\n classList.add(COLLAPSING_CLASS);\n }\n\n element.style[dimension] = direction === 'show' ? maxSize : '0px';\n\n return () => {\n setInitialClasses();\n classList.remove(COLLAPSING_CLASS);\n element.style[dimension] = '';\n };\n};\n\n/**\n * Measures the dimension of the collapsing element in pixels.\n *\n * @param element - The HTML element to measure.\n * @param dimension - The dimension ('width' or 'height') to measure.\n * @returns The size of the dimension in pixels.\n */\nfunction measureCollapsingElementDimensionPx(element: HTMLElement, dimension: 'width' | 'height'): string {\n // SSR fix\n if (typeof navigator === 'undefined') {\n return '0px';\n }\n\n const { classList } = element;\n const hasShownClass = classList.contains(SHOW_CLASS);\n if (!hasShownClass) {\n classList.add(SHOW_CLASS);\n }\n\n element.style[dimension] = '';\n const dimensionSize = element.getBoundingClientRect()[dimension] + 'px';\n\n if (!hasShownClass) {\n classList.remove(SHOW_CLASS);\n }\n\n return dimensionSize;\n}\n","import { TransitionStartFn } from '../types';\nimport { triggerReflow } from '../utils';\n\nexport const toastFadeInTransition: TransitionStartFn = (element: HTMLElement, animation: boolean) => {\n const { classList } = element;\n\n if (animation) {\n classList.add('fade');\n } else {\n classList.add('show');\n return;\n }\n\n triggerReflow(element);\n classList.add('show', 'showing');\n\n return () => {\n classList.remove('showing');\n };\n};\n\nexport const toastFadeOutTransition: TransitionStartFn = ({ classList }: HTMLElement) => {\n classList.add('showing');\n return () => {\n classList.remove('show', 'showing');\n };\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGA;;;;;;;;;;;;;;;;;;;;AAoBG;AACH,SAAS,SAAS,CAAI,IAAY,EAAA;AAC9B,IAAA,OAAO,CAAC,MAAqB,KACzB,IAAI,UAAU,CAAC,CAAC,QAAQ,KACpB,MAAM,CAAC,SAAS,CAAC;AACb,QAAA,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrD,QAAA,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,MAAM,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACnD,QAAA,QAAQ,EAAE,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,QAAQ,CAAC,QAAQ,EAAE;AACrD,KAAA,CAAC,CACL;AACT;AAEA;;;;;;;;;;;;;;AAcG;AACH,SAAS,uBAAuB,CAAC,OAAoB,EAAA;AACjD,IAAA,MAAM,EAAE,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AAC/B,KAAC;AACL;MAEa,sBAAsB,GAAsB,CAAC,EAAE,SAAS,EAAe,KAAI;AACpF,IAAA,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC;AACxB,IAAA,OAAO,MAAK;AACR,QAAA,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC;AACvC,KAAC;AACL;;AC1BA;;AAEG;;;;"}
|
@@ -139,15 +139,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
139
139
|
}]
|
140
140
|
}] });
|
141
141
|
|
142
|
-
const _imports = [
|
143
|
-
RdxProgressRootDirective,
|
144
|
-
RdxProgressIndicatorDirective
|
145
|
-
];
|
142
|
+
const _imports = [RdxProgressRootDirective, RdxProgressIndicatorDirective];
|
146
143
|
class RdxProgressModule {
|
147
144
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxProgressModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
148
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.4", ngImport: i0, type: RdxProgressModule, imports: [RdxProgressRootDirective,
|
149
|
-
RdxProgressIndicatorDirective], exports: [RdxProgressRootDirective,
|
150
|
-
RdxProgressIndicatorDirective] }); }
|
145
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.4", ngImport: i0, type: RdxProgressModule, imports: [RdxProgressRootDirective, RdxProgressIndicatorDirective], exports: [RdxProgressRootDirective, RdxProgressIndicatorDirective] }); }
|
151
146
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxProgressModule }); }
|
152
147
|
}
|
153
148
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxProgressModule, decorators: [{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-progress.mjs","sources":["../../../packages/primitives/progress/src/progress-root.directive.ts","../../../packages/primitives/progress/src/progress-indicator.directive.ts","../../../packages/primitives/progress/index.ts","../../../packages/primitives/progress/radix-ng-primitives-progress.ts"],"sourcesContent":["import { computed, Directive, effect, inject, InjectionToken, input, model } from '@angular/core';\nimport { isNullish, isNumber, provideToken } from '@radix-ng/primitives/core';\n\nexport const RdxProgressToken = new InjectionToken<RdxProgressRootDirective>('RdxProgressDirective');\n\n/**\n * Injects the current instance of RdxProgressRootDirective.\n * @returns The instance of RdxProgressRootDirective.\n */\nexport function injectProgress(): RdxProgressRootDirective {\n return inject(RdxProgressToken);\n}\n\nexport type ProgressState = 'indeterminate' | 'complete' | 'loading';\n\nexport interface ProgressProps {\n value?: number | null;\n max?: number;\n /**\n * A function to get the accessible label text representing the current value in a human-readable format.\n *\n * If not provided, the value label will be read as the numeric value as a percentage of the max value.\n */\n getValueLabel?: (value: number, max: number) => string;\n}\n\nconst MIN_PERCENT = 0;\nconst DEFAULT_MAX = 100;\n\n/**\n * Directive to manage progress bar state and attributes.\n *\n * This directive provides a way to create a progress bar with customizable value and max attributes.\n * It handles aria attributes for accessibility and provides different states like 'indeterminate', 'complete', and 'loading'.\n *\n * @group Components\n */\n@Directive({\n selector: '[rdxProgressRoot]',\n exportAs: 'rdxProgressRoot',\n providers: [provideToken(RdxProgressToken, RdxProgressRootDirective)],\n host: {\n role: 'progressbar',\n '[attr.aria-valuemax]': 'max()',\n '[attr.aria-valuemin]': '0',\n '[attr.aria-valuenow]': 'value()',\n '[attr.aria-valuetext]': 'label()',\n '[attr.aria-label]': 'label()',\n '[attr.data-state]': 'progressState()',\n '[attr.data-value]': 'value() ?? undefined',\n '[attr.data-max]': 'max()',\n // set tab index to -1 so screen readers will read the aria-label\n // Note: there is a known issue with JAWS that does not read progressbar aria labels on FireFox\n tabindex: '-1'\n }\n})\nexport class RdxProgressRootDirective {\n /**\n * The current value of the progress bar.\n * @group Props\n * @defaultValue 0\n */\n readonly value = model<number>(MIN_PERCENT);\n\n /**\n * The maximum value of the progress bar.\n * @defaultValue 100\n * @group Props\n */\n readonly max = model<number>(DEFAULT_MAX);\n\n /**\n * Function to generate the value label.\n * @group Props\n */\n readonly valueLabel = input<(value: number, max: number) => string>((value, max) =>\n this.defaultGetValueLabel(value, max)\n );\n\n protected readonly label = computed(() => this.valueLabel()(this.value(), this.max()));\n\n readonly progressState = computed<ProgressState>(() => {\n if (isNullish(this.value())) {\n return 'indeterminate';\n }\n if (this.value() === this.max()) {\n return 'complete';\n }\n return 'loading';\n });\n\n constructor() {\n effect(() => {\n const correctedValue = this.validateValue(this.value(), this.max());\n if (correctedValue != null && correctedValue !== this.value()) {\n this.value.set(correctedValue);\n }\n });\n\n effect(() => {\n const correctedMax = this.validateMax(this.max());\n if (correctedMax !== this.max()) {\n this.max.set(correctedMax);\n }\n });\n }\n\n private validateValue(value: any, max: number): number | null {\n const isValidValueError =\n isNullish(value) || (isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0);\n\n if (isValidValueError) return value as null;\n\n console.error(`Invalid prop \\`value\\` of value \\`${value}\\` supplied to \\`ProgressRoot\\`. The \\`value\\` prop must be:\n - a positive number\n - less than the value passed to \\`max\\` (or ${DEFAULT_MAX} if no \\`max\\` prop is set)\n - \\`null\\` or \\`undefined\\` if the progress is indeterminate.\n\nDefaulting to \\`null\\`.`);\n return null;\n }\n\n private validateMax(max: number): number {\n const isValidMaxError = isNumber(max) && !Number.isNaN(max) && max > 0;\n\n if (isValidMaxError) return max;\n\n console.error(\n `Invalid prop \\`max\\` of value \\`${max}\\` supplied to \\`ProgressRoot\\`. Only numbers greater than 0 are valid max values. Defaulting to \\`${DEFAULT_MAX}\\`.`\n );\n return DEFAULT_MAX;\n }\n\n private defaultGetValueLabel(value: number, max: number) {\n return `${Math.round((value / max) * 100)}%`;\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectProgress } from './progress-root.directive';\n\n/**\n * Directive to manage progress indicator state and attributes.\n *\n * This directive is used to display the progress indicator inside the progress bar.\n * It inherits the state and value from the `RdxProgressRootDirective`.\n */\n@Directive({\n selector: '[rdxProgressIndicator]',\n exportAs: 'rdxProgressIndicator',\n host: {\n '[attr.data-state]': 'progress.progressState()',\n '[attr.data-value]': 'progress.value()',\n '[attr.data-max]': 'progress.max()'\n }\n})\nexport class RdxProgressIndicatorDirective {\n /**\n * This allows the directive to access the progress bar state and values.\n */\n protected readonly progress = injectProgress();\n}\n","import { NgModule } from '@angular/core';\nimport { RdxProgressIndicatorDirective } from './src/progress-indicator.directive';\nimport { RdxProgressRootDirective } from './src/progress-root.directive';\n\nexport * from './src/progress-indicator.directive';\nexport * from './src/progress-root.directive';\n\nexport type { ProgressProps } from './src/progress-root.directive';\n\nconst _imports = [\n RdxProgressRootDirective,\n RdxProgressIndicatorDirective\n];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxProgressModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAGa,gBAAgB,GAAG,IAAI,cAAc,CAA2B,sBAAsB;AAEnG;;;AAGG;SACa,cAAc,GAAA;AAC1B,IAAA,OAAO,MAAM,CAAC,gBAAgB,CAAC;AACnC;AAeA,MAAM,WAAW,GAAG,CAAC;AACrB,MAAM,WAAW,GAAG,GAAG;AAEvB;;;;;;;AAOG;MAoBU,wBAAwB,CAAA;AAmCjC,IAAA,WAAA,GAAA;AAlCA;;;;AAIG;AACM,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAS,WAAW,CAAC;AAE3C;;;;AAIG;AACM,QAAA,IAAA,CAAA,GAAG,GAAG,KAAK,CAAS,WAAW,CAAC;AAEzC;;;AAGG;AACM,QAAA,IAAA,CAAA,UAAU,GAAG,KAAK,CAAyC,CAAC,KAAK,EAAE,GAAG,KAC3E,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,GAAG,CAAC,CACxC;QAE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CAAA;+GAOpB,iBAAiB,EAAA,CAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;ACjBD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"radix-ng-primitives-progress.mjs","sources":["../../../packages/primitives/progress/src/progress-root.directive.ts","../../../packages/primitives/progress/src/progress-indicator.directive.ts","../../../packages/primitives/progress/index.ts","../../../packages/primitives/progress/radix-ng-primitives-progress.ts"],"sourcesContent":["import { computed, Directive, effect, inject, InjectionToken, input, model } from '@angular/core';\nimport { isNullish, isNumber, provideToken } from '@radix-ng/primitives/core';\n\nexport const RdxProgressToken = new InjectionToken<RdxProgressRootDirective>('RdxProgressDirective');\n\n/**\n * Injects the current instance of RdxProgressRootDirective.\n * @returns The instance of RdxProgressRootDirective.\n */\nexport function injectProgress(): RdxProgressRootDirective {\n return inject(RdxProgressToken);\n}\n\nexport type ProgressState = 'indeterminate' | 'complete' | 'loading';\n\nexport interface ProgressProps {\n value?: number | null;\n max?: number;\n /**\n * A function to get the accessible label text representing the current value in a human-readable format.\n *\n * If not provided, the value label will be read as the numeric value as a percentage of the max value.\n */\n getValueLabel?: (value: number, max: number) => string;\n}\n\nconst MIN_PERCENT = 0;\nconst DEFAULT_MAX = 100;\n\n/**\n * Directive to manage progress bar state and attributes.\n *\n * This directive provides a way to create a progress bar with customizable value and max attributes.\n * It handles aria attributes for accessibility and provides different states like 'indeterminate', 'complete', and 'loading'.\n *\n * @group Components\n */\n@Directive({\n selector: '[rdxProgressRoot]',\n exportAs: 'rdxProgressRoot',\n providers: [provideToken(RdxProgressToken, RdxProgressRootDirective)],\n host: {\n role: 'progressbar',\n '[attr.aria-valuemax]': 'max()',\n '[attr.aria-valuemin]': '0',\n '[attr.aria-valuenow]': 'value()',\n '[attr.aria-valuetext]': 'label()',\n '[attr.aria-label]': 'label()',\n '[attr.data-state]': 'progressState()',\n '[attr.data-value]': 'value() ?? undefined',\n '[attr.data-max]': 'max()',\n // set tab index to -1 so screen readers will read the aria-label\n // Note: there is a known issue with JAWS that does not read progressbar aria labels on FireFox\n tabindex: '-1'\n }\n})\nexport class RdxProgressRootDirective {\n /**\n * The current value of the progress bar.\n * @group Props\n * @defaultValue 0\n */\n readonly value = model<number>(MIN_PERCENT);\n\n /**\n * The maximum value of the progress bar.\n * @defaultValue 100\n * @group Props\n */\n readonly max = model<number>(DEFAULT_MAX);\n\n /**\n * Function to generate the value label.\n * @group Props\n */\n readonly valueLabel = input<(value: number, max: number) => string>((value, max) =>\n this.defaultGetValueLabel(value, max)\n );\n\n protected readonly label = computed(() => this.valueLabel()(this.value(), this.max()));\n\n readonly progressState = computed<ProgressState>(() => {\n if (isNullish(this.value())) {\n return 'indeterminate';\n }\n if (this.value() === this.max()) {\n return 'complete';\n }\n return 'loading';\n });\n\n constructor() {\n effect(() => {\n const correctedValue = this.validateValue(this.value(), this.max());\n if (correctedValue != null && correctedValue !== this.value()) {\n this.value.set(correctedValue);\n }\n });\n\n effect(() => {\n const correctedMax = this.validateMax(this.max());\n if (correctedMax !== this.max()) {\n this.max.set(correctedMax);\n }\n });\n }\n\n private validateValue(value: any, max: number): number | null {\n const isValidValueError =\n isNullish(value) || (isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0);\n\n if (isValidValueError) return value as null;\n\n console.error(`Invalid prop \\`value\\` of value \\`${value}\\` supplied to \\`ProgressRoot\\`. The \\`value\\` prop must be:\n - a positive number\n - less than the value passed to \\`max\\` (or ${DEFAULT_MAX} if no \\`max\\` prop is set)\n - \\`null\\` or \\`undefined\\` if the progress is indeterminate.\n\nDefaulting to \\`null\\`.`);\n return null;\n }\n\n private validateMax(max: number): number {\n const isValidMaxError = isNumber(max) && !Number.isNaN(max) && max > 0;\n\n if (isValidMaxError) return max;\n\n console.error(\n `Invalid prop \\`max\\` of value \\`${max}\\` supplied to \\`ProgressRoot\\`. Only numbers greater than 0 are valid max values. Defaulting to \\`${DEFAULT_MAX}\\`.`\n );\n return DEFAULT_MAX;\n }\n\n private defaultGetValueLabel(value: number, max: number) {\n return `${Math.round((value / max) * 100)}%`;\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectProgress } from './progress-root.directive';\n\n/**\n * Directive to manage progress indicator state and attributes.\n *\n * This directive is used to display the progress indicator inside the progress bar.\n * It inherits the state and value from the `RdxProgressRootDirective`.\n */\n@Directive({\n selector: '[rdxProgressIndicator]',\n exportAs: 'rdxProgressIndicator',\n host: {\n '[attr.data-state]': 'progress.progressState()',\n '[attr.data-value]': 'progress.value()',\n '[attr.data-max]': 'progress.max()'\n }\n})\nexport class RdxProgressIndicatorDirective {\n /**\n * This allows the directive to access the progress bar state and values.\n */\n protected readonly progress = injectProgress();\n}\n","import { NgModule } from '@angular/core';\nimport { RdxProgressIndicatorDirective } from './src/progress-indicator.directive';\nimport { RdxProgressRootDirective } from './src/progress-root.directive';\n\nexport * from './src/progress-indicator.directive';\nexport * from './src/progress-root.directive';\n\nexport type { ProgressProps } from './src/progress-root.directive';\n\nconst _imports = [RdxProgressRootDirective, RdxProgressIndicatorDirective];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxProgressModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAGa,gBAAgB,GAAG,IAAI,cAAc,CAA2B,sBAAsB;AAEnG;;;AAGG;SACa,cAAc,GAAA;AAC1B,IAAA,OAAO,MAAM,CAAC,gBAAgB,CAAC;AACnC;AAeA,MAAM,WAAW,GAAG,CAAC;AACrB,MAAM,WAAW,GAAG,GAAG;AAEvB;;;;;;;AAOG;MAoBU,wBAAwB,CAAA;AAmCjC,IAAA,WAAA,GAAA;AAlCA;;;;AAIG;AACM,QAAA,IAAA,CAAA,KAAK,GAA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EAAA,CAAA,CAAA;AAAjB,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,iBAAiB,YANZ,wBAAwB,EAAE,6BAA6B,CAAvD,EAAA,OAAA,EAAA,CAAA,wBAAwB,EAAE,6BAA6B,CAAA,EAAA,CAAA,CAAA;+GAM5D,iBAAiB,EAAA,CAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;ACdD;;AAEG;;;;"}
|
@@ -222,9 +222,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
222
222
|
args: [{
|
223
223
|
selector: '[rdxRadioItemInput]',
|
224
224
|
exportAs: 'rdxRadioItemInput',
|
225
|
-
hostDirectives: [
|
226
|
-
{ directive: RdxVisuallyHiddenDirective, inputs: ['feature'] }
|
227
|
-
],
|
225
|
+
hostDirectives: [{ directive: RdxVisuallyHiddenDirective, inputs: ['feature'] }],
|
228
226
|
host: {
|
229
227
|
type: 'radio',
|
230
228
|
'[attr.name]': 'name()',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-radio.mjs","sources":["../../../packages/primitives/radio/src/radio-tokens.ts","../../../packages/primitives/radio/src/radio-root.directive.ts","../../../packages/primitives/radio/src/radio-item.directive.ts","../../../packages/primitives/radio/src/radio-indicator.directive.ts","../../../packages/primitives/radio/src/radio-item-input.directive.ts","../../../packages/primitives/radio/radix-ng-primitives-radio.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport { InjectionToken, InputSignalWithTransform, ModelSignal, Signal } from '@angular/core';\n\nexport interface RadioGroupProps {\n name?: string;\n disabled?: InputSignalWithTransform<boolean, BooleanInput>;\n defaultValue?: string;\n value: ModelSignal<string | null>;\n disableState: Signal<boolean>;\n}\n\nexport interface RadioGroupDirective extends RadioGroupProps {\n select(value: string | null): void;\n\n onTouched(): void;\n}\n\nexport const RDX_RADIO_GROUP = new InjectionToken<RadioGroupDirective>('RdxRadioGroup');\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, input, Input, model, output, signal } from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { provideValueAccessor } from '@radix-ng/primitives/core';\nimport { Orientation, RdxRovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';\nimport { RadioGroupDirective, RadioGroupProps, RDX_RADIO_GROUP } from './radio-tokens';\n\n@Directive({\n selector: '[rdxRadioRoot]',\n exportAs: 'rdxRadioRoot',\n providers: [\n provideValueAccessor(RdxRadioGroupDirective),\n { provide: RDX_RADIO_GROUP, useExisting: RdxRadioGroupDirective }],\n hostDirectives: [{ directive: RdxRovingFocusGroupDirective, inputs: ['dir', 'orientation', 'loop'] }],\n host: {\n role: 'radiogroup',\n '[attr.aria-orientation]': 'orientation()',\n '[attr.aria-required]': 'required()',\n '[attr.data-disabled]': 'disableState() ? \"\" : null',\n '(keydown)': 'onKeydown()'\n }\n})\nexport class RdxRadioGroupDirective implements RadioGroupProps, RadioGroupDirective, ControlValueAccessor {\n readonly value = model<string | null>(null);\n\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n @Input() defaultValue?: string;\n\n readonly required = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly orientation = input<Orientation>();\n\n /**\n * Event handler called when the value changes.\n */\n readonly onValueChange = output<string>();\n\n private readonly disable = signal<boolean>(this.disabled());\n readonly disableState = computed(() => this.disable() || this.disabled());\n\n /**\n * The callback function to call when the value of the radio group changes.\n */\n private onChange: (value: string) => void = () => {\n /* Empty */\n };\n\n /**\n * The callback function to call when the radio group is touched.\n * @ignore\n */\n onTouched: () => void = () => {\n /* Empty */\n };\n\n /**\n * Select a radio item.\n * @param value The value of the radio item to select.\n * @ignore\n */\n select(value: string): void {\n this.value.set(value);\n this.onValueChange.emit(value);\n this.onChange?.(value);\n this.onTouched();\n }\n\n /**\n * Update the value of the radio group.\n * @param value The new value of the radio group.\n * @ignore\n */\n writeValue(value: string): void {\n this.value.set(value);\n }\n\n /**\n * Register a callback function to call when the value of the radio group changes.\n * @param fn The callback function to call when the value of the radio group changes.\n * @ignore\n */\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n /** @ignore */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Set the disabled state of the radio group.\n * @param isDisabled Whether the radio group is disabled.\n * @ignore\n */\n setDisabledState(isDisabled: boolean): void {\n this.disable.set(isDisabled);\n }\n\n protected onKeydown(): void {\n if (this.disableState()) return;\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n InjectionToken,\n input,\n OnInit,\n signal\n} from '@angular/core';\nimport { provideToken } from '@radix-ng/primitives/core';\nimport { RdxRovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';\nimport { RDX_RADIO_GROUP } from './radio-tokens';\n\nexport const RdxRadioItemToken = new InjectionToken<RdxRadioItemDirective>('RadioItemToken');\n\nexport function injectRadioItem(): RdxRadioItemDirective {\n return inject(RdxRadioItemToken);\n}\n\n@Directive({\n selector: '[rdxRadioItem]',\n exportAs: 'rdxRadioItem',\n providers: [provideToken(RdxRadioItemToken, RdxRadioItemDirective)],\n hostDirectives: [\n { directive: RdxRovingFocusItemDirective, inputs: ['tabStopId: id', 'focusable', 'active', 'allowShiftKey'] }],\n\n host: {\n type: 'button',\n role: 'radio',\n '[attr.aria-checked]': 'checkedState()',\n '[attr.data-disabled]': 'disabledState() ? \"\" : null',\n '[attr.data-state]': 'checkedState() ? \"checked\" : \"unchecked\"',\n '[disabled]': 'disabledState()',\n '(click)': 'onClick()',\n '(keydown)': 'onKeyDown($event)',\n '(keyup)': 'onKeyUp()',\n '(focus)': 'onFocus()'\n }\n})\nexport class RdxRadioItemDirective implements OnInit {\n private readonly radioGroup = inject(RDX_RADIO_GROUP);\n private readonly elementRef = inject(ElementRef);\n\n readonly value = input.required<string>();\n\n readonly id = input<string>();\n\n readonly required = input<boolean>();\n\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n protected readonly disabledState = computed(() => this.radioGroup.disableState() || this.disabled());\n\n readonly checkedState = computed(() => this.radioGroup.value() === this.value());\n\n private readonly ARROW_KEYS = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];\n private readonly isArrowKeyPressedSignal = signal(false);\n\n /** @ignore */\n ngOnInit() {\n if (this.radioGroup.defaultValue === this.value()) {\n this.radioGroup.select(this.value());\n }\n }\n\n /** @ignore */\n onClick() {\n if (!this.disabledState()) {\n this.radioGroup.select(this.value());\n this.isArrowKeyPressedSignal.set(true);\n }\n }\n\n /** @ignore */\n onKeyDown(event: KeyboardEvent): void {\n if (this.ARROW_KEYS.includes(event.key)) {\n this.isArrowKeyPressedSignal.set(true);\n }\n }\n\n /** @ignore */\n onKeyUp() {\n this.isArrowKeyPressedSignal.set(false);\n }\n\n /** @ignore */\n onFocus() {\n this.radioGroup.select(this.value());\n setTimeout(() => {\n /**\n * When navigating with arrow keys, focus triggers on the radio item.\n * To \"check\" the radio, we programmatically trigger a click event.\n */\n if (this.isArrowKeyPressedSignal()) {\n this.elementRef.nativeElement.click();\n }\n }, 0);\n }\n}\n","import { Directive, inject } from '@angular/core';\nimport { RdxRadioItemDirective } from './radio-item.directive';\nimport { RDX_RADIO_GROUP, RadioGroupDirective } from './radio-tokens';\n\n@Directive({\n selector: '[rdxRadioIndicator]',\n exportAs: 'rdxRadioIndicator',\n host: {\n '[attr.data-state]': 'radioItem.checkedState() ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'radioItem.disabled() ? \"\" : undefined'\n }\n})\nexport class RdxRadioIndicatorDirective {\n protected readonly radioGroup: RadioGroupDirective = inject(RDX_RADIO_GROUP);\n protected readonly radioItem: RdxRadioItemDirective = inject(RdxRadioItemDirective);\n}\n","import { computed, Directive, input } from '@angular/core';\nimport { RdxVisuallyHiddenDirective } from '@radix-ng/primitives/visually-hidden';\nimport { injectRadioItem } from './radio-item.directive';\n\n@Directive({\n selector: '[rdxRadioItemInput]',\n exportAs: 'rdxRadioItemInput',\n hostDirectives: [\n { directive: RdxVisuallyHiddenDirective, inputs: ['feature'] }],\n host: {\n type: 'radio',\n '[attr.name]': 'name()',\n '[attr.required]': 'required()',\n '[attr.disabled]': 'disabled() ? disabled() : undefined',\n '[attr.checked]': 'checked()',\n '[value]': 'value()'\n }\n})\nexport class RdxRadioItemInputDirective {\n private readonly radioItem = injectRadioItem();\n\n readonly name = input<string>();\n readonly value = computed(() => this.radioItem.value() || undefined);\n readonly checked = computed(() => this.radioItem.checkedState() || undefined);\n readonly required = input<boolean | undefined>(this.radioItem.required());\n readonly disabled = input<boolean | undefined>(this.radioItem.disabled());\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;AAiBO,MAAM,eAAe,GAAG,IAAI,cAAc,CAAsB,eAAe,CAAC;;MCK1E,sBAAsB,CAAA;AAfnC,IAAA,WAAA,GAAA;AAgBa,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAgB,IAAI,CAAC;QAElC,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAwB,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;QAI/E,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAwB,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;QAE/E,IAAW,CAAA,WAAA,GAAG,KAAK,EAAe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AA,IAAA,CAAA,0BAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAA1B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAdtC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,qBAAqB;AAC/B,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,cAAc,EAAE;wBACZ,EAAE,SAAS,EAAE,0BAA0B,EAAE,MAAM,EAAE,CAAC,SAAS,CAAC;AAAG,qBAAA;AACnE,oBAAA,IAAI,EAAE;AACF,wBAAA,IAAI,EAAE,OAAO;AACb,wBAAA,aAAa,EAAE,QAAQ;AACvB,wBAAA,iBAAiB,EAAE,YAAY;AAC/B,wBAAA,iBAAiB,EAAE,qCAAqC;AACxD,wBAAA,gBAAgB,EAAE,WAAW;AAC7B,wBAAA,SAAS,EAAE;AACd;AACJ,iBAAA;;;ACjBD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"radix-ng-primitives-radio.mjs","sources":["../../../packages/primitives/radio/src/radio-tokens.ts","../../../packages/primitives/radio/src/radio-root.directive.ts","../../../packages/primitives/radio/src/radio-item.directive.ts","../../../packages/primitives/radio/src/radio-indicator.directive.ts","../../../packages/primitives/radio/src/radio-item-input.directive.ts","../../../packages/primitives/radio/radix-ng-primitives-radio.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport { InjectionToken, InputSignalWithTransform, ModelSignal, Signal } from '@angular/core';\n\nexport interface RadioGroupProps {\n name?: string;\n disabled?: InputSignalWithTransform<boolean, BooleanInput>;\n defaultValue?: string;\n value: ModelSignal<string | null>;\n disableState: Signal<boolean>;\n}\n\nexport interface RadioGroupDirective extends RadioGroupProps {\n select(value: string | null): void;\n\n onTouched(): void;\n}\n\nexport const RDX_RADIO_GROUP = new InjectionToken<RadioGroupDirective>('RdxRadioGroup');\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, input, Input, model, output, signal } from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { provideValueAccessor } from '@radix-ng/primitives/core';\nimport { Orientation, RdxRovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';\nimport { RadioGroupDirective, RadioGroupProps, RDX_RADIO_GROUP } from './radio-tokens';\n\n@Directive({\n selector: '[rdxRadioRoot]',\n exportAs: 'rdxRadioRoot',\n providers: [\n provideValueAccessor(RdxRadioGroupDirective),\n { provide: RDX_RADIO_GROUP, useExisting: RdxRadioGroupDirective }\n ],\n hostDirectives: [{ directive: RdxRovingFocusGroupDirective, inputs: ['dir', 'orientation', 'loop'] }],\n host: {\n role: 'radiogroup',\n '[attr.aria-orientation]': 'orientation()',\n '[attr.aria-required]': 'required()',\n '[attr.data-disabled]': 'disableState() ? \"\" : null',\n '(keydown)': 'onKeydown()'\n }\n})\nexport class RdxRadioGroupDirective implements RadioGroupProps, RadioGroupDirective, ControlValueAccessor {\n readonly value = model<string | null>(null);\n\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n @Input() defaultValue?: string;\n\n readonly required = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly orientation = input<Orientation>();\n\n /**\n * Event handler called when the value changes.\n */\n readonly onValueChange = output<string>();\n\n private readonly disable = signal<boolean>(this.disabled());\n readonly disableState = computed(() => this.disable() || this.disabled());\n\n /**\n * The callback function to call when the value of the radio group changes.\n */\n private onChange: (value: string) => void = () => {\n /* Empty */\n };\n\n /**\n * The callback function to call when the radio group is touched.\n * @ignore\n */\n onTouched: () => void = () => {\n /* Empty */\n };\n\n /**\n * Select a radio item.\n * @param value The value of the radio item to select.\n * @ignore\n */\n select(value: string): void {\n this.value.set(value);\n this.onValueChange.emit(value);\n this.onChange?.(value);\n this.onTouched();\n }\n\n /**\n * Update the value of the radio group.\n * @param value The new value of the radio group.\n * @ignore\n */\n writeValue(value: string): void {\n this.value.set(value);\n }\n\n /**\n * Register a callback function to call when the value of the radio group changes.\n * @param fn The callback function to call when the value of the radio group changes.\n * @ignore\n */\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n /** @ignore */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Set the disabled state of the radio group.\n * @param isDisabled Whether the radio group is disabled.\n * @ignore\n */\n setDisabledState(isDisabled: boolean): void {\n this.disable.set(isDisabled);\n }\n\n protected onKeydown(): void {\n if (this.disableState()) return;\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n InjectionToken,\n input,\n OnInit,\n signal\n} from '@angular/core';\nimport { provideToken } from '@radix-ng/primitives/core';\nimport { RdxRovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';\nimport { RDX_RADIO_GROUP } from './radio-tokens';\n\nexport const RdxRadioItemToken = new InjectionToken<RdxRadioItemDirective>('RadioItemToken');\n\nexport function injectRadioItem(): RdxRadioItemDirective {\n return inject(RdxRadioItemToken);\n}\n\n@Directive({\n selector: '[rdxRadioItem]',\n exportAs: 'rdxRadioItem',\n providers: [provideToken(RdxRadioItemToken, RdxRadioItemDirective)],\n hostDirectives: [\n { directive: RdxRovingFocusItemDirective, inputs: ['tabStopId: id', 'focusable', 'active', 'allowShiftKey'] }\n ],\n\n host: {\n type: 'button',\n role: 'radio',\n '[attr.aria-checked]': 'checkedState()',\n '[attr.data-disabled]': 'disabledState() ? \"\" : null',\n '[attr.data-state]': 'checkedState() ? \"checked\" : \"unchecked\"',\n '[disabled]': 'disabledState()',\n '(click)': 'onClick()',\n '(keydown)': 'onKeyDown($event)',\n '(keyup)': 'onKeyUp()',\n '(focus)': 'onFocus()'\n }\n})\nexport class RdxRadioItemDirective implements OnInit {\n private readonly radioGroup = inject(RDX_RADIO_GROUP);\n private readonly elementRef = inject(ElementRef);\n\n readonly value = input.required<string>();\n\n readonly id = input<string>();\n\n readonly required = input<boolean>();\n\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n protected readonly disabledState = computed(() => this.radioGroup.disableState() || this.disabled());\n\n readonly checkedState = computed(() => this.radioGroup.value() === this.value());\n\n private readonly ARROW_KEYS = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];\n private readonly isArrowKeyPressedSignal = signal(false);\n\n /** @ignore */\n ngOnInit() {\n if (this.radioGroup.defaultValue === this.value()) {\n this.radioGroup.select(this.value());\n }\n }\n\n /** @ignore */\n onClick() {\n if (!this.disabledState()) {\n this.radioGroup.select(this.value());\n this.isArrowKeyPressedSignal.set(true);\n }\n }\n\n /** @ignore */\n onKeyDown(event: KeyboardEvent): void {\n if (this.ARROW_KEYS.includes(event.key)) {\n this.isArrowKeyPressedSignal.set(true);\n }\n }\n\n /** @ignore */\n onKeyUp() {\n this.isArrowKeyPressedSignal.set(false);\n }\n\n /** @ignore */\n onFocus() {\n this.radioGroup.select(this.value());\n setTimeout(() => {\n /**\n * When navigating with arrow keys, focus triggers on the radio item.\n * To \"check\" the radio, we programmatically trigger a click event.\n */\n if (this.isArrowKeyPressedSignal()) {\n this.elementRef.nativeElement.click();\n }\n }, 0);\n }\n}\n","import { Directive, inject } from '@angular/core';\nimport { RdxRadioItemDirective } from './radio-item.directive';\nimport { RDX_RADIO_GROUP, RadioGroupDirective } from './radio-tokens';\n\n@Directive({\n selector: '[rdxRadioIndicator]',\n exportAs: 'rdxRadioIndicator',\n host: {\n '[attr.data-state]': 'radioItem.checkedState() ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'radioItem.disabled() ? \"\" : undefined'\n }\n})\nexport class RdxRadioIndicatorDirective {\n protected readonly radioGroup: RadioGroupDirective = inject(RDX_RADIO_GROUP);\n protected readonly radioItem: RdxRadioItemDirective = inject(RdxRadioItemDirective);\n}\n","import { computed, Directive, input } from '@angular/core';\nimport { RdxVisuallyHiddenDirective } from '@radix-ng/primitives/visually-hidden';\nimport { injectRadioItem } from './radio-item.directive';\n\n@Directive({\n selector: '[rdxRadioItemInput]',\n exportAs: 'rdxRadioItemInput',\n hostDirectives: [{ directive: RdxVisuallyHiddenDirective, inputs: ['feature'] }],\n host: {\n type: 'radio',\n '[attr.name]': 'name()',\n '[attr.required]': 'required()',\n '[attr.disabled]': 'disabled() ? disabled() : undefined',\n '[attr.checked]': 'checked()',\n '[value]': 'value()'\n }\n})\nexport class RdxRadioItemInputDirective {\n private readonly radioItem = injectRadioItem();\n\n readonly name = input<string>();\n readonly value = computed(() => this.radioItem.value() || undefined);\n readonly checked = computed(() => this.radioItem.checkedState() || undefined);\n readonly required = input<boolean | undefined>(this.radioItem.required());\n readonly disabled = input<boolean | undefined>(this.radioItem.disabled());\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;AAiBO,MAAM,eAAe,GAAG,IAAI,cAAc,CAAsB,eAAe,CAAC;;MCM1E,sBAAsB,CAAA;AAhBnC,IAAA,WAAA,GAAA;AAiBa,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAgB,IAAI,CAAC;QAElC,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAwB,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;QAI/E,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAwB,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;QAE/E,IAAW,CAAA,WAAA,GAAG,KAAK,EAAe;AAE3C;;AAEG;QACM,IAAa,CAAA,aAAA,GAAG,MAAM,EAAU;QAExB,IAAO,CAAA,OAAA,GAAG,MAAM,CAAU,IAAI,CAAC,QAAQ,EAAE,CAAC;AAClD,QAAA,IAAA,CAAA,YAAY,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;AAEzE;;AAEG;QACK,IAAQ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AE,mBAAmB;AAC7B,oBAAA,cAAc,EAAE,CAAC,EAAE,SAAS,EAAE,0BAA0B,EAAE,MAAM,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;AAChF,oBAAA,IAAI,EAAE;AACF,wBAAA,IAAI,EAAE,OAAO;AACb,wBAAA,aAAa,EAAE,QAAQ;AACvB,wBAAA,iBAAiB,EAAE,YAAY;AAC/B,wBAAA,iBAAiB,EAAE,qCAAqC;AACxD,wBAAA,gBAAgB,EAAE,WAAW;AAC7B,wBAAA,SAAS,EAAE;AACd;AACJ,iBAAA;;;AChBD;;AAEG;;;;"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { inject, Input, Component, ElementRef,
|
2
|
+
import { inject, Input, Component, NgZone, ElementRef, contentChild, Directive, ChangeDetectorRef, DestroyRef, forwardRef, contentChildren, viewChild, signal, computed, EventEmitter, booleanAttribute, Output, ContentChildren, NgModule } from '@angular/core';
|
3
3
|
import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
|
4
4
|
import { Directionality } from '@angular/cdk/bidi';
|
5
5
|
import { Subscription, defer, merge, take, switchMap, delay, Subject, startWith, pairwise } from 'rxjs';
|
@@ -7,7 +7,7 @@ import { ENTER, SPACE } from '@angular/cdk/keycodes';
|
|
7
7
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
8
8
|
import { SelectionModel } from '@angular/cdk/collections';
|
9
9
|
import * as i1 from '@angular/cdk/overlay';
|
10
|
-
import { Overlay,
|
10
|
+
import { Overlay, CdkConnectedOverlay, OverlayModule } from '@angular/cdk/overlay';
|
11
11
|
|
12
12
|
class RdxSelectValueDirective {
|
13
13
|
constructor() {
|
@@ -29,14 +29,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
29
29
|
|
30
30
|
class RdxSelectTriggerDirective {
|
31
31
|
constructor() {
|
32
|
+
this.ngZone = inject(NgZone);
|
32
33
|
this.nativeElement = inject(ElementRef).nativeElement;
|
33
34
|
this.select = inject(RdxSelectComponent);
|
35
|
+
this.value = contentChild.required(RdxSelectValueDirective);
|
36
|
+
}
|
37
|
+
ngAfterViewInit() {
|
38
|
+
this.select.triggerSize.set([this.nativeElement.offsetWidth, this.nativeElement.offsetHeight]);
|
39
|
+
this.observeTriggerResize();
|
40
|
+
}
|
41
|
+
ngOnDestroy() {
|
42
|
+
this.resizeObserver?.disconnect();
|
43
|
+
this.resizeObserver = null;
|
34
44
|
}
|
35
45
|
focus() {
|
36
46
|
this.nativeElement.focus();
|
37
47
|
}
|
48
|
+
observeTriggerResize() {
|
49
|
+
if (typeof ResizeObserver === 'undefined' || !ResizeObserver) {
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
this.ngZone.runOutsideAngular(() => {
|
53
|
+
this.resizeObserver = new ResizeObserver(() => {
|
54
|
+
this.select.triggerSize.set([this.nativeElement.offsetWidth, this.nativeElement.offsetHeight]);
|
55
|
+
});
|
56
|
+
this.resizeObserver.observe(this.nativeElement);
|
57
|
+
});
|
58
|
+
}
|
38
59
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxSelectTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
39
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
60
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.4", type: RdxSelectTriggerDirective, isStandalone: true, selector: "[rdxSelectTrigger]", host: { properties: { "attr.type": "\"button\"", "attr.role": "\"combobox\"", "attr.aria-autocomplete": "\"none\"", "attr.dir": "select.dir.value", "attr.aria-expanded": "select.open", "attr.aria-required": "select.required", "attr.disabled": "select.disabled ? \"\" : null", "attr.data-disabled": "select.disabled ? \"\" : null", "attr.data-state": "select.open ? 'open': 'closed'", "attr.data-placeholder": "value().placeholder || null" } }, queries: [{ propertyName: "value", first: true, predicate: RdxSelectValueDirective, descendants: true, isSignal: true }], ngImport: i0 }); }
|
40
61
|
}
|
41
62
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxSelectTriggerDirective, decorators: [{
|
42
63
|
type: Directive,
|
@@ -53,13 +74,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
53
74
|
'[attr.disabled]': 'select.disabled ? "" : null',
|
54
75
|
'[attr.data-disabled]': 'select.disabled ? "" : null',
|
55
76
|
'[attr.data-state]': "select.open ? 'open': 'closed'",
|
56
|
-
'[attr.data-placeholder]': 'value.placeholder || null'
|
77
|
+
'[attr.data-placeholder]': 'value().placeholder || null'
|
57
78
|
}
|
58
79
|
}]
|
59
|
-
}]
|
60
|
-
type: ContentChild,
|
61
|
-
args: [RdxSelectValueDirective]
|
62
|
-
}] } });
|
80
|
+
}] });
|
63
81
|
|
64
82
|
let nextId$1 = 0;
|
65
83
|
class RdxSelectComponent {
|
@@ -69,6 +87,21 @@ class RdxSelectComponent {
|
|
69
87
|
this.changeDetectorRef = inject(ChangeDetectorRef);
|
70
88
|
this.destroyRef = inject(DestroyRef);
|
71
89
|
this.ngZone = inject(NgZone);
|
90
|
+
this.trigger = contentChild.required(RdxSelectTriggerDirective);
|
91
|
+
this.content = contentChild.required(forwardRef(() => RdxSelectContentDirective));
|
92
|
+
this.items = contentChildren(forwardRef(() => RdxSelectItemDirective), { descendants: true });
|
93
|
+
this.overlayDir = viewChild.required(CdkConnectedOverlay);
|
94
|
+
/**
|
95
|
+
* Tuple type for the trigger element size. Set by the trigger element itself.
|
96
|
+
* The first element is the width and the second element is the height.
|
97
|
+
* @returns The size of the trigger element.
|
98
|
+
*/
|
99
|
+
this.triggerSize = signal([0, 0]);
|
100
|
+
/**
|
101
|
+
* The width of the trigger element.
|
102
|
+
* @returns The width of the trigger element.
|
103
|
+
*/
|
104
|
+
this.triggerWidth = computed(() => this.triggerSize()[0]);
|
72
105
|
/**
|
73
106
|
* This position config ensures that the top "start" corner of the overlay
|
74
107
|
* is aligned with the top "start" of the origin by default (overlapping
|
@@ -99,11 +132,17 @@ class RdxSelectComponent {
|
|
99
132
|
*/
|
100
133
|
this.id = `rdx-select-${nextId$1++}`;
|
101
134
|
this.open = false;
|
135
|
+
/**
|
136
|
+
* The overlay width will be set to the trigger width if this is true.
|
137
|
+
* Otherwise, the overlay width will be set to the width of the content.
|
138
|
+
*/
|
139
|
+
this.matchTriggerWidth = false;
|
102
140
|
this.onValueChange = new EventEmitter();
|
103
141
|
this.onOpenChange = new EventEmitter();
|
104
142
|
this.optionSelectionChanges = defer(() => {
|
105
|
-
|
106
|
-
|
143
|
+
const content = this.content();
|
144
|
+
if (content.options) {
|
145
|
+
return merge(...content.options.map((option) => option.onSelectionChange));
|
107
146
|
}
|
108
147
|
return this.ngZone.onStable.asObservable().pipe(take(1), switchMap(() => this.optionSelectionChanges));
|
109
148
|
});
|
@@ -141,9 +180,9 @@ class RdxSelectComponent {
|
|
141
180
|
this.selectionModel.clear();
|
142
181
|
this.selectionModel.select(event.source);
|
143
182
|
this.close();
|
144
|
-
this.trigger.focus();
|
183
|
+
this.trigger().focus();
|
145
184
|
});
|
146
|
-
this.content.keyManager.tabOut.subscribe(() => {
|
185
|
+
this.content().keyManager.tabOut.subscribe(() => {
|
147
186
|
if (this.open)
|
148
187
|
this.close();
|
149
188
|
});
|
@@ -182,7 +221,7 @@ class RdxSelectComponent {
|
|
182
221
|
this.onOpenChange.emit(this.open);
|
183
222
|
}
|
184
223
|
updateActiveItem(item) {
|
185
|
-
this.content.keyManager.updateActiveItem(item);
|
224
|
+
this.content().keyManager.updateActiveItem(item);
|
186
225
|
}
|
187
226
|
selectDefaultValue() {
|
188
227
|
if (!this.defaultValue)
|
@@ -190,7 +229,7 @@ class RdxSelectComponent {
|
|
190
229
|
this.selectValue(this.defaultValue);
|
191
230
|
}
|
192
231
|
selectValue(value) {
|
193
|
-
const option = this.content?.options.find((option) => option.value === value);
|
232
|
+
const option = this.content()?.options.find((option) => option.value === value);
|
194
233
|
if (option) {
|
195
234
|
option.selected = true;
|
196
235
|
option.highlighted = true;
|
@@ -199,10 +238,10 @@ class RdxSelectComponent {
|
|
199
238
|
}
|
200
239
|
}
|
201
240
|
closingActions() {
|
202
|
-
return merge(this.overlayDir.overlayRef.outsidePointerEvents(), this.overlayDir.overlayRef.detachments());
|
241
|
+
return merge(this.overlayDir().overlayRef.outsidePointerEvents(), this.overlayDir().overlayRef.detachments());
|
203
242
|
}
|
204
243
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
205
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
244
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.4", type: RdxSelectComponent, isStandalone: true, selector: "[rdxSelect]", inputs: { defaultValue: "defaultValue", name: "name", defaultOpen: ["defaultOpen", "defaultOpen", booleanAttribute], open: ["open", "open", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], required: ["required", "required", booleanAttribute], matchTriggerWidth: ["matchTriggerWidth", "matchTriggerWidth", booleanAttribute], value: "value" }, outputs: { onValueChange: "onValueChange", onOpenChange: "onOpenChange" }, host: { listeners: { "click": "toggle()", "keydown": "content().keyManager.onKeydown($event)" }, properties: { "style.--radix-select-trigger-width.px": "triggerSize()[0]", "style.--radix-select-trigger-height.px": "triggerSize()[1]" } }, queries: [{ propertyName: "trigger", first: true, predicate: RdxSelectTriggerDirective, descendants: true, isSignal: true }, { propertyName: "content", first: true, predicate: i0.forwardRef(() => RdxSelectContentDirective), descendants: true, isSignal: true }, { propertyName: "items", predicate: i0.forwardRef(() => RdxSelectItemDirective), descendants: true, isSignal: true }], viewQueries: [{ propertyName: "overlayDir", first: true, predicate: CdkConnectedOverlay, descendants: true, isSignal: true }], ngImport: i0, template: `
|
206
245
|
<ng-content select="[rdxSelectTrigger]" />
|
207
246
|
|
208
247
|
<ng-template
|
@@ -210,9 +249,15 @@ class RdxSelectComponent {
|
|
210
249
|
[cdkConnectedOverlayOrigin]="elementRef"
|
211
250
|
[cdkConnectedOverlayPositions]="positions"
|
212
251
|
[cdkConnectedOverlayScrollStrategy]="overlay.scrollStrategies.reposition()"
|
252
|
+
[cdkConnectedOverlayMinWidth]="triggerWidth() > 0 ? triggerWidth() : 'auto'"
|
253
|
+
[cdkConnectedOverlayWidth]="matchTriggerWidth ? triggerWidth() : 'auto'"
|
254
|
+
[cdkConnectedOverlay]
|
213
255
|
(attach)="onAttached()"
|
214
256
|
(backdropClick)="close()"
|
215
257
|
(detach)="onDetach()"
|
258
|
+
cdkConnectedOverlayLockPosition
|
259
|
+
cdkConnectedOverlayHasBackdrop
|
260
|
+
cdkConnectedOverlayBackdropClass="cdk-overlay-transparent-backdrop"
|
216
261
|
cdkConnectedOverlay
|
217
262
|
>
|
218
263
|
<ng-content select="[rdxSelectContent]" />
|
@@ -231,35 +276,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
231
276
|
[cdkConnectedOverlayOrigin]="elementRef"
|
232
277
|
[cdkConnectedOverlayPositions]="positions"
|
233
278
|
[cdkConnectedOverlayScrollStrategy]="overlay.scrollStrategies.reposition()"
|
279
|
+
[cdkConnectedOverlayMinWidth]="triggerWidth() > 0 ? triggerWidth() : 'auto'"
|
280
|
+
[cdkConnectedOverlayWidth]="matchTriggerWidth ? triggerWidth() : 'auto'"
|
281
|
+
[cdkConnectedOverlay]
|
234
282
|
(attach)="onAttached()"
|
235
283
|
(backdropClick)="close()"
|
236
284
|
(detach)="onDetach()"
|
285
|
+
cdkConnectedOverlayLockPosition
|
286
|
+
cdkConnectedOverlayHasBackdrop
|
287
|
+
cdkConnectedOverlayBackdropClass="cdk-overlay-transparent-backdrop"
|
237
288
|
cdkConnectedOverlay
|
238
289
|
>
|
239
290
|
<ng-content select="[rdxSelectContent]" />
|
240
291
|
</ng-template>
|
241
292
|
`,
|
242
293
|
host: {
|
294
|
+
'[style.--radix-select-trigger-width.px]': 'triggerSize()[0]',
|
295
|
+
'[style.--radix-select-trigger-height.px]': 'triggerSize()[1]',
|
243
296
|
'(click)': 'toggle()',
|
244
|
-
'(keydown)': 'content.keyManager.onKeydown($event)'
|
297
|
+
'(keydown)': 'content().keyManager.onKeydown($event)'
|
245
298
|
},
|
246
|
-
imports: [
|
247
|
-
OverlayModule
|
248
|
-
]
|
299
|
+
imports: [OverlayModule]
|
249
300
|
}]
|
250
|
-
}], propDecorators: {
|
251
|
-
type: ContentChild,
|
252
|
-
args: [RdxSelectTriggerDirective]
|
253
|
-
}], content: [{
|
254
|
-
type: ContentChild,
|
255
|
-
args: [forwardRef(() => RdxSelectContentDirective)]
|
256
|
-
}], items: [{
|
257
|
-
type: ContentChildren,
|
258
|
-
args: [forwardRef(() => RdxSelectItemDirective), { descendants: true }]
|
259
|
-
}], overlayDir: [{
|
260
|
-
type: ViewChild,
|
261
|
-
args: [CdkConnectedOverlay, { static: false }]
|
262
|
-
}], defaultValue: [{
|
301
|
+
}], propDecorators: { defaultValue: [{
|
263
302
|
type: Input
|
264
303
|
}], name: [{
|
265
304
|
type: Input
|
@@ -275,6 +314,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
275
314
|
}], required: [{
|
276
315
|
type: Input,
|
277
316
|
args: [{ transform: booleanAttribute }]
|
317
|
+
}], matchTriggerWidth: [{
|
318
|
+
type: Input,
|
319
|
+
args: [{ transform: booleanAttribute }]
|
278
320
|
}], value: [{
|
279
321
|
type: Input
|
280
322
|
}], onValueChange: [{
|