react-day-picker 8.0.0-beta.30 → 8.0.0-beta.35
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/CHANGELOG.md +24 -1
- package/README.md +1 -1
- package/build/DayPicker.d.ts +5 -4
- package/build/DayPicker.js +6 -5
- package/build/DayPicker.js.map +1 -1
- package/build/components/Button/Button.d.ts +1 -1
- package/build/components/Button/Button.js +2 -1
- package/build/components/Button/Button.js.map +1 -1
- package/build/components/Caption/Caption.d.ts +7 -0
- package/build/components/Caption/Caption.js +7 -6
- package/build/components/Caption/Caption.js.map +1 -1
- package/build/components/CaptionLabel/CaptionLabel.js +2 -1
- package/build/components/CaptionLabel/CaptionLabel.js.map +1 -1
- package/build/components/Day/Day.js +1 -1
- package/build/components/Day/Day.js.map +1 -1
- package/build/components/Day/hooks/useDay.d.ts +5 -5
- package/build/components/Day/hooks/useDay.js +11 -11
- package/build/components/Day/hooks/useDay.js.map +1 -1
- package/build/components/Day/hooks/useDayFocus.d.ts +1 -1
- package/build/components/Day/hooks/useDayFocus.js +27 -6
- package/build/components/Day/hooks/useDayFocus.js.map +1 -1
- package/build/components/DayContent/DayContent.js +2 -1
- package/build/components/DayContent/DayContent.js.map +1 -1
- package/build/components/Dropdown/Dropdown.d.ts +1 -1
- package/build/components/Dropdown/Dropdown.js +2 -1
- package/build/components/Dropdown/Dropdown.js.map +1 -1
- package/build/components/Footer/Footer.js +2 -1
- package/build/components/Footer/Footer.js.map +1 -1
- package/build/components/Head/Head.js +2 -1
- package/build/components/Head/Head.js.map +1 -1
- package/build/components/IconDropdown/IconDropdown.d.ts +2 -2
- package/build/components/IconDropdown/IconDropdown.js +1 -1
- package/build/components/IconDropdown/IconDropdown.js.map +1 -1
- package/build/components/IconLeft/IconLeft.d.ts +6 -0
- package/build/components/{IconPrevious/IconPrevious.js → IconLeft/IconLeft.js} +5 -5
- package/build/components/IconLeft/IconLeft.js.map +1 -0
- package/build/components/IconLeft/index.d.ts +1 -0
- package/build/components/IconRight/IconRight.d.ts +6 -0
- package/build/components/{IconNext/IconNext.js → IconRight/IconRight.js} +5 -5
- package/build/components/IconRight/IconRight.js.map +1 -0
- package/build/components/IconRight/index.d.ts +1 -0
- package/build/components/MonthsDropdown/MonthsDropdown.d.ts +1 -1
- package/build/components/MonthsDropdown/MonthsDropdown.js +2 -1
- package/build/components/MonthsDropdown/MonthsDropdown.js.map +1 -1
- package/build/components/Navigation/Navigation.d.ts +1 -1
- package/build/components/Navigation/Navigation.js +6 -9
- package/build/components/Navigation/Navigation.js.map +1 -1
- package/build/components/Root/Root.js +2 -2
- package/build/components/Root/Root.js.map +1 -1
- package/build/components/Row/Row.js +2 -1
- package/build/components/Row/Row.js.map +1 -1
- package/build/components/Table/Table.js +2 -1
- package/build/components/Table/Table.js.map +1 -1
- package/build/components/WeekNumber/WeekNumber.js +2 -1
- package/build/components/WeekNumber/WeekNumber.js.map +1 -1
- package/build/components/YearsDropdown/YearsDropdown.d.ts +1 -1
- package/build/components/YearsDropdown/YearsDropdown.js +2 -1
- package/build/components/YearsDropdown/YearsDropdown.js.map +1 -1
- package/build/components/index.d.ts +2 -7
- package/build/contexts/DayPicker/DayPickerContext.d.ts +3 -2
- package/build/contexts/DayPicker/DayPickerContext.js +1 -1
- package/build/contexts/DayPicker/DayPickerContext.js.map +1 -1
- package/build/contexts/DayPicker/DayPickerProvider.d.ts +1 -1
- package/build/contexts/DayPicker/DayPickerProvider.js +7 -7
- package/build/contexts/DayPicker/DayPickerProvider.js.map +1 -1
- package/build/contexts/DayPicker/defaultClassNames.js +1 -3
- package/build/contexts/DayPicker/defaultClassNames.js.map +1 -1
- package/build/contexts/DayPicker/index.d.ts +1 -0
- package/build/contexts/DayPicker/labels/labelDay.d.ts +2 -2
- package/build/contexts/DayPicker/labels/labelDay.js +1 -1
- package/build/contexts/DayPicker/labels/labelDay.js.map +1 -1
- package/build/contexts/DayPicker/labels/labelNext.d.ts +2 -2
- package/build/contexts/DayPicker/labels/labelNext.js.map +1 -1
- package/build/contexts/DayPicker/labels/labelPrevious.d.ts +2 -2
- package/build/contexts/DayPicker/labels/labelPrevious.js.map +1 -1
- package/build/contexts/DayPicker/labels/labelWeekNumber.d.ts +2 -2
- package/build/contexts/DayPicker/labels/labelWeekNumber.js.map +1 -1
- package/build/contexts/DayPicker/labels/labelWeekday.d.ts +2 -2
- package/build/contexts/DayPicker/labels/labelWeekday.js.map +1 -1
- package/build/contexts/DayPicker/useDayPicker.js +1 -1
- package/build/contexts/DayPicker/useDayPicker.js.map +1 -1
- package/build/contexts/DayPicker/utils/parseModifierProps.d.ts +1 -2
- package/build/contexts/DayPicker/utils/parseModifierProps.js +2 -2
- package/build/contexts/DayPicker/utils/parseModifierProps.js.map +1 -1
- package/build/contexts/Focus/FocusContext.d.ts +11 -1
- package/build/contexts/Focus/FocusContext.js +112 -3
- package/build/contexts/Focus/FocusContext.js.map +1 -1
- package/build/contexts/Focus/index.d.ts +0 -1
- package/build/contexts/Focus/useFocus.js +1 -1
- package/build/contexts/Focus/useFocus.js.map +1 -1
- package/build/contexts/Navigation/NavigationContext.d.ts +5 -1
- package/build/contexts/Navigation/NavigationContext.js +24 -3
- package/build/contexts/Navigation/NavigationContext.js.map +1 -1
- package/build/contexts/Navigation/index.d.ts +0 -1
- package/build/contexts/Navigation/useNavigation.js +1 -1
- package/build/contexts/Navigation/useNavigation.js.map +1 -1
- package/build/contexts/Navigation/useNavigationState.js +1 -0
- package/build/contexts/Navigation/useNavigationState.js.map +1 -1
- package/build/contexts/RootProvider.d.ts +8 -0
- package/build/contexts/{ContextProvider.js → RootProvider.js} +9 -14
- package/build/contexts/RootProvider.js.map +1 -0
- package/build/contexts/SelectMultiple/SelectMultipleContext.d.ts +15 -3
- package/build/contexts/SelectMultiple/SelectMultipleContext.js +73 -3
- package/build/contexts/SelectMultiple/SelectMultipleContext.js.map +1 -1
- package/build/contexts/SelectMultiple/index.d.ts +0 -1
- package/build/contexts/SelectMultiple/useSelectMultiple.js +1 -1
- package/build/contexts/SelectMultiple/useSelectMultiple.js.map +1 -1
- package/build/contexts/SelectRange/SelectRangeContext.d.ts +15 -4
- package/build/contexts/SelectRange/SelectRangeContext.js +114 -3
- package/build/contexts/SelectRange/SelectRangeContext.js.map +1 -1
- package/build/contexts/SelectRange/index.d.ts +0 -1
- package/build/contexts/SelectRange/useSelectRange.js +1 -1
- package/build/contexts/SelectRange/useSelectRange.js.map +1 -1
- package/build/contexts/SelectSingle/SelectSingleContext.d.ts +18 -4
- package/build/contexts/SelectSingle/SelectSingleContext.js +36 -3
- package/build/contexts/SelectSingle/SelectSingleContext.js.map +1 -1
- package/build/contexts/SelectSingle/index.d.ts +0 -1
- package/build/contexts/SelectSingle/useSelectSingle.js +1 -1
- package/build/contexts/SelectSingle/useSelectSingle.js.map +1 -1
- package/build/contexts/index.d.ts +1 -1
- package/build/hooks/index.d.ts +0 -1
- package/build/hooks/useControlledValue/useControlledValue.js +2 -2
- package/build/hooks/useControlledValue/useControlledValue.js.map +1 -1
- package/build/hooks/useInput/index.d.ts +0 -1
- package/build/hooks/useInput/useInput.d.ts +27 -3
- package/build/hooks/useInput/useInput.js +8 -10
- package/build/hooks/useInput/useInput.js.map +1 -1
- package/build/hooks/useModifiers/useModifiers.js +4 -5
- package/build/hooks/useModifiers/useModifiers.js.map +1 -1
- package/build/hooks/useModifiers/utils/getModifierStatus.js.map +1 -1
- package/build/hooks/useModifiers/utils/isDateInRange.d.ts +1 -1
- package/build/hooks/useModifiers/utils/isDateInRange.js.map +1 -1
- package/build/hooks/useModifiers/utils/isMatch.d.ts +1 -1
- package/build/hooks/useModifiers/utils/isMatch.js +10 -8
- package/build/hooks/useModifiers/utils/isMatch.js.map +1 -1
- package/build/main.js +14 -30
- package/build/main.js.map +1 -1
- package/build/packages/react-day-picker/src/DayPicker.d.ts +89 -0
- package/build/packages/react-day-picker/src/components/Button/Button.d.ts +7 -0
- package/build/packages/react-day-picker/src/components/Button/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/Caption/Caption.d.ts +18 -0
- package/build/packages/react-day-picker/src/components/Caption/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/CaptionLabel/CaptionLabel.d.ts +8 -0
- package/build/packages/react-day-picker/src/components/CaptionLabel/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/Day/Day.d.ts +13 -0
- package/build/packages/react-day-picker/src/components/Day/hooks/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/Day/hooks/useDay.d.ts +58 -0
- package/build/packages/react-day-picker/src/components/Day/hooks/useDayFocus.d.ts +8 -0
- package/build/packages/react-day-picker/src/components/Day/index.d.ts +2 -0
- package/build/packages/react-day-picker/src/components/DayContent/DayContent.d.ts +15 -0
- package/build/packages/react-day-picker/src/components/DayContent/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/Dropdown/Dropdown.d.ts +16 -0
- package/build/packages/react-day-picker/src/components/Dropdown/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/Footer/Footer.d.ts +3 -0
- package/build/packages/react-day-picker/src/components/Footer/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/Head/Head.d.ts +5 -0
- package/build/packages/react-day-picker/src/components/Head/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/Head/utils/getWeekdays.d.ts +6 -0
- package/build/packages/react-day-picker/src/components/Head/utils/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/IconDropdown/IconDropdown.d.ts +6 -0
- package/build/packages/react-day-picker/src/components/IconDropdown/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/IconLeft/IconLeft.d.ts +6 -0
- package/build/packages/react-day-picker/src/components/IconLeft/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/IconRight/IconRight.d.ts +6 -0
- package/build/packages/react-day-picker/src/components/IconRight/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/MonthsDropdown/MonthsDropdown.d.ts +12 -0
- package/build/packages/react-day-picker/src/components/MonthsDropdown/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/Navigation/Navigation.d.ts +20 -0
- package/build/packages/react-day-picker/src/components/Navigation/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/Root/Root.d.ts +6 -0
- package/build/packages/react-day-picker/src/components/Root/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/Row/Row.d.ts +16 -0
- package/build/packages/react-day-picker/src/components/Row/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/Table/Table.d.ts +12 -0
- package/build/packages/react-day-picker/src/components/Table/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/Table/utils/getOutsideEndDays.d.ts +3 -0
- package/build/packages/react-day-picker/src/components/Table/utils/getOutsideStartDays.d.ts +4 -0
- package/build/packages/react-day-picker/src/components/Table/utils/getWeeks.d.ts +17 -0
- package/build/packages/react-day-picker/src/components/WeekNumber/WeekNumber.d.ts +15 -0
- package/build/packages/react-day-picker/src/components/WeekNumber/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/YearsDropdown/YearsDropdown.d.ts +16 -0
- package/build/packages/react-day-picker/src/components/YearsDropdown/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/components/index.d.ts +13 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/DayPickerContext.d.ts +31 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/DayPickerProvider.d.ts +12 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/defaultClassNames.d.ts +5 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/formatters/formatCaption.d.ts +7 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/formatters/formatDay.d.ts +7 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/formatters/formatMonthCaption.d.ts +7 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/formatters/formatWeekNumber.d.ts +4 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/formatters/formatWeekdayName.d.ts +7 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/formatters/formatYearCaption.d.ts +6 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/formatters/index.d.ts +6 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/index.d.ts +2 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/labels/index.d.ts +7 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/labels/labelDay.d.ts +5 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/labels/labelMonthDropdown.d.ts +4 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/labels/labelNext.d.ts +5 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/labels/labelPrevious.d.ts +5 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/labels/labelWeekNumber.d.ts +5 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/labels/labelWeekday.d.ts +5 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/labels/labelYearDropdown.d.ts +4 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/useDayPicker.d.ts +8 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/utils/index.d.ts +2 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/utils/parseFromToProps.d.ts +9 -0
- package/build/packages/react-day-picker/src/contexts/DayPicker/utils/parseModifierProps.d.ts +8 -0
- package/build/packages/react-day-picker/src/contexts/Focus/FocusContext.d.ts +30 -0
- package/build/packages/react-day-picker/src/contexts/Focus/index.d.ts +2 -0
- package/build/packages/react-day-picker/src/contexts/Focus/useFocus.d.ts +3 -0
- package/build/packages/react-day-picker/src/contexts/Navigation/NavigationContext.d.ts +24 -0
- package/build/packages/react-day-picker/src/contexts/Navigation/index.d.ts +2 -0
- package/build/packages/react-day-picker/src/contexts/Navigation/useNavigation.d.ts +3 -0
- package/build/packages/react-day-picker/src/contexts/Navigation/useNavigationState.d.ts +7 -0
- package/build/packages/react-day-picker/src/contexts/Navigation/utils/getDisplayMonths.d.ts +8 -0
- package/build/packages/react-day-picker/src/contexts/Navigation/utils/getInitialMonth.d.ts +3 -0
- package/build/packages/react-day-picker/src/contexts/Navigation/utils/getNextMonth.d.ts +18 -0
- package/build/packages/react-day-picker/src/contexts/Navigation/utils/getPreviousMonth.d.ts +19 -0
- package/build/packages/react-day-picker/src/contexts/RootProvider.d.ts +8 -0
- package/build/packages/react-day-picker/src/contexts/SelectMultiple/SelectMultipleContext.d.ts +32 -0
- package/build/packages/react-day-picker/src/contexts/SelectMultiple/index.d.ts +2 -0
- package/build/packages/react-day-picker/src/contexts/SelectMultiple/useSelectMultiple.d.ts +3 -0
- package/build/packages/react-day-picker/src/contexts/SelectRange/SelectRangeContext.d.ts +32 -0
- package/build/packages/react-day-picker/src/contexts/SelectRange/index.d.ts +2 -0
- package/build/packages/react-day-picker/src/contexts/SelectRange/useSelectRange.d.ts +3 -0
- package/build/packages/react-day-picker/src/contexts/SelectRange/utils/addToRange.d.ts +8 -0
- package/build/packages/react-day-picker/src/contexts/SelectSingle/SelectSingleContext.d.ts +35 -0
- package/build/packages/react-day-picker/src/contexts/SelectSingle/index.d.ts +2 -0
- package/build/packages/react-day-picker/src/contexts/SelectSingle/useSelectSingle.d.ts +3 -0
- package/build/packages/react-day-picker/src/contexts/index.d.ts +7 -0
- package/build/packages/react-day-picker/src/hooks/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/hooks/useControlledValue/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/hooks/useControlledValue/useControlledValue.d.ts +12 -0
- package/build/packages/react-day-picker/src/hooks/useInput/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/hooks/useInput/useInput.d.ts +28 -0
- package/build/packages/react-day-picker/src/hooks/useInput/utils/isValidDate.d.ts +2 -0
- package/build/packages/react-day-picker/src/hooks/useModifiers/index.d.ts +1 -0
- package/build/packages/react-day-picker/src/hooks/useModifiers/useModifiers.d.ts +3 -0
- package/build/packages/react-day-picker/src/hooks/useModifiers/utils/getModifierStatus.d.ts +7 -0
- package/build/packages/react-day-picker/src/hooks/useModifiers/utils/isDateInRange.d.ts +3 -0
- package/build/packages/react-day-picker/src/hooks/useModifiers/utils/isMatch.d.ts +5 -0
- package/build/packages/react-day-picker/src/main.d.ts +5 -0
- package/build/{types/DayPickerBase.d.ts → packages/react-day-picker/src/types/DayPicker.d.ts} +40 -53
- package/build/packages/react-day-picker/src/types/DayPickerCustom.d.ts +11 -0
- package/build/packages/react-day-picker/src/types/DayPickerMultiple.d.ts +16 -0
- package/build/packages/react-day-picker/src/types/DayPickerRange.d.ts +17 -0
- package/build/packages/react-day-picker/src/types/DayPickerSingle.d.ts +14 -0
- package/build/packages/react-day-picker/src/types/EventHandlers.d.ts +51 -0
- package/build/packages/react-day-picker/src/types/Formatters.d.ts +24 -0
- package/build/packages/react-day-picker/src/types/Labels.d.ts +28 -0
- package/build/packages/react-day-picker/src/types/Matchers.d.ts +34 -0
- package/build/packages/react-day-picker/src/types/Modifiers.d.ts +16 -0
- package/build/{types/StyledElement.d.ts → packages/react-day-picker/src/types/Styles.d.ts} +15 -6
- package/build/packages/react-day-picker/src/types/index.d.ts +11 -0
- package/build/test/PageObjects.d.ts +7 -4
- package/build/test/customRender.d.ts +2 -2
- package/build/test/customRenderHook.d.ts +2 -2
- package/build/test/po.d.ts +29 -0
- package/build/test/setup.d.ts +0 -1
- package/build/test/utils.d.ts +2 -0
- package/build/types/DayPicker.d.ts +225 -0
- package/build/types/DayPickerCustom.d.ts +10 -6
- package/build/types/{isDayPickerCustom.js → DayPickerCustom.js} +1 -1
- package/build/types/DayPickerCustom.js.map +1 -0
- package/build/types/DayPickerMultiple.d.ts +8 -9
- package/build/types/{isDayPickerMultiple.js → DayPickerMultiple.js} +1 -1
- package/build/types/DayPickerMultiple.js.map +1 -0
- package/build/types/DayPickerRange.d.ts +10 -13
- package/build/types/{isDayPickerRange.js → DayPickerRange.js} +1 -1
- package/build/types/DayPickerRange.js.map +1 -0
- package/build/types/DayPickerSingle.d.ts +10 -11
- package/build/types/{isDayPickerSingle.js → DayPickerSingle.js} +1 -1
- package/build/types/DayPickerSingle.js.map +1 -0
- package/build/types/EventHandlers.d.ts +51 -0
- package/build/types/Formatters.d.ts +10 -5
- package/build/types/Labels.d.ts +24 -13
- package/build/types/Matchers.d.ts +34 -0
- package/build/types/Matchers.js +27 -0
- package/build/types/Matchers.js.map +1 -0
- package/build/types/Modifiers.d.ts +15 -4
- package/build/types/Styles.d.ts +83 -2
- package/build/types/index.d.ts +3 -46
- package/dist/main.js +926 -902
- package/dist/main.js.map +1 -1
- package/package.json +12 -19
- package/build/components/IconNext/IconNext.d.ts +0 -6
- package/build/components/IconNext/IconNext.js.map +0 -1
- package/build/components/IconNext/index.d.ts +0 -1
- package/build/components/IconPrevious/IconPrevious.d.ts +0 -6
- package/build/components/IconPrevious/IconPrevious.js.map +0 -1
- package/build/components/IconPrevious/index.d.ts +0 -1
- package/build/contexts/ContextProvider.d.ts +0 -8
- package/build/contexts/ContextProvider.js.map +0 -1
- package/build/contexts/Focus/FocusProvider.d.ts +0 -5
- package/build/contexts/Focus/FocusProvider.js +0 -66
- package/build/contexts/Focus/FocusProvider.js.map +0 -1
- package/build/contexts/Navigation/NavigationProvider.d.ts +0 -5
- package/build/contexts/Navigation/NavigationProvider.js +0 -26
- package/build/contexts/Navigation/NavigationProvider.js.map +0 -1
- package/build/contexts/SelectMultiple/SelectMultipleProvider.d.ts +0 -9
- package/build/contexts/SelectMultiple/SelectMultipleProvider.js +0 -76
- package/build/contexts/SelectMultiple/SelectMultipleProvider.js.map +0 -1
- package/build/contexts/SelectRange/SelectRangeProvider.d.ts +0 -13
- package/build/contexts/SelectRange/SelectRangeProvider.js +0 -119
- package/build/contexts/SelectRange/SelectRangeProvider.js.map +0 -1
- package/build/contexts/SelectSingle/SelectSingleProvider.d.ts +0 -13
- package/build/contexts/SelectSingle/SelectSingleProvider.js +0 -44
- package/build/contexts/SelectSingle/SelectSingleProvider.js.map +0 -1
- package/build/hooks/useInput/types/UseInput.d.ts +0 -12
- package/build/hooks/useInput/types/UseInputDayPickerProps.d.ts +0 -14
- package/build/hooks/useInput/types/UseInputFieldProps.d.ts +0 -12
- package/build/hooks/useInput/types/UseInputOptions.d.ts +0 -35
- package/build/hooks/useInput/types/index.d.ts +0 -4
- package/build/test/index.d.ts +0 -3
- package/build/types/CaptionLayout.d.ts +0 -7
- package/build/types/ClassNames.d.ts +0 -3
- package/build/types/Components.d.ts +0 -39
- package/build/types/CustomModifiers.d.ts +0 -4
- package/build/types/DateAfter.d.ts +0 -7
- package/build/types/DateBefore.d.ts +0 -7
- package/build/types/DateFormatter.d.ts +0 -6
- package/build/types/DateInterval.d.ts +0 -8
- package/build/types/DateRange.d.ts +0 -8
- package/build/types/DayClickEventHandler.d.ts +0 -6
- package/build/types/DayFocusEventHandler.d.ts +0 -6
- package/build/types/DayKeyboardEventHandler.d.ts +0 -6
- package/build/types/DayLabelFormatter.d.ts +0 -7
- package/build/types/DayMouseEventHandler.d.ts +0 -6
- package/build/types/DayOfWeekMatcher.d.ts +0 -7
- package/build/types/DayPickerProps.d.ts +0 -9
- package/build/types/DayTouchEventHandler.d.ts +0 -6
- package/build/types/InternalModifier.d.ts +0 -2
- package/build/types/Matcher.d.ts +0 -10
- package/build/types/Modifier.d.ts +0 -5
- package/build/types/ModifierClassNames.d.ts +0 -5
- package/build/types/ModifierStatus.d.ts +0 -5
- package/build/types/ModifierStyles.d.ts +0 -4
- package/build/types/MonthChangeEventHandler.d.ts +0 -4
- package/build/types/NavButtonLabelFormatter.d.ts +0 -7
- package/build/types/SelectMultipleEventHandler.d.ts +0 -12
- package/build/types/SelectRangeEventHandler.d.ts +0 -10
- package/build/types/SelectSingleEventHandler.d.ts +0 -12
- package/build/types/StyledComponentProps.d.ts +0 -10
- package/build/types/WeekNumberClickEventHandler.d.ts +0 -9
- package/build/types/WeekNumberFormatter.d.ts +0 -6
- package/build/types/WeekNumberLabelFormatter.d.ts +0 -5
- package/build/types/WeekdayLabelFormatter.d.ts +0 -4
- package/build/types/isArrayOfDates.d.ts +0 -2
- package/build/types/isArrayOfDates.js +0 -9
- package/build/types/isArrayOfDates.js.map +0 -1
- package/build/types/isDateAfterType.d.ts +0 -3
- package/build/types/isDateAfterType.js +0 -7
- package/build/types/isDateAfterType.js.map +0 -1
- package/build/types/isDateBeforeType.d.ts +0 -3
- package/build/types/isDateBeforeType.js +0 -7
- package/build/types/isDateBeforeType.js.map +0 -1
- package/build/types/isDateInterval.d.ts +0 -3
- package/build/types/isDateInterval.js +0 -10
- package/build/types/isDateInterval.js.map +0 -1
- package/build/types/isDateRange.d.ts +0 -3
- package/build/types/isDateRange.js +0 -8
- package/build/types/isDateRange.js.map +0 -1
- package/build/types/isDateType.d.ts +0 -2
- package/build/types/isDateType.js +0 -9
- package/build/types/isDateType.js.map +0 -1
- package/build/types/isDayOfWeekType.d.ts +0 -3
- package/build/types/isDayOfWeekType.js +0 -7
- package/build/types/isDayOfWeekType.js.map +0 -1
- package/build/types/isDayPickerCustom.d.ts +0 -4
- package/build/types/isDayPickerCustom.js.map +0 -1
- package/build/types/isDayPickerMultiple.d.ts +0 -4
- package/build/types/isDayPickerMultiple.js.map +0 -1
- package/build/types/isDayPickerRange.d.ts +0 -4
- package/build/types/isDayPickerRange.js.map +0 -1
- package/build/types/isDayPickerSingle.d.ts +0 -4
- package/build/types/isDayPickerSingle.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -16,7 +16,30 @@ with the previous versions.
|
|
|
16
16
|
|
|
17
17
|
See the preview website at https://react-day-picker-next.netlify.app.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
### v8.0.0-beta.35
|
|
22
|
+
|
|
23
|
+
- feat: add extended keyboard navigation (#1300) (2a098719)
|
|
24
|
+
- chore: export missing Button component (5ba65841)
|
|
25
|
+
- chore: rename `handleDayClick` to `onDayClick` (3d1678b2)
|
|
26
|
+
- chore: limit documented exports (c2fbd576)
|
|
27
|
+
- build: fix circular dependency (5cd0c2c8)
|
|
28
|
+
|
|
29
|
+
### v8.0.0-beta.33
|
|
30
|
+
|
|
31
|
+
- chore: unify context files (#1303) (d66b3981)
|
|
32
|
+
- chore: cleanup useInput types (7faec569)
|
|
33
|
+
- chore: improve internal modifiers typings (#1299) (9ddc64d9)
|
|
34
|
+
- chore: consolidate types (#1297) (e00c59e7)
|
|
35
|
+
|
|
36
|
+
### v8.0.0-beta.32
|
|
37
|
+
|
|
38
|
+
- fix: previous/next month navigation with RTL direction (68ad0adf)
|
|
39
|
+
- chore: updated `useInput` API (#1293)
|
|
40
|
+
- chore: removed `defaultSelected` prop (cd4f5790)
|
|
41
|
+
|
|
42
|
+
### v8.0.0-beta.31
|
|
20
43
|
|
|
21
44
|
- Switched to rollup as module bundler
|
|
22
45
|
- Added `custom` selection mode
|
package/README.md
CHANGED
package/build/DayPicker.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DayPickerProps } from './types';
|
|
2
|
+
import { DayPickerCustomProps, DayPickerMultipleProps, DayPickerProps, DayPickerRangeProps, DayPickerSingleProps } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* DayPicker render a date picker component to let users pick dates from a
|
|
5
5
|
* calendar. See http://react-day-picker.js.org for updated documentation and
|
|
@@ -36,6 +36,7 @@ import { DayPickerProps } from './types';
|
|
|
36
36
|
* days that can be selected with the `min` or the `max` props.
|
|
37
37
|
* - `mode="range"`: users can select a range of days. Limit the amount of days
|
|
38
38
|
* in the range with the `min` or the `max` props.
|
|
39
|
+
* - `mode="custom"`: implement your own selection mode with `onDayClick`.
|
|
39
40
|
*
|
|
40
41
|
* These selection modes should cover the most common use cases. In case you
|
|
41
42
|
* need a more refined way of selecting days, use `mode="custom"`. Use the
|
|
@@ -59,8 +60,8 @@ import { DayPickerProps } from './types';
|
|
|
59
60
|
*
|
|
60
61
|
* ### Styling
|
|
61
62
|
*
|
|
62
|
-
* DayPicker comes with a default, basic style in `react-day-picker/style` –
|
|
63
|
-
*
|
|
63
|
+
* DayPicker comes with a default, basic style in `react-day-picker/style` – use
|
|
64
|
+
* it as template for your own style.
|
|
64
65
|
*
|
|
65
66
|
* If you are using CSS modules, pass the imported styles object the
|
|
66
67
|
* `classNames` props.
|
|
@@ -85,4 +86,4 @@ import { DayPickerProps } from './types';
|
|
|
85
86
|
* <DayPicker locale={es} />
|
|
86
87
|
* ```
|
|
87
88
|
*/
|
|
88
|
-
export declare function DayPicker(props: DayPickerProps): JSX.Element;
|
|
89
|
+
export declare function DayPicker(props: DayPickerProps | DayPickerSingleProps | DayPickerMultipleProps | DayPickerRangeProps | DayPickerCustomProps): JSX.Element;
|
package/build/DayPicker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign } from './_virtual/_tslib.js';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { Root } from './components/Root/Root.js';
|
|
4
|
-
import {
|
|
4
|
+
import { RootProvider } from './contexts/RootProvider.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* DayPicker render a date picker component to let users pick dates from a
|
|
@@ -39,6 +39,7 @@ import { ContextProvider } from './contexts/ContextProvider.js';
|
|
|
39
39
|
* days that can be selected with the `min` or the `max` props.
|
|
40
40
|
* - `mode="range"`: users can select a range of days. Limit the amount of days
|
|
41
41
|
* in the range with the `min` or the `max` props.
|
|
42
|
+
* - `mode="custom"`: implement your own selection mode with `onDayClick`.
|
|
42
43
|
*
|
|
43
44
|
* These selection modes should cover the most common use cases. In case you
|
|
44
45
|
* need a more refined way of selecting days, use `mode="custom"`. Use the
|
|
@@ -62,8 +63,8 @@ import { ContextProvider } from './contexts/ContextProvider.js';
|
|
|
62
63
|
*
|
|
63
64
|
* ### Styling
|
|
64
65
|
*
|
|
65
|
-
* DayPicker comes with a default, basic style in `react-day-picker/style` –
|
|
66
|
-
*
|
|
66
|
+
* DayPicker comes with a default, basic style in `react-day-picker/style` – use
|
|
67
|
+
* it as template for your own style.
|
|
67
68
|
*
|
|
68
69
|
* If you are using CSS modules, pass the imported styles object the
|
|
69
70
|
* `classNames` props.
|
|
@@ -89,7 +90,7 @@ import { ContextProvider } from './contexts/ContextProvider.js';
|
|
|
89
90
|
* ```
|
|
90
91
|
*/
|
|
91
92
|
function DayPicker(props) {
|
|
92
|
-
return (React.createElement(
|
|
93
|
+
return (React.createElement(RootProvider, __assign({}, props),
|
|
93
94
|
React.createElement(Root, null)));
|
|
94
95
|
}
|
|
95
96
|
|
package/build/DayPicker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DayPicker.js","sources":["../src/DayPicker.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"DayPicker.js","sources":["../src/DayPicker.tsx"],"sourcesContent":["import React from 'react';\n\nimport {\n DayPickerCustomProps,\n DayPickerMultipleProps,\n DayPickerProps,\n DayPickerRangeProps,\n DayPickerSingleProps\n} from './types';\n\nimport { Root } from './components/Root';\nimport { RootProvider } from './contexts/RootProvider';\n\n/**\n * DayPicker render a date picker component to let users pick dates from a\n * calendar. See http://react-day-picker.js.org for updated documentation and\n * examples.\n *\n * ### Customization\n *\n * DayPicker offers different customization props. For example,\n *\n * - show multiple months using `numberOfMonths`\n * - display a dropdown to navigate the months via `captionLayout`\n * - display the week numbers with `showWeekNumbers`\n * - disable or hide days with `disabled` or `hidden`\n *\n * ### Controlling the months\n *\n * Change the initially displayed month using the `defaultMonth` prop. The\n * displayed months are controlled by DayPicker and stored in its internal\n * state. To control the months yourself, use `month` instead of `defaultMonth`\n * and use the `onMonthChange` event to set it.\n *\n * To limit the months the user can navigate to, use\n * `fromDate`/`fromMonth`/`fromYear` or `toDate`/`toMonth`/`toYear`.\n *\n * ### Selection modes\n *\n * DayPicker supports different selection mode that can be toggled using the\n * `mode` prop:\n *\n * - `mode=\"single\"`: only one day can be selected. Use `required` to make the\n * selection required. Use the `onSelect` event handler to get the selected\n * days.\n * - `mode=\"multiple\"`: users can select one or more days. Limit the amount of\n * days that can be selected with the `min` or the `max` props.\n * - `mode=\"range\"`: users can select a range of days. Limit the amount of days\n * in the range with the `min` or the `max` props.\n * - `mode=\"custom\"`: implement your own selection mode with `onDayClick`.\n *\n * These selection modes should cover the most common use cases. In case you\n * need a more refined way of selecting days, use `mode=\"custom\"`. Use the\n * `selected` props and add the day event handlers to add/remove days from the\n * selection.\n *\n * ### Modifiers\n *\n * A _modifier_ represents different styles or states for the days displayed in\n * the calendar (like \"selected\" or \"disabled\"). Define custom modifiers using\n * the `modifiers` prop.\n *\n * ### Formatters and custom component\n *\n * You can customize how the content is displayed in the date picker by using\n * either the formatters or replacing the internal components.\n *\n * For the most common cases you want to use the `formatters` prop to change how\n * the content is formatted in the calendar. Use the `components` prop to\n * replace the internal components, like the navigation icons.\n *\n * ### Styling\n *\n * DayPicker comes with a default, basic style in `react-day-picker/style` – use\n * it as template for your own style.\n *\n * If you are using CSS modules, pass the imported styles object the\n * `classNames` props.\n *\n * You can also style the elements via inline-styles using the `styles` prop.\n *\n * ### Form fields\n *\n * If you need to bind the date picker to a form field, you can use the\n * `useInput` hooks for a basic behavior. See the `useInput` source as an\n * example to bind the date picker with form fields.\n *\n * ### Localization\n *\n * To localize DayPicker, import the locale from `date-fns` package and use the\n * `locale` prop.\n *\n * For example, to use Spanish locale:\n *\n * ```\n * import es from 'date-fns/locale/es';\n * <DayPicker locale={es} />\n * ```\n */\nexport function DayPicker(\n props:\n | DayPickerProps\n | DayPickerSingleProps\n | DayPickerMultipleProps\n | DayPickerRangeProps\n | DayPickerCustomProps\n): JSX.Element {\n return (\n <RootProvider {...props}>\n <Root />\n </RootProvider>\n );\n}\n"],"names":[],"mappings":";;;;;AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAsFgB,SAAS,CACvB,KAKwB;IAExB,QACE,oBAAC,YAAY,eAAK,KAAK;QACrB,oBAAC,IAAI,OAAG,CACK,EACf;AACJ;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __assign } from '../../_virtual/_tslib.js';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { useDayPicker } from '../../contexts/DayPicker/useDayPicker.js';
|
|
4
|
+
import '../../contexts/DayPicker/DayPickerContext.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Render a button HTML element applying the reset class name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useDayPicker } from '../../contexts/DayPicker';\n\n/** The props for the [[Button]] component. */\nexport type ButtonProps = React.HTMLProps<HTMLButtonElement>;\n\n/**\n * Render a button HTML element applying the reset class name.\n */\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (props, ref) => {\n const { classNames, styles } = useDayPicker();\n\n const classNamesArr = [classNames.button_reset, classNames.button];\n if (props.className) {\n classNamesArr.push(props.className);\n }\n const className = classNamesArr.join(' ');\n\n const style = { ...styles.button_reset, ...styles.button };\n if (props.style) {\n Object.assign(style, props.style);\n }\n\n return (\n <button\n {...props}\n ref={ref}\n type=\"button\"\n className={className}\n style={style}\n />\n );\n }\n);\n"],"names":[],"mappings":";;;;;AAOA;;;IAGa,MAAM,GAAG,KAAK,CAAC,UAAU,CACpC,UAAC,KAAK,EAAE,GAAG;IACH,IAAA,KAAyB,YAAY,EAAE,EAArC,UAAU,gBAAA,EAAE,MAAM,YAAmB,CAAC;IAE9C,IAAM,aAAa,GAAG,CAAC,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IACnE,IAAI,KAAK,CAAC,SAAS,EAAE;QACnB,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;KACrC;IACD,IAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE1C,IAAM,KAAK,yBAAQ,MAAM,CAAC,YAAY,GAAK,MAAM,CAAC,MAAM,CAAE,CAAC;IAC3D,IAAI,KAAK,CAAC,KAAK,EAAE;QACf,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;KACnC;IAED,QACE,2CACM,KAAK,IACT,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,IACZ,EACF;AACJ,CAAC;;;;"}
|
|
@@ -4,6 +4,13 @@ export interface CaptionProps {
|
|
|
4
4
|
/** The month where the caption is displayed. */
|
|
5
5
|
displayMonth: Date;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* The layout of the caption:
|
|
9
|
+
*
|
|
10
|
+
* - `dropdown` - display a month / year dropdown
|
|
11
|
+
* - `buttons` - display previous / next month button.
|
|
12
|
+
*/
|
|
13
|
+
export declare type CaptionLayout = 'dropdown' | 'buttons';
|
|
7
14
|
/**
|
|
8
15
|
* Render the caption of a month, which includes title and navigation buttons.
|
|
9
16
|
* The caption has a different layout when setting the `numberOfMonths` prop.
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { isSameMonth } from 'date-fns';
|
|
3
|
-
import { MonthsDropdown } from '../MonthsDropdown/MonthsDropdown.js';
|
|
4
|
-
import { Navigation } from '../Navigation/Navigation.js';
|
|
5
|
-
import { YearsDropdown } from '../YearsDropdown/YearsDropdown.js';
|
|
6
3
|
import { useDayPicker } from '../../contexts/DayPicker/useDayPicker.js';
|
|
4
|
+
import '../../contexts/DayPicker/DayPickerContext.js';
|
|
7
5
|
import '../../contexts/Navigation/NavigationContext.js';
|
|
8
6
|
import { useNavigation } from '../../contexts/Navigation/useNavigation.js';
|
|
7
|
+
import { MonthsDropdown } from '../MonthsDropdown/MonthsDropdown.js';
|
|
8
|
+
import { Navigation } from '../Navigation/Navigation.js';
|
|
9
|
+
import { YearsDropdown } from '../YearsDropdown/YearsDropdown.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Render the caption of a month, which includes title and navigation buttons.
|
|
@@ -17,13 +18,13 @@ function Caption(props) {
|
|
|
17
18
|
var context = useDayPicker();
|
|
18
19
|
var classNames = context.classNames, numberOfMonths = context.numberOfMonths, disableNavigation = context.disableNavigation, styles = context.styles, captionLayout = context.captionLayout, onMonthChange = context.onMonthChange, dir = context.dir, CaptionLabel = context.components.CaptionLabel;
|
|
19
20
|
var _b = useNavigation(), previousMonth = _b.previousMonth, nextMonth = _b.nextMonth, goToMonth = _b.goToMonth, displayMonths = _b.displayMonths;
|
|
20
|
-
var handlePreviousClick = function (
|
|
21
|
+
var handlePreviousClick = function () {
|
|
21
22
|
if (!previousMonth)
|
|
22
23
|
return;
|
|
23
24
|
goToMonth(previousMonth);
|
|
24
25
|
onMonthChange === null || onMonthChange === void 0 ? void 0 : onMonthChange(previousMonth);
|
|
25
26
|
};
|
|
26
|
-
var handleNextClick = function (
|
|
27
|
+
var handleNextClick = function () {
|
|
27
28
|
if (!nextMonth)
|
|
28
29
|
return;
|
|
29
30
|
goToMonth(nextMonth);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Caption.js","sources":["../../../src/components/Caption/Caption.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Caption.js","sources":["../../../src/components/Caption/Caption.tsx"],"sourcesContent":["import React from 'react';\n\nimport { isSameMonth } from 'date-fns';\n\nimport { useDayPicker } from '../../contexts/DayPicker';\nimport { useNavigation } from '../../contexts/Navigation';\nimport { MonthsDropdown } from '../MonthsDropdown';\nimport { Navigation } from '../Navigation';\nimport { YearsDropdown } from '../YearsDropdown';\nimport { MonthChangeEventHandler } from '../../types/EventHandlers';\n\n/** Represent the props of the [[Caption]] component. */\nexport interface CaptionProps {\n /** The month where the caption is displayed. */\n displayMonth: Date;\n}\n\n/**\n * The layout of the caption:\n *\n * - `dropdown` - display a month / year dropdown\n * - `buttons` - display previous / next month button.\n */\nexport type CaptionLayout = 'dropdown' | 'buttons';\n\n/**\n * Render the caption of a month, which includes title and navigation buttons.\n * The caption has a different layout when setting the `numberOfMonths` prop.\n */\nexport function Caption(props: CaptionProps): JSX.Element {\n const { displayMonth } = props;\n const context = useDayPicker();\n const {\n classNames,\n numberOfMonths,\n disableNavigation,\n styles,\n captionLayout,\n onMonthChange,\n dir,\n components: { CaptionLabel }\n } = context;\n\n const { previousMonth, nextMonth, goToMonth, displayMonths } =\n useNavigation();\n\n const handlePreviousClick: React.MouseEventHandler = () => {\n if (!previousMonth) return;\n goToMonth(previousMonth);\n onMonthChange?.(previousMonth);\n };\n\n const handleNextClick: React.MouseEventHandler = () => {\n if (!nextMonth) return;\n goToMonth(nextMonth);\n onMonthChange?.(nextMonth);\n };\n\n const handleMonthChange: MonthChangeEventHandler = (newMonth) => {\n goToMonth(newMonth);\n onMonthChange?.(newMonth);\n };\n\n const displayIndex = displayMonths.findIndex((month) =>\n isSameMonth(displayMonth, month)\n );\n let isFirst = displayIndex === 0;\n let isLast = displayIndex === displayMonths.length - 1;\n if (dir === 'rtl') {\n [isLast, isFirst] = [isFirst, isLast];\n }\n\n const captionLabel = <CaptionLabel displayMonth={displayMonth} />;\n const hideNext = numberOfMonths > 1 && (isFirst || !isLast);\n const hidePrevious = numberOfMonths > 1 && (isLast || !isFirst);\n\n return (\n <div className={classNames.caption} style={styles.caption}>\n {disableNavigation && captionLabel}\n {!disableNavigation && (\n <>\n {captionLayout === 'dropdown' ? (\n <div\n className={classNames.caption_dropdowns}\n style={styles.caption_dropdowns}\n >\n <MonthsDropdown\n onChange={handleMonthChange}\n displayMonth={displayMonth}\n />\n <YearsDropdown\n onChange={handleMonthChange}\n displayMonth={displayMonth}\n />\n </div>\n ) : (\n <>\n <CaptionLabel displayMonth={displayMonth} />\n <Navigation\n displayMonth={displayMonth}\n hideNext={hideNext}\n hidePrevious={hidePrevious}\n nextMonth={nextMonth}\n previousMonth={previousMonth}\n onPreviousClick={handlePreviousClick}\n onNextClick={handleNextClick}\n />\n </>\n )}\n </>\n )}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;AAyBA;;;;SAIgB,OAAO,CAAC,KAAmB;;IACjC,IAAA,YAAY,GAAK,KAAK,aAAV,CAAW;IAC/B,IAAM,OAAO,GAAG,YAAY,EAAE,CAAC;IAE7B,IAAA,UAAU,GAQR,OAAO,WARC,EACV,cAAc,GAOZ,OAAO,eAPK,EACd,iBAAiB,GAMf,OAAO,kBANQ,EACjB,MAAM,GAKJ,OAAO,OALH,EACN,aAAa,GAIX,OAAO,cAJI,EACb,aAAa,GAGX,OAAO,cAHI,EACb,GAAG,GAED,OAAO,IAFN,EACW,YAAY,GACxB,OAAO,wBADiB,CAChB;IAEN,IAAA,KACJ,aAAa,EAAE,EADT,aAAa,mBAAA,EAAE,SAAS,eAAA,EAAE,SAAS,eAAA,EAAE,aAAa,mBACzC,CAAC;IAElB,IAAM,mBAAmB,GAA4B;QACnD,IAAI,CAAC,aAAa;YAAE,OAAO;QAC3B,SAAS,CAAC,aAAa,CAAC,CAAC;QACzB,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,aAAa,CAAC,CAAC;KAChC,CAAC;IAEF,IAAM,eAAe,GAA4B;QAC/C,IAAI,CAAC,SAAS;YAAE,OAAO;QACvB,SAAS,CAAC,SAAS,CAAC,CAAC;QACrB,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,SAAS,CAAC,CAAC;KAC5B,CAAC;IAEF,IAAM,iBAAiB,GAA4B,UAAC,QAAQ;QAC1D,SAAS,CAAC,QAAQ,CAAC,CAAC;QACpB,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,QAAQ,CAAC,CAAC;KAC3B,CAAC;IAEF,IAAM,YAAY,GAAG,aAAa,CAAC,SAAS,CAAC,UA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,CACD,CACJ,CACA,CACJ,CACG,EACN;AACJ;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { useDayPicker } from '../../contexts/DayPicker/useDayPicker.js';
|
|
3
|
+
import '../../contexts/DayPicker/DayPickerContext.js';
|
|
3
4
|
|
|
4
5
|
/** Render the caption for the displayed month. This component is used when `captionLayout="buttons"`. */
|
|
5
6
|
function CaptionLabel(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaptionLabel.js","sources":["../../../src/components/CaptionLabel/CaptionLabel.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"CaptionLabel.js","sources":["../../../src/components/CaptionLabel/CaptionLabel.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useDayPicker } from '../../contexts/DayPicker';\n\n/** The props for the [[CaptionLabel]] component. */\nexport interface CaptionLabelProps {\n /** The month where the caption is displayed. */\n displayMonth: Date;\n}\n\n/** Render the caption for the displayed month. This component is used when `captionLayout=\"buttons\"`. */\nexport function CaptionLabel(props: CaptionLabelProps): JSX.Element {\n const {\n locale,\n classNames,\n styles,\n formatters: { formatCaption }\n } = useDayPicker();\n return (\n <div\n key=\"caption\"\n className={classNames.caption_label}\n style={styles.caption_label}\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {formatCaption(props.displayMonth, { locale })}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;AAUA;SACgB,YAAY,CAAC,KAAwB;IAC7C,IAAA,KAKF,YAAY,EAAE,EAJhB,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,MAAM,YAAA,EACQ,aAAa,8BACX,CAAC;IACnB,QACE,6BACE,GAAG,EAAC,SAAS,EACb,SAAS,EAAE,UAAU,CAAC,aAAa,EACnC,KAAK,EAAE,MAAM,CAAC,aAAa,eACjB,QAAQ,iBACN,MAAM,IAEjB,aAAa,CAAC,KAAK,CAAC,YAAY,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAC1C,EACN;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Day.js","sources":["../../../src/components/Day/Day.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Day.js","sources":["../../../src/components/Day/Day.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Button } from '../Button';\n\nimport { useDay } from './hooks/useDay';\n\n/** Represent the props used by the [[Day]] component. */\nexport interface DayProps {\n /** The month where the date is displayed. */\n displayMonth: Date;\n /** The date to render. */\n date: Date;\n}\n\n/**\n * The content of a day cell – as a button or span element according to its\n * modifiers.\n */\nexport function Day(props: DayProps): JSX.Element {\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n\n const day = useDay(props.date, props.displayMonth, buttonRef);\n const { buttonProps, nonInteractiveProps } = day;\n\n if (!buttonProps && !nonInteractiveProps) {\n return <></>;\n }\n if (nonInteractiveProps) {\n return <div {...nonInteractiveProps} />;\n }\n return <Button ref={buttonRef} {...buttonProps} />;\n}\n"],"names":[],"mappings":";;;;;AAcA;;;;SAIgB,GAAG,CAAC,KAAe;IACjC,IAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAoB,IAAI,CAAC,CAAC;IAExD,IAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACtD,IAAA,WAAW,GAA0B,GAAG,YAA7B,EAAE,mBAAmB,GAAK,GAAG,oBAAR,CAAS;IAEjD,IAAI,CAAC,WAAW,IAAI,CAAC,mBAAmB,EAAE;QACxC,OAAO,yCAAK,CAAC;KACd;IACD,IAAI,mBAAmB,EAAE;QACvB,OAAO,wCAAS,mBAAmB,EAAI,CAAC;KACzC;IACD,OAAO,oBAAC,MAAM,aAAC,GAAG,EAAE,SAAS,IAAM,WAAW,EAAI,CAAC;AACrD;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DateRange, ModifierStatus,
|
|
3
|
-
import { SelectMultipleContextValue } from '../../../contexts/SelectMultiple';
|
|
4
|
-
import { SelectRangeContextValue } from '../../../contexts/SelectRange';
|
|
5
|
-
import { SelectSingleContextValue } from '../../../contexts/SelectSingle';
|
|
2
|
+
import { DateRange, ModifierStatus, StyledComponent } from '../../../types';
|
|
3
|
+
import { SelectMultipleContextValue } from '../../../contexts/SelectMultiple/SelectMultipleContext';
|
|
4
|
+
import { SelectRangeContextValue } from '../../../contexts/SelectRange/SelectRangeContext';
|
|
5
|
+
import { SelectSingleContextValue } from '../../../contexts/SelectSingle/SelectSingleContext';
|
|
6
6
|
export declare type UseDay = {
|
|
7
7
|
/** Whether the date is outside the display month/ */
|
|
8
8
|
isOutside: boolean;
|
|
@@ -22,7 +22,7 @@ export declare type UseDay = {
|
|
|
22
22
|
*
|
|
23
23
|
* When both this value and `buttonProps` are `undefined`, DayPicker should not render anything.
|
|
24
24
|
*/
|
|
25
|
-
nonInteractiveProps?:
|
|
25
|
+
nonInteractiveProps?: StyledComponent;
|
|
26
26
|
single: SelectSingleContextValue;
|
|
27
27
|
multiple: SelectMultipleContextValue;
|
|
28
28
|
range: SelectRangeContextValue;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { __assign } from '../../../_virtual/_tslib.js';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { isSameMonth } from 'date-fns';
|
|
4
|
-
import { isDayPickerMultiple } from '../../../types/
|
|
5
|
-
import { isDayPickerRange } from '../../../types/
|
|
6
|
-
import { isDayPickerSingle } from '../../../types/
|
|
4
|
+
import { isDayPickerMultiple } from '../../../types/DayPickerMultiple.js';
|
|
5
|
+
import { isDayPickerRange } from '../../../types/DayPickerRange.js';
|
|
6
|
+
import { isDayPickerSingle } from '../../../types/DayPickerSingle.js';
|
|
7
7
|
import { useDayPicker } from '../../../contexts/DayPicker/useDayPicker.js';
|
|
8
|
+
import '../../../contexts/DayPicker/DayPickerContext.js';
|
|
8
9
|
import '../../../contexts/SelectMultiple/SelectMultipleContext.js';
|
|
9
10
|
import { useSelectMultiple } from '../../../contexts/SelectMultiple/useSelectMultiple.js';
|
|
10
11
|
import '../../../contexts/SelectRange/SelectRangeContext.js';
|
|
11
12
|
import { useSelectRange } from '../../../contexts/SelectRange/useSelectRange.js';
|
|
12
13
|
import '../../../contexts/SelectSingle/SelectSingleContext.js';
|
|
13
14
|
import { useSelectSingle } from '../../../contexts/SelectSingle/useSelectSingle.js';
|
|
14
|
-
import 'date-fns/locale/en-US';
|
|
15
|
-
import { useModifiers } from '../../../hooks/useModifiers/useModifiers.js';
|
|
16
15
|
import { useDayFocus } from './useDayFocus.js';
|
|
16
|
+
import { useModifiers } from '../../../hooks/useModifiers/useModifiers.js';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* This hook returns details about the content to render in the day cell.
|
|
@@ -78,9 +78,9 @@ buttonRef) {
|
|
|
78
78
|
style = __assign(__assign({}, context.styles), context.styles.day_outside);
|
|
79
79
|
}
|
|
80
80
|
var DayContent = context.components.DayContent;
|
|
81
|
-
var children = (
|
|
81
|
+
var children = (React.createElement(DayContent, { date: date, displayMonth: displayMonth, modifiers: modifiers }));
|
|
82
82
|
var className = classNames.join(' ');
|
|
83
|
-
if (!context.mode) {
|
|
83
|
+
if (!context.mode && !context.onDayClick) {
|
|
84
84
|
return __assign(__assign({}, returnValue), { nonInteractiveProps: {
|
|
85
85
|
style: style,
|
|
86
86
|
className: className,
|
|
@@ -91,13 +91,13 @@ buttonRef) {
|
|
|
91
91
|
var handleClick = function (e) {
|
|
92
92
|
var _a, _b, _c, _d;
|
|
93
93
|
if (isDayPickerSingle(context)) {
|
|
94
|
-
(_a = single.
|
|
94
|
+
(_a = single.onDayClick) === null || _a === void 0 ? void 0 : _a.call(single, date, modifiers, e);
|
|
95
95
|
}
|
|
96
96
|
else if (isDayPickerMultiple(context)) {
|
|
97
|
-
(_b = multiple.
|
|
97
|
+
(_b = multiple.onDayClick) === null || _b === void 0 ? void 0 : _b.call(multiple, date, modifiers, e);
|
|
98
98
|
}
|
|
99
99
|
else if (isDayPickerRange(context)) {
|
|
100
|
-
(_c = range.
|
|
100
|
+
(_c = range.onDayClick) === null || _c === void 0 ? void 0 : _c.call(range, date, modifiers, e);
|
|
101
101
|
}
|
|
102
102
|
(_d = context.onDayClick) === null || _d === void 0 ? void 0 : _d.call(context, date, modifiers, e);
|
|
103
103
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDay.js","sources":["../../../../src/components/Day/hooks/useDay.tsx"],"sourcesContent":["import React from 'react';\n\nimport { isSameMonth } from 'date-fns';\n\nimport {\n DateRange,\n isDayPickerMultiple,\n isDayPickerRange,\n isDayPickerSingle,\n ModifierStatus,\n StyledComponentProps\n} from '../../../types';\n\nimport { useDayPicker } from '../../../contexts/DayPicker';\nimport {\n SelectMultipleContextValue,\n useSelectMultiple\n} from '../../../contexts/SelectMultiple';\nimport {\n SelectRangeContextValue,\n useSelectRange\n} from '../../../contexts/SelectRange';\nimport {\n SelectSingleContextValue,\n useSelectSingle\n} from '../../../contexts/SelectSingle';\nimport { useModifiers } from '../../../hooks';\n\nimport { useDayFocus } from './useDayFocus';\n\nexport type UseDay = {\n /** Whether the date is outside the display month/ */\n isOutside: boolean;\n /** The modifiers for the given date. */\n modifiers: ModifierStatus;\n /** The days in DayPicker currently selected. */\n selected: Date | Date[] | DateRange | undefined;\n /**\n * The props for rendering the day as interactive element.\n *\n * When `undefined`, DayPicker should render a non interactive element with non-interactive\n * props.\n */\n buttonProps?: Omit<React.HTMLProps<HTMLButtonElement>, 'ref'>;\n /**\n * The props for rendering the day as not interactive element.\n *\n * When both this value and `buttonProps` are `undefined`, DayPicker should not render anything.\n */\n nonInteractiveProps?: StyledComponentProps;\n single: SelectSingleContextValue;\n multiple: SelectMultipleContextValue;\n range: SelectRangeContextValue;\n};\n\n/**\n * This hook returns details about the content to render in the day cell.\n *\n *\n * When a day cell is rendered in the table, DayPicker can either:\n *\n * - render nothing: when the day is outside the month or has matched the\n * \"hidden\" modifier.\n * - render a button. When a selection mode is set, DayPicker renders a button\n * to allow the focus and the selection. In case of `custom` selection\n * mode, DayPicker expects a `onDayClick` prop to render a button.\n * - render a non-interactive element: when no selection mode is set, the day\n * cell shouldn’t respond to any interaction. DayPicker should render a `div`\n * or a `span`.\n *\n * ### Usage\n *\n * Use this hook to customize the behavior of the [[Day]] component. Create a\n * new `Day` component using this hook and pass it to the `components` prop.\n * The source of [[Day]] can be a good starting point.\n *\n * */\nexport function useDay(\n /** The day rendered in the month. */\n date: Date,\n /** The month where the date is displayed. DayPicker renders days outside the display month when `showOutsideDays` is true. */\n displayMonth: Date,\n /** A ref to the button element. */\n buttonRef: React.RefObject<HTMLButtonElement>\n): UseDay {\n const context = useDayPicker();\n const single = useSelectSingle();\n const multiple = useSelectMultiple();\n const range = useSelectRange();\n const { focus, blur, focusOnKeyDown, isFocused } = useDayFocus(\n date,\n buttonRef\n );\n\n const { modifiers, modifierClassNames, modifierStyle } = useModifiers(date);\n const isOutside = !isSameMonth(date, displayMonth);\n\n const returnValue = {\n isOutside,\n modifiers,\n selected: isDayPickerSingle(context)\n ? single.selected\n : isDayPickerMultiple(context)\n ? multiple.selected\n : isDayPickerRange(context)\n ? range.selected\n : undefined,\n single,\n multiple,\n range\n };\n if (isOutside && !context.showOutsideDays) {\n return returnValue;\n }\n if (modifiers.hidden) {\n return returnValue;\n }\n\n const classNames = [context.classNames.day].concat(modifierClassNames);\n let style: React.CSSProperties = { ...context.styles.day, ...modifierStyle };\n\n if (isOutside) {\n classNames.push(context.classNames.day_outside);\n style = { ...context.styles, ...context.styles.day_outside };\n }\n\n const { DayContent } = context.components;\n const children = (\n <DayContent date={date} displayMonth={displayMonth} modifiers={modifiers} />\n );\n\n let className = classNames.join(' ');\n\n if (!context.mode) {\n return {\n ...returnValue,\n nonInteractiveProps: {\n style,\n className,\n children\n }\n };\n }\n\n // #region Event handlers\n const handleClick: React.MouseEventHandler = (e) => {\n if (isDayPickerSingle(context)) {\n single.handleDayClick?.(date, modifiers, e);\n } else if (isDayPickerMultiple(context)) {\n multiple.handleDayClick?.(date, modifiers, e);\n } else if (isDayPickerRange(context)) {\n range.handleDayClick?.(date, modifiers, e);\n }\n context.onDayClick?.(date, modifiers, e);\n };\n\n const handleFocus: React.FocusEventHandler = (e) => {\n focus(date);\n context.onDayFocus?.(date, modifiers, e);\n };\n\n const handleBlur: React.FocusEventHandler = (e) => {\n blur();\n context.onDayBlur?.(date, modifiers, e);\n };\n\n const handleKeyDown: React.KeyboardEventHandler = (e) => {\n focusOnKeyDown(e);\n context.onDayKeyDown?.(date, modifiers, e);\n };\n\n const handleKeyUp: React.KeyboardEventHandler = (e) => {\n context.onDayKeyUp?.(date, modifiers, e);\n };\n const handleMouseEnter: React.MouseEventHandler = (e) => {\n context.onDayMouseEnter?.(date, modifiers, e);\n };\n const handleMouseLeave: React.MouseEventHandler = (e) => {\n context.onDayMouseLeave?.(date, modifiers, e);\n };\n const handleTouchCancel: React.TouchEventHandler = (e) => {\n context.onDayTouchCancel?.(date, modifiers, e);\n };\n const handleTouchEnd: React.TouchEventHandler = (e) => {\n context.onDayTouchEnd?.(date, modifiers, e);\n };\n const handleTouchMove: React.TouchEventHandler = (e) => {\n context.onDayTouchMove?.(date, modifiers, e);\n };\n const handleTouchStart: React.TouchEventHandler = (e) => {\n context.onDayTouchStart?.(date, modifiers, e);\n };\n\n if (isOutside) {\n classNames.push(context.classNames.day_outside);\n style = { ...context.styles, ...context.styles.day_outside };\n }\n\n className = classNames.join(' ');\n\n const { selected, disabled } = modifiers;\n\n const tabIndex = disabled || isFocused ? -1 : 0;\n\n return {\n ...returnValue,\n buttonProps: {\n children,\n 'aria-pressed': selected,\n style: style,\n disabled: disabled,\n className: className,\n tabIndex: tabIndex,\n onClick: handleClick,\n onFocus: handleFocus,\n onBlur: handleBlur,\n onKeyDown: handleKeyDown,\n onKeyUp: handleKeyUp,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n onTouchCancel: handleTouchCancel,\n onTouchEnd: handleTouchEnd,\n onTouchMove: handleTouchMove,\n onTouchStart: handleTouchStart\n }\n };\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;AAuDA;;;;;;;;;;;;;;;;;;;;;;SAsBgB,MAAM;AACpB;AACA,IAAU;AACV;AACA,YAAkB;AAClB;AACA,SAA6C;IAE7C,IAAM,OAAO,GAAG,YAAY,EAAE,CAAC;IAC/B,IAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IACjC,IAAM,QAAQ,GAAG,iBAAiB,EAAE,CAAC;IACrC,IAAM,KAAK,GAAG,cAAc,EAAE,CAAC;IACzB,IAAA,KAA6C,WAAW,CAC5D,IAAI,EACJ,SAAS,CACV,EAHO,KAAK,WAAA,EAAE,IAAI,UAAA,EAAE,cAAc,oBAAA,EAAE,SAAS,eAG7C,CAAC;IAEI,IAAA,KAAmD,YAAY,CAAC,IAAI,CAAC,EAAnE,SAAS,eAAA,EAAE,kBAAkB,wBAAA,EAAE,aAAa,mBAAuB,CAAC;IAC5E,IAAM,SAAS,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAEnD,IAAM,WAAW,GAAG;QAClB,SAAS,WAAA;QACT,SAAS,WAAA;QACT,QAAQ,EAAE,iBAAiB,CAAC,OAAO,CAAC;cAChC,MAAM,CAAC,QAAQ;cACf,mBAAmB,CAAC,OAAO,CAAC;kBAC5B,QAAQ,CAAC,QAAQ;kBACjB,gBAAgB,CAAC,OAAO,CAAC;sBACzB,KAAK,CAAC,QAAQ;sBACd,SAAS;QACb,MAAM,QAAA;QACN,QAAQ,UAAA;QACR,KAAK,OAAA;KACN,CAAC;IACF,IAAI,SAAS,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE;QACzC,OAAO,WAAW,CAAC;KACpB;IACD,IAAI,SAAS,CAAC,MAAM,EAAE;QACpB,OAAO,W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aAAa,EAAE,iBAAiB;YAChC,UAAU,EAAE,cAAc;YAC1B,WAAW,EAAE,eAAe;YAC5B,YAAY,EAAE,gBAAgB;SAC/B,IACD;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"useDay.js","sources":["../../../../src/components/Day/hooks/useDay.tsx"],"sourcesContent":["import React from 'react';\n\nimport { isSameMonth } from 'date-fns';\n\nimport {\n DateRange,\n isDayPickerMultiple,\n isDayPickerRange,\n isDayPickerSingle,\n ModifierStatus,\n StyledComponent\n} from '../../../types';\n\nimport { useDayPicker } from '../../../contexts/DayPicker';\nimport { useSelectMultiple } from '../../../contexts/SelectMultiple';\nimport { useSelectRange } from '../../../contexts/SelectRange';\nimport { useSelectSingle } from '../../../contexts/SelectSingle';\n\nimport { useDayFocus } from './useDayFocus';\nimport { SelectMultipleContextValue } from '../../../contexts/SelectMultiple/SelectMultipleContext';\nimport { SelectRangeContextValue } from '../../../contexts/SelectRange/SelectRangeContext';\nimport { SelectSingleContextValue } from '../../../contexts/SelectSingle/SelectSingleContext';\nimport { useModifiers } from '../../../hooks/useModifiers';\n\nexport type UseDay = {\n /** Whether the date is outside the display month/ */\n isOutside: boolean;\n /** The modifiers for the given date. */\n modifiers: ModifierStatus;\n /** The days in DayPicker currently selected. */\n selected: Date | Date[] | DateRange | undefined;\n /**\n * The props for rendering the day as interactive element.\n *\n * When `undefined`, DayPicker should render a non interactive element with non-interactive\n * props.\n */\n buttonProps?: Omit<React.HTMLProps<HTMLButtonElement>, 'ref'>;\n /**\n * The props for rendering the day as not interactive element.\n *\n * When both this value and `buttonProps` are `undefined`, DayPicker should not render anything.\n */\n nonInteractiveProps?: StyledComponent;\n single: SelectSingleContextValue;\n multiple: SelectMultipleContextValue;\n range: SelectRangeContextValue;\n};\n\n/**\n * This hook returns details about the content to render in the day cell.\n *\n *\n * When a day cell is rendered in the table, DayPicker can either:\n *\n * - render nothing: when the day is outside the month or has matched the\n * \"hidden\" modifier.\n * - render a button. When a selection mode is set, DayPicker renders a button\n * to allow the focus and the selection. In case of `custom` selection\n * mode, DayPicker expects a `onDayClick` prop to render a button.\n * - render a non-interactive element: when no selection mode is set, the day\n * cell shouldn’t respond to any interaction. DayPicker should render a `div`\n * or a `span`.\n *\n * ### Usage\n *\n * Use this hook to customize the behavior of the [[Day]] component. Create a\n * new `Day` component using this hook and pass it to the `components` prop.\n * The source of [[Day]] can be a good starting point.\n *\n * */\nexport function useDay(\n /** The day rendered in the month. */\n date: Date,\n /** The month where the date is displayed. DayPicker renders days outside the display month when `showOutsideDays` is true. */\n displayMonth: Date,\n /** A ref to the button element. */\n buttonRef: React.RefObject<HTMLButtonElement>\n): UseDay {\n const context = useDayPicker();\n const single = useSelectSingle();\n const multiple = useSelectMultiple();\n const range = useSelectRange();\n const { focus, blur, focusOnKeyDown, isFocused } = useDayFocus(\n date,\n buttonRef\n );\n\n const { modifiers, modifierClassNames, modifierStyle } = useModifiers(date);\n const isOutside = !isSameMonth(date, displayMonth);\n\n const returnValue = {\n isOutside,\n modifiers,\n selected: isDayPickerSingle(context)\n ? single.selected\n : isDayPickerMultiple(context)\n ? multiple.selected\n : isDayPickerRange(context)\n ? range.selected\n : undefined,\n single,\n multiple,\n range\n };\n if (isOutside && !context.showOutsideDays) {\n return returnValue;\n }\n if (modifiers.hidden) {\n return returnValue;\n }\n\n const classNames = [context.classNames.day].concat(modifierClassNames);\n let style: React.CSSProperties = { ...context.styles.day, ...modifierStyle };\n\n if (isOutside) {\n classNames.push(context.classNames.day_outside);\n style = { ...context.styles, ...context.styles.day_outside };\n }\n\n const { DayContent } = context.components;\n const children = (\n <DayContent date={date} displayMonth={displayMonth} modifiers={modifiers} />\n );\n\n let className = classNames.join(' ');\n\n if (!context.mode && !context.onDayClick) {\n return {\n ...returnValue,\n nonInteractiveProps: {\n style,\n className,\n children\n }\n };\n }\n\n // #region Event handlers\n const handleClick: React.MouseEventHandler = (e) => {\n if (isDayPickerSingle(context)) {\n single.onDayClick?.(date, modifiers, e);\n } else if (isDayPickerMultiple(context)) {\n multiple.onDayClick?.(date, modifiers, e);\n } else if (isDayPickerRange(context)) {\n range.onDayClick?.(date, modifiers, e);\n }\n context.onDayClick?.(date, modifiers, e);\n };\n\n const handleFocus: React.FocusEventHandler = (e) => {\n focus(date);\n context.onDayFocus?.(date, modifiers, e);\n };\n\n const handleBlur: React.FocusEventHandler = (e) => {\n blur();\n context.onDayBlur?.(date, modifiers, e);\n };\n\n const handleKeyDown: React.KeyboardEventHandler = (e) => {\n focusOnKeyDown(e);\n context.onDayKeyDown?.(date, modifiers, e);\n };\n\n const handleKeyUp: React.KeyboardEventHandler = (e) => {\n context.onDayKeyUp?.(date, modifiers, e);\n };\n const handleMouseEnter: React.MouseEventHandler = (e) => {\n context.onDayMouseEnter?.(date, modifiers, e);\n };\n const handleMouseLeave: React.MouseEventHandler = (e) => {\n context.onDayMouseLeave?.(date, modifiers, e);\n };\n const handleTouchCancel: React.TouchEventHandler = (e) => {\n context.onDayTouchCancel?.(date, modifiers, e);\n };\n const handleTouchEnd: React.TouchEventHandler = (e) => {\n context.onDayTouchEnd?.(date, modifiers, e);\n };\n const handleTouchMove: React.TouchEventHandler = (e) => {\n context.onDayTouchMove?.(date, modifiers, e);\n };\n const handleTouchStart: React.TouchEventHandler = (e) => {\n context.onDayTouchStart?.(date, modifiers, e);\n };\n\n if (isOutside) {\n classNames.push(context.classNames.day_outside);\n style = { ...context.styles, ...context.styles.day_outside };\n }\n\n className = classNames.join(' ');\n\n const { selected, disabled } = modifiers;\n\n const tabIndex = disabled || isFocused ? -1 : 0;\n\n return {\n ...returnValue,\n buttonProps: {\n children,\n 'aria-pressed': selected,\n style: style,\n disabled: disabled,\n className: className,\n tabIndex: tabIndex,\n onClick: handleClick,\n onFocus: handleFocus,\n onBlur: handleBlur,\n onKeyDown: handleKeyDown,\n onKeyUp: handleKeyUp,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n onTouchCancel: handleTouchCancel,\n onTouchEnd: handleTouchEnd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e;YAC5B,YAAY,EAAE,gBAAgB;SAC/B,IACD;AACJ;;;;"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { isSameDay } from 'date-fns';
|
|
3
|
-
import '../../../contexts/
|
|
3
|
+
import { useDayPicker } from '../../../contexts/DayPicker/useDayPicker.js';
|
|
4
4
|
import '../../../contexts/DayPicker/DayPickerContext.js';
|
|
5
|
-
import '../../../contexts/
|
|
5
|
+
import '../../../contexts/Focus/FocusContext.js';
|
|
6
6
|
import { useFocus } from '../../../contexts/Focus/useFocus.js';
|
|
7
7
|
|
|
8
8
|
/** Handle the focus for the day element. */
|
|
9
9
|
function useDayFocus(date, buttonRef) {
|
|
10
|
-
var _a = useFocus(), focusedDay = _a[0], _b = _a[1], focusDayAfter = _b.focusDayAfter, focusDayBefore = _b.focusDayBefore, focusWeekAfterDay = _b.focusWeekAfterDay, focusWeekBeforeDay = _b.focusWeekBeforeDay, blur = _b.blur, focus = _b.focus;
|
|
10
|
+
var _a = useFocus(), focusedDay = _a[0], _b = _a[1], focusDayAfter = _b.focusDayAfter, focusDayBefore = _b.focusDayBefore, focusWeekAfterDay = _b.focusWeekAfterDay, focusWeekBeforeDay = _b.focusWeekBeforeDay, blur = _b.blur, focus = _b.focus, focusMonthBefore = _b.focusMonthBefore, focusMonthAfter = _b.focusMonthAfter, focusYearBefore = _b.focusYearBefore, focusYearAfter = _b.focusYearAfter, focusStartOfWeek = _b.focusStartOfWeek, focusEndOfWeek = _b.focusEndOfWeek;
|
|
11
|
+
var dir = useDayPicker().dir;
|
|
11
12
|
// Focus the HTML element if this is the focused day.
|
|
12
13
|
React.useEffect(function () {
|
|
13
14
|
var _a;
|
|
@@ -22,12 +23,12 @@ function useDayFocus(date, buttonRef) {
|
|
|
22
23
|
case 'ArrowLeft':
|
|
23
24
|
e.preventDefault();
|
|
24
25
|
e.stopPropagation();
|
|
25
|
-
focusDayBefore();
|
|
26
|
+
dir === 'rtl' ? focusDayAfter() : focusDayBefore();
|
|
26
27
|
break;
|
|
27
28
|
case 'ArrowRight':
|
|
28
29
|
e.preventDefault();
|
|
29
30
|
e.stopPropagation();
|
|
30
|
-
focusDayAfter();
|
|
31
|
+
dir === 'rtl' ? focusDayBefore() : focusDayAfter();
|
|
31
32
|
break;
|
|
32
33
|
case 'ArrowDown':
|
|
33
34
|
e.preventDefault();
|
|
@@ -39,6 +40,26 @@ function useDayFocus(date, buttonRef) {
|
|
|
39
40
|
e.stopPropagation();
|
|
40
41
|
focusWeekBeforeDay();
|
|
41
42
|
break;
|
|
43
|
+
case 'PageUp':
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
e.shiftKey ? focusYearBefore() : focusMonthBefore();
|
|
47
|
+
break;
|
|
48
|
+
case 'PageDown':
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
e.shiftKey ? focusYearAfter() : focusMonthAfter();
|
|
52
|
+
break;
|
|
53
|
+
case 'Home':
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
focusStartOfWeek();
|
|
57
|
+
break;
|
|
58
|
+
case 'End':
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
focusEndOfWeek();
|
|
62
|
+
break;
|
|
42
63
|
}
|
|
43
64
|
};
|
|
44
65
|
var isFocused = Boolean(focusedDay && !isSameDay(focusedDay, date));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDayFocus.js","sources":["../../../../src/components/Day/hooks/useDayFocus.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"useDayFocus.js","sources":["../../../../src/components/Day/hooks/useDayFocus.ts"],"sourcesContent":["import React from 'react';\n\nimport { isSameDay } from 'date-fns';\n\nimport { useDayPicker } from '../../../contexts/DayPicker';\nimport { useFocus } from '../../../contexts/Focus';\n\n/** Handle the focus for the day element. */\nexport function useDayFocus(\n date: Date,\n buttonRef: React.RefObject<HTMLButtonElement>\n): {\n focus: (date: Date) => void;\n blur: () => void;\n focusOnKeyDown: React.KeyboardEventHandler;\n isFocused: boolean;\n} {\n const [\n focusedDay,\n {\n focusDayAfter,\n focusDayBefore,\n focusWeekAfterDay,\n focusWeekBeforeDay,\n blur,\n focus,\n focusMonthBefore,\n focusMonthAfter,\n focusYearBefore,\n focusYearAfter,\n focusStartOfWeek,\n focusEndOfWeek\n }\n ] = useFocus();\n const { dir } = useDayPicker();\n\n // Focus the HTML element if this is the focused day.\n React.useEffect(() => {\n if (!focusedDay) return;\n if (isSameDay(focusedDay, date)) {\n buttonRef.current?.focus();\n }\n }, [focusedDay, date, buttonRef]);\n\n const focusOnKeyDown: React.KeyboardEventHandler = (e) => {\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault();\n e.stopPropagation();\n dir === 'rtl' ? focusDayAfter() : focusDayBefore();\n break;\n case 'ArrowRight':\n e.preventDefault();\n e.stopPropagation();\n dir === 'rtl' ? focusDayBefore() : focusDayAfter();\n break;\n case 'ArrowDown':\n e.preventDefault();\n e.stopPropagation();\n focusWeekAfterDay();\n break;\n case 'ArrowUp':\n e.preventDefault();\n e.stopPropagation();\n focusWeekBeforeDay();\n break;\n case 'PageUp':\n e.preventDefault();\n e.stopPropagation();\n e.shiftKey ? focusYearBefore() : focusMonthBefore();\n break;\n case 'PageDown':\n e.preventDefault();\n e.stopPropagation();\n e.shiftKey ? focusYearAfter() : focusMonthAfter();\n break;\n case 'Home':\n e.preventDefault();\n e.stopPropagation();\n focusStartOfWeek();\n break;\n case 'End':\n e.preventDefault();\n e.stopPropagation();\n focusEndOfWeek();\n break;\n }\n };\n\n const isFocused = Boolean(focusedDay && !isSameDay(focusedDay, date));\n\n return { focus, blur, focusOnKeyDown, isFocused };\n}\n"],"names":[],"mappings":";;;;;;;AAOA;SACgB,WAAW,CACzB,IAAU,EACV,SAA6C;IAOvC,IAAA,KAgBF,QAAQ,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AC;gBACrB,MAAM;YACR,KAAK,QAAQ;gBACX,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,CAAC,CAAC,eAAe,EAAE,CAAC;gBACpB,CAAC,CAAC,QAAQ,GAAG,eAAe,EAAE,GAAG,gBAAgB,EAAE,CAAC;gBACpD,MAAM;YACR,KAAK,UAAU;gBACb,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,CAAC,CAAC,eAAe,EAAE,CAAC;gBACpB,CAAC,CAAC,QAAQ,GAAG,cAAc,EAAE,GAAG,eAAe,EAAE,CAAC;gBAClD,MAAM;YACR,KAAK,MAAM;gBACT,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,CAAC,CAAC,eAAe,EAAE,CAAC;gBACpB,gBAAgB,EAAE,CAAC;gBACnB,MAAM;YACR,KAAK,KAAK;gBACR,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,CAAC,CAAC,eAAe,EAAE,CAAC;gBACpB,cAAc,EAAE,CAAC;gBACjB,MAAM;SACT;KACF,CAAC;IAEF,IAAM,SAAS,GAAG,OAAO,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;IAEtE,OAAO,EAAE,KAAK,OAAA,EAAE,IAAI,MAAA,EAAE,cAAc,gBAAA,EAAE,SAAS,WAAA,EAAE,CAAC;AACpD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DayContent.js","sources":["../../../src/components/DayContent/DayContent.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"DayContent.js","sources":["../../../src/components/DayContent/DayContent.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useDayPicker } from '../../contexts/DayPicker';\n\nimport { ModifierStatus } from '../../types';\n\n/** Represent the props for the [[DayContent]] component. */\nexport interface DayContentProps {\n /** The date representing the day. */\n date: Date;\n /** The month where the day is displayed. */\n displayMonth: Date;\n /** The modifier status for the date. */\n modifiers: ModifierStatus;\n}\n\n/**\n * Render the content of the day cell.\n */\nexport function DayContent(props: DayContentProps): JSX.Element {\n const {\n locale,\n classNames,\n styles,\n labels: { labelDay },\n formatters: { formatDay }\n } = useDayPicker();\n\n return (\n <>\n <span aria-hidden=\"true\">{formatDay(props.date, { locale })}</span>\n <span className={classNames.vhidden} style={styles.vhidden}>\n {labelDay(props.date, props.modifiers, { locale })}\n </span>\n </>\n );\n}\n"],"names":[],"mappings":";;;;AAgBA;;;SAGgB,UAAU,CAAC,KAAsB;IACzC,IAAA,KAMF,YAAY,EAAE,EALhB,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,MAAM,YAAA,EACI,QAAQ,qBAAA,EACJ,SAAS,0BACP,CAAC;IAEnB,QACE;QACE,6CAAkB,MAAM,IAAE,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAQ;QACnE,8BAAM,SAAS,EAAE,UAAU,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,IACvD,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAC7C,CACN,EACH;AACJ;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { useDayPicker } from '../../contexts/DayPicker/useDayPicker.js';
|
|
3
|
+
import '../../contexts/DayPicker/DayPickerContext.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Render a styled select component – displaying a caption and a custom
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.js","sources":["../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sources":["../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useDayPicker } from '../../contexts/DayPicker';\n\n/** The props for the [[Dropdown]] component. */\nexport interface DropdownProps {\n caption?: React.ReactNode;\n children?: React.SelectHTMLAttributes<HTMLSelectElement>['children'];\n className?: string;\n ['aria-label']?: string;\n style?: React.CSSProperties;\n value?: React.SelectHTMLAttributes<HTMLSelectElement>['value'];\n onChange?: React.ChangeEventHandler<HTMLSelectElement>;\n}\n\n/**\n * Render a styled select component – displaying a caption and a custom\n * drop-down icon.\n */\nexport function Dropdown(props: DropdownProps): JSX.Element {\n const { onChange, value, children, caption, className, style } = props;\n const {\n classNames,\n styles,\n components: { IconDropdown }\n } = useDayPicker();\n return (\n <div className={className} style={style}>\n <span className={classNames.vhidden}>{props['aria-label']}</span>\n <select\n aria-label={props['aria-label']}\n className={classNames.dropdown}\n style={styles.dropdown}\n value={value}\n onChange={onChange}\n >\n {children}\n </select>\n <div\n className={classNames.caption_label}\n style={styles.caption_label}\n aria-hidden=\"true\"\n >\n {caption}\n {\n <IconDropdown\n className={classNames.dropdown_icon}\n style={styles.dropdown_icon}\n />\n }\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;AAeA;;;;SAIgB,QAAQ,CAAC,KAAoB;IACnC,IAAA,QAAQ,GAAiD,KAAK,SAAtD,EAAE,KAAK,GAA0C,KAAK,MAA/C,EAAE,QAAQ,GAAgC,KAAK,SAArC,EAAE,OAAO,GAAuB,KAAK,QAA5B,EAAE,SAAS,GAAY,KAAK,UAAjB,EAAE,KAAK,GAAK,KAAK,MAAV,CAAW;IACjE,IAAA,KAIF,YAAY,EAAE,EAHhB,UAAU,gBAAA,EACV,MAAM,YAAA,EACQ,YAAY,6BACV,CAAC;IACnB,QACE,6BAAK,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK;QACrC,8BAAM,SAAS,EAAE,UAAU,CAAC,OAAO,IAAG,KAAK,CAAC,YAAY,CAAC,CAAQ;QACjE,8CACc,KAAK,CAAC,YAAY,CAAC,EAC/B,SAAS,EAAE,UAAU,CAAC,QAAQ,EAC9B,KAAK,EAAE,MAAM,CAAC,QAAQ,EACtB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,IAEjB,QAAQ,CACF;QACT,6BACE,SAAS,EAAE,UAAU,CAAC,aAAa,EACnC,KAAK,EAAE,MAAM,CAAC,aAAa,iBACf,MAAM;YAEjB,OAAO;YAEN,oBAAC,YAAY,IACX,SAAS,EAAE,UAAU,CAAC,aAAa,EACnC,KAAK,EAAE,MAAM,CAAC,aAAa,GAC3B,CAEA,CACF,EACN;AACJ;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { useDayPicker } from '../../contexts/DayPicker/useDayPicker.js';
|
|
3
|
+
import '../../contexts/DayPicker/DayPickerContext.js';
|
|
3
4
|
|
|
4
5
|
/** Render the Footer component (empty as default).*/
|
|
5
6
|
function Footer() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Footer.js","sources":["../../../src/components/Footer/Footer.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Footer.js","sources":["../../../src/components/Footer/Footer.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useDayPicker } from '../../contexts/DayPicker';\n\n/** Render the Footer component (empty as default).*/\nexport function Footer(): JSX.Element {\n const {\n footer,\n styles,\n classNames: { tfoot }\n } = useDayPicker();\n if (!footer) return <></>;\n return (\n <tfoot className={tfoot} style={styles.tfoot}>\n <tr>\n <td colSpan={8}>{footer}</td>\n </tr>\n </tfoot>\n );\n}\n"],"names":[],"mappings":";;;;AAIA;SACgB,MAAM;IACd,IAAA,KAIF,YAAY,EAAE,EAHhB,MAAM,YAAA,EACN,MAAM,YAAA,EACQ,KAAK,sBACH,CAAC;IACnB,IAAI,CAAC,MAAM;QAAE,OAAO,yCAAK,CAAC;IAC1B,QACE,+BAAO,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK;QAC1C;YACE,4BAAI,OAAO,EAAE,CAAC,IAAG,MAAM,CAAM,CAC1B,CACC,EACR;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Head.js","sources":["../../../src/components/Head/Head.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Head.js","sources":["../../../src/components/Head/Head.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useDayPicker } from '../../contexts/DayPicker';\n\nimport { getWeekdays } from './utils';\n\n/**\n * Render the Head component - i.e. the table head with the weekday names.\n */\nexport function Head(): JSX.Element {\n const {\n classNames,\n styles,\n showWeekNumber,\n locale,\n formatters: { formatWeekdayName },\n labels: { labelWeekday }\n } = useDayPicker();\n\n const weekdays = getWeekdays(locale);\n\n return (\n <thead style={styles.head} className={classNames.head}>\n <tr style={styles.head_row} className={classNames.head_row}>\n {showWeekNumber && (\n <th\n scope=\"col\"\n style={styles.head_cell}\n className={classNames.head_cell}\n ></th>\n )}\n {weekdays.map((weekday, i) => (\n <th\n key={i}\n scope=\"col\"\n className={classNames.head_cell}\n style={styles.head_cell}\n >\n <span className={classNames.vhidden} aria-label=\"\">\n {labelWeekday(weekday, { locale })}\n </span>\n <span aria-hidden={true}>\n {formatWeekdayName(weekday, { locale })}\n </span>\n </th>\n ))}\n </tr>\n </thead>\n );\n}\n"],"names":[],"mappings":";;;;;AAMA;;;SAGgB,IAAI;IACZ,IAAA,KAOF,YAAY,EAAE,EANhB,UAAU,gBAAA,EACV,MAAM,YAAA,EACN,cAAc,oBAAA,EACd,MAAM,YAAA,EACQ,iBAAiB,kCAAA,EACrB,YAAY,yBACN,CAAC;IAEnB,IAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAErC,QACE,+BAAO,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,IAAI;QACnD,4BAAI,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,QAAQ;YACvD,cAAc,KACb,4BACE,KAAK,EAAC,KAAK,EACX,KAAK,EAAE,MAAM,CAAC,SAAS,EACvB,SAAS,EAAE,UAAU,CAAC,SAAS,GAC3B,CACP;YACA,QAAQ,CAAC,GAAG,CAAC,UAAC,OAAO,EAAE,CAAC,IAAK,QAC5B,4BACE,GAAG,EAAE,CAAC,EACN,KAAK,EAAC,KAAK,EACX,SAAS,EAAE,UAAU,CAAC,SAAS,EAC/B,KAAK,EAAE,MAAM,CAAC,SAAS;gBAEvB,8BAAM,SAAS,EAAE,UAAU,CAAC,OAAO,gBAAa,EAAE,IAC/C,YAAY,CAAC,OAAO,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAC7B;gBACP,6CAAmB,IAAI,IACpB,iBAAiB,CAAC,OAAO,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAClC,CACJ,IACN,CAAC,CACC,CACC,EACR;AACJ;;;;"}
|