fix: prevent negative numbers in input fields #870
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for
minandmaxHTML attributes toTextInputFieldand appliesmin={0}to all payroll and contractor payment numeric inputs to prevent users from entering negative values.SDK-200
Changes
Core Components
TextInputTypes.ts: Addedminandmaxto the interface, extending fromInputHTMLAttributesTextInput.tsx: Updated to extract and passminandmaxprops to the underlyingInputcomponentPayroll Forms
PayrollEditEmployeePresentation.tsx: Addedmin={0}to:TimeOffField.tsx: Addedmin={0}to time off hour inputsContractor Payment Forms
EditContractorPaymentPresentation.tsx: Addedmin={0}to:Testing & Documentation
TextInput.test.tsxto verifyminandmaxattributes render correctlyNumberInputWithMinMaxdemonstrating the feature with multiple examplesUsage Example
Testing
✅ All existing unit tests pass
✅ Added new test for
min/maxattribute rendering✅ Verified in Storybook that validation prevents negative numbers
✅ No linter errors
Screenshots/Demo
See the new Storybook story:
UI/Form/Fields/Text > NumberInputWithMinMaxBreaking Changes
None. This is a backwards-compatible enhancement. The
minandmaxprops are optional.Screen.Recording.2025-12-16.at.11.00.54.AM.mov