@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.
@@ -1,4 +1,4 @@
1
- import { AppBar, Toolbar, Container as Container$1, Grid, Button as Button$1, Typography as Typography$1, IconButton as IconButton$1, Menu as Menu$1, MenuItem as MenuItem$1, Divider, Fade, Paper as Paper$1, TextField as TextField$1, Dialog, Modal as Modal$1, Breadcrumbs, Slide, FormControl, InputLabel, Select as Select$1, CssBaseline, Box, useTheme as useTheme$1, makeStyles as makeStyles$1, useMediaQuery, FormControlLabel, OutlinedInput, FormHelperText, ListItemIcon, Backdrop, fade as fade$1, Popper as Popper$1, InputBase } from '@material-ui/core';
1
+ import { AppBar, Toolbar, Container as Container$1, Grid, Button as Button$1, Typography as Typography$1, IconButton as IconButton$1, Menu as Menu$1, MenuItem as MenuItem$1, Divider, Fade, Paper as Paper$1, TextField as TextField$1, Dialog, Modal as Modal$1, Breadcrumbs, Slide, FormControl, InputLabel, Select as Select$1, CssBaseline, Box, useTheme as useTheme$1, makeStyles as makeStyles$1, useMediaQuery, FormControlLabel, OutlinedInput, FormHelperText, ListItemIcon, Backdrop, fade as fade$1, Popper as Popper$1, InputBase, Grow } from '@material-ui/core';
2
2
  export { CssBaseline } from '@material-ui/core';
3
3
  import React__default, { useEffect, useState, Component as Component$1, forwardRef, useRef, useLayoutEffect as useLayoutEffect$1, useCallback, createElement, createContext, useContext, useMemo, Fragment as Fragment$1 } from 'react';
4
4
  import styled from 'styled-components';
