"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const reactHookForm = require("react-hook-form");
;/* empty css                                                                                                                                                                                        */
;/* empty css                                                                                                                                                                                         */
;/* empty css                                                                                                                                                                                                 */
;/* empty css                                                                                                                                                                                            */
;/* empty css                                                                                                                                                                                            */
const SegmentedControl = require("../../node_modules/.pnpm/@mantine_core@7.17.8_patch_hash_3qirwkgu3wxhvd6hnr2gb24yzq_@mantine_hooks@7.17.8_react@18.3.1_e5yvlgwhmeykc75dkphi7jou6q/node_modules/@mantine/core/esm/components/SegmentedControl/SegmentedControl.cjs");
const FormSegmentedControl = ({
  name,
  rules,
  onChange: formOnChange,
  ...restProps
}) => {
  const { control } = reactHookForm.useFormContext();
  return /* @__PURE__ */ jsxRuntime.jsx(
    reactHookForm.Controller,
    {
      name,
      control,
      rules,
      render: ({ field: { onChange, value } }) => {
        return /* @__PURE__ */ jsxRuntime.jsx(
          SegmentedControl.SegmentedControl,
          {
            value,
            onChange: (val) => {
              onChange(val);
              formOnChange == null ? void 0 : formOnChange(val);
            },
            ...restProps
          }
        );
      }
    }
  );
};
exports.FormSegmentedControl = FormSegmentedControl;
