import { jsx } from "react/jsx-runtime";
import "react";
import { useField } from "@tachybase/schema";
import { createStyles } from "antd-style";
import classnames from "classnames";
import { withDynamicSchemaProps } from "../../../application/hoc/withDynamicSchemaProps.mjs";
import { useCollectionParentRecordData } from "../../../data-source/collection-record/CollectionRecordProvider.mjs";
import { RecordProvider } from "../../../record-provider/index.mjs";
import { useDesignable } from "../../hooks/index.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      .tb-action-bar {\n        gap: 20px !important;\n        margin-top: ",
        ";\n      }\n    "
    ]);
    _templateObject = function() {
        return data;
    };
    return data;
}
const useStyles = createStyles((param, props)=>{
    let { css } = param;
    return {
        item: css(_templateObject(), props.designable ? '20px' : '0px')
    };
});
const ListItem = withDynamicSchemaProps((props)=>{
    const field = useField();
    const { designable } = useDesignable();
    const { styles } = useStyles({
        designable
    });
    const parentRecordData = useCollectionParentRecordData();
    return /*#__PURE__*/ jsx("div", {
        className: classnames(props.className, [
            'itemCss',
            styles.item
        ]),
        children: /*#__PURE__*/ jsx(RecordProvider, {
            record: field.value,
            parent: parentRecordData,
            children: props.children
        })
    });
});
export { ListItem };
