nuxt-ui-tools 1.24.0 → 1.25.1

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 (210) hide show
  1. package/dist/module.d.mts +3 -0
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +8 -0
  4. package/dist/runtime/display/components/blocks/display-accordion.d.vue.ts +4 -0
  5. package/dist/runtime/display/components/blocks/display-accordion.vue +96 -0
  6. package/dist/runtime/display/components/blocks/display-accordion.vue.d.ts +4 -0
  7. package/dist/runtime/display/components/blocks/display-alert.d.vue.ts +4 -0
  8. package/dist/runtime/display/components/blocks/display-alert.vue +136 -0
  9. package/dist/runtime/display/components/blocks/display-alert.vue.d.ts +4 -0
  10. package/dist/runtime/display/components/blocks/display-breakdown.d.vue.ts +4 -0
  11. package/dist/runtime/display/components/blocks/display-breakdown.vue +184 -0
  12. package/dist/runtime/display/components/blocks/display-breakdown.vue.d.ts +4 -0
  13. package/dist/runtime/display/components/blocks/display-chart.d.vue.ts +4 -0
  14. package/dist/runtime/display/components/blocks/display-chart.vue +241 -0
  15. package/dist/runtime/display/components/blocks/display-chart.vue.d.ts +4 -0
  16. package/dist/runtime/display/components/blocks/display-code.d.vue.ts +4 -0
  17. package/dist/runtime/display/components/blocks/display-code.vue +144 -0
  18. package/dist/runtime/display/components/blocks/display-code.vue.d.ts +4 -0
  19. package/dist/runtime/display/components/blocks/display-date.d.vue.ts +4 -0
  20. package/dist/runtime/display/components/blocks/display-date.vue +179 -0
  21. package/dist/runtime/display/components/blocks/display-date.vue.d.ts +4 -0
  22. package/dist/runtime/display/components/blocks/display-diff.d.vue.ts +4 -0
  23. package/dist/runtime/display/components/blocks/display-diff.vue +154 -0
  24. package/dist/runtime/display/components/blocks/display-diff.vue.d.ts +4 -0
  25. package/dist/runtime/display/components/blocks/display-empty.d.vue.ts +4 -0
  26. package/dist/runtime/display/components/blocks/display-empty.vue +75 -0
  27. package/dist/runtime/display/components/blocks/display-empty.vue.d.ts +4 -0
  28. package/dist/runtime/display/components/blocks/display-facts.d.vue.ts +4 -0
  29. package/dist/runtime/display/components/blocks/display-facts.vue +195 -0
  30. package/dist/runtime/display/components/blocks/display-facts.vue.d.ts +4 -0
  31. package/dist/runtime/display/components/blocks/display-heading.d.vue.ts +4 -0
  32. package/dist/runtime/display/components/blocks/display-heading.vue +103 -0
  33. package/dist/runtime/display/components/blocks/display-heading.vue.d.ts +4 -0
  34. package/dist/runtime/display/components/blocks/display-list.d.vue.ts +4 -0
  35. package/dist/runtime/display/components/blocks/display-list.vue +301 -0
  36. package/dist/runtime/display/components/blocks/display-list.vue.d.ts +4 -0
  37. package/dist/runtime/display/components/blocks/display-media.d.vue.ts +4 -0
  38. package/dist/runtime/display/components/blocks/display-media.vue +336 -0
  39. package/dist/runtime/display/components/blocks/display-media.vue.d.ts +4 -0
  40. package/dist/runtime/display/components/blocks/display-meter.d.vue.ts +4 -0
  41. package/dist/runtime/display/components/blocks/display-meter.vue +302 -0
  42. package/dist/runtime/display/components/blocks/display-meter.vue.d.ts +4 -0
  43. package/dist/runtime/display/components/blocks/display-person.d.vue.ts +4 -0
  44. package/dist/runtime/display/components/blocks/display-person.vue +153 -0
  45. package/dist/runtime/display/components/blocks/display-person.vue.d.ts +4 -0
  46. package/dist/runtime/display/components/blocks/display-record.d.vue.ts +4 -0
  47. package/dist/runtime/display/components/blocks/display-record.vue +268 -0
  48. package/dist/runtime/display/components/blocks/display-record.vue.d.ts +4 -0
  49. package/dist/runtime/display/components/blocks/display-stat.d.vue.ts +4 -0
  50. package/dist/runtime/display/components/blocks/display-stat.vue +189 -0
  51. package/dist/runtime/display/components/blocks/display-stat.vue.d.ts +4 -0
  52. package/dist/runtime/display/components/blocks/display-table.d.vue.ts +4 -0
  53. package/dist/runtime/display/components/blocks/display-table.vue +136 -0
  54. package/dist/runtime/display/components/blocks/display-table.vue.d.ts +4 -0
  55. package/dist/runtime/display/components/blocks/display-text.d.vue.ts +4 -0
  56. package/dist/runtime/display/components/blocks/display-text.vue +141 -0
  57. package/dist/runtime/display/components/blocks/display-text.vue.d.ts +4 -0
  58. package/dist/runtime/display/components/blocks/display-timeline.d.vue.ts +4 -0
  59. package/dist/runtime/display/components/blocks/display-timeline.vue +238 -0
  60. package/dist/runtime/display/components/blocks/display-timeline.vue.d.ts +4 -0
  61. package/dist/runtime/display/components/display.d.vue.ts +24 -0
  62. package/dist/runtime/display/components/display.vue +21 -0
  63. package/dist/runtime/display/components/display.vue.d.ts +24 -0
  64. package/dist/runtime/display/components/parts/display-actions.d.vue.ts +9 -0
  65. package/dist/runtime/display/components/parts/display-actions.vue +27 -0
  66. package/dist/runtime/display/components/parts/display-actions.vue.d.ts +9 -0
  67. package/dist/runtime/display/components/parts/display-chip.d.vue.ts +11 -0
  68. package/dist/runtime/display/components/parts/display-chip.vue +71 -0
  69. package/dist/runtime/display/components/parts/display-chip.vue.d.ts +11 -0
  70. package/dist/runtime/display/components/parts/display-copy.d.vue.ts +6 -0
  71. package/dist/runtime/display/components/parts/display-copy.vue +27 -0
  72. package/dist/runtime/display/components/parts/display-copy.vue.d.ts +6 -0
  73. package/dist/runtime/display/components/parts/display-empty-line.d.vue.ts +7 -0
  74. package/dist/runtime/display/components/parts/display-empty-line.vue +21 -0
  75. package/dist/runtime/display/components/parts/display-empty-line.vue.d.ts +7 -0
  76. package/dist/runtime/display/components/parts/display-fact-value.d.vue.ts +7 -0
  77. package/dist/runtime/display/components/parts/display-fact-value.vue +36 -0
  78. package/dist/runtime/display/components/parts/display-fact-value.vue.d.ts +7 -0
  79. package/dist/runtime/display/components/parts/display-load-error.d.vue.ts +7 -0
  80. package/dist/runtime/display/components/parts/display-load-error.vue +29 -0
  81. package/dist/runtime/display/components/parts/display-load-error.vue.d.ts +7 -0
  82. package/dist/runtime/display/components/parts/display-more.d.vue.ts +10 -0
  83. package/dist/runtime/display/components/parts/display-more.vue +23 -0
  84. package/dist/runtime/display/components/parts/display-more.vue.d.ts +10 -0
  85. package/dist/runtime/display/components/parts/display-record-media.d.vue.ts +11 -0
  86. package/dist/runtime/display/components/parts/display-record-media.vue +61 -0
  87. package/dist/runtime/display/components/parts/display-record-media.vue.d.ts +11 -0
  88. package/dist/runtime/display/components/parts/display-render.d.ts +10 -0
  89. package/dist/runtime/display/components/parts/display-render.js +5 -0
  90. package/dist/runtime/display/components/parts/display-skeleton.d.vue.ts +7 -0
  91. package/dist/runtime/display/components/parts/display-skeleton.vue +67 -0
  92. package/dist/runtime/display/components/parts/display-skeleton.vue.d.ts +7 -0
  93. package/dist/runtime/display/composables/use-display-config.d.ts +6 -0
  94. package/dist/runtime/display/composables/use-display-config.js +11 -0
  95. package/dist/runtime/display/composables/use-display-file-preview.d.ts +9 -0
  96. package/dist/runtime/display/composables/use-display-file-preview.js +11 -0
  97. package/dist/runtime/display/composables/use-display-icons.d.ts +8 -0
  98. package/dist/runtime/display/composables/use-display-icons.js +62 -0
  99. package/dist/runtime/display/composables/use-display-locale.d.ts +5 -0
  100. package/dist/runtime/display/composables/use-display-locale.js +5 -0
  101. package/dist/runtime/display/composables/use-display-number.d.ts +2 -0
  102. package/dist/runtime/display/composables/use-display-number.js +7 -0
  103. package/dist/runtime/display/composables/use-display-reveal.d.ts +14 -0
  104. package/dist/runtime/display/composables/use-display-reveal.js +15 -0
  105. package/dist/runtime/display/composables/use-display-url.d.ts +26 -0
  106. package/dist/runtime/display/composables/use-display-url.js +46 -0
  107. package/dist/runtime/display/directives/reveal-truncated.d.ts +10 -0
  108. package/dist/runtime/display/directives/reveal-truncated.js +31 -0
  109. package/dist/runtime/display/index.d.ts +4 -0
  110. package/dist/runtime/display/index.js +3 -0
  111. package/dist/runtime/display/plugins/display-tones.d.ts +3 -0
  112. package/dist/runtime/display/plugins/display-tones.js +17 -0
  113. package/dist/runtime/display/types/blocks/accordion.d.ts +18 -0
  114. package/dist/runtime/display/types/blocks/accordion.js +0 -0
  115. package/dist/runtime/display/types/blocks/alert.d.ts +31 -0
  116. package/dist/runtime/display/types/blocks/alert.js +0 -0
  117. package/dist/runtime/display/types/blocks/breakdown.d.ts +36 -0
  118. package/dist/runtime/display/types/blocks/breakdown.js +0 -0
  119. package/dist/runtime/display/types/blocks/chart.d.ts +23 -0
  120. package/dist/runtime/display/types/blocks/chart.js +0 -0
  121. package/dist/runtime/display/types/blocks/code.d.ts +21 -0
  122. package/dist/runtime/display/types/blocks/code.js +0 -0
  123. package/dist/runtime/display/types/blocks/date.d.ts +27 -0
  124. package/dist/runtime/display/types/blocks/date.js +0 -0
  125. package/dist/runtime/display/types/blocks/diff.d.ts +20 -0
  126. package/dist/runtime/display/types/blocks/diff.js +0 -0
  127. package/dist/runtime/display/types/blocks/empty.d.ts +13 -0
  128. package/dist/runtime/display/types/blocks/empty.js +0 -0
  129. package/dist/runtime/display/types/blocks/facts.d.ts +52 -0
  130. package/dist/runtime/display/types/blocks/facts.js +0 -0
  131. package/dist/runtime/display/types/blocks/heading.d.ts +19 -0
  132. package/dist/runtime/display/types/blocks/heading.js +0 -0
  133. package/dist/runtime/display/types/blocks/list.d.ts +36 -0
  134. package/dist/runtime/display/types/blocks/list.js +0 -0
  135. package/dist/runtime/display/types/blocks/media.d.ts +42 -0
  136. package/dist/runtime/display/types/blocks/media.js +0 -0
  137. package/dist/runtime/display/types/blocks/meter.d.ts +48 -0
  138. package/dist/runtime/display/types/blocks/meter.js +0 -0
  139. package/dist/runtime/display/types/blocks/person.d.ts +34 -0
  140. package/dist/runtime/display/types/blocks/person.js +0 -0
  141. package/dist/runtime/display/types/blocks/record.d.ts +44 -0
  142. package/dist/runtime/display/types/blocks/record.js +0 -0
  143. package/dist/runtime/display/types/blocks/stat.d.ts +44 -0
  144. package/dist/runtime/display/types/blocks/stat.js +0 -0
  145. package/dist/runtime/display/types/blocks/table.d.ts +28 -0
  146. package/dist/runtime/display/types/blocks/table.js +0 -0
  147. package/dist/runtime/display/types/blocks/text.d.ts +22 -0
  148. package/dist/runtime/display/types/blocks/text.js +0 -0
  149. package/dist/runtime/display/types/blocks/timeline.d.ts +37 -0
  150. package/dist/runtime/display/types/blocks/timeline.js +0 -0
  151. package/dist/runtime/display/types/config.d.ts +60 -0
  152. package/dist/runtime/display/types/config.js +0 -0
  153. package/dist/runtime/display/types/index.d.ts +22 -0
  154. package/dist/runtime/display/types/index.js +0 -0
  155. package/dist/runtime/display/types/registry.d.ts +57 -0
  156. package/dist/runtime/display/types/registry.js +0 -0
  157. package/dist/runtime/display/types/shared.d.ts +80 -0
  158. package/dist/runtime/display/types/shared.js +0 -0
  159. package/dist/runtime/display/utils/classes.d.ts +3 -0
  160. package/dist/runtime/display/utils/classes.js +7 -0
  161. package/dist/runtime/display/utils/config.d.ts +11 -0
  162. package/dist/runtime/display/utils/config.js +17 -0
  163. package/dist/runtime/display/utils/content.d.ts +7 -0
  164. package/dist/runtime/display/utils/content.js +13 -0
  165. package/dist/runtime/display/utils/dates.d.ts +16 -0
  166. package/dist/runtime/display/utils/dates.js +34 -0
  167. package/dist/runtime/display/utils/json.d.ts +7 -0
  168. package/dist/runtime/display/utils/json.js +15 -0
  169. package/dist/runtime/display/utils/links.d.ts +12 -0
  170. package/dist/runtime/display/utils/links.js +9 -0
  171. package/dist/runtime/display/utils/meter.d.ts +7 -0
  172. package/dist/runtime/display/utils/meter.js +13 -0
  173. package/dist/runtime/display/utils/registry.d.ts +47 -0
  174. package/dist/runtime/display/utils/registry.js +64 -0
  175. package/dist/runtime/display/utils/tone-css.d.ts +7 -0
  176. package/dist/runtime/display/utils/tone-css.js +38 -0
  177. package/dist/runtime/display/utils/tone.d.ts +26 -0
  178. package/dist/runtime/display/utils/tone.js +38 -0
  179. package/dist/runtime/display/utils/urls.d.ts +10 -0
  180. package/dist/runtime/display/utils/urls.js +33 -0
  181. package/dist/runtime/file-preview/components/shell/file-preview-stage.vue +5 -3
  182. package/dist/runtime/file-preview/composables/use-file-preview-source.d.ts +7 -0
  183. package/dist/runtime/file-preview/composables/use-file-preview-source.js +7 -1
  184. package/dist/runtime/file-preview/index.d.ts +1 -0
  185. package/dist/runtime/file-preview/index.js +1 -0
  186. package/dist/runtime/file-preview/types/file.d.ts +9 -0
  187. package/dist/runtime/file-preview/utils/errors.d.ts +30 -0
  188. package/dist/runtime/file-preview/utils/errors.js +26 -0
  189. package/dist/runtime/form/components/utils/form-file-preview.vue +7 -2
  190. package/dist/runtime/form/composables/use-form-root.js +17 -4
  191. package/dist/runtime/form/composables/use-form-runtime.js +7 -2
  192. package/dist/runtime/form/fields/index.d.ts +5 -0
  193. package/dist/runtime/form/fields/info/component.vue +51 -19
  194. package/dist/runtime/form/fields/info/config.d.ts +5 -0
  195. package/dist/runtime/form/fields/info/config.js +2 -1
  196. package/dist/runtime/form/fields/info/types.d.ts +78 -4
  197. package/dist/runtime/form/fields/info/use-info-display.d.ts +20 -0
  198. package/dist/runtime/form/fields/info/use-info-display.js +82 -0
  199. package/dist/runtime/form/fields/upload/upload-item.vue +10 -2
  200. package/dist/runtime/form/types/api.d.ts +6 -0
  201. package/dist/runtime/form/types/runtime.d.ts +2 -0
  202. package/dist/runtime/form/utils/dynamic.d.ts +6 -0
  203. package/dist/runtime/form/utils/dynamic.js +7 -0
  204. package/dist/runtime/i18n/locales/en.js +27 -0
  205. package/dist/runtime/i18n/locales/fr.js +27 -0
  206. package/dist/runtime/i18n/types.d.ts +35 -0
  207. package/dist/runtime/shared/styles/tokens.css +1 -1
  208. package/dist/runtime/shared/utils/file.d.ts +1 -1
  209. package/dist/runtime/table/utils/data-list-ui.d.ts +1 -1
  210. package/package.json +16 -1
