import { jsx } from "react/jsx-runtime";
import react, { useMemo } from "react";
import { useField, useFieldSchema } from "@tachybase/schema";
import { useDesignable } from "../../../schema-component/index.mjs";
import { SchemaSettingsDropdown } from "../../../schema-settings/index.mjs";
import { SchemaSettingsChildren } from "./SchemaSettingsChildren.mjs";
import { SchemaSettingsIcon } from "./SchemaSettingsIcon.mjs";
const SchemaSettingsWrapper = (props)=>{
    const { items, Component = SchemaSettingsIcon, name, componentProps, style, ...others } = props;
    const { dn } = useDesignable();
    const field = useField();
    const fieldSchema = useFieldSchema();
    const cProps = useMemo(()=>({
            options: props,
            style,
            ...componentProps
        }), [
        componentProps,
        props,
        style
    ]);
    return /*#__PURE__*/ jsx(SchemaSettingsDropdown, {
        title: /*#__PURE__*/ react.createElement(Component, cProps),
        dn: dn,
        field: field,
        fieldSchema: fieldSchema,
        ...others,
        children: /*#__PURE__*/ jsx(SchemaSettingsChildren, {
            children: items
        })
    });
};
export { SchemaSettingsWrapper };
