@firecms/core 3.0.0-canary.105 → 3.0.0-canary.107
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/form/PropertyFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MultiSelectBinding.d.ts +1 -1
- package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
- package/dist/index.es.js +50 -38
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +50 -38
- package/dist/index.umd.js.map +1 -1
- package/dist/preview/PropertyPreviewProps.d.ts +1 -1
- package/dist/preview/components/EnumValuesChip.d.ts +1 -1
- package/dist/types/fields.d.ts +8 -0
- package/package.json +5 -5
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +1 -1
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +1 -1
- package/src/components/EntityPreview.tsx +7 -7
- package/src/form/PropertyFieldBinding.tsx +11 -4
- package/src/form/field_bindings/MultiSelectBinding.tsx +2 -0
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +3 -3
- package/src/form/field_bindings/SelectFieldBinding.tsx +5 -3
- package/src/form/field_bindings/SwitchFieldBinding.tsx +2 -2
- package/src/form/field_bindings/TextFieldBinding.tsx +3 -1
- package/src/preview/PropertyPreviewProps.tsx +1 -1
- package/src/preview/components/BooleanPreview.tsx +1 -1
- package/src/preview/components/EnumValuesChip.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +1 -1
- package/src/preview/components/UrlComponentPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +1 -1
- package/src/preview/property_previews/MapPropertyPreview.tsx +1 -1
- package/src/preview/property_previews/SkeletonPropertyComponent.tsx +2 -2
- package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
- package/src/preview/util.ts +2 -2
- package/src/types/fields.tsx +10 -0
|
@@ -3,7 +3,7 @@ import { EnumValues } from "../../types";
|
|
|
3
3
|
export interface EnumValuesChipProps {
|
|
4
4
|
enumValues?: EnumValues;
|
|
5
5
|
enumKey: string | number;
|
|
6
|
-
size: "
|
|
6
|
+
size: "smallest" | "small" | "medium";
|
|
7
7
|
className?: string;
|
|
8
8
|
children?: React.ReactNode;
|
|
9
9
|
}
|
package/dist/types/fields.d.ts
CHANGED
|
@@ -86,6 +86,10 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
86
86
|
* Flag to indicate if this field should be disabled
|
|
87
87
|
*/
|
|
88
88
|
disabled?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Size of the field
|
|
91
|
+
*/
|
|
92
|
+
size?: "smallest" | "small" | "medium";
|
|
89
93
|
}
|
|
90
94
|
/**
|
|
91
95
|
* Context passed to custom fields
|
|
@@ -175,4 +179,8 @@ export interface PropertyFieldBindingProps<T extends CMSType, M extends Record<s
|
|
|
175
179
|
* Only used when the field is part of an array.
|
|
176
180
|
*/
|
|
177
181
|
index?: number;
|
|
182
|
+
/**
|
|
183
|
+
* The size of the field
|
|
184
|
+
*/
|
|
185
|
+
size?: "smallest" | "small" | "medium";
|
|
178
186
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-canary.
|
|
4
|
+
"version": "3.0.0-canary.107",
|
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"./package.json": "./package.json"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@firecms/editor": "^3.0.0-canary.
|
|
50
|
-
"@firecms/formex": "^3.0.0-canary.
|
|
51
|
-
"@firecms/ui": "^3.0.0-canary.
|
|
49
|
+
"@firecms/editor": "^3.0.0-canary.107",
|
|
50
|
+
"@firecms/formex": "^3.0.0-canary.107",
|
|
51
|
+
"@firecms/ui": "^3.0.0-canary.107",
|
|
52
52
|
"@hello-pangea/dnd": "^16.6.0",
|
|
53
53
|
"@radix-ui/react-portal": "^1.1.1",
|
|
54
54
|
"clsx": "^2.1.1",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"dist",
|
|
101
101
|
"src"
|
|
102
102
|
],
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "07f66833d1cc898c000b92029a8c33992a1dea55",
|
|
104
104
|
"publishConfig": {
|
|
105
105
|
"access": "public"
|
|
106
106
|
},
|
|
@@ -124,7 +124,7 @@ export const TableReferenceFieldSuccess = React.memo(
|
|
|
124
124
|
key={`preview_array_ref_${name}_${index}`}>
|
|
125
125
|
<ReferencePreview
|
|
126
126
|
onClick={disabled ? undefined : handleOpen}
|
|
127
|
-
size={"
|
|
127
|
+
size={"smallest"}
|
|
128
128
|
reference={reference}
|
|
129
129
|
hover={!disabled}
|
|
130
130
|
disabled={!path}
|
|
@@ -77,17 +77,17 @@ export function EntityPreview({
|
|
|
77
77
|
hover={disabled ? undefined : hover}
|
|
78
78
|
size={size}>
|
|
79
79
|
{imageProperty && (
|
|
80
|
-
<div className={cls("w-10 h-10 mr-2 shrink-0 grow-0", size === "
|
|
80
|
+
<div className={cls("w-10 h-10 mr-2 shrink-0 grow-0", size === "smallest" ? "my-0.5" : "m-2 self-start")}>
|
|
81
81
|
<PropertyPreview property={imageProperty}
|
|
82
82
|
propertyKey={imagePropertyKey as string}
|
|
83
|
-
size={"
|
|
83
|
+
size={"smallest"}
|
|
84
84
|
value={getValueInPath(entity.values, imagePropertyKey as string)}/>
|
|
85
85
|
</div>
|
|
86
86
|
)}
|
|
87
87
|
|
|
88
88
|
<div className={"flex flex-col flex-grow w-full m-1"}>
|
|
89
89
|
|
|
90
|
-
{size !== "
|
|
90
|
+
{size !== "smallest" && includeId && (
|
|
91
91
|
entity
|
|
92
92
|
? <div className={`${
|
|
93
93
|
size !== "medium"
|
|
@@ -131,10 +131,10 @@ export function EntityPreview({
|
|
|
131
131
|
propertyKey={key as string}
|
|
132
132
|
value={getValueInPath(entity.values, key)}
|
|
133
133
|
property={childProperty as ResolvedProperty}
|
|
134
|
-
size={"
|
|
134
|
+
size={"smallest"}/>
|
|
135
135
|
: <SkeletonPropertyComponent
|
|
136
136
|
property={childProperty as ResolvedProperty}
|
|
137
|
-
size={"
|
|
137
|
+
size={"smallest"}/>
|
|
138
138
|
}
|
|
139
139
|
</div>
|
|
140
140
|
);
|
|
@@ -144,7 +144,7 @@ export function EntityPreview({
|
|
|
144
144
|
|
|
145
145
|
{entity && includeEntityLink &&
|
|
146
146
|
<Tooltip title={`See details for ${entity.id}`}
|
|
147
|
-
className={size !== "
|
|
147
|
+
className={size !== "smallest" ? "self-start" : ""}>
|
|
148
148
|
<IconButton
|
|
149
149
|
color={"inherit"}
|
|
150
150
|
size={"small"}
|
|
@@ -203,7 +203,7 @@ const EntityPreviewContainerInner = React.forwardRef<HTMLDivElement, EntityPrevi
|
|
|
203
203
|
fullwidth ? "w-full" : "",
|
|
204
204
|
"items-center",
|
|
205
205
|
hover ? "hover:bg-slate-50 dark:hover:bg-gray-800 group-hover:bg-slate-50 dark:group-hover:bg-gray-800" : "",
|
|
206
|
-
size === "
|
|
206
|
+
size === "smallest" ? "p-1" : "p-2",
|
|
207
207
|
"flex border rounded-lg",
|
|
208
208
|
onClick ? "cursor-pointer" : "",
|
|
209
209
|
defaultBorderMixin,
|
|
@@ -54,6 +54,10 @@ export const PropertyFieldBinding = React.memo(PropertyFieldBindingInternal, (a:
|
|
|
54
54
|
if (a.index !== b.index) {
|
|
55
55
|
return false;
|
|
56
56
|
}
|
|
57
|
+
|
|
58
|
+
if (a.size !== b.size) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
57
61
|
const aIsBuilder = isPropertyBuilder(a.property) || a.property.fromBuilder;
|
|
58
62
|
const bIsBuilder = isPropertyBuilder(b.property) || b.property.fromBuilder;
|
|
59
63
|
|
|
@@ -82,6 +86,7 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, M extends Rec
|
|
|
82
86
|
minimalistView,
|
|
83
87
|
autoFocus,
|
|
84
88
|
index,
|
|
89
|
+
size
|
|
85
90
|
}: PropertyFieldBindingProps<T, M>): ReactElement<PropertyFieldBindingProps<T, M>> {
|
|
86
91
|
|
|
87
92
|
const customizationController = useCustomizationController();
|
|
@@ -151,7 +156,8 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, M extends Rec
|
|
|
151
156
|
disabled,
|
|
152
157
|
partOfArray,
|
|
153
158
|
minimalistView,
|
|
154
|
-
autoFocus
|
|
159
|
+
autoFocus,
|
|
160
|
+
size
|
|
155
161
|
};
|
|
156
162
|
|
|
157
163
|
return <FieldInternal
|
|
@@ -182,7 +188,8 @@ function FieldInternal<T extends CMSType, CustomProps, M extends Record<string,
|
|
|
182
188
|
minimalistView,
|
|
183
189
|
autoFocus,
|
|
184
190
|
context,
|
|
185
|
-
disabled
|
|
191
|
+
disabled,
|
|
192
|
+
size
|
|
186
193
|
},
|
|
187
194
|
fieldProps
|
|
188
195
|
}:
|
|
@@ -229,7 +236,6 @@ function FieldInternal<T extends CMSType, CustomProps, M extends Record<string,
|
|
|
229
236
|
const cmsFieldProps: FieldProps<T, CustomProps, M> = {
|
|
230
237
|
propertyKey,
|
|
231
238
|
value: value as T,
|
|
232
|
-
// initialValue,
|
|
233
239
|
setValue,
|
|
234
240
|
setFieldValue,
|
|
235
241
|
error,
|
|
@@ -244,7 +250,8 @@ function FieldInternal<T extends CMSType, CustomProps, M extends Record<string,
|
|
|
244
250
|
minimalistView: minimalistView ?? false,
|
|
245
251
|
autoFocus: autoFocus ?? false,
|
|
246
252
|
customProps: customFieldProps,
|
|
247
|
-
context
|
|
253
|
+
context,
|
|
254
|
+
size
|
|
248
255
|
};
|
|
249
256
|
|
|
250
257
|
return (
|
|
@@ -23,6 +23,7 @@ export function MultiSelectBinding({
|
|
|
23
23
|
disabled,
|
|
24
24
|
property,
|
|
25
25
|
includeDescription,
|
|
26
|
+
size = "medium",
|
|
26
27
|
autoFocus
|
|
27
28
|
}: FieldProps<EnumType[], any, any>) {
|
|
28
29
|
|
|
@@ -81,6 +82,7 @@ export function MultiSelectBinding({
|
|
|
81
82
|
return (
|
|
82
83
|
<div className="mt-0.5 ml-0.5 mt-2">
|
|
83
84
|
<MultiSelect
|
|
85
|
+
size={size === "medium" ? "medium" : "small"}
|
|
84
86
|
value={validValue ? value.map((v) => v.toString()) : []}
|
|
85
87
|
disabled={disabled}
|
|
86
88
|
label={<LabelWithIcon icon={getIconForProperty(property, "small")}
|
|
@@ -40,7 +40,7 @@ function ReferenceFieldBindingInternal({
|
|
|
40
40
|
autoFocus,
|
|
41
41
|
property,
|
|
42
42
|
includeDescription,
|
|
43
|
-
|
|
43
|
+
size = "medium"
|
|
44
44
|
}: FieldProps<EntityReference>) {
|
|
45
45
|
if (!property.path) {
|
|
46
46
|
throw new Error("Property path is required for ReferenceFieldBinding");
|
|
@@ -98,7 +98,7 @@ function ReferenceFieldBindingInternal({
|
|
|
98
98
|
disabled={!property.path}
|
|
99
99
|
previewProperties={property.previewProperties}
|
|
100
100
|
hover={!disabled}
|
|
101
|
-
size={
|
|
101
|
+
size={size}
|
|
102
102
|
onClick={disabled || isSubmitting ? undefined : onEntryClick}
|
|
103
103
|
reference={value}
|
|
104
104
|
includeEntityLink={property.includeEntityLink}
|
|
@@ -106,7 +106,7 @@ function ReferenceFieldBindingInternal({
|
|
|
106
106
|
/>}
|
|
107
107
|
|
|
108
108
|
{!value && <div className="justify-center text-left">
|
|
109
|
-
<EntityPreviewContainer className={cls("
|
|
109
|
+
<EntityPreviewContainer className={cls("px-6 h-16 text-sm font-medium flex items-center gap-6",
|
|
110
110
|
disabled || isSubmitting
|
|
111
111
|
? "text-slate-500"
|
|
112
112
|
: "cursor-pointer text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-gray-800 group-hover:bg-slate-50 dark:group-hover:bg-gray-800")}
|
|
@@ -27,7 +27,8 @@ export function SelectFieldBinding<T extends EnumType>({
|
|
|
27
27
|
autoFocus,
|
|
28
28
|
touched,
|
|
29
29
|
property,
|
|
30
|
-
includeDescription
|
|
30
|
+
includeDescription,
|
|
31
|
+
size = "medium"
|
|
31
32
|
}: SelectProps<T>) {
|
|
32
33
|
|
|
33
34
|
const enumValues = property.enumValues;
|
|
@@ -48,6 +49,7 @@ export function SelectFieldBinding<T extends EnumType>({
|
|
|
48
49
|
<>
|
|
49
50
|
|
|
50
51
|
<Select
|
|
52
|
+
size={size === "medium" ? "medium" : "small"}
|
|
51
53
|
value={value !== undefined && value != null ? value.toString() : ""}
|
|
52
54
|
disabled={disabled}
|
|
53
55
|
position="item-aligned"
|
|
@@ -73,7 +75,7 @@ export function SelectFieldBinding<T extends EnumType>({
|
|
|
73
75
|
return <EnumValuesChip
|
|
74
76
|
enumKey={enumKey}
|
|
75
77
|
enumValues={enumValues}
|
|
76
|
-
size={
|
|
78
|
+
size={size}/>;
|
|
77
79
|
}}
|
|
78
80
|
>
|
|
79
81
|
{enumValues && enumValues.map((option) => {
|
|
@@ -83,7 +85,7 @@ export function SelectFieldBinding<T extends EnumType>({
|
|
|
83
85
|
<EnumValuesChip
|
|
84
86
|
enumKey={String(option.id)}
|
|
85
87
|
enumValues={enumValues}
|
|
86
|
-
size={
|
|
88
|
+
size={size}/>
|
|
87
89
|
</SelectItem>
|
|
88
90
|
})}
|
|
89
91
|
</Select>
|
|
@@ -23,7 +23,7 @@ export const SwitchFieldBinding = React.forwardRef(function SwitchFieldBinding({
|
|
|
23
23
|
showError,
|
|
24
24
|
autoFocus,
|
|
25
25
|
disabled,
|
|
26
|
-
|
|
26
|
+
size = "medium",
|
|
27
27
|
property,
|
|
28
28
|
includeDescription
|
|
29
29
|
}: SwitchFieldProps, ref) {
|
|
@@ -46,7 +46,7 @@ export const SwitchFieldBinding = React.forwardRef(function SwitchFieldBinding({
|
|
|
46
46
|
title={property.name}/>}
|
|
47
47
|
disabled={disabled}
|
|
48
48
|
autoFocus={autoFocus}
|
|
49
|
-
size={
|
|
49
|
+
size={size}
|
|
50
50
|
/>
|
|
51
51
|
|
|
52
52
|
<FieldHelperText includeDescription={includeDescription}
|
|
@@ -28,6 +28,7 @@ export function TextFieldBinding<T extends string | number>({
|
|
|
28
28
|
autoFocus,
|
|
29
29
|
property,
|
|
30
30
|
includeDescription,
|
|
31
|
+
size = "medium"
|
|
31
32
|
}: TextFieldBindingProps<T>) {
|
|
32
33
|
|
|
33
34
|
let multiline: boolean | undefined;
|
|
@@ -70,6 +71,7 @@ export function TextFieldBinding<T extends string | number>({
|
|
|
70
71
|
return (
|
|
71
72
|
<>
|
|
72
73
|
<TextField
|
|
74
|
+
size={size}
|
|
73
75
|
value={value}
|
|
74
76
|
onChange={onChange}
|
|
75
77
|
autoFocus={autoFocus}
|
|
@@ -100,7 +102,7 @@ export function TextFieldBinding<T extends string | number>({
|
|
|
100
102
|
<PropertyPreview
|
|
101
103
|
value={value}
|
|
102
104
|
property={property}
|
|
103
|
-
size={
|
|
105
|
+
size={size}/>
|
|
104
106
|
</Collapse>}
|
|
105
107
|
|
|
106
108
|
</>
|
|
@@ -21,6 +21,6 @@ export function BooleanPreview({
|
|
|
21
21
|
size={size}
|
|
22
22
|
color={"secondary"}/>
|
|
23
23
|
{property.name && <span
|
|
24
|
-
className={cls("text-text-secondary dark:text-text-secondary-dark", size === "
|
|
24
|
+
className={cls("text-text-secondary dark:text-text-secondary-dark", size === "smallest" ? "text-sm" : "")}>{property.name}</span>}
|
|
25
25
|
</div>;
|
|
26
26
|
}
|
|
@@ -6,7 +6,7 @@ import { buildEnumLabel, enumToObjectEntries, getColorScheme, getLabelOrConfigFr
|
|
|
6
6
|
export interface EnumValuesChipProps {
|
|
7
7
|
enumValues?: EnumValues;
|
|
8
8
|
enumKey: string | number;
|
|
9
|
-
size: "
|
|
9
|
+
size: "smallest" | "small" | "medium";
|
|
10
10
|
className?: string;
|
|
11
11
|
children?: React.ReactNode;
|
|
12
12
|
}
|
|
@@ -28,7 +28,7 @@ export function ArrayOfReferencesPreview({
|
|
|
28
28
|
if (property?.dataType !== "array" || !property.of || property.of.dataType !== "reference")
|
|
29
29
|
throw Error("Picked wrong preview component ArrayOfReferencesPreview");
|
|
30
30
|
|
|
31
|
-
const childSize: PreviewSize = size === "medium" ? "small" : "
|
|
31
|
+
const childSize: PreviewSize = size === "medium" ? "small" : "smallest";
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
34
|
<div className="flex flex-col w-full">
|
|
@@ -33,7 +33,7 @@ export function ArrayOfStorageComponentsPreview({
|
|
|
33
33
|
if (property.dataType !== "array" || !property.of || property.of.dataType !== "string")
|
|
34
34
|
throw Error("Picked wrong preview component ArrayOfStorageComponentsPreview");
|
|
35
35
|
|
|
36
|
-
const childSize: PreviewSize = size === "medium" ? "small" : "
|
|
36
|
+
const childSize: PreviewSize = size === "medium" ? "small" : "smallest";
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
39
|
<div className={"flex flex-wrap gap-2"}>
|
|
@@ -37,7 +37,7 @@ export function ArrayOneOfPreview({
|
|
|
37
37
|
|
|
38
38
|
if (!values) return null;
|
|
39
39
|
|
|
40
|
-
const childSize: PreviewSize = size === "medium" ? "small" : "
|
|
40
|
+
const childSize: PreviewSize = size === "medium" ? "small" : "smallest";
|
|
41
41
|
|
|
42
42
|
const typeField = property.oneOf.typeField ?? DEFAULT_ONE_OF_TYPE;
|
|
43
43
|
const valueField = property.oneOf.valueField ?? DEFAULT_ONE_OF_VALUE;
|
|
@@ -37,7 +37,7 @@ export function ArrayPropertyPreview({
|
|
|
37
37
|
|
|
38
38
|
if (!values) return null;
|
|
39
39
|
|
|
40
|
-
const childSize: PreviewSize = size === "medium" ? "small" : "
|
|
40
|
+
const childSize: PreviewSize = size === "medium" ? "small" : "smallest";
|
|
41
41
|
|
|
42
42
|
return (
|
|
43
43
|
<div className="flex flex-col gap-2">
|
|
@@ -34,7 +34,7 @@ export function MapPropertyPreview<T extends Record<string, any> = Record<string
|
|
|
34
34
|
|
|
35
35
|
const mapPropertyKeys: string[] = Object.keys(mapProperty.properties)
|
|
36
36
|
|
|
37
|
-
if (size === "
|
|
37
|
+
if (size === "smallest")
|
|
38
38
|
return (
|
|
39
39
|
<div className="w-full flex flex-col space-y-1 md:space-y-2">
|
|
40
40
|
{mapPropertyKeys.map((key, index) => (
|
|
@@ -87,7 +87,7 @@ function renderMap<T extends Record<string, any>>(property: ResolvedMapProperty<
|
|
|
87
87
|
mapPropertyKeys = (property.previewProperties || Object.keys(property.properties)) as string[];
|
|
88
88
|
if (size === "small")
|
|
89
89
|
mapPropertyKeys = mapPropertyKeys.slice(0, 3);
|
|
90
|
-
else if (size === "
|
|
90
|
+
else if (size === "smallest")
|
|
91
91
|
mapPropertyKeys = mapPropertyKeys.slice(0, 1);
|
|
92
92
|
}
|
|
93
93
|
|
|
@@ -226,7 +226,7 @@ function renderUrlAudioComponent() {
|
|
|
226
226
|
|
|
227
227
|
export function renderSkeletonImageThumbnail(size: PreviewSize) {
|
|
228
228
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
229
|
-
const imageSize = size === "
|
|
229
|
+
const imageSize = size === "smallest" ? 40 : size === "small" ? 100 : 200;
|
|
230
230
|
return (
|
|
231
231
|
<Skeleton width={imageSize}
|
|
232
232
|
height={imageSize}/>
|
|
@@ -45,14 +45,14 @@ export function StringPropertyPreview({
|
|
|
45
45
|
if (!value) return <></>;
|
|
46
46
|
const lines = value.split("\n");
|
|
47
47
|
return value && value.includes("\n")
|
|
48
|
-
? <div className={cls("overflow-x-scroll", size === "
|
|
48
|
+
? <div className={cls("overflow-x-scroll", size === "smallest" ? "text-sm" : "")}>
|
|
49
49
|
{lines.map((str, index) =>
|
|
50
50
|
<React.Fragment key={`string_preview_${index}`}>
|
|
51
51
|
<span>{str}</span>
|
|
52
52
|
{index !== lines.length - 1 && <br/>}
|
|
53
53
|
</React.Fragment>)}
|
|
54
54
|
</div>
|
|
55
|
-
: (size === "
|
|
55
|
+
: (size === "smallest"
|
|
56
56
|
? <span className={"text-sm"}>{value}</span>
|
|
57
57
|
: <>{value}</>
|
|
58
58
|
);
|
package/src/preview/util.ts
CHANGED
|
@@ -6,7 +6,7 @@ export const SMALL_THUMBNAIL = 100;
|
|
|
6
6
|
export const REGULAR_THUMBNAIL = 200;
|
|
7
7
|
|
|
8
8
|
export function getThumbnailMeasure(size: PreviewSize): number {
|
|
9
|
-
if (size === "
|
|
9
|
+
if (size === "smallest")
|
|
10
10
|
return TINY_THUMBNAIL;
|
|
11
11
|
else if (size === "small")
|
|
12
12
|
return SMALL_THUMBNAIL;
|
|
@@ -19,7 +19,7 @@ export function getPreviewSizeFrom(size: CollectionSize): PreviewSize {
|
|
|
19
19
|
switch (size) {
|
|
20
20
|
case "xs":
|
|
21
21
|
case "s":
|
|
22
|
-
return "
|
|
22
|
+
return "smallest";
|
|
23
23
|
case "m":
|
|
24
24
|
return "small";
|
|
25
25
|
case "l":
|
package/src/types/fields.tsx
CHANGED
|
@@ -105,6 +105,11 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
105
105
|
*/
|
|
106
106
|
disabled?: boolean;
|
|
107
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Size of the field
|
|
110
|
+
*/
|
|
111
|
+
size?: "smallest" | "small" | "medium";
|
|
112
|
+
|
|
108
113
|
}
|
|
109
114
|
|
|
110
115
|
/**
|
|
@@ -213,4 +218,9 @@ export interface PropertyFieldBindingProps<T extends CMSType, M extends Record<s
|
|
|
213
218
|
* Only used when the field is part of an array.
|
|
214
219
|
*/
|
|
215
220
|
index?: number;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* The size of the field
|
|
224
|
+
*/
|
|
225
|
+
size?: "smallest" | "small" | "medium",
|
|
216
226
|
}
|