@cleartrip/talos-button 1.2.0-beta-260730-3.0 → 1.2.0-beta-260730-4.0

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.
@@ -17689,7 +17689,9 @@
17689
17689
  var getStyledSegmentButtonStyles = function (_a) {
17690
17690
  var theme = _a.theme,
17691
17691
  isActive = _a.isActive,
17692
- isDisabled = _a.isDisabled;
17692
+ isDisabled = _a.isDisabled,
17693
+ index = _a.index;
17694
+ var isFirstTab = index === 0;
17693
17695
  return {
17694
17696
  background: 'transparent',
17695
17697
  color: isActive ? theme.color.text.primary : theme.color.text.subHeading,
@@ -17700,7 +17702,9 @@
17700
17702
  borderRadius: '60px',
17701
17703
  cursor: 'pointer',
17702
17704
  width: '100%',
17703
- opacity: isDisabled ? theme.opacity['0.5'] : 1
17705
+ opacity: isDisabled ? theme.opacity['0.5'] : 1,
17706
+ paddingRight: isActive && !isFirstTab ? '8px' : '0px',
17707
+ paddingLeft: isActive && isFirstTab ? '8px' : '0px'
17704
17708
  };
17705
17709
  };
17706
17710
  var getStyledAnimatedContainerBlock = function () {
@@ -17714,17 +17718,19 @@
17714
17718
  var getStyledAnimatedBlock = function (_a) {
17715
17719
  var activeIndex = _a.activeIndex,
17716
17720
  _b = _a.animationLength,
17717
- animationLength = _b === void 0 ? '1s' : _b;
17721
+ animationLength = _b === void 0 ? '1s' : _b,
17722
+ optionsCount = _a.optionsCount;
17718
17723
  var isFirstTab = activeIndex === 0;
17719
17724
  var offsetLeft = isFirstTab ? 4 : -4;
17725
+ var sliderWidth = 100 / optionsCount;
17720
17726
  return {
17721
17727
  position: 'absolute',
17722
- width: 'calc(100% - 50%)',
17728
+ width: "".concat(sliderWidth, "%"),
17723
17729
  height: '32px',
17724
17730
  borderRadius: '60px',
17725
17731
  backgroundColor: '#fff',
17726
17732
  top: '2.5px',
17727
- left: "calc(".concat(activeIndex ? 50 : 0, "% + ").concat(offsetLeft, "px)"),
17733
+ left: "calc(".concat(activeIndex * sliderWidth, "% + ").concat(offsetLeft, "px)"),
17728
17734
  transition: "left ".concat(animationLength),
17729
17735
  animationDuration: animationLength,
17730
17736
  animationFillMode: 'forwards'
@@ -17754,12 +17760,14 @@
17754
17760
  var theme = _a.theme,
17755
17761
  isActive = _a.isActive,
17756
17762
  isDisabled = _a.isDisabled,
17763
+ index = _a.index,
17757
17764
  _b = _a.css,
17758
17765
  css = _b === void 0 ? {} : _b;
17759
17766
  return __assign$4(__assign$4({}, getStyledSegmentButtonStyles({
17760
17767
  theme: theme,
17761
17768
  isActive: isActive,
17762
- isDisabled: isDisabled
17769
+ isDisabled: isDisabled,
17770
+ index: index
17763
17771
  })), css);
17764
17772
  });
17765
17773
  _default.div(function (_a) {
@@ -17769,10 +17777,14 @@
17769
17777
  });
17770
17778
  _default.div(function (_a) {
17771
17779
  var activeIndex = _a.activeIndex,
17780
+ animationLength = _a.animationLength,
17781
+ optionsCount = _a.optionsCount,
17772
17782
  _b = _a.css,
17773
17783
  css = _b === void 0 ? {} : _b;
17774
17784
  return __assign$4(__assign$4({}, getStyledAnimatedBlock({
17775
- activeIndex: activeIndex
17785
+ activeIndex: activeIndex,
17786
+ animationLength: animationLength,
17787
+ optionsCount: optionsCount
17776
17788
  })), css);
17777
17789
  });
17778
17790