@guruhotel/aura-ui
Version:
⚛️ React UI library by GuruHotel
1 lines • 1.47 kB
JavaScript
import r,{useRef as e}from"react";import{useDateRangePickerState as o}from"@react-stately/datepicker";import{useDateRangePicker as t}from"@react-aria/datepicker";import{DateField as i}from"../date-field";import{FieldButton as a}from"./button";import{CircleExclamationSolid as l,CalendarRegular as d}from"../icons";import{DatePickerContainer as m,SpanSeparator as n}from"./date-picker.styles";import{RangeCalendar as s}from"../calendar";import{Popover as c}from"./popover";import{ModalProvider as p}from"@react-aria/overlays";import{useTheme as u}from"../theme";import{Box as f}from"../box";import{jsx as h}from"react/jsx-runtime";import{jsxs as b}from"react/jsx-runtime";function P({colorScheme:r="guru",size:P="md",rounded:v="md",dateInvalidIcon:x,calendarIcon:y,...O}){const S=o(O),j=e(),{groupProps:k,startFieldProps:g,endFieldProps:I,buttonProps:z,dialogProps:C,calendarProps:F}=t(O,S,j),{theme:D}=u();return h(p,{children:b(m,{...k,colorScheme:r,size:P,ref:j,children:[h(i,{...g,label:O.label,colorScheme:"unstyled",rounded:v}),h(n,{"aria-hidden":"true",children:"–"}),h(i,{...I,label:O.label,colorScheme:"unstyled",rounded:v}),"invalid"===S.validationState&&h(f,{css:{mr:"$2"},children:x||h(l,{label:"Exclamation",color:null==D?void 0:D.colors.red11.value})}),h(a,{...z,isPressed:S.isOpen,children:y||h(d,{label:"Calendar"})}),S.isOpen&&h(c,{...C,isOpen:S.isOpen,onClose:()=>S.setOpen(!1),isDatePicker:!0,children:h(s,{...F,rounded:v})})]})})}export default P;