@ghostvue/mcp 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/dist/assets/bundle.json +2 -2
  2. package/dist/assets/component-exports.json +1 -0
  3. package/dist/assets/docs/pages.json +1 -1
  4. package/dist/assets/examples/catalog.json +1 -1
  5. package/dist/assets/examples/sources/accordion/billing-faq.vue +123 -0
  6. package/dist/assets/examples/sources/avatar/team-roster.vue +69 -5
  7. package/dist/assets/examples/sources/badge/release-channels.vue +1 -1
  8. package/dist/assets/examples/sources/breadcrumb/basic.vue +60 -15
  9. package/dist/assets/examples/sources/button/refresh-status.vue +95 -0
  10. package/dist/assets/examples/sources/calendar/availability.vue +235 -0
  11. package/dist/assets/examples/sources/calendar/office-locale.vue +197 -0
  12. package/dist/assets/examples/sources/card/project-summary.vue +38 -3
  13. package/dist/assets/examples/sources/checkbox-group/basic.vue +56 -0
  14. package/dist/assets/examples/sources/checkbox-group/field.vue +73 -0
  15. package/dist/assets/examples/sources/checkbox-group/form.vue +100 -0
  16. package/dist/assets/examples/sources/checkbox-group/headless.vue +68 -0
  17. package/dist/assets/examples/sources/checkbox-group/notification-preferences.vue +380 -0
  18. package/dist/assets/examples/sources/collapsible/shipment-history.vue +135 -0
  19. package/dist/assets/examples/sources/combobox/review-request-form.vue +415 -0
  20. package/dist/assets/examples/sources/command-palette/async.vue +60 -12
  21. package/dist/assets/examples/sources/command-palette/basic.vue +123 -2
  22. package/dist/assets/examples/sources/command-palette/shortcut.vue +132 -5
  23. package/dist/assets/examples/sources/command-palette/themed.vue +44 -4
  24. package/dist/assets/examples/sources/command-palette/virtualized.vue +124 -3
  25. package/dist/assets/examples/sources/context-menu/themed.vue +81 -26
  26. package/dist/assets/examples/sources/data-table/themed-invoices.vue +219 -44
  27. package/dist/assets/examples/sources/date-picker/controlled.vue +8 -293
  28. package/dist/assets/examples/sources/date-picker/custom-format.vue +6 -295
  29. package/dist/assets/examples/sources/date-picker/nested-dialog.vue +28 -350
  30. package/dist/assets/examples/sources/date-picker/rtl.vue +5 -294
  31. package/dist/assets/examples/sources/date-picker/themed.vue +2 -2
  32. package/dist/assets/examples/sources/date-picker/validation.vue +8 -294
  33. package/dist/assets/examples/sources/dropdown-menu/nested-export.vue +56 -0
  34. package/dist/assets/examples/sources/empty-state/search-results.vue +26 -1
  35. package/dist/assets/examples/sources/field/billing-address-headless.vue +93 -0
  36. package/dist/assets/examples/sources/field/billing-address.vue +192 -0
  37. package/dist/assets/examples/sources/field/checkbox.vue +10 -2
  38. package/dist/assets/examples/sources/field/themed.vue +12 -11
  39. package/dist/assets/examples/sources/file-upload/asset-submission.vue +96 -36
  40. package/dist/assets/examples/sources/form/async-validation.vue +180 -0
  41. package/dist/assets/examples/sources/form/composable.vue +146 -0
  42. package/dist/assets/examples/sources/form/nested-webhooks.vue +233 -0
  43. package/dist/assets/examples/sources/form/profile-schema.vue +376 -0
  44. package/dist/assets/examples/sources/inline-alert/billing-notices.vue +26 -5
  45. package/dist/assets/examples/sources/inline-alert/feed-status.vue +229 -0
  46. package/dist/assets/examples/sources/input/clearable-search-headless.vue +162 -0
  47. package/dist/assets/examples/sources/input/clearable-search.vue +225 -0
  48. package/dist/assets/examples/sources/input/unit-suffix.vue +109 -0
  49. package/dist/assets/examples/sources/interactive-surface/basic.vue +20 -8
  50. package/dist/assets/examples/sources/interactive-surface/feature-tiles.vue +42 -8
  51. package/dist/assets/examples/sources/kbd/command-shortcuts.vue +0 -1
  52. package/dist/assets/examples/sources/link/documentation-footer.vue +11 -4
  53. package/dist/assets/examples/sources/link/router.vue +9 -5
  54. package/dist/assets/examples/sources/menubar/themed.vue +46 -10
  55. package/dist/assets/examples/sources/number-input/order-limits.vue +5 -0
  56. package/dist/assets/examples/sources/number-input/themed.vue +12 -6
  57. package/dist/assets/examples/sources/number-input/workshop-booking.vue +207 -0
  58. package/dist/assets/examples/sources/pagination/controlled.vue +83 -18
  59. package/dist/assets/examples/sources/pagination/ellipsis.vue +44 -14
  60. package/dist/assets/examples/sources/pagination/themed.vue +161 -21
  61. package/dist/assets/examples/sources/presence/basic.vue +81 -0
  62. package/dist/assets/examples/sources/presence/portal.vue +92 -0
  63. package/dist/assets/examples/sources/progress/report-export.vue +160 -0
  64. package/dist/assets/examples/sources/scroll-area/activity-feed.vue +0 -1
  65. package/dist/assets/examples/sources/scroll-area/horizontal.vue +169 -14
  66. package/dist/assets/examples/sources/scroll-area/themed.vue +42 -3
  67. package/dist/assets/examples/sources/scroll-spy/themed.vue +180 -31
  68. package/dist/assets/examples/sources/select/alert-routing-form.vue +356 -0
  69. package/dist/assets/examples/sources/select/multiple-form.vue +201 -0
  70. package/dist/assets/examples/sources/select/multiple-labels.vue +142 -0
  71. package/dist/assets/examples/sources/skeleton/profile-loading.vue +28 -4
  72. package/dist/assets/examples/sources/slider/audio-mixer.vue +8 -2
  73. package/dist/assets/examples/sources/slider/price-filter.vue +162 -0
  74. package/dist/assets/examples/sources/slider/vertical.vue +3 -2
  75. package/dist/assets/examples/sources/spinner/sync-status.vue +13 -10
  76. package/dist/assets/examples/sources/switch/form.vue +43 -11
  77. package/dist/assets/examples/sources/table/contain-horizontal.vue +24 -12
  78. package/dist/assets/examples/sources/table/row-headers.vue +118 -19
  79. package/dist/assets/examples/sources/tabs/review-sections.vue +43 -0
  80. package/dist/assets/examples/sources/tags-input/headless-field.vue +31 -0
  81. package/dist/assets/examples/sources/tags-input/project-labels.vue +64 -0
  82. package/dist/assets/examples/sources/tags-input/read-only.vue +12 -0
  83. package/dist/assets/examples/sources/toast/themed.vue +42 -19
  84. package/dist/assets/examples/sources/toolbar/themed.vue +22 -4
  85. package/dist/assets/examples/sources/tooltip/themed.vue +12 -1
  86. package/dist/assets/examples/sources/tree/themed.vue +70 -17
  87. package/dist/assets/manifests/themes/ghost-accordion.manifest.json +1 -0
  88. package/dist/assets/manifests/themes/ghost-button.manifest.json +1 -0
  89. package/dist/assets/manifests/themes/ghost-calendar.manifest.json +3 -1
  90. package/dist/assets/manifests/themes/ghost-checkbox-group.manifest.json +90 -0
  91. package/dist/assets/manifests/themes/ghost-collapsible.manifest.json +1 -0
  92. package/dist/assets/manifests/themes/ghost-combobox.manifest.json +1 -0
  93. package/dist/assets/manifests/themes/ghost-command-palette.manifest.json +2 -1
  94. package/dist/assets/manifests/themes/ghost-date-picker.manifest.json +5 -0
  95. package/dist/assets/manifests/themes/ghost-dropdown-menu.manifest.json +9 -0
  96. package/dist/assets/manifests/themes/ghost-field.manifest.json +10 -2
  97. package/dist/assets/manifests/themes/ghost-inline-alert.manifest.json +1 -0
  98. package/dist/assets/manifests/themes/ghost-input.manifest.json +3 -1
  99. package/dist/assets/manifests/themes/ghost-link.manifest.json +2 -1
  100. package/dist/assets/manifests/themes/ghost-number-input.manifest.json +1 -0
  101. package/dist/assets/manifests/themes/ghost-pagination.manifest.json +6 -2
  102. package/dist/assets/manifests/themes/ghost-progress.manifest.json +1 -0
  103. package/dist/assets/manifests/themes/ghost-radio-group-item.manifest.json +63 -0
  104. package/dist/assets/manifests/themes/ghost-scroll-area.manifest.json +12 -2
  105. package/dist/assets/manifests/themes/ghost-select.manifest.json +3 -0
  106. package/dist/assets/manifests/themes/ghost-slider.manifest.json +1 -0
  107. package/dist/assets/manifests/themes/ghost-table.manifest.json +2 -1
  108. package/dist/assets/manifests/themes/ghost-tags-input.manifest.json +255 -0
  109. package/dist/assets/manifests/vue/ghost-checkbox-group.manifest.json +173 -0
  110. package/dist/assets/manifests/vue/ghost-command-palette-content.manifest.json +6 -2
  111. package/dist/assets/manifests/vue/ghost-command-palette-overlay.manifest.json +6 -2
  112. package/dist/assets/manifests/vue/ghost-command-palette.manifest.json +0 -1
  113. package/dist/assets/manifests/vue/ghost-context-menu-content.manifest.json +3 -3
  114. package/dist/assets/manifests/vue/ghost-context-menu.manifest.json +1 -1
  115. package/dist/assets/manifests/vue/ghost-data-table-preset.manifest.json +1 -1
  116. package/dist/assets/manifests/vue/ghost-data-table-table.manifest.json +1 -1
  117. package/dist/assets/manifests/vue/ghost-data-table.manifest.json +99 -2
  118. package/dist/assets/manifests/vue/ghost-date-picker-content.manifest.json +12 -3
  119. package/dist/assets/manifests/vue/ghost-date-picker.manifest.json +1 -6
  120. package/dist/assets/manifests/vue/ghost-dialog-content.manifest.json +6 -2
  121. package/dist/assets/manifests/vue/ghost-dialog-overlay.manifest.json +6 -2
  122. package/dist/assets/manifests/vue/ghost-drawer-content.manifest.json +6 -2
  123. package/dist/assets/manifests/vue/ghost-drawer-overlay.manifest.json +6 -2
  124. package/dist/assets/manifests/vue/ghost-field-error.manifest.json +12 -1
  125. package/dist/assets/manifests/vue/ghost-field.manifest.json +35 -3
  126. package/dist/assets/manifests/vue/ghost-form.manifest.json +221 -0
  127. package/dist/assets/manifests/vue/ghost-hover-card-content.manifest.json +12 -3
  128. package/dist/assets/manifests/vue/ghost-input.manifest.json +2 -1
  129. package/dist/assets/manifests/vue/ghost-link.manifest.json +1 -2
  130. package/dist/assets/manifests/vue/ghost-menubar-content.manifest.json +3 -3
  131. package/dist/assets/manifests/vue/ghost-menubar.manifest.json +4 -4
  132. package/dist/assets/manifests/vue/ghost-pagination.manifest.json +0 -2
  133. package/dist/assets/manifests/vue/ghost-popover-content.manifest.json +6 -2
  134. package/dist/assets/manifests/vue/ghost-presence.manifest.json +96 -0
  135. package/dist/assets/manifests/vue/ghost-scroll-area.manifest.json +0 -1
  136. package/dist/assets/manifests/vue/ghost-select-content.manifest.json +6 -1
  137. package/dist/assets/manifests/vue/ghost-select-group.manifest.json +6 -1
  138. package/dist/assets/manifests/vue/ghost-select-label.manifest.json +6 -1
  139. package/dist/assets/manifests/vue/ghost-select-option.manifest.json +6 -1
  140. package/dist/assets/manifests/vue/ghost-select-trigger.manifest.json +6 -1
  141. package/dist/assets/manifests/vue/ghost-select-value.manifest.json +18 -2
  142. package/dist/assets/manifests/vue/ghost-select.manifest.json +18 -6
  143. package/dist/assets/manifests/vue/ghost-submenu-content.manifest.json +168 -0
  144. package/dist/assets/manifests/vue/ghost-submenu-trigger.manifest.json +102 -0
  145. package/dist/assets/manifests/vue/ghost-submenu.manifest.json +59 -0
  146. package/dist/assets/manifests/vue/ghost-table.manifest.json +0 -2
  147. package/dist/assets/manifests/vue/ghost-tabs.manifest.json +2 -1
  148. package/dist/assets/manifests/vue/ghost-tags-input.manifest.json +260 -0
  149. package/dist/assets/tokens.json +15 -0
  150. package/dist/components.d.ts +5 -0
  151. package/dist/components.js +80 -11
  152. package/package.json +1 -1
