import { createVNode, mergeProps } from "vue";
import { FormControl } from "../form-control/form-control.mjs";
import { Input } from "../input/input.mjs";
import { RadioGroup } from "../radio-group/radio-group.mjs";
import { CheckboxGroup } from "../checkbox-group/checkbox-group.mjs";
import { DatePicker } from "../date-picker/date-picker.mjs";
import { Switch } from "../switch/switch.mjs";
import { Select } from "../select/select.mjs";
import { defineComponent } from "../../utils/define-component.mjs";
import { pick } from "../../utils/dist/index.mjs";
const FormChildren = defineComponent({
  name: "VeFormChildren",
  props: {
    items: Array
  },
  setup(props, {
    slots
  }) {
    return () => {
      var _a, _b, _c;
      return (_c = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _c : (_b = props.items) == null ? void 0 : _b.map(({
        type,
        props: itemProps
      }) => {
        switch (type) {
          case "textarea":
            return createVNode(Input, mergeProps({
              "type": "textarea"
            }, itemProps), null);
          case "select":
            return createVNode(Select, itemProps, null);
          case "switch":
            const [controlProps, switchProps] = pick(itemProps || {}, ["label"]);
            return createVNode(FormControl, controlProps, {
              default: () => [createVNode(Switch, switchProps, null)]
            });
          case "date-picker":
            return createVNode(DatePicker, itemProps, null);
          case "checkbox":
            return createVNode(CheckboxGroup, itemProps, null);
          case "radio":
            return createVNode(RadioGroup, itemProps, null);
          case "input":
          default:
            return createVNode(Input, itemProps, null);
        }
      });
    };
  }
});
export {
  FormChildren
};
//# sourceMappingURL=form-children.mjs.map
