@middag-io/react 0.42.0 → 0.43.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 (65) hide show
  1. package/dist-lib/{DateField-x0Ot_z_i.js → DateField-lPZsiWfC.js} +5 -5
  2. package/dist-lib/{DateRangeField-DbWZ2f92.js → DateRangeField-B7zWB48D.js} +12 -8
  3. package/dist-lib/{DocumentField-fwq79IWM.js → DocumentField-DutGscEM.js} +3 -3
  4. package/dist-lib/{FormField-BDWkyFcl.js → FormField-ChfKYVSc.js} +3735 -2633
  5. package/dist-lib/{FormPanelBlock-mIvZ0IFE.js → FormPanelBlock-Cu2ATcpu.js} +71 -71
  6. package/dist-lib/{PhoneField-DZQc97Eo.js → PhoneField-CP13cgq1.js} +2867 -2870
  7. package/dist-lib/base/form/fields/EntityPickerField.d.ts.map +1 -1
  8. package/dist-lib/base/shell/BasicShell.js +1 -1
  9. package/dist-lib/base/shell/partials/EditablePanelProvider.d.ts.map +1 -1
  10. package/dist-lib/base/shell/partials/EditablePanelProvider.js +55 -54
  11. package/dist-lib/base/shell/partials/InlineEditablePanel.js +345 -343
  12. package/dist-lib/base/shell/partials/PageActionButton.js +2 -1
  13. package/dist-lib/base/utils/time.js +26 -26
  14. package/dist-lib/{button-CxyXN3nw.js → button-PJdZDEA8.js} +4 -4
  15. package/dist-lib/{calendar-BStHDcu3.js → calendar-CFrEYtPR.js} +22 -21
  16. package/dist-lib/{chevron-right-t5ALKicc.js → chevron-right-Dt7yZRj6.js} +1 -1
  17. package/dist-lib/chunks/{subpath-BhcZoWUz.js → subpath-BYl-9lKg.js} +1 -1
  18. package/dist-lib/{combobox-RfE54yDL.js → combobox-Dk1Mr_PH.js} +1055 -1058
  19. package/dist-lib/{dist-tanBwm1t.js → dist-CJ4YN5HQ.js} +5 -5
  20. package/dist-lib/{dist-BUns-jcX.js → dist-Cwj39GRS.js} +1 -1
  21. package/dist-lib/{dist-axU0pUop.js → dist-CyQnd0TP.js} +4 -4
  22. package/dist-lib/{dist-EdxoDTPy.js → dist-DUhG8dAI.js} +2 -2
  23. package/dist-lib/{document-validation-BSjTDZhG.js → document-validation-D1y_WEv5.js} +4 -4
  24. package/dist-lib/{floating-ui.react-dom-CNntavPo.js → floating-ui.react-dom-BASAHo_L.js} +3 -3
  25. package/dist-lib/i18n/I18nProvider.js +1 -1
  26. package/dist-lib/i18n/instance.js +1 -1
  27. package/dist-lib/i18n/register-strings.js +1 -1
  28. package/dist-lib/index.d.ts +1 -0
  29. package/dist-lib/index.d.ts.map +1 -1
  30. package/dist-lib/{input-DpHIBsEp.js → input-D1w5GXsE.js} +1 -1
  31. package/dist-lib/lib/host-pending.d.ts +32 -0
  32. package/dist-lib/lib/host-pending.d.ts.map +1 -0
  33. package/dist-lib/lib/host-pending.js +35 -0
  34. package/dist-lib/middag-react.js +21378 -7913
  35. package/dist-lib/{popover-CD3HfW3f.js → popover-7VNShhWQ.js} +6 -6
  36. package/dist-lib/primitives/reui/chart.js +12 -12
  37. package/dist-lib/primitives/reui/data-grid/data-grid-column-header.js +2 -2
  38. package/dist-lib/primitives/reui/data-grid/data-grid-pagination.js +28 -28
  39. package/dist-lib/primitives/reui/data-grid/data-grid-scroll-area.js +2 -2
  40. package/dist-lib/primitives/reui/data-grid/data-grid-table-dnd-rows.js +1 -1
  41. package/dist-lib/primitives/reui/data-grid/data-grid-table-dnd.js +2 -2
  42. package/dist-lib/primitives/reui/data-grid/data-grid-table-virtual.js +1 -1
  43. package/dist-lib/primitives/reui/data-grid/data-grid-table.js +5 -5
  44. package/dist-lib/primitives/reui/data-grid-pagination.js +28 -28
  45. package/dist-lib/primitives/reui/date-selector.js +5 -1
  46. package/dist-lib/primitives/reui/filters.js +24 -24
  47. package/dist-lib/primitives/reui/scrollspy.js +3 -1
  48. package/dist-lib/primitives/reui/stepper.js +23 -23
  49. package/dist-lib/primitives/reui/tree.js +7 -7
  50. package/dist-lib/{chunk-DeC0fbbY.js → rolldown-runtime-CWhphoD1.js} +1 -1
  51. package/dist-lib/{scroll-area-C_NPU_rI.js → scroll-area-CcAvV3Hh.js} +14 -8
  52. package/dist-lib/{skeleton-DXDJbb2L.js → skeleton-DP7igcN6.js} +1 -1
  53. package/dist-lib/{use-mobile-B18-3oTE.js → use-mobile-CqtqNcAV.js} +5 -5
  54. package/dist-lib/{utils-CpaZ5_iF.js → utils-DXlQmFY8.js} +2 -2
  55. package/package.json +4 -1
  56. package/dist-lib/MarkdownContent-DgypTiL-.js +0 -13507
  57. /package/dist-lib/{HugeiconsIcon-CKqc2W1S.js → HugeiconsIcon-C9KGSkIu.js} +0 -0
  58. /package/dist-lib/chunks/{subpath-B9beWkb2.js → subpath-AeMdleNB.js} +0 -0
  59. /package/dist-lib/chunks/{subpath-55YUOrvG.js → subpath-CJyJeTlw.js} +0 -0
  60. /package/dist-lib/chunks/{subpath--GXsYu-v.js → subpath-DjkzcIPp.js} +0 -0
  61. /package/dist-lib/chunks/{subpath-B30yU5uo.js → subpath-DoiyWIYV.js} +0 -0
  62. /package/dist-lib/chunks/{subpath-7b9-j7in.js → subpath-YbXSVoyF.js} +0 -0
  63. /package/dist-lib/chunks/{subpath-52vC0Fzu.js → subpath-oMCFwhdB.js} +0 -0
  64. /package/dist-lib/{dist-3F0-lo64.js → dist-BxFR7CYi.js} +0 -0
  65. /package/dist-lib/{useTranslation-D-tjJhTn.js → useTranslation-u1Lygbup.js} +0 -0
