"use strict";
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);
var register_exports = {};
__export(register_exports, {
  registerComponent: () => registerComponent
});
module.exports = __toCommonJS(register_exports);
var import_controls = require("@makeswift/controls");
var import_constants = require("../constants");
var import_FormContext = require("./context/FormContext");
var import_components_meta = require("../../../state/modules/components-meta");
var import_react = require("react");
var import_prop_controllers = require("@makeswift/prop-controllers");
function registerComponent(runtime) {
  return runtime.registerComponent(
    (0, import_react.lazy)(() => Promise.resolve().then(() => __toESM(require("./Form")))),
    {
      type: import_constants.MakeswiftComponentType.Form,
      label: "Form",
      icon: import_components_meta.ComponentIcon.Form,
      props: {
        id: (0, import_prop_controllers.ElementID)(),
        tableId: (0, import_prop_controllers.Table)(),
        fields: (0, import_prop_controllers.TableFormFields)(),
        submitLink: (0, import_prop_controllers.Link)((props) => ({
          label: "Redirect to",
          // TODO: This option is hardcoded. We should import it from LinkPanelOptions
          options: [
            { value: "OPEN_PAGE", label: "Open page" },
            { value: "OPEN_URL", label: "Open URL" }
          ],
          hidden: props.tableId == null
        })),
        gap: (0, import_prop_controllers.GapY)((props) => ({
          preset: [
            {
              deviceId: (0, import_controls.getBaseBreakpoint)(runtime.getBreakpoints()).id,
              value: { value: 10, unit: "px" }
            }
          ],
          label: "Gap",
          defaultValue: { value: 0, unit: "px" },
          hidden: props.tableId == null
        })),
        shape: (0, import_prop_controllers.ResponsiveIconRadioGroup)((props) => ({
          label: "Shape",
          options: [
            { label: "Pill", value: import_FormContext.Shapes.PILL, icon: "ButtonPill16" },
            { label: "Rounded", value: import_FormContext.Shapes.ROUNDED, icon: "ButtonRounded16" },
            { label: "Square", value: import_FormContext.Shapes.SQUARE, icon: "ButtonSquare16" }
          ],
          defaultValue: import_FormContext.Shapes.ROUNDED,
          hidden: props.tableId == null
        })),
        size: (0, import_prop_controllers.ResponsiveIconRadioGroup)((props) => ({
          label: "Size",
          options: [
            { label: "Small", value: import_FormContext.Sizes.SMALL, icon: "SizeSmall16" },
            { label: "Medium", value: import_FormContext.Sizes.MEDIUM, icon: "SizeMedium16" },
            { label: "Large", value: import_FormContext.Sizes.LARGE, icon: "SizeLarge16" }
          ],
          defaultValue: import_FormContext.Sizes.MEDIUM,
          hidden: props?.tableId == null
        })),
        contrast: (0, import_prop_controllers.ResponsiveIconRadioGroup)((props) => ({
          label: "Color",
          options: [
            { label: "Light mode", value: import_FormContext.Contrasts.LIGHT, icon: "Sun16" },
            { label: "Dark mode", value: import_FormContext.Contrasts.DARK, icon: "Moon16" }
          ],
          defaultValue: import_FormContext.Contrasts.LIGHT,
          hidden: props.tableId == null
        })),
        labelTextStyle: (0, import_prop_controllers.TextStyle)({ label: "Label text style" }),
        labelTextColor: (0, import_prop_controllers.ResponsiveColor)((props, device) => {
          const hidden = props.tableId == null;
          const responsiveContrast = import_prop_controllers.ResponsiveSelect.fromPropData(
            props.contrast
          );
          const contrast = (0, import_controls.findBreakpointOverride)(
            runtime.getBreakpoints(),
            responsiveContrast,
            device
          );
          return {
            hidden,
            label: "Label text color",
            placeholder: contrast?.value === import_FormContext.Contrasts.DARK ? "rgba(255,255,255,0.95)" : "rgba(0,0,0,0.8)"
          };
        }),
        submitTextStyle: (0, import_prop_controllers.TextStyle)({ label: "Button text style" }),
        brandColor: (0, import_prop_controllers.ResponsiveColor)((props) => ({
          label: "Button color",
          placeholder: "black",
          hidden: props.tableId == null
          // TODO: Add hideAlphaSlider
        })),
        submitTextColor: (0, import_prop_controllers.ResponsiveColor)((props) => ({
          label: "Button text color",
          placeholder: "white",
          hidden: props.tableId == null
        })),
        submitLabel: (0, import_prop_controllers.TextInput)((props) => ({
          label: "Button label",
          placeholder: "Submit",
          hidden: props.tableId == null
        })),
        submitVariant: (0, import_prop_controllers.ResponsiveSelect)((props) => ({
          label: "Button style",
          options: [
            { value: "flat", label: "Flat" },
            { value: "outline", label: "Outline" },
            { value: "shadow", label: "Floating" },
            { value: "clear", label: "Clear" },
            { value: "blocky", label: "Blocky" },
            { value: "bubbly", label: "Bubbly" },
            { value: "skewed", label: "Skewed" }
          ],
          defaultValue: "flat",
          hidden: props.tableId == null
        })),
        submitWidth: (0, import_prop_controllers.ResponsiveLength)((props) => ({
          label: "Button width",
          hidden: props.tableId == null
          // TODO: Add placeholder: { value: 'auto' }
        })),
        submitAlignment: (0, import_prop_controllers.ResponsiveIconRadioGroup)((props) => ({
          label: "Button alignment",
          options: [
            { label: "Left", value: import_FormContext.Alignments.LEFT, icon: "AlignLeft16" },
            { label: "Center", value: import_FormContext.Alignments.CENTER, icon: "AlignCenter16" },
            { label: "Right", value: import_FormContext.Alignments.RIGHT, icon: "AlignRight16" }
          ],
          defaultValue: import_FormContext.Alignments.CENTER,
          hidden: props.tableId == null
        })),
        width: (0, import_prop_controllers.Width)({
          preset: [
            {
              deviceId: (0, import_controls.getBaseBreakpoint)(runtime.getBreakpoints()).id,
              value: { value: 550, unit: "px" }
            }
          ],
          defaultValue: { value: 100, unit: "%" },
          format: import_prop_controllers.Width.Format.ClassName
        }),
        margin: (0, import_prop_controllers.Margin)({ format: import_prop_controllers.Margin.Format.ClassName })
      }
    }
  );
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  registerComponent
});
//# sourceMappingURL=register.js.map