nuxt-ui-tools 1.23.0 → 1.25.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.
- package/dist/module.d.mts +3 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +8 -0
- package/dist/runtime/display/components/blocks/display-accordion.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-accordion.vue +93 -0
- package/dist/runtime/display/components/blocks/display-accordion.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-alert.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-alert.vue +133 -0
- package/dist/runtime/display/components/blocks/display-alert.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-breakdown.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-breakdown.vue +178 -0
- package/dist/runtime/display/components/blocks/display-breakdown.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-chart.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-chart.vue +237 -0
- package/dist/runtime/display/components/blocks/display-chart.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-code.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-code.vue +143 -0
- package/dist/runtime/display/components/blocks/display-code.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-date.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-date.vue +174 -0
- package/dist/runtime/display/components/blocks/display-date.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-diff.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-diff.vue +142 -0
- package/dist/runtime/display/components/blocks/display-diff.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-empty.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-empty.vue +74 -0
- package/dist/runtime/display/components/blocks/display-empty.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-facts.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-facts.vue +180 -0
- package/dist/runtime/display/components/blocks/display-facts.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-heading.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-heading.vue +96 -0
- package/dist/runtime/display/components/blocks/display-heading.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-list.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-list.vue +295 -0
- package/dist/runtime/display/components/blocks/display-list.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-media.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-media.vue +326 -0
- package/dist/runtime/display/components/blocks/display-media.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-meter.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-meter.vue +301 -0
- package/dist/runtime/display/components/blocks/display-meter.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-person.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-person.vue +146 -0
- package/dist/runtime/display/components/blocks/display-person.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-record.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-record.vue +208 -0
- package/dist/runtime/display/components/blocks/display-record.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-stat.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-stat.vue +178 -0
- package/dist/runtime/display/components/blocks/display-stat.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-table.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-table.vue +132 -0
- package/dist/runtime/display/components/blocks/display-table.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-text.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-text.vue +135 -0
- package/dist/runtime/display/components/blocks/display-text.vue.d.ts +4 -0
- package/dist/runtime/display/components/blocks/display-timeline.d.vue.ts +4 -0
- package/dist/runtime/display/components/blocks/display-timeline.vue +232 -0
- package/dist/runtime/display/components/blocks/display-timeline.vue.d.ts +4 -0
- package/dist/runtime/display/components/display.d.vue.ts +24 -0
- package/dist/runtime/display/components/display.vue +21 -0
- package/dist/runtime/display/components/display.vue.d.ts +24 -0
- package/dist/runtime/display/components/parts/display-actions.d.vue.ts +9 -0
- package/dist/runtime/display/components/parts/display-actions.vue +24 -0
- package/dist/runtime/display/components/parts/display-actions.vue.d.ts +9 -0
- package/dist/runtime/display/components/parts/display-chip.d.vue.ts +11 -0
- package/dist/runtime/display/components/parts/display-chip.vue +45 -0
- package/dist/runtime/display/components/parts/display-chip.vue.d.ts +11 -0
- package/dist/runtime/display/components/parts/display-copy.d.vue.ts +6 -0
- package/dist/runtime/display/components/parts/display-copy.vue +27 -0
- package/dist/runtime/display/components/parts/display-copy.vue.d.ts +6 -0
- package/dist/runtime/display/components/parts/display-empty-line.d.vue.ts +7 -0
- package/dist/runtime/display/components/parts/display-empty-line.vue +21 -0
- package/dist/runtime/display/components/parts/display-empty-line.vue.d.ts +7 -0
- package/dist/runtime/display/components/parts/display-fact-value.d.vue.ts +7 -0
- package/dist/runtime/display/components/parts/display-fact-value.vue +35 -0
- package/dist/runtime/display/components/parts/display-fact-value.vue.d.ts +7 -0
- package/dist/runtime/display/components/parts/display-load-error.d.vue.ts +7 -0
- package/dist/runtime/display/components/parts/display-load-error.vue +29 -0
- package/dist/runtime/display/components/parts/display-load-error.vue.d.ts +7 -0
- package/dist/runtime/display/components/parts/display-more.d.vue.ts +10 -0
- package/dist/runtime/display/components/parts/display-more.vue +23 -0
- package/dist/runtime/display/components/parts/display-more.vue.d.ts +10 -0
- package/dist/runtime/display/components/parts/display-record-media.d.vue.ts +9 -0
- package/dist/runtime/display/components/parts/display-record-media.vue +59 -0
- package/dist/runtime/display/components/parts/display-record-media.vue.d.ts +9 -0
- package/dist/runtime/display/components/parts/display-render.d.ts +10 -0
- package/dist/runtime/display/components/parts/display-render.js +5 -0
- package/dist/runtime/display/components/parts/display-skeleton.d.vue.ts +7 -0
- package/dist/runtime/display/components/parts/display-skeleton.vue +67 -0
- package/dist/runtime/display/components/parts/display-skeleton.vue.d.ts +7 -0
- package/dist/runtime/display/composables/use-display-config.d.ts +6 -0
- package/dist/runtime/display/composables/use-display-config.js +11 -0
- package/dist/runtime/display/composables/use-display-file-preview.d.ts +9 -0
- package/dist/runtime/display/composables/use-display-file-preview.js +11 -0
- package/dist/runtime/display/composables/use-display-icons.d.ts +8 -0
- package/dist/runtime/display/composables/use-display-icons.js +62 -0
- package/dist/runtime/display/composables/use-display-locale.d.ts +5 -0
- package/dist/runtime/display/composables/use-display-locale.js +5 -0
- package/dist/runtime/display/composables/use-display-number.d.ts +2 -0
- package/dist/runtime/display/composables/use-display-number.js +7 -0
- package/dist/runtime/display/composables/use-display-reveal.d.ts +14 -0
- package/dist/runtime/display/composables/use-display-reveal.js +15 -0
- package/dist/runtime/display/composables/use-display-url.d.ts +26 -0
- package/dist/runtime/display/composables/use-display-url.js +46 -0
- package/dist/runtime/display/index.d.ts +4 -0
- package/dist/runtime/display/index.js +3 -0
- package/dist/runtime/display/plugins/display-tones.d.ts +3 -0
- package/dist/runtime/display/plugins/display-tones.js +17 -0
- package/dist/runtime/display/types/blocks/accordion.d.ts +18 -0
- package/dist/runtime/display/types/blocks/accordion.js +0 -0
- package/dist/runtime/display/types/blocks/alert.d.ts +31 -0
- package/dist/runtime/display/types/blocks/alert.js +0 -0
- package/dist/runtime/display/types/blocks/breakdown.d.ts +36 -0
- package/dist/runtime/display/types/blocks/breakdown.js +0 -0
- package/dist/runtime/display/types/blocks/chart.d.ts +23 -0
- package/dist/runtime/display/types/blocks/chart.js +0 -0
- package/dist/runtime/display/types/blocks/code.d.ts +21 -0
- package/dist/runtime/display/types/blocks/code.js +0 -0
- package/dist/runtime/display/types/blocks/date.d.ts +27 -0
- package/dist/runtime/display/types/blocks/date.js +0 -0
- package/dist/runtime/display/types/blocks/diff.d.ts +20 -0
- package/dist/runtime/display/types/blocks/diff.js +0 -0
- package/dist/runtime/display/types/blocks/empty.d.ts +13 -0
- package/dist/runtime/display/types/blocks/empty.js +0 -0
- package/dist/runtime/display/types/blocks/facts.d.ts +50 -0
- package/dist/runtime/display/types/blocks/facts.js +0 -0
- package/dist/runtime/display/types/blocks/heading.d.ts +19 -0
- package/dist/runtime/display/types/blocks/heading.js +0 -0
- package/dist/runtime/display/types/blocks/list.d.ts +36 -0
- package/dist/runtime/display/types/blocks/list.js +0 -0
- package/dist/runtime/display/types/blocks/media.d.ts +42 -0
- package/dist/runtime/display/types/blocks/media.js +0 -0
- package/dist/runtime/display/types/blocks/meter.d.ts +48 -0
- package/dist/runtime/display/types/blocks/meter.js +0 -0
- package/dist/runtime/display/types/blocks/person.d.ts +32 -0
- package/dist/runtime/display/types/blocks/person.js +0 -0
- package/dist/runtime/display/types/blocks/record.d.ts +42 -0
- package/dist/runtime/display/types/blocks/record.js +0 -0
- package/dist/runtime/display/types/blocks/stat.d.ts +44 -0
- package/dist/runtime/display/types/blocks/stat.js +0 -0
- package/dist/runtime/display/types/blocks/table.d.ts +28 -0
- package/dist/runtime/display/types/blocks/table.js +0 -0
- package/dist/runtime/display/types/blocks/text.d.ts +22 -0
- package/dist/runtime/display/types/blocks/text.js +0 -0
- package/dist/runtime/display/types/blocks/timeline.d.ts +37 -0
- package/dist/runtime/display/types/blocks/timeline.js +0 -0
- package/dist/runtime/display/types/config.d.ts +53 -0
- package/dist/runtime/display/types/config.js +0 -0
- package/dist/runtime/display/types/index.d.ts +22 -0
- package/dist/runtime/display/types/index.js +0 -0
- package/dist/runtime/display/types/registry.d.ts +57 -0
- package/dist/runtime/display/types/registry.js +0 -0
- package/dist/runtime/display/types/shared.d.ts +71 -0
- package/dist/runtime/display/types/shared.js +0 -0
- package/dist/runtime/display/utils/classes.d.ts +3 -0
- package/dist/runtime/display/utils/classes.js +7 -0
- package/dist/runtime/display/utils/config.d.ts +6 -0
- package/dist/runtime/display/utils/config.js +7 -0
- package/dist/runtime/display/utils/content.d.ts +7 -0
- package/dist/runtime/display/utils/content.js +13 -0
- package/dist/runtime/display/utils/dates.d.ts +16 -0
- package/dist/runtime/display/utils/dates.js +34 -0
- package/dist/runtime/display/utils/json.d.ts +7 -0
- package/dist/runtime/display/utils/json.js +15 -0
- package/dist/runtime/display/utils/meter.d.ts +7 -0
- package/dist/runtime/display/utils/meter.js +13 -0
- package/dist/runtime/display/utils/registry.d.ts +47 -0
- package/dist/runtime/display/utils/registry.js +64 -0
- package/dist/runtime/display/utils/tone-css.d.ts +7 -0
- package/dist/runtime/display/utils/tone-css.js +38 -0
- package/dist/runtime/display/utils/tone.d.ts +26 -0
- package/dist/runtime/display/utils/tone.js +38 -0
- package/dist/runtime/display/utils/urls.d.ts +10 -0
- package/dist/runtime/display/utils/urls.js +33 -0
- package/dist/runtime/file-preview/components/shell/file-preview-stage.vue +5 -3
- package/dist/runtime/file-preview/composables/use-file-preview-source.d.ts +7 -0
- package/dist/runtime/file-preview/composables/use-file-preview-source.js +7 -1
- package/dist/runtime/file-preview/index.d.ts +1 -0
- package/dist/runtime/file-preview/index.js +1 -0
- package/dist/runtime/file-preview/types/file.d.ts +9 -0
- package/dist/runtime/file-preview/utils/errors.d.ts +30 -0
- package/dist/runtime/file-preview/utils/errors.js +26 -0
- package/dist/runtime/form/components/utils/form-file-preview.vue +7 -2
- package/dist/runtime/form/composables/use-form-root.js +2 -0
- package/dist/runtime/form/composables/use-form-runtime.js +7 -2
- package/dist/runtime/form/fields/index.d.ts +5 -0
- package/dist/runtime/form/fields/info/component.vue +51 -19
- package/dist/runtime/form/fields/info/config.d.ts +5 -0
- package/dist/runtime/form/fields/info/config.js +2 -1
- package/dist/runtime/form/fields/info/types.d.ts +78 -4
- package/dist/runtime/form/fields/info/use-info-display.d.ts +20 -0
- package/dist/runtime/form/fields/info/use-info-display.js +82 -0
- package/dist/runtime/form/fields/upload/upload-item.vue +10 -2
- package/dist/runtime/form/types/api.d.ts +6 -0
- package/dist/runtime/form/types/runtime.d.ts +2 -0
- package/dist/runtime/form/utils/dynamic.d.ts +6 -0
- package/dist/runtime/form/utils/dynamic.js +7 -0
- package/dist/runtime/i18n/locales/en.js +32 -0
- package/dist/runtime/i18n/locales/fr.js +32 -0
- package/dist/runtime/i18n/types.d.ts +40 -0
- package/dist/runtime/shared/styles/tokens.css +1 -1
- package/dist/runtime/shared/utils/file.d.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-root.vue +2 -0
- package/dist/runtime/table/components/data-list/data-list-selection-actions.d.vue.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-selection-actions.vue +32 -5
- package/dist/runtime/table/components/data-list/data-list-selection-actions.vue.d.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-selection-sheet.d.vue.ts +10 -0
- package/dist/runtime/table/components/data-list/data-list-selection-sheet.vue +238 -0
- package/dist/runtime/table/components/data-list/data-list-selection-sheet.vue.d.ts +10 -0
- package/dist/runtime/table/components/grid/grid-renderer.vue +2 -0
- package/dist/runtime/table/components/summary/summary-renderer.vue +2 -0
- package/dist/runtime/table/components/table/table-renderer.vue +2 -0
- package/dist/runtime/table/components/utils/overlay-inset-spacer.d.vue.ts +3 -0
- package/dist/runtime/table/components/utils/overlay-inset-spacer.vue +13 -0
- package/dist/runtime/table/components/utils/overlay-inset-spacer.vue.d.ts +3 -0
- package/dist/runtime/table/composables/use-data-list-overlay-inset.d.ts +10 -0
- package/dist/runtime/table/composables/use-data-list-overlay-inset.js +11 -0
- package/dist/runtime/table/composables/use-table-actions.js +11 -2
- package/dist/runtime/table/constants/mobile.d.ts +0 -7
- package/dist/runtime/table/constants/mobile.js +0 -1
- package/dist/runtime/table/types/actions.d.ts +7 -0
- package/dist/runtime/table/types/data-list.d.ts +8 -1
- package/dist/runtime/table/utils/data-list-ui.d.ts +1 -1
- package/package.json +16 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import UIcon from "@nuxt/ui/components/Icon.vue";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import { useDisplayAppUi } from "../../composables/use-display-config";
|
|
5
|
+
import { useDisplayIcons } from "../../composables/use-display-icons";
|
|
6
|
+
import { useDisplayLocale } from "../../composables/use-display-locale";
|
|
7
|
+
import { resolveDisplayClasses } from "../../utils/classes";
|
|
8
|
+
import { isDisplayContentEmpty } from "../../utils/content";
|
|
9
|
+
import DisplayChip from "../parts/display-chip.vue";
|
|
10
|
+
import DisplayRender from "../parts/display-render";
|
|
11
|
+
import DisplaySkeleton from "../parts/display-skeleton.vue";
|
|
12
|
+
const {
|
|
13
|
+
variant = "inline",
|
|
14
|
+
title = void 0,
|
|
15
|
+
columns = void 0,
|
|
16
|
+
items,
|
|
17
|
+
showUnchanged = false,
|
|
18
|
+
loading = false,
|
|
19
|
+
ui = void 0
|
|
20
|
+
} = defineProps({
|
|
21
|
+
variant: { type: String, required: false },
|
|
22
|
+
title: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
23
|
+
columns: { type: Array, required: false },
|
|
24
|
+
items: { type: Array, required: true },
|
|
25
|
+
showUnchanged: { type: Boolean, required: false },
|
|
26
|
+
loading: { type: Boolean, required: false },
|
|
27
|
+
ui: { type: Object, required: false }
|
|
28
|
+
});
|
|
29
|
+
const { t } = useDisplayLocale();
|
|
30
|
+
const icons = useDisplayIcons();
|
|
31
|
+
const appUi = useDisplayAppUi("diff");
|
|
32
|
+
const inlineItems = computed(
|
|
33
|
+
() => showUnchanged ? items : items.filter((item) => item.changed !== false)
|
|
34
|
+
);
|
|
35
|
+
const headings = computed(
|
|
36
|
+
() => columns ?? [t("display.field"), t("display.before"), t("display.after")]
|
|
37
|
+
);
|
|
38
|
+
const classes = computed(
|
|
39
|
+
() => resolveDisplayClasses(
|
|
40
|
+
{
|
|
41
|
+
after: "rounded-[4px] bg-[var(--nut-display-success-soft)] px-1.5 py-px font-semibold text-[var(--nut-display-success-ink)]",
|
|
42
|
+
arrow: "size-3.5 shrink-0 text-dimmed",
|
|
43
|
+
before: "rounded-[4px] bg-[var(--nut-display-error-soft)] px-1.5 py-px text-[var(--nut-display-error-ink)] line-through decoration-[color-mix(in_oklab,currentColor_45%,transparent)]",
|
|
44
|
+
cell: "border-t border-muted px-3 py-2 align-middle",
|
|
45
|
+
headCell: "bg-elevated px-3 py-2 text-start text-[11px] font-bold tracking-[0.07em] text-muted uppercase",
|
|
46
|
+
item: "",
|
|
47
|
+
label: "mb-1 flex items-center gap-2 text-xs text-muted",
|
|
48
|
+
note: "",
|
|
49
|
+
root: "flex min-w-0 flex-col gap-2.5",
|
|
50
|
+
table: "w-full border-collapse text-sm",
|
|
51
|
+
title: "text-sm font-semibold text-toned",
|
|
52
|
+
unchanged: "text-muted",
|
|
53
|
+
values: "flex flex-wrap items-center gap-1.5 text-sm"
|
|
54
|
+
},
|
|
55
|
+
appUi.value,
|
|
56
|
+
ui
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<template>
|
|
62
|
+
<DisplaySkeleton
|
|
63
|
+
v-if="loading"
|
|
64
|
+
:layout="variant === 'columns' ? 'rows' : 'lines'"
|
|
65
|
+
:count="Math.max(items.length, 2)"
|
|
66
|
+
/>
|
|
67
|
+
<div v-else :class="classes.root" data-display="diff" :data-variant="variant">
|
|
68
|
+
<div v-if="!isDisplayContentEmpty(title)" :class="classes.title">
|
|
69
|
+
<DisplayRender :content="title" />
|
|
70
|
+
</div>
|
|
71
|
+
<template v-if="variant === 'inline'">
|
|
72
|
+
<div v-for="(item, index) in inlineItems" :key="index" :class="classes.item">
|
|
73
|
+
<div :class="classes.label">
|
|
74
|
+
<DisplayRender :content="item.label" />
|
|
75
|
+
<DisplayChip v-if="item.note" :chip="item.note" :class="classes.note" />
|
|
76
|
+
</div>
|
|
77
|
+
<div
|
|
78
|
+
v-if="item.changed === false"
|
|
79
|
+
:class="[classes.values, classes.unchanged]"
|
|
80
|
+
data-unchanged
|
|
81
|
+
>
|
|
82
|
+
<DisplayRender :content="isDisplayContentEmpty(item.after) ? item.before : item.after" />
|
|
83
|
+
</div>
|
|
84
|
+
<div v-else :class="classes.values">
|
|
85
|
+
<span v-if="!isDisplayContentEmpty(item.before)" :class="classes.before"
|
|
86
|
+
><DisplayRender :content="item.before"
|
|
87
|
+
/></span>
|
|
88
|
+
<UIcon
|
|
89
|
+
v-if="!isDisplayContentEmpty(item.before) && !isDisplayContentEmpty(item.after)"
|
|
90
|
+
:name="icons.arrowRight"
|
|
91
|
+
:class="classes.arrow"
|
|
92
|
+
/>
|
|
93
|
+
<span v-if="!isDisplayContentEmpty(item.after)" :class="classes.after"
|
|
94
|
+
><DisplayRender :content="item.after"
|
|
95
|
+
/></span>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</template>
|
|
99
|
+
<div v-else class="overflow-hidden rounded-[var(--nut-display-radius)] border border-default">
|
|
100
|
+
<table :class="classes.table">
|
|
101
|
+
<thead>
|
|
102
|
+
<tr>
|
|
103
|
+
<th
|
|
104
|
+
v-for="(heading, index) in headings"
|
|
105
|
+
:key="index"
|
|
106
|
+
scope="col"
|
|
107
|
+
:class="classes.headCell"
|
|
108
|
+
>
|
|
109
|
+
<DisplayRender :content="heading" />
|
|
110
|
+
</th>
|
|
111
|
+
</tr>
|
|
112
|
+
</thead>
|
|
113
|
+
<tbody>
|
|
114
|
+
<tr
|
|
115
|
+
v-for="(item, index) in items"
|
|
116
|
+
:key="index"
|
|
117
|
+
:class="item.changed === false ? 'text-dimmed' : ''"
|
|
118
|
+
:data-changed="item.changed !== false"
|
|
119
|
+
>
|
|
120
|
+
<td :class="[classes.cell, item.changed === false ? '' : 'text-toned']">
|
|
121
|
+
<span class="inline-flex flex-wrap items-center gap-1.5">
|
|
122
|
+
<DisplayRender :content="item.label" />
|
|
123
|
+
<DisplayChip v-if="item.note" :chip="item.note" :class="classes.note" />
|
|
124
|
+
</span>
|
|
125
|
+
</td>
|
|
126
|
+
<td :class="[classes.cell, item.changed === false ? '' : 'text-muted']">
|
|
127
|
+
<DisplayRender :content="item.before" />
|
|
128
|
+
</td>
|
|
129
|
+
<td
|
|
130
|
+
:class="[
|
|
131
|
+
classes.cell,
|
|
132
|
+
item.changed === false ? '' : 'font-semibold text-highlighted'
|
|
133
|
+
]"
|
|
134
|
+
>
|
|
135
|
+
<DisplayRender :content="item.after" />
|
|
136
|
+
</td>
|
|
137
|
+
</tr>
|
|
138
|
+
</tbody>
|
|
139
|
+
</table>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DisplayDiffProps } from '../../types/index.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<DisplayDiffProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayDiffProps> & 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 { DisplayEmptyProps } from '../../types/index.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<DisplayEmptyProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayEmptyProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import UIcon from "@nuxt/ui/components/Icon.vue";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import { useDisplayAppUi } from "../../composables/use-display-config";
|
|
5
|
+
import { useDisplayIcons } from "../../composables/use-display-icons";
|
|
6
|
+
import { useDisplayLocale } from "../../composables/use-display-locale";
|
|
7
|
+
import { resolveDisplayClasses } from "../../utils/classes";
|
|
8
|
+
import { isDisplayContentEmpty } from "../../utils/content";
|
|
9
|
+
import { displayToneClass } from "../../utils/tone";
|
|
10
|
+
import DisplayActions from "../parts/display-actions.vue";
|
|
11
|
+
import DisplayRender from "../parts/display-render";
|
|
12
|
+
import DisplaySkeleton from "../parts/display-skeleton.vue";
|
|
13
|
+
const {
|
|
14
|
+
variant = "dashed",
|
|
15
|
+
icon = void 0,
|
|
16
|
+
title = void 0,
|
|
17
|
+
description = void 0,
|
|
18
|
+
actions = void 0,
|
|
19
|
+
tone = "neutral",
|
|
20
|
+
loading = false,
|
|
21
|
+
ui = void 0
|
|
22
|
+
} = defineProps({
|
|
23
|
+
variant: { type: String, required: false },
|
|
24
|
+
icon: { type: String, required: false },
|
|
25
|
+
title: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
26
|
+
description: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
27
|
+
actions: { type: Array, required: false },
|
|
28
|
+
tone: { type: String, required: false },
|
|
29
|
+
loading: { type: Boolean, required: false },
|
|
30
|
+
ui: { type: Object, required: false }
|
|
31
|
+
});
|
|
32
|
+
const { t } = useDisplayLocale();
|
|
33
|
+
const icons = useDisplayIcons();
|
|
34
|
+
const appUi = useDisplayAppUi("empty");
|
|
35
|
+
const classes = computed(
|
|
36
|
+
() => resolveDisplayClasses(
|
|
37
|
+
variant === "plain" ? {
|
|
38
|
+
actions: "ms-auto flex gap-1.5",
|
|
39
|
+
description: "text-dimmed",
|
|
40
|
+
icon: "size-4 shrink-0",
|
|
41
|
+
root: "flex items-center gap-2 py-1.5 text-sm text-dimmed",
|
|
42
|
+
title: ""
|
|
43
|
+
} : {
|
|
44
|
+
actions: "mt-3 flex flex-wrap justify-center gap-2",
|
|
45
|
+
description: "max-w-sm text-sm text-muted",
|
|
46
|
+
icon: "mb-2 grid size-10 place-items-center rounded-[var(--nut-display-radius)] bg-[var(--nut-tone-soft)] text-[var(--nut-tone-ink)]",
|
|
47
|
+
root: "flex flex-col items-center gap-1 rounded-[var(--nut-display-radius)] border-[1.5px] border-dashed border-accented px-5 py-6 text-center",
|
|
48
|
+
title: "text-sm font-semibold text-highlighted"
|
|
49
|
+
},
|
|
50
|
+
appUi.value,
|
|
51
|
+
ui
|
|
52
|
+
)
|
|
53
|
+
);
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<template>
|
|
57
|
+
<DisplaySkeleton v-if="loading" layout="block" />
|
|
58
|
+
<div
|
|
59
|
+
v-else
|
|
60
|
+
:class="[classes.root, displayToneClass(tone)]"
|
|
61
|
+
data-display="empty"
|
|
62
|
+
:data-variant="variant"
|
|
63
|
+
>
|
|
64
|
+
<UIcon v-if="variant === 'plain'" :name="icon ?? icons.empty" :class="classes.icon" />
|
|
65
|
+
<span v-else :class="classes.icon"><UIcon :name="icon ?? icons.empty" class="size-5" /></span>
|
|
66
|
+
<div :class="classes.title">
|
|
67
|
+
<DisplayRender :content="title ?? (variant === 'plain' ? void 0 : t('display.empty'))" />
|
|
68
|
+
</div>
|
|
69
|
+
<div v-if="!isDisplayContentEmpty(description)" :class="classes.description">
|
|
70
|
+
<DisplayRender :content="description" />
|
|
71
|
+
</div>
|
|
72
|
+
<DisplayActions v-if="actions?.length" :actions="actions" :class="classes.actions" />
|
|
73
|
+
</div>
|
|
74
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DisplayEmptyProps } from '../../types/index.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<DisplayEmptyProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayEmptyProps> & 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 { DisplayFactsProps } from '../../types/index.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<DisplayFactsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayFactsProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,180 @@
|
|
|
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 { resolveDisplayClasses } from "../../utils/classes";
|
|
7
|
+
import { isDisplayContentEmpty } from "../../utils/content";
|
|
8
|
+
import {
|
|
9
|
+
DISPLAY_SURFACE_CLASSES,
|
|
10
|
+
DISPLAY_SURFACE_PADDING,
|
|
11
|
+
displayToneClass
|
|
12
|
+
} from "../../utils/tone";
|
|
13
|
+
import DisplayActions from "../parts/display-actions.vue";
|
|
14
|
+
import DisplayEmptyLine from "../parts/display-empty-line.vue";
|
|
15
|
+
import DisplayFactValue from "../parts/display-fact-value.vue";
|
|
16
|
+
import DisplayRender from "../parts/display-render";
|
|
17
|
+
import DisplaySkeleton from "../parts/display-skeleton.vue";
|
|
18
|
+
const {
|
|
19
|
+
layout = "ledger",
|
|
20
|
+
surface = void 0,
|
|
21
|
+
items = void 0,
|
|
22
|
+
groups = void 0,
|
|
23
|
+
columns = void 0,
|
|
24
|
+
labelWidth = "8rem",
|
|
25
|
+
empty = void 0,
|
|
26
|
+
actions = void 0,
|
|
27
|
+
loading = false,
|
|
28
|
+
ui = void 0
|
|
29
|
+
} = defineProps({
|
|
30
|
+
layout: { type: String, required: false },
|
|
31
|
+
surface: { type: String, required: false },
|
|
32
|
+
items: { type: Array, required: false },
|
|
33
|
+
groups: { type: Array, required: false },
|
|
34
|
+
columns: { type: Number, required: false },
|
|
35
|
+
labelWidth: { type: String, required: false },
|
|
36
|
+
empty: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
37
|
+
actions: { type: Array, required: false },
|
|
38
|
+
loading: { type: Boolean, required: false },
|
|
39
|
+
ui: { type: Object, required: false }
|
|
40
|
+
});
|
|
41
|
+
const CAPTION = "text-[11px] font-bold tracking-[0.07em] text-muted uppercase";
|
|
42
|
+
const LABEL_CLASSES = {
|
|
43
|
+
columns: "flex min-w-0 items-center gap-1.5 text-muted",
|
|
44
|
+
grid: `flex min-w-0 items-center gap-1.5 ${CAPTION}`,
|
|
45
|
+
inline: "inline-flex items-center gap-1.5 text-muted",
|
|
46
|
+
ledger: "flex min-w-0 items-center gap-1.5 text-muted",
|
|
47
|
+
tiles: `flex min-w-0 items-center gap-1.5 ${CAPTION}`
|
|
48
|
+
};
|
|
49
|
+
const VALUE_CLASSES = {
|
|
50
|
+
columns: "flex min-w-0 flex-wrap items-center gap-1.5 font-medium text-default [overflow-wrap:anywhere]",
|
|
51
|
+
grid: "flex min-h-5 min-w-0 flex-wrap items-center gap-1.5 font-semibold text-highlighted [overflow-wrap:anywhere]",
|
|
52
|
+
inline: "inline-flex items-center gap-1 font-bold text-highlighted tabular-nums",
|
|
53
|
+
ledger: "ms-auto flex min-w-0 flex-wrap items-center justify-end gap-1.5 text-end font-semibold text-highlighted tabular-nums [overflow-wrap:anywhere]",
|
|
54
|
+
tiles: "flex min-w-0 flex-wrap items-center gap-1.5 text-lg font-extrabold text-highlighted tabular-nums"
|
|
55
|
+
};
|
|
56
|
+
const ITEM_CLASSES = {
|
|
57
|
+
columns: "contents",
|
|
58
|
+
grid: "flex min-w-0 flex-col gap-1",
|
|
59
|
+
inline: "inline-flex min-w-0 items-baseline gap-1.5",
|
|
60
|
+
ledger: "flex flex-wrap items-center justify-between gap-x-4 gap-y-1 border-t border-muted py-2.5 first:border-t-0",
|
|
61
|
+
tiles: "flex min-w-0 flex-col gap-1 rounded-[var(--nut-display-radius)] bg-elevated px-3 py-2.5"
|
|
62
|
+
};
|
|
63
|
+
const GROUP_CLASSES = {
|
|
64
|
+
columns: "grid min-w-0 gap-x-4 gap-y-2.5 text-sm",
|
|
65
|
+
grid: "grid min-w-0 gap-x-5 gap-y-4 text-sm",
|
|
66
|
+
inline: "flex min-w-0 flex-wrap gap-x-4.5 gap-y-1.5 text-sm",
|
|
67
|
+
ledger: "",
|
|
68
|
+
tiles: "grid min-w-0 gap-2 text-sm"
|
|
69
|
+
};
|
|
70
|
+
const appUi = useDisplayAppUi("facts");
|
|
71
|
+
const resolvedSurface = computed(() => surface ?? (layout === "ledger" ? "bordered" : "plain"));
|
|
72
|
+
const resolvedGroups = computed(() => groups ?? [{ items: items ?? [] }]);
|
|
73
|
+
const count = computed(
|
|
74
|
+
() => resolvedGroups.value.reduce((total, group) => total + group.items.length, 0)
|
|
75
|
+
);
|
|
76
|
+
const boxed = computed(() => resolvedSurface.value !== "plain");
|
|
77
|
+
const groupStyle = computed(() => {
|
|
78
|
+
if (layout === "columns") return { gridTemplateColumns: `${labelWidth} minmax(0, 1fr)` };
|
|
79
|
+
if (layout !== "grid" && layout !== "tiles") return void 0;
|
|
80
|
+
return {
|
|
81
|
+
gridTemplateColumns: columns ? `repeat(${columns}, minmax(0, 1fr))` : `repeat(auto-fill, minmax(${layout === "grid" ? "9rem" : "8rem"}, 1fr))`
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
const classes = computed(
|
|
85
|
+
() => resolveDisplayClasses(
|
|
86
|
+
{
|
|
87
|
+
actions: "mt-2.5 flex flex-wrap gap-2",
|
|
88
|
+
empty: "",
|
|
89
|
+
group: GROUP_CLASSES[layout],
|
|
90
|
+
groupAside: "text-xs font-medium text-toned normal-case tracking-normal",
|
|
91
|
+
groupHeader: layout === "ledger" ? `flex items-baseline justify-between gap-3 border-t border-default py-1.5 first:border-t-0 ${boxed.value ? "bg-elevated" : ""} ${CAPTION}` : `mb-2 flex items-baseline justify-between gap-3 ${CAPTION}`,
|
|
92
|
+
groupTitle: "",
|
|
93
|
+
hint: layout === "ledger" ? "text-xs text-dimmed" : "text-xs text-muted",
|
|
94
|
+
item: ITEM_CLASSES[layout],
|
|
95
|
+
label: LABEL_CLASSES[layout],
|
|
96
|
+
root: layout === "ledger" ? `flex min-w-0 flex-col overflow-hidden text-sm ${DISPLAY_SURFACE_CLASSES[resolvedSurface.value]} ${boxed.value ? "[&>*]:px-4" : ""}` : `flex min-w-0 flex-col gap-4 ${DISPLAY_SURFACE_CLASSES[resolvedSurface.value]} ${DISPLAY_SURFACE_PADDING[resolvedSurface.value]}`,
|
|
97
|
+
value: VALUE_CLASSES[layout]
|
|
98
|
+
},
|
|
99
|
+
appUi.value,
|
|
100
|
+
ui
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
function valueClass(fact) {
|
|
104
|
+
return twMerge(
|
|
105
|
+
classes.value.value,
|
|
106
|
+
fact.tone ? `${displayToneClass(fact.tone)} text-[var(--nut-tone-ink)]` : "",
|
|
107
|
+
fact.emphasis ? "text-lg font-extrabold" : "",
|
|
108
|
+
fact.mono ? "font-mono text-[13px] font-medium" : ""
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<template>
|
|
114
|
+
<DisplaySkeleton
|
|
115
|
+
v-if="loading"
|
|
116
|
+
:layout="layout === 'ledger' ? 'rows' : layout === 'tiles' ? 'tiles' : 'lines'"
|
|
117
|
+
:count="Math.min(Math.max(count, 2), 5)"
|
|
118
|
+
/>
|
|
119
|
+
<DisplayEmptyLine v-else-if="!count" :content="empty" :class="classes.empty" />
|
|
120
|
+
<div
|
|
121
|
+
v-else-if="layout === 'ledger'"
|
|
122
|
+
:class="classes.root"
|
|
123
|
+
data-display="facts"
|
|
124
|
+
data-layout="ledger"
|
|
125
|
+
>
|
|
126
|
+
<template v-for="(group, groupIndex) in resolvedGroups" :key="groupIndex">
|
|
127
|
+
<div v-if="!isDisplayContentEmpty(group.title)" :class="classes.groupHeader">
|
|
128
|
+
<span :class="classes.groupTitle"><DisplayRender :content="group.title" /></span>
|
|
129
|
+
<span v-if="!isDisplayContentEmpty(group.aside)" :class="classes.groupAside">
|
|
130
|
+
<DisplayRender :content="group.aside" />
|
|
131
|
+
</span>
|
|
132
|
+
</div>
|
|
133
|
+
<div v-for="(fact, index) in group.items" :key="index" :class="classes.item">
|
|
134
|
+
<div class="flex min-w-0 flex-col gap-px">
|
|
135
|
+
<span :class="classes.label">
|
|
136
|
+
<UIcon v-if="fact.icon" :name="fact.icon" class="size-3.5 shrink-0" />
|
|
137
|
+
<DisplayRender :content="fact.label" />
|
|
138
|
+
</span>
|
|
139
|
+
<span v-if="!isDisplayContentEmpty(fact.hint)" :class="classes.hint">
|
|
140
|
+
<DisplayRender :content="fact.hint" />
|
|
141
|
+
</span>
|
|
142
|
+
</div>
|
|
143
|
+
<div :class="valueClass(fact)" data-display-value><DisplayFactValue :fact="fact" /></div>
|
|
144
|
+
</div>
|
|
145
|
+
</template>
|
|
146
|
+
</div>
|
|
147
|
+
<div v-else :class="classes.root" data-display="facts" :data-layout="layout">
|
|
148
|
+
<div v-for="(group, groupIndex) in resolvedGroups" :key="groupIndex">
|
|
149
|
+
<div v-if="!isDisplayContentEmpty(group.title)" :class="classes.groupHeader">
|
|
150
|
+
<span :class="classes.groupTitle"><DisplayRender :content="group.title" /></span>
|
|
151
|
+
<span v-if="!isDisplayContentEmpty(group.aside)" :class="classes.groupAside">
|
|
152
|
+
<DisplayRender :content="group.aside" />
|
|
153
|
+
</span>
|
|
154
|
+
</div>
|
|
155
|
+
<dl :class="['m-0', classes.group]" :style="groupStyle">
|
|
156
|
+
<div v-for="(fact, index) in group.items" :key="index" :class="classes.item">
|
|
157
|
+
<dt :class="classes.label">
|
|
158
|
+
<UIcon v-if="fact.icon" :name="fact.icon" class="size-3.5 shrink-0" />
|
|
159
|
+
<DisplayRender :content="fact.label" />
|
|
160
|
+
</dt>
|
|
161
|
+
<dd :class="['m-0', valueClass(fact)]" data-display-value>
|
|
162
|
+
<DisplayFactValue :fact="fact" />
|
|
163
|
+
</dd>
|
|
164
|
+
<dd
|
|
165
|
+
v-if="layout !== 'inline' && !isDisplayContentEmpty(fact.hint)"
|
|
166
|
+
:class="['m-0', classes.hint, layout === 'columns' ? 'col-start-2 -mt-2' : '']"
|
|
167
|
+
>
|
|
168
|
+
<DisplayRender :content="fact.hint" />
|
|
169
|
+
</dd>
|
|
170
|
+
</div>
|
|
171
|
+
</dl>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
<DisplayActions
|
|
175
|
+
v-if="!loading && actions?.length"
|
|
176
|
+
:actions="actions"
|
|
177
|
+
:class="classes.actions"
|
|
178
|
+
data-display-actions
|
|
179
|
+
/>
|
|
180
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DisplayFactsProps } from '../../types/index.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<DisplayFactsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayFactsProps> & 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 { DisplayHeadingProps } from '../../types/index.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<DisplayHeadingProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayHeadingProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,96 @@
|
|
|
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 { useDisplayAppUi } from "../../composables/use-display-config";
|
|
6
|
+
import { resolveDisplayClasses } from "../../utils/classes";
|
|
7
|
+
import { isDisplayContentEmpty, resolveDisplayText } from "../../utils/content";
|
|
8
|
+
import { displayToneClass } from "../../utils/tone";
|
|
9
|
+
import DisplayRender from "../parts/display-render";
|
|
10
|
+
import DisplaySkeleton from "../parts/display-skeleton.vue";
|
|
11
|
+
const {
|
|
12
|
+
title,
|
|
13
|
+
description = void 0,
|
|
14
|
+
variant = "title",
|
|
15
|
+
size = "md",
|
|
16
|
+
icon = void 0,
|
|
17
|
+
tone = "primary",
|
|
18
|
+
count = void 0,
|
|
19
|
+
action = void 0,
|
|
20
|
+
level = 3,
|
|
21
|
+
loading = false,
|
|
22
|
+
ui = void 0
|
|
23
|
+
} = defineProps({
|
|
24
|
+
title: { type: [String, Number, Function, Object, Boolean, null, Array], required: true, skipCheck: true },
|
|
25
|
+
description: { type: [String, Number, Function, Object, Boolean, null, Array], required: false, skipCheck: true },
|
|
26
|
+
variant: { type: String, required: false },
|
|
27
|
+
size: { type: String, required: false },
|
|
28
|
+
icon: { type: String, required: false },
|
|
29
|
+
tone: { type: String, required: false },
|
|
30
|
+
count: { type: [String, Number, Function], required: false },
|
|
31
|
+
action: { type: Object, required: false },
|
|
32
|
+
level: { type: Number, required: false },
|
|
33
|
+
loading: { type: Boolean, required: false },
|
|
34
|
+
ui: { type: Object, required: false }
|
|
35
|
+
});
|
|
36
|
+
const TITLE_CLASSES = {
|
|
37
|
+
lg: "text-base font-semibold text-highlighted",
|
|
38
|
+
md: "text-[15px] font-semibold text-highlighted",
|
|
39
|
+
sm: "text-sm font-semibold text-highlighted"
|
|
40
|
+
};
|
|
41
|
+
const appUi = useDisplayAppUi("heading");
|
|
42
|
+
const tile = computed(() => size === "lg" && Boolean(icon));
|
|
43
|
+
const classes = computed(
|
|
44
|
+
() => resolveDisplayClasses(
|
|
45
|
+
{
|
|
46
|
+
action: "ms-auto shrink-0",
|
|
47
|
+
count: "rounded-full bg-elevated px-2 py-px text-xs font-semibold text-toned tabular-nums",
|
|
48
|
+
description: "mt-0.5 text-sm text-muted",
|
|
49
|
+
icon: tile.value ? "grid size-10 shrink-0 place-items-center rounded-[var(--nut-display-radius)] bg-[var(--nut-tone-soft)] text-[var(--nut-tone-ink)]" : "size-4.5 shrink-0 text-muted",
|
|
50
|
+
root: variant === "eyebrow" ? "flex items-center gap-3" : tile.value || !isDisplayContentEmpty(description) ? "flex items-start gap-3" : "flex items-center gap-2",
|
|
51
|
+
rule: "h-px flex-1 bg-[var(--ui-border)]",
|
|
52
|
+
text: "flex min-w-0 flex-1 flex-col",
|
|
53
|
+
title: variant === "eyebrow" ? "m-0 text-[11px] font-bold tracking-[0.08em] text-muted uppercase" : `m-0 flex flex-wrap items-center gap-2 ${TITLE_CLASSES[size]}`
|
|
54
|
+
},
|
|
55
|
+
appUi.value,
|
|
56
|
+
ui
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
const actionButton = computed(() => {
|
|
60
|
+
if (!action) return void 0;
|
|
61
|
+
const { label, ...rest } = action;
|
|
62
|
+
return {
|
|
63
|
+
color: "primary",
|
|
64
|
+
size: "sm",
|
|
65
|
+
variant: "link",
|
|
66
|
+
...rest,
|
|
67
|
+
label: resolveDisplayText(label)
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<template>
|
|
73
|
+
<DisplaySkeleton v-if="loading" :count="isDisplayContentEmpty(description) ? 1 : 2" />
|
|
74
|
+
<div v-else-if="variant === 'eyebrow'" :class="classes.root" data-display="heading">
|
|
75
|
+
<component :is="`h${level}`" :class="classes.title">
|
|
76
|
+
<DisplayRender :content="title" />
|
|
77
|
+
</component>
|
|
78
|
+
<span :class="classes.rule" aria-hidden="true" />
|
|
79
|
+
</div>
|
|
80
|
+
<div v-else :class="[classes.root, displayToneClass(tone)]" data-display="heading">
|
|
81
|
+
<span v-if="tile" :class="classes.icon"><UIcon :name="icon ?? ''" class="size-5" /></span>
|
|
82
|
+
<UIcon v-else-if="icon" :name="icon" :class="classes.icon" />
|
|
83
|
+
<div :class="classes.text">
|
|
84
|
+
<component :is="`h${level}`" :class="classes.title">
|
|
85
|
+
<DisplayRender :content="title" />
|
|
86
|
+
<span v-if="count !== void 0" :class="classes.count">{{
|
|
87
|
+
resolveDisplayText(count)
|
|
88
|
+
}}</span>
|
|
89
|
+
</component>
|
|
90
|
+
<div v-if="!isDisplayContentEmpty(description)" :class="classes.description">
|
|
91
|
+
<DisplayRender :content="description" />
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
<UButton v-if="actionButton" v-bind="actionButton" :class="classes.action" />
|
|
95
|
+
</div>
|
|
96
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DisplayHeadingProps } from '../../types/index.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<DisplayHeadingProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayHeadingProps> & 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 { DisplayListProps } from '../../types/index.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<DisplayListProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DisplayListProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|