-
Notifications
You must be signed in to change notification settings - Fork 72
[LG-5504] refactor(date-picker): migrate to use InputBox component
#3286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
shaneeza
merged 149 commits into
shaneeza/time-picker-integration
from
LG-5504/input-box-in-date-picker-3
Nov 21, 2025
Merged
Changes from 125 commits
Commits
Show all changes
149 commits
Select commit
Hold shift + click to select a range
4f0dc24
refactor(date-picker): extract reusable logic from DateInputSegment, wip
shaneeza 2771235
refactor(date-picker): extract reusable logic from DateInputSegment, wip
shaneeza 4ebb946
refactor(date-picker): enhance InputSegment and DateInputSegment with…
shaneeza 9f40cff
refactor(date-picker): update InputSegment types and enhance DateInpu…
shaneeza 85351a3
refactor(date-picker): WIP enhance InputBox and DateInput components …
shaneeza ebdde67
refactor(date-picker): integrate InputBox into DateInputBox for impro…
shaneeza e19c926
refactor(date-picker): clean up DateInputBox and enhance InputBox typ…
shaneeza edce7cc
refactor(date-picker): enhance DatePicker components with improved ty…
shaneeza ad12567
refactor(date-picker): enhance InputSegment and DateInputSegment with…
shaneeza 6be0c01
refactor(input-box): move utils into input-box
shaneeza 97d84d4
refactor(input-box): move utils into input-box
shaneeza cf44545
refactor(date-picker): integrate InputBox and InputSegment into DateP…
shaneeza 01a4072
refactor(date-picker): migrate utility functions to InputBox and enha…
shaneeza 0d8a827
refactor(date-picker): improve type safety in DateInputSegment and cl…
shaneeza d62e92f
refactor(input-box): update exports in utils to include new segment v…
shaneeza 9e63f3b
refactor(input-box): add devDependencies for palette and enhance Inpu…
shaneeza 0a33907
refactor(input-box): simplify styling logic in InputBox and InputSegm…
shaneeza d4bc356
refactor(input-box): enhance type definitions in InputBox and InputSe…
shaneeza d36b02a
refactor(input-box): improve documentation for InputBox and InputSegm…
shaneeza dfd04ff
refactor(input-box): update documentation for segmentRefs and segment…
shaneeza 853eea4
refactor(input-box, date-picker): streamline value formatting by upda…
shaneeza 93d2c09
refactor(input-box, date-picker): update utils to allow zero values
shaneeza d2aa6ff
refactor(input-box, date-picker): introduce shouldSkipValidation flag…
shaneeza e3066f9
refactor(input-box): enhance renderSegment return type for improved t…
shaneeza ee819d6
refactor(input-box): improve InputBox tests to verify segment renderi…
shaneeza 3eb786c
refactor(input-box): remove unused getLgIds utility and clean up Inpu…
shaneeza ec62658
refactor(input-box, date-picker): rename segmentObj to segmentEnum fo…
shaneeza d192456
refactor(input-box, date-picker): update type annotations and enhance…
shaneeza fb7837a
refactor(input-box): update README and improve InputBox documentation…
shaneeza 40a106d
feat(input-box): adds input-box package and utils
shaneeza a773e7a
merge conflict
shaneeza 2f600d9
refactor(input-box): consolidate InputBox stories into a single file …
shaneeza b8d410a
refactor(date-picker): remove input-box dependency and streamline dat…
shaneeza 95de319
feat(date-picker): integrate input-box for date segment handling and …
shaneeza d7853dc
refactor(date-picker, input-box): implement context for segment manag…
shaneeza cae12d5
refactor(input-box): update InputBox and InputSegment components to u…
shaneeza b24d5bc
refactor(input-box): clarify type handling in InputBoxContext with de…
shaneeza b575531
refactor(input-box): enhance type handling in InputBox and InputSegme…
shaneeza 8236c8d
refactor(input-box): update InputSegment and InputBox components to u…
shaneeza f3125b6
refactor(date-picker): implement DateInputBoxContext for improved sta…
shaneeza c40ad4c
refactor(date-picker, input-box): enhance DateInput components by int…
shaneeza 8a76a79
refactor(date-picker, input-box): improve DateInputSegment tests and …
shaneeza 2141a34
refactor(date-picker): reorganize DateInputBox context imports and re…
shaneeza 8e4ada0
docs(input-box): expand README with detailed component descriptions, …
shaneeza cb9ec7f
docs(input-box): update README to reflect changes in component struct…
shaneeza 015cf67
refactor(input-box): rename `shouldRollover` to `shouldWrap` for clar…
shaneeza 4583b57
refactor(date-picker, input-box): reorganize imports and enhance prop…
shaneeza d552743
test(input-box): add comprehensive tests for segment navigation and r…
shaneeza 941e93c
fix(input-box, date-picker): address validation and formatting issues…
shaneeza 491ae48
refactor(input-box, date-picker): remove defaultMin prop and enhance …
shaneeza 2ed06d6
refactor(input-box): standardize parameter naming from `allowsZero` t…
shaneeza 15450a5
refactor(input-box): enhance createExplicitSegmentValidator documenta…
shaneeza 94306ec
test(input-box): enhance mouse and keyboard interaction tests for seg…
shaneeza 34ab4e6
test(input-box): add tests for Up and Down arrow key interactions to …
shaneeza 762bc65
refactor(input-box, date-picker): streamline InputBoxContext structur…
shaneeza 80c6c68
Merge branch 'shaneeza/time-picker-integration' of github.com:mongodb…
shaneeza e3f5a34
docs(input-box): update README.md to enhance installation instruction…
shaneeza 09d117b
feat(input-box): enhance InputBox and InputSegment components with ne…
shaneeza 3074847
Merge branch 'LG-5504/input-box-component' of github.com:mongodb/leaf…
shaneeza 35d975b
feat(input-box): add '@leafygreen-ui/a11y' as a dependency in pnpm-lo…
shaneeza 3a13648
Merge branch 'LG-5504/input-box-component' of github.com:mongodb/leaf…
shaneeza 2f81c18
fix(input-box): fix lint errors
shaneeza 86fbca9
feat(input-box): set default size for InputBox in stories and refacto…
shaneeza e4b54c5
Merge branch 'LG-5504/input-box-component' of github.com:mongodb/leaf…
shaneeza 0fd74e6
refactor(date-picker): simplify ProviderWrapper in DateInputSegment s…
shaneeza 7e6e4b4
feat(input-box): implement InputBoxContext and InputBoxProvider with …
shaneeza 1c69f5d
remove segement files
shaneeza 46746a5
Merge branch LG-5504/input-box-context of github.com:mongodb/leafygre…
shaneeza 691bde9
feat(input-box): implement InputSegment component with styles, tests,…
shaneeza b2984f3
feat(input-box): add @leafygreen-ui/a11y dependency and update InputS…
shaneeza 6be4fdf
Merge branch LG-5504/input-box-segment of github.com:mongodb/leafygre…
shaneeza b0d7bba
refactor(input-box): update createExplicitSegmentValidator tests to u…
shaneeza 3986897
test(input-box): refactor InputBoxContext tests for improved readabil…
shaneeza 2eda96e
refactor(input-box): update InputBoxContext types to extend SharedInp…
shaneeza fff0557
fix(input-box): correct comment formatting in testutils.mocks.ts for …
shaneeza 959c5a1
feat(input-box): add InputSegment component for modular input handling
shaneeza e97d393
feat(input-box): add placeholder for InputSegment types
shaneeza 0ab86c9
Merge branch 'LG-5504/input-box-context' of github.com:mongodb/leafyg…
shaneeza ad1f017
refactor(input-box): move InputSegmentChangeEventHandler import to sh…
shaneeza 81a943c
refactor(input-box): rename min and max props to minSegmentValue and …
shaneeza 8cfadbe
refactor(input-box): simplify placeholder logic in InputSegment stori…
shaneeza 68fc653
refactor(input-box): update InputSegment styles to use dynamic theme …
shaneeza a04d5ec
feat(input-box): extend InputSegmentProps to include hours, minutes, …
shaneeza 0101c32
refactor(input-box): rename onChange and onBlur props in InputSegment…
shaneeza 662f2dd
refactor(input-box): rename shouldSkipValidation prop to shouldValida…
shaneeza 967b33b
refactor(input-box): reorganize imports in testutils for better clari…
shaneeza a589e94
refactor(input-box): remove deprecated InputSegment types and update …
shaneeza 4a03f0b
Merge branch 'LG-5504/input-box-context' of github.com:mongodb/leafyg…
shaneeza e8a3705
refactor(input-box): update InputSegmentChangeEventHandler import to …
shaneeza 4cf138e
refactor(input-box): enhance InputSegment types and documentation, ad…
shaneeza a7062e2
refactor(input-box): streamline InputSegment exports by removing unus…
shaneeza dd132ea
test(input-box): add accessibility test for InputSegment to ensure no…
shaneeza 0e9b9bd
refactor(input-box): update InputSegment to remove size prop and enha…
shaneeza 5e73301
refactor(input-box): enhance InputSegment types by adding onChange an…
shaneeza 0baa5dc
refactor(input-box): pull the latest from input-segment
shaneeza 6db5451
refactor(input-box): update InputSegment types to extend from 'div' a…
shaneeza 2d76c2c
Merge branch 'LG-5504/input-box-segment' of github.com:mongodb/leafyg…
shaneeza d4ec60d
refactor(input-box): simplify SharedInputBoxTypes by removing redunda…
shaneeza bf2eeda
refactor(input-box): remove InputBoxContext and related tests to stre…
shaneeza 5c05dc1
refactor(input-box): remove InputBoxContext and related types to stre…
shaneeza 9dd8437
Merge branch 'LG-5504/input-box-component' of github.com:mongodb/leaf…
shaneeza 41b814c
wip
shaneeza 904fb8c
refactor(input-box): simplify InputSegment types by removing Value ge…
shaneeza 81e00e6
Merge branch 'LG-5504/input-box-segment' of github.com:mongodb/leafyg…
shaneeza 3792f8b
refactor(input-box): update InputSegment and InputBox types to includ…
shaneeza 4b96d3d
Merge branch 'LG-5504/input-box-component' of github.com:mongodb/leaf…
shaneeza a486f08
refactor(date-picker): streamline DateInput components by simplifying…
shaneeza 7b1db76
refactor(input-box): update InputSegment types to include value prop …
shaneeza 348faa3
Merge branch 'LG-5504/input-box-segment' of github.com:mongodb/leafyg…
shaneeza 20da919
refactor(input-box): remove unused Size import from InputBox.spec.tsx…
shaneeza 8627f35
Merge branch 'LG-5504/input-box-component' of github.com:mongodb/leaf…
shaneeza 6942348
refactor(input-box): enhance InputBox and InputSegment documentation,…
shaneeza 3a8af91
Merge branch LG-5504/input-box-component of github.com:mongodb/leafyg…
shaneeza 3fe8f0b
Merge branch 'shaneeza/time-picker-integration' of github.com:mongodb…
shaneeza 2dc0134
testing
shaneeza b4dd84d
refactor(input-box): remove unused dependencies and update InputSegme…
shaneeza f2cfaa3
update lock file
shaneeza c269b96
testing
shaneeza 73ea273
testing build
shaneeza a55bf24
testing build
shaneeza 717daa7
Merge branch 'LG-5504/input-box-segment' of github.com:mongodb/leafyg…
shaneeza 67d8f9f
test(input-segment): add test for resetting value with complete zeros…
shaneeza d7c1fc2
refactor(input-box): update separator literal styles to use new token…
shaneeza f52ed19
fix(input-segment): add missing line to check for number input handling
shaneeza fddc207
Merge branch LG-5504/input-box-component of github.com:mongodb/leafyg…
shaneeza 94f2900
Merge branch shaneeza/time-picker-integration of github.com:mongodb/l…
shaneeza 68e5f2c
refactor(input-segment): update comments and variable name for clarit…
shaneeza 3896c9c
refactor(input-box): update comment to reflect correct component resp…
shaneeza 410813e
refactor(input-segment): utilize isSingleDigit utility for digit inpu…
shaneeza ed31fdc
refactor(input-box): enhance documentation for InputBox component to …
shaneeza adaa3b6
refactor(input-box): integrate size prop into InputBox and InputSegme…
shaneeza a106f71
refactor(input-box): migrate Size import to shared.types for consiste…
shaneeza df546c1
refactor(input-box): enhance InputBox and InputSegment tests with seg…
shaneeza ea4d8b8
feat(input-box): add comprehensive mocks for date and time segments i…
shaneeza 4d1030b
feat(input-box): integrate lodash for utility functions and enhance I…
shaneeza f342d2f
refactor(input-box): remove unused props from InputBox stories and te…
shaneeza f7f28eb
fix(input-box): ensure segments prop is required and handle error log…
shaneeza ebd1fbb
Merge branch 'LG-5504/input-box-component' of github.com:mongodb/leaf…
shaneeza 454b522
refactor(date-input): remove unused charsPerSegment prop and update r…
shaneeza 2fc54a3
refactor(date-input): remove onKeyDown prop from DateInputBox and upd…
shaneeza 56c13ea
fix(date-input): import DateType and add comment about allowing any 4…
shaneeza 6ac1984
refactor(date-picker, input-box): standardize usage of charsCount ins…
shaneeza 68cd5fb
refactor(date-input): simplify DateInputBox by removing unused props …
shaneeza b44f58b
fix(date-picker): correct parameter name from disableSnapshots to dis…
shaneeza 8595a80
Merge branch 'shaneeza/time-picker-integration' of github.com:mongodb…
shaneeza f476dde
remove isSingleDigit utility and its associated tests
shaneeza faa3cf0
Merge branch 'shaneeza/time-picker-integration' of github.com:mongodb…
shaneeza 8e4a4a4
test(date-picker): ensure real timers are used after tests in keyboar…
shaneeza 7b02b54
refactor(date-picker): rename context value from `value` to `dateValu…
shaneeza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@leafygreen-ui/input-box': minor | ||
| --- | ||
|
|
||
| Initial release of `InputBox` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...e-picker/src/shared/components/DateInput/DateInputBoxContext/DateInputBoxContext.spec.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { isReact17, renderHook } from '@leafygreen-ui/testing-lib'; | ||
|
|
||
| import { | ||
| DateInputBoxProvider, | ||
| useDateInputBoxContext, | ||
| } from './DateInputBoxContext'; | ||
|
|
||
| describe('DateInputBoxContext', () => { | ||
| test('throws error when used outside of DateInputBoxProvider', () => { | ||
| /** | ||
| * The version of `renderHook` imported from "@testing-library/react-hooks", (used in React 17) | ||
| * has an error boundary, and doesn't throw errors as expected: | ||
| * https://github.com/testing-library/react-hooks-testing-library/blob/main/src/index.ts#L5 | ||
| * */ | ||
| if (isReact17()) { | ||
| const { result } = renderHook(() => useDateInputBoxContext()); | ||
| expect(result.error.message).toEqual( | ||
| 'useDateInputBoxContext must be used within a DateInputBoxProvider', | ||
| ); | ||
| } else { | ||
| expect(() => renderHook(() => useDateInputBoxContext())).toThrow( | ||
| 'useDateInputBoxContext must be used within a DateInputBoxProvider', | ||
| ); | ||
| } | ||
| }); | ||
|
|
||
| test('provides context values that match the props passed to the provider', () => { | ||
| const value = new Date(); | ||
| const { result } = renderHook(() => useDateInputBoxContext(), { | ||
| wrapper: ({ children }) => ( | ||
| <DateInputBoxProvider value={value}>{children}</DateInputBoxProvider> | ||
| ), | ||
| }); | ||
| expect(result.current.value).toEqual(value); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there are props that are not used for component logic, can we instead pass them through to
InputBoxthrough the spread...rest?