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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import {
| `link` | _(optional)_ link both calendars, once to the user is navigating between months. Only meant to use if the range is set to `true`. Defaults to `false`. |
| `sync` | _(optional)_ sync input values with the calendars views. Once the input values get changed, the calendar changes its views in sync. Defaults to `true`. |
| `first_day` | _(optional)_ to define the first day of the week. Defaults to `monday`. |
| `locale` | _(optional)_ to define the locale used in the calendar. Needs to be an `date-fns` **v2** locale object, like `import enLocale from 'date-fns/locale/en-GB'`. Defaults to `nb-NO`. |
Copy link
Contributor

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?

Copy link
Contributor Author

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

| `align_picker` | _(optional)_ use `right` to change the calendar alignment direction. Defaults to `left`. |
| `only_month` | _(optional)_ use `true` to only show the defined month. Disables the month navigation possibility. Defaults to `false`. |
| `hide_last_week` | _(optional)_ use `true` to only show the last week in the current month if it needs to be shown. The result is that there will mainly be shows five (5) weeks (rows) instead of six (6). Defaults to `false`. |
Expand Down
284 changes: 0 additions & 284 deletions packages/dnb-eufemia/src/components/date-picker/DatePicker.d.ts

This file was deleted.

Loading
Loading