@sikka/hawa 0.1.89 → 0.1.91

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.1.89",
3
+ "version": "0.1.91",
4
4
  "description": "Modern UI Kit made with Tailwind & Radix Primitives",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -265,6 +265,7 @@ interface DropdownMenuProps {
265
265
  align?: ExtendedDropdownMenuContentProps["align"]
266
266
  alignOffset?: ExtendedDropdownMenuContentProps["alignOffset"]
267
267
  width?: "default" | "sm" | "lg" | "parent"
268
+ selectCallback?: any
268
269
  }
269
270
  export const DropdownMenu: React.FC<DropdownMenuProps> = ({
270
271
  trigger,
@@ -277,6 +278,7 @@ export const DropdownMenu: React.FC<DropdownMenuProps> = ({
277
278
  triggerClassname,
278
279
  align,
279
280
  alignOffset,
281
+ selectCallback,
280
282
  width = "default",
281
283
  }) => {
282
284
  const widthStyles = {
@@ -311,7 +313,12 @@ export const DropdownMenu: React.FC<DropdownMenuProps> = ({
311
313
  <DropdownMenuItem
312
314
  disabled={subitem.disabled}
313
315
  className="flex flex-row gap-2"
314
- onSelect={() => subitem.action()}
316
+ onSelect={() => {
317
+ subitem.action()
318
+ if (selectCallback) {
319
+ selectCallback(subitem.value)
320
+ }
321
+ }}
315
322
  key={subIndex}
316
323
  >
317
324
  {subitem.icon && subitem.icon}
@@ -330,7 +337,16 @@ export const DropdownMenu: React.FC<DropdownMenuProps> = ({
330
337
  if (item.presist) {
331
338
  e.preventDefault()
332
339
  }
333
- item.action()
340
+ if (item.action) {
341
+ item.action()
342
+ if (selectCallback) {
343
+ selectCallback(item.value)
344
+ }
345
+ } else {
346
+ if (selectCallback) {
347
+ selectCallback(item.value)
348
+ }
349
+ }
334
350
  }}
335
351
  end={item.end}
336
352
  >
@@ -40,7 +40,6 @@ type TableTypes = {
40
40
  filter?: string
41
41
  }
42
42
  bordersWidth?: string
43
- onActionClicked?: any
44
43
  headerTools?: boolean
45
44
  borders?: "all" | "cols" | "rows" | "outer" | "inner"
46
45
  }
@@ -109,6 +108,7 @@ export const HawaTable: FC<TableTypes> = ({
109
108
  useEffect(() => {
110
109
  changePage()
111
110
  }, [slice, page])
111
+
112
112
  return (
113
113
  <div className="relative flex flex-col gap-2 ">
114
114
  <div className={`overflow-x-auto rounded bg-${headerColor}`}>
@@ -316,6 +316,9 @@ export const HawaTable: FC<TableTypes> = ({
316
316
  direction={direction}
317
317
  side="right"
318
318
  items={props.actions}
319
+ selectCallback={(e) =>
320
+ props.handleActionClick(e, singleRow)
321
+ }
319
322
  trigger={
320
323
  <div className="flex w-fit cursor-pointer items-center justify-center rounded p-2 hover:bg-gray-200 dark:hover:bg-gray-600">
321
324
  <svg