flowbite-svelte 1.10.16 → 1.10.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { computePosition, offset, flip, shift, autoUpdate } from "@floating-ui/dom";
|
|
7
7
|
import { onDestroy } from "svelte";
|
|
8
8
|
|
|
9
|
-
let { value = $bindable([]), placeholder = "Enter tags", class: className, classes, itemClass, spanClass, closeClass, inputClass, closeBtnSize = "xs", unique = false, availableTags = [], showHelper = false, showAvailableTags = false, allowNewTags =
|
|
9
|
+
let { value = $bindable([]), placeholder = "Enter tags", class: className, classes, itemClass, spanClass, closeClass, inputClass, closeBtnSize = "xs", unique = false, availableTags = [], showHelper = false, showAvailableTags = false, allowNewTags = true, ...restProps }: TagsProps = $props();
|
|
10
10
|
|
|
11
11
|
warnThemeDeprecation("Tags", { itemClass, spanClass, closeClass, inputClass }, { itemClass: "tag", spanClass: "span", closeClass: "close", inputClass: "input" });
|
|
12
12
|
let styling = $derived({
|
|
@@ -59,6 +59,12 @@
|
|
|
59
59
|
|
|
60
60
|
if (newTag.length === 0) return;
|
|
61
61
|
|
|
62
|
+
// Add validation: if allowNewTags is false and availableTags is empty, show error
|
|
63
|
+
if (!allowNewTags && availableTags.length === 0) {
|
|
64
|
+
errorMessage = "No available tags provided. Please add available tags or enable allowNewTags.";
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
62
68
|
const isInAvailable = availableTags.length === 0 || availableTags.some((tag) => tag.toLowerCase() === newTag.toLowerCase());
|
|
63
69
|
|
|
64
70
|
const alreadyExists = value.some((tag) => tag.toLowerCase() === newTag.toLowerCase());
|
|
@@ -203,6 +209,6 @@
|
|
|
203
209
|
@prop availableTags = []
|
|
204
210
|
@prop showHelper = false
|
|
205
211
|
@prop showAvailableTags = false
|
|
206
|
-
@prop allowNewTags =
|
|
212
|
+
@prop allowNewTags = true
|
|
207
213
|
@prop ...restProps
|
|
208
214
|
-->
|
|
@@ -17,7 +17,7 @@ import { type TagsProps } from "../..";
|
|
|
17
17
|
* @prop availableTags = []
|
|
18
18
|
* @prop showHelper = false
|
|
19
19
|
* @prop showAvailableTags = false
|
|
20
|
-
* @prop allowNewTags =
|
|
20
|
+
* @prop allowNewTags = true
|
|
21
21
|
* @prop ...restProps
|
|
22
22
|
*/
|
|
23
23
|
declare const Tags: import("svelte").Component<TagsProps, {}, "value">;
|