Skip to content

Commit 00bdd5d

Browse files
committed
fix(NcSelect): use shared scss mixin to apply new input design changes
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent ccf3cd6 commit 00bdd5d

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

src/components/NcSelect/NcSelect.vue

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ export default {
325325
<VueSelect
326326
class="select"
327327
:class="{
328+
'select--dark': isDark,
329+
'select--legacy': isLegacy,
328330
'select--no-wrap': noWrap,
329331
'user-select': userSelect,
330332
}"
@@ -414,12 +416,14 @@ import { VueSelect } from '@nextcloud/vue-select'
414416
import Vue from 'vue'
415417
import ChevronDown from 'vue-material-design-icons/ChevronDown.vue'
416418
import Close from 'vue-material-design-icons/Close.vue'
419+
import NcEllipsisedOption from '../NcEllipsisedOption/NcEllipsisedOption.vue'
420+
import NcListItemIcon from '../NcListItemIcon/NcListItemIcon.vue'
421+
import NcLoadingIcon from '../NcLoadingIcon/NcLoadingIcon.vue'
422+
import { useIsDarkTheme } from '../../composables/index.ts'
417423
import { useModelMigration } from '../../composables/useModelMigration.ts'
418424
import { t } from '../../l10n.js'
419425
import GenRandomId from '../../utils/GenRandomId.js'
420-
import NcEllipsisedOption from '../NcEllipsisedOption/index.js'
421-
import NcListItemIcon from '../NcListItemIcon/index.js'
422-
import NcLoadingIcon from '../NcLoadingIcon/index.js'
426+
import { isLegacy } from '../../utils/legacy.ts'
423427
424428
import '@nextcloud/vue-select/dist/vue-select.css'
425429
@@ -856,10 +860,13 @@ export default {
856860
const avatarSize = clickableArea - 2 * gridBaseLine
857861
858862
const model = useModelMigration('value', 'input')
863+
const isDark = useIsDarkTheme()
859864
860865
return {
861866
avatarSize,
862867
model,
868+
isDark,
869+
isLegacy,
863870
}
864871
},
865872
@@ -1013,6 +1020,8 @@ export default {
10131020
</script>
10141021
10151022
<style lang="scss">
1023+
@use '../../assets/input-border.scss' as border;
1024+
10161025
body {
10171026
/**
10181027
* Set custom vue-select CSS variables.
@@ -1082,7 +1091,7 @@ body {
10821091
10831092
.v-select.select {
10841093
/* Override default vue-select styles */
1085-
min-height: var(--default-clickable-area);
1094+
min-height: calc(var(--default-clickable-area) - 2 * var(--border-width-input));
10861095
min-width: 260px;
10871096
margin: 0 0 var(--default-grid-baseline);
10881097
@@ -1127,7 +1136,7 @@ body {
11271136
.vs__dropdown-toggle {
11281137
position: relative;
11291138
max-height: 100px;
1130-
padding: 0;
1139+
padding: var(--border-width-input);
11311140
overflow-y: auto;
11321141
}
11331142
@@ -1141,15 +1150,22 @@ body {
11411150
}
11421151
11431152
&.vs--open .vs__dropdown-toggle {
1144-
border-width: var(--border-width-input-focused);
1145-
outline: 2px solid var(--color-main-background);
11461153
border-color: var(--color-main-text);
11471154
border-bottom-color: transparent;
1155+
border-bottom-left-radius: 0;
1156+
border-bottom-right-radius: 0;
1157+
border-style: solid;
1158+
border-width: var(--border-width-input-focused);
1159+
outline: 2px solid var(--color-main-background);
1160+
padding: 0;
11481161
}
11491162
1150-
&:not(.vs--disabled, .vs--open) .vs__dropdown-toggle:hover {
1151-
outline: 2px solid var(--color-main-background);
1152-
border-color: var(--color-main-text);
1163+
&:not(.vs--disabled, .vs--open) {
1164+
.vs__dropdown-toggle:active,
1165+
.vs__dropdown-toggle:focus-within {
1166+
outline: 2px solid var(--color-main-background);
1167+
border-color: var(--color-main-text);
1168+
}
11531169
}
11541170
11551171
&.vs--disabled {
@@ -1216,6 +1232,10 @@ body {
12161232
}
12171233
}
12181234
1235+
.vs__dropdown-toggle {
1236+
@include border.inputLikeBorder('.select--dark', '.select--legacy', var(--vs-border-color));
1237+
}
1238+
12191239
.vs__dropdown-menu {
12201240
border-width: var(--border-width-input-focused) !important;
12211241
border-color: var(--color-main-text) !important;
@@ -1228,7 +1248,7 @@ body {
12281248
padding: 4px !important;
12291249
12301250
&--floating {
1231-
/* Fallback styles overidden by programmatically set inline styles */
1251+
/* Fallback styles overridden by programmatically set inline styles */
12321252
width: max-content;
12331253
position: absolute;
12341254
top: 0;

0 commit comments

Comments
 (0)