@@ -0,0 +1,197 @@
1
+ <script setup lang="ts">
2
+ import { computed, shallowRef } from 'vue'
3
+
4
+ import {
5
+ CalendarDate,
6
+ type DateValue,
7
+ GhostCalendar,
8
+ GhostCalendarGrid,
9
+ GhostCalendarHeader,
10
+ GhostCalendarHeading,
11
+ GhostCalendarNextButton,
12
+ GhostCalendarPrevButton,
13
+ GhostCard,
14
+ GhostSegmentedControl,
15
+ GhostSegmentedControlItem,
16
+ } from '@ghostvue/themes'
17
+
18
+ type OfficeId = 'austin' | 'berlin' | 'tokyo'
19
+
20
+ interface Office {
21
+ label: string
22
+ locale: string
23
+ /** 0 = Sunday. Set explicitly: not every browser reports a locale's week start. */
24
+ weekStartsOn: number
25
+ /** The calendar names its grid with `Intl`; the month buttons need your copy. */
26
+ previous: string
27
+ next: string
28
+ }
29
+
30
+ const offices: Record<OfficeId, Office> = {
31
+ austin: {
32
+ label: 'Austin',
33
+ locale: 'en-US',
34
+ weekStartsOn: 0,
35
+ previous: 'Previous month',
36
+ next: 'Next month',
37
+ },
38
+ berlin: {
39
+ label: 'Berlin',
40
+ locale: 'de-DE',
41
+ weekStartsOn: 1,
42
+ previous: 'Vorheriger Monat',
43
+ next: 'Nächster Monat',
44
+ },
45
+ tokyo: {
46
+ label: 'Tokyo',
47
+ locale: 'ja-JP',
48
+ weekStartsOn: 0,
49
+ previous: '前の月',
50
+ next: '次の月',
51
+ },
52
+ }
53
+
54
+ const officeId = shallowRef<OfficeId>('berlin')
55
+ const office = computed(() => offices[officeId.value])
56
+
57
+ const today = new CalendarDate(2024, 6, 3)
58
+ const visibleMonth = new CalendarDate(2024, 6, 1)
59
+ // A `CalendarDate` carries no locale: switching offices relabels the grid,
60
+ // but the selected day and the value sent to your API stay the same.
61
+ const reviewDay = shallowRef<DateValue>(new CalendarDate(2024, 6, 14))
62
+
63
+ const localDate = computed(() =>
64
+ new Intl.DateTimeFormat(office.value.locale, {
65
+ dateStyle: 'full',
66
+ timeZone: 'UTC',
67
+ }).format(reviewDay.value.toDate('UTC')),
68
+ )
69
+
70
+ function isOfficeId(value: string | undefined): value is OfficeId {
71
+ return value !== undefined && Object.hasOwn(offices, value)
72
+ }
73
+
74
+ function selectOffice(value: string | undefined): void {
75
+ // The segmented control reports `undefined` when its value is cleared;
76
+ // keep the current office so the calendar always has a locale.
77
+ if (isOfficeId(value)) officeId.value = value
78
+ }
79
+ </script>
80
+
81
+ <template>
82
+ <GhostCard class="office-review">
83
+ <template #header>
84
+ <div class="office-review__header">
85
+ <h2 class="office-review__title">Quarterly review</h2>
86
+ <GhostSegmentedControl
87
+ :model-value="officeId"
88
+ aria-label="Office calendar"
89
+ @update:model-value="selectOffice"
90
+ >
91
+ <GhostSegmentedControlItem
92
+ v-for="(entry, id) in offices"
93
+ :key="id"
94
+ :value="id"
95
+ >
96
+ {{ entry.label }}
97
+ </GhostSegmentedControlItem>
98
+ </GhostSegmentedControl>
99
+ </div>
100
+ </template>
101
+
102
+ <!--
103
+ `lang` lets screen readers pronounce the localized month, weekday, and
104
+ button names. The themed root forwards other attributes to the headless
105
+ calendar, so the wrapper element carries it.
106
+ -->
107
+ <div :lang="office.locale">
108
+ <GhostCalendar
109
+ v-model="reviewDay"
110
+ :locale="office.locale"
111
+ :week-starts-on="office.weekStartsOn"
112
+ :default-visible-month="visibleMonth"
113
+ :today="today"
114
+ >
115
+ <GhostCalendarHeader class="office-review__nav">
116
+ <GhostCalendarHeading />
117
+ <GhostCalendarPrevButton :aria-label="office.previous" />
118
+ <GhostCalendarNextButton :aria-label="office.next" />
119
+ </GhostCalendarHeader>
120
+ <GhostCalendarGrid />
121
+ </GhostCalendar>
122
+ </div>
123
+
124
+ <template #footer>
125
+ <div class="office-review__status" role="status" aria-live="polite">
126
+ <dl class="office-review__summary">
127
+ <div>
128
+ <dt>{{ office.label }}</dt>
129
+ <dd :lang="office.locale">{{ localDate }}</dd>
130
+ </div>
131
+ <div>
132
+ <dt>Saved as</dt>
133
+ <dd>
134
+ <code>{{ reviewDay.toString() }}</code>
135
+ </dd>
136
+ </div>
137
+ </dl>
138
+ </div>
139
+ </template>
140
+ </GhostCard>
141
+ </template>
142
+
143
+ <style scoped>
144
+ .office-review {
145
+ inline-size: 100%;
146
+ max-inline-size: 22rem;
147
+ }
148
+
149
+ .office-review__header {
150
+ display: grid;
151
+ gap: var(--ghost-space-gap-sm);
152
+ }
153
+
154
+ /* Reset the docs prose heading so the card title keeps the card's type scale. */
155
+ .office-review__title {
156
+ border: 0;
157
+ color: var(--ghost-surface-fg);
158
+ font-size: var(--ghost-type-size-md);
159
+ font-weight: var(--ghost-type-weight-semibold);
160
+ line-height: var(--ghost-type-line-tight);
161
+ margin: 0;
162
+ padding: 0;
163
+ }
164
+
165
+ .office-review__nav :deep(.ghost-calendar-heading) {
166
+ text-align: start;
167
+ }
168
+
169
+ .office-review__status {
170
+ inline-size: 100%;
171
+ }
172
+
173
+ .office-review__summary {
174
+ display: grid;
175
+ gap: var(--ghost-space-gap-xs);
176
+ font-size: var(--ghost-type-size-xs);
177
+ inline-size: 100%;
178
+ margin: 0;
179
+ }
180
+
181
+ .office-review__summary div {
182
+ display: flex;
183
+ flex-wrap: wrap;
184
+ gap: var(--ghost-space-gap-xs);
185
+ justify-content: space-between;
186
+ }
187
+
188
+ .office-review__summary dt {
189
+ color: var(--ghost-text-muted);
190
+ }
191
+
192
+ .office-review__summary dd {
193
+ color: var(--ghost-surface-fg);
194
+ font-variant-numeric: tabular-nums;
195
+ margin: 0;
196
+ }
197
+ </style>
@@ -1,10 +1,23 @@
1
1
  <script setup lang="ts">
