@wpmoo/ui 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -275,6 +275,10 @@ calm.
275
275
 
276
276
  ## Status And Support
277
277
 
278
+ The `2.1.1` patch release improves Chart tooltips, DataTable sorting
279
+ and selection, Combobox input, Context Menu disposal, Date Picker controls,
280
+ and Sidebar keyboard navigation. Page titles follow their owner heading weight.
281
+
278
282
  The `2.1.0` minor release adds host-translated password feedback, the
279
283
  `--moo-heading-font-weight` owner token, and a document scrolling mode for
280
284
  website shells. The Layout catalog demonstrates the document mode with a live
@@ -303,7 +307,7 @@ paths live in the [Installation guide](https://ui.wpmoo.org/installation/).
303
307
  Moo UI source code is MIT licensed. License details live in
304
308
  [LICENSE](LICENSE) and the [License page](https://ui.wpmoo.org/license/).
305
309
  Third-party distribution details and notices are kept separately in
306
- [THIRD_PARTY_NOTICES.md](https://github.com/wpmoo-org/ui/blob/v2.1.0/THIRD_PARTY_NOTICES.md).
310
+ [THIRD_PARTY_NOTICES.md](https://github.com/wpmoo-org/ui/blob/v2.1.1/THIRD_PARTY_NOTICES.md).
307
311
  Catalog visual assets and their license are repository-only and are not
308
312
  included in the npm package. Asset terms live in the
309
- [visual asset license](https://github.com/wpmoo-org/ui/blob/v2.1.0/ASSET_LICENSE.md).
313
+ [visual asset license](https://github.com/wpmoo-org/ui/blob/v2.1.1/ASSET_LICENSE.md).
@@ -83,5 +83,5 @@ The catalog serves its native ESM file and unchanged license separately under
83
83
  WPMoo-generated visual assets, including image assets under `site/static/images/`,
84
84
  are original WPMoo work and are not licensed under MIT unless explicitly
85
85
  stated. See the
86
- [repository visual asset license](https://github.com/wpmoo-org/ui/blob/v2.1.0/ASSET_LICENSE.md).
86
+ [repository visual asset license](https://github.com/wpmoo-org/ui/blob/v2.1.1/ASSET_LICENSE.md).
87
87
  These assets and their license file are not included in the npm package.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": "0.1",
3
3
  "status": "preview",
4
- "coreVersion": "2.1.0",
4
+ "coreVersion": "2.1.1",
5
5
  "bootstrap": {
6
6
  "canonicalVersion": "5.3.3",
7
7
  "targetRange": ">=5.3.0 <5.4",
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Moo UI v2.1.0 (https://wpmoo.org/)
2
+ * Moo UI v2.1.1 (https://wpmoo.org/)
3
3
  * Copyright 2026 WPMoo Authors
4
4
  * Licensed under MIT (https://github.com/wpmoo-org/ui/blob/main/LICENSE)
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Moo UI v2.1.0 (https://wpmoo.org/)
2
+ * Moo UI v2.1.1 (https://wpmoo.org/)
3
3
  * Copyright 2026 WPMoo Authors
4
4
  * Licensed under MIT (https://github.com/wpmoo-org/ui/blob/main/LICENSE)
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Moo UI v2.1.0 (https://wpmoo.org/)
2
+ * Moo UI v2.1.1 (https://wpmoo.org/)
3
3
  * Copyright 2026 WPMoo Authors
4
4
  * Licensed under MIT (https://github.com/wpmoo-org/ui/blob/main/LICENSE)
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Moo UI v2.1.0 (https://wpmoo.org/)
2
+ * Moo UI v2.1.1 (https://wpmoo.org/)
3
3
  * Copyright 2026 WPMoo Authors
4
4
  * Licensed under MIT (https://github.com/wpmoo-org/ui/blob/main/LICENSE)
5
5
  *
package/dist/js/chart.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Moo UI chart.js v2.1.0 (https://wpmoo.org/)
2
+ * Moo UI chart.js v2.1.1 (https://wpmoo.org/)
3
3
  * Copyright 2026 WPMoo Authors
4
4
  * Licensed under MIT (https://github.com/wpmoo-org/ui/blob/main/LICENSE)
5
5
  */
@@ -501,6 +501,14 @@ function tooltipLabel(context) {
501
501
  const parsed = context.parsed;
502
502
  const raw = context.raw;
503
503
  if (parsed !== null && typeof parsed === "object") {
504
+ const meta = context.chart?.getDatasetMeta?.(context.datasetIndex);
505
+ const valueAxis = meta?.iScale?.type === "category" ? meta.vScale?.axis : null;
506
+ const single = valueAxis ? parsed[valueAxis] : typeof parsed.r === "number" && parsed.x === void 0 ? parsed.r : void 0;
507
+ if (single !== void 0) {
508
+ const value2 = formatNumber(single);
509
+ if (!value2) return label;
510
+ return label ? `${label}: ${value2}` : value2;
511
+ }
504
512
  const values = [];
505
513
  if (typeof parsed.x === "number" && Number.isFinite(parsed.x)) {
506
514
  values.push(`X: ${formatNumber(parsed.x)}`);
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * Moo UI chart.min.js v2.1.0 (https://wpmoo.org/)
2
+ * Moo UI chart.min.js v2.1.1 (https://wpmoo.org/)
3
3
  * Copyright 2026 WPMoo Authors
4
4
  * Licensed under MIT (https://github.com/wpmoo-org/ui/blob/main/LICENSE)
5
5
  */
6
6
 
7
- import L from"chart.js/auto";var y=new WeakMap,j=new Map([["area",{chartType:"line",family:"cartesian",fillByDefault:!0,pointRadiusDefault:0}],["line",{chartType:"line",family:"cartesian",fillByDefault:!0}],["bar",{chartType:"bar",family:"cartesian"}],["pie",{chartType:"pie",family:"arc"}],["doughnut",{chartType:"doughnut",family:"arc"}],["polarArea",{chartType:"polarArea",family:"radial"}],["radar",{chartType:"radar",family:"radial"}],["scatter",{chartType:"scatter",family:"point"}],["bubble",{chartType:"bubble",family:"point"}]]),v=Array.from(j.keys()),U=new Set(["__proto__","constructor","prototype"]),g=6,x=g/2,E=5,R=12,G=1.5,V=1.5,B=1,Z=E+B,K="circle",A=g*Math.SQRT2,Q=g+R/2-A-2,S=Symbol("mooChartThemeState"),X=["backgroundColor","borderColor","hoverBackgroundColor","hoverBorderColor","pointBackgroundColor","pointBorderColor","pointHoverBackgroundColor","pointHoverBorderColor"],rr=["--bs-body-color","--bs-body-bg","--bs-secondary-color","--bs-secondary-bg","--bs-tertiary-color","--bs-tertiary-bg","--bs-border-color","--bs-primary","--bs-success","--bs-info","--bs-warning","--bs-danger","--bs-emphasis-color","--bs-info-text-emphasis","--bs-success-text-emphasis","--bs-warning-text-emphasis","--bs-danger-text-emphasis","--moo-chart-1","--moo-chart-2","--moo-chart-3","--moo-chart-4","--moo-chart-5"],w=["primary","success","info","warning","danger"];function N(r,o){let e=o?.getComputedStyle?.(r),t={};return e&&rr.forEach(n=>{t[n]=e.getPropertyValue(n).trim()}),t}function or(r){let o=r?.closest?.("[data-bs-theme]");if(o)return o;let e=r?.ownerDocument?.body;return e?.hasAttribute?.("data-bs-theme")?e:r?.ownerDocument?.documentElement||null}function M(r){return(r?.getAttribute?.("data-bs-theme")||r?.dataset?.bsTheme)==="dark"}function I(r){return Math.min(255,Math.max(0,Math.round(r)))}function er(r){let o=String(r).trim();if(o.endsWith("%")){let t=Number.parseFloat(o.slice(0,-1));return Number.isFinite(t)?I(t/100*255):null}let e=Number.parseFloat(o);return Number.isFinite(e)?I(e*255):null}function tr(r){if(r===void 0)return 1;let o=String(r).trim();if(o.endsWith("%")){let t=Number.parseFloat(o.slice(0,-1));return Number.isFinite(t)?Math.min(1,Math.max(0,t/100)):null}let e=Number.parseFloat(o);return Number.isFinite(e)?Math.min(1,Math.max(0,e)):null}function nr(r){if(typeof r!="string")return null;let o=r.trim(),e=o.match(/^color\(\s*srgb\s+([^\s/]+)\s+([^\s/]+)\s+([^\s/]+)(?:\s*\/\s*([^\s)]+))?\s*\)$/i);if(!e)return o||null;let t=e.slice(1,4).map(er),n=tr(e[4]);return t.some(i=>i===null)||n===null?null:n>=1?"rgb(".concat(t.join(", "),")"):"rgba(".concat(t.join(", "),", ").concat(Number(n.toFixed(3)),")")}function H(r,o,e,t,n){let i=r?.createElement,a=o?.getComputedStyle,u=r?.documentElement;if(!i||!a||!u)return t;let c=i.call(r,"span");if(c.style.color=e,!c.style.color)return t;c.hidden=!0,(n?.appendChild?n:u).appendChild(c);try{let s=a.call(o,c).color;return nr(s)||t}finally{c.remove()}}function P(r,o=!1,e=t=>t){let t={primary:r["--moo-chart-1"]||r["--bs-info"]||r["--bs-info-text-emphasis"],success:r["--moo-chart-2"]||r["--bs-success"],info:r["--moo-chart-3"]||r["--bs-info"],warning:r["--moo-chart-4"]||r["--bs-warning"],danger:r["--moo-chart-5"]||r["--bs-danger"]},n={primary:r["--moo-chart-1"]||r["--bs-info-text-emphasis"]||r["--bs-info"],success:r["--moo-chart-2"]||r["--bs-success-text-emphasis"]||r["--bs-success"],info:r["--moo-chart-3"]||r["--bs-info-text-emphasis"]||r["--bs-info"],warning:r["--moo-chart-4"]||r["--bs-warning-text-emphasis"]||r["--bs-warning"],danger:r["--moo-chart-5"]||r["--bs-danger-text-emphasis"]||r["--bs-danger"]},i=o?n:t;return{color:r["--bs-body-color"],backgroundColor:r["--bs-body-bg"],borderColor:r["--bs-border-color"],gridColor:r["--bs-secondary-color"],tickColor:r["--bs-secondary-color"],textColor:r["--bs-body-color"],secondaryText:r["--bs-secondary-color"],resolveColor:e,...i}}function _(r,o,e=22){return r.resolveColor("color-mix(in srgb, ".concat(o," ").concat(e,"%, transparent)"),o)}function W(r,o){return r.resolveColor("color-mix(in srgb, ".concat(o," 92%, ").concat(r.color,")"),o)}function ir(r,o){return Array.from({length:Math.max(o,1)},(e,t)=>{let n=w[t%w.length];return r[n]})}function z(r){return new Set(X.filter(o=>Object.prototype.hasOwnProperty.call(r,o)))}function Y(r,o=null){return r[S]||Object.defineProperty(r,S,{value:{explicitColorFields:o||z(r)}}),r[S]}function l(r,o,e,t){t.explicitColorFields.has(o)||(r[o]=e)}function sr(){return{pointStyle:K,rotation:0}}function ar(r){let e=r.chart.getDatasetMeta(r.datasetIndex).controller.getStyle(r.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:B,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}}function lr(r){return L.defaults.plugins.legend.labels.generateLabels(r).map(o=>({...o,lineWidth:B}))}function q(r,o,e,t,n=null){let i=w[o%w.length],a=t[i],u=W(t,a),c=a,d=r.type||e.chartType,s=Y(r,n);if(d==="line")l(r,"borderColor",u,s),l(r,"backgroundColor",_(t,a),s),l(r,"pointBackgroundColor",c,s),l(r,"pointBorderColor",c,s),r.pointBorderWidth=0,r.borderWidth===void 0&&(r.borderWidth=G),r.clip===void 0&&(r.clip=Z),r.pointRadius===void 0&&(r.pointRadius=e.pointRadiusDefault??x),r.pointHoverRadius=E,l(r,"pointHoverBackgroundColor",c,s),l(r,"pointHoverBorderColor",c,s),r.pointHoverBorderWidth=0,r.tension===void 0&&(r.tension=.3),e.fillByDefault&&r.fill===void 0&&(r.fill=!0);else if(d==="bar")l(r,"backgroundColor",t.resolveColor("color-mix(in srgb, ".concat(a," 78%, transparent)"),a),s),l(r,"borderColor",u,s),r.borderWidth===void 0&&(r.borderWidth=1),l(r,"hoverBackgroundColor",a,s),l(r,"hoverBorderColor",a,s),r.borderRadius=4;else if(d==="pie"||d==="doughnut"||d==="polarArea"){let b=ir(t,r.data?.length||0);l(r,"backgroundColor",b.map(m=>_(t,m,78)),s),l(r,"borderColor",b.map(m=>W(t,m)),s),l(r,"hoverBackgroundColor",b,s),l(r,"hoverBorderColor",b,s),r.borderWidth===void 0&&(r.borderWidth=1)}else d==="radar"?(l(r,"borderColor",u,s),l(r,"backgroundColor",_(t,a,18),s),l(r,"pointBackgroundColor",c,s),l(r,"pointBorderColor",c,s),l(r,"pointHoverBackgroundColor",c,s),l(r,"pointHoverBorderColor",c,s),r.borderWidth===void 0&&(r.borderWidth=V),r.pointRadius===void 0&&(r.pointRadius=x),r.pointHoverRadius===void 0&&(r.pointHoverRadius=E),r.pointHoverBorderWidth===void 0&&(r.pointHoverBorderWidth=0),r.fill===void 0&&(r.fill=!0)):(d==="scatter"||d==="bubble")&&(l(r,"backgroundColor",_(t,a,72),s),l(r,"borderColor",u,s),l(r,"hoverBackgroundColor",a,s),l(r,"hoverBorderColor",a,s),r.borderWidth===void 0&&(r.borderWidth=1),d==="scatter"?(r.pointRadius===void 0&&(r.pointRadius=x),r.pointHoverRadius===void 0&&(r.pointHoverRadius=E),r.pointHoverBorderWidth===void 0&&(r.pointHoverBorderWidth=0)):r.pointHoverRadius===void 0&&(r.pointHoverRadius=7));return r}function cr(r,o,e,t=[]){r&&(r.data.datasets.forEach((n,i)=>{q(n,i,e,o,t[i])}),r.options.scales&&Object.values(r.options.scales).forEach(n=>{n.grid&&(n.grid.color=o.resolveColor("color-mix(in srgb, ".concat(o.gridColor," 35%, transparent)"),o.gridColor)),n.ticks&&(n.ticks.color=o.secondaryText),n.title&&(n.title.color=o.textColor),n.angleLines&&(n.angleLines.color=o.resolveColor("color-mix(in srgb, ".concat(o.gridColor," 35%, transparent)"),o.gridColor)),n.pointLabels&&(n.pointLabels.color=o.secondaryText)}),r.options.plugins?.legend?.labels&&(r.options.plugins.legend.labels.color=o.textColor),r.options.plugins?.tooltip&&(r.options.plugins.tooltip.backgroundColor=o.backgroundColor,r.options.plugins.tooltip.titleColor=o.textColor,r.options.plugins.tooltip.bodyColor=o.secondaryText,r.options.plugins.tooltip.borderColor=o.borderColor),r.update())}function O(r){return{color:r.resolveColor("color-mix(in srgb, ".concat(r.gridColor," 35%, transparent)"),r.gridColor)}}function D(r,o={}){return{color:r.secondaryText,padding:8,...o}}function ur(r,o){let e=o.family==="point"?"linear":void 0;return{x:{...e?{type:e}:{},grid:O(r),ticks:D(r),border:{display:!1}},y:{...e?{type:e}:{},grid:O(r),ticks:D(r),border:{display:!1}}}}function dr(r){return{r:{angleLines:{color:r.resolveColor("color-mix(in srgb, ".concat(r.gridColor," 35%, transparent)"),r.gridColor)},grid:O(r),pointLabels:{color:r.secondaryText},ticks:D(r,{backdropColor:"transparent"})}}}function pr(r){return r.family==="point"||r.family==="arc"||r.family==="radial"?{mode:"nearest",intersect:!0}:{mode:"index",intersect:!1}}function hr(r){return!!r?.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches}function T(r){return typeof r=="number"&&Number.isFinite(r)?r.toLocaleString():""}function br(r){let o=r.dataset.label||r.label||"",e=r.parsed,t=r.raw;if(e!==null&&typeof e=="object"){let i=[];return typeof e.x=="number"&&Number.isFinite(e.x)&&i.push("X: ".concat(T(e.x))),typeof e.y=="number"&&Number.isFinite(e.y)&&i.push("Y: ".concat(T(e.y))),t&&typeof t=="object"&&typeof t.r=="number"&&i.push("Radius: ".concat(T(t.r))),i.length?o?"".concat(o,": ").concat(i.join(", ")):i.join(", "):o}let n=T(e);return n?o?"".concat(o,": ").concat(n):n:o}function fr(r,o,e){let t={responsive:!0,maintainAspectRatio:!1,interaction:pr(o),plugins:{legend:{labels:{color:r.textColor,usePointStyle:!0,pointStyle:K,boxWidth:g,boxHeight:g,generateLabels:lr,font:{size:R},padding:20}},tooltip:{backgroundColor:r.backgroundColor,titleColor:r.textColor,bodyColor:r.secondaryText,borderColor:r.borderColor,borderWidth:1,padding:12,cornerRadius:8,titleFont:{size:13,weight:"600"},bodyFont:{size:R},bodySpacing:6,usePointStyle:!0,boxWidth:A,boxHeight:A,boxPadding:Q,callbacks:{label:br,labelColor:ar,labelPointStyle:sr}}},animation:{duration:600,easing:"easeOutQuart"},hover:{animationDuration:200}};return o.family==="cartesian"||o.family==="point"?t.scales=ur(r,o):o.family==="radial"&&(t.scales=dr(r)),hr(e)&&(t.animation=!1,t.hover.animationDuration=0),t}function mr(r,o){let e=r.getAttribute("data-chart-data"),t=null,n=!1;if(e!==null&&e.trim()!==""){n=!0;try{t=JSON.parse(e)}catch(u){throw new SyntaxError("MooChart could not parse data-chart-data as JSON: ".concat(u.message))}}let i=Object.prototype.hasOwnProperty.call(o,"data");if(!i&&!n)throw new TypeError("MooChart data-chart-data is required unless config.data is provided.");let a=i?o.data:t;if(a==null||typeof a!="object"||Array.isArray(a)||!Array.isArray(a.labels)||!Array.isArray(a.datasets)){let u=i?"config.data":"data-chart-data";throw new TypeError("MooChart ".concat(u," must contain labels and datasets arrays."))}return a}function yr(r){let o=r.getAttribute("data-chart-options");if(o===null||o.trim()==="")return{};try{let e=JSON.parse(o);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError("MooChart data-chart-options must be a JSON object.");return e}catch(e){throw e instanceof SyntaxError?new SyntaxError("MooChart could not parse data-chart-options as JSON: ".concat(e.message)):e}}function $(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}function gr(r){return Object.entries(r||{}).filter(([o])=>!U.has(o))}function F(r={},o={}){let e={...r};return gr(o).forEach(([t,n])=>{e[t]=$(n)&&$(r[t])?F(r[t],n):n}),e}function Cr(){return v.slice(0,-1).join(", ")+", and "+v[v.length-1]}function _r(r,o){let e=o.type||r.getAttribute("data-chart")||"line",t=j.get(e);if(!t)throw new TypeError("MooChart supports ".concat(Cr(),' charts; received "').concat(e,'".'));return{publicType:e,...t}}var k=class r{static getInstance(o){return o?.nodeType===1&&y.get(o)||null}static getOrCreateInstance(o,e={}){return r.getInstance(o)||new r(o,e)}constructor(o,e={}){if(o?.nodeType!==1||!o.matches(".chart"))throw new TypeError("MooChart requires a .chart root element.");let t=y.get(o);if(t)return t;let n=o.querySelector(":scope > canvas");if(!n)throw new TypeError("MooChart requires a child <canvas> element inside the .chart root.");this._element=o,this._canvas=n,this._document=o.ownerDocument,this._window=this._document?.defaultView,this._config=e||{},this._themeElement=or(o);let i=_r(o,this._config),a=mr(o,this._config),u=yr(o);this._type=i.publicType,this._metadata=i,this._datasetExplicitColorFields=(a.datasets||[]).map(p=>z(p));let c=M(this._themeElement),d=N(this._themeElement,this._window),s=(p,h)=>H(this._document,this._window,p,h,this._themeElement);this._theme=P(d,c,s);let b=(a.datasets||[]).map((p,h)=>q({...p},h,i,this._theme,this._datasetExplicitColorFields[h])),m=F(F(fr(this._theme,i,this._window),u),this._config.options);if(this._chart=new L(n,{...this._config,type:i.chartType,data:{labels:a.labels||[],datasets:b},options:m}),this._chart.data.datasets.forEach((p,h)=>{Y(p,this._datasetExplicitColorFields[h])}),this._rethemeFrame=null,this._observer=null,this._themeElement&&this._window?.MutationObserver){this._observer=new this._window.MutationObserver(f=>{f.forEach(C=>{(C.attributeName==="data-bs-theme"||C.attributeName==="style")&&this._scheduleRetheme()})});let p={attributes:!0,attributeFilter:["data-bs-theme","style"]};[this._themeElement,this._document?.documentElement].filter((f,C,J)=>f&&J.indexOf(f)===C).forEach(f=>{this._observer.observe(f,p)})}y.set(o,this)}get chart(){return this._chart}get element(){return this._element}_scheduleRetheme(){if(this._rethemeFrame!==null)return;let o=this._window?.requestAnimationFrame;if(!o){this._applyTheme();return}this._rethemeFrame=o.call(this._window,()=>{this._rethemeFrame=null,this._applyTheme()})}_applyTheme(){if(!this._chart)return;let o=M(this._themeElement),e=N(this._themeElement,this._window),t=(n,i)=>H(this._document,this._window,n,i,this._themeElement);this._theme=P(e,o,t),cr(this._chart,this._theme,this._metadata,this._datasetExplicitColorFields)}dispose(){this._rethemeFrame!==null&&this._window?.cancelAnimationFrame&&this._window.cancelAnimationFrame(this._rethemeFrame),this._rethemeFrame=null,this._observer?.disconnect(),this._observer=null,this._chart?.destroy(),this._chart=null,y.get(this._element)===this&&y.delete(this._element)}};export{k as default};
7
+ import L from"chart.js/auto";var y=new WeakMap,j=new Map([["area",{chartType:"line",family:"cartesian",fillByDefault:!0,pointRadiusDefault:0}],["line",{chartType:"line",family:"cartesian",fillByDefault:!0}],["bar",{chartType:"bar",family:"cartesian"}],["pie",{chartType:"pie",family:"arc"}],["doughnut",{chartType:"doughnut",family:"arc"}],["polarArea",{chartType:"polarArea",family:"radial"}],["radar",{chartType:"radar",family:"radial"}],["scatter",{chartType:"scatter",family:"point"}],["bubble",{chartType:"bubble",family:"point"}]]),v=Array.from(j.keys()),U=new Set(["__proto__","constructor","prototype"]),C=6,x=C/2,E=5,A=12,G=1.5,V=1.5,B=1,Z=E+B,K="circle",R=C*Math.SQRT2,Q=C+A/2-R-2,S=Symbol("mooChartThemeState"),X=["backgroundColor","borderColor","hoverBackgroundColor","hoverBorderColor","pointBackgroundColor","pointBorderColor","pointHoverBackgroundColor","pointHoverBorderColor"],rr=["--bs-body-color","--bs-body-bg","--bs-secondary-color","--bs-secondary-bg","--bs-tertiary-color","--bs-tertiary-bg","--bs-border-color","--bs-primary","--bs-success","--bs-info","--bs-warning","--bs-danger","--bs-emphasis-color","--bs-info-text-emphasis","--bs-success-text-emphasis","--bs-warning-text-emphasis","--bs-danger-text-emphasis","--moo-chart-1","--moo-chart-2","--moo-chart-3","--moo-chart-4","--moo-chart-5"],w=["primary","success","info","warning","danger"];function M(r,o){let e=o?.getComputedStyle?.(r),t={};return e&&rr.forEach(n=>{t[n]=e.getPropertyValue(n).trim()}),t}function or(r){let o=r?.closest?.("[data-bs-theme]");if(o)return o;let e=r?.ownerDocument?.body;return e?.hasAttribute?.("data-bs-theme")?e:r?.ownerDocument?.documentElement||null}function N(r){return(r?.getAttribute?.("data-bs-theme")||r?.dataset?.bsTheme)==="dark"}function I(r){return Math.min(255,Math.max(0,Math.round(r)))}function er(r){let o=String(r).trim();if(o.endsWith("%")){let t=Number.parseFloat(o.slice(0,-1));return Number.isFinite(t)?I(t/100*255):null}let e=Number.parseFloat(o);return Number.isFinite(e)?I(e*255):null}function tr(r){if(r===void 0)return 1;let o=String(r).trim();if(o.endsWith("%")){let t=Number.parseFloat(o.slice(0,-1));return Number.isFinite(t)?Math.min(1,Math.max(0,t/100)):null}let e=Number.parseFloat(o);return Number.isFinite(e)?Math.min(1,Math.max(0,e)):null}function nr(r){if(typeof r!="string")return null;let o=r.trim(),e=o.match(/^color\(\s*srgb\s+([^\s/]+)\s+([^\s/]+)\s+([^\s/]+)(?:\s*\/\s*([^\s)]+))?\s*\)$/i);if(!e)return o||null;let t=e.slice(1,4).map(er),n=tr(e[4]);return t.some(a=>a===null)||n===null?null:n>=1?"rgb(".concat(t.join(", "),")"):"rgba(".concat(t.join(", "),", ").concat(Number(n.toFixed(3)),")")}function H(r,o,e,t,n){let a=r?.createElement,i=o?.getComputedStyle,u=r?.documentElement;if(!a||!i||!u)return t;let l=a.call(r,"span");if(l.style.color=e,!l.style.color)return t;l.hidden=!0,(n?.appendChild?n:u).appendChild(l);try{let s=i.call(o,l).color;return nr(s)||t}finally{l.remove()}}function P(r,o=!1,e=t=>t){let t={primary:r["--moo-chart-1"]||r["--bs-info"]||r["--bs-info-text-emphasis"],success:r["--moo-chart-2"]||r["--bs-success"],info:r["--moo-chart-3"]||r["--bs-info"],warning:r["--moo-chart-4"]||r["--bs-warning"],danger:r["--moo-chart-5"]||r["--bs-danger"]},n={primary:r["--moo-chart-1"]||r["--bs-info-text-emphasis"]||r["--bs-info"],success:r["--moo-chart-2"]||r["--bs-success-text-emphasis"]||r["--bs-success"],info:r["--moo-chart-3"]||r["--bs-info-text-emphasis"]||r["--bs-info"],warning:r["--moo-chart-4"]||r["--bs-warning-text-emphasis"]||r["--bs-warning"],danger:r["--moo-chart-5"]||r["--bs-danger-text-emphasis"]||r["--bs-danger"]},a=o?n:t;return{color:r["--bs-body-color"],backgroundColor:r["--bs-body-bg"],borderColor:r["--bs-border-color"],gridColor:r["--bs-secondary-color"],tickColor:r["--bs-secondary-color"],textColor:r["--bs-body-color"],secondaryText:r["--bs-secondary-color"],resolveColor:e,...a}}function T(r,o,e=22){return r.resolveColor("color-mix(in srgb, ".concat(o," ").concat(e,"%, transparent)"),o)}function W(r,o){return r.resolveColor("color-mix(in srgb, ".concat(o," 92%, ").concat(r.color,")"),o)}function ir(r,o){return Array.from({length:Math.max(o,1)},(e,t)=>{let n=w[t%w.length];return r[n]})}function z(r){return new Set(X.filter(o=>Object.prototype.hasOwnProperty.call(r,o)))}function Y(r,o=null){return r[S]||Object.defineProperty(r,S,{value:{explicitColorFields:o||z(r)}}),r[S]}function c(r,o,e,t){t.explicitColorFields.has(o)||(r[o]=e)}function sr(){return{pointStyle:K,rotation:0}}function ar(r){let e=r.chart.getDatasetMeta(r.datasetIndex).controller.getStyle(r.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:B,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}}function lr(r){return L.defaults.plugins.legend.labels.generateLabels(r).map(o=>({...o,lineWidth:B}))}function q(r,o,e,t,n=null){let a=w[o%w.length],i=t[a],u=W(t,i),l=i,d=r.type||e.chartType,s=Y(r,n);if(d==="line")c(r,"borderColor",u,s),c(r,"backgroundColor",T(t,i),s),c(r,"pointBackgroundColor",l,s),c(r,"pointBorderColor",l,s),r.pointBorderWidth=0,r.borderWidth===void 0&&(r.borderWidth=G),r.clip===void 0&&(r.clip=Z),r.pointRadius===void 0&&(r.pointRadius=e.pointRadiusDefault??x),r.pointHoverRadius=E,c(r,"pointHoverBackgroundColor",l,s),c(r,"pointHoverBorderColor",l,s),r.pointHoverBorderWidth=0,r.tension===void 0&&(r.tension=.3),e.fillByDefault&&r.fill===void 0&&(r.fill=!0);else if(d==="bar")c(r,"backgroundColor",t.resolveColor("color-mix(in srgb, ".concat(i," 78%, transparent)"),i),s),c(r,"borderColor",u,s),r.borderWidth===void 0&&(r.borderWidth=1),c(r,"hoverBackgroundColor",i,s),c(r,"hoverBorderColor",i,s),r.borderRadius=4;else if(d==="pie"||d==="doughnut"||d==="polarArea"){let f=ir(t,r.data?.length||0);c(r,"backgroundColor",f.map(m=>T(t,m,78)),s),c(r,"borderColor",f.map(m=>W(t,m)),s),c(r,"hoverBackgroundColor",f,s),c(r,"hoverBorderColor",f,s),r.borderWidth===void 0&&(r.borderWidth=1)}else d==="radar"?(c(r,"borderColor",u,s),c(r,"backgroundColor",T(t,i,18),s),c(r,"pointBackgroundColor",l,s),c(r,"pointBorderColor",l,s),c(r,"pointHoverBackgroundColor",l,s),c(r,"pointHoverBorderColor",l,s),r.borderWidth===void 0&&(r.borderWidth=V),r.pointRadius===void 0&&(r.pointRadius=x),r.pointHoverRadius===void 0&&(r.pointHoverRadius=E),r.pointHoverBorderWidth===void 0&&(r.pointHoverBorderWidth=0),r.fill===void 0&&(r.fill=!0)):(d==="scatter"||d==="bubble")&&(c(r,"backgroundColor",T(t,i,72),s),c(r,"borderColor",u,s),c(r,"hoverBackgroundColor",i,s),c(r,"hoverBorderColor",i,s),r.borderWidth===void 0&&(r.borderWidth=1),d==="scatter"?(r.pointRadius===void 0&&(r.pointRadius=x),r.pointHoverRadius===void 0&&(r.pointHoverRadius=E),r.pointHoverBorderWidth===void 0&&(r.pointHoverBorderWidth=0)):r.pointHoverRadius===void 0&&(r.pointHoverRadius=7));return r}function cr(r,o,e,t=[]){r&&(r.data.datasets.forEach((n,a)=>{q(n,a,e,o,t[a])}),r.options.scales&&Object.values(r.options.scales).forEach(n=>{n.grid&&(n.grid.color=o.resolveColor("color-mix(in srgb, ".concat(o.gridColor," 35%, transparent)"),o.gridColor)),n.ticks&&(n.ticks.color=o.secondaryText),n.title&&(n.title.color=o.textColor),n.angleLines&&(n.angleLines.color=o.resolveColor("color-mix(in srgb, ".concat(o.gridColor," 35%, transparent)"),o.gridColor)),n.pointLabels&&(n.pointLabels.color=o.secondaryText)}),r.options.plugins?.legend?.labels&&(r.options.plugins.legend.labels.color=o.textColor),r.options.plugins?.tooltip&&(r.options.plugins.tooltip.backgroundColor=o.backgroundColor,r.options.plugins.tooltip.titleColor=o.textColor,r.options.plugins.tooltip.bodyColor=o.secondaryText,r.options.plugins.tooltip.borderColor=o.borderColor),r.update())}function O(r){return{color:r.resolveColor("color-mix(in srgb, ".concat(r.gridColor," 35%, transparent)"),r.gridColor)}}function D(r,o={}){return{color:r.secondaryText,padding:8,...o}}function ur(r,o){let e=o.family==="point"?"linear":void 0;return{x:{...e?{type:e}:{},grid:O(r),ticks:D(r),border:{display:!1}},y:{...e?{type:e}:{},grid:O(r),ticks:D(r),border:{display:!1}}}}function dr(r){return{r:{angleLines:{color:r.resolveColor("color-mix(in srgb, ".concat(r.gridColor," 35%, transparent)"),r.gridColor)},grid:O(r),pointLabels:{color:r.secondaryText},ticks:D(r,{backdropColor:"transparent"})}}}function pr(r){return r.family==="point"||r.family==="arc"||r.family==="radial"?{mode:"nearest",intersect:!0}:{mode:"index",intersect:!1}}function hr(r){return!!r?.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches}function g(r){return typeof r=="number"&&Number.isFinite(r)?r.toLocaleString():""}function fr(r){let o=r.dataset.label||r.label||"",e=r.parsed,t=r.raw;if(e!==null&&typeof e=="object"){let a=r.chart?.getDatasetMeta?.(r.datasetIndex),i=a?.iScale?.type==="category"?a.vScale?.axis:null,u=i?e[i]:typeof e.r=="number"&&e.x===void 0?e.r:void 0;if(u!==void 0){let d=g(u);return d?o?"".concat(o,": ").concat(d):d:o}let l=[];return typeof e.x=="number"&&Number.isFinite(e.x)&&l.push("X: ".concat(g(e.x))),typeof e.y=="number"&&Number.isFinite(e.y)&&l.push("Y: ".concat(g(e.y))),t&&typeof t=="object"&&typeof t.r=="number"&&l.push("Radius: ".concat(g(t.r))),l.length?o?"".concat(o,": ").concat(l.join(", ")):l.join(", "):o}let n=g(e);return n?o?"".concat(o,": ").concat(n):n:o}function br(r,o,e){let t={responsive:!0,maintainAspectRatio:!1,interaction:pr(o),plugins:{legend:{labels:{color:r.textColor,usePointStyle:!0,pointStyle:K,boxWidth:C,boxHeight:C,generateLabels:lr,font:{size:A},padding:20}},tooltip:{backgroundColor:r.backgroundColor,titleColor:r.textColor,bodyColor:r.secondaryText,borderColor:r.borderColor,borderWidth:1,padding:12,cornerRadius:8,titleFont:{size:13,weight:"600"},bodyFont:{size:A},bodySpacing:6,usePointStyle:!0,boxWidth:R,boxHeight:R,boxPadding:Q,callbacks:{label:fr,labelColor:ar,labelPointStyle:sr}}},animation:{duration:600,easing:"easeOutQuart"},hover:{animationDuration:200}};return o.family==="cartesian"||o.family==="point"?t.scales=ur(r,o):o.family==="radial"&&(t.scales=dr(r)),hr(e)&&(t.animation=!1,t.hover.animationDuration=0),t}function mr(r,o){let e=r.getAttribute("data-chart-data"),t=null,n=!1;if(e!==null&&e.trim()!==""){n=!0;try{t=JSON.parse(e)}catch(u){throw new SyntaxError("MooChart could not parse data-chart-data as JSON: ".concat(u.message))}}let a=Object.prototype.hasOwnProperty.call(o,"data");if(!a&&!n)throw new TypeError("MooChart data-chart-data is required unless config.data is provided.");let i=a?o.data:t;if(i==null||typeof i!="object"||Array.isArray(i)||!Array.isArray(i.labels)||!Array.isArray(i.datasets)){let u=a?"config.data":"data-chart-data";throw new TypeError("MooChart ".concat(u," must contain labels and datasets arrays."))}return i}function yr(r){let o=r.getAttribute("data-chart-options");if(o===null||o.trim()==="")return{};try{let e=JSON.parse(o);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError("MooChart data-chart-options must be a JSON object.");return e}catch(e){throw e instanceof SyntaxError?new SyntaxError("MooChart could not parse data-chart-options as JSON: ".concat(e.message)):e}}function $(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}function gr(r){return Object.entries(r||{}).filter(([o])=>!U.has(o))}function F(r={},o={}){let e={...r};return gr(o).forEach(([t,n])=>{e[t]=$(n)&&$(r[t])?F(r[t],n):n}),e}function Cr(){return v.slice(0,-1).join(", ")+", and "+v[v.length-1]}function _r(r,o){let e=o.type||r.getAttribute("data-chart")||"line",t=j.get(e);if(!t)throw new TypeError("MooChart supports ".concat(Cr(),' charts; received "').concat(e,'".'));return{publicType:e,...t}}var k=class r{static getInstance(o){return o?.nodeType===1&&y.get(o)||null}static getOrCreateInstance(o,e={}){return r.getInstance(o)||new r(o,e)}constructor(o,e={}){if(o?.nodeType!==1||!o.matches(".chart"))throw new TypeError("MooChart requires a .chart root element.");let t=y.get(o);if(t)return t;let n=o.querySelector(":scope > canvas");if(!n)throw new TypeError("MooChart requires a child <canvas> element inside the .chart root.");this._element=o,this._canvas=n,this._document=o.ownerDocument,this._window=this._document?.defaultView,this._config=e||{},this._themeElement=or(o);let a=_r(o,this._config),i=mr(o,this._config),u=yr(o);this._type=a.publicType,this._metadata=a,this._datasetExplicitColorFields=(i.datasets||[]).map(p=>z(p));let l=N(this._themeElement),d=M(this._themeElement,this._window),s=(p,h)=>H(this._document,this._window,p,h,this._themeElement);this._theme=P(d,l,s);let f=(i.datasets||[]).map((p,h)=>q({...p},h,a,this._theme,this._datasetExplicitColorFields[h])),m=F(F(br(this._theme,a,this._window),u),this._config.options);if(this._chart=new L(n,{...this._config,type:a.chartType,data:{labels:i.labels||[],datasets:f},options:m}),this._chart.data.datasets.forEach((p,h)=>{Y(p,this._datasetExplicitColorFields[h])}),this._rethemeFrame=null,this._observer=null,this._themeElement&&this._window?.MutationObserver){this._observer=new this._window.MutationObserver(b=>{b.forEach(_=>{(_.attributeName==="data-bs-theme"||_.attributeName==="style")&&this._scheduleRetheme()})});let p={attributes:!0,attributeFilter:["data-bs-theme","style"]};[this._themeElement,this._document?.documentElement].filter((b,_,J)=>b&&J.indexOf(b)===_).forEach(b=>{this._observer.observe(b,p)})}y.set(o,this)}get chart(){return this._chart}get element(){return this._element}_scheduleRetheme(){if(this._rethemeFrame!==null)return;let o=this._window?.requestAnimationFrame;if(!o){this._applyTheme();return}this._rethemeFrame=o.call(this._window,()=>{this._rethemeFrame=null,this._applyTheme()})}_applyTheme(){if(!this._chart)return;let o=N(this._themeElement),e=M(this._themeElement,this._window),t=(n,a)=>H(this._document,this._window,n,a,this._themeElement);this._theme=P(e,o,t),cr(this._chart,this._theme,this._metadata,this._datasetExplicitColorFields)}dispose(){this._rethemeFrame!==null&&this._window?.cancelAnimationFrame&&this._window.cancelAnimationFrame(this._rethemeFrame),this._rethemeFrame=null,this._observer?.disconnect(),this._observer=null,this._chart?.destroy(),this._chart=null,y.get(this._element)===this&&y.delete(this._element)}};export{k as default};
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Moo UI combobox.js v2.1.0 (https://wpmoo.org/)
2
+ * Moo UI combobox.js v2.1.1 (https://wpmoo.org/)
3
3
  * Copyright 2026 WPMoo Authors
4
4
  * Licensed under MIT (https://github.com/wpmoo-org/ui/blob/main/LICENSE)
5
5
  */
@@ -246,11 +246,7 @@ class Combobox {
246
246
  _clearStaleSelection() {
247
247
  if (this._isMultiple) {
248
248
  this._input.value = "";
249
- this._options.forEach((option) => {
250
- option.hidden = false;
251
- });
252
- this._syncGroupVisibility();
253
- this._empty.hidden = true;
249
+ this._showAllOptions();
254
250
  return;
255
251
  }
256
252
  const selected = this._selectedOptions()[0] || null;
@@ -261,6 +257,14 @@ class Combobox {
261
257
  this._clearSelection();
262
258
  this._input.value = "";
263
259
  }
260
+ _showAllOptions() {
261
+ this._options.forEach((option) => {
262
+ option.hidden = false;
263
+ });
264
+ this._syncGroupVisibility();
265
+ this._empty.hidden = true;
266
+ this._liveRegion.textContent = "";
267
+ }
264
268
  _activeOption() {
265
269
  const activeId = this._input.getAttribute("aria-activedescendant");
266
270
  if (!activeId) {
@@ -347,6 +351,7 @@ class Combobox {
347
351
  if (this._hidden) {
348
352
  this._hidden.value = option.dataset.value || "";
349
353
  }
354
+ this._showAllOptions();
350
355
  this._toggleClear(true);
351
356
  this._setActiveOption(option);
352
357
  this._emitChange();
@@ -439,6 +444,12 @@ class Combobox {
439
444
  }
440
445
  }
441
446
  _handleKeydown(event) {
447
+ if (event.isComposing || event.keyCode === 229) {
448
+ if (event.key === "Tab") {
449
+ this._closeMenu();
450
+ }
451
+ return;
452
+ }
442
453
  const available = this._visibleOptions();
443
454
  const current = available.findIndex(
444
455
  (option) => option.id === this._input.getAttribute("aria-activedescendant")
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Moo UI context-menu.js v2.1.0 (https://wpmoo.org/)
2
+ * Moo UI context-menu.js v2.1.1 (https://wpmoo.org/)
3
3
  * Copyright 2026 WPMoo Authors
4
4
  * Licensed under MIT (https://github.com/wpmoo-org/ui/blob/main/LICENSE)
5
5
  */
@@ -67,12 +67,17 @@ class ContextMenu {
67
67
  this._bindEvents();
68
68
  }
69
69
  dispose() {
70
+ if (this._disposing) {
71
+ return;
72
+ }
73
+ this._disposing = true;
70
74
  this._listeners.forEach(({ target, type, handler, options }) => {
71
75
  target.removeEventListener(type, handler, options);
72
76
  });
73
77
  this._listeners = [];
74
- this._dropdown.dispose();
75
78
  this._syncExpanded(false);
79
+ this._dropdown.hide();
80
+ this._dropdown.dispose();
76
81
  this._invoker = null;
77
82
  this._pointerRect = null;
78
83
  instances.delete(this._element);
@@ -184,7 +189,7 @@ class ContextMenu {
184
189
  event.preventDefault();
185
190
  event.stopPropagation();
186
191
  const group = radioButton.dataset.contextMenuRadioGroup;
187
- this._menu.querySelectorAll(`[data-context-menu-radio-group="${group}"]`).forEach((button) => {
192
+ this._menu.querySelectorAll(`[data-context-menu-radio-group="${CSS.escape(String(group))}"]`).forEach((button) => {
188
193
  const checked = button === radioButton;
189
194
  button.classList.toggle("active", checked);
190
195
  button.setAttribute("aria-pressed", String(checked));
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Moo UI datatable.js v2.1.0 (https://wpmoo.org/)
2
+ * Moo UI datatable.js v2.1.1 (https://wpmoo.org/)
3
3
  * Copyright 2026 WPMoo Authors
4
4
  * Licensed under MIT (https://github.com/wpmoo-org/ui/blob/main/LICENSE)
5
5
  */
@@ -45,10 +45,34 @@ __name(ownerPortalRoot, "ownerPortalRoot");
45
45
 
46
46
  // src/js/components/datatable.js
47
47
  var instances = /* @__PURE__ */ new WeakMap();
48
+ var SORT_COLLATOR = new Intl.Collator(void 0, { numeric: true, sensitivity: "base" });
49
+ var PLAIN_NUMBER = /^[-+]?(?:\d+\.?\d*|\.\d+)$/;
50
+ function sortNumber(value) {
51
+ return PLAIN_NUMBER.test(value) ? Number(value) : null;
52
+ }
53
+ __name(sortNumber, "sortNumber");
54
+ function compareSortValues(a, b) {
55
+ const aNumber = sortNumber(a);
56
+ const bNumber = sortNumber(b);
57
+ if (aNumber !== null && bNumber !== null) {
58
+ return Math.sign(aNumber - bNumber);
59
+ }
60
+ if (aNumber !== null || bNumber !== null) {
61
+ return aNumber !== null ? -1 : 1;
62
+ }
63
+ return SORT_COLLATOR.compare(a, b);
64
+ }
65
+ __name(compareSortValues, "compareSortValues");
48
66
  function normalize(value) {
49
67
  return (value ?? "").toString().trim().toLowerCase();
50
68
  }
51
69
  __name(normalize, "normalize");
70
+ var ESCAPE_OWNER_SELECTOR = ".modal, .offcanvas, .dropdown-menu, .popover, [role='dialog'], [role='menu'], [role='listbox']";
71
+ function escapeBelongsElsewhere(event) {
72
+ const target = event.target;
73
+ return typeof target?.closest === "function" && (Boolean(target.closest(ESCAPE_OWNER_SELECTOR)) || target.getAttribute("aria-expanded") === "true");
74
+ }
75
+ __name(escapeBelongsElsewhere, "escapeBelongsElsewhere");
52
76
  var _DataTable = class _DataTable {
53
77
  static getInstance(element) {
54
78
  return element?.nodeType === 1 ? instances.get(element) || null : null;
@@ -498,7 +522,7 @@ var _DataTable = class _DataTable {
498
522
  );
499
523
  }
500
524
  _sortValue(row, key) {
501
- const cell = row.element.querySelector(`:scope > [data-datatable-column="${key}"]`);
525
+ const cell = row.element.querySelector(`:scope > [data-datatable-column="${CSS.escape(String(key))}"]`);
502
526
  if (!cell) {
503
527
  return "";
504
528
  }
@@ -525,10 +549,8 @@ var _DataTable = class _DataTable {
525
549
  filtered.sort((a, b) => {
526
550
  const aValue = this._sortValue(a, this._sortKey);
527
551
  const bValue = this._sortValue(b, this._sortKey);
528
- if (aValue === bValue) {
529
- return a.index - b.index;
530
- }
531
- return aValue > bValue ? direction : -direction;
552
+ const order = compareSortValues(aValue, bValue);
553
+ return order ? order * direction : a.index - b.index;
532
554
  });
533
555
  } else {
534
556
  filtered.sort((a, b) => a.index - b.index);
@@ -595,7 +617,7 @@ var _DataTable = class _DataTable {
595
617
  summary.appendChild(this._createFacetBadge(`${selected.size} selected`));
596
618
  } else {
597
619
  selected.forEach((value) => {
598
- const option = facetRoot.querySelector(`[data-datatable-facet-option="${value}"]`);
620
+ const option = facetRoot.querySelector(`[data-datatable-facet-option="${CSS.escape(String(value))}"]`);
599
621
  const label = option?.querySelector("[data-datatable-facet-option-label]")?.textContent ?? value;
600
622
  summary.appendChild(this._createFacetBadge(label));
601
623
  });
@@ -824,17 +846,17 @@ var _DataTable = class _DataTable {
824
846
  return withEllipsis;
825
847
  }
826
848
  _isColumnFixed(key) {
827
- return this._element.querySelector(`th[data-datatable-column="${key}"]`)?.hasAttribute("data-datatable-column-fixed") || false;
849
+ return this._element.querySelector(`th[data-datatable-column="${CSS.escape(String(key))}"]`)?.hasAttribute("data-datatable-column-fixed") || false;
828
850
  }
829
851
  _setColumnVisible(key, visible, { syncViewToggle = true } = {}) {
830
852
  if (!visible && this._isColumnFixed(key)) {
831
853
  return;
832
854
  }
833
- this._element.querySelectorAll(`[data-datatable-column="${key}"], [data-datatable-detail-column="${key}"]`).forEach((cell) => {
855
+ this._element.querySelectorAll(`[data-datatable-column="${CSS.escape(String(key))}"], [data-datatable-detail-column="${CSS.escape(String(key))}"]`).forEach((cell) => {
834
856
  cell.classList.toggle("datatable-col-hidden", !visible);
835
857
  });
836
858
  if (syncViewToggle) {
837
- this._element.querySelectorAll(`[data-datatable-column-toggle="${key}"]`).forEach((toggle) => {
859
+ this._element.querySelectorAll(`[data-datatable-column-toggle="${CSS.escape(String(key))}"]`).forEach((toggle) => {
838
860
  toggle.classList.toggle("active", visible);
839
861
  toggle.setAttribute("aria-pressed", String(visible));
840
862
  });
@@ -971,8 +993,8 @@ var _DataTable = class _DataTable {
971
993
  if (group) {
972
994
  const key = group.dataset.datatableFilterGroup;
973
995
  this._showFilterPickerPanel(key);
974
- const search = this._element.querySelector(`[data-datatable-filter-option-search="${key}"]`);
975
- const option = this._element.querySelector(`[data-datatable-filter-option-key="${key}"]`);
996
+ const search = this._element.querySelector(`[data-datatable-filter-option-search="${CSS.escape(String(key))}"]`);
997
+ const option = this._element.querySelector(`[data-datatable-filter-option-key="${CSS.escape(String(key))}"]`);
976
998
  (search || option)?.focus({ preventScroll: true });
977
999
  return;
978
1000
  }
@@ -987,7 +1009,7 @@ var _DataTable = class _DataTable {
987
1009
  }
988
1010
  const key = search.dataset.datatableFilterOptionSearch;
989
1011
  const query = normalize(search.value);
990
- this._element.querySelectorAll(`[data-datatable-filter-option-key="${key}"]`).forEach((option) => {
1012
+ this._element.querySelectorAll(`[data-datatable-filter-option-key="${CSS.escape(String(key))}"]`).forEach((option) => {
991
1013
  const label = normalize(option.querySelector("[data-datatable-filter-option-label]")?.textContent || option.textContent);
992
1014
  option.closest("li")?.classList.toggle("datatable-filter-option-search-hidden", query.length > 0 && !label.includes(query));
993
1015
  });
@@ -1004,7 +1026,7 @@ var _DataTable = class _DataTable {
1004
1026
  }
1005
1027
  const key = search.dataset.datatableFilterOptionSearch;
1006
1028
  const options = Array.from(
1007
- this._element.querySelectorAll(`[data-datatable-filter-option-key="${key}"]`)
1029
+ this._element.querySelectorAll(`[data-datatable-filter-option-key="${CSS.escape(String(key))}"]`)
1008
1030
  );
1009
1031
  const firstVisible = options.find(
1010
1032
  (option) => !option.closest("li")?.classList.contains("datatable-filter-option-search-hidden")
@@ -1129,7 +1151,7 @@ var _DataTable = class _DataTable {
1129
1151
  }
1130
1152
  row.element.setAttribute(`data-datatable-facet-${key}`, value);
1131
1153
  row.facets[key] = value;
1132
- const cell = row.element.querySelector(`[data-datatable-column="${key}"]`);
1154
+ const cell = row.element.querySelector(`[data-datatable-column="${CSS.escape(String(key))}"]`);
1133
1155
  if (!cell) {
1134
1156
  return;
1135
1157
  }
@@ -1143,7 +1165,7 @@ var _DataTable = class _DataTable {
1143
1165
  if (currentIcon && icon) {
1144
1166
  currentIcon.replaceWith(icon.cloneNode(true));
1145
1167
  }
1146
- const cardValue = row.cardElement?.querySelector(`[data-datatable-detail-column="${key}"] .datatable-card-value`);
1168
+ const cardValue = row.cardElement?.querySelector(`[data-datatable-detail-column="${CSS.escape(String(key))}"] .datatable-card-value`);
1147
1169
  if (cardValue) {
1148
1170
  cardValue.innerHTML = cell.innerHTML;
1149
1171
  }
@@ -1237,11 +1259,11 @@ var _DataTable = class _DataTable {
1237
1259
  }
1238
1260
  });
1239
1261
  this._listen(this._document, "click", (event) => this._handleSortAction(event));
1240
- this._listen(this._document, "keydown", (event) => {
1241
- if (event.key === "Escape" && this._selectedIds.size > 0) {
1262
+ this._listen(this._window, "keydown", (event) => {
1263
+ if (event.key === "Escape" && this._selectedIds.size > 0 && !escapeBelongsElsewhere(event)) {
1242
1264
  this._clearSelection();
1243
1265
  }
1244
- });
1266
+ }, { capture: true });
1245
1267
  this._listen(this._element, "show.bs.dropdown", (event) => {
1246
1268
  this._reparentRowActionMenu(event.target);
1247
1269
  this._reparentSortMenu(event.target);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Moo UI datepicker.js v2.1.0 (https://wpmoo.org/)
2
+ * Moo UI datepicker.js v2.1.1 (https://wpmoo.org/)
3
3
  * Copyright 2026 WPMoo Authors
4
4
  * Licensed under MIT (https://github.com/wpmoo-org/ui/blob/main/LICENSE)
5
5
  */
@@ -193,6 +193,15 @@ function dispatch(element, window2, name, detail = {}, cancelable = false) {
193
193
  })
194
194
  );
195
195
  }
196
+ function formDefaultValue(input) {
197
+ if (!input) {
198
+ return "";
199
+ }
200
+ if (!("datepickerFormDefault" in input.dataset)) {
201
+ input.dataset.datepickerFormDefault = input.getAttribute("value") || "";
202
+ }
203
+ return input.dataset.datepickerFormDefault;
204
+ }
196
205
  function setHiddenValue(input, value) {
197
206
  if (!input) return;
198
207
  input.value = value || "";
@@ -596,6 +605,7 @@ var MooCalendar = class _MooCalendar {
596
605
  ArrowUp: -7
597
606
  };
598
607
  let nextDate = null;
608
+ let stepTowardActive = false;
599
609
  if (event.key in keyMap) {
600
610
  nextDate = addDays(this._activeDate, keyMap[event.key]);
601
611
  } else if (event.key === "Home") {
@@ -606,10 +616,13 @@ var MooCalendar = class _MooCalendar {
606
616
  const weekStart = firstDayOfWeek(this._config.locale);
607
617
  const weekdayOffset = (this._activeDate.getDay() - weekStart + 7) % 7;
608
618
  nextDate = addDays(this._activeDate, 6 - weekdayOffset);
609
- } else if (event.key === "PageUp") {
610
- nextDate = addMonths(this._activeDate, -1);
611
- } else if (event.key === "PageDown") {
612
- nextDate = addMonths(this._activeDate, 1);
619
+ } else if (event.key === "PageUp" || event.key === "PageDown") {
620
+ const target = addMonths(this._activeDate, event.key === "PageUp" ? -1 : 1);
621
+ const { minDate, maxDate } = this._config;
622
+ nextDate = limitToRange(target, minDate, maxDate);
623
+ stepTowardActive = [minDate, maxDate].some(
624
+ (edge) => edge && compareDates(nextDate, edge) === 0
625
+ );
613
626
  } else if (event.key === "Enter" || event.key === " " || event.key === "Spacebar") {
614
627
  event.preventDefault();
615
628
  this._selectDate(this._activeDate, true);
@@ -618,7 +631,8 @@ var MooCalendar = class _MooCalendar {
618
631
  return;
619
632
  }
620
633
  event.preventDefault();
621
- this._setActiveDate(nextDate, true, compareDates(nextDate, this._activeDate) < 0 ? -1 : 1);
634
+ const backward = compareDates(nextDate, this._activeDate) < 0;
635
+ this._setActiveDate(nextDate, true, backward !== stepTowardActive ? -1 : 1);
622
636
  }
623
637
  _setActiveDate(date, focus = false, step = 0) {
624
638
  const nextDate = step === 0 ? this._nearestEnabledDate(date) : this._nextEnabledDate(date, step);
@@ -884,7 +898,7 @@ var MooDatepicker = class _MooDatepicker {
884
898
  value: config.value || this._input.value || element.dataset.datepickerValue
885
899
  });
886
900
  this._placeholder = this._config.placeholder;
887
- this._defaultValue = this._input.defaultValue || this._input.getAttribute("value") || "";
901
+ this._defaultValue = formDefaultValue(this._input);
888
902
  this.calendar = MooCalendar.getOrCreateInstance(this._calendarRoot, {
889
903
  ...this._config,
890
904
  mode: "single",
@@ -1049,8 +1063,8 @@ var MooDateRangePicker = class _MooDateRangePicker {
1049
1063
  endValue: config.endValue || this._endInput.value || element.dataset.datepickerEndValue
1050
1064
  });
1051
1065
  this._placeholder = this._config.placeholder;
1052
- this._defaultStartValue = this._startInput.defaultValue || this._startInput.getAttribute("value") || "";
1053
- this._defaultEndValue = this._endInput.defaultValue || this._endInput.getAttribute("value") || "";
1066
+ this._defaultStartValue = formDefaultValue(this._startInput);
1067
+ this._defaultEndValue = formDefaultValue(this._endInput);
1054
1068
  this.calendar = MooCalendar.getOrCreateInstance(this._calendarRoot, this._config);
1055
1069
  rangePickerInstances.set(element, this);
1056
1070
  this._syncFromCalendar();