@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.
Files changed (152) hide show
  1. package/dist/assets/bundle.json +2 -2
  2. package/dist/assets/component-exports.json +1 -0
  3. package/dist/assets/docs/pages.json +1 -1
  4. package/dist/assets/examples/catalog.json +1 -1
  5. package/dist/assets/examples/sources/accordion/billing-faq.vue +123 -0
  6. package/dist/assets/examples/sources/avatar/team-roster.vue +69 -5
  7. package/dist/assets/examples/sources/badge/release-channels.vue +1 -1
  8. package/dist/assets/examples/sources/breadcrumb/basic.vue +60 -15
  9. package/dist/assets/examples/sources/button/refresh-status.vue +95 -0
  10. package/dist/assets/examples/sources/calendar/availability.vue +235 -0
  11. package/dist/assets/examples/sources/calendar/office-locale.vue +197 -0
  12. package/dist/assets/examples/sources/card/project-summary.vue +38 -3
  13. package/dist/assets/examples/sources/checkbox-group/basic.vue +56 -0
  14. package/dist/assets/examples/sources/checkbox-group/field.vue +73 -0
  15. package/dist/assets/examples/sources/checkbox-group/form.vue +100 -0
  16. package/dist/assets/examples/sources/checkbox-group/headless.vue +68 -0
  17. package/dist/assets/examples/sources/checkbox-group/notification-preferences.vue +380 -0
  18. package/dist/assets/examples/sources/collapsible/shipment-history.vue +135 -0
  19. package/dist/assets/examples/sources/combobox/review-request-form.vue +415 -0
  20. package/dist/assets/examples/sources/command-palette/async.vue +60 -12
  21. package/dist/assets/examples/sources/command-palette/basic.vue +123 -2
  22. package/dist/assets/examples/sources/command-palette/shortcut.vue +132 -5
  23. package/dist/assets/examples/sources/command-palette/themed.vue +44 -4
  24. package/dist/assets/examples/sources/command-palette/virtualized.vue +124 -3
  25. package/dist/assets/examples/sources/context-menu/themed.vue +81 -26
  26. package/dist/assets/examples/sources/data-table/themed-invoices.vue +219 -44
  27. package/dist/assets/examples/sources/date-picker/controlled.vue +8 -293
  28. package/dist/assets/examples/sources/date-picker/custom-format.vue +6 -295
  29. package/dist/assets/examples/sources/date-picker/nested-dialog.vue +28 -350
  30. package/dist/assets/examples/sources/date-picker/rtl.vue +5 -294
  31. package/dist/assets/examples/sources/date-picker/themed.vue +2 -2
  32. package/dist/assets/examples/sources/date-picker/validation.vue +8 -294
  33. package/dist/assets/examples/sources/dropdown-menu/nested-export.vue +56 -0
  34. package/dist/assets/examples/sources/empty-state/search-results.vue +26 -1
  35. package/dist/assets/examples/sources/field/billing-address-headless.vue +93 -0
  36. package/dist/assets/examples/sources/field/billing-address.vue +192 -0
  37. package/dist/assets/examples/sources/field/checkbox.vue +10 -2
  38. package/dist/assets/examples/sources/field/themed.vue +12 -11
  39. package/dist/assets/examples/sources/file-upload/asset-submission.vue +96 -36
  40. package/dist/assets/examples/sources/form/async-validation.vue +180 -0
  41. package/dist/assets/examples/sources/form/composable.vue +146 -0
  42. package/dist/assets/examples/sources/form/nested-webhooks.vue +233 -0
  43. package/dist/assets/examples/sources/form/profile-schema.vue +376 -0
  44. package/dist/assets/examples/sources/inline-alert/billing-notices.vue +26 -5
  45. package/dist/assets/examples/sources/inline-alert/feed-status.vue +229 -0
  46. package/dist/assets/examples/sources/input/clearable-search-headless.vue +162 -0
  47. package/dist/assets/examples/sources/input/clearable-search.vue +225 -0
  48. package/dist/assets/examples/sources/input/unit-suffix.vue +109 -0
  49. package/dist/assets/examples/sources/interactive-surface/basic.vue +20 -8
  50. package/dist/assets/examples/sources/interactive-surface/feature-tiles.vue +42 -8
  51. package/dist/assets/examples/sources/kbd/command-shortcuts.vue +0 -1
  52. package/dist/assets/examples/sources/link/documentation-footer.vue +11 -4
  53. package/dist/assets/examples/sources/link/router.vue +9 -5
  54. package/dist/assets/examples/sources/menubar/themed.vue +46 -10
  55. package/dist/assets/examples/sources/number-input/order-limits.vue +5 -0
  56. package/dist/assets/examples/sources/number-input/themed.vue +12 -6
  57. package/dist/assets/examples/sources/number-input/workshop-booking.vue +207 -0
  58. package/dist/assets/examples/sources/pagination/controlled.vue +83 -18
  59. package/dist/assets/examples/sources/pagination/ellipsis.vue +44 -14
  60. package/dist/assets/examples/sources/pagination/themed.vue +161 -21
  61. package/dist/assets/examples/sources/presence/basic.vue +81 -0
  62. package/dist/assets/examples/sources/presence/portal.vue +92 -0
  63. package/dist/assets/examples/sources/progress/report-export.vue +160 -0
  64. package/dist/assets/examples/sources/scroll-area/activity-feed.vue +0 -1
  65. package/dist/assets/examples/sources/scroll-area/horizontal.vue +169 -14
  66. package/dist/assets/examples/sources/scroll-area/themed.vue +42 -3
  67. package/dist/assets/examples/sources/scroll-spy/themed.vue +180 -31
  68. package/dist/assets/examples/sources/select/alert-routing-form.vue +356 -0
  69. package/dist/assets/examples/sources/select/multiple-form.vue +201 -0
  70. package/dist/assets/examples/sources/select/multiple-labels.vue +142 -0
  71. package/dist/assets/examples/sources/skeleton/profile-loading.vue +28 -4
  72. package/dist/assets/examples/sources/slider/audio-mixer.vue +8 -2
  73. package/dist/assets/examples/sources/slider/price-filter.vue +162 -0
  74. package/dist/assets/examples/sources/slider/vertical.vue +3 -2
  75. package/dist/assets/examples/sources/spinner/sync-status.vue +13 -10
  76. package/dist/assets/examples/sources/switch/form.vue +43 -11
  77. package/dist/assets/examples/sources/table/contain-horizontal.vue +24 -12
  78. package/dist/assets/examples/sources/table/row-headers.vue +118 -19
  79. package/dist/assets/examples/sources/tabs/review-sections.vue +43 -0
  80. package/dist/assets/examples/sources/tags-input/headless-field.vue +31 -0
  81. package/dist/assets/examples/sources/tags-input/project-labels.vue +64 -0
  82. package/dist/assets/examples/sources/tags-input/read-only.vue +12 -0
  83. package/dist/assets/examples/sources/toast/themed.vue +42 -19
  84. package/dist/assets/examples/sources/toolbar/themed.vue +22 -4
  85. package/dist/assets/examples/sources/tooltip/themed.vue +12 -1
  86. package/dist/assets/examples/sources/tree/themed.vue +70 -17
  87. package/dist/assets/manifests/themes/ghost-accordion.manifest.json +1 -0
  88. package/dist/assets/manifests/themes/ghost-button.manifest.json +1 -0
  89. package/dist/assets/manifests/themes/ghost-calendar.manifest.json +3 -1
  90. package/dist/assets/manifests/themes/ghost-checkbox-group.manifest.json +90 -0
  91. package/dist/assets/manifests/themes/ghost-collapsible.manifest.json +1 -0
  92. package/dist/assets/manifests/themes/ghost-combobox.manifest.json +1 -0
  93. package/dist/assets/manifests/themes/ghost-command-palette.manifest.json +2 -1
  94. package/dist/assets/manifests/themes/ghost-date-picker.manifest.json +5 -0
  95. package/dist/assets/manifests/themes/ghost-dropdown-menu.manifest.json +9 -0
  96. package/dist/assets/manifests/themes/ghost-field.manifest.json +10 -2
  97. package/dist/assets/manifests/themes/ghost-inline-alert.manifest.json +1 -0
  98. package/dist/assets/manifests/themes/ghost-input.manifest.json +3 -1
  99. package/dist/assets/manifests/themes/ghost-link.manifest.json +2 -1
  100. package/dist/assets/manifests/themes/ghost-number-input.manifest.json +1 -0
  101. package/dist/assets/manifests/themes/ghost-pagination.manifest.json +6 -2
  102. package/dist/assets/manifests/themes/ghost-progress.manifest.json +1 -0
  103. package/dist/assets/manifests/themes/ghost-radio-group-item.manifest.json +63 -0
  104. package/dist/assets/manifests/themes/ghost-scroll-area.manifest.json +12 -2
  105. package/dist/assets/manifests/themes/ghost-select.manifest.json +3 -0
  106. package/dist/assets/manifests/themes/ghost-slider.manifest.json +1 -0
  107. package/dist/assets/manifests/themes/ghost-table.manifest.json +2 -1
  108. package/dist/assets/manifests/themes/ghost-tags-input.manifest.json +255 -0
  109. package/dist/assets/manifests/vue/ghost-checkbox-group.manifest.json +173 -0
  110. package/dist/assets/manifests/vue/ghost-command-palette-content.manifest.json +6 -2
  111. package/dist/assets/manifests/vue/ghost-command-palette-overlay.manifest.json +6 -2
  112. package/dist/assets/manifests/vue/ghost-command-palette.manifest.json +0 -1
  113. package/dist/assets/manifests/vue/ghost-context-menu-content.manifest.json +3 -3
  114. package/dist/assets/manifests/vue/ghost-context-menu.manifest.json +1 -1
  115. package/dist/assets/manifests/vue/ghost-data-table-preset.manifest.json +1 -1
  116. package/dist/assets/manifests/vue/ghost-data-table-table.manifest.json +1 -1
  117. package/dist/assets/manifests/vue/ghost-data-table.manifest.json +99 -2
  118. package/dist/assets/manifests/vue/ghost-date-picker-content.manifest.json +12 -3
  119. package/dist/assets/manifests/vue/ghost-date-picker.manifest.json +1 -6
  120. package/dist/assets/manifests/vue/ghost-dialog-content.manifest.json +6 -2
  121. package/dist/assets/manifests/vue/ghost-dialog-overlay.manifest.json +6 -2
  122. package/dist/assets/manifests/vue/ghost-drawer-content.manifest.json +6 -2
  123. package/dist/assets/manifests/vue/ghost-drawer-overlay.manifest.json +6 -2
  124. package/dist/assets/manifests/vue/ghost-field-error.manifest.json +12 -1
  125. package/dist/assets/manifests/vue/ghost-field.manifest.json +35 -3
  126. package/dist/assets/manifests/vue/ghost-form.manifest.json +221 -0
  127. package/dist/assets/manifests/vue/ghost-hover-card-content.manifest.json +12 -3
  128. package/dist/assets/manifests/vue/ghost-input.manifest.json +2 -1
  129. package/dist/assets/manifests/vue/ghost-link.manifest.json +1 -2
  130. package/dist/assets/manifests/vue/ghost-menubar-content.manifest.json +3 -3
  131. package/dist/assets/manifests/vue/ghost-menubar.manifest.json +4 -4
  132. package/dist/assets/manifests/vue/ghost-pagination.manifest.json +0 -2
  133. package/dist/assets/manifests/vue/ghost-popover-content.manifest.json +6 -2
  134. package/dist/assets/manifests/vue/ghost-presence.manifest.json +96 -0
  135. package/dist/assets/manifests/vue/ghost-scroll-area.manifest.json +0 -1
  136. package/dist/assets/manifests/vue/ghost-select-content.manifest.json +6 -1
  137. package/dist/assets/manifests/vue/ghost-select-group.manifest.json +6 -1
  138. package/dist/assets/manifests/vue/ghost-select-label.manifest.json +6 -1
  139. package/dist/assets/manifests/vue/ghost-select-option.manifest.json +6 -1
  140. package/dist/assets/manifests/vue/ghost-select-trigger.manifest.json +6 -1
  141. package/dist/assets/manifests/vue/ghost-select-value.manifest.json +18 -2
  142. package/dist/assets/manifests/vue/ghost-select.manifest.json +18 -6
  143. package/dist/assets/manifests/vue/ghost-submenu-content.manifest.json +168 -0
  144. package/dist/assets/manifests/vue/ghost-submenu-trigger.manifest.json +102 -0
  145. package/dist/assets/manifests/vue/ghost-submenu.manifest.json +59 -0
  146. package/dist/assets/manifests/vue/ghost-table.manifest.json +0 -2
  147. package/dist/assets/manifests/vue/ghost-tabs.manifest.json +2 -1
  148. package/dist/assets/manifests/vue/ghost-tags-input.manifest.json +260 -0
  149. package/dist/assets/tokens.json +15 -0
  150. package/dist/components.d.ts +5 -0
  151. package/dist/components.js +80 -11
  152. package/package.json +1 -1
