Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix(bal-checkbox-group): Disabled property not passed down to bal-checkbox-button #1264

Merged
merged 4 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/four-buses-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@baloise/design-system-components': patch
---

The radio and checkbox group component now updates its children when there are changes in the disabled or invalid status.
8 changes: 8 additions & 0 deletions packages/components/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,10 @@ export namespace Components {
* Defines the layout of the checkbox button
*/
"interface"?: BalProps.BalCheckboxGroupInterface;
/**
* If `true`, the element is not mutable, focusable, or even submitted with the form. The user can neither edit nor focus on the control, nor its form control descendants.
*/
"invalid"?: boolean;
/**
* The name of the control, which is submitted with the form data.
*/
Expand Down Expand Up @@ -5645,6 +5649,10 @@ declare namespace LocalJSX {
* Defines the layout of the checkbox button
*/
"interface"?: BalProps.BalCheckboxGroupInterface;
/**
* If `true`, the element is not mutable, focusable, or even submitted with the form. The user can neither edit nor focus on the control, nor its form control descendants.
*/
"invalid"?: boolean;
/**
* The name of the control, which is submitted with the form data.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,25 @@ export class CheckboxGroup
*/
@Prop() expanded = false

/**
* If `true`, the element is not mutable, focusable, or even submitted with the form. The user can neither edit nor focus on the control, nor its form control descendants.
*/
@Prop() invalid?: boolean = undefined

@Watch('invalid')
invalidChanged(value: boolean | undefined) {
if (this.control) {
if (value !== undefined) {
this.getCheckboxes().forEach(child => {
child.invalid = value
})
this.getCheckboxButtons().forEach(child => {
child.invalid = value
})
}
}
}

/**
* If `true`, the user cannot interact with the checkboxes.
*/
Expand All @@ -103,6 +122,9 @@ export class CheckboxGroup
this.getCheckboxes().forEach(child => {
child.disabled = value
})
this.getCheckboxButtons().forEach(child => {
child.disabled = value
})
}
}
}
Expand All @@ -119,6 +141,9 @@ export class CheckboxGroup
this.getCheckboxes().forEach(child => {
child.readonly = value
})
this.getCheckboxButtons().forEach(child => {
child.readonly = value
})
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ export class RadioGroup
this.getRadios().forEach(radio => {
radio.invalid = value
})
this.getRadioButtons().forEach(radio => {
radio.invalid = value
})
}
}

Expand All @@ -124,6 +127,9 @@ export class RadioGroup
this.getRadios().forEach(radio => {
radio.disabled = value
})
this.getRadioButtons().forEach(radio => {
radio.disabled = value
})
}
}

Expand All @@ -138,6 +144,9 @@ export class RadioGroup
this.getRadios().forEach(radio => {
radio.readonly = value
})
this.getRadioButtons().forEach(radio => {
radio.readonly = value
})
}
}

Expand Down