-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat(DatePicker): Convert to functional components with typescript and hooks #2799
Merged
Merged
Changes from all commits
Commits
Show all changes
180 commits
Select commit
Hold shift + click to select a range
309c79c
convert DatePicker to functional with ts
joakbjerk 89fa0d9
update types for detectOutsideClick
joakbjerk 0da7cb0
add DatePicker to context
joakbjerk b6aeec3
refactor DatePickerAddon
joakbjerk 6303a13
convert DatePickerCalc to ts and add types
joakbjerk ce384ce
convert DatePickerCalendar to ts with hooks
joakbjerk 9ae712b
refactor DatePicker defaultProps
joakbjerk 7ede24a
correct ZeroDayIndex type
joakbjerk 5fb9349
convert DatePickerContext to ts
joakbjerk 901cecf
remove console.log
joakbjerk ef393e6
fix end_date prop warning in tests
joakbjerk 7494f40
remove DatePickerCalendar type definition file
joakbjerk 3e5f5b7
convert DatePickerFooter
joakbjerk 74704ba
convert DatePickerRange
joakbjerk 45d3c05
add views type to context
joakbjerk 51e9ad3
convert DatePickerProvider
joakbjerk fc583c2
convert DatePickerInput
joakbjerk fd361b0
fix maskList on initial render
joakbjerk 41b00bd
fix onChange functionality
joakbjerk 9ceece0
fix broken paste functionality
joakbjerk ea02614
fix DatePickerInput forward ref error
joakbjerk c4eccdf
fix getDates date values
joakbjerk 1e14b2d
fix DatePickerCalendar export
joakbjerk 5122785
remove unused imports from DatePickerAddon
joakbjerk aff6772
fix ref type conflicts
joakbjerk 77a20bd
update Context types
joakbjerk 27d7b35
create one CalendarButton component
joakbjerk 26b5921
add translations to DatePickerContext type
joakbjerk 658b35b
fix DatePickerCalendar cache and days refs
joakbjerk 2af9d79
fix DatePickerInput size type
joakbjerk 93a9bfd
cleanup DatePicker date deifinitions
joakbjerk cd12bf4
update DatePickerFormLabel
joakbjerk ceca0fc
fix DatePicker context merging
joakbjerk 8e2762a
fix DatePicker internal states
joakbjerk b9a0c38
re-add soon to be deprecated context
joakbjerk 268ddc9
remove yet to be used component to fix aria live text
joakbjerk b85e8f4
add test for closing picker on outside click
joakbjerk 31444bc
update context types
joakbjerk 4f2aa8a
add js changes to ts files
joakbjerk 41be45c
merge latest changes
joakbjerk 26b1c59
merge latest changes
joakbjerk 74c10aa
refactored provider
joakbjerk f7e6e6f
create useDate hook
joakbjerk 4b8c8ec
correct type definition
joakbjerk b1760f6
create view and date hooks and fix tests
joakbjerk 4bbe72e
remove old files
joakbjerk b1f7f4b
remove type definition file
joakbjerk 4932884
fix type errors
joakbjerk 968c62c
fix TextMask type error
joakbjerk ea833dd
swap out useLocale with useTranslation
joakbjerk e2af5e9
move lastEventCallCache to own hook
joakbjerk 05d0d3e
move hooks to own files
joakbjerk 13dcf79
remove changeMonthViews flag as it is not needed anymore
joakbjerk 5f9fc96
move date correction to own function
joakbjerk cb8f8b5
fix bad setState and implement usePreviousProps hook
joakbjerk 0da52cd
move inputDates to own hook
joakbjerk 4f1a0ee
add usePreviousProps hook
joakbjerk db5e41c
remove useInputDates hook
joakbjerk ca9d9fe
shorthand conditional prop function calls
joakbjerk e05887f
move hasHadValidDate hook
joakbjerk 999b620
deprecate locale prop
joakbjerk c7d7891
memoize calendar locales
joakbjerk 9e1feb3
add comment
joakbjerk 35fcb10
remove unused hook
joakbjerk db244b5
fix type errors
joakbjerk a0ffffb
fix linting
joakbjerk 0af9dd2
fix portal type errors
joakbjerk a47018c
update shortcuts type
joakbjerk 6b9cd51
remove any types
joakbjerk a65c757
fix range keyboard selection
joakbjerk 565c4db
fix types
joakbjerk 3b3e788
remove redundant useEffect
joakbjerk ea877e5
remove updateState
joakbjerk 8c703be
remove unused onNav
joakbjerk 0611a03
refactor DatePickerRange
joakbjerk 52018d0
type fix
joakbjerk c537a37
remove unused import
joakbjerk 74b9748
refactor onNav
joakbjerk 33f677d
fix callOnChangeHandler type
joakbjerk c3b747c
remove isTrue
joakbjerk 9351fab
refactored getReturnObject
joakbjerk f702f1f
correct partialStartDate and partialEndDate types
joakbjerk 49bce1c
wrap provider functions in useCallbacks
joakbjerk 1b0c470
wrap functions in useCallback
joakbjerk aa05257
fix returnObject type
joakbjerk feba5df
refacto DatePickerAddon and update relevant types
joakbjerk 6abcfb9
rename useLastEventCallCache variable names
joakbjerk 9d6840a
rename date types
joakbjerk adbfb51
fix type errors
joakbjerk 8a5cdff
fix deprecated substr
joakbjerk 045afa2
update param names
joakbjerk 135a00f
refactor getReturnObject
joakbjerk 8195a39
refactor DatePickerCalendar
joakbjerk 5fce0cc
refactor getReturnObject
joakbjerk 69b476d
optimize dependency arrays
joakbjerk 22632fb
add comment
joakbjerk f854e4c
define type
joakbjerk 0f6791e
fix dates
joakbjerk 4fc8aa5
correct types
joakbjerk aab2f86
wrap DatePickerInput functions and values in useCallback and useMemos
joakbjerk 6a5e733
update DatePickerChangeEvent type
joakbjerk 9c9b16c
rename UsedButton to SubmitElement for clarity
joakbjerk 3aa76ac
wrap SubmitElement in useMemo
joakbjerk 46260e8
wrap DatePickerInput functions and values in useCallback and useMemo
joakbjerk 72db635
wrapped DatePicker functions and values in useCallback and useMemo
joakbjerk a30cd84
add types to DatePicker function parameters
joakbjerk 7f987d8
type refactoring
joakbjerk e838429
remove dispatchCustomEvent
joakbjerk 2345e9d
optimized dependency arrays
joakbjerk f0f5bff
type update
joakbjerk 2c211eb
fix DatePickerInput callbacks
joakbjerk 7b3980e
fix range dom error
joakbjerk 6ff319b
fix screenshot tests
joakbjerk 6a39864
fix useDates type error
joakbjerk b407913
change function order
joakbjerk bd9dec5
update return object
joakbjerk e6a73b0
fix on_hide return
joakbjerk 3d6d9e2
fix type errors
joakbjerk 922df2d
remove unused ref
joakbjerk e1837c5
fix input types
joakbjerk 338a8d7
fix portal type errors
joakbjerk 4a0e1ad
update test
joakbjerk 3c20d06
clean up even types
joakbjerk 0645ce4
fix types
joakbjerk d1ac410
update FormStatusProps omit
joakbjerk c8ef7a0
remove dispatchcustomevent
joakbjerk d04cb9c
optimize dependency array
joakbjerk 3f5d255
add usePreviousValue hook to useViews
joakbjerk 96f0a16
rename usePreviousProps to usePreviousValue
joakbjerk 1bbd230
move initDates function out of hook
joakbjerk d9650e3
fix callback check
joakbjerk c4da9ad
correct naming of hook
joakbjerk b4518ce
remove test stories
joakbjerk df4bdd4
lint fix
joakbjerk d4e25d7
lint fix
joakbjerk 44c84d5
improve function naming
joakbjerk e5c4468
fix button shortcuts
joakbjerk af25329
fix cancel button behaviour
joakbjerk 81ed2a4
re-add DatePickerEvent
joakbjerk cfe38cf
improve context and clarity for event params type
joakbjerk 71b0f1e
make all dates available for shortcut callback
joakbjerk 13ca0dd
fix linked calendar behaviour
joakbjerk 9903f7e
refactor input dates update logic
joakbjerk 50fa8b7
add comments
joakbjerk b73c825
fix range input removal bug
joakbjerk 799f693
remove date fallback from endDate if not range
joakbjerk 16e7cae
add todos
joakbjerk edcd1cc
add test for shortcuts used in range pickers
joakbjerk 9261731
add test for range pickers cancel button
joakbjerk 3dc149f
add tests for shortcut callback dates
joakbjerk 02ecf78
add test for linked range pickers
joakbjerk 5d3df00
add test for prop controlled end and start dates
joakbjerk 470c5e4
refactor month handling
joakbjerk 34b8385
refactor month handling to sync up with views
joakbjerk cbc66d6
refactor month handling to sync with views in range mode
joakbjerk acd37b9
reduce amount of code in month handling
joakbjerk 2b9c48a
add test for calendar view syncing
joakbjerk a0b5459
fix picker behaviour when end and start dates are the same month
joakbjerk 8fd7d92
fix same day selection for range mode
joakbjerk a6728b3
refactor month handling and add comments
joakbjerk 615bd94
add flag to identify if date change is triggered by shortcut or not, …
joakbjerk 8026d96
add test
joakbjerk 6afeb4b
rename props for clarity
joakbjerk 7524d9c
move date mapping into mapping function
joakbjerk 7e79a7e
fix on change callback dates when using keyboard
joakbjerk 861cd76
force month change on keyboard navigation
joakbjerk 02688b8
add tests for month change based on keyboard navigation
joakbjerk d1b0f6f
fix month change flicker bug
joakbjerk 733135b
fix date update performance and prevent unnecessary re-renders
joakbjerk 85213ee
remove unused prop
joakbjerk 2f37a28
remove redundant hook
joakbjerk c564f58
memoize date prop changes checker
joakbjerk 63e3b05
rename variables for clarity
joakbjerk 641a915
make sure dates not changed by props are not affected on prop change
joakbjerk 32b60e3
remove redundant variable assignment
joakbjerk 80d7a63
fix failing test
joakbjerk 41bf2cc
move all view logic handling to useViews
joakbjerk beb50ab
fix useLastEventCallCache update logic
joakbjerk 47bcbd2
fix typo in comment
joakbjerk e66a437
Various alignments
tujoworker 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 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
284 changes: 0 additions & 284 deletions
284
packages/dnb-eufemia/src/components/date-picker/DatePicker.d.ts
This file was deleted.
Oops, something went wrong.
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.
Is this a breaking change, that we no longer provide the
locale
property?If someone is using this property right now, is it safe to just remove it?
Should we mention the removal(and/or what users should do to keep the same functionality, if it's stille possible?) in some kind of release notes or just docs in
DatePicker
?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 think this was replaced by a locale/translation rewrite we did earlier this year. Cant remember the exact details though