@stacksjs/defaults 0.75.612 → 0.75.614

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 (132) hide show
  1. package/ai/skills/stacks-actions/SKILL.md +209 -1
  2. package/ai/skills/stacks-api/SKILL.md +1 -1
  3. package/ai/skills/stacks-buddy/SKILL.md +1 -1
  4. package/ai/skills/stacks-dashboard/SKILL.md +120 -9
  5. package/ai/skills/stacks-database/SKILL.md +4 -2
  6. package/ai/skills/stacks-email/SKILL.md +15 -0
  7. package/ai/skills/stacks-middleware/SKILL.md +4 -1
  8. package/ai/skills/stacks-native/CAPABILITIES.md +1 -1
  9. package/ai/skills/stacks-native/CATALOG.md +12 -12
  10. package/ai/skills/stacks-validation/SKILL.md +7 -0
  11. package/app/Actions/Dashboard/Models/ModelDestroyAction.ts +4 -47
  12. package/app/Actions/Dashboard/Models/ModelSaveAction.ts +257 -0
  13. package/app/Actions/Dashboard/Models/ModelStoreAction.ts +4 -31
  14. package/app/Actions/Dashboard/Models/ModelUpdateAction.ts +5 -61
  15. package/app/Actions/Dashboard/Models/model-related.ts +2 -3
  16. package/app/Actions/Dashboard/Models/model-row-writes.ts +188 -0
  17. package/app/Actions/Storefront/AddToCartAction.ts +12 -15
  18. package/app/Actions/Storefront/CheckoutContactAction.ts +18 -10
  19. package/app/Actions/Storefront/CheckoutShippingAction.ts +20 -10
  20. package/app/Actions/Storefront/PlaceOrderAction.ts +9 -12
  21. package/app/Actions/Storefront/UpdateCartItemAction.ts +11 -9
  22. package/app/Middleware/Abilities.ts +4 -3
  23. package/app/Middleware/Csrf.ts +10 -1
  24. package/app/Middleware/Throttle.ts +4 -4
  25. package/functions/dashboard-api.ts +9 -3
  26. package/functions/dashboard-model-bulk.ts +3 -3
  27. package/functions/dashboard-model-drafts.test.ts +122 -0
  28. package/functions/dashboard-model-drafts.ts +228 -0
  29. package/functions/dashboard-model-record.ts +1 -1
  30. package/ide/vscode/package.json +1 -1
  31. package/package.json +5 -5
  32. package/resources/components/Dashboard/Analytics/AnalyticsPageHeader.stx +3 -13
  33. package/resources/components/Dashboard/App/RequestsOverview.stx +3 -20
  34. package/resources/components/Dashboard/App/SourceInventory.stx +1 -5
  35. package/resources/components/Dashboard/Auth/AccessTokenCreateDialog.stx +11 -28
  36. package/resources/components/Dashboard/Commerce/CommerceCategoriesDashboard.stx +4 -8
  37. package/resources/components/Dashboard/Commerce/CommerceCategoryDialog.stx +9 -9
  38. package/resources/components/Dashboard/Commerce/CommerceCouponDialog.stx +14 -14
  39. package/resources/components/Dashboard/Commerce/CommerceCouponsDashboard.stx +5 -9
  40. package/resources/components/Dashboard/Commerce/CommerceCustomerDialog.stx +7 -7
  41. package/resources/components/Dashboard/Commerce/CommerceCustomersDashboard.stx +3 -7
  42. package/resources/components/Dashboard/Commerce/CommerceGiftCardDialog.stx +15 -15
  43. package/resources/components/Dashboard/Commerce/CommerceGiftCardsDashboard.stx +5 -9
  44. package/resources/components/Dashboard/Commerce/CommerceManufacturerDialog.stx +12 -15
  45. package/resources/components/Dashboard/Commerce/CommerceManufacturersDashboard.stx +4 -28
  46. package/resources/components/Dashboard/Commerce/CommerceOrderDialog.stx +15 -15
  47. package/resources/components/Dashboard/Commerce/CommerceOrdersDashboard.stx +4 -8
  48. package/resources/components/Dashboard/Commerce/CommerceOverviewDashboard.stx +3 -11
  49. package/resources/components/Dashboard/Commerce/CommercePaymentsDashboard.stx +8 -9
  50. package/resources/components/Dashboard/Commerce/CommercePosCatalog.stx +3 -20
  51. package/resources/components/Dashboard/Commerce/CommercePosCheckoutDialog.stx +4 -4
  52. package/resources/components/Dashboard/Commerce/CommerceProductDialog.stx +14 -14
  53. package/resources/components/Dashboard/Commerce/CommerceProductsDashboard.stx +4 -8
  54. package/resources/components/Dashboard/Commerce/CommerceReviewEditDialog.stx +14 -24
  55. package/resources/components/Dashboard/Commerce/CommerceReviewsDashboard.stx +5 -43
  56. package/resources/components/Dashboard/Commerce/CommerceTaxDialog.stx +22 -38
  57. package/resources/components/Dashboard/Commerce/CommerceTaxesDashboard.stx +5 -33
  58. package/resources/components/Dashboard/Commerce/CommerceUnitDialog.stx +16 -30
  59. package/resources/components/Dashboard/Commerce/CommerceUnitsDashboard.stx +4 -28
  60. package/resources/components/Dashboard/Commerce/CommerceVariantDialog.stx +15 -9
  61. package/resources/components/Dashboard/Commerce/CommerceVariantsDashboard.stx +8 -9
  62. package/resources/components/Dashboard/Commerce/Delivery/CourierDialog.stx +14 -12
  63. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRouteDialog.stx +9 -11
  64. package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveryDialog.stx +15 -9
  65. package/resources/components/Dashboard/Commerce/Delivery/LicenseKeyDialog.stx +11 -7
  66. package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodDialog.stx +14 -8
  67. package/resources/components/Dashboard/Commerce/Delivery/ShippingRateDialog.stx +11 -17
  68. package/resources/components/Dashboard/Commerce/Delivery/ShippingZoneDialog.stx +18 -12
  69. package/resources/components/Dashboard/Commerce/PaymentRefundDialog.stx +1 -1
  70. package/resources/components/Dashboard/Commerce/PrintDeviceDialog.stx +5 -5
  71. package/resources/components/Dashboard/Commerce/PrintDevicesDashboard.stx +4 -8
  72. package/resources/components/Dashboard/Commerce/PrintLogsDashboard.stx +5 -9
  73. package/resources/components/Dashboard/Commerce/ProductWaitlistDashboard.stx +2 -10
  74. package/resources/components/Dashboard/Commerce/ProductWaitlistEntryDialog.stx +14 -67
  75. package/resources/components/Dashboard/Commerce/RestaurantWaitlistDashboard.stx +3 -18
  76. package/resources/components/Dashboard/Commerce/RestaurantWaitlistEntryDialog.stx +23 -69
  77. package/resources/components/Dashboard/Content/AuthorEditorDialog.stx +4 -16
  78. package/resources/components/Dashboard/Content/BlogDashboard.stx +2 -19
  79. package/resources/components/Dashboard/Content/BlogPostEditorDialog.stx +31 -51
  80. package/resources/components/Dashboard/Content/CommentsDashboard.stx +1 -1
  81. package/resources/components/Dashboard/Content/ContentDashboard.stx +1 -11
  82. package/resources/components/Dashboard/Content/CreateFolderDialog.stx +1 -4
  83. package/resources/components/Dashboard/Content/FileManagerDashboard.stx +2 -2
  84. package/resources/components/Dashboard/Content/PageEditorDialog.stx +8 -17
  85. package/resources/components/Dashboard/Content/PostEditorDialog.stx +35 -45
  86. package/resources/components/Dashboard/Content/PostsDashboard.stx +1 -13
  87. package/resources/components/Dashboard/Content/SeoDashboard.stx +2 -20
  88. package/resources/components/Dashboard/Content/SeoEditorDialog.stx +4 -38
  89. package/resources/components/Dashboard/Content/TaxonomyEditorDialog.stx +8 -15
  90. package/resources/components/Dashboard/Data/ActivityLog.stx +1 -5
  91. package/resources/components/Dashboard/Deployments/DeploymentList.stx +2 -11
  92. package/resources/components/Dashboard/Email/InboxMessageList.stx +1 -5
  93. package/resources/components/Dashboard/Infrastructure/DnsDashboard.stx +2 -16
  94. package/resources/components/Dashboard/Infrastructure/LogsDashboard.stx +6 -10
  95. package/resources/components/Dashboard/Infrastructure/MailboxesDashboard.stx +1 -5
  96. package/resources/components/Dashboard/Infrastructure/ServersDashboard.stx +1 -5
  97. package/resources/components/Dashboard/Jobs/JobHistory.stx +3 -12
  98. package/resources/components/Dashboard/Kanban/KanbanCardDialog.stx +57 -51
  99. package/resources/components/Dashboard/Library/ComponentsDashboard.stx +4 -14
  100. package/resources/components/Dashboard/Library/DependenciesDashboard.stx +2 -15
  101. package/resources/components/Dashboard/Library/PackagesDashboard.stx +1 -8
  102. package/resources/components/Dashboard/Library/SourceScaffoldDialog.stx +1 -12
  103. package/resources/components/Dashboard/Management/PermissionsDashboard.stx +3 -3
  104. package/resources/components/Dashboard/Marketing/AbandonedCartsDashboard.stx +4 -4
  105. package/resources/components/Dashboard/Marketing/CampaignDeliveryDialog.stx +3 -5
  106. package/resources/components/Dashboard/Marketing/CampaignDialog.stx +59 -93
  107. package/resources/components/Dashboard/Marketing/CampaignsDashboard.stx +5 -5
  108. package/resources/components/Dashboard/Marketing/MarketingListDialog.stx +12 -26
  109. package/resources/components/Dashboard/Marketing/MarketingListsDashboard.stx +4 -4
  110. package/resources/components/Dashboard/Marketing/RecoveryCampaignDialog.stx +12 -43
  111. package/resources/components/Dashboard/Marketing/SocialPostDialog.stx +7 -41
  112. package/resources/components/Dashboard/Marketing/SocialPostsDashboard.stx +5 -5
  113. package/resources/components/Dashboard/Models/ModelRecordEdit.stx +240 -28
  114. package/resources/components/Dashboard/Models/ModelRecordsDashboard.stx +7 -23
  115. package/resources/components/Dashboard/Models/ModelsOverview.stx +2 -12
  116. package/resources/components/Dashboard/Notifications/NotificationDeliveries.stx +4 -27
  117. package/resources/components/Dashboard/Notifications/NotificationDeliveryHistory.stx +4 -36
  118. package/resources/components/Dashboard/Operations/RecoveryDestinationDialog.stx +18 -47
  119. package/resources/components/Dashboard/Operations/RecoveryPolicyDialog.stx +24 -78
  120. package/resources/components/Dashboard/Operations/RecoveryRestoreDialog.stx +8 -19
  121. package/resources/components/Dashboard/Queries/QueryDashboard.stx +3 -21
  122. package/resources/components/Dashboard/Releases/ReleaseDashboard.stx +2 -9
  123. package/resources/components/Dashboard/Settings/SettingsDashboard.stx +1 -11
  124. package/resources/components/Dashboard/UI/Input.stx +50 -1
  125. package/resources/components/Dashboard/UI/SearchFilter.stx +27 -17
  126. package/resources/components/Dashboard/UI/Select.stx +4 -1
  127. package/resources/components/Dashboard/UI/Textarea.stx +16 -1
  128. package/resources/views/cart.stx +14 -0
  129. package/resources/views/checkout/contact.stx +15 -1
  130. package/resources/views/checkout/payment.stx +7 -0
  131. package/resources/views/checkout/shipping.stx +39 -5
  132. package/routes/dashboard-api.ts +2 -0
