= (props) => {
hidden: null,
})}
{addonAfter && {addonAfter}}
+ {allowCopy ? CopyIcon : null}
);
}
- return element;
+ return (
+ <>
+ {CopyIcon ? (
+
+ {element}
+ {allowCopy ? CopyIcon : null}
+
+ ) : (
+ element
+ )}
+ >
+ );
};
export default BaseInput;
diff --git a/src/DefaultCopyIcon.tsx b/src/DefaultCopyIcon.tsx
new file mode 100644
index 0000000..e515acf
--- /dev/null
+++ b/src/DefaultCopyIcon.tsx
@@ -0,0 +1,22 @@
+import type { ReactNode } from 'react';
+import React from 'react';
+
+const DefaultCopyIcon: ReactNode = (
+
+
+
+);
+
+export default DefaultCopyIcon;
diff --git a/src/interface.ts b/src/interface.ts
index 3727420..b71e50e 100644
--- a/src/interface.ts
+++ b/src/interface.ts
@@ -10,6 +10,11 @@ import type { InputFocusOptions } from './utils/commonUtils';
import type { LiteralUnion } from './utils/types';
export interface CommonInputProps {
+ allowCopy?: ReactNode | boolean;
+ copyCallback?: (
+ v: InputHTMLAttributes['value'],
+ ele: ReactElement>,
+ ) => void;
prefix?: ReactNode;
suffix?: ReactNode;
addonBefore?: ReactNode;