@sikka/hawa 0.0.102 → 0.0.104
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/dist/styles.css +130 -80
- package/es/blocks/AuthForms/AppLanding.d.ts +1 -0
- package/es/blocks/AuthForms/CodeConfirmation.d.ts +6 -1
- package/es/blocks/AuthForms/NewPasswordForm.d.ts +0 -5
- package/es/blocks/AuthForms/ResetPasswordForm.d.ts +0 -3
- package/es/blocks/Referral/ReferralAccount.d.ts +7 -0
- package/es/blocks/Referral/ReferralSettlement.d.ts +8 -0
- package/es/blocks/Referral/ReferralStats.d.ts +8 -0
- package/es/blocks/Referral/index.d.ts +3 -0
- package/es/blocks/index.d.ts +1 -0
- package/es/elements/HawaChip.d.ts +1 -0
- package/es/elements/HawaCopyrights.d.ts +5 -5
- package/es/elements/HawaItemCard.d.ts +14 -6
- package/es/elements/HawaMenu.d.ts +2 -3
- package/es/elements/HawaModal.d.ts +1 -0
- package/es/elements/HawaRadio.d.ts +3 -1
- package/es/elements/HawaSelect.d.ts +2 -1
- package/es/elements/HawaSettingsRow.d.ts +1 -1
- package/es/elements/HawaTable.d.ts +2 -2
- package/es/index.es.js +1 -1
- package/lib/blocks/AuthForms/AppLanding.d.ts +1 -0
- package/lib/blocks/AuthForms/CodeConfirmation.d.ts +6 -1
- package/lib/blocks/AuthForms/NewPasswordForm.d.ts +0 -5
- package/lib/blocks/AuthForms/ResetPasswordForm.d.ts +0 -3
- package/lib/blocks/Referral/ReferralAccount.d.ts +7 -0
- package/lib/blocks/Referral/ReferralSettlement.d.ts +8 -0
- package/lib/blocks/Referral/ReferralStats.d.ts +8 -0
- package/lib/blocks/Referral/index.d.ts +3 -0
- package/lib/blocks/index.d.ts +1 -0
- package/lib/elements/HawaChip.d.ts +1 -0
- package/lib/elements/HawaCopyrights.d.ts +5 -5
- package/lib/elements/HawaItemCard.d.ts +14 -6
- package/lib/elements/HawaMenu.d.ts +2 -3
- package/lib/elements/HawaModal.d.ts +1 -0
- package/lib/elements/HawaRadio.d.ts +3 -1
- package/lib/elements/HawaSelect.d.ts +2 -1
- package/lib/elements/HawaSettingsRow.d.ts +1 -1
- package/lib/elements/HawaTable.d.ts +2 -2
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/src/blocks/AuthForms/AppLanding.tsx +2 -1
- package/src/blocks/AuthForms/CodeConfirmation.tsx +7 -2
- package/src/blocks/AuthForms/NewPasswordForm.tsx +1 -6
- package/src/blocks/AuthForms/ResetPasswordForm.tsx +1 -4
- package/src/blocks/AuthForms/SignInForm.tsx +1 -1
- package/src/blocks/AuthForms/SignInPhone.tsx +1 -1
- package/src/blocks/AuthForms/SignUpForm.tsx +1 -1
- package/src/blocks/Payment/CheckoutForm.tsx +9 -0
- package/src/blocks/Referral/ReferralAccount.tsx +49 -0
- package/src/blocks/Referral/ReferralSettlement.tsx +110 -0
- package/src/blocks/Referral/ReferralStats.tsx +94 -0
- package/src/blocks/Referral/index.ts +3 -0
- package/src/blocks/index.ts +5 -4
- package/src/elements/HawaButton.tsx +21 -21
- package/src/elements/HawaCheckbox.tsx +6 -4
- package/src/elements/HawaChip.tsx +17 -6
- package/src/elements/HawaCopyrights.tsx +5 -5
- package/src/elements/HawaItemCard.tsx +83 -58
- package/src/elements/HawaMenu.tsx +49 -54
- package/src/elements/HawaModal.tsx +58 -52
- package/src/elements/HawaRadio.tsx +27 -24
- package/src/elements/HawaSelect.tsx +4 -2
- package/src/elements/HawaSettingsRow.tsx +3 -6
- package/src/elements/HawaTable.tsx +2 -2
- package/src/elements/HawaTabs.tsx +15 -6
- package/src/elements/HawaTooltip.tsx +23 -16
- package/src/layout/HawaContainer.tsx +2 -2
- package/src/styles.css +130 -80
- package/storybook-static/209.d29fd715.iframe.bundle.js +2 -0
- package/storybook-static/{209.3141149a.iframe.bundle.js.LICENSE.txt → 209.d29fd715.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/main.a1546405.iframe.bundle.js +1 -0
- package/storybook-static/project.json +1 -1
- package/tailwind.config.js +1 -1
- package/storybook-static/209.3141149a.iframe.bundle.js +0 -2
- package/storybook-static/main.2fac3c3c.iframe.bundle.js +0 -1
|
@@ -1,25 +1,53 @@
|
|
|
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
|
-
|
|
5
|
-
actions
|
|
6
|
-
content
|
|
7
|
-
headerActions
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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: "w-full rounded-tr-lg rounded-tl-lg",
|
|
44
|
+
horizontal: "h-40 w-fit rounded-tl-lg rounded-bl-lg",
|
|
45
|
+
}
|
|
46
|
+
let headerActionsButtonStyle =
|
|
47
|
+
"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"
|
|
48
|
+
|
|
22
49
|
const [openActionHeader, setOpenActionHeader] = useState(false)
|
|
50
|
+
const [openDropDown, setOpenDropDown] = useState(false)
|
|
23
51
|
|
|
24
52
|
function handleOpenActionHeader() {
|
|
25
53
|
setOpenActionHeader(!openActionHeader)
|
|
@@ -37,61 +65,58 @@ export const HawaItemCard: React.FunctionComponent<ItemCardTypes> = ({
|
|
|
37
65
|
|
|
38
66
|
return (
|
|
39
67
|
<div
|
|
40
|
-
className=
|
|
68
|
+
className={clsx(defaultStyle, orientationStyles[orientation])}
|
|
41
69
|
{...props}
|
|
42
70
|
>
|
|
43
|
-
{
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
71
|
+
{cardImage && (
|
|
72
|
+
<img
|
|
73
|
+
src={"https://via.placeholder.com/50"}
|
|
74
|
+
// className=" h-full w-full max-w-sm bg-red-500 bg-[url('https://via.placeholder.com/50')] bg-cover bg-no-repeat"
|
|
75
|
+
className={clsx(imageStyles[orientation])}
|
|
76
|
+
/>
|
|
77
|
+
)}
|
|
78
|
+
<div className="relative w-full px-6 pt-6">
|
|
79
|
+
{headerActions && (
|
|
80
|
+
<div className="max-h- bg-red absolute right-0 top-0 flex justify-end pt-3 pr-3">
|
|
81
|
+
<HawaMenu
|
|
82
|
+
buttonPosition="top-right"
|
|
83
|
+
menuItems={headerActions}
|
|
84
|
+
handleClose={setOpenDropDown}
|
|
85
|
+
open={openDropDown}
|
|
59
86
|
>
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
>
|
|
77
|
-
{singleAction.label}
|
|
78
|
-
</a>
|
|
79
|
-
</li>
|
|
80
|
-
)
|
|
81
|
-
})}
|
|
82
|
-
</ul>
|
|
87
|
+
<div
|
|
88
|
+
className={clsx(headerActionsButtonStyle)}
|
|
89
|
+
onClick={handleOpenActionHeader}
|
|
90
|
+
>
|
|
91
|
+
<span className="sr-only">Open dropdown</span>
|
|
92
|
+
<svg
|
|
93
|
+
className="h-6 w-6"
|
|
94
|
+
aria-hidden="true"
|
|
95
|
+
fill="currentColor"
|
|
96
|
+
viewBox="0 0 20 20"
|
|
97
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
98
|
+
>
|
|
99
|
+
<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>
|
|
100
|
+
</svg>
|
|
101
|
+
</div>
|
|
102
|
+
</HawaMenu>
|
|
83
103
|
</div>
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
104
|
+
)}
|
|
105
|
+
|
|
106
|
+
{header && (
|
|
107
|
+
<h5 className="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
|
|
108
|
+
{header}
|
|
109
|
+
</h5>
|
|
110
|
+
)}
|
|
111
|
+
{content && (
|
|
112
|
+
<p className="w-full font-normal text-gray-700 dark:text-gray-400">
|
|
113
|
+
{content}
|
|
114
|
+
</p>
|
|
115
|
+
)}
|
|
116
|
+
{actions && (
|
|
117
|
+
<div className="flex justify-end rounded-b-lg p-3">{actions}</div>
|
|
118
|
+
)}
|
|
93
119
|
</div>
|
|
94
|
-
<div className="mt-6 flex justify-end rounded-b-lg p-3">{actions}</div>
|
|
95
120
|
</div>
|
|
96
121
|
)
|
|
97
122
|
}
|
|
@@ -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
|
|
17
|
-
handleClose
|
|
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
|
|
25
|
-
label
|
|
26
|
-
action
|
|
27
|
-
|
|
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-2 border-blue-400 border-opacity-20 ring-offset-1 absolute z-10 w-44 divide-y divide-gray-100 overflow-y-clip rounded-lg bg-white shadow 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",
|
|
@@ -51,47 +48,45 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
|
|
|
51
48
|
closed: "max-h-0 opacity-0 animate-expandUp",
|
|
52
49
|
}
|
|
53
50
|
return (
|
|
54
|
-
<div className="">
|
|
55
|
-
|
|
56
|
-
{children}
|
|
51
|
+
<div className="relative w-fit " onClick={() => handleClose(!open)}>
|
|
52
|
+
{children}
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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,33 +1,36 @@
|
|
|
1
|
-
import React from "react"
|
|
1
|
+
import React, { useState } from "react"
|
|
2
2
|
|
|
3
3
|
type RadioTypes = {
|
|
4
|
-
options
|
|
4
|
+
options?: any
|
|
5
|
+
onChangeTab?: any
|
|
6
|
+
defaultValue?: any
|
|
5
7
|
}
|
|
6
8
|
export const HawaRadio: React.FunctionComponent<RadioTypes> = (props) => {
|
|
9
|
+
const [selectedOption, setSelectedOption] = useState(props.defaultValue)
|
|
10
|
+
let activeTabStyle =
|
|
11
|
+
"inline-block py-2 px-4 text-white bg-blue-600 rounded-lg active"
|
|
12
|
+
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
|
+
|
|
7
15
|
return (
|
|
8
16
|
<div>
|
|
9
|
-
<ul className="w-
|
|
10
|
-
{props.options
|
|
11
|
-
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</label>
|
|
27
|
-
</div>
|
|
28
|
-
</li>
|
|
29
|
-
)
|
|
30
|
-
})}
|
|
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
|
+
{props.options?.map((opt: any) => (
|
|
19
|
+
<li>
|
|
20
|
+
<button
|
|
21
|
+
aria-current="page"
|
|
22
|
+
onClick={() => {
|
|
23
|
+
setSelectedOption(opt.value)
|
|
24
|
+
props.onChangeTab(opt.value)
|
|
25
|
+
}}
|
|
26
|
+
className={
|
|
27
|
+
selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
|
|
28
|
+
}
|
|
29
|
+
>
|
|
30
|
+
{opt.label}
|
|
31
|
+
</button>
|
|
32
|
+
</li>
|
|
33
|
+
))}
|
|
31
34
|
</ul>
|
|
32
35
|
</div>
|
|
33
36
|
)
|
|
@@ -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 && (
|
|
@@ -4,13 +4,11 @@ import { HawaTextField } from "./HawaTextField"
|
|
|
4
4
|
import { HawaSwitch } from "./HawaSwitch"
|
|
5
5
|
import { HawaColorPicker } from "./HawaColorPicker"
|
|
6
6
|
import { HawaRange } from "./HawaRange"
|
|
7
|
-
import { HawaCheckbox } from "./HawaCheckbox"
|
|
8
|
-
import { HawaTabs } from "./HawaTabs"
|
|
9
7
|
import { HawaRadio } from "./HawaRadio"
|
|
10
8
|
|
|
11
9
|
type SettingsRowTypes = {
|
|
12
10
|
settingsLabel: any
|
|
13
|
-
settingsType: "
|
|
11
|
+
settingsType: "text" | "radio" | "boolean" | "color" | "range"
|
|
14
12
|
radioProps: {
|
|
15
13
|
defaultValue: any
|
|
16
14
|
onChangeTab: any
|
|
@@ -34,14 +32,13 @@ export const HawaSettingsRow: React.FunctionComponent<SettingsRowTypes> = ({
|
|
|
34
32
|
radioProps,
|
|
35
33
|
}) => {
|
|
36
34
|
return (
|
|
37
|
-
<div className="my-
|
|
35
|
+
<div className="my-0.5 flex max-h-fit flex-row items-center justify-between rounded-xl bg-white px-4 py-2 pr-2 align-middle">
|
|
38
36
|
<HawaTypography>{settingsLabel}</HawaTypography>
|
|
39
|
-
{settingsType === "checkbox" && <HawaCheckbox centered />}
|
|
40
37
|
{settingsType === "text" && <HawaTextField margin="none" width="small" />}
|
|
41
38
|
{settingsType === "boolean" && <HawaSwitch />}
|
|
42
39
|
{settingsType === "range" && <HawaRange {...rangeProps} />}
|
|
43
40
|
{settingsType === "color" && <HawaColorPicker {...colorProps} />}
|
|
44
|
-
{settingsType === "radio" && <
|
|
41
|
+
{settingsType === "radio" && <HawaRadio {...radioProps} />}
|
|
45
42
|
</div>
|
|
46
43
|
)
|
|
47
44
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import clsx from "clsx"
|
|
1
2
|
import React, { useState } from "react"
|
|
2
3
|
|
|
3
4
|
type TabsTypes = {
|
|
@@ -8,13 +9,18 @@ type TabsTypes = {
|
|
|
8
9
|
export const HawaTabs: React.FunctionComponent<TabsTypes> = (props) => {
|
|
9
10
|
const [selectedOption, setSelectedOption] = useState(props.defaultValue)
|
|
10
11
|
let activeTabStyle =
|
|
11
|
-
"inline-block py-2 px-4 text-white bg-
|
|
12
|
+
"inline-block py-2 px-4 text-white bg-primary-500 rounded-lg rounded-br-none rounded-bl-none 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 rounded-lg rounded-br-none rounded-bl-none 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
|
|
18
|
+
<ul
|
|
19
|
+
className={clsx(
|
|
20
|
+
"flex w-fit flex-wrap rounded-lg rounded-br-none rounded-bl-none border-b-primary-500 bg-gray-100 text-center text-sm font-medium text-gray-500 dark:text-gray-400",
|
|
21
|
+
selectedOption ? "border-b-2" : "border-b-0"
|
|
22
|
+
)}
|
|
23
|
+
>
|
|
18
24
|
{props.options?.map((opt: any) => (
|
|
19
25
|
<li>
|
|
20
26
|
<button
|
|
@@ -23,9 +29,12 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = (props) => {
|
|
|
23
29
|
setSelectedOption(opt.value)
|
|
24
30
|
props.onChangeTab(opt.value)
|
|
25
31
|
}}
|
|
26
|
-
className={
|
|
27
|
-
selectedOption === opt.value
|
|
28
|
-
|
|
32
|
+
className={clsx(
|
|
33
|
+
selectedOption === opt.value
|
|
34
|
+
? activeTabStyle
|
|
35
|
+
: inactiveTabStyle,
|
|
36
|
+
"transition-all"
|
|
37
|
+
)}
|
|
29
38
|
>
|
|
30
39
|
{opt.label}
|
|
31
40
|
</button>
|