@sikka/hawa 0.0.112 → 0.0.114

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 (44) hide show
  1. package/dist/styles.css +16 -10
  2. package/es/blocks/AuthForms/AppLanding.d.ts +3 -3
  3. package/es/blocks/AuthForms/NewPasswordForm.d.ts +1 -2
  4. package/es/blocks/AuthForms/ResetPasswordForm.d.ts +1 -1
  5. package/es/blocks/AuthForms/SignInForm.d.ts +6 -6
  6. package/es/blocks/AuthForms/SignInPhone.d.ts +1 -0
  7. package/es/blocks/AuthForms/SignUpForm.d.ts +5 -5
  8. package/es/elements/HawaAlert.d.ts +7 -0
  9. package/es/elements/HawaButton.d.ts +2 -1
  10. package/es/elements/HawaChip.d.ts +1 -0
  11. package/es/elements/HawaRadio.d.ts +6 -1
  12. package/es/elements/HawaSnackbar.d.ts +7 -0
  13. package/es/index.es.js +1 -1
  14. package/es/stories/ElementsStories/Snackbar.stories.d.ts +1 -0
  15. package/lib/blocks/AuthForms/AppLanding.d.ts +3 -3
  16. package/lib/blocks/AuthForms/NewPasswordForm.d.ts +1 -2
  17. package/lib/blocks/AuthForms/ResetPasswordForm.d.ts +1 -1
  18. package/lib/blocks/AuthForms/SignInForm.d.ts +6 -6
  19. package/lib/blocks/AuthForms/SignInPhone.d.ts +1 -0
  20. package/lib/blocks/AuthForms/SignUpForm.d.ts +5 -5
  21. package/lib/elements/HawaAlert.d.ts +7 -0
  22. package/lib/elements/HawaButton.d.ts +2 -1
  23. package/lib/elements/HawaChip.d.ts +1 -0
  24. package/lib/elements/HawaRadio.d.ts +6 -1
  25. package/lib/elements/HawaSnackbar.d.ts +7 -0
  26. package/lib/index.js +1 -1
  27. package/lib/stories/ElementsStories/Snackbar.stories.d.ts +1 -0
  28. package/package.json +1 -1
  29. package/src/blocks/Account/UserSettingsForm.tsx +0 -1
  30. package/src/blocks/AuthForms/AppLanding.tsx +3 -3
  31. package/src/blocks/AuthForms/NewPasswordForm.tsx +1 -2
  32. package/src/blocks/AuthForms/ResetPasswordForm.tsx +1 -1
  33. package/src/blocks/AuthForms/SignInForm.tsx +6 -6
  34. package/src/blocks/AuthForms/SignInPhone.tsx +8 -10
  35. package/src/blocks/AuthForms/SignUpForm.tsx +7 -7
  36. package/src/elements/HawaAlert.tsx +21 -0
  37. package/src/elements/HawaButton.tsx +9 -2
  38. package/src/elements/HawaChip.tsx +9 -5
  39. package/src/elements/HawaRadio.tsx +7 -2
  40. package/src/elements/HawaSearchBar.tsx +1 -1
  41. package/src/elements/HawaSnackbar.tsx +24 -2
  42. package/src/elements/HawaTextField.tsx +18 -5
  43. package/src/layout/HawaContainer.tsx +2 -3
  44. package/src/styles.css +16 -10
@@ -6,3 +6,4 @@ export declare const Success: any;
6
6
  export declare const Warning: any;
7
7
  export declare const Info: any;
8
8
  export declare const Error: any;
