@middag-io/react 0.32.0 → 0.34.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 (211) hide show
  1. package/README.md +2 -2
  2. package/dist-lib/base/blocks/ActivityTimelineBlock.d.ts.map +1 -1
  3. package/dist-lib/base/shell/AuthShell.js +39 -0
  4. package/dist-lib/base/shell/BasicShell.js +207 -0
  5. package/dist-lib/base/shell/ImmersiveShell.js +55 -0
  6. package/dist-lib/base/shell/partials/InspectorContext.d.ts.map +1 -1
  7. package/dist-lib/base/shell/partials/InspectorContext.js +60 -0
  8. package/dist-lib/base/shell/partials/InspectorPanel.js +22 -0
  9. package/dist-lib/base/shell/partials/NavErrorBoundary.js +66 -0
  10. package/dist-lib/base/shell/partials/OverlayScreen.js +36 -0
  11. package/dist-lib/base/shell/partials/PageActionButton.js +4 -0
  12. package/dist-lib/base/theme/appearance.js +39 -0
  13. package/dist-lib/base/theme/host-layout-detector.js +39 -0
  14. package/dist-lib/base/theme/host-theme-detector.js +131 -0
  15. package/dist-lib/base/theme/sidebar-safelist.txt +20 -0
  16. package/dist-lib/base/theme/theme-bridge.css +164 -0
  17. package/dist-lib/base/theme/theme-context.js +103 -0
  18. package/dist-lib/base/theme/themes/classic.css +174 -0
  19. package/dist-lib/base/theme/tokens.css +290 -0
  20. package/dist-lib/base/theme/useHostTheme.js +34 -0
  21. package/dist-lib/base/utils/clipboard.js +16 -0
  22. package/dist-lib/base/utils/conditions.js +13 -0
  23. package/dist-lib/base/utils/icon-registry.js +16 -0
  24. package/dist-lib/base/utils/icons.js +11 -0
  25. package/dist-lib/base/utils/interpolate.js +6 -0
  26. package/dist-lib/base/utils/register-default-icons.js +9 -0
  27. package/dist-lib/base/utils/storage.js +30 -0
  28. package/dist-lib/base/utils/time.js +59 -0
  29. package/dist-lib/chunks/subpath-BD_PKGUX.js +146 -0
  30. package/dist-lib/chunks/subpath-DLFO_UGQ.js +604 -0
  31. package/dist-lib/components/reui/accordion.js +43 -0
  32. package/dist-lib/components/reui/alert-dialog.js +101 -0
  33. package/dist-lib/components/reui/alert.js +55 -0
  34. package/dist-lib/components/reui/aspect-ratio.js +11 -0
  35. package/dist-lib/components/reui/autocomplete.js +170 -0
  36. package/dist-lib/components/reui/avatar.js +51 -0
  37. package/dist-lib/components/reui/badge.js +64 -0
  38. package/dist-lib/components/reui/breadcrumb.js +69 -0
  39. package/dist-lib/components/reui/button-group.js +38 -0
  40. package/dist-lib/components/reui/button.js +47 -0
  41. package/dist-lib/components/reui/calendar.js +89 -0
  42. package/dist-lib/components/reui/card.js +55 -0
  43. package/dist-lib/components/reui/carousel.js +110 -0
  44. package/dist-lib/components/reui/chart.js +130 -0
  45. package/dist-lib/components/reui/checkbox.js +20 -0
  46. package/dist-lib/components/reui/collapsible.js +23 -0
  47. package/dist-lib/components/reui/combobox.js +166 -0
  48. package/dist-lib/components/reui/command.js +85 -0
  49. package/dist-lib/components/reui/context-menu.js +121 -0
  50. package/dist-lib/components/reui/data-grid/data-grid-column-filter.js +108 -0
  51. package/dist-lib/components/reui/data-grid/data-grid-column-header.js +217 -0
  52. package/dist-lib/components/reui/data-grid/data-grid-column-visibility.js +25 -0
  53. package/dist-lib/components/reui/data-grid/data-grid-pagination.js +132 -0
  54. package/dist-lib/components/reui/data-grid/data-grid-scroll-area.js +183 -0
  55. package/dist-lib/components/reui/data-grid/data-grid-table-dnd-rows.js +125 -0
  56. package/dist-lib/components/reui/data-grid/data-grid-table-dnd.js +130 -0
  57. package/dist-lib/components/reui/data-grid/data-grid-table-virtual.js +156 -0
  58. package/dist-lib/components/reui/data-grid/data-grid-table.js +546 -0
  59. package/dist-lib/components/reui/data-grid/data-grid.js +113 -0
  60. package/dist-lib/components/reui/data-grid-pagination.js +131 -0
  61. package/dist-lib/components/reui/date-selector.js +642 -0
  62. package/dist-lib/components/reui/dialog.js +94 -0
  63. package/dist-lib/components/reui/drawer.js +77 -0
  64. package/dist-lib/components/reui/dropdown-menu.js +123 -0
  65. package/dist-lib/components/reui/empty.js +59 -0
  66. package/dist-lib/components/reui/field.js +115 -0
  67. package/dist-lib/components/reui/filters.js +873 -0
  68. package/dist-lib/components/reui/frame.js +97 -0
  69. package/dist-lib/components/reui/hover-card.js +31 -0
  70. package/dist-lib/components/reui/icon-placeholder.js +14 -0
  71. package/dist-lib/components/reui/index.js +18 -0
  72. package/dist-lib/components/reui/input-group.js +78 -0
  73. package/dist-lib/components/reui/input-otp.js +44 -0
  74. package/dist-lib/components/reui/input.js +14 -0
  75. package/dist-lib/components/reui/item.js +116 -0
  76. package/dist-lib/components/reui/kanban.js +316 -0
  77. package/dist-lib/components/reui/kbd.js +19 -0
  78. package/dist-lib/components/reui/label.js +14 -0
  79. package/dist-lib/components/reui/menubar.js +132 -0
  80. package/dist-lib/components/reui/native-select.js +37 -0
  81. package/dist-lib/components/reui/navigation-menu.js +80 -0
  82. package/dist-lib/components/reui/number-field.js +126 -0
  83. package/dist-lib/components/reui/pagination.js +78 -0
  84. package/dist-lib/components/reui/phone-input.js +124 -0
  85. package/dist-lib/components/reui/popover.js +55 -0
  86. package/dist-lib/components/reui/progress.js +20 -0
  87. package/dist-lib/components/reui/radio-group.js +27 -0
  88. package/dist-lib/components/reui/rating.js +81 -0
  89. package/dist-lib/components/reui/resizable.js +31 -0
  90. package/dist-lib/components/reui/scroll-area.js +36 -0
  91. package/dist-lib/components/reui/scrollspy.js +104 -0
  92. package/dist-lib/components/reui/select.js +97 -0
  93. package/dist-lib/components/reui/separator.js +17 -0
  94. package/dist-lib/components/reui/sheet.js +81 -0
  95. package/dist-lib/components/reui/sidebar.js +350 -0
  96. package/dist-lib/components/reui/skeleton.js +12 -0
  97. package/dist-lib/components/reui/slider.js +35 -0
  98. package/dist-lib/components/reui/sonner.js +28 -0
  99. package/dist-lib/components/reui/sortable.js +172 -0
  100. package/dist-lib/components/reui/spinner.js +14 -0
  101. package/dist-lib/components/reui/stepper.js +193 -0
  102. package/dist-lib/components/reui/svgs/claudeAiIcon.js +13 -0
  103. package/dist-lib/components/reui/svgs/gemini.js +257 -0
  104. package/dist-lib/components/reui/svgs/openai.js +10 -0
  105. package/dist-lib/components/reui/svgs/openaiDark.js +13 -0
  106. package/dist-lib/components/reui/switch.js +19 -0
  107. package/dist-lib/components/reui/table.js +66 -0
  108. package/dist-lib/components/reui/tabs.js +47 -0
  109. package/dist-lib/components/reui/textarea.js +13 -0
  110. package/dist-lib/components/reui/timeline.js +84 -0
  111. package/dist-lib/components/reui/toggle-group.js +48 -0
  112. package/dist-lib/components/reui/toggle.js +36 -0
  113. package/dist-lib/components/reui/tooltip.js +35 -0
  114. package/dist-lib/components/reui/tree.js +102 -0
  115. package/dist-lib/contracts/block-data/data-display.d.ts +8 -0
  116. package/dist-lib/contracts/block-data/data-display.d.ts.map +1 -1
  117. package/dist-lib/i18n/I18nProvider.js +23 -0
  118. package/dist-lib/i18n/host-resolver.js +10 -0
  119. package/dist-lib/i18n/instance.js +2 -0
  120. package/dist-lib/i18n/locales/en/ui.json +266 -0
  121. package/dist-lib/i18n/locales/en/validators.json +13 -0
  122. package/dist-lib/i18n/locales/pt-BR/ui.json +266 -0
  123. package/dist-lib/i18n/locales/pt-BR/validators.json +13 -0
  124. package/dist-lib/i18n/register-strings.js +7 -0
  125. package/dist-lib/i18n/render-label.js +13 -0
  126. package/dist-lib/i18n/resolve-field-error.js +10 -0
  127. package/dist-lib/i18n/useHostString.js +31 -0
  128. package/dist-lib/i18n/useTranslation.js +48 -0
  129. package/dist-lib/lib/actions/resolve-action-target.js +48 -0
  130. package/dist-lib/lib/hooks/use-copy-to-clipboard.js +18 -0
  131. package/dist-lib/lib/hooks/use-file-upload.js +171 -0
  132. package/dist-lib/lib/hooks/use-mobile.js +18 -0
  133. package/dist-lib/lib/portal-container.js +7 -0
  134. package/dist-lib/lib/utils.js +8 -0
  135. package/dist-lib/middag-react.css +1 -1
  136. package/dist-lib/middag-react.js +26 -5
  137. package/package.json +39 -7
  138. package/dist-lib/_redirects +0 -1
  139. package/dist-lib/api/example/moodle/get/books.json +0 -209
  140. package/dist-lib/api/example/moodle/get/dashboard.json +0 -203
  141. package/dist-lib/api/example/wordpress/get/products.json +0 -165
  142. package/dist-lib/api/index.json +0 -66
  143. package/dist-lib/api/inspector/connectors/canvas.json +0 -18
  144. package/dist-lib/api/inspector/connectors/moodle.json +0 -18
  145. package/dist-lib/api/inspector/connectors/n8n.json +0 -18
  146. package/dist-lib/api/inspector/connectors/open-edx.json +0 -18
  147. package/dist-lib/api/inspector/offerings/off-1.json +0 -18
  148. package/dist-lib/api/inspector/offerings/off-2.json +0 -18
  149. package/dist-lib/api/inspector/offerings/off-3.json +0 -18
  150. package/dist-lib/api/inspector/offerings/off-4.json +0 -18
  151. package/dist-lib/api/inspector/offerings/off-5.json +0 -18
  152. package/dist-lib/api/inspector/offerings/off-6.json +0 -17
  153. package/dist-lib/lottie/calendar/schedule-1.json +0 -1
  154. package/dist-lib/lottie/calendar/schedule-2.json +0 -1
  155. package/dist-lib/lottie/celebration/confetti-1.json +0 -1
  156. package/dist-lib/lottie/celebration/confetti-2.json +0 -1
  157. package/dist-lib/lottie/celebration/confetti-3.json +0 -1
  158. package/dist-lib/lottie/cloud/cloud-1.json +0 -1
  159. package/dist-lib/lottie/cloud/cloud-2.json +0 -1
  160. package/dist-lib/lottie/connection/network-1.json +0 -1
  161. package/dist-lib/lottie/connection/network-2.json +0 -1
  162. package/dist-lib/lottie/connection/network-3.json +0 -1
  163. package/dist-lib/lottie/dashboard/analytics-1.json +0 -1
  164. package/dist-lib/lottie/dashboard/analytics-2.json +0 -1
  165. package/dist-lib/lottie/dashboard/analytics-3.json +0 -1
  166. package/dist-lib/lottie/email/mail-1.json +0 -1
  167. package/dist-lib/lottie/email/mail-2.json +0 -1
  168. package/dist-lib/lottie/email/mail-3.json +0 -1
  169. package/dist-lib/lottie/empty-state/empty-1.json +0 -1
  170. package/dist-lib/lottie/empty-state/empty-2.json +0 -1
  171. package/dist-lib/lottie/empty-state/empty-3.json +0 -1
  172. package/dist-lib/lottie/error/warning-1.json +0 -1
  173. package/dist-lib/lottie/error/warning-2.json +0 -1
  174. package/dist-lib/lottie/error/warning-3.json +0 -1
  175. package/dist-lib/lottie/index.ts +0 -49
  176. package/dist-lib/lottie/loading/spinner-1.json +0 -1
  177. package/dist-lib/lottie/loading/spinner-2.json +0 -1
  178. package/dist-lib/lottie/loading/spinner-3.json +0 -1
  179. package/dist-lib/lottie/maintenance/construction-1.json +0 -1
  180. package/dist-lib/lottie/maintenance/construction-2.json +0 -1
  181. package/dist-lib/lottie/maintenance/construction-3.json +0 -1
  182. package/dist-lib/lottie/not-found/404-1.json +0 -1
  183. package/dist-lib/lottie/not-found/404-2.json +0 -1
  184. package/dist-lib/lottie/not-found/404-3.json +0 -1
  185. package/dist-lib/lottie/notification/bell-1.json +0 -1
  186. package/dist-lib/lottie/notification/bell-2.json +0 -1
  187. package/dist-lib/lottie/notification/bell-3.json +0 -1
  188. package/dist-lib/lottie/onboarding/welcome-1.json +0 -1
  189. package/dist-lib/lottie/onboarding/welcome-2.json +0 -1
  190. package/dist-lib/lottie/onboarding/welcome-3.json +0 -1
  191. package/dist-lib/lottie/payment/wallet-1.json +0 -1
  192. package/dist-lib/lottie/payment/wallet-2.json +0 -1
  193. package/dist-lib/lottie/payment/wallet-3.json +0 -1
  194. package/dist-lib/lottie/search/search-1.json +0 -1
  195. package/dist-lib/lottie/search/search-2.json +0 -1
  196. package/dist-lib/lottie/search/search-3.json +0 -1
  197. package/dist-lib/lottie/security/lock-1.json +0 -1
  198. package/dist-lib/lottie/security/lock-2.json +0 -1
  199. package/dist-lib/lottie/security/lock-3.json +0 -1
  200. package/dist-lib/lottie/settings/gear-1.json +0 -1
  201. package/dist-lib/lottie/settings/gear-2.json +0 -1
  202. package/dist-lib/lottie/settings/gear-3.json +0 -1
  203. package/dist-lib/lottie/success/check-1.json +0 -1
  204. package/dist-lib/lottie/success/check-2.json +0 -1
  205. package/dist-lib/lottie/success/check-3.json +0 -1
  206. package/dist-lib/lottie/upload/upload-1.json +0 -1
  207. package/dist-lib/lottie/upload/upload-2.json +0 -1
  208. package/dist-lib/lottie/upload/upload-3.json +0 -1
  209. package/dist-lib/lottie/user/profile-1.json +0 -1
  210. package/dist-lib/lottie/user/profile-2.json +0 -1
  211. package/dist-lib/lottie/user/profile-3.json +0 -1
