@webamoki/web-svelte 2.2.1 → 2.4.0

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.
@@ -0,0 +1,39 @@
1
+ <script lang="ts">
2
+ import { cn, type WithoutChildrenOrChild } from '../../../utils.js';
3
+ import CheckIcon from '@lucide/svelte/icons/check';
4
+ import MinusIcon from '@lucide/svelte/icons/minus';
5
+ import { Checkbox as CheckboxPrimitive } from 'bits-ui';
6
+
7
+ let {
8
+ checked = $bindable(false),
9
+ class: className,
10
+ indeterminate = $bindable(false),
11
+ ref = $bindable(null),
12
+ ...restProps
13
+ }: WithoutChildrenOrChild<CheckboxPrimitive.RootProps> = $props();
14
+ </script>
15
+
16
+ <CheckboxPrimitive.Root
17
+ class={cn(
18
+ 'peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-gray-300 transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:data-checked:bg-primary',
19
+ className
20
+ )}
21
+ data-slot="checkbox"
22
+ bind:ref
23
+ bind:checked
24
+ bind:indeterminate
25
+ {...restProps}
26
+ >
27
+ {#snippet children({ checked, indeterminate })}
28
+ <div
29
+ class="grid place-content-center text-current transition-none [&>svg]:size-3.5"
30
+ data-slot="checkbox-indicator"
31
+ >
32
+ {#if checked}
33
+ <CheckIcon />
34
+ {:else if indeterminate}
35
+ <MinusIcon />
36
+ {/if}
37
+ </div>
38
+ {/snippet}
39
+ </CheckboxPrimitive.Root>
@@ -0,0 +1,4 @@
1
+ import { Checkbox as CheckboxPrimitive } from 'bits-ui';
2
+ declare const Checkbox: import("svelte").Component<Omit<Omit<CheckboxPrimitive.RootProps, "child">, "children">, {}, "ref" | "checked" | "indeterminate">;
3
+ type Checkbox = ReturnType<typeof Checkbox>;
4
+ export default Checkbox;
@@ -0,0 +1,2 @@
1
+ import Root from './checkbox.svelte';
2
+ export { Root as Checkbox, Root };
@@ -0,0 +1,4 @@
1
+ import Root from './checkbox.svelte';
2
+ export {
3
+ //
4
+ Root as Checkbox, Root };
@@ -0,0 +1,5 @@
1
+ import Group from './input-otp-group.svelte';
2
+ import Separator from './input-otp-separator.svelte';
3
+ import Slot from './input-otp-slot.svelte';
4
+ import Root from './input-otp.svelte';
5
+ export { Group, Root as InputOTP, Group as InputOTPGroup, Separator as InputOTPSeparator, Slot as InputOTPSlot, Root, Separator, Slot };
@@ -0,0 +1,5 @@
1
+ import Group from './input-otp-group.svelte';
2
+ import Separator from './input-otp-separator.svelte';
3
+ import Slot from './input-otp-slot.svelte';
4
+ import Root from './input-otp.svelte';
5
+ export { Group, Root as InputOTP, Group as InputOTPGroup, Separator as InputOTPSeparator, Slot as InputOTPSlot, Root, Separator, Slot };
@@ -0,0 +1,24 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+
4
+ import { cn, type WithElementRef } from '../../../utils.js';
5
+
6
+ let {
7
+ children,
8
+ class: className,
9
+ ref = $bindable(null),
10
+ ...restProps
11
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
12
+ </script>
13
+
14
+ <div
15
+ bind:this={ref}
16
+ class={cn(
17
+ 'flex items-center rounded-lg has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40',
18
+ className
19
+ )}
20
+ data-slot="input-otp-group"
21
+ {...restProps}
22
+ >
23
+ {@render children?.()}
24
+ </div>
@@ -0,0 +1,5 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import { type WithElementRef } from '../../../utils.js';
3
+ declare const InputOtpGroup: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
4
+ type InputOtpGroup = ReturnType<typeof InputOtpGroup>;
5
+ export default InputOtpGroup;
@@ -0,0 +1,28 @@
1
+ <script lang="ts">
2
+ import type { WithElementRef } from '../../../utils.js';
3
+ import type { HTMLAttributes } from 'svelte/elements';
4
+
5
+ import { cn } from '../../../utils.js';
6
+ import MinusIcon from '@lucide/svelte/icons/minus';
7
+
8
+ let {
9
+ children,
10
+ class: className,
11
+ ref = $bindable(null),
12
+ ...restProps
13
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
14
+ </script>
15
+
16
+ <div
17
+ bind:this={ref}
18
+ class={cn("flex items-center [&_svg:not([class*='size-'])]:size-4", className)}
19
+ data-slot="input-otp-separator"
20
+ role="separator"
21
+ {...restProps}
22
+ >
23
+ {#if children}
24
+ {@render children?.()}
25
+ {:else}
26
+ <MinusIcon />
27
+ {/if}
28
+ </div>
@@ -0,0 +1,5 @@
1
+ import type { WithElementRef } from '../../../utils.js';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ declare const InputOtpSeparator: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
4
+ type InputOtpSeparator = ReturnType<typeof InputOtpSeparator>;
5
+ export default InputOtpSeparator;
@@ -0,0 +1,31 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../utils.js';
3
+ import { PinInput as InputOTPPrimitive } from 'bits-ui';
4
+
5
+ let {
6
+ cell,
7
+ class: className,
8
+ ref = $bindable(null),
9
+ ...restProps
10
+ }: InputOTPPrimitive.CellProps = $props();
11
+ </script>
12
+
13
+ <InputOTPPrimitive.Cell
14
+ class={cn(
15
+ 'relative flex size-8 items-center justify-center border-y border-r border-input text-sm transition-all outline-none first:rounded-l-lg first:border-l last:rounded-r-lg aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-3 data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40',
16
+ className
17
+ )}
18
+ {cell}
19
+ data-slot="input-otp-slot"
20
+ bind:ref
21
+ {...restProps}
22
+ >
23
+ {cell.char}
24
+ {#if cell.hasFakeCaret}
25
+ <div
26
+ class="cn-input-otp-caret pointer-events-none absolute inset-0 flex items-center justify-center"
27
+ >
28
+ <div class="h-4 w-px animate-caret-blink bg-foreground duration-1000"></div>
29
+ </div>
30
+ {/if}
31
+ </InputOTPPrimitive.Cell>
@@ -0,0 +1,4 @@
1
+ import { PinInput as InputOTPPrimitive } from 'bits-ui';
2
+ declare const InputOtpSlot: import("svelte").Component<InputOTPPrimitive.CellProps, {}, "ref">;
3
+ type InputOtpSlot = ReturnType<typeof InputOtpSlot>;
4
+ export default InputOtpSlot;
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../utils.js';
3
+ import { PinInput as InputOTPPrimitive } from 'bits-ui';
4
+
5
+ let {
6
+ class: className,
7
+ ref = $bindable(null),
8
+ value = $bindable(''),
9
+ ...restProps
10
+ }: InputOTPPrimitive.RootProps = $props();
11
+ </script>
12
+
13
+ <InputOTPPrimitive.Root
14
+ class={cn(
15
+ 'cn-input-otp-input flex items-center gap-2 disabled:cursor-not-allowed has-disabled:opacity-50',
16
+ className
17
+ )}
18
+ data-slot="input-otp"
19
+ spellcheck={false}
20
+ bind:ref
21
+ bind:value
22
+ {...restProps}
23
+ />
@@ -0,0 +1,4 @@
1
+ import { PinInput as InputOTPPrimitive } from 'bits-ui';
2
+ declare const InputOtp: import("svelte").Component<InputOTPPrimitive.RootProps, {}, "ref" | "value">;
3
+ type InputOtp = ReturnType<typeof InputOtp>;
4
+ export default InputOtp;
@@ -0,0 +1,55 @@
1
+ <script generics="T extends Record<string, unknown>, U extends FormPath<T>, M" lang="ts">
2
+ import type { FormPath } from 'sveltekit-superforms';
3
+
4
+ import { Checkbox } from '../../../../shadcn/components/ui/checkbox/index.js';
5
+ import { cn } from '../../../../shadcn/utils.js';
6
+ import { Control, Description, Field, Label } from 'formsnap';
7
+
8
+ import type { FieldWrapperProps } from '../FieldWrapper.svelte';
9
+
10
+ import Errors from '../Errors.svelte';
11
+
12
+ interface Props extends FieldWrapperProps<T, U, M> {
13
+ checked?: boolean;
14
+ class?: string;
15
+ disabled?: boolean;
16
+ }
17
+
18
+ let {
19
+ checked = $bindable(false),
20
+ class: className,
21
+ description,
22
+ disabled,
23
+ form,
24
+ label,
25
+ name,
26
+ ...restProps
27
+ }: Props = $props();
28
+ </script>
29
+
30
+ <Field {name} {form}>
31
+ <div class={cn('space-y-1', className)}>
32
+ <Control>
33
+ {#snippet children({ props })}
34
+ <div class="flex items-center gap-2">
35
+ <Checkbox {disabled} bind:checked {...props} {...restProps} />
36
+ {#if label}
37
+ <Label
38
+ class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
39
+ >
40
+ {label}
41
+ {#if props['aria-required'] === 'true'}
42
+ <span class="text-red-500">*</span>
43
+ {/if}
44
+ </Label>
45
+ {/if}
46
+ </div>
47
+ {#if description}
48
+ <Description class="ml-6 text-sm text-muted-foreground">{description}</Description>
49
+ {/if}
50
+ {/snippet}
51
+ </Control>
52
+
53
+ <Errors class="ml-6" />
54
+ </div>
55
+ </Field>
@@ -0,0 +1,37 @@
1
+ export default CheckboxField;
2
+ type CheckboxField<T extends Record<string, unknown>, U extends FormPath<T>, M> = SvelteComponent<Props, {}, {}> & {
3
+ $$bindings?: "checked" | undefined;
4
+ } & {};
5
+ declare const CheckboxField: $$IsomorphicComponent;
6
+ import { FormPath } from 'sveltekit-superforms';
7
+ type Props = FieldWrapperProps<T, U, M> & {
8
+ checked?: boolean | undefined;
9
+ class?: string | undefined;
10
+ disabled?: boolean | undefined;
11
+ };
12
+ interface $$IsomorphicComponent {
13
+ new <T extends Record<string, unknown>, U extends FormPath<T>, M>(options: import("svelte").ComponentConstructorOptions<ReturnType<__sveltets_Render<T, U, M>["props"]>>): import("svelte").SvelteComponent<ReturnType<__sveltets_Render<T, U, M>["props"]>, ReturnType<__sveltets_Render<T, U, M>["events"]>, ReturnType<__sveltets_Render<T, U, M>["slots"]>> & {
14
+ $$bindings?: ReturnType<__sveltets_Render<T, U, M>["bindings"]>;
15
+ } & ReturnType<__sveltets_Render<T, U, M>["exports"]>;
16
+ <T extends Record<string, unknown>, U extends FormPath<T>, M>(internal: unknown, props: ReturnType<__sveltets_Render<T, U, M>["props"]> & {}): ReturnType<__sveltets_Render<T, U, M>["exports"]>;
17
+ z_$$bindings?: ReturnType<__sveltets_Render<any, any, any>["bindings"]>;
18
+ }
19
+ declare class __sveltets_Render<T extends Record<string, unknown>, U extends FormPath<T>, M> {
20
+ props(): ReturnType<typeof $$render<T, U, M>>["props"];
21
+ events(): ReturnType<typeof $$render<T, U, M>>["events"];
22
+ slots(): ReturnType<typeof $$render<T, U, M>>["slots"];
23
+ bindings(): "checked";
24
+ exports(): {};
25
+ }
26
+ declare function $$render<T extends Record<string, unknown>, U extends FormPath<T>, M>(): {
27
+ props: FieldWrapperProps<T, U, M> & {
28
+ checked?: boolean;
29
+ class?: string;
30
+ disabled?: boolean;
31
+ };
32
+ exports: {};
33
+ bindings: "checked";
34
+ slots: {};
35
+ events: {};
36
+ };
37
+ import { FieldWrapperProps } from '../FieldWrapper.svelte';
@@ -0,0 +1,48 @@
1
+ <script generics="T extends Record<string, unknown>, U extends FormPath<T>, M" lang="ts">
2
+ import type { FormPath } from 'sveltekit-superforms';
3
+
4
+ import {
5
+ InputOTP,
6
+ InputOTPGroup,
7
+ InputOTPSeparator,
8
+ InputOTPSlot
9
+ } from '../../../../shadcn/components/ui/input-otp/index.js';
10
+
11
+ import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
12
+
13
+ interface Props extends FieldWrapperProps<T, U, M> {
14
+ class?: string;
15
+ disabled?: boolean;
16
+ maxlength?: number;
17
+ value?: string;
18
+ }
19
+
20
+ let {
21
+ class: className,
22
+ disabled,
23
+ maxlength = 6,
24
+ value = $bindable(''),
25
+ ...fieldProps
26
+ }: Props = $props();
27
+ </script>
28
+
29
+ <FieldWrapper class={className} {...fieldProps}>
30
+ {#snippet formElem(props)}
31
+ <InputOTP {disabled} {maxlength} textalign="center" bind:value {...props}>
32
+ {#snippet children({ cells })}
33
+ {@const half = Math.ceil(maxlength / 2)}
34
+ <InputOTPGroup>
35
+ {#each cells.slice(0, half) as cell (cell)}
36
+ <InputOTPSlot {cell} />
37
+ {/each}
38
+ </InputOTPGroup>
39
+ <InputOTPSeparator />
40
+ <InputOTPGroup>
41
+ {#each cells.slice(half) as cell (cell)}
42
+ <InputOTPSlot {cell} />
43
+ {/each}
44
+ </InputOTPGroup>
45
+ {/snippet}
46
+ </InputOTP>
47
+ {/snippet}
48
+ </FieldWrapper>
@@ -0,0 +1,39 @@
1
+ export default PinField;
2
+ type PinField<T extends Record<string, unknown>, U extends FormPath<T>, M> = SvelteComponent<Props, {}, {}> & {
3
+ $$bindings?: "value" | undefined;
4
+ } & {};
5
+ declare const PinField: $$IsomorphicComponent;
6
+ import { FormPath } from 'sveltekit-superforms';
7
+ type Props = FieldWrapperProps<T, U, M> & {
8
+ class?: string | undefined;
9
+ disabled?: boolean | undefined;
10
+ maxlength?: number | undefined;
11
+ value?: string | undefined;
12
+ };
13
+ interface $$IsomorphicComponent {
14
+ new <T extends Record<string, unknown>, U extends FormPath<T>, M>(options: import("svelte").ComponentConstructorOptions<ReturnType<__sveltets_Render<T, U, M>["props"]>>): import("svelte").SvelteComponent<ReturnType<__sveltets_Render<T, U, M>["props"]>, ReturnType<__sveltets_Render<T, U, M>["events"]>, ReturnType<__sveltets_Render<T, U, M>["slots"]>> & {
15
+ $$bindings?: ReturnType<__sveltets_Render<T, U, M>["bindings"]>;
16
+ } & ReturnType<__sveltets_Render<T, U, M>["exports"]>;
17
+ <T extends Record<string, unknown>, U extends FormPath<T>, M>(internal: unknown, props: ReturnType<__sveltets_Render<T, U, M>["props"]> & {}): ReturnType<__sveltets_Render<T, U, M>["exports"]>;
18
+ z_$$bindings?: ReturnType<__sveltets_Render<any, any, any>["bindings"]>;
19
+ }
20
+ declare class __sveltets_Render<T extends Record<string, unknown>, U extends FormPath<T>, M> {
21
+ props(): ReturnType<typeof $$render<T, U, M>>["props"];
22
+ events(): ReturnType<typeof $$render<T, U, M>>["events"];
23
+ slots(): ReturnType<typeof $$render<T, U, M>>["slots"];
24
+ bindings(): "value";
25
+ exports(): {};
26
+ }
27
+ declare function $$render<T extends Record<string, unknown>, U extends FormPath<T>, M>(): {
28
+ props: FieldWrapperProps<T, U, M> & {
29
+ class?: string;
30
+ disabled?: boolean;
31
+ maxlength?: number;
32
+ value?: string;
33
+ };
34
+ exports: {};
35
+ bindings: "value";
36
+ slots: {};
37
+ events: {};
38
+ };
39
+ import { FieldWrapperProps } from '../FieldWrapper.svelte';
@@ -1,4 +1,5 @@
1
1
  import Button from './Button.svelte';
2
+ import CheckboxField from './fields/CheckboxField.svelte';
2
3
  import ChoiceField from './fields/ChoiceField.svelte';
3
4
  import ChoiceMultiField from './fields/ChoiceMultiField.svelte';
4
5
  import DateField from './fields/DateField.svelte';
@@ -6,6 +7,7 @@ import HexColorField from './fields/HexColorField.svelte';
6
7
  import MessageField from './fields/MessageField.svelte';
7
8
  import NumberField from './fields/NumberField.svelte';
8
9
  import PasswordField from './fields/PasswordField.svelte';
10
+ import PinField from './fields/PinField.svelte';
9
11
  import SelectField from './fields/SelectField.svelte';
10
12
  import SelectMultiField from './fields/SelectMultiField.svelte';
11
13
  import TextField from './fields/TextField.svelte';
@@ -15,4 +17,4 @@ import WeekdayChoiceField from './fields/WeekdayChoiceField.svelte';
15
17
  import WeekdayChoiceMultiField from './fields/WeekdayChoiceMultiField.svelte';
16
18
  import Form from './Form.svelte';
17
19
  import IconInputWrapper from './IconInputWrapper.svelte';
18
- export { Button, ChoiceField, ChoiceMultiField, DateField, Form, HexColorField, IconInputWrapper, MessageField, NumberField, PasswordField, SelectField, SelectMultiField, TextField, TextFieldNullable, TimeField, WeekdayChoiceField, WeekdayChoiceMultiField };
20
+ export { Button, CheckboxField, ChoiceField, ChoiceMultiField, DateField, Form, HexColorField, IconInputWrapper, MessageField, NumberField, PasswordField, PinField, SelectField, SelectMultiField, TextField, TextFieldNullable, TimeField, WeekdayChoiceField, WeekdayChoiceMultiField };
@@ -1,4 +1,5 @@
1
1
  import Button from './Button.svelte';
2
+ import CheckboxField from './fields/CheckboxField.svelte';
2
3
  import ChoiceField from './fields/ChoiceField.svelte';
3
4
  import ChoiceMultiField from './fields/ChoiceMultiField.svelte';
4
5
  import DateField from './fields/DateField.svelte';
@@ -6,6 +7,7 @@ import HexColorField from './fields/HexColorField.svelte';
6
7
  import MessageField from './fields/MessageField.svelte';
7
8
  import NumberField from './fields/NumberField.svelte';
8
9
  import PasswordField from './fields/PasswordField.svelte';
10
+ import PinField from './fields/PinField.svelte';
9
11
  import SelectField from './fields/SelectField.svelte';
10
12
  import SelectMultiField from './fields/SelectMultiField.svelte';
11
13
  import TextField from './fields/TextField.svelte';
@@ -15,4 +17,4 @@ import WeekdayChoiceField from './fields/WeekdayChoiceField.svelte';
15
17
  import WeekdayChoiceMultiField from './fields/WeekdayChoiceMultiField.svelte';
16
18
  import Form from './Form.svelte';
17
19
  import IconInputWrapper from './IconInputWrapper.svelte';
18
- export { Button, ChoiceField, ChoiceMultiField, DateField, Form, HexColorField, IconInputWrapper, MessageField, NumberField, PasswordField, SelectField, SelectMultiField, TextField, TextFieldNullable, TimeField, WeekdayChoiceField, WeekdayChoiceMultiField };
20
+ export { Button, CheckboxField, ChoiceField, ChoiceMultiField, DateField, Form, HexColorField, IconInputWrapper, MessageField, NumberField, PasswordField, PinField, SelectField, SelectMultiField, TextField, TextFieldNullable, TimeField, WeekdayChoiceField, WeekdayChoiceMultiField };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public",
5
5
  "provenance": true
6
6
  },
7
- "version": "2.2.1",
7
+ "version": "2.4.0",
8
8
  "license": "MIT",
9
9
  "repository": {
10
10
  "type": "git",
@@ -74,6 +74,7 @@
74
74
  "@eslint/compat": "^2.0.3",
75
75
  "@eslint/js": "^9.39.4",
76
76
  "@internationalized/date": "^3.12.0",
77
+ "@lucide/svelte": "^1.7.0",
77
78
  "@standard-schema/spec": "^1.1.0",
78
79
  "@sveltejs/adapter-static": "^3.0.10",
79
80
  "@sveltejs/kit": "^2.55.0",
@@ -116,7 +117,6 @@
116
117
  "svelte"
117
118
  ],
118
119
  "dependencies": {
119
- "@lucide/svelte": "^1.6.0",
120
120
  "aws4fetch": "^1.0.20",
121
121
  "bits-ui": "^2.16.3",
122
122
  "devalue": "^5.6.4",