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