diff --git a/src/components/builder/i18n.stories.tsx b/src/components/builder/i18n.stories.tsx index 33ebb568..781de925 100644 --- a/src/components/builder/i18n.stories.tsx +++ b/src/components/builder/i18n.stories.tsx @@ -3,6 +3,7 @@ import {expect, userEvent, waitFor, within} from '@storybook/test'; import {Formik} from 'formik'; import {TextField} from '@/components/formio'; +import {withFormik} from '@/sb-decorators'; import {ComponentTranslations} from './i18n'; @@ -108,3 +109,26 @@ export const Default: Story = { expect(translationField2).toBeNull(); }, }; + +export const LongStringsWrap: StoryObj> = { + decorators: [withFormik], + args: { + propertyLabels: { + label: 'Label', + }, + }, + parameters: { + formik: { + initialValues: { + label: Array(100).fill('a').join(''), + openForms: { + translations: { + nl: { + label: 'Insgelijks', + }, + }, + }, + }, + }, + }, +}; diff --git a/src/components/builder/i18n.tsx b/src/components/builder/i18n.tsx index 767ca12d..50b10d85 100644 --- a/src/components/builder/i18n.tsx +++ b/src/components/builder/i18n.tsx @@ -12,6 +12,7 @@ import {AnyComponentSchema} from '@/types/schemas'; import {Component, TextField} from '../formio'; import ComponentLabel from '../formio/component-label'; import './i18n.scss'; +import './table.scss'; type ExtractTranslatableProperties = T extends OFExtensions ? TK : never; type StringValueProperties = S extends AnyComponentSchema @@ -53,10 +54,13 @@ export function ComponentTranslations({ return ( - +
- - - - - diff --git a/src/components/builder/table.scss b/src/components/builder/table.scss new file mode 100644 index 00000000..1ae04bd8 --- /dev/null +++ b/src/components/builder/table.scss @@ -0,0 +1,21 @@ +.offb-table { + // Ensures that the column widths are respected + table-layout: fixed; + width: 100%; + + &__content { + &--allow-break { + overflow-wrap: break-word; + hyphens: auto; + } + } + + &__col { + &--width-25 { + width: 25%; + } + &--width-50 { + width: 50%; + } + } +} diff --git a/src/components/builder/values/i18n.tsx b/src/components/builder/values/i18n.tsx index 64f6e62d..4c65efba 100644 --- a/src/components/builder/values/i18n.tsx +++ b/src/components/builder/values/i18n.tsx @@ -45,10 +45,20 @@ export function ValuesTranslations({name, withOptionDescription}: ValuesTrans <>
+ ({ })} /> +
    {supportedLanguageCodes.map(code => (
  • @@ -92,19 +96,19 @@ export function ComponentTranslations({
+ + + ({ -
+
{(values?.[property] || '-') as string}
- {label} + + {label} + -
{value || '-'}
+
+ {value || '-'} +
({name, withOptionDescription}: ValuesTrans description="Label for option description location" defaultMessage="Option description ()" values={{ - option: () => {value || '-'}, + option: () => ( + + {value || '-'} + + ), }} /> -
{description || '-'}
+
+ {description || '-'} +