Skip to content

Commit

Permalink
fix: add classes to radiobuttons component (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnaRybkina authored May 10, 2023
1 parent d7cdaf4 commit 1520b7a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
11 changes: 8 additions & 3 deletions components/forms/w-toggle.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<w-field as="fieldset" v-bind="{ ...$attrs, ...$props }" :role="role" #default="{ triggerValidation }">
<div :class="wrapperClasses">
<div class="group" v-for="(toggle, i) in toggles">
<div :class="groupClasses" v-for="(toggle, i) in toggles">
<w-toggle-item
v-model="model"
:type="type"
Expand Down Expand Up @@ -46,8 +46,13 @@ const type = computed(() => (props.radio || props.radioButton) ? 'radio' : 'chec
const role = computed(() => props.toggles.length > 1 ? ((props.radio || props.radioButton) ? 'radiogroup' : 'group') : undefined);
const wrapperClasses = computed(() => ({
[ccToggle.wrapper]: true,
[`${ccToggle.segmentControl} ${ccToggle.focusableWithin}`]: props.radioButton,
[ccToggle.scJustified]: props.equalWidth,
[`${ccToggle.radioButtons} ${ccToggle.focusableWithin}`]: props.radioButton,
[ccToggle.radioButtonsJustified]: props.equalWidth,
}));
const groupClasses = computed(() => ({
[ccToggle.radioButtonsGroup]: true,
[ccToggle.radioButtonsGroupJustified]: props.equalWidth,
}));
</script>
Expand Down
5 changes: 2 additions & 3 deletions components/generic/w-toggle-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ const labelClasses = computed(() => (p.labelClass || {
[ccToggle.radioInvalid]: isRadio.value && p.invalid,
[ccToggle.checkboxInvalid]: isCheckbox.value && p.invalid,
[`${ccToggle.checkbox} ${ccToggle.labelCheckboxColors} ${ccToggle.icon} ${p.disabled ? '' : ccToggle.checkboxChecked}`]: isCheckbox.value,
[ccToggle.scLabel]: p.radioButton,
[ccToggle.scLabelJustified]: p.equalWidth,
[ccToggle.scLabelSmall]: p.small,
[ccToggle.radioButtonsLabel]: p.radioButton,
[ccToggle.radioButtonsLabelSmall]: p.small,
}));
const inputClasses = {
[p.class ? `${p.class} ${ccToggle.input}` : ccToggle.input]: true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@vue/compiler-sfc": "^3.2.37",
"@vue/test-utils": "^2.0.2",
"@warp-ds/core": "^1.0.0",
"@warp-ds/component-classes": "^1.0.0-alpha.56",
"@warp-ds/component-classes": "^1.0.0-alpha.60",
"@warp-ds/uno": "1.0.0-alpha.19",
"cleave-lite": "^1.0.0",
"cz-conventional-changelog": "^3.3.0",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1520b7a

Please sign in to comment.