@tanglemedia/svelte-starter-auth-shadcn 0.0.2 → 0.1.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.
Files changed (163) hide show
  1. package/dist/app.css +174 -0
  2. package/dist/app.html +0 -1
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +1 -0
  5. package/dist/lib/components/types.d.ts +13 -0
  6. package/dist/lib/components/types.js +1 -0
  7. package/dist/lib/components/ui/auth-layout/auth-layout-content-top.svelte +15 -0
  8. package/dist/lib/components/ui/auth-layout/auth-layout-content-top.svelte.d.ts +8 -0
  9. package/dist/lib/components/ui/auth-layout/auth-layout-content.svelte +15 -0
  10. package/dist/lib/components/ui/auth-layout/auth-layout-content.svelte.d.ts +8 -0
  11. package/dist/lib/components/ui/auth-layout/auth-layout-feature-info.svelte +45 -0
  12. package/dist/lib/components/ui/auth-layout/auth-layout-feature-info.svelte.d.ts +12 -0
  13. package/dist/lib/components/ui/auth-layout/auth-layout-feature.svelte +24 -0
  14. package/dist/lib/components/ui/auth-layout/auth-layout-feature.svelte.d.ts +8 -0
  15. package/dist/lib/components/ui/auth-layout/auth-layout-logo.svelte +99 -0
  16. package/dist/lib/components/ui/auth-layout/auth-layout-logo.svelte.d.ts +63 -0
  17. package/dist/lib/components/ui/auth-layout/auth-layout-main.svelte +17 -0
  18. package/dist/lib/components/ui/auth-layout/auth-layout-main.svelte.d.ts +8 -0
  19. package/dist/lib/components/ui/auth-layout/auth-layout.svelte +22 -82
  20. package/dist/lib/components/ui/auth-layout/auth-layout.svelte.d.ts +4 -11
  21. package/dist/lib/components/ui/auth-layout/index.d.ts +8 -2
  22. package/dist/lib/components/ui/auth-layout/index.js +10 -2
  23. package/dist/lib/components/ui/forgot-password/forgot-password-container.svelte +27 -0
  24. package/dist/lib/components/ui/forgot-password/forgot-password-container.svelte.d.ts +8 -0
  25. package/dist/lib/components/ui/forgot-password/forgot-password-form.svelte +70 -81
  26. package/dist/lib/components/ui/forgot-password/forgot-password-form.svelte.d.ts +12 -7
  27. package/dist/lib/components/ui/forgot-password/forgot-password-header.svelte +34 -0
  28. package/dist/lib/components/ui/forgot-password/forgot-password-header.svelte.d.ts +13 -0
  29. package/dist/lib/components/ui/forgot-password/forgot-password-login.svelte +19 -0
  30. package/dist/lib/components/ui/forgot-password/forgot-password-login.svelte.d.ts +9 -0
  31. package/dist/lib/components/ui/forgot-password/forgot-password-provider.svelte +13 -0
  32. package/dist/lib/components/ui/forgot-password/forgot-password-provider.svelte.d.ts +25 -0
  33. package/dist/lib/components/ui/forgot-password/forgot-password-submit.svelte +17 -0
  34. package/dist/lib/components/ui/forgot-password/forgot-password-submit.svelte.d.ts +7 -0
  35. package/dist/lib/components/ui/forgot-password/forgot-password-user-input.svelte +21 -0
  36. package/dist/lib/components/ui/forgot-password/forgot-password-user-input.svelte.d.ts +26 -0
  37. package/dist/lib/components/ui/forgot-password/forgot-password.schema.d.ts +5 -0
  38. package/dist/lib/components/ui/forgot-password/forgot-password.schema.js +4 -0
  39. package/dist/lib/components/ui/forgot-password/index.d.ts +9 -2
  40. package/dist/lib/components/ui/forgot-password/index.js +9 -2
  41. package/dist/lib/components/ui/index.d.ts +5 -0
  42. package/dist/lib/components/ui/index.js +6 -0
  43. package/dist/lib/components/ui/login-form/index.d.ts +11 -2
  44. package/dist/lib/components/ui/login-form/index.js +13 -2
  45. package/dist/lib/components/ui/login-form/login-container.svelte +27 -0
  46. package/dist/lib/components/ui/login-form/login-container.svelte.d.ts +8 -0
  47. package/dist/lib/components/ui/login-form/login-context.d.ts +2 -0
  48. package/dist/lib/components/ui/login-form/login-context.js +13 -0
  49. package/dist/lib/components/ui/login-form/login-forgot-password.svelte +19 -0
  50. package/dist/lib/components/ui/login-form/login-forgot-password.svelte.d.ts +9 -0
  51. package/dist/lib/components/ui/login-form/login-form.svelte +68 -111
  52. package/dist/lib/components/ui/login-form/login-form.svelte.d.ts +10 -7
  53. package/dist/lib/components/ui/login-form/login-header.svelte +34 -0
  54. package/dist/lib/components/ui/login-form/login-header.svelte.d.ts +13 -0
  55. package/dist/lib/components/ui/login-form/login-password-input.svelte +21 -0
  56. package/dist/lib/components/ui/login-form/login-password-input.svelte.d.ts +26 -0
  57. package/dist/lib/components/ui/login-form/login-provider.svelte +13 -0
  58. package/dist/lib/components/ui/login-form/login-provider.svelte.d.ts +25 -0
  59. package/dist/lib/components/ui/login-form/login-submit.svelte +17 -0
  60. package/dist/lib/components/ui/login-form/login-submit.svelte.d.ts +7 -0
  61. package/dist/lib/components/ui/login-form/login-user-input.svelte +21 -0
  62. package/dist/lib/components/ui/login-form/login-user-input.svelte.d.ts +26 -0
  63. package/dist/lib/components/ui/login-form/login.schema.d.ts +6 -0
  64. package/dist/lib/components/ui/login-form/login.schema.js +5 -0
  65. package/dist/lib/components/ui/register-form/index.d.ts +10 -2
  66. package/dist/lib/components/ui/register-form/index.js +10 -2
  67. package/dist/lib/components/ui/register-form/register-container.svelte +27 -0
  68. package/dist/lib/components/ui/register-form/register-container.svelte.d.ts +8 -0
  69. package/dist/lib/components/ui/register-form/register-form.svelte +67 -170
  70. package/dist/lib/components/ui/register-form/register-form.svelte.d.ts +10 -5
  71. package/dist/lib/components/ui/register-form/register-header.svelte +34 -0
  72. package/dist/lib/components/ui/register-form/register-header.svelte.d.ts +13 -0
  73. package/dist/lib/components/ui/register-form/register-name-input.svelte +21 -0
  74. package/dist/lib/components/ui/register-form/register-name-input.svelte.d.ts +26 -0
  75. package/dist/lib/components/ui/register-form/register-password-input.svelte +21 -0
  76. package/dist/lib/components/ui/register-form/register-password-input.svelte.d.ts +26 -0
  77. package/dist/lib/components/ui/register-form/register-provider.svelte +13 -0
  78. package/dist/lib/components/ui/register-form/register-provider.svelte.d.ts +25 -0
  79. package/dist/lib/components/ui/register-form/register-submit.svelte +17 -0
  80. package/dist/lib/components/ui/register-form/register-submit.svelte.d.ts +7 -0
  81. package/dist/lib/components/ui/register-form/register-user-input.svelte +21 -0
  82. package/dist/lib/components/ui/register-form/register-user-input.svelte.d.ts +26 -0
  83. package/dist/lib/components/ui/register-form/register.schema.d.ts +8 -0
  84. package/dist/lib/components/ui/register-form/register.schema.js +7 -0
  85. package/dist/lib/components/ui/reset-password/index.d.ts +8 -2
  86. package/dist/lib/components/ui/reset-password/index.js +8 -2
  87. package/dist/lib/components/ui/reset-password/reset-password-container.svelte +27 -0
  88. package/dist/lib/components/ui/reset-password/reset-password-container.svelte.d.ts +8 -0
  89. package/dist/lib/components/ui/reset-password/reset-password-form.svelte +91 -0
  90. package/dist/lib/components/ui/reset-password/reset-password-form.svelte.d.ts +20 -0
  91. package/dist/lib/components/ui/reset-password/reset-password-header.svelte +34 -0
  92. package/dist/lib/components/ui/reset-password/reset-password-header.svelte.d.ts +13 -0
  93. package/dist/lib/components/ui/reset-password/reset-password-password-input.svelte +21 -0
  94. package/dist/lib/components/ui/reset-password/reset-password-password-input.svelte.d.ts +26 -0
  95. package/dist/lib/components/ui/reset-password/reset-password-provider.svelte +13 -0
  96. package/dist/lib/components/ui/reset-password/reset-password-provider.svelte.d.ts +25 -0
  97. package/dist/lib/components/ui/reset-password/reset-password-submit.svelte +17 -0
  98. package/dist/lib/components/ui/reset-password/reset-password-submit.svelte.d.ts +7 -0
  99. package/dist/lib/components/ui/reset-password/reset-password.schema.d.ts +6 -0
  100. package/dist/lib/components/ui/reset-password/reset-password.schema.js +9 -0
  101. package/dist/lib/hooks/index.d.ts +1 -0
  102. package/dist/lib/hooks/index.js +1 -0
  103. package/dist/lib/index.d.ts +2 -0
  104. package/dist/lib/index.js +3 -0
  105. package/dist/lib/utils.d.ts +10 -0
  106. package/package.json +40 -69
  107. package/src/app.css +174 -0
  108. package/src/app.html +0 -1
  109. package/src/index.ts +1 -0
  110. package/src/lib/components/types.ts +24 -0
  111. package/src/lib/components/ui/auth-layout/auth-layout-content-top.svelte +15 -0
  112. package/src/lib/components/ui/auth-layout/auth-layout-content.svelte +15 -0
  113. package/src/lib/components/ui/auth-layout/auth-layout-feature-info.svelte +45 -0
  114. package/src/lib/components/ui/auth-layout/auth-layout-feature.svelte +24 -0
  115. package/src/lib/components/ui/auth-layout/auth-layout-logo.svelte +99 -0
  116. package/src/lib/components/ui/auth-layout/auth-layout-main.svelte +17 -0
  117. package/src/lib/components/ui/auth-layout/auth-layout.svelte +22 -88
  118. package/src/lib/components/ui/auth-layout/index.ts +20 -2
  119. package/src/lib/components/ui/forgot-password/forgot-password-container.svelte +27 -0
  120. package/src/lib/components/ui/forgot-password/forgot-password-form.svelte +70 -81
  121. package/src/lib/components/ui/forgot-password/forgot-password-header.svelte +34 -0
  122. package/src/lib/components/ui/forgot-password/forgot-password-login.svelte +19 -0
  123. package/src/lib/components/ui/forgot-password/forgot-password-provider.svelte +13 -0
  124. package/src/lib/components/ui/forgot-password/forgot-password-submit.svelte +17 -0
  125. package/src/lib/components/ui/forgot-password/forgot-password-user-input.svelte +21 -0
  126. package/src/lib/components/ui/forgot-password/forgot-password.schema.ts +7 -0
  127. package/src/lib/components/ui/forgot-password/index.ts +19 -2
  128. package/src/lib/components/ui/index.ts +6 -0
  129. package/src/lib/components/ui/login-form/index.ts +26 -2
  130. package/src/lib/components/ui/login-form/login-container.svelte +27 -0
  131. package/src/lib/components/ui/login-form/login-context.ts +16 -0
  132. package/src/lib/components/ui/login-form/login-forgot-password.svelte +19 -0
  133. package/src/lib/components/ui/login-form/login-form.svelte +68 -111
  134. package/src/lib/components/ui/login-form/login-header.svelte +34 -0
  135. package/src/lib/components/ui/login-form/login-password-input.svelte +21 -0
  136. package/src/lib/components/ui/login-form/login-provider.svelte +13 -0
  137. package/src/lib/components/ui/login-form/login-submit.svelte +17 -0
  138. package/src/lib/components/ui/login-form/login-user-input.svelte +21 -0
  139. package/src/lib/components/ui/login-form/login.schema.ts +8 -0
  140. package/src/lib/components/ui/register-form/index.ts +21 -2
  141. package/src/lib/components/ui/register-form/register-container.svelte +27 -0
  142. package/src/lib/components/ui/register-form/register-form.svelte +67 -170
  143. package/src/lib/components/ui/register-form/register-header.svelte +34 -0
  144. package/src/lib/components/ui/register-form/register-name-input.svelte +21 -0
  145. package/src/lib/components/ui/register-form/register-password-input.svelte +21 -0
  146. package/src/lib/components/ui/register-form/register-provider.svelte +13 -0
  147. package/src/lib/components/ui/register-form/register-submit.svelte +17 -0
  148. package/src/lib/components/ui/register-form/register-user-input.svelte +21 -0
  149. package/src/lib/components/ui/register-form/register.schema.ts +10 -0
  150. package/src/lib/components/ui/reset-password/index.ts +17 -2
  151. package/src/lib/components/ui/reset-password/reset-password-container.svelte +27 -0
  152. package/src/lib/components/ui/reset-password/reset-password-form.svelte +91 -0
  153. package/src/lib/components/ui/reset-password/reset-password-header.svelte +34 -0
  154. package/src/lib/components/ui/reset-password/reset-password-password-input.svelte +21 -0
  155. package/src/lib/components/ui/reset-password/reset-password-provider.svelte +13 -0
  156. package/src/lib/components/ui/reset-password/reset-password-submit.svelte +17 -0
  157. package/src/lib/components/ui/reset-password/reset-password.schema.ts +12 -0
  158. package/src/lib/hooks/index.ts +1 -0
  159. package/src/lib/index.ts +3 -0
  160. package/src/lib/utils.ts +8 -1
  161. package/dist/lib/components/ui/reset-password/reset-form.svelte +0 -120
  162. package/dist/lib/components/ui/reset-password/reset-form.svelte.d.ts +0 -16
  163. package/src/lib/components/ui/reset-password/reset-form.svelte +0 -120
