@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.
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());
@@ -13425,9 +13418,11 @@ var Main = React__default.forwardRef(function (props, ref) {
13425
13418
  });
13426
13419
  };
13427
13420
 
13421
+ var isControlled = props.calendar !== undefined;
13428
13422
  React.useEffect(function () {
13423
+ if (isControlled) return;
13429
13424
  setCalendar(getInitialCalendar(initialMonth, min, max));
13430
- }, [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()]);
13425
+ }, [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()]);
13431
13426
  React.useEffect(function () {
13432
13427
  var _ref2 = [calendar.weeks[0], calendar.weeks[calendar.weeks.length - 1]],
13433
13428
  first = _ref2[0],
@@ -13562,7 +13557,19 @@ var Main = React__default.forwardRef(function (props, ref) {
13562
13557
  type: details.indicator
13563
13558
  }));
13564
13559
  }));
13565
- })), props.children && React__default.createElement(Footer, null, props.children), loading && React__default.createElement(Loader, {
13560
+ })), function () {
13561
+ if (!props.children) {
13562
+ return null;
13563
+ }
13564
+
13565
+ if (Array.isArray(props.children) && !props.children.some(function (e) {
13566
+ return e;
13567
+ })) {
13568
+ return null;
13569
+ }
13570
+
13571
+ return React__default.createElement(Footer, null, props.children);
13572
+ }(), loading && React__default.createElement(Loader, {
13566
13573
  filled: theme$2.getColor('white', 95)
13567
13574
  }));
13568
13575
  });
@@ -13719,7 +13726,7 @@ var getTimeProps = function getTimeProps(time, value) {
13719
13726
  });
13720
13727
  };
13721
13728
 
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;
13729
+ 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
13730
  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
13731
  var theme = _ref.theme,
13725
13732
  appearance = _ref.appearance;
@@ -13798,7 +13805,7 @@ var Button = styled__default.button(_templateObject$e || (_templateObject$e = _t
13798
13805
  }, function (_ref10) {
13799
13806
  var loading = _ref10.loading;
13800
13807
  if (!loading) return;
13801
- return styled.css(_templateObject12$3 || (_templateObject12$3 = _taggedTemplateLiteralLoose(["\n pointer-events: none;\n "])));
13808
+ return styled.css(_templateObject12$2 || (_templateObject12$2 = _taggedTemplateLiteralLoose(["\n pointer-events: none;\n "])));
13802
13809
  });
13803
13810
 
13804
13811
  var _excluded = ["children", "content"];
@@ -13863,7 +13870,10 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
13863
13870
  time = _useState[0],
13864
13871
  setTime = _useState[1];
13865
13872
 
13866
- var _useState2 = React.useState(getInitialCalendar(value[0] || initialMonth, min, max)),
13873
+ var _useState2 = React.useState(function () {
13874
+ var calendar1 = getInitialCalendar(value[0] || initialMonth, min, max);
13875
+ return calendar1;
13876
+ }),
13867
13877
  calendar1 = _useState2[0],
13868
13878
  _setCalendar1 = _useState2[1];
13869
13879
 
@@ -13874,7 +13884,10 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
13874
13884
  });
13875
13885
  };
13876
13886
 
13877
- var _useState3 = React.useState(getCalendar2(calendar1)),
13887
+ var _useState3 = React.useState(function () {
13888
+ var calendar2 = getCalendar2(calendar1);
13889
+ return calendar2;
13890
+ }),
13878
13891
  calendar2 = _useState3[0],
13879
13892
  _setCalendar2 = _useState3[1];
13880
13893
 
@@ -13889,6 +13902,12 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
13889
13902
  hoverDay = _useState4[0],
13890
13903
  setHoverDay = _useState4[1];
13891
13904
 
13905
+ React.useEffect(function () {
13906
+ var calendar1 = getInitialCalendar(value[0] || initialMonth, min, max);
13907
+ var calendar2 = getCalendar2(calendar1);
13908
+ setCalendar1(calendar1);
13909
+ setCalendar2(calendar2);
13910
+ }, [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()]);
13892
13911
  React.useEffect(function () {
13893
13912
  var timeProps = getTimeProps(props.time, value);
13894
13913
  setHoverDay(null);
@@ -14007,11 +14026,16 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
14007
14026
  }
14008
14027
  });
