mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
fix(Select/SelectMenu): display falsy values
This commit is contained in:
@@ -250,7 +250,7 @@ function isSelectItem(item: SelectItem): item is SelectItemBase {
|
||||
|
||||
<slot :model-value="(modelValue as GetModelValue<T, VK, M>)" :open="open">
|
||||
<template v-for="displayedModelValue in [displayValue(modelValue as GetModelValue<T, VK, M>)]" :key="displayedModelValue">
|
||||
<span v-if="displayedModelValue" :class="ui.value({ class: props.ui?.value })">
|
||||
<span v-if="displayedModelValue !== undefined && displayedModelValue !== null" :class="ui.value({ class: props.ui?.value })">
|
||||
{{ displayedModelValue }}
|
||||
</span>
|
||||
<span v-else :class="ui.placeholder({ class: props.ui?.placeholder })">
|
||||
|
||||
@@ -385,7 +385,7 @@ function isSelectItem(item: SelectMenuItem): item is _SelectMenuItem {
|
||||
|
||||
<slot :model-value="(modelValue as GetModelValue<T, VK, M>)" :open="open">
|
||||
<template v-for="displayedModelValue in [displayValue(modelValue as GetModelValue<T, VK, M>)]" :key="displayedModelValue">
|
||||
<span v-if="displayedModelValue" :class="ui.value({ class: props.ui?.value })">
|
||||
<span v-if="displayedModelValue !== undefined && displayedModelValue !== null" :class="ui.value({ class: props.ui?.value })">
|
||||
{{ displayedModelValue }}
|
||||
</span>
|
||||
<span v-else :class="ui.placeholder({ class: props.ui?.placeholder })">
|
||||
|
||||
@@ -456,7 +456,7 @@ exports[`Select > renders with modelValue correctly 1`] = `
|
||||
|
||||
exports[`Select > renders with multiple and modelValue correctly 1`] = `
|
||||
"<button role="combobox" type="button" aria-controls="reka-select-content-v-0" aria-expanded="true" aria-required="false" aria-autocomplete="none" dir="ltr" data-state="open" class="relative group rounded-md inline-flex items-center focus:outline-none disabled:cursor-not-allowed disabled:opacity-75 transition-colors px-2.5 py-1.5 text-sm gap-1.5 text-highlighted bg-default ring ring-inset ring-accented focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary pe-9">
|
||||
<!--v-if--><span class="truncate text-dimmed"> </span><span class="absolute inset-y-0 end-0 flex items-center pe-2.5"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" class="shrink-0 text-dimmed size-5"></svg></span>
|
||||
<!--v-if--><span class="truncate pointer-events-none"></span><span class="absolute inset-y-0 end-0 flex items-center pe-2.5"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" class="shrink-0 text-dimmed size-5"></svg></span>
|
||||
</button>
|
||||
<!--teleport start-->
|
||||
|
||||
@@ -483,7 +483,7 @@ exports[`Select > renders with multiple and modelValue correctly 1`] = `
|
||||
|
||||
exports[`Select > renders with multiple correctly 1`] = `
|
||||
"<button role="combobox" type="button" aria-controls="reka-select-content-v-0" aria-expanded="true" aria-required="false" aria-autocomplete="none" dir="ltr" data-state="open" data-placeholder="" class="relative group rounded-md inline-flex items-center focus:outline-none disabled:cursor-not-allowed disabled:opacity-75 transition-colors px-2.5 py-1.5 text-sm gap-1.5 text-highlighted bg-default ring ring-inset ring-accented focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary pe-9">
|
||||
<!--v-if--><span class="truncate text-dimmed"> </span><span class="absolute inset-y-0 end-0 flex items-center pe-2.5"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" class="shrink-0 text-dimmed size-5"></svg></span>
|
||||
<!--v-if--><span class="truncate pointer-events-none"></span><span class="absolute inset-y-0 end-0 flex items-center pe-2.5"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" class="shrink-0 text-dimmed size-5"></svg></span>
|
||||
</button>
|
||||
<!--teleport start-->
|
||||
|
||||
|
||||
@@ -456,7 +456,7 @@ exports[`Select > renders with modelValue correctly 1`] = `
|
||||
|
||||
exports[`Select > renders with multiple and modelValue correctly 1`] = `
|
||||
"<button role="combobox" type="button" aria-controls="reka-select-content-v-0-0-0" aria-expanded="true" aria-required="false" aria-autocomplete="none" dir="ltr" data-state="open" class="relative group rounded-md inline-flex items-center focus:outline-none disabled:cursor-not-allowed disabled:opacity-75 transition-colors px-2.5 py-1.5 text-sm gap-1.5 text-highlighted bg-default ring ring-inset ring-accented focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary pe-9">
|
||||
<!--v-if--><span class="truncate text-dimmed"> </span><span class="absolute inset-y-0 end-0 flex items-center pe-2.5"><span class="iconify i-lucide:chevron-down shrink-0 text-dimmed size-5" aria-hidden="true"></span></span>
|
||||
<!--v-if--><span class="truncate pointer-events-none"></span><span class="absolute inset-y-0 end-0 flex items-center pe-2.5"><span class="iconify i-lucide:chevron-down shrink-0 text-dimmed size-5" aria-hidden="true"></span></span>
|
||||
</button>
|
||||
<!--teleport start-->
|
||||
|
||||
@@ -483,7 +483,7 @@ exports[`Select > renders with multiple and modelValue correctly 1`] = `
|
||||
|
||||
exports[`Select > renders with multiple correctly 1`] = `
|
||||
"<button role="combobox" type="button" aria-controls="reka-select-content-v-0-0-0" aria-expanded="true" aria-required="false" aria-autocomplete="none" dir="ltr" data-state="open" data-placeholder="" class="relative group rounded-md inline-flex items-center focus:outline-none disabled:cursor-not-allowed disabled:opacity-75 transition-colors px-2.5 py-1.5 text-sm gap-1.5 text-highlighted bg-default ring ring-inset ring-accented focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary pe-9">
|
||||
<!--v-if--><span class="truncate text-dimmed"> </span><span class="absolute inset-y-0 end-0 flex items-center pe-2.5"><span class="iconify i-lucide:chevron-down shrink-0 text-dimmed size-5" aria-hidden="true"></span></span>
|
||||
<!--v-if--><span class="truncate pointer-events-none"></span><span class="absolute inset-y-0 end-0 flex items-center pe-2.5"><span class="iconify i-lucide:chevron-down shrink-0 text-dimmed size-5" aria-hidden="true"></span></span>
|
||||
</button>
|
||||
<!--teleport start-->
|
||||
|
||||
|
||||
@@ -685,7 +685,7 @@ exports[`SelectMenu > renders with multiple and modelValue correctly 1`] = `
|
||||
|
||||
exports[`SelectMenu > renders with multiple correctly 1`] = `
|
||||
"<button type="button" tabindex="0" aria-label="Show popup" aria-haspopup="listbox" aria-expanded="true" aria-controls="" data-state="open" aria-disabled="false" class="relative group rounded-md inline-flex items-center focus:outline-none disabled:cursor-not-allowed disabled:opacity-75 transition-colors px-2.5 py-1.5 text-sm gap-1.5 text-highlighted bg-default ring ring-inset ring-accented focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary pe-9" dir="ltr" style="pointer-events: auto;">
|
||||
<!--v-if--><span class="truncate text-dimmed"> </span><span class="absolute inset-y-0 end-0 flex items-center pe-2.5"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" class="shrink-0 text-dimmed size-5"></svg></span>
|
||||
<!--v-if--><span class="truncate pointer-events-none"></span><span class="absolute inset-y-0 end-0 flex items-center pe-2.5"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" class="shrink-0 text-dimmed size-5"></svg></span>
|
||||
</button>
|
||||
<!--teleport start-->
|
||||
|
||||
|
||||
@@ -685,7 +685,7 @@ exports[`SelectMenu > renders with multiple and modelValue correctly 1`] = `
|
||||
|
||||
exports[`SelectMenu > renders with multiple correctly 1`] = `
|
||||
"<button type="button" tabindex="0" aria-label="Show popup" aria-haspopup="listbox" aria-expanded="true" aria-controls="" data-state="open" aria-disabled="false" class="relative group rounded-md inline-flex items-center focus:outline-none disabled:cursor-not-allowed disabled:opacity-75 transition-colors px-2.5 py-1.5 text-sm gap-1.5 text-highlighted bg-default ring ring-inset ring-accented focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary pe-9" dir="ltr" style="pointer-events: auto;">
|
||||
<!--v-if--><span class="truncate text-dimmed"> </span><span class="absolute inset-y-0 end-0 flex items-center pe-2.5"><span class="iconify i-lucide:chevron-down shrink-0 text-dimmed size-5" aria-hidden="true"></span></span>
|
||||
<!--v-if--><span class="truncate pointer-events-none"></span><span class="absolute inset-y-0 end-0 flex items-center pe-2.5"><span class="iconify i-lucide:chevron-down shrink-0 text-dimmed size-5" aria-hidden="true"></span></span>
|
||||
</button>
|
||||
<!--teleport start-->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user