@gntik-ai/blocks 0.9.0 → 0.10.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 (66) hide show
  1. package/dist/index.d.ts +129 -19
  2. package/dist/index.js +846 -354
  3. package/dist/index.js.map +1 -1
  4. package/package.json +3 -3
  5. package/src/billing/CostBreakdown/CostBreakdown.test.tsx +10 -0
  6. package/src/billing/CostBreakdown/CostBreakdown.tsx +50 -43
  7. package/src/billing/SpendVsBudget/SpendVsBudget.test.tsx +10 -0
  8. package/src/billing/SpendVsBudget/SpendVsBudget.tsx +35 -31
  9. package/src/builders/FlowBuilder/FlowBuilder.test.tsx +237 -2
  10. package/src/builders/FlowBuilder/FlowBuilder.tsx +101 -29
  11. package/src/builders/FlowBuilder/block.meta.ts +1 -1
  12. package/src/builders/FlowBuilder/connections.ts +30 -12
  13. package/src/builders/FlowBuilder/examples/ControlledGraph.tsx +8 -0
  14. package/src/builders/FlowBuilder/graph-state.ts +78 -0
  15. package/src/builders/LogViewer/LogViewer.labels.test.tsx +90 -0
  16. package/src/builders/LogViewer/LogViewer.tsx +43 -10
  17. package/src/builders/LogViewer/block.meta.ts +14 -1
  18. package/src/builders/LogViewer/examples/Spanish.tsx +30 -0
  19. package/src/data-display/ChartCard/ChartCard.locale.test.tsx +15 -0
  20. package/src/data-display/ChartCard/ChartCard.test.tsx +9 -0
  21. package/src/data-display/ChartCard/ChartCard.tsx +81 -67
  22. package/src/data-display/ChartCard/block.meta.ts +1 -1
  23. package/src/data-display/DescriptionListCard/DescriptionListCard.labels.test.tsx +73 -0
  24. package/src/data-display/DescriptionListCard/DescriptionListCard.tsx +37 -7
  25. package/src/data-display/DescriptionListCard/block.meta.ts +11 -1
  26. package/src/data-display/DescriptionListCard/examples/Spanish.tsx +22 -0
  27. package/src/feedback/EmptyStates/EmptyStates.labels.test.tsx +185 -0
  28. package/src/feedback/EmptyStates/EmptyStates.tsx +73 -20
  29. package/src/feedback/EmptyStates/block.meta.ts +73 -1
  30. package/src/feedback/EmptyStates/examples/Spanish.tsx +41 -0
  31. package/src/feedback/ErrorPanel/ErrorPanel.labels.test.tsx +99 -0
  32. package/src/feedback/ErrorPanel/ErrorPanel.tsx +38 -9
  33. package/src/feedback/ErrorPanel/block.meta.ts +19 -1
  34. package/src/feedback/ErrorPanel/examples/Spanish.tsx +30 -0
  35. package/src/feedback/InlineCallout/InlineCallout.labels.test.tsx +62 -0
  36. package/src/feedback/InlineCallout/InlineCallout.tsx +22 -9
  37. package/src/feedback/InlineCallout/block.meta.ts +9 -1
  38. package/src/feedback/InlineCallout/examples/Spanish.tsx +19 -0
  39. package/src/feedback/Skeletons/Skeletons.labels.test.tsx +24 -0
  40. package/src/forms/FileUploadPanel/FileUploadPanel.test.tsx +22 -1
  41. package/src/forms/FileUploadPanel/FileUploadPanel.tsx +4 -4
  42. package/src/forms/FileUploadPanel/fixtures.ts +0 -12
  43. package/src/forms/FileUploadPanel/format-bytes.test.ts +8 -0
  44. package/src/page-chrome/PageHeader/PageHeader.labels.test.tsx +56 -0
  45. package/src/page-chrome/PageHeader/PageHeader.tsx +19 -4
  46. package/src/page-chrome/PageHeader/block.meta.ts +8 -1
  47. package/src/page-chrome/PageHeader/examples/Labels.tsx +16 -0
  48. package/src/scheduling/AgendaList/AgendaList.test.tsx +25 -0
  49. package/src/scheduling/AgendaList/AgendaList.tsx +7 -2
  50. package/src/scheduling/AgendaList/AgendaListLocale.test.tsx +11 -0
  51. package/src/scheduling/AgendaList/block.meta.ts +1 -1
  52. package/src/scheduling/AgendaList/examples/Locale.tsx +29 -0
  53. package/src/scheduling/MonthCalendar/MonthCalendar.test.tsx +111 -1
  54. package/src/scheduling/MonthCalendar/MonthCalendar.tsx +19 -9
  55. package/src/scheduling/MonthCalendar/block.meta.ts +1 -1
  56. package/src/scheduling/MonthCalendar/examples/Locale.tsx +19 -0
  57. package/src/scheduling/WeekCalendar/WeekCalendar.test.tsx +73 -2
  58. package/src/scheduling/WeekCalendar/WeekCalendar.tsx +26 -12
  59. package/src/scheduling/WeekCalendar/block.meta.ts +1 -1
  60. package/src/scheduling/WeekCalendar/examples/Locale.tsx +19 -0
  61. package/src/scheduling/shared/dates.test.ts +75 -0
  62. package/src/scheduling/shared/dates.ts +46 -22
  63. package/src/scheduling/shared/useSchedulingClock.ts +13 -0
  64. package/src/shell/GlobalSearch/GlobalSearch.test.tsx +12 -0
  65. package/src/shell/GlobalSearch/fixtures.ts +2 -2
  66. package/src/tables/PaginationFooter/PaginationFooter.i18n.test.tsx +26 -0
