@radix-ng/primitives 1.0.6 → 1.0.7
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/aspect-ratio/README.md +1 -1
- package/fesm2022/radix-ng-primitives-accordion.mjs +6 -1
- package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-aspect-ratio.mjs +9 -34
- package/fesm2022/radix-ng-primitives-aspect-ratio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-avatar.mjs +69 -18
- package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-checkbox.mjs +5 -9
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-collapsible.mjs +4 -3
- package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-field.mjs +13 -14
- package/fesm2022/radix-ng-primitives-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-form.mjs +1 -1
- package/fesm2022/radix-ng-primitives-form.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-label.mjs +5 -4
- package/fesm2022/radix-ng-primitives-label.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-number-field.mjs +7 -3
- package/fesm2022/radix-ng-primitives-number-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-progress.mjs +37 -22
- package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-radio.mjs +1 -6
- package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-scroll-area.mjs +4 -4
- package/fesm2022/radix-ng-primitives-scroll-area.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-separator.mjs +7 -13
- package/fesm2022/radix-ng-primitives-separator.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-slider.mjs +1 -2
- package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-switch.mjs +3 -3
- package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tabs.mjs +4 -4
- package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle-group.mjs +10 -4
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle.mjs +24 -29
- package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toolbar.mjs +15 -2
- package/fesm2022/radix-ng-primitives-toolbar.mjs.map +1 -1
- package/package.json +1 -1
- package/types/radix-ng-primitives-accordion.d.ts +1 -0
- package/types/radix-ng-primitives-aspect-ratio.d.ts +10 -23
- package/types/radix-ng-primitives-avatar.d.ts +51 -25
- package/types/radix-ng-primitives-checkbox.d.ts +26 -98
- package/types/radix-ng-primitives-field.d.ts +33 -207
- package/types/radix-ng-primitives-form.d.ts +24 -33
- package/types/radix-ng-primitives-label.d.ts +3 -2
- package/types/radix-ng-primitives-number-field.d.ts +1 -1
- package/types/radix-ng-primitives-progress.d.ts +59 -121
- package/types/radix-ng-primitives-radio.d.ts +0 -1
- package/types/radix-ng-primitives-separator.d.ts +0 -7
- package/types/radix-ng-primitives-toggle-group.d.ts +7 -3
- package/types/radix-ng-primitives-toggle.d.ts +8 -8
- package/types/radix-ng-primitives-toolbar.d.ts +2 -0
package/aspect-ratio/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# @radix-ng/primitives/
|
|
1
|
+
# @radix-ng/primitives/aspect-ratio
|
|
@@ -318,6 +318,7 @@ class RdxAccordionTriggerDirective {
|
|
|
318
318
|
constructor() {
|
|
319
319
|
this.rootContext = injectAccordionRootContext();
|
|
320
320
|
this.itemContext = injectAccordionItemContext();
|
|
321
|
+
this.collapsibleContext = injectCollapsibleRootContext();
|
|
321
322
|
this.itemContext.triggerId.set(injectId('rdx-accordion-trigger-'));
|
|
322
323
|
}
|
|
323
324
|
changeItem(event) {
|
|
@@ -328,7 +329,7 @@ class RdxAccordionTriggerDirective {
|
|
|
328
329
|
this.rootContext.changeModelValue(this.itemContext.value(), event);
|
|
329
330
|
}
|
|
330
331
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAccordionTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
331
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.2", type: RdxAccordionTriggerDirective, isStandalone: true, selector: "[rdxAccordionTrigger]", host: { listeners: { "click": "changeItem($event)" }, properties: { "id": "itemContext.triggerId()", "attr.role": "\"button\"", "attr.aria-expanded": "itemContext.open()", "attr.aria-disabled": "itemContext.dataDisabled() ? \"true\" : undefined", "attr.data-disabled": "itemContext.dataDisabled() ? \"\" : undefined", "attr.data-panel-open": "itemContext.open() ? \"\" : undefined" } }, ngImport: i0 }); }
|
|
332
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.2", type: RdxAccordionTriggerDirective, isStandalone: true, selector: "[rdxAccordionTrigger]", host: { listeners: { "click": "changeItem($event)" }, properties: { "id": "itemContext.triggerId()", "attr.role": "\"button\"", "attr.aria-expanded": "itemContext.open()", "attr.aria-controls": "itemContext.open() ? collapsibleContext.panelId() : undefined", "attr.aria-disabled": "itemContext.dataDisabled() ? \"true\" : undefined", "attr.data-disabled": "itemContext.dataDisabled() ? \"\" : undefined", "attr.data-panel-open": "itemContext.open() ? \"\" : undefined" } }, ngImport: i0 }); }
|
|
332
333
|
}
|
|
333
334
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAccordionTriggerDirective, decorators: [{
|
|
334
335
|
type: Directive,
|
|
@@ -338,6 +339,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
338
339
|
'[id]': 'itemContext.triggerId()',
|
|
339
340
|
'[attr.role]': '"button"',
|
|
340
341
|
'[attr.aria-expanded]': 'itemContext.open()',
|
|
342
|
+
// Point at the panel only while open — the panel unmounts when closed, so referencing a
|
|
343
|
+
// missing id would be an invalid ARIA relationship. The id comes from the composed
|
|
344
|
+
// collapsible root (the same id the accordion panel renders).
|
|
345
|
+
'[attr.aria-controls]': 'itemContext.open() ? collapsibleContext.panelId() : undefined',
|
|
341
346
|
// Disabled triggers stay focusable (Base UI parity) — `aria-disabled`, not native `disabled`.
|
|
342
347
|
'[attr.aria-disabled]': 'itemContext.dataDisabled() ? "true" : undefined',
|
|
343
348
|
'[attr.data-disabled]': 'itemContext.dataDisabled() ? "" : undefined',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-accordion.mjs","sources":["../../../packages/primitives/accordion/src/accordion-root.directive.ts","../../../packages/primitives/accordion/src/accordion-item.directive.ts","../../../packages/primitives/accordion/src/accordion-header.directive.ts","../../../packages/primitives/accordion/src/accordion-panel.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 {\n booleanAttribute,\n computed,\n Directive,\n effect,\n inject,\n input,\n InputSignal,\n InputSignalWithTransform,\n model,\n ModelSignal,\n output,\n Signal\n} from '@angular/core';\nimport { RdxCompositeList } from '@radix-ng/primitives/composite';\nimport {\n AcceptableValue,\n BooleanInput,\n createCancelableChangeEventDetails,\n createContext,\n DataOrientation,\n RdxCancelableChangeEventDetails\n} from '@radix-ng/primitives/core';\n\n/** The reason an accordion value change was requested. */\nexport type RdxAccordionValueChangeReason = 'trigger-press' | 'none';\nexport type RdxAccordionValueChangeEventDetails = RdxCancelableChangeEventDetails<RdxAccordionValueChangeReason>;\n\n/** Payload of {@link RdxAccordionRootDirective.onValueChange}, mirroring Base UI's `(value, eventDetails)`. */\nexport interface RdxAccordionValueChangeEvent {\n value: AcceptableValue | AcceptableValue[] | undefined;\n eventDetails: RdxAccordionValueChangeEventDetails;\n}\n\nexport type AccordionRootContext = {\n disabled: InputSignalWithTransform<boolean, BooleanInput>;\n orientation: InputSignal<DataOrientation>;\n value: ModelSignal<AcceptableValue | AcceptableValue[] | undefined>;\n isSingle: Signal<boolean>;\n keepMounted: InputSignalWithTransform<boolean, BooleanInput>;\n hiddenUntilFound: InputSignalWithTransform<boolean, BooleanInput>;\n changeModelValue: (value: string, event?: Event) => 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 orientation: instance.orientation,\n value: instance.value,\n isSingle: instance.isSingle,\n keepMounted: instance.keepMounted,\n hiddenUntilFound: instance.hiddenUntilFound,\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 hostDirectives: [RdxCompositeList],\n host: {\n '[attr.data-orientation]': 'orientation()',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined'\n }\n})\nexport class RdxAccordionRootDirective {\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 * Allow multiple panels to be open simultaneously. In single mode an open item can always be\n * closed by clicking its trigger again (Base UI parity — there is no separate `collapsible`).\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 while hidden.\n *\n * @defaultValue false\n * @group Props\n */\n readonly keepMounted = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Allow collapsed panels to remain mounted (but hidden) so the browser's in-page search\n * can find and reveal them. Mirrors Base UI's `hiddenUntilFound`.\n *\n * @defaultValue false\n * @group Props\n */\n readonly hiddenUntilFound = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Event handler called when the expanded value changes. Emits the next value plus a cancelable\n * `eventDetails` (Base UI parity); call `eventDetails.cancel()` to reject the change.\n * @group Emits\n */\n readonly onValueChange = output<RdxAccordionValueChangeEvent>();\n\n readonly isSingle = computed(() => !this.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, event?: Event) => {\n let nextValue: AcceptableValue | AcceptableValue[] | undefined;\n\n if (this.isSingle()) {\n nextValue = 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 nextValue = modelValueArray;\n }\n\n const { eventDetails } = createCancelableChangeEventDetails<RdxAccordionValueChangeReason>(\n event ? 'trigger-press' : 'none',\n event ?? new Event('change')\n );\n\n this.onValueChange.emit({ value: nextValue, eventDetails });\n\n if (eventDetails.isCanceled()) {\n return;\n }\n\n this.value.set(nextValue);\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 { RdxCompositeListItem } from '@radix-ng/primitives/composite';\nimport { BooleanInput, createCancelableChangeEventDetails, createContext } from '@radix-ng/primitives/core';\nimport { injectAccordionRootContext, RdxAccordionValueChangeEventDetails } from './accordion-root.directive';\n\n/** Payload of {@link RdxAccordionItemDirective.onOpenChange}, mirroring Base UI's `(open, eventDetails)`. */\nexport interface RdxAccordionItemOpenChangeEvent {\n open: boolean;\n eventDetails: RdxAccordionValueChangeEventDetails;\n}\n\nexport type AccordionItemContext = {\n open: Signal<boolean>;\n disabled: Signal<boolean>;\n triggerId: WritableSignal<string>;\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 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 RdxCompositeListItem\n ],\n host: {\n '[attr.data-disabled]': 'isDisabled() ? \"\" : undefined',\n '[attr.data-open]': 'open() ? \"\" : undefined',\n '[attr.data-index]': 'index()'\n }\n})\nexport class RdxAccordionItemDirective {\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n private readonly collapsibleContext = injectCollapsibleRootContext();\n private readonly listItem = inject(RdxCompositeListItem, { self: true });\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. Emits `{ open, eventDetails }`\n * (Base UI parity).\n * @group Emits\n */\n readonly onOpenChange = output<RdxAccordionItemOpenChangeEvent>();\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 /** Set by the trigger; links the content's `aria-labelledby` to the trigger `id`. */\n readonly triggerId = signal('');\n\n readonly index = this.listItem.index;\n\n constructor() {\n effect(() => {\n this.updateOpen();\n });\n\n // Forward the accordion-level mount controls onto the composed collapsible panel.\n effect(() => {\n this.collapsibleContext.keepMounted.set(this.rootContext.keepMounted());\n });\n effect(() => {\n this.collapsibleContext.hiddenUntilFound.set(this.rootContext.hiddenUntilFound());\n });\n\n let initialized = false;\n effect(() => {\n const isOpen = this.open();\n if (!initialized) {\n initialized = true;\n return;\n }\n const { eventDetails } = createCancelableChangeEventDetails('none', new Event('change'));\n this.onOpenChange.emit({ open: isOpen, eventDetails });\n });\n }\n\n updateOpen = () => {\n this.collapsibleContext.open.set(this.open());\n };\n}\n","import { Directive } from '@angular/core';\nimport { injectAccordionItemContext } from './accordion-item.directive';\n\n@Directive({\n selector: '[rdxAccordionHeader]',\n host: {\n '[attr.data-open]': 'itemContext.open() ? \"\" : undefined',\n '[attr.data-disabled]': 'itemContext.dataDisabled() ? \"\" : undefined',\n '[attr.data-index]': 'itemContext.index()'\n }\n})\nexport class RdxAccordionHeaderDirective {\n protected readonly itemContext = injectAccordionItemContext();\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: '[rdxAccordionPanel]',\n hostDirectives: [RdxCollapsiblePanelDirective],\n host: {\n role: 'region',\n '[attr.aria-labelledby]': 'itemContext.triggerId()',\n '[attr.data-disabled]': 'itemContext.dataDisabled() ? \"\" : undefined',\n '[attr.data-orientation]': 'rootContext.orientation()',\n '[attr.data-index]': 'itemContext.index()',\n // Base UI's accordion panel exposes `data-open` (no `data-closed`) — suppress the\n // `data-closed` the composed RdxCollapsiblePanelDirective would otherwise add.\n '[attr.data-closed]': 'undefined',\n // `data-open` / `data-starting-style` / `data-ending-style` and the `--collapsible-panel-*`\n // size vars come from the composed RdxCollapsiblePanelDirective.\n // Re-expose the size vars under Base UI's accordion-scoped names.\n '[style]': `{\n '--accordion-panel-height': 'var(--collapsible-panel-height)',\n '--accordion-panel-width': 'var(--collapsible-panel-width)',\n }`\n }\n})\nexport class RdxAccordionPanelDirective {\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.role]': '\"button\"',\n '[attr.aria-expanded]': 'itemContext.open()',\n // Disabled triggers stay focusable (Base UI parity) — `aria-disabled`, not native `disabled`.\n '[attr.aria-disabled]': 'itemContext.dataDisabled() ? \"true\" : undefined',\n '[attr.data-disabled]': 'itemContext.dataDisabled() ? \"\" : undefined',\n '[attr.data-panel-open]': 'itemContext.open() ? \"\" : undefined',\n\n '(click)': 'changeItem($event)'\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(event: Event) {\n // `dataDisabled` is the effective disabled state (accordion-root OR item level).\n if (this.itemContext.dataDisabled()) {\n return;\n }\n\n this.rootContext.changeModelValue(this.itemContext.value()!, event);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { RdxAccordionHeaderDirective } from './src/accordion-header.directive';\nimport { RdxAccordionItemDirective } from './src/accordion-item.directive';\nimport { RdxAccordionPanelDirective } from './src/accordion-panel.directive';\nimport { RdxAccordionRootDirective } from './src/accordion-root.directive';\nimport { RdxAccordionTriggerDirective } from './src/accordion-trigger.directive';\n\nexport * from './src/accordion-header.directive';\nexport * from './src/accordion-item.directive';\nexport * from './src/accordion-panel.directive';\nexport * from './src/accordion-root.directive';\nexport * from './src/accordion-trigger.directive';\n\nconst _imports = [\n RdxAccordionHeaderDirective,\n RdxAccordionItemDirective,\n RdxAccordionPanelDirective,\n RdxAccordionRootDirective,\n RdxAccordionTriggerDirective\n];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._im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AAE,6CAA6C;AACrE,wBAAA,wBAAwB,EAAE,qCAAqC;AAE/D,wBAAA,SAAS,EAAE;AACd;AACJ,iBAAA;;;ACLD,MAAM,QAAQ,GAAG;IACb,2BAA2B;IAC3B,yBAAyB;IACzB,0BAA0B;IAC1B,yBAAyB;IACzB;CACH;MAMY,kBAAkB,CAAA;8GAAlB,kBAAkB,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,YAX3B,2BAA2B;YAC3B,yBAAyB;YACzB,0BAA0B;YAC1B,yBAAyB;AACzB,YAAA,4BAA4B,aAJ5B,2BAA2B;YAC3B,yBAAyB;YACzB,0BAA0B;YAC1B,yBAAyB;YACzB,4BAA4B,CAAA,EAAA,CAAA,CAAA;+GAOnB,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;;;ACxBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"radix-ng-primitives-accordion.mjs","sources":["../../../packages/primitives/accordion/src/accordion-root.directive.ts","../../../packages/primitives/accordion/src/accordion-item.directive.ts","../../../packages/primitives/accordion/src/accordion-header.directive.ts","../../../packages/primitives/accordion/src/accordion-panel.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 {\n booleanAttribute,\n computed,\n Directive,\n effect,\n inject,\n input,\n InputSignal,\n InputSignalWithTransform,\n model,\n ModelSignal,\n output,\n Signal\n} from '@angular/core';\nimport { RdxCompositeList } from '@radix-ng/primitives/composite';\nimport {\n AcceptableValue,\n BooleanInput,\n createCancelableChangeEventDetails,\n createContext,\n DataOrientation,\n RdxCancelableChangeEventDetails\n} from '@radix-ng/primitives/core';\n\n/** The reason an accordion value change was requested. */\nexport type RdxAccordionValueChangeReason = 'trigger-press' | 'none';\nexport type RdxAccordionValueChangeEventDetails = RdxCancelableChangeEventDetails<RdxAccordionValueChangeReason>;\n\n/** Payload of {@link RdxAccordionRootDirective.onValueChange}, mirroring Base UI's `(value, eventDetails)`. */\nexport interface RdxAccordionValueChangeEvent {\n value: AcceptableValue | AcceptableValue[] | undefined;\n eventDetails: RdxAccordionValueChangeEventDetails;\n}\n\nexport type AccordionRootContext = {\n disabled: InputSignalWithTransform<boolean, BooleanInput>;\n orientation: InputSignal<DataOrientation>;\n value: ModelSignal<AcceptableValue | AcceptableValue[] | undefined>;\n isSingle: Signal<boolean>;\n keepMounted: InputSignalWithTransform<boolean, BooleanInput>;\n hiddenUntilFound: InputSignalWithTransform<boolean, BooleanInput>;\n changeModelValue: (value: string, event?: Event) => 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 orientation: instance.orientation,\n value: instance.value,\n isSingle: instance.isSingle,\n keepMounted: instance.keepMounted,\n hiddenUntilFound: instance.hiddenUntilFound,\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 hostDirectives: [RdxCompositeList],\n host: {\n '[attr.data-orientation]': 'orientation()',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined'\n }\n})\nexport class RdxAccordionRootDirective {\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 * Allow multiple panels to be open simultaneously. In single mode an open item can always be\n * closed by clicking its trigger again (Base UI parity — there is no separate `collapsible`).\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 while hidden.\n *\n * @defaultValue false\n * @group Props\n */\n readonly keepMounted = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Allow collapsed panels to remain mounted (but hidden) so the browser's in-page search\n * can find and reveal them. Mirrors Base UI's `hiddenUntilFound`.\n *\n * @defaultValue false\n * @group Props\n */\n readonly hiddenUntilFound = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Event handler called when the expanded value changes. Emits the next value plus a cancelable\n * `eventDetails` (Base UI parity); call `eventDetails.cancel()` to reject the change.\n * @group Emits\n */\n readonly onValueChange = output<RdxAccordionValueChangeEvent>();\n\n readonly isSingle = computed(() => !this.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, event?: Event) => {\n let nextValue: AcceptableValue | AcceptableValue[] | undefined;\n\n if (this.isSingle()) {\n nextValue = 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 nextValue = modelValueArray;\n }\n\n const { eventDetails } = createCancelableChangeEventDetails<RdxAccordionValueChangeReason>(\n event ? 'trigger-press' : 'none',\n event ?? new Event('change')\n );\n\n this.onValueChange.emit({ value: nextValue, eventDetails });\n\n if (eventDetails.isCanceled()) {\n return;\n }\n\n this.value.set(nextValue);\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: unknown, b: unknown): 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 { RdxCompositeListItem } from '@radix-ng/primitives/composite';\nimport { BooleanInput, createCancelableChangeEventDetails, createContext } from '@radix-ng/primitives/core';\nimport { injectAccordionRootContext, RdxAccordionValueChangeEventDetails } from './accordion-root.directive';\n\n/** Payload of {@link RdxAccordionItemDirective.onOpenChange}, mirroring Base UI's `(open, eventDetails)`. */\nexport interface RdxAccordionItemOpenChangeEvent {\n open: boolean;\n eventDetails: RdxAccordionValueChangeEventDetails;\n}\n\nexport type AccordionItemContext = {\n open: Signal<boolean>;\n disabled: Signal<boolean>;\n triggerId: WritableSignal<string>;\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 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 RdxCompositeListItem\n ],\n host: {\n '[attr.data-disabled]': 'isDisabled() ? \"\" : undefined',\n '[attr.data-open]': 'open() ? \"\" : undefined',\n '[attr.data-index]': 'index()'\n }\n})\nexport class RdxAccordionItemDirective {\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n private readonly collapsibleContext = injectCollapsibleRootContext();\n private readonly listItem = inject(RdxCompositeListItem, { self: true });\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. Emits `{ open, eventDetails }`\n * (Base UI parity).\n * @group Emits\n */\n readonly onOpenChange = output<RdxAccordionItemOpenChangeEvent>();\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 /** Set by the trigger; links the content's `aria-labelledby` to the trigger `id`. */\n readonly triggerId = signal('');\n\n readonly index = this.listItem.index;\n\n constructor() {\n effect(() => {\n this.updateOpen();\n });\n\n // Forward the accordion-level mount controls onto the composed collapsible panel.\n effect(() => {\n this.collapsibleContext.keepMounted.set(this.rootContext.keepMounted());\n });\n effect(() => {\n this.collapsibleContext.hiddenUntilFound.set(this.rootContext.hiddenUntilFound());\n });\n\n let initialized = false;\n effect(() => {\n const isOpen = this.open();\n if (!initialized) {\n initialized = true;\n return;\n }\n const { eventDetails } = createCancelableChangeEventDetails('none', new Event('change'));\n this.onOpenChange.emit({ open: isOpen, eventDetails });\n });\n }\n\n updateOpen = () => {\n this.collapsibleContext.open.set(this.open());\n };\n}\n","import { Directive } from '@angular/core';\nimport { injectAccordionItemContext } from './accordion-item.directive';\n\n@Directive({\n selector: '[rdxAccordionHeader]',\n host: {\n '[attr.data-open]': 'itemContext.open() ? \"\" : undefined',\n '[attr.data-disabled]': 'itemContext.dataDisabled() ? \"\" : undefined',\n '[attr.data-index]': 'itemContext.index()'\n }\n})\nexport class RdxAccordionHeaderDirective {\n protected readonly itemContext = injectAccordionItemContext();\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: '[rdxAccordionPanel]',\n hostDirectives: [RdxCollapsiblePanelDirective],\n host: {\n role: 'region',\n '[attr.aria-labelledby]': 'itemContext.triggerId()',\n '[attr.data-disabled]': 'itemContext.dataDisabled() ? \"\" : undefined',\n '[attr.data-orientation]': 'rootContext.orientation()',\n '[attr.data-index]': 'itemContext.index()',\n // Base UI's accordion panel exposes `data-open` (no `data-closed`) — suppress the\n // `data-closed` the composed RdxCollapsiblePanelDirective would otherwise add.\n '[attr.data-closed]': 'undefined',\n // `data-open` / `data-starting-style` / `data-ending-style` and the `--collapsible-panel-*`\n // size vars come from the composed RdxCollapsiblePanelDirective.\n // Re-expose the size vars under Base UI's accordion-scoped names.\n '[style]': `{\n '--accordion-panel-height': 'var(--collapsible-panel-height)',\n '--accordion-panel-width': 'var(--collapsible-panel-width)',\n }`\n }\n})\nexport class RdxAccordionPanelDirective {\n protected readonly rootContext = injectAccordionRootContext();\n protected readonly itemContext = injectAccordionItemContext();\n}\n","import { Directive } from '@angular/core';\nimport { injectCollapsibleRootContext } from '@radix-ng/primitives/collapsible';\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.role]': '\"button\"',\n '[attr.aria-expanded]': 'itemContext.open()',\n // Point at the panel only while open — the panel unmounts when closed, so referencing a\n // missing id would be an invalid ARIA relationship. The id comes from the composed\n // collapsible root (the same id the accordion panel renders).\n '[attr.aria-controls]': 'itemContext.open() ? collapsibleContext.panelId() : undefined',\n // Disabled triggers stay focusable (Base UI parity) — `aria-disabled`, not native `disabled`.\n '[attr.aria-disabled]': 'itemContext.dataDisabled() ? \"true\" : undefined',\n '[attr.data-disabled]': 'itemContext.dataDisabled() ? \"\" : undefined',\n '[attr.data-panel-open]': 'itemContext.open() ? \"\" : undefined',\n\n '(click)': 'changeItem($event)'\n }\n})\nexport class RdxAccordionTriggerDirective {\n protected readonly rootContext = injectAccordionRootContext();\n protected readonly itemContext = injectAccordionItemContext();\n protected readonly collapsibleContext = injectCollapsibleRootContext();\n\n constructor() {\n this.itemContext.triggerId.set(injectId('rdx-accordion-trigger-'));\n }\n\n changeItem(event: Event) {\n // `dataDisabled` is the effective disabled state (accordion-root OR item level).\n if (this.itemContext.dataDisabled()) {\n return;\n }\n\n this.rootContext.changeModelValue(this.itemContext.value()!, event);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { RdxAccordionHeaderDirective } from './src/accordion-header.directive';\nimport { RdxAccordionItemDirective } from './src/accordion-item.directive';\nimport { RdxAccordionPanelDirective } from './src/accordion-panel.directive';\nimport { RdxAccordionRootDirective } from './src/accordion-root.directive';\nimport { RdxAccordionTriggerDirective } from './src/accordion-trigger.directive';\n\nexport * from './src/accordion-header.directive';\nexport * from './src/accordion-item.directive';\nexport * from './src/accordion-panel.directive';\nexport * from './src/accordion-root.directive';\nexport * from './src/accordion-trigger.directive';\n\nconst _imports = [\n RdxAccordionHeaderDirective,\n RdxAccordionItemDirective,\n RdxAccordionPanelDirective,\n RdxAccordionRootDirective,\n RdxAccordionTriggerDirective\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":["i1","i2"],"mappings":";;;;;;;;AA4CO,MAAM,CAAC,0BAA0B,EAAE,2BAA2B,CAAC,GAAG,aAAa,CAClF,sBAAsB,EACtB,sBAAsB;AAG1B,MAAM,WAAW,GAAG,MAA2B;AAC3C,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,yBAAyB,CAAC;IAElD,OAAO;QACH,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;QAC3C,gBAAgB,EAAE,QAAQ,CAAC;KAC9B;AACL,CAAC;AAED;;AAEG;MAWU,y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,YAX3B,2BAA2B;YAC3B,yBAAyB;YACzB,0BAA0B;YAC1B,yBAAyB;AACzB,YAAA,4BAA4B,aAJ5B,2BAA2B;YAC3B,yBAAyB;YACzB,0BAA0B;YAC1B,yBAAyB;YACzB,4BAA4B,CAAA,EAAA,CAAA,CAAA;+GAOnB,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;;;ACxBD;;AAEG;;;;"}
|
|
@@ -1,58 +1,33 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { input, numberAttribute, Directive } from '@angular/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* The content inside the element will be positioned absolutely.
|
|
5
|
+
* Maintains a fixed aspect ratio for its content using the native CSS `aspect-ratio` property.
|
|
6
|
+
* Place the content inside (e.g. an `<img class="size-full object-cover">`) and it fills the box.
|
|
7
|
+
*
|
|
9
8
|
* @group Components
|
|
10
9
|
*/
|
|
11
10
|
class RdxAspectRatioDirective {
|
|
12
11
|
constructor() {
|
|
13
|
-
this.element = inject(ElementRef);
|
|
14
|
-
this.renderer = inject(Renderer2);
|
|
15
12
|
/**
|
|
16
|
-
* The desired aspect ratio (e.g
|
|
17
|
-
*
|
|
13
|
+
* The desired aspect ratio (e.g. `16 / 9`). Defaults to `1` (a square, 1:1).
|
|
14
|
+
*
|
|
18
15
|
* @group Props
|
|
19
16
|
* @defaultValue 1
|
|
20
17
|
*/
|
|
21
18
|
this.ratio = input(1, { ...(ngDevMode ? { debugName: "ratio" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
22
|
-
/**
|
|
23
|
-
* Dynamically computed `padding-bottom` style for the element.
|
|
24
|
-
* This value is calculated based on the inverse of the aspect ratio.
|
|
25
|
-
*
|
|
26
|
-
* If the ratio is zero, it defaults to `0%` to avoid division by zero.
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
this.paddingBottom = computed(() => {
|
|
30
|
-
const ratioValue = this.ratio();
|
|
31
|
-
return `${ratioValue !== 0 ? (1 / ratioValue) * 100 : 0}%`;
|
|
32
|
-
}, /* @ts-ignore */
|
|
33
|
-
...(ngDevMode ? [{ debugName: "paddingBottom" }] : /* istanbul ignore next */ []));
|
|
34
|
-
}
|
|
35
|
-
ngAfterViewInit() {
|
|
36
|
-
const content = this.element.nativeElement.firstElementChild;
|
|
37
|
-
if (content) {
|
|
38
|
-
// Set the content to cover the entire element with absolute positioning
|
|
39
|
-
this.renderer.setStyle(content, 'position', 'absolute');
|
|
40
|
-
this.renderer.setStyle(content, 'inset', '0');
|
|
41
|
-
}
|
|
42
19
|
}
|
|
43
20
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAspectRatioDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
44
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: RdxAspectRatioDirective, isStandalone: true, selector: "[rdxAspectRatio]", inputs: { ratio: { classPropertyName: "ratio", publicName: "ratio", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.
|
|
21
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: RdxAspectRatioDirective, isStandalone: true, selector: "[rdxAspectRatio]", inputs: { ratio: { classPropertyName: "ratio", publicName: "ratio", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.aspect-ratio": "ratio() || null", "style.width": "\"100%\"" } }, exportAs: ["rdxAspectRatio"], ngImport: i0 }); }
|
|
45
22
|
}
|
|
46
23
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAspectRatioDirective, decorators: [{
|
|
47
24
|
type: Directive,
|
|
48
25
|
args: [{
|
|
49
26
|
selector: '[rdxAspectRatio]',
|
|
50
27
|
exportAs: 'rdxAspectRatio',
|
|
51
|
-
standalone: true,
|
|
52
28
|
host: {
|
|
53
|
-
'[style.
|
|
54
|
-
'[style.width]':
|
|
55
|
-
'[style.padding-bottom]': 'paddingBottom()'
|
|
29
|
+
'[style.aspect-ratio]': 'ratio() || null',
|
|
30
|
+
'[style.width]': '"100%"'
|
|
56
31
|
}
|
|
57
32
|
}]
|
|
58
33
|
}], propDecorators: { ratio: [{ type: i0.Input, args: [{ isSignal: true, alias: "ratio", required: false }] }] } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-aspect-ratio.mjs","sources":["../../../packages/primitives/aspect-ratio/src/aspect-ratio.directive.ts","../../../packages/primitives/aspect-ratio/radix-ng-primitives-aspect-ratio.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"radix-ng-primitives-aspect-ratio.mjs","sources":["../../../packages/primitives/aspect-ratio/src/aspect-ratio.directive.ts","../../../packages/primitives/aspect-ratio/radix-ng-primitives-aspect-ratio.ts"],"sourcesContent":["import { Directive, input, numberAttribute } from '@angular/core';\nimport { NumberInput } from '@radix-ng/primitives/core';\n\n/**\n * Maintains a fixed aspect ratio for its content using the native CSS `aspect-ratio` property.\n * Place the content inside (e.g. an `<img class=\"size-full object-cover\">`) and it fills the box.\n *\n * @group Components\n */\n@Directive({\n selector: '[rdxAspectRatio]',\n exportAs: 'rdxAspectRatio',\n host: {\n '[style.aspect-ratio]': 'ratio() || null',\n '[style.width]': '\"100%\"'\n }\n})\nexport class RdxAspectRatioDirective {\n /**\n * The desired aspect ratio (e.g. `16 / 9`). Defaults to `1` (a square, 1:1).\n *\n * @group Props\n * @defaultValue 1\n */\n readonly ratio = input<number, NumberInput>(1, { transform: numberAttribute });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAGA;;;;;AAKG;MASU,uBAAuB,CAAA;AARpC,IAAA,WAAA,GAAA;AASI;;;;;AAKG;QACM,IAAA,CAAA,KAAK,GAAG,KAAK,CAAsB,CAAC,6EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;AACjF,IAAA;8GARY,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAvB,uBAAuB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,oBAAA,EAAA,iBAAA,EAAA,aAAA,EAAA,UAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBARnC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,IAAI,EAAE;AACF,wBAAA,sBAAsB,EAAE,iBAAiB;AACzC,wBAAA,eAAe,EAAE;AACpB;AACJ,iBAAA;;;AChBD;;AAEG;;;;"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, inject, input, signal, Directive, PLATFORM_ID, output, NgModule } from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { createContext, watch } from '@radix-ng/primitives/core';
|
|
4
4
|
import { isPlatformBrowser } from '@angular/common';
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
function injectAvatarRootContext() {
|
|
8
|
-
return inject(AVATAR_ROOT_CONTEXT);
|
|
9
|
-
}
|
|
6
|
+
const [injectAvatarRootContext, provideAvatarRootContext] = createContext('AvatarRootContext', 'components/avatar');
|
|
10
7
|
|
|
11
8
|
const defaultAvatarConfig = {
|
|
12
9
|
delayMs: 0
|
|
@@ -84,6 +81,28 @@ class RdxAvatarImageDirective {
|
|
|
84
81
|
*/
|
|
85
82
|
this.src = input(/* @ts-ignore */
|
|
86
83
|
...(ngDevMode ? [undefined, { debugName: "src" }] : /* istanbul ignore next */ []));
|
|
84
|
+
/**
|
|
85
|
+
* A responsive `srcset` for the image. When set without `src`, an empty `src` no longer counts as
|
|
86
|
+
* an error.
|
|
87
|
+
*
|
|
88
|
+
* @group Props
|
|
89
|
+
*/
|
|
90
|
+
this.srcSet = input(/* @ts-ignore */
|
|
91
|
+
...(ngDevMode ? [undefined, { debugName: "srcSet" }] : /* istanbul ignore next */ []));
|
|
92
|
+
/**
|
|
93
|
+
* The `sizes` attribute paired with `srcSet`.
|
|
94
|
+
*
|
|
95
|
+
* @group Props
|
|
96
|
+
*/
|
|
97
|
+
this.sizes = input(/* @ts-ignore */
|
|
98
|
+
...(ngDevMode ? [undefined, { debugName: "sizes" }] : /* istanbul ignore next */ []));
|
|
99
|
+
/**
|
|
100
|
+
* The CORS mode used when fetching the image.
|
|
101
|
+
*
|
|
102
|
+
* @group Props
|
|
103
|
+
*/
|
|
104
|
+
this.crossOrigin = input(/* @ts-ignore */
|
|
105
|
+
...(ngDevMode ? [undefined, { debugName: "crossOrigin" }] : /* istanbul ignore next */ []));
|
|
87
106
|
this.referrerPolicy = input(/* @ts-ignore */
|
|
88
107
|
...(ngDevMode ? [undefined, { debugName: "referrerPolicy" }] : /* istanbul ignore next */ []));
|
|
89
108
|
/**
|
|
@@ -99,8 +118,8 @@ class RdxAvatarImageDirective {
|
|
|
99
118
|
if (!isPlatformBrowser(this.platformId)) {
|
|
100
119
|
return;
|
|
101
120
|
}
|
|
102
|
-
watch([this.src, this.referrerPolicy], ([src, referrer], onCleanup) => {
|
|
103
|
-
if (!src) {
|
|
121
|
+
watch([this.src, this.srcSet, this.sizes, this.crossOrigin, this.referrerPolicy], ([src, srcSet, sizes, crossOrigin, referrer], onCleanup) => {
|
|
122
|
+
if (!src && !srcSet) {
|
|
104
123
|
this.loadingStatus.set('error');
|
|
105
124
|
return;
|
|
106
125
|
}
|
|
@@ -108,11 +127,27 @@ class RdxAvatarImageDirective {
|
|
|
108
127
|
this.loadingStatus.set('loading');
|
|
109
128
|
image.onload = () => this.loadingStatus.set('loaded');
|
|
110
129
|
image.onerror = () => this.loadingStatus.set('error');
|
|
111
|
-
// Set
|
|
130
|
+
// Set the fetch-affecting attributes before `src`/`srcset` so they apply to the request.
|
|
112
131
|
if (referrer) {
|
|
113
132
|
image.referrerPolicy = referrer;
|
|
114
133
|
}
|
|
115
|
-
|
|
134
|
+
if (crossOrigin !== undefined) {
|
|
135
|
+
image.crossOrigin = crossOrigin;
|
|
136
|
+
}
|
|
137
|
+
if (srcSet) {
|
|
138
|
+
image.srcset = srcSet;
|
|
139
|
+
}
|
|
140
|
+
if (sizes) {
|
|
141
|
+
image.sizes = sizes;
|
|
142
|
+
}
|
|
143
|
+
if (src) {
|
|
144
|
+
image.src = src;
|
|
145
|
+
}
|
|
146
|
+
// A cached/already-decoded image is ready synchronously — resolve immediately so the
|
|
147
|
+
// fallback delay isn't started for an image that is already available.
|
|
148
|
+
if (image.complete && image.naturalWidth > 0) {
|
|
149
|
+
this.loadingStatus.set('loaded');
|
|
150
|
+
}
|
|
116
151
|
// Drop handlers for a stale src (or on destroy) so a late load/error
|
|
117
152
|
// can't overwrite the status for the current one.
|
|
118
153
|
onCleanup(() => {
|
|
@@ -121,14 +156,16 @@ class RdxAvatarImageDirective {
|
|
|
121
156
|
});
|
|
122
157
|
});
|
|
123
158
|
watch([this.loadingStatus], ([value]) => {
|
|
124
|
-
|
|
125
|
-
if (value
|
|
126
|
-
|
|
159
|
+
// Base UI fires the callback only once loading actually starts — skip the initial `idle`.
|
|
160
|
+
if (value === 'idle') {
|
|
161
|
+
return;
|
|
127
162
|
}
|
|
163
|
+
this.onLoadingStatusChange.emit(value);
|
|
164
|
+
this.rootContext.imageLoadingStatus.set(value);
|
|
128
165
|
});
|
|
129
166
|
}
|
|
130
167
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAvatarImageDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
131
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: RdxAvatarImageDirective, isStandalone: true, selector: "img[rdxAvatarImage]", inputs: { src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: false, transformFunction: null }, referrerPolicy: { classPropertyName: "referrerPolicy", publicName: "referrerPolicy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onLoadingStatusChange: "onLoadingStatusChange" }, host: {
|
|
168
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: RdxAvatarImageDirective, isStandalone: true, selector: "img[rdxAvatarImage]", inputs: { src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: false, transformFunction: null }, srcSet: { classPropertyName: "srcSet", publicName: "srcSet", isSignal: true, isRequired: false, transformFunction: null }, sizes: { classPropertyName: "sizes", publicName: "sizes", isSignal: true, isRequired: false, transformFunction: null }, crossOrigin: { classPropertyName: "crossOrigin", publicName: "crossOrigin", isSignal: true, isRequired: false, transformFunction: null }, referrerPolicy: { classPropertyName: "referrerPolicy", publicName: "referrerPolicy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onLoadingStatusChange: "onLoadingStatusChange" }, host: { properties: { "attr.src": "src()", "attr.srcset": "srcSet()", "attr.sizes": "sizes()", "attr.crossorigin": "crossOrigin()", "attr.referrerpolicy": "referrerPolicy()", "style.display": "(rootContext.imageLoadingStatus() === \"loaded\") ? null : \"none\"" } }, exportAs: ["rdxAvatarImage"], ngImport: i0 }); }
|
|
132
169
|
}
|
|
133
170
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAvatarImageDirective, decorators: [{
|
|
134
171
|
type: Directive,
|
|
@@ -136,28 +173,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
136
173
|
selector: 'img[rdxAvatarImage]',
|
|
137
174
|
exportAs: 'rdxAvatarImage',
|
|
138
175
|
host: {
|
|
139
|
-
role
|
|
176
|
+
// The host is a native `<img>` (selector `img[rdxAvatarImage]`) — its implicit `img` role is
|
|
177
|
+
// already correct, and forcing `role="img"` here would override any consumer override (Base UI
|
|
178
|
+
// adds no role).
|
|
140
179
|
'[attr.src]': 'src()',
|
|
180
|
+
'[attr.srcset]': 'srcSet()',
|
|
181
|
+
'[attr.sizes]': 'sizes()',
|
|
182
|
+
'[attr.crossorigin]': 'crossOrigin()',
|
|
141
183
|
'[attr.referrerpolicy]': 'referrerPolicy()',
|
|
142
184
|
'[style.display]': '(rootContext.imageLoadingStatus() === "loaded") ? null : "none"'
|
|
143
185
|
}
|
|
144
186
|
}]
|
|
145
|
-
}], ctorParameters: () => [], propDecorators: { src: [{ type: i0.Input, args: [{ isSignal: true, alias: "src", required: false }] }], referrerPolicy: [{ type: i0.Input, args: [{ isSignal: true, alias: "referrerPolicy", required: false }] }], onLoadingStatusChange: [{ type: i0.Output, args: ["onLoadingStatusChange"] }] } });
|
|
187
|
+
}], ctorParameters: () => [], propDecorators: { src: [{ type: i0.Input, args: [{ isSignal: true, alias: "src", required: false }] }], srcSet: [{ type: i0.Input, args: [{ isSignal: true, alias: "srcSet", required: false }] }], sizes: [{ type: i0.Input, args: [{ isSignal: true, alias: "sizes", required: false }] }], crossOrigin: [{ type: i0.Input, args: [{ isSignal: true, alias: "crossOrigin", required: false }] }], referrerPolicy: [{ type: i0.Input, args: [{ isSignal: true, alias: "referrerPolicy", required: false }] }], onLoadingStatusChange: [{ type: i0.Output, args: ["onLoadingStatusChange"] }] } });
|
|
146
188
|
|
|
189
|
+
const rootContext = () => {
|
|
190
|
+
const root = inject(RdxAvatarRootDirective);
|
|
191
|
+
return {
|
|
192
|
+
imageLoadingStatus: root.imageLoadingStatus
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* @group Components
|
|
197
|
+
*/
|
|
147
198
|
class RdxAvatarRootDirective {
|
|
148
199
|
constructor() {
|
|
149
200
|
this.imageLoadingStatus = signal('idle', /* @ts-ignore */
|
|
150
201
|
...(ngDevMode ? [{ debugName: "imageLoadingStatus" }] : /* istanbul ignore next */ []));
|
|
151
202
|
}
|
|
152
203
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAvatarRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
153
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.2", type: RdxAvatarRootDirective, isStandalone: true, selector: "span[rdxAvatarRoot]", providers: [
|
|
204
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.2", type: RdxAvatarRootDirective, isStandalone: true, selector: "span[rdxAvatarRoot]", providers: [provideAvatarRootContext(rootContext)], exportAs: ["rdxAvatarRoot"], ngImport: i0 }); }
|
|
154
205
|
}
|
|
155
206
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxAvatarRootDirective, decorators: [{
|
|
156
207
|
type: Directive,
|
|
157
208
|
args: [{
|
|
158
209
|
selector: 'span[rdxAvatarRoot]',
|
|
159
210
|
exportAs: 'rdxAvatarRoot',
|
|
160
|
-
providers: [
|
|
211
|
+
providers: [provideAvatarRootContext(rootContext)]
|
|
161
212
|
}]
|
|
162
213
|
}] });
|
|
163
214
|
|
|
@@ -179,5 +230,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
179
230
|
* Generated bundle index. Do not edit.
|
|
180
231
|
*/
|
|
181
232
|
|
|
182
|
-
export { RdxAvatarConfigToken, RdxAvatarFallbackDirective, RdxAvatarImageDirective, RdxAvatarModule, RdxAvatarRootDirective, defaultAvatarConfig, injectAvatarConfig, provideRdxAvatarConfig };
|
|
233
|
+
export { RdxAvatarConfigToken, RdxAvatarFallbackDirective, RdxAvatarImageDirective, RdxAvatarModule, RdxAvatarRootDirective, defaultAvatarConfig, injectAvatarConfig, injectAvatarRootContext, provideAvatarRootContext, provideRdxAvatarConfig };
|
|
183
234
|
//# sourceMappingURL=radix-ng-primitives-avatar.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-avatar.mjs","sources":["../../../packages/primitives/avatar/src/avatar-context.token.ts","../../../packages/primitives/avatar/src/avatar.config.ts","../../../packages/primitives/avatar/src/avatar-fallback.directive.ts","../../../packages/primitives/avatar/src/avatar-image.directive.ts","../../../packages/primitives/avatar/src/avatar-root.directive.ts","../../../packages/primitives/avatar/index.ts","../../../packages/primitives/avatar/radix-ng-primitives-avatar.ts"],"sourcesContent":["import { inject, InjectionToken, WritableSignal } from '@angular/core';\nimport { RdxImageLoadingStatus } from './types';\n\nexport interface AvatarContextToken {\n imageLoadingStatus: WritableSignal<RdxImageLoadingStatus>;\n}\n\nexport const AVATAR_ROOT_CONTEXT = new InjectionToken<AvatarContextToken>('AVATAR_ROOT_CONTEXT');\n\nexport function injectAvatarRootContext(): AvatarContextToken {\n return inject(AVATAR_ROOT_CONTEXT);\n}\n","import { inject, InjectionToken, Provider } from '@angular/core';\n\nexport interface RdxAvatarConfig {\n /**\n * Define a delay before the fallback is shown.\n * This is useful to only show the fallback for those with slower connections.\n * @default 0\n */\n delayMs: number;\n}\n\nexport const defaultAvatarConfig: RdxAvatarConfig = {\n delayMs: 0\n};\n\nexport const RdxAvatarConfigToken = new InjectionToken<RdxAvatarConfig>('RdxAvatarConfigToken');\n\nexport function provideRdxAvatarConfig(config: Partial<RdxAvatarConfig>): Provider[] {\n return [\n {\n provide: RdxAvatarConfigToken,\n useValue: { ...defaultAvatarConfig, ...config }\n }\n ];\n}\n\nexport function injectAvatarConfig(): RdxAvatarConfig {\n return inject(RdxAvatarConfigToken, { optional: true }) ?? defaultAvatarConfig;\n}\n","import { Directive, input, signal } from '@angular/core';\nimport { watch } from '@radix-ng/primitives/core';\nimport { injectAvatarRootContext } from './avatar-context.token';\nimport { injectAvatarConfig } from './avatar.config';\n\n/**\n * @group Components\n */\n@Directive({\n selector: 'span[rdxAvatarFallback]',\n exportAs: 'rdxAvatarFallback',\n host: {\n '[style.display]': 'canRender() && rootContext.imageLoadingStatus() !== \"loaded\" ? null : \"none\"'\n }\n})\nexport class RdxAvatarFallbackDirective {\n private readonly config = injectAvatarConfig();\n\n protected readonly rootContext = injectAvatarRootContext();\n\n /**\n * Useful for delaying rendering so it only appears for those with slower connections.\n *\n * @group Props\n * @defaultValue 0\n */\n readonly delayMs = input<number>(this.config.delayMs);\n\n protected readonly canRender = signal(false);\n\n constructor() {\n // Enable the fallback after an optional delay (so it only appears for\n // those on slower connections), independent of the image load status —\n // matches Radix/Base UI. The `display` binding then hides it once the\n // image has loaded.\n watch([this.delayMs], ([delayMs], onCleanup) => {\n this.canRender.set(false);\n\n if (delayMs) {\n const timeout = setTimeout(() => this.canRender.set(true), delayMs);\n // Cancel a pending delay if delayMs changes or the directive is\n // destroyed before it fires.\n onCleanup(() => clearTimeout(timeout));\n } else {\n this.canRender.set(true);\n }\n });\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport { Directive, inject, input, output, PLATFORM_ID, signal } from '@angular/core';\nimport { watch } from '@radix-ng/primitives/core';\nimport { injectAvatarRootContext } from './avatar-context.token';\nimport { HTMLAttributeReferrerPolicy, RdxImageLoadingStatus } from './types';\n\n/**\n * @group Components\n */\n@Directive({\n selector: 'img[rdxAvatarImage]',\n exportAs: 'rdxAvatarImage',\n host: {\n role: 'img',\n '[attr.src]': 'src()',\n '[attr.referrerpolicy]': 'referrerPolicy()',\n '[style.display]': '(rootContext.imageLoadingStatus() === \"loaded\") ? null : \"none\"'\n }\n})\nexport class RdxAvatarImageDirective {\n private readonly platformId = inject(PLATFORM_ID);\n\n protected readonly rootContext = injectAvatarRootContext();\n\n /**\n * @group Props\n */\n readonly src = input<string>();\n\n readonly referrerPolicy = input<HTMLAttributeReferrerPolicy>();\n\n /**\n * A callback providing information about the loading status of the image.\n * This is useful in case you want to control more precisely what to render as the image is loading.\n *\n * @group Emits\n */\n readonly onLoadingStatusChange = output<RdxImageLoadingStatus>();\n\n private readonly loadingStatus = signal<RdxImageLoadingStatus>('idle');\n\n constructor() {\n // Loading is browser-only; on the server the status stays 'idle'.\n if (!isPlatformBrowser(this.platformId)) {\n return;\n }\n\n watch([this.src, this.referrerPolicy], ([src, referrer], onCleanup) => {\n if (!src) {\n this.loadingStatus.set('error');\n return;\n }\n\n const image = new window.Image();\n this.loadingStatus.set('loading');\n image.onload = () => this.loadingStatus.set('loaded');\n image.onerror = () => this.loadingStatus.set('error');\n // Set referrerPolicy before src so it applies to the fetch.\n if (referrer) {\n image.referrerPolicy = referrer;\n }\n image.src = src;\n\n // Drop handlers for a stale src (or on destroy) so a late load/error\n // can't overwrite the status for the current one.\n onCleanup(() => {\n image.onload = null;\n image.onerror = null;\n });\n });\n\n watch([this.loadingStatus], ([value]) => {\n this.onLoadingStatusChange.emit(value);\n if (value !== 'idle') {\n this.rootContext.imageLoadingStatus.set(value);\n }\n });\n }\n}\n","import { Directive, signal } from '@angular/core';\nimport { provideToken } from '@radix-ng/primitives/core';\nimport { AVATAR_ROOT_CONTEXT, AvatarContextToken } from './avatar-context.token';\nimport { RdxImageLoadingStatus } from './types';\n\n@Directive({\n selector: 'span[rdxAvatarRoot]',\n exportAs: 'rdxAvatarRoot',\n providers: [provideToken(AVATAR_ROOT_CONTEXT, RdxAvatarRootDirective)]\n})\nexport class RdxAvatarRootDirective implements AvatarContextToken {\n readonly imageLoadingStatus = signal<RdxImageLoadingStatus>('idle');\n}\n","import { NgModule } from '@angular/core';\nimport { RdxAvatarFallbackDirective } from './src/avatar-fallback.directive';\nimport { RdxAvatarImageDirective } from './src/avatar-image.directive';\nimport { RdxAvatarRootDirective } from './src/avatar-root.directive';\n\nexport * from './src/avatar-fallback.directive';\nexport * from './src/avatar-image.directive';\nexport * from './src/avatar-root.directive';\nexport * from './src/avatar.config';\nexport type { RdxImageLoadingStatus } from './src/types';\n\nconst _imports = [RdxAvatarRootDirective, RdxAvatarFallbackDirective, RdxAvatarImageDirective];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxAvatarModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAOO,MAAM,mBAAmB,GAAG,IAAI,cAAc,CAAqB,qBAAqB,CAAC;SAEhF,uBAAuB,GAAA;AACnC,IAAA,OAAO,MAAM,CAAC,mBAAmB,CAAC;AACtC;;ACAO,MAAM,mBAAmB,GAAoB;AAChD,IAAA,OAAO,EAAE;;MAGA,oBAAoB,GAAG,IAAI,cAAc,CAAkB,sBAAsB;AAExF,SAAU,sBAAsB,CAAC,MAAgC,EAAA;IACnE,OAAO;AACH,QAAA;AACI,YAAA,OAAO,EAAE,oBAAoB;AAC7B,YAAA,QAAQ,EAAE,EAAE,GAAG,mBAAmB,EAAE,GAAG,MAAM;AAChD;KACJ;AACL;SAEgB,kBAAkB,GAAA;AAC9B,IAAA,OAAO,MAAM,CAAC,oBAAoB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,mBAAmB;AAClF;;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BAAsB,EAAE,0BAA0B,EAAE,uBAAuB,CAAC;MAMjF,eAAe,CAAA;8GAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAf,eAAe,EAAA,OAAA,EAAA,CANV,sBAAsB,EAAE,0BAA0B,EAAE,uBAAuB,CAAA,EAAA,OAAA,EAAA,CAA3E,sBAAsB,EAAE,0BAA0B,EAAE,uBAAuB,CAAA,EAAA,CAAA,CAAA;+GAMhF,eAAe,EAAA,CAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;AChBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"radix-ng-primitives-avatar.mjs","sources":["../../../packages/primitives/avatar/src/avatar-context.token.ts","../../../packages/primitives/avatar/src/avatar.config.ts","../../../packages/primitives/avatar/src/avatar-fallback.directive.ts","../../../packages/primitives/avatar/src/avatar-image.directive.ts","../../../packages/primitives/avatar/src/avatar-root.directive.ts","../../../packages/primitives/avatar/index.ts","../../../packages/primitives/avatar/radix-ng-primitives-avatar.ts"],"sourcesContent":["import { WritableSignal } from '@angular/core';\nimport { createContext } from '@radix-ng/primitives/core';\nimport { RdxImageLoadingStatus } from './types';\n\nexport interface AvatarRootContext {\n imageLoadingStatus: WritableSignal<RdxImageLoadingStatus>;\n}\n\nexport const [injectAvatarRootContext, provideAvatarRootContext] = createContext<AvatarRootContext>(\n 'AvatarRootContext',\n 'components/avatar'\n);\n","import { inject, InjectionToken, Provider } from '@angular/core';\n\nexport interface RdxAvatarConfig {\n /**\n * Define a delay before the fallback is shown.\n * This is useful to only show the fallback for those with slower connections.\n * @default 0\n */\n delayMs: number;\n}\n\nexport const defaultAvatarConfig: RdxAvatarConfig = {\n delayMs: 0\n};\n\nexport const RdxAvatarConfigToken = new InjectionToken<RdxAvatarConfig>('RdxAvatarConfigToken');\n\nexport function provideRdxAvatarConfig(config: Partial<RdxAvatarConfig>): Provider[] {\n return [\n {\n provide: RdxAvatarConfigToken,\n useValue: { ...defaultAvatarConfig, ...config }\n }\n ];\n}\n\nexport function injectAvatarConfig(): RdxAvatarConfig {\n return inject(RdxAvatarConfigToken, { optional: true }) ?? defaultAvatarConfig;\n}\n","import { Directive, input, signal } from '@angular/core';\nimport { watch } from '@radix-ng/primitives/core';\nimport { injectAvatarRootContext } from './avatar-context.token';\nimport { injectAvatarConfig } from './avatar.config';\n\n/**\n * @group Components\n */\n@Directive({\n selector: 'span[rdxAvatarFallback]',\n exportAs: 'rdxAvatarFallback',\n host: {\n '[style.display]': 'canRender() && rootContext.imageLoadingStatus() !== \"loaded\" ? null : \"none\"'\n }\n})\nexport class RdxAvatarFallbackDirective {\n private readonly config = injectAvatarConfig();\n\n protected readonly rootContext = injectAvatarRootContext();\n\n /**\n * Useful for delaying rendering so it only appears for those with slower connections.\n *\n * @group Props\n * @defaultValue 0\n */\n readonly delayMs = input<number>(this.config.delayMs);\n\n protected readonly canRender = signal(false);\n\n constructor() {\n // Enable the fallback after an optional delay (so it only appears for\n // those on slower connections), independent of the image load status —\n // matches Radix/Base UI. The `display` binding then hides it once the\n // image has loaded.\n watch([this.delayMs], ([delayMs], onCleanup) => {\n this.canRender.set(false);\n\n if (delayMs) {\n const timeout = setTimeout(() => this.canRender.set(true), delayMs);\n // Cancel a pending delay if delayMs changes or the directive is\n // destroyed before it fires.\n onCleanup(() => clearTimeout(timeout));\n } else {\n this.canRender.set(true);\n }\n });\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport { Directive, inject, input, output, PLATFORM_ID, signal } from '@angular/core';\nimport { watch } from '@radix-ng/primitives/core';\nimport { injectAvatarRootContext } from './avatar-context.token';\nimport { HTMLAttributeReferrerPolicy, RdxImageLoadingStatus } from './types';\n\n/**\n * @group Components\n */\n@Directive({\n selector: 'img[rdxAvatarImage]',\n exportAs: 'rdxAvatarImage',\n host: {\n // The host is a native `<img>` (selector `img[rdxAvatarImage]`) — its implicit `img` role is\n // already correct, and forcing `role=\"img\"` here would override any consumer override (Base UI\n // adds no role).\n '[attr.src]': 'src()',\n '[attr.srcset]': 'srcSet()',\n '[attr.sizes]': 'sizes()',\n '[attr.crossorigin]': 'crossOrigin()',\n '[attr.referrerpolicy]': 'referrerPolicy()',\n '[style.display]': '(rootContext.imageLoadingStatus() === \"loaded\") ? null : \"none\"'\n }\n})\nexport class RdxAvatarImageDirective {\n private readonly platformId = inject(PLATFORM_ID);\n\n protected readonly rootContext = injectAvatarRootContext();\n\n /**\n * @group Props\n */\n readonly src = input<string>();\n\n /**\n * A responsive `srcset` for the image. When set without `src`, an empty `src` no longer counts as\n * an error.\n *\n * @group Props\n */\n readonly srcSet = input<string>();\n\n /**\n * The `sizes` attribute paired with `srcSet`.\n *\n * @group Props\n */\n readonly sizes = input<string>();\n\n /**\n * The CORS mode used when fetching the image.\n *\n * @group Props\n */\n readonly crossOrigin = input<'anonymous' | 'use-credentials' | ''>();\n\n readonly referrerPolicy = input<HTMLAttributeReferrerPolicy>();\n\n /**\n * A callback providing information about the loading status of the image.\n * This is useful in case you want to control more precisely what to render as the image is loading.\n *\n * @group Emits\n */\n readonly onLoadingStatusChange = output<RdxImageLoadingStatus>();\n\n private readonly loadingStatus = signal<RdxImageLoadingStatus>('idle');\n\n constructor() {\n // Loading is browser-only; on the server the status stays 'idle'.\n if (!isPlatformBrowser(this.platformId)) {\n return;\n }\n\n watch(\n [this.src, this.srcSet, this.sizes, this.crossOrigin, this.referrerPolicy],\n ([src, srcSet, sizes, crossOrigin, referrer], onCleanup) => {\n if (!src && !srcSet) {\n this.loadingStatus.set('error');\n return;\n }\n\n const image = new window.Image();\n this.loadingStatus.set('loading');\n image.onload = () => this.loadingStatus.set('loaded');\n image.onerror = () => this.loadingStatus.set('error');\n // Set the fetch-affecting attributes before `src`/`srcset` so they apply to the request.\n if (referrer) {\n image.referrerPolicy = referrer;\n }\n if (crossOrigin !== undefined) {\n image.crossOrigin = crossOrigin;\n }\n if (srcSet) {\n image.srcset = srcSet;\n }\n if (sizes) {\n image.sizes = sizes;\n }\n if (src) {\n image.src = src;\n }\n\n // A cached/already-decoded image is ready synchronously — resolve immediately so the\n // fallback delay isn't started for an image that is already available.\n if (image.complete && image.naturalWidth > 0) {\n this.loadingStatus.set('loaded');\n }\n\n // Drop handlers for a stale src (or on destroy) so a late load/error\n // can't overwrite the status for the current one.\n onCleanup(() => {\n image.onload = null;\n image.onerror = null;\n });\n }\n );\n\n watch([this.loadingStatus], ([value]) => {\n // Base UI fires the callback only once loading actually starts — skip the initial `idle`.\n if (value === 'idle') {\n return;\n }\n this.onLoadingStatusChange.emit(value);\n this.rootContext.imageLoadingStatus.set(value);\n });\n }\n}\n","import { Directive, inject, signal } from '@angular/core';\nimport { AvatarRootContext, provideAvatarRootContext } from './avatar-context.token';\nimport { RdxImageLoadingStatus } from './types';\n\nconst rootContext = (): AvatarRootContext => {\n const root = inject(RdxAvatarRootDirective);\n return {\n imageLoadingStatus: root.imageLoadingStatus\n };\n};\n\n/**\n * @group Components\n */\n@Directive({\n selector: 'span[rdxAvatarRoot]',\n exportAs: 'rdxAvatarRoot',\n providers: [provideAvatarRootContext(rootContext)]\n})\nexport class RdxAvatarRootDirective {\n readonly imageLoadingStatus = signal<RdxImageLoadingStatus>('idle');\n}\n","import { NgModule } from '@angular/core';\nimport { RdxAvatarFallbackDirective } from './src/avatar-fallback.directive';\nimport { RdxAvatarImageDirective } from './src/avatar-image.directive';\nimport { RdxAvatarRootDirective } from './src/avatar-root.directive';\n\nexport * from './src/avatar-context.token';\nexport * from './src/avatar-fallback.directive';\nexport * from './src/avatar-image.directive';\nexport * from './src/avatar-root.directive';\nexport * from './src/avatar.config';\nexport type { HTMLAttributeReferrerPolicy, RdxImageLoadingStatus } from './src/types';\n\nconst _imports = [RdxAvatarRootDirective, RdxAvatarFallbackDirective, RdxAvatarImageDirective];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxAvatarModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAQO,MAAM,CAAC,uBAAuB,EAAE,wBAAwB,CAAC,GAAG,aAAa,CAC5E,mBAAmB,EACnB,mBAAmB;;ACChB,MAAM,mBAAmB,GAAoB;AAChD,IAAA,OAAO,EAAE;;MAGA,oBAAoB,GAAG,IAAI,cAAc,CAAkB,sBAAsB;AAExF,SAAU,sBAAsB,CAAC,MAAgC,EAAA;IACnE,OAAO;AACH,QAAA;AACI,YAAA,OAAO,EAAE,oBAAoB;AAC7B,YAAA,QAAQ,EAAE,EAAE,GAAG,mBAAmB,EAAE,GAAG,MAAM;AAChD;KACJ;AACL;SAEgB,kBAAkB,GAAA;AAC9B,IAAA,OAAO,MAAM,CAAC,oBAAoB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,mBAAmB;AAClF;;ACvBA;;AAEG;MAQU,0BAA0B,CAAA;AAenC,IAAA,WAAA,GAAA;QAdiB,IAAA,CAAA,MAAM,GAAG,kBAAkB,EAAE;QAE3B,IAAA,CAAA,WAAW,GAAG,uBAAuB,EAAE;AAE1D;;;;;AAKG;AACM,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAS,IAAI,CAAC,MAAM,CAAC,OAAO;oFAAC;QAElC,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,KAAK;sFAAC;;;;;AAOxC,QAAA,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,SAAS,KAAI;AAC3C,YAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;YAEzB,IAAI,OAAO,EAAE;AACT,gBAAA,MAAM,OAAO,GAAG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EAAA,CAA3E,sBAAsB,EAAE,0BAA0B,EAAE,uBAAuB,CAAA,EAAA,CAAA,CAAA;+GAMhF,eAAe,EAAA,CAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,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;;;;"}
|
|
@@ -268,13 +268,6 @@ class RdxCheckboxRootDirective {
|
|
|
268
268
|
this.uncheckedInputElement = null;
|
|
269
269
|
/** The group this checkbox belongs to, if it is rendered inside a `rdxCheckboxGroup`. */
|
|
270
270
|
this.group = injectCheckboxGroupContext(true);
|
|
271
|
-
/**
|
|
272
|
-
* @ignore
|
|
273
|
-
* Reflects the effective disabled state (CVA, covering reactive-forms `.disable()`, plus the
|
|
274
|
-
* group's disabled state), used for the `data-disabled` host attribute.
|
|
275
|
-
*/
|
|
276
|
-
this.isDisabled = computed(() => this.disabledState(), /* @ts-ignore */
|
|
277
|
-
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
278
271
|
/**
|
|
279
272
|
* The controlled checked state of the checkbox. Must be used in conjunction with onCheckedChange.
|
|
280
273
|
*
|
|
@@ -454,6 +447,9 @@ class RdxCheckboxRootDirective {
|
|
|
454
447
|
this.indeterminate.set(false);
|
|
455
448
|
this.checked.set(next);
|
|
456
449
|
this.controlValueAccessor.setValue(next);
|
|
450
|
+
// Mark the form control touched on user interaction so `touched`-gated validation shows
|
|
451
|
+
// (the visible control is the button, not the hidden input, so blur alone is unreliable).
|
|
452
|
+
this.controlValueAccessor.markAsTouched();
|
|
457
453
|
}
|
|
458
454
|
syncUncheckedInput() {
|
|
459
455
|
const name = this.name();
|
|
@@ -511,7 +507,7 @@ class RdxCheckboxRootDirective {
|
|
|
511
507
|
}
|
|
512
508
|
}
|
|
513
509
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxCheckboxRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
514
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: RdxCheckboxRootDirective, isStandalone: true, selector: "[rdxCheckboxRoot]", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, defaultChecked: { classPropertyName: "defaultChecked", publicName: "defaultChecked", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, submitValue: { classPropertyName: "submitValue", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, uncheckedValue: { classPropertyName: "uncheckedValue", publicName: "uncheckedValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, parent: { classPropertyName: "parent", publicName: "parent", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", indeterminate: "indeterminateChange", onCheckedChange: "onCheckedChange" }, host: { properties: { "attr.data-checked": "checkedState() && !indeterminateState() ? \"\" : undefined", "attr.data-unchecked": "!checkedState() && !indeterminateState() ? \"\" : undefined", "attr.data-indeterminate": "indeterminateState() ? \"\" : undefined", "attr.data-disabled": "
|
|
510
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: RdxCheckboxRootDirective, isStandalone: true, selector: "[rdxCheckboxRoot]", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, defaultChecked: { classPropertyName: "defaultChecked", publicName: "defaultChecked", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, submitValue: { classPropertyName: "submitValue", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, uncheckedValue: { classPropertyName: "uncheckedValue", publicName: "uncheckedValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, parent: { classPropertyName: "parent", publicName: "parent", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", indeterminate: "indeterminateChange", onCheckedChange: "onCheckedChange" }, host: { properties: { "attr.data-checked": "checkedState() && !indeterminateState() ? \"\" : undefined", "attr.data-unchecked": "!checkedState() && !indeterminateState() ? \"\" : undefined", "attr.data-indeterminate": "indeterminateState() ? \"\" : undefined", "attr.data-disabled": "disabledState() ? \"\" : undefined", "attr.data-readonly": "readOnlyState() ? \"\" : undefined", "attr.data-required": "required() ? \"\" : undefined" } }, providers: [provideCheckboxRootContext(rootContext)], hostDirectives: [{ directive: i1.RdxControlValueAccessor, inputs: ["value", "checked", "disabled", "disabled"] }], ngImport: i0 }); }
|
|
515
511
|
}
|
|
516
512
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxCheckboxRootDirective, decorators: [{
|
|
517
513
|
type: Directive,
|
|
@@ -528,7 +524,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
528
524
|
'[attr.data-checked]': 'checkedState() && !indeterminateState() ? "" : undefined',
|
|
529
525
|
'[attr.data-unchecked]': '!checkedState() && !indeterminateState() ? "" : undefined',
|
|
530
526
|
'[attr.data-indeterminate]': 'indeterminateState() ? "" : undefined',
|
|
531
|
-
'[attr.data-disabled]': '
|
|
527
|
+
'[attr.data-disabled]': 'disabledState() ? "" : undefined',
|
|
532
528
|
'[attr.data-readonly]': 'readOnlyState() ? "" : undefined',
|
|
533
529
|
'[attr.data-required]': 'required() ? "" : undefined'
|
|
534
530
|
}
|