@middag-io/react 0.33.0 → 0.35.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 (133) hide show
  1. package/README.md +28 -8
  2. package/dist-lib/base/shell/AuthShell.js +39 -0
  3. package/dist-lib/base/shell/BasicShell.js +207 -0
  4. package/dist-lib/base/shell/ImmersiveShell.js +55 -0
  5. package/dist-lib/base/shell/partials/InspectorContext.js +60 -0
  6. package/dist-lib/base/shell/partials/InspectorPanel.js +22 -0
  7. package/dist-lib/base/shell/partials/NavErrorBoundary.js +66 -0
  8. package/dist-lib/base/shell/partials/OverlayScreen.js +36 -0
  9. package/dist-lib/base/shell/partials/PageActionButton.js +4 -0
  10. package/dist-lib/base/theme/appearance.js +39 -0
  11. package/dist-lib/base/theme/host-layout-detector.js +39 -0
  12. package/dist-lib/base/theme/host-theme-detector.js +131 -0
  13. package/dist-lib/base/theme/sidebar-safelist.txt +20 -0
  14. package/dist-lib/base/theme/tailwind-theme.css +136 -0
  15. package/dist-lib/base/theme/theme-bridge.css +164 -0
  16. package/dist-lib/base/theme/theme-context.js +103 -0
  17. package/dist-lib/base/theme/themes/classic.css +174 -0
  18. package/dist-lib/base/theme/tokens.css +290 -0
  19. package/dist-lib/base/theme/useHostTheme.js +34 -0
  20. package/dist-lib/base/utils/clipboard.js +16 -0
  21. package/dist-lib/base/utils/conditions.js +13 -0
  22. package/dist-lib/base/utils/icon-registry.js +16 -0
  23. package/dist-lib/base/utils/icons.js +11 -0
  24. package/dist-lib/base/utils/interpolate.js +6 -0
  25. package/dist-lib/base/utils/register-default-icons.js +9 -0
  26. package/dist-lib/base/utils/storage.js +30 -0
  27. package/dist-lib/base/utils/time.js +59 -0
  28. package/dist-lib/chunks/subpath-BD_PKGUX.js +146 -0
  29. package/dist-lib/chunks/subpath-DLFO_UGQ.js +604 -0
  30. package/dist-lib/components/reui/accordion.js +43 -0
  31. package/dist-lib/components/reui/alert-dialog.js +101 -0
  32. package/dist-lib/components/reui/alert.js +55 -0
  33. package/dist-lib/components/reui/aspect-ratio.js +11 -0
  34. package/dist-lib/components/reui/autocomplete.js +170 -0
  35. package/dist-lib/components/reui/avatar.js +51 -0
  36. package/dist-lib/components/reui/badge.js +64 -0
  37. package/dist-lib/components/reui/breadcrumb.js +69 -0
  38. package/dist-lib/components/reui/button-group.js +38 -0
  39. package/dist-lib/components/reui/button.js +47 -0
  40. package/dist-lib/components/reui/calendar.js +89 -0
  41. package/dist-lib/components/reui/card.js +55 -0
  42. package/dist-lib/components/reui/carousel.js +110 -0
  43. package/dist-lib/components/reui/chart.js +130 -0
  44. package/dist-lib/components/reui/checkbox.js +20 -0
  45. package/dist-lib/components/reui/collapsible.js +23 -0
  46. package/dist-lib/components/reui/combobox.js +166 -0
  47. package/dist-lib/components/reui/command.js +85 -0
  48. package/dist-lib/components/reui/context-menu.js +121 -0
  49. package/dist-lib/components/reui/data-grid/data-grid-column-filter.js +108 -0
  50. package/dist-lib/components/reui/data-grid/data-grid-column-header.js +217 -0
  51. package/dist-lib/components/reui/data-grid/data-grid-column-visibility.js +25 -0
  52. package/dist-lib/components/reui/data-grid/data-grid-pagination.js +132 -0
  53. package/dist-lib/components/reui/data-grid/data-grid-scroll-area.js +183 -0
  54. package/dist-lib/components/reui/data-grid/data-grid-table-dnd-rows.js +125 -0
  55. package/dist-lib/components/reui/data-grid/data-grid-table-dnd.js +130 -0
  56. package/dist-lib/components/reui/data-grid/data-grid-table-virtual.js +156 -0
  57. package/dist-lib/components/reui/data-grid/data-grid-table.js +546 -0
  58. package/dist-lib/components/reui/data-grid/data-grid.js +113 -0
  59. package/dist-lib/components/reui/data-grid-pagination.js +131 -0
  60. package/dist-lib/components/reui/date-selector.js +642 -0
  61. package/dist-lib/components/reui/dialog.js +94 -0
  62. package/dist-lib/components/reui/drawer.js +77 -0
  63. package/dist-lib/components/reui/dropdown-menu.js +123 -0
  64. package/dist-lib/components/reui/empty.js +59 -0
  65. package/dist-lib/components/reui/field.js +115 -0
  66. package/dist-lib/components/reui/filters.js +873 -0
  67. package/dist-lib/components/reui/frame.js +97 -0
  68. package/dist-lib/components/reui/hover-card.js +31 -0
  69. package/dist-lib/components/reui/icon-placeholder.js +14 -0
  70. package/dist-lib/components/reui/index.js +18 -0
  71. package/dist-lib/components/reui/input-group.js +78 -0
  72. package/dist-lib/components/reui/input-otp.js +44 -0
  73. package/dist-lib/components/reui/input.js +14 -0
  74. package/dist-lib/components/reui/item.js +116 -0
  75. package/dist-lib/components/reui/kanban.js +316 -0
  76. package/dist-lib/components/reui/kbd.js +19 -0
  77. package/dist-lib/components/reui/label.js +14 -0
  78. package/dist-lib/components/reui/menubar.js +132 -0
  79. package/dist-lib/components/reui/native-select.js +37 -0
  80. package/dist-lib/components/reui/navigation-menu.js +80 -0
  81. package/dist-lib/components/reui/number-field.js +126 -0
  82. package/dist-lib/components/reui/pagination.js +78 -0
  83. package/dist-lib/components/reui/phone-input.js +124 -0
  84. package/dist-lib/components/reui/popover.js +55 -0
  85. package/dist-lib/components/reui/progress.js +20 -0
  86. package/dist-lib/components/reui/radio-group.js +27 -0
  87. package/dist-lib/components/reui/rating.js +81 -0
  88. package/dist-lib/components/reui/resizable.js +31 -0
  89. package/dist-lib/components/reui/scroll-area.js +36 -0
  90. package/dist-lib/components/reui/scrollspy.js +104 -0
  91. package/dist-lib/components/reui/select.js +97 -0
  92. package/dist-lib/components/reui/separator.js +17 -0
  93. package/dist-lib/components/reui/sheet.js +81 -0
  94. package/dist-lib/components/reui/sidebar.js +350 -0
  95. package/dist-lib/components/reui/skeleton.js +12 -0
  96. package/dist-lib/components/reui/slider.js +35 -0
  97. package/dist-lib/components/reui/sonner.js +28 -0
  98. package/dist-lib/components/reui/sortable.js +172 -0
  99. package/dist-lib/components/reui/spinner.js +14 -0
  100. package/dist-lib/components/reui/stepper.js +193 -0
  101. package/dist-lib/components/reui/svgs/claudeAiIcon.js +13 -0
  102. package/dist-lib/components/reui/svgs/gemini.js +257 -0
  103. package/dist-lib/components/reui/svgs/openai.js +10 -0
  104. package/dist-lib/components/reui/svgs/openaiDark.js +13 -0
  105. package/dist-lib/components/reui/switch.js +19 -0
  106. package/dist-lib/components/reui/table.js +66 -0
  107. package/dist-lib/components/reui/tabs.js +47 -0
  108. package/dist-lib/components/reui/textarea.js +13 -0
  109. package/dist-lib/components/reui/timeline.js +84 -0
  110. package/dist-lib/components/reui/toggle-group.js +48 -0
  111. package/dist-lib/components/reui/toggle.js +36 -0
  112. package/dist-lib/components/reui/tooltip.js +35 -0
  113. package/dist-lib/components/reui/tree.js +102 -0
  114. package/dist-lib/i18n/I18nProvider.js +23 -0
  115. package/dist-lib/i18n/host-resolver.js +10 -0
  116. package/dist-lib/i18n/instance.js +2 -0
  117. package/dist-lib/i18n/locales/en/ui.json +266 -0
  118. package/dist-lib/i18n/locales/en/validators.json +13 -0
  119. package/dist-lib/i18n/locales/pt-BR/ui.json +266 -0
  120. package/dist-lib/i18n/locales/pt-BR/validators.json +13 -0
  121. package/dist-lib/i18n/register-strings.js +7 -0
  122. package/dist-lib/i18n/render-label.js +13 -0
  123. package/dist-lib/i18n/resolve-field-error.js +10 -0
  124. package/dist-lib/i18n/useHostString.js +31 -0
  125. package/dist-lib/i18n/useTranslation.js +48 -0
  126. package/dist-lib/lib/actions/resolve-action-target.js +48 -0
  127. package/dist-lib/lib/hooks/use-copy-to-clipboard.js +18 -0
  128. package/dist-lib/lib/hooks/use-file-upload.js +171 -0
  129. package/dist-lib/lib/hooks/use-mobile.js +18 -0
  130. package/dist-lib/lib/portal-container.js +7 -0
  131. package/dist-lib/lib/utils.js +8 -0
  132. package/dist-lib/middag-react.css +1 -1
  133. package/package.json +41 -8
