@sikka/hawa 0.0.199 → 0.0.200

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.
@@ -23,7 +23,7 @@ type HawaAppLayoutTypes = {
23
23
  type MenuItems = {
24
24
  icon?: JSX.Element;
25
25
  label: string;
26
- action?: (e: React.MouseEvent<HTMLLIElement, MouseEvent>, item: string) => void;
26
+ action?: (e: any) => void;
27
27
  isButton?: boolean;
28
28
  };
29
29
  export declare const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.0.199",
3
+ "version": "0.0.200",
4
4
  "description": "SaaS Oriented UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -18,10 +18,7 @@ interface ItemCardTypes {
18
18
  type THeaderActions = {
19
19
  icon?: JSX.Element
20
20
  label: string
21
- action?: (
22
- e: React.MouseEvent<HTMLLIElement, MouseEvent>,
23
- item: string
24
- ) => void
21
+ action?: (e: any) => void
25
22
  isButton?: boolean
26
23
  }
27
24
  export const HawaItemCard: React.FunctionComponent<ItemCardTypes> = ({
@@ -20,16 +20,15 @@ interface TMenuTypes {
20
20
  | "bottom-right"
21
21
  | "bottom-left"
22
22
  onClickOutside?: any
23
+ actionedItem?: any
23
24
  size?: "small" | "normal" | "large"
24
25
  }
25
26
 
26
27
  type MenuItems = {
27
28
  icon?: JSX.Element
28
29
  label: string
29
- action?: (
30
- e: React.MouseEvent<HTMLLIElement, MouseEvent>,
31
- item: string
32
- ) => void
30
+ // action?: (item: any) => void
31
+ action?: (e: any) => void
33
32
  isButton?: boolean
34
33
  element?: any
35
34
  }
@@ -43,6 +42,7 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
43
42
  size = "normal",
44
43
  children,
45
44
  onClickOutside,
45
+ actionedItem,
46
46
  position = "top-right",
47
47
  }) => {
48
48
  const [menuOpened, setMenuOpened] = useState(false)
@@ -196,7 +196,7 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
196
196
  </li>
197
197
  ) : (
198
198
  <li
199
- onClick={(e) => item.action(e, item.label)}
199
+ onClick={() => item?.action(actionedItem)}
200
200
  className={clsx(
201
201
  item.isButton
202
202
  ? "flex cursor-pointer flex-row items-center rounded bg-buttonPrimary-500 py-2 px-4 text-white hover:bg-buttonPrimary-700 rtl:flex-row-reverse dark:hover:bg-buttonPrimary-700 dark:hover:text-white"
@@ -205,7 +205,13 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
205
205
  )}
206
206
  >
207
207
  {item.icon && (
208
- <div className="mr-2 rtl:ml-2">{item.icon}</div>
208
+ <div
209
+ className={
210
+ size === "small" ? "mr-1 rtl:ml-1" : "mr-2 rtl:ml-2"
211
+ }
212
+ >
213
+ {item.icon}
214
+ </div>
209
215
  )}
210
216
  {item.label}
211
217
  </li>
@@ -2,8 +2,9 @@ import React from "react"
2
2
  import { BsThreeDotsVertical } from "react-icons/bs"
3
3
  import clsx from "clsx"
4
4
  import { HawaMenu } from "./HawaMenu"
5
- // TODO: make action click return row
5
+
6
6
  // TODO: make action column width max fit
7
+
7
8
  type TableTypes = {
8
9
  columns: any[string]
9
10
  actions?: ActionItems[][]
@@ -18,15 +19,13 @@ type TableTypes = {
18
19
  clickable?: boolean
19
20
  actionsText?: string
20
21
  bordersWidth?: string
22
+ onActionClicked?: any
21
23
  borders?: "all" | "cols" | "rows" | "outer" | "inner"
22
24
  }
23
25
  type ActionItems = {
24
26
  icon?: JSX.Element
25
27
  label: string
26
- action?: (
27
- e: React.MouseEvent<HTMLLIElement, MouseEvent>,
28
- item: string
29
- ) => void
28
+ action?: (e: any) => void
30
29
  isButton?: boolean
31
30
  element?: any
32
31
  }
@@ -157,6 +156,7 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
157
156
  <div className="flex items-center justify-center">
158
157
  <HawaMenu
159
158
  size="small"
159
+ actionedItem={[rowIndex, singleRow]}
160
160
  menuItems={props.actions}
161
161
  position={
162
162
  direction === "rtl" ? "right-bottom" : "left-bottom"
@@ -192,28 +192,3 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
192
192
  </div>
193
193
  )
194
194
  }
195
-
196
- // const TableActionButton = (props) => {
197
- // let smallAct = props.action?.toLowerCase()
198
- // return (
199
- // <HawaButton
200
- // tooltipSize="small"
201
- // buttonID={props.action + props.row}
202
- // tooltipPosition="top-right"
203
- // size="xs"
204
- // variant="contained"
205
- // tooltip={props.action}
206
- // onClick={() => props.handleActionClick(smallAct)}
207
- // >
208
- // {smallAct === "delete" ? (
209
- // <FaTrash />
210
- // ) : smallAct === "view" ? (
211
- // <FaExclamationCircle />
212
- // ) : smallAct === "edit" ? (
213
- // <FaPen />
214
- // ) : (
215
- // props.action
216
- // )}
217
- // </HawaButton>
218
- // )
219
- // }
@@ -26,8 +26,7 @@ type InvoiceAccordionTypes = {
26
26
  icon?: JSX.Element
27
27
  label: string
28
28
  action?: (
29
- e: React.MouseEvent<HTMLLIElement, MouseEvent>,
30
- item: string
29
+ e: any
31
30
  ) => void
32
31
  isButton?: boolean
33
32
  element?: any
@@ -33,10 +33,7 @@ type HawaAppLayoutTypes = {
33
33
  type MenuItems = {
34
34
  icon?: JSX.Element
35
35
  label: string
36
- action?: (
37
- e: React.MouseEvent<HTMLLIElement, MouseEvent>,
38
- item: string
39
- ) => void
36
+ action?: (e: any) => void
40
37
  isButton?: boolean
41
38
  }
42
39
  export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
package/src/styles.css CHANGED
@@ -715,6 +715,9 @@ video {
715
715
  .mt-1 {
716
716
  margin-top: 0.25rem;
717
717
  }
718
+ .mr-1 {
719
+ margin-right: 0.25rem;
720
+ }
718
721
  .mr-2 {
719
722
  margin-right: 0.5rem;
720
723
  }
@@ -772,9 +775,6 @@ video {
772
775
  .mr-1\.5 {
773
776
  margin-right: 0.375rem;
774
777
  }
775
- .mr-1 {
776
- margin-right: 0.25rem;
777
- }
778
778
  .mt-6 {
779
779
  margin-top: 1.5rem;
780
780
  }
@@ -2136,6 +2136,10 @@ body {
2136
2136
  --tw-ring-color: rgb(147 197 253 / var(--tw-ring-opacity));
2137
2137
  }
2138
2138
 
2139
+ [dir="rtl"] .rtl\:ml-1 {
2140
+ margin-left: 0.25rem;
2141
+ }
2142
+
2139
2143
  [dir="rtl"] .rtl\:ml-2 {
2140
2144
  margin-left: 0.5rem;
2141
2145
  }