@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.
package/dist/index.js CHANGED
@@ -13066,7 +13066,7 @@ var Indicator = function Indicator(props) {
13066
13066
  }, props)));
13067
13067
  };
13068
13068
 
13069
- 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;
13069
+ var _templateObject$b, _templateObject2$b, _templateObject3$a, _templateObject4$8, _templateObject5$7, _templateObject6$6, _templateObject7$6, _templateObject8$5, _templateObject9$5, _templateObject10$5, _templateObject11$2;
13070
13070
  var Footer = styled__default.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"])));
13071
13071
  var WeekContainer = styled__default.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) {
13072
13072
  var theme = _ref.theme;
@@ -13091,53 +13091,46 @@ var Header = styled__default.div(_templateObject3$a || (_templateObject3$a = _ta
13091
13091
  var theme = _ref7.theme;
13092
13092
  return theme.getColor('lightestGrey', 40);
13093
13093
  }, WeekContainer);
13094
- var DayContainer = styled__default.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) {
13094
+ var DayContainer = styled__default.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) {
13095
13095
  var theme = _ref8.theme,
13096
13096
  appearance = _ref8.appearance,
13097
13097
  activeColor = _ref8.activeColor,
13098
13098
  onClick = _ref8.onClick;
13099
-
13100
- if (!onClick) {
13101
- return styled.css(_templateObject5$7 || (_templateObject5$7 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), theme.colors.white);
13102
- }
13103
-
13104
- var hover = function hover(color) {
13105
- return styled.css(_templateObject6$6 || (_templateObject6$6 = _taggedTemplateLiteralLoose(["\n :not(:disabled):hover {\n border-color: ", ";\n color: ", ";\n }\n "])), theme.colors[color], theme.colors[color]);
13099
+ var hover = onClick ? function (color) {
13100
+ return styled.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]);
13101
+ } : function () {
13102
+ return null;
13106
13103
  };
13107
13104
 
