UNPKG

@serendie/ui

Version:

Adaptive UI component library as part of Serendie Design System by Mitsubishi Electric

26 lines (23 loc) 691 B
import { getPatternStyles, patternFns } from '../helpers.js'; import { css } from '../css/index.js'; const flexConfig = { transform(props) { const { direction, align, justify, wrap: wrap2, basis, grow, shrink, ...rest } = props; return { display: "flex", flexDirection: direction, alignItems: align, justifyContent: justify, flexWrap: wrap2, flexBasis: basis, flexGrow: grow, flexShrink: shrink, ...rest }; }} export const getFlexStyle = (styles = {}) => { const _styles = getPatternStyles(flexConfig, styles) return flexConfig.transform(_styles, patternFns) } export const flex = (styles) => css(getFlexStyle(styles)) flex.raw = getFlexStyle