@middag-io/react 0.24.0 → 0.25.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 (102) hide show
  1. package/README.md +51 -34
  2. package/dist-lib/DateField-CZ13qKol.js +121 -0
  3. package/dist-lib/DateRangeField-CvU7wiyr.js +663 -0
  4. package/dist-lib/DocumentField-DHcXGh45.js +221 -0
  5. package/dist-lib/FormPanelBlock-DGndU2Rh.js +1735 -0
  6. package/dist-lib/FormSection-B_uXjngJ.js +8083 -0
  7. package/dist-lib/HugeiconsIcon-CKqc2W1S.js +1321 -0
  8. package/dist-lib/{MarkdownContent-DhffsdY-.js → MarkdownContent-B1aSl1Nl.js} +1553 -4815
  9. package/dist-lib/MarkdownContent-ZobA2Gtk.js +2 -0
  10. package/dist-lib/PhoneField-Boqhwr3y.js +18584 -0
  11. package/dist-lib/app/LazyBlock.d.ts +19 -11
  12. package/dist-lib/app/LazyBlock.d.ts.map +1 -1
  13. package/dist-lib/app/providers/i18n-defaults.d.ts.map +1 -1
  14. package/dist-lib/app/providers/inertia-error-reporter.d.ts +26 -0
  15. package/dist-lib/app/providers/inertia-error-reporter.d.ts.map +1 -0
  16. package/dist-lib/app/providers/locales/pt-BR.d.ts.map +1 -1
  17. package/dist-lib/app/register-defaults.d.ts +6 -6
  18. package/dist-lib/app/register-defaults.d.ts.map +1 -1
  19. package/dist-lib/base/blocks/DenseTableBlock.d.ts.map +1 -1
  20. package/dist-lib/base/blocks/FormPanelBlock.d.ts +20 -0
  21. package/dist-lib/base/blocks/FormPanelBlock.d.ts.map +1 -0
  22. package/dist-lib/base/blocks/FormPanelBlock.lazy.d.ts +13 -0
  23. package/dist-lib/base/blocks/FormPanelBlock.lazy.d.ts.map +1 -0
  24. package/dist-lib/base/form/FormField.d.ts.map +1 -1
  25. package/dist-lib/base/form/fields/NativeSelectField.d.ts +23 -0
  26. package/dist-lib/base/form/fields/NativeSelectField.d.ts.map +1 -0
  27. package/dist-lib/base/form/fields/OtpField.d.ts +22 -0
  28. package/dist-lib/base/form/fields/OtpField.d.ts.map +1 -0
  29. package/dist-lib/base/form/fields/SliderField.d.ts +24 -0
  30. package/dist-lib/base/form/fields/SliderField.d.ts.map +1 -0
  31. package/dist-lib/base/form/fields/register-default-fields.d.ts.map +1 -1
  32. package/dist-lib/base/form/form-schema-builder.d.ts +27 -0
  33. package/dist-lib/base/form/form-schema-builder.d.ts.map +1 -0
  34. package/dist-lib/base/hooks/useLazyTabs.d.ts +6 -0
  35. package/dist-lib/base/hooks/useLazyTabs.d.ts.map +1 -1
  36. package/dist-lib/base/hooks/usePolling.d.ts +15 -6
  37. package/dist-lib/base/hooks/usePolling.d.ts.map +1 -1
  38. package/dist-lib/base/hooks/useRemember.d.ts +31 -0
  39. package/dist-lib/base/hooks/useRemember.d.ts.map +1 -0
  40. package/dist-lib/base/partials/ActionBar/index.d.ts.map +1 -1
  41. package/dist-lib/base/partials/DataTable/cell-registry.d.ts +2 -0
  42. package/dist-lib/base/partials/DataTable/cell-registry.d.ts.map +1 -1
  43. package/dist-lib/base/partials/DataTable/cell-renderers.d.ts +2 -1
  44. package/dist-lib/base/partials/DataTable/cell-renderers.d.ts.map +1 -1
  45. package/dist-lib/base/partials/DataTable/index.d.ts +1 -1
  46. package/dist-lib/base/partials/DataTable/index.d.ts.map +1 -1
  47. package/dist-lib/base/partials/DataTable/register-default-cells.d.ts.map +1 -1
  48. package/dist-lib/base/partials/DataTable/types.d.ts +12 -2
  49. package/dist-lib/base/partials/DataTable/types.d.ts.map +1 -1
  50. package/dist-lib/base/partials/EntityItem/index.d.ts +48 -0
  51. package/dist-lib/base/partials/EntityItem/index.d.ts.map +1 -0
  52. package/dist-lib/base/partials/QuickRecordSheet/index.d.ts +24 -0
  53. package/dist-lib/base/partials/QuickRecordSheet/index.d.ts.map +1 -0
  54. package/dist-lib/base/partials/ResizableSidebar/index.d.ts +27 -0
  55. package/dist-lib/base/partials/ResizableSidebar/index.d.ts.map +1 -0
  56. package/dist-lib/base/partials/TableOfContents/index.d.ts +30 -0
  57. package/dist-lib/base/partials/TableOfContents/index.d.ts.map +1 -0
  58. package/dist-lib/base/partials/TimelineList/index.d.ts.map +1 -1
  59. package/dist-lib/base/partials/index.d.ts +4 -0
  60. package/dist-lib/base/partials/index.d.ts.map +1 -1
  61. package/dist-lib/base/shell/BasicShell.d.ts +4 -4
  62. package/dist-lib/base/shell/BasicShell.d.ts.map +1 -1
  63. package/dist-lib/base/shell/ImmersiveShell.d.ts.map +1 -1
  64. package/dist-lib/base/shell/partials/PageActionButton.d.ts.map +1 -1
  65. package/dist-lib/base/utils/time.d.ts +25 -13
  66. package/dist-lib/base/utils/time.d.ts.map +1 -1
  67. package/dist-lib/button-Ba1PcsOx.js +357 -0
  68. package/dist-lib/calendar-DnlbmjNu.js +4502 -0
  69. package/dist-lib/chevron-right-Casn6MFU.js +7 -0
  70. package/dist-lib/combobox-BbYGWCFO.js +5480 -0
  71. package/dist-lib/contracts/block-data/actions.d.ts +6 -6
  72. package/dist-lib/contracts/block-data/actions.d.ts.map +1 -1
  73. package/dist-lib/contracts/block-data/data-display.d.ts +16 -1
  74. package/dist-lib/contracts/block-data/data-display.d.ts.map +1 -1
  75. package/dist-lib/contracts/block-data/form.d.ts +62 -3
  76. package/dist-lib/contracts/block-data/form.d.ts.map +1 -1
  77. package/dist-lib/contracts/block-data/interactive.d.ts +2 -2
  78. package/dist-lib/contracts/generated/contract-schema.d.ts +1 -1
  79. package/dist-lib/contracts/generated/contract-types.d.ts +4 -2
  80. package/dist-lib/contracts/generated/contract-types.d.ts.map +1 -1
  81. package/dist-lib/contracts/generated/index.d.ts +1 -1
  82. package/dist-lib/contracts/page-contract-schema.d.ts +2 -2
  83. package/dist-lib/contracts/page-contract.d.ts +3 -3
  84. package/dist-lib/dist-7c0PXlrb.js +1195 -0
  85. package/dist-lib/dist-B-MyAb3x.js +54 -0
  86. package/dist-lib/dist-CmB86BdM.js +15 -0
  87. package/dist-lib/dist-DuO9WodV.js +234 -0
  88. package/dist-lib/document-validation-YgxIqb8k.js +1249 -0
  89. package/dist-lib/floating-ui.react-dom-BnOzLaz1.js +1089 -0
  90. package/dist-lib/i18n-D362dzBp.js +336 -0
  91. package/dist-lib/index.d.ts +4 -1
  92. package/dist-lib/index.d.ts.map +1 -1
  93. package/dist-lib/input-CdUVNe54.js +14 -0
  94. package/dist-lib/middag-react.css +1 -1
  95. package/dist-lib/middag-react.js +9818 -23633
  96. package/dist-lib/popover-Bxsp1hlN.js +241 -0
  97. package/dist-lib/scroll-area-B9TZ05bl.js +556 -0
  98. package/dist-lib/skeleton-HpnbVVji.js +12 -0
  99. package/dist-lib/use-mobile-Kp3Dy8mh.js +204 -0
  100. package/dist-lib/utils-Yj2czlvU.js +1713 -0
  101. package/package.json +1 -1
  102. /package/dist-lib/{dist-CK9PErDU.js → dist-axU0pUop.js} +0 -0
