Browse Source

feat: wrapper component for Chrome

-emits input event on color change

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/3481/head
mertmit 2 years ago committed by Raju Udava
parent
commit
2f1b21263a
  1. 30
      packages/nc-gui-v2/components/general/ChromeWrapper.vue

30
packages/nc-gui-v2/components/general/ChromeWrapper.vue

@ -0,0 +1,30 @@
<script lang="ts" setup>
import { Chrome } from '@ckpack/vue-color'
import { computed } from '#imports'
interface Props {
modelValue?: any
mode?: 'hex' | 'hex8' | 'hsl' | 'hsv' | 'rgba'
}
const props = withDefaults(defineProps<Props>(), {
modelValue: () => '#00FFFFFF',
mode: () => 'hex8',
})
const emit = defineEmits(['update:modelValue', 'input'])
const picked = computed({
get: () => props.modelValue || '#00FFFFFF',
set: (val) => {
emit('update:modelValue', val[props.mode] || null)
emit('input', val[props.mode] || null)
},
})
</script>
<template>
<Chrome v-model="picked" />
</template>
<style scoped></style>
Loading…
Cancel
Save