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