@thecb/components 4.2.7-beta.3 → 4.2.7-beta.4
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.cjs.js
CHANGED
|
@@ -6898,7 +6898,7 @@ function _templateObject3$2() {
|
|
|
6898
6898
|
}
|
|
6899
6899
|
|
|
6900
6900
|
function _templateObject2$4() {
|
|
6901
|
-
var data = _taggedTemplateLiteral(["\n box-sizing: border-box;\n display: flex;\n flex-wrap: wrap;\n overflow: hidden;\n padding: ", ";\n margin: ", ";\n\n > * {\n flex-grow: 1;\n ", ";\n ", "\n }\n\n ", "\n\n ", "\n\n ", "\n"]);
|
|
6901
|
+
var data = _taggedTemplateLiteral(["\n box-sizing: border-box;\n display: flex;\n flex-wrap: wrap;\n overflow: hidden;\n padding: ", ";\n margin: ", ";\n ", "\n\n > * {\n flex-grow: 1;\n ", ";\n ", "\n ", "\n }\n\n ", "\n\n ", "\n\n ", "\n"]);
|
|
6902
6902
|
|
|
6903
6903
|
_templateObject2$4 = function _templateObject2() {
|
|
6904
6904
|
return data;
|
|
@@ -6924,22 +6924,28 @@ var SwitcherInnerContainer = styled__default.div(_templateObject2$4(), function
|
|
|
6924
6924
|
var childGap = _ref2.childGap;
|
|
6925
6925
|
return "calc((".concat(childGap, " / 2) * -1)");
|
|
6926
6926
|
}, function (_ref3) {
|
|
6927
|
-
var
|
|
6928
|
-
|
|
6929
|
-
childGap = _ref3.childGap;
|
|
6930
|
-
return !maxChildrenOnly ? "flex-basis: calc((".concat(breakpoint, " - (100% - ").concat(childGap, ")) * 999);") : "";
|
|
6927
|
+
var constrainMobile = _ref3.constrainMobile;
|
|
6928
|
+
return constrainMobile && "max-width: 100%; margin-left: 0; margin-right: 0;";
|
|
6931
6929
|
}, function (_ref4) {
|
|
6932
|
-
var
|
|
6933
|
-
|
|
6930
|
+
var maxChildrenOnly = _ref4.maxChildrenOnly,
|
|
6931
|
+
breakpoint = _ref4.breakpoint,
|
|
6932
|
+
childGap = _ref4.childGap;
|
|
6933
|
+
return !maxChildrenOnly ? "flex-basis: calc((".concat(breakpoint, " - (100% - ").concat(childGap, ")) * 999);") : "";
|
|
6934
6934
|
}, function (_ref5) {
|
|
6935
|
-
var
|
|
6936
|
-
|
|
6937
|
-
return largeChild && largeChildSize ? "> :nth-child(".concat(largeChild, ") {\n flex-grow: ").concat(largeChildSize, ";\n }") : "";
|
|
6935
|
+
var childGap = _ref5.childGap;
|
|
6936
|
+
return "margin: calc(".concat(childGap, " / 2);");
|
|
6938
6937
|
}, function (_ref6) {
|
|
6939
|
-
var
|
|
6940
|
-
return
|
|
6938
|
+
var constrainMobile = _ref6.constrainMobile;
|
|
6939
|
+
return constrainMobile && "margin-left: 0; margin-right: 0;";
|
|
6941
6940
|
}, function (_ref7) {
|
|
6942
|
-
var
|
|
6941
|
+
var largeChild = _ref7.largeChild,
|
|
6942
|
+
largeChildSize = _ref7.largeChildSize;
|
|
6943
|
+
return largeChild && largeChildSize ? "> :nth-child(".concat(largeChild, ") {\n flex-grow: ").concat(largeChildSize, ";\n }") : "";
|
|
6944
|
+
}, function (_ref8) {
|
|
6945
|
+
var maxChildren = _ref8.maxChildren;
|
|
6946
|
+
return maxChildren ? "> :nth-last-child(".concat(maxChildren + 1, "), > :nth-last-child(").concat(maxChildren + 1, ") ~ * {\n flex-basis: 100%;\n }") : "";
|
|
6947
|
+
}, function (_ref9) {
|
|
6948
|
+
var extraStyles = _ref9.extraStyles;
|
|
6943
6949
|
return styled.css(_templateObject3$2(), extraStyles);
|
|
6944
6950
|
});
|
|
6945
6951
|
|
|
@@ -6968,6 +6974,11 @@ var SwitcherInnerContainer = styled__default.div(_templateObject2$4(), function
|
|
|
6968
6974
|
products/services should share the same width no matter the orientation, otherwise
|
|
6969
6975
|
one or more cards could be perceived as highlighted or featured in some way. Or
|
|
6970
6976
|
a set of numbered steps in, for example, a list of items to complete or tasks to do."
|
|
6977
|
+
|
|
6978
|
+
New: Set the "constrainMobile" prop to true in order to prevent switcher content from
|
|
6979
|
+
overflowing the mobile viewport:
|
|
6980
|
+
|
|
6981
|
+
<Switcher constrainMobile={isMobile} />
|
|
6971
6982
|
*/
|
|
6972
6983
|
|
|
6973
6984
|
var Switcher = function Switcher(_ref) {
|
|
@@ -6984,7 +6995,9 @@ var Switcher = function Switcher(_ref) {
|
|
|
6984
6995
|
padding = _ref$padding === void 0 ? "0" : _ref$padding,
|
|
6985
6996
|
children = _ref.children,
|
|
6986
6997
|
extraStyles = _ref.extraStyles,
|
|
6987
|
-
|
|
6998
|
+
_ref$constrainMobile = _ref.constrainMobile,
|
|
6999
|
+
constrainMobile = _ref$constrainMobile === void 0 ? false : _ref$constrainMobile,
|
|
7000
|
+
rest = _objectWithoutProperties(_ref, ["breakpoint", "childGap", "largeChild", "largeChildSize", "maxChildren", "maxChildrenOnly", "padding", "children", "extraStyles", "constrainMobile"]);
|
|
6988
7001
|
|
|
6989
7002
|
return /*#__PURE__*/React__default.createElement(SwitcherOuterContainer, null, /*#__PURE__*/React__default.createElement(SwitcherInnerContainer, _extends({
|
|
6990
7003
|
breakpoint: breakpoint,
|
|
@@ -6994,7 +7007,8 @@ var Switcher = function Switcher(_ref) {
|
|
|
6994
7007
|
maxChildren: maxChildren,
|
|
6995
7008
|
maxChildrenOnly: maxChildrenOnly,
|
|
6996
7009
|
padding: padding,
|
|
6997
|
-
extraStyles: extraStyles
|
|
7010
|
+
extraStyles: extraStyles,
|
|
7011
|
+
constrainMobile: constrainMobile
|
|
6998
7012
|
}, rest), safeChildren(children, /*#__PURE__*/React__default.createElement(React.Fragment, null))));
|
|
6999
7013
|
};
|
|
7000
7014
|
|
|
@@ -12692,7 +12706,7 @@ var ButtonWithAction = function ButtonWithAction(_ref2) {
|
|
|
12692
12706
|
var isMobile = themeContext.isMobile;
|
|
12693
12707
|
var hoverStyles = "\n outline: none;\n background-color: ".concat(themeValues.hoverBackgroundColor, ";\n border-color: ").concat(themeValues.hoverBorderColor, ";\n color: ").concat(themeValues.hoverColor, ";\n text-decoration: ").concat(variant === "ghost" || variant === "smallGhost" ? "underline" : "none", ";\n cursor: pointer;\n ");
|
|
12694
12708
|
var activeStyles = "\n outline: none;\n background-color: ".concat(themeValues.activeBackgroundColor, ";\n border-color: ").concat(themeValues.activeBorderColor, ";\n color: ").concat(themeValues.activeColor, ";\n text-decoration: ").concat(variant === "ghost" || variant === "smallGhost" ? "underline" : "none", ";\n ");
|
|
12695
|
-
var disabledStyles = "\n background-color: #6D717E;\n border-color: #6D717E;\n color: #FFFFFF;\n &:focus {\n box-shadow: 0 0 10px #6D717E;\n outline: none;\n }\n ";
|
|
12709
|
+
var disabledStyles = "\n background-color: #6D717E;\n border-color: #6D717E;\n color: #FFFFFF;\n cursor: default;\n &:focus {\n box-shadow: 0 0 10px #6D717E;\n outline: none;\n }\n ";
|
|
12696
12710
|
return /*#__PURE__*/React__default.createElement(Box, _extends({
|
|
12697
12711
|
variant: variant,
|
|
12698
12712
|
padding: themeValues.padding,
|
package/package.json
CHANGED
|
@@ -30,6 +30,11 @@ import {
|
|
|
30
30
|
products/services should share the same width no matter the orientation, otherwise
|
|
31
31
|
one or more cards could be perceived as highlighted or featured in some way. Or
|
|
32
32
|
a set of numbered steps in, for example, a list of items to complete or tasks to do."
|
|
33
|
+
|
|
34
|
+
New: Set the "constrainMobile" prop to true in order to prevent switcher content from
|
|
35
|
+
overflowing the mobile viewport:
|
|
36
|
+
|
|
37
|
+
<Switcher constrainMobile={isMobile} />
|
|
33
38
|
*/
|
|
34
39
|
|
|
35
40
|
const Switcher = ({
|
|
@@ -42,6 +47,7 @@ const Switcher = ({
|
|
|
42
47
|
padding = "0",
|
|
43
48
|
children,
|
|
44
49
|
extraStyles,
|
|
50
|
+
constrainMobile = false,
|
|
45
51
|
...rest
|
|
46
52
|
}) => (
|
|
47
53
|
<SwitcherOuterContainer>
|
|
@@ -54,6 +60,7 @@ const Switcher = ({
|
|
|
54
60
|
maxChildrenOnly={maxChildrenOnly}
|
|
55
61
|
padding={padding}
|
|
56
62
|
extraStyles={extraStyles}
|
|
63
|
+
constrainMobile={constrainMobile}
|
|
57
64
|
{...rest}
|
|
58
65
|
>
|
|
59
66
|
{safeChildren(children, <Fragment />)}
|
|
@@ -12,6 +12,8 @@ export const SwitcherInnerContainer = styled.div`
|
|
|
12
12
|
overflow: hidden;
|
|
13
13
|
padding: ${({ padding }) => padding};
|
|
14
14
|
margin: ${({ childGap }) => `calc((${childGap} / 2) * -1)`};
|
|
15
|
+
${({ constrainMobile }) =>
|
|
16
|
+
constrainMobile && `max-width: 100%; margin-left: 0; margin-right: 0;`}
|
|
15
17
|
|
|
16
18
|
> * {
|
|
17
19
|
flex-grow: 1;
|
|
@@ -20,6 +22,8 @@ export const SwitcherInnerContainer = styled.div`
|
|
|
20
22
|
? `flex-basis: calc((${breakpoint} - (100% - ${childGap})) * 999);`
|
|
21
23
|
: ``};
|
|
22
24
|
${({ childGap }) => `margin: calc(${childGap} / 2);`}
|
|
25
|
+
${({ constrainMobile }) =>
|
|
26
|
+
constrainMobile && `margin-left: 0; margin-right: 0;`}
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
${({ largeChild, largeChildSize }) =>
|