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