@@ -1,42 +1,161 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, ref } from 'vue'
3
3
 
4
- import { GhostCard, GhostPagination } from '@ghostvue/themes'
4
+ import {
5
+ GhostBadge,
6
+ GhostCard,
7
+ GhostPagination,
8
+ GhostTable,
9
+ } from '@ghostvue/themes'
10
+ import {
11
+ GhostTableBody,
12
+ GhostTableCell,
13
+ GhostTableHead,
14
+ GhostTableHeaderCell,
15
+ GhostTableRow,
16
+ } from '@ghostvue/vue'
5
17
 
6
- const pageSize = 10
7
- const totalItems = 80
18
+ type InvoiceStatus = 'paid' | 'due' | 'overdue'
19
+
20
+ interface Invoice {
21
+ id: string
22
+ customer: string
23
+ amount: string
24
+ status: InvoiceStatus
25
+ }
26
+
27
+ const customers = [
28
+ 'Northwind Traders',
29
+ 'Contoso Ltd',
30
+ 'Fabrikam Inc',
31
+ 'Tailspin Toys',
32
+ 'Litware Labs',
33
+ 'Adventure Works',
34
+ 'Proseware',
35
+ 'Wide World Importers',
36
+ ] as const
37
+
38
+ const statuses: readonly InvoiceStatus[] = ['paid', 'paid', 'due', 'overdue']
39
+
40
+ // An explicit locale keeps server and client output identical.
41
+ const currency = new Intl.NumberFormat('en-US', {
42
+ style: 'currency',
43
+ currency: 'USD',
44
+ })
45
+
46
+ /*
47
+ * Deterministic local data: 40 invoices built from fixed lists, so every
48
+ * page and range is the same on each render. A real app would fetch one
49
+ * page at a time and pass the total from the response.
50
+ */
51
+ const invoices: readonly Invoice[] = Array.from({ length: 40 }, (_, index) => {
52
+ const cents = 12_000 + ((index * 7_919) % 180_000)
53
+ return {
54
+ id: `INV-${String(1201 + index)}`,
55
+ customer: customers[index % customers.length] ?? 'Unknown',
56
+ amount: currency.format(cents / 100),
57
+ status: statuses[index % statuses.length] ?? 'paid',
58
+ }
59
+ })
60
+
61
+ const pageSize = 5
62
+ const pageCount = Math.ceil(invoices.length / pageSize)
8
63
  const page = ref(3)
