react-native-agenda-kit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +364 -0
- package/lib/commonjs/agenda/AgendaBackdrop.js +68 -0
- package/lib/commonjs/agenda/AgendaBackdrop.js.map +1 -0
- package/lib/commonjs/agenda/AgendaList.js +354 -0
- package/lib/commonjs/agenda/AgendaList.js.map +1 -0
- package/lib/commonjs/agenda/AgendaSlot.js +88 -0
- package/lib/commonjs/agenda/AgendaSlot.js.map +1 -0
- package/lib/commonjs/agenda/AgendaWindow.js +171 -0
- package/lib/commonjs/agenda/AgendaWindow.js.map +1 -0
- package/lib/commonjs/agenda/StickyHeaderOverlay.js +125 -0
- package/lib/commonjs/agenda/StickyHeaderOverlay.js.map +1 -0
- package/lib/commonjs/agenda/buildAgendaLayout.js +100 -0
- package/lib/commonjs/agenda/buildAgendaLayout.js.map +1 -0
- package/lib/commonjs/agenda/constants.js +29 -0
- package/lib/commonjs/agenda/constants.js.map +1 -0
- package/lib/commonjs/agenda/heights.js +49 -0
- package/lib/commonjs/agenda/heights.js.map +1 -0
- package/lib/commonjs/agenda/useAgendaScrollSync.js +204 -0
- package/lib/commonjs/agenda/useAgendaScrollSync.js.map +1 -0
- package/lib/commonjs/core/ArrowGlyph.js +65 -0
- package/lib/commonjs/core/ArrowGlyph.js.map +1 -0
- package/lib/commonjs/core/CalendarContext.js +32 -0
- package/lib/commonjs/core/CalendarContext.js.map +1 -0
- package/lib/commonjs/core/CalendarProvider.js +141 -0
- package/lib/commonjs/core/CalendarProvider.js.map +1 -0
- package/lib/commonjs/core/CalendarStore.js +70 -0
- package/lib/commonjs/core/CalendarStore.js.map +1 -0
- package/lib/commonjs/core/KitText.js +23 -0
- package/lib/commonjs/core/KitText.js.map +1 -0
- package/lib/commonjs/core/TodayButton.js +136 -0
- package/lib/commonjs/core/TodayButton.js.map +1 -0
- package/lib/commonjs/core/civil.js +101 -0
- package/lib/commonjs/core/civil.js.map +1 -0
- package/lib/commonjs/core/dateKey.js +56 -0
- package/lib/commonjs/core/dateKey.js.map +1 -0
- package/lib/commonjs/core/motion.js +56 -0
- package/lib/commonjs/core/motion.js.map +1 -0
- package/lib/commonjs/core/worklets.js +44 -0
- package/lib/commonjs/core/worklets.js.map +1 -0
- package/lib/commonjs/expandable/DayCell.js +120 -0
- package/lib/commonjs/expandable/DayCell.js.map +1 -0
- package/lib/commonjs/expandable/ExpandableCalendar.js +280 -0
- package/lib/commonjs/expandable/ExpandableCalendar.js.map +1 -0
- package/lib/commonjs/expandable/Knob.js +72 -0
- package/lib/commonjs/expandable/Knob.js.map +1 -0
- package/lib/commonjs/expandable/MonthPager.js +180 -0
- package/lib/commonjs/expandable/MonthPager.js.map +1 -0
- package/lib/commonjs/expandable/WeekStrip.js +451 -0
- package/lib/commonjs/expandable/WeekStrip.js.map +1 -0
- package/lib/commonjs/expandable/calendarCells.js +152 -0
- package/lib/commonjs/expandable/calendarCells.js.map +1 -0
- package/lib/commonjs/expandable/geometry.js +62 -0
- package/lib/commonjs/expandable/geometry.js.map +1 -0
- package/lib/commonjs/expandable/useExpandGesture.js +124 -0
- package/lib/commonjs/expandable/useExpandGesture.js.map +1 -0
- package/lib/commonjs/expandable/useHorizontalPager.js +97 -0
- package/lib/commonjs/expandable/useHorizontalPager.js.map +1 -0
- package/lib/commonjs/index.js +167 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/theme/ThemeProvider.js +73 -0
- package/lib/commonjs/theme/ThemeProvider.js.map +1 -0
- package/lib/commonjs/theme/index.js +75 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/theme/theme.js +79 -0
- package/lib/commonjs/theme/theme.js.map +1 -0
- package/lib/commonjs/theme/tokens.js +54 -0
- package/lib/commonjs/theme/tokens.js.map +1 -0
- package/lib/commonjs/timeline/DayColumn.js +95 -0
- package/lib/commonjs/timeline/DayColumn.js.map +1 -0
- package/lib/commonjs/timeline/DayPager.js +250 -0
- package/lib/commonjs/timeline/DayPager.js.map +1 -0
- package/lib/commonjs/timeline/EventBlock.js +91 -0
- package/lib/commonjs/timeline/EventBlock.js.map +1 -0
- package/lib/commonjs/timeline/GridLines.js +47 -0
- package/lib/commonjs/timeline/GridLines.js.map +1 -0
- package/lib/commonjs/timeline/HourGrid.js +96 -0
- package/lib/commonjs/timeline/HourGrid.js.map +1 -0
- package/lib/commonjs/timeline/NowIndicator.js +132 -0
- package/lib/commonjs/timeline/NowIndicator.js.map +1 -0
- package/lib/commonjs/timeline/TimelineDay.js +126 -0
- package/lib/commonjs/timeline/TimelineDay.js.map +1 -0
- package/lib/commonjs/timeline/packEvents.js +102 -0
- package/lib/commonjs/timeline/packEvents.js.map +1 -0
- package/lib/commonjs/timeline/timelineGeometry.js +27 -0
- package/lib/commonjs/timeline/timelineGeometry.js.map +1 -0
- package/lib/commonjs/timeline/timelineMath.js +82 -0
- package/lib/commonjs/timeline/timelineMath.js.map +1 -0
- package/lib/commonjs/types.js +71 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/agenda/AgendaBackdrop.js +63 -0
- package/lib/module/agenda/AgendaBackdrop.js.map +1 -0
- package/lib/module/agenda/AgendaList.js +349 -0
- package/lib/module/agenda/AgendaList.js.map +1 -0
- package/lib/module/agenda/AgendaSlot.js +84 -0
- package/lib/module/agenda/AgendaSlot.js.map +1 -0
- package/lib/module/agenda/AgendaWindow.js +167 -0
- package/lib/module/agenda/AgendaWindow.js.map +1 -0
- package/lib/module/agenda/StickyHeaderOverlay.js +120 -0
- package/lib/module/agenda/StickyHeaderOverlay.js.map +1 -0
- package/lib/module/agenda/buildAgendaLayout.js +95 -0
- package/lib/module/agenda/buildAgendaLayout.js.map +1 -0
- package/lib/module/agenda/constants.js +25 -0
- package/lib/module/agenda/constants.js.map +1 -0
- package/lib/module/agenda/heights.js +42 -0
- package/lib/module/agenda/heights.js.map +1 -0
- package/lib/module/agenda/useAgendaScrollSync.js +200 -0
- package/lib/module/agenda/useAgendaScrollSync.js.map +1 -0
- package/lib/module/core/ArrowGlyph.js +60 -0
- package/lib/module/core/ArrowGlyph.js.map +1 -0
- package/lib/module/core/CalendarContext.js +26 -0
- package/lib/module/core/CalendarContext.js.map +1 -0
- package/lib/module/core/CalendarProvider.js +136 -0
- package/lib/module/core/CalendarProvider.js.map +1 -0
- package/lib/module/core/CalendarStore.js +66 -0
- package/lib/module/core/CalendarStore.js.map +1 -0
- package/lib/module/core/KitText.js +19 -0
- package/lib/module/core/KitText.js.map +1 -0
- package/lib/module/core/TodayButton.js +133 -0
- package/lib/module/core/TodayButton.js.map +1 -0
- package/lib/module/core/civil.js +88 -0
- package/lib/module/core/civil.js.map +1 -0
- package/lib/module/core/dateKey.js +47 -0
- package/lib/module/core/dateKey.js.map +1 -0
- package/lib/module/core/motion.js +49 -0
- package/lib/module/core/motion.js.map +1 -0
- package/lib/module/core/worklets.js +38 -0
- package/lib/module/core/worklets.js.map +1 -0
- package/lib/module/expandable/DayCell.js +116 -0
- package/lib/module/expandable/DayCell.js.map +1 -0
- package/lib/module/expandable/ExpandableCalendar.js +275 -0
- package/lib/module/expandable/ExpandableCalendar.js.map +1 -0
- package/lib/module/expandable/Knob.js +67 -0
- package/lib/module/expandable/Knob.js.map +1 -0
- package/lib/module/expandable/MonthPager.js +175 -0
- package/lib/module/expandable/MonthPager.js.map +1 -0
- package/lib/module/expandable/WeekStrip.js +446 -0
- package/lib/module/expandable/WeekStrip.js.map +1 -0
- package/lib/module/expandable/calendarCells.js +142 -0
- package/lib/module/expandable/calendarCells.js.map +1 -0
- package/lib/module/expandable/geometry.js +58 -0
- package/lib/module/expandable/geometry.js.map +1 -0
- package/lib/module/expandable/useExpandGesture.js +118 -0
- package/lib/module/expandable/useExpandGesture.js.map +1 -0
- package/lib/module/expandable/useHorizontalPager.js +92 -0
- package/lib/module/expandable/useHorizontalPager.js.map +1 -0
- package/lib/module/index.js +35 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/theme/ThemeProvider.js +65 -0
- package/lib/module/theme/ThemeProvider.js.map +1 -0
- package/lib/module/theme/index.js +6 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/theme.js +74 -0
- package/lib/module/theme/theme.js.map +1 -0
- package/lib/module/theme/tokens.js +50 -0
- package/lib/module/theme/tokens.js.map +1 -0
- package/lib/module/timeline/DayColumn.js +91 -0
- package/lib/module/timeline/DayColumn.js.map +1 -0
- package/lib/module/timeline/DayPager.js +245 -0
- package/lib/module/timeline/DayPager.js.map +1 -0
- package/lib/module/timeline/EventBlock.js +87 -0
- package/lib/module/timeline/EventBlock.js.map +1 -0
- package/lib/module/timeline/GridLines.js +43 -0
- package/lib/module/timeline/GridLines.js.map +1 -0
- package/lib/module/timeline/HourGrid.js +94 -0
- package/lib/module/timeline/HourGrid.js.map +1 -0
- package/lib/module/timeline/NowIndicator.js +126 -0
- package/lib/module/timeline/NowIndicator.js.map +1 -0
- package/lib/module/timeline/TimelineDay.js +122 -0
- package/lib/module/timeline/TimelineDay.js.map +1 -0
- package/lib/module/timeline/packEvents.js +97 -0
- package/lib/module/timeline/packEvents.js.map +1 -0
- package/lib/module/timeline/timelineGeometry.js +22 -0
- package/lib/module/timeline/timelineGeometry.js.map +1 -0
- package/lib/module/timeline/timelineMath.js +75 -0
- package/lib/module/timeline/timelineMath.js.map +1 -0
- package/lib/module/types.js +67 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/commonjs/agenda/AgendaBackdrop.d.ts +20 -0
- package/lib/typescript/commonjs/agenda/AgendaBackdrop.d.ts.map +1 -0
- package/lib/typescript/commonjs/agenda/AgendaList.d.ts +12 -0
- package/lib/typescript/commonjs/agenda/AgendaList.d.ts.map +1 -0
- package/lib/typescript/commonjs/agenda/AgendaSlot.d.ts +45 -0
- package/lib/typescript/commonjs/agenda/AgendaSlot.d.ts.map +1 -0
- package/lib/typescript/commonjs/agenda/AgendaWindow.d.ts +49 -0
- package/lib/typescript/commonjs/agenda/AgendaWindow.d.ts.map +1 -0
- package/lib/typescript/commonjs/agenda/StickyHeaderOverlay.d.ts +39 -0
- package/lib/typescript/commonjs/agenda/StickyHeaderOverlay.d.ts.map +1 -0
- package/lib/typescript/commonjs/agenda/buildAgendaLayout.d.ts +57 -0
- package/lib/typescript/commonjs/agenda/buildAgendaLayout.d.ts.map +1 -0
- package/lib/typescript/commonjs/agenda/constants.d.ts +19 -0
- package/lib/typescript/commonjs/agenda/constants.d.ts.map +1 -0
- package/lib/typescript/commonjs/agenda/heights.d.ts +20 -0
- package/lib/typescript/commonjs/agenda/heights.d.ts.map +1 -0
- package/lib/typescript/commonjs/agenda/useAgendaScrollSync.d.ts +44 -0
- package/lib/typescript/commonjs/agenda/useAgendaScrollSync.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/ArrowGlyph.d.ts +14 -0
- package/lib/typescript/commonjs/core/ArrowGlyph.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/CalendarContext.d.ts +35 -0
- package/lib/typescript/commonjs/core/CalendarContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/CalendarProvider.d.ts +41 -0
- package/lib/typescript/commonjs/core/CalendarProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/CalendarStore.d.ts +28 -0
- package/lib/typescript/commonjs/core/CalendarStore.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/KitText.d.ts +10 -0
- package/lib/typescript/commonjs/core/KitText.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/TodayButton.d.ts +18 -0
- package/lib/typescript/commonjs/core/TodayButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/civil.d.ts +26 -0
- package/lib/typescript/commonjs/core/civil.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/dateKey.d.ts +21 -0
- package/lib/typescript/commonjs/core/dateKey.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/motion.d.ts +18 -0
- package/lib/typescript/commonjs/core/motion.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/worklets.d.ts +12 -0
- package/lib/typescript/commonjs/core/worklets.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/DayCell.d.ts +22 -0
- package/lib/typescript/commonjs/expandable/DayCell.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/ExpandableCalendar.d.ts +40 -0
- package/lib/typescript/commonjs/expandable/ExpandableCalendar.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/Knob.d.ts +19 -0
- package/lib/typescript/commonjs/expandable/Knob.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/MonthPager.d.ts +35 -0
- package/lib/typescript/commonjs/expandable/MonthPager.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/WeekStrip.d.ts +34 -0
- package/lib/typescript/commonjs/expandable/WeekStrip.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/calendarCells.d.ts +52 -0
- package/lib/typescript/commonjs/expandable/calendarCells.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/geometry.d.ts +43 -0
- package/lib/typescript/commonjs/expandable/geometry.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/useExpandGesture.d.ts +35 -0
- package/lib/typescript/commonjs/expandable/useExpandGesture.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/useHorizontalPager.d.ts +35 -0
- package/lib/typescript/commonjs/expandable/useHorizontalPager.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +26 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/theme/ThemeProvider.d.ts +27 -0
- package/lib/typescript/commonjs/theme/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/index.d.ts +4 -0
- package/lib/typescript/commonjs/theme/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/theme.d.ts +62 -0
- package/lib/typescript/commonjs/theme/theme.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/tokens.d.ts +46 -0
- package/lib/typescript/commonjs/theme/tokens.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/DayColumn.d.ts +32 -0
- package/lib/typescript/commonjs/timeline/DayColumn.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/DayPager.d.ts +32 -0
- package/lib/typescript/commonjs/timeline/DayPager.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/EventBlock.d.ts +17 -0
- package/lib/typescript/commonjs/timeline/EventBlock.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/GridLines.d.ts +5 -0
- package/lib/typescript/commonjs/timeline/GridLines.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/HourGrid.d.ts +12 -0
- package/lib/typescript/commonjs/timeline/HourGrid.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/NowIndicator.d.ts +28 -0
- package/lib/typescript/commonjs/timeline/NowIndicator.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/TimelineDay.d.ts +14 -0
- package/lib/typescript/commonjs/timeline/TimelineDay.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/packEvents.d.ts +25 -0
- package/lib/typescript/commonjs/timeline/packEvents.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/timelineGeometry.d.ts +14 -0
- package/lib/typescript/commonjs/timeline/timelineGeometry.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/timelineMath.d.ts +32 -0
- package/lib/typescript/commonjs/timeline/timelineMath.d.ts.map +1 -0
- package/lib/typescript/commonjs/types.d.ts +237 -0
- package/lib/typescript/commonjs/types.d.ts.map +1 -0
- package/lib/typescript/module/agenda/AgendaBackdrop.d.ts +20 -0
- package/lib/typescript/module/agenda/AgendaBackdrop.d.ts.map +1 -0
- package/lib/typescript/module/agenda/AgendaList.d.ts +12 -0
- package/lib/typescript/module/agenda/AgendaList.d.ts.map +1 -0
- package/lib/typescript/module/agenda/AgendaSlot.d.ts +45 -0
- package/lib/typescript/module/agenda/AgendaSlot.d.ts.map +1 -0
- package/lib/typescript/module/agenda/AgendaWindow.d.ts +49 -0
- package/lib/typescript/module/agenda/AgendaWindow.d.ts.map +1 -0
- package/lib/typescript/module/agenda/StickyHeaderOverlay.d.ts +39 -0
- package/lib/typescript/module/agenda/StickyHeaderOverlay.d.ts.map +1 -0
- package/lib/typescript/module/agenda/buildAgendaLayout.d.ts +57 -0
- package/lib/typescript/module/agenda/buildAgendaLayout.d.ts.map +1 -0
- package/lib/typescript/module/agenda/constants.d.ts +19 -0
- package/lib/typescript/module/agenda/constants.d.ts.map +1 -0
- package/lib/typescript/module/agenda/heights.d.ts +20 -0
- package/lib/typescript/module/agenda/heights.d.ts.map +1 -0
- package/lib/typescript/module/agenda/useAgendaScrollSync.d.ts +44 -0
- package/lib/typescript/module/agenda/useAgendaScrollSync.d.ts.map +1 -0
- package/lib/typescript/module/core/ArrowGlyph.d.ts +14 -0
- package/lib/typescript/module/core/ArrowGlyph.d.ts.map +1 -0
- package/lib/typescript/module/core/CalendarContext.d.ts +35 -0
- package/lib/typescript/module/core/CalendarContext.d.ts.map +1 -0
- package/lib/typescript/module/core/CalendarProvider.d.ts +41 -0
- package/lib/typescript/module/core/CalendarProvider.d.ts.map +1 -0
- package/lib/typescript/module/core/CalendarStore.d.ts +28 -0
- package/lib/typescript/module/core/CalendarStore.d.ts.map +1 -0
- package/lib/typescript/module/core/KitText.d.ts +10 -0
- package/lib/typescript/module/core/KitText.d.ts.map +1 -0
- package/lib/typescript/module/core/TodayButton.d.ts +18 -0
- package/lib/typescript/module/core/TodayButton.d.ts.map +1 -0
- package/lib/typescript/module/core/civil.d.ts +26 -0
- package/lib/typescript/module/core/civil.d.ts.map +1 -0
- package/lib/typescript/module/core/dateKey.d.ts +21 -0
- package/lib/typescript/module/core/dateKey.d.ts.map +1 -0
- package/lib/typescript/module/core/motion.d.ts +18 -0
- package/lib/typescript/module/core/motion.d.ts.map +1 -0
- package/lib/typescript/module/core/worklets.d.ts +12 -0
- package/lib/typescript/module/core/worklets.d.ts.map +1 -0
- package/lib/typescript/module/expandable/DayCell.d.ts +22 -0
- package/lib/typescript/module/expandable/DayCell.d.ts.map +1 -0
- package/lib/typescript/module/expandable/ExpandableCalendar.d.ts +40 -0
- package/lib/typescript/module/expandable/ExpandableCalendar.d.ts.map +1 -0
- package/lib/typescript/module/expandable/Knob.d.ts +19 -0
- package/lib/typescript/module/expandable/Knob.d.ts.map +1 -0
- package/lib/typescript/module/expandable/MonthPager.d.ts +35 -0
- package/lib/typescript/module/expandable/MonthPager.d.ts.map +1 -0
- package/lib/typescript/module/expandable/WeekStrip.d.ts +34 -0
- package/lib/typescript/module/expandable/WeekStrip.d.ts.map +1 -0
- package/lib/typescript/module/expandable/calendarCells.d.ts +52 -0
- package/lib/typescript/module/expandable/calendarCells.d.ts.map +1 -0
- package/lib/typescript/module/expandable/geometry.d.ts +43 -0
- package/lib/typescript/module/expandable/geometry.d.ts.map +1 -0
- package/lib/typescript/module/expandable/useExpandGesture.d.ts +35 -0
- package/lib/typescript/module/expandable/useExpandGesture.d.ts.map +1 -0
- package/lib/typescript/module/expandable/useHorizontalPager.d.ts +35 -0
- package/lib/typescript/module/expandable/useHorizontalPager.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +26 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/theme/ThemeProvider.d.ts +27 -0
- package/lib/typescript/module/theme/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/module/theme/index.d.ts +4 -0
- package/lib/typescript/module/theme/index.d.ts.map +1 -0
- package/lib/typescript/module/theme/theme.d.ts +62 -0
- package/lib/typescript/module/theme/theme.d.ts.map +1 -0
- package/lib/typescript/module/theme/tokens.d.ts +46 -0
- package/lib/typescript/module/theme/tokens.d.ts.map +1 -0
- package/lib/typescript/module/timeline/DayColumn.d.ts +32 -0
- package/lib/typescript/module/timeline/DayColumn.d.ts.map +1 -0
- package/lib/typescript/module/timeline/DayPager.d.ts +32 -0
- package/lib/typescript/module/timeline/DayPager.d.ts.map +1 -0
- package/lib/typescript/module/timeline/EventBlock.d.ts +17 -0
- package/lib/typescript/module/timeline/EventBlock.d.ts.map +1 -0
- package/lib/typescript/module/timeline/GridLines.d.ts +5 -0
- package/lib/typescript/module/timeline/GridLines.d.ts.map +1 -0
- package/lib/typescript/module/timeline/HourGrid.d.ts +12 -0
- package/lib/typescript/module/timeline/HourGrid.d.ts.map +1 -0
- package/lib/typescript/module/timeline/NowIndicator.d.ts +28 -0
- package/lib/typescript/module/timeline/NowIndicator.d.ts.map +1 -0
- package/lib/typescript/module/timeline/TimelineDay.d.ts +14 -0
- package/lib/typescript/module/timeline/TimelineDay.d.ts.map +1 -0
- package/lib/typescript/module/timeline/packEvents.d.ts +25 -0
- package/lib/typescript/module/timeline/packEvents.d.ts.map +1 -0
- package/lib/typescript/module/timeline/timelineGeometry.d.ts +14 -0
- package/lib/typescript/module/timeline/timelineGeometry.d.ts.map +1 -0
- package/lib/typescript/module/timeline/timelineMath.d.ts +32 -0
- package/lib/typescript/module/timeline/timelineMath.d.ts.map +1 -0
- package/lib/typescript/module/types.d.ts +237 -0
- package/lib/typescript/module/types.d.ts.map +1 -0
- package/package.json +105 -0
- package/src/agenda/AgendaBackdrop.tsx +55 -0
- package/src/agenda/AgendaList.tsx +370 -0
- package/src/agenda/AgendaSlot.tsx +88 -0
- package/src/agenda/AgendaWindow.tsx +183 -0
- package/src/agenda/StickyHeaderOverlay.tsx +126 -0
- package/src/agenda/buildAgendaLayout.ts +110 -0
- package/src/agenda/constants.ts +22 -0
- package/src/agenda/heights.ts +44 -0
- package/src/agenda/useAgendaScrollSync.ts +251 -0
- package/src/core/ArrowGlyph.tsx +53 -0
- package/src/core/CalendarContext.ts +47 -0
- package/src/core/CalendarProvider.tsx +165 -0
- package/src/core/CalendarStore.ts +64 -0
- package/src/core/KitText.tsx +10 -0
- package/src/core/TodayButton.tsx +121 -0
- package/src/core/civil.ts +92 -0
- package/src/core/dateKey.ts +52 -0
- package/src/core/motion.ts +51 -0
- package/src/core/worklets.ts +37 -0
- package/src/expandable/DayCell.tsx +97 -0
- package/src/expandable/ExpandableCalendar.tsx +278 -0
- package/src/expandable/Knob.tsx +67 -0
- package/src/expandable/MonthPager.tsx +208 -0
- package/src/expandable/WeekStrip.tsx +439 -0
- package/src/expandable/calendarCells.ts +155 -0
- package/src/expandable/geometry.ts +51 -0
- package/src/expandable/useExpandGesture.ts +147 -0
- package/src/expandable/useHorizontalPager.ts +116 -0
- package/src/index.ts +62 -0
- package/src/theme/ThemeProvider.tsx +85 -0
- package/src/theme/index.ts +18 -0
- package/src/theme/theme.ts +110 -0
- package/src/theme/tokens.ts +50 -0
- package/src/timeline/DayColumn.tsx +84 -0
- package/src/timeline/DayPager.tsx +295 -0
- package/src/timeline/EventBlock.tsx +76 -0
- package/src/timeline/GridLines.tsx +36 -0
- package/src/timeline/HourGrid.tsx +90 -0
- package/src/timeline/NowIndicator.tsx +123 -0
- package/src/timeline/TimelineDay.tsx +112 -0
- package/src/timeline/packEvents.ts +118 -0
- package/src/timeline/timelineGeometry.ts +23 -0
- package/src/timeline/timelineMath.ts +86 -0
- package/src/types.ts +252 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One day in the MONTH GRID. Selection arrives as a plain prop from the committed
|
|
5
|
+
* date, and `memo` on primitive props means a commit re-renders two cells, not the
|
|
6
|
+
* month. (The week strip tracks a fling frame by frame with one pill instead.)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { useKitStyles } from "../theme/index.js";
|
|
10
|
+
import { FONT_SIZE, RADIUS } from "../theme/tokens.js";
|
|
11
|
+
import { memo } from 'react';
|
|
12
|
+
import { Pressable, StyleSheet, View } from 'react-native';
|
|
13
|
+
import { KitText } from "../core/KitText.js";
|
|
14
|
+
import { DAY_CELL, DAY_LINE_HEIGHT, DAY_TEXT_MARGIN_TOP, DOT_MARGIN_TOP, DOT_SIZE } from "./geometry.js";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
const DayCellInner = ({
|
|
17
|
+
dayIndex,
|
|
18
|
+
label,
|
|
19
|
+
left,
|
|
20
|
+
top,
|
|
21
|
+
isToday,
|
|
22
|
+
isDisabled,
|
|
23
|
+
isSelected,
|
|
24
|
+
dot,
|
|
25
|
+
onPress,
|
|
26
|
+
accessibilityLabel
|
|
27
|
+
}) => {
|
|
28
|
+
const styles = useKitStyles(makeStyles);
|
|
29
|
+
const state = isSelected ? 3 : isDisabled ? 2 : isToday ? 1 : 0;
|
|
30
|
+
return /*#__PURE__*/_jsxs(Pressable, {
|
|
31
|
+
style: [styles.cell, {
|
|
32
|
+
left,
|
|
33
|
+
top
|
|
34
|
+
}, isSelected ? styles.cellSelected : null],
|
|
35
|
+
onPress: () => onPress(dayIndex),
|
|
36
|
+
disabled: isDisabled,
|
|
37
|
+
accessibilityRole: "button",
|
|
38
|
+
accessibilityLabel: accessibilityLabel,
|
|
39
|
+
accessibilityState: {
|
|
40
|
+
selected: isSelected,
|
|
41
|
+
disabled: isDisabled
|
|
42
|
+
},
|
|
43
|
+
children: [/*#__PURE__*/_jsx(KitText, {
|
|
44
|
+
style: styles.text[state],
|
|
45
|
+
children: label
|
|
46
|
+
}), dot !== null ? /*#__PURE__*/_jsx(View, {
|
|
47
|
+
style: [styles.dot, isSelected || !dot ? styles.dotFill[state] : {
|
|
48
|
+
backgroundColor: dot
|
|
49
|
+
}]
|
|
50
|
+
}) : null]
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
export const DayCell = /*#__PURE__*/memo(DayCellInner);
|
|
54
|
+
DayCell.displayName = 'DayCell';
|
|
55
|
+
|
|
56
|
+
/** `text` and `dotFill` are indexed by state: 0 plain, 1 today, 2 disabled, 3 selected. */
|
|
57
|
+
const makeStyles = ({
|
|
58
|
+
colors,
|
|
59
|
+
fonts
|
|
60
|
+
}) => {
|
|
61
|
+
const text = {
|
|
62
|
+
marginTop: DAY_TEXT_MARGIN_TOP,
|
|
63
|
+
fontFamily: fonts.regular,
|
|
64
|
+
fontSize: FONT_SIZE.sm,
|
|
65
|
+
lineHeight: DAY_LINE_HEIGHT
|
|
66
|
+
};
|
|
67
|
+
const s = StyleSheet.create({
|
|
68
|
+
cell: {
|
|
69
|
+
position: 'absolute',
|
|
70
|
+
width: DAY_CELL,
|
|
71
|
+
height: DAY_CELL,
|
|
72
|
+
borderRadius: RADIUS.full,
|
|
73
|
+
alignItems: 'center'
|
|
74
|
+
},
|
|
75
|
+
// The one accent use on the calendar — active selection: one accent, nowhere else.
|
|
76
|
+
cellSelected: {
|
|
77
|
+
backgroundColor: colors.accentFill
|
|
78
|
+
},
|
|
79
|
+
text: {
|
|
80
|
+
...text,
|
|
81
|
+
color: colors.text
|
|
82
|
+
},
|
|
83
|
+
textToday: {
|
|
84
|
+
...text,
|
|
85
|
+
color: colors.accent
|
|
86
|
+
},
|
|
87
|
+
textDisabled: {
|
|
88
|
+
...text,
|
|
89
|
+
color: colors.textMuted
|
|
90
|
+
},
|
|
91
|
+
textSelected: {
|
|
92
|
+
...text,
|
|
93
|
+
color: colors.onAccentFill
|
|
94
|
+
},
|
|
95
|
+
dot: {
|
|
96
|
+
width: DOT_SIZE,
|
|
97
|
+
height: DOT_SIZE,
|
|
98
|
+
marginTop: DOT_MARGIN_TOP,
|
|
99
|
+
borderRadius: RADIUS.full
|
|
100
|
+
},
|
|
101
|
+
dotDefault: {
|
|
102
|
+
backgroundColor: colors.accent
|
|
103
|
+
},
|
|
104
|
+
dotSelected: {
|
|
105
|
+
backgroundColor: colors.onAccentFill
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return {
|
|
109
|
+
cell: s.cell,
|
|
110
|
+
cellSelected: s.cellSelected,
|
|
111
|
+
dot: s.dot,
|
|
112
|
+
text: [s.text, s.textToday, s.textDisabled, s.textSelected],
|
|
113
|
+
dotFill: [s.dotDefault, s.dotDefault, s.dotDefault, s.dotSelected]
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=DayCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useKitStyles","FONT_SIZE","RADIUS","memo","Pressable","StyleSheet","View","KitText","DAY_CELL","DAY_LINE_HEIGHT","DAY_TEXT_MARGIN_TOP","DOT_MARGIN_TOP","DOT_SIZE","jsx","_jsx","jsxs","_jsxs","DayCellInner","dayIndex","label","left","top","isToday","isDisabled","isSelected","dot","onPress","accessibilityLabel","styles","makeStyles","state","style","cell","cellSelected","disabled","accessibilityRole","accessibilityState","selected","children","text","dotFill","backgroundColor","DayCell","displayName","colors","fonts","marginTop","fontFamily","regular","fontSize","sm","lineHeight","s","create","position","width","height","borderRadius","full","alignItems","accentFill","color","textToday","accent","textDisabled","textMuted","textSelected","onAccentFill","dotDefault","dotSelected"],"sourceRoot":"../../../src","sources":["expandable/DayCell.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,YAAY,QAA2B,mBAAU;AAC1D,SAASC,SAAS,EAAEC,MAAM,QAAQ,oBAAiB;AACnD,SAASC,IAAI,QAAQ,OAAO;AAC5B,SAASC,SAAS,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC1D,SAASC,OAAO,QAAQ,oBAAiB;AACzC,SAASC,QAAQ,EAAEC,eAAe,EAAEC,mBAAmB,EAAEC,cAAc,EAAEC,QAAQ,QAAQ,eAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAiBtG,MAAMC,YAAY,GAAGA,CAAC;EACpBC,QAAQ;EACRC,KAAK;EACLC,IAAI;EACJC,GAAG;EACHC,OAAO;EACPC,UAAU;EACVC,UAAU;EACVC,GAAG;EACHC,OAAO;EACPC;AACK,CAAC,KAAK;EACX,MAAMC,MAAM,GAAG5B,YAAY,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,YAAY,EAAEZ,CAAC,CAACc,YAAY,CAAC;IAC3D1B,OAAO,EAAE,CAACY,CAAC,CAACgB,UAAU,EAAEhB,CAAC,CAACgB,UAAU,EAAEhB,CAAC,CAACgB,UAAU,EAAEhB,CAAC,CAACiB,WAAW;EACnE,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The expandable calendar — week strip closed, month grid open — and the body it
|
|
5
|
+
* pushes down.
|
|
6
|
+
*
|
|
7
|
+
* Nothing animates height. `progress` (0 closed, 1 open) moves and every layer
|
|
8
|
+
* reads it as a transform or opacity: the month layer fades in and slides from
|
|
9
|
+
* "selected week on top" to its natural place, the strip fades out, and the knob
|
|
10
|
+
* and fixed-height body translate by `progress · travel`, where `travel` belongs
|
|
11
|
+
* to the VISIBLE month and re-targets when that changes while open.
|
|
12
|
+
*
|
|
13
|
+
* The body renders `children` because it must read `progress`. A list drag closes
|
|
14
|
+
* an open calendar: the grid shows the committed date, the list the day under it.
|
|
15
|
+
* With a screen reader the calendar is a static open month grid — TalkBack ignores
|
|
16
|
+
* opacity, would read strip and grid both, and cannot perform the pan.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { useKitStyles } from "../theme/index.js";
|
|
20
|
+
import { ANIMATION } from "../theme/tokens.js";
|
|
21
|
+
import { memo, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
22
|
+
import { Dimensions, StyleSheet, View } from 'react-native';
|
|
23
|
+
import { GestureDetector } from 'react-native-gesture-handler';
|
|
24
|
+
import Animated, { useAnimatedReaction, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
25
|
+
import { useCalendarContext, useCalendarDate } from "../core/CalendarContext.js";
|
|
26
|
+
import { clampIndex, dayIndexOf, ymdAt } from "../core/dateKey.js";
|
|
27
|
+
import { KIT_EASING, kitDuration, useScreenReaderEnabled } from "../core/motion.js";
|
|
28
|
+
import { clampNum } from "../core/worklets.js";
|
|
29
|
+
import { buildCalendarCells, buildDots, cellLefts, pageOfIndex } from "./calendarCells.js";
|
|
30
|
+
import { calendarHeights, KNOB_CONTAINER_HEIGHT, MAX_WEEKS, WEEK_ROW_HEIGHT } from "./geometry.js";
|
|
31
|
+
import { Knob } from "./Knob.js";
|
|
32
|
+
import { MonthPager } from "./MonthPager.js";
|
|
33
|
+
import { snap, useExpandGesture } from "./useExpandGesture.js";
|
|
34
|
+
import { WeekStrip } from "./WeekStrip.js";
|
|
35
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
36
|
+
const POSITIONS = {
|
|
37
|
+
CLOSED: 'closed',
|
|
38
|
+
OPEN: 'open'
|
|
39
|
+
};
|
|
40
|
+
const {
|
|
41
|
+
closed: CLOSED_H,
|
|
42
|
+
full: CALENDAR_H
|
|
43
|
+
} = calendarHeights(MAX_WEEKS);
|
|
44
|
+
/**
|
|
45
|
+
* Invisible, so the stale translateY is unseen; one object makes Reanimated skip the
|
|
46
|
+
* update. Opacity only: `updateProps` reassigns `transform` on the object it is given.
|
|
47
|
+
*/
|
|
48
|
+
const CLOSED_MONTH_STYLE = {
|
|
49
|
+
opacity: 0
|
|
50
|
+
};
|
|
51
|
+
const ExpandableCalendarInner = ({
|
|
52
|
+
initialPosition = 'closed',
|
|
53
|
+
onCalendarToggled,
|
|
54
|
+
style,
|
|
55
|
+
closeOnDayPress = true,
|
|
56
|
+
closeOnListScroll = true,
|
|
57
|
+
markedDates,
|
|
58
|
+
disablePan = false,
|
|
59
|
+
openThreshold,
|
|
60
|
+
closeThreshold,
|
|
61
|
+
knobAccessibilityLabel,
|
|
62
|
+
dayAccessibilityLabel,
|
|
63
|
+
monthShortLabels,
|
|
64
|
+
children,
|
|
65
|
+
ref
|
|
66
|
+
}) => {
|
|
67
|
+
const styles = useKitStyles(makeStyles);
|
|
68
|
+
const {
|
|
69
|
+
range,
|
|
70
|
+
store,
|
|
71
|
+
dateRef,
|
|
72
|
+
setDate,
|
|
73
|
+
reduceMotion
|
|
74
|
+
} = useCalendarContext();
|
|
75
|
+
const date = useCalendarDate();
|
|
76
|
+
const screenReader = useScreenReaderEnabled();
|
|
77
|
+
const {
|
|
78
|
+
dayIndex,
|
|
79
|
+
listDragSeq
|
|
80
|
+
} = store;
|
|
81
|
+
const [layout, setLayout] = useState(() => ({
|
|
82
|
+
width: Dimensions.get('window').width,
|
|
83
|
+
height: 0
|
|
84
|
+
}));
|
|
85
|
+
const [isOpen, setIsOpen] = useState(initialPosition === 'open');
|
|
86
|
+
const {
|
|
87
|
+
labels,
|
|
88
|
+
ordinalByIndex,
|
|
89
|
+
pages
|
|
90
|
+
} = useMemo(() => buildCalendarCells(range), [range]);
|
|
91
|
+
const dots = useMemo(() => buildDots(range, markedDates), [range, markedDates]);
|
|
92
|
+
const lefts = useMemo(() => cellLefts(layout.width), [layout.width]);
|
|
93
|
+
const a11yLabels = useMemo(() => screenReader && dayAccessibilityLabel ? range.ymdByIndex.map(ymd => dayAccessibilityLabel(ymd)) : undefined, [dayAccessibilityLabel, range, screenReader]);
|
|
94
|
+
const [initialPage] = useState(() => pageOfIndex(pages, clampIndex(range, dayIndexOf(range, dateRef.current))));
|
|
95
|
+
const progress = useSharedValue(initialPosition === 'open' ? 1 : 0);
|
|
96
|
+
const visiblePage = useSharedValue(initialPage);
|
|
97
|
+
const travel = useSharedValue(calendarHeights(pages.weeksByPage[initialPage] ?? 5).travel);
|
|
98
|
+
const pagesSV = useSharedValue(pages);
|
|
99
|
+
const writtenPages = useRef(pages);
|
|
100
|
+
useLayoutEffect(() => {
|
|
101
|
+
if (writtenPages.current === pages) return;
|
|
102
|
+
writtenPages.current = pages;
|
|
103
|
+
pagesSV.value = pages;
|
|
104
|
+
}, [pages, pagesSV]);
|
|
105
|
+
const retarget = kitDuration(ANIMATION.base, reduceMotion);
|
|
106
|
+
useAnimatedReaction(() => visiblePage.value, (page, prev) => {
|
|
107
|
+
if (prev === null || page === prev) return;
|
|
108
|
+
const next = calendarHeights(pagesSV.value.weeksByPage[page] ?? 5).travel;
|
|
109
|
+
// Open: glide the body to the new month's bottom edge. Closed: record it for the next open.
|
|
110
|
+
travel.value = progress.value > 0 ? withTiming(next, {
|
|
111
|
+
duration: retarget,
|
|
112
|
+
easing: KIT_EASING
|
|
113
|
+
}) : next;
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// Through a ref: the gesture's worklets capture `handleToggled`, so it never changes identity.
|
|
117
|
+
const onToggledRef = useRef(onCalendarToggled);
|
|
118
|
+
useLayoutEffect(() => {
|
|
119
|
+
onToggledRef.current = onCalendarToggled;
|
|
120
|
+
});
|
|
121
|
+
const handleToggled = useCallback(open => {
|
|
122
|
+
setIsOpen(open);
|
|
123
|
+
onToggledRef.current?.(open);
|
|
124
|
+
}, []);
|
|
125
|
+
const {
|
|
126
|
+
pan,
|
|
127
|
+
snapTo,
|
|
128
|
+
lastReported
|
|
129
|
+
} = useExpandGesture({
|
|
130
|
+
progress,
|
|
131
|
+
travel,
|
|
132
|
+
enabled: !disablePan && !screenReader,
|
|
133
|
+
openThreshold,
|
|
134
|
+
closeThreshold,
|
|
135
|
+
reduceMotion,
|
|
136
|
+
initialOpen: initialPosition === 'open',
|
|
137
|
+
onToggled: handleToggled
|
|
138
|
+
});
|
|
139
|
+
const toggle = useCallback(() => snapTo(), [snapTo]);
|
|
140
|
+
|
|
141
|
+
// Not foldable into the gesture's `initialOpen`/`enabled`: the flag resolves after
|
|
142
|
+
// mount, and `enabled` is also false for `disablePan`, which must not open.
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
if (screenReader) snapTo(1);
|
|
145
|
+
}, [screenReader, snapTo]);
|
|
146
|
+
useAnimatedReaction(() => listDragSeq.value, (seq, prev) => {
|
|
147
|
+
// Only a CHANGE of the counter is a drag; its first reading is the mount.
|
|
148
|
+
if (prev === null || seq === prev || !closeOnListScroll || screenReader) return;
|
|
149
|
+
if (progress.value > 0) snap(progress, lastReported, 0, reduceMotion, handleToggled);
|
|
150
|
+
});
|
|
151
|
+
useImperativeHandle(ref, () => ({
|
|
152
|
+
toggleCalendarPosition: screenReader ? () => true : toggle
|
|
153
|
+
}), [screenReader, toggle]);
|
|
154
|
+
const handleDayPress = useCallback(idx => {
|
|
155
|
+
if (clampIndex(range, idx) !== idx) return;
|
|
156
|
+
setDate(ymdAt(range, idx), 'dayPress');
|
|
157
|
+
// Same tick as the date: no race between the agenda's scroll and the collapse.
|
|
158
|
+
if (closeOnDayPress && !screenReader && progress.value > 0) snapTo(0);
|
|
159
|
+
}, [closeOnDayPress, progress, range, screenReader, setDate, snapTo]);
|
|
160
|
+
const monthStyle = useAnimatedStyle(() => {
|
|
161
|
+
const p = progress.value;
|
|
162
|
+
if (p === 0) return CLOSED_MONTH_STYLE;
|
|
163
|
+
const {
|
|
164
|
+
gridStartByPage,
|
|
165
|
+
weeksByPage
|
|
166
|
+
} = pagesSV.value;
|
|
167
|
+
const page = visiblePage.value;
|
|
168
|
+
const row = clampNum(Math.floor((dayIndex.value - (gridStartByPage[page] ?? 0)) / 7), 0, (weeksByPage[page] ?? MAX_WEEKS) - 1);
|
|
169
|
+
return {
|
|
170
|
+
opacity: p,
|
|
171
|
+
transform: [{
|
|
172
|
+
translateY: -(1 - p) * row * WEEK_ROW_HEIGHT
|
|
173
|
+
}]
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
const weekStyle = useAnimatedStyle(() => ({
|
|
177
|
+
opacity: 1 - progress.value
|
|
178
|
+
}));
|
|
179
|
+
const knobStyle = useAnimatedStyle(() => ({
|
|
180
|
+
transform: [{
|
|
181
|
+
translateY: CLOSED_H - KNOB_CONTAINER_HEIGHT + progress.value * travel.value
|
|
182
|
+
}]
|
|
183
|
+
}));
|
|
184
|
+
const bodyStyle = useAnimatedStyle(() => ({
|
|
185
|
+
transform: [{
|
|
186
|
+
translateY: progress.value * travel.value
|
|
187
|
+
}]
|
|
188
|
+
}));
|
|
189
|
+
const onLayout = useCallback(e => {
|
|
190
|
+
const {
|
|
191
|
+
width,
|
|
192
|
+
height
|
|
193
|
+
} = e.nativeEvent.layout;
|
|
194
|
+
setLayout(prev => Math.abs(prev.width - width) < 0.5 && Math.abs(prev.height - height) < 0.5 ? prev : {
|
|
195
|
+
width,
|
|
196
|
+
height
|
|
197
|
+
});
|
|
198
|
+
}, []);
|
|
199
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
200
|
+
style: [styles.region, style],
|
|
201
|
+
onLayout: onLayout,
|
|
202
|
+
children: [/*#__PURE__*/_jsx(GestureDetector, {
|
|
203
|
+
gesture: pan,
|
|
204
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
205
|
+
collapsable: false,
|
|
206
|
+
style: styles.calendar,
|
|
207
|
+
children: [/*#__PURE__*/_jsx(MonthPager, {
|
|
208
|
+
width: layout.width,
|
|
209
|
+
lefts: lefts,
|
|
210
|
+
pages: pages,
|
|
211
|
+
pagesSV: pagesSV,
|
|
212
|
+
labels: labels,
|
|
213
|
+
a11yLabels: a11yLabels,
|
|
214
|
+
dots: dots,
|
|
215
|
+
selectedIndex: dayIndexOf(range, date),
|
|
216
|
+
initialPage: initialPage,
|
|
217
|
+
visiblePage: visiblePage,
|
|
218
|
+
onDayPress: handleDayPress,
|
|
219
|
+
animatedStyle: monthStyle,
|
|
220
|
+
isOpen: isOpen,
|
|
221
|
+
screenReader: screenReader
|
|
222
|
+
}), screenReader ? null : /*#__PURE__*/_jsxs(_Fragment, {
|
|
223
|
+
children: [/*#__PURE__*/_jsx(WeekStrip, {
|
|
224
|
+
width: layout.width,
|
|
225
|
+
lefts: lefts,
|
|
226
|
+
labels: labels,
|
|
227
|
+
ordinals: ordinalByIndex,
|
|
228
|
+
monthShortLabels: monthShortLabels,
|
|
229
|
+
dots: dots,
|
|
230
|
+
onDayPress: handleDayPress,
|
|
231
|
+
animatedStyle: weekStyle,
|
|
232
|
+
interactive: !isOpen
|
|
233
|
+
}), /*#__PURE__*/_jsx(Knob, {
|
|
234
|
+
animatedStyle: knobStyle,
|
|
235
|
+
onPress: toggle,
|
|
236
|
+
accessibilityLabel: knobAccessibilityLabel
|
|
237
|
+
})]
|
|
238
|
+
})]
|
|
239
|
+
})
|
|
240
|
+
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
241
|
+
style: [styles.body, {
|
|
242
|
+
height: Math.max(0, layout.height - CLOSED_H)
|
|
243
|
+
}, bodyStyle],
|
|
244
|
+
children: children
|
|
245
|
+
})]
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
export const ExpandableCalendar = Object.assign(/*#__PURE__*/memo(ExpandableCalendarInner), {
|
|
249
|
+
positions: POSITIONS
|
|
250
|
+
});
|
|
251
|
+
const makeStyles = ({
|
|
252
|
+
colors
|
|
253
|
+
}) => StyleSheet.create({
|
|
254
|
+
region: {
|
|
255
|
+
flex: 1,
|
|
256
|
+
overflow: 'hidden',
|
|
257
|
+
backgroundColor: colors.surface
|
|
258
|
+
},
|
|
259
|
+
calendar: {
|
|
260
|
+
position: 'absolute',
|
|
261
|
+
top: 0,
|
|
262
|
+
left: 0,
|
|
263
|
+
right: 0,
|
|
264
|
+
height: CALENDAR_H,
|
|
265
|
+
backgroundColor: colors.surface
|
|
266
|
+
},
|
|
267
|
+
body: {
|
|
268
|
+
position: 'absolute',
|
|
269
|
+
top: CLOSED_H,
|
|
270
|
+
left: 0,
|
|
271
|
+
right: 0,
|
|
272
|
+
backgroundColor: colors.surface
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
//# sourceMappingURL=ExpandableCalendar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useKitStyles","ANIMATION","memo","useCallback","useEffect","useImperativeHandle","useLayoutEffect","useMemo","useRef","useState","Dimensions","StyleSheet","View","GestureDetector","Animated","useAnimatedReaction","useAnimatedStyle","useSharedValue","withTiming","useCalendarContext","useCalendarDate","clampIndex","dayIndexOf","ymdAt","KIT_EASING","kitDuration","useScreenReaderEnabled","clampNum","buildCalendarCells","buildDots","cellLefts","pageOfIndex","calendarHeights","KNOB_CONTAINER_HEIGHT","MAX_WEEKS","WEEK_ROW_HEIGHT","Knob","MonthPager","snap","useExpandGesture","WeekStrip","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","POSITIONS","CLOSED","OPEN","closed","CLOSED_H","full","CALENDAR_H","CLOSED_MONTH_STYLE","opacity","ExpandableCalendarInner","initialPosition","onCalendarToggled","style","closeOnDayPress","closeOnListScroll","markedDates","disablePan","openThreshold","closeThreshold","knobAccessibilityLabel","dayAccessibilityLabel","monthShortLabels","children","ref","styles","makeStyles","range","store","dateRef","setDate","reduceMotion","date","screenReader","dayIndex","listDragSeq","layout","setLayout","width","get","height","isOpen","setIsOpen","labels","ordinalByIndex","pages","dots","lefts","a11yLabels","ymdByIndex","map","ymd","undefined","initialPage","current","progress","visiblePage","travel","weeksByPage","pagesSV","writtenPages","value","retarget","base","page","prev","next","duration","easing","onToggledRef","handleToggled","open","pan","snapTo","lastReported","enabled","initialOpen","onToggled","toggle","seq","toggleCalendarPosition","handleDayPress","idx","monthStyle","p","gridStartByPage","row","Math","floor","transform","translateY","weekStyle","knobStyle","bodyStyle","onLayout","e","nativeEvent","abs","region","gesture","collapsable","calendar","selectedIndex","onDayPress","animatedStyle","ordinals","interactive","onPress","accessibilityLabel","body","max","ExpandableCalendar","Object","assign","positions","colors","create","flex","overflow","backgroundColor","surface","position","top","left","right"],"sourceRoot":"../../../src","sources":["expandable/ExpandableCalendar.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,YAAY,QAA2B,mBAAU;AAC1D,SAASC,SAAS,QAAQ,oBAAiB;AAC3C,SACEC,IAAI,EACJC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,eAAe,EACfC,OAAO,EACPC,MAAM,E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calendar (not just here) opens and closes — the band is the affordance, not
|
|
6
|
+
* the only hit area.
|
|
7
|
+
*
|
|
8
|
+
* A `Pressable`, not a `Gesture.Tap` raced against the pan. The tap belongs to
|
|
9
|
+
* the knob alone; racing a tap on the whole detector would make every day-cell
|
|
10
|
+
* tap also toggle the calendar.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { useKitStyles } from "../theme/index.js";
|
|
14
|
+
import { RADIUS } from "../theme/tokens.js";
|
|
15
|
+
import { memo } from 'react';
|
|
16
|
+
import { Pressable, StyleSheet, View } from 'react-native';
|
|
17
|
+
import Animated from 'react-native-reanimated';
|
|
18
|
+
import { KNOB_CONTAINER_HEIGHT, KNOB_HEIGHT, KNOB_WIDTH } from "./geometry.js";
|
|
19
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
const KnobInner = ({
|
|
21
|
+
animatedStyle,
|
|
22
|
+
onPress,
|
|
23
|
+
accessibilityLabel
|
|
24
|
+
}) => {
|
|
25
|
+
const styles = useKitStyles(makeStyles);
|
|
26
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
27
|
+
style: [styles.container, animatedStyle],
|
|
28
|
+
children: /*#__PURE__*/_jsx(Pressable, {
|
|
29
|
+
style: styles.hit,
|
|
30
|
+
onPress: onPress,
|
|
31
|
+
accessibilityRole: "button",
|
|
32
|
+
accessibilityLabel: accessibilityLabel,
|
|
33
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
34
|
+
style: styles.knob
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
export const Knob = /*#__PURE__*/memo(KnobInner);
|
|
40
|
+
Knob.displayName = 'Knob';
|
|
41
|
+
const makeStyles = ({
|
|
42
|
+
colors
|
|
43
|
+
}) => StyleSheet.create({
|
|
44
|
+
container: {
|
|
45
|
+
position: 'absolute',
|
|
46
|
+
top: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
right: 0,
|
|
49
|
+
height: KNOB_CONTAINER_HEIGHT,
|
|
50
|
+
backgroundColor: colors.surface
|
|
51
|
+
},
|
|
52
|
+
hit: {
|
|
53
|
+
flex: 1,
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
justifyContent: 'center'
|
|
56
|
+
},
|
|
57
|
+
knob: {
|
|
58
|
+
width: KNOB_WIDTH,
|
|
59
|
+
height: KNOB_HEIGHT,
|
|
60
|
+
// A pill is the one shape `full` exists for — the one shape `full` exists for.
|
|
61
|
+
borderRadius: RADIUS.full,
|
|
62
|
+
// The library's default `expandableKnobColor` is #e8ecf0 — a slate grey,
|
|
63
|
+
// which reads as a tinted surface. `border` is the nearest true-neutral.
|
|
64
|
+
backgroundColor: colors.border
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=Knob.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useKitStyles","RADIUS","memo","Pressable","StyleSheet","View","Animated","KNOB_CONTAINER_HEIGHT","KNOB_HEIGHT","KNOB_WIDTH","jsx","_jsx","KnobInner","animatedStyle","onPress","accessibilityLabel","styles","makeStyles","style","container","children","hit","accessibilityRole","knob","Knob","displayName","colors","create","position","top","left","right","height","backgroundColor","surface","flex","alignItems","justifyContent","width","borderRadius","full","border"],"sourceRoot":"../../../src","sources":["expandable/Knob.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,YAAY,QAA2B,mBAAU;AAC1D,SAASC,MAAM,QAAQ,oBAAiB;AACxC,SAASC,IAAI,QAAQ,OAAO;AAC5B,SAASC,SAAS,EAAEC,UAAU,EAAEC,IAAI,QAAwC,cAAc;AAC1F,OAAOC,QAAQ,MAA8B,yBAAyB;AACtE,SAASC,qBAAqB,EAAEC,WAAW,EAAEC,UAAU,QAAQ,eAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQ5E,MAAMC,SAAS,GAAGA,CAAC;EAAEC,aAAa;EAAE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**
|
|
4
|
+
* The open calendar: one month per page across the selectable window.
|
|
5
|
+
*
|
|
6
|
+
* Selection is the COMMITTED date as a plain prop, handed only to the page that
|
|
7
|
+
* holds it, so a commit re-renders at most two pages and two memo'd cells.
|
|
8
|
+
*
|
|
9
|
+
* Mounted pages derive from that same committed date. Closed, only its month
|
|
10
|
+
* exists: the layer is invisible, and every month crossing commits a date. Open,
|
|
11
|
+
* its two neighbours join so a swipe shows one; a swipe that lands commits the
|
|
12
|
+
* new month, which re-centres the window. A screen reader pages by scroll
|
|
13
|
+
* actions, so it gets every month. Moves page the pager instantly even while
|
|
14
|
+
* closed, so opening shows the right month.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { memo, useCallback } from 'react';
|
|
18
|
+
import { StyleSheet, View } from 'react-native';
|
|
19
|
+
import Animated from 'react-native-reanimated';
|
|
20
|
+
import { useCalendarContext } from "../core/CalendarContext.js";
|
|
21
|
+
import { clampIndex, ymdAt } from "../core/dateKey.js";
|
|
22
|
+
import { pageOfIndex } from "./calendarCells.js";
|
|
23
|
+
import { DayCell } from "./DayCell.js";
|
|
24
|
+
import { MAX_WEEKS, WEEK_ROW_HEIGHT, WEEK_ROW_V_MARGIN } from "./geometry.js";
|
|
25
|
+
import { PAGER_SCROLL_THROTTLE, useHorizontalPager } from "./useHorizontalPager.js";
|
|
26
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
|
+
const GRID_HEIGHT = MAX_WEEKS * WEEK_ROW_HEIGHT;
|
|
28
|
+
const MonthGrid = /*#__PURE__*/memo(({
|
|
29
|
+
page,
|
|
30
|
+
width,
|
|
31
|
+
lefts,
|
|
32
|
+
gridStart,
|
|
33
|
+
weeks,
|
|
34
|
+
rawPageByIndex,
|
|
35
|
+
labels,
|
|
36
|
+
a11yLabels,
|
|
37
|
+
dots,
|
|
38
|
+
selectedIndex,
|
|
39
|
+
todayIndex,
|
|
40
|
+
minIndex,
|
|
41
|
+
maxIndex,
|
|
42
|
+
onDayPress
|
|
43
|
+
}) => {
|
|
44
|
+
const cells = [];
|
|
45
|
+
for (let r = 0; r < weeks; r += 1) {
|
|
46
|
+
for (let c = 0; c < 7; c += 1) {
|
|
47
|
+
const i = gridStart + r * 7 + c;
|
|
48
|
+
// Days of the neighbouring months are blank, as the library's `hideExtraDays` draws them.
|
|
49
|
+
if (i < 0 || i >= labels.length || rawPageByIndex[i] !== page) continue;
|
|
50
|
+
cells.push(/*#__PURE__*/_jsx(DayCell, {
|
|
51
|
+
dayIndex: i,
|
|
52
|
+
label: labels[i],
|
|
53
|
+
accessibilityLabel: a11yLabels?.[i],
|
|
54
|
+
left: lefts[c],
|
|
55
|
+
top: r * WEEK_ROW_HEIGHT + WEEK_ROW_V_MARGIN,
|
|
56
|
+
isToday: i === todayIndex,
|
|
57
|
+
isDisabled: i < minIndex || i > maxIndex,
|
|
58
|
+
isSelected: i === selectedIndex,
|
|
59
|
+
dot: dots[i],
|
|
60
|
+
onPress: onDayPress
|
|
61
|
+
}, i));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return /*#__PURE__*/_jsx(View, {
|
|
65
|
+
style: [styles.grid, {
|
|
66
|
+
left: page * width,
|
|
67
|
+
width
|
|
68
|
+
}],
|
|
69
|
+
children: cells
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
MonthGrid.displayName = 'MonthGrid';
|
|
73
|
+
const MonthPagerInner = ({
|
|
74
|
+
width,
|
|
75
|
+
lefts,
|
|
76
|
+
pages,
|
|
77
|
+
pagesSV,
|
|
78
|
+
labels,
|
|
79
|
+
a11yLabels,
|
|
80
|
+
dots,
|
|
81
|
+
selectedIndex,
|
|
82
|
+
initialPage,
|
|
83
|
+
visiblePage,
|
|
84
|
+
onDayPress,
|
|
85
|
+
animatedStyle,
|
|
86
|
+
isOpen,
|
|
87
|
+
screenReader
|
|
88
|
+
}) => {
|
|
89
|
+
const {
|
|
90
|
+
range,
|
|
91
|
+
setDate
|
|
92
|
+
} = useCalendarContext();
|
|
93
|
+
|
|
94
|
+
/** A swipe landed on another month: select its first selectable day. */
|
|
95
|
+
const onMonthSettled = useCallback(page => {
|
|
96
|
+
setDate(ymdAt(range, clampIndex(range, pages.monthStartByPage[page])), 'pageScroll', 'month');
|
|
97
|
+
}, [pages, range, setDate]);
|
|
98
|
+
const pageOf = useCallback(idx => {
|
|
99
|
+
'worklet';
|
|
100
|
+
|
|
101
|
+
return pageOfIndex(pagesSV.value, idx);
|
|
102
|
+
}, [pagesSV]);
|
|
103
|
+
const pager = useHorizontalPager({
|
|
104
|
+
width,
|
|
105
|
+
initialPage,
|
|
106
|
+
origin: 'month',
|
|
107
|
+
pageOf,
|
|
108
|
+
page: visiblePage,
|
|
109
|
+
onSettled: onMonthSettled
|
|
110
|
+
});
|
|
111
|
+
const interactive = isOpen || screenReader;
|
|
112
|
+
const committed = pageOfIndex(pages, clampIndex(range, selectedIndex));
|
|
113
|
+
const reach = isOpen ? 1 : 0;
|
|
114
|
+
const first = screenReader ? 0 : Math.max(0, committed - reach);
|
|
115
|
+
const last = screenReader ? pages.count - 1 : Math.min(pages.count - 1, committed + reach);
|
|
116
|
+
const grids = [];
|
|
117
|
+
for (let p = first; p <= last; p += 1) {
|
|
118
|
+
grids.push(/*#__PURE__*/_jsx(MonthGrid, {
|
|
119
|
+
page: p,
|
|
120
|
+
width: width,
|
|
121
|
+
lefts: lefts,
|
|
122
|
+
gridStart: pages.gridStartByPage[p],
|
|
123
|
+
weeks: pages.weeksByPage[p],
|
|
124
|
+
rawPageByIndex: pages.rawPageByIndex,
|
|
125
|
+
labels: labels,
|
|
126
|
+
a11yLabels: a11yLabels,
|
|
127
|
+
dots: dots,
|
|
128
|
+
selectedIndex: pages.rawPageByIndex[selectedIndex] === p ? selectedIndex : -1,
|
|
129
|
+
todayIndex: range.todayIndex,
|
|
130
|
+
minIndex: range.minIndex,
|
|
131
|
+
maxIndex: range.maxIndex,
|
|
132
|
+
onDayPress: onDayPress
|
|
133
|
+
}, p));
|
|
134
|
+
}
|
|
135
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
136
|
+
pointerEvents: interactive ? 'auto' : 'none',
|
|
137
|
+
style: [styles.root, {
|
|
138
|
+
width
|
|
139
|
+
}, animatedStyle],
|
|
140
|
+
children: /*#__PURE__*/_jsx(Animated.ScrollView, {
|
|
141
|
+
ref: pager.ref,
|
|
142
|
+
horizontal: true,
|
|
143
|
+
pagingEnabled: true,
|
|
144
|
+
showsHorizontalScrollIndicator: false,
|
|
145
|
+
scrollEnabled: interactive,
|
|
146
|
+
onScroll: pager.onScroll,
|
|
147
|
+
scrollEventThrottle: PAGER_SCROLL_THROTTLE,
|
|
148
|
+
contentOffset: pager.contentOffset,
|
|
149
|
+
onLayout: pager.onLayout,
|
|
150
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
151
|
+
style: {
|
|
152
|
+
width: pages.count * width,
|
|
153
|
+
height: GRID_HEIGHT
|
|
154
|
+
},
|
|
155
|
+
children: grids
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
export const MonthPager = /*#__PURE__*/memo(MonthPagerInner);
|
|
161
|
+
MonthPager.displayName = 'MonthPager';
|
|
162
|
+
const styles = StyleSheet.create({
|
|
163
|
+
root: {
|
|
164
|
+
position: 'absolute',
|
|
165
|
+
top: 0,
|
|
166
|
+
left: 0,
|
|
167
|
+
height: GRID_HEIGHT
|
|
168
|
+
},
|
|
169
|
+
grid: {
|
|
170
|
+
position: 'absolute',
|
|
171
|
+
top: 0,
|
|
172
|
+
height: GRID_HEIGHT
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
//# sourceMappingURL=MonthPager.js.map
|