14009
14028
  }();
14010
- var middle = new Date();
14011
- middle.setFullYear(calendar1.year);
14012
- middle.setMonth(calendar1.month + 1);
14013
- middle.setDate(1);
14014
- middle.setHours(0, 0, 0, 0);
14029
+ var middle = [new Date(), new Date()];
14030
+ middle[0].setDate(1);
14031
+ middle[0].setFullYear(calendar2.year);
14032
+ middle[0].setMonth(calendar2.month);
14033
+ middle[0].setDate(0);
14034
+ middle[0].setHours(23, 59, 59, 999);
14035
+ middle[1].setDate(1);
14036
+ middle[1].setFullYear(calendar1.year);
14037
+ middle[1].setMonth(calendar1.month + 1);
14038
+ middle[1].setHours(0, 0, 0, 0);
14015
14039
  var inputs = getTimeProps(props.time, value).map(function (timeProps, index) {
14016
14040
  if (!timeProps) return undefined;
14017
14041
  var width = timeProps.seconds ? 'withSeconds' : 'withoutSeconds';
@@ -14052,12 +14076,20 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
14052
14076
  calendar: [calendar1, function (v) {
14053
14077
  setCalendar1(function (prev) {
14054
14078
  var c1 = typeof v === 'function' ? v(prev) : v;
14055
- setCalendar2(getCalendar2(c1));
14079
+ setCalendar2(function (prev) {
14080
+ if (prev.year > c1.year) return prev;
14081
+
14082
+ if (prev.year === c1.year && prev.month > c1.month) {
14083
+ return prev;
14084
+ }
14085
+
14086
+ return getCalendar2(c1);
14087
+ });
14056
14088
  return c1;
14057
14089
  });
14058
14090
  }],
14059
14091
  min: min,
14060
- max: max
14092
+ max: max && dateCompare(max, middle[0], 'lt') ? max : middle[0]
14061
14093
  }), inputs[0]), React__default.createElement(BasicCalendar, Object.assign({}, calendarProps, {
14062
14094
  getDay: function getDay(c) {
14063
14095
  return _getDay2(c, 'right');
@@ -14072,7 +14104,7 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
14072
14104
  ref: ref,
14073
14105
  label: React__default.createElement(LabelContainer$1, null, React__default.createElement("b", null, "Fim:"), " ", value[1] ? dateToIsoString(value[1]) : '––/––/––––'),
14074
14106
  calendar: [calendar2, setCalendar2],
14075
- min: min && dateCompare(min, middle, 'gt') ? min : middle,
14107
+ min: min && dateCompare(min, middle[1], 'gt') ? min : middle[1],
14076
14108
  max: max
14077
14109
  }), inputs[1], submitProps && React__default.createElement(SubmitButton, Object.assign({
14078
14110
  content: 'Aplicar'
@@ -15587,7 +15619,7 @@ var Switch = function Switch(props) {
15587
15619
  })), React__default.createElement("span", null), label.after && React__default.createElement(LabelContainer$3, null, label.after));
15588
15620
  };
15589
15621
 
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;
15622
+ 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
15623
  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
15624
  var theme = _ref.theme;
15593
15625
  return theme.spacings.s4;
@@ -15655,9 +15687,9 @@ var InputContainer$1 = styled__default.div(_templateObject10$7 || (_templateObje
15655
15687
  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
15688
  }
15657
15689
 
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);
15690
+ 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
15691
  });
