minerva-design 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/custom-elements.json +663 -0
- package/dist/angular/fesm2022/minerva-angular.mjs +1163 -34
- package/dist/angular/fesm2022/minerva-angular.mjs.map +1 -1
- package/dist/angular/types/minerva-angular.d.ts +237 -1
- package/dist/core/calendar-date.d.cts +5 -0
- package/dist/core/calendar-date.d.ts +5 -0
- package/dist/core/contracts.cjs +1 -1
- package/dist/core/contracts.cjs.map +1 -1
- package/dist/core/contracts.js +1 -1
- package/dist/core/contracts.js.map +1 -1
- package/dist/core/index.cjs +6 -6
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +671 -630
- package/dist/core/index.js.map +1 -1
- package/dist/core/styling-hooks/components/date-picker.d.cts +45 -0
- package/dist/core/styling-hooks/components/date-picker.d.ts +45 -0
- package/dist/core/styling-hooks/manifest.d.cts +44 -0
- package/dist/core/styling-hooks/manifest.d.ts +44 -0
- package/dist/core/styling-hooks.cjs +1 -1
- package/dist/core/styling-hooks.cjs.map +1 -1
- package/dist/core/styling-hooks.js +62 -0
- package/dist/core/styling-hooks.js.map +1 -1
- package/dist/native/components/Calendar/Calendar.cjs +1 -1
- package/dist/native/components/Calendar/Calendar.cjs.map +1 -1
- package/dist/native/components/Calendar/Calendar.d.cts +2 -0
- package/dist/native/components/Calendar/Calendar.d.ts +2 -0
- package/dist/native/components/Calendar/Calendar.js +115 -112
- package/dist/native/components/Calendar/Calendar.js.map +1 -1
- package/dist/native/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/native/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/native/components/Checkbox/Checkbox.js +8 -8
- package/dist/native/components/Checkbox/CheckboxGroup.cjs +1 -1
- package/dist/native/components/Checkbox/CheckboxGroup.cjs.map +1 -1
- package/dist/native/components/Checkbox/CheckboxGroup.js +6 -6
- package/dist/native/components/DatePicker/DatePicker.cjs +2 -0
- package/dist/native/components/DatePicker/DatePicker.cjs.map +1 -0
- package/dist/native/components/DatePicker/DatePicker.d.cts +40 -0
- package/dist/native/components/DatePicker/DatePicker.d.ts +40 -0
- package/dist/native/components/DatePicker/DatePicker.js +110 -0
- package/dist/native/components/DatePicker/DatePicker.js.map +1 -0
- package/dist/native/components/DatePicker/index.cjs +1 -0
- package/dist/native/components/DatePicker/index.d.cts +2 -0
- package/dist/native/components/DatePicker/index.d.ts +2 -0
- package/dist/native/components/DatePicker/index.js +2 -0
- package/dist/native/components/Radio/RadioGroup.cjs +1 -1
- package/dist/native/components/Radio/RadioGroup.cjs.map +1 -1
- package/dist/native/components/Radio/RadioGroup.js +9 -9
- package/dist/native/components/Switch/Switch.cjs +1 -1
- package/dist/native/components/Switch/Switch.cjs.map +1 -1
- package/dist/native/components/Switch/Switch.js +23 -23
- package/dist/native/components/Switch/Switch.js.map +1 -1
- package/dist/native/index.cjs +1 -1
- package/dist/native/index.d.cts +1 -0
- package/dist/native/index.d.ts +1 -0
- package/dist/native/index.js +70 -68
- package/dist/native/source/components/Calendar/Calendar.tsx +14 -6
- package/dist/native/source/components/DatePicker/DatePicker.tsx +201 -0
- package/dist/native/source/components/DatePicker/index.ts +2 -0
- package/dist/native/source/index.ts +1 -0
- package/dist/native/source/manifest.ts +6 -0
- package/dist/react/components/DatePicker/DatePicker.cjs +2 -0
- package/dist/react/components/DatePicker/DatePicker.cjs.map +1 -0
- package/dist/react/components/DatePicker/DatePicker.d.cts +13 -0
- package/dist/react/components/DatePicker/DatePicker.d.ts +13 -0
- package/dist/react/components/DatePicker/DatePicker.js +315 -0
- package/dist/react/components/DatePicker/DatePicker.js.map +1 -0
- package/dist/react/components/DatePicker/datePicker.module.scss.cjs +2 -0
- package/dist/react/components/DatePicker/datePicker.module.scss.cjs.map +1 -0
- package/dist/react/components/DatePicker/datePicker.module.scss.js +23 -0
- package/dist/react/components/DatePicker/datePicker.module.scss.js.map +1 -0
- package/dist/react/components/DatePicker/index.cjs +1 -0
- package/dist/react/components/DatePicker/index.d.cts +5 -0
- package/dist/react/components/DatePicker/index.d.ts +5 -0
- package/dist/react/components/DatePicker/index.js +3 -0
- package/dist/react/components/DatePicker/types.d.cts +97 -0
- package/dist/react/components/DatePicker/types.d.ts +97 -0
- package/dist/react/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/react/components/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/react/components/Tooltip/Tooltip.js +5 -5
- package/dist/react/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/react/components/index.cjs +1 -1
- package/dist/react/components/index.d.cts +1 -0
- package/dist/react/components/index.d.ts +1 -0
- package/dist/react/components/index.js +3 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +7 -6
- package/dist/react/style.css +1 -0
- package/dist/react/styles/date-picker.css +7 -0
- package/dist/taro/date-picker.d.ts +20 -0
- package/dist/taro/index.d.ts +1 -0
- package/dist/taro/index.js +1155 -990
- package/dist/uni/DatePicker.vue +225 -0
- package/dist/uni/DatePicker.vue.d.ts +36 -0
- package/dist/uni/MonthCalendar.vue +2 -0
- package/dist/uni/MonthCalendar.vue.d.ts +2 -0
- package/dist/uni/index.d.ts +1 -0
- package/dist/uni/index.js +1 -0
- package/dist/uni/manifest.d.ts +7 -0
- package/dist/uni/manifest.js +8 -0
- package/dist/vue/components/DatePicker/DatePicker.vue.d.ts +36 -0
- package/dist/vue/components/DatePicker/DatePicker.vue.js +7 -0
- package/dist/vue/components/DatePicker/DatePicker.vue.js.map +1 -0
- package/dist/vue/components/DatePicker/DatePicker.vue_vue_type_script_setup_true_lang.js +380 -0
- package/dist/vue/components/DatePicker/DatePicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/DatePicker/index.d.ts +2 -0
- package/dist/vue/components/DatePicker/index.js +2 -0
- package/dist/vue/components/DatePicker/types.d.ts +26 -0
- package/dist/vue/components/MonthCalendar/MonthCalendar.vue.d.ts +1 -1
- package/dist/vue/global.d.ts +108 -0
- package/dist/vue/groups/forms-pickers.d.ts +1 -0
- package/dist/vue/groups/forms-pickers.js +5 -2
- package/dist/vue/groups/forms-pickers.js.map +1 -1
- package/dist/vue/index.js +95 -94
- package/dist/weapp/controls.js +259 -76
- package/dist/weapp/date-picker/index.js +1 -0
- package/dist/weapp/date-picker/index.json +1 -0
- package/dist/weapp/date-picker/index.wxml +1 -0
- package/dist/weapp/date-picker/index.wxss +1 -0
- package/dist/weapp/types.d.ts +19 -0
- package/dist/web-components/cdn/minerva.js +461 -335
- package/dist/web-components/cdn/minerva.js.map +1 -1
- package/dist/web-components/components/date-picker/date-picker.d.ts +110 -0
- package/dist/web-components/components/date-picker/date-picker.js +378 -0
- package/dist/web-components/components/date-picker/date-picker.js.map +1 -0
- package/dist/web-components/elements/date-picker.d.ts +1 -0
- package/dist/web-components/elements/date-picker.js +8 -0
- package/dist/web-components/elements/date-picker.js.map +1 -0
- package/dist/web-components/html-custom-data.json +85 -0
- package/dist/web-components/index.d.ts +1 -0
- package/dist/web-components/index.js +8 -6
- package/dist/web-components/styles/DatePicker/datePicker.css.js +6 -0
- package/dist/web-components/styles/DatePicker/datePicker.css.js.map +1 -0
- package/dist/web-components/types/react.d.ts +12 -0
- package/dist/web-components/types/solid.d.ts +9 -0
- package/dist/web-components/types/svelte.d.ts +9 -0
- package/dist/web-components/types/vue.d.ts +10 -0
- package/package.json +9 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../../theme/MinervaProvider.cjs"),t=require("../../internal/parts.cjs"),n=require("../../internal/styles.cjs"),r=require("../Button/Button.cjs");require("../Button/index.cjs");const i=require("../../internal/Icon.cjs"),a=require("../../internal/Overlay.cjs"),o=require("../../internal/useMachine.cjs"),s=require("../../internal/useOverlay.cjs"),c=require("../../internal/useControllable.cjs");let l=require("react"),u=require("react-native"),d=require("../../../core/index.cjs"),f=require("react/jsx-runtime");var p=[`sun`,`mon`,`tue`,`wed`,`thu`,`fri`,`sat`],m={small:`control-height-sm`,medium:`control-height-md`,large:`control-height-lg`},h=e=>{let[t,n,r]=e.split(`-`).map(Number);return(0,d.localDate)(t,n-1,r)},g=e=>{if(e!==void 0)return e===null?[]:(Array.isArray(e)?e:[e]).map(d.dayKey)};function _(e){let t=e?.join(`\0`);return(0,l.useMemo)(()=>t===void 0?void 0:t===``?[]:t.split(`\0`),[t])}function v(e){return e.poppable?(0,f.jsx)(y,{...e}):(0,f.jsx)(b,{...e})}function y({open:o,defaultOpen:l=!1,onOpenChange:d,title:p,confirmText:m,onConfirm:h,onChange:g,value:_,defaultValue:v=null,type:y=`single`,...x}){let{tokens:S,fonts:C}=e.useTheme(),{t:w}=e.useI18n(),T=s.useOverlay({open:o,defaultOpen:l,onOpenChange:d}),[E,D]=c.useControllable(_,v,g);if(T.state.phase===`closed`)return null;let O=Array.isArray(E)?E.length>0:E!==null,k=p??w(`calendar.title`),A=typeof k==`string`||typeof k==`number`?String(k):void 0;return(0,f.jsxs)(a.Overlay,{component:`calendar`,phase:T.state.phase,onAnimationEnd:T.onAnimationEnd,onRequestClose:T.close,placement:`bottom`,panelProps:{role:`dialog`,accessibilityLabel:A},children:[(0,f.jsxs)(u.View,{style:{flexDirection:`row`,alignItems:`center`,justifyContent:`center`,paddingVertical:S.space[4],paddingHorizontal:S.space[12]},...t.part(`calendar`,`header`),children:[A===void 0?k:(0,f.jsx)(u.Text,{accessibilityRole:`header`,style:[n.textStyle(S,`lg`,C.sans),{fontWeight:n.weight(S,`semibold`)}],...t.part(`calendar`,`title`),children:A}),(0,f.jsx)(u.Pressable,{accessibilityRole:`button`,accessibilityLabel:w(`modal.close`),hitSlop:n.hitSlopFor(S,28,28),onPress:()=>T.close(`close-button`),style:({pressed:e})=>({position:`absolute`,right:S.space[4],width:28,height:28,borderRadius:14,alignItems:`center`,justifyContent:`center`,backgroundColor:e?S.colors[`surface-muted-color`]:`transparent`}),...t.part(`calendar`,`close`),children:(0,f.jsx)(i.Icon,{name:`close`,size:14,color:S.colors[`text-muted-color`]})})]}),(0,f.jsx)(b,{...x,type:y,value:E,onChange:D,style:[{paddingHorizontal:S.space[2]},x.style]}),(0,f.jsx)(u.View,{style:{padding:S.space[4],paddingTop:S.space[2]},...t.part(`calendar`,`footer`),children:(0,f.jsx)(r.Button,{fullWidth:!0,disabled:!O,onPress:()=>{h?.(E),T.close(`confirm`)},children:m??w(`calendar.confirm`)})})]})}function b({type:r=`single`,value:a,defaultValue:s=null,onChange:v,onSelect:y,month:b,defaultMonth:x,onMonthChange:S,minDate:C,maxDate:w,disabledDate:T,firstDayOfWeek:E=0,size:
|
|
1
|
+
const e=require("../../theme/MinervaProvider.cjs"),t=require("../../internal/parts.cjs"),n=require("../../internal/styles.cjs"),r=require("../Button/Button.cjs");require("../Button/index.cjs");const i=require("../../internal/Icon.cjs"),a=require("../../internal/Overlay.cjs"),o=require("../../internal/useMachine.cjs"),s=require("../../internal/useOverlay.cjs"),c=require("../../internal/useControllable.cjs");let l=require("react"),u=require("react-native"),d=require("../../../core/index.cjs"),f=require("react/jsx-runtime");var p=[`sun`,`mon`,`tue`,`wed`,`thu`,`fri`,`sat`],m={small:`control-height-sm`,medium:`control-height-md`,large:`control-height-lg`},h=e=>{let[t,n,r]=e.split(`-`).map(Number);return(0,d.localDate)(t,n-1,r)},g=e=>{if(e!==void 0)return e===null?[]:(Array.isArray(e)?e:[e]).map(d.dayKey)};function _(e){let t=e?.join(`\0`);return(0,l.useMemo)(()=>t===void 0?void 0:t===``?[]:t.split(`\0`),[t])}function v(e){return e.poppable?(0,f.jsx)(y,{...e}):(0,f.jsx)(b,{...e})}function y({open:o,defaultOpen:l=!1,onOpenChange:d,title:p,confirmText:m,onConfirm:h,onChange:g,value:_,defaultValue:v=null,type:y=`single`,...x}){let{tokens:S,fonts:C}=e.useTheme(),{t:w}=e.useI18n(),T=s.useOverlay({open:o,defaultOpen:l,onOpenChange:d}),[E,D]=c.useControllable(_,v,g);if(T.state.phase===`closed`)return null;let O=Array.isArray(E)?E.length>0:E!==null,k=p??w(`calendar.title`),A=typeof k==`string`||typeof k==`number`?String(k):void 0;return(0,f.jsxs)(a.Overlay,{component:`calendar`,phase:T.state.phase,onAnimationEnd:T.onAnimationEnd,onRequestClose:T.close,placement:`bottom`,panelProps:{role:`dialog`,accessibilityLabel:A},children:[(0,f.jsxs)(u.View,{style:{flexDirection:`row`,alignItems:`center`,justifyContent:`center`,paddingVertical:S.space[4],paddingHorizontal:S.space[12]},...t.part(`calendar`,`header`),children:[A===void 0?k:(0,f.jsx)(u.Text,{accessibilityRole:`header`,style:[n.textStyle(S,`lg`,C.sans),{fontWeight:n.weight(S,`semibold`)}],...t.part(`calendar`,`title`),children:A}),(0,f.jsx)(u.Pressable,{accessibilityRole:`button`,accessibilityLabel:w(`modal.close`),hitSlop:n.hitSlopFor(S,28,28),onPress:()=>T.close(`close-button`),style:({pressed:e})=>({position:`absolute`,right:S.space[4],width:28,height:28,borderRadius:14,alignItems:`center`,justifyContent:`center`,backgroundColor:e?S.colors[`surface-muted-color`]:`transparent`}),...t.part(`calendar`,`close`),children:(0,f.jsx)(i.Icon,{name:`close`,size:14,color:S.colors[`text-muted-color`]})})]}),(0,f.jsx)(b,{...x,type:y,value:E,onChange:D,style:[{paddingHorizontal:S.space[2]},x.style]}),(0,f.jsx)(u.View,{style:{padding:S.space[4],paddingTop:S.space[2]},...t.part(`calendar`,`footer`),children:(0,f.jsx)(r.Button,{fullWidth:!0,disabled:!O,onPress:()=>{h?.(E),T.close(`confirm`)},children:m??w(`calendar.confirm`)})})]})}function b({type:r=`single`,value:a,defaultValue:s=null,onChange:v,onSelect:y,month:b,defaultMonth:x,onMonthChange:S,minDate:C,maxDate:w,disabledDate:T,firstDayOfWeek:E=0,locale:D,size:O=`medium`,disabled:k=!1,previousMonthLabel:A,nextMonthLabel:ee,style:te,accessibilityLabel:ne,poppable:re,open:ie,defaultOpen:ae,onOpenChange:oe,title:se,confirmText:ce,onConfirm:le,...ue}){let{tokens:j,fonts:de}=e.useTheme(),{t:M,language:N}=e.useI18n(),[P]=(0,l.useState)(()=>{let e=new Date;return(0,d.localDate)(e.getFullYear(),e.getMonth(),e.getDate())}),fe=(0,d.dayKey)(P),F=C?(0,d.dayKey)(C):void 0,I=w?(0,d.dayKey)(w):void 0,L=e=>{let t=(0,d.dayKey)(e);return F!==void 0&&t<F||I!==void 0&&t>I||!!T?.(e)},pe=e=>{let t=e.map(h);return r===`single`?t[0]??null:r===`range`?t.length===2?[t[0],t[1]]:null:t},me=_(g(a)),[R,z]=o.useMachine(d.createSelectionMachine,{mode:r===`single`?`single`:`multiple`,value:me,defaultValue:g(s)??[],isDisabled:e=>L(h(e)),max:r===`range`?2:void 0,onValueChange:e=>v?.(pe(e))}),[B,V]=(0,l.useState)(null),H=R.value,U=r===`range`?B===null?H.length===2?[H[0],H[1]]:null:[B,B]:null,he=H[0]?h(H[0]):void 0,[ge,W]=c.useControllable(b,x??he??(C&&C>P?C:P),S),G=(0,d.monthStart)(ge),_e=!k&&(!C||G>(0,d.monthStart)(C)),ve=!k&&(!w||(0,d.monthStart)(G,1)<=w),ye=e=>{let t=(0,d.dayKey)(e);y?.(e),r===`single`?z({type:`SELECT`,value:t}):r===`multiple`?z({type:`TOGGLE`,value:t}):B===null||t<B?V(t):(V(null),z({type:`SET`,value:[B,t]})),(0,d.sameMonth)(e,G)||W((0,d.monthStart)(e))},be=(0,l.useMemo)(()=>{try{let e=new Intl.DateTimeFormat(D??N,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`});return t=>e.format(t)}catch{return e=>e.toDateString()}},[N,D]),K=(G.getDay()-E+7)%7,xe=(0,d.localDate)(G.getFullYear(),G.getMonth()+1,0).getDate(),q=[...Array.from({length:K},()=>null),...Array.from({length:xe},(e,t)=>(0,d.addDays)(G,t))];for(;q.length%7;)q.push(null);let J=[];for(let e=0;e<q.length;e+=7)J.push(q.slice(e,e+7));let Y=j.sizes[m[O]],X=Math.min(Y-j.space[1],44),Z=j.colors[`primary-color`],Q=de.sans,$=e=>{let r=e<0?_e:ve,a=e<0?A??M(`monthCalendar.previousMonth`):ee??M(`monthCalendar.nextMonth`);return(0,f.jsx)(u.Pressable,{accessibilityRole:`button`,accessibilityLabel:a,accessibilityState:{disabled:!r},disabled:!r,hitSlop:n.hitSlopFor(j,32,32),onPress:()=>W((0,d.monthStart)(G,e)),style:({pressed:e})=>({width:32,height:32,borderRadius:16,alignItems:`center`,justifyContent:`center`,opacity:r?1:.35,backgroundColor:e?j.colors[`surface-muted-color`]:`transparent`}),...t.part(`calendar`,e<0?`prev`:`next`),children:(0,f.jsx)(i.Icon,{name:e<0?`chevron-left`:`chevron-right`,size:16,color:j.colors[`text-secondary-color`]})})},Se=e=>{let r=(0,d.dayKey)(e),i=k||L(e),a=r===fe,o=U?.[0]===r,s=U?.[1]===r&&B===null,c=!!U&&r>U[0]&&r<U[1],l=U?o||s:H.includes(r),p=l||c,m=U?.[0]===U?.[1],h=[a?M(`monthCalendar.today`):void 0,o?M(`calendar.rangeStart`):void 0,s?M(`calendar.rangeEnd`):void 0].filter(Boolean),g=[be(e),...h].join(`, `),_=i?j.colors[`text-disabled-color`]:l?j.colors[`text-inverse-color`]:c?j.colors[`primary-color-text`]:a?Z:j.colors[`text-color`],v=j.colors[`primary-color-subtle`];return(0,f.jsxs)(u.Pressable,{accessibilityRole:`button`,accessibilityLabel:g,accessibilityState:{selected:p,disabled:i},"aria-selected":p,disabled:i,onPress:()=>ye(e),style:{flex:1,height:Y,alignItems:`center`,justifyContent:`center`,backgroundColor:c?v:`transparent`},...t.part(`calendar`,`day`,{selected:p,today:a,disabled:i,"range-start":o&&!!U,"range-end":s,"range-middle":c}),children:[U&&!m&&(o||s)&&(0,f.jsx)(u.View,{style:{position:`absolute`,top:0,bottom:0,left:o?`50%`:0,right:s?`50%`:0,backgroundColor:v}}),(0,f.jsxs)(u.View,{style:{width:X,height:X,borderRadius:X/2,alignItems:`center`,justifyContent:`center`,backgroundColor:l&&!i?Z:`transparent`,borderWidth:a&&!l?1:0,borderColor:Z},children:[(0,f.jsx)(u.Text,{allowFontScaling:!1,style:[n.textStyle(j,O===`small`?`sm`:`md`,Q),{color:_,fontWeight:n.weight(j,l||a?`semibold`:`regular`)}],children:e.getDate()}),(o||s)&&!m&&O!==`small`&&(0,f.jsx)(u.Text,{allowFontScaling:!1,style:{position:`absolute`,bottom:-j.space[`0-5`],fontSize:j.fontSize.xs-3,color:j.colors[`text-inverse-color`],...Q?{fontFamily:Q}:null},children:M(o?`calendar.rangeStart`:`calendar.rangeEnd`)})]})]},r)};return(0,f.jsxs)(u.View,{role:`group`,accessibilityLabel:ne??M(`monthCalendar.label`),...t.part(`calendar`,`root`,{type:r,disabled:k}),...ue,style:[{backgroundColor:j.colors[`surface-color`]},te],children:[(0,f.jsxs)(u.View,{style:{flexDirection:`row`,alignItems:`center`,justifyContent:`space-between`,paddingHorizontal:j.space[2],paddingVertical:j.space[2]},children:[$(-1),(0,f.jsx)(u.Text,{accessibilityRole:`header`,accessibilityLiveRegion:`polite`,style:[n.textStyle(j,`lg`,Q),{fontWeight:n.weight(j,`semibold`)}],...t.part(`calendar`,`month-title`),children:D?new Intl.DateTimeFormat(D,{year:`numeric`,month:`long`}).format(G):M(`calendar.monthTitle`,{year:G.getFullYear(),month:G.getMonth()+1})}),$(1)]}),(0,f.jsx)(u.View,{importantForAccessibility:`no-hide-descendants`,accessibilityElementsHidden:!0,style:{flexDirection:`row`,paddingVertical:j.space[1]},...t.part(`calendar`,`weekdays`),children:Array.from({length:7},(e,t)=>{let r=p[(E+t)%7];return(0,f.jsx)(u.Text,{style:[n.textStyle(j,`xs`,Q),{flex:1,textAlign:`center`,color:j.colors[`text-muted-color`]}],children:M(`monthCalendar.weekdays.${r}`)},r)})}),J.map((e,n)=>(0,f.jsx)(u.View,{style:{flexDirection:`row`,marginBottom:j.space[`0-5`]},...t.part(`calendar`,`week`),children:e.map((e,t)=>e?Se(e):(0,f.jsx)(u.View,{style:{flex:1,height:Y}},`empty-${t}`))},n))]})}exports.Calendar=v;
|
|
2
2
|
//# sourceMappingURL=Calendar.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.cjs","names":["localDate","dayKey","useMemo","useTheme","useI18n","useOverlay","useControllable","Overlay","View","part","Text","textStyle","weight","Pressable","hitSlopFor","Icon","Button","useState","useMachine","createSelectionMachine","monthStart","sameMonth","addDays","require_MinervaProvider","require_parts","require_styles","require_Button","require_Icon","require_Overlay","require_useMachine","require_useOverlay","require_useControllable","react","react_native","_minerva_core","react_jsx_runtime","WEEKDAYS","CELL_HEIGHT","parseKey","y","m","d","key","keysOf","value","useStableKeys","joined","keys","Calendar","props","PoppableCalendar","CalendarView","rest","t","translate","overlay","current","setCurrent","defaultValue","onChange","ready","titleNode","title","titleText","fonts","pressed","onConfirm","confirmText","_poppable","_open","_defaultOpen","_onOpenChange","_title","_confirmText","_onConfirm","today","now","todayKey","minKey","minDate","maxKey","maxDate","isDisabled","date","disabledDate","toValue","dates","type","controlledKeys","state","send","pendingStart","setPendingStart","selected","rangeKeys","firstSelected","shownMonth","setShownMonth","month","defaultMonth","onMonthChange","first","canPrev","disabled","canNext","press","onSelect","fullDate","format","language","lead","firstDayOfWeek","daysInMonth","cells","i","weeks","cellHeight","size","dot","primary","sans","navButton","enabled","direction","label","previousMonthLabel","nextMonthLabel","renderDay","off","isToday","start","end","middle","filled","isSelected","singleDayRange","suffixes","textColor","band","accessibilityLabel","style","name","week","col","row"],"sources":["../../../../../native/src/components/Calendar/Calendar.tsx"],"sourcesContent":["import { useMemo, useState, type ReactNode } from \"react\";\nimport {\n Pressable,\n Text,\n View,\n type StyleProp,\n type ViewProps,\n type ViewStyle,\n} from \"react-native\";\nimport {\n addDays,\n createSelectionMachine,\n dayKey,\n localDate,\n monthStart,\n sameMonth,\n} from \"@minerva/core\";\nimport { useI18n, useTheme } from \"../../theme/MinervaProvider\";\nimport { Icon } from \"../../internal/Icon\";\nimport { Overlay, type OverlayCloseReason } from \"../../internal/Overlay\";\nimport { part } from \"../../internal/parts\";\nimport { hitSlopFor, textStyle, weight } from \"../../internal/styles\";\nimport { useControllable } from \"../../internal/useControllable\";\nimport { useMachine } from \"../../internal/useMachine\";\nimport { useOverlay } from \"../../internal/useOverlay\";\nimport { Button } from \"../Button\";\n\n/** Selection type of `Calendar` */\nexport type CalendarType = \"single\" | \"multiple\" | \"range\";\n\n/**\n * Value of `Calendar`: a day (`single`, `null`: none), days (`multiple`) or\n * a `[start, end]` range (`range`); every date is local midnight\n */\nexport type CalendarValue = Date | Date[] | [Date, Date] | null;\n\n/** Why a poppable calendar closed */\nexport type CalendarCloseReason = OverlayCloseReason;\n\nexport interface CalendarProps extends Omit<ViewProps, \"style\" | \"children\"> {\n /**\n * Selection type: one day, several days, or a range\n * @default \"single\"\n */\n type?: CalendarType;\n /**\n * Selected day(s) (controlled; pair with `onChange`): a `Date` (`single`),\n * `Date[]` (`multiple`) or `[start, end]` (`range`)\n */\n value?: CalendarValue;\n /** Initially selected day(s) (uncontrolled) @default null */\n defaultValue?: CalendarValue;\n /**\n * Called with the new selection (a range once both ends are picked)\n */\n onChange?: (value: CalendarValue) => void;\n /** Called with every pressed day */\n onSelect?: (date: Date) => void;\n /** Displayed month (controlled; any day of the month; pair with `onMonthChange`) */\n month?: Date;\n /**\n * Initially displayed month (uncontrolled)\n * @default the month of the first selected day, else of today\n */\n defaultMonth?: Date;\n /** Called with the first day of the month navigated to */\n onMonthChange?: (month: Date) => void;\n /** Earliest selectable day (earlier days are disabled) */\n minDate?: Date;\n /** Latest selectable day (later days are disabled) */\n maxDate?: Date;\n /** Extra disabled days */\n disabledDate?: (date: Date) => boolean;\n /**\n * First column of the week (0: Sunday ... 6: Saturday)\n * @default 0\n */\n firstDayOfWeek?: number;\n /**\n * Cell density: compact (\"small\"), default (\"medium\") or comfortable\n * (\"large\")\n * @default \"medium\"\n */\n size?: \"small\" | \"medium\" | \"large\";\n /**\n * Blocks navigation and selection\n * @default false\n */\n disabled?: boolean;\n /** Label of the previous-month button @default the \"monthCalendar.previousMonth\" message */\n previousMonthLabel?: string;\n /** Label of the next-month button @default the \"monthCalendar.nextMonth\" message */\n nextMonthLabel?: string;\n /**\n * Renders the calendar in a bottom sheet with a title and a confirm\n * button (`open` / `defaultOpen` / `onOpenChange`)\n * @default false\n */\n poppable?: boolean;\n /** Controlled open state of the poppable sheet */\n open?: boolean;\n /**\n * Initial open state of the poppable sheet while uncontrolled\n * @default false\n */\n defaultOpen?: boolean;\n /** Called with the requested open state of the sheet and the close reason */\n onOpenChange?: (open: boolean, reason?: CalendarCloseReason) => void;\n /** Title of the poppable sheet @default the \"calendar.title\" message */\n title?: ReactNode;\n /** Text of the confirm button @default the \"calendar.confirm\" message */\n confirmText?: ReactNode;\n /** Called by the confirm button of the poppable sheet with the selection */\n onConfirm?: (value: CalendarValue) => void;\n /** Style of the calendar */\n style?: StyleProp<ViewStyle>;\n}\n\nconst WEEKDAYS = [\"sun\", \"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\"] as const;\nconst CELL_HEIGHT = {\n small: \"control-height-sm\",\n medium: \"control-height-md\",\n large: \"control-height-lg\",\n} as const;\n\nconst parseKey = (key: string) => {\n const [y, m, d] = key.split(\"-\").map(Number);\n return localDate(y, m - 1, d);\n};\n\n/** The selected day keys of a value */\nconst keysOf = (value: CalendarValue | undefined): string[] | undefined => {\n if (value === undefined) return undefined;\n if (value === null) return [];\n return (Array.isArray(value) ? value : [value]).map(dayKey);\n};\n\n/** The same array while its items are unchanged (controlled values) */\nfunction useStableKeys(keys: readonly string[] | undefined) {\n const joined = keys?.join(\"\\u0000\");\n return useMemo(\n () =>\n joined === undefined\n ? undefined\n : joined === \"\"\n ? []\n : joined.split(\"\\u0000\"),\n [joined],\n );\n}\n\n/**\n * A month calendar for picking a day, several days or a range: weekday\n * header, month navigation, min / max dates, today ring, selected fills\n * and range tint. Inline, or in a bottom sheet with a confirm button\n * (`poppable`). Single and multiple selections run on the selection\n * machine of @minerva/core.\n */\nexport function Calendar(props: CalendarProps) {\n if (!props.poppable) return <CalendarView {...props} />;\n return <PoppableCalendar {...props} />;\n}\n\nfunction PoppableCalendar({\n open,\n defaultOpen = false,\n onOpenChange,\n title,\n confirmText,\n onConfirm,\n onChange,\n value,\n defaultValue = null,\n type = \"single\",\n ...rest\n}: CalendarProps) {\n const { tokens: t, fonts } = useTheme();\n const { t: translate } = useI18n();\n const overlay = useOverlay({ open, defaultOpen, onOpenChange });\n // the sheet keeps the selection to confirm\n const [current, setCurrent] = useControllable<CalendarValue>(\n value,\n defaultValue,\n onChange,\n );\n if (overlay.state.phase === \"closed\") return null;\n const ready = Array.isArray(current) ? current.length > 0 : current !== null;\n const titleNode = title ?? translate(\"calendar.title\");\n const titleText =\n typeof titleNode === \"string\" || typeof titleNode === \"number\"\n ? String(titleNode)\n : undefined;\n const closeSize = 28;\n\n return (\n <Overlay\n component=\"calendar\"\n phase={overlay.state.phase}\n onAnimationEnd={overlay.onAnimationEnd}\n onRequestClose={overlay.close}\n placement=\"bottom\"\n panelProps={{ role: \"dialog\", accessibilityLabel: titleText }}\n >\n <View\n style={{\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"center\",\n paddingVertical: t.space[\"4\"],\n paddingHorizontal: t.space[\"12\"],\n }}\n {...part(\"calendar\", \"header\")}\n >\n {titleText !== undefined ? (\n <Text\n accessibilityRole=\"header\"\n style={[\n textStyle(t, \"lg\", fonts.sans),\n { fontWeight: weight(t, \"semibold\") },\n ]}\n {...part(\"calendar\", \"title\")}\n >\n {titleText}\n </Text>\n ) : (\n titleNode\n )}\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={translate(\"modal.close\")}\n hitSlop={hitSlopFor(t, closeSize, closeSize)}\n onPress={() => overlay.close(\"close-button\")}\n style={({ pressed }) => ({\n position: \"absolute\",\n right: t.space[\"4\"],\n width: closeSize,\n height: closeSize,\n borderRadius: closeSize / 2,\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: pressed\n ? t.colors[\"surface-muted-color\"]\n : \"transparent\",\n })}\n {...part(\"calendar\", \"close\")}\n >\n <Icon name=\"close\" size={14} color={t.colors[\"text-muted-color\"]} />\n </Pressable>\n </View>\n <CalendarView\n {...rest}\n type={type}\n value={current}\n onChange={setCurrent}\n style={[{ paddingHorizontal: t.space[\"2\"] }, rest.style]}\n />\n <View\n style={{ padding: t.space[\"4\"], paddingTop: t.space[\"2\"] }}\n {...part(\"calendar\", \"footer\")}\n >\n <Button\n fullWidth\n disabled={!ready}\n onPress={() => {\n onConfirm?.(current);\n overlay.close(\"confirm\");\n }}\n >\n {confirmText ?? translate(\"calendar.confirm\")}\n </Button>\n </View>\n </Overlay>\n );\n}\n\nfunction CalendarView({\n type = \"single\",\n value,\n defaultValue = null,\n onChange,\n onSelect,\n month,\n defaultMonth,\n onMonthChange,\n minDate,\n maxDate,\n disabledDate,\n firstDayOfWeek = 0,\n size = \"medium\",\n disabled = false,\n previousMonthLabel,\n nextMonthLabel,\n style,\n accessibilityLabel,\n // poppable-only props, unused inline\n poppable: _poppable,\n open: _open,\n defaultOpen: _defaultOpen,\n onOpenChange: _onOpenChange,\n title: _title,\n confirmText: _confirmText,\n onConfirm: _onConfirm,\n ...rest\n}: CalendarProps) {\n const { tokens: t, fonts } = useTheme();\n const { t: translate, language } = useI18n();\n const [today] = useState(() => {\n const now = new Date();\n return localDate(now.getFullYear(), now.getMonth(), now.getDate());\n });\n const todayKey = dayKey(today);\n const minKey = minDate ? dayKey(minDate) : undefined;\n const maxKey = maxDate ? dayKey(maxDate) : undefined;\n const isDisabled = (date: Date) => {\n const key = dayKey(date);\n return (\n (minKey !== undefined && key < minKey) ||\n (maxKey !== undefined && key > maxKey) ||\n !!disabledDate?.(date)\n );\n };\n\n const toValue = (keys: readonly string[]): CalendarValue => {\n const dates = keys.map(parseKey);\n if (type === \"single\") return dates[0] ?? null;\n if (type === \"range\") {\n return dates.length === 2 ? [dates[0], dates[1]] : null;\n }\n return dates;\n };\n const controlledKeys = useStableKeys(keysOf(value));\n const [state, send] = useMachine(createSelectionMachine<string>, {\n mode: type === \"single\" ? (\"single\" as const) : (\"multiple\" as const),\n value: controlledKeys,\n defaultValue: keysOf(defaultValue) ?? [],\n isDisabled: (key: string) => isDisabled(parseKey(key)),\n max: type === \"range\" ? 2 : undefined,\n onValueChange: (keys: string[]) => onChange?.(toValue(keys)),\n });\n // range: the first end picked, waiting for the second\n const [pendingStart, setPendingStart] = useState<string | null>(null);\n\n const selected = state.value;\n const rangeKeys: [string, string] | null =\n type === \"range\"\n ? pendingStart !== null\n ? [pendingStart, pendingStart]\n : selected.length === 2\n ? [selected[0], selected[1]]\n : null\n : null;\n\n const firstSelected = selected[0] ? parseKey(selected[0]) : undefined;\n const [shownMonth, setShownMonth] = useControllable<Date>(\n month,\n defaultMonth ??\n firstSelected ??\n (minDate && minDate > today ? minDate : today),\n onMonthChange,\n );\n const first = monthStart(shownMonth);\n const canPrev = !disabled && (!minDate || first > monthStart(minDate));\n const canNext = !disabled && (!maxDate || monthStart(first, 1) <= maxDate);\n\n const press = (date: Date) => {\n const key = dayKey(date);\n onSelect?.(date);\n if (type === \"single\") {\n send({ type: \"SELECT\", value: key });\n } else if (type === \"multiple\") {\n send({ type: \"TOGGLE\", value: key });\n } else if (pendingStart === null || key < pendingStart) {\n setPendingStart(key);\n } else {\n setPendingStart(null);\n send({ type: \"SET\", value: [pendingStart, key] });\n }\n if (!sameMonth(date, first)) setShownMonth(monthStart(date));\n };\n\n const fullDate = useMemo(() => {\n try {\n const format = new Intl.DateTimeFormat(language, {\n weekday: \"long\",\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n });\n return (date: Date) => format.format(date);\n } catch {\n return (date: Date) => date.toDateString();\n }\n }, [language]);\n\n const lead = (first.getDay() - firstDayOfWeek + 7) % 7;\n const daysInMonth = localDate(\n first.getFullYear(),\n first.getMonth() + 1,\n 0,\n ).getDate();\n const cells: (Date | null)[] = [\n ...Array.from({ length: lead }, () => null),\n ...Array.from({ length: daysInMonth }, (_, i) => addDays(first, i)),\n ];\n while (cells.length % 7) cells.push(null);\n const weeks: (Date | null)[][] = [];\n for (let i = 0; i < cells.length; i += 7) weeks.push(cells.slice(i, i + 7));\n\n const cellHeight = t.sizes[CELL_HEIGHT[size]];\n const dot = Math.min(cellHeight - t.space[\"1\"], 44);\n const primary = t.colors[\"primary-color\"];\n const sans = fonts.sans;\n const navSize = 32;\n\n const navButton = (direction: -1 | 1) => {\n const enabled = direction < 0 ? canPrev : canNext;\n const label =\n direction < 0\n ? (previousMonthLabel ?? translate(\"monthCalendar.previousMonth\"))\n : (nextMonthLabel ?? translate(\"monthCalendar.nextMonth\"));\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n accessibilityState={{ disabled: !enabled }}\n disabled={!enabled}\n hitSlop={hitSlopFor(t, navSize, navSize)}\n onPress={() => setShownMonth(monthStart(first, direction))}\n style={({ pressed }) => ({\n width: navSize,\n height: navSize,\n borderRadius: navSize / 2,\n alignItems: \"center\",\n justifyContent: \"center\",\n opacity: enabled ? 1 : 0.35,\n backgroundColor: pressed\n ? t.colors[\"surface-muted-color\"]\n : \"transparent\",\n })}\n {...part(\"calendar\", direction < 0 ? \"prev\" : \"next\")}\n >\n <Icon\n name={direction < 0 ? \"chevron-left\" : \"chevron-right\"}\n size={16}\n color={t.colors[\"text-secondary-color\"]}\n />\n </Pressable>\n );\n };\n\n const renderDay = (date: Date) => {\n const key = dayKey(date);\n const off = disabled || isDisabled(date);\n const isToday = key === todayKey;\n const start = rangeKeys?.[0] === key;\n const end = rangeKeys?.[1] === key && pendingStart === null;\n const middle = !!rangeKeys && key > rangeKeys[0] && key < rangeKeys[1];\n const filled = rangeKeys ? start || end : selected.includes(key);\n const isSelected = filled || middle;\n const singleDayRange = rangeKeys?.[0] === rangeKeys?.[1];\n const suffixes = [\n isToday ? translate(\"monthCalendar.today\") : undefined,\n start ? translate(\"calendar.rangeStart\") : undefined,\n end ? translate(\"calendar.rangeEnd\") : undefined,\n ].filter(Boolean);\n const label = [fullDate(date), ...suffixes].join(\", \");\n const textColor = off\n ? t.colors[\"text-disabled-color\"]\n : filled\n ? t.colors[\"text-inverse-color\"]\n : middle\n ? t.colors[\"primary-color-text\"]\n : isToday\n ? primary\n : t.colors[\"text-color\"];\n const band = t.colors[\"primary-color-subtle\"];\n\n return (\n <Pressable\n key={key}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n accessibilityState={{ selected: isSelected, disabled: off }}\n aria-selected={isSelected}\n disabled={off}\n onPress={() => press(date)}\n style={{\n flex: 1,\n height: cellHeight,\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: middle ? band : \"transparent\",\n }}\n {...part(\"calendar\", \"day\", {\n selected: isSelected,\n today: isToday,\n disabled: off,\n \"range-start\": start && !!rangeKeys,\n \"range-end\": end,\n \"range-middle\": middle,\n })}\n >\n {rangeKeys && !singleDayRange && (start || end) && (\n <View\n style={{\n position: \"absolute\",\n top: 0,\n bottom: 0,\n left: start ? \"50%\" : 0,\n right: end ? \"50%\" : 0,\n backgroundColor: band,\n }}\n />\n )}\n <View\n style={{\n width: dot,\n height: dot,\n borderRadius: dot / 2,\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: filled && !off ? primary : \"transparent\",\n borderWidth: isToday && !filled ? 1 : 0,\n borderColor: primary,\n }}\n >\n <Text\n allowFontScaling={false}\n style={[\n textStyle(t, size === \"small\" ? \"sm\" : \"md\", sans),\n {\n color: textColor,\n fontWeight: weight(\n t,\n filled || isToday ? \"semibold\" : \"regular\",\n ),\n },\n ]}\n >\n {date.getDate()}\n </Text>\n {(start || end) && !singleDayRange && size !== \"small\" && (\n <Text\n allowFontScaling={false}\n style={{\n position: \"absolute\",\n bottom: -t.space[\"0-5\"],\n fontSize: t.fontSize.xs - 3,\n color: t.colors[\"text-inverse-color\"],\n ...(sans ? { fontFamily: sans } : null),\n }}\n >\n {translate(start ? \"calendar.rangeStart\" : \"calendar.rangeEnd\")}\n </Text>\n )}\n </View>\n </Pressable>\n );\n };\n\n return (\n <View\n role=\"group\"\n accessibilityLabel={\n accessibilityLabel ?? translate(\"monthCalendar.label\")\n }\n {...part(\"calendar\", \"root\", { type, disabled })}\n {...rest}\n style={[{ backgroundColor: t.colors[\"surface-color\"] }, style]}\n >\n <View\n style={{\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n paddingHorizontal: t.space[\"2\"],\n paddingVertical: t.space[\"2\"],\n }}\n >\n {navButton(-1)}\n <Text\n accessibilityRole=\"header\"\n accessibilityLiveRegion=\"polite\"\n style={[\n textStyle(t, \"lg\", sans),\n { fontWeight: weight(t, \"semibold\") },\n ]}\n {...part(\"calendar\", \"month-title\")}\n >\n {translate(\"calendar.monthTitle\", {\n year: first.getFullYear(),\n month: first.getMonth() + 1,\n })}\n </Text>\n {navButton(1)}\n </View>\n <View\n importantForAccessibility=\"no-hide-descendants\"\n accessibilityElementsHidden\n style={{ flexDirection: \"row\", paddingVertical: t.space[\"1\"] }}\n {...part(\"calendar\", \"weekdays\")}\n >\n {Array.from({ length: 7 }, (_, i) => {\n const name = WEEKDAYS[(firstDayOfWeek + i) % 7];\n return (\n <Text\n key={name}\n style={[\n textStyle(t, \"xs\", sans),\n {\n flex: 1,\n textAlign: \"center\",\n color: t.colors[\"text-muted-color\"],\n },\n ]}\n >\n {translate(`monthCalendar.weekdays.${name}`)}\n </Text>\n );\n })}\n </View>\n {weeks.map((week, row) => (\n <View\n key={row}\n style={{ flexDirection: \"row\", marginBottom: t.space[\"0-5\"] }}\n {...part(\"calendar\", \"week\")}\n >\n {week.map((date, col) =>\n date ? (\n renderDay(date)\n ) : (\n <View\n key={`empty-${col}`}\n style={{ flex: 1, height: cellHeight }}\n />\n ),\n )}\n </View>\n ))}\n </View>\n );\n}\n"],"mappings":"+gBAsHA,IAAMoC,EAAW,CAAC,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,KAAK,EAC3DC,EAAc,CAClB,MAAO,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G,CAAA,EACL1B,EAAM,KAAK,EAAM,KAChB,EAAAhF,EAAA,IAAA,CAAC3B,EAAAA,KAAD,CAEE,MAAO,CAAE,cAAe,MAAO,aAAc6C,EAAE,MAAM,MAAO,EAC5D,GAAI5C,EAAAA,KAAK,WAAY,MAAM,EAE1B,SAAAqI,EAAK,KAAK,EAAM,IACf3D,EACE4C,GAAU5C,CAAI,GAEd,EAAAhD,EAAA,IAAA,CAAC3B,EAAAA,KAAD,CAEE,MAAO,CAAE,KAAM,EAAG,OAAQ4G,CAAW,CACtC,EAFM,SAAS2B,GAEf,CAEL,CACI,EAdCC,CAcD,CACP,CACG,GAEV"}
|
|
1
|
+
{"version":3,"file":"Calendar.cjs","names":["localDate","dayKey","useMemo","useTheme","useI18n","useOverlay","useControllable","Overlay","View","part","Text","textStyle","weight","Pressable","hitSlopFor","Icon","Button","useState","useMachine","createSelectionMachine","monthStart","sameMonth","addDays","require_MinervaProvider","require_parts","require_styles","require_Button","require_Icon","require_Overlay","require_useMachine","require_useOverlay","require_useControllable","react","react_native","_minerva_core","react_jsx_runtime","WEEKDAYS","CELL_HEIGHT","parseKey","y","m","d","key","keysOf","value","useStableKeys","joined","keys","Calendar","props","PoppableCalendar","CalendarView","rest","t","translate","overlay","current","setCurrent","defaultValue","onChange","ready","titleNode","title","titleText","fonts","pressed","onConfirm","confirmText","_poppable","_open","_defaultOpen","_onOpenChange","_title","_confirmText","_onConfirm","today","now","todayKey","minKey","minDate","maxKey","maxDate","isDisabled","date","disabledDate","toValue","dates","type","controlledKeys","state","send","pendingStart","setPendingStart","selected","rangeKeys","firstSelected","shownMonth","setShownMonth","month","defaultMonth","onMonthChange","first","canPrev","disabled","canNext","press","onSelect","fullDate","format","locale","language","lead","firstDayOfWeek","daysInMonth","cells","i","weeks","cellHeight","size","dot","primary","sans","navButton","enabled","direction","label","previousMonthLabel","nextMonthLabel","renderDay","off","isToday","start","end","middle","filled","isSelected","singleDayRange","suffixes","textColor","band","accessibilityLabel","style","name","week","col","row"],"sources":["../../../../../native/src/components/Calendar/Calendar.tsx"],"sourcesContent":["import { useMemo, useState, type ReactNode } from \"react\";\nimport {\n Pressable,\n Text,\n View,\n type StyleProp,\n type ViewProps,\n type ViewStyle,\n} from \"react-native\";\nimport {\n addDays,\n createSelectionMachine,\n dayKey,\n localDate,\n monthStart,\n sameMonth,\n} from \"@minerva/core\";\nimport { useI18n, useTheme } from \"../../theme/MinervaProvider\";\nimport { Icon } from \"../../internal/Icon\";\nimport { Overlay, type OverlayCloseReason } from \"../../internal/Overlay\";\nimport { part } from \"../../internal/parts\";\nimport { hitSlopFor, textStyle, weight } from \"../../internal/styles\";\nimport { useControllable } from \"../../internal/useControllable\";\nimport { useMachine } from \"../../internal/useMachine\";\nimport { useOverlay } from \"../../internal/useOverlay\";\nimport { Button } from \"../Button\";\n\n/** Selection type of `Calendar` */\nexport type CalendarType = \"single\" | \"multiple\" | \"range\";\n\n/**\n * Value of `Calendar`: a day (`single`, `null`: none), days (`multiple`) or\n * a `[start, end]` range (`range`); every date is local midnight\n */\nexport type CalendarValue = Date | Date[] | [Date, Date] | null;\n\n/** Why a poppable calendar closed */\nexport type CalendarCloseReason = OverlayCloseReason;\n\nexport interface CalendarProps extends Omit<ViewProps, \"style\" | \"children\"> {\n /**\n * Selection type: one day, several days, or a range\n * @default \"single\"\n */\n type?: CalendarType;\n /**\n * Selected day(s) (controlled; pair with `onChange`): a `Date` (`single`),\n * `Date[]` (`multiple`) or `[start, end]` (`range`)\n */\n value?: CalendarValue;\n /** Initially selected day(s) (uncontrolled) @default null */\n defaultValue?: CalendarValue;\n /**\n * Called with the new selection (a range once both ends are picked)\n */\n onChange?: (value: CalendarValue) => void;\n /** Called with every pressed day */\n onSelect?: (date: Date) => void;\n /** Displayed month (controlled; any day of the month; pair with `onMonthChange`) */\n month?: Date;\n /**\n * Initially displayed month (uncontrolled)\n * @default the month of the first selected day, else of today\n */\n defaultMonth?: Date;\n /** Called with the first day of the month navigated to */\n onMonthChange?: (month: Date) => void;\n /** Earliest selectable day (earlier days are disabled) */\n minDate?: Date;\n /** Latest selectable day (later days are disabled) */\n maxDate?: Date;\n /** Locale of calendar month and accessible date names. */\n locale?: string;\n /** Extra disabled days */\n disabledDate?: (date: Date) => boolean;\n /**\n * First column of the week (0: Sunday ... 6: Saturday)\n * @default 0\n */\n firstDayOfWeek?: number;\n /**\n * Cell density: compact (\"small\"), default (\"medium\") or comfortable\n * (\"large\")\n * @default \"medium\"\n */\n size?: \"small\" | \"medium\" | \"large\";\n /**\n * Blocks navigation and selection\n * @default false\n */\n disabled?: boolean;\n /** Label of the previous-month button @default the \"monthCalendar.previousMonth\" message */\n previousMonthLabel?: string;\n /** Label of the next-month button @default the \"monthCalendar.nextMonth\" message */\n nextMonthLabel?: string;\n /**\n * Renders the calendar in a bottom sheet with a title and a confirm\n * button (`open` / `defaultOpen` / `onOpenChange`)\n * @default false\n */\n poppable?: boolean;\n /** Controlled open state of the poppable sheet */\n open?: boolean;\n /**\n * Initial open state of the poppable sheet while uncontrolled\n * @default false\n */\n defaultOpen?: boolean;\n /** Called with the requested open state of the sheet and the close reason */\n onOpenChange?: (open: boolean, reason?: CalendarCloseReason) => void;\n /** Title of the poppable sheet @default the \"calendar.title\" message */\n title?: ReactNode;\n /** Text of the confirm button @default the \"calendar.confirm\" message */\n confirmText?: ReactNode;\n /** Called by the confirm button of the poppable sheet with the selection */\n onConfirm?: (value: CalendarValue) => void;\n /** Style of the calendar */\n style?: StyleProp<ViewStyle>;\n}\n\nconst WEEKDAYS = [\"sun\", \"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\"] as const;\nconst CELL_HEIGHT = {\n small: \"control-height-sm\",\n medium: \"control-height-md\",\n large: \"control-height-lg\",\n} as const;\n\nconst parseKey = (key: string) => {\n const [y, m, d] = key.split(\"-\").map(Number);\n return localDate(y, m - 1, d);\n};\n\n/** The selected day keys of a value */\nconst keysOf = (value: CalendarValue | undefined): string[] | undefined => {\n if (value === undefined) return undefined;\n if (value === null) return [];\n return (Array.isArray(value) ? value : [value]).map(dayKey);\n};\n\n/** The same array while its items are unchanged (controlled values) */\nfunction useStableKeys(keys: readonly string[] | undefined) {\n const joined = keys?.join(\"\\u0000\");\n return useMemo(\n () =>\n joined === undefined\n ? undefined\n : joined === \"\"\n ? []\n : joined.split(\"\\u0000\"),\n [joined],\n );\n}\n\n/**\n * A month calendar for picking a day, several days or a range: weekday\n * header, month navigation, min / max dates, today ring, selected fills\n * and range tint. Inline, or in a bottom sheet with a confirm button\n * (`poppable`). Single and multiple selections run on the selection\n * machine of @minerva/core.\n */\nexport function Calendar(props: CalendarProps) {\n if (!props.poppable) return <CalendarView {...props} />;\n return <PoppableCalendar {...props} />;\n}\n\nfunction PoppableCalendar({\n open,\n defaultOpen = false,\n onOpenChange,\n title,\n confirmText,\n onConfirm,\n onChange,\n value,\n defaultValue = null,\n type = \"single\",\n ...rest\n}: CalendarProps) {\n const { tokens: t, fonts } = useTheme();\n const { t: translate } = useI18n();\n const overlay = useOverlay({ open, defaultOpen, onOpenChange });\n // the sheet keeps the selection to confirm\n const [current, setCurrent] = useControllable<CalendarValue>(\n value,\n defaultValue,\n onChange,\n );\n if (overlay.state.phase === \"closed\") return null;\n const ready = Array.isArray(current) ? current.length > 0 : current !== null;\n const titleNode = title ?? translate(\"calendar.title\");\n const titleText =\n typeof titleNode === \"string\" || typeof titleNode === \"number\"\n ? String(titleNode)\n : undefined;\n const closeSize = 28;\n\n return (\n <Overlay\n component=\"calendar\"\n phase={overlay.state.phase}\n onAnimationEnd={overlay.onAnimationEnd}\n onRequestClose={overlay.close}\n placement=\"bottom\"\n panelProps={{ role: \"dialog\", accessibilityLabel: titleText }}\n >\n <View\n style={{\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"center\",\n paddingVertical: t.space[\"4\"],\n paddingHorizontal: t.space[\"12\"],\n }}\n {...part(\"calendar\", \"header\")}\n >\n {titleText !== undefined ? (\n <Text\n accessibilityRole=\"header\"\n style={[\n textStyle(t, \"lg\", fonts.sans),\n { fontWeight: weight(t, \"semibold\") },\n ]}\n {...part(\"calendar\", \"title\")}\n >\n {titleText}\n </Text>\n ) : (\n titleNode\n )}\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={translate(\"modal.close\")}\n hitSlop={hitSlopFor(t, closeSize, closeSize)}\n onPress={() => overlay.close(\"close-button\")}\n style={({ pressed }) => ({\n position: \"absolute\",\n right: t.space[\"4\"],\n width: closeSize,\n height: closeSize,\n borderRadius: closeSize / 2,\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: pressed\n ? t.colors[\"surface-muted-color\"]\n : \"transparent\",\n })}\n {...part(\"calendar\", \"close\")}\n >\n <Icon name=\"close\" size={14} color={t.colors[\"text-muted-color\"]} />\n </Pressable>\n </View>\n <CalendarView\n {...rest}\n type={type}\n value={current}\n onChange={setCurrent}\n style={[{ paddingHorizontal: t.space[\"2\"] }, rest.style]}\n />\n <View\n style={{ padding: t.space[\"4\"], paddingTop: t.space[\"2\"] }}\n {...part(\"calendar\", \"footer\")}\n >\n <Button\n fullWidth\n disabled={!ready}\n onPress={() => {\n onConfirm?.(current);\n overlay.close(\"confirm\");\n }}\n >\n {confirmText ?? translate(\"calendar.confirm\")}\n </Button>\n </View>\n </Overlay>\n );\n}\n\nfunction CalendarView({\n type = \"single\",\n value,\n defaultValue = null,\n onChange,\n onSelect,\n month,\n defaultMonth,\n onMonthChange,\n minDate,\n maxDate,\n disabledDate,\n firstDayOfWeek = 0,\n locale,\n size = \"medium\",\n disabled = false,\n previousMonthLabel,\n nextMonthLabel,\n style,\n accessibilityLabel,\n // poppable-only props, unused inline\n poppable: _poppable,\n open: _open,\n defaultOpen: _defaultOpen,\n onOpenChange: _onOpenChange,\n title: _title,\n confirmText: _confirmText,\n onConfirm: _onConfirm,\n ...rest\n}: CalendarProps) {\n const { tokens: t, fonts } = useTheme();\n const { t: translate, language } = useI18n();\n const [today] = useState(() => {\n const now = new Date();\n return localDate(now.getFullYear(), now.getMonth(), now.getDate());\n });\n const todayKey = dayKey(today);\n const minKey = minDate ? dayKey(minDate) : undefined;\n const maxKey = maxDate ? dayKey(maxDate) : undefined;\n const isDisabled = (date: Date) => {\n const key = dayKey(date);\n return (\n (minKey !== undefined && key < minKey) ||\n (maxKey !== undefined && key > maxKey) ||\n !!disabledDate?.(date)\n );\n };\n\n const toValue = (keys: readonly string[]): CalendarValue => {\n const dates = keys.map(parseKey);\n if (type === \"single\") return dates[0] ?? null;\n if (type === \"range\") {\n return dates.length === 2 ? [dates[0], dates[1]] : null;\n }\n return dates;\n };\n const controlledKeys = useStableKeys(keysOf(value));\n const [state, send] = useMachine(createSelectionMachine<string>, {\n mode: type === \"single\" ? (\"single\" as const) : (\"multiple\" as const),\n value: controlledKeys,\n defaultValue: keysOf(defaultValue) ?? [],\n isDisabled: (key: string) => isDisabled(parseKey(key)),\n max: type === \"range\" ? 2 : undefined,\n onValueChange: (keys: string[]) => onChange?.(toValue(keys)),\n });\n // range: the first end picked, waiting for the second\n const [pendingStart, setPendingStart] = useState<string | null>(null);\n\n const selected = state.value;\n const rangeKeys: [string, string] | null =\n type === \"range\"\n ? pendingStart !== null\n ? [pendingStart, pendingStart]\n : selected.length === 2\n ? [selected[0], selected[1]]\n : null\n : null;\n\n const firstSelected = selected[0] ? parseKey(selected[0]) : undefined;\n const [shownMonth, setShownMonth] = useControllable<Date>(\n month,\n defaultMonth ??\n firstSelected ??\n (minDate && minDate > today ? minDate : today),\n onMonthChange,\n );\n const first = monthStart(shownMonth);\n const canPrev = !disabled && (!minDate || first > monthStart(minDate));\n const canNext = !disabled && (!maxDate || monthStart(first, 1) <= maxDate);\n\n const press = (date: Date) => {\n const key = dayKey(date);\n onSelect?.(date);\n if (type === \"single\") {\n send({ type: \"SELECT\", value: key });\n } else if (type === \"multiple\") {\n send({ type: \"TOGGLE\", value: key });\n } else if (pendingStart === null || key < pendingStart) {\n setPendingStart(key);\n } else {\n setPendingStart(null);\n send({ type: \"SET\", value: [pendingStart, key] });\n }\n if (!sameMonth(date, first)) setShownMonth(monthStart(date));\n };\n\n const fullDate = useMemo(() => {\n try {\n const format = new Intl.DateTimeFormat(locale ?? language, {\n weekday: \"long\",\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n });\n return (date: Date) => format.format(date);\n } catch {\n return (date: Date) => date.toDateString();\n }\n }, [language, locale]);\n\n const lead = (first.getDay() - firstDayOfWeek + 7) % 7;\n const daysInMonth = localDate(\n first.getFullYear(),\n first.getMonth() + 1,\n 0,\n ).getDate();\n const cells: (Date | null)[] = [\n ...Array.from({ length: lead }, () => null),\n ...Array.from({ length: daysInMonth }, (_, i) => addDays(first, i)),\n ];\n while (cells.length % 7) cells.push(null);\n const weeks: (Date | null)[][] = [];\n for (let i = 0; i < cells.length; i += 7) weeks.push(cells.slice(i, i + 7));\n\n const cellHeight = t.sizes[CELL_HEIGHT[size]];\n const dot = Math.min(cellHeight - t.space[\"1\"], 44);\n const primary = t.colors[\"primary-color\"];\n const sans = fonts.sans;\n const navSize = 32;\n\n const navButton = (direction: -1 | 1) => {\n const enabled = direction < 0 ? canPrev : canNext;\n const label =\n direction < 0\n ? (previousMonthLabel ?? translate(\"monthCalendar.previousMonth\"))\n : (nextMonthLabel ?? translate(\"monthCalendar.nextMonth\"));\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n accessibilityState={{ disabled: !enabled }}\n disabled={!enabled}\n hitSlop={hitSlopFor(t, navSize, navSize)}\n onPress={() => setShownMonth(monthStart(first, direction))}\n style={({ pressed }) => ({\n width: navSize,\n height: navSize,\n borderRadius: navSize / 2,\n alignItems: \"center\",\n justifyContent: \"center\",\n opacity: enabled ? 1 : 0.35,\n backgroundColor: pressed\n ? t.colors[\"surface-muted-color\"]\n : \"transparent\",\n })}\n {...part(\"calendar\", direction < 0 ? \"prev\" : \"next\")}\n >\n <Icon\n name={direction < 0 ? \"chevron-left\" : \"chevron-right\"}\n size={16}\n color={t.colors[\"text-secondary-color\"]}\n />\n </Pressable>\n );\n };\n\n const renderDay = (date: Date) => {\n const key = dayKey(date);\n const off = disabled || isDisabled(date);\n const isToday = key === todayKey;\n const start = rangeKeys?.[0] === key;\n const end = rangeKeys?.[1] === key && pendingStart === null;\n const middle = !!rangeKeys && key > rangeKeys[0] && key < rangeKeys[1];\n const filled = rangeKeys ? start || end : selected.includes(key);\n const isSelected = filled || middle;\n const singleDayRange = rangeKeys?.[0] === rangeKeys?.[1];\n const suffixes = [\n isToday ? translate(\"monthCalendar.today\") : undefined,\n start ? translate(\"calendar.rangeStart\") : undefined,\n end ? translate(\"calendar.rangeEnd\") : undefined,\n ].filter(Boolean);\n const label = [fullDate(date), ...suffixes].join(\", \");\n const textColor = off\n ? t.colors[\"text-disabled-color\"]\n : filled\n ? t.colors[\"text-inverse-color\"]\n : middle\n ? t.colors[\"primary-color-text\"]\n : isToday\n ? primary\n : t.colors[\"text-color\"];\n const band = t.colors[\"primary-color-subtle\"];\n\n return (\n <Pressable\n key={key}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n accessibilityState={{ selected: isSelected, disabled: off }}\n aria-selected={isSelected}\n disabled={off}\n onPress={() => press(date)}\n style={{\n flex: 1,\n height: cellHeight,\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: middle ? band : \"transparent\",\n }}\n {...part(\"calendar\", \"day\", {\n selected: isSelected,\n today: isToday,\n disabled: off,\n \"range-start\": start && !!rangeKeys,\n \"range-end\": end,\n \"range-middle\": middle,\n })}\n >\n {rangeKeys && !singleDayRange && (start || end) && (\n <View\n style={{\n position: \"absolute\",\n top: 0,\n bottom: 0,\n left: start ? \"50%\" : 0,\n right: end ? \"50%\" : 0,\n backgroundColor: band,\n }}\n />\n )}\n <View\n style={{\n width: dot,\n height: dot,\n borderRadius: dot / 2,\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: filled && !off ? primary : \"transparent\",\n borderWidth: isToday && !filled ? 1 : 0,\n borderColor: primary,\n }}\n >\n <Text\n allowFontScaling={false}\n style={[\n textStyle(t, size === \"small\" ? \"sm\" : \"md\", sans),\n {\n color: textColor,\n fontWeight: weight(\n t,\n filled || isToday ? \"semibold\" : \"regular\",\n ),\n },\n ]}\n >\n {date.getDate()}\n </Text>\n {(start || end) && !singleDayRange && size !== \"small\" && (\n <Text\n allowFontScaling={false}\n style={{\n position: \"absolute\",\n bottom: -t.space[\"0-5\"],\n fontSize: t.fontSize.xs - 3,\n color: t.colors[\"text-inverse-color\"],\n ...(sans ? { fontFamily: sans } : null),\n }}\n >\n {translate(start ? \"calendar.rangeStart\" : \"calendar.rangeEnd\")}\n </Text>\n )}\n </View>\n </Pressable>\n );\n };\n\n return (\n <View\n role=\"group\"\n accessibilityLabel={\n accessibilityLabel ?? translate(\"monthCalendar.label\")\n }\n {...part(\"calendar\", \"root\", { type, disabled })}\n {...rest}\n style={[{ backgroundColor: t.colors[\"surface-color\"] }, style]}\n >\n <View\n style={{\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n paddingHorizontal: t.space[\"2\"],\n paddingVertical: t.space[\"2\"],\n }}\n >\n {navButton(-1)}\n <Text\n accessibilityRole=\"header\"\n accessibilityLiveRegion=\"polite\"\n style={[\n textStyle(t, \"lg\", sans),\n { fontWeight: weight(t, \"semibold\") },\n ]}\n {...part(\"calendar\", \"month-title\")}\n >\n {locale\n ? new Intl.DateTimeFormat(locale, {\n year: \"numeric\",\n month: \"long\",\n }).format(first)\n : translate(\"calendar.monthTitle\", {\n year: first.getFullYear(),\n month: first.getMonth() + 1,\n })}\n </Text>\n {navButton(1)}\n </View>\n <View\n importantForAccessibility=\"no-hide-descendants\"\n accessibilityElementsHidden\n style={{ flexDirection: \"row\", paddingVertical: t.space[\"1\"] }}\n {...part(\"calendar\", \"weekdays\")}\n >\n {Array.from({ length: 7 }, (_, i) => {\n const name = WEEKDAYS[(firstDayOfWeek + i) % 7];\n return (\n <Text\n key={name}\n style={[\n textStyle(t, \"xs\", sans),\n {\n flex: 1,\n textAlign: \"center\",\n color: t.colors[\"text-muted-color\"],\n },\n ]}\n >\n {translate(`monthCalendar.weekdays.${name}`)}\n </Text>\n );\n })}\n </View>\n {weeks.map((week, row) => (\n <View\n key={row}\n style={{ flexDirection: \"row\", marginBottom: t.space[\"0-5\"] }}\n {...part(\"calendar\", \"week\")}\n >\n {week.map((date, col) =>\n date ? (\n renderDay(date)\n ) : (\n <View\n key={`empty-${col}`}\n style={{ flex: 1, height: cellHeight }}\n />\n ),\n )}\n </View>\n ))}\n </View>\n );\n}\n"],"mappings":"+gBAwHA,IAAMoC,EAAW,CAAC,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,KAAK,EAC3DC,EAAc,CAClB,MAAO,oBACP,OAAQ,oBACR,MAAO,mBACT,EAEMC,EAAY,GAAgB,CAChC,GAAM,CAACC,EAAGC,EAAGC,GAAKC,EAAI,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM,EAC3C,OAAA,EAAO1C,EAAAA,UAAAA,CAAUuC,EAAGC,EAAI,EAAGC,CAAC,CAC9B,EAGME,EAAU,GAA2D,CACzE,GAAIC,IAAU,IAAA,GAEd,OADIA,IAAU,KAAa,CAAC,GACpB,MAAM,QAAQA,CAAK,EAAIA,EAAQ,CAACA,CAAK,EAAA,CAAG,IAAI3C,EAAAA,MAAM,CAC5D,EAGA,SAAS4C,EAAc,EAAqC,CAC1D,IAAMC,EAASC,GAAM,KAAK,IAAQ,EAClC,OAAA,EAAO7C,EAAAA,QAAAA,KAEH4C,IAAW,IAAA,GACP,IAAA,GACAA,IAAW,GACT,CAAC,EACDA,EAAO,MAAM,IAAQ,EAC7B,CAACA,CAAM,CACT,CACF,CASA,SAAgBE,EAAS,EAAsB,CAE7C,OADKC,EAAM,UACJ,EAAAd,EAAA,IAAA,CAACe,EAAD,CAAkB,GAAID,CAAQ,CAAA,GADT,EAAAd,EAAA,IAAA,CAACgB,EAAD,CAAc,GAAIF,CAAQ,CAAA,CAExD,CAEA,SAASC,EAA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C,CACD,CAAA,EACLqB,EAAU,CAAC,CACR,KACN,EAAAvF,EAAA,IAAA,CAAC3B,EAAAA,KAAD,CACE,0BAA0B,sBAC1B,4BAAA,GACA,MAAO,CAAE,cAAe,MAAO,gBAAiB6C,EAAE,MAAM,EAAK,EAC7D,GAAI5C,EAAAA,KAAK,WAAY,UAAU,EAE9B,SAAA,MAAM,KAAK,CAAE,OAAQ,CAAE,GAAI,EAAG,IAAM,CACnC,IAAMqI,EAAO1G,GAAU4E,EAAiBG,GAAK,GAC7C,OACE,EAAAhF,EAAA,IAAA,CAACzB,EAAAA,KAAD,CAEE,MAAO,CACLC,EAAAA,UAAU0C,EAAG,KAAMoE,CAAI,EACvB,CACE,KAAM,EACN,UAAW,SACX,MAAOpE,EAAE,OAAO,mBAClB,CACF,EAEC,SAAAC,EAAU,0BAA0BwF,GAAM,CACvC,EAXCA,CAWD,CAEV,CAAC,CACG,CAAA,EACL1B,EAAM,KAAK,EAAM,KAChB,EAAAjF,EAAA,IAAA,CAAC3B,EAAAA,KAAD,CAEE,MAAO,CAAE,cAAe,MAAO,aAAc6C,EAAE,MAAM,MAAO,EAC5D,GAAI5C,EAAAA,KAAK,WAAY,MAAM,EAE1B,SAAAsI,EAAK,KAAK,EAAM,IACf5D,EACE6C,GAAU7C,CAAI,GAEd,EAAAhD,EAAA,IAAA,CAAC3B,EAAAA,KAAD,CAEE,MAAO,CAAE,KAAM,EAAG,OAAQ6G,CAAW,CACtC,EAFM,SAAS2B,GAEf,CAEL,CACI,EAdCC,CAcD,CACP,CACG,GAEV"}
|
|
@@ -42,6 +42,8 @@ export interface CalendarProps extends Omit<ViewProps, "style" | "children"> {
|
|
|
42
42
|
minDate?: Date;
|
|
43
43
|
/** Latest selectable day (later days are disabled) */
|
|
44
44
|
maxDate?: Date;
|
|
45
|
+
/** Locale of calendar month and accessible date names. */
|
|
46
|
+
locale?: string;
|
|
45
47
|
/** Extra disabled days */
|
|
46
48
|
disabledDate?: (date: Date) => boolean;
|
|
47
49
|
/**
|
|
@@ -42,6 +42,8 @@ export interface CalendarProps extends Omit<ViewProps, "style" | "children"> {
|
|
|
42
42
|
minDate?: Date;
|
|
43
43
|
/** Latest selectable day (later days are disabled) */
|
|
44
44
|
maxDate?: Date;
|
|
45
|
+
/** Locale of calendar month and accessible date names. */
|
|
46
|
+
locale?: string;
|
|
45
47
|
/** Extra disabled days */
|
|
46
48
|
disabledDate?: (date: Date) => boolean;
|
|
47
49
|
/**
|