@@ -0,0 +1,24 @@
1
+ import type { FsSuperForm } from 'formsnap';
2
+ import type { WithChild } from 'svelte-toolbelt';
3
+ import type { SuperForm } from 'sveltekit-superforms';
4
+
5
+ export type FsSuperFormPrimitive<T extends Record<string, unknown>> =
6
+ FsSuperForm<T>;
7
+
8
+ export type LoginProviderProps<T extends Record<string, unknown>> = WithChild<
9
+ {
10
+ superforms: SuperForm<T>;
11
+ action?: string;
12
+ method?:
13
+ | 'dialog'
14
+ | 'get'
15
+ | 'post'
16
+ | 'DIALOG'
17
+ | 'GET'
18
+ | 'POST'
19
+ | null
20
+ | undefined;
21
+ // children: Snippet;
22
+ },
23
+ { props: { superforms: SuperForm<T> } }
24
+ >;
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ import { cn } from "@tanglemedia/svelte-starter-ui-shadcn";
3
+ import type { Snippet } from "svelte";
4
+
5
+ type Props = {
6
+ children?: Snippet<[]>;
7
+ class?: string;
8
+ };
9
+
10
+ const { children, class: cls }: Props = $props();
11
+ </script>
12
+
13
+ <div class={cn("flex justify-center gap-2 md:justify-start", cls)}>
14
+ {@render children?.()}
15
+ </div>
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ import { cn } from "@tanglemedia/svelte-starter-ui-shadcn";
3
+ import type { Snippet } from "svelte";
4
+
5
+ type Props = {
6
+ children?: Snippet<[]>;
7
+ class?: string;
8
+ };
9
+
10
+ const { children, class: cls }: Props = $props();
11
+ </script>
12
+
13
+ <div class={cn("flex flex-col gap-4 p-6 md:p-10", cls)}>
14
+ {@render children?.()}
15
+ </div>
@@ -0,0 +1,45 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from "svelte";
3
+
4
+ interface Props {
5
+ logo?: string | null;
6
+ logoClass?: string | null;
7
+ name?: string | null;
8
+ quote?: string | null;
9
+ quoteAuthor?: string | null;
10
+ children?: Snippet;
11
+ }
12
+
13
+ let {
14
+ logo = null,
15
+ name = "Tangle Media Inc.",
16
+ quote = "",
17
+ quoteAuthor = "",
18
+ logoClass,
19
+ children,
20
+ }: Props = $props();
21
+ </script>
22
+
23
+ <div
24
+ class="text-white top-6 left-6 right-6 bottom-6 absolute text-lg font-medium text-shadow-lg"
25
+ >
26
+ {@render renderLogoName()}
27
+ {@render children?.()}
28
+ <blockquote class="space-y-2 mt-2 lg:mt-0 mr-4 lg:mr-0 hidden lg:block lg:absolute bottom-6">
29
+ <p class="text-sm text-shadow-lg">
30
+ {quote}
31
+ </p>
32
+ <footer class="text-xs text-shadow-lg">{quoteAuthor}</footer>
33
+ </blockquote>
34
+ </div>
35
+
36
+ {#snippet renderLogoName()}
37
+ <div class="flex items-center gap-4">
38
+ {#if logo}
39
+ <img src={logo} alt="logo" class={logoClass} />
40
+ {/if}
41
+ {#if name}
42
+ {name}
43
+ {/if}
44
+ </div>
45
+ {/snippet}
@@ -0,0 +1,24 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from "svelte";
3
+
4
+ interface Props {
5
+ image?: string | null;
6
+ children?: Snippet;
7
+ }
8
+
9
+ let {
10
+ image = "https://images.unsplash.com/photo-1590069261209-f8e9b8642343?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1376&q=80",
11
+ children,
12
+ }: Props = $props();
13
+ </script>
14
+
15
+ <div
16
+ class="absolute top-0 left-0 right-0 bottom-0 z-[-1]"
17
+ style="
18
+ background-image:
19
+ url({image});
20
+ background-size: cover;
21
+ background-position: center"
22
+ >
23
+ {@render children?.()}
24
+ </div>
@@ -0,0 +1,99 @@
1
+ <script lang="ts" module>
2
+ import { type VariantProps, tv } from 'tailwind-variants';
3
+
4
+ const authLogoSizeVariants = tv({
5
+ base: 'flex shrink-0 overflow-hidden rounded-lg',
6
+ variants: {
7
+ size: {
8
+ default: 'size-8',
9
+ lg: 'size-16',
10
+ xl: 'size-24',
11
+ '2xl': 'size-32',
12
+ '3xl': 'size-40',
13
+ },
14
+ },
15
+ defaultVariants: {
16
+ size: 'default',
17
+ },
18
+ });
19
+
20
+ const authLogoTextSizeVariants = tv({
21
+ base: '',
22
+ variants: {
23
+ size: {
24
+ default: '',
25
+ lg: 'text-2xl',
26
+ xl: 'text-5xl',
27
+ '2xl': 'text-6xl',
28
+ '3xl': 'text-9xl',
29
+ },
30
+ },
31
+ defaultVariants: {
32
+ size: 'default',
33
+ },
34
+ });
35
+
36
+ const authLogoAlignVariants = tv({
37
+ base: 'flex items-center gap-2 font-medium',
38
+ variants: {
39
+ align: {
40
+ default: 'self-auto',
41
+ left: 'self-start',
42
+ right: 'self-end',
43
+ center: 'self-center',
44
+ },
45
+ },
46
+ defaultVariants: {
47
+ align: 'default',
48
+ },
49
+ });
50
+
51
+ export type AuthLogoSize = VariantProps<typeof authLogoSizeVariants>['size'];
52
+ export type AuthLogoAlign = VariantProps<
53
+ typeof authLogoAlignVariants
54
+ >['align'];
55
+ </script>
56
+
57
+ <script lang="ts">
58
+ import { cn } from '@tanglemedia/svelte-starter-ui-shadcn';
59
+ import type { Snippet } from 'svelte';
60
+
61
+ type Props = {
62
+ children?: Snippet<[]>;
63
+ class?: string;
64
+ src?: string | null;
65
+ logoClass?: string | null;
66
+ href?: string;
67
+ size?: AuthLogoSize;
68
+ align?: AuthLogoAlign;
69
+ };
70
+
71
+ const {
72
+ children,
73
+ class: cls,
74
+ src,
75
+ logoClass,
76
+ href,
77
+ size,
78
+ align,
79
+ }: Props = $props();
80
+
81
+ // cn(authLogoVariants({ size }));
82
+ </script>
83
+
84
+ <svelte:element
85
+ this={href ? 'a' : 'span'}
86
+ class={cn(authLogoAlignVariants({ align }), cls)}
87
+ {href}
88
+ >
89
+ <div class={cn(authLogoSizeVariants({ size }))}>
90
+ {#if src}
91
+ <img {src} alt="logo" class={cn('aspect-square size-full', logoClass)} />
92
+ {/if}
93
+ </div>
94
+ {#if children}
95
+ <div class={cn(authLogoTextSizeVariants({ size }))}>
96
+ {@render children?.()}
97
+ </div>
98
+ {/if}
99
+ </svelte:element>
@@ -0,0 +1,17 @@
1
+ <script lang="ts">
2
+ import { cn } from '@tanglemedia/svelte-starter-ui-shadcn';
3
+ import type { Snippet } from 'svelte';
4
+
5
+ type Props = {
6
+ children?: Snippet<[]>;
7
+ class?: string;
8
+ };
9
+
10
+ const { children, class: cls }: Props = $props();
11
+ </script>
12
+
13
+ <div class={cn('flex flex-1 items-center justify-center', cls)}>
14
+ <div class="w-full max-w-sm lg:max-w-md flex flex-col gap-6">
15
+ {@render children?.()}
16
+ </div>
17
+ </div>
@@ -1,97 +1,31 @@
1
1
  <script lang="ts">
2
- import { Button } from '@tanglemedia/svelte-starter-ui-shadcn/Button';
3
- // import { getConfig } from '@tanglemedia/svelte-starter-core';
2
+ import type { Snippet } from "svelte";
4
3
 
5
4
  interface Props {
6
- logo?: string | null;
7
- backgroundImage?: string | null;
8
- name?: string | null;
9
- quote?: string | null;
10
- quoteAuthor?: string | null;
11
- layoutMode?: string | null;
12
- leftSideBackground?: string | null;
13
- rightSideBackground?: string | null;
14
- opacity?: number | null;
15
- logoClass?: string | null;
16
- filterClass?: string | null;
17
- backgroundImageClass?: string | null;
5
+ side?: "left" | "right";
6
+ feature?: Snippet;
7
+ children: Snippet;
18
8
  }
19
9
 
20
- let {
21
- logo = null,
22
- backgroundImage = "https://images.unsplash.com/photo-1590069261209-f8e9b8642343?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1376&q=80",
23
- name = "Tangle Media Inc.",
24
- quote = "",
25
- quoteAuthor = "",
26
- layoutMode,
27
- leftSideBackground,
28
- rightSideBackground,
29
- opacity,
30
- logoClass = "",
31
- filterClass,
32
- backgroundImageClass = "",
33
- children
34
- }: Props = $props();
10
+ let { side = "left", feature, children }: Props = $props();
35
11
  </script>
36
12
 
37
- <div
38
- class="container relative h-[100vh] flex-col items-center justify-center grid lg:max-w-none lg:grid-cols-2 lg:px-0"
39
- >
40
- <div class="bg-muted relative hidden h-full flex-col p-10 text-white lg:flex dark:border-r">
41
- <div
42
- class="absolute inset-0 bg-background {backgroundImageClass}"
43
- style="
44
- background-image:
45
- url({backgroundImage});"
46
- ></div>
47
- <div class="relative z-20 flex items-center text-lg font-medium text-shadow-lg">
48
- {#if logo}
49
- <img src={logo} alt="logo" class={logoClass} />
50
- {:else}
51
- {name}
52
- {/if}
53
- </div>
54
- <div class="relative z-20 mt-auto">
55
- <blockquote class="space-y-2">
56
- <p class="text-lg text-shadow-lg">
57
- {quote}
58
- </p>
59
- <footer class="text-sm text-shadow-lg">{quoteAuthor}</footer>
60
- </blockquote>
61
- </div>
62
- <div class="absolute top-0 bottom-0 left-0 right-0 bg-primary-500/10 filter blur(2px)"></div>
63
- </div>
64
- <div class="lg:hidden absolute top-0 left-0 right-0 bottom-1/2 z-[-1] {backgroundImageClass}" style="
65
- mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
66
- background-image:
67
- url({backgroundImage});
68
- background-size: cover;
69
- background-position: center">
70
- <div class="text-white top-6 left-6 absolute text-lg font-medium z-20 text-shadow-lg">
71
- {#if logo}
72
- <img src={logo} alt="logo" class={logoClass} />
73
- {:else}
74
- {name}
75
- {/if}
76
- <blockquote class="space-y-2 mt-2 mr-4">
77
- <p class="text-sm text-shadow-lg">
78
- {quote}
79
- </p>
80
- <footer class="text-xs text-shadow-lg">{quoteAuthor}</footer>
81
- </blockquote>
82
- </div>
83
- <div class="absolute top-0 bottom-0 left-0 right-0 bg-primary-500/10 filter blur(2px)"></div>
84
- <div class="absolute bottom-0 left-0 right-0 h-20 bg-gradient-to-b from-gray-900/10 to-background transition duration-500 ease-in-out"></div>
85
- </div>
86
- <div class="lg:p-8">
87
- <div class="mx-auto flex w-full flex-col justify-center space-y-6">
88
- {@render children()}
89
- </div>
90
- </div>
13
+ <div class="relative min-h-svh grid grid-cols-1 lg:grid-cols-2">
14
+ {#if side === "left"}
15
+ {#if feature}
16
+ {@render renderFeature()}
17
+ {/if}
18
+ {/if}
19
+ {@render children()}
20
+ {#if side === "right"}
21
+ {#if feature}
22
+ {@render renderFeature()}
23
+ {/if}
24
+ {/if}
91
25
  </div>
92
26
 
93
- <style lang="postcss">
94
- .text-shadow-lg {
95
- text-shadow: 0 2px 2px rgb(0 0 0 / 0.4);
96
- }
97
- </style>
27
+ {#snippet renderFeature()}
28
+ <div class="w-full absolute h-[50vh] lg:h-screen lg:relative lg:block">
29
+ {@render feature?.()}
30
+ </div>
31
+ {/snippet}
@@ -1,3 +1,21 @@
1
- import AuthLayout from './auth-layout.svelte';
1
+ import Root from "./auth-layout.svelte";
2
+ import Feature from "./auth-layout-feature.svelte";
3
+ import Info from "./auth-layout-feature-info.svelte";
4
+ import Content from './auth-layout-content.svelte';
5
+ import Main from './auth-layout-main.svelte';
6
+ import ContentTop from './auth-layout-content-top.svelte';
7
+ import Logo from './auth-layout-logo.svelte';
2
8
 
3
- export { AuthLayout };
9
+ export {
10
+ Root,
11
+ Feature,
12
+ Info,
13
+ Content,
14
+ ContentTop,
15
+ Main,
16
+ Logo,
17
+ //
18
+ Root as AuthLayout,
19
+ Feature as AuthLayoutFeature,
20
+ Info as AuthLayoutFeatureInfo
21
+ };
@@ -0,0 +1,27 @@
1
+ <script lang="ts">
2
+ import { Card } from '@tanglemedia/svelte-starter-ui-shadcn';
3
+ import type { WithChild } from 'svelte-toolbelt';
4
+ import { cn } from '../../../utils.js';
5
+
6
+ type ForgotPasswordContainerProps = Omit<WithChild, 'child'> & {
7
+ class?: string;
8
+ card?: boolean;
9
+ };
10
+
11
+ const {
12
+ children,
13
+ class: cls,
14
+ card = true,
15
+ ...rest
16
+ }: ForgotPasswordContainerProps = $props();
17
+ </script>
18
+
19
+ {#if !card}
20
+ <div class={cn('mx-auto max-w-sm', cls)} {...rest}>
21
+ {@render children?.()}
22
+ </div>
23
+ {:else}
24
+ <Card.Root class={cn('mx-auto max-w-sm', cls)} {...rest}>
25
+ {@render children?.()}
26
+ </Card.Root>
27
+ {/if}
@@ -1,102 +1,91 @@
1
1
  <script lang="ts">
2
- import * as Card from '@tanglemedia/svelte-starter-ui-shadcn/Card';
3
- import { Button } from '@tanglemedia/svelte-starter-ui-shadcn/Button';
4
- import { Input } from '@tanglemedia/svelte-starter-ui-shadcn/Input';
5
- import { Label } from '@tanglemedia/svelte-starter-ui-shadcn/Label';
6
- import * as Form from '@tanglemedia/svelte-starter-ui-shadcn/Form';
7
- import type { Snippet } from 'svelte';
2
+ import { Card } from "@tanglemedia/svelte-starter-ui-shadcn";
3
+ import type { Snippet } from "svelte";
4
+ import SuperDebug, {
5
+ defaults,
6
+ superForm,
7
+ type Infer,
8
+ type SuperForm,
9
+ type SuperValidated,
10
+ } from "sveltekit-superforms";
11
+ import { zod4 } from "sveltekit-superforms/adapters";
12
+ import ForgotPasswordContainer from "./forgot-password-container.svelte";
13
+ import ForgotPasswordUserInput from "./forgot-password-user-input.svelte";
14
+ import ForgotPasswordHeader from "./forgot-password-header.svelte";
15
+ import ForgotPasswordProvider from "./forgot-password-provider.svelte";
16
+ import ForgotPasswordSubmit from "./forgot-password-submit.svelte";
17
+ import ForgotPasswordLogin from "./forgot-password-login.svelte";
18
+ import { forgotPasswordSchema, type ForgotPasswordSchema } from "./forgot-password.schema.js";
19
+ import { ServerError } from "@tanglemedia/svelte-starter-form-shadcn";
8
20
 
9
21
  interface Props {
10
- superform: any;
22
+ superform?: SuperForm<Infer<ForgotPasswordSchema>> | null;
11
23
  card?: boolean;
12
- cardClass?: string;
24
+ // cardClass?: string;
13
25
  title?: string;
14
26
  description?: string;
15
- login?: boolean;
27
+ // forgotPassword?: boolean;
16
28
  loginLink?: string;
17
- formTail?: Snippet;
18
- formHead?: Snippet;
29
+ register?: boolean;
30
+ registerLink?: string;
31
+ lead?: Snippet;
32
+ tail?: Snippet;
19
33
  children?: Snippet;
34
+ form?: SuperValidated<Infer<ForgotPasswordSchema>>;
35
+ action?: string;
36
+
37
+ debug?: boolean;
20
38
  }
21
39
 
22
- let {
23
- superform,
24
- card = false,
25
- cardClass = "mx-auto max-w-sm",
26
- title = "Forgot Password",
40
+ let {
41
+ debug = false,
42
+ form,
43
+ superform: superforms = $bindable(null),
44
+ card = true,
45
+ title = "Forgot Password",
27
46
  description = "Enter your email below to request a password reset",
28
- login = true,
47
+ // forgotPassword = true,
29
48
  loginLink = "/login",
30
- formTail,
31
- formHead,
32
- children
49
+ register = true,
50
+ registerLink = "/register",
51
+ lead,
52
+ tail,
53
+ action = "?/forgot-password",
33
54
  }: Props = $props();
34
55
 
35
- const { form: formData, enhance } = superform;
56
+ superforms = superforms || superForm(form || defaults(zod4(forgotPasswordSchema)));
57
+
58
+ const { errors, message } = superforms;
36
59
  </script>
37
60
 
38
- {#if card}
39
- <Card.Root class={cardClass}>
40
- <Card.Header>
41
- <Card.Title class="text-2xl">{title}</Card.Title>
42
- <Card.Description>{description}</Card.Description>
43
- </Card.Header>
61
+ <ForgotPasswordProvider {superforms} {action}>
62
+ <ForgotPasswordContainer {card}>
63
+ <ForgotPasswordHeader text={title} desc={description} />
44
64
  <Card.Content>
45
- <form method="POST" use:enhance class="grid gap-4">
46
- {@render formHead?.()}
47
- {#if children}
48
- {@render children?.()}
49
- {:else}
50
- <Form.Field form={superform} name="email">
51
- <Form.Control>
52
- {#snippet children({ props })}
53
- <Form.Label>Email</Form.Label>
54
- <Input {...props} bind:value={$formData.email} type="email" required />
55
- {/snippet}
56
- </Form.Control>
57
- <Form.FieldErrors />
58
- </Form.Field>
59
- {/if}
60
- <Form.Button type="submit" class="w-full">Request Password</Form.Button>
61
- {@render formTail?.()}
62
- </form>
63
- {#if login}
65
+ {@render lead?.()}
66
+ <ServerError class="mb-4" />
67
+ <ForgotPasswordUserInput name={"email"}>
68
+ {#snippet asideLabel()}
69
+ <ForgotPasswordLogin href={loginLink} />
70
+ {/snippet}
71
+ </ForgotPasswordUserInput>
72
+ <ForgotPasswordSubmit />
73
+ {#if register}
64
74
  <div class="mt-4 text-center text-sm">
65
- Remember your password?
66
- <a href={loginLink} class="underline"> Sign in </a>
75
+ Don't have an account?
76
+ <a href={registerLink} class="underline"> Sign up </a>
67
77
  </div>
68
78
  {/if}
69
- </Card.Content>
70
- </Card.Root>
71
- {:else}
72
- <div class={cardClass}>
73
- <div class="flex flex-col space-y-1.5 p-6 pb-0">
74
- <h3 class="font-semibold tracking-tight text-2xl">{title}</h3>
75
- <p class="text-muted-foreground text-sm">{description}</p>
76
- </div>
77
- <form method="POST" use:enhance class="grid gap-4 p-6">
78
- {@render formHead?.()}
79
- {#if children}
80
- {@render children?.()}
81
- {:else}
82
- <Form.Field form={superform} name="email">
83
- <Form.Control>
84
- {#snippet children({ props })}
85
- <Form.Label>Email</Form.Label>
86
- <Input {...props} bind:value={$formData.email} type="email" required />
87
- {/snippet}
88
- </Form.Control>
89
- <Form.FieldErrors />
90
- </Form.Field>
79
+ {@render tail?.()}
80
+
81
+ {#if debug}
82
+ <div class="mb-6">
83
+ <h4>Errors</h4>
84
+ <SuperDebug data={errors} />
85
+ </div>
86
+ <h4>Message</h4>
87
+ <SuperDebug data={$message} />
91
88
  {/if}
92
- <Form.Button type="submit" class="w-full">Request Password</Form.Button>
93
- {@render formTail?.()}
94
- </form>
95
- {#if login}
96
- <div class="mt-4 text-center text-sm">
97
- Remember your password?
98
- <a href={loginLink} class="underline"> Sign in </a>
99
- </div>
100
- {/if}
101
- </div>
102
- {/if}
89
+ </Card.Content>
90
+ </ForgotPasswordContainer>
91
+ </ForgotPasswordProvider>
@@ -0,0 +1,34 @@
1
+ <script lang="ts">
2
+ import { Card } from '@tanglemedia/svelte-starter-ui-shadcn';
3
+ import type { Snippet } from 'svelte';
4
+
5
+ type LoginHeaderAttr = {
6
+ text?: string;
7
+ desc?: string;
8
+ };
9
+
10
+ type LoginHeaderProps = LoginHeaderAttr & {
11
+ title?: Snippet<[LoginHeaderAttr]>;
12
+ description?: Snippet<[LoginHeaderAttr]>;
13
+ children?: Snippet<[LoginHeaderAttr]>;
14
+ };
15
+
16
+ let { title, children, description, ...restProps }: LoginHeaderProps = $props();
17
+ </script>
18
+
19
+ <Card.Header>
20
+ <Card.Title class="text-2xl">
21
+ {#if title}
22
+ {@render title(restProps)}
23
+ {:else if children}
24
+ {@render children?.(restProps)}
25
+ {:else}
26
+ {restProps.text}
27
+ {/if}
28
+ </Card.Title>
29
+ {#if description}
30
+ <Card.Description>{@render description(restProps)}</Card.Description>
31
+ {:else if restProps.desc}
32
+ <Card.Description>{restProps.desc}</Card.Description>
33
+ {/if}
34
+ </Card.Header>
@@ -0,0 +1,19 @@
1
+ <script lang="ts">
2
+ import { cn } from "$lib/utils.js";
3
+ import type { Snippet } from "svelte";
4
+
5
+ type LoginForgotPasswordProps = {
6
+ href: string;
7
+ class?: string;
8
+ children?: Snippet;
9
+ };
10
+ const { href, class: cls, children }: LoginForgotPasswordProps = $props();
11
+ </script>
12
+
13
+ <a {href} class={cn("ml-auto inline-block text-sm underline", cls)}>
14
+ {#if children}
15
+ {@render children?.()}
16
+ {:else}
17
+ Back to login
18
+ {/if}
19
+ </a>
@@ -0,0 +1,13 @@
1
+ <script lang="ts" module>
2
+ type T = Record<string, unknown>;
3
+ </script>
4
+
5
+ <script lang="ts" generics="T extends Record<string, unknown>">
6
+ import {
7
+ Form,
8
+ type FormProviderProps,
9
+ } from "@tanglemedia/svelte-starter-form-shadcn";
10
+ let rest: FormProviderProps<T> = $props();
11
+ </script>
12
+
13
+ <Form.Provider {...rest} />