@yosgo/swap-ui 1.0.119 → 1.0.120

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
@@ -2715,11 +2715,9 @@ var useStyles$2 = core.makeStyles(function (theme) { return ({
2715
2715
  borderColor: theme.black.black500,
2716
2716
  },
2717
2717
  "&.Mui-focused": {
2718
- boxShadow: props.select ? "unset" : "0px 0px 0px 4px #D7DFF8",
2718
+ boxShadow: "0px 0px 0px 4px #D7DFF8",
2719
2719
  "& fieldset": {
2720
- border: props.select
2721
- ? "1px solid " + theme.black.black1000 + " !important"
2722
- : "1px solid " + theme.primary.primary400 + " !important",
2720
+ border: "1px solid " + theme.primary.primary400 + " !important",
2723
2721
  borderWidth: "1px !important",
2724
2722
  },
2725
2723
  "&.Mui-error": {
@@ -3107,7 +3105,7 @@ var Button = function (props) {
3107
3105
  : variant === "secondary"
3108
3106
  ? theme.primary.primary400
3109
3107
  : variant === "tertiary"
3110
- ? theme.primary.primary500
3108
+ ? theme.black.black800
3111
3109
  : variant === "text"
3112
3110
  ? theme.primary.primary400
3113
3111
  : variant === "black"
@@ -3120,7 +3118,7 @@ var Button = function (props) {
3120
3118
  : variant === "secondary"
3121
3119
  ? theme.black.white
3122
3120
  : variant === "tertiary"
3123
- ? theme.primary.primary50
3121
+ ? theme.black.black400
3124
3122
  : variant === "text"
3125
3123
  ? theme.black.white
3126
3124
  : variant === "black"
@@ -3165,7 +3163,7 @@ var Button = function (props) {
3165
3163
  : variant === "secondary"
3166
3164
  ? theme.primary.primary50
3167
3165
  : variant === "tertiary"
3168
- ? theme.primary.primary100
3166
+ ? theme.black.black500
3169
3167
  : variant === "text"
3170
3168
  ? theme.primary.primary50
3171
3169
  : variant === "black"
@@ -3189,7 +3187,7 @@ var Button = function (props) {
3189
3187
  : variant === "secondary"
3190
3188
  ? theme.primary.primary100
3191
3189
  : variant === "tertiary"
3192
- ? theme.primary.primary200
3190
+ ? theme.black.black600
3193
3191
  : variant === "text"
3194
3192
  ? theme.primary.primary100
3195
3193
  : variant === "black"
@@ -3203,13 +3201,15 @@ var Button = function (props) {
3203
3201
  ? "0px 0px 0px 4px #CCCCCC"
3204
3202
  : variant === "danger"
3205
3203
  ? "0px 0px 0px 4px #FFCCD0"
3206
- : "0px 0px 0px 4px #D7DFF8",
3204
+ : variant === "tertiary"
3205
+ ? "0px 0px 0px 4px rgba(0, 0, 0, 0.1)"
3206
+ : "0px 0px 0px 4px #D7DFF8",
3207
3207
  backgroundColor: variant === "primary"
3208
3208
  ? theme.primary.primary400
3209
3209
  : variant === "secondary"
3210
3210
  ? theme.primary.primary50
3211
3211
  : variant === "tertiary"
3212
- ? theme.primary.primary50
3212
+ ? theme.black.black400
3213
3213
  : variant === "text"
3214
3214
  ? theme.primary.primary50
3215
3215
  : variant === "black"
@@ -3220,7 +3220,7 @@ var Button = function (props) {
3220
3220
  border: variant === "secondary"
3221
3221
  ? "1px solid " + theme.primary.primary400
3222
3222
  : variant === "tertiary"
3223
- ? "1px solid " + theme.primary.primary400
3223
+ ? "1px solid " + theme.black.black600
3224
3224
  : variant === "text"
3225
3225
  ? "1px solid " + theme.primary.primary400
3226
3226
  : variant === "black"
@@ -3236,7 +3236,7 @@ var Button = function (props) {
3236
3236
  : variant === "secondary"
3237
3237
  ? theme.black.white
3238
3238
  : variant === "tertiary"
3239
- ? theme.primary.primary100
3239
+ ? theme.black.black400
3240
3240
  : variant === "text"
3241
3241
  ? theme.black.white
3242
3242
  : variant === "black"
@@ -3249,7 +3249,7 @@ var Button = function (props) {
3249
3249
  : variant === "secondary"
3250
3250
  ? theme.primary.primary400
3251
3251
  : variant === "tertiary"
3252
- ? theme.primary.primary500
3252
+ ? theme.black.black800
3253
3253
  : variant === "text"
3254
3254
  ? theme.primary.primary400
3255
3255
  : variant === "black"
@@ -6675,7 +6675,7 @@ var Modal = React__default.forwardRef(function (props, ref) {
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 () {
6678
- if (mobile && fullWidth) {
6678
+ if (mobile || fullWidth) {
6679
6679
  if ((helpText || multiline) && !label) {
6680
6680
  setClientHeight(window.innerHeight - 64 - 73 - 64);
6681
6681
  }
@@ -6689,7 +6689,7 @@ var Modal = React__default.forwardRef(function (props, ref) {
6689
6689
  setClientHeight(window.innerHeight - 64 - 56 - 64);
6690
6690
  }
6691
6691
  }
6692
- }, []);
6692
+ }, [fullWidth, mobile]);
6693
6693
  React.useEffect(function () {
6694
6694
  var scrollbar_width = window.innerWidth - document.body.clientWidth;
6695
6695
  setScorllbarWidth(scrollbar_width / 2);
@@ -7013,7 +7013,7 @@ var Modal = React__default.forwardRef(function (props, ref) {
7013
7013
  pointerEvents: onExit ? "none" : "unset",
7014
7014
  maxHeight: bodyMaxHeight
7015
7015
  ? bodyMaxHeight
7016
- : mobile && fullWidth
7016
+ : fullWidth
7017
7017
  ? clientHeight
7018
7018
  : "unset",
7019
7019
  overflowY: !onExit ? "scroll" : "hidden",
@@ -7134,12 +7134,15 @@ var Modal = React__default.forwardRef(function (props, ref) {
7134
7134
  children))) : null,
7135
7135
  (label || secondaryButton || primaryButton) && !disUnderLine ? (React__default.createElement(core.Divider, null)) : null,
7136
7136
  React__default.createElement(core.Box, { className: classes.footer }, footer ? (footer) : (React__default.createElement(React__default.Fragment, null,
7137
- !buttonFullWidth || !footerDisplayColumn ? (React__default.createElement(core.Box, { marginBottom: mobile ? (label ? "12px" : 0) : 0 },
7138
- React__default.createElement(Typography, { variant: mobile ? "title" : "h6" }, label))) : null,
7137
+ !buttonFullWidth || !footerDisplayColumn ? (React__default.createElement(core.Box, { marginBottom: mobile ? (label ? "12px" : 0) : 0, style: {
7138
+ fontSize: mobile ? 16 : 18,
7139
+ fontWeight: 700,
7140
+ lineHeight: 1.4,
7141
+ } }, label)) : null,
7139
7142
  secondaryButton || primaryButton ? (React__default.createElement(core.Box, { className: classes.footerButton },
7140
7143
  React__default.createElement(core.Box, { width: mobile && !buttonFullWidth && !footerDisplayColumn
7141
7144
  ? null
7142
- : "100%", marginRight: !footerDisplayColumn ? 1 : 0 }, secondaryButton ? (React__default.createElement(Button, { fullWidth: buttonFullWidth || footerDisplayColumn, variant: secondaryButton.variant
7145
+ : "100%", marginRight: !footerDisplayColumn && secondaryButton ? 1 : 0 }, secondaryButton ? (React__default.createElement(Button, { fullWidth: buttonFullWidth || footerDisplayColumn, variant: secondaryButton.variant
7143
7146
  ? secondaryButton.variant
7144
7147
  : "secondary", size: "small", onClick: secondaryButton.onClick, disabled: secondaryButton.disabled, loading: secondaryButton.loading, style: secondaryButton.style }, secondaryButton.title)) : null),
7145
7148
  React__default.createElement(core.Box, { width: "100%", marginBottom: footerDisplayColumn ? 1 : 0 }, primaryButton ? (React__default.createElement(Button, { fullWidth: buttonFullWidth || footerDisplayColumn || mobile, variant: primaryButton.variant
@@ -11784,7 +11787,7 @@ var AutoComplete = function (props) {
11784
11787
  };
11785
11788
 
11786
11789
  var TaxTextField = function (_a) {
11787
- var onChange = _a.onChange, codeValue = _a.codeValue, domainValue = _a.domainValue, domainCodeValue = _a.domainCodeValue, codeError = _a.codeError, codeHelperText = _a.codeHelperText, domainError = _a.domainError, domainHelperText = _a.domainHelperText, codeOnClick = _a.codeOnClick, domainOnClick = _a.domainOnClick, mobile = _a.mobile;
11790
+ var onChange = _a.onChange, codeValue = _a.codeValue, domainValue = _a.domainValue, domainCodeValue = _a.domainCodeValue, codeError = _a.codeError, codeHelperText = _a.codeHelperText, domainError = _a.domainError, domainHelperText = _a.domainHelperText, codeOnClick = _a.codeOnClick, domainOnClick = _a.domainOnClick, mobile = _a.mobile, codeFocused = _a.codeFocused, domainFocused = _a.domainFocused;
11788
11791
  var _b = React.useState(""), modalIncome = _b[0], setModalIncome = _b[1];
11789
11792
  var _c = React.useState(""), modalExpense = _c[0], setModalExpense = _c[1];
11790
11793
  var handleModalTaxDescription = function () {
@@ -11841,7 +11844,7 @@ var TaxTextField = function (_a) {
11841
11844
  justifyContent: "space-between",
11842
11845
  } },
11843
11846
  React__default.createElement("div", { style: { width: "100%" } },
11844
- React__default.createElement(TextField, { fullWidth: true, select: true, error: codeError, helperText: codeHelperText, height: 56, label: "\u9078\u64C7\u7533\u5831\u985E\u5225", value: codeValue, onClick: handleCodeClick, onChange: function (e) {
11847
+ React__default.createElement(TextField, { focused: codeFocused, fullWidth: true, select: true, error: codeError, helperText: codeHelperText, height: 56, label: "\u9078\u64C7\u7533\u5831\u985E\u5225", value: codeValue, onClick: handleCodeClick, onChange: function (e) {
11845
11848
  setModalIncome(e.target.value);
11846
11849
  setModalExpense("");
11847
11850
  } },
@@ -11873,7 +11876,7 @@ var TaxTextField = function (_a) {
11873
11876
  margin: mobile ? "24px 0 0 0 " : "0 0 0 8px",
11874
11877
  } }, codeValue === "9B" ? (
11875
11878
  // 9B Select
11876
- React__default.createElement(TextField, { select: true, fullWidth: true, error: domainError, helperText: domainHelperText, height: 56, label: "\u8F38\u5165\u57F7\u884C\u696D\u52D9\u985E\u5225", value: domainCodeValue, onClick: handleDomainClick, onChange: function (e) {
11879
+ React__default.createElement(TextField, { focused: domainFocused, select: true, fullWidth: true, error: domainError, helperText: domainHelperText, height: 56, label: "\u8F38\u5165\u57F7\u884C\u696D\u52D9\u985E\u5225", value: domainCodeValue, onClick: handleDomainClick, onChange: function (e) {
11877
11880
  setModalExpense(e.target.value);
11878
11881
  setAnchorEl(null);
11879
11882
  } },
@@ -11902,7 +11905,7 @@ var TaxTextField = function (_a) {
11902
11905
  option.label)); }))) : (
11903
11906
  // 9A AutoComplete
11904
11907
  React__default.createElement(React__default.Fragment, null,
11905
- React__default.createElement(TextField, { error: domainError, helperText: domainHelperText, fullWidth: true, label: "\u8F38\u5165\u57F7\u884C\u696D\u52D9\u985E\u5225", height: 56, value: domainValue, onClick: handleDomainClick, InputProps: {
11908
+ React__default.createElement(TextField, { focused: domainFocused, error: domainError, helperText: domainHelperText, fullWidth: true, label: "\u8F38\u5165\u57F7\u884C\u696D\u52D9\u985E\u5225", height: 56, value: domainValue, onClick: handleDomainClick, InputProps: {
11906
11909
  endAdornment: (React__default.createElement("div", { style: { width: 24, height: 24 } },
11907
11910
  React__default.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
11908
11911
  React__default.createElement("path", { d: "M7 10L12 15L17 10H7Z", fill: "black" })))),
@@ -12645,6 +12648,533 @@ var Switch = function (props) {
12645
12648
  React__default.createElement("path", { d: "M4.5 10.21L1.395 7.105L2.81 5.69L4.5 7.385L9.44 2.44L10.855 3.855L4.5 10.21Z", fill: "#4862CC" })))) }, other))));
12646
12649
  };
12647
12650
 
12651
+ var useStylesForMonthButton = core.makeStyles(function (theme) { return ({
12652
+ root: function (props) { return ({
12653
+ width: "100%",
12654
+ height: "100%",
12655
+ borderRadius: 8,
12656
+ border: props.selected
12657
+ ? "1px solid " + theme.primary.primary300
12658
+ : "1px solid " + theme.black.black500,
12659
+ boxSizing: "border-box",
12660
+ display: "flex",
12661
+ alignItems: "center",
12662
+ justifyContent: "center",
12663
+ fontSize: 14,
12664
+ fontWeight: 700,
12665
+ lineHeight: 1.4,
12666
+ backgroundColor: props.selected
12667
+ ? theme.primary.primary50
12668
+ : theme.black.white,
12669
+ cursor: "pointer",
12670
+ "&:hover": {
12671
+ border: props.selected
12672
+ ? "1px solid " + theme.primary.primary300
12673
+ : "1px solid " + theme.black.black600,
12674
+ backgroundColor: props.selected
12675
+ ? theme.primary.primary50
12676
+ : theme.black.black100,
12677
+ },
12678
+ }); },
12679
+ }); });
12680
+ var useStylesForCalendar = core.makeStyles(function (theme) { return ({
12681
+ head: {
12682
+ width: "100%",
12683
+ display: "flex",
12684
+ alignItems: "center",
12685
+ justifyContent: "center",
12686
+ height: 48,
12687
+ fontSize: 14,
12688
+ fontWeight: 700,
12689
+ marginBottom: 8,
12690
+ position: "relative",
12691
+ },
12692
+ body: {
12693
+ display: "grid",
12694
+ gridTemplateColumns: "1fr 1fr 1fr 1fr 1fr 1fr 1fr",
12695
+ gap: 8,
12696
+ },
12697
+ days: {
12698
+ width: 32,
12699
+ height: 32,
12700
+ display: "flex",
12701
+ alignItems: "center",
12702
+ justifyContent: "center",
12703
+ fontSize: 14,
12704
+ color: theme.black.black600,
12705
+ },
12706
+ date: {
12707
+ width: 32,
12708
+ height: 32,
12709
+ display: "flex",
12710
+ alignItems: "center",
12711
+ justifyContent: "center",
12712
+ marginBottom: 4,
12713
+ fontSize: 14,
12714
+ fontWeight: 700,
12715
+ color: theme.black.black800,
12716
+ cursor: "pointer",
12717
+ borderRadius: "50%",
12718
+ "&:hover": {
12719
+ backgroundColor: theme.primary.primary50,
12720
+ },
12721
+ },
12722
+ }); });
12723
+ 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"]);
12725
+ var _a = React.useState(Number(new Date().getFullYear())), year = _a[0], setYear = _a[1];
12726
+ var _b = React.useState(Number(new Date().getMonth() + 1)), month = _b[0], setMonth = _b[1];
12727
+ var _c = React.useState(1), nextMonth = _c[0], setNextMonth = _c[1];
12728
+ var _d = React.useState(""), date = _d[0], setDate = _d[1];
12729
+ var _e = React.useState(false), isOpenMonthSelector = _e[0], setIsOpenMonthSelector = _e[1];
12730
+ var _f = React.useState(false), isClicked = _f[0], setIsClicked = _f[1];
12731
+ React.useEffect(function () {
12732
+ if (format === "month") {
12733
+ if (month % 2 === 0) {
12734
+ setMonth(month - 1);
12735
+ }
12736
+ else {
12737
+ if (month < 1) {
12738
+ setMonth(11);
12739
+ setYear(year - 1);
12740
+ }
12741
+ if (month > 12) {
12742
+ setMonth(1);
12743
+ setYear(year + 1);
12744
+ }
12745
+ }
12746
+ }
12747
+ }, [month]);
12748
+ React.useEffect(function () {
12749
+ if (isClicked && getValue) {
12750
+ if (format === "month") {
12751
+ if (month < 1) {
12752
+ getValue(year - 1 + "-11");
12753
+ }
12754
+ else if (month > 12) {
12755
+ getValue(year + 1 + "-1");
12756
+ }
12757
+ else {
12758
+ getValue(year + "-" + month);
12759
+ }
12760
+ }
12761
+ else if (format === "day") {
12762
+ getValue(date);
12763
+ }
12764
+ else {
12765
+ getValue(String(year));
12766
+ }
12767
+ setIsClicked(false);
12768
+ }
12769
+ }, [isClicked]);
12770
+ return (React__default.createElement("div", __assign({}, other), format !== "day" ? (React__default.createElement("div", { style: {
12771
+ borderRadius: 8,
12772
+ border: "1px solid #cccccc",
12773
+ boxSizing: "border-box",
12774
+ width: format === "month" ? 219 : 180,
12775
+ height: 40,
12776
+ display: "grid",
12777
+ alignItems: "center",
12778
+ gridTemplateColumns: "36px 1px 1fr 1px 36px",
12779
+ position: "relative",
12780
+ } },
12781
+ React__default.createElement(IconButton, { onClick: function () {
12782
+ if (format === "month") {
12783
+ setMonth(month - 2);
12784
+ }
12785
+ else {
12786
+ setYear(year - 1);
12787
+ }
12788
+ setIsClicked(true);
12789
+ }, style: {
12790
+ width: "100%",
12791
+ height: "100%",
12792
+ display: "flex",
12793
+ justifyContent: "center",
12794
+ alignItems: "center",
12795
+ borderRadius: "8px 0 0 8px",
12796
+ } }, icon_arrowleft),
12797
+ verticalline,
12798
+ React__default.createElement("div", { style: {
12799
+ display: "flex",
12800
+ justifyContent: "center",
12801
+ alignItems: "center",
12802
+ } },
12803
+ icon_calendar,
12804
+ format === "month" ? (React__default.createElement("div", { style: {
12805
+ fontSize: 14,
12806
+ fontWeight: 700,
12807
+ lineHeight: 1.4,
12808
+ marginLeft: 4,
12809
+ cursor: "pointer",
12810
+ }, onClick: function () { return setIsOpenMonthSelector(!isOpenMonthSelector); } },
12811
+ year,
12812
+ "\u5E74",
12813
+ month,
12814
+ "-",
12815
+ month + 1,
12816
+ "\u6708")) : (React__default.createElement("div", { style: {
12817
+ fontSize: 14,
12818
+ fontWeight: 700,
12819
+ lineHeight: 1.4,
12820
+ marginLeft: 4,
12821
+ } },
12822
+ year,
12823
+ "\u5E74"))),
12824
+ verticalline,
12825
+ React__default.createElement(IconButton, { onClick: function () {
12826
+ if (format === "month") {
12827
+ setMonth(month + 2);
12828
+ }
12829
+ else {
12830
+ setYear(year + 1);
12831
+ }
12832
+ setIsClicked(true);
12833
+ }, style: {
12834
+ width: "100%",
12835
+ height: "100%",
12836
+ display: "flex",
12837
+ justifyContent: "center",
12838
+ alignItems: "center",
12839
+ borderRadius: "0 8px 8px 0",
12840
+ } }, icon_arrowright),
12841
+ format === "month" ? (React__default.createElement(core.Grow, { in: isOpenMonthSelector, style: { transformOrigin: "0 0 0" } },
12842
+ React__default.createElement("div", { style: {
12843
+ border: "1px solid #cccccc",
12844
+ borderRadius: 8,
12845
+ boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
12846
+ boxSizing: "border-box",
12847
+ width: 302,
12848
+ height: 160,
12849
+ position: "absolute",
12850
+ backgroundColor: "#ffffff",
12851
+ zIndex: 1,
12852
+ top: 52,
12853
+ left: 0,
12854
+ } },
12855
+ React__default.createElement("div", { style: {
12856
+ height: 48,
12857
+ padding: 8,
12858
+ display: "grid",
12859
+ gridTemplateColumns: "32px 1fr 32px",
12860
+ gap: 13,
12861
+ alignItems: "center",
12862
+ boxShadow: "0px 1px 0px #ECECEC",
12863
+ } },
12864
+ React__default.createElement(IconButton, { hoverColor: "black400", onClick: function () {
12865
+ setYear(year - 1);
12866
+ setIsClicked(true);
12867
+ } }, icon_arrowleft),
12868
+ React__default.createElement(Typography, { variant: "subtitle", style: { textAlign: "center" } },
12869
+ year,
12870
+ "\u5E74"),
12871
+ React__default.createElement(IconButton, { hoverColor: "black400", onClick: function () {
12872
+ setYear(year + 1);
12873
+ setIsClicked(true);
12874
+ } }, icon_arrowright)),
12875
+ React__default.createElement("div", { style: {
12876
+ padding: 16,
12877
+ display: "grid",
12878
+ alignItems: "center",
12879
+ gap: 8,
12880
+ gridTemplateColumns: "1fr 1fr 1fr",
12881
+ gridTemplateRows: "36px 36px",
12882
+ } }, 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
+ React__default.createElement("span", { style: { fontWeight: 400 } }, "\u5DF2\u9078\u64C7\uFF1A"),
12884
+ date &&
12885
+ date.split("-")[0] + "\u5E74" + date.split("-")[1] + "\u6708" + date.split("-")[2] + "\u65E5")) : (React__default.createElement(React__default.Fragment, null,
12886
+ React__default.createElement(Typography, { variant: "caption2" },
12887
+ React__default.createElement("span", { style: { fontWeight: 400 } }, "\u5DF2\u9078\u64C7\uFF1A")),
12888
+ React__default.createElement(Typography, { variant: "subtitle" }, date &&
12889
+ date.split("-")[0] + "\u5E74" + date.split("-")[1] + "\u6708" + date.split("-")[2] + "\u65E5"))), primaryButton: {
12890
+ title: "確認",
12891
+ onClick: function () {
12892
+ onClose();
12893
+ },
12894
+ }, secondaryButton: { title: "取消", onClick: onClose }, children: !mobile ? (React__default.createElement("div", { style: { display: "flex", justifyContent: "space-between" } },
12895
+ React__default.createElement(Calendar, { month: month, year: year, date: date, setDate: setDate, min: min, max: max, position: "left", leftClick: function () {
12896
+ if (month - 1 < 1) {
12897
+ setMonth(12);
12898
+ setYear(year - 1);
12899
+ }
12900
+ else {
12901
+ setMonth(month - 1);
12902
+ }
12903
+ setNextMonth(month);
12904
+ }, defaultValue: defaultValue, setIsClicked: setIsClicked }),
12905
+ React__default.createElement(Calendar, { month: nextMonth, year: month > nextMonth ? year + 1 : year, date: date, setDate: setDate, min: min, max: max, position: "right", rightClick: function () {
12906
+ if (nextMonth + 1 > 12) {
12907
+ setMonth(12);
12908
+ setNextMonth(1);
12909
+ }
12910
+ else if (month + 1 > 12) {
12911
+ setMonth(1);
12912
+ setNextMonth(2);
12913
+ setYear(year + 1);
12914
+ }
12915
+ else {
12916
+ setMonth(month + 1);
12917
+ setNextMonth(nextMonth + 1);
12918
+ }
12919
+ }, defaultValue: defaultValue, setIsClicked: setIsClicked }))) : (React__default.createElement(Calendar, { month: month, year: year, date: date, setDate: setDate, min: min, max: max, position: "left", leftClick: function () {
12920
+ if (month - 1 < 1) {
12921
+ setMonth(12);
12922
+ setYear(year - 1);
12923
+ }
12924
+ else {
12925
+ setMonth(month - 1);
12926
+ }
12927
+ setNextMonth(month);
12928
+ }, rightClick: function () {
12929
+ if (nextMonth + 1 > 12) {
12930
+ setMonth(12);
12931
+ setNextMonth(1);
12932
+ }
12933
+ else if (month + 1 > 12) {
12934
+ setMonth(1);
12935
+ setNextMonth(2);
12936
+ setYear(year + 1);
12937
+ }
12938
+ else {
12939
+ setMonth(month + 1);
12940
+ setNextMonth(nextMonth + 1);
12941
+ }
12942
+ }, defaultValue: defaultValue, setIsClicked: setIsClicked, mobile: mobile })) }, ModalProps)))));
12943
+ };
12944
+ var MonthButton = function (_a) {
12945
+ var index = _a.index, month = _a.month, setMonth = _a.setMonth, setIsOpenMonthSelector = _a.setIsOpenMonthSelector, setIsClicked = _a.setIsClicked;
12946
+ var styleProps = {
12947
+ selected: 1 + 2 * index === month,
12948
+ };
12949
+ var classes = useStylesForMonthButton(styleProps);
12950
+ return (React__default.createElement("div", { className: classes.root, onClick: function () {
12951
+ setMonth(1 + 2 * index);
12952
+ setIsOpenMonthSelector(false);
12953
+ setIsClicked(true);
12954
+ } },
12955
+ 1 + 2 * index,
12956
+ "-",
12957
+ 2 + 2 * index,
12958
+ "\u6708"));
12959
+ };
12960
+ var Calendar = function (_a) {
12961
+ 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
+ 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();
12971
+ var arrowDisabled = (msOfMin !== 0 && position === "left" && msOfFirstDayOfMonth <= msOfMin) ||
12972
+ (msOfMax !== 0 && position === "right" && msOfLastDayOfMonth >= msOfMax);
12973
+ var mobileLeftArrowDisabled = msOfMin !== 0 && msOfFirstDayOfMonth <= msOfMin;
12974
+ var mobileRightArrowDisabled = msOfMax !== 0 && msOfLastDayOfMonth >= msOfMax;
12975
+ var classes = useStylesForCalendar();
12976
+ var theme = core.useTheme();
12977
+ return (React__default.createElement("div", null,
12978
+ React__default.createElement("div", { className: classes.head },
12979
+ year,
12980
+ "\u5E74",
12981
+ month,
12982
+ "\u6708",
12983
+ !mobile ? (React__default.createElement(IconButton, { onClick: position === "left" ? leftClick : rightClick, disabled: arrowDisabled, style: {
12984
+ position: "absolute",
12985
+ left: position === "left" ? 8 : undefined,
12986
+ right: position === "left" ? undefined : 8,
12987
+ top: 8,
12988
+ opacity: arrowDisabled ? 0.4 : undefined,
12989
+ } }, position === "left" ? icon_arrowleft : icon_arrowright)) : (React__default.createElement(React__default.Fragment, null,
12990
+ React__default.createElement(IconButton, { onClick: leftClick, disabled: mobileLeftArrowDisabled, style: {
12991
+ position: "absolute",
12992
+ left: 8,
12993
+ top: 8,
12994
+ opacity: mobileLeftArrowDisabled ? 0.4 : undefined,
12995
+ } }, icon_arrowleft),
12996
+ React__default.createElement(IconButton, { onClick: rightClick, disabled: mobileRightArrowDisabled, style: {
12997
+ position: "absolute",
12998
+ right: 8,
12999
+ top: 8,
13000
+ opacity: mobileRightArrowDisabled ? 0.4 : undefined,
13001
+ } }, icon_arrowright)))),
13002
+ React__default.createElement("div", { className: classes.body },
13003
+ ["日", "一", "二", "三", "四", "五", "六"].map(function (i) { return (React__default.createElement("div", { key: i, className: classes.days }, i)); }),
13004
+ Array.from(Array(month === 2
13005
+ ? year % 4 === 0
13006
+ ? 29 + firstDayOfMonth(year, month)
13007
+ : 28 + firstDayOfMonth(year, month)
13008
+ : isBigMonth
13009
+ ? 31 + firstDayOfMonth(year, month)
13010
+ : 30 + firstDayOfMonth(year, month)).keys()).map(function (_i, i) {
13011
+ if (i + 1 <= firstDayOfMonth(year, month))
13012
+ return (React__default.createElement("div", { key: i, style: {
13013
+ width: 32,
13014
+ height: 32,
13015
+ } }));
13016
+ var dateNumber = i + 1 - firstDayOfMonth(year, month);
13017
+ var isSelected = year === selectedYear &&
13018
+ month === selectedMonth &&
13019
+ dateNumber === selectedDate;
13020
+ var isToday = year === today.getFullYear() &&
13021
+ month === today.getMonth() + 1 &&
13022
+ dateNumber === today.getDate();
13023
+ var msOfDate = new Date(year + "-" + month + "-" + dateNumber).getTime();
13024
+ var disabled = (msOfMin !== 0 && msOfDate < msOfMin) ||
13025
+ (msOfMax !== 0 && msOfDate > msOfMax);
13026
+ return (React__default.createElement("div", { key: i, className: classes.date, onClick: function () {
13027
+ setDate(year + "-" + month + "-" + dateNumber);
13028
+ setIsClicked(true);
13029
+ }, style: {
13030
+ backgroundColor: isSelected
13031
+ ? theme.primary.primary400
13032
+ : isToday
13033
+ ? theme.black.black400
13034
+ : undefined,
13035
+ color: isSelected ? theme.black.white : undefined,
13036
+ border: isSelected
13037
+ ? "1px solid " + theme.primary.primary600
13038
+ : undefined,
13039
+ opacity: disabled ? 0.4 : undefined,
13040
+ pointerEvents: disabled ? "none" : undefined,
13041
+ } }, dateNumber));
13042
+ }))));
13043
+ };
13044
+ var firstDayOfMonth = function (year, month) {
13045
+ var firstDay = year + "-" + month + "-" + 1;
13046
+ return new Date(firstDay).getDay();
13047
+ };
13048
+ var verticalline = (React__default.createElement("div", { style: { width: 1, height: "100%", backgroundColor: "#cccccc" } }));
13049
+ 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
+ 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" })));
13051
+ var icon_arrowright = (React__default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
13052
+ React__default.createElement("path", { d: "M7.15833 13.8167L10.975 10L7.15833 6.175L8.33333 5L13.3333 10L8.33333 15L7.15833 13.8167Z", fill: "black" })));
13053
+ var icon_calendar = (React__default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
13054
+ React__default.createElement("path", { d: "M5.83333 8.33333H10V12.5H5.83333V8.33333ZM15.8333 15.8333H4.16667V6.66667H15.8333V15.8333ZM15.8333 2.5H15V0.833332H13.3333V2.5H6.66667V0.833332H5V2.5H4.16667C3.24167 2.5 2.5 3.25 2.5 4.16667V15.8333C2.5 16.2754 2.67559 16.6993 2.98816 17.0118C3.30072 17.3244 3.72464 17.5 4.16667 17.5H15.8333C16.2754 17.5 16.6993 17.3244 17.0118 17.0118C17.3244 16.6993 17.5 16.2754 17.5 15.8333V4.16667C17.5 3.72464 17.3244 3.30071 17.0118 2.98815C16.6993 2.67559 16.2754 2.5 15.8333 2.5Z", fill: "#6F6F6F" })));
13055
+
13056
+ var Breadcrumb = function (props) {
13057
+ var maxItems = props.maxItems, separator = props.separator, children = props.children, other = __rest(props, ["maxItems", "separator", "children"]);
13058
+ var _a = React.useState(false), isHoverThreeDots = _a[0], setIsHoverThreeDots = _a[1];
13059
+ var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
13060
+ var handleThreeDotsClick = function (event) {
13061
+ setAnchorEl(event.currentTarget);
13062
+ };
13063
+ var handleThreeDotsClose = function () {
13064
+ setAnchorEl(null);
13065
+ };
13066
+ return (React__default.createElement("div", __assign({ style: { display: "flex", alignItems: "center" } }, other),
13067
+ maxItems && (children === null || children === void 0 ? void 0 : children.length) > maxItems ? (
13068
+ /**隱藏內容 */
13069
+ React__default.createElement(React__default.Fragment, null,
13070
+ React__default.createElement("div", { style: {
13071
+ display: "flex",
13072
+ alignItems: "center",
13073
+ fontSize: 14,
13074
+ fontWeight: 400,
13075
+ } },
13076
+ children[0],
13077
+ React__default.createElement(Typography, { variant: "body2", style: { margin: "0 8px" } }, separator ? separator : "/"),
13078
+ React__default.createElement("div", { onClick: handleThreeDotsClick, onMouseEnter: function () { return setIsHoverThreeDots(true); }, onMouseLeave: function () { return setIsHoverThreeDots(false); }, style: { cursor: "pointer" } }, isHoverThreeDots ? icon_threedots_hover : icon_threedots),
13079
+ React__default.createElement(Typography, { variant: "body2", style: { margin: "0 8px" } }, separator ? separator : "/")),
13080
+ children
13081
+ .slice((children === null || children === void 0 ? void 0 : children.length) - maxItems + 1)
13082
+ .map(function (i, index) {
13083
+ return (React__default.createElement("div", { key: Math.random().toString(36).substr(2), style: {
13084
+ display: "flex",
13085
+ alignItems: "center",
13086
+ fontSize: 14,
13087
+ fontWeight: index + 1 === (children === null || children === void 0 ? void 0 : children.length) ? 700 : 400,
13088
+ } },
13089
+ i,
13090
+ index + 1 !== maxItems - 1 && (React__default.createElement(Typography, { variant: "body2", style: { margin: "0 8px" } }, separator ? separator : "/"))));
13091
+ }))) : (children === null || children === void 0 ? void 0 : children.map(function (i, index) {
13092
+ return (React__default.createElement("div", { key: Math.random().toString(36).substr(2), style: {
13093
+ display: "flex",
13094
+ alignItems: "center",
13095
+ fontSize: 14,
13096
+ fontWeight: index + 1 === (children === null || children === void 0 ? void 0 : children.length) ? 700 : 400,
13097
+ } },
13098
+ i,
13099
+ index + 1 !== (children === null || children === void 0 ? void 0 : children.length) && (React__default.createElement(Typography, { variant: "body2", style: { margin: "0 8px" } }, separator ? separator : "/"))));
13100
+ })),
13101
+ React__default.createElement(Menu, { anchorEl: anchorEl, keepMounted: true, open: Boolean(anchorEl), onClose: handleThreeDotsClose, anchorOrigin: { vertical: "bottom", horizontal: -16 }, getContentAnchorEl: null }, children === null || children === void 0 ? void 0 : children.slice(1, (children === null || children === void 0 ? void 0 : children.length) - maxItems + 1).map(function (i) {
13102
+ var content = i.props.children;
13103
+ var href = i.props.href;
13104
+ var target = i.props.target;
13105
+ console.log(target);
13106
+ return (React__default.createElement(MenuItem, { key: Math.random().toString(36).substr(2), onClick: function () {
13107
+ if (target && target === "_blank") {
13108
+ window.open(href);
13109
+ }
13110
+ else {
13111
+ window.location.href = href;
13112
+ }
13113
+ } }, content));
13114
+ }))));
13115
+ };
13116
+ var icon_threedots = (React__default.createElement("svg", { width: "12", height: "20", viewBox: "0 0 12 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
13117
+ React__default.createElement("path", { d: "M1.946 16.182C2.45 16.182 2.87 15.79 2.87 15.216C2.87 14.642 2.45 14.222 1.946 14.222C1.442 14.222 1.022 14.642 1.022 15.216C1.022 15.79 1.442 16.182 1.946 16.182ZM5.84248 16.182C6.34648 16.182 6.76648 15.79 6.76648 15.216C6.76648 14.642 6.34648 14.222 5.84248 14.222C5.33848 14.222 4.91848 14.642 4.91848 15.216C4.91848 15.79 5.33848 16.182 5.84248 16.182ZM9.73897 16.182C10.243 16.182 10.663 15.79 10.663 15.216C10.663 14.642 10.243 14.222 9.73897 14.222C9.23497 14.222 8.81497 14.642 8.81497 15.216C8.81497 15.79 9.23497 16.182 9.73897 16.182Z", fill: "#4B4B4B" })));
13118
+ var icon_threedots_hover = (React__default.createElement("svg", { width: "12", height: "20", viewBox: "0 0 12 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
13119
+ React__default.createElement("path", { d: "M1.946 16.182C2.45 16.182 2.87 15.79 2.87 15.216C2.87 14.642 2.45 14.222 1.946 14.222C1.442 14.222 1.022 14.642 1.022 15.216C1.022 15.79 1.442 16.182 1.946 16.182ZM5.84248 16.182C6.34648 16.182 6.76648 15.79 6.76648 15.216C6.76648 14.642 6.34648 14.222 5.84248 14.222C5.33848 14.222 4.91848 14.642 4.91848 15.216C4.91848 15.79 5.33848 16.182 5.84248 16.182ZM9.73897 16.182C10.243 16.182 10.663 15.79 10.663 15.216C10.663 14.642 10.243 14.222 9.73897 14.222C9.23497 14.222 8.81497 14.642 8.81497 15.216C8.81497 15.79 9.23497 16.182 9.73897 16.182Z", fill: "#4B4B4B" }),
13120
+ React__default.createElement("path", { d: "M0 18.1H11.685V18.8H0V18.1Z", fill: "#4B4B4B" })));
13121
+
13122
+ var BreadcrumbItem = function (props) {
13123
+ var last = props.last, other = __rest(props, ["last"]);
13124
+ return (React__default.createElement(Link, __assign({}, other, { color: last ? "black1000" : "black800", style: {
13125
+ fontWeight: last ? 700 : 400,
13126
+ cursor: last ? "unset" : undefined,
13127
+ textDecoration: last ? "none" : undefined,
13128
+ } })));
13129
+ };
13130
+
13131
+ var useStyles$n = core.makeStyles(function (theme) { return ({
13132
+ root: function (props) { return ({
13133
+ width: props.width ? props.width : 350,
13134
+ height: props.height ? props.height : "100%",
13135
+ backgroundColor: theme.black.white,
13136
+ boxSizing: "border-box",
13137
+ border: "1px solid " + theme.black.black500,
13138
+ borderRadius: 8,
13139
+ display: "flex",
13140
+ flexDirection: "column",
13141
+ justifyContent: "space-between",
13142
+ overflow: "hidden",
13143
+ }); },
13144
+ body: { padding: 24, width: "100%", height: "100%" },
13145
+ buttonblock: {
13146
+ width: "100%",
13147
+ boxShadow: "0px -1px 0px " + theme.black.black400,
13148
+ borderRadius: " 0px 0px 8px 8px",
13149
+ display: "flex",
13150
+ padding: 0,
13151
+ },
13152
+ }); });
13153
+ var Card = function (props) {
13154
+ var width = props.width, height = props.height, children = props.children, buttons = props.buttons, bodyStyle = props.bodyStyle, loading = props.loading, other = __rest(props, ["width", "height", "children", "buttons", "bodyStyle", "loading"]);
13155
+ var useStylesProps = { width: width, height: height };
13156
+ var classes = useStyles$n(useStylesProps);
13157
+ var theme = core.useTheme();
13158
+ return (React__default.createElement("div", __assign({ className: classes.root }, other),
13159
+ React__default.createElement("div", { className: classes.body, style: bodyStyle }, !loading ? (children) : (React__default.createElement("div", { style: { width: "100%", height: "100%" } },
13160
+ React__default.createElement(Skeleton$1, { width: "40%", height: "calc((100% - 16px) /3 )" }),
13161
+ React__default.createElement(SWAPSpace, { size: 8 }),
13162
+ React__default.createElement(Skeleton$1, { width: "100%", height: "calc((100% - 16px) /3 )" }),
13163
+ React__default.createElement(SWAPSpace, { size: 8 }),
13164
+ React__default.createElement("div", { style: {
13165
+ display: "flex",
13166
+ justifyContent: "space-between",
13167
+ width: "100%",
13168
+ height: "calc((100% - 16px) /3 )",
13169
+ } },
13170
+ React__default.createElement(Skeleton$1, { width: "26.4%", height: "100%" }),
13171
+ React__default.createElement(Skeleton$1, { width: "26.4%", height: "100%" }))))),
13172
+ React__default.createElement("div", { className: classes.buttonblock }, !loading ? (buttons === null || buttons === void 0 ? void 0 : buttons.map(function (i, index) { return (React__default.createElement(Button, { key: Math.random().toString(36).substr(2), fullWidth: true, variant: i.variant ? i.variant : "black", style: __assign({ borderRight: index + 1 === (buttons === null || buttons === void 0 ? void 0 : buttons.length)
13173
+ ? undefined
13174
+ : "1px solid " + theme.black.black400, borderRadius: "0px 0px 0px 0px" }, i.style), onClick: i.onClick, disabled: i.disabled, loading: i.loading }, i.title)); })) : (React__default.createElement("div", { style: { padding: "16px 24px", width: "100%", height: 48 } },
13175
+ React__default.createElement(Skeleton$1, { width: "100%", height: "100%" }))))));
13176
+ };
13177
+
12648
13178
  var Container = function (_a) {
12649
13179
  var children = _a.children, style = _a.style, maxWidth = _a.maxWidth, padding = _a.padding;
12650
13180
  var XXS = useBreakpoints("xxs");
@@ -12722,12 +13252,16 @@ Object.defineProperty(exports, 'createMuiTheme', {
12722
13252
  });
12723
13253
  exports.AutoComplete = AutoComplete;
12724
13254
  exports.Banner = Banner;
13255
+ exports.Breadcrumb = Breadcrumb;
13256
+ exports.BreadcrumbItem = BreadcrumbItem;
12725
13257
  exports.Button = Button;
13258
+ exports.Card = Card;
12726
13259
  exports.CheckBox = CheckBox;
12727
13260
  exports.CheckBoxList = CheckBoxList;
12728
13261
  exports.Chip = Chip;
12729
13262
  exports.CircularProgress = CircularProgress;
12730
13263
  exports.Container = Container;
13264
+ exports.DatePicker = DatePicker;
12731
13265
  exports.Dropdown = Dropdown;
12732
13266
  exports.IconButton = IconButton;
12733
13267
  exports.Link = Link;