@mw-kit/mw-ui 1.7.47 → 1.7.49

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());
@@ -13422,9 +13415,11 @@ var Main = React__default.forwardRef(function (props, ref) {
13422
13415
  });
13423
13416
  };
13424
13417
 
13418
+ var isControlled = props.calendar !== undefined;
13425
13419
  useEffect(function () {
13420
+ if (isControlled) return;
13426
13421
  setCalendar(getInitialCalendar(initialMonth, min, max));
13427
- }, [initialMonth === null || initialMonth === void 0 ? void 0 : initialMonth.toISOString(), min === null || min === void 0 ? void 0 : min.toISOString(), max === null || max === void 0 ? void 0 : max.toISOString()]);
13422
+ }, [isControlled, initialMonth === null || initialMonth === void 0 ? void 0 : initialMonth.toISOString(), min === null || min === void 0 ? void 0 : min.toISOString(), max === null || max === void 0 ? void 0 : max.toISOString()]);
13428
13423
  useEffect(function () {
13429
13424
  var _ref2 = [calendar.weeks[0], calendar.weeks[calendar.weeks.length - 1]],
13430
13425
  first = _ref2[0],
@@ -13559,7 +13554,19 @@ var Main = React__default.forwardRef(function (props, ref) {
13559
13554
  type: details.indicator
13560
13555
  }));
13561
13556
  }));
13562
- })), props.children && React__default.createElement(Footer, null, props.children), loading && React__default.createElement(Loader, {
13557
+ })), function () {
13558
+ if (!props.children) {
13559
+ return null;
13560
+ }
13561
+
13562
+ if (Array.isArray(props.children) && !props.children.some(function (e) {
13563
+ return e;
13564
+ })) {
13565
+ return null;
13566
+ }
13567
+
13568
+ return React__default.createElement(Footer, null, props.children);
13569
+ }(), loading && React__default.createElement(Loader, {
13563
13570
  filled: theme$2.getColor('white', 95)
13564
13571
  }));
13565
13572
  });
@@ -13716,7 +13723,7 @@ var getTimeProps = function getTimeProps(time, value) {
13716
13723
  });
13717
13724
  };
13718
13725
 
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;
13726
+ 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
13727
  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
13728
  var theme = _ref.theme,
13722
13729
  appearance = _ref.appearance;
@@ -13795,7 +13802,7 @@ var Button = styled.button(_templateObject$e || (_templateObject$e = _taggedTemp
13795
13802
  }, function (_ref10) {
13796
13803
  var loading = _ref10.loading;
13797
13804
  if (!loading) return;
13798
- return css(_templateObject12$3 || (_templateObject12$3 = _taggedTemplateLiteralLoose(["\n pointer-events: none;\n "])));
13805
+ return css(_templateObject12$2 || (_templateObject12$2 = _taggedTemplateLiteralLoose(["\n pointer-events: none;\n "])));
13799
13806
  });
13800
13807
 
13801
13808
  var _excluded = ["children", "content"];
@@ -13860,7 +13867,10 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
13860
13867
  time = _useState[0],
13861
13868
  setTime = _useState[1];
13862
13869
 
13863
- var _useState2 = useState(getInitialCalendar(value[0] || initialMonth, min, max)),
13870
+ var _useState2 = useState(function () {
13871
+ var calendar1 = getInitialCalendar(value[0] || initialMonth, min, max);
13872
+ return calendar1;
13873
+ }),
13864
13874
  calendar1 = _useState2[0],
13865
13875
  _setCalendar1 = _useState2[1];
13866
13876
 
@@ -13871,7 +13881,10 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
13871
13881
  });
13872
13882
  };
13873
13883
 
13874
- var _useState3 = useState(getCalendar2(calendar1)),
13884
+ var _useState3 = useState(function () {
13885
+ var calendar2 = getCalendar2(calendar1);
13886
+ return calendar2;
13887
+ }),
13875
13888
  calendar2 = _useState3[0],
13876
13889
  _setCalendar2 = _useState3[1];
13877
13890
 
@@ -13886,6 +13899,12 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
13886
13899
  hoverDay = _useState4[0],
13887
13900
  setHoverDay = _useState4[1];
13888
13901
 