@@ -5154,7 +5154,13 @@ var of = {
5154
5154
  neutral: "bg-muted"
5155
5155
  };
5156
5156
  function sf({ block: e }) {
5157
- let { t, locale: n } = I(), { meta: r, key: i } = e, a = Vr().props[i] ?? e.data, o = r?.loading === !0, [s, c] = W(!1), l = () => {
5157
+ let { t, locale: n } = I(), { meta: r, key: i } = e, a = Vr().props[i] ?? e.data, o = r?.loading === !0, [s, c] = W(!1), [l, u] = W(/* @__PURE__ */ new Set()), d = (e, t) => {
5158
+ u((e) => new Set(e).add(t)), G.post(e, {}, {
5159
+ preserveState: !0,
5160
+ preserveScroll: !0,
5161
+ only: [i]
5162
+ });
5163
+ }, f = () => {
5158
5164
  a.loadMoreHref && (c(!0), G.get(a.loadMoreHref, {}, {
5159
5165
  preserveState: !0,
5160
5166
  preserveScroll: !0,
@@ -5197,9 +5203,9 @@ function sf({ block: e }) {
5197
5203
  size: 14,
5198
5204
  className: "text-white"
5199
5205
  })
5200
- }), /* @__PURE__ */ q("div", {
5206
+ }), /* @__PURE__ */ J("div", {
5201
5207
  className: "min-w-0 flex-1",
5202
- children: /* @__PURE__ */ J("div", {
5208
+ children: [/* @__PURE__ */ J("div", {
5203
5209
  className: "flex items-baseline justify-between gap-2",
5204
5210
  children: [/* @__PURE__ */ J("p", {
5205
5211
  className: "text-sm",
@@ -5221,7 +5227,16 @@ function sf({ block: e }) {
5221
5227
  title: rf(e.timestamp),
5222
5228
  children: nf(e.timestamp, n)
5223
5229
  })]
5224
- })
5230
+ }), e.markReadHref && (e.read || l.has(e.id) ? /* @__PURE__ */ q("span", {
5231
+ className: "text-muted-foreground mt-1 inline-block text-xs",
5232
+ children: t("middag.ui.activity.read")
5233
+ }) : /* @__PURE__ */ q(F, {
5234
+ variant: "ghost",
5235
+ size: "sm",
5236
+ className: "mt-1 h-auto px-2 py-0.5 text-xs",
5237
+ onClick: () => d(e.markReadHref, e.id),
5238
+ children: t("middag.ui.activity.mark_read")
5239
+ }))]
5225
5240
  })]
5226
5241
  }, e.id))
