From 706a2cdaddb869bb97085da40b692d5de575872a Mon Sep 17 00:00:00 2001 From: "AzureAD\\OlaBarecka" Date: Sun, 13 Aug 2023 09:47:10 +0100 Subject: [PATCH] feat: structured list components in progress --- .../CvStructuredList/CvStructuredList.vue | 48 ++++++++++++++-- .../CvStructuredList/CvStructuredListData.vue | 20 +++++-- .../CvStructuredListHeading.vue | 12 ++-- .../CvStructuredList/CvStructuredListItem.vue | 49 +++++++++++++++-- .../CvStructuredListItemSelectable.vue | 55 +++++++++++++++++-- .../CvStructuredListItemStandard.vue | 12 ++-- 6 files changed, 160 insertions(+), 36 deletions(-) diff --git a/src/components/CvStructuredList/CvStructuredList.vue b/src/components/CvStructuredList/CvStructuredList.vue index 97f9de962..10add8a8c 100644 --- a/src/components/CvStructuredList/CvStructuredList.vue +++ b/src/components/CvStructuredList/CvStructuredList.vue @@ -1,11 +1,47 @@ +import { defineEmits, provide } from 'vue'; +import { carbonPrefix } from '../../global/settings'; + +const props = defineProps({ + /** + * makes cv-structured-list-item selectable + */ + selectable: Boolean, + condensed: Boolean, +}); - +const emit = defineEmits(['change']); + +provide('on', val => { + emit('change', val); +}); +provide('selectable', props.selectable); + diff --git a/src/components/CvStructuredList/CvStructuredListData.vue b/src/components/CvStructuredList/CvStructuredListData.vue index 97f9de962..6dc54fe67 100644 --- a/src/components/CvStructuredList/CvStructuredListData.vue +++ b/src/components/CvStructuredList/CvStructuredListData.vue @@ -1,11 +1,19 @@ - - diff --git a/src/components/CvStructuredList/CvStructuredListHeading.vue b/src/components/CvStructuredList/CvStructuredListHeading.vue index 97f9de962..578f0cdd4 100644 --- a/src/components/CvStructuredList/CvStructuredListHeading.vue +++ b/src/components/CvStructuredList/CvStructuredListHeading.vue @@ -1,11 +1,11 @@ - - diff --git a/src/components/CvStructuredList/CvStructuredListItem.vue b/src/components/CvStructuredList/CvStructuredListItem.vue index 97f9de962..ff7221af8 100644 --- a/src/components/CvStructuredList/CvStructuredListItem.vue +++ b/src/components/CvStructuredList/CvStructuredListItem.vue @@ -1,11 +1,48 @@ +import { computed } from 'vue'; +import CvStructuredListItemStandard from './CvStructuredListItemStandard.vue'; +import CvStructuredListItemSelectable from './CvStructuredListItemSelectable.vue'; + +defineOptions({ + inheritAttrs: false, +}); + +defineProps({ + modelValue: { + type: String, + default: undefined, + }, + value: { + type: String, + default: undefined, + }, +}); + +const selectable = inject('selectable'); +const change = inject('change'); - +const tagType = computed(() => { + return selectable + ? CvStructuredListItemStandard + : CvStructuredListItemSelectable; +}); + +const emit = defineEmits(['change']); + +provide('on', val => { + emit('change', val); + change(val); //emit to parent +}); + diff --git a/src/components/CvStructuredList/CvStructuredListItemSelectable.vue b/src/components/CvStructuredList/CvStructuredListItemSelectable.vue index 97f9de962..d42ac325f 100644 --- a/src/components/CvStructuredList/CvStructuredListItemSelectable.vue +++ b/src/components/CvStructuredList/CvStructuredListItemSelectable.vue @@ -1,11 +1,54 @@ +import { carbonPrefix } from '../../global/settings'; +import { useCvId, props as propsCvId, useRadio } from '../../use'; +import CheckmarkFilled16 from '@carbon/icons-vue/es/checkmark--filled/16'; + +defineOptions({ + inheritAttrs: false, +}); - +const props = defineProps({ + label: { + type: String, + default: undefined, + }, + modelValue: { + type: String, + default: undefined, + }, + value: { + type: String, + default: undefined, + }, + ...propsCvId, +}); + +const cvId = useCvId(props); +const { isChecked } = useRadio(props, emit); + diff --git a/src/components/CvStructuredList/CvStructuredListItemStandard.vue b/src/components/CvStructuredList/CvStructuredListItemStandard.vue index 97f9de962..acdf27f92 100644 --- a/src/components/CvStructuredList/CvStructuredListItemStandard.vue +++ b/src/components/CvStructuredList/CvStructuredListItemStandard.vue @@ -1,11 +1,11 @@ - -