From f4f798b1b4bae3073b669a562fd2b3a7880dffc3 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Mon, 15 May 2023 11:45:23 -0300
Subject: second form

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

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

diff --git a/packages/exchange-backoffice-ui/src/handlers/InputInteger.tsx b/packages/exchange-backoffice-ui/src/handlers/InputInteger.tsx
new file mode 100644
index 000000000..49e6973fc
--- /dev/null
+++ b/packages/exchange-backoffice-ui/src/handlers/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

