baseui
Version:
A React Component library implementing the Base design language
151 lines (147 loc) • 4.57 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Root = exports.List = exports.Label = exports.Item = exports.DragHandle = exports.CloseHandle = void 0;
var _styles = require("../styles");
/*
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.
*/
/**
* Main component container element
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const Root = exports.Root = (0, _styles.styled)('div', ({
$theme
}) => {
return {
width: '100%'
};
});
Root.displayName = "Root";
Root.displayName = 'Root';
Root.displayName = 'StyledRoot';
// @ts-ignore
const List = exports.List = (0, _styles.styled)('ul', ({
$isDragged
}) => {
return {
paddingLeft: 0,
cursor: $isDragged ? 'grabbing' : null,
pointerEvents: $isDragged ? 'none' : 'auto'
};
});
List.displayName = "List";
List.displayName = 'List';
List.displayName = 'StyledList';
const Item = exports.Item = (0, _styles.styled)('li',
// @ts-ignore
({
$isDragged,
$isSelected,
$theme,
$isFocusVisible
}) => {
return {
':hover': !$isDragged && !$isSelected ? {
borderTopWidth: '2px',
borderBottomWidth: '2px',
borderLeftWidth: '2px',
borderRightWidth: '2px',
borderTopStyle: 'solid',
borderBottomStyle: 'solid',
borderLeftStyle: 'solid',
borderRightStyle: 'solid',
borderTopColor: $theme.colors.borderSelected,
borderBottomColor: $theme.colors.borderSelected,
borderLeftColor: $theme.colors.borderSelected,
borderRightColor: $theme.colors.borderSelected
} : {},
':focus': {
outline: $isFocusVisible && !$isDragged && !$isSelected ? `3px solid ${$theme.colors.borderAccent}` : 'none',
outlineOffset: '-3px'
},
paddingTop: $theme.sizing.scale600,
paddingBottom: $theme.sizing.scale600,
paddingLeft: $theme.sizing.scale600,
paddingRight: $theme.sizing.scale600,
color: $theme.colors.contentPrimary,
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
listStyle: 'none',
cursor: $isDragged ? 'grabbing' : 'grab',
backgroundColor: $theme.colors.backgroundPrimary,
boxShadow: $isDragged ? '0 2px 6px rgba(0, 0, 0, 0.32)' : null,
borderTopWidth: '2px',
borderBottomWidth: '2px',
borderLeftWidth: '2px',
borderRightWidth: '2px',
borderTopStyle: 'solid',
borderBottomStyle: 'solid',
borderLeftStyle: 'solid',
borderRightStyle: 'solid',
borderTopColor: $isDragged || $isSelected ? $theme.colors.borderSelected : 'transparent',
borderBottomColor: $isDragged || $isSelected ? $theme.colors.borderSelected : 'transparent',
borderLeftColor: $isDragged || $isSelected ? $theme.colors.borderSelected : 'transparent',
borderRightColor: $isDragged || $isSelected ? $theme.colors.borderSelected : 'transparent'
};
});
Item.displayName = "Item";
Item.displayName = 'Item';
List.displayName = 'StyledItem';
const DragHandle = exports.DragHandle = (0, _styles.styled)('div', ({
$theme
}) => {
const marginDir = $theme.direction === 'rtl' ? 'marginLeft' : 'marginRight';
return {
[marginDir]: $theme.sizing.scale600,
width: $theme.sizing.scale800,
color: '#CCC',
display: 'flex',
alignItems: 'center'
};
});
DragHandle.displayName = "DragHandle";
DragHandle.displayName = 'DragHandle';
DragHandle.displayName = 'StyledDragHandle';
const CloseHandle = exports.CloseHandle = (0, _styles.styled)('button', ({
$theme,
$isFocusVisible
}) => {
const marginDir = $theme.direction === 'rtl' ? 'marginRight' : 'marginLeft';
return {
borderLeftStyle: 'none',
borderTopStyle: 'none',
borderRightStyle: 'none',
borderBottomStyle: 'none',
paddingTop: 0,
paddingBottom: 0,
paddingLeft: 0,
paddingRight: 0,
overflow: 'visible',
cursor: 'pointer',
backgroundColor: 'transparent',
[marginDir]: $theme.sizing.scale600,
width: $theme.sizing.scale800,
display: 'flex',
alignItems: 'center',
':focus': {
outline: $isFocusVisible ? `3px solid ${$theme.colors.borderAccent}` : 'none'
}
};
});
CloseHandle.displayName = "CloseHandle";
CloseHandle.displayName = 'CloseHandle';
CloseHandle.displayName = 'StyledCloseHandle';
const Label = exports.Label = (0, _styles.styled)('div', ({
$theme
}) => ({
flexGrow: 1,
...$theme.typography.font300
}));
Label.displayName = "Label";
Label.displayName = 'Label';
Label.displayName = 'StyledLabel';