quicksnack 3.2.0 → 3.3.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.
|
@@ -2,7 +2,7 @@ import { BoxProps } from "../Box/Box";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
interface Props extends BoxProps {
|
|
4
4
|
stretch?: boolean;
|
|
5
|
-
items: Array<JSX.Element | false>;
|
|
5
|
+
items: Array<JSX.Element | false | {}>;
|
|
6
6
|
}
|
|
7
7
|
export declare const Floater: React.FC<Props>;
|
|
8
8
|
export {};
|
|
@@ -32,10 +32,17 @@ var FloaterItem_1 = require("./FloaterItem");
|
|
|
32
32
|
var horizontalMargin = { laptop: -1 };
|
|
33
33
|
var verticalMargin = { mobile: -1, laptop: 0 };
|
|
34
34
|
var display = { mobile: "block", laptop: "flex" };
|
|
35
|
+
var hasElement = function (item) {
|
|
36
|
+
return !!item.element;
|
|
37
|
+
};
|
|
35
38
|
var Floater = function (_a) {
|
|
36
39
|
var items = _a.items, _b = _a.stretch, stretch = _b === void 0 ? false : _b, props = __rest(_a, ["items", "stretch"]);
|
|
37
40
|
return react_1.default.createElement(Box_1.Box, __assign({ mb: verticalMargin, mt: verticalMargin, ml: horizontalMargin, mr: horizontalMargin, display: display }, props), items
|
|
38
41
|
.filter(Boolean)
|
|
39
|
-
.map(function (item, i) {
|
|
42
|
+
.map(function (item, i) {
|
|
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);
|
|
46
|
+
}));
|
|
40
47
|
};
|
|
41
48
|
exports.Floater = Floater;
|