@orion-studios/payload-studio 0.5.0-beta.33 → 0.5.0-beta.35

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/index.mjs CHANGED
@@ -1,22 +1,22 @@
1
- import {
2
- blocks_exports
3
- } from "./chunk-DUPYIJJH.mjs";
4
1
  import {
5
2
  admin_exports
6
3
  } from "./chunk-7IGLXLUB.mjs";
7
4
  import {
8
5
  admin_app_exports
9
6
  } from "./chunk-XVH5SCBD.mjs";
7
+ import {
8
+ blocks_exports
9
+ } from "./chunk-DUPYIJJH.mjs";
10
10
  import {
11
11
  nextjs_exports
12
- } from "./chunk-RZZFLVWG.mjs";
12
+ } from "./chunk-GPQPDEB5.mjs";
13
+ import {
14
+ studio_exports
15
+ } from "./chunk-N67KVM2S.mjs";
13
16
  import {
14
17
  studio_pages_exports
15
18
  } from "./chunk-QW24Y4UH.mjs";
16
19
  import "./chunk-SIL2J5MF.mjs";
17
- import {
18
- studio_exports
19
- } from "./chunk-N67KVM2S.mjs";
20
20
  import "./chunk-6BWS3CLP.mjs";
21
21
  export {
22
22
  admin_exports as admin,
@@ -4,10 +4,10 @@ import {
4
4
  createPayloadClient,
5
5
  createSiteQueries,
6
6
  resolveMedia
7
- } from "../chunk-RZZFLVWG.mjs";
7
+ } from "../chunk-GPQPDEB5.mjs";
8
+ import "../chunk-N67KVM2S.mjs";
8
9
  import "../chunk-QW24Y4UH.mjs";
9
10
  import "../chunk-SIL2J5MF.mjs";
10
- import "../chunk-N67KVM2S.mjs";
11
11
  import "../chunk-6BWS3CLP.mjs";
12
12
  export {
13
13
  WEBSITE_CONTENT_TAG,
@@ -500,8 +500,9 @@ var heroHeightMap = {
500
500
  var normalizeImageFit = (value) => normalizeHeroImageFit(value);
501
501
  var normalizeImageCornerStyle = (value, legacyFitValue) => normalizeHeroImageCornerStyle(value, legacyFitValue);
502
502
  var normalizeImagePosition = (value) => normalizeHeroImagePosition(value);
503
- var imageObjectPosition = (value) => {
504
- switch (value) {
503
+ var imageObjectPosition = (value, fit = "cover") => {
504
+ const resolved = fit === "cover" && (value === "left" || value === "right") ? "center" : value;
505
+ switch (resolved) {
505
506
  case "top":
506
507
  return "center top";
507
508
  case "bottom":
@@ -521,7 +522,7 @@ var getImagePresentationStyle = (options) => {
521
522
  return {
522
523
  borderRadius: options.cornerStyle === "square" ? 0 : `${options.roundedRadius ?? 12}px`,
523
524
  objectFit: options.fit || "cover",
524
- objectPosition: hasCustomPosition ? `${x}% ${y}%` : imageObjectPosition(options.position || "center")
525
+ objectPosition: hasCustomPosition ? `${x}% ${y}%` : imageObjectPosition(options.position || "center", options.fit || "cover")
525
526
  };
526
527
  };
527
528
  function cloneBlockLayout(layout) {
@@ -1788,8 +1789,12 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1788
1789
  setExpandedItemIndex((current) => current === itemIndex ? null : itemIndex);
1789
1790
  openSidebarPanel("selected");
1790
1791
  };
1791
- const defaultItemFocus = (value) => {
1792
+ const defaultItemFocus = (value, fitValue) => {
1792
1793
  const normalized = normalizeImagePosition(value);
1794
+ const fit = normalizeImageFit(fitValue);
1795
+ if (fit === "cover" && (normalized === "left" || normalized === "right")) {
1796
+ return { x: 50, y: 50 };
1797
+ }
1793
1798
  switch (normalized) {
1794
1799
  case "top":
1795
1800
  return { x: 50, y: 0 };
@@ -3989,13 +3994,16 @@ function BuilderPageEditor({ initialDoc, pageID }) {
3989
3994
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
3990
3995
  "select",
3991
3996
  {
3992
- onChange: (event) => updateArrayItemField(
3993
- selectedIndex ?? 0,
3994
- "items",
3995
- itemIndex,
3996
- "imageFit",
3997
- event.target.value
3998
- ),
3997
+ onChange: (event) => {
3998
+ const nextFit = event.target.value;
3999
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imageFit", nextFit);
4000
+ if (nextFit === "cover") {
4001
+ const pos = normalizeImagePosition(item.imagePosition);
4002
+ if (pos === "left" || pos === "right") {
4003
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePosition", "center");
4004
+ }
4005
+ }
4006
+ },
3999
4007
  style: sidebarInputStyle,
4000
4008
  value: normalizeImageFit(item.imageFit),
4001
4009
  children: [
@@ -4031,27 +4039,34 @@ function BuilderPageEditor({ initialDoc, pageID }) {
4031
4039
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
4032
4040
  "select",
4033
4041
  {
4034
- onChange: (event) => updateArrayItemField(
4035
- selectedIndex ?? 0,
4036
- "items",
4037
- itemIndex,
4038
- "imagePosition",
4039
- event.target.value
4040
- ),
4042
+ onChange: (event) => {
4043
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePosition", event.target.value);
4044
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePositionX", null);
4045
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePositionY", null);
4046
+ },
4041
4047
  style: sidebarInputStyle,
4042
- value: normalizeImagePosition(item.imagePosition),
4048
+ value: (() => {
4049
+ const fit = normalizeImageFit(item.imageFit);
4050
+ const pos = normalizeImagePosition(item.imagePosition);
4051
+ if (fit === "cover" && (pos === "left" || pos === "right")) {
4052
+ return "center";
4053
+ }
4054
+ return pos;
4055
+ })(),
4043
4056
  children: [
4044
4057
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "center", children: "Center" }),
4045
4058
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "top", children: "Top" }),
4046
4059
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "bottom", children: "Bottom" }),
4047
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "left", children: "Left" }),
4048
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "right", children: "Right" })
4060
+ normalizeImageFit(item.imageFit) !== "cover" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
4061
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "left", children: "Left" }),
4062
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "right", children: "Right" })
4063
+ ] }) : null
4049
4064
  ]
