@sikka/hawa 0.0.106 → 0.0.107
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/es/elements/DragDropImages.d.ts +1 -1
- package/es/elements/HawaMenu.d.ts +2 -1
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/useDiscloser.d.ts +7 -0
- package/es/index.d.ts +1 -0
- package/es/index.es.js +1 -1
- package/lib/elements/DragDropImages.d.ts +1 -1
- package/lib/elements/HawaMenu.d.ts +2 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/useDiscloser.d.ts +7 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -1
- package/package.json +3 -2
- package/src/elements/DragDropImages.tsx +3 -3
- package/src/elements/HawaItemCard.tsx +6 -2
- package/src/elements/HawaMenu.tsx +10 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useDiscloser.ts +25 -0
- package/src/index.ts +2 -1
- package/storybook-static/{209.d29fd715.iframe.bundle.js → 209.05314e10.iframe.bundle.js} +2 -2
- package/storybook-static/{209.d29fd715.iframe.bundle.js.LICENSE.txt → 209.05314e10.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/main.7a1984b7.iframe.bundle.js +1 -0
- package/storybook-static/project.json +1 -1
- package/storybook-static/main.a1546405.iframe.bundle.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sikka/hawa",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.107",
|
|
4
4
|
"description": "UI Kit",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.es.js",
|
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
"react-icons": "^4.6.0",
|
|
96
96
|
"react-select": "^5.3.2",
|
|
97
97
|
"rollup-plugin-swc": "^0.2.1",
|
|
98
|
-
"rollup-plugin-typescript2": "^0.34.1"
|
|
98
|
+
"rollup-plugin-typescript2": "^0.34.1",
|
|
99
|
+
"start": "^5.1.0"
|
|
99
100
|
}
|
|
100
101
|
}
|
|
@@ -15,7 +15,7 @@ type DragDropImagesTypes = {
|
|
|
15
15
|
setFiles: any
|
|
16
16
|
setDeletedFiles: any
|
|
17
17
|
maxFiles: number
|
|
18
|
-
accept:
|
|
18
|
+
accept: string
|
|
19
19
|
onAcceptedFiles: any
|
|
20
20
|
showPreview: any
|
|
21
21
|
onDeleteFile: any
|
|
@@ -157,9 +157,9 @@ export const DragDropImages: React.FunctionComponent<DragDropImagesTypes> = ({
|
|
|
157
157
|
<div
|
|
158
158
|
// variant="drop-area"
|
|
159
159
|
{...getRootProps({
|
|
160
|
-
|
|
161
|
-
// style: { backgroundColor: isDragActive && "white" },
|
|
160
|
+
style: {backgroundColor : isDragActive ? "white" : "inherit" }
|
|
162
161
|
})}
|
|
162
|
+
// style={{ backgroundColor: isDragActive ? "white" : "inherit" }}
|
|
163
163
|
className="flex flex-col justify-center rounded-xl border border-dashed border-black"
|
|
164
164
|
>
|
|
165
165
|
<input {...getInputProps()} />
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import clsx from "clsx"
|
|
2
2
|
import React, { useEffect } from "react"
|
|
3
3
|
import { useState } from "react"
|
|
4
|
+
import useDiscloser from "../hooks/useDiscloser"
|
|
4
5
|
import { HawaMenu } from "./HawaMenu"
|
|
5
6
|
|
|
6
7
|
interface ItemCardTypes {
|
|
@@ -48,6 +49,8 @@ export const HawaItemCard: React.FunctionComponent<ItemCardTypes> = ({
|
|
|
48
49
|
"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
50
|
|
|
50
51
|
const [openActionHeader, setOpenActionHeader] = useState(false)
|
|
52
|
+
const {isOpen : isActionOpen, onClose : onActionClose, onOpen : onActionOpen} = useDiscloser();
|
|
53
|
+
const {isOpen : isDropDownOpen, onClose : onDropDownClose, onOpen : onDropDownOpen} = useDiscloser();
|
|
51
54
|
const [openDropDown, setOpenDropDown] = useState(false)
|
|
52
55
|
|
|
53
56
|
function handleOpenActionHeader() {
|
|
@@ -84,8 +87,9 @@ export const HawaItemCard: React.FunctionComponent<ItemCardTypes> = ({
|
|
|
84
87
|
<HawaMenu
|
|
85
88
|
buttonPosition="top-right"
|
|
86
89
|
menuItems={headerActions}
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
handleOpen={onDropDownOpen}
|
|
91
|
+
handleClose={onDropDownClose}
|
|
92
|
+
open={isDropDownOpen}
|
|
89
93
|
>
|
|
90
94
|
<div
|
|
91
95
|
className={clsx(headerActionsButtonStyle)}
|
|
@@ -8,7 +8,8 @@ interface TMenuTypes {
|
|
|
8
8
|
headerTitle?: string
|
|
9
9
|
headerSubtitle?: string
|
|
10
10
|
open?: boolean
|
|
11
|
-
handleClose?: (
|
|
11
|
+
handleClose?: () => void
|
|
12
|
+
handleOpen: () => void
|
|
12
13
|
anchor?: any
|
|
13
14
|
children?: ReactNode
|
|
14
15
|
buttonPosition?: "top-right" | "top-left" | "bottom-right" | "bottom-left"
|
|
@@ -32,6 +33,7 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
|
|
|
32
33
|
headerSubtitle,
|
|
33
34
|
open,
|
|
34
35
|
handleClose,
|
|
36
|
+
handleOpen,
|
|
35
37
|
buttonPosition,
|
|
36
38
|
children,
|
|
37
39
|
}) => {
|
|
@@ -48,7 +50,13 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
|
|
|
48
50
|
closed: "h-0 ",
|
|
49
51
|
}
|
|
50
52
|
return (
|
|
51
|
-
<div
|
|
53
|
+
<div
|
|
54
|
+
className="relative w-fit "
|
|
55
|
+
onClick={() => {
|
|
56
|
+
if (open) handleClose()
|
|
57
|
+
else handleOpen()
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
52
60
|
{children}
|
|
53
61
|
|
|
54
62
|
<div
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useDiscloser"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useState } from "react"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
type TUseDiscloser = {
|
|
5
|
+
isOpen : boolean,
|
|
6
|
+
onOpen : () => void,
|
|
7
|
+
onClose : () => void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const useDiscloser = (value: boolean = false) : TUseDiscloser => {
|
|
11
|
+
const [open, setOpen] = useState<boolean>(value)
|
|
12
|
+
|
|
13
|
+
const onOpen = () => setOpen(true)
|
|
14
|
+
|
|
15
|
+
const onClose = () => setOpen(false)
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
isOpen: open,
|
|
19
|
+
onOpen: onOpen,
|
|
20
|
+
onClose: onClose,
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export default useDiscloser;
|
package/src/index.ts
CHANGED