Updates to account for dev changes

This commit is contained in:
FrankRua 2022-02-22 17:00:09 -05:00
parent d64cd068a2
commit 3361e6818a
4 changed files with 272 additions and 273 deletions

View file

@ -2,17 +2,38 @@
<div class="container-fluid nested-radio"> <div class="container-fluid nested-radio">
<div class="row mb-1"> <div class="row mb-1">
<div class="col"> <div class="col">
<listCard groupName="listcard1" isWide="true" buttonImage="https://digitalconsumercms-dev.safelite.com/images/default-source/damage-options/car.svg?sfvrsn=1468d7f1_3" buttonLabel="Green Tint, Blue Shade" buttonID="radio1" /> <listCard
groupName="listcard1"
isWide="true"
buttonImage="https://digitalconsumercms-dev.safelite.com/images/default-source/damage-options/car.svg?sfvrsn=1468d7f1_3"
buttonLabel="Green Tint, Blue Shade"
buttonID="radio1"
/>
</div> </div>
</div> </div>
<div class="row mb-1"> <div class="row mb-1">
<div class="col"> <div class="col">
<buttonQuestion buttonType="radio" groupName="Demo Group" buttonID="button1" isRequired value="test button" screenReaderOnlyText="rain sensor, solar, 3rd visor band" :answers="demoArray" questionText="ok now select your features" /> <buttonQuestion
buttonType="radio"
groupName="Demo Group"
buttonID="button1"
isRequired
value="test button"
screenReaderOnlyText="rain sensor, solar, 3rd visor band"
:answers="demoArray"
questionText="ok now select your features"
/>
</div> </div>
</div> </div>
<div class="row mb-2"> <div class="row mb-2">
<div class="col"> <div class="col">
<listCard groupName="listcard1" isWide="true" buttonImage="https://digitalconsumercms-dev.safelite.com/images/default-source/damage-options/car.svg?sfvrsn=1468d7f1_3" buttonLabel="Green Tint" buttonID="radio2" /> <listCard
groupName="listcard1"
isWide="true"
buttonImage="https://digitalconsumercms-dev.safelite.com/images/default-source/damage-options/car.svg?sfvrsn=1468d7f1_3"
buttonLabel="Green Tint"
buttonID="radio2"
/>
</div> </div>
</div> </div>
</div> </div>
@ -33,8 +54,9 @@ export default {
demoArray: [ demoArray: [
"rain sensor, solar, 3rd visor band", "rain sensor, solar, 3rd visor band",
"rain sensor, heated glass, solar, 3rd visor band", "rain sensor, heated glass, solar, 3rd visor band",
] ],
} };
},
}; };
</script> </script>
@ -42,11 +64,11 @@ export default {
.nested-radio { .nested-radio {
.ui-radio { .ui-radio {
flex-direction: column; flex-direction: column;
margin: .25rem 0; margin: 0.25rem 0;
} }
p { p {
font-size: .875rem; font-size: 0.875rem;
} }
} }
</style> </style>

View file

@ -8,6 +8,7 @@
<div class="container nested-radio" v-for="(value, name, index) in featureListData" :key="index"> <div class="container nested-radio" v-for="(value, name, index) in featureListData" :key="index">
<div class="row my-2"> <div class="row my-2">
<div class="col"> <div class="col">
<listCard v-model="selectedTint[name]" :isRadio="true" :isWide="true" :buttonImage=" <listCard v-model="selectedTint[name]" :isRadio="true" :isWide="true" :buttonImage="
require(`@/assets/img/tints/${getTintSourceImage( require(`@/assets/img/tints/${getTintSourceImage(
glassLocation, glassLocation,
@ -16,14 +17,17 @@
" :buttonLabel="name" altText="" :buttonID="`${glassLocation}-${glassName}-${name}`" :groupName="`${glassLocation}-${glassName}`" @isCheckedChanged="ResetTintAndPartSelections()" /> " :buttonLabel="name" altText="" :buttonID="`${glassLocation}-${glassName}-${name}`" :groupName="`${glassLocation}-${glassName}`" @isCheckedChanged="ResetTintAndPartSelections()" />
</div> </div>
</div> </div>
<transition name="fade" mode="out-in">
<div v-if=" <div v-if="
selectedTint[name] != undefined && selectedTint[name] != undefined &&
selectedTint[name].buttonId === `${glassLocation}-${glassName}-${name}` selectedTint[name].buttonId === `${glassLocation}-${glassName}-${name}`
" class="row my-2"> " class="row my-2" aria-live="polite">
<div class="col"> <div class="col">
<buttonQuestion v-model="selectedPart[glassLocation]" buttonType="radio" class="radioQuestion" questionText="ok now select your features" :answers="value" textPosition="text-start" :loaderEnabled="false" :isRequired="true" :groupName="`${glassLocation}-${glassName}-${name}`" v-on:update:modelValue="EmitPartSelection($event)" /> <buttonQuestion v-model="selectedPart[glassLocation]" buttonType="radio" class="radioQuestion" questionText="ok now select your features" :answers="value" textPosition="text-start" :loaderEnabled="false" :isRequired="true" :groupName="`${glassLocation}-${glassName}-${name}`" v-on:update:modelValue="EmitPartSelection($event)" />
</div> </div>
</div> </div>
</transition>
</div> </div>
</template> </template>

View file

@ -48,10 +48,7 @@
</template> </template>
<script> <script>
import { import { useField } from "vee-validate";
useField
} from "vee-validate";
export default { export default {
name: "listCard", name: "listCard",
props: { props: {
@ -72,11 +69,6 @@ export default {
}, },
colLength: String, colLength: String,
validationRules: String, validationRules: String,
selectedButtonIDs: [Array, String],
hasError: Boolean,
},
colLength: String,
validationRules: String,
selectedValues: [Array, String], selectedValues: [Array, String],
hasError: Boolean, hasError: Boolean,
}, },
@ -97,36 +89,30 @@ export default {
if (this.buttonLabelSubCopy) { if (this.buttonLabelSubCopy) {
classes += " checkboxTop"; classes += " checkboxTop";
} }
return classes;
} else {
return "flex-column pt-4 pb-2";
}
}, },
}, },
methods: { methods: {
handleCheckChange(newValue, oldValue){ handleCheckChange(newValue, oldValue){
const isInitialization = typeof(oldValue) === 'function'; const isInitialization = typeof(oldValue) === 'function';
if (!isInitialization) { if (!isInitialization) {
this.$emit('isCheckedChanged', { checkValue: this.checkValue, value: this.value.toString() }); const emitEvent = { checkValue: this.checkValue, value: this.value.toString(), buttonId: this.buttonID.toString() };
}
}
},
setup(props) {
const inputType = props.isMultiSelect ? "checkbox" : "radio";
const emitEvent = {
isChecked: this.checkValue,
buttonId: this.buttonID.toString()
};
this.$emit('isCheckedChanged', emitEvent); this.$emit('isCheckedChanged', emitEvent);
this.$emit('update:modelValue', emitEvent); this.$emit('update:modelValue', emitEvent);
} }
}
}, },
setup(props) { setup(props) {
const inputType = props.isMultiSelect ? "checkbox" : "radio"; const inputType = props.isMultiSelect ? "checkbox" : "radio";
const { const {
value: inputValue, value: inputValue,
handleChange, handleChange,
errors, errors,
} = useField(props.groupName, props.validationRules, { } = useField(props.groupName, props.validationRules,
{
type: inputType, type: inputType,
checkedValue: props.value, checkedValue: props.value,
}); });
@ -141,12 +127,10 @@ export default {
<style lang="scss"> <style lang="scss">
.list-card { .list-card {
border: 1px solid $gray-500; border: 1px solid $gray-500;
&.invalid { &.invalid {
//Red border if invalid //Red border if invalid
border: 1px solid $red; border: 1px solid $red;
} }
img { img {
// svg's should be constructed on the same canvas size/viewbox to ensure they occupy the same space in the DOM. This will allow easy/proper alignment of elements. See exisitng svg's for examples. // svg's should be constructed on the same canvas size/viewbox to ensure they occupy the same space in the DOM. This will allow easy/proper alignment of elements. See exisitng svg's for examples.
height: auto; height: auto;
@ -154,58 +138,47 @@ export default {
margin-bottom: 3rem; margin-bottom: 3rem;
max-width: 100%; max-width: 100%;
} }
&:hover { &:hover {
box-shadow: 0px 0px 0px 4px $blue-300; box-shadow: 0px 0px 0px 4px $blue-300;
border: 1px solid transparent; border: 1px solid transparent;
} }
input[type="checkbox"], input[type="checkbox"],
input[type="radio"] { input[type="radio"] {
opacity: 0; opacity: 0;
width: 0; width: 0;
height: 0; height: 0;
+ label { + label {
display: block; display: block;
position: relative; position: relative;
&:hover { &:hover {
cursor: pointer; cursor: pointer;
} }
p { p {
color: $gray-600; color: $gray-600;
text-align: center; text-align: center;
&.sub-copy { &.sub-copy {
color: $gray-550; color: $gray-550;
} }
} }
} }
&:focus + label { &:focus + label {
box-shadow: 0 0 0 2.5px $blue; box-shadow: 0 0 0 2.5px $blue;
border-radius: 0.5rem; border-radius: 0.5rem;
} }
&:checked + label { &:checked + label {
background: $blue-100; background: $blue-100;
box-shadow: 0 0 0 1px $blue; box-shadow: 0 0 0 1px $blue;
border-radius: 0.5rem; border-radius: 0.5rem;
} }
&:checked + label { &:checked + label {
p { p {
color: $black; color: $black;
font-weight: 500; font-weight: 500;
} }
.sub-copy { .sub-copy {
color: $gray-600; color: $gray-600;
} }
} }
+ label::before { + label::before {
content: ""; content: "";
position: absolute; position: absolute;
@ -221,19 +194,15 @@ export default {
flex-shrink: 0; flex-shrink: 0;
color: $gray-600; color: $gray-600;
} }
+ label.checkboxTop::before { + label.checkboxTop::before {
margin: -1.25rem 0.5rem 0 0 !important; margin: -1.25rem 0.5rem 0 0 !important;
} }
+ label.checkboxTop::after { + label.checkboxTop::after {
margin: -1.5rem 0.5rem 0 0 !important; margin: -1.5rem 0.5rem 0 0 !important;
} }
&:checked + label::before { &:checked + label::before {
background: $blue; background: $blue;
} }
&:checked + label::after { &:checked + label::after {
content: ""; content: "";
position: absolute; position: absolute;
@ -245,31 +214,26 @@ export default {
transform: rotate(-45deg); transform: rotate(-45deg);
} }
} }
input[type="radio"] { input[type="radio"] {
+ label::before { + label::before {
content: ""; content: "";
display: none; display: none;
} }
+ label::after { + label::after {
content: ""; content: "";
display: none; display: none;
} }
+ label { + label {
img { img {
margin-bottom: 0; margin-bottom: 0;
} }
} }
} }
&.horizontal { &.horizontal {
img { img {
margin-bottom: 0; margin-bottom: 0;
width: 5.5rem; width: 5.5rem;
} }
input[type="checkbox"], input[type="checkbox"],
input[type="radio"] { input[type="radio"] {
+ label::before { + label::before {
@ -278,24 +242,19 @@ export default {
margin: 0 0.5rem 0 0; margin: 0 0.5rem 0 0;
order: 1; order: 1;
} }
&:checked + label::after { &:checked + label::after {
content: ""; content: "";
margin: -0.25rem 0 0 0; margin: -0.25rem 0 0 0;
left: 0.875rem; left: 0.875rem;
} }
+ label { + label {
min-height: 48px; min-height: 48px;
color: $gray-600; color: $gray-600;
img { img {
margin-bottom: 0; margin-bottom: 0;
} }
p { p {
text-align: left; text-align: left;
&.sub-copy { &.sub-copy {
color: $gray-550; color: $gray-550;
} }

View file

@ -10,7 +10,7 @@
:aria-required="isRequired" :aria-required="isRequired"
:value="value" :value="value"
:v-model="checkValue" :v-model="checkValue"
@change="handleCheckChanged" @change="handleCheckChanged()"
/> />
<label class="d-flex align-items-start form-check-label" :for="buttonID"> <label class="d-flex align-items-start form-check-label" :for="buttonID">
<p v-if="buttonLabel" class="m-0">{{ buttonLabel }}</p> <p v-if="buttonLabel" class="m-0">{{ buttonLabel }}</p>
@ -22,12 +22,8 @@
</template> </template>
<script> <script>
import { import { toRefs } from "vue";
toRefs import { useField } from "vee-validate";
} from "vue";
import {
useField
} from "vee-validate";
export default { export default {
name: "radio", name: "radio",
props: { props: {
@ -35,25 +31,42 @@ export default {
buttonLabel: String, buttonLabel: String,
buttonID: String, buttonID: String,
isRequired: Boolean, isRequired: Boolean,
hasError: Boolean,
value: { value: {
type: [String, Number], type: [String, Number],
default: "", default: "",
}, },
screenReaderOnlyText: String, screenReaderOnlyText: String,
hasError: Boolean,
}, },
data() { data() {
return { return {
checkValue: Boolean, checkValue: Boolean,
}; };
}, },
handleCheckChange(newValue, oldValue){ created() {
const isInitialization = typeof(oldValue) === 'function'; if (this.selectedButtonIDs) {
this.checkValue = this.selectedButtonIDs[0];
}
},
methods: {
handleClick(value) {
this.handleChange(value);
},
handleCheckChanged(newValue, oldValue) {
const isInitialization = typeof oldValue === "function";
if (!isInitialization) { if (!isInitialization) {
this.$emit('isCheckedChanged', { checkValue: this.checkValue, value: this.value.toString() });
} const emitEvent = {
checkValue: this.checkValue,
value: this.value.toString(),
buttonID: this.buttonID.toString(),
};
this.$emit("isCheckedChanged", emitEvent);
this.$emit("update:modelValue", emitEvent);
} }
}, },
},
setup(props) { setup(props) {
const { groupName, value } = toRefs(props); const { groupName, value } = toRefs(props);
const { checked, handleChange, errorMessage } = useField( const { checked, handleChange, errorMessage } = useField(
@ -72,12 +85,13 @@ export default {
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.form-check { .form-check {
.form-check-input { .form-check-input {
border: 1px solid $gray-500; border: 1px solid $gray-500;
border-radius: 100%; border-radius: 100%;
margin-right: .5rem; margin-right: 0.5rem;
&:checked { &:checked {
background-color: $white; background-color: $white;
background-size: 71%; background-size: 71%;