UNPKG

@kiwicom/orbit-components

Version:

Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.

54 lines (53 loc) 1.83 kB
"use strict"; "use client"; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default; exports.__esModule = true; exports.default = void 0; var _react = _interopRequireDefault(require("react")); var _styledComponents = _interopRequireWildcard(require("styled-components")); var _Stack = _interopRequireDefault(require("../../../Stack")); var _TabContext = require("../../TabContext"); var _common = require("../../../utils/common"); const StyledTabListWrapper = _styledComponents.default.div.withConfig({ displayName: "TabList__StyledTabListWrapper", componentId: "sc-15h3hsn-0" })(["", ";"], ({ $margin, $padding, $fullWidth }) => (0, _styledComponents.css)(["width:", ";", ";", ";"], $fullWidth ? "100%" : "auto", (0, _common.spacingUtility)($padding, "padding"), (0, _common.spacingUtility)($margin))); const TabList = ({ children, spacing = "none", compact, padding, margin, dataTest, fullWidth }) => { return /*#__PURE__*/_react.default.createElement(StyledTabListWrapper, { role: "tablist", "aria-label": "tabs", $fullWidth: fullWidth, $padding: padding, $margin: margin, "data-test": dataTest }, /*#__PURE__*/_react.default.createElement(_Stack.default, { flex: fullWidth, spacing: spacing }, _react.default.Children.map(children, (child, idx) => { if (! /*#__PURE__*/_react.default.isValidElement(child)) return null; return ( /*#__PURE__*/ // eslint-disable-next-line react/no-array-index-key _react.default.createElement(_TabContext.TabProvider, { index: idx, key: idx, compact: compact }, child) ); }))); }; var _default = TabList; exports.default = _default;