Skip to content

Commit eb735db

Browse files
authored
Add displayMode to fields.text in fields-document (#9586)
1 parent bb14b48 commit eb735db

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

Diff for: packages/fields-document/src/DocumentEditor/component-blocks/api.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
Checkbox,
2424
Text,
2525
TextField,
26+
TextArea,
2627
} from '#fields-ui'
2728

2829
export * from './api-shared'
@@ -37,13 +38,25 @@ export const fields = {
3738
text({
3839
label,
3940
defaultValue = '',
41+
displayMode,
4042
}: {
4143
label: string
4244
defaultValue?: string
45+
displayMode?: 'input' | 'textarea'
4346
}): FormField<string, undefined> {
4447
return {
4548
kind: 'form' as const,
4649
Input({ value, onChange, autoFocus }: InputArgs<string>) {
50+
if (displayMode === 'textarea') {
51+
return (
52+
<TextArea
53+
autoFocus={autoFocus}
54+
label={label}
55+
onChange={x => onChange?.(x)}
56+
value={value}
57+
/>
58+
)
59+
}
4760
return (
4861
<TextField
4962
autoFocus={autoFocus}

Diff for: packages/fields-document/src/DocumentEditor/component-blocks/fields-ui-empty.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ function throwAlways(): never {
55
}
66

77
export const TextField = throwAlways,
8+
TextArea = throwAlways,
89
Checkbox = throwAlways,
910
Text = throwAlways,
1011
makeIntegerFieldInput = () => throwAlways,

Diff for: packages/fields-document/src/DocumentEditor/component-blocks/fields-ui.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { VStack } from '@keystar/ui/layout'
1212
import { TagGroup } from '@keystar/ui/tag'
1313
import { Text } from '@keystar/ui/typography'
1414

15-
export { TextField } from '@keystar/ui/text-field'
15+
export { TextField, TextArea } from '@keystar/ui/text-field'
1616
export { Text } from '@keystar/ui/typography'
1717
export { Checkbox } from '@keystar/ui/checkbox'
1818

0 commit comments

Comments
 (0)