@@ -0,0 +1,54 @@
1
+ import { a as e } from "./button-Ba1PcsOx.js";
2
+ import * as t from "react";
3
+ //#region node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
4
+ var n = t.useInsertionEffect || e;
5
+ function r({ prop: e, defaultProp: n, onChange: r = () => {}, caller: o }) {
6
+ let [s, c, l] = i({
7
+ defaultProp: n,
8
+ onChange: r
9
+ }), u = e !== void 0, d = u ? e : s;
10
+ {
11
+ let n = t.useRef(e !== void 0);
12
+ t.useEffect(() => {
13
+ let e = n.current;
14
+ e !== u && console.warn(`${o} is changing from ${e ? "controlled" : "uncontrolled"} to ${u ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`), n.current = u;
15
+ }, [u, o]);
16
+ }
17
+ return [d, t.useCallback((t) => {
18
+ if (u) {
19
+ let n = a(t) ? t(e) : t;
20
+ n !== e && l.current?.(n);
21
+ } else c(t);
22
+ }, [
23
+ u,
24
+ e,
25
+ c,
26
+ l
27
+ ])];
28
+ }
29
+ function i({ defaultProp: e, onChange: r }) {
30
+ let [i, a] = t.useState(e), o = t.useRef(i), s = t.useRef(r);
31
+ return n(() => {
32
+ s.current = r;
33
+ }, [r]), t.useEffect(() => {
34
+ o.current !== i && (s.current?.(i), o.current = i);
35
+ }, [i, o]), [
36
+ i,
37
+ a,
38
+ s
39
+ ];
40
+ }
41
+ function a(e) {
42
+ return typeof e == "function";
43
+ }
44
+ //#endregion
45
+ //#region node_modules/@radix-ui/react-id/dist/index.mjs
46
+ var o = t.useId || (() => void 0), s = 0;
47
+ function c(n) {
48
+ let [r, i] = t.useState(o());
49
+ return e(() => {
50
+ n || i((e) => e ?? String(s++));
51
+ }, [n]), n || (r ? `radix-${r}` : "");
52
+ }
53
+ //#endregion
54
+ export { r as n, c as t };
@@ -0,0 +1,15 @@
1
+ import * as e from "react";
2
+ import "react/jsx-runtime";
3
+ //#region node_modules/@radix-ui/react-direction/dist/index.mjs
4
+ var t = e.createContext(void 0);
5
+ function n(n) {
6
+ let r = e.useContext(t);
7
+ return n || r || "ltr";
8
+ }
9
+ //#endregion
10
+ //#region node_modules/@radix-ui/number/dist/index.mjs
11
+ function r(e, [t, n]) {
12
+ return Math.min(n, Math.max(t, e));
13
+ }
14
+ //#endregion
15
+ export { n, r as t };
@@ -0,0 +1,234 @@
1
+ import { c as e, o as t, p as n, r, u as i } from "./button-Ba1PcsOx.js";
2
+ import { n as a, t as o } from "./dist-B-MyAb3x.js";
3
+ import { n as s } from "./dist-CmB86BdM.js";
4
+ import * as c from "react";
5
+ import l from "react";
6
+ import { jsx as u } from "react/jsx-runtime";
7
+ import "react-dom";
8
+ //#region node_modules/@radix-ui/react-collection/dist/index.mjs
9
+ function d(t) {
10
+ let r = t + "CollectionProvider", [a, o] = e(r), [s, c] = a(r, {
11
+ collectionRef: { current: null },
12
+ itemMap: /* @__PURE__ */ new Map()
13
+ }), d = (e) => {
14
+ let { scope: t, children: n } = e, r = l.useRef(null), i = l.useRef(/* @__PURE__ */ new Map()).current;
15
+ return /* @__PURE__ */ u(s, {
16
+ scope: t,
17
+ itemMap: i,
18
+ collectionRef: r,
19
+ children: n
20
+ });
21
+ };
22
+ d.displayName = r;
23
+ let f = t + "CollectionSlot", p = i(f), m = l.forwardRef((e, t) => {
24
+ let { scope: r, children: i } = e;
25
+ return /* @__PURE__ */ u(p, {
26
+ ref: n(t, c(f, r).collectionRef),
27
+ children: i
28
+ });
29
+ });
30
+ m.displayName = f;
31
+ let h = t + "CollectionItemSlot", g = "data-radix-collection-item", _ = i(h), v = l.forwardRef((e, t) => {
32
+ let { scope: r, children: i, ...a } = e, o = l.useRef(null), s = n(t, o), d = c(h, r);
33
+ return l.useEffect(() => (d.itemMap.set(o, {
34
+ ref: o,
35
+ ...a
36
+ }), () => void d.itemMap.delete(o))), /* @__PURE__ */ u(_, {
37
+ [g]: "",
38
+ ref: s,
39
+ children: i
40
+ });
41
+ });
42
+ v.displayName = h;
43
+ function y(e) {
44
+ let n = c(t + "CollectionConsumer", e);
45
+ return l.useCallback(() => {
46
+ let e = n.collectionRef.current;
47
+ if (!e) return [];
48
+ let t = Array.from(e.querySelectorAll(`[${g}]`));
49
+ return Array.from(n.itemMap.values()).sort((e, n) => t.indexOf(e.ref.current) - t.indexOf(n.ref.current));
50
+ }, [n.collectionRef, n.itemMap]);
51
+ }
52
+ return [
53
+ {
54
+ Provider: d,
55
+ Slot: m,
56
+ ItemSlot: v
57
+ },
58
+ y,
59
+ o
60
+ ];
61
+ }
62
+ //#endregion
63
+ //#region node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-primitive/dist/index.mjs
64
+ var f = [
65
+ "a",
66
+ "button",
67
+ "div",
68
+ "form",
69
+ "h2",
70
+ "h3",
71
+ "img",
72
+ "input",
73
+ "label",
74
+ "li",
75
+ "nav",
76
+ "ol",
77
+ "p",
78
+ "select",
79
+ "span",
80
+ "svg",
81
+ "ul"
82
+ ].reduce((e, t) => {
83
+ let n = i(`Primitive.${t}`), r = c.forwardRef((e, r) => {
84
+ let { asChild: i, ...a } = e, o = i ? n : t;
85
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ u(o, {
86
+ ...a,
87
+ ref: r
88
+ });
89
+ });
90
+ return r.displayName = `Primitive.${t}`, {
91
+ ...e,
92
+ [t]: r
93
+ };
94
+ }, {}), p = "rovingFocusGroup.onEntryFocus", m = {
95
+ bubbles: !1,
96
+ cancelable: !0
97
+ }, h = "RovingFocusGroup", [g, _, v] = d(h), [y, b] = e(h, [v]), [x, S] = y(h), C = c.forwardRef((e, t) => /* @__PURE__ */ u(g.Provider, {
98
+ scope: e.__scopeRovingFocusGroup,
99
+ children: /* @__PURE__ */ u(g.Slot, {
100
+ scope: e.__scopeRovingFocusGroup,
101
+ children: /* @__PURE__ */ u(w, {
102
+ ...e,
103
+ ref: t
104
+ })
105
+ })
106
+ }));
107
+ C.displayName = h;
108
+ var w = c.forwardRef((e, i) => {
109
+ let { __scopeRovingFocusGroup: o, orientation: l, loop: d = !1, dir: g, currentTabStopId: v, defaultCurrentTabStopId: y, onCurrentTabStopIdChange: b, onEntryFocus: S, preventScrollOnEntryFocus: C = !1, ...w } = e, T = c.useRef(null), E = n(i, T), D = s(g), [O, k] = a({
110
+ prop: v,
111
+ defaultProp: y ?? null,
112
+ onChange: b,
113
+ caller: h
114
+ }), [j, M] = c.useState(!1), N = r(S), P = _(o), F = c.useRef(!1), [I, L] = c.useState(0);
115
+ return c.useEffect(() => {
116
+ let e = T.current;
117
+ if (e) return e.addEventListener(p, N), () => e.removeEventListener(p, N);
118
+ }, [N]), /* @__PURE__ */ u(x, {
119
+ scope: o,
120
+ orientation: l,
121
+ dir: D,
122
+ loop: d,
123
+ currentTabStopId: O,
124
+ onItemFocus: c.useCallback((e) => k(e), [k]),
125
+ onItemShiftTab: c.useCallback(() => M(!0), []),
126
+ onFocusableItemAdd: c.useCallback(() => L((e) => e + 1), []),
127
+ onFocusableItemRemove: c.useCallback(() => L((e) => e - 1), []),
128
+ children: /* @__PURE__ */ u(f.div, {
129
+ tabIndex: j || I === 0 ? -1 : 0,
130
+ "data-orientation": l,
131
+ ...w,
132
+ ref: E,
133
+ style: {
134
+ outline: "none",
135
+ ...e.style
136
+ },
137
+ onMouseDown: t(e.onMouseDown, () => {
138
+ F.current = !0;
139
+ }),
140
+ onFocus: t(e.onFocus, (e) => {
141
+ let t = !F.current;
142
+ if (e.target === e.currentTarget && t && !j) {
143
+ let t = new CustomEvent(p, m);
144
+ if (e.currentTarget.dispatchEvent(t), !t.defaultPrevented) {
145
+ let e = P().filter((e) => e.focusable);
146
+ A([
147
+ e.find((e) => e.active),
148
+ e.find((e) => e.id === O),
149
+ ...e
150
+ ].filter(Boolean).map((e) => e.ref.current), C);
151
+ }
152
+ }
153
+ F.current = !1;
154
+ }),
155
+ onBlur: t(e.onBlur, () => M(!1))
156
+ })
157
+ });
158
+ }), T = "RovingFocusGroupItem", E = c.forwardRef((e, n) => {
159
+ let { __scopeRovingFocusGroup: r, focusable: i = !0, active: a = !1, tabStopId: s, children: l, ...d } = e, p = o(), m = s || p, h = S(T, r), v = h.currentTabStopId === m, y = _(r), { onFocusableItemAdd: b, onFocusableItemRemove: x, currentTabStopId: C } = h;
160
+ return c.useEffect(() => {
161
+ if (i) return b(), () => x();
162
+ }, [
163
+ i,
164
+ b,
165
+ x
166
+ ]), /* @__PURE__ */ u(g.ItemSlot, {
167
+ scope: r,
168
+ id: m,
169
+ focusable: i,
170
+ active: a,
171
+ children: /* @__PURE__ */ u(f.span, {
172
+ tabIndex: v ? 0 : -1,
173
+ "data-orientation": h.orientation,
174
+ ...d,
175
+ ref: n,
176
+ onMouseDown: t(e.onMouseDown, (e) => {
177
+ i ? h.onItemFocus(m) : e.preventDefault();
178
+ }),
179
+ onFocus: t(e.onFocus, () => h.onItemFocus(m)),
180
+ onKeyDown: t(e.onKeyDown, (e) => {
181
+ if (e.key === "Tab" && e.shiftKey) {
182
+ h.onItemShiftTab();
183
+ return;
184
+ }
185
+ if (e.target !== e.currentTarget) return;
186
+ let t = k(e, h.orientation, h.dir);
187
+ if (t !== void 0) {
188
+ if (e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) return;
189
+ e.preventDefault();
190
+ let n = y().filter((e) => e.focusable).map((e) => e.ref.current);
191
+ if (t === "last") n.reverse();
192
+ else if (t === "prev" || t === "next") {
193
+ t === "prev" && n.reverse();
194
+ let r = n.indexOf(e.currentTarget);
195
+ n = h.loop ? j(n, r + 1) : n.slice(r + 1);
196
+ }
197
+ setTimeout(() => A(n));
198
+ }
199
+ }),
200
+ children: typeof l == "function" ? l({
201
+ isCurrentTabStop: v,
202
+ hasTabStop: C != null
203
+ }) : l
204
+ })
205
+ });
206
+ });
207
+ E.displayName = T;
208
+ var D = {
209
+ ArrowLeft: "prev",
210
+ ArrowUp: "prev",
211
+ ArrowRight: "next",
212
+ ArrowDown: "next",
213
+ PageUp: "first",
214
+ Home: "first",
215
+ PageDown: "last",
216
+ End: "last"
217
+ };
218
+ function O(e, t) {
219
+ return t === "rtl" ? e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e : e;
220
+ }
221
+ function k(e, t, n) {
222
+ let r = O(e.key, n);
223
+ if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(r)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(r))) return D[r];
224
+ }
225
+ function A(e, t = !1) {
226
+ let n = document.activeElement;
227
+ for (let r of e) if (r === n || (r.focus({ preventScroll: t }), document.activeElement !== n)) return;
228
+ }
229
+ function j(e, t) {
230
+ return e.map((n, r) => e[(t + r) % e.length]);
231
+ }
232
+ var M = C, N = E;
233
+ //#endregion
234
+ export { d as i, M as n, b as r, N as t };