13108
13105
  if (appearance === 'disabled') {
13109
- return styled.css(_templateObject7$6 || (_templateObject7$6 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), theme.getColor('greyishBlue', 10));
13106
+ return styled.css(_templateObject6$6 || (_templateObject6$6 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), theme.getColor('greyishBlue', 10));
13110
13107
  } else if (appearance === 'highlight') {
13111
- return styled.css(_templateObject8$5 || (_templateObject8$5 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n ", "\n "])), theme.getColor('blue', 30), hover('blue'));
13108
+ return styled.css(_templateObject7$6 || (_templateObject7$6 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n ", "\n "])), theme.getColor('blue', 30), hover('blue'));
13112
13109
  } else if (appearance === 'active') {
13113
- return styled.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) {
13110
+ return styled.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) {
13114
13111
  var theme = _ref9.theme;
13115
13112
  return theme.colors[activeColor];
13116
13113
  }, hover('white'));
13117
13114
  }
13118
13115
 
13119
- return styled.css(_templateObject10$5 || (_templateObject10$5 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n ", "\n "])), theme.colors.white, hover('blue'));
13116
+ return styled.css(_templateObject9$5 || (_templateObject9$5 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n ", "\n "])), theme.colors.white, hover('blue'));
13120
13117
  }, function (_ref10) {
13121
- var onClick = _ref10.onClick;
13122
- if (!onClick) return;
13123
- return styled.css(_templateObject11$2 || (_templateObject11$2 = _taggedTemplateLiteralLoose(["\n :not(:disabled) {\n cursor: pointer;\n }\n "])));
13124
- }, function (_ref11) {
13125
- var theme = _ref11.theme;
13118
+ var theme = _ref10.theme;
13126
13119
  return theme.colors.silver;
13127
- }, function (_ref12) {
13128
- var appearance = _ref12.appearance,
13129
- today = _ref12.today,
13130
- theme = _ref12.theme;
13120
+ }, function (_ref11) {
13121
+ var appearance = _ref11.appearance,
13122
+ today = _ref11.today,
13123
+ theme = _ref11.theme;
13131
13124
 
13132
13125
  if (today !== 1) {
13133
13126
  return;
13134
13127
  }
13135
13128
 
13136
- return styled.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']);
13129
+ return styled.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']);
13137
13130
  });
13138
13131
  var DayIndicator = styled__default(Indicator).attrs({
13139
13132
  size: 'mini'
13140
- })(_templateObject13$2 || (_templateObject13$2 = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: calc(", " - 1px);\n left: calc(50% - (", " / 2) + 1px);\n"])), sizes.mini, sizes.mini);
13133
+ })(_templateObject11$2 || (_templateObject11$2 = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: calc(", " - 1px);\n left: calc(50% - (", " / 2) + 1px);\n"])), sizes.mini, sizes.mini);
13141
13134
 
13142
13135
  var getCalendar = function getCalendar(d) {
13143
13136
  var date = new Date(d.getTime());
@@ -13719,7 +13712,7 @@ var getTimeProps = function getTimeProps(time, value) {
13719
13712
  });
13720
13713
  };
13721
13714
 
13722
- 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;
13715
+ 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;
13723
13716
  var Button = styled__default.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) {
13724
13717
  var theme = _ref.theme,
13725
13718
  appearance = _ref.appearance;
@@ -13798,7 +13791,7 @@ var Button = styled__default.button(_templateObject$e || (_templateObject$e = _t
13798
13791
  }, function (_ref10) {
13799
13792
  var loading = _ref10.loading;
13800
13793
  if (!loading) return;
13801
- return styled.css(_templateObject12$3 || (_templateObject12$3 = _taggedTemplateLiteralLoose(["\n pointer-events: none;\n "])));
13794
+ return styled.css(_templateObject12$2 || (_templateObject12$2 = _taggedTemplateLiteralLoose(["\n pointer-events: none;\n "])));
13802
13795
  });
13803
13796
 
13804
13797
  var _excluded = ["children", "content"];
@@ -15587,7 +15580,7 @@ var Switch = function Switch(props) {
15587
15580
  })), React__default.createElement("span", null), label.after && React__default.createElement(LabelContainer$3, null, label.after));
15588
15581
  };
15589
15582
 
15590
- 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;
15583
+ 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;
15591
15584
  var bullet = styled.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) {
15592
15585
  var theme = _ref.theme;
15593
15586
  return theme.spacings.s4;
@@ -15655,9 +15648,9 @@ var InputContainer$1 = styled__default.div(_templateObject10$7 || (_templateObje
15655
15648
  return styled.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);
15656
15649
  }
15657
15650
 
15658
- return styled.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);
15651
+ return styled.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);
15659
15652
  });
