UNPKG

@adyen/adyen-platform-experience-web

Version:

![Platform Experience header](https://github.com/Adyen/adyen-platform-experience-web/assets/7926613/18094965-9e01-450e-8dc9-ea84e6b22c2b)

21 lines (20 loc) 517 B
import { InteractionKeyCode as t } from "../../types.js"; const u = [ t.BACKSPACE, t.DELETE, t.ARROW_LEFT, t.ARROW_RIGHT, t.ARROW_UP, t.ARROW_DOWN, t.TAB ], R = ({ event: s, inputType: c, onValidInput: o }) => { const i = s.currentTarget, { key: e } = s, n = /^[0-9.,-]$/.test(e), l = /[.,]/.test(i.value), a = e === "." || e === ",", r = u.includes(e); if (c === "number" && !r && (!n || l && a)) { s.preventDefault(); return; } o?.(s); }; export { R as filterDisallowedCharacters };