UNPKG

baseui

Version:

A React Component library implementing the Base design language

106 lines (103 loc) 2.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TabContent = exports.TabBar = exports.Tab = exports.Root = void 0; var _styles = require("../styles"); var _constants = require("./constants"); /* Copyright (c) Uber Technologies, Inc. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. */ const Root = exports.Root = (0, _styles.styled)('div', props => { const { $orientation } = props; return { display: 'flex', flexDirection: $orientation === _constants.ORIENTATION.vertical ? 'row' : 'column' }; }); Root.displayName = "Root"; Root.displayName = 'Root'; const Tab = exports.Tab = (0, _styles.styled)('div', props => { const { $disabled, $active, $orientation, $isFocusVisible, $theme: { colors, sizing, typography } } = props; let style = { ...typography.font200, boxSizing: 'border-box', color: $active ? colors.contentPrimary : colors.tabColor, cursor: $disabled ? 'not-allowed' : 'pointer', paddingTop: sizing.scale600, paddingBottom: sizing.scale600, paddingLeft: sizing.scale300, paddingRight: sizing.scale300, marginLeft: sizing.scale200, marginRight: sizing.scale200, outline: $isFocusVisible ? `3px solid ${colors.borderAccent}` : 'none', outlineOffset: '-3px', borderBottom: $orientation === _constants.ORIENTATION.horizontal && $active && !$isFocusVisible ? `2px solid ${colors.borderSelected}` : '2px solid transparent', display: 'inline-block' }; if (!$disabled && !$active) { style = { ...style, ':focus': { color: colors.contentPrimary }, ':hover': { color: colors.contentPrimary } }; } return style; }); Tab.displayName = "Tab"; Tab.displayName = 'Tab'; const TabBar = exports.TabBar = (0, _styles.styled)('div', props => { const { $orientation, $theme: { colors, sizing } } = props; return { display: 'flex', flexDirection: $orientation === _constants.ORIENTATION.vertical ? 'column' : 'row', paddingLeft: sizing.scale400, paddingRight: sizing.scale400, backgroundColor: colors.tabBarFill }; }); TabBar.displayName = "TabBar"; TabBar.displayName = 'TabBar'; const TabContent = exports.TabContent = (0, _styles.styled)('div', props => { const { $active, $theme: { sizing, typography } } = props; return { ...typography.font300, display: $active ? 'block' : 'none', paddingLeft: sizing.scale800, paddingRight: sizing.scale800, paddingTop: sizing.scale500, paddingBottom: sizing.scale500 }; }); TabContent.displayName = "TabContent"; TabContent.displayName = 'TabContent';