svseeds 0.4.6 → 0.4.8

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.
Files changed (51) hide show
  1. package/_svseeds/Accordion.svelte +17 -17
  2. package/_svseeds/Accordion.svelte.d.ts +10 -10
  3. package/_svseeds/DarkToggle.svelte +15 -15
  4. package/_svseeds/DarkToggle.svelte.d.ts +6 -6
  5. package/_svseeds/TagsInputField.svelte +48 -53
  6. package/_svseeds/TagsInputField.svelte.d.ts +22 -22
  7. package/_svseeds/ToggleGroupField.svelte +39 -39
  8. package/_svseeds/ToggleGroupField.svelte.d.ts +18 -18
  9. package/_svseeds/_Button.svelte +23 -22
  10. package/_svseeds/_Button.svelte.d.ts +13 -13
  11. package/_svseeds/_CheckField.svelte +33 -33
  12. package/_svseeds/_CheckField.svelte.d.ts +14 -14
  13. package/_svseeds/_ColorPicker.svelte +16 -16
  14. package/_svseeds/_ColorPicker.svelte.d.ts +10 -10
  15. package/_svseeds/_ComboBox.svelte +15 -15
  16. package/_svseeds/_ComboBox.svelte.d.ts +8 -8
  17. package/_svseeds/_ContextMenu.svelte +18 -18
  18. package/_svseeds/_ContextMenu.svelte.d.ts +12 -12
  19. package/_svseeds/_Disclosure.svelte +31 -29
  20. package/_svseeds/_Disclosure.svelte.d.ts +14 -14
  21. package/_svseeds/_HotkeyCapture.svelte +19 -19
  22. package/_svseeds/_HotkeyCapture.svelte.d.ts +10 -10
  23. package/_svseeds/_Modal.svelte +19 -19
  24. package/_svseeds/_Modal.svelte.d.ts +12 -12
  25. package/_svseeds/_ProgressTracker.svelte +27 -26
  26. package/_svseeds/_ProgressTracker.svelte.d.ts +15 -15
  27. package/_svseeds/_SelectField.svelte +36 -36
  28. package/_svseeds/_SelectField.svelte.d.ts +14 -14
  29. package/_svseeds/_Slider.svelte +26 -25
  30. package/_svseeds/_Slider.svelte.d.ts +15 -15
  31. package/_svseeds/_Sortable.svelte +35 -35
  32. package/_svseeds/_Sortable.svelte.d.ts +18 -18
  33. package/_svseeds/_Tabs.svelte +23 -23
  34. package/_svseeds/_Tabs.svelte.d.ts +10 -10
  35. package/_svseeds/{TagsInput.svelte → _TagsInput.svelte} +40 -47
  36. package/_svseeds/{TagsInput.svelte.d.ts → _TagsInput.svelte.d.ts} +17 -21
  37. package/_svseeds/_TextField.svelte +39 -39
  38. package/_svseeds/_TextField.svelte.d.ts +16 -16
  39. package/_svseeds/_Toggle.svelte +30 -34
  40. package/_svseeds/_Toggle.svelte.d.ts +16 -18
  41. package/_svseeds/_ToggleGroup.svelte +16 -16
  42. package/_svseeds/_ToggleGroup.svelte.d.ts +10 -10
  43. package/_svseeds/_Tooltip.svelte +21 -21
  44. package/_svseeds/_Tooltip.svelte.d.ts +13 -13
  45. package/_svseeds/core.d.ts +34 -17
  46. package/_svseeds/core.js +1 -1
  47. package/index.d.ts +3 -4
  48. package/index.js +2 -3
  49. package/package.json +1 -1
  50. package/_svseeds/_Badge.svelte +0 -73
  51. package/_svseeds/_Badge.svelte.d.ts +0 -33
@@ -1,14 +1,14 @@
1
1
  <!--
2
2
  @component