4050
4065
  }
4051
4066
  )
4052
4067
  ] }),
4053
4068
  (() => {
4054
- const fallbackFocus = defaultItemFocus(item.imagePosition);
4069
+ const fallbackFocus = defaultItemFocus(item.imagePosition, item.imageFit);
4055
4070
  const focusX = parsePercentNumber(item.imagePositionX, fallbackFocus.x);
4056
4071
  const focusY = parsePercentNumber(item.imagePositionY, fallbackFocus.y);
4057
4072
  const hasCustomFocus = typeof item.imagePositionX === "number" || typeof item.imagePositionX === "string" || typeof item.imagePositionY === "number" || typeof item.imagePositionY === "string";
@@ -4433,13 +4448,16 @@ function BuilderPageEditor({ initialDoc, pageID }) {
4433
4448
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
4434
4449
  "select",
4435
4450
  {
4436
- onChange: (event) => updateArrayItemField(
4437
- selectedIndex ?? 0,
4438
- "items",
4439
- itemIndex,
4440
- "imageFit",
4441
- event.target.value
4442
- ),
4451
+ onChange: (event) => {
4452
+ const nextFit = event.target.value;
4453
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imageFit", nextFit);
4454
+ if (nextFit === "cover") {
4455
+ const pos = normalizeImagePosition(item.imagePosition);
4456
+ if (pos === "left" || pos === "right") {
4457
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePosition", "center");
4458
+ }
4459
+ }
4460
+ },
4443
4461
  style: sidebarInputStyle,
4444
4462
  value: normalizeImageFit(item.imageFit),
4445
4463
  children: [
@@ -4475,27 +4493,34 @@ function BuilderPageEditor({ initialDoc, pageID }) {
4475
4493
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
4476
4494
  "select",
4477
4495
  {
4478
- onChange: (event) => updateArrayItemField(
4479
- selectedIndex ?? 0,
4480
- "items",
4481
- itemIndex,
4482
- "imagePosition",
4483
- event.target.value
4484
- ),
4496
+ onChange: (event) => {
4497
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePosition", event.target.value);
4498
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePositionX", null);
4499
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePositionY", null);
4500
+ },
4485
4501
  style: sidebarInputStyle,
4486
- value: normalizeImagePosition(item.imagePosition),
4502
+ value: (() => {
4503
+ const fit = normalizeImageFit(item.imageFit);
4504
+ const pos = normalizeImagePosition(item.imagePosition);
4505
+ if (fit === "cover" && (pos === "left" || pos === "right")) {
4506
+ return "center";
4507
+ }
4508
+ return pos;
4509
+ })(),
4487
4510
  children: [
4488
4511
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "center", children: "Center" }),
4489
4512
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "top", children: "Top" }),
4490
4513
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "bottom", children: "Bottom" }),
4491
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "left", children: "Left" }),
4492
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "right", children: "Right" })
4514
+ normalizeImageFit(item.imageFit) !== "cover" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
4515
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "left", children: "Left" }),
4516
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "right", children: "Right" })
4517
+ ] }) : null
4493
4518
  ]
