var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/dataSourceComponents/dataSourceForm/group/index.tsx
var group_exports = {};
__export(group_exports, {
  default: () => group_default
});
module.exports = __toCommonJS(group_exports);
var import_react = __toESM(require("react"));
var import_classnames = __toESM(require("classnames"));
var import_antd = require("antd");
var import_ahooks = require("ahooks");
var import_useFormSetting = __toESM(require("../provider/hooks/useFormSetting"));
var import_usePisellConfig = __toESM(require("../../../pisell-config-provider/hooks/usePisellConfig"));
var import_index = require("./index.less");
var FormGroup = (props) => {
  const {
    title,
    description,
    showTitle: propsShowTitle,
    showDescription: propsShowDescription,
    showBackgroundColor,
    backgroundColor: propsBackgroundColor,
    children
  } = props;
  const ref = (0, import_react.useRef)(null);
  const size = (0, import_ahooks.useSize)(ref);
  const { groupInfoPosition: formSettingGroupInfoPosition } = (0, import_useFormSetting.default)();
  const { platform } = (0, import_usePisellConfig.default)();
  const groupInfoPosition = (0, import_react.useMemo)(() => {
    const isMobile = platform === "h5";
    if (isMobile || ((size == null ? void 0 : size.width) || 0) < 500) {
      return "top";
    }
    return formSettingGroupInfoPosition;
  }, [platform, formSettingGroupInfoPosition, size == null ? void 0 : size.width]);
  const backgroundColor = showBackgroundColor ? propsBackgroundColor : void 0;
  const wrapperStyle = (0, import_react.useMemo)(() => {
    return {
      backgroundColor: groupInfoPosition === "side" ? void 0 : backgroundColor
    };
  }, [groupInfoPosition, backgroundColor]);
  const contentStyle = (0, import_react.useMemo)(() => {
    return {
      backgroundColor: groupInfoPosition === "side" ? backgroundColor : void 0
    };
  }, [groupInfoPosition, backgroundColor]);
  return /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      style: wrapperStyle,
      className: (0, import_classnames.default)("pisell-lowcode-data-source-form-group", {
        "pisell-lowcode-data-source-form-group-top": groupInfoPosition === "top",
        "pisell-lowcode-data-source-form-group-side": groupInfoPosition === "side"
      }),
      ref
    },
    /* @__PURE__ */ import_react.default.createElement(import_antd.Row, { style: { flex: 1 }, gutter: 16 }, /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: groupInfoPosition === "top" ? 24 : 6 }, (propsShowTitle && title || propsShowDescription && description) && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-data-source-form-group-info" }, propsShowTitle && title && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-data-source-form-group-title" }, title), propsShowDescription && description && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-data-source-form-group-description" }, description))), /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: groupInfoPosition === "top" ? 24 : 18 }, /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: "pisell-lowcode-data-source-form-group-content",
        style: contentStyle
      },
      children
    )))
  );
};
var group_default = FormGroup;
