From 2a7e7b9ca99484875e23d855d9df86190703e2ad Mon Sep 17 00:00:00 2001 From: Tommy Date: Thu, 5 Sep 2024 11:48:23 -0400 Subject: [PATCH 01/26] feat: wip --- es-ds-components/components/es-form-radio-card.vue | 0 es-ds-components/components/es-form-radio-cards.vue | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 es-ds-components/components/es-form-radio-card.vue create mode 100644 es-ds-components/components/es-form-radio-cards.vue diff --git a/es-ds-components/components/es-form-radio-card.vue b/es-ds-components/components/es-form-radio-card.vue new file mode 100644 index 000000000..e69de29bb diff --git a/es-ds-components/components/es-form-radio-cards.vue b/es-ds-components/components/es-form-radio-cards.vue new file mode 100644 index 000000000..e69de29bb From bca817bb3d11dd5e03ef670a23304f9469d2222c Mon Sep 17 00:00:00 2001 From: Tommy Date: Fri, 6 Sep 2024 09:29:23 -0400 Subject: [PATCH 02/26] feat: wip --- .../components/es-form-radio-card.vue | 28 ++++++ .../components/es-form-radio-cards.vue | 36 ++++++++ es-ds-docs/components/ds-molecules-list.vue | 91 ++++++++++++++----- es-ds-docs/pages/molecules/radio-cards.vue | 72 +++++++++++++++ 4 files changed, 205 insertions(+), 22 deletions(-) create mode 100644 es-ds-docs/pages/molecules/radio-cards.vue diff --git a/es-ds-components/components/es-form-radio-card.vue b/es-ds-components/components/es-form-radio-card.vue index e69de29bb..15e677cb3 100644 --- a/es-ds-components/components/es-form-radio-card.vue +++ b/es-ds-components/components/es-form-radio-card.vue @@ -0,0 +1,28 @@ + + + diff --git a/es-ds-components/components/es-form-radio-cards.vue b/es-ds-components/components/es-form-radio-cards.vue index e69de29bb..d6f238c98 100644 --- a/es-ds-components/components/es-form-radio-cards.vue +++ b/es-ds-components/components/es-form-radio-cards.vue @@ -0,0 +1,36 @@ + + + diff --git a/es-ds-docs/components/ds-molecules-list.vue b/es-ds-docs/components/ds-molecules-list.vue index f4888a4f0..2804e9486 100644 --- a/es-ds-docs/components/ds-molecules-list.vue +++ b/es-ds-docs/components/ds-molecules-list.vue @@ -1,68 +1,115 @@ + - diff --git a/es-ds-docs/pages/molecules/radio-cards.vue b/es-ds-docs/pages/molecules/radio-cards.vue new file mode 100644 index 000000000..67cf87cda --- /dev/null +++ b/es-ds-docs/pages/molecules/radio-cards.vue @@ -0,0 +1,72 @@ + + + + From 1a20c9368a8eafef3b2abf9a4516bd0a9dcc3990 Mon Sep 17 00:00:00 2001 From: Tommy Date: Tue, 10 Sep 2024 10:36:05 -0400 Subject: [PATCH 03/26] feat: explicit prop passing --- .../components/es-form-radio-card.vue | 43 ++++++++++++++++++- .../components/es-radio-button.vue | 16 ++++++- es-ds-docs/pages/molecules/radio-cards.vue | 9 +++- 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/es-ds-components/components/es-form-radio-card.vue b/es-ds-components/components/es-form-radio-card.vue index 15e677cb3..54bd459f4 100644 --- a/es-ds-components/components/es-form-radio-card.vue +++ b/es-ds-components/components/es-form-radio-card.vue @@ -6,6 +6,8 @@ interface IProps { inline?: boolean; // eslint-disable-next-line @typescript-eslint/no-explicit-any value: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + modelValue: any; } const props = withDefaults(defineProps(), { @@ -15,14 +17,53 @@ const props = withDefaults(defineProps(), { inline: false, value: null, }); + +const emit = defineEmits([ + 'radio-card:change', + 'radio-card:blur', + 'radio-card:focus', + 'radio-card:update', +]) + + + +function handleClick() { + if (props.value !== props.modelValue) { + emit('radio-card:update', props.value); + } +} + +const isSelected = computed(() => props.modelValue === props.value) + +const isFocused = ref(false); +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function handleFocus(e: any) { + console.log('form-radio-card:handleFocus ', e); + // eslint-disable-next-line no-debugger + // debugger; + emit('radio-card:focus', e); + if (isSelected.value) { + isFocused.value = true; + } else { + isFocused.value = false; + } +} diff --git a/es-ds-components/components/es-radio-button.vue b/es-ds-components/components/es-radio-button.vue index b171a7aa4..c14e01ec6 100644 --- a/es-ds-components/components/es-radio-button.vue +++ b/es-ds-components/components/es-radio-button.vue @@ -8,6 +8,8 @@ interface IProps { inline?: boolean; // eslint-disable-next-line @typescript-eslint/no-explicit-any value: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + modelValue: any; } const props = withDefaults(defineProps(), { @@ -17,6 +19,13 @@ const props = withDefaults(defineProps(), { inline: false, value: null, }); + +defineEmits([ + 'radio-button:change', + 'radio-button:focus', + 'radio-button:blur', + 'radio-button:update', +]) diff --git a/es-ds-docs/pages/molecules/radio-button-new.vue b/es-ds-docs/pages/molecules/radio-button-new.vue new file mode 100644 index 000000000..22cc6628f --- /dev/null +++ b/es-ds-docs/pages/molecules/radio-button-new.vue @@ -0,0 +1,93 @@ + + + diff --git a/es-ds-styles/scss/_custom-forms.scss b/es-ds-styles/scss/_custom-forms.scss index 8b795a825..72b1a0ac6 100644 --- a/es-ds-styles/scss/_custom-forms.scss +++ b/es-ds-styles/scss/_custom-forms.scss @@ -181,21 +181,21 @@ border-radius: variables.$custom-radio-indicator-border-radius; } - .custom-control-input:has(.custom-radio-input:checked) ~ .custom-control-label { + .custom-control-input:checked ~ .custom-control-label { &::before { background-color: variables.$custom-control-indicator-bg; } &::after { - background-image: functions.escape-svg(variables.$custom-radio-indicator-icon-checked) !important; + background-image: functions.escape-svg(variables.$custom-radio-indicator-icon-checked); } } - .custom-control-input:has(.custom-radio-input:disabled:checked) ~ .custom-control-label { + .custom-control-input:disabled:checked ~ .custom-control-label { &::before { @include gradients.gradient-bg(variables.$custom-control-indicator-checked-disabled-bg); } &::after { - background-image: functions.escape-svg(variables.$custom-radio-indicator-icon-checked-disabled) !important; + background-image: functions.escape-svg(variables.$custom-radio-indicator-icon-checked-disabled); } } } From 2bb4eb671528dda721ea5e7ecc74f83ada7fb126 Mon Sep 17 00:00:00 2001 From: Tommy Date: Tue, 10 Sep 2024 17:17:37 -0400 Subject: [PATCH 05/26] feat: rewrite without prime button --- .../components/es-radio-button-group-new.vue | 61 ----------------- .../components/es-radio-button-group.vue | 41 +++++------ .../components/es-radio-button-new.vue | 57 ---------------- .../components/es-radio-button.vue | 68 ++++++++++--------- es-ds-docs/pages/molecules/radio-button.vue | 61 ++++++++--------- 5 files changed, 83 insertions(+), 205 deletions(-) delete mode 100644 es-ds-components/components/es-radio-button-group-new.vue delete mode 100644 es-ds-components/components/es-radio-button-new.vue diff --git a/es-ds-components/components/es-radio-button-group-new.vue b/es-ds-components/components/es-radio-button-group-new.vue deleted file mode 100644 index b7b5ff710..000000000 --- a/es-ds-components/components/es-radio-button-group-new.vue +++ /dev/null @@ -1,61 +0,0 @@ - - - diff --git a/es-ds-components/components/es-radio-button-group.vue b/es-ds-components/components/es-radio-button-group.vue index 80ce3aa85..d9f37753e 100644 --- a/es-ds-components/components/es-radio-button-group.vue +++ b/es-ds-components/components/es-radio-button-group.vue @@ -1,18 +1,11 @@ diff --git a/es-ds-components/components/es-radio-button-new.vue b/es-ds-components/components/es-radio-button-new.vue deleted file mode 100644 index 4d58f1824..000000000 --- a/es-ds-components/components/es-radio-button-new.vue +++ /dev/null @@ -1,57 +0,0 @@ - - - diff --git a/es-ds-components/components/es-radio-button.vue b/es-ds-components/components/es-radio-button.vue index ccd86b354..d60d86345 100644 --- a/es-ds-components/components/es-radio-button.vue +++ b/es-ds-components/components/es-radio-button.vue @@ -1,52 +1,58 @@ diff --git a/es-ds-docs/pages/molecules/radio-button.vue b/es-ds-docs/pages/molecules/radio-button.vue index fe3c41b45..9275c127d 100644 --- a/es-ds-docs/pages/molecules/radio-button.vue +++ b/es-ds-docs/pages/molecules/radio-button.vue @@ -1,41 +1,34 @@ diff --git a/es-ds-components/components/es-form-radio-cards.vue b/es-ds-components/components/es-form-radio-cards.vue index d6f238c98..72b1350f4 100644 --- a/es-ds-components/components/es-form-radio-cards.vue +++ b/es-ds-components/components/es-form-radio-cards.vue @@ -1,36 +1,81 @@ diff --git a/es-ds-components/components/es-radio-button-group.vue b/es-ds-components/components/es-radio-button-group.vue index d9f37753e..810e61a67 100644 --- a/es-ds-components/components/es-radio-button-group.vue +++ b/es-ds-components/components/es-radio-button-group.vue @@ -5,7 +5,7 @@ interface IOptions { // eslint-disable-next-line @typescript-eslint/no-explicit-any value: any; disabled?: boolean; - inline?: boolean; + // inline?: boolean; } interface IProps { @@ -45,10 +45,10 @@ defineEmits([ :id="option.id" :key="option.value" :disabled="option?.disabled || false" - :name="name" + :name="props.name" :value="option.value" :model-value="props.modelValue" - :inline="option.inline || false" + :inline="props.inline || false" :display-name="option.text" @update:model-value="$emit('update:model-value', option.value)" /> diff --git a/es-ds-docs/pages/molecules/radio-cards.vue b/es-ds-docs/pages/molecules/radio-cards.vue index d48839837..aaf7c7ae8 100644 --- a/es-ds-docs/pages/molecules/radio-cards.vue +++ b/es-ds-docs/pages/molecules/radio-cards.vue @@ -1,10 +1,5 @@ From cfc529ed940feb9afc9aa7c4752ba23e7c806800 Mon Sep 17 00:00:00 2001 From: Tommy Date: Thu, 12 Sep 2024 11:13:15 -0400 Subject: [PATCH 09/26] feat: add detach label example --- .../components/es-form-radio-cards.vue | 2 +- es-ds-docs/pages/molecules/radio-cards.vue | 54 +++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/es-ds-components/components/es-form-radio-cards.vue b/es-ds-components/components/es-form-radio-cards.vue index 89ed34895..402488908 100644 --- a/es-ds-components/components/es-form-radio-cards.vue +++ b/es-ds-components/components/es-form-radio-cards.vue @@ -60,7 +60,7 @@ function handleUpdate(value: any) { :id="`${props.id}-radiogroup`" role="radiogroup" tabindex="-1" - class="es-form-radio-cards d-flex justify-content-center" + class="es-form-radio-cards d-flex justify-content-center btn-group-vertical" :class="{ 'has-icon': props.hasIcon }" > diff --git a/es-ds-docs/pages/molecules/radio-cards.vue b/es-ds-docs/pages/molecules/radio-cards.vue index 2db9ad67b..384299a6d 100644 --- a/es-ds-docs/pages/molecules/radio-cards.vue +++ b/es-ds-docs/pages/molecules/radio-cards.vue @@ -37,6 +37,14 @@ const storageReasonOptions: { [key:string]: any }[] = [ }, ] +const installTimelineLabel = 'What’s your timeline for installing heat pumps?'; +const installTimelineOptions = [ + { label: 'ASAP', value: 'ASAP' }, + { label: 'Within the next 2-4 weeks', value: '2-4 weeks' }, + { label: 'Within the next 2-4 months', value: '2-4 months' }, + { label: '5+ months', value: '5+ months' }, +]; + function handleSubmit() { console.log('handleSubmit'); } @@ -145,5 +153,51 @@ function handleSubmit() {

+

+ Detached label +

+

+ This example demonstrates a case where more control is needed over the position of the field + label on the desktop breakpoint, so it is rendered separately of the radio cards component. + We do still need to pass the label text into the radio cards component for accessibility + purposes, but hide it visually by passing in a prop. +

+
+
+ + +

+ {{ installTimelineLabel }} +

+
+ + + + {{ option.label }} + + + +
+
+

+ Selection: + {{ form.installTimeline || '[none]' }} +

+
+ From 5e025002412c7fe626a407a82b23da5606688c92 Mon Sep 17 00:00:00 2001 From: Tommy Date: Thu, 12 Sep 2024 13:26:02 -0400 Subject: [PATCH 10/26] feat: add disabled styling --- .../components/es-form-radio-card.vue | 2 +- .../components/es-form-radio-cards.vue | 2 +- es-ds-docs/pages/molecules/radio-cards.vue | 108 ++++++++++++++++-- .../scss/vue/components/_radio-cards.scss | 10 ++ 4 files changed, 113 insertions(+), 9 deletions(-) diff --git a/es-ds-components/components/es-form-radio-card.vue b/es-ds-components/components/es-form-radio-card.vue index 7daef3e5c..0ab0df824 100644 --- a/es-ds-components/components/es-form-radio-card.vue +++ b/es-ds-components/components/es-form-radio-card.vue @@ -34,7 +34,7 @@ const isChecked = computed(() => props.value === model.value);