4494
4519
  }
4495
4520
  )
4496
4521
  ] }),
4497
4522
  (() => {
4498
- const fallbackFocus = defaultItemFocus(item.imagePosition);
4523
+ const fallbackFocus = defaultItemFocus(item.imagePosition, item.imageFit);
4499
4524
  const focusX = parsePercentNumber(item.imagePositionX, fallbackFocus.x);
4500
4525
  const focusY = parsePercentNumber(item.imagePositionY, fallbackFocus.y);
4501
4526
  const hasCustomFocus = typeof item.imagePositionX === "number" || typeof item.imagePositionX === "string" || typeof item.imagePositionY === "number" || typeof item.imagePositionY === "string";
@@ -4794,13 +4819,16 @@ function BuilderPageEditor({ initialDoc, pageID }) {
4794
4819
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
4795
4820
  "select",
4796
4821
  {
4797
- onChange: (event) => updateArrayItemField(
4798
- selectedIndex ?? 0,
4799
- "items",
4800
- itemIndex,
4801
- "imageFit",
4802
- event.target.value
4803
- ),
4822
+ onChange: (event) => {
4823
+ const nextFit = event.target.value;
4824
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imageFit", nextFit);
4825
+ if (nextFit === "cover") {
4826
+ const pos = normalizeImagePosition(item.imagePosition);
4827
+ if (pos === "left" || pos === "right") {
4828
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePosition", "center");
4829
+ }
4830
+ }
4831
+ },
4804
4832
  style: sidebarInputStyle,
4805
4833
  value: normalizeImageFit(item.imageFit),
4806
4834
  children: [
@@ -4836,27 +4864,34 @@ function BuilderPageEditor({ initialDoc, pageID }) {
4836
4864
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
4837
4865
  "select",
4838
4866
  {
4839
- onChange: (event) => updateArrayItemField(
4840
- selectedIndex ?? 0,
4841
- "items",
4842
- itemIndex,
4843
- "imagePosition",
4844
- event.target.value
4845
- ),
4867
+ onChange: (event) => {
4868
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePosition", event.target.value);
4869
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePositionX", null);
4870
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePositionY", null);
4871
+ },
4846
4872
  style: sidebarInputStyle,
4847
- value: normalizeImagePosition(item.imagePosition),
4873
+ value: (() => {
4874
+ const fit = normalizeImageFit(item.imageFit);
4875
+ const pos = normalizeImagePosition(item.imagePosition);
4876
+ if (fit === "cover" && (pos === "left" || pos === "right")) {
4877
+ return "center";
4878
+ }
4879
+ return pos;
4880
+ })(),
4848
4881
  children: [
4849
4882
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "center", children: "Center" }),
4850
4883
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "top", children: "Top" }),
4851
4884
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "bottom", children: "Bottom" }),
4852
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "left", children: "Left" }),
4853
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "right", children: "Right" })
4885
+ normalizeImageFit(item.imageFit) !== "cover" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
4886
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "left", children: "Left" }),
4887
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "right", children: "Right" })
4888
+ ] }) : null
4854
4889
  ]
4855
4890
  }
4856
4891
  )
4857
4892
  ] }),
