@sikka/hawa 0.2.3-beta → 0.2.4-beta

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.2.3-beta",
3
+ "version": "0.2.4-beta",
4
4
  "description": "Modern UI Kit made with Tailwind & Radix Primitives",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -5,12 +5,72 @@ import {
5
5
  HawaAlert,
6
6
  HawaPhoneInput,
7
7
  InterfaceSettings,
8
+ HawaLoading,
8
9
  } from "../../elements"
9
10
  import { Card, CardContent, CardFooter } from "../../elements/Card"
10
11
  import { Button } from "../../elements/Button"
11
12
  import { Icons } from "../../elements/Icons"
12
13
  import { cn } from "../../util"
13
14
 
15
+ type SignInFormTypes = {
16
+ texts?: {
17
+ emailLabel?: string
18
+ emailPlaceholder?: string
19
+ emailRequiredText?: string
20
+ emailInvalidText?: string
21
+ usernameLabel?: string
22
+ usernamePlaceholder?: string
23
+ usernameRequired?: string
24
+ phoneRequiredText?: string
25
+ passwordLabel?: string
26
+ passwordPlaceholder?: string
27
+ passwordRequiredText?: string
28
+ forgotPasswordText?: string
29
+ newUserText?: string
30
+ createAccount?: string
31
+ signInText?: string
32
+ signInViaGoogleLabel?: string
33
+ signInViaGithubLabel?: string
34
+ signInViaTwitterLabel?: string
35
+ }
36
+ handleLanguage?: () => void
37
+ currentLanguage?: any
38
+ handleColorMode?: () => void
39
+ currentColorMode?: any
40
+ logosOnly?: boolean
41
+ direction?: "rtl" | "ltr"
42
+ showError?: any
43
+ errorTitle?: string
44
+ errorText?: string
45
+ signInType?: "email" | "username" | "phone"
46
+ withoutResetPassword?: boolean
47
+ withoutSignUp?: boolean
48
+ /**
49
+ *show spinner if true
50
+ */
51
+ isLoading?: any
52
+
53
+ isGoogleLoading?: boolean
54
+ isTwitterLoading?: boolean
55
+ isGithubLoading?: boolean
56
+
57
+ viaGoogle?: boolean
58
+ viaGithub?: boolean
59
+ viaTwitter?: boolean
60
+ /**
61
+ * Handle the sign in .
62
+ */
63
+ handleSignIn?: (e: any) => void
64
+ /**
65
+ * Handle routing to sign up page
66
+ */
67
+ handleRouteToSignUp?: () => void
68
+ handleForgotPassword?: () => void
69
+ handleGoogleSignIn?: () => void
70
+ handleGithubSignIn?: () => void
71
+ handleTwitterSignIn?: () => void
72
+ }
73
+
14
74
  export const SignInForm: FC<SignInFormTypes> = (props) => {
15
75
  const {
16
76
  formState: { errors },
@@ -23,19 +83,6 @@ export const SignInForm: FC<SignInFormTypes> = (props) => {
23
83
  <Card dir={props.direction}>
24
84
  <CardContent headless>
25
85
  <form onSubmit={handleSubmit((e) => props.handleSignIn(e))}>
26
- {/* an attempt to animate the alert showing */}
27
- {/* <div
28
- className={clsx(
29
- "h-0 overflow-clip bg-blue-500 transition-all",
30
- props.showError ? "h-auto" : ""
31
- )}
32
- >
33
- <HawaAlert
34
- title={props.errorTitle}
35
- text={props.errorText}
36
- severity="error"
37
- />
38
- </div> */}
39
86
  {props.showError && (
40
87
  <HawaAlert
41
88
  title={props.errorTitle}
@@ -131,7 +178,15 @@ export const SignInForm: FC<SignInFormTypes> = (props) => {
131
178
  </>
132
179
  )}
133
180
 
134
- <Button className="mt-4 w-full" isLoading={props.isLoading}>
181
+ <Button
182
+ className="mt-4 w-full"
183
+ // disabled={
184
+ // props.isGithubLoading ||
185
+ // props.isGoogleLoading ||
186
+ // props.isTwitterLoading
187
+ // }
188
+ isLoading={props.isLoading}
189
+ >
135
190
  {props.texts.signInText}
136
191
  </Button>
137
192
  {!props.withoutSignUp && (
@@ -152,36 +207,53 @@ export const SignInForm: FC<SignInFormTypes> = (props) => {
152
207
  {props.viaGithub || props.viaGoogle || props.viaTwitter ? (
153
208
  <CardFooter
154
209
  className={cn(
155
- props.logosOnly ? "flex flex-row gap-2 justify-center" : "grid grid-cols-1 gap-2"
210
+ props.logosOnly
211
+ ? "flex flex-row justify-center gap-2"
212
+ : "grid grid-cols-1 gap-2"
156
213
  )}
157
214
  >
158
215
  {props.viaGoogle && (
159
216
  <Button
217
+ // isLoading={props.isGoogleLoading}
160
218
  className="flex flex-row items-center gap-2"
161
219
  variant="outline"
162
220
  onClick={props.handleGoogleSignIn}
163
221
  >
164
- <Icons.google className="h-4 w-4" />
222
+ {props.isGoogleLoading ? (
223
+ <HawaLoading size="button" />
224
+ ) : (
225
+ <Icons.google className="h-4 w-4" />
226
+ )}
165
227
  {!props.logosOnly && props.texts.signInViaGoogleLabel}
166
228
  </Button>
167
229
  )}
168
230
  {props.viaGithub && (
169
231
  <Button
232
+ // isLoading={props.isGithubLoading}
170
233
  className="flex flex-row items-center gap-2"
171
234
  variant="outline"
172
235
  onClick={props.handleGithubSignIn}
173
236
  >
174
- <Icons.gitHub className="h-4 w-4" />
237
+ {props.isGithubLoading ? (
238
+ <HawaLoading size="button" />
239
+ ) : (
240
+ <Icons.gitHub className="h-4 w-4" />
241
+ )}
175
242
  {!props.logosOnly && props.texts.signInViaGithubLabel}
176
243
  </Button>
177
244
  )}
178
245
  {props.viaTwitter && (
179
246
  <Button
247
+ // isLoading={props.isTwitterLoading}
180
248
  className="flex flex-row items-center gap-2"
181
249
  variant="outline"
182
250
  onClick={props.handleTwitterSignIn}
183
251
  >
184
- <Icons.twitter className="h-4 w-4" />
252
+ {props.isTwitterLoading ? (
253
+ <HawaLoading size="button" />
254
+ ) : (
255
+ <Icons.twitter className="h-4 w-4" />
256
+ )}{" "}
185
257
  {!props.logosOnly && props.texts.signInViaTwitterLabel}
186
258
  </Button>
187
259
  )}
@@ -197,57 +269,3 @@ export const SignInForm: FC<SignInFormTypes> = (props) => {
197
269
  </div>
198
270
  )
199
271
  }
200
-
201
- type SignInFormTypes = {
202
- handleLanguage?: () => void
203
- currentLanguage?: any
204
- handleColorMode?: () => void
205
- currentColorMode?: any
206
- logosOnly?: boolean
207
- direction?: "rtl" | "ltr"
208
- showError?: any
209
- errorTitle?: string
210
- errorText?: string
211
- signInType?: "email" | "username" | "phone"
212
- texts?: {
213
- emailLabel?: string
214
- emailPlaceholder?: string
215
- emailRequiredText?: string
216
- emailInvalidText?: string
217
- usernameLabel?: string
218
- usernamePlaceholder?: string
219
- usernameRequired?: string
220
- phoneRequiredText?: string
221
- passwordLabel?: string
222
- passwordPlaceholder?: string
223
- passwordRequiredText?: string
224
- forgotPasswordText?: string
225
- newUserText?: string
226
- createAccount?: string
227
- signInText?: string
228
- signInViaGoogleLabel?: string
229
- signInViaGithubLabel?: string
230
- signInViaTwitterLabel?: string
231
- }
232
- withoutResetPassword?: boolean
233
- withoutSignUp?: boolean
234
- /**
235
- *show spinner if true
236
- */
237
- isLoading?: any
238
- viaGoogle?: boolean
239
- viaGithub?: boolean
240
- viaTwitter?: boolean
241
- /**
242
- * Handle the sign in .
243
- */
244
- handleSignIn?: (e: any) => void
245
- /**
246
- * Handle routing to sign up page
247
- */
248
- handleRouteToSignUp?: () => void
249
- handleForgotPassword?: () => void
250
- handleGoogleSignIn?: () => void
251
- handleGithubSignIn?: () => void
252
- handleTwitterSignIn?: () => void
253
- }
@@ -9,11 +9,11 @@ type UsageCardTypes = {
9
9
  }
10
10
  export const UsageCard: FC<UsageCardTypes> = (props) => {
11
11
  return (
12
- <div className="flex w-full flex-col gap-0 border p-4">
12
+ <div className="flex w-full flex-col gap-0 rounded border bg-card p-4">
13
13
  <div className="flex flex-row items-center gap-2">
14
14
  <span className="bg-white-200">{props.title}</span>
15
15
  {props.tooltip && (
16
- <Tooltip content={props.tooltip} side="right">
16
+ <Tooltip content={props.tooltip} >
17
17
  <svg
18
18
  stroke="currentColor"
19
19
  aria-label="Exclamation Circle"