react-day-picker 8.0.0-beta.32 → 8.0.0-beta.33
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 +12 -3
- package/build/DayPicker.d.ts +3 -2
- 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 +1 -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 +8 -8
- package/build/components/Caption/Caption.js.map +1 -1
- package/build/components/CaptionLabel/CaptionLabel.js +1 -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 +2 -2
- package/build/components/Day/hooks/useDay.js +5 -5
- 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 +1 -1
- package/build/components/Day/hooks/useDayFocus.js.map +1 -1
- package/build/components/DayContent/DayContent.js +1 -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 +1 -1
- package/build/components/Dropdown/Dropdown.js.map +1 -1
- package/build/components/Footer/Footer.js +1 -1
- package/build/components/Footer/Footer.js.map +1 -1
- package/build/components/Head/Head.js +1 -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 +2 -2
- package/build/components/IconLeft/IconLeft.js +3 -3
- package/build/components/IconLeft/IconLeft.js.map +1 -1
- package/build/components/IconRight/IconRight.d.ts +2 -2
- package/build/components/IconRight/IconRight.js +3 -3
- package/build/components/IconRight/IconRight.js.map +1 -1
- package/build/components/MonthsDropdown/MonthsDropdown.d.ts +1 -1
- package/build/components/MonthsDropdown/MonthsDropdown.js +1 -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 +1 -1
- package/build/components/Navigation/Navigation.js.map +1 -1
- package/build/components/Root/Root.js +1 -2
- package/build/components/Root/Root.js.map +1 -1
- package/build/components/Row/Row.js +1 -1
- package/build/components/Row/Row.js.map +1 -1
- package/build/components/Table/Table.js +1 -1
- package/build/components/Table/Table.js.map +1 -1
- package/build/components/WeekNumber/WeekNumber.js +1 -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 +1 -1
- package/build/components/YearsDropdown/YearsDropdown.js.map +1 -1
- 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 +1 -1
- 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/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.js +1 -0
- package/build/contexts/DayPicker/utils/parseModifierProps.js.map +1 -1
- package/build/contexts/Focus/FocusContext.d.ts +5 -1
- package/build/contexts/Focus/FocusContext.js +63 -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 +23 -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/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 +14 -2
- 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 +14 -3
- 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 +17 -3
- 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/useControlledValue/useControlledValue.js +2 -2
- package/build/hooks/useControlledValue/useControlledValue.js.map +1 -1
- package/build/hooks/useInput/useInput.d.ts +11 -32
- package/build/hooks/useInput/useInput.js +2 -4
- package/build/hooks/useInput/useInput.js.map +1 -1
- package/build/hooks/useModifiers/useModifiers.js +3 -5
- package/build/hooks/useModifiers/useModifiers.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 +11 -22
- package/build/main.js.map +1 -1
- package/build/types/{DayPickerProps.d.ts → DayPicker.d.ts} +35 -16
- package/build/types/DayPickerCustom.d.ts +11 -0
- package/build/types/{isDayPickerCustom.js → DayPickerCustom.js} +1 -1
- package/build/types/DayPickerCustom.js.map +1 -0
- package/build/types/{DayPickerMultipleProps.d.ts → DayPickerMultiple.d.ts} +5 -5
- package/build/types/{isDayPickerMultiple.js → DayPickerMultiple.js} +1 -1
- package/build/types/DayPickerMultiple.js.map +1 -0
- package/build/types/{DayPickerRangeProps.d.ts → DayPickerRange.d.ts} +6 -6
- package/build/types/{isDayPickerRange.js → DayPickerRange.js} +1 -1
- package/build/types/DayPickerRange.js.map +1 -0
- package/build/types/DayPickerSingle.d.ts +14 -0
- 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 -12
- 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 +7 -50
- package/dist/main.js +555 -589
- package/dist/main.js.map +1 -1
- package/package.json +3 -2
- 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 -23
- package/build/contexts/SelectMultiple/SelectMultipleProvider.js.map +0 -1
- package/build/contexts/SelectMultiple/SelectMultipleProviderInternal.d.ts +0 -8
- package/build/contexts/SelectMultiple/SelectMultipleProviderInternal.js +0 -61
- package/build/contexts/SelectMultiple/SelectMultipleProviderInternal.js.map +0 -1
- package/build/contexts/SelectRange/SelectRangeProvider.d.ts +0 -9
- package/build/contexts/SelectRange/SelectRangeProvider.js +0 -26
- package/build/contexts/SelectRange/SelectRangeProvider.js.map +0 -1
- package/build/contexts/SelectRange/SelectRangeProviderInternal.d.ts +0 -8
- package/build/contexts/SelectRange/SelectRangeProviderInternal.js +0 -99
- package/build/contexts/SelectRange/SelectRangeProviderInternal.js.map +0 -1
- package/build/contexts/SelectSingle/SelectSingleProvider.d.ts +0 -9
- package/build/contexts/SelectSingle/SelectSingleProvider.js +0 -20
- package/build/contexts/SelectSingle/SelectSingleProvider.js.map +0 -1
- package/build/contexts/SelectSingle/SelectSingleProviderInternal.d.ts +0 -8
- package/build/contexts/SelectSingle/SelectSingleProviderInternal.js +0 -27
- package/build/contexts/SelectSingle/SelectSingleProviderInternal.js.map +0 -1
- 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/DayPickerCustomProps.d.ts +0 -11
- package/build/types/DayPickerSingleProps.d.ts +0 -14
- 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/StyledElement.d.ts +0 -76
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthsDropdown.js","sources":["../../../src/components/MonthsDropdown/MonthsDropdown.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"MonthsDropdown.js","sources":["../../../src/components/MonthsDropdown/MonthsDropdown.tsx"],"sourcesContent":["import React from 'react';\n\nimport { isSameYear, setMonth as setDateMonth, startOfMonth } from 'date-fns';\n\nimport { useDayPicker } from '../../contexts/DayPicker';\nimport { MonthChangeEventHandler } from '../../types/EventHandlers';\n\n/** The props for the [[MonthsDropdown]] component. */\nexport interface MonthsDropdownProps {\n /** The month where the dropdown is displayed. */\n displayMonth: Date;\n onChange: MonthChangeEventHandler;\n}\n\n/**\n * Render the dropdown to navigate between months.\n */\nexport function MonthsDropdown(props: MonthsDropdownProps): JSX.Element {\n const { displayMonth } = props;\n\n const {\n fromDate,\n toDate,\n styles,\n locale,\n formatters: { formatMonthCaption },\n classNames,\n components: { Dropdown },\n labels: { labelMonthDropdown }\n } = useDayPicker();\n\n if (!fromDate && !toDate) {\n // TODO: use type guards\n return <></>;\n }\n const dropdownMonths: Date[] = [];\n\n if (fromDate && toDate) {\n if (isSameYear(fromDate, toDate)) {\n // only display the months included in the range\n for (\n let month = fromDate.getMonth();\n month <= toDate.getMonth();\n month++\n ) {\n dropdownMonths.push(setDateMonth(startOfMonth(fromDate), month));\n }\n } else {\n // display all the 12 months\n for (let month = 0; month <= 11; month++) {\n const anyDate = new Date(); // any date is OK, we just need the year\n dropdownMonths.push(setDateMonth(startOfMonth(anyDate), month));\n }\n }\n }\n\n const handleChange: React.ChangeEventHandler<HTMLSelectElement> = (e) => {\n const newMonth = setDateMonth(\n new Date(displayMonth),\n Number(e.target.value)\n );\n props.onChange(newMonth);\n };\n\n return (\n <Dropdown\n aria-label={labelMonthDropdown()}\n className={classNames.dropdown_month}\n style={styles.dropdown_month}\n onChange={handleChange}\n value={displayMonth.getMonth()}\n caption={formatMonthCaption(displayMonth, { locale })}\n >\n {dropdownMonths.map((m) => (\n <option key={m.getMonth()} value={m.getMonth()}>\n {formatMonthCaption(m, { locale })}\n </option>\n ))}\n </Dropdown>\n );\n}\n"],"names":["setDateMonth"],"mappings":";;;;AAcA;;;SAGgB,cAAc,CAAC,KAA0B;IAC/C,IAAA,YAAY,GAAK,KAAK,aAAV,CAAW;IAEzB,IAAA,KASF,YAAY,EAAE,EARhB,QAAQ,cAAA,EACR,MAAM,YAAA,EACN,MAAM,YAAA,EACN,MAAM,YAAA,EACQ,kBAAkB,mCAAA,EAChC,UAAU,gBAAA,EACI,QAAQ,yBAAA,EACZ,kBAAkB,+BAC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CAAC,UAAC,CAAC,IAAK,QACzB,gCAAQ,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE,IAC3C,kBAAkB,CAAC,CAAC,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAC3B,IACV,CAAC,CACO,EACX;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navigation.js","sources":["../../../src/components/Navigation/Navigation.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Navigation.js","sources":["../../../src/components/Navigation/Navigation.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useDayPicker } from '../../contexts/DayPicker';\nimport { Button } from '../Button';\n\n/** The props for the [[Navigation]] component. */\nexport interface NavigationProps {\n /** The month where the caption is displayed. */\n displayMonth: Date;\n /** The previous month. */\n previousMonth?: Date;\n /** The next month. */\n nextMonth?: Date;\n /** Hide the previous button. */\n hidePrevious: boolean;\n /** Hide the next button. */\n hideNext: boolean;\n /** Event handler when the next button is clicked. */\n onNextClick: React.MouseEventHandler<HTMLButtonElement>;\n /** Event handler when the previous button is clicked. */\n onPreviousClick: React.MouseEventHandler<HTMLButtonElement>;\n}\n\n/** A component rendering the navigation buttons or the drop-downs. */\nexport function Navigation(props: NavigationProps): JSX.Element {\n const {\n dir,\n locale,\n classNames,\n styles,\n labels: { labelPrevious, labelNext },\n components: { IconRight, IconLeft }\n } = useDayPicker();\n let { onPreviousClick, onNextClick } = props;\n if (dir === 'rtl') {\n [onNextClick, onPreviousClick] = [onPreviousClick, onNextClick];\n }\n\n const { previousMonth, nextMonth } = props;\n\n const previousLabel = labelPrevious(previousMonth, { locale });\n const previousClassName = [\n classNames.nav_button,\n classNames.nav_button_previous\n ].join(' ');\n\n const nextLabel = labelNext(nextMonth, { locale });\n const nextClassName = [\n classNames.nav_button,\n classNames.nav_button_next\n ].join(' ');\n\n if (!nextMonth && !previousMonth) {\n return <></>;\n }\n\n return (\n <div className={classNames.nav} style={styles.nav}>\n {!props.hidePrevious && (\n <Button\n aria-label={previousLabel}\n className={previousClassName}\n style={styles.nav_button_next}\n disabled={!previousMonth}\n onClick={dir === 'rtl' ? onNextClick : onPreviousClick}\n >\n {dir === 'rtl' ? (\n <IconRight\n className={classNames.nav_icon}\n style={styles.nav_icon}\n />\n ) : (\n <IconLeft className={classNames.nav_icon} style={styles.nav_icon} />\n )}\n </Button>\n )}\n {!props.hideNext && (\n <Button\n aria-label={nextLabel}\n className={nextClassName}\n style={styles.nav_button_next}\n disabled={!nextMonth}\n onClick={dir === 'rtl' ? onPreviousClick : onNextClick}\n >\n {dir === 'rtl' ? (\n <IconLeft className={classNames.nav_icon} style={styles.nav_icon} />\n ) : (\n <IconRight\n className={classNames.nav_icon}\n style={styles.nav_icon}\n />\n )}\n </Button>\n )}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;AAuBA;SACgB,UAAU,CAAC,KAAsB;;IACzC,IAAA,KAOF,YAAY,EAAE,EANhB,GAAG,SAAA,EACH,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,MAAM,YAAA,EACN,cAAoC,EAA1B,aAAa,mBAAA,EAAE,SAAS,eAAA,EAClC,kBAAmC,EAArB,SAAS,eAAA,EAAE,QAAQ,cACjB,CAAC;IACb,IAAA,eAAe,GAAkB,KAAK,gBAAvB,EAAE,WAAW,GAAK,KAAK,YAAV,CAAW;IAC7C,IAAI,GAAG,KAAK,KAAK,EAAE;QACjB,KAAiC,CAAC,eAAe,EAAE,WAAW,CAAC,EAA9D,WAAW,QAAA,EAAE,eAAe,QAAA,CAAmC;KACjE;IAEO,IAAA,aAAa,GAAgB,KAAK,cAArB,EAAE,SAAS,GAAK,KAAK,UAAV,CAAW;IAE3C,IAAM,aAAa,GAAG,aAAa,CAAC,aAAa,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;IAC/D,IAAM,iBAAiB,GAAG;QACxB,UAAU,CAAC,UAAU;QACrB,UAAU,CAA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AS,IACR,SAAS,EAAE,UAAU,CAAC,QAAQ,EAC9B,KAAK,EAAE,MAAM,CAAC,QAAQ,GACtB,CACH,CACM,CACV,CACG,EACN;AACJ;;;;"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { __assign } from '../../_virtual/_tslib.js';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { Table } from '../Table/Table.js';
|
|
4
4
|
import { useDayPicker } from '../../contexts/DayPicker/useDayPicker.js';
|
|
5
5
|
import '../../contexts/Navigation/NavigationContext.js';
|
|
6
|
-
import 'date-fns';
|
|
7
6
|
import { useNavigation } from '../../contexts/Navigation/useNavigation.js';
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Root.js","sources":["../../../src/components/Root/Root.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Root.js","sources":["../../../src/components/Root/Root.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Table } from '../Table';\nimport { useDayPicker } from '../../contexts/DayPicker';\nimport { useNavigation } from '../../contexts/Navigation';\n\n/**\n * Render the container with the months and their captions. The number of months\n * rendered depends by the `numberOfMonths` prop.\n */\nexport function Root(): JSX.Element {\n const {\n dir,\n className,\n classNames,\n style,\n styles,\n numberOfMonths,\n showWeekNumber,\n components: { Caption }\n } = useDayPicker();\n\n const { displayMonths } = useNavigation();\n\n const rootClassNames = [className ?? classNames.root];\n if (numberOfMonths > 1) {\n rootClassNames.push(classNames.multiple_month);\n }\n if (showWeekNumber) {\n rootClassNames.push(classNames.with_weeknumber);\n }\n if (className) rootClassNames.concat(className.split(' '));\n\n const renderMonth = (displayMonth: Date, displayIndex: number) => {\n const className = [classNames.month];\n const style = { ...styles.month };\n let isFirst = displayIndex === 0;\n let isLast = displayIndex === displayMonths.length - 1;\n\n if (dir === 'rtl') [isLast, isFirst] = [isFirst, isLast];\n\n if (isFirst) {\n className.push(classNames.caption_first);\n Object.assign(style, styles.caption_first);\n }\n if (isLast) className.push(classNames.caption_last);\n if (!isFirst && !isLast) className.push(classNames.caption_middle);\n\n return (\n <div key={displayIndex} className={className.join(' ')} style={style}>\n <Caption displayMonth={displayMonth} />\n <Table displayMonth={displayMonth} />\n </div>\n );\n };\n\n return (\n <div\n className={rootClassNames.join(' ')}\n style={{ ...styles.root, ...style }}\n dir={dir}\n >\n <div className={classNames.months} style={styles.months}>\n {displayMonths.map(renderMonth)}\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAMA;;;;SAIgB,IAAI;IACZ,IAAA,KASF,YAAY,EAAE,EARhB,GAAG,SAAA,EACH,SAAS,eAAA,EACT,UAAU,gBAAA,EACV,KAAK,WAAA,EACL,MAAM,YAAA,EACN,cAAc,oBAAA,EACd,cAAc,oBAAA,EACA,OAAO,wBACL,CAAC;IAEX,IAAA,aAAa,GAAK,aAAa,EAAE,cAApB,CAAqB;IAE1C,IAAM,cAAc,GAAG,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IACtD,IAAI,cAAc,GAAG,CAAC,EAAE;QACtB,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;KAChD;IACD,IAAI,cAAc,EAAE;QAClB,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;KACjD;IACD,IAAI,SAAS;QAAE,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAE3D,IAAM,WAAW,GAAG,UAAC,YAAkB,EAAE,YAAoB;;QAC3D,IAAM,SAAS,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACrC,IAAM,KAAK,gBAAQ,MAAM,CAAC,KAAK,CAAE,CAAC;QAClC,IAAI,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC;QACjC,IAAI,MAAM,GAAG,YAAY,KAAK,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;QAEvD,IAAI,GAAG,KAAK,KAAK;YAAE,KAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,EAApC,MAAM,QAAA,EAAE,OAAO,QAAA,CAAsB;QAEzD,IAAI,OAAO,EAAE;YACX,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;YACzC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;SAC5C;QACD,IAAI,MAAM;YAAE,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QACpD,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM;YAAE,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QAEnE,QACE,6BAAK,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK;YAClE,oBAAC,OAAO,IAAC,YAAY,EAAE,YAAY,GAAI;YACvC,oBAAC,KAAK,IAAC,YAAY,EAAE,YAAY,GAAI,CACjC,EACN;KACH,CAAC;IAEF,QACE,6BACE,SAAS,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,EACnC,KAAK,wBAAO,MAAM,CAAC,IAAI,GAAK,KAAK,GACjC,GAAG,EAAE,GAAG;QAER,6BAAK,SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,IACpD,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,CAC3B,CACF,EACN;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Row.js","sources":["../../../src/components/Row/Row.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Row.js","sources":["../../../src/components/Row/Row.tsx"],"sourcesContent":["import React from 'react';\n\nimport { getUnixTime } from 'date-fns';\n\nimport { useDayPicker } from '../../contexts/DayPicker';\n\n/**\n * The props for the [[Row]] component.\n */\nexport interface RowProps {\n /** The month where the row is displayed. */\n displayMonth: Date;\n /** The number of the week to render. */\n weekNumber: number;\n /** The days contained in the week. */\n dates: Date[];\n}\n\n/**\n * Render a row in the calendar, with the days and optionally the week number.\n */\nexport function Row(props: RowProps): JSX.Element {\n const {\n styles,\n classNames,\n showWeekNumber,\n components: { Day, WeekNumber }\n } = useDayPicker();\n\n let weekNumberCell;\n if (showWeekNumber) {\n weekNumberCell = (\n <td className={classNames.cell} style={styles.cell}>\n <WeekNumber number={props.weekNumber} dates={props.dates} />\n </td>\n );\n }\n\n return (\n <tr className={classNames.row} style={styles.row}>\n {weekNumberCell}\n {props.dates.map((date) => (\n <td\n className={classNames.cell}\n style={styles.cell}\n key={getUnixTime(date)}\n >\n <Day displayMonth={props.displayMonth} date={date} />\n </td>\n ))}\n </tr>\n );\n}\n"],"names":[],"mappings":";;;;AAkBA;;;SAGgB,GAAG,CAAC,KAAe;IAC3B,IAAA,KAKF,YAAY,EAAE,EAJhB,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,cAAc,oBAAA,EACd,kBAA+B,EAAjB,GAAG,SAAA,EAAE,UAAU,gBACb,CAAC;IAEnB,IAAI,cAAc,CAAC;IACnB,IAAI,cAAc,EAAE;QAClB,cAAc,IACZ,4BAAI,SAAS,EAAE,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI;YAChD,oBAAC,UAAU,IAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAI,CACzD,CACN,CAAC;KACH;IAED,QACE,4BAAI,SAAS,EAAE,UAAU,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG;QAC7C,cAAc;QACd,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,QACzB,4BACE,SAAS,EAAE,UAAU,CAAC,IAAI,EAC1B,KAAK,EAAE,MAAM,CAAC,IAAI,EAClB,GAAG,EAAE,WAAW,CAAC,IAAI,CAAC;YAEtB,oBAAC,GAAG,IAAC,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,GAAI,CAClD,IACN,CAAC,CACC,EACL;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","sources":["../../../src/components/Table/Table.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Table.js","sources":["../../../src/components/Table/Table.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useDayPicker } from '../../contexts/DayPicker';\n\nimport { getWeeks } from './utils/getWeeks';\n\n/**\n * The props for the [[Table]] component.\n */\nexport interface TableProps {\n /** The month where the table is displayed. */\n displayMonth: Date;\n}\n\n/**\n * Render the table with the calendar.\n */\nexport function Table(props: TableProps): JSX.Element {\n const {\n locale,\n classNames,\n styles,\n hideHead,\n fixedWeeks,\n components: { Head, Row, Footer }\n } = useDayPicker();\n const weeks = getWeeks(props.displayMonth, { locale, fixedWeeks });\n return (\n <table className={classNames.table} style={styles.table}>\n {!hideHead && <Head />}\n <tbody className={classNames.tbody} style={styles.tbody}>\n {weeks.map((week) => (\n <Row\n displayMonth={props.displayMonth}\n key={week.weekNumber}\n dates={week.dates}\n weekNumber={week.weekNumber}\n />\n ))}\n </tbody>\n <Footer />\n </table>\n );\n}\n"],"names":[],"mappings":";;;;AAcA;;;SAGgB,KAAK,CAAC,KAAiB;IAC/B,IAAA,KAOF,YAAY,EAAE,EANhB,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,MAAM,YAAA,EACN,QAAQ,cAAA,EACR,UAAU,gBAAA,EACV,kBAAiC,EAAnB,IAAI,UAAA,EAAE,GAAG,SAAA,EAAE,MAAM,YACf,CAAC;IACnB,IAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,YAAY,EAAE,EAAE,MAAM,QAAA,EAAE,UAAU,YAAA,EAAE,CAAC,CAAC;IACnE,QACE,+BAAO,SAAS,EAAE,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK;QACpD,CAAC,QAAQ,IAAI,oBAAC,IAAI,OAAG;QACtB,+BAAO,SAAS,EAAE,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,IACpD,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,QACnB,oBAAC,GAAG,IACF,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,GAAG,EAAE,IAAI,CAAC,UAAU,EACpB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,UAAU,EAAE,IAAI,CAAC,UAAU,GAC3B,IACH,CAAC,CACI;QACR,oBAAC,MAAM,OAAG,CACJ,EACR;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WeekNumber.js","sources":["../../../src/components/WeekNumber/WeekNumber.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"WeekNumber.js","sources":["../../../src/components/WeekNumber/WeekNumber.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Button } from '../Button';\nimport { useDayPicker } from '../../contexts/DayPicker';\n\n/**\n * The props for the [[WeekNumber]] component.\n */\nexport interface WeekNumberProps {\n /** The number of the week. */\n number: number;\n /** The dates in the week. */\n dates: Date[];\n}\n\n/**\n * Render the week number element. If `onWeekNumberClick` is passed to DayPicker, it\n * renders a button, otherwise a span element.\n */\nexport function WeekNumber(props: WeekNumberProps): JSX.Element {\n const { number: weekNumber, dates } = props;\n const {\n onWeekNumberClick,\n styles,\n classNames,\n locale,\n labels: { labelWeekNumber },\n formatters: { formatWeekNumber }\n } = useDayPicker();\n\n const handleClick: React.MouseEventHandler = function (e) {\n onWeekNumberClick?.(weekNumber, dates, e);\n };\n\n const content = formatWeekNumber(Number(weekNumber), { locale });\n\n if (!onWeekNumberClick) {\n return (\n <span className={classNames.weeknumber} style={styles.weeknumber}>\n {content}\n </span>\n );\n }\n\n const label = labelWeekNumber(Number(weekNumber), { locale });\n\n return (\n <Button\n aria-label={label}\n className={classNames.weeknumber}\n style={styles.weeknumber}\n onClick={handleClick}\n >\n {content}\n </Button>\n );\n}\n"],"names":[],"mappings":";;;;AAeA;;;;SAIgB,UAAU,CAAC,KAAsB;IACvC,IAAQ,UAAU,GAAY,KAAK,OAAjB,EAAE,KAAK,GAAK,KAAK,MAAV,CAAW;IACtC,IAAA,KAOF,YAAY,EAAE,EANhB,iBAAiB,uBAAA,EACjB,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,MAAM,YAAA,EACI,eAAe,4BAAA,EACX,gBAAgB,iCACd,CAAC;IAEnB,IAAM,WAAW,GAA4B,UAAU,CAAC;QACtD,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAG,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;KAC3C,CAAC;IAEF,IAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;IAEjE,IAAI,CAAC,iBAAiB,EAAE;QACtB,QACE,8BAAM,SAAS,EAAE,UAAU,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,UAAU,IAC7D,OAAO,CACH,EACP;KACH;IAED,IAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;IAE9D,QACE,oBAAC,MAAM,kBACO,KAAK,EACjB,SAAS,EAAE,UAAU,CAAC,UAAU,EAChC,KAAK,EAAE,MAAM,CAAC,UAAU,EACxB,OAAO,EAAE,WAAW,IAEnB,OAAO,CACD,EACT;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YearsDropdown.js","sources":["../../../src/components/YearsDropdown/YearsDropdown.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"YearsDropdown.js","sources":["../../../src/components/YearsDropdown/YearsDropdown.tsx"],"sourcesContent":["import React from 'react';\n\nimport { setYear, startOfYear } from 'date-fns';\n\nimport { useDayPicker } from '../../contexts/DayPicker';\nimport { MonthChangeEventHandler } from '../../types/EventHandlers';\n\n/**\n * The props for the [[YearsDropdown]] component.\n */\nexport interface YearsDropdownProps {\n /** The month where the drop-down is displayed. */\n displayMonth: Date;\n /** Callback to handle the `change` event. */\n onChange: MonthChangeEventHandler;\n}\n\n/**\n * Render a dropdown to change the year. Take in account the `nav.fromDate` and\n * `toDate` from context.\n */\nexport function YearsDropdown(props: YearsDropdownProps): JSX.Element {\n const { displayMonth } = props;\n const {\n fromDate,\n toDate,\n locale,\n styles,\n classNames,\n components: { Dropdown },\n formatters: { formatYearCaption },\n labels: { labelYearDropdown }\n } = useDayPicker();\n\n const years: Date[] = [];\n if (fromDate && toDate) {\n const fromYear = fromDate.getFullYear();\n const toYear = toDate.getFullYear();\n for (let year = fromYear; year <= toYear; year++) {\n years.push(setYear(startOfYear(new Date()), year));\n }\n }\n\n const handleChange: React.ChangeEventHandler<HTMLSelectElement> = (e) => {\n const newMonth = setYear(new Date(displayMonth), Number(e.target.value));\n props.onChange(newMonth);\n };\n\n return (\n <Dropdown\n aria-label={labelYearDropdown()}\n className={classNames.dropdown_month}\n style={styles.dropdown_month}\n onChange={handleChange}\n value={displayMonth.getFullYear()}\n caption={formatYearCaption(displayMonth, { locale })}\n >\n {years.map((year) => (\n <option key={year.getFullYear()} value={year.getFullYear()}>\n {formatYearCaption(year, { locale })}\n </option>\n ))}\n </Dropdown>\n );\n}\n"],"names":[],"mappings":";;;;AAiBA;;;;SAIgB,aAAa,CAAC,KAAyB;IAC7C,IAAA,YAAY,GAAK,KAAK,aAAV,CAAW;IACzB,IAAA,KASF,YAAY,EAAE,EARhB,QAAQ,cAAA,EACR,MAAM,YAAA,EACN,MAAM,YAAA,EACN,MAAM,YAAA,EACN,UAAU,gBAAA,EACI,QAAQ,yBAAA,EACR,iBAAiB,kCAAA,EACrB,iB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react';
|
|
2
|
+
import { CaptionLayout } from '../../components';
|
|
3
|
+
import { ClassNames, Components, DayPickerProps, Formatters, Labels, ModifierClassNames, Modifiers, Styles } from '../../types';
|
|
3
4
|
/** Represent the value of the [[DayPickerContext]]. */
|
|
4
5
|
export declare type DayPickerContextValue = DayPickerProps & {
|
|
5
6
|
captionLayout: CaptionLayout;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DayPickerContext.js","sources":["../../../src/contexts/DayPicker/DayPickerContext.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"DayPickerContext.js","sources":["../../../src/contexts/DayPicker/DayPickerContext.ts"],"sourcesContent":["import React from 'react';\nimport { CaptionLayout } from '../../components';\n\nimport {\n ClassNames,\n Components,\n DayPickerProps,\n Formatters,\n Labels,\n ModifierClassNames,\n Modifiers,\n Styles\n} from '../../types';\n\n/** Represent the value of the [[DayPickerContext]]. */\nexport type DayPickerContextValue = DayPickerProps & {\n captionLayout: CaptionLayout;\n classNames: Required<ClassNames>;\n components: Components;\n formatters: Formatters;\n labels: Labels;\n locale: Locale;\n modifierClassNames: ModifierClassNames;\n modifierPrefix: string;\n modifiers: Modifiers;\n numberOfMonths: number;\n styles: Styles;\n today: Date;\n\n // Internally we handle only fromDate/Todate\n toYear?: never;\n fromYear?: never;\n toMonth?: never;\n fromMonth?: never;\n};\n\n/**\n * The DayPicker context shares the props passed to DayPicker within the\n * internal components. It is used to set the default values and perform\n * one-time calculations required to render the days.\n *\n * Access this context from the [[useDayPicker]] hook when using custom\n * components.\n */\nexport const DayPickerContext = React.createContext<\n DayPickerContextValue | undefined\n>(undefined);\n"],"names":[],"mappings":";;AAoCA;;;;;;;;IAQa,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAEjD,SAAS;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __rest, __assign } from '../../_virtual/_tslib.js';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import enUS from 'date-fns/locale/en-US';
|
|
4
4
|
import { Caption } from '../../components/Caption/Caption.js';
|
|
5
5
|
import { CaptionLabel } from '../../components/CaptionLabel/CaptionLabel.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DayPickerProvider.js","sources":["../../../src/contexts/DayPicker/DayPickerProvider.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"DayPickerProvider.js","sources":["../../../src/contexts/DayPicker/DayPickerProvider.tsx"],"sourcesContent":["import React from 'react';\n\nimport enUS from 'date-fns/locale/en-US';\n\nimport { Caption } from '../../components/Caption';\nimport { CaptionLabel } from '../../components/CaptionLabel';\nimport { Day } from '../../components/Day';\nimport { DayContent } from '../../components/DayContent';\nimport { Dropdown } from '../../components/Dropdown';\nimport { Footer } from '../../components/Footer';\nimport { Head } from '../../components/Head';\nimport { IconDropdown } from '../../components/IconDropdown';\nimport { IconLeft } from '../../components/IconLeft';\nimport { IconRight } from '../../components/IconRight';\nimport { Row } from '../../components/Row';\nimport { WeekNumber } from '../../components/WeekNumber';\nimport { DayPickerProps } from '../../types';\nimport { DayPickerContext, DayPickerContextValue } from './DayPickerContext';\nimport { defaultClassNames } from './defaultClassNames';\nimport * as formatters from './formatters';\nimport * as labels from './labels';\nimport { parseFromToProps, parseModifierProps } from './utils';\n\n/** Represent the props for the [[DayPickerProvider]]. */\nexport interface DayPickerProviderProps {\n /** The props passed to the DayPicker component. */\n initialProps: DayPickerProps;\n children?: React.ReactNode;\n}\n/**\n * The provider for the [[DayPickerContext]].\n */\nexport function DayPickerProvider(props: DayPickerProviderProps): JSX.Element {\n const { children, initialProps } = props;\n\n const locale = initialProps.locale ?? enUS;\n const numberOfMonths = initialProps.numberOfMonths ?? 1;\n const today = initialProps.today ?? new Date();\n\n // Limit navigation\n const { fromDate, toDate } = parseFromToProps(initialProps);\n\n // Default caption layout. If calendar navigation is unlimited, it must be\n // always `buttons` – as we cannot display infinite options in the dropdown.\n let captionLayout = initialProps.captionLayout ?? 'buttons';\n if (!fromDate && !toDate) captionLayout = 'buttons';\n\n const modifiers = parseModifierProps(initialProps);\n\n // Disable days before/after from/toDate\n if (fromDate) {\n modifiers.disabled.push({ before: fromDate });\n }\n if (toDate) {\n modifiers.disabled.push({ after: toDate });\n }\n\n const { toYear, fromYear, toMonth, fromMonth, ...contextProps } =\n initialProps;\n\n const context: DayPickerContextValue = {\n ...contextProps,\n\n captionLayout,\n\n fromDate,\n toDate,\n today,\n\n locale,\n\n modifierClassNames: initialProps.modifierClassNames ?? {},\n modifierPrefix: 'rdp-day_',\n modifiers: modifiers,\n numberOfMonths,\n\n styles: initialProps.styles ?? {},\n classNames: {\n ...defaultClassNames,\n ...initialProps.classNames\n },\n formatters: {\n ...formatters,\n ...initialProps.formatters\n },\n labels: {\n ...labels,\n ...initialProps.labels\n },\n components: {\n Caption: Caption,\n CaptionLabel: CaptionLabel,\n Day: Day,\n DayContent: DayContent,\n Dropdown: Dropdown,\n Footer: Footer,\n Head: Head,\n IconDropdown: IconDropdown,\n IconRight: IconRight,\n IconLeft: IconLeft,\n Row: Row,\n WeekNumber: WeekNumber,\n ...initialProps.components\n }\n };\n\n return (\n <DayPickerContext.Provider value={context}>\n {children}\n </DayPickerContext.Provider>\n );\n}\n"],"names":["formatters","labels"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA;;;SAGgB,iBAAiB,CAAC,KAA6B;;IACrD,IAAA,QAAQ,GAAmB,KAAK,SAAxB,EAAE,YAAY,GAAK,KAAK,aAAV,CAAW;IAEzC,IAAM,MAAM,GAAG,MAAA,YAAY,CAAC,MAAM,mCAAI,IAAI,CAAC;IAC3C,IAAM,cAAc,GAAG,MAAA,YAAY,CAAC,cAAc,mCAAI,CAAC,CAAC;IACxD,IAAM,KAAK,GAAG,MAAA,YAAY,CAAC,KAAK,mCAAI,IAAI,IAAI,EAAE,CAAC;;IAGzC,IAAA,KAAuB,gBAAgB,CAAC,YAAY,CAAC,EAAnD,QAAQ,cAAA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YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,IACnB,YAAY,CAAC,UAAU,IAE7B,CAAC;IAEF,QACE,oBAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IACtC,QAAQ,CACiB,EAC5B;AACJ;;;;"}
|
|
@@ -32,12 +32,10 @@ var defaultClassNames = {
|
|
|
32
32
|
nav_button_next: 'rdp-nav_button_next',
|
|
33
33
|
nav_icon: 'rdp-nav_icon',
|
|
34
34
|
row: 'rdp-row',
|
|
35
|
-
row_head: 'rdp-row_head',
|
|
36
35
|
weeknumber: 'rdp-weeknumber',
|
|
37
36
|
cell: 'rdp-cell',
|
|
38
37
|
day: 'rdp-day',
|
|
39
|
-
day_outside: 'rdp-day_outside'
|
|
40
|
-
day_today: 'rdp-day_today'
|
|
38
|
+
day_outside: 'rdp-day_outside'
|
|
41
39
|
};
|
|
42
40
|
|
|
43
41
|
export { defaultClassNames };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultClassNames.js","sources":["../../../src/contexts/DayPicker/defaultClassNames.ts"],"sourcesContent":["import { ClassNames } from '../../types';\n\n/**\n * The name of the default CSS classes.\n */\nexport const defaultClassNames: Required<ClassNames> = {\n root: 'rdp',\n multiple_month: 'rdp-multiple_months',\n with_weeknumber: 'rdp-with_weeknumber',\n vhidden: 'rdp-vhidden',\n button_reset: 'rdp-button_reset',\n button: 'rdp-button',\n\n caption: 'rdp-caption',\n\n caption_first: 'rdp-caption_first',\n caption_last: 'rdp-caption_last',\n caption_middle: 'rdp-caption_middle',\n caption_label: 'rdp-caption_label',\n\n caption_dropdowns: 'rdp-caption_dropdowns',\n\n dropdown: 'rdp-dropdown',\n dropdown_month: 'rdp-dropdown_month',\n dropdown_year: 'rdp-dropdown_year',\n dropdown_icon: 'rdp-dropdown_icon',\n\n months: 'rdp-months',\n month: 'rdp-month',\n table: 'rdp-table',\n tbody: 'rdp-tbody',\n tfoot: 'rdp-tfoot',\n\n head: 'rdp-head',\n head_row: 'rdp-head_row',\n head_cell: 'rdp-head_cell',\n\n nav: 'rdp-nav',\n nav_button: 'rdp-nav_button',\n nav_button_previous: 'rdp-nav_button_previous',\n nav_button_next: 'rdp-nav_button_next',\n\n nav_icon: 'rdp-nav_icon',\n\n row: 'rdp-row',\n
|
|
1
|
+
{"version":3,"file":"defaultClassNames.js","sources":["../../../src/contexts/DayPicker/defaultClassNames.ts"],"sourcesContent":["import { ClassNames } from '../../types';\n\n/**\n * The name of the default CSS classes.\n */\nexport const defaultClassNames: Required<ClassNames> = {\n root: 'rdp',\n multiple_month: 'rdp-multiple_months',\n with_weeknumber: 'rdp-with_weeknumber',\n vhidden: 'rdp-vhidden',\n button_reset: 'rdp-button_reset',\n button: 'rdp-button',\n\n caption: 'rdp-caption',\n\n caption_first: 'rdp-caption_first',\n caption_last: 'rdp-caption_last',\n caption_middle: 'rdp-caption_middle',\n caption_label: 'rdp-caption_label',\n\n caption_dropdowns: 'rdp-caption_dropdowns',\n\n dropdown: 'rdp-dropdown',\n dropdown_month: 'rdp-dropdown_month',\n dropdown_year: 'rdp-dropdown_year',\n dropdown_icon: 'rdp-dropdown_icon',\n\n months: 'rdp-months',\n month: 'rdp-month',\n table: 'rdp-table',\n tbody: 'rdp-tbody',\n tfoot: 'rdp-tfoot',\n\n head: 'rdp-head',\n head_row: 'rdp-head_row',\n head_cell: 'rdp-head_cell',\n\n nav: 'rdp-nav',\n nav_button: 'rdp-nav_button',\n nav_button_previous: 'rdp-nav_button_previous',\n nav_button_next: 'rdp-nav_button_next',\n\n nav_icon: 'rdp-nav_icon',\n\n row: 'rdp-row',\n weeknumber: 'rdp-weeknumber',\n cell: 'rdp-cell',\n\n day: 'rdp-day',\n day_outside: 'rdp-day_outside'\n};\n"],"names":[],"mappings":"AAEA;;;IAGa,iBAAiB,GAAyB;IACrD,IAAI,EAAE,KAAK;IACX,cAAc,EAAE,qBAAqB;IACrC,eAAe,EAAE,qBAAqB;IACtC,OAAO,EAAE,aAAa;IACtB,YAAY,EAAE,kBAAkB;IAChC,MAAM,EAAE,YAAY;IAEpB,OAAO,EAAE,aAAa;IAEtB,aAAa,EAAE,mBAAmB;IAClC,YAAY,EAAE,kBAAkB;IAChC,cAAc,EAAE,oBAAoB;IACpC,aAAa,EAAE,mBAAmB;IAElC,iBAAiB,EAAE,uBAAuB;IAE1C,QAAQ,EAAE,cAAc;IACxB,cAAc,EAAE,oBAAoB;IACpC,aAAa,EAAE,mBAAmB;IAClC,aAAa,EAAE,mBAAmB;IAElC,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,WAAW;IAElB,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,cAAc;IACxB,SAAS,EAAE,eAAe;IAE1B,GAAG,EAAE,SAAS;IACd,UAAU,EAAE,gBAAgB;IAC5B,mBAAmB,EAAE,yBAAyB;IAC9C,eAAe,EAAE,qBAAqB;IAEtC,QAAQ,EAAE,cAAc;IAExB,GAAG,EAAE,SAAS;IACd,UAAU,EAAE,gBAAgB;IAC5B,IAAI,EAAE,UAAU;IAEhB,GAAG,EAAE,SAAS;IACd,WAAW,EAAE,iBAAiB;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labelDay.js","sources":["../../../../src/contexts/DayPicker/labels/labelDay.ts"],"sourcesContent":["import { format } from 'date-fns';\n\nimport {
|
|
1
|
+
{"version":3,"file":"labelDay.js","sources":["../../../../src/contexts/DayPicker/labels/labelDay.ts"],"sourcesContent":["import { format } from 'date-fns';\n\nimport { DayLabel } from '../../../types';\n\n/**\n * The default ARIA label for the day button.\n */\nexport const labelDay: DayLabel = (day, modifers, options): string => {\n return format(day, 'do MMMM (EEEE)', options);\n};\n"],"names":[],"mappings":";;AAIA;;;IAGa,QAAQ,GAAa,UAAC,GAAG,EAAE,QAAQ,EAAE,OAAO;IACvD,OAAO,MAAM,CAAC,GAAG,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC;AAChD;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NavButtonLabel } from '../../../types';
|
|
2
2
|
/**
|
|
3
3
|
* The default ARIA label for next month button in navigation
|
|
4
4
|
*/
|
|
5
|
-
export declare const labelNext:
|
|
5
|
+
export declare const labelNext: NavButtonLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labelNext.js","sources":["../../../../src/contexts/DayPicker/labels/labelNext.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"labelNext.js","sources":["../../../../src/contexts/DayPicker/labels/labelNext.ts"],"sourcesContent":["import { NavButtonLabel } from '../../../types';\n\n/**\n * The default ARIA label for next month button in navigation\n */\nexport const labelNext: NavButtonLabel = (): string => {\n return 'Go to next month';\n};\n"],"names":[],"mappings":"AAEA;;;IAGa,SAAS,GAAmB;IACvC,OAAO,kBAAkB,CAAC;AAC5B;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NavButtonLabel } from '../../../types';
|
|
2
2
|
/**
|
|
3
3
|
* The default ARIA label for previous month button in navigation
|
|
4
4
|
*/
|
|
5
|
-
export declare const labelPrevious:
|
|
5
|
+
export declare const labelPrevious: NavButtonLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labelPrevious.js","sources":["../../../../src/contexts/DayPicker/labels/labelPrevious.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"labelPrevious.js","sources":["../../../../src/contexts/DayPicker/labels/labelPrevious.ts"],"sourcesContent":["import { NavButtonLabel } from '../../../types';\n\n/**\n * The default ARIA label for previous month button in navigation\n */\nexport const labelPrevious: NavButtonLabel = (): string => {\n return 'Go to previous month';\n};\n"],"names":[],"mappings":"AAEA;;;IAGa,aAAa,GAAmB;IAC3C,OAAO,sBAAsB,CAAC;AAChC;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WeekNumberLabel } from '../../../types';
|
|
2
2
|
/**
|
|
3
3
|
* The default ARIA label for the WeekNumber element.
|
|
4
4
|
*/
|
|
5
|
-
export declare const labelWeekNumber:
|
|
5
|
+
export declare const labelWeekNumber: WeekNumberLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labelWeekNumber.js","sources":["../../../../src/contexts/DayPicker/labels/labelWeekNumber.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"labelWeekNumber.js","sources":["../../../../src/contexts/DayPicker/labels/labelWeekNumber.ts"],"sourcesContent":["import { WeekNumberLabel } from '../../../types';\n\n/**\n * The default ARIA label for the WeekNumber element.\n */\nexport const labelWeekNumber: WeekNumberLabel = (n): string => {\n return `Week n. ${n}`;\n};\n"],"names":[],"mappings":"AAEA;;;IAGa,eAAe,GAAoB,UAAC,CAAC;IAChD,OAAO,aAAW,CAAG,CAAC;AACxB;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WeekdayLabel } from '../../../types';
|
|
2
2
|
/**
|
|
3
3
|
* The default ARIA label for the Weekday element.
|
|
4
4
|
*/
|
|
5
|
-
export declare const labelWeekday:
|
|
5
|
+
export declare const labelWeekday: WeekdayLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labelWeekday.js","sources":["../../../../src/contexts/DayPicker/labels/labelWeekday.ts"],"sourcesContent":["import { format } from 'date-fns';\n\nimport {
|
|
1
|
+
{"version":3,"file":"labelWeekday.js","sources":["../../../../src/contexts/DayPicker/labels/labelWeekday.ts"],"sourcesContent":["import { format } from 'date-fns';\n\nimport { WeekdayLabel } from '../../../types';\n\n/**\n * The default ARIA label for the Weekday element.\n */\nexport const labelWeekday: WeekdayLabel = (day, options): string => {\n return format(day, 'cccc.', options);\n};\n"],"names":[],"mappings":";;AAIA;;;IAGa,YAAY,GAAiB,UAAC,GAAG,EAAE,OAAO;IACrD,OAAO,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACvC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDayPicker.js","sources":["../../../src/contexts/DayPicker/useDayPicker.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"useDayPicker.js","sources":["../../../src/contexts/DayPicker/useDayPicker.ts"],"sourcesContent":["import React from 'react';\n\nimport { DayPickerContext, DayPickerContextValue } from './DayPickerContext';\n\n/**\n * Hook to access the [[DayPickerContext]].\n *\n * To use this hook make sure to wrap the components with a one\n * [[DayPickerProvider]].\n * */\nexport function useDayPicker(): DayPickerContextValue {\n const context = React.useContext(DayPickerContext);\n if (!context) {\n throw new Error(\n `Context is not defined. useDayPicker must be used within a DayPickerProvider with a valid values.`\n );\n }\n return context;\n}\n"],"names":[],"mappings":";;;AAIA;;;;;;SAMgB,YAAY;IAC1B,IAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;IACnD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,mGAAmG,CACpG,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseModifierProps.js","sources":["../../../../src/contexts/DayPicker/utils/parseModifierProps.ts"],"sourcesContent":["import { DayPickerProps, InternalModifier, Modifiers } from '../../../types';\n\n/** Props that will merge into the modifiers. */\nconst modifierShortcuts: InternalModifier[] = [\n 'selected',\n 'hidden',\n 'disabled'\n];\n\n/**\n * Parse the modifiers from the props and return them as a map of array of\n * matcher.\n *\n * Internally we want modifiers as an array of matchers – as opposite of the\n * props which can accept also a matcher.\n */\nexport function parseModifierProps(initialProps: DayPickerProps): Modifiers {\n const initialModifiers = initialProps.modifiers || {};\n\n const modifiers: Modifiers = {\n selected: [],\n disabled: [],\n hidden: [],\n range_end: [],\n range_middle: [],\n range_start: []\n };\n\n Object.entries(initialModifiers).forEach(([modifier, matcher]) => {\n if (Array.isArray(matcher)) {\n modifiers[modifier] = matcher;\n } else if (matcher) {\n modifiers[modifier] = [matcher];\n } else {\n modifiers[modifier] = [];\n }\n });\n\n modifierShortcuts.forEach((modifier) => {\n // @ts-expect-error TOFIX: initial props do not have some modifiers\n const modifierFromProp = initialProps[modifier];\n if (Array.isArray(modifierFromProp)) {\n modifiers[modifier] = modifierFromProp;\n } else if (modifierFromProp !== undefined) {\n modifiers[modifier] = [modifierFromProp];\n } else {\n modifiers[modifier] = [];\n }\n });\n\n return modifiers;\n}\n"],"names":[],"mappings":"AAEA;AACA,IAAM,iBAAiB,GAAuB;IAC5C,UAAU;IACV,QAAQ;IACR,UAAU;CACX,CAAC;AAEF;;;;;;;SAOgB,kBAAkB,CAAC,YAA4B;IAC7D,IAAM,gBAAgB,GAAG,YAAY,CAAC,SAAS,IAAI,EAAE,CAAC;IAEtD,IAAM,SAAS,GAAc;QAC3B,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,EAAE;QACV,SAAS,EAAE,EAAE;QACb,YAAY,EAAE,EAAE;QAChB,WAAW,EAAE,EAAE;KAChB,CAAC;IAEF,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,UAAC,EAAmB;YAAlB,QAAQ,QAAA,EAAE,OAAO,QAAA;QAC1D,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAC1B,SAAS,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC;SAC/B;aAAM,IAAI,OAAO,EAAE;YAClB,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;SACjC;aAAM;YACL,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;SAC1B;KACF,CAAC,CAAC;IAEH,iBAAiB,CAAC,OAAO,CAAC,UAAC,QAAQ;;QAEjC,IAAM,gBAAgB,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAI,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE;YACnC,SAAS,CAAC,QAAQ,CAAC,GAAG,gBAAgB,CAAC;SACxC;aAAM,IAAI,gBAAgB,KAAK,SAAS,EAAE;YACzC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;SAC1C;aAAM;YACL,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;SAC1B;KACF,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB;;;;"}
|
|
1
|
+
{"version":3,"file":"parseModifierProps.js","sources":["../../../../src/contexts/DayPicker/utils/parseModifierProps.ts"],"sourcesContent":["import { DayPickerProps, InternalModifier, Modifiers } from '../../../types';\n\n/** Props that will merge into the modifiers. */\nconst modifierShortcuts: InternalModifier[] = [\n 'selected',\n 'hidden',\n 'disabled'\n];\n\n/**\n * Parse the modifiers from the props and return them as a map of array of\n * matcher.\n *\n * Internally we want modifiers as an array of matchers – as opposite of the\n * props which can accept also a matcher.\n */\nexport function parseModifierProps(initialProps: DayPickerProps): Modifiers {\n const initialModifiers = initialProps.modifiers || {};\n\n const modifiers: Modifiers = {\n selected: [],\n disabled: [],\n hidden: [],\n today: [],\n range_end: [],\n range_middle: [],\n range_start: []\n };\n\n Object.entries(initialModifiers).forEach(([modifier, matcher]) => {\n if (Array.isArray(matcher)) {\n modifiers[modifier] = matcher;\n } else if (matcher) {\n modifiers[modifier] = [matcher];\n } else {\n modifiers[modifier] = [];\n }\n });\n\n modifierShortcuts.forEach((modifier) => {\n // @ts-expect-error TOFIX: initial props do not have some modifiers\n const modifierFromProp = initialProps[modifier];\n if (Array.isArray(modifierFromProp)) {\n modifiers[modifier] = modifierFromProp;\n } else if (modifierFromProp !== undefined)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AAQ,CAAC,GAAG,EAAE,CAAC;SAC1B;KACF,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
/** Represents the value of the [[NavigationContext]]. */
|
|
3
3
|
export declare type FocusContextValue = [
|
|
4
4
|
/** The day currently focused */
|
|
@@ -24,3 +24,7 @@ export declare type FocusContextValue = [
|
|
|
24
24
|
* Access this context from the [[useFocus]] hook.
|
|
25
25
|
*/
|
|
26
26
|
export declare const FocusContext: React.Context<FocusContextValue | undefined>;
|
|
27
|
+
/** The provider for the [[FocusContext]]. */
|
|
28
|
+
export declare function FocusProvider({ children }: {
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
}): JSX.Element;
|
|
@@ -1,11 +1,71 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { addDays, addWeeks, isSameMonth, addMonths } from 'date-fns';
|
|
3
|
+
import { useDayPicker } from '../DayPicker/useDayPicker.js';
|
|
4
|
+
import '../Navigation/NavigationContext.js';
|
|
5
|
+
import { useNavigation } from '../Navigation/useNavigation.js';
|
|
2
6
|
|
|
3
7
|
/**
|
|
4
8
|
* The Focus context shares details about the focused day for the keyboard navigation.
|
|
5
9
|
*
|
|
6
10
|
* Access this context from the [[useFocus]] hook.
|
|
7
11
|
*/
|
|
8
|
-
var FocusContext = React.createContext(undefined);
|
|
12
|
+
var FocusContext = React.createContext(undefined);
|
|
13
|
+
/** The provider for the [[FocusContext]]. */
|
|
14
|
+
function FocusProvider(_a) {
|
|
15
|
+
var children = _a.children;
|
|
16
|
+
var _b = React.useState(), focusedDay = _b[0], setDay = _b[1];
|
|
17
|
+
var _c = useNavigation(), goToMonth = _c.goToMonth, displayMonths = _c.displayMonths;
|
|
18
|
+
var numberOfMonths = useDayPicker().numberOfMonths;
|
|
19
|
+
var blur = function () { return setDay(undefined); };
|
|
20
|
+
var focus = function (date) { return setDay(date); };
|
|
21
|
+
var switchMonth = function (date, offset) {
|
|
22
|
+
if (displayMonths.some(function (m) { return isSameMonth(date, m); }))
|
|
23
|
+
return;
|
|
24
|
+
if (offset < 0) {
|
|
25
|
+
goToMonth(addMonths(date, 1 + offset));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
goToMonth(date);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var focusDayBefore = function () {
|
|
32
|
+
if (!focusedDay)
|
|
33
|
+
return;
|
|
34
|
+
var before = addDays(focusedDay, -1);
|
|
35
|
+
setDay(before);
|
|
36
|
+
switchMonth(before, numberOfMonths * -1);
|
|
37
|
+
};
|
|
38
|
+
var focusDayAfter = function () {
|
|
39
|
+
if (!focusedDay)
|
|
40
|
+
return;
|
|
41
|
+
var after = addDays(focusedDay, 1);
|
|
42
|
+
setDay(after);
|
|
43
|
+
switchMonth(after, numberOfMonths);
|
|
44
|
+
};
|
|
45
|
+
var focusWeekBeforeDay = function () {
|
|
46
|
+
if (!focusedDay)
|
|
47
|
+
return;
|
|
48
|
+
var up = addWeeks(focusedDay, -1);
|
|
49
|
+
setDay(up);
|
|
50
|
+
switchMonth(up, numberOfMonths * -1);
|
|
51
|
+
};
|
|
52
|
+
var focusWeekAfterDay = function () {
|
|
53
|
+
if (!focusedDay)
|
|
54
|
+
return;
|
|
55
|
+
var down = addWeeks(focusedDay, 1);
|
|
56
|
+
setDay(down);
|
|
57
|
+
switchMonth(down, numberOfMonths);
|
|
58
|
+
};
|
|
59
|
+
var setters = {
|
|
60
|
+
blur: blur,
|
|
61
|
+
focus: focus,
|
|
62
|
+
focusDayAfter: focusDayAfter,
|
|
63
|
+
focusDayBefore: focusDayBefore,
|
|
64
|
+
focusWeekAfterDay: focusWeekAfterDay,
|
|
65
|
+
focusWeekBeforeDay: focusWeekBeforeDay
|
|
66
|
+
};
|
|
67
|
+
return (React.createElement(FocusContext.Provider, { value: [focusedDay, setters] }, children));
|
|
68
|
+
}
|
|
9
69
|
|
|
10
|
-
export { FocusContext };
|
|
70
|
+
export { FocusContext, FocusProvider };
|
|
11
71
|
//# sourceMappingURL=FocusContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FocusContext.js","sources":["../../../src/contexts/Focus/FocusContext.
|
|
1
|
+
{"version":3,"file":"FocusContext.js","sources":["../../../src/contexts/Focus/FocusContext.tsx"],"sourcesContent":["import React from 'react';\n\nimport { addDays, addMonths, addWeeks, isSameMonth } from 'date-fns';\n\nimport { useDayPicker } from '../DayPicker';\nimport { useNavigation } from '../Navigation';\n\n/** Represents the value of the [[NavigationContext]]. */\nexport type FocusContextValue = [\n /** The day currently focused */\n focusedDay: Date | undefined,\n setters: {\n /** Focus the specified day. */\n focus: (day: Date) => void;\n /** Blur the focused day */\n blur: () => void;\n /** Focus the day after the focused day. */\n focusDayAfter: () => void;\n /** Focus the day before the focused day. */\n focusDayBefore: () => void;\n /** Focus the day in the week before the focused day. */\n focusWeekBeforeDay: () => void;\n /** Focus the day in the week after the focused day. */\n focusWeekAfterDay: () => void;\n }\n];\n\n/**\n * The Focus context shares details about the focused day for the keyboard navigation.\n *\n * Access this context from the [[useFocus]] hook.\n */\nexport const FocusContext = React.createContext<FocusContextValue | undefined>(\n undefined\n);\n\n/** The provider for the [[FocusContext]]. */\nexport function FocusProvider({\n children\n}: {\n children: React.ReactNode;\n}): JSX.Element {\n const [focusedDay, setDay] = React.useState<Date | undefined>();\n const { goToMonth, displayMonths } = useNavigation();\n const { numberOfMonths } = useDayPicker();\n\n const blur = () => setDay(undefined);\n const focus = (date: Date) => setDay(date);\n\n const switchMonth = (date: Date, offset: number) => {\n if (displayMonths.some((m) => isSameMonth(date, m))) return;\n if (offset < 0) {\n goToMonth(addMonths(date, 1 + offset));\n } else {\n goToMonth(date);\n }\n };\n\n const focusDayBefore = () => {\n if (!focusedDay) return;\n const before = addDays(focusedDay, -1);\n setDay(before);\n switchMonth(before, numberOfMonths * -1);\n };\n const focusDayAfter = () => {\n if (!focusedDay) return;\n const after = addDays(focusedDay, 1);\n setDay(after);\n switchMonth(after, numberOfMonths);\n };\n const focusWeekBeforeDay = () => {\n if (!focusedDay) return;\n const up = addWeeks(focusedDay, -1);\n setDay(up);\n switchMonth(up, numberOfMonths * -1);\n };\n const focusWeekAfterDay = () => {\n if (!focusedDay) return;\n const down = addWeeks(focusedDay, 1);\n setDay(down);\n switchMonth(down, numberOfMonths);\n };\n\n const setters = {\n blur,\n focus,\n focusDayAfter,\n focusDayBefore,\n focusWeekAfterDay,\n focusWeekBeforeDay\n };\n\n return (\n <FocusContext.Provider value={[focusedDay, setters]}>\n {children}\n </FocusContext.Provider>\n );\n}\n"],"names":[],"mappings":";;;;;;AA2BA;;;;;IAKa,YAAY,GAAG,KAAK,CAAC,aAAa,CAC7C,SAAS,EACT;AAEF;SACgB,aAAa,CAAC,EAI7B;QAHC,QAAQ,cAAA;IAIF,IAAA,KAAuB,KAAK,CAAC,QAAQ,EAAoB,EAAxD,UAAU,QAAA,EAAE,MAAM,QAAsC,CAAC;IAC1D,IAAA,KAA+B,aAAa,EAAE,EAA5C,SAAS,eAAA,EAAE,aAAa,mBAAoB,CAAC;IAC7C,IAAA,cAAc,GAAK,YAAY,EAAE,eAAnB,CAAoB;IAE1C,IAAM,IAAI,GAAG,cAAM,OAAA,MAAM,CAAC,SAAS,CAAC,GAAA,CAAC;IACrC,IAAM,KAAK,GAAG,UAAC,IAAU,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,GAAA,CAAC;IAE3C,IAAM,WAAW,GAAG,UAAC,IAAU,EAAE,MAAc;QAC7C,IAAI,aAAa,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,GAAA,CAAC;YAAE,OAAO;QAC5D,IAAI,MAAM,GAAG,CAAC,EAAE;YACd,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC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AAC,IAChD,QAAQ,CACa,EACxB;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocus.js","sources":["../../../src/contexts/Focus/useFocus.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"useFocus.js","sources":["../../../src/contexts/Focus/useFocus.ts"],"sourcesContent":["import React from 'react';\n\nimport { FocusContext, FocusContextValue } from './FocusContext';\n\n/** Hook to access the [[FocusContext]]. */\nexport function useFocus(): FocusContextValue {\n const context = React.useContext(FocusContext);\n if (!context) {\n throw new Error('useFocus must be used within a FocusProvider');\n }\n return context;\n}\n"],"names":[],"mappings":";;;AAIA;SACgB,QAAQ;IACtB,IAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAC/C,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;KACjE;IACD,OAAO,OAAO,CAAC;AACjB;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
/** Represents the value of the [[NavigationContext]]. */
|
|
3
3
|
export interface NavigationContextValue {
|
|
4
4
|
/** The current month. Note that when `numberOfMonths > 1` represent the first month in the displayed months. */
|
|
@@ -18,3 +18,7 @@ export interface NavigationContextValue {
|
|
|
18
18
|
* Access this context from the [[useNavigation]] hook.
|
|
19
19
|
*/
|
|
20
20
|
export declare const NavigationContext: React.Context<NavigationContextValue | undefined>;
|
|
21
|
+
/** Provides the values for the [[NavigationContext]]. */
|
|
22
|
+
export declare function NavigationProvider(props: {
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
}): JSX.Element;
|