UNPKG

2.68 kBJavaScriptView Raw
1"use strict";
2var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3 if (k2 === undefined) k2 = k;
4 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5}) : (function(o, m, k, k2) {
6 if (k2 === undefined) k2 = k;
7 o[k2] = m[k];
8}));
9var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10 Object.defineProperty(o, "default", { enumerable: true, value: v });
11}) : function(o, v) {
12 o["default"] = v;
13});
14var __importStar = (this && this.__importStar) || function (mod) {
15 if (mod && mod.__esModule) return mod;
16 var result = {};
17 if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18 __setModuleDefault(result, mod);
19 return result;
20};
21var __rest = (this && this.__rest) || function (s, e) {
22 var t = {};
23 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
24 t[p] = s[p];
25 if (s != null && typeof Object.getOwnPropertySymbols === "function")
26 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
27 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
28 t[p[i]] = s[p[i]];
29 }
30 return t;
31};
32Object.defineProperty(exports, "__esModule", { value: true });
33/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
34const react_1 = __importStar(require("react"));
35/**
36 * `<Box>` is an essential Ink component to build your layout. It's like `<div style="display: flex">` in the browser.
37 */
38const Box = react_1.forwardRef((_a, ref) => {
39 var { children } = _a, style = __rest(_a, ["children"]);
40 const transformedStyle = Object.assign(Object.assign({}, style), { marginLeft: style.marginLeft || style.marginX || style.margin || 0, marginRight: style.marginRight || style.marginX || style.margin || 0, marginTop: style.marginTop || style.marginY || style.margin || 0, marginBottom: style.marginBottom || style.marginY || style.margin || 0, paddingLeft: style.paddingLeft || style.paddingX || style.padding || 0, paddingRight: style.paddingRight || style.paddingX || style.padding || 0, paddingTop: style.paddingTop || style.paddingY || style.padding || 0, paddingBottom: style.paddingBottom || style.paddingY || style.padding || 0 });
41 return (react_1.default.createElement("ink-box", { ref: ref, style: transformedStyle }, children));
42});
43Box.displayName = 'Box';
44Box.defaultProps = {
45 flexDirection: 'row',
46 flexGrow: 0,
47 flexShrink: 1
48};
49exports.default = Box;
50//# sourceMappingURL=Box.js.map
\No newline at end of file