@sikka/hawa 0.0.106 → 0.0.108

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.0.106",
3
+ "version": "0.0.108",
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
  }
@@ -58,7 +58,7 @@ export const SignInForm: React.FunctionComponent<SignInFormTypes> = (props) => {
58
58
 
59
59
  return (
60
60
  <HawaContainer maxWidth="small">
61
- <form onSubmit={handleSubmit(props.handleSignIn)}>
61
+ <form onSubmit={handleSubmit((e) => props.handleSignIn(e))}>
62
62
  {props.showError && (
63
63
  <HawaAlert
64
64
  title={props.errorTitle}
@@ -150,6 +150,7 @@ export const SignInForm: React.FunctionComponent<SignInFormTypes> = (props) => {
150
150
  size="medium"
151
151
  width="full"
152
152
  type="submit"
153
+ // onClick={(e) => console.log("clicking")}
153
154
  >
154
155
  {props.texts.signInText}
155
156
  </HawaButton>
@@ -15,7 +15,7 @@ type DragDropImagesTypes = {
15
15
  setFiles: any
16
16
  setDeletedFiles: any
17
17
  maxFiles: number
18
- accept: any
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
- //fix type error
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()} />
@@ -6,7 +6,7 @@ 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
+ tooltip?: string,
10
10
  isLoading?: boolean
11
11
  }
12
12
 
@@ -95,6 +95,7 @@ export function HawaButton({
95
95
  )
96
96
  }
97
97
  disabled={disabled}
98
+ type={props.type}
98
99
  {...props}
99
100
  >
100
101
  {!isLoading ? (
@@ -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
- handleClose={setOpenDropDown}
88
- open={openDropDown}
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?: (e: boolean) => void
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 className="relative w-fit " onClick={() => handleClose(!open)}>
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
@@ -1,3 +1,4 @@
1
1
  export * from "./elements"
2
2
  export * from "./layout"
3
- export * from "./blocks"
3
+ export * from "./blocks"
4
+ export * from "./hooks"