@ghostvue/mcp 0.1.0 → 0.2.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/assets/bundle.json +2 -2
- package/dist/assets/component-exports.json +1 -0
- package/dist/assets/docs/pages.json +1 -1
- package/dist/assets/examples/catalog.json +1 -1
- package/dist/assets/examples/sources/accordion/billing-faq.vue +123 -0
- package/dist/assets/examples/sources/avatar/team-roster.vue +69 -5
- package/dist/assets/examples/sources/badge/release-channels.vue +1 -1
- package/dist/assets/examples/sources/breadcrumb/basic.vue +60 -15
- package/dist/assets/examples/sources/button/refresh-status.vue +95 -0
- package/dist/assets/examples/sources/calendar/availability.vue +235 -0
- package/dist/assets/examples/sources/calendar/office-locale.vue +197 -0
- package/dist/assets/examples/sources/card/project-summary.vue +38 -3
- package/dist/assets/examples/sources/checkbox-group/basic.vue +56 -0
- package/dist/assets/examples/sources/checkbox-group/field.vue +73 -0
- package/dist/assets/examples/sources/checkbox-group/form.vue +100 -0
- package/dist/assets/examples/sources/checkbox-group/headless.vue +68 -0
- package/dist/assets/examples/sources/checkbox-group/notification-preferences.vue +380 -0
- package/dist/assets/examples/sources/collapsible/shipment-history.vue +135 -0
- package/dist/assets/examples/sources/combobox/review-request-form.vue +415 -0
- package/dist/assets/examples/sources/command-palette/async.vue +60 -12
- package/dist/assets/examples/sources/command-palette/basic.vue +123 -2
- package/dist/assets/examples/sources/command-palette/shortcut.vue +132 -5
- package/dist/assets/examples/sources/command-palette/themed.vue +44 -4
- package/dist/assets/examples/sources/command-palette/virtualized.vue +124 -3
- package/dist/assets/examples/sources/context-menu/themed.vue +81 -26
- package/dist/assets/examples/sources/data-table/themed-invoices.vue +219 -44
- package/dist/assets/examples/sources/date-picker/controlled.vue +8 -293
- package/dist/assets/examples/sources/date-picker/custom-format.vue +6 -295
- package/dist/assets/examples/sources/date-picker/nested-dialog.vue +28 -350
- package/dist/assets/examples/sources/date-picker/rtl.vue +5 -294
- package/dist/assets/examples/sources/date-picker/themed.vue +2 -2
- package/dist/assets/examples/sources/date-picker/validation.vue +8 -294
- package/dist/assets/examples/sources/dropdown-menu/nested-export.vue +56 -0
- package/dist/assets/examples/sources/empty-state/search-results.vue +26 -1
- package/dist/assets/examples/sources/field/billing-address-headless.vue +93 -0
- package/dist/assets/examples/sources/field/billing-address.vue +192 -0
- package/dist/assets/examples/sources/field/checkbox.vue +10 -2
- package/dist/assets/examples/sources/field/themed.vue +12 -11
- package/dist/assets/examples/sources/file-upload/asset-submission.vue +96 -36
- package/dist/assets/examples/sources/form/async-validation.vue +180 -0
- package/dist/assets/examples/sources/form/composable.vue +146 -0
- package/dist/assets/examples/sources/form/nested-webhooks.vue +233 -0
- package/dist/assets/examples/sources/form/profile-schema.vue +376 -0
- package/dist/assets/examples/sources/inline-alert/billing-notices.vue +26 -5
- package/dist/assets/examples/sources/inline-alert/feed-status.vue +229 -0
- package/dist/assets/examples/sources/input/clearable-search-headless.vue +162 -0
- package/dist/assets/examples/sources/input/clearable-search.vue +225 -0
- package/dist/assets/examples/sources/input/unit-suffix.vue +109 -0
- package/dist/assets/examples/sources/interactive-surface/basic.vue +20 -8
- package/dist/assets/examples/sources/interactive-surface/feature-tiles.vue +42 -8
- package/dist/assets/examples/sources/kbd/command-shortcuts.vue +0 -1
- package/dist/assets/examples/sources/link/documentation-footer.vue +11 -4
- package/dist/assets/examples/sources/link/router.vue +9 -5
- package/dist/assets/examples/sources/menubar/themed.vue +46 -10
- package/dist/assets/examples/sources/number-input/order-limits.vue +5 -0
- package/dist/assets/examples/sources/number-input/themed.vue +12 -6
- package/dist/assets/examples/sources/number-input/workshop-booking.vue +207 -0
- package/dist/assets/examples/sources/pagination/controlled.vue +83 -18
- package/dist/assets/examples/sources/pagination/ellipsis.vue +44 -14
- package/dist/assets/examples/sources/pagination/themed.vue +161 -21
- package/dist/assets/examples/sources/presence/basic.vue +81 -0
- package/dist/assets/examples/sources/presence/portal.vue +92 -0
- package/dist/assets/examples/sources/progress/report-export.vue +160 -0
- package/dist/assets/examples/sources/scroll-area/activity-feed.vue +0 -1
- package/dist/assets/examples/sources/scroll-area/horizontal.vue +169 -14
- package/dist/assets/examples/sources/scroll-area/themed.vue +42 -3
- package/dist/assets/examples/sources/scroll-spy/themed.vue +180 -31
- package/dist/assets/examples/sources/select/alert-routing-form.vue +356 -0
- package/dist/assets/examples/sources/select/multiple-form.vue +201 -0
- package/dist/assets/examples/sources/select/multiple-labels.vue +142 -0
- package/dist/assets/examples/sources/skeleton/profile-loading.vue +28 -4
- package/dist/assets/examples/sources/slider/audio-mixer.vue +8 -2
- package/dist/assets/examples/sources/slider/price-filter.vue +162 -0
- package/dist/assets/examples/sources/slider/vertical.vue +3 -2
- package/dist/assets/examples/sources/spinner/sync-status.vue +13 -10
- package/dist/assets/examples/sources/switch/form.vue +43 -11
- package/dist/assets/examples/sources/table/contain-horizontal.vue +24 -12
- package/dist/assets/examples/sources/table/row-headers.vue +118 -19
- package/dist/assets/examples/sources/tabs/review-sections.vue +43 -0
- package/dist/assets/examples/sources/tags-input/headless-field.vue +31 -0
- package/dist/assets/examples/sources/tags-input/project-labels.vue +64 -0
- package/dist/assets/examples/sources/tags-input/read-only.vue +12 -0
- package/dist/assets/examples/sources/toast/themed.vue +42 -19
- package/dist/assets/examples/sources/toolbar/themed.vue +22 -4
- package/dist/assets/examples/sources/tooltip/themed.vue +12 -1
- package/dist/assets/examples/sources/tree/themed.vue +70 -17
- package/dist/assets/manifests/themes/ghost-accordion.manifest.json +1 -0
- package/dist/assets/manifests/themes/ghost-button.manifest.json +1 -0
- package/dist/assets/manifests/themes/ghost-calendar.manifest.json +3 -1
- package/dist/assets/manifests/themes/ghost-checkbox-group.manifest.json +90 -0
- package/dist/assets/manifests/themes/ghost-collapsible.manifest.json +1 -0
- package/dist/assets/manifests/themes/ghost-combobox.manifest.json +1 -0
- package/dist/assets/manifests/themes/ghost-command-palette.manifest.json +2 -1
- package/dist/assets/manifests/themes/ghost-date-picker.manifest.json +5 -0
- package/dist/assets/manifests/themes/ghost-dropdown-menu.manifest.json +9 -0
- package/dist/assets/manifests/themes/ghost-field.manifest.json +10 -2
- package/dist/assets/manifests/themes/ghost-inline-alert.manifest.json +1 -0
- package/dist/assets/manifests/themes/ghost-input.manifest.json +3 -1
- package/dist/assets/manifests/themes/ghost-link.manifest.json +2 -1
- package/dist/assets/manifests/themes/ghost-number-input.manifest.json +1 -0
- package/dist/assets/manifests/themes/ghost-pagination.manifest.json +6 -2
- package/dist/assets/manifests/themes/ghost-progress.manifest.json +1 -0
- package/dist/assets/manifests/themes/ghost-radio-group-item.manifest.json +63 -0
- package/dist/assets/manifests/themes/ghost-scroll-area.manifest.json +12 -2
- package/dist/assets/manifests/themes/ghost-select.manifest.json +3 -0
- package/dist/assets/manifests/themes/ghost-slider.manifest.json +1 -0
- package/dist/assets/manifests/themes/ghost-table.manifest.json +2 -1
- package/dist/assets/manifests/themes/ghost-tags-input.manifest.json +255 -0
- package/dist/assets/manifests/vue/ghost-checkbox-group.manifest.json +173 -0
- package/dist/assets/manifests/vue/ghost-command-palette-content.manifest.json +6 -2
- package/dist/assets/manifests/vue/ghost-command-palette-overlay.manifest.json +6 -2
- package/dist/assets/manifests/vue/ghost-command-palette.manifest.json +0 -1
- package/dist/assets/manifests/vue/ghost-context-menu-content.manifest.json +3 -3
- package/dist/assets/manifests/vue/ghost-context-menu.manifest.json +1 -1
- package/dist/assets/manifests/vue/ghost-data-table-preset.manifest.json +1 -1
- package/dist/assets/manifests/vue/ghost-data-table-table.manifest.json +1 -1
- package/dist/assets/manifests/vue/ghost-data-table.manifest.json +99 -2
- package/dist/assets/manifests/vue/ghost-date-picker-content.manifest.json +12 -3
- package/dist/assets/manifests/vue/ghost-date-picker.manifest.json +1 -6
- package/dist/assets/manifests/vue/ghost-dialog-content.manifest.json +6 -2
- package/dist/assets/manifests/vue/ghost-dialog-overlay.manifest.json +6 -2
- package/dist/assets/manifests/vue/ghost-drawer-content.manifest.json +6 -2
- package/dist/assets/manifests/vue/ghost-drawer-overlay.manifest.json +6 -2
- package/dist/assets/manifests/vue/ghost-field-error.manifest.json +12 -1
- package/dist/assets/manifests/vue/ghost-field.manifest.json +35 -3
- package/dist/assets/manifests/vue/ghost-form.manifest.json +221 -0
- package/dist/assets/manifests/vue/ghost-hover-card-content.manifest.json +12 -3
- package/dist/assets/manifests/vue/ghost-input.manifest.json +2 -1
- package/dist/assets/manifests/vue/ghost-link.manifest.json +1 -2
- package/dist/assets/manifests/vue/ghost-menubar-content.manifest.json +3 -3
- package/dist/assets/manifests/vue/ghost-menubar.manifest.json +4 -4
- package/dist/assets/manifests/vue/ghost-pagination.manifest.json +0 -2
- package/dist/assets/manifests/vue/ghost-popover-content.manifest.json +6 -2
- package/dist/assets/manifests/vue/ghost-presence.manifest.json +96 -0
- package/dist/assets/manifests/vue/ghost-scroll-area.manifest.json +0 -1
- package/dist/assets/manifests/vue/ghost-select-content.manifest.json +6 -1
- package/dist/assets/manifests/vue/ghost-select-group.manifest.json +6 -1
- package/dist/assets/manifests/vue/ghost-select-label.manifest.json +6 -1
- package/dist/assets/manifests/vue/ghost-select-option.manifest.json +6 -1
- package/dist/assets/manifests/vue/ghost-select-trigger.manifest.json +6 -1
- package/dist/assets/manifests/vue/ghost-select-value.manifest.json +18 -2
- package/dist/assets/manifests/vue/ghost-select.manifest.json +18 -6
- package/dist/assets/manifests/vue/ghost-submenu-content.manifest.json +168 -0
- package/dist/assets/manifests/vue/ghost-submenu-trigger.manifest.json +102 -0
- package/dist/assets/manifests/vue/ghost-submenu.manifest.json +59 -0
- package/dist/assets/manifests/vue/ghost-table.manifest.json +0 -2
- package/dist/assets/manifests/vue/ghost-tabs.manifest.json +2 -1
- package/dist/assets/manifests/vue/ghost-tags-input.manifest.json +260 -0
- package/dist/assets/tokens.json +15 -0
- package/dist/components.d.ts +5 -0
- package/dist/components.js +80 -11
- package/package.json +1 -1
|
@@ -1,39 +1,166 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref } from 'vue'
|
|
2
|
+
import { computed, nextTick, ref, shallowRef, useTemplateRef } from 'vue'
|
|
3
3
|
import {
|
|
4
|
+
GhostBadge,
|
|
4
5
|
GhostButton,
|
|
5
6
|
GhostDataTable,
|
|
6
7
|
GhostDataTablePreset,
|
|
8
|
+
GhostInput,
|
|
7
9
|
GhostPagination,
|
|
8
10
|
defineDataTableColumns,
|
|
9
11
|
type DataTableRowId,
|
|
12
|
+
type GhostInputExposed,
|
|
10
13
|
} from '@ghostvue/themes'
|
|
11
14
|
|
|
15
|
+
type InvoiceStatus = 'Paid' | 'Open' | 'Overdue'
|
|
16
|
+
|
|
12
17
|
interface Invoice {
|
|
13
18
|
id: string
|
|
14
19
|
customer: string
|
|
20
|
+
email: string
|
|
21
|
+
/** ISO date, so the column sorts chronologically as text. */
|
|
22
|
+
due: string
|
|
23
|
+
status: InvoiceStatus
|
|
24
|
+
/** US dollars. Format for display; sort and filter on the number. */
|
|
15
25
|
amount: number
|
|
16
26
|
}
|
|
17
27
|
|
|
18
28
|
const helper = defineDataTableColumns<Invoice>()
|
|
19
29
|
const columns = [
|
|
30
|
+
helper.accessorKey('id', { header: 'Invoice' }),
|
|
20
31
|
helper.accessorKey('customer', { header: 'Customer' }),
|
|
32
|
+
helper.accessorKey('due', { header: 'Due' }),
|
|
33
|
+
helper.accessorKey('status', { header: 'Status' }),
|
|
21
34
|
helper.accessorKey('amount', { header: 'Amount' }),
|
|
22
35
|
]
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
|
|
37
|
+
// Rows are replaced, never mutated, so the table sees each update.
|
|
38
|
+
const invoices = shallowRef<readonly Invoice[]>([
|
|
39
|
+
{
|
|
40
|
+
id: 'INV-1048',
|
|
41
|
+
customer: 'Northstar Studio',
|
|
42
|
+
email: 'billing@northstar.example',
|
|
43
|
+
due: '2026-12-18',
|
|
44
|
+
status: 'Open',
|
|
45
|
+
amount: 2480,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 'INV-1047',
|
|
49
|
+
customer: 'Fieldwork Labs',
|
|
50
|
+
email: 'billing@fieldwork.example',
|
|
51
|
+
due: '2026-11-15',
|
|
52
|
+
status: 'Overdue',
|
|
53
|
+
amount: 3725,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: 'INV-1046',
|
|
57
|
+
customer: 'Canopy Digital',
|
|
58
|
+
email: 'accounts@canopy.example',
|
|
59
|
+
due: '2026-12-14',
|
|
60
|
+
status: 'Paid',
|
|
61
|
+
amount: 1560,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: 'INV-1045',
|
|
65
|
+
customer: 'Harbor & Co.',
|
|
66
|
+
email: 'billing@harbor.example',
|
|
67
|
+
due: '2026-11-12',
|
|
68
|
+
status: 'Overdue',
|
|
69
|
+
amount: 980.5,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'INV-1044',
|
|
73
|
+
customer: 'Summit Supply',
|
|
74
|
+
email: 'accounts@summit.example',
|
|
75
|
+
due: '2026-12-10',
|
|
76
|
+
status: 'Paid',
|
|
77
|
+
amount: 2140,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'INV-1043',
|
|
81
|
+
customer: 'Lumen Works',
|
|
82
|
+
email: 'accounts@lumen.example',
|
|
83
|
+
due: '2026-12-08',
|
|
84
|
+
status: 'Open',
|
|
85
|
+
amount: 1260,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: 'INV-1042',
|
|
89
|
+
customer: 'Orbit Analytics',
|
|
90
|
+
email: 'finance@orbit.example',
|
|
91
|
+
due: '2026-12-05',
|
|
92
|
+
status: 'Paid',
|
|
93
|
+
amount: 4200,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: 'INV-1041',
|
|
97
|
+
customer: 'Juniper Health',
|
|
98
|
+
email: 'billing@juniper.example',
|
|
99
|
+
due: '2026-12-02',
|
|
100
|
+
status: 'Open',
|
|
101
|
+
amount: 645.75,
|
|
102
|
+
},
|
|
103
|
+
])
|
|
104
|
+
|
|
105
|
+
const currency = new Intl.NumberFormat('en-US', {
|
|
106
|
+
style: 'currency',
|
|
107
|
+
currency: 'USD',
|
|
108
|
+
})
|
|
109
|
+
// The due dates are calendar days, so format them in UTC to avoid a shift.
|
|
110
|
+
const dueDate = new Intl.DateTimeFormat('en-US', {
|
|
111
|
+
month: 'short',
|
|
112
|
+
day: 'numeric',
|
|
113
|
+
year: 'numeric',
|
|
114
|
+
timeZone: 'UTC',
|
|
115
|
+
})
|
|
31
116
|
|
|
32
117
|
const globalFilter = ref('')
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
118
|
+
// Start with the two overdue invoices on page 1 selected, ready to collect.
|
|
119
|
+
const selectedRowIds = ref<DataTableRowId[]>(['INV-1047', 'INV-1045'])
|
|
120
|
+
const expandedRowIds = ref<DataTableRowId[]>(['INV-1047'])
|
|
121
|
+
const pagination = ref({ pageIndex: 1, pageSize: 4 })
|
|
122
|
+
const saving = ref(false)
|
|
123
|
+
const notice = ref('')
|
|
124
|
+
const searchField = useTemplateRef<GhostInputExposed>('searchField')
|
|
125
|
+
|
|
126
|
+
const payableIds = computed(() => {
|
|
127
|
+
const selected = new Set(selectedRowIds.value)
|
|
128
|
+
return invoices.value
|
|
129
|
+
.filter((invoice) => selected.has(invoice.id) && invoice.status !== 'Paid')
|
|
130
|
+
.map((invoice) => invoice.id)
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
function tone(status: InvoiceStatus) {
|
|
134
|
+
if (status === 'Paid') return 'accent'
|
|
135
|
+
return status === 'Overdue' ? 'danger' : 'neutral'
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async function markPaid(): Promise<void> {
|
|
139
|
+
const ids = new Set<DataTableRowId>(payableIds.value)
|
|
140
|
+
if (!ids.size || saving.value) return
|
|
141
|
+
saving.value = true
|
|
142
|
+
// Stands in for a request to your billing API; `loading` marks the table busy.
|
|
143
|
+
await new Promise((resolve) => setTimeout(resolve, 600))
|
|
144
|
+
invoices.value = invoices.value.map((invoice) =>
|
|
145
|
+
ids.has(invoice.id) ? { ...invoice, status: 'Paid' } : invoice,
|
|
146
|
+
)
|
|
147
|
+
// Rows stay selectable while the save runs, so drop only the ids this save
|
|
148
|
+
// captured and keep anything picked meanwhile. When nothing remains, the
|
|
149
|
+
// preset returns focus to "Select all rows" as the bar closes.
|
|
150
|
+
selectedRowIds.value = selectedRowIds.value.filter((id) => !ids.has(id))
|
|
151
|
+
saving.value = false
|
|
152
|
+
notice.value =
|
|
153
|
+
ids.size === 1
|
|
154
|
+
? '1 invoice marked paid'
|
|
155
|
+
: `${String(ids.size)} invoices marked paid`
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async function clearSearch(): Promise<void> {
|
|
159
|
+
globalFilter.value = ''
|
|
160
|
+
// The button that ran this unmounts with the empty result; keep focus.
|
|
161
|
+
await nextTick()
|
|
162
|
+
searchField.value?.focus()
|
|
163
|
+
}
|
|
37
164
|
</script>
|
|
38
165
|
|
|
39
166
|
<template>
|
|
@@ -45,7 +172,7 @@ const loading = ref(false)
|
|
|
45
172
|
:data="invoices"
|
|
46
173
|
:columns="columns"
|
|
47
174
|
:get-row-id="(row) => row.id"
|
|
48
|
-
:loading="
|
|
175
|
+
:loading="saving"
|
|
49
176
|
enable-row-selection
|
|
50
177
|
enable-row-expansion
|
|
51
178
|
sticky-header
|
|
@@ -55,62 +182,95 @@ const loading = ref(false)
|
|
|
55
182
|
>
|
|
56
183
|
<GhostDataTablePreset
|
|
57
184
|
:columns="columns"
|
|
58
|
-
:layout-slots="['
|
|
185
|
+
:layout-slots="['bulkActions', 'footer']"
|
|
59
186
|
contain-horizontal
|
|
60
187
|
scroll-label="Invoice table"
|
|
61
188
|
empty-title="No matching invoices"
|
|
62
189
|
:empty-heading-level="2"
|
|
63
190
|
search-label="Search invoices"
|
|
64
191
|
>
|
|
65
|
-
<template #
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
192
|
+
<template #search="{ value, setValue, label, disabled }">
|
|
193
|
+
<label>
|
|
194
|
+
<span>{{ label }}</span>
|
|
195
|
+
<GhostInput
|
|
196
|
+
ref="searchField"
|
|
197
|
+
type="search"
|
|
198
|
+
size="sm"
|
|
199
|
+
placeholder="Customer or invoice"
|
|
200
|
+
:model-value="value"
|
|
201
|
+
:disabled="disabled"
|
|
202
|
+
@update:model-value="setValue"
|
|
203
|
+
/>
|
|
204
|
+
</label>
|
|
74
205
|
</template>
|
|
75
|
-
<template #
|
|
206
|
+
<template #bulkActions="{ selectedCount, clearSelection }">
|
|
207
|
+
<span>{{ selectedCount }} selected</span>
|
|
76
208
|
<GhostButton
|
|
77
209
|
size="sm"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
@click="loading = !loading"
|
|
210
|
+
:loading="saving"
|
|
211
|
+
:disabled="!payableIds.length"
|
|
212
|
+
@click="markPaid"
|
|
82
213
|
>
|
|
83
|
-
|
|
214
|
+
Mark paid
|
|
84
215
|
</GhostButton>
|
|
85
|
-
</template>
|
|
86
|
-
<template #bulkActions="{ selectedCount, clearSelection }">
|
|
87
|
-
<span>{{ selectedCount }} selected</span>
|
|
88
216
|
<GhostButton
|
|
89
217
|
size="sm"
|
|
90
218
|
tone="neutral"
|
|
91
|
-
variant="
|
|
219
|
+
variant="ghost"
|
|
92
220
|
@click="clearSelection"
|
|
93
221
|
>
|
|
94
222
|
Clear selection
|
|
95
223
|
</GhostButton>
|
|
96
224
|
</template>
|
|
97
|
-
<template #
|
|
225
|
+
<template #due="{ value }">
|
|
226
|
+
<time :datetime="value">{{ dueDate.format(new Date(value)) }}</time>
|
|
227
|
+
</template>
|
|
228
|
+
<template #status="{ value }">
|
|
229
|
+
<GhostBadge :tone="tone(value)" variant="soft" size="sm">
|
|
230
|
+
{{ value }}
|
|
231
|
+
</GhostBadge>
|
|
232
|
+
</template>
|
|
233
|
+
<template #amount="{ value }">
|
|
234
|
+
<span class="invoice-amount">{{ currency.format(value) }}</span>
|
|
235
|
+
</template>
|
|
98
236
|
<template #detail="{ row, rowId }">
|
|
99
|
-
|
|
237
|
+
<div class="invoice-detail">
|
|
238
|
+
<span>
|
|
239
|
+
{{ row.id }} for {{ row.customer }} is due
|
|
240
|
+
{{ dueDate.format(new Date(row.due)) }}. Billing contact:
|
|
241
|
+
{{ row.email }}.
|
|
242
|
+
</span>
|
|
243
|
+
<GhostButton
|
|
244
|
+
size="sm"
|
|
245
|
+
variant="outline"
|
|
246
|
+
tone="neutral"
|
|
247
|
+
@click="
|
|
248
|
+
expandedRowIds = expandedRowIds.filter((id) => id !== rowId)
|
|
249
|
+
"
|
|
250
|
+
>
|
|
251
|
+
Hide details
|
|
252
|
+
</GhostButton>
|
|
253
|
+
</div>
|
|
254
|
+
</template>
|
|
255
|
+
<template
|
|
256
|
+
#footer="{ pagination: page, pageCount, rowCount, setPageIndex }"
|
|
257
|
+
>
|
|
258
|
+
<!-- One polite region reports search results and saved actions. -->
|
|
259
|
+
<span role="status">
|
|
260
|
+
{{ rowCount }} {{ rowCount === 1 ? 'invoice' : 'invoices' }}
|
|
261
|
+
<template v-if="notice">· {{ notice }}</template>
|
|
262
|
+
</span>
|
|
100
263
|
<GhostButton
|
|
264
|
+
v-if="rowCount === 0"
|
|
101
265
|
size="sm"
|
|
102
|
-
variant="outline"
|
|
103
266
|
tone="neutral"
|
|
104
|
-
|
|
267
|
+
variant="outline"
|
|
268
|
+
@click="clearSearch"
|
|
105
269
|
>
|
|
106
|
-
|
|
270
|
+
Clear search
|
|
107
271
|
</GhostButton>
|
|
108
|
-
</template>
|
|
109
|
-
<template
|
|
110
|
-
#footer="{ pagination: page, pageCount, rowCount, setPageIndex }"
|
|
111
|
-
>
|
|
112
|
-
<span>{{ rowCount }} invoices</span>
|
|
113
272
|
<GhostPagination
|
|
273
|
+
v-else
|
|
114
274
|
size="sm"
|
|
115
275
|
:model-value="page.pageIndex"
|
|
116
276
|
:page-count="pageCount"
|
|
@@ -121,3 +281,18 @@ const loading = ref(false)
|
|
|
121
281
|
</GhostDataTablePreset>
|
|
122
282
|
</GhostDataTable>
|
|
123
283
|
</template>
|
|
284
|
+
|
|
285
|
+
<style scoped>
|
|
286
|
+
/* Tabular figures keep the decimal places aligned down the column. */
|
|
287
|
+
.invoice-amount {
|
|
288
|
+
font-variant-numeric: tabular-nums;
|
|
289
|
+
white-space: nowrap;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.invoice-detail {
|
|
293
|
+
display: flex;
|
|
294
|
+
flex-wrap: wrap;
|
|
295
|
+
align-items: center;
|
|
296
|
+
gap: var(--ghost-space-gap-sm);
|
|
297
|
+
}
|
|
298
|
+
</style>
|
|
@@ -3,12 +3,13 @@ import { shallowRef } from 'vue'
|
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
CalendarDate,
|
|
6
|
+
GhostButton,
|
|
6
7
|
GhostDatePicker,
|
|
7
8
|
GhostDatePickerContent,
|
|
8
9
|
GhostDatePickerInput,
|
|
9
10
|
GhostDatePickerTrigger,
|
|
10
11
|
type GhostDatePickerValue,
|
|
11
|
-
} from '@ghostvue/
|
|
12
|
+
} from '@ghostvue/themes'
|
|
12
13
|
|
|
13
14
|
const launch = shallowRef<GhostDatePickerValue>(new CalendarDate(2026, 12, 1))
|
|
14
15
|
const open = shallowRef(false)
|
|
@@ -16,7 +17,7 @@ const today = new CalendarDate(2026, 11, 17)
|
|
|
16
17
|
</script>
|
|
17
18
|
|
|
18
19
|
<template>
|
|
19
|
-
<div class="date-picker-controlled">
|
|
20
|
+
<div class="ghost-theme date-picker-controlled">
|
|
20
21
|
<label for="date-picker-controlled-launch">Launch date</label>
|
|
21
22
|
<GhostDatePicker
|
|
22
23
|
v-slot="{ clear, pending }"
|
|
@@ -25,16 +26,11 @@ const today = new CalendarDate(2026, 11, 17)
|
|
|
25
26
|
:today="today"
|
|
26
27
|
>
|
|
27
28
|
<span class="date-picker-controlled__row">
|
|
28
|
-
<GhostDatePickerInput
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/>
|
|
32
|
-
<GhostDatePickerTrigger class="date-picker-demo__button" />
|
|
33
|
-
<button type="button" class="date-picker-demo__button" @click="clear">
|
|
34
|
-
Clear
|
|
35
|
-
</button>
|
|
29
|
+
<GhostDatePickerInput id="date-picker-controlled-launch" />
|
|
30
|
+
<GhostDatePickerTrigger />
|
|
31
|
+
<GhostButton type="button" @click="clear">Clear</GhostButton>
|
|
36
32
|
</span>
|
|
37
|
-
<GhostDatePickerContent
|
|
33
|
+
<GhostDatePickerContent />
|
|
38
34
|
<p>
|
|
39
35
|
Calendar {{ open ? 'open' : 'closed'
|
|
40
36
|
}}{{ pending ? ', unsaved text' : '' }}
|
|
@@ -55,6 +51,7 @@ const today = new CalendarDate(2026, 11, 17)
|
|
|
55
51
|
|
|
56
52
|
.date-picker-controlled__row {
|
|
57
53
|
display: inline-flex;
|
|
54
|
+
flex-wrap: wrap;
|
|
58
55
|
gap: 0.25rem;
|
|
59
56
|
}
|
|
60
57
|
|
|
@@ -62,285 +59,3 @@ const today = new CalendarDate(2026, 11, 17)
|
|
|
62
59
|
margin: 0;
|
|
63
60
|
}
|
|
64
61
|
</style>
|
|
65
|
-
|
|
66
|
-
<style>
|
|
67
|
-
/*
|
|
68
|
-
* Headless GhostDatePicker ships behavior and positioning only, so this
|
|
69
|
-
* sample brings its own consumer CSS. It is unscoped on purpose: the calendar
|
|
70
|
-
* surface renders in a body portal, outside this component's scoped
|
|
71
|
-
* attribute, and the `date-picker-demo` prefix keeps the classes from
|
|
72
|
-
* colliding with page styles. Every headless date picker example carries
|
|
73
|
-
* this same block (a test keeps them identical), so copy it once per app.
|
|
74
|
-
*
|
|
75
|
-
* Colors read GhostVue semantic tokens when a theme is loaded and fall back
|
|
76
|
-
* to CSS system colors, which follow light and dark on their own. The month
|
|
77
|
-
* grid mirrors the themed calendar recipe: one 7-column template shared by
|
|
78
|
-
* the weekday header and every week, and distinct today, selected, range,
|
|
79
|
-
* outside-month and unavailable states that only change color, border or
|
|
80
|
-
* decoration, so the grid never shifts. Nothing animates, so reduced motion
|
|
81
|
-
* needs no override.
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
.date-picker-demo__input {
|
|
85
|
-
background-color: var(--ghost-surface-bg, Field);
|
|
86
|
-
border: 1px solid var(--ghost-border-strong, FieldText);
|
|
87
|
-
border-radius: var(--ghost-radius-md, 0.375rem);
|
|
88
|
-
box-sizing: border-box;
|
|
89
|
-
color: var(--ghost-text-default, FieldText);
|
|
90
|
-
font: inherit;
|
|
91
|
-
font-variant-numeric: tabular-nums;
|
|
92
|
-
/* Room for "YYYY-MM-DD" plus padding and borders. */
|
|
93
|
-
inline-size: calc(11ch + 1.5rem + 2px);
|
|
94
|
-
max-inline-size: 100%;
|
|
95
|
-
min-block-size: 2.5rem;
|
|
96
|
-
padding: 0.375rem 0.75rem;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.date-picker-demo__input[data-state='invalid'] {
|
|
100
|
-
border-color: var(--ghost-border-danger, CanvasText);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.date-picker-demo__input:disabled {
|
|
104
|
-
color: var(--ghost-text-muted, GrayText);
|
|
105
|
-
cursor: not-allowed;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/* The calendar trigger and the sample's own buttons share one look. */
|
|
109
|
-
.date-picker-demo__button {
|
|
110
|
-
align-items: center;
|
|
111
|
-
background-color: var(--ghost-elevation-1-bg, ButtonFace);
|
|
112
|
-
border: 1px solid var(--ghost-border-strong, ButtonBorder);
|
|
113
|
-
border-radius: var(--ghost-radius-md, 0.375rem);
|
|
114
|
-
box-sizing: border-box;
|
|
115
|
-
color: var(--ghost-surface-fg, ButtonText);
|
|
116
|
-
cursor: pointer;
|
|
117
|
-
display: inline-flex;
|
|
118
|
-
font: inherit;
|
|
119
|
-
gap: 0.375rem;
|
|
120
|
-
justify-content: center;
|
|
121
|
-
min-block-size: 2.5rem;
|
|
122
|
-
min-inline-size: 2.5rem;
|
|
123
|
-
padding: 0.375rem 0.75rem;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.date-picker-demo__button[data-part='trigger'] {
|
|
127
|
-
padding: 0.375rem;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.date-picker-demo__button:hover:not(:disabled),
|
|
131
|
-
.date-picker-demo__popup
|
|
132
|
-
:is([data-part='close'], [data-part='prev'], [data-part='next']):hover:not(
|
|
133
|
-
:disabled
|
|
134
|
-
) {
|
|
135
|
-
background-color: var(--ghost-surface-muted-bg, Canvas);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.date-picker-demo__input:focus-visible,
|
|
139
|
-
.date-picker-demo__button:focus-visible,
|
|
140
|
-
.date-picker-demo__popup button:focus-visible {
|
|
141
|
-
outline: 2px solid var(--ghost-focus-ring-color, Highlight);
|
|
142
|
-
outline-offset: 2px;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/*
|
|
146
|
-
* An opaque, layered surface above page content. Inline position, left and
|
|
147
|
-
* top come from the picker's floating layer, which anchors the surface to
|
|
148
|
-
* the input; this rule only paints it and caps its width on small screens.
|
|
149
|
-
*/
|
|
150
|
-
.date-picker-demo__popup {
|
|
151
|
-
background-color: var(--ghost-elevation-3-bg, Canvas);
|
|
152
|
-
border: 1px solid var(--ghost-elevation-3-border, GrayText);
|
|
153
|
-
border-radius: var(--ghost-radius-lg, 0.5rem);
|
|
154
|
-
box-shadow: var(--ghost-elevation-3-shadow, 0 0.5rem 1.5rem rgb(0 0 0 / 20%));
|
|
155
|
-
box-sizing: border-box;
|
|
156
|
-
color: var(--ghost-surface-fg, CanvasText);
|
|
157
|
-
display: grid;
|
|
158
|
-
gap: 0.5rem;
|
|
159
|
-
inline-size: max-content;
|
|
160
|
-
max-inline-size: calc(100vw - 1rem);
|
|
161
|
-
overflow: auto;
|
|
162
|
-
padding: 0.75rem;
|
|
163
|
-
z-index: 50;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.date-picker-demo__popup
|
|
167
|
-
:is([data-part='close'], [data-part='prev'], [data-part='next']) {
|
|
168
|
-
background: transparent;
|
|
169
|
-
border: 1px solid transparent;
|
|
170
|
-
border-radius: var(--ghost-radius-md, 0.375rem);
|
|
171
|
-
color: inherit;
|
|
172
|
-
cursor: pointer;
|
|
173
|
-
font: inherit;
|
|
174
|
-
min-block-size: 2.25rem;
|
|
175
|
-
min-inline-size: 2.25rem;
|
|
176
|
-
padding: 0 0.5rem;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.date-picker-demo__popup [data-part='close'] {
|
|
180
|
-
font-size: 1.25rem;
|
|
181
|
-
justify-self: end;
|
|
182
|
-
line-height: 1;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.date-picker-demo__popup :is([data-part='prev'], [data-part='next']):disabled {
|
|
186
|
-
color: var(--ghost-text-subtle, GrayText);
|
|
187
|
-
cursor: not-allowed;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.date-picker-demo__popup [data-part='header'] {
|
|
191
|
-
align-items: center;
|
|
192
|
-
display: flex;
|
|
193
|
-
gap: 0.25rem;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.date-picker-demo__popup [data-part='heading'] {
|
|
197
|
-
flex: 1;
|
|
198
|
-
font-size: 1rem;
|
|
199
|
-
font-weight: 600;
|
|
200
|
-
margin: 0;
|
|
201
|
-
text-align: center;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/* Weekday header and weeks share one 7-column template, so columns align. */
|
|
205
|
-
.date-picker-demo__popup [data-part='grid'] {
|
|
206
|
-
display: grid;
|
|
207
|
-
gap: 0.125rem;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.date-picker-demo__popup [data-part='grid'] > [role='row'] {
|
|
211
|
-
display: grid;
|
|
212
|
-
gap: 0.125rem;
|
|
213
|
-
grid-template-columns: repeat(7, 2.5rem);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.date-picker-demo__popup [role='columnheader'] {
|
|
217
|
-
color: var(--ghost-text-muted, GrayText);
|
|
218
|
-
font-size: 0.75rem;
|
|
219
|
-
font-weight: 500;
|
|
220
|
-
padding-block: 0.25rem;
|
|
221
|
-
text-align: center;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
.date-picker-demo__popup [data-part='cell'] {
|
|
225
|
-
aspect-ratio: 1;
|
|
226
|
-
background: transparent;
|
|
227
|
-
border: 1px solid transparent;
|
|
228
|
-
border-radius: var(--ghost-radius-md, 0.375rem);
|
|
229
|
-
color: inherit;
|
|
230
|
-
cursor: pointer;
|
|
231
|
-
font: inherit;
|
|
232
|
-
font-variant-numeric: tabular-nums;
|
|
233
|
-
/* A transparent outline turns into a visible ring under forced colors. */
|
|
234
|
-
outline: 2px solid transparent;
|
|
235
|
-
outline-offset: -2px;
|
|
236
|
-
padding: 0;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/* Zero-specificity hover, so the state fills below always win. */
|
|
240
|
-
.date-picker-demo__popup
|
|
241
|
-
[data-part='cell']:where(:hover:not(:disabled, [aria-disabled])) {
|
|
242
|
-
background-color: var(--ghost-surface-muted-bg, Canvas);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/* Adjacent-month days fill the first and last weeks but are not selectable. */
|
|
246
|
-
.date-picker-demo__popup [data-part='cell'][data-outside-month] {
|
|
247
|
-
color: var(--ghost-text-subtle, GrayText);
|
|
248
|
-
cursor: default;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.date-picker-demo__popup [data-part='cell'][data-today] {
|
|
252
|
-
border-color: var(--ghost-border-primary, CanvasText);
|
|
253
|
-
color: var(--ghost-text-primary, CanvasText);
|
|
254
|
-
font-weight: 600;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/* Unavailable days are struck through: distinct from adjacent-month days. */
|
|
258
|
-
.date-picker-demo__popup
|
|
259
|
-
[data-part='cell']:is(:disabled, [aria-disabled='true']):not(
|
|
260
|
-
[data-outside-month]
|
|
261
|
-
) {
|
|
262
|
-
color: var(--ghost-text-subtle, GrayText);
|
|
263
|
-
cursor: not-allowed;
|
|
264
|
-
text-decoration: line-through;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
.date-picker-demo__popup [data-part='cell'][data-state='range-middle'] {
|
|
268
|
-
background-color: var(--ghost-surface-muted-bg, Canvas);
|
|
269
|
-
color: var(--ghost-surface-fg, CanvasText);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
.date-picker-demo__popup
|
|
273
|
-
[data-part='cell']:is(
|
|
274
|
-
[data-state='selected'],
|
|
275
|
-
[data-state='range-start'],
|
|
276
|
-
[data-state='range-end']
|
|
277
|
-
) {
|
|
278
|
-
background-color: var(--ghost-action-primary-bg, Highlight);
|
|
279
|
-
border-color: var(--ghost-action-primary-border, Highlight);
|
|
280
|
-
color: var(--ghost-action-primary-fg, HighlightText);
|
|
281
|
-
font-weight: 600;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
.date-picker-demo__popup [data-part='cell']:focus-visible {
|
|
285
|
-
outline-color: var(--ghost-focus-ring-color, Highlight);
|
|
286
|
-
outline-offset: 2px;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
.date-picker-demo__popup [data-part='error-summary'] {
|
|
290
|
-
color: var(--ghost-status-danger-fg, CanvasText);
|
|
291
|
-
font-size: 0.875rem;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
.date-picker-demo__popup
|
|
295
|
-
:is([data-part='error-summary'] p, [data-part='status']) {
|
|
296
|
-
margin: 0;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
.date-picker-demo__popup [data-part='status'] {
|
|
300
|
-
color: var(--ghost-text-muted, GrayText);
|
|
301
|
-
font-size: 0.875rem;
|
|
302
|
-
max-inline-size: calc(7 * 2.5rem + 6 * 0.125rem);
|
|
303
|
-
min-block-size: 1lh;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/*
|
|
307
|
-
* Forced colors: only today keeps a CanvasText border; inactive days use
|
|
308
|
-
* GrayText. Selected days and range ends become Highlight cells (opted out
|
|
309
|
-
* so HighlightText stays on Highlight); range middles keep a Highlight
|
|
310
|
-
* border so the span still reads.
|
|
311
|
-
*/
|
|
312
|
-
@media (forced-colors: active) {
|
|
313
|
-
.date-picker-demo__popup {
|
|
314
|
-
border-color: CanvasText;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
.date-picker-demo__popup [data-part='cell'] {
|
|
318
|
-
border-color: Canvas;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
.date-picker-demo__popup [data-part='cell'][data-today] {
|
|
322
|
-
border-color: CanvasText;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
.date-picker-demo__popup
|
|
326
|
-
[data-part='cell']:is(:disabled, [aria-disabled='true']) {
|
|
327
|
-
color: GrayText;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
.date-picker-demo__popup [data-part='cell'][data-state='range-middle'] {
|
|
331
|
-
border-color: Highlight;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
.date-picker-demo__popup
|
|
335
|
-
[data-part='cell']:is(
|
|
336
|
-
[data-state='selected'],
|
|
337
|
-
[data-state='range-start'],
|
|
338
|
-
[data-state='range-end']
|
|
339
|
-
) {
|
|
340
|
-
background-color: Highlight;
|
|
341
|
-
border-color: Highlight;
|
|
342
|
-
color: HighlightText;
|
|
343
|
-
forced-color-adjust: none;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
</style>
|