13902
+ useEffect(function () {
13903
+ var calendar1 = getInitialCalendar(value[0] || initialMonth, min, max);
13904
+ var calendar2 = getCalendar2(calendar1);
13905
+ setCalendar1(calendar1);
13906
+ setCalendar2(calendar2);
13907
+ }, [initialMonth === null || initialMonth === void 0 ? void 0 : initialMonth.toISOString(), min === null || min === void 0 ? void 0 : min.toISOString(), max === null || max === void 0 ? void 0 : max.toISOString()]);
13889
13908
  useEffect(function () {
13890
13909
  var timeProps = getTimeProps(props.time, value);
13891
13910
  setHoverDay(null);
@@ -14004,11 +14023,16 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
14004
14023
  }
14005
14024
  });
14006
14025
  }();
14007
- var middle = new Date();
14008
- middle.setFullYear(calendar1.year);
14009
- middle.setMonth(calendar1.month + 1);
14010
- middle.setDate(1);
14011
- middle.setHours(0, 0, 0, 0);
14026
+ var middle = [new Date(), new Date()];
14027
+ middle[0].setDate(1);
14028
+ middle[0].setFullYear(calendar2.year);
14029
+ middle[0].setMonth(calendar2.month);
14030
+ middle[0].setDate(0);
14031
+ middle[0].setHours(23, 59, 59, 999);
14032
+ middle[1].setDate(1);
14033
+ middle[1].setFullYear(calendar1.year);
14034
+ middle[1].setMonth(calendar1.month + 1);
14035
+ middle[1].setHours(0, 0, 0, 0);
14012
14036
  var inputs = getTimeProps(props.time, value).map(function (timeProps, index) {
14013
14037
  if (!timeProps) return undefined;
14014
14038
  var width = timeProps.seconds ? 'withSeconds' : 'withoutSeconds';
@@ -14049,12 +14073,20 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
14049
14073
  calendar: [calendar1, function (v) {
14050
14074
  setCalendar1(function (prev) {
14051
14075
  var c1 = typeof v === 'function' ? v(prev) : v;
14052
- setCalendar2(getCalendar2(c1));
14076
+ setCalendar2(function (prev) {
14077
+ if (prev.year > c1.year) return prev;
14078
+
14079
+ if (prev.year === c1.year && prev.month > c1.month) {
14080
+ return prev;
14081
+ }
14082
+
14083
+ return getCalendar2(c1);
14084
+ });
14053
14085
  return c1;
14054
14086
  });
14055
14087
  }],
14056
14088
  min: min,
14057
- max: max
14089
+ max: max && dateCompare(max, middle[0], 'lt') ? max : middle[0]
14058
14090
  }), inputs[0]), React__default.createElement(BasicCalendar, Object.assign({}, calendarProps, {
14059
14091
  getDay: function getDay(c) {
14060
14092
  return _getDay2(c, 'right');
@@ -14069,7 +14101,7 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
14069
14101
  ref: ref,
14070
14102
  label: React__default.createElement(LabelContainer$1, null, React__default.createElement("b", null, "Fim:"), " ", value[1] ? dateToIsoString(value[1]) : '––/––/––––'),
14071
14103
  calendar: [calendar2, setCalendar2],
14072
- min: min && dateCompare(min, middle, 'gt') ? min : middle,
14104
+ min: min && dateCompare(min, middle[1], 'gt') ? min : middle[1],
14073
14105
  max: max
14074
14106
  }), inputs[1], submitProps && React__default.createElement(SubmitButton, Object.assign({
14075
14107
  content: 'Aplicar'
@@ -15584,7 +15616,7 @@ var Switch = function Switch(props) {
15584
15616
  })), React__default.createElement("span", null), label.after && React__default.createElement(LabelContainer$3, null, label.after));
15585
15617
  };
15586
15618
 
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;
15619
+ 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
15620
  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
15621
  var theme = _ref.theme;
15590
15622
  return theme.spacings.s4;
@@ -15652,9 +15684,9 @@ var InputContainer$1 = styled.div(_templateObject10$7 || (_templateObject10$7 =
15652
15684
  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
15685
  }
15654
15686
 
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);
15687
+ 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
15688
  });
