@melt-ui/svelte
Advanced tools
Comparing version 0.33.1 to 0.34.0
@@ -22,2 +22,3 @@ export * from './accordion/index.js'; | ||
export * from './tabs/index.js'; | ||
export * from './table-of-contents/index.js'; | ||
export * from './tags-input/index.js'; | ||
@@ -24,0 +25,0 @@ export * from './toast/index.js'; |
@@ -22,2 +22,3 @@ export * from './accordion/index.js'; | ||
export * from './tabs/index.js'; | ||
export * from './table-of-contents/index.js'; | ||
export * from './tags-input/index.js'; | ||
@@ -24,0 +25,0 @@ export * from './toast/index.js'; |
@@ -76,2 +76,3 @@ /// <reference types="svelte" /> | ||
unique: import("svelte/store").Writable<boolean>; | ||
trim: import("svelte/store").Writable<boolean>; | ||
addOnPaste: import("svelte/store").Writable<boolean>; | ||
@@ -78,0 +79,0 @@ maxTags: import("svelte/store").Writable<number | undefined>; |
@@ -11,2 +11,3 @@ import { builder, createElHelpers, effect, executeCallbacks, generateId, getElementByMeltId, isBrowser, isHTMLElement, kbd, omit, overridable, styleToString, toWritableStores, addMeltEventListener, } from '../../internal/helpers/index.js'; | ||
unique: false, | ||
trim: true, | ||
blur: 'nothing', | ||
@@ -30,3 +31,3 @@ addOnPaste: false, | ||
const options = toWritableStores(omit(withDefaults, 'tags')); | ||
const { placeholder, disabled, editable, unique, blur, addOnPaste, allowed, denied, add, remove, update, maxTags, } = options; | ||
const { placeholder, disabled, editable, unique, trim, blur, addOnPaste, allowed, denied, add, remove, update, maxTags, } = options; | ||
// A store representing the current input value. A readable version is exposed to the | ||
@@ -63,3 +64,6 @@ // user | ||
const $maxTags = get(maxTags); | ||
// Tag uniqueness | ||
// Trim the validation value before validations | ||
if (get(trim)) | ||
v = v.trim(); | ||
// Tag uniqueness | ||
if (get(unique) && $editing?.value !== v) { | ||
@@ -101,2 +105,5 @@ const index = $tags.findIndex((tag) => tag.value === v); | ||
} | ||
// Trim the value, only after the user defined add function | ||
if (get(trim)) | ||
workingTag.value = workingTag.value.trim(); | ||
tags.update((current) => { | ||
@@ -126,2 +133,5 @@ current.push(workingTag); | ||
} | ||
// Trim the value, only after the user defined update function | ||
if (get(trim)) | ||
workingTag.value = workingTag.value.trim(); | ||
// Update the tag matching the old id | ||
@@ -128,0 +138,0 @@ tags.update(($tags) => { |
@@ -14,2 +14,3 @@ import type { BuilderReturn } from '../../internal/types.js'; | ||
unique?: boolean; | ||
trim?: boolean; | ||
blur?: Blur; | ||
@@ -16,0 +17,0 @@ addOnPaste?: boolean; |
{ | ||
"name": "@melt-ui/svelte", | ||
"version": "0.33.1", | ||
"version": "0.34.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "exports": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
578794
325
13337