@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
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, nextTick, ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
GhostBadge,
|
|
6
|
+
GhostButton,
|
|
7
|
+
GhostCard,
|
|
8
|
+
GhostCombobox,
|
|
9
|
+
GhostComboboxContent,
|
|
10
|
+
GhostComboboxEmpty,
|
|
11
|
+
GhostComboboxInput,
|
|
12
|
+
GhostComboboxOption,
|
|
13
|
+
GhostField,
|
|
14
|
+
GhostFieldControl,
|
|
15
|
+
GhostFieldDescription,
|
|
16
|
+
GhostFieldError,
|
|
17
|
+
GhostFieldLabel,
|
|
18
|
+
} from '@ghostvue/themes'
|
|
19
|
+
|
|
20
|
+
interface Choice {
|
|
21
|
+
value: string
|
|
22
|
+
label: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Deterministic local data: option values are what the form submits.
|
|
26
|
+
const reviewers: readonly Choice[] = [
|
|
27
|
+
{ value: 'maya-chen', label: 'Maya Chen' },
|
|
28
|
+
{ value: 'marcus-reed', label: 'Marcus Reed' },
|
|
29
|
+
{ value: 'priya-natarajan', label: 'Priya Natarajan' },
|
|
30
|
+
{ value: 'jonas-weber', label: 'Jonas Weber' },
|
|
31
|
+
{ value: 'amara-okafor', label: 'Amara Okafor' },
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
const labelChoices: readonly Choice[] = [
|
|
35
|
+
{ value: 'bug', label: 'Bug' },
|
|
36
|
+
{ value: 'docs', label: 'Documentation' },
|
|
37
|
+
{ value: 'performance', label: 'Performance' },
|
|
38
|
+
{ value: 'accessibility', label: 'Accessibility' },
|
|
39
|
+
{ value: 'security', label: 'Security' },
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
// Reset seed for the multi-value field; native reset restores it.
|
|
43
|
+
const defaultLabels: string[] = ['bug']
|
|
44
|
+
|
|
45
|
+
const reviewer = ref<string | undefined>(undefined)
|
|
46
|
+
const reviewerQuery = ref('')
|
|
47
|
+
const labels = ref<string[]>([...defaultLabels])
|
|
48
|
+
const labelQuery = ref('')
|
|
49
|
+
const reviewerMissing = ref(false)
|
|
50
|
+
|
|
51
|
+
function labelFor(choices: readonly Choice[], value: string): string {
|
|
52
|
+
return choices.find((choice) => choice.value === value)?.label ?? value
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/*
|
|
56
|
+
* Filtering is consumer-owned. In single mode the input shows the chosen
|
|
57
|
+
* label after a selection, so that text lists every reviewer again instead
|
|
58
|
+
* of filtering down to one.
|
|
59
|
+
*/
|
|
60
|
+
function matching(choices: readonly Choice[], query: string, shown = '') {
|
|
61
|
+
const needle = query.trim().toLowerCase()
|
|
62
|
+
if (needle === '' || query === shown) return choices
|
|
63
|
+
return choices.filter((choice) => choice.label.toLowerCase().includes(needle))
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const reviewerOptions = computed(() =>
|
|
67
|
+
matching(
|
|
68
|
+
reviewers,
|
|
69
|
+
reviewerQuery.value,
|
|
70
|
+
reviewer.value ? labelFor(reviewers, reviewer.value) : '',
|
|
71
|
+
),
|
|
72
|
+
)
|
|
73
|
+
const labelOptions = computed(() => matching(labelChoices, labelQuery.value))
|
|
74
|
+
|
|
75
|
+
// The combobox root accepts string | string[] | undefined for both modes.
|
|
76
|
+
function onReviewer(value: string | string[] | undefined): void {
|
|
77
|
+
reviewer.value = typeof value === 'string' ? value : undefined
|
|
78
|
+
reviewerMissing.value = false
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function onLabels(value: string | string[] | undefined): void {
|
|
82
|
+
labels.value = Array.isArray(value) ? value : []
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
interface SubmittedEntry {
|
|
86
|
+
name: string
|
|
87
|
+
values: string[]
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const submitted = ref<SubmittedEntry[]>([])
|
|
91
|
+
const status = ref('')
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
* `novalidate` turns off the browser's bubbles, but `checkValidity()` still
|
|
95
|
+
* runs native constraint validation: the required combobox's hidden input
|
|
96
|
+
* fails, fires `invalid`, and the input gets `aria-invalid` on its own.
|
|
97
|
+
*/
|
|
98
|
+
async function send(event: SubmitEvent): Promise<void> {
|
|
99
|
+
// Read before awaiting: currentTarget is cleared once dispatch ends.
|
|
100
|
+
const form = event.currentTarget
|
|
101
|
+
if (!(form instanceof HTMLFormElement)) return
|
|
102
|
+
if (!form.checkValidity()) {
|
|
103
|
+
reviewerMissing.value = true
|
|
104
|
+
submitted.value = []
|
|
105
|
+
status.value = ''
|
|
106
|
+
await nextTick()
|
|
107
|
+
form.querySelector<HTMLElement>('[aria-invalid="true"]')?.focus()
|
|
108
|
+
return
|
|
109
|
+
}
|
|
110
|
+
// A multiple combobox submits one entry per selected value.
|
|
111
|
+
const data = new FormData(form)
|
|
112
|
+
submitted.value = ['reviewer', 'labels'].map((name) => ({
|
|
113
|
+
name,
|
|
114
|
+
values: data
|
|
115
|
+
.getAll(name)
|
|
116
|
+
.map((value) => (typeof value === 'string' ? value : value.name)),
|
|
117
|
+
}))
|
|
118
|
+
const person = reviewer.value ? labelFor(reviewers, reviewer.value) : ''
|
|
119
|
+
status.value = `Review requested from ${person}.`
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Native reset restores each combobox's `default-value` and clears queries.
|
|
123
|
+
function onReset(): void {
|
|
124
|
+
reviewerMissing.value = false
|
|
125
|
+
submitted.value = []
|
|
126
|
+
status.value = 'Form reset.'
|
|
127
|
+
}
|
|
128
|
+
</script>
|
|
129
|
+
|
|
130
|
+
<template>
|
|
131
|
+
<form class="review" novalidate @submit.prevent="send" @reset="onReset">
|
|
132
|
+
<GhostCard as="section" aria-labelledby="review-title">
|
|
133
|
+
<template #header>
|
|
134
|
+
<div class="review__header">
|
|
135
|
+
<h2 id="review-title" class="review__title">Request a review</h2>
|
|
136
|
+
<p class="review__lead">
|
|
137
|
+
Pull request #1284 · Retry failed card payments
|
|
138
|
+
</p>
|
|
139
|
+
</div>
|
|
140
|
+
</template>
|
|
141
|
+
|
|
142
|
+
<div class="review__fields">
|
|
143
|
+
<GhostField required :invalid="reviewerMissing">
|
|
144
|
+
<GhostFieldLabel required>Reviewer</GhostFieldLabel>
|
|
145
|
+
<GhostFieldDescription
|
|
146
|
+
>One person approves the merge.</GhostFieldDescription
|
|
147
|
+
>
|
|
148
|
+
<GhostFieldControl v-slot="field">
|
|
149
|
+
<!-- `required` on the root enables native form validation. -->
|
|
150
|
+
<GhostCombobox
|
|
151
|
+
v-model:search="reviewerQuery"
|
|
152
|
+
:model-value="reviewer"
|
|
153
|
+
name="reviewer"
|
|
154
|
+
required
|
|
155
|
+
@update:model-value="onReviewer"
|
|
156
|
+
>
|
|
157
|
+
<GhostComboboxInput
|
|
158
|
+
v-bind="field"
|
|
159
|
+
placeholder="Search people"
|
|
160
|
+
spellcheck="false"
|
|
161
|
+
/>
|
|
162
|
+
<GhostComboboxContent class="review-list" :offset="6">
|
|
163
|
+
<GhostComboboxOption
|
|
164
|
+
v-for="choice in reviewerOptions"
|
|
165
|
+
:key="choice.value"
|
|
166
|
+
:value="choice.value"
|
|
167
|
+
:text-value="choice.label"
|
|
168
|
+
>
|
|
169
|
+
{{ choice.label }}
|
|
170
|
+
</GhostComboboxOption>
|
|
171
|
+
<GhostComboboxEmpty
|
|
172
|
+
>No one matches that name.</GhostComboboxEmpty
|
|
173
|
+
>
|
|
174
|
+
</GhostComboboxContent>
|
|
175
|
+
</GhostCombobox>
|
|
176
|
+
</GhostFieldControl>
|
|
177
|
+
<GhostFieldError v-if="reviewerMissing">
|
|
178
|
+
Choose a reviewer.
|
|
179
|
+
</GhostFieldError>
|
|
180
|
+
</GhostField>
|
|
181
|
+
|
|
182
|
+
<GhostField>
|
|
183
|
+
<GhostFieldLabel>Labels</GhostFieldLabel>
|
|
184
|
+
<GhostFieldDescription>
|
|
185
|
+
Pick any number. The list stays open while you toggle labels.
|
|
186
|
+
</GhostFieldDescription>
|
|
187
|
+
<GhostFieldControl v-slot="field">
|
|
188
|
+
<GhostCombobox
|
|
189
|
+
v-model:search="labelQuery"
|
|
190
|
+
:model-value="labels"
|
|
191
|
+
:default-value="defaultLabels"
|
|
192
|
+
name="labels"
|
|
193
|
+
multiple
|
|
194
|
+
@update:model-value="onLabels"
|
|
195
|
+
>
|
|
196
|
+
<GhostComboboxInput
|
|
197
|
+
v-bind="field"
|
|
198
|
+
placeholder="Filter labels"
|
|
199
|
+
spellcheck="false"
|
|
200
|
+
/>
|
|
201
|
+
<GhostComboboxContent class="review-list" :offset="6">
|
|
202
|
+
<GhostComboboxOption
|
|
203
|
+
v-for="choice in labelOptions"
|
|
204
|
+
:key="choice.value"
|
|
205
|
+
:value="choice.value"
|
|
206
|
+
:text-value="choice.label"
|
|
207
|
+
>
|
|
208
|
+
<span class="review-list__option">
|
|
209
|
+
{{ choice.label }}
|
|
210
|
+
<svg
|
|
211
|
+
v-if="labels.includes(choice.value)"
|
|
212
|
+
class="review-list__check"
|
|
213
|
+
aria-hidden="true"
|
|
214
|
+
viewBox="0 0 16 16"
|
|
215
|
+
>
|
|
216
|
+
<path d="M3.5 8.5l3 3 6-7" />
|
|
217
|
+
</svg>
|
|
218
|
+
</span>
|
|
219
|
+
</GhostComboboxOption>
|
|
220
|
+
<GhostComboboxEmpty>No labels match.</GhostComboboxEmpty>
|
|
221
|
+
</GhostComboboxContent>
|
|
222
|
+
</GhostCombobox>
|
|
223
|
+
</GhostFieldControl>
|
|
224
|
+
<ul
|
|
225
|
+
v-if="labels.length > 0"
|
|
226
|
+
class="review__chips"
|
|
227
|
+
aria-label="Selected labels"
|
|
228
|
+
>
|
|
229
|
+
<li v-for="value in labels" :key="value">
|
|
230
|
+
<GhostBadge>{{ labelFor(labelChoices, value) }}</GhostBadge>
|
|
231
|
+
</li>
|
|
232
|
+
</ul>
|
|
233
|
+
<span v-else class="review__none">No labels</span>
|
|
234
|
+
</GhostField>
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
<template #footer>
|
|
238
|
+
<div class="review__footer">
|
|
239
|
+
<p class="review__status" role="status">{{ status }}</p>
|
|
240
|
+
<div class="review__actions">
|
|
241
|
+
<GhostButton type="reset" variant="ghost" tone="neutral">
|
|
242
|
+
Reset
|
|
243
|
+
</GhostButton>
|
|
244
|
+
<GhostButton type="submit">Request review</GhostButton>
|
|
245
|
+
</div>
|
|
246
|
+
</div>
|
|
247
|
+
<section
|
|
248
|
+
v-if="submitted.length > 0"
|
|
249
|
+
class="review__submitted"
|
|
250
|
+
aria-labelledby="review-submitted-title"
|
|
251
|
+
>
|
|
252
|
+
<h3 id="review-submitted-title" class="review__submitted-title">
|
|
253
|
+
Submitted form data
|
|
254
|
+
</h3>
|
|
255
|
+
<dl class="review__entries">
|
|
256
|
+
<div
|
|
257
|
+
v-for="entry in submitted"
|
|
258
|
+
:key="entry.name"
|
|
259
|
+
class="review__entry"
|
|
260
|
+
>
|
|
261
|
+
<dt>{{ entry.name }}</dt>
|
|
262
|
+
<dd>
|
|
263
|
+
{{ entry.values.filter(Boolean).join(', ') || '(empty)' }}
|
|
264
|
+
</dd>
|
|
265
|
+
</div>
|
|
266
|
+
</dl>
|
|
267
|
+
</section>
|
|
268
|
+
</template>
|
|
269
|
+
</GhostCard>
|
|
270
|
+
</form>
|
|
271
|
+
</template>
|
|
272
|
+
|
|
273
|
+
<style scoped>
|
|
274
|
+
/* The form keeps a readable measure and shrinks with the preview on phones. */
|
|
275
|
+
.review {
|
|
276
|
+
max-inline-size: 32rem;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.review__header {
|
|
280
|
+
display: grid;
|
|
281
|
+
gap: var(--ghost-space-gap-xs);
|
|
282
|
+
padding-block-end: var(--ghost-space-stack-sm);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/* Native text picks up docs prose styles, so each element resets its own. */
|
|
286
|
+
.review__title,
|
|
287
|
+
.review__submitted-title {
|
|
288
|
+
border: 0;
|
|
289
|
+
color: var(--ghost-text-default);
|
|
290
|
+
font-size: var(--ghost-type-size-lg);
|
|
291
|
+
font-weight: var(--ghost-type-weight-semibold);
|
|
292
|
+
line-height: var(--ghost-type-line-tight);
|
|
293
|
+
margin: 0;
|
|
294
|
+
padding: 0;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.review__submitted-title {
|
|
298
|
+
font-size: var(--ghost-type-size-sm);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.review__lead,
|
|
302
|
+
.review__status,
|
|
303
|
+
.review__none {
|
|
304
|
+
color: var(--ghost-text-muted);
|
|
305
|
+
font-size: var(--ghost-type-size-sm);
|
|
306
|
+
line-height: var(--ghost-type-line-snug);
|
|
307
|
+
margin: 0;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.review__fields {
|
|
311
|
+
display: grid;
|
|
312
|
+
gap: var(--ghost-space-stack-lg);
|
|
313
|
+
grid-template-columns: minmax(0, 1fr);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/* Selected labels wrap under the input; reset the docs list styles. */
|
|
317
|
+
.review__chips {
|
|
318
|
+
display: flex;
|
|
319
|
+
flex-wrap: wrap;
|
|
320
|
+
gap: var(--ghost-space-gap-xs);
|
|
321
|
+
list-style: none;
|
|
322
|
+
margin: 0;
|
|
323
|
+
padding: 0;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.review__chips li {
|
|
327
|
+
margin: 0;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.review__footer {
|
|
331
|
+
align-items: center;
|
|
332
|
+
display: flex;
|
|
333
|
+
flex-wrap: wrap;
|
|
334
|
+
gap: var(--ghost-space-gap-sm) var(--ghost-space-gap-md);
|
|
335
|
+
justify-content: flex-end;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.review__status {
|
|
339
|
+
flex: 1 1 10rem;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.review__actions {
|
|
343
|
+
display: flex;
|
|
344
|
+
gap: var(--ghost-space-gap-sm);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.review__submitted {
|
|
348
|
+
border-block-start: var(--ghost-border-hairline-width) solid
|
|
349
|
+
var(--ghost-border-default);
|
|
350
|
+
display: grid;
|
|
351
|
+
gap: var(--ghost-space-gap-sm);
|
|
352
|
+
margin-block-start: var(--ghost-space-stack-md);
|
|
353
|
+
padding-block-start: var(--ghost-space-stack-md);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.review__entries {
|
|
357
|
+
display: grid;
|
|
358
|
+
gap: var(--ghost-space-gap-xs);
|
|
359
|
+
margin: 0;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.review__entry {
|
|
363
|
+
column-gap: var(--ghost-space-gap-md);
|
|
364
|
+
display: grid;
|
|
365
|
+
font-size: var(--ghost-type-size-sm);
|
|
366
|
+
grid-template-columns: minmax(0, 6rem) minmax(0, 1fr);
|
|
367
|
+
line-height: var(--ghost-type-line-snug);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.review__entry dt,
|
|
371
|
+
.review__entry dd {
|
|
372
|
+
margin: 0;
|
|
373
|
+
min-inline-size: 0;
|
|
374
|
+
overflow-wrap: anywhere;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.review__entry dt {
|
|
378
|
+
color: var(--ghost-text-muted);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.review__entry dd {
|
|
382
|
+
color: var(--ghost-text-default);
|
|
383
|
+
font-weight: var(--ghost-type-weight-medium);
|
|
384
|
+
}
|
|
385
|
+
</style>
|
|
386
|
+
|
|
387
|
+
<style>
|
|
388
|
+
/*
|
|
389
|
+
* Unscoped on purpose: these classes land on the listbox content and its
|
|
390
|
+
* options inside a body portal, where a scoped attribute is not guaranteed.
|
|
391
|
+
* The themed list paints the surface and the checked fill; the check mark
|
|
392
|
+
* only adds a second cue for multi-value rows and never shifts layout.
|
|
393
|
+
*/
|
|
394
|
+
.review-list {
|
|
395
|
+
min-inline-size: 14rem;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.review-list__option {
|
|
399
|
+
align-items: center;
|
|
400
|
+
display: flex;
|
|
401
|
+
gap: var(--ghost-space-gap-sm);
|
|
402
|
+
justify-content: space-between;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.review-list__check {
|
|
406
|
+
block-size: 1rem;
|
|
407
|
+
fill: none;
|
|
408
|
+
flex: none;
|
|
409
|
+
inline-size: 1rem;
|
|
410
|
+
stroke: currentColor;
|
|
411
|
+
stroke-linecap: round;
|
|
412
|
+
stroke-linejoin: round;
|
|
413
|
+
stroke-width: 1.75;
|
|
414
|
+
}
|
|
415
|
+
</style>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { ref } from 'vue'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
+
GhostButton,
|
|
5
6
|
GhostCommandPalette,
|
|
6
7
|
GhostCommandPaletteContent,
|
|
7
8
|
GhostCommandPaletteEmpty,
|
|
@@ -14,22 +15,24 @@ import {
|
|
|
14
15
|
useGhostCommandPaletteAsyncSearch,
|
|
15
16
|
type GhostCommandPaletteCommandPayload,
|
|
16
17
|
type GhostCommandPaletteSearchPayload,
|
|
17
|
-
} from '@ghostvue/
|
|
18
|
+
} from '@ghostvue/themes'
|
|
18
19
|
|
|
19
20
|
interface Page {
|
|
20
21
|
id: string
|
|
21
22
|
title: string
|
|
23
|
+
space: string
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
const catalog: Page[] = [
|
|
25
|
-
{ id: 'page-roadmap', title: 'Roadmap' },
|
|
26
|
-
{ id: 'page-release-notes', title: 'Release notes' },
|
|
27
|
-
{ id: 'page-retro', title: 'Sprint retro' },
|
|
28
|
-
{ id: 'page-onboarding', title: 'Onboarding checklist' },
|
|
29
|
-
{ id: 'page-oncall', title: 'On-call runbook' },
|
|
30
|
-
{ id: 'page-pricing', title: 'Pricing experiments' },
|
|
27
|
+
{ id: 'page-roadmap', title: 'Roadmap', space: 'Product' },
|
|
28
|
+
{ id: 'page-release-notes', title: 'Release notes', space: 'Product' },
|
|
29
|
+
{ id: 'page-retro', title: 'Sprint retro', space: 'Engineering' },
|
|
30
|
+
{ id: 'page-onboarding', title: 'Onboarding checklist', space: 'People' },
|
|
31
|
+
{ id: 'page-oncall', title: 'On-call runbook', space: 'Engineering' },
|
|
32
|
+
{ id: 'page-pricing', title: 'Pricing experiments', space: 'Growth' },
|
|
31
33
|
]
|
|
32
34
|
|
|
35
|
+
const search = ref('')
|
|
33
36
|
const results = ref<Page[]>(catalog)
|
|
34
37
|
const loading = ref(false)
|
|
35
38
|
const opened = ref('Nothing yet')
|
|
@@ -74,31 +77,76 @@ function onCommand({ id }: GhostCommandPaletteCommandPayload): void {
|
|
|
74
77
|
</script>
|
|
75
78
|
|
|
76
79
|
<template>
|
|
77
|
-
<div>
|
|
80
|
+
<div class="palette-async">
|
|
78
81
|
<GhostCommandPalette
|
|
82
|
+
v-model:search="search"
|
|
79
83
|
:loading="loading"
|
|
80
84
|
@search="onSearch"
|
|
81
85
|
@command="onCommand"
|
|
82
86
|
>
|
|
83
|
-
<GhostCommandPaletteTrigger
|
|
87
|
+
<GhostCommandPaletteTrigger :as="GhostButton" variant="outline">
|
|
88
|
+
Search pages
|
|
89
|
+
</GhostCommandPaletteTrigger>
|
|
84
90
|
<GhostCommandPaletteOverlay />
|
|
85
91
|
<GhostCommandPaletteContent>
|
|
86
92
|
<GhostCommandPaletteTitle>Search pages</GhostCommandPaletteTitle>
|
|
87
93
|
<GhostCommandPaletteInput placeholder="Page title" />
|
|
94
|
+
<!--
|
|
95
|
+
While loading, the list keeps the previous results and the palette
|
|
96
|
+
announces "Loading results" itself, so this visible line is hidden
|
|
97
|
+
from assistive technology to avoid a second announcement.
|
|
98
|
+
-->
|
|
99
|
+
<p class="palette-async__status" aria-hidden="true">
|
|
100
|
+
{{ loading ? 'Searching pages…' : 'Results update as you type' }}
|
|
101
|
+
</p>
|
|
88
102
|
<GhostCommandPaletteList>
|
|
89
103
|
<GhostCommandPaletteItem
|
|
90
104
|
v-for="page in results"
|
|
91
105
|
:id="page.id"
|
|
92
106
|
:key="page.id"
|
|
107
|
+
:text-value="page.title"
|
|
93
108
|
>
|
|
94
|
-
{{ page.title }}
|
|
109
|
+
<span class="palette-async__title">{{ page.title }}</span>
|
|
110
|
+
<span class="palette-async__space">{{ page.space }}</span>
|
|
95
111
|
</GhostCommandPaletteItem>
|
|
96
|
-
<GhostCommandPaletteEmpty>
|
|
112
|
+
<GhostCommandPaletteEmpty>
|
|
113
|
+
No pages match “{{ search.trim() }}”. Try a shorter title.
|
|
114
|
+
</GhostCommandPaletteEmpty>
|
|
97
115
|
</GhostCommandPaletteList>
|
|
98
116
|
</GhostCommandPaletteContent>
|
|
99
117
|
</GhostCommandPalette>
|
|
100
|
-
<p>
|
|
118
|
+
<p class="palette-async__result">
|
|
101
119
|
Opened: <output>{{ opened }}</output>
|
|
102
120
|
</p>
|
|
103
121
|
</div>
|
|
104
122
|
</template>
|
|
123
|
+
|
|
124
|
+
<style scoped>
|
|
125
|
+
.palette-async {
|
|
126
|
+
display: grid;
|
|
127
|
+
gap: var(--ghost-space-gap-sm);
|
|
128
|
+
justify-items: start;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.palette-async__result {
|
|
132
|
+
color: var(--ghost-text-muted);
|
|
133
|
+
font-size: var(--ghost-type-size-sm);
|
|
134
|
+
margin: 0;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.palette-async__status {
|
|
138
|
+
color: var(--ghost-text-muted);
|
|
139
|
+
font-size: var(--ghost-type-size-sm);
|
|
140
|
+
margin: 0;
|
|
141
|
+
padding-inline: var(--ghost-space-inset-sm);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.palette-async__title {
|
|
145
|
+
flex: 1;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.palette-async__space {
|
|
149
|
+
color: var(--ghost-text-muted);
|
|
150
|
+
font-size: var(--ghost-type-size-sm);
|
|
151
|
+
}
|
|
152
|
+
</style>
|
|
@@ -74,8 +74,8 @@ function runCommand({ id }: GhostCommandPaletteCommandPayload): void {
|
|
|
74
74
|
<GhostCommandPaletteTrigger
|
|
75
75
|
>Open command palette</GhostCommandPaletteTrigger
|
|
76
76
|
>
|
|
77
|
-
<GhostCommandPaletteOverlay />
|
|
78
|
-
<GhostCommandPaletteContent>
|
|
77
|
+
<GhostCommandPaletteOverlay class="command-palette-demo__overlay" />
|
|
78
|
+
<GhostCommandPaletteContent class="command-palette-demo">
|
|
79
79
|
<GhostCommandPaletteTitle>Command palette</GhostCommandPaletteTitle>
|
|
80
80
|
<GhostCommandPaletteInput placeholder="Type a command" />
|
|
81
81
|
<GhostCommandPaletteList>
|
|
@@ -106,3 +106,124 @@ function runCommand({ id }: GhostCommandPaletteCommandPayload): void {
|
|
|
106
106
|
</p>
|
|
107
107
|
</div>
|
|
108
108
|
</template>
|
|
109
|
+
|
|
110
|
+
<style>
|
|
111
|
+
/*
|
|
112
|
+
* Headless GhostCommandPalette ships behavior only: the overlay and content
|
|
113
|
+
* are portaled to <body> with no position, surface or item states. This
|
|
114
|
+
* consumer CSS is unscoped on purpose, because portaled parts do not carry
|
|
115
|
+
* the component's scoped attribute, and prefixed so it cannot collide with
|
|
116
|
+
* page styles. Parts below the content are reached through `data-part`.
|
|
117
|
+
*
|
|
118
|
+
* Colors read GhostVue semantic tokens when a theme is loaded and fall back
|
|
119
|
+
* to CSS system colors, which follow light and dark on their own. Rows keep
|
|
120
|
+
* fixed geometry: highlight and disabled only change color. The highlight
|
|
121
|
+
* follows `data-highlighted`, because focus stays in the input. Nothing
|
|
122
|
+
* animates, so reduced motion needs no override.
|
|
123
|
+
*/
|
|
124
|
+
.command-palette-demo__overlay {
|
|
125
|
+
background-color: rgb(0 0 0 / 45%);
|
|
126
|
+
inset: 0;
|
|
127
|
+
position: fixed;
|
|
128
|
+
z-index: 50;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* Anchored near the top so the input stays put as results change. */
|
|
132
|
+
.command-palette-demo {
|
|
133
|
+
background-color: var(--ghost-elevation-4-bg, Canvas);
|
|
134
|
+
border: 1px solid var(--ghost-elevation-4-border, GrayText);
|
|
135
|
+
border-radius: var(--ghost-radius-lg, 0.5rem);
|
|
136
|
+
box-shadow: var(--ghost-elevation-4-shadow, 0 1rem 2rem rgb(0 0 0 / 25%));
|
|
137
|
+
box-sizing: border-box;
|
|
138
|
+
color: var(--ghost-surface-fg, CanvasText);
|
|
139
|
+
display: grid;
|
|
140
|
+
gap: 0.5rem;
|
|
141
|
+
inline-size: min(calc(100vw - 2rem), 32rem);
|
|
142
|
+
left: 50%;
|
|
143
|
+
max-block-size: calc(100dvh - 2rem);
|
|
144
|
+
overflow: auto;
|
|
145
|
+
padding: 0.75rem;
|
|
146
|
+
position: fixed;
|
|
147
|
+
top: min(12dvh, 8rem);
|
|
148
|
+
transform: translateX(-50%);
|
|
149
|
+
z-index: 50;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.command-palette-demo [data-part='title'] {
|
|
153
|
+
border: 0;
|
|
154
|
+
font-size: 0.875rem;
|
|
155
|
+
font-weight: 600;
|
|
156
|
+
letter-spacing: normal;
|
|
157
|
+
line-height: 1.4;
|
|
158
|
+
margin: 0;
|
|
159
|
+
padding: 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.command-palette-demo [data-part='input'] {
|
|
163
|
+
background-color: var(--ghost-surface-bg, Field);
|
|
164
|
+
border: 1px solid var(--ghost-border-strong, GrayText);
|
|
165
|
+
border-radius: var(--ghost-radius-md, 0.375rem);
|
|
166
|
+
box-sizing: border-box;
|
|
167
|
+
color: var(--ghost-text-default, FieldText);
|
|
168
|
+
font: inherit;
|
|
169
|
+
inline-size: 100%;
|
|
170
|
+
padding: 0.5rem 0.75rem;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.command-palette-demo [data-part='input']:focus-visible {
|
|
174
|
+
outline: 2px solid var(--ghost-focus-ring-color, Highlight);
|
|
175
|
+
outline-offset: 2px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.command-palette-demo [data-part='list'] {
|
|
179
|
+
max-block-size: min(50dvh, 18rem);
|
|
180
|
+
overflow: auto;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.command-palette-demo [data-part='label'] {
|
|
184
|
+
color: var(--ghost-text-muted, GrayText);
|
|
185
|
+
font-size: 0.75rem;
|
|
186
|
+
font-weight: 600;
|
|
187
|
+
padding: 0.25rem 0.75rem;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.command-palette-demo [data-part='separator'] {
|
|
191
|
+
border-block-start: 1px solid var(--ghost-border-default, GrayText);
|
|
192
|
+
margin-block: 0.25rem;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.command-palette-demo [role='option'] {
|
|
196
|
+
border-radius: var(--ghost-radius-sm, 0.25rem);
|
|
197
|
+
cursor: default;
|
|
198
|
+
/* A transparent outline turns into a visible ring under forced colors. */
|
|
199
|
+
outline: 2px solid transparent;
|
|
200
|
+
outline-offset: -2px;
|
|
201
|
+
padding: 0.375rem 0.75rem;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.command-palette-demo [role='option'][data-highlighted] {
|
|
205
|
+
background-color: var(--ghost-action-primary-bg, Highlight);
|
|
206
|
+
color: var(--ghost-action-primary-fg, HighlightText);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.command-palette-demo [role='option'][aria-disabled='true'] {
|
|
210
|
+
color: var(--ghost-text-muted, GrayText);
|
|
211
|
+
cursor: not-allowed;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.command-palette-demo [data-part='empty'],
|
|
215
|
+
.command-palette-demo > p {
|
|
216
|
+
color: var(--ghost-text-muted, GrayText);
|
|
217
|
+
font-size: 0.875rem;
|
|
218
|
+
margin: 0;
|
|
219
|
+
padding: 0.375rem 0.75rem;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
@media (forced-colors: active) {
|
|
223
|
+
.command-palette-demo [role='option'][data-highlighted] {
|
|
224
|
+
background-color: Highlight;
|
|
225
|
+
color: HighlightText;
|
|
226
|
+
forced-color-adjust: none;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
</style>
|