svseeds 0.4.3 → 0.4.5

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.
@@ -8,7 +8,7 @@
8
8
  element?: HTMLButtonElement; // bindable
9
9
  deps?: DarkToggleDeps;
10
10
  }
11
- export interface DarkToggleDeps {
11
+ interface DarkToggleDeps {
12
12
  svsToggle?: Omit<ToggleProps, ToggleReqdProps | ToggleBindProps>;
13
13
  }
14
14
  ```
@@ -24,7 +24,7 @@ import { type ToggleProps, type ToggleReqdProps, type ToggleBindProps } from "./
24
24
  * element?: HTMLButtonElement; // bindable
25
25
  * deps?: DarkToggleDeps;
26
26
  * }
27
- * export interface DarkToggleDeps {
27
+ * interface DarkToggleDeps {
28
28
  * svsToggle?: Omit<ToggleProps, ToggleReqdProps | ToggleBindProps>;
29
29
  * }
30
30
  * ```
@@ -16,6 +16,7 @@
16
16
  validations?: ToggleGroupFieldValidation[];
17
17
  status?: string; // bindable <STATE.NEUTRAL>
18
18
  style?: SVSStyle;
19
+ name?: string;
19
20
  deps?: ToggleGroupFieldDeps;
20
21
  [key: string]: unknown | Snippet;
21
22
  }
@@ -40,6 +41,7 @@
40
41
  validations?: ToggleGroupFieldValidation[];
41
42
  status?: string; // bindable <STATE.NEUTRAL>
42
43
  style?: SVSStyle;
44
+ name?: string;
43
45
  deps?: ToggleGroupFieldDeps;
44
46
  [key: string]: unknown | Snippet;
45
47
  }
@@ -60,7 +62,7 @@
60
62
  </script>
61
63
 
62
64
  <script lang="ts">
63
- let { options, label, extra, aux, left, right, bottom, descFirst = false, values = $bindable([]), multiple = true, validations = [], status = $bindable(""), style, attributes, elements = $bindable([]), deps, ...rest }: ToggleGroupFieldProps = $props();
65
+ let { options, label, extra, aux, left, right, bottom, descFirst = false, values = $bindable([]), multiple = true, validations = [], status = $bindable(""), style, name, deps, ...rest }: ToggleGroupFieldProps = $props();
64
66
 
65
67
  // *** Initialize *** //
66
68
  if (!status) status = STATE.NEUTRAL;
@@ -131,7 +133,7 @@
131
133
  {@render desc(descFirst)}
132
134
  <div class={cls(PARTS.MIDDLE, status)}>
133
135
  {@render side(PARTS.LEFT, left)}
134
- <input bind:this={element} style="display: none;" aria-hidden="true" {oninvalid} />
136
+ {@render fnForm()}
135
137
  <ToggleGroup bind:values bind:ariaErrMsgId={idMsg} bind:status={neutral} {options} {multiple} {...svsToggleGroup} />
136
138
  {@render side(PARTS.RIGHT, right)}
137
139
  </div>
@@ -159,3 +161,9 @@
159
161
  <div class={cls(PARTS.BOTTOM, status)} id={idDesc ?? idErr} role={live}>{message}</div>
160
162
  {/if}
161
163
  {/snippet}
