@sikka/hawa 0.0.103 → 0.0.105

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 (78) hide show
  1. package/dist/styles.css +148 -85
  2. package/es/blocks/AuthForms/AppLanding.d.ts +1 -0
  3. package/es/blocks/AuthForms/CodeConfirmation.d.ts +6 -1
  4. package/es/blocks/AuthForms/NewPasswordForm.d.ts +0 -5
  5. package/es/blocks/AuthForms/ResetPasswordForm.d.ts +0 -3
  6. package/es/blocks/Referral/ReferralAccount.d.ts +7 -0
  7. package/es/blocks/Referral/ReferralSettlement.d.ts +8 -0
  8. package/es/blocks/Referral/ReferralStats.d.ts +8 -0
  9. package/es/blocks/Referral/index.d.ts +3 -0
  10. package/es/blocks/index.d.ts +1 -0
  11. package/es/elements/HawaButton.d.ts +1 -1
  12. package/es/elements/HawaChip.d.ts +1 -0
  13. package/es/elements/HawaCopyrights.d.ts +5 -5
  14. package/es/elements/HawaItemCard.d.ts +14 -6
  15. package/es/elements/HawaMenu.d.ts +2 -3
  16. package/es/elements/HawaModal.d.ts +1 -0
  17. package/es/elements/HawaSelect.d.ts +2 -1
  18. package/es/elements/HawaTable.d.ts +3 -2
  19. package/es/index.es.js +1 -1
  20. package/lib/blocks/AuthForms/AppLanding.d.ts +1 -0
  21. package/lib/blocks/AuthForms/CodeConfirmation.d.ts +6 -1
  22. package/lib/blocks/AuthForms/NewPasswordForm.d.ts +0 -5
  23. package/lib/blocks/AuthForms/ResetPasswordForm.d.ts +0 -3
  24. package/lib/blocks/Referral/ReferralAccount.d.ts +7 -0
  25. package/lib/blocks/Referral/ReferralSettlement.d.ts +8 -0
  26. package/lib/blocks/Referral/ReferralStats.d.ts +8 -0
  27. package/lib/blocks/Referral/index.d.ts +3 -0
  28. package/lib/blocks/index.d.ts +1 -0
  29. package/lib/elements/HawaButton.d.ts +1 -1
  30. package/lib/elements/HawaChip.d.ts +1 -0
  31. package/lib/elements/HawaCopyrights.d.ts +5 -5
  32. package/lib/elements/HawaItemCard.d.ts +14 -6
  33. package/lib/elements/HawaMenu.d.ts +2 -3
  34. package/lib/elements/HawaModal.d.ts +1 -0
  35. package/lib/elements/HawaSelect.d.ts +2 -1
  36. package/lib/elements/HawaTable.d.ts +3 -2
  37. package/lib/index.js +1 -1
  38. package/package.json +1 -1
  39. package/src/blocks/AuthForms/AppLanding.tsx +2 -1
  40. package/src/blocks/AuthForms/CodeConfirmation.tsx +7 -2
  41. package/src/blocks/AuthForms/NewPasswordForm.tsx +1 -6
  42. package/src/blocks/AuthForms/ResetPasswordForm.tsx +1 -4
  43. package/src/blocks/AuthForms/SignInForm.tsx +1 -1
  44. package/src/blocks/AuthForms/SignInPhone.tsx +1 -1
  45. package/src/blocks/AuthForms/SignUpForm.tsx +1 -1
  46. package/src/blocks/Payment/CheckoutForm.tsx +9 -0
  47. package/src/blocks/Referral/ReferralAccount.tsx +49 -0
  48. package/src/blocks/Referral/ReferralSettlement.tsx +110 -0
  49. package/src/blocks/Referral/ReferralStats.tsx +94 -0
  50. package/src/blocks/Referral/index.ts +3 -0
  51. package/src/blocks/index.ts +5 -4
  52. package/src/elements/HawaButton.tsx +23 -22
  53. package/src/elements/HawaChip.tsx +17 -6
  54. package/src/elements/HawaCopyrights.tsx +5 -5
  55. package/src/elements/HawaItemCard.tsx +86 -58
  56. package/src/elements/HawaMenu.tsx +51 -56
  57. package/src/elements/HawaModal.tsx +58 -52
  58. package/src/elements/HawaRadio.tsx +12 -4
  59. package/src/elements/HawaSelect.tsx +4 -2
  60. package/src/elements/HawaSwitch.tsx +5 -3
  61. package/src/elements/HawaTable.tsx +54 -19
  62. package/src/elements/HawaTooltip.tsx +23 -16
  63. package/src/layout/HawaContainer.tsx +2 -2
  64. package/src/styles.css +148 -85
  65. package/storybook-static/209.d29fd715.iframe.bundle.js +2 -0
  66. package/storybook-static/{209.70afd616.iframe.bundle.js.LICENSE.txt → 209.d29fd715.iframe.bundle.js.LICENSE.txt} +11 -15
  67. package/storybook-static/{767.888009dba401078f3f72.manager.bundle.js → 767.2f9c96fa3338c8d16078.manager.bundle.js} +2 -2
  68. package/storybook-static/{767.888009dba401078f3f72.manager.bundle.js.LICENSE.txt → 767.2f9c96fa3338c8d16078.manager.bundle.js.LICENSE.txt} +19 -22
  69. package/storybook-static/iframe.html +1 -1
  70. package/storybook-static/index.html +1 -1
  71. package/storybook-static/main.a1546405.iframe.bundle.js +1 -0
  72. package/storybook-static/project.json +1 -1
  73. package/storybook-static/runtime~main.4d0bf318.iframe.bundle.js +1 -0
  74. package/tailwind.config.js +10 -8
  75. package/storybook-static/209.70afd616.iframe.bundle.js +0 -2
  76. package/storybook-static/745.4b81597c.iframe.bundle.js +0 -1
  77. package/storybook-static/main.ff0dd517.iframe.bundle.js +0 -1
  78. package/storybook-static/runtime~main.968bd8b6.iframe.bundle.js +0 -1
