pleroma-fe/src/components/select/select.vue

89 lines
1.6 KiB
Vue
Raw Normal View History

<template>
<label
class="Select input"
2021-03-11 16:31:15 +02:00
:class="{ disabled, unstyled }"
>
<select
:disabled="disabled"
2022-03-21 22:00:25 +02:00
:value="modelValue"
v-bind="$attrs"
2022-03-21 22:00:25 +02:00
@change="$emit('update:modelValue', $event.target.value)"
>
<slot />
</select>
2022-03-23 16:15:05 +02:00
{{ ' ' }}
<FAIcon
v-if="!$attrs.size && !$attrs.multiple"
class="select-down-icon"
icon="chevron-down"
/>
</label>
</template>
2021-03-11 16:19:11 +02:00
<script src="./select.js"> </script>
<style lang="scss">
2022-03-17 09:06:05 +02:00
/* TODO fix order of styles */
label.Select {
padding: 0;
select {
appearance: none;
background: transparent;
border: none;
2024-02-22 18:04:28 +02:00
color: var(--text);
margin: 0;
2023-01-09 13:02:16 -05:00
padding: 0 2em 0 0.2em;
2024-02-22 18:04:28 +02:00
font-family: var(--font);
2022-04-20 23:22:51 +03:00
font-size: 1em;
width: 100%;
z-index: 1;
2022-04-20 23:22:51 +03:00
height: 2em;
line-height: 16px;
&[multiple],
&[size] {
height: 100%;
padding: 0.2em;
option {
background-color: transparent;
&.-active {
color: var(--selectionText);
background-color: var(--selectionBackground);
}
}
}
}
2021-03-11 16:31:15 +02:00
&.disabled,
&:disabled {
background-color: var(--background);
opacity: 1; /* override browser */
select {
&[multiple],
&[size] {
option.-active {
color: var(--text);
background: transparent;
}
}
}
}
2021-03-11 16:31:15 +02:00
.select-down-icon {
position: absolute;
top: 0;
bottom: 0;
right: 5px;
height: 100%;
2022-03-15 21:00:52 +02:00
width: 0.875em;
2024-02-22 18:04:28 +02:00
font-family: var(--font);
2022-04-20 23:22:51 +03:00
line-height: 2;
2021-03-11 16:31:15 +02:00
z-index: 0;
pointer-events: none;
}
}
</style>