3
- default value: `<value>`
3
+ default value: `(value)`
4
4
  ```ts
5
5
  interface AccordionProps {
6
6
  labels?: string[];
7
- current?: number; // bindable <-1>
8
- status?: string; // bindable <STATE.NEUTRAL>
9
- style?: SVSStyle;
7
+ current?: number; // bindable (-1)
8
+ styling?: SVSClass;
9
+ variant?: string; // bindable (VARIANT.NEUTRAL)
10
10
  deps?: AccordionDeps;
11
- [key: string]: unknown | Snippet;
11
+ [key: string]: unknown | Snippet; // labels or contents of each disclosure
12
12
  }
13
13
  interface AccordionDeps {
14
14
  svsDisclosure?: Omit<DisclosureProps, DisclosureReqdProps | DisclosureBindProps>;
@@ -18,17 +18,17 @@
18
18
  <script module lang="ts">
19
19
  export interface AccordionProps {
20
20
  labels?: string[];
21
- current?: number; // bindable <-1>
22
- status?: string; // bindable <STATE.NEUTRAL>
23
- style?: SVSStyle;
21
+ current?: number; // bindable (-1)
22
+ styling?: SVSClass;
23
+ variant?: string; // bindable (VARIANT.NEUTRAL)
24
24
  deps?: AccordionDeps;
25
- [key: string]: unknown | Snippet;
25
+ [key: string]: unknown | Snippet; // labels or contents of each disclosure
26
26
  }
27
27
  export interface AccordionDeps {
28
28
  svsDisclosure?: Omit<DisclosureProps, DisclosureReqdProps | DisclosureBindProps>;
29
29
  }
30
30
  export type AccordionReqdProps = never;
31
- export type AccordionBindProps = "current" | "status";
31
+ export type AccordionBindProps = "current" | "variant";
32
32
 
33
33
  type NamedId = { id: string, name: string };
34
34
  const preset = "svs-accordion";
@@ -45,16 +45,16 @@
45
45
  }
46
46
 
47
47
  import { type Snippet, untrack } from "svelte";
48
- import { type SVSStyle, STATE, PARTS, elemId, fnClass, omit } from "./core";
48
+ import { type SVSClass, VARIANT, PARTS, elemId, fnClass, omit } from "./core";
49
49
  import Disclosure, { type DisclosureProps, type DisclosureReqdProps, type DisclosureBindProps } from "./_Disclosure.svelte";
50
50
  </script>
51
51
 
52
52
  <script lang="ts">
53
- let { labels = [], current = $bindable(-1), status = $bindable(""), style, deps, ...rest }: AccordionProps = $props();
53
+ let { labels = [], current = $bindable(-1), styling, variant = $bindable(""), deps, ...rest }: AccordionProps = $props();
54
54
 
55
55
  // *** Initialize *** //
56
- if (!status) status = STATE.NEUTRAL;
57
- const cls = fnClass(preset, style);
56
+ if (!variant) variant = VARIANT.NEUTRAL;
57
+ const cls = fnClass(preset, styling);
58
58
  const isStrLabel = labels.length > 0;
59
59
  const lbls = toNamedId(isStrLabel ? labels : getSnippetNames(roleLabel, rest));
60
60
  const panels = getSnippetNames(rolePanel, rest);
@@ -66,8 +66,8 @@
66
66
 
67
67
  // *** Initialize Deps *** //
68
68
  const svsDisclosure = {
69
- ...omit(deps?.svsDisclosure, "attributes", "style"),
70
- style: deps?.svsDisclosure?.style ?? `${preset} svs-disclosure`,
69
+ ...omit(deps?.svsDisclosure, "attributes", "styling"),
70
+ styling: deps?.svsDisclosure?.styling ?? `${preset} svs-disclosure`,
71
71
  };
72
72
 
73
73
  // *** Bind Handlers *** //
@@ -101,7 +101,7 @@
101
101
  <!---------------------------------------->
102
102
 
103
103
  {#if isValidAccordion}
104
- <div class={cls(PARTS.WHOLE, status)} role="group">
104
+ <div class={cls(PARTS.WHOLE, variant)} role="group">
105
105
  {#each lbls as { id, name }, i (id)}
106
106
  {@const ontoggle = exclusiveToggle(i)}
107
107
  <Disclosure bind:open={opens[i]} bind:element={elems[i]} label={isStrLabel ? name : (rest[name] as Snippet)} attributes={{...deps?.svsDisclosure?.attributes, ontoggle}} {...svsDisclosure}>
@@ -1,8 +1,8 @@
1
1
  export interface AccordionProps {
2
2
  labels?: string[];
3
3
  current?: number;
4
- status?: string;
5
- style?: SVSStyle;
4
+ styling?: SVSClass;
5
+ variant?: string;
6
6
  deps?: AccordionDeps;
7
7
  [key: string]: unknown | Snippet;
8
8
  }
@@ -10,26 +10,26 @@ export interface AccordionDeps {
10
10
  svsDisclosure?: Omit<DisclosureProps, DisclosureReqdProps | DisclosureBindProps>;
11
11
  }
12
12
  export type AccordionReqdProps = never;
13
- export type AccordionBindProps = "current" | "status";
13
+ export type AccordionBindProps = "current" | "variant";
14
14
  import { type Snippet } from "svelte";
15
- import { type SVSStyle } from "./core";
15
+ import { type SVSClass } from "./core";
16
16
  import { type DisclosureProps, type DisclosureReqdProps, type DisclosureBindProps } from "./_Disclosure.svelte";
17
17
  /**
18
- * default value: `<value>`
18
+ * default value: `(value)`
19
19
  * ```ts
