-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: wip datepicker * chore: wip style fixes * feat: wip added datepicker * chore: focus on current date on datepicker toggle * chore: minor refactors * fix: datepicker disclosure focus restore not working * refactor: refactored duplicate calendar component * feat: added Tab behaviour in datepicker spinbuttons composite * fix: ensure tabIndex 0 * feat: alt arrowdown to open dropdown * refactor: reorganized & refactored code * fix: datepicker on open focus on selected date * chore: fixed calendar types & dateSegment composite spread * feat: datepicker v3 (#70) * refactor(datepicker): ♻️ organize imports and improve code flow * feat(datepicker): ✨ add controllable date picker * refactor(date-picker): ♻️ bring popover close focus back * fix(date-picker): 🐛 fix focus spin button on focus * fix(date-picker): 🐛 fix outside click moving focus to button * refactor(date-picker): ♻️ arrange imports * refactor(date-picker): 🏷️ update types for Date Segment * fix(date-picker): 🐛 fix focus movements * fix(date-picker): 🐛 fix focus & date values * fix: calendar day value lag & few css improvements Co-authored-by: Anurag <hazru.anurag@gmail.com> * fix: range calendar start date iso timing lag * chore: datepicker stories improvements (#72) * refactor(date-picker): ♻️ added more stories * refactor(date-picker): ♻️ add disabled styles * feat: added segment component (#71) * feat: added Segment component * refactor: review updates & segment aria label fix * chore: event listener rename * feat: added Segment component to DatePicker * fix: datepicker propagation * refactor: unified DateValue type import & removed extra composite in DatePickerState * chore: fieldvalue fix * chore: removed DOMProps * test: css ignore tests Co-authored-by: Navin Moorthy <navin007.a@gmail.com>
- Loading branch information
1 parent
4dc06ef
commit 2698ddf
Showing
29 changed files
with
1,823 additions
and
131 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {}; |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import React from "react"; | ||
|
||
import "./index.css"; | ||
import { | ||
Calendar as CalendarWrapper, | ||
CalendarButton, | ||
CalendarCell, | ||
CalendarCellButton, | ||
CalendarGrid, | ||
CalendarHeader, | ||
CalendarWeekTitle, | ||
CalendarStateInitialProps, | ||
useCalendarState, | ||
} from "../index"; | ||
import { CalendarStateReturn } from "../CalendarState"; | ||
|
||
export const CalendarComp: React.FC<CalendarStateReturn> = state => { | ||
return ( | ||
<CalendarWrapper {...state} className="calendar"> | ||
<div className="header"> | ||
<CalendarButton {...state} goto="previousYear" className="prev-year"> | ||
<svg | ||
fill="none" | ||
stroke="currentColor" | ||
viewBox="0 0 24 24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
strokeWidth="2" | ||
d="M11 19l-7-7 7-7m8 14l-7-7 7-7" | ||
></path> | ||
</svg> | ||
</CalendarButton> | ||
<CalendarButton {...state} goto="previousMonth" className="prev-month"> | ||
<svg | ||
fill="none" | ||
stroke="currentColor" | ||
viewBox="0 0 24 24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
strokeWidth="2" | ||
d="M15 19l-7-7 7-7" | ||
></path> | ||
</svg> | ||
</CalendarButton> | ||
<CalendarHeader {...state} /> | ||
<CalendarButton {...state} goto="nextMonth" className="next-month"> | ||
<svg | ||
fill="none" | ||
stroke="currentColor" | ||
viewBox="0 0 24 24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
strokeWidth="2" | ||
d="M9 5l7 7-7 7" | ||
></path> | ||
</svg> | ||
</CalendarButton> | ||
<CalendarButton {...state} goto="nextYear" className="next-year"> | ||
<svg | ||
fill="none" | ||
stroke="currentColor" | ||
viewBox="0 0 24 24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
strokeWidth="2" | ||
d="M13 5l7 7-7 7M5 5l7 7-7 7" | ||
></path> | ||
</svg> | ||
</CalendarButton> | ||
</div> | ||
|
||
<CalendarGrid {...state} as="table" className="dates"> | ||
<thead> | ||
<tr> | ||
{state.weekDays.map((day, dayIndex) => { | ||
return ( | ||
<CalendarWeekTitle | ||
{...state} | ||
as="th" | ||
scope="col" | ||
key={dayIndex} | ||
dayIndex={dayIndex} | ||
> | ||
<abbr title={day.title}>{day.abbr}</abbr> | ||
</CalendarWeekTitle> | ||
); | ||
})} | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{state.daysInMonth.map((week, weekIndex) => ( | ||
<tr key={weekIndex}> | ||
{week.map((day, dayIndex) => ( | ||
<CalendarCell {...state} as="td" key={dayIndex} date={day}> | ||
<CalendarCellButton {...state} date={day} /> | ||
</CalendarCell> | ||
))} | ||
</tr> | ||
))} | ||
</tbody> | ||
</CalendarGrid> | ||
</CalendarWrapper> | ||
); | ||
}; | ||
|
||
export const CalendarComponent: React.FC<CalendarStateInitialProps> = props => { | ||
const state = useCalendarState(props); | ||
|
||
return <CalendarComp {...state} />; | ||
}; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
.calendar { | ||
margin-top: 1em; | ||
max-width: 320px; | ||
position: relative; | ||
} | ||
|
Oops, something went wrong.