@gntik-ai/templates 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/index.d.ts +58 -18
  2. package/dist/index.js +471 -391
  3. package/dist/index.js.map +1 -1
  4. package/package.json +8 -8
  5. package/src/assistant-chat/Page.test.tsx +37 -7
  6. package/src/assistant-chat/Page.tsx +98 -137
  7. package/src/assistant-chat/data.ts +69 -1
  8. package/src/assistant-chat/examples/AdapterChat.tsx +9 -0
  9. package/src/assistant-chat/template.meta.ts +1 -1
  10. package/src/board/Lane.tsx +1 -1
  11. package/src/code-editor/Page.test.tsx +12 -0
  12. package/src/code-editor/Page.tsx +2 -1
  13. package/src/code-editor/examples/PaletteTypography.tsx +130 -0
  14. package/src/code-editor/template.meta.ts +1 -1
  15. package/src/contact/Page.test.tsx +106 -0
  16. package/src/contact/Page.tsx +21 -3
  17. package/src/contact/PublicFrame.tsx +2 -17
  18. package/src/contact/examples/CustomFailure.tsx +24 -0
  19. package/src/contact/examples/FailedSend.tsx +19 -0
  20. package/src/contact/template.meta.ts +2 -2
  21. package/src/docs-article/Page.tsx +1 -1
  22. package/src/help-home/Page.test.tsx +10 -0
  23. package/src/help-home/Page.tsx +2 -4
  24. package/src/incident-console/Page.tsx +1 -1
  25. package/src/keyboard-shortcuts/Page.test.tsx +23 -1
  26. package/src/keyboard-shortcuts/Page.tsx +13 -3
  27. package/src/keyboard-shortcuts/ShortcutSheet.tsx +4 -5
  28. package/src/landing/Page.tsx +3 -17
  29. package/src/landing/template.meta.ts +1 -1
  30. package/src/messaging/Page.test.tsx +20 -3
  31. package/src/messaging/Page.tsx +15 -43
  32. package/src/messaging/template.meta.ts +1 -1
  33. package/src/notification-inbox/Page.tsx +1 -1
  34. package/src/pending-activation/Page.test.tsx +1 -1
  35. package/src/pricing/PublicFrame.tsx +2 -17
  36. package/src/pricing/template.meta.ts +1 -1
  37. package/src/resource-detail/CustomTabs.tsx +41 -0
  38. package/src/resource-detail/Page.default.test.tsx +29 -0
  39. package/src/resource-detail/Page.shell-less.test.tsx +36 -0
  40. package/src/resource-detail/Page.tabs.test.tsx +116 -0
  41. package/src/resource-detail/Page.tsx +62 -27
  42. package/src/resource-detail/__snapshots__/Page.default.test.tsx.snap +5 -0
  43. package/src/resource-detail/examples/embedded-custom-tabs.tsx +44 -0
  44. package/src/resource-detail/template.meta.ts +1 -1
  45. package/src/resource-index/Page.test.tsx +178 -1
  46. package/src/resource-index/Page.tsx +59 -3
  47. package/src/resource-index/examples/UrlSynced.tsx +10 -0
  48. package/src/resource-index/template.meta.ts +1 -1
  49. package/src/resource-tree/Page.tsx +1 -1
  50. package/src/run-trace/Page.tsx +2 -2
  51. package/src/scorecard/Page.test.tsx +54 -0
  52. package/src/scorecard/Page.tsx +2 -0
  53. package/src/scorecard/data.ts +1 -1
  54. package/src/search-results/Page.tsx +3 -6
  55. package/src/settings-appearance/Page.test.tsx +36 -1
  56. package/src/settings-appearance/Page.tsx +15 -2
  57. package/src/settings-appearance/template.meta.ts +2 -1
  58. package/src/settings-profile/__tests__/dom.ts +4 -2
  59. package/src/settings-profile/fixtures/editable.snap +1 -1
  60. package/src/shared/ConsoleShell.context.test.tsx +125 -0
  61. package/src/shared/ConsoleShell.navigation.test.tsx +100 -0
  62. package/src/shared/ConsoleShell.tsx +38 -9
  63. package/src/shell-sidebar/Examples.test.tsx +73 -0
  64. package/src/shell-sidebar/examples/Brand.tsx +16 -0
  65. package/src/shell-sidebar/examples/ContextRegion.tsx +26 -0
  66. package/src/shell-sidebar/examples/PlatformWide.tsx +11 -0
  67. package/src/shell-sidebar/examples/Tenants.tsx +42 -0
  68. package/src/shell-sidebar/examples/UserMenuChildren.tsx +23 -0
  69. package/src/shell-sidebar/template.meta.ts +1 -1
  70. package/src/sign-in/BrandPanel.tsx +2 -2
  71. package/src/sign-in/Page.test.tsx +5 -0
  72. package/src/sso-login/Page.test.tsx +6 -0
  73. package/src/sso-login/Page.tsx +1 -0
  74. package/src/test/public-footer.test.tsx +44 -0
  75. package/src/test/without-forced-colors.test.ts +44 -0
  76. package/src/test/without-forced-colors.ts +14 -0
