material-plus-ui 1.1.0 → 1.3.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/README.md +21 -1
- package/dist/components/accordion/MPAccordion.js +1 -1
- package/dist/components/alert/MPAlert.js +1 -1
- package/dist/components/animate-appear/MPAnimateAppear.js +1 -1
- package/dist/components/animate-blink/MPAnimateBlink.js +1 -1
- package/dist/components/animate-fade/MPAnimateFade.js +1 -1
- package/dist/components/animate-grow/MPAnimateGrow.js +1 -1
- package/dist/components/animate-headline/MPAnimateHeadline.js +1 -1
- package/dist/components/animate-lighting/MPAnimateLighting.js +1 -1
- package/dist/components/animate-marquee/MPAnimateMarquee.js +1 -1
- package/dist/components/animate-rotate/MPAnimateRotate.js +1 -1
- package/dist/components/animate-slide/MPAnimateSlide.js +1 -1
- package/dist/components/animate-typing/MPAnimateTyping.js +1 -1
- package/dist/components/animate-zoom/MPAnimateZoom.js +1 -1
- package/dist/components/aspect-ratio/MPAspectRatio.js +1 -1
- package/dist/components/avatar/MPAvatar.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.js +1 -1
- package/dist/components/box/MPBox.js +1 -1
- package/dist/components/breadcrumb/MPBreadcrumb.js +1 -1
- package/dist/components/button/MPButton.js +1 -1
- package/dist/components/button-group/MPButtonGroup.js +1 -1
- 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.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.js +1 -1
- package/dist/components/container/MPContainer.js +1 -1
- package/dist/components/date-picker/MPDatePicker.js +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.js +1 -1
- package/dist/components/divider/MPDivider.js +1 -1
- package/dist/components/drawer/MPDrawer.d.ts +25 -6
- 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/grid/MPGrid.js +1 -1
- package/dist/components/highlight/MPHighlight.js +1 -1
- package/dist/components/icon/MPIcon.js +1 -1
- package/dist/components/icon-button/MPIconButton.js +1 -1
- package/dist/components/list/MPList.js +1 -1
- package/dist/components/otp-field/MPOtpField.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/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.js +1 -1
- package/dist/components/shortcut/MPShortcut.js +1 -1
- package/dist/components/skeleton/MPSkeleton.js +1 -1
- package/dist/components/slider/MPSlider.js +1 -1
- package/dist/components/snackbar/MPSnackbar.js +1 -1
- package/dist/components/spoiler/MPSpoiler.js +1 -1
- package/dist/components/switch/MPSwitch.js +1 -1
- package/dist/components/tabs/MPTabs.js +1 -1
- package/dist/components/text-field/MPTextField.js +1 -1
- package/dist/components/text-link/MPTextLink.js +1 -1
- package/dist/components/time-picker/MPTimePicker.js +1 -1
- package/dist/components/timeline/MPTimeline.js +1 -1
- package/dist/components/typography/MPTypography.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/internal/Calendar.js +1 -1
- package/dist/internal/button-group.js +1 -1
- package/dist/internal/i18n.d.ts +64 -3
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/locale.js +1 -1
- package/dist/internal/menu.js +1 -1
- package/dist/internal/surface.d.ts +42 -12
- package/dist/internal/surface.js +1 -1
- package/dist/locales/ar.d.ts +17 -0
- package/dist/locales/ar.js +1 -0
- package/dist/locales/de.d.ts +17 -0
- package/dist/locales/de.js +1 -0
- package/dist/locales/es.d.ts +17 -0
- package/dist/locales/es.js +1 -0
- package/dist/locales/fr.d.ts +17 -0
- package/dist/locales/fr.js +1 -0
- package/dist/locales/hi.d.ts +17 -0
- package/dist/locales/hi.js +1 -0
- package/dist/locales/id.d.ts +17 -0
- package/dist/locales/id.js +1 -0
- package/dist/locales/index.d.ts +89 -0
- package/dist/locales/index.js +1 -0
- package/dist/locales/it.d.ts +17 -0
- package/dist/locales/it.js +1 -0
- package/dist/locales/ja.d.ts +17 -0
- package/dist/locales/ja.js +1 -0
- package/dist/locales/ko.d.ts +17 -0
- package/dist/locales/ko.js +1 -0
- package/dist/locales/nl.d.ts +17 -0
- package/dist/locales/nl.js +1 -0
- package/dist/locales/pl.d.ts +17 -0
- package/dist/locales/pl.js +1 -0
- package/dist/locales/pt.d.ts +17 -0
- package/dist/locales/pt.js +1 -0
- package/dist/locales/ru.d.ts +17 -0
- package/dist/locales/ru.js +1 -0
- package/dist/locales/th.d.ts +17 -0
- package/dist/locales/th.js +1 -0
- package/dist/locales/tr.d.ts +17 -0
- package/dist/locales/tr.js +1 -0
- package/dist/locales/vi.d.ts +17 -0
- package/dist/locales/vi.js +1 -0
- package/dist/locales/zh-hans.d.ts +21 -0
- package/dist/locales/zh-hans.js +1 -0
- package/dist/locales/zh-hant.d.ts +20 -0
- package/dist/locales/zh-hant.js +1 -0
- package/dist/styles/accordion.css +2 -0
- package/dist/styles/alert.css +2 -0
- package/dist/styles/animate-appear.css +2 -0
- package/dist/styles/animate-blink.css +2 -0
- package/dist/styles/animate-fade.css +2 -0
- package/dist/styles/animate-grow.css +2 -0
- package/dist/styles/animate-headline.css +2 -0
- package/dist/styles/animate-lighting.css +2 -0
- package/dist/styles/animate-marquee.css +2 -0
- package/dist/styles/animate-rotate.css +2 -0
- package/dist/styles/animate-slide.css +2 -0
- package/dist/styles/animate-typing.css +2 -0
- package/dist/styles/animate-zoom.css +2 -0
- package/dist/styles/aspect-ratio.css +2 -0
- package/dist/styles/avatar.css +2 -0
- package/dist/styles/badge.css +2 -0
- package/dist/styles/blockquote.css +2 -0
- package/dist/styles/bottom-navigation.css +2 -0
- package/dist/styles/box.css +2 -0
- package/dist/styles/breadcrumb.css +2 -0
- package/dist/styles/button-group.css +2 -0
- package/dist/styles/button.css +2 -0
- package/dist/styles/card.css +2 -0
- package/dist/styles/carousel.css +2 -0
- package/dist/styles/chat-bubble.css +2 -0
- package/dist/styles/checkbox.css +2 -0
- package/dist/styles/chip.css +2 -0
- package/dist/styles/collapsible.css +2 -0
- package/dist/styles/color-picker.css +2 -0
- package/dist/styles/combobox.css +2 -0
- package/dist/styles/container.css +2 -0
- package/dist/styles/date-picker.css +2 -0
- package/dist/styles/date-range-picker.css +2 -0
- package/dist/styles/date-time-picker.css +2 -0
- package/dist/styles/dialog.css +2 -0
- package/dist/styles/divider.css +2 -0
- package/dist/styles/drawer.css +2 -0
- package/dist/styles/empty.css +2 -0
- package/dist/styles/file-picker.css +2 -0
- package/dist/styles/floating-action-button.css +2 -0
- package/dist/styles/grid.css +2 -0
- package/dist/styles/highlight.css +2 -0
- package/dist/styles/icon-button.css +2 -0
- package/dist/styles/icon.css +2 -0
- package/dist/styles/list.css +2 -0
- package/dist/styles/locale.css +2 -0
- package/dist/styles/menu.css +2 -0
- package/dist/styles/number-field.css +2 -0
- package/dist/styles/otp-field.css +2 -0
- package/dist/styles/overlay.css +2 -0
- package/dist/styles/pagination.css +2 -0
- package/dist/styles/panes.css +2 -0
- package/dist/styles/pill.css +2 -0
- package/dist/styles/popover.css +2 -0
- package/dist/styles/progress-box.css +2 -0
- package/dist/styles/progress-circular.css +2 -0
- package/dist/styles/progress-linear.css +2 -0
- package/dist/styles/radio-group.css +2 -0
- package/dist/styles/rating.css +2 -0
- package/dist/styles/segmented-button.css +2 -0
- package/dist/styles/select.css +2 -0
- package/dist/styles/shortcut.css +2 -0
- package/dist/styles/skeleton.css +2 -0
- package/dist/styles/slider.css +2 -0
- package/dist/styles/snackbar.css +2 -0
- package/dist/styles/spoiler.css +2 -0
- package/dist/styles/switch.css +2 -0
- package/dist/styles/table.css +2 -0
- package/dist/styles/tabs.css +2 -0
- package/dist/styles/text-field.css +2 -0
- package/dist/styles/text-link.css +2 -0
- package/dist/styles/time-picker.css +2 -0
- package/dist/styles/timeline.css +2 -0
- package/dist/styles/tokens.css +2 -0
- package/dist/styles/tooltip.css +2 -0
- package/dist/styles/typography.css +2 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +55 -5
- package/package.json +31 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{Select as n}from"@base-ui/react/select";import{Field as r}from"@base-ui/react/field";import{MPIcon as i}from"../icon/MPIcon";import{CheckIcon as l,ChevronDownIcon as o}from"../../constants/icons";import{MPFieldLabel as s,MPFieldOutline as d,useFloatingLabel as c}from"../../internal/FieldOutline";import{
|
|
1
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{Select as n}from"@base-ui/react/select";import{Field as r}from"@base-ui/react/field";import{MPIcon as i}from"../icon/MPIcon";import{CheckIcon as l,ChevronDownIcon as o}from"../../constants/icons";import{MPFieldLabel as s,MPFieldOutline as d,useFloatingLabel as c}from"../../internal/FieldOutline";import{MPStateLayer as m}from"../../internal/StateLayer";import{MPSupportingText as p}from"../../internal/SupportingText";import{CONTROL_ICON as u,PROSE_TEXT as f,hasContent as h}from"../../internal/scale";import{FADE as g,PORTAL_LAYER as x}from"../../internal/surface";const v={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 MPSelect=/*@__PURE__*/t.forwardRef(function({items:b,value:N,defaultValue:y,onValueChange:j,placeholder:w,label:I,floatingLabel:S=!0,description:k,errorMessage:z,startIcon:P,size:M="md",fullWidth:O=!1,required:V=!1,disabled:q=!1,readOnly:T=!1,name:_,id:C},L){const R=h(z),F=v[M],W=t.useId(),B=C??W,[A,D]=t.useState(y??null),[E,G]=t.useState(!1),H=void 0===N?A:N,{shrunk:J,focusProps:K}=c({floating:S&&h(I),filled:null!==H&&""!==H,pinned:E||!!P}),Q=t.useMemo(()=>b.map(e=>({label:e.label??String(e.value),value:e.value})),[b]);return a(r.Root,{className:["mp-select group flex-col align-top",O?"flex w-full":"inline-flex w-fit"].join(" "),disabled:q,invalid:R,"data-mp-size":M,...K,children:[a(n.Root,{id:B,name:_,items:Q,value:N,defaultValue:y,onValueChange:e=>{D(e??null),j?.(e??null)},onOpenChange:G,disabled:q,readOnly:T,required:V,children:[a("div",{className:"relative w-full",children:[a(n.Trigger,{ref:L,className:["relative flex w-full items-center gap-2 select-none","appearance-none bg-transparent font-[inherit] outline-none",F.padding,F.height,f[M],q?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface "+(T?"cursor-default":"cursor-pointer")].join(" "),children:[P?e("span",{className:["flex shrink-0 items-center",q?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:P}):null,e(n.Value,{className:["min-w-0 flex-1 truncate text-start","data-placeholder:text-mp-on-surface-variant",q?"data-placeholder:text-mp-on-surface/38":""].filter(Boolean).join(" "),placeholder:J?w:void 0}),e(n.Icon,{className:["flex shrink-0 items-center","transition-transform duration-(--mp-sys-motion-duration-short4)","data-popup-open:rotate-180",q?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:e(i,{icon:o,size:u[M]})})]}),e(d,{label:I,required:V,notched:J}),h(I)?e(s,{size:M,label:I,required:V,htmlFor:B,shrunk:J}):null]}),e(n.Portal,{children:e(n.Positioner,{className:x,sideOffset:4,alignItemWithTrigger:!1,children:e(n.Popup,{className:["mp-select__popup rounded-mp-xs shadow-mp-2 bg-mp-surface-container p-2","text-mp-on-surface min-w-[var(--anchor-width)] outline-none",f[M],g].join(" "),children:e(n.List,{className:"max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain",children:b.map(t=>a(n.Item,{value:t.value,disabled:t.disabled,className:["mp-select__item group rounded-mp-xs relative flex cursor-pointer items-center","gap-3 py-2 pe-3 ps-2 select-none outline-none","transition-[background-color,color]","duration-(--mp-sys-motion-duration-short4)","data-selected:text-mp-on-secondary-container","data-selected:bg-mp-secondary-container","data-disabled:text-mp-on-surface/38 data-disabled:cursor-default"].join(" "),children:[e(m,{className:"group-data-highlighted:opacity-8 group-data-disabled:opacity-0"}),e("span",{className:"flex size-5 shrink-0 items-center justify-center",children:e(n.ItemIndicator,{children:e(i,{icon:l,size:18})})}),e(n.ItemText,{className:"min-w-0 flex-1 truncate",children:t.label??String(t.value)})]},String(t.value)))})})})})]}),e(p,{description:k,errorMessage:z,className:F.padding})]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as n,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{accentSlots as o}from"../../internal/accent";import{VISUALLY_HIDDEN as r}from"../../internal/visually-hidden";const m=e=>({symbol:e,name:e}),l={mod:{mac:{symbol:"⌘",name:"Command"},windows:m("Ctrl"),linux:m("Ctrl")},meta:{mac:{symbol:"⌘",name:"Command"},windows:m("Win"),linux:m("Super")},ctrl:{mac:{symbol:"⌃",name:"Control"},windows:m("Ctrl"),linux:m("Ctrl")},alt:{mac:{symbol:"⌥",name:"Option"},windows:m("Alt"),linux:m("Alt")},shift:{mac:{symbol:"⇧",name:"Shift"},windows:m("Shift"),linux:m("Shift")},enter:{mac:{symbol:"↩",name:"Enter"},windows:m("Enter"),linux:m("Enter")},tab:{mac:{symbol:"⇥",name:"Tab"},windows:m("Tab"),linux:m("Tab")},escape:{mac:{symbol:"⎋",name:"Escape"},windows:m("Esc"),linux:m("Esc")},backspace:{mac:{symbol:"⌫",name:"Backspace"},windows:m("Backspace"),linux:m("Backspace")},delete:{mac:{symbol:"⌦",name:"Delete"},windows:m("Del"),linux:m("Del")},capslock:{mac:{symbol:"⇪",name:"Caps Lock"},windows:m("Caps Lock"),linux:m("Caps Lock")}},s={cmdorctrl:"mod",commandorcontrol:"mod",cmd:"meta",command:"meta",super:"meta",win:"meta",windows:"meta",control:"ctrl",option:"alt",opt:"alt",return:"enter",esc:"escape",del:"delete",caps:"capslock"},i={up:{symbol:"↑",name:"Arrow up"},down:{symbol:"↓",name:"Arrow down"},left:{symbol:"←",name:"Arrow left"},right:{symbol:"→",name:"Arrow right"},arrowup:{symbol:"↑",name:"Arrow up"},arrowdown:{symbol:"↓",name:"Arrow down"},arrowleft:{symbol:"←",name:"Arrow left"},arrowright:{symbol:"→",name:"Arrow right"}};function c(){if("undefined"==typeof navigator)return"windows";const e=navigator.userAgentData,n=`${e?.platform??""} ${navigator.platform??""} ${navigator.userAgent??""}`;return/mac|iphone|ipad|ipod/i.test(n)?"mac":/win/i.test(n)?"windows":"linux"}function d(){return()=>{}}function p(){return"windows"}const u={xs:"h-5",sm:"h-6",md:"h-8",lg:"h-10",xl:"h-12"},w={xs:"min-w-5",sm:"min-w-6",md:"min-w-8",lg:"min-w-10",xl:"min-w-12"},x={xs:"text-mp-label-small",sm:"text-mp-label-medium",md:"text-mp-label-large",lg:"text-mp-label-large",xl:"text-mp-title-medium"},f={xs:"px-1",sm:"px-1.5",md:"px-2",lg:"px-2.5",xl:"px-3"},b={xs:"rounded-mp-xs",sm:"rounded-mp-xs",md:"rounded-mp-sm",lg:"rounded-mp-sm",xl:"rounded-mp-md"},y={filled:"bg-(--_mp-accent) text-(--_mp-on-accent)",tonal:"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)",elevated:"shadow-mp-1 bg-mp-surface-container-low text-mp-on-surface-variant",outlined:"border-mp-outline-variant text-mp-on-surface-variant border bg-transparent",text:"text-mp-on-surface-variant bg-mp-surface-container"};export const MPShortcut
|
|
1
|
+
import{jsx as e,Fragment as n,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{accentSlots as o}from"../../internal/accent";import{VISUALLY_HIDDEN as r}from"../../internal/visually-hidden";const m=e=>({symbol:e,name:e}),l={mod:{mac:{symbol:"⌘",name:"Command"},windows:m("Ctrl"),linux:m("Ctrl")},meta:{mac:{symbol:"⌘",name:"Command"},windows:m("Win"),linux:m("Super")},ctrl:{mac:{symbol:"⌃",name:"Control"},windows:m("Ctrl"),linux:m("Ctrl")},alt:{mac:{symbol:"⌥",name:"Option"},windows:m("Alt"),linux:m("Alt")},shift:{mac:{symbol:"⇧",name:"Shift"},windows:m("Shift"),linux:m("Shift")},enter:{mac:{symbol:"↩",name:"Enter"},windows:m("Enter"),linux:m("Enter")},tab:{mac:{symbol:"⇥",name:"Tab"},windows:m("Tab"),linux:m("Tab")},escape:{mac:{symbol:"⎋",name:"Escape"},windows:m("Esc"),linux:m("Esc")},backspace:{mac:{symbol:"⌫",name:"Backspace"},windows:m("Backspace"),linux:m("Backspace")},delete:{mac:{symbol:"⌦",name:"Delete"},windows:m("Del"),linux:m("Del")},capslock:{mac:{symbol:"⇪",name:"Caps Lock"},windows:m("Caps Lock"),linux:m("Caps Lock")}},s={cmdorctrl:"mod",commandorcontrol:"mod",cmd:"meta",command:"meta",super:"meta",win:"meta",windows:"meta",control:"ctrl",option:"alt",opt:"alt",return:"enter",esc:"escape",del:"delete",caps:"capslock"},i={up:{symbol:"↑",name:"Arrow up"},down:{symbol:"↓",name:"Arrow down"},left:{symbol:"←",name:"Arrow left"},right:{symbol:"→",name:"Arrow right"},arrowup:{symbol:"↑",name:"Arrow up"},arrowdown:{symbol:"↓",name:"Arrow down"},arrowleft:{symbol:"←",name:"Arrow left"},arrowright:{symbol:"→",name:"Arrow right"}};function c(){if("undefined"==typeof navigator)return"windows";const e=navigator.userAgentData,n=`${e?.platform??""} ${navigator.platform??""} ${navigator.userAgent??""}`;return/mac|iphone|ipad|ipod/i.test(n)?"mac":/win/i.test(n)?"windows":"linux"}function d(){return()=>{}}function p(){return"windows"}const u={xs:"h-5",sm:"h-6",md:"h-8",lg:"h-10",xl:"h-12"},w={xs:"min-w-5",sm:"min-w-6",md:"min-w-8",lg:"min-w-10",xl:"min-w-12"},x={xs:"text-mp-label-small",sm:"text-mp-label-medium",md:"text-mp-label-large",lg:"text-mp-label-large",xl:"text-mp-title-medium"},f={xs:"px-1",sm:"px-1.5",md:"px-2",lg:"px-2.5",xl:"px-3"},b={xs:"rounded-mp-xs",sm:"rounded-mp-xs",md:"rounded-mp-sm",lg:"rounded-mp-sm",xl:"rounded-mp-md"},y={filled:"bg-(--_mp-accent) text-(--_mp-on-accent)",tonal:"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)",elevated:"shadow-mp-1 bg-mp-surface-container-low text-mp-on-surface-variant",outlined:"border-mp-outline-variant text-mp-on-surface-variant border bg-transparent",text:"text-mp-on-surface-variant bg-mp-surface-container"};export const MPShortcut=/*@__PURE__*/t.forwardRef(function({variant:h="outlined",size:g="md",color:v="secondary",keys:A,os:k="auto",separator:C,className:E,style:S,...j},B){const N=t.useSyncExternalStore(d,c,p),_="auto"===k?N:k,D=function(e){return Array.isArray(e)?e.map(e=>e.trim()).filter(Boolean):e.split("+").map(e=>e.trim()).filter(Boolean)}(A),L=D.map(e=>function(e,n){const a=e.toLowerCase().replace(/[\s_-]/g,""),t=s[a]??a,o=i[t];if(o)return o;const r=l[t];return r?r[n]:m(1===e.length?e.toUpperCase():e)}(e,_)),T=void 0===C?"mac"===_?null:"+":C,$=["inline-flex shrink-0 items-center justify-center","font-mono leading-none whitespace-nowrap tabular-nums",u[g],w[g],x[g],f[g],b[g],y[h]].join(" ");return e("span",{ref:B,"data-mp-size":g,"data-mp-variant":h,className:["mp-shortcut inline-flex max-w-full items-center gap-1 align-middle",E??""].filter(Boolean).join(" "),style:{...o(v),...S},...j,children:L.map((o,m)=>a(t.Fragment,{children:[m>0&&null!==T?e("span",{"aria-hidden":"true",className:"text-mp-on-surface-variant",children:T}):null,e("kbd",{className:$,children:o.symbol===o.name?o.symbol:a(n,{children:[e("span",{"aria-hidden":"true",children:o.symbol}),e("span",{className:r,children:o.name})]})})]},m))})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{useRender as l}from"@base-ui/react/use-render";import{CONTROL_SQUARE as o}from"../../internal/scale";const a={xs:"h-3",sm:"h-3.5",md:"h-4",lg:"h-4",xl:"h-5.5"},n={xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-2",xl:"gap-1.5"},i={xs:"h-12",sm:"h-16",md:"h-20",lg:"h-28",xl:"h-36"},t="overflow-hidden bg-(--_mp-placeholder)";function s(e){if(void 0!==e)return"number"==typeof e?`${e}px`:e}export const MPSkeleton
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{useRender as l}from"@base-ui/react/use-render";import{CONTROL_SQUARE as o}from"../../internal/scale";const a={xs:"h-3",sm:"h-3.5",md:"h-4",lg:"h-4",xl:"h-5.5"},n={xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-2",xl:"gap-1.5"},i={xs:"h-12",sm:"h-16",md:"h-20",lg:"h-28",xl:"h-36"},t="overflow-hidden bg-(--_mp-placeholder)";function s(e){if(void 0!==e)return"number"==typeof e?`${e}px`:e}export const MPSkeleton=/*@__PURE__*/r.forwardRef(function({shape:r="line",lines:m=1,size:d="md",color:p,width:c,height:h,animated:f=!0,label:u,render:x,className:g,style:w,...v},b){const y=f?"animate-pulse motion-reduce:animate-none":"",$="circle"===r?`rounded-mp-full shrink-0 ${o[d]}`:"rect"===r?`rounded-mp-md w-full ${void 0===h?i[d]:""}`:`rounded-mp-xs w-full ${a[d]}`,j=u?{role:"status","aria-busy":!0,"aria-label":u}:{"aria-hidden":!0},k="line"===r&&m>1;return l({render:x,ref:b,props:{"data-mp-size":d,className:(k?["mp-skeleton flex w-full flex-col",n[d],g??""]:["mp-skeleton",t,y,$,g??""]).filter(Boolean).join(" "),style:{"--_mp-placeholder":p?`var(--_mp-color-${p}-container)`:"var(--_mp-color-surface-container-highest)",width:s(c),height:k?void 0:s(h),...w},...j,...k?{children:Array.from({length:m},(r,l)=>e("div",{className:[t,y,"rounded-mp-xs",a[d],l===m-1?"w-3/5":"w-full"].filter(Boolean).join(" ")},l))}:null,...v}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as s from"react";import{Slider as a}from"@base-ui/react/slider";import{accentSlots as t}from"../../internal/accent";import{MPStateLayer as n}from"../../internal/StateLayer";import{META_TEXT as i,hasContent as o}from"../../internal/scale";const l={xs:{thickness:"h-0.5",cross:"w-0.5",handle:"size-3.5",strip:"h-8",stripCross:"w-8"},sm:{thickness:"h-[3px]",cross:"w-[3px]",handle:"size-4",strip:"h-9",stripCross:"w-9"},md:{thickness:"h-1",cross:"w-1",handle:"size-5",strip:"h-10",stripCross:"w-10"},lg:{thickness:"h-1.5",cross:"w-1.5",handle:"size-6",strip:"h-11",stripCross:"w-11"},xl:{thickness:"h-2",cross:"w-2",handle:"size-7",strip:"h-12",stripCross:"w-12"}},c=["duration-(--mp-sys-motion-duration-short2) ease-mp-standard","motion-reduce:transition-none"].join(" "),m={xs:"size-8",sm:"size-9",md:"size-10",lg:"size-11",xl:"size-12"};export const MPSlider=/*@__PURE__*/s.forwardRef(function({value:s,defaultValue:u,onValueChange:p,onValueCommitted:d,min:f=0,max:h=100,step:g=1,label:x,description:b,showValue:w=!1,format:j,orientation:y="horizontal",size:z="md",color:v="primary",disabled:C=!1,name:N,"aria-label":_},k){const V="vertical"===y,$=l[z],A=s??u,B=Array.isArray(A)?A.length:1;return r(a.Root,{ref:k,value:s,defaultValue:u,onValueChange:e=>p?.(e),onValueCommitted:e=>d?.(e),min:f,max:h,step:g,disabled:C,orientation:y,format:j,name:N,"data-mp-size":z,className:["mp-slider flex",V?"w-fit flex-col items-center gap-2":"w-full flex-col gap-1",C?"cursor-default":""].filter(Boolean).join(" "),style:t(v),children:[o(x)||w?r("div",{className:["flex w-full items-baseline gap-2",i].join(" "),children:[o(x)?e(a.Label,{className:C?"text-mp-on-surface/38":"text-mp-on-surface-variant",children:x}):null,w?e(a.Value,{className:["ms-auto tabular-nums",C?"text-mp-on-surface/38":"text-mp-on-surface"].join(" ")}):null]}):null,e(a.Control,{className:["mp-slider__control group/rail flex touch-none items-center justify-center select-none",V?`${$.stripCross} h-40 flex-col`:`w-full ${$.strip}`,C?"":"cursor-pointer"].filter(Boolean).join(" "),children:r(a.Track,{className:["mp-slider__track rounded-mp-full relative",V?`${$.cross} h-full`:`${$.thickness} w-full`,C?"bg-mp-on-surface/12":"bg-mp-surface-container-highest"].join(" "),children:[e(a.Indicator,{className:["rounded-mp-full","[transition-property:inset-inline-start,width,bottom,height]",c,"group-data-dragging/rail:transition-none",C?"bg-mp-on-surface/38":"bg-(--_mp-accent)"].join(" ")}),Array.from({length:B},(r,s)=>e(a.Thumb,{index:s,"aria-label":o(x)?void 0:_,className:["mp-slider__handle group rounded-mp-full relative outline-none","[transition-property:inset-inline-start,bottom]",c,"data-dragging:transition-none",$.handle,C?"bg-mp-on-surface/38 cursor-default":"bg-(--_mp-accent) cursor-grab active:cursor-grabbing"].join(" "),children:C?null:e(n,{layer:["top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",m[z],"bg-(--_mp-accent)"].join(" "),className:"group-data-dragging:opacity-16"})},s))]})}),o(b)?e("div",{className:[i,C?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:b}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Toast as s}from"@base-ui/react/toast";import{MPIcon as i}from"../icon/MPIcon";import{CloseIcon as n}from"../../constants/icons";import{accentSlots as r}from"../../internal/accent";import{useMPLocale as a,useMPMessages as l}from"../../internal/locale";import{MPStateLayer as c}from"../../internal/StateLayer";import{PORTAL_LAYER as m}from"../../internal/surface";const p={"top-start":"top-0 items-start","top-center":"top-0 items-center","top-end":"top-0 items-end","bottom-start":"bottom-0 flex-col-reverse items-start","bottom-center":"bottom-0 flex-col-reverse items-center","bottom-end":"bottom-0 flex-col-reverse items-end"},d=["transition-[opacity,translate] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard","data-starting-style:opacity-0 data-ending-style:opacity-0"].join(" "),u={top:"motion-safe:data-starting-style:-translate-y-full motion-safe:data-ending-style:-translate-y-full",bottom:"motion-safe:data-starting-style:translate-y-full motion-safe:data-ending-style:translate-y-full"},f={xs:"text-mp-body-small",sm:"text-mp-body-small",md:"text-mp-body-medium",lg:"text-mp-body-medium",xl:"text-mp-body-large"},x={xs:"min-h-9 gap-1.5 py-1.5 ps-3 pe-1.5",sm:"min-h-10 gap-2 py-2 ps-3.5 pe-2",md:"min-h-12 gap-2 py-2.5 ps-4 pe-2",lg:"min-h-14 gap-3 py-3 ps-5 pe-2.5",xl:"min-h-16 gap-3 py-3.5 pe-3 ps-6"},b={xs:16,sm:18,md:20,lg:22,xl:24};function y(e){const{color:t,icon:o,message:s,actionLabel:i,onAction:n,...r}=e;return{...r,title:s,data:{color:t,icon:o},actionProps:void 0===i?void 0:{children:i,onClick:n}}}export function useMPSnackbar(){const e=s.useToastManager();return o.useMemo(()=>({add:t=>e.add(y(t)),close:t=>e.close(t),update:(t,o)=>e.update(t,y(o)),promise:(t,o)=>e.promise(t,{loading:y(o.loading),success:e=>y("function"==typeof o.success?o.success(e):o.success),error:e=>y("function"==typeof o.error?o.error(e):o.error)}),snackbars:e.toasts}),[e])}function h({toast:o,color:a,size:l,showClose:m,closeLabel:p,swipeDirection:y,edge:h}){const g=o.data?.color??a,v=o.data?.icon,w={"--_mp-plate":g?`var(--_mp-color-${g}-container)`:"var(--_mp-color-inverse-surface)","--_mp-on-plate":g?`var(--_mp-color-on-${g}-container)`:"var(--_mp-color-inverse-on-surface)","--_mp-plate-action":g?`var(--_mp-color-${g})`:"var(--_mp-color-inverse-primary)",...g?r(g):null};return t(s.Root,{toast:o,swipeDirection:y,"data-mp-size":l,className:["mp-snackbar rounded-mp-xs shadow-mp-3 pointer-events-auto flex w-full items-center","bg-(--_mp-plate) text-(--_mp-on-plate) outline-none",x[l],f[l],d,u[h],"data-limited:hidden"].join(" "),style:w,children:[v?e("span",{className:"flex shrink-0 items-center",children:v}):null,e(s.Title,{render:e("span",{}),className:"min-w-0 flex-1 py-0.5 ps-1 [min-inline-size:min(280px,100%)]"}),e(s.Action,{className:["text-mp-label-large flex shrink-0 cursor-pointer items-center","rounded-mp-full h-8 px-3 text-(--_mp-plate-action)","transition-colors duration-(--mp-sys-motion-duration-short4)","hover:bg-(--_mp-plate-action)/8 focus-visible:bg-(--_mp-plate-action)/10","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" ")}),m?t(s.Close,{"aria-label":p,className:["group rounded-mp-full relative flex size-8 shrink-0 cursor-pointer","items-center justify-center text-(--_mp-on-plate)","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),children:[e(c,{}),e(i,{icon:n,size:b[l]})]}):null]})}function g({position:t,width:o,...i}){const{toasts:n}=s.useToastManager(),r=t.startsWith("top")?"top":"bottom",a=["top"===r?"up":"down","left","right"];return e(s.Portal,{children:e(s.Viewport,{className:[m,"pointer-events-none fixed inset-x-0 flex flex-col gap-2 p-4",p[t]].join(" "),children:n.map(t=>e("div",{className:"w-full",style:{maxWidth:"number"==typeof o?`${o}px`:o},children:e(h,{toast:t,swipeDirection:a,edge:r,...i})},t.id))})})}export function MPSnackbarProvider({color:o,position:i="bottom-start",timeout:n=5e3,limit:r=3,width:c=600,size:m="md",showClose:p=!0,closeLabel:d,locale:u,children:f}){const x=a(u),b=l("common",x);return t(s.Provider,{timeout:n,limit:r,children:[f,e(g,{position:i,width:c,color:o,size:m,showClose:p,closeLabel:d??b.close})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{MPButton as o}from"../button/MPButton";import{inertProps as i}from"../../internal/inert";import{useMPLocale as n,useMPMessages as t}from"../../internal/locale";import{hasContent as l,META_TEXT as d,SHEET_PAD as s,SHEET_PAD_X as c,SHEET_PAD_Y as m}from"../../internal/scale";import{CONTAINER_SURFACE as p}from"../../internal/surface";const f="[background-color:color-mix(in_oklab,var(--_mp-color-surface)_55%,transparent)]";export const MPSpoiler
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{MPButton as o}from"../button/MPButton";import{inertProps as i}from"../../internal/inert";import{useMPLocale as n,useMPMessages as t}from"../../internal/locale";import{hasContent as l,META_TEXT as d,SHEET_PAD as s,SHEET_PAD_X as c,SHEET_PAD_Y as m}from"../../internal/scale";import{CONTAINER_SURFACE as p}from"../../internal/surface";const f="[background-color:color-mix(in_oklab,var(--_mp-color-surface)_55%,transparent)]";export const MPSpoiler=/*@__PURE__*/a.forwardRef(function({revealed:u,defaultRevealed:v=!1,onRevealedChange:x,locale:h,label:b,hideLabel:j,description:N,action:g,reversible:y=!1,maxHeight:z,blur:k=10,padded:w=!0,variant:B="outlined",size:C="md",color:R="primary",className:_,children:H,...M},P){const S=n(h),$=t("spoiler",S),I=a.useId(),[L,q]=a.useState(v),A=u??L,D=e=>{void 0===u&&q(e),x?.(e)},E=!1===N?null:N??$.notice;return r("div",{ref:P,"data-mp-size":C,"data-mp-variant":B,"data-mp-revealed":A||void 0,className:["mp-spoiler rounded-mp-md relative isolate overflow-hidden","box-border",p[B],"text-mp-on-surface",_??""].filter(Boolean).join(" "),...M,children:[e("div",{id:I,className:["min-w-0",w?s[C]:"","transition-[filter] duration-(--mp-sys-motion-duration-short4) ease-mp-standard","motion-reduce:transition-none",A?"":"select-none"].filter(Boolean).join(" "),style:{filter:A?void 0:`blur(${k}px)`,maxHeight:A?void 0:z,overflow:A?void 0:"hidden"},...i(!A),children:H}),A?null:r("div",{className:["absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 text-center",s[C],f].join(" "),children:[l(E)?e("p",{className:`text-mp-on-surface-variant m-0 ${d}`,children:E}):null,g??e(o,{variant:"tonal",size:C,color:R,onClick:()=>D(!0),"aria-expanded":!1,"aria-controls":I,children:b??$.reveal})]}),A&&y?e("div",{className:["flex justify-end",c[C],m[C],"pt-0"].join(" "),children:e(o,{variant:"text",size:C,color:R,onClick:()=>D(!1),"aria-expanded":!0,"aria-controls":I,children:j??$.hide})}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as t,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{Switch as n}from"@base-ui/react/switch";import{Field as i}from"@base-ui/react/field";import{MPIcon as
|
|
1
|
+
import{jsx as e,Fragment as t,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{Switch as n}from"@base-ui/react/switch";import{Field as i}from"@base-ui/react/field";import{MPIcon as s}from"../icon/MPIcon";import{CheckIcon as o,CloseIcon as c}from"../../constants/icons";import{accentSlots as l}from"../../internal/accent";import{MPStateLayer as d}from"../../internal/StateLayer";import{MPSupportingText as h}from"../../internal/SupportingText";import{PROSE_TEXT as m,hasContent as p}from"../../internal/scale";const u={xs:{track:"h-5 w-8",thumb:"left-[5px] size-2.5 data-checked:left-[15px] data-checked:size-3.5",halo:"size-8",glyph:8},sm:{track:"h-6 w-10",thumb:"left-1.5 size-3 data-checked:left-[19px] data-checked:size-[18px]",halo:"size-9",glyph:10},md:{track:"h-8 w-13",thumb:"left-2 size-4 data-checked:left-6 data-checked:size-6",halo:"size-10",glyph:14},lg:{track:"h-9 w-15",thumb:"left-[9px] size-[18px] data-checked:left-7 data-checked:size-7",halo:"size-11",glyph:16},xl:{track:"h-10 w-17",thumb:"left-2.5 size-5 data-checked:left-[33px] data-checked:size-[30px]",halo:"size-12",glyph:18}};export const MPSwitch=/*@__PURE__*/r.forwardRef(function({checked:f,defaultChecked:g,onCheckedChange:k,label:b,description:x,errorMessage:y,icons:z=!1,labelPlacement:j="end",size:w="md",color:N="primary",required:_=!1,disabled:C=!1,readOnly:M=!1,name:v,id:P,fullWidth:R=!1},S){const W=p(y),q=W?"error":N,F=u[w],I=r.useId(),L=P??I,O=e("span",{className:"flex h-[1lh] shrink-0 items-center",children:e(n.Root,{ref:S,id:L,name:v,checked:f,defaultChecked:g,required:_,disabled:C,readOnly:M,onCheckedChange:e=>k?.(e),className:["mp-switch__track group relative box-border inline-flex shrink-0 p-0","rounded-mp-full appearance-none font-[inherit] outline-none","transition-[background-color,box-shadow]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard",F.track,C?["bg-mp-surface-container-highest inset-ring-2 inset-ring-mp-on-surface/12","cursor-default","data-checked:bg-mp-on-surface/12 data-checked:inset-ring-0"].join(" "):[M?"cursor-default":"cursor-pointer","bg-mp-surface-container-highest inset-ring-2",W?"inset-ring-mp-error":"inset-ring-mp-outline","data-checked:inset-ring-0 data-checked:bg-(--_mp-accent)"].join(" ")].join(" "),children:a(n.Thumb,{className:["mp-switch__thumb absolute top-1/2 flex -translate-y-1/2 items-center justify-center","rounded-full","transition-[left,width,height,background-color]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard",F.thumb,C?"bg-mp-on-surface/38 data-checked:bg-mp-surface-container-highest":[W?"bg-mp-error":"bg-mp-outline","data-checked:bg-(--_mp-on-accent)"].join(" ")].join(" "),children:[C?null:e(d,{layer:["top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",F.halo,"bg-mp-on-surface group-data-checked:bg-(--_mp-accent)"].join(" ")}),z?a(t,{children:[e("span",{className:["absolute inset-0 flex items-center justify-center","transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard opacity-0 group-data-checked:opacity-100",C?"text-mp-surface-container-highest":"text-(--_mp-accent)"].join(" "),children:e(s,{icon:o,size:F.glyph,strokeWidth:3})}),e("span",{className:["absolute inset-0 flex items-center justify-center","text-mp-surface-container-highest","transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard group-data-checked:opacity-0"].join(" "),children:e(s,{icon:c,size:F.glyph,strokeWidth:3})})]}):null]})})}),T=p(b)||p(x)||W?a("span",{className:["flex min-w-0 flex-col gap-0.5","start"===j?"flex-1":""].filter(Boolean).join(" "),children:[p(b)?a(i.Label,{htmlFor:L,className:["leading-[1.4]",C?"text-mp-on-surface/38 cursor-default":M?"text-mp-on-surface":"text-mp-on-surface cursor-pointer"].join(" "),children:[b,_?e("span",{"aria-hidden":"true",children:" *"}):null]}):null,e(h,{description:x,errorMessage:y})]}):null;return e(i.Root,{className:["mp-switch align-top",R?"flex w-full":"inline-flex"].join(" "),disabled:C,invalid:W,"data-mp-size":w,style:l(q),children:e("div",{className:["flex w-full items-start gap-3",m[w]].join(" "),children:a(t,"start"===j?{children:[T,O]}:{children:[O,T]})})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Tabs as i}from"@base-ui/react/tabs";import{accentSlots as
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Tabs as i}from"@base-ui/react/tabs";import{accentSlots as o}from"../../internal/accent";import{MPStateLayer as n}from"../../internal/StateLayer";import{CONTROL_GAP as r,hasContent as l,SHEET_GAP as s}from"../../internal/scale";const c=/*@__PURE__*/a.createContext({variant:"primary",size:"md",iconPosition:"top",fullWidth:!1}),m={xs:"h-8",sm:"h-10",md:"h-12",lg:"h-14",xl:"h-16"},u={xs:"h-11",sm:"h-13",md:"h-16",lg:"h-18",xl:"h-20"},d={xs:"text-mp-label-medium",sm:"text-mp-label-large",md:"text-mp-title-small",lg:"text-mp-title-small",xl:"text-mp-title-medium"},p={xs:"px-3",sm:"px-3.5",md:"px-4",lg:"px-5",xl:"px-6"},f={xs:12,sm:14,md:16,lg:20,xl:24},h={xs:18,sm:20,md:24,lg:24,xl:28};function x(e,t,i,o=""){a.Children.toArray(e).forEach(e=>{if(!a.isValidElement(e))return void(l(e)&&t.push(e));if(e.type===a.Fragment)return void x(e.props.children,t,i,`${o}${String(e.key)}/`);const n=o?a.cloneElement(e,{key:`${o}${String(e.key)}`}):e;e.type===MPTabPanel?i.push(n):t.push(n)})}export const MPTabs=/*@__PURE__*/a.forwardRef(function({variant:n="primary",color:r="primary",size:l="md",value:m,defaultValue:u,onValueChange:d,iconPosition:p,activateOnFocus:h=!1,loopFocus:v=!0,divider:b=!0,fullWidth:y=!1,className:_,style:g,children:w,"aria-label":j,...P},N){const k=p??("primary"===n?"top":"start"),M=a.useMemo(()=>({variant:n,size:l,iconPosition:k,fullWidth:y}),[n,l,k,y]),$=[],z=[];return x(w,$,z),e(c.Provider,{value:M,children:t(i.Root,{ref:N,value:m,defaultValue:u,onValueChange:e=>d?.(e),"data-mp-size":l,"data-mp-variant":n,className:["mp-tabs flex min-w-0 flex-col",s[l],_??""].filter(Boolean).join(" "),style:{...o(r),"--_mp-tab-inset":`${f[l]}px`,...g},...P,children:[t(i.List,{"aria-label":j,activateOnFocus:h,loopFocus:v,className:["mp-tabs__list relative flex shrink-0",b?"border-mp-outline-variant border-b":"",y?"w-full":"","overflow-x-auto overflow-y-hidden"].filter(Boolean).join(" "),children:[$,e(i.Indicator,{className:["mp-tabs__indicator pointer-events-none absolute bottom-0","bg-(--_mp-accent)","primary"===n?["h-0.75 rounded-t-full","left-[calc(var(--active-tab-left)_+_var(--_mp-tab-inset))]","w-[calc(var(--active-tab-width)_-_2_*_var(--_mp-tab-inset))]"].join(" "):"left-(--active-tab-left) h-0.5 w-(--active-tab-width)","[transition-property:left,width]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard"].join(" ")})]}),z]})})});export const MPTab=/*@__PURE__*/a.forwardRef(function({value:o,icon:s,disabled:f=!1,className:x,children:v,...b},y){const{variant:_,size:g,iconPosition:w,fullWidth:j}=a.useContext(c),P="top"===w&&l(s);return t(i.Tab,{ref:y,value:o,disabled:f,className:["mp-tabs__tab group relative flex shrink-0 items-center justify-center","box-border appearance-none bg-transparent font-[inherit] whitespace-nowrap select-none","overflow-hidden outline-none","transition-[color] duration-(--mp-sys-motion-duration-short4) ease-mp-standard",P?`flex-col gap-1 ${u[g]}`:`flex-row ${m[g]}`,P?"":r[g],d[g],p[g],f?"text-mp-on-surface/38 cursor-default":["text-mp-on-surface-variant cursor-pointer","primary"===_?"data-active:text-(--_mp-accent)":"data-active:text-mp-on-surface"].join(" "),"outline-mp-secondary focus-visible:outline-2 focus-visible:-outline-offset-2","focus-visible:outline-solid",j?"flex-1":"",x??""].filter(Boolean).join(" "),...b,children:[f?null:e(n,{}),l(s)?e("span",{className:"relative flex shrink-0 items-center justify-center",style:{width:h[g],height:h[g]},children:s}):null,l(v)?e("span",{className:"relative truncate",children:v}):null]})});export const MPTabPanel=/*@__PURE__*/a.forwardRef(function({value:t,keepMounted:a=!1,className:o,children:n,...r},l){return e(i.Panel,{ref:l,value:t,keepMounted:a,className:["mp-tabs__panel text-mp-on-surface min-w-0 flex-1","rounded-mp-xs outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none","transition-opacity duration-(--mp-sys-motion-duration-short4) ease-mp-standard","data-starting-style:opacity-0",o??""].filter(Boolean).join(" "),...r,children:n})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Field as n}from"@base-ui/react/field";import{MPIcon as a}from"../icon/MPIcon";import{MPFieldLabel as r,MPFieldOutline as l,useFloatingLabel as i}from"../../internal/FieldOutline";import{VisibilityIcon as s,VisibilityOffIcon as d}from"../../constants/icons";import{useMPLocale as p,useMPMessages as c}from"../../internal/locale";const u={xs:{padding:"px-2",control:"py-1.5",text:"text-mp-body-medium",icon:16},sm:{padding:"px-3",control:"py-2.5",text:"text-mp-body-medium",icon:18},md:{padding:"px-4",control:"py-4",text:"text-mp-body-large",icon:20},lg:{padding:"px-4",control:"py-5",text:"text-mp-body-large",icon:22},xl:{padding:"px-5",control:"py-6",text:"text-mp-body-large",icon:24}};export const MPTextField
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Field as n}from"@base-ui/react/field";import{MPIcon as a}from"../icon/MPIcon";import{MPFieldLabel as r,MPFieldOutline as l,useFloatingLabel as i}from"../../internal/FieldOutline";import{VisibilityIcon as s,VisibilityOffIcon as d}from"../../constants/icons";import{useMPLocale as p,useMPMessages as c}from"../../internal/locale";const u={xs:{padding:"px-2",control:"py-1.5",text:"text-mp-body-medium",icon:16},sm:{padding:"px-3",control:"py-2.5",text:"text-mp-body-medium",icon:18},md:{padding:"px-4",control:"py-4",text:"text-mp-body-large",icon:20},lg:{padding:"px-4",control:"py-5",text:"text-mp-body-large",icon:22},xl:{padding:"px-5",control:"py-6",text:"text-mp-body-large",icon:24}};export const MPTextField=/*@__PURE__*/o.forwardRef(function({value:m,name:f,type:x="text",placeholder:b,autoComplete:g,label:y,floatingLabel:h=!0,onChange:v,onFormReset:w,onSubmit:C,errorMessage:k="",required:j=!1,fullWidth:z=!1,readOnly:E=!1,autoFocus:F=!1,size:M="md",disabled:N=!1,disableEnterKey:P=!1,rows:S,maxLength:q,startIcon:D,resizable:L=!1,id:R,locale:I,passwordLabels:O},B){const K=p(I),U=c("textField",K,O),_=o.useRef(null),[T,W]=o.useState(!1),[$,A]=o.useState(!1),[G,H]=o.useState(m),J=o.useId(),Q=R??J,V=!!S,X=k.length>0,Y=u[M],Z=$?G:m,{shrunk:ee,focusProps:te}=i({floating:h&&!!y,filled:Z.length>0,pinned:!!D}),oe=o.useCallback(e=>{_.current=e,"function"==typeof B?B(e):B&&(B.current=e)},[B]),ne=e=>{e.preventDefault()};return o.useEffect(()=>{$||H(m)},[m,$]),o.useEffect(()=>{F&&!window.matchMedia("(max-width: 599.95px)").matches&&_.current?.focus()},[]),t(n.Root,{className:["mp-text-field group relative",z?"w-full":"inline-block","align-top"].join(" "),disabled:N,invalid:X,"data-mp-size":M,...te,children:[t("div",{className:["relative flex w-full items-center gap-2",Y.padding,V?"py-2":""].filter(Boolean).join(" "),children:[e(l,{label:y,required:j,notched:ee}),D?e("span",{className:"text-mp-on-surface-variant group-data-disabled:text-mp-on-surface/38 flex shrink-0 items-center",children:D}):null,e(n.Control,{render:V?e("textarea",{rows:S}):e("input",{}),id:Q,name:f,type:V?void 0:T?"text":x,required:j,readOnly:E,disabled:N,autoComplete:g,placeholder:ee?b:void 0,maxLength:q,value:Z,ref:oe,className:[`${Y.text} text-mp-on-surface w-full min-w-0 flex-1`,"font-[family-name:var(--mp-sys-typescale-body-large-font)]","appearance-none border-0 bg-transparent px-0 outline-none","caret-mp-primary",Y.control,V?"py-0":"",V&&L?"resize-y":"resize-none","group-data-disabled:text-mp-on-surface/38","placeholder:text-mp-on-surface-variant group-data-disabled:placeholder:text-mp-on-surface/38"].filter(Boolean).join(" "),onChange:e=>{w?.();const t=e.target.value;$&&H(t),v?.(t)},onCompositionStart:()=>{A(!0),H(m)},onCompositionUpdate:e=>{H(e.target.value)},onCompositionEnd:e=>{A(!1);const t=e.target.value;w?.(),v?.(t),H(t)},onKeyDown:e=>{if("Enter"===e.key){if(function(e){const t=e.nativeEvent;return t.isComposing||229===t.keyCode}(e))return;C?.(),V&&!P||e.preventDefault()}}}),"password"!==x||V?null:e("button",{type:"button","aria-label":T?U.hidePassword:U.showPassword,onClick:()=>W(e=>!e),onMouseDown:ne,onMouseUp:ne,disabled:N,className:["text-mp-on-surface-variant -mr-1 flex shrink-0 items-center justify-center","cursor-pointer appearance-none border-0 bg-transparent p-1 font-[inherit]","rounded-full outline-none","hover:text-mp-on-surface focus-visible:text-mp-primary","disabled:text-mp-on-surface/38 disabled:cursor-default"].join(" "),children:e(a,{icon:T?s:d,size:Y.icon})}),y?e(r,{size:M,label:y,required:j,htmlFor:Q,shrunk:ee,multiline:V}):null]}),X?e(n.Error,{match:!0,className:["mp-text-field__support text-mp-body-small text-mp-error mt-1 block",Y.padding,"group-data-disabled:text-mp-on-surface/38"].join(" "),children:k}):null]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as n,jsxs as o}from"react/jsx-runtime";import*as r from"react";import{useRender as i}from"@base-ui/react/use-render";import{MPIcon as t}from"../icon/MPIcon";import{ExternalLinkIcon as l,LinkIcon as s}from"../../constants/icons";import{accentSlots as a}from"../../internal/accent";import{PROSE_TEXT as c}from"../../internal/scale";import{VISUALLY_HIDDEN as m}from"../../internal/visually-hidden";const p={always:"[&.mp-link]:underline",hover:"[&.mp-link]:no-underline [&.mp-link]:hover:underline",none:"[&.mp-link]:no-underline"},d=["[&.mp-link]:[text-underline-offset:0.2em]","[&.mp-link]:[text-decoration-thickness:0.08em]","[&.mp-link]:[text-decoration-color:color-mix(in_oklab,currentColor_45%,transparent)]","[&.mp-link]:hover:[text-decoration-color:currentColor]"].join(" ");export const MPTextLink
|
|
1
|
+
import{jsx as e,Fragment as n,jsxs as o}from"react/jsx-runtime";import*as r from"react";import{useRender as i}from"@base-ui/react/use-render";import{MPIcon as t}from"../icon/MPIcon";import{ExternalLinkIcon as l,LinkIcon as s}from"../../constants/icons";import{accentSlots as a}from"../../internal/accent";import{PROSE_TEXT as c}from"../../internal/scale";import{VISUALLY_HIDDEN as m}from"../../internal/visually-hidden";const p={always:"[&.mp-link]:underline",hover:"[&.mp-link]:no-underline [&.mp-link]:hover:underline",none:"[&.mp-link]:no-underline"},d=["[&.mp-link]:[text-underline-offset:0.2em]","[&.mp-link]:[text-decoration-thickness:0.08em]","[&.mp-link]:[text-decoration-color:color-mix(in_oklab,currentColor_45%,transparent)]","[&.mp-link]:hover:[text-decoration-color:currentColor]"].join(" ");export const MPTextLink=/*@__PURE__*/r.forwardRef(function({href:r,underline:u="always",color:f,size:k,newTab:h=!1,icon:x,newTabLabel:b="Opens in a new tab",render:v,className:y,style:w,children:j,..._},g){const N=h?"_blank":_.target,T="_blank"===N,z=x??T,C=!0===z?e(t,{icon:T?l:s,size:"0.95em"}):z,L=["mp-link cursor-pointer","transition-[color,text-decoration-color]","duration-(--mp-sys-motion-duration-short4)","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid focus-visible:rounded-mp-xs outline-none",k?c[k]:"",p[u],d,f?"[&.mp-link]:text-(--_mp-accent)":"[&.mp-link]:text-inherit",y??""].filter(Boolean).join(" ");return i({render:v??e("a",{}),ref:g,props:{href:r,target:N,rel:T?"noopener noreferrer":void 0,className:L,style:f?{...a(f),...w}:w,children:o(n,{children:[j,C?e("span",{className:"ms-[0.25em] inline-flex align-baseline",children:C}):null,T?o(n,{children:[" ",e("span",{className:m,children:b})]}):null]}),..._}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as o}from"react/jsx-runtime";import*as n from"react";import{MPButton as l}from"../button/MPButton";import{MPIcon as r}from"../icon/MPIcon";import{ClockIcon as t}from"../../constants/icons";import{MPTimeGrid as a}from"../../internal/Calendar";import{FOOTER_SIZE as i,MPPickerFooter as s,MPPickerShell as c,useDisplaySamples as u}from"../../internal/Picker";import{useMPLocale as d,useMPMessages as m}from"../../internal/locale";import{CONTROL_ICON as p}from"../../internal/scale";import{formatDate as h,isHour12 as f,isValidDate as g,secondsOfDay as S,timeUnitSpan as b,toISOTime as v,withPlaceholder as C,withTime as x}from"../../internal/date";export const MPTimePicker
|
|
1
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import*as n from"react";import{MPButton as l}from"../button/MPButton";import{MPIcon as r}from"../icon/MPIcon";import{ClockIcon as t}from"../../constants/icons";import{MPTimeGrid as a}from"../../internal/Calendar";import{FOOTER_SIZE as i,MPPickerFooter as s,MPPickerShell as c,useDisplaySamples as u}from"../../internal/Picker";import{useMPLocale as d,useMPMessages as m}from"../../internal/locale";import{CONTROL_ICON as p}from"../../internal/scale";import{formatDate as h,isHour12 as f,isValidDate as g,secondsOfDay as S,timeUnitSpan as b,toISOTime as v,withPlaceholder as C,withTime as x}from"../../internal/date";export const MPTimePicker=/*@__PURE__*/n.forwardRef(function({value:k,defaultValue:w,onValueChange:z,open:D,defaultOpen:O,onOpenChange:y,referenceDate:P,minTime:T,maxTime:M,shouldDisableTime:j,hour12:I,showSeconds:V=!1,hourStep:B=1,minuteStep:N=1,secondStep:R=1,locale:F,format:H,placeholder:q,clearable:A=!1,showNowButton:E=!0,closeOnSelect:G=!1,labels:J,name:K,size:L="md",color:Q="primary",readOnly:U=!1,disabled:W=!1,startIcon:X,...Y},Z){const $=d(F),_=m("picker",$,J),ee=I??f($),[oe,ne]=n.useState(w??null),le=void 0!==k?k:oe,[re,te]=n.useState(O??!1),ae=D??re,[ie]=n.useState(()=>P??new Date),se=e=>{e&&(U||W)||(void 0===D&&te(e),y?.(e))},ce=e=>{void 0===k&&ne(e),z?.(e)},ue=n.useCallback((e,o)=>{const[n,l]=b(o,e);return!!(g(T)&&l<S(T))||(!!(g(M)&&n>S(M))||(j?.(e,o)??!1))},[T,M,j]),de=H??{hour:"numeric",minute:"2-digit",hour12:ee,...V?{second:"2-digit"}:{}},me=new Date,pe=x(P??ie,{hours:me.getHours(),minutes:me.getMinutes(),seconds:V?me.getSeconds():0}),he=E||A||!G,fe=C(u($,de),q);return e(c,{...Y,slug:"time-picker",size:L,color:Q,readOnly:U,disabled:W,triggerRef:Z,startIcon:void 0===X?e(r,{icon:t,size:p[L]}):X,display:g(le)?h(le,$,de):q??"",samples:fe,empty:!g(le),clearable:A,onClear:()=>ce(null),open:ae,onOpenChange:se,labels:_,hiddenValues:K?[{name:K,value:g(le)?v(le,V):""}]:void 0,children:o("div",{className:"flex flex-col "+(he?"gap-1.5":""),children:[e(a,{size:L,locale:$,value:g(le)?le:null,referenceDate:P??ie,onChange:e=>{ce(e),G&&se(!1)},hour12:ee,showSeconds:V,hourStep:B,minuteStep:N,secondStep:R,shouldDisableTime:ue,labels:_,autoFocus:!0}),he?o(s,{children:[A?e(l,{variant:"text",size:i[L],color:Q,onClick:()=>{ce(null),se(!1)},children:_.clear}):null,E?e(l,{variant:"text",size:i[L],color:Q,disabled:ue(pe,"second"),onClick:()=>{ce(pe),se(!1)},children:_.now}):null,G?null:e(l,{variant:"filled",size:i[L],color:Q,onClick:()=>se(!1),children:_.done})]}):null]})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as t from"react";import{useRender as n}from"@base-ui/react/use-render";import{accentSlots as l}from"../../internal/accent";import{hasContent as a,META_TEXT as o,PROSE_TEXT as i,SHEET_TITLE as s}from"../../internal/scale";const c
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as t from"react";import{useRender as n}from"@base-ui/react/use-render";import{accentSlots as l}from"../../internal/accent";import{hasContent as a,META_TEXT as o,PROSE_TEXT as i,SHEET_TITLE as s}from"../../internal/scale";const c=/*@__PURE__*/t.createContext(null),m=/*@__PURE__*/t.createContext({index:0,last:!1}),p={xs:"0.875rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"1.875rem"},d={xs:"gap-2",sm:"gap-2.5",md:"gap-3",lg:"gap-3.5",xl:"gap-4"},u={xs:"pb-5",sm:"pb-6",md:"pb-7",lg:"pb-8",xl:"pb-10"},x={xs:"pe-5",sm:"pe-6",md:"pe-7",lg:"pe-8",xl:"pe-10"},f={solid:"border-solid",dashed:"border-dashed",dotted:"border-dotted",none:""},b={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"},v={complete:"border-(--_mp-accent)",current:"border-mp-outline-variant",upcoming:"border-mp-outline-variant"},h={complete:"text-mp-on-surface",current:"text-(--_mp-accent)",upcoming:"text-mp-on-surface-variant"};export const MPTimelineItem=/*@__PURE__*/t.forwardRef(function({title:n,meta:g,bullet:_,status:N,color:y,connector:z="solid",className:j,style:w,children:$,...C},M){const P=t.useContext(c),{index:B,last:k}=t.useContext(m),A=P?.size??"md",R=P?.orientation??"vertical",T=y??P?.color??"primary",I=P?.active??null,q=N??(null===I?"upcoming":B<I?"complete":B===I?"current":"upcoming"),D="horizontal"===R,E="none"!==z&&!k,F=e("span",{"aria-hidden":"true",className:["rounded-mp-full relative z-10 flex shrink-0 items-center justify-center","size-(--_mp-bullet) text-[calc(var(--_mp-bullet)*0.5)] leading-none font-medium","tabular-nums [&>svg]:size-[0.6em]",b[q],"transition-[background-color,border-color,box-shadow,color]","duration-(--mp-sys-motion-duration-short4)"].join(" "),children:_}),G=E?e("span",{"aria-hidden":"true",className:["pointer-events-none absolute",D?"start-(--_mp-bullet) top-[calc(var(--_mp-bullet)/2_-_1px)] end-0 border-t-2":"top-(--_mp-bullet) start-[calc(var(--_mp-bullet)/2_-_1px)] bottom-0 border-s-2",f[z],v[q]].filter(Boolean).join(" ")}):null,H=r("div",{className:"flex min-w-0 flex-col gap-0.5 "+(D?"mt-2":""),children:[a(n)||a(g)?r("div",{className:"flex flex-wrap items-baseline gap-x-2",children:[a(n)?e("span",{className:`${s[A]} ${h[q]}`,children:n}):null,a(g)?e("span",{className:`text-mp-on-surface-variant ${o}`,children:g}):null]}):null,a($)?e("div",{className:`text-mp-on-surface-variant ${i[A]}`,children:$}):null]});return r("li",{ref:M,"aria-current":"current"===q?"step":void 0,"data-status":q,className:["relative",D?`flex min-w-0 flex-1 flex-col ${k?"":x[A]}`:`flex ${d[A]} ${k?"":u[A]}`,j??""].filter(Boolean).join(" "),style:{"--_mp-bullet":p[A],...l(T),...w},...C,children:[G,F,H]})});export const MPTimeline=/*@__PURE__*/t.forwardRef(function({active:r,size:l="md",color:a="primary",orientation:o="vertical",render:i,className:s,style:p,children:d,...u},x){const f=t.Children.toArray(d),b=f.length,v=t.useMemo(()=>({size:l,orientation:o,color:a,active:r??null}),[l,o,a,r]),h=t.useMemo(()=>Array.from({length:b},(e,r)=>({index:r,last:r===b-1})),[b]),g=n({render:i??e("ol",{}),ref:x,props:{role:"list","data-mp-size":l,className:["mp-timeline flex","horizontal"===o?"flex-row":"flex-col",s??""].filter(Boolean).join(" "),style:p,children:f.map((r,t)=>e(m.Provider,{value:h[t],children:r},t)),...u}});return e(c.Provider,{value:v,children:g})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as p from"react";import{useRender as t}from"@base-ui/react/use-render";import{accentSlots as e}from"../../internal/accent";const r={h1:"[&.mp-typography]:text-mp-display-small",h2:"[&.mp-typography]:text-mp-headline-large",h3:"[&.mp-typography]:text-mp-headline-medium",h4:"[&.mp-typography]:text-mp-headline-small",h5:"[&.mp-typography]:text-mp-title-large",h6:"[&.mp-typography]:text-mp-title-medium",lead:"[&.mp-typography]:text-mp-title-large",body:"[&.mp-typography]:text-mp-body-large",caption:"[&.mp-typography]:text-mp-body-small",overline:"[&.mp-typography]:text-mp-label-small [&.mp-typography]:tracking-[0.08em] uppercase"},a={h1:"regular",h2:"regular",h3:"regular",h4:"regular",h5:"regular",h6:"medium",lead:"regular",body:"regular",caption:"regular",overline:"medium"},m={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",lead:"p",body:"p",caption:"span",overline:"span"},o=new Set(["caption","overline"]),y={h1:"[&.mp-typography]:mb-4",h2:"[&.mp-typography]:mb-3.5",h3:"[&.mp-typography]:mb-3",h4:"[&.mp-typography]:mb-2.5",h5:"[&.mp-typography]:mb-2",h6:"[&.mp-typography]:mb-2",lead:"[&.mp-typography]:mb-4",body:"[&.mp-typography]:mb-3",caption:"[&.mp-typography]:mb-2",overline:"[&.mp-typography]:mb-2"},h="[&.mp-typography]:mt-0 [&.mp-typography]:ms-0 [&.mp-typography]:me-0",l={regular:"[&.mp-typography]:font-normal",medium:"[&.mp-typography]:font-medium",semibold:"[&.mp-typography]:font-semibold",bold:"[&.mp-typography]:font-bold"},n={start:"text-start",center:"text-center",end:"text-end",justify:"text-justify"},g={1:"truncate",2:"line-clamp-2",3:"line-clamp-3",4:"line-clamp-4",5:"line-clamp-5",6:"line-clamp-6"};export const MPTypography
|
|
1
|
+
import*as p from"react";import{useRender as t}from"@base-ui/react/use-render";import{accentSlots as e}from"../../internal/accent";const r={h1:"[&.mp-typography]:text-mp-display-small",h2:"[&.mp-typography]:text-mp-headline-large",h3:"[&.mp-typography]:text-mp-headline-medium",h4:"[&.mp-typography]:text-mp-headline-small",h5:"[&.mp-typography]:text-mp-title-large",h6:"[&.mp-typography]:text-mp-title-medium",lead:"[&.mp-typography]:text-mp-title-large",body:"[&.mp-typography]:text-mp-body-large",caption:"[&.mp-typography]:text-mp-body-small",overline:"[&.mp-typography]:text-mp-label-small [&.mp-typography]:tracking-[0.08em] uppercase"},a={h1:"regular",h2:"regular",h3:"regular",h4:"regular",h5:"regular",h6:"medium",lead:"regular",body:"regular",caption:"regular",overline:"medium"},m={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",lead:"p",body:"p",caption:"span",overline:"span"},o=new Set(["caption","overline"]),y={h1:"[&.mp-typography]:mb-4",h2:"[&.mp-typography]:mb-3.5",h3:"[&.mp-typography]:mb-3",h4:"[&.mp-typography]:mb-2.5",h5:"[&.mp-typography]:mb-2",h6:"[&.mp-typography]:mb-2",lead:"[&.mp-typography]:mb-4",body:"[&.mp-typography]:mb-3",caption:"[&.mp-typography]:mb-2",overline:"[&.mp-typography]:mb-2"},h="[&.mp-typography]:mt-0 [&.mp-typography]:ms-0 [&.mp-typography]:me-0",l={regular:"[&.mp-typography]:font-normal",medium:"[&.mp-typography]:font-medium",semibold:"[&.mp-typography]:font-semibold",bold:"[&.mp-typography]:font-bold"},n={start:"text-start",center:"text-center",end:"text-end",justify:"text-justify"},g={1:"truncate",2:"line-clamp-2",3:"line-clamp-3",4:"line-clamp-4",5:"line-clamp-5",6:"line-clamp-6"};export const MPTypography=/*@__PURE__*/p.forwardRef(function({level:i="body",color:c,weight:d,align:s,lines:u,gutter:b=!1,render:x,className:f,style:v,children:j,...w},N){const k=["mp-typography",r[i],l[d??a[i]],h,b?y[i]:"[&.mp-typography]:mb-0",s?n[s]:"",u?g[u]??"line-clamp-6":"",c?"[&.mp-typography]:text-(--_mp-accent)":o.has(i)?"[&.mp-typography]:text-mp-on-surface-variant":"[&.mp-typography]:text-mp-on-surface",f??""].filter(Boolean).join(" ");return t({render:x??p.createElement(m[i]),ref:N,props:{className:k,style:c?{...e(c),...v}:v,children:j,...w}})});
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./types";export*from"./constants/icons";export*from"./components/accordion";export*from"./components/alert";export*from"./components/animate-appear";export*from"./components/animate-blink";export*from"./components/animate-fade";export*from"./components/animate-grow";export*from"./components/animate-headline";export*from"./components/animate-lighting";export*from"./components/animate-marquee";export*from"./components/animate-rotate";export*from"./components/animate-slide";export*from"./components/animate-typing";export*from"./components/animate-zoom";export*from"./components/aspect-ratio";export*from"./components/avatar";export*from"./components/badge";export*from"./components/blockquote";export*from"./components/bottom-navigation";export*from"./components/box";export*from"./components/breadcrumb";export*from"./components/button";export*from"./components/button-group";export*from"./components/card";export*from"./components/carousel";export*from"./components/chat-bubble";export*from"./components/checkbox";export*from"./components/chip";export*from"./components/collapsible";export*from"./components/color-picker";export*from"./components/combobox";export*from"./components/container";export*from"./components/date-picker";export*from"./components/date-range-picker";export*from"./components/date-time-picker";export*from"./components/dialog";export*from"./components/divider";export*from"./components/drawer";export*from"./components/empty";export*from"./components/file-picker";export*from"./components/floating-action-button";export*from"./components/grid";export*from"./components/highlight";export*from"./components/icon";export*from"./components/icon-button";export*from"./components/list";export*from"./components/locale";export*from"./components/menu";export*from"./components/number-field";export*from"./components/otp-field";export*from"./components/overlay";export*from"./components/pagination";export*from"./components/panes";export*from"./components/pill";export*from"./components/popover";export*from"./components/progress-box";export*from"./components/progress-circular";export*from"./components/progress-linear";export*from"./components/radio-group";export*from"./components/rating";export*from"./components/segmented-button";export*from"./components/select";export*from"./components/shortcut";export*from"./components/skeleton";export*from"./components/slider";export*from"./components/snackbar";export*from"./components/spoiler";export*from"./components/switch";export*from"./components/table";export*from"./components/tabs";export*from"./components/text-field";export*from"./components/text-link";export*from"./components/time-picker";export*from"./components/timeline";export*from"./components/tooltip";export*from"./components/typography";
|
|
1
|
+
export*from"./types";export{registerMPMessages}from"./internal/i18n";export*from"./constants/icons";export*from"./components/accordion";export*from"./components/alert";export*from"./components/animate-appear";export*from"./components/animate-blink";export*from"./components/animate-fade";export*from"./components/animate-grow";export*from"./components/animate-headline";export*from"./components/animate-lighting";export*from"./components/animate-marquee";export*from"./components/animate-rotate";export*from"./components/animate-slide";export*from"./components/animate-typing";export*from"./components/animate-zoom";export*from"./components/aspect-ratio";export*from"./components/avatar";export*from"./components/badge";export*from"./components/blockquote";export*from"./components/bottom-navigation";export*from"./components/box";export*from"./components/breadcrumb";export*from"./components/button";export*from"./components/button-group";export*from"./components/card";export*from"./components/carousel";export*from"./components/chat-bubble";export*from"./components/checkbox";export*from"./components/chip";export*from"./components/collapsible";export*from"./components/color-picker";export*from"./components/combobox";export*from"./components/container";export*from"./components/date-picker";export*from"./components/date-range-picker";export*from"./components/date-time-picker";export*from"./components/dialog";export*from"./components/divider";export*from"./components/drawer";export*from"./components/empty";export*from"./components/file-picker";export*from"./components/floating-action-button";export*from"./components/grid";export*from"./components/highlight";export*from"./components/icon";export*from"./components/icon-button";export*from"./components/list";export*from"./components/locale";export*from"./components/menu";export*from"./components/number-field";export*from"./components/otp-field";export*from"./components/overlay";export*from"./components/pagination";export*from"./components/panes";export*from"./components/pill";export*from"./components/popover";export*from"./components/progress-box";export*from"./components/progress-circular";export*from"./components/progress-linear";export*from"./components/radio-group";export*from"./components/rating";export*from"./components/segmented-button";export*from"./components/select";export*from"./components/shortcut";export*from"./components/skeleton";export*from"./components/slider";export*from"./components/snackbar";export*from"./components/spoiler";export*from"./components/switch";export*from"./components/table";export*from"./components/tabs";export*from"./components/text-field";export*from"./components/text-link";export*from"./components/time-picker";export*from"./components/timeline";export*from"./components/tooltip";export*from"./components/typography";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as o,Fragment as t}from"react/jsx-runtime";import*as n from"react";import{MPButton as r}from"../components/button/MPButton";import{MPIcon as l}from"../components/icon/MPIcon";import{MPIconButton as a}from"../components/icon-button/MPIconButton";import{ChevronDownIcon as s,ChevronLeftIcon as c,ChevronRightIcon as i}from"../constants/icons";import{MPStateLayer as u}from"./StateLayer";import{CONTROL_ICON as m,META_TEXT as d,PROSE_TEXT as h}from"./scale";import{VISUALLY_HIDDEN as p}from"./visually-hidden";import{addDays as f,addMonths as g,addYears as v,calendarWeeks as w,compareDay as x,dateFormatter as b,daysInMonth as y,isDayOutside as D,isMonthBeforeYear as S,isSameDay as M,isSameMonth as N,isValidDate as P,makeDate as C,meridiemLabels as _,monthLabels as k,startOfDay as z,startOfMonth as F,today as Y,weekdayLabels as A,withTime as j,YEAR_PAGE_SIZE as E,yearPageStart as B}from"./date";const R={xs:"1.75rem",sm:"2rem",md:"2.5rem",lg:"2.75rem",xl:"3rem"},T={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"},$=["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 H({children:t,label:n,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 o("button",{type:"button",role:"gridcell","aria-label":n,"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:[$,"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:p,onKeyDown:f,children:[i?null:e(u,{}),t]})}function K({size:n,color:u,view:d,month:p,locale:f,labels:g,showPreviousButton:v,showNextButton:w,onStep:x,onViewChange:b}){const y=k(f,"long")[p.getMonth()],D=String(p.getFullYear()),M=S(f),N=T[n],P="day"===d?[g.previousMonth,g.nextMonth]:"month"===d?[g.previousYear,g.nextYear]:[g.previousYears,g.nextYears],C=(o,t)=>t?e(a,{size:N,color:u,label:P[-1===o?0:1],icon:e(l,{icon:-1===o?c:i,size:m[N],className:"rtl:rotate-180"}),onClick:()=>x(o)}):e("span",{"aria-hidden":"true",className:"size-(--_mp-cell)"}),_=o=>e(l,{icon:s,size:m[N],className:["transition-transform duration-(--mp-sys-motion-duration-short4)",o?"rotate-180":""].filter(Boolean).join(" ")}),z=e(r,{variant:"text",size:N,color:u,"aria-label":g.chooseMonth,"aria-expanded":"month"===d,endIcon:_("month"===d),onClick:()=>b("month"===d?"day":"month"),children:y},"month"),F=e(r,{variant:"text",size:N,color:u,className:"tabular-nums","aria-label":g.chooseYear,"aria-expanded":"year"===d,endIcon:_("year"===d),onClick:()=>b("year"===d?"day":"year"),children:D},"year"),Y=B(p.getFullYear());return o("div",{className:"flex items-center justify-between gap-1",children:[C(-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[n]}`,children:`${Y}–${Y+E-1}`}):"month"===d?F:o(t,M?{children:[z,F]}:{children:[F,z]})}),C(1,w)]})}export function MPCalendar({size:t,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:w,showOutsideDays:x=!0,autoFocus:b=!1,showPreviousButton:y=!0,showNextButton:S=!0,labels:M}){const[_,k]=n.useState("day"),A=n.useMemo(()=>i.filter(P),[i]),[j,B]=n.useState(()=>{const e=A.find(e=>N(e,s));return e?z(e):N(Y(),s)?Y():F(s)}),T=n.useRef(b),$=n.useRef(null);n.useEffect(()=>{B(e=>N(e,s)?e:F(s))},[s]),n.useLayoutEffect(()=>{T.current&&(T.current=!1,$.current?.querySelector('[data-focus-target="true"]')?.focus({preventScroll:!0}))});const H=n.useCallback(e=>D(e,p,f)||(w?.(e)??!1),[p,f,w]),q=e=>{T.current=!0,k(e)},I=e=>{T.current=!0,c(e)};return o("div",{ref:$,className:"mp-calendar flex flex-col gap-1",style:{"--_mp-cell":R[t]},onPointerLeave:()=>h?.(null),children:[e(K,{size:t,color:r,view:_,month:s,locale:l,labels:M,showPreviousButton:y,showNextButton:S,onStep:e=>{c("day"===_?g(s,e):v(s,"month"===_?e:e*E))},onViewChange:q}),e("div",{className:"h-[calc(var(--_mp-cell)*7)] w-[calc(var(--_mp-cell)*7)]",children:"day"===_?e(L,{size:t,locale:l,weekStartsOn:a,month:s,chosen:A,rangeStart:u,rangeEnd:m,focusedDate:j,showOutsideDays:x,isDisabled:H,onSelect:e=>{B(e),d(e)},onPreviewChange:h,onMoveFocus:e=>{T.current=!0,B(e),N(e,s)||c(F(e))}}):"month"===_?e(O,{size:t,locale:l,month:s,chosen:A,minDate:p,maxDate:f,onMoveCursor:I,onPick:e=>{c(C(s.getFullYear(),e,1)),q("day")}}):e(U,{size:t,month:s,chosen:A,minDate:p,maxDate:f,onMoveCursor:I,onPick:e=>{c(C(e,s.getMonth(),1)),q("month")}})})]})}function L({size:t,locale:r,weekStartsOn:l,month:a,chosen:s,rangeStart:c,rangeEnd:i,focusedDate:u,showOutsideDays:m,isDisabled:p,onSelect:v,onPreviewChange:y,onMoveFocus:D}){const S=A(r,l,"narrow"),C=A(r,l,"long"),_=(z=i,P(k=c)&&P(z)?x(k,z)<=0?[k,z]:[z,k]:null);var k,z;const F=Y(),j=n.useMemo(()=>{const e=b(r,{dateStyle:"full"});return w(a,l).map(o=>o.map(o=>({date:o,label:e.format(o)})))},[a,l,r]);return o("div",{role:"grid","aria-label":b(r,{year:"numeric",month:"long"}).format(a),className:"flex h-full flex-col",children:[e("div",{role:"row",className:"grid grid-cols-7",children:S.map((o,t)=>e("span",{role:"columnheader","aria-label":C[t],className:`text-mp-on-surface-variant flex h-(--_mp-cell) items-center justify-center select-none ${d}`,children:o},t))}),j.map((o,n)=>e("div",{role:"row",className:"grid grid-cols-7",children:o.map(({date:o,label:n})=>{const r=!N(o,a);if(r&&!m)return e("span",{role:"gridcell","aria-hidden":"true",className:"size-(--_mp-cell)"},o.getTime());const c=s.some(e=>M(e,o)),i=null!==_&&x(o,_[0])>=0&&x(o,_[1])<=0,d=null!==_&&i&&M(o,_[0]),w=null!==_&&i&&M(o,_[1]);return e(H,{label:n,selected:c,inRange:i&&!c,rangeEdge:i?d&&w?"both":d?"start":w?"end":"middle":null,current:M(o,F)&&!c,muted:r,disabled:p(o),focused:M(o,u),className:`size-(--_mp-cell) ${h[t]}`,onClick:()=>v(o),onPointerEnter:()=>y?.(o),onKeyDown:e=>((e,o)=>{const t=(o.getDay()-l+7)%7,n={ArrowLeft:()=>f(o,-1),ArrowRight:()=>f(o,1),ArrowUp:()=>f(o,-7),ArrowDown:()=>f(o,7),Home:()=>f(o,-t),End:()=>f(o,6-t),PageUp:()=>g(o,e.shiftKey?-12:-1),PageDown:()=>g(o,e.shiftKey?12:1)}[e.key];n&&(e.preventDefault(),D(n()))})(e,o),children:o.getDate()},o.getTime())})},n))]})}function O({size:o,locale:t,month:n,chosen:r,minDate:l,maxDate:a,onMoveCursor:s,onPick:c}){const i=k(t,"short"),u=k(t,"long"),m=n.getFullYear(),d=new Date,p=e=>{const o={ArrowLeft:-1,ArrowRight:1,ArrowUp:-3,ArrowDown:3,PageUp:-12,PageDown:12}[e.key];void 0!==o&&(e.preventDefault(),s(g(F(n),o)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2,3].map(t=>e("div",{role:"row",className:"grid grid-cols-3 gap-1",children:[0,1,2].map(s=>{const f=3*t+s,g=C(m,f,1),v=C(m,f,y(m,f));return e(H,{label:`${u[f]} ${m}`,selected:r.some(e=>e.getFullYear()===m&&e.getMonth()===f),current:d.getFullYear()===m&&d.getMonth()===f,disabled:P(l)&&x(v,l)<0||P(a)&&x(g,a)>0,focused:f===n.getMonth(),className:`h-(--_mp-cell) w-full ${h[o]}`,onClick:()=>c(f),onKeyDown:p,children:i[f]},f)})},t))})}function U({size:o,month:t,chosen:n,minDate:r,maxDate:l,onMoveCursor:a,onPick:s}){const c=B(t.getFullYear()),i=(new Date).getFullYear(),u=e=>{const o={ArrowLeft:-1,ArrowRight:1,ArrowUp:-4,ArrowDown:4,PageUp:-E,PageDown:E}[e.key];void 0!==o&&(e.preventDefault(),a(v(F(t),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(H,{label:String(d),selected:n.some(e=>e.getFullYear()===d),current:d===i,disabled:P(r)&&d<r.getFullYear()||P(l)&&d>l.getFullYear(),focused:d===t.getFullYear(),className:`h-(--_mp-cell) w-full ${h[o]}`,onClick:()=>s(d),onKeyDown:u,children:d},d)})},a))})}function q(e){const o=e.parentElement;if(!o)return;const t=e.getBoundingClientRect(),n=o.getBoundingClientRect(),r=t.top-n.top-o.clientTop+o.scrollTop,l=r+t.height;r<o.scrollTop?o.scrollTop=r:l>o.scrollTop+o.clientHeight&&(o.scrollTop=l-o.clientHeight)}export function MPTimeGrid({size:t,locale:r,value:l,referenceDate:a,onChange:s,hour12:c,showSeconds:i,hourStep:m,minuteStep:d,secondStep:f,shouldDisableTime:g,autoFocus:v=!1,labels:w}){const x=l??a,y=n.useRef(null),[D,S]=n.useMemo(()=>_(r),[r]);n.useEffect(()=>{const e=y.current;if(e?.querySelectorAll('[data-chosen="true"]').forEach(q),v){const o=e?.querySelector('[role="listbox"]');(o?.querySelector('[data-chosen="true"]')??o?.querySelector('[role="option"]'))?.focus({preventScroll:!0})}},[v]);const M=n.useMemo(()=>{const e=Math.ceil((c?12:24)/m),o=Array.from({length:e},(e,o)=>o*m);return c?o.map(e=>0===e?12:e):o},[c,m]),N=n.useMemo(()=>Array.from({length:Math.ceil(60/d)},(e,o)=>o*d),[d]),P=n.useMemo(()=>Array.from({length:Math.ceil(60/f)},(e,o)=>o*f),[f]),C=e=>String(e).padStart(2,"0"),k=c?x.getHours()%12||12:x.getHours(),z=(n,r,a,i,m)=>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(" "),children:a.map(r=>{const a=((e,o)=>j(x,"hour"===e?{hours:c?o%12+(x.getHours()>=12?12:0):o}:"minute"===e?{minutes:o}:"second"===e?{seconds:o}:{hours:x.getHours()%12+12*o}))(n,r),d=null!==l&&i(r),p=g?.(a,n)??!1;return o("button",{type:"button",role:"option","aria-selected":d,"aria-disabled":p||void 0,"data-chosen":d?"true":void 0,className:[$,"rounded-mp-full h-(--_mp-cell) w-full shrink-0",h[t],p?"cursor-default text-mp-on-surface/38":d?"bg-(--_mp-accent) text-(--_mp-on-accent)":"text-mp-on-surface"].join(" "),onClick:()=>{p||s(a)},children:[p?null:e(u,{}),m(r)]},r)})},n);return o("div",{ref:y,className:"mp-time-grid flex gap-1",style:{"--_mp-cell":R[t]},children:[z("hour",w.hour,M,e=>e===k,e=>c?String(e):C(e)),z("minute",w.minute,N,e=>e===x.getMinutes(),C),i?z("second",w.second,P,e=>e===x.getSeconds(),C):null,c?z("meridiem",w.meridiem,[0,1],e=>(x.getHours()>=12?1:0)===e,e=>0===e?D:S):null,e("span",{className:p,"aria-live":"polite",children:null===l?"":b(r,{hour:"numeric",minute:"2-digit",...i?{second:"2-digit"}:{}}).format(l)})]})}
|
|
1
|
+
import{jsx as e,jsxs as o,Fragment as t}from"react/jsx-runtime";import*as n from"react";import{MPButton as r}from"../components/button/MPButton";import{MPIcon as l}from"../components/icon/MPIcon";import{MPIconButton as a}from"../components/icon-button/MPIconButton";import{ChevronDownIcon as s,ChevronLeftIcon as c,ChevronRightIcon as i}from"../constants/icons";import{MPStateLayer as u}from"./StateLayer";import{CONTROL_ICON as m,META_TEXT as d,PROSE_TEXT as h}from"./scale";import{VISUALLY_HIDDEN as p}from"./visually-hidden";import{addDays as f,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 N,isSameMonth as M,isValidDate as P,makeDate as _,meridiemLabels as C,monthLabels as k,startOfDay as z,startOfMonth as F,today as Y,weekdayLabels as A,withTime as E,YEAR_PAGE_SIZE as j,yearPageStart as B}from"./date";const R={xs:"1.75rem",sm:"2rem",md:"2.5rem",lg:"2.75rem",xl:"3rem"},T={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"},$=["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 H({children:t,label:n,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 o("button",{type:"button",role:"gridcell","aria-label":n,"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:[$,"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:p,onKeyDown:f,children:[i?null:e(u,{}),t]})}function K({size:n,color:u,view:d,month:p,locale:f,labels:g,showPreviousButton:v,showNextButton:y,onStep:w,onViewChange:x}){const b=k(f,"long")[p.getMonth()],D=String(p.getFullYear()),N=S(f),M=T[n],P="day"===d?[g.previousMonth,g.nextMonth]:"month"===d?[g.previousYear,g.nextYear]:[g.previousYears,g.nextYears],_=(o,t)=>t?e(a,{size:M,color:u,label:P[-1===o?0:1],icon:e(l,{icon:-1===o?c:i,size:m[M],className:"rtl:rotate-180"}),onClick:()=>w(o)}):e("span",{"aria-hidden":"true",className:"size-(--_mp-cell)"}),C=o=>e(l,{icon:s,size:m[M],className:["transition-transform duration-(--mp-sys-motion-duration-short4)",o?"rotate-180":""].filter(Boolean).join(" ")}),z=e(r,{variant:"text",size:M,color:u,"aria-label":g.chooseMonth,"aria-expanded":"month"===d,endIcon:C("month"===d),onClick:()=>x("month"===d?"day":"month"),children:b},"month"),F=e(r,{variant:"text",size:M,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"),Y=B(p.getFullYear());return o("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[n]}`,children:`${Y}–${Y+j-1}`}):"month"===d?F:o(t,N?{children:[z,F]}:{children:[F,z]})}),_(1,y)]})}export function MPCalendar({size:t,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:y,showOutsideDays:w=!0,autoFocus:x=!1,showPreviousButton:b=!0,showNextButton:S=!0,labels:N}){const[C,k]=n.useState("day"),A=n.useMemo(()=>i.filter(P),[i]),[E,B]=n.useState(()=>{const e=A.find(e=>M(e,s));return e?z(e):M(Y(),s)?Y():F(s)}),T=n.useRef(x),$=n.useRef(null);n.useEffect(()=>{B(e=>M(e,s)?e:F(s))},[s]),n.useLayoutEffect(()=>{T.current&&(T.current=!1,$.current?.querySelector('[data-focus-target="true"]')?.focus({preventScroll:!0}))});const H=n.useCallback(e=>D(e,p,f)||(y?.(e)??!1),[p,f,y]),q=e=>{T.current=!0,k(e)},I=e=>{T.current=!0,c(e)};return o("div",{ref:$,className:"mp-calendar flex flex-col gap-1",style:{"--_mp-cell":R[t]},onPointerLeave:()=>h?.(null),children:[e(K,{size:t,color:r,view:C,month:s,locale:l,labels:N,showPreviousButton:b,showNextButton:S,onStep:e=>{c("day"===C?g(s,e):v(s,"month"===C?e:e*j))},onViewChange:q}),e("div",{className:"h-[calc(var(--_mp-cell)*7)] w-[calc(var(--_mp-cell)*7)]",children:"day"===C?e(L,{size:t,locale:l,weekStartsOn:a,month:s,chosen:A,rangeStart:u,rangeEnd:m,focusedDate:E,showOutsideDays:w,isDisabled:H,onSelect:e=>{B(e),d(e)},onPreviewChange:h,onMoveFocus:e=>{T.current=!0,B(e),M(e,s)||c(F(e))}}):"month"===C?e(O,{size:t,locale:l,month:s,chosen:A,minDate:p,maxDate:f,onMoveCursor:I,onPick:e=>{c(_(s.getFullYear(),e,1)),q("day")}}):e(U,{size:t,month:s,chosen:A,minDate:p,maxDate:f,onMoveCursor:I,onPick:e=>{c(_(e,s.getMonth(),1)),q("month")}})})]})}function L({size:t,locale:r,weekStartsOn:l,month:a,chosen:s,rangeStart:c,rangeEnd:i,focusedDate:u,showOutsideDays:m,isDisabled:p,onSelect:v,onPreviewChange:b,onMoveFocus:D}){const S=A(r,l,"narrow"),_=A(r,l,"long"),C=(z=i,P(k=c)&&P(z)?w(k,z)<=0?[k,z]:[z,k]:null);var k,z;const F=Y(),E=n.useMemo(()=>{const e=x(r,{dateStyle:"full"});return y(a,l).map(o=>o.map(o=>({date:o,label:e.format(o)})))},[a,l,r]),j=n.useRef(null),B=n.useRef(a);n.useLayoutEffect(()=>{const e=j.current,o=B.current;if(B.current=a,!e||M(o,a))return;const t=o.getTime()<a.getTime(),n="rtl"===getComputedStyle(e).direction;e.style.setProperty("--_mp-calendar-from",String(t===n?-1:1)),e.dataset.mpPaged="true",e.style.animationName="none",e.offsetWidth,e.style.animationName=""},[a]);return o("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((o,t)=>e("span",{role:"columnheader","aria-label":_[t],className:`text-mp-on-surface-variant flex h-(--_mp-cell) items-center justify-center select-none ${d}`,children:o},t))})}),e("div",{ref:j,role:"rowgroup",className:"mp-calendar__page flex flex-1 flex-col",children:E.map((o,n)=>e("div",{role:"row",className:"grid grid-cols-7",children:o.map(({date:o,label:n})=>{const r=!M(o,a);if(r&&!m)return e("span",{role:"gridcell","aria-hidden":"true",className:"size-(--_mp-cell)"},o.getTime());const c=s.some(e=>N(e,o)),i=null!==C&&w(o,C[0])>=0&&w(o,C[1])<=0,d=null!==C&&i&&N(o,C[0]),y=null!==C&&i&&N(o,C[1]);return e(H,{label:n,selected:c,inRange:i&&!c,rangeEdge:i?d&&y?"both":d?"start":y?"end":"middle":null,current:N(o,F)&&!c,muted:r,disabled:p(o),focused:N(o,u),className:`size-(--_mp-cell) ${h[t]}`,onClick:()=>v(o),onPointerEnter:()=>b?.(o),onKeyDown:e=>((e,o)=>{const t=(o.getDay()-l+7)%7,n={ArrowLeft:()=>f(o,-1),ArrowRight:()=>f(o,1),ArrowUp:()=>f(o,-7),ArrowDown:()=>f(o,7),Home:()=>f(o,-t),End:()=>f(o,6-t),PageUp:()=>g(o,e.shiftKey?-12:-1),PageDown:()=>g(o,e.shiftKey?12:1)}[e.key];n&&(e.preventDefault(),D(n()))})(e,o),children:o.getDate()},o.getTime())})},n))})]})}function O({size:o,locale:t,month:n,chosen:r,minDate:l,maxDate:a,onMoveCursor:s,onPick:c}){const i=k(t,"short"),u=k(t,"long"),m=n.getFullYear(),d=new Date,p=e=>{const o={ArrowLeft:-1,ArrowRight:1,ArrowUp:-3,ArrowDown:3,PageUp:-12,PageDown:12}[e.key];void 0!==o&&(e.preventDefault(),s(g(F(n),o)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2,3].map(t=>e("div",{role:"row",className:"grid grid-cols-3 gap-1",children:[0,1,2].map(s=>{const f=3*t+s,g=_(m,f,1),v=_(m,f,b(m,f));return e(H,{label:`${u[f]} ${m}`,selected:r.some(e=>e.getFullYear()===m&&e.getMonth()===f),current:d.getFullYear()===m&&d.getMonth()===f,disabled:P(l)&&w(v,l)<0||P(a)&&w(g,a)>0,focused:f===n.getMonth(),className:`h-(--_mp-cell) w-full ${h[o]}`,onClick:()=>c(f),onKeyDown:p,children:i[f]},f)})},t))})}function U({size:o,month:t,chosen:n,minDate:r,maxDate:l,onMoveCursor:a,onPick:s}){const c=B(t.getFullYear()),i=(new Date).getFullYear(),u=e=>{const o={ArrowLeft:-1,ArrowRight:1,ArrowUp:-4,ArrowDown:4,PageUp:-j,PageDown:j}[e.key];void 0!==o&&(e.preventDefault(),a(v(F(t),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(H,{label:String(d),selected:n.some(e=>e.getFullYear()===d),current:d===i,disabled:P(r)&&d<r.getFullYear()||P(l)&&d>l.getFullYear(),focused:d===t.getFullYear(),className:`h-(--_mp-cell) w-full ${h[o]}`,onClick:()=>s(d),onKeyDown:u,children:d},d)})},a))})}function q(e){const o=e.parentElement;if(!o)return;const t=e.getBoundingClientRect(),n=o.getBoundingClientRect(),r=t.top-n.top-o.clientTop+o.scrollTop,l=r+t.height;r<o.scrollTop?o.scrollTop=r:l>o.scrollTop+o.clientHeight&&(o.scrollTop=l-o.clientHeight)}export function MPTimeGrid({size:t,locale:r,value:l,referenceDate:a,onChange:s,hour12:c,showSeconds:i,hourStep:m,minuteStep:d,secondStep:f,shouldDisableTime:g,autoFocus:v=!1,labels:y}){const w=l??a,b=n.useRef(null),[D,S]=n.useMemo(()=>C(r),[r]);n.useEffect(()=>{const e=b.current;if(e?.querySelectorAll('[data-chosen="true"]').forEach(q),v){const o=e?.querySelector('[role="listbox"]');(o?.querySelector('[data-chosen="true"]')??o?.querySelector('[role="option"]'))?.focus({preventScroll:!0})}},[v]);const N=n.useMemo(()=>{const e=Math.ceil((c?12:24)/m),o=Array.from({length:e},(e,o)=>o*m);return c?o.map(e=>0===e?12:e):o},[c,m]),M=n.useMemo(()=>Array.from({length:Math.ceil(60/d)},(e,o)=>o*d),[d]),P=n.useMemo(()=>Array.from({length:Math.ceil(60/f)},(e,o)=>o*f),[f]),_=e=>String(e).padStart(2,"0"),k=c?w.getHours()%12||12:w.getHours(),z=(n,r,a,i,m)=>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(" "),children:a.map(r=>{const a=((e,o)=>E(w,"hour"===e?{hours:c?o%12+(w.getHours()>=12?12:0):o}:"minute"===e?{minutes:o}:"second"===e?{seconds:o}:{hours:w.getHours()%12+12*o}))(n,r),d=null!==l&&i(r),p=g?.(a,n)??!1;return o("button",{type:"button",role:"option","aria-selected":d,"aria-disabled":p||void 0,"data-chosen":d?"true":void 0,className:[$,"rounded-mp-full h-(--_mp-cell) w-full shrink-0",h[t],p?"cursor-default text-mp-on-surface/38":d?"bg-(--_mp-accent) text-(--_mp-on-accent)":"text-mp-on-surface"].join(" "),onClick:()=>{p||s(a)},children:[p?null:e(u,{}),m(r)]},r)})},n);return o("div",{ref:b,className:"mp-time-grid flex gap-1",style:{"--_mp-cell":R[t]},children:[z("hour",y.hour,N,e=>e===k,e=>c?String(e):_(e)),z("minute",y.minute,M,e=>e===w.getMinutes(),_),i?z("second",y.second,P,e=>e===w.getSeconds(),_):null,c?z("meridiem",y.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 +1 @@
|
|
|
1
|
-
import*as t from"react";export const MPButtonGroupContext
|
|
1
|
+
import*as t from"react";export const MPButtonGroupContext=/*@__PURE__*/t.createContext(null);
|
package/dist/internal/i18n.d.ts
CHANGED
|
@@ -20,11 +20,26 @@
|
|
|
20
20
|
*
|
|
21
21
|
* Every component that reads this takes a `locale` and an override prop for the
|
|
22
22
|
* strings themselves, so an unsupported language is never a dead end: `locale`
|
|
23
|
-
* gets you a translation
|
|
23
|
+
* gets you a translation, `MPLocaleProvider` gets you one for the whole
|
|
24
24
|
* application at once, and the prop gets you one for anything else.
|
|
25
25
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* ## Why English is the only table in this file
|
|
27
|
+
*
|
|
28
|
+
* The other eighteen live under `src/locales/`, and nothing in the library
|
|
29
|
+
* imports them. They used to be here, and being here is what made them cost
|
|
30
|
+
* something: a component that says one word — `MPButton` says *Loading* — held a
|
|
31
|
+
* static import chain down to a table of every string in every language, and a
|
|
32
|
+
* bundler cannot drop data that something imports. Twenty kilobytes, on every
|
|
33
|
+
* consumer, for a word.
|
|
34
|
+
*
|
|
35
|
+
* So the table arrives from the outside instead. `registerMPMessages` below is
|
|
36
|
+
* how, `material-plus-ui/locales` is where from, and the only thing that changed
|
|
37
|
+
* for a reader is that the application now names the languages it speaks. Once
|
|
38
|
+
* it has, `locale="ko"` resolves through exactly the path it always did.
|
|
39
|
+
*
|
|
40
|
+
* The public surface is `registerMPMessages`, `MPLocaleProvider` and the
|
|
41
|
+
* per-component `labels` props; `resolveMessages` and `fillMessage` stay
|
|
42
|
+
* internal.
|
|
28
43
|
*/
|
|
29
44
|
/**
|
|
30
45
|
* One namespace per component, rather than one flat list of keys.
|
|
@@ -210,6 +225,52 @@ export interface MPMessages {
|
|
|
210
225
|
notice: string;
|
|
211
226
|
};
|
|
212
227
|
}
|
|
228
|
+
/** A translation may fill in as much or as little of the table as it has. */
|
|
229
|
+
export type MPPartialMessages = {
|
|
230
|
+
[Namespace in keyof MPMessages]?: Partial<MPMessages[Namespace]>;
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* One language, ready to be handed to `registerMPMessages`.
|
|
234
|
+
*
|
|
235
|
+
* The tag travels with the table rather than beside it, so registering is
|
|
236
|
+
* `registerMPMessages(ko)` and not `registerMPMessages('ko', ko)` — one
|
|
237
|
+
* argument that cannot disagree with itself, and a shape an application can
|
|
238
|
+
* write by hand for a language this library does not ship.
|
|
239
|
+
*/
|
|
240
|
+
export interface MPLocale {
|
|
241
|
+
/**
|
|
242
|
+
* The BCP 47 tag this table answers to, lowercased on the way in.
|
|
243
|
+
*
|
|
244
|
+
* Broad rather than narrow: `pt` serves a reader who asked for `pt-BR`, and a
|
|
245
|
+
* table registered as `pt-BR` would not serve one who asked for `pt`.
|
|
246
|
+
*/
|
|
247
|
+
locale: string;
|
|
248
|
+
/**
|
|
249
|
+
* Other tags that should resolve to this same table.
|
|
250
|
+
*
|
|
251
|
+
* What `zh-hant` uses to answer for `zh-TW`, `zh-HK` and `zh-MO`: the same
|
|
252
|
+
* characters under three names, held once. An alias is registered with the
|
|
253
|
+
* table and disappears with it.
|
|
254
|
+
*/
|
|
255
|
+
aliases?: string[];
|
|
256
|
+
/** The strings. Anything left out falls back to English, a namespace at a time. */
|
|
257
|
+
messages: MPPartialMessages;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Teaches the library a language.
|
|
261
|
+
*
|
|
262
|
+
* Variadic because registering one is the common case and registering four is
|
|
263
|
+
* the next one, and neither should need a loop at the call site. Call it once,
|
|
264
|
+
* at startup, before anything renders: it is module-level state, and a table
|
|
265
|
+
* that arrives after a component has already resolved its strings would be a
|
|
266
|
+
* table that only takes effect at the next re-render.
|
|
267
|
+
*
|
|
268
|
+
* Registering a tag that is already registered replaces it, which is what makes
|
|
269
|
+
* `registerMPMessages({ locale: 'ko', messages: { common: { close: '나가기' } } })`
|
|
270
|
+
* a workable way to correct one word without forking a file — although a
|
|
271
|
+
* component's own `labels` prop is the lighter tool for that.
|
|
272
|
+
*/
|
|
273
|
+
export declare function registerMPMessages(...locales: MPLocale[]): void;
|
|
213
274
|
/**
|
|
214
275
|
* The strings for a locale, merged over English.
|
|
215
276
|
*
|
package/dist/internal/i18n.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={common:{close:"Close",clear:"Clear",open:"Open",remove:"Remove",removeNamed:"Remove {label}",loading:"Loading"},textField:{showPassword:"Show the password",hidePassword:"Hide the password"},empty:{title:"Nothing here"},picker:{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"},alert:{dismiss:"Dismiss"},chat:{sending:"Sending",sent:"Sent",delivered:"Delivered",read:"Read",failed:"Not sent",typing:"Typing"},spoiler:{reveal:"Reveal",hide:"Hide",notice:"Hidden so it is not read by accident"},pagination:{label:"Pagination",page:"Page {page}",status:"Page {page} of {total}",previous:"Previous page",next:"Next page",first:"First page",last:"Last page"},rating:{label:"Rating",value:"{value} out of {max}",empty:"Not rated"}},a={ko:{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:"종료"},alert:{dismiss:"닫기"},chat:{sending:"보내는 중",sent:"보냄",delivered:"전달됨",read:"읽음",failed:"전송 실패",typing:"입력 중"},spoiler:{reveal:"보기",hide:"가리기",notice:"실수로 읽지 않도록 가려 두었습니다"},pagination:{label:"페이지 매기기",page:"{page}페이지",status:"{total}페이지 중 {page}페이지",previous:"이전 페이지",next:"다음 페이지",first:"첫 페이지",last:"마지막 페이지"},rating:{label:"별점",value:"{max}점 만점에 {value}점",empty:"평가 없음"}},ja:{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:"終了"},alert:{dismiss:"閉じる"},chat:{sending:"送信中",sent:"送信済み",delivered:"配信済み",read:"既読",failed:"送信できませんでした",typing:"入力中"},spoiler:{reveal:"表示する",hide:"隠す",notice:"うっかり読まないように隠してあります"},pagination:{label:"ページ送り",page:"{page}ページ",status:"{total}ページ中{page}ページ",previous:"前のページ",next:"次のページ",first:"最初のページ",last:"最後のページ"},rating:{label:"評価",value:"{max}段階中{value}",empty:"未評価"}},"zh-hans":{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:"结束"},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:"{max} 分中的 {value} 分",empty:"未评分"}},"zh-hant":{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:"結束"},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:"{max} 分中的 {value} 分",empty:"未評分"}},es:{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"},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"}},pt:{common:{close:"Fechar",clear:"Limpar",open:"Abrir",remove:"Remover",removeNamed:"Remover {label}",loading:"Carregando"},textField:{showPassword:"Mostrar a senha",hidePassword:"Ocultar a senha"},empty:{title:"Não há nada aqui"},picker:{previousMonth:"Mês anterior",nextMonth:"Próximo mês",previousYear:"Ano anterior",nextYear:"Próximo ano",previousYears:"Anos anteriores",nextYears:"Próximos anos",chooseMonth:"Escolher um mês",chooseYear:"Escolher um ano",today:"Hoje",now:"Agora",clear:"Limpar",done:"Concluído",hour:"Hora",minute:"Minuto",second:"Segundo",meridiem:"AM/PM",start:"Início",end:"Fim"},alert:{dismiss:"Fechar"},chat:{sending:"Enviando",sent:"Enviado",delivered:"Entregue",read:"Lido",failed:"Não enviado",typing:"Digitando"},spoiler:{reveal:"Mostrar",hide:"Ocultar",notice:"Oculto para não ser lido por acidente"},pagination:{label:"Paginação",page:"Página {page}",status:"Página {page} de {total}",previous:"Página anterior",next:"Próxima página",first:"Primeira página",last:"Última página"},rating:{label:"Avaliação",value:"{value} de {max}",empty:"Sem avaliação"}},fr:{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"},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é"}},de:{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"},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"}},it:{common:{close:"Chiudi",clear:"Cancella",open:"Apri",remove:"Rimuovi",removeNamed:"Rimuovi {label}",loading:"Caricamento"},textField:{showPassword:"Mostra la password",hidePassword:"Nascondi la password"},empty:{title:"Non c'è nulla qui"},picker:{previousMonth:"Mese precedente",nextMonth:"Mese successivo",previousYear:"Anno precedente",nextYear:"Anno successivo",previousYears:"Anni precedenti",nextYears:"Anni successivi",chooseMonth:"Scegli un mese",chooseYear:"Scegli un anno",today:"Oggi",now:"Adesso",clear:"Cancella",done:"Fatto",hour:"Ora",minute:"Minuto",second:"Secondo",meridiem:"AM/PM",start:"Inizio",end:"Fine"},alert:{dismiss:"Chiudi"},chat:{sending:"Invio in corso",sent:"Inviato",delivered:"Consegnato",read:"Letto",failed:"Non inviato",typing:"Sta scrivendo"},spoiler:{reveal:"Mostra",hide:"Nascondi",notice:"Nascosto per non essere letto per sbaglio"},pagination:{label:"Impaginazione",page:"Pagina {page}",status:"Pagina {page} di {total}",previous:"Pagina precedente",next:"Pagina successiva",first:"Prima pagina",last:"Ultima pagina"},rating:{label:"Valutazione",value:"{value} su {max}",empty:"Non valutato"}},nl:{common:{close:"Sluiten",clear:"Wissen",open:"Openen",remove:"Verwijderen",removeNamed:"{label} verwijderen",loading:"Laden"},textField:{showPassword:"Wachtwoord tonen",hidePassword:"Wachtwoord verbergen"},empty:{title:"Hier is niets"},picker:{previousMonth:"Vorige maand",nextMonth:"Volgende maand",previousYear:"Vorig jaar",nextYear:"Volgend jaar",previousYears:"Vorige jaren",nextYears:"Volgende jaren",chooseMonth:"Kies een maand",chooseYear:"Kies een jaar",today:"Vandaag",now:"Nu",clear:"Wissen",done:"Klaar",hour:"Uur",minute:"Minuut",second:"Seconde",meridiem:"AM/PM",start:"Begin",end:"Einde"},alert:{dismiss:"Sluiten"},chat:{sending:"Verzenden",sent:"Verzonden",delivered:"Bezorgd",read:"Gelezen",failed:"Niet verzonden",typing:"Aan het typen"},spoiler:{reveal:"Tonen",hide:"Verbergen",notice:"Verborgen zodat het niet per ongeluk wordt gelezen"},pagination:{label:"Paginering",page:"Pagina {page}",status:"Pagina {page} van {total}",previous:"Vorige pagina",next:"Volgende pagina",first:"Eerste pagina",last:"Laatste pagina"},rating:{label:"Beoordeling",value:"{value} van {max}",empty:"Niet beoordeeld"}},pl:{common:{close:"Zamknij",clear:"Wyczyść",open:"Otwórz",remove:"Usuń",removeNamed:"Usuń {label}",loading:"Ładowanie"},textField:{showPassword:"Pokaż hasło",hidePassword:"Ukryj hasło"},empty:{title:"Nic tu nie ma"},picker:{previousMonth:"Poprzedni miesiąc",nextMonth:"Następny miesiąc",previousYear:"Poprzedni rok",nextYear:"Następny rok",previousYears:"Poprzednie lata",nextYears:"Następne lata",chooseMonth:"Wybierz miesiąc",chooseYear:"Wybierz rok",today:"Dzisiaj",now:"Teraz",clear:"Wyczyść",done:"Gotowe",hour:"Godzina",minute:"Minuta",second:"Sekunda",meridiem:"AM/PM",start:"Początek",end:"Koniec"},alert:{dismiss:"Zamknij"},chat:{sending:"Wysyłanie",sent:"Wysłano",delivered:"Dostarczono",read:"Przeczytano",failed:"Nie wysłano",typing:"Pisze"},spoiler:{reveal:"Pokaż",hide:"Ukryj",notice:"Ukryte, aby nie przeczytać przez przypadek"},pagination:{label:"Paginacja",page:"Strona {page}",status:"Strona {page} z {total}",previous:"Poprzednia strona",next:"Następna strona",first:"Pierwsza strona",last:"Ostatnia strona"},rating:{label:"Ocena",value:"{value} z {max}",empty:"Brak oceny"}},ru:{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:"Конец"},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:"Без оценки"}},tr:{common:{close:"Kapat",clear:"Temizle",open:"Aç",remove:"Kaldır",removeNamed:"{label} kaldır",loading:"Yükleniyor"},textField:{showPassword:"Parolayı göster",hidePassword:"Parolayı gizle"},empty:{title:"Burada bir şey yok"},picker:{previousMonth:"Önceki ay",nextMonth:"Sonraki ay",previousYear:"Önceki yıl",nextYear:"Sonraki yıl",previousYears:"Önceki yıllar",nextYears:"Sonraki yıllar",chooseMonth:"Ay seçin",chooseYear:"Yıl seçin",today:"Bugün",now:"Şimdi",clear:"Temizle",done:"Tamam",hour:"Saat",minute:"Dakika",second:"Saniye",meridiem:"ÖÖ/ÖS",start:"Başlangıç",end:"Bitiş"},alert:{dismiss:"Kapat"},chat:{sending:"Gönderiliyor",sent:"Gönderildi",delivered:"İletildi",read:"Okundu",failed:"Gönderilemedi",typing:"Yazıyor"},spoiler:{reveal:"Göster",hide:"Gizle",notice:"Yanlışlıkla okunmasın diye gizlendi"},pagination:{label:"Sayfalama",page:"Sayfa {page}",status:"{total} sayfadan {page}. sayfa",previous:"Önceki sayfa",next:"Sonraki sayfa",first:"İlk sayfa",last:"Son sayfa"},rating:{label:"Değerlendirme",value:"{max} üzerinden {value}",empty:"Değerlendirilmedi"}},ar:{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:"النهاية"},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:"بدون تقييم"}},hi:{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:"AM/PM",start:"प्रारंभ",end:"समाप्ति"},alert:{dismiss:"बंद करें"},chat:{sending:"भेजा जा रहा है",sent:"भेजा गया",delivered:"पहुँच गया",read:"पढ़ लिया गया",failed:"नहीं भेजा गया",typing:"टाइप कर रहे हैं"},spoiler:{reveal:"दिखाएँ",hide:"छिपाएँ",notice:"गलती से न पढ़ लिया जाए इसलिए छिपाया गया है"},pagination:{label:"पृष्ठ क्रमांकन",page:"पृष्ठ {page}",status:"{total} में से पृष्ठ {page}",previous:"पिछला पृष्ठ",next:"अगला पृष्ठ",first:"पहला पृष्ठ",last:"अंतिम पृष्ठ"},rating:{label:"रेटिंग",value:"{max} में से {value}",empty:"रेटिंग नहीं दी गई"}},id:{common:{close:"Tutup",clear:"Bersihkan",open:"Buka",remove:"Hapus",removeNamed:"Hapus {label}",loading:"Memuat"},textField:{showPassword:"Tampilkan kata sandi",hidePassword:"Sembunyikan kata sandi"},empty:{title:"Tidak ada apa-apa di sini"},picker:{previousMonth:"Bulan sebelumnya",nextMonth:"Bulan berikutnya",previousYear:"Tahun sebelumnya",nextYear:"Tahun berikutnya",previousYears:"Tahun-tahun sebelumnya",nextYears:"Tahun-tahun berikutnya",chooseMonth:"Pilih bulan",chooseYear:"Pilih tahun",today:"Hari ini",now:"Sekarang",clear:"Hapus",done:"Selesai",hour:"Jam",minute:"Menit",second:"Detik",meridiem:"AM/PM",start:"Mulai",end:"Akhir"},alert:{dismiss:"Tutup"},chat:{sending:"Mengirim",sent:"Terkirim",delivered:"Diterima",read:"Dibaca",failed:"Gagal terkirim",typing:"Sedang mengetik"},spoiler:{reveal:"Tampilkan",hide:"Sembunyikan",notice:"Disembunyikan agar tidak terbaca tanpa sengaja"},pagination:{label:"Penomoran halaman",page:"Halaman {page}",status:"Halaman {page} dari {total}",previous:"Halaman sebelumnya",next:"Halaman berikutnya",first:"Halaman pertama",last:"Halaman terakhir"},rating:{label:"Peringkat",value:"{value} dari {max}",empty:"Belum dinilai"}},vi:{common:{close:"Đóng",clear:"Xóa",open:"Mở",remove:"Gỡ bỏ",removeNamed:"Gỡ bỏ {label}",loading:"Đang tải"},textField:{showPassword:"Hiện mật khẩu",hidePassword:"Ẩn mật khẩu"},empty:{title:"Không có gì ở đây"},picker:{previousMonth:"Tháng trước",nextMonth:"Tháng sau",previousYear:"Năm trước",nextYear:"Năm sau",previousYears:"Các năm trước",nextYears:"Các năm sau",chooseMonth:"Chọn tháng",chooseYear:"Chọn năm",today:"Hôm nay",now:"Bây giờ",clear:"Xóa",done:"Xong",hour:"Giờ",minute:"Phút",second:"Giây",meridiem:"SA/CH",start:"Bắt đầu",end:"Kết thúc"},alert:{dismiss:"Đóng"},chat:{sending:"Đang gửi",sent:"Đã gửi",delivered:"Đã nhận",read:"Đã đọc",failed:"Chưa gửi được",typing:"Đang nhập"},spoiler:{reveal:"Hiện",hide:"Ẩn",notice:"Đã ẩn để không vô tình đọc phải"},pagination:{label:"Phân trang",page:"Trang {page}",status:"Trang {page} trên {total}",previous:"Trang trước",next:"Trang sau",first:"Trang đầu",last:"Trang cuối"},rating:{label:"Đánh giá",value:"{value} trên {max}",empty:"Chưa đánh giá"}},th:{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:"AM/PM",start:"เริ่ม",end:"สิ้นสุด"},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:"ยังไม่ได้ให้คะแนน"}}},n={zh:"zh-hans","zh-cn":"zh-hans","zh-my":"zh-hans","zh-sg":"zh-hans","zh-hk":"zh-hant","zh-mo":"zh-hant","zh-tw":"zh-hant"};const i=new Map([["",e]]);export function resolveMessages(t){const o=t?.trim()??"",r=i.get(o);if(r)return r;const s=function(e){const a=e.toLowerCase().split(/[-_]/).filter(Boolean),n=a[0];if(!n)return[];const i=a.slice(1),t=i.find(e=>/^[a-z]{4}$/.test(e)),o=i.find(e=>/^([a-z]{2}|\d{3})$/.test(e));return[t?`${n}-${t}`:"",o?`${n}-${o}`:"",n].filter(Boolean)}(o).map(e=>a[e]??a[n[e]??""]).find(Boolean),l=s?{common:{...e.common,...s.common},textField:{...e.textField,...s.textField},empty:{...e.empty,...s.empty},picker:{...e.picker,...s.picker},alert:{...e.alert,...s.alert},chat:{...e.chat,...s.chat},pagination:{...e.pagination,...s.pagination},rating:{...e.rating,...s.rating},spoiler:{...e.spoiler,...s.spoiler}}:e;return i.set(o,l),l}export function fillMessage(e,a){return e.replace(/\{(\w+)\}/g,(e,n)=>a[n]??e)}
|
|
1
|
+
const e={common:{close:"Close",clear:"Clear",open:"Open",remove:"Remove",removeNamed:"Remove {label}",loading:"Loading"},textField:{showPassword:"Show the password",hidePassword:"Hide the password"},empty:{title:"Nothing here"},picker:{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"},alert:{dismiss:"Dismiss"},chat:{sending:"Sending",sent:"Sent",delivered:"Delivered",read:"Read",failed:"Not sent",typing:"Typing"},spoiler:{reveal:"Reveal",hide:"Hide",notice:"Hidden so it is not read by accident"},pagination:{label:"Pagination",page:"Page {page}",status:"Page {page} of {total}",previous:"Previous page",next:"Next page",first:"First page",last:"Last page"},rating:{label:"Rating",value:"{value} out of {max}",empty:"Not rated"}},t=new Map;export function registerMPMessages(...a){for(const e of a){t.set(e.locale.toLowerCase(),e.messages);for(const o of e.aliases??[])t.set(o.toLowerCase(),e.messages)}o.clear(),o.set("",e)}const o=new Map([["",e]]);export function resolveMessages(a){const s=a?.trim()??"",n=o.get(s);if(n)return n;const r=function(e){const t=e.toLowerCase().split(/[-_]/).filter(Boolean),o=t[0];if(!o)return[];const a=t.slice(1),s=a.find(e=>/^[a-z]{4}$/.test(e)),n=a.find(e=>/^([a-z]{2}|\d{3})$/.test(e));return[s?`${o}-${s}`:"",n?`${o}-${n}`:"",o].filter(Boolean)}(s).map(e=>t.get(e)).find(Boolean),i=r?{common:{...e.common,...r.common},textField:{...e.textField,...r.textField},empty:{...e.empty,...r.empty},picker:{...e.picker,...r.picker},alert:{...e.alert,...r.alert},chat:{...e.chat,...r.chat},pagination:{...e.pagination,...r.pagination},rating:{...e.rating,...r.rating},spoiler:{...e.spoiler,...r.spoiler}}:e;return o.set(s,i),i}export function fillMessage(e,t){return e.replace(/\{(\w+)\}/g,(e,o)=>t[o]??e)}
|
package/dist/internal/locale.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{resolveMessages as t}from"./i18n";export const MPLocaleContext
|
|
1
|
+
import*as e from"react";import{resolveMessages as t}from"./i18n";export const MPLocaleContext=/*@__PURE__*/e.createContext(void 0);export function useMPLocale(t){const o=e.useContext(MPLocaleContext);return t??o}export function useMPMessages(o,n,r){return e.useMemo(()=>{const e=t(n)[o];return r?{...e,...r}:e},[o,n,r])}
|
package/dist/internal/menu.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as t from"react";export const MPMenuContext
|
|
1
|
+
import*as t from"react";export const MPMenuContext=/*@__PURE__*/t.createContext({size:"md",color:"primary"});
|