fuma 2.1.5 → 2.1.6

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.
@@ -9,11 +9,13 @@
9
9
  value = $bindable(),
10
10
  type = 'text',
11
11
  class: klass,
12
+ variant = 'floating',
12
13
  ...props
13
14
  }: {
14
15
  label: string
15
16
  field?: RemoteFormField<string>
16
17
  value?: string
18
+ variant?: 'floating' | 'block'
17
19
  type?:
18
20
  | 'text'
19
21
  | 'email'
@@ -29,17 +31,37 @@
29
31
  | 'color'
30
32
  | 'select'
31
33
  } & InputProps = $props()
34
+
35
+ const inputId = $props.id()
36
+ const inputProps = $derived({
37
+ id: inputId,
38
+ class: ['input', klass],
39
+ placeholder: variant === 'floating' ? label : '',
40
+ ...props
41
+ })
32
42
  </script>
33
43
 
34
- <label class="floating-label">
35
- <span>{label}</span>
44
+ {#snippet snippetInput()}
36
45
  {#if field}
37
- <input placeholder={label} class={['input', klass]} {...field.as(type)} {...props} />
46
+ <input {...inputProps} {...field.as(type)} />
38
47
  {:else}
39
- <input placeholder={label} class={['input', klass]} {type} bind:value {...props} />
48
+ <input {...inputProps} {type} bind:value />
40
49
  {/if}
41
- <Issues {field} />
42
- </label>
50
+ {/snippet}
51
+
52
+ {#if variant === 'floating'}
53
+ <label class="floating-label">
54
+ <span>{label}</span>
55
+ {@render snippetInput()}
56
+ <Issues {field} />
57
+ </label>
58
+ {:else}
59
+ <fieldset class="fieldset">
60
+ <label class="label" for={inputId}>{label}</label>
61
+ {@render snippetInput()}
62
+ <Issues {field} />
63
+ </fieldset>
64
+ {/if}
43
65
 
44
66
  <style>
45
67
  input[aria-invalid='true'] {
@@ -4,6 +4,7 @@ type $$ComponentProps = {
4
4
  label: string;
5
5
  field?: RemoteFormField<string>;
6
6
  value?: string;
7
+ variant?: 'floating' | 'block';
7
8
  type?: 'text' | 'email' | 'password' | 'url' | 'tel' | 'search' | 'date' | 'datetime-local' | 'time' | 'month' | 'week' | 'color' | 'select';
8
9
  } & InputProps;
9
10
  declare const InputString: import("svelte").Component<$$ComponentProps, {}, "value">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "My fullstack material build with sveltekit, daisyui, zod, prisma, lucia",
5
5
  "author": {
6
6
  "name": "Jonas Voisard",