@mw-kit/mw-ui 1.7.46 → 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/components/Calendar/components/Basic/components/Main/styles.d.ts +4 -1
- package/dist/components/Calendar/components/Basic/interfaces.d.ts +4 -1
- package/dist/index.js +139 -68
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +139 -68
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -12582,7 +12582,15 @@ var Checkbox = React__default.forwardRef(function (props, ref) {
|
|
|
12582
12582
|
bordered = props.bordered;
|
|
12583
12583
|
var htmlProps = filterObject(props, ['label', 'invalid', 'required', 'padding', 'bordered']);
|
|
12584
12584
|
|
|
12585
|
-
var _ref =
|
|
12585
|
+
var _ref = function () {
|
|
12586
|
+
if (!props.label) {
|
|
12587
|
+
return [function () {
|
|
12588
|
+
return null;
|
|
12589
|
+
}];
|
|
12590
|
+
}
|
|
12591
|
+
|
|
12592
|
+
return typeof props.label === 'function' ? [props.label] : [LabelContent, props.label];
|
|
12593
|
+
}(),
|
|
12586
12594
|
LabelComponent = _ref[0],
|
|
12587
12595
|
children = _ref[1];
|
|
12588
12596
|
|
|
@@ -12855,9 +12863,14 @@ var MenuComponent = function MenuComponent(props, ref) {
|
|
|
12855
12863
|
var children = _ref2.children;
|
|
12856
12864
|
return React__default.createElement(Popup, Object.assign({
|
|
12857
12865
|
on: 'click',
|
|
12858
|
-
position: '
|
|
12866
|
+
position: 'left center',
|
|
12859
12867
|
inverted: true,
|
|
12860
|
-
wide: true
|
|
12868
|
+
wide: true,
|
|
12869
|
+
popperModifiers: {
|
|
12870
|
+
preventOverflow: {
|
|
12871
|
+
boundariesElement: 'window'
|
|
12872
|
+
}
|
|
12873
|
+
}
|
|
12861
12874
|
}, rule, {
|
|
12862
12875
|
trigger: React__default.createElement("div", null, children)
|
|
12863
12876
|
}));
|
|
@@ -13050,7 +13063,7 @@ var Indicator = function Indicator(props) {
|
|
|
13050
13063
|
}, props)));
|
|
13051
13064
|
};
|
|
13052
13065
|
|
|
13053
|
-
var _templateObject$b, _templateObject2$b, _templateObject3$a, _templateObject4$8, _templateObject5$7, _templateObject6$6, _templateObject7$6, _templateObject8$5, _templateObject9$5, _templateObject10$5, _templateObject11$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;
|
|
13054
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"])));
|
|
13055
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) {
|
|
13056
13069
|
var theme = _ref.theme;
|
|
@@ -13075,52 +13088,46 @@ var Header = styled.div(_templateObject3$a || (_templateObject3$a = _taggedTempl
|
|
|
13075
13088
|
var theme = _ref7.theme;
|
|
13076
13089
|
return theme.getColor('lightestGrey', 40);
|
|
13077
13090
|
}, WeekContainer);
|
|
13078
|
-
var DayContainer = styled.button(_templateObject4$8 || (_templateObject4$8 = _taggedTemplateLiteralLoose(["\n position: relative;\n overflow: hidden;\n\n ", ";\n\n
|
|
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) {
|
|
13079
13092
|
var theme = _ref8.theme,
|
|
13080
13093
|
appearance = _ref8.appearance,
|
|
13094
|
+
activeColor = _ref8.activeColor,
|
|
13081
13095
|
onClick = _ref8.onClick;
|
|
13082
|
-
|
|
13083
|
-
|
|
13084
|
-
|
|
13085
|
-
|
|
13086
|
-
|
|
13087
|
-
var hover = function hover(color) {
|
|
13088
|
-
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;
|
|
13089
13100
|
};
|
|
13090
13101
|
|
|
13091
13102
|
if (appearance === 'disabled') {
|
|
13092
|
-
return css(
|
|
13103
|
+
return css(_templateObject6$6 || (_templateObject6$6 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), theme.getColor('greyishBlue', 10));
|
|
13093
13104
|
} else if (appearance === 'highlight') {
|
|
13094
|
-
return css(
|
|
13105
|
+
return css(_templateObject7$6 || (_templateObject7$6 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n ", "\n "])), theme.getColor('blue', 30), hover('blue'));
|
|
13095
13106
|
} else if (appearance === 'active') {
|
|
13096
|
-
return css(
|
|
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) {
|
|
13097
13108
|
var theme = _ref9.theme;
|
|
13098
|
-
return theme.colors
|
|
13109
|
+
return theme.colors[activeColor];
|
|
13099
13110
|
}, hover('white'));
|
|
13100
13111
|
}
|
|
13101
13112
|
|
|
13102
|
-
return css(
|
|
13113
|
+
return css(_templateObject9$5 || (_templateObject9$5 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n ", "\n "])), theme.colors.white, hover('blue'));
|
|
13103
13114
|
}, function (_ref10) {
|
|
13104
|
-
var
|
|
13105
|
-
if (!onClick) return;
|
|
13106
|
-
return css(_templateObject11$2 || (_templateObject11$2 = _taggedTemplateLiteralLoose(["\n :not(:disabled) {\n cursor: pointer;\n }\n "])));
|
|
13107
|
-
}, function (_ref11) {
|
|
13108
|
-
var theme = _ref11.theme;
|
|
13115
|
+
var theme = _ref10.theme;
|
|
13109
13116
|
return theme.colors.silver;
|
|
13110
|
-
}, function (
|
|
13111
|
-
var appearance =
|
|
13112
|
-
today =
|
|
13113
|
-
theme =
|
|
13117
|
+
}, function (_ref11) {
|
|
13118
|
+
var appearance = _ref11.appearance,
|
|
13119
|
+
today = _ref11.today,
|
|
13120
|
+
theme = _ref11.theme;
|
|
13114
13121
|
|
|
13115
13122
|
if (today !== 1) {
|
|
13116
13123
|
return;
|
|
13117
13124
|
}
|
|
13118
13125
|
|
|
13119
|
-
return css(
|
|
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']);
|
|
13120
13127
|
});
|
|
13121
13128
|
var DayIndicator = styled(Indicator).attrs({
|
|
13122
13129
|
size: 'mini'
|
|
13123
|
-
})(
|
|
13130
|
+
})(_templateObject11$2 || (_templateObject11$2 = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: calc(", " - 1px);\n left: calc(50% - (", " / 2) + 1px);\n"])), sizes.mini, sizes.mini);
|
|
13124
13131
|
|
|
13125
13132
|
var getCalendar = function getCalendar(d) {
|
|
13126
13133
|
var date = new Date(d.getTime());
|
|
@@ -13539,6 +13546,7 @@ var Main = React__default.forwardRef(function (props, ref) {
|
|
|
13539
13546
|
onMouseOut: onMouseOut,
|
|
13540
13547
|
disabled: disabled,
|
|
13541
13548
|
appearance: appearance,
|
|
13549
|
+
activeColor: details.activeColor || 'blue',
|
|
13542
13550
|
today: dateCompare(new Date(), date, 'eq', false) ? 1 : 0
|
|
13543
13551
|
}, day, details.indicator && React__default.createElement(DayIndicator, {
|
|
13544
13552
|
type: details.indicator
|
|
@@ -13701,7 +13709,7 @@ var getTimeProps = function getTimeProps(time, value) {
|
|
|
13701
13709
|
});
|
|
13702
13710
|
};
|
|
13703
13711
|
|
|
13704
|
-
var _templateObject$e, _templateObject2$c, _templateObject3$b, _templateObject4$9, _templateObject5$8, _templateObject6$7, _templateObject7$7, _templateObject8$6, _templateObject9$6, _templateObject10$6, _templateObject11$3, _templateObject12$
|
|
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;
|
|
13705
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) {
|
|
13706
13714
|
var theme = _ref.theme,
|
|
13707
13715
|
appearance = _ref.appearance;
|
|
@@ -13780,7 +13788,7 @@ var Button = styled.button(_templateObject$e || (_templateObject$e = _taggedTemp
|
|
|
13780
13788
|
}, function (_ref10) {
|
|
13781
13789
|
var loading = _ref10.loading;
|
|
13782
13790
|
if (!loading) return;
|
|
13783
|
-
return css(_templateObject12$
|
|
13791
|
+
return css(_templateObject12$2 || (_templateObject12$2 = _taggedTemplateLiteralLoose(["\n pointer-events: none;\n "])));
|
|
13784
13792
|
});
|
|
13785
13793
|
|
|
13786
13794
|
var _excluded = ["children", "content"];
|
|
@@ -15569,7 +15577,7 @@ var Switch = function Switch(props) {
|
|
|
15569
15577
|
})), React__default.createElement("span", null), label.after && React__default.createElement(LabelContainer$3, null, label.after));
|
|
15570
15578
|
};
|
|
15571
15579
|
|
|
15572
|
-
var _templateObject$q, _templateObject2$m, _templateObject3$i, _templateObject4$d, _templateObject5$b, _templateObject6$a, _templateObject7$a, _templateObject8$8, _templateObject9$8, _templateObject10$7, _templateObject11$4, _templateObject12$
|
|
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;
|
|
15573
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) {
|
|
15574
15582
|
var theme = _ref.theme;
|
|
15575
15583
|
return theme.spacings.s4;
|
|
@@ -15637,9 +15645,9 @@ var InputContainer$1 = styled.div(_templateObject10$7 || (_templateObject10$7 =
|
|
|
15637
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);
|
|
15638
15646
|
}
|
|
15639
15647
|
|
|
15640
|
-
return css(_templateObject12$
|
|
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);
|
|
15641
15649
|
});
|
|
15642
|
-
var MinMaxLabelContainer = styled.div(_templateObject13$
|
|
15650
|
+
var MinMaxLabelContainer = styled.div(_templateObject13$2 || (_templateObject13$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n padding-bottom: 2px;\n"])));
|
|
15643
15651
|
var LabelsContainer = styled.div(_templateObject14$2 || (_templateObject14$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n gap: 7px;\n\n ", "\n"])), function (_ref19) {
|
|
15644
15652
|
var position = _ref19.position;
|
|
15645
15653
|
|
|
@@ -15892,7 +15900,7 @@ var LabelContainer$5 = styled.div(_templateObject$r || (_templateObject$r = _tag
|
|
|
15892
15900
|
var theme = _ref.theme;
|
|
15893
15901
|
return theme.useTypography('p');
|
|
15894
15902
|
});
|
|
15895
|
-
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) {
|
|
15896
15904
|
var theme = _ref2.theme;
|
|
15897
15905
|
return theme.spacings.s1;
|
|
15898
15906
|
}, function (_ref3) {
|
|
@@ -16130,7 +16138,7 @@ var parse = function parse(value) {
|
|
|
16130
16138
|
});
|
|
16131
16139
|
};
|
|
16132
16140
|
|
|
16133
|
-
var _templateObject$s, _templateObject2$o, _templateObject3$k, _templateObject4$f, _templateObject5$d, _templateObject6$c, _templateObject7$c, _templateObject8$9, _templateObject9$9, _templateObject10$8, _templateObject11$5, _templateObject12$
|
|
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;
|
|
16134
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"])));
|
|
16135
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) {
|
|
16136
16144
|
var theme = _ref.theme;
|
|
@@ -16186,7 +16194,7 @@ var LabelText$1 = styled.label(_templateObject11$5 || (_templateObject11$5 = _ta
|
|
|
16186
16194
|
}, function (_ref13) {
|
|
16187
16195
|
var required = _ref13.required;
|
|
16188
16196
|
if (!required) return;
|
|
16189
|
-
return css(_templateObject12$
|
|
16197
|
+
return css(_templateObject12$4 || (_templateObject12$4 = _taggedTemplateLiteralLoose(["\n :after {\n content: ' *';\n }\n "])));
|
|
16190
16198
|
});
|
|
16191
16199
|
|
|
16192
16200
|
var Component$1 = React__default.forwardRef(function (props, ref) {
|
|
@@ -17669,7 +17677,7 @@ var useContext$2 = function useContext() {
|
|
|
17669
17677
|
return React__default.useContext(Provider$2);
|
|
17670
17678
|
};
|
|
17671
17679
|
|
|
17672
|
-
var _templateObject$D, _templateObject2$u, _templateObject3$p, _templateObject4$i, _templateObject5$f, _templateObject6$e, _templateObject7$e, _templateObject8$b, _templateObject9$b, _templateObject10$a, _templateObject11$6, _templateObject12$
|
|
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;
|
|
17673
17681
|
var aligns = {
|
|
17674
17682
|
self: {
|
|
17675
17683
|
horizontal: {
|
|
@@ -17766,13 +17774,13 @@ var Col = styled.div(_templateObject$D || (_templateObject$D = _taggedTemplateLi
|
|
|
17766
17774
|
theme = _ref6.theme;
|
|
17767
17775
|
if (fontColor === undefined) return;
|
|
17768
17776
|
var c = Array.isArray(fontColor) ? theme.getColor.apply(theme, fontColor) : theme.colors[fontColor];
|
|
17769
|
-
return css(_templateObject12$
|
|
17777
|
+
return css(_templateObject12$5 || (_templateObject12$5 = _taggedTemplateLiteralLoose(["\n color: ", ";\n "])), c);
|
|
17770
17778
|
}, function (_ref7) {
|
|
17771
17779
|
var backgroundColor = _ref7.backgroundColor,
|
|
17772
17780
|
theme = _ref7.theme;
|
|
17773
17781
|
if (backgroundColor === undefined) return;
|
|
17774
17782
|
var c = Array.isArray(backgroundColor) ? theme.getColor.apply(theme, backgroundColor) : theme.colors[backgroundColor];
|
|
17775
|
-
return css(_templateObject13$
|
|
17783
|
+
return css(_templateObject13$3 || (_templateObject13$3 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n "])), c);
|
|
17776
17784
|
}, function (_ref8) {
|
|
17777
17785
|
var hover = _ref8.hover,
|
|
17778
17786
|
theme = _ref8.theme;
|
|
@@ -18819,57 +18827,120 @@ var Tab = styled.li(_templateObject5$t || (_templateObject5$t = _taggedTemplateL
|
|
|
18819
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);
|
|
18820
18828
|
});
|
|
18821
18829
|
|
|
18830
|
+
var initialStatus = function initialStatus(active, length) {
|
|
18831
|
+
var status = Array(length).fill('open');
|
|
18832
|
+
status[active] = 'active';
|
|
18833
|
+
return status;
|
|
18834
|
+
};
|
|
18835
|
+
|
|
18822
18836
|
var Tabs$1 = function Tabs$1(props) {
|
|
18823
18837
|
var options = props.options,
|
|
18824
18838
|
activeState = props.activeState,
|
|
18825
18839
|
internal = props.internal;
|
|
18826
|
-
|
|
18827
|
-
var _useState = useState(options),
|
|
18828
|
-
tabs = _useState[0],
|
|
18829
|
-
setTabs = _useState[1];
|
|
18830
|
-
|
|
18831
18840
|
var active = activeState[0],
|
|
18832
18841
|
setActive = activeState[1];
|
|
18833
18842
|
|
|
18834
|
-
var
|
|
18835
|
-
|
|
18836
|
-
|
|
18837
|
-
setActive(index);
|
|
18838
|
-
};
|
|
18843
|
+
var _useState = useState(initialStatus(active, options.length)),
|
|
18844
|
+
status = _useState[0],
|
|
18845
|
+
setStatus = _useState[1];
|
|
18839
18846
|
|
|
18840
|
-
var
|
|
18841
|
-
|
|
18842
|
-
|
|
18847
|
+
var activate = function activate(active, length) {
|
|
18848
|
+
setStatus(function (prev) {
|
|
18849
|
+
if (length !== undefined && length !== prev.length) {
|
|
18850
|
+
return initialStatus(active, length);
|
|
18851
|
+
}
|
|
18852
|
+
|
|
18853
|
+
var current = prev.findIndex(function (e) {
|
|
18854
|
+
return e === 'active';
|
|
18855
|
+
});
|
|
18843
18856
|
|
|
18844
|
-
if (
|
|
18845
|
-
|
|
18857
|
+
if (current !== active && current > -1 && active > -1 && active < prev.length) {
|
|
18858
|
+
var _status = [].concat(prev);
|
|
18859
|
+
|
|
18860
|
+
_status[current] = 'open';
|
|
18861
|
+
_status[active] = 'active';
|
|
18862
|
+
return [].concat(_status);
|
|
18846
18863
|
}
|
|
18847
18864
|
|
|
18848
|
-
|
|
18849
|
-
return aux;
|
|
18865
|
+
return prev;
|
|
18850
18866
|
});
|
|
18851
18867
|
};
|
|
18852
18868
|
|
|
18853
|
-
|
|
18854
|
-
|
|
18855
|
-
}
|
|
18856
|
-
|
|
18857
|
-
|
|
18858
|
-
|
|
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
|
+
}
|
|
18859
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;
|
|
18860
18922
|
});
|
|
18861
18923
|
};
|
|
18924
|
+
|
|
18925
|
+
var Close = props.alwaysOpen ? function () {
|
|
18926
|
+
return null;
|
|
18927
|
+
} : SvgClose;
|
|
18862
18928
|
return React__default.createElement(Container$n, null, React__default.createElement(Tabs, {
|
|
18863
18929
|
internal: +(internal || false)
|
|
18864
|
-
},
|
|
18865
|
-
|
|
18930
|
+
}, options.reduce(function (elements, tab, index) {
|
|
18931
|
+
if (status[index] === 'closed') return elements;
|
|
18932
|
+
return [].concat(elements, [React__default.createElement(Tab, {
|
|
18866
18933
|
key: index,
|
|
18867
|
-
active: +(
|
|
18934
|
+
active: +(status[index] === 'active'),
|
|
18868
18935
|
onClick: function onClick(event) {
|
|
18869
|
-
return
|
|
18936
|
+
return onClickActivate(index, event);
|
|
18870
18937
|
}
|
|
18871
|
-
}, React__default.createElement("span", null, tab.label),
|
|
18872
|
-
|
|
18938
|
+
}, React__default.createElement("span", null, tab.label), React__default.createElement(Close, {
|
|
18939
|
+
onClick: function onClick() {
|
|
18940
|
+
return onClickClose(index);
|
|
18941
|
+
}
|
|
18942
|
+
}))]);
|
|
18943
|
+
}, [])));
|
|
18873
18944
|
};
|
|
18874
18945
|
|
|
18875
18946
|
var _templateObject$X;
|