@basis-ng/primitives 0.0.1-alpha.140 → 0.0.1-alpha.142
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.
|
@@ -800,22 +800,14 @@ class Checkbox {
|
|
|
800
800
|
*/
|
|
801
801
|
size = model('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
802
802
|
/**
|
|
803
|
-
*
|
|
803
|
+
* Whether the checkbox is disabled. Automatically bound by Signal Forms.
|
|
804
804
|
*/
|
|
805
|
-
|
|
806
|
-
/**
|
|
807
|
-
* Disabled flag controlled by Angular forms APIs.
|
|
808
|
-
*/
|
|
809
|
-
disabledFromControl = signal(false, ...(ngDevMode ? [{ debugName: "disabledFromControl" }] : []));
|
|
810
|
-
/**
|
|
811
|
-
* Combined disabled state exposed to the template bindings.
|
|
812
|
-
*/
|
|
813
|
-
isDisabled = computed(() => this.disabledBinding() || this.disabledFromControl(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : []));
|
|
805
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
|
|
814
806
|
/**
|
|
815
807
|
* Toggle the checkbox when the user clicks on it.
|
|
816
808
|
*/
|
|
817
809
|
onToggle() {
|
|
818
|
-
if (this.
|
|
810
|
+
if (this.disabled()) {
|
|
819
811
|
return;
|
|
820
812
|
}
|
|
821
813
|
const newValue = !this.value();
|
|
@@ -826,17 +818,10 @@ class Checkbox {
|
|
|
826
818
|
* Prevent the page from scrolling when pressing the space key.
|
|
827
819
|
*/
|
|
828
820
|
suppressSpace(event) {
|
|
829
|
-
if (!this.
|
|
821
|
+
if (!this.disabled()) {
|
|
830
822
|
event.preventDefault();
|
|
831
823
|
}
|
|
832
824
|
}
|
|
833
|
-
/**
|
|
834
|
-
* Toggle disabled state on the checkbox.
|
|
835
|
-
* @param isDisabled - Whether the control is disabled.
|
|
836
|
-
*/
|
|
837
|
-
setDisabledState(isDisabled) {
|
|
838
|
-
this.disabledFromControl.set(isDisabled);
|
|
839
|
-
}
|
|
840
825
|
/**
|
|
841
826
|
* Update the current value (FormValueControl API).
|
|
842
827
|
* @param value - New boolean value to apply.
|
|
@@ -846,7 +831,7 @@ class Checkbox {
|
|
|
846
831
|
this.valueChange.emit(value);
|
|
847
832
|
}
|
|
848
833
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: Checkbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
849
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: Checkbox, isStandalone: true, selector: "button[b-checkbox]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null },
|
|
834
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: Checkbox, isStandalone: true, selector: "button[b-checkbox]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", valueChange: "valueChange", size: "sizeChange" }, host: { attributes: { "type": "\"button\"" }, listeners: { "click": "onToggle()", "keydown.space": "suppressSpace($event)" }, properties: { "attr.role": "\"checkbox\"", "attr.aria-checked": "value()", "attr.data-state": "value() ? \"checked\" : \"unchecked\"", "attr.aria-disabled": "disabled()", "disabled": "disabled()", "attr.data-disabled": "disabled() ? \"\" : null", "class.b-size-sm": "size() === \"sm\"", "class.b-size-md": "size() === \"md\"", "class.b-size-lg": "size() === \"lg\"" } }, ngImport: i0, template: `
|
|
850
835
|
<span class="b-checkbox-indicator" aria-hidden="true">
|
|
851
836
|
@if (value()) {
|
|
852
837
|
<svg
|
|
@@ -894,9 +879,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
894
879
|
'[attr.role]': '"checkbox"',
|
|
895
880
|
'[attr.aria-checked]': 'value()',
|
|
896
881
|
'[attr.data-state]': 'value() ? "checked" : "unchecked"',
|
|
897
|
-
'[attr.aria-disabled]': '
|
|
898
|
-
'[disabled]': '
|
|
899
|
-
'[attr.data-disabled]': '
|
|
882
|
+
'[attr.aria-disabled]': 'disabled()',
|
|
883
|
+
'[disabled]': 'disabled()',
|
|
884
|
+
'[attr.data-disabled]': 'disabled() ? "" : null',
|
|
900
885
|
'[class.b-size-sm]': 'size() === "sm"',
|
|
901
886
|
'[class.b-size-md]': 'size() === "md"',
|
|
902
887
|
'[class.b-size-lg]': 'size() === "lg"',
|
|
@@ -905,7 +890,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
905
890
|
},
|
|
906
891
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
907
892
|
}]
|
|
908
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }, { type: i0.Output, args: ["sizeChange"] }],
|
|
893
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }, { type: i0.Output, args: ["sizeChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
|
|
909
894
|
|
|
910
895
|
/**
|
|
911
896
|
* Presents a list of selectable command options and manages keyboard navigation.
|
|
@@ -2933,6 +2918,8 @@ class Select {
|
|
|
2933
2918
|
selectContent = contentChild(SelectContent, ...(ngDevMode ? [{ debugName: "selectContent" }] : []));
|
|
2934
2919
|
/** Function to display the selected value(s). */
|
|
2935
2920
|
displayWith = input.required(...(ngDevMode ? [{ debugName: "displayWith" }] : []));
|
|
2921
|
+
/** Whether the select is disabled. Automatically bound by Signal Forms. */
|
|
2922
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
|
|
2936
2923
|
/** Current value array for the select. */
|
|
2937
2924
|
value = model([], ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
2938
2925
|
/** Emitted when the value changes. */
|
|
@@ -2940,6 +2927,7 @@ class Select {
|
|
|
2940
2927
|
constructor() {
|
|
2941
2928
|
effect(() => this.updateDisplayedValue());
|
|
2942
2929
|
effect(() => this.handleContentValueChanges());
|
|
2930
|
+
effect(() => this.selectTrigger()?.disabled.set(this.disabled()));
|
|
2943
2931
|
}
|
|
2944
2932
|
ngOnInit() {
|
|
2945
2933
|
this.setupTriggerEvents();
|
|
@@ -3014,13 +3002,6 @@ class Select {
|
|
|
3014
3002
|
overlay.closeOverlay();
|
|
3015
3003
|
});
|
|
3016
3004
|
}
|
|
3017
|
-
/**
|
|
3018
|
-
* Toggle disabled state on the select trigger.
|
|
3019
|
-
* @param isDisabled - Whether the control is disabled.
|
|
3020
|
-
*/
|
|
3021
|
-
setDisabledState(isDisabled) {
|
|
3022
|
-
this.selectTrigger()?.disabled.set(isDisabled);
|
|
3023
|
-
}
|
|
3024
3005
|
/**
|
|
3025
3006
|
* Update the current value.
|
|
3026
3007
|
* @param value - New value array to apply.
|
|
@@ -3030,7 +3011,7 @@ class Select {
|
|
|
3030
3011
|
this.valueChange.emit(value);
|
|
3031
3012
|
}
|
|
3032
3013
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: Select, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3033
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.8", type: Select, isStandalone: true, selector: "b-select", inputs: { displayWith: { classPropertyName: "displayWith", publicName: "displayWith", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", valueChange: "valueChange" }, queries: [{ propertyName: "overlay", first: true, predicate: ConnectedOverlay, descendants: true, isSignal: true }, { propertyName: "selectTrigger", first: true, predicate: SelectTrigger, descendants: true, isSignal: true }, { propertyName: "selectValue", first: true, predicate: SelectValue, descendants: true, isSignal: true }, { propertyName: "selectContent", first: true, predicate: SelectContent, descendants: true, isSignal: true }], ngImport: i0, template: ` <ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3014
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.8", type: Select, isStandalone: true, selector: "b-select", inputs: { displayWith: { classPropertyName: "displayWith", publicName: "displayWith", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", valueChange: "valueChange" }, queries: [{ propertyName: "overlay", first: true, predicate: ConnectedOverlay, descendants: true, isSignal: true }, { propertyName: "selectTrigger", first: true, predicate: SelectTrigger, descendants: true, isSignal: true }, { propertyName: "selectValue", first: true, predicate: SelectValue, descendants: true, isSignal: true }, { propertyName: "selectContent", first: true, predicate: SelectContent, descendants: true, isSignal: true }], ngImport: i0, template: ` <ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3034
3015
|
}
|
|
3035
3016
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: Select, decorators: [{
|
|
3036
3017
|
type: Component,
|
|
@@ -3039,7 +3020,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
3039
3020
|
template: ` <ng-content />`,
|
|
3040
3021
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3041
3022
|
}]
|
|
3042
|
-
}], ctorParameters: () => [], propDecorators: { overlay: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ConnectedOverlay), { isSignal: true }] }], selectTrigger: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SelectTrigger), { isSignal: true }] }], selectValue: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SelectValue), { isSignal: true }] }], selectContent: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SelectContent), { isSignal: true }] }], displayWith: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayWith", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }] } });
|
|
3023
|
+
}], ctorParameters: () => [], propDecorators: { overlay: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ConnectedOverlay), { isSignal: true }] }], selectTrigger: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SelectTrigger), { isSignal: true }] }], selectValue: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SelectValue), { isSignal: true }] }], selectContent: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SelectContent), { isSignal: true }] }], displayWith: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayWith", required: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }] } });
|
|
3043
3024
|
|
|
3044
3025
|
/**
|
|
3045
3026
|
* Directive to automatically focus the select filter input when it is initialized.
|