astryx-dracula 0.5.0 → 0.6.2

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 (129) hide show
  1. package/BRAND.md +3 -3
  2. package/README.md +7 -4
  3. package/USAGE.md +49 -49
  4. package/astryx-dracula.d.ts +2 -2
  5. package/astryx-dracula.js +25 -9
  6. package/astryx-dracula.variants.d.ts +2 -2
  7. package/astryx.integration.mjs +1 -1
  8. package/icons.mjs +21 -17
  9. package/icons.tsx +69 -62
  10. package/package.json +125 -120
  11. package/shared/auth-chrome-config.ts +6 -6
  12. package/shared/auth-chrome.tsx +143 -144
  13. package/shared/auth-copy.ts +14 -14
  14. package/shared/chaptered-doc-config.ts +48 -51
  15. package/shared/chaptered-doc.tsx +267 -289
  16. package/shared/chart-hues.ts +25 -10
  17. package/shared/chart-labels.tsx +31 -30
  18. package/shared/chart-legend.tsx +55 -56
  19. package/shared/chart-panel-style.ts +3 -3
  20. package/shared/data-bar.tsx +97 -102
  21. package/shared/format-money.ts +1 -1
  22. package/shared/gallery-image.ts +6 -6
  23. package/shared/login-demo.ts +1 -1
  24. package/shared/metric-card.tsx +101 -105
  25. package/shared/metric-delta.tsx +28 -27
  26. package/shared/order-desk.tsx +205 -216
  27. package/shared/revenue-chart.tsx +145 -165
  28. package/shared/scene-castle.tsx +206 -291
  29. package/shared/scene-frame.tsx +33 -32
  30. package/shared/scene-hues.ts +17 -17
  31. package/shared/scene-tile.tsx +88 -92
  32. package/shared/settings-data.ts +119 -125
  33. package/shared/settings-rows.tsx +122 -159
  34. package/shared/sparkline.tsx +75 -88
  35. package/shared/sso-icons.tsx +10 -22
  36. package/shared/stars.tsx +16 -25
  37. package/templates/ai-chat-landing.template.mjs +5 -4
  38. package/templates/ai-chat-landing.tsx +473 -460
  39. package/templates/ai-chat.template.mjs +5 -4
  40. package/templates/ai-chat.tsx +543 -612
  41. package/templates/blank.template.mjs +5 -4
  42. package/templates/blank.tsx +18 -14
  43. package/templates/centered-hero.template.mjs +5 -4
  44. package/templates/centered-hero.tsx +55 -68
  45. package/templates/classic-gallery.template.mjs +5 -4
  46. package/templates/classic-gallery.tsx +97 -104
  47. package/templates/contact-form.template.mjs +5 -4
  48. package/templates/contact-form.tsx +247 -282
  49. package/templates/dashboard-portfolio.template.mjs +5 -4
  50. package/templates/dashboard-portfolio.tsx +717 -548
  51. package/templates/dashboard.template.mjs +5 -4
  52. package/templates/dashboard.tsx +596 -567
  53. package/templates/detail-page.template.mjs +5 -4
  54. package/templates/detail-page.tsx +546 -603
  55. package/templates/documentation-design.template.mjs +5 -4
  56. package/templates/documentation-design.tsx +231 -243
  57. package/templates/documentation-technical.template.mjs +5 -4
  58. package/templates/documentation-technical.tsx +236 -239
  59. package/templates/documentation.template.mjs +5 -4
  60. package/templates/documentation.tsx +267 -279
  61. package/templates/editor.template.mjs +5 -4
  62. package/templates/editor.tsx +844 -877
  63. package/templates/file-explorer.template.mjs +5 -4
  64. package/templates/file-explorer.tsx +566 -590
  65. package/templates/form-two-column.template.mjs +5 -4
  66. package/templates/form-two-column.tsx +195 -210
  67. package/templates/gallery-hero.template.mjs +5 -4
  68. package/templates/gallery-hero.tsx +93 -114
  69. package/templates/ide.template.mjs +5 -4
  70. package/templates/ide.tsx +407 -453
  71. package/templates/incident-console.template.mjs +5 -4
  72. package/templates/incident-console.tsx +593 -575
  73. package/templates/kanban-board.template.mjs +5 -4
  74. package/templates/kanban-board.tsx +665 -683
  75. package/templates/library.template.mjs +5 -4
  76. package/templates/library.tsx +409 -430
  77. package/templates/login-card.template.mjs +5 -4
  78. package/templates/login-card.tsx +63 -72
  79. package/templates/login-split.template.mjs +5 -4
  80. package/templates/login-split.tsx +192 -193
  81. package/templates/login-sso.template.mjs +5 -4
  82. package/templates/login-sso.tsx +257 -258
  83. package/templates/login.template.mjs +5 -4
  84. package/templates/login.tsx +53 -49
  85. package/templates/messaging-shell.template.mjs +5 -4
  86. package/templates/messaging-shell.tsx +556 -574
  87. package/templates/mixed-gallery.template.mjs +5 -4
  88. package/templates/mixed-gallery.tsx +60 -58
  89. package/templates/payment-form.template.mjs +5 -4
  90. package/templates/payment-form.tsx +882 -991
  91. package/templates/product-detail.template.mjs +5 -4
  92. package/templates/product-detail.tsx +261 -272
  93. package/templates/product-gallery.template.mjs +5 -4
  94. package/templates/product-gallery.tsx +126 -137
  95. package/templates/product-tour.template.mjs +5 -4
  96. package/templates/product-tour.tsx +741 -773
  97. package/templates/settings-dialog.template.mjs +5 -4
  98. package/templates/settings-dialog.tsx +688 -717
  99. package/templates/settings-sidebar.template.mjs +5 -4
  100. package/templates/settings-sidebar.tsx +762 -807
  101. package/templates/settings.template.mjs +5 -4
  102. package/templates/settings.tsx +289 -304
  103. package/templates/shell-nav.template.mjs +5 -4
  104. package/templates/shell-nav.tsx +212 -219
  105. package/templates/shell-side-nav.template.mjs +5 -4
  106. package/templates/shell-side-nav.tsx +135 -157
  107. package/templates/shell-top-nav.template.mjs +5 -4
  108. package/templates/shell-top-nav.tsx +182 -203
  109. package/templates/side-gallery.template.mjs +5 -4
  110. package/templates/side-gallery.tsx +85 -90
  111. package/templates/table-grouped.template.mjs +5 -4
  112. package/templates/table-grouped.tsx +1000 -1053
  113. package/templates/table-page-chart.template.mjs +5 -4
  114. package/templates/table-page-chart.tsx +400 -398
  115. package/templates/table-page-heatmap-status.template.mjs +5 -4
  116. package/templates/table-page-heatmap-status.tsx +483 -512
  117. package/templates/table-page-shoe-store-heatmap.template.mjs +5 -4
  118. package/templates/table-page-shoe-store-heatmap.tsx +748 -746
  119. package/templates/table-page.template.mjs +5 -4
  120. package/templates/table-page.tsx +396 -405
  121. package/templates/table.template.mjs +5 -4
  122. package/templates/table.tsx +92 -93
  123. package/templates/tech-report.template.mjs +5 -4
  124. package/templates/tech-report.tsx +1316 -1304
  125. package/templates/theme-showcase.template.mjs +5 -4
  126. package/templates/theme-showcase.tsx +871 -951
  127. package/theme.css +35 -77
  128. package/theme.css.d.ts +9 -0
  129. package/tokens.css +373 -380
