import { jsx, jsxs } from "react/jsx-runtime";
import "react";
import { observer } from "@tachybase/schema";
import { createStyles } from "antd-style";
import { SortableItem, useDesigner } from "../../index.mjs";
import { useFlag } from "../../../flag-provider/hooks/useFlag.mjs";
function _tagged_template_literal(strings, raw) {
    if (!raw) raw = strings.slice(0);
    return Object.freeze(Object.defineProperties(strings, {
        raw: {
            value: Object.freeze(raw)
        }
    }));
}
function _templateObject() {
    const data = _tagged_template_literal([
        "\n      position: relative;\n      margin: ",
        ";\n      padding: ",
        ";\n\n      &:hover {\n        > .general-schema-designer {\n          display: block;\n        }\n      }\n      > .general-schema-designer {\n        position: absolute;\n        z-index: 999;\n        top: 0;\n        bottom: 0;\n        left: 0;\n        right: 0;\n        display: none;\n        background: var(--colorBgSettingsHover) !important;\n        border: 0 !important;\n        pointer-events: none;\n        > .general-schema-designer-icons {\n          position: absolute;\n          right: 2px;\n          top: 2px;\n          line-height: 16px;\n          pointer-events: all;\n          .ant-space-item {\n            background-color: var(--colorSettings);\n            color: #fff;\n            line-height: 16px;\n            width: 16px;\n            padding-left: 1px;\n            align-self: stretch;\n          }\n        }\n      }\n    "
    ]);
    _templateObject = function() {
        return data;
    };
    return data;
}
const useStyles = createStyles((param, param1)=>{
    let { css } = param, { margin = '-18px -16px', padding = '18px 16px' } = param1;
    return {
        designer: css(_templateObject(), margin, padding)
    };
});
const TableColumnActionBar = observer((props)=>{
    const Designer = useDesigner();
    const { isInSubTable } = useFlag() || {};
    const { styles } = useStyles({
        margin: isInSubTable ? '-12px -8px' : '-18px -16px',
        padding: isInSubTable ? '12px 8px' : '18px 16px'
    });
    return /*#__PURE__*/ jsxs(SortableItem, {
        className: styles.designer,
        children: [
            /*#__PURE__*/ jsx(Designer, {}),
            props.children
        ]
    });
}, {
    displayName: 'TableColumnActionBar'
});
export { TableColumnActionBar, useStyles };