9
+ export declare const WithActions: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.0.112",
3
+ "version": "0.0.114",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -13,7 +13,6 @@ export const UserSettingsForm: React.FunctionComponent<
13
13
  > = (props) => {
14
14
  return (
15
15
  <HawaContainer>
16
- {" "}
17
16
  {props.children}
18
17
  <HawaButton
19
18
  color="primary"
@@ -3,9 +3,9 @@ import { HawaButton } from "../../elements"
3
3
  import { HawaContainer } from "../../layout/HawaContainer"
4
4
 
5
5
  type AppLandingTypes = {
6
- handleSignIn: any
7
- handleSignUp: any
8
- handleLanguage: any
6
+ handleSignIn: () => void
7
+ handleSignUp: () => void
8
+ handleLanguage: () => void
9
9
  texts: {
10
10
  signIn: string
11
11
  signUp: string
@@ -4,7 +4,7 @@ import { Controller, FormProvider, useForm } from "react-hook-form"
4
4
  import { HawaContainer } from "../../layout"
5
5
 
6
6
  type NewPasswordTypes = {
7
- handleNewPassword: any
7
+ handleNewPassword: () => void
8
8
  passwordChanged: any
9
9
  texts: {
10
10
  passwordPlaceholder: string
@@ -17,7 +17,6 @@ type NewPasswordTypes = {
17
17
  passwordMatchError: string
18
18
  passwordChanged: string
19
19
  }
20
- handleSignIn: any
21
20
  }
22
21
 
23
22
  export const NewPasswordForm: React.FunctionComponent<NewPasswordTypes> = (
@@ -4,7 +4,7 @@ import { HawaButton, HawaTextField } from "../../elements"
4
4
  import { HawaContainer } from "../../layout"
5
5
 
6
6
  type ResetPasswordType = {
7
- handleResetPassword: any
7
+ handleResetPassword: () => void
8
8
  sent: any
9
9
  texts: {
10
10
  emailLabel: string
@@ -41,12 +41,12 @@ type SignInFormTypes = {
41
41
  viaGoogle: boolean
42
42
  viaGithub: boolean
43
43
  viaTwitter: boolean
44
- handleSignIn: any
45
- handleRouteToSignUp: any
46
- handleForgotPassword: any
47
- handleGoogleSignIn: any
48
- handleGithubSignIn: any
49
- handleTwitterSignIn: any
44
+ handleSignIn: (e: any) => void
45
+ handleRouteToSignUp: () => void
46
+ handleForgotPassword: () => void
47
+ handleGoogleSignIn: () => void
48
+ handleGithubSignIn: () => void
49
+ handleTwitterSignIn: () => void
50
50
  }
51
51
 
52
52
  export const SignInForm: React.FunctionComponent<SignInFormTypes> = (props) => {
@@ -11,29 +11,27 @@ type SignInPhoneTypes = {
11
11
  handlePhoneChange: any
12
12
  phoneRequiredText: any
13
13
  SignInButtonText: any
14
+ handleSignIn: any
14
15
  }
15
16
 
16
17
  export const SignInPhone: React.FunctionComponent<SignInPhoneTypes> = (
17
18
  props
18
19
  ) => {
20
+ const methods = useForm()
19
21
  const {
20
22
  formState: { errors },
21
23
  handleSubmit,
22
24
  control,
23
- } = useForm()
25
+ } = methods
24
26
 
25
27
  const [userPhone, setUserPhone] = useState("")
26
- const handlingSubmit = () => {
27
- console.log("submitting ", userPhone)
28
- }
29
28
  return (
30
29
  <HawaContainer>
31
30
  <form
32
- onSubmit={handleSubmit(() => console.log("testing submit"))}
33
- // onSubmit={(e) => {
34
- // e.preventDefault()
35
- // console.log("testing submit")
36
- // }}
31
+ onSubmit={(e) => {
32
+ e.preventDefault()
33
+ props.handleSignIn(userPhone)
34
+ }}
37
35
  >
38
36
  <Controller
39
37
  control={control}
@@ -42,11 +40,11 @@ export const SignInPhone: React.FunctionComponent<SignInPhoneTypes> = (
42
40
  <HawaPhoneInput
43
41
  country={props.country ?? ""}
44
42
  label={props.label ?? ""}
45
- {...field}
46
43
  handleChange={(e: any) => {
47
44
  console.log("test")
48
45
  setUserPhone(e.target.value)
49
46
  }}
47
+ {...field}
50
48
  // handleChange={(e: any) => {
51
49
  // // props.handlePhoneChange(e.target.value)
52
50
  // setUserPhone(e.target.value)
@@ -49,11 +49,11 @@ type SignUpFormTypes = {
49
49
  showNewsletterOption: boolean
50
50
  showRefCode: boolean
51
51
  showTermsOption: boolean
52
- handleSignUp: any
53
- handleRouteToSignIn: any
54
- handleGoogleSignUp: any
55
- handleGithubSignUp: any
56
- handleTwitterSignUp: any
52
+ handleSignUp: (e: any) => void
53
+ handleRouteToSignIn: () => void
54
+ handleGoogleSignUp: () => void
55
+ handleGithubSignUp: () => void
56
+ handleTwitterSignUp: () => void
57
57
  showError: any
58
58
  errorTitle: any
59
59
  errorText: any
@@ -78,7 +78,7 @@ export const SignUpForm: React.FunctionComponent<SignUpFormTypes> = (props) => {
78
78
  />
79
79
  )}
80
80
  <FormProvider {...methods}>
81
- <form onSubmit={handleSubmit(props.handleSignUp)}>
81
+ <form onSubmit={handleSubmit((e) => props.handleSignUp(e))}>
82
82
  <Controller
83
83
  control={control}
84
84
  name="fullName"
@@ -228,7 +228,6 @@ export const SignUpForm: React.FunctionComponent<SignUpFormTypes> = (props) => {
228
228
  render={({ field }) => (
229
229
  <HawaCheckbox
230
230
  helperText={errors.terms_accepted?.message}
231
- {...field}
232
231
  onChange={() => console.log("te")}
233
232
  label={
234
233
  <span>
@@ -238,6 +237,7 @@ export const SignUpForm: React.FunctionComponent<SignUpFormTypes> = (props) => {
238
237
  </a>
239
238
  </span>
240
239
  }
240
+ {...field}
241
241
  />
242
242
  )}
243
243
  rules={{ required: props.texts.termsRequiredText }}
@@ -1,5 +1,6 @@
1
1
  import React from "react"
2
2
  import clsx from "clsx"
3
+ import { HawaButton } from "./HawaButton"
3
4
 
4
5
  let severities = {
5
6
  info: "text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
@@ -13,6 +14,13 @@ type AlertTypes = {
13
14
  title?: any
14
15
  text: any
15
16
  hideIcon?: any
17
+ actions?: [
18
+ {
19
+ label: string
20
+ onClick: any
21
+ variant: "contained" | "outlined"
22
+ }
23
+ ]
16
24
  }
17
25
  export const HawaAlert: React.FunctionComponent<AlertTypes> = (props) => {
18
26
  return (
@@ -25,6 +33,19 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = (props) => {
25
33
  >
26
34
  <span className="font-medium">{props.title}</span>
27
35
  <span>{" " + props.text}</span>
36
+ {props.actions && (
37
+ <div className="mt-2 flex flex-row gap-2">
38
+ {props.actions.map((act) => (
39
+ <HawaButton
40
+ variant={act.variant}
41
+ onClick={act.onClick()}
42
+ margins="none"
43
+ >
44
+ {act.label}
45
+ </HawaButton>
46
+ ))}
47
+ </div>
48
+ )}
28
49
  </div>
29
50
  )
30
51
  }
@@ -6,7 +6,8 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
6
6
  color?: "default" | "primary" | "secondary"
7
7
  width?: "full" | "normal" | "half"
8
8
  size?: "small" | "medium" | "large" | "noPadding"
9
- tooltip?: string,
9
+ margins?: "none" | "1" | "2" | "3" | "4"
10
+ tooltip?: string
10
11
  isLoading?: boolean
11
12
  }
12
13
 
@@ -59,6 +60,7 @@ export function HawaButton({
59
60
  width = "normal",
60
61
  disabled = false,
61
62
  isLoading = false,
63
+ margins = "2",
62
64
  tooltip,
63
65
  children,
64
66
  ...props
@@ -66,7 +68,12 @@ export function HawaButton({
66
68
  const [isHovered, setIsHovered] = React.useState(false)
67
69
 
68
70
  return (
69
- <div className="relative my-2">
71
+ <div
72
+ className={clsx(
73
+ "relative",
74
+ margins !== "none" ? `my-${margins}` : "my-0"
75
+ )}
76
+ >
70
77
  <button
71
78
  onMouseEnter={() => {
72
79
  setIsHovered(true)
@@ -4,20 +4,24 @@ import React from "react"
4
4
  type TChipTypes = {
5
5
  label: string
6
6
  size: "small" | "normal" | "large"
7
+ icon?: any
7
8
  }
8
9
  export const HawaChip: React.FunctionComponent<TChipTypes> = ({
9
10
  size = "normal",
10
11
  label,
12
+ icon,
11
13
  }) => {
12
- // small: "text-xs px-2.5 py-1.5",
13
- // medium: "text-sm leading-4 px-3 py-2",
14
- // large: "text-sm px-4 py-2",
15
14
  let defaultStyles =
16
- "rounded-lg bg-blue-200 px-2.5 py-0.5 font-bold text-blue-800 dark:bg-blue-200 dark:text-blue-800"
15
+ "flex flex-row w-fit gap-1 items-center rounded-lg bg-blue-200 px-2.5 py-0.5 font-bold text-blue-800 dark:bg-blue-200 dark:text-blue-800"
17
16
  let sizeStyles = {
18
17
  small: "h-fit text-xs",
19
18
  normal: "h-full leading-4 px-3 py-2 text-xs ",
20
19
  large: "",
21
20
  }
22
- return <span className={clsx(defaultStyles, sizeStyles[size])}>{label}</span>
21
+ return (
22
+ <span className={clsx(defaultStyles, sizeStyles[size])}>
23
+ {icon && icon}
24
+ {label}
25
+ </span>
26
+ )
23
27
  }
@@ -2,7 +2,12 @@ import clsx from "clsx"
2
2
  import React, { useState } from "react"
3
3
 
4
4
  type RadioTypes = {
5
- options?: any
5
+ options?: [
6
+ {
7
+ value: any
8
+ label: any
9
+ }
10
+ ]
6
11
  onChangeTab?: any
7
12
  defaultValue?: any
8
13
  }
@@ -17,7 +22,7 @@ export const HawaRadio: React.FunctionComponent<RadioTypes> = (props) => {
17
22
  <div>
18
23
  <ul
19
24
  className={clsx(
20
- props.options.length > 2
25
+ props.options?.length > 2
21
26
  ? "flex-wrap xs:max-w-full xs:flex-nowrap"
22
27
  : "",
23
28
  "flex max-w-fit flex-row whitespace-nowrap rounded-lg bg-gray-100 text-center text-sm font-medium text-gray-500 dark:text-gray-400"
@@ -5,5 +5,5 @@ type SearchBarTypes = {}
5
5
  export const HawaSearchBar: React.FunctionComponent<SearchBarTypes> = (
6
6
  props
7
7
  ) => {
8
- return <HawaTextField {...props} />
8
+ return <HawaTextField type={"search"} {...props} />
9
9
  }
@@ -1,5 +1,6 @@
1
1
  import clsx from "clsx"
2
2
  import React, { FC } from "react"
3
+ import { HawaButton } from "./HawaButton"
3
4
 
4
5
  type THawaSnackBar = {
5
6
  severity: "info" | "warning" | "error" | "success" | "none"
@@ -12,6 +13,13 @@ type THawaSnackBar = {
12
13
  | "bottom-right"
13
14
  | "bottom-center"
14
15
  | "bottom-left"
16
+ actions?: [
17
+ {
18
+ label: string
19
+ onClick: any
20
+ variant: "contained" | "outlined"
21
+ }
22
+ ]
15
23
  }
16
24
 
17
25
  export const HawaSnackbar: FC<THawaSnackBar> = ({
@@ -19,6 +27,7 @@ export const HawaSnackbar: FC<THawaSnackBar> = ({
19
27
  description,
20
28
  severity = "info",
21
29
  position = "bottom-left",
30
+ actions,
22
31
  }) => {
23
32
  let defaultStyle =
24
33
  "fixed flex flex-row items-top p-1 w-full max-w-xs rounded-lg shadow dark:text-gray-400 dark:bg-gray-800"
@@ -44,8 +53,21 @@ export const HawaSnackbar: FC<THawaSnackBar> = ({
44
53
  className={clsx(defaultStyle, severities[severity], positions[position])}
45
54
  >
46
55
  <div className="p-3">
47
- <div className="ml-3 text-sm font-bold">{title}</div>
48
- <div className="ml-3 text-sm font-normal">{description}</div>
56
+ <div className="text-sm font-bold">{title}</div>
57
+ <div className="text-sm font-normal">{description}</div>
58
+ {actions && (
59
+ <div className="mt-2 flex flex-row gap-2">
60
+ {actions.map((act) => (
61
+ <HawaButton
62
+ variant={act.variant}
63
+ onClick={act.onClick()}
64
+ margins="none"
65
+ >
66
+ {act.label}
67
+ </HawaButton>
68
+ ))}
69
+ </div>
70
+ )}
49
71
  </div>
50
72
  <button
51
73
  type="button"
@@ -1,6 +1,6 @@
1
1
  import React from "react"
2
2
  import clsx from "clsx"
3
-
3
+ import { FaSearch } from "react-icons/fa"
4
4
  type TextFieldTypes = {
5
5
  margin?: "none" | "normal" | "large"
6
6
  width?: "small" | "normal" | "full"
@@ -53,11 +53,24 @@ export const HawaTextField: React.FunctionComponent<TextFieldTypes> = ({
53
53
  className="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
54
54
  placeholder="Your message..."
55
55
  />
56
+ ) : props.type === "search" ? (
57
+ <div className="relative">
58
+ <FaSearch
59
+ color="gray"
60
+ className="absolute top-1/2 left-3 -translate-y-1/2"
61
+ />
62
+ <input
63
+ {...props}
64
+ className="mb-0 block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 pl-10 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
65
+ />
66
+ </div>
56
67
  ) : (
57
- <input
58
- {...props}
59
- className="mb-0 block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
60
- />
68
+ <div>
69
+ <input
70
+ {...props}
71
+ className="mb-0 block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
72
+ />
73
+ </div>
61
74
  )}
62
75
 
63
76
  {props.helperText && (
@@ -13,12 +13,11 @@ export const HawaContainer: React.FunctionComponent<ContainerTypes> = ({
13
13
  centered = false,
14
14
  ...props
15
15
  }) => {
16
- let defaultStyle =
17
- "flex w-full max-w-sm flex-col rounded-xl p-4 dark:bg-gray-600"
16
+ let defaultStyle = "flex w-full flex-col rounded-xl p-4 dark:bg-gray-600"
18
17
  let maxWidthStyles: any = {
19
18
  full: "md:max-w-xl",
20
19
  small: "md:max-w-sm w-1/3 min-w-min",
21
- normal: "md:max-w-md",
20
+ normal: "max-w-sm md:max-w-md",
22
21
  }
23
22
  let variantStyles = {
24
23
  contained: "bg-primary-300",
package/src/styles.css CHANGED
@@ -541,6 +541,9 @@ video {
541
541
  .bottom-4 {
542
542
  bottom: 1rem;
543
543
  }
544
+ .left-3 {
545
+ left: 0.75rem;
546
+ }
544
547
  .top-5 {
545
548
  top: 1.25rem;
546
549
  }
@@ -587,14 +590,18 @@ video {
587
590
  margin-left: 0.25rem;
588
591
  margin-right: 0.25rem;
589
592
  }
590
- .my-2 {
591
- margin-top: 0.5rem;
592
- margin-bottom: 0.5rem;
593
+ .my-0 {
594
+ margin-top: 0px;
595
+ margin-bottom: 0px;
593
596
  }
594
597
  .mx-2 {
595
598
  margin-left: 0.5rem;
596
599
  margin-right: 0.5rem;
597
600
  }
601
+ .my-2 {
602
+ margin-top: 0.5rem;
603
+ margin-bottom: 0.5rem;
604
+ }
598
605
  .my-7 {
599
606
  margin-top: 1.75rem;
600
607
  margin-bottom: 1.75rem;
@@ -603,10 +610,6 @@ video {
603
610
  margin-top: 0.125rem;
604
611
  margin-bottom: 0.125rem;
605
612
  }
606
- .my-0 {
607
- margin-top: 0px;
608
- margin-bottom: 0px;
609
- }
610
613
  .ml-auto {
611
614
  margin-left: auto;
612
615
  }
@@ -619,6 +622,9 @@ video {
619
622
  .mb-4 {
620
623
  margin-bottom: 1rem;
621
624
  }
625
+ .mt-2 {
626
+ margin-top: 0.5rem;
627
+ }
622
628
  .mb-0 {
623
629
  margin-bottom: 0px;
624
630
  }
@@ -652,9 +658,6 @@ video {
652
658
  .ml-2 {
653
659
  margin-left: 0.5rem;
654
660
  }
655
- .mt-2 {
656
- margin-top: 0.5rem;
657
- }
658
661
  .mb-5 {
659
662
  margin-bottom: 1.25rem;
660
663
  }
@@ -1389,6 +1392,9 @@ video {
1389
1392
  .pr-3 {
1390
1393
  padding-right: 0.75rem;
1391
1394
  }
1395
+ .pl-10 {
1396
+ padding-left: 2.5rem;
1397
+ }
1392
1398
  .pt-0 {
1393
1399
  padding-top: 0px;
1394
1400
  }