9
64
 
65
+ // The page index is 1-based; slice the matching window of records.
66
+ const pageStart = computed(() => (page.value - 1) * pageSize)
67
+ const visibleInvoices = computed(() =>
68
+ invoices.slice(pageStart.value, pageStart.value + pageSize),
69
+ )
70
+
10
71
  const rangeLabel = computed(() => {
11
- const start = (page.value - 1) * pageSize + 1
12
- const end = Math.min(page.value * pageSize, totalItems)
13
- return `Showing ${String(start)}–${String(end)} of ${String(totalItems)} invoices`
72
+ const start = pageStart.value + 1
73
+ const end = Math.min(pageStart.value + pageSize, invoices.length)
74
+ return `Showing ${String(start)}–${String(end)} of ${String(invoices.length)} invoices`
14
75
  })
76
+
77
+ const statusLabel: Record<InvoiceStatus, string> = {
78
+ paid: 'Paid',
79
+ due: 'Due',
80
+ overdue: 'Overdue',
81
+ }
82
+
83
+ // Badge tone is a color intent, not a status vocabulary: map it here.
84
+ const statusTone: Record<InvoiceStatus, 'accent' | 'neutral' | 'danger'> = {
85
+ paid: 'accent',
86
+ due: 'neutral',
87
+ overdue: 'danger',
88
+ }
15
89
  </script>
