From 852ee65ba2d117ef5422961a8d90681cf3e0e2d7 Mon Sep 17 00:00:00 2001 From: Mateus Miguel Date: Tue, 17 Dec 2024 17:10:39 -0300 Subject: [PATCH] fix(aurora): add maxLength support to NumberWidget --- packages/aurora-theme/Widgets/NumberWidget/index.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/aurora-theme/Widgets/NumberWidget/index.jsx b/packages/aurora-theme/Widgets/NumberWidget/index.jsx index aebf45f..2a94ea3 100644 --- a/packages/aurora-theme/Widgets/NumberWidget/index.jsx +++ b/packages/aurora-theme/Widgets/NumberWidget/index.jsx @@ -1,8 +1,11 @@ import React from "react" import TextWidget from "../TextWidget" -const NumberWidget = ({ min = "0", max, ...rest }) => { +const NumberWidget = ({ min = "0", max, maxLength, ...rest }) => { const handleChange = (value) => { + if (maxLength && value.length > maxLength) { + value = value.slice(0, maxLength) + } rest.onChange(value); }