@yosgo/swap-ui 1.0.129 → 1.0.130

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
@@ -2996,6 +2996,13 @@ var useStyles$5 = core.makeStyles(function (theme) { return ({
2996
2996
  height: props.slide ? "100%" : 0,
2997
2997
  backgroundColor: theme.primary.primary50,
2998
2998
  }); },
2999
+ scrollButtons: {
3000
+ width: 32,
3001
+ overflow: "hidden",
3002
+ "&.Mui-disabled": {
3003
+ width: 4,
3004
+ },
3005
+ },
2999
3006
  }); });
3000
3007
  var SegmentedTabs = function (_a) {
3001
3008
  var children = _a.children, width = _a.width, slide = _a.slide, other = __rest(_a, ["children", "width", "slide"]);
@@ -3004,23 +3011,30 @@ var SegmentedTabs = function (_a) {
3004
3011
  slide: slide,
3005
3012
  };
3006
3013
  var classes = useStyles$5(styleProps);
3014
+ var tabsRef = React.useRef(null);
3015
+ React.useEffect(function () {
3016
+ if (tabsRef &&
3017
+ tabsRef.current &&
3018
+ other.variant &&
3019
+ other.variant === "scrollable") {
3020
+ //確保 scrollable tabs 的 selected tab 能夠顯示出來
3021
+ var el_1 = tabsRef.current.querySelectorAll(".MuiButtonBase-root.MuiTab-root.MuiTab-textColorInherit.Mui-selected")[0];
3022
+ if (el_1) {
3023
+ setTimeout(function () {
3024
+ el_1.scrollIntoView({
3025
+ behavior: "smooth",
3026
+ block: "end",
3027
+ inline: "nearest",
3028
+ });
3029
+ }, 1000);
3030
+ }
3031
+ }
3032
+ }, []);
3007
3033
  return (React__default.createElement(MaterialTabs, __assign({}, other, { classes: {
3008
3034
  root: classes.root,
3009
3035
  indicator: classes.indicator,
3010
- }, indicatorColor: "primary", ScrollButtonComponent: function (props) {
3011
- //自訂按鈕,disabled 時不顯示按鈕
3012
- console.log(props);
3013
- if (props.disabled === true) {
3014
- return (React__default.createElement("div", { style: {
3015
- width: "5px",
3016
- transition: "width 1s",
3017
- transitionTimingFunction: "ease-in-out",
3018
- } }));
3019
- }
3020
- else {
3021
- return React__default.createElement(core.TabScrollButton, __assign({}, props));
3022
- }
3023
- } }), children));
3036
+ scrollButtons: classes.scrollButtons,
3037
+ }, indicatorColor: "primary", ref: tabsRef }), children));
3024
3038
  };
3025
3039
 
3026
3040
  function TabPanel(props) {