@@ -0,0 +1,130 @@
1
+ import { useState } from 'react';
2
+ import { Markdown, ModelPicker } from '@gntik-ai/chat';
3
+ import { CodeEditor, DiffEditor } from '@gntik-ai/editor';
4
+ import {
5
+ Button,
6
+ CodeBlock,
7
+ JsonViewer,
8
+ Select,
9
+ SelectContent,
10
+ SelectGroup,
11
+ SelectGroupLabel,
12
+ SelectItem,
13
+ SelectLabel,
14
+ SelectTrigger,
15
+ Separator,
16
+ Terminal,
17
+ ThemeScope,
18
+ useTheme,
19
+ } from '@gntik-ai/ui';
20
+
21
+ // This preview runs in its own iframe. It temporarily gives navy opt-in typography;
22
+ // the shipped navy palette and its colours are unchanged.
23
+ const previewPalette = `
24
+ [data-palette="navy"] {
25
+ --font-sans: "Inter", "Geist", "Helvetica Neue", Arial, sans-serif;
26
+ --font-mono: "Courier New", monospace;
27
+ --font-style-emphasis: normal;
28
+ --text-transform-label: none;
29
+ }`;
30
+ const original = '// Original comment\nconst count = 1;';
31
+ const modified = '// Modified comment\nconst count = 2;';
32
+
33
+ function Editors({ label }: { label: string }) {
34
+ return (
35
+ <div className="space-y-3" data-editors={label}>
36
+ <CodeEditor defaultValue={original} language="javascript" height={120} aria-label={`${label} code`} />
37
+ <DiffEditor
38
+ original={original}
39
+ modified={modified}
40
+ language="javascript"
41
+ height={140}
42
+ aria-label={`${label} diff`}
43
+ />
44
+ </div>
45
+ );
46
+ }
47
+
48
+ export default function PaletteTypography() {
49
+ const { resolved, setMode } = useTheme();
50
+ const [custom, setCustom] = useState(true);
51
+ const [palette, setPalette] = useState<'navy' | 'green'>('navy');
52
+ return (
53
+ <section className="space-y-6 p-6" aria-label="Typography in palettes">
54
+ {custom && <style>{previewPalette}</style>}
55
+ <h1 className="text-heading-lg">Typography in palettes</h1>
56
+ <p>
57
+ This example opts into self-hosted Inter, upright emphasis and sentence-case labels. Editors follow the mono
58
+ font; editor colours follow the page theme. Green restores the defaults, including in nested scopes.
59
+ </p>
60
+ <div className="flex flex-wrap gap-2">
61
+ <Button
62
+ onClick={() => {
63
+ setCustom(!custom);
64
+ setPalette(custom ? 'green' : 'navy');
65
+ }}
66
+ aria-pressed={custom}
67
+ >
68
+ Custom typography
69
+ </Button>
70
+ <Button onClick={() => setPalette(palette === 'navy' ? 'green' : 'navy')}>Switch scope palette</Button>
71
+ {(['dark', 'light', 'high_contrast'] as const).map((theme) => (
72
+ <Button key={theme} onClick={() => setMode(theme)} aria-pressed={resolved === theme}>
73
+ {theme}
74
+ </Button>
75
+ ))}
76
+ </div>
77
+ <ThemeScope
78
+ theme={resolved}
79
+ data-palette={palette}
80
+ data-typography-scope
81
+ className="space-y-4 rounded-lg border border-border bg-background p-4 text-foreground"
82
+ >
83
+ <p>
84
+ <em>Scoped emphasis</em> and <i>scoped italic</i>
85
+ </p>
86
+ <Separator label="Scope label" labelStyle="kicker" />
87
+ <Select defaultValue="one" items={[{ value: 'one', label: 'First option' }]} modal={false}>
88
+ <SelectLabel>Typography choice</SelectLabel>
89
+ <SelectTrigger />
90
+ <SelectContent>
91
+ <SelectGroup>
92
+ <SelectGroupLabel>Available choices</SelectGroupLabel>
93
+ <SelectItem value="one">
94
+ <em>Portal emphasis</em>
95
+ </SelectItem>
96
+ </SelectGroup>
97
+ </SelectContent>
98
+ </Select>
99
+ <CodeBlock code="// CodeBlock comment" language="javascript" />
100
+ <JsonViewer data={{ empty: null }} />
101
+ <Markdown>{'![Preview](javascript:blocked)'}</Markdown>
102
+ <Terminal lines={['\u001b[3mANSI emphasis\u001b[0m']} toolbar={false} />
103
+ <ModelPicker
104
+ label="Typography model"
105
+ value={null}
106
+ onValueChange={() => {}}
107
+ models={[
108
+ {
109
+ id: 'local',
110
+ name: 'Local model',
111
+ provider: 'Local',
112
+ disabled: true,
113
+ disabledReason: 'Unavailable reason',
114
+ },
115
+ ]}
116
+ />
117
+ <Editors label="scoped" />
118
+ <ThemeScope theme={resolved} data-palette="green" data-inner-typography-scope className="space-y-3">
119
+ <p>
120
+ <em>Nested emphasis</em>
121
+ </p>
122
+ <Editors label="inner" />
123
+ </ThemeScope>
124
+ </ThemeScope>
125
+ <div data-html-card className="bg-card">
126
+ <Editors label="sibling" />
127
+ </div>
128
+ </section>
129
+ );
130
+ }
@@ -6,7 +6,7 @@ export const meta: TemplateMeta = {
6
6
  priority: 'P3',
7
7
  status: 'experimental',
8
8
  description:
9
- 'Full-screen code editor: CanvasLayout top bar (breadcrumb, title, status, branch, Save), a file TreeList with a context menu (open, copy path, close tab, delete) in the palette, and the CodePanel block (file tabs, Monaco editor or diff, problems list) as the canvas.',
9
+ 'Full-screen code editor: CanvasLayout top bar (breadcrumb, title, status, branch, Save), a file TreeList with a context menu (open, copy path, close tab, delete) in the palette, and the CodePanel block (file tabs, Monaco editor or diff, problems list) as the canvas. The Typography in palettes example demonstrates opt-in Inter, upright emphasis, sentence-case labels, scoped and nested editor mono fonts, and shared page-theme editor colours.',
10
10
  layout: 'CanvasLayout',
11
11
  blocks: ['code-panel'],
12
12
  };
