"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Box = exports.Flex = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const clsx_1 = tslib_1.__importDefault(require("clsx"));
const twMerge_1 = require("../twMerge");
const ALIGN_ITEMS_MAP = {
    center: 'twa:items-center',
    'flex-start': 'twa:items-start',
    start: 'twa:items-start',
    'flex-end': 'twa:items-end',
    end: 'twa:items-end',
    stretch: 'twa:items-stretch',
    baseline: 'twa:items-baseline',
};
const FLEX_DIRECTION_MAP = {
    row: 'twa:flex-row',
    column: 'twa:flex-col',
};
const JUSTIFY_CONTENT_MAP = {
    'space-between': 'twa:justify-between',
    'space-around': 'twa:justify-around',
    'space-evenly': 'twa:justify-evenly',
    'space-start': 'twa:justify-start',
    'space-end': 'twa:justify-end',
    center: 'twa:justify-center',
};
const FLEX_WRAP_MAP = {
    wrap: 'twa:flex-wrap',
    nowrap: 'twa:flex-nowrap',
    'wrap-reverse': 'twa:flex-wrap-reverse',
};
exports.Flex = React.forwardRef((props, ref) => {
    const { className: _, flexDirection, alignItems, justifyContent, flexWrap, as, ...domProps } = props;
    const className = (0, clsx_1.default)('twa:flex', 'twa:box-border', FLEX_DIRECTION_MAP[flexDirection], ALIGN_ITEMS_MAP[alignItems], JUSTIFY_CONTENT_MAP[justifyContent], FLEX_WRAP_MAP[flexWrap]);
    const Cmp = (as || 'div');
    return (React.createElement(Cmp, { ref: ref, ...domProps, className: (0, twMerge_1.twMerge)(className, props.className) }));
});
exports.Box = React.forwardRef((props, ref) => {
    const { className, as, ...domProps } = props;
    const Cmp = (as || 'div');
    return (React.createElement(Cmp, { ref: ref, ...domProps, className: (0, twMerge_1.twMerge)('twa:box-border', className) }));
});
