Commit c9fe395
authored
[LG-5504] feat(input-box): Add segment focus behavior (#3322)
* refactor(date-picker): extract reusable logic from DateInputSegment, wip
* refactor(date-picker): extract reusable logic from DateInputSegment, wip
* refactor(date-picker): enhance InputSegment and DateInputSegment with improved type handling and event management
* refactor(date-picker): update InputSegment types and enhance DateInputSegment with additional props
* refactor(date-picker): WIP enhance InputBox and DateInput components with improved type handling and segment management
* refactor(date-picker): integrate InputBox into DateInputBox for improved segment management and type handling
* refactor(date-picker): clean up DateInputBox and enhance InputBox types for better segment management
* refactor(date-picker): enhance DatePicker components with improved type handling and segment management
* refactor(date-picker): enhance InputSegment and DateInputSegment with new props for step handling and rollover management
* refactor(input-box): move utils into input-box
* refactor(input-box): move utils into input-box
* refactor(date-picker): integrate InputBox and InputSegment into DatePicker components for improved segment management and type handling
* refactor(date-picker): migrate utility functions to InputBox and enhance segment validation logic for improved date handling
* refactor(date-picker): improve type safety in DateInputSegment and clean up InputBox component
* refactor(input-box): update exports in utils to include new segment validation and formatting functions
* refactor(input-box): add devDependencies for palette and enhance InputSegment and InputBox tests for better coverage
* refactor(input-box): simplify styling logic in InputBox and InputSegment components by introducing utility functions
* refactor(input-box): enhance type definitions in InputBox and InputSegment components for improved clarity and documentation
* refactor(input-box): improve documentation for InputBox and InputSegment types with clearer examples
* refactor(input-box): update documentation for segmentRefs and segmentRules in InputBox types for better clarity
* refactor(input-box, date-picker): streamline value formatting by updating getValueFormatter to accept segment-specific character counts
* refactor(input-box, date-picker): update utils to allow zero values
* refactor(input-box, date-picker): introduce shouldSkipValidation flag for year segment and enhance validation logic
* refactor(input-box): enhance renderSegment return type for improved type safety and clarity
* refactor(input-box): improve InputBox tests to verify segment rendering and props validation
* refactor(input-box): remove unused getLgIds utility and clean up InputSegment props
* refactor(input-box, date-picker): rename segmentObj to segmentEnum for consistency and clarity across components
* refactor(input-box, date-picker): update type annotations and enhance tests for InputBox and InputSegment components
* refactor(input-box): update README and improve InputBox documentation for clarity
* feat(input-box): adds input-box package and utils
* refactor(input-box): consolidate InputBox stories into a single file and enhance control parameters
* refactor(date-picker): remove input-box dependency and streamline date segment handling
* feat(date-picker): integrate input-box for date segment handling and enhance validation logic
* refactor(date-picker, input-box): implement context for segment management and streamline props handling in DateInput components
* refactor(input-box): update InputBox and InputSegment components to use context for segment rendering and streamline prop handling
* refactor(input-box): clarify type handling in InputBoxContext with detailed comments on type assertions
* refactor(input-box): enhance type handling in InputBox and InputSegment components for improved clarity and consistency
* refactor(input-box): update InputSegment and InputBox components to utilize context for segment values and enhance prop handling
* refactor(date-picker): implement DateInputBoxContext for improved state management and enhance DateInputSegment integration
* refactor(date-picker, input-box): enhance DateInput components by integrating context for segment management and improving prop handling
* refactor(date-picker, input-box): improve DateInputSegment tests and stories by enhancing prop handling and integrating context for segment management
* refactor(date-picker): reorganize DateInputBox context imports and remove unused DateInputBoxContext file
* docs(input-box): expand README with detailed component descriptions, features, and usage examples for InputBox, InputBoxContext, and InputSegment
* docs(input-box): update README to reflect changes in component structure and props for InputBox and InputSegment
* refactor(input-box): rename `shouldRollover` to `shouldWrap` for clarity and update related documentation and tests
* refactor(date-picker, input-box): reorganize imports and enhance prop handling in DateInputBox and InputBox components for improved clarity and functionality
* test(input-box): add comprehensive tests for segment navigation and rendering behavior in InputBox component
* fix(input-box, date-picker): address validation and formatting issues in InputBox and DateInputBox components; enhance tests for edge cases and input behavior
* refactor(input-box, date-picker): remove defaultMin prop and enhance validation logic for segment inputs; update tests for improved coverage and clarity
* refactor(input-box): standardize parameter naming from `allowsZero` to `allowZero` across components and utility functions for consistency
* refactor(input-box): enhance createExplicitSegmentValidator documentation by adding parameter descriptions and examples for improved clarity
* test(input-box): enhance mouse and keyboard interaction tests for segment focus behavior in InputBox component
* test(input-box): add tests for Up and Down arrow key interactions to maintain focus in InputBox segments
* refactor(input-box, date-picker): streamline InputBoxContext structure and enhance type definitions; update InputBox and InputSegment components for improved clarity and functionality
* docs(input-box): update README.md to enhance installation instructions, usage examples, and component prop descriptions for better clarity and usability
* feat(input-box): enhance InputBox and InputSegment components with new features and documentation.
* feat(input-box): add '@leafygreen-ui/a11y' as a dependency in pnpm-lock.yaml
* fix(input-box): fix lint errors
* feat(input-box): set default size for InputBox in stories and refactor InputSegment styles for improved class handling
* refactor(date-picker): simplify ProviderWrapper in DateInputSegment stories for better segment handling
* feat(input-box): implement InputBoxContext and InputBoxProvider with associated types and tests
* remove segement files
* feat(input-box): implement InputSegment component with styles, tests, and stories
* feat(input-box): add @leafygreen-ui/a11y dependency and update InputSegment component references
* refactor(input-box): update createExplicitSegmentValidator tests to use object parameter format for improved clarity and consistency
* test(input-box): refactor InputBoxContext tests for improved readability by destructuring context values
* refactor(input-box): update InputBoxContext types to extend SharedInputBoxTypes and remove deprecated InputSegment types
* fix(input-box): correct comment formatting in testutils.mocks.ts for clarity
* feat(input-box): add InputSegment component for modular input handling
* feat(input-box): add placeholder for InputSegment types
* refactor(input-box): move InputSegmentChangeEventHandler import to shared types for better organization
* refactor(input-box): rename min and max props to minSegmentValue and maxSegmentValue for consistency
* refactor(input-box): simplify placeholder logic in InputSegment stories using defaultPlaceholderMock
* refactor(input-box): update InputSegment styles to use dynamic theme styles and improve organization
* feat(input-box): extend InputSegmentProps to include hours, minutes, and seconds segments
* refactor(input-box): rename onChange and onBlur props in InputSegment to improve clarity
* refactor(input-box): rename shouldSkipValidation prop to shouldValidate for clarity and consistency
* refactor(input-box): reorganize imports in testutils for better clarity and structure
* refactor(input-box): remove deprecated InputSegment types and update imports in InputBoxContext
* refactor(input-box): update InputSegmentChangeEventHandler import to use type alias from shared.types
* refactor(input-box): enhance InputSegment types and documentation, adding isInputSegment utility and improving component descriptions
* refactor(input-box): streamline InputSegment exports by removing unused types
* test(input-box): add accessibility test for InputSegment to ensure no violations when tooltip is closed
* refactor(input-box): update InputSegment to remove size prop and enhance type definitions for better clarity
* refactor(input-box): enhance InputSegment types by adding onChange and onBlur event handlers with detailed documentation
* refactor(input-box): update InputSegment types to extend from 'div' and include additional props for improved functionality
* refactor(input-box): simplify SharedInputBoxTypes by removing redundant properties and enhancing type clarity
* refactor(input-box): remove InputBoxContext and related tests to streamline input box functionality
* wip
* refactor(input-box): simplify InputSegment types by removing Value generic and updating related components for improved clarity
* refactor(input-box): update InputSegment and InputBox types to include value prop and streamline segment handling
* refactor(date-picker): streamline DateInput components by simplifying props and enhancing context usage
* refactor(input-box): update InputSegment types to include value prop and remove unused segmentRefs and segments properties for improved clarity
* refactor(input-box): remove unused Size import from InputBox.spec.tsx for cleaner code
* refactor(input-box): enhance InputBox and InputSegment documentation, update props for clarity, and streamline type exports
* testing
* refactor(input-box): remove unused dependencies and update InputSegment types for consistency
* update lock file
* testing
* testing build
* testing build
* test(input-segment): add test for resetting value with complete zeros and update InputSegment story with segmentEnum
* refactor(input-box): update separator literal styles to use new token-based approach
* fix(input-segment): add missing line to check for number input handling
* refactor(input-segment): update comments and variable name for clarity in digit input handling
* refactor(input-box): update comment to reflect correct component responsible for increment/decrement logic
* refactor(input-segment): utilize isSingleDigit utility for digit input handling
* refactor(input-box): enhance documentation for InputBox component to clarify functionality and usage
* refactor(input-box): integrate size prop into InputBox and InputSegment components for enhanced customization
* refactor(input-box): migrate Size import to shared.types for consistent usage across components
* refactor(input-box): enhance InputBox and InputSegment tests with segmentRefs integration for improved focus handling
* feat(input-box): add comprehensive mocks for date and time segments in testutils for enhanced testing capabilities
* feat(input-box): integrate lodash for utility functions and enhance InputBox stories with date and time segment examples
* refactor(input-box): remove unused props from InputBox stories and testutils for cleaner code
* feat(input-box): enhance InputBox functionality with click handling and focus management for segments
* fix(input-box): ensure segments prop is required and handle error logging in InputBox component
* refactor(date-input): remove unused charsPerSegment prop and update related references to charsCount for consistency
* refactor(date-input): remove onKeyDown prop from DateInputBox and update DateInputBoxProviderProps to extend PropsWithChildren for better type handling
* fix(date-input): import DateType and add comment about allowing any 4-digit year value in custom validation for date segments
* refactor(date-picker, input-box): standardize usage of charsCount instead of charsPerSegment across components and tests for consistency
* refactor(input-box): simplify InputBox tests and remove unused click handling logic for improved clarity
* refactor(input-box): update exports and clean up InputBox component by removing unused props for better maintainability
* refactor(date-input): simplify DateInputBox by removing unused props for cleaner implementation
* fix(date-picker): correct parameter name from disableSnapshots to disableSnapshot in DatePicker stories and pass size prop to InputBox
* remove isSingleDigit utility and its associated tests
* test(date-picker): ensure real timers are used after tests in keyboard and mouse interaction specs
* feat(date-picker): integrate focusAndSelectSegment utility for improved segment handling in DatePickerInput
* fix(date-picker): clarify comment regarding focusAndSelectSegment implementation in DatePickerInput
* rename files
* refactor(date-picker): remove unused getFirstEmptySegment utility function
* refactor(input-box): remove unused getFirstEmptySegment and getSegmentToFocus utilities
* refactor(input-box): remove getSegmentToFocus utility and its associated tests
* test(input-box): enhance focusAndSelectSegment tests for improved coverage and edge case handling
* feat(input-box): enhance InputSegment focus handling with data-focus attribute support in stories and styles
* fix(input-box): enhance focus handling in InputSegment styles by adding support for data-focus attribute1 parent 92fd3e3 commit c9fe395
File tree
14 files changed
+585
-148
lines changed- packages
- date-picker/src
- DatePicker
- DatePickerInput
- utils/getSegmentToFocus
- input-box/src
- InputSegment
- utils
- focusAndSelectSegment
- getFirstEmptySegment
- getSegmentToFocus
14 files changed
+585
-148
lines changedLines changed: 11 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| |||
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
23 | | - | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
80 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
81 | 89 | | |
82 | 90 | | |
83 | 91 | | |
84 | 92 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | 93 | | |
89 | 94 | | |
90 | 95 | | |
| |||
Lines changed: 0 additions & 96 deletions
This file was deleted.
Lines changed: 0 additions & 27 deletions
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
| |||
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
84 | 93 | | |
85 | 94 | | |
86 | 95 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | | - | |
| 48 | + | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | | - | |
| 18 | + | |
| 19 | + | |
Lines changed: 161 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
0 commit comments