@chtc/web-components 1.0.4 → 1.0.6
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,8 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { IconButtonProps } from "@mui/material";
|
|
2
|
-
type ConfirmButtonProps = IconButtonProps
|
|
3
|
-
|
|
3
|
+
type ConfirmButtonProps = IconButtonProps & {
|
|
4
|
+
onConfirm?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const ConfirmButton: ({ onConfirm, ...props }: ConfirmButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
7
|
export default ConfirmButton;
|
|
5
8
|
//# sourceMappingURL=ConfirmButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmButton.d.ts","sourceRoot":"","sources":["../../src/ConfirmButton/ConfirmButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConfirmButton.d.ts","sourceRoot":"","sources":["../../src/ConfirmButton/ConfirmButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAA0B,eAAe,EAAW,MAAM,eAAe,CAAC;AAEjF,KAAK,kBAAkB,GAAI,eAAe,GAAG;IAC5C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;CAC7E,CAAA;AAED,QAAA,MAAM,aAAa,GAAI,yBAAuB,kBAAkB,4CA4D/D,CAAA;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -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 } from "@mui/material";
|
|
4
|
-
const ConfirmButton = ({ ...props }) => {
|
|
4
|
+
const ConfirmButton = ({ onConfirm, ...props }) => {
|
|
5
5
|
const [askingForConfirmation, setAskingForConfirmation] = useState(false);
|
|
6
6
|
const [growDirection, setGrowDirection] = useState('right');
|
|
7
7
|
const iconButtonRef = useRef(null);
|
|
@@ -31,12 +31,13 @@ const ConfirmButton = ({ ...props }) => {
|
|
|
31
31
|
borderRadius: 1,
|
|
32
32
|
...(askingForConfirmation ?
|
|
33
33
|
{ borderColor: props === null || props === void 0 ? void 0 : props.color, borderWidth: 1 } : {})
|
|
34
|
-
}, children: [_jsx(IconButton, { ...props, ref: iconButtonRef, onClick: () =>
|
|
34
|
+
}, children: [_jsx(IconButton, { ...props, ref: iconButtonRef, onClick: (e) => {
|
|
35
|
+
setAskingForConfirmation(!askingForConfirmation);
|
|
36
|
+
if (props.onClick)
|
|
37
|
+
props.onClick(e);
|
|
38
|
+
} }), _jsx(Box, { sx: growDirection === 'right'
|
|
35
39
|
? { position: 'absolute', top: 0, left: '100%' }
|
|
36
|
-
: { position: 'absolute', top: 0, right: '100%' }, children: _jsx(Collapse, { in: askingForConfirmation, orientation: 'horizontal', children: _jsx(Button, { variant: 'contained', color: (props === null || props === void 0 ? void 0 : props.color) == 'default' ? 'primary' : props === null || props === void 0 ? void 0 : props.color, size: props === null || props === void 0 ? void 0 : props.size, onClick:
|
|
37
|
-
(props === null || props === void 0 ? void 0 : props.onClick) && props.onClick(e);
|
|
38
|
-
setAskingForConfirmation(false);
|
|
39
|
-
}, ref: confirmButtonRef, children: "Confirm" }) }) })] }));
|
|
40
|
+
: { position: 'absolute', top: 0, right: '100%' }, children: _jsx(Collapse, { in: askingForConfirmation, orientation: 'horizontal', children: _jsx(Button, { variant: 'contained', color: (props === null || props === void 0 ? void 0 : props.color) == 'default' ? 'primary' : props === null || props === void 0 ? void 0 : props.color, size: props === null || props === void 0 ? void 0 : props.size, onClick: onConfirm, ref: confirmButtonRef, children: "Confirm" }) }) })] }));
|
|
40
41
|
};
|
|
41
42
|
export default ConfirmButton;
|
|
42
43
|
//# sourceMappingURL=ConfirmButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmButton.js","sourceRoot":"","sources":["../../src/ConfirmButton/ConfirmButton.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAmB,QAAQ,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfirmButton.js","sourceRoot":"","sources":["../../src/ConfirmButton/ConfirmButton.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAmB,QAAQ,EAAC,MAAM,eAAe,CAAC;AAMjF,MAAM,aAAa,GAAG,CAAC,EAAC,SAAS,EAAE,GAAG,KAAK,EAAqB,EAAE,EAAE;IACnE,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1E,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAmB,OAAO,CAAC,CAAC;IAC9E,MAAM,aAAa,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IACtD,MAAM,gBAAgB,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAEzD,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,qBAAqB,IAAI,aAAa,CAAC,OAAO,IAAI,gBAAgB,CAAC,OAAO,EAAE,CAAC;YAChF,MAAM,QAAQ,GAAG,aAAa,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;YAC/D,MAAM,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;YACrE,MAA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G,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,YAGlD,KAAC,QAAQ,IAAC,EAAE,EAAE,qBAAqB,EAAE,WAAW,EAAE,YAAY,YAC7D,KAAC,MAAM,IACN,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,KAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,EAC3D,IAAI,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,EACjB,OAAO,EAAE,SAAS,EAClB,GAAG,EAAE,gBAAgB,wBAGb,GACC,GACN,IACD,CACN,CAAA;AACF,CAAC,CAAA;AAED,eAAe,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chtc/web-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
|
+
"homepage": "https://path-cc.io/web-components/",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/path-cc/web-components.git"
|
|
8
|
+
},
|
|
4
9
|
"description": "CHTC Web Components",
|
|
5
10
|
"main": "index.js",
|
|
6
11
|
"types": "index.d.ts",
|