5227
5242
  })] }, e.label)), a.hasMore && /* @__PURE__ */ q("li", {
@@ -5229,7 +5244,7 @@ function sf({ block: e }) {
5229
5244
  children: /* @__PURE__ */ q(F, {
5230
5245
  variant: "ghost",
5231
5246
  size: "sm",
5232
- onClick: l,
5247
+ onClick: f,
5233
5248
  disabled: s,
5234
5249
  "aria-label": t("middag.ui.activity.load_more_label"),
5235
5250
  children: t(s ? "middag.ui.loading" : "middag.ui.load_more")
@@ -14471,7 +14486,9 @@ var pS = {
14471
14486
  "middag.ui.actionbar.selected_one": "{count} selected",
14472
14487
  "middag.ui.actionbar.selected_other": "{count} selected",
14473
14488
  "middag.ui.activity.load_more_label": "Load more activities",
14489
+ "middag.ui.activity.mark_read": "Mark as read",
14474
14490
  "middag.ui.activity.no_activity": "No activity recorded",
14491
+ "middag.ui.activity.read": "Read",
14475
14492
  "middag.ui.activity.system_actor": "System",
14476
14493
  "middag.ui.activity.timeline_label": "Activity timeline",
14477
14494
  "middag.ui.appearance.dark": "Dark",
@@ -14633,6 +14650,7 @@ var pS = {
14633
14650
  "middag.ui.inspector.close": "Close inspector",
14634
14651
  "middag.ui.inspector.error": "Could not load details.",
14635
14652
  "middag.ui.inspector.favorite": "Favorite",
14653
+ "middag.ui.inspector.label": "Inspector",
14636
14654
  "middag.ui.inspector.tab_activity": "Activity",
14637
14655
  "middag.ui.inspector.tab_config": "Config",
14638
14656
  "middag.ui.inspector.tab_overview": "Overview",
@@ -14745,7 +14763,9 @@ var pS = {
14745
14763
  "middag.ui.actionbar.selected_one": "{count} selecionado",
14746
14764
  "middag.ui.actionbar.selected_other": "{count} selecionados",
14747
14765
  "middag.ui.activity.load_more_label": "Carregar mais atividades",
14766
+ "middag.ui.activity.mark_read": "Marcar como lida",
14748
14767
  "middag.ui.activity.no_activity": "Nenhuma atividade registrada",
14768
+ "middag.ui.activity.read": "Lida",
14749
14769
  "middag.ui.activity.system_actor": "Sistema",
14750
14770
  "middag.ui.activity.timeline_label": "Linha do tempo de atividades",
14751
14771
  "middag.ui.appearance.dark": "Escuro",
@@ -14907,6 +14927,7 @@ var pS = {
14907
14927
  "middag.ui.inspector.close": "Fechar inspetor",
14908
14928
  "middag.ui.inspector.error": "Não foi possível carregar os detalhes.",
14909
14929
  "middag.ui.inspector.favorite": "Favoritar",
14930
+ "middag.ui.inspector.label": "Inspetor",
14910
14931
  "middag.ui.inspector.tab_activity": "Atividade",
14911
14932
  "middag.ui.inspector.tab_config": "Configuração",
14912
14933
  "middag.ui.inspector.tab_overview": "Detalhes",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middag-io/react",
3
- "version": "0.32.0",
3
+ "version": "0.34.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",
@@ -24,15 +24,47 @@
24
24
  },
25
25
  "./style.css": "./dist-lib/middag-react.css",
26
26
  "./theme.css": "./src/theme.css",
27
- "./reui/*": "./src/components/reui/*",
28
- "./i18n/*": "./src/i18n/*",
27
+ "./reui/*": {
28
+ "types": "./dist-lib/components/reui/*.d.ts",
29
+ "import": "./dist-lib/components/reui/*.js",
30
+ "default": "./dist-lib/components/reui/*.js"
31
+ },
32
+ "./reui/*.tsx": {
33
+ "types": "./dist-lib/components/reui/*.d.ts",
34
+ "import": "./dist-lib/components/reui/*.js",
35
+ "default": "./dist-lib/components/reui/*.js"
36
+ },
37
+ "./i18n/*": {
38
+ "types": "./dist-lib/i18n/*.d.ts",
39
+ "import": "./dist-lib/i18n/*.js",
40
+ "default": "./dist-lib/i18n/*.js"
41
+ },
42
+ "./i18n/locales/*.json": "./dist-lib/i18n/locales/*.json",
29
43
  "./blocks/*": "./src/base/blocks/*",
30
44
  "./form/*": "./src/base/form/*",
31
45
  "./partials/*": "./src/base/partials/*",
32
- "./lib/*": "./src/lib/*",
33
- "./shell/*": "./src/base/shell/*",
34
- "./utils/*": "./src/base/utils/*",
35
- "./theme/*": "./src/base/theme/*",
46
+ "./lib/*": {
47
+ "types": "./dist-lib/lib/*.d.ts",
48
+ "import": "./dist-lib/lib/*.js",
49
+ "default": "./dist-lib/lib/*.js"
50
+ },
51
+ "./shell/*": {
52
+ "types": "./dist-lib/base/shell/*.d.ts",
53
+ "import": "./dist-lib/base/shell/*.js",
54
+ "default": "./dist-lib/base/shell/*.js"
55
+ },
56
+ "./utils/*": {
57
+ "types": "./dist-lib/base/utils/*.d.ts",
58
+ "import": "./dist-lib/base/utils/*.js",
59
+ "default": "./dist-lib/base/utils/*.js"
60
+ },
61
+ "./theme/*": {
62
+ "types": "./dist-lib/base/theme/*.d.ts",
63
+ "import": "./dist-lib/base/theme/*.js",
64
+ "default": "./dist-lib/base/theme/*.js"
65
+ },
66
+ "./theme/*.css": "./dist-lib/base/theme/*.css",
67
+ "./theme/*.txt": "./dist-lib/base/theme/*.txt",
36
68
  "./themes/classic.css": "./src/base/theme/themes/classic.css"
37
69
  },
38
70
  "files": [
@@ -1 +0,0 @@
1
- /* /index.html 200
@@ -1,209 +0,0 @@
1
- {
2
- "description": "Example: GET /api/books -- Returns a list of books for the Moodle admin panel. Demonstrates a stack layout with a dense_table block including sortable columns, pagination, filters, row actions, and bulk actions.",
3
- "host": "moodle",
4
- "method": "GET",
5
- "contract": {
6
- "version": "1",
7
- "shell": "admin",
8
- "page": {
9
- "key": "books-list",
10
- "title": "Books",
11
- "breadcrumbs": [
12
- { "label": "Site Administration", "href": "/admin" },
13
- { "label": "Plugins", "href": "/admin/plugins" },
14
- { "label": "Books" }
15
- ],
16
- "actions": [
17
- {
18
- "id": "add-book",
19
- "label": "Add Book",
20
- "intent": "primary",
21
- "href": "/admin/books/new",
22
- "icon": "plus"
23
- }
24
- ],
25
- "filterTabs": [
26
- { "key": "all", "label": "All", "badge": 12 },
27
- { "key": "published", "label": "Published", "badge": 9 },
28
- { "key": "draft", "label": "Draft", "badge": 2 },
29
- { "key": "archived", "label": "Archived", "badge": 1 }
30
- ]
31
- },
32
- "layout": {
33
- "template": "stack",
34
- "meta": { "fullBleed": true },
35
- "regions": {
36
- "content": [
37
- {
38
- "type": "dense_table",
39
- "key": "books-table",
40
- "data": {
41
- "columns": [
42
- { "key": "title", "label": "Title", "variant": "text", "sortable": true, "searchable": true },
43
- { "key": "author", "label": "Author", "variant": "text", "sortable": true },
44
- { "key": "course", "label": "Course", "variant": "text", "sortable": true },
45
- { "key": "chapters", "label": "Chapters", "variant": "text", "sortable": true },
46
- { "key": "status", "label": "Status", "variant": "status", "sortable": true },
47
- { "key": "updated_at", "label": "Last Updated", "variant": "timestamp", "sortable": true }
48
- ],
49
- "rows": [
50
- {
51
- "id": "book-1",
52
- "title": "Introduction to Machine Learning",
53
- "author": "Dr. Sarah Chen",
54
- "course": "CS 301 - Artificial Intelligence",
55
- "chapters": "14",
56
- "status": "Published",
57
- "updated_at": 1746057600,
58
- "href": "/admin/books/book-1"
59
- },
60
- {
61
- "id": "book-2",
62
- "title": "Workplace Safety Handbook",
63
- "author": "Mark Johnson",
64
- "course": "NR-10 Safety Compliance",
65
- "chapters": "8",
66
- "status": "Published",
67
- "updated_at": 1745971200,
68
- "href": "/admin/books/book-2"
69
- },
70
- {
71
- "id": "book-3",
72
- "title": "Data Privacy & LGPD Guide",
73
- "author": "Ana Costa",
74
- "course": "Compliance Training",
75
- "chapters": "11",
76
- "status": "Published",
77
- "updated_at": 1745884800,
78
- "href": "/admin/books/book-3"
79
- },
80
- {
81
- "id": "book-4",
82
- "title": "Leadership Fundamentals",
83
- "author": "Carlos Mendes",
84
- "course": "Management Track",
85
- "chapters": "6",
86
- "status": "Draft",
87
- "updated_at": 1745798400,
88
- "href": "/admin/books/book-4"
89
- },
90
- {
91
- "id": "book-5",
92
- "title": "Onboarding Procedures v2",
93
- "author": "HR Team",
94
- "course": "Employee Onboarding",
95
- "chapters": "5",
96
- "status": "Draft",
97
- "updated_at": 1745712000,
98
- "href": "/admin/books/book-5"
99
- },
100
- {
101
- "id": "book-6",
102
- "title": "Advanced Excel for Finance",
103
- "author": "Julia Ferreira",
104
- "course": "Finance Skills",
105
- "chapters": "18",
106
- "status": "Published",
107
- "updated_at": 1745625600,
108
- "href": "/admin/books/book-6"
109
- }
110
- ],
111
- "pagination": {
112
- "page": 1,
113
- "perPage": 20,
114
- "total": 12,
115
- "lastPage": 1
116
- },
117
- "sort": {
118
- "column": "title",
119
- "direction": "asc"
120
- },
121
- "filters": {
122
- "available": [
123
- {
124
- "key": "status",
125
- "label": "Status",
126
- "type": "select",
127
- "options": [
128
- { "value": "Published", "label": "Published" },
129
- { "value": "Draft", "label": "Draft" },
130
- { "value": "Archived", "label": "Archived" }
131
- ]
132
- },
133
- {
134
- "key": "course",
135
- "label": "Course",
136
- "type": "select",
137
- "options": [
138
- { "value": "cs301", "label": "CS 301 - Artificial Intelligence" },
139
- { "value": "nr10", "label": "NR-10 Safety Compliance" },
140
- { "value": "compliance", "label": "Compliance Training" },
141
- { "value": "management", "label": "Management Track" }
142
- ]
143
- }
144
- ],
145
- "applied": {}
146
- },
147
- "rowActions": [
148
- {
149
- "id": "edit",
150
- "label": "Edit",
151
- "icon": "edit",
152
- "method": "get",
153
- "href": "/admin/books/${id}/edit"
154
- },
155
- {
156
- "id": "duplicate",
157
- "label": "Duplicate",
158
- "icon": "copy",
159
- "method": "post",
160
- "requiresConfirmation": true,
161
- "confirmation": {
162
- "title": "Duplicate Book",
163
- "message": "A copy of this book will be created as a draft. Continue?",
164
- "intent": "default",
165
- "confirmLabel": "Duplicate",
166
- "cancelLabel": "Cancel"
167
- }
168
- },
169
- {
170
- "id": "delete",
171
- "label": "Delete",
172
- "icon": "trash",
173
- "intent": "danger",
174
- "method": "delete",
175
- "requiresConfirmation": true,
176
- "confirmation": {
177
- "title": "Delete Book",
178
- "message": "This will permanently delete the book and all its chapters. This action cannot be undone.",
179
- "intent": "danger",
180
- "confirmLabel": "Delete",
181
- "cancelLabel": "Cancel"
182
- }
183
- }
184
- ],
185
- "bulkActions": [
186
- {
187
- "id": "publish",
188
- "label": "Publish Selected",
189
- "href": "/admin/books/bulk/publish",
190
- "method": "post"
191
- },
192
- {
193
- "id": "archive",
194
- "label": "Archive Selected",
195
- "href": "/admin/books/bulk/archive",
196
- "method": "post",
197
- "intent": "danger",
198
- "requiresConfirmation": true,
199
- "confirmationMessage": "Archive all selected books? They will no longer be visible to students."
200
- }
201
- ],
202
- "searchPlaceholder": "Search books by title or author..."
203
- }
204
- }
205
- ]
206
- }
207
- }
208
- }
209
- }
@@ -1,203 +0,0 @@
1
- {
2
- "description": "Example: GET /api/dashboard -- Returns the admin dashboard for Moodle. Demonstrates a dashboard layout with metric_card blocks in the metrics region and a dense_table in the content region.",
3
- "host": "moodle",
4
- "method": "GET",
5
- "contract": {
6
- "version": "1",
7
- "shell": "admin",
8
- "page": {
9
- "key": "admin-dashboard",
10
- "title": "Dashboard",
11
- "favoritable": false,
12
- "breadcrumbs": [
13
- { "label": "Site Administration" }
14
- ]
15
- },
16
- "layout": {
17
- "template": "dashboard",
18
- "regions": {
19
- "metrics": [
20
- {
21
- "type": "metric_card",
22
- "key": "metric-active-users",
23
- "data": {
24
- "value": 3842,
25
- "delta": "+12% this month",
26
- "deltaDirection": "positive",
27
- "label": "Active Users",
28
- "icon": "users",
29
- "href": "/admin/users"
30
- }
31
- },
32
- {
33
- "type": "metric_card",
34
- "key": "metric-courses",
35
- "data": {
36
- "value": 127,
37
- "delta": "+5 new",
38
- "deltaDirection": "positive",
39
- "label": "Active Courses",
40
- "icon": "graduation-cap",
41
- "href": "/admin/courses"
42
- }
43
- },
44
- {
45
- "type": "metric_card",
46
- "key": "metric-completions",
47
- "data": {
48
- "value": 1893,
49
- "delta": "+8% vs last month",
50
- "deltaDirection": "positive",
51
- "label": "Course Completions",
52
- "icon": "chart",
53
- "href": "/admin/reports/completions"
54
- }
55
- },
56
- {
57
- "type": "metric_card",
58
- "key": "metric-storage",
59
- "data": {
60
- "value": "42.7 GB",
61
- "delta": "68% of quota",
62
- "deltaDirection": "neutral",
63
- "label": "Storage Used",
64
- "icon": "hard-drive"
65
- }
66
- },
67
- {
68
- "type": "metric_card",
69
- "key": "metric-enrollments",
70
- "data": {
71
- "value": 562,
72
- "delta": "+89 this week",
73
- "deltaDirection": "positive",
74
- "label": "New Enrollments",
75
- "icon": "user-plus",
76
- "href": "/admin/enrolments"
77
- }
78
- },
79
- {
80
- "type": "metric_card",
81
- "key": "metric-compliance",
82
- "data": {
83
- "value": "91.3%",
84
- "delta": "-0.5%",
85
- "deltaDirection": "negative",
86
- "label": "Compliance Rate",
87
- "icon": "shield",
88
- "href": "/admin/compliance"
89
- }
90
- },
91
- {
92
- "type": "metric_card",
93
- "key": "metric-pending-tasks",
94
- "data": {
95
- "value": 18,
96
- "delta": "3 overdue",
97
- "deltaDirection": "negative",
98
- "label": "Pending Tasks",
99
- "icon": "clock",
100
- "href": "/admin/tasks"
101
- }
102
- },
103
- {
104
- "type": "metric_card",
105
- "key": "metric-certificates",
106
- "data": {
107
- "value": 234,
108
- "delta": "+42 issued this month",
109
- "deltaDirection": "positive",
110
- "label": "Certificates Issued",
111
- "icon": "file-export",
112
- "href": "/admin/certificates"
113
- }
114
- }
115
- ],
116
- "content": [
117
- {
118
- "type": "dense_table",
119
- "key": "recent-activity-table",
120
- "title": "Recent Activity",
121
- "data": {
122
- "columns": [
123
- { "key": "user", "label": "User", "variant": "text", "searchable": true },
124
- { "key": "action", "label": "Action", "variant": "text" },
125
- { "key": "target", "label": "Target", "variant": "text" },
126
- { "key": "status", "label": "Status", "variant": "status" },
127
- { "key": "timestamp", "label": "When", "variant": "timestamp", "sortable": true }
128
- ],
129
- "rows": [
130
- {
131
- "id": "act-1",
132
- "user": "Maria Santos",
133
- "action": "Completed course",
134
- "target": "NR-10 Safety Compliance",
135
- "status": "Success",
136
- "timestamp": 1746057600
137
- },
138
- {
139
- "id": "act-2",
140
- "user": "System (Cron)",
141
- "action": "Backup completed",
142
- "target": "Full site backup",
143
- "status": "Success",
144
- "timestamp": 1746054000
145
- },
146
- {
147
- "id": "act-3",
148
- "user": "Pedro Oliveira",
149
- "action": "Enrolled in course",
150
- "target": "Leadership Fundamentals",
151
- "status": "Pending",
152
- "timestamp": 1746050400
153
- },
154
- {
155
- "id": "act-4",
156
- "user": "SAP Connector",
157
- "action": "User sync failed",
158
- "target": "SAP SuccessFactors",
159
- "status": "Error",
160
- "timestamp": 1746046800
161
- },
162
- {
163
- "id": "act-5",
164
- "user": "Admin",
165
- "action": "Published course",
166
- "target": "Data Privacy & LGPD Guide",
167
- "status": "Success",
168
- "timestamp": 1746043200
169
- }
170
- ],
171
- "pagination": {
172
- "page": 1,
173
- "perPage": 10,
174
- "total": 48,
175
- "lastPage": 5
176
- },
177
- "sort": {
178
- "column": "timestamp",
179
- "direction": "desc"
180
- },
181
- "filters": {
182
- "available": [
183
- {
184
- "key": "status",
185
- "label": "Status",
186
- "type": "select",
187
- "options": [
188
- { "value": "Success", "label": "Success" },
189
- { "value": "Pending", "label": "Pending" },
190
- { "value": "Error", "label": "Error" }
191
- ]
192
- }
193
- ],
194
- "applied": {}
195
- },
196
- "searchPlaceholder": "Search activity..."
197
- }
198
- }
199
- ]
200
- }
201
- }
202
- }
203
- }