@@ -1,7 +1,7 @@
1
- import { c as e, i as t, o as n, p as r, u as i } from "./button-CxyXN3nw.js";
2
- import { t as a } from "./utils-CpaZ5_iF.js";
3
- import { n as o, t as s } from "./dist-BUns-jcX.js";
4
- import { a as c, c as l, d as u, f as d, i as f, l as p, n as m, r as h, s as g, t as _, u as v } from "./dist-EdxoDTPy.js";
1
+ import { c as e, i as t, o as n, p as r, u as i } from "./button-PJdZDEA8.js";
2
+ import { t as a } from "./utils-DXlQmFY8.js";
3
+ import { n as o, t as s } from "./dist-Cwj39GRS.js";
4
+ import { a as c, c as l, d as u, f as d, i as f, l as p, n as m, r as h, s as g, t as _, u as v } from "./dist-DUhG8dAI.js";
5
5
  import * as y from "react";
6
6
  import { jsx as b } from "react/jsx-runtime";
7
7
  import "react-dom";
@@ -135,8 +135,8 @@ var R = i("PopoverContent.RemoveScroll"), z = y.forwardRef((e, t) => {
135
135
  e.preventDefault(), s.current || i.triggerRef.current?.focus();
136
136
  }),
137
137
  onPointerDownOutside: n(e.onPointerDownOutside, (e) => {
138
- let t = e.detail.originalEvent, n = t.button === 0 && t.ctrlKey === !0;
139
- s.current = t.button === 2 || n;
138
+ let t = e.detail.originalEvent, n = t.button === 0 && t.ctrlKey === !0, r = t.button === 2 || n;
139
+ s.current = r;
140
140
  }, { checkForDefaultPrevented: !1 }),
141
141
  onFocusOutside: n(e.onFocusOutside, (e) => e.preventDefault(), { checkForDefaultPrevented: !1 })
142
142
  })
