@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,376 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { reactive, ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
GhostForm,
|
|
6
|
+
type GhostFormSubmitPayload,
|
|
7
|
+
type StandardSchemaV1,
|
|
8
|
+
} from '@ghostvue/vue'
|
|
9
|
+
import {
|
|
10
|
+
GhostButton,
|
|
11
|
+
GhostCard,
|
|
12
|
+
GhostField,
|
|
13
|
+
GhostFieldControl,
|
|
14
|
+
GhostFieldDescription,
|
|
15
|
+
GhostFieldError,
|
|
16
|
+
GhostFieldLabel,
|
|
17
|
+
GhostInlineAlert,
|
|
18
|
+
GhostInput,
|
|
19
|
+
} from '@ghostvue/themes'
|
|
20
|
+
|
|
21
|
+
interface ProfileInput {
|
|
22
|
+
displayName: string
|
|
23
|
+
supportEmail: string
|
|
24
|
+
seatLimit: string
|
|
25
|
+
billing: {
|
|
26
|
+
postalCode: string
|
|
27
|
+
}
|
|
28
|
+
webhooks: { url: string }[]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface ProfileOutput {
|
|
32
|
+
displayName: string
|
|
33
|
+
supportEmail: string
|
|
34
|
+
seatLimit: number
|
|
35
|
+
billing: {
|
|
36
|
+
postalCode: string
|
|
37
|
+
}
|
|
38
|
+
webhooks: { url: URL }[]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
* Any Standard Schema v1 validator (Zod, Valibot, ArkType) satisfies this
|
|
43
|
+
* interface. Shown inline to make the ~standard input -> output contract clear.
|
|
44
|
+
*/
|
|
45
|
+
const profileSchema: StandardSchemaV1<ProfileInput, ProfileOutput> = {
|
|
46
|
+
'~standard': {
|
|
47
|
+
version: 1,
|
|
48
|
+
vendor: 'example',
|
|
49
|
+
validate(raw) {
|
|
50
|
+
const data = raw as ProfileInput
|
|
51
|
+
const issues: StandardSchemaV1.Issue[] = []
|
|
52
|
+
|
|
53
|
+
const displayName = data.displayName.trim()
|
|
54
|
+
if (displayName.length === 0) {
|
|
55
|
+
issues.push({
|
|
56
|
+
message: 'Enter a display name.',
|
|
57
|
+
path: ['displayName'],
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const supportEmail = data.supportEmail.trim().toLowerCase()
|
|
62
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(supportEmail)) {
|
|
63
|
+
issues.push({
|
|
64
|
+
message: 'Enter an address like team@company.com.',
|
|
65
|
+
path: [{ key: 'supportEmail' }],
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const parsedSeats = Number(data.seatLimit.trim())
|
|
70
|
+
if (!Number.isInteger(parsedSeats) || parsedSeats < 1) {
|
|
71
|
+
issues.push({
|
|
72
|
+
message: 'Seat limit must be a whole number of at least 1.',
|
|
73
|
+
path: ['seatLimit'],
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const postalCode = data.billing.postalCode.trim()
|
|
78
|
+
if (postalCode.length < 3) {
|
|
79
|
+
issues.push({
|
|
80
|
+
message: 'Enter a valid billing postal code.',
|
|
81
|
+
path: ['billing', 'postalCode'],
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const webhooks: { url: URL }[] = []
|
|
86
|
+
data.webhooks.forEach((entry, index) => {
|
|
87
|
+
try {
|
|
88
|
+
webhooks.push({ url: new URL(entry.url.trim()) })
|
|
89
|
+
} catch {
|
|
90
|
+
issues.push({
|
|
91
|
+
message: 'Enter a full https:// webhook URL.',
|
|
92
|
+
path: ['webhooks', index, 'url'],
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
if (parsedSeats > 100 && webhooks.length === 0) {
|
|
98
|
+
issues.push({
|
|
99
|
+
message: 'Plans above 100 seats require at least one audit webhook.',
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (issues.length > 0) {
|
|
104
|
+
return { issues }
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
value: {
|
|
109
|
+
displayName,
|
|
110
|
+
supportEmail,
|
|
111
|
+
seatLimit: parsedSeats,
|
|
112
|
+
billing: { postalCode },
|
|
113
|
+
webhooks,
|
|
114
|
+
},
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const initialValues = (): ProfileInput => ({
|
|
121
|
+
displayName: 'Ada Lovelace',
|
|
122
|
+
supportEmail: 'ada@analytical-engines.org',
|
|
123
|
+
seatLimit: '25',
|
|
124
|
+
billing: { postalCode: 'EC1A 1BB' },
|
|
125
|
+
webhooks: [{ url: 'https://hooks.analytical.engine/audit' }],
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
const values = reactive<ProfileInput>(initialValues())
|
|
129
|
+
const billingId = 'org_01J9XK2M8P'
|
|
130
|
+
const lastSavedSummary = ref<string>('')
|
|
131
|
+
|
|
132
|
+
function handleSave({
|
|
133
|
+
output,
|
|
134
|
+
setFieldErrors,
|
|
135
|
+
waitUntil,
|
|
136
|
+
}: GhostFormSubmitPayload<ProfileOutput, ProfileInput>): void {
|
|
137
|
+
waitUntil(
|
|
138
|
+
Promise.resolve().then(() => {
|
|
139
|
+
if (output.supportEmail.endsWith('@blocked.example')) {
|
|
140
|
+
setFieldErrors('supportEmail', [
|
|
141
|
+
'Use a verified workspace domain for support alerts.',
|
|
142
|
+
])
|
|
143
|
+
return
|
|
144
|
+
}
|
|
145
|
+
lastSavedSummary.value = `Saved ${String(output.seatLimit)} seats for ${output.displayName} (${output.webhooks[0]?.url.hostname ?? 'no webhook'}).`
|
|
146
|
+
}),
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function handleReset(): void {
|
|
151
|
+
Object.assign(values, initialValues())
|
|
152
|
+
lastSavedSummary.value = ''
|
|
153
|
+
}
|
|
154
|
+
</script>
|
|
155
|
+
|
|
156
|
+
<template>
|
|
157
|
+
<GhostForm
|
|
158
|
+
v-slot="{ formErrors, isSubmitting }"
|
|
159
|
+
class="profile-schema-form"
|
|
160
|
+
:schema="profileSchema"
|
|
161
|
+
:values="values"
|
|
162
|
+
@submit="handleSave"
|
|
163
|
+
@reset="handleReset"
|
|
164
|
+
>
|
|
165
|
+
<GhostCard as="section" aria-labelledby="form-profile-title">
|
|
166
|
+
<template #header>
|
|
167
|
+
<div class="profile-schema-form__header">
|
|
168
|
+
<h2 id="form-profile-title" class="profile-schema-form__title">
|
|
169
|
+
Workspace profile
|
|
170
|
+
</h2>
|
|
171
|
+
<p class="profile-schema-form__lead">
|
|
172
|
+
Validates with Standard Schema v1 and transforms strings to typed
|
|
173
|
+
numbers and URLs on submit.
|
|
174
|
+
</p>
|
|
175
|
+
</div>
|
|
176
|
+
</template>
|
|
177
|
+
|
|
178
|
+
<div class="profile-schema-form__fields">
|
|
179
|
+
<GhostInlineAlert
|
|
180
|
+
v-if="formErrors.length > 0"
|
|
181
|
+
announce="alert"
|
|
182
|
+
tone="danger"
|
|
183
|
+
>
|
|
184
|
+
<template #title>Unable to save profile</template>
|
|
185
|
+
<template #message>
|
|
186
|
+
<ul class="profile-schema-form__alert-list">
|
|
187
|
+
<li v-for="(err, idx) in formErrors" :key="idx">{{ err }}</li>
|
|
188
|
+
</ul>
|
|
189
|
+
</template>
|
|
190
|
+
</GhostInlineAlert>
|
|
191
|
+
|
|
192
|
+
<GhostField name="displayName" required>
|
|
193
|
+
<GhostFieldLabel>Display name</GhostFieldLabel>
|
|
194
|
+
<GhostFieldControl v-slot="field">
|
|
195
|
+
<GhostInput
|
|
196
|
+
v-bind="field"
|
|
197
|
+
v-model="values.displayName"
|
|
198
|
+
name="displayName"
|
|
199
|
+
autocomplete="name"
|
|
200
|
+
block
|
|
201
|
+
/>
|
|
202
|
+
</GhostFieldControl>
|
|
203
|
+
<GhostFieldError />
|
|
204
|
+
</GhostField>
|
|
205
|
+
|
|
206
|
+
<GhostField name="supportEmail" required>
|
|
207
|
+
<GhostFieldLabel>Support email</GhostFieldLabel>
|
|
208
|
+
<GhostFieldDescription>
|
|
209
|
+
Alerts and billing receipts are sent to this address.
|
|
210
|
+
</GhostFieldDescription>
|
|
211
|
+
<GhostFieldControl v-slot="field">
|
|
212
|
+
<GhostInput
|
|
213
|
+
v-bind="field"
|
|
214
|
+
v-model="values.supportEmail"
|
|
215
|
+
type="email"
|
|
216
|
+
name="supportEmail"
|
|
217
|
+
autocomplete="email"
|
|
218
|
+
block
|
|
219
|
+
/>
|
|
220
|
+
</GhostFieldControl>
|
|
221
|
+
<GhostFieldError />
|
|
222
|
+
</GhostField>
|
|
223
|
+
|
|
224
|
+
<GhostField name="seatLimit" required>
|
|
225
|
+
<GhostFieldLabel>Seat limit</GhostFieldLabel>
|
|
226
|
+
<GhostFieldControl v-slot="field">
|
|
227
|
+
<GhostInput
|
|
228
|
+
v-bind="field"
|
|
229
|
+
v-model="values.seatLimit"
|
|
230
|
+
inputmode="numeric"
|
|
231
|
+
name="seatLimit"
|
|
232
|
+
block
|
|
233
|
+
/>
|
|
234
|
+
</GhostFieldControl>
|
|
235
|
+
<GhostFieldError />
|
|
236
|
+
</GhostField>
|
|
237
|
+
|
|
238
|
+
<GhostField name="billing.postalCode" required>
|
|
239
|
+
<GhostFieldLabel>Billing postal code</GhostFieldLabel>
|
|
240
|
+
<GhostFieldControl v-slot="field">
|
|
241
|
+
<GhostInput
|
|
242
|
+
v-bind="field"
|
|
243
|
+
v-model="values.billing.postalCode"
|
|
244
|
+
name="billing.postalCode"
|
|
245
|
+
autocomplete="postal-code"
|
|
246
|
+
block
|
|
247
|
+
/>
|
|
248
|
+
</GhostFieldControl>
|
|
249
|
+
<GhostFieldError />
|
|
250
|
+
</GhostField>
|
|
251
|
+
|
|
252
|
+
<GhostField
|
|
253
|
+
v-for="(hook, index) in values.webhooks"
|
|
254
|
+
:key="index"
|
|
255
|
+
:name="`webhooks.${index}.url`"
|
|
256
|
+
required
|
|
257
|
+
>
|
|
258
|
+
<GhostFieldLabel>Webhook URL {{ index + 1 }}</GhostFieldLabel>
|
|
259
|
+
<GhostFieldControl v-slot="field">
|
|
260
|
+
<GhostInput
|
|
261
|
+
v-bind="field"
|
|
262
|
+
v-model="hook.url"
|
|
263
|
+
type="url"
|
|
264
|
+
:name="`webhooks.${index}.url`"
|
|
265
|
+
block
|
|
266
|
+
/>
|
|
267
|
+
</GhostFieldControl>
|
|
268
|
+
<GhostFieldError />
|
|
269
|
+
</GhostField>
|
|
270
|
+
|
|
271
|
+
<!-- No `name` prop: opts out of GhostForm validation and stays prop-driven. -->
|
|
272
|
+
<GhostField disabled>
|
|
273
|
+
<GhostFieldLabel>Organization ID</GhostFieldLabel>
|
|
274
|
+
<GhostFieldDescription>
|
|
275
|
+
Assigned by your workspace administrator.
|
|
276
|
+
</GhostFieldDescription>
|
|
277
|
+
<GhostFieldControl v-slot="field">
|
|
278
|
+
<GhostInput v-bind="field" :model-value="billingId" block />
|
|
279
|
+
</GhostFieldControl>
|
|
280
|
+
</GhostField>
|
|
281
|
+
</div>
|
|
282
|
+
|
|
283
|
+
<template #footer>
|
|
284
|
+
<div class="profile-schema-form__actions">
|
|
285
|
+
<p class="profile-schema-form__status" role="status">
|
|
286
|
+
{{ lastSavedSummary }}
|
|
287
|
+
</p>
|
|
288
|
+
<GhostButton
|
|
289
|
+
type="reset"
|
|
290
|
+
variant="ghost"
|
|
291
|
+
tone="neutral"
|
|
292
|
+
class="profile-schema-form__action"
|
|
293
|
+
>
|
|
294
|
+
Reset
|
|
295
|
+
</GhostButton>
|
|
296
|
+
<GhostButton
|
|
297
|
+
type="submit"
|
|
298
|
+
:loading="isSubmitting"
|
|
299
|
+
class="profile-schema-form__action"
|
|
300
|
+
>
|
|
301
|
+
Save profile
|
|
302
|
+
</GhostButton>
|
|
303
|
+
</div>
|
|
304
|
+
</template>
|
|
305
|
+
</GhostCard>
|
|
306
|
+
</GhostForm>
|
|
307
|
+
</template>
|
|
308
|
+
|
|
309
|
+
<style scoped>
|
|
310
|
+
.profile-schema-form {
|
|
311
|
+
max-inline-size: 32rem;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.profile-schema-form__header {
|
|
315
|
+
display: grid;
|
|
316
|
+
gap: var(--ghost-space-gap-xs);
|
|
317
|
+
padding-block-end: var(--ghost-space-stack-sm);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.profile-schema-form__title {
|
|
321
|
+
color: var(--ghost-text-default);
|
|
322
|
+
font-size: var(--ghost-type-size-lg);
|
|
323
|
+
font-weight: var(--ghost-type-weight-semibold);
|
|
324
|
+
line-height: var(--ghost-type-line-tight);
|
|
325
|
+
margin: 0;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.profile-schema-form__lead,
|
|
329
|
+
.profile-schema-form__status {
|
|
330
|
+
color: var(--ghost-text-muted);
|
|
331
|
+
font-size: var(--ghost-type-size-sm);
|
|
332
|
+
line-height: var(--ghost-type-line-snug);
|
|
333
|
+
margin: 0;
|
|
334
|
+
overflow-wrap: anywhere;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.profile-schema-form__fields {
|
|
338
|
+
display: grid;
|
|
339
|
+
gap: var(--ghost-space-stack-lg);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.profile-schema-form__alert-list {
|
|
343
|
+
margin: 0;
|
|
344
|
+
padding-inline-start: 1.25rem;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.profile-schema-form :deep([data-part='description']),
|
|
348
|
+
.profile-schema-form :deep([data-part='error']) {
|
|
349
|
+
overflow-wrap: anywhere;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.profile-schema-form__actions {
|
|
353
|
+
display: grid;
|
|
354
|
+
gap: var(--ghost-space-gap-sm) var(--ghost-space-gap-md);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.profile-schema-form :deep(.profile-schema-form__action) {
|
|
358
|
+
inline-size: 100%;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
@container ghost-demo (min-width: 30rem) {
|
|
362
|
+
.profile-schema-form__actions {
|
|
363
|
+
align-items: center;
|
|
364
|
+
display: flex;
|
|
365
|
+
justify-content: flex-end;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.profile-schema-form__status {
|
|
369
|
+
flex: 1 1 auto;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.profile-schema-form :deep(.profile-schema-form__action) {
|
|
373
|
+
inline-size: auto;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
</style>
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref } from 'vue'
|
|
2
|
+
import { nextTick, ref, useTemplateRef } from 'vue'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
GhostButton,
|
|
6
|
+
GhostCard,
|
|
7
|
+
GhostInlineAlert,
|
|
8
|
+
type GhostButtonExposed,
|
|
9
|
+
} from '@ghostvue/themes'
|
|
5
10
|
|
|
6
11
|
const showQuotaNotice = ref(true)
|
|
7
12
|
const status = ref('')
|
|
@@ -10,14 +15,23 @@ function retryCharge(): void {
|
|
|
10
15
|
status.value = 'Payment retry queued.'
|
|
11
16
|
}
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
const dismissButton = useTemplateRef<GhostButtonExposed>('dismissButton')
|
|
19
|
+
const restoreButton = useTemplateRef<GhostButtonExposed>('restoreButton')
|
|
20
|
+
|
|
21
|
+
// Dismiss and Restore each unmount the button that was pressed. Move focus to
|
|
22
|
+
// the control that replaces it so keyboard users are not dropped on the page.
|
|
23
|
+
async function dismissQuota(): Promise<void> {
|
|
14
24
|
showQuotaNotice.value = false
|
|
15
25
|
status.value = 'Usage notice dismissed.'
|
|
26
|
+
await nextTick()
|
|
27
|
+
restoreButton.value?.focus()
|
|
16
28
|
}
|
|
17
29
|
|
|
18
|
-
function restoreNotices(): void {
|
|
30
|
+
async function restoreNotices(): Promise<void> {
|
|
19
31
|
showQuotaNotice.value = true
|
|
20
32
|
status.value = 'Notices restored.'
|
|
33
|
+
await nextTick()
|
|
34
|
+
dismissButton.value?.focus()
|
|
21
35
|
}
|
|
22
36
|
</script>
|
|
23
37
|
|
|
@@ -36,7 +50,12 @@ function restoreNotices(): void {
|
|
|
36
50
|
</template>
|
|
37
51
|
|
|
38
52
|
<div class="notices__stack">
|
|
39
|
-
|
|
53
|
+
<!--
|
|
54
|
+
These notices are present on first paint, so they keep the default
|
|
55
|
+
announce="off" and are read in document order. The footer status
|
|
56
|
+
line announces what the actions did.
|
|
57
|
+
-->
|
|
58
|
+
<GhostInlineAlert variant="solid" tone="danger">
|
|
40
59
|
<template #title>Payment method declined</template>
|
|
41
60
|
<template #message>
|
|
42
61
|
The card ending in 4242 failed authorization. Update billing details
|
|
@@ -68,6 +87,7 @@ function restoreNotices(): void {
|
|
|
68
87
|
</template>
|
|
69
88
|
<template #actions>
|
|
70
89
|
<GhostButton
|
|
90
|
+
ref="dismissButton"
|
|
71
91
|
size="sm"
|
|
72
92
|
variant="ghost"
|
|
73
93
|
tone="neutral"
|
|
@@ -84,6 +104,7 @@ function restoreNotices(): void {
|
|
|
84
104
|
<p class="notices__status" role="status">{{ status }}</p>
|
|
85
105
|
<GhostButton
|
|
86
106
|
v-if="!showQuotaNotice"
|
|
107
|
+
ref="restoreButton"
|
|
87
108
|
size="sm"
|
|
88
109
|
variant="ghost"
|
|
89
110
|
tone="neutral"
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, reactive, ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
GhostBadge,
|
|
6
|
+
GhostButton,
|
|
7
|
+
GhostCard,
|
|
8
|
+
GhostInlineAlert,
|
|
9
|
+
type GhostInlineAlertTone,
|
|
10
|
+
} from '@ghostvue/themes'
|
|
11
|
+
|
|
12
|
+
type FeedId = 'buoy' | 'wind' | 'tide'
|
|
13
|
+
|
|
14
|
+
interface Feed {
|
|
15
|
+
name: string
|
|
16
|
+
reading: string
|
|
17
|
+
/** Minutes since the reading was measured. */
|
|
18
|
+
age: number
|
|
19
|
+
available: boolean
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type Phase = 'checking' | 'partial' | 'retrying' | 'current'
|
|
23
|
+
|
|
24
|
+
interface PhaseCopy {
|
|
25
|
+
tone: GhostInlineAlertTone
|
|
26
|
+
title: string
|
|
27
|
+
message: string
|
|
28
|
+
action: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const feeds = reactive<Record<FeedId, Feed>>({
|
|
32
|
+
buoy: {
|
|
33
|
+
name: 'Harbor buoy',
|
|
34
|
+
reading: '1.2 m swell',
|
|
35
|
+
age: 18,
|
|
36
|
+
available: true,
|
|
37
|
+
},
|
|
38
|
+
wind: { name: 'Pier wind', reading: '14 kn SW', age: 9, available: true },
|
|
39
|
+
tide: {
|
|
40
|
+
name: 'Tide gauge',
|
|
41
|
+
reading: '2.1 m rising',
|
|
42
|
+
age: 9,
|
|
43
|
+
available: true,
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const phase = ref<Phase>('checking')
|
|
48
|
+
|
|
49
|
+
const copy: Record<Phase, PhaseCopy> = {
|
|
50
|
+
checking: {
|
|
51
|
+
tone: 'neutral',
|
|
52
|
+
title: 'Checking 3 feeds…',
|
|
53
|
+
message: 'Saved readings stay on screen until each feed responds.',
|
|
54
|
+
action: 'Receive responses',
|
|
55
|
+
},
|
|
56
|
+
partial: {
|
|
57
|
+
tone: 'danger',
|
|
58
|
+
title: 'Harbor buoy is unavailable',
|
|
59
|
+
message:
|
|
60
|
+
'Showing its saved reading. Pier wind and tide gauge are up to date.',
|
|
61
|
+
action: 'Retry harbor buoy',
|
|
62
|
+
},
|
|
63
|
+
retrying: {
|
|
64
|
+
tone: 'neutral',
|
|
65
|
+
title: 'Retrying harbor buoy…',
|
|
66
|
+
message: 'Its saved reading stays on screen until the feed responds.',
|
|
67
|
+
action: 'Receive response',
|
|
68
|
+
},
|
|
69
|
+
current: {
|
|
70
|
+
tone: 'accent',
|
|
71
|
+
title: 'All 3 feeds are up to date',
|
|
72
|
+
message: 'Readings refresh every 10 minutes.',
|
|
73
|
+
action: 'Refresh feeds',
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const current = computed(() => copy[phase.value])
|
|
78
|
+
|
|
79
|
+
function ageText(feed: Feed): string {
|
|
80
|
+
const prefix = feed.available ? 'Updated' : 'Saved'
|
|
81
|
+
return feed.age === 0
|
|
82
|
+
? `${prefix} just now`
|
|
83
|
+
: `${prefix} ${String(feed.age)} min ago`
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Stand-ins for feed responses, so each phase can be inspected. Readings and
|
|
87
|
+
// their ages change outside the alert, so they are not announced.
|
|
88
|
+
function nextStep(): void {
|
|
89
|
+
switch (phase.value) {
|
|
90
|
+
case 'checking':
|
|
91
|
+
feeds.wind = { ...feeds.wind, reading: '16 kn SW', age: 0 }
|
|
92
|
+
feeds.tide = { ...feeds.tide, reading: '2.3 m rising', age: 0 }
|
|
93
|
+
feeds.buoy.available = false
|
|
94
|
+
phase.value = 'partial'
|
|
95
|
+
break
|
|
96
|
+
case 'partial':
|
|
97
|
+
phase.value = 'retrying'
|
|
98
|
+
break
|
|
99
|
+
case 'retrying':
|
|
100
|
+
feeds.buoy = { ...feeds.buoy, reading: '1.4 m swell', age: 0 }
|
|
101
|
+
feeds.buoy.available = true
|
|
102
|
+
phase.value = 'current'
|
|
103
|
+
break
|
|
104
|
+
case 'current':
|
|
105
|
+
for (const feed of Object.values(feeds)) feed.age += 10
|
|
106
|
+
phase.value = 'checking'
|
|
107
|
+
break
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<template>
|
|
113
|
+
<section class="feed-status" aria-labelledby="feed-status-title">
|
|
114
|
+
<GhostCard>
|
|
115
|
+
<template #header>
|
|
116
|
+
<h2 id="feed-status-title" class="feed-status__title">
|
|
117
|
+
Coastal conditions
|
|
118
|
+
</h2>
|
|
119
|
+
</template>
|
|
120
|
+
|
|
121
|
+
<div class="feed-status__body">
|
|
122
|
+
<!--
|
|
123
|
+
One alert stays mounted for the whole refresh, so its role="status"
|
|
124
|
+
region exists before the text changes and each change is announced
|
|
125
|
+
politely. Remounting it per phase could drop announcements.
|
|
126
|
+
-->
|
|
127
|
+
<GhostInlineAlert
|
|
128
|
+
announce="status"
|
|
129
|
+
variant="soft"
|
|
130
|
+
:tone="current.tone"
|
|
131
|
+
:heading-level="3"
|
|
132
|
+
>
|
|
133
|
+
<template #title>{{ current.title }}</template>
|
|
134
|
+
<template #message>{{ current.message }}</template>
|
|
135
|
+
</GhostInlineAlert>
|
|
136
|
+
|
|
137
|
+
<ul class="feed-status__list">
|
|
138
|
+
<li v-for="feed in feeds" :key="feed.name" class="feed-status__item">
|
|
139
|
+
<span class="feed-status__name">{{ feed.name }}</span>
|
|
140
|
+
<span class="feed-status__reading">{{ feed.reading }}</span>
|
|
141
|
+
<span class="feed-status__age">
|
|
142
|
+
{{ ageText(feed) }}
|
|
143
|
+
<GhostBadge
|
|
144
|
+
v-if="!feed.available"
|
|
145
|
+
size="sm"
|
|
146
|
+
tone="danger"
|
|
147
|
+
variant="soft"
|
|
148
|
+
>
|
|
149
|
+
Offline
|
|
150
|
+
</GhostBadge>
|
|
151
|
+
</span>
|
|
152
|
+
</li>
|
|
153
|
+
</ul>
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
<template #footer>
|
|
157
|
+
<GhostButton
|
|
158
|
+
size="sm"
|
|
159
|
+
variant="outline"
|
|
160
|
+
tone="neutral"
|
|
161
|
+
@click="nextStep"
|
|
162
|
+
>
|
|
163
|
+
{{ current.action }}
|
|
164
|
+
</GhostButton>
|
|
165
|
+
</template>
|
|
166
|
+
</GhostCard>
|
|
167
|
+
</section>
|
|
168
|
+
</template>
|
|
169
|
+
|
|
170
|
+
<style scoped>
|
|
171
|
+
.feed-status {
|
|
172
|
+
max-inline-size: 36rem;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.feed-status__title {
|
|
176
|
+
color: var(--ghost-text-default);
|
|
177
|
+
font-size: var(--ghost-type-size-lg);
|
|
178
|
+
font-weight: var(--ghost-type-weight-semibold);
|
|
179
|
+
line-height: var(--ghost-type-line-tight);
|
|
180
|
+
margin: 0;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.feed-status__body {
|
|
184
|
+
display: grid;
|
|
185
|
+
gap: var(--ghost-space-stack-md);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.feed-status__list {
|
|
189
|
+
display: grid;
|
|
190
|
+
gap: var(--ghost-space-gap-sm);
|
|
191
|
+
list-style: none;
|
|
192
|
+
margin: 0;
|
|
193
|
+
padding: 0;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.feed-status__item {
|
|
197
|
+
align-items: baseline;
|
|
198
|
+
column-gap: var(--ghost-space-gap-sm);
|
|
199
|
+
display: grid;
|
|
200
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
201
|
+
row-gap: var(--ghost-space-gap-2xs);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.feed-status__name {
|
|
205
|
+
color: var(--ghost-text-default);
|
|
206
|
+
font-size: var(--ghost-type-size-sm);
|
|
207
|
+
font-weight: var(--ghost-type-weight-medium);
|
|
208
|
+
line-height: var(--ghost-type-line-snug);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.feed-status__reading {
|
|
212
|
+
color: var(--ghost-text-default);
|
|
213
|
+
font-size: var(--ghost-type-size-sm);
|
|
214
|
+
font-variant-numeric: tabular-nums;
|
|
215
|
+
line-height: var(--ghost-type-line-snug);
|
|
216
|
+
text-align: end;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.feed-status__age {
|
|
220
|
+
align-items: center;
|
|
221
|
+
color: var(--ghost-text-muted);
|
|
222
|
+
display: flex;
|
|
223
|
+
flex-wrap: wrap;
|
|
224
|
+
font-size: var(--ghost-type-size-xs);
|
|
225
|
+
gap: var(--ghost-space-gap-xs);
|
|
226
|
+
grid-column: 1 / -1;
|
|
227
|
+
line-height: var(--ghost-type-line-normal);
|
|
228
|
+
}
|
|
229
|
+
</style>
|