@@ -0,0 +1,156 @@
1
+ "use client";
2
+ import { cn as e } from "../../../lib/utils.js";
3
+ import { useDataGrid as t } from "./data-grid.js";
4
+ import { Spinner as n } from "../spinner.js";
5
+ import { DataGridTableBase as r, DataGridTableBody as i, DataGridTableEmpty as a, DataGridTableFoot as o, DataGridTableHead as s, DataGridTableHeadRow as c, DataGridTableHeadRowCell as l, DataGridTableHeadRowCellResize as u, DataGridTableRenderedRow as d, DataGridTableRowSpacer as f, DataGridTableViewport as p, getDataGridTableRowSections as m } from "./data-grid-table.js";
6
+ import { memo as h, useCallback as g, useEffect as _, useMemo as v, useState as y } from "react";
7
+ import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
8
+ import { flexRender as C } from "@tanstack/react-table";
9
+ import { useVirtualizer as w } from "@tanstack/react-virtual";
10
+ //#region src/components/reui/data-grid/data-grid-table-virtual.tsx
11
+ function T({ columnCount: e, height: t }) {
12
+ return t <= 0 ? null : /* @__PURE__ */ x("tr", {
13
+ "aria-hidden": "true",
14
+ children: /* @__PURE__ */ x("td", {
15
+ colSpan: e,
16
+ style: {
17
+ height: t,
18
+ padding: 0
19
+ }
20
+ })
21
+ });
22
+ }
23
+ function E({ children: t, className: n, columnCount: r }) {
24
+ return /* @__PURE__ */ x("tr", { children: /* @__PURE__ */ x("td", {
25
+ colSpan: r,
26
+ className: e("text-muted-foreground py-4 text-center text-sm", n),
27
+ children: t
28
+ }) });
29
+ }
30
+ function D({ columnCount: e, topRows: t, centerRows: r, bottomRows: i, virtualItems: o, totalSize: s, isVirtualizationEnabled: c, isInfiniteMode: l, isFetchingMore: u, hasMore: f, loadingMoreMessage: p, allRowsLoadedMessage: m, measureRowRef: h }) {
31
+ let g = t.length + r.length + i.length;
32
+ if (!g) return /* @__PURE__ */ x(a, {});
33
+ let _ = r.length > 0, v = l && u, y = l && f === !1 && g > 0, C = _ || v || y, w = c && _ && o.length > 0 ? o[0]?.start ?? 0 : 0, D = c && _ && o.length > 0 ? Math.max(0, s - (o[o.length - 1]?.end ?? 0)) : 0, O = [];
34
+ return t.forEach((e, n) => {
35
+ O.push(/* @__PURE__ */ x(d, {
36
+ row: e,
37
+ pinnedBoundary: n === t.length - 1 && C ? "top" : void 0
38
+ }, e.id));
39
+ }), c ? (w > 0 && O.push(/* @__PURE__ */ x(T, {
40
+ columnCount: e,
41
+ height: w
42
+ }, "virtual-spacer-start")), o.forEach((e) => {
43
+ let t = r[e.index];
44
+ t && O.push(/* @__PURE__ */ x(d, {
45
+ row: t,
46
+ rowRef: h
47
+ }, t.id));
48
+ }), D > 0 && O.push(/* @__PURE__ */ x(T, {
49
+ columnCount: e,
50
+ height: D
51
+ }, "virtual-spacer-end"))) : r.forEach((e) => {
52
+ O.push(/* @__PURE__ */ x(d, { row: e }, e.id));
53
+ }), v && O.push(/* @__PURE__ */ x(E, {
54
+ columnCount: e,
55
+ children: /* @__PURE__ */ S("div", {
56
+ className: "flex items-center justify-center gap-2",
57
+ children: [/* @__PURE__ */ x(n, { className: "size-4 opacity-60" }), p]
58
+ })
59
+ }, "virtual-status-loading")), y && O.push(/* @__PURE__ */ x(E, {
60
+ columnCount: e,
61
+ className: "py-3 text-xs",
62
+ children: m
63
+ }, "virtual-status-complete")), i.forEach((e, n) => {
64
+ O.push(/* @__PURE__ */ x(d, {
65
+ row: e,
66
+ pinnedBoundary: n === 0 && (t.length > 0 || C) ? "bottom" : void 0
67
+ }, e.id));
68
+ }), /* @__PURE__ */ x(b, { children: O });
69
+ }
70
+ var O = h(D, (e, t) => !!t.table.getState().columnSizingInfo.isResizingColumn);
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({
73
+ containerElement: null,
74
+ scrollElement: null
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) => {
76
+ L({
77
+ containerElement: e,
78
+ scrollElement: e?.closest("[data-slot=\"scroll-area-viewport\"]") ?? e
79
+ });
80
+ }, []), J = I.scrollElement !== null && I.scrollElement !== I.containerElement, Y = g(() => B ? B(I) : I.scrollElement, [B, I]), X = g((e) => {
81
+ let t = M[e];
82
+ return t ? z?.(e, t) ?? t.id ?? e : e;
83
+ }, [M, z]), te = g((e) => {
84
+ let t = M[e];
85
+ return t ? R?.(e, t) ?? n : n;
86
+ }, [
87
+ M,
88
+ R,
89
+ n
90
+ ]), Z = w({
91
+ count: M.length,
92
+ getScrollElement: Y,
93
+ getItemKey: X,
94
+ estimateSize: te,
95
+ overscan: H ?? a,
96
+ measureElement: V,
97
+ ...U
98
+ }), Q = W ? Z.getVirtualItems() : [], ne = W ? Z.getTotalSize() : 0, re = W && V ? Z.measureElement : void 0, $ = v(() => Math.max(0, D), [D]);
99
+ return _(() => {
100
+ if (!W || !F || E === !1 || T) return;
101
+ let e = Q[Q.length - 1];
102
+ e && e.index >= M.length - 1 - $ && b?.();
103
+ }, [
104
+ M.length,
105
+ E,
106
+ T,
107
+ F,
108
+ W,
109
+ b,
110
+ $,
111
+ Q
112
+ ]), /* @__PURE__ */ x(p, {
113
+ viewportRef: q,
114
+ className: J ? void 0 : "block",
115
+ style: J ? void 0 : {
116
+ height: e,
117
+ overflow: "auto",
118
+ position: "relative"
119
+ },
120
+ children: /* @__PURE__ */ S(r, { children: [
121
+ h && /* @__PURE__ */ x(s, { children: A.getHeaderGroups().map((e, t) => /* @__PURE__ */ x(c, {
122
+ headerGroup: e,
123
+ children: e.headers.map((e, t) => {
124
+ let { column: n } = e;
125
+ return /* @__PURE__ */ S(l, {
126
+ header: e,
127
+ children: [e.isPlaceholder ? null : j.tableLayout?.columnsResizable && n.getCanResize() ? /* @__PURE__ */ x("div", {
128
+ className: "truncate",
129
+ children: C(e.column.columnDef.header, e.getContext())
130
+ }) : C(e.column.columnDef.header, e.getContext()), j.tableLayout?.columnsResizable && n.getCanResize() && /* @__PURE__ */ x(u, { header: e })]
131
+ }, t);
132
+ })
133
+ }, t)) }),
134
+ h && (j.tableLayout?.stripped || !j.tableLayout?.rowBorder) && /* @__PURE__ */ x(f, {}),
135
+ /* @__PURE__ */ x(i, { children: /* @__PURE__ */ x(O, {
136
+ table: A,
137
+ columnCount: P,
138
+ topRows: ee,
139
+ centerRows: M,
140
+ bottomRows: N,
141
+ virtualItems: Q,
142
+ totalSize: ne,
143
+ isVirtualizationEnabled: W,
144
+ isInfiniteMode: F,
145
+ isFetchingMore: T,
146
+ hasMore: E,
147
+ loadingMoreMessage: G,
148
+ allRowsLoadedMessage: K,
149
+ measureRowRef: re
150
+ }) }),
151
+ d && /* @__PURE__ */ x(o, { children: d })
152
+ ] })
153
+ });
154
+ }
155
+ //#endregion
156
+ export { k as DataGridTableVirtual };