@oslokommune/punkt-elements
Version:
Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo
31 lines (30 loc) • 1.33 kB
TypeScript
import type { TDateRangeMap, ISelectionOptions } from '../../shared-types/calendar';
export type { TDateRangeMap, ISelectionState, ISelectionOptions } from '../../shared-types/calendar';
/**
* Convert selected string array to Date array
*/
export declare function convertSelectedToDates(selected: string | string[]): Date[];
/**
* Update the range map for visualizing date ranges
*/
export declare function updateRangeMap(start: Date, end: Date): TDateRangeMap;
/**
* Check if a range selection is allowed (no excluded dates in between)
*/
export declare function isRangeAllowed(date: Date, selectedDates: Date[], excludedates: Date[], excludeweekdays: string[]): boolean;
/**
* Add a date to the selection
*/
export declare function addToSelection(selectedDate: Date, currentSelected: string[]): string[];
/**
* Remove a date from the selection
*/
export declare function removeFromSelection(selectedDate: Date, currentSelected: string[]): string[];
/**
* Toggle a date in the selection
*/
export declare function toggleSelection(selectedDate: Date, currentSelected: string[], maxMultiple: number): string[];
/**
* Handle range selection logic
*/
export declare function handleRangeSelection(selectedDate: Date, currentSelected: string[], options: Pick<ISelectionOptions, 'excludedates' | 'excludeweekdays'>): string[];