@gntik-ai/blocks 0.10.0 → 0.11.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.
- package/dist/index.d.ts +301 -40
- package/dist/index.js +1441 -297
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/auth/ForgotPasswordForm/ForgotPasswordForm.labels.test.tsx +179 -0
- package/src/auth/ForgotPasswordForm/ForgotPasswordForm.tsx +59 -24
- package/src/auth/ForgotPasswordForm/block.meta.ts +22 -1
- package/src/auth/ForgotPasswordForm/examples/Labels.tsx +29 -0
- package/src/auth/MfaChallenge/MfaChallenge.labels.test.tsx +139 -0
- package/src/auth/MfaChallenge/MfaChallenge.tsx +69 -23
- package/src/auth/MfaChallenge/block.meta.ts +29 -1
- package/src/auth/MfaChallenge/examples/Labels.tsx +28 -0
- package/src/auth/ResetPasswordForm/ResetPasswordForm.labels.test.tsx +104 -0
- package/src/auth/ResetPasswordForm/ResetPasswordForm.tsx +42 -15
- package/src/auth/ResetPasswordForm/block.meta.ts +17 -1
- package/src/auth/ResetPasswordForm/examples/Labels.tsx +28 -0
- package/src/auth/SignInForm/SignInForm.labels.test.tsx +137 -0
- package/src/auth/SignInForm/SignInForm.tsx +43 -16
- package/src/auth/SignInForm/block.meta.ts +22 -1
- package/src/auth/SignInForm/examples/Labels.tsx +29 -0
- package/src/auth/SignUpForm/SignUpForm.labels.test.tsx +217 -0
- package/src/auth/SignUpForm/SignUpForm.tsx +65 -26
- package/src/auth/SignUpForm/block.meta.ts +27 -1
- package/src/auth/SignUpForm/examples/Labels.tsx +29 -0
- package/src/auth/SsoButtons/SsoButtons.labels.test.tsx +30 -0
- package/src/auth/SsoButtons/SsoButtons.tsx +10 -2
- package/src/auth/SsoButtons/block.meta.ts +8 -1
- package/src/auth/SsoButtons/examples/Labels.tsx +24 -0
- package/src/auth/shared.i18n.test.tsx +71 -0
- package/src/auth/shared.tsx +48 -11
- package/src/builders/LogViewer/LogViewer.levels.test.tsx +49 -0
- package/src/builders/LogViewer/LogViewer.tsx +29 -8
- package/src/builders/LogViewer/LogViewer.wrap.test.tsx +181 -0
- package/src/builders/LogViewer/block.meta.ts +6 -1
- package/src/builders/LogViewer/examples/Wrap.tsx +62 -0
- package/src/builders/LogViewer/use-wrapped-log-rows.ts +42 -0
- package/src/data-display/DescriptionListCard/DescriptionListCard.options.test.tsx +64 -0
- package/src/data-display/DescriptionListCard/DescriptionListCard.tsx +38 -17
- package/src/data-display/DescriptionListCard/block.meta.ts +1 -1
- package/src/data-display/DescriptionListCard/examples/Spanish.tsx +7 -0
- package/src/feedback/EmptyStates/EmptyStates.tsx +32 -14
- package/src/feedback/EmptyStates/NoAccessEmpty.options.test.tsx +38 -0
- package/src/feedback/EmptyStates/block.meta.ts +1 -1
- package/src/feedback/EmptyStates/examples/Spanish.tsx +7 -0
- package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.labels.test.tsx +115 -0
- package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.tsx +63 -21
- package/src/forms/CreateApiKeyDialog/block.meta.ts +22 -1
- package/src/forms/CreateApiKeyDialog/examples/Labels.tsx +29 -0
- package/src/forms/CredentialDisclosureDialog/CredentialDisclosureDialog.labels.test.tsx +165 -0
- package/src/forms/CredentialDisclosureDialog/CredentialDisclosureDialog.tsx +31 -8
- package/src/forms/CredentialDisclosureDialog/SecretCopy.tsx +16 -8
- package/src/forms/CredentialDisclosureDialog/block.meta.ts +19 -1
- package/src/forms/CredentialDisclosureDialog/examples/Labels.tsx +38 -0
- package/src/forms/DangerZone/ConfirmDestructiveDialog.tsx +17 -3
- package/src/forms/DangerZone/DangerZone.labels.test.tsx +87 -0
- package/src/forms/DangerZone/DangerZone.tsx +20 -5
- package/src/forms/DangerZone/block.meta.ts +10 -1
- package/src/forms/DangerZone/examples/Labels.tsx +29 -0
- package/src/forms/DateRangeFilter/DateRangeFilter.labels.test.tsx +52 -0
- package/src/forms/DateRangeFilter/DateRangeFilter.tsx +11 -3
- package/src/forms/DateRangeFilter/block.meta.ts +8 -1
- package/src/forms/DateRangeFilter/examples/Labels.tsx +28 -0
- package/src/forms/DialogWizard/DialogWizard.labels.test.tsx +37 -0
- package/src/forms/DialogWizard/DialogWizard.tsx +13 -2
- package/src/forms/DialogWizard/block.meta.ts +7 -1
- package/src/forms/DialogWizard/examples/Labels.tsx +39 -0
- package/src/forms/FileUploadPanel/FileUploadPanel.labels.test.tsx +126 -0
- package/src/forms/FileUploadPanel/FileUploadPanel.tsx +81 -18
- package/src/forms/FileUploadPanel/block.meta.ts +22 -1
- package/src/forms/FileUploadPanel/examples/Labels.tsx +29 -0
- package/src/forms/FormSection/FormSection.labels.test.tsx +37 -0
- package/src/forms/FormSection/FormSection.tsx +14 -3
- package/src/forms/FormSection/block.meta.ts +7 -1
- package/src/forms/FormSection/examples/Labels.tsx +27 -0
- package/src/forms/InviteMembersDialog/InviteMembersDialog.labels.test.tsx +87 -0
- package/src/forms/InviteMembersDialog/InviteMembersDialog.tsx +51 -16
- package/src/forms/InviteMembersDialog/block.meta.ts +20 -1
- package/src/forms/InviteMembersDialog/examples/Labels.tsx +28 -0
- package/src/forms/SettingsRow/SettingsRow.labels.test.tsx +33 -0
- package/src/forms/SettingsRow/SettingsRow.tsx +14 -3
- package/src/forms/SettingsRow/block.meta.ts +7 -1
- package/src/forms/SettingsRow/examples/Labels.tsx +27 -0
- package/src/forms/ValidationSummary/ValidationSummary.labels.test.tsx +47 -0
- package/src/forms/ValidationSummary/ValidationSummary.tsx +9 -3
- package/src/forms/ValidationSummary/block.meta.ts +6 -1
- package/src/forms/ValidationSummary/examples/Labels.tsx +24 -0
- package/src/forms/index.ts +5 -1
- package/src/forms/translated-content.tsx +12 -0
- package/src/page-chrome/PageHeader/PageHeader.options.test.tsx +34 -0
- package/src/page-chrome/PageHeader/PageHeader.tsx +7 -1
- package/src/page-chrome/PageHeader/block.meta.ts +1 -1
- package/src/page-chrome/PageHeader/examples/Spanish.tsx +11 -0
- package/src/tables/DataTable/DataTable.cross-page-selection.test.tsx +322 -0
- package/src/tables/DataTable/DataTable.labels.test.tsx +74 -0
- package/src/tables/DataTable/DataTable.server-pagination.test.tsx +1 -1
- package/src/tables/DataTable/DataTable.single-select.test.tsx +47 -7
- package/src/tables/DataTable/DataTable.test.tsx +55 -0
- package/src/tables/DataTable/DataTable.tsx +134 -67
- package/src/tables/DataTable/block.meta.ts +21 -3
- package/src/tables/DataTable/data-table-props.ts +14 -5
- package/src/tables/DataTable/data-table-row.tsx +7 -3
- package/src/tables/DataTable/data-table-utils.ts +2 -0
- package/src/tables/DataTable/examples/client-selection.tsx +33 -0
- package/src/tables/DataTable/examples/paginated-single-selection.tsx +46 -0
- package/src/tables/DataTable/examples/server-pagination.tsx +55 -15
- package/src/tables/DataTable/labels.ts +4 -0
- package/src/tables/DataTable/selection-strip.tsx +31 -0
- package/src/tables/DataTable/single-selection.tsx +0 -7
- package/src/tables/DataTable/use-multiple-selection.ts +86 -0
- package/src/test/OptInDefaults.test.tsx +27 -0
- package/src/test/fixtures/opt-in-defaults.json +10 -0
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { useI18n, WizardLayout, type WizardLayoutProps } from '@gntik-ai/ui';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
+
export interface DialogWizardLabels {
|
|
5
|
+
title: string;
|
|
6
|
+
details: string;
|
|
7
|
+
review: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
4
10
|
export interface DialogWizardProps extends Omit<WizardLayoutProps, 'mode' | 'steps' | 'current'> {
|
|
11
|
+
labels?: Partial<DialogWizardLabels>;
|
|
5
12
|
steps?: WizardLayoutProps['steps'];
|
|
6
13
|
current?: number;
|
|
7
14
|
/** Step-local validation surface, normally a ValidationSummary with consumer copy. */
|
|
@@ -12,6 +19,7 @@ export interface DialogWizardProps extends Omit<WizardLayoutProps, 'mode' | 'ste
|
|
|
12
19
|
|
|
13
20
|
/** Modal variant of create-wizard for a flow over its parent page. State stays consumer-owned. */
|
|
14
21
|
export function DialogWizard({
|
|
22
|
+
labels,
|
|
15
23
|
steps,
|
|
16
24
|
current = 0,
|
|
17
25
|
size = 'dialog',
|
|
@@ -22,7 +30,10 @@ export function DialogWizard({
|
|
|
22
30
|
...props
|
|
23
31
|
}: DialogWizardProps) {
|
|
24
32
|
const { t } = useI18n();
|
|
25
|
-
const items = steps ?? [
|
|
33
|
+
const items = steps ?? [
|
|
34
|
+
{ label: labels?.details ?? t('wizard.details') },
|
|
35
|
+
{ label: labels?.review ?? t('wizard.review') },
|
|
36
|
+
];
|
|
26
37
|
return (
|
|
27
38
|
<WizardLayout
|
|
28
39
|
{...props}
|
|
@@ -30,7 +41,7 @@ export function DialogWizard({
|
|
|
30
41
|
size={size}
|
|
31
42
|
steps={items}
|
|
32
43
|
current={current}
|
|
33
|
-
title={title ?? t('wizard.title')}
|
|
44
|
+
title={title ?? labels?.title ?? t('wizard.title')}
|
|
34
45
|
>
|
|
35
46
|
{stepError}
|
|
36
47
|
{current >= items.length - 1 && reviewStep != null ? reviewStep : children}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { BlockMeta } from '../../meta';
|
|
2
|
+
import type { DialogWizardLabels } from './DialogWizard';
|
|
2
3
|
|
|
3
4
|
export const meta: BlockMeta = {
|
|
4
5
|
name: 'Dialog wizard',
|
|
5
6
|
family: 'forms',
|
|
6
7
|
status: 'beta',
|
|
7
8
|
description:
|
|
8
|
-
'Modal variant of create-wizard for create flows over their parent page, without a route change. Defaults to dialog size (fullscreen on mobile); size="fullscreen" fills every viewport. Consumer-controlled step state survives closing. Use the create-wizard page template for a dedicated page flow, or WizardLayout mode="overlay" for a fullscreen flow. Supply all labels, pendingLabel and stepAnnouncement from your own i18n; stepError accepts ValidationSummary and reviewStep accepts DescriptionListCard.',
|
|
9
|
+
'Modal variant of create-wizard for create flows over their parent page, without a route change. Defaults to dialog size (fullscreen on mobile); size="fullscreen" fills every viewport. Consumer-controlled step state survives closing. Use the create-wizard page template for a dedicated page flow, or WizardLayout mode="overlay" for a fullscreen flow. Supply all labels, pendingLabel and stepAnnouncement from your own i18n; stepError accepts ValidationSummary and reviewStep accepts DescriptionListCard. Optional labels?: Partial<DialogWizardLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=dialog-wizard--labels.',
|
|
10
|
+
labels: [
|
|
11
|
+
{ key: 'title', type: 'string', state: 'Default content and accessible names' },
|
|
12
|
+
{ key: 'details', type: 'string', state: 'Default content and accessible names' },
|
|
13
|
+
{ key: 'review', type: 'string', state: 'Default content and accessible names' },
|
|
14
|
+
] satisfies Array<{ key: keyof DialogWizardLabels; type: string; state: string }>,
|
|
9
15
|
uses: ['WizardLayout', 'Dialog', 'Stepper', 'Button'],
|
|
10
16
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Button, I18nProvider } from '@gntik-ai/ui';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { DialogWizard, type DialogWizardLabels } from '../DialogWizard';
|
|
4
|
+
|
|
5
|
+
export default function Labels() {
|
|
6
|
+
const [spanish, setSpanish] = useState(false);
|
|
7
|
+
const [custom, setCustom] = useState(true);
|
|
8
|
+
const [open, setOpen] = useState(false);
|
|
9
|
+
const [current, setCurrent] = useState(0);
|
|
10
|
+
const labels: Partial<DialogWizardLabels> = {
|
|
11
|
+
title: 'New resource',
|
|
12
|
+
details: 'Configure',
|
|
13
|
+
review: 'Confirm details',
|
|
14
|
+
};
|
|
15
|
+
return (
|
|
16
|
+
<div className="grid gap-4">
|
|
17
|
+
<div className="flex flex-wrap gap-2">
|
|
18
|
+
<Button variant="secondary" aria-pressed={spanish} onClick={() => setSpanish(!spanish)}>
|
|
19
|
+
Spanish catalog
|
|
20
|
+
</Button>
|
|
21
|
+
<Button variant="secondary" aria-pressed={custom} onClick={() => setCustom(!custom)}>
|
|
22
|
+
Custom labels
|
|
23
|
+
</Button>
|
|
24
|
+
</div>
|
|
25
|
+
<I18nProvider locale={spanish ? 'es' : 'en'}>
|
|
26
|
+
<Button onClick={() => setOpen(true)}>Open wizard</Button>
|
|
27
|
+
<DialogWizard
|
|
28
|
+
labels={custom ? labels : undefined}
|
|
29
|
+
open={open}
|
|
30
|
+
onOpenChange={setOpen}
|
|
31
|
+
current={current}
|
|
32
|
+
onStepChange={setCurrent}
|
|
33
|
+
onFinish={() => setOpen(false)}
|
|
34
|
+
description="Configure and review your new resource."
|
|
35
|
+
/>
|
|
36
|
+
</I18nProvider>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { I18nProvider, es } from '@gntik-ai/ui';
|
|
4
|
+
import { FileUploadPanel, type FileUploadPanelLabels } from './FileUploadPanel';
|
|
5
|
+
const files = [{ id: '1', name: 'report.csv', size: 3, progress: 100, status: 'done' as const }];
|
|
6
|
+
it('preserves English and translates static copy and parameterised file messages', async () => {
|
|
7
|
+
const { container, rerender } = render(<FileUploadPanel defaultFiles={files} accept=".csv" maxSize={1000} />);
|
|
8
|
+
expect(screen.getByRole('group', { name: 'Upload files' })).toBeVisible();
|
|
9
|
+
expect(screen.getByText('Drag files here or')).toBeVisible();
|
|
10
|
+
expect(screen.getByRole('button', { name: 'Browse files' })).toBeVisible();
|
|
11
|
+
expect(screen.getByText('CSV · max 1 kB per file')).toBeVisible();
|
|
12
|
+
expect(screen.getByRole('list', { name: 'Files' })).toBeVisible();
|
|
13
|
+
expect(screen.getByText('3 B · uploaded')).toBeVisible();
|
|
14
|
+
expect(screen.getByRole('button', { name: 'Remove report.csv' })).toBeVisible();
|
|
15
|
+
rerender(
|
|
16
|
+
<I18nProvider locale="es">
|
|
17
|
+
<FileUploadPanel defaultFiles={files} accept=".csv" maxSize={1000} onUpload={() => Promise.reject(null)} />
|
|
18
|
+
</I18nProvider>,
|
|
19
|
+
);
|
|
20
|
+
expect(screen.getByRole('group', { name: es['upload.label'] })).toBeVisible();
|
|
21
|
+
expect(screen.getByText(es['upload.drop'])).toBeVisible();
|
|
22
|
+
expect(screen.getByRole('button', { name: es['upload.browse'] })).toBeVisible();
|
|
23
|
+
expect(screen.getByText('CSV · máx. 1 kB por archivo')).toBeVisible();
|
|
24
|
+
expect(screen.getByRole('list', { name: es['upload.files'] })).toBeVisible();
|
|
25
|
+
expect(screen.getByText('3 B · subido')).toBeVisible();
|
|
26
|
+
const input = container.querySelector('input[type="file"]') as HTMLInputElement;
|
|
27
|
+
fireEvent.change(input, {
|
|
28
|
+
target: {
|
|
29
|
+
files: [new File(['x'], 'test.csv'), new File(['x'], 'bad.png'), new File(['x'.repeat(2000)], 'large.csv')],
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
expect(screen.getByRole('status')).toHaveTextContent('1 archivo añadido. 2 rechazados.');
|
|
33
|
+
expect(screen.getByText('Tipo de archivo no admitido · sin subir')).toBeVisible();
|
|
34
|
+
expect(screen.getByText('Supera el límite de 1 kB · sin subir')).toBeVisible();
|
|
35
|
+
expect(await screen.findByText('Error al subir · sin subir')).toBeVisible();
|
|
36
|
+
expect(screen.getByRole('status')).toHaveTextContent('No se pudo subir test.csv.');
|
|
37
|
+
expect(screen.getByRole('button', { name: 'Reintentar test.csv' })).toBeVisible();
|
|
38
|
+
await userEvent.click(screen.getByRole('button', { name: 'Quitar report.csv' }));
|
|
39
|
+
expect(screen.getByRole('status')).toHaveTextContent('report.csv eliminado.');
|
|
40
|
+
});
|
|
41
|
+
it.each(['en', 'es'])('uses all label overrides under %s and explicit label/hint first', async (locale) => {
|
|
42
|
+
const labels: FileUploadPanelLabels = {
|
|
43
|
+
label: 'Custom label',
|
|
44
|
+
drop: 'Custom drop',
|
|
45
|
+
browse: 'Custom browse',
|
|
46
|
+
files: 'Custom files',
|
|
47
|
+
failed: 'Custom failure',
|
|
48
|
+
typeRejected: 'Custom type',
|
|
49
|
+
hint: (types, size) => `Custom hint ${types} ${size}`,
|
|
50
|
+
tooLarge: (size) => `Custom large ${size}`,
|
|
51
|
+
done: (name) => `Custom done ${name}`,
|
|
52
|
+
error: (name) => `Custom error ${name}`,
|
|
53
|
+
added: (count) => `Custom added ${count}`,
|
|
54
|
+
rejected: (count) => `Custom rejected ${count}`,
|
|
55
|
+
removed: (name) => `Custom removed ${name}`,
|
|
56
|
+
uploading: (name) => `Custom uploading ${name}`,
|
|
57
|
+
notUploaded: (error) => `Custom not uploaded ${error}`,
|
|
58
|
+
uploaded: (size) => `Custom uploaded ${size}`,
|
|
59
|
+
retry: (name) => `Custom retry ${name}`,
|
|
60
|
+
remove: (name) => `Custom remove ${name}`,
|
|
61
|
+
};
|
|
62
|
+
const { container, rerender } = render(
|
|
63
|
+
<I18nProvider locale={locale}>
|
|
64
|
+
<FileUploadPanel
|
|
65
|
+
labels={labels}
|
|
66
|
+
defaultFiles={files}
|
|
67
|
+
accept=".csv"
|
|
68
|
+
maxSize={1000}
|
|
69
|
+
onUpload={() => Promise.reject(null)}
|
|
70
|
+
/>
|
|
71
|
+
</I18nProvider>,
|
|
72
|
+
);
|
|
73
|
+
for (const text of ['Custom label', 'Custom drop', 'Custom hint CSV 1 kB', 'Custom uploaded 3 B'])
|
|
74
|
+
expect(screen.getByText(text)).toBeVisible();
|
|
75
|
+
expect(screen.getByRole('button', { name: 'Custom browse' })).toBeVisible();
|
|
76
|
+
expect(screen.getByRole('list', { name: 'Custom files' })).toBeVisible();
|
|
77
|
+
const input = container.querySelector('input[type="file"]') as HTMLInputElement;
|
|
78
|
+
fireEvent.change(input, {
|
|
79
|
+
target: {
|
|
80
|
+
files: [new File(['x'], 'test.csv'), new File(['x'], 'bad.png'), new File(['x'.repeat(2000)], 'large.csv')],
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
expect(screen.getByRole('status')).toHaveTextContent('Custom added 1 Custom rejected 2');
|
|
84
|
+
expect(screen.getByRole('progressbar', { name: 'Custom uploading test.csv' })).toBeVisible();
|
|
85
|
+
expect(screen.getByText('Custom not uploaded Custom type')).toBeVisible();
|
|
86
|
+
expect(screen.getByText('Custom not uploaded Custom large 1 kB')).toBeVisible();
|
|
87
|
+
await waitFor(() => expect(screen.getByRole('status')).toHaveTextContent('Custom error test.csv'));
|
|
88
|
+
expect(screen.getByText('Custom not uploaded Custom failure')).toBeVisible();
|
|
89
|
+
expect(screen.getByRole('button', { name: 'Custom retry test.csv' })).toBeVisible();
|
|
90
|
+
await userEvent.click(screen.getByRole('button', { name: 'Custom remove report.csv' }));
|
|
91
|
+
expect(screen.getByRole('status')).toHaveTextContent('Custom removed report.csv');
|
|
92
|
+
rerender(
|
|
93
|
+
<I18nProvider locale={locale}>
|
|
94
|
+
<FileUploadPanel labels={labels} label="Explicit label" hint="Explicit hint" />
|
|
95
|
+
</I18nProvider>,
|
|
96
|
+
);
|
|
97
|
+
expect(screen.getByRole('group', { name: 'Explicit label' })).toBeVisible();
|
|
98
|
+
expect(screen.getByText('Explicit hint')).toBeVisible();
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it.each(['es', 'en'])('uses translated and custom successful upload announcements under %s', async (locale) => {
|
|
102
|
+
const { container, rerender } = render(
|
|
103
|
+
<I18nProvider locale={locale}>
|
|
104
|
+
<FileUploadPanel defaultFiles={[]} onUpload={() => Promise.resolve()} />
|
|
105
|
+
</I18nProvider>,
|
|
106
|
+
);
|
|
107
|
+
const input = container.querySelector('input[type="file"]') as HTMLInputElement;
|
|
108
|
+
fireEvent.change(input, { target: { files: [new File(['x'], 'ready.csv')] } });
|
|
109
|
+
expect(
|
|
110
|
+
screen.getByRole('progressbar', { name: locale === 'es' ? 'Subiendo ready.csv' : 'Uploading ready.csv' }),
|
|
111
|
+
).toBeVisible();
|
|
112
|
+
await waitFor(() =>
|
|
113
|
+
expect(screen.getByRole('status')).toHaveTextContent(locale === 'es' ? 'ready.csv subido.' : 'ready.csv uploaded.'),
|
|
114
|
+
);
|
|
115
|
+
rerender(
|
|
116
|
+
<I18nProvider locale={locale}>
|
|
117
|
+
<FileUploadPanel
|
|
118
|
+
defaultFiles={[]}
|
|
119
|
+
labels={{ done: (name) => `Custom done ${name}` }}
|
|
120
|
+
onUpload={() => Promise.resolve()}
|
|
121
|
+
/>
|
|
122
|
+
</I18nProvider>,
|
|
123
|
+
);
|
|
124
|
+
fireEvent.change(input, { target: { files: [new File(['x'], 'custom.csv')] } });
|
|
125
|
+
await waitFor(() => expect(screen.getByRole('status')).toHaveTextContent('Custom done custom.csv'));
|
|
126
|
+
});
|
|
@@ -5,7 +5,29 @@ import { acceptsFile, simulateUpload, uploadItems, type UploadItem } from './fix
|
|
|
5
5
|
|
|
6
6
|
export type { UploadItem, UploadStatus } from './fixtures';
|
|
7
7
|
|
|
8
|
+
export interface FileUploadPanelLabels {
|
|
9
|
+
label: string;
|
|
10
|
+
drop: string;
|
|
11
|
+
browse: string;
|
|
12
|
+
files: string;
|
|
13
|
+
failed: string;
|
|
14
|
+
typeRejected: string;
|
|
15
|
+
hint: (types: string, size: string) => string;
|
|
16
|
+
tooLarge: (size: string) => string;
|
|
17
|
+
done: (name: string) => string;
|
|
18
|
+
error: (name: string) => string;
|
|
19
|
+
added: (count: number) => string;
|
|
20
|
+
rejected: (count: number) => string;
|
|
21
|
+
removed: (name: string) => string;
|
|
22
|
+
uploading: (name: string) => string;
|
|
23
|
+
notUploaded: (error: string) => string;
|
|
24
|
+
uploaded: (size: string) => string;
|
|
25
|
+
retry: (name: string) => string;
|
|
26
|
+
remove: (name: string) => string;
|
|
27
|
+
}
|
|
28
|
+
|
|
8
29
|
export interface FileUploadPanelProps {
|
|
30
|
+
labels?: Partial<FileUploadPanelLabels>;
|
|
9
31
|
/** Accepted types, as for `<input accept>` (".csv,.json", "image/*"). */
|
|
10
32
|
accept?: string;
|
|
11
33
|
/** Maximum size per file in bytes. */
|
|
@@ -32,6 +54,7 @@ const nextId = () => `upload-${++uid}`;
|
|
|
32
54
|
* retry and remove. Rejected files stay in the list with the reason.
|
|
33
55
|
*/
|
|
34
56
|
export function FileUploadPanel({
|
|
57
|
+
labels,
|
|
35
58
|
accept = '.csv,.json,.jsonl,.yaml,.pdf',
|
|
36
59
|
maxSize = 25_000_000,
|
|
37
60
|
multiple = true,
|
|
@@ -44,7 +67,7 @@ export function FileUploadPanel({
|
|
|
44
67
|
className,
|
|
45
68
|
}: FileUploadPanelProps) {
|
|
46
69
|
const { t, formatBytes } = useI18n();
|
|
47
|
-
const label = labelProp ?? t('upload.label');
|
|
70
|
+
const label = labelProp ?? labels?.label ?? t('upload.label');
|
|
48
71
|
const id = useId();
|
|
49
72
|
const inputRef = useRef<HTMLInputElement | null>(null);
|
|
50
73
|
const [sources, setSources] = useState<Record<string, File>>({});
|
|
@@ -53,6 +76,13 @@ export function FileUploadPanel({
|
|
|
53
76
|
const [announcement, setAnnouncement] = useState('');
|
|
54
77
|
const hintText =
|
|
55
78
|
hint ??
|
|
79
|
+
labels?.hint?.(
|
|
80
|
+
accept
|
|
81
|
+
.split(',')
|
|
82
|
+
.map((a) => a.replace('.', '').toUpperCase())
|
|
83
|
+
.join(' · '),
|
|
84
|
+
formatBytes(maxSize),
|
|
85
|
+
) ??
|
|
56
86
|
t('upload.hint', {
|
|
57
87
|
types: accept
|
|
58
88
|
.split(',')
|
|
@@ -69,11 +99,14 @@ export function FileUploadPanel({
|
|
|
69
99
|
onUpload(file, (pct) => patch(itemId, { progress: pct })).then(
|
|
70
100
|
() => {
|
|
71
101
|
patch(itemId, { status: 'done', progress: 100 });
|
|
72
|
-
setAnnouncement(t('upload.done', { name: file.name }));
|
|
102
|
+
setAnnouncement(labels?.done?.(file.name) ?? t('upload.done', { name: file.name }));
|
|
73
103
|
},
|
|
74
104
|
(e: unknown) => {
|
|
75
|
-
patch(itemId, {
|
|
76
|
-
|
|
105
|
+
patch(itemId, {
|
|
106
|
+
status: 'error',
|
|
107
|
+
error: e instanceof Error ? e.message : (labels?.failed ?? t('upload.failed')),
|
|
108
|
+
});
|
|
109
|
+
setAnnouncement(labels?.error?.(file.name) ?? t('upload.error', { name: file.name }));
|
|
77
110
|
},
|
|
78
111
|
);
|
|
79
112
|
};
|
|
@@ -86,9 +119,9 @@ export function FileUploadPanel({
|
|
|
86
119
|
for (const file of files) {
|
|
87
120
|
const itemId = nextId();
|
|
88
121
|
const error = !acceptsFile(file, accept)
|
|
89
|
-
? t('upload.typeRejected')
|
|
122
|
+
? (labels?.typeRejected ?? t('upload.typeRejected'))
|
|
90
123
|
: file.size > maxSize
|
|
91
|
-
? t('upload.tooLarge', { size: formatBytes(maxSize) })
|
|
124
|
+
? (labels?.tooLarge?.(formatBytes(maxSize)) ?? t('upload.tooLarge', { size: formatBytes(maxSize) }))
|
|
92
125
|
: undefined;
|
|
93
126
|
added.push({
|
|
94
127
|
id: itemId,
|
|
@@ -107,7 +140,10 @@ export function FileUploadPanel({
|
|
|
107
140
|
setSources((current) => ({ ...current, ...kept }));
|
|
108
141
|
const rejected = added.filter((a) => a.error).length;
|
|
109
142
|
setAnnouncement(
|
|
110
|
-
[
|
|
143
|
+
[
|
|
144
|
+
labels?.added?.(added.length - rejected) ?? t('upload.added', { count: added.length - rejected }),
|
|
145
|
+
rejected ? (labels?.rejected?.(rejected) ?? t('upload.rejected', { count: rejected })) : '',
|
|
146
|
+
]
|
|
111
147
|
.filter(Boolean)
|
|
112
148
|
.join(' '),
|
|
113
149
|
);
|
|
@@ -117,7 +153,7 @@ export function FileUploadPanel({
|
|
|
117
153
|
const remove = (item: UploadItem) => {
|
|
118
154
|
setSources((current) => Object.fromEntries(Object.entries(current).filter(([k]) => k !== item.id)));
|
|
119
155
|
setItems((list) => list.filter((x) => x.id !== item.id));
|
|
120
|
-
setAnnouncement(t('upload.removed', { name: item.name }));
|
|
156
|
+
setAnnouncement(labels?.removed?.(item.name) ?? t('upload.removed', { name: item.name }));
|
|
121
157
|
onRemove?.(item);
|
|
122
158
|
};
|
|
123
159
|
|
|
@@ -154,7 +190,7 @@ export function FileUploadPanel({
|
|
|
154
190
|
<div className="mx-auto grid size-12 place-items-center rounded-2xl bg-secondary/70 text-muted-foreground ring-1 ring-border">
|
|
155
191
|
<Upload size={22} aria-hidden />
|
|
156
192
|
</div>
|
|
157
|
-
<p className="mt-4 text-[13.5px] text-foreground">{t('upload.drop')}</p>
|
|
193
|
+
<p className="mt-4 text-[13.5px] text-foreground">{labels?.drop ?? t('upload.drop')}</p>
|
|
158
194
|
<Button
|
|
159
195
|
variant="secondary"
|
|
160
196
|
size="sm"
|
|
@@ -163,7 +199,7 @@ export function FileUploadPanel({
|
|
|
163
199
|
onClick={() => inputRef.current?.click()}
|
|
164
200
|
aria-describedby={`${id}-hint`}
|
|
165
201
|
>
|
|
166
|
-
{t('upload.browse')}
|
|
202
|
+
{labels?.browse ?? t('upload.browse')}
|
|
167
203
|
</Button>
|
|
168
204
|
<p id={`${id}-hint`} className="mt-3 font-mono text-[11.5px] text-muted-foreground">
|
|
169
205
|
{hintText}
|
|
@@ -182,9 +218,15 @@ export function FileUploadPanel({
|
|
|
182
218
|
/>
|
|
183
219
|
</div>
|
|
184
220
|
{items.length > 0 && (
|
|
185
|
-
<ul aria-label={t('upload.files')} className="mt-4 space-y-2">
|
|
221
|
+
<ul aria-label={labels?.files ?? t('upload.files')} className="mt-4 space-y-2">
|
|
186
222
|
{items.map((item) => (
|
|
187
|
-
<FileRow
|
|
223
|
+
<FileRow
|
|
224
|
+
key={item.id}
|
|
225
|
+
labels={labels}
|
|
226
|
+
item={item}
|
|
227
|
+
onRemove={() => remove(item)}
|
|
228
|
+
onRetry={retryFor(item.id)}
|
|
229
|
+
/>
|
|
188
230
|
))}
|
|
189
231
|
</ul>
|
|
190
232
|
)}
|
|
@@ -195,7 +237,17 @@ export function FileUploadPanel({
|
|
|
195
237
|
);
|
|
196
238
|
}
|
|
197
239
|
|
|
198
|
-
function FileRow({
|
|
240
|
+
function FileRow({
|
|
241
|
+
item,
|
|
242
|
+
onRemove,
|
|
243
|
+
onRetry,
|
|
244
|
+
labels,
|
|
245
|
+
}: {
|
|
246
|
+
item: UploadItem;
|
|
247
|
+
onRemove: () => void;
|
|
248
|
+
onRetry?: () => void;
|
|
249
|
+
labels?: Partial<FileUploadPanelLabels>;
|
|
250
|
+
}) {
|
|
199
251
|
const { t, formatBytes } = useI18n();
|
|
200
252
|
const err = item.status === 'error';
|
|
201
253
|
const done = item.status === 'done';
|
|
@@ -219,14 +271,15 @@ function FileRow({ item, onRemove, onRetry }: { item: UploadItem; onRemove: () =
|
|
|
219
271
|
<Progress
|
|
220
272
|
value={item.progress}
|
|
221
273
|
size="sm"
|
|
222
|
-
aria-label={t('upload.uploading', { name: item.name })}
|
|
274
|
+
aria-label={labels?.uploading?.(item.name) ?? t('upload.uploading', { name: item.name })}
|
|
223
275
|
className="mt-1.5"
|
|
224
276
|
/>
|
|
225
277
|
) : (
|
|
226
278
|
<div className={cn('mt-0.5 font-mono text-[11px]', err ? 'text-destructive-text' : 'text-muted-foreground')}>
|
|
227
279
|
{err
|
|
228
|
-
?
|
|
229
|
-
|
|
280
|
+
? (labels?.notUploaded?.(item.error ?? labels?.failed ?? t('upload.failed')) ??
|
|
281
|
+
t('upload.notUploaded', { error: item.error ?? labels?.failed ?? t('upload.failed') }))
|
|
282
|
+
: (labels?.uploaded?.(formatBytes(item.size)) ?? t('upload.uploaded', { size: formatBytes(item.size) }))}
|
|
230
283
|
</div>
|
|
231
284
|
)}
|
|
232
285
|
</div>
|
|
@@ -236,9 +289,19 @@ function FileRow({ item, onRemove, onRetry }: { item: UploadItem; onRemove: () =
|
|
|
236
289
|
</span>
|
|
237
290
|
)}
|
|
238
291
|
{err && onRetry && (
|
|
239
|
-
<IconButton
|
|
292
|
+
<IconButton
|
|
293
|
+
icon={RotateCcw}
|
|
294
|
+
size="sm"
|
|
295
|
+
label={labels?.retry?.(item.name) ?? t('upload.retry', { name: item.name })}
|
|
296
|
+
onClick={onRetry}
|
|
297
|
+
/>
|
|
240
298
|
)}
|
|
241
|
-
<IconButton
|
|
299
|
+
<IconButton
|
|
300
|
+
icon={X}
|
|
301
|
+
size="sm"
|
|
302
|
+
label={labels?.remove?.(item.name) ?? t('common.removeItem', { label: item.name })}
|
|
303
|
+
onClick={onRemove}
|
|
304
|
+
/>
|
|
242
305
|
</li>
|
|
243
306
|
);
|
|
244
307
|
}
|
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
import type { BlockMeta } from '../../meta';
|
|
2
|
+
import type { FileUploadPanelLabels } from './FileUploadPanel';
|
|
2
3
|
|
|
3
4
|
export const meta: BlockMeta = {
|
|
4
5
|
name: 'File upload panel',
|
|
5
6
|
family: 'forms',
|
|
6
7
|
status: 'stable',
|
|
7
8
|
description:
|
|
8
|
-
'Drag-and-drop zone with a Browse button, type and size validation, and a file list with progress, retry and remove.',
|
|
9
|
+
'Drag-and-drop zone with a Browse button, type and size validation, and a file list with progress, retry and remove. Optional labels?: Partial<FileUploadPanelLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=file-upload-panel--labels.',
|
|
10
|
+
labels: [
|
|
11
|
+
{ key: 'label', type: 'string', state: 'Default content and accessible names' },
|
|
12
|
+
{ key: 'drop', type: 'string', state: 'Default content and accessible names' },
|
|
13
|
+
{ key: 'browse', type: 'string', state: 'Default content and accessible names' },
|
|
14
|
+
{ key: 'files', type: 'string', state: 'Default content and accessible names' },
|
|
15
|
+
{ key: 'failed', type: 'string', state: 'Default content and accessible names' },
|
|
16
|
+
{ key: 'typeRejected', type: 'string', state: 'Default content and accessible names' },
|
|
17
|
+
{ key: 'hint', type: '(types: string, size: string) => string', state: 'Default content and accessible names' },
|
|
18
|
+
{ key: 'tooLarge', type: '(size: string) => string', state: 'Default content and accessible names' },
|
|
19
|
+
{ key: 'done', type: '(name: string) => string', state: 'Async feedback' },
|
|
20
|
+
{ key: 'error', type: '(name: string) => string', state: 'Validation feedback' },
|
|
21
|
+
{ key: 'added', type: '(count: number) => string', state: 'Default content and accessible names' },
|
|
22
|
+
{ key: 'rejected', type: '(count: number) => string', state: 'Default content and accessible names' },
|
|
23
|
+
{ key: 'removed', type: '(name: string) => string', state: 'Default content and accessible names' },
|
|
24
|
+
{ key: 'uploading', type: '(name: string) => string', state: 'Async feedback' },
|
|
25
|
+
{ key: 'notUploaded', type: '(error: string) => string', state: 'Async feedback' },
|
|
26
|
+
{ key: 'uploaded', type: '(size: string) => string', state: 'Async feedback' },
|
|
27
|
+
{ key: 'retry', type: '(name: string) => string', state: 'Default content and accessible names' },
|
|
28
|
+
{ key: 'remove', type: '(name: string) => string', state: 'Default content and accessible names' },
|
|
29
|
+
] satisfies Array<{ key: keyof FileUploadPanelLabels; type: string; state: string }>,
|
|
9
30
|
uses: ['Button', 'IconButton', 'Progress'],
|
|
10
31
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Button, I18nProvider } from '@gntik-ai/ui';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { FileUploadPanel, type FileUploadPanelLabels } from '../FileUploadPanel';
|
|
4
|
+
|
|
5
|
+
export default function Labels() {
|
|
6
|
+
const [spanish, setSpanish] = useState(false);
|
|
7
|
+
const [custom, setCustom] = useState(true);
|
|
8
|
+
const labels: Partial<FileUploadPanelLabels> = {
|
|
9
|
+
label: 'Project documents',
|
|
10
|
+
browse: 'Choose documents',
|
|
11
|
+
drop: 'Drop documents here or',
|
|
12
|
+
done: (name) => `${name} is ready`,
|
|
13
|
+
};
|
|
14
|
+
return (
|
|
15
|
+
<div className="grid gap-4">
|
|
16
|
+
<div className="flex flex-wrap gap-2">
|
|
17
|
+
<Button variant="secondary" aria-pressed={spanish} onClick={() => setSpanish(!spanish)}>
|
|
18
|
+
Spanish catalog
|
|
19
|
+
</Button>
|
|
20
|
+
<Button variant="secondary" aria-pressed={custom} onClick={() => setCustom(!custom)}>
|
|
21
|
+
Custom labels
|
|
22
|
+
</Button>
|
|
23
|
+
</div>
|
|
24
|
+
<I18nProvider locale={spanish ? 'es' : 'en'}>
|
|
25
|
+
<FileUploadPanel labels={custom ? labels : undefined} />
|
|
26
|
+
</I18nProvider>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { I18nProvider, es } from '@gntik-ai/ui';
|
|
3
|
+
import { FormSection } from './FormSection';
|
|
4
|
+
|
|
5
|
+
it('localises defaults while preserving the English sample fields', () => {
|
|
6
|
+
const { rerender } = render(<FormSection />);
|
|
7
|
+
expect(screen.getByRole('region', { name: 'General' })).toBeVisible();
|
|
8
|
+
expect(screen.getByText('Basic details shown to everyone who can access this project.')).toBeVisible();
|
|
9
|
+
rerender(
|
|
10
|
+
<I18nProvider locale="es">
|
|
11
|
+
<FormSection />
|
|
12
|
+
</I18nProvider>,
|
|
13
|
+
);
|
|
14
|
+
expect(screen.getByRole('region', { name: 'General' })).toBeVisible();
|
|
15
|
+
expect(screen.getByText('Datos básicos que ven todos los que tienen acceso a este proyecto.')).toBeVisible();
|
|
16
|
+
expect(screen.getByText(es['formSection.description'])).toBeVisible();
|
|
17
|
+
expect(screen.getByRole('region', { name: es['formSection.title'] })).toBeVisible();
|
|
18
|
+
expect(screen.getByLabelText('Project name')).toHaveValue('billing-dashboard');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it.each(['en', 'es'])('uses explicit props before labels before catalog under %s', (locale) => {
|
|
22
|
+
const labels = { title: 'Custom heading', description: 'Custom help' };
|
|
23
|
+
const { rerender } = render(
|
|
24
|
+
<I18nProvider locale={locale}>
|
|
25
|
+
<FormSection labels={labels} />
|
|
26
|
+
</I18nProvider>,
|
|
27
|
+
);
|
|
28
|
+
expect(screen.getByRole('region', { name: labels.title })).toBeVisible();
|
|
29
|
+
expect(screen.getByText(labels.description)).toBeVisible();
|
|
30
|
+
rerender(
|
|
31
|
+
<I18nProvider locale={locale}>
|
|
32
|
+
<FormSection labels={labels} title="Explicit heading" description="Explicit help" />
|
|
33
|
+
</I18nProvider>,
|
|
34
|
+
);
|
|
35
|
+
expect(screen.getByRole('region', { name: 'Explicit heading' })).toBeVisible();
|
|
36
|
+
expect(screen.getByText('Explicit help')).toBeVisible();
|
|
37
|
+
});
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { Field, FieldDescription, FieldLabel, Input, Textarea, cn } from '@gntik-ai/ui';
|
|
1
|
+
import { useI18n, Field, FieldDescription, FieldLabel, Input, Textarea, cn } from '@gntik-ai/ui';
|
|
2
2
|
import { useId, type HTMLAttributes, type ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
+
export interface FormSectionLabels {
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
4
9
|
export interface FormSectionProps extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'className'> {
|
|
10
|
+
labels?: Partial<FormSectionLabels>;
|
|
5
11
|
/** Section title shown in the left column; also names the section landmark. */
|
|
6
12
|
title?: ReactNode;
|
|
7
13
|
/** Help text under the title. */
|
|
@@ -38,8 +44,9 @@ function SampleFields() {
|
|
|
38
44
|
* single column on small screens.
|
|
39
45
|
*/
|
|
40
46
|
export function FormSection({
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
labels,
|
|
48
|
+
title: titleProp,
|
|
49
|
+
description: descriptionProp,
|
|
43
50
|
children,
|
|
44
51
|
actions,
|
|
45
52
|
headingLevel: Heading = 'h2',
|
|
@@ -47,6 +54,10 @@ export function FormSection({
|
|
|
47
54
|
className,
|
|
48
55
|
...props
|
|
49
56
|
}: FormSectionProps) {
|
|
57
|
+
const { t } = useI18n();
|
|
58
|
+
const title = titleProp === undefined ? (labels?.title ?? t('formSection.title')) : titleProp;
|
|
59
|
+
const description =
|
|
60
|
+
descriptionProp === undefined ? (labels?.description ?? t('formSection.description')) : descriptionProp;
|
|
50
61
|
const id = useId();
|
|
51
62
|
return (
|
|
52
63
|
<section
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { BlockMeta } from '../../meta';
|
|
2
|
+
import type { FormSectionLabels } from './FormSection';
|
|
2
3
|
|
|
3
4
|
export const meta: BlockMeta = {
|
|
4
5
|
name: 'Form section',
|
|
5
6
|
family: 'forms',
|
|
6
7
|
status: 'stable',
|
|
7
|
-
description:
|
|
8
|
+
description:
|
|
9
|
+
'Two-column settings section: title and help on the left, fields on the right; stacks on small screens. Optional labels?: Partial<FormSectionLabels> overrides built-in copy; explicit props and validation messages win, then labels, then I18nProvider (en/es). No provider preserves English; fixtures and caller content stay unchanged. Interactive preview: /preview.html?kind=block&id=form-section--labels.',
|
|
10
|
+
labels: [
|
|
11
|
+
{ key: 'title', type: 'string', state: 'Default content and accessible names' },
|
|
12
|
+
{ key: 'description', type: 'string', state: 'Default content and accessible names' },
|
|
13
|
+
] satisfies Array<{ key: keyof FormSectionLabels; type: string; state: string }>,
|
|
8
14
|
uses: ['Field', 'Input', 'Textarea'],
|
|
9
15
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Button, I18nProvider } from '@gntik-ai/ui';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { FormSection, type FormSectionLabels } from '../FormSection';
|
|
4
|
+
|
|
5
|
+
export default function Labels() {
|
|
6
|
+
const [spanish, setSpanish] = useState(false);
|
|
7
|
+
const [custom, setCustom] = useState(true);
|
|
8
|
+
const labels: Partial<FormSectionLabels> = {
|
|
9
|
+
title: 'Workspace details',
|
|
10
|
+
description: 'Manage your workspace information.',
|
|
11
|
+
};
|
|
12
|
+
return (
|
|
13
|
+
<div className="grid gap-4">
|
|
14
|
+
<div className="flex flex-wrap gap-2">
|
|
15
|
+
<Button variant="secondary" aria-pressed={spanish} onClick={() => setSpanish(!spanish)}>
|
|
16
|
+
Spanish catalog
|
|
17
|
+
</Button>
|
|
18
|
+
<Button variant="secondary" aria-pressed={custom} onClick={() => setCustom(!custom)}>
|
|
19
|
+
Custom labels
|
|
20
|
+
</Button>
|
|
21
|
+
</div>
|
|
22
|
+
<I18nProvider locale={spanish ? 'es' : 'en'}>
|
|
23
|
+
<FormSection labels={custom ? labels : undefined} />
|
|
24
|
+
</I18nProvider>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|