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,238 @@
1
+ <script setup>
2
+ import UIcon from "@nuxt/ui/components/Icon.vue";
3
+ import { computed } from "vue";
4
+ import { useUiToolsLocale } from "#ui-tools/i18n";
5
+ import { resolveTextValue } from "#ui-tools/shared/utils/render";
6
+ import { useDashboardTime } from "../composables/use-dashboard-time";
7
+ import { useDashboardUi } from "../composables/use-dashboard-ui";
8
+ import { resolveDashboardColor } from "../utils/charts";
9
+ import { toDashboardCell } from "../utils/export";
10
+ import { startOfDashboardDay, toDashboardTime } from "../utils/time";
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
+ label,
26
+ description,
27
+ time,
28
+ icon,
29
+ color,
30
+ avatar,
31
+ groupBy,
32
+ limit,
33
+ rowKey,
34
+ selected,
35
+ rowActions,
36
+ onSelect,
37
+ ui,
38
+ ...block
39
+ } = defineProps({
40
+ title: { type: [String, Number, Function], required: false },
41
+ subtitle: { type: [String, Number, Function], required: false },
42
+ size: { type: String, required: false },
43
+ rows: { type: String, required: false },
44
+ card: { type: Boolean, required: false },
45
+ activation: { type: String, required: false },
46
+ empty: { type: Object, required: false },
47
+ menu: { type: [Boolean, Array, Function], required: false },
48
+ actions: { type: Array, required: false },
49
+ freshness: { type: Boolean, required: false },
50
+ source: { type: Object, required: true },
51
+ label: { type: Function, required: true },
52
+ description: { type: Function, required: false },
53
+ time: { type: Function, required: true },
54
+ icon: { type: Function, required: false },
55
+ color: { type: Function, required: false },
56
+ avatar: { type: Function, required: false },
57
+ groupBy: { type: String, required: false },
58
+ limit: { type: Number, required: false },
59
+ rowKey: { type: Function, required: false },
60
+ selected: { type: Function, required: false },
61
+ rowActions: { type: Function, required: false },
62
+ onSelect: { type: Function, required: false },
63
+ ui: { type: Object, required: false }
64
+ });
65
+ defineSlots();
66
+ const { t } = useUiToolsLocale();
67
+ const clock = useDashboardTime();
68
+ const appUi = useDashboardUi();
69
+ const classes = computed(
70
+ () => resolveDashboardClasses(
71
+ {
72
+ description: "mt-0.5 block text-xs text-muted",
73
+ group: "pt-1 pb-2.5 text-[11px] font-semibold tracking-wide text-dimmed uppercase",
74
+ item: "flex min-w-0 gap-3",
75
+ label: "min-w-0 flex-1 text-[13px] text-default",
76
+ marker: "relative z-[1] grid size-7 shrink-0 place-items-center overflow-hidden rounded-full",
77
+ time: "shrink-0 text-[11.5px] text-dimmed tabular-nums"
78
+ },
79
+ appUi.value.feed,
80
+ ui
81
+ )
82
+ );
83
+ const entries = computed(
84
+ () => (source.data ?? []).map((row, index) => {
85
+ const at = toDashboardTime(time(row));
86
+ return {
87
+ actions: rowActions?.(row, index) ?? [],
88
+ at,
89
+ avatar: avatar?.(row),
90
+ color: resolveDashboardColor(color?.(row) ?? "neutral", 0),
91
+ day: startOfDashboardDay(at),
92
+ description: description ? resolveTextValue(description(row)) : "",
93
+ icon: icon?.(row),
94
+ index,
95
+ key: rowKey?.(row, index) ?? index,
96
+ label: resolveTextValue(label(row)),
97
+ row,
98
+ selected: selected?.(row, index) ?? false
99
+ };
100
+ })
101
+ );
102
+ function groups(expanded) {
103
+ const shown = limit && !expanded ? entries.value.slice(0, limit) : entries.value;
104
+ if (groupBy !== "day") return [{ entries: shown, key: "all", time: void 0 }];
105
+ const grouped = [];
106
+ for (const entry of shown) {
107
+ const last = grouped.at(-1);
108
+ if (last?.time === entry.day) last.entries.push(entry);
109
+ else grouped.push({ entries: [entry], key: String(entry.day), time: entry.day });
110
+ }
111
+ return grouped;
112
+ }
113
+ function tabulate() {
114
+ const columns = [
115
+ { key: "time", label: t("dashboard.table.time"), numeric: false },
116
+ { key: "label", label: t("dashboard.table.label"), numeric: false },
117
+ description && { key: "description", label: t("dashboard.table.description"), numeric: false }
118
+ ];
119
+ return {
120
+ columns: columns.filter((column) => column !== void 0),
121
+ rows: entries.value.map(
122
+ (entry) => [
123
+ toDashboardCell(
124
+ Number.isFinite(entry.at) ? new Date(entry.at).toISOString() : "",
125
+ clock.absolute(entry.at)
126
+ ),
127
+ toDashboardCell(entry.label),
128
+ description && toDashboardCell(entry.description)
129
+ ].filter((cell) => cell !== void 0)
130
+ )
131
+ };
132
+ }
133
+ </script>
134
+
135
+ <template>
136
+ <DashboardCard
137
+ v-bind="block"
138
+ :card
139
+ :menu
140
+ :freshness
141
+ :ui
142
+ :source
143
+ :is-empty="entries.length === 0"
144
+ :tabulate
145
+ >
146
+ <template #skeleton>
147
+ <DashboardSkeleton kind="feed" :count="limit ?? 5" />
148
+ </template>
149
+ <template v-if="$slots['header-right']" #header-right>
150
+ <slot name="header-right" />
151
+ </template>
152
+ <template v-if="$slots.toolbar" #toolbar>
153
+ <slot name="toolbar" />
154
+ </template>
155
+ <template v-if="$slots.footer" #footer>
156
+ <slot name="footer" />
157
+ </template>
158
+
159
+ <template #default="{ expanded }">
160
+ <div class="flex flex-col">
161
+ <section v-for="group in groups(expanded)" :key="group.key">
162
+ <h3 v-if="group.time !== void 0" :class="classes.group">
163
+ {{ clock.day(group.time) }}
164
+ </h3>
165
+ <ol class="flex flex-col">
166
+ <li
167
+ v-for="(entry, position) in group.entries"
168
+ :key="entry.key"
169
+ :data-selected="entry.selected || void 0"
170
+ :class="[
171
+ classes.item,
172
+ onSelect && DASHBOARD_SELECTABLE_ROW,
173
+ entry.selected && DASHBOARD_SELECTED_ROW
174
+ ]"
175
+ >
176
+ <!-- Rail: the marker, then a line down to the next event of the group -->
177
+ <div class="relative flex w-7 shrink-0 flex-col items-center">
178
+ <span v-if="entry.avatar" :class="classes.marker" class="bg-elevated">
179
+ <img :src="entry.avatar" alt="" class="size-full object-cover" />
180
+ </span>
181
+ <span
182
+ v-else-if="entry.icon"
183
+ :class="classes.marker"
184
+ :style="{
185
+ background: `color-mix(in oklab, ${entry.color} 12%, var(--ui-bg))`,
186
+ color: entry.color
187
+ }"
188
+ >
189
+ <UIcon :name="entry.icon" class="size-3.5" />
190
+ </span>
191
+ <span v-else :class="classes.marker">
192
+ <span class="size-2 rounded-full" :style="{ background: entry.color }" />
193
+ </span>
194
+ <span
195
+ v-if="position < group.entries.length - 1"
196
+ aria-hidden="true"
197
+ class="w-px flex-1 bg-[var(--nut-dash-grid)]"
198
+ />
199
+ </div>
200
+ <div class="flex min-w-0 flex-1 items-baseline gap-3 pt-[5px] pb-3.5">
201
+ <div :class="classes.label">
202
+ {{ entry.label }}
203
+ <small v-if="entry.description" :class="classes.description">
204
+ {{ entry.description }}
205
+ </small>
206
+ </div>
207
+ <time
208
+ :datetime="
209
+ Number.isFinite(entry.at) ? new Date(entry.at).toISOString() : void 0
210
+ "
211
+ :title="clock.absolute(entry.at)"
212
+ :class="classes.time"
213
+ data-allow-mismatch="text"
214
+ >
215
+ {{ clock.relative(entry.at) }}
216
+ </time>
217
+ <DashboardRowActionsMenu
218
+ v-if="entry.actions.length"
219
+ :actions="entry.actions"
220
+ :label="entry.label"
221
+ class="-my-1 self-center"
222
+ />
223
+ </div>
224
+ <button
225
+ v-if="onSelect"
226
+ type="button"
227
+ :class="DASHBOARD_ROW_BUTTON"
228
+ :aria-label="entry.label"
229
+ :aria-pressed="selected ? entry.selected : void 0"
230
+ @click="onSelect({ index: entry.index, row: entry.row })"
231
+ />
232
+ </li>
233
+ </ol>
234
+ </section>
235
+ </div>
236
+ </template>
237
+ </DashboardCard>
238
+ </template>
@@ -0,0 +1,49 @@
1
+ import type { LazyTextValue } from '#ui-tools/shared/types/utils';
2
+ import type { DashboardBlockBaseProps, DashboardBlockUi, DashboardFeedUi, DashboardRowActions, DashboardSelected, DashboardSelectEvent, DashboardSeriesColor, DashboardSourceLike, DashboardTimeValue } 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
+ /** What happened. */
7
+ label: (row: TRow) => LazyTextValue;
8
+ description?: (row: TRow) => LazyTextValue | undefined;
9
+ /** When it happened: a `Date`, epoch milliseconds, or an ISO string. Shown relative to now. */
10
+ time: (row: TRow) => DashboardTimeValue;
11
+ /** Icon on the timeline rail. Without `icon` or `avatar`, the rail shows a dot. */
12
+ icon?: (row: TRow) => string | undefined;
13
+ /** Tint of the icon or dot: a palette slot, a Nuxt UI color, or any CSS color. */
14
+ color?: (row: TRow) => DashboardSeriesColor | undefined;
15
+ /** Image URL shown on the rail instead of the icon (who did it). */
16
+ avatar?: (row: TRow) => string | undefined;
17
+ /** `day`: a heading per day (`Today`, `Yesterday`, then the date). Rows keep source order. */
18
+ groupBy?: "day";
19
+ /** Events 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
+ /** Events shown as selected (the value a `select` handler stored). */
23
+ selected?: DashboardSelected<TRow>;
24
+ /** Actions of each event: inline icon buttons and a `⋮` menu after its time. */
25
+ rowActions?: DashboardRowActions<TRow>;
26
+ /** Makes each event a button. */
27
+ onSelect?: (event: DashboardSelectEvent<TRow>) => void;
28
+ ui?: DashboardBlockUi & DashboardFeedUi;
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,34 @@
1
+ import type { LazyTextValue } from '#ui-tools/shared/types/utils';
2
+ import type { DashboardBlockBaseProps, DashboardBlockUi, DashboardFunnelUi, 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
+ value: (row: TRow) => number;
8
+ format?: DashboardValueFormat;
9
+ /** Colors per step, in order. Defaults to the palette. */
10
+ colors?: readonly DashboardSeriesColor[];
11
+ /** Makes each step a button. */
12
+ onSelect?: (event: DashboardSelectEvent<TRow>) => void;
13
+ ui?: DashboardBlockUi & DashboardFunnelUi;
14
+ }> & (typeof globalThis extends {
15
+ __VLS_PROPS_FALLBACK: infer P;
16
+ } ? P : {});
17
+ expose: (exposed: {}) => void;
18
+ attrs: any;
19
+ slots: {
20
+ 'header-right'?: () => unknown;
21
+ toolbar?: () => unknown;
22
+ footer?: () => unknown;
23
+ };
24
+ emit: {};
25
+ }>) => import("vue").VNode & {
26
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
27
+ };
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;
30
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
31
+ [K in keyof T]: T[K];
32
+ } : {
33
+ [K in keyof T as K]: T[K];
34
+ }) & {};
@@ -0,0 +1,157 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { useUiToolsLocale } from "#ui-tools/i18n";
4
+ import { resolveTextValue } from "#ui-tools/shared/utils/render";
5
+ import { useDashboardFormat } from "../composables/use-dashboard-format";
6
+ import { useDashboardUi } from "../composables/use-dashboard-ui";
7
+ import { resolveDashboardColor } from "../utils/charts";
8
+ import { toDashboardCell } from "../utils/export";
9
+ import {
10
+ DASHBOARD_ROW_BUTTON,
11
+ DASHBOARD_SELECTABLE_ROW,
12
+ resolveDashboardClasses
13
+ } from "../utils/ui";
14
+ import DashboardSkeleton from "./block/dashboard-skeleton.vue";
15
+ import DashboardCard from "./dashboard-card.vue";
16
+ const {
17
+ source,
18
+ card = true,
19
+ menu = void 0,
20
+ freshness = void 0,
21
+ label,
22
+ value,
23
+ format,
24
+ colors,
25
+ onSelect,
26
+ ui,
27
+ ...block
28
+ } = defineProps({
29
+ title: { type: [String, Number, Function], required: false },
30
+ subtitle: { type: [String, Number, Function], required: false },
31
+ size: { type: String, required: false },
32
+ rows: { type: String, required: false },
33
+ card: { type: Boolean, required: false },
34
+ activation: { type: String, required: false },
35
+ empty: { type: Object, required: false },
36
+ menu: { type: [Boolean, Array, Function], required: false },
37
+ actions: { type: Array, required: false },
38
+ freshness: { type: Boolean, required: false },
39
+ source: { type: Object, required: true },
40
+ label: { type: Function, required: true },
41
+ value: { type: Function, required: true },
42
+ format: { type: Function, required: false },
43
+ colors: { type: Array, required: false },
44
+ onSelect: { type: Function, required: false },
45
+ ui: { type: Object, required: false }
46
+ });
47
+ defineSlots();
48
+ const { t } = useUiToolsLocale();
49
+ const formats = useDashboardFormat();
50
+ const appUi = useDashboardUi();
51
+ const classes = computed(
52
+ () => resolveDashboardClasses(
53
+ {
54
+ label: "font-medium text-default",
55
+ note: "ms-auto shrink-0 text-xs text-muted",
56
+ step: "flex flex-col gap-1.5",
57
+ track: "h-[22px] overflow-hidden rounded-[5px] bg-[var(--nut-dash-track)]",
58
+ value: "text-[15px] font-semibold text-highlighted tabular-nums"
59
+ },
60
+ appUi.value.funnel,
61
+ ui
62
+ )
63
+ );
64
+ const steps = computed(() => {
65
+ const data = source.data ?? [];
66
+ const values = data.map((row) => value(row));
67
+ const first = values[0] ?? 0;
68
+ return data.map((row, index) => {
69
+ const amount = values[index] ?? 0;
70
+ const previous = values[index - 1];
71
+ const ratio = previous === void 0 || previous <= 0 ? null : amount / previous * 100;
72
+ return {
73
+ amount,
74
+ color: resolveDashboardColor(colors?.[index], index),
75
+ index,
76
+ label: resolveTextValue(label(row)),
77
+ note: previous === void 0 ? t("dashboard.funnel.base") : t("dashboard.funnel.fromPrevious", {
78
+ value: ratio === null ? "\u2014" : formats.percent.value(ratio)
79
+ }),
80
+ ratio,
81
+ row,
82
+ value: (format ?? formats.number.value)(amount),
83
+ width: first > 0 ? `${amount / first * 100}%` : "0%"
84
+ };
85
+ });
86
+ });
87
+ function tabulate() {
88
+ return {
89
+ columns: [
90
+ { key: "label", label: t("dashboard.table.label"), numeric: false },
91
+ { key: "value", label: t("dashboard.table.value"), numeric: true },
92
+ { key: "share", label: t("dashboard.table.share"), numeric: true }
93
+ ],
94
+ rows: steps.value.map((step) => [
95
+ toDashboardCell(step.label),
96
+ toDashboardCell(step.amount, step.value),
97
+ toDashboardCell(
98
+ step.ratio === null ? null : Math.round(step.ratio * 10) / 10,
99
+ step.ratio === null ? "" : formats.percent.value(step.ratio)
100
+ )
101
+ ])
102
+ };
103
+ }
104
+ </script>
105
+
106
+ <template>
107
+ <DashboardCard
108
+ v-bind="block"
109
+ :card
110
+ :menu
111
+ :freshness
112
+ :ui
113
+ :source
114
+ :is-empty="steps.length === 0"
115
+ :tabulate
116
+ >
117
+ <template #skeleton>
118
+ <DashboardSkeleton kind="funnel" :count="4" />
119
+ </template>
120
+ <template v-if="$slots['header-right']" #header-right>
121
+ <slot name="header-right" />
122
+ </template>
123
+ <template v-if="$slots.toolbar" #toolbar>
124
+ <slot name="toolbar" />
125
+ </template>
126
+ <template v-if="$slots.footer" #footer>
127
+ <slot name="footer" />
128
+ </template>
129
+
130
+ <ol class="flex flex-col gap-3.5 pt-1">
131
+ <li
132
+ v-for="step in steps"
133
+ :key="step.index"
134
+ :class="[classes.step, onSelect && [DASHBOARD_SELECTABLE_ROW, 'py-1']]"
135
+ >
136
+ <div class="flex items-baseline gap-2.5 text-[13px]">
137
+ <b :class="classes.label">{{ step.label }}</b>
138
+ <span :class="classes.value">{{ step.value }}</span>
139
+ <small :class="classes.note">{{ step.note }}</small>
140
+ </div>
141
+ <div :class="classes.track">
142
+ <i
143
+ class="block h-full min-w-1.5 rounded-[5px] transition-[width] duration-500 ease-out"
144
+ :style="{ background: step.color, width: step.width }"
145
+ />
146
+ </div>
147
+ <button
148
+ v-if="onSelect"
149
+ type="button"
150
+ :class="DASHBOARD_ROW_BUTTON"
151
+ :aria-label="step.label"
152
+ @click="onSelect({ index: step.index, row: step.row })"
153
+ />
154
+ </li>
155
+ </ol>
156
+ </DashboardCard>
157
+ </template>
@@ -0,0 +1,34 @@
1
+ import type { LazyTextValue } from '#ui-tools/shared/types/utils';
2
+ import type { DashboardBlockBaseProps, DashboardBlockUi, DashboardFunnelUi, 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
+ value: (row: TRow) => number;
8
+ format?: DashboardValueFormat;
9
+ /** Colors per step, in order. Defaults to the palette. */
10
+ colors?: readonly DashboardSeriesColor[];
11
+ /** Makes each step a button. */
12
+ onSelect?: (event: DashboardSelectEvent<TRow>) => void;
13
+ ui?: DashboardBlockUi & DashboardFunnelUi;
14
+ }> & (typeof globalThis extends {
15
+ __VLS_PROPS_FALLBACK: infer P;
16
+ } ? P : {});
17
+ expose: (exposed: {}) => void;
18
+ attrs: any;
19
+ slots: {
20
+ 'header-right'?: () => unknown;
21
+ toolbar?: () => unknown;
22
+ footer?: () => unknown;
23
+ };
24
+ emit: {};
25
+ }>) => import("vue").VNode & {
26
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
27
+ };
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;
30
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
31
+ [K in keyof T]: T[K];
32
+ } : {
33
+ [K in keyof T as K]: T[K];
34
+ }) & {};
@@ -0,0 +1,55 @@
1
+ import type { LazyTextValue } from '#ui-tools/shared/types/utils';
2
+ import type { DashboardBlockBaseProps, DashboardBlockUi, DashboardGaugeUi, DashboardSeriesColor, DashboardSourceLike, DashboardValueFormat } from '../types/index.js';
3
+ declare const __VLS_export: <TData>(__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<TData>;
6
+ /** Current value, placed between `min` and `max`. */
7
+ value: (data: TData & ({} | null)) => number | null | undefined;
8
+ /** Start of the scale. Defaults to `0`. */
9
+ min?: number | ((data: TData & ({} | null)) => number);
10
+ /** End of the scale (a goal, a capacity). Defaults to `100`. */
11
+ max?: number | ((data: TData & ({} | null)) => number);
12
+ /** Target on the scale, drawn as a tick across the ring. `null` hides it. */
13
+ target?: (data: TData & ({} | null)) => number | null | undefined;
14
+ /** Center value format. Defaults to the locale number format. */
15
+ format?: DashboardValueFormat;
16
+ /** Text under the value, inside the ring. */
17
+ caption?: LazyTextValue | ((data: TData & ({} | null)) => LazyTextValue | undefined);
18
+ /**
19
+ * Filled stroke color: a palette slot, a Nuxt UI color, any CSS color, or a function of the
20
+ * value and its share of the scale (`0`–`1`), e.g. to turn red past a threshold.
21
+ */
22
+ color?: DashboardSeriesColor | ((value: number, share: number) => DashboardSeriesColor);
23
+ /** `arc`: a 240° gauge open at the bottom, with the scale bounds under it. `ring`: a full ring. */
24
+ variant?: "arc" | "ring";
25
+ /** Ring size in pixels. */
26
+ diameter?: number;
27
+ thickness?: number;
28
+ ui?: DashboardBlockUi & DashboardGaugeUi;
29
+ }> & (typeof globalThis extends {
30
+ __VLS_PROPS_FALLBACK: infer P;
31
+ } ? P : {});
32
+ expose: (exposed: {}) => void;
33
+ attrs: any;
34
+ slots: {
35
+ /** Content in the middle of the ring, instead of the value and caption. */
36
+ center?: (props: {
37
+ data: TData & ({} | null);
38
+ value: string;
39
+ share: number;
40
+ }) => unknown;
41
+ 'header-right'?: () => unknown;
42
+ toolbar?: () => unknown;
43
+ footer?: () => unknown;
44
+ };
45
+ emit: {};
46
+ }>) => import("vue").VNode & {
47
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
48
+ };
49
+ declare const _default: typeof __VLS_export;
50
+ export default _default;
51
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
52
+ [K in keyof T]: T[K];
53
+ } : {
54
+ [K in keyof T as K]: T[K];
55
+ }) & {};