| 1 |
<template> |
| 2 |
<ElOption |
| 3 |
:class="['ivyforms-select-option', { 'is-secondary': isSecondary }]" |
| 4 |
:value="props.value" |
| 5 |
:label="props.label" |
| 6 |
:disabled="disabled" |
| 7 |
> |
| 8 |
<slot /> |
| 9 |
<IvyIcon |
| 10 |
v-if="props.iconConfig?.name" |
| 11 |
v-bind="{ ...props.iconConfig, name: props.iconConfig.name }" |
| 12 |
/> |
| 13 |
</ElOption> |
| 14 |
</template> |
| 15 |
|
| 16 |
<script setup lang="ts"> |
| 17 |
import { inject } from 'vue' |
| 18 |
import IvyIcon from '@/views/_components/icon/IvyIcon.vue' |
| 19 |
import type { IconCategory } from '@/types/icons/icon-category' |
| 20 |
import type { IconType } from '@/types/icons/icon-type' |
| 21 |
|
| 22 |
const props = defineProps<{ |
| 23 |
value: string | number | boolean | object |
| 24 |
label?: string | number |
| 25 |
disabled?: boolean |
| 26 |
iconConfig?: { |
| 27 |
name: string |
| 28 |
type?: IconType |
| 29 |
category?: IconCategory |
| 30 |
size?: 'l' | 'd' | 's' | 'xs' |
| 31 |
class?: string |
| 32 |
} |
| 33 |
}>() |
| 34 |
|
| 35 |
const isSecondary = inject('isSecondary', false) |
| 36 |
</script> |
| 37 |
|
| 38 |
<style lang="scss"> |
| 39 |
// Select Option |
| 40 |
.ivyforms-select-option { |
| 41 |
&.el-select-dropdown__item { |
| 42 |
height: 48px; |
| 43 |
color: var(--map-base-dusk-symbol-2); |
| 44 |
cursor: pointer; |
| 45 |
display: flex; |
| 46 |
align-items: center; |
| 47 |
justify-content: space-between; |
| 48 |
margin: 0; |
| 49 |
font-size: 14px; |
| 50 |
font-style: normal; |
| 51 |
font-weight: 400; |
| 52 |
line-height: 20px; |
| 53 |
|
| 54 |
&.is-selected { |
| 55 |
background: var(--map-base-brand-o10); |
| 56 |
color: var(--map-base-dusk-symbol-2); |
| 57 |
font-size: 14px; |
| 58 |
font-style: normal; |
| 59 |
font-weight: 400; |
| 60 |
|
| 61 |
&.is-secondary { |
| 62 |
background: var(--map-base-purple-o10); |
| 63 |
&:after { |
| 64 |
background-color: var(--map-base-purple-symbol-0) !important; |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
&:after { |
| 69 |
background-color: var(--map-base-brand-symbol-2) !important; |
| 70 |
} |
| 71 |
} |
| 72 |
|
| 73 |
&:hover, |
| 74 |
&.is-hovering { |
| 75 |
color: var(--map-base-dusk-symbol-2); |
| 76 |
background: var(--map-hover); |
| 77 |
} |
| 78 |
|
| 79 |
.ivyforms-icon { |
| 80 |
display: contents; |
| 81 |
} |
| 82 |
} |
| 83 |
} |
| 84 |
</style> |
| 85 |
|