@gntik-ai/blocks 0.11.0 → 0.13.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 (189) hide show
  1. package/dist/index.d.ts +1501 -1232
  2. package/dist/index.js +1891 -840
  3. package/dist/index.js.map +1 -1
  4. package/package.json +6 -6
  5. package/src/ai/EvaluationScorecard/EvaluationScorecard.test.tsx +10 -0
  6. package/src/ai/EvaluationScorecard/EvaluationScorecard.tsx +2 -1
  7. package/src/ai/PromptEditor/PromptEditor.tsx +2 -2
  8. package/src/ai/PromptEditor/examples/controlled-variables.tsx +1 -1
  9. package/src/ai/TokenCostCard/TokenCostCard.test.tsx +10 -0
  10. package/src/ai/TokenCostCard/TokenCostCard.tsx +2 -1
  11. package/src/ai/TraceWaterfall/TraceWaterfall.tsx +2 -2
  12. package/src/auth/ForgotPasswordForm/ForgotPasswordForm.test.tsx +6 -0
  13. package/src/auth/ForgotPasswordForm/ForgotPasswordForm.tsx +4 -1
  14. package/src/auth/ForgotPasswordForm/block.meta.ts +1 -1
  15. package/src/auth/ForgotPasswordForm/examples/LargeFields.tsx +6 -0
  16. package/src/auth/MfaChallenge/MfaChallenge.test.tsx +9 -0
  17. package/src/auth/MfaChallenge/MfaChallenge.tsx +5 -2
  18. package/src/auth/MfaChallenge/block.meta.ts +1 -1
  19. package/src/auth/MfaChallenge/examples/LargeFields.tsx +6 -0
  20. package/src/auth/ResetPasswordForm/ResetPasswordForm.test.tsx +7 -0
  21. package/src/auth/ResetPasswordForm/ResetPasswordForm.tsx +5 -3
  22. package/src/auth/ResetPasswordForm/block.meta.ts +1 -1
  23. package/src/auth/ResetPasswordForm/examples/LargeFields.tsx +6 -0
  24. package/src/auth/SignInForm/SignInForm.test.tsx +7 -0
  25. package/src/auth/SignInForm/SignInForm.tsx +5 -1
  26. package/src/auth/SignInForm/block.meta.ts +1 -1
  27. package/src/auth/SignInForm/examples/LargeFields.tsx +6 -0
  28. package/src/auth/SignUpForm/SignUpForm.test.tsx +22 -0
  29. package/src/auth/SignUpForm/SignUpForm.tsx +7 -1
  30. package/src/auth/SignUpForm/block.meta.ts +1 -1
  31. package/src/auth/SignUpForm/examples/LargeFields.tsx +6 -0
  32. package/src/auth/__snapshots__/field-size.test.tsx.snap +11 -0
  33. package/src/auth/field-size.test.tsx +21 -0
  34. package/src/auth/large-examples.test.tsx +30 -0
  35. package/src/auth/shared.tsx +7 -2
  36. package/src/billing/PaymentMethodCard/PaymentMethodCard.tsx +1 -1
  37. package/src/billing/PlanCard/PlanCard.baseline.test.tsx +3 -2
  38. package/src/billing/PlanCard/__snapshots__/PlanCard.baseline.test.tsx.snap +2 -2
  39. package/src/billing/PlanDefinitionCard/examples/Compact.tsx +1 -4
  40. package/src/billing/PlanDefinitionCard/examples/Full.tsx +1 -4
  41. package/src/builders/CodePanel/CodePanel.test.tsx +11 -0
  42. package/src/builders/CodePanel/CodePanel.tsx +4 -3
  43. package/src/builders/FlowBuilder/FlowBuilder.tsx +4 -19
  44. package/src/builders/FlowBuilder/parts.tsx +4 -4
  45. package/src/builders/LogViewer/LogViewer.follow.test.tsx +29 -0
  46. package/src/builders/LogViewer/LogViewer.test.tsx +24 -0
  47. package/src/builders/LogViewer/LogViewer.tsx +67 -20
  48. package/src/builders/LogViewer/block.meta.ts +2 -1
  49. package/src/builders/LogViewer/examples/Spanish.tsx +2 -1
  50. package/src/data-display/ActivityFeed/ActivityFeed.tsx +1 -1
  51. package/src/data-display/ChartCard/ChartCard.tsx +2 -2
  52. package/src/data-display/ChartCard/examples/ContainerPanel.tsx +16 -0
  53. package/src/data-display/CommentThread/CommentThread.test.tsx +70 -1
  54. package/src/data-display/CommentThread/CommentThread.tsx +22 -6
  55. package/src/data-display/CommentThread/block.meta.ts +1 -1
  56. package/src/data-display/CommentThread/examples/RenderedBody.tsx +20 -0
  57. package/src/data-display/DescriptionListCard/DescriptionListCard.test.tsx +24 -1
  58. package/src/data-display/DescriptionListCard/DescriptionListCard.tsx +14 -20
  59. package/src/data-display/DescriptionListCard/block.meta.ts +2 -1
  60. package/src/data-display/DescriptionListCard/examples/Spanish.tsx +2 -1
  61. package/src/data-display/KpiRow/KpiRow.doc.ts +14 -0
  62. package/src/data-display/KpiRow/KpiRow.test.tsx +11 -0
  63. package/src/data-display/KpiRow/KpiRow.tsx +72 -55
  64. package/src/data-display/KpiRow/examples/ContainerPanel.tsx +47 -0
  65. package/src/data-display/ResourceCardGrid/ResourceCardGrid.doc.ts +19 -0
  66. package/src/data-display/ResourceCardGrid/ResourceCardGrid.test.tsx +13 -0
  67. package/src/data-display/ResourceCardGrid/ResourceCardGrid.tsx +49 -40
  68. package/src/data-display/ResourceCardGrid/examples/ContainerPanel.tsx +18 -0
  69. package/src/data-display/StatusTimeline/StatusTimeline.tsx +1 -1
  70. package/src/feedback/EmptyStates/EmptyStates.test.tsx +42 -0
  71. package/src/feedback/EmptyStates/EmptyStates.tsx +5 -3
  72. package/src/feedback/EmptyStates/block.meta.ts +1 -1
  73. package/src/feedback/EmptyStates/examples/HiddenAction.tsx +13 -0
  74. package/src/feedback/ErrorPanel/ErrorPanel.tsx +13 -15
  75. package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.lifecycle.test.tsx +123 -0
  76. package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.tsx +128 -139
  77. package/src/forms/CreateApiKeyDialog/block.meta.ts +12 -1
  78. package/src/forms/FileUploadPanel/FileUploadPanel.controlled.test.tsx +482 -0
  79. package/src/forms/FileUploadPanel/FileUploadPanel.drag.test.tsx +60 -0
  80. package/src/forms/FileUploadPanel/FileUploadPanel.lifecycle.test.tsx +165 -0
  81. package/src/forms/FileUploadPanel/FileUploadPanel.tsx +267 -69
  82. package/src/forms/FileUploadPanel/block.meta.ts +5 -1
  83. package/src/forms/FileUploadPanel/examples/AutoCancel.tsx +38 -0
  84. package/src/forms/FileUploadPanel/examples/Labels.tsx +1 -1
  85. package/src/forms/FileUploadPanel/examples/ManualForm.tsx +36 -0
  86. package/src/forms/FileUploadPanel/fixtures.ts +31 -16
  87. package/src/forms/FileUploadPanel/simulate-upload.test.ts +24 -0
  88. package/src/forms/FormSection/FormSection.test.tsx +11 -0
  89. package/src/forms/FormSection/FormSection.tsx +20 -22
  90. package/src/forms/FormSection/block.meta.ts +1 -1
  91. package/src/forms/FormSection/examples/ContainerPanel.tsx +16 -0
  92. package/src/forms/InviteMembersDialog/InviteMembersDialog.lifecycle.test.tsx +80 -0
  93. package/src/forms/InviteMembersDialog/InviteMembersDialog.tsx +90 -109
  94. package/src/forms/InviteMembersDialog/block.meta.ts +1 -1
  95. package/src/forms/ValidationSummary/ValidationSummary.tsx +1 -4
  96. package/src/hooks/index.ts +2 -0
  97. package/src/hooks/useTableData.integration.test.tsx +89 -0
  98. package/src/hooks/useTableData.test.tsx +613 -0
  99. package/src/hooks/useTableData.ts +377 -0
  100. package/src/index.ts +1 -0
  101. package/src/marketing/ComparisonTable/ComparisonTable.tsx +2 -2
  102. package/src/marketing/FeatureGrid/FeatureGrid.tsx +1 -1
  103. package/src/marketing/LogoCloud/LogoCloud.doc.ts +13 -0
  104. package/src/marketing/LogoCloud/LogoCloud.test.tsx +155 -0
  105. package/src/marketing/LogoCloud/LogoCloud.tsx +89 -0
  106. package/src/marketing/LogoCloud/block.meta.ts +10 -0
  107. package/src/marketing/LogoCloud/examples/CaptionStart.tsx +6 -0
  108. package/src/marketing/LogoCloud/examples/Custom.tsx +25 -0
  109. package/src/marketing/LogoCloud/examples/Empty.tsx +6 -0
  110. package/src/marketing/LogoCloud/examples/Grid.tsx +13 -0
  111. package/src/marketing/LogoCloud/examples/Row.tsx +6 -0
  112. package/src/marketing/LogoCloud/examples/UnderHero.tsx +13 -0
  113. package/src/marketing/LogoCloud/fixtures.ts +23 -0
  114. package/src/marketing/PricingTable/PricingTable.tsx +1 -1
  115. package/src/marketing/SiteFooter/SiteFooter.doc.ts +18 -0
  116. package/src/marketing/SiteFooter/SiteFooter.test.tsx +236 -0
  117. package/src/marketing/SiteFooter/SiteFooter.tsx +160 -0
  118. package/src/marketing/SiteFooter/block.meta.ts +10 -0
  119. package/src/marketing/SiteFooter/examples/Centered.tsx +15 -0
  120. package/src/marketing/SiteFooter/examples/Columns.tsx +15 -0
  121. package/src/marketing/SiteFooter/examples/Custom.tsx +35 -0
  122. package/src/marketing/SiteFooter/examples/Empty.tsx +6 -0
  123. package/src/marketing/SiteFooter/examples/Simple.tsx +14 -0
  124. package/src/marketing/SiteFooter/fixtures.ts +36 -0
  125. package/src/marketing/index.ts +6 -0
  126. package/src/page-chrome/PageHeader/EditableTitle.test.tsx +26 -0
  127. package/src/page-chrome/PageHeader/PageHeader.tsx +4 -4
  128. package/src/page-chrome/PageHeader/block.meta.ts +1 -1
  129. package/src/page-chrome/PageHeader/examples/ContainerPanel.tsx +16 -0
  130. package/src/page-chrome/PageHeader/examples/EditableTitle.tsx +23 -0
  131. package/src/page-chrome/PageToolbar/PageToolbar.test.tsx +3 -1
  132. package/src/page-chrome/PageToolbar/PageToolbar.tsx +2 -2
  133. package/src/page-chrome/StickyActionBar/StickyActionBar.tsx +1 -1
  134. package/src/scheduling/AgendaList/AgendaList.tsx +39 -15
  135. package/src/scheduling/AgendaList/AgendaListZone.test.tsx +38 -0
  136. package/src/scheduling/AgendaList/block.meta.ts +1 -1
  137. package/src/scheduling/AgendaList/examples/TimeZone.tsx +28 -0
  138. package/src/scheduling/MonthCalendar/MonthCalendar.tsx +51 -40
  139. package/src/scheduling/MonthCalendar/MonthCalendarZone.test.tsx +44 -0
  140. package/src/scheduling/MonthCalendar/block.meta.ts +1 -1
  141. package/src/scheduling/MonthCalendar/examples/TimeZone.tsx +28 -0
  142. package/src/scheduling/WeekCalendar/WeekCalendar.tsx +37 -28
  143. package/src/scheduling/WeekCalendar/WeekCalendarZone.test.tsx +41 -0
  144. package/src/scheduling/WeekCalendar/block.meta.ts +1 -1
  145. package/src/scheduling/WeekCalendar/examples/TimeZone.tsx +28 -0
  146. package/src/scheduling/shared/CalendarHeader.tsx +26 -1
  147. package/src/scheduling/shared/dates.ts +102 -58
  148. package/src/scheduling/shared/events.ts +2 -2
  149. package/src/shell/AppSidebar/AppSidebar.context.test.tsx +175 -0
  150. package/src/shell/AppSidebar/AppSidebar.doc.ts +29 -0
  151. package/src/shell/AppSidebar/AppSidebar.tsx +97 -25
  152. package/src/shell/AppSidebar/block.meta.ts +1 -1
  153. package/src/shell/GlobalSearch/GlobalSearch.test.tsx +1 -0
  154. package/src/shell/GlobalSearch/GlobalSearch.tsx +1 -1
  155. package/src/tables/DataTable/DataTable.cursor-example.test.tsx +67 -0
  156. package/src/tables/DataTable/DataTable.export.test.tsx +511 -0
  157. package/src/tables/DataTable/DataTable.inline-edit-focus.test.tsx +32 -0
  158. package/src/tables/DataTable/DataTable.layout.test.tsx +6 -5
  159. package/src/tables/DataTable/DataTable.link-actions.test.tsx +18 -0
  160. package/src/tables/DataTable/DataTable.server-pagination.test.tsx +328 -14
  161. package/src/tables/DataTable/DataTable.test.tsx +85 -1
  162. package/src/tables/DataTable/DataTable.tsx +108 -14
  163. package/src/tables/DataTable/block.meta.ts +11 -1
  164. package/src/tables/DataTable/column-sizing.ts +2 -2
  165. package/src/tables/DataTable/data-table-props.ts +29 -1
  166. package/src/tables/DataTable/data-table-row.tsx +2 -2
  167. package/src/tables/DataTable/data-table-utils.ts +4 -0
  168. package/src/tables/DataTable/editable-cell.tsx +20 -79
  169. package/src/tables/DataTable/examples/csv-export.tsx +74 -0
  170. package/src/tables/DataTable/examples/cursor-load-more.tsx +87 -0
  171. package/src/tables/DataTable/examples/server-pagination.tsx +47 -40
  172. package/src/tables/DataTable/export-menu.tsx +58 -0
  173. package/src/tables/DataTable/header-cell.tsx +1 -1
  174. package/src/tables/DataTable/labels.ts +7 -0
  175. package/src/tables/DataTable/resize-handle.tsx +2 -2
  176. package/src/tables/DataTable/use-table-export.ts +117 -0
  177. package/src/tables/FilterBar/FilterBar.test.tsx +12 -0
  178. package/src/tables/FilterBar/FilterBar.tsx +5 -7
  179. package/src/team/ProfileHeader/ProfileHeader.picker.test.tsx +34 -0
  180. package/src/team/ProfileHeader/ProfileHeader.test.tsx +2 -2
  181. package/src/team/ProfileHeader/ProfileHeader.tsx +17 -24
  182. package/src/team/ProfileHeader/block.meta.ts +1 -1
  183. package/src/test/OptInDefaults.test.tsx +10 -1
  184. package/src/test/clipboard-fallback.test.tsx +49 -0
  185. package/src/test/copy-examples.test.tsx +29 -0
  186. package/src/test/copy-feedback.test.tsx +166 -0
  187. package/src/test/fixtures/opt-in-defaults.json +5 -5
  188. package/src/test/without-forced-colors.test.ts +44 -0
  189. package/src/test/without-forced-colors.ts +14 -0