@@ -48,13 +48,13 @@ ${n.map(([e, n]) => {
48
48
  function p({ active: a, payload: o, className: s, indicator: c = "dot", hideLabel: u = !1, hideIndicator: d = !1, label: f, labelFormatter: p, labelClassName: m, formatter: h, color: _, nameKey: v, labelKey: y }) {
49
49
  let { config: b } = l(), x = t.useMemo(() => {
50
50
  if (u || !o?.length) return null;
51
- let [t] = o, n = g(b, t, `${y ?? t?.dataKey ?? t?.name ?? "value"}`), i = !y && typeof f == "string" ? b[f]?.label ?? f : n?.label;
51
+ let [t] = o, n = `${y ?? t?.dataKey ?? t?.name ?? "value"}`, i = g(b, t, n), a = !y && typeof f == "string" ? b[f]?.label ?? f : i?.label;
52
52
  return p ? /* @__PURE__ */ r("div", {
53
53
  className: e("font-medium", m),
54
- children: p(i, o)
55
- }) : i ? /* @__PURE__ */ r("div", {
54
+ children: p(a, o)
55
+ }) : a ? /* @__PURE__ */ r("div", {
56
56
  className: e("font-medium", m),
57
- children: i
57
+ children: a
58
58
  }) : null;
59
59
  }, [
60
60
  f,
@@ -72,10 +72,10 @@ function p({ active: a, payload: o, className: s, indicator: c = "dot", hideLabe
72
72
  children: [S ? null : x, /* @__PURE__ */ r("div", {
73
73
  className: "grid gap-1.5",
74
74
  children: o.filter((e) => e.type !== "none").map((t, a) => {
75
- let o = g(b, t, `${v ?? t.name ?? t.dataKey ?? "value"}`), s = _ ?? t.payload?.fill ?? t.color;
75
+ let o = `${v ?? t.name ?? t.dataKey ?? "value"}`, s = g(b, t, o), l = _ ?? t.payload?.fill ?? t.color;
76
76
  return /* @__PURE__ */ r("div", {
77
77
  className: e("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground", c === "dot" && "items-center"),
78
- children: h && t?.value !== void 0 && t.name ? h(t.value, t.name, t, a, t.payload) : /* @__PURE__ */ i(n, { children: [o?.icon ? /* @__PURE__ */ r(o.icon, {}) : !d && /* @__PURE__ */ r("div", {
78
+ children: h && t?.value !== void 0 && t.name ? h(t.value, t.name, t, a, t.payload) : /* @__PURE__ */ i(n, { children: [s?.icon ? /* @__PURE__ */ r(s.icon, {}) : !d && /* @__PURE__ */ r("div", {
79
79
  className: e("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", {
80
80
  "h-2.5 w-2.5": c === "dot",
81
81
  "w-1": c === "line",
@@ -83,8 +83,8 @@ function p({ active: a, payload: o, className: s, indicator: c = "dot", hideLabe
83
83
  "my-0.5": S && c === "dashed"
84
84
  }),
85
85
  style: {
86
- "--color-bg": s,
87
- "--color-border": s
86
+ "--color-bg": l,
87
+ "--color-border": l
88
88
  }
89
89
  }), /* @__PURE__ */ i("div", {
90
90
  className: e("flex flex-1 justify-between leading-none", S ? "items-end" : "items-center"),
@@ -92,7 +92,7 @@ function p({ active: a, payload: o, className: s, indicator: c = "dot", hideLabe
92
92
  className: "grid gap-1.5",
93
93
  children: [S ? x : null, /* @__PURE__ */ r("span", {
94
94
  className: "text-muted-foreground",
95
- children: o?.label ?? t.name
95
+ children: s?.label ?? t.name
96
96
  })]
97
97
  }), t.value != null && /* @__PURE__ */ r("span", {
98
98
  className: "font-mono font-medium text-foreground tabular-nums",
@@ -110,13 +110,13 @@ function h({ className: t, hideIcon: n = !1, payload: a, verticalAlign: o = "bot
110
110
  return a?.length ? /* @__PURE__ */ r("div", {
111
111
  className: e("flex items-center justify-center gap-4", o === "top" ? "pb-3" : "pt-3", t),
112
112
  children: a.filter((e) => e.type !== "none").map((t, a) => {
113
- let o = g(c, t, `${s ?? t.dataKey ?? "value"}`);
113
+ let o = `${s ?? t.dataKey ?? "value"}`, l = g(c, t, o);
114
114
  return /* @__PURE__ */ i("div", {
115
115
  className: e("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),
116
- children: [o?.icon && !n ? /* @__PURE__ */ r(o.icon, {}) : /* @__PURE__ */ r("div", {
116
+ children: [l?.icon && !n ? /* @__PURE__ */ r(l.icon, {}) : /* @__PURE__ */ r("div", {
117
117
  className: "h-2 w-2 shrink-0 rounded-[2px]",
118
118
  style: { backgroundColor: t.color }
119
- }), o?.label]
119
+ }), l?.label]
120
120
  }, a);
121
121
  })
122
122
  }) : null;
@@ -68,7 +68,7 @@ function A({ column: h, title: A, icon: j, className: M, filter: N, visibility:
68
68
  })
69
69
  ]
70
70
  }, "sort-desc")), t = !0), L.tableLayout?.columnsPinnable && G && (t && e.push(/* @__PURE__ */ _(u, {}, "sep-pin")), e.push(/* @__PURE__ */ v(c, {
71
- onClick: () => h.pin(U === "left" ? !1 : "left"),
71
+ onClick: () => h.pin(U !== "left" && "left"),
72
72
  children: [
73
73
  /* @__PURE__ */ _(y, {
74
74
  icon: S,
@@ -87,7 +87,7 @@ function A({ column: h, title: A, icon: j, className: M, filter: N, visibility:
87
87
  })
88
88
  ]
89
89
  }, "pin-left"), /* @__PURE__ */ v(c, {
90
- onClick: () => h.pin(U === "right" ? !1 : "right"),
90
+ onClick: () => h.pin(U !== "right" && "right"),
91
91
  children: [
92
92
  /* @__PURE__ */ _(y, {
93
93
  icon: w,
@@ -30,31 +30,7 @@ function h(h) {
30
30
  nextPageLabel: "Go to next page",
31
31
  ellipsisText: "...",
32
32
  ...h
33
- }, b = "size-7 p-0 text-sm", x = b + " rtl:transform rtl:rotate-180", S = g.getState().pagination.pageIndex, C = g.getState().pagination.pageSize, w = S * C + 1, T = Math.min((S + 1) * C, _), E = g.getPageCount(), D = y?.info ? y.info.replace("{from}", w.toString()).replace("{to}", T.toString()).replace("{count}", _.toString()) : `${w} - ${T} of ${_}`, O = y?.moreLimit || 5, k = Math.floor(S / O) * O, A = Math.min(k + O, E), j = () => {
34
- let n = [];
35
- for (let r = k; r < A; r++) n.push(/* @__PURE__ */ u(t, {
36
- size: "icon-sm",
37
- variant: "ghost",
38
- className: e(b, "text-muted-foreground", { "bg-accent text-accent-foreground": S === r }),
39
- onClick: () => {
40
- S !== r && g.setPageIndex(r);
41
- },
42
- children: r + 1
43
- }, r));
44
- return n;
45
- }, M = () => k > 0 ? /* @__PURE__ */ u(t, {
46
- size: "icon-sm",
47
- className: b,
48
- variant: "ghost",
49
- onClick: () => g.setPageIndex(k - 1),
50
- children: y.ellipsisText
51
- }) : null, N = () => A < E ? /* @__PURE__ */ u(t, {
52
- className: b,
53
- variant: "ghost",
54
- size: "icon-sm",
55
- onClick: () => g.setPageIndex(A),
56
- children: y.ellipsisText
57
- }) : null;
33
+ }, b = "size-7 p-0 text-sm", x = "size-7 p-0 text-sm rtl:transform rtl:rotate-180", S = g.getState().pagination.pageIndex, C = g.getState().pagination.pageSize, w = S * C + 1, T = Math.min((S + 1) * C, _), E = g.getPageCount(), D = y?.info ? y.info.replace("{from}", w.toString()).replace("{to}", T.toString()).replace("{count}", _.toString()) : `${w} - ${T} of ${_}`, O = y?.moreLimit || 5, k = Math.floor(S / O) * O, A = Math.min(k + O, E);
58
34
  return /* @__PURE__ */ d("div", {
59
35
  "data-slot": "data-grid-pagination",
60
36
  className: e("flex grow flex-col flex-wrap items-center justify-between gap-2.5 py-2.5 sm:flex-row sm:py-0", y?.className),
@@ -105,9 +81,33 @@ function h(h) {
105
81
  className: "size-4"
106
82
  })]
107
83
  }),
108
- M(),
109
- j(),
110
- N(),
84
+ k > 0 ? /* @__PURE__ */ u(t, {
85
+ size: "icon-sm",
86
+ className: b,
87
+ variant: "ghost",
88
+ onClick: () => g.setPageIndex(k - 1),
89
+ children: y.ellipsisText
90
+ }) : null,
91
+ (() => {
92
+ let n = [];
93
+ for (let r = k; r < A; r++) n.push(/* @__PURE__ */ u(t, {
94
+ size: "icon-sm",
95
+ variant: "ghost",
96
+ className: e(b, "text-muted-foreground", { "bg-accent text-accent-foreground": S === r }),
97
+ onClick: () => {
98
+ S !== r && g.setPageIndex(r);
99
+ },
100
+ children: r + 1
101
+ }, r));
102
+ return n;
103
+ })(),
104
+ A < E ? /* @__PURE__ */ u(t, {
105
+ className: b,
106
+ variant: "ghost",
107
+ size: "icon-sm",
108
+ onClick: () => g.setPageIndex(A),
109
+ children: y.ellipsisText
110
+ }) : null,
111
111
  /* @__PURE__ */ d(t, {
112
112
  size: "icon-sm",
113
113
  variant: "ghost",
@@ -120,8 +120,8 @@ function h({ children: h, className: g, orientation: _ = "both", ...v }) {
120
120
  let { thumbHeight: t } = C.current;
121
121
  if (e.target !== e.currentTarget) return;
122
122
  e.preventDefault(), e.stopPropagation();
123
- let n = e.currentTarget.getBoundingClientRect();
124
- N(e.clientY - n.top - t / 2);
123
+ let n = e.currentTarget.getBoundingClientRect(), r = e.clientY - n.top - t / 2;
124
+ N(r);
125
125
  };
126
126
  return /* @__PURE__ */ c("div", {
127
127
  ref: b,
@@ -42,7 +42,7 @@ function U({ row: e }) {
42
42
  transform: B.Transform.toString(t),
43
43
  transition: n,
44
44
  opacity: i ? .8 : 1,
45
- zIndex: i ? 1 : 0,
45
+ zIndex: +!!i,
46
46
  position: "relative",
47
47
  cursor: i ? "grabbing" : void 0
48
48
  };
@@ -22,7 +22,7 @@ function R({ header: n }) {
22
22
  cursor: s ? "grabbing" : void 0,
23
23
  whiteSpace: "nowrap",
24
24
  width: r.tableLayout?.columnsResizable ? `calc(var(--header-${n.id}-size) * 1px)` : n.column.getSize(),
25
- zIndex: s ? 1 : 0
25
+ zIndex: +!!s
26
26
  },
27
27
  dndRef: l,
28
28
  children: /* @__PURE__ */ C("div", {
@@ -62,7 +62,7 @@ function z({ cell: e }) {
62
62
  transition: s,
63
63
  cursor: r ? "grabbing" : void 0,
64
64
  width: n.tableLayout?.columnsResizable ? `calc(var(--col-${e.column.id}-size) * 1px)` : e.column.getSize(),
65
- zIndex: r ? 1 : 0
65
+ zIndex: +!!r
66
66
  },
67
67
  dndRef: i,
68
68
  children: E(e.column.columnDef.cell, e.getContext())
@@ -69,7 +69,7 @@ function D({ columnCount: e, topRows: t, centerRows: r, bottomRows: i, virtualIt
69
69
  }
70
70
  var O = h(D, (e, t) => !!t.table.getState().columnSizingInfo.isResizingColumn);
71
71
  function k({ height: e, estimateSize: n = 48, overscan: a = 10, footerContent: d, renderHeader: h = !0, onFetchMore: b, isFetchingMore: T = !1, hasMore: E, fetchMoreOffset: D = 0, virtualizerOptions: k }) {
72
- let { table: A, props: j } = t(), { topRows: ee, centerRows: M, bottomRows: N } = m(A, j.tableLayout?.rowsPinnable), P = A.getVisibleFlatColumns().length + (j.tableLayout?.columnsResizable ? 1 : 0), F = typeof b == "function", [I, L] = y({
72
+ let { table: A, props: j } = t(), { topRows: ee, centerRows: M, bottomRows: N } = m(A, j.tableLayout?.rowsPinnable), P = A.getVisibleFlatColumns().length + +!!j.tableLayout?.columnsResizable, F = typeof b == "function", [I, L] = y({
73
73
  containerElement: null,
74
74
  scrollElement: null
75
75
  }), { estimateSize: R, getItemKey: z, getScrollElement: B, measureElement: V, overscan: H, ...U } = k ?? {}, W = k?.enabled !== !1, G = j.fetchingMoreMessage || j.loadingMessage || "Loading...", K = j.allRowsLoadedMessage || "All records loaded", q = g((e) => {
@@ -33,7 +33,7 @@ function v(e) {
33
33
  right: t === "right" ? `${e.getAfter("right")}px` : void 0,
34
34
  position: t ? "sticky" : "relative",
35
35
  width: e.getSize(),
36
- zIndex: t ? 1 : 0
36
+ zIndex: +!!t
37
37
  };
38
38
  }
39
39
  function y(e, t) {
@@ -276,12 +276,12 @@ function F({ viewportElement: e }) {
276
276
  if (!t.tableLayout?.columnsResizable || o !== "onEnd" || !a) return null;
277
277
  let s = r.getFlatHeaders().find((e) => e.column.id === a || e.id === a);
278
278
  if (!s) return null;
279
- let c = i.deltaOffset ?? 0, l = e?.querySelector("[data-slot=\"data-grid-table\"] thead")?.getBoundingClientRect().height ?? 0, u = typeof i.startOffset == "number" && e ? i.startOffset - e.getBoundingClientRect().left : s.getStart() + s.getSize();
279
+ let c = i.deltaOffset ?? 0, l = e?.querySelector("[data-slot=\"data-grid-table\"] thead")?.getBoundingClientRect().height ?? 0;
280
280
  return /* @__PURE__ */ f("div", {
281
281
  "aria-hidden": "true",
282
282
  className: "pointer-events-none absolute inset-y-0 z-20",
283
283
  style: {
284
- left: u,
284
+ left: typeof i.startOffset == "number" && e ? i.startOffset - e.getBoundingClientRect().left : s.getStart() + s.getSize(),
285
285
  transform: `translateX(${c}px)`
286
286
  },
287
287
  children: [/* @__PURE__ */ d("div", { className: "bg-primary/85 absolute inset-y-0 left-0 w-px -translate-x-1/2" }), /* @__PURE__ */ d("div", {
@@ -363,7 +363,7 @@ function W({ row: t }) {
363
363
  return /* @__PURE__ */ d("tr", {
364
364
  className: e(r.tableLayout?.rowBorder && "[&:not(:last-child)>td]:border-b"),
365
365
  children: /* @__PURE__ */ d("td", {
366
- colSpan: t.getVisibleCells().length + (r.tableLayout?.columnsResizable ? 1 : 0),
366
+ colSpan: t.getVisibleCells().length + +!!r.tableLayout?.columnsResizable,
367
367
  children: i.getAllColumns().find((e) => e.columnDef.meta?.expandedContent)?.columnDef.meta?.expandedContent?.(t.original)
368
368
  })
369
369
  });
@@ -396,7 +396,7 @@ function K({ row: e, pinnedBoundary: t, rowRef: n }) {
396
396
  }), e.getIsExpanded() && /* @__PURE__ */ d(W, { row: e })] });
397
397
  }
398
398
  function q() {
399
- let { table: e, props: t } = n(), r = e.getVisibleLeafColumns().length + (t.tableLayout?.columnsResizable ? 1 : 0);
399
+ let { table: e, props: t } = n(), r = e.getVisibleLeafColumns().length + +!!t.tableLayout?.columnsResizable;
400
400
  return /* @__PURE__ */ d("tr", { children: /* @__PURE__ */ d("td", {
401
401
  colSpan: Math.max(r, 1),
402
402
  className: "text-muted-foreground text-sm py-6 text-center",
@@ -29,31 +29,7 @@ function h(h) {
29
29
  nextPageLabel: "Go to next page",
30
30
  ellipsisText: "...",
31
31
  ...h
32
- }, b = "size-7 p-0 text-sm", x = b + " rtl:transform rtl:rotate-180", S = g.getState().pagination.pageIndex, C = g.getState().pagination.pageSize, w = S * C + 1, T = Math.min((S + 1) * C, _), E = g.getPageCount(), D = y?.info ? y.info.replace("{from}", w.toString()).replace("{to}", T.toString()).replace("{count}", _.toString()) : `${w} - ${T} of ${_}`, O = y?.moreLimit || 5, k = Math.floor(S / O) * O, A = Math.min(k + O, E), j = () => {
33
- let n = [];
34
- for (let r = k; r < A; r++) n.push(/* @__PURE__ */ u(t, {
35
- size: "icon-sm",
36
- variant: "ghost",
37
- className: e(b, "text-muted-foreground", { "bg-accent text-accent-foreground": S === r }),
38
- onClick: () => {
39
- S !== r && g.setPageIndex(r);
40
- },
41
- children: r + 1
42
- }, r));
43
- return n;
44
- }, M = () => k > 0 ? /* @__PURE__ */ u(t, {
45
- size: "icon-sm",
46
- className: b,
47
- variant: "ghost",
48
- onClick: () => g.setPageIndex(k - 1),
49
- children: y.ellipsisText
50
- }) : null, N = () => A < E ? /* @__PURE__ */ u(t, {
51
- className: b,
52
- variant: "ghost",
53
- size: "icon-sm",
54
- onClick: () => g.setPageIndex(A),
55
- children: y.ellipsisText
56
- }) : null;
32
+ }, b = "size-7 p-0 text-sm", x = "size-7 p-0 text-sm rtl:transform rtl:rotate-180", S = g.getState().pagination.pageIndex, C = g.getState().pagination.pageSize, w = S * C + 1, T = Math.min((S + 1) * C, _), E = g.getPageCount(), D = y?.info ? y.info.replace("{from}", w.toString()).replace("{to}", T.toString()).replace("{count}", _.toString()) : `${w} - ${T} of ${_}`, O = y?.moreLimit || 5, k = Math.floor(S / O) * O, A = Math.min(k + O, E);
57
33
  return /* @__PURE__ */ d("div", {
58
34
  "data-slot": "data-grid-pagination",
59
35
  className: e("flex grow flex-col flex-wrap items-center justify-between gap-2.5 py-2.5 sm:flex-row sm:py-0", y?.className),
@@ -104,9 +80,33 @@ function h(h) {
104
80
  className: "size-4"
105
81
  })]
106
82
  }),
107
- M(),
108
- j(),
109
- N(),
83
+ k > 0 ? /* @__PURE__ */ u(t, {
84
+ size: "icon-sm",
85
+ className: b,
86
+ variant: "ghost",
87
+ onClick: () => g.setPageIndex(k - 1),
88
+ children: y.ellipsisText
89
+ }) : null,
90
+ (() => {
91
+ let n = [];
92
+ for (let r = k; r < A; r++) n.push(/* @__PURE__ */ u(t, {
93
+ size: "icon-sm",
94
+ variant: "ghost",
95
+ className: e(b, "text-muted-foreground", { "bg-accent text-accent-foreground": S === r }),
96
+ onClick: () => {
97
+ S !== r && g.setPageIndex(r);
98
+ },
99
+ children: r + 1
100
+ }, r));
101
+ return n;
102
+ })(),
103
+ A < E ? /* @__PURE__ */ u(t, {
104
+ className: b,
105
+ variant: "ghost",
106
+ size: "icon-sm",
107
+ onClick: () => g.setPageIndex(A),
108
+ children: y.ellipsisText
109
+ }) : null,
110
110
  /* @__PURE__ */ d(t, {
111
111
  size: "icon-sm",
112
112
  variant: "ghost",
@@ -181,7 +181,11 @@ function N({ value: e, onChange: t, defaultPeriodType: n = "day", defaultFilterT
181
181
  return n >= r && n <= i;
182
182
  }, [I, R]), q = d((e) => !I || !R ? !1 : e >= I.year && e <= R.year, [I, R]);
183
183
  return p(() => {
184
- e && (y(e.period || g), x(i ?? e.operator ?? r), C(e.startDate), T(e.endDate), k(e.year), j(e.month), N(e.quarter), F(e.halfYear), L(e.rangeStart), z(e.rangeEnd));
184
+ if (e) {
185
+ y(e.period || g);
186
+ let t = i ?? e.operator ?? r;
187
+ x(t), C(e.startDate), T(e.endDate), k(e.year), j(e.month), N(e.quarter), F(e.halfYear), L(e.rangeStart), z(e.rangeEnd);
188
+ }
185
189
  }, [
186
190
  e,
187
191
  g,
@@ -109,28 +109,7 @@ function ie({ field: t, onBlur: n, onKeyDown: r, className: i, ...a }) {
109
109
  return () => clearTimeout(e);
110
110
  }
111
111
  }, [a.autoFocus]);
112
- let _ = (e, t) => !t || !e ? !0 : new RegExp(t).test(e), v = () => d.i18n.validation.invalid, y = (e) => {
113
- let r = e.target.value, i = t?.pattern || a.pattern;
114
- if (r && (i || t?.validation)) {
115
- let e = !0, n = "";
116
- if (t?.validation) {
117
- let i = t.validation(r);
118
- typeof i == "boolean" ? e = i : (e = i.valid, n = i.message || "");
119
- } else i && (e = _(r, i));
120
- p(e), h(e ? "" : n || v());
121
- } else p(!0), h("");
122
- n?.(e);
123
- }, b = (e) => {
124
- !f && ![
125
- "Tab",
126
- "Escape",
127
- "Enter",
128
- "ArrowUp",
129
- "ArrowDown",
130
- "ArrowLeft",
131
- "ArrowRight"
132
- ].includes(e.key) && (p(!0), h("")), r?.(e);
133
- };
112
+ let _ = (e, t) => !t || !e || new RegExp(t).test(e), v = () => d.i18n.validation.invalid;
134
113
  return /* @__PURE__ */ F(o, {
135
114
  className: e("w-36", d.size == "sm" && "h-8!", d.size == "default" && "h-9!", d.size == "lg" && "h-10!", i),
136
115
  children: [
@@ -139,8 +118,29 @@ function ie({ field: t, onBlur: n, onKeyDown: r, className: i, ...a }) {
139
118
  ref: g,
140
119
  "aria-invalid": !f,
141
120
  "aria-describedby": !f && m ? `${t?.key || "input"}-error` : void 0,
142
- onBlur: y,
143
- onKeyDown: b,
121
+ onBlur: (e) => {
122
+ let r = e.target.value, i = t?.pattern || a.pattern;
123
+ if (r && (i || t?.validation)) {
124
+ let e = !0, n = "";
125
+ if (t?.validation) {
126
+ let i = t.validation(r);
127
+ typeof i == "boolean" ? e = i : (e = i.valid, n = i.message || "");
128
+ } else i && (e = _(r, i));
129
+ p(e), h(e ? "" : n || v());
130
+ } else p(!0), h("");
131
+ n?.(e);
132
+ },
133
+ onKeyDown: (e) => {
134
+ !f && ![
135
+ "Tab",
136
+ "Escape",
137
+ "Enter",
138
+ "ArrowUp",
139
+ "ArrowDown",
140
+ "ArrowLeft",
141
+ "ArrowRight"
142
+ ].includes(e.key) && (p(!0), h("")), r?.(e);
143
+ },
144
144
  className: e(d.size == "sm" && "h-8! text-xs", d.size == "default" && "h-9!", d.size == "lg" && "h-10!"),
145
145
  ...a
146
146
  }),
@@ -28,7 +28,9 @@ function i({ children: i, targetRef: a, onUpdate: o, className: s, offset: c = 0
28
28
  o.offsetTop - s <= n && d < i && (i = d, r = t);
29
29
  });
30
30
  let o = e.scrollHeight;
31
- n + e.clientHeight >= o - 2 && (r = p.current.length - 1), h(p.current[r]?.getAttribute(`data-${u}-anchor`) || null);
31
+ n + e.clientHeight >= o - 2 && (r = p.current.length - 1);
32
+ let s = p.current[r]?.getAttribute(`data-${u}-anchor`) || null;
33
+ h(s);
32
34
  }, [
33
35
  p,
34
36
  a,
@@ -77,28 +77,7 @@ function _({ asChild: t = !1, className: n, children: r, tabIndex: i, ...a }) {
77
77
  o(() => {
78
78
  D.current && g(D.current);
79
79
  }, [D.current]);
80
- let O = s(() => _.findIndex((e) => e === D.current), [_, D.current]), k = (e) => {
81
- switch (e.key) {
82
- case "ArrowRight":
83
- case "ArrowDown":
84
- e.preventDefault(), O !== -1 && v && v(O);
85
- break;
86
- case "ArrowLeft":
87
- case "ArrowUp":
88
- e.preventDefault(), O !== -1 && y && y(O);
89
- break;
90
- case "Home":
91
- e.preventDefault(), b && b();
92
- break;
93
- case "End":
94
- e.preventDefault(), x && x();
95
- break;
96
- case "Enter":
97
- case " ":
98
- e.preventDefault(), f(S);
99
- break;
100
- }
101
- };
80
+ let O = s(() => _.findIndex((e) => e === D.current), [_, D.current]);
102
81
  return t ? /* @__PURE__ */ u("span", {
103
82
  "data-slot": "stepper-trigger",
104
83
  "data-state": l,
@@ -116,7 +95,28 @@ function _({ asChild: t = !1, className: n, children: r, tabIndex: i, ...a }) {
116
95
  "data-loading": d,
117
96
  className: e("focus-visible:border-ring focus-visible:ring-ring/50 inline-flex cursor-pointer items-center outline-none focus-visible:z-10 focus-visible:ring-3 disabled:pointer-events-none disabled:opacity-60", "gap-3 rounded-full", n),
118
97
  onClick: () => f(S),
119
- onKeyDown: k,
98
+ onKeyDown: (e) => {
99
+ switch (e.key) {
100
+ case "ArrowRight":
101
+ case "ArrowDown":
102
+ e.preventDefault(), O !== -1 && v && v(O);
103
+ break;
104
+ case "ArrowLeft":
105
+ case "ArrowUp":
106
+ e.preventDefault(), O !== -1 && y && y(O);
107
+ break;
108
+ case "Home":
109
+ e.preventDefault(), b && b();
110
+ break;
111
+ case "End":
112
+ e.preventDefault(), x && x();
113
+ break;
114
+ case "Enter":
115
+ case " ":
116
+ e.preventDefault(), f(S);
117
+ break;
118
+ }
119
+ },
120
120
  disabled: C,
121
121
  ...a,
122
122
  children: r
@@ -42,11 +42,11 @@ function m({ item: t, className: n, asChild: r = !1, children: o, ...s }) {
42
42
  children: o,
43
43
  ...u
44
44
  }, h = {
45
- ...p,
46
- "--tree-padding": `${t.getItemMeta().level * l}px`
47
- }, g = {
48
45
  "data-slot": "tree-item",
49
- style: h,
46
+ style: {
47
+ ...p,
48
+ "--tree-padding": `${t.getItemMeta().level * l}px`
49
+ },
50
50
  className: e("z-10 ps-(--tree-padding) outline-hidden select-none not-last:pb-0.5 focus:z-20 data-[disabled]:pointer-events-none data-[disabled]:opacity-50", n),
51
51
  "data-focus": typeof t.isFocused == "function" ? t.isFocused() || !1 : void 0,
52
52
  "data-folder": typeof t.isFolder == "function" ? t.isFolder() || !1 : void 0,
@@ -54,14 +54,14 @@ function m({ item: t, className: n, asChild: r = !1, children: o, ...s }) {
54
54
  "data-drag-target": typeof t.isDragTarget == "function" ? t.isDragTarget() || !1 : void 0,
55
55
  "data-search-match": typeof t.isMatchingSearch == "function" ? t.isMatchingSearch() || !1 : void 0,
56
56
  "aria-expanded": t.isExpanded()
57
- }, _ = r ? i.Root : "button";
57
+ }, g = r ? i.Root : "button";
58
58
  return /* @__PURE__ */ a(d.Provider, {
59
59
  value: {
60
60
  ...c,
61
61
  currentItem: t
62
62
  },
63
- children: /* @__PURE__ */ a(_, {
64
- ...g,
63
+ children: /* @__PURE__ */ a(g, {
64
+ ...h,
65
65
  ...m,
66
66
  children: o
67
67
  })
@@ -1,7 +1,7 @@
1
1
  import * as __cjs_react from "react";
2
2
  import * as __cjs_react_dom from "react-dom";
3
3
  //#region \0rolldown/runtime.js
4
- var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), s = (e, n) => {
4
+ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
5
5
  let r = {};
6
6
  for (var i in e) t(r, i, {
7
7
  get: e[i],
@@ -1,6 +1,6 @@
1
- import { a as e, c as t, i as n, o as r, p as i, r as a, u as o } from "./button-CxyXN3nw.js";
2
- import { t as s } from "./utils-CpaZ5_iF.js";
3
- import { n as c, t as l } from "./dist-3F0-lo64.js";
1
+ import { a as e, c as t, i as n, o as r, p as i, r as a, u as o } from "./button-PJdZDEA8.js";
2
+ import { t as s } from "./utils-DXlQmFY8.js";
3
+ import { n as c, t as l } from "./dist-BxFR7CYi.js";
4
4
  import * as u from "react";
5
5
  import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
6
6
  import "react-dom";
@@ -343,10 +343,13 @@ var E = u.forwardRef((e, t) => {
343
343
  }), [M, N] = _(w), P = u.forwardRef((e, t) => {
344
344
  let { __scopeScrollArea: n, sizes: o, hasThumb: s, onThumbChange: c, onThumbPointerUp: l, onThumbPointerDown: d, onThumbPositionChange: p, onDragScroll: h, onWheelScroll: g, onResize: _, ...v } = e, y = b(w, n), [x, S] = u.useState(null), C = i(t, (e) => S(e)), T = u.useRef(null), E = u.useRef(""), D = y.viewport, O = o.content - o.viewport, k = a(g), A = a(p), j = Y(_, 10);
345
345
  function N(e) {
346
- T.current && h({
347
- x: e.clientX - T.current.left,
348
- y: e.clientY - T.current.top
349
- });
346
+ if (T.current) {
347
+ let t = e.clientX - T.current.left, n = e.clientY - T.current.top;
348
+ h({
349
+ x: t,
350
+ y: n
351
+ });
352
+ }
350
353
  }
351
354
  return u.useEffect(() => {
352
355
  let e = (e) => {
@@ -401,7 +404,10 @@ var E = u.forwardRef((e, t) => {
401
404
  let e = s.viewport;
402
405
  if (e) {
403
406
  let t = () => {
404
- h(), p.current || (p.current = J(e, l), l());
407
+ if (h(), !p.current) {
408
+ let t = J(e, l);
409
+ p.current = t, l();
410
+ }
405
411
  };
406
412
  return l(), e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
407
413
  }
@@ -1,4 +1,4 @@
1
- import { t as e } from "./utils-CpaZ5_iF.js";
1
+ import { t as e } from "./utils-DXlQmFY8.js";
2
2
  import { jsx as t } from "react/jsx-runtime";
3
3
  //#region src/primitives/reui/skeleton.tsx
4
4
  function n({ className: n, ...r }) {
@@ -1,8 +1,8 @@
1
- import { c as e, i as t, m as n, o as r, u as i } from "./button-CxyXN3nw.js";
2
- import { t as a } from "./utils-CpaZ5_iF.js";
3
- import { n as o, r as s, t as c } from "./dist-tanBwm1t.js";
4
- import { n as l, t as u } from "./dist-BUns-jcX.js";
5
- import { n as d } from "./dist-3F0-lo64.js";
1
+ import { c as e, i as t, m as n, o as r, u as i } from "./button-PJdZDEA8.js";
2
+ import { t as a } from "./utils-DXlQmFY8.js";
3
+ import { n as o, r as s, t as c } from "./dist-CJ4YN5HQ.js";
4
+ import { n as l, t as u } from "./dist-Cwj39GRS.js";
5
+ import { n as d } from "./dist-BxFR7CYi.js";
6
6
  import * as f from "react";
7
7
  import { useSyncExternalStore as p } from "react";
8
8
  import { jsx as m } from "react/jsx-runtime";
@@ -32,7 +32,7 @@ var n = (e, t) => {
32
32
  getClassGroupId: (e) => {
33
33
  if (e.startsWith("[") && e.endsWith("]")) return u(e);
34
34
  let n = e.split(a);
35
- return l(n, n[0] === "" && n.length > 1 ? 1 : 0, t);
35
+ return l(n, +(n[0] === "" && n.length > 1), t);
36
36
  },
37
37
  getConflictingClassGroupIds: (e, t) => {
38
38
  if (t) {
@@ -239,7 +239,7 @@ var n = (e, t) => {
239
239
  }, X = (e, t, n = !1) => {
240
240
  let r = M.exec(e);
241
241
  return r ? r[1] ? t(r[1]) : n : !1;
242
- }, Z = (e) => e === "position" || e === "percentage", Q = (e) => e === "image" || e === "url", $ = (e) => e === "length" || e === "size" || e === "bg-size", Se = (e) => e === "length", Ce = (e) => e === "number", we = (e) => e === "family-name", Te = (e) => e === "number" || e === "weight", Ee = (e) => e === "shadow", De = /* @__PURE__ */ O(() => {
242
+ }, Z = (e) => e === "position" || e === "percentage", Q = (e) => e === "image" || e === "url", $ = (e) => e === "length" || e === "size" || e === "bg-size", Se = (e) => e === "length", Ce = (e) => e === "number", we = (e) => e === "family-name", Te = (e) => e === "number" || e === "weight", Ee = (e) => e === "shadow", De = /*#__PURE__*/ O(() => {
243
243
  let e = A("color"), t = A("font"), n = A("text"), r = A("font-weight"), i = A("tracking"), a = A("leading"), o = A("breakpoint"), s = A("container"), c = A("spacing"), l = A("radius"), u = A("shadow"), ee = A("inset-shadow"), d = A("text-shadow"), f = A("drop-shadow"), p = A("blur"), m = A("perspective"), h = A("aspect"), g = A("ease"), _ = A("animate"), v = () => [
244
244
  "auto",
245
245
  "avoid",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middag-io/react",
3
- "version": "0.42.0",
3
+ "version": "0.43.0",
4
4
  "type": "module",
5
5
  "description": "MIDDAG shared React UI library for Moodle, WordPress and other Inertia hosts",
6
6
  "license": "Apache-2.0",
@@ -78,6 +78,9 @@
78
78
  "react": "^19.0.0",
79
79
  "react-dom": "^19.0.0"
80
80
  },
81
+ "overrides": {
82
+ "happy-dom": "^21.0.4"
83
+ },
81
84
  "homepage": "https://ui-docs.middag.io",
82
85
  "bugs": {
83
86
  "url": "https://github.com/middag-io/middag-react/issues"