@sikka/hawa 0.8.14-next → 0.8.15-next

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/index.d.mts CHANGED
@@ -116,7 +116,7 @@ interface ItemCardTypes {
116
116
  /** a URL for the image of the card */
117
117
  cardImage?: string;
118
118
  /** a function that fires when the card is clicked anywhere */
119
- onCardClick?: any;
119
+ onCardClick?: (event: React__default.MouseEvent<HTMLDivElement>) => void;
120
120
  /** a React node with HawaIconCount children to have counters at the bottom of the card */
121
121
  counts?: JSX.Element;
122
122
  /** The action buttons on the bottom right of the card */
package/dist/index.d.ts CHANGED
@@ -116,7 +116,7 @@ interface ItemCardTypes {
116
116
  /** a URL for the image of the card */
117
117
  cardImage?: string;
118
118
  /** a function that fires when the card is clicked anywhere */
119
- onCardClick?: any;
119
+ onCardClick?: (event: React__default.MouseEvent<HTMLDivElement>) => void;
120
120
  /** a React node with HawaIconCount children to have counters at the bottom of the card */
121
121
  counts?: JSX.Element;
122
122
  /** The action buttons on the bottom right of the card */
package/dist/index.js CHANGED
@@ -1362,7 +1362,8 @@ var DropdownMenu = function(param) {
1362
1362
  };
1363
1363
  // components/elements/cards/ItemCard.tsx
1364
1364
  var ItemCard = function(_param) {
1365
- var handleOpenActionHeader = function handleOpenActionHeader() {
1365
+ var handleOpenActionHeader = function handleOpenActionHeader(e) {
1366
+ e.stopPropagation();
1366
1367
  setOpenActionHeader(!openActionHeader);
1367
1368
  };
1368
1369
  var actions = _param.actions, counts = _param.counts, content = _param.content, headerActions = _param.headerActions, clickableImage = _param.clickableImage, clickableImageAction = _param.clickableImageAction, clickableImageActionText = _param.clickableImageActionText, clickableImageActionIcon = _param.clickableImageActionIcon, header = _param.header, cardImage = _param.cardImage, _param_orientation = _param.orientation, orientation = _param_orientation === void 0 ? "vertical" : _param_orientation, props = _object_without_properties(_param, [
@@ -1404,11 +1405,17 @@ var ItemCard = function(_param) {
1404
1405
  openActionHeader
1405
1406
  ]);
1406
1407
  return /* @__PURE__ */ import_react5.default.createElement("div", _object_spread({
1407
- className: (0, import_clsx5.default)(defaultStyle, orientationStyles[orientation])
1408
+ className: (0, import_clsx5.default)(defaultStyle, orientationStyles[orientation]),
1409
+ onClick: function(e) {
1410
+ e.stopPropagation();
1411
+ if (props.onCardClick) {
1412
+ props.onCardClick(e);
1413
+ }
1414
+ }
1408
1415
  }, props), cardImage && /* @__PURE__ */ import_react5.default.createElement("div", {
1409
1416
  className: "hawa-group hawa-relative hawa-overflow-clip"
1410
1417
  }, /* @__PURE__ */ import_react5.default.createElement("img", {
1411
- src: "https://via.placeholder.com/50",
1418
+ src: cardImage,
1412
1419
  className: (0, import_clsx5.default)(imageStyles[orientation], clickableImage ? "hawa-overflow-clip hawa-transition-all group-hover:hawa-blur-lg" : "")
1413
1420
  }), clickableImage && /* @__PURE__ */ import_react5.default.createElement("div", {
1414
1421
  className: "hawa-absolute hawa-left-0 hawa-top-0 hawa-flex hawa-h-full hawa-w-full hawa-items-center hawa-justify-center hawa-opacity-0 hawa-transition-all group-hover:hawa-opacity-100 "
@@ -1441,7 +1448,15 @@ var ItemCard = function(_param) {
1441
1448
  className: "hawa-w-full hawa-font-normal hawa-text-gray-700 dark:hawa-text-gray-400"
1442
1449
  }, content), actions || counts ? /* @__PURE__ */ import_react5.default.createElement("div", {
1443
1450
  className: (0, import_clsx5.default)("hawa-mt-3 hawa-flex hawa-items-center hawa-rounded-b-lg dark:hawa-text-white ", actions && counts ? "hawa-justify-between" : "hawa-justify-end")
1444
- }, counts, actions) : null));
1451
+ }, counts, /* @__PURE__ */ import_react5.default.createElement(StopPropagationWrapper, null, actions)) : null));
1452
+ };
1453
+ var StopPropagationWrapper = function(props) {
1454
+ var handleClick = function(e) {
1455
+ e.stopPropagation();
1456
+ };
1457
+ return /* @__PURE__ */ import_react5.default.createElement("div", {
1458
+ onClick: handleClick
1459
+ }, props.children);
1445
1460
  };
1446
1461
  // components/elements/Dialog.tsx
1447
1462
  var React9 = __toESM(require("react"));
package/dist/index.mjs CHANGED
@@ -747,7 +747,8 @@ var ItemCard = ({
747
747
  };
748
748
  let headerActionsButtonStyle = "hawa-inline-block hawa-rounded hawa-p-1 hawa-text-sm hawa-text-gray-500 hover:hawa-bg-gray-100 focus:hawa-outline-none focus:hawa-ring-4 focus:hawa-ring-gray-200 dark:hawa-text-gray-400 dark:hover:hawa-bg-gray-700 dark:focus:hawa-ring-gray-700";
749
749
  const [openActionHeader, setOpenActionHeader] = useState3(false);
750
- function handleOpenActionHeader() {
750
+ function handleOpenActionHeader(e) {
751
+ e.stopPropagation();
751
752
  setOpenActionHeader(!openActionHeader);
752
753
  }
753
754
  useEffect2(() => {
@@ -762,12 +763,18 @@ var ItemCard = ({
762
763
  "div",
763
764
  {
764
765
  className: clsx5(defaultStyle, orientationStyles[orientation]),
766
+ onClick: (e) => {
767
+ e.stopPropagation();
768
+ if (props.onCardClick) {
769
+ props.onCardClick(e);
770
+ }
771
+ },
765
772
  ...props
766
773
  },
767
774
  cardImage && /* @__PURE__ */ React8.createElement("div", { className: "hawa-group hawa-relative hawa-overflow-clip" }, /* @__PURE__ */ React8.createElement(
768
775
  "img",
769
776
  {
770
- src: "https://via.placeholder.com/50",
777
+ src: cardImage,
771
778
  className: clsx5(
772
779
  imageStyles[orientation],
773
780
  clickableImage ? "hawa-overflow-clip hawa-transition-all group-hover:hawa-blur-lg" : ""
@@ -815,10 +822,16 @@ var ItemCard = ({
815
822
  )
816
823
  },
817
824
  counts,
818
- actions
825
+ /* @__PURE__ */ React8.createElement(StopPropagationWrapper, null, actions)
819
826
  ) : null)
820
827
  );
821
828
  };
829
+ var StopPropagationWrapper = (props) => {
830
+ const handleClick = (e) => {
831
+ e.stopPropagation();
832
+ };
833
+ return /* @__PURE__ */ React8.createElement("div", { onClick: handleClick }, props.children);
834
+ };
822
835
 
823
836
  // components/elements/Dialog.tsx
824
837
  import * as React9 from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.8.14-next",
3
+ "version": "0.8.15-next",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {