"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);

// packages/components/src/angle-picker-control/index.tsx
var angle_picker_control_exports = {};
__export(angle_picker_control_exports, {
  AnglePickerControl: () => AnglePickerControl,
  default: () => angle_picker_control_default
});
module.exports = __toCommonJS(angle_picker_control_exports);
var import_clsx = __toESM(require("clsx"), 1);
var import_element = require("@wordpress/element");
var import_i18n = require("@wordpress/i18n");
var import_flex = require("../flex/index.cjs");
var import_spacer = require("../spacer/index.cjs");
var import_number_control = __toESM(require("../number-control/index.cjs"), 1);
var import_input_prefix_wrapper = __toESM(require("../input-control/input-prefix-wrapper.cjs"), 1);
var import_input_suffix_wrapper = __toESM(require("../input-control/input-suffix-wrapper.cjs"), 1);
var import_angle_circle = __toESM(require("./angle-circle.cjs"), 1);
var import_jsx_runtime = require("react/jsx-runtime");
function UnforwardedAnglePickerControl(props, ref) {
  const {
    className,
    label = (0, import_i18n.__)("Angle"),
    onChange,
    value,
    ...restProps
  } = props;
  const handleOnNumberChange = (unprocessedValue) => {
    if (onChange === void 0) {
      return;
    }
    const inputValue = unprocessedValue !== void 0 && unprocessedValue !== "" ? parseInt(unprocessedValue, 10) : 0;
    onChange(inputValue);
  };
  const classes = (0, import_clsx.default)("components-angle-picker-control", className);
  const prefixOrSuffixProp = (0, import_i18n.isRTL)() ? {
    prefix: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_prefix_wrapper.default, {
      children: "\xB0"
    })
  } : {
    suffix: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_suffix_wrapper.default, {
      children: "\xB0"
    })
  };
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_flex.Flex, {
    ...restProps,
    ref,
    className: classes,
    gap: 2,
    children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_flex.FlexBlock, {
      children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_number_control.default, {
        __next40pxDefaultSize: true,
        label,
        className: "components-angle-picker-control__input-field",
        max: 360,
        min: 0,
        onChange: handleOnNumberChange,
        step: "1",
        value,
        spinControls: "none",
        ...prefixOrSuffixProp
      })
    }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_spacer.Spacer, {
      marginBottom: "1",
      marginTop: "auto",
      children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_angle_circle.default, {
        "aria-hidden": "true",
        value,
        onChange
      })
    })]
  });
}
var AnglePickerControl = (0, import_element.forwardRef)(UnforwardedAnglePickerControl);
var angle_picker_control_default = AnglePickerControl;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  AnglePickerControl
});
//# sourceMappingURL=index.cjs.map
