Rocky_Mountain_Vending/.pnpm-store/v10/files/59/2d20a5eb308b4a5424e3f5b3ed48c87bd499ef818bea7d04014c4d6f9c3709c446b38d1054835611bf6e638ddafeaa91afe64ffcc3d4516516b7d0eab51566
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

45 lines
No EOL
2 KiB
Text

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useRange = useRange;
const useControlledValue_js_1 = require("../helpers/useControlledValue.js");
const index_js_1 = require("../utils/index.js");
const rangeIncludesDate_js_1 = require("../utils/rangeIncludesDate.js");
/**
* Hook to manage range selection in the DayPicker component.
*
* @template T - The type of DayPicker props.
* @param props - The DayPicker props.
* @param dateLib - The date utility library instance.
* @returns An object containing the selected range, a function to select a
* range, and a function to check if a date is within the range.
*/
function useRange(props, dateLib) {
const { disabled, excludeDisabled, selected: initiallySelected, required, onSelect } = props;
const [internallySelected, setSelected] = (0, useControlledValue_js_1.useControlledValue)(initiallySelected, onSelect ? initiallySelected : undefined);
const selected = !onSelect ? internallySelected : initiallySelected;
const isSelected = (date) => selected && (0, rangeIncludesDate_js_1.rangeIncludesDate)(selected, date, false, dateLib);
const select = (triggerDate, modifiers, e) => {
const { min, max } = props;
const newRange = triggerDate
? (0, index_js_1.addToRange)(triggerDate, selected, min, max, required, dateLib)
: undefined;
if (excludeDisabled && disabled && newRange?.from && newRange.to) {
if ((0, index_js_1.rangeContainsModifiers)({ from: newRange.from, to: newRange.to }, disabled, dateLib)) {
// if a disabled days is found, the range is reset
newRange.from = triggerDate;
newRange.to = undefined;
}
}
if (!onSelect) {
setSelected(newRange);
}
onSelect?.(newRange, triggerDate, modifiers, e);
return newRange;
};
return {
selected,
select,
isSelected
};
}
//# sourceMappingURL=useRange.js.map