flowbite-svelte 0.15.7 → 0.15.10

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.
@@ -2,7 +2,6 @@ import { SvelteComponentTyped } from "svelte";
2
2
  import type { RadioType } from '../types';
3
3
  declare const __propDef: {
4
4
  props: {
5
- legend?: string;
6
5
  divClass?: string;
7
6
  inputClass?: string;
8
7
  labelClass?: string;
@@ -12,7 +11,9 @@ declare const __propDef: {
12
11
  events: {
13
12
  [evt: string]: CustomEvent<any>;
14
13
  };
15
- slots: {};
14
+ slots: {
15
+ helper: {};
16
+ };
16
17
  };
17
18
  export declare type RadioProps = typeof __propDef.props;
18
19
  export declare type RadioEvents = typeof __propDef.events;
@@ -1,16 +1,47 @@
1
1
  <script>import generateId from '../utils/generateId.js';
2
2
  export let name = 'toggle-example';
3
+ export let color;
4
+ export let size = 'default';
3
5
  export let id = generateId();
4
6
  export let label = 'Toggle me';
7
+ export let value;
5
8
  export let checked = false;
6
9
  export let disabled = false;
7
- export let labelClass = 'flex relative items-center mb-4 cursor-pointer';
10
+ export let labelClass = 'relative inline-flex items-center cursor-pointer';
8
11
  export let divClass = 'w-11 h-6 bg-gray-200 rounded-full border border-gray-200 toggle-bg dark:bg-gray-700 dark:border-gray-600';
12
+ export let inputClass = 'sr-only';
13
+ if (color || size) {
14
+ inputClass += ' peer';
15
+ }
9
16
  export let spanClass = 'ml-3 text-sm font-medium text-gray-900 dark:text-gray-300';
17
+ if (color === 'red') {
18
+ divClass = "w-11 h-6 bg-gray-200 rounded-full peer peer-focus:ring-4 peer-focus:ring-red-300 dark:peer-focus:ring-red-800 dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-red-600";
19
+ }
20
+ else if (color === 'green') {
21
+ divClass = "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-green-300 dark:peer-focus:ring-green-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-green-600";
22
+ }
23
+ else if (color === 'purple') {
24
+ divClass = "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-purple-300 dark:peer-focus:ring-purple-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-purple-600";
25
+ }
26
+ else if (color === 'yellow') {
27
+ divClass = "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-yellow-300 dark:peer-focus:ring-yellow-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-yellow-400";
28
+ }
29
+ else if (color === 'teal') {
30
+ divClass = "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-teal-300 dark:peer-focus:ring-teal-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-teal-600";
31
+ }
32
+ else if (color === 'orange') {
33
+ divClass = "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-orange-300 dark:peer-focus:ring-orange-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-orange-500";
34
+ }
35
+ else if (size === 'small') {
36
+ divClass = "w-9 h-5 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600";
37
+ }
38
+ else if (size === 'large') {
39
+ divClass = "w-14 h-7 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[4px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-6 after:w-6 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600";
40
+ }
10
41
  </script>
11
42
 
12
43
  <label for={id} class={labelClass}>
13
- <input type="checkbox" {id} class="sr-only" {checked} {name} {disabled} />
14
- <div class={divClass} />
44
+ <input type="checkbox" {id} class={inputClass} {value} {checked} {name} {disabled} />
45
+ <div class="{divClass} {$$props.class}" />
15
46
  <span class={spanClass}>{label}</span>
16
47
  </label>
@@ -1,13 +1,19 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
+ import type { ToggleColorType } from '../types.js';
2
3
  declare const __propDef: {
3
4
  props: {
5
+ [x: string]: any;
4
6
  name?: string;
7
+ color: ToggleColorType;
8
+ size?: 'small' | 'default' | 'large';
5
9
  id?: string;
6
10
  label?: string;
11
+ value: string;
7
12
  checked?: boolean;
8
13
  disabled?: boolean;
9
14
  labelClass?: string;
10
15
  divClass?: string;
16
+ inputClass?: string;
11
17
  spanClass?: string;
12
18
  };
13
19
  events: {
package/index.js CHANGED
@@ -7,13 +7,6 @@ export { default as Alert } from'./alerts/Alert.svelte'
7
7
  export { default as BorderAlert } from'./alerts/BorderAlert.svelte'
8
8
  export { default as InfoAlert } from'./alerts/InfoAlert.svelte'
9
9
 
10
- // Auth
11
- export { default as Confirm } from'./auth/Confirm.svelte'
12
- export { default as ForgotPassword } from'./auth/ForgotPassword.svelte'
13
- export { default as Login } from'./auth/Login.svelte'
14
- export { default as Register } from'./auth/Register.svelte'
15
- export { default as Reset } from './auth/Reset.svelte'
16
-
17
10
  // Avatar
18
11
  export { default as Avatar } from './avatar/Avatar.svelte'
19
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbite-svelte",
3
- "version": "0.15.7",
3
+ "version": "0.15.10",
4
4
  "description": "Flowbite components for Svelte",
5
5
  "main": "./package/index.js",
6
6
  "author": {
@@ -13,7 +13,7 @@
13
13
  "license": "MIT",
14
14
  "devDependencies": {
15
15
  "@codewithshin/svelte-feathericons": "^0.1.9",
16
- "@codewithshin/svelte-sidebar": "^0.4.8",
16
+ "@codewithshin/svelte-sidebar": "^0.5.7",
17
17
  "@codewithshin/svelte-utterances": "^0.2.2",
18
18
  "@playwright/test": "^1.21.0",
19
19
  "@sveltejs/adapter-auto": "next",
@@ -90,12 +90,6 @@
90
90
  "./alerts/Alert.svelte": "./alerts/Alert.svelte",
91
91
  "./alerts/BorderAlert.svelte": "./alerts/BorderAlert.svelte",
92
92
  "./alerts/InfoAlert.svelte": "./alerts/InfoAlert.svelte",
93
- "./auth/Confirm.svelte": "./auth/Confirm.svelte",
94
- "./auth/ForgotPassword.svelte": "./auth/ForgotPassword.svelte",
95
- "./auth/Input.svelte": "./auth/Input.svelte",
96
- "./auth/Login.svelte": "./auth/Login.svelte",
97
- "./auth/Register.svelte": "./auth/Register.svelte",
98
- "./auth/Reset.svelte": "./auth/Reset.svelte",
99
93
  "./avatar/Avatar.svelte": "./avatar/Avatar.svelte",
100
94
  "./badges/Badge.svelte": "./badges/Badge.svelte",
101
95
  "./badges/BadgeIcon.svelte": "./badges/BadgeIcon.svelte",
package/types.d.ts CHANGED
@@ -119,7 +119,7 @@ export interface PillTabType {
119
119
  }
120
120
  export interface RadioType {
121
121
  id: string;
122
- label: string;
122
+ label: string | HTMLElement;
123
123
  value: string;
124
124
  checked?: boolean;
125
125
  disabled?: boolean;
@@ -196,6 +196,7 @@ export interface TimelineItemHorizontalType {
196
196
  iconClass?: string;
197
197
  text?: HTMLElement | string;
198
198
  }
199
+ export declare type ToggleColorType = 'red' | 'green' | 'purple' | 'yellow' | 'teal' | 'orange';
199
200
  export interface TransitionParamTypes {
200
201
  delay?: number;
201
202
  duration?: number;
@@ -1,23 +0,0 @@
1
- <script>import { Button, Alert, Spinner } from '../index';
2
- export let loginLink;
3
- export let success;
4
- export let error;
5
- </script>
6
-
7
- <div
8
- class="p-4 max-w-sm bg-white rounded-lg border border-gray-200 shadow-md sm:p-6 lg:p-8 dark:bg-gray-800 dark:border-gray-700 w-full"
9
- >
10
- {#if success}
11
- <h1 class="text-xl w-full mb-4 font-medium text-gray-900 dark:text-white">
12
- Your email is confirmed.
13
- </h1>
14
- <a href={loginLink.href} class="py-4">
15
- <Button textSize="text-sm" >{loginLink.name}</Button>
16
- </a>
17
- {:else}
18
- <Spinner />
19
- {/if}
20
- {#if error}
21
- <Alert alertId="alert-red" color="red" closeBtn>{error}</Alert>
22
- {/if}
23
- </div>
@@ -1,19 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import type { LinkType } from '../types';
3
- declare const __propDef: {
4
- props: {
5
- loginLink: LinkType;
6
- success: string;
7
- error: string;
8
- };
9
- events: {
10
- [evt: string]: CustomEvent<any>;
11
- };
12
- slots: {};
13
- };
14
- export declare type ConfirmProps = typeof __propDef.props;
15
- export declare type ConfirmEvents = typeof __propDef.events;
16
- export declare type ConfirmSlots = typeof __propDef.slots;
17
- export default class Confirm extends SvelteComponentTyped<ConfirmProps, ConfirmEvents, ConfirmSlots> {
18
- }
19
- export {};
@@ -1,57 +0,0 @@
1
- <script>import { Alert } from '../index';
2
- export let forgot = undefined;
3
- export let email = '';
4
- export let error = '';
5
- export let message = '';
6
- export let data = '';
7
- </script>
8
-
9
- <div
10
- class="p-4 max-w-sm bg-white rounded-lg border border-gray-200 shadow-md sm:p-6 lg:p-8 dark:bg-gray-800 dark:border-gray-700 w-full"
11
- >
12
- <form class="space-y-6" on:submit|preventDefault={forgot}>
13
- <div class="heading">
14
- <a class="back" href="/"><i class="bi bi-arrow-left dark:text-white" /></a>
15
- <h2 class="text-xl font-medium text-gray-900 dark:text-white">Forgot password</h2>
16
- </div>
17
- <div>
18
- <label for="email" class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300"
19
- >Email</label
20
- >
21
- <input
22
- type="email"
23
- required
24
- name="email"
25
- placeholder="Enter your email"
26
- class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white"
27
- bind:value={email}
28
- />
29
- {#if data}
30
- <div class="mt-6">
31
- <Alert alertId="alert-green" color="yellow" closeBtn>
32
- {data}
33
- </Alert>
34
- </div>
35
- {/if}
36
- {#if message}
37
- <div class="mt-6">
38
- <Alert alertId="alert-green" color="green" closeBtn>
39
- {message}
40
- </Alert>
41
- </div>
42
- {/if}
43
- {#if error}
44
- <div class="mt-6">
45
- <Alert alertId="alert-green" color="red" closeBtn>
46
- {error}
47
- </Alert>
48
- </div>
49
- {/if}
50
- </div>
51
- <button
52
- type="submit"
53
- class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
54
- >Send recovery email</button
55
- >
56
- </form>
57
- </div>
@@ -1,21 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import type { AuthFunctionType } from '../types';
3
- declare const __propDef: {
4
- props: {
5
- forgot?: AuthFunctionType;
6
- email?: string;
7
- error?: string;
8
- message?: string;
9
- data?: string;
10
- };
11
- events: {
12
- [evt: string]: CustomEvent<any>;
13
- };
14
- slots: {};
15
- };
16
- export declare type ForgotPasswordProps = typeof __propDef.props;
17
- export declare type ForgotPasswordEvents = typeof __propDef.events;
18
- export declare type ForgotPasswordSlots = typeof __propDef.slots;
19
- export default class ForgotPassword extends SvelteComponentTyped<ForgotPasswordProps, ForgotPasswordEvents, ForgotPasswordSlots> {
20
- }
21
- export {};
package/auth/Input.svelte DELETED
File without changes
@@ -1,19 +0,0 @@
1
- /** @typedef {typeof __propDef.props} InputProps */
2
- /** @typedef {typeof __propDef.events} InputEvents */
3
- /** @typedef {typeof __propDef.slots} InputSlots */
4
- export default class Input extends SvelteComponentTyped<{}, {
5
- [evt: string]: CustomEvent<any>;
6
- }, {}> {
7
- }
8
- export type InputProps = typeof __propDef.props;
9
- export type InputEvents = typeof __propDef.events;
10
- export type InputSlots = typeof __propDef.slots;
11
- import { SvelteComponentTyped } from "svelte";
12
- declare const __propDef: {
13
- props: {};
14
- events: {
15
- [evt: string]: CustomEvent<any>;
16
- };
17
- slots: {};
18
- };
19
- export {};
package/auth/Login.svelte DELETED
@@ -1,116 +0,0 @@
1
- <script>import { Alert } from '../index';
2
- export let login = undefined;
3
- export let title = 'Sign in';
4
- export let btnSignInColor = 'blue';
5
- export let rememberMe = false;
6
- export let signup = undefined;
7
- export let lostPassword = undefined;
8
- export let error = '';
9
- export let submitText = 'Login to your account';
10
- let submitClass;
11
- export let fields;
12
- if (btnSignInColor === 'blue') {
13
- submitClass =
14
- 'w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800';
15
- }
16
- else if (btnSignInColor === 'gray') {
17
- submitClass =
18
- 'w-full text-white bg-gray-700 hover:bg-gray-800 focus:ring-4 focus:ring-gray-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-gray-600 dark:hover:bg-gray-700 dark:focus:ring-gray-800';
19
- }
20
- else if (btnSignInColor === 'red') {
21
- submitClass =
22
- 'w-full text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800';
23
- }
24
- else if (btnSignInColor === 'yellow') {
25
- submitClass =
26
- 'w-full text-white bg-yellow-700 hover:bg-yellow-800 focus:ring-4 focus:ring-yellow-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-yellow-600 dark:hover:bg-yellow-700 dark:focus:ring-yellow-800';
27
- }
28
- else if (btnSignInColor === 'green') {
29
- submitClass =
30
- 'w-full text-white bg-green-700 hover:bg-green-800 focus:ring-4 focus:ring-green-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800';
31
- }
32
- else if (btnSignInColor === 'indigo') {
33
- submitClass =
34
- 'w-full text-white bg-indigo-700 hover:bg-indigo-800 focus:ring-4 focus:ring-indigo-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-indigo-600 dark:hover:bg-indigo-700 dark:focus:ring-indigo-800';
35
- }
36
- else if (btnSignInColor === 'purple') {
37
- submitClass =
38
- 'w-full text-white bg-purple-700 hover:bg-purple-800 focus:ring-4 focus:ring-purple-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-purple-600 dark:hover:bg-purple-700 dark:focus:ring-purple-800';
39
- }
40
- else if (btnSignInColor === 'pink') {
41
- submitClass =
42
- 'w-full text-white bg-pink-700 hover:bg-pink-800 focus:ring-4 focus:ring-pink-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-pink-600 dark:hover:bg-pink-700 dark:focus:ring-pink-800';
43
- }
44
- else {
45
- submitClass =
46
- 'w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800';
47
- }
48
- </script>
49
-
50
- <div
51
- class="p-4 max-w-sm w-full bg-white rounded-lg border border-gray-200 shadow-md sm:p-6 lg:p-8 dark:bg-gray-800 dark:border-gray-700"
52
- >
53
- <form class="space-y-6" on:submit|preventDefault={login}>
54
- <h3 class="text-xl font-medium text-gray-900 dark:text-white">{title}</h3>
55
- {#each fields as field}
56
- <div>
57
- <label
58
- for={field.label}
59
- class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300"
60
- >{field.label}</label
61
- >
62
- <input
63
- type={field.fieldtype}
64
- name={field.label}
65
- id={field.label}
66
- class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white"
67
- placeholder={field.placeholder}
68
- required={field.required}
69
- />
70
- </div>
71
- {/each}
72
- <div class="flex items-start">
73
- {#if rememberMe}
74
- <div class="flex items-start">
75
- <div class="flex items-center h-5">
76
- <input
77
- id="remember"
78
- type="checkbox"
79
- class="w-4 h-4 bg-gray-50 rounded border border-gray-300 focus:ring-3 focus:ring-blue-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-blue-600 dark:ring-offset-gray-800"
80
- />
81
- </div>
82
- <div class="ml-3 text-sm">
83
- <label for="remember" class="font-medium text-gray-900 dark:text-gray-300"
84
- >Remember me</label
85
- >
86
- </div>
87
- </div>
88
- {/if}
89
- {#if lostPassword}
90
- <a
91
- href={lostPassword.href}
92
- rel={lostPassword.rel}
93
- class="ml-auto text-sm text-blue-700 hover:underline dark:text-blue-500"
94
- >{lostPassword.name}</a
95
- >
96
- {/if}
97
- </div>
98
- {#if error}
99
- <div class="mt-6">
100
- <Alert alertId="alert-red" color="red" closeBtn>
101
- {error}
102
- </Alert>
103
- </div>
104
- {/if}
105
- <button type="submit" class={submitClass}>{submitText}</button>
106
- {#if signup}
107
- <div class="text-sm font-medium text-gray-500 dark:text-gray-300">
108
- Not registered? <a
109
- href={signup.href}
110
- rel={signup.rel}
111
- class="text-blue-700 hover:underline dark:text-blue-500">{signup.name}</a
112
- >
113
- </div>
114
- {/if}
115
- </form>
116
- </div>
@@ -1,25 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import type { AuthFunctionType, LinkType, AuthFieldType } from '../types';
3
- declare const __propDef: {
4
- props: {
5
- login?: AuthFunctionType;
6
- title?: string;
7
- btnSignInColor?: string;
8
- rememberMe?: boolean;
9
- signup?: LinkType;
10
- lostPassword?: LinkType;
11
- error?: string;
12
- submitText?: string;
13
- fields: AuthFieldType[];
14
- };
15
- events: {
16
- [evt: string]: CustomEvent<any>;
17
- };
18
- slots: {};
19
- };
20
- export declare type LoginProps = typeof __propDef.props;
21
- export declare type LoginEvents = typeof __propDef.events;
22
- export declare type LoginSlots = typeof __propDef.slots;
23
- export default class Login extends SvelteComponentTyped<LoginProps, LoginEvents, LoginSlots> {
24
- }
25
- export {};
@@ -1,118 +0,0 @@
1
- <script>import { Alert } from '../index';
2
- import { createEventDispatcher } from 'svelte';
3
- const dispatch = createEventDispatcher();
4
- export let register = undefined;
5
- export let error = '';
6
- export let login = undefined;
7
- export let rememberMe = false;
8
- export let lostPassword = undefined;
9
- export let message = '';
10
- // Variables bound to respective inputs via bind:value
11
- // export let email: string = 'email';
12
- // export let password: string = '';
13
- // export let name: string = '';
14
- //
15
- // export let nameField: string = 'username';
16
- // field names password, name, email
17
- export let fields = [
18
- {
19
- label: 'name',
20
- fieldtype: 'text',
21
- required: true,
22
- placeholder: 'Your name'
23
- },
24
- {
25
- label: 'email',
26
- fieldtype: 'email',
27
- required: true,
28
- placeholder: 'Your email'
29
- },
30
- {
31
- label: 'password',
32
- fieldtype: 'password',
33
- required: true,
34
- placeholder: 'Your password'
35
- }
36
- ];
37
- </script>
38
-
39
- <div
40
- class="p-4 max-w-sm bg-white rounded-lg border border-gray-200 shadow-md sm:p-6 lg:p-8 dark:bg-gray-800 dark:border-gray-700 w-full"
41
- >
42
- <form class="space-y-6" on:submit|preventDefault={register}>
43
- {#if message}
44
- <div class="mt-6">
45
- <Alert alertId="alert-green" color="green" closeBtn>
46
- {message}
47
- </Alert>
48
- </div>
49
- {/if}
50
- <div class="heading">
51
- <a class="back" href="/"><i class="bi bi-arrow-left dark:text-white" /></a>
52
- <h3 class="text-xl font-medium text-gray-900 dark:text-white">Register</h3>
53
- </div>
54
- {#each fields as field}
55
- <div>
56
- <label
57
- for={field.label}
58
- class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300"
59
- >{field.label}</label
60
- >
61
- <input
62
- type={field.fieldtype}
63
- required={field.required}
64
- name={field.label}
65
- placeholder={field.placeholder}
66
- class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white"
67
- />
68
- </div>
69
- {/each}
70
- {#if error}
71
- <div class="mt-6">
72
- <Alert alertId="alert-green" color="red" closeBtn>
73
- {error}
74
- </Alert>
75
- </div>
76
- {/if}
77
- <div class="flex items-start">
78
- {#if rememberMe}
79
- <div class="flex items-start">
80
- <div class="flex items-center h-5">
81
- <input
82
- id="remember"
83
- aria-describedby="remember"
84
- type="checkbox"
85
- class="w-4 h-4 bg-gray-50 rounded border border-gray-300 focus:ring-3 focus:ring-blue-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-blue-600 dark:ring-offset-gray-800"
86
- required
87
- />
88
- </div>
89
- <div class="ml-3 text-sm">
90
- <label for="remember" class="font-medium text-gray-900 dark:text-gray-300"
91
- >Remember me</label
92
- >
93
- </div>
94
- </div>
95
- {/if}
96
- {#if lostPassword}
97
- <a
98
- href={lostPassword.href}
99
- rel={lostPassword.rel}
100
- class="ml-auto text-sm text-blue-700 hover:underline dark:text-blue-500"
101
- >{lostPassword.name}</a
102
- >
103
- {/if}
104
- </div>
105
- <button
106
- type="submit"
107
- class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
108
- >Register</button
109
- >
110
- {#if login}
111
- <a
112
- href={login.href}
113
- rel={login.rel}
114
- class="ml-auto text-sm text-blue-700 hover:underline dark:text-blue-500">{login.name}</a
115
- >
116
- {/if}
117
- </form>
118
- </div>
@@ -1,23 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import type { AuthFunctionType, LinkType, AuthFieldType } from '../types';
3
- declare const __propDef: {
4
- props: {
5
- register?: AuthFunctionType;
6
- error?: string;
7
- login?: LinkType;
8
- rememberMe?: boolean;
9
- lostPassword?: LinkType;
10
- message?: string;
11
- fields?: AuthFieldType[];
12
- };
13
- events: {
14
- [evt: string]: CustomEvent<any>;
15
- };
16
- slots: {};
17
- };
18
- export declare type RegisterProps = typeof __propDef.props;
19
- export declare type RegisterEvents = typeof __propDef.events;
20
- export declare type RegisterSlots = typeof __propDef.slots;
21
- export default class Register extends SvelteComponentTyped<RegisterProps, RegisterEvents, RegisterSlots> {
22
- }
23
- export {};
package/auth/Reset.svelte DELETED
@@ -1,57 +0,0 @@
1
- <script>import { Alert } from '../index';
2
- export let resetpw = undefined;
3
- export let password = '';
4
- export let email = '';
5
- export let confirmpw = '';
6
- export let error = '';
7
- export let message = '';
8
- </script>
9
-
10
- <div
11
- class="p-4 max-w-sm bg-white rounded-lg border border-gray-200 shadow-md sm:p-6 lg:p-8 dark:bg-gray-800 dark:border-gray-700 w-full"
12
- >
13
- <form class="space-y-6" on:submit|preventDefault={resetpw}>
14
- <div class="heading">
15
- <h2 class="text-xl font-medium text-gray-900 dark:text-white">Reset password</h2>
16
- </div>
17
- <input
18
- type="password"
19
- required
20
- name="password"
21
- placeholder="Enter your password."
22
- bind:value={password}
23
- class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white"
24
- />
25
- <input
26
- type="password"
27
- required
28
- name="confirmpw"
29
- placeholder="Confirm your password."
30
- bind:value={confirmpw}
31
- class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white"
32
- />
33
- <input type="hidden" required name="email" bind:value={email} />
34
- {#if error}
35
- <div class="mt-6">
36
- <Alert alertId="alert-green" color="red" closeBtn>
37
- {error}
38
- </Alert>
39
- </div>
40
- {/if}
41
- {#if message}
42
- <div class="mt-6">
43
- <Alert alertId="alert-green" color="green" closeBtn>
44
- {message}
45
- </Alert>
46
- <a
47
- href="/auth/login"
48
- class="ml-auto text-sm text-blue-700 hover:underline dark:text-blue-500">Go to Login</a
49
- >
50
- </div>
51
- {/if}
52
- <button
53
- class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
54
- type="submit">Reset</button
55
- >
56
- </form>
57
- </div>
@@ -1,22 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import type { AuthFunctionType } from '../types';
3
- declare const __propDef: {
4
- props: {
5
- resetpw?: AuthFunctionType;
6
- password?: string;
7
- email?: string;
8
- confirmpw?: string;
9
- error?: string;
10
- message?: string;
11
- };
12
- events: {
13
- [evt: string]: CustomEvent<any>;
14
- };
15
- slots: {};
16
- };
17
- export declare type ResetProps = typeof __propDef.props;
18
- export declare type ResetEvents = typeof __propDef.events;
19
- export declare type ResetSlots = typeof __propDef.slots;
20
- export default class Reset extends SvelteComponentTyped<ResetProps, ResetEvents, ResetSlots> {
21
- }
22
- export {};