"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const React = require("react");
require("clsx");
const styles = require("../../utils/styles.cjs");
const index = require("../Typography/index.cjs");
const NumberInput$1 = 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/NumberInput/NumberInput.cjs");
const NumberInput = React.forwardRef((props, ref) => {
  const { leftAddon, rightAddon, leftAddonProps, rightAddonProps, leftSection, rightSection, ...rest } = props;
  return /* @__PURE__ */ jsxRuntime.jsx(
    NumberInput$1.NumberInput,
    {
      ...rest,
      ref,
      styles: styles.mergeStylesList([
        (theme) => {
          const withLeftAddon = !!leftAddon;
          const withRightAddon = !!rightAddon;
          if (!withLeftAddon && !withRightAddon) {
            return {};
          }
          const sectionBaseStyles = {
            position: "initial",
            width: "fit-content",
            border: `1px solid ${theme.colors.carbon[4]}`,
            backgroundColor: theme.colors.carbon[2],
            paddingLeft: 12,
            paddingRight: 12
          };
          const wrapperBaseStyles = {
            "--input-padding-inline-start": "var(--input-padding)"
          };
          return {
            wrapper: {
              display: "flex",
              "&[data-with-left-section]": withLeftAddon ? wrapperBaseStyles : void 0,
              "&[data-with-right-section]": withRightAddon ? wrapperBaseStyles : void 0
            },
            section: {
              '&[data-position="left"]': withLeftAddon ? {
                ...sectionBaseStyles,
                borderRightWidth: 0,
                borderTopLeftRadius: theme.defaultRadius,
                borderBottomLeftRadius: theme.defaultRadius
              } : void 0,
              '&[data-position="right"]': withRightAddon ? {
                ...sectionBaseStyles,
                borderLeftWidth: 0,
                borderTopRightRadius: theme.defaultRadius,
                borderBottomRightRadius: theme.defaultRadius
              } : void 0
            },
            input: {
              flex: 1,
              ...withLeftAddon ? {
                borderTopLeftRadius: 0,
                borderBottomLeftRadius: 0
              } : void 0,
              ...withRightAddon ? {
                borderTopRightRadius: 0,
                borderBottomRightRadius: 0
              } : void 0
            }
          };
        }
      ]),
      leftSection: !!leftAddon ? /* @__PURE__ */ jsxRuntime.jsx(index.Typography, { variant: "label-lg", ...leftAddonProps, children: leftAddon }) : leftSection,
      rightSection: !!rightAddon ? /* @__PURE__ */ jsxRuntime.jsx(index.Typography, { variant: "label-lg", ...rightAddonProps, children: rightAddon }) : rightSection
    }
  );
});
exports.NumberInput = NumberInput;