@@ -1,9 +1,18 @@
1
- import { Alert, Button, Link, type AlertTone } from '@gntik-ai/ui';
1
+ import { Alert, Button, Link, useI18n, type AlertTone } from '@gntik-ai/ui';
2
2
  import type { LucideIcon } from '@gntik-ai/icons';
3
3
  import { useState, type ReactNode } from 'react';
4
4
  import type { FeedbackAction } from '../types';
5
5
 
6
+ export interface InlineCalloutLabels {
7
+ title: string;
8
+ description: string;
9
+ upgrade: string;
10
+ viewUsage: string;
11
+ }
12
+
6
13
  export interface InlineCalloutProps {
14
+ /** Per-key copy overrides; explicit props take precedence, then labels, then the active catalog. */
15
+ labels?: Partial<InlineCalloutLabels>;
7
16
  tone?: AlertTone;
8
17
  title?: ReactNode;
9
18
  description?: ReactNode;
@@ -18,23 +27,27 @@ export interface InlineCalloutProps {
18
27
  className?: string;
19
28
  }
20
29
 
21
- const inlineCalloutDefaultActions: FeedbackAction[] = [
22
- { label: 'Upgrade plan', variant: 'secondary' },
23
- { label: 'View usage', href: '#usage' },
24
- ];
25
-
26
30
  /** In-content callout built on Alert: tone, title, body and a row of actions. */
27
31
  export function InlineCallout({
28
32
  tone = 'warning',
29
- title = 'You have used 92% of your build minutes',
30
- description = 'Builds will queue once the monthly limit is reached. Upgrade the plan or reduce concurrent builds.',
31
- actions = inlineCalloutDefaultActions,
33
+ title: titleProp,
34
+ labels,
35
+ description: descriptionProp,
36
+ actions: actionsProp,
32
37
  icon,
33
38
  dismissible = false,
34
39
  open,
35
40
  onDismiss,
36
41
  className,
37
42
  }: InlineCalloutProps) {
43
+ const { t } = useI18n();
44
+ const title = titleProp === undefined ? (labels?.title ?? t('callout.title')) : titleProp;
45
+ const description =
46
+ descriptionProp === undefined ? (labels?.description ?? t('callout.description')) : descriptionProp;
47
+ const actions: FeedbackAction[] = actionsProp ?? [
48
+ { label: labels?.upgrade ?? t('callout.upgrade'), variant: 'secondary' },
49
+ { label: labels?.viewUsage ?? t('callout.viewUsage'), href: '#usage' },
50
+ ];
38
51
  const [dismissed, setDismissed] = useState(false);
39
52
  if (!(open ?? !dismissed)) return null;
40
53
  return (
@@ -1,9 +1,17 @@
1
1
  import type { BlockMeta } from '../../meta';
2
+ import type { InlineCalloutLabels } from './InlineCallout';
2
3
 
3
4
  export const meta: BlockMeta = {
4
5
  name: 'Inline callout',
5
6
  family: 'feedback',
6
7
  status: 'beta',
7
- description: 'Alert-based in-content callout with a tone, title, body, action buttons or links and optional dismiss.',
8
+ description:
9
+ 'Alert-based in-content callout with a tone, title, body, action buttons or links and optional dismiss. Optional labels?: Partial<InlineCalloutLabels> overrides each built-in label. Explicit content props win over labels, then I18nProvider (en/es); no provider keeps English. Imported fixtures and machine data stay unchanged. See the Catalog labels live preview.',
10
+ labels: [
11
+ { key: 'title', type: 'string', state: 'Callout title; explicit title prop wins, including null' },
12
+ { key: 'description', type: 'string', state: 'Callout body; explicit description prop wins, including null' },
13
+ { key: 'upgrade', type: 'string', state: 'Default primary action; explicit actions win' },
14
+ { key: 'viewUsage', type: 'string', state: 'Default usage link; explicit actions win' },
15
+ ] satisfies Array<{ key: keyof InlineCalloutLabels; type: string; state: string }>,
8
16
  uses: ['Alert', 'Button', 'Link'],
9
17
  };
@@ -0,0 +1,19 @@
1
+ import { I18nProvider, Stack } from '@gntik-ai/ui';
2
+ import { InlineCallout } from '../InlineCallout';
3
+ export default function Spanish() {
4
+ return (
5
+ <I18nProvider locale="es">
6
+ <Stack gap={6}>
7
+ <InlineCallout />
8
+ <InlineCallout
9
+ labels={{
10
+ title: 'Build usage',
11
+ description: 'Review your current allowance.',
12
+ upgrade: 'Change plan',
13
+ viewUsage: 'Open usage',
14
+ }}
15
+ />
16
+ </Stack>
17
+ </I18nProvider>
18
+ );
19
+ }
@@ -0,0 +1,24 @@
1
+ import { render, screen } from '@testing-library/react';
2
+ import { I18nProvider, es } from '@gntik-ai/ui';
3
+ import { ListSkeleton, PageSkeleton, TableSkeleton } from './Skeletons';
4
+
5
+ it.each([
6
+ [TableSkeleton, 'loading.table', 'Loading table'],
7
+ [ListSkeleton, 'loading.list', 'Loading list'],
8
+ [PageSkeleton, 'loading.page', 'Loading page'],
9
+ ] as const)('audits catalog and explicit loading labels for %s', (Skeleton, key, english) => {
10
+ const { rerender } = render(<Skeleton />);
11
+ expect(screen.getByRole('status').textContent).toBe(english);
12
+ rerender(
13
+ <I18nProvider locale="es">
14
+ <Skeleton />
15
+ </I18nProvider>,
16
+ );
17
+ expect(screen.getByRole('status').textContent).toBe(es[key]);
18
+ rerender(
19
+ <I18nProvider locale="es">
20
+ <Skeleton label="Caller loading text" />
21
+ </I18nProvider>,
22
+ );
23
+ expect(screen.getByRole('status').textContent).toBe('Caller loading text');
24
+ });
@@ -1,3 +1,4 @@
1
+ import { I18nProvider } from '@gntik-ai/ui';
1
2
  import { act, fireEvent, render, screen } from '@testing-library/react';
2
3
  import userEvent from '@testing-library/user-event';
3
4
  import { expectNoAxeViolations } from '../../test/a11y';
@@ -5,6 +6,26 @@ import { FileUploadPanel } from './FileUploadPanel';
5
6
  import { acceptsFile } from './fixtures';
6
7
 
7
8
  describe('FileUploadPanel', () => {
9
+ it('shows decimal default limits and provider-localized file sizes', () => {
10
+ render(
11
+ <I18nProvider locale="es">
12
+ <FileUploadPanel defaultFiles={[{ id: 'es', name: 'report.pdf', size: 1536, progress: 100, status: 'done' }]} />
13
+ </I18nProvider>,
14
+ );
15
+ expect(screen.getByText(/25 MB/)).toBeInTheDocument();
16
+ expect(screen.getByText(/1,5 kB/)).toBeInTheDocument();
17
+ });
18
+
19
+ it('rejects files above the decimal default limit', () => {
20
+ const onUpload = vi.fn(() => Promise.resolve());
21
+ const { container } = render(<FileUploadPanel defaultFiles={[]} onUpload={onUpload} />);
22
+ const input = container.querySelector('input[type="file"]') as HTMLInputElement;
23
+ const big = new File([new Uint8Array(25_000_001)], 'big.pdf', { type: 'application/pdf' });
24
+ fireEvent.change(input, { target: { files: [big] } });
25
+ expect(screen.getByText(/Exceeds the 25 MB limit/)).toBeInTheDocument();
26
+ expect(onUpload).not.toHaveBeenCalled();
27
+ });
28
+
8
29
  it('renders the default list', async () => {
9
30
  const { container } = render(<FileUploadPanel />);
10
31
  expect(screen.getByRole('group', { name: 'Upload files' })).toBeInTheDocument();
@@ -27,7 +48,7 @@ describe('FileUploadPanel', () => {
27
48
  fireEvent.change(input, { target: { files: [ok, big, bad] } });
28
49
  expect(onUpload).toHaveBeenCalledOnce();
29
50
  expect(screen.getByRole('progressbar', { name: 'Uploading report.csv' })).toBeInTheDocument();
30
- expect(screen.getByText(/Exceeds the 1000 B limit/)).toBeInTheDocument();
51
+ expect(screen.getByText(/Exceeds the 1 kB limit/)).toBeInTheDocument();
31
52
  expect(screen.getByText(/File type not accepted/)).toBeInTheDocument();
32
53
  await act(async () => finish());
33
54
  expect(screen.getByText(/^3 B · uploaded$/)).toBeInTheDocument();
@@ -1,7 +1,7 @@
1
1
  import { Button, IconButton, Progress, cn, useI18n } from '@gntik-ai/ui';
2
2
  import { CircleAlert, FileText, RotateCcw, Upload, X } from '@gntik-ai/icons';
3
3
  import { useId, useRef, useState, type DragEvent } from 'react';
4
- import { acceptsFile, formatBytes, simulateUpload, uploadItems, type UploadItem } from './fixtures';
4
+ import { acceptsFile, simulateUpload, uploadItems, type UploadItem } from './fixtures';
5
5
 
6
6
  export type { UploadItem, UploadStatus } from './fixtures';
7
7
 
@@ -33,7 +33,7 @@ const nextId = () => `upload-${++uid}`;
33
33
  */
34
34
  export function FileUploadPanel({
35
35
  accept = '.csv,.json,.jsonl,.yaml,.pdf',
36
- maxSize = 25 * 1024 * 1024,
36
+ maxSize = 25_000_000,
37
37
  multiple = true,
38
38
  defaultFiles = uploadItems,
39
39
  onUpload = simulateUpload,
@@ -43,7 +43,7 @@ export function FileUploadPanel({
43
43
  disabled = false,
44
44
  className,
45
45
  }: FileUploadPanelProps) {
46
- const { t } = useI18n();
46
+ const { t, formatBytes } = useI18n();
47
47
  const label = labelProp ?? t('upload.label');
48
48
  const id = useId();
49
49
  const inputRef = useRef<HTMLInputElement | null>(null);
@@ -196,7 +196,7 @@ export function FileUploadPanel({
196
196
  }
197
197
 
198
198
  function FileRow({ item, onRemove, onRetry }: { item: UploadItem; onRemove: () => void; onRetry?: () => void }) {
199
- const { t } = useI18n();
199
+ const { t, formatBytes } = useI18n();
200
200
  const err = item.status === 'error';
201
201
  const done = item.status === 'done';
202
202
  return (
@@ -39,18 +39,6 @@ export function simulateUpload(_file: File, onProgress: (pct: number) => void):
39
39
  });
40
40
  }
41
41
 
42
- export function formatBytes(bytes: number) {
43
- if (bytes < 1024) return `${bytes} B`;
44
- const units = ['KB', 'MB', 'GB', 'TB'];
45
- let v = bytes / 1024;
46
- let i = 0;
47
- while (v >= 1024 && i < units.length - 1) {
48
- v /= 1024;
49
- i++;
50
- }
51
- return `${v >= 10 ? Math.round(v) : v.toFixed(1)} ${units[i]}`;
52
- }
53
-
54
42
  /** Matches a file against an `accept` list (".csv", "image/*", "application/pdf"). */
55
43
  export function acceptsFile(file: { name: string; type: string }, accept: string | undefined) {
56
44
  if (!accept) return true;
@@ -0,0 +1,8 @@
1
+ import { chartFmt } from '@gntik-ai/charts';
2
+ import { formatBytes } from '@gntik-ai/ui';
3
+
4
+ describe('byte formatter parity', () => {
5
+ it.each([0, 512, 999, 1536, 999_999, 1_840_000, 2_540_000_000])('agrees with chart sizes for %s bytes', (size) => {
6
+ expect(formatBytes(size, 'en')).toBe(chartFmt.bytes(size));
7
+ });
8
+ });
@@ -0,0 +1,56 @@
1
+ import { render, screen } from '@testing-library/react';
2
+ import { I18nProvider, es } from '@gntik-ai/ui';
3
+ import { PageHeader, type PageHeaderLabels } from './PageHeader';
4
+ import { pageHeaderMeta, pageHeaderTabs, pageHeaderActions } from './fixtures';
5
+
6
+ it('translates built-in header labels and leaves fixtures untouched', () => {
7
+ render(
8
+ <I18nProvider locale="es">
9
+ <PageHeader />
10
+ </I18nProvider>,
11
+ );
12
+ expect(screen.getByRole('heading', { name: es['pageHeader.title'] })).toHaveTextContent('Despliegues');
13
+ expect(screen.getByText(es['pageHeader.description'])).toBeVisible();
14
+ expect(screen.getByRole('button', { name: es['pageHeader.moreActions'] })).toBeVisible();
15
+ expect(screen.getByRole('tablist', { name: es['pageHeader.sections'] })).toBeVisible();
16
+ for (const item of pageHeaderMeta) expect(screen.getByText(String(item.value))).toBeVisible();
17
+ for (const tab of pageHeaderTabs) expect(screen.getByRole('tab', { name: new RegExp(tab.label) })).toBeVisible();
18
+ for (const action of pageHeaderActions)
19
+ expect(screen.getAllByRole('button', { name: action.label })[0]).toBeVisible();
20
+ });
21
+
22
+ it('preserves English and merges each override below explicit title and description props', () => {
23
+ const { rerender } = render(<PageHeader />);
24
+ expect(screen.getByRole('heading', { name: 'Deployments' })).toBeVisible();
25
+ expect(screen.getByText('Every build and release of this project across its environments.')).toBeVisible();
26
+ expect(screen.getByRole('button', { name: 'More actions' })).toBeVisible();
27
+ expect(screen.getByRole('tablist', { name: 'Page sections' })).toBeVisible();
28
+ const labels: PageHeaderLabels = {
29
+ title: 'Custom title',
30
+ description: 'Custom description',
31
+ moreActions: 'Custom actions',
32
+ sections: 'Custom sections',
33
+ };
34
+ const view = (overrides: Partial<PageHeaderLabels>, explicit = false) => (
35
+ <I18nProvider locale="es">
36
+ <PageHeader
37
+ labels={overrides}
38
+ title={explicit ? 'Explicit title' : undefined}
39
+ description={explicit ? 'Explicit description' : undefined}
40
+ />
41
+ </I18nProvider>
42
+ );
43
+ rerender(view(labels));
44
+ expect(screen.getByRole('heading', { name: labels.title })).toBeVisible();
45
+ expect(screen.getByText(labels.description)).toBeVisible();
46
+ expect(screen.getByRole('button', { name: labels.moreActions })).toBeVisible();
47
+ expect(screen.getByRole('tablist', { name: labels.sections })).toBeVisible();
48
+ rerender(view(labels, true));
49
+ expect(screen.getByRole('heading', { name: 'Explicit title' })).toBeVisible();
50
+ expect(screen.getByText('Explicit description')).toBeVisible();
51
+ rerender(view({ moreActions: '' }));
52
+ expect(screen.getByRole('heading', { name: es['pageHeader.title'] })).toBeVisible();
53
+ expect(screen.getByText(es['pageHeader.description'])).toBeVisible();
54
+ expect(screen.getByRole('tablist', { name: es['pageHeader.sections'] })).toBeVisible();
55
+ expect(screen.getByRole('button', { name: '' })).toBeVisible();
56
+ });
@@ -31,7 +31,16 @@ export interface PageHeaderTab {
31
31
  count?: number;
32
32
  }
33
33
 
34
+ export interface PageHeaderLabels {
35
+ title: string;
36
+ description: string;
37
+ moreActions: string;
38
+ sections: string;
39
+ }
40
+
34
41
  export interface PageHeaderProps {
42
+ /** Per-key copy overrides; explicit props take precedence, then labels, then the active catalog. */
43
+ labels?: Partial<PageHeaderLabels>;
35
44
  /** Root element. Use 'div' where the layout already has a banner (e.g. StackedLayout's pageHeader slot). */
36
45
  as?: 'header' | 'div';
37
46
  /** Location trail above the title; `null` hides it. */
@@ -62,9 +71,10 @@ export interface PageHeaderProps {
62
71
  export function PageHeader({
63
72
  as: Root = 'header',
64
73
  breadcrumbs = pageHeaderBreadcrumbs,
65
- title = 'Deployments',
74
+ title: titleProp,
75
+ labels,
66
76
  titleRef,
67
- description = 'Every build and release of this project across its environments.',
77
+ description: descriptionProp,
68
78
  status = 'active',
69
79
  statuses,
70
80
  meta = pageHeaderMeta,
@@ -76,6 +86,9 @@ export function PageHeader({
76
86
  className,
77
87
  }: PageHeaderProps) {
78
88
  const { t } = useI18n();
89
+ const title = titleProp === undefined ? (labels?.title ?? t('pageHeader.title')) : titleProp;
90
+ const description =
91
+ descriptionProp === undefined ? (labels?.description ?? t('pageHeader.description')) : descriptionProp;
79
92
  const explicitPrimary = actions.findIndex((a) => a.variant === 'primary');
80
93
  const primaryIndex = explicitPrimary >= 0 ? explicitPrimary : actions.length - 1;
81
94
  const primary = actions[primaryIndex];
@@ -127,7 +140,9 @@ export function PageHeader({
127
140
  <>
128
141
  <div className="hidden shrink-0 items-center gap-2.5 sm:flex">{actions.map(renderAction)}</div>
129
142
  <div className="flex shrink-0 items-center gap-2 sm:hidden">
130
- {folded.length > 0 && <MoreMenu items={folded.map(toMenuAction)} label="More actions" />}
143
+ {folded.length > 0 && (
144
+ <MoreMenu items={folded.map(toMenuAction)} label={labels?.moreActions ?? t('pageHeader.moreActions')} />
145
+ )}
131
146
  {primary && renderAction(primary, primaryIndex)}
132
147
  </div>
133
148
  </>
@@ -140,7 +155,7 @@ export function PageHeader({
140
155
  onValueChange={(value) => onTabChange?.(String(value))}
141
156
  className="mt-5"
142
157
  >
143
- <TabsList aria-label={t('pageHeader.sections')} className="overflow-x-auto">
158
+ <TabsList aria-label={labels?.sections ?? t('pageHeader.sections')} className="overflow-x-auto">
144
159
  {tabs.map((t) => (
145
160
  <TabsTab key={t.value} value={t.value} count={t.count}>
146
161
  {t.label}
@@ -1,10 +1,17 @@
1
1
  import type { BlockMeta } from '../../meta';
2
+ import type { PageHeaderLabels } from './PageHeader';
2
3
 
3
4
  export const meta: BlockMeta = {
4
5
  name: 'Page header',
5
6
  family: 'page-chrome',
6
7
  status: 'beta',
7
8
  description:
8
- 'Screen header with breadcrumb, title and status, description, meta row, actions that fold into a MoreMenu on small screens, and optional navigation tabs. titleRef targets the h1 for titleRef.current.focus(), adding tabIndex=-1 only when supplied so the title stays outside the Tab order. In a StatusLayout heading slot use as="div" and disable breadcrumb, meta, tabs, actions, status and description fixtures; the slot supplies the page’s only h1. The tablist name follows I18nProvider (en/es); the Spanish preview keeps caller content unchanged.',
9
+ 'Screen header with breadcrumb, title and status, description, meta row, actions that fold into a MoreMenu on small screens, and optional navigation tabs. titleRef targets the h1 for titleRef.current.focus(), adding tabIndex=-1 only when supplied so the title stays outside the Tab order. In a StatusLayout heading slot use as="div" and disable breadcrumb, meta, tabs, actions, status and description fixtures; the slot supplies the page’s only h1. The tablist name follows I18nProvider (en/es); the Spanish preview keeps caller content unchanged. Optional labels?: Partial<PageHeaderLabels> overrides each built-in label. Explicit content props win over labels, then I18nProvider (en/es); no provider keeps English. Imported fixtures and machine data stay unchanged. See the Catalog labels live preview.',
10
+ labels: [
11
+ { key: 'title', type: 'string', state: 'Heading; explicit title prop wins, including null' },
12
+ { key: 'description', type: 'string', state: 'Description; explicit description prop wins, including null' },
13
+ { key: 'moreActions', type: 'string', state: 'Compact actions menu name' },
14
+ { key: 'sections', type: 'string', state: 'Tablist name' },
15
+ ] satisfies Array<{ key: keyof PageHeaderLabels; type: string; state: string }>,
9
16
  uses: ['Breadcrumbs', 'Button', 'MoreMenu', 'StatusTag', 'Tabs'],
10
17
  };
@@ -0,0 +1,16 @@
1
+ import { I18nProvider } from '@gntik-ai/ui';
2
+ import { PageHeader } from '../PageHeader';
3
+ export default function Labels() {
4
+ return (
5
+ <I18nProvider locale="es">
6
+ <PageHeader
7
+ labels={{
8
+ title: 'Application releases',
9
+ description: 'Build and release history.',
10
+ moreActions: 'Additional actions',
11
+ sections: 'Release sections',
12
+ }}
13
+ />
14
+ </I18nProvider>
15
+ );
16
+ }
@@ -1,3 +1,4 @@
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';
@@ -26,3 +27,27 @@ describe('AgendaList', () => {
26
27
  expect(screen.getByRole('heading', { name: 'Nothing scheduled' })).toBeInTheDocument();
27
28
  });
28
29
  });
30
+
31
+ it.each([
32
+ ['en-US', undefined, '9:30 AM–10:00 AM'],
33
+ ['es-ES', undefined, '09:30–10:00'],
34
+ ['en-US', 'h23', '09:30–10:00'],
35
+ ] as const)('formats agenda ranges for %s with override %s', (locale, hourCycle, expected) => {
36
+ render(
37
+ <I18nProvider locale={locale}>
38
+ <AgendaList
39
+ hourCycle={hourCycle}
40
+ events={[
41
+ {
42
+ id: 'clock',
43
+ title: 'Review',
44
+ kind: 'task',
45
+ start: new Date(2026, 3, 15, 9, 30),
46
+ end: new Date(2026, 3, 15, 10),
47
+ },
48
+ ]}
49
+ />
50
+ </I18nProvider>,
51
+ );
52
+ expect(screen.getByText(expected)).toBeInTheDocument();
53
+ });
@@ -1,13 +1,16 @@
1
1
  import { useId, useMemo } from 'react';
2
2
  import { Badge, EmptyState, cn, useI18n } from '@gntik-ai/ui';
3
3
  import { CalendarDays, ChevronRight, Clock } from '@gntik-ai/icons';
4
+ import { useSchedulingClock } from '../shared/useSchedulingClock';
4
5
  import { EventTile } from '../shared/EventTile';
5
- import { addDays, dayKey, formatDay, formatRange, sameDay } from '../shared/dates';
6
+ import { addDays, dayKey, formatDay, formatRange, sameDay, type HourCycle } from '../shared/dates';
6
7
  import { defaultEventKinds, groupByDay, kindOf, TONE, type EventKind, type ScheduleEvent } from '../shared/events';
7
8
  import { sampleEvents, sampleToday } from '../shared/fixtures';
8
9
 
9
10
  export interface AgendaListProps {
10
11
  events?: ScheduleEvent[];
12
+ /** Clock used for event ranges; defaults to the provider or runtime locale. */
13
+ hourCycle?: HourCycle;
11
14
  /** The app's "today": labels the Today/Tomorrow groups. */
12
15
  today?: Date;
13
16
  /** Only events on or after this day. Defaults to `today`; pass null for all. */
@@ -30,6 +33,7 @@ export interface AgendaListProps {
30
33
  /** Upcoming scheduled work grouped by day, each row with a kind tile, time range and location. */
31
34
  export function AgendaList({
32
35
  events = sampleEvents,
36
+ hourCycle: hourCycleProp,
33
37
  today = sampleToday,
34
38
  from,
35
39
  days = 7,
@@ -43,6 +47,7 @@ export function AgendaList({
43
47
  className,
44
48
  }: AgendaListProps) {
45
49
  const { t, locale } = useI18n();
50
+ const clock = useSchedulingClock(hourCycleProp);
46
51
  const title = titleProp ?? t('calendar.agenda');
47
52
  const emptyTitle = emptyTitleProp ?? t('calendar.emptyTitle');
48
53
  const emptyDescription = emptyDescriptionProp ?? t('calendar.emptyDescription');
@@ -105,7 +110,7 @@ export function AgendaList({
105
110
  >
106
111
  {list.map((event) => {
107
112
  const kind = kindOf(event, kinds);
108
- const range = formatRange(event.start, event.end, locale);
113
+ const range = formatRange(event.start, event.end, clock.locale, clock.hourCycle);
109
114
  const content = (
110
115
  <>
111
116
  <EventTile kind={kind} />
@@ -0,0 +1,11 @@
1
+ import { render, screen } from '@testing-library/react';
2
+ import { expectNoAxeViolations } from '../../test/a11y';
3
+ import Locale from './examples/Locale';
4
+
5
+ it('gives each agenda locale example a distinct landmark name', async () => {
6
+ const { container } = render(<Locale />);
7
+ expect(screen.getByRole('region', { name: 'Agenda (en-US)' })).toBeInTheDocument();
8
+ expect(screen.getByRole('region', { name: 'Agenda (es-ES)' })).toBeInTheDocument();
9
+ expect(screen.getByRole('region', { name: 'Agenda (en-US, h23)' })).toBeInTheDocument();
10
+ await expectNoAxeViolations(container);
11
+ });
@@ -5,6 +5,6 @@ export const meta: BlockMeta = {
5
5
  family: 'scheduling',
6
6
  status: 'beta',
7
7
  description:
8
- 'Upcoming scheduled work grouped by day (Today/Tomorrow labels), each row with a kind tile, time range, location and kind badge; empty state included.',
8
+ 'Upcoming scheduled work grouped by day (Today/Tomorrow labels), each row with a kind tile, locale-formatted time range, location and kind badge; empty state included. hourCycle overrides the provider/runtime clock. Locale examples show en-US, es-ES, then en-US with the 24-hour override.',
9
9
  uses: ['Badge', 'EmptyState'],
10
10
  };
@@ -0,0 +1,29 @@
1
+ import { I18nProvider, useI18n } from '@gntik-ai/ui';
2
+ import { AgendaList } from '../AgendaList';
3
+
4
+ function LocaleAgenda({ hourCycle }: { hourCycle?: 'h23' }) {
5
+ const { locale, t } = useI18n();
6
+ return (
7
+ <AgendaList
8
+ title={`${t('calendar.agenda')} (${locale}${hourCycle ? `, ${hourCycle}` : ''})`}
9
+ hourCycle={hourCycle}
10
+ />
11
+ );
12
+ }
13
+
14
+ /** Compare US defaults, Spanish defaults, and explicit overrides under US English. */
15
+ export default function Locale() {
16
+ return (
17
+ <div className="space-y-6">
18
+ <I18nProvider locale="en-US">
19
+ <LocaleAgenda />
20
+ </I18nProvider>
21
+ <I18nProvider locale="es-ES">
22
+ <LocaleAgenda />
23
+ </I18nProvider>
24
+ <I18nProvider locale="en-US">
25
+ <LocaleAgenda hourCycle="h23" />
26
+ </I18nProvider>
27
+ </div>
28
+ );
29
+ }
@@ -1,4 +1,5 @@
1
- import { render, screen } from '@testing-library/react';
1
+ import { Calendar, I18nProvider, localeWeekStart } from '@gntik-ai/ui';
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 { MonthCalendar } from './MonthCalendar';
@@ -30,3 +31,112 @@ describe('MonthCalendar', () => {
30
31
  expect(screen.getByRole('heading', { name: 'April 2026' })).toBeInTheDocument();
31
32
  });
32
33
  });
34
+
35
+ it.each([
36
+ ['en-US', 'Sunday', '2026-03-29'],
37
+ ['es-ES', 'lunes', '2026-03-30'],
38
+ ])('starts the April grid with the locale weekday (%s)', (locale, header, firstDate) => {
39
+ const { container } = render(
40
+ <I18nProvider locale={locale}>
41
+ <MonthCalendar events={[]} today={new Date(2026, 3, 15)} />
42
+ </I18nProvider>,
43
+ );
44
+ expect(screen.getAllByRole('columnheader')[0]).toHaveAccessibleName(header);
45
+ expect(container.querySelector('[data-date]')).toHaveAttribute('data-date', firstDate);
46
+ });
47
+
48
+ it.each([
49
+ ['en-US', undefined, '9:30 AM'],
50
+ ['es-ES', undefined, '09:30'],
51
+ ['en-US', 'h23', '09:30'],
52
+ ] as const)('formats month event times for %s with override %s', (locale, hourCycle, expected) => {
53
+ render(
54
+ <I18nProvider locale={locale}>
55
+ <MonthCalendar
56
+ hourCycle={hourCycle}
57
+ events={[
58
+ {
59
+ id: 'clock',
60
+ title: 'Review',
61
+ kind: 'task',
62
+ start: new Date(2026, 3, 15, 9, 30),
63
+ end: new Date(2026, 3, 15, 10),
64
+ },
65
+ ]}
66
+ />
67
+ </I18nProvider>,
68
+ );
69
+ expect(screen.getByText(expected)).toBeInTheDocument();
70
+ });
71
+
72
+ it.each([
73
+ ['en-US', undefined, '2026-04-12', '2026-04-18'],
74
+ ['es-ES', undefined, '2026-04-13', '2026-04-19'],
75
+ ['en-US', 1, '2026-04-13', '2026-04-19'],
76
+ ] as const)('moves to week edges for %s with override %s', async (locale, weekStartsOn, home, end) => {
77
+ const user = userEvent.setup();
78
+ const { container } = render(
79
+ <I18nProvider locale={locale}>
80
+ <MonthCalendar events={[]} weekStartsOn={weekStartsOn} today={new Date(2026, 3, 15)} />
81
+ </I18nProvider>,
82
+ );
83
+ const day = (key: string) => container.querySelector<HTMLElement>(`[data-date="${key}"]`)!;
84
+ day('2026-04-15').focus();
85
+ await user.keyboard('{Home}');
86
+ expect(day(home)).toHaveFocus();
87
+ day('2026-04-15').focus();
88
+ await user.keyboard('{End}');
89
+ expect(day(end)).toHaveFocus();
90
+ if (weekStartsOn === 1) {
91
+ expect(screen.getAllByRole('columnheader')[0]).toHaveAccessibleName('Monday');
92
+ expect(container.querySelector('[data-date]')).toHaveAttribute('data-date', '2026-03-30');
93
+ }
94
+ });
95
+
96
+ it.each(['en-US', 'en-GB'])('matches the ui Calendar without a provider in a %s runtime', (runtimeLocale) => {
97
+ const NativeFormatter = Intl.DateTimeFormat;
98
+ vi.stubGlobal(
99
+ 'Intl',
100
+ Object.create(Intl, {
101
+ DateTimeFormat: {
102
+ value: class extends NativeFormatter {
103
+ constructor(locale?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions) {
104
+ super(locale ?? runtimeLocale, options);
105
+ }
106
+ },
107
+ },
108
+ }),
109
+ );
110
+ try {
111
+ render(
112
+ <>
113
+ <MonthCalendar events={[]} />
114
+ <Calendar defaultMonth={new Date(2026, 3, 1)} />
115
+ </>,
116
+ );
117
+ const grids = screen.getAllByRole('grid');
118
+ const header = (grid: HTMLElement) => within(grid).getAllByRole('columnheader')[0]!;
119
+ const date = new Date(2026, 0, 4 + localeWeekStart(undefined));
120
+ expect(header(grids[0]!)).toHaveAccessibleName(new Intl.DateTimeFormat('en', { weekday: 'long' }).format(date));
121
+ expect(header(grids[1]!).querySelector('abbr')).toHaveAttribute(
122
+ 'title',
123
+ new Intl.DateTimeFormat(undefined, { weekday: 'long' }).format(date),
124
+ );
125
+ } finally {
126
+ vi.unstubAllGlobals();
127
+ }
128
+ });
129
+
130
+ it('marks only weekend cells', () => {
131
+ render(
132
+ <I18nProvider locale="en-US">
133
+ <MonthCalendar events={[]} />
134
+ </I18nProvider>,
135
+ );
136
+ const cells = screen.getAllByRole('gridcell');
137
+ expect(cells.filter((cell) => cell.hasAttribute('data-weekend'))).toHaveLength(12);
138
+ for (const cell of cells) {
139
+ const label = within(cell).getByRole('button').getAttribute('aria-label') ?? '';
140
+ expect(cell.hasAttribute('data-weekend')).toBe(/^(Saturday|Sunday),/.test(label));
141
+ }
142
+ });