UNPKG

@gsretail.com/gui-core

Version:

A skeleton to create your own React component library using Rollup, TypeScript, Sass and Storybook

2 lines (1 loc) 1.92 kB
import e from"../../../@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js";import o from"../../../@babel/runtime/helpers/esm/extends.js";import*as r from"react";import t from"@mui/material/Typography";import{styled as a,useThemeProps as i}from"@mui/material/styles";import{unstable_composeClasses as l}from"@mui/material";import{PickersToolbar as s}from"../internals/components/PickersToolbar.js";import{useUtils as m,useLocaleText as n}from"../internals/hooks/useUtils.js";import{isYearOnlyView as b,isYearAndMonthViews as p}from"./shared.js";import{getDatePickerToolbarUtilityClass as c}from"./datePickerToolbarClasses.js";import{jsx as d}from"react/jsx-runtime";const u=["parsedValue","isLandscape","isMobileKeyboardViewOpen","onChange","toggleMobileKeyboardView","toolbarFormat","toolbarPlaceholder","toolbarTitle","views"],f=a(s,{name:"MuiDatePickerToolbar",slot:"Root",overridesResolver:(e,o)=>o.root})({}),h=a(t,{name:"MuiDatePickerToolbar",slot:"Title",overridesResolver:(e,o)=>o.title})((({ownerState:e})=>o({},e.isLandscape&&{margin:"auto 16px auto auto"}))),g=r.forwardRef((function(t,a){const s=i({props:t,name:"MuiDatePickerToolbar"}),{parsedValue:g,isLandscape:y,isMobileKeyboardViewOpen:T,toggleMobileKeyboardView:w,toolbarFormat:M,toolbarPlaceholder:P="––",toolbarTitle:j,views:k}=s,V=e(s,u),v=m(),D=n(),K=(e=>{const{classes:o}=e;return l({root:["root"],title:["title"]},c,o)})(s),L=null!=j?j:D.datePickerDefaultToolbarTitle,x=r.useMemo((()=>g?M?v.formatByString(g,M):b(k)?v.format(g,"year"):p(k)?v.format(g,"month"):/en/.test(v.getCurrentLocaleCode())?v.format(g,"normalDateWithWeekday"):v.format(g,"normalDate"):P),[g,M,P,v,k]),C=s;return d(f,o({ref:a,toolbarTitle:L,isMobileKeyboardViewOpen:T,toggleMobileKeyboardView:w,isLandscape:y,className:K.root},V,{children:d(h,{variant:"h4",align:y?"left":"center",ownerState:C,className:K.title,children:x})}))}));export{g as DatePickerToolbar};