@@ -1,25 +1,54 @@
1
+ import clsx from "clsx"
1
2
  import React, { useEffect } from "react"
2
3
  import { useState } from "react"
4
+ import { HawaMenu } from "./HawaMenu"
3
5
 
4
- type ItemCardTypes = {
5
- actions: any
6
- content: any
7
- headerActions: any
8
- // label: PropTypes.string,
9
- // action: PropTypes.func,
10
- header: any
11
- lang: string
6
+ interface ItemCardTypes {
7
+ actions?: any
8
+ content?: any
9
+ headerActions?: THeaderActions[][]
10
+ header?: any
11
+ lang?: string
12
+ cardImage?: string
12
13
  onCardClick?: any
14
+ orientation?: "horizontal" | "vertical"
13
15
  }
14
16
 
17
+ type THeaderActions = {
18
+ icon?: JSX.Element
19
+ label: string
20
+ action?: (
21
+ e: React.MouseEvent<HTMLLIElement, MouseEvent>,
22
+ item: string
23
+ ) => void
24
+ isButton?: boolean
25
+ }
15
26
  export const HawaItemCard: React.FunctionComponent<ItemCardTypes> = ({
16
27
  actions,
17
28
  content,
18
29
  headerActions,
19
30
  header,
31
+ cardImage,
32
+ orientation = "vertical",
20
33
  ...props
21
34
  }) => {
35
+ let defaultStyle =
36
+ "block rounded-lg border border-gray-200 bg-white shadow-sm hover:shadow-lg transition-all dark:border-gray-700 dark:bg-gray-800 "
37
+
38
+ let orientationStyles = {
39
+ vertical: "max-w-sm",
40
+ horizontal: "flex flex-row w-full",
41
+ }
42
+ let imageStyles = {
43
+ vertical: "h-auto max-h-56 w-full rounded-t-lg object-cover",
44
+ horizontal:
45
+ "h-auto w-full rounded-l-lg object-cover md:h-auto md:w-48 md:rounded-none md:rounded-l-lg",
46
+ }
47
+ let headerActionsButtonStyle =
48
+ "inline-block rounded-lg p-1 text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-700"
49
+
22
50
  const [openActionHeader, setOpenActionHeader] = useState(false)
51
+ const [openDropDown, setOpenDropDown] = useState(false)
23
52
 
24
53
  function handleOpenActionHeader() {
25
54
  setOpenActionHeader(!openActionHeader)
@@ -37,61 +66,60 @@ export const HawaItemCard: React.FunctionComponent<ItemCardTypes> = ({
37
66
 
38
67
  return (
39
68
  <div
40
- className="relative block max-w-sm rounded-lg border border-gray-200 bg-white pt-6 shadow-md dark:border-gray-700 dark:bg-gray-800 "
69
+ className={clsx(defaultStyle, orientationStyles[orientation])}
41
70
  {...props}
42
71
  >
43
- {headerActions && (
44
- <div className="absolute right-0 top-0 flex justify-end pt-3 pr-3">
45
- <button
46
- id="dropdownButton"
47
- data-dropdown-toggle="dropdown"
48
- className="inline-block rounded-lg text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-700"
49
- type="button"
50
- onClick={handleOpenActionHeader}
51
- >
52
- <span className="sr-only">Open dropdown</span>
53
- <svg
54
- className="h-6 w-6"
55
- aria-hidden="true"
56
- fill="currentColor"
57
- viewBox="0 0 20 20"
58
- xmlns="http://www.w3.org/2000/svg"
72
+ {cardImage && (
73
+ <img
74
+ src={"https://via.placeholder.com/50"}
75
+ // className=" h-full w-full max-w-sm bg-red-500 bg-[url('https://via.placeholder.com/50')] bg-cover bg-no-repeat"
76
+ className={clsx(imageStyles[orientation])}
77
+ // className="h-40 w-fit rounded-tl-lg rounded-bl-lg bg-[url('https://via.placeholder.com/50')] bg-cover bg-no-repeat "
78
+ // className="h-auto w-full rounded-l-lg object-cover md:h-auto md:w-48 md:rounded-none md:rounded-l-lg"
79
+ />
80
+ )}
81
+ <div className="relative w-full px-6 pt-6">
82
+ {headerActions && (
83
+ <div className="max-h- bg-red absolute right-0 top-0 flex justify-end pt-3 pr-3">
84
+ <HawaMenu
85
+ buttonPosition="top-right"
86
+ menuItems={headerActions}
87
+ handleClose={setOpenDropDown}
88
+ open={openDropDown}
59
89
  >
60
- <path d="M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z"></path>
61
- </svg>
62
- </button>
63
- <div
64
- id="dropdown"
65
- className={`absolute ${
66
- openActionHeader ? "block" : "hidden"
67
- } right-0 top-7 z-10 w-44 list-none divide-y divide-gray-100 rounded bg-white text-base shadow dark:bg-gray-700`}
68
- >
69
- <ul className="py-1" aria-labelledby="dropdownButton">
70
- {headerActions.map((singleAction: any) => {
71
- return (
72
- <li onClick={singleAction.action}>
73
- <a
74
- href="#"
75
- className="block py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-600 dark:hover:text-white"
76
- >
77
- {singleAction.label}
78
- </a>
79
- </li>
80
- )
81
- })}
82
- </ul>
90
+ <div
91
+ className={clsx(headerActionsButtonStyle)}
92
+ onClick={handleOpenActionHeader}
93
+ >
94
+ <span className="sr-only">Open dropdown</span>
95
+ <svg
96
+ className="h-6 w-6"
97
+ aria-hidden="true"
98
+ fill="currentColor"
99
+ viewBox="0 0 20 20"
100
+ xmlns="http://www.w3.org/2000/svg"
101
+ >
102
+ <path d="M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z"></path>
103
+ </svg>
104
+ </div>
105
+ </HawaMenu>
83
106
  </div>
84
- </div>
85
- )}
86
- <div className="px-6">
87
- <h5 className="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
88
- {header}{" "}
89
- </h5>
90
- <p className="font-normal text-gray-700 dark:text-gray-400">
91
- {content}
92
- </p>
107
+ )}
108
+
109
+ {header && (
110
+ <h5 className="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
111
+ {header}
112
+ </h5>
113
+ )}
114
+ {content && (
115
+ <p className="w-full font-normal text-gray-700 dark:text-gray-400">
116
+ {content}
117
+ </p>
118
+ )}
119
+ {actions && (
120
+ <div className="flex justify-end rounded-b-lg p-3">{actions}</div>
121
+ )}
93
122
  </div>
94
- <div className="mt-6 flex justify-end rounded-b-lg p-3">{actions}</div>
95
123
  </div>
96
124
  )
97
125
  }
@@ -2,29 +2,26 @@ import clsx from "clsx"
2
2
  import React, { ReactNode } from "react"
3
3
 
4
4
  interface TMenuTypes {
5
- popMenuID: any
6
5
  menuItems: MenuItems[][]
7
- //
8
- // icon: PropTypes.element,
9
- // label: PropTypes.string,
10
- // action: PropTypes.func,
11
- //
12
6
  withHeader?: boolean
13
7
  withIcons?: boolean
14
8
  headerTitle?: string
15
9
  headerSubtitle?: string
16
- open: boolean
17
- handleClose: (e : boolean) => void
10
+ open?: boolean
11
+ handleClose?: (e: boolean) => void
18
12
  anchor?: any
19
13
  children?: ReactNode
20
14
  buttonPosition?: "top-right" | "top-left" | "bottom-right" | "bottom-left"
21
15
  }
22
16
 
23
- type MenuItems = {
24
- icon ?: JSX.Element,
25
- label : string,
26
- action ?: (e : React.MouseEvent<HTMLLIElement, MouseEvent>,item : string) => void
27
- isButton ?: boolean
17
+ type MenuItems = {
18
+ icon?: JSX.Element
19
+ label: string
20
+ action?: (
21
+ e: React.MouseEvent<HTMLLIElement, MouseEvent>,
22
+ item: string
23
+ ) => void
24
+ isButton?: boolean
28
25
  }
29
26
 
30
27
  export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
@@ -39,7 +36,7 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
39
36
  children,
40
37
  }) => {
41
38
  let defaultStyles =
42
- "absolute z-10 w-44 divide-y divide-gray-100 overflow-y-clip rounded-lg bg-white shadow transition-all dark:bg-gray-700"
39
+ "border-none ring-offset-1 absolute z-10 w-44 divide-y divide-gray-100 overflow-y-clip rounded-lg bg-gray-50 shadow-lg transition-all dark:bg-gray-700"
43
40
  let positionStyles = {
44
41
  "top-right": "top-30 right-0",
45
42
  "top-left": "top-30 left-0",
@@ -47,51 +44,49 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
47
44
  "bottom-left": "bottom-30 left-0",
48
45
  }
49
46
  let animationStyles = {
50
- opened: "max-h-72 animate-expandDown",
51
- closed: "max-h-0 opacity-0 animate-expandUp",
47
+ opened: "max-h-fit",
48
+ closed: "h-0 ",
52
49
  }
53
50
  return (
54
- <div className="">
55
- <div className="relative w-fit" onClick={() => handleClose(!open)}>
56
- {children}
51
+ <div className="relative w-fit " onClick={() => handleClose(!open)}>
52
+ {children}
57
53
 
58
- <div
59
- className={clsx(
60
- defaultStyles,
61
- positionStyles[buttonPosition],
62
- open ? animationStyles.opened : animationStyles.closed
63
- )}
64
- >
65
- {withHeader && (
66
- <div className="py-3 px-4 text-sm text-gray-900 dark:text-white">
67
- <div>{headerTitle}</div>
68
- <div className="truncate font-medium">{headerSubtitle}</div>
69
- </div>
70
- )}
71
- {menuItems.map((group) => {
72
- return (
73
- <ul className="py-1 text-sm text-gray-700 dark:text-gray-200">
74
- {group.map((item) => {
75
- return (
76
- <li
77
- onClick={(e) => item.action(e, item.label)}
78
- className={
79
- item.isButton
80
- ? "mx-1 flex cursor-pointer flex-row items-center rounded-lg bg-primary-500 py-2 px-4 text-white hover:bg-primary-600 rtl:flex-row-reverse dark:hover:bg-primary-600 dark:hover:text-white"
81
- : "mx-1 flex cursor-pointer flex-row items-center rounded-lg py-2 px-4 hover:bg-gray-100 rtl:flex-row-reverse dark:hover:bg-gray-600 dark:hover:text-white"
82
- }
83
- >
84
- {withIcons && (
85
- <div className="mr-2 rtl:ml-2">{item.icon}</div>
86
- )}
87
- {item.label}
88
- </li>
89
- )
90
- })}
91
- </ul>
92
- )
93
- })}
94
- </div>
54
+ <div
55
+ className={clsx(
56
+ defaultStyles,
57
+ positionStyles[buttonPosition],
58
+ open ? animationStyles.opened : animationStyles.closed
59
+ )}
60
+ >
61
+ {withHeader && (
62
+ <div className="py-3 px-4 text-sm text-gray-900 dark:text-white">
63
+ <div>{headerTitle}</div>
64
+ <div className="truncate font-medium">{headerSubtitle}</div>
65
+ </div>
66
+ )}
67
+ {menuItems.map((group) => {
68
+ return (
69
+ <ul className="py-1 text-sm text-gray-700 dark:text-gray-200">
70
+ {group?.map((item) => {
71
+ return (
72
+ <li
73
+ onClick={(e) => item.action(e, item.label)}
74
+ className={
75
+ item.isButton
76
+ ? "mx-1 flex cursor-pointer flex-row items-center rounded-lg bg-primary-500 py-2 px-4 text-white hover:bg-primary-600 rtl:flex-row-reverse dark:hover:bg-primary-600 dark:hover:text-white"
77
+ : "mx-1 flex cursor-pointer flex-row items-center rounded-lg py-2 px-4 hover:bg-gray-100 rtl:flex-row-reverse dark:hover:bg-gray-600 dark:hover:text-white"
78
+ }
79
+ >
80
+ {withIcons && (
81
+ <div className="mr-2 rtl:ml-2">{item.icon}</div>
82
+ )}
83
+ {item.label}
84
+ </li>
85
+ )
86
+ })}
87
+ </ul>
88
+ )
89
+ })}
95
90
  </div>
96
91
  </div>
97
92
  )
@@ -1,10 +1,11 @@
1
+ import clsx from "clsx"
1
2
  import React, { ReactElement, useEffect } from "react"
2
3
 
3
4
  type ModalTypes = {
4
5
  open: boolean
5
6
  title: string
6
7
  onClose: () => void
7
- // closeOnClickOutside: any
8
+ closeOnClickOutside?: boolean
8
9
  modalID?: string
9
10
  children: ReactElement
10
11
  actions: any
@@ -13,63 +14,68 @@ export const HawaModal: React.FunctionComponent<ModalTypes> = ({
13
14
  open,
14
15
  title,
15
16
  onClose,
17
+ closeOnClickOutside = true,
16
18
  ...props
17
19
  }) => {
18
- // useEffect((): any => {
19
- // if (closeOnClickOutside) {
20
- // window.onclick = () => {
21
- // console.log("open : ", open)
22
- // if (open) {
23
- // console.log("Im clicing")
24
- // onClose()
25
- // }
26
- // }
27
- // }
28
- // return () => (window.onclick = null)
29
- // }, [open])
20
+ let defaultStyle =
21
+ "absolute top-1/2 left-1/2 w-full h-screen flex flex-col justify-center items-center -translate-x-1/2 -translate-y-1/2 transition-all"
22
+ useEffect((): any => {
23
+ if (closeOnClickOutside && open) {
24
+ window.onclick = (e) => {
25
+ e.stopPropagation()
26
+ console.log("open : ", open)
27
+ console.log("Im clicing")
28
+ onClose()
29
+ }
30
+ }
31
+ return () => (window.onclick = null)
32
+ }, [open])
30
33
  return (
31
34
  <div
32
- id={props.modalID}
33
- tabIndex={-1}
34
- aria-hidden="true"
35
- className={`${
36
- open ? "block" : "hidden"
37
- } h-modal fixed top-0 right-0 left-0 z-50 w-full items-center justify-center overflow-y-auto overflow-x-hidden md:inset-0 md:h-full`}
35
+ className={clsx(
36
+ defaultStyle,
37
+ open ? "z-10 opacity-100 " : "invisible -z-10 opacity-0"
38
+ )}
38
39
  >
39
- <div className="relative h-full w-full max-w-2xl p-4 md:h-auto">
40
- <div className="relative rounded-lg bg-white shadow dark:bg-gray-700">
41
- <div className="flex items-start justify-between rounded-t border-b p-4 dark:border-gray-600">
42
- <h3 className="text-xl font-semibold text-gray-900 dark:text-white">
43
- {title}
44
- </h3>
45
- <button
46
- type="button"
47
- className="ml-auto inline-flex items-center rounded-lg bg-transparent p-1.5 text-sm text-gray-400 hover:bg-gray-200 hover:text-gray-900 dark:hover:bg-gray-600 dark:hover:text-white"
48
- data-modal-toggle="defaultModal"
49
- onClick={(e) => {
50
- onClose()
51
- }}
40
+ <div
41
+ className={clsx(
42
+ "absolute h-screen w-full bg-gray-500 opacity-50",
43
+ open ? "opacity-50" : "opacity-0"
44
+ )}
45
+ ></div>
46
+
47
+ <div className="relative w-1/2 max-w-md rounded-lg bg-white p-1 shadow-lg dark:bg-gray-700">
48
+ <div className="flex items-start justify-between rounded-t p-3 dark:border-gray-600">
49
+ <h3 className="text-xl font-semibold text-gray-900 dark:text-white">
50
+ {title}
51
+ </h3>
52
+ <button
53
+ type="button"
54
+ className="inline-flex items-center rounded-lg bg-transparent p-1.5 text-sm text-gray-400 hover:bg-gray-200 hover:text-gray-900 dark:hover:bg-gray-600 dark:hover:text-white"
55
+ data-modal-toggle="defaultModal"
56
+ onClick={(e) => {
57
+ onClose()
58
+ }}
59
+ >
60
+ <svg
61
+ aria-hidden="true"
62
+ className="h-5 w-5"
63
+ fill="currentColor"
64
+ viewBox="0 0 20 20"
65
+ xmlns="http://www.w3.org/2000/svg"
52
66
  >
53
- <svg
54
- aria-hidden="true"
55
- className="h-5 w-5"
56
- fill="currentColor"
57
- viewBox="0 0 20 20"
58
- xmlns="http://www.w3.org/2000/svg"
59
- >
60
- <path
61
- fill-rule="evenodd"
62
- d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
63
- clip-rule="evenodd"
64
- ></path>
65
- </svg>
66
- <span className="sr-only">Close modal</span>
67
- </button>
68
- </div>
69
- <div className="space-y-6 p-6">{props.children}</div>
70
- <div className="flex items-center space-x-2 rounded-b border-t border-gray-200 p-6 dark:border-gray-600">
71
- {props.actions}
72
- </div>
67
+ <path
68
+ fill-rule="evenodd"
69
+ d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
70
+ clip-rule="evenodd"
71
+ ></path>
72
+ </svg>
73
+ <span className="sr-only">Close modal</span>
74
+ </button>
75
+ </div>
76
+ <div className="space-y-6 p-3">{props.children}</div>
77
+ <div className="mx-2 flex items-center justify-end space-x-1 p-0 dark:border-gray-600">
78
+ {props.actions}
73
79
  </div>
74
80
  </div>
75
81
  </div>
@@ -1,3 +1,4 @@
1
+ import clsx from "clsx"
1
2
  import React, { useState } from "react"
2
3
 
3
4
  type RadioTypes = {
@@ -8,15 +9,22 @@ type RadioTypes = {
8
9
  export const HawaRadio: React.FunctionComponent<RadioTypes> = (props) => {
9
10
  const [selectedOption, setSelectedOption] = useState(props.defaultValue)
10
11
  let activeTabStyle =
11
- "inline-block py-2 px-4 text-white bg-blue-600 rounded-lg active"
12
+ "inline-block py-2 px-4 w-full text-white bg-blue-600 rounded-lg active"
12
13
  let inactiveTabStyle =
13
- "inline-block py-2 px-4 rounded-lg hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 dark:hover:text-white"
14
+ "inline-block py-2 px-4 w-full bg-gray-100 rounded-lg hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 dark:hover:text-white"
14
15
 
15
16
  return (
16
17
  <div>
17
- <ul className="flex w-fit flex-wrap rounded-lg bg-gray-100 text-center text-sm font-medium text-gray-500 dark:text-gray-400">
18
+ <ul
19
+ className={clsx(
20
+ props.options.length > 2
21
+ ? "flex-wrap xs:max-w-full xs:flex-nowrap"
22
+ : "",
23
+ "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"
24
+ )}
25
+ >
18
26
  {props.options?.map((opt: any) => (
19
- <li>
27
+ <li className="w-full">
20
28
  <button
21
29
  aria-current="page"
22
30
  onClick={() => {
@@ -68,7 +68,7 @@ const Menu: React.FunctionComponent<MenuTypes> = ({
68
68
  }) => {
69
69
  return (
70
70
  <div
71
- className="absolute mt-2 w-full rounded-lg bg-white"
71
+ className="absolute z-10 mt-2 w-full rounded-lg bg-white ring-1 ring-blue-200"
72
72
  ref={innerRef}
73
73
  {...innerProps}
74
74
  // {...props}
@@ -81,7 +81,7 @@ const Menu: React.FunctionComponent<MenuTypes> = ({
81
81
  type SelectTypes = {
82
82
  label?: any
83
83
  isCreatable?: any
84
- options?: any
84
+ options?: any[any]
85
85
  isClearable?: any
86
86
  isMulti?: any
87
87
  isSearchable?: any
@@ -92,6 +92,7 @@ type SelectTypes = {
92
92
  fullWidth?: any
93
93
  value?: any
94
94
  children?: any
95
+ getOptionLabel?: any
95
96
  }
96
97
  export const HawaSelect: React.FunctionComponent<SelectTypes> = (props) => {
97
98
  return (
@@ -115,6 +116,7 @@ export const HawaSelect: React.FunctionComponent<SelectTypes> = (props) => {
115
116
  Option,
116
117
  Menu,
117
118
  }}
119
+ getOptionLabel={props.getOptionLabel}
118
120
  />
119
121
  )}
120
122
  {props.isCreatable && (
@@ -17,9 +17,11 @@ export const HawaSwitch: React.FunctionComponent<SwitchTypes> = (props) => {
17
17
  className="peer sr-only"
18
18
  />
19
19
  <div className="peer h-6 w-11 rounded-full bg-gray-200 after:absolute after:top-[2px] after:left-[2px] after:h-5 after:w-5 after:rounded-full after:border after:border-gray-300 after:bg-white after:transition-all after:content-[''] peer-checked:bg-blue-600 peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:border-gray-600 dark:bg-gray-700 dark:peer-focus:ring-blue-800"></div>
20
- <span className="mx-2 text-sm font-medium text-gray-900 dark:text-gray-300">
21
- {props.text}
22
- </span>
20
+ {props.text && (
21
+ <span className="mx-2 text-sm font-medium text-gray-900 dark:text-gray-300">
22
+ {props.text}
23
+ </span>
24
+ )}
23
25
  </label>
24
26
  )
25
27
  }
@@ -1,18 +1,29 @@
1
1
  import React from "react"
2
2
  import { HawaButton } from "./HawaButton"
3
-
3
+ import { FaTrash, FaExclamationCircle, FaPen } from "react-icons/fa"
4
+ import clsx from "clsx"
5
+ // import { HiOutlineEye } from "react-icons/hi2"
4
6
  type TableTypes = {
5
7
  lang?: any
6
- columns?: any
8
+ columns: any[string]
7
9
  actions?: any
8
- rows?: any
10
+ rows?: any[any]
9
11
  noDataText?: any
10
12
  handleActionClick?: any
11
13
  end?: any
14
+ size?: "normal" | "small"
12
15
  }
13
16
 
14
- export const HawaTable: React.FunctionComponent<TableTypes> = (props) => {
17
+ export const HawaTable: React.FunctionComponent<TableTypes> = ({
18
+ size = "normal",
19
+ ...props
20
+ }) => {
15
21
  let isArabic = props.lang === "ar"
22
+
23
+ let sizeStyles = {
24
+ normal: "py-3 px-6",
25
+ small: "px-3 py-1",
26
+ }
16
27
  return (
17
28
  <>
18
29
  <div>
@@ -21,15 +32,15 @@ export const HawaTable: React.FunctionComponent<TableTypes> = (props) => {
21
32
  <thead className="bg-gray-50 text-xs uppercase text-gray-700 dark:bg-gray-700 dark:text-gray-400">
22
33
  <tr>
23
34
  {props.columns.map((col: any, i: any) => (
24
- <th key={i} scope="col" className="py-3 px-6">
35
+ <th key={i} scope="col" className={clsx(sizeStyles[size])}>
25
36
  {col}
26
37
  </th>
27
38
  ))}
28
- {props.actions && (
29
- <th scope="col" className="py-3 px-6">
39
+ {props.actions && size !== "small" ? (
40
+ <th scope="col" className={clsx(sizeStyles[size])}>
30
41
  actions
31
42
  </th>
32
- )}
43
+ ) : null}
33
44
  </tr>
34
45
  </thead>
35
46
  <tbody>
@@ -44,30 +55,30 @@ export const HawaTable: React.FunctionComponent<TableTypes> = (props) => {
44
55
  return (
45
56
  <th
46
57
  scope="row"
47
- className="whitespace-nowrap py-4 px-6 font-medium text-gray-900 dark:text-white"
58
+ className={clsx(
59
+ sizeStyles[size],
60
+ "whitespace-nowrap font-medium text-gray-900 dark:text-white"
61
+ )}
48
62
  >
49
63
  {r}{" "}
50
64
  </th>
51
65
  )
52
66
  } else {
53
- return <td className="py-4 px-6">{r}</td>
67
+ return <td className={clsx(sizeStyles[size])}>{r}</td>
54
68
  }
55
69
  })}
56
- {props.actions && (
70
+ {props.actions && size !== "small" ? (
57
71
  <td
58
72
  align={isArabic ? "right" : "left"}
59
73
  style={{ fontWeight: 700 }}
74
+ className="flex flex-row gap-1"
60
75
  // variant={isArabic ? "borderedRight" : "borderedLeft"}
61
76
  >
62
- {props.actions.map((act: any) => (
63
- <HawaButton
64
- onClick={() => props.handleActionClick(singleRow)}
65
- >
66
- {act}
67
- </HawaButton>
68
- ))}
77
+ {props.actions.map((act: any) => {
78
+ return <TableActionButton action={act} />
79
+ })}
69
80
  </td>
70
- )}
81
+ ) : null}
71
82
  </tr>
72
83
  ))
73
84
  ) : (
@@ -192,3 +203,27 @@ export const HawaTable: React.FunctionComponent<TableTypes> = (props) => {
192
203
  </>
193
204
  )
194
205
  }
206
+
207
+ const TableActionButton = (props) => {
208
+ let smallAct = props.action.toLowerCase()
209
+ return (
210
+ <HawaButton
211
+ size="noPadding"
212
+ variant="outlined"
213
+ tooltip={props.action}
214
+ onClick={() => props.handleActionClick(smallAct)}
215
+ >
216
+ <div className="w-full rounded-lg p-1.5">
217
+ {smallAct === "delete" ? (
218
+ <FaTrash />
219
+ ) : smallAct === "view" ? (
220
+ <FaExclamationCircle />
221
+ ) : smallAct === "edit" ? (
222
+ <FaPen />
223
+ ) : (
224
+ props.action
225
+ )}
226
+ </div>
227
+ </HawaButton>
228
+ )
229
+ }