@undefine-ui/design-system 2.10.1 → 2.12.0
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/README.md +69 -7
- package/dist/index.cjs +379 -93
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +125 -2
- package/dist/index.d.ts +125 -2
- package/dist/index.js +370 -88
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -622,6 +622,82 @@ var useSetState = (initialState) => {
|
|
|
622
622
|
return memoizedValue;
|
|
623
623
|
};
|
|
624
624
|
|
|
625
|
+
// src/hooks/useCountdown.tsx
|
|
626
|
+
import { useRef, useState as useState6, useEffect as useEffect2, useCallback as useCallback6 } from "react";
|
|
627
|
+
var useCountdownDate = (date) => {
|
|
628
|
+
const targetTime = typeof date === "number" ? date : typeof date === "string" ? new Date(date).valueOf() : date.valueOf();
|
|
629
|
+
const [countdown, setCountdown] = useState6({
|
|
630
|
+
days: "00",
|
|
631
|
+
hours: "00",
|
|
632
|
+
minutes: "00",
|
|
633
|
+
seconds: "00"
|
|
634
|
+
});
|
|
635
|
+
const setNewTime = useCallback6(() => {
|
|
636
|
+
const now = Date.now();
|
|
637
|
+
const distanceToNow = targetTime - now;
|
|
638
|
+
if (distanceToNow <= 0) {
|
|
639
|
+
setCountdown({
|
|
640
|
+
days: "00",
|
|
641
|
+
hours: "00",
|
|
642
|
+
minutes: "00",
|
|
643
|
+
seconds: "00"
|
|
644
|
+
});
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
const getDays = Math.floor(distanceToNow / (1e3 * 60 * 60 * 24));
|
|
648
|
+
const getHours = `0${Math.floor(distanceToNow % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60))}`.slice(-2);
|
|
649
|
+
const getMinutes = `0${Math.floor(distanceToNow % (1e3 * 60 * 60) / (1e3 * 60))}`.slice(-2);
|
|
650
|
+
const getSeconds = `0${Math.floor(distanceToNow % (1e3 * 60) / 1e3)}`.slice(-2);
|
|
651
|
+
setCountdown({
|
|
652
|
+
days: getDays < 10 ? `0${getDays}` : `${getDays}`,
|
|
653
|
+
hours: getHours,
|
|
654
|
+
minutes: getMinutes,
|
|
655
|
+
seconds: getSeconds
|
|
656
|
+
});
|
|
657
|
+
}, [targetTime]);
|
|
658
|
+
useEffect2(() => {
|
|
659
|
+
setNewTime();
|
|
660
|
+
const interval = setInterval(setNewTime, 1e3);
|
|
661
|
+
return () => clearInterval(interval);
|
|
662
|
+
}, [setNewTime]);
|
|
663
|
+
return countdown;
|
|
664
|
+
};
|
|
665
|
+
var useCountdownSeconds = (initCountdown) => {
|
|
666
|
+
const [countdown, setCountdown] = useState6(initCountdown);
|
|
667
|
+
const intervalIdRef = useRef(null);
|
|
668
|
+
const remainingSecondsRef = useRef(initCountdown);
|
|
669
|
+
const startCountdown = useCallback6(() => {
|
|
670
|
+
if (intervalIdRef.current) {
|
|
671
|
+
clearInterval(intervalIdRef.current);
|
|
672
|
+
}
|
|
673
|
+
remainingSecondsRef.current = initCountdown;
|
|
674
|
+
setCountdown(initCountdown);
|
|
675
|
+
intervalIdRef.current = setInterval(() => {
|
|
676
|
+
remainingSecondsRef.current -= 1;
|
|
677
|
+
if (remainingSecondsRef.current <= 0) {
|
|
678
|
+
if (intervalIdRef.current) clearInterval(intervalIdRef.current);
|
|
679
|
+
setCountdown(0);
|
|
680
|
+
} else {
|
|
681
|
+
setCountdown(remainingSecondsRef.current);
|
|
682
|
+
}
|
|
683
|
+
}, 1e3);
|
|
684
|
+
}, [initCountdown]);
|
|
685
|
+
useEffect2(() => {
|
|
686
|
+
return () => {
|
|
687
|
+
if (intervalIdRef.current) {
|
|
688
|
+
clearInterval(intervalIdRef.current);
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
}, []);
|
|
692
|
+
const counting = countdown > 0 && countdown < initCountdown;
|
|
693
|
+
return {
|
|
694
|
+
counting,
|
|
695
|
+
countdown,
|
|
696
|
+
startCountdown,
|
|
697
|
+
setCountdown
|
|
698
|
+
};
|
|
699
|
+
};
|
|
700
|
+
|
|
625
701
|
// src/hooks/useResponsive.ts
|
|
626
702
|
import { useMemo as useMemo5 } from "react";
|
|
627
703
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
@@ -656,19 +732,19 @@ var useWidth = () => {
|
|
|
656
732
|
};
|
|
657
733
|
|
|
658
734
|
// src/hooks/useEventListener.ts
|
|
659
|
-
import { useRef, useEffect as
|
|
660
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect :
|
|
735
|
+
import { useRef as useRef2, useEffect as useEffect3, useLayoutEffect } from "react";
|
|
736
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect3;
|
|
661
737
|
var useEventListener = ({
|
|
662
738
|
eventName,
|
|
663
739
|
handler,
|
|
664
740
|
element,
|
|
665
741
|
options
|
|
666
742
|
}) => {
|
|
667
|
-
const savedHandler =
|
|
743
|
+
const savedHandler = useRef2(handler);
|
|
668
744
|
useIsomorphicLayoutEffect(() => {
|
|
669
745
|
savedHandler.current = handler;
|
|
670
746
|
}, [handler]);
|
|
671
|
-
|
|
747
|
+
useEffect3(() => {
|
|
672
748
|
const targetElement = element?.current || window;
|
|
673
749
|
if (!(targetElement && targetElement.addEventListener)) {
|
|
674
750
|
return;
|
|
@@ -682,11 +758,11 @@ var useEventListener = ({
|
|
|
682
758
|
};
|
|
683
759
|
|
|
684
760
|
// src/hooks/useCopyToClipboard.ts
|
|
685
|
-
import { useMemo as useMemo6, useState as
|
|
761
|
+
import { useMemo as useMemo6, useState as useState7, useCallback as useCallback7 } from "react";
|
|
686
762
|
var useCopyToClipboard = () => {
|
|
687
|
-
const [copiedText, setCopiedText] =
|
|
688
|
-
const [isCopied, setIsCopied] =
|
|
689
|
-
const copy =
|
|
763
|
+
const [copiedText, setCopiedText] = useState7("");
|
|
764
|
+
const [isCopied, setIsCopied] = useState7(false);
|
|
765
|
+
const copy = useCallback7(
|
|
690
766
|
async (text2) => {
|
|
691
767
|
if (!navigator?.clipboard) {
|
|
692
768
|
console.warn("Clipboard not supported");
|
|
@@ -714,11 +790,11 @@ var useCopyToClipboard = () => {
|
|
|
714
790
|
};
|
|
715
791
|
|
|
716
792
|
// src/hooks/useScrollOffsetTop.ts
|
|
717
|
-
import { useRef as
|
|
793
|
+
import { useRef as useRef3, useMemo as useMemo7, useState as useState8, useEffect as useEffect4, useCallback as useCallback8 } from "react";
|
|
718
794
|
var useScrollOffSetTop = (top = 0) => {
|
|
719
|
-
const elementRef =
|
|
720
|
-
const [offsetTop, setOffsetTop] =
|
|
721
|
-
const handleScrollChange =
|
|
795
|
+
const elementRef = useRef3(null);
|
|
796
|
+
const [offsetTop, setOffsetTop] = useState8(false);
|
|
797
|
+
const handleScrollChange = useCallback8(() => {
|
|
722
798
|
const scrollHeight = Math.round(window.scrollY);
|
|
723
799
|
if (elementRef?.current) {
|
|
724
800
|
const rect = elementRef.current.getBoundingClientRect();
|
|
@@ -728,7 +804,7 @@ var useScrollOffSetTop = (top = 0) => {
|
|
|
728
804
|
setOffsetTop(scrollHeight > top);
|
|
729
805
|
}
|
|
730
806
|
}, [top]);
|
|
731
|
-
|
|
807
|
+
useEffect4(() => {
|
|
732
808
|
handleScrollChange();
|
|
733
809
|
window.addEventListener("scroll", handleScrollChange, { passive: true });
|
|
734
810
|
return () => {
|
|
@@ -4348,7 +4424,7 @@ var MuiTextField = {
|
|
|
4348
4424
|
lineHeight: 1.153,
|
|
4349
4425
|
position: "relative",
|
|
4350
4426
|
fontSize: theme.typography.h8.fontSize,
|
|
4351
|
-
fontWeight: theme.typography.fontWeightMedium
|
|
4427
|
+
fontWeight: `${theme.typography.fontWeightMedium} !important`,
|
|
4352
4428
|
marginBottom: theme.spacing(1),
|
|
4353
4429
|
color: `${theme.vars.palette.icon.black} !important`,
|
|
4354
4430
|
// Focused state
|
|
@@ -6187,7 +6263,7 @@ var UploadProgress = ({ progress: progress2 = 20 }) => {
|
|
|
6187
6263
|
};
|
|
6188
6264
|
|
|
6189
6265
|
// src/components/Upload/components/MultiFilePreview.tsx
|
|
6190
|
-
import { useRef as
|
|
6266
|
+
import { useRef as useRef4 } from "react";
|
|
6191
6267
|
import Box9 from "@mui/material/Box";
|
|
6192
6268
|
import IconButton2 from "@mui/material/IconButton";
|
|
6193
6269
|
|
|
@@ -6255,7 +6331,7 @@ var DeleteButton = ({ sx, ...rest }) => {
|
|
|
6255
6331
|
// src/components/Upload/components/MultiFilePreview.tsx
|
|
6256
6332
|
import { jsx as jsx48, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6257
6333
|
var MultiFilePreview = ({ files, onRemove }) => {
|
|
6258
|
-
const scrollRef =
|
|
6334
|
+
const scrollRef = useRef4(null);
|
|
6259
6335
|
const handleScroll = (direction) => {
|
|
6260
6336
|
if (scrollRef.current) {
|
|
6261
6337
|
const scrollAmount = 300;
|
|
@@ -6706,22 +6782,223 @@ var RHFUpload = ({ name, multiple, helperText, ...rest }) => {
|
|
|
6706
6782
|
);
|
|
6707
6783
|
};
|
|
6708
6784
|
|
|
6709
|
-
// src/components/HookForm/
|
|
6785
|
+
// src/components/HookForm/RHFOTPInput.tsx
|
|
6710
6786
|
import { Controller as Controller3, useFormContext as useFormContext3 } from "react-hook-form";
|
|
6787
|
+
|
|
6788
|
+
// src/components/OTPInput/index.tsx
|
|
6789
|
+
import { useRef as useRef5, useState as useState9 } from "react";
|
|
6790
|
+
import { useTheme as useTheme2 } from "@mui/material/styles";
|
|
6791
|
+
import Box13 from "@mui/material/Box";
|
|
6792
|
+
import FormHelperText3 from "@mui/material/FormHelperText";
|
|
6793
|
+
import { inputBaseClasses as inputBaseClasses3 } from "@mui/material/InputBase";
|
|
6794
|
+
import TextField from "@mui/material/TextField";
|
|
6795
|
+
import { Fragment, jsx as jsx53, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6796
|
+
var OTPInput = (props) => {
|
|
6797
|
+
const { length = 6, onChange, onComplete, error: error2, helperText, containerProps, ...rest } = props;
|
|
6798
|
+
const theme = useTheme2();
|
|
6799
|
+
const [otp, setOtp] = useState9(Array(length).fill(""));
|
|
6800
|
+
const inputsRef = useRef5([]);
|
|
6801
|
+
const handleChange = (value, index) => {
|
|
6802
|
+
if (!/^[0-9]$/.test(value) && value !== "") return;
|
|
6803
|
+
const newOtp = [...otp];
|
|
6804
|
+
newOtp[index] = value;
|
|
6805
|
+
setOtp(newOtp);
|
|
6806
|
+
onChange?.(newOtp.join(""));
|
|
6807
|
+
if (value && index < length - 1) {
|
|
6808
|
+
inputsRef.current[index + 1]?.focus();
|
|
6809
|
+
}
|
|
6810
|
+
if (newOtp.every((val) => val !== "")) {
|
|
6811
|
+
onComplete?.(newOtp.join(""));
|
|
6812
|
+
}
|
|
6813
|
+
};
|
|
6814
|
+
const handleKeyDown = (event, index) => {
|
|
6815
|
+
if (event.key === "Backspace") {
|
|
6816
|
+
if (otp[index] === "") {
|
|
6817
|
+
if (index > 0) {
|
|
6818
|
+
inputsRef.current[index - 1]?.focus();
|
|
6819
|
+
setOtp((prevOtp) => {
|
|
6820
|
+
const newOtp = [...prevOtp];
|
|
6821
|
+
newOtp[index - 1] = "";
|
|
6822
|
+
return newOtp;
|
|
6823
|
+
});
|
|
6824
|
+
}
|
|
6825
|
+
} else {
|
|
6826
|
+
setOtp((prevOtp) => {
|
|
6827
|
+
const newOtp = [...prevOtp];
|
|
6828
|
+
newOtp[index] = "";
|
|
6829
|
+
return newOtp;
|
|
6830
|
+
});
|
|
6831
|
+
}
|
|
6832
|
+
} else if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
|
|
6833
|
+
if (index > 0) {
|
|
6834
|
+
inputsRef.current[index - 1]?.focus();
|
|
6835
|
+
}
|
|
6836
|
+
} else if (event.key === "ArrowRight" || event.key === "ArrowDown") {
|
|
6837
|
+
if (index < length - 1) {
|
|
6838
|
+
inputsRef.current[index + 1]?.focus();
|
|
6839
|
+
}
|
|
6840
|
+
}
|
|
6841
|
+
};
|
|
6842
|
+
const handlePaste = (event) => {
|
|
6843
|
+
event.preventDefault();
|
|
6844
|
+
const pasteData = event.clipboardData.getData("text");
|
|
6845
|
+
if (!/^\d+$/.test(pasteData)) return;
|
|
6846
|
+
const newOtp = [...otp];
|
|
6847
|
+
for (let i = 0; i < length; i++) {
|
|
6848
|
+
if (pasteData[i]) {
|
|
6849
|
+
newOtp[i] = pasteData[i];
|
|
6850
|
+
} else {
|
|
6851
|
+
newOtp[i] = "";
|
|
6852
|
+
}
|
|
6853
|
+
}
|
|
6854
|
+
setOtp(newOtp);
|
|
6855
|
+
onChange?.(newOtp.join(""));
|
|
6856
|
+
const filled = newOtp.filter((otp2) => otp2 !== "");
|
|
6857
|
+
inputsRef.current[filled.length]?.focus();
|
|
6858
|
+
if (newOtp.every((val) => val !== "")) {
|
|
6859
|
+
inputsRef.current[filled.length - 1]?.focus();
|
|
6860
|
+
onComplete?.(newOtp.join(""));
|
|
6861
|
+
}
|
|
6862
|
+
};
|
|
6863
|
+
return /* @__PURE__ */ jsxs30(Fragment, { children: [
|
|
6864
|
+
/* @__PURE__ */ jsx53(Box13, { display: "flex", justifyContent: "center", ...containerProps, children: otp.map((_, index) => /* @__PURE__ */ jsx53(
|
|
6865
|
+
Box13,
|
|
6866
|
+
{
|
|
6867
|
+
display: "flex",
|
|
6868
|
+
alignItems: "center",
|
|
6869
|
+
sx: {
|
|
6870
|
+
"&:not(:last-of-type)": {
|
|
6871
|
+
mr: 1.5
|
|
6872
|
+
}
|
|
6873
|
+
},
|
|
6874
|
+
children: /* @__PURE__ */ jsx53(
|
|
6875
|
+
TextField,
|
|
6876
|
+
{
|
|
6877
|
+
size: "medium",
|
|
6878
|
+
value: otp[index],
|
|
6879
|
+
onChange: (e) => handleChange(e.target.value, index),
|
|
6880
|
+
onKeyDown: (e) => handleKeyDown(e, index),
|
|
6881
|
+
onPaste: handlePaste,
|
|
6882
|
+
inputRef: (el) => inputsRef.current[index] = el,
|
|
6883
|
+
error: error2,
|
|
6884
|
+
slotProps: {
|
|
6885
|
+
htmlInput: {
|
|
6886
|
+
maxLength: 1,
|
|
6887
|
+
inputMode: "numeric",
|
|
6888
|
+
autoComplete: "one-time-code"
|
|
6889
|
+
}
|
|
6890
|
+
},
|
|
6891
|
+
sx: {
|
|
6892
|
+
[`& .${inputBaseClasses3.root}`]: {
|
|
6893
|
+
borderRadius: theme.radius["radius-lg"],
|
|
6894
|
+
backgroundColor: "transparent",
|
|
6895
|
+
border: `1px solid ${theme.vars.palette.border.default}`,
|
|
6896
|
+
transition: theme.transitions.create(
|
|
6897
|
+
["background-color", "border-color", "box-shadow"],
|
|
6898
|
+
{
|
|
6899
|
+
duration: theme.transitions.duration.short
|
|
6900
|
+
}
|
|
6901
|
+
),
|
|
6902
|
+
// Remove default underline
|
|
6903
|
+
"&::before, &::after": {
|
|
6904
|
+
display: "none"
|
|
6905
|
+
},
|
|
6906
|
+
// Hover state
|
|
6907
|
+
"&:hover": {
|
|
6908
|
+
backgroundColor: "transparent",
|
|
6909
|
+
borderColor: theme.vars.palette.border.default
|
|
6910
|
+
},
|
|
6911
|
+
// Focus state
|
|
6912
|
+
[`&.${inputBaseClasses3.focused}`]: {
|
|
6913
|
+
backgroundColor: theme.vars.palette.common.white,
|
|
6914
|
+
border: `1px solid ${theme.vars.palette.border.default}`,
|
|
6915
|
+
boxShadow: `0 0 0 2px ${varAlpha(theme.vars.palette.primary["300Channel"], 1)}`
|
|
6916
|
+
},
|
|
6917
|
+
// Error state
|
|
6918
|
+
[`&.${inputBaseClasses3.error}`]: {
|
|
6919
|
+
backgroundColor: theme.vars.palette.error[100],
|
|
6920
|
+
borderColor: theme.vars.palette.error[300],
|
|
6921
|
+
"&:hover": {
|
|
6922
|
+
backgroundColor: theme.vars.palette.error[100],
|
|
6923
|
+
borderColor: theme.vars.palette.error[300]
|
|
6924
|
+
},
|
|
6925
|
+
[`&.${inputBaseClasses3.focused}`]: {
|
|
6926
|
+
backgroundColor: theme.vars.palette.error[100],
|
|
6927
|
+
border: `1px solid ${theme.vars.palette.border.default}`,
|
|
6928
|
+
boxShadow: `0 0 0 2px ${varAlpha(theme.vars.palette.error["300Channel"], 1)}`
|
|
6929
|
+
}
|
|
6930
|
+
},
|
|
6931
|
+
// Disabled state
|
|
6932
|
+
[`&.${inputBaseClasses3.disabled}`]: {
|
|
6933
|
+
backgroundColor: theme.vars.palette.surface.disable,
|
|
6934
|
+
borderColor: theme.vars.palette.surface.disable,
|
|
6935
|
+
color: theme.vars.palette.text.disabled,
|
|
6936
|
+
"&:hover": {
|
|
6937
|
+
backgroundColor: theme.vars.palette.surface.disable,
|
|
6938
|
+
borderColor: theme.vars.palette.surface.disable
|
|
6939
|
+
}
|
|
6940
|
+
}
|
|
6941
|
+
},
|
|
6942
|
+
"& .MuiFilledInput-input": {
|
|
6943
|
+
padding: "0px !important",
|
|
6944
|
+
borderRadius: theme.radius["radius-lg"],
|
|
6945
|
+
fontWeight: 600,
|
|
6946
|
+
width: { xs: 44 },
|
|
6947
|
+
height: { xs: 44 },
|
|
6948
|
+
textAlign: "center"
|
|
6949
|
+
},
|
|
6950
|
+
...rest.sx
|
|
6951
|
+
}
|
|
6952
|
+
}
|
|
6953
|
+
)
|
|
6954
|
+
},
|
|
6955
|
+
index
|
|
6956
|
+
)) }),
|
|
6957
|
+
error2 && /* @__PURE__ */ jsx53(FormHelperText3, { sx: { color: "error.main" }, children: helperText })
|
|
6958
|
+
] });
|
|
6959
|
+
};
|
|
6960
|
+
var OTPInput_default = OTPInput;
|
|
6961
|
+
|
|
6962
|
+
// src/components/HookForm/RHFOTPInput.tsx
|
|
6963
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
6964
|
+
var RHFOTPInput = ({ name, length = 6, helperText, ...rest }) => {
|
|
6965
|
+
const { control, setValue } = useFormContext3();
|
|
6966
|
+
return /* @__PURE__ */ jsx54(
|
|
6967
|
+
Controller3,
|
|
6968
|
+
{
|
|
6969
|
+
name,
|
|
6970
|
+
control,
|
|
6971
|
+
render: ({ field, fieldState: { error: error2 } }) => /* @__PURE__ */ jsx54(
|
|
6972
|
+
OTPInput_default,
|
|
6973
|
+
{
|
|
6974
|
+
length,
|
|
6975
|
+
onChange: field.onChange,
|
|
6976
|
+
onComplete: (otp) => setValue(name, otp),
|
|
6977
|
+
error: Boolean(error2),
|
|
6978
|
+
helperText: error2?.message ?? helperText,
|
|
6979
|
+
...rest
|
|
6980
|
+
}
|
|
6981
|
+
)
|
|
6982
|
+
}
|
|
6983
|
+
);
|
|
6984
|
+
};
|
|
6985
|
+
|
|
6986
|
+
// src/components/HookForm/RHFTextField.tsx
|
|
6987
|
+
import { Controller as Controller4, useFormContext as useFormContext4 } from "react-hook-form";
|
|
6711
6988
|
import IconButton3 from "@mui/material/IconButton";
|
|
6712
6989
|
import InputAdornment from "@mui/material/InputAdornment";
|
|
6713
|
-
import
|
|
6714
|
-
import { jsx as
|
|
6990
|
+
import TextField2 from "@mui/material/TextField";
|
|
6991
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
6715
6992
|
var RHFTextField = ({ name, helperText, type, slotProps, ...rest }) => {
|
|
6716
|
-
const { control } =
|
|
6993
|
+
const { control } = useFormContext4();
|
|
6717
6994
|
const passwordVisibility = useBoolean();
|
|
6718
|
-
return /* @__PURE__ */
|
|
6719
|
-
|
|
6995
|
+
return /* @__PURE__ */ jsx55(
|
|
6996
|
+
Controller4,
|
|
6720
6997
|
{
|
|
6721
6998
|
name,
|
|
6722
6999
|
control,
|
|
6723
|
-
render: ({ field, fieldState: { error: error2 } }) => /* @__PURE__ */
|
|
6724
|
-
|
|
7000
|
+
render: ({ field, fieldState: { error: error2 } }) => /* @__PURE__ */ jsx55(
|
|
7001
|
+
TextField2,
|
|
6725
7002
|
{
|
|
6726
7003
|
...field,
|
|
6727
7004
|
fullWidth: true,
|
|
@@ -6741,7 +7018,7 @@ var RHFTextField = ({ name, helperText, type, slotProps, ...rest }) => {
|
|
|
6741
7018
|
input: {
|
|
6742
7019
|
...slotProps?.input,
|
|
6743
7020
|
...type === "password" && {
|
|
6744
|
-
endAdornment: /* @__PURE__ */
|
|
7021
|
+
endAdornment: /* @__PURE__ */ jsx55(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx55(IconButton3, { edge: "end", onClick: passwordVisibility.onToggle, children: /* @__PURE__ */ jsx55(
|
|
6745
7022
|
Icon,
|
|
6746
7023
|
{
|
|
6747
7024
|
icon: passwordVisibility.value ? "EyeClosed" : "Eye",
|
|
@@ -6759,7 +7036,7 @@ var RHFTextField = ({ name, helperText, type, slotProps, ...rest }) => {
|
|
|
6759
7036
|
};
|
|
6760
7037
|
|
|
6761
7038
|
// src/components/HookForm/RHFRadioGroup.tsx
|
|
6762
|
-
import { Controller as
|
|
7039
|
+
import { Controller as Controller5, useFormContext as useFormContext5 } from "react-hook-form";
|
|
6763
7040
|
import Stack5 from "@mui/material/Stack";
|
|
6764
7041
|
import Typography4 from "@mui/material/Typography";
|
|
6765
7042
|
import Radio from "@mui/material/Radio";
|
|
@@ -6767,8 +7044,8 @@ import FormControlLabel2 from "@mui/material/FormControlLabel";
|
|
|
6767
7044
|
import FormLabel2 from "@mui/material/FormLabel";
|
|
6768
7045
|
import RadioGroup from "@mui/material/RadioGroup";
|
|
6769
7046
|
import FormControl2 from "@mui/material/FormControl";
|
|
6770
|
-
import
|
|
6771
|
-
import { jsx as
|
|
7047
|
+
import FormHelperText4 from "@mui/material/FormHelperText";
|
|
7048
|
+
import { jsx as jsx56, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
6772
7049
|
var RHFRadioGroup = ({
|
|
6773
7050
|
name,
|
|
6774
7051
|
label,
|
|
@@ -6777,16 +7054,16 @@ var RHFRadioGroup = ({
|
|
|
6777
7054
|
slotProps,
|
|
6778
7055
|
...other
|
|
6779
7056
|
}) => {
|
|
6780
|
-
const { control } =
|
|
7057
|
+
const { control } = useFormContext5();
|
|
6781
7058
|
const labelledby = `${name}-radio-buttons-group-label`;
|
|
6782
7059
|
const ariaLabel = (val) => `Radio ${val}`;
|
|
6783
|
-
return /* @__PURE__ */
|
|
6784
|
-
|
|
7060
|
+
return /* @__PURE__ */ jsx56(
|
|
7061
|
+
Controller5,
|
|
6785
7062
|
{
|
|
6786
7063
|
name,
|
|
6787
7064
|
control,
|
|
6788
|
-
render: ({ field, fieldState: { error: error2 } }) => /* @__PURE__ */
|
|
6789
|
-
label && /* @__PURE__ */
|
|
7065
|
+
render: ({ field, fieldState: { error: error2 } }) => /* @__PURE__ */ jsxs31(FormControl2, { component: "fieldset", sx: slotProps?.wrap, children: [
|
|
7066
|
+
label && /* @__PURE__ */ jsx56(
|
|
6790
7067
|
FormLabel2,
|
|
6791
7068
|
{
|
|
6792
7069
|
id: labelledby,
|
|
@@ -6796,11 +7073,11 @@ var RHFRadioGroup = ({
|
|
|
6796
7073
|
children: label
|
|
6797
7074
|
}
|
|
6798
7075
|
),
|
|
6799
|
-
/* @__PURE__ */
|
|
7076
|
+
/* @__PURE__ */ jsx56(RadioGroup, { ...field, "aria-labelledby": labelledby, ...other, children: options.map((option) => /* @__PURE__ */ jsx56(
|
|
6800
7077
|
FormControlLabel2,
|
|
6801
7078
|
{
|
|
6802
7079
|
value: option.value,
|
|
6803
|
-
control: /* @__PURE__ */
|
|
7080
|
+
control: /* @__PURE__ */ jsx56(
|
|
6804
7081
|
Radio,
|
|
6805
7082
|
{
|
|
6806
7083
|
...slotProps?.radio,
|
|
@@ -6812,9 +7089,9 @@ var RHFRadioGroup = ({
|
|
|
6812
7089
|
}
|
|
6813
7090
|
}
|
|
6814
7091
|
),
|
|
6815
|
-
label: /* @__PURE__ */
|
|
6816
|
-
/* @__PURE__ */
|
|
6817
|
-
option?.description && /* @__PURE__ */
|
|
7092
|
+
label: /* @__PURE__ */ jsxs31(Stack5, { children: [
|
|
7093
|
+
/* @__PURE__ */ jsx56(Typography4, { variant: "bodyMd", color: "textHeader", fontWeight: 500, children: option.label }),
|
|
7094
|
+
option?.description && /* @__PURE__ */ jsx56(Typography4, { variant: "body2", color: "textBody", children: option?.description })
|
|
6818
7095
|
] }),
|
|
6819
7096
|
sx: {
|
|
6820
7097
|
alignItems: option?.description ? "flex-start" : "center"
|
|
@@ -6822,17 +7099,17 @@ var RHFRadioGroup = ({
|
|
|
6822
7099
|
},
|
|
6823
7100
|
option.value
|
|
6824
7101
|
)) }),
|
|
6825
|
-
(!!error2 || helperText) && /* @__PURE__ */
|
|
7102
|
+
(!!error2 || helperText) && /* @__PURE__ */ jsx56(FormHelperText4, { error: !!error2, sx: { mx: 0 }, ...slotProps?.formHelperText, children: error2 ? error2?.message : helperText })
|
|
6826
7103
|
] })
|
|
6827
7104
|
}
|
|
6828
7105
|
);
|
|
6829
7106
|
};
|
|
6830
7107
|
|
|
6831
7108
|
// src/components/HookForm/RHFAutocomplete.tsx
|
|
6832
|
-
import { Controller as
|
|
6833
|
-
import
|
|
7109
|
+
import { Controller as Controller6, useFormContext as useFormContext6 } from "react-hook-form";
|
|
7110
|
+
import TextField3 from "@mui/material/TextField";
|
|
6834
7111
|
import Autocomplete from "@mui/material/Autocomplete";
|
|
6835
|
-
import { jsx as
|
|
7112
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
6836
7113
|
var RHFAutocomplete = ({
|
|
6837
7114
|
name,
|
|
6838
7115
|
label,
|
|
@@ -6842,13 +7119,13 @@ var RHFAutocomplete = ({
|
|
|
6842
7119
|
handleChange,
|
|
6843
7120
|
...other
|
|
6844
7121
|
}) => {
|
|
6845
|
-
const { control, setValue } =
|
|
6846
|
-
return /* @__PURE__ */
|
|
6847
|
-
|
|
7122
|
+
const { control, setValue } = useFormContext6();
|
|
7123
|
+
return /* @__PURE__ */ jsx57(
|
|
7124
|
+
Controller6,
|
|
6848
7125
|
{
|
|
6849
7126
|
name,
|
|
6850
7127
|
control,
|
|
6851
|
-
render: ({ field, fieldState: { error: error2 } }) => /* @__PURE__ */
|
|
7128
|
+
render: ({ field, fieldState: { error: error2 } }) => /* @__PURE__ */ jsx57(
|
|
6852
7129
|
Autocomplete,
|
|
6853
7130
|
{
|
|
6854
7131
|
...field,
|
|
@@ -6857,8 +7134,8 @@ var RHFAutocomplete = ({
|
|
|
6857
7134
|
setValue(name, newValue, { shouldValidate: true });
|
|
6858
7135
|
handleChange?.(newValue);
|
|
6859
7136
|
},
|
|
6860
|
-
renderInput: (params) => /* @__PURE__ */
|
|
6861
|
-
|
|
7137
|
+
renderInput: (params) => /* @__PURE__ */ jsx57(
|
|
7138
|
+
TextField3,
|
|
6862
7139
|
{
|
|
6863
7140
|
label,
|
|
6864
7141
|
placeholder,
|
|
@@ -6876,17 +7153,17 @@ var RHFAutocomplete = ({
|
|
|
6876
7153
|
};
|
|
6877
7154
|
|
|
6878
7155
|
// src/components/HookForm/RHFCheckbox.tsx
|
|
6879
|
-
import { Controller as
|
|
7156
|
+
import { Controller as Controller7, useFormContext as useFormContext7 } from "react-hook-form";
|
|
6880
7157
|
import Stack6 from "@mui/material/Stack";
|
|
6881
|
-
import
|
|
7158
|
+
import Box14 from "@mui/material/Box";
|
|
6882
7159
|
import Typography5 from "@mui/material/Typography";
|
|
6883
7160
|
import Checkbox from "@mui/material/Checkbox";
|
|
6884
7161
|
import FormGroup2 from "@mui/material/FormGroup";
|
|
6885
7162
|
import FormLabel3 from "@mui/material/FormLabel";
|
|
6886
7163
|
import FormControl3 from "@mui/material/FormControl";
|
|
6887
|
-
import
|
|
7164
|
+
import FormHelperText5 from "@mui/material/FormHelperText";
|
|
6888
7165
|
import FormControlLabel3 from "@mui/material/FormControlLabel";
|
|
6889
|
-
import { jsx as
|
|
7166
|
+
import { jsx as jsx58, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
6890
7167
|
var RHFCheckbox = ({
|
|
6891
7168
|
name,
|
|
6892
7169
|
description,
|
|
@@ -6896,18 +7173,18 @@ var RHFCheckbox = ({
|
|
|
6896
7173
|
slotProps,
|
|
6897
7174
|
...other
|
|
6898
7175
|
}) => {
|
|
6899
|
-
const { control } =
|
|
7176
|
+
const { control } = useFormContext7();
|
|
6900
7177
|
const baseAriaLabel = `Checkbox for ${name}`;
|
|
6901
|
-
return /* @__PURE__ */
|
|
6902
|
-
|
|
7178
|
+
return /* @__PURE__ */ jsx58(
|
|
7179
|
+
Controller7,
|
|
6903
7180
|
{
|
|
6904
7181
|
name,
|
|
6905
7182
|
control,
|
|
6906
|
-
render: ({ field, fieldState: { error: error2 } }) => /* @__PURE__ */
|
|
6907
|
-
/* @__PURE__ */
|
|
7183
|
+
render: ({ field, fieldState: { error: error2 } }) => /* @__PURE__ */ jsxs32(Box14, { sx: slotProps?.wrap, children: [
|
|
7184
|
+
/* @__PURE__ */ jsx58(
|
|
6908
7185
|
FormControlLabel3,
|
|
6909
7186
|
{
|
|
6910
|
-
control: /* @__PURE__ */
|
|
7187
|
+
control: /* @__PURE__ */ jsx58(
|
|
6911
7188
|
Checkbox,
|
|
6912
7189
|
{
|
|
6913
7190
|
...field,
|
|
@@ -6922,9 +7199,9 @@ var RHFCheckbox = ({
|
|
|
6922
7199
|
}
|
|
6923
7200
|
}
|
|
6924
7201
|
),
|
|
6925
|
-
label: /* @__PURE__ */
|
|
6926
|
-
/* @__PURE__ */
|
|
6927
|
-
description && /* @__PURE__ */
|
|
7202
|
+
label: /* @__PURE__ */ jsxs32(Stack6, { children: [
|
|
7203
|
+
/* @__PURE__ */ jsx58(Typography5, { variant: "bodyMd", color: "textHeader", fontWeight: 500, children: label }),
|
|
7204
|
+
description && /* @__PURE__ */ jsx58(Typography5, { variant: "body2", color: "textBody", children: description })
|
|
6928
7205
|
] }),
|
|
6929
7206
|
sx: {
|
|
6930
7207
|
alignItems: description ? "flex-start" : "center",
|
|
@@ -6933,7 +7210,7 @@ var RHFCheckbox = ({
|
|
|
6933
7210
|
...other
|
|
6934
7211
|
}
|
|
6935
7212
|
),
|
|
6936
|
-
(!!error2 || helperText) && /* @__PURE__ */
|
|
7213
|
+
(!!error2 || helperText) && /* @__PURE__ */ jsx58(FormHelperText5, { error: !!error2, ...slotProps?.formHelperText, children: error2 ? error2?.message : helperText })
|
|
6937
7214
|
] })
|
|
6938
7215
|
}
|
|
6939
7216
|
);
|
|
@@ -6947,15 +7224,15 @@ var RHFMultiCheckbox = ({
|
|
|
6947
7224
|
row,
|
|
6948
7225
|
...other
|
|
6949
7226
|
}) => {
|
|
6950
|
-
const { control } =
|
|
7227
|
+
const { control } = useFormContext7();
|
|
6951
7228
|
const getSelected = (currentValues, optionValue) => currentValues.includes(optionValue) ? currentValues.filter((value) => value !== optionValue) : [...currentValues, optionValue];
|
|
6952
|
-
return /* @__PURE__ */
|
|
6953
|
-
|
|
7229
|
+
return /* @__PURE__ */ jsx58(
|
|
7230
|
+
Controller7,
|
|
6954
7231
|
{
|
|
6955
7232
|
name,
|
|
6956
7233
|
control,
|
|
6957
7234
|
defaultValue: [],
|
|
6958
|
-
render: ({ field, fieldState: { error: error2 } }) => /* @__PURE__ */
|
|
7235
|
+
render: ({ field, fieldState: { error: error2 } }) => /* @__PURE__ */ jsxs32(
|
|
6959
7236
|
FormControl3,
|
|
6960
7237
|
{
|
|
6961
7238
|
component: "fieldset",
|
|
@@ -6963,7 +7240,7 @@ var RHFMultiCheckbox = ({
|
|
|
6963
7240
|
sx: slotProps?.formControl?.sx,
|
|
6964
7241
|
...slotProps?.formControl,
|
|
6965
7242
|
children: [
|
|
6966
|
-
label && /* @__PURE__ */
|
|
7243
|
+
label && /* @__PURE__ */ jsx58(
|
|
6967
7244
|
FormLabel3,
|
|
6968
7245
|
{
|
|
6969
7246
|
component: "legend",
|
|
@@ -6972,12 +7249,12 @@ var RHFMultiCheckbox = ({
|
|
|
6972
7249
|
children: label
|
|
6973
7250
|
}
|
|
6974
7251
|
),
|
|
6975
|
-
/* @__PURE__ */
|
|
7252
|
+
/* @__PURE__ */ jsx58(FormGroup2, { row, ...other, children: options.map((option) => {
|
|
6976
7253
|
const itemAriaLabel = option.label || `Option ${option.value}`;
|
|
6977
|
-
return /* @__PURE__ */
|
|
7254
|
+
return /* @__PURE__ */ jsx58(
|
|
6978
7255
|
FormControlLabel3,
|
|
6979
7256
|
{
|
|
6980
|
-
control: /* @__PURE__ */
|
|
7257
|
+
control: /* @__PURE__ */ jsx58(
|
|
6981
7258
|
Checkbox,
|
|
6982
7259
|
{
|
|
6983
7260
|
checked: (field.value || []).includes(option.value),
|
|
@@ -6995,9 +7272,9 @@ var RHFMultiCheckbox = ({
|
|
|
6995
7272
|
}
|
|
6996
7273
|
}
|
|
6997
7274
|
),
|
|
6998
|
-
label: /* @__PURE__ */
|
|
6999
|
-
/* @__PURE__ */
|
|
7000
|
-
option?.description && /* @__PURE__ */
|
|
7275
|
+
label: /* @__PURE__ */ jsxs32(Stack6, { children: [
|
|
7276
|
+
/* @__PURE__ */ jsx58(Typography5, { variant: "bodyMd", color: "textHeader", fontWeight: 500, children: option.label }),
|
|
7277
|
+
option?.description && /* @__PURE__ */ jsx58(Typography5, { variant: "body2", color: "textBody", children: option?.description })
|
|
7001
7278
|
] }),
|
|
7002
7279
|
sx: {
|
|
7003
7280
|
alignItems: option?.description ? "flex-start" : "center"
|
|
@@ -7006,8 +7283,8 @@ var RHFMultiCheckbox = ({
|
|
|
7006
7283
|
option.value
|
|
7007
7284
|
);
|
|
7008
7285
|
}) }),
|
|
7009
|
-
(!!error2 || helperText) && /* @__PURE__ */
|
|
7010
|
-
|
|
7286
|
+
(!!error2 || helperText) && /* @__PURE__ */ jsx58(
|
|
7287
|
+
FormHelperText5,
|
|
7011
7288
|
{
|
|
7012
7289
|
sx: { mx: 0, ...slotProps?.formHelperText?.sx },
|
|
7013
7290
|
...slotProps?.formHelperText,
|
|
@@ -7023,6 +7300,7 @@ var RHFMultiCheckbox = ({
|
|
|
7023
7300
|
|
|
7024
7301
|
// src/components/HookForm/fields.ts
|
|
7025
7302
|
var Field = {
|
|
7303
|
+
OTP: RHFOTPInput,
|
|
7026
7304
|
Switch: RHFSwitch,
|
|
7027
7305
|
Upload: RHFUpload,
|
|
7028
7306
|
Text: RHFTextField,
|
|
@@ -7035,29 +7313,29 @@ var Field = {
|
|
|
7035
7313
|
// src/components/CopyButton/index.tsx
|
|
7036
7314
|
import Tooltip from "@mui/material/Tooltip";
|
|
7037
7315
|
import IconButton4 from "@mui/material/IconButton";
|
|
7038
|
-
import { jsx as
|
|
7316
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
7039
7317
|
var CopyButton = ({ text: text2, size = "small" }) => {
|
|
7040
7318
|
const { copy, isCopied } = useCopyToClipboard();
|
|
7041
|
-
return /* @__PURE__ */
|
|
7319
|
+
return /* @__PURE__ */ jsx59(Tooltip, { title: isCopied ? "Copied" : "Copy", children: /* @__PURE__ */ jsx59(
|
|
7042
7320
|
IconButton4,
|
|
7043
7321
|
{
|
|
7044
7322
|
size,
|
|
7045
7323
|
onClick: () => copy(text2),
|
|
7046
7324
|
"aria-label": "copy token",
|
|
7047
7325
|
sx: { color: "icon.black" },
|
|
7048
|
-
children: /* @__PURE__ */
|
|
7326
|
+
children: /* @__PURE__ */ jsx59(Icon, { icon: isCopied ? "ClipboardCheck" : "Copy", sx: { width: 20, height: 20 } })
|
|
7049
7327
|
}
|
|
7050
7328
|
) });
|
|
7051
7329
|
};
|
|
7052
7330
|
|
|
7053
7331
|
// src/components/LoadingScreen/index.tsx
|
|
7054
7332
|
import Portal from "@mui/material/Portal";
|
|
7055
|
-
import
|
|
7333
|
+
import Box15 from "@mui/material/Box";
|
|
7056
7334
|
import LinearProgress from "@mui/material/LinearProgress";
|
|
7057
|
-
import { jsx as
|
|
7335
|
+
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
7058
7336
|
var LoadingScreen = ({ portal, sx, ...rest }) => {
|
|
7059
|
-
const content = /* @__PURE__ */
|
|
7060
|
-
|
|
7337
|
+
const content = /* @__PURE__ */ jsx60(
|
|
7338
|
+
Box15,
|
|
7061
7339
|
{
|
|
7062
7340
|
sx: {
|
|
7063
7341
|
px: 5,
|
|
@@ -7070,17 +7348,17 @@ var LoadingScreen = ({ portal, sx, ...rest }) => {
|
|
|
7070
7348
|
...sx
|
|
7071
7349
|
},
|
|
7072
7350
|
...rest,
|
|
7073
|
-
children: /* @__PURE__ */
|
|
7351
|
+
children: /* @__PURE__ */ jsx60(LinearProgress, { color: "primary", sx: { width: 1, maxWidth: 360 } })
|
|
7074
7352
|
}
|
|
7075
7353
|
);
|
|
7076
7354
|
if (portal) {
|
|
7077
|
-
return /* @__PURE__ */
|
|
7355
|
+
return /* @__PURE__ */ jsx60(Portal, { children: content });
|
|
7078
7356
|
}
|
|
7079
7357
|
return content;
|
|
7080
7358
|
};
|
|
7081
7359
|
var SplashScreen = ({ portal, sx, ...rest }) => {
|
|
7082
|
-
const content = /* @__PURE__ */
|
|
7083
|
-
|
|
7360
|
+
const content = /* @__PURE__ */ jsx60(
|
|
7361
|
+
Box15,
|
|
7084
7362
|
{
|
|
7085
7363
|
sx: {
|
|
7086
7364
|
right: 0,
|
|
@@ -7096,11 +7374,11 @@ var SplashScreen = ({ portal, sx, ...rest }) => {
|
|
|
7096
7374
|
...sx
|
|
7097
7375
|
},
|
|
7098
7376
|
...rest,
|
|
7099
|
-
children: /* @__PURE__ */
|
|
7377
|
+
children: /* @__PURE__ */ jsx60(AnimatedLogo, {})
|
|
7100
7378
|
}
|
|
7101
7379
|
);
|
|
7102
7380
|
if (portal) {
|
|
7103
|
-
return /* @__PURE__ */
|
|
7381
|
+
return /* @__PURE__ */ jsx60(Portal, { children: content });
|
|
7104
7382
|
}
|
|
7105
7383
|
return content;
|
|
7106
7384
|
};
|
|
@@ -7131,10 +7409,12 @@ export {
|
|
|
7131
7409
|
NavArrowDown,
|
|
7132
7410
|
NavArrowLeft,
|
|
7133
7411
|
NavArrowRight,
|
|
7412
|
+
OTPInput,
|
|
7134
7413
|
RHFAutocomplete,
|
|
7135
7414
|
RHFCheckbox,
|
|
7136
7415
|
RHFMultiCheckbox,
|
|
7137
7416
|
RHFMultiSwitch,
|
|
7417
|
+
RHFOTPInput,
|
|
7138
7418
|
RHFRadioGroup,
|
|
7139
7419
|
RHFSwitch,
|
|
7140
7420
|
RHFTextField,
|
|
@@ -7230,6 +7510,8 @@ export {
|
|
|
7230
7510
|
updateCoreWithSettings,
|
|
7231
7511
|
useBoolean,
|
|
7232
7512
|
useCopyToClipboard,
|
|
7513
|
+
useCountdownDate,
|
|
7514
|
+
useCountdownSeconds,
|
|
7233
7515
|
useEventListener,
|
|
7234
7516
|
useLocalStorage,
|
|
7235
7517
|
usePopover,
|