-
Notifications
You must be signed in to change notification settings - Fork 74
[LG-5532] feat(time-input) display segment values #3379
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 58 commits into
shaneeza/segment-logic-integration
from
LG-5532/segments-display-values
Dec 23, 2025
Merged
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
bf86e07
feat(time-input): add utils for toggling select and formatparts
shaneeza 612b474
wip
shaneeza a578ecb
refactor(time-input): enhance time formatting utilities and improve d…
shaneeza 804cd88
refactor(time-input): improve time input handling and formatting logic
shaneeza 1db42af
feat(time-input): add TimeFormField and TimeFormFieldInputContainer c…
shaneeza 206e145
temp remove ts check
shaneeza bb3916d
refactor(time-input): clean up unused select unit logic and improve s…
shaneeza df69d22
feat(time-input): enhance TimeInput component with new constants for …
shaneeza 2f5707f
refactor(time-input): update time segment rules and default values to…
shaneeza 9715407
refactor(time-input): simplify getFormatParts function by removing lo…
shaneeza dad7b62
test(time-input): add unit tests for getFormatParts utility to verify…
shaneeza f559593
refactor(time-input): remove locale dependency from formatParts in Ti…
shaneeza 3e6f6be
feat(time-input): add default time parts and enhance time input conte…
shaneeza 1ef4c97
merge conflits
shaneeza 87023fb
feat(time-input): enhance TimeInput stories with new argTypes for dar…
shaneeza 580c90f
test(time-input): add comprehensive unit tests for TimeInputSegment c…
shaneeza 2495aa1
test(time-input): add comprehensive unit tests for TimeInputSegment c…
shaneeza 4cad730
refactor(time-input): update time segment handling to use explicit is…
shaneeza 1afe57e
refactor(time-input): rename shouldShowSelect to is12hFormat for clar…
shaneeza cb84996
refactor(time-input): clean up unused state and comments in TimeInput…
shaneeza 6e265a7
chore(pnpm-lock): add workspace links for @leafygreen-ui/input-box to…
shaneeza 2547fdc
refactor(time-input): remove unused console logs and simplify time fo…
shaneeza 10d4039
merge conflict
shaneeza e46a73c
refactor(time-input): clean up comments and improve test descriptions…
shaneeza 94ed98f
refactor(time-input): remove outdated TODO comment in TimeInputContex…
shaneeza 7e42f34
merge conflict
shaneeza 2d2fbd5
Merge branch 'shaneeza/segment-logic-integration' of github.com:mongo…
shaneeza d9b99ec
Merge branch 'LG-5538/segments-parse-time' of github.com:mongodb/leaf…
shaneeza f07a1b8
merge conflict
shaneeza ed87ee7
test(time-input): add unit tests for TimeInputBox component
shaneeza e18c444
feat(time-input): integrate LGIDs into TimeInput components for impro…
shaneeza a361ba7
test(time-input): add test to verify seconds input is not rendered wh…
shaneeza aa4e7a2
feat(time-input): implement getNonLiteralTimeParts utility function w…
shaneeza d38ee94
refactor(time-input): rename defaultTimeParts to defaultDateTimeParts…
shaneeza d57c109
refactor(time-input): simplify import structure for getFormatPartsVal…
shaneeza aff3376
refactor(time-input): enhance getFormatter utility to conditionally i…
shaneeza 9e343ff
refactor(time-input): consolidate imports for utility functions in Ti…
shaneeza 346cb74
feat(time-input): add getFormattedDateTimeParts utility with tests fo…
shaneeza 31dba0b
refactor(time-input): rename TimeParts to DateTimeParts and update re…
shaneeza 388339e
refactor(time-input): update documentation in getFormattedDateTimePar…
shaneeza cea6a1d
merge conflict
shaneeza 8abc708
refactor(time-input): remove unused state and error message from Time…
shaneeza 4458f6f
refactor(time-input): update styles for seamless input display and cl…
shaneeza 5455489
Merge branch 'shaneeza/segment-logic-integration' of github.com:mongo…
shaneeza 237c4ee
chore(version): update version to 5.2.0
shaneeza 617ebb7
Merge branch 'LG-5538/segments-parse-time' of github.com:mongodb/leaf…
shaneeza a736467
merge conflict
shaneeza c9751da
fix(time-input): update minExplicitValue for hour segment to ensure c…
shaneeza 7ccb116
feat(time-input): enhance time input context and segment change event…
shaneeza 2b4acae
refactor(time-input): remove unused TimeInputDisplayContext utility file
shaneeza 574a23a
refactor(time-input): streamline imports and enhance context utility …
shaneeza 96b9ebd
feat(time-input): add TimeInputDisplayContext utility functions and d…
shaneeza e032c8b
refactor(time-input): update imports to use TimeInputDisplayContext u…
shaneeza a04fca7
refactor(time-input): update component props to use ComponentPropsWit…
shaneeza 379f871
refactor(time-input): move time segment rules and default min/max fun…
shaneeza 4a62b19
refactor(time-input): simplify aria attributes in TimeFormFieldInputC…
shaneeza e88a937
refactor(time-input): remove unused TimeInputSegmentChangeEvent type …
shaneeza a714dc8
refactor(time-input): rename defaultPlaceholder to defaultPlaceholder…
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
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
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
63 changes: 62 additions & 1 deletion
63
packages/time-input/src/Context/TimeInputDisplayContext/TimeInputDisplayContext.utils.ts
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 |
|---|---|---|
| @@ -1 +1,62 @@ | ||
| // TODO: min, max helpers | ||
| import { | ||
| MAX_DATE, | ||
| MIN_DATE, | ||
| SupportedLocales, | ||
| } from '@leafygreen-ui/date-utils'; | ||
| import { BaseFontSize } from '@leafygreen-ui/tokens'; | ||
|
|
||
| import { Size } from '../../TimeInput/TimeInput.types'; | ||
| import { getLgIds } from '../../utils'; | ||
|
|
||
| import { | ||
| TimeInputDisplayContextProps, | ||
| TimeInputDisplayProviderProps, | ||
| } from './TimeInputDisplayContext.types'; | ||
|
|
||
| export type DisplayContextPropKeys = Exclude< | ||
| keyof TimeInputDisplayProviderProps, | ||
| 'lgIds' | ||
| >; | ||
|
|
||
| /** | ||
| * Props names that that are added to the context and used to pick and omit props | ||
| */ | ||
| export const displayContextPropNames: Array<DisplayContextPropKeys> = [ | ||
| 'aria-label', | ||
| 'aria-labelledby', | ||
| 'label', | ||
| 'description', | ||
| 'locale', | ||
| 'timeZone', | ||
| 'min', | ||
| 'max', | ||
| 'baseFontSize', | ||
| 'disabled', | ||
| 'size', | ||
| 'errorMessage', | ||
| 'state', | ||
| 'showSeconds', | ||
| ]; | ||
|
|
||
| /** | ||
| * The default display context values | ||
| */ | ||
| export const defaultTimeInputDisplayContext: TimeInputDisplayContextProps = { | ||
| ariaLabelProp: '', | ||
| ariaLabelledbyProp: '', | ||
| label: '', | ||
| description: '', | ||
| locale: SupportedLocales.ISO_8601, | ||
| timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone, | ||
| min: MIN_DATE, | ||
| max: MAX_DATE, | ||
| baseFontSize: BaseFontSize.Body1, | ||
| disabled: false, | ||
| size: Size.Default, | ||
| errorMessage: '', | ||
| isDirty: false, | ||
| setIsDirty: () => {}, | ||
| is12HourFormat: false, | ||
| showSeconds: true, | ||
| lgIds: getLgIds(), | ||
| }; |
57 changes: 0 additions & 57 deletions
57
packages/time-input/src/Context/TimeInputDisplayContext/TimePickerDisplayContext.utils.ts
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export * from './TimeInputContext'; | ||
| export * from './TimeInputDisplayContext'; |
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.
Taking another look, I see this pattern here and elsewhere. Don't want to blow up scope of these changes, but with this many instances, it seems like a repeat pattern worth abstracting in some way
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.
I'll create a ticket for this
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.
https://jira.mongodb.org/browse/LG-5836