react-calendar-kit
Version:
React Calendar Kit is a powerful and flexible library for building accessible and highly customizable calendar and date/time picker components in your React applications. React Calendar Kit provides a solid foundation for creating inclusive user experienc
3 lines (2 loc) • 1.47 kB
JavaScript
'use client';
import{a as l}from"./chunk-TXR3SP4K.mjs";import{a as d}from"./chunk-OR7D7L2Y.mjs";import{c as p}from"./chunk-RBKSHWF4.mjs";import{a as s}from"./chunk-VMZM6ONT.mjs";import i,{forwardRef as L,useMemo as F,useRef as G}from"react";import{CalendarDate as m,createCalendar as I}from"@internationalized/date";import{useRangeCalendar as j}from"@react-aria/calendar";import{useLocale as q}from"@react-aria/i18n";import{useRangeCalendarState as z}from"@react-stately/calendar";function c(e,C){let{minValue:f=new m(1900,1,1),maxValue:u=new m(2099,12,31),className:P,classNames:y={},styles:R={},visibleMonths:g=1,weekdayStyle:k="short",createCalendar:a,withPicker:t=!1,pickerHeight:h=278,pickerEmptyItem:b=3,pickerOpen:v,defaultPickerOpen:x=!1,onPickerOpenChange:M,...T}=e,{locale:w}=q(),r=t?1:Math.max(1,Math.min(g,3)),E=F(()=>({months:r}),[r]),n=z({...e,locale:w,minValue:f,maxValue:u,visibleDuration:E,createCalendar:!a||typeof a!="function"?I:a}),o=G(null),{calendarProps:S,prevButtonProps:D,nextButtonProps:N,title:V,errorMessageProps:O}=j(e,n,o),[A,B]=l({prop:v,defaultProp:x,onChange:M}),H=p(o,C);return i.createElement(s,{value:{state:n,visibleMonths:r,weekdayStyle:k,classNames:y,styles:R,withPicker:t,pickerHeight:h,pickerEmptyItem:b,isPickerExpanded:A,setPickerExpanded:B}},i.createElement(d,{ref:H,calendarProps:S,prevButtonProps:D,nextButtonProps:N,title:V,errorMessageProps:O,className:P,...T}))}c.displayName="RangeCalendar";var $=L(c);export{$ as a};