@@ -1,108 +1,90 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
- // XLE (canonical structure, validated with `bunx astryx layout check`):
3
- // L > LC[p=0] > Ctr > S.transparent[p=6 mw=1100] > V[g=5] > (V[g=6] > (V[g=2] > (Hd"Payment Request"[level=1 t=display-2] + Tx"Review your order"[t=body]) + D) + H[g=8] > (SI > V[g=8] > (V[g=1] > (H[j=between] > (Hd"Sign in to check out"[level=2] + B"Sign in") + Tx"Sign in to track your order"[t=body]) + V[g=3] > (Hd"Contact information"[level=2] + TI"Email" + CB"Email offers") + V[g=3] > (Hd"Shipping information"[level=2] + G[c=2 g=3] > (TI"First Name" + TI"Last Name") + TI"Address" + G[c=2 g=3] > (TI"City" + TI"ZIP Code") + SE"State" + TI"Phone Number" + CB"Save information") + V[g=3] > (V[g=1] > (Hd"Delivery"[level=2] + Tx"Processing time"[t=body]) + RL"Delivery method" > RLI*2) + V[g=3] > (V[g=1] > (Hd"Payment method"[level=2] + Tx"Encrypted"[t=body]) + G[c=2 g=3] > (B"PayPal" + B"Google Pay") + D"Or pay with card" + TI"Card Number" + G[c=3 g=3] > (SE"Expiry Month" + SE"Expiry Year" + TI"CVC") + TI"Name on Card" + CB"Billing address") + V[g=3] > (Hd"Promo code"[level=2] + H[g=2] > (TI"Promo code" + B"Apply")) + V[g=3] > (Hd"Gift options"[level=2] + CB"Gift message" + TA"Gift message") + V[g=4] > (H[g=5] > (H[g=1] > (Ic + Tx))*3 + V[g=2] > (B"Place order"[primary] + B"Continue shopping") + D + H[g=4] > (Lk"Refund policy" + Lk"Privacy policy" + Lk"Terms" + Lk"Cancellations"))) + SI > C[p=4] > Col"Order Summary" > V[g=4] > (V[g=3] > H[g=3] > (Tmb + V[g=1] > (Tx"Obsidian Ritual Chalice" + Tx"Hand-carved"[t=supporting])))*3 + V[g=3] > (Hd"Order Total"[level=3] + H[j=between] > (Tx"Subtotal" + Tx"$91.20") + D + H[j=between] > (Tx"Total"[t=large] + Tx"$91.20"[t=large]) + Bn"Free shipping over $300"))))
4
-
5
- import {useState, type CSSProperties} from 'react';
6
- import {
7
- VStack,
8
- HStack,
9
- Stack,
10
- StackItem,
11
- Layout,
12
- LayoutContent,
13
- } from '@astryxdesign/core/Layout';
14
- import {Grid} from '@astryxdesign/core/Grid';
15
- import {Button} from '@astryxdesign/core/Button';
16
- import {Text, Heading} from '@astryxdesign/core/Text';
17
- import {TextInput} from '@astryxdesign/core/TextInput';
18
- import {Selector} from '@astryxdesign/core/Selector';
19
- import {CheckboxInput} from '@astryxdesign/core/CheckboxInput';
20
- import {RadioList, RadioListItem} from '@astryxdesign/core/RadioList';
21
- import {Link} from '@astryxdesign/core/Link';
22
- import {TextArea} from '@astryxdesign/core/TextArea';
23
- import {Divider} from '@astryxdesign/core/Divider';
24
- import {Banner} from '@astryxdesign/core/Banner';
25
- import {Card} from '@astryxdesign/core/Card';
26
- import {type SceneHue} from 'astryx-dracula/shared/scene-hues';
27
- import {SceneTile} from 'astryx-dracula/shared/scene-tile';
28
- import {Collapsible} from '@astryxdesign/core/Collapsible';
29
- import {StatusDot} from '@astryxdesign/core/StatusDot';
30
- import {NumberInput} from '@astryxdesign/core/NumberInput';
31
- import {useMediaQuery} from '@astryxdesign/core/hooks';
32
- import {Section} from '@astryxdesign/core/Section';
33
- import {Center} from '@astryxdesign/core/Center';
34
- import {Icon} from '@astryxdesign/core/Icon';
35
- import {ShieldCheck, Lock, CircleCheck, Truck} from 'lucide-react';
2
+ // XLE (canonical structure of the tree below; the CLI had no XLE validator
3
+ // after `astryx layout` was removed in 0.7.0, so this is a reading aid and a
4
+ // human drift check — update it with the file, never alone):
5
+ // L[h=fill] > LC[p=0] > Ctr > S.transparent[p=6 mw=1100] > V[g=5] > (V[g=6] > (V[g=2] > (Hd"Payment Request"[level=1 t=display-2] + Tx"Review your order"[t=body]) + D) + H[g=8] > (SI > V[g=8] > (V[g=1] > (H[j=between] > (Hd"Sign in to check out"[level=2] + B.secondary"Sign in") + Tx"Sign in to track your order"[t=body]) + V[g=3] > (Hd"Contact information"[level=2] + TI"Email" + CB"Email me with news and offers") + V[g=3] > (Hd"Shipping information"[level=2] + G[c=2 g=3] > (TI"First Name" + TI"Last Name") + TI"Address" + G[c=2 g=3] > (TI"City" + TI"ZIP Code") + SE"State" + TI"Phone Number" + CB"Save my information for a faster checkout") + V[g=3] > (V[g=1] > (Hd"Delivery"[level=2] + Tx"Processing time"[t=body])) + (RL"Delivery method" > RLI*2) + V[g=3] > (V[g=1] > (Hd"Payment method"[level=2] + Tx"Encrypted"[t=body])) + (V[g=3] > G[c=2 g=3] > (B.secondary"PayPal" + B.secondary"Google Pay")) + D"Or pay with card" + (V[g=3] > TI"Card Number" + G[c=3 g=3] > (SE"Expiry Month" + SE"Expiry Year" + TI"CVC") + TI"Name on Card" + CB"Use shipping address as billing address" + (V[g=3] > TI"Address" + G[c=2 g=3] > (TI"City" + TI"ZIP Code") + SE"State")) + V[g=3] > (Hd"Promo code"[level=2] + H[g=2] > (TI"Promo code" + B.secondary"Apply")) + V[g=3] > (Hd"Gift options"[level=2] + CB"Add a gift message" + (V[g=3] > (G[c=2 g=3] > (TI"To" + TI"From")) + TA"Gift message")) + V[g=4] > (H[g=5] > (H[g=1] > (Ic + Tx))*3 + V[g=2] > (B.primary"Place order" + B.secondary"Continue shopping") + D + H[g=4] > (Lk"Refund policy" + Lk"Privacy policy" + Lk"Terms of service" + Lk"Cancellations"))) + SI > C[p=4] > Col"Order Summary" > V[g=4] > (H[g=3] > (C[p=0] > Scene{SceneTile}) + (SI > V[g=1] > (Tx"Obsidian Ritual Chalice" + Tx"Hand-carved · 12 oz"[t=supporting] + (H[g=2] > NI"Qty" + B.ghost"Remove" + B.ghost"Save"))))*3 + V[g=3] > (Hd"Order Total"[level=3] + V[g=2] > (H[j=between] > (Tx"Subtotal" + Tx"$230.00")) + (H[j=between] > (Tx"Shipping" + Tx"$4.95")) + (H[j=between] > (Tx"Tax" + Tx"$18.40")) + D + (H[j=between] > (Tx"Total"[t=large] + Tx"$253.35"[t=large])) + Bn"Free shipping on orders over $300")))
6
+
7
+ import { Banner } from "@astryxdesign/core/Banner";
8
+ import { Button } from "@astryxdesign/core/Button";
9
+ import { Card } from "@astryxdesign/core/Card";
10
+ import { Center } from "@astryxdesign/core/Center";
11
+ import { CheckboxInput } from "@astryxdesign/core/CheckboxInput";
12
+ import { Collapsible } from "@astryxdesign/core/Collapsible";
13
+ import { Divider } from "@astryxdesign/core/Divider";
14
+ import { Grid } from "@astryxdesign/core/Grid";
15
+ import { useMediaQuery } from "@astryxdesign/core/hooks";
16
+ import { Icon } from "@astryxdesign/core/Icon";
17
+ import { HStack, Layout, LayoutContent, Stack, StackItem, VStack } from "@astryxdesign/core/Layout";
18
+ import { Link } from "@astryxdesign/core/Link";
19
+ import { NumberInput } from "@astryxdesign/core/NumberInput";
20
+ import { RadioList, RadioListItem } from "@astryxdesign/core/RadioList";
21
+ import { Section } from "@astryxdesign/core/Section";
22
+ import { Selector } from "@astryxdesign/core/Selector";
23
+ import { StatusDot } from "@astryxdesign/core/StatusDot";
24
+ import { Heading, Text } from "@astryxdesign/core/Text";
25
+ import { TextArea } from "@astryxdesign/core/TextArea";
26
+ import { TextInput } from "@astryxdesign/core/TextInput";
27
+ import type { SceneHue } from "astryx-dracula/shared/scene-hues";
28
+ import { SceneTile } from "astryx-dracula/shared/scene-tile";
29
+ import { CircleCheck, Lock, ShieldCheck, Truck } from "lucide-react";
30
+ import { type CSSProperties, useState } from "react";
36
31
 
37
32
  // ── Constants ─────────────────────────────────────────────────────────────────
38
33
 
39
- const MONTHS = [
40
- '01',
41
- '02',
42
- '03',
43
- '04',
44
- '05',
45
- '06',
46
- '07',
47
- '08',
48
- '09',
49
- '10',
50
- '11',
51
- '12',
52
- ];
53
- const YEARS = Array.from({length: 12}, (_, i) => String(2025 + i));
34
+ const MONTHS = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
35
+ const YEARS = Array.from({ length: 12 }, (_, i) => String(2025 + i));
54
36
 
55
37
  const US_STATES = [
56
- 'Alabama',
57
- 'Alaska',
58
- 'Arizona',
59
- 'Arkansas',
60
- 'California',
61
- 'Colorado',
62
- 'Connecticut',
63
- 'Delaware',
64
- 'Florida',
65
- 'Georgia',
66
- 'Hawaii',
67
- 'Idaho',
68
- 'Illinois',
69
- 'Indiana',
70
- 'Iowa',
71
- 'Kansas',
72
- 'Kentucky',
73
- 'Louisiana',
74
- 'Maine',
75
- 'Maryland',
76
- 'Massachusetts',
77
- 'Michigan',
78
- 'Minnesota',
79
- 'Mississippi',
80
- 'Missouri',
81
- 'Montana',
82
- 'Nebraska',
83
- 'Nevada',
84
- 'New Hampshire',
85
- 'New Jersey',
86
- 'New Mexico',
87
- 'New York',
88
- 'North Carolina',
89
- 'North Dakota',
90
- 'Ohio',
91
- 'Oklahoma',
92
- 'Oregon',
93
- 'Pennsylvania',
94
- 'Rhode Island',
95
- 'South Carolina',
96
- 'South Dakota',
97
- 'Tennessee',
98
- 'Texas',
99
- 'Utah',
100
- 'Vermont',
101
- 'Virginia',
102
- 'Washington',
103
- 'West Virginia',
104
- 'Wisconsin',
105
- 'Wyoming',
38
+ "Alabama",
39
+ "Alaska",
40
+ "Arizona",
41
+ "Arkansas",
42
+ "California",
43
+ "Colorado",
44
+ "Connecticut",
45
+ "Delaware",
46
+ "Florida",
47
+ "Georgia",
48
+ "Hawaii",
49
+ "Idaho",
50
+ "Illinois",
51
+ "Indiana",
52
+ "Iowa",
53
+ "Kansas",
54
+ "Kentucky",
55
+ "Louisiana",
56
+ "Maine",
57
+ "Maryland",
58
+ "Massachusetts",
59
+ "Michigan",
60
+ "Minnesota",
61
+ "Mississippi",
62
+ "Missouri",
63
+ "Montana",
64
+ "Nebraska",
65
+ "Nevada",
66
+ "New Hampshire",
67
+ "New Jersey",
68
+ "New Mexico",
69
+ "New York",
70
+ "North Carolina",
71
+ "North Dakota",
72
+ "Ohio",
73
+ "Oklahoma",
74
+ "Oregon",
75
+ "Pennsylvania",
76
+ "Rhode Island",
77
+ "South Carolina",
78
+ "South Dakota",
79
+ "Tennessee",
80
+ "Texas",
81
+ "Utah",
82
+ "Vermont",
83
+ "Virginia",
84
+ "Washington",
85
+ "West Virginia",
86
+ "Wisconsin",
87
+ "Wyoming",
106
88
  ];
