@radix-ng/primitives 1.0.0-beta.5 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/composite/README.md +3 -0
- package/fesm2022/radix-ng-primitives-accordion.mjs +20 -44
- package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-checkbox.mjs +134 -58
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-composite.mjs +599 -0
- package/fesm2022/radix-ng-primitives-composite.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-drawer.mjs +442 -2
- package/fesm2022/radix-ng-primitives-drawer.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menu.mjs +315 -68
- package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menubar.mjs +91 -36
- package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-navigation-menu.mjs +281 -88
- package/fesm2022/radix-ng-primitives-navigation-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-popover.mjs +40 -15
- package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-popper.mjs +73 -65
- package/fesm2022/radix-ng-primitives-popper.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-radio.mjs +63 -27
- package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-scroll-area.mjs +56 -25
- package/fesm2022/radix-ng-primitives-scroll-area.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-select.mjs +59 -29
- package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-slider.mjs +57 -13
- package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tabs.mjs +335 -73
- package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle-group.mjs +66 -21
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle.mjs +29 -11
- package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toolbar.mjs +68 -36
- package/fesm2022/radix-ng-primitives-toolbar.mjs.map +1 -1
- package/navigation-menu/README.md +5 -2
- package/package.json +6 -10
- package/types/radix-ng-primitives-accordion.d.ts +12 -16
- package/types/radix-ng-primitives-checkbox.d.ts +98 -70
- package/types/radix-ng-primitives-composite.d.ts +195 -0
- package/types/radix-ng-primitives-drawer.d.ts +40 -2
- package/types/radix-ng-primitives-menu.d.ts +46 -16
- package/types/radix-ng-primitives-menubar.d.ts +12 -5
- package/types/radix-ng-primitives-navigation-menu.d.ts +65 -33
- package/types/radix-ng-primitives-popover.d.ts +9 -5
- package/types/radix-ng-primitives-popper.d.ts +1 -0
- package/types/radix-ng-primitives-radio.d.ts +11 -9
- package/types/radix-ng-primitives-scroll-area.d.ts +4 -1
- package/types/radix-ng-primitives-select.d.ts +46 -32
- package/types/radix-ng-primitives-slider.d.ts +19 -4
- package/types/radix-ng-primitives-tabs.d.ts +69 -14
- package/types/radix-ng-primitives-toggle-group.d.ts +27 -16
- package/types/radix-ng-primitives-toggle.d.ts +5 -5
- package/types/radix-ng-primitives-toolbar.d.ts +84 -69
- package/collection/README.md +0 -1
- package/fesm2022/radix-ng-primitives-collection.mjs +0 -72
- package/fesm2022/radix-ng-primitives-collection.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-roving-focus.mjs +0 -388
- package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +0 -1
- package/roving-focus/README.md +0 -3
- package/types/radix-ng-primitives-collection.d.ts +0 -44
- package/types/radix-ng-primitives-roving-focus.d.ts +0 -187
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, model, input, booleanAttribute, output, signal, computed, effect, Directive, ElementRef, NgModule } from '@angular/core';
|
|
2
|
+
import { inject, model, input, booleanAttribute, output, signal, computed, effect, Directive, ElementRef, Renderer2, DestroyRef, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@radix-ng/primitives/core';
|
|
4
4
|
import { createContext, createCancelableChangeEventDetails, provideValueAccessor, RdxControlValueAccessor } from '@radix-ng/primitives/core';
|
|
5
|
-
import * as i1$1 from '@radix-ng/primitives/presence';
|
|
6
|
-
import { provideRdxPresenceContext, RdxPresenceDirective } from '@radix-ng/primitives/presence';
|
|
7
5
|
|
|
8
6
|
const [injectCheckboxGroupContext, provideCheckboxGroupContext] = createContext('CheckboxGroupContext', 'components/checkbox');
|
|
9
7
|
const groupContext = () => {
|
|
@@ -122,7 +120,7 @@ class RdxCheckboxGroupDirective {
|
|
|
122
120
|
}
|
|
123
121
|
const current = this.value();
|
|
124
122
|
const next = current.includes(name) ? current.filter((v) => v !== name) : [...current, name];
|
|
125
|
-
if (!this.emit(next,
|
|
123
|
+
if (!this.emit(next, event)) {
|
|
126
124
|
return;
|
|
127
125
|
}
|
|
128
126
|
// A direct child change becomes the new "remembered" selection and resets the parent cycle.
|
|
@@ -151,7 +149,7 @@ class RdxCheckboxGroupDirective {
|
|
|
151
149
|
const all = allValues.filter((name) => !this.isNameDisabled(name) || remembered.includes(name));
|
|
152
150
|
const rememberedIsAllOrNone = remembered.length === all.length || remembered.length === 0;
|
|
153
151
|
if (rememberedIsAllOrNone) {
|
|
154
|
-
this.emit(this.value().length === all.length ? none : all,
|
|
152
|
+
this.emit(this.value().length === all.length ? none : all, event);
|
|
155
153
|
return;
|
|
156
154
|
}
|
|
157
155
|
let nextStatus = 'mixed';
|
|
@@ -164,7 +162,7 @@ class RdxCheckboxGroupDirective {
|
|
|
164
162
|
nextStatus = 'off';
|
|
165
163
|
nextValue = none;
|
|
166
164
|
}
|
|
167
|
-
if (!this.emit(nextValue,
|
|
165
|
+
if (!this.emit(nextValue, event)) {
|
|
168
166
|
return;
|
|
169
167
|
}
|
|
170
168
|
this.parentStatus = nextStatus;
|
|
@@ -179,9 +177,9 @@ class RdxCheckboxGroupDirective {
|
|
|
179
177
|
this.uncontrolledState = this.value();
|
|
180
178
|
}
|
|
181
179
|
}
|
|
182
|
-
emit(next,
|
|
180
|
+
emit(next, event) {
|
|
183
181
|
const trigger = event?.currentTarget instanceof HTMLElement ? event.currentTarget : undefined;
|
|
184
|
-
const { eventDetails } = createCancelableChangeEventDetails(
|
|
182
|
+
const { eventDetails } = createCancelableChangeEventDetails('none', event ?? new Event('checkbox-group.value-change'), trigger);
|
|
185
183
|
this.onValueChange.emit({ value: next, eventDetails });
|
|
186
184
|
if (eventDetails.isCanceled()) {
|
|
187
185
|
return false;
|
|
@@ -242,8 +240,9 @@ const rootContext = () => {
|
|
|
242
240
|
name: checkbox.name,
|
|
243
241
|
parent: checkbox.parent,
|
|
244
242
|
form: checkbox.form,
|
|
245
|
-
readonly: checkbox.
|
|
243
|
+
readonly: checkbox.readOnlyState,
|
|
246
244
|
state: checkbox.state,
|
|
245
|
+
uncheckedValue: checkbox.uncheckedValue,
|
|
247
246
|
toggle(event) {
|
|
248
247
|
checkbox.toggle(event);
|
|
249
248
|
}
|
|
@@ -256,6 +255,9 @@ const [injectCheckboxRootContext, provideCheckboxRootContext] = createContext('C
|
|
|
256
255
|
class RdxCheckboxRootDirective {
|
|
257
256
|
constructor() {
|
|
258
257
|
this.controlValueAccessor = inject(RdxControlValueAccessor);
|
|
258
|
+
this.elementRef = inject(ElementRef);
|
|
259
|
+
this.renderer = inject(Renderer2);
|
|
260
|
+
this.uncheckedInputElement = null;
|
|
259
261
|
/** The group this checkbox belongs to, if it is rendered inside a `rdxCheckboxGroup`. */
|
|
260
262
|
this.group = injectCheckboxGroupContext(true);
|
|
261
263
|
/**
|
|
@@ -273,6 +275,13 @@ class RdxCheckboxRootDirective {
|
|
|
273
275
|
* @group Props
|
|
274
276
|
*/
|
|
275
277
|
this.checked = model(false, ...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
278
|
+
/**
|
|
279
|
+
* The state of the checkbox when it is initially rendered.
|
|
280
|
+
*
|
|
281
|
+
* @default false
|
|
282
|
+
* @group Props
|
|
283
|
+
*/
|
|
284
|
+
this.defaultChecked = input(undefined, { ...(ngDevMode ? { debugName: "defaultChecked" } : /* istanbul ignore next */ {}), transform: (value) => (value === undefined ? undefined : booleanAttribute(value)) });
|
|
276
285
|
/**
|
|
277
286
|
* Whether the checkbox is in a mixed state: neither ticked nor unticked.
|
|
278
287
|
* Orthogonal to `checked` and not part of the submitted form value. A user
|
|
@@ -291,6 +300,13 @@ class RdxCheckboxRootDirective {
|
|
|
291
300
|
* @group Props
|
|
292
301
|
*/
|
|
293
302
|
this.submitValue = input('on', { ...(ngDevMode ? { debugName: "submitValue" } : /* istanbul ignore next */ {}), alias: 'value' });
|
|
303
|
+
/**
|
|
304
|
+
* The value submitted with the form when the checkbox is unchecked.
|
|
305
|
+
* By default, unchecked checkboxes do not submit any value, matching native checkbox behavior.
|
|
306
|
+
*
|
|
307
|
+
* @group Props
|
|
308
|
+
*/
|
|
309
|
+
this.uncheckedValue = input(...(ngDevMode ? [undefined, { debugName: "uncheckedValue" }] : /* istanbul ignore next */ []));
|
|
294
310
|
/**
|
|
295
311
|
* Whether or not the checkbox button is disabled. This prevents the user from interacting with it.
|
|
296
312
|
* @group Props
|
|
@@ -301,6 +317,8 @@ class RdxCheckboxRootDirective {
|
|
|
301
317
|
* @group Props
|
|
302
318
|
*/
|
|
303
319
|
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
320
|
+
/** Alias matching Base UI's `readOnly` prop spelling. */
|
|
321
|
+
this.readOnly = input(false, { ...(ngDevMode ? { debugName: "readOnly" } : /* istanbul ignore next */ {}), alias: 'readOnly', transform: booleanAttribute });
|
|
304
322
|
/**
|
|
305
323
|
* Whether or not the checkbox is required.
|
|
306
324
|
* @group Props
|
|
@@ -361,6 +379,7 @@ class RdxCheckboxRootDirective {
|
|
|
361
379
|
}, ...(ngDevMode ? [{ debugName: "indeterminateState" }] : /* istanbul ignore next */ []));
|
|
362
380
|
/** @ignore The effective disabled state, including the group. */
|
|
363
381
|
this.disabledState = computed(() => this.controlValueAccessor.disabled() || (this.group?.disabled() ?? false), ...(ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []));
|
|
382
|
+
this.readOnlyState = computed(() => this.readonly() || this.readOnly(), ...(ngDevMode ? [{ debugName: "readOnlyState" }] : /* istanbul ignore next */ []));
|
|
364
383
|
this.state = computed(() => this.indeterminateState() ? 'indeterminate' : this.checkedState() ? 'checked' : 'unchecked', ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
365
384
|
// Inside a group, register this child's name and its own disabled state so a `parent`
|
|
366
385
|
// checkbox can preserve disabled-but-checked children when selecting/deselecting all.
|
|
@@ -371,8 +390,26 @@ class RdxCheckboxRootDirective {
|
|
|
371
390
|
onCleanup(group.registerChild(name, this.controlValueAccessor.disabled));
|
|
372
391
|
}
|
|
373
392
|
});
|
|
393
|
+
let hasAppliedDefault = false;
|
|
394
|
+
effect(() => {
|
|
395
|
+
const defaultChecked = this.defaultChecked();
|
|
396
|
+
if (!hasAppliedDefault && defaultChecked !== undefined) {
|
|
397
|
+
hasAppliedDefault = true;
|
|
398
|
+
this.checked.set(defaultChecked);
|
|
399
|
+
this.controlValueAccessor.setValue(defaultChecked);
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
effect(() => {
|
|
403
|
+
this.syncUncheckedInput();
|
|
404
|
+
});
|
|
405
|
+
inject(DestroyRef).onDestroy(() => {
|
|
406
|
+
this.removeUncheckedInput();
|
|
407
|
+
});
|
|
374
408
|
}
|
|
375
409
|
toggle(event) {
|
|
410
|
+
if (this.disabledState() || this.readOnlyState()) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
376
413
|
const group = this.group;
|
|
377
414
|
if (group) {
|
|
378
415
|
if (this.parent()) {
|
|
@@ -391,7 +428,7 @@ class RdxCheckboxRootDirective {
|
|
|
391
428
|
// kept in sync so `[(checked)]` / `[(indeterminate)]` reflect the change.
|
|
392
429
|
const next = this.indeterminateState() ? true : !this.checkedState();
|
|
393
430
|
const trigger = event?.currentTarget instanceof HTMLElement ? event.currentTarget : undefined;
|
|
394
|
-
const { eventDetails } = createCancelableChangeEventDetails(
|
|
431
|
+
const { eventDetails } = createCancelableChangeEventDetails('none', event ?? new Event('checkbox.checked-change'), trigger);
|
|
395
432
|
this.onCheckedChange.emit({ checked: next, eventDetails });
|
|
396
433
|
if (eventDetails.isCanceled()) {
|
|
397
434
|
return;
|
|
@@ -400,8 +437,63 @@ class RdxCheckboxRootDirective {
|
|
|
400
437
|
this.checked.set(next);
|
|
401
438
|
this.controlValueAccessor.setValue(next);
|
|
402
439
|
}
|
|
440
|
+
syncUncheckedInput() {
|
|
441
|
+
const name = this.name();
|
|
442
|
+
const uncheckedValue = this.uncheckedValue();
|
|
443
|
+
const shouldRender = !this.checkedState() && !this.group && !this.parent() && name !== undefined && uncheckedValue !== undefined;
|
|
444
|
+
if (!shouldRender) {
|
|
445
|
+
this.removeUncheckedInput();
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
const input = this.ensureUncheckedInput();
|
|
449
|
+
this.renderer.setAttribute(input, 'type', 'hidden');
|
|
450
|
+
this.renderer.setAttribute(input, 'name', name);
|
|
451
|
+
this.renderer.setAttribute(input, 'value', uncheckedValue);
|
|
452
|
+
this.setOptionalAttribute(input, 'form', this.form());
|
|
453
|
+
this.setBooleanAttribute(input, 'disabled', this.disabledState());
|
|
454
|
+
}
|
|
455
|
+
ensureUncheckedInput() {
|
|
456
|
+
if (this.uncheckedInputElement) {
|
|
457
|
+
return this.uncheckedInputElement;
|
|
458
|
+
}
|
|
459
|
+
const host = this.elementRef.nativeElement;
|
|
460
|
+
const parent = host.parentNode;
|
|
461
|
+
const input = this.renderer.createElement('input');
|
|
462
|
+
if (parent) {
|
|
463
|
+
this.renderer.insertBefore(parent, input, host.nextSibling);
|
|
464
|
+
}
|
|
465
|
+
this.uncheckedInputElement = input;
|
|
466
|
+
return input;
|
|
467
|
+
}
|
|
468
|
+
removeUncheckedInput() {
|
|
469
|
+
const input = this.uncheckedInputElement;
|
|
470
|
+
if (!input) {
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
const parent = input.parentNode;
|
|
474
|
+
if (parent) {
|
|
475
|
+
this.renderer.removeChild(parent, input);
|
|
476
|
+
}
|
|
477
|
+
this.uncheckedInputElement = null;
|
|
478
|
+
}
|
|
479
|
+
setOptionalAttribute(element, name, value) {
|
|
480
|
+
if (value) {
|
|
481
|
+
this.renderer.setAttribute(element, name, value);
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
this.renderer.removeAttribute(element, name);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
setBooleanAttribute(element, name, value) {
|
|
488
|
+
if (value) {
|
|
489
|
+
this.renderer.setAttribute(element, name, '');
|
|
490
|
+
}
|
|
491
|
+
else {
|
|
492
|
+
this.renderer.removeAttribute(element, name);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
403
495
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCheckboxRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
404
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxCheckboxRootDirective, isStandalone: true, selector: "[rdxCheckboxRoot]", inputs: { checked: { classPropertyName: "checked", publicName: "checked", 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 }, 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-
|
|
496
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", 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 }, 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": "isDisabled() ? \"\" : 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 }); }
|
|
405
497
|
}
|
|
406
498
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCheckboxRootDirective, decorators: [{
|
|
407
499
|
type: Directive,
|
|
@@ -415,13 +507,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
415
507
|
}
|
|
416
508
|
],
|
|
417
509
|
host: {
|
|
418
|
-
'[attr.data-
|
|
510
|
+
'[attr.data-checked]': 'checkedState() && !indeterminateState() ? "" : undefined',
|
|
511
|
+
'[attr.data-unchecked]': '!checkedState() && !indeterminateState() ? "" : undefined',
|
|
512
|
+
'[attr.data-indeterminate]': 'indeterminateState() ? "" : undefined',
|
|
419
513
|
'[attr.data-disabled]': 'isDisabled() ? "" : undefined',
|
|
420
|
-
'[attr.data-readonly]': '
|
|
514
|
+
'[attr.data-readonly]': 'readOnlyState() ? "" : undefined',
|
|
421
515
|
'[attr.data-required]': 'required() ? "" : undefined'
|
|
422
516
|
}
|
|
423
517
|
}]
|
|
424
|
-
}], ctorParameters: () => [], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }, { type: i0.Output, args: ["indeterminateChange"] }], submitValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], parent: [{ type: i0.Input, args: [{ isSignal: true, alias: "parent", required: false }] }], form: [{ type: i0.Input, args: [{ isSignal: true, alias: "form", required: false }] }], onCheckedChange: [{ type: i0.Output, args: ["onCheckedChange"] }] } });
|
|
518
|
+
}], ctorParameters: () => [], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], defaultChecked: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultChecked", required: false }] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }, { type: i0.Output, args: ["indeterminateChange"] }], submitValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], uncheckedValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "uncheckedValue", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], readOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readOnly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], parent: [{ type: i0.Input, args: [{ isSignal: true, alias: "parent", required: false }] }], form: [{ type: i0.Input, args: [{ isSignal: true, alias: "form", required: false }] }], onCheckedChange: [{ type: i0.Output, args: ["onCheckedChange"] }] } });
|
|
425
519
|
|
|
426
520
|
/**
|
|
427
521
|
* Directive: rdxCheckboxButton
|
|
@@ -452,7 +546,7 @@ class RdxCheckboxButtonDirective {
|
|
|
452
546
|
});
|
|
453
547
|
}
|
|
454
548
|
clicked(event) {
|
|
455
|
-
if (event.defaultPrevented || this.rootContext.readonly()) {
|
|
549
|
+
if (event.defaultPrevented || this.rootContext.disabled() || this.rootContext.readonly()) {
|
|
456
550
|
return;
|
|
457
551
|
}
|
|
458
552
|
this.rootContext.toggle(event);
|
|
@@ -464,7 +558,7 @@ class RdxCheckboxButtonDirective {
|
|
|
464
558
|
}
|
|
465
559
|
}
|
|
466
560
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCheckboxButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
467
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxCheckboxButtonDirective, isStandalone: true, selector: "button[rdxCheckboxButton]", host: { attributes: { "type": "button", "role": "checkbox" }, listeners: { "click": "clicked($event)", "keydown.enter": "$event.preventDefault()" }, properties: { "attr.aria-checked": "rootContext.indeterminate() ? \"mixed\" : rootContext.checked()", "attr.aria-controls": "ariaControls()", "attr.aria-required": "rootContext.required() || undefined", "attr.aria-readonly": "rootContext.readonly() || undefined", "attr.data-
|
|
561
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxCheckboxButtonDirective, isStandalone: true, selector: "button[rdxCheckboxButton]", host: { attributes: { "type": "button", "role": "checkbox" }, listeners: { "click": "clicked($event)", "keydown.enter": "$event.preventDefault()" }, properties: { "attr.aria-checked": "rootContext.indeterminate() ? \"mixed\" : rootContext.checked()", "attr.aria-controls": "ariaControls()", "attr.aria-disabled": "rootContext.disabled() ? \"true\" : undefined", "attr.aria-required": "rootContext.required() || undefined", "attr.aria-readonly": "rootContext.readonly() || undefined", "attr.data-checked": "rootContext.checked() && !rootContext.indeterminate() ? \"\" : undefined", "attr.data-unchecked": "!rootContext.checked() && !rootContext.indeterminate() ? \"\" : undefined", "attr.data-indeterminate": "rootContext.indeterminate() ? \"\" : undefined", "attr.data-disabled": "rootContext.disabled() ? \"\" : undefined", "attr.data-readonly": "rootContext.readonly() ? \"\" : undefined", "attr.data-required": "rootContext.required() ? \"\" : undefined" } }, ngImport: i0 }); }
|
|
468
562
|
}
|
|
469
563
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCheckboxButtonDirective, decorators: [{
|
|
470
564
|
type: Directive,
|
|
@@ -475,13 +569,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
475
569
|
role: 'checkbox',
|
|
476
570
|
'[attr.aria-checked]': 'rootContext.indeterminate() ? "mixed" : rootContext.checked()',
|
|
477
571
|
'[attr.aria-controls]': 'ariaControls()',
|
|
572
|
+
'[attr.aria-disabled]': 'rootContext.disabled() ? "true" : undefined',
|
|
478
573
|
'[attr.aria-required]': 'rootContext.required() || undefined',
|
|
479
574
|
'[attr.aria-readonly]': 'rootContext.readonly() || undefined',
|
|
480
|
-
'[attr.data-
|
|
575
|
+
'[attr.data-checked]': 'rootContext.checked() && !rootContext.indeterminate() ? "" : undefined',
|
|
576
|
+
'[attr.data-unchecked]': '!rootContext.checked() && !rootContext.indeterminate() ? "" : undefined',
|
|
577
|
+
'[attr.data-indeterminate]': 'rootContext.indeterminate() ? "" : undefined',
|
|
481
578
|
'[attr.data-disabled]': 'rootContext.disabled() ? "" : undefined',
|
|
482
579
|
'[attr.data-readonly]': 'rootContext.readonly() ? "" : undefined',
|
|
483
|
-
'[attr.
|
|
484
|
-
'[attr.value]': 'rootContext.value()',
|
|
580
|
+
'[attr.data-required]': 'rootContext.required() ? "" : undefined',
|
|
485
581
|
'(click)': 'clicked($event)',
|
|
486
582
|
// According to WAI ARIA, Checkboxes don't activate on enter keypress
|
|
487
583
|
'(keydown.enter)': '$event.preventDefault()'
|
|
@@ -492,49 +588,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
492
588
|
class RdxCheckboxIndicatorDirective {
|
|
493
589
|
constructor() {
|
|
494
590
|
this.rootContext = injectCheckboxRootContext();
|
|
591
|
+
/** Keep the indicator in the DOM when unchecked so CSS exit animations can play. */
|
|
592
|
+
this.keepMounted = input(false, { ...(ngDevMode ? { debugName: "keepMounted" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
593
|
+
this.isVisible = computed(() => this.rootContext.checked() || this.rootContext.indeterminate(), ...(ngDevMode ? [{ debugName: "isVisible" }] : /* istanbul ignore next */ []));
|
|
495
594
|
}
|
|
496
595
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCheckboxIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
497
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
596
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxCheckboxIndicatorDirective, isStandalone: true, selector: "[rdxCheckboxIndicator]", inputs: { keepMounted: { classPropertyName: "keepMounted", publicName: "keepMounted", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-checked": "rootContext.checked() && !rootContext.indeterminate() ? \"\" : undefined", "attr.data-unchecked": "!rootContext.checked() && !rootContext.indeterminate() ? \"\" : undefined", "attr.data-indeterminate": "rootContext.indeterminate() ? \"\" : undefined", "attr.data-disabled": "rootContext.disabled() ? \"\" : undefined", "attr.data-readonly": "rootContext.readonly() ? \"\" : undefined", "attr.data-required": "rootContext.required() ? \"\" : undefined", "attr.data-starting-style": "isVisible() ? \"\" : undefined", "attr.data-ending-style": "!isVisible() ? \"\" : undefined", "style.display": "!keepMounted() && !isVisible() ? \"none\" : null", "style.pointer-events": "\"none\"" } }, ngImport: i0 }); }
|
|
498
597
|
}
|
|
499
598
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCheckboxIndicatorDirective, decorators: [{
|
|
500
599
|
type: Directive,
|
|
501
600
|
args: [{
|
|
502
601
|
selector: '[rdxCheckboxIndicator]',
|
|
503
602
|
host: {
|
|
504
|
-
'[attr.data-
|
|
603
|
+
'[attr.data-checked]': 'rootContext.checked() && !rootContext.indeterminate() ? "" : undefined',
|
|
604
|
+
'[attr.data-unchecked]': '!rootContext.checked() && !rootContext.indeterminate() ? "" : undefined',
|
|
605
|
+
'[attr.data-indeterminate]': 'rootContext.indeterminate() ? "" : undefined',
|
|
505
606
|
'[attr.data-disabled]': 'rootContext.disabled() ? "" : undefined',
|
|
506
|
-
'[
|
|
607
|
+
'[attr.data-readonly]': 'rootContext.readonly() ? "" : undefined',
|
|
608
|
+
'[attr.data-required]': 'rootContext.required() ? "" : undefined',
|
|
609
|
+
'[attr.data-starting-style]': 'isVisible() ? "" : undefined',
|
|
610
|
+
'[attr.data-ending-style]': '!isVisible() ? "" : undefined',
|
|
611
|
+
'[style.display]': '!keepMounted() && !isVisible() ? "none" : null',
|
|
507
612
|
'[style.pointer-events]': '"none"'
|
|
508
613
|
}
|
|
509
614
|
}]
|
|
510
|
-
}] });
|
|
511
|
-
|
|
512
|
-
class RdxCheckboxIndicatorPresenceDirective {
|
|
513
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCheckboxIndicatorPresenceDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
514
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxCheckboxIndicatorPresenceDirective, isStandalone: true, selector: "ng-template[rdxCheckboxIndicatorPresence]", providers: [
|
|
515
|
-
provideRdxPresenceContext(() => {
|
|
516
|
-
const rootContext = injectCheckboxRootContext();
|
|
517
|
-
return {
|
|
518
|
-
present: computed(() => rootContext.checked() || rootContext.indeterminate())
|
|
519
|
-
};
|
|
520
|
-
})
|
|
521
|
-
], hostDirectives: [{ directive: i1$1.RdxPresenceDirective }], ngImport: i0 }); }
|
|
522
|
-
}
|
|
523
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCheckboxIndicatorPresenceDirective, decorators: [{
|
|
524
|
-
type: Directive,
|
|
525
|
-
args: [{
|
|
526
|
-
selector: 'ng-template[rdxCheckboxIndicatorPresence]',
|
|
527
|
-
providers: [
|
|
528
|
-
provideRdxPresenceContext(() => {
|
|
529
|
-
const rootContext = injectCheckboxRootContext();
|
|
530
|
-
return {
|
|
531
|
-
present: computed(() => rootContext.checked() || rootContext.indeterminate())
|
|
532
|
-
};
|
|
533
|
-
})
|
|
534
|
-
],
|
|
535
|
-
hostDirectives: [RdxPresenceDirective]
|
|
536
|
-
}]
|
|
537
|
-
}] });
|
|
615
|
+
}], propDecorators: { keepMounted: [{ type: i0.Input, args: [{ isSignal: true, alias: "keepMounted", required: false }] }] } });
|
|
538
616
|
|
|
539
617
|
class RdxCheckboxInputDirective {
|
|
540
618
|
constructor() {
|
|
@@ -566,7 +644,7 @@ class RdxCheckboxInputDirective {
|
|
|
566
644
|
});
|
|
567
645
|
}
|
|
568
646
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCheckboxInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
569
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxCheckboxInputDirective, isStandalone: true, selector: "input[rdxCheckboxInput]", host: { attributes: { "type": "checkbox", "tabindex": "-1", "aria-hidden": "true" }, properties: { "attr.name": "rootContext.name() || undefined", "attr.checked": "rootContext.state() === \"checked\" ? \"\" : undefined", "attr.form": "rootContext.form() || undefined", "attr.value": "rootContext.value()", "required": "rootContext.required()
|
|
647
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxCheckboxInputDirective, isStandalone: true, selector: "input[rdxCheckboxInput]", host: { attributes: { "type": "checkbox", "tabindex": "-1", "aria-hidden": "true" }, properties: { "attr.name": "rootContext.parent() ? undefined : rootContext.name() || undefined", "attr.checked": "rootContext.state() === \"checked\" ? \"\" : undefined", "checked": "rootContext.checked()", "attr.form": "rootContext.form() || undefined", "attr.value": "rootContext.value()", "required": "rootContext.required()", "disabled": "rootContext.disabled()", "style": "{\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n inset: 0,\n transform: 'translateX(-100%)',\n }" } }, ngImport: i0 }); }
|
|
570
648
|
}
|
|
571
649
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCheckboxInputDirective, decorators: [{
|
|
572
650
|
type: Directive,
|
|
@@ -576,14 +654,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
576
654
|
type: 'checkbox',
|
|
577
655
|
tabindex: '-1',
|
|
578
656
|
'aria-hidden': 'true',
|
|
579
|
-
'[attr.name]': 'rootContext.name() || undefined',
|
|
657
|
+
'[attr.name]': 'rootContext.parent() ? undefined : rootContext.name() || undefined',
|
|
580
658
|
// Only a truly checked box is submitted; `indeterminate` is a property
|
|
581
659
|
// (set below), never a submitted "checked" value.
|
|
582
660
|
'[attr.checked]': 'rootContext.state() === "checked" ? "" : undefined',
|
|
661
|
+
'[checked]': 'rootContext.checked()',
|
|
583
662
|
'[attr.form]': 'rootContext.form() || undefined',
|
|
584
663
|
'[attr.value]': 'rootContext.value()',
|
|
585
|
-
'[required]': 'rootContext.required()
|
|
586
|
-
'[
|
|
664
|
+
'[required]': 'rootContext.required()',
|
|
665
|
+
'[disabled]': 'rootContext.disabled()',
|
|
587
666
|
'[style]': `{
|
|
588
667
|
position: 'absolute',
|
|
589
668
|
pointerEvents: 'none',
|
|
@@ -601,7 +680,6 @@ const checkboxImports = [
|
|
|
601
680
|
RdxCheckboxRootDirective,
|
|
602
681
|
RdxCheckboxButtonDirective,
|
|
603
682
|
RdxCheckboxIndicatorDirective,
|
|
604
|
-
RdxCheckboxIndicatorPresenceDirective,
|
|
605
683
|
RdxCheckboxGroupDirective
|
|
606
684
|
];
|
|
607
685
|
class RdxCheckboxModule {
|
|
@@ -610,12 +688,10 @@ class RdxCheckboxModule {
|
|
|
610
688
|
RdxCheckboxRootDirective,
|
|
611
689
|
RdxCheckboxButtonDirective,
|
|
612
690
|
RdxCheckboxIndicatorDirective,
|
|
613
|
-
RdxCheckboxIndicatorPresenceDirective,
|
|
614
691
|
RdxCheckboxGroupDirective], exports: [RdxCheckboxInputDirective,
|
|
615
692
|
RdxCheckboxRootDirective,
|
|
616
693
|
RdxCheckboxButtonDirective,
|
|
617
694
|
RdxCheckboxIndicatorDirective,
|
|
618
|
-
RdxCheckboxIndicatorPresenceDirective,
|
|
619
695
|
RdxCheckboxGroupDirective] }); }
|
|
620
696
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCheckboxModule }); }
|
|
621
697
|
}
|
|
@@ -631,5 +707,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
631
707
|
* Generated bundle index. Do not edit.
|
|
632
708
|
*/
|
|
633
709
|
|
|
634
|
-
export { RdxCheckboxButtonDirective, RdxCheckboxGroupDirective, RdxCheckboxIndicatorDirective,
|
|
710
|
+
export { RdxCheckboxButtonDirective, RdxCheckboxGroupDirective, RdxCheckboxIndicatorDirective, RdxCheckboxInputDirective, RdxCheckboxModule, RdxCheckboxRootDirective, checkboxImports, getState, injectCheckboxGroupContext, injectCheckboxRootContext, isIndeterminate, provideCheckboxGroupContext, provideCheckboxRootContext };
|
|
635
711
|
//# sourceMappingURL=radix-ng-primitives-checkbox.mjs.map
|