-
Notifications
You must be signed in to change notification settings - Fork 69
Integration: Date Picker [LG-3152] #1951
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
Merged
Changes from all commits
Commits
Show all changes
412 commits
Select commit
Hold shift + click to select a range
d67aa28
update tests
TheSonOfThomp 0d71cd5
adds validation handler functionality
TheSonOfThomp 82951bd
update Segment formatting & change handling
TheSonOfThomp b6ff0e5
updates handleValidation tests
TheSonOfThomp cbbb413
adds initialOpen. moves isOpen to context
TheSonOfThomp cf86f19
fix ts
TheSonOfThomp 8a6049b
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp aec8a7f
rm changesets
TheSonOfThomp f1e084d
mv menuId declaration
TheSonOfThomp 6cf112d
init range picker
TheSonOfThomp 45da1b0
separate date picker input/menu concerns
TheSonOfThomp 0edfac0
first pass range form field
TheSonOfThomp 8f52782
Creates form-field component
TheSonOfThomp 8030156
Creates form-field component
TheSonOfThomp e32f1e4
fixes types
TheSonOfThomp 0bdd4a6
lint
TheSonOfThomp 2db1792
Merge branch 'FormField-component' into adam/date-picker-lg-3152
TheSonOfThomp 948c91b
rename prop to errorMessage
TheSonOfThomp 2103ff1
adds tests, updates aria attributes, adds stories
TheSonOfThomp e182caf
Update FormField.stories.tsx
TheSonOfThomp 31e25e2
Merge branch 'FormField-component' into adam/date-picker-lg-3152
TheSonOfThomp be56b77
adds rests for ReactNode label & description
TheSonOfThomp 91a544d
Merge branch 'FormField-component' into adam/date-picker-lg-3152
TheSonOfThomp 3114085
adds tests for form field pass through
TheSonOfThomp bdd1c20
adds tests for form field pass through
TheSonOfThomp da2aefe
implements form-field
TheSonOfThomp d3e543a
lint
TheSonOfThomp f3806f5
rm explicit presentation role from icon
TheSonOfThomp 45ea27e
Merge branch 'main' into FormField-component
TheSonOfThomp 3a529db
update dependencies. fix stories
TheSonOfThomp 691478a
Refactor to use composition
TheSonOfThomp d4eb45e
erefactor styles
TheSonOfThomp ac5dbda
add stories. add docs
TheSonOfThomp d1541f6
improves button demo
TheSonOfThomp fd28815
mv sub components
TheSonOfThomp 88033c5
reorg components. update tests
TheSonOfThomp e8777ae
Address RA UI bugs
TheSonOfThomp c1c3438
Merge branch 'FormField-component' into adam/date-picker-lg-3152
TheSonOfThomp 595bc19
Update yarn.lock
TheSonOfThomp 01694aa
refactor DateFormField
TheSonOfThomp e5e5559
adds tests for getSegmentToFocus
TheSonOfThomp c37b02e
creates getRangeSegmentToFocus
TheSonOfThomp 84f0eb0
scaffolds keydown behavior
TheSonOfThomp 8607e56
add darkMode prop. Update 'unset' -> 'default'
TheSonOfThomp 05f9f9e
rm Valid state from SB
TheSonOfThomp 125bdaa
update Default -> None
TheSonOfThomp 882b76d
fix build
TheSonOfThomp 8a6c427
Rename to FormFieldInputContainer
TheSonOfThomp e932e7f
fix tests
TheSonOfThomp bafe0b8
Merge branch 'main' into FormField-component
TheSonOfThomp 28e0b74
Merge branch 'FormField-component' into adam/date-picker-lg-3152
TheSonOfThomp 669499c
Refactors re FormField changes
TheSonOfThomp 8120eab
scaffolds range menu
TheSonOfThomp 00453d9
renames icon -> contentEnd
TheSonOfThomp 6fd9da0
Update FormField.stories.tsx
TheSonOfThomp da1297b
Update FormField.stories.tsx
TheSonOfThomp 6cc638a
Adds Base Font Size
TheSonOfThomp b7ebd9f
Merge branch 'FormField-component' into adam/date-picker-lg-3152
TheSonOfThomp 548e22f
Update DateFormField.tsx
TheSonOfThomp a33f001
major range menu buildout
TheSonOfThomp 784eb84
fix tests
TheSonOfThomp 7c7d6f3
Update package.json
TheSonOfThomp 7ed0283
Merge branch 'main' into FormField-component
TheSonOfThomp cbba43f
Merge branch 'FormField-component' into adam/date-picker-lg-3152
TheSonOfThomp 559d1a5
bump dp deps
TheSonOfThomp a34a80d
updates tsdocs for shared components
TheSonOfThomp d70bd9b
rename QuickSelectionMenu
TheSonOfThomp 27f2984
update range calendar menu styling
TheSonOfThomp c5b04e6
Create getFullMonthLabel.spec.ts
TheSonOfThomp 212fe72
update range menu spacing
TheSonOfThomp 84a3d42
adds range rendering tests
TheSonOfThomp 1b552fe
outlines bulk of range tests
TheSonOfThomp e18c758
refactor to value/onchange
TheSonOfThomp 2d870c4
update calendar rendering
TheSonOfThomp 91aa96d
scaffold calendar handlers
TheSonOfThomp 95ea4b6
updates range input handlers
TheSonOfThomp b0aac8d
input handlers
TheSonOfThomp 0524d78
fills out input tests
TheSonOfThomp 4d97fe8
move typing tests
TheSonOfThomp 6b4ce05
Renames onChange to onDateChange
TheSonOfThomp 6adb71c
Updates onSegmentChange to onChange
TheSonOfThomp d6695b2
LG-3675, LG-3676: Date Picker select width and menu width (#2013)
shaneeza 24f5be6
format segments on value update
TheSonOfThomp 892e8c5
update Range picker with updated callbacks
TheSonOfThomp 963aa49
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp 09637ec
update typing & validation handler tests
TheSonOfThomp 5c71ebc
creates isSameUTCRange
TheSonOfThomp 27e101b
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp b4c1471
updates range picker test suite
TheSonOfThomp fd4854e
Update DateRangePicker.spec.tsx
TheSonOfThomp 37c5c3f
over-engineering the tab stop tests
TheSonOfThomp bb6e682
simplify tab stop tests
TheSonOfThomp a35bdd6
update disabled / color (#2022)
shaneeza 19f5a58
adds focus handling
TheSonOfThomp 6fa0182
Merge branch 'adam/date-picker-lg-3152' of https://github.com/mongodb…
TheSonOfThomp 6046dbc
adds ref to Select component
TheSonOfThomp 01e58a5
Create loud-trainers-sparkle.md
TheSonOfThomp bf961fa
adds example & tests to polymorphic
TheSonOfThomp 5b728fa
allows Link to accept a ref
TheSonOfThomp fd7cf26
Create tidy-lemons-drop.md
TheSonOfThomp 55a468c
Merge branch 'select-forward-ref' into adam/date-picker-lg-3152
TheSonOfThomp cdfb7c7
Merge branch 'link-ref' into adam/date-picker-lg-3152
TheSonOfThomp ee42cd4
updates ref to month select
TheSonOfThomp 4be9c16
updates single date picker tab behavior
TheSonOfThomp e5ec508
adds cell hover range interaction
TheSonOfThomp 2b3716b
updates calendar cell styles
TheSonOfThomp 4774a5a
mv funcs to utils
TheSonOfThomp 8b4d819
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp 3e45e3c
cleanup & add isDefined util
TheSonOfThomp 0a0ac5b
adds range-value setting logic
TheSonOfThomp 3f4e42d
adds arrow key functionality
TheSonOfThomp 9557a9b
adds chevron click functionality
TheSonOfThomp 9c05c0a
add size to FormField (#2029)
shaneeza 7a7a786
run .focus on next animation frame
TheSonOfThomp 1fd5a00
update default calendar
TheSonOfThomp 436e506
on apply, cancel clear
TheSonOfThomp 356c0a9
adds close menu tests
TheSonOfThomp 287add0
adds validation story
TheSonOfThomp cbe9114
adds calendar button click tests
TheSonOfThomp a426723
Update DateRangeMenuCalendars.types.ts
TheSonOfThomp aa363d6
corrects initial highlight when value = null array
TheSonOfThomp 266cb38
fix isEqual import
shaneeza b543241
LG-3677: Date Picker date selection on enter/space (#2015)
shaneeza a564ce0
update dark mode calendar cell hover color
shaneeza 8c0b8d8
add a check for tab presses inside handleCalendarKeyDown
shaneeza 0caaa36
use data-testid instead of data-lg
TheSonOfThomp 57be86d
Speeds up tab tests
TheSonOfThomp 3699810
Merge branch 'adam/date-picker-lg-3152' of https://github.com/mongodb…
TheSonOfThomp 5f39eac
fixes some tests
TheSonOfThomp f53b4b9
LG-3696: dp menu toggle (#2032)
shaneeza d551f8e
remove pointer-events none from disabled calendar cell
shaneeza 1abb26b
rearchitect range picker with context
TheSonOfThomp f2be624
fixes build
TheSonOfThomp b4fc35c
adds handlevalidation to context
TheSonOfThomp defa9e1
moves min/max date to global constants
TheSonOfThomp 5bdba83
adds quick range tests
TheSonOfThomp 3f7ef2b
implements quick range buttons
TheSonOfThomp 26803d3
completes todo test
TheSonOfThomp 119660a
Adds missing tests
TheSonOfThomp fe09c75
Update DateRangeMenu.spec.tsx
TheSonOfThomp 0874f3d
fix build
TheSonOfThomp 1e8744e
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp 4d49add
DatePicker prepare exports (#2051)
TheSonOfThomp 28d16cc
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp f1e2076
Adam/date picker/input auto focus (#2057)
TheSonOfThomp 0c323bd
Update getRelativeSegment.spec.tsx
TheSonOfThomp 9d47c70
LG-3699, LG-3723: DP keyboard interactions [WIP] (#2052)
shaneeza d9a44c9
Update types.ts
TheSonOfThomp 93ccc0f
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp c33b8d1
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp 9a5ee13
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp 6c88db4
DatePicker: Highlight, tab & focus (#2063)
TheSonOfThomp fe93b87
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp 4c810e2
Fire transitionEnd in Tab tests
TheSonOfThomp d371e7e
update how we test month change highlight
TheSonOfThomp 871c259
ts fix
TheSonOfThomp dafb470
LG-3740, LG-3741: DP initialOpen + disabled (#2069)
shaneeza fc5a4b2
DatePicker [LG-3748]: Restricts month menu options (#2070)
TheSonOfThomp cf2d33e
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp 561df1a
DatePicker [LG-3758, LG-3760, LG-3764, LG-3765] Menu year/month selec…
TheSonOfThomp 4fd2f06
Date Picker [LG-3792] adds tests (#2085)
shaneeza 1a9e170
Date Picker [LG-3756, LG-3771, LG-3774, LG-3768] Arrow keys in Date I…
TheSonOfThomp 978def3
Updates logic for setting focus when menu opens (#2086)
TheSonOfThomp 92401d9
Update DatePicker.spec.tsx
TheSonOfThomp 7592b63
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp 717d243
add modal test
shaneeza 1a131b4
add maxLength (#2088)
shaneeza 5f7e1d3
Date Picker [LG-3773]: Daylight time cell focus (#2087)
TheSonOfThomp f29b854
Date Picker [LG-3767] Modal bugs (#2091)
shaneeza d821334
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp 83798c1
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp 7719526
Date Picker: React 17 [LG-3788] (#2094)
TheSonOfThomp 6599ea4
Date Picker [LG -3806, LG-3808] Consume LeafyGreenProvider (#2096)
shaneeza b905ac8
updates comments
TheSonOfThomp fc32072
update comments
TheSonOfThomp 9fe41b2
direct lodash import
TheSonOfThomp 7cf1b32
use today from context
TheSonOfThomp 2745012
prevent default on arrow keys (#2097)
TheSonOfThomp 4fe0498
Date Picker [LG-3809] multiple renders when disabled (#2098)
shaneeza 62f2960
remove focus from cal icon when disabled (#2100)
shaneeza 0161dc5
add tests (#2102)
shaneeza 4dfb5d3
DatePicker [LG-3805] menu out of range (#2103)
TheSonOfThomp e5e90a8
Date Picker [LG-3811] autocomplete (#2099)
shaneeza 1691394
update year select aria label
shaneeza eb89f55
Merge branch 'adam/date-picker-lg-3152' of github.com:mongodb/leafygr…
shaneeza 057aa0e
fix error icon placement
shaneeza bc8a62a
increase select width
shaneeza 0ef6cbd
Date picker [LG-3834] Internal error handling (#2105)
TheSonOfThomp ee0ffbe
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp 6807d66
fixes newDateFromSegments util
TheSonOfThomp 377db14
restores `state` to contextPropNames
TheSonOfThomp 33f1303
Date picker [LG-3847] Restrict year input auto-format (#2107)
TheSonOfThomp ec2b478
Date Picker [LG-3810] calendar cell focus (#2109)
shaneeza c6e0c28
Date picker [LG-3827] input segment responsive to min max (#2108)
TheSonOfThomp 78ad91c
Update DatePicker.spec.tsx (#2110)
TheSonOfThomp 546117f
Fix Chromatic failures (#2111)
TheSonOfThomp ed75e7c
Date Picker [LG-3826] Calendar month menu jump (#2112)
TheSonOfThomp 5dc8268
Date Picker [LG-3838] truncate selects (#2113)
shaneeza cbe91f9
increase z-index (#2116)
shaneeza d9426b8
Date Picker [LG-3829] space press (#2115)
shaneeza 3cc5d7e
Date picker [LG-3816, LG-3859] Timezone bugs (#2114)
TheSonOfThomp bc41ebb
Date picker [LG-3854] No impossible dates (#2117)
TheSonOfThomp bf772e7
Date Picker: move date segment types (#2118)
TheSonOfThomp e31001a
Date Picker [LG-3835]: Rename component > content (#2119)
TheSonOfThomp 0698414
rm deprecated utils
TheSonOfThomp e9aa1d2
Date picker [LG-3868] Month & weekday Internationalization (#2121)
TheSonOfThomp 787e9c8
mv main story
TheSonOfThomp aa511a7
Delete rollup.config.mjs
TheSonOfThomp 6aec3e2
remove getProviderPropsFromStoryArgs
TheSonOfThomp 436349a
Update DatePicker.stories.tsx
TheSonOfThomp 5467d9b
Date picker [LG-3873] rename locale prop (#2122)
TheSonOfThomp c6ad642
Date Picker [LG-3844] add propTypes (#2124)
shaneeza 4fed5f8
Date Picker [LG-3852] invalid chevron (#2123)
shaneeza 25cfd86
Date picker [LG-3860, LG-3856] min/max bugs (#2125)
TheSonOfThomp 8ea3c0d
Delete DateFormField.spec.tsx
TheSonOfThomp b08a5c4
Create eighty-kings-mix.md
TheSonOfThomp 7001dff
DatePicker: DateUtils (#2126)
TheSonOfThomp 128345f
Date Picker [LG-3887] fix page scroll (#2129)
shaneeza cf1ff45
Date picker timezone tests (#2134)
TheSonOfThomp 5dbcb49
Date picker: DateUtils: Testing (#2133)
TheSonOfThomp 2e2f924
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp c4d1b75
lint
TheSonOfThomp 6b53d1e
Adam/date picker shared context (#2136)
TheSonOfThomp 76ffbf3
Date Picker [LG-3886] aria labels (#2135)
shaneeza 63fcf61
Date picker [LG-3888, LG-3890] timezone prop today (#2132)
TheSonOfThomp c9f7c74
Date picker [LG-3894] Local date strings (#2137)
TheSonOfThomp 848a631
Date picker [LG-3864] year input rollover (#2138)
TheSonOfThomp 2414e5e
Date picker [LG-3895] Segment input restriction (#2140)
TheSonOfThomp 3106d48
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp 95af767
Date Picker chromatic fixes (#2141)
shaneeza ab16f9e
Date Picker [LG-3897] backspace (#2143)
shaneeza 9335ada
Date picker: restructure ixn tests (#2142)
TheSonOfThomp 363a15d
DatePicker [LG-3899] arrow key errors (#2145)
TheSonOfThomp 8ad3063
Date Picker [LG-3899] arrow key errors (#2144)
TheSonOfThomp e7f6652
Date picker [LG-3912] Test for invalid dates (#2146)
TheSonOfThomp 09ae215
move menu position (#2157)
shaneeza c17a9aa
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp dc270c6
creates newTZDate
TheSonOfThomp f5f315f
updates isSameUTCDay & isSameUTCMonth tests
TheSonOfThomp a117c9b
moves special rollover logic to getMaxSegmentValue
TheSonOfThomp 4d00142
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp 429fcaa
add readme (#2164)
shaneeza d548aca
update README
shaneeza b36e616
Date Picker x React 17 (#2163)
TheSonOfThomp eb15c8a
Merge branch 'main' into adam/date-picker-lg-3152
TheSonOfThomp a24d14a
fix label in README
shaneeza 87f1260
Date picker [LG-3911] Responding to `null` and `"Invalid Date"` value…
TheSonOfThomp 19e601f
fix DateInputChangeEventHandler import
TheSonOfThomp 28a733c
updates changeset version
TheSonOfThomp ae4b58d
Update package.json
TheSonOfThomp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@lg-tools/meta': minor | ||
--- | ||
|
||
- Adds `exitWithErrorMessage` util | ||
- Fixes recursion in `findPackageJson` |
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/date-picker': minor | ||
--- | ||
|
||
Initial pre-release of `date-picker`. Use DatePicker to allow users to input a date |
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 @@ | ||
--- | ||
'@lg-tools/test': minor | ||
--- | ||
|
||
Adds coverage reporting for untested sub-modules |
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,8 @@ | ||
--- | ||
'@leafygreen-ui/select': patch | ||
--- | ||
|
||
- Passes `onEnter*` and `onExit*` props to internal `Popover` component | ||
- Adds tests to test `onEnter*` and `onExit*` callbacks | ||
- Adds tests to test `PopoverContext` | ||
|
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 @@ | ||
--- | ||
'@lg-tools/test': minor | ||
--- | ||
|
||
Updates to jest 29 for React 17 testing |
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/lib': minor | ||
--- | ||
|
||
Updates Typescript signature of `createSyntheticEvent` |
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 @@ | ||
--- | ||
'@lg-tools/storybook-decorators': patch | ||
--- | ||
|
||
Adds Null check for args |
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,9 @@ | ||
--- | ||
'@leafygreen-ui/lib': minor | ||
--- | ||
- Creates new utility functions | ||
- `rollover` | ||
- `truncateStart` | ||
- `cloneReverse` | ||
- `isDefined` | ||
- `isZeroLike` & `isNotZeroLike` |
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/form-field': patch | ||
--- | ||
|
||
Updates disabled icon colors |
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-option': minor | ||
--- | ||
|
||
Renders `aria-disabled` attribute when `disabled` is provided |
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/popover': patch | ||
--- | ||
|
||
Exports `ChildrenFunctionParameters` type |
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/form-field': minor | ||
--- | ||
|
||
Adds `data-testid` to Label, Description & Error elements |
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/date-utils': minor | ||
--- | ||
|
||
Initial pre-release of `date-utils`. DateUtils contains utility functions for managing and manipulating JS Date objects |
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,8 @@ | ||
--- | ||
'@leafygreen-ui/hooks': minor | ||
--- | ||
|
||
- Extends `useControlledValue` to accept any type. | ||
- Adds `updateValue` function in return value. This method triggers a synthetic event to update the value of a controlled or uncontrolled component. | ||
- Adds `initialValue` argument. Used for setting the initial value for uncontrolled components. Without this we may encounter a React error for switching between controlled/uncontrolled inputs | ||
- The value of `isControlled` is now immutable after the first render |
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 @@ | ||
--- | ||
'@lg-tools/validate': patch | ||
--- | ||
|
||
Updates dev file pattern to include entire `testutils/` directories |
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/a11y': patch | ||
--- | ||
|
||
Update `AriaLabelProps` `label` type from `string` to `ReactNode` |
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/lib': patch | ||
--- | ||
|
||
Updates `target` type in `createSyntheticEvent` to extend `EventTarget` |
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/typography': minor | ||
--- | ||
|
||
Allows `Link` component to accept a ref |
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,100 @@ | ||
# Date Picker | ||
|
||
 | ||
|
||
#### [View on MongoDB.design](https://www.mongodb.design/component/date-picker/example/) | ||
|
||
## Installation | ||
|
||
### Yarn | ||
|
||
```shell | ||
yarn add @leafygreen-ui/date-picker | ||
``` | ||
|
||
### NPM | ||
|
||
```shell | ||
npm install @leafygreen-ui/date-picker | ||
``` | ||
|
||
## Example | ||
|
||
```js | ||
import { DatePicker } from '@leafygreen-ui/date-picker'; | ||
|
||
const [date, setDate] = useState<Date>(); | ||
|
||
<DatePicker | ||
label="Pick a date" | ||
value={date} | ||
max={new Date("2026-12-26")} | ||
onDateChange={setDate} | ||
locale="iso8601" | ||
timeZone="utc" | ||
/>; | ||
``` | ||
|
||
## Properties | ||
|
||
| Prop | Type | Description | Default | | ||
| ------------------ | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | | ||
| `label` | `ReactNode` | Label shown above the date picker. | | | ||
| `description` | `ReactNode` | A description for the date picker. It's recommended to set a meaningful time zone representation as the description. (e.g. "Coordinated Universal Time") | | | ||
| `locale` | `'iso8601'`\| `'string'` | Sets the _presentation format_ for the displayed date, and localizes month & weekday labels. Defaults to the user’s browser preference (if available), otherwise ISO-8601. | `iso8601` | | ||
| `timeZone` | `string` | A valid IANA timezone string, or UTC offset, used to calculate initial values. Defaults to the user’s browser settings. | | ||
| `min` | `Date` | The earliest date accepted, in UTC | | | ||
| `max` | `Date` | The latest date accepted, in UTC | | | ||
| `value` | `'Date'` \| `'InvalidDate'` \| `'null'` | The selected date. Note that this Date object will be read as UTC time. Providing `Date.now()` could result in the incorrect date being displayed, depending on the system time zone. <br><br> To set `value` to today, regardless of timeZone, use `setToUTCMidnight(new Date(Date.now()))`. <br><br> e.g. `2023-12-31` at 20:00 in Los Angeles, will be `2024-01-01` at 04:00 in UTC. To set the correct day (`2023-12-31`) as the DatePicker value we must first convert our local timestamp to `2023-12-31` at midnight | | | ||
| `onDateChange` | `(value?: Date \| InvalidDate \| null) => void` | Callback fired when the user makes a value change. Fired on click of a new date in the menu, or on keydown if the input contains a valid date. <br><br> _Not_ fired when a date segment changes, but does not create a full date <br><br> Callback date argument will be a Date object in UTC time, or `null` | | | ||
| `initialValue` | `'Date'` \| `'InvalidDate'` \| `'null'` | The initial selected date. Ignored if `value` is provided <br><br> Note that this Date object will be read as UTC time. See `value` prop documentation for more details | | | ||
| `handleValidation` | `(value?: Date \| InvalidDate \| null) => void` | A callback fired when validation should run, based on [form validation guidelines](https://www.mongodb.design/foundation/forms/#form-validation-error-handling). Use this callback to compute the correct `state` and `errorMessage` value.<br> <br> Callback date argument will be a Date object in UTC time, or `null` | | | ||
| `onChange` | `(event: ChangeEvent<HTMLInputElement>) => void` | Callback fired when any segment changes, (but not necessarily a full value) | | | ||
| `baseFontSize` | `'13'` \| `'16'` | The base font size of the input. Inherits from the nearest LeafyGreenProvider | | | ||
| `disabled` | `boolean` | Whether the input is disabled. _Note_: will not set the `disabled` attribute on an input and the calendar menu will not open if disabled is set to true. | `false` | | ||
| `size` | `'small'` \| `'xsmall'` \| `'default'` \| `'large'` | Whether the input is disabled. Note: will not set the `disabled` attribute on an input and the calendar menu will not open if disabled is set to true. | `default` | | ||
| `state` | `'none'` \| `'error'` | Whether to show an error message | `none` | | ||
| `errorMessage` | `string` | A message to show in red underneath the input when state is `Error` | | | ||
| `initialOpen` | `boolean` | Whether the calendar menu is initially open. _Note_: The calendar menu will not open if disabled is set to `true`. | `false` | | ||
| `autoComplete` | `'off'` \| `'on'` \| `'bday'` | Whether the input should autofill | `off` | | ||
| `darkMode` | `boolean` | Render the component in dark mode. | `false` | | ||
|
||
## 🔎 Glossary | ||
|
||
### Date format | ||
|
||
The pattern in which a string stores date (& time) information. E.g. `“YYYY-DD-MM”`, `“MM/DD/YYYY”`, `“YYYY-MM-DDTHH:mm:ss.sssZ”` | ||
|
||
### Wire format (or Data format) | ||
|
||
The format of the date string passed into the component. This will typically be [ISO-8601](https://www.iso.org/iso-8601-date-and-time-format.html), but could be any format accepted by the [Date constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date). | ||
|
||
### Presentation format | ||
|
||
The format in which the date is presented to the user. By default, the HTML date input element presents this in the format of the user’s Locale (as defined in browser or OS settings). | ||
|
||
### Locale | ||
|
||
Language, script, & region information. Can also include [other data](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale). | ||
|
||
### Time Zone | ||
|
||
A string representing a user’s local time zone (e.g. “America/New_York”) or UTC offset. Valid time zones are defined by IANA, and [listed on Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). A UTC offset can be [provided in a DateTime string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format). | ||
|
||
### UTC offset | ||
|
||
The offset of a time zone vs UTC. E.g. The UTC offset for `“America/New_York”` is -5:00, (or -4:00 depending on daylight savings). | ||
|
||
### Wire time zone (or Data time zone) | ||
|
||
The time zone information contained in the date string/object passed into the component. | ||
|
||
### Presentation time zone | ||
|
||
The time zone relative to which we present date information to the user. Can result in a different day than the wire time zone. E.g. `“2023-08-08T00:00:00Z”` (Aug. 8/2023 at midnight UTC) => `“2023-08-07T20:00:00-04:00”` (Aug. 7 at 8pm EDT) | ||
|
||
## Special Case | ||
|
||
### Aria Labels | ||
|
||
Either `label` or `aria-labelledby` or `aria-label` must be provided, or there will be a console error. This is to ensure that screenreaders have a description for what the DatePicker does. |
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.
Uh oh!
There was an error while loading. Please reload this page.