diff --git a/Documentation/ComponentPicker/index.md b/Documentation/ComponentPicker/index.md index 62565666..56e4bdff 100644 --- a/Documentation/ComponentPicker/index.md +++ b/Documentation/ComponentPicker/index.md @@ -139,6 +139,11 @@ Components with descriptors today: | `Tag` | `Tag` | `severity`, `rounded` | | `Skeleton` | `Skeleton` | `width`, `height`, `borderRadius`, `circle` | | `ProgressSpinner` | `ProgressSpinner` | `aria-label` | +| `Breadcrumbs` | `Breadcrumbs` | `aria-label` | +| `Message` | `Message` | `severity` | +| `Toolbar` | `Toolbar` | `orientation`, `aria-label` | +| `ToolbarGroup` | `ToolbarGroup` | `orientation` | +| `ToolbarSeparator` | `ToolbarSeparator` | `orientation` | | `TextInput` | `TextInput` | `placeholder`, `invalid`, `disabled`, `readOnly`, `type` | | `TextArea` | `TextArea` | `placeholder`, `rows`, `invalid`, `disabled`, `readOnly` | | `Dialog` | `Dialog` | `title`, `placement`, `width`, `okLabel`, `cancelLabel` | diff --git a/Source/Common/Breadcrumbs.tsx b/Source/Common/Breadcrumbs.tsx index db59a4d7..e8139746 100644 --- a/Source/Common/Breadcrumbs.tsx +++ b/Source/Common/Breadcrumbs.tsx @@ -10,6 +10,8 @@ import { import type { ExactPartKeys } from '../types/ExactPartKeys'; import type { PartsOf } from '../types/parts'; import { classNames } from '../ClassNames/classNames'; +import { describeComponent } from '../configuration/identity/describeComponent'; +import { useComponentPresentation } from '../configuration/identity/useComponentPresentation'; /** Attributes a consumer may hand to one {@link Breadcrumbs} part: class, style, title and data attributes. */ export type BreadcrumbsPartAttributes = Pick< @@ -61,6 +63,10 @@ export interface BreadcrumbsProps { pt?: BreadcrumbsParts; } +const breadcrumbsDescriptor = describeComponent('Breadcrumbs', [ + { name: 'aria-label', label: 'Accessible label', type: 'string' }, +]); + /** * A breadcrumb trail. * @@ -69,66 +75,64 @@ export interface BreadcrumbsProps { * a destination. The trail is an ordered list inside a navigation landmark, so it can be jumped to * and its length announced. */ -export const Breadcrumbs = ({ - items, - separator = '/', - 'aria-label': ariaLabel, - className, - pt, -}: BreadcrumbsProps) => ( - // React Aria renders the ordered list; the navigation landmark around it is ours, because a - // trail a screen-reader user cannot jump to is only a list of links. - + ); +}; diff --git a/Source/ComponentPicker/for_ComponentPicker/given/common_and_toolbar_components.tsx b/Source/ComponentPicker/for_ComponentPicker/given/common_and_toolbar_components.tsx new file mode 100644 index 00000000..d25c447b --- /dev/null +++ b/Source/ComponentPicker/for_ComponentPicker/given/common_and_toolbar_components.tsx @@ -0,0 +1,96 @@ +// Copyright (c) Cratis. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +import React, { type ReactElement } from 'react'; +import { Breadcrumbs } from '../../../Common/Breadcrumbs'; +import { Message } from '../../../Display/Message'; +import { Toolbar } from '../../../Toolbar/Toolbar'; +import { ToolbarGroup } from '../../../Toolbar/ToolbarGroup'; +import { ToolbarSeparator } from '../../../Toolbar/ToolbarSeparator'; +import type { PresentationPropertyDescriptor } from '../../../configuration/identity/PresentationPropertyDescriptor'; +import type { PresentationPropertyValue } from '../../../configuration/identity/PresentationPropertyValue'; + +interface PresentationComponentCase { + component: string; + element: ReactElement; + defaults: ReactElement; + properties: readonly PresentationPropertyDescriptor>[]; + current: Record; + preview: Record; + read: (element: HTMLElement) => unknown; + rendered: unknown; + previewed: unknown; + defaultRendered: unknown; +} + +export const commonAndToolbarComponents: readonly PresentationComponentCase[] = [ + { + component: 'Breadcrumbs', + element: Example Project }]} separator={›} />, + defaults: , + properties: [{ name: 'aria-label', label: 'Accessible label', type: 'string' }], + current: { 'aria-label': 'Example trail' }, + preview: { 'aria-label': 'Preview trail' }, + read: (element) => element.parentElement!.getAttribute('aria-label'), + rendered: 'Example trail', + previewed: 'Preview trail', + defaultRendered: null, + }, + { + component: 'Message', + element: Example status} />, + defaults: , + properties: [ + { name: 'severity', label: 'Severity', type: 'enum', values: ['info', 'success', 'warn', 'error', 'secondary', 'contrast'], defaultValue: 'info' }, + ], + current: { severity: 'info' }, + preview: { severity: 'error' }, + read: (element) => [element.dataset.severity, element.getAttribute('role'), element.querySelector('[data-cratis-part="icon"]')!.textContent], + rendered: ['info', 'status', 'ⓘ'], + previewed: ['error', 'alert', '⨯'], + defaultRendered: ['info', 'status', 'ⓘ'], + }, + { + component: 'Toolbar', + element: Example tool, + defaults: Example tool, + properties: [ + { name: 'orientation', label: 'Orientation', type: 'enum', values: ['vertical', 'horizontal'], defaultValue: 'vertical' }, + { name: 'aria-label', label: 'Accessible label', type: 'string' }, + ], + current: { orientation: 'horizontal', 'aria-label': 'Example tools' }, + preview: { orientation: 'vertical', 'aria-label': 'Preview tools' }, + read: (element) => [element.dataset.orientation, element.getAttribute('aria-orientation'), element.getAttribute('aria-label'), element.classList.contains('cratis:flex-row')], + rendered: ['horizontal', 'horizontal', 'Example tools', true], + previewed: ['vertical', 'vertical', 'Preview tools', false], + defaultRendered: ['vertical', 'vertical', 'Tools', false], + }, + { + component: 'ToolbarGroup', + element: Example tool, + defaults: , + properties: [ + { name: 'orientation', label: 'Orientation', type: 'enum', values: ['vertical', 'horizontal'], defaultValue: 'vertical' }, + ], + current: { orientation: 'horizontal' }, + preview: { orientation: 'vertical' }, + read: (element) => [element.dataset.orientation, element.classList.contains('cratis:flex-row')], + rendered: ['horizontal', true], + previewed: ['vertical', false], + defaultRendered: ['vertical', false], + }, + { + component: 'ToolbarSeparator', + element: , + defaults: , + properties: [ + { name: 'orientation', label: 'Orientation', type: 'enum', values: ['vertical', 'horizontal'], defaultValue: 'vertical' }, + ], + current: { orientation: 'horizontal' }, + preview: { orientation: 'vertical' }, + read: (element) => [element.dataset.orientation, element.getAttribute('aria-orientation'), element.classList.contains('toolbar-separator--in-horizontal')], + rendered: ['horizontal', 'vertical', true], + previewed: ['vertical', 'horizontal', false], + defaultRendered: ['vertical', 'horizontal', false], + }, +]; diff --git a/Source/ComponentPicker/for_ComponentPicker/when_picking_common_and_toolbar_components.tsx b/Source/ComponentPicker/for_ComponentPicker/when_picking_common_and_toolbar_components.tsx new file mode 100644 index 00000000..1f728943 --- /dev/null +++ b/Source/ComponentPicker/for_ComponentPicker/when_picking_common_and_toolbar_components.tsx @@ -0,0 +1,90 @@ +// Copyright (c) Cratis. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// @vitest-environment jsdom + +import React, { act } from 'react'; +import { + knownComponentDescriptors, + previewPresentationChanges, + registeredComponentFor, +} from '../../configuration/identity/componentInstances'; +import type { PresentationChange } from '../../configuration/identity/PresentationChange'; +import { describeComponentElement } from '../describeComponentElement'; +import { commonAndToolbarComponents } from './given/common_and_toolbar_components'; +import { click, hover, mountScreen, startPicking, unmountScreen, type ScreenInTheDom } from './given/a_screen_in_the_dom'; + +for (const example of commonAndToolbarComponents) { + describe(`when picking a ${example.component}`, () => { + let screen: ScreenInTheDom; + let element: HTMLElement; + + beforeEach(async () => { + screen = await mountScreen(<>{example.element}{example.element}); + element = screen.container.querySelector(`[data-cratis-component="${example.component}"]`)!; + }); + + afterEach(async () => { + screen.picker().cancel(); + await unmountScreen(screen); + }); + + it('should register only its typed presentation properties and allowed values', () => { + registeredComponentFor(element)!.descriptor.properties.should.deep.equal(example.properties); + }); + + it('should make its static descriptor discoverable', () => { + knownComponentDescriptors().find((descriptor) => descriptor.component === example.component)! + .should.equal(registeredComponentFor(element)!.descriptor); + }); + + it('should report current values through the picker', async () => { + const pending = await startPicking(screen); + await hover(element); + await click(element); + const picked = (await pending.result)!; + picked.component.should.equal(example.component); + picked.presentationProperties.map(({ name, value, editable }) => ({ name, value, editable })) + .should.deep.equal(Object.entries(example.current).map(([name, value]) => ({ name, value, editable: true }))); + }); + + it('should read registered values rather than DOM attributes', () => { + element.setAttribute('data-orientation', 'DOM-only'); + element.setAttribute('data-severity', 'DOM-only'); + element.setAttribute('aria-label', 'DOM-only'); + Object.fromEntries(describeComponentElement(element).presentationProperties.map(({ name, value }) => [name, value])) + .should.deep.equal(example.current); + }); + + it('should preview and revert without changing registered props or another instance', async () => { + const changes: PresentationChange[] = Object.entries(example.preview).map(([property, to]) => ({ + property, from: example.current[property], to, + })); + const original = registeredComponentFor(element)!.props; + const other = screen.container.querySelectorAll(`[data-cratis-component="${example.component}"]`)[1]; + let revert!: () => void; + [example.read(element)].should.deep.equal([example.rendered]); + await act(async () => { revert = previewPresentationChanges(element, changes); }); + [example.read(element)].should.deep.equal([example.previewed]); + [example.read(other)].should.deep.equal([example.rendered]); + registeredComponentFor(element)!.props.should.equal(original); + Object.fromEntries(describeComponentElement(element).presentationProperties.map(({ name, value }) => [name, value])) + .should.deep.equal(example.current); + await act(async () => { revert(); revert(); }); + [example.read(element)].should.deep.equal([example.rendered]); + }); + + it('should preserve defaults while reporting unset props as editable', async () => { + await act(async () => screen.root.render(example.defaults)); + const defaultElement = screen.container.querySelector(`[data-cratis-component="${example.component}"]`)!; + [example.read(defaultElement)].should.deep.equal([example.defaultRendered]); + describeComponentElement(defaultElement).presentationProperties.map(({ name, value, editable }) => ({ name, value, editable })) + .should.deep.equal(example.properties.map(({ name }) => ({ name, value: undefined, editable: true }))); + }); + + it('should unregister when unmounted', async () => { + await act(async () => screen.root.render(<>)); + [registeredComponentFor(element)].should.deep.equal([undefined]); + }); + }); +} diff --git a/Source/ComponentPicker/for_ComponentPicker/when_previewing_common_and_toolbar_presentation.tsx b/Source/ComponentPicker/for_ComponentPicker/when_previewing_common_and_toolbar_presentation.tsx new file mode 100644 index 00000000..6350d7da --- /dev/null +++ b/Source/ComponentPicker/for_ComponentPicker/when_previewing_common_and_toolbar_presentation.tsx @@ -0,0 +1,94 @@ +// Copyright (c) Cratis. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// @vitest-environment jsdom + +import React, { act } from 'react'; +import { Breadcrumbs } from '../../Common/Breadcrumbs'; +import { CratisComponentsProvider } from '../../Common/CratisComponentsProvider'; +import { Message } from '../../Display/Message'; +import { Toolbar } from '../../Toolbar/Toolbar'; +import { previewPresentationChanges } from '../../configuration/identity/componentInstances'; +import { mountScreen, unmountScreen, type ScreenInTheDom } from './given/a_screen_in_the_dom'; + +const key = async (element: Element, name: string) => { + await act(async () => { + element.dispatchEvent(new KeyboardEvent('keydown', { key: name, bubbles: true, cancelable: true })); + }); +}; + +describe('when previewing common and toolbar presentation details', () => { + let screen: ScreenInTheDom; + + afterEach(async () => { await unmountScreen(screen); }); + + it('should preserve opted-out live regions and hidden icons when previewing message severity', async () => { + screen = await mountScreen(Example status); + const element = screen.container.querySelector('[data-cratis-component="Message"]')!; + let revert!: () => void; + await act(async () => { + revert = previewPresentationChanges(element, [{ property: 'severity', from: 'error', to: 'info' }]); + }); + element.dataset.severity!.should.equal('info'); + [element.getAttribute('role'), element.querySelector('[data-cratis-part="icon"]')].should.deep.equal([null, null]); + element.querySelector('strong')!.textContent!.should.equal('Example status'); + await act(async () => revert()); + element.dataset.severity!.should.equal('error'); + [element.getAttribute('role')].should.deep.equal([null]); + }); + + it('should preserve breadcrumb content and destinations when previewing the landmark name', async () => { + screen = await mountScreen(›} items={[ + { label: Example Project, href: 'https://example.invalid/project' }, + { label: 'Example page' }, + ]} />); + const element = screen.container.querySelector('[data-cratis-component="Breadcrumbs"]')!; + let revert!: () => void; + await act(async () => { + revert = previewPresentationChanges(element, [{ property: 'aria-label', from: 'Example trail', to: 'Preview trail' }]); + }); + element.parentElement!.getAttribute('aria-label')!.should.equal('Preview trail'); + element.querySelector('a')!.getAttribute('href')!.should.equal('https://example.invalid/project'); + element.querySelector('strong')!.textContent!.should.equal('Example Project'); + element.querySelector('[aria-current="page"]')!.textContent!.should.equal('Example page'); + element.querySelector('[data-cratis-part="separator"]')!.textContent!.should.equal('›'); + await act(async () => revert()); + element.parentElement!.getAttribute('aria-label')!.should.equal('Example trail'); + }); + + it('should restore the provider toolbar name after reverting a label preview', async () => { + screen = await mountScreen( + + + + , + ); + const elements = screen.container.querySelectorAll('[data-cratis-component="Toolbar"]'); + let revert!: () => void; + await act(async () => { + revert = previewPresentationChanges(elements[0], [{ property: 'aria-label', from: undefined, to: 'Preview tools' }]); + previewPresentationChanges(elements[1], [{ property: 'aria-label', from: undefined, to: 'Preview tools' }]); + }); + elements[0].getAttribute('aria-label')!.should.equal('Preview tools'); + [elements[1].getAttribute('aria-label')].should.deep.equal([null]); + elements[1].getAttribute('aria-labelledby')!.should.equal('example-heading'); + await act(async () => revert()); + elements[0].getAttribute('aria-label')!.should.equal('Example tools'); + }); + + it('should keep toolbar keyboard navigation aligned with the previewed orientation', async () => { + screen = await mountScreen(); + const element = screen.container.querySelector('[data-cratis-component="Toolbar"]')!; + const [first, second] = element.querySelectorAll('button'); + let revert!: () => void; + await act(async () => { + revert = previewPresentationChanges(element, [{ property: 'orientation', from: undefined, to: 'horizontal' }]); + first.focus(); + }); + await key(first, 'ArrowRight'); + (document.activeElement === second).should.equal(true); + await act(async () => { revert(); first.focus(); }); + await key(first, 'ArrowDown'); + (document.activeElement === second).should.equal(true); + }); +}); diff --git a/Source/Display/Message.tsx b/Source/Display/Message.tsx index 077428db..ab4ea5f6 100644 --- a/Source/Display/Message.tsx +++ b/Source/Display/Message.tsx @@ -2,6 +2,8 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. import type { ReactNode } from 'react'; +import { describeComponent } from '../configuration/identity/describeComponent'; +import { useComponentPresentation } from '../configuration/identity/useComponentPresentation'; /** Severity tone of a {@link Message}. */ export type MessageSeverity = @@ -37,33 +39,34 @@ const severitySymbols: Record = { contrast: 'ⓘ', }; +const messageDescriptor = describeComponent('Message', [ + { name: 'severity', label: 'Severity', type: 'enum', values: ['info', 'success', 'warn', 'error', 'secondary', 'contrast'] satisfies NonNullable[], defaultValue: 'info' }, +]); + /** A declarative inline status message. */ -export const Message = ({ - severity = 'info', - text, - children, - className, - icon, - live = true, -}: MessageProps) => ( -
- {icon !== false && ( -
+ ); +}; diff --git a/Source/ObjectContentEditor/ObjectContentEditor.tsx b/Source/ObjectContentEditor/ObjectContentEditor.tsx index 78cb25de..8ec4833d 100644 --- a/Source/ObjectContentEditor/ObjectContentEditor.tsx +++ b/Source/ObjectContentEditor/ObjectContentEditor.tsx @@ -1,16 +1,15 @@ // Copyright (c) Cratis. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -import { Tooltip } from '../Common/Tooltip'; -import React, { useState, useCallback, useMemo, useEffect } from 'react'; -import * as faIcons from 'react-icons/fa6'; +import React, { useState, useCallback } from 'react'; import { ObjectNavigationalBar } from '../ObjectNavigationalBar'; import type { ChangeHandler } from '../types/ChangeHandler'; import type { ChangeMeta } from '../types/ChangeMeta'; import type { Json, JsonSchema, JsonSchemaProperty } from '../types/JsonSchema'; -import { getValueAtPath } from './objectHelpers'; - -import { DatePickerInput } from '../Common/DatePickerInput'; +import { renderEditField } from './editField'; +import { renderTable } from './table'; +import { useNavigation } from './useNavigation'; +import { useValidation } from './useValidation'; /** * Props for {@link ObjectContentEditor}. @@ -77,170 +76,14 @@ export const ObjectContentEditor = ({ onChange, onValidationChange, className, -}: ObjectContentEditorProps) => { +}: ObjectContentEditorProps): React.JSX.Element => { const [navigationPath, setNavigationPath] = useState([]); - const [validationErrors, setValidationErrors] = useState>({}); - - const validateValue = useCallback( - ( - propertyName: string, - value: Json, - property: JsonSchemaProperty, - ): string | undefined => { - if (editMode) { - if (value === null || value === undefined || value === '') { - return 'This field is required'; - } - } else { - const isRequired = schema.required?.includes(propertyName); - if ( - isRequired && - (value === null || value === undefined || value === '') - ) { - return 'This field is required'; - } - } - - if (property.type === 'string' && typeof value === 'string') { - if ( - property.format === 'email' && - value && - !value.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/) - ) { - return 'Invalid email format'; - } - if ( - property.format === 'uri' && - value && - !value.match(/^https?:\/\/.+/) - ) { - return 'Invalid URI format'; - } - } - - if (property.type === 'number' || property.type === 'integer') { - if ( - value !== null && - value !== undefined && - value !== '' && - isNaN(Number(value)) - ) { - return 'Must be a valid number'; - } - } - - return undefined; - }, - [schema, editMode], - ); - - useEffect(() => { - if (!editMode || navigationPath.length > 0) return; - - const errors: Record = {}; - const properties = schema.properties || {}; - - Object.entries(properties).forEach(([propertyName, property]) => { - const value = (object as Record)[propertyName]; - const error = validateValue( - propertyName, - value, - property as JsonSchemaProperty, - ); - if (error) { - errors[propertyName] = error; - } - }); - - setValidationErrors(errors); - }, [object, schema, editMode, navigationPath, validateValue]); - - useEffect(() => { - if (editMode && onValidationChange) { - const hasErrors = Object.keys(validationErrors).length > 0; - onValidationChange(hasErrors); - } - }, [validationErrors, editMode, onValidationChange]); - - const navigateTo = useCallback( - (segments: string[]) => { - setNavigationPath([...navigationPath, ...segments]); - }, - [navigationPath], - ); - - const navigateToBreadcrumb = useCallback( - (index: number) => { - if (index === 0) { - setNavigationPath([]); - } else { - setNavigationPath(navigationPath.slice(0, index)); - } - }, - [navigationPath], - ); - - const currentData = useMemo(() => { - if (navigationPath.length === 0) { - return object; - } - - const value = getValueAtPath(object, navigationPath); - return value !== null && typeof value === 'object' ? value : null; - }, [object, navigationPath]); - - useEffect(() => { - if (navigationPath.length > 0 && currentData === null) { - setNavigationPath([]); - } - }, [currentData, navigationPath]); - - const currentProperties = useMemo(() => { - const properties = schema.properties || {}; - - if (navigationPath.length === 0) { - return properties; - } - - return {}; - }, [schema, navigationPath]); - - const tableStyle: React.CSSProperties = { - width: '100%', - borderCollapse: 'collapse', - fontFamily: '-apple-system, BlinkMacSystemFont, "SF Mono", monospace', - fontSize: '13px', - }; - - const rowStyle: React.CSSProperties = { - borderBottom: '1px solid var(--cratis-surface-border)', - }; - - const labelStyle: React.CSSProperties = { - padding: '8px 12px', - color: 'var(--cratis-text-color-secondary)', - textAlign: 'left', - fontWeight: 500, - width: '140px', - whiteSpace: 'nowrap', - }; - - const valueStyle: React.CSSProperties = { - padding: '8px 12px', - color: 'var(--cratis-text-color)', - textAlign: 'left', - }; - - const infoIconStyle: React.CSSProperties = { - fontSize: '0.875rem', - color: 'var(--cratis-text-color-secondary)', - flexShrink: 0, - }; - - const fieldErrorStyle: React.CSSProperties = { - color: 'var(--cratis-red-500)', - fontSize: '0.75rem', - }; + const { validationErrors, validateChange } = useValidation({ + object, schema, editMode, navigationPath, onValidationChange, + }); + const { navigateTo, navigateToBreadcrumb, currentData, currentProperties } = useNavigation({ + object, schema, navigationPath, setNavigationPath, + }); const updateValue = useCallback( (propertyName: string, newValue: Json, meta: ChangeMeta) => { @@ -253,410 +96,20 @@ export const ObjectContentEditor = ({ [object, onChange], ); - const renderEditField = ( + const renderEditableValue = ( propertyName: string, property: JsonSchemaProperty, value: Json, - ) => { - const error = validationErrors[propertyName]; - - const handleChange = (newValue: Json, meta: ChangeMeta) => { + ) => renderEditField({ + propertyName, + property, + value, + error: validationErrors[propertyName], + handleChange: (newValue, meta) => { updateValue(propertyName, newValue, meta); - const validationError = validateValue(propertyName, newValue, property); - setValidationErrors((prev) => { - const newErrors = { ...prev }; - if (validationError) { - newErrors[propertyName] = validationError; - } else { - delete newErrors[propertyName]; - } - return newErrors; - }); - }; - - if (property.type === 'boolean') { - return ( -
- - handleChange(event.target.checked, { - source: 'user', - nativeEvent: event.nativeEvent, - }) - } - aria-invalid={Boolean(error) || undefined} - className='cratis:size-5 cratis:accent-[var(--cratis-primary-color)]' - /> - {error && {error}} -
- ); - } - - if (property.type === 'number' || property.type === 'integer') { - return ( -
- - handleChange( - event.target.value === '' - ? null - : event.target.valueAsNumber, - { - source: 'user', - nativeEvent: event.nativeEvent, - }, - ) - } - aria-invalid={Boolean(error) || undefined} - className='cratis-field-input cratis:w-full' - /> - {error && {error}} -
- ); - } - - if (property.type === 'string' && property.format === 'date-time') { - const dateValue = value ? new Date(value as string) : null; - return ( -
- - handleChange( - date ? date.toISOString() : null, - meta ?? { source: 'user' }, - ) - } - showTime - showIcon - invalid={!!error} - /> - {error && {error}} -
- ); - } - - if (property.type === 'string' && property.format === 'date') { - const dateValue = value ? new Date(value as string) : null; - return ( -
- - handleChange( - date ? date.toISOString().split('T')[0] : null, - meta ?? { source: 'user' }, - ) - } - showIcon - invalid={!!error} - /> - {error && {error}} -
- ); - } - - if (property.type === 'array') { - return ( -
- Array editing not yet supported -
- ); - } - - if (property.type === 'object') { - return ( -
- Object editing not yet supported -
- ); - } - - const isLongText = (value as string)?.length > 50; - - if (isLongText) { - return ( -
-