15660
- var MinMaxLabelContainer = styled__default.div(_templateObject13$3 || (_templateObject13$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n padding-bottom: 2px;\n"])));
15692
+ var MinMaxLabelContainer = styled__default.div(_templateObject13$2 || (_templateObject13$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n padding-bottom: 2px;\n"])));
15661
15693
  var LabelsContainer = styled__default.div(_templateObject14$2 || (_templateObject14$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n gap: 7px;\n\n ", "\n"])), function (_ref19) {
15662
15694
  var position = _ref19.position;
15663
15695
 
@@ -15910,7 +15942,7 @@ var LabelContainer$5 = styled__default.div(_templateObject$r || (_templateObject
15910
15942
  var theme = _ref.theme;
15911
15943
  return theme.useTypography('p');
15912
15944
  });
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) {
15945
+ 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
15946
  var theme = _ref2.theme;
15915
15947
  return theme.spacings.s1;
15916
15948
  }, function (_ref3) {
@@ -16148,7 +16180,7 @@ var parse = function parse(value) {
16148
16180
  });
16149
16181
  };
16150
16182
 
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;
16183
+ 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
16184
  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
16185
  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
16186
  var theme = _ref.theme;
@@ -16204,7 +16236,7 @@ var LabelText$1 = styled__default.label(_templateObject11$5 || (_templateObject1
16204
16236
  }, function (_ref13) {
16205
16237
  var required = _ref13.required;
16206
16238
  if (!required) return;
16207
- return styled.css(_templateObject12$5 || (_templateObject12$5 = _taggedTemplateLiteralLoose(["\n :after {\n content: ' *';\n }\n "])));
16239
+ return styled.css(_templateObject12$4 || (_templateObject12$4 = _taggedTemplateLiteralLoose(["\n :after {\n content: ' *';\n }\n "])));
16208
16240
  });
16209
16241
 
16210
16242
  var Component$1 = React__default.forwardRef(function (props, ref) {
@@ -17687,7 +17719,7 @@ var useContext$2 = function useContext() {
17687
17719
  return React__default.useContext(Provider$2);
17688
17720
  };
17689
17721
 
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;
17722
+ 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
17723
  var aligns = {
17692
17724
  self: {
17693
17725
  horizontal: {
@@ -17784,13 +17816,13 @@ var Col = styled__default.div(_templateObject$D || (_templateObject$D = _taggedT
17784
17816
  theme = _ref6.theme;
17785
17817
  if (fontColor === undefined) return;
17786
17818
  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);
17819
+ return styled.css(_templateObject12$5 || (_templateObject12$5 = _taggedTemplateLiteralLoose(["\n color: ", ";\n "])), c);
17788
17820
  }, function (_ref7) {
17789
17821
  var backgroundColor = _ref7.backgroundColor,
17790
17822
  theme = _ref7.theme;
17791
17823
  if (backgroundColor === undefined) return;
17792
17824
  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);
17825
+ return styled.css(_templateObject13$3 || (_templateObject13$3 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), c);
17794
17826
  }, function (_ref8) {
17795
17827
  var hover = _ref8.hover,
17796
17828
  theme = _ref8.theme;
@@ -18837,57 +18869,120 @@ var Tab = styled__default.li(_templateObject5$t || (_templateObject5$t = _tagged
18837
18869
  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
18870
  });
18839
18871
 
18872
+ var initialStatus = function initialStatus(active, length) {
18873
+ var status = Array(length).fill('open');
18874
+ status[active] = 'active';
18875
+ return status;
18876
+ };
18877
+
18840
18878
  var Tabs$1 = function Tabs$1(props) {
18841
18879
  var options = props.options,
18842
18880
  activeState = props.activeState,
18843
18881
  internal = props.internal;
18844
-
18845
- var _useState = React.useState(options),
18846
- tabs = _useState[0],
18847
- setTabs = _useState[1];
18848
-
18849
18882
  var active = activeState[0],
18850
18883
  setActive = activeState[1];
18851
18884
 
18852
- var updateActiveTab = function updateActiveTab(index, event) {
18853
- var element = event.target;
18854
- if (element.tagName === 'svg') return;
18855
- setActive(index);
18856
- };
18885
+ var _useState = React.useState(initialStatus(active, options.length)),
18886
+ status = _useState[0],
18887
+ setStatus = _useState[1];
18857
18888
 
18858
- var removeTab = function removeTab(index) {
18859
- setTabs(function (prevState) {
18860
- var aux = [].concat(prevState);
18889
+ var activate = function activate(active, length) {
18890
+ setStatus(function (prev) {
18891
+ if (length !== undefined && length !== prev.length) {
18892
+ return initialStatus(active, length);
18893
+ }
18894
+
18895
+ var current = prev.findIndex(function (e) {
18896
+ return e === 'active';
18897
+ });
18898
+
18899
+ if (current !== active && current > -1 && active > -1 && active < prev.length) {
18900
+ var _status = [].concat(prev);
18861
18901
 
18862
- if (index === active) {
18863
- setActive(index > 0 ? index - 1 : 1);
18902
+ _status[current] = 'open';
18903
+ _status[active] = 'active';
18904
+ return [].concat(_status);
18864
18905
  }
18865
18906
 
18866
- aux.splice(index, 1);
18867
- return aux;
18907
+ return prev;
18868
18908
  });
18869
18909
  };
18870
18910
 
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);
18911
+ React.useEffect(function () {
18912
+ activate(active, options.length);
18913
+ }, [active, options.length]);
18914
+ React.useEffect(function () {
18915
+ var current = status.findIndex(function (e) {
18916
+ return e === 'active';
18917
+ });
18918
+ setActive(current);
18919
+ }, [status]);
18920
+
18921
+ var onClickActivate = function onClickActivate(index, event) {
18922
+ var element = event.target;
18923
+
18924
+ while (element) {
18925
+ if (element.tagName === 'svg') return;
18926
+ element = element.parentElement;
18927
+ }
18928
+
18929
+ activate(index);
18930
+ };
18931
+
18932
+ var onClickClose = function onClickClose(index) {
18933
+ var getActive = function getActive(removed, prev) {
18934
+ for (var i = index - 1; i > -1; i--) {
18935
+ if (removed[i] !== 'closed') {
18936
+ return i;
18937
+ }
18877
18938
  }
18939
+
18940
+ for (var _i = index + 1; _i < removed.length; _i++) {
18941
+ if (removed[_i] !== 'closed') {
18942
+ return _i;
18943
+ }
18944
+ }
18945
+
18946
+ return prev;
18947
+ };
18948
+
18949
+ setStatus(function (prev) {
18950
+ if (prev[index] === 'closed') return prev;
18951
+ var active = prev.findIndex(function (e) {
18952
+ return e === 'active';
18953
+ });
18954
+ var status = [].concat(prev);
18955
+ status[index] = 'closed';
18956
+
18957
+ if (active === index) {
18958
+ var _active = getActive(status, index);
18959
+
18960
+ status[_active] = 'active';
18961
+ }
18962
+
18963
+ return status;
18878
18964
  });
18879
18965
  };
18966
+
18967
+ var Close = props.alwaysOpen ? function () {
18968
+ return null;
18969
+ } : SvgClose;
18880
18970
  return React__default.createElement(Container$n, null, React__default.createElement(Tabs, {
18881
18971
  internal: +(internal || false)
18882
- }, tabs.map(function (tab, index) {
18883
- return React__default.createElement(Tab, {
18972
+ }, options.reduce(function (elements, tab, index) {
18973
+ if (status[index] === 'closed') return elements;
18974
+ return [].concat(elements, [React__default.createElement(Tab, {
18884
18975
  key: index,
18885
- active: +(active === index),
18976
+ active: +(status[index] === 'active'),
18886
18977
  onClick: function onClick(event) {
18887
- return updateActiveTab(index, event);
18978
+ return onClickActivate(index, event);
18888
18979
  }
18889
- }, React__default.createElement("span", null, tab.label), getClose(index));
18890
- })));
18980
+ }, React__default.createElement("span", null, tab.label), React__default.createElement(Close, {
18981
+ onClick: function onClick() {
18982
+ return onClickClose(index);
18983
+ }
18984
+ }))]);
18985
+ }, [])));
18891
18986
  };
18892
18987
 
18893
18988
  var _templateObject$X;