@radix-ng/primitives 0.33.2 → 0.35.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/calendar/src/calendar-root.directive.d.ts +3 -3
- package/core/index.d.ts +1 -0
- package/core/src/accessor/provide-value-accessor.d.ts +1 -1
- package/core/src/date-time/index.d.ts +3 -0
- package/core/src/date-time/parser.d.ts +37 -0
- package/core/src/date-time/parts.d.ts +12 -0
- package/core/src/date-time/segment.d.ts +4 -0
- package/core/src/date-time/types.d.ts +18 -1
- package/core/src/date-time/useDateField.d.ts +141 -0
- package/core/src/date-time/utils.d.ts +3 -0
- package/core/src/provide-token.d.ts +22 -0
- package/date-field/README.md +1 -0
- package/date-field/index.d.ts +2 -0
- package/date-field/src/date-field-context.token.d.ts +18 -0
- package/date-field/src/date-field-input.directive.d.ts +53 -0
- package/date-field/src/date-field-root.directive.d.ts +126 -0
- package/dialog/src/dialog-ref.d.ts +3 -0
- package/dialog/src/dialog.config.d.ts +1 -0
- package/fesm2022/radix-ng-primitives-calendar.mjs +6 -15
- package/fesm2022/radix-ng-primitives-calendar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-checkbox.mjs +3 -4
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-core.mjs +1014 -8
- package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-date-field.mjs +320 -0
- package/fesm2022/radix-ng-primitives-date-field.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-dialog.mjs +54 -4
- package/fesm2022/radix-ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-navigation-menu.mjs +0 -2
- package/fesm2022/radix-ng-primitives-navigation-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-progress.mjs +3 -3
- package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-radio.mjs +7 -7
- package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-switch.mjs +7 -15
- package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tabs.mjs +3 -6
- package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle-group.mjs +8 -10
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle.mjs +5 -12
- package/fesm2022/radix-ng-primitives-toggle.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/switch/src/switch-root.directive.d.ts +0 -1
- package/toggle/src/toggle.directive.d.ts +0 -1
- package/tooltip/src/tooltip-root.directive.d.ts +4 -4
@@ -1,10 +1,10 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { InjectionToken, inject, input, booleanAttribute, computed, effect, Directive, model, output, signal
|
2
|
+
import { InjectionToken, inject, input, booleanAttribute, computed, effect, Directive, model, output, signal } from '@angular/core';
|
3
3
|
import * as i1 from '@radix-ng/primitives/roving-focus';
|
4
4
|
import { RdxRovingFocusItemDirective, RdxRovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';
|
5
5
|
import * as i2 from '@radix-ng/primitives/toggle';
|
6
6
|
import { RdxToggleDirective } from '@radix-ng/primitives/toggle';
|
7
|
-
import {
|
7
|
+
import { provideValueAccessor, provideToken } from '@radix-ng/primitives/core';
|
8
8
|
|
9
9
|
const RdxToggleGroupItemToken = new InjectionToken('RdxToggleGroupItemToken');
|
10
10
|
function injectToggleGroupItem() {
|
@@ -69,7 +69,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
69
69
|
args: [{
|
70
70
|
selector: '[rdxToggleGroupItem]',
|
71
71
|
exportAs: 'rdxToggleGroupItem',
|
72
|
-
standalone: true,
|
73
72
|
providers: [{ provide: RdxToggleGroupItemToken, useExisting: RdxToggleGroupItemDirective }],
|
74
73
|
hostDirectives: [
|
75
74
|
{
|
@@ -172,7 +171,7 @@ class RdxToggleGroupWithoutFocusDirective {
|
|
172
171
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxToggleGroupWithoutFocusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
173
172
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxToggleGroupWithoutFocusDirective, isStandalone: true, selector: "[rdxToggleGroupWithoutFocus]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", onValueChange: "onValueChange" }, host: { attributes: { "role": "group" }, listeners: { "focusout": "onTouched?.()" } }, providers: [
|
174
173
|
{ provide: RdxToggleGroupToken, useExisting: RdxToggleGroupWithoutFocusDirective },
|
175
|
-
|
174
|
+
provideValueAccessor(RdxToggleGroupWithoutFocusDirective)
|
176
175
|
], exportAs: ["rdxToggleGroupWithoutFocus"], ngImport: i0 }); }
|
177
176
|
}
|
178
177
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxToggleGroupWithoutFocusDirective, decorators: [{
|
@@ -180,10 +179,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
180
179
|
args: [{
|
181
180
|
selector: '[rdxToggleGroupWithoutFocus]',
|
182
181
|
exportAs: 'rdxToggleGroupWithoutFocus',
|
183
|
-
standalone: true,
|
184
182
|
providers: [
|
185
183
|
{ provide: RdxToggleGroupToken, useExisting: RdxToggleGroupWithoutFocusDirective },
|
186
|
-
|
184
|
+
provideValueAccessor(RdxToggleGroupWithoutFocusDirective)
|
187
185
|
],
|
188
186
|
host: {
|
189
187
|
role: 'group',
|
@@ -279,8 +277,8 @@ class RdxToggleGroupDirective {
|
|
279
277
|
}
|
280
278
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxToggleGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
281
279
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxToggleGroupDirective, isStandalone: true, selector: "[rdxToggleGroup]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", onValueChange: "onValueChange" }, host: { attributes: { "role": "group" }, listeners: { "focusout": "onTouched?.()" } }, providers: [
|
282
|
-
|
283
|
-
|
280
|
+
provideToken(RdxToggleGroupToken, RdxToggleGroupDirective),
|
281
|
+
provideValueAccessor(RdxToggleGroupDirective)
|
284
282
|
], exportAs: ["rdxToggleGroup"], hostDirectives: [{ directive: i1.RdxRovingFocusGroupDirective, inputs: ["dir", "dir", "orientation", "orientation", "loop", "loop"] }], ngImport: i0 }); }
|
285
283
|
}
|
286
284
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxToggleGroupDirective, decorators: [{
|
@@ -289,8 +287,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
289
287
|
selector: '[rdxToggleGroup]',
|
290
288
|
exportAs: 'rdxToggleGroup',
|
291
289
|
providers: [
|
292
|
-
|
293
|
-
|
290
|
+
provideToken(RdxToggleGroupToken, RdxToggleGroupDirective),
|
291
|
+
provideValueAccessor(RdxToggleGroupDirective)
|
294
292
|
],
|
295
293
|
hostDirectives: [{ directive: RdxRovingFocusGroupDirective, inputs: ['dir', 'orientation', 'loop'] }],
|
296
294
|
host: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-toggle-group.mjs","sources":["../../../packages/primitives/toggle-group/src/toggle-group-item.token.ts","../../../packages/primitives/toggle-group/src/toggle-group.token.ts","../../../packages/primitives/toggle-group/src/toggle-group-item.directive.ts","../../../packages/primitives/toggle-group/src/toggle-group-without-focus.directive.ts","../../../packages/primitives/toggle-group/src/toggle-group.directive.ts","../../../packages/primitives/toggle-group/radix-ng-primitives-toggle-group.ts"],"sourcesContent":["import { inject, InjectionToken } from '@angular/core';\nimport type { RdxToggleGroupItemDirective } from './toggle-group-item.directive';\n\nexport const RdxToggleGroupItemToken = new InjectionToken<RdxToggleGroupItemDirective>('RdxToggleGroupItemToken');\n\nexport function injectToggleGroupItem(): RdxToggleGroupItemDirective {\n return inject(RdxToggleGroupItemToken);\n}\n","import { inject, InjectionToken } from '@angular/core';\n\nexport interface IRdxToggleGroup {\n toggle(value: string): void;\n\n disabled: any;\n value: any;\n type: any;\n}\n\nexport const RdxToggleGroupToken = new InjectionToken<IRdxToggleGroup>('RdxToggleGroupToken');\n\nexport function injectToggleGroup(): IRdxToggleGroup {\n return inject(RdxToggleGroupToken);\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, effect, inject, input } from '@angular/core';\nimport { RdxRovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';\nimport { RdxToggleDirective } from '@radix-ng/primitives/toggle';\nimport { RdxToggleGroupItemToken } from './toggle-group-item.token';\nimport { injectToggleGroup } from './toggle-group.token';\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxToggleGroupItem]',\n exportAs: 'rdxToggleGroupItem',\n standalone: true,\n providers: [{ provide: RdxToggleGroupItemToken, useExisting: RdxToggleGroupItemDirective }],\n hostDirectives: [\n {\n directive: RdxRovingFocusItemDirective,\n inputs: ['focusable', 'active', 'allowShiftKey']\n },\n {\n directive: RdxToggleDirective,\n inputs: ['pressed', 'disabled']\n }\n ],\n host: {\n '(click)': 'toggle()'\n }\n})\nexport class RdxToggleGroupItemDirective {\n private readonly rdxToggleDirective = inject(RdxToggleDirective);\n\n private readonly rdxRovingFocusItemDirective = inject(RdxRovingFocusItemDirective);\n\n /**\n * Access the toggle group.\n * @ignore\n */\n protected readonly rootContext = injectToggleGroup();\n\n /**\n * The value of this toggle button.\n *\n * @group Props\n */\n readonly value = input.required<string>();\n\n /**\n * Whether this toggle button is disabled.\n * @defaultValue false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n private readonly isPressed = computed(() => {\n return this.rootContext.type() === 'single'\n ? this.rootContext.value() === this.value()\n : this.rootContext.value()?.includes(this.value());\n });\n\n private readonly isDisabled = computed(() => this.rootContext.disabled() || this.disabled());\n\n constructor() {\n effect(() => {\n this.rdxToggleDirective.pressed.set(!!this.isPressed());\n this.rdxToggleDirective.disabledModel.set(this.isDisabled());\n\n this.rdxRovingFocusItemDirective.active = !!this.isPressed();\n });\n }\n\n /**\n * @ignore\n */\n toggle(): void {\n if (this.disabled()) {\n return;\n }\n\n this.rootContext.toggle(this.value());\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, model, output, signal } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { RdxToggleGroupToken } from './toggle-group.token';\n\nlet nextId = 0;\n\n@Directive({\n selector: '[rdxToggleGroupWithoutFocus]',\n exportAs: 'rdxToggleGroupWithoutFocus',\n standalone: true,\n providers: [\n { provide: RdxToggleGroupToken, useExisting: RdxToggleGroupWithoutFocusDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: RdxToggleGroupWithoutFocusDirective, multi: true }\n ],\n host: {\n role: 'group',\n '(focusout)': 'onTouched?.()'\n }\n})\nexport class RdxToggleGroupWithoutFocusDirective implements ControlValueAccessor {\n /**\n * @ignore\n */\n readonly id: string = `rdx-toggle-group-${nextId++}`;\n\n /**\n * @group Props\n */\n readonly value = model<string | string[] | undefined>(undefined);\n\n /**\n * @group Props\n */\n readonly type = input<'single' | 'multiple'>('single');\n\n /**\n * Whether the toggle group is disabled.\n * @defaultValue false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Event emitted when the selected toggle button changes.\n * @group Emits\n */\n readonly onValueChange = output<string[] | string | undefined>();\n\n /**\n * The value change callback.\n */\n private onChange?: (value: string | string[] | undefined) => void;\n\n /**\n * onTouch function registered via registerOnTouch (ControlValueAccessor).\n */\n protected onTouched?: () => void;\n\n /**\n * Toggle a value.\n * @param value The value to toggle.\n * @ignore\n */\n toggle(value: string): void {\n if (this.disabled()) {\n return;\n }\n\n if (this.type() === 'single') {\n this.value.set(value);\n } else {\n this.value.set(\n ((currentValue) =>\n currentValue && Array.isArray(currentValue)\n ? currentValue.includes(value)\n ? currentValue.filter((v) => v !== value) // delete\n : [...currentValue, value] // update\n : [value])(this.value())\n );\n }\n\n this.onValueChange.emit(this.value());\n this.onChange?.(this.value());\n }\n\n /**\n * Select a value from Angular forms.\n * @param value The value to select.\n * @ignore\n */\n writeValue(value: string): void {\n this.value.set(value);\n }\n\n /**\n * Register a callback to be called when the value changes.\n * @param fn The callback to register.\n * @ignore\n */\n registerOnChange(fn: (value: string | string[] | undefined) => void): void {\n this.onChange = fn;\n }\n\n /**\n * Register a callback to be called when the toggle group is touched.\n * @param fn The callback to register.\n * @ignore\n */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n private readonly accessorDisabled = signal(false);\n\n /**\n * Set the disabled state of the toggle group.\n * @param isDisabled Whether the toggle group is disabled.\n * @ignore\n */\n setDisabledState(isDisabled: boolean): void {\n this.accessorDisabled.set(isDisabled);\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, forwardRef, input, model, output, signal } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { RdxRovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';\nimport { RdxToggleGroupToken } from './toggle-group.token';\n\nlet nextId = 0;\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxToggleGroup]',\n exportAs: 'rdxToggleGroup',\n providers: [\n { provide: RdxToggleGroupToken, useExisting: forwardRef(() => RdxToggleGroupDirective) },\n { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => RdxToggleGroupDirective), multi: true }\n ],\n hostDirectives: [{ directive: RdxRovingFocusGroupDirective, inputs: ['dir', 'orientation', 'loop'] }],\n host: {\n role: 'group',\n\n '(focusout)': 'onTouched?.()'\n }\n})\nexport class RdxToggleGroupDirective implements ControlValueAccessor {\n /**\n * @ignore\n */\n readonly id: string = `rdx-toggle-group-${nextId++}`;\n\n /**\n * @group Props\n */\n readonly value = model<string | string[] | undefined>(undefined);\n\n /**\n * @group Props\n */\n readonly type = input<'single' | 'multiple'>('single');\n\n /**\n * Whether the toggle group is disabled.\n * @defaultValue false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Event emitted when the selected toggle button changes.\n * @group Emits\n */\n readonly onValueChange = output<string[] | string | undefined>();\n\n /**\n * The value change callback.\n */\n private onChange?: (value: string | string[] | undefined) => void;\n\n /**\n * onTouch function registered via registerOnTouch (ControlValueAccessor).\n */\n protected onTouched?: () => void;\n\n /**\n * Toggle a value.\n * @param value The value to toggle.\n * @ignore\n */\n toggle(value: string): void {\n if (this.disabled()) {\n return;\n }\n\n if (this.type() === 'single') {\n this.value.set(value);\n } else {\n this.value.set(\n ((currentValue) =>\n currentValue && Array.isArray(currentValue)\n ? currentValue.includes(value)\n ? currentValue.filter((v) => v !== value) // delete\n : [...currentValue, value] // update\n : [value])(this.value())\n );\n }\n\n this.onValueChange.emit(this.value());\n this.onChange?.(this.value());\n }\n\n /**\n * Select a value from Angular forms.\n * @param value The value to select.\n * @ignore\n */\n writeValue(value: string): void {\n this.value.set(value);\n }\n\n /**\n * Register a callback to be called when the value changes.\n * @param fn The callback to register.\n * @ignore\n */\n registerOnChange(fn: (value: string | string[] | undefined) => void): void {\n this.onChange = fn;\n }\n\n /**\n * Register a callback to be called when the toggle group is touched.\n * @param fn The callback to register.\n * @ignore\n */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n private readonly accessorDisabled = signal(false);\n /**\n * Set the disabled state of the toggle group.\n * @param isDisabled Whether the toggle group is disabled.\n * @ignore\n */\n setDisabledState(isDisabled: boolean): void {\n this.accessorDisabled.set(isDisabled);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["nextId"],"mappings":";;;;;;;;MAGa,uBAAuB,GAAG,IAAI,cAAc,CAA8B,yBAAyB;SAEhG,qBAAqB,GAAA;AACjC,IAAA,OAAO,MAAM,CAAC,uBAAuB,CAAC;AAC1C;;MCGa,mBAAmB,GAAG,IAAI,cAAc,CAAkB,qBAAqB;SAE5E,iBAAiB,GAAA;AAC7B,IAAA,OAAO,MAAM,CAAC,mBAAmB,CAAC;AACtC;;ACPA;;AAEG;MAoBU,2BAA2B,CAAA;AAiCpC,IAAA,WAAA,GAAA;AAhCiB,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;AAE/C,QAAA,IAAA,CAAA,2BAA2B,GAAG,MAAM,CAAC,2BAA2B,CAAC;AAElF;;;AAGG;QACgB,IAAW,CAAA,WAAA,GAAG,iBAAiB,EAAE;AAEpD;;;;AAIG;AACM,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAU;AAEzC;;;;AAIG;QACM,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAwB,KAAK,EAAE,EAAE,SAAS,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ages/primitives/toggle-group/src/toggle-group-item.token.ts","../../../packages/primitives/toggle-group/src/toggle-group.token.ts","../../../packages/primitives/toggle-group/src/toggle-group-item.directive.ts","../../../packages/primitives/toggle-group/src/toggle-group-without-focus.directive.ts","../../../packages/primitives/toggle-group/src/toggle-group.directive.ts","../../../packages/primitives/toggle-group/radix-ng-primitives-toggle-group.ts"],"sourcesContent":["import { inject, InjectionToken } from '@angular/core';\nimport type { RdxToggleGroupItemDirective } from './toggle-group-item.directive';\n\nexport const RdxToggleGroupItemToken = new InjectionToken<RdxToggleGroupItemDirective>('RdxToggleGroupItemToken');\n\nexport function injectToggleGroupItem(): RdxToggleGroupItemDirective {\n return inject(RdxToggleGroupItemToken);\n}\n","import { inject, InjectionToken } from '@angular/core';\n\nexport interface IRdxToggleGroup {\n toggle(value: string): void;\n disabled: any;\n value: any;\n type: any;\n}\n\nexport const RdxToggleGroupToken = new InjectionToken<IRdxToggleGroup>('RdxToggleGroupToken');\n\nexport function injectToggleGroup(): IRdxToggleGroup {\n return inject(RdxToggleGroupToken);\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, effect, inject, input } from '@angular/core';\nimport { RdxRovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';\nimport { RdxToggleDirective } from '@radix-ng/primitives/toggle';\nimport { RdxToggleGroupItemToken } from './toggle-group-item.token';\nimport { injectToggleGroup } from './toggle-group.token';\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxToggleGroupItem]',\n exportAs: 'rdxToggleGroupItem',\n providers: [{ provide: RdxToggleGroupItemToken, useExisting: RdxToggleGroupItemDirective }],\n hostDirectives: [\n {\n directive: RdxRovingFocusItemDirective,\n inputs: ['focusable', 'active', 'allowShiftKey']\n },\n {\n directive: RdxToggleDirective,\n inputs: ['pressed', 'disabled']\n }\n ],\n host: {\n '(click)': 'toggle()'\n }\n})\nexport class RdxToggleGroupItemDirective {\n private readonly rdxToggleDirective = inject(RdxToggleDirective);\n\n private readonly rdxRovingFocusItemDirective = inject(RdxRovingFocusItemDirective);\n\n /**\n * Access the toggle group.\n * @ignore\n */\n protected readonly rootContext = injectToggleGroup();\n\n /**\n * The value of this toggle button.\n *\n * @group Props\n */\n readonly value = input.required<string>();\n\n /**\n * Whether this toggle button is disabled.\n * @defaultValue false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n private readonly isPressed = computed(() => {\n return this.rootContext.type() === 'single'\n ? this.rootContext.value() === this.value()\n : this.rootContext.value()?.includes(this.value());\n });\n\n private readonly isDisabled = computed(() => this.rootContext.disabled() || this.disabled());\n\n constructor() {\n effect(() => {\n this.rdxToggleDirective.pressed.set(!!this.isPressed());\n this.rdxToggleDirective.disabledModel.set(this.isDisabled());\n\n this.rdxRovingFocusItemDirective.active = !!this.isPressed();\n });\n }\n\n /**\n * @ignore\n */\n toggle(): void {\n if (this.disabled()) {\n return;\n }\n\n this.rootContext.toggle(this.value());\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, model, output, signal } from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { provideValueAccessor } from '@radix-ng/primitives/core';\nimport { RdxToggleGroupToken } from './toggle-group.token';\n\nlet nextId = 0;\n\n@Directive({\n selector: '[rdxToggleGroupWithoutFocus]',\n exportAs: 'rdxToggleGroupWithoutFocus',\n providers: [\n { provide: RdxToggleGroupToken, useExisting: RdxToggleGroupWithoutFocusDirective },\n provideValueAccessor(RdxToggleGroupWithoutFocusDirective)],\n host: {\n role: 'group',\n '(focusout)': 'onTouched?.()'\n }\n})\nexport class RdxToggleGroupWithoutFocusDirective implements ControlValueAccessor {\n /**\n * @ignore\n */\n readonly id: string = `rdx-toggle-group-${nextId++}`;\n\n /**\n * @group Props\n */\n readonly value = model<string | string[] | undefined>(undefined);\n\n /**\n * @group Props\n */\n readonly type = input<'single' | 'multiple'>('single');\n\n /**\n * Whether the toggle group is disabled.\n * @defaultValue false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Event emitted when the selected toggle button changes.\n * @group Emits\n */\n readonly onValueChange = output<string[] | string | undefined>();\n\n /**\n * The value change callback.\n */\n private onChange?: (value: string | string[] | undefined) => void;\n\n /**\n * onTouch function registered via registerOnTouch (ControlValueAccessor).\n */\n protected onTouched?: () => void;\n\n /**\n * Toggle a value.\n * @param value The value to toggle.\n * @ignore\n */\n toggle(value: string): void {\n if (this.disabled()) {\n return;\n }\n\n if (this.type() === 'single') {\n this.value.set(value);\n } else {\n this.value.set(\n ((currentValue) =>\n currentValue && Array.isArray(currentValue)\n ? currentValue.includes(value)\n ? currentValue.filter((v) => v !== value) // delete\n : [...currentValue, value] // update\n : [value])(this.value())\n );\n }\n\n this.onValueChange.emit(this.value());\n this.onChange?.(this.value());\n }\n\n /**\n * Select a value from Angular forms.\n * @param value The value to select.\n * @ignore\n */\n writeValue(value: string): void {\n this.value.set(value);\n }\n\n /**\n * Register a callback to be called when the value changes.\n * @param fn The callback to register.\n * @ignore\n */\n registerOnChange(fn: (value: string | string[] | undefined) => void): void {\n this.onChange = fn;\n }\n\n /**\n * Register a callback to be called when the toggle group is touched.\n * @param fn The callback to register.\n * @ignore\n */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n private readonly accessorDisabled = signal(false);\n\n /**\n * Set the disabled state of the toggle group.\n * @param isDisabled Whether the toggle group is disabled.\n * @ignore\n */\n setDisabledState(isDisabled: boolean): void {\n this.accessorDisabled.set(isDisabled);\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, model, output, signal } from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { provideToken, provideValueAccessor } from '@radix-ng/primitives/core';\nimport { RdxRovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';\nimport { RdxToggleGroupToken } from './toggle-group.token';\n\nlet nextId = 0;\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxToggleGroup]',\n exportAs: 'rdxToggleGroup',\n providers: [\n provideToken(RdxToggleGroupToken, RdxToggleGroupDirective),\n provideValueAccessor(RdxToggleGroupDirective)],\n hostDirectives: [{ directive: RdxRovingFocusGroupDirective, inputs: ['dir', 'orientation', 'loop'] }],\n host: {\n role: 'group',\n\n '(focusout)': 'onTouched?.()'\n }\n})\nexport class RdxToggleGroupDirective implements ControlValueAccessor {\n /**\n * @ignore\n */\n readonly id: string = `rdx-toggle-group-${nextId++}`;\n\n /**\n * @group Props\n */\n readonly value = model<string | string[] | undefined>(undefined);\n\n /**\n * @group Props\n */\n readonly type = input<'single' | 'multiple'>('single');\n\n /**\n * Whether the toggle group is disabled.\n * @defaultValue false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Event emitted when the selected toggle button changes.\n * @group Emits\n */\n readonly onValueChange = output<string[] | string | undefined>();\n\n /**\n * The value change callback.\n */\n private onChange?: (value: string | string[] | undefined) => void;\n\n /**\n * onTouch function registered via registerOnTouch (ControlValueAccessor).\n */\n protected onTouched?: () => void;\n\n /**\n * Toggle a value.\n * @param value The value to toggle.\n * @ignore\n */\n toggle(value: string): void {\n if (this.disabled()) {\n return;\n }\n\n if (this.type() === 'single') {\n this.value.set(value);\n } else {\n this.value.set(\n ((currentValue) =>\n currentValue && Array.isArray(currentValue)\n ? currentValue.includes(value)\n ? currentValue.filter((v) => v !== value) // delete\n : [...currentValue, value] // update\n : [value])(this.value())\n );\n }\n\n this.onValueChange.emit(this.value());\n this.onChange?.(this.value());\n }\n\n /**\n * Select a value from Angular forms.\n * @param value The value to select.\n * @ignore\n */\n writeValue(value: string): void {\n this.value.set(value);\n }\n\n /**\n * Register a callback to be called when the value changes.\n * @param fn The callback to register.\n * @ignore\n */\n registerOnChange(fn: (value: string | string[] | undefined) => void): void {\n this.onChange = fn;\n }\n\n /**\n * Register a callback to be called when the toggle group is touched.\n * @param fn The callback to register.\n * @ignore\n */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n private readonly accessorDisabled = signal(false);\n /**\n * Set the disabled state of the toggle group.\n * @param isDisabled Whether the toggle group is disabled.\n * @ignore\n */\n setDisabledState(isDisabled: boolean): void {\n this.accessorDisabled.set(isDisabled);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["nextId"],"mappings":";;;;;;;;MAGa,uBAAuB,GAAG,IAAI,cAAc,CAA8B,yBAAyB;SAEhG,qBAAqB,GAAA;AACjC,IAAA,OAAO,MAAM,CAAC,uBAAuB,CAAC;AAC1C;;MCEa,mBAAmB,GAAG,IAAI,cAAc,CAAkB,qBAAqB;SAE5E,iBAAiB,GAAA;AAC7B,IAAA,OAAO,MAAM,CAAC,mBAAmB,CAAC;AACtC;;ACNA;;AAEG;MAmBU,2BAA2B,CAAA;AAiCpC,IAAA,WAAA,GAAA;AAhCiB,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;AAE/C,QAAA,IAAA,CAAA,2BAA2B,GAAG,MAAM,CAAC,2BAA2B,CAAC;AAElF;;;AAGG;QACgB,IAAW,CAAA,WAAA,GAAG,iBAAiB,EAAE;AAEpD;;;;AAIG;AACM,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAU;AAEzC;;;;AAIG;QACM,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAwB,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;AAEvE,QAAA,IAAA,CAAA,SAAS,GAAG,QAAQ,CAAC,MAAK;AACvC,YAAA,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK;kBAC7B,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,IAAI,CAAC,KAAK;AACzC,kBAAE,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC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SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,SAAS,EAAE;wBACP,YAAY,CAAC,mBAAmB,EAA0B,uBAAA,CAAA;AAC1D,wBAAA,oBAAoB,CAAyB,uBAAA;AAAC,qBAAA;AAClD,oBAAA,cAAc,EAAE,CAAC,EAAE,SAAS,EAAE,4BAA4B,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC;AACrG,oBAAA,IAAI,EAAE;AACF,wBAAA,IAAI,EAAE,OAAO;AAEb,wBAAA,YAAY,EAAE;AACjB;AACJ,iBAAA;;;ACxBD;;AAEG;;;;"}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { Directive,
|
2
|
+
import { Directive, input, booleanAttribute, model, computed, output, signal } from '@angular/core';
|
3
3
|
import * as i1 from '@radix-ng/primitives/visually-hidden';
|
4
4
|
import { RdxVisuallyHiddenInputDirective } from '@radix-ng/primitives/visually-hidden';
|
5
|
-
import {
|
5
|
+
import { provideValueAccessor } from '@radix-ng/primitives/core';
|
6
6
|
|
7
7
|
class RdxToggleVisuallyHiddenInputDirective {
|
8
8
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxToggleVisuallyHiddenInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
@@ -13,7 +13,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
13
13
|
args: [{
|
14
14
|
selector: 'input[rdxToggleVisuallyHiddenInput]',
|
15
15
|
exportAs: 'rdxToggleVisuallyHiddenInput',
|
16
|
-
standalone: true,
|
17
16
|
hostDirectives: [
|
18
17
|
{
|
19
18
|
directive: RdxVisuallyHiddenInputDirective,
|
@@ -31,11 +30,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
31
30
|
}]
|
32
31
|
}] });
|
33
32
|
|
34
|
-
const TOGGLE_VALUE_ACCESSOR = {
|
35
|
-
provide: NG_VALUE_ACCESSOR,
|
36
|
-
useExisting: forwardRef(() => RdxToggleDirective),
|
37
|
-
multi: true
|
38
|
-
};
|
39
33
|
/**
|
40
34
|
* @group Components
|
41
35
|
*/
|
@@ -101,15 +95,14 @@ class RdxToggleDirective {
|
|
101
95
|
this.accessorDisabled.set(isDisabled);
|
102
96
|
}
|
103
97
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxToggleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
104
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxToggleDirective, isStandalone: true, selector: "[rdxToggle]", inputs: { defaultPressed: { classPropertyName: "defaultPressed", publicName: "defaultPressed", isSignal: true, isRequired: false, transformFunction: null }, pressed: { classPropertyName: "pressed", publicName: "pressed", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disabledModel: { classPropertyName: "disabledModel", publicName: "disabledModel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pressed: "pressedChange", disabledModel: "disabledModelChange", onPressedChange: "onPressedChange" }, host: { listeners: { "click": "togglePressed()" }, properties: { "attr.aria-pressed": "pressed()", "attr.data-state": "dataState()", "attr.data-disabled": "disabledState() ? \"\" : undefined", "disabled": "disabledState()" } }, providers: [
|
98
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxToggleDirective, isStandalone: true, selector: "[rdxToggle]", inputs: { defaultPressed: { classPropertyName: "defaultPressed", publicName: "defaultPressed", isSignal: true, isRequired: false, transformFunction: null }, pressed: { classPropertyName: "pressed", publicName: "pressed", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disabledModel: { classPropertyName: "disabledModel", publicName: "disabledModel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pressed: "pressedChange", disabledModel: "disabledModelChange", onPressedChange: "onPressedChange" }, host: { listeners: { "click": "togglePressed()" }, properties: { "attr.aria-pressed": "pressed()", "attr.data-state": "dataState()", "attr.data-disabled": "disabledState() ? \"\" : undefined", "disabled": "disabledState()" } }, providers: [provideValueAccessor(RdxToggleDirective)], exportAs: ["rdxToggle"], ngImport: i0 }); }
|
105
99
|
}
|
106
100
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxToggleDirective, decorators: [{
|
107
101
|
type: Directive,
|
108
102
|
args: [{
|
109
103
|
selector: '[rdxToggle]',
|
110
104
|
exportAs: 'rdxToggle',
|
111
|
-
|
112
|
-
providers: [TOGGLE_VALUE_ACCESSOR],
|
105
|
+
providers: [provideValueAccessor(RdxToggleDirective)],
|
113
106
|
host: {
|
114
107
|
'[attr.aria-pressed]': 'pressed()',
|
115
108
|
'[attr.data-state]': 'dataState()',
|
@@ -124,5 +117,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
124
117
|
* Generated bundle index. Do not edit.
|
125
118
|
*/
|
126
119
|
|
127
|
-
export { RdxToggleDirective, RdxToggleVisuallyHiddenInputDirective
|
120
|
+
export { RdxToggleDirective, RdxToggleVisuallyHiddenInputDirective };
|
128
121
|
//# sourceMappingURL=radix-ng-primitives-toggle.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-toggle.mjs","sources":["../../../packages/primitives/toggle/src/toggle-visually-hidden-input.directive.ts","../../../packages/primitives/toggle/src/toggle.directive.ts","../../../packages/primitives/toggle/radix-ng-primitives-toggle.ts"],"sourcesContent":["import { Directive } from '@angular/core';\nimport { RdxVisuallyHiddenInputDirective } from '@radix-ng/primitives/visually-hidden';\n\n@Directive({\n selector: 'input[rdxToggleVisuallyHiddenInput]',\n exportAs: 'rdxToggleVisuallyHiddenInput',\n
|
1
|
+
{"version":3,"file":"radix-ng-primitives-toggle.mjs","sources":["../../../packages/primitives/toggle/src/toggle-visually-hidden-input.directive.ts","../../../packages/primitives/toggle/src/toggle.directive.ts","../../../packages/primitives/toggle/radix-ng-primitives-toggle.ts"],"sourcesContent":["import { Directive } from '@angular/core';\nimport { RdxVisuallyHiddenInputDirective } from '@radix-ng/primitives/visually-hidden';\n\n@Directive({\n selector: 'input[rdxToggleVisuallyHiddenInput]',\n exportAs: 'rdxToggleVisuallyHiddenInput',\n hostDirectives: [\n {\n directive: RdxVisuallyHiddenInputDirective,\n inputs: [\n 'name',\n 'required',\n 'value',\n 'disabled'\n ]\n }\n ],\n host: {\n type: 'checkbox'\n }\n})\nexport class RdxToggleVisuallyHiddenInputDirective {}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, input, model, output, OutputEmitterRef, signal } from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { provideValueAccessor } from '@radix-ng/primitives/core';\n\nexport interface ToggleProps {\n /**\n * The controlled state of the toggle.\n */\n pressed?: boolean;\n\n /**\n * The state of the toggle when initially rendered. Use `defaultPressed`\n * if you do not need to control the state of the toggle.\n * @defaultValue false\n */\n defaultPressed?: boolean;\n\n /**\n * The callback that fires when the state of the toggle changes.\n */\n onPressedChange?: OutputEmitterRef<boolean>;\n\n /**\n * Whether the toggle is disabled.\n * @defaultValue false\n */\n disabled?: boolean;\n}\n\nexport type DataState = 'on' | 'off';\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxToggle]',\n exportAs: 'rdxToggle',\n providers: [provideValueAccessor(RdxToggleDirective)],\n host: {\n '[attr.aria-pressed]': 'pressed()',\n '[attr.data-state]': 'dataState()',\n '[attr.data-disabled]': 'disabledState() ? \"\" : undefined',\n '[disabled]': 'disabledState()',\n\n '(click)': 'togglePressed()'\n }\n})\nexport class RdxToggleDirective implements ControlValueAccessor {\n /**\n * The pressed state of the toggle when it is initially rendered.\n * Use when you do not need to control its pressed state.\n *\n * @group Props\n */\n readonly defaultPressed = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * The controlled pressed state of the toggle.\n * Must be used in conjunction with `onPressedChange`.\n *\n * @group Props\n */\n readonly pressed = model<boolean>(this.defaultPressed());\n\n /**\n * When true, prevents the user from interacting with the toggle.\n *\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /** @ignore */\n readonly disabledModel = model<boolean>(this.disabled());\n\n /** @ignore */\n readonly disabledState = computed(() => this.disabled() || this.disabledModel() || this.accessorDisabled());\n\n protected readonly dataState = computed<DataState>(() => {\n return this.pressed() ? 'on' : 'off';\n });\n\n /**\n * Event handler called when the pressed state of the toggle changes.\n *\n * @group Emits\n */\n readonly onPressedChange = output<boolean>();\n\n protected togglePressed(): void {\n if (!this.disabled()) {\n this.pressed.set(!this.pressed());\n this.onChange(this.pressed());\n this.onPressedChange.emit(this.pressed());\n }\n }\n\n private readonly accessorDisabled = signal(false);\n\n private onChange: (value: any) => void = () => {};\n\n /** @ignore */\n onTouched: (() => void) | undefined;\n\n /** @ignore */\n writeValue(value: any): void {\n this.pressed.set(value);\n }\n\n /** @ignore */\n registerOnChange(fn: (value: any) => void): void {\n this.onChange = fn;\n }\n\n /** @ignore */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /** @ignore */\n setDisabledState(isDisabled: boolean): void {\n this.accessorDisabled.set(isDisabled);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAqBa,qCAAqC,CAAA;8GAArC,qCAAqC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EA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AAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAlB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,kBAAkB,67BAVhB,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,CAAC,EAAA,QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAU5C,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAb9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,SAAS,EAAE,CAAC,oBAAoB,CAAA,kBAAA,CAAoB,CAAC;AACrD,oBAAA,IAAI,EAAE;AACF,wBAAA,qBAAqB,EAAE,WAAW;AAClC,wBAAA,mBAAmB,EAAE,aAAa;AAClC,wBAAA,sBAAsB,EAAE,kCAAkC;AAC1D,wBAAA,YAAY,EAAE,iBAAiB;AAE/B,wBAAA,SAAS,EAAE;AACd;AACJ,iBAAA;;;AC/CD;;AAEG;;;;"}
|
@@ -79,7 +79,7 @@ export declare class RdxHoverCardRootDirective {
|
|
79
79
|
window: Window & typeof globalThis;
|
80
80
|
primitiveConfigs?: import("./utils/types").PrimitiveConfigs;
|
81
81
|
onDestroyCallbacks: Set<() => void>;
|
82
|
-
"__#
|
82
|
+
"__#12362@#clickDomRootEventCallbacks": Set<(event: MouseEvent) => void>;
|
83
83
|
registerPrimitive<T extends object>(primitiveInstance: T): void;
|
84
84
|
deregisterPrimitive<T extends object>(primitiveInstance: T): void;
|
85
85
|
preventPrimitiveFromCdkEvent<T extends object>(primitiveInstance: T, eventType: import("./utils/types").EventType): void;
|
@@ -90,9 +90,9 @@ export declare class RdxHoverCardRootDirective {
|
|
90
90
|
primitivePreventedFromCdkEvent<T extends object>(primitiveInstance: T, eventType: import("./utils/types").EventType): boolean | undefined;
|
91
91
|
addClickDomRootEventCallback(callback: (event: MouseEvent) => void): void;
|
92
92
|
removeClickDomRootEventCallback(callback: (event: MouseEvent) => void): boolean;
|
93
|
-
"__#
|
94
|
-
"__#
|
95
|
-
"__#
|
93
|
+
"__#12362@#setPreventPrimitiveFromCdkEvent"<T extends object, R extends import("./utils/types").EventType, K extends import("./utils/types").PrimitiveConfig[`prevent${Capitalize<R>}`]>(primitiveInstance: T, eventType: R, value: K): void;
|
94
|
+
"__#12362@#registerOnDestroyCallbacks"(): void;
|
95
|
+
"__#12362@#listenToClickDomRootEvent"(): void;
|
96
96
|
} | null;
|
97
97
|
/** @ignore */
|
98
98
|
readonly destroyRef: DestroyRef;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@radix-ng/primitives",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.35.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"publishConfig": {
|
6
6
|
"access": "public"
|
@@ -76,6 +76,10 @@
|
|
76
76
|
"types": "./core/index.d.ts",
|
77
77
|
"default": "./fesm2022/radix-ng-primitives-core.mjs"
|
78
78
|
},
|
79
|
+
"./date-field": {
|
80
|
+
"types": "./date-field/index.d.ts",
|
81
|
+
"default": "./fesm2022/radix-ng-primitives-date-field.mjs"
|
82
|
+
},
|
79
83
|
"./dialog": {
|
80
84
|
"types": "./dialog/index.d.ts",
|
81
85
|
"default": "./fesm2022/radix-ng-primitives-dialog.mjs"
|
@@ -70,7 +70,7 @@ export declare class RdxPopoverRootDirective {
|
|
70
70
|
window: Window & typeof globalThis;
|
71
71
|
primitiveConfigs?: import("./utils/types").PrimitiveConfigs;
|
72
72
|
onDestroyCallbacks: Set<() => void>;
|
73
|
-
"__#
|
73
|
+
"__#15681@#clickDomRootEventCallbacks": Set<(event: MouseEvent) => void>;
|
74
74
|
registerPrimitive<T extends object>(primitiveInstance: T): void;
|
75
75
|
deregisterPrimitive<T extends object>(primitiveInstance: T): void;
|
76
76
|
preventPrimitiveFromCdkEvent<T extends object>(primitiveInstance: T, eventType: import("./utils/types").EventType): void;
|
@@ -81,9 +81,9 @@ export declare class RdxPopoverRootDirective {
|
|
81
81
|
primitivePreventedFromCdkEvent<T extends object>(primitiveInstance: T, eventType: import("./utils/types").EventType): boolean | undefined;
|
82
82
|
addClickDomRootEventCallback(callback: (event: MouseEvent) => void): void;
|
83
83
|
removeClickDomRootEventCallback(callback: (event: MouseEvent) => void): boolean;
|
84
|
-
"__#
|
85
|
-
"__#
|
86
|
-
"__#
|
84
|
+
"__#15681@#setPreventPrimitiveFromCdkEvent"<T extends object, R extends import("./utils/types").EventType, K extends import("./utils/types").PrimitiveConfig[`prevent${Capitalize<R>}`]>(primitiveInstance: T, eventType: R, value: K): void;
|
85
|
+
"__#15681@#registerOnDestroyCallbacks"(): void;
|
86
|
+
"__#15681@#listenToClickDomRootEvent"(): void;
|
87
87
|
} | null;
|
88
88
|
/** @ignore */
|
89
89
|
readonly destroyRef: DestroyRef;
|
@@ -4,7 +4,6 @@ import { ControlValueAccessor } from '@angular/forms';
|
|
4
4
|
import * as i0 from "@angular/core";
|
5
5
|
export declare const RdxSwitchToken: InjectionToken<RdxSwitchRootDirective>;
|
6
6
|
export declare function injectSwitch(): RdxSwitchRootDirective;
|
7
|
-
export declare const SWITCH_VALUE_ACCESSOR: any;
|
8
7
|
export interface SwitchProps {
|
9
8
|
checked?: ModelSignal<boolean>;
|
10
9
|
defaultChecked?: InputSignalWithTransform<boolean, BooleanInput>;
|
@@ -79,7 +79,7 @@ export declare class RdxTooltipRootDirective {
|
|
79
79
|
window: Window & typeof globalThis;
|
80
80
|
primitiveConfigs?: import("./utils/types").PrimitiveConfigs;
|
81
81
|
onDestroyCallbacks: Set<() => void>;
|
82
|
-
"__#
|
82
|
+
"__#19148@#clickDomRootEventCallbacks": Set<(event: MouseEvent) => void>;
|
83
83
|
registerPrimitive<T extends object>(primitiveInstance: T): void;
|
84
84
|
deregisterPrimitive<T extends object>(primitiveInstance: T): void;
|
85
85
|
preventPrimitiveFromCdkEvent<T extends object>(primitiveInstance: T, eventType: import("./utils/types").EventType): void;
|
@@ -90,9 +90,9 @@ export declare class RdxTooltipRootDirective {
|
|
90
90
|
primitivePreventedFromCdkEvent<T extends object>(primitiveInstance: T, eventType: import("./utils/types").EventType): boolean | undefined;
|
91
91
|
addClickDomRootEventCallback(callback: (event: MouseEvent) => void): void;
|
92
92
|
removeClickDomRootEventCallback(callback: (event: MouseEvent) => void): boolean;
|
93
|
-
"__#
|
94
|
-
"__#
|
95
|
-
"__#
|
93
|
+
"__#19148@#setPreventPrimitiveFromCdkEvent"<T extends object, R extends import("./utils/types").EventType, K extends import("./utils/types").PrimitiveConfig[`prevent${Capitalize<R>}`]>(primitiveInstance: T, eventType: R, value: K): void;
|
94
|
+
"__#19148@#registerOnDestroyCallbacks"(): void;
|
95
|
+
"__#19148@#listenToClickDomRootEvent"(): void;
|
96
96
|
} | null;
|
97
97
|
/** @ignore */
|
98
98
|
readonly destroyRef: DestroyRef;
|