@chtc/web-components 1.0.8 → 1.0.9
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.
|
@@ -3,9 +3,9 @@ import { IconButtonProps } from "@mui/material";
|
|
|
3
3
|
import { Theme } from "@mui/material/styles";
|
|
4
4
|
export type ConfirmButtonProps = IconButtonProps & {
|
|
5
5
|
color: keyof Theme['palette'];
|
|
6
|
-
|
|
6
|
+
confirmNode?: ReactNode;
|
|
7
7
|
onConfirm?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
8
8
|
};
|
|
9
|
-
declare const ConfirmButton: ({ onConfirm,
|
|
9
|
+
declare const ConfirmButton: ({ onConfirm, confirmNode, ...props }: ConfirmButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default ConfirmButton;
|
|
11
11
|
//# sourceMappingURL=ConfirmButton.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useEffect } from "react";
|
|
3
3
|
import { Box, Button, IconButton, Collapse, useTheme } from "@mui/material";
|
|
4
|
-
const ConfirmButton = ({ onConfirm,
|
|
4
|
+
const ConfirmButton = ({ onConfirm, confirmNode = 'Confirm', ...props }) => {
|
|
5
5
|
const theme = useTheme();
|
|
6
6
|
const [askingForConfirmation, setAskingForConfirmation] = useState(false);
|
|
7
7
|
const [growDirection, setGrowDirection] = useState('right');
|
|
@@ -49,7 +49,7 @@ const ConfirmButton = ({ onConfirm, confirmText = 'Confirm', ...props }) => {
|
|
|
49
49
|
...(growDirection === 'right'
|
|
50
50
|
? { order: 2 }
|
|
51
51
|
: { order: 1 }),
|
|
52
|
-
}, children: _jsx(Collapse, { in: askingForConfirmation, orientation: 'horizontal', children: _jsx(Button, { variant: 'contained', color: props === null || props === void 0 ? void 0 : props.color, size: props === null || props === void 0 ? void 0 : props.size, onClick: onConfirm, ref: confirmButtonRef, children:
|
|
52
|
+
}, children: _jsx(Collapse, { in: askingForConfirmation, orientation: 'horizontal', children: _jsx(Button, { variant: 'contained', color: props === null || props === void 0 ? void 0 : props.color, size: props === null || props === void 0 ? void 0 : props.size, onClick: onConfirm, ref: confirmButtonRef, children: confirmNode }) }) })] }) }) }));
|
|
53
53
|
};
|
|
54
54
|
export default ConfirmButton;
|
|
55
55
|
//# sourceMappingURL=ConfirmButton.js.map
|