@addsign/moje-agenda-shared-lib 1.0.12 → 1.0.14

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.
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useEffect } from "react";
2
+ import { useState, useEffect } from "react";
3
3
  import { F as FaRegTrashAlt } from "../index-DH-TC1O6.js";
4
4
  import { G as GenIcon } from "../iconBase-B8_TsgYI.js";
5
5
  import Button from "./Button.js";
@@ -14,6 +14,7 @@ function ConfirmationModalDialog({
14
14
  agreeeText,
15
15
  cancelText
16
16
  }) {
17
+ const [isConfirming, setIsConfirming] = useState(false);
17
18
  useEffect(() => {
18
19
  const handleKeyDown = (event) => {
19
20
  if (event.key === "Escape") {
@@ -90,7 +91,13 @@ function ConfirmationModalDialog({
90
91
  {
91
92
  type: "button",
92
93
  variant: "danger",
93
- onClick: confirmAction,
94
+ onClick: () => {
95
+ if (!isConfirming) {
96
+ setIsConfirming(true);
97
+ confirmAction();
98
+ }
99
+ },
100
+ disabled: isConfirming,
94
101
  className: "flex-1",
95
102
  children: [
96
103
  agreeeText || "OK",