16
90
 
17
91
  <template>
18
- <GhostCard class="invoices-footer">
19
- <div class="invoices-footer__row">
20
- <div class="invoices-footer__summary" role="status" aria-live="polite">
21
- {{ rangeLabel }}
92
+ <!--
93
+ The pager sits below the rows it controls. Paging swaps the rows and
94
+ the polite status reads the new range once, while focus stays on the
95
+ page button the user pressed.
96
+ -->
97
+ <GhostCard class="invoices">
98
+ <!--
99
+ contain-horizontal is a safety net: on the narrowest phones the rows
100
+ scroll inside the named "Invoices" region instead of widening the page.
101
+ -->
102
+ <GhostTable
103
+ contain-horizontal
104
+ scroll-label="Invoices"
105
+ aria-label="Invoices"
106
+ >
107
+ <GhostTableHead>
108
+ <GhostTableRow>
109
+ <GhostTableHeaderCell scope="col">Invoice</GhostTableHeaderCell>
110
+ <GhostTableHeaderCell scope="col">Status</GhostTableHeaderCell>
111
+ <GhostTableHeaderCell scope="col" class="invoices__number">
112
+ Amount
113
+ </GhostTableHeaderCell>
114
+ </GhostTableRow>
115
+ </GhostTableHead>
116
+ <GhostTableBody>
117
+ <GhostTableRow v-for="invoice in visibleInvoices" :key="invoice.id">
118
+ <!-- The invoice number names the row; the customer is its detail. -->
119
+ <GhostTableHeaderCell scope="row">
120
+ <span class="invoices__lines">
121
+ <span class="invoices__id">{{ invoice.id }}</span>
122
+ <span class="invoices__customer">{{ invoice.customer }}</span>
123
+ </span>
124
+ </GhostTableHeaderCell>
125
+ <GhostTableCell>
126
+ <GhostBadge :tone="statusTone[invoice.status]">
127
+ {{ statusLabel[invoice.status] }}
128
+ </GhostBadge>
129
+ </GhostTableCell>
130
+ <GhostTableCell class="invoices__number">
131
+ {{ invoice.amount }}
132
+ </GhostTableCell>
133
+ </GhostTableRow>
134
+ </GhostTableBody>
135
+ </GhostTable>
136
+
137
+ <template #footer>
138
+ <div class="invoices__footer">
139
+ <p class="invoices__summary" role="status">{{ rangeLabel }}</p>
140
+ <GhostPagination
141
+ v-model="page"
142
+ :page-count="pageCount"
143
+ size="sm"
144
+ aria-label="Invoice pages"
145
+ />
22
146
  </div>
