UNPKG

710 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.dayPickerContext = void 0;
4exports.useDayPicker = useDayPicker;
5const react_1 = require("react");
6/** @private */
7exports.dayPickerContext = (0, react_1.createContext)(undefined);
8/**
9 * Return the context to work with `<DayPicker />` inside custom components.
10 *
11 * @group Hooks
12 * @see https://daypicker.dev/guides/custom-components
13 */
14function useDayPicker(props) {
15 const context = (0, react_1.useContext)(exports.dayPickerContext);
16 if (context === undefined) {
17 throw new Error("useDayPicker() must be used within a custom component.");
18 }
19 return context;
20}
21//# sourceMappingURL=useDayPicker.js.map
\No newline at end of file