15657
- var MinMaxLabelContainer = styled.div(_templateObject13$3 || (_templateObject13$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n padding-bottom: 2px;\n"])));
15689
+ var MinMaxLabelContainer = styled.div(_templateObject13$2 || (_templateObject13$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n padding-bottom: 2px;\n"])));
15658
15690
  var LabelsContainer = styled.div(_templateObject14$2 || (_templateObject14$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n gap: 7px;\n\n ", "\n"])), function (_ref19) {
15659
15691
  var position = _ref19.position;
15660
15692
 
@@ -15907,7 +15939,7 @@ var LabelContainer$5 = styled.div(_templateObject$r || (_templateObject$r = _tag
15907
15939
  var theme = _ref.theme;
15908
15940
  return theme.useTypography('p');
15909
15941
  });
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) {
15942
+ 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
15943
  var theme = _ref2.theme;
15912
15944
  return theme.spacings.s1;
15913
15945
  }, function (_ref3) {
@@ -16145,7 +16177,7 @@ var parse = function parse(value) {
16145
16177
  });
16146
16178
  };
16147
16179
 
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;
16180
+ 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
16181
  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
16182
  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
16183
  var theme = _ref.theme;
@@ -16201,7 +16233,7 @@ var LabelText$1 = styled.label(_templateObject11$5 || (_templateObject11$5 = _ta
16201
16233
  }, function (_ref13) {
16202
16234
  var required = _ref13.required;
16203
16235
  if (!required) return;
16204
- return css(_templateObject12$5 || (_templateObject12$5 = _taggedTemplateLiteralLoose(["\n :after {\n content: ' *';\n }\n "])));
16236
+ return css(_templateObject12$4 || (_templateObject12$4 = _taggedTemplateLiteralLoose(["\n :after {\n content: ' *';\n }\n "])));
16205
16237
  });
16206
16238
 
16207
16239
  var Component$1 = React__default.forwardRef(function (props, ref) {
@@ -17684,7 +17716,7 @@ var useContext$2 = function useContext() {
17684
17716
  return React__default.useContext(Provider$2);
17685
17717
  };
17686
17718
 
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;
17719
+ 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
17720
  var aligns = {
17689
17721
  self: {
17690
17722
  horizontal: {
@@ -17781,13 +17813,13 @@ var Col = styled.div(_templateObject$D || (_templateObject$D = _taggedTemplateLi
17781
17813
  theme = _ref6.theme;
17782
17814
  if (fontColor === undefined) return;
17783
17815
  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);
17816
+ return css(_templateObject12$5 || (_templateObject12$5 = _taggedTemplateLiteralLoose(["\n color: ", ";\n "])), c);
17785
17817
  }, function (_ref7) {
17786
17818
  var backgroundColor = _ref7.backgroundColor,
17787
17819
  theme = _ref7.theme;
17788
17820
  if (backgroundColor === undefined) return;
17789
17821
  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);
17822
+ return css(_templateObject13$3 || (_templateObject13$3 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), c);
17791
17823
  }, function (_ref8) {
17792
17824
  var hover = _ref8.hover,
17793
17825
  theme = _ref8.theme;
@@ -18834,57 +18866,120 @@ var Tab = styled.li(_templateObject5$t || (_templateObject5$t = _taggedTemplateL
18834
18866
  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
18867
  });
18836
18868
 
18869
+ var initialStatus = function initialStatus(active, length) {
18870
+ var status = Array(length).fill('open');
18871
+ status[active] = 'active';
18872
+ return status;
18873
+ };
18874
+
18837
18875
  var Tabs$1 = function Tabs$1(props) {
18838
18876
  var options = props.options,
18839
18877
  activeState = props.activeState,
18840
18878
  internal = props.internal;
18841
-
18842
- var _useState = useState(options),
18843
- tabs = _useState[0],
18844
- setTabs = _useState[1];
18845
-
18846
18879
  var active = activeState[0],
18847
18880
  setActive = activeState[1];
18848
18881
 
18849
- var updateActiveTab = function updateActiveTab(index, event) {
18850
- var element = event.target;
18851
- if (element.tagName === 'svg') return;
18852
- setActive(index);
18853
- };
18882
+ var _useState = useState(initialStatus(active, options.length)),
18883
+ status = _useState[0],
18884
+ setStatus = _useState[1];
18854
18885
 
18855
- var removeTab = function removeTab(index) {
18856
- setTabs(function (prevState) {
18857
- var aux = [].concat(prevState);
18886
+ var activate = function activate(active, length) {
18887
+ setStatus(function (prev) {
18888
+ if (length !== undefined && length !== prev.length) {
18889
+ return initialStatus(active, length);
18890
+ }
18891
+
18892
+ var current = prev.findIndex(function (e) {
18893
+ return e === 'active';
18894
+ });
18895
+
18896
+ if (current !== active && current > -1 && active > -1 && active < prev.length) {
18897
+ var _status = [].concat(prev);
18858
18898
 
18859
- if (index === active) {
18860
- setActive(index > 0 ? index - 1 : 1);
18899
+ _status[current] = 'open';
18900
+ _status[active] = 'active';
18901
+ return [].concat(_status);
18861
18902
  }
18862
18903
 
18863
- aux.splice(index, 1);
18864
- return aux;
18904
+ return prev;
18865
18905
  });
18866
18906
  };
18867
18907
 
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);
18908
+ useEffect(function () {
18909
+ activate(active, options.length);
18910
+ }, [active, options.length]);
18911
+ useEffect(function () {
18912
+ var current = status.findIndex(function (e) {
18913
+ return e === 'active';
18914
+ });
18915
+ setActive(current);
18916
+ }, [status]);
18917
+
18918
+ var onClickActivate = function onClickActivate(index, event) {
18919
+ var element = event.target;
18920
+
18921
+ while (element) {
18922
+ if (element.tagName === 'svg') return;
18923
+ element = element.parentElement;
18924
+ }
18925
+
18926
+ activate(index);
18927
+ };
18928
+
18929
+ var onClickClose = function onClickClose(index) {
18930
+ var getActive = function getActive(removed, prev) {
18931
+ for (var i = index - 1; i > -1; i--) {
18932
+ if (removed[i] !== 'closed') {
18933
+ return i;
18934
+ }
18874
18935
  }
18936
+
18937
+ for (var _i = index + 1; _i < removed.length; _i++) {
18938
+ if (removed[_i] !== 'closed') {
18939
+ return _i;
18940
+ }
18941
+ }
18942
+
18943
+ return prev;
18944
+ };
18945
+
18946
+ setStatus(function (prev) {
18947
+ if (prev[index] === 'closed') return prev;
18948
+ var active = prev.findIndex(function (e) {
18949
+ return e === 'active';
18950
+ });
18951
+ var status = [].concat(prev);
18952
+ status[index] = 'closed';
18953
+
18954
+ if (active === index) {
18955
+ var _active = getActive(status, index);
18956
+
18957
+ status[_active] = 'active';
18958
+ }
18959
+
18960
+ return status;
18875
18961
  });
18876
18962
  };
18963
+
18964
+ var Close = props.alwaysOpen ? function () {
18965
+ return null;
18966
+ } : SvgClose;
18877
18967
  return React__default.createElement(Container$n, null, React__default.createElement(Tabs, {
18878
18968
  internal: +(internal || false)
18879
- }, tabs.map(function (tab, index) {
18880
- return React__default.createElement(Tab, {
18969
+ }, options.reduce(function (elements, tab, index) {
18970
+ if (status[index] === 'closed') return elements;
18971
+ return [].concat(elements, [React__default.createElement(Tab, {
18881
18972
  key: index,
18882
- active: +(active === index),
18973
+ active: +(status[index] === 'active'),
18883
18974
  onClick: function onClick(event) {
18884
- return updateActiveTab(index, event);
18975
+ return onClickActivate(index, event);
18885
18976
  }
18886
- }, React__default.createElement("span", null, tab.label), getClose(index));
18887
- })));
18977
+ }, React__default.createElement("span", null, tab.label), React__default.createElement(Close, {
18978
+ onClick: function onClick() {
18979
+ return onClickClose(index);
18980
+ }
18981
+ }))]);
18982
+ }, [])));
18888
18983
  };
18889
18984
 
18890
18985
  var _templateObject$X;