Skip to content

Commit 1c4d8e1

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 16ff9bf commit 1c4d8e1

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

src/components/NcSelect/NcSelect.vue

Lines changed: 29 additions & 9 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
}"
330332
v-bind="propsToForward"
@@ -398,10 +400,12 @@ import { h, warn } from 'vue'
398400
import VueSelect from 'vue-select'
399401
import ChevronDown from 'vue-material-design-icons/ChevronDown.vue'
400402
import Close from 'vue-material-design-icons/Close.vue'
403+
import NcEllipsisedOption from '../NcEllipsisedOption/NcEllipsisedOption.vue'
404+
import NcLoadingIcon from '../NcLoadingIcon/NcLoadingIcon.vue'
405+
import { useIsDarkTheme } from '../../composables/index.ts'
401406
import { t } from '../../l10n.ts'
402407
import { createElementId } from '../../utils/createElementId.ts'
403-
import NcEllipsisedOption from '../NcEllipsisedOption/index.js'
404-
import NcLoadingIcon from '../NcLoadingIcon/index.ts'
408+
import { isLegacy } from '../../utils/legacy.ts'
405409
406410
// TODO: Use @nextcloud/vue-select once a vue 3 version is available.
407411
// Until then, all @nextcloud/vue-select specific improvements won't be available.
@@ -777,8 +781,11 @@ export default {
777781
const gridBaseLine = Number.parseInt(window.getComputedStyle(document.body).getPropertyValue('--default-grid-baseline'))
778782
const avatarSize = clickableArea - 2 * gridBaseLine
779783
784+
const isDark = useIsDarkTheme()
785+
780786
return {
781787
avatarSize,
788+
isLegacy,
782789
}
783790
},
784791
@@ -902,6 +909,8 @@ export default {
902909
</script>
903910
904911
<style lang="scss">
912+
@use '../../assets/input-border.scss' as border;
913+
905914
body {
906915
/**
907916
* Set custom vue-select CSS variables.
@@ -971,7 +980,7 @@ body {
971980
972981
.v-select.select {
973982
/* Override default vue-select styles */
974-
min-height: var(--default-clickable-area);
983+
min-height: calc(var(--default-clickable-area) - 2 * var(--border-width-input));
975984
min-width: 260px;
976985
margin: 0 0 var(--default-grid-baseline);
977986
@@ -1016,7 +1025,7 @@ body {
10161025
.vs__dropdown-toggle {
10171026
position: relative;
10181027
max-height: 100px;
1019-
padding: 0;
1028+
padding: var(--border-width-input);
10201029
overflow-y: auto;
10211030
}
10221031
@@ -1030,15 +1039,22 @@ body {
10301039
}
10311040
10321041
&.vs--open .vs__dropdown-toggle {
1033-
border-width: var(--border-width-input-focused);
1034-
outline: 2px solid var(--color-main-background);
10351042
border-color: var(--color-main-text);
10361043
border-bottom-color: transparent;
1044+
border-bottom-left-radius: 0;
1045+
border-bottom-right-radius: 0;
1046+
border-style: solid;
1047+
border-width: var(--border-width-input-focused);
1048+
outline: 2px solid var(--color-main-background);
1049+
padding: 0;
10371050
}
10381051
1039-
&:not(.vs--disabled, .vs--open) .vs__dropdown-toggle:hover {
1040-
outline: 2px solid var(--color-main-background);
1041-
border-color: var(--color-main-text);
1052+
&:not(.vs--disabled, .vs--open) {
1053+
.vs__dropdown-toggle:active,
1054+
.vs__dropdown-toggle:focus-within {
1055+
outline: 2px solid var(--color-main-background);
1056+
border-color: var(--color-main-text);
1057+
}
10421058
}
10431059
10441060
&.vs--disabled {
@@ -1105,6 +1121,10 @@ body {
11051121
}
11061122
}
11071123
1124+
.vs__dropdown-toggle {
1125+
@include border.inputLikeBorder('.select--dark', '.select--legacy', var(--vs-border-color));
1126+
}
1127+
11081128
.vs__dropdown-menu {
11091129
border-width: var(--border-width-input-focused) !important;
11101130
border-color: var(--color-main-text) !important;

0 commit comments

Comments
 (0)