@@ -2710,11 +2710,9 @@ var useStyles$2 = makeStyles$1(function (theme) { return ({
2710
2710
  borderColor: theme.black.black500,
2711
2711
  },
2712
2712
  "&.Mui-focused": {
2713
- boxShadow: props.select ? "unset" : "0px 0px 0px 4px #D7DFF8",
2713
+ boxShadow: "0px 0px 0px 4px #D7DFF8",
2714
2714
  "& fieldset": {
2715
- border: props.select
2716
- ? "1px solid " + theme.black.black1000 + " !important"
2717
- : "1px solid " + theme.primary.primary400 + " !important",
2715
+ border: "1px solid " + theme.primary.primary400 + " !important",
2718
2716
  borderWidth: "1px !important",
2719
2717
  },
2720
2718
  "&.Mui-error": {
@@ -3102,7 +3100,7 @@ var Button = function (props) {
3102
3100
  : variant === "secondary"
3103
3101
  ? theme.primary.primary400
3104
3102
  : variant === "tertiary"
3105
- ? theme.primary.primary500
3103
+ ? theme.black.black800
3106
3104
  : variant === "text"
3107
3105
  ? theme.primary.primary400
3108
3106
  : variant === "black"
@@ -3115,7 +3113,7 @@ var Button = function (props) {
3115
3113
  : variant === "secondary"
3116
3114
  ? theme.black.white
3117
3115
  : variant === "tertiary"
3118
- ? theme.primary.primary50
3116
+ ? theme.black.black400
3119
3117
  : variant === "text"
3120
3118
  ? theme.black.white
3121
3119
  : variant === "black"
@@ -3160,7 +3158,7 @@ var Button = function (props) {
3160
3158
  : variant === "secondary"
3161
3159
  ? theme.primary.primary50
3162
3160
  : variant === "tertiary"
3163
- ? theme.primary.primary100
3161
+ ? theme.black.black500
3164
3162
  : variant === "text"
3165
3163
  ? theme.primary.primary50
3166
3164
  : variant === "black"
@@ -3184,7 +3182,7 @@ var Button = function (props) {
3184
3182
  : variant === "secondary"
3185
3183
  ? theme.primary.primary100
3186
3184
  : variant === "tertiary"
3187
- ? theme.primary.primary200
3185
+ ? theme.black.black600
3188
3186
  : variant === "text"
3189
3187
  ? theme.primary.primary100
3190
3188
  : variant === "black"
@@ -3198,13 +3196,15 @@ var Button = function (props) {
3198
3196
  ? "0px 0px 0px 4px #CCCCCC"
3199
3197
  : variant === "danger"
3200
3198
  ? "0px 0px 0px 4px #FFCCD0"
3201
- : "0px 0px 0px 4px #D7DFF8",
3199
+ : variant === "tertiary"
3200
+ ? "0px 0px 0px 4px rgba(0, 0, 0, 0.1)"
3201
+ : "0px 0px 0px 4px #D7DFF8",
3202
3202
  backgroundColor: variant === "primary"
3203
3203
  ? theme.primary.primary400
3204
3204
  : variant === "secondary"
3205
3205
  ? theme.primary.primary50
3206
3206
  : variant === "tertiary"
3207
- ? theme.primary.primary50
3207
+ ? theme.black.black400
3208
3208
  : variant === "text"
3209
3209
  ? theme.primary.primary50
3210
3210
  : variant === "black"
@@ -3215,7 +3215,7 @@ var Button = function (props) {
3215
3215
  border: variant === "secondary"
3216
3216
  ? "1px solid " + theme.primary.primary400
3217
3217
  : variant === "tertiary"
3218
- ? "1px solid " + theme.primary.primary400
3218
+ ? "1px solid " + theme.black.black600
3219
3219
  : variant === "text"
3220
3220
  ? "1px solid " + theme.primary.primary400
3221
3221
  : variant === "black"
@@ -3231,7 +3231,7 @@ var Button = function (props) {
3231
3231
  : variant === "secondary"
3232
3232
  ? theme.black.white
3233
3233
  : variant === "tertiary"
3234
- ? theme.primary.primary100
3234
+ ? theme.black.black400
3235
3235
  : variant === "text"
3236
3236
  ? theme.black.white
3237
3237
  : variant === "black"
@@ -3244,7 +3244,7 @@ var Button = function (props) {
3244
3244
  : variant === "secondary"
3245
3245
  ? theme.primary.primary400
3246
3246
  : variant === "tertiary"
3247
- ? theme.primary.primary500
3247
+ ? theme.black.black800
3248
3248
  : variant === "text"
3249
3249
  ? theme.primary.primary400
3250
3250
  : variant === "black"
@@ -6670,7 +6670,7 @@ var Modal = React__default.forwardRef(function (props, ref) {
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 () {
6673
- if (mobile && fullWidth) {
6673
+ if (mobile || fullWidth) {
6674
6674
  if ((helpText || multiline) && !label) {
6675
6675
  setClientHeight(window.innerHeight - 64 - 73 - 64);
6676
6676
  }
@@ -6684,7 +6684,7 @@ var Modal = React__default.forwardRef(function (props, ref) {
6684
6684
  setClientHeight(window.innerHeight - 64 - 56 - 64);
6685
6685
  }
6686
6686
  }
6687
- }, []);
6687
+ }, [fullWidth, mobile]);
6688
6688
  useEffect(function () {
6689
6689
  var scrollbar_width = window.innerWidth - document.body.clientWidth;
6690
6690
  setScorllbarWidth(scrollbar_width / 2);
@@ -7008,7 +7008,7 @@ var Modal = React__default.forwardRef(function (props, ref) {
7008
7008
  pointerEvents: onExit ? "none" : "unset",
7009
7009
  maxHeight: bodyMaxHeight
7010
7010
  ? bodyMaxHeight
7011
- : mobile && fullWidth
7011
+ : fullWidth
7012
7012
  ? clientHeight
7013
7013
  : "unset",
7014
7014
  overflowY: !onExit ? "scroll" : "hidden",
@@ -7129,12 +7129,15 @@ var Modal = React__default.forwardRef(function (props, ref) {
7129
7129
  children))) : null,
7130
7130
  (label || secondaryButton || primaryButton) && !disUnderLine ? (React__default.createElement(Divider, null)) : null,
7131
7131
  React__default.createElement(Box, { className: classes.footer }, footer ? (footer) : (React__default.createElement(React__default.Fragment, null,
7132
- !buttonFullWidth || !footerDisplayColumn ? (React__default.createElement(Box, { marginBottom: mobile ? (label ? "12px" : 0) : 0 },
7133
- React__default.createElement(Typography, { variant: mobile ? "title" : "h6" }, label))) : null,
7132
+ !buttonFullWidth || !footerDisplayColumn ? (React__default.createElement(Box, { marginBottom: mobile ? (label ? "12px" : 0) : 0, style: {
7133
+ fontSize: mobile ? 16 : 18,
7134
+ fontWeight: 700,
7135
+ lineHeight: 1.4,
7136
+ } }, label)) : null,
7134
7137
  secondaryButton || primaryButton ? (React__default.createElement(Box, { className: classes.footerButton },
7135
7138
  React__default.createElement(Box, { width: mobile && !buttonFullWidth && !footerDisplayColumn
7136
7139
  ? null
7137
- : "100%", marginRight: !footerDisplayColumn ? 1 : 0 }, secondaryButton ? (React__default.createElement(Button, { fullWidth: buttonFullWidth || footerDisplayColumn, variant: secondaryButton.variant
7140
+ : "100%", marginRight: !footerDisplayColumn && secondaryButton ? 1 : 0 }, secondaryButton ? (React__default.createElement(Button, { fullWidth: buttonFullWidth || footerDisplayColumn, variant: secondaryButton.variant
7138
7141
  ? secondaryButton.variant
7139
7142
  : "secondary", size: "small", onClick: secondaryButton.onClick, disabled: secondaryButton.disabled, loading: secondaryButton.loading, style: secondaryButton.style }, secondaryButton.title)) : null),
7140
7143
  React__default.createElement(Box, { width: "100%", marginBottom: footerDisplayColumn ? 1 : 0 }, primaryButton ? (React__default.createElement(Button, { fullWidth: buttonFullWidth || footerDisplayColumn || mobile, variant: primaryButton.variant
@@ -11779,7 +11782,7 @@ var AutoComplete = function (props) {
11779
11782
  };
11780
11783
 
11781
11784
  var TaxTextField = function (_a) {
11782
- 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;
11785
+ 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;
11783
11786
  var _b = useState(""), modalIncome = _b[0], setModalIncome = _b[1];
11784
11787
  var _c = useState(""), modalExpense = _c[0], setModalExpense = _c[1];
11785
11788
  var handleModalTaxDescription = function () {
@@ -11836,7 +11839,7 @@ var TaxTextField = function (_a) {
11836
11839
  justifyContent: "space-between",
11837
11840
  } },
11838
11841
  React__default.createElement("div", { style: { width: "100%" } },
11839
- 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) {
11842
+ 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) {
11840
11843
  setModalIncome(e.target.value);
11841
11844
  setModalExpense("");
11842
11845
  } },
@@ -11868,7 +11871,7 @@ var TaxTextField = function (_a) {
11868
11871
  margin: mobile ? "24px 0 0 0 " : "0 0 0 8px",
11869
11872
  } }, codeValue === "9B" ? (
11870
11873
  // 9B Select
11871
- 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) {
11874
+ 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) {
11872
11875
  setModalExpense(e.target.value);
11873
11876
  setAnchorEl(null);
11874
11877
  } },
@@ -11897,7 +11900,7 @@ var TaxTextField = function (_a) {
11897
11900
  option.label)); }))) : (
11898
11901
  // 9A AutoComplete
11899
11902
  React__default.createElement(React__default.Fragment, null,
11900
- 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: {
11903
+ 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: {
11901
11904
  endAdornment: (React__default.createElement("div", { style: { width: 24, height: 24 } },
11902
11905
  React__default.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
11903
11906
  React__default.createElement("path", { d: "M7 10L12 15L17 10H7Z", fill: "black" })))),
@@ -12640,6 +12643,533 @@ var Switch = function (props) {
12640
12643
  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))));
12641
12644
  };
12642
12645
 
12646
+ var useStylesForMonthButton = makeStyles$1(function (theme) { return ({
12647
+ root: function (props) { return ({
12648
+ width: "100%",
12649
+ height: "100%",
12650
+ borderRadius: 8,
12651
+ border: props.selected
12652
+ ? "1px solid " + theme.primary.primary300
12653
+ : "1px solid " + theme.black.black500,
12654
+ boxSizing: "border-box",
12655
+ display: "flex",
12656
+ alignItems: "center",
12657
+ justifyContent: "center",
12658
+ fontSize: 14,
12659
+ fontWeight: 700,
12660
+ lineHeight: 1.4,
12661
+ backgroundColor: props.selected
12662
+ ? theme.primary.primary50
12663
+ : theme.black.white,
12664
+ cursor: "pointer",
12665
+ "&:hover": {
12666
+ border: props.selected
12667
+ ? "1px solid " + theme.primary.primary300
12668
+ : "1px solid " + theme.black.black600,
12669
+ backgroundColor: props.selected
12670
+ ? theme.primary.primary50
12671
+ : theme.black.black100,
12672
+ },
12673
+ }); },
12674
+ }); });
12675
+ var useStylesForCalendar = makeStyles$1(function (theme) { return ({
12676
+ head: {
12677
+ width: "100%",
12678
+ display: "flex",
12679
+ alignItems: "center",
12680
+ justifyContent: "center",
12681
+ height: 48,
12682
+ fontSize: 14,
12683
+ fontWeight: 700,
12684
+ marginBottom: 8,
12685
+ position: "relative",
12686
+ },
12687
+ body: {
12688
+ display: "grid",
12689
+ gridTemplateColumns: "1fr 1fr 1fr 1fr 1fr 1fr 1fr",
12690
+ gap: 8,
12691
+ },
12692
+ days: {
12693
+ width: 32,
12694
+ height: 32,
12695
+ display: "flex",
12696
+ alignItems: "center",
12697
+ justifyContent: "center",
12698
+ fontSize: 14,
12699
+ color: theme.black.black600,
12700
+ },
12701
+ date: {
12702
+ width: 32,
12703
+ height: 32,
12704
+ display: "flex",
12705
+ alignItems: "center",
12706
+ justifyContent: "center",
12707
+ marginBottom: 4,
12708
+ fontSize: 14,
12709
+ fontWeight: 700,
12710
+ color: theme.black.black800,
12711
+ cursor: "pointer",
12712
+ borderRadius: "50%",
12713
+ "&:hover": {
12714
+ backgroundColor: theme.primary.primary50,
12715
+ },
12716
+ },
12717
+ }); });
12718
+ 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"]);
12720
+ var _a = useState(Number(new Date().getFullYear())), year = _a[0], setYear = _a[1];
12721
+ var _b = useState(Number(new Date().getMonth() + 1)), month = _b[0], setMonth = _b[1];
12722
+ var _c = useState(1), nextMonth = _c[0], setNextMonth = _c[1];
12723
+ var _d = useState(""), date = _d[0], setDate = _d[1];
12724
+ var _e = useState(false), isOpenMonthSelector = _e[0], setIsOpenMonthSelector = _e[1];
12725
+ var _f = useState(false), isClicked = _f[0], setIsClicked = _f[1];
12726
+ useEffect(function () {
12727
+ if (format === "month") {
12728
+ if (month % 2 === 0) {
12729
+ setMonth(month - 1);
12730
+ }
12731
+ else {
12732
+ if (month < 1) {
12733
+ setMonth(11);
12734
+ setYear(year - 1);
12735
+ }
12736
+ if (month > 12) {
12737
+ setMonth(1);
12738
+ setYear(year + 1);
12739
+ }
12740
+ }
12741
+ }
12742
+ }, [month]);
12743
+ useEffect(function () {
12744
+ if (isClicked && getValue) {
12745
+ if (format === "month") {
12746
+ if (month < 1) {
12747
+ getValue(year - 1 + "-11");
12748
+ }
12749
+ else if (month > 12) {
12750
+ getValue(year + 1 + "-1");
12751
+ }
12752
+ else {
12753
+ getValue(year + "-" + month);
12754
+ }
12755
+ }
12756
+ else if (format === "day") {
12757
+ getValue(date);
12758
+ }
12759
+ else {
12760
+ getValue(String(year));
12761
+ }
12762
+ setIsClicked(false);
12763
+ }
12764
+ }, [isClicked]);
12765
+ return (React__default.createElement("div", __assign({}, other), format !== "day" ? (React__default.createElement("div", { style: {
12766
+ borderRadius: 8,
12767
+ border: "1px solid #cccccc",
12768
+ boxSizing: "border-box",
12769
+ width: format === "month" ? 219 : 180,
12770
+ height: 40,
12771
+ display: "grid",
12772
+ alignItems: "center",
12773
+ gridTemplateColumns: "36px 1px 1fr 1px 36px",
12774
+ position: "relative",
12775
+ } },
12776
+ React__default.createElement(IconButton, { onClick: function () {
12777
+ if (format === "month") {
12778
+ setMonth(month - 2);
12779
+ }
12780
+ else {
12781
+ setYear(year - 1);
12782
+ }
12783
+ setIsClicked(true);
12784
+ }, style: {
12785
+ width: "100%",
12786
+ height: "100%",
12787
+ display: "flex",
12788
+ justifyContent: "center",
12789
+ alignItems: "center",
12790
+ borderRadius: "8px 0 0 8px",
12791
+ } }, icon_arrowleft),
12792
+ verticalline,
12793
+ React__default.createElement("div", { style: {
12794
+ display: "flex",
12795
+ justifyContent: "center",
12796
+ alignItems: "center",
12797
+ } },
12798
+ icon_calendar,
12799
+ format === "month" ? (React__default.createElement("div", { style: {
12800
+ fontSize: 14,
12801
+ fontWeight: 700,
12802
+ lineHeight: 1.4,
12803
+ marginLeft: 4,
12804
+ cursor: "pointer",
12805
+ }, onClick: function () { return setIsOpenMonthSelector(!isOpenMonthSelector); } },
12806
+ year,
12807
+ "\u5E74",
12808
+ month,
12809
+ "-",
12810
+ month + 1,
12811
+ "\u6708")) : (React__default.createElement("div", { style: {
12812
+ fontSize: 14,
12813
+ fontWeight: 700,
12814
+ lineHeight: 1.4,
12815
+ marginLeft: 4,
12816
+ } },
12817
+ year,
12818
+ "\u5E74"))),
12819
+ verticalline,
12820
+ React__default.createElement(IconButton, { onClick: function () {
12821
+ if (format === "month") {
12822
+ setMonth(month + 2);
12823
+ }
12824
+ else {
12825
+ setYear(year + 1);
12826
+ }
12827
+ setIsClicked(true);
12828
+ }, style: {
12829
+ width: "100%",
12830
+ height: "100%",
12831
+ display: "flex",
12832
+ justifyContent: "center",
12833
+ alignItems: "center",
12834
+ borderRadius: "0 8px 8px 0",
12835
+ } }, icon_arrowright),
12836
+ format === "month" ? (React__default.createElement(Grow, { in: isOpenMonthSelector, style: { transformOrigin: "0 0 0" } },
12837
+ React__default.createElement("div", { style: {
12838
+ border: "1px solid #cccccc",
12839
+ borderRadius: 8,
12840
+ boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
12841
+ boxSizing: "border-box",
12842
+ width: 302,
12843
+ height: 160,
12844
+ position: "absolute",
12845
+ backgroundColor: "#ffffff",
12846
+ zIndex: 1,
12847
+ top: 52,
12848
+ left: 0,
12849
+ } },
12850
+ React__default.createElement("div", { style: {
12851
+ height: 48,
12852
+ padding: 8,
12853
+ display: "grid",
12854
+ gridTemplateColumns: "32px 1fr 32px",
12855
+ gap: 13,
12856
+ alignItems: "center",
12857
+ boxShadow: "0px 1px 0px #ECECEC",
12858
+ } },
12859
+ React__default.createElement(IconButton, { hoverColor: "black400", onClick: function () {
12860
+ setYear(year - 1);
12861
+ setIsClicked(true);
12862
+ } }, icon_arrowleft),
12863
+ React__default.createElement(Typography, { variant: "subtitle", style: { textAlign: "center" } },
12864
+ year,
12865
+ "\u5E74"),
12866
+ React__default.createElement(IconButton, { hoverColor: "black400", onClick: function () {
12867
+ setYear(year + 1);
12868
+ setIsClicked(true);
12869
+ } }, icon_arrowright)),
12870
+ React__default.createElement("div", { style: {
12871
+ padding: 16,
12872
+ display: "grid",
12873
+ alignItems: "center",
12874
+ gap: 8,
12875
+ gridTemplateColumns: "1fr 1fr 1fr",
12876
+ gridTemplateRows: "36px 36px",
12877
+ } }, 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
+ React__default.createElement("span", { style: { fontWeight: 400 } }, "\u5DF2\u9078\u64C7\uFF1A"),
12879
+ date &&
12880
+ date.split("-")[0] + "\u5E74" + date.split("-")[1] + "\u6708" + date.split("-")[2] + "\u65E5")) : (React__default.createElement(React__default.Fragment, null,
12881
+ React__default.createElement(Typography, { variant: "caption2" },
12882
+ React__default.createElement("span", { style: { fontWeight: 400 } }, "\u5DF2\u9078\u64C7\uFF1A")),
12883
+ React__default.createElement(Typography, { variant: "subtitle" }, date &&
12884
+ date.split("-")[0] + "\u5E74" + date.split("-")[1] + "\u6708" + date.split("-")[2] + "\u65E5"))), primaryButton: {
12885
+ title: "確認",
12886
+ onClick: function () {
12887
+ onClose();
12888
+ },
12889
+ }, secondaryButton: { title: "取消", onClick: onClose }, children: !mobile ? (React__default.createElement("div", { style: { display: "flex", justifyContent: "space-between" } },
12890
+ React__default.createElement(Calendar, { month: month, year: year, date: date, setDate: setDate, min: min, max: max, position: "left", leftClick: function () {
12891
+ if (month - 1 < 1) {
12892
+ setMonth(12);
12893
+ setYear(year - 1);
12894
+ }
12895
+ else {
12896
+ setMonth(month - 1);
12897
+ }
12898
+ setNextMonth(month);
12899
+ }, defaultValue: defaultValue, setIsClicked: setIsClicked }),
12900
+ React__default.createElement(Calendar, { month: nextMonth, year: month > nextMonth ? year + 1 : year, date: date, setDate: setDate, min: min, max: max, position: "right", rightClick: function () {
12901
+ if (nextMonth + 1 > 12) {
12902
+ setMonth(12);
12903
+ setNextMonth(1);
12904
+ }
12905
+ else if (month + 1 > 12) {
12906
+ setMonth(1);
12907
+ setNextMonth(2);
12908
+ setYear(year + 1);
12909
+ }
12910
+ else {
12911
+ setMonth(month + 1);
12912
+ setNextMonth(nextMonth + 1);
12913
+ }
12914
+ }, defaultValue: defaultValue, setIsClicked: setIsClicked }))) : (React__default.createElement(Calendar, { month: month, year: year, date: date, setDate: setDate, min: min, max: max, position: "left", leftClick: function () {
12915
+ if (month - 1 < 1) {
12916
+ setMonth(12);
12917
+ setYear(year - 1);
12918
+ }
12919
+ else {
12920
+ setMonth(month - 1);
12921
+ }
12922
+ setNextMonth(month);
12923
+ }, rightClick: function () {
12924
+ if (nextMonth + 1 > 12) {
12925
+ setMonth(12);
12926
+ setNextMonth(1);
12927
+ }
12928
+ else if (month + 1 > 12) {
12929
+ setMonth(1);
12930
+ setNextMonth(2);
12931
+ setYear(year + 1);
12932
+ }
12933
+ else {
12934
+ setMonth(month + 1);
12935
+ setNextMonth(nextMonth + 1);
12936
+ }
12937
+ }, defaultValue: defaultValue, setIsClicked: setIsClicked, mobile: mobile })) }, ModalProps)))));
12938
+ };
12939
+ var MonthButton = function (_a) {
12940
+ var index = _a.index, month = _a.month, setMonth = _a.setMonth, setIsOpenMonthSelector = _a.setIsOpenMonthSelector, setIsClicked = _a.setIsClicked;
12941
+ var styleProps = {
12942
+ selected: 1 + 2 * index === month,
12943
+ };
12944
+ var classes = useStylesForMonthButton(styleProps);
12945
+ return (React__default.createElement("div", { className: classes.root, onClick: function () {
12946
+ setMonth(1 + 2 * index);
12947
+ setIsOpenMonthSelector(false);
12948
+ setIsClicked(true);
12949
+ } },
12950
+ 1 + 2 * index,
12951
+ "-",
12952
+ 2 + 2 * index,
12953
+ "\u6708"));
12954
+ };
12955
+ var Calendar = function (_a) {
12956
+ 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
+ var isBigMonth = (month <= 7 && month % 2 !== 0) || (month >= 8 && month % 2 === 0);
12958
+ var today = defaultValue ? new Date(defaultValue) : new Date();
12959
+ var selectedYear = Number(date.split("-")[0]);
12960
+ var selectedMonth = Number(date.split("-")[1]);
12961
+ var selectedDate = Number(date.split("-")[2]);
12962
+ var msOfMin = min ? new Date(min).getTime() : 0;
12963
+ var msOfMax = max ? new Date(max).getTime() : 0;
12964
+ var msOfFirstDayOfMonth = new Date(year + "-" + month + "-1").getTime();
12965
+ var msOfLastDayOfMonth = new Date(year + "-" + month + "-" + (month === 2 ? (year % 4 === 0 ? 29 : 28) : isBigMonth ? 31 : 30)).getTime();
12966
+ var arrowDisabled = (msOfMin !== 0 && position === "left" && msOfFirstDayOfMonth <= msOfMin) ||
12967
+ (msOfMax !== 0 && position === "right" && msOfLastDayOfMonth >= msOfMax);
12968
+ var mobileLeftArrowDisabled = msOfMin !== 0 && msOfFirstDayOfMonth <= msOfMin;
12969
+ var mobileRightArrowDisabled = msOfMax !== 0 && msOfLastDayOfMonth >= msOfMax;
12970
+ var classes = useStylesForCalendar();
12971
+ var theme = useTheme$1();
12972
+ return (React__default.createElement("div", null,
12973
+ React__default.createElement("div", { className: classes.head },
12974
+ year,
12975
+ "\u5E74",
12976
+ month,
12977
+ "\u6708",
12978
+ !mobile ? (React__default.createElement(IconButton, { onClick: position === "left" ? leftClick : rightClick, disabled: arrowDisabled, style: {
12979
+ position: "absolute",
12980
+ left: position === "left" ? 8 : undefined,
12981
+ right: position === "left" ? undefined : 8,
12982
+ top: 8,
12983
+ opacity: arrowDisabled ? 0.4 : undefined,
12984
+ } }, position === "left" ? icon_arrowleft : icon_arrowright)) : (React__default.createElement(React__default.Fragment, null,
12985
+ React__default.createElement(IconButton, { onClick: leftClick, disabled: mobileLeftArrowDisabled, style: {
12986
+ position: "absolute",
12987
+ left: 8,
12988
+ top: 8,
12989
+ opacity: mobileLeftArrowDisabled ? 0.4 : undefined,
12990
+ } }, icon_arrowleft),
12991
+ React__default.createElement(IconButton, { onClick: rightClick, disabled: mobileRightArrowDisabled, style: {
12992
+ position: "absolute",
12993
+ right: 8,
12994
+ top: 8,
12995
+ opacity: mobileRightArrowDisabled ? 0.4 : undefined,
12996
+ } }, icon_arrowright)))),
12997
+ React__default.createElement("div", { className: classes.body },
12998
+ ["日", "一", "二", "三", "四", "五", "六"].map(function (i) { return (React__default.createElement("div", { key: i, className: classes.days }, i)); }),
12999
+ Array.from(Array(month === 2
13000
+ ? year % 4 === 0
13001
+ ? 29 + firstDayOfMonth(year, month)
13002
+ : 28 + firstDayOfMonth(year, month)
13003
+ : isBigMonth
13004
+ ? 31 + firstDayOfMonth(year, month)
13005
+ : 30 + firstDayOfMonth(year, month)).keys()).map(function (_i, i) {
13006
+ if (i + 1 <= firstDayOfMonth(year, month))
13007
+ return (React__default.createElement("div", { key: i, style: {
13008
+ width: 32,
13009
+ height: 32,
13010
+ } }));
13011
+ var dateNumber = i + 1 - firstDayOfMonth(year, month);
13012
+ var isSelected = year === selectedYear &&
13013
+ month === selectedMonth &&
13014
+ dateNumber === selectedDate;
13015
+ var isToday = year === today.getFullYear() &&
13016
+ month === today.getMonth() + 1 &&
13017
+ dateNumber === today.getDate();
13018
+ var msOfDate = new Date(year + "-" + month + "-" + dateNumber).getTime();
13019
+ var disabled = (msOfMin !== 0 && msOfDate < msOfMin) ||
13020
+ (msOfMax !== 0 && msOfDate > msOfMax);
13021
+ return (React__default.createElement("div", { key: i, className: classes.date, onClick: function () {
13022
+ setDate(year + "-" + month + "-" + dateNumber);
13023
+ setIsClicked(true);
13024
+ }, style: {
13025
+ backgroundColor: isSelected
13026
+ ? theme.primary.primary400
13027
+ : isToday
13028
+ ? theme.black.black400
13029
+ : undefined,
13030
+ color: isSelected ? theme.black.white : undefined,
13031
+ border: isSelected
13032
+ ? "1px solid " + theme.primary.primary600
13033
+ : undefined,
13034
+ opacity: disabled ? 0.4 : undefined,
13035
+ pointerEvents: disabled ? "none" : undefined,
13036
+ } }, dateNumber));
13037
+ }))));
13038
+ };
13039
+ var firstDayOfMonth = function (year, month) {
13040
+ var firstDay = year + "-" + month + "-" + 1;
13041
+ return new Date(firstDay).getDay();
13042
+ };
13043
+ var verticalline = (React__default.createElement("div", { style: { width: 1, height: "100%", backgroundColor: "#cccccc" } }));
13044
+ 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
+ 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" })));
13046
+ 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" },
13047
+ 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" })));
13048
+ 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" },
13049
+ 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" })));
13050
+
13051
+ var Breadcrumb = function (props) {
13052
+ var maxItems = props.maxItems, separator = props.separator, children = props.children, other = __rest(props, ["maxItems", "separator", "children"]);
13053
+ var _a = useState(false), isHoverThreeDots = _a[0], setIsHoverThreeDots = _a[1];
13054
+ var _b = useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
13055
+ var handleThreeDotsClick = function (event) {
13056
+ setAnchorEl(event.currentTarget);
13057
+ };
13058
+ var handleThreeDotsClose = function () {
13059
+ setAnchorEl(null);
13060
+ };
13061
+ return (React__default.createElement("div", __assign({ style: { display: "flex", alignItems: "center" } }, other),
13062
+ maxItems && (children === null || children === void 0 ? void 0 : children.length) > maxItems ? (
13063
+ /**隱藏內容 */
13064
+ React__default.createElement(React__default.Fragment, null,
13065
+ React__default.createElement("div", { style: {
13066
+ display: "flex",
13067
+ alignItems: "center",
13068
+ fontSize: 14,
13069
+ fontWeight: 400,
13070
+ } },
13071
+ children[0],
13072
+ React__default.createElement(Typography, { variant: "body2", style: { margin: "0 8px" } }, separator ? separator : "/"),
13073
+ 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),
13074
+ React__default.createElement(Typography, { variant: "body2", style: { margin: "0 8px" } }, separator ? separator : "/")),
13075
+ children
13076
+ .slice((children === null || children === void 0 ? void 0 : children.length) - maxItems + 1)
13077
+ .map(function (i, index) {
13078
+ return (React__default.createElement("div", { key: Math.random().toString(36).substr(2), style: {
13079
+ display: "flex",
13080
+ alignItems: "center",
13081
+ fontSize: 14,
13082
+ fontWeight: index + 1 === (children === null || children === void 0 ? void 0 : children.length) ? 700 : 400,
13083
+ } },
13084
+ i,
13085
+ index + 1 !== maxItems - 1 && (React__default.createElement(Typography, { variant: "body2", style: { margin: "0 8px" } }, separator ? separator : "/"))));
13086
+ }))) : (children === null || children === void 0 ? void 0 : children.map(function (i, index) {
13087
+ return (React__default.createElement("div", { key: Math.random().toString(36).substr(2), style: {
13088
+ display: "flex",
13089
+ alignItems: "center",
13090
+ fontSize: 14,
13091
+ fontWeight: index + 1 === (children === null || children === void 0 ? void 0 : children.length) ? 700 : 400,
13092
+ } },
13093
+ i,
13094
+ index + 1 !== (children === null || children === void 0 ? void 0 : children.length) && (React__default.createElement(Typography, { variant: "body2", style: { margin: "0 8px" } }, separator ? separator : "/"))));
13095
+ })),
13096
+ 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) {
13097
+ var content = i.props.children;
13098
+ var href = i.props.href;
13099
+ var target = i.props.target;
13100
+ console.log(target);
13101
+ return (React__default.createElement(MenuItem, { key: Math.random().toString(36).substr(2), onClick: function () {
13102
+ if (target && target === "_blank") {
13103
+ window.open(href);
13104
+ }
13105
+ else {
13106
+ window.location.href = href;
13107
+ }
13108
+ } }, content));
13109
+ }))));
13110
+ };
13111
+ 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" },
13112
+ 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" })));
13113
+ 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" },
13114
+ 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" }),
13115
+ React__default.createElement("path", { d: "M0 18.1H11.685V18.8H0V18.1Z", fill: "#4B4B4B" })));
13116
+
13117
+ var BreadcrumbItem = function (props) {
13118
+ var last = props.last, other = __rest(props, ["last"]);
13119
+ return (React__default.createElement(Link, __assign({}, other, { color: last ? "black1000" : "black800", style: {
13120
+ fontWeight: last ? 700 : 400,
13121
+ cursor: last ? "unset" : undefined,
13122
+ textDecoration: last ? "none" : undefined,
13123
+ } })));
13124
+ };
13125
+
13126
+ var useStyles$n = makeStyles$1(function (theme) { return ({
13127
+ root: function (props) { return ({
13128
+ width: props.width ? props.width : 350,
13129
+ height: props.height ? props.height : "100%",
13130
+ backgroundColor: theme.black.white,
13131
+ boxSizing: "border-box",
13132
+ border: "1px solid " + theme.black.black500,
13133
+ borderRadius: 8,
13134
+ display: "flex",
13135
+ flexDirection: "column",
13136
+ justifyContent: "space-between",
13137
+ overflow: "hidden",
13138
+ }); },
13139
+ body: { padding: 24, width: "100%", height: "100%" },
13140
+ buttonblock: {
13141
+ width: "100%",
13142
+ boxShadow: "0px -1px 0px " + theme.black.black400,
13143
+ borderRadius: " 0px 0px 8px 8px",
13144
+ display: "flex",
13145
+ padding: 0,
13146
+ },
13147
+ }); });
13148
+ var Card = function (props) {
13149
+ 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"]);
13150
+ var useStylesProps = { width: width, height: height };
13151
+ var classes = useStyles$n(useStylesProps);
13152
+ var theme = useTheme$1();
13153
+ return (React__default.createElement("div", __assign({ className: classes.root }, other),
13154
+ React__default.createElement("div", { className: classes.body, style: bodyStyle }, !loading ? (children) : (React__default.createElement("div", { style: { width: "100%", height: "100%" } },
13155
+ React__default.createElement(Skeleton$1, { width: "40%", height: "calc((100% - 16px) /3 )" }),
13156
+ React__default.createElement(SWAPSpace, { size: 8 }),
13157
+ React__default.createElement(Skeleton$1, { width: "100%", height: "calc((100% - 16px) /3 )" }),
13158
+ React__default.createElement(SWAPSpace, { size: 8 }),
13159
+ React__default.createElement("div", { style: {
13160
+ display: "flex",
13161
+ justifyContent: "space-between",
13162
+ width: "100%",
13163
+ height: "calc((100% - 16px) /3 )",
13164
+ } },
13165
+ React__default.createElement(Skeleton$1, { width: "26.4%", height: "100%" }),
13166
+ React__default.createElement(Skeleton$1, { width: "26.4%", height: "100%" }))))),
13167
+ 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)
13168
+ ? undefined
13169
+ : "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 } },
13170
+ React__default.createElement(Skeleton$1, { width: "100%", height: "100%" }))))));
13171
+ };
13172
+
12643
13173
  var Container = function (_a) {
12644
13174
  var children = _a.children, style = _a.style, maxWidth = _a.maxWidth, padding = _a.padding;
12645
13175
  var XXS = useBreakpoints("xxs");
@@ -12697,5 +13227,5 @@ var Container = function (_a) {
12697
13227
  return (React__default.createElement(MaterialContainer, { className: classes.root, style: style }, children));
12698
13228
  };
12699
13229
 
12700
- export { AutoComplete, Banner, Button, CheckBox, CheckBoxList, Chip, CircularProgress, Container, Dropdown, IconButton, Link, Menu, MenuItem, Modal, Pagination$1 as Pagination, Paper, Progress, RadioButton, RadioList, SWAPAppBar, SWAPBanner, SWAPCopyField, SWAPDialog, SWAPExpenseTypes, SWAPIncomeTypes, SWAPLogo, SWAPModal, SWAPShare, SWAPSpace, SWAPTaxDescription, SWAPTaxExpenseLabel, SWAPTaxField, SWAPTaxIncomeLabel, SWAPTheme, SegmentedTab, SegmentedTabs, Select, Skeleton$1 as Skeleton, Snackbar, Styles, Switch, Tab, TabPanel, Tabs, TaxTextField, TextField, Tooltip, Typography, useBreakpoints };
13230
+ export { AutoComplete, Banner, Breadcrumb, BreadcrumbItem, Button, Card, CheckBox, CheckBoxList, Chip, CircularProgress, Container, DatePicker, Dropdown, IconButton, Link, Menu, MenuItem, Modal, Pagination$1 as Pagination, Paper, Progress, RadioButton, RadioList, SWAPAppBar, SWAPBanner, SWAPCopyField, SWAPDialog, SWAPExpenseTypes, SWAPIncomeTypes, SWAPLogo, SWAPModal, SWAPShare, SWAPSpace, SWAPTaxDescription, SWAPTaxExpenseLabel, SWAPTaxField, SWAPTaxIncomeLabel, SWAPTheme, SegmentedTab, SegmentedTabs, Select, Skeleton$1 as Skeleton, Snackbar, Styles, Switch, Tab, TabPanel, Tabs, TaxTextField, TextField, Tooltip, Typography, useBreakpoints };
12701
13231
  //# sourceMappingURL=index.esm.js.map