From cb535460350bd510dd4b2b7d6bc3c6ec5f5bcdf1 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Wed, 10 May 2023 00:53:37 -0300
Subject: almost first document

---
 .../exchange-backoffice-ui/src/forms/InputInteger.tsx | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 packages/exchange-backoffice-ui/src/forms/InputInteger.tsx

(limited to 'packages/exchange-backoffice-ui/src/forms/InputInteger.tsx')

diff --git a/packages/exchange-backoffice-ui/src/forms/InputInteger.tsx b/packages/exchange-backoffice-ui/src/forms/InputInteger.tsx
new file mode 100644
index 000000000..49e6973fc
--- /dev/null
+++ b/packages/exchange-backoffice-ui/src/forms/InputInteger.tsx
@@ -0,0 +1,19 @@
+import { VNode, h } from "preact";
+import { InputLine, UIFormProps } from "./InputLine.js";
+
+export function InputInteger(props: UIFormProps<number>): VNode {
+  return (
+    <InputLine
+      type="number"
+      converter={{
+        fromStringUI: (v) => {
+          return !v ? 0 : Number.parseInt(v, 10);
+        },
+        toStringUI: (v?: number) => {
+          return v === undefined ? "" : String(v);
+        },
+      }}
+      {...props}
+    />
+  );
+}
-- 
cgit v1.2.3