4858
4893
  (() => {
4859
- const fallbackFocus = defaultItemFocus(item.imagePosition);
4894
+ const fallbackFocus = defaultItemFocus(item.imagePosition, item.imageFit);
4860
4895
  const focusX = parsePercentNumber(item.imagePositionX, fallbackFocus.x);
4861
4896
  const focusY = parsePercentNumber(item.imagePositionY, fallbackFocus.y);
4862
4897
  const hasCustomFocus = typeof item.imagePositionX === "number" || typeof item.imagePositionX === "string" || typeof item.imagePositionY === "number" || typeof item.imagePositionY === "string";
@@ -472,8 +472,9 @@ var heroHeightMap = {
472
472
  var normalizeImageFit = (value) => normalizeHeroImageFit(value);
473
473
  var normalizeImageCornerStyle = (value, legacyFitValue) => normalizeHeroImageCornerStyle(value, legacyFitValue);
474
474
  var normalizeImagePosition = (value) => normalizeHeroImagePosition(value);
475
- var imageObjectPosition = (value) => {
476
- switch (value) {
475
+ var imageObjectPosition = (value, fit = "cover") => {
476
+ const resolved = fit === "cover" && (value === "left" || value === "right") ? "center" : value;
477
+ switch (resolved) {
477
478
  case "top":
478
479
  return "center top";
479
480
  case "bottom":
@@ -493,7 +494,7 @@ var getImagePresentationStyle = (options) => {
493
494
  return {
494
495
  borderRadius: options.cornerStyle === "square" ? 0 : `${options.roundedRadius ?? 12}px`,
495
496
  objectFit: options.fit || "cover",
496
- objectPosition: hasCustomPosition ? `${x}% ${y}%` : imageObjectPosition(options.position || "center")
497
+ objectPosition: hasCustomPosition ? `${x}% ${y}%` : imageObjectPosition(options.position || "center", options.fit || "cover")
497
498
  };
498
499
  };
499
500
  function cloneBlockLayout(layout) {
@@ -1760,8 +1761,12 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1760
1761
  setExpandedItemIndex((current) => current === itemIndex ? null : itemIndex);
1761
1762
  openSidebarPanel("selected");
1762
1763
  };
1763
- const defaultItemFocus = (value) => {
1764
+ const defaultItemFocus = (value, fitValue) => {
1764
1765
  const normalized = normalizeImagePosition(value);
1766
+ const fit = normalizeImageFit(fitValue);
1767
+ if (fit === "cover" && (normalized === "left" || normalized === "right")) {
1768
+ return { x: 50, y: 50 };
1769
+ }
1765
1770
  switch (normalized) {
1766
1771
  case "top":
1767
1772
  return { x: 50, y: 0 };
@@ -3961,13 +3966,16 @@ function BuilderPageEditor({ initialDoc, pageID }) {
3961
3966
  /* @__PURE__ */ jsxs(
3962
3967
  "select",
3963
3968
  {
3964
- onChange: (event) => updateArrayItemField(
3965
- selectedIndex ?? 0,
3966
- "items",
3967
- itemIndex,
3968
- "imageFit",
3969
- event.target.value
3970
- ),
3969
+ onChange: (event) => {
3970
+ const nextFit = event.target.value;
3971
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imageFit", nextFit);
3972
+ if (nextFit === "cover") {
3973
+ const pos = normalizeImagePosition(item.imagePosition);
3974
+ if (pos === "left" || pos === "right") {
3975
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePosition", "center");
3976
+ }
3977
+ }
3978
+ },
3971
3979
  style: sidebarInputStyle,
3972
3980
  value: normalizeImageFit(item.imageFit),
3973
3981
  children: [
@@ -4003,27 +4011,34 @@ function BuilderPageEditor({ initialDoc, pageID }) {
4003
4011
  /* @__PURE__ */ jsxs(
4004
4012
  "select",
4005
4013
  {
4006
- onChange: (event) => updateArrayItemField(
4007
- selectedIndex ?? 0,
4008
- "items",
4009
- itemIndex,
4010
- "imagePosition",
4011
- event.target.value
4012
- ),
4014
+ onChange: (event) => {
4015
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePosition", event.target.value);
4016
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePositionX", null);
4017
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePositionY", null);
4018
+ },
4013
4019
  style: sidebarInputStyle,
4014
- value: normalizeImagePosition(item.imagePosition),
4020
+ value: (() => {
4021
+ const fit = normalizeImageFit(item.imageFit);
4022
+ const pos = normalizeImagePosition(item.imagePosition);
4023
+ if (fit === "cover" && (pos === "left" || pos === "right")) {
4024
+ return "center";
4025
+ }
4026
+ return pos;
4027
+ })(),
4015
4028
  children: [
4016
4029
  /* @__PURE__ */ jsx("option", { value: "center", children: "Center" }),
4017
4030
  /* @__PURE__ */ jsx("option", { value: "top", children: "Top" }),
4018
4031
  /* @__PURE__ */ jsx("option", { value: "bottom", children: "Bottom" }),
4019
- /* @__PURE__ */ jsx("option", { value: "left", children: "Left" }),
4020
- /* @__PURE__ */ jsx("option", { value: "right", children: "Right" })
4032
+ normalizeImageFit(item.imageFit) !== "cover" ? /* @__PURE__ */ jsxs(Fragment, { children: [
4033
+ /* @__PURE__ */ jsx("option", { value: "left", children: "Left" }),
4034
+ /* @__PURE__ */ jsx("option", { value: "right", children: "Right" })
4035
+ ] }) : null
4021
4036
  ]
4022
4037
  }
4023
4038
  )
4024
4039
  ] }),
4025
4040
  (() => {
4026
- const fallbackFocus = defaultItemFocus(item.imagePosition);
4041
+ const fallbackFocus = defaultItemFocus(item.imagePosition, item.imageFit);
4027
4042
  const focusX = parsePercentNumber(item.imagePositionX, fallbackFocus.x);
4028
4043
  const focusY = parsePercentNumber(item.imagePositionY, fallbackFocus.y);
4029
4044
  const hasCustomFocus = typeof item.imagePositionX === "number" || typeof item.imagePositionX === "string" || typeof item.imagePositionY === "number" || typeof item.imagePositionY === "string";
@@ -4405,13 +4420,16 @@ function BuilderPageEditor({ initialDoc, pageID }) {
4405
4420
  /* @__PURE__ */ jsxs(
4406
4421
  "select",
4407
4422
  {
4408
- onChange: (event) => updateArrayItemField(
4409
- selectedIndex ?? 0,
4410
- "items",
4411
- itemIndex,
4412
- "imageFit",
4413
- event.target.value
4414
- ),
4423
+ onChange: (event) => {
4424
+ const nextFit = event.target.value;
4425
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imageFit", nextFit);
4426
+ if (nextFit === "cover") {
4427
+ const pos = normalizeImagePosition(item.imagePosition);
4428
+ if (pos === "left" || pos === "right") {
4429
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePosition", "center");
4430
+ }
4431
+ }
4432
+ },
4415
4433
  style: sidebarInputStyle,
4416
4434
  value: normalizeImageFit(item.imageFit),
4417
4435
  children: [
@@ -4447,27 +4465,34 @@ function BuilderPageEditor({ initialDoc, pageID }) {
4447
4465
  /* @__PURE__ */ jsxs(
4448
4466
  "select",
4449
4467
  {
4450
- onChange: (event) => updateArrayItemField(
4451
- selectedIndex ?? 0,
4452
- "items",
4453
- itemIndex,
4454
- "imagePosition",
4455
- event.target.value
4456
- ),
4468
+ onChange: (event) => {
4469
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePosition", event.target.value);
4470
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePositionX", null);
4471
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePositionY", null);
4472
+ },
4457
4473
  style: sidebarInputStyle,
4458
- value: normalizeImagePosition(item.imagePosition),
4474
+ value: (() => {
4475
+ const fit = normalizeImageFit(item.imageFit);
4476
+ const pos = normalizeImagePosition(item.imagePosition);
4477
+ if (fit === "cover" && (pos === "left" || pos === "right")) {
4478
+ return "center";
4479
+ }
4480
+ return pos;
4481
+ })(),
4459
4482
  children: [
4460
4483
  /* @__PURE__ */ jsx("option", { value: "center", children: "Center" }),
4461
4484
  /* @__PURE__ */ jsx("option", { value: "top", children: "Top" }),
4462
4485
  /* @__PURE__ */ jsx("option", { value: "bottom", children: "Bottom" }),
4463
- /* @__PURE__ */ jsx("option", { value: "left", children: "Left" }),
4464
- /* @__PURE__ */ jsx("option", { value: "right", children: "Right" })
4486
+ normalizeImageFit(item.imageFit) !== "cover" ? /* @__PURE__ */ jsxs(Fragment, { children: [
4487
+ /* @__PURE__ */ jsx("option", { value: "left", children: "Left" }),
4488
+ /* @__PURE__ */ jsx("option", { value: "right", children: "Right" })
4489
+ ] }) : null
4465
4490
  ]
4466
4491
  }
4467
4492
  )
4468
4493
  ] }),
4469
4494
  (() => {
4470
- const fallbackFocus = defaultItemFocus(item.imagePosition);
4495
+ const fallbackFocus = defaultItemFocus(item.imagePosition, item.imageFit);
4471
4496
  const focusX = parsePercentNumber(item.imagePositionX, fallbackFocus.x);
4472
4497
  const focusY = parsePercentNumber(item.imagePositionY, fallbackFocus.y);
4473
4498
  const hasCustomFocus = typeof item.imagePositionX === "number" || typeof item.imagePositionX === "string" || typeof item.imagePositionY === "number" || typeof item.imagePositionY === "string";
@@ -4766,13 +4791,16 @@ function BuilderPageEditor({ initialDoc, pageID }) {
4766
4791
  /* @__PURE__ */ jsxs(
4767
4792
  "select",
4768
4793
  {
4769
- onChange: (event) => updateArrayItemField(
4770
- selectedIndex ?? 0,
4771
- "items",
4772
- itemIndex,
4773
- "imageFit",
4774
- event.target.value
4775
- ),
4794
+ onChange: (event) => {
4795
+ const nextFit = event.target.value;
4796
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imageFit", nextFit);
4797
+ if (nextFit === "cover") {
4798
+ const pos = normalizeImagePosition(item.imagePosition);
4799
+ if (pos === "left" || pos === "right") {
4800
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePosition", "center");
4801
+ }
4802
+ }
4803
+ },
4776
4804
  style: sidebarInputStyle,
4777
4805
  value: normalizeImageFit(item.imageFit),
4778
4806
  children: [
@@ -4808,27 +4836,34 @@ function BuilderPageEditor({ initialDoc, pageID }) {
4808
4836
  /* @__PURE__ */ jsxs(
4809
4837
  "select",
4810
4838
  {
4811
- onChange: (event) => updateArrayItemField(
4812
- selectedIndex ?? 0,
4813
- "items",
4814
- itemIndex,
4815
- "imagePosition",
4816
- event.target.value
4817
- ),
4839
+ onChange: (event) => {
4840
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePosition", event.target.value);
4841
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePositionX", null);
4842
+ updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "imagePositionY", null);
4843
+ },
4818
4844
  style: sidebarInputStyle,
4819
- value: normalizeImagePosition(item.imagePosition),
4845
+ value: (() => {
4846
+ const fit = normalizeImageFit(item.imageFit);
4847
+ const pos = normalizeImagePosition(item.imagePosition);
4848
+ if (fit === "cover" && (pos === "left" || pos === "right")) {
4849
+ return "center";
4850
+ }
4851
+ return pos;
4852
+ })(),
4820
4853
  children: [
4821
4854
  /* @__PURE__ */ jsx("option", { value: "center", children: "Center" }),
4822
4855
  /* @__PURE__ */ jsx("option", { value: "top", children: "Top" }),
4823
4856
  /* @__PURE__ */ jsx("option", { value: "bottom", children: "Bottom" }),
4824
- /* @__PURE__ */ jsx("option", { value: "left", children: "Left" }),
4825
- /* @__PURE__ */ jsx("option", { value: "right", children: "Right" })
4857
+ normalizeImageFit(item.imageFit) !== "cover" ? /* @__PURE__ */ jsxs(Fragment, { children: [
4858
+ /* @__PURE__ */ jsx("option", { value: "left", children: "Left" }),
4859
+ /* @__PURE__ */ jsx("option", { value: "right", children: "Right" })
4860
+ ] }) : null
4826
4861
  ]
4827
4862
  }
4828
4863
  )
4829
4864
  ] }),
4830
4865
  (() => {
4831
- const fallbackFocus = defaultItemFocus(item.imagePosition);
4866
+ const fallbackFocus = defaultItemFocus(item.imagePosition, item.imageFit);
4832
4867
  const focusX = parsePercentNumber(item.imagePositionX, fallbackFocus.x);
4833
4868
  const focusY = parsePercentNumber(item.imagePositionY, fallbackFocus.y);
4834
4869
  const hasCustomFocus = typeof item.imagePositionX === "number" || typeof item.imagePositionX === "string" || typeof item.imagePositionY === "number" || typeof item.imagePositionY === "string";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.5.0-beta.33",
3
+ "version": "0.5.0-beta.35",
4
4
  "description": "Unified Payload CMS toolkit for Orion Studios",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -1,9 +1,9 @@
1
- import {
2
- studioDocumentToLayout
3
- } from "./chunk-QW24Y4UH.mjs";
4
1
  import {
5
2
  assertStudioDocumentV1
6
3
  } from "./chunk-N67KVM2S.mjs";
4
+ import {
5
+ studioDocumentToLayout
6
+ } from "./chunk-QW24Y4UH.mjs";
7
7
  import {
8
8
  __export
9
9
  } from "./chunk-6BWS3CLP.mjs";