@tap-payments/os-micro-frontend-shared 0.0.13 → 0.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.
- package/build/components/OTPInput/OTPInput.d.ts +10 -0
- package/build/components/OTPInput/OTPInput.js +32 -0
- package/build/components/OTPInput/index.d.ts +2 -0
- package/build/components/OTPInput/index.js +2 -0
- package/build/components/OTPInput/style.d.ts +23 -0
- package/build/components/OTPInput/style.js +29 -0
- package/package.json +2 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { OtpInputProps } from 'react18-input-otp';
|
|
3
|
+
interface OTPInputProps extends Omit<OtpInputProps, 'numInputs' | 'onChange'> {
|
|
4
|
+
numInputs?: number;
|
|
5
|
+
onChange?: (otp: string) => void;
|
|
6
|
+
onSubmitOtp?: (otp: string) => void;
|
|
7
|
+
}
|
|
8
|
+
declare function OTPInput({ numInputs, separateAfter, isInputSecure, isInputNum, onSubmitOtp, ...props }: OTPInputProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const _default: import("react").MemoExoticComponent<typeof OTPInput>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { useState, memo } from 'react';
|
|
14
|
+
import Box from '@mui/material/Box';
|
|
15
|
+
import OtpInput from 'react18-input-otp';
|
|
16
|
+
import { inputFocusStyle, inputStyle, inputErrorStyle, Separator } from './style';
|
|
17
|
+
function OTPInput(_a) {
|
|
18
|
+
var { numInputs = 6, separateAfter = 3, isInputSecure = true, isInputNum = true, onSubmitOtp } = _a, props = __rest(_a, ["numInputs", "separateAfter", "isInputSecure", "isInputNum", "onSubmitOtp"]);
|
|
19
|
+
const [otp, setOtp] = useState('');
|
|
20
|
+
const handleChange = (enteredOtp) => {
|
|
21
|
+
setOtp(enteredOtp);
|
|
22
|
+
if (enteredOtp.length === numInputs) {
|
|
23
|
+
onSubmitOtp === null || onSubmitOtp === void 0 ? void 0 : onSubmitOtp(enteredOtp);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return (_jsx(Box, Object.assign({ sx: {
|
|
27
|
+
'::selection': {
|
|
28
|
+
background: 'transparent',
|
|
29
|
+
},
|
|
30
|
+
} }, { children: _jsx(OtpInput, Object.assign({ inputStyle: Object.assign(Object.assign({}, inputStyle), props.inputProps), focusStyle: inputFocusStyle, errorStyle: inputErrorStyle, value: otp, separator: _jsx(Separator, { children: "-" }), isInputNum: isInputNum, isInputSecure: isInputSecure, numInputs: numInputs, separateAfter: separateAfter, shouldAutoFocus: true, onChange: handleChange }, props)) })));
|
|
31
|
+
}
|
|
32
|
+
export default memo(OTPInput);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const inputStyle: {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
borderRadius: string;
|
|
6
|
+
fontSize: string;
|
|
7
|
+
border: string;
|
|
8
|
+
caretColor: string;
|
|
9
|
+
outline: string;
|
|
10
|
+
margin: string;
|
|
11
|
+
userSelect: string;
|
|
12
|
+
color: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const inputFocusStyle: {
|
|
15
|
+
boxShadow: string;
|
|
16
|
+
border: string;
|
|
17
|
+
userSelect: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const inputErrorStyle: {
|
|
20
|
+
border: string;
|
|
21
|
+
boxShadow: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const Separator: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { styled } from '@mui/material/styles';
|
|
2
|
+
export const inputStyle = {
|
|
3
|
+
width: 45,
|
|
4
|
+
height: 48,
|
|
5
|
+
borderRadius: '8px',
|
|
6
|
+
fontSize: '45px',
|
|
7
|
+
border: `1px solid #f2f2f2`,
|
|
8
|
+
caretColor: 'transparent',
|
|
9
|
+
outline: 'none',
|
|
10
|
+
margin: '0 4px',
|
|
11
|
+
userSelect: 'none !important',
|
|
12
|
+
color: '#20232B',
|
|
13
|
+
};
|
|
14
|
+
export const inputFocusStyle = {
|
|
15
|
+
boxShadow: '0px 0px 8px 0px #00000026',
|
|
16
|
+
border: '1px solid #1F88D0',
|
|
17
|
+
userSelect: 'none !important',
|
|
18
|
+
};
|
|
19
|
+
export const inputErrorStyle = {
|
|
20
|
+
border: '0.9px solid #FF3D00',
|
|
21
|
+
boxShadow: '0px 0px 3.59px 0px #00000040',
|
|
22
|
+
};
|
|
23
|
+
export const Separator = styled('span')(() => ({
|
|
24
|
+
marginInline: '5.25px',
|
|
25
|
+
fontWeight: 500,
|
|
26
|
+
fontSize: '14px',
|
|
27
|
+
lineHeight: '24px',
|
|
28
|
+
color: '#20232B',
|
|
29
|
+
}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
3
|
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.14",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|
|
7
7
|
"module": "build/index.js",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"react-virtualized-auto-sizer": "^1.0.20",
|
|
54
54
|
"react-window": "^1.8.9",
|
|
55
55
|
"react-window-infinite-loader": "^1.0.9",
|
|
56
|
+
"react18-input-otp": "^1.1.4",
|
|
56
57
|
"recharts": "^2.15.1"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|