svseeds 0.3.2 → 0.3.3

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.
@@ -2,8 +2,8 @@
2
2
  export type TagsInputProps = {
3
3
  values?: string[], // bindable
4
4
  type?: "left" | "right" | "bottom", // <"left">
5
- confirm?: string[],
6
- trim?: boolean, // <false>
5
+ confirm?: string[], // <["Enter"]>
6
+ trim?: boolean, // <true>
7
7
  unique?: boolean, // <true>
8
8
  min?: TagCountValidation,
9
9
  max?: TagCountValidation,
@@ -32,7 +32,7 @@
32
32
  </script>
33
33
 
34
34
  <script lang="ts">
35
- let { values = $bindable([]), type = "left", confirm = [], trim = false, unique = true, min, max, validations = [], status = $bindable(""), style, element = $bindable(), deps }: TagsInputProps = $props();
35
+ let { values = $bindable([]), type = "left", confirm = [], trim = true, unique = true, min, max, validations = [], status = $bindable(""), style, element = $bindable(), deps }: TagsInputProps = $props();
36
36
 
37
37
  // *** Initialize *** //
38
38
  if (!status) status = STATE.DEFAULT;
@@ -57,8 +57,8 @@
57
57
  message = msg ?? bottom;
58
58
  element?.setCustomValidity(msg ?? "");
59
59
  }
60
- function validate(onchange?: boolean) {
61
- if (!value && onchange) return toNonInvalid(neutral);
60
+ function validate() {
61
+ if (!value) return toNonInvalid(neutral);
62
62
  for (const v of validations) {
63
63
  const msg = v(value, element?.validity);
64
64
  if (msg) return toInvalid(msg);
@@ -79,7 +79,7 @@
79
79
  // *** Event Handlers *** //
80
80
  function onchange(ev: Event) {
81
81
  attributes?.onchange?.(ev as any);
82
- validate(true);
82
+ validate();
83
83
  }
84
84
  function oninvalid(ev: Event) {
85
85
  attributes?.oninvalid?.(ev as any);
package/index.d.ts CHANGED
@@ -15,7 +15,7 @@ export { default as SelectField, type SelectFieldProps, type SelectFieldReqdProp
15
15
  export { default as Slider, type SliderProps, type SliderReqdProps, type SliderBindProps, type Range } from "./_svseeds/_Slider.svelte";
16
16
  export { default as Sortable, type SortableProps, type SortableReqdProps, type SortableBindProps, SortableItems } from "./_svseeds/_Sortable.svelte";
17
17
  export { default as Tabs, type TabsProps, type TabsReqdProps, type TabsBindProps } from "./_svseeds/_Tabs.svelte";
18
- export { default as TagsInput, type TagsInputProps, type TagsInputReqdProps, type TagsInputBindProps, type TagsInputDeps } from "./_svseeds/TagsInput.svelte";
18
+ export { default as TagsInput, type TagsInputProps, type TagsInputReqdProps, type TagsInputBindProps, type TagsInputDeps, type TagCountValidation } from "./_svseeds/TagsInput.svelte";
19
19
  export { default as TextField, type TextFieldProps, type TextFieldReqdProps, type TextFieldBindProps } from "./_svseeds/_TextField.svelte";
20
20
  export { default as TogglesField, type TogglesFieldProps, type TogglesFieldReqdProps, type TogglesFieldBindProps } from "./_svseeds/_TogglesField.svelte";
21
21
  export { default as Toggle, type ToggleProps, type ToggleReqdProps, type ToggleBindProps } from "./_svseeds/_Toggle.svelte";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "svseeds",
3
- "version": "0.3.2",
4
- "description": "Simple headless components for Svelte.",
3
+ "version": "0.3.3",
4
+ "description": "Simple components for Svelte.",
5
5
  "type": "module",
6
6
  "main": "./index.js",
7
7
  "module": "./index.js",