@@ -1,10 +1,116 @@
1
+ import { I18nProvider } from '@gntik-ai/ui';
1
2
  import { render, screen, within } from '@testing-library/react';
2
3
  import userEvent from '@testing-library/user-event';
3
4
  import { expectNoAxeViolations } from '../test/a11y';
4
5
  import ContactPage from './Page';
5
6
  import { offices } from './data';
6
7
 
8
+ const validValues = {
9
+ name: 'Ada Example',
10
+ email: 'ada@example.com',
11
+ company: 'Example Ltd',
12
+ topic: 'sales' as const,
13
+ message: 'We would like a demo for 40 seats.',
14
+ };
15
+
7
16
  describe('ContactPage', () => {
17
+ it('clears the alert before retrying, then focuses success and resets without an error', async () => {
18
+ const onSubmit = vi
19
+ .fn()
20
+ .mockRejectedValueOnce(new Error('502 Bad Gateway'))
21
+ .mockImplementationOnce(() => {
22
+ expect(screen.queryByRole('alert')).not.toBeInTheDocument();
23
+ return Promise.resolve();
24
+ });
25
+ render(<ContactPage onSubmit={onSubmit} defaultValues={validValues} />);
26
+ await userEvent.click(screen.getByRole('button', { name: 'Send message' }));
27
+ expect(await screen.findByRole('alert')).toBeInTheDocument();
28
+
29
+ await userEvent.click(screen.getByRole('button', { name: 'Send message' }));
30
+ expect(await screen.findByRole('heading', { name: 'Message sent' })).toBeInTheDocument();
31
+ expect(onSubmit).toHaveBeenCalledTimes(2);
32
+ expect(screen.queryByRole('alert')).not.toBeInTheDocument();
33
+ expect(screen.getByRole('status')).toHaveFocus();
34
+
35
+ await userEvent.click(screen.getByRole('button', { name: 'Send another message' }));
36
+ expect(screen.getByRole('form', { name: 'Contact form' })).toBeInTheDocument();
37
+ expect(screen.getByRole('textbox', { name: /^Name/ })).toHaveValue('Ada Example');
38
+ expect(screen.queryByRole('alert')).not.toBeInTheDocument();
39
+ });
40
+
41
+ it.each(['dark', 'light', 'high_contrast'])(
42
+ 'keeps the form and safely announces a failed send (%s)',
43
+ { timeout: 15000 },
44
+ async (theme) => {
45
+ document.documentElement.className = theme;
46
+ const onSubmit = vi.fn().mockRejectedValue(new Error('502 Bad Gateway'));
47
+ render(<ContactPage onSubmit={onSubmit} defaultValues={{ topic: 'sales' }} />);
48
+ await userEvent.type(screen.getByRole('textbox', { name: /^Name/ }), 'Ada Example');
49
+ await userEvent.type(screen.getByRole('textbox', { name: /Work email/ }), 'ada@example.com');
50
+ await userEvent.type(screen.getByRole('textbox', { name: /Company/ }), 'Example Ltd');
51
+ await userEvent.type(screen.getByRole('textbox', { name: /Message/ }), 'We would like a demo for 40 seats.');
52
+ const send = screen.getByRole('button', { name: 'Send message' });
53
+ await userEvent.click(send);
54
+
55
+ expect(await screen.findByRole('alert')).toHaveTextContent("We couldn't send your message. Please try again.");
56
+ expect(screen.getByRole('textbox', { name: /^Name/ })).toHaveValue('Ada Example');
57
+ expect(screen.getByRole('textbox', { name: /Work email/ })).toHaveValue('ada@example.com');
58
+ expect(screen.getByRole('textbox', { name: /Company/ })).toHaveValue('Example Ltd');
59
+ expect(screen.getByRole('combobox', { name: /Topic/ })).toHaveTextContent('Sales');
60
+ expect(screen.getByRole('textbox', { name: /Message/ })).toHaveValue('We would like a demo for 40 seats.');
61
+ expect(screen.queryByRole('heading', { name: 'Message sent' })).not.toBeInTheDocument();
62
+ expect(screen.queryByRole('status')).not.toBeInTheDocument();
63
+ expect(screen.queryByText('502 Bad Gateway')).not.toBeInTheDocument();
64
+ expect(send).toBeEnabled();
65
+ expect(send).not.toHaveAttribute('aria-busy', 'true');
66
+ expect(send).toHaveFocus();
67
+ await expectNoAxeViolations();
68
+ },
69
+ );
70
+
71
+ it('uses the visitor-facing message override without exposing the rejection', async () => {
72
+ render(
73
+ <ContactPage
74
+ defaultValues={validValues}
75
+ onSubmit={vi.fn().mockRejectedValue(new Error('502 Bad Gateway'))}
76
+ submitErrorMessage={<span>Sending is paused. Email us instead.</span>}
77
+ />,
78
+ );
79
+ await userEvent.click(screen.getByRole('button', { name: 'Send message' }));
80
+ expect(await screen.findByRole('alert')).toHaveTextContent('Sending is paused. Email us instead.');
81
+ expect(screen.queryByText("We couldn't send your message. Please try again.")).not.toBeInTheDocument();
82
+ expect(screen.queryByText('502 Bad Gateway')).not.toBeInTheDocument();
83
+ });
84
+
85
+ it('uses the Spanish catalog for send failures', async () => {
86
+ render(
87
+ <I18nProvider locale="es">
88
+ <ContactPage defaultValues={validValues} onSubmit={vi.fn().mockRejectedValue(new Error('502 Bad Gateway'))} />
89
+ </I18nProvider>,
90
+ );
91
+ await userEvent.click(screen.getByRole('button', { name: 'Send message' }));
92
+ expect(await screen.findByRole('alert')).toHaveTextContent(
93
+ 'No hemos podido enviar tu mensaje. Inténtalo de nuevo.',
94
+ );
95
+ });
96
+
97
+ it('does not call onSubmit or show a send-failure alert for invalid values', async () => {
98
+ const onSubmit = vi.fn();
99
+ render(<ContactPage onSubmit={onSubmit} />);
100
+ await userEvent.click(screen.getByRole('button', { name: 'Send message' }));
101
+ expect(screen.getAllByText('Enter your name.').length).toBeGreaterThan(0);
102
+ expect(onSubmit).not.toHaveBeenCalled();
103
+ expect(screen.queryByRole('alert')).not.toBeInTheDocument();
104
+ });
105
+
106
+ it('shows no alert after a successful send', async () => {
107
+ render(<ContactPage defaultValues={validValues} onSubmit={vi.fn().mockResolvedValue(undefined)} />);
108
+ await userEvent.click(screen.getByRole('button', { name: 'Send message' }));
109
+ expect(await screen.findByRole('heading', { name: 'Message sent' })).toBeInTheDocument();
110
+ expect(screen.getByRole('status')).toHaveFocus();
111
+ expect(screen.queryByRole('alert')).not.toBeInTheDocument();
112
+ });
113
+
8
114
  it('renders the form and office cards', { timeout: 15000 }, async () => {
9
115
  render(<ContactPage />);
10
116
  expect(screen.getByRole('main')).toBeInTheDocument();
@@ -1,6 +1,7 @@
1
1
  import { ValidationSummary, type ValidationIssue } from '@gntik-ai/blocks';
2
2
  import { CircleCheck, Clock, Mail, MapPin, Phone, Send } from '@gntik-ai/icons';
3
3
  import {
4
+ Alert,
4
5
  Button,
5
6
  Card,
6
7
  CardBody,
@@ -20,9 +21,11 @@ import {
20
21
  Stack,
21
22
  Text,
22
23
  Textarea,
24
+ useI18n,
23
25
  type MegaMenuItem,
24
26
  } from '@gntik-ai/ui';
25
27
  import { useId, useState, type ReactNode } from 'react';
28
+ import { flushSync } from 'react-dom';
26
29
  import {
27
30
  contactTopics,
28
31
  emptyContact,
@@ -46,8 +49,10 @@ export interface ContactProps {
46
49
  topics: Array<{ value: ContactTopic; label: string }>;
47
50
  offices: Office[];
48
51
  defaultValues: Partial<ContactValues>;
49
- /** Called with valid values; the page shows the success state once it resolves. */
52
+ /** Called with valid values; resolution shows success and rejection shows the error alert. */
50
53
  onSubmit: (values: ContactValues) => void | Promise<void>;
54
+ /** Visitor-facing send failure message; defaults to the localized contact.sendFailed text. */
55
+ submitErrorMessage?: ReactNode;
51
56
  footerLinks: Array<{ label: string; href: string }>;
52
57
  copyright: ReactNode;
53
58
  }
@@ -60,7 +65,7 @@ const LABELS: Record<keyof ContactValues, string> = {
60
65
  message: 'Message',
61
66
  };
62
67
 
63
- /** Public contact page: StackedLayout + MegaMenu, a validated form with a success state, and office cards. */
68
+ /** Public contact page: validated form with send-failure feedback, a focused success state, and office cards. */
64
69
  export default function ContactPage(props: Partial<ContactProps>) {
65
70
  const {
66
71
  brand,
@@ -72,13 +77,16 @@ export default function ContactPage(props: Partial<ContactProps>) {
72
77
  offices: officeList = offices,
73
78
  defaultValues,
74
79
  onSubmit,
80
+ submitErrorMessage,
75
81
  footerLinks = publicFooterLinks,
76
82
  copyright = publicCopyright,
77
83
  } = props;
84
+ const { t } = useI18n();
78
85
  const [values, setValues] = useState<ContactValues>({ ...emptyContact, ...defaultValues });
79
86
  const [submitCount, setSubmitCount] = useState(0);
80
87
  const [sending, setSending] = useState(false);
81
88
  const [sent, setSent] = useState(false);
89
+ const [submitError, setSubmitError] = useState(false);
82
90
  const ids = useId();
83
91
  const fieldId = (k: keyof ContactValues) => `${ids}-${k}`;
84
92
 
@@ -94,10 +102,16 @@ export default function ContactPage(props: Partial<ContactProps>) {
94
102
  const submit = async () => {
95
103
  setSubmitCount((n) => n + 1);
96
104
  if (Object.keys(validateContact(values)).length > 0) return;
97
- setSending(true);
105
+ // Commit the cleared alert before the consumer's submission callback starts.
106
+ flushSync(() => {
107
+ setSubmitError(false);
108
+ setSending(true);
109
+ });
98
110
  try {
99
111
  await onSubmit?.(values);
100
112
  setSent(true);
113
+ } catch {
114
+ setSubmitError(true);
101
115
  } finally {
102
116
  setSending(false);
103
117
  }
@@ -106,6 +120,7 @@ export default function ContactPage(props: Partial<ContactProps>) {
106
120
  setValues({ ...emptyContact, ...defaultValues });
107
121
  setSubmitCount(0);
108
122
  setSent(false);
123
+ setSubmitError(false);
109
124
  };
110
125
 
111
126
  return (
@@ -215,6 +230,9 @@ export default function ContactPage(props: Partial<ContactProps>) {
215
230
  <Text variant="caption" tone="muted">
216
231
  By sending this form you agree to our <Link href="/privacy">privacy policy</Link>.
217
232
  </Text>
233
+ {submitError && (
234
+ <Alert tone="destructive" description={submitErrorMessage ?? t('contact.sendFailed')} />
235
+ )}
218
236
  <div>
219
237
  <Button type="submit" icon={Send} loading={sending}>
220
238
  Send message
@@ -1,6 +1,6 @@
1
+ import { SiteFooter } from '@gntik-ai/blocks';
1
2
  import {
2
3
  Button,
3
- Link,
4
4
  Logo,
5
5
  MegaMenu,
6
6
  MobileNav,
@@ -61,22 +61,7 @@ export function PublicFrame({
61
61
  </>
62
62
  }
63
63
  subnav={<MegaMenu items={menu} currentHref={currentHref} label="Primary" className="hidden lg:block" />}
64
- footer={
65
- <div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
66
- <span>{copyright}</span>
67
- <nav aria-label="Footer">
68
- <ul className="flex flex-wrap gap-x-4 gap-y-1">
69
- {footerLinks.map((l) => (
70
- <li key={l.href}>
71
- <Link href={l.href} tone="muted" underline="hover">
72
- {l.label}
73
- </Link>
74
- </li>
75
- ))}
76
- </ul>
77
- </nav>
78
- </div>
79
- }
64
+ footer={<SiteFooter layout="simple" links={footerLinks} copyright={copyright} />}
80
65
  >
81
66
  {children}
82
67
  </StackedLayout>
@@ -0,0 +1,24 @@
1
+ import { Link, useI18n } from '@gntik-ai/ui';
2
+ import { useRef } from 'react';
3
+ import ContactPage from '../Page';
4
+
5
+ /** The first send shows a custom support link; submitting again succeeds. */
6
+ export default function CustomFailure() {
7
+ const { t } = useI18n();
8
+ const attempts = useRef(0);
9
+ return (
10
+ <ContactPage
11
+ defaultValues={{
12
+ name: 'Ada Example',
13
+ email: 'ada@example.com',
14
+ company: 'Example Ltd',
15
+ topic: 'sales',
16
+ message: 'We would like a demo for 40 seats.',
17
+ }}
18
+ submitErrorMessage={<Link href="mailto:contact@example.com">{t('error.support')}</Link>}
19
+ onSubmit={async () => {
20
+ if (attempts.current++ === 0) throw new Error();
21
+ }}
22
+ />
23
+ );
24
+ }
@@ -0,0 +1,19 @@
1
+ import ContactPage from '../Page';
2
+
3
+ /** Submit the prefilled form to see safe failure feedback with every value preserved. */
4
+ export default function FailedSend() {
5
+ return (
6
+ <ContactPage
7
+ defaultValues={{
8
+ name: 'Ada Example',
9
+ email: 'ada@example.com',
10
+ company: 'Example Ltd',
11
+ topic: 'sales',
12
+ message: 'We would like a demo for 40 seats.',
13
+ }}
14
+ onSubmit={async () => {
15
+ throw new Error();
16
+ }}
17
+ />
18
+ );
19
+ }
@@ -6,7 +6,7 @@ export const meta: TemplateMeta = {
6
6
  priority: 'P3',
7
7
  status: 'experimental',
8
8
  description:
9
- 'Public contact page: StackedLayout with a MegaMenu (MobileNav below lg), a validated contact form (Field, Input, Select, Textarea, ValidationSummary) with a focused success state, and office cards with address, email, phone and hours.',
9
+ 'Public contact page: StackedLayout with a MegaMenu (MobileNav below lg), a validated contact form (Field, Input, Select, Textarea, ValidationSummary) with a focused success state and a destructive Alert on failed sends. Failed sends keep all values and use submitErrorMessage or localized contact.sendFailed text without exposing backend errors. Includes office cards with address, email, phone and hours.',
10
10
  layout: 'StackedLayout',
11
- blocks: ['validation-summary'],
11
+ blocks: ['site-footer', 'validation-summary'],
12
12
  };
@@ -188,7 +188,7 @@ export default function DocsArticlePage(props: Partial<DocsArticleProps>) {
188
188
  }
189
189
  >
190
190
  {breadcrumbs && <Breadcrumbs items={breadcrumbs} className="mb-4" />}
191
- <p className="font-mono text-[11px] tracking-[0.18em] text-primary-text uppercase">{eyebrow}</p>
191
+ <p className="font-mono text-[11px] tracking-[0.18em] text-primary-text label-case">{eyebrow}</p>
192
192
  <h1 className="mt-2 text-[28px] font-bold tracking-[-0.02em] text-foreground">{title}</h1>
193
193
  <p className={`mt-3 ${P}`}>{lead}</p>
194
194
  <Text variant="caption" tone="muted" className="mt-2">
@@ -30,4 +30,14 @@ describe('HelpHomePage', () => {
30
30
  expect(screen.getByText('1 article')).toBeInTheDocument();
31
31
  expect(screen.queryByRole('heading', { name: 'Browse by topic' })).not.toBeInTheDocument();
32
32
  });
33
+
34
+ it('clears the search with Escape and brings the topics back', { timeout: 15000 }, async () => {
35
+ render(<HelpHomePage />);
36
+ const search = screen.getByRole('searchbox', { name: 'Search help articles' });
37
+ await userEvent.type(search, 'webhook');
38
+ expect(screen.queryByRole('heading', { name: 'Browse by topic' })).not.toBeInTheDocument();
39
+ await userEvent.keyboard('{Escape}');
40
+ expect(search).toHaveValue('');
41
+ expect(screen.getByRole('heading', { name: 'Browse by topic' })).toBeInTheDocument();
42
+ });
33
43
  });
@@ -7,10 +7,10 @@ import {
7
7
  EmptyState,
8
8
  Grid,
9
9
  Heading,
10
- Input,
11
10
  Link,
12
11
  Logo,
13
12
  NavList,
13
+ SearchField,
14
14
  Stack,
15
15
  Text,
16
16
  ThemeSwitcher,
@@ -86,12 +86,10 @@ export default function HelpHomePage(props: Partial<HelpHomeProps>) {
86
86
  </Heading>
87
87
  <Text tone="muted">{description}</Text>
88
88
  <form role="search" aria-label="Help articles" onSubmit={submit} className="max-w-xl">
89
- <Input
90
- type="search"
89
+ <SearchField
91
90
  aria-label="Search help articles"
92
91
  aria-describedby={`${ids}-count`}
93
92
  placeholder="Search articles…"
94
- leadingIcon={Search}
95
93
  value={query}
96
94
  onValueChange={setQuery}
97
95
  />
@@ -124,7 +124,7 @@ export default function IncidentConsolePage(props: Partial<IncidentConsoleProps>
124
124
  setSelectedId(i.id);
125
125
  setShowDetail(true);
126
126
  }}
127
- className="flex w-full flex-col gap-1.5 rounded-lg px-3 py-2.5 text-start hover:bg-accent/55 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring aria-[current=true]:bg-accent"
127
+ className="flex w-full flex-col gap-1.5 rounded-lg px-3 py-2.5 text-start hover:bg-accent/55 focus-ring aria-[current=true]:bg-accent"
128
128
  >
129
129
  <span className="flex items-center gap-2">
130
130
  <Badge tone={severityTones[i.severity]} size="sm">
@@ -1,4 +1,4 @@
1
- import { render, screen, within } from '@testing-library/react';
1
+ import { fireEvent, render, screen, within } from '@testing-library/react';
2
2
  import userEvent from '@testing-library/user-event';
3
3
  import { expectNoAxeViolations } from '../test/a11y';
4
4
  import KeyboardShortcutsPage, { KeyboardShortcutsDialog } from './Page';
@@ -43,6 +43,28 @@ describe('platform shortcut hints', () => {
43
43
  });
44
44
 
45
45
  describe('KeyboardShortcutsPage', () => {
46
+ it.each(['dark', 'light', 'high_contrast'])(
47
+ 'opens help and focuses search without intercepting typing in %s',
48
+ async (theme) => {
49
+ document.documentElement.className = theme;
50
+ const user = userEvent.setup();
51
+ render(<KeyboardShortcutsPage />);
52
+ fireEvent.keyDown(document.body, { key: '/' });
53
+ expect(screen.getByRole('searchbox', { name: 'Search shortcuts' })).toHaveFocus();
54
+ screen.getByRole('searchbox').blur();
55
+ fireEvent.keyDown(document.body, { key: '?', shiftKey: true });
56
+ const dialog = await screen.findByRole('dialog', { name: 'Keyboard shortcuts' });
57
+ const search = within(dialog).getByRole('searchbox', { name: 'Search shortcuts' });
58
+ await user.type(search, '?');
59
+ expect(search).toHaveValue('?');
60
+ expect(dialog).toBeInTheDocument();
61
+ const close = within(dialog).getByRole('button', { name: 'Close' });
62
+ close.focus();
63
+ fireEvent.keyDown(close, { key: '/' });
64
+ expect(search).toHaveFocus();
65
+ await expectNoAxeViolations();
66
+ },
67
+ );
46
68
  it('renders the console page with every group', { timeout: 15000 }, async () => {
47
69
  render(<KeyboardShortcutsPage />);
48
70
  expect(screen.getByRole('main')).toBeInTheDocument();
@@ -10,9 +10,10 @@ import {
10
10
  DialogTitle,
11
11
  DialogTrigger,
12
12
  Page,
13
+ useHotkeys,
13
14
  type BreadcrumbItem,
14
15
  } from '@gntik-ai/ui';
15
- import type { ReactElement } from 'react';
16
+ import { useRef, useState, type ReactElement } from 'react';
16
17
  import { ConsoleShell, type ConsoleShellProps } from '../shared/ConsoleShell';
17
18
  import { shortcutBreadcrumbs, shortcutGroups, type ShortcutGroup } from './data';
18
19
  import { ShortcutSheet } from './ShortcutSheet';
@@ -53,6 +54,7 @@ export default function KeyboardShortcutsPage(props: Partial<KeyboardShortcutsPr
53
54
  }
54
55
  >
55
56
  <ShortcutSheet groups={groups} />
57
+ <KeyboardShortcutsDialog groups={groups} title={title} trigger={null} />
56
58
  </Page>
57
59
  </ConsoleShell>
58
60
  );
@@ -77,10 +79,18 @@ export function KeyboardShortcutsDialog({
77
79
  trigger = <Button variant="secondary" icon={Keyboard} />,
78
80
  title = 'Keyboard shortcuts',
79
81
  }: KeyboardShortcutsDialogProps) {
82
+ const [openState, setOpenState] = useState(defaultOpen ?? false);
83
+ const content = useRef<HTMLDivElement>(null);
84
+ const setOpen = (next: boolean) => {
85
+ setOpenState(next);
86
+ onOpenChange?.(next);
87
+ };
88
+ useHotkeys({ '?': () => setOpen(true) });
89
+ useHotkeys({ '/': () => content.current?.querySelector('input')?.focus() }, { ref: content });
80
90
  return (
81
- <Dialog open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>
91
+ <Dialog open={open ?? openState} onOpenChange={setOpen}>
82
92
  {trigger && <DialogTrigger render={trigger}>{title}</DialogTrigger>}
83
- <DialogContent size="lg">
93
+ <DialogContent size="lg" ref={content}>
84
94
  <DialogHeader>
85
95
  <DialogTitle>{title}</DialogTitle>
86
96
  <DialogDescription>Search by action or key.</DialogDescription>
@@ -1,6 +1,6 @@
1
1
  import { useI18n, useOs } from '@gntik-ai/ui';
2
- import { Keyboard, Search } from '@gntik-ai/icons';
3
- import { EmptyState, Grid, Heading, Input, KbdCombo, Stack, Text } from '@gntik-ai/ui';
2
+ import { Keyboard } from '@gntik-ai/icons';
3
+ import { EmptyState, Grid, Heading, KbdCombo, SearchField, Stack, Text } from '@gntik-ai/ui';
4
4
  import { useId, useState } from 'react';
5
5
  import { filterShortcuts, type ShortcutGroup } from './data';
6
6
 
@@ -24,12 +24,11 @@ export function ShortcutSheet({ groups, headingLevel = 2, columns = 2, autoFocus
24
24
  return (
25
25
  <Stack gap={5}>
26
26
  <Stack gap={2}>
27
- <Input
28
- type="search"
27
+ <SearchField
29
28
  aria-label="Search shortcuts"
30
29
  aria-describedby={countId}
31
30
  placeholder="Search shortcuts…"
32
- leadingIcon={Search}
31
+ shortcut="/"
33
32
  value={query}
34
33
  onValueChange={setQuery}
35
34
  autoFocus={autoFocus}
@@ -3,13 +3,14 @@ import {
3
3
  FeatureGrid,
4
4
  Hero,
5
5
  PricingTable,
6
+ SiteFooter,
6
7
  type FaqItem,
7
8
  type Feature,
8
9
  type MarketingAction,
9
10
  type PricingCycle,
10
11
  type PricingTier,
11
12
  } from '@gntik-ai/blocks';
12
- import { Button, Link, Logo, StackedLayout, ThemeSwitcher, type NavItem } from '@gntik-ai/ui';
13
+ import { Button, Logo, StackedLayout, ThemeSwitcher, type NavItem } from '@gntik-ai/ui';
13
14
  import type { ReactNode } from 'react';
14
15
  import { landingCopyright, landingFooterLinks, landingLinks } from './data';
15
16
 
@@ -72,22 +73,7 @@ export default function LandingPage(props: Partial<LandingProps>) {
72
73
  </Button>
73
74
  </>
74
75
  }
75
- footer={
76
- <div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
77
- <span>{copyright}</span>
78
- <nav aria-label="Footer">
79
- <ul className="flex flex-wrap gap-x-4 gap-y-1">
80
- {footerLinks.map((l) => (
81
- <li key={l.href}>
82
- <Link href={l.href} tone="muted" underline="hover">
83
- {l.label}
84
- </Link>
85
- </li>
86
- ))}
87
- </ul>
88
- </nav>
89
- </div>
90
- }
76
+ footer={<SiteFooter layout="simple" links={footerLinks} copyright={copyright} />}
91
77
  >
92
78
  <Hero
93
79
  title={heroTitle}
@@ -7,5 +7,5 @@ export const meta: TemplateMeta = {
7
7
  status: 'experimental',
8
8
  description: 'Public landing: Hero, FeatureGrid, PricingTable, Faq',
9
9
  layout: 'StackedLayout',
10
- blocks: ['hero', 'feature-grid', 'pricing-table', 'faq'],
10
+ blocks: ['site-footer', 'hero', 'feature-grid', 'pricing-table', 'faq'],
11
11
  };