@ghostvue/mcp 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/bundle.json +2 -2
- package/dist/assets/component-exports.json +1 -0
- package/dist/assets/docs/pages.json +1 -1
- package/dist/assets/examples/catalog.json +1 -1
- package/dist/assets/examples/sources/accordion/billing-faq.vue +123 -0
- package/dist/assets/examples/sources/avatar/team-roster.vue +69 -5
- package/dist/assets/examples/sources/badge/release-channels.vue +1 -1
- package/dist/assets/examples/sources/breadcrumb/basic.vue +60 -15
- package/dist/assets/examples/sources/button/refresh-status.vue +95 -0
- package/dist/assets/examples/sources/calendar/availability.vue +235 -0
- package/dist/assets/examples/sources/calendar/office-locale.vue +197 -0
- package/dist/assets/examples/sources/card/project-summary.vue +38 -3
- package/dist/assets/examples/sources/checkbox-group/basic.vue +56 -0
- package/dist/assets/examples/sources/checkbox-group/field.vue +73 -0
- package/dist/assets/examples/sources/checkbox-group/form.vue +100 -0
- package/dist/assets/examples/sources/checkbox-group/headless.vue +68 -0
- package/dist/assets/examples/sources/checkbox-group/notification-preferences.vue +380 -0
- package/dist/assets/examples/sources/collapsible/shipment-history.vue +135 -0
- package/dist/assets/examples/sources/combobox/review-request-form.vue +415 -0
- package/dist/assets/examples/sources/command-palette/async.vue +60 -12
- package/dist/assets/examples/sources/command-palette/basic.vue +123 -2
- package/dist/assets/examples/sources/command-palette/shortcut.vue +132 -5
- package/dist/assets/examples/sources/command-palette/themed.vue +44 -4
- package/dist/assets/examples/sources/command-palette/virtualized.vue +124 -3
- package/dist/assets/examples/sources/context-menu/themed.vue +81 -26
- package/dist/assets/examples/sources/data-table/themed-invoices.vue +219 -44
- package/dist/assets/examples/sources/date-picker/controlled.vue +8 -293
- package/dist/assets/examples/sources/date-picker/custom-format.vue +6 -295
- package/dist/assets/examples/sources/date-picker/nested-dialog.vue +28 -350
- package/dist/assets/examples/sources/date-picker/rtl.vue +5 -294
- package/dist/assets/examples/sources/date-picker/themed.vue +2 -2
- package/dist/assets/examples/sources/date-picker/validation.vue +8 -294
- package/dist/assets/examples/sources/dropdown-menu/nested-export.vue +56 -0
- package/dist/assets/examples/sources/empty-state/search-results.vue +26 -1
- package/dist/assets/examples/sources/field/billing-address-headless.vue +93 -0
- package/dist/assets/examples/sources/field/billing-address.vue +192 -0
- package/dist/assets/examples/sources/field/checkbox.vue +10 -2
- package/dist/assets/examples/sources/field/themed.vue +12 -11
- package/dist/assets/examples/sources/file-upload/asset-submission.vue +96 -36
- package/dist/assets/examples/sources/form/async-validation.vue +180 -0
- package/dist/assets/examples/sources/form/composable.vue +146 -0
- package/dist/assets/examples/sources/form/nested-webhooks.vue +233 -0
- package/dist/assets/examples/sources/form/profile-schema.vue +376 -0
- package/dist/assets/examples/sources/inline-alert/billing-notices.vue +26 -5
- package/dist/assets/examples/sources/inline-alert/feed-status.vue +229 -0
- package/dist/assets/examples/sources/input/clearable-search-headless.vue +162 -0
- package/dist/assets/examples/sources/input/clearable-search.vue +225 -0
- package/dist/assets/examples/sources/input/unit-suffix.vue +109 -0
- package/dist/assets/examples/sources/interactive-surface/basic.vue +20 -8
- package/dist/assets/examples/sources/interactive-surface/feature-tiles.vue +42 -8
- package/dist/assets/examples/sources/kbd/command-shortcuts.vue +0 -1
- package/dist/assets/examples/sources/link/documentation-footer.vue +11 -4
- package/dist/assets/examples/sources/link/router.vue +9 -5
- package/dist/assets/examples/sources/menubar/themed.vue +46 -10
- package/dist/assets/examples/sources/number-input/order-limits.vue +5 -0
- package/dist/assets/examples/sources/number-input/themed.vue +12 -6
- package/dist/assets/examples/sources/number-input/workshop-booking.vue +207 -0
- package/dist/assets/examples/sources/pagination/controlled.vue +83 -18
- package/dist/assets/examples/sources/pagination/ellipsis.vue +44 -14
- package/dist/assets/examples/sources/pagination/themed.vue +161 -21
- package/dist/assets/examples/sources/presence/basic.vue +81 -0
- package/dist/assets/examples/sources/presence/portal.vue +92 -0
- package/dist/assets/examples/sources/progress/report-export.vue +160 -0
- package/dist/assets/examples/sources/scroll-area/activity-feed.vue +0 -1
- package/dist/assets/examples/sources/scroll-area/horizontal.vue +169 -14
- package/dist/assets/examples/sources/scroll-area/themed.vue +42 -3
- package/dist/assets/examples/sources/scroll-spy/themed.vue +180 -31
- package/dist/assets/examples/sources/select/alert-routing-form.vue +356 -0
- package/dist/assets/examples/sources/select/multiple-form.vue +201 -0
- package/dist/assets/examples/sources/select/multiple-labels.vue +142 -0
- package/dist/assets/examples/sources/skeleton/profile-loading.vue +28 -4
- package/dist/assets/examples/sources/slider/audio-mixer.vue +8 -2
- package/dist/assets/examples/sources/slider/price-filter.vue +162 -0
- package/dist/assets/examples/sources/slider/vertical.vue +3 -2
- package/dist/assets/examples/sources/spinner/sync-status.vue +13 -10
- package/dist/assets/examples/sources/switch/form.vue +43 -11
- package/dist/assets/examples/sources/table/contain-horizontal.vue +24 -12
- package/dist/assets/examples/sources/table/row-headers.vue +118 -19
- package/dist/assets/examples/sources/tabs/review-sections.vue +43 -0
- package/dist/assets/examples/sources/tags-input/headless-field.vue +31 -0
- package/dist/assets/examples/sources/tags-input/project-labels.vue +64 -0
- package/dist/assets/examples/sources/tags-input/read-only.vue +12 -0
- package/dist/assets/examples/sources/toast/themed.vue +42 -19
- package/dist/assets/examples/sources/toolbar/themed.vue +22 -4
- package/dist/assets/examples/sources/tooltip/themed.vue +12 -1
- package/dist/assets/examples/sources/tree/themed.vue +70 -17
- package/dist/assets/manifests/themes/ghost-accordion.manifest.json +1 -0
- package/dist/assets/manifests/themes/ghost-button.manifest.json +1 -0
- package/dist/assets/manifests/themes/ghost-calendar.manifest.json +3 -1
- package/dist/assets/manifests/themes/ghost-checkbox-group.manifest.json +90 -0
- package/dist/assets/manifests/themes/ghost-collapsible.manifest.json +1 -0
- package/dist/assets/manifests/themes/ghost-combobox.manifest.json +1 -0
- package/dist/assets/manifests/themes/ghost-command-palette.manifest.json +2 -1
- package/dist/assets/manifests/themes/ghost-date-picker.manifest.json +5 -0
- package/dist/assets/manifests/themes/ghost-dropdown-menu.manifest.json +9 -0
- package/dist/assets/manifests/themes/ghost-field.manifest.json +10 -2
- package/dist/assets/manifests/themes/ghost-inline-alert.manifest.json +1 -0
- package/dist/assets/manifests/themes/ghost-input.manifest.json +3 -1
- package/dist/assets/manifests/themes/ghost-link.manifest.json +2 -1
- package/dist/assets/manifests/themes/ghost-number-input.manifest.json +1 -0
- package/dist/assets/manifests/themes/ghost-pagination.manifest.json +6 -2
- package/dist/assets/manifests/themes/ghost-progress.manifest.json +1 -0
- package/dist/assets/manifests/themes/ghost-radio-group-item.manifest.json +63 -0
- package/dist/assets/manifests/themes/ghost-scroll-area.manifest.json +12 -2
- package/dist/assets/manifests/themes/ghost-select.manifest.json +3 -0
- package/dist/assets/manifests/themes/ghost-slider.manifest.json +1 -0
- package/dist/assets/manifests/themes/ghost-table.manifest.json +2 -1
- package/dist/assets/manifests/themes/ghost-tags-input.manifest.json +255 -0
- package/dist/assets/manifests/vue/ghost-checkbox-group.manifest.json +173 -0
- package/dist/assets/manifests/vue/ghost-command-palette-content.manifest.json +6 -2
- package/dist/assets/manifests/vue/ghost-command-palette-overlay.manifest.json +6 -2
- package/dist/assets/manifests/vue/ghost-command-palette.manifest.json +0 -1
- package/dist/assets/manifests/vue/ghost-context-menu-content.manifest.json +3 -3
- package/dist/assets/manifests/vue/ghost-context-menu.manifest.json +1 -1
- package/dist/assets/manifests/vue/ghost-data-table-preset.manifest.json +1 -1
- package/dist/assets/manifests/vue/ghost-data-table-table.manifest.json +1 -1
- package/dist/assets/manifests/vue/ghost-data-table.manifest.json +99 -2
- package/dist/assets/manifests/vue/ghost-date-picker-content.manifest.json +12 -3
- package/dist/assets/manifests/vue/ghost-date-picker.manifest.json +1 -6
- package/dist/assets/manifests/vue/ghost-dialog-content.manifest.json +6 -2
- package/dist/assets/manifests/vue/ghost-dialog-overlay.manifest.json +6 -2
- package/dist/assets/manifests/vue/ghost-drawer-content.manifest.json +6 -2
- package/dist/assets/manifests/vue/ghost-drawer-overlay.manifest.json +6 -2
- package/dist/assets/manifests/vue/ghost-field-error.manifest.json +12 -1
- package/dist/assets/manifests/vue/ghost-field.manifest.json +35 -3
- package/dist/assets/manifests/vue/ghost-form.manifest.json +221 -0
- package/dist/assets/manifests/vue/ghost-hover-card-content.manifest.json +12 -3
- package/dist/assets/manifests/vue/ghost-input.manifest.json +2 -1
- package/dist/assets/manifests/vue/ghost-link.manifest.json +1 -2
- package/dist/assets/manifests/vue/ghost-menubar-content.manifest.json +3 -3
- package/dist/assets/manifests/vue/ghost-menubar.manifest.json +4 -4
- package/dist/assets/manifests/vue/ghost-pagination.manifest.json +0 -2
- package/dist/assets/manifests/vue/ghost-popover-content.manifest.json +6 -2
- package/dist/assets/manifests/vue/ghost-presence.manifest.json +96 -0
- package/dist/assets/manifests/vue/ghost-scroll-area.manifest.json +0 -1
- package/dist/assets/manifests/vue/ghost-select-content.manifest.json +6 -1
- package/dist/assets/manifests/vue/ghost-select-group.manifest.json +6 -1
- package/dist/assets/manifests/vue/ghost-select-label.manifest.json +6 -1
- package/dist/assets/manifests/vue/ghost-select-option.manifest.json +6 -1
- package/dist/assets/manifests/vue/ghost-select-trigger.manifest.json +6 -1
- package/dist/assets/manifests/vue/ghost-select-value.manifest.json +18 -2
- package/dist/assets/manifests/vue/ghost-select.manifest.json +18 -6
- package/dist/assets/manifests/vue/ghost-submenu-content.manifest.json +168 -0
- package/dist/assets/manifests/vue/ghost-submenu-trigger.manifest.json +102 -0
- package/dist/assets/manifests/vue/ghost-submenu.manifest.json +59 -0
- package/dist/assets/manifests/vue/ghost-table.manifest.json +0 -2
- package/dist/assets/manifests/vue/ghost-tabs.manifest.json +2 -1
- package/dist/assets/manifests/vue/ghost-tags-input.manifest.json +260 -0
- package/dist/assets/tokens.json +15 -0
- package/dist/components.d.ts +5 -0
- package/dist/components.js +80 -11
- package/package.json +1 -1
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { defineComponent, h } from 'vue'
|
|
3
3
|
|
|
4
|
-
import { GhostLink } from '@ghostvue/
|
|
4
|
+
import { GhostLink } from '@ghostvue/themes'
|
|
5
5
|
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Stand-in for RouterLink or NuxtLink, so this file runs without a router.
|
|
8
|
+
* In an app, pass the router's own link component to `as` instead.
|
|
9
|
+
*/
|
|
7
10
|
const AppRouterLink = defineComponent({
|
|
8
11
|
name: 'AppRouterLink',
|
|
9
12
|
props: {
|
|
@@ -16,7 +19,8 @@ const AppRouterLink = defineComponent({
|
|
|
16
19
|
</script>
|
|
17
20
|
|
|
18
21
|
<template>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
<!-- `to` falls through to the router component; the theme styles its anchor. -->
|
|
23
|
+
<GhostLink :as="AppRouterLink" to="/components/button">
|
|
24
|
+
In-app route
|
|
25
|
+
</GhostLink>
|
|
22
26
|
</template>
|
|
@@ -14,6 +14,9 @@ import {
|
|
|
14
14
|
GhostMenubarRadioItem,
|
|
15
15
|
GhostMenubarSeparator,
|
|
16
16
|
GhostMenubarTrigger,
|
|
17
|
+
GhostSubmenu,
|
|
18
|
+
GhostSubmenuContent,
|
|
19
|
+
GhostSubmenuTrigger,
|
|
17
20
|
} from '@ghostvue/themes'
|
|
18
21
|
|
|
19
22
|
type LayoutMode = 'comfortable' | 'compact'
|
|
@@ -21,6 +24,7 @@ type LayoutMode = 'comfortable' | 'compact'
|
|
|
21
24
|
const wordWrap = ref(true)
|
|
22
25
|
const lineNumbers = ref(true)
|
|
23
26
|
const layout = ref<LayoutMode>('comfortable')
|
|
27
|
+
const documentName = ref('release-notes.md')
|
|
24
28
|
const lastAction = ref('Ready')
|
|
25
29
|
|
|
26
30
|
const statusSummary = computed(() => {
|
|
@@ -36,6 +40,19 @@ function runAction(label: string): void {
|
|
|
36
40
|
lastAction.value = label
|
|
37
41
|
}
|
|
38
42
|
|
|
43
|
+
// File commands change the open document, so the result shows in the editor
|
|
44
|
+
// body as well as in the status line. Focus returns to the File trigger.
|
|
45
|
+
function newDraft(): void {
|
|
46
|
+
documentName.value = 'Untitled draft.md'
|
|
47
|
+
runAction('Created new draft')
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function duplicateDocument(): void {
|
|
51
|
+
const source = documentName.value
|
|
52
|
+
documentName.value = source.replace(/(\.md)?$/, ' copy.md')
|
|
53
|
+
runAction(`Duplicated ${source}`)
|
|
54
|
+
}
|
|
55
|
+
|
|
39
56
|
function setLayout(value: string): void {
|
|
40
57
|
if (value === 'comfortable' || value === 'compact') {
|
|
41
58
|
layout.value = value
|
|
@@ -53,20 +70,39 @@ function setLayout(value: string): void {
|
|
|
53
70
|
<GhostMenubarTrigger :as="GhostButton" variant="ghost" size="sm">
|
|
54
71
|
File
|
|
55
72
|
</GhostMenubarTrigger>
|
|
56
|
-
<GhostMenubarContent :offset="6">
|
|
57
|
-
<GhostMenubarItem @select="
|
|
73
|
+
<GhostMenubarContent aria-label="File" :offset="6">
|
|
74
|
+
<GhostMenubarItem @select="newDraft">
|
|
58
75
|
<span class="menubar__indicator" aria-hidden="true" />
|
|
59
76
|
New draft
|
|
60
77
|
</GhostMenubarItem>
|
|
61
|
-
<GhostMenubarItem @select="
|
|
78
|
+
<GhostMenubarItem @select="duplicateDocument">
|
|
62
79
|
<span class="menubar__indicator" aria-hidden="true" />
|
|
63
80
|
Duplicate
|
|
64
81
|
</GhostMenubarItem>
|
|
65
82
|
<GhostMenubarSeparator decorative />
|
|
66
|
-
<
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
83
|
+
<GhostSubmenu>
|
|
84
|
+
<GhostSubmenuTrigger>Export</GhostSubmenuTrigger>
|
|
85
|
+
<GhostSubmenuContent>
|
|
86
|
+
<GhostMenubarItem @select="runAction('Exported PDF')">
|
|
87
|
+
PDF
|
|
88
|
+
</GhostMenubarItem>
|
|
89
|
+
<GhostSubmenu>
|
|
90
|
+
<GhostSubmenuTrigger>Text formats</GhostSubmenuTrigger>
|
|
91
|
+
<GhostSubmenuContent portal>
|
|
92
|
+
<GhostMenubarItem
|
|
93
|
+
@select="runAction('Exported Markdown')"
|
|
94
|
+
>
|
|
95
|
+
Markdown
|
|
96
|
+
</GhostMenubarItem>
|
|
97
|
+
<GhostMenubarItem
|
|
98
|
+
@select="runAction('Exported plain text')"
|
|
99
|
+
>
|
|
100
|
+
Plain text
|
|
101
|
+
</GhostMenubarItem>
|
|
102
|
+
</GhostSubmenuContent>
|
|
103
|
+
</GhostSubmenu>
|
|
104
|
+
</GhostSubmenuContent>
|
|
105
|
+
</GhostSubmenu>
|
|
70
106
|
<GhostMenubarItem disabled>
|
|
71
107
|
<span class="menubar__indicator" aria-hidden="true" />
|
|
72
108
|
Publish (read-only)
|
|
@@ -78,7 +114,7 @@ function setLayout(value: string): void {
|
|
|
78
114
|
<GhostMenubarTrigger :as="GhostButton" variant="ghost" size="sm">
|
|
79
115
|
Edit
|
|
80
116
|
</GhostMenubarTrigger>
|
|
81
|
-
<GhostMenubarContent :offset="6">
|
|
117
|
+
<GhostMenubarContent aria-label="Edit" :offset="6">
|
|
82
118
|
<GhostMenubarItem @select="runAction('Undid last change')">
|
|
83
119
|
<span class="menubar__indicator" aria-hidden="true" />
|
|
84
120
|
Undo
|
|
@@ -99,7 +135,7 @@ function setLayout(value: string): void {
|
|
|
99
135
|
<GhostMenubarTrigger :as="GhostButton" variant="ghost" size="sm">
|
|
100
136
|
View
|
|
101
137
|
</GhostMenubarTrigger>
|
|
102
|
-
<GhostMenubarContent :offset="6">
|
|
138
|
+
<GhostMenubarContent aria-label="View" :offset="6">
|
|
103
139
|
<GhostMenubarLabel>Editor</GhostMenubarLabel>
|
|
104
140
|
<GhostMenubarCheckboxItem v-model:checked="wordWrap">
|
|
105
141
|
<span class="menubar__indicator" aria-hidden="true">
|
|
@@ -139,7 +175,7 @@ function setLayout(value: string): void {
|
|
|
139
175
|
</template>
|
|
140
176
|
|
|
141
177
|
<div class="editor-shell__body">
|
|
142
|
-
<span class="editor-shell__doc">
|
|
178
|
+
<span class="editor-shell__doc">{{ documentName }}</span>
|
|
143
179
|
<span class="editor-shell__hint">
|
|
144
180
|
Use ArrowLeft / ArrowRight across menus, ArrowDown to open.
|
|
145
181
|
</span>
|
|
@@ -187,6 +187,11 @@ function clearSaved(): void {
|
|
|
187
187
|
.limits-form__fields {
|
|
188
188
|
display: grid;
|
|
189
189
|
gap: var(--ghost-space-stack-lg);
|
|
190
|
+
/*
|
|
191
|
+
* The spinbutton's intrinsic width sets its min-content size, so an auto
|
|
192
|
+
* track would push the steppers past a phone-width card. Let it shrink.
|
|
193
|
+
*/
|
|
194
|
+
grid-template-columns: minmax(0, 1fr);
|
|
190
195
|
}
|
|
191
196
|
|
|
192
197
|
.limits-form :deep([data-part='description']),
|
|
@@ -3,18 +3,24 @@ import { ref } from 'vue'
|
|
|
3
3
|
|
|
4
4
|
import { GhostNumberInput } from '@ghostvue/themes'
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const retryDelay = ref(30)
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<template>
|
|
10
|
-
<label for="
|
|
10
|
+
<label for="retry-delay">Retry delay</label>
|
|
11
|
+
<!-- The unit format shows "30 seconds" in the field and in aria-valuetext. -->
|
|
11
12
|
<GhostNumberInput
|
|
12
|
-
id="
|
|
13
|
-
v-model="
|
|
13
|
+
id="retry-delay"
|
|
14
|
+
v-model="retryDelay"
|
|
14
15
|
:min="0"
|
|
15
|
-
:
|
|
16
|
+
:max="300"
|
|
17
|
+
:step="15"
|
|
18
|
+
locale="en-US"
|
|
19
|
+
:format-options="{ style: 'unit', unit: 'second', unitDisplay: 'long' }"
|
|
20
|
+
decrement-label="Shorten retry delay"
|
|
21
|
+
increment-label="Lengthen retry delay"
|
|
16
22
|
size="lg"
|
|
17
23
|
block
|
|
18
|
-
name="
|
|
24
|
+
name="retry-delay"
|
|
19
25
|
/>
|
|
20
26
|
</template>
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
GhostButton,
|
|
6
|
+
GhostCard,
|
|
7
|
+
GhostField,
|
|
8
|
+
GhostFieldControl,
|
|
9
|
+
GhostFieldDescription,
|
|
10
|
+
GhostFieldLabel,
|
|
11
|
+
GhostNumberInput,
|
|
12
|
+
} from '@ghostvue/themes'
|
|
13
|
+
|
|
14
|
+
const MAX_SEATS = 6
|
|
15
|
+
const MAX_MINUTES = 180
|
|
16
|
+
const RATE_PER_SEAT_HOUR = 30
|
|
17
|
+
|
|
18
|
+
const seats = ref<number | null>(2)
|
|
19
|
+
const minutes = ref<number | null>(90)
|
|
20
|
+
const reserved = ref('')
|
|
21
|
+
|
|
22
|
+
const price = computed(() =>
|
|
23
|
+
new Intl.NumberFormat('en-US', {
|
|
24
|
+
style: 'currency',
|
|
25
|
+
currency: 'USD',
|
|
26
|
+
maximumFractionDigits: 0,
|
|
27
|
+
}).format(
|
|
28
|
+
((seats.value ?? 0) * (minutes.value ?? 0) * RATE_PER_SEAT_HOUR) / 60,
|
|
29
|
+
),
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
// One polite message for whichever limit the reader reaches. The stepper
|
|
33
|
+
// button for that direction is disabled at the bound, so say why in words.
|
|
34
|
+
const limitMessage = computed(() => {
|
|
35
|
+
if (reserved.value) return reserved.value
|
|
36
|
+
const limits: string[] = []
|
|
37
|
+
if (seats.value === MAX_SEATS) {
|
|
38
|
+
limits.push(`a booking holds up to ${String(MAX_SEATS)} seats`)
|
|
39
|
+
}
|
|
40
|
+
if (minutes.value === MAX_MINUTES) limits.push('sessions run up to 3 hours')
|
|
41
|
+
return limits.length ? `Limit reached: ${limits.join(' and ')}.` : ''
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
function reserve(): void {
|
|
45
|
+
if (seats.value === null || minutes.value === null) return
|
|
46
|
+
reserved.value = `Reserved ${String(seats.value)} seats for ${String(minutes.value)} minutes.`
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<form
|
|
52
|
+
class="booking"
|
|
53
|
+
novalidate
|
|
54
|
+
@submit.prevent="reserve"
|
|
55
|
+
@input="reserved = ''"
|
|
56
|
+
>
|
|
57
|
+
<GhostCard as="section" aria-labelledby="booking-title">
|
|
58
|
+
<template #header>
|
|
59
|
+
<div class="booking__header">
|
|
60
|
+
<h2 id="booking-title" class="booking__title">
|
|
61
|
+
Book a design workshop
|
|
62
|
+
</h2>
|
|
63
|
+
<p class="booking__lead">
|
|
64
|
+
$30 per seat per hour. Seats and length stop at their limits.
|
|
65
|
+
</p>
|
|
66
|
+
</div>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<div class="booking__fields">
|
|
70
|
+
<GhostField required>
|
|
71
|
+
<GhostFieldLabel>Seats</GhostFieldLabel>
|
|
72
|
+
<GhostFieldDescription
|
|
73
|
+
>1 to 6 seats per booking.</GhostFieldDescription
|
|
74
|
+
>
|
|
75
|
+
<GhostFieldControl v-slot="field">
|
|
76
|
+
<GhostNumberInput
|
|
77
|
+
v-bind="field"
|
|
78
|
+
v-model="seats"
|
|
79
|
+
:min="1"
|
|
80
|
+
:max="MAX_SEATS"
|
|
81
|
+
name="seats"
|
|
82
|
+
decrement-label="Remove a seat"
|
|
83
|
+
increment-label="Add a seat"
|
|
84
|
+
block
|
|
85
|
+
@update:model-value="reserved = ''"
|
|
86
|
+
/>
|
|
87
|
+
</GhostFieldControl>
|
|
88
|
+
</GhostField>
|
|
89
|
+
|
|
90
|
+
<GhostField required>
|
|
91
|
+
<GhostFieldLabel>Session length</GhostFieldLabel>
|
|
92
|
+
<GhostFieldDescription>
|
|
93
|
+
30 minutes to 3 hours, in 30-minute steps.
|
|
94
|
+
</GhostFieldDescription>
|
|
95
|
+
<GhostFieldControl v-slot="field">
|
|
96
|
+
<!-- The unit format shows "90 minutes" in the field and in aria-valuetext. -->
|
|
97
|
+
<GhostNumberInput
|
|
98
|
+
v-bind="field"
|
|
99
|
+
v-model="minutes"
|
|
100
|
+
:min="30"
|
|
101
|
+
:max="MAX_MINUTES"
|
|
102
|
+
:step="30"
|
|
103
|
+
locale="en-US"
|
|
104
|
+
:format-options="{
|
|
105
|
+
style: 'unit',
|
|
106
|
+
unit: 'minute',
|
|
107
|
+
unitDisplay: 'long',
|
|
108
|
+
}"
|
|
109
|
+
name="minutes"
|
|
110
|
+
decrement-label="Shorten session"
|
|
111
|
+
increment-label="Lengthen session"
|
|
112
|
+
block
|
|
113
|
+
@update:model-value="reserved = ''"
|
|
114
|
+
/>
|
|
115
|
+
</GhostFieldControl>
|
|
116
|
+
</GhostField>
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
<template #footer>
|
|
120
|
+
<div class="booking__footer">
|
|
121
|
+
<p class="booking__total">
|
|
122
|
+
Total <strong class="booking__price">{{ price }}</strong>
|
|
123
|
+
</p>
|
|
124
|
+
<p class="booking__status" role="status">{{ limitMessage }}</p>
|
|
125
|
+
<GhostButton type="submit" class="booking__action">
|
|
126
|
+
Reserve seats
|
|
127
|
+
</GhostButton>
|
|
128
|
+
</div>
|
|
129
|
+
</template>
|
|
130
|
+
</GhostCard>
|
|
131
|
+
</form>
|
|
132
|
+
</template>
|
|
133
|
+
|
|
134
|
+
<style scoped>
|
|
135
|
+
.booking {
|
|
136
|
+
max-inline-size: 32rem;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.booking__header {
|
|
140
|
+
display: grid;
|
|
141
|
+
gap: var(--ghost-space-gap-xs);
|
|
142
|
+
padding-block-end: var(--ghost-space-stack-sm);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.booking__title {
|
|
146
|
+
color: var(--ghost-text-default);
|
|
147
|
+
font-size: var(--ghost-type-size-lg);
|
|
148
|
+
font-weight: var(--ghost-type-weight-semibold);
|
|
149
|
+
line-height: var(--ghost-type-line-tight);
|
|
150
|
+
margin: 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.booking__lead,
|
|
154
|
+
.booking__status {
|
|
155
|
+
color: var(--ghost-text-muted);
|
|
156
|
+
font-size: var(--ghost-type-size-sm);
|
|
157
|
+
line-height: var(--ghost-type-line-snug);
|
|
158
|
+
margin: 0;
|
|
159
|
+
overflow-wrap: anywhere;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.booking__fields {
|
|
163
|
+
display: grid;
|
|
164
|
+
gap: var(--ghost-space-stack-lg);
|
|
165
|
+
/*
|
|
166
|
+
* The spinbutton's intrinsic width sets its min-content size, so an auto
|
|
167
|
+
* track would push the steppers past a phone-width card. Let it shrink.
|
|
168
|
+
*/
|
|
169
|
+
grid-template-columns: minmax(0, 1fr);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.booking :deep([data-part='description']) {
|
|
173
|
+
overflow-wrap: anywhere;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.booking__footer {
|
|
177
|
+
display: grid;
|
|
178
|
+
gap: var(--ghost-space-gap-sm) var(--ghost-space-gap-md);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.booking__total {
|
|
182
|
+
color: var(--ghost-text-default);
|
|
183
|
+
font-size: var(--ghost-type-size-sm);
|
|
184
|
+
line-height: var(--ghost-type-line-snug);
|
|
185
|
+
margin: 0;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.booking__price {
|
|
189
|
+
font-variant-numeric: tabular-nums;
|
|
190
|
+
font-weight: var(--ghost-type-weight-semibold);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.booking :deep(.booking__action) {
|
|
194
|
+
inline-size: 100%;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
@container ghost-demo (min-width: 30rem) {
|
|
198
|
+
.booking__footer {
|
|
199
|
+
align-items: center;
|
|
200
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.booking :deep(.booking__action) {
|
|
204
|
+
inline-size: auto;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
</style>
|
|
@@ -1,31 +1,96 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref } from 'vue'
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
GhostCard,
|
|
6
|
+
GhostPagination,
|
|
7
|
+
GhostSegmentedControl,
|
|
8
|
+
GhostSegmentedControlItem,
|
|
9
|
+
} from '@ghostvue/themes'
|
|
5
10
|
|
|
6
|
-
const
|
|
7
|
-
|
|
11
|
+
const pageSizes = ['10', '25', '50'] as const
|
|
12
|
+
type PageSize = (typeof pageSizes)[number]
|
|
13
|
+
|
|
14
|
+
function isPageSize(value: unknown): value is PageSize {
|
|
15
|
+
return pageSizes.some((size) => size === value)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const totalEvents = 120
|
|
19
|
+
const pageSize = ref<PageSize>('25')
|
|
20
|
+
const page = ref(2)
|
|
21
|
+
|
|
22
|
+
// The parent owns both numbers: the page count follows the chosen size.
|
|
23
|
+
const pageCount = computed(() =>
|
|
24
|
+
Math.max(1, Math.ceil(totalEvents / Number(pageSize.value))),
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
const rangeLabel = computed(() => {
|
|
28
|
+
const size = Number(pageSize.value)
|
|
29
|
+
const start = (page.value - 1) * size + 1
|
|
30
|
+
const end = Math.min(page.value * size, totalEvents)
|
|
31
|
+
return `Events ${String(start)}–${String(end)} of ${String(totalEvents)} · page ${String(page.value)} of ${String(pageCount.value)}`
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
/*
|
|
35
|
+
* Changing the page size changes pageCount. Keep the first event the user
|
|
36
|
+
* was looking at on screen by moving to the page that now contains it,
|
|
37
|
+
* which also keeps the page inside the new bounds.
|
|
38
|
+
*/
|
|
39
|
+
function setPageSize(next: unknown): void {
|
|
40
|
+
if (!isPageSize(next)) return
|
|
41
|
+
const firstEvent = (page.value - 1) * Number(pageSize.value)
|
|
42
|
+
pageSize.value = next
|
|
43
|
+
page.value = Math.floor(firstEvent / Number(next)) + 1
|
|
44
|
+
}
|
|
8
45
|
</script>
|
|
9
46
|
|
|
10
47
|
<template>
|
|
11
|
-
<
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
48
|
+
<GhostCard as="section" class="audit" aria-label="Audit log">
|
|
49
|
+
<div class="audit__controls">
|
|
50
|
+
<GhostSegmentedControl
|
|
51
|
+
:model-value="pageSize"
|
|
52
|
+
aria-label="Events per page"
|
|
53
|
+
@update:model-value="setPageSize"
|
|
54
|
+
>
|
|
55
|
+
<GhostSegmentedControlItem
|
|
56
|
+
v-for="size in pageSizes"
|
|
57
|
+
:key="size"
|
|
58
|
+
:value="size"
|
|
59
|
+
>
|
|
60
|
+
{{ size }}
|
|
61
|
+
</GhostSegmentedControlItem>
|
|
62
|
+
</GhostSegmentedControl>
|
|
63
|
+
<!-- Controlled: the parent passes the page and applies each update. -->
|
|
64
|
+
<GhostPagination
|
|
65
|
+
:model-value="page"
|
|
66
|
+
:page-count="pageCount"
|
|
67
|
+
size="sm"
|
|
68
|
+
aria-label="Audit log pages"
|
|
69
|
+
@update:model-value="page = $event"
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
<p class="audit__status" role="status">{{ rangeLabel }}</p>
|
|
73
|
+
</GhostCard>
|
|
20
74
|
</template>
|
|
21
75
|
|
|
22
76
|
<style scoped>
|
|
23
|
-
.
|
|
24
|
-
|
|
25
|
-
|
|
77
|
+
.audit {
|
|
78
|
+
inline-size: 100%;
|
|
79
|
+
max-inline-size: 40rem;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.audit__controls {
|
|
83
|
+
align-items: center;
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-wrap: wrap;
|
|
86
|
+
gap: var(--ghost-space-gap-sm) var(--ghost-space-gap-md);
|
|
87
|
+
justify-content: space-between;
|
|
26
88
|
}
|
|
27
89
|
|
|
28
|
-
.
|
|
29
|
-
|
|
90
|
+
.audit__status {
|
|
91
|
+
color: var(--ghost-text-muted);
|
|
92
|
+
font-size: var(--ghost-type-size-sm);
|
|
93
|
+
font-variant-numeric: var(--ghost-type-numeric-tabular);
|
|
94
|
+
margin: var(--ghost-space-stack-sm) 0 0;
|
|
30
95
|
}
|
|
31
96
|
</style>
|
|
@@ -1,29 +1,59 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref } from 'vue'
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
3
|
|
|
4
|
-
import { GhostPagination } from '@ghostvue/
|
|
4
|
+
import { GhostCard, GhostPagination } from '@ghostvue/themes'
|
|
5
5
|
|
|
6
|
+
const pageSize = 24
|
|
7
|
+
const totalProducts = 960
|
|
8
|
+
const pageCount = totalProducts / pageSize
|
|
6
9
|
const page = ref(15)
|
|
10
|
+
|
|
11
|
+
const rangeLabel = computed(() => {
|
|
12
|
+
const start = (page.value - 1) * pageSize + 1
|
|
13
|
+
const end = Math.min(page.value * pageSize, totalProducts)
|
|
14
|
+
return `Products ${String(start)}–${String(end)} of ${String(totalProducts)}`
|
|
15
|
+
})
|
|
7
16
|
</script>
|
|
8
17
|
|
|
9
18
|
<template>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class="
|
|
17
|
-
|
|
19
|
+
<!--
|
|
20
|
+
Forty pages would not fit on one line. With siblingCount and
|
|
21
|
+
boundaryCount at 1 the pager keeps the first and last page, one page on
|
|
22
|
+
each side of the current one, and an ellipsis for each hidden run.
|
|
23
|
+
-->
|
|
24
|
+
<GhostCard as="section" class="catalog" aria-label="Product catalog">
|
|
25
|
+
<div class="catalog__row">
|
|
26
|
+
<p class="catalog__status" role="status">{{ rangeLabel }}</p>
|
|
27
|
+
<GhostPagination
|
|
28
|
+
v-model="page"
|
|
29
|
+
:page-count="pageCount"
|
|
30
|
+
:sibling-count="1"
|
|
31
|
+
:boundary-count="1"
|
|
32
|
+
size="sm"
|
|
33
|
+
aria-label="Catalog pages"
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
</GhostCard>
|
|
18
37
|
</template>
|
|
19
38
|
|
|
20
39
|
<style scoped>
|
|
21
|
-
.
|
|
40
|
+
.catalog {
|
|
41
|
+
inline-size: 100%;
|
|
42
|
+
max-inline-size: 40rem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.catalog__row {
|
|
46
|
+
align-items: center;
|
|
22
47
|
display: flex;
|
|
23
48
|
flex-wrap: wrap;
|
|
24
|
-
gap:
|
|
25
|
-
|
|
49
|
+
gap: var(--ghost-space-gap-sm) var(--ghost-space-gap-md);
|
|
50
|
+
justify-content: space-between;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.catalog__status {
|
|
54
|
+
color: var(--ghost-text-muted);
|
|
55
|
+
font-size: var(--ghost-type-size-sm);
|
|
56
|
+
font-variant-numeric: var(--ghost-type-numeric-tabular);
|
|
26
57
|
margin: 0;
|
|
27
|
-
padding: 0;
|
|
28
58
|
}
|
|
29
59
|
</style>
|