@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/index.js CHANGED
@@ -6671,7 +6671,7 @@ var ModalTransitionEffect = React__default.forwardRef(function ModalTransitionEf
6671
6671
  return (React__default.createElement(React__default.Fragment, null, slide ? (React__default.createElement(core.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))));
6672
6672
  });
6673
6673
  var Modal = React__default.forwardRef(function (props, ref) {
6674
- 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, isFreshchatOpen = props.isFreshchatOpen;
6674
+ 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;
6675
6675
  var _a = React.useState(0), clientHeight = _a[0], setClientHeight = _a[1];
6676
6676
  var _b = React.useState(0), scorllbarWidth = _b[0], setScorllbarWidth = _b[1];
6677
6677
  React.useEffect(function () {
@@ -6694,14 +6694,6 @@ var Modal = React__default.forwardRef(function (props, ref) {
6694
6694
  var scrollbar_width = window.innerWidth - document.body.clientWidth;
6695
6695
  setScorllbarWidth(scrollbar_width / 2);
6696
6696
  }, []);
6697
- React.useEffect(function () {
6698
- if (!isFreshchatOpen) {
6699
- var elem = document.getElementById("fc_frame");
6700
- if (elem) {
6701
- elem.style["display"] = open ? "none" : "block";
6702
- }
6703
- }
6704
- }, [open]);
6705
6697
  var match_XS = useBreakpoints("xs");
6706
6698
  var useStyles = core.makeStyles(function (theme) { return ({
6707
6699
  root: {
@@ -7053,7 +7045,10 @@ var Modal = React__default.forwardRef(function (props, ref) {
7053
7045
  },
7054
7046
  }); });
7055
7047
  var classes = useStyles();
7056
- return (React__default.createElement(MaterialModal, { open: open, className: classes.root, BackdropComponent: core.Backdrop, BackdropProps: { className: classes.backdrop } },
7048
+ return (React__default.createElement(MaterialModal, { open: open, className: classes.root, BackdropComponent: core.Backdrop, BackdropProps: {
7049
+ className: classes.backdrop,
7050
+ style: { overflow: "auto", WebkitOverflowScrolling: "touch" },
7051
+ }, style: { overflow: "auto", WebkitOverflowScrolling: "touch" } },
7057
7052
  React__default.createElement(ModalTransitionEffect, { in: open, slide: fullWidth, style: {
7058
7053
  outline: "none",
7059
7054
  transition: "ease-in-out",
@@ -7234,7 +7229,7 @@ var useStyles$b = core.makeStyles(function () { return ({
7234
7229
  height: props.height,
7235
7230
  display: "flex",
7236
7231
  alignItems: "center",
7237
- justifyContent: "space-between",
7232
+ justifyContent: "center",
7238
7233
  }); },
7239
7234
  }); });
7240
7235
  var Chip = function (props) {
@@ -7253,7 +7248,7 @@ var Chip = function (props) {
7253
7248
  ? theme.danger.danger50
7254
7249
  : theme.primary.primary50,
7255
7250
  width: width ? width : "fit-content",
7256
- height: height ? height : "fit-content",
7251
+ height: height ? height : 24,
7257
7252
  border: outlined || !contained
7258
7253
  ? variant === "neutral"
7259
7254
  ? "1px solid " + theme.black.black500
@@ -7265,7 +7260,7 @@ var Chip = function (props) {
7265
7260
  ? "1px solid " + theme.danger.danger800
7266
7261
  : "1px solid " + theme.primary.primary800
7267
7262
  : null,
7268
- padding: outlined || !contained ? "3.5px 8px" : "3.5px 9px",
7263
+ padding: outlined || !contained ? "0px 8px" : "0px 9px",
7269
7264
  };
7270
7265
  var classes = useStyles$b(styleProps);
7271
7266
  return (React__default.createElement("div", __assign({ className: classes.root }, other),
@@ -7277,9 +7272,11 @@ var Chip = function (props) {
7277
7272
  ? "success800"
7278
7273
  : variant === "danger"
7279
7274
  ? "danger800"
7280
- : "primary800", style: { marginRight: icon ? 4 : 0 } }, label),
7281
- icon));
7282
- };
7275
+ : "primary800", style: { marginRight: variant === "success" ? 4 : 0 } }, label),
7276
+ variant === "success" && !icon ? icon_success : icon));
7277
+ };
7278
+ 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" },
7279
+ React__default.createElement("path", { d: "M14 4.66666L6 12.6667L2.33333 9L3.27333 8.06L6 10.78L13.06 3.72666L14 4.66666Z", fill: "#00821E" })));
7283
7280
 
7284
7281
  var CircularProgress = function (props) {
7285
7282
  var theme = core.useTheme();
@@ -12721,7 +12718,7 @@ var useStylesForCalendar = core.makeStyles(function (theme) { return ({
12721
12718
  },
12722
12719
  }); });
12723
12720
  var DatePicker = function (props) {
12724
- 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"]);
12721
+ 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"]);
12725
12722
  var _a = React.useState(Number(new Date().getFullYear())), year = _a[0], setYear = _a[1];
12726
12723
  var _b = React.useState(Number(new Date().getMonth() + 1)), month = _b[0], setMonth = _b[1];
12727
12724
  var _c = React.useState(1), nextMonth = _c[0], setNextMonth = _c[1];
@@ -12759,7 +12756,7 @@ var DatePicker = function (props) {
12759
12756
  }
12760
12757
  }
12761
12758
  else if (format === "day") {
12762
- getValue(date);
12759
+ getValue(date.replace(/\//g, "-"));
12763
12760
  }
12764
12761
  else {
12765
12762
  getValue(String(year));
@@ -12767,6 +12764,11 @@ var DatePicker = function (props) {
12767
12764
  setIsClicked(false);
12768
12765
  }
12769
12766
  }, [isClicked]);
12767
+ React.useEffect(function () {
12768
+ if (value) {
12769
+ setDate(changeDateFormatToSlash(value));
12770
+ }
12771
+ }, [value]);
12770
12772
  return (React__default.createElement("div", __assign({}, other), format !== "day" ? (React__default.createElement("div", { style: {
12771
12773
  borderRadius: 8,
12772
12774
  border: "1px solid #cccccc",
@@ -12882,11 +12884,11 @@ var DatePicker = function (props) {
12882
12884
  } }, 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" },
12883
12885
  React__default.createElement("span", { style: { fontWeight: 400 } }, "\u5DF2\u9078\u64C7\uFF1A"),
12884
12886
  date &&
12885
- date.split("-")[0] + "\u5E74" + date.split("-")[1] + "\u6708" + date.split("-")[2] + "\u65E5")) : (React__default.createElement(React__default.Fragment, null,
12887
+ date.split("/")[0] + "\u5E74" + date.split("/")[1] + "\u6708" + date.split("/")[2] + "\u65E5")) : (React__default.createElement(React__default.Fragment, null,
12886
12888
  React__default.createElement(Typography, { variant: "caption2" },
12887
12889
  React__default.createElement("span", { style: { fontWeight: 400 } }, "\u5DF2\u9078\u64C7\uFF1A")),
12888
12890
  React__default.createElement(Typography, { variant: "subtitle" }, date &&
12889
- date.split("-")[0] + "\u5E74" + date.split("-")[1] + "\u6708" + date.split("-")[2] + "\u65E5"))), primaryButton: {
12891
+ date.split("/")[0] + "\u5E74" + date.split("/")[1] + "\u6708" + date.split("/")[2] + "\u65E5"))), primaryButton: {
12890
12892
  title: "確認",
12891
12893
  onClick: function () {
12892
12894
  onClose();
@@ -12960,14 +12962,16 @@ var MonthButton = function (_a) {
12960
12962
  var Calendar = function (_a) {
12961
12963
  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;
12962
12964
  var isBigMonth = (month <= 7 && month % 2 !== 0) || (month >= 8 && month % 2 === 0);
12963
- var today = defaultValue ? new Date(defaultValue) : new Date();
12964
- var selectedYear = Number(date.split("-")[0]);
12965
- var selectedMonth = Number(date.split("-")[1]);
12966
- var selectedDate = Number(date.split("-")[2]);
12967
- var msOfMin = min ? new Date(min).getTime() : 0;
12968
- var msOfMax = max ? new Date(max).getTime() : 0;
12969
- var msOfFirstDayOfMonth = new Date(year + "-" + month + "-1").getTime();
12970
- var msOfLastDayOfMonth = new Date(year + "-" + month + "-" + (month === 2 ? (year % 4 === 0 ? 29 : 28) : isBigMonth ? 31 : 30)).getTime();
12965
+ var today = defaultValue
12966
+ ? new Date(changeDateFormatToSlash(defaultValue))
12967
+ : new Date();
12968
+ var selectedYear = Number(date.split("/")[0]);
12969
+ var selectedMonth = Number(date.split("/")[1]);
12970
+ var selectedDate = Number(date.split("/")[2]);
12971
+ var msOfMin = min ? new Date(changeDateFormatToSlash(min)).getTime() : 0;
12972
+ var msOfMax = max ? new Date(changeDateFormatToSlash(max)).getTime() : 0;
12973
+ var msOfFirstDayOfMonth = new Date(year + "/" + month + "/1").getTime();
12974
+ var msOfLastDayOfMonth = new Date(year + "/" + month + "/" + (month === 2 ? (year % 4 === 0 ? 29 : 28) : isBigMonth ? 31 : 30)).getTime();
12971
12975
  var arrowDisabled = (msOfMin !== 0 && position === "left" && msOfFirstDayOfMonth <= msOfMin) ||
12972
12976
  (msOfMax !== 0 && position === "right" && msOfLastDayOfMonth >= msOfMax);
12973
12977
  var mobileLeftArrowDisabled = msOfMin !== 0 && msOfFirstDayOfMonth <= msOfMin;
@@ -13020,11 +13024,11 @@ var Calendar = function (_a) {
13020
13024
  var isToday = year === today.getFullYear() &&
13021
13025
  month === today.getMonth() + 1 &&
13022
13026
  dateNumber === today.getDate();
13023
- var msOfDate = new Date(year + "-" + month + "-" + dateNumber).getTime();
13027
+ var msOfDate = new Date(year + "/" + month + "/" + dateNumber).getTime();
13024
13028
  var disabled = (msOfMin !== 0 && msOfDate < msOfMin) ||
13025
13029
  (msOfMax !== 0 && msOfDate > msOfMax);
13026
13030
  return (React__default.createElement("div", { key: i, className: classes.date, onClick: function () {
13027
- setDate(year + "-" + month + "-" + dateNumber);
13031
+ setDate(year + "/" + month + "/" + dateNumber);
13028
13032
  setIsClicked(true);
13029
13033
  }, style: {
13030
13034
  backgroundColor: isSelected
@@ -13042,9 +13046,12 @@ var Calendar = function (_a) {
13042
13046
  }))));
13043
13047
  };
13044
13048
  var firstDayOfMonth = function (year, month) {
13045
- var firstDay = year + "-" + month + "-" + 1;
13049
+ var firstDay = year + "/" + month + "/" + 1;
13046
13050
  return new Date(firstDay).getDay();
13047
13051
  };
13052
+ var changeDateFormatToSlash = function (date) {
13053
+ return date.replace(/-/g, "/");
13054
+ };
13048
13055
  var verticalline = (React__default.createElement("div", { style: { width: 1, height: "100%", backgroundColor: "#cccccc" } }));
13049
13056
  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" },
13050
13057
  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" })));