@webamoki/web-svelte 2.3.0 → 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,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,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';
@@ -7,6 +7,7 @@ import HexColorField from './fields/HexColorField.svelte';
7
7
  import MessageField from './fields/MessageField.svelte';
8
8
  import NumberField from './fields/NumberField.svelte';
9
9
  import PasswordField from './fields/PasswordField.svelte';
10
+ import PinField from './fields/PinField.svelte';
10
11
  import SelectField from './fields/SelectField.svelte';
11
12
  import SelectMultiField from './fields/SelectMultiField.svelte';
12
13
  import TextField from './fields/TextField.svelte';
@@ -16,4 +17,4 @@ import WeekdayChoiceField from './fields/WeekdayChoiceField.svelte';
16
17
  import WeekdayChoiceMultiField from './fields/WeekdayChoiceMultiField.svelte';
17
18
  import Form from './Form.svelte';
18
19
  import IconInputWrapper from './IconInputWrapper.svelte';
19
- export { Button, CheckboxField, 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 };
@@ -7,6 +7,7 @@ import HexColorField from './fields/HexColorField.svelte';
7
7
  import MessageField from './fields/MessageField.svelte';
8
8
  import NumberField from './fields/NumberField.svelte';
9
9
  import PasswordField from './fields/PasswordField.svelte';
10
+ import PinField from './fields/PinField.svelte';
10
11
  import SelectField from './fields/SelectField.svelte';
11
12
  import SelectMultiField from './fields/SelectMultiField.svelte';
12
13
  import TextField from './fields/TextField.svelte';
@@ -16,4 +17,4 @@ import WeekdayChoiceField from './fields/WeekdayChoiceField.svelte';
16
17
  import WeekdayChoiceMultiField from './fields/WeekdayChoiceMultiField.svelte';
17
18
  import Form from './Form.svelte';
18
19
  import IconInputWrapper from './IconInputWrapper.svelte';
19
- export { Button, CheckboxField, 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.3.0",
7
+ "version": "2.4.0",
8
8
  "license": "MIT",
9
9
  "repository": {
10
10
  "type": "git",