Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../chunk-BN4qSVkS.cjs");
const require_styles_fields = require("../../styles/fields.cjs");
let _emotion_react = require("@emotion/react");
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
//#region src/components/CodeInput/SingleCodeInput.tsx
const defaultWidth = "42px";
const vPadding = 15;
function SingleCodeInput({ id, maxLength, onChange = () => {}, value, inputRef = null, onKeyUp = () => {}, onKeyDown = () => {}, onPaste = () => {}, type, max, cssProp, ariaLabel, disabled, onBlur, width = defaultWidth, variant = "default" }) {
	const theme = (0, _emotion_react.useTheme)();
	const commonCSS = _emotion_react.css`
    text-align: center;

    &::-webkit-outer-spin-button,
    &::-webkit-inner-spin-button {
      display: none;
      margin: 0;
    }
    -moz-appearance: textfield; /* Firefox */
  `;
	const unifiedCSS = _emotion_react.css`
    ${commonCSS}
    width: ${width};
    padding: 0;
    border: none;
    background: transparent;
    font: inherit;
    color: ${theme.text};
    outline: none;
    caret-color: ${theme.info};

    &::placeholder {
      color: ${theme.secondary};
    }
  `;
	const defaultCSS = (0, _emotion_react.css)(`
      ${require_styles_fields.textInputStyle({
		theme,
		disabled: Boolean(disabled),
		hasError: false,
		borderRadius: 8
	}).styles}
      width: ${width};
      max-width: ${defaultWidth};
      padding: ${vPadding}px 0px;
      &:not(:last-of-type):not(:focus-visible) {
        border-right: none;
      }
      &:not(:first-of-type):not(:last-of-type) {
        border-radius: 0;
      }
      &:first-of-type {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
      }
      &:last-of-type {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
      }
      &:focus,
      &:active {
        padding: ${vPadding - 1}px 0px !important;
      }
    `, commonCSS, cssProp);
	return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("input", {
		id,
		maxLength,
		onChange: (event) => onChange(event, id),
		value,
		ref: inputRef,
		type: variant === "unified" ? "text" : type,
		"aria-label": ariaLabel,
		onKeyUp: (event) => onKeyUp(event, id),
		onKeyDown: (event) => onKeyDown(event, id),
		onPaste: (event) => onPaste(event),
		max,
		css: variant === "unified" ? unifiedCSS : defaultCSS,
		onBlur,
		inputMode: "numeric",
		pattern: "[0-9]*",
		placeholder: variant === "unified" ? "-" : void 0
	});
}
//#endregion
exports.SingleCodeInput = SingleCodeInput;