164
+ {#snippet fnForm()}
165
+ <input bind:this={element} style="display: none;" aria-hidden="true" {oninvalid} />
166
+ {#each values as value}
167
+ <input type="hidden" {name} {value} />
168
+ {/each}
169
+ {/snippet}
@@ -12,6 +12,7 @@ export interface ToggleGroupFieldProps {
12
12
  validations?: ToggleGroupFieldValidation[];
13
13
  status?: string;
14
14
  style?: SVSStyle;
15
+ name?: string;
15
16
  deps?: ToggleGroupFieldDeps;
16
17
  [key: string]: unknown | Snippet;
17
18
  }
@@ -42,6 +43,7 @@ import { type ToggleGroupProps, type ToggleGroupReqdProps, type ToggleGroupBindP
42
43
  * validations?: ToggleGroupFieldValidation[];
43
44
  * status?: string; // bindable <STATE.NEUTRAL>
44
45
  * style?: SVSStyle;
46
+ * name?: string;
45
47
  * deps?: ToggleGroupFieldDeps;
46
48
  * [key: string]: unknown | Snippet;
47
49
  * }
@@ -51,6 +53,6 @@ import { type ToggleGroupProps, type ToggleGroupReqdProps, type ToggleGroupBindP
51
53
  * type ToggleGroupFieldValidation = (values: string[]) => string;
52
54
  * ```
53
55
  */
54
- declare const ToggleGroupField: import("svelte").Component<ToggleGroupFieldProps, {}, "elements" | "status" | "values">;
56
+ declare const ToggleGroupField: import("svelte").Component<ToggleGroupFieldProps, {}, "status" | "values">;
55
57
  type ToggleGroupField = ReturnType<typeof ToggleGroupField>;
56
58
  export default ToggleGroupField;
@@ -14,7 +14,7 @@
14
14
  ```
15
15
  ```ts
16
16
  type RgbColor = [number, number, number];
17
- export function getHex(rgb: RgbColor): string
17
+ function getHex(rgb: RgbColor): string
18
18
  // getHex([255, 123, 34]) => "#ff7b22"
19
19
  ```
20
20
  -->
@@ -29,7 +29,7 @@ import { type SVSStyle } from "./core";
29
29
  * ```
30
30
  * ```ts
31
31
  * type RgbColor = [number, number, number];
32
- * export function getHex(rgb: RgbColor): string
32
+ * function getHex(rgb: RgbColor): string
33
33
  * // getHex([255, 123, 34]) => "#ff7b22"
34
34
  * ```
35
35
  */
@@ -14,6 +14,7 @@
14
14
  attributes?: HTMLButtonAttributes;
15
15
  action?: Action;
16
16
  element?: HTMLButtonElement; // bindable
17
+ children?: Snippet;
17
18
  }
18
19
  ```
19
20
  -->
@@ -30,6 +31,7 @@
30
31
  attributes?: HTMLButtonAttributes;
31
32
  action?: Action;
32
33
  element?: HTMLButtonElement; // bindable
34
+ children?: Snippet;
33
35
  }
34
36
  export type ToggleReqdProps = never;
35
37
  export type ToggleBindProps = "value" | "status" | "element";
@@ -44,7 +46,7 @@
44
46
  </script>
45
47
 
46
48
  <script lang="ts">
47
- let { main, left, right, value = $bindable(false), type = "button", ariaLabel, status = $bindable(""), style, attributes, action, element = $bindable() }: ToggleProps = $props();
49
+ let { main, left, right, value = $bindable(false), type = "button", ariaLabel, status = $bindable(""), style, attributes, action, element = $bindable(), children }: ToggleProps = $props();
48
50
 
49
51
  // *** Initialize *** //
50
52
  if (!status) status = STATE.NEUTRAL;
@@ -88,6 +90,8 @@
88
90
  {#snippet contents()}
89
91
  {#if main}
90
92
  {@render main(status, value, element)}
93
+ {:else if children}
94
+ {@render children()}
91
95
  {/if}
92
96
  {/snippet}
93
97
  {#snippet button(role: string)}
@@ -10,6 +10,7 @@ export interface ToggleProps {
10
10
  attributes?: HTMLButtonAttributes;
11
11
  action?: Action;
12
12
  element?: HTMLButtonElement;
13
+ children?: Snippet;
13
14
  }
14
15
  export type ToggleReqdProps = never;
15
16
  export type ToggleBindProps = "value" | "status" | "element";
@@ -32,6 +33,7 @@ import { type SVSStyle } from "./core";
32
33
  * attributes?: HTMLButtonAttributes;
33
34
  * action?: Action;
34
35
  * element?: HTMLButtonElement; // bindable
36
+ * children?: Snippet;
35
37
  * }
36
38
  * ```
37
39
  */
package/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { type SVSStyle, BASE, STATE, PARTS, elemId, fnClass, isNeutral, omit, de
2
2
  export { default as Badge, type BadgeReqdProps, type BadgeBindProps } from "./_svseeds/_Badge.svelte";
3
3
  export { default as Button, type ButtonReqdProps, type ButtonBindProps } from "./_svseeds/_Button.svelte";
4
4
  export { default as CheckField, type CheckFieldReqdProps, type CheckFieldBindProps, type CheckFieldValidation } from "./_svseeds/_CheckField.svelte";
5
- export { default as ColorPicker, type ColorPickerReqdProps, type ColorPickerBindProps, getHex, getHex } from "./_svseeds/_ColorPicker.svelte";
5
+ export { default as ColorPicker, type ColorPickerReqdProps, type ColorPickerBindProps, getHex } from "./_svseeds/_ColorPicker.svelte";
6
6
  export { default as ComboBox, type ComboBoxReqdProps, type ComboBoxBindProps } from "./_svseeds/_ComboBox.svelte";
7
7
  export { default as ContextMenu, type ContextMenuReqdProps, type ContextMenuBindProps } from "./_svseeds/_ContextMenu.svelte";
8
8
  export { default as Disclosure, type DisclosureReqdProps, type DisclosureBindProps } from "./_svseeds/_Disclosure.svelte";
package/index.js CHANGED
@@ -2,7 +2,7 @@ export { BASE, STATE, PARTS, elemId, fnClass, isNeutral, omit, debounce, throttl
2
2
  export { default as Badge } from "./_svseeds/_Badge.svelte";
3
3
  export { default as Button } from "./_svseeds/_Button.svelte";
4
4
  export { default as CheckField } from "./_svseeds/_CheckField.svelte";
5
- export { default as ColorPicker, getHex, getHex } from "./_svseeds/_ColorPicker.svelte";
5
+ export { default as ColorPicker, getHex } from "./_svseeds/_ColorPicker.svelte";
6
6
  export { default as ComboBox } from "./_svseeds/_ComboBox.svelte";
7
7
  export { default as ContextMenu } from "./_svseeds/_ContextMenu.svelte";
8
8
  export { default as Disclosure } from "./_svseeds/_Disclosure.svelte";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svseeds",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "Simple components for Svelte.",
5
5
  "type": "module",
6
6
  "main": "./index.js",