material-plus-ui 1.9.0 → 1.10.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.
Files changed (224) hide show
  1. package/README.md +2 -2
  2. package/dist/a2ui/extended/api.d.ts +4 -4
  3. package/dist/components/accordion/MPAccordion.d.ts +13 -0
  4. package/dist/components/accordion/MPAccordion.js +1 -1
  5. package/dist/components/accordion/index.d.ts +1 -1
  6. package/dist/components/animate-counter/MPAnimateCounter.js +1 -1
  7. package/dist/components/animate-headline/MPAnimateHeadline.d.ts +8 -0
  8. package/dist/components/animate-headline/MPAnimateHeadline.js +1 -1
  9. package/dist/components/animate-lighting/MPAnimateLighting.js +1 -1
  10. package/dist/components/animate-marquee/MPAnimateMarquee.js +1 -1
  11. package/dist/components/animate-scramble/MPAnimateScramble.d.ts +8 -0
  12. package/dist/components/animate-scramble/MPAnimateScramble.js +1 -1
  13. package/dist/components/animate-split/MPAnimateSplit.d.ts +8 -0
  14. package/dist/components/animate-split/MPAnimateSplit.js +1 -1
  15. package/dist/components/animate-typing/MPAnimateTyping.d.ts +10 -2
  16. package/dist/components/animate-typing/MPAnimateTyping.js +1 -1
  17. package/dist/components/app-logo/MPAppLogo.d.ts +6 -1
  18. package/dist/components/area-chart/MPAreaChart.js +1 -1
  19. package/dist/components/avatar/MPAvatar.d.ts +16 -0
  20. package/dist/components/avatar/MPAvatar.js +1 -1
  21. package/dist/components/bar-chart/MPBarChart.js +1 -1
  22. package/dist/components/breadcrumb/MPBreadcrumb.d.ts +8 -0
  23. package/dist/components/breadcrumb/MPBreadcrumb.js +1 -1
  24. package/dist/components/carousel/MPCarousel.js +1 -1
  25. package/dist/components/checkbox/MPCheckbox.js +1 -1
  26. package/dist/components/code-block/MPCodeBlock.js +1 -1
  27. package/dist/components/combobox/MPCombobox.js +1 -1
  28. package/dist/components/command-palette/MPCommandPalette.js +1 -1
  29. package/dist/components/config/MPConfigProvider.d.ts +17 -1
  30. package/dist/components/config/MPConfigProvider.js +1 -1
  31. package/dist/components/confirm/MPConfirmProvider.js +1 -1
  32. package/dist/components/data-table/MPDataTable.d.ts +0 -34
  33. package/dist/components/data-table/MPDataTable.js +1 -1
  34. package/dist/components/date-range-picker/MPDateRangePicker.js +1 -1
  35. package/dist/components/drawer/MPDrawer.d.ts +13 -1
  36. package/dist/components/drawer/MPDrawer.js +1 -1
  37. package/dist/components/file-picker/MPFilePicker.js +1 -1
  38. package/dist/components/form/MPForm.d.ts +3 -0
  39. package/dist/components/form/MPForm.js +1 -1
  40. package/dist/components/gauge-chart/MPGaugeChart.js +1 -1
  41. package/dist/components/header/MPHeader.js +1 -1
  42. package/dist/components/heatmap-chart/MPHeatmapChart.js +1 -1
  43. package/dist/components/image/MPImage.d.ts +5 -0
  44. package/dist/components/image/MPImage.js +1 -1
  45. package/dist/components/line-chart/MPLineChart.js +1 -1
  46. package/dist/components/locale/MPLocaleProvider.d.ts +15 -30
  47. package/dist/components/locale/MPLocaleProvider.js +1 -1
  48. package/dist/components/menu/MPMenu.d.ts +9 -1
  49. package/dist/components/menu/MPMenu.js +1 -1
  50. package/dist/components/meter/MPMeter.d.ts +5 -0
  51. package/dist/components/meter/MPMeter.js +1 -1
  52. package/dist/components/mockup/MPMockup.js +1 -1
  53. package/dist/components/navigation-menu/MPNavigationMenu.d.ts +27 -1
  54. package/dist/components/navigation-menu/MPNavigationMenu.js +1 -1
  55. package/dist/components/number-field/MPNumberField.d.ts +2 -1
  56. package/dist/components/number-field/MPNumberField.js +1 -1
  57. package/dist/components/otp-field/MPOtpField.js +1 -1
  58. package/dist/components/page-layout/MPPageLayout.js +1 -1
  59. package/dist/components/pagination/MPPagination.d.ts +8 -0
  60. package/dist/components/pagination/MPPagination.js +1 -1
  61. package/dist/components/panes/MPPanes.js +1 -1
  62. package/dist/components/pie-chart/MPPieChart.js +1 -1
  63. package/dist/components/pill/MPPill.js +1 -1
  64. package/dist/components/progress-box/MPProgressBox.js +1 -1
  65. package/dist/components/progress-circular/MPProgressCircular.js +1 -1
  66. package/dist/components/progress-linear/MPProgressLinear.js +1 -1
  67. package/dist/components/radio-group/MPRadioGroup.js +1 -1
  68. package/dist/components/scatter-chart/MPScatterChart.js +1 -1
  69. package/dist/components/sidebar/MPSidebar.d.ts +11 -0
  70. package/dist/components/sidebar/MPSidebar.js +1 -1
  71. package/dist/components/slider/MPSlider.d.ts +5 -0
  72. package/dist/components/slider/MPSlider.js +1 -1
  73. package/dist/components/snackbar/MPSnackbar.js +1 -1
  74. package/dist/components/switch/MPSwitch.js +1 -1
  75. package/dist/components/tabs/MPTabs.js +1 -1
  76. package/dist/components/text-field/MPTextField.js +1 -1
  77. package/dist/components/timeline-chart/MPTimelineChart.js +1 -1
  78. package/dist/components/tour/MPTour.js +1 -1
  79. package/dist/components/transfer/MPTransfer.js +1 -1
  80. package/dist/components/tree-select/MPTreeSelect.js +1 -1
  81. package/dist/components/tree-view/MPTreeView.d.ts +8 -0
  82. package/dist/components/tree-view/MPTreeView.js +1 -1
  83. package/dist/hooks/index.d.ts +4 -2
  84. package/dist/hooks/index.js +1 -1
  85. package/dist/hooks/mpColorSchemeScript.d.ts +46 -0
  86. package/dist/hooks/mpColorSchemeScript.js +1 -0
  87. package/dist/hooks/useMPColorScheme.d.ts +2 -47
  88. package/dist/hooks/useMPColorScheme.js +1 -1
  89. package/dist/hooks/useMPMediaQuery.js +1 -1
  90. package/dist/hooks/useMPOnScreen.js +1 -1
  91. package/dist/internal/Calendar.js +1 -1
  92. package/dist/internal/ChartChrome.d.ts +11 -2
  93. package/dist/internal/ChartChrome.js +1 -1
  94. package/dist/internal/ChartFrame.js +1 -1
  95. package/dist/internal/FieldOutline.d.ts +9 -1
  96. package/dist/internal/FieldOutline.js +1 -1
  97. package/dist/internal/RenderedLink.d.ts +20 -0
  98. package/dist/internal/RenderedLink.js +2 -0
  99. package/dist/internal/SupportingText.js +1 -1
  100. package/dist/internal/animate.d.ts +4 -0
  101. package/dist/internal/animate.js +1 -1
  102. package/dist/internal/box-size.d.ts +22 -0
  103. package/dist/internal/box-size.js +2 -0
  104. package/dist/internal/chart.d.ts +21 -11
  105. package/dist/internal/chart.js +1 -1
  106. package/dist/internal/color-scheme-keys.d.ts +13 -0
  107. package/dist/internal/color-scheme-keys.js +1 -0
  108. package/dist/internal/color-scheme.d.ts +11 -2
  109. package/dist/internal/color-scheme.js +1 -1
  110. package/dist/internal/config.d.ts +2 -0
  111. package/dist/internal/date.d.ts +2 -8
  112. package/dist/internal/date.js +1 -1
  113. package/dist/internal/highlight.js +1 -1
  114. package/dist/internal/i18n.d.ts +0 -53
  115. package/dist/internal/i18n.js +1 -1
  116. package/dist/internal/intersection.d.ts +50 -0
  117. package/dist/internal/intersection.js +2 -0
  118. package/dist/internal/intl.d.ts +22 -21
  119. package/dist/internal/intl.js +1 -1
  120. package/dist/internal/keys.d.ts +0 -9
  121. package/dist/internal/keys.js +1 -1
  122. package/dist/internal/layout-effect.d.ts +7 -0
  123. package/dist/internal/layout-effect.js +2 -0
  124. package/dist/internal/locale.d.ts +10 -2
  125. package/dist/internal/media.d.ts +1 -0
  126. package/dist/internal/media.js +1 -0
  127. package/dist/internal/occurrence.d.ts +18 -0
  128. package/dist/internal/occurrence.js +1 -0
  129. package/dist/internal/page-layout.js +1 -1
  130. package/dist/internal/progress.d.ts +5 -0
  131. package/dist/internal/ref.d.ts +9 -0
  132. package/dist/internal/ref.js +1 -0
  133. package/dist/internal/remember.d.ts +36 -0
  134. package/dist/internal/remember.js +1 -0
  135. package/dist/internal/surface.d.ts +7 -1
  136. package/dist/internal/surface.js +1 -1
  137. package/dist/internal/text.d.ts +10 -4
  138. package/dist/internal/text.js +1 -1
  139. package/dist/internal/window-class.d.ts +8 -0
  140. package/dist/internal/window-class.js +1 -1
  141. package/dist/styles/accordion.css +1 -1
  142. package/dist/styles/alert.css +1 -1
  143. package/dist/styles/animate-appear.css +1 -1
  144. package/dist/styles/animate-blink.css +1 -1
  145. package/dist/styles/animate-counter.css +1 -1
  146. package/dist/styles/animate-fade.css +1 -1
  147. package/dist/styles/animate-float.css +1 -1
  148. package/dist/styles/animate-grow.css +1 -1
  149. package/dist/styles/animate-headline.css +1 -1
  150. package/dist/styles/animate-lighting.css +1 -1
  151. package/dist/styles/animate-marquee.css +1 -1
  152. package/dist/styles/animate-reveal.css +1 -1
  153. package/dist/styles/animate-rotate.css +1 -1
  154. package/dist/styles/animate-scramble.css +1 -1
  155. package/dist/styles/animate-shake.css +1 -1
  156. package/dist/styles/animate-slide.css +1 -1
  157. package/dist/styles/animate-split.css +1 -1
  158. package/dist/styles/animate-typing.css +1 -1
  159. package/dist/styles/animate-zoom.css +1 -1
  160. package/dist/styles/avatar.css +1 -1
  161. package/dist/styles/blockquote.css +1 -1
  162. package/dist/styles/box.css +1 -1
  163. package/dist/styles/breadcrumb.css +1 -1
  164. package/dist/styles/calendar.css +1 -1
  165. package/dist/styles/card.css +1 -1
  166. package/dist/styles/carousel.css +1 -1
  167. package/dist/styles/checkbox.css +1 -1
  168. package/dist/styles/chip.css +1 -1
  169. package/dist/styles/collapsible.css +1 -1
  170. package/dist/styles/color-picker.css +1 -1
  171. package/dist/styles/combobox.css +1 -1
  172. package/dist/styles/command-palette.css +1 -1
  173. package/dist/styles/confirm.css +1 -1
  174. package/dist/styles/data-table.css +1 -1
  175. package/dist/styles/date-picker.css +1 -1
  176. package/dist/styles/date-range-picker.css +1 -1
  177. package/dist/styles/date-time-picker.css +1 -1
  178. package/dist/styles/dialog.css +1 -1
  179. package/dist/styles/drawer.css +1 -1
  180. package/dist/styles/empty.css +1 -1
  181. package/dist/styles/floating-bottom-navigation.css +1 -1
  182. package/dist/styles/footer.css +1 -1
  183. package/dist/styles/gauge-chart.css +1 -1
  184. package/dist/styles/header.css +1 -1
  185. package/dist/styles/highlight.css +1 -1
  186. package/dist/styles/hover-card.css +1 -1
  187. package/dist/styles/image.css +1 -1
  188. package/dist/styles/list.css +1 -1
  189. package/dist/styles/menu.css +1 -1
  190. package/dist/styles/menubar.css +1 -1
  191. package/dist/styles/meter.css +1 -1
  192. package/dist/styles/navigation-menu.css +1 -1
  193. package/dist/styles/number-field.css +1 -1
  194. package/dist/styles/otp-field.css +1 -1
  195. package/dist/styles/overlay.css +1 -1
  196. package/dist/styles/page-layout.css +1 -1
  197. package/dist/styles/pill.css +1 -1
  198. package/dist/styles/popconfirm.css +1 -1
  199. package/dist/styles/popover.css +1 -1
  200. package/dist/styles/progress-box.css +1 -1
  201. package/dist/styles/progress-circular.css +1 -1
  202. package/dist/styles/progress-linear.css +1 -1
  203. package/dist/styles/radio-group.css +1 -1
  204. package/dist/styles/select.css +1 -1
  205. package/dist/styles/sidebar.css +1 -1
  206. package/dist/styles/slider.css +1 -1
  207. package/dist/styles/snackbar.css +1 -1
  208. package/dist/styles/spoiler.css +1 -1
  209. package/dist/styles/stack.css +1 -1
  210. package/dist/styles/switch.css +1 -1
  211. package/dist/styles/table.css +1 -1
  212. package/dist/styles/tabs.css +1 -1
  213. package/dist/styles/text-field.css +1 -1
  214. package/dist/styles/time-picker.css +1 -1
  215. package/dist/styles/tokens.css +1 -1
  216. package/dist/styles/toolbar.css +1 -1
  217. package/dist/styles/tour.css +1 -1
  218. package/dist/styles/transfer.css +1 -1
  219. package/dist/styles/tree-select.css +1 -1
  220. package/dist/styles/tree-view.css +1 -1
  221. package/dist/styles/typography.css +1 -1
  222. package/dist/styles.css +1 -1
  223. package/dist/tailwind.css +116 -4
  224. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{MPIcon as n}from"../icon/MPIcon.js";import{CheckIcon as r,CodeIcon as i,CopyIcon as l}from"../../constants/icons.js";import{canonicalLanguage as a,highlightCode as s,plainLines as c}from"../../internal/highlight.js";import{cssLength as m}from"../../internal/length.js";import{useMPLocale as d,useMPMessages as p}from"../../internal/locale.js";import{CODE as u}from"../../internal/messages/code.js";import{META_TEXT as f,hasContent as g}from"../../internal/scale.js";import{VISUALLY_HIDDEN as x}from"../../internal/visually-hidden.js";import{useMPDensity as h,useMPSize as b}from"../../internal/config.js";export{registerMPLanguage}from"../../internal/highlight.js";const y={xs:"text-[0.6875rem]/[1.55]",sm:"text-[0.75rem]/[1.6]",md:"text-[0.8125rem]/[1.65]",lg:"text-[0.875rem]/[1.7]",xl:"text-[1rem]/[1.7]"},v={xs:8,sm:12,md:14,lg:16,xl:20},w={xs:8,sm:12,md:14,lg:16,xl:20},j={xs:4,sm:4,md:6,lg:8,xl:8};function N(e,t,o){return Math.max(o,e+2*t)}export const MPCodeBlock=/*@__PURE__*/o.forwardRef(function({code:k,language:_,theme:M="auto",size:S,density:$,highlight:L=!0,toolbar:T=!0,title:z,showLanguage:C=!0,copyable:F=!0,rawToggle:R=!1,markLines:A,lineNumbers:H=!1,startLine:K=1,prompt:B,wrap:E=!1,maxHeight:P,fontFamily:D,fontSize:I,lineHeight:q,locale:G,copyLabel:J,copiedLabel:O,rawLabel:Q,onCopy:U,className:V,style:W,...X},Y){const Z=b(S),ee=h($),te=p(u,d(G)),oe=o.useMemo(()=>k.replace(/\r\n?/g,"\n").replace(/\s+$/,""),[k]),ne=a(_),[re,ie]=o.useState(!1),[le,ae]=o.useState(null),[se,ce]=o.useState(null),me=L&&!re&&null!==ne;o.useEffect(()=>{if(!me||!ne)return void ce(null);let e=!1;return s(oe,ne).then(t=>{e||ce(t)},()=>{e||ce(null)}),()=>{e=!0}},[oe,ne,me]);const de=o.useMemo(()=>me&&se?se:c(oe),[me,se,oe]),pe=o.useMemo(()=>function(e){const t=new Set;if(void 0===e)return t;for(const o of Array.isArray(e)?e:[e])if("number"!=typeof o)for(const e of o.split(",")){const o=/^\s*(\d+)\s*(?:-\s*(\d+)\s*)?$/.exec(e);if(!o)continue;const n=Number(o[1]),r=void 0===o[2]?n:Number(o[2]);for(let e=Math.min(n,r);e<=Math.max(n,r);e+=1)t.add(e)}else Number.isFinite(o)&&t.add(Math.trunc(o));return t}(A),[A]),ue=o.useRef(void 0);o.useEffect(()=>()=>clearTimeout(ue.current),[]);const fe=o.useRef(null),ge=J??te.copy,xe=O??te.copied,he=Q??te.raw,be=/*@__PURE__*/["mp-code__button inline-flex shrink-0 cursor-pointer items-center gap-1 border-0","rounded-mp-xs bg-transparent px-1.5 py-1","text-(--mp-code-dim) hover:text-(--mp-code-fg) hover:bg-(--mp-code-hover)",f,"transition-[color,background-color] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard motion-reduce:transition-none","outline-(--mp-code-fg) focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none"].join(" "),ye=g(z)?"string"==typeof z?z:void 0:ne??te.label,ve=T&&(C||F||R||g(z));return t("div",{ref:Y,"data-mp-size":Z,"data-mp-code-theme":M,"data-mp-code-wrap":E?"true":void 0,className:["mp-code rounded-mp-md flex min-w-0 flex-col overflow-hidden","border-(--mp-code-rule) bg-(--mp-code-bg) text-(--mp-code-fg) border",V??""].filter(Boolean).join(" "),style:{"--mp-code-gutter":`${String(K+Math.max(de.length-1,0)).length}ch`,"--mp-code-pad-x":`${N(w[Z],ee,6)}px`,"--mp-code-pad-y":`${N(v[Z],ee,4)}px`,"--mp-code-bar-pad-y":`${N(j[Z],ee,2)}px`,...D?{fontFamily:D}:null,...void 0===I?null:{fontSize:m(I)},...void 0===q?null:{lineHeight:q},...W},...X,children:[ve?t("div",{className:["mp-code__bar border-(--mp-code-rule) flex min-w-0 items-center gap-1 border-b","px-[calc(var(--mp-code-pad-x)+2px)] py-(--mp-code-bar-pad-y)"].join(" "),children:[g(z)?e("span",{className:`mp-code__title min-w-0 truncate font-mono ${f}`,children:z}):null,C&&ne?e("span",{className:["mp-code__language text-(--mp-code-dim) min-w-0 truncate font-mono","tracking-wide uppercase select-none",f].join(" "),children:ne}):null,e("span",{className:"flex-1"}),R&&L?e("button",{type:"button","aria-pressed":re,"aria-label":he,title:he,onClick:()=>ie(e=>!e),className:[be,re?"bg-(--mp-code-hover) text-(--mp-code-fg)":""].filter(Boolean).join(" "),children:e(n,{icon:i,size:"1.15em"})}):null,F?t("button",{type:"button",onClick:async()=>{const e=await async function(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.cssText="position:fixed;top:0;left:0;opacity:0;pointer-events:none",document.body.append(t),t.select();const o=document.execCommand("copy");return t.remove(),o}catch{return!1}}(oe);clearTimeout(ue.current),ae(e),ue.current=setTimeout(()=>ae(null),2e3),e&&U?.(oe)},className:be,children:[e(n,{icon:le?r:l,size:"1.15em"}),e("span",{children:null===le?ge:le?xe:te.copyFailed})]}):null]}):null,e("div",{className:`mp-code__body flex min-h-0 flex-col ${y[Z]}`,children:e("div",{role:"region","aria-label":ye,tabIndex:0,onKeyDown:e=>{if("a"!==e.key&&"A"!==e.key)return;if(!e.metaKey&&!e.ctrlKey||e.altKey)return;const t=fe.current,o="undefined"==typeof window?null:window.getSelection();if(!t||!o)return;e.preventDefault();const n=document.createRange();n.selectNodeContents(t),o.removeAllRanges(),o.addRange(n)},className:["mp-code__scroller box-border min-h-0 overflow-auto py-(--mp-code-pad-y)","outline-(--mp-code-fg) focus-visible:outline-2 focus-visible:-outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),style:void 0===P?void 0:{maxHeight:m(P)},children:e("pre",{ref:fe,className:["m-0 bg-transparent p-0 font-mono",E?"w-full":"w-max min-w-full"].join(" "),children:de.map((t,n)=>{const r=K+n;return e("div",{className:"mp-code-line px-(--mp-code-pad-x)","data-line":H?r:void 0,"data-mark":pe.has(r)?"":void 0,"data-prompt":B&&t.length>0?B:void 0,children:e("code",{children:t.map((t,n)=>t.token?e("span",{className:t.token,children:t.text},n):e(o.Fragment,{children:t.text},n))})},n)})})})}),e("span",{"aria-live":"polite",className:x,children:null===le?"":le?xe:te.copyFailed})]})});
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{MPIcon as n}from"../icon/MPIcon.js";import{CheckIcon as r,CodeIcon as i,CopyIcon as l}from"../../constants/icons.js";import{canonicalLanguage as a,highlightCode as s,plainLines as c}from"../../internal/highlight.js";import{watchIntersection as m}from"../../internal/intersection.js";import{cssLength as d}from"../../internal/length.js";import{useMPLocale as p,useMPMessages as u}from"../../internal/locale.js";import{CODE as f}from"../../internal/messages/code.js";import{META_TEXT as g,hasContent as x}from"../../internal/scale.js";import{VISUALLY_HIDDEN as h}from"../../internal/visually-hidden.js";import{useMPDensity as b,useMPSize as y}from"../../internal/config.js";export{registerMPLanguage}from"../../internal/highlight.js";const v={xs:"text-[0.6875rem]/[1.55]",sm:"text-[0.75rem]/[1.6]",md:"text-[0.8125rem]/[1.65]",lg:"text-[0.875rem]/[1.7]",xl:"text-[1rem]/[1.7]"},w={xs:8,sm:12,md:14,lg:16,xl:20},j={xs:8,sm:12,md:14,lg:16,xl:20},N={xs:4,sm:4,md:6,lg:8,xl:8};function k(e,t,o){return Math.max(o,e+2*t)}export const MPCodeBlock=/*@__PURE__*/o.forwardRef(function({code:M,language:_,theme:S="auto",size:T,density:$,highlight:L=!0,toolbar:z=!0,title:C,showLanguage:F=!0,copyable:R=!0,rawToggle:A=!1,markLines:E,lineNumbers:H=!1,startLine:I=1,prompt:K,wrap:B=!1,maxHeight:P,fontFamily:D,fontSize:O,lineHeight:q,locale:G,copyLabel:J,copiedLabel:Q,rawLabel:U,onCopy:V,className:W,style:X,...Y},Z){const ee=y(T),te=b($),oe=u(f,p(G)),ne=o.useMemo(()=>M.replace(/\r\n?/g,"\n").replace(/\s+$/,""),[M]),re=a(_),[ie,le]=o.useState(!1),[ae,se]=o.useState(null),[ce,me]=o.useState(null),[de,pe]=o.useState(!1),ue=L&&!ie&&null!==re;o.useEffect(()=>{if(!ue||!re)return void me(null);if(!de)return;let e=!1;return s(ne,re).then(t=>{e||o.startTransition(()=>me(t))},()=>{e||me(null)}),()=>{e=!0}},[ne,re,ue,de]);const fe=o.useMemo(()=>ue&&ce?ce:c(ne),[ue,ce,ne]),ge=o.useMemo(()=>function(e){const t=new Set;if(void 0===e)return t;for(const o of Array.isArray(e)?e:[e])if("number"!=typeof o)for(const e of o.split(",")){const o=/^\s*(\d+)\s*(?:-\s*(\d+)\s*)?$/.exec(e);if(!o)continue;const n=Number(o[1]),r=void 0===o[2]?n:Number(o[2]);for(let e=Math.min(n,r);e<=Math.max(n,r);e+=1)t.add(e)}else Number.isFinite(o)&&t.add(Math.trunc(o));return t}(E),[E]),xe=o.useRef(void 0);o.useEffect(()=>()=>clearTimeout(xe.current),[]);const he=o.useRef(null);o.useEffect(()=>{const e=he.current;if(!de){if(e&&"undefined"!=typeof IntersectionObserver)return m(e,e=>{e.isIntersecting&&pe(!0)},{rootMargin:"100% 0px"});pe(!0)}},[de]);const be=J??oe.copy,ye=Q??oe.copied,ve=U??oe.raw,we=/*@__PURE__*/["mp-code__button inline-flex shrink-0 cursor-pointer items-center gap-1 border-0","rounded-mp-xs bg-transparent px-1.5 py-1","text-(--mp-code-dim) hover:text-(--mp-code-fg) hover:bg-(--mp-code-hover)",g,"transition-[color,background-color] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard motion-reduce:transition-none","outline-(--mp-code-fg) focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none"].join(" "),je=x(C)?"string"==typeof C?C:void 0:re??oe.label,Ne=z&&(F||R||A||x(C));return t("div",{ref:Z,"data-mp-size":ee,"data-mp-code-theme":S,"data-mp-code-wrap":B?"true":void 0,className:["mp-code rounded-mp-md flex min-w-0 flex-col overflow-hidden","border-(--mp-code-rule) bg-(--mp-code-bg) text-(--mp-code-fg) border",W??""].filter(Boolean).join(" "),style:{"--mp-code-gutter":`${String(I+Math.max(fe.length-1,0)).length}ch`,"--mp-code-pad-x":`${k(j[ee],te,6)}px`,"--mp-code-pad-y":`${k(w[ee],te,4)}px`,"--mp-code-bar-pad-y":`${k(N[ee],te,2)}px`,...D?{fontFamily:D}:null,...void 0===O?null:{fontSize:d(O)},...void 0===q?null:{lineHeight:q},...X},...Y,children:[Ne?t("div",{className:["mp-code__bar border-(--mp-code-rule) flex min-w-0 items-center gap-1 border-b","px-[calc(var(--mp-code-pad-x)+2px)] py-(--mp-code-bar-pad-y)"].join(" "),children:[x(C)?e("span",{className:`mp-code__title min-w-0 truncate font-mono ${g}`,children:C}):null,F&&re?e("span",{className:["mp-code__language text-(--mp-code-dim) min-w-0 truncate font-mono","tracking-wide uppercase select-none",g].join(" "),children:re}):null,e("span",{className:"flex-1"}),A&&L?e("button",{type:"button","aria-pressed":ie,"aria-label":ve,title:ve,onClick:()=>le(e=>!e),className:[we,ie?"bg-(--mp-code-hover) text-(--mp-code-fg)":""].filter(Boolean).join(" "),children:e(n,{icon:i,size:"1.15em"})}):null,R?t("button",{type:"button",onClick:async()=>{const e=await async function(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.cssText="position:fixed;top:0;left:0;opacity:0;pointer-events:none",document.body.append(t),t.select();const o=document.execCommand("copy");return t.remove(),o}catch{return!1}}(ne);clearTimeout(xe.current),se(e),xe.current=setTimeout(()=>se(null),2e3),e&&V?.(ne)},className:we,children:[e(n,{icon:ae?r:l,size:"1.15em"}),e("span",{children:null===ae?be:ae?ye:oe.copyFailed})]}):null]}):null,e("div",{className:`mp-code__body flex min-h-0 flex-col ${v[ee]}`,children:e("div",{role:"region","aria-label":je,tabIndex:0,onKeyDown:e=>{if("a"!==e.key&&"A"!==e.key)return;if(!e.metaKey&&!e.ctrlKey||e.altKey)return;const t=he.current,o="undefined"==typeof window?null:window.getSelection();if(!t||!o)return;e.preventDefault();const n=document.createRange();n.selectNodeContents(t),o.removeAllRanges(),o.addRange(n)},className:["mp-code__scroller box-border min-h-0 overflow-auto py-(--mp-code-pad-y)","outline-(--mp-code-fg) focus-visible:outline-2 focus-visible:-outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),style:void 0===P?void 0:{maxHeight:d(P)},children:e("pre",{ref:he,className:["m-0 bg-transparent p-0 font-mono",B?"w-full":"w-max min-w-full"].join(" "),children:fe.map((t,n)=>{const r=I+n;return e("div",{className:"mp-code-line px-(--mp-code-pad-x)","data-line":H?r:void 0,"data-mark":ge.has(r)?"":void 0,"data-prompt":K&&t.length>0?K:void 0,children:e("code",{children:t.map((t,n)=>t.token?e("span",{className:t.token,children:t.text},n):e(o.Fragment,{children:t.text},n))})},n)})})})}),e("span",{"aria-live":"polite",className:h,children:null===ae?"":ae?ye:oe.copyFailed})]})});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as n from"react";import{Combobox as o}from"@base-ui/react/combobox";import{Field as l}from"@base-ui/react/field";import{MPChip as t}from"../chip/MPChip.js";import{MPIcon as r}from"../icon/MPIcon.js";import{AddIcon as i,CheckIcon as s,ChevronDownIcon as m,CloseIcon as c}from"../../constants/icons.js";import{MPFieldLabel as p,MPFieldOutline as u,useFloatingLabel as d}from"../../internal/FieldOutline.js";import{fillMessage as h}from"../../internal/i18n.js";import{useMPLocale as f,useMPMessages as b}from"../../internal/locale.js";import{COMBOBOX as g}from"../../internal/messages/combobox.js";import{COMMON as x}from"../../internal/messages/common.js";import{MPStateLayer as v}from"../../internal/StateLayer.js";import{MPSupportingText as y}from"../../internal/SupportingText.js";import{CONTROL_ICON as j,PROSE_TEXT as C,hasContent as w}from"../../internal/scale.js";import{MARK_MOTION_KEPT as N}from"../../internal/mark.js";import{FADE as L,PORTAL_LAYER as M}from"../../internal/surface.js";import{useMPSize as k}from"../../internal/config.js";const S={xs:{padding:"ps-2 pe-1",height:"h-8"},sm:{padding:"ps-3 pe-1.5",height:"h-10"},md:{padding:"ps-4 pe-2",height:"h-14"},lg:{padding:"ps-4 pe-2",height:"h-16"},xl:{padding:"ps-5 pe-2.5",height:"h-18"}},I={xs:"min-h-8 py-1",sm:"min-h-10 py-1.5",md:"min-h-14 py-3",lg:"min-h-16 py-3",xl:"min-h-18 py-3"},z={xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"};function V(e){return null==e?[]:Array.isArray(e)?e.slice():[e]}export function MPCombobox({items:O,multiple:$,value:P,defaultValue:_,onValueChange:q,onInputValueChange:F,onKeyDown:T,onKeyUp:A,onFocus:D,onBlur:K,onClick:R,onDoubleClick:B,onContextMenu:E,allowCustom:U=!0,customLabel:G,clearable:H=!1,emptyMessage:W,limit:J,filter:Q,chipVariant:X,chipColor:Y,placeholder:Z,label:ee,floatingLabel:ae=!0,description:ne,errorMessage:oe,startIcon:le,size:te,fullWidth:re=!1,required:ie=!1,disabled:se=!1,readOnly:me=!1,name:ce,open:pe,defaultOpen:ue,onOpenChange:de,clearLabel:he,openLabel:fe,locale:be,removeLabel:ge,inputRef:xe,id:ve,classNames:ye,className:je,style:Ce}){const we=k(te),Ne=f(be),Le=b(x,Ne),Me=b(g,Ne),ke=w(oe),Se=!0===$,Ie=S[we],ze=n.useId(),Ve=ve??ze,Oe=n.useMemo(()=>O.map(e=>({value:e.value,label:e.label??String(e.value),content:e.content,disabled:e.disabled})),[O]),[$e,Pe]=n.useState(()=>V(_)),_e=void 0===P?$e:V(P),[qe,Fe]=n.useState(""),{shrunk:Te,focusProps:Ae}=d({floating:ae&&w(ee),filled:_e.length>0||""!==qe,pinned:!!le}),De=n.useMemo(()=>new Map(Oe.map(e=>[e.value,e])),[Oe]),Ke=n.useMemo(()=>{const e=new Set;for(const a of Oe)e.add(a.label.toLocaleLowerCase()),e.add(String(a.value).toLocaleLowerCase());return e},[Oe]),Re=n.useCallback(e=>De.get(e)??{value:e,label:String(e),custom:!0},[De]),Be=qe.trim(),Ee=Be.toLocaleLowerCase(),Ue=""===Be||Ke.has(Ee)||_e.some(e=>String(e).toLocaleLowerCase()===Ee),Ge=!U||me||se||Ue?null:Be,He=n.useMemo(()=>null==Q?Q:(e,a)=>!0===e.custom||Q(e,a),[Q]),We=n.useMemo(()=>null===Ge?Oe:[...Oe,{value:Ge,label:Ge,custom:!0}],[Oe,Ge]),Je=Se?_e.map(Re):_e.length>0?Re(_e[0]):null;const Qe=/*@__PURE__*/["min-w-0 flex-1 self-stretch border-0 bg-transparent text-inherit [font:inherit] outline-none","placeholder:text-mp-on-surface-variant",se?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface caret-mp-primary"].join(" "),Xe=/*@__PURE__*/["group rounded-mp-full relative flex size-8 shrink-0 cursor-pointer items-center justify-center","appearance-none border-0 bg-transparent p-0","text-mp-on-surface-variant","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none","disabled:text-mp-on-surface/38 disabled:cursor-default"].join(" "),Ye=a=>e(o.Input,{ref:xe,id:Ve,placeholder:Te?Z:void 0,onKeyDown:T,onKeyUp:A,onFocus:D,onBlur:K,onClick:R,onDoubleClick:B,onContextMenu:E,className:Se?`${Qe} min-w-16 ${a?"ms-1.5":""}`:Qe});return a(l.Root,{disabled:se,invalid:ke,"data-mp-size":we,className:["mp-combobox group flex-col align-top",re?"flex w-full":"inline-flex w-fit",je??""].filter(Boolean).join(" "),style:Ce,...Ae,children:[a(o.Root,{name:ce,items:We,multiple:Se,value:Je,onValueChange:e=>{!function(e){void 0===P&&Pe(e),q?.(Se?e:e[0]??null)}((null===e?[]:Array.isArray(e)?e:[e]).map(e=>e.value))},onInputValueChange:e=>{Fe(e),F?.(e)},open:pe,defaultOpen:ue,onOpenChange:e=>de?.(e),autoHighlight:!0,itemToStringLabel:e=>e.label,itemToStringValue:e=>String(e.value),isItemEqualToValue:(e,a)=>e.value===a.value,limit:J,filter:He,disabled:se,readOnly:me,required:ie,children:[a("div",{className:"relative w-full",children:[a(o.InputGroup,{className:["relative flex w-full items-center gap-2",Ie.padding,Se?I[we]:Ie.height,C[we],se?"cursor-default":"cursor-text"].join(" "),children:[le?e("span",{className:["flex shrink-0 items-center",se?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:le}):null,Se?e(o.Chips,{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:e(o.Value,{children:l=>a(n.Fragment,{children:[l.map((a,n)=>e(o.Chip,{render:e(t,{variant:X??(ke?"outlined":"tonal"),color:Y??(ke?"error":"primary"),size:z[we],disabled:se,endIcon:me||se?null:e(o.ChipRemove,{"aria-label":ge?ge(a.label):h(Le.removeNamed,{label:a.label}),className:"flex cursor-pointer appearance-none items-center border-0 bg-transparent p-0 text-inherit opacity-70 hover:opacity-100",children:e(r,{icon:c,size:16})})}),children:a.label},`${n}:${String(a.value)}`)),Ye(l.length>0)]})})}):Ye(!1),H&&!me?a(o.Clear,{"aria-label":he??Le.clear,className:Xe,children:[e(v,{}),e(r,{icon:c,size:j[we]})]}):null,a(o.Trigger,{"aria-label":fe??Le.open,className:Xe,children:[e(v,{}),e(o.Icon,{className:["relative flex items-center","transition-transform duration-(--mp-sys-motion-duration-short4)","data-popup-open:rotate-180"].join(" "),children:e(r,{icon:m,size:j[we]})})]})]}),e(u,{label:ee,required:ie,notched:Te}),w(ee)?e(p,{size:we,label:ee,required:ie,htmlFor:Ve,shrunk:Te}):null]}),e(o.Portal,{children:e(o.Positioner,{className:M,sideOffset:4,children:a(o.Popup,{className:["mp-combobox__popup rounded-mp-xs shadow-mp-2 bg-mp-surface-container p-2","text-mp-on-surface w-[var(--anchor-width)] outline-none","max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain",C[we],L].join(" "),children:[e(o.Empty,{className:"text-mp-on-surface-variant px-3 py-2 empty:hidden",children:W??Me.empty}),e(o.List,{children:(n,l)=>a(o.Item,{value:n,disabled:n.disabled,className:["mp-combobox__item group rounded-mp-xs relative flex cursor-pointer",ye?.item??"","items-center gap-3 py-2 ps-2 pe-3 select-none outline-none","transition-[background-color,color]","duration-(--mp-sys-motion-duration-short4)","data-selected:bg-mp-secondary-container","data-selected:text-mp-on-secondary-container","data-disabled:text-mp-on-surface/38 data-disabled:cursor-default"].join(" "),children:[e(v,{className:"group-data-highlighted:opacity-8 group-data-disabled:opacity-0"}),e("span",{className:"flex size-5 shrink-0 items-center justify-center",children:n.custom?e(r,{icon:i,size:18}):e(o.ItemIndicator,{keepMounted:!0,className:`mp-combobox__mark ${N}`,children:e(r,{icon:s,size:18})})}),e("span",{className:w(n.content)?"min-w-0 flex-1":"min-w-0 flex-1 truncate",children:n.custom?G?G(n.label):h(Me.add,{label:n.label}):n.content??n.label})]},`${l}:${n.custom?"custom:":""}${String(n.value)}`)})]})})})]}),e(y,{description:ne,errorMessage:oe,className:Ie.padding})]})}
2
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as n from"react";import{Combobox as o}from"@base-ui/react/combobox";import{Field as l}from"@base-ui/react/field";import{MPChip as t}from"../chip/MPChip.js";import{MPIcon as r}from"../icon/MPIcon.js";import{AddIcon as i,CheckIcon as s,ChevronDownIcon as m,CloseIcon as c}from"../../constants/icons.js";import{MPFieldLabel as p,MPFieldOutline as u,useFloatingLabel as d}from"../../internal/FieldOutline.js";import{fillMessage as h}from"../../internal/i18n.js";import{useMPLocale as f,useMPMessages as b}from"../../internal/locale.js";import{COMBOBOX as g}from"../../internal/messages/combobox.js";import{COMMON as x}from"../../internal/messages/common.js";import{MPStateLayer as v}from"../../internal/StateLayer.js";import{MPSupportingText as y}from"../../internal/SupportingText.js";import{CONTROL_ICON as j,PROSE_TEXT as C,hasContent as w}from"../../internal/scale.js";import{MARK_MOTION_KEPT as N}from"../../internal/mark.js";import{FADE as L,PORTAL_LAYER as M}from"../../internal/surface.js";import{useMPSize as k}from"../../internal/config.js";import{occurrenceKeys as I}from"../../internal/occurrence.js";const S={xs:{padding:"ps-2 pe-1",height:"h-8"},sm:{padding:"ps-3 pe-1.5",height:"h-10"},md:{padding:"ps-4 pe-2",height:"h-14"},lg:{padding:"ps-4 pe-2",height:"h-16"},xl:{padding:"ps-5 pe-2.5",height:"h-18"}},z={xs:"min-h-8 py-1",sm:"min-h-10 py-1.5",md:"min-h-14 py-3",lg:"min-h-16 py-3",xl:"min-h-18 py-3"},V={xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"};function O(e){return null==e?[]:Array.isArray(e)?e.slice():[e]}export function MPCombobox({items:P,multiple:_,value:q,defaultValue:F,onValueChange:T,onInputValueChange:$,onKeyDown:A,onKeyUp:D,onFocus:K,onBlur:R,onClick:B,onDoubleClick:E,onContextMenu:U,allowCustom:G=!0,customLabel:H,clearable:W=!1,emptyMessage:J,limit:Q,filter:X,chipVariant:Y,chipColor:Z,placeholder:ee,label:ae,floatingLabel:ne=!0,description:oe,errorMessage:le,startIcon:te,size:re,fullWidth:ie=!1,required:se=!1,disabled:me=!1,readOnly:ce=!1,name:pe,open:ue,defaultOpen:de,onOpenChange:he,clearLabel:fe,openLabel:be,locale:ge,removeLabel:xe,inputRef:ve,id:ye,classNames:je,className:Ce,style:we}){const Ne=k(re),Le=f(ge),Me=b(x,Le),ke=b(g,Le),Ie=w(le),Se=!0===_,ze=S[Ne],Ve=n.useId(),Oe=ye??Ve,Pe=n.useMemo(()=>P.map(e=>({value:e.value,label:e.label??String(e.value),content:e.content,disabled:e.disabled})),[P]),[_e,qe]=n.useState(()=>O(F)),Fe=void 0===q?_e:O(q),[Te,$e]=n.useState(""),{shrunk:Ae,focusProps:De}=d({floating:ne&&w(ae),filled:Fe.length>0||""!==Te,pinned:!!te}),Ke=n.useMemo(()=>new Map(Pe.map(e=>[e.value,e])),[Pe]),Re=n.useMemo(()=>{const e=new Set;for(const a of Pe)e.add(a.label.toLocaleLowerCase()),e.add(String(a.value).toLocaleLowerCase());return e},[Pe]),Be=n.useCallback(e=>Ke.get(e)??{value:e,label:String(e),custom:!0},[Ke]),Ee=Te.trim(),Ue=Ee.toLocaleLowerCase(),Ge=""===Ee||Re.has(Ue)||Fe.some(e=>String(e).toLocaleLowerCase()===Ue),He=!G||ce||me||Ge?null:Ee,We=n.useMemo(()=>null==X?X:(e,a)=>!0===e.custom||X(e,a),[X]),Je=n.useMemo(()=>null===He?Pe:[...Pe,{value:He,label:He,custom:!0}],[Pe,He]),Qe=n.useMemo(()=>I(Je,e=>`${e.custom?"custom:":""}${String(e.value)}`),[Je]),Xe=Se?Fe.map(Be):Fe.length>0?Be(Fe[0]):null;const Ye=/*@__PURE__*/["min-w-0 flex-1 self-stretch border-0 bg-transparent text-inherit [font:inherit] outline-none","placeholder:text-mp-on-surface-variant",me?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface caret-mp-primary"].join(" "),Ze=/*@__PURE__*/["group rounded-mp-full relative flex size-8 shrink-0 cursor-pointer items-center justify-center","appearance-none border-0 bg-transparent p-0","text-mp-on-surface-variant","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none","disabled:text-mp-on-surface/38 disabled:cursor-default"].join(" "),ea=a=>e(o.Input,{ref:ve,id:Oe,placeholder:Ae?ee:void 0,onKeyDown:A,onKeyUp:D,onFocus:K,onBlur:R,onClick:B,onDoubleClick:E,onContextMenu:U,className:Se?`${Ye} min-w-16 ${a?"ms-1.5":""}`:Ye});return a(l.Root,{disabled:me,invalid:Ie,"data-mp-size":Ne,className:["mp-combobox group flex-col align-top",ie?"flex w-full":"inline-flex w-fit",Ce??""].filter(Boolean).join(" "),style:we,...De,children:[a(o.Root,{name:pe,items:Je,multiple:Se,value:Xe,onValueChange:e=>{!function(e){void 0===q&&qe(e),T?.(Se?e:e[0]??null)}((null===e?[]:Array.isArray(e)?e:[e]).map(e=>e.value))},onInputValueChange:e=>{$e(e),$?.(e)},open:ue,defaultOpen:de,onOpenChange:e=>he?.(e),autoHighlight:!0,itemToStringLabel:e=>e.label,itemToStringValue:e=>String(e.value),isItemEqualToValue:(e,a)=>e.value===a.value,limit:Q,filter:We,disabled:me,readOnly:ce,required:se,children:[a("div",{className:"relative w-full",children:[a(o.InputGroup,{className:["relative flex w-full items-center gap-2",ze.padding,Se?z[Ne]:ze.height,C[Ne],me?"cursor-default":"cursor-text"].join(" "),children:[te?e("span",{className:["flex shrink-0 items-center",me?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:te}):null,Se?e(o.Chips,{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:e(o.Value,{children:l=>{const i=I(l,e=>e.value);return a(n.Fragment,{children:[l.map((a,n)=>e(o.Chip,{render:e(t,{variant:Y??(Ie?"outlined":"tonal"),color:Z??(Ie?"error":"primary"),size:V[Ne],disabled:me,endIcon:ce||me?null:e(o.ChipRemove,{"aria-label":xe?xe(a.label):h(Me.removeNamed,{label:a.label}),className:"flex cursor-pointer appearance-none items-center border-0 bg-transparent p-0 text-inherit opacity-70 hover:opacity-100",children:e(r,{icon:c,size:16})})}),children:a.label},i.get(a)??n)),ea(l.length>0)]})}})}):ea(!1),W&&!ce?a(o.Clear,{"aria-label":fe??Me.clear,className:Ze,children:[e(v,{}),e(r,{icon:c,size:j[Ne]})]}):null,a(o.Trigger,{"aria-label":be??Me.open,className:Ze,children:[e(v,{}),e(o.Icon,{className:["relative flex items-center","transition-transform duration-(--mp-sys-motion-duration-short4)","data-popup-open:rotate-180"].join(" "),children:e(r,{icon:m,size:j[Ne]})})]})]}),e(u,{label:ae,required:se,notched:Ae}),w(ae)?e(p,{size:Ne,label:ae,required:se,htmlFor:Oe,shrunk:Ae}):null]}),e(o.Portal,{children:e(o.Positioner,{className:M,sideOffset:4,children:a(o.Popup,{className:["mp-combobox__popup rounded-mp-xs shadow-mp-2 bg-mp-surface-container p-2","text-mp-on-surface w-[var(--anchor-width)] outline-none","max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain",C[Ne],L].join(" "),children:[e(o.Empty,{className:"text-mp-on-surface-variant px-3 py-2 empty:hidden",children:J??ke.empty}),e(o.List,{children:(n,l)=>a(o.Item,{value:n,disabled:n.disabled,className:["mp-combobox__item group rounded-mp-xs relative flex cursor-pointer",je?.item??"","items-center gap-3 py-2 ps-2 pe-3 select-none outline-none","transition-[background-color,color]","duration-(--mp-sys-motion-duration-short4)","data-selected:bg-mp-secondary-container","data-selected:text-mp-on-secondary-container","data-disabled:text-mp-on-surface/38 data-disabled:cursor-default"].join(" "),children:[e(v,{className:"group-data-highlighted:opacity-8 group-data-disabled:opacity-0"}),e("span",{className:"flex size-5 shrink-0 items-center justify-center",children:n.custom?e(r,{icon:i,size:18}):e(o.ItemIndicator,{keepMounted:!0,className:`mp-combobox__mark ${N}`,children:e(r,{icon:s,size:18})})}),e("span",{className:w(n.content)?"min-w-0 flex-1":"min-w-0 flex-1 truncate",children:n.custom?H?H(n.label):h(ke.add,{label:n.label}):n.content??n.label})]},Qe.get(n)??l)})]})})})]}),e(y,{description:oe,errorMessage:le,className:ze.padding})]})}
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Autocomplete as n}from"@base-ui/react/autocomplete";import{Dialog as l}from"@base-ui/react/dialog";import{MPShortcut as r}from"../shortcut/MPShortcut.js";import{accentSlots as o}from"../../internal/accent.js";import{cssLength as s}from"../../internal/length.js";import{matchesShortcut as i,useDetectedOS as m}from"../../internal/keys.js";import{useMPLocale as c,useMPMessages as p}from"../../internal/locale.js";import{COMMAND as d}from"../../internal/messages/command.js";import{MPStateLayer as u}from"../../internal/StateLayer.js";import{hasContent as f,META_TEXT as h,PROSE_TEXT as x}from"../../internal/scale.js";import{FADE as g,PORTAL_LAYER as v,SCRIM as y,SHEET_MOTION as w}from"../../internal/surface.js";import{useMPColor as b,useMPSize as j}from"../../internal/config.js";const N={xs:"max-w-sm",sm:"max-w-md",md:"max-w-xl",lg:"max-w-2xl",xl:"max-w-3xl"},k={xs:"h-10",sm:"h-12",md:"h-14",lg:"h-16",xl:"h-18"},$={xs:"px-2",sm:"px-2.5",md:"px-3",lg:"px-4",xl:"px-5"},C={xs:"py-1",sm:"py-1.5",md:"py-2",lg:"py-2.5",xl:"py-3"};function S(e){return[e.label,e.group??"",...e.keywords??[]].join("\n").toLowerCase()}export function MPCommandPalette({items:_,open:L,defaultOpen:M=!1,onOpenChange:P,onSelect:E,shortcut:z="Mod+K",width:B,maxHeight:O=320,size:V,color:F,locale:H,placeholder:I,emptyMessage:R,label:D,classNames:K,className:T,style:W}){const q=j(V),A=b(F),G=c(H),J=p(d,G),Q=m(),[U,X]=a.useState(M),[Y,Z]=a.useState(""),ee=L??U,te=a.useCallback(e=>{e||Z(""),void 0===L&&X(e),P?.(e)},[L,P]);a.useEffect(()=>{if(!1===z)return;const e=e=>{i(e,z,Q)&&(e.preventDefault(),te(!0))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[z,Q,te]);const ae=a.useMemo(()=>_.map(S),[_]),ne=a.useMemo(()=>{if(""===Y)return _;const e=Y.toLowerCase();return _.filter((t,a)=>ae[a].includes(e))},[_,ae,Y]),le=s(B),re=s(O);return e(l.Root,{open:ee,onOpenChange:te,children:t(l.Portal,{children:[e(l.Backdrop,{className:[`${v} fixed inset-0`,g,y,K?.backdrop??""].filter(Boolean).join(" ")}),e(l.Viewport,{className:`${v} fixed inset-0 flex justify-center p-4 pt-[12vh]`,children:e(l.Popup,{"aria-label":D??J.label,"data-mp-size":q,className:["mp-command-palette relative flex w-full flex-col self-start overflow-hidden","bg-mp-surface-container-high text-mp-on-surface shadow-mp-3 rounded-mp-xl","outline-none",x[q],void 0===le?N[q]:"",`transition-[opacity,scale] ${w}`,"motion-safe:data-starting-style:scale-95 motion-safe:data-ending-style:scale-95",T??""].filter(Boolean).join(" "),style:{...o(A),...void 0===le?null:{maxWidth:le},...W},children:t(n.Root,{open:!0,mode:"list",items:ne,filter:null,value:Y,onValueChange:e=>Z(e),itemToStringValue:e=>e.label,children:[e("div",{className:`border-mp-outline-variant flex shrink-0 items-center border-b ${$[q]}`,children:e(n.Input,{autoFocus:!0,placeholder:I??J.search,className:["mp-command-palette__input min-w-0 flex-1 bg-transparent font-[inherit]",K?.input??"","text-inherit outline-none","placeholder:text-mp-on-surface-variant caret-(--_mp-accent)",k[q]].join(" ")})}),e(n.List,{className:"mp-command-palette__list min-h-0 flex-1 overflow-y-auto overscroll-contain p-1"+(K?.list?` ${K.list}`:""),style:{maxHeight:re},children:(l,o)=>t(a.Fragment,{children:[l.group&&l.group!==ne[o-1]?.group?e("div",{role:"presentation",className:`text-mp-on-surface-variant pt-2 pb-1 font-medium ${$[q]} ${h}`,children:l.group}):null,t(n.Item,{index:o,value:l,disabled:l.disabled,onClick:()=>(e=>{e.disabled||(e.onSelect?.(),E?.(e),te(!1))})(l),className:["mp-command-palette__row group rounded-mp-xs relative flex cursor-pointer",K?.row??"","items-center gap-3 select-none outline-none","data-disabled:text-mp-on-surface/38 data-disabled:cursor-default",$[q],C[q]].join(" "),children:[e(u,{layer:"inset-0 rounded-[inherit] bg-current",className:"group-data-highlighted:opacity-8 group-data-disabled:opacity-0"}),f(l.icon)?e("span",{className:"relative flex h-[1lh] shrink-0 items-center",children:l.icon}):null,t("span",{className:"relative flex min-w-0 flex-1 flex-col",children:[e("span",{className:"truncate",children:l.label}),f(l.description)?e("span",{className:`text-mp-on-surface-variant truncate ${h}`,children:l.description}):null]}),l.shortcut?e(r,{size:"xs",keys:l.shortcut,className:"relative shrink-0"}):null]})]},`${o}:${l.value}`)}),e(n.Empty,{className:`text-mp-on-surface-variant py-6 text-center ${$[q]} ${h}`,children:R??J.empty})]})})})]})})}
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Autocomplete as n}from"@base-ui/react/autocomplete";import{Dialog as r}from"@base-ui/react/dialog";import{MPShortcut as l}from"../shortcut/MPShortcut.js";import{accentSlots as o}from"../../internal/accent.js";import{cssLength as s}from"../../internal/length.js";import{matchesShortcut as i,useDetectedOS as m}from"../../internal/keys.js";import{useMPLocale as c,useMPMessages as p}from"../../internal/locale.js";import{COMMAND as d}from"../../internal/messages/command.js";import{MPStateLayer as u}from"../../internal/StateLayer.js";import{hasContent as f,META_TEXT as h,PROSE_TEXT as x}from"../../internal/scale.js";import{FADE as g,PORTAL_LAYER as v,SCRIM as y,SHEET_MOTION as w}from"../../internal/surface.js";import{useMPColor as b,useMPSize as j}from"../../internal/config.js";import{occurrenceKeys as N}from"../../internal/occurrence.js";const k={xs:"max-w-sm",sm:"max-w-md",md:"max-w-xl",lg:"max-w-2xl",xl:"max-w-3xl"},$={xs:"h-10",sm:"h-12",md:"h-14",lg:"h-16",xl:"h-18"},C={xs:"px-2",sm:"px-2.5",md:"px-3",lg:"px-4",xl:"px-5"},M={xs:"py-1",sm:"py-1.5",md:"py-2",lg:"py-2.5",xl:"py-3"};function S(e){return[e.label,e.group??"",...e.keywords??[]].join("\n").toLowerCase()}export function MPCommandPalette({items:_,open:L,defaultOpen:P=!1,onOpenChange:E,onSelect:z,shortcut:B="Mod+K",width:O,maxHeight:V=320,size:F,color:H,locale:I,placeholder:R,emptyMessage:D,label:K,classNames:T,className:W,style:q}){const A=j(F),G=b(H),J=c(I),Q=p(d,J),U=m(),[X,Y]=a.useState(P),[Z,ee]=a.useState(""),te=L??X,ae=a.useCallback(e=>{e||ee(""),void 0===L&&Y(e),E?.(e)},[L,E]);a.useEffect(()=>{if(!1===B)return;const e=e=>{i(e,B,U)&&(e.preventDefault(),ae(!0))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[B,U,ae]);const ne=a.useMemo(()=>_.map(S),[_]),re=a.useMemo(()=>N(_,e=>e.value),[_]),le=a.useMemo(()=>{if(""===Z)return _;const e=Z.toLowerCase();return _.filter((t,a)=>ne[a].includes(e))},[_,ne,Z]),oe=s(O),se=s(V);return e(r.Root,{open:te,onOpenChange:ae,children:t(r.Portal,{children:[e(r.Backdrop,{className:[`${v} fixed inset-0`,g,y,T?.backdrop??""].filter(Boolean).join(" ")}),e(r.Viewport,{className:`${v} fixed inset-0 flex justify-center p-4 pt-[12vh]`,children:e(r.Popup,{"aria-label":K??Q.label,"data-mp-size":A,className:["mp-command-palette relative flex w-full flex-col self-start overflow-hidden","bg-mp-surface-container-high text-mp-on-surface shadow-mp-3 rounded-mp-xl","outline-none",x[A],void 0===oe?k[A]:"",`transition-[opacity,scale] ${w}`,"motion-safe:data-starting-style:scale-95 motion-safe:data-ending-style:scale-95",W??""].filter(Boolean).join(" "),style:{...o(G),...void 0===oe?null:{maxWidth:oe},...q},children:t(n.Root,{open:!0,mode:"list",items:le,filter:null,value:Z,onValueChange:e=>ee(e),itemToStringValue:e=>e.label,children:[e("div",{className:`border-mp-outline-variant flex shrink-0 items-center border-b ${C[A]}`,children:e(n.Input,{autoFocus:!0,placeholder:R??Q.search,className:["mp-command-palette__input min-w-0 flex-1 bg-transparent font-[inherit]",T?.input??"","text-inherit outline-none","placeholder:text-mp-on-surface-variant caret-(--_mp-accent)",$[A]].join(" ")})}),e(n.List,{className:"mp-command-palette__list min-h-0 flex-1 overflow-y-auto overscroll-contain p-1"+(T?.list?` ${T.list}`:""),style:{maxHeight:se},children:(r,o)=>t(a.Fragment,{children:[r.group&&r.group!==le[o-1]?.group?e("div",{role:"presentation",className:`text-mp-on-surface-variant pt-2 pb-1 font-medium ${C[A]} ${h}`,children:r.group}):null,t(n.Item,{index:o,value:r,disabled:r.disabled,onClick:()=>(e=>{e.disabled||(e.onSelect?.(),z?.(e),ae(!1))})(r),className:["mp-command-palette__row group rounded-mp-xs relative flex cursor-pointer",T?.row??"","items-center gap-3 select-none outline-none","data-disabled:text-mp-on-surface/38 data-disabled:cursor-default",C[A],M[A]].join(" "),children:[e(u,{layer:"inset-0 rounded-[inherit] bg-current",className:"group-data-highlighted:opacity-8 group-data-disabled:opacity-0"}),f(r.icon)?e("span",{className:"relative flex h-[1lh] shrink-0 items-center",children:r.icon}):null,t("span",{className:"relative flex min-w-0 flex-1 flex-col",children:[e("span",{className:"truncate",children:r.label}),f(r.description)?e("span",{className:`text-mp-on-surface-variant truncate ${h}`,children:r.description}):null]}),r.shortcut?e(l,{size:"xs",keys:r.shortcut,className:"relative shrink-0"}):null]})]},re.get(r)??o)}),e(n.Empty,{className:`text-mp-on-surface-variant py-6 text-center ${C[A]} ${h}`,children:D??Q.empty})]})})})]})})}
@@ -86,6 +86,22 @@ export interface MPConfigProviderProps {
86
86
  * gets the CSS half and not the other one.
87
87
  */
88
88
  dir?: 'ltr' | 'rtl';
89
+ /**
90
+ * Keeps a line under every field for its description or its error, whether
91
+ * or not there is one yet.
92
+ *
93
+ * By default the line is opened when there is something to put in it, and
94
+ * that moves everything below the field down by a line. Right after the
95
+ * reader typed, that is fine — a page that moves in answer to the reader is
96
+ * not a page that jumped. An error that arrives later is not: a server's
97
+ * answer to a submit, a check that waited for the reader to stop typing, or
98
+ * `MPForm`'s `errors` filled in from a response all push the page down with
99
+ * nothing the reader did to explain it, which is the shift Cumulative Layout
100
+ * Shift counts. With this the line is there from the start, and a message
101
+ * fills it in place.
102
+ * @default false
103
+ */
104
+ reserveSupportingText?: boolean;
89
105
  children?: React.ReactNode;
90
106
  }
91
107
  /**
@@ -149,7 +165,7 @@ export interface MPConfigProviderProps {
149
165
  * </MPConfigProvider>
150
166
  * ```
151
167
  */
152
- export declare function MPConfigProvider({ size, color, density, breakpoints, locale, dir, children }: MPConfigProviderProps): React.JSX.Element;
168
+ export declare function MPConfigProvider({ size, color, density, breakpoints, locale, dir, reserveSupportingText, children }: MPConfigProviderProps): React.JSX.Element;
153
169
  /**
154
170
  * The configuration in force at this point in the tree.
155
171
  *
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as r}from"react/jsx-runtime";import*as i from"react";import{DirectionProvider as o}from"@base-ui/react/direction-provider";import{MPConfigContext as e,useMPConfig as n}from"../../internal/config.js";import{MPLocaleContext as t,useMPLocale as s}from"../../internal/locale.js";import{WINDOW_CLASSES as a}from"../../internal/window-class.js";export function MPConfigProvider({size:c,color:d,density:l,breakpoints:p,locale:m,dir:f,children:v}){const u=n(),b=s(),j=a.map(r=>p?.[r]??u.breakpoints?.[r]??"").join(","),y=i.useMemo(()=>({size:c??u.size,color:d??u.color,density:l??u.density,breakpoints:p||u.breakpoints?{...u.breakpoints,...p}:void 0}),[c,d,l,u.size,u.color,u.density,j]),h=m??b,k=r(e.Provider,{value:y,children:r(t.Provider,{value:h,children:v})});return f?r(o,{direction:f,children:r("div",{dir:f,style:{display:"contents"},children:k})}):k}export{n as useMPConfig};
2
+ import{jsx as r}from"react/jsx-runtime";import*as e from"react";import{DirectionProvider as i}from"@base-ui/react/direction-provider";import{MPConfigContext as o,useMPConfig as t}from"../../internal/config.js";import{MPLocaleContext as n,useMPLocale as s}from"../../internal/locale.js";import{WINDOW_CLASSES as p}from"../../internal/window-class.js";export function MPConfigProvider({size:a,color:c,density:d,breakpoints:l,locale:m,dir:v,reserveSupportingText:u,children:f}){const x=t(),b=s(),g=p.map(r=>l?.[r]??x.breakpoints?.[r]??"").join(","),j=e.useMemo(()=>({size:a??x.size,color:c??x.color,density:d??x.density,breakpoints:l||x.breakpoints?{...x.breakpoints,...l}:void 0,reserveSupportingText:u??x.reserveSupportingText}),[a,c,d,u,x.size,x.color,x.density,x.reserveSupportingText,g]),y=m??b,h=r(o.Provider,{value:j,children:r(n.Provider,{value:y,children:f})});return v?r(i,{direction:v,children:r("div",{dir:v,style:{display:"contents"},children:h})}):h}export{t as useMPConfig};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,Fragment as r,jsxs as n}from"react/jsx-runtime";import*as o from"react";import{MPButton as i}from"../button/MPButton.js";import{MPDialog as t}from"../dialog/MPDialog.js";import{useMPLocale as l,useMPMessages as c}from"../../internal/locale.js";import{CONFIRM as s}from"../../internal/messages/confirm.js";const a=/*@__PURE__*/o.createContext(null);export function MPConfirmProvider({defaults:u,children:m}){const[d,f]=o.useState(null),p=c(s,l()),h=o.useRef(null),C=o.useCallback((e,r)=>new Promise(n=>{h.current?.(!1),h.current=n,f({...u,...e,acknowledge:r})}),[u]),P=o.useMemo(()=>({confirm:e=>C(e,!1),alert:e=>C(e,!0).then(()=>{})}),[C]),x=e=>{h.current?.(e),h.current=null,f(null)},g=o.useRef(null);d&&(g.current=d);const v=d??g.current,w=v?.acknowledge??!1;return n(a.Provider,{value:P,children:[m,e(t,{open:null!==d,onOpenChange:e=>{e||x(w)},icon:v?.icon,title:v?.title,description:v?.description,size:v?.size??"md",color:v?.color??"primary",dismissible:v?.dismissible??!0,actions:n(r,{children:[w?null:e(i,{variant:"text",onClick:()=>x(!1),children:v?.cancelLabel??p.cancel}),e(i,{variant:"text",color:v?.color??"primary",onClick:()=>x(!0),children:v?.confirmLabel??(w?p.ok:p.confirm)})]}),children:v?.children})]})}export function useMPConfirm(){const e=o.useContext(a);if(!e)throw new Error("useMPConfirm was called outside an <MPConfirmProvider>. Wrap the application in one — the provider is what holds the dialog every confirm() is drawn in.");return e}
2
+ import{jsx as e,Fragment as r,jsxs as n}from"react/jsx-runtime";import*as o from"react";import{MPButton as i}from"../button/MPButton.js";import{MPDialog as t}from"../dialog/MPDialog.js";import{useMPLocale as l,useMPMessages as c}from"../../internal/locale.js";import{CONFIRM as s}from"../../internal/messages/confirm.js";const a=/*@__PURE__*/o.createContext(null);export function MPConfirmProvider({defaults:u,children:m}){const[d,f]=o.useState(null),p=c(s,l()),h=o.useRef(null),C=o.useRef(u);C.current=u;const P=o.useCallback((e,r)=>new Promise(n=>{h.current?.(!1),h.current=n,f({...C.current,...e,acknowledge:r})}),[]),x=o.useMemo(()=>({confirm:e=>P(e,!1),alert:e=>P(e,!0).then(()=>{})}),[P]),g=e=>{h.current?.(e),h.current=null,f(null)},v=o.useRef(null);d&&(v.current=d);const w=d??v.current,j=w?.acknowledge??!1;return n(a.Provider,{value:x,children:[m,e(t,{open:null!==d,onOpenChange:e=>{e||g(j)},icon:w?.icon,title:w?.title,description:w?.description,size:w?.size??"md",color:w?.color??"primary",dismissible:w?.dismissible??!0,actions:n(r,{children:[j?null:e(i,{variant:"text",onClick:()=>g(!1),children:w?.cancelLabel??p.cancel}),e(i,{variant:"text",color:w?.color??"primary",onClick:()=>g(!0),children:w?.confirmLabel??(j?p.ok:p.confirm)})]}),children:w?.children})]})}export function useMPConfirm(){const e=o.useContext(a);if(!e)throw new Error("useMPConfirm was called outside an <MPConfirmProvider>. Wrap the application in one — the provider is what holds the dialog every confirm() is drawn in.");return e}
@@ -277,38 +277,4 @@ export interface MPDataTableProps<Row> extends Omit<React.ComponentPropsWithoutR
277
277
  density?: MPDensity;
278
278
  classNames?: MPSlots<MPDataTableSlot>;
279
279
  }
280
- /**
281
- * A grid of data with the four things a reader does to one: put it in order,
282
- * cut it down, step through it and take some of it away.
283
- *
284
- * ```tsx
285
- * <MPDataTable headers={columns} items={rows} sortable searchable paged />
286
- * ```
287
- *
288
- * It is a separate component from [MPTable](table) rather than a mode of it.
289
- * `MPTable` is the presentational half: it
290
- * draws what it is given, in the order it is given, and a page that only shows a
291
- * grid should not carry a comparator, a CSV writer and a page clamp to do it.
292
- * What the two do share is the geometry — `internal/table.ts` holds the cells'
293
- * room and the type they are set in — so a data table never sits a pixel off the
294
- * plain table beside it.
295
- *
296
- * ## What it does to the rows, and in what order
297
- *
298
- * Search, then `filter`, then sort, then the page. The order is the only one
299
- * that makes each step mean what it says: sorting before searching would order
300
- * rows nobody is going to see, and paging before either would cut a page out of
301
- * a list the reader has not asked for yet. `render`'s `index` counts along the
302
- * sorted, searched order across every page, so it is a running row number rather
303
- * than a position on the screen.
304
- *
305
- * ## Who holds the keyboard
306
- *
307
- * A row that answers a press has to answer a keyboard, and a table of two
308
- * hundred rows that each did would be two hundred tab stops. So there is exactly
309
- * one route into a row and `checkboxes` is what picks it: with ticks, the tick
310
- * is the control and the row is not in the tab order; without them, the row is.
311
- * `onRowClick` on its own always puts the row in the tab order, because then
312
- * there is nothing else to press.
313
- */
314
280
  export declare function MPDataTable<Row>({ headers, items, getRowKey, caption, empty, locale: localeProp, sortable, sortMode, sort: sortProp, defaultSort, onSortChange, searchable, search: searchProp, defaultSearch, onSearchChange, searchLabel, filter, toolbar, paged, page: pageProp, defaultPage, onPageChange, pageSize: pageSizeProp, defaultPageSize, onPageSizeChange, pageSizeOptions, resizable, columnWidths: columnWidthsProp, defaultColumnWidths, onColumnWidthsChange, selectionMode, selected: selectedProp, defaultSelected, onSelectedChange, checkboxes, onRowClick, exportable, exportFileName, exportEscapeFormulas, onExport, striped, hoverable, stickyHeader, variant, elevation, size: sizeProp, color: colorProp, density: densityProp, className, style, classNames, ...props }: MPDataTableProps<Row>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{MPButton as r}from"../button/MPButton.js";import{MPCheckbox as n}from"../checkbox/MPCheckbox.js";import{MPIcon as o}from"../icon/MPIcon.js";import{MPPagination as l}from"../pagination/MPPagination.js";import{MPSelect as s}from"../select/MPSelect.js";import{MPTextField as i}from"../text-field/MPTextField.js";import{ArrowDownIcon as c,ArrowUpIcon as d,SearchIcon as m}from"../../constants/icons.js";import{accentSlots as u}from"../../internal/accent.js";import{containerSurface as p}from"../../internal/elevation.js";import{useMPColor as f,useMPDensity as h,useMPSize as y}from"../../internal/config.js";import{useMPLocale as g,useMPMessages as b}from"../../internal/locale.js";import{fillMessage as v}from"../../internal/i18n.js";import{DATA_TABLE as x}from"../../internal/messages/data-table.js";import{TABLE as k}from"../../internal/messages/table.js";import{TRANSFER as w}from"../../internal/messages/transfer.js";import{CONTROL_ICON as S,META_TEXT as N}from"../../internal/scale.js";import{VISUALLY_HIDDEN as j}from"../../internal/visually-hidden.js";import{CELL_TEXT as C,HEAD_TEXT as z,ROW as _,cellPadX as M,cellPadY as P,drawableCell as E}from"../../internal/table.js";import{DEFAULT_COLUMN_WIDTH as L,MIN_COLUMN_WIDTH as D,compareValues as $,downloadText as A,keysBetween as I,nextSort as K,pageBounds as W,searchHaystack as R,searchText as T,sortRows as B,toCsv as F}from"../../internal/data-table.js";function V(e,t){return e.value?e.value(t):t[e.key]}const H={xs:36,sm:40,md:48,lg:52,xl:60},X=/*@__PURE__*/["group/sort -m-1 flex w-full cursor-pointer items-center gap-1 rounded-mp-xs p-1","appearance-none border-0 bg-transparent text-inherit text-start [font:inherit]","transition-[color] duration-(--mp-sys-motion-duration-short4) ease-mp-standard","hover:text-mp-on-surface","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none"].join(" "),O=/*@__PURE__*/["mp-data-table__resize absolute inset-y-0 end-0 z-10 w-2 translate-x-1/2 rtl:-translate-x-1/2","cursor-col-resize touch-none select-none appearance-none border-0 bg-transparent p-0","after:absolute after:inset-y-1 after:start-1/2 after:w-px after:bg-transparent","after:transition-[background-color] after:duration-(--mp-sys-motion-duration-short4)","hover:after:bg-mp-primary data-dragging:after:bg-mp-primary","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-solid outline-none"].join(" ");export function MPDataTable({headers:q,items:G,getRowKey:J,caption:Q,empty:U,locale:Y,sortable:Z=!1,sortMode:ee="single",sort:te,defaultSort:ae,onSortChange:re,searchable:ne=!1,search:oe,defaultSearch:le,onSearchChange:se,searchLabel:ie,filter:ce,toolbar:de,paged:me=!1,page:ue,defaultPage:pe,onPageChange:fe,pageSize:he,defaultPageSize:ye,onPageSizeChange:ge,pageSizeOptions:be=[10,25,50,100],resizable:ve=!1,columnWidths:xe,defaultColumnWidths:ke,onColumnWidthsChange:we,selectionMode:Se="none",selected:Ne,defaultSelected:je,onSelectedChange:Ce,checkboxes:ze=!1,onRowClick:_e,exportable:Me=!1,exportFileName:Pe="table.csv",exportEscapeFormulas:Ee=!0,onExport:Le,striped:De=!1,hoverable:$e=!1,stickyHeader:Ae=!1,variant:Ie="outlined",elevation:Ke,size:We,color:Re,density:Te,className:Be,style:Fe,classNames:Ve,...He}){const Xe=y(We),Oe=f(Re),qe=h(Te),Ge=g(Y),Je=b(x,Ge),Qe=b(k,Ge),Ue=b(w,Ge),Ye=M(Xe,qe),Ze=P(Xe,qe),[et,tt]=a.useState(()=>[...ae??[]]),at=te??et,[rt,nt]=a.useState(le??""),ot=oe??rt,[lt,st]=a.useState(pe??1),it=ue??lt,[ct,dt]=a.useState(ye??25),mt=he??ct,[ut,pt]=a.useState(()=>({...ke})),ft=xe??ut,[ht,yt]=a.useState(()=>[...je??[]]),gt=Ne??ht,bt=a.useMemo(()=>new Set(gt.map(e=>String(e))),[gt]),vt=a.useRef(null),xt=a.useMemo(()=>G.map((e,t)=>{const a=J?J(e,t):t;return{row:e,identity:a,key:String(a),origin:t}}),[G,J]),kt=a.useMemo(()=>{const e=q.filter(e=>!1!==e.searchable);return xt.map(t=>R(e.map(e=>V(e,t.row))))},[xt,q]),wt=T(ot.trim()),St=a.useMemo(()=>{const e=""===wt?xt:xt.filter((e,t)=>kt[t].includes(wt));return ce?e.filter(e=>ce(e.row,e.origin)):e},[xt,kt,wt,ce]),Nt=a.useMemo(()=>new Intl.Collator(Ge,{numeric:!0,sensitivity:"base"}),[Ge]),jt=a.useMemo(()=>B(St,at,(e,t)=>{const a=q.find(t=>t.key===e);if(!a)return null;const r="desc"===t,n=a.compare;return n?(e,t)=>r?-n(e.row,t.row):n(e.row,t.row):(e,t)=>$(V(a,e.row),V(a,t.row),Nt,r)}),[St,at,q,Nt]),Ct=W(jt.length,it,mt),zt=me?jt.slice(Ct.start,Ct.end):jt,_t=e=>{void 0===ue&&st(e),fe?.(e)},Mt=e=>{void 0===xe&&pt(e),we?.(e)},Pt=e=>{const t=new Set(e),a=[],r=[];for(const e of xt)t.has(e.key)&&(r.push(e.identity),a.push(e.row));void 0===Ne&&yt(r),Ce?.(r,a)},Et="none"!==Se,Lt="multiple"===Se,Dt=ze&&Et,$t=(e,t,a)=>{if(_e?.(e.row,Ct.start+t),Et){if(!Lt)return Pt(bt.has(e.key)?[]:[e.key]),void(vt.current=e.key);if(a&&null!==vt.current){const t=I(zt.map(e=>e.key),vt.current,e.key);return void Pt([...new Set([...bt,...t])])}vt.current=e.key,Pt(bt.has(e.key)?[...bt].filter(t=>t!==e.key):[...bt,e.key])}},At=zt.map(e=>e.key),It=At.filter(e=>bt.has(e)).length,Kt=At.length>0&&It===At.length,Wt=e=>ft[e.key]??e.width??L,Rt=a.useRef(null);a.useEffect(()=>()=>{null!==Rt.current&&(document.body.style.userSelect=Rt.current,Rt.current=null)},[]);const Tt=(e,t)=>{const a=Math.max(D,e.minWidth??D);Mt({...ft,[e.key]:Math.max(a,Wt(e)+t)})},Bt=e=>{const t={...ft};delete t[e.key],Mt(t)},Ft={padding:`${Ze} ${Ye}`},Vt={...Ft,backgroundColor:"var(--_mp-color-surface-container)"},Ht={borderTop:"1px solid var(--_mp-color-outline-variant)",backgroundColor:"var(--_mp-row)"},Xt=q.length+(Dt?1:0),Ot=Boolean(_e)||Et&&!Dt,qt=$e||Et||Boolean(_e),Gt=ne||Me||void 0!==de,Jt=me||Et,Qt=(...e)=>e.filter(Boolean).join(" ");return t("div",{"data-mp-size":Xe,"data-mp-variant":Ie,className:Qt("mp-data-table rounded-mp-md flex flex-col",p(Ie,Ke),Be),style:{...u(Oe),...Fe},...He,children:[Gt?t("div",{className:Qt("mp-data-table__toolbar flex flex-wrap items-center gap-2",Ve?.toolbar),style:{padding:`${Ze} ${Ye}`},children:[ne?e(i,{size:Xe,value:ot,onChange:e=>{void 0===oe&&nt(e),_t(1),se?.(e)},label:ie??Ue.search,startIcon:e(o,{icon:m,size:S[Xe]}),className:"mp-data-table__search min-w-0 flex-1"}):e("div",{className:"min-w-0 flex-1"}),de,Me?e(r,{size:Xe,variant:"text",color:Oe,onClick:()=>{const e=q.filter(e=>!1!==e.exportable),t=e.map(e=>"string"==typeof e.label?e.label:e.key),a=jt.map(t=>e.map(e=>e.exportValue?e.exportValue(t.row):V(e,t.row))),r=F([t,...a],{escapeFormulas:Ee});Le?Le(r):A(r,Pe,"text/csv;charset=utf-8")},startIcon:e(o,{icon:c,size:S[Xe]}),children:Je.download}):null]}):null,e("div",{className:"mp-data-table__scroll min-h-0 flex-1 overflow-auto",children:t("table",{className:Qt("text-mp-on-surface w-full text-start",C[Xe],Ve?.table),style:{borderCollapse:"collapse",...ve?{tableLayout:"fixed",minWidth:q.reduce((e,t)=>e+Wt(t),Dt?H[Xe]:0)}:void 0},children:[Q?e("caption",{className:`text-mp-on-surface-variant ${N}`,style:{...Ft,textAlign:"start"},children:Q}):null,t("colgroup",{children:[Dt?e("col",{style:{width:H[Xe]}}):null,q.map(t=>e("col",{style:ve||void 0!==ft[t.key]||void 0!==t.width?{width:Wt(t)}:void 0},t.key))]}),e("thead",{className:Ve?.head,children:t("tr",{children:[Dt?e("th",{scope:"col",className:Qt("whitespace-nowrap",Ae&&"sticky top-0 z-20"),style:Vt,children:e(n,{size:Xe,color:Oe,checked:Kt,indeterminate:It>0&&!Kt,onCheckedChange:()=>{Pt(Kt?[...bt].filter(e=>!At.includes(e)):[...new Set([...bt,...At])])},label:e("span",{className:j,children:Je.selectAll}),disabled:!Lt||0===At.length})}):null,q.map(a=>{const r=a.sortable??Z,n=(l=a.key,at.findIndex(e=>e.key===l));var l;const s=-1===n?void 0:at[n],i=a.resizable??ve,c=a.align??"start";return t("th",{scope:"col","aria-sort":r?void 0===s?"none":"asc"===s.direction?"ascending":"descending":void 0,className:Qt("text-mp-on-surface-variant relative whitespace-nowrap",z[Xe],Ae&&"sticky top-0 z-10"),style:{...Vt,textAlign:c},children:[r?t("button",{type:"button",className:Qt(X,"end"===c&&"justify-end","center"===c&&"justify-center"),onClick:e=>((e,t)=>{const a=K(at,e,t&&"multiple"===ee);void 0===te&&tt(a),re?.(a)})(a.key,e.shiftKey),children:[e("span",{className:"min-w-0 truncate",children:a.label??a.key}),e(o,{icon:d,size:S[Xe]-6,className:Qt("shrink-0 transition-[rotate,opacity]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard",void 0===s?"opacity-0 group-hover/sort:opacity-38":"text-mp-primary opacity-100","desc"===s?.direction&&"rotate-180")}),at.length>1&&-1!==n?e("span",{className:"text-mp-primary shrink-0 tabular-nums",children:n+1}):null]}):a.label??a.key,i?e("button",{type:"button","aria-label":Je.resize,className:O,onPointerDown:e=>((e,t)=>{const a=t.currentTarget;try{a.setPointerCapture(t.pointerId)}catch{}a.dataset.dragging="true";const r=document.body.style.userSelect;Rt.current=r,document.body.style.userSelect="none";const n=t.clientX,o=Wt(e),l="rtl"===getComputedStyle(a).direction?-1:1,s=Math.max(D,e.minWidth??D),i=t=>{Mt({...ft,[e.key]:Math.max(s,Math.round(o+(t.clientX-n)*l))})},c=()=>{a.removeEventListener("pointermove",i),a.removeEventListener("pointerup",c),a.removeEventListener("pointercancel",c),delete a.dataset.dragging,null!==Rt.current&&(document.body.style.userSelect=Rt.current,Rt.current=null)};a.addEventListener("pointermove",i),a.addEventListener("pointerup",c),a.addEventListener("pointercancel",c)})(a,e),onDoubleClick:()=>Bt(a),onKeyDown:e=>{const t=e.shiftKey?32:8;"ArrowRight"===e.key?(e.preventDefault(),Tt(a,t)):"ArrowLeft"===e.key?(e.preventDefault(),Tt(a,-t)):"Home"===e.key&&(e.preventDefault(),Bt(a))}}):null]},a.key)})]})}),e("tbody",{children:0===zt.length?e("tr",{className:_,style:Ht,children:e("td",{colSpan:Xt,className:"text-mp-on-surface-variant",style:{padding:`2rem ${Ye}`,textAlign:"center"},children:U??Qe.empty})}):zt.map((a,r)=>{const o=bt.has(a.key);return t("tr",{"aria-selected":Et?o:void 0,className:Qt(_,Ve?.row,De&&(Ct.start+r)%2==1?"[--_mp-row:var(--_mp-color-surface-container-low)]":"",o?"[--_mp-row:var(--_mp-color-secondary-container)]":"",qt&&!o?"hover:[--_mp-row:var(--_mp-color-surface-container)]":"",(Et||_e)&&"cursor-pointer",Ot&&["outline-mp-secondary focus-visible:outline-2","focus-visible:-outline-offset-2 focus-visible:outline-solid outline-none"].join(" ")),style:Ht,tabIndex:Ot?0:void 0,onClick:e=>$t(a,r,e.shiftKey),onKeyDown:Ot?e=>{"Enter"!==e.key&&" "!==e.key||e.target===e.currentTarget&&(e.preventDefault(),$t(a,r,e.shiftKey))}:void 0,children:[Dt?e("td",{style:Ft,children:e(n,{size:Xe,color:Oe,checked:o,onCheckedChange:()=>$t(a,r,!1),label:e("span",{className:j,children:Je.selectRow})})}):null,q.map(t=>e("td",{className:Ve?.cell,style:{...Ft,textAlign:t.align??"start"},children:t.render?t.render(a.row,Ct.start+r):E(V(t,a.row))},t.key))]},a.key)})})]})}),Jt?t("div",{className:Qt("mp-data-table__footer border-mp-outline-variant flex flex-wrap items-center gap-3","text-mp-on-surface-variant border-t",N,Ve?.footer),style:{padding:`${Ze} ${Ye}`},children:[e("span",{className:"mp-data-table__count",children:v(Je.total,{total:String(jt.length)})}),bt.size>0?e("span",{className:"mp-data-table__selected text-mp-primary",children:v(Je.selected,{count:String(bt.size)})}):null,e("span",{className:"flex-1"}),me&&be.length>0?e(s,{size:"xs",label:Je.perPage,floatingLabel:!1,value:mt,onValueChange:e=>(e=>{void 0===he&&dt(e),_t(1),ge?.(e)})(Number(e)),items:be.map(e=>({value:e})),className:"mp-data-table__page-size",style:{minWidth:"9.5rem"}}):null,me?e(l,{size:"xs",color:Oe,count:Ct.pages,page:Ct.page,onPageChange:_t,locale:Ge}):null]}):null]})}
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{MPButton as n}from"../button/MPButton.js";import{MPCheckbox as r}from"../checkbox/MPCheckbox.js";import{MPIcon as o}from"../icon/MPIcon.js";import{MPPagination as l}from"../pagination/MPPagination.js";import{MPSelect as s}from"../select/MPSelect.js";import{MPTextField as i}from"../text-field/MPTextField.js";import{ArrowDownIcon as c,ArrowUpIcon as d,SearchIcon as m}from"../../constants/icons.js";import{accentSlots as u}from"../../internal/accent.js";import{containerSurface as p}from"../../internal/elevation.js";import{useMPColor as f,useMPDensity as h,useMPSize as y}from"../../internal/config.js";import{useMPLocale as g,useMPMessages as b}from"../../internal/locale.js";import{fillMessage as v}from"../../internal/i18n.js";import{checkServerLocale as x,intlLocale as k}from"../../internal/intl.js";import{DATA_TABLE as w}from"../../internal/messages/data-table.js";import{TABLE as N}from"../../internal/messages/table.js";import{TRANSFER as S}from"../../internal/messages/transfer.js";import{CONTROL_ICON as C,META_TEXT as j}from"../../internal/scale.js";import{VISUALLY_HIDDEN as z}from"../../internal/visually-hidden.js";import{CELL_TEXT as _,HEAD_TEXT as M,ROW as P,cellPadX as L,cellPadY as E,drawableCell as $}from"../../internal/table.js";import{DEFAULT_COLUMN_WIDTH as A,MIN_COLUMN_WIDTH as D,compareValues as I,downloadText as K,keysBetween as R,nextSort as W,pageBounds as B,searchHaystack as F,searchText as T,sortRows as X,toCsv as V}from"../../internal/data-table.js";function H(e,t){return e.value?e.value(t):t[e.key]}const Y={xs:36,sm:40,md:48,lg:52,xl:60},q=/*@__PURE__*/["group/sort -m-1 flex w-full cursor-pointer items-center gap-1 rounded-mp-xs p-1","appearance-none border-0 bg-transparent text-inherit text-start [font:inherit]","transition-[color] duration-(--mp-sys-motion-duration-short4) ease-mp-standard","hover:text-mp-on-surface","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none"].join(" "),O=/*@__PURE__*/["mp-data-table__resize absolute inset-y-0 end-0 z-10 w-2 translate-x-1/2 rtl:-translate-x-1/2","cursor-col-resize touch-none select-none appearance-none border-0 bg-transparent p-0","after:absolute after:inset-y-1 after:start-1/2 after:w-px after:bg-transparent","after:transition-[background-color] after:duration-(--mp-sys-motion-duration-short4)","hover:after:bg-mp-primary data-dragging:after:bg-mp-primary","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-solid outline-none"].join(" "),G={borderTop:"1px solid var(--_mp-color-outline-variant)",backgroundColor:"var(--_mp-row)"};function J({entry:a,index:n,at:o,chosen:l,headers:s,striped:i,lit:c,pressable:d,selectable:m,tabStop:u,ticks:p,rowClassName:f,cellClassName:h,padX:y,padY:g,size:b,color:v,selectLabel:x,onPress:k}){const w={padding:`${g} ${y}`};return t("tr",{"aria-selected":m?l:void 0,className:[P,f,i&&o%2==1?"[--_mp-row:var(--_mp-color-surface-container-low)]":"",l?"[--_mp-row:var(--_mp-color-secondary-container)]":"",c&&!l?"hover:[--_mp-row:var(--_mp-color-surface-container)]":"",d&&"cursor-pointer",u&&["outline-mp-secondary focus-visible:outline-2","focus-visible:-outline-offset-2 focus-visible:outline-solid outline-none"].join(" ")].filter(Boolean).join(" "),style:G,tabIndex:u?0:void 0,onClick:e=>k(a,n,e.shiftKey),onKeyDown:u?e=>{"Enter"!==e.key&&" "!==e.key||e.target===e.currentTarget&&(e.preventDefault(),k(a,n,e.shiftKey))}:void 0,children:[p?e("td",{style:w,children:e(r,{size:b,color:v,checked:l,onCheckedChange:()=>k(a,n,!1),label:e("span",{className:z,children:x})})}):null,s.map(t=>e("td",{className:h,style:{...w,textAlign:t.align??"start"},children:t.render?t.render(a.row,o):$(H(t,a.row))},t.key))]})}const Q=/*@__PURE__*/a.memo(J);export function MPDataTable({headers:$,items:J,getRowKey:U,caption:Z,empty:ee,locale:te,sortable:ae=!1,sortMode:ne="single",sort:re,defaultSort:oe,onSortChange:le,searchable:se=!1,search:ie,defaultSearch:ce,onSearchChange:de,searchLabel:me,filter:ue,toolbar:pe,paged:fe=!1,page:he,defaultPage:ye,onPageChange:ge,pageSize:be,defaultPageSize:ve,onPageSizeChange:xe,pageSizeOptions:ke=[10,25,50,100],resizable:we=!1,columnWidths:Ne,defaultColumnWidths:Se,onColumnWidthsChange:Ce,selectionMode:je="none",selected:ze,defaultSelected:_e,onSelectedChange:Me,checkboxes:Pe=!1,onRowClick:Le,exportable:Ee=!1,exportFileName:$e="table.csv",exportEscapeFormulas:Ae=!0,onExport:De,striped:Ie=!1,hoverable:Ke=!1,stickyHeader:Re=!1,variant:We="outlined",elevation:Be,size:Fe,color:Te,density:Xe,className:Ve,style:He,classNames:Ye,...qe}){const Oe=y(Fe),Ge=f(Te),Je=h(Xe),Qe=g(te),Ue=b(w,Qe),Ze=b(N,Qe),et=b(S,Qe),tt=L(Oe,Je),at=E(Oe,Je),[nt,rt]=a.useState(()=>[...oe??[]]),ot=re??nt,[lt,st]=a.useState(ce??""),it=ie??lt,[ct,dt]=a.useState(ye??1),mt=he??ct,[ut,pt]=a.useState(ve??25),ft=be??ut,[ht,yt]=a.useState(()=>({...Se})),gt=Ne??ht,[bt,vt]=a.useState(()=>[..._e??[]]),xt=ze??bt,kt=a.useMemo(()=>new Set(xt.map(e=>String(e))),[xt]),wt=a.useRef(null),Nt=a.useMemo(()=>J.map((e,t)=>{const a=U?U(e,t):t;return{row:e,identity:a,key:String(a),origin:t}}),[J,U]),St=T(it.trim()),Ct=""!==St,jt=a.useMemo(()=>{if(!Ct)return null;const e=$.filter(e=>!1!==e.searchable);return Nt.map(t=>F(e.map(e=>H(e,t.row))))},[Nt,$,Ct]),zt=a.useMemo(()=>{const e=""!==St&&jt?Nt.filter((e,t)=>jt[t].includes(St)):Nt;return ue?e.filter(e=>ue(e.row,e.origin)):e},[Nt,jt,St,ue]),_t=a.useMemo(()=>(x(Qe),new Intl.Collator(k(Qe),{numeric:!0,sensitivity:"base"})),[Qe]),Mt=a.useMemo(()=>X(zt,ot,(e,t)=>{const a=$.find(t=>t.key===e);if(!a)return null;const n="desc"===t,r=a.compare;if(r)return(e,t)=>n?-r(e.row,t.row):r(e.row,t.row);const o=new Map,l=e=>(o.has(e)||o.set(e,H(a,e.row)),o.get(e));return(e,t)=>I(l(e),l(t),_t,n)}),[zt,ot,$,_t]),Pt=B(Mt.length,mt,ft),Lt=fe?Mt.slice(Pt.start,Pt.end):Mt,Et=e=>{void 0===he&&dt(e),ge?.(e)},$t=e=>{void 0===Ne&&yt(e),Ce?.(e)},At=e=>{const t=new Set(e),a=[],n=[];for(const e of Nt)t.has(e.key)&&(n.push(e.identity),a.push(e.row));void 0===ze&&vt(n),Me?.(n,a)},Dt="none"!==je,It="multiple"===je,Kt=Pe&&Dt,Rt=(e,t,a)=>{if(Le?.(e.row,Pt.start+t),Dt){if(!It)return At(kt.has(e.key)?[]:[e.key]),void(wt.current=e.key);if(a&&null!==wt.current){const t=R(Lt.map(e=>e.key),wt.current,e.key);return void At([...new Set([...kt,...t])])}wt.current=e.key,At(kt.has(e.key)?[...kt].filter(t=>t!==e.key):[...kt,e.key])}},Wt=a.useRef(Rt);Wt.current=Rt;const Bt=a.useCallback((e,t,a)=>Wt.current(e,t,a),[]),Ft=Lt.map(e=>e.key),Tt=Ft.filter(e=>kt.has(e)).length,Xt=Ft.length>0&&Tt===Ft.length,Vt=e=>gt[e.key]??e.width??A,Ht=a.useRef(null);a.useEffect(()=>()=>{null!==Ht.current&&(document.body.style.userSelect=Ht.current,Ht.current=null)},[]);const Yt=(e,t)=>{const a=Math.max(D,e.minWidth??D);$t({...gt,[e.key]:Math.max(a,Vt(e)+t)})},qt=e=>{const t={...gt};delete t[e.key],$t(t)},Ot={padding:`${at} ${tt}`},Gt={...Ot,backgroundColor:"var(--_mp-color-surface-container)"},Jt=G,Qt=$.length+(Kt?1:0),Ut=Boolean(Le)||Dt&&!Kt,Zt=Ke||Dt||Boolean(Le),ea=se||Ee||void 0!==pe,ta=fe||Dt,aa=(...e)=>e.filter(Boolean).join(" ");return t("div",{"data-mp-size":Oe,"data-mp-variant":We,className:aa("mp-data-table rounded-mp-md flex flex-col",p(We,Be),Ve),style:{...u(Ge),...He},...qe,children:[ea?t("div",{className:aa("mp-data-table__toolbar flex flex-wrap items-center gap-2",Ye?.toolbar),style:{padding:`${at} ${tt}`},children:[se?e(i,{size:Oe,value:it,onChange:e=>{void 0===ie&&st(e),Et(1),de?.(e)},label:me??et.search,startIcon:e(o,{icon:m,size:C[Oe]}),className:"mp-data-table__search min-w-0 flex-1"}):e("div",{className:"min-w-0 flex-1"}),pe,Ee?e(n,{size:Oe,variant:"text",color:Ge,onClick:()=>{const e=$.filter(e=>!1!==e.exportable),t=e.map(e=>"string"==typeof e.label?e.label:e.key),a=Mt.map(t=>e.map(e=>e.exportValue?e.exportValue(t.row):H(e,t.row))),n=V([t,...a],{escapeFormulas:Ae});De?De(n):K(n,$e,"text/csv;charset=utf-8")},startIcon:e(o,{icon:c,size:C[Oe]}),children:Ue.download}):null]}):null,e("div",{className:"mp-data-table__scroll min-h-0 flex-1 overflow-auto",children:t("table",{className:aa("text-mp-on-surface w-full text-start",_[Oe],Ye?.table),style:{borderCollapse:"collapse",...we?{tableLayout:"fixed",minWidth:$.reduce((e,t)=>e+Vt(t),Kt?Y[Oe]:0)}:void 0},children:[Z?e("caption",{className:`text-mp-on-surface-variant ${j}`,style:{...Ot,textAlign:"start"},children:Z}):null,t("colgroup",{children:[Kt?e("col",{style:{width:Y[Oe]}}):null,$.map(t=>e("col",{style:we||void 0!==gt[t.key]||void 0!==t.width?{width:Vt(t)}:void 0},t.key))]}),e("thead",{className:Ye?.head,children:t("tr",{children:[Kt?e("th",{scope:"col",className:aa("whitespace-nowrap",Re&&"sticky top-0 z-20"),style:Gt,children:e(r,{size:Oe,color:Ge,checked:Xt,indeterminate:Tt>0&&!Xt,onCheckedChange:()=>{const e=new Set(Ft);At(Xt?[...kt].filter(t=>!e.has(t)):[...new Set([...kt,...Ft])])},label:e("span",{className:z,children:Ue.selectAll}),disabled:!It||0===Ft.length})}):null,$.map(a=>{const n=a.sortable??ae,r=(l=a.key,ot.findIndex(e=>e.key===l));var l;const s=-1===r?void 0:ot[r],i=a.resizable??we,c=a.align??"start";return t("th",{scope:"col","aria-sort":n?void 0===s?"none":"asc"===s.direction?"ascending":"descending":void 0,className:aa("text-mp-on-surface-variant relative whitespace-nowrap",M[Oe],Re&&"sticky top-0 z-10"),style:{...Gt,textAlign:c},children:[n?t("button",{type:"button",className:aa(q,"end"===c&&"justify-end","center"===c&&"justify-center"),onClick:e=>((e,t)=>{const a=W(ot,e,t&&"multiple"===ne);void 0===re&&rt(a),le?.(a)})(a.key,e.shiftKey),children:[e("span",{className:"min-w-0 truncate",children:a.label??a.key}),e(o,{icon:d,size:C[Oe]-6,className:aa("shrink-0 transition-[rotate,opacity]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard",void 0===s?"opacity-0 group-hover/sort:opacity-38":"text-mp-primary opacity-100","desc"===s?.direction&&"rotate-180")}),ot.length>1&&-1!==r?e("span",{className:"text-mp-primary shrink-0 tabular-nums",children:r+1}):null]}):a.label??a.key,i?e("button",{type:"button","aria-label":Ue.resize,className:O,onPointerDown:e=>((e,t)=>{const a=t.currentTarget;try{a.setPointerCapture(t.pointerId)}catch{}a.dataset.dragging="true";const n=document.body.style.userSelect;Ht.current=n,document.body.style.userSelect="none";const r=t.clientX,o=Vt(e),l="rtl"===getComputedStyle(a).direction?-1:1,s=Math.max(D,e.minWidth??D);let i=null,c=0;const d=()=>{c=0,null!==i&&($t({...gt,[e.key]:i}),i=null)},m=e=>{i=Math.max(s,Math.round(o+(e.clientX-r)*l)),0===c&&(c=requestAnimationFrame(d))},u=()=>{cancelAnimationFrame(c),d(),a.removeEventListener("pointermove",m),a.removeEventListener("pointerup",u),a.removeEventListener("pointercancel",u),delete a.dataset.dragging,null!==Ht.current&&(document.body.style.userSelect=Ht.current,Ht.current=null)};a.addEventListener("pointermove",m),a.addEventListener("pointerup",u),a.addEventListener("pointercancel",u)})(a,e),onDoubleClick:()=>qt(a),onKeyDown:e=>{const t=e.shiftKey?32:8;"ArrowRight"===e.key?(e.preventDefault(),Yt(a,t)):"ArrowLeft"===e.key?(e.preventDefault(),Yt(a,-t)):"Home"===e.key&&(e.preventDefault(),qt(a))}}):null]},a.key)})]})}),e("tbody",{children:0===Lt.length?e("tr",{className:P,style:Jt,children:e("td",{colSpan:Qt,className:"text-mp-on-surface-variant",style:{padding:`2rem ${tt}`,textAlign:"center"},children:ee??Ze.empty})}):Lt.map((t,a)=>e(Q,{entry:t,index:a,at:Pt.start+a,chosen:kt.has(t.key),headers:$,striped:Ie,lit:Zt,pressable:Dt||Boolean(Le),selectable:Dt,tabStop:Ut,ticks:Kt,rowClassName:Ye?.row,cellClassName:Ye?.cell,padX:tt,padY:at,size:Oe,color:Ge,selectLabel:Ue.selectRow,onPress:Bt},t.key))})]})}),ta?t("div",{className:aa("mp-data-table__footer border-mp-outline-variant flex flex-wrap items-center gap-3","text-mp-on-surface-variant border-t",j,Ye?.footer),style:{padding:`${at} ${tt}`},children:[e("span",{className:"mp-data-table__count",children:v(Ue.total,{total:String(Mt.length)})}),kt.size>0?e("span",{className:"mp-data-table__selected text-mp-primary",children:v(Ue.selected,{count:String(kt.size)})}):null,e("span",{className:"flex-1"}),fe&&ke.length>0?e(s,{size:"xs",label:Ue.perPage,floatingLabel:!1,value:ft,onValueChange:e=>(e=>{void 0===be&&pt(e),Et(1),xe?.(e)})(Number(e)),items:ke.map(e=>({value:e})),className:"mp-data-table__page-size",style:{minWidth:"9.5rem"}}):null,fe?e(l,{size:"xs",color:Ge,count:Pt.pages,page:Pt.page,onPageChange:Et,locale:Qe}):null]}):null]})}
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as n from"react";import{MPButton as a}from"../button/MPButton.js";import{MPIcon as t}from"../icon/MPIcon.js";import{ArrowRightIcon as r,CalendarIcon as s}from"../../constants/icons.js";import{Calendar as o}from"../../internal/Calendar.js";import{FOOTER_SIZE as i,MPPickerFooter as c,MPPickerShell as u,useDisplaySamples as m}from"../../internal/Picker.js";import{useMPLocale as d,useMPMessages as p}from"../../internal/locale.js";import{PICKER as f}from"../../internal/messages/picker.js";import{MPWidthSizer as h}from"../../internal/WidthSizer.js";import{CONTROL_ICON as v,META_TEXT as x}from"../../internal/scale.js";import{addMonths as g,compareDay as j,formatDate as b,isValidDate as w,localeWeekStart as N,startOfDay as S,startOfMonth as C,toISODate as D,today as k,withPlaceholder as y}from"../../internal/date.js";import{useMPColor as O,useMPSize as P}from"../../internal/config.js";const z={start:null,end:null};export const MPDateRangePicker=/*@__PURE__*/n.forwardRef(function({value:M,defaultValue:B,onValueChange:I,open:R,defaultOpen:V,onOpenChange:E,defaultMonth:F,minDate:W,maxDate:$,shouldDisableDate:_,locale:q,weekStartsOn:A,format:G={dateStyle:"medium"},monthCount:H=2,startPlaceholder:J,endPlaceholder:K,presets:L,clearable:Q=!1,closeOnSelect:T=!0,labels:U,name:X,size:Y,color:Z,readOnly:ee=!1,disabled:le=!1,startIcon:ne,...ae},te){const re=P(Y),se=O(Z),oe=d(q),ie=p(f,oe,U),ce=A??N(oe),[ue,me]=n.useState(B??z),de=void 0!==M?M??z:ue,pe=w(de.start)?de.start:null,fe=w(de.end)?de.end:null,[he,ve]=n.useState(V??!1),xe=R??he,[ge,je]=n.useState(null),[be,we]=n.useState(null),[Ne,Se]=n.useState(()=>C(pe??F??k()));n.useEffect(()=>{xe?Se(C(pe??F??k())):(je(null),we(null))},[xe]);const Ce=e=>{e&&(ee||le)||(void 0===R&&ve(e),E?.(e))},De=e=>{void 0===M&&me(e),I?.(e)},ke=ge??pe,ye=null!==ge?be:fe,Oe=(l,n)=>w(l)?b(l,oe,G):e("span",{className:"text-mp-on-surface-variant",children:n??""}),Pe=g(Ne,1),ze=2===H,Me=m(oe,G),Be=null!==ge?ie.end:null===pe?ie.start:null,Ie={size:re,color:se,locale:oe,weekStartsOn:ce,selected:[pe,fe,ge],rangeStart:ke,rangeEnd:ye,onSelect:e=>{const l=S(e);if(null===ge)return je(l),we(l),void De({start:l,end:null});const[n,a]=j(l,ge)<0?[l,ge]:[ge,l];je(null),we(null),De({start:n,end:a}),T&&Ce(!1)},onPreviewChange:e=>{null!==ge&&we(e??ge)},minDate:W,maxDate:$,shouldDisableDate:_,showOutsideDays:!1,labels:ie};return e(u,{...ae,slug:"date-range-picker",size:re,color:se,readOnly:ee,disabled:le,triggerRef:te,startIcon:void 0===ne?e(t,{icon:s,size:v[re]}):ne,display:l("span",{className:"flex min-w-0 items-center gap-1.5",children:[l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:Oe(pe,J)}),e(h,{samples:y(Me,J)})]}),e("span",{"aria-hidden":"true",className:"text-mp-on-surface-variant flex shrink-0 items-center rtl:rotate-180",children:e(t,{icon:r,size:v[re]})}),l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:Oe(fe,K)}),e(h,{samples:y(Me,K)})]})]}),empty:null===pe&&null===fe,clearable:Q,onClear:()=>De(z),open:xe,onOpenChange:Ce,labels:ie,hiddenValues:X?[{name:X,value:pe?D(pe):""},{name:X,value:fe?D(fe):""}]:void 0,children:l("div",{className:"flex flex-col gap-1.5",children:[l("div",{className:"flex items-stretch gap-2",children:[L&&L.length>0?e("div",{className:"border-mp-outline-variant flex max-h-[calc(var(--_mp-cell,2.5rem)*8)] flex-col overflow-y-auto border-e pe-1.5",children:L.map((l,n)=>e(a,{variant:"text",size:i[re],color:se,className:"justify-start whitespace-nowrap",onClick:()=>(e=>{const l="function"==typeof e.value?e.value():e.value;je(null),we(null),De(l),w(l.start)&&Se(C(l.start)),T&&Ce(!1)})(l),children:l.label},n))}):null,e(o,{...Ie,month:Ne,onMonthChange:Se,showNextButton:!ze,autoFocus:!0}),ze?e(o,{...Ie,month:Pe,onMonthChange:e=>Se(g(e,-1)),showPreviousButton:!1}):null]}),Q||null!==Be?l(c,{children:[null!==Be?e("span",{className:`text-mp-on-surface-variant me-auto ${x}`,children:Be}):null,Q?e(a,{variant:"text",size:i[re],color:se,onClick:()=>{je(null),we(null),De(z),Ce(!1)},children:ie.clear}):null]}):null]})})});
2
+ import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as n from"react";import{MPButton as a}from"../button/MPButton.js";import{MPIcon as t}from"../icon/MPIcon.js";import{ArrowRightIcon as r,CalendarIcon as s}from"../../constants/icons.js";import{Calendar as o}from"../../internal/Calendar.js";import{FOOTER_SIZE as i,MPPickerFooter as c,MPPickerShell as u,useDisplaySamples as m}from"../../internal/Picker.js";import{useMPLocale as d,useMPMessages as p}from"../../internal/locale.js";import{PICKER as f}from"../../internal/messages/picker.js";import{MPWidthSizer as h}from"../../internal/WidthSizer.js";import{CONTROL_ICON as v,META_TEXT as x}from"../../internal/scale.js";import{addMonths as g,compareDay as j,formatDate as b,isValidDate as w,localeWeekStart as N,startOfDay as S,startOfMonth as C,toISODate as D,today as k,withPlaceholder as y}from"../../internal/date.js";import{useMPColor as O,useMPSize as P}from"../../internal/config.js";const z={start:null,end:null};export const MPDateRangePicker=/*@__PURE__*/n.forwardRef(function({value:M,defaultValue:B,onValueChange:I,open:R,defaultOpen:V,onOpenChange:E,defaultMonth:F,minDate:W,maxDate:$,shouldDisableDate:_,locale:q,weekStartsOn:A,format:G={dateStyle:"medium"},monthCount:H=2,startPlaceholder:J,endPlaceholder:K,presets:L,clearable:Q=!1,closeOnSelect:T=!0,labels:U,name:X,size:Y,color:Z,readOnly:ee=!1,disabled:le=!1,startIcon:ne,...ae},te){const re=P(Y),se=O(Z),oe=d(q),ie=p(f,oe,U),ce=A??N(oe),[ue,me]=n.useState(B??z),de=void 0!==M?M??z:ue,pe=w(de.start)?de.start:null,fe=w(de.end)?de.end:null,[he,ve]=n.useState(V??!1),xe=R??he,[ge,je]=n.useState(null),[be,we]=n.useState(null),[Ne,Se]=n.useState(()=>C(pe??F??k()));n.useEffect(()=>{xe?Se(C(pe??F??k())):(je(null),we(null))},[xe]);const Ce=e=>{e&&(ee||le)||(void 0===R&&ve(e),E?.(e))},De=e=>{void 0===M&&me(e),I?.(e)},ke=ge??pe,ye=null!==ge?be:fe,Oe=(l,n)=>w(l)?b(l,oe,G):e("span",{className:"text-mp-on-surface-variant",children:n??""}),Pe=n.useMemo(()=>g(Ne,1),[Ne]),ze=2===H,Me=m(oe,G),Be=null!==ge?ie.end:null===pe?ie.start:null,Ie={size:re,color:se,locale:oe,weekStartsOn:ce,selected:[pe,fe,ge],rangeStart:ke,rangeEnd:ye,onSelect:e=>{const l=S(e);if(null===ge)return je(l),we(l),void De({start:l,end:null});const[n,a]=j(l,ge)<0?[l,ge]:[ge,l];je(null),we(null),De({start:n,end:a}),T&&Ce(!1)},onPreviewChange:e=>{null!==ge&&we(e??ge)},minDate:W,maxDate:$,shouldDisableDate:_,showOutsideDays:!1,labels:ie};return e(u,{...ae,slug:"date-range-picker",size:re,color:se,readOnly:ee,disabled:le,triggerRef:te,startIcon:void 0===ne?e(t,{icon:s,size:v[re]}):ne,display:l("span",{className:"flex min-w-0 items-center gap-1.5",children:[l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:Oe(pe,J)}),e(h,{samples:y(Me,J)})]}),e("span",{"aria-hidden":"true",className:"text-mp-on-surface-variant flex shrink-0 items-center rtl:rotate-180",children:e(t,{icon:r,size:v[re]})}),l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:Oe(fe,K)}),e(h,{samples:y(Me,K)})]})]}),empty:null===pe&&null===fe,clearable:Q,onClear:()=>De(z),open:xe,onOpenChange:Ce,labels:ie,hiddenValues:X?[{name:X,value:pe?D(pe):""},{name:X,value:fe?D(fe):""}]:void 0,children:l("div",{className:"flex flex-col gap-1.5",children:[l("div",{className:"flex items-stretch gap-2",children:[L&&L.length>0?e("div",{className:"border-mp-outline-variant flex max-h-[calc(var(--_mp-cell,2.5rem)*8)] flex-col overflow-y-auto border-e pe-1.5",children:L.map((l,n)=>e(a,{variant:"text",size:i[re],color:se,className:"justify-start whitespace-nowrap",onClick:()=>(e=>{const l="function"==typeof e.value?e.value():e.value;je(null),we(null),De(l),w(l.start)&&Se(C(l.start)),T&&Ce(!1)})(l),children:l.label},n))}):null,e(o,{...Ie,month:Ne,onMonthChange:Se,showNextButton:!ze,autoFocus:!0}),ze?e(o,{...Ie,month:Pe,onMonthChange:e=>Se(g(e,-1)),showPreviousButton:!1}):null]}),Q||null!==Be?l(c,{children:[null!==Be?e("span",{className:`text-mp-on-surface-variant me-auto ${x}`,children:Be}):null,Q?e(a,{variant:"text",size:i[re],color:se,onClick:()=>{je(null),we(null),De(z),Ce(!1)},children:ie.clear}):null]}):null]})})});
@@ -113,6 +113,18 @@ export interface MPDrawerProps {
113
113
  * @default true
114
114
  */
115
115
  dismissible?: boolean;
116
+ /**
117
+ * Keeps a closed `modal` drawer's contents in the document, hidden, instead
118
+ * of taking them out of it.
119
+ *
120
+ * For a drawer that is a site's navigation on a narrow screen: closed, its
121
+ * links are otherwise not on the page at all, which is the page a crawler
122
+ * renders at a phone's width. A modal drawer is drawn into a portal, which no
123
+ * server renders, so the links arrive with hydration either way — a server
124
+ * should still send them somewhere in the page itself.
125
+ * @default false
126
+ */
127
+ keepMounted?: boolean;
116
128
  /**
117
129
  * How far the panel reaches in by default, and the type scale inside it.
118
130
  * `md` is MD3's own 360dp navigation drawer.
@@ -190,4 +202,4 @@ export declare const MPDrawerClose: React.ForwardRefExoticComponent<Omit<import(
190
202
  * `SLIDE` gives a reader who asked for less motion the old behaviour exactly:
191
203
  * the fade, with nowhere to travel from.
192
204
  */
193
- export declare function MPDrawer({ side, mode, open, defaultOpen, onOpenChange, trigger, title, description, actions, dividers, showClose, closeLabel, locale: localeProp, extent, rounded, dismissible, size: sizeProp, classNames, className, style, children }: MPDrawerProps): React.JSX.Element | null;
205
+ export declare function MPDrawer({ side, mode, open, defaultOpen, onOpenChange, trigger, title, description, actions, dividers, showClose, closeLabel, locale: localeProp, extent, rounded, dismissible, keepMounted, size: sizeProp, classNames, className, style, children }: MPDrawerProps): React.JSX.Element | null;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import*as a from"react";import{Dialog as o}from"@base-ui/react/dialog";import{MPIcon as n}from"../icon/MPIcon.js";import{CloseIcon as r}from"../../constants/icons.js";import{useMPLocale as i,useMPMessages as s}from"../../internal/locale.js";import{COMMON as d}from"../../internal/messages/common.js";import{MPStateLayer as m}from"../../internal/StateLayer.js";import{cssLength as f}from"../../internal/length.js";import{hasContent as c,META_TEXT as p,PROSE_TEXT as u,SHEET_GAP as x,SHEET_PAD_X as h,SHEET_PAD_Y as g,SHEET_TITLE as b}from"../../internal/scale.js";import{FADE as y,PORTAL_LAYER as j,SCRIM as v,SHEET_MOTION as w}from"../../internal/surface.js";import{useMPSize as N}from"../../internal/config.js";const $={xs:"w-60",sm:"w-72",md:"w-90",lg:"w-104",xl:"w-120"},k={left:"rounded-r-mp-lg",right:"rounded-l-mp-lg",top:"rounded-b-mp-xl",bottom:"rounded-t-mp-xl"},C={left:"border-r",right:"border-l",top:"border-b",bottom:"border-t"},z={left:"flex-row justify-start",right:"flex-row justify-end",top:"flex-col justify-start",bottom:"flex-col justify-end"},P={left:"motion-safe:data-starting-style:-translate-x-full motion-safe:data-ending-style:-translate-x-full",right:"motion-safe:data-starting-style:translate-x-full motion-safe:data-ending-style:translate-x-full",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"},B=`transition-[opacity,translate] ${w}`,D="border-mp-outline-variant border-t";export const MPDrawerClose=o.Close;export function MPDrawer({side:w="left",mode:O="modal",open:M,defaultOpen:L,onOpenChange:S,trigger:T,title:F,description:I,actions:R,dividers:V=!1,showClose:q,closeLabel:A,locale:E,extent:G,rounded:H=!0,dismissible:J=!0,size:K,classNames:Q,className:U,style:W,children:X}){const Y=N(K),Z=i(E),_=s(d,Z),ee="modal"===O,te="left"===w||"right"===w,le=q??ee,ae=A??_.close,[oe,ne]=a.useState(L??!0),re=M??oe,ie=h[Y],se=g[Y],de=V?`${ie} ${se}`:ie,me=c(F)||c(I),fe=c(R),ce=void 0===G?null:{[te?"width":"height"]:f(G)},pe=["mp-drawer relative flex flex-col overflow-hidden box-border","border-mp-outline-variant outline-none",ee?"bg-mp-surface-container-low shadow-mp-1":"bg-mp-surface","text-mp-on-surface",u[Y],C[w],H?k[w]:"",ee?`${B} ${P[w]}`:"",te?`h-full max-w-full ${void 0===G?$[Y]:""}`:"w-full "+(void 0===G?"max-h-[85%]":""),V?"":`${se} ${x[Y]}`,U??""].filter(Boolean).join(" "),ue=ee?o.Title:"h2",xe=ee?o.Description:"p",he=/*@__PURE__*/["group text-mp-on-surface-variant relative flex size-10 shrink-0","rounded-mp-full cursor-pointer items-center justify-center","appearance-none border-0 bg-transparent","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),ge=t(l,{children:[me||le?t("div",{className:`flex shrink-0 items-start gap-3 ${de}`,children:[t("div",{className:"flex min-w-0 flex-1 flex-col",children:[c(F)?e(ue,{className:`m-0 ${b[Y]}`,children:F}):null,c(I)?e(xe,{className:`text-mp-on-surface-variant m-0 ${p}`,children:I}):null]}),le?ee?t(o.Close,{"aria-label":ae,className:he,children:[e(m,{}),e(n,{icon:r,size:20})]}):t("button",{type:"button","aria-label":ae,className:he,onClick:()=>{void 0===M&&ne(!1),S?.(!1)},children:[e(m,{}),e(n,{icon:r,size:20})]}):null]}):null,c(X)?e("div",{className:["min-h-0 flex-1 overflow-y-auto overscroll-contain",de,V&&(me||le)?D:"",V?"":"-my-1 py-1"].filter(Boolean).join(" "),children:X}):null,fe?e("div",{className:["flex shrink-0 flex-wrap items-center justify-end gap-2",de,V?D:""].filter(Boolean).join(" "),children:R}):null]});return ee?t(o.Root,{open:M,defaultOpen:L,disablePointerDismissal:!J,onOpenChange:(e,t)=>{J||e||"escape-key"!==t.reason?S?.(e):t.cancel()},children:[T?e(o.Trigger,{render:T}):null,t(o.Portal,{children:[e(o.Backdrop,{className:[`${j} fixed inset-0`,y,v,Q?.backdrop??""].filter(Boolean).join(" ")}),e(o.Viewport,{className:`${j} fixed inset-0 flex ${z[w]}`,children:e(o.Popup,{"data-mp-size":Y,"data-mp-side":w,"data-mp-mode":O,className:pe,style:{...ce,...W},children:ge})})]})]}):re?e("div",{"data-mp-size":Y,"data-mp-side":w,"data-mp-mode":O,className:pe,style:{...ce,...W},children:ge}):null}
2
+ import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import*as o from"react";import{Dialog as a}from"@base-ui/react/dialog";import{MPIcon as n}from"../icon/MPIcon.js";import{CloseIcon as i}from"../../constants/icons.js";import{useMPLocale as r,useMPMessages as s}from"../../internal/locale.js";import{COMMON as d}from"../../internal/messages/common.js";import{MPStateLayer as m}from"../../internal/StateLayer.js";import{cssLength as f}from"../../internal/length.js";import{hasContent as c,META_TEXT as p,PROSE_TEXT as u,SHEET_GAP as h,SHEET_PAD_X as x,SHEET_PAD_Y as g,SHEET_TITLE as b}from"../../internal/scale.js";import{FADE as y,PORTAL_LAYER as j,SCRIM as v,SHEET_MOTION as w}from"../../internal/surface.js";import{useMPSize as N}from"../../internal/config.js";const $={xs:"w-60",sm:"w-72",md:"w-90",lg:"w-104",xl:"w-120"},k={left:"rounded-r-mp-lg",right:"rounded-l-mp-lg",top:"rounded-b-mp-xl",bottom:"rounded-t-mp-xl"},C={left:"border-r",right:"border-l",top:"border-b",bottom:"border-t"},z={left:"flex-row justify-start",right:"flex-row justify-end",top:"flex-col justify-start",bottom:"flex-col justify-end"},P={left:"motion-safe:data-starting-style:-translate-x-full motion-safe:data-ending-style:-translate-x-full",right:"motion-safe:data-starting-style:translate-x-full motion-safe:data-ending-style:translate-x-full",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"},B=`transition-[opacity,translate] ${w}`,M="border-mp-outline-variant border-t";export const MPDrawerClose=a.Close;export function MPDrawer({side:w="left",mode:D="modal",open:O,defaultOpen:L,onOpenChange:S,trigger:T,title:F,description:I,actions:R,dividers:V=!1,showClose:q,closeLabel:A,locale:E,extent:G,rounded:H=!0,dismissible:J=!0,keepMounted:K=!1,size:Q,classNames:U,className:W,style:X,children:Y}){const Z=N(Q),_=r(E),ee=s(d,_),te="modal"===D,le="left"===w||"right"===w,oe=q??te,ae=A??ee.close,[ne,ie]=o.useState(L??!0),re=O??ne,se=x[Z],de=g[Z],me=V?`${se} ${de}`:se,fe=c(F)||c(I),ce=c(R),pe=void 0===G?null:{[le?"width":"height"]:f(G)},ue=["mp-drawer relative flex flex-col overflow-hidden box-border","[&[hidden]]:hidden","border-mp-outline-variant outline-none",te?"bg-mp-surface-container-low shadow-mp-1":"bg-mp-surface","text-mp-on-surface",u[Z],C[w],H?k[w]:"",te?`${B} ${P[w]}`:"",le?`h-full max-w-full ${void 0===G?$[Z]:""}`:"w-full "+(void 0===G?"max-h-[85%]":""),V?"":`${de} ${h[Z]}`,W??""].filter(Boolean).join(" "),he=te?a.Title:"h2",xe=te?a.Description:"p",ge=/*@__PURE__*/["group text-mp-on-surface-variant relative flex size-10 shrink-0","rounded-mp-full cursor-pointer items-center justify-center","appearance-none border-0 bg-transparent","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),be=t(l,{children:[fe||oe?t("div",{className:`flex shrink-0 items-start gap-3 ${me}`,children:[t("div",{className:"flex min-w-0 flex-1 flex-col",children:[c(F)?e(he,{className:`m-0 ${b[Z]}`,children:F}):null,c(I)?e(xe,{className:`text-mp-on-surface-variant m-0 ${p}`,children:I}):null]}),oe?te?t(a.Close,{"aria-label":ae,className:ge,children:[e(m,{}),e(n,{icon:i,size:20})]}):t("button",{type:"button","aria-label":ae,className:ge,onClick:()=>{void 0===O&&ie(!1),S?.(!1)},children:[e(m,{}),e(n,{icon:i,size:20})]}):null]}):null,c(Y)?e("div",{className:["min-h-0 flex-1 overflow-y-auto overscroll-contain",me,V&&(fe||oe)?M:"",V?"":"-my-1 py-1"].filter(Boolean).join(" "),children:Y}):null,ce?e("div",{className:["flex shrink-0 flex-wrap items-center justify-end gap-2",me,V?M:""].filter(Boolean).join(" "),children:R}):null]});return te?t(a.Root,{open:O,defaultOpen:L,disablePointerDismissal:!J,onOpenChange:(e,t)=>{J||e||"escape-key"!==t.reason?S?.(e):t.cancel()},children:[T?e(a.Trigger,{render:T}):null,t(a.Portal,{keepMounted:K,children:[e(a.Backdrop,{className:[`${j} fixed inset-0`,y,v,U?.backdrop??""].filter(Boolean).join(" ")}),e(a.Viewport,{className:`${j} fixed inset-0 flex [&[hidden]]:hidden ${z[w]}`,children:e(a.Popup,{"data-mp-size":Z,"data-mp-side":w,"data-mp-mode":D,className:ue,style:{...pe,...X},children:be})})]})]}):re?e("div",{"data-mp-size":Z,"data-mp-side":w,"data-mp-mode":D,className:ue,style:{...pe,...X},children:be}):null}
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{MPIcon as t}from"../icon/MPIcon.js";import{CloseIcon as a,UploadIcon as i}from"../../constants/icons.js";import{fillMessage as o}from"../../internal/i18n.js";import{useMPLocale as l,useMPMessages as s}from"../../internal/locale.js";import{COMMON as c}from"../../internal/messages/common.js";import{FILE_PICKER as m}from"../../internal/messages/file-picker.js";import{MPStateLayer as p}from"../../internal/StateLayer.js";import{CONTROL_ICON as u,META_TEXT as d,PROSE_TEXT as f,STACK_GAP as h,hasContent as x}from"../../internal/scale.js";import{useMPSize as b}from"../../internal/config.js";const v={xs:"p-4",sm:"p-5",md:"p-6",lg:"p-8",xl:"p-10"};export function formatFileSize(e){if(e<1e3)return`${e} B`;const r=["kB","MB","GB","TB"];let n=e/1e3,t=0;for(;n>=1e3&&t<r.length-1;)n/=1e3,t+=1;return`${n<10?n.toFixed(1):Math.round(n)} ${r[t]}`}function g(e){return`${e.name}-${e.size}-${e.lastModified}`}const j=new Set;function y(e,r){const n=e.name.toLowerCase(),t=e.type.toLowerCase();return r.split(",").map(e=>e.trim().toLowerCase()).filter(Boolean).some(e=>e.startsWith(".")?n.endsWith(e):e.endsWith("/*")?t.startsWith(e.slice(0,-1)):t===e)}export const MPFilePicker=/*@__PURE__*/n.forwardRef(function({accept:N,multiple:k=!1,maxSize:w,maxFiles:z,value:B,defaultValue:C,onFilesChange:I,onReject:S,label:$,description:D,errorMessage:F,title:L,hint:M,icon:T,showList:W=!0,removeLabel:_,locale:P,size:R,fullWidth:E=!0,required:O=!1,disabled:q=!1,readOnly:A=!1,name:V,id:G,className:H,style:Y},J){const K=b(R),Q=l(P),U=s(c,Q),X=s(m,Q),Z=n.useRef(null);n.useImperativeHandle(J,()=>Z.current,[]);const[ee,re]=n.useState(()=>[...C??[]]),ne=B?[...B]:ee,te=n.useRef(0),[ae,ie]=n.useState(!1),oe=x(F),le=q||A,se=n.useId(),ce=n.useId(),me=n.useCallback(e=>{B||re(e),I?.(e)},[I,B]),pe=n.useCallback(e=>{const r=[],n=[],t=k?z??Number.POSITIVE_INFINITY:1,a=k?ne.length:0;for(const i of e)N&&!y(i,N)?n.push({file:i,reason:"type"}):void 0!==w&&i.size>w?n.push({file:i,reason:"size"}):a+r.length>=t?n.push({file:i,reason:"count"}):r.push(i);return{kept:r,rejections:n}},[N,ne.length,z,w,k]),[ue,de]=n.useState(j),fe=n.useCallback(e=>{const{kept:r,rejections:n}=pe(e);n.length>0&&S?.(n),r.length>0&&(de(new Set(r.map(g))),me(k?[...ne,...r]:r))},[pe,me,ne,k,S]);return r("div",{className:["mp-file-picker flex-col align-top",h[K],E?"flex w-full":"inline-flex",H??""].filter(Boolean).join(" "),style:Y,"data-mp-size":K,"data-disabled":q||void 0,"data-invalid":oe||void 0,children:[x($)?r("span",{id:ce,className:[d,q?"text-mp-on-surface/38":oe?"text-mp-error":"text-mp-on-surface-variant"].join(" "),children:[$,O?e("span",{"aria-hidden":"true",children:" *"}):null]}):null,r("div",{className:"relative flex w-full flex-col",onDragEnter:e=>{le||(e.preventDefault(),te.current+=1,ie(!0))},onDragOver:e=>{le||(e.preventDefault(),e.dataTransfer.dropEffect="copy")},onDragLeave:()=>{le||(te.current=Math.max(0,te.current-1),0===te.current&&ie(!1))},onDrop:e=>{le||(e.preventDefault(),te.current=0,ie(!1),fe(Array.from(e.dataTransfer.files)))},children:[r("button",{type:"button",id:G,disabled:q,"aria-describedby":x(D)||oe?se:void 0,"aria-invalid":oe||void 0,className:["mp-file-picker__zone group relative flex w-full flex-col items-center","justify-center gap-2 text-center","rounded-mp-md box-border border-2 border-dashed","appearance-none bg-transparent font-[inherit] outline-none","transition-[border-color,background-color] duration-(--mp-sys-motion-duration-short4)",v[K],f[K],q?"border-mp-on-surface/12 text-mp-on-surface/38 cursor-default":[A?"cursor-default":"cursor-pointer",oe?"border-mp-error":"border-mp-outline-variant","text-mp-on-surface",ae?"border-mp-primary bg-mp-primary/8":""].filter(Boolean).join(" ")].filter(Boolean).join(" "),onClick:()=>{!le&&Z.current&&(Z.current.value="",Z.current.click())},children:[le?null:e(p,{layer:"inset-0 rounded-[inherit] bg-mp-primary"}),void 0===T?e(t,{icon:i,size:1.6*u[K],className:q?"":"text-mp-primary"}):x(T)?e("span",{className:q?"":"text-mp-primary",children:T}):null,e("span",{className:"font-medium",children:L??X.prompt}),x(M)?e("span",{className:[d,q?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:M}):null]}),e("input",{ref:Z,type:"file",name:V,accept:N,multiple:k,required:O&&0===ne.length,disabled:le,tabIndex:-1,"aria-labelledby":x($)?ce:void 0,"aria-describedby":x(D)||oe?se:void 0,className:"absolute size-px overflow-hidden opacity-0 [clip-path:inset(50%)]",onChange:e=>fe(Array.from(e.target.files??[]))})]}),W&&ne.length>0?e("ul",{className:["mp-file-picker__list m-0 flex w-full list-none flex-col p-0",h[K]].join(" "),children:ne.map((n,i)=>r("li",{className:["rounded-mp-xs bg-mp-surface-container-low flex w-full items-center gap-3","px-3 py-2",f[K],q?"text-mp-on-surface/38":"text-mp-on-surface",ue.has(g(n))?"mp-row-arrive":""].filter(Boolean).join(" "),children:[e("span",{className:"min-w-0 flex-1 truncate",children:n.name}),e("span",{className:[d,"shrink-0 tabular-nums",q?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:formatFileSize(n.size)}),le?null:r("button",{type:"button","aria-label":_?_(n.name):o(U.removeNamed,{label:n.name}),className:["group text-mp-on-surface-variant relative flex size-8 shrink-0","cursor-pointer appearance-none items-center justify-center rounded-full","bg-transparent p-0 font-[inherit] outline-none"].join(" "),onClick:()=>me(ne.filter((e,r)=>r!==i)),children:[e(p,{}),e(t,{icon:a,size:18})]})]},`${g(n)}-${i}`))}):null,oe?e("span",{id:se,className:[d,"text-mp-error"].join(" "),children:F}):x(D)?e("span",{id:se,className:[d,q?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:D}):null]})});
2
+ import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{MPIcon as t}from"../icon/MPIcon.js";import{CloseIcon as a,UploadIcon as i}from"../../constants/icons.js";import{fillMessage as o}from"../../internal/i18n.js";import{useMPLocale as l,useMPMessages as s}from"../../internal/locale.js";import{COMMON as c}from"../../internal/messages/common.js";import{FILE_PICKER as u}from"../../internal/messages/file-picker.js";import{MPStateLayer as m}from"../../internal/StateLayer.js";import{CONTROL_ICON as p,META_TEXT as f,PROSE_TEXT as d,STACK_GAP as h,hasContent as x}from"../../internal/scale.js";import{useMPSize as b}from"../../internal/config.js";const v={xs:"p-4",sm:"p-5",md:"p-6",lg:"p-8",xl:"p-10"};export function formatFileSize(e){if(e<1e3)return`${e} B`;const r=["kB","MB","GB","TB"];let n=e/1e3,t=0;for(;n>=1e3&&t<r.length-1;)n/=1e3,t+=1;return`${n<10?n.toFixed(1):Math.round(n)} ${r[t]}`}function g(e){return`${e.name}-${e.size}-${e.lastModified}`}const j=new Set;function y(e,r){const n=e.name.toLowerCase(),t=e.type.toLowerCase();return r.split(",").map(e=>e.trim().toLowerCase()).filter(Boolean).some(e=>e.startsWith(".")?n.endsWith(e):e.endsWith("/*")?t.startsWith(e.slice(0,-1)):t===e)}export const MPFilePicker=/*@__PURE__*/n.forwardRef(function({accept:N,multiple:k=!1,maxSize:w,maxFiles:z,value:C,defaultValue:B,onFilesChange:I,onReject:S,label:D,description:L,errorMessage:$,title:E,hint:F,icon:M,showList:T=!0,removeLabel:R,locale:W,size:_,fullWidth:P=!0,required:O=!1,disabled:q=!1,readOnly:A=!1,name:V,id:G,className:H,style:Y},J){const K=b(_),Q=l(W),U=s(c,Q),X=s(u,Q),Z=n.useRef(null);n.useImperativeHandle(J,()=>Z.current,[]);const[ee,re]=n.useState(()=>[...B??[]]),ne=C?[...C]:ee,te=n.useRef(0),[ae,ie]=n.useState(!1),oe=x($),le=q||A,se=n.useId(),ce=n.useId(),ue=n.useRef([]),me=n.useCallback(e=>{const r=Z.current;if(!r||"undefined"==typeof DataTransfer)return;const n=new DataTransfer;for(const r of e)n.items.add(r);r.files=n.files,ue.current=e},[]);n.useEffect(()=>{ue.current.length===ne.length&&ue.current.every((e,r)=>e===ne[r])||me(ne)}),n.useEffect(()=>{const e=Z.current;if(!e)return;const r=()=>me(ue.current);return e.addEventListener("cancel",r),()=>e.removeEventListener("cancel",r)},[me]);const pe=n.useCallback(e=>{C||re(e),I?.(e)},[I,C]),fe=n.useCallback(e=>{const r=[],n=[],t=k?z??Number.POSITIVE_INFINITY:1,a=k?ne.length:0;for(const i of e)N&&!y(i,N)?n.push({file:i,reason:"type"}):void 0!==w&&i.size>w?n.push({file:i,reason:"size"}):a+r.length>=t?n.push({file:i,reason:"count"}):r.push(i);return{kept:r,rejections:n}},[N,ne.length,z,w,k]),[de,he]=n.useState(j),xe=n.useCallback(e=>{const{kept:r,rejections:n}=fe(e);n.length>0&&S?.(n),r.length>0&&(he(new Set(r.map(g))),pe(k?[...ne,...r]:r))},[fe,pe,ne,k,S]);return r("div",{className:["mp-file-picker flex-col align-top",h[K],P?"flex w-full":"inline-flex",H??""].filter(Boolean).join(" "),style:Y,"data-mp-size":K,"data-disabled":q||void 0,"data-invalid":oe||void 0,children:[x(D)?r("span",{id:ce,className:[f,q?"text-mp-on-surface/38":oe?"text-mp-error":"text-mp-on-surface-variant"].join(" "),children:[D,O?e("span",{"aria-hidden":"true",children:" *"}):null]}):null,r("div",{className:"relative flex w-full flex-col",onDragEnter:e=>{le||(e.preventDefault(),te.current+=1,ie(!0))},onDragOver:e=>{le||(e.preventDefault(),e.dataTransfer.dropEffect="copy")},onDragLeave:()=>{le||(te.current=Math.max(0,te.current-1),0===te.current&&ie(!1))},onDrop:e=>{le||(e.preventDefault(),te.current=0,ie(!1),xe(Array.from(e.dataTransfer.files)))},children:[r("button",{type:"button",id:G,disabled:q,"aria-describedby":x(L)||oe?se:void 0,"aria-invalid":oe||void 0,className:["mp-file-picker__zone group relative flex w-full flex-col items-center","justify-center gap-2 text-center","rounded-mp-md box-border border-2 border-dashed","appearance-none bg-transparent font-[inherit] outline-none","transition-[border-color,background-color] duration-(--mp-sys-motion-duration-short4)",v[K],d[K],q?"border-mp-on-surface/12 text-mp-on-surface/38 cursor-default":[A?"cursor-default":"cursor-pointer",oe?"border-mp-error":"border-mp-outline-variant","text-mp-on-surface",ae?"border-mp-primary bg-mp-primary/8":""].filter(Boolean).join(" ")].filter(Boolean).join(" "),onClick:()=>{!le&&Z.current&&(Z.current.value="",Z.current.click())},children:[le?null:e(m,{layer:"inset-0 rounded-[inherit] bg-mp-primary"}),void 0===M?e(t,{icon:i,size:1.6*p[K],className:q?"":"text-mp-primary"}):x(M)?e("span",{className:q?"":"text-mp-primary",children:M}):null,e("span",{className:"font-medium",children:E??X.prompt}),x(F)?e("span",{className:[f,q?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:F}):null]}),e("input",{ref:Z,type:"file",name:V,accept:N,multiple:k,required:O&&0===ne.length,disabled:le,tabIndex:-1,"aria-labelledby":x(D)?ce:void 0,"aria-describedby":x(L)||oe?se:void 0,className:"absolute size-px overflow-hidden opacity-0 [clip-path:inset(50%)]",onChange:e=>xe(Array.from(e.target.files??[]))})]}),T&&ne.length>0?e("ul",{className:["mp-file-picker__list m-0 flex w-full list-none flex-col p-0",h[K]].join(" "),children:ne.map((n,i)=>r("li",{className:["rounded-mp-xs bg-mp-surface-container-low flex w-full items-center gap-3","px-3 py-2",d[K],q?"text-mp-on-surface/38":"text-mp-on-surface",de.has(g(n))?"mp-row-arrive":""].filter(Boolean).join(" "),children:[e("span",{className:"min-w-0 flex-1 truncate",children:n.name}),e("span",{className:[f,"shrink-0 tabular-nums",q?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:formatFileSize(n.size)}),le?null:r("button",{type:"button","aria-label":R?R(n.name):o(U.removeNamed,{label:n.name}),className:["group text-mp-on-surface-variant relative flex size-8 shrink-0","cursor-pointer appearance-none items-center justify-center rounded-full","bg-transparent p-0 font-[inherit] outline-none"].join(" "),onClick:()=>pe(ne.filter((e,r)=>r!==i)),children:[e(m,{}),e(t,{icon:a,size:18})]})]},`${g(n)}-${i}`))}):null,oe?e("span",{id:se,className:[f,"text-mp-error"].join(" "),children:$}):x(L)?e("span",{id:se,className:[f,q?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:L}):null]})});
@@ -33,6 +33,9 @@ export interface MPFormProps extends Omit<React.ComponentPropsWithoutRef<'form'>
33
33
  /**
34
34
  * Called on a valid submit, with the form's values. The native submit event is
35
35
  * prevented, so nothing navigates.
36
+ *
37
+ * Leave it out and give the form an `action` — a URL, or a React server
38
+ * action — and a valid submit goes to the action instead.
36
39
  */
37
40
  onSubmit?: (values: Record<string, unknown>) => void;
38
41
  /**
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as r}from"react/jsx-runtime";import*as o from"react";import{Form as e}from"@base-ui/react/form";import{useMPSize as i}from"../../internal/config.js";import{SHEET_GAP as t}from"../../internal/scale.js";export const MPForm=/*@__PURE__*/o.forwardRef(function({validationMode:o="onSubmit",errors:m,onSubmit:a,size:n,className:s,children:f,...l},c){const d=i(n);return r(e,{ref:c,validationMode:o,errors:m,onFormSubmit:r=>a?.(r),"data-mp-size":d,className:["mp-form flex flex-col",t[d],s??""].filter(Boolean).join(" "),...l,children:f})});
2
+ import{jsx as o}from"react/jsx-runtime";import*as r from"react";import{Form as i}from"@base-ui/react/form";import{useMPSize as e}from"../../internal/config.js";import{SHEET_GAP as t}from"../../internal/scale.js";export const MPForm=/*@__PURE__*/r.forwardRef(function({validationMode:r="onSubmit",errors:a,onSubmit:m,size:n,className:s,children:f,...c},l){const d=e(n);return o(i,{ref:l,validationMode:r,errors:a,onFormSubmit:m||void 0===c.action?o=>m?.(o):void 0,"data-mp-size":d,className:["mp-form flex flex-col",t[d],s??""].filter(Boolean).join(" "),...c,children:f})});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Meter as l}from"@base-ui/react/meter";import{useMPElementSize as r}from"../../hooks/useMPElementSize.js";import{useMPColor as o,useMPSize as m}from"../../internal/config.js";import{useMPLocale as i}from"../../internal/locale.js";import{accentSlots as s}from"../../internal/accent.js";import{thresholdColor as n}from"../../internal/threshold.js";import{progressFraction as c}from"../../internal/progress.js";import{CHART_FONT_SIZE as h,PLOT_HEIGHT as p,arcPath as f,formatStatistic as u}from"../../internal/chart.js";import{cssLength as d}from"../../internal/length.js";import{META_TEXT as x}from"../../internal/scale.js";const g={xs:"text-mp-title-medium",sm:"text-mp-title-large",md:"text-mp-headline-small",lg:"text-mp-headline-medium",xl:"text-mp-display-small"};export function MPGaugeChart({value:v,min:j=0,max:M=100,sweep:_=240,label:b,thresholds:y,bands:w=!1,color:N,format:P,locale:$,height:z,size:I,className:k,style:B,...R}){const C=m(I),E=o(N),G=i($),L=a.useRef(null),S=r(L),V=c(v,j,M)??0,W=n(v,E,y),q=h[C],A=S.width,D="number"==typeof z?z:void 0===z?p[C]:S.height,F=Math.min(300,Math.max(30,_))*Math.PI/180,H=F/2,J=H>Math.PI/2?Math.cos(Math.PI-H):0,K=Math.min(A/2,D/(1+J)),O=Math.max(0,K-2),Q=.78*O,T=A/2,U=O+2,X=-H,Y=H,Z=X+V*F,ee=a.useMemo(()=>{if(!w||!y||0===y.length)return[{from:0,to:1,color:E}];const e=[...y.map(e=>({at:c(e.from,j,M)??0,color:e.color})).filter(e=>e.at>0&&e.at<1).sort((e,t)=>e.at-t.at)],t=[];let a=0,l=E;for(const r of e)t.push({from:a,to:r.at,color:l}),a=r.at,l=r.color;return t.push({from:a,to:1,color:l}),t},[w,y,E,j,M]),te=u(v,G,P,!1);return t(l.Root,{value:v,min:j,max:M,format:P,"data-mp-size":C,className:["mp-gauge-chart flex min-w-0 flex-col items-center",k??""].filter(Boolean).join(" "),style:{...s(W),...B},...R,children:[t("div",{ref:L,className:"mp-gauge-chart__dial relative w-full",style:{height:d(z)??p[C]},children:[A>0&&O>0?t("svg",{width:A,height:D,viewBox:`0 0 ${A} ${D}`,"aria-hidden":"true",className:"block overflow-visible",children:[ee.map((t,a)=>e("path",{d:f(T,U,O,Q,X+t.from*F,X+t.to*F),fill:w?`var(--_mp-color-${t.color})`:"var(--_mp-color-on-surface)",opacity:w?.22:.12},a)),e("path",{d:f(T,U,O,Q,X,Z),fill:"var(--_mp-accent)"}),e("path",{d:f(T,U,O,Q,X,X+.004*F),fill:"var(--_mp-color-outline)"}),e("path",{d:f(T,U,O,Q,Y-.004*F,Y),fill:"var(--_mp-color-outline)"})]}):null,t("div",{className:"pointer-events-none absolute inset-x-0 flex flex-col items-center",style:{top:U-.45*Q},children:[e(l.Value,{className:`mp-gauge-chart__value text-mp-on-surface font-medium tabular-nums ${g[C]}`,children:e=>P?e:te}),b?e(l.Label,{className:`mp-gauge-chart__label text-mp-on-surface-variant ${x}`,style:{maxWidth:1.8*Q},children:b}):null]})]}),J>0?e("span",{"aria-hidden":"true",style:{height:q/2}}):null]})}
2
+ import{jsx as t,jsxs as e}from"react/jsx-runtime";import*as a from"react";import{Meter as l}from"@base-ui/react/meter";import{useBoxSize as r}from"../../internal/box-size.js";import{useMPColor as o,useMPSize as i}from"../../internal/config.js";import{useMPLocale as m}from"../../internal/locale.js";import{intlLocale as s}from"../../internal/intl.js";import{accentSlots as n}from"../../internal/accent.js";import{thresholdColor as c}from"../../internal/threshold.js";import{progressFraction as h}from"../../internal/progress.js";import{CHART_FONT_SIZE as p,PLOT_HEIGHT as f,arcPath as u,formatStatistic as d}from"../../internal/chart.js";import{cssLength as x}from"../../internal/length.js";import{META_TEXT as g}from"../../internal/scale.js";const v={xs:"text-mp-title-medium",sm:"text-mp-title-large",md:"text-mp-headline-small",lg:"text-mp-headline-medium",xl:"text-mp-display-small"};export function MPGaugeChart({value:j,min:b=0,max:_=100,sweep:M=240,label:y,thresholds:w,bands:N=!1,color:$,format:P,locale:z,height:I,size:B,className:R,style:k,...C}){const G=i(B),L=o($),V=m(z),W=a.useRef(null),q=r(W),A=h(j,b,_)??0,D=c(j,L,w),E=p[G],F=q.width,H="number"==typeof I?I:void 0===I?f[G]:q.height,J=Math.min(300,Math.max(30,M))*Math.PI/180,K=J/2,O=K>Math.PI/2?Math.cos(Math.PI-K):0,Q=F>0?Math.min(F/2,H/(1+O)):H/(1+O),S=Math.max(0,Q-2),T=.78*S,U=F/2,X=S+2,Y=-K,Z=K,tt=Y+A*J,et=a.useMemo(()=>{if(!N||!w||0===w.length)return[{from:0,to:1,color:L}];const t=[...w.map(t=>({at:h(t.from,b,_)??0,color:t.color})).filter(t=>t.at>0&&t.at<1).sort((t,e)=>t.at-e.at)],e=[];let a=0,l=L;for(const r of t)e.push({from:a,to:r.at,color:l}),a=r.at,l=r.color;return e.push({from:a,to:1,color:l}),e},[N,w,L,b,_]),at=d(j,V,P,!1);return e(l.Root,{value:j,min:b,max:_,format:P,locale:s(V),"data-mp-size":G,className:["mp-gauge-chart flex min-w-0 flex-col items-center",R??""].filter(Boolean).join(" "),style:{...n(D),...k},...C,children:[e("div",{ref:W,className:"mp-gauge-chart__dial relative w-full",style:{height:x(I)??f[G]},children:[F>0&&S>0?e("svg",{width:F,height:H,viewBox:`0 0 ${F} ${H}`,"aria-hidden":"true",className:"block overflow-visible",children:[et.map((e,a)=>t("path",{d:u(U,X,S,T,Y+e.from*J,Y+e.to*J),fill:N?`var(--_mp-color-${e.color})`:"var(--_mp-color-on-surface)",opacity:N?.22:.12},a)),t("path",{d:u(U,X,S,T,Y,tt),fill:"var(--_mp-accent)"}),t("path",{d:u(U,X,S,T,Y,Y+.004*J),fill:"var(--_mp-color-outline)"}),t("path",{d:u(U,X,S,T,Z-.004*J,Z),fill:"var(--_mp-color-outline)"})]}):null,e("div",{className:"pointer-events-none absolute inset-x-0 flex flex-col items-center",style:{top:X-.45*T},children:[t(l.Value,{className:`mp-gauge-chart__value text-mp-on-surface font-medium tabular-nums ${v[G]}`,children:t=>P?t:at}),y?t(l.Label,{className:`mp-gauge-chart__label text-mp-on-surface-variant ${g}`,style:{maxWidth:1.8*T},children:y}):null]})]}),O>0?t("span",{"aria-hidden":"true",style:{height:E/2}}):null]})}
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as i from"react";import{useRender as n}from"@base-ui/react/use-render";import{barSurface as r,MPPageLayoutContext as a}from"../../internal/page-layout.js";import{hasContent as s}from"../../internal/scale.js";import{sheetPadX as l}from"../../internal/density.js";import{measureValue as m}from"../../internal/measure.js";import{useWindowMins as o}from"../../internal/window-class.js";import{responsiveSlots as d,withBaseline as c}from"../../internal/responsive.js";import{useMPDensity as p,useMPSize as f}from"../../internal/config.js";const x={xs:"min-h-12",sm:"min-h-14",md:"min-h-16",lg:"min-h-20",xl:"min-h-24"},u={xs:"text-mp-title-small",sm:"text-mp-title-medium",md:"text-mp-title-large",lg:"text-mp-headline-small",xl:"text-mp-headline-medium"},h={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-4",xl:"gap-5"},g={xs:"gap-3",sm:"gap-4",md:"gap-6",lg:"gap-8",xl:"gap-10"},j={static:"",absolute:"absolute inset-x-0 top-0 z-30",sticky:"sticky top-0 z-30",fixed:"fixed inset-x-0 top-0 z-40"},b={start:"shrink-0",center:"flex-1 basis-0",end:"shrink-0"},v={start:"flex min-w-0 flex-1 items-center justify-start",center:"flex min-w-0 shrink items-center justify-center",end:"flex min-w-0 flex-1 items-center justify-end"};export const MPHeader=/*@__PURE__*/i.forwardRef(function({brand:y,actions:w,align:N="start",position:k="sticky",variant:_="tonal",elevation:z,size:B,density:C,maxWidth:$="none",padded:H=!0,label:M,render:P,className:R,children:W,...q},A){const D=f(B),E=p(C),F=o(),{register:G}=i.useContext(a),I=i.useCallback(e=>{G("header",e),"function"==typeof A?A(e):A&&(A.current=e)},[G,A]);return n({render:P??e("header",{}),ref:I,props:{"aria-label":M,"data-mp-size":D,"data-mp-variant":_,className:["mp-header text-mp-on-surface box-border w-full min-w-0",r(_,z),"outlined"===_?"border-mp-outline-variant border-b":"",j[k],R??""].filter(Boolean).join(" "),children:t("div",{className:["flex w-full items-center",x[D],g[D],H?l(D,E):"","none"===$?"":"mp-measure mx-auto"].filter(Boolean).join(" "),style:"none"===$?void 0:d("measure",c($,"none"),e=>m(e,F)),children:[s(y)?e("div",{className:["mp-header__brand flex min-w-0 items-center",b[N],h[D],u[D]].join(" "),children:y}):"center"===N?e("div",{"aria-hidden":"true",className:b[N]}):null,s(W)?e("div",{className:`mp-header__middle ${v[N]} ${h[D]}`,children:W}):null,s(w)?e("div",{className:["mp-header__actions flex min-w-0 items-center justify-end",b[N],h[D]].join(" "),children:w}):"center"===N?e("div",{"aria-hidden":"true",className:b[N]}):null]}),...q}})});
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as i from"react";import{useRender as n}from"@base-ui/react/use-render";import{barSurface as a,MPPageLayoutContext as r}from"../../internal/page-layout.js";import{hasContent as s}from"../../internal/scale.js";import{sheetPadX as m}from"../../internal/density.js";import{measureValue as l}from"../../internal/measure.js";import{useWindowMins as o}from"../../internal/window-class.js";import{responsiveSlots as d,withBaseline as p}from"../../internal/responsive.js";import{useMPDensity as c,useMPSize as f}from"../../internal/config.js";const x={xs:"min-h-12",sm:"min-h-14",md:"min-h-16",lg:"min-h-20",xl:"min-h-24"},u={xs:"text-mp-title-small",sm:"text-mp-title-medium",md:"text-mp-title-large",lg:"text-mp-headline-small",xl:"text-mp-headline-medium"},h={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-4",xl:"gap-5"},g={xs:"gap-3",sm:"gap-4",md:"gap-6",lg:"gap-8",xl:"gap-10"},j={static:"",absolute:"absolute inset-x-0 top-0 z-30",sticky:"sticky top-0 z-30",fixed:"fixed inset-x-0 top-0 z-40"},b={start:"shrink-0",center:"flex-1 basis-0",end:"shrink-0"},v={start:"flex min-w-0 flex-1 items-center justify-start",center:"flex min-w-0 shrink items-center justify-center",end:"flex min-w-0 flex-1 items-center justify-end"};export const MPHeader=/*@__PURE__*/i.forwardRef(function({brand:y,actions:w,align:N="start",position:k="sticky",variant:_="tonal",elevation:z,size:B,density:C,maxWidth:$="none",padded:H=!0,label:M,render:P,className:R,children:W,...q},A){const D=f(B),E=c(C),F=o(),{register:G}=i.useContext(r),I=i.useCallback(e=>{G("header",e),"function"==typeof A?A(e):A&&(A.current=e)},[G,A]);return n({render:P??e("header",{}),ref:I,props:{"aria-label":M,"data-mp-size":D,"data-mp-variant":_,"data-mp-position":k,className:["mp-header text-mp-on-surface box-border w-full min-w-0",a(_,z),"outlined"===_?"border-mp-outline-variant border-b":"",j[k],R??""].filter(Boolean).join(" "),children:t("div",{className:["flex w-full items-center",x[D],g[D],H?m(D,E):"","none"===$?"":"mp-measure mx-auto"].filter(Boolean).join(" "),style:"none"===$?void 0:d("measure",p($,"none"),e=>l(e,F)),children:[s(y)?e("div",{className:["mp-header__brand flex min-w-0 items-center",b[N],h[D],u[D]].join(" "),children:y}):"center"===N?e("div",{"aria-hidden":"true",className:b[N]}):null,s(W)?e("div",{className:`mp-header__middle ${v[N]} ${h[D]}`,children:W}):null,s(w)?e("div",{className:["mp-header__actions flex min-w-0 items-center justify-end",b[N],h[D]].join(" "),children:w}):"center"===N?e("div",{"aria-hidden":"true",className:b[N]}):null]}),...q}})});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{useMPElementSize as a}from"../../hooks/useMPElementSize.js";import{useMPLocale as n,useMPMessages as r}from"../../internal/locale.js";import{useMPSize as o}from"../../internal/config.js";import{CHART as i}from"../../internal/messages/chart.js";import{TABLE as m}from"../../internal/messages/table.js";import{ChartShell as s,ChartTable as c,ChartTooltipPanel as h}from"../../internal/ChartChrome.js";import{CHART_FONT_SIZE as u,MARK_GAP as d,PLOT_HEIGHT as f,RAMP_STEPS as p,formatCategory as x,formatStatistic as g,rampFill as v,rampInk as y,rampStep as w,textWidth as M,tickTurn as b,toValues as k,truncate as j,turnedBand as A,turnedRoom as $}from"../../internal/chart.js";export function MPHeatmapChart({series:N,categories:B,xAxis:S,yAxis:_,min:z,max:P,valueLabels:C=!1,height:D,format:L,locale:R,label:I,legend:E,tooltip:F,empty:W,size:H,className:K,style:U,...X}){const Y=o(H),q=n(R),G=r(i,q),J=r(m,q),O=l.useRef(null),Q=a(O),T=l.useId(),[V,Z]=l.useState(null),ee=l.useMemo(()=>k(N),[N]),te=ee.reduce((e,t)=>Math.max(e,t.length),0),le=l.useCallback(e=>g(e,q,L,!0),[L,q]),ae=N.map((e,t)=>e.name??String(t+1)),ne=Array.from({length:te},(e,t)=>S?.tickFormat?String(S.tickFormat(B?.[t]??t,t)):x(B?.[t]??t,q)),re=ee.flat().filter(e=>null!==e.value),oe=z??(re.length>0?Math.min(...re.map(e=>e.value)):0),ie=P??(re.length>0?Math.max(...re.map(e=>e.value)):0),me=ie-oe||1,se=u[Y],ce=Q.width,he="number"==typeof D?D:void 0===D?f[Y]:Q.height,ue=ae.reduce((e,t)=>Math.max(e,M(t,se)),0),de=_?.hidden?0:_?.thickness??Math.min(140,ue+10),fe=Math.max(0,ce-de),pe=te>0?fe/te:0,xe=S?.hidden?0:b(S?.tickLabels??"auto",ne,se,pe),ge=Math.min(120,.5*he),ve=ne.map((e,t)=>j(e,xe>0?Math.min($(xe,ge,se),xe>=90?1/0:(de+pe*(t+.5))/Math.cos(xe*Math.PI/180)):pe-2,se)),ye=ve.reduce((e,t)=>Math.max(e,M(t,se)),0),we=S?.hidden?0:S?.thickness??(xe>0?8+A(xe,ye,se)+4:se+12),Me=de,be=0,ke=Math.max(0,he-we),je=ee.length>0?ke/ee.length:0,Ae=(e,t)=>{Z(l=>{const a=l??{row:0,column:0};return{row:Math.min(ee.length-1,Math.max(0,a.row+(l?e:0))),column:Math.min(te-1,Math.max(0,a.column+(l?t:0)))}})},$e=V?ee[V.row]?.[V.column]??null:null,Ne=V&&$e&&null!==$e.value?[{seriesIndex:V.row,name:ae[V.row],color:v(w(($e.value-oe)/me)),value:$e.value,formatted:le($e.value),label:$e.label}]:[],Be=!1===F?{mode:"none"}:!0===F||void 0===F?{}:F,Se=!1!==E&&re.length>0,_e=0===te||0===ee.length||0===re.length,ze=Array.from({length:te},(e,t)=>ee.map(e=>e[t]??{value:null}));return e(s,{...X,size:Y,className:["mp-heatmap-chart",K??""].filter(Boolean).join(" "),style:U,plotRef:O,name:I??G.label,describedBy:_e?void 0:T,interactive:!_e,height:D,legendSide:"bottom",plotProps:{onPointerMove:_e||"none"===Be.mode?void 0:e=>Z(((e,t)=>{const l=O.current;if(!l||pe<=0||je<=0)return null;const a=l.getBoundingClientRect(),n=Math.floor((e-a.left-Me)/pe),r=Math.floor((t-a.top-be)/je);return n<0||n>=te||r<0||r>=ee.length?null:{row:r,column:n}})(e.clientX,e.clientY)),onPointerLeave:()=>Z(null),onKeyDown:_e||"none"===Be.mode?void 0:e=>{if("ArrowRight"===e.key)Ae(0,1);else if("ArrowLeft"===e.key)Ae(0,-1);else if("ArrowDown"===e.key)Ae(1,0);else if("ArrowUp"===e.key)Ae(-1,0);else{if("Escape"!==e.key)return;Z(null)}e.preventDefault()},onBlur:()=>Z(null)},tooltip:V&&Ne.length>0&&"none"!==Be.mode?e(h,{heading:`${ae[V.row]} · ${ne[V.column]}`,items:Ne,x:Me+(V.column+.5)*pe,y:be+(V.row+.5)*je,flip:V.column>te/2,size:Y}):null,legend:Se?t("div",{className:"mp-chart__legend flex items-center justify-center gap-2",children:[e("span",{className:"text-mp-on-surface-variant text-mp-label-small tabular-nums",children:le(oe)}),e("span",{className:"flex","aria-hidden":"true",children:Array.from({length:p},(t,l)=>e("span",{className:"block h-3 w-6 first:rounded-s-mp-xs last:rounded-e-mp-xs",style:{background:v(l)}},l))}),e("span",{className:"text-mp-on-surface-variant text-mp-label-small tabular-nums",children:le(ie)})]}):null,status:{heading:V?`${ae[V.row]} · ${ne[V.column]}`:void 0,items:Ne},table:_e?null:e(c,{id:T,caption:I??G.table,corner:_?.label??G.category,categories:ae,names:ne,values:ze,format:le,locale:q,empty:J.empty}),children:_e?e("div",{className:"text-mp-on-surface-variant text-mp-body-small flex h-full items-center justify-center",children:W??J.empty}):ce>0&&he>0?t("svg",{width:ce,height:he,viewBox:`0 0 ${ce} ${he}`,"aria-hidden":"true",className:"block overflow-visible",children:[e("g",{className:"mp-heatmap-chart__cells",children:ee.map((l,a)=>Array.from({length:te},(n,r)=>{const o=l[r],i=V?.row===a&&V?.column===r,m=Me+r*pe,s=be+a*je,c=Math.max(0,pe-d),h=Math.max(0,je-d);if(!o||null===o.value)return e("rect",{x:m+d/2,y:s+d/2,width:c,height:h,fill:"none",stroke:"var(--_mp-color-outline-variant)",strokeWidth:1,strokeDasharray:"2 2",rx:2},r);const u=w((o.value-oe)/me);return t("g",{children:[e("rect",{x:m+d/2,y:s+d/2,width:c,height:h,fill:o.color??v(u),rx:2,stroke:i?"var(--_mp-color-on-surface)":"none",strokeWidth:i?2:0}),C&&c>M(le(o.value),se)+8&&h>se+4?e("text",{x:m+pe/2,y:s+je/2,textAnchor:"middle",dominantBaseline:"central",fill:y(u),fontSize:se,children:le(o.value)}):null]},r)}))}),_?.hidden?null:ae.map((t,l)=>e("text",{x:Me-8,y:be+(l+.5)*je,textAnchor:"end",dominantBaseline:"central",fill:"var(--_mp-color-on-surface-variant)",fontSize:se,children:j(t,de-10,se)},`r${l}`)),S?.hidden?null:ve.map((t,l)=>{const a=Me+(l+.5)*pe,n=be+ke;return e("text",{x:a,y:xe>0?n+8:n+se+4,textAnchor:xe>0?"end":"middle",dominantBaseline:xe>0?"central":void 0,transform:xe>0?`rotate(${-xe} ${a} ${n+8})`:void 0,fill:"var(--_mp-color-on-surface-variant)",fontSize:se,children:t},`c${l}`)})]}):null})}
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{useBoxSize as n}from"../../internal/box-size.js";import{useMPLocale as a,useMPMessages as r}from"../../internal/locale.js";import{useMPSize as o}from"../../internal/config.js";import{CHART as i}from"../../internal/messages/chart.js";import{TABLE as m}from"../../internal/messages/table.js";import{ChartShell as s,ChartTable as c,ChartTooltipPanel as u}from"../../internal/ChartChrome.js";import{CHART_FONT_SIZE as h,MARK_GAP as d,PLOT_HEIGHT as f,RAMP_STEPS as p,bounds as x,formatCategory as v,formatStatistic as g,rampFill as y,rampInk as w,rampStep as b,textWidth as M,tickTurn as k,toValues as j,truncate as A,turnedBand as $,turnedRoom as N}from"../../internal/chart.js";export function MPHeatmapChart({series:B,categories:_,xAxis:z,yAxis:S,min:C,max:P,valueLabels:D=!1,height:L,format:R,locale:I,label:F,legend:W,tooltip:E,empty:H,size:K,className:U,style:X,...Y}){const q=o(K),G=a(I),J=r(i,G),O=r(m,G),Q=l.useRef(null),T=n(Q),V=l.useId(),[Z,ee]=l.useState(null),te=l.useMemo(()=>j(B),[B]),le=te.reduce((e,t)=>Math.max(e,t.length),0),ne=l.useCallback(e=>g(e,G,R,!0),[R,G]),ae=B.map((e,t)=>e.name??String(t+1)),re=Array.from({length:le},(e,t)=>z?.tickFormat?String(z.tickFormat(_?.[t]??t,t)):v(_?.[t]??t,G)),oe=te.flat().filter(e=>null!==e.value),ie=x(oe.map(e=>e.value)),me=C??ie?.min??0,se=P??ie?.max??0,ce=se-me||1,ue=h[q],he=T.width,de="number"==typeof L?L:void 0===L?f[q]:T.height,fe=ae.reduce((e,t)=>Math.max(e,M(t,ue)),0),pe=S?.hidden?0:S?.thickness??Math.min(140,fe+10),xe=Math.max(0,he-pe),ve=le>0?xe/le:0,ge=z?.hidden?0:k(z?.tickLabels??"auto",re,ue,ve),ye=Math.min(120,.5*de),we=re.map((e,t)=>A(e,ge>0?Math.min(N(ge,ye,ue),ge>=90?1/0:(pe+ve*(t+.5))/Math.cos(ge*Math.PI/180)):ve-2,ue)),be=we.reduce((e,t)=>Math.max(e,M(t,ue)),0),Me=z?.hidden?0:z?.thickness??(ge>0?8+$(ge,be,ue)+4:ue+12),ke=pe,je=0,Ae=Math.max(0,de-Me),$e=te.length>0?Ae/te.length:0,Ne=(e,t)=>{ee(l=>{const n=l??{row:0,column:0};return{row:Math.min(te.length-1,Math.max(0,n.row+(l?e:0))),column:Math.min(le-1,Math.max(0,n.column+(l?t:0)))}})},Be=Z?te[Z.row]?.[Z.column]??null:null,_e=Z&&Be&&null!==Be.value?[{seriesIndex:Z.row,name:ae[Z.row],color:y(b((Be.value-me)/ce)),value:Be.value,formatted:ne(Be.value),label:Be.label}]:[],ze=!1===E?{mode:"none"}:!0===E||void 0===E?{}:E,Se=!1!==W&&oe.length>0,Ce=0===le||0===te.length||0===oe.length,Pe=Array.from({length:le},(e,t)=>te.map(e=>e[t]??{value:null}));return e(s,{...Y,size:q,className:["mp-heatmap-chart",U??""].filter(Boolean).join(" "),style:X,plotRef:Q,name:F??J.label,describedBy:Ce?void 0:V,interactive:!Ce,height:L,legendSide:"bottom",plotProps:{onPointerMove:Ce||"none"===ze.mode?void 0:e=>{const t=((e,t)=>{const l=Q.current;if(!l||ve<=0||$e<=0)return null;const n=l.getBoundingClientRect(),a=Math.floor((e-n.left-ke)/ve),r=Math.floor((t-n.top-je)/$e);return a<0||a>=le||r<0||r>=te.length?null:{row:r,column:a}})(e.clientX,e.clientY);ee(e=>e&&t&&e.row===t.row&&e.column===t.column?e:t)},onPointerLeave:()=>ee(null),onKeyDown:Ce||"none"===ze.mode?void 0:e=>{if("ArrowRight"===e.key)Ne(0,1);else if("ArrowLeft"===e.key)Ne(0,-1);else if("ArrowDown"===e.key)Ne(1,0);else if("ArrowUp"===e.key)Ne(-1,0);else{if("Escape"!==e.key)return;ee(null)}e.preventDefault()},onBlur:()=>ee(null)},tooltip:Z&&_e.length>0&&"none"!==ze.mode?e(u,{heading:`${ae[Z.row]} · ${re[Z.column]}`,items:_e,x:ke+(Z.column+.5)*ve,y:je+(Z.row+.5)*$e,flip:Z.column>le/2,size:q}):null,legend:Se?t("div",{className:"mp-chart__legend flex items-center justify-center gap-2",children:[e("span",{className:"text-mp-on-surface-variant text-mp-label-small tabular-nums",children:ne(me)}),e("span",{className:"flex","aria-hidden":"true",children:Array.from({length:p},(t,l)=>e("span",{className:"block h-3 w-6 first:rounded-s-mp-xs last:rounded-e-mp-xs",style:{background:y(l)}},l))}),e("span",{className:"text-mp-on-surface-variant text-mp-label-small tabular-nums",children:ne(se)})]}):null,status:{heading:Z?`${ae[Z.row]} · ${re[Z.column]}`:void 0,items:_e},table:Ce?null:e(c,{id:V,caption:F??J.table,corner:S?.label??J.category,categories:ae,names:re,values:Pe,format:ne,locale:G,empty:O.empty}),children:Ce?e("div",{className:"text-mp-on-surface-variant text-mp-body-small flex h-full items-center justify-center",children:H??O.empty}):he>0&&de>0?t("svg",{width:he,height:de,viewBox:`0 0 ${he} ${de}`,"aria-hidden":"true",className:"block overflow-visible",children:[e("g",{className:"mp-heatmap-chart__cells",children:te.map((l,n)=>Array.from({length:le},(a,r)=>{const o=l[r],i=Z?.row===n&&Z?.column===r,m=ke+r*ve,s=je+n*$e,c=Math.max(0,ve-d),u=Math.max(0,$e-d);if(!o||null===o.value)return e("rect",{x:m+d/2,y:s+d/2,width:c,height:u,fill:"none",stroke:"var(--_mp-color-outline-variant)",strokeWidth:1,strokeDasharray:"2 2",rx:2},r);const h=b((o.value-me)/ce);return t("g",{children:[e("rect",{x:m+d/2,y:s+d/2,width:c,height:u,fill:o.color??y(h),rx:2,stroke:i?"var(--_mp-color-on-surface)":"none",strokeWidth:i?2:0}),D&&c>M(ne(o.value),ue)+8&&u>ue+4?e("text",{x:m+ve/2,y:s+$e/2,textAnchor:"middle",dominantBaseline:"central",fill:w(h),fontSize:ue,children:ne(o.value)}):null]},r)}))}),S?.hidden?null:ae.map((t,l)=>e("text",{x:ke-8,y:je+(l+.5)*$e,textAnchor:"end",dominantBaseline:"central",fill:"var(--_mp-color-on-surface-variant)",fontSize:ue,children:A(t,pe-10,ue)},`r${l}`)),z?.hidden?null:we.map((t,l)=>{const n=ke+(l+.5)*ve,a=je+Ae;return e("text",{x:n,y:ge>0?a+8:a+ue+4,textAnchor:ge>0?"end":"middle",dominantBaseline:ge>0?"central":void 0,transform:ge>0?`rotate(${-ge} ${n} ${a+8})`:void 0,fill:"var(--_mp-color-on-surface-variant)",fontSize:ue,children:t},`c${l}`)})]}):null})}
@@ -180,6 +180,11 @@ export interface MPImageProps extends Omit<React.ComponentPropsWithoutRef<'img'>
180
180
  * Sets `loading="eager"` and a high fetch priority. A `loading` or
181
181
  * `fetchPriority` of your own still wins. Give it to one picture per page: a
182
182
  * high priority on every picture raises none of them above the others.
183
+ *
184
+ * The picture is also drawn as soon as it arrives rather than faded in once
185
+ * the page's JavaScript has heard it load, with the placeholder under it
186
+ * instead of over it — on a server-rendered page, a faded picture cannot
187
+ * appear before hydration.
183
188
  * @default false
184
189
  */
185
190
  priority?: boolean;