@@ -0,0 +1,6 @@
1
+ import { LogoCloud } from '../LogoCloud';
2
+ import { sampleLogos } from '../fixtures';
3
+
4
+ export default function CaptionStart() {
5
+ return <LogoCloud logos={sampleLogos} captionPlacement="start" />;
6
+ }
@@ -0,0 +1,25 @@
1
+ import { I18nProvider, useI18n } from '@gntik-ai/ui';
2
+ import { LogoCloud } from '../LogoCloud';
3
+ import { sampleLogos } from '../fixtures';
4
+
5
+ function LocalizedClouds() {
6
+ const { t } = useI18n();
7
+ return (
8
+ <>
9
+ <LogoCloud logos={sampleLogos} logoHeight={40} className="text-foreground" />
10
+ <LogoCloud
11
+ logos={sampleLogos.map((logo, index) => ({ ...logo, className: index === 0 ? 'text-foreground' : undefined }))}
12
+ caption={<span>{t('logoCloud.examples.community')}</span>}
13
+ />
14
+ </>
15
+ );
16
+ }
17
+
18
+ /** Spanish captions, taller marks and both root and individual token overrides. */
19
+ export default function Custom() {
20
+ return (
21
+ <I18nProvider locale="es">
22
+ <LocalizedClouds />
23
+ </I18nProvider>
24
+ );
25
+ }
@@ -0,0 +1,6 @@
1
+ import { LogoCloud } from '../LogoCloud';
2
+
3
+ /** Empty input produces no caption, list or dangling ARIA reference. */
4
+ export default function Empty() {
5
+ return <LogoCloud logos={[]} />;
6
+ }
@@ -0,0 +1,13 @@
1
+ import { LogoCloud } from '../LogoCloud';
2
+ import { sampleLogos } from '../fixtures';
3
+
4
+ /** Six, three and four columns from md; every grid uses two columns on phones. */
5
+ export default function Grid() {
6
+ return (
7
+ <div className="space-y-8">
8
+ <LogoCloud logos={sampleLogos} layout="grid" columns={6} />
9
+ <LogoCloud logos={sampleLogos} layout="grid" columns={3} />
10
+ <LogoCloud logos={sampleLogos} layout="grid" columns={4} />
11
+ </div>
12
+ );
13
+ }
@@ -0,0 +1,6 @@
1
+ import { LogoCloud } from '../LogoCloud';
2
+ import { sampleLogos } from '../fixtures';
3
+
4
+ export default function Row() {
5
+ return <LogoCloud logos={sampleLogos} />;
6
+ }
@@ -0,0 +1,13 @@
1
+ import { Hero } from '../../Hero/Hero';
2
+ import { LogoCloud } from '../LogoCloud';
3
+ import { sampleLogos } from '../fixtures';
4
+
5
+ /** A separate section after Hero; the Hero API and landing template stay unchanged. */
6
+ export default function UnderHero() {
7
+ return (
8
+ <div>
9
+ <Hero media={null} />
10
+ <LogoCloud logos={sampleLogos} />
11
+ </div>
12
+ );
13
+ }
@@ -0,0 +1,23 @@
1
+ import { createElement } from 'react';
2
+ import type { LogoCloudItem } from './LogoCloud';
3
+
4
+ /** Neutral placeholder marks, never customer assets. Supply your own currentColor SVGs. */
5
+ export const sampleLogos: LogoCloudItem[] = (
6
+ [
7
+ ['acme', 'Acme', 96, 'M14 0 28 28H0z'],
8
+ ['example', 'Example', 128, 'M0 0h28v28H0z'],
9
+ ['sample', 'Sample', 118, 'M14 0 28 14 14 28 0 14z'],
10
+ ['demo', 'Demo', 100, 'M0 0h12v28H0zM16 0h12v28H16z'],
11
+ ['placeholder', 'Placeholder', 166, 'M0 0h28v12H0zM0 16h28v12H0z'],
12
+ ['studio', 'Studio', 108, 'M0 0h12v16h16v12H0z'],
13
+ ] as const
14
+ ).map(([id, name, width, path]) => ({
15
+ id,
16
+ name,
17
+ mark: createElement(
18
+ 'svg',
19
+ { viewBox: `0 0 ${width} 28`, fill: 'currentColor', focusable: 'false' },
20
+ createElement('path', { d: path }),
21
+ createElement('text', { x: 36, y: 21, fontSize: 20, fontWeight: 600 }, name),
22
+ ),
23
+ }));
@@ -132,7 +132,7 @@ export function PricingTable({
132
132
  {hasHeader && (
133
133
  <div className="mx-auto max-w-2xl text-center">
134
134
  {eyebrow && (
135
- <p className="font-mono text-[12px] font-semibold tracking-wide text-primary-text uppercase">{eyebrow}</p>
135
+ <p className="font-mono text-[12px] font-semibold tracking-wide text-primary-text label-case">{eyebrow}</p>
136
136
  )}
137
137
  {hasTitle && (
138
138
  <Heading
@@ -0,0 +1,18 @@
1
+ import type { ComponentDoc } from '@gntik-ai/ui';
2
+ import { meta } from './block.meta';
3
+
4
+ export const doc: ComponentDoc = {
5
+ name: 'SiteFooter',
6
+ group: 'Navigation',
7
+ status: 'beta',
8
+ description: meta.description,
9
+ primitive: 'Composition of Link, Logo, IconButton and ThemeSwitcher',
10
+ pattern: 'navigation',
11
+ keyboard: [
12
+ ['Tab', 'Visits column links, legal links and social anchors in DOM order.'],
13
+ ['Enter', 'Follows the focused footer link.'],
14
+ ['Arrow keys', 'Moves between the optional theme options.'],
15
+ ['Space', 'Selects the focused theme option.'],
16
+ ],
17
+ tokens: ['foreground', 'muted-foreground', 'border', 'focus-ring'],
18
+ };
@@ -0,0 +1,236 @@
1
+ import { render, screen, within } from '@testing-library/react';
2
+ import { SiteFooter } from './SiteFooter';
3
+ import userEvent from '@testing-library/user-event';
4
+ import { Rss } from 'lucide-react';
5
+ import { I18nProvider, StackedLayout, ThemeProvider } from '@gntik-ai/ui';
6
+ import { sampleFooterColumns, sampleLegalLinks, sampleSocialLinks } from './fixtures';
7
+ import { expectNoAxeViolations } from '../../test/a11y';
8
+ import Columns from './examples/Columns';
9
+ import Centered from './examples/Centered';
10
+ import Simple from './examples/Simple';
11
+ import Custom from './examples/Custom';
12
+ import Empty from './examples/Empty';
13
+
14
+ describe('SiteFooter', () => {
15
+ it('supports keyboard theme selection from the footer', async () => {
16
+ const user = userEvent.setup();
17
+ render(
18
+ <ThemeProvider storageKey={null} defaultMode="dark">
19
+ <SiteFooter themeSwitcher />
20
+ </ThemeProvider>,
21
+ );
22
+ const group = screen.getByRole('group', { name: 'Theme' });
23
+ within(group).getByRole('button', { name: 'Dark' }).focus();
24
+ await user.keyboard('{ArrowRight}');
25
+ const highContrast = within(group).getByRole('button', { name: 'High contrast' });
26
+ expect(highContrast).toHaveFocus();
27
+ await user.keyboard(' ');
28
+ expect(highContrast).toHaveAttribute('aria-pressed', 'true');
29
+ await user.keyboard('{ArrowLeft}{Enter}');
30
+ expect(within(group).getByRole('button', { name: 'Dark' })).toHaveAttribute('aria-pressed', 'true');
31
+ });
32
+ describe.each([
33
+ ['columns', Columns],
34
+ ['centered', Centered],
35
+ ['simple RTL', Simple],
36
+ ['custom Spanish', Custom],
37
+ ['empty', Empty],
38
+ ] as const)('%s example', (_name, Example) => {
39
+ it.each(['dark', 'light', 'high_contrast'])('has no axe violations in %s', async (theme) => {
40
+ document.documentElement.className = theme;
41
+ const { container } = render(<Example />);
42
+ await expectNoAxeViolations(container);
43
+ });
44
+ });
45
+ it.each(['columns', 'centered', 'simple'] as const)('omits empty and absent groups in %s', (layout) => {
46
+ const { container, rerender } = render(
47
+ <SiteFooter layout={layout} columns={[]} links={[]} legalLinks={[]} social={[]} />,
48
+ );
49
+ expect(container.querySelector('nav, ul, h2, h3')).toBeNull();
50
+ expect(screen.getByText('© Example, Inc.')).toBeInTheDocument();
51
+ rerender(<SiteFooter layout={layout} />);
52
+ expect(container.querySelector('nav, ul, h2, h3')).toBeNull();
53
+ rerender(<SiteFooter layout={layout} columns={[{ title: 'No links', links: [] }]} />);
54
+ expect(container.querySelector('nav, ul, h2, h3')).toBeNull();
55
+ });
56
+
57
+ it('uses the kit external link with its icon, hint and muted hover underline', () => {
58
+ render(
59
+ <SiteFooter
60
+ layout="simple"
61
+ links={[{ label: 'Documentation', href: 'https://example.com/docs', external: true }]}
62
+ />,
63
+ );
64
+ const link = screen.getByRole('link', { name: /Documentation/ });
65
+ expect(link).toHaveAttribute('target', '_blank');
66
+ expect(link).toHaveAttribute('rel', 'noopener noreferrer');
67
+ expect(link).toHaveClass('text-muted-foreground', 'hover:underline');
68
+ expect(link.querySelector('svg')).toHaveAttribute('aria-hidden', 'true');
69
+ expect(link).toHaveTextContent('opens in a new tab');
70
+ });
71
+
72
+ it('uses Spanish social names and preserves explicit navigation and copyright overrides', () => {
73
+ const { rerender } = render(
74
+ <I18nProvider locale="es">
75
+ <SiteFooter columns={sampleFooterColumns} legalLinks={sampleLegalLinks} social={sampleSocialLinks} />
76
+ </I18nProvider>,
77
+ );
78
+ expect(screen.getByRole('navigation', { name: 'Pie de página' })).toBeInTheDocument();
79
+ expect(screen.getByRole('navigation', { name: 'Legal' })).toBeInTheDocument();
80
+ expect(screen.getByRole('list', { name: 'Redes sociales' })).toBeInTheDocument();
81
+ rerender(
82
+ <I18nProvider locale="es">
83
+ <SiteFooter columns={sampleFooterColumns} navLabel="Explore" copyright="© Custom" />
84
+ </I18nProvider>,
85
+ );
86
+ expect(screen.getByRole('navigation', { name: 'Explore' })).toBeInTheDocument();
87
+ expect(screen.getByText('© Custom')).toBeInTheDocument();
88
+ expect(screen.queryByText('© Example, Inc.')).toBeNull();
89
+ });
90
+ it('renders the public fixtures with Product, Company, Resources and RSS', () => {
91
+ render(<SiteFooter columns={sampleFooterColumns} legalLinks={sampleLegalLinks} social={sampleSocialLinks} />);
92
+ expect(
93
+ within(screen.getByRole('navigation', { name: 'Footer' }))
94
+ .getAllByRole('heading', { level: 2 })
95
+ .map((h) => h.textContent),
96
+ ).toEqual(['Product', 'Company', 'Resources']);
97
+ expect(screen.getByRole('navigation', { name: 'Legal' })).toBeInTheDocument();
98
+ expect(screen.getByRole('link', { name: 'RSS feed' })).toHaveAttribute('href', '/feed.xml');
99
+ });
100
+ it('places the newsletter slot below the custom brand and description', () => {
101
+ render(
102
+ <SiteFooter
103
+ brand={<span>Example brand</span>}
104
+ description="Built for teams"
105
+ newsletter={<a href="/subscribe">Subscribe</a>}
106
+ />,
107
+ );
108
+ const brand = screen.getByText('Example brand');
109
+ expect(brand.nextElementSibling).toHaveTextContent('Built for teams');
110
+ expect(brand.nextElementSibling?.nextElementSibling).toHaveTextContent('Subscribe');
111
+ });
112
+ it.each(['columns', 'centered', 'simple'] as const)(
113
+ 'offers four icon-only theme options at every width in %s only when requested',
114
+ (layout) => {
115
+ const { rerender } = render(<SiteFooter layout={layout} />);
116
+ expect(screen.queryByRole('group', { name: 'Theme' })).toBeNull();
117
+ rerender(<SiteFooter layout={layout} themeSwitcher />);
118
+ const group = screen.getByRole('group', { name: 'Theme' });
119
+ const options = within(group).getAllByRole('button');
120
+ expect(options.map((option) => option.getAttribute('aria-label'))).toEqual([
121
+ 'Light',
122
+ 'Dark',
123
+ 'High contrast',
124
+ 'System',
125
+ ]);
126
+ for (const option of options) expect(option.textContent).toBe('');
127
+ for (let node: Element | null = group; node; node = node.parentElement) {
128
+ expect(node.className).not.toMatch(/(?:^|\s)(?:hidden|md:)/);
129
+ }
130
+ },
131
+ );
132
+ it('centers the brand, wrapping link and social rows, and copyright', () => {
133
+ const { container } = render(
134
+ <SiteFooter
135
+ layout="centered"
136
+ links={[{ label: 'Status', href: '/status' }]}
137
+ social={[{ label: 'RSS feed', href: '/feed.xml', icon: Rss }]}
138
+ />,
139
+ );
140
+ expect(container.firstElementChild).toHaveClass('flex', 'flex-col', 'items-center', 'text-center');
141
+ for (const list of screen.getAllByRole('list')) expect(list).toHaveClass('flex-wrap', 'justify-center');
142
+ expect(screen.getByRole('img')).toBeInTheDocument();
143
+ expect(screen.getByText('© Example, Inc.')).toBeInTheDocument();
144
+ });
145
+ it('keeps the original simple row classes and inherited typography under RTL, with translated navigation', () => {
146
+ const { container } = render(
147
+ <I18nProvider locale="es" dir="rtl">
148
+ <SiteFooter
149
+ layout="simple"
150
+ links={[{ label: 'Status', href: '/status' }]}
151
+ legalLinks={[{ label: 'Privacy', href: '/privacy' }]}
152
+ copyright="© Example"
153
+ />
154
+ </I18nProvider>,
155
+ );
156
+ const row = screen.getByText('© Example').parentElement!;
157
+ expect(row.className).toBe('flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between');
158
+ expect(screen.getByRole('navigation', { name: 'Pie de página' }).querySelector('ul')?.className).toBe(
159
+ 'flex flex-wrap gap-x-4 gap-y-1',
160
+ );
161
+ expect(screen.getByRole('navigation', { name: 'Legal' })).toBeInTheDocument();
162
+ expect(container.querySelector('[dir="rtl"]')).toContainElement(row);
163
+ expect(row.className).not.toMatch(/text-|(?:ml|mr|pl|pr|left|right)-/);
164
+ expect(row.firstElementChild).toHaveTextContent('© Example');
165
+ expect(screen.queryByRole('img')).toBeNull();
166
+ });
167
+ it('provides an opt-in landmark and composes inside StackedLayout without nesting footers', () => {
168
+ const { container, rerender } = render(<SiteFooter />);
169
+ expect(container.firstElementChild?.tagName).toBe('DIV');
170
+ expect(screen.queryByRole('contentinfo')).not.toBeInTheDocument();
171
+ rerender(<SiteFooter landmark />);
172
+ expect(screen.getByRole('contentinfo')).toBe(container.firstElementChild);
173
+ expect(container.firstElementChild?.tagName).toBe('FOOTER');
174
+ rerender(
175
+ <StackedLayout footer={<SiteFooter layout="simple" />}>
176
+ <h1>Example</h1>
177
+ </StackedLayout>,
178
+ );
179
+ expect(screen.getAllByRole('contentinfo')).toHaveLength(1);
180
+ expect(screen.getByRole('contentinfo').querySelector('footer')).toBeNull();
181
+ });
182
+ it('names social anchors, hides their icons and follows column, legal, social tab order', async () => {
183
+ const user = userEvent.setup();
184
+ render(
185
+ <SiteFooter
186
+ columns={[{ title: 'Product', links: [{ label: 'Overview', href: '/product' }] }]}
187
+ legalLinks={[{ label: 'Privacy', href: '/privacy' }]}
188
+ social={[{ label: 'RSS feed', href: '/feed.xml', icon: Rss }]}
189
+ />,
190
+ );
191
+ const list = screen.getByRole('list', { name: 'Social links' });
192
+ const rss = within(list).getByRole('link', { name: 'RSS feed' });
193
+ expect(rss).toHaveAttribute('href', '/feed.xml');
194
+ expect(rss.querySelector('svg')).toHaveAttribute('aria-hidden', 'true');
195
+ for (const label of ['Overview', 'Privacy', 'RSS feed']) {
196
+ await user.tab();
197
+ expect(screen.getByRole('link', { name: label })).toHaveFocus();
198
+ }
199
+ });
200
+ it('renders titled columns in one navigation and legal links separately', () => {
201
+ const { rerender } = render(
202
+ <SiteFooter
203
+ columns={[
204
+ { title: 'Product', links: [{ label: 'Overview', href: '/product' }] },
205
+ { title: 'Company', links: [{ label: 'About', href: '/about' }] },
206
+ { title: 'Resources', links: [{ label: 'Docs', href: '/docs' }] },
207
+ ]}
208
+ legalLinks={[{ label: 'Privacy', href: '/privacy' }]}
209
+ />,
210
+ );
211
+ const nav = screen.getByRole('navigation', { name: 'Footer' });
212
+ expect(
213
+ within(nav)
214
+ .getAllByRole('heading', { level: 2 })
215
+ .map((h) => h.textContent),
216
+ ).toEqual(['Product', 'Company', 'Resources']);
217
+ for (const heading of within(nav).getAllByRole('heading')) {
218
+ expect(heading.nextElementSibling?.tagName).toBe('UL');
219
+ expect(within(heading.nextElementSibling as HTMLElement).getByRole('link')).toBeInTheDocument();
220
+ }
221
+ expect(
222
+ within(screen.getByRole('navigation', { name: 'Legal' })).getByRole('link', { name: 'Privacy' }),
223
+ ).toHaveAttribute('href', '/privacy');
224
+ expect(screen.getByText('© Example, Inc.')).toBeInTheDocument();
225
+ rerender(
226
+ <SiteFooter
227
+ headingLevel="h3"
228
+ navLabel="Explore"
229
+ columns={[{ title: 'Product', links: [{ label: 'Overview', href: '/product' }] }]}
230
+ />,
231
+ );
232
+ expect(
233
+ within(screen.getByRole('navigation', { name: 'Explore' })).getByRole('heading', { level: 3, name: 'Product' }),
234
+ ).toBeInTheDocument();
235
+ });
236
+ });
@@ -0,0 +1,160 @@
1
+ import type { ComponentType, ReactNode } from 'react';
2
+ import { IconButton, Link, Logo, ThemeSwitcher, cn, useI18n } from '@gntik-ai/ui';
3
+
4
+ export interface SiteFooterLink {
5
+ label: string;
6
+ href: string;
7
+ external?: boolean;
8
+ }
9
+
10
+ export interface SiteFooterColumn {
11
+ title: string;
12
+ links: SiteFooterLink[];
13
+ }
14
+
15
+ export interface SiteFooterSocialLink {
16
+ /** Use the network name (for example "RSS feed") as the accessible name. */
17
+ label: string;
18
+ href: string;
19
+ icon: ComponentType<{ size?: number; 'aria-hidden'?: boolean }>;
20
+ }
21
+
22
+ export interface SiteFooterProps {
23
+ layout?: 'columns' | 'centered' | 'simple';
24
+ brand?: ReactNode;
25
+ description?: ReactNode;
26
+ columns?: SiteFooterColumn[];
27
+ links?: SiteFooterLink[];
28
+ legalLinks?: SiteFooterLink[];
29
+ social?: SiteFooterSocialLink[];
30
+ copyright?: ReactNode;
31
+ headingLevel?: 'h2' | 'h3';
32
+ navLabel?: string;
33
+ landmark?: boolean;
34
+ /** Show the icon-only theme control at every viewport width. */
35
+ themeSwitcher?: boolean;
36
+ /** Content under the brand blurb in columns and centered layouts; supply your own form. */
37
+ newsletter?: ReactNode;
38
+ className?: string;
39
+ }
40
+
41
+ function LinkList({ links, className }: { links: SiteFooterLink[]; className?: string }) {
42
+ return (
43
+ <ul className={cn('flex flex-wrap gap-x-4 gap-y-1', className)}>
44
+ {links.map((link) => (
45
+ <li key={link.href}>
46
+ <Link href={link.href} external={link.external} tone="muted" underline="hover">
47
+ {link.label}
48
+ </Link>
49
+ </li>
50
+ ))}
51
+ </ul>
52
+ );
53
+ }
54
+
55
+ /** Public-page footer. The default div fits inside a layout's existing footer landmark. */
56
+ export function SiteFooter({
57
+ layout = 'columns',
58
+ brand = <Logo size={24} wordmark />,
59
+ description,
60
+ columns = [],
61
+ links = [],
62
+ legalLinks = [],
63
+ social = [],
64
+ copyright,
65
+ headingLevel: Heading = 'h2',
66
+ navLabel,
67
+ landmark = false,
68
+ themeSwitcher = false,
69
+ newsletter,
70
+ className,
71
+ }: SiteFooterProps) {
72
+ const { t } = useI18n();
73
+ const populatedColumns = columns.filter((column) => column.links.length > 0);
74
+ const Root = landmark ? 'footer' : 'div';
75
+ const copyrightContent = copyright === undefined ? t('footer.copyright') : copyright;
76
+ const centered = layout === 'centered';
77
+ const rowNav = links.length > 0 && (
78
+ <nav aria-label={navLabel ?? t('footer.label')}>
79
+ <LinkList links={links} className={centered ? 'justify-center' : undefined} />
80
+ </nav>
81
+ );
82
+ const legalNav = legalLinks.length > 0 && (
83
+ <nav aria-label={t('footer.legal')}>
84
+ <LinkList links={legalLinks} className={centered ? 'justify-center' : undefined} />
85
+ </nav>
86
+ );
87
+ const socialList = social.length > 0 && (
88
+ <ul aria-label={t('footer.social')} className={cn('flex flex-wrap gap-2', centered && 'justify-center')}>
89
+ {social.map((link) => (
90
+ <li key={link.href}>
91
+ <IconButton
92
+ icon={link.icon}
93
+ label={link.label}
94
+ render={<a href={link.href} />}
95
+ role="link"
96
+ nativeButton={false}
97
+ size="sm"
98
+ />
99
+ </li>
100
+ ))}
101
+ </ul>
102
+ );
103
+ if (layout === 'simple') {
104
+ return (
105
+ <Root className={cn('flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between', className)}>
106
+ <span>{copyrightContent}</span>
107
+ {rowNav}
108
+ {legalNav}
109
+ {socialList}
110
+ {themeSwitcher && <ThemeSwitcher size="sm" showLabels={false} />}
111
+ </Root>
112
+ );
113
+ }
114
+ if (centered) {
115
+ return (
116
+ <Root
117
+ className={cn(
118
+ 'flex min-w-0 flex-col items-center gap-6 px-4 py-12 text-center text-sm wrap-anywhere text-muted-foreground sm:px-6 [&>*]:max-w-full',
119
+ className,
120
+ )}
121
+ >
122
+ {brand}
123
+ {description && <div>{description}</div>}
124
+ {newsletter && <div>{newsletter}</div>}
125
+ {rowNav}
126
+ {legalNav}
127
+ {socialList}
128
+ <span>{copyrightContent}</span>
129
+ {themeSwitcher && <ThemeSwitcher size="sm" showLabels={false} />}
130
+ </Root>
131
+ );
132
+ }
133
+ return (
134
+ <Root className={cn('min-w-0 px-4 py-12 text-sm wrap-anywhere text-muted-foreground sm:px-6', className)}>
135
+ <div className="grid min-w-0 gap-8 lg:grid-cols-[minmax(0,1fr)_minmax(0,2fr)]">
136
+ <div className="min-w-0 space-y-4">
137
+ {brand}
138
+ {description && <div>{description}</div>}
139
+ {newsletter && <div>{newsletter}</div>}
140
+ </div>
141
+ {populatedColumns.length > 0 && (
142
+ <nav aria-label={navLabel ?? t('footer.label')} className="grid min-w-0 grid-cols-2 gap-8 lg:grid-cols-4">
143
+ {populatedColumns.map((column) => (
144
+ <div key={column.title} className="min-w-0">
145
+ <Heading className="mb-3 text-sm font-semibold text-foreground">{column.title}</Heading>
146
+ <LinkList links={column.links} className="flex-col gap-y-2" />
147
+ </div>
148
+ ))}
149
+ </nav>
150
+ )}
151
+ </div>
152
+ <div className="mt-8 flex flex-wrap items-center justify-between gap-3">
153
+ <span>{copyrightContent}</span>
154
+ {legalNav}
155
+ {socialList}
156
+ {themeSwitcher && <ThemeSwitcher size="sm" showLabels={false} />}
157
+ </div>
158
+ </Root>
159
+ );
160
+ }
@@ -0,0 +1,10 @@
1
+ import type { BlockMeta } from '../../meta';
2
+
3
+ export const meta: BlockMeta = {
4
+ name: 'Site footer',
5
+ family: 'marketing',
6
+ status: 'beta',
7
+ description:
8
+ 'Public footer with columns, centered and simple layouts. Optional brand, description, newsletter slot, legal and social links, and an icon-only theme switcher at every width. Uses a div by default inside a layout footer; opt into landmark for standalone pages. Empty groups stay absent; navigation names use the English/Spanish catalog or navLabel. Social labels must name the network. Simple mode preserves inherited typography and the public templates’ spacing.',
9
+ uses: ['Link', 'Logo', 'IconButton', 'ThemeSwitcher'],
10
+ };
@@ -0,0 +1,15 @@
1
+ import { SiteFooter } from '../SiteFooter';
2
+ import { sampleFooterColumns, sampleLegalLinks, sampleSocialLinks } from '../fixtures';
3
+
4
+ export default function Centered() {
5
+ return (
6
+ <SiteFooter
7
+ layout="centered"
8
+ landmark
9
+ links={sampleFooterColumns.flatMap((column) => column.links)}
10
+ legalLinks={sampleLegalLinks}
11
+ social={sampleSocialLinks}
12
+ themeSwitcher
13
+ />
14
+ );
15
+ }
@@ -0,0 +1,15 @@
1
+ import { SiteFooter } from '../SiteFooter';
2
+ import { sampleFooterColumns, sampleLegalLinks, sampleSocialLinks } from '../fixtures';
3
+
4
+ /** A standalone public footer. Inside StackedLayout, omit landmark. */
5
+ export default function Columns() {
6
+ return (
7
+ <SiteFooter
8
+ landmark
9
+ columns={sampleFooterColumns}
10
+ legalLinks={sampleLegalLinks}
11
+ social={sampleSocialLinks}
12
+ themeSwitcher
13
+ />
14
+ );
15
+ }
@@ -0,0 +1,35 @@
1
+ import { I18nProvider, Link, Logo } from '@gntik-ai/ui';
2
+ import { SiteFooter } from '../SiteFooter';
3
+ import { sampleFooterColumns, sampleLegalLinks, sampleSocialLinks } from '../fixtures';
4
+
5
+ /** Caller copy and newsletter content remain under the consumer's control. */
6
+ export default function Custom() {
7
+ return (
8
+ <I18nProvider locale="es">
9
+ <SiteFooter
10
+ landmark
11
+ headingLevel="h3"
12
+ navLabel="Explore"
13
+ brand={<Logo size={32} wordmark />}
14
+ description="A workspace for your team."
15
+ newsletter={<Link href="/subscribe">Subscribe to updates</Link>}
16
+ columns={sampleFooterColumns.map((column) =>
17
+ column.title === 'Resources'
18
+ ? {
19
+ ...column,
20
+ links: [
21
+ ...column.links,
22
+ { label: 'External documentation', href: 'https://example.com/docs', external: true },
23
+ ],
24
+ }
25
+ : column,
26
+ )}
27
+ legalLinks={sampleLegalLinks}
28
+ social={sampleSocialLinks}
29
+ copyright="© Example studio"
30
+ themeSwitcher
31
+ className="rounded-lg border border-border"
32
+ />
33
+ </I18nProvider>
34
+ );
35
+ }
@@ -0,0 +1,6 @@
1
+ import { SiteFooter } from '../SiteFooter';
2
+
3
+ /** Empty or omitted groups produce no empty navigation, list or heading. */
4
+ export default function Empty() {
5
+ return <SiteFooter landmark columns={[]} links={[]} legalLinks={[]} social={[]} brand={null} />;
6
+ }
@@ -0,0 +1,14 @@
1
+ import { I18nProvider, StackedLayout } from '@gntik-ai/ui';
2
+ import { SiteFooter } from '../SiteFooter';
3
+ import { sampleLegalLinks } from '../fixtures';
4
+
5
+ /** Logical alignment mirrors the inherited one-row layout in RTL. */
6
+ export default function Simple() {
7
+ return (
8
+ <I18nProvider locale="en" dir="rtl">
9
+ <StackedLayout footer={<SiteFooter layout="simple" links={sampleLegalLinks} themeSwitcher />}>
10
+ <div />
11
+ </StackedLayout>
12
+ </I18nProvider>
13
+ );
14
+ }