material-plus-ui 1.5.0 → 1.6.0
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/dist/components/accordion/MPAccordion.js +1 -1
- package/dist/components/alert/MPAlert.js +1 -1
- package/dist/components/animate-lighting/MPAnimateLighting.js +1 -1
- package/dist/components/aspect-ratio/MPAspectRatio.js +1 -1
- package/dist/components/avatar/MPAvatar.js +1 -1
- package/dist/components/avatar-group/MPAvatarGroup.js +1 -1
- package/dist/components/badge/MPBadge.js +1 -1
- package/dist/components/blockquote/MPBlockquote.js +1 -1
- package/dist/components/bottom-navigation/MPBottomNavigation.d.ts +17 -0
- package/dist/components/bottom-navigation/MPBottomNavigation.js +1 -1
- package/dist/components/breadcrumb/MPBreadcrumb.js +1 -1
- package/dist/components/button/MPButton.d.ts +49 -3
- package/dist/components/button/MPButton.js +1 -1
- package/dist/components/calendar/MPCalendar.d.ts +160 -0
- package/dist/components/calendar/MPCalendar.js +2 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/card/MPCard.js +1 -1
- package/dist/components/carousel/MPCarousel.js +1 -1
- package/dist/components/chat-bubble/MPChatBubble.js +1 -1
- package/dist/components/checkbox/MPCheckbox.js +1 -1
- package/dist/components/chip/MPChip.d.ts +21 -6
- package/dist/components/chip/MPChip.js +1 -1
- package/dist/components/collapsible/MPCollapsible.js +1 -1
- package/dist/components/color-picker/MPColorPicker.js +1 -1
- package/dist/components/combobox/MPCombobox.d.ts +52 -3
- package/dist/components/combobox/MPCombobox.js +1 -1
- package/dist/components/command-palette/MPCommandPalette.d.ts +1 -1
- package/dist/components/command-palette/MPCommandPalette.js +1 -1
- package/dist/components/config/MPConfigProvider.d.ts +124 -0
- package/dist/components/config/MPConfigProvider.js +2 -0
- package/dist/components/config/index.d.ts +2 -0
- package/dist/components/config/index.js +1 -0
- package/dist/components/confirm/MPConfirmProvider.d.ts +143 -0
- package/dist/components/confirm/MPConfirmProvider.js +2 -0
- package/dist/components/confirm/index.d.ts +2 -0
- package/dist/components/confirm/index.js +1 -0
- package/dist/components/container/MPContainer.js +1 -1
- package/dist/components/date-picker/MPDatePicker.d.ts +53 -2
- package/dist/components/date-picker/MPDatePicker.js +1 -1
- package/dist/components/date-picker/index.d.ts +1 -1
- package/dist/components/date-range-picker/MPDateRangePicker.js +1 -1
- package/dist/components/date-time-picker/MPDateTimePicker.js +1 -1
- package/dist/components/dialog/MPDialog.d.ts +16 -3
- package/dist/components/dialog/MPDialog.js +1 -1
- package/dist/components/divider/MPDivider.js +1 -1
- package/dist/components/drawer/MPDrawer.d.ts +1 -1
- package/dist/components/drawer/MPDrawer.js +1 -1
- package/dist/components/empty/MPEmpty.js +1 -1
- package/dist/components/file-picker/MPFilePicker.js +1 -1
- package/dist/components/floating-action-button/MPFloatingActionButton.js +1 -1
- package/dist/components/footer/MPFooter.js +1 -1
- package/dist/components/grid/MPGrid.d.ts +23 -1
- package/dist/components/grid/MPGrid.js +1 -1
- package/dist/components/header/MPHeader.js +1 -1
- package/dist/components/image/MPImage.d.ts +112 -0
- package/dist/components/image/MPImage.js +2 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/image/index.js +1 -0
- package/dist/components/list/MPList.d.ts +28 -0
- package/dist/components/list/MPList.js +1 -1
- package/dist/components/menu/MPMenu.d.ts +21 -2
- package/dist/components/menu/MPMenu.js +1 -1
- package/dist/components/menubar/MPMenubar.js +1 -1
- package/dist/components/navigation-menu/MPNavigationMenu.js +1 -1
- package/dist/components/number-field/MPNumberField.d.ts +3 -3
- package/dist/components/number-field/MPNumberField.js +1 -1
- package/dist/components/otp-field/MPOtpField.js +1 -1
- package/dist/components/overlay/MPOverlay.d.ts +1 -1
- package/dist/components/overlay/MPOverlay.js +1 -1
- package/dist/components/pagination/MPPagination.js +1 -1
- package/dist/components/panes/MPPanes.js +1 -1
- package/dist/components/pill/MPPill.js +1 -1
- package/dist/components/popconfirm/MPPopconfirm.d.ts +92 -0
- package/dist/components/popconfirm/MPPopconfirm.js +2 -0
- package/dist/components/popconfirm/index.d.ts +2 -0
- package/dist/components/popconfirm/index.js +1 -0
- package/dist/components/popover/MPPopover.d.ts +1 -1
- package/dist/components/popover/MPPopover.js +1 -1
- package/dist/components/progress-box/MPProgressBox.js +1 -1
- package/dist/components/progress-circular/MPProgressCircular.js +1 -1
- package/dist/components/progress-linear/MPProgressLinear.js +1 -1
- package/dist/components/radio-group/MPRadioGroup.js +1 -1
- package/dist/components/rating/MPRating.js +1 -1
- package/dist/components/segmented-button/MPSegmentedButton.js +1 -1
- package/dist/components/select/MPSelect.d.ts +2 -2
- package/dist/components/select/MPSelect.js +1 -1
- package/dist/components/shortcut/MPShortcut.js +1 -1
- package/dist/components/sidebar/MPSidebar.js +1 -1
- package/dist/components/skeleton/MPSkeleton.js +1 -1
- package/dist/components/slider/MPSlider.d.ts +27 -0
- package/dist/components/slider/MPSlider.js +1 -1
- package/dist/components/snackbar/MPSnackbar.d.ts +20 -1
- package/dist/components/snackbar/MPSnackbar.js +1 -1
- package/dist/components/spoiler/MPSpoiler.js +1 -1
- package/dist/components/stepper/MPStepper.d.ts +153 -0
- package/dist/components/stepper/MPStepper.js +2 -0
- package/dist/components/stepper/index.d.ts +2 -0
- package/dist/components/stepper/index.js +1 -0
- package/dist/components/switch/MPSwitch.js +1 -1
- package/dist/components/table/MPTable.d.ts +1 -1
- package/dist/components/table/MPTable.js +1 -1
- package/dist/components/tabs/MPTabs.js +1 -1
- package/dist/components/text-field/MPTextField.d.ts +38 -14
- package/dist/components/text-field/MPTextField.js +1 -1
- package/dist/components/time-picker/MPTimePicker.js +1 -1
- package/dist/components/timeline/MPTimeline.d.ts +10 -2
- package/dist/components/timeline/MPTimeline.js +1 -1
- package/dist/components/toggle/MPToggle.js +1 -1
- package/dist/components/transfer/MPTransfer.js +1 -1
- package/dist/components/typography/MPTypography.d.ts +7 -0
- package/dist/components/typography/MPTypography.js +1 -2
- package/dist/components/visually-hidden/MPVisuallyHidden.d.ts +60 -0
- package/dist/components/visually-hidden/MPVisuallyHidden.js +2 -0
- package/dist/components/visually-hidden/index.d.ts +2 -0
- package/dist/components/visually-hidden/index.js +1 -0
- package/dist/constants/glyphs.d.ts +2 -0
- package/dist/constants/glyphs.js +1 -1
- package/dist/constants/icons.d.ts +1 -0
- package/dist/constants/icons.js +1 -1
- package/dist/hooks/index.d.ts +23 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useMPColorScheme.d.ts +135 -0
- package/dist/hooks/useMPColorScheme.js +1 -0
- package/dist/hooks/useMPReducedMotion.d.ts +32 -0
- package/dist/hooks/useMPReducedMotion.js +1 -0
- package/dist/hooks/useMPShortcut.d.ts +105 -0
- package/dist/hooks/useMPShortcut.js +2 -0
- package/dist/hooks/useMPWindowClass.d.ts +48 -0
- package/dist/hooks/useMPWindowClass.js +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +1 -1
- package/dist/internal/Calendar.d.ts +19 -4
- package/dist/internal/Calendar.js +1 -1
- package/dist/internal/Picker.d.ts +15 -3
- package/dist/internal/Picker.js +1 -1
- package/dist/internal/color-scheme.d.ts +28 -0
- package/dist/internal/color-scheme.js +2 -0
- package/dist/internal/config.d.ts +43 -0
- package/dist/internal/config.js +2 -0
- package/dist/internal/date.d.ts +50 -3
- package/dist/internal/date.js +1 -1
- package/dist/internal/i18n.d.ts +26 -1
- package/dist/internal/messages/confirm.d.ts +3 -0
- package/dist/internal/messages/confirm.js +1 -0
- package/dist/internal/messages/picker.js +1 -1
- package/dist/internal/progress.d.ts +14 -0
- package/dist/internal/step.d.ts +71 -0
- package/dist/internal/step.js +1 -0
- package/dist/internal/window-class.d.ts +21 -0
- package/dist/internal/window-class.js +2 -0
- package/dist/locales/ar.js +1 -1
- package/dist/locales/de.js +1 -1
- package/dist/locales/es.js +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/hi.js +1 -1
- package/dist/locales/id.js +1 -1
- package/dist/locales/it.js +1 -1
- package/dist/locales/ja.js +1 -1
- package/dist/locales/ko.js +1 -1
- package/dist/locales/nl.js +1 -1
- package/dist/locales/pl.js +1 -1
- package/dist/locales/pt.js +1 -1
- package/dist/locales/ru.js +1 -1
- package/dist/locales/th.js +1 -1
- package/dist/locales/tr.js +1 -1
- package/dist/locales/vi.js +1 -1
- package/dist/locales/zh-hans.js +1 -1
- package/dist/locales/zh-hant.js +1 -1
- package/dist/styles/accordion.css +1 -1
- package/dist/styles/animate-lighting.css +1 -1
- package/dist/styles/aspect-ratio.css +1 -1
- package/dist/styles/bottom-navigation.css +1 -1
- package/dist/styles/calendar.css +2 -0
- package/dist/styles/chip.css +1 -1
- package/dist/styles/combobox.css +1 -1
- package/dist/styles/config.css +2 -0
- package/dist/styles/confirm.css +2 -0
- package/dist/styles/grid.css +1 -1
- package/dist/styles/highlight.css +1 -1
- package/dist/styles/image.css +2 -0
- package/dist/styles/list.css +1 -1
- package/dist/styles/panes.css +1 -1
- package/dist/styles/popconfirm.css +2 -0
- package/dist/styles/progress-box.css +1 -1
- package/dist/styles/progress-circular.css +1 -1
- package/dist/styles/progress-linear.css +1 -1
- package/dist/styles/rating.css +1 -1
- package/dist/styles/shortcut.css +1 -1
- package/dist/styles/slider.css +1 -1
- package/dist/styles/snackbar.css +1 -1
- package/dist/styles/stepper.css +2 -0
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/timeline.css +1 -1
- package/dist/styles/tokens.css +1 -1
- package/dist/styles/transfer.css +1 -1
- package/dist/styles/typography.css +1 -1
- package/dist/styles/visually-hidden.css +2 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +91 -5
- package/dist/types.d.ts +64 -0
- package/package.json +6 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{MPButton as r}from"../components/button/MPButton.js";import{MPIcon as l}from"../components/icon/MPIcon.js";import{MPIconButton as a}from"../components/icon-button/MPIconButton.js";import{ChevronDownIcon as s,ChevronLeftIcon as c,ChevronRightIcon as i}from"../constants/icons.js";import{MPStateLayer as u}from"./StateLayer.js";import{CONTROL_ICON as m,META_TEXT as d,PROSE_TEXT as h}from"./scale.js";import{VISUALLY_HIDDEN as f}from"./visually-hidden.js";import{addDays as p,addMonths as g,addYears as v,calendarWeeks as y,compareDay as w,dateFormatter as x,daysInMonth as b,isDayOutside as D,isMonthBeforeYear as S,isSameDay as M,isSameMonth as N,isValidDate as P,makeDate as _,meridiemLabels as C,monthLabels as k,startOfDay as j,startOfMonth as z,today as F,weekdayLabels as A,withTime as E,YEAR_PAGE_SIZE as T,yearPageStart as Y}from"./date.js";const B={xs:"1.75rem",sm:"2rem",md:"2.5rem",lg:"2.75rem",xl:"3rem"},R={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"},H=/*@__PURE__*/["group relative flex cursor-pointer items-center justify-center overflow-hidden","box-border appearance-none bg-transparent font-[inherit] tabular-nums select-none","transition-[background-color,border-color,color]","duration-(--mp-sys-motion-duration-short4)","outline-mp-secondary focus-visible:z-10 focus-visible:outline-2","focus-visible:outline-offset-[-2px] focus-visible:outline-solid outline-none"].join(" ");function $({children:n,label:o,selected:r,inRange:l=!1,rangeEdge:a=null,current:s=!1,muted:c=!1,disabled:i=!1,focused:m=!1,className:d,onClick:h,onPointerEnter:f,onKeyDown:p}){return t("button",{type:"button",role:"gridcell","aria-label":o,"aria-selected":r,"aria-current":s?"date":void 0,"aria-disabled":i||void 0,tabIndex:m?0:-1,"data-focus-target":m?"true":void 0,className:[H,"start"===a?"rounded-s-mp-full":"end"===a?"rounded-e-mp-full":"middle"===a?"rounded-none":"rounded-mp-full",i?"cursor-default text-mp-on-surface/38":r?"bg-(--_mp-accent) text-(--_mp-on-accent)":l?"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)":s?"border border-(--_mp-accent) text-(--_mp-accent)":c?"text-mp-on-surface-variant":"text-mp-on-surface",d??""].filter(Boolean).join(" "),onClick:()=>{i||h()},onPointerEnter:f,onKeyDown:p,children:[i?null:e(u,{}),n]})}function K({size:o,color:u,view:d,month:f,locale:p,labels:g,showPreviousButton:v,showNextButton:y,onStep:w,onViewChange:x}){const b=k(p,"long")[f.getMonth()],D=String(f.getFullYear()),M=S(p),N=R[o],P="day"===d?[g.previousMonth,g.nextMonth]:"month"===d?[g.previousYear,g.nextYear]:[g.previousYears,g.nextYears],_=(t,n)=>n?e(a,{size:N,color:u,label:P[-1===t?0:1],icon:e(l,{icon:-1===t?c:i,size:m[N],className:"rtl:rotate-180"}),onClick:()=>w(t)}):e("span",{"aria-hidden":"true",className:"size-(--_mp-cell)"}),C=t=>e(l,{icon:s,size:m[N],className:["transition-transform duration-(--mp-sys-motion-duration-short4)",t?"rotate-180":""].filter(Boolean).join(" ")}),j=e(r,{variant:"text",size:N,color:u,"aria-label":g.chooseMonth,"aria-expanded":"month"===d,endIcon:C("month"===d),onClick:()=>x("month"===d?"day":"month"),children:b},"month"),z=e(r,{variant:"text",size:N,color:u,className:"tabular-nums","aria-label":g.chooseYear,"aria-expanded":"year"===d,endIcon:C("year"===d),onClick:()=>x("year"===d?"day":"year"),children:D},"year"),F=Y(f.getFullYear());return t("div",{className:"flex items-center justify-between gap-1",children:[_(-1,v),e("div",{className:"flex min-w-0 flex-1 items-center justify-center gap-1",children:"year"===d?e("span",{className:`text-mp-on-surface flex h-(--_mp-cell) items-center tabular-nums ${h[o]}`,children:`${F}–${F+T-1}`}):"month"===d?z:t(n,M?{children:[j,z]}:{children:[z,j]})}),_(1,y)]})}export function MPCalendar({size:n,color:r,locale:l,weekStartsOn:a,month:s,onMonthChange:c,selected:i,rangeStart:u=null,rangeEnd:m=null,onSelect:d,onPreviewChange:h,minDate:f,maxDate:p,shouldDisableDate:y,showOutsideDays:w=!0,autoFocus:x=!1,showPreviousButton:b=!0,showNextButton:S=!0,labels:M}){const[C,k]=o.useState("day"),A=o.useMemo(()=>i.filter(P),[i]),[E,Y]=o.useState(()=>{const e=A.find(e=>N(e,s));return e?j(e):N(F(),s)?F():z(s)}),R=o.useRef(x),H=o.useRef(null);o.useEffect(()=>{Y(e=>N(e,s)?e:z(s))},[s]),o.useLayoutEffect(()=>{R.current&&(R.current=!1,H.current?.querySelector('[data-focus-target="true"]')?.focus({preventScroll:!0}))});const $=o.useCallback(e=>D(e,f,p)||(y?.(e)??!1),[f,p,y]),L=e=>{R.current=!0,k(e)},q=e=>{R.current=!0,c(e)};return t("div",{ref:H,className:"mp-calendar flex flex-col gap-1",style:{"--_mp-cell":B[n]},onPointerLeave:()=>h?.(null),children:[e(K,{size:n,color:r,view:C,month:s,locale:l,labels:M,showPreviousButton:b,showNextButton:S,onStep:e=>{c("day"===C?g(s,e):v(s,"month"===C?e:e*T))},onViewChange:L}),e("div",{className:"h-[calc(var(--_mp-cell)*7)] w-[calc(var(--_mp-cell)*7)]",children:"day"===C?e(U,{size:n,locale:l,weekStartsOn:a,month:s,chosen:A,rangeStart:u,rangeEnd:m,focusedDate:E,showOutsideDays:w,isDisabled:$,onSelect:e=>{Y(e),d(e)},onPreviewChange:h,onMoveFocus:e=>{R.current=!0,Y(e),N(e,s)||c(z(e))}}):"month"===C?e(I,{size:n,locale:l,month:s,chosen:A,minDate:f,maxDate:p,onMoveCursor:q,onPick:e=>{c(_(s.getFullYear(),e,1)),L("day")}}):e(O,{size:n,month:s,chosen:A,minDate:f,maxDate:p,onMoveCursor:q,onPick:e=>{c(_(e,s.getMonth(),1)),L("month")}})})]})}function L(e){return"rtl"===getComputedStyle(e).direction?-1:1}function U({size:n,locale:r,weekStartsOn:l,month:a,chosen:s,rangeStart:c,rangeEnd:i,focusedDate:u,showOutsideDays:m,isDisabled:f,onSelect:v,onPreviewChange:b,onMoveFocus:D}){const S=A(r,l,"narrow"),_=A(r,l,"long"),C=(j=i,P(k=c)&&P(j)?w(k,j)<=0?[k,j]:[j,k]:null);var k,j;const z=F(),E=o.useMemo(()=>{const e=x(r,{dateStyle:"full"});return y(a,l).map(t=>t.map(t=>({date:t,label:e.format(t)})))},[a,l,r]),T=o.useRef(null),Y=o.useRef(a);o.useLayoutEffect(()=>{const e=T.current,t=Y.current;if(Y.current=a,!e||N(t,a))return;const n=t.getTime()<a.getTime(),o="rtl"===getComputedStyle(e).direction;e.style.setProperty("--_mp-calendar-from",String(n===o?-1:1)),e.dataset.mpPaged="true",e.style.animationName="none",e.offsetWidth,e.style.animationName=""},[a]);return t("div",{role:"grid","aria-label":x(r,{year:"numeric",month:"long"}).format(a),className:"flex h-full flex-col",children:[e("div",{role:"rowgroup",children:e("div",{role:"row",className:"grid grid-cols-7",children:S.map((t,n)=>e("span",{role:"columnheader","aria-label":_[n],className:`text-mp-on-surface-variant flex h-(--_mp-cell) items-center justify-center select-none ${d}`,children:t},n))})}),e("div",{ref:T,role:"rowgroup",className:"mp-calendar__page flex flex-1 flex-col",children:E.map((t,o)=>e("div",{role:"row",className:"grid grid-cols-7",children:t.map(({date:t,label:o})=>{const r=!N(t,a);if(r&&!m)return e("span",{role:"gridcell","aria-hidden":"true",className:"size-(--_mp-cell)"},t.getTime());const c=s.some(e=>M(e,t)),i=null!==C&&w(t,C[0])>=0&&w(t,C[1])<=0,d=null!==C&&i&&M(t,C[0]),y=null!==C&&i&&M(t,C[1]);return e($,{label:o,selected:c,inRange:i&&!c,rangeEdge:i?d&&y?"both":d?"start":y?"end":"middle":null,current:M(t,z)&&!c,muted:r,disabled:f(t),focused:M(t,u),className:`size-(--_mp-cell) ${h[n]}`,onClick:()=>v(t),onPointerEnter:()=>b?.(t),onKeyDown:e=>((e,t)=>{const n=(t.getDay()-l+7)%7,o=L(e.currentTarget),r={ArrowLeft:()=>p(t,-o),ArrowRight:()=>p(t,o),ArrowUp:()=>p(t,-7),ArrowDown:()=>p(t,7),Home:()=>p(t,-n),End:()=>p(t,6-n),PageUp:()=>g(t,e.shiftKey?-12:-1),PageDown:()=>g(t,e.shiftKey?12:1)}[e.key];r&&(e.preventDefault(),D(r()))})(e,t),children:t.getDate()},t.getTime())})},o))})]})}function I({size:t,locale:n,month:o,chosen:r,minDate:l,maxDate:a,onMoveCursor:s,onPick:c}){const i=k(n,"short"),u=k(n,"long"),m=o.getFullYear(),d=new Date,f=e=>{const t=L(e.currentTarget),n={ArrowLeft:-t,ArrowRight:t,ArrowUp:-3,ArrowDown:3,PageUp:-12,PageDown:12}[e.key];void 0!==n&&(e.preventDefault(),s(g(z(o),n)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2,3].map(n=>e("div",{role:"row",className:"grid grid-cols-3 gap-1",children:[0,1,2].map(s=>{const p=3*n+s,g=_(m,p,1),v=_(m,p,b(m,p));return e($,{label:`${u[p]} ${m}`,selected:r.some(e=>e.getFullYear()===m&&e.getMonth()===p),current:d.getFullYear()===m&&d.getMonth()===p,disabled:P(l)&&w(v,l)<0||P(a)&&w(g,a)>0,focused:p===o.getMonth(),className:`h-(--_mp-cell) w-full ${h[t]}`,onClick:()=>c(p),onKeyDown:f,children:i[p]},p)})},n))})}function O({size:t,month:n,chosen:o,minDate:r,maxDate:l,onMoveCursor:a,onPick:s}){const c=Y(n.getFullYear()),i=(new Date).getFullYear(),u=e=>{const t=L(e.currentTarget),o={ArrowLeft:-t,ArrowRight:t,ArrowUp:-4,ArrowDown:4,PageUp:-T,PageDown:T}[e.key];void 0!==o&&(e.preventDefault(),a(v(z(n),o)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2].map(a=>e("div",{role:"row",className:"grid grid-cols-4 gap-1",children:[0,1,2,3].map(m=>{const d=c+4*a+m;return e($,{label:String(d),selected:o.some(e=>e.getFullYear()===d),current:d===i,disabled:P(r)&&d<r.getFullYear()||P(l)&&d>l.getFullYear(),focused:d===n.getFullYear(),className:`h-(--_mp-cell) w-full ${h[t]}`,onClick:()=>s(d),onKeyDown:u,children:d},d)})},a))})}function q(e,t){return Number.isFinite(e)?Math.min(t,Math.max(1,Math.round(e))):1}function V(e){const t=e.parentElement;if(!t)return;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.top-o.top-t.clientTop+t.scrollTop,l=r+n.height;r<t.scrollTop?t.scrollTop=r:l>t.scrollTop+t.clientHeight&&(t.scrollTop=l-t.clientHeight)}export function MPTimeGrid({size:n,locale:r,value:l,referenceDate:a,onChange:s,hour12:c,showSeconds:i,hourStep:m,minuteStep:d,secondStep:p,shouldDisableTime:g,autoFocus:v=!1,labels:y}){const w=l??a,b=o.useRef(null),[D,S]=o.useMemo(()=>C(r),[r]);o.useEffect(()=>{const e=b.current;if(e?.querySelectorAll('[data-chosen="true"]').forEach(V),v){const t=e?.querySelector('[role="listbox"]');(t?.querySelector('[data-chosen="true"]')??t?.querySelector('[role="option"]'))?.focus({preventScroll:!0})}},[v]);const M=o.useMemo(()=>{const e=c?12:24,t=q(m,e),n=Array.from({length:Math.ceil(e/t)},(e,n)=>n*t);return c?n.map(e=>0===e?12:e):n},[c,m]),N=o.useMemo(()=>{const e=q(d,60);return Array.from({length:Math.ceil(60/e)},(t,n)=>n*e)},[d]),P=o.useMemo(()=>{const e=q(p,60);return Array.from({length:Math.ceil(60/e)},(t,n)=>n*e)},[p]),_=e=>String(e).padStart(2,"0"),k=c?w.getHours()%12||12:w.getHours(),[j,z]=o.useState({}),F=(o,r,a,i,m)=>{const d=null===l?-1:a.findIndex(e=>i(e)),f=j[o]??(d>=0?d:0);return e("div",{role:"listbox","aria-label":r,className:["mp-time-grid__column flex flex-col gap-0.5 overflow-y-auto overscroll-contain","h-[calc(var(--_mp-cell)*7)] w-[calc(var(--_mp-cell)*1.75)]","scroll-py-0.5 [scrollbar-width:thin]"].join(" "),onKeyDown:e=>{const t={ArrowDown:1,ArrowUp:-1,PageDown:5,PageUp:-5}[e.key],n=void 0!==t?(e=>{const t=[...e.children].indexOf(document.activeElement);return t>=0?t:f})(e.currentTarget)+t:"Home"===e.key?0:"End"===e.key?a.length-1:null;null!==n&&(e.preventDefault(),((e,t)=>{const n=Math.min(a.length-1,Math.max(0,e)),r=t.children[n];z(e=>({...e,[o]:n})),r instanceof HTMLElement&&(r.focus({preventScroll:!0}),V(r))})(n,e.currentTarget))},children:a.map((r,a)=>{const d=((e,t)=>E(w,"hour"===e?{hours:c?t%12+(w.getHours()>=12?12:0):t}:"minute"===e?{minutes:t}:"second"===e?{seconds:t}:{hours:w.getHours()%12+12*t}))(o,r),p=null!==l&&i(r),v=g?.(d,o)??!1;return t("button",{type:"button",role:"option","aria-selected":p,"aria-disabled":v||void 0,"data-chosen":p?"true":void 0,tabIndex:a===f?0:-1,className:[H,"rounded-mp-full h-(--_mp-cell) w-full shrink-0",h[n],v?"cursor-default text-mp-on-surface/38":p?"bg-(--_mp-accent) text-(--_mp-on-accent)":"text-mp-on-surface"].join(" "),onFocus:()=>z(e=>({...e,[o]:a})),onClick:()=>{v||s(d)},children:[v?null:e(u,{}),m(r)]},r)})},o)};return t("div",{ref:b,className:"mp-time-grid flex gap-1",style:{"--_mp-cell":B[n]},children:[F("hour",y.hour,M,e=>e===k,e=>c?String(e):_(e)),F("minute",y.minute,N,e=>e===w.getMinutes(),_),i?F("second",y.second,P,e=>e===w.getSeconds(),_):null,c?F("meridiem",y.meridiem,[0,1],e=>(w.getHours()>=12?1:0)===e,e=>0===e?D:S):null,e("span",{className:f,"aria-live":"polite",children:null===l?"":x(r,{hour:"numeric",minute:"2-digit",...i?{second:"2-digit"}:{}}).format(l)})]})}
|
|
2
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{MPButton as r}from"../components/button/MPButton.js";import{MPIcon as l}from"../components/icon/MPIcon.js";import{MPIconButton as a}from"../components/icon-button/MPIconButton.js";import{ChevronDownIcon as s,ChevronLeftIcon as c,ChevronRightIcon as i}from"../constants/icons.js";import{MPStateLayer as u}from"./StateLayer.js";import{CONTROL_ICON as m,META_TEXT as d,PROSE_TEXT as h}from"./scale.js";import{VISUALLY_HIDDEN as p}from"./visually-hidden.js";import{addDays as f,addMonths as g,addYears as y,calendarWeeks as v,compareDay as w,dateFormatter as x,isDayOutside as b,isMonthBeforeYear as D,isSameDay as S,isSameMonth as M,isUnitOutside as N,isValidDate as P,makeDate as _,meridiemLabels as C,monthLabels as k,startOfDay as j,startOfMonth as z,today as A,weekdayLabels as E,withTime as T,YEAR_PAGE_SIZE as F,yearPageStart as Y}from"./date.js";const B={xs:"1.75rem",sm:"2rem",md:"2.5rem",lg:"2.75rem",xl:"3rem"},R={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"},H=/*@__PURE__*/["group relative flex cursor-pointer items-center justify-center overflow-hidden","box-border appearance-none font-[inherit] tabular-nums select-none","transition-[background-color,border-color,color]","duration-(--mp-sys-motion-duration-short4)","outline-mp-secondary focus-visible:z-10 focus-visible:outline-2","focus-visible:outline-offset-[-2px] focus-visible:outline-solid outline-none"].join(" "),$={day:0,month:1,year:2};function K({children:n,label:o,selected:r,inRange:l=!1,rangeEdge:a=null,current:s=!1,muted:c=!1,disabled:i=!1,focused:m=!1,className:d,onClick:h,onPointerEnter:p,onKeyDown:f}){return t("button",{type:"button",role:"gridcell","aria-label":o,"aria-selected":r,"aria-current":s?"date":void 0,"aria-disabled":i||void 0,tabIndex:m?0:-1,"data-focus-target":m?"true":void 0,className:[H,"start"===a?"rounded-s-mp-full":"end"===a?"rounded-e-mp-full":"middle"===a?"rounded-none":"rounded-mp-full",i?"bg-transparent cursor-default text-mp-on-surface/38":r?"bg-(--_mp-accent) text-(--_mp-on-accent)":l?"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)":s?"bg-transparent border border-(--_mp-accent) text-(--_mp-accent)":c?"bg-transparent text-mp-on-surface-variant":"bg-transparent text-mp-on-surface",d??""].filter(Boolean).join(" "),onClick:()=>{i||h()},onPointerEnter:p,onKeyDown:f,children:[i?null:e(u,{}),n]})}function L({size:o,color:u,view:d,month:p,locale:f,labels:g,showPreviousButton:y,showNextButton:v,onStep:w,onViewChange:x}){const b=k(f,"long")[p.getMonth()],S=String(p.getFullYear()),M=D(f),N=R[o],P="day"===d?[g.previousMonth,g.nextMonth]:"month"===d?[g.previousYear,g.nextYear]:[g.previousYears,g.nextYears],_=(t,n)=>n?e(a,{size:N,color:u,label:P[-1===t?0:1],icon:e(l,{icon:-1===t?c:i,size:m[N],className:"rtl:rotate-180"}),onClick:()=>w(t)}):e("span",{"aria-hidden":"true",className:"size-(--_mp-cell)"}),C=t=>e(l,{icon:s,size:m[N],className:["transition-transform duration-(--mp-sys-motion-duration-short4)",t?"rotate-180":""].filter(Boolean).join(" ")}),j=e(r,{variant:"text",size:N,color:u,"aria-label":g.chooseMonth,"aria-expanded":"month"===d,endIcon:C("month"===d),onClick:()=>x("month"===d?"day":"month"),children:b},"month"),z=e(r,{variant:"text",size:N,color:u,className:"tabular-nums","aria-label":g.chooseYear,"aria-expanded":"year"===d,endIcon:C("year"===d),onClick:()=>x("year"===d?"day":"year"),children:S},"year"),A=Y(p.getFullYear());return t("div",{className:"flex items-center justify-between gap-1",children:[_(-1,y),e("div",{className:"flex min-w-0 flex-1 items-center justify-center gap-1",children:"year"===d?e("span",{className:`text-mp-on-surface flex h-(--_mp-cell) items-center tabular-nums ${h[o]}`,children:`${A}–${A+F-1}`}):"month"===d?z:t(n,M?{children:[j,z]}:{children:[z,j]})}),_(1,v)]})}export function Calendar({size:n,color:r,locale:l,weekStartsOn:a,month:s,onMonthChange:c,selected:i,rangeStart:u=null,rangeEnd:m=null,onSelect:d,onPreviewChange:h,minDate:p,maxDate:f,shouldDisableDate:v,showOutsideDays:w=!0,autoFocus:x=!1,showPreviousButton:D=!0,showNextButton:S=!0,precision:N="day",labels:C}){const[k,E]=o.useState(N),T=$[k]<$[N]?N:k,Y=o.useMemo(()=>i.filter(P),[i]),[R,H]=o.useState(()=>{const e=Y.find(e=>M(e,s));return e?j(e):M(A(),s)?A():z(s)}),K=o.useRef(x),U=o.useRef(null);o.useEffect(()=>{H(e=>M(e,s)?e:z(s))},[s]),o.useLayoutEffect(()=>{K.current&&(K.current=!1,U.current?.querySelector('[data-focus-target="true"]')?.focus({preventScroll:!0}))});const V=o.useCallback(e=>b(e,p,f)||(v?.(e)??!1),[p,f,v]),G=e=>{K.current=!0,E(e)},W=e=>{K.current=!0,c(e)};return t("div",{ref:U,className:"mp-calendar flex flex-col gap-1",style:{"--_mp-cell":B[n]},onPointerLeave:()=>h?.(null),children:[e(L,{size:n,color:r,view:T,month:s,locale:l,labels:C,showPreviousButton:D,showNextButton:S,onStep:e=>{c("day"===T?g(s,e):y(s,"month"===T?e:e*F))},onViewChange:G}),e("div",{className:"h-[calc(var(--_mp-cell)*7)] w-[calc(var(--_mp-cell)*7)]",children:"day"===T?e(I,{size:n,locale:l,weekStartsOn:a,month:s,chosen:Y,rangeStart:u,rangeEnd:m,focusedDate:R,showOutsideDays:w,isDisabled:V,onSelect:e=>{H(e),d(e)},onPreviewChange:h,onMoveFocus:e=>{K.current=!0,H(e),M(e,s)||c(z(e))}}):"month"===T?e(O,{size:n,locale:l,month:s,chosen:Y,minDate:p,maxDate:f,onMoveCursor:W,onPick:e=>{const t=_(s.getFullYear(),e,1);"month"!==N?(c(t),G("day")):d(t)}}):e(q,{size:n,month:s,chosen:Y,minDate:p,maxDate:f,onMoveCursor:W,onPick:e=>{"year"!==N?(c(_(e,s.getMonth(),1)),G("month")):d(_(e,0,1))}})})]})}function U(e){return"rtl"===getComputedStyle(e).direction?-1:1}function I({size:n,locale:r,weekStartsOn:l,month:a,chosen:s,rangeStart:c,rangeEnd:i,focusedDate:u,showOutsideDays:m,isDisabled:p,onSelect:y,onPreviewChange:b,onMoveFocus:D}){const N=E(r,l,"narrow"),_=E(r,l,"long"),C=(j=i,P(k=c)&&P(j)?w(k,j)<=0?[k,j]:[j,k]:null);var k,j;const z=A(),T=o.useMemo(()=>{const e=x(r,{dateStyle:"full"});return v(a,l).map(t=>t.map(t=>({date:t,label:e.format(t)})))},[a,l,r]),F=o.useRef(null),Y=o.useRef(a);o.useLayoutEffect(()=>{const e=F.current,t=Y.current;if(Y.current=a,!e||M(t,a))return;const n=t.getTime()<a.getTime(),o="rtl"===getComputedStyle(e).direction;e.style.setProperty("--_mp-calendar-from",String(n===o?-1:1)),e.dataset.mpPaged="true",e.style.animationName="none",e.offsetWidth,e.style.animationName=""},[a]);return t("div",{role:"grid","aria-label":x(r,{year:"numeric",month:"long"}).format(a),className:"flex h-full flex-col",children:[e("div",{role:"rowgroup",children:e("div",{role:"row",className:"grid grid-cols-7",children:N.map((t,n)=>e("span",{role:"columnheader","aria-label":_[n],className:`text-mp-on-surface-variant flex h-(--_mp-cell) items-center justify-center select-none ${d}`,children:t},n))})}),e("div",{ref:F,role:"rowgroup",className:"mp-calendar__page flex flex-1 flex-col",children:T.map((t,o)=>e("div",{role:"row",className:"grid grid-cols-7",children:t.map(({date:t,label:o})=>{const r=!M(t,a);if(r&&!m)return e("span",{role:"gridcell","aria-hidden":"true",className:"size-(--_mp-cell)"},t.getTime());const c=s.some(e=>S(e,t)),i=null!==C&&w(t,C[0])>=0&&w(t,C[1])<=0,d=null!==C&&i&&S(t,C[0]),v=null!==C&&i&&S(t,C[1]);return e(K,{label:o,selected:c,inRange:i&&!c,rangeEdge:i?d&&v?"both":d?"start":v?"end":"middle":null,current:S(t,z)&&!c,muted:r,disabled:p(t),focused:S(t,u),className:`size-(--_mp-cell) ${h[n]}`,onClick:()=>y(t),onPointerEnter:()=>b?.(t),onKeyDown:e=>((e,t)=>{const n=(t.getDay()-l+7)%7,o=U(e.currentTarget),r={ArrowLeft:()=>f(t,-o),ArrowRight:()=>f(t,o),ArrowUp:()=>f(t,-7),ArrowDown:()=>f(t,7),Home:()=>f(t,-n),End:()=>f(t,6-n),PageUp:()=>g(t,e.shiftKey?-12:-1),PageDown:()=>g(t,e.shiftKey?12:1)}[e.key];r&&(e.preventDefault(),D(r()))})(e,t),children:t.getDate()},t.getTime())})},o))})]})}function O({size:t,locale:n,month:r,chosen:l,minDate:a,maxDate:s,onMoveCursor:c,onPick:i}){const u=k(n,"short"),m=r.getFullYear(),d=new Date,p=o.useMemo(()=>{const e=x(n,{year:"numeric",month:"long"});return Array.from({length:12},(t,n)=>e.format(_(m,n,1)))},[n,m]),f=e=>{const t=U(e.currentTarget),n={ArrowLeft:-t,ArrowRight:t,ArrowUp:-3,ArrowDown:3,PageUp:-12,PageDown:12}[e.key];void 0!==n&&(e.preventDefault(),c(g(z(r),n)))};return e("div",{role:"grid","aria-label":String(m),className:"flex h-full flex-col justify-evenly",children:[0,1,2,3].map(n=>e("div",{role:"row",className:"grid grid-cols-3 gap-1",children:[0,1,2].map(o=>{const c=3*n+o;return e(K,{label:p[c],selected:l.some(e=>e.getFullYear()===m&&e.getMonth()===c),current:d.getFullYear()===m&&d.getMonth()===c,disabled:N(_(m,c,1),"month",a,s),focused:c===r.getMonth(),className:`h-(--_mp-cell) w-full ${h[t]}`,onClick:()=>i(c),onKeyDown:f,children:u[c]},c)})},n))})}function q({size:t,month:n,chosen:o,minDate:r,maxDate:l,onMoveCursor:a,onPick:s}){const c=Y(n.getFullYear()),i=(new Date).getFullYear(),u=e=>{const t=U(e.currentTarget),o={ArrowLeft:-t,ArrowRight:t,ArrowUp:-4,ArrowDown:4,PageUp:-F,PageDown:F}[e.key];void 0!==o&&(e.preventDefault(),a(y(z(n),o)))};return e("div",{role:"grid","aria-label":`${c}–${c+F-1}`,className:"flex h-full flex-col justify-evenly",children:[0,1,2].map(a=>e("div",{role:"row",className:"grid grid-cols-4 gap-1",children:[0,1,2,3].map(m=>{const d=c+4*a+m;return e(K,{label:String(d),selected:o.some(e=>e.getFullYear()===d),current:d===i,disabled:N(_(d,0,1),"year",r,l),focused:d===n.getFullYear(),className:`h-(--_mp-cell) w-full ${h[t]}`,onClick:()=>s(d),onKeyDown:u,children:d},d)})},a))})}function V(e,t){return Number.isFinite(e)?Math.min(t,Math.max(1,Math.round(e))):1}function G(e){const t=e.parentElement;if(!t)return;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.top-o.top-t.clientTop+t.scrollTop,l=r+n.height;r<t.scrollTop?t.scrollTop=r:l>t.scrollTop+t.clientHeight&&(t.scrollTop=l-t.clientHeight)}export function MPTimeGrid({size:n,locale:r,value:l,referenceDate:a,onChange:s,hour12:c,showSeconds:i,hourStep:m,minuteStep:d,secondStep:f,shouldDisableTime:g,autoFocus:y=!1,labels:v}){const w=l??a,b=o.useRef(null),[D,S]=o.useMemo(()=>C(r),[r]);o.useEffect(()=>{const e=b.current;if(e?.querySelectorAll('[data-chosen="true"]').forEach(G),y){const t=e?.querySelector('[role="listbox"]');(t?.querySelector('[data-chosen="true"]')??t?.querySelector('[role="option"]'))?.focus({preventScroll:!0})}},[y]);const M=o.useMemo(()=>{const e=c?12:24,t=V(m,e),n=Array.from({length:Math.ceil(e/t)},(e,n)=>n*t);return c?n.map(e=>0===e?12:e):n},[c,m]),N=o.useMemo(()=>{const e=V(d,60);return Array.from({length:Math.ceil(60/e)},(t,n)=>n*e)},[d]),P=o.useMemo(()=>{const e=V(f,60);return Array.from({length:Math.ceil(60/e)},(t,n)=>n*e)},[f]),_=e=>String(e).padStart(2,"0"),k=c?w.getHours()%12||12:w.getHours(),[j,z]=o.useState({}),A=(o,r,a,i,m)=>{const d=null===l?-1:a.findIndex(e=>i(e)),p=j[o]??(d>=0?d:0);return e("div",{role:"listbox","aria-label":r,className:["mp-time-grid__column flex flex-col gap-0.5 overflow-y-auto overscroll-contain","h-[calc(var(--_mp-cell)*7)] w-[calc(var(--_mp-cell)*1.75)]","scroll-py-0.5 [scrollbar-width:thin]"].join(" "),onKeyDown:e=>{const t={ArrowDown:1,ArrowUp:-1,PageDown:5,PageUp:-5}[e.key],n=void 0!==t?(e=>{const t=[...e.children].indexOf(document.activeElement);return t>=0?t:p})(e.currentTarget)+t:"Home"===e.key?0:"End"===e.key?a.length-1:null;null!==n&&(e.preventDefault(),((e,t)=>{const n=Math.min(a.length-1,Math.max(0,e)),r=t.children[n];z(e=>({...e,[o]:n})),r instanceof HTMLElement&&(r.focus({preventScroll:!0}),G(r))})(n,e.currentTarget))},children:a.map((r,a)=>{const d=((e,t)=>T(w,"hour"===e?{hours:c?t%12+(w.getHours()>=12?12:0):t}:"minute"===e?{minutes:t}:"second"===e?{seconds:t}:{hours:w.getHours()%12+12*t}))(o,r),f=null!==l&&i(r),y=g?.(d,o)??!1;return t("button",{type:"button",role:"option","aria-selected":f,"aria-disabled":y||void 0,"data-chosen":f?"true":void 0,tabIndex:a===p?0:-1,className:[H,"rounded-mp-full h-(--_mp-cell) w-full shrink-0",h[n],y?"bg-transparent cursor-default text-mp-on-surface/38":f?"bg-(--_mp-accent) text-(--_mp-on-accent)":"bg-transparent text-mp-on-surface"].join(" "),onFocus:()=>z(e=>({...e,[o]:a})),onClick:()=>{y||s(d)},children:[y?null:e(u,{}),m(r)]},r)})},o)};return t("div",{ref:b,className:"mp-time-grid flex gap-1",style:{"--_mp-cell":B[n]},children:[A("hour",v.hour,M,e=>e===k,e=>c?String(e):_(e)),A("minute",v.minute,N,e=>e===w.getMinutes(),_),i?A("second",v.second,P,e=>e===w.getSeconds(),_):null,c?A("meridiem",v.meridiem,[0,1],e=>(w.getHours()>=12?1:0)===e,e=>0===e?D:S):null,e("span",{className:p,"aria-live":"polite",children:null===l?"":x(r,{hour:"numeric",minute:"2-digit",...i?{second:"2-digit"}:{}}).format(l)})]})}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { MPPickerLabels } from './Calendar.js';
|
|
3
|
-
import type { MPColor, MPSize, MPStyleProps } from '../types.js';
|
|
3
|
+
import type { MPColor, MPControlEventProps, MPSize, MPStyleProps } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* The strings a trigger is held open by, kept across renders that did not
|
|
6
6
|
* change what it could say.
|
|
@@ -25,6 +25,18 @@ import type { MPColor, MPSize, MPStyleProps } from '../types.js';
|
|
|
25
25
|
* never a wrong answer.
|
|
26
26
|
*/
|
|
27
27
|
export declare function useDisplaySamples(locale: string | undefined, options: Intl.DateTimeFormatOptions): string[];
|
|
28
|
+
/**
|
|
29
|
+
* The popup's room, one track tighter than a control's.
|
|
30
|
+
*
|
|
31
|
+
* A calendar is already a grid of forty-two padded cells; giving the sheet
|
|
32
|
+
* around it a control's 16px as well would put 24px of nothing between the last
|
|
33
|
+
* column and the edge.
|
|
34
|
+
*
|
|
35
|
+
* Exported because `MPCalendar` draws the same grid on a surface of its own, and
|
|
36
|
+
* a standalone calendar sitting one track wider than the identical calendar in a
|
|
37
|
+
* picker's popup is the drift a shared table exists to prevent.
|
|
38
|
+
*/
|
|
39
|
+
export declare const POPUP_PAD: Record<MPSize, string>;
|
|
28
40
|
/**
|
|
29
41
|
* The props a picker takes from its shell rather than inventing.
|
|
30
42
|
*
|
|
@@ -32,7 +44,7 @@ export declare function useDisplaySamples(locale: string | undefined, options: I
|
|
|
32
44
|
* the rows a reader of the docs is actually looking at — every one of the four
|
|
33
45
|
* pickers lists them, and they mean the same thing on all four.
|
|
34
46
|
*/
|
|
35
|
-
export interface MPPickerShellProps extends MPStyleProps {
|
|
47
|
+
export interface MPPickerShellProps extends MPStyleProps, MPControlEventProps<HTMLButtonElement> {
|
|
36
48
|
/**
|
|
37
49
|
* Which accent family the popup reads: the chosen day's fill, the band across
|
|
38
50
|
* a range, today's outline, the footer's confirm button.
|
|
@@ -130,7 +142,7 @@ interface InternalShellProps extends MPPickerShellProps {
|
|
|
130
142
|
* treatment, and the popup's `surface-container` at elevation 2 — which is the
|
|
131
143
|
* same floating sheet a menu and a select's list are drawn on.
|
|
132
144
|
*/
|
|
133
|
-
export declare function MPPickerShell({ slug, size, color, fullWidth, label, floatingLabel, description, errorMessage, startIcon, required, disabled, readOnly, id, className, style, display, samples, empty, clearable, onClear, open, onOpenChange, labels, hiddenValues, children, triggerRef }: InternalShellProps): React.JSX.Element;
|
|
145
|
+
export declare function MPPickerShell({ slug, size, color, fullWidth, label, floatingLabel, description, errorMessage, startIcon, required, disabled, readOnly, id, className, style, onKeyDown, onKeyUp, onFocus, onBlur, onClick, onDoubleClick, onContextMenu, display, samples, empty, clearable, onClear, open, onOpenChange, labels, hiddenValues, children, triggerRef }: InternalShellProps): React.JSX.Element;
|
|
134
146
|
/**
|
|
135
147
|
* The row of shortcuts under a picker's panel.
|
|
136
148
|
*
|
package/dist/internal/Picker.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as
|
|
2
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as o from"react";import{Field as r}from"@base-ui/react/field";import{Popover as i}from"@base-ui/react/popover";import{MPIcon as t}from"../components/icon/MPIcon.js";import{CloseIcon as l}from"../constants/icons.js";import{accentSlots as s}from"./accent.js";import{MPFieldLabel as a,MPFieldOutline as p,useFloatingLabel as c}from"./FieldOutline.js";import{MPStateLayer as u}from"./StateLayer.js";import{MPSupportingText as m}from"./SupportingText.js";import{MPWidthSizer as d}from"./WidthSizer.js";import{displaySamples as f}from"./date.js";import{CONTROL_ICON as h,hasContent as x,PROSE_TEXT as g}from"./scale.js";import{FADE as b,PORTAL_LAYER as y}from"./surface.js";export function useDisplaySamples(e,n){const r=`${e??""} ${JSON.stringify(n)}`;return o.useMemo(()=>f(e,n),[r])}const j={xs:{padding:"px-2",height:"h-8"},sm:{padding:"px-3",height:"h-10"},md:{padding:"px-4",height:"h-14"},lg:{padding:"px-4",height:"h-16"},xl:{padding:"px-5",height:"h-18"}};export const POPUP_PAD={xs:"p-1.5",sm:"p-2",md:"p-2.5",lg:"p-3",xl:"p-3.5"};export function MPPickerShell({slug:f,size:v="md",color:P="primary",fullWidth:N=!1,label:k,floatingLabel:w=!0,description:C,errorMessage:O,startIcon:M,required:D=!1,disabled:F=!1,readOnly:S=!1,id:z,className:B,style:_,onKeyDown:I,onKeyUp:K,onFocus:R,onBlur:U,onClick:$,onDoubleClick:q,onContextMenu:T,display:A,samples:E,empty:L,clearable:W=!1,onClear:J,open:V,onOpenChange:Z,labels:G,hiddenValues:H,children:Q,triggerRef:X}){const Y=x(O),ee=j[v],ne=o.useId(),oe=z??ne,re=W&&!L&&!(F||S),{shrunk:ie,focusProps:te}=c({floating:w&&x(k),filled:!L,pinned:V||x(M)});return n(r.Root,{disabled:F,invalid:Y,"data-mp-size":v,className:[`mp-${f} group flex-col align-top`,N?"flex w-full":"inline-flex w-fit",B??""].filter(Boolean).join(" "),style:{...s(P),..._},...te,children:[n(i.Root,{open:V,onOpenChange:Z,children:[n("div",{className:"relative w-full",children:[n(i.Trigger,{id:oe,ref:X,disabled:F,nativeButton:!0,onKeyDown:I,onKeyUp:K,onFocus:R,onBlur:U,onClick:$,onDoubleClick:q,onContextMenu:T,className:["relative flex w-full items-center gap-2 select-none","appearance-none bg-transparent font-[inherit] outline-none",ee.padding,re?"pe-10":"",ee.height,g[v],F?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface "+(S?"cursor-default":"cursor-pointer")].filter(Boolean).join(" "),children:[M?e("span",{className:["flex shrink-0 items-center",F?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:M}):null,n("span",{className:"flex min-w-0 flex-1 flex-col",children:[e("span",{className:["w-full truncate text-start",L&&!F?"text-mp-on-surface-variant":""].filter(Boolean).join(" "),children:L&&!ie?null:A}),e(d,{samples:E??[]})]})]}),re?n("button",{type:"button","aria-label":G.clear,onClick:J,className:["group/clear rounded-mp-full text-mp-on-surface-variant absolute inset-y-0","end-1 my-auto flex size-8 cursor-pointer items-center justify-center","appearance-none border-0 bg-transparent font-[inherit]","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none"].join(" "),children:[e(u,{className:"group-hover/clear:opacity-8 group-focus-visible/clear:opacity-10"}),e(t,{icon:l,size:h[v]})]}):null,e(p,{label:k,required:D,notched:ie}),x(k)?e(a,{size:v,label:k,required:D,htmlFor:oe,shrunk:ie}):null]}),e(i.Portal,{children:e(i.Positioner,{className:y,sideOffset:4,align:"start",children:e(i.Popup,{initialFocus:!1,style:s(P),className:[`mp-${f}__popup rounded-mp-md shadow-mp-2 bg-mp-surface-container`,"text-mp-on-surface outline-none",POPUP_PAD[v],g[v],b].join(" "),children:Q})})})]}),e(m,{description:C,errorMessage:O,className:ee.padding}),H?.map((n,o)=>e("input",{type:"hidden",name:n.name,value:n.value},o))]})}export function MPPickerFooter({children:n}){return e("div",{className:"border-mp-outline-variant flex items-center justify-end gap-1 border-t pt-1.5",children:n})}export function MPPickerDivider(){return e("div",{"aria-hidden":"true",className:"bg-mp-outline-variant w-px self-stretch"})}export const FOOTER_SIZE={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** What a page can be set to. `'system'` is the absence of a choice. */
|
|
2
|
+
export type MPColorScheme = 'light' | 'dark' | 'system';
|
|
3
|
+
/** What is actually painted, once `'system'` has been resolved. */
|
|
4
|
+
export type MPResolvedColorScheme = 'light' | 'dark';
|
|
5
|
+
export declare const SCHEME_ATTRIBUTE = "data-mp-scheme";
|
|
6
|
+
export declare const DEFAULT_STORAGE_KEY = "mp-color-scheme";
|
|
7
|
+
/**
|
|
8
|
+
* Puts the choice on the document element, or takes it off.
|
|
9
|
+
*
|
|
10
|
+
* `'system'` **removes** the attribute rather than writing it, which is the
|
|
11
|
+
* whole of how the media query gets its say back: the dark block is reached
|
|
12
|
+
* either by `prefers-color-scheme` on a root that is not forced light, or by the
|
|
13
|
+
* attribute. An attribute spelling out `system` would match neither.
|
|
14
|
+
*/
|
|
15
|
+
export declare function applyScheme(scheme: MPColorScheme): void;
|
|
16
|
+
export declare function setScheme(storageKey: string, scheme: MPColorScheme): void;
|
|
17
|
+
export declare function useChosenScheme(storageKey: string): MPColorScheme;
|
|
18
|
+
/**
|
|
19
|
+
* What the operating system is asking for, followed live.
|
|
20
|
+
*
|
|
21
|
+
* Subscribed to even while a page has chosen `'light'` or `'dark'`, which costs
|
|
22
|
+
* one listener and buys the thing a toggle is usually for: switching back to
|
|
23
|
+
* `'system'` reports the right answer immediately rather than on the next
|
|
24
|
+
* change.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useSystemScheme(): MPResolvedColorScheme;
|
|
27
|
+
/** Test seam: forgets the page's choice so a suite can start from nothing. */
|
|
28
|
+
export declare function resetScheme(): void;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import*as e from"react";export const SCHEME_ATTRIBUTE="data-mp-scheme";export const DEFAULT_STORAGE_KEY="mp-color-scheme";const t="(prefers-color-scheme: dark)";function n(e){return"light"===e||"dark"===e||"system"===e}let o;const r=new Set;function c(){for(const e of r)e()}export function applyScheme(e){if("undefined"==typeof document)return;const t=document.documentElement;"system"===e?t.removeAttribute("data-mp-scheme"):t.setAttribute("data-mp-scheme",e)}export function setScheme(e,t){o=t,function(e,t){try{"system"===t?localStorage.removeItem(e):localStorage.setItem(e,t)}catch{}}(e,t),applyScheme(t),c()}function s(e){return r.add(e),()=>{r.delete(e)}}function u(e){return o??=function(){if("undefined"==typeof document)return;const e=document.documentElement.getAttribute("data-mp-scheme");return n(e)&&"system"!==e?e:void 0}()??function(e){try{if("undefined"==typeof localStorage)return"system";const t=localStorage.getItem(e);return n(t)?t:"system"}catch{return"system"}}(e),o}export function useChosenScheme(t){const n=e.useCallback(()=>u(t),[t]);return e.useSyncExternalStore(s,n,()=>"system")}function m(e){if("undefined"==typeof window||!window.matchMedia)return()=>{};const n=window.matchMedia(t);return n.addEventListener("change",e),()=>n.removeEventListener("change",e)}function i(){return"undefined"!=typeof window&&window.matchMedia?.(t).matches?"dark":"light"}export function useSystemScheme(){return e.useSyncExternalStore(m,i,()=>"light")}export function resetScheme(){o=void 0,c()}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two prop defaults an application can move for the whole page.
|
|
3
|
+
*
|
|
4
|
+
* `size` and `color` are the only axes where every component in this library
|
|
5
|
+
* starts from the *same* answer — `md` and `primary` — which is what makes a
|
|
6
|
+
* single app-wide default meaningful for them and meaningless for anything else.
|
|
7
|
+
* A `variant` default is per component by design (`MPAccordion` is `outlined`,
|
|
8
|
+
* `MPAlert` is `tonal`, `MPBadge` is `filled`), so one global value would be
|
|
9
|
+
* overwriting six considered decisions with one arbitrary one.
|
|
10
|
+
*
|
|
11
|
+
* The same rule decides which components read this at all: a component that was
|
|
12
|
+
* taking the library's default takes the configured one instead, and a component
|
|
13
|
+
* that had chosen its own keeps it. `MPBadge` stays `error`, `MPTooltip` stays
|
|
14
|
+
* `sm`, `MPDialog`, `MPPill` and `MPShortcut` stay `secondary` — those are not
|
|
15
|
+
* unfilled defaults, they are answers.
|
|
16
|
+
*
|
|
17
|
+
* ## Why this needs context at all
|
|
18
|
+
*
|
|
19
|
+
* Which is the question `MPLocaleProvider` answers for itself, and the answer
|
|
20
|
+
* here is the same shape. Everything a theme normally carries — the colour
|
|
21
|
+
* roles, the type scale, the corners, the motion — is a CSS custom property and
|
|
22
|
+
* reaches a component through the cascade. `size` cannot: it resolves to literal
|
|
23
|
+
* Tailwind class strings (`h-14`, `text-mp-body-large`), because Tailwind finds
|
|
24
|
+
* classes by scanning source text and an interpolated `h-${n}` generates no rule
|
|
25
|
+
* at all. See `internal/scale.ts`. A value that cannot be a custom property and
|
|
26
|
+
* has to reach every call site is exactly what context is for.
|
|
27
|
+
*/
|
|
28
|
+
import * as React from 'react';
|
|
29
|
+
import type { MPColor, MPSize } from '../types.js';
|
|
30
|
+
/** What an `MPConfigProvider` can set. Anything unset is inherited, then default. */
|
|
31
|
+
export interface MPConfigValue {
|
|
32
|
+
size?: MPSize;
|
|
33
|
+
color?: MPColor;
|
|
34
|
+
}
|
|
35
|
+
export declare const MPConfigContext: React.Context<MPConfigValue>;
|
|
36
|
+
/** The configuration in force at this point in the tree. */
|
|
37
|
+
export declare function useMPConfig(): MPConfigValue;
|
|
38
|
+
/**
|
|
39
|
+
* `prop ?? config ?? the library's own`, which is the order of specificity: what
|
|
40
|
+
* this call site said, then what the application said, then what Material says.
|
|
41
|
+
*/
|
|
42
|
+
export declare function useMPSize(size: MPSize | undefined): MPSize;
|
|
43
|
+
export declare function useMPColor(color: MPColor | undefined): MPColor;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import*as t from"react";const e=Object.freeze({});export const MPConfigContext=/*@__PURE__*/t.createContext(e);export function useMPConfig(){return t.useContext(MPConfigContext)}export function useMPSize(e){const o=t.useContext(MPConfigContext);return e??o.size??"md"}export function useMPColor(e){const o=t.useContext(MPConfigContext);return e??o.color??"primary"}
|
package/dist/internal/date.d.ts
CHANGED
|
@@ -25,6 +25,16 @@
|
|
|
25
25
|
import type { MPWeekday } from '../types.js';
|
|
26
26
|
/** Which unit the calendar is currently letting you pick. */
|
|
27
27
|
export type MPCalendarView = 'day' | 'month' | 'year';
|
|
28
|
+
/**
|
|
29
|
+
* Which unit a picker asks for at all — the view the calendar stops at.
|
|
30
|
+
*
|
|
31
|
+
* The same three words as `MPCalendarView` and deliberately a second name: one
|
|
32
|
+
* is what is on screen at this moment, the other is what the control is *for*.
|
|
33
|
+
* A day picker passes through all three views and answers with a day; a month
|
|
34
|
+
* picker never draws a day grid, and the year view above it is a way of
|
|
35
|
+
* reaching a month rather than an answer of its own.
|
|
36
|
+
*/
|
|
37
|
+
export type MPDatePrecision = MPCalendarView;
|
|
28
38
|
/** How many years one page of the year grid holds. Four columns of three. */
|
|
29
39
|
export declare const YEAR_PAGE_SIZE = 12;
|
|
30
40
|
/**
|
|
@@ -44,8 +54,22 @@ export declare function isValidDate(value: unknown): value is Date;
|
|
|
44
54
|
export declare function startOfDay(date: Date): Date;
|
|
45
55
|
/** The first day of the month this date is in, at midnight. */
|
|
46
56
|
export declare function startOfMonth(date: Date): Date;
|
|
57
|
+
/** The first day of the year this date is in, at midnight. */
|
|
58
|
+
export declare function startOfYear(date: Date): Date;
|
|
47
59
|
/** How many days a month has, leap years included. */
|
|
48
60
|
export declare function daysInMonth(year: number, month: number): number;
|
|
61
|
+
/**
|
|
62
|
+
* The first instant of the day, month or year a date falls in.
|
|
63
|
+
*
|
|
64
|
+
* Which of the three is the picker's question rather than the calendar's. A
|
|
65
|
+
* control asked for a month holds a `Date` standing for a whole month, and the
|
|
66
|
+
* only honest one is that month's first day: a picker whose trigger says
|
|
67
|
+
* *July 2026* and whose form submits the 31st is printing one thing and sending
|
|
68
|
+
* another.
|
|
69
|
+
*/
|
|
70
|
+
export declare function startOfUnit(date: Date, unit: MPCalendarView): Date;
|
|
71
|
+
/** The last day of that same unit, at midnight — the other end of its span. */
|
|
72
|
+
export declare function endOfUnit(date: Date, unit: MPCalendarView): Date;
|
|
49
73
|
/** Today, at midnight. The one place the pickers read the clock for a *date*. */
|
|
50
74
|
export declare function today(): Date;
|
|
51
75
|
export declare function addDays(date: Date, amount: number): Date;
|
|
@@ -71,6 +95,21 @@ export declare function isSameMonth(a: Date | null | undefined, b: Date | null |
|
|
|
71
95
|
* has been chosen.
|
|
72
96
|
*/
|
|
73
97
|
export declare function isDayOutside(date: Date, min?: Date | null, max?: Date | null): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* The same question asked of a whole month or a whole year.
|
|
100
|
+
*
|
|
101
|
+
* A unit is outside the span only when *every* day in it is, which is what
|
|
102
|
+
* leaves July reachable under a `minDate` of 10 July: the bound is about which
|
|
103
|
+
* months exist, and where inside one it falls is a day grid's problem. It is
|
|
104
|
+
* the widening `isDayOutside` already applies to the time of day, one rung up —
|
|
105
|
+
* and it is the rule both the month grid and the year grid were already
|
|
106
|
+
* spelling out for themselves.
|
|
107
|
+
*
|
|
108
|
+
* The day case is handed to `isDayOutside` rather than written as this rule
|
|
109
|
+
* with a one-day span, because that is the one that runs forty-two times per
|
|
110
|
+
* calendar per render and it can answer without building either end.
|
|
111
|
+
*/
|
|
112
|
+
export declare function isUnitOutside(date: Date, unit: MPCalendarView, min?: Date | null, max?: Date | null): boolean;
|
|
74
113
|
/** Seconds since local midnight — what `minTime`/`maxTime` are compared on. */
|
|
75
114
|
export declare function secondsOfDay(date: Date): number;
|
|
76
115
|
/** Which column of a clock a candidate time is being offered for. */
|
|
@@ -127,16 +166,24 @@ export declare function displaySamples(locale: string | undefined, options: Intl
|
|
|
127
166
|
*/
|
|
128
167
|
export declare function withPlaceholder(samples: string[], placeholder: unknown): string[];
|
|
129
168
|
/**
|
|
130
|
-
* The
|
|
169
|
+
* The machine-readable spellings, for the hidden input that makes a picker
|
|
131
170
|
* submit with a form.
|
|
132
171
|
*
|
|
133
172
|
* Local, not UTC, and that is the whole point: `toISOString()` on a `Date`
|
|
134
173
|
* standing for 27 July in Seoul gives `2026-07-26T15:00:00Z`, and a form field
|
|
135
174
|
* that quietly reports the day before the one on screen is the single most
|
|
136
175
|
* expensive bug a date picker can ship. The shapes are the ones the native
|
|
137
|
-
* `<input type="date">`, `type="
|
|
138
|
-
* server that already parses those needs no
|
|
176
|
+
* `<input type="date">`, `type="month"`, `type="time"` and
|
|
177
|
+
* `type="datetime-local"` submit, so a server that already parses those needs no
|
|
178
|
+
* new code.
|
|
179
|
+
*
|
|
180
|
+
* A year on its own is the one with no input type behind it, and `YYYY` is what
|
|
181
|
+
* is left of the others once the parts a year picker was never asked about are
|
|
182
|
+
* taken off. Each spelling is built from the one above it, so there is one
|
|
183
|
+
* answer to how a year is written and not three.
|
|
139
184
|
*/
|
|
185
|
+
export declare function toISOYear(date: Date): string;
|
|
186
|
+
export declare function toISOMonth(date: Date): string;
|
|
140
187
|
export declare function toISODate(date: Date): string;
|
|
141
188
|
export declare function toISOTime(date: Date, withSeconds?: boolean): string;
|
|
142
189
|
export declare function toISODateTime(date: Date, withSeconds?: boolean): string;
|
package/dist/internal/date.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const YEAR_PAGE_SIZE=12;export function makeDate(t,e,r){const n=new Date(0);return n.setFullYear(t,e,r),n.setHours(0,0,0,0),n}export function isValidDate(t){return t instanceof Date&&!Number.isNaN(t.getTime())}export function startOfDay(t){const e=new Date(t.getTime());return e.setHours(0,0,0,0),e}export function startOfMonth(t){return makeDate(t.getFullYear(),t.getMonth(),1)}export function daysInMonth(t,e){return makeDate(t,e+1,0).getDate()}export function today(){return startOfDay(new Date)}export function addDays(t,e){const r=new Date(t.getTime());return r.setDate(r.getDate()+e),r}export function addMonths(t,e){const r=new Date(t.getTime()),n=makeDate(t.getFullYear(),t.getMonth()+e,1);return r.setFullYear(n.getFullYear(),n.getMonth(),Math.min(t.getDate(),daysInMonth(n.getFullYear(),n.getMonth()))),r}export function addYears(t,e){return addMonths(t,12*e)}export function compareDay(t,e){return startOfDay(t).getTime()-startOfDay(e).getTime()}export function isSameDay(t,e){return isValidDate(t)&&isValidDate(e)&&0===compareDay(t,e)}export function isSameMonth(t,e){return isValidDate(t)&&isValidDate(e)&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()}export function isDayOutside(t,e,r){return!!(isValidDate(e)&&compareDay(t,e)<0)||isValidDate(r)&&compareDay(t,r)>0}export function secondsOfDay(t){return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}export function timeUnitSpan(t,e){const r=secondsOfDay(e);if("hour"===t){const t=3600*Math.floor(r/3600);return[t,t+3599]}if("minute"===t){const t=60*Math.floor(r/60);return[t,t+59]}if("second"===t)return[r,r];const n=e.getHours()<12?0:43200;return[n,n+43200-1]}export function withTime(t,e){const r=new Date(t.getTime());return r.setHours(e.hours??r.getHours(),e.minutes??r.getMinutes(),e.seconds??r.getSeconds(),0),r}export function mergeDateAndTime(t,e){return withTime(startOfDay(t),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()})}export function calendarWeeks(t,e){const r=startOfMonth(t),n=(r.getDay()-e+7)%7,o=addDays(r,-n);return Array.from({length:6},(t,e)=>Array.from({length:7},(t,r)=>addDays(o,7*e+r)))}export function yearPageStart(t){return t-(t%12+12)%12}function t(t,e,r){if(t.set(e,r),t.size>64){const e=t.keys().next();e.done||t.delete(e.value)}return r}const e=new Map;export function dateFormatter(r,n){const o=`${r??""}\0${JSON.stringify(n)}`,a=e.get(o);return a||t(e,o,new Intl.DateTimeFormat(r,n))}export function formatDate(t,e,r){return isValidDate(t)?dateFormatter(e,r).format(t):""}const r=Array.from({length:24},(t,e)=>new Date(2027,e%12,21+e%7,e,58,58));export function displaySamples(t,e){const n=dateFormatter(t,e);return[...new Set(r.map(t=>n.format(t)))]}export function withPlaceholder(t,e){return"string"==typeof e&&""!==e?[...t,e]:t}export function
|
|
1
|
+
export const YEAR_PAGE_SIZE=12;export function makeDate(t,e,r){const n=new Date(0);return n.setFullYear(t,e,r),n.setHours(0,0,0,0),n}export function isValidDate(t){return t instanceof Date&&!Number.isNaN(t.getTime())}export function startOfDay(t){const e=new Date(t.getTime());return e.setHours(0,0,0,0),e}export function startOfMonth(t){return makeDate(t.getFullYear(),t.getMonth(),1)}export function startOfYear(t){return makeDate(t.getFullYear(),0,1)}export function daysInMonth(t,e){return makeDate(t,e+1,0).getDate()}export function startOfUnit(t,e){return"year"===e?startOfYear(t):"month"===e?startOfMonth(t):startOfDay(t)}export function endOfUnit(t,e){return"year"===e?makeDate(t.getFullYear(),11,31):"month"===e?makeDate(t.getFullYear(),t.getMonth()+1,0):startOfDay(t)}export function today(){return startOfDay(new Date)}export function addDays(t,e){const r=new Date(t.getTime());return r.setDate(r.getDate()+e),r}export function addMonths(t,e){const r=new Date(t.getTime()),n=makeDate(t.getFullYear(),t.getMonth()+e,1);return r.setFullYear(n.getFullYear(),n.getMonth(),Math.min(t.getDate(),daysInMonth(n.getFullYear(),n.getMonth()))),r}export function addYears(t,e){return addMonths(t,12*e)}export function compareDay(t,e){return startOfDay(t).getTime()-startOfDay(e).getTime()}export function isSameDay(t,e){return isValidDate(t)&&isValidDate(e)&&0===compareDay(t,e)}export function isSameMonth(t,e){return isValidDate(t)&&isValidDate(e)&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()}export function isDayOutside(t,e,r){return!!(isValidDate(e)&&compareDay(t,e)<0)||isValidDate(r)&&compareDay(t,r)>0}export function isUnitOutside(t,e,r,n){return"day"===e?isDayOutside(t,r,n):!!(isValidDate(r)&&compareDay(endOfUnit(t,e),r)<0)||isValidDate(n)&&compareDay(startOfUnit(t,e),n)>0}export function secondsOfDay(t){return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}export function timeUnitSpan(t,e){const r=secondsOfDay(e);if("hour"===t){const t=3600*Math.floor(r/3600);return[t,t+3599]}if("minute"===t){const t=60*Math.floor(r/60);return[t,t+59]}if("second"===t)return[r,r];const n=e.getHours()<12?0:43200;return[n,n+43200-1]}export function withTime(t,e){const r=new Date(t.getTime());return r.setHours(e.hours??r.getHours(),e.minutes??r.getMinutes(),e.seconds??r.getSeconds(),0),r}export function mergeDateAndTime(t,e){return withTime(startOfDay(t),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()})}export function calendarWeeks(t,e){const r=startOfMonth(t),n=(r.getDay()-e+7)%7,o=addDays(r,-n);return Array.from({length:6},(t,e)=>Array.from({length:7},(t,r)=>addDays(o,7*e+r)))}export function yearPageStart(t){return t-(t%12+12)%12}function t(t,e,r){if(t.set(e,r),t.size>64){const e=t.keys().next();e.done||t.delete(e.value)}return r}const e=new Map;export function dateFormatter(r,n){const o=`${r??""}\0${JSON.stringify(n)}`,a=e.get(o);return a||t(e,o,new Intl.DateTimeFormat(r,n))}export function formatDate(t,e,r){return isValidDate(t)?dateFormatter(e,r).format(t):""}const r=Array.from({length:24},(t,e)=>new Date(2027,e%12,21+e%7,e,58,58));export function displaySamples(t,e){const n=dateFormatter(t,e);return[...new Set(r.map(t=>n.format(t)))]}export function withPlaceholder(t,e){return"string"==typeof e&&""!==e?[...t,e]:t}export function toISOYear(t){return String(t.getFullYear()).padStart(4,"0")}export function toISOMonth(t){return`${toISOYear(t)}-${String(t.getMonth()+1).padStart(2,"0")}`}export function toISODate(t){return`${toISOMonth(t)}-${String(t.getDate()).padStart(2,"0")}`}export function toISOTime(t,e=!1){const r=t=>String(t).padStart(2,"0"),n=`${r(t.getHours())}:${r(t.getMinutes())}`;return e?`${n}:${r(t.getSeconds())}`:n}export function toISODateTime(t,e=!1){return`${toISODate(t)}T${toISOTime(t,e)}`}const n=makeDate(2021,7,1),o=new Map;export function weekdayLabels(e,r,a="narrow"){const i=`w ${e??""} ${r} ${a}`,u=o.get(i);if(u)return u;const s=dateFormatter(e,{weekday:a});return t(o,i,Array.from({length:7},(t,e)=>s.format(addDays(n,(r+e)%7))))}export function monthLabels(e,r="short"){const n=`m ${e??""} ${r}`,a=o.get(n);if(a)return a;const i=dateFormatter(e,{month:r});return t(o,n,Array.from({length:12},(t,e)=>i.format(makeDate(2021,e,1))))}export function isMonthBeforeYear(t){const e=dateFormatter(t,{year:"numeric",month:"long"}).formatToParts(n);return e.findIndex(t=>"month"===t.type)<e.findIndex(t=>"year"===t.type)}export function isHour12(t){const e=dateFormatter(t,{hour:"numeric"}).resolvedOptions();return e.hourCycle?"h11"===e.hourCycle||"h12"===e.hourCycle:!0===e.hour12}export function meridiemLabels(t){const e=dateFormatter(t,{hour:"numeric",hour12:!0}),r=t=>{const r=e.formatToParts(withTime(n,{hours:t})).find(t=>"dayPeriod"===t.type);return r?.value??(t<12?"AM":"PM")};return[r(9),r(21)]}export function localeWeekStart(t){try{const e=t??(new Intl.DateTimeFormat).resolvedOptions().locale,r=new Intl.Locale(e),n="function"==typeof r.getWeekInfo?r.getWeekInfo():r.weekInfo;if("number"==typeof n?.firstDay)return n.firstDay%7}catch{}return 0}
|
package/dist/internal/i18n.d.ts
CHANGED
|
@@ -137,8 +137,17 @@ export interface MPMessages {
|
|
|
137
137
|
/** The two header buttons that open the month grid and the year grid. */
|
|
138
138
|
chooseMonth: string;
|
|
139
139
|
chooseYear: string;
|
|
140
|
-
/**
|
|
140
|
+
/**
|
|
141
|
+
* The footer's actions.
|
|
142
|
+
*
|
|
143
|
+
* `today` has two coarser spellings rather than one word doing all three
|
|
144
|
+
* jobs: the shortcut lands on whatever unit the picker asks for, and a
|
|
145
|
+
* button that said *Today* on a year picker would be naming a day the
|
|
146
|
+
* control has no way to choose.
|
|
147
|
+
*/
|
|
141
148
|
today: string;
|
|
149
|
+
thisMonth: string;
|
|
150
|
+
thisYear: string;
|
|
142
151
|
now: string;
|
|
143
152
|
clear: string;
|
|
144
153
|
done: string;
|
|
@@ -431,6 +440,22 @@ export interface MPMessages {
|
|
|
431
440
|
/** What the trigger reads before anything has been chosen. */
|
|
432
441
|
empty: string;
|
|
433
442
|
};
|
|
443
|
+
/**
|
|
444
|
+
* The two buttons on a confirmation, and the one on an acknowledgement.
|
|
445
|
+
*
|
|
446
|
+
* A namespace of its own rather than three more entries in `common`, because
|
|
447
|
+
* `common` is the glyph labels — the × that is read out as *close* — and these
|
|
448
|
+
* are the words on the buttons themselves. A caller who wants *Delete* rather
|
|
449
|
+
* than *Confirm* passes a label; these are what is drawn when they do not.
|
|
450
|
+
*/
|
|
451
|
+
confirm: {
|
|
452
|
+
/** The button that says yes. */
|
|
453
|
+
confirm: string;
|
|
454
|
+
/** The button that says no, and what a dismissal counts as. */
|
|
455
|
+
cancel: string;
|
|
456
|
+
/** The single button on an acknowledgement, which has nothing to refuse. */
|
|
457
|
+
ok: string;
|
|
458
|
+
};
|
|
434
459
|
}
|
|
435
460
|
/** A translation may fill in as much or as little of the table as it has. */
|
|
436
461
|
export type MPPartialMessages = {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CONFIRM={name:"confirm",en:{confirm:"Confirm",cancel:"Cancel",ok:"OK"}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PICKER={name:"picker",en:{previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",today:"Today",now:"Now",clear:"Clear",done:"Done",hour:"Hour",minute:"Minute",second:"Second",meridiem:"AM/PM",start:"Start",end:"End"}};
|
|
1
|
+
export const PICKER={name:"picker",en:{previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",today:"Today",thisMonth:"This month",thisYear:"This year",now:"Now",clear:"Clear",done:"Done",hour:"Hour",minute:"Minute",second:"Second",meridiem:"AM/PM",start:"Start",end:"End"}};
|
|
@@ -43,6 +43,20 @@ export interface MPProgressProps {
|
|
|
43
43
|
max?: number;
|
|
44
44
|
/** A name for what is loading. Read out with the value by a screen reader. */
|
|
45
45
|
label?: React.ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* Keeps that name for a screen reader and takes it off the screen.
|
|
48
|
+
*
|
|
49
|
+
* For the indicator that is already labelled by what is around it — a spinner
|
|
50
|
+
* inside a card whose heading says what is loading, a bar under a filename.
|
|
51
|
+
* Drawing the name a second time is noise a sighted reader has to skip;
|
|
52
|
+
* *removing* it leaves a `progressbar` announced as "63%" and nothing else,
|
|
53
|
+
* which is a number with no subject.
|
|
54
|
+
*
|
|
55
|
+
* This is the third option, and it is the one the old `aria-label` was: the
|
|
56
|
+
* name stays in the accessibility tree and stops taking a line.
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
hideLabel?: boolean;
|
|
46
60
|
/**
|
|
47
61
|
* Shows the value as text beside the shape. A percentage of the range unless
|
|
48
62
|
* `format` says otherwise.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bullet, the connector and the ladder they are drawn on — written once for
|
|
3
|
+
* the two components that draw a numbered sequence.
|
|
4
|
+
*
|
|
5
|
+
* `MPTimeline` shows a sequence that **happened**; `MPStepper` drives one that
|
|
6
|
+
* is being **worked through**. They are two components because those are two
|
|
7
|
+
* jobs — one is read and the other is pressed — but they are the same picture,
|
|
8
|
+
* and a picture kept by two tables is a picture that drifts the first time one
|
|
9
|
+
* of them is edited alone. That is the argument `scale.ts` makes about the size
|
|
10
|
+
* ladder, applied to a smaller thing.
|
|
11
|
+
*
|
|
12
|
+
* What is *not* here is anything either one decides on its own: the timeline's
|
|
13
|
+
* `meta` line, the stepper's reachability. Those are not shared and putting them
|
|
14
|
+
* here would make this a third component nobody renders.
|
|
15
|
+
*/
|
|
16
|
+
import type { MPSize } from '../types.js';
|
|
17
|
+
/**
|
|
18
|
+
* How far a step has got.
|
|
19
|
+
*
|
|
20
|
+
* Three rather than more, and `error` is deliberately not among them —
|
|
21
|
+
* `MPStepper` draws a failed step by swapping the accent family for `error`,
|
|
22
|
+
* which is one axis rather than a fourth state every table below would have to
|
|
23
|
+
* grow a row for. The three are about *position in the sequence*; the colour is
|
|
24
|
+
* about what happened.
|
|
25
|
+
*/
|
|
26
|
+
export type MPStepStatus = 'complete' | 'current' | 'upcoming';
|
|
27
|
+
/** How the line between two steps is drawn. `none` leaves the gap open. */
|
|
28
|
+
export type MPStepConnector = 'solid' | 'dashed' | 'dotted' | 'none';
|
|
29
|
+
/**
|
|
30
|
+
* The bullet.
|
|
31
|
+
*
|
|
32
|
+
* Its own ladder rather than a step off `CONTROL_HEIGHT`, for the reason a
|
|
33
|
+
* checkbox's tick has one: a bullet is not a control you can put a label inside.
|
|
34
|
+
* It is a mark beside one, sized against the title next to it.
|
|
35
|
+
*
|
|
36
|
+
* It is written as a custom property rather than as a class because the
|
|
37
|
+
* connector has to know it: the line is centred on the bullet, and centring is
|
|
38
|
+
* arithmetic on this number.
|
|
39
|
+
*/
|
|
40
|
+
export declare const BULLET_SIZE: Record<MPSize, string>;
|
|
41
|
+
/** Between the bullet column and the content beside it. */
|
|
42
|
+
export declare const BULLET_GAP: Record<MPSize, string>;
|
|
43
|
+
/**
|
|
44
|
+
* How far apart two steps sit.
|
|
45
|
+
*
|
|
46
|
+
* The floor is set by the step with nothing in it. A step that is only a title
|
|
47
|
+
* and a time is one line tall, so the gap is the *whole* of what separates it
|
|
48
|
+
* from the next one — where a step with a paragraph under it has the paragraph's
|
|
49
|
+
* own leading working for it as well.
|
|
50
|
+
*/
|
|
51
|
+
export declare const ITEM_GAP: Record<MPSize, string>;
|
|
52
|
+
/** The same ladder across, for the horizontal form. */
|
|
53
|
+
export declare const ITEM_GAP_X: Record<MPSize, string>;
|
|
54
|
+
export declare const BORDER_STYLE: Record<MPStepConnector, string>;
|
|
55
|
+
/**
|
|
56
|
+
* The bullet at each of the three states.
|
|
57
|
+
*
|
|
58
|
+
* Every one of them is a different axis, never a different opacity: `complete`
|
|
59
|
+
* is filled with the accent under its own ink, `current` is the same fill with a
|
|
60
|
+
* halo of the container tone around it, and `upcoming` is a hairline ring on the
|
|
61
|
+
* page's own surface. A reader who cannot tell the colours apart still has a
|
|
62
|
+
* filled shape, a haloed shape and an empty one.
|
|
63
|
+
*/
|
|
64
|
+
export declare const BULLET: Record<MPStepStatus, string>;
|
|
65
|
+
/**
|
|
66
|
+
* The line *after* a step, which is what makes it the step's own property: a
|
|
67
|
+
* connector is coloured by whether the step it leaves has been reached, not by
|
|
68
|
+
* where it arrives.
|
|
69
|
+
*/
|
|
70
|
+
export declare const CONNECTOR_COLOR: Record<MPStepStatus, string>;
|
|
71
|
+
export declare const TITLE_COLOR: Record<MPStepStatus, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const BULLET_SIZE={xs:"0.875rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"1.875rem"};export const BULLET_GAP={xs:"gap-2",sm:"gap-2.5",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const ITEM_GAP={xs:"pb-5",sm:"pb-6",md:"pb-7",lg:"pb-8",xl:"pb-10"};export const ITEM_GAP_X={xs:"pe-5",sm:"pe-6",md:"pe-7",lg:"pe-8",xl:"pe-10"};export const BORDER_STYLE={solid:"border-solid",dashed:"border-dashed",dotted:"border-dotted",none:""};export const BULLET={complete:"bg-(--_mp-accent) text-(--_mp-on-accent)",current:"bg-(--_mp-accent) text-(--_mp-on-accent) shadow-[0_0_0_0.25rem_var(--_mp-accent-container)]",upcoming:"border-mp-outline text-mp-on-surface-variant border-2 bg-transparent"};export const CONNECTOR_COLOR={complete:"border-(--_mp-accent)",current:"border-mp-outline-variant",upcoming:"border-mp-outline-variant"};export const TITLE_COLOR={complete:"text-mp-on-surface",current:"text-(--_mp-accent)",upcoming:"text-mp-on-surface-variant"};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { MPWindowClass } from '../types.js';
|
|
2
|
+
/** Smallest first, which is also the order the media queries have to be in. */
|
|
3
|
+
export declare const WINDOW_CLASSES: readonly MPWindowClass[];
|
|
4
|
+
/**
|
|
5
|
+
* The width each class starts at, in CSS pixels.
|
|
6
|
+
*
|
|
7
|
+
* A class runs from its own entry up to the next one's, so the test is `>=` and
|
|
8
|
+
* the widest matching class wins. `compact` starts at zero because there is no
|
|
9
|
+
* window narrower than no window.
|
|
10
|
+
*/
|
|
11
|
+
export declare const WINDOW_MIN: Record<MPWindowClass, number>;
|
|
12
|
+
/** Which class a width falls in. Widest match wins. */
|
|
13
|
+
export declare function windowClassFor(width: number): MPWindowClass;
|
|
14
|
+
/**
|
|
15
|
+
* `useSyncExternalStore` rather than an effect and a `useState`, for the reason
|
|
16
|
+
* `useMPCollapsed` gives: the hook needs a **server snapshot**, and this is the
|
|
17
|
+
* one API that tells React the server's answer and the client's are meant to
|
|
18
|
+
* differ. An effect would render the wrong layout once and then correct it,
|
|
19
|
+
* which React would not know to expect.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useWindowClass(onServer: MPWindowClass): MPWindowClass;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import*as e from"react";export const WINDOW_CLASSES=["compact","medium","expanded","large","extra-large"];export const WINDOW_MIN={compact:0,medium:600,expanded:840,large:1200,"extra-large":1600};export function windowClassFor(e){let t="compact";for(const n of WINDOW_CLASSES)e>=WINDOW_MIN[n]&&(t=n);return t}let t=null;function n(){return"undefined"!=typeof window&&window.matchMedia?(t??=WINDOW_CLASSES.filter(e=>WINDOW_MIN[e]>0).map(e=>window.matchMedia(`(min-width: ${WINDOW_MIN[e]}px)`)),t):[]}function o(e){const t=n();for(const n of t)n.addEventListener("change",e);return()=>{for(const n of t)n.removeEventListener("change",e)}}export function useWindowClass(t){const r=e.useCallback(()=>function(e){const t=n();if(0===t.length)return e;let o="compact",r=0;for(const e of WINDOW_CLASSES)0!==WINDOW_MIN[e]&&(t[r]?.matches&&(o=e),r+=1);return o}(t),[t]);return e.useSyncExternalStore(o,r,r)}
|
package/dist/locales/ar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ar={locale:"ar",messages:{common:{close:"إغلاق",clear:"مسح",open:"فتح",remove:"إزالة",removeNamed:"إزالة {label}",loading:"جارٍ التحميل"},textField:{showPassword:"إظهار كلمة المرور",hidePassword:"إخفاء كلمة المرور"},empty:{title:"لا يوجد شيء هنا"},picker:{previousMonth:"الشهر السابق",nextMonth:"الشهر التالي",previousYear:"السنة السابقة",nextYear:"السنة التالية",previousYears:"السنوات السابقة",nextYears:"السنوات التالية",chooseMonth:"اختيار شهر",chooseYear:"اختيار سنة",today:"اليوم",now:"الآن",clear:"مسح",done:"تم",hour:"الساعة",minute:"الدقيقة",second:"الثانية",meridiem:"ص/م",start:"البداية",end:"النهاية"},numberField:{increase:"زيادة",decrease:"إنقاص"},carousel:{label:"عرض دوّار",previous:"الشريحة السابقة",next:"الشريحة التالية",slide:"الشريحة {index} من {total}"},breadcrumb:{label:"مسار التنقل",expand:"إظهار الخطوات المخفية"},combobox:{empty:"لا توجد نتائج",add:"إضافة ”{label}“"},table:{empty:"لا توجد بيانات"},filePicker:{prompt:"أفلِت الملفات هنا، أو انقر للاستعراض"},textLink:{newTab:"يُفتح في تبويب جديد"},overlay:{label:"طبقة تراكب"},alert:{dismiss:"إغلاق"},chat:{sending:"جارٍ الإرسال",sent:"تم الإرسال",delivered:"تم التسليم",read:"تمت القراءة",failed:"لم يتم الإرسال",typing:"يكتب الآن"},spoiler:{reveal:"إظهار",hide:"إخفاء",notice:"مخفي حتى لا يُقرأ بالخطأ"},pagination:{label:"ترقيم الصفحات",page:"الصفحة {page}",status:"الصفحة {page} من {total}",previous:"الصفحة السابقة",next:"الصفحة التالية",first:"الصفحة الأولى",last:"الصفحة الأخيرة"},rating:{label:"التقييم",value:"{value} من {max}",empty:"بدون تقييم"},colorPicker:{area:"التشبع والسطوع",hue:"درجة اللون",alpha:"العتامة",value:"قيمة اللون",swatches:"ألوان جاهزة",clear:"مسح",empty:"بلا لون"},transfer:{source:"المتاح",target:"المحدد",toTarget:"النقل إلى المحدد",toSource:"الإرجاع إلى المتاح",search:"بحث",empty:"لا شيء هنا"},command:{label:"لوحة الأوامر",search:"اكتب أمراً أو ابحث…",empty:"لا توجد أوامر مطابقة"},layout:{skipToContent:"تخطٍ إلى المحتوى",sidebar:"الشريط الجانبي",openSidebar:"فتح الشريط الجانبي",closeSidebar:"إغلاق الشريط الجانبي",resizeSidebar:"تغيير عرض الشريط الجانبي"}}};
|
|
1
|
+
export const ar={locale:"ar",messages:{common:{close:"إغلاق",clear:"مسح",open:"فتح",remove:"إزالة",removeNamed:"إزالة {label}",loading:"جارٍ التحميل"},textField:{showPassword:"إظهار كلمة المرور",hidePassword:"إخفاء كلمة المرور"},empty:{title:"لا يوجد شيء هنا"},picker:{previousMonth:"الشهر السابق",nextMonth:"الشهر التالي",previousYear:"السنة السابقة",nextYear:"السنة التالية",previousYears:"السنوات السابقة",nextYears:"السنوات التالية",chooseMonth:"اختيار شهر",chooseYear:"اختيار سنة",today:"اليوم",thisMonth:"هذا الشهر",thisYear:"هذه السنة",now:"الآن",clear:"مسح",done:"تم",hour:"الساعة",minute:"الدقيقة",second:"الثانية",meridiem:"ص/م",start:"البداية",end:"النهاية"},numberField:{increase:"زيادة",decrease:"إنقاص"},carousel:{label:"عرض دوّار",previous:"الشريحة السابقة",next:"الشريحة التالية",slide:"الشريحة {index} من {total}"},breadcrumb:{label:"مسار التنقل",expand:"إظهار الخطوات المخفية"},combobox:{empty:"لا توجد نتائج",add:"إضافة ”{label}“"},table:{empty:"لا توجد بيانات"},filePicker:{prompt:"أفلِت الملفات هنا، أو انقر للاستعراض"},textLink:{newTab:"يُفتح في تبويب جديد"},overlay:{label:"طبقة تراكب"},alert:{dismiss:"إغلاق"},chat:{sending:"جارٍ الإرسال",sent:"تم الإرسال",delivered:"تم التسليم",read:"تمت القراءة",failed:"لم يتم الإرسال",typing:"يكتب الآن"},spoiler:{reveal:"إظهار",hide:"إخفاء",notice:"مخفي حتى لا يُقرأ بالخطأ"},pagination:{label:"ترقيم الصفحات",page:"الصفحة {page}",status:"الصفحة {page} من {total}",previous:"الصفحة السابقة",next:"الصفحة التالية",first:"الصفحة الأولى",last:"الصفحة الأخيرة"},rating:{label:"التقييم",value:"{value} من {max}",empty:"بدون تقييم"},colorPicker:{area:"التشبع والسطوع",hue:"درجة اللون",alpha:"العتامة",value:"قيمة اللون",swatches:"ألوان جاهزة",clear:"مسح",empty:"بلا لون"},transfer:{source:"المتاح",target:"المحدد",toTarget:"النقل إلى المحدد",toSource:"الإرجاع إلى المتاح",search:"بحث",empty:"لا شيء هنا"},command:{label:"لوحة الأوامر",search:"اكتب أمراً أو ابحث…",empty:"لا توجد أوامر مطابقة"},layout:{skipToContent:"تخطٍ إلى المحتوى",sidebar:"الشريط الجانبي",openSidebar:"فتح الشريط الجانبي",closeSidebar:"إغلاق الشريط الجانبي",resizeSidebar:"تغيير عرض الشريط الجانبي"},confirm:{confirm:"تأكيد",cancel:"إلغاء",ok:"حسنًا"}}};
|
package/dist/locales/de.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const de={locale:"de",messages:{common:{close:"Schließen",clear:"Löschen",open:"Öffnen",remove:"Entfernen",removeNamed:"{label} entfernen",loading:"Wird geladen"},textField:{showPassword:"Passwort anzeigen",hidePassword:"Passwort verbergen"},empty:{title:"Nichts vorhanden"},picker:{previousMonth:"Voriger Monat",nextMonth:"Nächster Monat",previousYear:"Voriges Jahr",nextYear:"Nächstes Jahr",previousYears:"Vorige Jahre",nextYears:"Nächste Jahre",chooseMonth:"Monat auswählen",chooseYear:"Jahr auswählen",today:"Heute",now:"Jetzt",clear:"Löschen",done:"Fertig",hour:"Stunde",minute:"Minute",second:"Sekunde",meridiem:"AM/PM",start:"Beginn",end:"Ende"},numberField:{increase:"Erhöhen",decrease:"Verringern"},carousel:{label:"Karussell",previous:"Vorherige Folie",next:"Nächste Folie",slide:"Folie {index} von {total}"},breadcrumb:{label:"Brotkrümelnavigation",expand:"Ausgeblendete Schritte anzeigen"},combobox:{empty:"Keine Treffer",add:"„{label}“ hinzufügen"},table:{empty:"Keine Daten"},filePicker:{prompt:"Dateien hier ablegen oder zum Auswählen klicken"},textLink:{newTab:"Wird in einem neuen Tab geöffnet"},overlay:{label:"Overlay"},alert:{dismiss:"Schließen"},chat:{sending:"Wird gesendet",sent:"Gesendet",delivered:"Zugestellt",read:"Gelesen",failed:"Nicht gesendet",typing:"Schreibt"},spoiler:{reveal:"Anzeigen",hide:"Verbergen",notice:"Verborgen, damit es nicht versehentlich gelesen wird"},pagination:{label:"Seitennummerierung",page:"Seite {page}",status:"Seite {page} von {total}",previous:"Vorherige Seite",next:"Nächste Seite",first:"Erste Seite",last:"Letzte Seite"},rating:{label:"Bewertung",value:"{value} von {max}",empty:"Nicht bewertet"},colorPicker:{area:"Sättigung und Helligkeit",hue:"Farbton",alpha:"Deckkraft",value:"Farbwert",swatches:"Vorgegebene Farben",clear:"Löschen",empty:"Keine Farbe"},transfer:{source:"Verfügbar",target:"Ausgewählt",toTarget:"Zu Ausgewählt verschieben",toSource:"Zurück zu Verfügbar",search:"Suchen",empty:"Nichts vorhanden"},command:{label:"Befehlspalette",search:"Befehl eingeben oder suchen…",empty:"Keine Befehle gefunden"},layout:{skipToContent:"Zum Inhalt springen",sidebar:"Seitenleiste",openSidebar:"Seitenleiste öffnen",closeSidebar:"Seitenleiste schließen",resizeSidebar:"Seitenleiste anpassen"}}};
|
|
1
|
+
export const de={locale:"de",messages:{common:{close:"Schließen",clear:"Löschen",open:"Öffnen",remove:"Entfernen",removeNamed:"{label} entfernen",loading:"Wird geladen"},textField:{showPassword:"Passwort anzeigen",hidePassword:"Passwort verbergen"},empty:{title:"Nichts vorhanden"},picker:{previousMonth:"Voriger Monat",nextMonth:"Nächster Monat",previousYear:"Voriges Jahr",nextYear:"Nächstes Jahr",previousYears:"Vorige Jahre",nextYears:"Nächste Jahre",chooseMonth:"Monat auswählen",chooseYear:"Jahr auswählen",today:"Heute",thisMonth:"Dieser Monat",thisYear:"Dieses Jahr",now:"Jetzt",clear:"Löschen",done:"Fertig",hour:"Stunde",minute:"Minute",second:"Sekunde",meridiem:"AM/PM",start:"Beginn",end:"Ende"},numberField:{increase:"Erhöhen",decrease:"Verringern"},carousel:{label:"Karussell",previous:"Vorherige Folie",next:"Nächste Folie",slide:"Folie {index} von {total}"},breadcrumb:{label:"Brotkrümelnavigation",expand:"Ausgeblendete Schritte anzeigen"},combobox:{empty:"Keine Treffer",add:"„{label}“ hinzufügen"},table:{empty:"Keine Daten"},filePicker:{prompt:"Dateien hier ablegen oder zum Auswählen klicken"},textLink:{newTab:"Wird in einem neuen Tab geöffnet"},overlay:{label:"Overlay"},alert:{dismiss:"Schließen"},chat:{sending:"Wird gesendet",sent:"Gesendet",delivered:"Zugestellt",read:"Gelesen",failed:"Nicht gesendet",typing:"Schreibt"},spoiler:{reveal:"Anzeigen",hide:"Verbergen",notice:"Verborgen, damit es nicht versehentlich gelesen wird"},pagination:{label:"Seitennummerierung",page:"Seite {page}",status:"Seite {page} von {total}",previous:"Vorherige Seite",next:"Nächste Seite",first:"Erste Seite",last:"Letzte Seite"},rating:{label:"Bewertung",value:"{value} von {max}",empty:"Nicht bewertet"},colorPicker:{area:"Sättigung und Helligkeit",hue:"Farbton",alpha:"Deckkraft",value:"Farbwert",swatches:"Vorgegebene Farben",clear:"Löschen",empty:"Keine Farbe"},transfer:{source:"Verfügbar",target:"Ausgewählt",toTarget:"Zu Ausgewählt verschieben",toSource:"Zurück zu Verfügbar",search:"Suchen",empty:"Nichts vorhanden"},command:{label:"Befehlspalette",search:"Befehl eingeben oder suchen…",empty:"Keine Befehle gefunden"},layout:{skipToContent:"Zum Inhalt springen",sidebar:"Seitenleiste",openSidebar:"Seitenleiste öffnen",closeSidebar:"Seitenleiste schließen",resizeSidebar:"Seitenleiste anpassen"},confirm:{confirm:"Bestätigen",cancel:"Abbrechen",ok:"OK"}}};
|
package/dist/locales/es.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const es={locale:"es",messages:{common:{close:"Cerrar",clear:"Borrar",open:"Abrir",remove:"Quitar",removeNamed:"Quitar {label}",loading:"Cargando"},textField:{showPassword:"Mostrar la contraseña",hidePassword:"Ocultar la contraseña"},empty:{title:"No hay nada aquí"},picker:{previousMonth:"Mes anterior",nextMonth:"Mes siguiente",previousYear:"Año anterior",nextYear:"Año siguiente",previousYears:"Años anteriores",nextYears:"Años siguientes",chooseMonth:"Elegir un mes",chooseYear:"Elegir un año",today:"Hoy",now:"Ahora",clear:"Borrar",done:"Listo",hour:"Hora",minute:"Minuto",second:"Segundo",meridiem:"a. m./p. m.",start:"Inicio",end:"Fin"},numberField:{increase:"Aumentar",decrease:"Disminuir"},carousel:{label:"Carrusel",previous:"Diapositiva anterior",next:"Diapositiva siguiente",slide:"Diapositiva {index} de {total}"},breadcrumb:{label:"Ruta de navegación",expand:"Mostrar los pasos ocultos"},combobox:{empty:"Sin coincidencias",add:"Añadir «{label}»"},table:{empty:"Sin datos"},filePicker:{prompt:"Suelta los archivos aquí o haz clic para buscarlos"},textLink:{newTab:"Se abre en una pestaña nueva"},overlay:{label:"Superposición"},alert:{dismiss:"Cerrar"},chat:{sending:"Enviando",sent:"Enviado",delivered:"Entregado",read:"Leído",failed:"No enviado",typing:"Escribiendo"},spoiler:{reveal:"Mostrar",hide:"Ocultar",notice:"Oculto para que no se lea por accidente"},pagination:{label:"Paginación",page:"Página {page}",status:"Página {page} de {total}",previous:"Página anterior",next:"Página siguiente",first:"Primera página",last:"Última página"},rating:{label:"Valoración",value:"{value} de {max}",empty:"Sin valorar"},colorPicker:{area:"Saturación y brillo",hue:"Tono",alpha:"Opacidad",value:"Valor del color",swatches:"Colores predefinidos",clear:"Borrar",empty:"Sin color"},transfer:{source:"Disponibles",target:"Seleccionados",toTarget:"Mover a seleccionados",toSource:"Devolver a disponibles",search:"Buscar",empty:"No hay nada"},command:{label:"Paleta de comandos",search:"Escribe un comando o busca…",empty:"No se encontraron comandos"},layout:{skipToContent:"Saltar al contenido",sidebar:"Barra lateral",openSidebar:"Abrir barra lateral",closeSidebar:"Cerrar barra lateral",resizeSidebar:"Cambiar el ancho de la barra lateral"}}};
|
|
1
|
+
export const es={locale:"es",messages:{common:{close:"Cerrar",clear:"Borrar",open:"Abrir",remove:"Quitar",removeNamed:"Quitar {label}",loading:"Cargando"},textField:{showPassword:"Mostrar la contraseña",hidePassword:"Ocultar la contraseña"},empty:{title:"No hay nada aquí"},picker:{previousMonth:"Mes anterior",nextMonth:"Mes siguiente",previousYear:"Año anterior",nextYear:"Año siguiente",previousYears:"Años anteriores",nextYears:"Años siguientes",chooseMonth:"Elegir un mes",chooseYear:"Elegir un año",today:"Hoy",thisMonth:"Este mes",thisYear:"Este año",now:"Ahora",clear:"Borrar",done:"Listo",hour:"Hora",minute:"Minuto",second:"Segundo",meridiem:"a. m./p. m.",start:"Inicio",end:"Fin"},numberField:{increase:"Aumentar",decrease:"Disminuir"},carousel:{label:"Carrusel",previous:"Diapositiva anterior",next:"Diapositiva siguiente",slide:"Diapositiva {index} de {total}"},breadcrumb:{label:"Ruta de navegación",expand:"Mostrar los pasos ocultos"},combobox:{empty:"Sin coincidencias",add:"Añadir «{label}»"},table:{empty:"Sin datos"},filePicker:{prompt:"Suelta los archivos aquí o haz clic para buscarlos"},textLink:{newTab:"Se abre en una pestaña nueva"},overlay:{label:"Superposición"},alert:{dismiss:"Cerrar"},chat:{sending:"Enviando",sent:"Enviado",delivered:"Entregado",read:"Leído",failed:"No enviado",typing:"Escribiendo"},spoiler:{reveal:"Mostrar",hide:"Ocultar",notice:"Oculto para que no se lea por accidente"},pagination:{label:"Paginación",page:"Página {page}",status:"Página {page} de {total}",previous:"Página anterior",next:"Página siguiente",first:"Primera página",last:"Última página"},rating:{label:"Valoración",value:"{value} de {max}",empty:"Sin valorar"},colorPicker:{area:"Saturación y brillo",hue:"Tono",alpha:"Opacidad",value:"Valor del color",swatches:"Colores predefinidos",clear:"Borrar",empty:"Sin color"},transfer:{source:"Disponibles",target:"Seleccionados",toTarget:"Mover a seleccionados",toSource:"Devolver a disponibles",search:"Buscar",empty:"No hay nada"},command:{label:"Paleta de comandos",search:"Escribe un comando o busca…",empty:"No se encontraron comandos"},layout:{skipToContent:"Saltar al contenido",sidebar:"Barra lateral",openSidebar:"Abrir barra lateral",closeSidebar:"Cerrar barra lateral",resizeSidebar:"Cambiar el ancho de la barra lateral"},confirm:{confirm:"Confirmar",cancel:"Cancelar",ok:"Aceptar"}}};
|
package/dist/locales/fr.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const fr={locale:"fr",messages:{common:{close:"Fermer",clear:"Effacer",open:"Ouvrir",remove:"Supprimer",removeNamed:"Supprimer {label}",loading:"Chargement"},textField:{showPassword:"Afficher le mot de passe",hidePassword:"Masquer le mot de passe"},empty:{title:"Il n'y a rien ici"},picker:{previousMonth:"Mois précédent",nextMonth:"Mois suivant",previousYear:"Année précédente",nextYear:"Année suivante",previousYears:"Années précédentes",nextYears:"Années suivantes",chooseMonth:"Choisir un mois",chooseYear:"Choisir une année",today:"Aujourd'hui",now:"Maintenant",clear:"Effacer",done:"Terminé",hour:"Heure",minute:"Minute",second:"Seconde",meridiem:"AM/PM",start:"Début",end:"Fin"},numberField:{increase:"Augmenter",decrease:"Diminuer"},carousel:{label:"Carrousel",previous:"Diapositive précédente",next:"Diapositive suivante",slide:"Diapositive {index} sur {total}"},breadcrumb:{label:"Fil d’Ariane",expand:"Afficher les étapes masquées"},combobox:{empty:"Aucun résultat",add:"Ajouter « {label} »"},table:{empty:"Aucune donnée"},filePicker:{prompt:"Déposez les fichiers ici, ou cliquez pour parcourir"},textLink:{newTab:"S’ouvre dans un nouvel onglet"},overlay:{label:"Superposition"},alert:{dismiss:"Fermer"},chat:{sending:"Envoi en cours",sent:"Envoyé",delivered:"Distribué",read:"Lu",failed:"Non envoyé",typing:"En train d'écrire"},spoiler:{reveal:"Afficher",hide:"Masquer",notice:"Masqué pour ne pas être lu par accident"},pagination:{label:"Pagination",page:"Page {page}",status:"Page {page} sur {total}",previous:"Page précédente",next:"Page suivante",first:"Première page",last:"Dernière page"},rating:{label:"Note",value:"{value} sur {max}",empty:"Non noté"},colorPicker:{area:"Saturation et luminosité",hue:"Teinte",alpha:"Opacité",value:"Valeur de la couleur",swatches:"Couleurs prédéfinies",clear:"Effacer",empty:"Aucune couleur"},transfer:{source:"Disponibles",target:"Sélectionnés",toTarget:"Déplacer vers les sélectionnés",toSource:"Renvoyer vers les disponibles",search:"Rechercher",empty:"Rien ici"},command:{label:"Palette de commandes",search:"Tapez une commande ou recherchez…",empty:"Aucune commande trouvée"},layout:{skipToContent:"Aller au contenu",sidebar:"Barre latérale",openSidebar:"Ouvrir la barre latérale",closeSidebar:"Fermer la barre latérale",resizeSidebar:"Redimensionner la barre latérale"}}};
|
|
1
|
+
export const fr={locale:"fr",messages:{common:{close:"Fermer",clear:"Effacer",open:"Ouvrir",remove:"Supprimer",removeNamed:"Supprimer {label}",loading:"Chargement"},textField:{showPassword:"Afficher le mot de passe",hidePassword:"Masquer le mot de passe"},empty:{title:"Il n'y a rien ici"},picker:{previousMonth:"Mois précédent",nextMonth:"Mois suivant",previousYear:"Année précédente",nextYear:"Année suivante",previousYears:"Années précédentes",nextYears:"Années suivantes",chooseMonth:"Choisir un mois",chooseYear:"Choisir une année",today:"Aujourd'hui",thisMonth:"Ce mois-ci",thisYear:"Cette année",now:"Maintenant",clear:"Effacer",done:"Terminé",hour:"Heure",minute:"Minute",second:"Seconde",meridiem:"AM/PM",start:"Début",end:"Fin"},numberField:{increase:"Augmenter",decrease:"Diminuer"},carousel:{label:"Carrousel",previous:"Diapositive précédente",next:"Diapositive suivante",slide:"Diapositive {index} sur {total}"},breadcrumb:{label:"Fil d’Ariane",expand:"Afficher les étapes masquées"},combobox:{empty:"Aucun résultat",add:"Ajouter « {label} »"},table:{empty:"Aucune donnée"},filePicker:{prompt:"Déposez les fichiers ici, ou cliquez pour parcourir"},textLink:{newTab:"S’ouvre dans un nouvel onglet"},overlay:{label:"Superposition"},alert:{dismiss:"Fermer"},chat:{sending:"Envoi en cours",sent:"Envoyé",delivered:"Distribué",read:"Lu",failed:"Non envoyé",typing:"En train d'écrire"},spoiler:{reveal:"Afficher",hide:"Masquer",notice:"Masqué pour ne pas être lu par accident"},pagination:{label:"Pagination",page:"Page {page}",status:"Page {page} sur {total}",previous:"Page précédente",next:"Page suivante",first:"Première page",last:"Dernière page"},rating:{label:"Note",value:"{value} sur {max}",empty:"Non noté"},colorPicker:{area:"Saturation et luminosité",hue:"Teinte",alpha:"Opacité",value:"Valeur de la couleur",swatches:"Couleurs prédéfinies",clear:"Effacer",empty:"Aucune couleur"},transfer:{source:"Disponibles",target:"Sélectionnés",toTarget:"Déplacer vers les sélectionnés",toSource:"Renvoyer vers les disponibles",search:"Rechercher",empty:"Rien ici"},command:{label:"Palette de commandes",search:"Tapez une commande ou recherchez…",empty:"Aucune commande trouvée"},layout:{skipToContent:"Aller au contenu",sidebar:"Barre latérale",openSidebar:"Ouvrir la barre latérale",closeSidebar:"Fermer la barre latérale",resizeSidebar:"Redimensionner la barre latérale"},confirm:{confirm:"Confirmer",cancel:"Annuler",ok:"OK"}}};
|