20
20
  * interface AccordionProps {
21
21
  * labels?: string[];
22
- * current?: number; // bindable <-1>
23
- * status?: string; // bindable <STATE.NEUTRAL>
24
- * style?: SVSStyle;
22
+ * current?: number; // bindable (-1)
23
+ * styling?: SVSClass;
24
+ * variant?: string; // bindable (VARIANT.NEUTRAL)
25
25
  * deps?: AccordionDeps;
26
- * [key: string]: unknown | Snippet;
26
+ * [key: string]: unknown | Snippet; // labels or contents of each disclosure
27
27
  * }
28
28
  * interface AccordionDeps {
29
29
  * svsDisclosure?: Omit<DisclosureProps, DisclosureReqdProps | DisclosureBindProps>;
30
30
  * }
31
31
  * ```
32
32
  */
33
- declare const Accordion: import("svelte").Component<AccordionProps, {}, "status" | "current">;
33
+ declare const Accordion: import("svelte").Component<AccordionProps, {}, "variant" | "current">;
34
34
  type Accordion = ReturnType<typeof Accordion>;
35
35
  export default Accordion;
@@ -1,11 +1,11 @@
1
1
  <!--
2
2
  @component
3
- default value: `<value>`
3
+ default value: `(value)`
4
4
  ```ts
5
5
  interface DarkToggleProps {
6
- dark?: boolean; // bindable <(prefers-color-scheme)>
7
- status?: string; // bindable <STATE.NEUTRAL>
6
+ dark?: boolean; // bindable (prefers-color-scheme)
8
7
  element?: HTMLButtonElement; // bindable
8
+ variant?: string; // bindable (VARIANT.NEUTRAL)
9
9
  deps?: DarkToggleDeps;
10
10
  }