23
- <GhostPagination
24
- v-model="page"
25
- :page-count="8"
26
- size="sm"
27
- aria-label="Themed invoices"
28
- />
29
- </div>
147
+ </template>
30
148
  </GhostCard>
31
149
  </template>
32
150
 
33
151
  <style scoped>
34
- .invoices-footer {
152
+ .invoices {
35
153
  inline-size: 100%;
36
154
  max-inline-size: 40rem;
37
155
  }
38
156
 
39
- .invoices-footer__row {
157
+ /* Summary and pager share a row on wide cards and stack on phones. */
158
+ .invoices__footer {
40
159
  align-items: center;
41
160
  display: flex;
42
161
  flex-wrap: wrap;
@@ -44,9 +163,30 @@ const rangeLabel = computed(() => {
44
163
  justify-content: space-between;
45
164
  }
46
165
 
47
- .invoices-footer__summary {
166
+ .invoices__summary {
48
167
  color: var(--ghost-text-muted);
49
168
  font-size: var(--ghost-type-size-sm);
50
- font-variant-numeric: tabular-nums;
169
+ font-variant-numeric: var(--ghost-type-numeric-tabular);
170
+ margin: 0;
171
+ }
172
+
173
+ .invoices__lines {
174
+ display: grid;
175
+ }
176
+
177
+ .invoices__id,
178
+ .invoices__number {
179
+ font-variant-numeric: var(--ghost-type-numeric-tabular);
180
+ white-space: nowrap;
181
+ }
182
+
183
+ .invoices__customer {
184
+ color: var(--ghost-text-muted);
185
+ font-size: var(--ghost-type-size-xs);
186
+ font-weight: var(--ghost-type-weight-regular);
187
+ }
188
+
189
+ .invoices__number {
190
+ text-align: end;
51
191
  }
52
192
  </style>
@@ -0,0 +1,81 @@
1
+ <script setup lang="ts">
2
+ import { ref } from 'vue'
3
+
4
+ import { GhostPresence } from '@ghostvue/vue'
5
+
6
+ const open = ref(false)
7
+ const exits = ref(0)
8
+ </script>
9
+
10
+ <template>
11
+ <div class="presence-basic">
12
+ <button
13
+ type="button"
14
+ class="presence-basic__toggle"
15
+ aria-controls="presence-basic-panel"
16
+ :aria-expanded="open"
17
+ @click="open = !open"
18
+ >
19
+ {{ open ? 'Hide inspector' : 'Show inspector' }}
20
+ </button>
21
+
22
+ <GhostPresence :present="open" @exit-complete="exits += 1">
23
+ <aside
24
+ id="presence-basic-panel"
25
+ class="presence-basic__panel"
26
+ aria-label="Inspector"
27
+ >
28
+ <p>Selection: 3 layers</p>
29
+ <button type="button" class="presence-basic__toggle">Group</button>
30
+ </aside>
31
+ </GhostPresence>
32
+
33
+ <p class="presence-basic__status">Completed exits: {{ exits }}</p>
34
+ </div>
35
+ </template>
36
+
37
+ <style scoped>
38
+ .presence-basic {
39
+ display: grid;
40
+ gap: 0.75rem;
41
+ justify-items: start;
42
+ }
43
+
44
+ .presence-basic__toggle {
45
+ border: 1px solid ButtonBorder;
46
+ border-radius: 0.375rem;
47
+ padding: 0.375rem 0.75rem;
48
+ }
49
+
50
+ /* Plain CSS against the data-state hook GhostPresence writes. */
51
+ .presence-basic__panel {
52
+ border: 1px solid GrayText;
53
+ border-radius: 0.5rem;
54
+ padding: 0.75rem 1rem;
55
+ transition:
56
+ opacity 120ms ease,
57
+ translate 120ms ease;
58
+
59
+ @starting-style {
60
+ opacity: 0;
61
+ translate: 0 0.5rem;
62
+ }
63
+ }
64
+
65
+ .presence-basic__panel[data-state='closed'] {
66
+ opacity: 0;
67
+ translate: 0 0.5rem;
68
+ }
69
+
70
+ @media (prefers-reduced-motion: reduce) {
71
+ .presence-basic__panel,
72
+ .presence-basic__panel[data-state='closed'] {
73
+ translate: none;
74
+ }
75
+ }
76
+
77
+ .presence-basic__status {
78
+ font-size: 0.875rem;
79
+ margin: 0;
80
+ }
81
+ </style>
@@ -0,0 +1,92 @@
1
+ <script setup lang="ts">
2
+ import { ref } from 'vue'
3
+
4
+ import { GhostPortal, GhostPresence } from '@ghostvue/vue'
5
+
6
+ const open = ref(false)
7
+ </script>
8
+
9
+ <template>
10
+ <div class="presence-portal">
11
+ <button
12
+ type="button"
13
+ class="presence-portal__toggle"
14
+ :aria-expanded="open"
15
+ @click="open = !open"
16
+ >
17
+ {{ open ? 'Hide draft' : 'Show draft' }}
18
+ </button>
19
+
20
+ <GhostPortal>
21
+ <GhostPresence v-slot="{ state, exiting, setElement }" :present="open">
22
+ <!-- Two roots: bind the surface whose motion gates removal. -->
23
+ <div
24
+ class="presence-portal__backdrop"
25
+ aria-hidden="true"
26
+ :data-state="state"
27
+ @click="open = false"
28
+ ></div>
29
+ <div
30
+ :ref="setElement"
31
+ class="presence-portal__notice"
32
+ role="region"
33
+ aria-label="Saved draft"
34
+ :data-state="state"
35
+ :inert="exiting || undefined"
36
+ >
37
+ <p>Draft saved to your workspace.</p>
38
+ <button
39
+ type="button"
40
+ class="presence-portal__toggle"
41
+ @click="open = false"
42
+ >
43
+ Close
44
+ </button>
45
+ </div>
46
+ </GhostPresence>
47
+ </GhostPortal>
48
+ </div>
49
+ </template>
50
+
51
+ <style scoped>
52
+ .presence-portal__toggle {
53
+ border: 1px solid ButtonBorder;
54
+ border-radius: 0.375rem;
55
+ padding: 0.375rem 0.75rem;
56
+ }
57
+
58
+ .presence-portal__backdrop {
59
+ background: color-mix(in srgb, CanvasText 20%, transparent);
60
+ inset: 0;
61
+ position: fixed;
62
+ transition: opacity 120ms ease;
63
+ z-index: 49;
64
+
65
+ @starting-style {
66
+ opacity: 0;
67
+ }
68
+ }
69
+
70
+ .presence-portal__notice {
71
+ background: Canvas;
72
+ border: 1px solid GrayText;
73
+ border-radius: 0.5rem;
74
+ color: CanvasText;
75
+ inset-block-end: 1rem;
76
+ inset-inline-end: 1rem;
77
+ padding: 0.75rem 1rem;
78
+ position: fixed;
79
+ transition: opacity 120ms ease;
80
+ z-index: 50;
81
+
82
+ @starting-style {
83
+ opacity: 0;
84
+ }
85
+ }
86
+
87
+ .presence-portal__backdrop[data-state='closed'],
88
+ .presence-portal__notice[data-state='closed'] {
89
+ opacity: 0;
90
+ pointer-events: none;
91
+ }
92
+ </style>
@@ -0,0 +1,160 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref } from 'vue'
3
+
4
+ import { GhostButton, GhostCard, GhostProgress } from '@ghostvue/themes'
5
+
6
+ const BATCH_SIZE = 240
7
+
8
+ // `null` until the server reports how many rows the export holds.
9
+ const totalRows = ref<number | null>(null)
10
+ const exportedRows = ref(0)
11
+
12
+ const rows = new Intl.NumberFormat('en-US')
13
+
14
+ const isDone = computed(
15
+ () => totalRows.value !== null && exportedRows.value >= totalRows.value,
16
+ )
17
+ // While the total is unknown, pass `value: null` and nothing else. Once it is
18
+ // known, `max` is the row total and `valueText` says what the number counts.
19
+ const progress = computed(() =>
20
+ totalRows.value === null
21
+ ? { value: null }
22
+ : {
23
+ value: exportedRows.value,
24
+ max: totalRows.value,
25
+ valueText: `${rows.format(exportedRows.value)} of ${rows.format(totalRows.value)} rows`,
26
+ },
27
+ )
28
+ const statusText = computed(() => {
29
+ if (progress.value.valueText === undefined) return 'Counting rows…'
30
+ if (isDone.value) return `Export ready: ${progress.value.valueText}`
31
+ return progress.value.valueText
32
+ })
33
+
34
+ // Stand-ins for server progress events, so each step can be inspected.
35
+ function receiveUpdate(): void {
36
+ if (totalRows.value === null) {
37
+ totalRows.value = 960
38
+ return
39
+ }
40
+ exportedRows.value = Math.min(
41
+ totalRows.value,
42
+ exportedRows.value + BATCH_SIZE,
43
+ )
44
+ }
45
+
46
+ function restart(): void {
47
+ totalRows.value = null
48
+ exportedRows.value = 0
49
+ }
50
+
51
+ const actionLabel = computed(() => {
52
+ if (totalRows.value === null) return 'Finish counting'
53
+ return isDone.value ? 'Start new export' : 'Export next batch'
54
+ })
55
+
56
+ function nextStep(): void {
57
+ if (isDone.value) restart()
58
+ else receiveUpdate()
59
+ }
60
+ </script>
61
+
62
+ <template>
63
+ <section class="report-export" aria-labelledby="report-export-title">
64
+ <GhostCard>
65
+ <template #header>
66
+ <div class="report-export__header">
67
+ <h2 id="report-export-title" class="report-export__title">
68
+ Export billing report
69
+ </h2>
70
+ <p class="report-export__lead">
71
+ November invoices as CSV. The bar shows a value once the row count
72
+ is known.
73
+ </p>
74
+ </div>
75
+ </template>
76
+
77
+ <div class="report-export__item">
78
+ <div class="report-export__row">
79
+ <span class="report-export__file">billing-2026-11.csv</span>
80
+ <span class="report-export__value" role="status">{{
81
+ statusText
82
+ }}</span>
83
+ </div>
84
+ <GhostProgress
85
+ label="Exporting billing-2026-11.csv"
86
+ v-bind="progress"
87
+ />
88
+ </div>
89
+
90
+ <template #footer>
91
+ <!--
92
+ One button walks every phase, so keyboard focus stays on it from
93
+ counting through export and back to an unknown total.
94
+ -->
95
+ <GhostButton
96
+ size="sm"
97
+ variant="outline"
98
+ tone="neutral"
99
+ @click="nextStep"
100
+ >
101
+ {{ actionLabel }}
102
+ </GhostButton>
103
+ </template>
104
+ </GhostCard>
105
+ </section>
106
+ </template>
107
+
108
+ <style scoped>
109
+ .report-export {
110
+ max-inline-size: 32rem;
111
+ }
112
+
113
+ .report-export__header {
114
+ display: grid;
115
+ gap: var(--ghost-space-gap-xs);
116
+ }
117
+
118
+ .report-export__title {
119
+ color: var(--ghost-text-default);
120
+ font-size: var(--ghost-type-size-lg);
121
+ font-weight: var(--ghost-type-weight-semibold);
122
+ line-height: var(--ghost-type-line-tight);
123
+ margin: 0;
124
+ }
125
+
126
+ .report-export__lead {
127
+ color: var(--ghost-text-muted);
128
+ font-size: var(--ghost-type-size-sm);
129
+ line-height: var(--ghost-type-line-snug);
130
+ margin: 0;
131
+ }
132
+
133
+ .report-export__item {
134
+ display: grid;
135
+ gap: var(--ghost-space-gap-xs);
136
+ }
137
+
138
+ .report-export__row {
139
+ align-items: center;
140
+ display: flex;
141
+ flex-wrap: wrap;
142
+ gap: var(--ghost-space-gap-sm);
143
+ justify-content: space-between;
144
+ }
145
+
146
+ .report-export__file {
147
+ color: var(--ghost-text-default);
148
+ font-family: var(--ghost-type-family-mono);
149
+ font-size: var(--ghost-type-size-sm);
150
+ font-weight: var(--ghost-type-weight-medium);
151
+ line-height: var(--ghost-type-line-snug);
152
+ overflow-wrap: anywhere;
153
+ }
154
+
155
+ .report-export__value {
156
+ color: var(--ghost-text-muted);
157
+ font-size: var(--ghost-type-size-xs);
158
+ font-variant-numeric: tabular-nums;
159
+ }
160
+ </style>
@@ -120,7 +120,6 @@ const events = [
120
120
 
121
121
  .activity-feed__scroll {
122
122
  max-block-size: 13rem;
123
- padding-inline-end: var(--ghost-space-gap-xs);
124
123
  }
125
124
 
126
125
  .activity-feed__list {