@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/index.js CHANGED
@@ -2700,14 +2700,22 @@ var RadioButton = function (props) {
2700
2700
  };
2701
2701
 
2702
2702
  var useStyles$2 = core.makeStyles(function (theme) { return ({
2703
+ root: {
2704
+ "& .MuiFormHelperText-contained": {
2705
+ marginLeft: 16,
2706
+ marginRight: 16,
2707
+ },
2708
+ },
2703
2709
  inputRoot: function (props) { return ({
2704
2710
  width: props.width,
2705
2711
  height: props.height,
2706
2712
  padding: "0px 16px",
2707
2713
  backgroundColor: "white",
2708
2714
  fontSize: 16,
2709
- lineHeight: 1.4,
2715
+ lineHeight: "unset",
2710
2716
  fontWeight: 400,
2717
+ display: "flex",
2718
+ alignItems: "center",
2711
2719
  "& fieldset": {
2712
2720
  "& legend": {
2713
2721
  width: "0.01px",
@@ -2735,11 +2743,18 @@ var useStyles$2 = core.makeStyles(function (theme) { return ({
2735
2743
  },
2736
2744
  }); },
2737
2745
  input: {
2746
+ fontSize: 16,
2747
+ lineHeight: "unset",
2748
+ fontWeight: 400,
2749
+ display: "flex",
2750
+ alignItems: "center",
2738
2751
  "&:-webkit-autofill": {
2739
2752
  "-webkit-box-shadow": "0 0 0 100px #FFFFFF inset",
2740
2753
  },
2741
2754
  "&::placeholder": { color: theme.black.black700, opacity: 1 },
2742
2755
  padding: 0,
2756
+ margin: 0,
2757
+ height: "fit-content",
2743
2758
  },
2744
2759
  selectRoot: function (props) { return ({
2745
2760
  borderRadius: 8,
@@ -2759,7 +2774,11 @@ var useStyles$2 = core.makeStyles(function (theme) { return ({
2759
2774
  "&.Mui-error": { color: theme.black.black700 },
2760
2775
  },
2761
2776
  shrink: {
2762
- transform: "translate(14px, -6px) !important",
2777
+ transform: "translate(14px, -10px) !important",
2778
+ height: 20,
2779
+ display: "flex",
2780
+ alignItems: "center",
2781
+ justifyContent: "center",
2763
2782
  backgroundColor: "white",
2764
2783
  fontSize: 14,
2765
2784
  fontWeight: 700,
@@ -2781,7 +2800,7 @@ var TextField = function (props) {
2781
2800
  select: select,
2782
2801
  };
2783
2802
  var classes = useStyles$2(styleProps);
2784
- return (React__default.createElement(MaterialTextField, __assign({ fullWidth: fullWidth, select: select }, other, { variant: "outlined", InputProps: __assign({ classes: {
2803
+ return (React__default.createElement(MaterialTextField, __assign({ fullWidth: fullWidth, select: select }, other, { className: classes.root, variant: "outlined", InputProps: __assign({ classes: {
2785
2804
  root: classes.inputRoot,
2786
2805
  input: classes.input,
2787
2806
  } }, InputProps), InputLabelProps: __assign({ classes: {
@@ -6671,7 +6690,7 @@ var ModalTransitionEffect = React__default.forwardRef(function ModalTransitionEf
6671
6690
  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
6691
  });
6673
6692
  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;
6693
+ 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
6694
  var _a = React.useState(0), clientHeight = _a[0], setClientHeight = _a[1];
6676
6695
  var _b = React.useState(0), scorllbarWidth = _b[0], setScorllbarWidth = _b[1];
6677
6696
  React.useEffect(function () {
@@ -6694,14 +6713,6 @@ var Modal = React__default.forwardRef(function (props, ref) {
6694
6713
  var scrollbar_width = window.innerWidth - document.body.clientWidth;
6695
6714
  setScorllbarWidth(scrollbar_width / 2);
6696
6715
  }, []);
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
6716
  var match_XS = useBreakpoints("xs");
6706
6717
  var useStyles = core.makeStyles(function (theme) { return ({
6707
6718
  root: {
@@ -7053,7 +7064,10 @@ var Modal = React__default.forwardRef(function (props, ref) {
7053
7064
  },
7054
7065
  }); });
7055
7066
  var classes = useStyles();
7056
- return (React__default.createElement(MaterialModal, { open: open, className: classes.root, BackdropComponent: core.Backdrop, BackdropProps: { className: classes.backdrop } },
7067
+ return (React__default.createElement(MaterialModal, { open: open, className: classes.root, BackdropComponent: core.Backdrop, BackdropProps: {
7068
+ className: classes.backdrop,
7069
+ style: { overflow: "auto", WebkitOverflowScrolling: "touch" },
7070
+ } },
7057
7071
  React__default.createElement(ModalTransitionEffect, { in: open, slide: fullWidth, style: {
7058
7072
  outline: "none",
7059
7073
  transition: "ease-in-out",
@@ -7234,7 +7248,12 @@ var useStyles$b = core.makeStyles(function () { return ({
7234
7248
  height: props.height,
7235
7249
  display: "flex",
7236
7250
  alignItems: "center",
7237
- justifyContent: "space-between",
7251
+ justifyContent: "center",
7252
+ fontSize: "0.75rem",
7253
+ lineHeight: "17px",
7254
+ fontWeight: 700,
7255
+ marginRight: props.marginRight,
7256
+ color: props.color,
7238
7257
  }); },
7239
7258
  }); });
7240
7259
  var Chip = function (props) {
@@ -7253,7 +7272,7 @@ var Chip = function (props) {
7253
7272
  ? theme.danger.danger50
7254
7273
  : theme.primary.primary50,
7255
7274
  width: width ? width : "fit-content",
7256
- height: height ? height : "fit-content",
7275
+ height: height ? height : 24,
7257
7276
  border: outlined || !contained
7258
7277
  ? variant === "neutral"
7259
7278
  ? "1px solid " + theme.black.black500
@@ -7265,21 +7284,25 @@ var Chip = function (props) {
7265
7284
  ? "1px solid " + theme.danger.danger800
7266
7285
  : "1px solid " + theme.primary.primary800
7267
7286
  : null,
7268
- padding: outlined || !contained ? "3.5px 8px" : "3.5px 9px",
7287
+ padding: outlined || !contained ? "0px 8px" : "0px 9px",
7288
+ color: variant === "neutral"
7289
+ ? theme.black.black800
7290
+ : variant === "primary"
7291
+ ? theme.primary.primary800
7292
+ : variant === "success"
7293
+ ? theme.success.success800
7294
+ : variant === "danger"
7295
+ ? theme.danger.danger800
7296
+ : theme.primary.primary800,
7297
+ marginRight: variant === "success" ? 4 : 0,
7269
7298
  };
7270
7299
  var classes = useStyles$b(styleProps);
7271
7300
  return (React__default.createElement("div", __assign({ className: classes.root }, other),
7272
- React__default.createElement(Typography, { variant: "caption1", color: variant === "neutral"
7273
- ? "black800"
7274
- : variant === "primary"
7275
- ? "primary800"
7276
- : variant === "success"
7277
- ? "success800"
7278
- : variant === "danger"
7279
- ? "danger800"
7280
- : "primary800", style: { marginRight: icon ? 4 : 0 } }, label),
7281
- icon));
7282
- };
7301
+ label,
7302
+ variant === "success" && !icon ? icon_success : icon));
7303
+ };
7304
+ 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" },
7305
+ 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
7306
 
7284
7307
  var CircularProgress = function (props) {
7285
7308
  var theme = core.useTheme();
@@ -12721,7 +12744,7 @@ var useStylesForCalendar = core.makeStyles(function (theme) { return ({
12721
12744
  },
12722
12745
  }); });
12723
12746
  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"]);
12747
+ 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
12748
  var _a = React.useState(Number(new Date().getFullYear())), year = _a[0], setYear = _a[1];
12726
12749
  var _b = React.useState(Number(new Date().getMonth() + 1)), month = _b[0], setMonth = _b[1];
12727
12750
  var _c = React.useState(1), nextMonth = _c[0], setNextMonth = _c[1];
@@ -12759,7 +12782,7 @@ var DatePicker = function (props) {
12759
12782
  }
12760
12783
  }
12761
12784
  else if (format === "day") {
12762
- getValue(date);
12785
+ getValue(date.replace(/\//g, "-"));
12763
12786
  }
12764
12787
  else {
12765
12788
  getValue(String(year));
@@ -12767,6 +12790,11 @@ var DatePicker = function (props) {
12767
12790
  setIsClicked(false);
12768
12791
  }
12769
12792
  }, [isClicked]);
12793
+ React.useEffect(function () {
12794
+ if (value) {
12795
+ setDate(changeDateFormatToSlash(value));
12796
+ }
12797
+ }, [value]);
12770
12798
  return (React__default.createElement("div", __assign({}, other), format !== "day" ? (React__default.createElement("div", { style: {
12771
12799
  borderRadius: 8,
12772
12800
  border: "1px solid #cccccc",
@@ -12882,11 +12910,11 @@ var DatePicker = function (props) {
12882
12910
  } }, 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
12911
  React__default.createElement("span", { style: { fontWeight: 400 } }, "\u5DF2\u9078\u64C7\uFF1A"),
12884
12912
  date &&
12885
- date.split("-")[0] + "\u5E74" + date.split("-")[1] + "\u6708" + date.split("-")[2] + "\u65E5")) : (React__default.createElement(React__default.Fragment, null,
12913
+ date.split("/")[0] + "\u5E74" + date.split("/")[1] + "\u6708" + date.split("/")[2] + "\u65E5")) : (React__default.createElement(React__default.Fragment, null,
12886
12914
  React__default.createElement(Typography, { variant: "caption2" },
12887
12915
  React__default.createElement("span", { style: { fontWeight: 400 } }, "\u5DF2\u9078\u64C7\uFF1A")),
12888
12916
  React__default.createElement(Typography, { variant: "subtitle" }, date &&
12889
- date.split("-")[0] + "\u5E74" + date.split("-")[1] + "\u6708" + date.split("-")[2] + "\u65E5"))), primaryButton: {
12917
+ date.split("/")[0] + "\u5E74" + date.split("/")[1] + "\u6708" + date.split("/")[2] + "\u65E5"))), primaryButton: {
12890
12918
  title: "確認",
12891
12919
  onClick: function () {
12892
12920
  onClose();
@@ -12960,14 +12988,16 @@ var MonthButton = function (_a) {
12960
12988
  var Calendar = function (_a) {
12961
12989
  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
12990
  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();
12991
+ var today = defaultValue
12992
+ ? new Date(changeDateFormatToSlash(defaultValue))
12993
+ : new Date();
12994
+ var selectedYear = Number(date.split("/")[0]);
12995
+ var selectedMonth = Number(date.split("/")[1]);
12996
+ var selectedDate = Number(date.split("/")[2]);
12997
+ var msOfMin = min ? new Date(changeDateFormatToSlash(min)).getTime() : 0;
12998
+ var msOfMax = max ? new Date(changeDateFormatToSlash(max)).getTime() : 0;
12999
+ var msOfFirstDayOfMonth = new Date(year + "/" + month + "/1").getTime();
13000
+ var msOfLastDayOfMonth = new Date(year + "/" + month + "/" + (month === 2 ? (year % 4 === 0 ? 29 : 28) : isBigMonth ? 31 : 30)).getTime();
12971
13001
  var arrowDisabled = (msOfMin !== 0 && position === "left" && msOfFirstDayOfMonth <= msOfMin) ||
12972
13002
  (msOfMax !== 0 && position === "right" && msOfLastDayOfMonth >= msOfMax);
12973
13003
  var mobileLeftArrowDisabled = msOfMin !== 0 && msOfFirstDayOfMonth <= msOfMin;
@@ -13020,11 +13050,11 @@ var Calendar = function (_a) {
13020
13050
  var isToday = year === today.getFullYear() &&
13021
13051
  month === today.getMonth() + 1 &&
13022
13052
  dateNumber === today.getDate();
13023
- var msOfDate = new Date(year + "-" + month + "-" + dateNumber).getTime();
13053
+ var msOfDate = new Date(year + "/" + month + "/" + dateNumber).getTime();
13024
13054
  var disabled = (msOfMin !== 0 && msOfDate < msOfMin) ||
13025
13055
  (msOfMax !== 0 && msOfDate > msOfMax);
13026
13056
  return (React__default.createElement("div", { key: i, className: classes.date, onClick: function () {
13027
- setDate(year + "-" + month + "-" + dateNumber);
13057
+ setDate(year + "/" + month + "/" + dateNumber);
13028
13058
  setIsClicked(true);
13029
13059
  }, style: {
13030
13060
  backgroundColor: isSelected
@@ -13042,9 +13072,12 @@ var Calendar = function (_a) {
13042
13072
  }))));
13043
13073
  };
13044
13074
  var firstDayOfMonth = function (year, month) {
13045
- var firstDay = year + "-" + month + "-" + 1;
13075
+ var firstDay = year + "/" + month + "/" + 1;
13046
13076
  return new Date(firstDay).getDay();
13047
13077
  };
13078
+ var changeDateFormatToSlash = function (date) {
13079
+ return date.replace(/-/g, "/");
13080
+ };
13048
13081
  var verticalline = (React__default.createElement("div", { style: { width: 1, height: "100%", backgroundColor: "#cccccc" } }));
13049
13082
  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
13083
  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" })));