11
11
  interface DarkToggleDeps {
@@ -15,16 +15,16 @@
15
15
  -->
16
16
  <script module lang="ts">
17
17
  export interface DarkToggleProps {
18
- dark?: boolean; // bindable <(prefers-color-scheme)>
19
- status?: string; // bindable <STATE.NEUTRAL>
18
+ dark?: boolean; // bindable (prefers-color-scheme)
20
19
  element?: HTMLButtonElement; // bindable
20
+ variant?: string; // bindable (VARIANT.NEUTRAL)
21
21
  deps?: DarkToggleDeps;
22
22
  }
23
23
  export interface DarkToggleDeps {
24
24
  svsToggle?: Omit<ToggleProps, ToggleReqdProps | ToggleBindProps>;
25
25
  }
26
26
  export type DarkToggleReqdProps = never;
27
- export type DarkToggleBindProps = "dark" | "status" | "element";
27
+ export type DarkToggleBindProps = "dark" | "variant" | "element";
28
28
 
29
29
  export const THEME = { LIGHT: "light", DARK: "dark" } as const;
30
30
  export function setThemeToRoot(theme?: string) {
@@ -137,22 +137,22 @@
137
137
  }
138
138
  const theme = new Theme();
139
139
 
140
- import { STATE, omit } from "./core";
140
+ import { VARIANT, omit } from "./core";
141
141
  import Toggle, { type ToggleProps, type ToggleReqdProps, type ToggleBindProps } from "./_Toggle.svelte";
142
142
  </script>
143
143
 
144
144
  <script lang="ts">
145
- let { dark = $bindable(), status = $bindable(""), element = $bindable(), deps }: DarkToggleProps = $props();
145
+ let { dark = $bindable(), variant = $bindable(""), element = $bindable(), deps }: DarkToggleProps = $props();
146
146
 
147
147
  // *** Initialize *** //
148
- if (!status) status = STATE.NEUTRAL;
148
+ if (!variant) variant = VARIANT.NEUTRAL;
149
149
  if (dark === undefined) dark = theme.dark;
150
150
  theme.dark = dark;
151
151
 
152
152
  // *** Initialize Deps *** //
153
153
  const svsToggle = {
154
- ...omit(deps?.svsToggle, "main", "style", "attributes"),
155
- style: deps?.svsToggle?.style ?? `${preset} svs-toggle`,
154
+ ...omit(deps?.svsToggle, "children", "styling", "attributes"),
155
+ styling: deps?.svsToggle?.styling ?? `${preset} svs-toggle`,
156
156
  ariaLabel,
157
157
  attributes: {
158
158
  ...deps?.svsToggle?.attributes,
@@ -165,10 +165,10 @@
165
165
 
166
166
  <!---------------------------------------->
167
167
 
168
- <Toggle bind:value={dark} bind:status bind:element {...svsToggle}>
169
- {#snippet main(status: string, value: boolean, element: HTMLButtonElement | undefined)}
170
- {#if deps?.svsToggle?.main}
171
- {@render deps.svsToggle.main(status, value, element)}
168
+ <Toggle bind:value={dark} bind:variant bind:element {...svsToggle}>
169
+ {#snippet children(value: boolean, variant: string, element: HTMLButtonElement | undefined)}
170
+ {#if deps?.svsToggle?.children}
171
+ {@render deps.svsToggle.children(value, variant, element)}
172
172
  {:else}
173
173
  {#if value}
174
174
  {@render svgDark()}
@@ -1,14 +1,14 @@
1
1
  export interface DarkToggleProps {
2
2
  dark?: boolean;
3
- status?: string;
4
3
  element?: HTMLButtonElement;
4
+ variant?: string;
5
5
  deps?: DarkToggleDeps;
6
6
  }
7
7
  export interface DarkToggleDeps {
8
8
  svsToggle?: Omit<ToggleProps, ToggleReqdProps | ToggleBindProps>;
9
9
  }
10
10
  export type DarkToggleReqdProps = never;
11
- export type DarkToggleBindProps = "dark" | "status" | "element";
11
+ export type DarkToggleBindProps = "dark" | "variant" | "element";
12
12
  export declare const THEME: {
13
13
  readonly LIGHT: "light";
14
14
  readonly DARK: "dark";
@@ -16,12 +16,12 @@ export declare const THEME: {
16
16
  export declare function setThemeToRoot(theme?: string): void;
17
17
  import { type ToggleProps, type ToggleReqdProps, type ToggleBindProps } from "./_Toggle.svelte";
18
18
  /**
19
- * default value: `<value>`
19
+ * default value: `(value)`
20
20
  * ```ts
21
21
  * interface DarkToggleProps {
22
- * dark?: boolean; // bindable <(prefers-color-scheme)>
23
- * status?: string; // bindable <STATE.NEUTRAL>
22
+ * dark?: boolean; // bindable (prefers-color-scheme)
24
23
  * element?: HTMLButtonElement; // bindable
24
+ * variant?: string; // bindable (VARIANT.NEUTRAL)
25
25
  * deps?: DarkToggleDeps;
26
26
  * }
27
27
  * interface DarkToggleDeps {
@@ -29,6 +29,6 @@ import { type ToggleProps, type ToggleReqdProps, type ToggleBindProps } from "./
29
29
  * }
30
30
  * ```
31
31
  */
32
- declare const DarkToggle: import("svelte").Component<DarkToggleProps, {}, "status" | "element" | "dark">;
32
+ declare const DarkToggle: import("svelte").Component<DarkToggleProps, {}, "variant" | "element" | "dark">;
33
33
  type DarkToggle = ReturnType<typeof DarkToggle>;
34
34
  export default DarkToggle;
@@ -1,30 +1,30 @@
1
1
  <!--
2
2
  @component
3
- default value: `<value>`
3
+ default value: `(value)`
4
4
  ```ts
5
5
  interface TagsInputFieldProps {
6
6
  label?: string;
7
7
  extra?: string;
8
- aux?: Snippet<[string, string[], HTMLInputElement | undefined]>; // Snippet<[status,values,element]>
9
- left?: Snippet<[string, string[], HTMLInputElement | undefined]>; // Snippet<[status,values,element]>
10
- right?: Snippet<[string, string[], HTMLInputElement | undefined]>; // Snippet<[status,values,element]>
8
+ aux?: Snippet<[string[], string, HTMLInputElement | undefined]>; // Snippet<[values,variant,element]>
9
+ left?: Snippet<[string[], string, HTMLInputElement | undefined]>; // Snippet<[values,variant,element]>
10
+ right?: Snippet<[string[], string, HTMLInputElement | undefined]>; // Snippet<[values,variant,element]>
11
11
  bottom?: string;
12
- descFirst?: boolean; // <false>
12
+ descFirst?: boolean; // (false)
13
13
  values?: string[]; // bindable
14
14
  min?: TagsInputFieldCountValidation;
15
15
  max?: TagsInputFieldCountValidation;
16
16
  constraints?: TagsInputFieldConstraint[];
17
17
  validations?: TagsInputFieldValidation[];
18
- status?: string; // bindable <STATE.NEUTRAL>
19
- style?: SVSStyle;
20
18
  element?: HTMLInputElement; // bindable
19
+ styling?: SVSClass;
20
+ variant?: string; // bindable (VARIANT.NEUTRAL)
21
21
  deps?: TagsInputFieldDeps;
22
22
  }
23
23
  interface TagsInputFieldDeps extends TagsInputDeps {
24
24
  svsTagsInput?: Omit<TagsInputProps, TagsInputReqdProps | TagsInputBindProps | "deps">;
25
25
  }
26
- type TagsInputFieldConstraint = (value: string, validity: ValidityState) => string;
27
- type TagsInputFieldValidation = (values: string[], validity: ValidityState) => string;
26
+ type TagsInputFieldConstraint = (value: string, validity: ValidityState) => string | undefined;
27
+ type TagsInputFieldValidation = (values: string[], validity: ValidityState) => string | undefined;
28
28
  type TagsInputFieldCountValidation = {
29
29
  value: number;
30
30
  message: string;
@@ -35,43 +35,43 @@
35
35
  export interface TagsInputFieldProps {
36
36
  label?: string;
37
37
  extra?: string;
38
- aux?: Snippet<[string, string[], HTMLInputElement | undefined]>; // Snippet<[status,values,element]>
39
- left?: Snippet<[string, string[], HTMLInputElement | undefined]>; // Snippet<[status,values,element]>
40
- right?: Snippet<[string, string[], HTMLInputElement | undefined]>; // Snippet<[status,values,element]>
38
+ aux?: Snippet<[string[], string, HTMLInputElement | undefined]>; // Snippet<[values,variant,element]>
39
+ left?: Snippet<[string[], string, HTMLInputElement | undefined]>; // Snippet<[values,variant,element]>
40
+ right?: Snippet<[string[], string, HTMLInputElement | undefined]>; // Snippet<[values,variant,element]>
41
41
  bottom?: string;
42
- descFirst?: boolean; // <false>
42
+ descFirst?: boolean; // (false)
43
43
  values?: string[]; // bindable
44
44
  min?: TagsInputFieldCountValidation;
45
45
  max?: TagsInputFieldCountValidation;
46
46
  constraints?: TagsInputFieldConstraint[];
47
47
  validations?: TagsInputFieldValidation[];
48
- status?: string; // bindable <STATE.NEUTRAL>
49
- style?: SVSStyle;
50
48
  element?: HTMLInputElement; // bindable
49
+ styling?: SVSClass;
50
+ variant?: string; // bindable (VARIANT.NEUTRAL)
51
51
  deps?: TagsInputFieldDeps;
52
52
  }
53
- export interface TagsInputFieldDeps extends TagsInputDeps {
54
- svsTagsInput?: Omit<TagsInputProps, TagsInputReqdProps | TagsInputBindProps | "deps">;
53
+ export interface TagsInputFieldDeps {
54
+ svsTagsInput?: Omit<TagsInputProps, TagsInputReqdProps | TagsInputBindProps>;
55
55
  }
56
56
  export type TagsInputFieldReqdProps = never;
57
- export type TagsInputFieldBindProps = "values" | "status" | "element";
58
- export type TagsInputFieldConstraint = (value: string, validity: ValidityState) => string;
59
- export type TagsInputFieldValidation = (values: string[], validity: ValidityState) => string;
57
+ export type TagsInputFieldBindProps = "values" | "variant" | "element";
58
+ export type TagsInputFieldConstraint = (value: string, validity: ValidityState) => string | undefined;
59
+ export type TagsInputFieldValidation = (values: string[], validity: ValidityState) => string | undefined;
60
60
  export type TagsInputFieldCountValidation = { value: number, message: string };
61
61
 
62
62
  const preset = "svs-tags-input-field";
63
63
 
64
64
  import { type Snippet, untrack } from "svelte";
65
- import { type SVSStyle, STATE, PARTS, elemId, fnClass, isNeutral, omit } from "./core";
66
- import TagsInput, { type TagsInputProps, type TagsInputReqdProps, type TagsInputBindProps, type TagsInputDeps } from "./TagsInput.svelte";
65
+ import { type SVSClass, VARIANT, PARTS, elemId, fnClass, isNeutral, omit } from "./core";
66
+ import TagsInput, { type TagsInputProps, type TagsInputReqdProps, type TagsInputBindProps } from "./_TagsInput.svelte";
67
67
  </script>
68
68
 
69
69
  <script lang="ts">
70
- let { label, extra, aux, left, right, bottom, descFirst = false, values = $bindable([]), min, max, constraints = [], validations = [], status = $bindable(""), style, element = $bindable(), deps }: TagsInputFieldProps = $props();
70
+ let { label, extra, aux, left, right, bottom, descFirst = false, values = $bindable([]), min, max, constraints = [], validations = [], element = $bindable(), styling, variant = $bindable(""), deps }: TagsInputFieldProps = $props();
71
71
 
72
72
  // *** Initialize *** //
73
- if (!status) status = STATE.NEUTRAL;
74
- const cls = fnClass(preset, style);
73
+ if (!variant) variant = VARIANT.NEUTRAL;
74
+ const cls = fnClass(preset, styling);
75
75
  const id = deps?.svsTagsInput?.attributes?.id ? deps.svsTagsInput.attributes.id : elemId.get(label?.trim());
76
76
  const idLabel = elemId.get(label?.trim());
77
77
  const idDesc = elemId.get(bottom?.trim());
@@ -82,14 +82,10 @@
82
82
  if (min) validations.unshift(() => values.length < min.value ? min.message : "");
83
83
 
84
84
  // *** Initialize Deps *** //
85
- const svsBadge = {
86
- ...omit(deps?.svsBadge, "style"),
87
- style: deps?.svsBadge?.style ?? `${preset} svs-tags-input svs-badge`,
88
- };
89
85
  const svsTagsInput = {
90
- ...omit(deps?.svsTagsInput, "style", "attributes"),
86
+ ...omit(deps?.svsTagsInput, "styling", "attributes"),
91
87
  events: { onadd, onremove: deps?.svsTagsInput?.events?.onremove },
92
- style: deps?.svsTagsInput?.style ?? `${preset} svs-tags-input`,
88
+ styling: deps?.svsTagsInput?.styling ?? `${preset} svs-tags-input`,
93
89
  attributes: {
94
90
  ...omit(deps?.svsTagsInput?.attributes, "id", "onchange", "oninvalid", "aria-describedby"),
95
91
  id,
@@ -100,19 +96,19 @@
100
96
  };
101
97
 
102
98
  // *** Status *** //
103
- let neutral = isNeutral(status) ? status : STATE.NEUTRAL;
104
- $effect(() => { neutral = isNeutral(status) ? status : neutral });
105
- let live = $derived(status === STATE.INACTIVE ? "alert" : "status");
106
- let idMsg = $derived(status === STATE.INACTIVE && message?.trim() ? idErr : undefined);
99
+ let neutral = isNeutral(variant) ? variant : VARIANT.NEUTRAL;
100
+ $effect(() => { neutral = isNeutral(variant) ? variant : neutral });
101
+ let live = $derived(variant === VARIANT.INACTIVE ? "alert" : "status");
102
+ let idMsg = $derived(variant === VARIANT.INACTIVE && message?.trim() ? idErr : undefined);
107
103
  function shift(oninvalid: boolean = false, msg?: string) {
108
104
  const vmsg = element?.validationMessage ?? "";
109
- status = getStatus(oninvalid, vmsg, msg);
110
- message = status === STATE.INACTIVE ? msg ? msg : vmsg ? vmsg : bottom : bottom;
105
+ variant = getStatus(oninvalid, vmsg, msg);
106
+ message = variant === VARIANT.INACTIVE ? msg ? msg : vmsg ? vmsg : bottom : bottom;
111
107
  }
112
108
  function getStatus(oninvalid: boolean, vmsg: string, msg?: string): string {
113
- if (msg || (oninvalid && vmsg)) return STATE.INACTIVE;
109
+ if (msg || (oninvalid && vmsg)) return VARIANT.INACTIVE;
114
110
  if (!values.length || vmsg) return neutral;
115
- return STATE.ACTIVE;
111
+ return VARIANT.ACTIVE;
116
112
  }
117
113
  function verify() {
118
114
  if (!element) return;
@@ -136,9 +132,9 @@
136
132
  // *** Event Handlers *** //
137
133
  function onadd(values: string[], value: string): void | boolean {
138
134
  if (deps?.svsTagsInput?.events?.onadd?.(values, value)) return true;
139
- status = neutral;
135
+ variant = neutral;
140
136
  shift(false, check());
141
- return status === STATE.INACTIVE;
137
+ return variant === VARIANT.INACTIVE;
142
138
  }
143
139
  function check(): string | undefined {
144
140
  if (!element) return;
@@ -149,7 +145,7 @@
149
145
  }
150
146
  function onchange(ev: Event) {
151
147
  deps?.svsTagsInput?.attributes?.onchange?.(ev as any);
152
- if (!isNeutral(status)) shift();
148
+ if (!isNeutral(variant)) shift();
153
149
  }
154
150
  function oninvalid(ev: Event) {
155
151
  deps?.svsTagsInput?.attributes?.oninvalid?.(ev as any);
@@ -161,19 +157,19 @@
161
157
 
162
158
  <!---------------------------------------->
163
159
 
164
- <div class={cls(PARTS.WHOLE, status)} role="group" aria-labelledby={idLabel}>
160
+ <div class={cls(PARTS.WHOLE, variant)} role="group" aria-labelledby={idLabel}>
165
161
  {#if aux}
166
- <div class={cls(PARTS.TOP, status)}>
162
+ <div class={cls(PARTS.TOP, variant)}>
167
163
  {@render lbl()}
168
- <span class={cls(PARTS.AUX, status)}>{@render aux(status, values, element)}</span>
164
+ <span class={cls(PARTS.AUX, variant)}>{@render aux(values, variant, element)}</span>
169
165
  </div>
170
166
  {:else}
171
167
  {@render lbl()}
172
168
  {/if}
173
169
  {@render desc(descFirst)}
174
- <div class={cls(PARTS.MIDDLE, status)}>
170
+ <div class={cls(PARTS.MIDDLE, variant)}>
175
171
  {@render side(PARTS.LEFT, left)}
176
- <TagsInput bind:values bind:value bind:status bind:element bind:ariaErrMsgId={idMsg} {...svsTagsInput} deps={{ svsBadge }} />
172
+ <TagsInput bind:values bind:value bind:variant bind:element bind:ariaErrMsgId={idMsg} {...svsTagsInput} />
177
173
  {@render side(PARTS.RIGHT, right)}
178
174
  </div>
179
175
  {@render desc(!descFirst)}
@@ -181,22 +177,21 @@
181
177
 
182
178
  {#snippet lbl()}
183
179
  {#if label?.trim()}
184
- <label class={cls(PARTS.LABEL, status)} for={id} id={idLabel}>
180
+ <label class={cls(PARTS.LABEL, variant)} for={id} id={idLabel}>
185
181
  {label}
186
182
  {#if extra?.trim()}
187
- <span class={cls(PARTS.EXTRA, status)}>{extra}</span>
183
+ <span class={cls(PARTS.EXTRA, variant)}>{extra}</span>
188
184
  {/if}
189
185
  </label>
190
186
  {/if}
191
187
  {/snippet}
192
- {#snippet side(area: string, body?: Snippet<[string, string[], HTMLInputElement | undefined]>)}
188
+ {#snippet side(area: string, body?: Snippet<[string[], string, HTMLInputElement | undefined]>)}
193
189
  {#if body}
194
- <span class={cls(area, status)}>{@render body(status, values, element)}</span>
190
+ <span class={cls(area, variant)}>{@render body(values, variant, element)}</span>
195
191
  {/if}
196
192
  {/snippet}
197
193
  {#snippet desc(show: boolean)}
198
194
  {#if show && message?.trim()}
199
- <div class={cls(PARTS.BOTTOM, status)} id={idDesc ?? idErr} role={live}>{message}</div>
195
+ <div class={cls(PARTS.BOTTOM, variant)} id={idDesc ?? idErr} role={live}>{message}</div>
200
196
  {/if}
201
197
  {/snippet}
202
-
@@ -1,9 +1,9 @@
1
1
  export interface TagsInputFieldProps {
2
2
  label?: string;
3
3
  extra?: string;
4
- aux?: Snippet<[string, string[], HTMLInputElement | undefined]>;
5
- left?: Snippet<[string, string[], HTMLInputElement | undefined]>;
6
- right?: Snippet<[string, string[], HTMLInputElement | undefined]>;
4
+ aux?: Snippet<[string[], string, HTMLInputElement | undefined]>;
5
+ left?: Snippet<[string[], string, HTMLInputElement | undefined]>;
6
+ right?: Snippet<[string[], string, HTMLInputElement | undefined]>;
7
7
  bottom?: string;
8
8
  descFirst?: boolean;
9
9
  values?: string[];
@@ -11,57 +11,57 @@ export interface TagsInputFieldProps {
11
11
  max?: TagsInputFieldCountValidation;
12
12
  constraints?: TagsInputFieldConstraint[];
13
13
  validations?: TagsInputFieldValidation[];
14
- status?: string;
15
- style?: SVSStyle;
16
14
  element?: HTMLInputElement;
15
+ styling?: SVSClass;
16
+ variant?: string;
17
17
  deps?: TagsInputFieldDeps;
18
18
  }
19
- export interface TagsInputFieldDeps extends TagsInputDeps {
20
- svsTagsInput?: Omit<TagsInputProps, TagsInputReqdProps | TagsInputBindProps | "deps">;
19
+ export interface TagsInputFieldDeps {
20
+ svsTagsInput?: Omit<TagsInputProps, TagsInputReqdProps | TagsInputBindProps>;
21
21
  }
22
22
  export type TagsInputFieldReqdProps = never;
23
- export type TagsInputFieldBindProps = "values" | "status" | "element";
24
- export type TagsInputFieldConstraint = (value: string, validity: ValidityState) => string;
25
- export type TagsInputFieldValidation = (values: string[], validity: ValidityState) => string;
23
+ export type TagsInputFieldBindProps = "values" | "variant" | "element";
24
+ export type TagsInputFieldConstraint = (value: string, validity: ValidityState) => string | undefined;
25
+ export type TagsInputFieldValidation = (values: string[], validity: ValidityState) => string | undefined;
26
26
  export type TagsInputFieldCountValidation = {
27
27
  value: number;
28
28
  message: string;
29
29
  };
30
30
  import { type Snippet } from "svelte";
31
- import { type SVSStyle } from "./core";
32
- import { type TagsInputProps, type TagsInputReqdProps, type TagsInputBindProps, type TagsInputDeps } from "./TagsInput.svelte";
31
+ import { type SVSClass } from "./core";
32
+ import { type TagsInputProps, type TagsInputReqdProps, type TagsInputBindProps } from "./_TagsInput.svelte";
33
33
  /**
34
- * default value: `<value>`
34
+ * default value: `(value)`
35
35
  * ```ts
36
36
  * interface TagsInputFieldProps {
37
37
  * label?: string;
38
38
  * extra?: string;
39
- * aux?: Snippet<[string, string[], HTMLInputElement | undefined]>; // Snippet<[status,values,element]>
40
- * left?: Snippet<[string, string[], HTMLInputElement | undefined]>; // Snippet<[status,values,element]>
41
- * right?: Snippet<[string, string[], HTMLInputElement | undefined]>; // Snippet<[status,values,element]>
39
+ * aux?: Snippet<[string[], string, HTMLInputElement | undefined]>; // Snippet<[values,variant,element]>
40
+ * left?: Snippet<[string[], string, HTMLInputElement | undefined]>; // Snippet<[values,variant,element]>
41
+ * right?: Snippet<[string[], string, HTMLInputElement | undefined]>; // Snippet<[values,variant,element]>
42
42
  * bottom?: string;
43
- * descFirst?: boolean; // <false>
43
+ * descFirst?: boolean; // (false)
44
44
  * values?: string[]; // bindable
45
45
  * min?: TagsInputFieldCountValidation;
46
46
  * max?: TagsInputFieldCountValidation;
47
47
  * constraints?: TagsInputFieldConstraint[];
48
48
  * validations?: TagsInputFieldValidation[];
49
- * status?: string; // bindable <STATE.NEUTRAL>
50
- * style?: SVSStyle;
51
49
  * element?: HTMLInputElement; // bindable
50
+ * styling?: SVSClass;
51
+ * variant?: string; // bindable (VARIANT.NEUTRAL)
52
52
  * deps?: TagsInputFieldDeps;
53
53
  * }
54
54
  * interface TagsInputFieldDeps extends TagsInputDeps {
55
55
  * svsTagsInput?: Omit<TagsInputProps, TagsInputReqdProps | TagsInputBindProps | "deps">;
56
56
  * }
57
- * type TagsInputFieldConstraint = (value: string, validity: ValidityState) => string;
58
- * type TagsInputFieldValidation = (values: string[], validity: ValidityState) => string;
57
+ * type TagsInputFieldConstraint = (value: string, validity: ValidityState) => string | undefined;
58
+ * type TagsInputFieldValidation = (values: string[], validity: ValidityState) => string | undefined;
59
59
  * type TagsInputFieldCountValidation = {
60
60
  * value: number;
61
61
  * message: string;
62
62
  * };
63
63
  * ```
64
64
  */
65
- declare const TagsInputField: import("svelte").Component<TagsInputFieldProps, {}, "status" | "element" | "values">;
65
+ declare const TagsInputField: import("svelte").Component<TagsInputFieldProps, {}, "variant" | "element" | "values">;
66
66
  type TagsInputField = ReturnType<typeof TagsInputField>;
67
67
  export default TagsInputField;