@semantic-components/ui 0.8.0 → 0.10.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.
|
@@ -8930,11 +8930,15 @@ class ScCheckbox {
|
|
|
8930
8930
|
checkboxClasses = computed(() => cn('peer appearance-none h-4 w-4 shrink-0 cursor-pointer rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground', this.checkboxClass()));
|
|
8931
8931
|
svgClass = input('');
|
|
8932
8932
|
svgClasses = computed(() => cn('absolute top-0 left-0 w-4 h-4 outline-none cursor-pointer text-primary-foreground', this.svgClass()));
|
|
8933
|
+
indeterminate = model(false);
|
|
8934
|
+
ariaLabel = input(null, { alias: 'aria-label' });
|
|
8933
8935
|
checked = model(false);
|
|
8934
8936
|
disabled = model(false);
|
|
8937
|
+
change = output();
|
|
8935
8938
|
state = computed(() => {
|
|
8936
8939
|
return this.checked() ? 'checked' : 'unchecked';
|
|
8937
8940
|
});
|
|
8941
|
+
host = inject(ElementRef);
|
|
8938
8942
|
constructor() {
|
|
8939
8943
|
effect(() => {
|
|
8940
8944
|
if (this.checked() !== true && this.checked() !== false) {
|
|
@@ -8943,6 +8947,7 @@ class ScCheckbox {
|
|
|
8943
8947
|
if (this.disabled() !== true && this.disabled() !== false) {
|
|
8944
8948
|
this.disabled.update((v) => coerceBooleanProperty(v));
|
|
8945
8949
|
}
|
|
8950
|
+
this.host.nativeElement.indeterminate = this.indeterminate();
|
|
8946
8951
|
});
|
|
8947
8952
|
}
|
|
8948
8953
|
toggle() {
|
|
@@ -8951,6 +8956,10 @@ class ScCheckbox {
|
|
|
8951
8956
|
}
|
|
8952
8957
|
const v = !this.checked();
|
|
8953
8958
|
this.checked.set(v);
|
|
8959
|
+
this.change.emit(v);
|
|
8960
|
+
if (this.indeterminate() === true) {
|
|
8961
|
+
this.indeterminate.set(false);
|
|
8962
|
+
}
|
|
8954
8963
|
this.onChange(v);
|
|
8955
8964
|
this._cdr.markForCheck();
|
|
8956
8965
|
}
|
|
@@ -8970,8 +8979,14 @@ class ScCheckbox {
|
|
|
8970
8979
|
setDisabledState(isDisabled) {
|
|
8971
8980
|
this.disabled.set(isDisabled);
|
|
8972
8981
|
}
|
|
8982
|
+
_onInteractionEvent(event) {
|
|
8983
|
+
// We always have to stop propagation on the change event.
|
|
8984
|
+
// Otherwise the change event, from the input element, will bubble up and
|
|
8985
|
+
// emit its event object to the `change` output.
|
|
8986
|
+
event.stopPropagation();
|
|
8987
|
+
}
|
|
8973
8988
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ScCheckbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8974
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: ScCheckbox, isStandalone: true, selector: "sc-checkbox", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, checkboxClass: { classPropertyName: "checkboxClass", publicName: "checkboxClass", isSignal: true, isRequired: false, transformFunction: null }, svgClass: { classPropertyName: "svgClass", publicName: "svgClass", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", disabled: "disabledChange" }, host: { listeners: { "click": "toggle()" }, properties: { "class": "classes()" } }, providers: [
|
|
8989
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: ScCheckbox, isStandalone: true, selector: "sc-checkbox", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, checkboxClass: { classPropertyName: "checkboxClass", publicName: "checkboxClass", isSignal: true, isRequired: false, transformFunction: null }, svgClass: { classPropertyName: "svgClass", publicName: "svgClass", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { indeterminate: "indeterminateChange", checked: "checkedChange", disabled: "disabledChange", change: "change" }, host: { listeners: { "click": "toggle()" }, properties: { "class": "classes()" } }, providers: [
|
|
8975
8990
|
{
|
|
8976
8991
|
provide: NG_VALUE_ACCESSOR,
|
|
8977
8992
|
useExisting: forwardRef(() => ScCheckbox),
|
|
@@ -8979,28 +8994,38 @@ class ScCheckbox {
|
|
|
8979
8994
|
},
|
|
8980
8995
|
], ngImport: i0, template: `
|
|
8981
8996
|
<input
|
|
8997
|
+
[attr.aria-label]="ariaLabel()"
|
|
8982
8998
|
[class]="checkboxClasses()"
|
|
8983
8999
|
[disabled]="disabled()"
|
|
9000
|
+
[checked]="checked()"
|
|
8984
9001
|
[attr.data-state]="state()"
|
|
9002
|
+
(change)="_onInteractionEvent($event)"
|
|
8985
9003
|
type="checkbox"
|
|
8986
9004
|
/>
|
|
8987
9005
|
|
|
8988
|
-
@if (
|
|
9006
|
+
@if (this.indeterminate() === true) {
|
|
9007
|
+
<svg-minus-icon [class]="svgClasses()" />
|
|
9008
|
+
} @else if (checked() === true) {
|
|
8989
9009
|
<svg-check-icon [class]="svgClasses()" />
|
|
8990
9010
|
}
|
|
8991
|
-
`, isInline: true, styles: [""], dependencies: [{ kind: "component", type: SvgCheckIcon, selector: "svg-check-icon", inputs: ["class", "svgClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
9011
|
+
`, isInline: true, styles: [""], dependencies: [{ kind: "component", type: SvgCheckIcon, selector: "svg-check-icon", inputs: ["class", "svgClass"] }, { kind: "component", type: SvgMinusIcon, selector: "svg-minus-icon", inputs: ["class", "svgClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
8992
9012
|
}
|
|
8993
9013
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ScCheckbox, decorators: [{
|
|
8994
9014
|
type: Component,
|
|
8995
|
-
args: [{ selector: 'sc-checkbox', imports: [SvgCheckIcon], template: `
|
|
9015
|
+
args: [{ selector: 'sc-checkbox', imports: [SvgCheckIcon, SvgMinusIcon], template: `
|
|
8996
9016
|
<input
|
|
9017
|
+
[attr.aria-label]="ariaLabel()"
|
|
8997
9018
|
[class]="checkboxClasses()"
|
|
8998
9019
|
[disabled]="disabled()"
|
|
9020
|
+
[checked]="checked()"
|
|
8999
9021
|
[attr.data-state]="state()"
|
|
9022
|
+
(change)="_onInteractionEvent($event)"
|
|
9000
9023
|
type="checkbox"
|
|
9001
9024
|
/>
|
|
9002
9025
|
|
|
9003
|
-
@if (
|
|
9026
|
+
@if (this.indeterminate() === true) {
|
|
9027
|
+
<svg-minus-icon [class]="svgClasses()" />
|
|
9028
|
+
} @else if (checked() === true) {
|
|
9004
9029
|
<svg-check-icon [class]="svgClasses()" />
|
|
9005
9030
|
}
|
|
9006
9031
|
`, host: {
|
|
@@ -10603,14 +10628,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
10603
10628
|
}] });
|
|
10604
10629
|
|
|
10605
10630
|
class ScMenuCheckboxItem {
|
|
10631
|
+
_cdkMenuItemCheckbox = inject(CdkMenuItemCheckbox, { host: true });
|
|
10606
10632
|
class = input('');
|
|
10607
10633
|
classes = computed(() => cn('relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50', this.class()));
|
|
10634
|
+
disabled = input(false, {
|
|
10635
|
+
transform: booleanAttribute,
|
|
10636
|
+
});
|
|
10637
|
+
constructor() {
|
|
10638
|
+
effect(() => {
|
|
10639
|
+
this._cdkMenuItemCheckbox.disabled = this.disabled();
|
|
10640
|
+
});
|
|
10641
|
+
}
|
|
10608
10642
|
scChecked = input(false, {
|
|
10609
10643
|
transform: booleanAttribute,
|
|
10610
10644
|
});
|
|
10611
10645
|
scTriggered = output();
|
|
10612
10646
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ScMenuCheckboxItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
10613
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: ScMenuCheckboxItem, isStandalone: true, selector: "button[sc-menu-checkbox-item]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, scChecked: { classPropertyName: "scChecked", publicName: "scChecked", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { scTriggered: "scTriggered" }, host: { properties: { "class": "classes()" } }, hostDirectives: [{ directive: i1$5.CdkMenuItemCheckbox, inputs: ["cdkMenuItemChecked", "scChecked"], outputs: ["cdkMenuItemTriggered", "scTriggered"] }], ngImport: i0, template: `
|
|
10647
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: ScMenuCheckboxItem, isStandalone: true, selector: "button[sc-menu-checkbox-item]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, scChecked: { classPropertyName: "scChecked", publicName: "scChecked", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { scTriggered: "scTriggered" }, host: { properties: { "class": "classes()" } }, hostDirectives: [{ directive: i1$5.CdkMenuItemCheckbox, inputs: ["cdkMenuItemChecked", "scChecked"], outputs: ["cdkMenuItemTriggered", "scTriggered"] }], ngImport: i0, template: `
|
|
10614
10648
|
@if (scChecked()) {
|
|
10615
10649
|
<span class="absolute left-2 flex size-3.5 items-center justify-center">
|
|
10616
10650
|
<svg-check-icon class="size-4" />
|
|
@@ -10637,7 +10671,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
10637
10671
|
outputs: ['cdkMenuItemTriggered: scTriggered'],
|
|
10638
10672
|
},
|
|
10639
10673
|
] }]
|
|
10640
|
-
}] });
|
|
10674
|
+
}], ctorParameters: () => [] });
|
|
10641
10675
|
|
|
10642
10676
|
class ScMenuRadioGroup {
|
|
10643
10677
|
class = input('');
|