107
89
 
108
90
  // One Dracula accent per line item, from the fixed categorical vocabulary.
@@ -110,36 +92,36 @@ const US_STATES = [
110
92
  // this map is typed `SceneHue`. `Record<string, string>` let any caller slip
111
93
  // purple through to a scene; the union is what stops the next one.
112
94
  const ITEM_HUES: Record<string, SceneHue> = {
113
- '1': 'var(--dracula-cyan)',
114
- '2': 'var(--dracula-pink)',
115
- '3': 'var(--dracula-yellow)',
95
+ "1": "var(--dracula-cyan)",
96
+ "2": "var(--dracula-pink)",
97
+ "3": "var(--dracula-yellow)",
116
98
  };
117
99
 
118
100
  const ORDER_ITEMS = [
119
- {
120
- id: '1',
121
- name: 'Obsidian Ritual Chalice',
122
- variant: 'Hand-carved · 12 oz',
123
- price: 78,
124
- qty: 1,
125
- limited: false,
126
- },
127
- {
128
- id: '2',
129
- name: 'Blood-Moon Offering Plate',
130
- variant: 'Moon-glazed · 10 in',
131
- price: 72,
132
- qty: 1,
133
- limited: false,
134
- },
135
- {
136
- id: '3',
137
- name: 'Crypt Cereal Bowl',
138
- variant: 'Speckled obsidian · 6 in',
139
- price: 80,
140
- qty: 1,
141
- limited: true,
142
- },
101
+ {
102
+ id: "1",
103
+ name: "Obsidian Ritual Chalice",
104
+ variant: "Hand-carved · 12 oz",
105
+ price: 78,
106
+ qty: 1,
107
+ limited: false,
108
+ },
109
+ {
110
+ id: "2",
111
+ name: "Blood-Moon Offering Plate",
112
+ variant: "Moon-glazed · 10 in",
113
+ price: 72,
114
+ qty: 1,
115
+ limited: false,
116
+ },
117
+ {
118
+ id: "3",
119
+ name: "Crypt Cereal Bowl",
120
+ variant: "Speckled obsidian · 6 in",
121
+ price: 80,
122
+ qty: 1,
123
+ limited: true,
124
+ },
143
125
  ];
144
126
 
145
127
  const TAX_RATE = 0.08;
@@ -150,913 +132,822 @@ const fmt = (n: number) => `$${n.toFixed(2)}`;
150
132
  // Plain inline styles using Astryx design-token CSS variables (declared at
151
133
  // :root by `@astryxdesign/core/astryx.css`). No StyleX compiler required.
152
134
 
153
- const fullWidth: CSSProperties = {width: '100%'};
135
+ const fullWidth: CSSProperties = { width: "100%" };
154
136
  // Form column flex-basis so the two checkout columns share width evenly.
155
- const formColBasis: CSSProperties = {flexBasis: 0};
137
+ const formColBasis: CSSProperties = { flexBasis: 0 };
156
138
  // Space the Order Summary content below its collapsible trigger title.
157
- const summaryContent: CSSProperties = {paddingBlockStart: 'var(--spacing-2)'};
139
+ const summaryContent: CSSProperties = { paddingBlockStart: "var(--spacing-2)" };
158
140
  // Order-summary column: sticky beside the form on desktop.
159
141
  const summarySticky: CSSProperties = {
160
- flexBasis: 0,
161
- position: 'sticky',
162
- top: 'var(--spacing-4)',
163
- alignSelf: 'flex-start',
142
+ flexBasis: 0,
143
+ position: "sticky",
144
+ top: "var(--spacing-4)",
145
+ alignSelf: "flex-start",
164
146
  };
165
147
  // On mobile the summary moves above the form.
166
- const summaryMobileOrder: CSSProperties = {order: -1};
148
+ const summaryMobileOrder: CSSProperties = { order: -1 };
167
149
  // Line-item photo: fixed square frame; art lives in shared/scene-tile
168
150
  // (lg fork). Astryx has no Image primitive (#2582), so the tile is inline
169
151
  // SVG on brand tokens instead of a data-URI bitmap with baked-in hex.
170
152
  const itemPhotoFrame: CSSProperties = {
171
- width: 'var(--spacing-10)',
172
- height: 'var(--spacing-10)',
173
- overflow: 'clip',
174
- flexShrink: 0,
153
+ width: "var(--spacing-10)",
154
+ height: "var(--spacing-10)",
155
+ overflow: "clip",
156
+ flexShrink: 0,
175
157
  };
176
158
  // Accepted card-network marks (Visa/Mastercard/Amex), shared style.
177
159
  const cardLogo: CSSProperties = {
178
- height: 'var(--spacing-7)',
179
- width: 'auto',
180
- borderRadius: 'var(--radius-element)',
181
- borderWidth: 'var(--border-width)',
182
- borderStyle: 'solid',
183
- borderColor: 'var(--color-separator)',
184
- backgroundColor: 'var(--color-background-surface)',
160
+ height: "var(--spacing-7)",
161
+ width: "auto",
162
+ borderRadius: "var(--radius-element)",
163
+ borderWidth: "var(--border-width)",
164
+ borderStyle: "solid",
165
+ borderColor: "var(--color-separator)",
166
+ backgroundColor: "var(--color-background-surface)",
185
167
  };
186
168
 
187
- function OrderItemPhoto({item}: {item: (typeof ORDER_ITEMS)[number]}) {
188
- return (
189
- <Card padding={0} style={itemPhotoFrame}>
190
- <SceneTile label={item.name} hue={ITEM_HUES[item.id]} size="lg" />
191
- </Card>
192
- );
169
+ function OrderItemPhoto({ item }: { item: (typeof ORDER_ITEMS)[number] }) {
170
+ return (
171
+ <Card padding={0} style={itemPhotoFrame}>
172
+ <SceneTile label={item.name} hue={ITEM_HUES[item.id]} size="lg" />
173
+ </Card>
174
+ );
193
175
  }
194
176
 
195
177
  function OrderLineItem({
196
- item,
197
- qty,
198
- onChangeQty,
178
+ item,
179
+ qty,
180
+ onChangeQty,
199
181
  }: {
200
- item: (typeof ORDER_ITEMS)[number];
201
- qty: number;
202
- onChangeQty: (v: number) => void;
182
+ item: (typeof ORDER_ITEMS)[number];
183
+ qty: number;
184
+ onChangeQty: (v: number) => void;
203
185
  }) {
204
- return (
205
- <HStack gap={3} vAlign="start">
206
- <OrderItemPhoto item={item} />
207
- <StackItem size="fill">
208
- <VStack gap={1}>
209
- <HStack gap={2} hAlign="between" vAlign="start">
210
- <HStack gap={2} vAlign="center" wrap="wrap">
211
- <Text type="body" weight="semibold">
212
- {item.name}
213
- </Text>
214
- {item.limited && (
215
- <HStack gap={1} vAlign="center">
216
- <StatusDot variant="warning" label="Limited edition" />
217
- <Text type="supporting" color="secondary">
218
- Limited edition
219
- </Text>
220
- </HStack>
221
- )}
222
- </HStack>
223
- <Text type="body" hasTabularNumbers>
224
- {fmt(item.price)}
225
- </Text>
226
- </HStack>
227
- <Text type="supporting" color="secondary">
228
- {item.variant}
229
- </Text>
230
- <HStack gap={2} vAlign="end" wrap="wrap">
231
- <NumberInput
232
- label="Qty"
233
- value={qty}
234
- onChange={onChangeQty}
235
- min={1}
236
- max={10}
237
- isIntegerOnly
238
- />
239
- {/* Editing the order in place — an action, never a destination. */}
240
- <Button label="Remove" variant="ghost" onClick={() => {}} />
241
- <Button label="Save" variant="ghost" onClick={() => {}} />
242
- </HStack>
243
- </VStack>
244
- </StackItem>
245
- </HStack>
246
- );
186
+ return (
187
+ <HStack gap={3} vAlign="start">
188
+ <OrderItemPhoto item={item} />
189
+ <StackItem size="fill">
190
+ <VStack gap={1}>
191
+ <HStack gap={2} hAlign="between" vAlign="start">
192
+ <HStack gap={2} vAlign="center" wrap="wrap">
193
+ <Text type="body" weight="semibold">
194
+ {item.name}
195
+ </Text>
196
+ {item.limited && (
197
+ <HStack gap={1} vAlign="center">
198
+ <StatusDot variant="warning" label="Limited edition" />
199
+ <Text type="supporting" color="secondary">
200
+ Limited edition
201
+ </Text>
202
+ </HStack>
203
+ )}
204
+ </HStack>
205
+ <Text type="body" hasTabularNumbers>
206
+ {fmt(item.price)}
207
+ </Text>
208
+ </HStack>
209
+ <Text type="supporting" color="secondary">
210
+ {item.variant}
211
+ </Text>
212
+ <HStack gap={2} vAlign="end" wrap="wrap">
213
+ <NumberInput
214
+ label="Qty"
215
+ value={qty}
216
+ onChange={onChangeQty}
217
+ min={1}
218
+ max={10}
219
+ isIntegerOnly
220
+ />
221
+ {/* Editing the order in place — an action, never a destination. */}
222
+ <Button label="Remove" variant="ghost" onClick={() => {}} />
223
+ <Button label="Save" variant="ghost" onClick={() => {}} />
224
+ </HStack>
225
+ </VStack>
226
+ </StackItem>
227
+ </HStack>
228
+ );
247
229
  }
248
230
 
249
231
  function OrderSummaryCard({
250
- quantities,
251
- onChangeQty,
252
- subtotal,
253
- shipping,
254
- tax,
255
- total,
232
+ quantities,
233
+ onChangeQty,
234
+ subtotal,
235
+ shipping,
236
+ tax,
237
+ total,
256
238
  }: {
257
- quantities: Record<string, number>;
258
- onChangeQty: (id: string, v: number) => void;
259
- subtotal: number;
260
- shipping: number;
261
- tax: number;
262
- total: number;
239
+ quantities: Record<string, number>;
240
+ onChangeQty: (id: string, v: number) => void;
241
+ subtotal: number;
242
+ shipping: number;
243
+ tax: number;
244
+ total: number;
263
245
  }) {
264
- return (
265
- <Card padding={4}>
266
- <VStack gap={4}>
267
- {/* Accordion header — clickable on mobile only */}
268
- <Collapsible trigger="Order Summary" defaultIsOpen={true}>
269
- <VStack gap={4} style={summaryContent}>
270
- {ORDER_ITEMS.map(item => (
271
- <OrderLineItem
272
- key={item.id}
273
- item={item}
274
- qty={quantities[item.id] ?? item.qty}
275
- onChangeQty={v => onChangeQty(item.id, v)}
276
- />
277
- ))}
278
- <OrderTotalSection
279
- subtotal={subtotal}
280
- shipping={shipping}
281
- tax={tax}
282
- total={total}
283
- />
284
- </VStack>
285
- </Collapsible>
286
- </VStack>
287
- </Card>
288
- );
246
+ return (
247
+ <Card padding={4}>
248
+ <VStack gap={4}>
249
+ {/* Accordion header — clickable on mobile only */}
250
+ <Collapsible trigger="Order Summary" defaultIsOpen={true}>
251
+ <VStack gap={4} style={summaryContent}>
252
+ {ORDER_ITEMS.map((item) => (
253
+ <OrderLineItem
254
+ key={item.id}
255
+ item={item}
256
+ qty={quantities[item.id] ?? item.qty}
257
+ onChangeQty={(v) => onChangeQty(item.id, v)}
258
+ />
259
+ ))}
260
+ <OrderTotalSection subtotal={subtotal} shipping={shipping} tax={tax} total={total} />
261
+ </VStack>
262
+ </Collapsible>
263
+ </VStack>
264
+ </Card>
265
+ );
289
266
  }
290
267
 
291
268
  function OrderTotalSection({
292
- subtotal,
293
- shipping,
294
- tax,
295
- total,
269
+ subtotal,
270
+ shipping,
271
+ tax,
272
+ total,
296
273
  }: {
297
- subtotal: number;
298
- shipping: number;
299
- tax: number;
300
- total: number;
274
+ subtotal: number;
275
+ shipping: number;
276
+ tax: number;
277
+ total: number;
301
278
  }) {
302
- return (
303
- <VStack gap={3}>
304
- <Heading level={3}>Order Total</Heading>
305
- <VStack gap={2}>
306
- <HStack hAlign="between" vAlign="center">
307
- <Text type="body" color="secondary">
308
- Subtotal
309
- </Text>
310
- <Text type="body" hasTabularNumbers>
311
- {fmt(subtotal)}
312
- </Text>
313
- </HStack>
314
- <HStack hAlign="between" vAlign="center">
315
- <Text type="body" color="secondary">
316
- Shipping
317
- </Text>
318
- <Text type="body" hasTabularNumbers>
319
- {fmt(shipping)}
320
- </Text>
321
- </HStack>
322
- <HStack hAlign="between" vAlign="center">
323
- <Text type="body" color="secondary">
324
- Tax
325
- </Text>
326
- <Text type="body" hasTabularNumbers>
327
- {fmt(tax)}
328
- </Text>
329
- </HStack>
330
- </VStack>
331
- <Divider />
332
- <HStack hAlign="between" vAlign="center">
333
- <Text type="large">
334
- Total
335
- </Text>
336
- <Text type="large" hasTabularNumbers>
337
- {fmt(total)}
338
- </Text>
339
- </HStack>
340
- <Banner
341
- status="info"
342
- icon={<Icon icon={Truck} size="sm" />}
343
- title="Free shipping on orders over $300"
344
- />
345
- </VStack>
346
- );
279
+ return (
280
+ <VStack gap={3}>
281
+ <Heading level={3}>Order Total</Heading>
282
+ <VStack gap={2}>
283
+ <HStack hAlign="between" vAlign="center">
284
+ <Text type="body" color="secondary">
285
+ Subtotal
286
+ </Text>
287
+ <Text type="body" hasTabularNumbers>
288
+ {fmt(subtotal)}
289
+ </Text>
290
+ </HStack>
291
+ <HStack hAlign="between" vAlign="center">
292
+ <Text type="body" color="secondary">
293
+ Shipping
294
+ </Text>
295
+ <Text type="body" hasTabularNumbers>
296
+ {fmt(shipping)}
297
+ </Text>
298
+ </HStack>
299
+ <HStack hAlign="between" vAlign="center">
300
+ <Text type="body" color="secondary">
301
+ Tax
302
+ </Text>
303
+ <Text type="body" hasTabularNumbers>
304
+ {fmt(tax)}
305
+ </Text>
306
+ </HStack>
307
+ </VStack>
308
+ <Divider />
309
+ <HStack hAlign="between" vAlign="center">
310
+ <Text type="large">Total</Text>
311
+ <Text type="large" hasTabularNumbers>
312
+ {fmt(total)}
313
+ </Text>
314
+ </HStack>
315
+ <Banner
316
+ status="info"
317
+ icon={<Icon icon={Truck} size="sm" />}
318
+ title="Free shipping on orders over $300"
319
+ />
320
+ </VStack>
321
+ );
347
322
  }
348
323
 
349
- const TRUST_ITEMS: Array<{icon: typeof ShieldCheck; label: string}> = [
350
- {icon: ShieldCheck, label: 'Secure Payment'},
351
- {icon: Lock, label: 'SSL Encrypted'},
352
- {icon: CircleCheck, label: 'Free Returns'},
324
+ const TRUST_ITEMS: Array<{ icon: typeof ShieldCheck; label: string }> = [
325
+ { icon: ShieldCheck, label: "Secure Payment" },
326
+ { icon: Lock, label: "SSL Encrypted" },
327
+ { icon: CircleCheck, label: "Free Returns" },
353
328
  ];
354
329
 
355
- const SELF_HREF = '#/templates/payment-form';
330
+ const SELF_HREF = "#/templates/payment-form";
356
331
 
357
- const POLICY_LINKS = [
358
- 'Refund policy',
359
- 'Privacy policy',
360
- 'Terms of service',
361
- 'Cancellations',
362
- ];
332
+ const POLICY_LINKS = ["Refund policy", "Privacy policy", "Terms of service", "Cancellations"];
363
333
 
364
334
  function TrustBar() {
365
- return (
366
- <HStack gap={5} hAlign="center" wrap="wrap">
367
- {TRUST_ITEMS.map(item => (
368
- <HStack key={item.label} gap={1} vAlign="center">
369
- <Icon icon={item.icon} size="sm" color="secondary" />
370
- <Text type="supporting" color="secondary">
371
- {item.label}
372
- </Text>
373
- </HStack>
374
- ))}
375
- </HStack>
376
- );
335
+ return (
336
+ <HStack gap={5} hAlign="center" wrap="wrap">
337
+ {TRUST_ITEMS.map((item) => (
338
+ <HStack key={item.label} gap={1} vAlign="center">
339
+ <Icon icon={item.icon} size="sm" color="secondary" />
340
+ <Text type="supporting" color="secondary">
341
+ {item.label}
342
+ </Text>
343
+ </HStack>
344
+ ))}
345
+ </HStack>
346
+ );
377
347
  }
378
348
 
379
349
  function PolicyLinks() {
380
- return (
381
- <HStack gap={4} vAlign="center" wrap="wrap">
382
- {POLICY_LINKS.map(label => (
383
- <Link key={label} href={SELF_HREF} type="supporting">
384
- {label}
385
- </Link>
386
- ))}
387
- </HStack>
388
- );
350
+ return (
351
+ <HStack gap={4} vAlign="center" wrap="wrap">
352
+ {POLICY_LINKS.map((label) => (
353
+ <Link key={label} href={SELF_HREF} type="supporting">
354
+ {label}
355
+ </Link>
356
+ ))}
357
+ </HStack>
358
+ );
389
359
  }
390
360
 
391
361
  export default function PaymentForm() {
392
- // 768, not 767: eight sibling templates gate the same collapse at exactly
393
- // 768 (`documentation-design.tsx:568`, `documentation-technical.tsx:61`,
394
- // `editor.tsx:640`, `file-explorer.tsx:375`, `ide.tsx:244`,
395
- // `settings-sidebar.tsx:127`, `settings.tsx:79`, `messaging-shell.tsx:393`),
396
- // and this file's own second query below is 1024. At 767 this was the only
397
- // off-by-one in the set, so at exactly a 768px viewport `isMobile` was
398
- // false while `isStacked` was true: the outer Stack had already gone
399
- // vertical (`:514`) and all six `columns={isMobile ? 1 : N}` grids below
400
- // stayed wide inside it, including the 3-column expiry row at `:821`.
401
- const isMobile = useMediaQuery('(max-width: 768px)');
402
- const isStacked = useMediaQuery('(max-width: 1024px)');
403
- const [firstName, setFirstName] = useState('');
404
- const [lastName, setLastName] = useState('');
405
- const [address, setAddress] = useState('');
406
- const [city, setCity] = useState('');
407
- const [zip, setZip] = useState('');
408
- const [state, setState] = useState('');
409
- const [phone, setPhone] = useState('');
410
- const [saveInfo, setSaveInfo] = useState(false);
411
- const [email, setEmail] = useState('');
412
- const [emailOffers, setEmailOffers] = useState(false);
413
- const [deliveryMethod, setDeliveryMethod] = useState('standard');
414
- const [paymentMethod, _setPaymentMethod] = useState('card');
415
- const [cardNumber, setCardNumber] = useState('');
416
- const [expiry, setExpiry] = useState('');
417
- const [expYear, setExpYear] = useState('');
418
- const [billingMatchesShipping, setBillingMatchesShipping] = useState(true);
419
- const [billingAddress, setBillingAddress] = useState('');
420
- const [billingCity, setBillingCity] = useState('');
421
- const [billingZip, setBillingZip] = useState('');
422
- const [billingState, setBillingState] = useState('');
423
- const [addGiftMessage, setAddGiftMessage] = useState(false);
424
- const [giftTo, setGiftTo] = useState('');
425
- const [giftFrom, setGiftFrom] = useState('');
426
- const [giftMessage, setGiftMessage] = useState('');
427
- const [cvc, setCvc] = useState('');
428
- const [cardName, setCardName] = useState('');
429
- const [promo, setPromo] = useState('');
430
- const [quantities, setQuantities] = useState<Record<string, number>>({
431
- '1': 1,
432
- '2': 1,
433
- '3': 1,
434
- });
435
- const [submitted, setSubmitted] = useState(false);
436
-
437
- // Totals follow the editable quantities (and the free-shipping banner:
438
- // orders at or over the threshold ship free).
439
- const subtotal = ORDER_ITEMS.reduce(
440
- (sum, item) => sum + item.price * (quantities[item.id] ?? item.qty),
441
- 0,
442
- );
443
- const shipping =
444
- subtotal >= FREE_SHIPPING_THRESHOLD
445
- ? 0
446
- : deliveryMethod === 'expedited'
447
- ? 9.95
448
- : 4.95;
449
- const tax = Math.round(subtotal * TAX_RATE * 100) / 100;
450
- const total = subtotal + shipping + tax;
451
-
452
- // One lockstep 'Required' string for every empty field: seventeen call
453
- // sites share this one spelling, so a copy change cannot leave one field
454
- // behind with the old text.
455
- const required = (hasValue: unknown): string | undefined =>
456
- hasValue ? undefined : 'Required';
457
-
458
- const errors: Record<string, string | undefined> = submitted
459
- ? {
460
- firstName: required(firstName.trim()),
461
- lastName: required(lastName.trim()),
462
- address: required(address.trim()),
463
- city: required(city.trim()),
464
- zip: required(zip.trim()),
465
- state: required(state),
466
- email: required(email.trim()),
467
- phone: required(phone.trim()),
468
- expiry: required(expiry),
469
- expYear: required(expYear),
470
- cvc: required(cvc.trim()),
471
- cardNumber:
472
- paymentMethod === 'card' ? required(cardNumber.trim()) : undefined,
473
- cardName:
474
- paymentMethod === 'card' ? required(cardName.trim()) : undefined,
475
- billingAddress:
476
- !billingMatchesShipping ? required(billingAddress.trim()) : undefined,
477
- billingCity:
478
- !billingMatchesShipping ? required(billingCity.trim()) : undefined,
479
- billingZip:
480
- !billingMatchesShipping ? required(billingZip.trim()) : undefined,
481
- billingState:
482
- !billingMatchesShipping ? required(billingState) : undefined,
483
- }
484
- : {};
485
-
486
- return (
487
- <Layout
488
- height="fill"
489
- content={
490
- <LayoutContent padding={0}>
491
- <Center axis="horizontal">
492
- <Section
493
- variant="transparent"
494
- maxWidth={1100}
495
- width="100%"
496
- padding={6}>
497
- <VStack gap={5}>
498
- {/* Page header */}
499
- <VStack gap={6}>
500
- <VStack gap={2}>
501
- <Heading level={1} type="display-2">
502
- Payment Request
503
- </Heading>
504
- <Text type="body" color="secondary">
505
- Review your order and complete your purchase. All
506
- transactions are sealed with 256-bit SSL encryption.
507
- </Text>
508
- </VStack>
509
- <Divider />
510
- </VStack>
511
-
512
- <Stack
513
- direction={isStacked ? 'vertical' : 'horizontal'}
514
- gap={8}
515
- vAlign="start">
516
- <StackItem
517
- size="fill"
518
- style={isStacked ? undefined : formColBasis}>
519
- <VStack gap={8}>
520
- {/* Sign in */}
521
- <VStack gap={1}>
522
- <HStack gap={2} hAlign="between" vAlign="center">
523
- <Heading level={2}>Sign in to check out</Heading>
524
- <Button
525
- label="Sign in"
526
- variant="secondary"
527
-
528
- onClick={() => {}}
529
- />
530
- </HStack>
531
- <Text type="body" color="secondary">
532
- Sign in to track your order and save your information
533
- for faster checkout.
534
- </Text>
535
- </VStack>
536
-
537
- {/* Contact Information */}
538
- <VStack gap={3}>
539
- <Heading level={2}>Contact information</Heading>
540
- <TextInput
541
- size="lg"
542
- label="Email"
543
- isRequired
544
- placeholder="you@castle.dracula"
545
- value={email}
546
- onChange={setEmail}
547
- status={
548
- errors.email
549
- ? {type: 'error', message: errors.email}
550
- : undefined
551
- }
552
- />
553
- <CheckboxInput
554
- label="Email me with news and offers"
555
- value={emailOffers}
556
- onChange={setEmailOffers}
557
- />
558
- </VStack>
559
-
560
- {/* Shipping Information */}
561
- <VStack gap={3}>
562
- <Heading level={2}>Shipping information</Heading>
563
- <Grid columns={isMobile ? 1 : 2} gap={3}>
564
- <TextInput
565
- size="lg"
566
- label="First Name"
567
- isRequired
568
- placeholder="Vlad"
569
- value={firstName}
570
- onChange={setFirstName}
571
- status={
572
- errors.firstName
573
- ? {type: 'error', message: errors.firstName}
574
- : undefined
575
- }
576
- />
577
- <TextInput
578
- size="lg"
579
- label="Last Name"
580
- isRequired
581
- placeholder="Dracul"
582
- value={lastName}
583
- onChange={setLastName}
584
- status={
585
- errors.lastName
586
- ? {type: 'error', message: errors.lastName}
587
- : undefined
588
- }
589
- />
590
- </Grid>
591
- <TextInput
592
- size="lg"
593
- label="Address"
594
- isRequired
595
- placeholder="666 Castle Way"
596
- value={address}
597
- onChange={setAddress}
598
- status={
599
- errors.address
600
- ? {type: 'error', message: errors.address}
601
- : undefined
602
- }
603
- />
604
- <Grid columns={isMobile ? 1 : 2} gap={3}>
605
- <TextInput
606
- size="lg"
607
- label="City"
608
- isRequired
609
- placeholder="Transylvania"
610
- value={city}
611
- onChange={setCity}
612
- status={
613
- errors.city
614
- ? {type: 'error', message: errors.city}
615
- : undefined
616
- }
617
- />
618
- <TextInput
619
- size="lg"
620
- label="ZIP Code"
621
- isRequired
622
- placeholder="40000"
623
- value={zip}
624
- onChange={setZip}
625
- status={
626
- errors.zip
627
- ? {type: 'error', message: errors.zip}
628
- : undefined
629
- }
630
- />
631
- </Grid>
632
- <Selector
633
- size="lg"
634
- label="State"
635
- isRequired
636
- placeholder="Select state"
637
- options={US_STATES}
638
- value={state}
639
- onChange={setState}
640
- status={
641
- errors.state
642
- ? {type: 'error', message: errors.state}
643
- : undefined
644
- }
645
- />
646
- <TextInput
647
- size="lg"
648
- label="Phone Number"
649
- isRequired
650
- placeholder="+1 (555) 123-4567"
651
- value={phone}
652
- onChange={setPhone}
653
- labelTooltip="We use your phone number to provide shipping updates and contact you about your delivery if needed."
654
- status={
655
- errors.phone
656
- ? {type: 'error', message: errors.phone}
657
- : undefined
658
- }
659
- />
660
- <CheckboxInput
661
- label="Save my information for a faster checkout"
662
- value={saveInfo}
663
- onChange={setSaveInfo}
664
- />
665
- </VStack>
666
-
667
- {/* Delivery */}
668
- <VStack gap={3}>
669
- <VStack gap={1}>
670
- <Heading level={2}>Delivery</Heading>
671
- <Text type="body" color="secondary">
672
- Please allow 1–3 business days processing time
673
- before your order ships.
674
- </Text>
675
- </VStack>
676
- <RadioList
677
- label="Delivery method"
678
- value={deliveryMethod}
679
- onChange={setDeliveryMethod}>
680
- <RadioListItem
681
- value="standard"
682
- label="Standard (3–7 business days)"
683
- endContent={
684
- <Text
685
- type="body"
686
- weight="semibold"
687
- hasTabularNumbers>
688
- $4.95
689
- </Text>
690
- }
691
- />
692
- <RadioListItem
693
- value="expedited"
694
- label="Expedited (1–2 business days)"
695
- endContent={
696
- <Text
697
- type="body"
698
- weight="semibold"
699
- hasTabularNumbers>
700
- $9.95
701
- </Text>
702
- }
703
- />
704
- </RadioList>
705
- </VStack>
706
-
707
- {/* Payment Method */}
708
- <VStack gap={3}>
709
- <VStack gap={1}>
710
- <Heading level={2}>Payment method</Heading>
711
- <Text type="body" color="secondary">
712
- All transactions are secure and encrypted.
713
- </Text>
714
- </VStack>
715
-
716
- {/* Express checkout */}
717
- <VStack gap={3}>
718
- <Grid columns={isMobile ? 1 : 2} gap={3}>
719
- {/* PayPal */}
720
- <Button
721
- label="PayPal"
722
- variant="secondary"
723
- size="lg"
724
- onClick={() => {}}
725
- />
726
- {/* Google Pay */}
727
- <Button
728
- label="Google Pay"
729
- variant="secondary"
730
- size="lg"
731
- onClick={() => {}}
732
- />
733
- </Grid>
734
- </VStack>
735
-
736
- <Divider label="Or pay with card" />
737
-
738
- {/* Credit card fields */}
739
- <VStack gap={3}>
740
- {/* Card type icons — inline Dracula marks on
362
+ // 768, not 767: eight sibling templates gate the same collapse at exactly
363
+ // 768 (`documentation-design.tsx:568`, `documentation-technical.tsx:61`,
364
+ // `editor.tsx:640`, `file-explorer.tsx:375`, `ide.tsx:244`,
365
+ // `settings-sidebar.tsx:127`, `settings.tsx:79`, `messaging-shell.tsx:393`),
366
+ // and this file's own second query below is 1024. At 767 this was the only
367
+ // off-by-one in the set, so at exactly a 768px viewport `isMobile` was
368
+ // false while `isStacked` was true: the outer Stack had already gone
369
+ // vertical (`:514`) and all six `columns={isMobile ? 1 : N}` grids below
370
+ // stayed wide inside it, including the 3-column expiry row at `:821`.
371
+ const isMobile = useMediaQuery("(max-width: 768px)");
372
+ const isStacked = useMediaQuery("(max-width: 1024px)");
373
+ const [firstName, setFirstName] = useState("");
374
+ const [lastName, setLastName] = useState("");
375
+ const [address, setAddress] = useState("");
376
+ const [city, setCity] = useState("");
377
+ const [zip, setZip] = useState("");
378
+ const [state, setState] = useState("");
379
+ const [phone, setPhone] = useState("");
380
+ const [saveInfo, setSaveInfo] = useState(false);
381
+ const [email, setEmail] = useState("");
382
+ const [emailOffers, setEmailOffers] = useState(false);
383
+ const [deliveryMethod, setDeliveryMethod] = useState("standard");
384
+ const [paymentMethod, _setPaymentMethod] = useState("card");
385
+ const [cardNumber, setCardNumber] = useState("");
386
+ const [expiry, setExpiry] = useState("");
387
+ const [expYear, setExpYear] = useState("");
388
+ const [billingMatchesShipping, setBillingMatchesShipping] = useState(true);
389
+ const [billingAddress, setBillingAddress] = useState("");
390
+ const [billingCity, setBillingCity] = useState("");
391
+ const [billingZip, setBillingZip] = useState("");
392
+ const [billingState, setBillingState] = useState("");
393
+ const [addGiftMessage, setAddGiftMessage] = useState(false);
394
+ const [giftTo, setGiftTo] = useState("");
395
+ const [giftFrom, setGiftFrom] = useState("");
396
+ const [giftMessage, setGiftMessage] = useState("");
397
+ const [cvc, setCvc] = useState("");
398
+ const [cardName, setCardName] = useState("");
399
+ const [promo, setPromo] = useState("");
400
+ const [quantities, setQuantities] = useState<Record<string, number>>({
401
+ "1": 1,
402
+ "2": 1,
403
+ "3": 1,
404
+ });
405
+ const [submitted, setSubmitted] = useState(false);
406
+
407
+ // Totals follow the editable quantities (and the free-shipping banner:
408
+ // orders at or over the threshold ship free).
409
+ const subtotal = ORDER_ITEMS.reduce(
410
+ (sum, item) => sum + item.price * (quantities[item.id] ?? item.qty),
411
+ 0,
412
+ );
413
+ const shipping =
414
+ subtotal >= FREE_SHIPPING_THRESHOLD ? 0 : deliveryMethod === "expedited" ? 9.95 : 4.95;
415
+ const tax = Math.round(subtotal * TAX_RATE * 100) / 100;
416
+ const total = subtotal + shipping + tax;
417
+
418
+ // One lockstep 'Required' string for every empty field: seventeen call
419
+ // sites share this one spelling, so a copy change cannot leave one field
420
+ // behind with the old text.
421
+ const required = (hasValue: unknown): string | undefined => (hasValue ? undefined : "Required");
422
+
423
+ const errors: Record<string, string | undefined> = submitted
424
+ ? {
425
+ firstName: required(firstName.trim()),
426
+ lastName: required(lastName.trim()),
427
+ address: required(address.trim()),
428
+ city: required(city.trim()),
429
+ zip: required(zip.trim()),
430
+ state: required(state),
431
+ email: required(email.trim()),
432
+ phone: required(phone.trim()),
433
+ expiry: required(expiry),
434
+ expYear: required(expYear),
435
+ cvc: required(cvc.trim()),
436
+ cardNumber: paymentMethod === "card" ? required(cardNumber.trim()) : undefined,
437
+ cardName: paymentMethod === "card" ? required(cardName.trim()) : undefined,
438
+ billingAddress: !billingMatchesShipping ? required(billingAddress.trim()) : undefined,
439
+ billingCity: !billingMatchesShipping ? required(billingCity.trim()) : undefined,
440
+ billingZip: !billingMatchesShipping ? required(billingZip.trim()) : undefined,
441
+ billingState: !billingMatchesShipping ? required(billingState) : undefined,
442
+ }
443
+ : {};
444
+
445
+ return (
446
+ <Layout
447
+ height="fill"
448
+ content={
449
+ <LayoutContent padding={0}>
450
+ <Center axis="horizontal">
451
+ <Section variant="transparent" maxWidth={1100} width="100%" padding={6}>
452
+ <VStack gap={5}>
453
+ {/* Page header */}
454
+ <VStack gap={6}>
455
+ <VStack gap={2}>
456
+ <Heading level={1} type="display-2">
457
+ Payment Request
458
+ </Heading>
459
+ <Text type="body" color="secondary">
460
+ Review your order and complete your purchase. All transactions are sealed with
461
+ 256-bit SSL encryption.
462
+ </Text>
463
+ </VStack>
464
+ <Divider />
465
+ </VStack>
466
+
467
+ <Stack direction={isStacked ? "vertical" : "horizontal"} gap={8} vAlign="start">
468
+ <StackItem size="fill" style={isStacked ? undefined : formColBasis}>
469
+ <VStack gap={8}>
470
+ {/* Sign in */}
471
+ <VStack gap={1}>
472
+ <HStack gap={2} hAlign="between" vAlign="center">
473
+ <Heading level={2}>Sign in to check out</Heading>
474
+ <Button label="Sign in" variant="secondary" onClick={() => {}} />
475
+ </HStack>
476
+ <Text type="body" color="secondary">
477
+ Sign in to track your order and save your information for faster checkout.
478
+ </Text>
479
+ </VStack>
480
+
481
+ {/* Contact Information */}
482
+ <VStack gap={3}>
483
+ <Heading level={2}>Contact information</Heading>
484
+ <TextInput
485
+ size="lg"
486
+ label="Email"
487
+ isRequired
488
+ placeholder="you@castle.dracula"
489
+ value={email}
490
+ onChange={setEmail}
491
+ status={
492
+ errors.email ? { type: "error", message: errors.email } : undefined
493
+ }
494
+ />
495
+ <CheckboxInput
496
+ label="Email me with news and offers"
497
+ value={emailOffers}
498
+ onChange={setEmailOffers}
499
+ />
500
+ </VStack>
501
+
502
+ {/* Shipping Information */}
503
+ <VStack gap={3}>
504
+ <Heading level={2}>Shipping information</Heading>
505
+ <Grid columns={isMobile ? 1 : 2} gap={3}>
506
+ <TextInput
507
+ size="lg"
508
+ label="First Name"
509
+ isRequired
510
+ placeholder="Vlad"
511
+ value={firstName}
512
+ onChange={setFirstName}
513
+ status={
514
+ errors.firstName
515
+ ? { type: "error", message: errors.firstName }
516
+ : undefined
517
+ }
518
+ />
519
+ <TextInput
520
+ size="lg"
521
+ label="Last Name"
522
+ isRequired
523
+ placeholder="Dracul"
524
+ value={lastName}
525
+ onChange={setLastName}
526
+ status={
527
+ errors.lastName
528
+ ? { type: "error", message: errors.lastName }
529
+ : undefined
530
+ }
531
+ />
532
+ </Grid>
533
+ <TextInput
534
+ size="lg"
535
+ label="Address"
536
+ isRequired
537
+ placeholder="666 Castle Way"
538
+ value={address}
539
+ onChange={setAddress}
540
+ status={
541
+ errors.address ? { type: "error", message: errors.address } : undefined
542
+ }
543
+ />
544
+ <Grid columns={isMobile ? 1 : 2} gap={3}>
545
+ <TextInput
546
+ size="lg"
547
+ label="City"
548
+ isRequired
549
+ placeholder="Transylvania"
550
+ value={city}
551
+ onChange={setCity}
552
+ status={
553
+ errors.city ? { type: "error", message: errors.city } : undefined
554
+ }
555
+ />
556
+ <TextInput
557
+ size="lg"
558
+ label="ZIP Code"
559
+ isRequired
560
+ placeholder="40000"
561
+ value={zip}
562
+ onChange={setZip}
563
+ status={errors.zip ? { type: "error", message: errors.zip } : undefined}
564
+ />
565
+ </Grid>
566
+ <Selector
567
+ size="lg"
568
+ label="State"
569
+ isRequired
570
+ placeholder="Select state"
571
+ options={US_STATES}
572
+ value={state}
573
+ onChange={setState}
574
+ status={
575
+ errors.state ? { type: "error", message: errors.state } : undefined
576
+ }
577
+ />
578
+ <TextInput
579
+ size="lg"
580
+ label="Phone Number"
581
+ isRequired
582
+ placeholder="+1 (555) 123-4567"
583
+ value={phone}
584
+ onChange={setPhone}
585
+ labelTooltip="We use your phone number to provide shipping updates and contact you about your delivery if needed."
586
+ status={
587
+ errors.phone ? { type: "error", message: errors.phone } : undefined
588
+ }
589
+ />
590
+ <CheckboxInput
591
+ label="Save my information for a faster checkout"
592
+ value={saveInfo}
593
+ onChange={setSaveInfo}
594
+ />
595
+ </VStack>
596
+
597
+ {/* Delivery */}
598
+ <VStack gap={3}>
599
+ <VStack gap={1}>
600
+ <Heading level={2}>Delivery</Heading>
601
+ <Text type="body" color="secondary">
602
+ Please allow 1–3 business days processing time before your order ships.
603
+ </Text>
604
+ </VStack>
605
+ <RadioList
606
+ label="Delivery method"
607
+ value={deliveryMethod}
608
+ onChange={setDeliveryMethod}
609
+ >
610
+ <RadioListItem
611
+ value="standard"
612
+ label="Standard (3–7 business days)"
613
+ endContent={
614
+ <Text type="body" weight="semibold" hasTabularNumbers>
615
+ $4.95
616
+ </Text>
617
+ }
618
+ />
619
+ <RadioListItem
620
+ value="expedited"
621
+ label="Expedited (1–2 business days)"
622
+ endContent={
623
+ <Text type="body" weight="semibold" hasTabularNumbers>
624
+ $9.95
625
+ </Text>
626
+ }
627
+ />
628
+ </RadioList>
629
+ </VStack>
630
+
631
+ {/* Payment Method */}
632
+ <VStack gap={3}>
633
+ <VStack gap={1}>
634
+ <Heading level={2}>Payment method</Heading>
635
+ <Text type="body" color="secondary">
636
+ All transactions are secure and encrypted.
637
+ </Text>
638
+ </VStack>
639
+
640
+ {/* Express checkout */}
641
+ <VStack gap={3}>
642
+ <Grid columns={isMobile ? 1 : 2} gap={3}>
643
+ {/* PayPal */}
644
+ <Button
645
+ label="PayPal"
646
+ variant="secondary"
647
+ size="lg"
648
+ onClick={() => {}}
649
+ />
650
+ {/* Google Pay */}
651
+ <Button
652
+ label="Google Pay"
653
+ variant="secondary"
654
+ size="lg"
655
+ onClick={() => {}}
656
+ />
657
+ </Grid>
658
+ </VStack>
659
+
660
+ <Divider label="Or pay with card" />
661
+
662
+ {/* Credit card fields */}
663
+ <VStack gap={3}>
664
+ {/* Card type icons — inline Dracula marks on
741
665
  brand tokens; no vendor hotlinks. */}
742
- <HStack gap={1.5} vAlign="center">
743
- <svg
744
- viewBox="0 0 48 32"
745
- role="img"
746
- aria-label="Visa"
747
- style={cardLogo}>
748
- <rect
749
- width="48"
750
- height="32"
751
- fill="var(--color-background-surface)"
752
- />
753
- <text
754
- x="24"
755
- y="21"
756
- textAnchor="middle"
757
- fontSize="10"
758
- fontStyle="italic"
759
- fill="var(--dracula-comment)">
760
- VISA
761
- </text>
762
- </svg>
763
- <svg
764
- viewBox="0 0 48 32"
765
- role="img"
766
- aria-label="Mastercard"
767
- style={cardLogo}>
768
- <rect
769
- width="48"
770
- height="32"
771
- fill="var(--color-background-surface)"
772
- />
773
- <circle
774
- cx="19"
775
- cy="16"
776
- r="8"
777
- fill="var(--dracula-red)"
778
- />
779
- <circle
780
- cx="29"
781
- cy="16"
782
- r="8"
783
- fill="var(--dracula-orange)"
784
- opacity={0.85}
785
- />
786
- </svg>
787
- <svg
788
- viewBox="0 0 48 32"
789
- role="img"
790
- aria-label="Amex"
791
- style={cardLogo}>
792
- <rect
793
- width="48"
794
- height="32"
795
- fill="var(--color-background-surface)"
796
- />
797
- <text
798
- x="24"
799
- y="21"
800
- textAnchor="middle"
801
- fontSize="10"
802
- fill="var(--dracula-cyan)">
803
- AMEX
804
- </text>
805
- </svg>
806
- </HStack>
807
- <TextInput
808
- size="lg"
809
- label="Card Number"
810
- isRequired
811
- placeholder="1234 5678 9012 3456"
812
- value={cardNumber}
813
- onChange={setCardNumber}
814
- status={
815
- errors.cardNumber
816
- ? {type: 'error', message: errors.cardNumber}
817
- : undefined
818
- }
819
- />
820
- <Grid columns={isMobile ? 1 : 3} gap={3}>
821
- <Selector
822
- size="lg"
823
- label="Expiry Month"
824
- isRequired
825
- placeholder="MM"
826
- options={MONTHS}
827
- value={expiry}
828
- onChange={setExpiry}
829
- status={
830
- errors.expiry
831
- ? {type: 'error', message: errors.expiry}
832
- : undefined
833
- }
834
- />
835
- <Selector
836
- size="lg"
837
- label="Expiry Year"
838
- isRequired
839
- placeholder="YY"
840
- options={YEARS}
841
- value={expYear}
842
- onChange={setExpYear}
843
- status={
844
- errors.expYear
845
- ? {type: 'error', message: errors.expYear}
846
- : undefined
847
- }
848
- />
849
- <TextInput
850
- size="lg"
851
- label="CVC"
852
- isRequired
853
- placeholder="123"
854
- value={cvc}
855
- onChange={setCvc}
856
- labelTooltip="3-digit security code usually found on the back of your card. American Express cards have a 4-digit code located on the front."
857
- status={
858
- errors.cvc
859
- ? {type: 'error', message: errors.cvc}
860
- : undefined
861
- }
862
- />
863
- </Grid>
864
- <TextInput
865
- size="lg"
866
- label="Name on Card"
867
- isRequired
868
- placeholder="Vlad Dracul"
869
- value={cardName}
870
- onChange={setCardName}
871
- status={
872
- errors.cardName
873
- ? {type: 'error', message: errors.cardName}
874
- : undefined
875
- }
876
- />
877
- <CheckboxInput
878
- label="Use shipping address as billing address"
879
- value={billingMatchesShipping}
880
- onChange={setBillingMatchesShipping}
881
- />
882
- {!billingMatchesShipping && (
883
- <VStack gap={3}>
884
- <TextInput
885
- size="lg"
886
- label="Address"
887
- isRequired
888
- placeholder="666 Castle Way"
889
- value={billingAddress}
890
- onChange={setBillingAddress}
891
- status={
892
- errors.billingAddress
893
- ? {
894
- type: 'error',
895
- message: errors.billingAddress,
896
- }
897
- : undefined
898
- }
899
- />
900
- <Grid columns={isMobile ? 1 : 2} gap={3}>
901
- <TextInput
902
- size="lg"
903
- label="City"
904
- isRequired
905
- placeholder="Transylvania"
906
- value={billingCity}
907
- onChange={setBillingCity}
908
- status={
909
- errors.billingCity
910
- ? {
911
- type: 'error',
912
- message: errors.billingCity,
913
- }
914
- : undefined
915
- }
916
- />
917
- <TextInput
918
- size="lg"
919
- label="ZIP Code"
920
- isRequired
921
- placeholder="40000"
922
- value={billingZip}
923
- onChange={setBillingZip}
924
- status={
925
- errors.billingZip
926
- ? {
927
- type: 'error',
928
- message: errors.billingZip,
929
- }
930
- : undefined
931
- }
932
- />
933
- </Grid>
934
- <Selector
935
- size="lg"
936
- label="State"
937
- isRequired
938
- placeholder="Select state"
939
- options={US_STATES}
940
- value={billingState}
941
- onChange={setBillingState}
942
- status={
943
- errors.billingState
944
- ? {
945
- type: 'error',
946
- message: errors.billingState,
947
- }
948
- : undefined
949
- }
950
- />
951
- </VStack>
952
- )}
953
- </VStack>
954
- </VStack>
955
-
956
- {/* Promo Code */}
957
- <VStack gap={3}>
958
- <Heading level={2}>Promo code</Heading>
959
- <HStack gap={2} vAlign="end">
960
- <StackItem size="fill">
961
- <TextInput
962
- size="lg"
963
- label="Promo code"
964
- placeholder="Enter promo code"
965
- value={promo}
966
- onChange={setPromo}
967
- style={fullWidth}
968
- />
969
- </StackItem>
970
- <Button
971
- label="Apply"
972
- variant="secondary"
973
- size="lg"
974
- onClick={() => {}}
975
- />
976
- </HStack>
977
- </VStack>
978
-
979
- {/* Gift Options */}
980
- <VStack gap={3}>
981
- <Heading level={2}>Gift options</Heading>
982
- <CheckboxInput
983
- label="Add a gift message"
984
- value={addGiftMessage}
985
- onChange={setAddGiftMessage}
986
- />
987
- {addGiftMessage && (
988
- <VStack gap={3}>
989
- <Grid columns={isMobile ? 1 : 2} gap={3}>
990
- <TextInput
991
- size="lg"
992
- label="To"
993
- placeholder="Recipient name"
994
- value={giftTo}
995
- onChange={setGiftTo}
996
- />
997
- <TextInput
998
- size="lg"
999
- label="From"
1000
- placeholder="Your name"
1001
- value={giftFrom}
1002
- onChange={setGiftFrom}
1003
- />
1004
- </Grid>
1005
- <TextArea
1006
- label="Gift message"
1007
- placeholder="Write something here"
1008
- value={giftMessage}
1009
- onChange={setGiftMessage}
1010
- />
1011
- </VStack>
1012
- )}
1013
- </VStack>
1014
-
1015
- {/* Trust bar + CTAs + policy links */}
1016
- <VStack gap={4}>
1017
- <TrustBar />
1018
- <VStack gap={2}>
1019
- <Button
1020
- label="Place order"
1021
- variant="primary"
1022
- size="lg"
1023
- style={fullWidth}
1024
- onClick={() => setSubmitted(true)}
1025
- />
1026
- <Button
1027
- label="Continue shopping"
1028
- variant="secondary"
1029
- size="lg"
1030
- style={fullWidth}
1031
- onClick={() => {}}
1032
- />
1033
- </VStack>
1034
- <Divider />
1035
- <PolicyLinks />
1036
- </VStack>
1037
- </VStack>
1038
- </StackItem>
1039
-
1040
- <StackItem
1041
- size="fill"
1042
- style={isStacked ? summaryMobileOrder : summarySticky}>
1043
- <OrderSummaryCard
1044
- quantities={quantities}
1045
- onChangeQty={(id, v) =>
1046
- setQuantities(q => ({...q, [id]: v}))
1047
- }
1048
- subtotal={subtotal}
1049
- shipping={shipping}
1050
- tax={tax}
1051
- total={total}
1052
- />
1053
- </StackItem>
1054
- </Stack>
1055
- </VStack>
1056
- </Section>
1057
- </Center>
1058
- </LayoutContent>
1059
- }
1060
- />
1061
- );
666
+ <HStack gap={1.5} vAlign="center">
667
+ <svg viewBox="0 0 48 32" role="img" aria-label="Visa" style={cardLogo}>
668
+ <rect width="48" height="32" fill="var(--color-background-surface)" />
669
+ <text
670
+ x="24"
671
+ y="21"
672
+ textAnchor="middle"
673
+ fontSize="10"
674
+ fontStyle="italic"
675
+ fill="var(--dracula-comment)"
676
+ >
677
+ VISA
678
+ </text>
679
+ </svg>
680
+ <svg
681
+ viewBox="0 0 48 32"
682
+ role="img"
683
+ aria-label="Mastercard"
684
+ style={cardLogo}
685
+ >
686
+ <rect width="48" height="32" fill="var(--color-background-surface)" />
687
+ <circle cx="19" cy="16" r="8" fill="var(--dracula-red)" />
688
+ <circle
689
+ cx="29"
690
+ cy="16"
691
+ r="8"
692
+ fill="var(--dracula-orange)"
693
+ opacity={0.85}
694
+ />
695
+ </svg>
696
+ <svg viewBox="0 0 48 32" role="img" aria-label="Amex" style={cardLogo}>
697
+ <rect width="48" height="32" fill="var(--color-background-surface)" />
698
+ <text
699
+ x="24"
700
+ y="21"
701
+ textAnchor="middle"
702
+ fontSize="10"
703
+ fill="var(--dracula-cyan)"
704
+ >
705
+ AMEX
706
+ </text>
707
+ </svg>
708
+ </HStack>
709
+ <TextInput
710
+ size="lg"
711
+ label="Card Number"
712
+ isRequired
713
+ placeholder="1234 5678 9012 3456"
714
+ value={cardNumber}
715
+ onChange={setCardNumber}
716
+ status={
717
+ errors.cardNumber
718
+ ? { type: "error", message: errors.cardNumber }
719
+ : undefined
720
+ }
721
+ />
722
+ <Grid columns={isMobile ? 1 : 3} gap={3}>
723
+ <Selector
724
+ size="lg"
725
+ label="Expiry Month"
726
+ isRequired
727
+ placeholder="MM"
728
+ options={MONTHS}
729
+ value={expiry}
730
+ onChange={setExpiry}
731
+ status={
732
+ errors.expiry
733
+ ? { type: "error", message: errors.expiry }
734
+ : undefined
735
+ }
736
+ />
737
+ <Selector
738
+ size="lg"
739
+ label="Expiry Year"
740
+ isRequired
741
+ placeholder="YY"
742
+ options={YEARS}
743
+ value={expYear}
744
+ onChange={setExpYear}
745
+ status={
746
+ errors.expYear
747
+ ? { type: "error", message: errors.expYear }
748
+ : undefined
749
+ }
750
+ />
751
+ <TextInput
752
+ size="lg"
753
+ label="CVC"
754
+ isRequired
755
+ placeholder="123"
756
+ value={cvc}
757
+ onChange={setCvc}
758
+ labelTooltip="3-digit security code usually found on the back of your card. American Express cards have a 4-digit code located on the front."
759
+ status={
760
+ errors.cvc ? { type: "error", message: errors.cvc } : undefined
761
+ }
762
+ />
763
+ </Grid>
764
+ <TextInput
765
+ size="lg"
766
+ label="Name on Card"
767
+ isRequired
768
+ placeholder="Vlad Dracul"
769
+ value={cardName}
770
+ onChange={setCardName}
771
+ status={
772
+ errors.cardName
773
+ ? { type: "error", message: errors.cardName }
774
+ : undefined
775
+ }
776
+ />
777
+ <CheckboxInput
778
+ label="Use shipping address as billing address"
779
+ value={billingMatchesShipping}
780
+ onChange={setBillingMatchesShipping}
781
+ />
782
+ {!billingMatchesShipping && (
783
+ <VStack gap={3}>
784
+ <TextInput
785
+ size="lg"
786
+ label="Address"
787
+ isRequired
788
+ placeholder="666 Castle Way"
789
+ value={billingAddress}
790
+ onChange={setBillingAddress}
791
+ status={
792
+ errors.billingAddress
793
+ ? {
794
+ type: "error",
795
+ message: errors.billingAddress,
796
+ }
797
+ : undefined
798
+ }
799
+ />
800
+ <Grid columns={isMobile ? 1 : 2} gap={3}>
801
+ <TextInput
802
+ size="lg"
803
+ label="City"
804
+ isRequired
805
+ placeholder="Transylvania"
806
+ value={billingCity}
807
+ onChange={setBillingCity}
808
+ status={
809
+ errors.billingCity
810
+ ? {
811
+ type: "error",
812
+ message: errors.billingCity,
813
+ }
814
+ : undefined
815
+ }
816
+ />
817
+ <TextInput
818
+ size="lg"
819
+ label="ZIP Code"
820
+ isRequired
821
+ placeholder="40000"
822
+ value={billingZip}
823
+ onChange={setBillingZip}
824
+ status={
825
+ errors.billingZip
826
+ ? {
827
+ type: "error",
828
+ message: errors.billingZip,
829
+ }
830
+ : undefined
831
+ }
832
+ />
833
+ </Grid>
834
+ <Selector
835
+ size="lg"
836
+ label="State"
837
+ isRequired
838
+ placeholder="Select state"
839
+ options={US_STATES}
840
+ value={billingState}
841
+ onChange={setBillingState}
842
+ status={
843
+ errors.billingState
844
+ ? {
845
+ type: "error",
846
+ message: errors.billingState,
847
+ }
848
+ : undefined
849
+ }
850
+ />
851
+ </VStack>
852
+ )}
853
+ </VStack>
854
+ </VStack>
855
+
856
+ {/* Promo Code */}
857
+ <VStack gap={3}>
858
+ <Heading level={2}>Promo code</Heading>
859
+ <HStack gap={2} vAlign="end">
860
+ <StackItem size="fill">
861
+ <TextInput
862
+ size="lg"
863
+ label="Promo code"
864
+ placeholder="Enter promo code"
865
+ value={promo}
866
+ onChange={setPromo}
867
+ controlStyle={fullWidth}
868
+ />
869
+ </StackItem>
870
+ <Button label="Apply" variant="secondary" size="lg" onClick={() => {}} />
871
+ </HStack>
872
+ </VStack>
873
+
874
+ {/* Gift Options */}
875
+ <VStack gap={3}>
876
+ <Heading level={2}>Gift options</Heading>
877
+ <CheckboxInput
878
+ label="Add a gift message"
879
+ value={addGiftMessage}
880
+ onChange={setAddGiftMessage}
881
+ />
882
+ {addGiftMessage && (
883
+ <VStack gap={3}>
884
+ <Grid columns={isMobile ? 1 : 2} gap={3}>
885
+ <TextInput
886
+ size="lg"
887
+ label="To"
888
+ placeholder="Recipient name"
889
+ value={giftTo}
890
+ onChange={setGiftTo}
891
+ />
892
+ <TextInput
893
+ size="lg"
894
+ label="From"
895
+ placeholder="Your name"
896
+ value={giftFrom}
897
+ onChange={setGiftFrom}
898
+ />
899
+ </Grid>
900
+ <TextArea
901
+ label="Gift message"
902
+ placeholder="Write something here"
903
+ value={giftMessage}
904
+ onChange={setGiftMessage}
905
+ />
906
+ </VStack>
907
+ )}
908
+ </VStack>
909
+
910
+ {/* Trust bar + CTAs + policy links */}
911
+ <VStack gap={4}>
912
+ <TrustBar />
913
+ <VStack gap={2}>
914
+ <Button
915
+ label="Place order"
916
+ variant="primary"
917
+ size="lg"
918
+ style={fullWidth}
919
+ onClick={() => setSubmitted(true)}
920
+ />
921
+ <Button
922
+ label="Continue shopping"
923
+ variant="secondary"
924
+ size="lg"
925
+ style={fullWidth}
926
+ onClick={() => {}}
927
+ />
928
+ </VStack>
929
+ <Divider />
930
+ <PolicyLinks />
931
+ </VStack>
932
+ </VStack>
933
+ </StackItem>
934
+
935
+ <StackItem size="fill" style={isStacked ? summaryMobileOrder : summarySticky}>
936
+ <OrderSummaryCard
937
+ quantities={quantities}
938
+ onChangeQty={(id, v) => setQuantities((q) => ({ ...q, [id]: v }))}
939
+ subtotal={subtotal}
940
+ shipping={shipping}
941
+ tax={tax}
942
+ total={total}
943
+ />
944
+ </StackItem>
945
+ </Stack>
946
+ </VStack>
947
+ </Section>
948
+ </Center>
949
+ </LayoutContent>
950
+ }
951
+ />
952
+ );
1062
953
  }