2
+ import { ref } from 'vue'
3
+
2
4
  import {
3
5
  GhostAvatar,
4
6
  GhostBadge,
5
7
  GhostButton,
6
8
  GhostCard,
9
+ GhostLink,
7
10
  } from '@ghostvue/themes'
11
+
12
+ // Deploy acts in place, so the card root stays a static article and each
13
+ // footer control keeps its own tab stop.
14
+ const nextDeploy = ref(49)
15
+ const deployStatus = ref('')
16
+
17
+ function deploy() {
18
+ deployStatus.value = `Deploy #${String(nextDeploy.value)} queued for us-west-2.`
19
+ nextDeploy.value += 1
20
+ }
8
21
  </script>
9
22
 
10
23
  <template>
@@ -31,17 +44,28 @@ import {
31
44
  Latest build passed all 48 integration checks. Edge cache warming is
32
45
  active across 12 regions.
33
46
  </span>
47
+ <!-- Stays mounted so the queued message is announced when it appears. -->
48
+ <span role="status" class="card-showcase__status">{{
49
+ deployStatus
50
+ }}</span>
34
51
 
35
52
  <template #footer>
36
53
  <div class="card-showcase__footer">
37
- <GhostButton size="sm" variant="outline" tone="neutral">
54
+ <GhostLink
55
+ href="#northwind-web-logs"
56
+ appearance="button"
57
+ size="sm"
58
+ variant="outline"
59
+ tone="neutral"
60
+ >
38
61
  View logs
39
- </GhostButton>
40
- <GhostButton size="sm">Deploy</GhostButton>
62
+ </GhostLink>
63
+ <GhostButton size="sm" @click="deploy">Deploy</GhostButton>
41
64
  </div>
42
65
  </template>
43
66
  </GhostCard>
44
67
 
68
+ <!-- The whole card is one link, so it holds no buttons or nested links. -->
45
69
  <GhostCard as="a" href="#deployment-guide" interactive="spotlight">
46
70
  <template #header>
47
71
  <div class="card-showcase__header">
@@ -111,6 +135,17 @@ import {
111
135
  line-height: var(--ghost-type-line-normal);
112
136
  }
113
137
 
138
+ .card-showcase__status {
139
+ color: var(--ghost-text-default);
140
+ display: block;
141
+ font-size: var(--ghost-type-size-sm);
142
+ line-height: var(--ghost-type-line-normal);
143
+ }
144
+
145
+ .card-showcase__status:not(:empty) {
146
+ margin-block-start: var(--ghost-space-gap-xs);
147
+ }
148
+
114
149
  .card-showcase__footer {
115
150
  display: flex;
116
151
  flex-wrap: wrap;
@@ -0,0 +1,56 @@
1
+ <script setup lang="ts">
2
+ import { ref } from 'vue'
3
+
4
+ import { GhostCheckbox, GhostCheckboxGroup } from '@ghostvue/themes'
5
+
6
+ type Channel = 'email' | 'slack' | 'webhooks'
7
+
8
+ const channels = ref<Channel[]>(['email'])
9
+ </script>
10
+
11
+ <template>
12
+ <div class="basic-group">
13
+ <GhostCheckboxGroup v-model="channels" name="channels">
14
+ <legend>Release updates</legend>
15
+ <label class="basic-group__option">
16
+ <GhostCheckbox value="email" />
17
+ Email digest
18
+ </label>
19
+ <label class="basic-group__option">
20
+ <GhostCheckbox value="slack" />
21
+ Slack channel
22
+ </label>
23
+ <label class="basic-group__option">
24
+ <GhostCheckbox value="webhooks" />
25
+ Webhook events
26
+ </label>
27
+ </GhostCheckboxGroup>
28
+
29
+ <p class="basic-group__summary">
30
+ Selected: {{ channels.length ? channels.join(', ') : 'none' }}
31
+ </p>
32
+ </div>
33
+ </template>
34
+
35
+ <style scoped>
36
+ .basic-group {
37
+ display: grid;
38
+ gap: var(--ghost-space-stack-sm);
39
+ }
40
+
41
+ .basic-group__option {
42
+ align-items: center;
43
+ color: var(--ghost-text-default);
44
+ cursor: pointer;
45
+ display: inline-flex;
46
+ font-size: var(--ghost-type-size-sm);
47
+ gap: var(--ghost-space-gap-sm);
48
+ line-height: var(--ghost-type-line-snug);
49
+ }
50
+
51
+ .basic-group__summary {
52
+ color: var(--ghost-text-muted);
53
+ font-size: var(--ghost-type-size-sm);
54
+ margin: 0;
55
+ }
56
+ </style>
@@ -0,0 +1,73 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref } from 'vue'
3
+
4
+ import { GhostCheckbox, GhostCheckboxGroup } from '@ghostvue/themes'
5
+
6
+ type Scope = 'read' | 'write' | 'admin'
7
+
8
+ const scopes = ref<Scope[]>([])
9
+ const isInvalid = computed(() => scopes.value.length === 0)
10
+ </script>
11
+
12
+ <template>
13
+ <div class="scope-field">
14
+ <GhostCheckboxGroup
15
+ v-model="scopes"
16
+ name="scopes"
17
+ :invalid="isInvalid"
18
+ :aria-describedby="isInvalid ? 'scope-error' : 'scope-hint'"
19
+ >
20
+ <legend>API token scopes</legend>
21
+ <p id="scope-hint" class="scope-field__hint">
22
+ Select at least one permission for this token.
23
+ </p>
24
+ <label class="scope-field__option">
25
+ <GhostCheckbox value="read" />
26
+ Read deployments
27
+ </label>
28
+ <label class="scope-field__option">
29
+ <GhostCheckbox value="write" />
30
+ Trigger builds
31
+ </label>
32
+ <label class="scope-field__option">
33
+ <GhostCheckbox value="admin" />
34
+ Manage billing
35
+ </label>
36
+ </GhostCheckboxGroup>
37
+
38
+ <p v-if="isInvalid" id="scope-error" class="scope-field__error">
39
+ Choose at least one token scope before generating a key.
40
+ </p>
41
+ </div>
42
+ </template>
43
+
44
+ <style scoped>
45
+ .scope-field {
46
+ display: grid;
47
+ gap: var(--ghost-space-gap-xs);
48
+ }
49
+
50
+ .scope-field__hint {
51
+ color: var(--ghost-text-muted);
52
+ font-size: var(--ghost-type-size-sm);
53
+ line-height: var(--ghost-type-line-snug);
54
+ margin: 0;
55
+ }
56
+
57
+ .scope-field__option {
58
+ align-items: center;
59
+ color: var(--ghost-text-default);
60
+ cursor: pointer;
61
+ display: inline-flex;
62
+ font-size: var(--ghost-type-size-sm);
63
+ gap: var(--ghost-space-gap-sm);
64
+ line-height: var(--ghost-type-line-snug);
65
+ }
66
+
67
+ .scope-field__error {
68
+ color: var(--ghost-status-danger-fg);
69
+ font-size: var(--ghost-type-size-sm);
70
+ line-height: var(--ghost-type-line-snug);
71
+ margin: 0;
72
+ }
73
+ </style>
@@ -0,0 +1,100 @@
1
+ <script setup lang="ts">
2
+ import { ref } from 'vue'
3
+
4
+ import {
5
+ GhostButton,
6
+ GhostCheckbox,
7
+ GhostCheckboxGroup,
8
+ } from '@ghostvue/themes'
9
+
10
+ type ExportColumn = 'id' | 'customer' | 'total' | 'tax'
11
+
12
+ const defaultColumns: readonly ExportColumn[] = ['id', 'total']
13
+ const columns = ref<ExportColumn[]>([...defaultColumns])
14
+ const submitted = ref<string[] | null>(null)
15
+
16
+ function onSubmit(event: Event): void {
17
+ const form = event.currentTarget as HTMLFormElement
18
+ submitted.value = new FormData(form)
19
+ .getAll('columns')
20
+ .filter((entry): entry is string => typeof entry === 'string')
21
+ }
22
+
23
+ function onReset(): void {
24
+ submitted.value = null
25
+ }
26
+ </script>
27
+
28
+ <template>
29
+ <form class="export-form" @submit.prevent="onSubmit" @reset="onReset">
30
+ <GhostCheckboxGroup
31
+ v-model="columns"
32
+ :default-value="defaultColumns"
33
+ name="columns"
34
+ >
35
+ <legend>Export columns</legend>
36
+ <label class="export-form__option">
37
+ <GhostCheckbox value="id" />
38
+ Invoice ID
39
+ </label>
40
+ <label class="export-form__option">
41
+ <GhostCheckbox value="customer" />
42
+ Customer name
43
+ </label>
44
+ <label class="export-form__option">
45
+ <GhostCheckbox value="total" />
46
+ Total amount
47
+ </label>
48
+ <label class="export-form__option">
49
+ <GhostCheckbox value="tax" />
50
+ Tax breakdown
51
+ </label>
52
+ </GhostCheckboxGroup>
53
+
54
+ <div class="export-form__actions">
55
+ <GhostButton type="reset" variant="ghost" tone="neutral">
56
+ Reset
57
+ </GhostButton>
58
+ <GhostButton type="submit">Export CSV</GhostButton>
59
+ </div>
60
+
61
+ <p class="export-form__result" role="status">
62
+ {{
63
+ submitted === null
64
+ ? `Model: ${JSON.stringify(columns)}`
65
+ : `Submitted getAll("columns"): ${JSON.stringify(submitted)}`
66
+ }}
67
+ </p>
68
+ </form>
69
+ </template>
70
+
71
+ <style scoped>
72
+ .export-form {
73
+ display: grid;
74
+ gap: var(--ghost-space-stack-md);
75
+ max-inline-size: 28rem;
76
+ }
77
+
78
+ .export-form__option {
79
+ align-items: center;
80
+ color: var(--ghost-text-default);
81
+ cursor: pointer;
82
+ display: inline-flex;
83
+ font-size: var(--ghost-type-size-sm);
84
+ gap: var(--ghost-space-gap-sm);
85
+ line-height: var(--ghost-type-line-snug);
86
+ }
87
+
88
+ .export-form__actions {
89
+ display: flex;
90
+ flex-wrap: wrap;
91
+ gap: var(--ghost-space-gap-sm);
92
+ }
93
+
94
+ .export-form__result {
95
+ color: var(--ghost-text-muted);
96
+ font-size: var(--ghost-type-size-sm);
97
+ margin: 0;
98
+ overflow-wrap: anywhere;
99
+ }
100
+ </style>
@@ -0,0 +1,68 @@
1
+ <script setup lang="ts">
2
+ import { ref } from 'vue'
3
+
4
+ import { GhostCheckbox, GhostCheckboxGroup } from '@ghostvue/vue'
5
+
6
+ type Feature = 'audit' | 'sso' | 'scim'
7
+
8
+ const features = ref<Feature[]>(['audit'])
9
+ </script>
10
+
11
+ <template>
12
+ <div class="headless-group-demo">
13
+ <GhostCheckboxGroup v-model="features" name="features">
14
+ <legend>Workspace security</legend>
15
+ <label class="headless-group-demo__option">
16
+ <GhostCheckbox value="audit" />
17
+ Audit log stream
18
+ </label>
19
+ <label class="headless-group-demo__option">
20
+ <GhostCheckbox value="sso" />
21
+ SAML single sign-on
22
+ </label>
23
+ <label class="headless-group-demo__option">
24
+ <GhostCheckbox value="scim" disabled />
25
+ SCIM provisioning (enterprise)
26
+ </label>
27
+ </GhostCheckboxGroup>
28
+
29
+ <p class="headless-group-demo__status">
30
+ Model: {{ JSON.stringify(features) }}
31
+ </p>
32
+ </div>
33
+ </template>
34
+
35
+ <style scoped>
36
+ .headless-group-demo {
37
+ color: var(--ghost-text-default, CanvasText);
38
+ display: grid;
39
+ gap: 0.75rem;
40
+ }
41
+
42
+ .headless-group-demo :deep(.ghost-checkbox-group) {
43
+ border: 1px solid var(--ghost-border-default, GrayText);
44
+ border-radius: 0.375rem;
45
+ display: grid;
46
+ gap: 0.5rem;
47
+ margin: 0;
48
+ min-inline-size: 0;
49
+ padding: 0.75rem 1rem;
50
+ }
51
+
52
+ .headless-group-demo :deep(.ghost-checkbox-group > legend) {
53
+ font-weight: 600;
54
+ padding-inline: 0.25rem;
55
+ }
56
+
57
+ .headless-group-demo__option {
58
+ align-items: center;
59
+ display: inline-flex;
60
+ gap: 0.5rem;
61
+ }
62
+
63
+ .headless-group-demo__status {
64
+ color: var(--ghost-text-muted, GrayText);
65
+ font-size: 0.875rem;
66
+ margin: 0;
67
+ }
68
+ </style>