UNPKG

fui-fancyui

Version:
58 lines (57 loc) 1.11 kB
"use client"; import { jsx as w } from "react/jsx-runtime"; import { forwardRef as b, useMemo as C } from "react"; import { useNumberInput as D } from "./useNumberInput.hook.js"; import { StyledNumberInput as I } from "./NumberInput.styled.js"; const v = b((a, l) => { const { value: m, onChange: u, onKeyDown: i, align: p, id: h, autoWidth: t, decimalPlaces: s = 2, step: n, min: o, themeType: y, layer: d, max: r, externalStyle: c, ...f } = a, { inputValue: e, handleChange: g, handleKeyDown: x } = D({ value: m, onChange: u, onKeyDown: i, min: o, max: r, decimalPlaces: s, step: n }), $ = C( () => t ? e ? `${e.length + 1}ch` : "2ch" : "100%", [e, t] ); return /* @__PURE__ */ w( I, { id: h, ref: l, type: "text", value: e !== null ? e : "", step: n, min: o, $themeType: y, $layer: d, max: r, onChange: g, onKeyDown: x, $externalStyle: c, $width: $, $align: p, ...f } ); }); export { v as default };