nuxt-ui-tools 1.0.1 → 1.1.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 (226) hide show
  1. package/dist/module.d.mts +3 -0
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +37 -0
  4. package/dist/runtime/dashboard/components/block/dashboard-block-state.d.vue.ts +12 -0
  5. package/dist/runtime/dashboard/components/block/dashboard-block-state.vue +59 -0
  6. package/dist/runtime/dashboard/components/block/dashboard-block-state.vue.d.ts +12 -0
  7. package/dist/runtime/dashboard/components/block/dashboard-data-table.d.vue.ts +9 -0
  8. package/dist/runtime/dashboard/components/block/dashboard-data-table.vue +47 -0
  9. package/dist/runtime/dashboard/components/block/dashboard-data-table.vue.d.ts +9 -0
  10. package/dist/runtime/dashboard/components/block/dashboard-ring.d.vue.ts +34 -0
  11. package/dist/runtime/dashboard/components/block/dashboard-ring.vue +91 -0
  12. package/dist/runtime/dashboard/components/block/dashboard-ring.vue.d.ts +34 -0
  13. package/dist/runtime/dashboard/components/block/dashboard-row-actions.d.vue.ts +13 -0
  14. package/dist/runtime/dashboard/components/block/dashboard-row-actions.vue +49 -0
  15. package/dist/runtime/dashboard/components/block/dashboard-row-actions.vue.d.ts +13 -0
  16. package/dist/runtime/dashboard/components/block/dashboard-skeleton.d.vue.ts +34 -0
  17. package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue +312 -0
  18. package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue.d.ts +34 -0
  19. package/dist/runtime/dashboard/components/charts/renderer.d.ts +43 -0
  20. package/dist/runtime/dashboard/components/charts/renderer.js +34 -0
  21. package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.d.vue.ts +18 -0
  22. package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.vue +45 -0
  23. package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.vue.d.ts +18 -0
  24. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.d.vue.ts +14 -0
  25. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.vue +190 -0
  26. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.vue.d.ts +14 -0
  27. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.d.vue.ts +13 -0
  28. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.vue +72 -0
  29. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.vue.d.ts +13 -0
  30. package/dist/runtime/dashboard/components/charts/unovis/xy-layers.d.ts +43 -0
  31. package/dist/runtime/dashboard/components/charts/unovis/xy-layers.js +60 -0
  32. package/dist/runtime/dashboard/components/dashboard-alerts.d.vue.ts +49 -0
  33. package/dist/runtime/dashboard/components/dashboard-alerts.vue +226 -0
  34. package/dist/runtime/dashboard/components/dashboard-alerts.vue.d.ts +49 -0
  35. package/dist/runtime/dashboard/components/dashboard-bar-chart.d.vue.ts +53 -0
  36. package/dist/runtime/dashboard/components/dashboard-bar-chart.vue +131 -0
  37. package/dist/runtime/dashboard/components/dashboard-bar-chart.vue.d.ts +53 -0
  38. package/dist/runtime/dashboard/components/dashboard-bars.d.vue.ts +49 -0
  39. package/dist/runtime/dashboard/components/dashboard-bars.vue +187 -0
  40. package/dist/runtime/dashboard/components/dashboard-bars.vue.d.ts +49 -0
  41. package/dist/runtime/dashboard/components/dashboard-card.d.vue.ts +47 -0
  42. package/dist/runtime/dashboard/components/dashboard-card.vue +316 -0
  43. package/dist/runtime/dashboard/components/dashboard-card.vue.d.ts +47 -0
  44. package/dist/runtime/dashboard/components/dashboard-combo-chart.d.vue.ts +52 -0
  45. package/dist/runtime/dashboard/components/dashboard-combo-chart.vue +128 -0
  46. package/dist/runtime/dashboard/components/dashboard-combo-chart.vue.d.ts +52 -0
  47. package/dist/runtime/dashboard/components/dashboard-donut-chart.d.vue.ts +48 -0
  48. package/dist/runtime/dashboard/components/dashboard-donut-chart.vue +216 -0
  49. package/dist/runtime/dashboard/components/dashboard-donut-chart.vue.d.ts +48 -0
  50. package/dist/runtime/dashboard/components/dashboard-feed.d.vue.ts +49 -0
  51. package/dist/runtime/dashboard/components/dashboard-feed.vue +238 -0
  52. package/dist/runtime/dashboard/components/dashboard-feed.vue.d.ts +49 -0
  53. package/dist/runtime/dashboard/components/dashboard-funnel.d.vue.ts +34 -0
  54. package/dist/runtime/dashboard/components/dashboard-funnel.vue +157 -0
  55. package/dist/runtime/dashboard/components/dashboard-funnel.vue.d.ts +34 -0
  56. package/dist/runtime/dashboard/components/dashboard-gauge.d.vue.ts +55 -0
  57. package/dist/runtime/dashboard/components/dashboard-gauge.vue +177 -0
  58. package/dist/runtime/dashboard/components/dashboard-gauge.vue.d.ts +55 -0
  59. package/dist/runtime/dashboard/components/dashboard-grid.d.vue.ts +38 -0
  60. package/dist/runtime/dashboard/components/dashboard-grid.vue +49 -0
  61. package/dist/runtime/dashboard/components/dashboard-grid.vue.d.ts +38 -0
  62. package/dist/runtime/dashboard/components/dashboard-legend.d.vue.ts +8 -0
  63. package/dist/runtime/dashboard/components/dashboard-legend.vue +37 -0
  64. package/dist/runtime/dashboard/components/dashboard-legend.vue.d.ts +8 -0
  65. package/dist/runtime/dashboard/components/dashboard-line-chart.d.vue.ts +46 -0
  66. package/dist/runtime/dashboard/components/dashboard-line-chart.vue +129 -0
  67. package/dist/runtime/dashboard/components/dashboard-line-chart.vue.d.ts +46 -0
  68. package/dist/runtime/dashboard/components/dashboard-list.d.vue.ts +63 -0
  69. package/dist/runtime/dashboard/components/dashboard-list.vue +239 -0
  70. package/dist/runtime/dashboard/components/dashboard-list.vue.d.ts +63 -0
  71. package/dist/runtime/dashboard/components/dashboard-paired-bars.d.vue.ts +43 -0
  72. package/dist/runtime/dashboard/components/dashboard-paired-bars.vue +194 -0
  73. package/dist/runtime/dashboard/components/dashboard-paired-bars.vue.d.ts +43 -0
  74. package/dist/runtime/dashboard/components/dashboard-refresh.d.vue.ts +29 -0
  75. package/dist/runtime/dashboard/components/dashboard-refresh.vue +86 -0
  76. package/dist/runtime/dashboard/components/dashboard-refresh.vue.d.ts +29 -0
  77. package/dist/runtime/dashboard/components/dashboard-relative-time.d.vue.ts +12 -0
  78. package/dist/runtime/dashboard/components/dashboard-relative-time.vue +23 -0
  79. package/dist/runtime/dashboard/components/dashboard-relative-time.vue.d.ts +12 -0
  80. package/dist/runtime/dashboard/components/dashboard-stack-bar.d.vue.ts +36 -0
  81. package/dist/runtime/dashboard/components/dashboard-stack-bar.vue +162 -0
  82. package/dist/runtime/dashboard/components/dashboard-stack-bar.vue.d.ts +36 -0
  83. package/dist/runtime/dashboard/components/dashboard-stat.d.vue.ts +69 -0
  84. package/dist/runtime/dashboard/components/dashboard-stat.vue +279 -0
  85. package/dist/runtime/dashboard/components/dashboard-stat.vue.d.ts +69 -0
  86. package/dist/runtime/dashboard/components/dashboard-stats.d.vue.ts +38 -0
  87. package/dist/runtime/dashboard/components/dashboard-stats.vue +202 -0
  88. package/dist/runtime/dashboard/components/dashboard-stats.vue.d.ts +38 -0
  89. package/dist/runtime/dashboard/components/dashboard-table.d.vue.ts +52 -0
  90. package/dist/runtime/dashboard/components/dashboard-table.vue +305 -0
  91. package/dist/runtime/dashboard/components/dashboard-table.vue.d.ts +52 -0
  92. package/dist/runtime/dashboard/components/dashboard-tabs.d.vue.ts +35 -0
  93. package/dist/runtime/dashboard/components/dashboard-tabs.vue +55 -0
  94. package/dist/runtime/dashboard/components/dashboard-tabs.vue.d.ts +35 -0
  95. package/dist/runtime/dashboard/components/dashboard-total.d.vue.ts +10 -0
  96. package/dist/runtime/dashboard/components/dashboard-total.vue +32 -0
  97. package/dist/runtime/dashboard/components/dashboard-total.vue.d.ts +10 -0
  98. package/dist/runtime/dashboard/components/dashboard-widget.d.vue.ts +46 -0
  99. package/dist/runtime/dashboard/components/dashboard-widget.vue +84 -0
  100. package/dist/runtime/dashboard/components/dashboard-widget.vue.d.ts +46 -0
  101. package/dist/runtime/dashboard/composables/use-dashboard-api.d.ts +15 -0
  102. package/dist/runtime/dashboard/composables/use-dashboard-api.js +91 -0
  103. package/dist/runtime/dashboard/composables/use-dashboard-block.d.ts +22 -0
  104. package/dist/runtime/dashboard/composables/use-dashboard-block.js +35 -0
  105. package/dist/runtime/dashboard/composables/use-dashboard-chart.d.ts +36 -0
  106. package/dist/runtime/dashboard/composables/use-dashboard-chart.js +118 -0
  107. package/dist/runtime/dashboard/composables/use-dashboard-derived.d.ts +12 -0
  108. package/dist/runtime/dashboard/composables/use-dashboard-derived.js +47 -0
  109. package/dist/runtime/dashboard/composables/use-dashboard-format.d.ts +6 -0
  110. package/dist/runtime/dashboard/composables/use-dashboard-format.js +12 -0
  111. package/dist/runtime/dashboard/composables/use-dashboard-options.d.ts +8 -0
  112. package/dist/runtime/dashboard/composables/use-dashboard-options.js +63 -0
  113. package/dist/runtime/dashboard/composables/use-dashboard-param-scope.d.ts +30 -0
  114. package/dist/runtime/dashboard/composables/use-dashboard-param-scope.js +71 -0
  115. package/dist/runtime/dashboard/composables/use-dashboard-remote-options.d.ts +12 -0
  116. package/dist/runtime/dashboard/composables/use-dashboard-remote-options.js +117 -0
  117. package/dist/runtime/dashboard/composables/use-dashboard-resource.d.ts +35 -0
  118. package/dist/runtime/dashboard/composables/use-dashboard-resource.js +80 -0
  119. package/dist/runtime/dashboard/composables/use-dashboard-scope.d.ts +46 -0
  120. package/dist/runtime/dashboard/composables/use-dashboard-scope.js +127 -0
  121. package/dist/runtime/dashboard/composables/use-dashboard-time.d.ts +13 -0
  122. package/dist/runtime/dashboard/composables/use-dashboard-time.js +40 -0
  123. package/dist/runtime/dashboard/composables/use-dashboard-ui.d.ts +22 -0
  124. package/dist/runtime/dashboard/composables/use-dashboard-ui.js +19 -0
  125. package/dist/runtime/dashboard/composables/use-dashboard-views.d.ts +46 -0
  126. package/dist/runtime/dashboard/composables/use-dashboard-views.js +49 -0
  127. package/dist/runtime/dashboard/composables/use-dashboard.d.ts +24 -0
  128. package/dist/runtime/dashboard/composables/use-dashboard.js +42 -0
  129. package/dist/runtime/dashboard/constants/query.d.ts +16 -0
  130. package/dist/runtime/dashboard/constants/query.js +15 -0
  131. package/dist/runtime/dashboard/index.d.ts +4 -0
  132. package/dist/runtime/dashboard/index.js +3 -0
  133. package/dist/runtime/dashboard/schema/index.d.ts +57 -0
  134. package/dist/runtime/dashboard/schema/index.js +3 -0
  135. package/dist/runtime/dashboard/types/blocks.d.ts +251 -0
  136. package/dist/runtime/dashboard/types/blocks.js +0 -0
  137. package/dist/runtime/dashboard/types/charts.d.ts +60 -0
  138. package/dist/runtime/dashboard/types/charts.js +0 -0
  139. package/dist/runtime/dashboard/types/index.d.ts +7 -0
  140. package/dist/runtime/dashboard/types/index.js +0 -0
  141. package/dist/runtime/dashboard/types/options.d.ts +46 -0
  142. package/dist/runtime/dashboard/types/options.js +0 -0
  143. package/dist/runtime/dashboard/types/params.d.ts +115 -0
  144. package/dist/runtime/dashboard/types/params.js +0 -0
  145. package/dist/runtime/dashboard/types/resource.d.ts +106 -0
  146. package/dist/runtime/dashboard/types/resource.js +0 -0
  147. package/dist/runtime/dashboard/types/runtime.d.ts +44 -0
  148. package/dist/runtime/dashboard/types/runtime.js +0 -0
  149. package/dist/runtime/dashboard/types/schema.d.ts +171 -0
  150. package/dist/runtime/dashboard/types/schema.js +0 -0
  151. package/dist/runtime/dashboard/types/ui.d.ts +201 -0
  152. package/dist/runtime/dashboard/types/ui.js +0 -0
  153. package/dist/runtime/dashboard/utils/builders/dashboard-params.d.ts +85 -0
  154. package/dist/runtime/dashboard/utils/builders/dashboard-params.js +87 -0
  155. package/dist/runtime/dashboard/utils/chart-frame.d.ts +5 -0
  156. package/dist/runtime/dashboard/utils/chart-frame.js +27 -0
  157. package/dist/runtime/dashboard/utils/charts.d.ts +61 -0
  158. package/dist/runtime/dashboard/utils/charts.js +142 -0
  159. package/dist/runtime/dashboard/utils/comparison.d.ts +15 -0
  160. package/dist/runtime/dashboard/utils/comparison.js +19 -0
  161. package/dist/runtime/dashboard/utils/export.d.ts +13 -0
  162. package/dist/runtime/dashboard/utils/export.js +45 -0
  163. package/dist/runtime/dashboard/utils/options.d.ts +12 -0
  164. package/dist/runtime/dashboard/utils/options.js +23 -0
  165. package/dist/runtime/dashboard/utils/params/codecs.d.ts +14 -0
  166. package/dist/runtime/dashboard/utils/params/codecs.js +69 -0
  167. package/dist/runtime/dashboard/utils/resource.d.ts +16 -0
  168. package/dist/runtime/dashboard/utils/resource.js +39 -0
  169. package/dist/runtime/dashboard/utils/schema.d.ts +9 -0
  170. package/dist/runtime/dashboard/utils/schema.js +31 -0
  171. package/dist/runtime/dashboard/utils/sparkline.d.ts +21 -0
  172. package/dist/runtime/dashboard/utils/sparkline.js +53 -0
  173. package/dist/runtime/dashboard/utils/state.d.ts +28 -0
  174. package/dist/runtime/dashboard/utils/state.js +32 -0
  175. package/dist/runtime/dashboard/utils/time.d.ts +17 -0
  176. package/dist/runtime/dashboard/utils/time.js +60 -0
  177. package/dist/runtime/dashboard/utils/tracker.d.ts +12 -0
  178. package/dist/runtime/dashboard/utils/tracker.js +31 -0
  179. package/dist/runtime/dashboard/utils/ui.d.ts +38 -0
  180. package/dist/runtime/dashboard/utils/ui.js +24 -0
  181. package/dist/runtime/dashboard/utils/visibility.d.ts +2 -0
  182. package/dist/runtime/dashboard/utils/visibility.js +25 -0
  183. package/dist/runtime/form/types/options.d.ts +15 -36
  184. package/dist/runtime/i18n/locales/en.js +62 -0
  185. package/dist/runtime/i18n/locales/fr.js +62 -0
  186. package/dist/runtime/i18n/types.d.ts +67 -0
  187. package/dist/runtime/shared/index.d.ts +2 -0
  188. package/dist/runtime/shared/styles/tokens.css +1 -1
  189. package/dist/runtime/shared/types/query.d.ts +10 -0
  190. package/dist/runtime/shared/types/query.js +0 -0
  191. package/dist/runtime/shared/types/remote-options.d.ts +37 -0
  192. package/dist/runtime/shared/types/remote-options.js +0 -0
  193. package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.d.vue.ts +2 -2
  194. package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.vue.d.ts +2 -2
  195. package/dist/runtime/spreadsheet/composables/use-spreadsheet-internals.d.ts +15 -15
  196. package/dist/runtime/spreadsheet/composables/use-spreadsheet-resolutions.d.ts +2 -2
  197. package/dist/runtime/spreadsheet/schema/normalize.d.ts +1 -1
  198. package/dist/runtime/spreadsheet/utils/references/sources.d.ts +1 -1
  199. package/dist/runtime/table/components/data-list/data-list-content.d.vue.ts +1 -1
  200. package/dist/runtime/table/components/data-list/data-list-content.vue.d.ts +1 -1
  201. package/dist/runtime/table/components/data-list/data-list-infinite-loader.d.vue.ts +1 -1
  202. package/dist/runtime/table/components/data-list/data-list-infinite-loader.vue.d.ts +1 -1
  203. package/dist/runtime/table/components/data-list/data-list-layout-switch.d.vue.ts +1 -1
  204. package/dist/runtime/table/components/data-list/data-list-layout-switch.vue.d.ts +1 -1
  205. package/dist/runtime/table/components/data-list/data-list-pagination.d.vue.ts +1 -1
  206. package/dist/runtime/table/components/data-list/data-list-pagination.vue.d.ts +1 -1
  207. package/dist/runtime/table/components/data-list/data-list-sort-menu.d.vue.ts +1 -1
  208. package/dist/runtime/table/components/data-list/data-list-sort-menu.vue.d.ts +1 -1
  209. package/dist/runtime/table/components/data-list/sort-menu-panel.d.vue.ts +2 -2
  210. package/dist/runtime/table/components/data-list/sort-menu-panel.vue.d.ts +2 -2
  211. package/dist/runtime/table/components/filters/shared/filter-match-mode-button.d.vue.ts +1 -1
  212. package/dist/runtime/table/components/filters/shared/filter-match-mode-button.vue.d.ts +1 -1
  213. package/dist/runtime/table/components/layout/table-footer.d.vue.ts +1 -1
  214. package/dist/runtime/table/components/layout/table-footer.vue.d.ts +1 -1
  215. package/dist/runtime/table/components/table/table-cell-ellipsis.d.ts +1 -1
  216. package/dist/runtime/table/composables/use-query-state.d.ts +3 -3
  217. package/dist/runtime/table/composables/use-table-columns.d.ts +3 -3
  218. package/dist/runtime/table/composables/use-table-internals.d.ts +27 -27
  219. package/dist/runtime/table/composables/use-table-pagination.d.ts +2 -2
  220. package/dist/runtime/table/composables/use-table-selection.d.ts +1 -1
  221. package/dist/runtime/table/composables/use-table-state.d.ts +3 -3
  222. package/dist/runtime/table/types/source.d.ts +4 -5
  223. package/dist/runtime/table/utils/columns/menu.d.ts +1 -1
  224. package/dist/runtime/table/utils/columns/state.d.ts +1 -1
  225. package/dist/runtime/table/utils/data-list-ui.d.ts +1 -1
  226. package/package.json +28 -1
