Skip to content

Commit

Permalink
Merge branch 'main' into 312-notification-bar-update-style-and-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgoud authored Feb 27, 2024
2 parents 6062eb9 + 4692c03 commit b8d4ef9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
1 change: 1 addition & 0 deletions packages/components/input/src/input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
:max="type === 'number' ? max : undefined"
:step="type === 'number' ? step : undefined"
:data-test="dataTest != undefined ? `input-${dataTest}` : undefined"
v-bind="$attrs"
@focus="handleFocus"
@blur="handleBlur"
/>
Expand Down
21 changes: 7 additions & 14 deletions packages/components/select/src/select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
>
<input
ref="labelInput"
:value="currentLabel"
:value="customLabel || currentLabel"
class="puik-select__selected"
:autocomplete="autocomplete"
:placeholder="placeholder"
Expand Down Expand Up @@ -113,7 +113,7 @@
</template>

<script setup lang="ts">
import { computed, provide, ref, useSlots, watch } from 'vue'
import { computed, provide, ref, useSlots } from 'vue'
import { Listbox, ListboxButton, ListboxOptions } from '@headlessui/vue'
import { isObject, isFunction, isArray, slotIsEmpty } from '@puik/utils'
import { useLocale } from '@puik/hooks'
Expand Down Expand Up @@ -142,20 +142,13 @@ const query = ref('')
const currentLabel = ref()
const selectedValue = computed({
get() {
return props.modelValue
},
set(option: any) {
currentLabel.value = props.customLabel ?? option.label
emit('update:modelValue', option.value)
get: () => props.modelValue,
set: (option: any) => {
currentLabel.value = option.label
return emit('update:modelValue', option.value)
},
})
watch(
() => props.customLabel,
() => (currentLabel.value = props.customLabel)
)
const filteredItems = computed(() => {
if (props.options) {
if (query.value) {
Expand All @@ -177,7 +170,7 @@ const filteredItems = computed(() => {
const hasError = computed(() => props.error || slotIsEmpty(slots.error))
const handleAutoComplete = (label: string | number) => {
if (label === currentLabel.value) return
if (label === props.customLabel || currentLabel.value) return
if (labelInput.value) {
labelInput.value.value = ''
}
Expand Down

0 comments on commit b8d4ef9

Please sign in to comment.