@@ -0,0 +1,268 @@
1
+ <script setup>
2
+ import UIcon from "@nuxt/ui/components/Icon.vue";
3
+ import ULink from "@nuxt/ui/components/Link.vue";
4
+ import { computed } from "vue";
5
+ import { useDisplayAppUi } from "../../composables/use-display-config";
6
+ import { useDisplayReveal } from "../../composables/use-display-reveal";
7
+ import { vRevealTruncated } from "../../directives/reveal-truncated";
8
+ import { resolveDisplayClasses } from "../../utils/classes";
9
+ import { isDisplayContentEmpty } from "../../utils/content";
10
+ import { displayLinkAttrs } from "../../utils/links";
11
+ import { DISPLAY_SURFACE_CLASSES } from "../../utils/tone";
12
+ import DisplayChip from "../parts/display-chip.vue";
13
+ import DisplayEmptyLine from "../parts/display-empty-line.vue";
14
+ import DisplayMore from "../parts/display-more.vue";
15
+ import DisplayRecordMedia from "../parts/display-record-media.vue";
16
+ import DisplayRender from "../parts/display-render";
17
+ import DisplaySkeleton from "../parts/display-skeleton.vue";
18
+ const {
19
+ variant = "row",
20
+ heading = void 0,
21
+ headingIcon = void 0,
22
+ items = void 0,
23
+ surface = "bordered",
24
+ max = void 0,
25
+ step = void 0,
26
+ empty = void 0,
27
+ loading = false,
28
+ ui = void 0,
29
+ ...record
30
+ } = defineProps({
31
+ variant: { type: String, required: false },
32
+ heading: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
33
+ headingIcon: { type: String, required: false },
34
+ items: { type: Array, required: false },
35
+ surface: { type: String, required: false },
36
+ loading: { type: Boolean, required: false },
37
+ ui: { type: Object, required: false },
38
+ reference: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
39
+ title: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
40
+ meta: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
41
+ metaIcon: { type: String, required: false },
42
+ description: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
43
+ image: { type: Object, required: false },
44
+ avatar: { type: Object, required: false },
45
+ icon: { type: String, required: false },
46
+ tone: { type: String, required: false },
47
+ badges: { type: Array, required: false },
48
+ trailing: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
49
+ trailingCaption: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
50
+ chip: { type: Object, required: false },
51
+ to: { type: String, required: false },
52
+ target: { type: [String, Object, null], required: false },
53
+ onClick: { type: Function, required: false },
54
+ max: { type: Number, required: false },
55
+ step: { type: Number, required: false },
56
+ empty: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true }
57
+ });
58
+ const appUi = useDisplayAppUi("record");
59
+ const single = computed(() => ({ ...record, title: record.title ?? "" }));
60
+ const reveal = useDisplayReveal({ items: () => items ?? [], max: () => max, step: () => step });
61
+ const classes = computed(
62
+ () => resolveDisplayClasses(
63
+ {
64
+ badges: "mt-1.5 flex flex-wrap gap-1",
65
+ body: "min-w-0 flex-1",
66
+ description: "mt-1 line-clamp-2 text-sm text-muted",
67
+ empty: "",
68
+ header: "flex items-center gap-2 border-b border-default bg-elevated px-3 py-2 text-sm font-semibold text-toned",
69
+ icon: "size-4 shrink-0 text-dimmed",
70
+ item: "flex items-center gap-2.5 border-t border-muted px-3 py-2.5 first:border-t-0",
71
+ avatar: "",
72
+ list: "",
73
+ media: "",
74
+ meta: "mt-0.5 flex min-w-0 items-center gap-1 text-xs text-muted",
75
+ more: "w-full justify-center rounded-none border-t border-muted",
76
+ reference: "font-mono text-[11px] text-dimmed",
77
+ root: variant === "card" || variant === "stack" ? `min-w-0 overflow-hidden ${DISPLAY_SURFACE_CLASSES[surface]}` : `flex min-w-0 items-center ${variant === "compact" ? "gap-2.5 p-2" : "gap-3 p-2.5"} ${DISPLAY_SURFACE_CLASSES[surface]}`,
78
+ title: "truncate font-semibold text-highlighted",
79
+ trailing: "shrink-0 text-end",
80
+ trailingCaption: "text-[11px] text-dimmed",
81
+ trailingValue: "font-extrabold text-highlighted tabular-nums"
82
+ },
83
+ appUi.value,
84
+ ui
85
+ )
86
+ );
87
+ function linkProps(item) {
88
+ if (item.to) return { is: ULink, ...displayLinkAttrs(item.to, item.target) };
89
+ if (item.onClick) return { is: "button", type: "button", onClick: item.onClick };
90
+ return { is: "div" };
91
+ }
92
+ </script>
93
+
94
+ <template>
95
+ <DisplaySkeleton v-if="loading" :layout="variant === 'stack' ? 'rows' : 'card'" :count="3" />
96
+ <div
97
+ v-else-if="variant === 'stack'"
98
+ :class="classes.root"
99
+ data-display="record"
100
+ data-variant="stack"
101
+ >
102
+ <div v-if="!isDisplayContentEmpty(heading)" :class="classes.header">
103
+ <UIcon v-if="headingIcon" :name="headingIcon" class="size-4 shrink-0 text-muted" />
104
+ <DisplayRender :content="heading" />
105
+ <span
106
+ class="ms-auto rounded-full bg-default px-2 py-px text-xs font-semibold text-toned tabular-nums"
107
+ >
108
+ {{ items?.length ?? 0 }}
109
+ </span>
110
+ </div>
111
+ <DisplayEmptyLine v-if="!items?.length" :content="empty" class="m-3" :class="classes.empty" />
112
+ <div v-else :class="classes.list">
113
+ <component
114
+ :is="linkProps(item).is"
115
+ v-for="(item, index) in reveal.visible.value"
116
+ :key="index"
117
+ v-bind="linkProps(item)"
118
+ :class="[
119
+ classes.item,
120
+ item.to || item.onClick ? 'w-full text-start hover:bg-elevated' : ''
121
+ ]"
122
+ >
123
+ <DisplayRecordMedia
124
+ :item="item"
125
+ size="sm"
126
+ :class="classes.media"
127
+ :avatar-class="classes.avatar"
128
+ />
129
+ <div :class="classes.body">
130
+ <div
131
+ v-if="!isDisplayContentEmpty(item.reference)"
132
+ v-reveal-truncated
133
+ :class="classes.reference"
134
+ >
135
+ <DisplayRender :content="item.reference" />
136
+ </div>
137
+ <div v-reveal-truncated :class="[classes.title, 'text-sm']">
138
+ <DisplayRender :content="item.title" />
139
+ </div>
140
+ <div v-if="!isDisplayContentEmpty(item.meta)" v-reveal-truncated :class="classes.meta">
141
+ <UIcon v-if="item.metaIcon" :name="item.metaIcon" class="size-3 shrink-0" />
142
+ <span v-reveal-truncated class="truncate"><DisplayRender :content="item.meta" /></span>
143
+ </div>
144
+ <div
145
+ v-if="!isDisplayContentEmpty(item.description)"
146
+ v-reveal-truncated
147
+ :class="classes.description"
148
+ >
149
+ <DisplayRender :content="item.description" />
150
+ </div>
151
+ <div v-if="item.badges?.length" :class="classes.badges">
152
+ <DisplayChip
153
+ v-for="(badge, badgeIndex) in item.badges"
154
+ :key="badgeIndex"
155
+ :chip="badge"
156
+ />
157
+ </div>
158
+ </div>
159
+ <DisplayChip v-if="item.chip" :chip="item.chip" />
160
+ <div v-if="!isDisplayContentEmpty(item.trailing)" :class="classes.trailing">
161
+ <div v-reveal-truncated :class="classes.trailingValue">
162
+ <DisplayRender :content="item.trailing" />
163
+ </div>
164
+ <div
165
+ v-if="!isDisplayContentEmpty(item.trailingCaption)"
166
+ v-reveal-truncated
167
+ :class="classes.trailingCaption"
168
+ >
169
+ <DisplayRender :content="item.trailingCaption" />
170
+ </div>
171
+ </div>
172
+ </component>
173
+ <DisplayMore
174
+ v-if="reveal.hidden.value"
175
+ :count="reveal.next.value"
176
+ :class="classes.more"
177
+ @reveal="reveal.reveal"
178
+ />
179
+ </div>
180
+ </div>
181
+ <component
182
+ :is="linkProps(single).is"
183
+ v-else-if="variant === 'card'"
184
+ v-bind="linkProps(single)"
185
+ :class="[classes.root, 'block text-start']"
186
+ data-display="record"
187
+ data-variant="card"
188
+ >
189
+ <DisplayRecordMedia :item="single" banner :class="classes.media" />
190
+ <div class="p-3.5">
191
+ <div
192
+ v-if="!isDisplayContentEmpty(single.reference)"
193
+ v-reveal-truncated
194
+ :class="classes.reference"
195
+ >
196
+ <DisplayRender :content="single.reference" />
197
+ </div>
198
+ <div v-reveal-truncated :class="classes.title"><DisplayRender :content="single.title" /></div>
199
+ <div v-if="!isDisplayContentEmpty(single.meta)" v-reveal-truncated :class="classes.meta">
200
+ <UIcon v-if="single.metaIcon" :name="single.metaIcon" class="size-3 shrink-0" />
201
+ <span v-reveal-truncated class="truncate"><DisplayRender :content="single.meta" /></span>
202
+ </div>
203
+ <div v-if="single.badges?.length" :class="classes.badges">
204
+ <DisplayChip v-for="(badge, index) in single.badges" :key="index" :chip="badge" />
205
+ </div>
206
+ <div
207
+ v-if="!isDisplayContentEmpty(single.description)"
208
+ v-reveal-truncated
209
+ :class="classes.description"
210
+ >
211
+ <DisplayRender :content="single.description" />
212
+ </div>
213
+ </div>
214
+ </component>
215
+ <component
216
+ :is="linkProps(single).is"
217
+ v-else
218
+ v-bind="linkProps(single)"
219
+ :class="[
220
+ classes.root,
221
+ single.to || single.onClick ? 'w-full text-start hover:bg-elevated' : ''
222
+ ]"
223
+ data-display="record"
224
+ :data-variant="variant"
225
+ >
226
+ <DisplayRecordMedia
227
+ :item="single"
228
+ :size="variant === 'compact' ? 'sm' : 'lg'"
229
+ :avatar-class="classes.avatar"
230
+ :class="classes.media"
231
+ />
232
+ <div :class="classes.body">
233
+ <div
234
+ v-if="!isDisplayContentEmpty(single.reference)"
235
+ v-reveal-truncated
236
+ :class="classes.reference"
237
+ >
238
+ <DisplayRender :content="single.reference" />
239
+ </div>
240
+ <div v-reveal-truncated :class="classes.title"><DisplayRender :content="single.title" /></div>
241
+ <div v-if="!isDisplayContentEmpty(single.meta)" v-reveal-truncated :class="classes.meta">
242
+ <UIcon v-if="single.metaIcon" :name="single.metaIcon" class="size-3 shrink-0" />
243
+ <span v-reveal-truncated class="truncate"><DisplayRender :content="single.meta" /></span>
244
+ </div>
245
+ <div v-if="single.badges?.length && variant === 'row'" :class="classes.badges">
246
+ <DisplayChip v-for="(badge, index) in single.badges" :key="index" :chip="badge" />
247
+ </div>
248
+ </div>
249
+ <DisplayChip v-if="single.chip" :chip="single.chip" />
250
+ <div v-if="!isDisplayContentEmpty(single.trailing)" :class="classes.trailing">
251
+ <div v-reveal-truncated :class="classes.trailingValue">
252
+ <DisplayRender :content="single.trailing" />
253
+ </div>
254
+ <div
255
+ v-if="!isDisplayContentEmpty(single.trailingCaption)"
256
+ v-reveal-truncated
257
+ :class="classes.trailingCaption"
258
+ >
259
+ <DisplayRender :content="single.trailingCaption" />
260
+ </div>
261
+ </div>
262
+ <UIcon
263
+ v-if="variant === 'compact' && (single.to || single.onClick)"
264
+ name="i-lucide-chevron-right"
265
+ :class="classes.icon"
266
+ />
267
+ </component>
268
+ </template>
@@ -0,0 +1,4 @@
1
+ import type { DisplayRecordProps } from '../../types/index.js';
2
+ declare const __VLS_export: import("vue").DefineComponent<DisplayRecordProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayRecordProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
3
+ declare const _default: typeof __VLS_export;
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import type { DisplayStatProps } from '../../types/index.js';
2
+ declare const __VLS_export: import("vue").DefineComponent<DisplayStatProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayStatProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
3
+ declare const _default: typeof __VLS_export;
4
+ export default _default;
@@ -0,0 +1,189 @@
1
+ <script setup>
2
+ import UIcon from "@nuxt/ui/components/Icon.vue";
3
+ import { twMerge } from "tailwind-merge";
4
+ import { computed } from "vue";
5
+ import { useDisplayAppUi } from "../../composables/use-display-config";
6
+ import { vRevealTruncated } from "../../directives/reveal-truncated";
7
+ import { resolveDisplayClasses } from "../../utils/classes";
8
+ import { isDisplayContentEmpty, resolveDisplayText } from "../../utils/content";
9
+ import {
10
+ DISPLAY_SURFACE_CLASSES,
11
+ DISPLAY_SURFACE_PADDING,
12
+ displayToneClass
13
+ } from "../../utils/tone";
14
+ import DisplayChip from "../parts/display-chip.vue";
15
+ import DisplayRender from "../parts/display-render";
16
+ import DisplaySkeleton from "../parts/display-skeleton.vue";
17
+ const {
18
+ variant = "hero",
19
+ label = void 0,
20
+ value = void 0,
21
+ unit = void 0,
22
+ caption = void 0,
23
+ chip = void 0,
24
+ status = void 0,
25
+ delta = void 0,
26
+ trend = void 0,
27
+ items = void 0,
28
+ tone = "primary",
29
+ size = "md",
30
+ surface = void 0,
31
+ loading = false,
32
+ ui = void 0
33
+ } = defineProps({
34
+ variant: { type: String, required: false },
35
+ label: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
36
+ value: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
37
+ unit: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
38
+ caption: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
39
+ chip: { type: Object, required: false },
40
+ status: { type: Object, required: false },
41
+ delta: { type: Object, required: false },
42
+ trend: { type: Array, required: false },
43
+ items: { type: Array, required: false },
44
+ tone: { type: String, required: false },
45
+ size: { type: String, required: false },
46
+ surface: { type: String, required: false },
47
+ loading: { type: Boolean, required: false },
48
+ ui: { type: Object, required: false }
49
+ });
50
+ const VALUE_SIZES = {
51
+ hero: { lg: "text-4xl", md: "text-3xl", sm: "text-xl" },
52
+ price: { lg: "text-3xl", md: "text-2xl", sm: "text-lg" },
53
+ row: { lg: "text-2xl", md: "text-xl", sm: "text-base" },
54
+ trend: { lg: "text-3xl", md: "text-2xl", sm: "text-lg" }
55
+ };
56
+ const appUi = useDisplayAppUi("stat");
57
+ const resolvedSurface = computed(
58
+ () => surface ?? (variant === "hero" ? "muted" : variant === "row" ? "bordered" : "plain")
59
+ );
60
+ const deltaTone = computed(() => {
61
+ if (!delta) return "neutral";
62
+ if (delta.tone) return delta.tone;
63
+ if (delta.direction === "down") return "error";
64
+ return delta.direction === "flat" ? "neutral" : "success";
65
+ });
66
+ const deltaIcon = computed(() => {
67
+ if (delta?.direction === "down") return "i-lucide-trending-down";
68
+ return delta?.direction === "flat" ? "i-lucide-minus" : "i-lucide-trending-up";
69
+ });
70
+ const sparkline = computed(() => {
71
+ if (!trend || trend.length < 2) return void 0;
72
+ const min = Math.min(...trend);
73
+ const span = Math.max(...trend) - min || 1;
74
+ const points = trend.map((point, index) => {
75
+ const x = index / (trend.length - 1) * 100;
76
+ const y = 30 - (point - min) / span * 26;
77
+ return `${x.toFixed(2)} ${y.toFixed(2)}`;
78
+ });
79
+ const line = `M${points.join(" L")}`;
80
+ return { area: `${line} L100 32 L0 32 Z`, line };
81
+ });
82
+ const classes = computed(
83
+ () => resolveDisplayClasses(
84
+ {
85
+ caption: variant === "hero" ? "mt-1 flex flex-wrap items-center justify-center gap-1.5 text-xs text-muted" : "mt-0.5 flex flex-wrap items-center gap-1.5 text-xs text-muted",
86
+ delta: "inline-flex items-center gap-1 rounded-full bg-[var(--nut-tone-soft)] px-2 py-0.5 text-xs font-bold text-[var(--nut-tone-ink)]",
87
+ item: "min-w-0 border-s border-default px-3.5 py-3 first:border-s-0",
88
+ itemCaption: "mt-0.5 text-xs text-muted",
89
+ itemLabel: "text-xs text-dimmed",
90
+ itemValue: `mt-0.5 font-extrabold text-highlighted tabular-nums ${VALUE_SIZES.row[size]}`,
91
+ items: "grid",
92
+ label: "text-xs font-semibold text-muted",
93
+ root: variant === "row" ? DISPLAY_SURFACE_CLASSES[resolvedSurface.value] : `flex min-w-0 ${variant === "hero" ? "flex-col items-center text-center" : variant === "trend" ? "items-end gap-4" : "flex-col"} ${DISPLAY_SURFACE_CLASSES[resolvedSurface.value]} ${DISPLAY_SURFACE_PADDING[resolvedSurface.value]}`,
94
+ sparkline: "h-11 min-w-0 flex-1 text-[var(--nut-tone)]",
95
+ status: "mt-1 flex items-center gap-1.5 text-sm font-semibold text-[var(--nut-tone-ink)]",
96
+ unit: "ms-1 text-sm font-semibold tracking-normal text-muted",
97
+ value: `my-0.5 leading-tight font-extrabold tracking-tight text-highlighted tabular-nums ${VALUE_SIZES[variant][size]}`
98
+ },
99
+ appUi.value,
100
+ ui
101
+ )
102
+ );
103
+ </script>
104
+
105
+ <template>
106
+ <DisplaySkeleton
107
+ v-if="loading"
108
+ :layout="variant === 'row' ? 'tiles' : 'lines'"
109
+ :count="variant === 'row' ? 3 : 2"
110
+ />
111
+ <div v-else-if="variant === 'row'" :class="classes.root" data-display="stat" data-variant="row">
112
+ <div
113
+ :class="classes.items"
114
+ :style="{ gridTemplateColumns: `repeat(${items?.length || 1}, minmax(0, 1fr))` }"
115
+ >
116
+ <div
117
+ v-for="(item, index) in items"
118
+ :key="index"
119
+ :class="[classes.item, item.tone ? displayToneClass(item.tone) : '']"
120
+ >
121
+ <div v-reveal-truncated :class="classes.itemLabel">
122
+ <DisplayRender :content="item.label" />
123
+ </div>
124
+ <div :class="twMerge(classes.itemValue, item.tone ? 'text-[var(--nut-tone-ink)]' : '')">
125
+ <DisplayRender :content="item.value" />
126
+ </div>
127
+ <div
128
+ v-if="!isDisplayContentEmpty(item.caption)"
129
+ v-reveal-truncated
130
+ :class="classes.itemCaption"
131
+ >
132
+ <DisplayRender :content="item.caption" />
133
+ </div>
134
+ </div>
135
+ </div>
136
+ </div>
137
+ <div
138
+ v-else
139
+ :class="[classes.root, displayToneClass(tone)]"
140
+ data-display="stat"
141
+ :data-variant="variant"
142
+ >
143
+ <div :class="variant === 'trend' ? 'min-w-0' : 'contents'">
144
+ <div v-if="!isDisplayContentEmpty(label)" v-reveal-truncated :class="classes.label">
145
+ <DisplayRender :content="label" />
146
+ </div>
147
+ <div :class="variant === 'trend' ? 'flex items-center gap-2' : 'contents'">
148
+ <div v-reveal-truncated :class="classes.value">
149
+ <DisplayRender :content="value" />
150
+ <span v-if="!isDisplayContentEmpty(unit)" :class="classes.unit"
151
+ ><DisplayRender :content="unit"
152
+ /></span>
153
+ </div>
154
+ <span v-if="delta" :class="[classes.delta, displayToneClass(deltaTone)]" data-display-delta>
155
+ <UIcon :name="deltaIcon" class="size-3.5" />{{ resolveDisplayText(delta.value) }}
156
+ </span>
157
+ </div>
158
+ <div v-if="status" :class="[classes.status, displayToneClass(status.tone ?? 'success')]">
159
+ <UIcon v-if="status.icon" :name="status.icon" class="size-4 shrink-0" />
160
+ <DisplayRender :content="status.text" />
161
+ </div>
162
+ <div
163
+ v-if="!isDisplayContentEmpty(caption) || chip"
164
+ v-reveal-truncated
165
+ :class="classes.caption"
166
+ >
167
+ <DisplayChip v-if="chip" :chip="chip" />
168
+ <DisplayRender :content="caption" />
169
+ </div>
170
+ </div>
171
+ <svg
172
+ v-if="variant === 'trend' && sparkline"
173
+ :class="classes.sparkline"
174
+ viewBox="0 0 100 32"
175
+ preserveAspectRatio="none"
176
+ aria-hidden="true"
177
+ >
178
+ <path :d="sparkline.area" fill="currentColor" fill-opacity="0.14" />
179
+ <path
180
+ :d="sparkline.line"
181
+ fill="none"
182
+ stroke="currentColor"
183
+ stroke-width="2"
184
+ stroke-linejoin="round"
185
+ vector-effect="non-scaling-stroke"
186
+ />
187
+ </svg>
188
+ </div>
189
+ </template>
@@ -0,0 +1,4 @@
1
+ import type { DisplayStatProps } from '../../types/index.js';
2
+ declare const __VLS_export: import("vue").DefineComponent<DisplayStatProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayStatProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
3
+ declare const _default: typeof __VLS_export;
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import type { DisplayTableProps } from '../../types/index.js';
2
+ declare const __VLS_export: import("vue").DefineComponent<DisplayTableProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayTableProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
3
+ declare const _default: typeof __VLS_export;
4
+ export default _default;
@@ -0,0 +1,136 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { isNumber } from "../../../shared/utils/predicate";
4
+ import { useDisplayAppUi } from "../../composables/use-display-config";
5
+ import { useDisplayReveal } from "../../composables/use-display-reveal";
6
+ import { vRevealTruncated } from "../../directives/reveal-truncated";
7
+ import { resolveDisplayClasses } from "../../utils/classes";
8
+ import { isDisplayContentEmpty } from "../../utils/content";
9
+ import { DISPLAY_SURFACE_CLASSES } from "../../utils/tone";
10
+ import DisplayEmptyLine from "../parts/display-empty-line.vue";
11
+ import DisplayMore from "../parts/display-more.vue";
12
+ import DisplayRender from "../parts/display-render";
13
+ import DisplaySkeleton from "../parts/display-skeleton.vue";
14
+ const {
15
+ columns,
16
+ rows,
17
+ footer = void 0,
18
+ caption = void 0,
19
+ note = void 0,
20
+ maxHeight = void 0,
21
+ surface = "bordered",
22
+ max = void 0,
23
+ step = void 0,
24
+ empty = void 0,
25
+ loading = false,
26
+ ui = void 0
27
+ } = defineProps({
28
+ columns: { type: Array, required: true },
29
+ rows: { type: Array, required: true },
30
+ footer: { type: Object, required: false },
31
+ caption: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
32
+ note: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
33
+ maxHeight: { type: [Number, String], required: false },
34
+ surface: { type: String, required: false },
35
+ loading: { type: Boolean, required: false },
36
+ ui: { type: Object, required: false },
37
+ max: { type: Number, required: false },
38
+ step: { type: Number, required: false },
39
+ empty: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true }
40
+ });
41
+ const ALIGN_CLASSES = { center: "text-center", end: "text-end", start: "text-start" };
42
+ const appUi = useDisplayAppUi("table");
43
+ const reveal = useDisplayReveal({ items: () => rows, max: () => max, step: () => step });
44
+ const scrollerStyle = computed(
45
+ () => maxHeight === void 0 ? void 0 : { maxHeight: isNumber(maxHeight) ? `${maxHeight}px` : maxHeight }
46
+ );
47
+ const classes = computed(
48
+ () => resolveDisplayClasses(
49
+ {
50
+ cell: "px-3 py-2 align-middle text-default",
51
+ empty: "",
52
+ foot: "",
53
+ footCell: "sticky bottom-0 border-t border-default bg-elevated px-3 py-2 font-bold text-highlighted",
54
+ head: "",
55
+ headCell: "sticky top-0 z-[1] border-b border-default bg-elevated px-3 py-2 text-[11px] font-bold tracking-[0.07em] whitespace-nowrap text-muted uppercase",
56
+ meta: "mt-1.5 flex justify-between gap-3 text-xs text-dimmed",
57
+ more: "mt-1 self-center",
58
+ root: "flex min-w-0 flex-col",
59
+ row: "border-t border-muted first:border-t-0",
60
+ scroller: `min-w-0 overflow-auto ${DISPLAY_SURFACE_CLASSES[surface]}`,
61
+ table: "w-full border-collapse text-sm"
62
+ },
63
+ appUi.value,
64
+ ui
65
+ )
66
+ );
67
+ function alignClass(column) {
68
+ return [
69
+ ALIGN_CLASSES[column.align ?? (column.numeric ? "end" : "start")],
70
+ column.numeric ? "tabular-nums" : "",
71
+ column.mono ? "font-mono text-[13px]" : ""
72
+ ];
73
+ }
74
+ </script>
75
+
76
+ <template>
77
+ <DisplaySkeleton v-if="loading" layout="rows" :count="Math.min(Math.max(rows.length, 3), 6)" />
78
+ <DisplayEmptyLine v-else-if="!rows.length" :content="empty" :class="classes.empty" />
79
+ <div v-else :class="classes.root" data-display="table">
80
+ <div :class="classes.scroller" :style="scrollerStyle">
81
+ <table :class="classes.table">
82
+ <thead :class="classes.head">
83
+ <tr>
84
+ <th
85
+ v-for="column in columns"
86
+ :key="column.key"
87
+ scope="col"
88
+ v-reveal-truncated
89
+ :class="[classes.headCell, ...alignClass(column)]"
90
+ :style="column.width ? { width: column.width } : void 0"
91
+ >
92
+ <DisplayRender :content="column.label" />
93
+ </th>
94
+ </tr>
95
+ </thead>
96
+ <tbody>
97
+ <tr v-for="(row, index) in reveal.visible.value" :key="index" :class="classes.row">
98
+ <td
99
+ v-for="column in columns"
100
+ :key="column.key"
101
+ v-reveal-truncated
102
+ :class="[classes.cell, ...alignClass(column)]"
103
+ >
104
+ <DisplayRender :content="row[column.key]" />
105
+ </td>
106
+ </tr>
107
+ </tbody>
108
+ <tfoot v-if="footer" :class="classes.foot">
109
+ <tr>
110
+ <td
111
+ v-for="column in columns"
112
+ :key="column.key"
113
+ :class="[classes.footCell, ...alignClass(column)]"
114
+ >
115
+ <DisplayRender :content="footer[column.key]" />
116
+ </td>
117
+ </tr>
118
+ </tfoot>
119
+ </table>
120
+ </div>
121
+ <DisplayMore
122
+ v-if="reveal.hidden.value"
123
+ :count="reveal.next.value"
124
+ :class="classes.more"
125
+ @reveal="reveal.reveal"
126
+ />
127
+ <div
128
+ v-if="!isDisplayContentEmpty(caption) || !isDisplayContentEmpty(note)"
129
+ v-reveal-truncated
130
+ :class="classes.meta"
131
+ >
132
+ <span><DisplayRender :content="caption" /></span>
133
+ <span><DisplayRender :content="note" /></span>
134
+ </div>
135
+ </div>
136
+ </template>
@@ -0,0 +1,4 @@
1
+ import type { DisplayTableProps } from '../../types/index.js';
2
+ declare const __VLS_export: import("vue").DefineComponent<DisplayTableProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayTableProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
3
+ declare const _default: typeof __VLS_export;
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import type { DisplayTextProps } from '../../types/index.js';
2
+ declare const __VLS_export: import("vue").DefineComponent<DisplayTextProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayTextProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
3
+ declare const _default: typeof __VLS_export;
4
+ export default _default;