quicksnack 3.10.1 → 3.11.0
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/Box/Box.d.ts +1 -0
- package/dist/components/Box/Box.js +3 -2
- package/dist/components/Floater/Floater.d.ts +1 -0
- package/dist/components/Floater/Floater.js +3 -3
- package/dist/components/Floater/FloaterItem.d.ts +1 -0
- package/dist/components/Floater/FloaterItem.js +3 -2
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ export interface BoxProps {
|
|
|
10
10
|
mr?: Responsive<number>;
|
|
11
11
|
mb?: Responsive<number>;
|
|
12
12
|
ml?: Responsive<number>;
|
|
13
|
+
width?: Responsive<number | string>;
|
|
13
14
|
display?: Responsive<"inline" | "block" | "contents" | "flex" | "grid" | "inline-block" | "inline-flex" | "inline-grid" | "inline-table" | "list-item" | "run-in" | "table" | "table-caption" | "table-column-group" | "table-header-group" | "table-footer-group" | "table-row-group" | "table-cell" | "table-column" | "table-row" | "none" | "initial" | "inherit">;
|
|
14
15
|
flexGrow?: Responsive<"inherit" | "initial" | "unset" | number>;
|
|
15
16
|
flexShrink?: Responsive<"inherit" | "initial" | "unset" | number>;
|
|
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.Box = void 0;
|
|
27
27
|
var responsiveProps_1 = require("../../responsiveness/responsiveProps");
|
|
28
28
|
var styled_components_1 = __importStar(require("styled-components"));
|
|
29
|
-
exports.Box = styled_components_1.default.div(
|
|
29
|
+
exports.Box = styled_components_1.default.div(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n box-sizing: border-box;\n \n ", "\n"], ["\n box-sizing: border-box;\n \n ", "\n"])), function (props) { return (0, responsiveProps_1.responsiveProps)(props, {
|
|
30
30
|
"p": function (unit) { return (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["padding: ", ";"], ["padding: ", ";"])), props.theme.spacing(unit)); },
|
|
31
31
|
"pt": function (unit) { return (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["padding-top: ", ";"], ["padding-top: ", ";"])), props.theme.spacing(unit)); },
|
|
32
32
|
"pr": function (unit) { return (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["padding-right: ", ";"], ["padding-right: ", ";"])), props.theme.spacing(unit)); },
|
|
@@ -44,5 +44,6 @@ exports.Box = styled_components_1.default.div(templateObject_18 || (templateObje
|
|
|
44
44
|
"alignItems": function (unit) { return (0, styled_components_1.css)(templateObject_15 || (templateObject_15 = __makeTemplateObject(["align-items: ", ";"], ["align-items: ", ";"])), unit); },
|
|
45
45
|
"textAlign": function (unit) { return (0, styled_components_1.css)(templateObject_16 || (templateObject_16 = __makeTemplateObject(["text-align: ", ";"], ["text-align: ", ";"])), unit); },
|
|
46
46
|
"justifyContent": function (unit) { return (0, styled_components_1.css)(templateObject_17 || (templateObject_17 = __makeTemplateObject(["justify-content: ", ";"], ["justify-content: ", ";"])), unit); },
|
|
47
|
+
"width": function (unit) { return (0, styled_components_1.css)(templateObject_18 || (templateObject_18 = __makeTemplateObject(["width: ", ";"], ["width: ", ";"])), typeof unit === 'number' ? props.theme.spacing(unit) : unit); },
|
|
47
48
|
}); });
|
|
48
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18;
|
|
49
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19;
|
|
@@ -36,13 +36,13 @@ var hasElement = function (item) {
|
|
|
36
36
|
return !!item.element;
|
|
37
37
|
};
|
|
38
38
|
var Floater = function (_a) {
|
|
39
|
-
var items = _a.items, _b = _a.
|
|
39
|
+
var items = _a.items, _b = _a.forceEqualWidth, forceEqualWidth = _b === void 0 ? false : _b, _c = _a.stretch, stretch = _c === void 0 ? false : _c, props = __rest(_a, ["items", "forceEqualWidth", "stretch"]);
|
|
40
40
|
return react_1.default.createElement(Box_1.Box, __assign({ mb: verticalMargin, mt: verticalMargin, ml: horizontalMargin, mr: horizontalMargin, display: display }, props), items
|
|
41
41
|
.filter(Boolean)
|
|
42
42
|
.map(function (item, i) {
|
|
43
43
|
return hasElement(item)
|
|
44
|
-
? react_1.default.createElement(FloaterItem_1.FloaterItem, { key: i, stretch: item.stretch }, item.element)
|
|
45
|
-
: react_1.default.createElement(FloaterItem_1.FloaterItem, { key: i, stretch: stretch }, item);
|
|
44
|
+
? (react_1.default.createElement(FloaterItem_1.FloaterItem, { key: i, laptopWidth: item.forceEqualWidth ? "".concat(100 / items.length, "%") : undefined, stretch: item.stretch }, item.element))
|
|
45
|
+
: react_1.default.createElement(FloaterItem_1.FloaterItem, { key: i, laptopWidth: forceEqualWidth ? "".concat(100 / items.length, "%") : undefined, stretch: stretch }, item);
|
|
46
46
|
}));
|
|
47
47
|
};
|
|
48
48
|
exports.Floater = Floater;
|
|
@@ -32,7 +32,8 @@ var horizontalPadding = { laptop: 1 };
|
|
|
32
32
|
var verticalPadding = { mobile: 1, laptop: 0 };
|
|
33
33
|
var flexGrow = { laptop: 1 };
|
|
34
34
|
var FloaterItem = function (_a) {
|
|
35
|
-
var stretch = _a.stretch, props = __rest(_a, ["stretch"]);
|
|
36
|
-
|
|
35
|
+
var stretch = _a.stretch, laptopWidth = _a.laptopWidth, props = __rest(_a, ["stretch", "laptopWidth"]);
|
|
36
|
+
var width = react_1.default.useMemo(function () { return ({ laptop: laptopWidth }); }, [laptopWidth]);
|
|
37
|
+
return react_1.default.createElement(Box_1.Box, __assign({ flexGrow: stretch ? flexGrow : undefined, width: width, pt: verticalPadding, pb: verticalPadding, pl: horizontalPadding, pr: horizontalPadding }, props));
|
|
37
38
|
};
|
|
38
39
|
exports.FloaterItem = FloaterItem;
|