@payloadcms/ui 3.0.0-beta.86 → 3.0.0-beta.87

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.
Files changed (128) hide show
  1. package/dist/elements/FieldSelect/index.js +1 -0
  2. package/dist/elements/FieldSelect/index.js.map +1 -1
  3. package/dist/elements/ListDrawer/DrawerContent.js +1 -0
  4. package/dist/elements/ListDrawer/DrawerContent.js.map +1 -1
  5. package/dist/elements/TableColumns/buildColumnState.d.ts.map +1 -1
  6. package/dist/elements/TableColumns/buildColumnState.js +1 -0
  7. package/dist/elements/TableColumns/buildColumnState.js.map +1 -1
  8. package/dist/elements/Upload/index.js +1 -0
  9. package/dist/elements/Upload/index.js.map +1 -1
  10. package/dist/elements/ViewDescription/index.d.ts +5 -5
  11. package/dist/elements/ViewDescription/index.d.ts.map +1 -1
  12. package/dist/elements/ViewDescription/index.js +1 -1
  13. package/dist/elements/ViewDescription/index.js.map +1 -1
  14. package/dist/exports/client/index.js +7 -7
  15. package/dist/exports/client/index.js.map +3 -3
  16. package/dist/exports/shared/index.js +2 -2
  17. package/dist/exports/shared/index.js.map +3 -3
  18. package/dist/fields/Array/index.d.ts.map +1 -1
  19. package/dist/fields/Array/index.js +3 -0
  20. package/dist/fields/Array/index.js.map +1 -1
  21. package/dist/fields/Blocks/index.d.ts.map +1 -1
  22. package/dist/fields/Blocks/index.js +3 -0
  23. package/dist/fields/Blocks/index.js.map +1 -1
  24. package/dist/fields/Checkbox/Input.d.ts +5 -3
  25. package/dist/fields/Checkbox/Input.d.ts.map +1 -1
  26. package/dist/fields/Checkbox/Input.js +2 -0
  27. package/dist/fields/Checkbox/Input.js.map +1 -1
  28. package/dist/fields/Checkbox/index.d.ts.map +1 -1
  29. package/dist/fields/Checkbox/index.js +2 -0
  30. package/dist/fields/Checkbox/index.js.map +1 -1
  31. package/dist/fields/Code/index.d.ts.map +1 -1
  32. package/dist/fields/Code/index.js +3 -0
  33. package/dist/fields/Code/index.js.map +1 -1
  34. package/dist/fields/Collapsible/index.d.ts.map +1 -1
  35. package/dist/fields/Collapsible/index.js +1 -0
  36. package/dist/fields/Collapsible/index.js.map +1 -1
  37. package/dist/fields/ConfirmPassword/index.d.ts.map +1 -1
  38. package/dist/fields/ConfirmPassword/index.js +2 -0
  39. package/dist/fields/ConfirmPassword/index.js.map +1 -1
  40. package/dist/fields/DateTime/index.d.ts.map +1 -1
  41. package/dist/fields/DateTime/index.js +3 -0
  42. package/dist/fields/DateTime/index.js.map +1 -1
  43. package/dist/fields/Email/index.d.ts.map +1 -1
  44. package/dist/fields/Email/index.js +4 -1
  45. package/dist/fields/Email/index.js.map +1 -1
  46. package/dist/fields/FieldDescription/index.d.ts +2 -3
  47. package/dist/fields/FieldDescription/index.d.ts.map +1 -1
  48. package/dist/fields/FieldDescription/index.js.map +1 -1
  49. package/dist/fields/FieldError/index.d.ts +2 -3
  50. package/dist/fields/FieldError/index.d.ts.map +1 -1
  51. package/dist/fields/FieldError/index.js.map +1 -1
  52. package/dist/fields/FieldLabel/index.d.ts +2 -3
  53. package/dist/fields/FieldLabel/index.d.ts.map +1 -1
  54. package/dist/fields/FieldLabel/index.js.map +1 -1
  55. package/dist/fields/Group/index.d.ts.map +1 -1
  56. package/dist/fields/Group/index.js +1 -0
  57. package/dist/fields/Group/index.js.map +1 -1
  58. package/dist/fields/JSON/index.d.ts.map +1 -1
  59. package/dist/fields/JSON/index.js +3 -0
  60. package/dist/fields/JSON/index.js.map +1 -1
  61. package/dist/fields/Number/index.d.ts.map +1 -1
  62. package/dist/fields/Number/index.js +3 -0
  63. package/dist/fields/Number/index.js.map +1 -1
  64. package/dist/fields/Password/input.d.ts.map +1 -1
  65. package/dist/fields/Password/input.js +33 -29
  66. package/dist/fields/Password/input.js.map +1 -1
  67. package/dist/fields/Password/types.d.ts +7 -3
  68. package/dist/fields/Password/types.d.ts.map +1 -1
  69. package/dist/fields/Password/types.js.map +1 -1
  70. package/dist/fields/Point/index.d.ts.map +1 -1
  71. package/dist/fields/Point/index.js +3 -0
  72. package/dist/fields/Point/index.js.map +1 -1
  73. package/dist/fields/RadioGroup/index.d.ts.map +1 -1
  74. package/dist/fields/RadioGroup/index.js +3 -0
  75. package/dist/fields/RadioGroup/index.js.map +1 -1
  76. package/dist/fields/Relationship/index.d.ts.map +1 -1
  77. package/dist/fields/Relationship/index.js +3 -0
  78. package/dist/fields/Relationship/index.js.map +1 -1
  79. package/dist/fields/Select/Input.d.ts +3 -1
  80. package/dist/fields/Select/Input.d.ts.map +1 -1
  81. package/dist/fields/Select/Input.js +60 -55
  82. package/dist/fields/Select/Input.js.map +1 -1
  83. package/dist/fields/Select/index.d.ts.map +1 -1
  84. package/dist/fields/Select/index.js +1 -0
  85. package/dist/fields/Select/index.js.map +1 -1
  86. package/dist/fields/Tabs/index.js +2 -1
  87. package/dist/fields/Tabs/index.js.map +1 -1
  88. package/dist/fields/Text/Input.d.ts.map +1 -1
  89. package/dist/fields/Text/Input.js +45 -40
  90. package/dist/fields/Text/Input.js.map +1 -1
  91. package/dist/fields/Text/index.d.ts.map +1 -1
  92. package/dist/fields/Text/index.js +1 -0
  93. package/dist/fields/Text/index.js.map +1 -1
  94. package/dist/fields/Text/types.d.ts +3 -1
  95. package/dist/fields/Text/types.d.ts.map +1 -1
  96. package/dist/fields/Text/types.js.map +1 -1
  97. package/dist/fields/Textarea/Input.d.ts.map +1 -1
  98. package/dist/fields/Textarea/Input.js +39 -34
  99. package/dist/fields/Textarea/Input.js.map +1 -1
  100. package/dist/fields/Textarea/index.d.ts.map +1 -1
  101. package/dist/fields/Textarea/index.js +6 -0
  102. package/dist/fields/Textarea/index.js.map +1 -1
  103. package/dist/fields/Textarea/types.d.ts +6 -4
  104. package/dist/fields/Textarea/types.d.ts.map +1 -1
  105. package/dist/fields/Textarea/types.js.map +1 -1
  106. package/dist/fields/Upload/Input.d.ts +6 -4
  107. package/dist/fields/Upload/Input.d.ts.map +1 -1
  108. package/dist/fields/Upload/Input.js +58 -52
  109. package/dist/fields/Upload/Input.js.map +1 -1
  110. package/dist/fields/Upload/index.d.ts.map +1 -1
  111. package/dist/fields/Upload/index.js +6 -0
  112. package/dist/fields/Upload/index.js.map +1 -1
  113. package/dist/forms/RowLabel/types.d.ts +2 -2
  114. package/dist/forms/RowLabel/types.d.ts.map +1 -1
  115. package/dist/forms/RowLabel/types.js.map +1 -1
  116. package/dist/providers/Config/createClientConfig/collections.d.ts.map +1 -1
  117. package/dist/providers/Config/createClientConfig/collections.js +12 -4
  118. package/dist/providers/Config/createClientConfig/collections.js.map +1 -1
  119. package/dist/providers/Config/createClientConfig/fields.d.ts.map +1 -1
  120. package/dist/providers/Config/createClientConfig/fields.js +19 -14
  121. package/dist/providers/Config/createClientConfig/fields.js.map +1 -1
  122. package/dist/providers/Config/createClientConfig/getCreateMappedComponent.d.ts.map +1 -1
  123. package/dist/providers/Config/createClientConfig/getCreateMappedComponent.js +10 -4
  124. package/dist/providers/Config/createClientConfig/getCreateMappedComponent.js.map +1 -1
  125. package/dist/providers/Config/createClientConfig/globals.d.ts.map +1 -1
  126. package/dist/providers/Config/createClientConfig/globals.js +6 -2
  127. package/dist/providers/Config/createClientConfig/globals.js.map +1 -1
  128. package/package.json +5 -5
@@ -1,6 +1,6 @@
1
- import{isReactServerComponentOrFunction as x}from"payload/shared";import h from"react";var b=({Component:o,serverOnlyProps:t,...e})=>o?h.createElement(r=>{let s={...r,...x(o)?t??{}:{}};return h.createElement(o,{...s})},{...e}):null;import{isReactServerComponentOrFunction as R,serverProps as L}from"payload/shared";import F from"react";function I({Component:o,sanitizeServerOnlyProps:t,toMergeIntoProps:e}){return t===void 0&&(t=!R(o)),r=>{let s=T(r,e);return t&&L.forEach(n=>{delete s[n]}),F.createElement(o,{...s})}}function T(o,t){return{...o,...t}}import C from"react";var w=({fill:o})=>{let t=o||"var(--theme-elevation-1000)";return C.createElement("svg",{className:"graphic-icon",height:"100%",viewBox:"0 0 25 25",width:"100%",xmlns:"http://www.w3.org/2000/svg"},C.createElement("path",{d:"M11.5293 0L23 6.90096V19.9978L14.3608 25V11.9032L2.88452 5.00777L11.5293 0Z",fill:t}),C.createElement("path",{d:"M10.6559 24.2727V14.0518L2 19.0651L10.6559 24.2727Z",fill:t}))};import d from"react";var D=`
1
+ import{isReactServerComponentOrFunction as R}from"payload/shared";import S from"react";var L=({Component:o,serverOnlyProps:t,...e})=>o?S.createElement(r=>{let i={...r,...R(o)?t??{}:{}};return S.createElement(o,{...i})},{...e}):null;import{isReactServerComponentOrFunction as F,serverProps as I}from"payload/shared";import T from"react";function w({Component:o,sanitizeServerOnlyProps:t,toMergeIntoProps:e}){return t===void 0&&(t=!F(o)),r=>{let i=D(r,e);return t&&I.forEach(s=>{delete i[s]}),T.createElement(o,{...i})}}function D(o,t){return{...o,...t}}import g from"react";var H=({fill:o})=>{let t=o||"var(--theme-elevation-1000)";return g.createElement("svg",{className:"graphic-icon",height:"100%",viewBox:"0 0 25 25",width:"100%",xmlns:"http://www.w3.org/2000/svg"},g.createElement("path",{d:"M11.5293 0L23 6.90096V19.9978L14.3608 25V11.9032L2.88452 5.00777L11.5293 0Z",fill:t}),g.createElement("path",{d:"M10.6559 24.2727V14.0518L2 19.0651L10.6559 24.2727Z",fill:t}))};import m from"react";var A=`
2
2
  .graphic-logo path {
3
3
  fill: var(--theme-elevation-1000);
4
4
  }
