UNPKG

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.41 kB
'use client'; import{a as m}from"./chunk-YCQF46KQ.mjs";import{a as i}from"./chunk-SO6NUY46.mjs";import{c as n}from"./chunk-RBKSHWF4.mjs";import d,{forwardRef as M,useRef as w}from"react";import{CalendarDate as u,createCalendar as k}from"@internationalized/date";import{useDateField as A}from"@react-aria/datepicker";import{useLocale as H}from"@react-aria/i18n";import{filterDOMProps as O,mergeProps as a}from"@react-aria/utils";import{useDateFieldState as Z}from"@react-stately/datepicker";var P=(e,f)=>{let{groupProps:c={},labelProps:y={},inputProps:D={},fieldProps:C={},className:I,classNames:s={},styles:o={},style:g,shouldForceLeadingZeros:p=!0,minValue:S=new u(1900,1,1),maxValue:T=new u(2099,12,31),createCalendar:r,segmentProps:N,formatSegment:R,startContent:V,endContent:b,children:x,...F}=e,{locale:E}=H(),t=Z({...e,locale:E,minValue:S,maxValue:T,shouldForceLeadingZeros:p,createCalendar:!r||typeof r!="function"?k:r}),l=w(null),h=n(l,f),{labelProps:v,fieldProps:G,inputProps:L}=A({...e,shouldForceLeadingZeros:p},t,l);return d.createElement(m,{"data-disabled":t.isDisabled,"data-invalid":t.isInvalid,className:I,classNames:s,styles:o,style:g,ref:h,labelProps:a(v,y),startContent:V,endContent:b,label:e.label,...a(c,O(F))},d.createElement(i,{fieldProps:a(G,C),inputProps:a(L,D),state:t,classNames:s,segmentProps:N,formatSegment:R,styles:o}),x)};P.displayName="DateInput";var X=M(P);export{X as a};