@guruhotel/aura-ui
Version:
⚛️ React UI library by GuruHotel
1 lines • 3.91 kB
JavaScript
exports.__esModule=!0,exports.CalendarCell=function({state:p,date:S,currentMonth:f,numberOfDays:b}){const{rounded:g,colorScheme:m,tooltip:v,dateUnavailableStyle:y}=(0,u.useCalendarProps)(),x=(0,e.useRef)(null),{cellProps:D,buttonProps:j,isSelected:C,isDisabled:P,formattedDate:R}=(0,t.useCalendarCell)({date:S},p,x),q=p.isCellUnavailable(S)&&!P,O=!(0,r.isSameMonth)(f,S),T=p.highlightedRange?(0,r.isSameDay)(S,p.highlightedRange.start):C,F=p.highlightedRange?(0,r.isSameDay)(S,p.highlightedRange.end):C,{locale:V}=(0,i.useLocale)(),w=(0,r.getDayOfWeek)(S,V),$=C&&(T||0===w||1===S.day)&&void 0!==g,z=C&&(F||6===w||S.day===S.calendar.getDaysInMonth(S))&&void 0!==g,M=C&&F&&!q,W=C&&T&&!q,{focusProps:E,isFocusVisible:k}=(0,o.useFocusRing)(),_=(0,n.getStylesWithColorScheme)({isRoundedLeft:$,isSelected:C,colorScheme:m,isSelectionStart:T,isSelectionEnd:F,isFocusVisible:k,isUnavailable:q,isDisabled:P}),H=()=>{if("dot"===y){if(q)return(0,h.jsx)(d.Status,{colorScheme:"red",css:{...c.DOT_CSS}});if(!(C||k||P))return(0,h.jsx)(d.Status,{css:{...c.DOT_CSS}})}return null};return(0,h.jsx)(a.Td,{...D,isCell:!0,isFocusVisible:k,children:(0,h.jsx)(a.TdContainer,{...(0,s.mergeProps)(j,E),ref:x,hidden:O,isRoundedLeft:$?g:void 0,isRoundedRight:z?g:void 0,isDisabled:P,css:{bg:_.containerBg},children:(0,h.jsx)(l.TooltipWrapper,{hoverEndSelection:M,hoverStartSelection:W,numberOfDays:b,tooltip:v,children:(0,h.jsxs)(a.TdText,{isSelected:C,isDisabled:P,isFocusVisible:k,isSelectionStart:T,isSelectionEnd:F,isUnavailable:q,containDot:"dot"===y,rounded:g,css:{boxShadow:_.boxShadowFocusVisible,..._.stylesWhenIsSelectionStart,..._.stylesWhenIsSelectionEnd,..._.compoundVariantsForSelectionStart,..._.compoundVariantsForSelectionEnd,..._.hoverElementThatIsNotSelection,..._.hoverStartSelection,..._.hoverEndSelection},children:[R,(0,h.jsx)(H,{})]})})})})},exports.CalendarHorizontalCell=function(r){const{size:d,colorScheme:c,rounded:p}=(0,u.useCalendarProps)(),S=(0,n.decreaseResponsiveValue)(d,"fontSize"),f=(0,n.increaseResponsiveValue)(d,"fontSize"),b=(0,e.useRef)(null),{cellProps:g,buttonProps:m,isDisabled:v,isSelected:y}=(0,t.useCalendarCell)(r,r.state,b),x=(0,i.useDateFormatter)({day:"2-digit",weekday:"short",month:"long",timeZone:r.state.timeZone,calendar:r.date.calendar.identifier}),D=x.formatToParts(r.date.toDate(r.state.timeZone)),{focusProps:j,isFocusVisible:C}=(0,o.useFocusRing)();return(0,h.jsx)(l.HorizontalTooltip,{extendedDate:x.format(r.date.toDate(r.state.timeZone)),children:(0,h.jsx)(a.TdHorizontal,{...g,children:(0,h.jsxs)(a.HorizontalContainer,{isDisabled:v,colorScheme:c,rounded:p,isFocusVisible:C,...(0,s.mergeProps)(m,j),ref:b,css:{color:C?`$${c}9`:void 0,background:y?`$${c}3`:void 0,boxShadow:y?`0 0 0 2px $colors$${c}9`:void 0},children:[(0,h.jsx)(a.DayText,{as:"span",css:{...S},children:D[0].value}),(0,h.jsx)(a.NumberDayText,{as:"span",isSelected:y,css:{color:y?`$${c}9`:"$text11",...f},children:D[2].value})]})})})};var e=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=p(t);if(r&&r.has(e))return r.get(e);var i={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var a=o?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(i,s,a):i[s]=e[s]}i.default=e,r&&r.set(e,i);return i}(require("react")),t=require("@react-aria/calendar"),r=require("@internationalized/date"),i=require("@react-aria/i18n"),o=require("@react-aria/focus"),s=require("@react-aria/utils"),a=require("./calendar.styles"),n=require("./utils"),l=require("./tooltip-wrapper"),d=require("../status"),c=require("./calendar.constants"),u=require("./calendar-props.provider"),h=require("react/jsx-runtime");function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(p=function(e){return e?r:t})(e)}