15660
- var MinMaxLabelContainer = styled__default.div(_templateObject13$3 || (_templateObject13$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n padding-bottom: 2px;\n"])));
15653
+ var MinMaxLabelContainer = styled__default.div(_templateObject13$2 || (_templateObject13$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n padding-bottom: 2px;\n"])));
15661
15654
  var LabelsContainer = styled__default.div(_templateObject14$2 || (_templateObject14$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n gap: 7px;\n\n ", "\n"])), function (_ref19) {
15662
15655
  var position = _ref19.position;
15663
15656
 
@@ -15910,7 +15903,7 @@ var LabelContainer$5 = styled__default.div(_templateObject$r || (_templateObject
15910
15903
  var theme = _ref.theme;
15911
15904
  return theme.useTypography('p');
15912
15905
  });
15913
- var Label$6 = styled__default.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) {
15906
+ var Label$6 = styled__default.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) {
15914
15907
  var theme = _ref2.theme;
15915
15908
  return theme.spacings.s1;
15916
15909
  }, function (_ref3) {
@@ -16148,7 +16141,7 @@ var parse = function parse(value) {
16148
16141
  });
16149
16142
  };
16150
16143
 
16151
- 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;
16144
+ 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;
16152
16145
  var RelativeContainer$5 = styled__default.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"])));
16153
16146
  var LabelContainer$6 = styled__default.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) {
16154
16147
  var theme = _ref.theme;
@@ -16204,7 +16197,7 @@ var LabelText$1 = styled__default.label(_templateObject11$5 || (_templateObject1
16204
16197
  }, function (_ref13) {
16205
16198
  var required = _ref13.required;
16206
16199
  if (!required) return;
16207
- return styled.css(_templateObject12$5 || (_templateObject12$5 = _taggedTemplateLiteralLoose(["\n :after {\n content: ' *';\n }\n "])));
16200
+ return styled.css(_templateObject12$4 || (_templateObject12$4 = _taggedTemplateLiteralLoose(["\n :after {\n content: ' *';\n }\n "])));
16208
16201
  });
16209
16202
 
16210
16203
  var Component$1 = React__default.forwardRef(function (props, ref) {
@@ -17687,7 +17680,7 @@ var useContext$2 = function useContext() {
17687
17680
  return React__default.useContext(Provider$2);
17688
17681
  };
17689
17682
 
17690
- 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;
17683
+ 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;
17691
17684
  var aligns = {
17692
17685
  self: {
17693
17686
  horizontal: {
@@ -17784,13 +17777,13 @@ var Col = styled__default.div(_templateObject$D || (_templateObject$D = _taggedT
17784
17777
  theme = _ref6.theme;
17785
17778
  if (fontColor === undefined) return;
17786
17779
  var c = Array.isArray(fontColor) ? theme.getColor.apply(theme, fontColor) : theme.colors[fontColor];
17787
- return styled.css(_templateObject12$6 || (_templateObject12$6 = _taggedTemplateLiteralLoose(["\n color: ", ";\n "])), c);
17780
+ return styled.css(_templateObject12$5 || (_templateObject12$5 = _taggedTemplateLiteralLoose(["\n color: ", ";\n "])), c);
17788
17781
  }, function (_ref7) {
17789
17782
  var backgroundColor = _ref7.backgroundColor,
17790
17783
  theme = _ref7.theme;
17791
17784
  if (backgroundColor === undefined) return;
17792
17785
  var c = Array.isArray(backgroundColor) ? theme.getColor.apply(theme, backgroundColor) : theme.colors[backgroundColor];
17793
- return styled.css(_templateObject13$4 || (_templateObject13$4 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), c);
17786
+ return styled.css(_templateObject13$3 || (_templateObject13$3 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), c);
17794
17787
  }, function (_ref8) {
17795
17788
  var hover = _ref8.hover,
17796
17789
  theme = _ref8.theme;
@@ -18837,57 +18830,120 @@ var Tab = styled__default.li(_templateObject5$t || (_templateObject5$t = _tagged
18837
18830
  return styled.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);
18838
18831
  });
18839
18832
 
18833
+ var initialStatus = function initialStatus(active, length) {
18834
+ var status = Array(length).fill('open');
18835
+ status[active] = 'active';
18836
+ return status;
18837
+ };
18838
+
18840
18839
  var Tabs$1 = function Tabs$1(props) {
18841
18840
  var options = props.options,
18842
18841
  activeState = props.activeState,
18843
18842
  internal = props.internal;
18844
-
18845
- var _useState = React.useState(options),
18846
- tabs = _useState[0],
18847
- setTabs = _useState[1];
18848
-
18849
18843
  var active = activeState[0],
18850
18844
  setActive = activeState[1];
18851
18845
 
18852
- var updateActiveTab = function updateActiveTab(index, event) {
18853
- var element = event.target;
18854
- if (element.tagName === 'svg') return;
18855
- setActive(index);
18856
- };
18846
+ var _useState = React.useState(initialStatus(active, options.length)),
18847
+ status = _useState[0],
18848
+ setStatus = _useState[1];
18849
+
18850
+ var activate = function activate(active, length) {
18851
+ setStatus(function (prev) {
18852
+ if (length !== undefined && length !== prev.length) {
18853
+ return initialStatus(active, length);
18854
+ }
18857
18855
 
18858
- var removeTab = function removeTab(index) {
18859
- setTabs(function (prevState) {
18860
- var aux = [].concat(prevState);
18856
+ var current = prev.findIndex(function (e) {
18857
+ return e === 'active';
18858
+ });
18859
+
18860
+ if (current !== active && current > -1 && active > -1 && active < prev.length) {
18861
+ var _status = [].concat(prev);
18861
18862
 
18862
- if (index === active) {
18863
- setActive(index > 0 ? index - 1 : 1);
18863
+ _status[current] = 'open';
18864
+ _status[active] = 'active';
18865
+ return [].concat(_status);
18864
18866
  }
18865
18867
 
18866
- aux.splice(index, 1);
18867
- return aux;
18868
+ return prev;
18868
18869
  });
18869
18870
  };
18870
18871
 
18871
- var getClose = props.alwaysOpen ? function () {
18872
- return undefined;
18873
- } : function (index) {
18874
- return React__default.createElement(SvgClose, {
18875
- onClick: function onClick() {
18876
- return removeTab(index);
18872
+ React.useEffect(function () {
18873
+ activate(active, options.length);
18874
+ }, [active, options.length]);
18875
+ React.useEffect(function () {
18876
+ var current = status.findIndex(function (e) {
18877
+ return e === 'active';
18878
+ });
18879
+ setActive(current);
18880
+ }, [status]);
18881
+
18882
+ var onClickActivate = function onClickActivate(index, event) {
18883
+ var element = event.target;
18884
+
18885
+ while (element) {
18886
+ if (element.tagName === 'svg') return;
18887
+ element = element.parentElement;
18888
+ }
18889
+
18890
+ activate(index);
18891
+ };
18892
+
18893
+ var onClickClose = function onClickClose(index) {
18894
+ var getActive = function getActive(removed, prev) {
18895
+ for (var i = index - 1; i > -1; i--) {
18896
+ if (removed[i] !== 'closed') {
18897
+ return i;
18898
+ }
18899
+ }
18900
+
18901
+ for (var _i = index + 1; _i < removed.length; _i++) {
18902
+ if (removed[_i] !== 'closed') {
18903
+ return _i;
18904
+ }
18877
18905
  }
18906
+
18907
+ return prev;
18908
+ };
18909
+
18910
+ setStatus(function (prev) {
18911
+ if (prev[index] === 'closed') return prev;
18912
+ var active = prev.findIndex(function (e) {
18913
+ return e === 'active';
18914
+ });
18915
+ var status = [].concat(prev);
18916
+ status[index] = 'closed';
18917
+
18918
+ if (active === index) {
18919
+ var _active = getActive(status, index);
18920
+
18921
+ status[_active] = 'active';
18922
+ }
18923
+
18924
+ return status;
18878
18925
  });
18879
18926
  };
18927
+
18928
+ var Close = props.alwaysOpen ? function () {
18929
+ return null;
18930
+ } : SvgClose;
18880
18931
  return React__default.createElement(Container$n, null, React__default.createElement(Tabs, {
18881
18932
  internal: +(internal || false)
18882
- }, tabs.map(function (tab, index) {
18883
- return React__default.createElement(Tab, {
18933
+ }, options.reduce(function (elements, tab, index) {
18934
+ if (status[index] === 'closed') return elements;
18935
+ return [].concat(elements, [React__default.createElement(Tab, {
18884
18936
  key: index,
18885
- active: +(active === index),
18937
+ active: +(status[index] === 'active'),
18886
18938
  onClick: function onClick(event) {
18887
- return updateActiveTab(index, event);
18939
+ return onClickActivate(index, event);
18888
18940
  }
18889
- }, React__default.createElement("span", null, tab.label), getClose(index));
18890
- })));
18941
+ }, React__default.createElement("span", null, tab.label), React__default.createElement(Close, {
18942
+ onClick: function onClick() {
18943
+ return onClickClose(index);
18944
+ }
18945
+ }))]);
18946
+ }, [])));
18891
18947
  };
18892
18948
 
18893
18949
  var _templateObject$X;