@yosgo/swap-ui 1.0.120 → 1.0.124
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 +75 -42
- package/build/index.esm.js.map +1 -1
- package/build/index.js +75 -42
- 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
|
@@ -2695,14 +2695,22 @@ var RadioButton = function (props) {
|
|
|
2695
2695
|
};
|
|
2696
2696
|
|
|
2697
2697
|
var useStyles$2 = makeStyles$1(function (theme) { return ({
|
|
2698
|
+
root: {
|
|
2699
|
+
"& .MuiFormHelperText-contained": {
|
|
2700
|
+
marginLeft: 16,
|
|
2701
|
+
marginRight: 16,
|
|
2702
|
+
},
|
|
2703
|
+
},
|
|
2698
2704
|
inputRoot: function (props) { return ({
|
|
2699
2705
|
width: props.width,
|
|
2700
2706
|
height: props.height,
|
|
2701
2707
|
padding: "0px 16px",
|
|
2702
2708
|
backgroundColor: "white",
|
|
2703
2709
|
fontSize: 16,
|
|
2704
|
-
lineHeight:
|
|
2710
|
+
lineHeight: "unset",
|
|
2705
2711
|
fontWeight: 400,
|
|
2712
|
+
display: "flex",
|
|
2713
|
+
alignItems: "center",
|
|
2706
2714
|
"& fieldset": {
|
|
2707
2715
|
"& legend": {
|
|
2708
2716
|
width: "0.01px",
|
|
@@ -2730,11 +2738,18 @@ var useStyles$2 = makeStyles$1(function (theme) { return ({
|
|
|
2730
2738
|
},
|
|
2731
2739
|
}); },
|
|
2732
2740
|
input: {
|
|
2741
|
+
fontSize: 16,
|
|
2742
|
+
lineHeight: "unset",
|
|
2743
|
+
fontWeight: 400,
|
|
2744
|
+
display: "flex",
|
|
2745
|
+
alignItems: "center",
|
|
2733
2746
|
"&:-webkit-autofill": {
|
|
2734
2747
|
"-webkit-box-shadow": "0 0 0 100px #FFFFFF inset",
|
|
2735
2748
|
},
|
|
2736
2749
|
"&::placeholder": { color: theme.black.black700, opacity: 1 },
|
|
2737
2750
|
padding: 0,
|
|
2751
|
+
margin: 0,
|
|
2752
|
+
height: "fit-content",
|
|
2738
2753
|
},
|
|
2739
2754
|
selectRoot: function (props) { return ({
|
|
2740
2755
|
borderRadius: 8,
|
|
@@ -2754,7 +2769,11 @@ var useStyles$2 = makeStyles$1(function (theme) { return ({
|
|
|
2754
2769
|
"&.Mui-error": { color: theme.black.black700 },
|
|
2755
2770
|
},
|
|
2756
2771
|
shrink: {
|
|
2757
|
-
transform: "translate(14px, -
|
|
2772
|
+
transform: "translate(14px, -10px) !important",
|
|
2773
|
+
height: 20,
|
|
2774
|
+
display: "flex",
|
|
2775
|
+
alignItems: "center",
|
|
2776
|
+
justifyContent: "center",
|
|
2758
2777
|
backgroundColor: "white",
|
|
2759
2778
|
fontSize: 14,
|
|
2760
2779
|
fontWeight: 700,
|
|
@@ -2776,7 +2795,7 @@ var TextField = function (props) {
|
|
|
2776
2795
|
select: select,
|
|
2777
2796
|
};
|
|
2778
2797
|
var classes = useStyles$2(styleProps);
|
|
2779
|
-
return (React__default.createElement(MaterialTextField, __assign({ fullWidth: fullWidth, select: select }, other, { variant: "outlined", InputProps: __assign({ classes: {
|
|
2798
|
+
return (React__default.createElement(MaterialTextField, __assign({ fullWidth: fullWidth, select: select }, other, { className: classes.root, variant: "outlined", InputProps: __assign({ classes: {
|
|
2780
2799
|
root: classes.inputRoot,
|
|
2781
2800
|
input: classes.input,
|
|
2782
2801
|
} }, InputProps), InputLabelProps: __assign({ classes: {
|
|
@@ -6666,7 +6685,7 @@ var ModalTransitionEffect = React__default.forwardRef(function ModalTransitionEf
|
|
|
6666
6685
|
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
6686
|
});
|
|
6668
6687
|
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
|
|
6688
|
+
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
6689
|
var _a = useState(0), clientHeight = _a[0], setClientHeight = _a[1];
|
|
6671
6690
|
var _b = useState(0), scorllbarWidth = _b[0], setScorllbarWidth = _b[1];
|
|
6672
6691
|
useEffect(function () {
|
|
@@ -6689,14 +6708,6 @@ var Modal = React__default.forwardRef(function (props, ref) {
|
|
|
6689
6708
|
var scrollbar_width = window.innerWidth - document.body.clientWidth;
|
|
6690
6709
|
setScorllbarWidth(scrollbar_width / 2);
|
|
6691
6710
|
}, []);
|
|
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
6711
|
var match_XS = useBreakpoints("xs");
|
|
6701
6712
|
var useStyles = makeStyles$1(function (theme) { return ({
|
|
6702
6713
|
root: {
|
|
@@ -7048,7 +7059,10 @@ var Modal = React__default.forwardRef(function (props, ref) {
|
|
|
7048
7059
|
},
|
|
7049
7060
|
}); });
|
|
7050
7061
|
var classes = useStyles();
|
|
7051
|
-
return (React__default.createElement(MaterialModal, { open: open, className: classes.root, BackdropComponent: Backdrop, BackdropProps: {
|
|
7062
|
+
return (React__default.createElement(MaterialModal, { open: open, className: classes.root, BackdropComponent: Backdrop, BackdropProps: {
|
|
7063
|
+
className: classes.backdrop,
|
|
7064
|
+
style: { overflow: "auto", WebkitOverflowScrolling: "touch" },
|
|
7065
|
+
} },
|
|
7052
7066
|
React__default.createElement(ModalTransitionEffect, { in: open, slide: fullWidth, style: {
|
|
7053
7067
|
outline: "none",
|
|
7054
7068
|
transition: "ease-in-out",
|
|
@@ -7229,7 +7243,12 @@ var useStyles$b = makeStyles$1(function () { return ({
|
|
|
7229
7243
|
height: props.height,
|
|
7230
7244
|
display: "flex",
|
|
7231
7245
|
alignItems: "center",
|
|
7232
|
-
justifyContent: "
|
|
7246
|
+
justifyContent: "center",
|
|
7247
|
+
fontSize: "0.75rem",
|
|
7248
|
+
lineHeight: "17px",
|
|
7249
|
+
fontWeight: 700,
|
|
7250
|
+
marginRight: props.marginRight,
|
|
7251
|
+
color: props.color,
|
|
7233
7252
|
}); },
|
|
7234
7253
|
}); });
|
|
7235
7254
|
var Chip = function (props) {
|
|
@@ -7248,7 +7267,7 @@ var Chip = function (props) {
|
|
|
7248
7267
|
? theme.danger.danger50
|
|
7249
7268
|
: theme.primary.primary50,
|
|
7250
7269
|
width: width ? width : "fit-content",
|
|
7251
|
-
height: height ? height :
|
|
7270
|
+
height: height ? height : 24,
|
|
7252
7271
|
border: outlined || !contained
|
|
7253
7272
|
? variant === "neutral"
|
|
7254
7273
|
? "1px solid " + theme.black.black500
|
|
@@ -7260,21 +7279,25 @@ var Chip = function (props) {
|
|
|
7260
7279
|
? "1px solid " + theme.danger.danger800
|
|
7261
7280
|
: "1px solid " + theme.primary.primary800
|
|
7262
7281
|
: null,
|
|
7263
|
-
padding: outlined || !contained ? "
|
|
7282
|
+
padding: outlined || !contained ? "0px 8px" : "0px 9px",
|
|
7283
|
+
color: variant === "neutral"
|
|
7284
|
+
? theme.black.black800
|
|
7285
|
+
: variant === "primary"
|
|
7286
|
+
? theme.primary.primary800
|
|
7287
|
+
: variant === "success"
|
|
7288
|
+
? theme.success.success800
|
|
7289
|
+
: variant === "danger"
|
|
7290
|
+
? theme.danger.danger800
|
|
7291
|
+
: theme.primary.primary800,
|
|
7292
|
+
marginRight: variant === "success" ? 4 : 0,
|
|
7264
7293
|
};
|
|
7265
7294
|
var classes = useStyles$b(styleProps);
|
|
7266
7295
|
return (React__default.createElement("div", __assign({ className: classes.root }, other),
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
? "success800"
|
|
7273
|
-
: variant === "danger"
|
|
7274
|
-
? "danger800"
|
|
7275
|
-
: "primary800", style: { marginRight: icon ? 4 : 0 } }, label),
|
|
7276
|
-
icon));
|
|
7277
|
-
};
|
|
7296
|
+
label,
|
|
7297
|
+
variant === "success" && !icon ? icon_success : icon));
|
|
7298
|
+
};
|
|
7299
|
+
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" },
|
|
7300
|
+
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
7301
|
|
|
7279
7302
|
var CircularProgress = function (props) {
|
|
7280
7303
|
var theme = useTheme$1();
|
|
@@ -12716,7 +12739,7 @@ var useStylesForCalendar = makeStyles$1(function (theme) { return ({
|
|
|
12716
12739
|
},
|
|
12717
12740
|
}); });
|
|
12718
12741
|
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"]);
|
|
12742
|
+
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
12743
|
var _a = useState(Number(new Date().getFullYear())), year = _a[0], setYear = _a[1];
|
|
12721
12744
|
var _b = useState(Number(new Date().getMonth() + 1)), month = _b[0], setMonth = _b[1];
|
|
12722
12745
|
var _c = useState(1), nextMonth = _c[0], setNextMonth = _c[1];
|
|
@@ -12754,7 +12777,7 @@ var DatePicker = function (props) {
|
|
|
12754
12777
|
}
|
|
12755
12778
|
}
|
|
12756
12779
|
else if (format === "day") {
|
|
12757
|
-
getValue(date);
|
|
12780
|
+
getValue(date.replace(/\//g, "-"));
|
|
12758
12781
|
}
|
|
12759
12782
|
else {
|
|
12760
12783
|
getValue(String(year));
|
|
@@ -12762,6 +12785,11 @@ var DatePicker = function (props) {
|
|
|
12762
12785
|
setIsClicked(false);
|
|
12763
12786
|
}
|
|
12764
12787
|
}, [isClicked]);
|
|
12788
|
+
useEffect(function () {
|
|
12789
|
+
if (value) {
|
|
12790
|
+
setDate(changeDateFormatToSlash(value));
|
|
12791
|
+
}
|
|
12792
|
+
}, [value]);
|
|
12765
12793
|
return (React__default.createElement("div", __assign({}, other), format !== "day" ? (React__default.createElement("div", { style: {
|
|
12766
12794
|
borderRadius: 8,
|
|
12767
12795
|
border: "1px solid #cccccc",
|
|
@@ -12877,11 +12905,11 @@ var DatePicker = function (props) {
|
|
|
12877
12905
|
} }, 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
12906
|
React__default.createElement("span", { style: { fontWeight: 400 } }, "\u5DF2\u9078\u64C7\uFF1A"),
|
|
12879
12907
|
date &&
|
|
12880
|
-
date.split("
|
|
12908
|
+
date.split("/")[0] + "\u5E74" + date.split("/")[1] + "\u6708" + date.split("/")[2] + "\u65E5")) : (React__default.createElement(React__default.Fragment, null,
|
|
12881
12909
|
React__default.createElement(Typography, { variant: "caption2" },
|
|
12882
12910
|
React__default.createElement("span", { style: { fontWeight: 400 } }, "\u5DF2\u9078\u64C7\uFF1A")),
|
|
12883
12911
|
React__default.createElement(Typography, { variant: "subtitle" }, date &&
|
|
12884
|
-
date.split("
|
|
12912
|
+
date.split("/")[0] + "\u5E74" + date.split("/")[1] + "\u6708" + date.split("/")[2] + "\u65E5"))), primaryButton: {
|
|
12885
12913
|
title: "確認",
|
|
12886
12914
|
onClick: function () {
|
|
12887
12915
|
onClose();
|
|
@@ -12955,14 +12983,16 @@ var MonthButton = function (_a) {
|
|
|
12955
12983
|
var Calendar = function (_a) {
|
|
12956
12984
|
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
12985
|
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
|
|
12986
|
+
var today = defaultValue
|
|
12987
|
+
? new Date(changeDateFormatToSlash(defaultValue))
|
|
12988
|
+
: new Date();
|
|
12989
|
+
var selectedYear = Number(date.split("/")[0]);
|
|
12990
|
+
var selectedMonth = Number(date.split("/")[1]);
|
|
12991
|
+
var selectedDate = Number(date.split("/")[2]);
|
|
12992
|
+
var msOfMin = min ? new Date(changeDateFormatToSlash(min)).getTime() : 0;
|
|
12993
|
+
var msOfMax = max ? new Date(changeDateFormatToSlash(max)).getTime() : 0;
|
|
12994
|
+
var msOfFirstDayOfMonth = new Date(year + "/" + month + "/1").getTime();
|
|
12995
|
+
var msOfLastDayOfMonth = new Date(year + "/" + month + "/" + (month === 2 ? (year % 4 === 0 ? 29 : 28) : isBigMonth ? 31 : 30)).getTime();
|
|
12966
12996
|
var arrowDisabled = (msOfMin !== 0 && position === "left" && msOfFirstDayOfMonth <= msOfMin) ||
|
|
12967
12997
|
(msOfMax !== 0 && position === "right" && msOfLastDayOfMonth >= msOfMax);
|
|
12968
12998
|
var mobileLeftArrowDisabled = msOfMin !== 0 && msOfFirstDayOfMonth <= msOfMin;
|
|
@@ -13015,11 +13045,11 @@ var Calendar = function (_a) {
|
|
|
13015
13045
|
var isToday = year === today.getFullYear() &&
|
|
13016
13046
|
month === today.getMonth() + 1 &&
|
|
13017
13047
|
dateNumber === today.getDate();
|
|
13018
|
-
var msOfDate = new Date(year + "
|
|
13048
|
+
var msOfDate = new Date(year + "/" + month + "/" + dateNumber).getTime();
|
|
13019
13049
|
var disabled = (msOfMin !== 0 && msOfDate < msOfMin) ||
|
|
13020
13050
|
(msOfMax !== 0 && msOfDate > msOfMax);
|
|
13021
13051
|
return (React__default.createElement("div", { key: i, className: classes.date, onClick: function () {
|
|
13022
|
-
setDate(year + "
|
|
13052
|
+
setDate(year + "/" + month + "/" + dateNumber);
|
|
13023
13053
|
setIsClicked(true);
|
|
13024
13054
|
}, style: {
|
|
13025
13055
|
backgroundColor: isSelected
|
|
@@ -13037,9 +13067,12 @@ var Calendar = function (_a) {
|
|
|
13037
13067
|
}))));
|
|
13038
13068
|
};
|
|
13039
13069
|
var firstDayOfMonth = function (year, month) {
|
|
13040
|
-
var firstDay = year + "
|
|
13070
|
+
var firstDay = year + "/" + month + "/" + 1;
|
|
13041
13071
|
return new Date(firstDay).getDay();
|
|
13042
13072
|
};
|
|
13073
|
+
var changeDateFormatToSlash = function (date) {
|
|
13074
|
+
return date.replace(/-/g, "/");
|
|
13075
|
+
};
|
|
13043
13076
|
var verticalline = (React__default.createElement("div", { style: { width: 1, height: "100%", backgroundColor: "#cccccc" } }));
|
|
13044
13077
|
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
13078
|
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" })));
|