@gsretail.com/gui-core
Version:
A skeleton to create your own React component library using Rollup, TypeScript, Sass and Storybook
2 lines (1 loc) • 965 B
JavaScript
import e from"../../../../@babel/runtime/helpers/esm/extends.js";import*as r from"react";import{useEventCallback as o}from"@mui/material/utils";import{onSpaceOrEnter as a}from"../utils/utils.js";import{useLocaleText as i,useUtils as l}from"../hooks/useUtils.js";import{getDisplayDate as t}from"../utils/text-field-helper.js";const s=r.forwardRef((function(s,n){const{disabled:p,getOpenDialogAriaText:u,inputFormat:m,InputProps:d,inputRef:f,label:c,openPicker:b,rawValue:P,renderInput:y,TextFieldProps:k={},validationError:x,className:O}=s,g=i(),j=null!=u?u:g.openDatePickerDialogue,D=l(),h=r.useMemo((()=>e({},d,{readOnly:!0})),[d]),w=t(D,P,m),I=o((e=>{e.stopPropagation(),b()}));return y(e({label:c,disabled:p,ref:n,inputRef:f,error:x,InputProps:h,className:O},!s.readOnly&&!s.disabled&&{onClick:I},{inputProps:e({disabled:p,readOnly:!0,"aria-readonly":!0,"aria-label":j(P,D),value:w},!s.readOnly&&{onClick:I},{onKeyDown:a(b)})},k))}));export{s as PureDateInput};