diff --git a/src/components/reusable/modal/modal.stories.js b/src/components/reusable/modal/modal.stories.js
index ae9c87d9..a3931e50 100644
--- a/src/components/reusable/modal/modal.stories.js
+++ b/src/components/reusable/modal/modal.stories.js
@@ -55,6 +55,7 @@ export const Modal = {
?destructive=${args.destructive}
?okDisabled=${args.okDisabled}
?hideFooter=${args.hideFooter}
+ ?hideCancelButton=${args.hideCancelButton}
@on-close=${(e) => action(e.type)(e)}
>
Open Modal
@@ -108,6 +109,7 @@ export const BeforeClose = {
cancelText=${args.cancelText}
?destructive=${args.destructive}
?okDisabled=${args.okDisabled}
+ ?hideCancelButton=${args.hideCancelButton}
.beforeClose=${(returnValue) => handleBeforeClose(returnValue)}
@on-close=${(e) => action(e.type)(e)}
>
diff --git a/src/components/reusable/radioButton/radioButton.scss b/src/components/reusable/radioButton/radioButton.scss
index 488e02ac..bedc34ba 100644
--- a/src/components/reusable/radioButton/radioButton.scss
+++ b/src/components/reusable/radioButton/radioButton.scss
@@ -72,6 +72,8 @@ input {
&[disabled] {
border-color: var(--kd-color-text-disabled);
+ opacity: 0.5;
+ cursor: not-allowed;
&:hover {
background-color: transparent;
diff --git a/src/components/reusable/radioButton/radioButton.stories.js b/src/components/reusable/radioButton/radioButton.stories.js
index 14fc1f56..e1f1bbe6 100644
--- a/src/components/reusable/radioButton/radioButton.stories.js
+++ b/src/components/reusable/radioButton/radioButton.stories.js
@@ -17,11 +17,13 @@ export const RadioButton = {
args: {
unnamed: 'Label',
value: 'example',
+ disabled: false,
},
render: (args) => {
return html`
action(e.type)(e)}
>
${args.unnamed}
diff --git a/src/components/reusable/radioButton/radioButtonGroup.ts b/src/components/reusable/radioButton/radioButtonGroup.ts
index 48d190eb..1c57acea 100644
--- a/src/components/reusable/radioButton/radioButtonGroup.ts
+++ b/src/components/reusable/radioButton/radioButtonGroup.ts
@@ -90,12 +90,26 @@ export class RadioButtonGroup extends FormMixin(LitElement) {
: null}
-
+
`;
}
+ private _handleSlotChange() {
+ this._updateChildren();
+ }
+
+ private _updateChildren() {
+ this.radioButtons.forEach((radio) => {
+ radio.disabled = this.disabled;
+ radio.checked = radio.value === this.value;
+ radio.name = this.name;
+ radio.required = this.required;
+ radio.invalid = this._isInvalid;
+ });
+ }
+
override willUpdate(changedProps: any) {
if (changedProps.has('textStrings')) {
this._textStrings = deepmerge(_defaultTextStrings, this.textStrings);
@@ -103,48 +117,17 @@ export class RadioButtonGroup extends FormMixin(LitElement) {
}
override updated(changedProps: any) {
- // preserve FormMixin updated function
this._onUpdated(changedProps);
- if (changedProps.has('name')) {
- // set name for each radio button
- this.radioButtons.forEach((radio: any) => {
- radio.name = this.name;
- });
- }
-
- if (changedProps.has('value')) {
- // set checked state for each radio button
- this.radioButtons.forEach((radio: any) => {
- radio.checked = radio.value === this.value;
- });
- }
-
- if (changedProps.has('required')) {
- // set required for each radio button
- this.radioButtons.forEach((radio: any) => {
- radio.required = this.required;
- });
- }
-
- if (
- changedProps.has('disabled') &&
- changedProps.get('disabled') !== undefined
- ) {
- // set disabled for each radio button
- this.radioButtons.forEach((radio: any) => {
- radio.disabled = this.disabled;
- });
- }
-
if (
+ changedProps.has('value') ||
+ changedProps.has('name') ||
+ changedProps.has('required') ||
+ changedProps.has('disabled') ||
changedProps.has('invalidText') ||
changedProps.has('internalValidationMsg')
) {
- // set invalid state for each radio button
- this.radioButtons.forEach((radio: any) => {
- radio.invalid = this._isInvalid;
- });
+ this._updateChildren();
}
}