5
- `,H=()=>d.createElement("svg",{className:"graphic-logo",fill:"none",height:"50",viewBox:"0 0 180 50",width:"180",xmlns:"http://www.w3.org/2000/svg"},d.createElement("style",null,D),d.createElement("path",{d:"M65.922 13.8685C71.1075 13.8685 77.0257 14.6014 77.0257 22.2185C77.0257 28.6587 71.8736 30.2243 66.0664 30.2243H62.2689V39.0961H57.2944V13.8685H65.922ZM62.2689 17.7659V26.3602H66.3773C69.4752 26.3602 71.9069 25.594 71.9069 22.2518C71.9069 18.1101 68.7424 17.7659 66.022 17.7659H62.2689Z"}),d.createElement("path",{d:"M84.3209 39.5514C80.7344 39.5514 77.5698 37.4639 77.5698 34.0884C77.5698 29.6358 82.5443 28.3145 89.8949 27.4706V27.1264C89.8949 24.2394 88.3626 23.2623 86.3084 23.2623C84.2542 23.2623 82.7219 24.2394 82.622 26.2936H78.1361C78.4803 22.6072 81.7226 19.8867 86.4861 19.8867C91.1163 19.8867 94.7028 21.7633 94.7028 28.1035C94.7028 28.692 94.6362 31.2014 94.6362 32.9114C94.6362 35.865 94.8472 37.5416 95.1914 39.1073H90.7721C90.6278 38.5188 90.4945 37.6083 90.4279 36.7089C89.0844 38.6853 87.1412 39.5514 84.3209 39.5514ZM90.0282 30.5463C84.6651 31.1015 82.511 31.7344 82.511 33.8219C82.511 35.1766 83.588 36.298 85.7532 36.298C88.7512 36.298 90.0393 34.5547 90.0393 31.4901V30.5463H90.0282Z"}),d.createElement("path",{d:"M97.2899 45.1921V41.5057H99.0998C100.699 41.5057 101.432 41.539 102.231 39.5514L102.442 39.0295L95.269 20.3753H100.521L104.763 33.8774L109.115 20.3753H113.99L107.139 38.541C104.951 44.3593 103.974 45.1921 99.3108 45.1921H97.2899Z"}),d.createElement("path",{d:"M120.263 39.1073H115.456V13.8685H120.263V39.1073Z"}),d.createElement("path",{d:"M122.406 29.7801C122.406 23.2067 126.826 19.9645 131.7 19.9645C136.575 19.9645 140.994 23.2067 140.994 29.7801C140.994 36.3535 136.575 39.5625 131.7 39.5625C126.826 39.5514 122.406 36.3535 122.406 29.7801ZM127.281 29.7801C127.281 33.6775 128.913 35.7984 131.7 35.7984C134.487 35.7984 136.119 33.6775 136.119 29.7801C136.119 25.8494 134.487 23.7286 131.7 23.7286C128.913 23.7286 127.281 25.8383 127.281 29.7801Z"}),d.createElement("path",{d:"M149.167 39.5514C145.58 39.5514 142.416 37.4639 142.416 34.0884C142.416 29.6358 147.39 28.3145 154.741 27.4706V27.1264C154.741 24.2394 153.208 23.2623 151.154 23.2623C149.1 23.2623 147.568 24.2394 147.468 26.2936H142.982C143.326 22.6072 146.568 19.8867 151.332 19.8867C155.962 19.8867 159.549 21.7633 159.549 28.1035C159.549 28.692 159.482 31.2014 159.482 32.9114C159.482 35.865 159.693 37.5416 160.037 39.1073H155.618C155.473 38.5188 155.34 37.6083 155.274 36.7089C153.941 38.6853 151.987 39.5514 149.167 39.5514ZM154.874 30.5463C149.511 31.1015 147.357 31.7344 147.357 33.8219C147.357 35.1766 148.434 36.298 150.599 36.298C153.597 36.298 154.885 34.5547 154.885 31.4901V30.5463H154.874Z"}),d.createElement("path",{d:"M175.06 39.1073V36.7422C173.872 38.7964 171.618 39.5625 169.664 39.5625C165.067 39.5625 161.625 35.7317 161.625 29.7468C161.625 23.8619 165 19.9645 169.664 19.9645C172.029 19.9645 174.05 21.0415 175.06 22.7848V13.8796H179.868V39.1073H175.06ZM175.238 29.7357C175.238 25.9716 173.494 23.6398 170.852 23.6398C168.242 23.6398 166.677 26.1159 166.677 29.7691C166.677 33.4222 168.242 35.865 170.852 35.865C173.494 35.865 175.238 33.5665 175.238 29.7357Z"}),d.createElement("path",{d:"M19.1531 0L42.049 13.8019V39.9956L24.8049 50V23.8064L1.89795 10.0155L19.1531 0Z"}),d.createElement("path",{d:"M17.4097 48.5454V28.1035L0.132324 38.1301L17.4097 48.5454Z"}));import{isReactServerComponentOrFunction as A}from"payload/shared";import f from"react";var u=({Component:o,clientProps:t={},mappedComponent:e,serverProps:i})=>{if(!e&&o){if(Array.isArray(o))return o.map((s,n)=>f.createElement(u,{Component:s,clientProps:t,key:n,serverProps:i}));let r=A(o)?{type:"server",Component:o,RenderedComponent:null}:{type:"client",Component:o};return f.createElement(u,{clientProps:t,mappedComponent:r,serverProps:i})}return e?Array.isArray(e)?e.map((r,s)=>f.createElement(u,{clientProps:t,key:s,mappedComponent:r,serverProps:i})):e.type==="empty"?null:e.RenderedComponent?e.RenderedComponent:e.Component?e.type==="server"?e.props?f.createElement(e.Component,{...e.props,...i,...t}):f.createElement(e.Component,{...i,...t}):e.props?f.createElement(e.Component,{...e.props,...t}):f.createElement(e.Component,{...t}):null:null};import{parsePayloadComponent as G}from"payload/shared";var c=({identifier:o,importMap:t,payloadComponent:e,silent:i})=>{if(!e)return{Component:void 0,clientProps:void 0,serverProps:void 0};let{exportName:r,path:s}=G(e),n=s+"#"+r,a=t[n];return!a&&!i&&console.error("getComponent: Component not found in importMap",{identifier:o,key:n,payloadComponent:e},"You may need to run the `payload generate:importmap` command to generate the importMap ahead of runtime."),{Component:a,clientProps:typeof e=="object"?e.clientProps:void 0,serverProps:typeof e=="object"?e.serverProps:void 0}};import{isReactServerComponentOrFunction as P}from"payload/shared";import S from"react";function V({importMap:o,serverProps:t}){let e=(r,s,n,a,p)=>{if(r==null){if(!a)return;if(P(a))return{type:"server",Component:null,RenderedComponent:S.createElement(a,{key:s,...t,...n})};{let m={type:"client",Component:a};return n&&(m.props=n),m}}if(r===!1)return{type:"empty"};let l=r&&typeof r=="object"&&"ReactComponent"in r?{Component:r.ReactComponent}:c({identifier:p,importMap:o,payloadComponent:r});if(l.Component||console.error("getCreateMappedComponent: Component not found in importMap",{identifier:p,key:s}),P(l.Component)){let m=l.Component;return{type:"server",Component:null,RenderedComponent:S.createElement(m,{key:s,...t,...l.serverProps,...n})}}else return l.Component?{type:"client",Component:l.Component,props:{...l.clientProps||{},...n}}:void 0};return(r,s,n,a)=>{if(!(r==null&&!n))if(r&&Array.isArray(r)){let p=[];for(let l=0;l<r.length;l++){let m=e(r[l],l,s,n,a);p.push(m)}return p}else return e(r,void 0,s,n,a)}}import*as v from"qs-esm";var $={delete:(o,t={headers:{}})=>{let e=t&&t.headers?{...t.headers}:{},i={...t,credentials:"include",headers:{...e},method:"delete"};return fetch(o,i)},get:(o,t={headers:{}})=>{let e="";return t.params&&(e=v.stringify(t.params,{addQueryPrefix:!0})),fetch(`${o}${e}`,{credentials:"include",...t})},patch:(o,t={headers:{}})=>{let e=t&&t.headers?{...t.headers}:{},i={...t,credentials:"include",headers:{...e},method:"PATCH"};return fetch(o,i)},post:(o,t={headers:{}})=>{let e=t&&t.headers?{...t.headers}:{},i={...t,credentials:"include",headers:{...e},method:"post"};return fetch(`${o}`,i)},put:(o,t={headers:{}})=>{let e=t&&t.headers?{...t.headers}:{},i={...t,credentials:"include",headers:{...e},method:"put"};return fetch(o,i)}};var Z=(o,t)=>!o?.locales||o.locales.length===0?null:o.locales.find(e=>e?.code===t);var q=o=>{let{adminRoute:t,basePath:e="",path:i,serverURL:r}=o;if(t)if(t==="/"){if(!i)return`${r||""}${e}${t}`}else return`${r||""}${e}${t}${i}`;return`${r||""}${e}${i}`};import{format as O,formatDistanceToNow as ce}from"date-fns";var g=({date:o,i18n:t,pattern:e})=>{let i=new Date(o);return O(i,e,{locale:t.dateFNS})};import{getTranslation as j}from"@payloadcms/translations";var E=({collectionConfig:o,data:t,dateFormat:e,fallback:i,globalConfig:r,i18n:s})=>{let n;if(o){let a=o?.admin?.useAsTitle;if(a&&(n=t?.[a]||n,n)){let p=o.fields.find(m=>"name"in m&&m.name===a);if(p?.type==="date"){let m="date"in p.admin&&p?.admin?.date?.displayFormat||e;n=g({date:n,i18n:s,pattern:m})||n}}}return r&&(n=j(r?.label,s)||r?.slug),n||(n=i||`[${s.t("general:untitled")}]`),n};var N=async o=>{let{apiRoute:t,body:e,onError:i,serverURL:r,signal:s,token:n}=o,a=await fetch(`${r}${t}/form-state`,{body:JSON.stringify(e),credentials:"include",headers:{"Content-Type":"application/json",...n?{Authorization:`JWT ${n}`}:{}},method:"POST",signal:s}),p=await a.json();return a.ok?p:(typeof i=="function"&&i(p),e?.formState)};import{getTranslation as y}from"@payloadcms/translations";var M=(e=>(e.collection="collections",e.global="globals",e))(M||{});function z(o,t,e){return o.reduce((r,s)=>{if(t?.[s.type.toLowerCase()]?.[s.entity.slug]?.read.permission){let n=y(s.entity.admin.group,e);if(s.entity.admin.group){let a=r.find(l=>y(l.label,e)===n),p=a;a||(p={entities:[],label:n},r.push(p)),p.entities.push(s)}else r.find(p=>y(p.label,e)===e.t(`general:${s.type}`)).entities.push(s)}return r},[{entities:[],label:e.t("general:collections")},{entities:[],label:e.t("general:globals")}]).filter(r=>r.entities.length>0)}var W=o=>{let{collectionSlug:t,docPermissions:e,globalSlug:i,isEditing:r}=o;return t?!!(r&&e?.update?.permission||!r&&e?.create?.permission):i?!!e?.update?.permission:!1};var U=({id:o,collectionSlug:t,globalSlug:e})=>!!(e||t&&o);export{M as EntityType,w as PayloadIcon,H as PayloadLogo,u as RenderComponent,b as WithServerSideProps,Z as findLocaleFromCode,q as formatAdminURL,g as formatDate,E as formatDocTitle,c as getComponent,V as getCreateMappedComponent,N as getFormState,z as groupNavItems,W as hasSavePermission,U as isEditing,$ as requests,I as withMergedProps};
5
+ `,G=()=>m.createElement("svg",{className:"graphic-logo",fill:"none",height:"50",viewBox:"0 0 180 50",width:"180",xmlns:"http://www.w3.org/2000/svg"},m.createElement("style",null,A),m.createElement("path",{d:"M65.922 13.8685C71.1075 13.8685 77.0257 14.6014 77.0257 22.2185C77.0257 28.6587 71.8736 30.2243 66.0664 30.2243H62.2689V39.0961H57.2944V13.8685H65.922ZM62.2689 17.7659V26.3602H66.3773C69.4752 26.3602 71.9069 25.594 71.9069 22.2518C71.9069 18.1101 68.7424 17.7659 66.022 17.7659H62.2689Z"}),m.createElement("path",{d:"M84.3209 39.5514C80.7344 39.5514 77.5698 37.4639 77.5698 34.0884C77.5698 29.6358 82.5443 28.3145 89.8949 27.4706V27.1264C89.8949 24.2394 88.3626 23.2623 86.3084 23.2623C84.2542 23.2623 82.7219 24.2394 82.622 26.2936H78.1361C78.4803 22.6072 81.7226 19.8867 86.4861 19.8867C91.1163 19.8867 94.7028 21.7633 94.7028 28.1035C94.7028 28.692 94.6362 31.2014 94.6362 32.9114C94.6362 35.865 94.8472 37.5416 95.1914 39.1073H90.7721C90.6278 38.5188 90.4945 37.6083 90.4279 36.7089C89.0844 38.6853 87.1412 39.5514 84.3209 39.5514ZM90.0282 30.5463C84.6651 31.1015 82.511 31.7344 82.511 33.8219C82.511 35.1766 83.588 36.298 85.7532 36.298C88.7512 36.298 90.0393 34.5547 90.0393 31.4901V30.5463H90.0282Z"}),m.createElement("path",{d:"M97.2899 45.1921V41.5057H99.0998C100.699 41.5057 101.432 41.539 102.231 39.5514L102.442 39.0295L95.269 20.3753H100.521L104.763 33.8774L109.115 20.3753H113.99L107.139 38.541C104.951 44.3593 103.974 45.1921 99.3108 45.1921H97.2899Z"}),m.createElement("path",{d:"M120.263 39.1073H115.456V13.8685H120.263V39.1073Z"}),m.createElement("path",{d:"M122.406 29.7801C122.406 23.2067 126.826 19.9645 131.7 19.9645C136.575 19.9645 140.994 23.2067 140.994 29.7801C140.994 36.3535 136.575 39.5625 131.7 39.5625C126.826 39.5514 122.406 36.3535 122.406 29.7801ZM127.281 29.7801C127.281 33.6775 128.913 35.7984 131.7 35.7984C134.487 35.7984 136.119 33.6775 136.119 29.7801C136.119 25.8494 134.487 23.7286 131.7 23.7286C128.913 23.7286 127.281 25.8383 127.281 29.7801Z"}),m.createElement("path",{d:"M149.167 39.5514C145.58 39.5514 142.416 37.4639 142.416 34.0884C142.416 29.6358 147.39 28.3145 154.741 27.4706V27.1264C154.741 24.2394 153.208 23.2623 151.154 23.2623C149.1 23.2623 147.568 24.2394 147.468 26.2936H142.982C143.326 22.6072 146.568 19.8867 151.332 19.8867C155.962 19.8867 159.549 21.7633 159.549 28.1035C159.549 28.692 159.482 31.2014 159.482 32.9114C159.482 35.865 159.693 37.5416 160.037 39.1073H155.618C155.473 38.5188 155.34 37.6083 155.274 36.7089C153.941 38.6853 151.987 39.5514 149.167 39.5514ZM154.874 30.5463C149.511 31.1015 147.357 31.7344 147.357 33.8219C147.357 35.1766 148.434 36.298 150.599 36.298C153.597 36.298 154.885 34.5547 154.885 31.4901V30.5463H154.874Z"}),m.createElement("path",{d:"M175.06 39.1073V36.7422C173.872 38.7964 171.618 39.5625 169.664 39.5625C165.067 39.5625 161.625 35.7317 161.625 29.7468C161.625 23.8619 165 19.9645 169.664 19.9645C172.029 19.9645 174.05 21.0415 175.06 22.7848V13.8796H179.868V39.1073H175.06ZM175.238 29.7357C175.238 25.9716 173.494 23.6398 170.852 23.6398C168.242 23.6398 166.677 26.1159 166.677 29.7691C166.677 33.4222 168.242 35.865 170.852 35.865C173.494 35.865 175.238 33.5665 175.238 29.7357Z"}),m.createElement("path",{d:"M19.1531 0L42.049 13.8019V39.9956L24.8049 50V23.8064L1.89795 10.0155L19.1531 0Z"}),m.createElement("path",{d:"M17.4097 48.5454V28.1035L0.132324 38.1301L17.4097 48.5454Z"}));import{isReactServerComponentOrFunction as V}from"payload/shared";import u from"react";var C=({Component:o,clientProps:t={},mappedComponent:e,serverProps:n})=>{if(!e&&o){if(Array.isArray(o))return o.map((i,s)=>u.createElement(C,{Component:i,clientProps:t,key:s,serverProps:n}));let r=V(o)?{type:"server",Component:o,RenderedComponent:null}:{type:"client",Component:o};return u.createElement(C,{clientProps:t,mappedComponent:r,serverProps:n})}return e?Array.isArray(e)?e.map((r,i)=>u.createElement(C,{clientProps:t,key:i,mappedComponent:r,serverProps:n})):e.type==="empty"?null:e.RenderedComponent?e.RenderedComponent:e.Component?e.type==="server"?e.props?u.createElement(e.Component,{...e.props,...n,...t}):u.createElement(e.Component,{...n,...t}):e.props?u.createElement(e.Component,{...e.props,...t}):u.createElement(e.Component,{...t}):null:null};import{parsePayloadComponent as $}from"payload/shared";var y=({identifier:o,importMap:t,payloadComponent:e,silent:n})=>{if(!e)return{Component:void 0,clientProps:void 0,serverProps:void 0};let{exportName:r,path:i}=$(e),s=i+"#"+r,a=t[s];return!a&&!n&&console.error("getComponent: Component not found in importMap",{identifier:o,key:s,payloadComponent:e},"You may need to run the `payload generate:importmap` command to generate the importMap ahead of runtime."),{Component:a,clientProps:typeof e=="object"?e.clientProps:void 0,serverProps:typeof e=="object"?e.serverProps:void 0}};import{isReactServerComponentOrFunction as v}from"payload/shared";import M from"react";function Z({importMap:o,serverProps:t}){let e=(r,i,s,a,p)=>{let{clientProps:l,serverProps:d}=s||{};if(r==null){if(!a)return;if(v(a))return{type:"server",Component:null,RenderedComponent:M.createElement(a,{key:i,...t,...d,...l})};{let c={type:"client",Component:a};return l&&(c.props=l),c}}if(r===!1)return{type:"empty"};let f=r&&typeof r=="object"&&"ReactComponent"in r?{Component:r.ReactComponent}:y({identifier:p,importMap:o,payloadComponent:r});if(f.Component||console.error("getCreateMappedComponent: Component not found in importMap",{identifier:p,key:i}),v(f.Component)){let c=f.Component;return{type:"server",Component:null,RenderedComponent:M.createElement(c,{key:i,...t,...f.serverProps,...d,...l})}}else return f.Component?{type:"client",Component:f.Component,props:{...f.clientProps||{},...l}}:void 0};return(r,i,s,a)=>{if(!(r==null&&!s))if(r&&Array.isArray(r)){let p=[];for(let l=0;l<r.length;l++){let d=e(r[l],l,i,s,a);p.push(d)}return p}else return e(r,void 0,i,s,a)}}import*as x from"qs-esm";var j={delete:(o,t={headers:{}})=>{let e=t&&t.headers?{...t.headers}:{},n={...t,credentials:"include",headers:{...e},method:"delete"};return fetch(o,n)},get:(o,t={headers:{}})=>{let e="";return t.params&&(e=x.stringify(t.params,{addQueryPrefix:!0})),fetch(`${o}${e}`,{credentials:"include",...t})},patch:(o,t={headers:{}})=>{let e=t&&t.headers?{...t.headers}:{},n={...t,credentials:"include",headers:{...e},method:"PATCH"};return fetch(o,n)},post:(o,t={headers:{}})=>{let e=t&&t.headers?{...t.headers}:{},n={...t,credentials:"include",headers:{...e},method:"post"};return fetch(`${o}`,n)},put:(o,t={headers:{}})=>{let e=t&&t.headers?{...t.headers}:{},n={...t,credentials:"include",headers:{...e},method:"put"};return fetch(o,n)}};var q=(o,t)=>!o?.locales||o.locales.length===0?null:o.locales.find(e=>e?.code===t);var O=o=>{let{adminRoute:t,basePath:e="",path:n,serverURL:r}=o;if(t)if(t==="/"){if(!n)return`${r||""}${e}${t}`}else return`${r||""}${e}${t}${n}`;return`${r||""}${e}${n}`};import{format as E,formatDistanceToNow as ye}from"date-fns";var h=({date:o,i18n:t,pattern:e})=>{let n=new Date(o);return E(n,e,{locale:t.dateFNS})};import{getTranslation as N}from"@payloadcms/translations";var z=({collectionConfig:o,data:t,dateFormat:e,fallback:n,globalConfig:r,i18n:i})=>{let s;if(o){let a=o?.admin?.useAsTitle;if(a&&(s=t?.[a]||s,s)){let p=o.fields.find(d=>"name"in d&&d.name===a);if(p?.type==="date"){let d="date"in p.admin&&p?.admin?.date?.displayFormat||e;s=h({date:s,i18n:i,pattern:d})||s}}}return r&&(s=N(r?.label,i)||r?.slug),s||(s=n||`[${i.t("general:untitled")}]`),s};var W=async o=>{let{apiRoute:t,body:e,onError:n,serverURL:r,signal:i,token:s}=o,a=await fetch(`${r}${t}/form-state`,{body:JSON.stringify(e),credentials:"include",headers:{"Content-Type":"application/json",...s?{Authorization:`JWT ${s}`}:{}},method:"POST",signal:i}),p=await a.json();return a.ok?p:(typeof n=="function"&&n(p),e?.formState)};import{getTranslation as P}from"@payloadcms/translations";var b=(e=>(e.collection="collections",e.global="globals",e))(b||{});function U(o,t,e){return o.reduce((r,i)=>{if(t?.[i.type.toLowerCase()]?.[i.entity.slug]?.read.permission){let s=P(i.entity.admin.group,e);if(i.entity.admin.group){let a=r.find(l=>P(l.label,e)===s),p=a;a||(p={entities:[],label:s},r.push(p)),p.entities.push(i)}else r.find(p=>P(p.label,e)===e.t(`general:${i.type}`)).entities.push(i)}return r},[{entities:[],label:e.t("general:collections")},{entities:[],label:e.t("general:globals")}]).filter(r=>r.entities.length>0)}var B=o=>{let{collectionSlug:t,docPermissions:e,globalSlug:n,isEditing:r}=o;return t?!!(r&&e?.update?.permission||!r&&e?.create?.permission):n?!!e?.update?.permission:!1};var k=({id:o,collectionSlug:t,globalSlug:e})=>!!(e||t&&o);export{b as EntityType,H as PayloadIcon,G as PayloadLogo,C as RenderComponent,L as WithServerSideProps,q as findLocaleFromCode,O as formatAdminURL,h as formatDate,z as formatDocTitle,y as getComponent,Z as getCreateMappedComponent,W as getFormState,U as groupNavItems,B as hasSavePermission,k as isEditing,j as requests,w as withMergedProps};
6
6
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/elements/WithServerSideProps/index.tsx", "../../../src/elements/withMergedProps/index.tsx", "../../../src/graphics/Icon/index.tsx", "../../../src/graphics/Logo/index.tsx", "../../../src/providers/Config/RenderComponent.tsx", "../../../src/providers/Config/createClientConfig/getComponent.ts", "../../../src/providers/Config/createClientConfig/getCreateMappedComponent.tsx", "../../../src/utilities/api.ts", "../../../src/utilities/findLocaleFromCode.ts", "../../../src/utilities/formatAdminURL.ts", "../../../src/utilities/formatDate.ts", "../../../src/utilities/formatDocTitle.ts", "../../../src/utilities/getFormState.ts", "../../../src/utilities/groupNavItems.ts", "../../../src/utilities/hasSavePermission.ts", "../../../src/utilities/isEditing.ts"],
4
- "sourcesContent": ["import type { WithServerSidePropsComponent } from 'payload'\n\nimport { isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\nexport const WithServerSideProps: WithServerSidePropsComponent = ({\n Component,\n serverOnlyProps,\n ...rest\n}) => {\n if (Component) {\n const WithServerSideProps: React.FC = (passedProps) => {\n const propsWithServerOnlyProps = {\n ...passedProps,\n ...(isReactServerComponentOrFunction(Component) ? serverOnlyProps ?? {} : {}),\n }\n\n return <Component {...propsWithServerOnlyProps} />\n }\n\n return <WithServerSideProps {...rest} />\n }\n\n return null\n}\n", "import { isReactServerComponentOrFunction, serverProps } from 'payload/shared'\nimport React from 'react'\n\n/**\n * Creates a higher-order component (HOC) that merges predefined properties (`toMergeIntoProps`)\n * with any properties passed to the resulting component.\n *\n * Use this when you want to pre-specify some props for a component, while also allowing users to\n * pass in their own props. The HOC ensures the passed props and predefined props are combined before\n * rendering the original component.\n *\n * @example\n * const PredefinedComponent = getMergedPropsComponent({\n * Component: OriginalComponent,\n * toMergeIntoProps: { someExtraValue: 5 }\n * });\n * // Using <PredefinedComponent customProp=\"value\" /> will result in\n * // <OriginalComponent customProp=\"value\" someExtraValue={5} />\n *\n * @returns A higher-order component with combined properties.\n *\n * @param Component - The original component to wrap.\n * @param sanitizeServerOnlyProps - If true, server-only props will be removed from the merged props. @default true if the component is not a server component, false otherwise.\n * @param toMergeIntoProps - The properties to merge into the passed props.\n */\nexport function withMergedProps<ToMergeIntoProps, CompleteReturnProps>({\n Component,\n sanitizeServerOnlyProps,\n toMergeIntoProps,\n}: {\n Component: React.FC<CompleteReturnProps>\n sanitizeServerOnlyProps?: boolean\n toMergeIntoProps: ToMergeIntoProps\n}): React.FC<CompleteReturnProps> {\n if (sanitizeServerOnlyProps === undefined) {\n sanitizeServerOnlyProps = !isReactServerComponentOrFunction(Component)\n }\n // A wrapper around the args.Component to inject the args.toMergeArgs as props, which are merged with the passed props\n const MergedPropsComponent: React.FC<CompleteReturnProps> = (passedProps) => {\n const mergedProps = simpleMergeProps(passedProps, toMergeIntoProps) as CompleteReturnProps\n\n if (sanitizeServerOnlyProps) {\n serverProps.forEach((prop) => {\n delete mergedProps[prop]\n })\n }\n\n return <Component {...mergedProps} />\n }\n\n return MergedPropsComponent\n}\n\nfunction simpleMergeProps(props, toMerge) {\n return { ...props, ...toMerge }\n}\n", "import React from 'react'\n\nexport const PayloadIcon: React.FC<{\n fill?: string\n}> = ({ fill: fillFromProps }) => {\n const fill = fillFromProps || 'var(--theme-elevation-1000)'\n\n return (\n <svg\n className=\"graphic-icon\"\n height=\"100%\"\n viewBox=\"0 0 25 25\"\n width=\"100%\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M11.5293 0L23 6.90096V19.9978L14.3608 25V11.9032L2.88452 5.00777L11.5293 0Z\"\n fill={fill}\n />\n <path d=\"M10.6559 24.2727V14.0518L2 19.0651L10.6559 24.2727Z\" fill={fill} />\n </svg>\n )\n}\n", "import React from 'react'\n\nconst css = `\n .graphic-logo path {\n fill: var(--theme-elevation-1000);\n }\n`\n\nexport const PayloadLogo: React.FC = () => (\n <svg\n className=\"graphic-logo\"\n fill=\"none\"\n height=\"50\"\n viewBox=\"0 0 180 50\"\n width=\"180\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <style>{css}</style>\n <path d=\"M65.922 13.8685C71.1075 13.8685 77.0257 14.6014 77.0257 22.2185C77.0257 28.6587 71.8736 30.2243 66.0664 30.2243H62.2689V39.0961H57.2944V13.8685H65.922ZM62.2689 17.7659V26.3602H66.3773C69.4752 26.3602 71.9069 25.594 71.9069 22.2518C71.9069 18.1101 68.7424 17.7659 66.022 17.7659H62.2689Z\" />\n <path d=\"M84.3209 39.5514C80.7344 39.5514 77.5698 37.4639 77.5698 34.0884C77.5698 29.6358 82.5443 28.3145 89.8949 27.4706V27.1264C89.8949 24.2394 88.3626 23.2623 86.3084 23.2623C84.2542 23.2623 82.7219 24.2394 82.622 26.2936H78.1361C78.4803 22.6072 81.7226 19.8867 86.4861 19.8867C91.1163 19.8867 94.7028 21.7633 94.7028 28.1035C94.7028 28.692 94.6362 31.2014 94.6362 32.9114C94.6362 35.865 94.8472 37.5416 95.1914 39.1073H90.7721C90.6278 38.5188 90.4945 37.6083 90.4279 36.7089C89.0844 38.6853 87.1412 39.5514 84.3209 39.5514ZM90.0282 30.5463C84.6651 31.1015 82.511 31.7344 82.511 33.8219C82.511 35.1766 83.588 36.298 85.7532 36.298C88.7512 36.298 90.0393 34.5547 90.0393 31.4901V30.5463H90.0282Z\" />\n <path d=\"M97.2899 45.1921V41.5057H99.0998C100.699 41.5057 101.432 41.539 102.231 39.5514L102.442 39.0295L95.269 20.3753H100.521L104.763 33.8774L109.115 20.3753H113.99L107.139 38.541C104.951 44.3593 103.974 45.1921 99.3108 45.1921H97.2899Z\" />\n <path d=\"M120.263 39.1073H115.456V13.8685H120.263V39.1073Z\" />\n <path d=\"M122.406 29.7801C122.406 23.2067 126.826 19.9645 131.7 19.9645C136.575 19.9645 140.994 23.2067 140.994 29.7801C140.994 36.3535 136.575 39.5625 131.7 39.5625C126.826 39.5514 122.406 36.3535 122.406 29.7801ZM127.281 29.7801C127.281 33.6775 128.913 35.7984 131.7 35.7984C134.487 35.7984 136.119 33.6775 136.119 29.7801C136.119 25.8494 134.487 23.7286 131.7 23.7286C128.913 23.7286 127.281 25.8383 127.281 29.7801Z\" />\n <path d=\"M149.167 39.5514C145.58 39.5514 142.416 37.4639 142.416 34.0884C142.416 29.6358 147.39 28.3145 154.741 27.4706V27.1264C154.741 24.2394 153.208 23.2623 151.154 23.2623C149.1 23.2623 147.568 24.2394 147.468 26.2936H142.982C143.326 22.6072 146.568 19.8867 151.332 19.8867C155.962 19.8867 159.549 21.7633 159.549 28.1035C159.549 28.692 159.482 31.2014 159.482 32.9114C159.482 35.865 159.693 37.5416 160.037 39.1073H155.618C155.473 38.5188 155.34 37.6083 155.274 36.7089C153.941 38.6853 151.987 39.5514 149.167 39.5514ZM154.874 30.5463C149.511 31.1015 147.357 31.7344 147.357 33.8219C147.357 35.1766 148.434 36.298 150.599 36.298C153.597 36.298 154.885 34.5547 154.885 31.4901V30.5463H154.874Z\" />\n <path d=\"M175.06 39.1073V36.7422C173.872 38.7964 171.618 39.5625 169.664 39.5625C165.067 39.5625 161.625 35.7317 161.625 29.7468C161.625 23.8619 165 19.9645 169.664 19.9645C172.029 19.9645 174.05 21.0415 175.06 22.7848V13.8796H179.868V39.1073H175.06ZM175.238 29.7357C175.238 25.9716 173.494 23.6398 170.852 23.6398C168.242 23.6398 166.677 26.1159 166.677 29.7691C166.677 33.4222 168.242 35.865 170.852 35.865C173.494 35.865 175.238 33.5665 175.238 29.7357Z\" />\n <path d=\"M19.1531 0L42.049 13.8019V39.9956L24.8049 50V23.8064L1.89795 10.0155L19.1531 0Z\" />\n <path d=\"M17.4097 48.5454V28.1035L0.132324 38.1301L17.4097 48.5454Z\" />\n </svg>\n)\n", "import type { MappedComponent } from 'payload'\n\nimport { isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\n/**\n * Can be used to render both MappedComponents and React Components.\n */\nexport const RenderComponent: React.FC<{\n readonly Component?: React.ComponentType | React.ComponentType[]\n readonly clientProps?: object\n readonly mappedComponent?: MappedComponent | MappedComponent[]\n readonly serverProps?: object\n}> = ({ Component, clientProps = {}, mappedComponent, serverProps }) => {\n if (!mappedComponent && Component) {\n if (Array.isArray(Component)) {\n return Component.map((c, index) => (\n <RenderComponent\n Component={c}\n clientProps={clientProps}\n key={index}\n serverProps={serverProps}\n />\n ))\n }\n\n const mappedComponent: MappedComponent = isReactServerComponentOrFunction(Component)\n ? {\n type: 'server',\n Component,\n RenderedComponent: null,\n }\n : {\n type: 'client',\n Component,\n }\n\n return (\n <RenderComponent\n clientProps={clientProps}\n mappedComponent={mappedComponent}\n serverProps={serverProps}\n />\n )\n }\n if (!mappedComponent) {\n return null\n }\n\n if (Array.isArray(mappedComponent)) {\n return mappedComponent.map((c, index) => (\n <RenderComponent\n clientProps={clientProps}\n key={index}\n mappedComponent={c}\n serverProps={serverProps}\n />\n ))\n }\n\n if (mappedComponent.type === 'empty') {\n return null\n }\n\n if (mappedComponent.RenderedComponent) {\n return mappedComponent.RenderedComponent\n }\n\n if (!mappedComponent.Component) {\n return null\n }\n\n if (mappedComponent.type === 'server') {\n if (mappedComponent.props) {\n return (\n <mappedComponent.Component {...mappedComponent.props} {...serverProps} {...clientProps} />\n )\n }\n\n return <mappedComponent.Component {...serverProps} {...clientProps} />\n }\n\n if (mappedComponent.props) {\n return <mappedComponent.Component {...mappedComponent.props} {...clientProps} />\n }\n\n return <mappedComponent.Component {...clientProps} />\n}\n", "import type { ImportMap, PayloadComponent, ResolvedComponent } from 'payload'\n\nimport { parsePayloadComponent } from 'payload/shared'\n\n/**\n * Gets the resolved React component from `PayloadComponent` from the importMap\n */\nexport const getComponent = <\n TComponentServerProps extends object,\n TComponentClientProps extends object,\n>({\n identifier,\n importMap,\n payloadComponent,\n silent,\n}: {\n identifier?: string\n importMap: ImportMap\n payloadComponent:\n | PayloadComponent<TComponentServerProps, TComponentClientProps>\n | null\n | undefined\n silent?: boolean\n}): ResolvedComponent<TComponentServerProps, TComponentClientProps> => {\n if (!payloadComponent) {\n // undefined, null or false\n return {\n Component: undefined,\n clientProps: undefined,\n serverProps: undefined,\n }\n }\n\n const { exportName, path } = parsePayloadComponent(payloadComponent)\n\n const key = path + '#' + exportName\n\n const Component = importMap[key]\n\n if (!Component && !silent) {\n console.error(\n `getComponent: Component not found in importMap`,\n {\n identifier,\n key,\n payloadComponent,\n },\n 'You may need to run the `payload generate:importmap` command to generate the importMap ahead of runtime.',\n )\n }\n\n return {\n Component,\n clientProps:\n typeof payloadComponent === 'object'\n ? (payloadComponent.clientProps as TComponentClientProps)\n : undefined,\n serverProps:\n typeof payloadComponent === 'object'\n ? (payloadComponent.serverProps as TComponentServerProps)\n : undefined,\n }\n}\n", "import type { I18nClient } from '@payloadcms/translations'\nimport type {\n CreateMappedComponent,\n ImportMap,\n JsonObject,\n MappedComponent,\n Payload,\n PayloadComponent,\n} from 'payload'\n\nimport { isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\nimport { getComponent } from './getComponent.js'\n\nexport function getCreateMappedComponent({\n importMap,\n serverProps,\n}: {\n importMap: ImportMap\n serverProps: {\n [key: string]: any\n i18n?: I18nClient\n payload?: Payload\n }\n}): CreateMappedComponent {\n const createSingleMappedComponent = (\n payloadComponent: { ReactComponent: React.FC<any> } | PayloadComponent,\n key: number | string,\n props: JsonObject,\n Fallback: React.FC<any>,\n identifier: string,\n ): MappedComponent => {\n if (payloadComponent === undefined || payloadComponent === null) {\n if (!Fallback) {\n return undefined\n }\n\n if (isReactServerComponentOrFunction(Fallback)) {\n return {\n type: 'server',\n Component: null,\n RenderedComponent: <Fallback key={key} {...serverProps} {...props} />,\n }\n } else {\n const toReturn: MappedComponent = {\n type: 'client',\n Component: Fallback,\n }\n\n // conditionally set props here to avoid bloating the HTML with `$undefined` props\n if (props) toReturn.props = props\n\n return toReturn\n }\n }\n\n if (payloadComponent === false) {\n return {\n type: 'empty',\n }\n }\n\n const resolvedComponent =\n payloadComponent &&\n typeof payloadComponent === 'object' &&\n 'ReactComponent' in payloadComponent\n ? {\n Component: payloadComponent.ReactComponent,\n }\n : getComponent({\n identifier,\n importMap,\n payloadComponent: payloadComponent as any,\n })\n\n if (!resolvedComponent.Component) {\n console.error(`getCreateMappedComponent: Component not found in importMap`, {\n identifier,\n key,\n })\n }\n\n if (isReactServerComponentOrFunction(resolvedComponent.Component)) {\n const Component: React.FC<any> = resolvedComponent.Component\n\n return {\n type: 'server',\n Component: null,\n RenderedComponent: (\n <Component key={key} {...serverProps} {...resolvedComponent.serverProps} {...props} />\n ),\n }\n } else {\n if (!resolvedComponent.Component) {\n return undefined\n }\n\n return {\n type: 'client',\n Component: resolvedComponent.Component,\n props: {\n ...(resolvedComponent.clientProps || {}),\n ...props,\n },\n }\n }\n }\n\n const createMappedComponent: CreateMappedComponent = (\n payloadComponent,\n props,\n fallback,\n identifier,\n ) => {\n if ((payloadComponent === undefined || payloadComponent === null) && !fallback) {\n return undefined as any\n }\n\n if (payloadComponent && Array.isArray(payloadComponent)) {\n const mappedComponents: MappedComponent[] = []\n for (let i = 0; i < payloadComponent.length; i++) {\n const component = createSingleMappedComponent(\n payloadComponent[i],\n i,\n props,\n fallback,\n identifier,\n )\n mappedComponents.push(component)\n }\n return mappedComponents as any\n } else {\n return createSingleMappedComponent(\n payloadComponent,\n undefined,\n props,\n fallback,\n identifier,\n ) as any\n }\n }\n\n return createMappedComponent\n}\n", "import * as qs from 'qs-esm'\n\ntype GetOptions = {\n params?: Record<string, unknown>\n} & RequestInit\n\nexport const requests = {\n delete: (url: string, options: RequestInit = { headers: {} }): Promise<Response> => {\n const headers = options && options.headers ? { ...options.headers } : {}\n\n const formattedOptions: RequestInit = {\n ...options,\n credentials: 'include',\n headers: {\n ...headers,\n },\n method: 'delete',\n }\n\n return fetch(url, formattedOptions)\n },\n\n get: (url: string, options: GetOptions = { headers: {} }): Promise<Response> => {\n let query = ''\n if (options.params) {\n query = qs.stringify(options.params, { addQueryPrefix: true })\n }\n return fetch(`${url}${query}`, {\n credentials: 'include',\n ...options,\n })\n },\n\n patch: (url: string, options: RequestInit = { headers: {} }): Promise<Response> => {\n const headers = options && options.headers ? { ...options.headers } : {}\n\n const formattedOptions: RequestInit = {\n ...options,\n credentials: 'include',\n headers: {\n ...headers,\n },\n method: 'PATCH',\n }\n\n return fetch(url, formattedOptions)\n },\n\n post: (url: string, options: RequestInit = { headers: {} }): Promise<Response> => {\n const headers = options && options.headers ? { ...options.headers } : {}\n\n const formattedOptions: RequestInit = {\n ...options,\n credentials: 'include',\n headers: {\n ...headers,\n },\n method: 'post',\n }\n\n return fetch(`${url}`, formattedOptions)\n },\n\n put: (url: string, options: RequestInit = { headers: {} }): Promise<Response> => {\n const headers = options && options.headers ? { ...options.headers } : {}\n\n const formattedOptions: RequestInit = {\n ...options,\n credentials: 'include',\n headers: {\n ...headers,\n },\n method: 'put',\n }\n\n return fetch(url, formattedOptions)\n },\n}\n", "import type { Locale, SanitizedLocalizationConfig } from 'payload'\n/*\n return the Locale for given locale code, else return null\n*/\nexport const findLocaleFromCode = (\n localizationConfig: SanitizedLocalizationConfig,\n locale: string,\n): Locale | null => {\n if (!localizationConfig?.locales || localizationConfig.locales.length === 0) {\n return null\n }\n\n return localizationConfig.locales.find((el) => el?.code === locale)\n}\n", "import type { Config } from 'payload'\n\n/** Will read the `routes.admin` config and appropriately handle `\"/\"` admin paths */\nexport const formatAdminURL = (args: {\n adminRoute: Config['routes']['admin']\n basePath?: string\n path: string\n serverURL?: Config['serverURL']\n}): string => {\n const { adminRoute, basePath = '', path, serverURL } = args\n\n if (adminRoute) {\n if (adminRoute === '/') {\n if (!path) {\n return `${serverURL || ''}${basePath}${adminRoute}`\n }\n } else {\n return `${serverURL || ''}${basePath}${adminRoute}${path}`\n }\n }\n\n return `${serverURL || ''}${basePath}${path}`\n}\n", "import type { I18n } from '@payloadcms/translations'\n\nimport { format, formatDistanceToNow } from 'date-fns'\n\ntype FormatDateArgs = {\n date: Date | number | string | undefined\n i18n: I18n<any, any>\n pattern: string\n}\n\nexport const formatDate = ({ date, i18n, pattern }: FormatDateArgs): string => {\n const theDate = new Date(date)\n return format(theDate, pattern, { locale: i18n.dateFNS })\n}\n\ntype FormatTimeToNowArgs = {\n date: Date | number | string | undefined\n i18n: I18n<any, any>\n}\n\nexport const formatTimeToNow = ({ date, i18n }: FormatTimeToNowArgs): string => {\n const theDate = new Date(date)\n return formatDistanceToNow(theDate, { locale: i18n.dateFNS })\n}\n", "import type { I18n } from '@payloadcms/translations'\nimport type {\n ClientCollectionConfig,\n ClientGlobalConfig,\n SanitizedConfig,\n TypeWithID,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport { formatDate } from '../utilities/formatDate.js'\n\nexport const formatDocTitle = ({\n collectionConfig,\n data,\n dateFormat: dateFormatFromConfig,\n fallback,\n globalConfig,\n i18n,\n}: {\n collectionConfig?: ClientCollectionConfig\n data: TypeWithID\n dateFormat: SanitizedConfig['admin']['dateFormat']\n fallback?: string\n globalConfig?: ClientGlobalConfig\n i18n: I18n<any, any>\n}): string => {\n let title: string\n\n if (collectionConfig) {\n const useAsTitle = collectionConfig?.admin?.useAsTitle\n\n if (useAsTitle) {\n title = data?.[useAsTitle] || title\n\n if (title) {\n const fieldConfig = collectionConfig.fields.find(\n (f) => 'name' in f && f.name === useAsTitle,\n )\n\n const isDate = fieldConfig?.type === 'date'\n\n if (isDate) {\n const dateFormat =\n ('date' in fieldConfig.admin && fieldConfig?.admin?.date?.displayFormat) ||\n dateFormatFromConfig\n title = formatDate({ date: title, i18n, pattern: dateFormat }) || title\n }\n }\n }\n }\n\n if (globalConfig) {\n title = getTranslation(globalConfig?.label, i18n) || globalConfig?.slug\n }\n\n if (!title) {\n title = fallback || `[${i18n.t('general:untitled')}]`\n }\n\n return title\n}\n", "import type { FormState, SanitizedConfig } from 'payload'\n\nimport type { BuildFormStateArgs } from '../forms/buildStateFromSchema/index.js'\n\nexport const getFormState = async (args: {\n apiRoute: SanitizedConfig['routes']['api']\n body: BuildFormStateArgs\n onError?: (data?: any) => Promise<void> | void\n serverURL: SanitizedConfig['serverURL']\n signal?: AbortSignal\n token?: string\n}): Promise<FormState> => {\n const { apiRoute, body, onError, serverURL, signal, token } = args\n\n const res = await fetch(`${serverURL}${apiRoute}/form-state`, {\n body: JSON.stringify(body),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n ...(token ? { Authorization: `JWT ${token}` } : {}),\n },\n method: 'POST',\n signal,\n })\n\n const json = (await res.json()) as FormState\n\n if (res.ok) {\n return json\n } else {\n if (typeof onError === 'function') {\n void onError(json)\n }\n }\n\n return body?.formState\n}\n", "import type { I18nClient } from '@payloadcms/translations'\nimport type {\n ClientCollectionConfig,\n ClientGlobalConfig,\n Permissions,\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nexport enum EntityType {\n collection = 'collections',\n global = 'globals',\n}\n\nexport type EntityToGroup =\n | {\n entity: ClientCollectionConfig | SanitizedCollectionConfig\n type: EntityType.collection\n }\n | {\n entity: ClientGlobalConfig | SanitizedGlobalConfig\n type: EntityType.global\n }\n\nexport type Group = {\n entities: EntityToGroup[]\n label: string\n}\n\nexport function groupNavItems(\n entities: EntityToGroup[],\n permissions: Permissions,\n i18n: I18nClient,\n): Group[] {\n const result = entities.reduce(\n (groups, entityToGroup) => {\n if (\n permissions?.[entityToGroup.type.toLowerCase()]?.[entityToGroup.entity.slug]?.read\n .permission\n ) {\n const translatedGroup = getTranslation(entityToGroup.entity.admin.group, i18n)\n if (entityToGroup.entity.admin.group) {\n const existingGroup = groups.find(\n (group) => getTranslation(group.label, i18n) === translatedGroup,\n ) as Group\n let matchedGroup: Group = existingGroup\n if (!existingGroup) {\n matchedGroup = { entities: [], label: translatedGroup }\n groups.push(matchedGroup)\n }\n\n matchedGroup.entities.push(entityToGroup)\n } else {\n const defaultGroup = groups.find((group) => {\n return getTranslation(group.label, i18n) === i18n.t(`general:${entityToGroup.type}`)\n }) as Group\n defaultGroup.entities.push(entityToGroup)\n }\n }\n\n return groups\n },\n [\n {\n entities: [],\n label: i18n.t('general:collections'),\n },\n {\n entities: [],\n label: i18n.t('general:globals'),\n },\n ],\n )\n\n return result.filter((group) => group.entities.length > 0)\n}\n", "import type { CollectionPermission, DocumentPermissions, GlobalPermission } from 'payload'\n\nexport const hasSavePermission = (args: {\n /*\n * Pass either `collectionSlug` or `globalSlug`\n */\n collectionSlug?: string\n docPermissions: DocumentPermissions\n /*\n * Pass either `collectionSlug` or `globalSlug`\n */\n globalSlug?: string\n isEditing: boolean\n}) => {\n const { collectionSlug, docPermissions, globalSlug, isEditing } = args\n\n if (collectionSlug) {\n return Boolean(\n (isEditing && docPermissions?.update?.permission) ||\n (!isEditing && (docPermissions as CollectionPermission)?.create?.permission),\n )\n }\n\n if (globalSlug) {\n return Boolean((docPermissions as GlobalPermission)?.update?.permission)\n }\n\n return false\n}\n", "export const isEditing = ({\n id,\n collectionSlug,\n globalSlug,\n}: {\n collectionSlug?: string\n globalSlug?: string\n id?: number | string\n}): boolean => Boolean(globalSlug || (collectionSlug && !!id))\n"],
5
- "mappings": "AAEA,OAAS,oCAAAA,MAAwC,iBACjD,OAAOC,MAAW,QAEX,IAAMC,EAAoD,CAAC,CAChE,UAAAC,EACA,gBAAAC,EACA,GAAGC,CACL,IACMF,EAUKF,EAAA,cATgCK,GAAgB,CACrD,IAAMC,EAA2B,CAC/B,GAAGD,EACH,GAAIN,EAAiCG,CAAS,EAAIC,GAAmB,CAAC,EAAI,CAAC,CAC7E,EAEA,OAAOH,EAAA,cAACE,EAAA,CAAW,GAAGI,EAA0B,CAClD,EAEQ,CAAqB,GAAGF,EAAM,EAGjC,KCvBT,OAAS,oCAAAG,EAAkC,eAAAC,MAAmB,iBAC9D,OAAOC,MAAW,QAwBX,SAASC,EAAuD,CACrE,UAAAC,EACA,wBAAAC,EACA,iBAAAC,CACF,EAIkC,CAChC,OAAID,IAA4B,SAC9BA,EAA0B,CAACL,EAAiCI,CAAS,GA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,EAAIJ,EAElE,OAAIC,EACK,GACJG,GAAaF,GAAgB,QAAQ,YACnC,CAACE,GAAcF,GAAyC,QAAQ,YAInEC,EACK,EAASD,GAAqC,QAAQ,WAGxD,EACT,EC5BO,IAAMG,EAAY,CAAC,CACxB,GAAAC,EACA,eAAAC,EACA,WAAAC,CACF,IAIe,GAAQA,GAAeD,GAAoBD",
6
- "names": ["isReactServerComponentOrFunction", "React", "WithServerSideProps", "Component", "serverOnlyProps", "rest", "passedProps", "propsWithServerOnlyProps", "isReactServerComponentOrFunction", "serverProps", "React", "withMergedProps", "Component", "sanitizeServerOnlyProps", "toMergeIntoProps", "passedProps", "mergedProps", "simpleMergeProps", "prop", "props", "toMerge", "React", "PayloadIcon", "fillFromProps", "fill", "React", "css", "PayloadLogo", "isReactServerComponentOrFunction", "React", "RenderComponent", "Component", "clientProps", "mappedComponent", "serverProps", "c", "index", "parsePayloadComponent", "getComponent", "identifier", "importMap", "payloadComponent", "silent", "exportName", "path", "key", "Component", "isReactServerComponentOrFunction", "React", "getCreateMappedComponent", "importMap", "serverProps", "createSingleMappedComponent", "payloadComponent", "key", "props", "Fallback", "identifier", "isReactServerComponentOrFunction", "React", "toReturn", "resolvedComponent", "getComponent", "Component", "fallback", "mappedComponents", "i", "component", "qs", "requests", "url", "options", "headers", "formattedOptions", "query", "findLocaleFromCode", "localizationConfig", "locale", "el", "formatAdminURL", "args", "adminRoute", "basePath", "path", "serverURL", "format", "formatDistanceToNow", "formatDate", "date", "i18n", "pattern", "theDate", "getTranslation", "formatDocTitle", "collectionConfig", "data", "dateFormatFromConfig", "fallback", "globalConfig", "i18n", "title", "useAsTitle", "fieldConfig", "f", "dateFormat", "formatDate", "getTranslation", "getFormState", "args", "apiRoute", "body", "onError", "serverURL", "signal", "token", "res", "json", "getTranslation", "EntityType", "groupNavItems", "entities", "permissions", "i18n", "groups", "entityToGroup", "translatedGroup", "existingGroup", "group", "matchedGroup", "hasSavePermission", "args", "collectionSlug", "docPermissions", "globalSlug", "isEditing", "isEditing", "id", "collectionSlug", "globalSlug"]
4
+ "sourcesContent": ["import type { WithServerSidePropsComponent } from 'payload'\n\nimport { isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\nexport const WithServerSideProps: WithServerSidePropsComponent = ({\n Component,\n serverOnlyProps,\n ...rest\n}) => {\n if (Component) {\n const WithServerSideProps: React.FC = (passedProps) => {\n const propsWithServerOnlyProps = {\n ...passedProps,\n ...(isReactServerComponentOrFunction(Component) ? serverOnlyProps ?? {} : {}),\n }\n\n return <Component {...propsWithServerOnlyProps} />\n }\n\n return <WithServerSideProps {...rest} />\n }\n\n return null\n}\n", "import { isReactServerComponentOrFunction, serverProps } from 'payload/shared'\nimport React from 'react'\n\n/**\n * Creates a higher-order component (HOC) that merges predefined properties (`toMergeIntoProps`)\n * with any properties passed to the resulting component.\n *\n * Use this when you want to pre-specify some props for a component, while also allowing users to\n * pass in their own props. The HOC ensures the passed props and predefined props are combined before\n * rendering the original component.\n *\n * @example\n * const PredefinedComponent = getMergedPropsComponent({\n * Component: OriginalComponent,\n * toMergeIntoProps: { someExtraValue: 5 }\n * });\n * // Using <PredefinedComponent customProp=\"value\" /> will result in\n * // <OriginalComponent customProp=\"value\" someExtraValue={5} />\n *\n * @returns A higher-order component with combined properties.\n *\n * @param Component - The original component to wrap.\n * @param sanitizeServerOnlyProps - If true, server-only props will be removed from the merged props. @default true if the component is not a server component, false otherwise.\n * @param toMergeIntoProps - The properties to merge into the passed props.\n */\nexport function withMergedProps<ToMergeIntoProps, CompleteReturnProps>({\n Component,\n sanitizeServerOnlyProps,\n toMergeIntoProps,\n}: {\n Component: React.FC<CompleteReturnProps>\n sanitizeServerOnlyProps?: boolean\n toMergeIntoProps: ToMergeIntoProps\n}): React.FC<CompleteReturnProps> {\n if (sanitizeServerOnlyProps === undefined) {\n sanitizeServerOnlyProps = !isReactServerComponentOrFunction(Component)\n }\n // A wrapper around the args.Component to inject the args.toMergeArgs as props, which are merged with the passed props\n const MergedPropsComponent: React.FC<CompleteReturnProps> = (passedProps) => {\n const mergedProps = simpleMergeProps(passedProps, toMergeIntoProps) as CompleteReturnProps\n\n if (sanitizeServerOnlyProps) {\n serverProps.forEach((prop) => {\n delete mergedProps[prop]\n })\n }\n\n return <Component {...mergedProps} />\n }\n\n return MergedPropsComponent\n}\n\nfunction simpleMergeProps(props, toMerge) {\n return { ...props, ...toMerge }\n}\n", "import React from 'react'\n\nexport const PayloadIcon: React.FC<{\n fill?: string\n}> = ({ fill: fillFromProps }) => {\n const fill = fillFromProps || 'var(--theme-elevation-1000)'\n\n return (\n <svg\n className=\"graphic-icon\"\n height=\"100%\"\n viewBox=\"0 0 25 25\"\n width=\"100%\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M11.5293 0L23 6.90096V19.9978L14.3608 25V11.9032L2.88452 5.00777L11.5293 0Z\"\n fill={fill}\n />\n <path d=\"M10.6559 24.2727V14.0518L2 19.0651L10.6559 24.2727Z\" fill={fill} />\n </svg>\n )\n}\n", "import React from 'react'\n\nconst css = `\n .graphic-logo path {\n fill: var(--theme-elevation-1000);\n }\n`\n\nexport const PayloadLogo: React.FC = () => (\n <svg\n className=\"graphic-logo\"\n fill=\"none\"\n height=\"50\"\n viewBox=\"0 0 180 50\"\n width=\"180\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <style>{css}</style>\n <path d=\"M65.922 13.8685C71.1075 13.8685 77.0257 14.6014 77.0257 22.2185C77.0257 28.6587 71.8736 30.2243 66.0664 30.2243H62.2689V39.0961H57.2944V13.8685H65.922ZM62.2689 17.7659V26.3602H66.3773C69.4752 26.3602 71.9069 25.594 71.9069 22.2518C71.9069 18.1101 68.7424 17.7659 66.022 17.7659H62.2689Z\" />\n <path d=\"M84.3209 39.5514C80.7344 39.5514 77.5698 37.4639 77.5698 34.0884C77.5698 29.6358 82.5443 28.3145 89.8949 27.4706V27.1264C89.8949 24.2394 88.3626 23.2623 86.3084 23.2623C84.2542 23.2623 82.7219 24.2394 82.622 26.2936H78.1361C78.4803 22.6072 81.7226 19.8867 86.4861 19.8867C91.1163 19.8867 94.7028 21.7633 94.7028 28.1035C94.7028 28.692 94.6362 31.2014 94.6362 32.9114C94.6362 35.865 94.8472 37.5416 95.1914 39.1073H90.7721C90.6278 38.5188 90.4945 37.6083 90.4279 36.7089C89.0844 38.6853 87.1412 39.5514 84.3209 39.5514ZM90.0282 30.5463C84.6651 31.1015 82.511 31.7344 82.511 33.8219C82.511 35.1766 83.588 36.298 85.7532 36.298C88.7512 36.298 90.0393 34.5547 90.0393 31.4901V30.5463H90.0282Z\" />\n <path d=\"M97.2899 45.1921V41.5057H99.0998C100.699 41.5057 101.432 41.539 102.231 39.5514L102.442 39.0295L95.269 20.3753H100.521L104.763 33.8774L109.115 20.3753H113.99L107.139 38.541C104.951 44.3593 103.974 45.1921 99.3108 45.1921H97.2899Z\" />\n <path d=\"M120.263 39.1073H115.456V13.8685H120.263V39.1073Z\" />\n <path d=\"M122.406 29.7801C122.406 23.2067 126.826 19.9645 131.7 19.9645C136.575 19.9645 140.994 23.2067 140.994 29.7801C140.994 36.3535 136.575 39.5625 131.7 39.5625C126.826 39.5514 122.406 36.3535 122.406 29.7801ZM127.281 29.7801C127.281 33.6775 128.913 35.7984 131.7 35.7984C134.487 35.7984 136.119 33.6775 136.119 29.7801C136.119 25.8494 134.487 23.7286 131.7 23.7286C128.913 23.7286 127.281 25.8383 127.281 29.7801Z\" />\n <path d=\"M149.167 39.5514C145.58 39.5514 142.416 37.4639 142.416 34.0884C142.416 29.6358 147.39 28.3145 154.741 27.4706V27.1264C154.741 24.2394 153.208 23.2623 151.154 23.2623C149.1 23.2623 147.568 24.2394 147.468 26.2936H142.982C143.326 22.6072 146.568 19.8867 151.332 19.8867C155.962 19.8867 159.549 21.7633 159.549 28.1035C159.549 28.692 159.482 31.2014 159.482 32.9114C159.482 35.865 159.693 37.5416 160.037 39.1073H155.618C155.473 38.5188 155.34 37.6083 155.274 36.7089C153.941 38.6853 151.987 39.5514 149.167 39.5514ZM154.874 30.5463C149.511 31.1015 147.357 31.7344 147.357 33.8219C147.357 35.1766 148.434 36.298 150.599 36.298C153.597 36.298 154.885 34.5547 154.885 31.4901V30.5463H154.874Z\" />\n <path d=\"M175.06 39.1073V36.7422C173.872 38.7964 171.618 39.5625 169.664 39.5625C165.067 39.5625 161.625 35.7317 161.625 29.7468C161.625 23.8619 165 19.9645 169.664 19.9645C172.029 19.9645 174.05 21.0415 175.06 22.7848V13.8796H179.868V39.1073H175.06ZM175.238 29.7357C175.238 25.9716 173.494 23.6398 170.852 23.6398C168.242 23.6398 166.677 26.1159 166.677 29.7691C166.677 33.4222 168.242 35.865 170.852 35.865C173.494 35.865 175.238 33.5665 175.238 29.7357Z\" />\n <path d=\"M19.1531 0L42.049 13.8019V39.9956L24.8049 50V23.8064L1.89795 10.0155L19.1531 0Z\" />\n <path d=\"M17.4097 48.5454V28.1035L0.132324 38.1301L17.4097 48.5454Z\" />\n </svg>\n)\n", "import type { MappedComponent } from 'payload'\n\nimport { isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\n/**\n * Can be used to render both MappedComponents and React Components.\n */\nexport const RenderComponent: React.FC<{\n readonly Component?: React.ComponentType | React.ComponentType[]\n readonly clientProps?: object\n readonly mappedComponent?: MappedComponent | MappedComponent[]\n readonly serverProps?: object\n}> = ({ Component, clientProps = {}, mappedComponent, serverProps }) => {\n if (!mappedComponent && Component) {\n if (Array.isArray(Component)) {\n return Component.map((c, index) => (\n <RenderComponent\n Component={c}\n clientProps={clientProps}\n key={index}\n serverProps={serverProps}\n />\n ))\n }\n\n const mappedComponent: MappedComponent = isReactServerComponentOrFunction(Component)\n ? {\n type: 'server',\n Component,\n RenderedComponent: null,\n }\n : {\n type: 'client',\n Component,\n }\n\n return (\n <RenderComponent\n clientProps={clientProps}\n mappedComponent={mappedComponent}\n serverProps={serverProps}\n />\n )\n }\n if (!mappedComponent) {\n return null\n }\n\n if (Array.isArray(mappedComponent)) {\n return mappedComponent.map((c, index) => (\n <RenderComponent\n clientProps={clientProps}\n key={index}\n mappedComponent={c}\n serverProps={serverProps}\n />\n ))\n }\n\n if (mappedComponent.type === 'empty') {\n return null\n }\n\n if (mappedComponent.RenderedComponent) {\n return mappedComponent.RenderedComponent\n }\n\n if (!mappedComponent.Component) {\n return null\n }\n\n if (mappedComponent.type === 'server') {\n if (mappedComponent.props) {\n return (\n <mappedComponent.Component {...mappedComponent.props} {...serverProps} {...clientProps} />\n )\n }\n\n return <mappedComponent.Component {...serverProps} {...clientProps} />\n }\n\n if (mappedComponent.props) {\n return <mappedComponent.Component {...mappedComponent.props} {...clientProps} />\n }\n\n return <mappedComponent.Component {...clientProps} />\n}\n", "import type { ImportMap, PayloadComponent, ResolvedComponent } from 'payload'\n\nimport { parsePayloadComponent } from 'payload/shared'\n\n/**\n * Gets the resolved React component from `PayloadComponent` from the importMap\n */\nexport const getComponent = <\n TComponentServerProps extends object,\n TComponentClientProps extends object,\n>({\n identifier,\n importMap,\n payloadComponent,\n silent,\n}: {\n identifier?: string\n importMap: ImportMap\n payloadComponent:\n | PayloadComponent<TComponentServerProps, TComponentClientProps>\n | null\n | undefined\n silent?: boolean\n}): ResolvedComponent<TComponentServerProps, TComponentClientProps> => {\n if (!payloadComponent) {\n // undefined, null or false\n return {\n Component: undefined,\n clientProps: undefined,\n serverProps: undefined,\n }\n }\n\n const { exportName, path } = parsePayloadComponent(payloadComponent)\n\n const key = path + '#' + exportName\n\n const Component = importMap[key]\n\n if (!Component && !silent) {\n console.error(\n `getComponent: Component not found in importMap`,\n {\n identifier,\n key,\n payloadComponent,\n },\n 'You may need to run the `payload generate:importmap` command to generate the importMap ahead of runtime.',\n )\n }\n\n return {\n Component,\n clientProps:\n typeof payloadComponent === 'object'\n ? (payloadComponent.clientProps as TComponentClientProps)\n : undefined,\n serverProps:\n typeof payloadComponent === 'object'\n ? (payloadComponent.serverProps as TComponentServerProps)\n : undefined,\n }\n}\n", "import type { I18nClient } from '@payloadcms/translations'\nimport type {\n CreateMappedComponent,\n ImportMap,\n JsonObject,\n MappedComponent,\n Payload,\n PayloadComponent,\n} from 'payload'\n\nimport { isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\nimport { getComponent } from './getComponent.js'\n\nexport function getCreateMappedComponent({\n importMap,\n serverProps,\n}: {\n importMap: ImportMap\n serverProps: {\n [key: string]: any\n i18n?: I18nClient\n payload?: Payload\n }\n}): CreateMappedComponent {\n const createSingleMappedComponent = (\n payloadComponent: { ReactComponent: React.FC<any> } | PayloadComponent,\n key: number | string,\n props: {\n clientProps: JsonObject\n serverProps: object\n },\n Fallback: React.FC<any>,\n identifier: string,\n ): MappedComponent => {\n const { clientProps, serverProps: componentServerProps } = props || {}\n\n if (payloadComponent === undefined || payloadComponent === null) {\n if (!Fallback) {\n return undefined\n }\n\n if (isReactServerComponentOrFunction(Fallback)) {\n return {\n type: 'server',\n Component: null,\n RenderedComponent: (\n <Fallback key={key} {...serverProps} {...componentServerProps} {...clientProps} />\n ),\n }\n } else {\n const toReturn: MappedComponent = {\n type: 'client',\n Component: Fallback,\n }\n\n // conditionally set props here to avoid bloating the HTML with `$undefined` props\n if (clientProps) toReturn.props = clientProps\n\n return toReturn\n }\n }\n\n if (payloadComponent === false) {\n return {\n type: 'empty',\n }\n }\n\n const resolvedComponent =\n payloadComponent &&\n typeof payloadComponent === 'object' &&\n 'ReactComponent' in payloadComponent\n ? {\n Component: payloadComponent.ReactComponent,\n }\n : getComponent({\n identifier,\n importMap,\n payloadComponent: payloadComponent as any,\n })\n\n if (!resolvedComponent.Component) {\n console.error(`getCreateMappedComponent: Component not found in importMap`, {\n identifier,\n key,\n })\n }\n\n if (isReactServerComponentOrFunction(resolvedComponent.Component)) {\n const Component: React.FC<any> = resolvedComponent.Component\n\n return {\n type: 'server',\n Component: null,\n RenderedComponent: (\n <Component\n key={key}\n {...serverProps}\n {...resolvedComponent.serverProps}\n {...componentServerProps}\n {...clientProps}\n />\n ),\n }\n } else {\n if (!resolvedComponent.Component) {\n return undefined\n }\n\n return {\n type: 'client',\n Component: resolvedComponent.Component,\n props: {\n ...(resolvedComponent.clientProps || {}),\n ...clientProps,\n },\n }\n }\n }\n\n const createMappedComponent: CreateMappedComponent = (\n payloadComponent,\n props,\n fallback,\n identifier,\n ) => {\n if ((payloadComponent === undefined || payloadComponent === null) && !fallback) {\n return undefined as any\n }\n\n if (payloadComponent && Array.isArray(payloadComponent)) {\n const mappedComponents: MappedComponent[] = []\n for (let i = 0; i < payloadComponent.length; i++) {\n const component = createSingleMappedComponent(\n payloadComponent[i],\n i,\n props,\n fallback,\n identifier,\n )\n mappedComponents.push(component)\n }\n return mappedComponents as any\n } else {\n return createSingleMappedComponent(\n payloadComponent,\n undefined,\n props,\n fallback,\n identifier,\n ) as any\n }\n }\n\n return createMappedComponent\n}\n", "import * as qs from 'qs-esm'\n\ntype GetOptions = {\n params?: Record<string, unknown>\n} & RequestInit\n\nexport const requests = {\n delete: (url: string, options: RequestInit = { headers: {} }): Promise<Response> => {\n const headers = options && options.headers ? { ...options.headers } : {}\n\n const formattedOptions: RequestInit = {\n ...options,\n credentials: 'include',\n headers: {\n ...headers,\n },\n method: 'delete',\n }\n\n return fetch(url, formattedOptions)\n },\n\n get: (url: string, options: GetOptions = { headers: {} }): Promise<Response> => {\n let query = ''\n if (options.params) {\n query = qs.stringify(options.params, { addQueryPrefix: true })\n }\n return fetch(`${url}${query}`, {\n credentials: 'include',\n ...options,\n })\n },\n\n patch: (url: string, options: RequestInit = { headers: {} }): Promise<Response> => {\n const headers = options && options.headers ? { ...options.headers } : {}\n\n const formattedOptions: RequestInit = {\n ...options,\n credentials: 'include',\n headers: {\n ...headers,\n },\n method: 'PATCH',\n }\n\n return fetch(url, formattedOptions)\n },\n\n post: (url: string, options: RequestInit = { headers: {} }): Promise<Response> => {\n const headers = options && options.headers ? { ...options.headers } : {}\n\n const formattedOptions: RequestInit = {\n ...options,\n credentials: 'include',\n headers: {\n ...headers,\n },\n method: 'post',\n }\n\n return fetch(`${url}`, formattedOptions)\n },\n\n put: (url: string, options: RequestInit = { headers: {} }): Promise<Response> => {\n const headers = options && options.headers ? { ...options.headers } : {}\n\n const formattedOptions: RequestInit = {\n ...options,\n credentials: 'include',\n headers: {\n ...headers,\n },\n method: 'put',\n }\n\n return fetch(url, formattedOptions)\n },\n}\n", "import type { Locale, SanitizedLocalizationConfig } from 'payload'\n/*\n return the Locale for given locale code, else return null\n*/\nexport const findLocaleFromCode = (\n localizationConfig: SanitizedLocalizationConfig,\n locale: string,\n): Locale | null => {\n if (!localizationConfig?.locales || localizationConfig.locales.length === 0) {\n return null\n }\n\n return localizationConfig.locales.find((el) => el?.code === locale)\n}\n", "import type { Config } from 'payload'\n\n/** Will read the `routes.admin` config and appropriately handle `\"/\"` admin paths */\nexport const formatAdminURL = (args: {\n adminRoute: Config['routes']['admin']\n basePath?: string\n path: string\n serverURL?: Config['serverURL']\n}): string => {\n const { adminRoute, basePath = '', path, serverURL } = args\n\n if (adminRoute) {\n if (adminRoute === '/') {\n if (!path) {\n return `${serverURL || ''}${basePath}${adminRoute}`\n }\n } else {\n return `${serverURL || ''}${basePath}${adminRoute}${path}`\n }\n }\n\n return `${serverURL || ''}${basePath}${path}`\n}\n", "import type { I18n } from '@payloadcms/translations'\n\nimport { format, formatDistanceToNow } from 'date-fns'\n\ntype FormatDateArgs = {\n date: Date | number | string | undefined\n i18n: I18n<any, any>\n pattern: string\n}\n\nexport const formatDate = ({ date, i18n, pattern }: FormatDateArgs): string => {\n const theDate = new Date(date)\n return format(theDate, pattern, { locale: i18n.dateFNS })\n}\n\ntype FormatTimeToNowArgs = {\n date: Date | number | string | undefined\n i18n: I18n<any, any>\n}\n\nexport const formatTimeToNow = ({ date, i18n }: FormatTimeToNowArgs): string => {\n const theDate = new Date(date)\n return formatDistanceToNow(theDate, { locale: i18n.dateFNS })\n}\n", "import type { I18n } from '@payloadcms/translations'\nimport type {\n ClientCollectionConfig,\n ClientGlobalConfig,\n SanitizedConfig,\n TypeWithID,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport { formatDate } from '../utilities/formatDate.js'\n\nexport const formatDocTitle = ({\n collectionConfig,\n data,\n dateFormat: dateFormatFromConfig,\n fallback,\n globalConfig,\n i18n,\n}: {\n collectionConfig?: ClientCollectionConfig\n data: TypeWithID\n dateFormat: SanitizedConfig['admin']['dateFormat']\n fallback?: string\n globalConfig?: ClientGlobalConfig\n i18n: I18n<any, any>\n}): string => {\n let title: string\n\n if (collectionConfig) {\n const useAsTitle = collectionConfig?.admin?.useAsTitle\n\n if (useAsTitle) {\n title = data?.[useAsTitle] || title\n\n if (title) {\n const fieldConfig = collectionConfig.fields.find(\n (f) => 'name' in f && f.name === useAsTitle,\n )\n\n const isDate = fieldConfig?.type === 'date'\n\n if (isDate) {\n const dateFormat =\n ('date' in fieldConfig.admin && fieldConfig?.admin?.date?.displayFormat) ||\n dateFormatFromConfig\n title = formatDate({ date: title, i18n, pattern: dateFormat }) || title\n }\n }\n }\n }\n\n if (globalConfig) {\n title = getTranslation(globalConfig?.label, i18n) || globalConfig?.slug\n }\n\n if (!title) {\n title = fallback || `[${i18n.t('general:untitled')}]`\n }\n\n return title\n}\n", "import type { FormState, SanitizedConfig } from 'payload'\n\nimport type { BuildFormStateArgs } from '../forms/buildStateFromSchema/index.js'\n\nexport const getFormState = async (args: {\n apiRoute: SanitizedConfig['routes']['api']\n body: BuildFormStateArgs\n onError?: (data?: any) => Promise<void> | void\n serverURL: SanitizedConfig['serverURL']\n signal?: AbortSignal\n token?: string\n}): Promise<FormState> => {\n const { apiRoute, body, onError, serverURL, signal, token } = args\n\n const res = await fetch(`${serverURL}${apiRoute}/form-state`, {\n body: JSON.stringify(body),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n ...(token ? { Authorization: `JWT ${token}` } : {}),\n },\n method: 'POST',\n signal,\n })\n\n const json = (await res.json()) as FormState\n\n if (res.ok) {\n return json\n } else {\n if (typeof onError === 'function') {\n void onError(json)\n }\n }\n\n return body?.formState\n}\n", "import type { I18nClient } from '@payloadcms/translations'\nimport type {\n ClientCollectionConfig,\n ClientGlobalConfig,\n Permissions,\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nexport enum EntityType {\n collection = 'collections',\n global = 'globals',\n}\n\nexport type EntityToGroup =\n | {\n entity: ClientCollectionConfig | SanitizedCollectionConfig\n type: EntityType.collection\n }\n | {\n entity: ClientGlobalConfig | SanitizedGlobalConfig\n type: EntityType.global\n }\n\nexport type Group = {\n entities: EntityToGroup[]\n label: string\n}\n\nexport function groupNavItems(\n entities: EntityToGroup[],\n permissions: Permissions,\n i18n: I18nClient,\n): Group[] {\n const result = entities.reduce(\n (groups, entityToGroup) => {\n if (\n permissions?.[entityToGroup.type.toLowerCase()]?.[entityToGroup.entity.slug]?.read\n .permission\n ) {\n const translatedGroup = getTranslation(entityToGroup.entity.admin.group, i18n)\n if (entityToGroup.entity.admin.group) {\n const existingGroup = groups.find(\n (group) => getTranslation(group.label, i18n) === translatedGroup,\n ) as Group\n let matchedGroup: Group = existingGroup\n if (!existingGroup) {\n matchedGroup = { entities: [], label: translatedGroup }\n groups.push(matchedGroup)\n }\n\n matchedGroup.entities.push(entityToGroup)\n } else {\n const defaultGroup = groups.find((group) => {\n return getTranslation(group.label, i18n) === i18n.t(`general:${entityToGroup.type}`)\n }) as Group\n defaultGroup.entities.push(entityToGroup)\n }\n }\n\n return groups\n },\n [\n {\n entities: [],\n label: i18n.t('general:collections'),\n },\n {\n entities: [],\n label: i18n.t('general:globals'),\n },\n ],\n )\n\n return result.filter((group) => group.entities.length > 0)\n}\n", "import type { CollectionPermission, DocumentPermissions, GlobalPermission } from 'payload'\n\nexport const hasSavePermission = (args: {\n /*\n * Pass either `collectionSlug` or `globalSlug`\n */\n collectionSlug?: string\n docPermissions: DocumentPermissions\n /*\n * Pass either `collectionSlug` or `globalSlug`\n */\n globalSlug?: string\n isEditing: boolean\n}) => {\n const { collectionSlug, docPermissions, globalSlug, isEditing } = args\n\n if (collectionSlug) {\n return Boolean(\n (isEditing && docPermissions?.update?.permission) ||\n (!isEditing && (docPermissions as CollectionPermission)?.create?.permission),\n )\n }\n\n if (globalSlug) {\n return Boolean((docPermissions as GlobalPermission)?.update?.permission)\n }\n\n return false\n}\n", "export const isEditing = ({\n id,\n collectionSlug,\n globalSlug,\n}: {\n collectionSlug?: string\n globalSlug?: string\n id?: number | string\n}): boolean => Boolean(globalSlug || (collectionSlug && !!id))\n"],
5
+ "mappings": "AAEA,OAAS,oCAAAA,MAAwC,iBACjD,OAAOC,MAAW,QAEX,IAAMC,EAAoD,CAAC,CAChE,UAAAC,EACA,gBAAAC,EACA,GAAGC,CACL,IACMF,EAUKF,EAAA,cATgCK,GAAgB,CACrD,IAAMC,EAA2B,CAC/B,GAAGD,EACH,GAAIN,EAAiCG,CAAS,EAAIC,GAAmB,CAAC,EAAI,CAAC,CAC7E,EAEA,OAAOH,EAAA,cAACE,EAAA,CAAW,GAAGI,EAA0B,CAClD,EAEQ,CAAqB,GAAGF,EAAM,EAGjC,KCvBT,OAAS,oCAAAG,EAAkC,eAAAC,MAAmB,iBAC9D,OAAOC,MAAW,QAwBX,SAASC,EAAuD,CACrE,UAAAC,EACA,wBAAAC,EACA,iBAAAC,CACF,EAIkC,CAChC,OAAID,IAA4B,SAC9BA,EAA0B,CAACL,EAAiCI,CAAS,GAGVG,GAAgB,CAC3E,IAAMC,EAAcC,EAAiBF,EAAaD,CAAgB,EAElE,OAAID,GACFJ,EAAY,QAASS,GAAS,CAC5B,OAAOF,EAAYE,CAAI,CACzB,CAAC,EAGIR,EAAA,cAACE,EAAA,CAAW,GAAGI,EAAa,CACrC,CAGF,CAEA,SAASC,EAAiBE,EAAOC,EAAS,CACxC,MAAO,CAAE,GAAGD,EAAO,GAAGC,CAAQ,CAChC,CCvDA,OAAOC,MAAW,QAEX,IAAMC,EAER,CAAC,C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",
6
+ "names": ["isReactServerComponentOrFunction", "React", "WithServerSideProps", "Component", "serverOnlyProps", "rest", "passedProps", "propsWithServerOnlyProps", "isReactServerComponentOrFunction", "serverProps", "React", "withMergedProps", "Component", "sanitizeServerOnlyProps", "toMergeIntoProps", "passedProps", "mergedProps", "simpleMergeProps", "prop", "props", "toMerge", "React", "PayloadIcon", "fillFromProps", "fill", "React", "css", "PayloadLogo", "isReactServerComponentOrFunction", "React", "RenderComponent", "Component", "clientProps", "mappedComponent", "serverProps", "c", "index", "parsePayloadComponent", "getComponent", "identifier", "importMap", "payloadComponent", "silent", "exportName", "path", "key", "Component", "isReactServerComponentOrFunction", "React", "getCreateMappedComponent", "importMap", "serverProps", "createSingleMappedComponent", "payloadComponent", "key", "props", "Fallback", "identifier", "clientProps", "componentServerProps", "isReactServerComponentOrFunction", "React", "toReturn", "resolvedComponent", "getComponent", "Component", "fallback", "mappedComponents", "i", "component", "qs", "requests", "url", "options", "headers", "formattedOptions", "query", "findLocaleFromCode", "localizationConfig", "locale", "el", "formatAdminURL", "args", "adminRoute", "basePath", "path", "serverURL", "format", "formatDistanceToNow", "formatDate", "date", "i18n", "pattern", "theDate", "getTranslation", "formatDocTitle", "collectionConfig", "data", "dateFormatFromConfig", "fallback", "globalConfig", "i18n", "title", "useAsTitle", "fieldConfig", "f", "dateFormat", "formatDate", "getTranslation", "getFormState", "args", "apiRoute", "body", "onError", "serverURL", "signal", "token", "res", "json", "getTranslation", "EntityType", "groupNavItems", "entities", "permissions", "i18n", "groups", "entityToGroup", "translatedGroup", "existingGroup", "group", "matchedGroup", "hasSavePermission", "args", "collectionSlug", "docPermissions", "globalSlug", "isEditing", "isEditing", "id", "collectionSlug", "globalSlug"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Array/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,SAAS,CAAA;AAG5E,OAAO,KAAsB,MAAM,OAAO,CAAA;AAuB1C,OAAO,cAAc,CAAA;AAIrB,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA0TzD,CAAA;AAED,eAAO,MAAM,UAAU,2BAAqC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Array/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,SAAS,CAAA;AAG5E,OAAO,KAAsB,MAAM,OAAO,CAAA;AAuB1C,OAAO,cAAc,CAAA;AAIrB,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA6TzD,CAAA;AAED,eAAO,MAAM,UAAU,2BAAqC,CAAA"}
@@ -350,6 +350,7 @@ export const ArrayFieldComponent = props => {
350
350
  if ($[45] !== showError || $[46] !== field || $[47] !== errorProps || $[48] !== path) {
351
351
  t22 = showError && _jsx(FieldError, {
352
352
  CustomError: field?.admin?.components?.Error,
353
+ field,
353
354
  path,
354
355
  ...(errorProps || {})
355
356
  });
@@ -405,6 +406,7 @@ export const ArrayFieldComponent = props => {
405
406
  children: _jsx(FieldLabel, {
406
407
  Label: field?.admin?.components?.Label,
407
408
  as: "span",
409
+ field,
408
410
  label,
409
411
  required,
410
412
  unstyled: true,
@@ -432,6 +434,7 @@ export const ArrayFieldComponent = props => {
432
434
  }), _jsx(FieldDescription, {
433
435
  Description: field?.admin?.components?.Description,
434
436
  description,
437
+ field,
435
438
  ...t25
436
439
  })]
437
440
  }), _jsx(NullifyLocaleField, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","getTranslation","React","useCallback","Banner","Button","DraggableSortableItem","DraggableSortable","ErrorPill","useFieldProps","useForm","useFormSubmitted","extractRowsAndCollapsedIDs","toggleAllRows","NullifyLocaleField","useField","withCondition","useConfig","useDocumentInfo","useLocale","useTranslation","scrollToID","FieldDescription","FieldError","FieldLabel","fieldBaseClass","ArrayRow","baseClass","ArrayFieldComponent","props","$","descriptionProps","errorProps","field","t0","forceRender","t1","labelProps","readOnly","readOnlyFromTopLevelProps","validate","name","_path","pathFromProps","admin","t2","fields","label","localized","maxRows","minRows","minRowsProp","required","t3","undefined","className","components","t4","description","isSortable","t5","readOnlyFromAdmin","RowLabel","readOnlyFromProps","indexPath","path","pathFromContext","permissions","readOnlyFromContext","setDocFieldPreferences","addFieldRow","dispatchFields","setModified","submitted","code","locale","i18n","t","config","t6","localization","t7","bb0","fallback","defaultLocale","editingDefaultLocale","t8","p","labels","plural","singular","getLabels","t9","value","options","memoizedValidate","t10","t11","hasRows","errorPaths","formInitializing","formProcessing","rows","t12","schemaPath","showError","valid","value_0","t13","disabled","t14","rowIndex","setTimeout","addRow","t15","rowIndex_0","type","duplicateRow","t16","rowIndex_1","removeRow","t17","moveFromIndex","moveToIndex","moveRow","t18","collapsed","collapsedIDs","updatedRows","toggleCollapseAll","t19","rowID","collapsed_0","collapsedIDs_0","updatedRows_0","setCollapse","hasMaxRows","length","fieldErrorCount","fieldHasErrors","showRequired","showMinRows","t20","t21","filter","Boolean","t22","_jsx","CustomError","Error","t23","t24","count","withMessage","t25","_jsxs","join","id","replace","children","Label","as","unstyled","onClick","Description","fieldValue","ids","map","_temp","onDragEnd","t26","moveFromIndex_0","moveToIndex_0","row_0","i","rowErrorCount","errorPath","startsWith","row","draggableSortableItemProps","errorCount","rowCount","Fragment","buttonStyle","icon","iconPosition","iconStyle","ArrayField"],"sources":["../../../src/fields/Array/index.tsx"],"sourcesContent":["'use client'\nimport type { ArrayFieldProps, ArrayField as ArrayFieldType } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback } from 'react'\n\nimport { Banner } from '../../elements/Banner/index.js'\nimport { Button } from '../../elements/Button/index.js'\nimport { DraggableSortableItem } from '../../elements/DraggableSortable/DraggableSortableItem/index.js'\nimport { DraggableSortable } from '../../elements/DraggableSortable/index.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useForm, useFormSubmitted } from '../../forms/Form/context.js'\nimport { extractRowsAndCollapsedIDs, toggleAllRows } from '../../forms/Form/rowHelpers.js'\nimport { NullifyLocaleField } from '../../forms/NullifyField/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { scrollToID } from '../../utilities/scrollToID.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { ArrayRow } from './ArrayRow.js'\nimport './index.scss'\n\nconst baseClass = 'array-field'\n\nexport const ArrayFieldComponent: React.FC<ArrayFieldProps> = (props) => {\n const {\n descriptionProps,\n errorProps,\n field,\n field: {\n name,\n _path: pathFromProps,\n admin: {\n className,\n components: { RowLabel },\n description,\n isSortable = true,\n readOnly: readOnlyFromAdmin,\n } = {},\n fields,\n label,\n localized,\n maxRows,\n minRows: minRowsProp,\n required,\n },\n forceRender = false,\n labelProps,\n readOnly: readOnlyFromTopLevelProps,\n validate,\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const {\n indexPath,\n path: pathFromContext,\n permissions,\n readOnly: readOnlyFromContext,\n } = useFieldProps()\n\n const minRows = minRowsProp ?? required ? 1 : 0\n\n const { setDocFieldPreferences } = useDocumentInfo()\n const { addFieldRow, dispatchFields, setModified } = useForm()\n const submitted = useFormSubmitted()\n const { code: locale } = useLocale()\n const { i18n, t } = useTranslation()\n\n const {\n config: { localization },\n } = useConfig()\n\n const editingDefaultLocale = (() => {\n if (localization && localization.fallback) {\n const defaultLocale = localization.defaultLocale || 'en'\n return locale === defaultLocale\n }\n\n return true\n })()\n\n // Handle labeling for Arrays, Global Arrays, and Blocks\n const getLabels = (p: ArrayFieldProps): Partial<ArrayFieldType['labels']> => {\n if ('labels' in p && p?.labels) return p.labels\n if ('label' in p.field && p.field.label) return { plural: undefined, singular: p.field.label }\n return { plural: t('general:rows'), singular: t('general:row') }\n }\n\n const labels = getLabels(props)\n\n const memoizedValidate = useCallback(\n (value, options) => {\n // alternative locales can be null\n if (!editingDefaultLocale && value === null) {\n return true\n }\n if (typeof validate === 'function') {\n return validate(value, { ...options, maxRows, minRows, required })\n }\n },\n [maxRows, minRows, required, validate, editingDefaultLocale],\n )\n\n const {\n errorPaths,\n formInitializing,\n formProcessing,\n path,\n rows = [],\n schemaPath,\n showError,\n valid,\n value,\n } = useField<number>({\n hasRows: true,\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const addRow = useCallback(\n async (rowIndex: number): Promise<void> => {\n await addFieldRow({ path, rowIndex, schemaPath })\n setModified(true)\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [addFieldRow, path, setModified, schemaPath],\n )\n\n const duplicateRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({ type: 'DUPLICATE_ROW', path, rowIndex })\n setModified(true)\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex}`)\n }, 0)\n },\n [dispatchFields, path, setModified],\n )\n\n const removeRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({ type: 'REMOVE_ROW', path, rowIndex })\n setModified(true)\n },\n [dispatchFields, path, setModified],\n )\n\n const moveRow = useCallback(\n (moveFromIndex: number, moveToIndex: number) => {\n dispatchFields({ type: 'MOVE_ROW', moveFromIndex, moveToIndex, path })\n setModified(true)\n },\n [dispatchFields, path, setModified],\n )\n\n const toggleCollapseAll = useCallback(\n (collapsed: boolean) => {\n const { collapsedIDs, updatedRows } = toggleAllRows({\n collapsed,\n rows,\n })\n dispatchFields({ type: 'SET_ALL_ROWS_COLLAPSED', path, updatedRows })\n setDocFieldPreferences(path, { collapsed: collapsedIDs })\n },\n [dispatchFields, path, rows, setDocFieldPreferences],\n )\n\n const setCollapse = useCallback(\n (rowID: string, collapsed: boolean) => {\n const { collapsedIDs, updatedRows } = extractRowsAndCollapsedIDs({\n collapsed,\n rowID,\n rows,\n })\n dispatchFields({ type: 'SET_ROW_COLLAPSED', path, updatedRows })\n setDocFieldPreferences(path, { collapsed: collapsedIDs })\n },\n [dispatchFields, path, rows, setDocFieldPreferences],\n )\n\n const hasMaxRows = maxRows && rows.length >= maxRows\n\n const fieldErrorCount = errorPaths.length\n const fieldHasErrors = submitted && errorPaths.length > 0\n\n const showRequired = disabled && rows.length === 0\n const showMinRows = rows.length < minRows || (required && rows.length === 0)\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${path.replace(/\\./g, '__')}`}\n >\n {showError && (\n <FieldError\n CustomError={field?.admin?.components?.Error}\n path={path}\n {...(errorProps || {})}\n />\n )}\n <header className={`${baseClass}__header`}>\n <div className={`${baseClass}__header-wrap`}>\n <div className={`${baseClass}__header-content`}>\n <h3 className={`${baseClass}__title`}>\n <FieldLabel\n Label={field?.admin?.components?.Label}\n as=\"span\"\n label={label}\n required={required}\n unstyled\n {...(labelProps || {})}\n />\n </h3>\n {fieldHasErrors && fieldErrorCount > 0 && (\n <ErrorPill count={fieldErrorCount} i18n={i18n} withMessage />\n )}\n </div>\n {rows.length > 0 && (\n <ul className={`${baseClass}__header-actions`}>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(true)}\n type=\"button\"\n >\n {t('fields:collapseAll')}\n </button>\n </li>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(false)}\n type=\"button\"\n >\n {t('fields:showAll')}\n </button>\n </li>\n </ul>\n )}\n </div>\n <FieldDescription\n Description={field?.admin?.components?.Description}\n description={description}\n {...(descriptionProps || {})}\n />\n </header>\n <NullifyLocaleField fieldValue={value} localized={localized} path={path} />\n {(rows.length > 0 || (!valid && (showRequired || showMinRows))) && (\n <DraggableSortable\n className={`${baseClass}__draggable-rows`}\n ids={rows.map((row) => row.id)}\n onDragEnd={({ moveFromIndex, moveToIndex }) => moveRow(moveFromIndex, moveToIndex)}\n >\n {rows.map((row, i) => {\n const rowErrorCount = errorPaths?.filter((errorPath) =>\n errorPath.startsWith(`${path}.${i}.`),\n ).length\n return (\n <DraggableSortableItem disabled={disabled || !isSortable} id={row.id} key={row.id}>\n {(draggableSortableItemProps) => (\n <ArrayRow\n {...draggableSortableItemProps}\n RowLabel={RowLabel}\n addRow={addRow}\n duplicateRow={duplicateRow}\n errorCount={rowErrorCount}\n fields={fields}\n forceRender={forceRender}\n hasMaxRows={hasMaxRows}\n indexPath={indexPath}\n isSortable={isSortable}\n labels={labels}\n moveRow={moveRow}\n path={path}\n permissions={permissions}\n readOnly={disabled}\n removeRow={removeRow}\n row={row}\n rowCount={rows.length}\n rowIndex={i}\n schemaPath={schemaPath}\n setCollapse={setCollapse}\n />\n )}\n </DraggableSortableItem>\n )\n })}\n {!valid && (\n <React.Fragment>\n {showRequired && (\n <Banner>\n {t('validation:fieldHasNo', { label: getTranslation(labels.plural, i18n) })}\n </Banner>\n )}\n {showMinRows && (\n <Banner type=\"error\">\n {t('validation:requiresAtLeast', {\n count: minRows,\n label:\n getTranslation(minRows > 1 ? labels.plural : labels.singular, i18n) ||\n t(minRows > 1 ? 'general:rows' : 'general:row'),\n })}\n </Banner>\n )}\n </React.Fragment>\n )}\n </DraggableSortable>\n )}\n {!disabled && !hasMaxRows && (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__add-row`}\n icon=\"plus\"\n iconPosition=\"left\"\n iconStyle=\"with-border\"\n onClick={() => {\n void addRow(value || 0)\n }}\n >\n {t('fields:addLabel', { label: getTranslation(labels.singular, i18n) })}\n </Button>\n )}\n </div>\n )\n}\n\nexport const ArrayField = withCondition(ArrayFieldComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,WAAW,QAAQ;AAEnC,SAASC,MAAM,QAAQ;AACvB,SAASC,MAAM,QAAQ;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,SAAS,QAAQ;AAC1B,SAASC,aAAa,QAAQ;AAC9B,SAASC,OAAO,EAAEC,gBAAgB,QAAQ;AAC1C,SAASC,0BAA0B,EAAEC,aAAa,QAAQ;AAC1D,SAASC,kBAAkB,QAAQ;AACnC,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAChC,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,SAASC,UAAU,QAAQ;AAC3B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAC3B,SAASC,cAAc,QAAQ;AAC/B,SAASC,QAAQ,QAAQ;AACzB,OAAO;AAEP,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,mBAAA,GAAiDC,KAAA;EAAA,MAAAC,CAAA,GAAA9B,EAAA;EAC5D;IAAA+B,gBAAA;IAAAC,UAAA;IAAAC,KAAA;IAAAA,KAAA,EAAAC,EAAA;IAAAC,WAAA,EAAAC,EAAA;IAAAC,UAAA;IAAAC,QAAA,EAAAC,yBAAA;IAAAC;EAAA,IAyBIX,KAAA;EArBK;IAAAY,IAAA;IAAAC,KAAA,EAAAC,aAAA;IAAAC,KAAA,EAAAC,EAAA;IAAAC,MAAA;IAAAC,KAAA;IAAAC,SAAA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AACnD,KAAA,IACAiD,KAAA,CAAAzJ,KAAA,CAAAoL,QAAA;QAAAvB,QAAA,GACGnB,YAAA,IACCO,IAAA,CAAA/I,MAAA;UAAA2J,QAAA,EACGlF,CAAA,CAAE;YAAA9B,KAAA,EAAkC9C,cAAA,CAAeuF,MAAA,CAAAC,MAAA,EAAeb,IAAA;UAAA,CAAM;QAAA,C,GAG5EiE,WAAA,IACCM,IAAA,CAAA/I,MAAA;UAAAgH,IAAA,EAAa;UAAA2C,QAAA,EACVlF,CAAA,CAAE;YAAA2E,KAAA,EACMtG,OAAA;YAAAH,KAAA,EAEL9C,cAAA,CAAeiD,OAAA,IAAU,GAAIsC,MAAA,CAAAC,MAAA,GAAgBD,MAAA,CAAAE,QAAe,EAAEd,IAAA,KAC9DC,CAAA,CAAE3B,OAAA,IAAU,GAAI,iBAAiB;UAAA,CACrC;QAAA,C;;QAOX,CAAC2D,QAAA,KAAa2B,UAAA,IACbW,IAAA,CAAA9I,MAAA;MAAAkL,WAAA,EACc;MAAAhI,SAAA,EACD,GAAA5B,SAAA,WAAuB;MAAA6J,IAAA,EAC7B;MAAAC,YAAA,EACQ;MAAAC,SAAA,EACH;MAAAvB,OAAA,EAAAA,CAAA;QAEHlD,MAAA,CAAOpB,OAAA,KAAS;MAAA;MAAAkE,QAAA,EAGtBlF,CAAA,CAAE;QAAA9B,KAAA,EAA4B9C,cAAA,CAAeuF,MAAA,CAAAE,QAAA,EAAiBd,IAAA;MAAA,CAAM;IAAA,C;;CAK/E;AAEA,OAAO,MAAM+G,UAAA,GAAa3K,aAAA,CAAcY,mBAAA;AA5TsB,SAAA4I,MAAAU,GAAA;EAAA,OAgP7BA,GAAA,CAAArB,EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","getTranslation","React","useCallback","Banner","Button","DraggableSortableItem","DraggableSortable","ErrorPill","useFieldProps","useForm","useFormSubmitted","extractRowsAndCollapsedIDs","toggleAllRows","NullifyLocaleField","useField","withCondition","useConfig","useDocumentInfo","useLocale","useTranslation","scrollToID","FieldDescription","FieldError","FieldLabel","fieldBaseClass","ArrayRow","baseClass","ArrayFieldComponent","props","$","descriptionProps","errorProps","field","t0","forceRender","t1","labelProps","readOnly","readOnlyFromTopLevelProps","validate","name","_path","pathFromProps","admin","t2","fields","label","localized","maxRows","minRows","minRowsProp","required","t3","undefined","className","components","t4","description","isSortable","t5","readOnlyFromAdmin","RowLabel","readOnlyFromProps","indexPath","path","pathFromContext","permissions","readOnlyFromContext","setDocFieldPreferences","addFieldRow","dispatchFields","setModified","submitted","code","locale","i18n","t","config","t6","localization","t7","bb0","fallback","defaultLocale","editingDefaultLocale","t8","p","labels","plural","singular","getLabels","t9","value","options","memoizedValidate","t10","t11","hasRows","errorPaths","formInitializing","formProcessing","rows","t12","schemaPath","showError","valid","value_0","t13","disabled","t14","rowIndex","setTimeout","addRow","t15","rowIndex_0","type","duplicateRow","t16","rowIndex_1","removeRow","t17","moveFromIndex","moveToIndex","moveRow","t18","collapsed","collapsedIDs","updatedRows","toggleCollapseAll","t19","rowID","collapsed_0","collapsedIDs_0","updatedRows_0","setCollapse","hasMaxRows","length","fieldErrorCount","fieldHasErrors","showRequired","showMinRows","t20","t21","filter","Boolean","t22","_jsx","CustomError","Error","t23","t24","count","withMessage","t25","_jsxs","join","id","replace","children","Label","as","unstyled","onClick","Description","fieldValue","ids","map","_temp","onDragEnd","t26","moveFromIndex_0","moveToIndex_0","row_0","i","rowErrorCount","errorPath","startsWith","row","draggableSortableItemProps","errorCount","rowCount","Fragment","buttonStyle","icon","iconPosition","iconStyle","ArrayField"],"sources":["../../../src/fields/Array/index.tsx"],"sourcesContent":["'use client'\nimport type { ArrayFieldProps, ArrayField as ArrayFieldType } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback } from 'react'\n\nimport { Banner } from '../../elements/Banner/index.js'\nimport { Button } from '../../elements/Button/index.js'\nimport { DraggableSortableItem } from '../../elements/DraggableSortable/DraggableSortableItem/index.js'\nimport { DraggableSortable } from '../../elements/DraggableSortable/index.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useForm, useFormSubmitted } from '../../forms/Form/context.js'\nimport { extractRowsAndCollapsedIDs, toggleAllRows } from '../../forms/Form/rowHelpers.js'\nimport { NullifyLocaleField } from '../../forms/NullifyField/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { scrollToID } from '../../utilities/scrollToID.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { ArrayRow } from './ArrayRow.js'\nimport './index.scss'\n\nconst baseClass = 'array-field'\n\nexport const ArrayFieldComponent: React.FC<ArrayFieldProps> = (props) => {\n const {\n descriptionProps,\n errorProps,\n field,\n field: {\n name,\n _path: pathFromProps,\n admin: {\n className,\n components: { RowLabel },\n description,\n isSortable = true,\n readOnly: readOnlyFromAdmin,\n } = {},\n fields,\n label,\n localized,\n maxRows,\n minRows: minRowsProp,\n required,\n },\n forceRender = false,\n labelProps,\n readOnly: readOnlyFromTopLevelProps,\n validate,\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const {\n indexPath,\n path: pathFromContext,\n permissions,\n readOnly: readOnlyFromContext,\n } = useFieldProps()\n\n const minRows = minRowsProp ?? required ? 1 : 0\n\n const { setDocFieldPreferences } = useDocumentInfo()\n const { addFieldRow, dispatchFields, setModified } = useForm()\n const submitted = useFormSubmitted()\n const { code: locale } = useLocale()\n const { i18n, t } = useTranslation()\n\n const {\n config: { localization },\n } = useConfig()\n\n const editingDefaultLocale = (() => {\n if (localization && localization.fallback) {\n const defaultLocale = localization.defaultLocale || 'en'\n return locale === defaultLocale\n }\n\n return true\n })()\n\n // Handle labeling for Arrays, Global Arrays, and Blocks\n const getLabels = (p: ArrayFieldProps): Partial<ArrayFieldType['labels']> => {\n if ('labels' in p && p?.labels) return p.labels\n if ('label' in p.field && p.field.label) return { plural: undefined, singular: p.field.label }\n return { plural: t('general:rows'), singular: t('general:row') }\n }\n\n const labels = getLabels(props)\n\n const memoizedValidate = useCallback(\n (value, options) => {\n // alternative locales can be null\n if (!editingDefaultLocale && value === null) {\n return true\n }\n if (typeof validate === 'function') {\n return validate(value, { ...options, maxRows, minRows, required })\n }\n },\n [maxRows, minRows, required, validate, editingDefaultLocale],\n )\n\n const {\n errorPaths,\n formInitializing,\n formProcessing,\n path,\n rows = [],\n schemaPath,\n showError,\n valid,\n value,\n } = useField<number>({\n hasRows: true,\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const addRow = useCallback(\n async (rowIndex: number): Promise<void> => {\n await addFieldRow({ path, rowIndex, schemaPath })\n setModified(true)\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [addFieldRow, path, setModified, schemaPath],\n )\n\n const duplicateRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({ type: 'DUPLICATE_ROW', path, rowIndex })\n setModified(true)\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex}`)\n }, 0)\n },\n [dispatchFields, path, setModified],\n )\n\n const removeRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({ type: 'REMOVE_ROW', path, rowIndex })\n setModified(true)\n },\n [dispatchFields, path, setModified],\n )\n\n const moveRow = useCallback(\n (moveFromIndex: number, moveToIndex: number) => {\n dispatchFields({ type: 'MOVE_ROW', moveFromIndex, moveToIndex, path })\n setModified(true)\n },\n [dispatchFields, path, setModified],\n )\n\n const toggleCollapseAll = useCallback(\n (collapsed: boolean) => {\n const { collapsedIDs, updatedRows } = toggleAllRows({\n collapsed,\n rows,\n })\n dispatchFields({ type: 'SET_ALL_ROWS_COLLAPSED', path, updatedRows })\n setDocFieldPreferences(path, { collapsed: collapsedIDs })\n },\n [dispatchFields, path, rows, setDocFieldPreferences],\n )\n\n const setCollapse = useCallback(\n (rowID: string, collapsed: boolean) => {\n const { collapsedIDs, updatedRows } = extractRowsAndCollapsedIDs({\n collapsed,\n rowID,\n rows,\n })\n dispatchFields({ type: 'SET_ROW_COLLAPSED', path, updatedRows })\n setDocFieldPreferences(path, { collapsed: collapsedIDs })\n },\n [dispatchFields, path, rows, setDocFieldPreferences],\n )\n\n const hasMaxRows = maxRows && rows.length >= maxRows\n\n const fieldErrorCount = errorPaths.length\n const fieldHasErrors = submitted && errorPaths.length > 0\n\n const showRequired = disabled && rows.length === 0\n const showMinRows = rows.length < minRows || (required && rows.length === 0)\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${path.replace(/\\./g, '__')}`}\n >\n {showError && (\n <FieldError\n CustomError={field?.admin?.components?.Error}\n field={field}\n path={path}\n {...(errorProps || {})}\n />\n )}\n <header className={`${baseClass}__header`}>\n <div className={`${baseClass}__header-wrap`}>\n <div className={`${baseClass}__header-content`}>\n <h3 className={`${baseClass}__title`}>\n <FieldLabel\n Label={field?.admin?.components?.Label}\n as=\"span\"\n field={field}\n label={label}\n required={required}\n unstyled\n {...(labelProps || {})}\n />\n </h3>\n {fieldHasErrors && fieldErrorCount > 0 && (\n <ErrorPill count={fieldErrorCount} i18n={i18n} withMessage />\n )}\n </div>\n {rows.length > 0 && (\n <ul className={`${baseClass}__header-actions`}>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(true)}\n type=\"button\"\n >\n {t('fields:collapseAll')}\n </button>\n </li>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(false)}\n type=\"button\"\n >\n {t('fields:showAll')}\n </button>\n </li>\n </ul>\n )}\n </div>\n <FieldDescription\n Description={field?.admin?.components?.Description}\n description={description}\n field={field}\n {...(descriptionProps || {})}\n />\n </header>\n <NullifyLocaleField fieldValue={value} localized={localized} path={path} />\n {(rows.length > 0 || (!valid && (showRequired || showMinRows))) && (\n <DraggableSortable\n className={`${baseClass}__draggable-rows`}\n ids={rows.map((row) => row.id)}\n onDragEnd={({ moveFromIndex, moveToIndex }) => moveRow(moveFromIndex, moveToIndex)}\n >\n {rows.map((row, i) => {\n const rowErrorCount = errorPaths?.filter((errorPath) =>\n errorPath.startsWith(`${path}.${i}.`),\n ).length\n return (\n <DraggableSortableItem disabled={disabled || !isSortable} id={row.id} key={row.id}>\n {(draggableSortableItemProps) => (\n <ArrayRow\n {...draggableSortableItemProps}\n RowLabel={RowLabel}\n addRow={addRow}\n duplicateRow={duplicateRow}\n errorCount={rowErrorCount}\n fields={fields}\n forceRender={forceRender}\n hasMaxRows={hasMaxRows}\n indexPath={indexPath}\n isSortable={isSortable}\n labels={labels}\n moveRow={moveRow}\n path={path}\n permissions={permissions}\n readOnly={disabled}\n removeRow={removeRow}\n row={row}\n rowCount={rows.length}\n rowIndex={i}\n schemaPath={schemaPath}\n setCollapse={setCollapse}\n />\n )}\n </DraggableSortableItem>\n )\n })}\n {!valid && (\n <React.Fragment>\n {showRequired && (\n <Banner>\n {t('validation:fieldHasNo', { label: getTranslation(labels.plural, i18n) })}\n </Banner>\n )}\n {showMinRows && (\n <Banner type=\"error\">\n {t('validation:requiresAtLeast', {\n count: minRows,\n label:\n getTranslation(minRows > 1 ? labels.plural : labels.singular, i18n) ||\n t(minRows > 1 ? 'general:rows' : 'general:row'),\n })}\n </Banner>\n )}\n </React.Fragment>\n )}\n </DraggableSortable>\n )}\n {!disabled && !hasMaxRows && (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__add-row`}\n icon=\"plus\"\n iconPosition=\"left\"\n iconStyle=\"with-border\"\n onClick={() => {\n void addRow(value || 0)\n }}\n >\n {t('fields:addLabel', { label: getTranslation(labels.singular, i18n) })}\n </Button>\n )}\n </div>\n )\n}\n\nexport const ArrayField = withCondition(ArrayFieldComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,WAAW,QAAQ;AAEnC,SAASC,MAAM,QAAQ;AACvB,SAASC,MAAM,QAAQ;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,SAAS,QAAQ;AAC1B,SAASC,aAAa,QAAQ;AAC9B,SAASC,OAAO,EAAEC,gBAAgB,QAAQ;AAC1C,SAASC,0BAA0B,EAAEC,aAAa,QAAQ;AAC1D,SAASC,kBAAkB,QAAQ;AACnC,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAChC,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,SAASC,UAAU,QAAQ;AAC3B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAC3B,SAASC,cAAc,QAAQ;AAC/B,SAASC,QAAQ,QAAQ;AACzB,OAAO;AAEP,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,mBAAA,GAAiDC,KAAA;EAAA,MAAAC,CAAA,GAAA9B,EAAA;EAC5D;IAAA+B,gBAAA;IAAAC,UAAA;IAAAC,KAAA;IAAAA,KAAA,EAAAC,EAAA;IAAAC,WAAA,EAAAC,EAAA;IAAAC,UAAA;IAAAC,QAAA,EAAAC,yBAAA;IAAAC;EAAA,IAyBIX,KAAA;EArBK;IAAAY,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{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Blocks/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9C,OAAO,KAAgC,MAAM,OAAO,CAAA;AA0BpD,OAAO,cAAc,CAAA;AA8UrB,eAAO,MAAM,WAAW,2BAAsC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Blocks/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9C,OAAO,KAAgC,MAAM,OAAO,CAAA;AA0BpD,OAAO,cAAc,CAAA;AAkVrB,eAAO,MAAM,WAAW,2BAAsC,CAAA"}
@@ -337,6 +337,7 @@ const BlocksFieldComponent = props => {
337
337
  if ($[43] !== showError || $[44] !== field || $[45] !== errorProps || $[46] !== path) {
338
338
  t20 = showError && _jsx(FieldError, {
339
339
  CustomError: field?.admin?.components?.Error,
340
+ field,
340
341
  path,
341
342
  ...(errorProps || {})
342
343
  });
@@ -391,6 +392,7 @@ const BlocksFieldComponent = props => {
391
392
  children: _jsx(FieldLabel, {
392
393
  Label: field?.admin?.components?.Description,
393
394
  as: "span",
395
+ field,
394
396
  label,
395
397
  required,
396
398
  unstyled: true,
@@ -418,6 +420,7 @@ const BlocksFieldComponent = props => {
418
420
  }), _jsx(FieldDescription, {
419
421
  Description: field?.admin?.components?.Description,
420
422
  description,
423
+ field,
421
424
  ...t23
422
425
  })]
423
426
  }), _jsx(NullifyLocaleField, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","getTranslation","React","Fragment","useCallback","Banner","Button","DraggableSortableItem","DraggableSortable","DrawerToggler","useDrawerSlug","ErrorPill","useFieldProps","useForm","useFormSubmitted","extractRowsAndCollapsedIDs","toggleAllRows","NullifyLocaleField","useField","withCondition","useConfig","useDocumentInfo","useLocale","useTranslation","scrollToID","FieldDescription","FieldError","FieldLabel","fieldBaseClass","BlockRow","BlocksDrawer","baseClass","BlocksFieldComponent","props","$","i18n","t","descriptionProps","errorProps","field","t0","forceRender","t1","labelProps","readOnly","readOnlyFromTopLevelProps","validate","name","_path","pathFromProps","admin","t2","blocks","label","labels","labelsFromProps","localized","maxRows","minRows","minRowsProp","required","t3","undefined","className","description","isSortable","t4","readOnlyFromAdmin","readOnlyFromProps","indexPath","readOnlyFromContext","setDocFieldPreferences","addFieldRow","dispatchFields","setModified","code","locale","config","t5","localization","drawerSlug","submitted","plural","singular","t6","bb0","fallback","defaultLocale","editingDefaultLocale","t7","value","options","memoizedValidate","path","pathFromContext","t8","t9","hasRows","errorPaths","formInitializing","formProcessing","permissions","rows","t10","schemaPath","showError","valid","value_0","t11","disabled","t12","rowIndex","blockType","data","setTimeout","addRow","t13","rowIndex_0","type","duplicateRow","t14","rowIndex_1","removeRow","t15","moveFromIndex","moveToIndex","moveRow","t16","collapsed","collapsedIDs","updatedRows","toggleCollapseAll","t17","rowID","collapsed_0","collapsedIDs_0","updatedRows_0","setCollapse","hasMaxRows","length","fieldErrorCount","fieldHasErrors","showMinRows","showRequired","t18","t19","filter","Boolean","t20","_jsx","CustomError","components","Error","t21","t22","count","withMessage","t23","_jsxs","join","id","replace","children","Label","Description","as","unstyled","onClick","fieldValue","ids","map","_temp","onDragEnd","t24","moveFromIndex_0","moveToIndex_0","row_0","i","blockType_0","row","blockToRender","find","block","slug","rowErrorCount","errorPath","startsWith","draggableSortableItemProps","errorCount","rowCount","buttonStyle","el","icon","iconPosition","iconStyle","addRowIndex","BlocksField"],"sources":["../../../src/fields/Blocks/index.tsx"],"sourcesContent":["'use client'\nimport type { BlockFieldProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment, useCallback } from 'react'\n\nimport { Banner } from '../../elements/Banner/index.js'\nimport { Button } from '../../elements/Button/index.js'\nimport { DraggableSortableItem } from '../../elements/DraggableSortable/DraggableSortableItem/index.js'\nimport { DraggableSortable } from '../../elements/DraggableSortable/index.js'\nimport { DrawerToggler } from '../../elements/Drawer/index.js'\nimport { useDrawerSlug } from '../../elements/Drawer/useDrawerSlug.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useForm, useFormSubmitted } from '../../forms/Form/context.js'\nimport { extractRowsAndCollapsedIDs, toggleAllRows } from '../../forms/Form/rowHelpers.js'\nimport { NullifyLocaleField } from '../../forms/NullifyField/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { scrollToID } from '../../utilities/scrollToID.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { BlockRow } from './BlockRow.js'\nimport { BlocksDrawer } from './BlocksDrawer/index.js'\nimport './index.scss'\n\nconst baseClass = 'blocks-field'\n\nconst BlocksFieldComponent: React.FC<BlockFieldProps> = (props) => {\n const { i18n, t } = useTranslation()\n\n const {\n descriptionProps,\n errorProps,\n field,\n field: {\n name,\n _path: pathFromProps,\n admin: { className, description, isSortable = true, readOnly: readOnlyFromAdmin } = {},\n blocks,\n label,\n labels: labelsFromProps,\n localized,\n maxRows,\n minRows: minRowsProp,\n required,\n },\n forceRender = false,\n labelProps,\n readOnly: readOnlyFromTopLevelProps,\n validate,\n } = props\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const { indexPath, readOnly: readOnlyFromContext } = useFieldProps()\n const minRows = minRowsProp ?? required ? 1 : 0\n\n const { setDocFieldPreferences } = useDocumentInfo()\n const { addFieldRow, dispatchFields, setModified } = useForm()\n const { code: locale } = useLocale()\n const {\n config: { localization },\n } = useConfig()\n const drawerSlug = useDrawerSlug('blocks-drawer')\n const submitted = useFormSubmitted()\n\n const labels = {\n plural: t('fields:blocks'),\n singular: t('fields:block'),\n ...labelsFromProps,\n }\n\n const editingDefaultLocale = (() => {\n if (localization && localization.fallback) {\n const defaultLocale = localization.defaultLocale || 'en'\n return locale === defaultLocale\n }\n\n return true\n })()\n\n const memoizedValidate = useCallback(\n (value, options) => {\n // alternative locales can be null\n if (!editingDefaultLocale && value === null) {\n return true\n }\n if (typeof validate === 'function') {\n return validate(value, { ...options, maxRows, minRows, required })\n }\n },\n [maxRows, minRows, required, validate, editingDefaultLocale],\n )\n\n const { path: pathFromContext } = useFieldProps()\n\n const {\n errorPaths,\n formInitializing,\n formProcessing,\n path,\n permissions,\n rows = [],\n schemaPath,\n showError,\n valid,\n value,\n } = useField<number>({\n hasRows: true,\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const addRow = useCallback(\n async (rowIndex: number, blockType: string): Promise<void> => {\n await addFieldRow({\n data: { blockType },\n path,\n rowIndex,\n schemaPath: `${schemaPath}.${blockType}`,\n })\n setModified(true)\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [addFieldRow, path, setModified, schemaPath],\n )\n\n const duplicateRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({ type: 'DUPLICATE_ROW', path, rowIndex })\n setModified(true)\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [dispatchFields, path, setModified],\n )\n\n const removeRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({\n type: 'REMOVE_ROW',\n path,\n rowIndex,\n })\n\n setModified(true)\n },\n [path, dispatchFields, setModified],\n )\n\n const moveRow = useCallback(\n (moveFromIndex: number, moveToIndex: number) => {\n dispatchFields({ type: 'MOVE_ROW', moveFromIndex, moveToIndex, path })\n setModified(true)\n },\n [dispatchFields, path, setModified],\n )\n\n const toggleCollapseAll = useCallback(\n (collapsed: boolean) => {\n const { collapsedIDs, updatedRows } = toggleAllRows({\n collapsed,\n rows,\n })\n dispatchFields({ type: 'SET_ALL_ROWS_COLLAPSED', path, updatedRows })\n setDocFieldPreferences(path, { collapsed: collapsedIDs })\n },\n [dispatchFields, path, rows, setDocFieldPreferences],\n )\n\n const setCollapse = useCallback(\n (rowID: string, collapsed: boolean) => {\n const { collapsedIDs, updatedRows } = extractRowsAndCollapsedIDs({\n collapsed,\n rowID,\n rows,\n })\n dispatchFields({ type: 'SET_ROW_COLLAPSED', path, updatedRows })\n setDocFieldPreferences(path, { collapsed: collapsedIDs })\n },\n [dispatchFields, path, rows, setDocFieldPreferences],\n )\n\n const hasMaxRows = maxRows && rows.length >= maxRows\n\n const fieldErrorCount = errorPaths.length\n const fieldHasErrors = submitted && fieldErrorCount + (valid ? 0 : 1) > 0\n\n const showMinRows = rows.length < minRows || (required && rows.length === 0)\n const showRequired = disabled && rows.length === 0\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${path.replace(/\\./g, '__')}`}\n >\n {showError && (\n <FieldError\n CustomError={field?.admin?.components?.Error}\n path={path}\n {...(errorProps || {})}\n />\n )}\n <header className={`${baseClass}__header`}>\n <div className={`${baseClass}__header-wrap`}>\n <div className={`${baseClass}__heading-with-error`}>\n <h3>\n <FieldLabel\n Label={field?.admin?.components?.Description}\n as=\"span\"\n label={label}\n required={required}\n unstyled\n {...(labelProps || {})}\n />\n </h3>\n {fieldHasErrors && fieldErrorCount > 0 && (\n <ErrorPill count={fieldErrorCount} i18n={i18n} withMessage />\n )}\n </div>\n {rows.length > 0 && (\n <ul className={`${baseClass}__header-actions`}>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(true)}\n type=\"button\"\n >\n {t('fields:collapseAll')}\n </button>\n </li>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(false)}\n type=\"button\"\n >\n {t('fields:showAll')}\n </button>\n </li>\n </ul>\n )}\n </div>\n <FieldDescription\n Description={field?.admin?.components?.Description}\n description={description}\n {...(descriptionProps || {})}\n />\n </header>\n <NullifyLocaleField fieldValue={value} localized={localized} path={path} />\n {(rows.length > 0 || (!valid && (showRequired || showMinRows))) && (\n <DraggableSortable\n className={`${baseClass}__rows`}\n ids={rows.map((row) => row.id)}\n onDragEnd={({ moveFromIndex, moveToIndex }) => moveRow(moveFromIndex, moveToIndex)}\n >\n {rows.map((row, i) => {\n const { blockType } = row\n const blockToRender = blocks.find((block) => block.slug === blockType)\n\n if (blockToRender) {\n const rowErrorCount = errorPaths.filter((errorPath) =>\n errorPath.startsWith(`${path}.${i}`),\n ).length\n return (\n <DraggableSortableItem disabled={disabled || !isSortable} id={row.id} key={row.id}>\n {(draggableSortableItemProps) => (\n <BlockRow\n {...draggableSortableItemProps}\n addRow={addRow}\n block={blockToRender}\n blocks={blocks}\n duplicateRow={duplicateRow}\n errorCount={rowErrorCount}\n forceRender={forceRender}\n hasMaxRows={hasMaxRows}\n indexPath={indexPath}\n isSortable={isSortable}\n labels={labels}\n moveRow={moveRow}\n path={path}\n permissions={permissions}\n readOnly={disabled}\n removeRow={removeRow}\n row={row}\n rowCount={rows.length}\n rowIndex={i}\n schemaPath={schemaPath}\n setCollapse={setCollapse}\n />\n )}\n </DraggableSortableItem>\n )\n }\n\n return null\n })}\n {!editingDefaultLocale && (\n <React.Fragment>\n {showMinRows && (\n <Banner type=\"error\">\n {t('validation:requiresAtLeast', {\n count: minRows,\n label:\n getTranslation(minRows > 1 ? labels.plural : labels.singular, i18n) ||\n t(minRows > 1 ? 'general:row' : 'general:rows'),\n })}\n </Banner>\n )}\n {showRequired && (\n <Banner>\n {t('validation:fieldHasNo', { label: getTranslation(labels.plural, i18n) })}\n </Banner>\n )}\n </React.Fragment>\n )}\n </DraggableSortable>\n )}\n {!disabled && !hasMaxRows && (\n <Fragment>\n <DrawerToggler className={`${baseClass}__drawer-toggler`} slug={drawerSlug}>\n <Button\n buttonStyle=\"icon-label\"\n el=\"span\"\n icon=\"plus\"\n iconPosition=\"left\"\n iconStyle=\"with-border\"\n >\n {t('fields:addLabel', { label: getTranslation(labels.singular, i18n) })}\n </Button>\n </DrawerToggler>\n <BlocksDrawer\n addRow={addRow}\n addRowIndex={rows?.length || 0}\n blocks={blocks}\n drawerSlug={drawerSlug}\n labels={labels}\n />\n </Fragment>\n )}\n </div>\n )\n}\n\nexport const BlocksField = withCondition(BlocksFieldComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,EAAEC,WAAW,QAAQ;AAE7C,SAASC,MAAM,QAAQ;AACvB,SAASC,MAAM,QAAQ;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAC9B,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAS,QAAQ;AAC1B,SAASC,aAAa,QAAQ;AAC9B,SAASC,OAAO,EAAEC,gBAAgB,QAAQ;AAC1C,SAASC,0BAA0B,EAAEC,aAAa,QAAQ;AAC1D,SAASC,kBAAkB,QAAQ;AACnC,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAChC,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,SAASC,UAAU,QAAQ;AAC3B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAC3B,SAASC,cAAc,QAAQ;AAC/B,SAASC,QAAQ,QAAQ;AACzB,SAASC,YA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,EAEe7F,IAAA,EAAAqC,MAAA,KAAgB;QAAAvF,MAAA;QAAA4B,UAAA;QAAA1B;MAAA,C;;;CASzC;AAEA,OAAO,MAAM8I,WAAA,GAAcjL,aAAA,CAAca,oBAAA;AA1Ue,SAAA2I,MAAAQ,GAAA;EAAA,OA+OvBA,GAAA,CAAAnB,EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","getTranslation","React","Fragment","useCallback","Banner","Button","DraggableSortableItem","DraggableSortable","DrawerToggler","useDrawerSlug","ErrorPill","useFieldProps","useForm","useFormSubmitted","extractRowsAndCollapsedIDs","toggleAllRows","NullifyLocaleField","useField","withCondition","useConfig","useDocumentInfo","useLocale","useTranslation","scrollToID","FieldDescription","FieldError","FieldLabel","fieldBaseClass","BlockRow","BlocksDrawer","baseClass","BlocksFieldComponent","props","$","i18n","t","descriptionProps","errorProps","field","t0","forceRender","t1","labelProps","readOnly","readOnlyFromTopLevelProps","validate","name","_path","pathFromProps","admin","t2","blocks","label","labels","labelsFromProps","localized","maxRows","minRows","minRowsProp","required","t3","undefined","className","description","isSortable","t4","readOnlyFromAdmin","readOnlyFromProps","indexPath","readOnlyFromContext","setDocFieldPreferences","addFieldRow","dispatchFields","setModified","code","locale","config","t5","localization","drawerSlug","submitted","plural","singular","t6","bb0","fallback","defaultLocale","editingDefaultLocale","t7","value","options","memoizedValidate","path","pathFromContext","t8","t9","hasRows","errorPaths","formInitializing","formProcessing","permissions","rows","t10","schemaPath","showError","valid","value_0","t11","disabled","t12","rowIndex","blockType","data","setTimeout","addRow","t13","rowIndex_0","type","duplicateRow","t14","rowIndex_1","removeRow","t15","moveFromIndex","moveToIndex","moveRow","t16","collapsed","collapsedIDs","updatedRows","toggleCollapseAll","t17","rowID","collapsed_0","collapsedIDs_0","updatedRows_0","setCollapse","hasMaxRows","length","fieldErrorCount","fieldHasErrors","showMinRows","showRequired","t18","t19","filter","Boolean","t20","_jsx","CustomError","components","Error","t21","t22","count","withMessage","t23","_jsxs","join","id","replace","children","Label","Description","as","unstyled","onClick","fieldValue","ids","map","_temp","onDragEnd","t24","moveFromIndex_0","moveToIndex_0","row_0","i","blockType_0","row","blockToRender","find","block","slug","rowErrorCount","errorPath","startsWith","draggableSortableItemProps","errorCount","rowCount","buttonStyle","el","icon","iconPosition","iconStyle","addRowIndex","BlocksField"],"sources":["../../../src/fields/Blocks/index.tsx"],"sourcesContent":["'use client'\nimport type { BlockFieldProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment, useCallback } from 'react'\n\nimport { Banner } from '../../elements/Banner/index.js'\nimport { Button } from '../../elements/Button/index.js'\nimport { DraggableSortableItem } from '../../elements/DraggableSortable/DraggableSortableItem/index.js'\nimport { DraggableSortable } from '../../elements/DraggableSortable/index.js'\nimport { DrawerToggler } from '../../elements/Drawer/index.js'\nimport { useDrawerSlug } from '../../elements/Drawer/useDrawerSlug.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useForm, useFormSubmitted } from '../../forms/Form/context.js'\nimport { extractRowsAndCollapsedIDs, toggleAllRows } from '../../forms/Form/rowHelpers.js'\nimport { NullifyLocaleField } from '../../forms/NullifyField/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { scrollToID } from '../../utilities/scrollToID.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { BlockRow } from './BlockRow.js'\nimport { BlocksDrawer } from './BlocksDrawer/index.js'\nimport './index.scss'\n\nconst baseClass = 'blocks-field'\n\nconst BlocksFieldComponent: React.FC<BlockFieldProps> = (props) => {\n const { i18n, t } = useTranslation()\n\n const {\n descriptionProps,\n errorProps,\n field,\n field: {\n name,\n _path: pathFromProps,\n admin: { className, description, isSortable = true, readOnly: readOnlyFromAdmin } = {},\n blocks,\n label,\n labels: labelsFromProps,\n localized,\n maxRows,\n minRows: minRowsProp,\n required,\n },\n forceRender = false,\n labelProps,\n readOnly: readOnlyFromTopLevelProps,\n validate,\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const { indexPath, readOnly: readOnlyFromContext } = useFieldProps()\n const minRows = minRowsProp ?? required ? 1 : 0\n\n const { setDocFieldPreferences } = useDocumentInfo()\n const { addFieldRow, dispatchFields, setModified } = useForm()\n const { code: locale } = useLocale()\n const {\n config: { localization },\n } = useConfig()\n const drawerSlug = useDrawerSlug('blocks-drawer')\n const submitted = useFormSubmitted()\n\n const labels = {\n plural: t('fields:blocks'),\n singular: t('fields:block'),\n ...labelsFromProps,\n }\n\n const editingDefaultLocale = (() => {\n if (localization && localization.fallback) {\n const defaultLocale = localization.defaultLocale || 'en'\n return locale === defaultLocale\n }\n\n return true\n })()\n\n const memoizedValidate = useCallback(\n (value, options) => {\n // alternative locales can be null\n if (!editingDefaultLocale && value === null) {\n return true\n }\n if (typeof validate === 'function') {\n return validate(value, { ...options, maxRows, minRows, required })\n }\n },\n [maxRows, minRows, required, validate, editingDefaultLocale],\n )\n\n const { path: pathFromContext } = useFieldProps()\n\n const {\n errorPaths,\n formInitializing,\n formProcessing,\n path,\n permissions,\n rows = [],\n schemaPath,\n showError,\n valid,\n value,\n } = useField<number>({\n hasRows: true,\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const addRow = useCallback(\n async (rowIndex: number, blockType: string): Promise<void> => {\n await addFieldRow({\n data: { blockType },\n path,\n rowIndex,\n schemaPath: `${schemaPath}.${blockType}`,\n })\n setModified(true)\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [addFieldRow, path, setModified, schemaPath],\n )\n\n const duplicateRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({ type: 'DUPLICATE_ROW', path, rowIndex })\n setModified(true)\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [dispatchFields, path, setModified],\n )\n\n const removeRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({\n type: 'REMOVE_ROW',\n path,\n rowIndex,\n })\n\n setModified(true)\n },\n [path, dispatchFields, setModified],\n )\n\n const moveRow = useCallback(\n (moveFromIndex: number, moveToIndex: number) => {\n dispatchFields({ type: 'MOVE_ROW', moveFromIndex, moveToIndex, path })\n setModified(true)\n },\n [dispatchFields, path, setModified],\n )\n\n const toggleCollapseAll = useCallback(\n (collapsed: boolean) => {\n const { collapsedIDs, updatedRows } = toggleAllRows({\n collapsed,\n rows,\n })\n dispatchFields({ type: 'SET_ALL_ROWS_COLLAPSED', path, updatedRows })\n setDocFieldPreferences(path, { collapsed: collapsedIDs })\n },\n [dispatchFields, path, rows, setDocFieldPreferences],\n )\n\n const setCollapse = useCallback(\n (rowID: string, collapsed: boolean) => {\n const { collapsedIDs, updatedRows } = extractRowsAndCollapsedIDs({\n collapsed,\n rowID,\n rows,\n })\n dispatchFields({ type: 'SET_ROW_COLLAPSED', path, updatedRows })\n setDocFieldPreferences(path, { collapsed: collapsedIDs })\n },\n [dispatchFields, path, rows, setDocFieldPreferences],\n )\n\n const hasMaxRows = maxRows && rows.length >= maxRows\n\n const fieldErrorCount = errorPaths.length\n const fieldHasErrors = submitted && fieldErrorCount + (valid ? 0 : 1) > 0\n\n const showMinRows = rows.length < minRows || (required && rows.length === 0)\n const showRequired = disabled && rows.length === 0\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${path.replace(/\\./g, '__')}`}\n >\n {showError && (\n <FieldError\n CustomError={field?.admin?.components?.Error}\n field={field}\n path={path}\n {...(errorProps || {})}\n />\n )}\n <header className={`${baseClass}__header`}>\n <div className={`${baseClass}__header-wrap`}>\n <div className={`${baseClass}__heading-with-error`}>\n <h3>\n <FieldLabel\n Label={field?.admin?.components?.Description}\n as=\"span\"\n field={field}\n label={label}\n required={required}\n unstyled\n {...(labelProps || {})}\n />\n </h3>\n {fieldHasErrors && fieldErrorCount > 0 && (\n <ErrorPill count={fieldErrorCount} i18n={i18n} withMessage />\n )}\n </div>\n {rows.length > 0 && (\n <ul className={`${baseClass}__header-actions`}>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(true)}\n type=\"button\"\n >\n {t('fields:collapseAll')}\n </button>\n </li>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(false)}\n type=\"button\"\n >\n {t('fields:showAll')}\n </button>\n </li>\n </ul>\n )}\n </div>\n <FieldDescription\n Description={field?.admin?.components?.Description}\n description={description}\n field={field}\n {...(descriptionProps || {})}\n />\n </header>\n <NullifyLocaleField fieldValue={value} localized={localized} path={path} />\n {(rows.length > 0 || (!valid && (showRequired || showMinRows))) && (\n <DraggableSortable\n className={`${baseClass}__rows`}\n ids={rows.map((row) => row.id)}\n onDragEnd={({ moveFromIndex, moveToIndex }) => moveRow(moveFromIndex, moveToIndex)}\n >\n {rows.map((row, i) => {\n const { blockType } = row\n const blockToRender = blocks.find((block) => block.slug === blockType)\n\n if (blockToRender) {\n const rowErrorCount = errorPaths.filter((errorPath) =>\n errorPath.startsWith(`${path}.${i}`),\n ).length\n return (\n <DraggableSortableItem disabled={disabled || !isSortable} id={row.id} key={row.id}>\n {(draggableSortableItemProps) => (\n <BlockRow\n {...draggableSortableItemProps}\n addRow={addRow}\n block={blockToRender}\n blocks={blocks}\n duplicateRow={duplicateRow}\n errorCount={rowErrorCount}\n forceRender={forceRender}\n hasMaxRows={hasMaxRows}\n indexPath={indexPath}\n isSortable={isSortable}\n labels={labels}\n moveRow={moveRow}\n path={path}\n permissions={permissions}\n readOnly={disabled}\n removeRow={removeRow}\n row={row}\n rowCount={rows.length}\n rowIndex={i}\n schemaPath={schemaPath}\n setCollapse={setCollapse}\n />\n )}\n </DraggableSortableItem>\n )\n }\n\n return null\n })}\n {!editingDefaultLocale && (\n <React.Fragment>\n {showMinRows && (\n <Banner type=\"error\">\n {t('validation:requiresAtLeast', {\n count: minRows,\n label:\n getTranslation(minRows > 1 ? labels.plural : labels.singular, i18n) ||\n t(minRows > 1 ? 'general:row' : 'general:rows'),\n })}\n </Banner>\n )}\n {showRequired && (\n <Banner>\n {t('validation:fieldHasNo', { label: getTranslation(labels.plural, i18n) })}\n </Banner>\n )}\n </React.Fragment>\n )}\n </DraggableSortable>\n )}\n {!disabled && !hasMaxRows && (\n <Fragment>\n <DrawerToggler className={`${baseClass}__drawer-toggler`} slug={drawerSlug}>\n <Button\n buttonStyle=\"icon-label\"\n el=\"span\"\n icon=\"plus\"\n iconPosition=\"left\"\n iconStyle=\"with-border\"\n >\n {t('fields:addLabel', { label: getTranslation(labels.singular, i18n) })}\n </Button>\n </DrawerToggler>\n <BlocksDrawer\n addRow={addRow}\n addRowIndex={rows?.length || 0}\n blocks={blocks}\n drawerSlug={drawerSlug}\n labels={labels}\n />\n </Fragment>\n )}\n </div>\n )\n}\n\nexport const BlocksField = withCondition(BlocksFieldComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,EAAEC,WAAW,QAAQ;AAE7C,SAASC,MAAM,QAAQ;AACvB,SAASC,MAAM,QAAQ;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAC9B,SAASC,aAAa,QAAQ;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