@yosgo/swap-ui 1.0.120 → 1.0.121
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/DatePicker/DatePicker.types.d.ts +1 -0
- package/build/Modal/Modal.types.d.ts +0 -1
- package/build/index.esm.js +38 -31
- package/build/index.esm.js.map +1 -1
- package/build/index.js +38 -31
- package/build/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -46,5 +46,4 @@ export interface ModalProps {
|
|
|
46
46
|
icon?: React.ReactNode;
|
|
47
47
|
checkIconColor?: "primary" | "secondary" | "tertiary" | "primary50" | "primary100" | "primary200" | "primary300" | "primary400" | "primary500" | "primary600" | "primary700" | "primary800" | "primary900" | "primaryA11y" | "secondary50" | "secondary100" | "secondary200" | "secondary300" | "secondary400" | "secondary500" | "secondary600" | "secondary700" | "secondary800" | "secondary900" | "secondaryA11y" | "danger50" | "danger100" | "danger200" | "danger300" | "danger400" | "danger500" | "danger600" | "danger700" | "danger800" | "danger900" | "dangerA11y" | "success50" | "success100" | "success200" | "success300" | "success400" | "success500" | "success600" | "success700" | "success800" | "success900" | "successA11y" | "white" | "black100" | "black200" | "black300" | "black400" | "black500" | "black600" | "black700" | "black800" | "black900" | "black1000";
|
|
48
48
|
iconColor?: "primary" | "secondary" | "tertiary" | "primary50" | "primary100" | "primary200" | "primary300" | "primary400" | "primary500" | "primary600" | "primary700" | "primary800" | "primary900" | "primaryA11y" | "secondary50" | "secondary100" | "secondary200" | "secondary300" | "secondary400" | "secondary500" | "secondary600" | "secondary700" | "secondary800" | "secondary900" | "secondaryA11y" | "danger50" | "danger100" | "danger200" | "danger300" | "danger400" | "danger500" | "danger600" | "danger700" | "danger800" | "danger900" | "dangerA11y" | "success50" | "success100" | "success200" | "success300" | "success400" | "success500" | "success600" | "success700" | "success800" | "success900" | "successA11y" | "white" | "black100" | "black200" | "black300" | "black400" | "black500" | "black600" | "black700" | "black800" | "black900" | "black1000";
|
|
49
|
-
isFreshchatOpen?: boolean;
|
|
50
49
|
}
|
package/build/index.esm.js
CHANGED
|
@@ -6666,7 +6666,7 @@ var ModalTransitionEffect = React__default.forwardRef(function ModalTransitionEf
|
|
|
6666
6666
|
return (React__default.createElement(React__default.Fragment, null, slide ? (React__default.createElement(Slide, { in: open, direction: "up", mountOnEnter: true, unmountOnExit: true, timeout: { enter: 300, exit: 300 } }, children)) : (React__default.createElement(animated.div, __assign({ style: __assign(__assign({}, style), defaultStyle) }, other), children))));
|
|
6667
6667
|
});
|
|
6668
6668
|
var Modal = React__default.forwardRef(function (props, ref) {
|
|
6669
|
-
var width = props.width, height = props.height, open = props.open, onClose = props.onClose, title = props.title, helpText = props.helpText, size = props.size, headpadding = props.headpadding, headChildren = props.headChildren, checked = props.checked, failed = props.failed, icon = props.icon, checkIconColor = props.checkIconColor, iconColor = props.iconColor, children = props.children, label = props.label, buttonFullWidth = props.buttonFullWidth, footerDisplayColumn = props.footerDisplayColumn, secondaryButton = props.secondaryButton, primaryButton = props.primaryButton, mobile = props.mobile, fullWidth = props.fullWidth, bodyPadding = props.bodyPadding, maxWidth = props.maxWidth, disCloseIcon = props.disCloseIcon, titleStyle = props.titleStyle, bodyStyle = props.bodyStyle, onExit = props.onExit, bodyMaxHeight = props.bodyMaxHeight, multiline = props.multiline, disUnderLine = props.disUnderLine, footer = props.footer
|
|
6669
|
+
var width = props.width, height = props.height, open = props.open, onClose = props.onClose, title = props.title, helpText = props.helpText, size = props.size, headpadding = props.headpadding, headChildren = props.headChildren, checked = props.checked, failed = props.failed, icon = props.icon, checkIconColor = props.checkIconColor, iconColor = props.iconColor, children = props.children, label = props.label, buttonFullWidth = props.buttonFullWidth, footerDisplayColumn = props.footerDisplayColumn, secondaryButton = props.secondaryButton, primaryButton = props.primaryButton, mobile = props.mobile, fullWidth = props.fullWidth, bodyPadding = props.bodyPadding, maxWidth = props.maxWidth, disCloseIcon = props.disCloseIcon, titleStyle = props.titleStyle, bodyStyle = props.bodyStyle, onExit = props.onExit, bodyMaxHeight = props.bodyMaxHeight, multiline = props.multiline, disUnderLine = props.disUnderLine, footer = props.footer;
|
|
6670
6670
|
var _a = useState(0), clientHeight = _a[0], setClientHeight = _a[1];
|
|
6671
6671
|
var _b = useState(0), scorllbarWidth = _b[0], setScorllbarWidth = _b[1];
|
|
6672
6672
|
useEffect(function () {
|
|
@@ -6689,14 +6689,6 @@ var Modal = React__default.forwardRef(function (props, ref) {
|
|
|
6689
6689
|
var scrollbar_width = window.innerWidth - document.body.clientWidth;
|
|
6690
6690
|
setScorllbarWidth(scrollbar_width / 2);
|
|
6691
6691
|
}, []);
|
|
6692
|
-
useEffect(function () {
|
|
6693
|
-
if (!isFreshchatOpen) {
|
|
6694
|
-
var elem = document.getElementById("fc_frame");
|
|
6695
|
-
if (elem) {
|
|
6696
|
-
elem.style["display"] = open ? "none" : "block";
|
|
6697
|
-
}
|
|
6698
|
-
}
|
|
6699
|
-
}, [open]);
|
|
6700
6692
|
var match_XS = useBreakpoints("xs");
|
|
6701
6693
|
var useStyles = makeStyles$1(function (theme) { return ({
|
|
6702
6694
|
root: {
|
|
@@ -7048,7 +7040,10 @@ var Modal = React__default.forwardRef(function (props, ref) {
|
|
|
7048
7040
|
},
|
|
7049
7041
|
}); });
|
|
7050
7042
|
var classes = useStyles();
|
|
7051
|
-
return (React__default.createElement(MaterialModal, { open: open, className: classes.root, BackdropComponent: Backdrop, BackdropProps: {
|
|
7043
|
+
return (React__default.createElement(MaterialModal, { open: open, className: classes.root, BackdropComponent: Backdrop, BackdropProps: {
|
|
7044
|
+
className: classes.backdrop,
|
|
7045
|
+
style: { overflow: "auto", WebkitOverflowScrolling: "touch" },
|
|
7046
|
+
}, style: { overflow: "auto", WebkitOverflowScrolling: "touch" } },
|
|
7052
7047
|
React__default.createElement(ModalTransitionEffect, { in: open, slide: fullWidth, style: {
|
|
7053
7048
|
outline: "none",
|
|
7054
7049
|
transition: "ease-in-out",
|
|
@@ -7229,7 +7224,7 @@ var useStyles$b = makeStyles$1(function () { return ({
|
|
|
7229
7224
|
height: props.height,
|
|
7230
7225
|
display: "flex",
|
|
7231
7226
|
alignItems: "center",
|
|
7232
|
-
justifyContent: "
|
|
7227
|
+
justifyContent: "center",
|
|
7233
7228
|
}); },
|
|
7234
7229
|
}); });
|
|
7235
7230
|
var Chip = function (props) {
|
|
@@ -7248,7 +7243,7 @@ var Chip = function (props) {
|
|
|
7248
7243
|
? theme.danger.danger50
|
|
7249
7244
|
: theme.primary.primary50,
|
|
7250
7245
|
width: width ? width : "fit-content",
|
|
7251
|
-
height: height ? height :
|
|
7246
|
+
height: height ? height : 24,
|
|
7252
7247
|
border: outlined || !contained
|
|
7253
7248
|
? variant === "neutral"
|
|
7254
7249
|
? "1px solid " + theme.black.black500
|
|
@@ -7260,7 +7255,7 @@ var Chip = function (props) {
|
|
|
7260
7255
|
? "1px solid " + theme.danger.danger800
|
|
7261
7256
|
: "1px solid " + theme.primary.primary800
|
|
7262
7257
|
: null,
|
|
7263
|
-
padding: outlined || !contained ? "
|
|
7258
|
+
padding: outlined || !contained ? "0px 8px" : "0px 9px",
|
|
7264
7259
|
};
|
|
7265
7260
|
var classes = useStyles$b(styleProps);
|
|
7266
7261
|
return (React__default.createElement("div", __assign({ className: classes.root }, other),
|
|
@@ -7272,9 +7267,11 @@ var Chip = function (props) {
|
|
|
7272
7267
|
? "success800"
|
|
7273
7268
|
: variant === "danger"
|
|
7274
7269
|
? "danger800"
|
|
7275
|
-
: "primary800", style: { marginRight:
|
|
7276
|
-
icon));
|
|
7277
|
-
};
|
|
7270
|
+
: "primary800", style: { marginRight: variant === "success" ? 4 : 0 } }, label),
|
|
7271
|
+
variant === "success" && !icon ? icon_success : icon));
|
|
7272
|
+
};
|
|
7273
|
+
var icon_success = (React__default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
7274
|
+
React__default.createElement("path", { d: "M14 4.66666L6 12.6667L2.33333 9L3.27333 8.06L6 10.78L13.06 3.72666L14 4.66666Z", fill: "#00821E" })));
|
|
7278
7275
|
|
|
7279
7276
|
var CircularProgress = function (props) {
|
|
7280
7277
|
var theme = useTheme$1();
|
|
@@ -12716,7 +12713,7 @@ var useStylesForCalendar = makeStyles$1(function (theme) { return ({
|
|
|
12716
12713
|
},
|
|
12717
12714
|
}); });
|
|
12718
12715
|
var DatePicker = function (props) {
|
|
12719
|
-
var open = props.open, onClose = props.onClose, format = props.format, mobile = props.mobile, min = props.min, max = props.max, ModalProps = props.ModalProps, defaultValue = props.defaultValue, getValue = props.getValue, other = __rest(props, ["open", "onClose", "format", "mobile", "min", "max", "ModalProps", "defaultValue", "getValue"]);
|
|
12716
|
+
var open = props.open, onClose = props.onClose, format = props.format, mobile = props.mobile, min = props.min, max = props.max, ModalProps = props.ModalProps, defaultValue = props.defaultValue, getValue = props.getValue, value = props.value, other = __rest(props, ["open", "onClose", "format", "mobile", "min", "max", "ModalProps", "defaultValue", "getValue", "value"]);
|
|
12720
12717
|
var _a = useState(Number(new Date().getFullYear())), year = _a[0], setYear = _a[1];
|
|
12721
12718
|
var _b = useState(Number(new Date().getMonth() + 1)), month = _b[0], setMonth = _b[1];
|
|
12722
12719
|
var _c = useState(1), nextMonth = _c[0], setNextMonth = _c[1];
|
|
@@ -12754,7 +12751,7 @@ var DatePicker = function (props) {
|
|
|
12754
12751
|
}
|
|
12755
12752
|
}
|
|
12756
12753
|
else if (format === "day") {
|
|
12757
|
-
getValue(date);
|
|
12754
|
+
getValue(date.replace(/\//g, "-"));
|
|
12758
12755
|
}
|
|
12759
12756
|
else {
|
|
12760
12757
|
getValue(String(year));
|
|
@@ -12762,6 +12759,11 @@ var DatePicker = function (props) {
|
|
|
12762
12759
|
setIsClicked(false);
|
|
12763
12760
|
}
|
|
12764
12761
|
}, [isClicked]);
|
|
12762
|
+
useEffect(function () {
|
|
12763
|
+
if (value) {
|
|
12764
|
+
setDate(changeDateFormatToSlash(value));
|
|
12765
|
+
}
|
|
12766
|
+
}, [value]);
|
|
12765
12767
|
return (React__default.createElement("div", __assign({}, other), format !== "day" ? (React__default.createElement("div", { style: {
|
|
12766
12768
|
borderRadius: 8,
|
|
12767
12769
|
border: "1px solid #cccccc",
|
|
@@ -12877,11 +12879,11 @@ var DatePicker = function (props) {
|
|
|
12877
12879
|
} }, Array.from(Array(6).keys()).map(function (_i, i) { return (React__default.createElement(MonthButton, { key: i, index: i, month: month, setMonth: setMonth, setIsOpenMonthSelector: setIsOpenMonthSelector, setIsClicked: setIsClicked })); }))))) : null)) : (React__default.createElement(Modal, __assign({ bodyPadding: mobile ? 16 : undefined, fullWidth: mobile, open: open, onClose: onClose, size: mobile ? undefined : "medium", label: !mobile ? (React__default.createElement(Typography, { variant: "h6" },
|
|
12878
12880
|
React__default.createElement("span", { style: { fontWeight: 400 } }, "\u5DF2\u9078\u64C7\uFF1A"),
|
|
12879
12881
|
date &&
|
|
12880
|
-
date.split("
|
|
12882
|
+
date.split("/")[0] + "\u5E74" + date.split("/")[1] + "\u6708" + date.split("/")[2] + "\u65E5")) : (React__default.createElement(React__default.Fragment, null,
|
|
12881
12883
|
React__default.createElement(Typography, { variant: "caption2" },
|
|
12882
12884
|
React__default.createElement("span", { style: { fontWeight: 400 } }, "\u5DF2\u9078\u64C7\uFF1A")),
|
|
12883
12885
|
React__default.createElement(Typography, { variant: "subtitle" }, date &&
|
|
12884
|
-
date.split("
|
|
12886
|
+
date.split("/")[0] + "\u5E74" + date.split("/")[1] + "\u6708" + date.split("/")[2] + "\u65E5"))), primaryButton: {
|
|
12885
12887
|
title: "確認",
|
|
12886
12888
|
onClick: function () {
|
|
12887
12889
|
onClose();
|
|
@@ -12955,14 +12957,16 @@ var MonthButton = function (_a) {
|
|
|
12955
12957
|
var Calendar = function (_a) {
|
|
12956
12958
|
var year = _a.year, month = _a.month, setDate = _a.setDate, date = _a.date, min = _a.min, max = _a.max, leftClick = _a.leftClick, rightClick = _a.rightClick, position = _a.position, defaultValue = _a.defaultValue, setIsClicked = _a.setIsClicked, mobile = _a.mobile;
|
|
12957
12959
|
var isBigMonth = (month <= 7 && month % 2 !== 0) || (month >= 8 && month % 2 === 0);
|
|
12958
|
-
var today = defaultValue
|
|
12959
|
-
|
|
12960
|
-
|
|
12961
|
-
var
|
|
12962
|
-
var
|
|
12963
|
-
var
|
|
12964
|
-
var
|
|
12965
|
-
var
|
|
12960
|
+
var today = defaultValue
|
|
12961
|
+
? new Date(changeDateFormatToSlash(defaultValue))
|
|
12962
|
+
: new Date();
|
|
12963
|
+
var selectedYear = Number(date.split("/")[0]);
|
|
12964
|
+
var selectedMonth = Number(date.split("/")[1]);
|
|
12965
|
+
var selectedDate = Number(date.split("/")[2]);
|
|
12966
|
+
var msOfMin = min ? new Date(changeDateFormatToSlash(min)).getTime() : 0;
|
|
12967
|
+
var msOfMax = max ? new Date(changeDateFormatToSlash(max)).getTime() : 0;
|
|
12968
|
+
var msOfFirstDayOfMonth = new Date(year + "/" + month + "/1").getTime();
|
|
12969
|
+
var msOfLastDayOfMonth = new Date(year + "/" + month + "/" + (month === 2 ? (year % 4 === 0 ? 29 : 28) : isBigMonth ? 31 : 30)).getTime();
|
|
12966
12970
|
var arrowDisabled = (msOfMin !== 0 && position === "left" && msOfFirstDayOfMonth <= msOfMin) ||
|
|
12967
12971
|
(msOfMax !== 0 && position === "right" && msOfLastDayOfMonth >= msOfMax);
|
|
12968
12972
|
var mobileLeftArrowDisabled = msOfMin !== 0 && msOfFirstDayOfMonth <= msOfMin;
|
|
@@ -13015,11 +13019,11 @@ var Calendar = function (_a) {
|
|
|
13015
13019
|
var isToday = year === today.getFullYear() &&
|
|
13016
13020
|
month === today.getMonth() + 1 &&
|
|
13017
13021
|
dateNumber === today.getDate();
|
|
13018
|
-
var msOfDate = new Date(year + "
|
|
13022
|
+
var msOfDate = new Date(year + "/" + month + "/" + dateNumber).getTime();
|
|
13019
13023
|
var disabled = (msOfMin !== 0 && msOfDate < msOfMin) ||
|
|
13020
13024
|
(msOfMax !== 0 && msOfDate > msOfMax);
|
|
13021
13025
|
return (React__default.createElement("div", { key: i, className: classes.date, onClick: function () {
|
|
13022
|
-
setDate(year + "
|
|
13026
|
+
setDate(year + "/" + month + "/" + dateNumber);
|
|
13023
13027
|
setIsClicked(true);
|
|
13024
13028
|
}, style: {
|
|
13025
13029
|
backgroundColor: isSelected
|
|
@@ -13037,9 +13041,12 @@ var Calendar = function (_a) {
|
|
|
13037
13041
|
}))));
|
|
13038
13042
|
};
|
|
13039
13043
|
var firstDayOfMonth = function (year, month) {
|
|
13040
|
-
var firstDay = year + "
|
|
13044
|
+
var firstDay = year + "/" + month + "/" + 1;
|
|
13041
13045
|
return new Date(firstDay).getDay();
|
|
13042
13046
|
};
|
|
13047
|
+
var changeDateFormatToSlash = function (date) {
|
|
13048
|
+
return date.replace(/-/g, "/");
|
|
13049
|
+
};
|
|
13043
13050
|
var verticalline = (React__default.createElement("div", { style: { width: 1, height: "100%", backgroundColor: "#cccccc" } }));
|
|
13044
13051
|
var icon_arrowleft = (React__default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
13045
13052
|
React__default.createElement("path", { d: "M12.8417 13.8167L9.02502 10L12.8417 6.175L11.6667 5L6.66669 10L11.6667 15L12.8417 13.8167Z", fill: "black" })));
|