@payloadcms/ui 3.39.1 → 3.40.0-internal.9cc3927
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/elements/BulkUpload/EditForm/index.js +1 -1
- package/dist/elements/BulkUpload/EditForm/index.js.map +1 -1
- package/dist/elements/DocumentControls/index.js +1 -1
- package/dist/elements/DocumentControls/index.js.map +1 -1
- package/dist/elements/FolderView/CollectionTypePill/index.js +1 -1
- package/dist/elements/FolderView/CollectionTypePill/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/File/index.d.ts.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/File/index.js +1 -2
- package/dist/elements/Table/DefaultCell/fields/File/index.js.map +1 -1
- package/dist/exports/client/index.js +10 -10
- package/dist/exports/client/index.js.map +4 -4
- package/dist/fields/Select/Input.d.ts +1 -0
- package/dist/fields/Select/Input.d.ts.map +1 -1
- package/dist/fields/Select/Input.js +50 -47
- package/dist/fields/Select/Input.js.map +1 -1
- package/dist/fields/Select/index.d.ts.map +1 -1
- package/dist/fields/Select/index.js +4 -0
- package/dist/fields/Select/index.js.map +1 -1
- package/dist/fields/Upload/HasMany/index.d.ts.map +1 -1
- package/dist/fields/Upload/HasMany/index.js +1 -2
- package/dist/fields/Upload/HasMany/index.js.map +1 -1
- package/dist/fields/Upload/HasOne/index.d.ts.map +1 -1
- package/dist/fields/Upload/HasOne/index.js +1 -2
- package/dist/fields/Upload/HasOne/index.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js +19 -0
- package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js.map +1 -1
- package/dist/forms/useField/index.d.ts.map +1 -1
- package/dist/forms/useField/index.js +60 -57
- package/dist/forms/useField/index.js.map +1 -1
- package/dist/forms/useField/types.d.ts +2 -1
- package/dist/forms/useField/types.d.ts.map +1 -1
- package/dist/forms/useField/types.js.map +1 -1
- package/dist/views/List/ListHeader/index.js +1 -1
- package/dist/views/List/ListHeader/index.js.map +1 -1
- package/package.json +5 -5
- package/dist/utilities/getBestFitFromSizes.d.ts +0 -25
- package/dist/utilities/getBestFitFromSizes.d.ts.map +0 -1
- package/dist/utilities/getBestFitFromSizes.js +0 -45
- package/dist/utilities/getBestFitFromSizes.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.40.0-internal.9cc3927",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"ts-essentials": "10.0.3",
|
|
134
134
|
"use-context-selector": "2.0.0",
|
|
135
135
|
"uuid": "10.0.0",
|
|
136
|
-
"@payloadcms/translations": "3.
|
|
136
|
+
"@payloadcms/translations": "3.40.0-internal.9cc3927"
|
|
137
137
|
},
|
|
138
138
|
"devDependencies": {
|
|
139
139
|
"@babel/cli": "7.26.4",
|
|
@@ -148,14 +148,14 @@
|
|
|
148
148
|
"babel-plugin-react-compiler": "19.0.0-beta-e993439-20250405",
|
|
149
149
|
"esbuild": "0.24.2",
|
|
150
150
|
"esbuild-sass-plugin": "3.3.1",
|
|
151
|
-
"
|
|
152
|
-
"
|
|
151
|
+
"payload": "3.40.0-internal.9cc3927",
|
|
152
|
+
"@payloadcms/eslint-config": "3.28.0"
|
|
153
153
|
},
|
|
154
154
|
"peerDependencies": {
|
|
155
155
|
"next": "^15.2.3",
|
|
156
156
|
"react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
157
157
|
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
158
|
-
"payload": "3.
|
|
158
|
+
"payload": "3.40.0-internal.9cc3927"
|
|
159
159
|
},
|
|
160
160
|
"engines": {
|
|
161
161
|
"node": "^18.20.2 || >=20.9.0"
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Takes image sizes and a target range and returns the url of the image within that range.
|
|
3
|
-
* If no images fit within the range, it selects the next smallest adequate image, the original,
|
|
4
|
-
* or the largest smaller image if no better fit exists.
|
|
5
|
-
*
|
|
6
|
-
* @param sizes The given FileSizes.
|
|
7
|
-
* @param targetSizeMax The ideal image maximum width. Defaults to 180.
|
|
8
|
-
* @param targetSizeMin The ideal image minimum width. Defaults to 40.
|
|
9
|
-
* @param thumbnailURL The thumbnail url set in config. If passed a url, will return early with it.
|
|
10
|
-
* @param url The url of the original file.
|
|
11
|
-
* @param width The width of the original file.
|
|
12
|
-
* @returns A url of the best fit file.
|
|
13
|
-
*/
|
|
14
|
-
export declare const getBestFitFromSizes: ({ sizes, targetSizeMax, targetSizeMin, thumbnailURL, url, width, }: {
|
|
15
|
-
sizes?: Record<string, {
|
|
16
|
-
url?: string;
|
|
17
|
-
width?: number;
|
|
18
|
-
}>;
|
|
19
|
-
targetSizeMax?: number;
|
|
20
|
-
targetSizeMin?: number;
|
|
21
|
-
thumbnailURL?: string;
|
|
22
|
-
url: string;
|
|
23
|
-
width?: number;
|
|
24
|
-
}) => string;
|
|
25
|
-
//# sourceMappingURL=getBestFitFromSizes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getBestFitFromSizes.d.ts","sourceRoot":"","sources":["../../src/utilities/getBestFitFromSizes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,uEAO7B;IACD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACxD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,WA0CA,CAAA"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Takes image sizes and a target range and returns the url of the image within that range.
|
|
3
|
-
* If no images fit within the range, it selects the next smallest adequate image, the original,
|
|
4
|
-
* or the largest smaller image if no better fit exists.
|
|
5
|
-
*
|
|
6
|
-
* @param sizes The given FileSizes.
|
|
7
|
-
* @param targetSizeMax The ideal image maximum width. Defaults to 180.
|
|
8
|
-
* @param targetSizeMin The ideal image minimum width. Defaults to 40.
|
|
9
|
-
* @param thumbnailURL The thumbnail url set in config. If passed a url, will return early with it.
|
|
10
|
-
* @param url The url of the original file.
|
|
11
|
-
* @param width The width of the original file.
|
|
12
|
-
* @returns A url of the best fit file.
|
|
13
|
-
*/export const getBestFitFromSizes = ({
|
|
14
|
-
sizes,
|
|
15
|
-
targetSizeMax = 180,
|
|
16
|
-
targetSizeMin = 40,
|
|
17
|
-
thumbnailURL,
|
|
18
|
-
url,
|
|
19
|
-
width
|
|
20
|
-
}) => {
|
|
21
|
-
if (thumbnailURL) {
|
|
22
|
-
return thumbnailURL;
|
|
23
|
-
}
|
|
24
|
-
if (!sizes) {
|
|
25
|
-
return url;
|
|
26
|
-
}
|
|
27
|
-
const bestFit = Object.values(sizes).reduce((closest, current) => {
|
|
28
|
-
if (!current.width || current.width < targetSizeMin) {
|
|
29
|
-
return closest;
|
|
30
|
-
}
|
|
31
|
-
if (current.width >= targetSizeMin && current.width <= targetSizeMax) {
|
|
32
|
-
return !closest.width || current.width < closest.width || closest.width < targetSizeMin || closest.width > targetSizeMax ? current : closest;
|
|
33
|
-
}
|
|
34
|
-
if (!closest.width || !closest.original && closest.width < targetSizeMin && current.width > closest.width || closest.width > targetSizeMax && current.width < closest.width) {
|
|
35
|
-
return current;
|
|
36
|
-
}
|
|
37
|
-
return closest;
|
|
38
|
-
}, {
|
|
39
|
-
original: true,
|
|
40
|
-
url,
|
|
41
|
-
width
|
|
42
|
-
});
|
|
43
|
-
return bestFit.url || url;
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=getBestFitFromSizes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getBestFitFromSizes.js","names":["getBestFitFromSizes","sizes","targetSizeMax","targetSizeMin","thumbnailURL","url","width","bestFit","Object","values","reduce","closest","current","original"],"sources":["../../src/utilities/getBestFitFromSizes.ts"],"sourcesContent":["/**\n * Takes image sizes and a target range and returns the url of the image within that range.\n * If no images fit within the range, it selects the next smallest adequate image, the original,\n * or the largest smaller image if no better fit exists.\n *\n * @param sizes The given FileSizes.\n * @param targetSizeMax The ideal image maximum width. Defaults to 180.\n * @param targetSizeMin The ideal image minimum width. Defaults to 40.\n * @param thumbnailURL The thumbnail url set in config. If passed a url, will return early with it.\n * @param url The url of the original file.\n * @param width The width of the original file.\n * @returns A url of the best fit file.\n */\nexport const getBestFitFromSizes = ({\n sizes,\n targetSizeMax = 180,\n targetSizeMin = 40,\n thumbnailURL,\n url,\n width,\n}: {\n sizes?: Record<string, { url?: string; width?: number }>\n targetSizeMax?: number\n targetSizeMin?: number\n thumbnailURL?: string\n url: string\n width?: number\n}) => {\n if (thumbnailURL) {\n return thumbnailURL\n }\n\n if (!sizes) {\n return url\n }\n\n const bestFit = Object.values(sizes).reduce<{\n original?: boolean\n url?: string\n width?: number\n }>(\n (closest, current) => {\n if (!current.width || current.width < targetSizeMin) {\n return closest\n }\n\n if (current.width >= targetSizeMin && current.width <= targetSizeMax) {\n return !closest.width ||\n current.width < closest.width ||\n closest.width < targetSizeMin ||\n closest.width > targetSizeMax\n ? current\n : closest\n }\n\n if (\n !closest.width ||\n (!closest.original && closest.width < targetSizeMin && current.width > closest.width) ||\n (closest.width > targetSizeMax && current.width < closest.width)\n ) {\n return current\n }\n\n return closest\n },\n { original: true, url, width },\n )\n\n return bestFit.url || url\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