import styled from "@emotion/styled";
import { css } from "@emotion/react";
import { component, mergeConfig } from "../../engines";
import { checkboxConfig, checkboxTokens } from "../Checkbox";
import { dividerConfig, dividerTokens } from "../Divider";
import { buttonConfig, buttonTokens } from "../Button";
import { linkButtonConfig, linkButtonTokens } from "../LinkButton";
import { tableTokens as tokens } from "./Table.tokens";
var mergedCheckboxConfig = mergeConfig(checkboxConfig);
var Checkbox = component(mergedCheckboxConfig);
var mergedButtonConfig = mergeConfig(buttonConfig);
var ButtonBase = component(mergedButtonConfig);
var mergedDividerConfig = mergeConfig(dividerConfig);
var Divider = component(mergedDividerConfig);
var mergedLinkButtonConfig = mergeConfig(linkButtonConfig);
var LinkButtonBase = component(mergedLinkButtonConfig);
export var base = /*#__PURE__*/ css("display:inline-flex;flex-direction:column;align-items:flex-start;", "base");
export var ScrollableWrapper = /*#__PURE__*/ styled("div", {
    target: "e16hvqrc0",
    label: "ScrollableWrapper"
})("overflow-y:auto;max-height:", function(param) {
    var maxHeight = param.maxHeight;
    return maxHeight || 'none';
}, ";");
export var Table = /*#__PURE__*/ styled("table", {
    target: "e16hvqrc1",
    label: "Table"
})("width:fit-content;font-family:var(", tokens.fontFamily, ");font-size:var(", tokens.fontSize, ");font-style:var(", tokens.fontStyle, ");font-weight:var(", tokens.fontWeight, ");letter-spacing:var(", tokens.letterSpacing, ");line-height:var(", tokens.lineHeight, ");border-collapse:collapse;border-width:0;border-style:solid;border-color:", function(param) {
    var borderVariant = param.borderVariant;
    return borderVariant === 'all' ? "var(".concat(tokens.borderColor, ")") : 'transparent';
}, ";");
export var Tr = /*#__PURE__*/ styled("tr", {
    target: "e16hvqrc2",
    label: "Tr"
})("box-sizing:content-box;width:fit-content;background-color:", function(param) {
    var selected = param.selected;
    return selected ? 'var(--surface-transparent-accent)' : 'transparent';
}, ";");
export var Thead = /*#__PURE__*/ styled("thead", {
    target: "e16hvqrc3",
    label: "Thead"
})("position:", function(param) {
    var stickyHeader = param.stickyHeader;
    return stickyHeader ? 'sticky' : 'static';
}, ";top:0;background:", function(param) {
    var stickyHeader = param.stickyHeader;
    return stickyHeader ? 'var(--background-primary)' : 'transparent';
}, ";z-index:10;box-shadow:", function(param) {
    var view = param.view, borderVariant = param.borderVariant;
    return(// eslint-disable-next-line no-nested-ternary
    view === 'clear' ? 'none' : borderVariant === 'header' || borderVariant === 'rows' ? "inset 0 -1px 0 0 var(".concat(tokens.borderColor, ")") : "inset 0 1px 0 0 var(".concat(tokens.borderColor, "), inset 0 -1px 0 0 var(").concat(tokens.borderColor, ")"));
}, ";", Tr, "{background:transparent;}");
export var Tbody = /*#__PURE__*/ styled("tbody", {
    target: "e16hvqrc4",
    label: "Tbody"
})();
export var Resizer = /*#__PURE__*/ styled("div", {
    target: "e16hvqrc5",
    label: "Resizer"
})("display:", function(param) {
    var isResizing = param.isResizing;
    return isResizing ? 'block' : 'none';
}, ";position:absolute;z-index:1;top:-0.0625rem;bottom:0;right:-0.125rem;width:0.1875rem;background:var(--outline-accent);cursor:col-resize;user-select:none;touch-action:none;");
export var Th = /*#__PURE__*/ styled("th", {
    target: "e16hvqrc6",
    label: "Th"
})("padding:", function(param) {
    var selectionCell = param.selectionCell;
    return selectionCell ? "var(".concat(tokens.checkboxCellPadding, ")") : "var(".concat(tokens.cellPadding, ")");
}, ";position:relative;font-weight:600;text-align:left;height:var(", tokens.headerRowHeight, ");background-color:transparent;color:inherit;box-sizing:content-box;border-width:0.0625rem;border-top-width:0;border-bottom-width:0;border-style:solid;border-color:", function(param) {
    var borderVariant = param.borderVariant;
    return borderVariant === 'all' ? "var(".concat(tokens.borderColor, ")") : 'transparent';
}, ";box-sizing:border-box;&:hover{", Resizer, "{display:block;}}");
export var StyledCheckbox = /*#__PURE__*/ styled(Checkbox, {
    target: "e16hvqrc7",
    label: "StyledCheckbox"
})(checkboxTokens.triggerSize, ":var(", tokens.checkboxTriggerSize, ");", checkboxTokens.triggerBorderRadius, ":var(", tokens.checkboxTriggerBorderRadius, ");", checkboxTokens.fillColor, ":var(", tokens.checkboxFillColor, ");", checkboxTokens.iconColor, ":var(", tokens.checkboxTriggerIconColor, ");", checkboxTokens.triggerBorderCheckedColor, ":var(", tokens.checkboxTriggerBorderCheckedColor, ");", checkboxTokens.triggerBorderWidth, ":var(", tokens.checkboxTriggerBorderWidth, ");", checkboxTokens.triggerBorderColor, ":var(", tokens.checkboxTriggerBorderColor, ");");
export var StyledDivider = /*#__PURE__*/ styled(Divider, {
    target: "e16hvqrc8",
    label: "StyledDivider"
})(dividerTokens.baseSideSize, ":0.0625rem;", dividerTokens.background, ":var(--surface-transparent-tertiary);", dividerTokens.borderRadius, ":0.0625rem;");
export var Button = /*#__PURE__*/ styled(ButtonBase, {
    target: "e16hvqrc9",
    label: "Button"
})(buttonTokens.buttonHeight, ":var(", tokens.buttonHeight, ");", buttonTokens.buttonDisabledOpacity, ":0.4;", buttonTokens.buttonFontFamily, ":var(", tokens.buttonFontFamily, ");", buttonTokens.buttonFontSize, ":var(", tokens.buttonFontSize, ");", buttonTokens.buttonFontStyle, ":var(", tokens.buttonFontStyle, ");", buttonTokens.buttonFontWeight, ":var(", tokens.buttonFontWeight, ");", buttonTokens.buttonLetterSpacing, ":var(", tokens.buttonLetterSpacing, ");", buttonTokens.buttonLineHeight, ":var(", tokens.buttonLineHeight, ");");
export var ButtonAccent = /*#__PURE__*/ styled(Button, {
    target: "e16hvqrc10",
    label: "ButtonAccent"
})(buttonTokens.buttonColor, ":var(--on-dark-text-primary);", buttonTokens.buttonValueColor, ":var(--on-dark-text-secondary);", buttonTokens.buttonBackgroundColor, ":var(--surface-accent);", buttonTokens.buttonBackgroundColorHover, ":var(--surface-accent-hover);", buttonTokens.buttonBackgroundColorActive, ":var(--surface-accent-active);");
export var LinkButton = /*#__PURE__*/ styled(LinkButtonBase, {
    target: "e16hvqrc11",
    label: "LinkButton"
})(linkButtonTokens.linkButtonColor, ":var(--text-primary);", linkButtonTokens.linkButtonBackgroundColor, ":var(--surface-transparent-clear);", linkButtonTokens.linkButtonColorHover, ":var(--text-primary-hover);", linkButtonTokens.linkButtonColorActive, ":var(--text-primary-active);", linkButtonTokens.linkButtonFocusColor, ":var(--surface-accent);", linkButtonTokens.linkButtonFontFamily, ":var(", tokens.linkButtonFontFamily, ");", linkButtonTokens.linkButtonFontSize, ":var(", tokens.linkButtonFontSize, ");", linkButtonTokens.linkButtonFontStyle, ":var(", tokens.linkButtonFontStyle, ");", linkButtonTokens.linkButtonFontWeight, ":var(", tokens.linkButtonFontWeight, ");", linkButtonTokens.linkButtonLetterSpacing, ":var(", tokens.linkButtonLetterSpacing, ");", linkButtonTokens.linkButtonLineHeight, ":var(", tokens.linkButtonLineHeight, ");");