@@ -0,0 +1,228 @@
1
+ /**
2
+ * A record's related rows, changed on its edit page and saved with it, all or
3
+ * nothing (stacksjs/stacks#3315).
4
+ *
5
+ * On the edit page a related panel's rows are not written one at a time. Each
6
+ * add, edit and delete is kept as a draft until "Save changes", which sends
7
+ * the record's fields and every panel's drafts in one request
8
+ * (`PATCH /models/{slug}/{id}/save`). The server writes them all in one
9
+ * transaction, or none of them, and says where a refusal was.
10
+ *
11
+ * Everything here is plain data in and out, so the page holds the drafts in
12
+ * one state and each change makes a new one.
13
+ */
14
+ import { DashboardApiError, dashboardApi } from './dashboard-api'
15
+ import type { ModelFormValues, ModelRelatedPanel, ModelWriteFailure } from './dashboard-model-record'
16
+ import { modelFieldColumn, modelFormPayload, modelFormValues, modelPath, modelWriteFailure } from './dashboard-model-record'
17
+
18
+ /** A row added on this page and not saved yet. `key` names it until it has an id. */
19
+ export interface ModelDraftRow {
20
+ key: string
21
+ values: ModelFormValues
22
+ }
23
+
24
+ /** One panel's unsaved changes. */
25
+ export interface ModelPanelDraft {
26
+ added: ModelDraftRow[]
27
+ /** A listed row's values as edited here, by row id. */
28
+ edited: Record<string, ModelFormValues>
29
+ /** The listed rows to delete, by id. */
30
+ removed: string[]
31
+ }
32
+
33
+ /** Every panel's unsaved changes, by panel slug. */
34
+ export type ModelDrafts = Record<string, ModelPanelDraft>
35
+
36
+ /** What one panel asks the save to change, as the endpoint reads it. */
37
+ export interface ModelRelatedChanges {
38
+ slug: string
39
+ create: Array<{ key: string, fields: Record<string, unknown> }>
40
+ update: Array<{ id: number | string, fields: Record<string, unknown> }>
41
+ destroy: Array<number | string>
42
+ }
43
+
44
+ /** Where a combined save was refused: the record's fields, or one row of one panel. */
45
+ export interface ModelSaveLocation {
46
+ operation: 'update' | 'create' | 'destroy'
47
+ panel?: string
48
+ /** A listed row's id, or the key of one added here. */
49
+ row?: string
50
+ }
51
+
52
+ export type ModelSaveFailure = ModelWriteFailure & { at?: ModelSaveLocation }
53
+
54
+ /** How a row of a panel stands on this page. */
55
+ export type ModelDraftState = 'kept' | 'added' | 'edited' | 'removed'
56
+
57
+ /** A row as the edit page lists it: its summary values, how it stands, and what names it. */
58
+ export interface ModelDraftListRow {
59
+ /** The listed row's id, or the key of one added here. */
60
+ key: string
61
+ state: ModelDraftState
62
+ values: Record<string, unknown>
63
+ }
64
+
65
+ const NEW_ROW = 'new-'
66
+
67
+ function panelDraft(drafts: ModelDrafts, slug: string): ModelPanelDraft {
68
+ return drafts[slug] ?? { added: [], edited: {}, removed: [] }
69
+ }
70
+
71
+ function withPanel(drafts: ModelDrafts, slug: string, next: ModelPanelDraft): ModelDrafts {
72
+ return { ...drafts, [slug]: next }
73
+ }
74
+
75
+ /** Whether `key` names a row added here rather than one that is stored. */
76
+ export function modelDraftIsNew(key: string): boolean {
77
+ return key.startsWith(NEW_ROW)
78
+ }
79
+
80
+ /** A key for the next row added to a panel, unique among the ones there. */
81
+ export function modelDraftKey(drafts: ModelDrafts, slug: string): string {
82
+ const taken = new Set(panelDraft(drafts, slug).added.map(row => row.key))
83
+ let index = taken.size + 1
84
+ while (taken.has(`${NEW_ROW}${index}`))
85
+ index++
86
+ return `${NEW_ROW}${index}`
87
+ }
88
+
89
+ /** What a row's form starts from: the values added or edited here, else the row's stored ones. */
90
+ export function modelDraftValues(panel: ModelRelatedPanel, drafts: ModelDrafts, key: string): ModelFormValues {
91
+ const draft = panelDraft(drafts, panel.slug)
92
+ if (modelDraftIsNew(key))
93
+ return { ...(draft.added.find(row => row.key === key)?.values ?? modelFormValues(panel.fields ?? [])) }
94
+ return { ...(draft.edited[key] ?? modelDraftStored(panel, key)) }
95
+ }
96
+
97
+ /** A listed row's values as they are stored, in the form's shape. */
98
+ export function modelDraftStored(panel: ModelRelatedPanel, key: string): ModelFormValues {
99
+ return modelFormValues(panel.fields ?? [], panel.values?.[key] ?? {})
100
+ }
101
+
102
+ /** Keep a row's form: a new row added, or a row's values changed, whether it was listed or added here. */
103
+ export function modelDraftPut(drafts: ModelDrafts, panel: ModelRelatedPanel, key: string, values: ModelFormValues): ModelDrafts {
104
+ const draft = panelDraft(drafts, panel.slug)
105
+ if (modelDraftIsNew(key)) {
106
+ const added = draft.added.some(row => row.key === key)
107
+ ? draft.added.map(row => row.key === key ? { key, values } : row)
108
+ : [...draft.added, { key, values }]
109
+ return withPanel(drafts, panel.slug, { ...draft, added })
110
+ }
111
+ return withPanel(drafts, panel.slug, { ...draft, edited: { ...draft.edited, [key]: values } })
112
+ }
113
+
114
+ /** Mark a row to be deleted. A row added here is simply dropped, and an edit to a deleted row goes with it. */
115
+ export function modelDraftRemove(drafts: ModelDrafts, panel: ModelRelatedPanel, key: string): ModelDrafts {
116
+ const draft = panelDraft(drafts, panel.slug)
117
+ if (modelDraftIsNew(key))
118
+ return withPanel(drafts, panel.slug, { ...draft, added: draft.added.filter(row => row.key !== key) })
119
+ const edited = { ...draft.edited }
120
+ delete edited[key]
121
+ return withPanel(drafts, panel.slug, { ...draft, edited, removed: draft.removed.includes(key) ? draft.removed : [...draft.removed, key] })
122
+ }
123
+
124
+ /** Keep a row marked for deletion after all. */
125
+ export function modelDraftRestore(drafts: ModelDrafts, panel: ModelRelatedPanel, key: string): ModelDrafts {
126
+ const draft = panelDraft(drafts, panel.slug)
127
+ return withPanel(drafts, panel.slug, { ...draft, removed: draft.removed.filter(id => id !== key) })
128
+ }
129
+
130
+ /** The fields an edit to a listed row changed, against what is stored. */
131
+ function editedFields(panel: ModelRelatedPanel, key: string, values: ModelFormValues): Record<string, unknown> {
132
+ return modelFormPayload(panel.fields ?? [], values, modelDraftStored(panel, key))
133
+ }
134
+
135
+ /**
136
+ * What the save sends for the related rows: per panel, the new rows, the
137
+ * edits that changed something, and the rows to delete. A panel with none of
138
+ * them is left out, so a page whose rows were only looked at sends nothing.
139
+ */
140
+ export function modelRelatedSaveChanges(panels: ModelRelatedPanel[], drafts: ModelDrafts): ModelRelatedChanges[] {
141
+ const changes: ModelRelatedChanges[] = []
142
+ for (const panel of panels) {
143
+ const draft = drafts[panel.slug]
144
+ if (!draft)
145
+ continue
146
+ const create = draft.added.map(row => ({ key: row.key, fields: modelFormPayload(panel.fields ?? [], row.values) }))
147
+ const update = Object.entries(draft.edited)
148
+ .filter(([key]) => !draft.removed.includes(key))
149
+ .map(([key, values]) => ({ id: rowId(key), fields: editedFields(panel, key, values) }))
150
+ .filter(row => Object.keys(row.fields).length > 0)
151
+ const destroy = draft.removed.map(rowId)
152
+ if (create.length + update.length + destroy.length > 0)
153
+ changes.push({ slug: panel.slug, create, update, destroy })
154
+ }
155
+ return changes
156
+ }
157
+
158
+ /** How many related rows a save would add, change or delete. */
159
+ export function modelDraftChangeCount(panels: ModelRelatedPanel[], drafts: ModelDrafts): number {
160
+ return modelRelatedSaveChanges(panels, drafts).reduce((count, panel) => count + panel.create.length + panel.update.length + panel.destroy.length, 0)
161
+ }
162
+
163
+ function rowId(key: string): number | string {
164
+ const id = Number(key)
165
+ return Number.isSafeInteger(id) && id > 0 ? id : key
166
+ }
167
+
168
+ /**
169
+ * A panel's rows as the edit page lists them: the stored ones, marked edited
170
+ * or to be deleted, then the ones added here. An added or edited row shows
171
+ * the values it will be saved with.
172
+ */
173
+ export function modelDraftListRows(panel: ModelRelatedPanel, drafts: ModelDrafts): ModelDraftListRow[] {
174
+ const draft = panelDraft(drafts, panel.slug)
175
+ const shown = (values: ModelFormValues, base: Record<string, unknown>): Record<string, unknown> => {
176
+ const out = { ...base }
177
+ for (const [name, value] of Object.entries(values))
178
+ out[modelFieldColumn(name)] = value
179
+ return out
180
+ }
181
+ const listed = panel.rows.map((row): ModelDraftListRow => {
182
+ const key = String(row.id)
183
+ if (draft.removed.includes(key))
184
+ return { key, state: 'removed', values: row }
185
+ const edited = draft.edited[key]
186
+ if (edited && Object.keys(editedFields(panel, key, edited)).length > 0)
187
+ return { key, state: 'edited', values: shown(edited, row) }
188
+ return { key, state: 'kept', values: row }
189
+ })
190
+ const added = draft.added.map((row): ModelDraftListRow => ({ key: row.key, state: 'added', values: shown(row.values, {}) }))
191
+ return [...listed, ...added]
192
+ }
193
+
194
+ /** The words for a row on the list: its first few summary values, else its id. */
195
+ export function modelDraftRowLabel(panel: ModelRelatedPanel, row: ModelDraftListRow): string {
196
+ const words = panel.columns
197
+ .map(column => row.values[column.key])
198
+ .filter(value => value !== null && value !== undefined && String(value).trim() !== '')
199
+ .slice(0, 3)
200
+ .map(String)
201
+ if (words.length > 0)
202
+ return words.join(' · ')
203
+ return modelDraftIsNew(row.key) ? `New ${panel.label.toLowerCase()}` : `${panel.label} #${row.key}`
204
+ }
205
+
206
+ /**
207
+ * Save the record's changed fields and its panels' changes in one request,
208
+ * all or nothing. A refusal comes back with where it was (`at`), so the page
209
+ * can point at the record's field or at the row.
210
+ */
211
+ export async function saveModelRecordWithRelated(
212
+ slug: string,
213
+ id: string | number,
214
+ fields: Record<string, unknown>,
215
+ related: ModelRelatedChanges[],
216
+ ): Promise<{ ok: true } | ModelSaveFailure> {
217
+ try {
218
+ await dashboardApi(`${modelPath(slug)}/${encodeURIComponent(String(id))}/save`, { method: 'PATCH', body: { fields, related } })
219
+ return { ok: true }
220
+ }
221
+ catch (reason) {
222
+ const failure: ModelSaveFailure = modelWriteFailure(reason)
223
+ const at = reason instanceof DashboardApiError ? (reason.body as { at?: unknown } | null)?.at : undefined
224
+ if (at && typeof at === 'object' && typeof (at as ModelSaveLocation).operation === 'string')
225
+ failure.at = at as ModelSaveLocation
226
+ return failure
227
+ }
228
+ }
@@ -164,7 +164,7 @@ export interface ModelCreateForm {
164
164
  /** What a model offers before its capabilities are known, or when it has none. */
165
165
  export const NO_WRITES: ModelWriteCapabilities = { create: false, update: false, destroy: false, invite: false, anonymize: false }
166
166
 
167
- function modelPath(slug: string): string {
167
+ export function modelPath(slug: string): string {
168
168
  return `/api/dashboard/models/${encodeURIComponent(slug)}`
169
169
  }
170
170
 
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.75.612",
5
+ "version": "0.75.614",
6
6
  "description": "Stacks, built into VS Code: stx templates, pickier linting and formatting, encrypted env files, the dev server preview and every buddy command. No other extensions required.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.612",
5
+ "version": "0.75.614",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -45,14 +45,14 @@
45
45
  "dependencies": {
46
46
  "@iconify-json/f7": "^1.2.2",
47
47
  "@iconify-json/hugeicons": "^1.2.35",
48
- "@stacksjs/mobile": "0.75.612",
48
+ "@stacksjs/mobile": "0.75.614",
49
49
  "@stacksjs/sanitizer": "^0.2.889",
50
50
  "@stacksjs/stx": "^0.2.889",
51
- "@stacksjs/strings": "0.75.612",
51
+ "@stacksjs/strings": "0.75.614",
52
52
  "@xterm/addon-fit": "^0.11.0",
53
53
  "@xterm/xterm": "^6.0.0",
54
54
  "ts-qr-codes": "^0.1.8",
55
- "@stacksjs/support": "0.75.612",
56
- "@stacksjs/browser": "0.75.612"
55
+ "@stacksjs/support": "0.75.614",
56
+ "@stacksjs/browser": "0.75.614"
57
57
  }
58
58
  }
@@ -11,8 +11,8 @@ effect(() => {
11
11
  selectedRange.set(range())
12
12
  })
13
13
 
14
- function emitRange(event: Event): void {
15
- emit('range-change', (event.target as HTMLSelectElement).value)
14
+ function emitRange(next: string): void {
15
+ emit('range-change', next)
16
16
  }
17
17
  </script>
18
18
 
@@ -24,17 +24,7 @@ function emitRange(event: Event): void {
24
24
 
25
25
  <div class="flex flex-wrap gap-2 items-center">
26
26
  <span class="text-gray-500 text-sm dark:text-neutral-400">{{ dateRange() }}</span>
27
- <select
28
- x-model="selectedRange"
29
- aria-label="Analytics date range"
30
- class="block pl-3 pr-10 py-1.5 text-gray-900 sm:leading-6 sm:text-sm dark:text-white dark:bg-neutral-800 border-0 ring-1 ring-gray-300 ring-inset rounded-md dark:ring-neutral-700 focus:ring-2 focus:ring-blue-600 focus:ring-inset"
31
- @change="emitRange($event)"
32
- >
33
- <option value="day">Last 24 hours</option>
34
- <option value="week">Last 7 days</option>
35
- <option value="month">Last 30 days</option>
36
- <option value="year">Last year</option>
37
- </select>
27
+ <Select v-model:value="selectedRange" ariaLabel="Analytics date range" placeholder="" :options="[{ value: 'day', label: 'Last 24 hours' }, { value: 'week', label: 'Last 7 days' }, { value: 'month', label: 'Last 30 days' }, { value: 'year', label: 'Last year' }]" @change="emitRange" />
38
28
  <Button variant="secondary" :loading="loading()" @click="emit('refresh')">
39
29
  <span :if="!loading()" class="h-4 w-4 i-hugeicons-refresh"></span>
40
30
  Refresh
@@ -209,26 +209,9 @@ onMount(() => {
209
209
  <p class="mt-1 text-neutral-500 text-xs dark:text-neutral-400">Showing up to 100 persisted records. Last-hour rate: {{ stats().requestsPerMinute.toFixed(2) }} per minute.</p>
210
210
  </div>
211
211
  <div class="grid gap-3 grid-cols-1 sm:grid-cols-[minmax(0,1fr)_auto_auto]">
212
- <label class="block relative">
213
- <span class="sr-only">Search requests</span>
214
- <span class="absolute left-3 top-2.5 h-4 w-4 text-neutral-400 i-hugeicons-search-01"></span>
215
- <input x-model="search" type="search" placeholder="Search path, client, status, or error" class="block pl-9 pr-3 py-2 w-full text-neutral-900 text-sm dark:text-white bg-white dark:bg-neutral-950 border border-neutral-300 rounded-lg dark:border-neutral-700 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20">
216
- </label>
217
- <label>
218
- <span class="sr-only">Method</span>
219
- <select x-model="methodFilter" class="px-3 py-2 w-full text-neutral-900 text-sm dark:text-white bg-white dark:bg-neutral-950 border border-neutral-300 rounded-lg dark:border-neutral-700">
220
- <option value="all">All methods</option>
221
- <option :for="method in methods()" :value="method">{{ method }}</option>
222
- </select>
223
- </label>
224
- <label>
225
- <span class="sr-only">Status</span>
226
- <select x-model="statusFilter" class="px-3 py-2 w-full text-neutral-900 text-sm dark:text-white bg-white dark:bg-neutral-950 border border-neutral-300 rounded-lg dark:border-neutral-700">
227
- <option value="all">All statuses</option>
228
- <option value="success">Below 400</option>
229
- <option value="error">400 and above</option>
230
- </select>
231
- </label>
212
+ <SearchFilter v-model:searchValue="search" placeholder="Search path, client, status, or error" ariaLabel="Search requests" />
213
+ <Select v-model:value="methodFilter" ariaLabel="Method" placeholder="" :options="[{ value: 'all', label: 'All methods' }, ...methods().map(method => ({ value: method, label: method }))]" />
214
+ <Select v-model:value="statusFilter" ariaLabel="Status" placeholder="" :options="[{ value: 'all', label: 'All statuses' }, { value: 'success', label: 'Below 400' }, { value: 'error', label: '400 and above' }]" />
232
215
  </div>
233
216
  </div>
234
217
 
@@ -242,11 +242,7 @@ onMount(() => {
242
242
  <h2 class="font-semibold text-neutral-900 dark:text-white">Native source inventory</h2>
243
243
  <p class="mt-1 text-neutral-500 text-xs dark:text-neutral-400">{{ page().note }}</p>
244
244
  </div>
245
- <label class="block relative w-full sm:max-w-xs">
246
- <span class="sr-only">Search {{ page().title.toLowerCase() }}</span>
247
- <span class="absolute left-3 top-2.5 h-4 w-4 text-neutral-400 i-hugeicons-search-01"></span>
248
- <input x-model="search" type="search" :placeholder="'Search ' + page().title.toLowerCase()" class="block pl-9 pr-3 py-2 w-full text-neutral-900 text-sm dark:text-white bg-white dark:bg-neutral-950 border border-neutral-300 rounded-lg dark:border-neutral-700 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20">
249
- </label>
245
+ <SearchFilter v-model:searchValue="search" :placeholder="'Search ' + page().title.toLowerCase()" :ariaLabel="'Search ' + page().title.toLowerCase()" class="w-full sm:max-w-xs" />
250
246
  </div>
251
247
 
252
248
  <Table
@@ -43,8 +43,7 @@ effect(() => {
43
43
  wasOpen = isOpen
44
44
  })
45
45
 
46
- function toggleScope(event: Event, scope: string): void {
47
- const enabled = (event.target as HTMLInputElement).checked
46
+ function toggleScope(scope: string, enabled: boolean): void {
48
47
  selectedScopes.set(enabled
49
48
  ? [...new Set([...selectedScopes(), scope])]
50
49
  : selectedScopes().filter(item => item !== scope))
@@ -97,38 +96,22 @@ async function copyToken(): Promise<void> {
97
96
  <div role="status" class="px-4 py-3 text-amber-800 text-sm dark:text-amber-200 bg-amber-50 dark:bg-amber-950/40 border border-amber-200 rounded-lg dark:border-amber-900">
98
97
  {{ message() }}
99
98
  </div>
100
- <label class="block">
101
- <span class="font-medium text-neutral-700 text-sm dark:text-neutral-300">New token</span>
102
- <textarea readonly rows="4" aria-label="New access token" class="block mt-2 p-3 w-full font-mono text-neutral-900 text-xs dark:text-white bg-neutral-50 dark:bg-neutral-950 border border-neutral-300 rounded-lg dark:border-neutral-700">{{ createdToken() }}</textarea>
103
- </label>
99
+ <div>
100
+ <Textarea :value="createdToken()" label="New token" ariaLabel="New access token" :readonly="true" :rows="4" :monospace="true" />
101
+ </div>
104
102
  </div>
105
103
 
106
- <form :if="!createdToken()" id="access-token-create-form" class="space-y-5" @submit.prevent="submit">
107
- <label class="block">
108
- <span class="font-medium text-neutral-700 text-sm dark:text-neutral-300">Token name</span>
109
- <input x-model="tokenName" name="name" type="text" maxlength="255" required placeholder="CI deployment" class="block mt-2 px-3 py-2 w-full text-neutral-900 text-sm dark:text-white bg-white dark:bg-neutral-950 border border-neutral-300 rounded-lg dark:border-neutral-700 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20">
110
- </label>
111
-
112
- <label class="block">
113
- <span class="font-medium text-neutral-700 text-sm dark:text-neutral-300">Expires after</span>
114
- <select x-model="expiryMinutes" name="expires_in_minutes" class="block mt-2 px-3 py-2 w-full text-neutral-900 text-sm dark:text-white bg-white dark:bg-neutral-950 border border-neutral-300 rounded-lg dark:border-neutral-700 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20">
115
- <option value="60">1 hour</option>
116
- <option value="1440">1 day</option>
117
- <option value="10080">7 days</option>
118
- <option value="43200">30 days</option>
119
- </select>
120
- </label>
104
+ <form :if="!createdToken()" id="access-token-create-form" class="grid gap-5" @submit.prevent="submit">
105
+ <Input v-model:value="tokenName" name="name" label="Token name" :maxLength="255" :required="true" placeholder="CI deployment" />
106
+ <Select v-model:value="expiryMinutes" name="expires_in_minutes" label="Expires after" placeholder="" :options="[{ value: '60', label: '1 hour' }, { value: '1440', label: '1 day' }, { value: '10080', label: '7 days' }, { value: '43200', label: '30 days' }]" />
121
107
 
122
108
  <fieldset>
123
109
  <legend class="font-medium text-neutral-700 text-sm dark:text-neutral-300">Scopes</legend>
124
110
  <div class="grid gap-2 grid-cols-1 sm:grid-cols-2 mt-2">
125
- <label :for="scope in availableScopes" class="flex gap-3 items-start p-3 border border-neutral-200 rounded-lg dark:border-neutral-700">
126
- <input name="scopes" type="checkbox" :value="scope.name" :checked="selectedScopes().includes(scope.name)" class="mt-0.5 h-4 w-4 text-blue-600 rounded" @change="toggleScope($event, scope.name)">
127
- <span>
128
- <span class="block font-medium text-neutral-900 text-sm dark:text-white">{{ scope.name }}</span>
129
- <span class="block mt-0.5 text-neutral-500 text-xs dark:text-neutral-400">{{ scope.description }}</span>
130
- </span>
131
- </label>
111
+ <!-- Several of many: a shared checkbox per scope. The loop is on the card, not the component. -->
112
+ <div :for="scope in availableScopes" class="p-3 border border-neutral-200 rounded-lg dark:border-neutral-700">
113
+ <Checkbox size="sm" :label="scope.name" :description="scope.description" :checked="selectedScopes().includes(scope.name)" @update:checked="toggleScope(scope.name, $event)" />
114
+ </div>
132
115
  </div>
133
116
  </fieldset>
134
117
  </form>
@@ -240,14 +240,10 @@ onMount(() => {
240
240
 
241
241
  <section class="flex flex-col gap-3">
242
242
  <div class="grid gap-3 grid-cols-1 sm:grid-cols-2 xl:grid-cols-5">
243
- <label class="relative sm:col-span-2">
244
- <span class="sr-only">Search product categories</span>
245
- <span class="flex absolute inset-y-0 left-0 items-center pl-3 text-gray-400 pointer-events-none"><span class="h-4 w-4 i-hugeicons-search-01"></span></span>
246
- <input x-model="search" type="search" placeholder="Search names, slugs, or descriptions" class="pl-9 pr-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700" />
247
- </label>
248
- <label><span class="sr-only">Category availability</span><select x-model="activeFilter" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700"><option value="all">Any availability</option><option value="active">Active</option><option value="inactive">Inactive</option></select></label>
249
- <label><span class="sr-only">Category hierarchy</span><select x-model="hierarchyFilter" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700"><option value="all">Any hierarchy</option><option value="root">Root categories</option><option value="child">Child categories</option></select></label>
250
- <label><span class="sr-only">Sort product categories</span><select x-model="sort" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700"><option value="order">Display order</option><option value="name">Name</option><option value="newest">Newest</option></select></label>
243
+ <div class="sm:col-span-2"><SearchFilter v-model:searchValue="search" placeholder="Search names, slugs, or descriptions" ariaLabel="Search product categories" /></div>
244
+ <Select v-model:value="activeFilter" ariaLabel="Category availability" placeholder="" :options="[{ value: 'all', label: 'Any availability' }, { value: 'active', label: 'Active' }, { value: 'inactive', label: 'Inactive' }]" />
245
+ <Select v-model:value="hierarchyFilter" ariaLabel="Category hierarchy" placeholder="" :options="[{ value: 'all', label: 'Any hierarchy' }, { value: 'root', label: 'Root categories' }, { value: 'child', label: 'Child categories' }]" />
246
+ <Select v-model:value="sort" ariaLabel="Sort product categories" placeholder="" :options="[{ value: 'order', label: 'Display order' }, { value: 'name', label: 'Name' }, { value: 'newest', label: 'Newest' }]" />
251
247
  </div>
252
248
 
253
249
  <div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
@@ -10,7 +10,7 @@ const busy = useReactiveProp('busy', false)
10
10
  const errors = useReactiveProp('errors', {} as Record<string, string>)
11
11
  const emit = defineEmits(['submit', 'close'])
12
12
  const name = state('')
13
- const description = state('')
13
+ const descriptionText = state('')
14
14
  const slug = state('')
15
15
  const imageUrl = state('')
16
16
  const isActive = state(true)
@@ -30,7 +30,7 @@ effect(() => {
30
30
  return
31
31
  hydrationKey = key
32
32
  name.set(current?.name || '')
33
- description.set(current?.description || '')
33
+ descriptionText.set(current?.description || '')
34
34
  slug.set(current?.slug || '')
35
35
  imageUrl.set(current?.imageUrl || '')
36
36
  isActive.set(current?.isActive ?? true)
@@ -94,7 +94,7 @@ function submit(): void {
94
94
  return
95
95
  emit('submit', {
96
96
  name: name().trim(),
97
- description: description().trim(),
97
+ description: descriptionText().trim(),
98
98
  slug: slugify(slug()),
99
99
  imageUrl: imageUrl().trim(),
100
100
  isActive: isActive(),
@@ -121,12 +121,12 @@ function errorMessages(): string[] {
121
121
  <li :for="message in errorMessages()" :key="message">{{ message }}</li>
122
122
  </ul>
123
123
  <div class="grid gap-4 grid-cols-1 sm:grid-cols-2">
124
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Name</span><input x-model="name" type="text" maxlength="50" required class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" /></label>
125
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Slug</span><input x-model="slug" type="text" required spellcheck="false" class="mt-1 px-3 py-2 w-full font-mono text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" @input="markSlugTouched" @blur="normalizeSlug" /></label>
126
- <label class="block sm:col-span-2"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Description</span><textarea x-model="description" rows="3" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700"></textarea></label>
127
- <label class="block sm:col-span-2"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Image URL</span><input x-model="imageUrl" type="text" placeholder="Optional persisted asset URL" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" /><span class="block mt-1 text-gray-500 text-xs dark:text-neutral-500">Use a stored asset URL. File uploads belong to the native storage workflow.</span></label>
128
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Parent category</span><select x-model="parentCategoryId" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700"><option value="">Root category</option><option :for="option in parentOptions()" :key="option.id" :value="option.id">{{ option.name }}</option></select></label>
129
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Display order</span><input x-model="displayOrder" type="number" min="0" step="1" required class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" /></label>
124
+ <Input v-model:value="name" label="Name" :maxLength="50" :required="true" />
125
+ <Input v-model:value="slug" label="Slug" :required="true" :spellcheck="false" :monospace="true" @input="markSlugTouched" @blur="normalizeSlug" />
126
+ <div class="sm:col-span-2"><Textarea v-model:value="descriptionText" label="Description" :rows="3" /></div>
127
+ <div class="sm:col-span-2"><Input v-model:value="imageUrl" label="Image URL" placeholder="Optional persisted asset URL" hint="Use a stored asset URL. File uploads belong to the native storage workflow." /></div>
128
+ <Select v-model:value="parentCategoryId" label="Parent category" placeholder="" :options="[{ value: '', label: 'Root category' }, ...parentOptions().map(option => ({ value: option.id, label: option.name }))]" />
129
+ <Input v-model:value="displayOrder" label="Display order" type="number" min="0" step="1" :required="true" />
130
130
  <div class="sm:col-span-2 p-3 border border-gray-200 rounded-lg dark:border-neutral-700">
131
131
  <Toggle v-model:checked="isActive" label="Active in the storefront" description="Availability is independent from the hierarchy." labelPosition="left" />
132
132
  </div>
@@ -15,7 +15,7 @@ const busy = useReactiveProp('busy', false)
15
15
  const errors = useReactiveProp('errors', {} as Record<string, string>)
16
16
  const emit = defineEmits(['submit', 'close'])
17
17
  const code = state('')
18
- const description = state('')
18
+ const descriptionText = state('')
19
19
  const status = state<CouponStatus>('Active')
20
20
  const isActive = state(true)
21
21
  const discountType = state<CouponDiscountType>('percentage')
@@ -39,7 +39,7 @@ effect(() => {
39
39
  return
40
40
  hydrationKey = key
41
41
  code.set(current?.code || '')
42
- description.set(current?.description || '')
42
+ descriptionText.set(current?.description || '')
43
43
  status.set(current?.status || 'Active')
44
44
  isActive.set(current?.isActive ?? true)
45
45
  discountType.set(current?.discountType || 'percentage')
@@ -88,7 +88,7 @@ function submit(): void {
88
88
  return
89
89
  emit('submit', {
90
90
  code: code().trim().toUpperCase(),
91
- description: description().trim(),
91
+ description: descriptionText().trim(),
92
92
  status: status(),
93
93
  isActive: isActive(),
94
94
  discountType: discountType(),
@@ -121,17 +121,17 @@ function errorMessages(): string[] {
121
121
  <li :for="message in errorMessages()" :key="message">{{ message }}</li>
122
122
  </ul>
123
123
  <div class="grid gap-4 grid-cols-1 sm:grid-cols-2">
124
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Code</span><input x-model="code" type="text" maxlength="50" required spellcheck="false" class="mt-1 px-3 py-2 w-full font-mono text-gray-900 text-sm uppercase dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" /></label>
125
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Status</span><select x-model="status" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700"><option value="Active">Active</option><option value="Scheduled">Scheduled</option><option value="Expired">Expired</option></select></label>
126
- <label class="block sm:col-span-2"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Description</span><textarea x-model="description" rows="3" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700"></textarea></label>
127
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Discount type</span><select x-model="discountType" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700"><option value="percentage">Percentage</option><option value="fixed_amount">Fixed amount</option></select></label>
128
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Discount value</span><input x-model="discountValue" type="number" :min="discountType() === 'fixed_amount' ? '0' : '0.01'" :step="discountType() === 'fixed_amount' ? moneyInputStep(currency()) : '0.01'" required class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" /></label>
129
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Minimum order amount</span><input x-model="minOrderAmount" type="number" min="0" :step="moneyInputStep(currency())" placeholder="No minimum" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" /></label>
130
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Maximum discount amount</span><input x-model="maxDiscountAmount" type="number" min="0" :step="moneyInputStep(currency())" placeholder="No maximum" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" /></label>
131
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Usage limit</span><input x-model="usageLimit" type="number" min="1" step="1" placeholder="No limit" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" /></label>
132
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Free product ID</span><input x-model="freeProductId" type="text" placeholder="Optional" class="mt-1 px-3 py-2 w-full font-mono text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" /></label>
133
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Start date</span><input x-model="startDate" type="date" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" /></label>
134
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">End date</span><input x-model="endDate" type="date" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" /></label>
124
+ <Input v-model:value="code" label="Code" :maxLength="50" :required="true" :spellcheck="false" :monospace="true" class="uppercase" />
125
+ <Select v-model:value="status" label="Status" placeholder="" :options="[{ value: 'Active', label: 'Active' }, { value: 'Scheduled', label: 'Scheduled' }, { value: 'Expired', label: 'Expired' }]" />
126
+ <div class="sm:col-span-2"><Textarea v-model:value="descriptionText" label="Description" :rows="3" /></div>
127
+ <Select v-model:value="discountType" label="Discount type" placeholder="" :options="[{ value: 'percentage', label: 'Percentage' }, { value: 'fixed_amount', label: 'Fixed amount' }]" />
128
+ <Input v-model:value="discountValue" label="Discount value" type="number" :min="discountType() === 'fixed_amount' ? '0' : '0.01'" :step="discountType() === 'fixed_amount' ? moneyInputStep(currency()) : '0.01'" :required="true" />
129
+ <Input v-model:value="minOrderAmount" label="Minimum order amount" type="number" min="0" :step="moneyInputStep(currency())" placeholder="No minimum" />
130
+ <Input v-model:value="maxDiscountAmount" label="Maximum discount amount" type="number" min="0" :step="moneyInputStep(currency())" placeholder="No maximum" />
131
+ <Input v-model:value="usageLimit" label="Usage limit" type="number" min="1" step="1" placeholder="No limit" />
132
+ <Input v-model:value="freeProductId" label="Free product ID" placeholder="Optional" :monospace="true" />
133
+ <Input v-model:value="startDate" label="Start date" type="date" />
134
+ <Input v-model:value="endDate" label="End date" type="date" />
135
135
  <div class="sm:col-span-2 p-3 border border-gray-200 rounded-lg dark:border-neutral-700">
136
136
  <Toggle v-model:checked="isActive" label="Enabled for redemption" description="Availability is stored separately from lifecycle status." labelPosition="left" />
137
137
  </div>
@@ -222,15 +222,11 @@ onMount(() => {
222
222
 
223
223
  <section class="flex flex-col gap-3">
224
224
  <div class="grid gap-3 grid-cols-1 sm:grid-cols-2 xl:grid-cols-6">
225
- <label class="relative sm:col-span-2">
226
- <span class="sr-only">Search coupons</span>
227
- <span class="flex absolute inset-y-0 left-0 items-center pl-3 text-gray-400 pointer-events-none"><span class="h-4 w-4 i-hugeicons-search-01"></span></span>
228
- <input x-model="search" type="search" placeholder="Search codes, descriptions, or products" class="pl-9 pr-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700" />
229
- </label>
230
- <label><span class="sr-only">Coupon status</span><select x-model="statusFilter" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700"><option value="all">All statuses</option><option value="Active">Active</option><option value="Scheduled">Scheduled</option><option value="Expired">Expired</option></select></label>
231
- <label><span class="sr-only">Coupon availability</span><select x-model="enabledFilter" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700"><option value="all">Any availability</option><option value="enabled">Enabled</option><option value="disabled">Disabled</option></select></label>
232
- <label><span class="sr-only">Discount type</span><select x-model="typeFilter" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700"><option value="all">All discount types</option><option value="percentage">Percentage</option><option value="fixed_amount">Fixed amount</option></select></label>
233
- <label><span class="sr-only">Sort coupons</span><select x-model="sort" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700"><option value="newest">Newest</option><option value="code">Code</option><option value="usage">Most used</option><option value="expiry">Expiry date</option></select></label>
225
+ <div class="sm:col-span-2"><SearchFilter v-model:searchValue="search" placeholder="Search codes, descriptions, or products" ariaLabel="Search coupons" /></div>
226
+ <Select v-model:value="statusFilter" ariaLabel="Coupon status" placeholder="" :options="[{ value: 'all', label: 'All statuses' }, { value: 'Active', label: 'Active' }, { value: 'Scheduled', label: 'Scheduled' }, { value: 'Expired', label: 'Expired' }]" />
227
+ <Select v-model:value="enabledFilter" ariaLabel="Coupon availability" placeholder="" :options="[{ value: 'all', label: 'Any availability' }, { value: 'enabled', label: 'Enabled' }, { value: 'disabled', label: 'Disabled' }]" />
228
+ <Select v-model:value="typeFilter" ariaLabel="Discount type" placeholder="" :options="[{ value: 'all', label: 'All discount types' }, { value: 'percentage', label: 'Percentage' }, { value: 'fixed_amount', label: 'Fixed amount' }]" />
229
+ <Select v-model:value="sort" ariaLabel="Sort coupons" placeholder="" :options="[{ value: 'newest', label: 'Newest' }, { value: 'code', label: 'Code' }, { value: 'usage', label: 'Most used' }, { value: 'expiry', label: 'Expiry date' }]" />
234
230
  </div>
235
231
 
236
232
  <div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">