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.

48 lines (47 loc) 1.33 kB
"use client"; import React from "react"; import styled, { css } from "styled-components"; import Stack from "../../../Stack"; import { TabProvider } from "../../TabContext"; import { spacingUtility } from "../../../utils/common"; const StyledTabListWrapper = styled.div.withConfig({ displayName: "TabList__StyledTabListWrapper", componentId: "sc-15h3hsn-0" })(["", ";"], ({ $margin, $padding, $fullWidth }) => css(["width:", ";", ";", ";"], $fullWidth ? "100%" : "auto", spacingUtility($padding, "padding"), spacingUtility($margin))); const TabList = ({ children, spacing = "none", compact, padding, margin, dataTest, fullWidth }) => { return /*#__PURE__*/React.createElement(StyledTabListWrapper, { role: "tablist", "aria-label": "tabs", $fullWidth: fullWidth, $padding: padding, $margin: margin, "data-test": dataTest }, /*#__PURE__*/React.createElement(Stack, { flex: fullWidth, spacing: spacing }, React.Children.map(children, (child, idx) => { if (! /*#__PURE__*/React.isValidElement(child)) return null; return ( /*#__PURE__*/ // eslint-disable-next-line react/no-array-index-key React.createElement(TabProvider, { index: idx, key: idx, compact: compact }, child) ); }))); }; export default TabList;