UNPKG

@guruhotel/aura-ui

Version:

⚛️ React UI library by GuruHotel

1 lines 946 B
import e,{useRef as r}from"react";import{useLocale as t}from"@react-aria/i18n";import{useTimeFieldState as o}from"@react-stately/datepicker";import{useTimeField as m}from"@react-aria/datepicker";import{DateSegment as i}from"./date-segment";import{DateFieldElements as a}from"./date-field.styles";import{CircleExclamationSolid as c}from"../icons";import{useTheme as l}from"../theme";import{Box as s}from"../box";import{jsx as d}from"react/jsx-runtime";import{jsxs as n}from"react/jsx-runtime";function f({colorScheme:e="guru",size:f="md",rounded:p="md",dateInvalidIcon:u,...x}){const{locale:h}=t(),v=o({...x,locale:h}),g=r(),{fieldProps:j}=m(x,v,g),{theme:S}=l();return n(a,{...j,ref:g,colorScheme:e,size:f,children:[v.segments.map(((e,r)=>d(i,{segment:e,state:v,rounded:p},`${e.text}-${r}`))),"invalid"===v.validationState&&d(s,{css:{mx:"$2"},children:u||d(c,{label:"Exclamation",color:null==S?void 0:S.colors.red11.value})})]})}export default f;