@@ -0,0 +1,226 @@
1
+ <script setup>
2
+ import UButton from "@nuxt/ui/components/Button.vue";
3
+ import UIcon from "@nuxt/ui/components/Icon.vue";
4
+ import { computed } from "vue";
5
+ import { useUiToolsLocale } from "#ui-tools/i18n";
6
+ import { isNumber } from "#ui-tools/shared/utils/predicate";
7
+ import { resolveTextValue } from "#ui-tools/shared/utils/render";
8
+ import { useDashboardFormat } from "../composables/use-dashboard-format";
9
+ import { useDashboardUi } from "../composables/use-dashboard-ui";
10
+ import { toDashboardCell } from "../utils/export";
11
+ import {
12
+ DASHBOARD_ROW_BUTTON,
13
+ DASHBOARD_SELECTABLE_ROW,
14
+ DASHBOARD_SELECTED_ROW,
15
+ resolveDashboardClasses
16
+ } from "../utils/ui";
17
+ import DashboardRowActionsMenu from "./block/dashboard-row-actions.vue";
18
+ import DashboardSkeleton from "./block/dashboard-skeleton.vue";
19
+ import DashboardCard from "./dashboard-card.vue";
20
+ const {
21
+ source,
22
+ card = true,
23
+ menu = void 0,
24
+ freshness = void 0,
25
+ severity,
26
+ label,
27
+ description,
28
+ value,
29
+ format,
30
+ icon,
31
+ action,
32
+ order = "severity",
33
+ limit,
34
+ rowKey,
35
+ selected,
36
+ rowActions,
37
+ onSelect,
38
+ empty,
39
+ ui,
40
+ ...block
41
+ } = defineProps({
42
+ title: { type: [String, Number, Function], required: false },
43
+ subtitle: { type: [String, Number, Function], required: false },
44
+ size: { type: String, required: false },
45
+ rows: { type: String, required: false },
46
+ card: { type: Boolean, required: false },
47
+ activation: { type: String, required: false },
48
+ empty: { type: Object, required: false },
49
+ menu: { type: [Boolean, Array, Function], required: false },
50
+ actions: { type: Array, required: false },
51
+ freshness: { type: Boolean, required: false },
52
+ source: { type: Object, required: true },
53
+ severity: { type: Function, required: true },
54
+ label: { type: Function, required: true },
55
+ description: { type: Function, required: false },
56
+ value: { type: Function, required: false },
57
+ format: { type: Function, required: false },
58
+ icon: { type: Function, required: false },
59
+ action: { type: Function, required: false },
60
+ order: { type: String, required: false },
61
+ limit: { type: Number, required: false },
62
+ rowKey: { type: Function, required: false },
63
+ selected: { type: Function, required: false },
64
+ rowActions: { type: Function, required: false },
65
+ onSelect: { type: Function, required: false },
66
+ ui: { type: Object, required: false }
67
+ });
68
+ defineSlots();
69
+ const { t } = useUiToolsLocale();
70
+ const formats = useDashboardFormat();
71
+ const appUi = useDashboardUi();
72
+ const classes = computed(
73
+ () => resolveDashboardClasses(
74
+ {
75
+ action: "relative z-[1] shrink-0",
76
+ description: "block truncate text-xs text-muted",
77
+ icon: "grid size-8 shrink-0 place-items-center rounded-lg",
78
+ label: "block truncate text-[13px] font-medium text-default",
79
+ row: "flex min-w-0 items-center gap-3 py-2.5",
80
+ value: "shrink-0 text-sm font-semibold text-highlighted tabular-nums"
81
+ },
82
+ appUi.value.alerts,
83
+ ui
84
+ )
85
+ );
86
+ const rank = { error: 0, info: 2, success: 3, warning: 1 };
87
+ const icons = {
88
+ error: "i-lucide-octagon-alert",
89
+ info: "i-lucide-info",
90
+ success: "i-lucide-circle-check",
91
+ warning: "i-lucide-triangle-alert"
92
+ };
93
+ const entries = computed(() => {
94
+ const rows = (source.data ?? []).map((row, index) => {
95
+ const level = severity(row);
96
+ const raw = value?.(row);
97
+ const button = action?.(row);
98
+ return {
99
+ action: button ? { ...button, label: resolveTextValue(button.label) } : null,
100
+ actions: rowActions?.(row, index) ?? [],
101
+ color: `var(--ui-${level})`,
102
+ description: description ? resolveTextValue(description(row)) : "",
103
+ icon: icon?.(row) ?? icons[level],
104
+ index,
105
+ key: rowKey?.(row, index) ?? index,
106
+ label: resolveTextValue(label(row)),
107
+ level,
108
+ raw,
109
+ row,
110
+ selected: selected?.(row, index) ?? false,
111
+ value: raw === null || raw === void 0 ? "" : isNumber(raw) ? (format ?? formats.number.value)(raw) : resolveTextValue(raw)
112
+ };
113
+ });
114
+ return order === "severity" ? rows.sort((a, b) => rank[a.level] - rank[b.level]) : rows;
115
+ });
116
+ const visible = (expanded) => limit && !expanded ? entries.value.slice(0, limit) : entries.value;
117
+ const emptyContent = computed(() => ({
118
+ icon: "i-lucide-circle-check",
119
+ title: t("dashboard.alerts.empty"),
120
+ ...empty
121
+ }));
122
+ function tabulate() {
123
+ const columns = [
124
+ { key: "severity", label: t("dashboard.table.severity"), numeric: false },
125
+ { key: "label", label: t("dashboard.table.label"), numeric: false },
126
+ description && { key: "description", label: t("dashboard.table.description"), numeric: false },
127
+ value && { key: "value", label: t("dashboard.table.value"), numeric: true }
128
+ ];
129
+ return {
130
+ columns: columns.filter((column) => column !== void 0),
131
+ rows: entries.value.map(
132
+ (entry) => [
133
+ toDashboardCell(t(`dashboard.alerts.severity.${entry.level}`)),
134
+ toDashboardCell(entry.label),
135
+ description && toDashboardCell(entry.description),
136
+ value && toDashboardCell(isNumber(entry.raw) ? entry.raw : entry.value, entry.value)
137
+ ].filter((cell) => cell !== void 0)
138
+ )
139
+ };
140
+ }
141
+ </script>
142
+
143
+ <template>
144
+ <DashboardCard
145
+ v-bind="block"
146
+ :card
147
+ :menu
148
+ :freshness
149
+ :ui
150
+ :source
151
+ :empty="emptyContent"
152
+ :is-empty="entries.length === 0"
153
+ :tabulate
154
+ >
155
+ <template #skeleton>
156
+ <DashboardSkeleton kind="rows" leading="icon" :count="limit ?? 4" />
157
+ </template>
158
+ <template v-if="$slots['header-right']" #header-right>
159
+ <slot name="header-right" />
160
+ </template>
161
+ <template v-if="$slots.toolbar" #toolbar>
162
+ <slot name="toolbar" />
163
+ </template>
164
+ <template v-if="$slots.footer" #footer>
165
+ <slot name="footer" />
166
+ </template>
167
+
168
+ <template #default="{ expanded }">
169
+ <ul class="flex flex-col divide-y divide-[var(--nut-dash-grid)]">
170
+ <li
171
+ v-for="entry in visible(expanded)"
172
+ :key="entry.key"
173
+ :data-severity="entry.level"
174
+ :data-selected="entry.selected || void 0"
175
+ :class="[
176
+ classes.row,
177
+ onSelect && DASHBOARD_SELECTABLE_ROW,
178
+ entry.selected && DASHBOARD_SELECTED_ROW
179
+ ]"
180
+ >
181
+ <span
182
+ :class="classes.icon"
183
+ :style="{
184
+ background: `color-mix(in oklab, ${entry.color} 12%, transparent)`,
185
+ color: entry.color
186
+ }"
187
+ >
188
+ <UIcon :name="entry.icon" class="size-4" />
189
+ <span class="sr-only">{{ t(`dashboard.alerts.severity.${entry.level}`) }}</span>
190
+ </span>
191
+ <div class="min-w-0 flex-1">
192
+ <b :class="classes.label">{{ entry.label }}</b>
193
+ <small v-if="entry.description" :class="classes.description">
194
+ {{ entry.description }}
195
+ </small>
196
+ </div>
197
+ <span v-if="entry.value" :class="classes.value">{{ entry.value }}</span>
198
+ <button
199
+ v-if="onSelect"
200
+ type="button"
201
+ :class="DASHBOARD_ROW_BUTTON"
202
+ :aria-label="entry.label"
203
+ :aria-pressed="selected ? entry.selected : void 0"
204
+ @click="onSelect({ index: entry.index, row: entry.row })"
205
+ />
206
+ <UButton
207
+ v-if="entry.action"
208
+ color="neutral"
209
+ variant="outline"
210
+ size="xs"
211
+ :label="entry.action.label"
212
+ :icon="entry.action.icon"
213
+ :to="entry.action.to"
214
+ :class="classes.action"
215
+ @click="entry.action.onClick"
216
+ />
217
+ <DashboardRowActionsMenu
218
+ v-if="entry.actions.length"
219
+ :actions="entry.actions"
220
+ :label="entry.label"
221
+ />
222
+ </li>
223
+ </ul>
224
+ </template>
225
+ </DashboardCard>
226
+ </template>
@@ -0,0 +1,49 @@
1
+ import type { LazyTextValue } from '#ui-tools/shared/types/utils';
2
+ import type { DashboardAlertAction, DashboardAlertSeverity, DashboardAlertsUi, DashboardBlockBaseProps, DashboardBlockUi, DashboardRowActions, DashboardSelected, DashboardSelectEvent, DashboardSourceLike, DashboardValueFormat } from '../types/index.js';
3
+ declare const __VLS_export: <TRow>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<Omit<DashboardBlockBaseProps, "ui"> & {
5
+ source: DashboardSourceLike<readonly TRow[] | undefined>;
6
+ severity: (row: TRow) => DashboardAlertSeverity;
7
+ /** What needs attention. */
8
+ label: (row: TRow) => LazyTextValue;
9
+ description?: (row: TRow) => LazyTextValue | undefined;
10
+ /** Trailing figure (a count, an amount). Numbers go through `format`. */
11
+ value?: (row: TRow) => LazyTextValue | null | undefined;
12
+ format?: DashboardValueFormat;
13
+ /** Icon of the row. Defaults to the severity's icon. */
14
+ icon?: (row: TRow) => string | undefined;
15
+ /** Button at the end of the row (a link or a handler). */
16
+ action?: (row: TRow) => DashboardAlertAction | null | undefined;
17
+ /** `severity` (default): most severe first, ties in source order. `source`: as received. */
18
+ order?: "severity" | "source";
19
+ /** Rows shown in the card. The expand dialog, table view, and CSV export show them all. */
20
+ limit?: number;
21
+ rowKey?: (row: TRow, index: number) => PropertyKey;
22
+ /** Rows shown as selected (the value a `select` handler stored). */
23
+ selected?: DashboardSelected<TRow>;
24
+ /** More actions of each row: inline icon buttons and a `⋮` menu after its `action`. */
25
+ rowActions?: DashboardRowActions<TRow>;
26
+ /** Makes each row a button (next to its `action`). */
27
+ onSelect?: (event: DashboardSelectEvent<TRow>) => void;
28
+ ui?: DashboardBlockUi & DashboardAlertsUi;
29
+ }> & (typeof globalThis extends {
30
+ __VLS_PROPS_FALLBACK: infer P;
31
+ } ? P : {});
32
+ expose: (exposed: {}) => void;
33
+ attrs: any;
34
+ slots: {
35
+ 'header-right'?: () => unknown;
36
+ toolbar?: () => unknown;
37
+ footer?: () => unknown;
38
+ };
39
+ emit: {};
40
+ }>) => import("vue").VNode & {
41
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
42
+ };
43
+ declare const _default: typeof __VLS_export;
44
+ export default _default;
45
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
46
+ [K in keyof T]: T[K];
47
+ } : {
48
+ [K in keyof T as K]: T[K];
49
+ }) & {};
@@ -0,0 +1,53 @@
1
+ import type { LazyTextValue } from '#ui-tools/shared/types/utils';
2
+ import type { DashboardAxisOptions, DashboardBlockBaseProps, DashboardHighlight, DashboardReferenceLine, DashboardSelected, DashboardSelectEvent, DashboardSeries, DashboardSourceLike, DashboardValueFormat } from '../types/index.js';
3
+ declare const __VLS_export: <TRow>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<DashboardBlockBaseProps & {
5
+ source: DashboardSourceLike<readonly TRow[] | undefined>;
6
+ /** Category of each row (month, account…). Rows are plotted in order. */
7
+ x: (row: TRow, index: number) => string | number | Date;
8
+ xFormat?: (value: string | number | Date) => string;
9
+ /** Header of the category column in the table view and CSV export. */
10
+ xLabel?: LazyTextValue;
11
+ series: readonly DashboardSeries<TRow>[];
12
+ /** Dashed line drawn over the bars, e.g. the previous period. */
13
+ comparison?: DashboardSeries<TRow>;
14
+ stacked?: boolean;
15
+ yAxis?: DashboardAxisOptions;
16
+ /** Value format for the axis and tooltips. */
17
+ format?: DashboardValueFormat;
18
+ reference?: DashboardReferenceLine | readonly DashboardReferenceLine[];
19
+ /** Chart height in pixels. */
20
+ height?: number;
21
+ /** Series legend in the header. */
22
+ legend?: boolean;
23
+ /** Expected number of x positions, drawn by the loading skeleton before data arrives. */
24
+ points?: number;
25
+ /** Bars drawn at full strength (`max`, `min`, `last`, or an accessor); the others fade. */
26
+ highlight?: DashboardHighlight<TRow>;
27
+ /** Rows shown as selected: their bars stay, the others fade (wins over `highlight`). */
28
+ selected?: DashboardSelected<TRow>;
29
+ /** Prints each group's value above its bars (the stack total when `stacked`). */
30
+ labels?: boolean;
31
+ /** A click on the chart selects the x position under the pointer. */
32
+ onSelect?: (event: DashboardSelectEvent<TRow>) => void;
33
+ }> & (typeof globalThis extends {
34
+ __VLS_PROPS_FALLBACK: infer P;
35
+ } ? P : {});
36
+ expose: (exposed: {}) => void;
37
+ attrs: any;
38
+ slots: {
39
+ 'header-right'?: () => unknown;
40
+ toolbar?: () => unknown;
41
+ footer?: () => unknown;
42
+ };
43
+ emit: {};
44
+ }>) => import("vue").VNode & {
45
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
46
+ };
47
+ declare const _default: typeof __VLS_export;
48
+ export default _default;
49
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
50
+ [K in keyof T]: T[K];
51
+ } : {
52
+ [K in keyof T as K]: T[K];
53
+ }) & {};
@@ -0,0 +1,131 @@
1
+ <script setup>
2
+ import { useMounted } from "@vueuse/core";
3
+ import { computed } from "vue";
4
+ import {
5
+ resolveDashboardExpandedHeight,
6
+ useDashboardChart
7
+ } from "../composables/use-dashboard-chart";
8
+ import DashboardSkeleton from "./block/dashboard-skeleton.vue";
9
+ import { dashboardChartRenderer } from "./charts/renderer";
10
+ import DashboardCard from "./dashboard-card.vue";
11
+ const {
12
+ source,
13
+ card = true,
14
+ menu = void 0,
15
+ freshness = void 0,
16
+ x,
17
+ xFormat,
18
+ xLabel,
19
+ series,
20
+ comparison,
21
+ stacked = false,
22
+ yAxis,
23
+ format,
24
+ reference,
25
+ height = 250,
26
+ legend = true,
27
+ points = 12,
28
+ highlight,
29
+ selected,
30
+ labels = false,
31
+ onSelect,
32
+ ...block
33
+ } = defineProps({
34
+ title: { type: [String, Number, Function], required: false },
35
+ subtitle: { type: [String, Number, Function], required: false },
36
+ size: { type: String, required: false },
37
+ rows: { type: String, required: false },
38
+ card: { type: Boolean, required: false },
39
+ activation: { type: String, required: false },
40
+ empty: { type: Object, required: false },
41
+ menu: { type: [Boolean, Array, Function], required: false },
42
+ actions: { type: Array, required: false },
43
+ freshness: { type: Boolean, required: false },
44
+ ui: { type: Object, required: false },
45
+ source: { type: Object, required: true },
46
+ x: { type: Function, required: true },
47
+ xFormat: { type: Function, required: false },
48
+ xLabel: { type: [String, Number, Function], required: false },
49
+ series: { type: Array, required: true },
50
+ comparison: { type: Object, required: false },
51
+ stacked: { type: Boolean, required: false },
52
+ yAxis: { type: Object, required: false },
53
+ format: { type: Function, required: false },
54
+ reference: { type: [Object, Array], required: false },
55
+ height: { type: Number, required: false },
56
+ legend: { type: Boolean, required: false },
57
+ points: { type: Number, required: false },
58
+ highlight: { type: [String, Function], required: false },
59
+ selected: { type: Function, required: false },
60
+ labels: { type: Boolean, required: false },
61
+ onSelect: { type: Function, required: false }
62
+ });
63
+ defineSlots();
64
+ const mounted = useMounted();
65
+ const allSeries = computed(
66
+ () => comparison ? [...series, { color: "series-2", ...comparison, dashed: true, type: "line" }] : series
67
+ );
68
+ const seed = computed(() => allSeries.value.map((entry) => entry.key).join("|"));
69
+ const skeletonSeries = computed(() => series.length);
70
+ const skeletonPoints = computed(() => source.data?.length || points);
71
+ const chart = useDashboardChart({
72
+ defaultType: "bar",
73
+ format: () => format,
74
+ highlight: () => highlight,
75
+ labels: () => labels,
76
+ onSelect: () => onSelect,
77
+ references: () => reference,
78
+ rows: () => source.data ?? [],
79
+ selected: () => selected,
80
+ series: () => allSeries.value,
81
+ stacked: () => stacked,
82
+ x: () => x,
83
+ xFormat: () => xFormat,
84
+ xLabel: () => xLabel,
85
+ yAxis: () => yAxis
86
+ });
87
+ </script>
88
+
89
+ <template>
90
+ <DashboardCard
91
+ v-bind="block"
92
+ :card
93
+ :menu
94
+ :freshness
95
+ :source
96
+ :legend="legend ? chart.legend.value : void 0"
97
+ :is-empty="chart.frame.value.data.length === 0 || chart.frame.value.series.length === 0"
98
+ :tabulate="chart.tabulate"
99
+ >
100
+ <template #skeleton>
101
+ <DashboardSkeleton
102
+ kind="bars"
103
+ :height
104
+ :series="skeletonSeries"
105
+ :count="skeletonPoints"
106
+ :seed
107
+ />
108
+ </template>
109
+ <template v-if="$slots['header-right']" #header-right>
110
+ <slot name="header-right" />
111
+ </template>
112
+ <template v-if="$slots.toolbar" #toolbar>
113
+ <slot name="toolbar" />
114
+ </template>
115
+ <template v-if="$slots.footer" #footer>
116
+ <slot name="footer" />
117
+ </template>
118
+
119
+ <template #default="{ expanded }">
120
+ <component
121
+ :is="dashboardChartRenderer.xy"
122
+ v-if="mounted"
123
+ :frame="chart.frame.value"
124
+ :height="expanded ? resolveDashboardExpandedHeight(height) : height"
125
+ :selectable="chart.selectable.value"
126
+ @select="chart.select"
127
+ />
128
+ <div v-else aria-hidden="true" :style="{ height: `${height}px` }" />
129
+ </template>
130
+ </DashboardCard>
131
+ </template>
@@ -0,0 +1,53 @@
1
+ import type { LazyTextValue } from '#ui-tools/shared/types/utils';
2
+ import type { DashboardAxisOptions, DashboardBlockBaseProps, DashboardHighlight, DashboardReferenceLine, DashboardSelected, DashboardSelectEvent, DashboardSeries, DashboardSourceLike, DashboardValueFormat } from '../types/index.js';
3
+ declare const __VLS_export: <TRow>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<DashboardBlockBaseProps & {
5
+ source: DashboardSourceLike<readonly TRow[] | undefined>;
6
+ /** Category of each row (month, account…). Rows are plotted in order. */
7
+ x: (row: TRow, index: number) => string | number | Date;
8
+ xFormat?: (value: string | number | Date) => string;
9
+ /** Header of the category column in the table view and CSV export. */
10
+ xLabel?: LazyTextValue;
11
+ series: readonly DashboardSeries<TRow>[];
12
+ /** Dashed line drawn over the bars, e.g. the previous period. */
13
+ comparison?: DashboardSeries<TRow>;
14
+ stacked?: boolean;
15
+ yAxis?: DashboardAxisOptions;
16
+ /** Value format for the axis and tooltips. */
17
+ format?: DashboardValueFormat;
18
+ reference?: DashboardReferenceLine | readonly DashboardReferenceLine[];
19
+ /** Chart height in pixels. */
20
+ height?: number;
21
+ /** Series legend in the header. */
22
+ legend?: boolean;
23
+ /** Expected number of x positions, drawn by the loading skeleton before data arrives. */
24
+ points?: number;
25
+ /** Bars drawn at full strength (`max`, `min`, `last`, or an accessor); the others fade. */
26
+ highlight?: DashboardHighlight<TRow>;
27
+ /** Rows shown as selected: their bars stay, the others fade (wins over `highlight`). */
28
+ selected?: DashboardSelected<TRow>;
29
+ /** Prints each group's value above its bars (the stack total when `stacked`). */
30
+ labels?: boolean;
31
+ /** A click on the chart selects the x position under the pointer. */
32
+ onSelect?: (event: DashboardSelectEvent<TRow>) => void;
33
+ }> & (typeof globalThis extends {
34
+ __VLS_PROPS_FALLBACK: infer P;
35
+ } ? P : {});
36
+ expose: (exposed: {}) => void;
37
+ attrs: any;
38
+ slots: {
39
+ 'header-right'?: () => unknown;
40
+ toolbar?: () => unknown;
41
+ footer?: () => unknown;
42
+ };
43
+ emit: {};
44
+ }>) => import("vue").VNode & {
45
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
46
+ };
47
+ declare const _default: typeof __VLS_export;
48
+ export default _default;
49
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
50
+ [K in keyof T]: T[K];
51
+ } : {
52
+ [K in keyof T as K]: T[K];
53
+ }) & {};
@@ -0,0 +1,49 @@
1
+ import type { LazyTextValue } from '#ui-tools/shared/types/utils';
2
+ import type { DashboardBarsUi, DashboardBlockBaseProps, DashboardBlockUi, DashboardRowActions, DashboardSelected, DashboardSelectEvent, DashboardSeriesColor, DashboardSourceLike, DashboardValueFormat } from '../types/index.js';
3
+ declare const __VLS_export: <TRow>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<Omit<DashboardBlockBaseProps, "ui"> & {
5
+ source: DashboardSourceLike<readonly TRow[] | undefined>;
6
+ label: (row: TRow) => LazyTextValue;
7
+ /** Small monospace tag after the label (version, code…). */
8
+ tag?: (row: TRow) => LazyTextValue | undefined;
9
+ /** Bar length. */
10
+ value: (row: TRow) => number;
11
+ /** Right-aligned text. Defaults to the formatted value. */
12
+ meta?: (row: TRow) => LazyTextValue;
13
+ format?: DashboardValueFormat;
14
+ /** Value of a full bar. Defaults to the largest value. */
15
+ max?: number;
16
+ color?: DashboardSeriesColor;
17
+ /** `first`: only the leading row takes `color`, the others use the muted tone. */
18
+ emphasis?: "all" | "first";
19
+ /** Rows shown in the card. The expand dialog, table view, and CSV export show them all. */
20
+ limit?: number;
21
+ rowKey?: (row: TRow, index: number) => PropertyKey;
22
+ /** Rows shown as selected: their bars keep `color`, the others fade. */
23
+ selected?: DashboardSelected<TRow>;
24
+ /** Actions of each row: inline icon buttons and a `⋮` menu after the value. */
25
+ rowActions?: DashboardRowActions<TRow>;
26
+ /** Makes each row a button. */
27
+ onSelect?: (event: DashboardSelectEvent<TRow>) => void;
28
+ ui?: DashboardBlockUi & DashboardBarsUi;
29
+ }> & (typeof globalThis extends {
30
+ __VLS_PROPS_FALLBACK: infer P;
31
+ } ? P : {});
32
+ expose: (exposed: {}) => void;
33
+ attrs: any;
34
+ slots: {
35
+ 'header-right'?: () => unknown;
36
+ toolbar?: () => unknown;
37
+ footer?: () => unknown;
38
+ };
39
+ emit: {};
40
+ }>) => import("vue").VNode & {
41
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
42
+ };
43
+ declare const _default: typeof __VLS_export;
44
+ export default _default;
45
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
46
+ [K in keyof T]: T[K];
47
+ } : {
48
+ [K in keyof T as K]: T[K];
49
+ }) & {};