react-chessboard-ui 1.4.0 → 1.4.1

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.
@@ -26,7 +26,7 @@ export declare const useChessBoardInteractive: (props: UseChessBoardInteractiveP
26
26
  markCell: (cellPos: CellPos) => void;
27
27
  setNewMove: import("react").Dispatch<import("react").SetStateAction<ChangeMove>>;
28
28
  setAnimated: import("react").Dispatch<import("react").SetStateAction<boolean>>;
29
- handleClick: (cellPos: CellPos) => void;
29
+ handleClick: (cellPos: CellPos, viewOnly?: boolean) => void;
30
30
  clearFromPos: () => void;
31
31
  handleGrabEnd: (cellPos: CellPos, withTransition?: boolean) => void;
32
32
  handleGrabbing: (x: number, y: number) => void;
package/dist/index.js CHANGED
@@ -2610,9 +2610,13 @@ var useChessBoardInteractive = function useChessBoardInteractive(props) {
2610
2610
  clearClickedPos();
2611
2611
  clearClickPossibleMoves();
2612
2612
  };
2613
- var handleClick = function handleClick(cellPos) {
2613
+ var handleClick = function handleClick(cellPos, viewOnly) {
2614
+ if (viewOnly === void 0) {
2615
+ viewOnly = false;
2616
+ }
2614
2617
  clearMarkedCells();
2615
2618
  clearArrows();
2619
+ if (viewOnly) return;
2616
2620
  if (clickedPos[0] === -1) {
2617
2621
  selectClickFrom(cellPos);
2618
2622
  return;
@@ -2973,7 +2977,9 @@ var ChessBoard = function ChessBoard(props) {
2973
2977
  boardConfig: boardConfig
2974
2978
  }), React__default.createElement(ChessBoardControlLayout, {
2975
2979
  boardConfig: boardConfig,
2976
- onClick: handleClick,
2980
+ onClick: function onClick(pos) {
2981
+ return handleClick(pos, viewOnly);
2982
+ },
2977
2983
  onGrabStart: viewOnly ? function () {} : selectHoverFrom,
2978
2984
  onGrabStartRight: startRenderArrow,
2979
2985
  onGrabEnd: viewOnly ? function () {} : handleGrabEnd,