@brickclay-org/ui 0.1.15 → 0.1.16
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/fesm2022/brickclay-org-ui.mjs +31 -7
- package/fesm2022/brickclay-org-ui.mjs.map +1 -1
- package/index.d.ts +20 -7
- package/package.json +1 -1
|
@@ -2870,7 +2870,20 @@ class BkRadioButton {
|
|
|
2870
2870
|
radioClass = '';
|
|
2871
2871
|
label = '';
|
|
2872
2872
|
labelClass = '';
|
|
2873
|
+
/**
|
|
2874
|
+
* The model value represented by this radio option.
|
|
2875
|
+
* Checked when the bound model `=== value`.
|
|
2876
|
+
*/
|
|
2873
2877
|
value;
|
|
2878
|
+
/**
|
|
2879
|
+
* Model value to write when de-selecting this radio (only when `allowDeselect` is true).
|
|
2880
|
+
*/
|
|
2881
|
+
uncheckedValue = null;
|
|
2882
|
+
/**
|
|
2883
|
+
* If true, selecting an already-selected radio will clear the model to `uncheckedValue`.
|
|
2884
|
+
* Default false (standard radio behavior).
|
|
2885
|
+
*/
|
|
2886
|
+
allowDeselect = false;
|
|
2874
2887
|
disabled = false;
|
|
2875
2888
|
variant = 'dot';
|
|
2876
2889
|
change = new EventEmitter();
|
|
@@ -2880,12 +2893,19 @@ class BkRadioButton {
|
|
|
2880
2893
|
select() {
|
|
2881
2894
|
if (this.disabled)
|
|
2882
2895
|
return;
|
|
2883
|
-
if (this.modelValue
|
|
2884
|
-
|
|
2885
|
-
|
|
2896
|
+
if (this.modelValue === this.value) {
|
|
2897
|
+
if (!this.allowDeselect)
|
|
2898
|
+
return;
|
|
2899
|
+
this.modelValue = this.uncheckedValue;
|
|
2900
|
+
this.onChange(this.uncheckedValue);
|
|
2886
2901
|
this.onTouched();
|
|
2887
|
-
this.change.emit(this.
|
|
2902
|
+
this.change.emit(this.uncheckedValue);
|
|
2903
|
+
return;
|
|
2888
2904
|
}
|
|
2905
|
+
this.modelValue = this.value;
|
|
2906
|
+
this.onChange(this.value);
|
|
2907
|
+
this.onTouched();
|
|
2908
|
+
this.change.emit(this.value);
|
|
2889
2909
|
}
|
|
2890
2910
|
get isChecked() {
|
|
2891
2911
|
return this.modelValue === this.value;
|
|
@@ -2903,17 +2923,17 @@ class BkRadioButton {
|
|
|
2903
2923
|
this.disabled = isDisabled;
|
|
2904
2924
|
}
|
|
2905
2925
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BkRadioButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2906
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: BkRadioButton, isStandalone: true, selector: "bk-radio-button", inputs: { radioClass: "radioClass", label: "label", labelClass: "labelClass", value: "value", disabled: "disabled", variant: "variant" }, outputs: { change: "change" }, providers: [
|
|
2926
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: BkRadioButton, isStandalone: true, selector: "bk-radio-button", inputs: { radioClass: "radioClass", label: "label", labelClass: "labelClass", value: "value", uncheckedValue: "uncheckedValue", allowDeselect: "allowDeselect", disabled: "disabled", variant: "variant" }, outputs: { change: "change" }, providers: [
|
|
2907
2927
|
{
|
|
2908
2928
|
provide: NG_VALUE_ACCESSOR,
|
|
2909
2929
|
useExisting: forwardRef(() => BkRadioButton),
|
|
2910
2930
|
multi: true,
|
|
2911
2931
|
},
|
|
2912
|
-
], ngImport: i0, template: "<div\r\n class=\"inline-flex items-center gap-2 cursor-pointer group outline-none\"\r\n (click)=\"select()\"\r\n (keydown.enter)=\"select()\"\r\n (keydown.space)=\"$event.preventDefault(); select()\"\r\n tabindex=\"0\"\r\n [attr.aria-disabled]=\"disabled\">\r\n\r\n <div\r\n class=\"relative flex items-center justify-center rounded-full border-2 transition-all duration-200 flex-shrink-0 group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 radio\"\r\n [ngClass]=\"[\r\n radioClass,\r\n !isChecked && !disabled ? 'bg-white border-gray-300 group-hover:border-gray-400' : '',\r\n\r\n variant === 'dot' && isChecked && !disabled ? 'border-black bg-white' : '',\r\n\r\n variant === 'tick' && isChecked && !disabled ? 'bg-black border-black' : '',\r\n\r\n disabled && isChecked && variant === 'tick' ? 'bg-gray-300 border-gray-300' : '',\r\n disabled && isChecked && variant === 'dot' ? 'border-gray-300 bg-gray-50' : '',\r\n disabled && !isChecked ? 'bg-gray-100 border-gray-200' : '',\r\n disabled ? 'cursor-not-allowed' : ''\r\n ]\"\r\n >\r\n@if(variant === 'dot'){\r\n <span\r\n class=\"rounded-full bg-black transition-transform duration-200 transform dot\"\r\n [class.scale-0]=\"!isChecked\"\r\n [class.scale-100]=\"isChecked\"\r\n [class.bg-gray-400]=\"disabled\"\r\n ></span>\r\n}\r\n @if (variant === 'tick'){\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"3.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n class=\"text-white pointer-events-none transition-opacity duration-200 tick\"\r\n [class.opacity-0]=\"!isChecked\"\r\n [class.opacity-100]=\"isChecked\"\r\n\r\n >\r\n <polyline points=\"20 6 9 17 4 12\"></polyline>\r\n </svg>\r\n }\r\n </div>\r\n\r\n @if(label) {\r\n <span class=\"font-medium text-xs text-[#1B223A] select-none {{labelClass}}\"\r\n [ngClass]=\"disabled ? 'text-gray-400' : ''\">\r\n {{ label }}\r\n </span>\r\n }\r\n</div>\r\n", styles: [".radio.xsm{@apply size-[14px] min-h-[14px] min-w-[14px];}.radio.sm{@apply size-[16px] min-h-[16px] min-w-[16px];}.radio.md{@apply size-[18px] min-h-[18px] min-w-[18px];}.radio.lg{@apply size-[19px] min-h-[19px] min-w-[19px];}.radio.xsm .dot{@apply size-[6px] min-h-[6px] min-w-[6px];}.radio.sm .dot{@apply size-[8px] min-h-[8px] min-w-[8px];}.radio.md .dot{@apply size-[10px] min-h-[10px] min-w-[10px];}.radio.lg .dot{@apply size-[11px] min-h-[11px] min-w-[11px];}.radio.xsm .tick{@apply size-[9px] min-h-[9px] min-w-[9px];}.radio.sm .tick{@apply size-[10px] min-h-[10px] min-w-[10px];}.radio.md .tick{@apply size-[12px] min-h-[12px] min-w-[12px];}.radio.lg .tick{@apply size-[14px] min-h-[14px] min-w-[14px];}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }
|
|
2932
|
+
], ngImport: i0, template: "<div\r\n class=\"inline-flex items-center gap-2 cursor-pointer group outline-none\"\r\n (click)=\"select()\"\r\n (keydown.enter)=\"select()\"\r\n (keydown.space)=\"$event.preventDefault(); select()\"\r\n tabindex=\"0\"\r\n [attr.aria-disabled]=\"disabled\">\r\n\r\n <div\r\n class=\"relative flex items-center justify-center rounded-full border-2 transition-all duration-200 flex-shrink-0 group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 radio\"\r\n [ngClass]=\"[\r\n radioClass,\r\n !isChecked && !disabled ? 'bg-white border-gray-300 group-hover:border-gray-400' : '',\r\n\r\n variant === 'dot' && isChecked && !disabled ? 'border-black bg-white' : '',\r\n\r\n variant === 'tick' && isChecked && !disabled ? 'bg-black border-black' : '',\r\n\r\n disabled && isChecked && variant === 'tick' ? 'bg-gray-300 border-gray-300' : '',\r\n disabled && isChecked && variant === 'dot' ? 'border-gray-300 bg-gray-50' : '',\r\n disabled && !isChecked ? 'bg-gray-100 border-gray-200' : '',\r\n disabled ? 'cursor-not-allowed' : ''\r\n ]\"\r\n >\r\n@if(variant === 'dot'){\r\n <span\r\n class=\"rounded-full bg-black transition-transform duration-200 transform dot\"\r\n [class.scale-0]=\"!isChecked\"\r\n [class.scale-100]=\"isChecked\"\r\n [class.bg-gray-400]=\"disabled\"\r\n ></span>\r\n}\r\n @if (variant === 'tick'){\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"3.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n class=\"text-white pointer-events-none transition-opacity duration-200 tick\"\r\n [class.opacity-0]=\"!isChecked\"\r\n [class.opacity-100]=\"isChecked\"\r\n\r\n >\r\n <polyline points=\"20 6 9 17 4 12\"></polyline>\r\n </svg>\r\n }\r\n </div>\r\n\r\n @if(label) {\r\n <span class=\"font-medium text-xs text-[#1B223A] select-none {{labelClass}}\"\r\n [ngClass]=\"disabled ? 'text-gray-400' : ''\">\r\n {{ label }}\r\n </span>\r\n }\r\n</div>\r\n", styles: [".radio.xsm{@apply size-[14px] min-h-[14px] min-w-[14px];}.radio.sm{@apply size-[16px] min-h-[16px] min-w-[16px];}.radio.md{@apply size-[18px] min-h-[18px] min-w-[18px];}.radio.lg{@apply size-[19px] min-h-[19px] min-w-[19px];}.radio.xsm .dot{@apply size-[6px] min-h-[6px] min-w-[6px];}.radio.sm .dot{@apply size-[8px] min-h-[8px] min-w-[8px];}.radio.md .dot{@apply size-[10px] min-h-[10px] min-w-[10px];}.radio.lg .dot{@apply size-[11px] min-h-[11px] min-w-[11px];}.radio.xsm .tick{@apply size-[9px] min-h-[9px] min-w-[9px];}.radio.sm .tick{@apply size-[10px] min-h-[10px] min-w-[10px];}.radio.md .tick{@apply size-[12px] min-h-[12px] min-w-[12px];}.radio.lg .tick{@apply size-[14px] min-h-[14px] min-w-[14px];}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
2913
2933
|
}
|
|
2914
2934
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BkRadioButton, decorators: [{
|
|
2915
2935
|
type: Component,
|
|
2916
|
-
args: [{ selector: 'bk-radio-button', standalone: true, imports: [CommonModule
|
|
2936
|
+
args: [{ selector: 'bk-radio-button', standalone: true, imports: [CommonModule], encapsulation: ViewEncapsulation.None, providers: [
|
|
2917
2937
|
{
|
|
2918
2938
|
provide: NG_VALUE_ACCESSOR,
|
|
2919
2939
|
useExisting: forwardRef(() => BkRadioButton),
|
|
@@ -2928,6 +2948,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
2928
2948
|
type: Input
|
|
2929
2949
|
}], value: [{
|
|
2930
2950
|
type: Input
|
|
2951
|
+
}], uncheckedValue: [{
|
|
2952
|
+
type: Input
|
|
2953
|
+
}], allowDeselect: [{
|
|
2954
|
+
type: Input
|
|
2931
2955
|
}], disabled: [{
|
|
2932
2956
|
type: Input
|
|
2933
2957
|
}], variant: [{
|