@webamoki/web-svelte 0.5.24 → 0.5.25

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.
@@ -4,6 +4,7 @@
4
4
  name: U;
5
5
  label?: string;
6
6
  description?: string;
7
+ class?: string;
7
8
  }
8
9
 
9
10
  export interface FormAttrs extends ControlAttrs {
@@ -13,6 +14,7 @@
13
14
  </script>
14
15
 
15
16
  <script lang="ts" generics="T extends Record<string, unknown>, U extends FormPath<T>, M">
17
+ import { cn } from '../../shadcn/utils.js';
16
18
  import {
17
19
  Control,
18
20
  Description,
@@ -22,21 +24,21 @@
22
24
  type FsSuperForm
23
25
  } from 'formsnap';
24
26
  import type { Snippet } from 'svelte';
27
+ import type { HTMLInputAttributes } from 'svelte/elements';
25
28
  import type { FormPath } from 'sveltekit-superforms';
26
29
  import Errors from './Errors.svelte';
27
- import type { HTMLInputAttributes } from 'svelte/elements';
28
30
 
29
31
  interface Props extends FieldWrapperProps<T, U, M> {
30
32
  formElem: Snippet<[ControlAttrs]>;
31
33
  }
32
- let { form, name, label, description, formElem }: Props = $props();
34
+ let { form, name, label, description, formElem, class: className }: Props = $props();
33
35
  </script>
34
36
 
35
37
  <Field {form} {name}>
36
- <div class="space-y-1">
38
+ <div class={cn('space-y-1', className)}>
37
39
  <Control>
38
40
  {#snippet children({ props })}
39
- <div class="space-y-1">
41
+ <div class="w-full space-y-1">
40
42
  {#if label || description}
41
43
  <div>
42
44
  {#if label}
@@ -3,6 +3,7 @@ export interface FieldWrapperProps<T extends Record<string, unknown>, U extends
3
3
  name: U;
4
4
  label?: string;
5
5
  description?: string;
6
+ class?: string;
6
7
  }
7
8
  export interface FormAttrs extends ControlAttrs {
8
9
  disabled?: HTMLInputAttributes['disabled'];
@@ -10,8 +11,8 @@ export interface FormAttrs extends ControlAttrs {
10
11
  }
11
12
  import { type ControlAttrs, type FsSuperForm } from 'formsnap';
12
13
  import type { Snippet } from 'svelte';
13
- import type { FormPath } from 'sveltekit-superforms';
14
14
  import type { HTMLInputAttributes } from 'svelte/elements';
15
+ import type { FormPath } from 'sveltekit-superforms';
15
16
  declare function $$render<T extends Record<string, unknown>, U extends FormPath<T>, M>(): {
16
17
  props: FieldWrapperProps<T, U, M> & {
17
18
  formElem: Snippet<[ControlAttrs]>;
@@ -6,7 +6,10 @@
6
6
  import type { FormPath } from 'sveltekit-superforms';
7
7
  import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
8
8
 
9
- type Props = FieldWrapperProps<T, U, M> & ChoiceProps<V, I, K>;
9
+ type Props = {
10
+ class?: string;
11
+ } & FieldWrapperProps<T, U, M> &
12
+ ChoiceProps<V, I, K>;
10
13
 
11
14
  let {
12
15
  items,
@@ -23,26 +26,26 @@
23
26
  description,
24
27
  disabled,
25
28
  readonly,
26
- buttonContent
29
+ buttonContent,
30
+ class: className
27
31
  }: Props = $props();
28
32
  </script>
29
33
 
30
- <FieldWrapper {form} {name} {label} {description}>
34
+ <FieldWrapper {form} {name} {label} {description} class={className}>
31
35
  {#snippet formElem(props)}
32
- <div class="flex w-full items-center gap-2">
33
- <Choice
34
- {items}
35
- {getKey}
36
- {getLabel}
37
- {getValue}
38
- {onChange}
39
- {buttonContent}
40
- {vertical}
41
- {disabled}
42
- {readonly}
43
- bind:value
44
- {...props}
45
- />
46
- </div>
36
+ <Choice
37
+ {items}
38
+ {getKey}
39
+ {getLabel}
40
+ {getValue}
41
+ {onChange}
42
+ {buttonContent}
43
+ {vertical}
44
+ {disabled}
45
+ {readonly}
46
+ bind:value
47
+ {...props}
48
+ class="w-full"
49
+ />
47
50
  {/snippet}
48
51
  </FieldWrapper>
@@ -2,7 +2,9 @@ import { type ChoiceProps } from '../../ui/choice/Choice.svelte';
2
2
  import type { FormPath } from 'sveltekit-superforms';
3
3
  import { type FieldWrapperProps } from '../FieldWrapper.svelte';
4
4
  declare function $$render<V, I, K extends string | number | symbol, T extends Record<string, unknown>, U extends FormPath<T>, M>(): {
5
- props: FieldWrapperProps<T, U, M> & ChoiceProps<V, I, K>;
5
+ props: {
6
+ class?: string;
7
+ } & FieldWrapperProps<T, U, M> & ChoiceProps<V, I, K>;
6
8
  exports: {};
7
9
  bindings: "value";
8
10
  slots: {};
@@ -6,7 +6,7 @@
6
6
  import type { FormPath } from 'sveltekit-superforms';
7
7
  import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
8
8
 
9
- type Props = FieldWrapperProps<T, U, M> & ChoiceMultiProps<V, I, K>;
9
+ type Props = { class?: string } & FieldWrapperProps<T, U, M> & ChoiceMultiProps<V, I, K>;
10
10
  let {
11
11
  items,
12
12
  getKey,
@@ -23,27 +23,27 @@
23
23
  description,
24
24
  disabled,
25
25
  readonly,
26
- buttonContent
26
+ buttonContent,
27
+ class: className
27
28
  }: Props = $props();
28
29
  </script>
29
30
 
30
- <FieldWrapper {form} {name} {label} {description}>
31
+ <FieldWrapper {form} {name} {label} {description} class={className}>
31
32
  {#snippet formElem(props)}
32
- <div class="flex w-full items-center gap-2">
33
- <ChoiceMulti
34
- {items}
35
- {getKey}
36
- {getLabel}
37
- {getValue}
38
- {onAdd}
39
- {onRemove}
40
- {buttonContent}
41
- {disabled}
42
- {readonly}
43
- {vertical}
44
- {...props}
45
- bind:value
46
- />
47
- </div>
33
+ <ChoiceMulti
34
+ {items}
35
+ {getKey}
36
+ {getLabel}
37
+ {getValue}
38
+ {onAdd}
39
+ {onRemove}
40
+ {buttonContent}
41
+ {disabled}
42
+ {readonly}
43
+ {vertical}
44
+ {...props}
45
+ bind:value
46
+ class="w-full"
47
+ />
48
48
  {/snippet}
49
49
  </FieldWrapper>
@@ -2,7 +2,9 @@ import { type ChoiceMultiProps } from '../../ui/choice/ChoiceMulti.svelte';
2
2
  import type { FormPath } from 'sveltekit-superforms';
3
3
  import { type FieldWrapperProps } from '../FieldWrapper.svelte';
4
4
  declare function $$render<V, I, K extends string | number | symbol, T extends Record<string, unknown>, U extends FormPath<T>, M>(): {
5
- props: FieldWrapperProps<T, U, M> & ChoiceMultiProps<V, I, K>;
5
+ props: {
6
+ class?: string;
7
+ } & FieldWrapperProps<T, U, M> & ChoiceMultiProps<V, I, K>;
6
8
  exports: {};
7
9
  bindings: "value";
8
10
  slots: {};
@@ -1,11 +1,11 @@
1
1
  <script lang="ts" generics="T extends Record<string, unknown>, U extends FormPath<T>, M">
2
- import type { FormPath } from 'sveltekit-superforms';
3
- import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
4
2
  import WeekdayChoice, {
5
3
  type WeekdayChoiceProps
6
4
  } from '../../ui/choice/WeekdayChoice.svelte';
5
+ import type { FormPath } from 'sveltekit-superforms';
6
+ import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
7
7
 
8
- type Props = FieldWrapperProps<T, U, M> & WeekdayChoiceProps;
8
+ type Props = { class?: string } & FieldWrapperProps<T, U, M> & WeekdayChoiceProps;
9
9
 
10
10
  let {
11
11
  onChange,
@@ -19,23 +19,23 @@
19
19
  label,
20
20
  description,
21
21
  disabled,
22
- readonly
22
+ readonly,
23
+ class: className
23
24
  }: Props = $props();
24
25
  </script>
25
26
 
26
- <FieldWrapper {form} {name} {label} {description}>
27
+ <FieldWrapper {form} {name} {label} {description} class={className}>
27
28
  {#snippet formElem(props)}
28
- <div class="flex w-full items-center gap-2">
29
- <WeekdayChoice
30
- {onChange}
31
- {vertical}
32
- {disabled}
33
- {readonly}
34
- {letterLabels}
35
- {longLabels}
36
- bind:value
37
- {...props}
38
- />
39
- </div>
29
+ <WeekdayChoice
30
+ {onChange}
31
+ {vertical}
32
+ {disabled}
33
+ {readonly}
34
+ {letterLabels}
35
+ {longLabels}
36
+ bind:value
37
+ {...props}
38
+ class="w-full"
39
+ />
40
40
  {/snippet}
41
41
  </FieldWrapper>
@@ -1,8 +1,10 @@
1
+ import { type WeekdayChoiceProps } from '../../ui/choice/WeekdayChoice.svelte';
1
2
  import type { FormPath } from 'sveltekit-superforms';
2
3
  import { type FieldWrapperProps } from '../FieldWrapper.svelte';
3
- import { type WeekdayChoiceProps } from '../../ui/choice/WeekdayChoice.svelte';
4
4
  declare function $$render<T extends Record<string, unknown>, U extends FormPath<T>, M>(): {
5
- props: FieldWrapperProps<T, U, M> & WeekdayChoiceProps;
5
+ props: {
6
+ class?: string;
7
+ } & FieldWrapperProps<T, U, M> & WeekdayChoiceProps;
6
8
  exports: {};
7
9
  bindings: "value";
8
10
  slots: {};
@@ -1,10 +1,10 @@
1
1
  <script lang="ts" generics="T extends Record<string, unknown>, U extends FormPath<T>, M">
2
- import type { FormPath } from 'sveltekit-superforms';
3
- import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
4
2
  import type { WeekdayChoiceMultiProps } from '../../ui/choice/WeekdayChoiceMulti.svelte';
5
3
  import WeekdayChoiceMulti from '../../ui/choice/WeekdayChoiceMulti.svelte';
4
+ import type { FormPath } from 'sveltekit-superforms';
5
+ import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
6
6
 
7
- type Props = FieldWrapperProps<T, U, M> & WeekdayChoiceMultiProps;
7
+ type Props = { class?: string } & FieldWrapperProps<T, U, M> & WeekdayChoiceMultiProps;
8
8
  let {
9
9
  onAdd,
10
10
  onRemove,
@@ -18,24 +18,23 @@
18
18
  label,
19
19
  description,
20
20
  disabled,
21
- readonly
21
+ readonly,
22
+ class: className
22
23
  }: Props = $props();
23
24
  </script>
24
25
 
25
- <FieldWrapper {form} {name} {label} {description}>
26
+ <FieldWrapper {form} {name} {label} {description} class={className}>
26
27
  {#snippet formElem(props)}
27
- <div class="flex w-full items-center gap-2">
28
- <WeekdayChoiceMulti
29
- {onAdd}
30
- {onRemove}
31
- {disabled}
32
- {readonly}
33
- {vertical}
34
- {letterLabels}
35
- {longLabels}
36
- {...props}
37
- bind:value
38
- />
39
- </div>
28
+ <WeekdayChoiceMulti
29
+ {onAdd}
30
+ {onRemove}
31
+ {disabled}
32
+ {readonly}
33
+ {vertical}
34
+ {letterLabels}
35
+ {longLabels}
36
+ {...props}
37
+ bind:value
38
+ />
40
39
  {/snippet}
41
40
  </FieldWrapper>
@@ -1,8 +1,10 @@
1
+ import type { WeekdayChoiceMultiProps } from '../../ui/choice/WeekdayChoiceMulti.svelte';
1
2
  import type { FormPath } from 'sveltekit-superforms';
2
3
  import { type FieldWrapperProps } from '../FieldWrapper.svelte';
3
- import type { WeekdayChoiceMultiProps } from '../../ui/choice/WeekdayChoiceMulti.svelte';
4
4
  declare function $$render<T extends Record<string, unknown>, U extends FormPath<T>, M>(): {
5
- props: FieldWrapperProps<T, U, M> & WeekdayChoiceMultiProps;
5
+ props: {
6
+ class?: string;
7
+ } & FieldWrapperProps<T, U, M> & WeekdayChoiceMultiProps;
6
8
  exports: {};
7
9
  bindings: "value";
8
10
  slots: {};
@@ -7,6 +7,7 @@
7
7
  getValue: (item: I) => V;
8
8
  vertical?: boolean;
9
9
  buttonContent?: Snippet<[label: string, item: I]>;
10
+ class?: string;
10
11
  }
11
12
  </script>
12
13
 
@@ -31,6 +32,7 @@
31
32
  readonly,
32
33
  'aria-invalid': ariaInvalid,
33
34
  buttonContent,
35
+ class: className,
34
36
  ...control
35
37
  }: Props = $props();
36
38
  </script>
@@ -43,7 +45,8 @@
43
45
  vertical ? 'grid-flow-row auto-rows-fr' : 'auto-cols-fr grid-flow-col',
44
46
  disabled || readonly ? 'pointer-events-none' : 'cursor-pointer',
45
47
  disabled && 'opacity-50',
46
- ariaInvalid && 'border-destructive'
48
+ ariaInvalid && 'border-destructive',
49
+ className
47
50
  )}
48
51
  >
49
52
  {#each items as item (getKey(item))}
@@ -5,6 +5,7 @@ export interface ChoiceInternalProps<V, I, K extends string | number | symbol> e
5
5
  getValue: (item: I) => V;
6
6
  vertical?: boolean;
7
7
  buttonContent?: Snippet<[label: string, item: I]>;
8
+ class?: string;
8
9
  }
9
10
  import type { FormAttrs } from '../../form/FieldWrapper.svelte';
10
11
  import type { Snippet } from 'svelte';
@@ -7,6 +7,7 @@
7
7
  letterLabels?: boolean;
8
8
  disabled?: boolean | null;
9
9
  readonly?: boolean | null;
10
+ class?: string;
10
11
  }
11
12
  </script>
12
13
 
@@ -6,6 +6,7 @@ export interface WeekdayChoiceProps {
6
6
  letterLabels?: boolean;
7
7
  disabled?: boolean | null;
8
8
  readonly?: boolean | null;
9
+ class?: string;
9
10
  }
10
11
  import { type Day } from '../../../utils/index.js';
11
12
  declare const WeekdayChoice: import("svelte").Component<WeekdayChoiceProps, {}, "value">;
@@ -10,6 +10,7 @@
10
10
  letterLabels?: boolean;
11
11
  disabled?: boolean | null;
12
12
  readonly?: boolean | null;
13
+ class?: string;
13
14
  }
14
15
  </script>
15
16
 
@@ -7,6 +7,7 @@ export interface WeekdayChoiceMultiProps {
7
7
  letterLabels?: boolean;
8
8
  disabled?: boolean | null;
9
9
  readonly?: boolean | null;
10
+ class?: string;
10
11
  }
11
12
  import { type Day } from '../../../utils/index.js';
12
13
  declare const WeekdayChoiceMulti: import("svelte").Component<WeekdayChoiceMultiProps, {}, "value">;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.5.24",
6
+ "version": "0.5.25",
7
7
  "license": "MIT",
8
8
  "files": [
9
9
  "dist",