@mw-kit/mw-ui 1.7.47 → 1.7.48

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.
@@ -13063,7 +13063,7 @@ var Indicator = function Indicator(props) {
13063
13063
  }, props)));
13064
13064
  };
13065
13065
 
13066
- var _templateObject$b, _templateObject2$b, _templateObject3$a, _templateObject4$8, _templateObject5$7, _templateObject6$6, _templateObject7$6, _templateObject8$5, _templateObject9$5, _templateObject10$5, _templateObject11$2, _templateObject12$2, _templateObject13$2;
13066
+ var _templateObject$b, _templateObject2$b, _templateObject3$a, _templateObject4$8, _templateObject5$7, _templateObject6$6, _templateObject7$6, _templateObject8$5, _templateObject9$5, _templateObject10$5, _templateObject11$2;
13067
13067
  var Footer = styled.div(_templateObject$b || (_templateObject$b = _taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n > button:last-child {\n margin-left: auto;\n }\n"])));
13068
13068
  var WeekContainer = styled.div(_templateObject2$b || (_templateObject2$b = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n\n :not(:first-child) {\n border-top: 1px solid ", ";\n }\n\n > * {\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n width: 32px;\n height: 32px;\n\n color: ", ";\n box-shadow: none;\n\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n\n border: 1px solid transparent;\n :not(:last-child) {\n border-right-color: ", ";\n }\n }\n"])), function (_ref) {
13069
13069
  var theme = _ref.theme;
@@ -13088,53 +13088,46 @@ var Header = styled.div(_templateObject3$a || (_templateObject3$a = _taggedTempl
13088
13088
  var theme = _ref7.theme;
13089
13089
  return theme.getColor('lightestGrey', 40);
13090
13090
  }, WeekContainer);
13091
- var DayContainer = styled.button(_templateObject4$8 || (_templateObject4$8 = _taggedTemplateLiteralLoose(["\n position: relative;\n overflow: hidden;\n\n ", ";\n\n ", "\n\n :disabled {\n color: ", ";\n }\n\n &,\n :after {\n transition-property: background-color, color, border-color;\n transition-timing-function: ease-in-out;\n transition-duration: 0.25s;\n }\n\n ", "\n"])), function (_ref8) {
13091
+ var DayContainer = styled.button(_templateObject4$8 || (_templateObject4$8 = _taggedTemplateLiteralLoose(["\n position: relative;\n overflow: hidden;\n\n ", ";\n\n :disabled {\n color: ", ";\n }\n\n &,\n :after {\n transition-property: background-color, color, border-color;\n transition-timing-function: ease-in-out;\n transition-duration: 0.25s;\n }\n\n ", "\n"])), function (_ref8) {
13092
13092
  var theme = _ref8.theme,
13093
13093
  appearance = _ref8.appearance,
13094
13094
  activeColor = _ref8.activeColor,
13095
13095
  onClick = _ref8.onClick;
13096
-
13097
- if (!onClick) {
13098
- return css(_templateObject5$7 || (_templateObject5$7 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), theme.colors.white);
13099
- }
13100
-
13101
- var hover = function hover(color) {
13102
- return css(_templateObject6$6 || (_templateObject6$6 = _taggedTemplateLiteralLoose(["\n :not(:disabled):hover {\n border-color: ", ";\n color: ", ";\n }\n "])), theme.colors[color], theme.colors[color]);
13096
+ var hover = onClick ? function (color) {
13097
+ return css(_templateObject5$7 || (_templateObject5$7 = _taggedTemplateLiteralLoose(["\n :not(:disabled):hover {\n border-color: ", ";\n color: ", ";\n cursor: pointer;\n }\n "])), theme.colors[color], theme.colors[color]);
13098
+ } : function () {
13099
+ return null;
13103
13100
  };
13104
13101
 
13105
13102
  if (appearance === 'disabled') {
13106
- return css(_templateObject7$6 || (_templateObject7$6 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), theme.getColor('greyishBlue', 10));
13103
+ return css(_templateObject6$6 || (_templateObject6$6 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), theme.getColor('greyishBlue', 10));
13107
13104
  } else if (appearance === 'highlight') {
13108
- return css(_templateObject8$5 || (_templateObject8$5 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n ", "\n "])), theme.getColor('blue', 30), hover('blue'));
13105
+ return css(_templateObject7$6 || (_templateObject7$6 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n ", "\n "])), theme.getColor('blue', 30), hover('blue'));
13109
13106
  } else if (appearance === 'active') {
13110
- return css(_templateObject9$5 || (_templateObject9$5 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n color: ", ";\n :not(:last-child) {\n border-right-color: ", ";\n }\n ", "\n "])), theme.colors[activeColor], theme.colors.white, function (_ref9) {
13107
+ return css(_templateObject8$5 || (_templateObject8$5 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n color: ", ";\n :not(:last-child) {\n border-right-color: ", ";\n }\n ", "\n "])), theme.colors[activeColor], theme.colors.white, function (_ref9) {
13111
13108
  var theme = _ref9.theme;
13112
13109
  return theme.colors[activeColor];
13113
13110
  }, hover('white'));
13114
13111
  }
13115
13112
 
13116
- return css(_templateObject10$5 || (_templateObject10$5 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n ", "\n "])), theme.colors.white, hover('blue'));
13113
+ return css(_templateObject9$5 || (_templateObject9$5 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n ", "\n "])), theme.colors.white, hover('blue'));
13117
13114
  }, function (_ref10) {
13118
- var onClick = _ref10.onClick;
13119
- if (!onClick) return;
13120
- return css(_templateObject11$2 || (_templateObject11$2 = _taggedTemplateLiteralLoose(["\n :not(:disabled) {\n cursor: pointer;\n }\n "])));
13121
- }, function (_ref11) {
13122
- var theme = _ref11.theme;
13115
+ var theme = _ref10.theme;
13123
13116
  return theme.colors.silver;
13124
- }, function (_ref12) {
13125
- var appearance = _ref12.appearance,
13126
- today = _ref12.today,
13127
- theme = _ref12.theme;
13117
+ }, function (_ref11) {
13118
+ var appearance = _ref11.appearance,
13119
+ today = _ref11.today,
13120
+ theme = _ref11.theme;
13128
13121
 
13129
13122
  if (today !== 1) {
13130
13123
  return;
13131
13124
  }
13132
13125
 
13133
- return css(_templateObject12$2 || (_templateObject12$2 = _taggedTemplateLiteralLoose(["\n :after {\n content: '';\n position: absolute;\n top: -60%;\n right: -60%;\n width: 100%;\n height: 100%;\n background-color: ", ";\n transform: rotate(45deg);\n }\n "])), theme.colors[appearance === 'active' ? 'white' : 'blue']);
13126
+ return css(_templateObject10$5 || (_templateObject10$5 = _taggedTemplateLiteralLoose(["\n :after {\n content: '';\n position: absolute;\n top: -60%;\n right: -60%;\n width: 100%;\n height: 100%;\n background-color: ", ";\n transform: rotate(45deg);\n }\n "])), theme.colors[appearance === 'active' ? 'white' : 'blue']);
13134
13127
  });
13135
13128
  var DayIndicator = styled(Indicator).attrs({
13136
13129
  size: 'mini'
13137
- })(_templateObject13$2 || (_templateObject13$2 = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: calc(", " - 1px);\n left: calc(50% - (", " / 2) + 1px);\n"])), sizes.mini, sizes.mini);
13130
+ })(_templateObject11$2 || (_templateObject11$2 = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: calc(", " - 1px);\n left: calc(50% - (", " / 2) + 1px);\n"])), sizes.mini, sizes.mini);
13138
13131
 
13139
13132
  var getCalendar = function getCalendar(d) {
13140
13133
  var date = new Date(d.getTime());
@@ -13716,7 +13709,7 @@ var getTimeProps = function getTimeProps(time, value) {
13716
13709
  });
13717
13710
  };
13718
13711
 
13719
- var _templateObject$e, _templateObject2$c, _templateObject3$b, _templateObject4$9, _templateObject5$8, _templateObject6$7, _templateObject7$7, _templateObject8$6, _templateObject9$6, _templateObject10$6, _templateObject11$3, _templateObject12$3;
13712
+ var _templateObject$e, _templateObject2$c, _templateObject3$b, _templateObject4$9, _templateObject5$8, _templateObject6$7, _templateObject7$7, _templateObject8$6, _templateObject9$6, _templateObject10$6, _templateObject11$3, _templateObject12$2;
13720
13713
  var Button = styled.button(_templateObject$e || (_templateObject$e = _taggedTemplateLiteralLoose(["\n padding: 0\n ", ";\n font-family: 'Lato', sans-serif;\n font-weight: ", ";\n border-radius: 4px;\n position: relative;\n user-select: none;\n\n ", ";\n\n ", ";\n\n color: ", ";\n\n :disabled {\n ", "\n }\n\n :hover {\n cursor: ", ";\n\n ", "\n }\n\n :active {\n ", ";\n }\n\n ", "\n"])), function (_ref) {
13721
13714
  var theme = _ref.theme,
13722
13715
  appearance = _ref.appearance;
@@ -13795,7 +13788,7 @@ var Button = styled.button(_templateObject$e || (_templateObject$e = _taggedTemp
13795
13788
  }, function (_ref10) {
13796
13789
  var loading = _ref10.loading;
13797
13790
  if (!loading) return;
13798
- return css(_templateObject12$3 || (_templateObject12$3 = _taggedTemplateLiteralLoose(["\n pointer-events: none;\n "])));
13791
+ return css(_templateObject12$2 || (_templateObject12$2 = _taggedTemplateLiteralLoose(["\n pointer-events: none;\n "])));
13799
13792
  });
13800
13793
 
13801
13794
  var _excluded = ["children", "content"];
@@ -15584,7 +15577,7 @@ var Switch = function Switch(props) {
15584
15577
  })), React__default.createElement("span", null), label.after && React__default.createElement(LabelContainer$3, null, label.after));
15585
15578
  };
15586
15579
 
15587
- var _templateObject$q, _templateObject2$m, _templateObject3$i, _templateObject4$d, _templateObject5$b, _templateObject6$a, _templateObject7$a, _templateObject8$8, _templateObject9$8, _templateObject10$7, _templateObject11$4, _templateObject12$4, _templateObject13$3, _templateObject14$2, _templateObject15$2, _templateObject16$2, _templateObject17$2, _templateObject18$2, _templateObject19$1, _templateObject20$1;
15580
+ var _templateObject$q, _templateObject2$m, _templateObject3$i, _templateObject4$d, _templateObject5$b, _templateObject6$a, _templateObject7$a, _templateObject8$8, _templateObject9$8, _templateObject10$7, _templateObject11$4, _templateObject12$3, _templateObject13$2, _templateObject14$2, _templateObject15$2, _templateObject16$2, _templateObject17$2, _templateObject18$2, _templateObject19$1, _templateObject20$1;
15588
15581
  var bullet = css(_templateObject$q || (_templateObject$q = _taggedTemplateLiteralLoose(["\n appearance: none;\n width: ", ";\n height: ", ";\n border-radius: 100%;\n border-width: 1px;\n border-style: solid;\n background-color: ", ";\n box-shadow: 0px 1px 3px ", ";\n"])), function (_ref) {
15589
15582
  var theme = _ref.theme;
15590
15583
  return theme.spacings.s4;
@@ -15652,9 +15645,9 @@ var InputContainer$1 = styled.div(_templateObject10$7 || (_templateObject10$7 =
15652
15645
  return css(_templateObject11$4 || (_templateObject11$4 = _taggedTemplateLiteralLoose(["\n ", " > span {\n background-color: ", ";\n }\n\n ", " {\n /** firefox */\n ::-moz-range-thumb {\n border-color: ", ";\n }\n /** ie */\n ::-ms-thumb {\n border-color: ", ";\n }\n /** chrome */\n ::-webkit-slider-thumb {\n border-color: ", ";\n }\n }\n "])), SelectedArea, theme.colors.blue, Input$2, theme.colors.lightestGrey, theme.colors.lightestGrey, theme.colors.lightestGrey);
15653
15646
  }
15654
15647
 
15655
- return css(_templateObject12$4 || (_templateObject12$4 = _taggedTemplateLiteralLoose(["\n ", " > span {\n background-color: ", ";\n }\n\n ", " {\n /** firefox */\n ::-moz-range-thumb {\n border-color: ", ";\n }\n /** ie */\n ::-ms-thumb {\n border-color: ", ";\n }\n /** chrome */\n ::-webkit-slider-thumb {\n border-color: ", ";\n }\n }\n "])), SelectedArea, theme.colors.warningRed, Input$2, theme.colors.warningRed, theme.colors.warningRed, theme.colors.warningRed);
15648
+ return css(_templateObject12$3 || (_templateObject12$3 = _taggedTemplateLiteralLoose(["\n ", " > span {\n background-color: ", ";\n }\n\n ", " {\n /** firefox */\n ::-moz-range-thumb {\n border-color: ", ";\n }\n /** ie */\n ::-ms-thumb {\n border-color: ", ";\n }\n /** chrome */\n ::-webkit-slider-thumb {\n border-color: ", ";\n }\n }\n "])), SelectedArea, theme.colors.warningRed, Input$2, theme.colors.warningRed, theme.colors.warningRed, theme.colors.warningRed);
15656
15649
  });
15657
- var MinMaxLabelContainer = styled.div(_templateObject13$3 || (_templateObject13$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n padding-bottom: 2px;\n"])));
15650
+ var MinMaxLabelContainer = styled.div(_templateObject13$2 || (_templateObject13$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n padding-bottom: 2px;\n"])));
15658
15651
  var LabelsContainer = styled.div(_templateObject14$2 || (_templateObject14$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n gap: 7px;\n\n ", "\n"])), function (_ref19) {
15659
15652
  var position = _ref19.position;
15660
15653
 
@@ -15907,7 +15900,7 @@ var LabelContainer$5 = styled.div(_templateObject$r || (_templateObject$r = _tag
15907
15900
  var theme = _ref.theme;
15908
15901
  return theme.useTypography('p');
15909
15902
  });
15910
- var Label$6 = styled.label(_templateObject2$n || (_templateObject2$n = _taggedTemplateLiteralLoose(["\n display: flex;\n gap: ", ";\n\n ", "\n\n ", "\n\n", "\n\n > input {\n height: 0;\n width: 0;\n /* Chrome, Safari, Edge, Opera */\n :-webkit-outer-spin-button,\n :-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n /* Firefox */\n -moz-appearance: none;\n }\n\n > span {\n height: 17px;\n width: 17px;\n border-radius: 100%;\n border-width: 1px;\n border-style: solid;\n background-color: ", ";\n position: relative;\n transition-property: border-color;\n transition-duration: 0.5s;\n transition-timing-function: ease-in-out;\n :before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n height: 0;\n width: 0;\n border-radius: 100%;\n transition-property: top, left, width, height, background-color;\n transition-duration: 0.5s;\n transition-timing-function: cubic-bezier(0.68, -0.55, 0.27, 1.55);\n }\n }\n > input:checked + span {\n :before {\n top: calc(50% - 4.5px);\n left: calc(50% - 4.5px);\n height: 9px;\n width: 9px;\n }\n }\n"])), function (_ref2) {
15903
+ var Label$6 = styled.label(_templateObject2$n || (_templateObject2$n = _taggedTemplateLiteralLoose(["\n display: flex;\n gap: ", ";\n\n ", "\n\n ", "\n\n", "\n\n > input {\n position: absolute;\n top: 0;\n left: 0;\n height: 0;\n width: 0;\n /* Chrome, Safari, Edge, Opera */\n :-webkit-outer-spin-button,\n :-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n /* Firefox */\n -moz-appearance: none;\n }\n\n > span {\n height: 17px;\n width: 17px;\n min-height: 17px;\n min-width: 17px;\n max-height: 17px;\n max-width: 17px;\n border-radius: 100%;\n border-width: 1px;\n border-style: solid;\n background-color: ", ";\n position: relative;\n transition-property: border-color;\n transition-duration: 0.5s;\n transition-timing-function: ease-in-out;\n :before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n height: 0;\n width: 0;\n border-radius: 100%;\n transition-property: top, left, width, height, background-color;\n transition-duration: 0.5s;\n transition-timing-function: cubic-bezier(0.68, -0.55, 0.27, 1.55);\n }\n }\n > input:checked + span {\n :before {\n top: calc(50% - 4.5px);\n left: calc(50% - 4.5px);\n height: 9px;\n width: 9px;\n }\n }\n"])), function (_ref2) {
15911
15904
  var theme = _ref2.theme;
15912
15905
  return theme.spacings.s1;
15913
15906
  }, function (_ref3) {
@@ -16145,7 +16138,7 @@ var parse = function parse(value) {
16145
16138
  });
16146
16139
  };
16147
16140
 
16148
- var _templateObject$s, _templateObject2$o, _templateObject3$k, _templateObject4$f, _templateObject5$d, _templateObject6$c, _templateObject7$c, _templateObject8$9, _templateObject9$9, _templateObject10$8, _templateObject11$5, _templateObject12$5;
16141
+ var _templateObject$s, _templateObject2$o, _templateObject3$k, _templateObject4$f, _templateObject5$d, _templateObject6$c, _templateObject7$c, _templateObject8$9, _templateObject9$9, _templateObject10$8, _templateObject11$5, _templateObject12$4;
16149
16142
  var RelativeContainer$5 = styled.div(_templateObject$s || (_templateObject$s = _taggedTemplateLiteralLoose(["\n position: relative;\n user-select: none;\n min-width: 220px;\n\n > input,\n > label > input {\n color: transparent;\n background-color: transparent;\n width: 1px;\n height: 1px;\n position: absolute;\n left: 0;\n bottom: 0;\n border: 0;\n padding: 0;\n overflow: hidden;\n outline: none;\n box-shadow: none;\n }\n"])));
16150
16143
  var LabelContainer$6 = styled.div(_templateObject2$o || (_templateObject2$o = _taggedTemplateLiteralLoose(["\n ", "\n line-height: 17px;\n flex: 1;\n\n :first-child {\n text-align: left;\n }\n :not(:first-child) {\n text-align: center;\n }\n\n ", "\n\n ", ";\n"])), function (_ref) {
16151
16144
  var theme = _ref.theme;
@@ -16201,7 +16194,7 @@ var LabelText$1 = styled.label(_templateObject11$5 || (_templateObject11$5 = _ta
16201
16194
  }, function (_ref13) {
16202
16195
  var required = _ref13.required;
16203
16196
  if (!required) return;
16204
- return css(_templateObject12$5 || (_templateObject12$5 = _taggedTemplateLiteralLoose(["\n :after {\n content: ' *';\n }\n "])));
16197
+ return css(_templateObject12$4 || (_templateObject12$4 = _taggedTemplateLiteralLoose(["\n :after {\n content: ' *';\n }\n "])));
16205
16198
  });
16206
16199
 
16207
16200
  var Component$1 = React__default.forwardRef(function (props, ref) {
@@ -17684,7 +17677,7 @@ var useContext$2 = function useContext() {
17684
17677
  return React__default.useContext(Provider$2);
17685
17678
  };
17686
17679
 
17687
- var _templateObject$D, _templateObject2$u, _templateObject3$p, _templateObject4$i, _templateObject5$f, _templateObject6$e, _templateObject7$e, _templateObject8$b, _templateObject9$b, _templateObject10$a, _templateObject11$6, _templateObject12$6, _templateObject13$4, _templateObject14$3, _templateObject15$3;
17680
+ var _templateObject$D, _templateObject2$u, _templateObject3$p, _templateObject4$i, _templateObject5$f, _templateObject6$e, _templateObject7$e, _templateObject8$b, _templateObject9$b, _templateObject10$a, _templateObject11$6, _templateObject12$5, _templateObject13$3, _templateObject14$3, _templateObject15$3;
17688
17681
  var aligns = {
17689
17682
  self: {
17690
17683
  horizontal: {
@@ -17781,13 +17774,13 @@ var Col = styled.div(_templateObject$D || (_templateObject$D = _taggedTemplateLi
17781
17774
  theme = _ref6.theme;
17782
17775
  if (fontColor === undefined) return;
17783
17776
  var c = Array.isArray(fontColor) ? theme.getColor.apply(theme, fontColor) : theme.colors[fontColor];
17784
- return css(_templateObject12$6 || (_templateObject12$6 = _taggedTemplateLiteralLoose(["\n color: ", ";\n "])), c);
17777
+ return css(_templateObject12$5 || (_templateObject12$5 = _taggedTemplateLiteralLoose(["\n color: ", ";\n "])), c);
17785
17778
  }, function (_ref7) {
17786
17779
  var backgroundColor = _ref7.backgroundColor,
17787
17780
  theme = _ref7.theme;
17788
17781
  if (backgroundColor === undefined) return;
17789
17782
  var c = Array.isArray(backgroundColor) ? theme.getColor.apply(theme, backgroundColor) : theme.colors[backgroundColor];
17790
- return css(_templateObject13$4 || (_templateObject13$4 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), c);
17783
+ return css(_templateObject13$3 || (_templateObject13$3 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), c);
17791
17784
  }, function (_ref8) {
17792
17785
  var hover = _ref8.hover,
17793
17786
  theme = _ref8.theme;
@@ -18834,57 +18827,120 @@ var Tab = styled.li(_templateObject5$t || (_templateObject5$t = _taggedTemplateL
18834
18827
  return css(_templateObject6$r || (_templateObject6$r = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n padding: 0 ", ";\n gap: ", ";\n\n span {\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n\n color: ", ";\n }\n\n svg {\n stroke: ", ";\n\n &:hover {\n stroke: ", ";\n }\n }\n "])), theme.colors[active ? 'blue' : 'white'], theme.spacings.s2, theme.spacings.s2, theme.typographies.h2.fontFamily, theme.typographies.h2.fontSize, theme.typographies.h2.fontWeight, theme.colors[active ? 'white' : 'darkBlue'], theme.colors[active ? 'white' : 'darkBlue'], theme.colors.red);
18835
18828
  });
18836
18829
 
18830
+ var initialStatus = function initialStatus(active, length) {
18831
+ var status = Array(length).fill('open');
18832
+ status[active] = 'active';
18833
+ return status;
18834
+ };
18835
+
18837
18836
  var Tabs$1 = function Tabs$1(props) {
18838
18837
  var options = props.options,
18839
18838
  activeState = props.activeState,
18840
18839
  internal = props.internal;
18841
-
18842
- var _useState = useState(options),
18843
- tabs = _useState[0],
18844
- setTabs = _useState[1];
18845
-
18846
18840
  var active = activeState[0],
18847
18841
  setActive = activeState[1];
18848
18842
 
18849
- var updateActiveTab = function updateActiveTab(index, event) {
18850
- var element = event.target;
18851
- if (element.tagName === 'svg') return;
18852
- setActive(index);
18853
- };
18843
+ var _useState = useState(initialStatus(active, options.length)),
18844
+ status = _useState[0],
18845
+ setStatus = _useState[1];
18846
+
18847
+ var activate = function activate(active, length) {
18848
+ setStatus(function (prev) {
18849
+ if (length !== undefined && length !== prev.length) {
18850
+ return initialStatus(active, length);
18851
+ }
18854
18852
 
18855
- var removeTab = function removeTab(index) {
18856
- setTabs(function (prevState) {
18857
- var aux = [].concat(prevState);
18853
+ var current = prev.findIndex(function (e) {
18854
+ return e === 'active';
18855
+ });
18856
+
18857
+ if (current !== active && current > -1 && active > -1 && active < prev.length) {
18858
+ var _status = [].concat(prev);
18858
18859
 
18859
- if (index === active) {
18860
- setActive(index > 0 ? index - 1 : 1);
18860
+ _status[current] = 'open';
18861
+ _status[active] = 'active';
18862
+ return [].concat(_status);
18861
18863
  }
18862
18864
 
18863
- aux.splice(index, 1);
18864
- return aux;
18865
+ return prev;
18865
18866
  });
18866
18867
  };
18867
18868
 
18868
- var getClose = props.alwaysOpen ? function () {
18869
- return undefined;
18870
- } : function (index) {
18871
- return React__default.createElement(SvgClose, {
18872
- onClick: function onClick() {
18873
- return removeTab(index);
18869
+ useEffect(function () {
18870
+ activate(active, options.length);
18871
+ }, [active, options.length]);
18872
+ useEffect(function () {
18873
+ var current = status.findIndex(function (e) {
18874
+ return e === 'active';
18875
+ });
18876
+ setActive(current);
18877
+ }, [status]);
18878
+
18879
+ var onClickActivate = function onClickActivate(index, event) {
18880
+ var element = event.target;
18881
+
18882
+ while (element) {
18883
+ if (element.tagName === 'svg') return;
18884
+ element = element.parentElement;
18885
+ }
18886
+
18887
+ activate(index);
18888
+ };
18889
+
18890
+ var onClickClose = function onClickClose(index) {
18891
+ var getActive = function getActive(removed, prev) {
18892
+ for (var i = index - 1; i > -1; i--) {
18893
+ if (removed[i] !== 'closed') {
18894
+ return i;
18895
+ }
18896
+ }
18897
+
18898
+ for (var _i = index + 1; _i < removed.length; _i++) {
18899
+ if (removed[_i] !== 'closed') {
18900
+ return _i;
18901
+ }
18874
18902
  }
18903
+
18904
+ return prev;
18905
+ };
18906
+
18907
+ setStatus(function (prev) {
18908
+ if (prev[index] === 'closed') return prev;
18909
+ var active = prev.findIndex(function (e) {
18910
+ return e === 'active';
18911
+ });
18912
+ var status = [].concat(prev);
18913
+ status[index] = 'closed';
18914
+
18915
+ if (active === index) {
18916
+ var _active = getActive(status, index);
18917
+
18918
+ status[_active] = 'active';
18919
+ }
18920
+
18921
+ return status;
18875
18922
  });
18876
18923
  };
18924
+
18925
+ var Close = props.alwaysOpen ? function () {
18926
+ return null;
18927
+ } : SvgClose;
18877
18928
  return React__default.createElement(Container$n, null, React__default.createElement(Tabs, {
18878
18929
  internal: +(internal || false)
18879
- }, tabs.map(function (tab, index) {
18880
- return React__default.createElement(Tab, {
18930
+ }, options.reduce(function (elements, tab, index) {
18931
+ if (status[index] === 'closed') return elements;
18932
+ return [].concat(elements, [React__default.createElement(Tab, {
18881
18933
  key: index,
18882
- active: +(active === index),
18934
+ active: +(status[index] === 'active'),
18883
18935
  onClick: function onClick(event) {
18884
- return updateActiveTab(index, event);
18936
+ return onClickActivate(index, event);
18885
18937
  }
18886
- }, React__default.createElement("span", null, tab.label), getClose(index));
18887
- })));
18938
+ }, React__default.createElement("span", null, tab.label), React__default.createElement(Close, {
18939
+ onClick: function onClick() {
18940
+ return onClickClose(index);
18941
+ }
18942
+ }))]);
18943
+ }, [])));
18888
18944
  };
18889
18945
 
18890
18946
  var _templateObject$X;