@melt-ui/svelte
Advanced tools
Comparing version 0.34.4 to 0.34.5
@@ -335,6 +335,7 @@ import { createLabel, createSeparator } from '../index.js'; | ||
optionsList.push(optProps); | ||
const isSelected = Array.isArray($value) ? $value.includes(props?.value) : $value === props?.value; | ||
return { | ||
role: 'option', | ||
'aria-selected': $value === props?.value, | ||
'data-selected': $value === props?.value ? '' : undefined, | ||
'aria-selected': isSelected, | ||
'data-selected': isSelected ? '' : undefined, | ||
'data-value': JSON.stringify(props.value), | ||
@@ -341,0 +342,0 @@ 'data-label': props.label ?? undefined, |
@@ -105,2 +105,5 @@ import { builder, createElHelpers, effect, executeCallbacks, generateId, getElementByMeltId, isBrowser, isHTMLElement, kbd, omit, overridable, styleToString, toWritableStores, addMeltEventListener, } from '../../internal/helpers/index.js'; | ||
workingTag.value = workingTag.value.trim(); | ||
// if it's not valid we don't add it to the tags list | ||
if (!isInputValid(workingTag.value)) | ||
return false; | ||
tags.update((current) => { | ||
@@ -133,2 +136,5 @@ current.push(workingTag); | ||
workingTag.value = workingTag.value.trim(); | ||
// if it's not valid we don't add it to the tags list | ||
if (!isInputValid(workingTag.value)) | ||
return false; | ||
// Update the tag matching the old id | ||
@@ -135,0 +141,0 @@ tags.update(($tags) => { |
@@ -36,5 +36,5 @@ import type { BuilderReturn } from '../../internal/types.js'; | ||
}; | ||
export type UpdateTag = (tag: Tag) => Promise<Tag>; | ||
export type RemoveTag = (tag: Tag) => Promise<boolean>; | ||
export type AddTag = (tag: string) => Promise<Tag | string>; | ||
export type UpdateTag = (tag: Tag) => Tag | Promise<Tag>; | ||
export type RemoveTag = (tag: Tag) => boolean | Promise<boolean>; | ||
export type AddTag = (tag: string) => (Tag | string) | Promise<Tag | string>; | ||
export type TagsInput = BuilderReturn<typeof createTagsInput>; | ||
@@ -41,0 +41,0 @@ export type TagsInputElements = TagsInput['elements']; |
{ | ||
"name": "@melt-ui/svelte", | ||
"version": "0.34.4", | ||
"version": "0.34.5", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "exports": { |
580192
13390