@payloadcms/ui 3.0.0-beta.46 → 3.0.0-beta.48

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 (116) hide show
  1. package/dist/elements/DocumentControls/index.d.ts.map +1 -1
  2. package/dist/elements/DocumentControls/index.js +28 -21
  3. package/dist/elements/DocumentControls/index.js.map +1 -1
  4. package/dist/elements/DocumentDrawer/DrawerContent.js +1 -1
  5. package/dist/elements/DocumentDrawer/DrawerContent.js.map +1 -1
  6. package/dist/elements/DuplicateDocument/index.d.ts.map +1 -1
  7. package/dist/elements/DuplicateDocument/index.js +2 -2
  8. package/dist/elements/DuplicateDocument/index.js.map +1 -1
  9. package/dist/elements/ListDrawer/DrawerContent.d.ts.map +1 -1
  10. package/dist/elements/ListDrawer/DrawerContent.js +1 -1
  11. package/dist/elements/ListDrawer/DrawerContent.js.map +1 -1
  12. package/dist/elements/ReactSelect/index.d.ts +1 -1
  13. package/dist/elements/ReactSelect/index.d.ts.map +1 -1
  14. package/dist/elements/ReactSelect/index.js.map +1 -1
  15. package/dist/elements/ReactSelect/types.d.ts +4 -4
  16. package/dist/elements/ReactSelect/types.d.ts.map +1 -1
  17. package/dist/elements/ReactSelect/types.js.map +1 -1
  18. package/dist/elements/SortComplex/index.d.ts.map +1 -1
  19. package/dist/elements/SortComplex/index.js.map +1 -1
  20. package/dist/elements/TableColumns/index.d.ts +0 -2
  21. package/dist/elements/TableColumns/index.d.ts.map +1 -1
  22. package/dist/elements/TableColumns/index.js +83 -85
  23. package/dist/elements/TableColumns/index.js.map +1 -1
  24. package/dist/elements/Thumbnail/index.d.ts.map +1 -1
  25. package/dist/elements/Thumbnail/index.js +2 -2
  26. package/dist/elements/Thumbnail/index.js.map +1 -1
  27. package/dist/elements/Upload/index.d.ts.map +1 -1
  28. package/dist/elements/Upload/index.js +4 -9
  29. package/dist/elements/Upload/index.js.map +1 -1
  30. package/dist/elements/Upload/index.scss +0 -11
  31. package/dist/elements/WhereBuilder/Condition/Relationship/index.js +3 -3
  32. package/dist/elements/WhereBuilder/Condition/Relationship/index.js.map +1 -1
  33. package/dist/elements/WhereBuilder/Condition/index.d.ts +2 -1
  34. package/dist/elements/WhereBuilder/Condition/index.d.ts.map +1 -1
  35. package/dist/elements/WhereBuilder/Condition/index.js.map +1 -1
  36. package/dist/elements/WhereBuilder/index.d.ts.map +1 -1
  37. package/dist/elements/WhereBuilder/index.js.map +1 -1
  38. package/dist/fields/Array/index.js +2 -2
  39. package/dist/fields/Array/index.js.map +1 -1
  40. package/dist/fields/Blocks/index.js +1 -1
  41. package/dist/fields/Blocks/index.js.map +1 -1
  42. package/dist/fields/Checkbox/index.js +1 -1
  43. package/dist/fields/Checkbox/index.js.map +1 -1
  44. package/dist/fields/Code/index.js +1 -1
  45. package/dist/fields/Code/index.js.map +1 -1
  46. package/dist/fields/Collapsible/index.js +1 -1
  47. package/dist/fields/Collapsible/index.js.map +1 -1
  48. package/dist/fields/DateTime/index.d.ts +1 -1
  49. package/dist/fields/DateTime/index.d.ts.map +1 -1
  50. package/dist/fields/DateTime/index.js +1 -1
  51. package/dist/fields/DateTime/index.js.map +1 -1
  52. package/dist/fields/Email/index.d.ts.map +1 -1
  53. package/dist/fields/Email/index.js +1 -1
  54. package/dist/fields/Email/index.js.map +1 -1
  55. package/dist/fields/JSON/index.d.ts +1 -1
  56. package/dist/fields/JSON/index.d.ts.map +1 -1
  57. package/dist/fields/JSON/index.js +1 -1
  58. package/dist/fields/JSON/index.js.map +1 -1
  59. package/dist/fields/Number/index.js +1 -1
  60. package/dist/fields/Number/index.js.map +1 -1
  61. package/dist/fields/Point/index.js +1 -1
  62. package/dist/fields/Point/index.js.map +1 -1
  63. package/dist/fields/RadioGroup/index.js +1 -1
  64. package/dist/fields/RadioGroup/index.js.map +1 -1
  65. package/dist/fields/Relationship/index.d.ts.map +1 -1
  66. package/dist/fields/Relationship/index.js +18 -10
  67. package/dist/fields/Relationship/index.js.map +1 -1
  68. package/dist/fields/Relationship/types.d.ts +1 -2
  69. package/dist/fields/Relationship/types.d.ts.map +1 -1
  70. package/dist/fields/Relationship/types.js.map +1 -1
  71. package/dist/fields/Select/Input.d.ts +3 -1
  72. package/dist/fields/Select/Input.d.ts.map +1 -1
  73. package/dist/fields/Select/Input.js.map +1 -1
  74. package/dist/fields/Select/index.d.ts +1 -1
  75. package/dist/fields/Select/index.d.ts.map +1 -1
  76. package/dist/fields/Select/index.js +4 -6
  77. package/dist/fields/Select/index.js.map +1 -1
  78. package/dist/fields/Tabs/index.js +1 -1
  79. package/dist/fields/Tabs/index.js.map +1 -1
  80. package/dist/fields/Text/Input.d.ts.map +1 -1
  81. package/dist/fields/Text/Input.js.map +1 -1
  82. package/dist/fields/Text/index.js +1 -1
  83. package/dist/fields/Text/index.js.map +1 -1
  84. package/dist/fields/Text/types.d.ts +9 -4
  85. package/dist/fields/Text/types.d.ts.map +1 -1
  86. package/dist/fields/Text/types.js.map +1 -1
  87. package/dist/fields/Textarea/index.js +1 -1
  88. package/dist/fields/Textarea/index.js.map +1 -1
  89. package/dist/fields/Upload/index.js +1 -1
  90. package/dist/fields/Upload/index.js.map +1 -1
  91. package/dist/forms/FieldError/index.js +1 -1
  92. package/dist/forms/FieldError/index.js.map +1 -1
  93. package/dist/forms/FieldPropsProvider/index.js +4 -4
  94. package/dist/forms/FieldPropsProvider/index.js.map +1 -1
  95. package/dist/forms/Form/index.js +1 -1
  96. package/dist/forms/Form/index.js.map +1 -1
  97. package/dist/forms/Form/types.d.ts +2 -3
  98. package/dist/forms/Form/types.d.ts.map +1 -1
  99. package/dist/forms/Form/types.js.map +1 -1
  100. package/dist/forms/withCondition/index.js +1 -1
  101. package/dist/forms/withCondition/index.js.map +1 -1
  102. package/dist/graphics/Account/index.d.ts +0 -1
  103. package/dist/graphics/Account/index.d.ts.map +1 -1
  104. package/dist/graphics/Account/index.js +5 -1
  105. package/dist/graphics/Account/index.js.map +1 -1
  106. package/dist/providers/ComponentMap/buildComponentMap/fields.d.ts.map +1 -1
  107. package/dist/providers/ComponentMap/buildComponentMap/fields.js +2 -1
  108. package/dist/providers/ComponentMap/buildComponentMap/fields.js.map +1 -1
  109. package/dist/providers/FormQueryParams/index.d.ts.map +1 -1
  110. package/dist/providers/FormQueryParams/index.js +8 -6
  111. package/dist/providers/FormQueryParams/index.js.map +1 -1
  112. package/package.json +4 -4
  113. package/dist/elements/TableColumns/columnReducer.d.ts +0 -24
  114. package/dist/elements/TableColumns/columnReducer.d.ts.map +0 -1
  115. package/dist/elements/TableColumns/columnReducer.js +0 -59
  116. package/dist/elements/TableColumns/columnReducer.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/Textarea/index.tsx"],"sourcesContent":["/* eslint-disable react/destructuring-assignment */\n'use client'\nimport type { ClientValidate } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback } from 'react'\n\nimport type { TextAreaInputProps, TextareaFieldProps } from './types.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { isFieldRTL } from '../shared/index.js'\nimport { TextareaInput } from './Input.js'\nimport './index.scss'\n\nexport { TextAreaInputProps, TextareaFieldProps, TextareaInput }\n\nconst TextareaField: React.FC<TextareaFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n label,\n labelProps,\n locale,\n localized,\n maxLength,\n minLength,\n path: pathFromProps,\n placeholder,\n readOnly: readOnlyFromProps,\n required,\n rows,\n rtl,\n style,\n validate,\n width,\n } = props\n\n const { i18n } = useTranslation()\n\n const { localization } = useConfig()\n\n const isRTL = isFieldRTL({\n fieldLocalized: localized,\n fieldRTL: rtl,\n locale,\n localizationConfig: localization || undefined,\n })\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function')\n return validate(value, { ...options, maxLength, minLength, required })\n },\n [validate, required, maxLength, minLength],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, path, setValue, showError, value } = useField<string>({\n path: pathFromContext || pathFromProps || name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n return (\n <TextareaInput\n AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n CustomDescription={CustomDescription}\n CustomError={CustomError}\n CustomLabel={CustomLabel}\n className={className}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n label={label}\n labelProps={labelProps}\n onChange={(e) => {\n setValue(e.target.value)\n }}\n path={path}\n placeholder={getTranslation(placeholder, i18n)}\n readOnly={disabled}\n required={required}\n rows={rows}\n rtl={isRTL}\n showError={showError}\n style={style}\n value={value}\n width={width}\n />\n )\n}\n\nexport const Textarea = withCondition(TextareaField)\n"],"names":["getTranslation","React","useCallback","useFieldProps","useField","withCondition","useConfig","useTranslation","isFieldRTL","TextareaInput","TextareaField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","label","labelProps","locale","localized","maxLength","minLength","path","pathFromProps","placeholder","readOnly","readOnlyFromProps","required","rows","rtl","style","validate","width","i18n","localization","isRTL","fieldLocalized","fieldRTL","localizationConfig","undefined","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formInitializing","formProcessing","setValue","showError","disabled","onChange","e","target","Textarea"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,iDAAiD,GACjD;;AAGA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAI1C,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC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,MAAMS,WAAWvB,qBAAqBkB,uBAAuBE,kBAAkBD;IAE/E,qBACE,KAACzC;QACCI,YAAYA;QACZC,aAAaA;QACbC,mBAAmBA;QACnBC,aAAaA;QACbC,aAAaA;QACbC,WAAWA;QACXC,kBAAkBA;QAClBC,YAAYA;QACZC,OAAOA;QACPC,YAAYA;QACZiC,UAAU,CAACC;YACTJ,SAASI,EAAEC,MAAM,CAACX,KAAK;QACzB;QACAnB,MAAMA;QACNE,aAAa7B,eAAe6B,aAAaS;QACzCR,UAAUwB;QACVtB,UAAUA;QACVC,MAAMA;QACNC,KAAKM;QACLa,WAAWA;QACXlB,OAAOA;QACPW,OAAOA;QACPT,OAAOA;;AAGb;AAEA,OAAO,MAAMqB,WAAWrD,cAAcK,eAAc"}
1
+ {"version":3,"sources":["../../../src/fields/Textarea/index.tsx"],"sourcesContent":["/* eslint-disable react/destructuring-assignment */\n'use client'\nimport type { ClientValidate } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback } from 'react'\n\nimport type { TextAreaInputProps, TextareaFieldProps } from './types.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { isFieldRTL } from '../shared/index.js'\nimport { TextareaInput } from './Input.js'\nimport './index.scss'\n\nexport { TextAreaInputProps, TextareaFieldProps, TextareaInput }\n\nconst TextareaField: React.FC<TextareaFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n label,\n labelProps,\n locale,\n localized,\n maxLength,\n minLength,\n path: pathFromProps,\n placeholder,\n readOnly: readOnlyFromProps,\n required,\n rows,\n rtl,\n style,\n validate,\n width,\n } = props\n\n const { i18n } = useTranslation()\n\n const { localization } = useConfig()\n\n const isRTL = isFieldRTL({\n fieldLocalized: localized,\n fieldRTL: rtl,\n locale,\n localizationConfig: localization || undefined,\n })\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function')\n return validate(value, { ...options, maxLength, minLength, required })\n },\n [validate, required, maxLength, minLength],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, path, setValue, showError, value } = useField<string>({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n return (\n <TextareaInput\n AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n CustomDescription={CustomDescription}\n CustomError={CustomError}\n CustomLabel={CustomLabel}\n className={className}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n label={label}\n labelProps={labelProps}\n onChange={(e) => {\n setValue(e.target.value)\n }}\n path={path}\n placeholder={getTranslation(placeholder, i18n)}\n readOnly={disabled}\n required={required}\n rows={rows}\n rtl={isRTL}\n showError={showError}\n style={style}\n value={value}\n width={width}\n />\n )\n}\n\nexport const Textarea = withCondition(TextareaField)\n"],"names":["getTranslation","React","useCallback","useFieldProps","useField","withCondition","useConfig","useTranslation","isFieldRTL","TextareaInput","TextareaField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","label","labelProps","locale","localized","maxLength","minLength","path","pathFromProps","placeholder","readOnly","readOnlyFromProps","required","rows","rtl","style","validate","width","i18n","localization","isRTL","fieldLocalized","fieldRTL","localizationConfig","undefined","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formInitializing","formProcessing","setValue","showError","disabled","onChange","e","target","Textarea"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,iDAAiD,GACjD;;AAGA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,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1C,SAAiB;QAC9FuB,MAAMqB,mBAAmBpB,iBAAiBhB;QAC1CwB,UAAUS;IACZ;IAEA,MAAMS,WAAWvB,qBAAqBkB,uBAAuBE,kBAAkBD;IAE/E,qBACE,KAACzC;QACCI,YAAYA;QACZC,aAAaA;QACbC,mBAAmBA;QACnBC,aAAaA;QACbC,aAAaA;QACbC,WAAWA;QACXC,kBAAkBA;QAClBC,YAAYA;QACZC,OAAOA;QACPC,YAAYA;QACZiC,UAAU,CAACC;YACTJ,SAASI,EAAEC,MAAM,CAACX,KAAK;QACzB;QACAnB,MAAMA;QACNE,aAAa7B,eAAe6B,aAAaS;QACzCR,UAAUwB;QACVtB,UAAUA;QACVC,MAAMA;QACNC,KAAKM;QACLa,WAAWA;QACXlB,OAAOA;QACPW,OAAOA;QACPT,OAAOA;;AAGb;AAEA,OAAO,MAAMqB,WAAWrD,cAAcK,eAAc"}
@@ -24,7 +24,7 @@ const _Upload = (props)=>{
24
24
  ]);
25
25
  const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps();
26
26
  const { filterOptions, formInitializing, formProcessing, path, setValue, showError, value } = useField({
27
- path: pathFromContext || pathFromProps,
27
+ path: pathFromContext ?? pathFromProps,
28
28
  validate: memoizedValidate
29
29
  });
30
30
  const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/Upload/index.tsx"],"sourcesContent":["'use client'\n\nimport React, { useCallback } from 'react'\n\nimport type { UploadInputProps } from './Input.js'\nimport type { UploadFieldProps } from './types.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { UploadInput } from './Input.js'\nimport './index.scss'\n\nexport { UploadFieldProps, UploadInput }\nexport type { UploadInputProps }\n\nconst _Upload: React.FC<UploadFieldProps> = (props) => {\n const {\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n label,\n labelProps,\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n relationTo,\n required,\n style,\n validate,\n width,\n } = props\n\n const {\n collections,\n routes: { api },\n serverURL,\n } = useConfig()\n\n const collection = collections.find((coll) => coll.slug === relationTo)\n\n const memoizedValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { filterOptions, formInitializing, formProcessing, path, setValue, showError, value } =\n useField<string>({\n path: pathFromContext || pathFromProps,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const onChange = useCallback(\n (incomingValue) => {\n const incomingID = incomingValue?.id || incomingValue\n setValue(incomingID)\n },\n [setValue],\n )\n\n if (collection.upload) {\n return (\n <UploadInput\n CustomDescription={CustomDescription}\n CustomError={CustomError}\n CustomLabel={CustomLabel}\n api={api}\n className={className}\n collection={collection}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n filterOptions={filterOptions}\n label={label}\n labelProps={labelProps}\n onChange={onChange}\n path={path}\n readOnly={disabled}\n relationTo={relationTo}\n required={required}\n serverURL={serverURL}\n showError={showError}\n style={style}\n value={value}\n width={width}\n />\n )\n }\n\n return null\n}\n\nexport const Upload = withCondition(_Upload)\n"],"names":["React","useCallback","useFieldProps","useField","withCondition","useConfig","UploadInput","_Upload","props","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","label","labelProps","path","pathFromProps","readOnly","readOnlyFromProps","relationTo","required","style","validate","width","collections","routes","api","serverURL","collection","find","coll","slug","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","filterOptions","formInitializing","formProcessing","setValue","showError","disabled","onChange","incomingValue","incomingID","id","upload","Upload"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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eAAeE,MAAMF;QACxCJ,SAASK;IACX,GACA;QAACL;KAAS;IAGZ,IAAIZ,WAAWmB,MAAM,EAAE;QACrB,qBACE,KAAC3C;YACCG,mBAAmBA;YACnBC,aAAaA;YACbC,aAAaA;YACbiB,KAAKA;YACLhB,WAAWA;YACXkB,YAAYA;YACZjB,kBAAkBA;YAClBC,YAAYA;YACZyB,eAAeA;YACfxB,OAAOA;YACPC,YAAYA;YACZ6B,UAAUA;YACV5B,MAAMA;YACNE,UAAUyB;YACVvB,YAAYA;YACZC,UAAUA;YACVO,WAAWA;YACXc,WAAWA;YACXpB,OAAOA;YACPY,OAAOA;YACPV,OAAOA;;IAGb;IAEA,OAAO;AACT;AAEA,OAAO,MAAMyB,SAAS9C,cAAcG,SAAQ"}
1
+ {"version":3,"sources":["../../../src/fields/Upload/index.tsx"],"sourcesContent":["'use client'\n\nimport React, { useCallback } from 'react'\n\nimport type { UploadInputProps } from './Input.js'\nimport type { UploadFieldProps } from './types.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { UploadInput } from './Input.js'\nimport './index.scss'\n\nexport { UploadFieldProps, UploadInput }\nexport type { UploadInputProps }\n\nconst _Upload: React.FC<UploadFieldProps> = (props) => {\n const {\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n label,\n labelProps,\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n relationTo,\n required,\n style,\n validate,\n width,\n } = props\n\n const {\n collections,\n routes: { api },\n serverURL,\n } = useConfig()\n\n const collection = collections.find((coll) => coll.slug === relationTo)\n\n const memoizedValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { filterOptions, formInitializing, formProcessing, path, setValue, showError, value } =\n useField<string>({\n path: pathFromContext ?? pathFromProps,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const onChange = useCallback(\n (incomingValue) => {\n const incomingID = incomingValue?.id || incomingValue\n setValue(incomingID)\n },\n [setValue],\n )\n\n if (collection.upload) {\n return (\n <UploadInput\n CustomDescription={CustomDescription}\n CustomError={CustomError}\n CustomLabel={CustomLabel}\n api={api}\n className={className}\n collection={collection}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n filterOptions={filterOptions}\n label={label}\n labelProps={labelProps}\n onChange={onChange}\n path={path}\n readOnly={disabled}\n relationTo={relationTo}\n required={required}\n serverURL={serverURL}\n showError={showError}\n style={style}\n value={value}\n width={width}\n />\n )\n }\n\n return null\n}\n\nexport const Upload = withCondition(_Upload)\n"],"names":["React","useCallback","useFieldProps","useField","withCondition","useConfig","UploadInput","_Upload","props","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","label","labelProps","path","pathFromProps","readOnly","readOnlyFromProps","relationTo","required","style","validate","width","collections","routes","api","serverURL","collection","find","coll","slug","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","filterOptions","formInitializing","formProcessing","setValue","showError","disabled","onChange","incomingValue","incomingID","id","upload","Upload"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAEA,OAAOA,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,WAAW,QAAQ,aAAY;AAGxC,SAA2BA,WAAW,GAAE;AAGxC,MAAMC,UAAsC,CAACC;IAC3C,MAAM,EACJC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,SA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;YACXpB,OAAOA;YACPY,OAAOA;YACPV,OAAOA;;IAGb;IAEA,OAAO;AACT;AAEA,OAAO,MAAMyB,SAAS9C,cAAcG,SAAQ"}
@@ -8,7 +8,7 @@ const baseClass = 'field-error';
8
8
  const DefaultFieldError = (props)=>{
9
9
  const { alignCaret = 'right', message: messageFromProps, path: pathFromProps, showError: showErrorFromProps } = props;
10
10
  const { path: pathFromContext } = useFieldProps();
11
- const path = pathFromContext || pathFromProps;
11
+ const path = pathFromContext ?? pathFromProps;
12
12
  const hasSubmitted = useFormSubmitted();
13
13
  const field = useFormFields(([fields])=>fields && fields?.[path] || null);
14
14
  const { errorMessage, valid } = field || {};
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/forms/FieldError/index.tsx"],"sourcesContent":["'use client'\n\nimport type { ErrorProps } from 'payload/types'\n\nimport React from 'react'\n\nimport { Tooltip } from '../../elements/Tooltip/index.js'\nimport { useFieldProps } from '../FieldPropsProvider/index.js'\nimport { useFormFields, useFormSubmitted } from '../Form/context.js'\nimport './index.scss'\n\nconst baseClass = 'field-error'\n\nconst DefaultFieldError: React.FC<ErrorProps> = (props) => {\n const {\n alignCaret = 'right',\n message: messageFromProps,\n path: pathFromProps,\n showError: showErrorFromProps,\n } = props\n\n const { path: pathFromContext } = useFieldProps()\n const path = pathFromContext || pathFromProps\n\n const hasSubmitted = useFormSubmitted()\n const field = useFormFields(([fields]) => (fields && fields?.[path]) || null)\n\n const { errorMessage, valid } = field || {}\n\n const message = messageFromProps || errorMessage\n const showMessage = showErrorFromProps || (hasSubmitted && valid === false)\n\n if (showMessage && message?.length) {\n return (\n <Tooltip alignCaret={alignCaret} className={baseClass} delay={0} staticPositioning>\n {message}\n </Tooltip>\n )\n }\n\n return null\n}\n\nexport const FieldError: React.FC<ErrorProps> = (props) => {\n const { CustomError } = props\n\n if (CustomError !== undefined) {\n return CustomError\n }\n\n return <DefaultFieldError {...props} />\n}\n"],"names":["React","Tooltip","useFieldProps","useFormFields","useFormSubmitted","baseClass","DefaultFieldError","props","alignCaret","message","messageFromProps","path","pathFromProps","showError","showErrorFromProps","pathFromContext","hasSubmitted","field","fields","errorMessage","valid","showMessage","length","className","delay","staticPositioning","FieldError","CustomError","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAIA,OAAOA,WAAW,QAAO;AAEzB,SAASC,OAAO,QAAQ,kCAAiC;AACzD,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,qBAAoB;AAGpE,MAAMC,YAAY;AAElB,MAAMC,oBAA0C,CAACC;IAC/C,MAAM,EACJC,aAAa,OAAO,EACpBC,SAASC,gBAAgB,EACzBC,MAAMC,aAAa,EACnBC,WAAWC,kBAAkB,EAC9B,GAAGP;IAEJ,MAAM,EAAEI,MAAMI,eAAe,EAAE,GAAGb;IAClC,MAAMS,OAAOI,mBAAmBH;IAEhC,MAAMI,eAAeZ;IACrB,MAAMa,QAAQd,cAAc,CAAC,CAACe,OAAO,GAAK,AAACA,UAAUA,QAAQ,CAACP,KAAK,IAAK;IAExE,MAAM,EAAEQ,YAAY,EAAEC,KAAK,EAAE,GAAGH,SAAS,CAAC;IAE1C,MAAMR,UAAUC,oBAAoBS;IACpC,MAAME,cAAcP,sBAAuBE,gBAAgBI,UAAU;IAErE,IAAIC,eAAeZ,SAASa,QAAQ;QAClC,qBACE,KAACrB;YAAQO,YAAYA;YAAYe,WAAWlB;YAAWmB,OAAO;YAAGC,iBAAiB;sBAC/EhB;;IAGP;IAEA,OAAO;AACT;AAEA,OAAO,MAAMiB,aAAmC,CAACnB;IAC/C,MAAM,EAAEoB,WAAW,EAAE,GAAGpB;IAExB,IAAIoB,gBAAgBC,WAAW;QAC7B,OAAOD;IACT;IAEA,qBAAO,KAACrB;QAAmB,GAAGC,KAAK;;AACrC,EAAC"}
1
+ {"version":3,"sources":["../../../src/forms/FieldError/index.tsx"],"sourcesContent":["'use client'\n\nimport type { ErrorProps } from 'payload/types'\n\nimport React from 'react'\n\nimport { Tooltip } from '../../elements/Tooltip/index.js'\nimport { useFieldProps } from '../FieldPropsProvider/index.js'\nimport { useFormFields, useFormSubmitted } from '../Form/context.js'\nimport './index.scss'\n\nconst baseClass = 'field-error'\n\nconst DefaultFieldError: React.FC<ErrorProps> = (props) => {\n const {\n alignCaret = 'right',\n message: messageFromProps,\n path: pathFromProps,\n showError: showErrorFromProps,\n } = props\n\n const { path: pathFromContext } = useFieldProps()\n const path = pathFromContext ?? pathFromProps\n\n const hasSubmitted = useFormSubmitted()\n const field = useFormFields(([fields]) => (fields && fields?.[path]) || null)\n\n const { errorMessage, valid } = field || {}\n\n const message = messageFromProps || errorMessage\n const showMessage = showErrorFromProps || (hasSubmitted && valid === false)\n\n if (showMessage && message?.length) {\n return (\n <Tooltip alignCaret={alignCaret} className={baseClass} delay={0} staticPositioning>\n {message}\n </Tooltip>\n )\n }\n\n return null\n}\n\nexport const FieldError: React.FC<ErrorProps> = (props) => {\n const { CustomError } = props\n\n if (CustomError !== undefined) {\n return CustomError\n }\n\n return <DefaultFieldError {...props} />\n}\n"],"names":["React","Tooltip","useFieldProps","useFormFields","useFormSubmitted","baseClass","DefaultFieldError","props","alignCaret","message","messageFromProps","path","pathFromProps","showError","showErrorFromProps","pathFromContext","hasSubmitted","field","fields","errorMessage","valid","showMessage","length","className","delay","staticPositioning","FieldError","CustomError","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAIA,OAAOA,WAAW,QAAO;AAEzB,SAASC,OAAO,QAAQ,kCAAiC;AACzD,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,qBAAoB;AAGpE,MAAMC,YAAY;AAElB,MAAMC,oBAA0C,CAACC;IAC/C,MAAM,EACJC,aAAa,OAAO,EACpBC,SAASC,gBAAgB,EACzBC,MAAMC,aAAa,EACnBC,WAAWC,kBAAkB,EAC9B,GAAGP;IAEJ,MAAM,EAAEI,MAAMI,eAAe,EAAE,GAAGb;IAClC,MAAMS,OAAOI,mBAAmBH;IAEhC,MAAMI,eAAeZ;IACrB,MAAMa,QAAQd,cAAc,CAAC,CAACe,OAAO,GAAK,AAACA,UAAUA,QAAQ,CAACP,KAAK,IAAK;IAExE,MAAM,EAAEQ,YAAY,EAAEC,KAAK,EAAE,GAAGH,SAAS,CAAC;IAE1C,MAAMR,UAAUC,oBAAoBS;IACpC,MAAME,cAAcP,sBAAuBE,gBAAgBI,UAAU;IAErE,IAAIC,eAAeZ,SAASa,QAAQ;QAClC,qBACE,KAACrB;YAAQO,YAAYA;YAAYe,WAAWlB;YAAWmB,OAAO;YAAGC,iBAAiB;sBAC/EhB;;IAGP;IAEA,OAAO;AACT;AAEA,OAAO,MAAMiB,aAAmC,CAACnB;IAC/C,MAAM,EAAEoB,WAAW,EAAE,GAAGpB;IAExB,IAAIoB,gBAAgBC,WAAW;QAC7B,OAAOD;IACT;IAEA,qBAAO,KAACrB;QAAmB,GAAGC,KAAK;;AACrC,EAAC"}
@@ -2,13 +2,13 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import React from 'react';
4
4
  const FieldPropsContext = /*#__PURE__*/ React.createContext({
5
- type: '',
5
+ type: undefined,
6
6
  custom: {},
7
- indexPath: '',
8
- path: '',
7
+ indexPath: undefined,
8
+ path: undefined,
9
9
  permissions: {},
10
10
  readOnly: false,
11
- schemaPath: '',
11
+ schemaPath: undefined,
12
12
  siblingPermissions: {}
13
13
  });
14
14
  export const FieldPropsProvider = ({ type, children, custom, indexPath, path, permissions, readOnly, schemaPath, siblingPermissions })=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/forms/FieldPropsProvider/index.tsx"],"sourcesContent":["'use client'\nimport type { FieldTypes } from 'payload/config'\nimport type { FieldPermissions } from 'payload/types'\n\nimport React from 'react'\n\nexport type FieldPropsContextType = {\n custom?: Record<any, string>\n indexPath?: string\n path: string\n permissions?: FieldPermissions\n readOnly: boolean\n schemaPath: string\n siblingPermissions: {\n [fieldName: string]: FieldPermissions\n }\n type: keyof FieldTypes\n}\n\nconst FieldPropsContext = React.createContext<FieldPropsContextType>({\n type: '' as keyof FieldTypes,\n custom: {},\n indexPath: '',\n path: '',\n permissions: {} as FieldPermissions,\n readOnly: false,\n schemaPath: '',\n siblingPermissions: {},\n})\n\nexport type Props = {\n children: React.ReactNode\n custom?: Record<any, string>\n indexPath?: string\n isForceRendered?: boolean\n path: string\n permissions?: FieldPermissions\n readOnly: boolean\n schemaPath: string\n siblingPermissions: {\n [fieldName: string]: FieldPermissions\n }\n type: keyof FieldTypes\n}\n\nexport const FieldPropsProvider: React.FC<Props> = ({\n type,\n children,\n custom,\n indexPath,\n path,\n permissions,\n readOnly,\n schemaPath,\n siblingPermissions,\n}) => {\n return (\n <FieldPropsContext.Provider\n value={{\n type,\n custom,\n indexPath,\n path,\n permissions,\n readOnly,\n schemaPath,\n siblingPermissions,\n }}\n >\n {children}\n </FieldPropsContext.Provider>\n )\n}\n\nexport const useFieldProps = () => {\n const props = React.useContext(FieldPropsContext)\n return props\n}\n"],"names":["React","FieldPropsContext","createContext","type","custom","indexPath","path","permissions","readOnly","schemaPath","siblingPermissions","FieldPropsProvider","children","Provider","value","useFieldProps","props","useContext"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAIA,OAAOA,WAAW,QAAO;AAezB,MAAMC,kCAAoBD,MAAME,aAAa,CAAwB;IACnEC,MAAM;IACNC,QAAQ,CAAC;IACTC,WAAW;IACXC,MAAM;IACNC,aAAa,CAAC;IACdC,UAAU;IACVC,YAAY;IACZC,oBAAoB,CAAC;AACvB;AAiBA,OAAO,MAAMC,qBAAsC,CAAC,EAClDR,IAAI,EACJS,QAAQ,EACRR,MAAM,EACNC,SAAS,EACTC,IAAI,EACJC,WAAW,EACXC,QAAQ,EACRC,UAAU,EACVC,kBAAkB,EACnB;IACC,qBACE,KAACT,kBAAkBY,QAAQ;QACzBC,OAAO;YACLX;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;QACF;kBAECE;;AAGP,EAAC;AAED,OAAO,MAAMG,gBAAgB;IAC3B,MAAMC,QAAQhB,MAAMiB,UAAU,CAAChB;IAC/B,OAAOe;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/forms/FieldPropsProvider/index.tsx"],"sourcesContent":["'use client'\nimport type { FieldTypes } from 'payload/config'\nimport type { FieldPermissions } from 'payload/types'\n\nimport React from 'react'\n\nexport type FieldPropsContextType = {\n custom?: Record<any, string>\n indexPath?: string\n path: string\n permissions?: FieldPermissions\n readOnly: boolean\n schemaPath: string\n siblingPermissions: {\n [fieldName: string]: FieldPermissions\n }\n type: keyof FieldTypes\n}\n\nconst FieldPropsContext = React.createContext<FieldPropsContextType>({\n type: undefined as keyof FieldTypes,\n custom: {},\n indexPath: undefined,\n path: undefined,\n permissions: {} as FieldPermissions,\n readOnly: false,\n schemaPath: undefined,\n siblingPermissions: {},\n})\n\nexport type Props = {\n children: React.ReactNode\n custom?: Record<any, string>\n indexPath?: string\n isForceRendered?: boolean\n path: string\n permissions?: FieldPermissions\n readOnly: boolean\n schemaPath: string\n siblingPermissions: {\n [fieldName: string]: FieldPermissions\n }\n type: keyof FieldTypes\n}\n\nexport const FieldPropsProvider: React.FC<Props> = ({\n type,\n children,\n custom,\n indexPath,\n path,\n permissions,\n readOnly,\n schemaPath,\n siblingPermissions,\n}) => {\n return (\n <FieldPropsContext.Provider\n value={{\n type,\n custom,\n indexPath,\n path,\n permissions,\n readOnly,\n schemaPath,\n siblingPermissions,\n }}\n >\n {children}\n </FieldPropsContext.Provider>\n )\n}\n\nexport const useFieldProps = () => {\n const props = React.useContext(FieldPropsContext)\n return props\n}\n"],"names":["React","FieldPropsContext","createContext","type","undefined","custom","indexPath","path","permissions","readOnly","schemaPath","siblingPermissions","FieldPropsProvider","children","Provider","value","useFieldProps","props","useContext"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAIA,OAAOA,WAAW,QAAO;AAezB,MAAMC,kCAAoBD,MAAME,aAAa,CAAwB;IACnEC,MAAMC;IACNC,QAAQ,CAAC;IACTC,WAAWF;IACXG,MAAMH;IACNI,aAAa,CAAC;IACdC,UAAU;IACVC,YAAYN;IACZO,oBAAoB,CAAC;AACvB;AAiBA,OAAO,MAAMC,qBAAsC,CAAC,EAClDT,IAAI,EACJU,QAAQ,EACRR,MAAM,EACNC,SAAS,EACTC,IAAI,EACJC,WAAW,EACXC,QAAQ,EACRC,UAAU,EACVC,kBAAkB,EACnB;IACC,qBACE,KAACV,kBAAkBa,QAAQ;QACzBC,OAAO;YACLZ;YACAE;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;QACF;kBAECE;;AAGP,EAAC;AAED,OAAO,MAAMG,gBAAgB;IAC3B,MAAMC,QAAQjB,MAAMkB,UAAU,CAACjB;IAC/B,OAAOgB;AACT,EAAC"}
@@ -210,7 +210,7 @@ export const Form = (props)=>{
210
210
  setModified(false);
211
211
  setDisabled(false);
212
212
  if (typeof handleResponse === 'function') {
213
- handleResponse(res);
213
+ handleResponse(res, successToast, errorToast);
214
214
  return;
215
215
  }
216
216
  const contentType = res.headers.get('content-type');
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/forms/Form/index.tsx"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload/types'\n\n/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\nimport isDeepEqual from 'deep-equal'\nimport { useRouter } from 'next/navigation.js'\nimport { serialize } from 'object-to-formdata'\nimport { wait } from 'payload/utilities'\nimport QueryString from 'qs'\nimport React, { useCallback, useEffect, useReducer, useRef, useState } from 'react'\nimport { toast } from 'sonner'\n\nimport type {\n Context as FormContextType,\n FormProps,\n GetDataByPath,\n SubmitOptions,\n} from './types.js'\n\nimport { useDebouncedEffect } from '../../hooks/useDebouncedEffect.js'\nimport useThrottledEffect from '../../hooks/useThrottledEffect.js'\nimport { useAuth } from '../../providers/Auth/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useFormQueryParams } from '../../providers/FormQueryParams/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useOperation } from '../../providers/Operation/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { requests } from '../../utilities/api.js'\nimport { getFormState } from '../../utilities/getFormState.js'\nimport { reduceFieldsToValues } from '../../utilities/reduceFieldsToValues.js'\nimport {\n FormContext,\n FormFieldsContext,\n FormWatchContext,\n InitializingContext,\n ModifiedContext,\n ProcessingContext,\n SubmittedContext,\n} from './context.js'\nimport { errorMessages } from './errorMessages.js'\nimport { fieldReducer } from './fieldReducer.js'\nimport { getDataByPath as getDataByPathFunc } from './getDataByPath.js'\nimport { getSiblingData as getSiblingDataFunc } from './getSiblingData.js'\nimport { initContextState } from './initContextState.js'\nimport { mergeServerFormState } from './mergeServerFormState.js'\n\nconst baseClass = 'form'\n\nexport const Form: React.FC<FormProps> = (props) => {\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n\n const {\n action,\n beforeSubmit,\n children,\n className,\n disableSuccessStatus,\n disableValidationOnSubmit,\n disabled: disabledFromProps,\n // fields: fieldsFromProps = collection?.fields || global?.fields,\n handleResponse,\n initialState, // fully formed initial field state\n isInitializing: initializingFromProps,\n onChange,\n onSubmit,\n onSuccess,\n redirect,\n submitted: submittedFromProps,\n uuid,\n waitForAutocomplete,\n } = props\n\n const method = 'method' in props ? props?.method : undefined\n\n const router = useRouter()\n\n const { code: locale } = useLocale()\n const { i18n, t } = useTranslation()\n const { refreshCookie, user } = useAuth()\n const operation = useOperation()\n const { formQueryParams } = useFormQueryParams()\n\n const config = useConfig()\n const {\n routes: { api: apiRoute },\n serverURL,\n } = config\n\n const [disabled, setDisabled] = useState(disabledFromProps || false)\n const [isMounted, setIsMounted] = useState(false)\n const [modified, setModified] = useState(false)\n const [initializing, setInitializing] = useState(initializingFromProps)\n const [processing, setProcessing] = useState(false)\n const [submitted, setSubmitted] = useState(false)\n const formRef = useRef<HTMLFormElement>(null)\n const contextRef = useRef({} as FormContextType)\n\n const fieldsReducer = useReducer(fieldReducer, {}, () => initialState)\n\n /**\n * `fields` is the current, up-to-date state/data of all fields in the form. It can be modified by using dispatchFields,\n * which calls the fieldReducer, which then updates the state.\n */\n const [fields, dispatchFields] = fieldsReducer\n\n contextRef.current.fields = fields\n\n const validateForm = useCallback(async () => {\n const validatedFieldState = {}\n let isValid = true\n\n const dataFromContext = contextRef.current.getData()\n const data = dataFromContext\n\n const validationPromises = Object.entries(contextRef.current.fields).map(\n async ([path, field]) => {\n const validatedField = field\n\n if (field.passesCondition !== false) {\n let validationResult: boolean | string = validatedField.valid\n\n if (typeof field.validate === 'function') {\n let valueToValidate = field.value\n\n if (field?.rows && Array.isArray(field.rows)) {\n valueToValidate = contextRef.current.getDataByPath(path)\n }\n\n validationResult = await field.validate(valueToValidate, {\n id,\n config,\n data,\n operation,\n siblingData: contextRef.current.getSiblingData(path),\n t,\n user,\n })\n\n if (typeof validationResult === 'string') {\n validatedField.errorMessage = validationResult\n validatedField.valid = false\n } else {\n validatedField.valid = true\n validatedField.errorMessage = undefined\n }\n }\n\n if (validatedField.valid === false) {\n isValid = false\n }\n }\n\n validatedFieldState[path] = validatedField\n },\n )\n\n await Promise.all(validationPromises)\n\n if (!isDeepEqual(contextRef.current.fields, validatedFieldState)) {\n dispatchFields({ type: 'REPLACE_STATE', state: validatedFieldState })\n }\n\n return isValid\n }, [id, user, operation, t, dispatchFields, config])\n\n const submit = useCallback(\n async (options: SubmitOptions = {}, e): Promise<void> => {\n const {\n action: actionArg,\n method: methodToUse = method,\n overrides = {},\n skipValidation,\n } = options\n\n if (disabled) {\n if (e) {\n e.preventDefault()\n }\n return\n }\n\n // create new toast promise which will resolve manually later\n let successToast, errorToast\n const promise = new Promise((resolve, reject) => {\n successToast = resolve\n errorToast = reject\n })\n\n const hasFormSubmitAction =\n actionArg || typeof action === 'string' || typeof action === 'function'\n\n if (redirect || disableSuccessStatus || !hasFormSubmitAction) {\n // Do not show submitting toast, as the promise toast may never disappear under these conditions.\n // Instead, make successToast() or errorToast() throw toast.success / toast.error\n successToast = (data) => toast.success(data)\n errorToast = (data) => toast.error(data)\n } else {\n toast.promise(promise, {\n error: (data) => {\n return data as string\n },\n loading: t('general:submitting'),\n success: (data) => {\n return data as string\n },\n })\n }\n\n if (e) {\n e.stopPropagation()\n e.preventDefault()\n }\n\n setProcessing(true)\n setDisabled(true)\n\n if (waitForAutocomplete) await wait(100)\n\n // Execute server side validations\n if (Array.isArray(beforeSubmit)) {\n let revalidatedFormState: FormState\n\n await beforeSubmit.reduce(async (priorOnChange, beforeSubmitFn) => {\n await priorOnChange\n\n const result = await beforeSubmitFn({\n formState: fields,\n })\n\n revalidatedFormState = result\n }, Promise.resolve())\n\n const isValid = Object.entries(revalidatedFormState).every(([, field]) => field.valid)\n\n if (!isValid) {\n setProcessing(false)\n setSubmitted(true)\n setDisabled(false)\n return dispatchFields({ type: 'REPLACE_STATE', state: revalidatedFormState })\n }\n }\n\n const isValid =\n skipValidation || disableValidationOnSubmit ? true : await contextRef.current.validateForm()\n\n // If not valid, prevent submission\n if (!isValid) {\n errorToast(t('error:correctInvalidFields'))\n setProcessing(false)\n setSubmitted(true)\n setDisabled(false)\n return\n }\n\n // If submit handler comes through via props, run that\n if (onSubmit) {\n const data = {\n ...reduceFieldsToValues(fields, true),\n ...overrides,\n }\n\n onSubmit(fields, data)\n }\n\n if (!hasFormSubmitAction) {\n // No action provided, so we should return. An example where this happens are lexical link drawers. Upon submitting the drawer, we\n // want to close it without submitting the form. Stuff like validation would be handled by lexical before this, through beforeSubmit\n setProcessing(false)\n setSubmitted(true)\n setDisabled(false)\n return\n }\n\n const formData = contextRef.current.createFormData(overrides)\n\n try {\n let res\n const actionEndpoint =\n actionArg ||\n (typeof action === 'string'\n ? `${action}${QueryString.stringify(formQueryParams, { addQueryPrefix: true })}`\n : null)\n\n if (actionEndpoint) {\n res = await requests[methodToUse.toLowerCase()](actionEndpoint, {\n body: formData,\n headers: {\n 'Accept-Language': i18n.language,\n },\n })\n } else if (typeof action === 'function') {\n res = await action(formData)\n }\n\n setModified(false)\n setDisabled(false)\n\n if (typeof handleResponse === 'function') {\n handleResponse(res)\n return\n }\n\n const contentType = res.headers.get('content-type')\n const isJSON = contentType && contentType.indexOf('application/json') !== -1\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let json: Record<string, any> = {}\n\n if (isJSON) json = await res.json()\n if (res.status < 400) {\n if (typeof onSuccess === 'function') await onSuccess(json)\n setSubmitted(false)\n setProcessing(false)\n\n if (redirect) {\n router.push(redirect)\n } else if (!disableSuccessStatus) {\n successToast(json.message || t('general:submissionSuccessful'))\n }\n } else {\n setProcessing(false)\n setSubmitted(true)\n\n contextRef.current = { ...contextRef.current } // triggers rerender of all components that subscribe to form\n if (json.message) {\n errorToast(json.message)\n\n return\n }\n\n if (Array.isArray(json.errors)) {\n const [fieldErrors, nonFieldErrors] = json.errors.reduce(\n ([fieldErrs, nonFieldErrs], err) => {\n const newFieldErrs = []\n const newNonFieldErrs = []\n\n if (err?.message) {\n newNonFieldErrs.push(err)\n }\n\n if (Array.isArray(err?.data)) {\n err.data.forEach((dataError) => {\n if (dataError?.field) {\n newFieldErrs.push(dataError)\n } else {\n newNonFieldErrs.push(dataError)\n }\n })\n }\n\n return [\n [...fieldErrs, ...newFieldErrs],\n [...nonFieldErrs, ...newNonFieldErrs],\n ]\n },\n [[], []],\n )\n\n dispatchFields({\n type: 'ADD_SERVER_ERRORS',\n errors: fieldErrors,\n })\n\n nonFieldErrors.forEach((err) => {\n errorToast(err.message || t('error:unknown'))\n })\n\n return\n }\n\n const message = errorMessages?.[res.status] || res?.statusText || t('error:unknown')\n\n errorToast(message)\n }\n } catch (err) {\n console.error('Error submitting form', err)\n setProcessing(false)\n setSubmitted(true)\n setDisabled(false)\n\n errorToast(err.message)\n }\n },\n [\n beforeSubmit,\n action,\n disableSuccessStatus,\n disableValidationOnSubmit,\n disabled,\n dispatchFields,\n fields,\n handleResponse,\n method,\n onSubmit,\n onSuccess,\n redirect,\n router,\n t,\n i18n,\n waitForAutocomplete,\n formQueryParams,\n ],\n )\n\n const getFields = useCallback(() => contextRef.current.fields, [])\n\n const getField = useCallback((path: string) => contextRef.current.fields[path], [])\n\n const getData = useCallback(() => reduceFieldsToValues(contextRef.current.fields, true), [])\n\n const getSiblingData = useCallback(\n (path: string) => getSiblingDataFunc(contextRef.current.fields, path),\n [],\n )\n const getDataByPath = useCallback<GetDataByPath>(\n (path: string) => getDataByPathFunc(contextRef.current.fields, path),\n [],\n )\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const createFormData = useCallback((overrides: any = {}) => {\n const data = reduceFieldsToValues(contextRef.current.fields, true)\n\n const file = data?.file\n\n if (file) {\n delete data.file\n }\n\n const dataWithOverrides = {\n ...data,\n ...overrides,\n }\n\n const dataToSerialize = {\n _payload: JSON.stringify(dataWithOverrides),\n file,\n }\n\n // nullAsUndefineds is important to allow uploads and relationship fields to clear themselves\n const formData = serialize(dataToSerialize, { indices: true, nullsAsUndefineds: false })\n\n return formData\n }, [])\n\n const reset = useCallback(\n async (data: unknown) => {\n const newState = await getFormState({\n apiRoute,\n body: {\n id,\n collectionSlug,\n data,\n globalSlug,\n operation,\n schemaPath: collectionSlug || globalSlug,\n },\n serverURL,\n })\n\n contextRef.current = { ...initContextState } as FormContextType\n setModified(false)\n dispatchFields({ type: 'REPLACE_STATE', state: newState })\n },\n [apiRoute, collectionSlug, dispatchFields, globalSlug, id, operation, serverURL],\n )\n\n const replaceState = useCallback(\n (state: FormState) => {\n contextRef.current = { ...initContextState } as FormContextType\n setModified(false)\n dispatchFields({ type: 'REPLACE_STATE', state })\n },\n [dispatchFields],\n )\n\n const getFieldStateBySchemaPath = useCallback(\n async ({ data, schemaPath }) => {\n const fieldSchema = await getFormState({\n apiRoute,\n body: {\n collectionSlug,\n data,\n globalSlug,\n schemaPath,\n },\n serverURL,\n })\n return fieldSchema\n },\n [apiRoute, collectionSlug, globalSlug, serverURL],\n )\n\n const addFieldRow: FormContextType['addFieldRow'] = useCallback(\n async ({ data, path, rowIndex, schemaPath }) => {\n const subFieldState = await getFieldStateBySchemaPath({ data, schemaPath })\n\n dispatchFields({\n type: 'ADD_ROW',\n blockType: data?.blockType,\n path,\n rowIndex,\n subFieldState,\n })\n },\n [getFieldStateBySchemaPath, dispatchFields],\n )\n\n const removeFieldRow: FormContextType['removeFieldRow'] = useCallback(\n ({ path, rowIndex }) => {\n dispatchFields({ type: 'REMOVE_ROW', path, rowIndex })\n },\n [dispatchFields],\n )\n\n const replaceFieldRow: FormContextType['replaceFieldRow'] = useCallback(\n async ({ data, path, rowIndex, schemaPath }) => {\n const subFieldState = await getFieldStateBySchemaPath({ data, schemaPath })\n\n dispatchFields({\n type: 'REPLACE_ROW',\n blockType: data?.blockType,\n path,\n rowIndex,\n subFieldState,\n })\n },\n [getFieldStateBySchemaPath, dispatchFields],\n )\n\n useEffect(() => {\n if (initializingFromProps !== undefined) {\n setInitializing(initializingFromProps)\n }\n }, [initializingFromProps])\n\n contextRef.current.submit = submit\n contextRef.current.getFields = getFields\n contextRef.current.getField = getField\n contextRef.current.getData = getData\n contextRef.current.getSiblingData = getSiblingData\n contextRef.current.getDataByPath = getDataByPath\n contextRef.current.validateForm = validateForm\n contextRef.current.createFormData = createFormData\n contextRef.current.setModified = setModified\n contextRef.current.setProcessing = setProcessing\n contextRef.current.setSubmitted = setSubmitted\n contextRef.current.disabled = disabled\n contextRef.current.setDisabled = setDisabled\n contextRef.current.formRef = formRef\n contextRef.current.reset = reset\n contextRef.current.replaceState = replaceState\n contextRef.current.dispatchFields = dispatchFields\n contextRef.current.addFieldRow = addFieldRow\n contextRef.current.removeFieldRow = removeFieldRow\n contextRef.current.replaceFieldRow = replaceFieldRow\n contextRef.current.uuid = uuid\n contextRef.current.initializing = initializing\n\n useEffect(() => {\n setIsMounted(true)\n }, [])\n\n useEffect(() => {\n if (typeof disabledFromProps === 'boolean') setDisabled(disabledFromProps)\n }, [disabledFromProps])\n\n useEffect(() => {\n if (typeof submittedFromProps === 'boolean') setSubmitted(submittedFromProps)\n }, [submittedFromProps])\n\n useEffect(() => {\n if (initialState) {\n contextRef.current = { ...initContextState } as FormContextType\n dispatchFields({ type: 'REPLACE_STATE', optimize: false, state: initialState })\n }\n }, [initialState, dispatchFields])\n\n useThrottledEffect(\n () => {\n refreshCookie()\n },\n 15000,\n [fields],\n )\n\n useEffect(() => {\n contextRef.current = { ...contextRef.current } // triggers rerender of all components that subscribe to form\n setModified(false)\n }, [locale])\n\n const classes = [className, baseClass].filter(Boolean).join(' ')\n\n useDebouncedEffect(\n () => {\n const executeOnChange = async () => {\n if (Array.isArray(onChange)) {\n let revalidatedFormState: FormState = contextRef.current.fields\n\n for (const onChangeFn of onChange) {\n revalidatedFormState = await onChangeFn({\n formState: revalidatedFormState,\n })\n }\n\n const { changed, newState } = mergeServerFormState(\n contextRef.current.fields || {},\n revalidatedFormState,\n )\n\n if (changed) {\n dispatchFields({\n type: 'REPLACE_STATE',\n optimize: false,\n state: newState,\n })\n }\n }\n }\n\n if (modified) void executeOnChange()\n },\n 150,\n // Make sure we trigger this whenever modified changes (not just when `fields` changes), otherwise we will miss merging server form state for the first form update/onChange. Here's why:\n // `fields` updates before `modified`, because setModified is in a setTimeout. So on the first change, modified is false, so we don't trigger the effect even though we should.\n [contextRef.current.fields, dispatchFields, onChange, modified],\n )\n\n const actionString =\n typeof action === 'string'\n ? `${action}${QueryString.stringify(formQueryParams, { addQueryPrefix: true })}`\n : ''\n\n return (\n <form\n action={method ? actionString : (action as string)}\n className={classes}\n method={method}\n noValidate\n onSubmit={(e) => contextRef.current.submit({}, e)}\n ref={formRef}\n >\n <FormContext.Provider value={contextRef.current}>\n <FormWatchContext.Provider\n value={{\n fields,\n ...contextRef.current,\n }}\n >\n <SubmittedContext.Provider value={submitted}>\n <InitializingContext.Provider value={!isMounted || (isMounted && initializing)}>\n <ProcessingContext.Provider value={processing}>\n <ModifiedContext.Provider value={modified}>\n <FormFieldsContext.Provider value={fieldsReducer}>\n {children}\n </FormFieldsContext.Provider>\n </ModifiedContext.Provider>\n </ProcessingContext.Provider>\n </InitializingContext.Provider>\n </SubmittedContext.Provider>\n </FormWatchContext.Provider>\n </FormContext.Provider>\n </form>\n )\n}\n\nexport {\n FormContext,\n FormFieldsContext,\n FormWatchContext,\n ModifiedContext,\n ProcessingContext,\n SubmittedContext,\n useAllFormFields,\n useForm,\n useFormFields,\n useFormModified,\n useFormProcessing,\n useFormSubmitted,\n useWatchForm,\n} from './context.js'\n\nexport { FormProps }\n"],"names":["isDeepEqual","useRouter","serialize","wait","QueryString","React","useCallback","useEffect","useReducer","useRef","useState","toast","useDebouncedEffect","useThrottledEffect","useAuth","useConfig","useDocumentInfo","useFormQueryParams","useLocale","useOperation","useTranslation","requests","getFormState","reduceFieldsToValues","FormContext","FormFieldsContext","FormWatchContext","InitializingContext","ModifiedContext","ProcessingContext","SubmittedContext","errorMessages","fieldReducer","getDataByPath","getDataByPathFunc","getSiblingData","getSiblingDataFunc","initContextState","mergeServerFormState","baseClass","Form","props","id","collectionSlug","globalSlug","action","beforeSubmit","children","className","disableSuccessStatus","disableValidationOnSubmit","disabled","disabledFromProps","handleResponse","initialState","isInitializing","initializingFromProps","onChange","onSubmit","onSuccess","redirect","submitted","submittedFromProps","uuid","waitForAutocomplete","method","undefined","router","code","locale","i18n","t","refreshCookie","user","operation","formQueryParams","config","routes","api","apiRoute","serverURL","setDisabled","isMounted","setIsMounted","modified","setModified","initializing","setInitializing","processing","setProcessing","setSubmitted","formRef","contextRef","fieldsReducer","fields","dispatchFields","current","validateForm","validatedFieldState","isValid","dataFromContext","getData","data","validationPromises","Object","entries","map","path","field","validatedField","passesCondition","validationResult","valid","validate","valueToValidate","value","rows","Array","isArray","siblingData","errorMessage","Promise","all","type","state","submit","options","e","actionArg","methodToUse","overrides","skipValidation","preventDefault","successToast","errorToast","promise","resolve","reject","hasFormSubmitAction","success","error","loading","stopPropagation","revalidatedFormState","reduce","priorOnChange","beforeSubmitFn","result","formState","every","formData","createFormData","res","actionEndpoint","stringify","addQueryPrefix","toLowerCase","body","headers","language","contentType","get","isJSON","indexOf","json","status","push","message","errors","fieldErrors","nonFieldErrors","fieldErrs","nonFieldErrs","err","newFieldErrs","newNonFieldErrs","forEach","dataError","statusText","console","getFields","getField","file","dataWithOverrides","dataToSerialize","_payload","JSON","indices","nullsAsUndefineds","reset","newState","schemaPath","replaceState","getFieldStateBySchemaPath","fieldSchema","addFieldRow","rowIndex","subFieldState","blockType","removeFieldRow","replaceFieldRow","optimize","classes","filter","Boolean","join","executeOnChange","onChangeFn","changed","actionString","form","noValidate","ref","Provider","useAllFormFields","useForm","useFormFields","useFormModified","useFormProcessing","useFormSubmitted","useWatchForm"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;AAUrB,EAAC;AAED,SACEvB,WAAW,EACXC,iBAAiB,EACjBC,gBAAgB,EAChBE,eAAe,EACfC,iBAAiB,EACjBC,gBAAgB,EAChBwL,gBAAgB,EAChBC,OAAO,EACPC,aAAa,EACbC,eAAe,EACfC,iBAAiB,EACjBC,gBAAgB,EAChBC,YAAY,QACP,eAAc"}
1
+ {"version":3,"sources":["../../../src/forms/Form/index.tsx"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload/types'\n\n/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\nimport isDeepEqual from 'deep-equal'\nimport { useRouter } from 'next/navigation.js'\nimport { serialize } from 'object-to-formdata'\nimport { wait } from 'payload/utilities'\nimport QueryString from 'qs'\nimport React, { useCallback, useEffect, useReducer, useRef, useState } from 'react'\nimport { toast } from 'sonner'\n\nimport type {\n Context as FormContextType,\n FormProps,\n GetDataByPath,\n SubmitOptions,\n} from './types.js'\n\nimport { useDebouncedEffect } from '../../hooks/useDebouncedEffect.js'\nimport useThrottledEffect from '../../hooks/useThrottledEffect.js'\nimport { useAuth } from '../../providers/Auth/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useFormQueryParams } from '../../providers/FormQueryParams/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useOperation } from '../../providers/Operation/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { requests } from '../../utilities/api.js'\nimport { getFormState } from '../../utilities/getFormState.js'\nimport { reduceFieldsToValues } from '../../utilities/reduceFieldsToValues.js'\nimport {\n FormContext,\n FormFieldsContext,\n FormWatchContext,\n InitializingContext,\n ModifiedContext,\n ProcessingContext,\n SubmittedContext,\n} from './context.js'\nimport { errorMessages } from './errorMessages.js'\nimport { fieldReducer } from './fieldReducer.js'\nimport { getDataByPath as getDataByPathFunc } from './getDataByPath.js'\nimport { getSiblingData as getSiblingDataFunc } from './getSiblingData.js'\nimport { initContextState } from './initContextState.js'\nimport { mergeServerFormState } from './mergeServerFormState.js'\n\nconst baseClass = 'form'\n\nexport const Form: React.FC<FormProps> = (props) => {\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n\n const {\n action,\n beforeSubmit,\n children,\n className,\n disableSuccessStatus,\n disableValidationOnSubmit,\n disabled: disabledFromProps,\n // fields: fieldsFromProps = collection?.fields || global?.fields,\n handleResponse,\n initialState, // fully formed initial field state\n isInitializing: initializingFromProps,\n onChange,\n onSubmit,\n onSuccess,\n redirect,\n submitted: submittedFromProps,\n uuid,\n waitForAutocomplete,\n } = props\n\n const method = 'method' in props ? props?.method : undefined\n\n const router = useRouter()\n\n const { code: locale } = useLocale()\n const { i18n, t } = useTranslation()\n const { refreshCookie, user } = useAuth()\n const operation = useOperation()\n const { formQueryParams } = useFormQueryParams()\n\n const config = useConfig()\n const {\n routes: { api: apiRoute },\n serverURL,\n } = config\n\n const [disabled, setDisabled] = useState(disabledFromProps || false)\n const [isMounted, setIsMounted] = useState(false)\n const [modified, setModified] = useState(false)\n const [initializing, setInitializing] = useState(initializingFromProps)\n const [processing, setProcessing] = useState(false)\n const [submitted, setSubmitted] = useState(false)\n const formRef = useRef<HTMLFormElement>(null)\n const contextRef = useRef({} as FormContextType)\n\n const fieldsReducer = useReducer(fieldReducer, {}, () => initialState)\n\n /**\n * `fields` is the current, up-to-date state/data of all fields in the form. It can be modified by using dispatchFields,\n * which calls the fieldReducer, which then updates the state.\n */\n const [fields, dispatchFields] = fieldsReducer\n\n contextRef.current.fields = fields\n\n const validateForm = useCallback(async () => {\n const validatedFieldState = {}\n let isValid = true\n\n const dataFromContext = contextRef.current.getData()\n const data = dataFromContext\n\n const validationPromises = Object.entries(contextRef.current.fields).map(\n async ([path, field]) => {\n const validatedField = field\n\n if (field.passesCondition !== false) {\n let validationResult: boolean | string = validatedField.valid\n\n if (typeof field.validate === 'function') {\n let valueToValidate = field.value\n\n if (field?.rows && Array.isArray(field.rows)) {\n valueToValidate = contextRef.current.getDataByPath(path)\n }\n\n validationResult = await field.validate(valueToValidate, {\n id,\n config,\n data,\n operation,\n siblingData: contextRef.current.getSiblingData(path),\n t,\n user,\n })\n\n if (typeof validationResult === 'string') {\n validatedField.errorMessage = validationResult\n validatedField.valid = false\n } else {\n validatedField.valid = true\n validatedField.errorMessage = undefined\n }\n }\n\n if (validatedField.valid === false) {\n isValid = false\n }\n }\n\n validatedFieldState[path] = validatedField\n },\n )\n\n await Promise.all(validationPromises)\n\n if (!isDeepEqual(contextRef.current.fields, validatedFieldState)) {\n dispatchFields({ type: 'REPLACE_STATE', state: validatedFieldState })\n }\n\n return isValid\n }, [id, user, operation, t, dispatchFields, config])\n\n const submit = useCallback(\n async (options: SubmitOptions = {}, e): Promise<void> => {\n const {\n action: actionArg,\n method: methodToUse = method,\n overrides = {},\n skipValidation,\n } = options\n\n if (disabled) {\n if (e) {\n e.preventDefault()\n }\n return\n }\n\n // create new toast promise which will resolve manually later\n let successToast, errorToast\n const promise = new Promise((resolve, reject) => {\n successToast = resolve\n errorToast = reject\n })\n\n const hasFormSubmitAction =\n actionArg || typeof action === 'string' || typeof action === 'function'\n\n if (redirect || disableSuccessStatus || !hasFormSubmitAction) {\n // Do not show submitting toast, as the promise toast may never disappear under these conditions.\n // Instead, make successToast() or errorToast() throw toast.success / toast.error\n successToast = (data) => toast.success(data)\n errorToast = (data) => toast.error(data)\n } else {\n toast.promise(promise, {\n error: (data) => {\n return data as string\n },\n loading: t('general:submitting'),\n success: (data) => {\n return data as string\n },\n })\n }\n\n if (e) {\n e.stopPropagation()\n e.preventDefault()\n }\n\n setProcessing(true)\n setDisabled(true)\n\n if (waitForAutocomplete) await wait(100)\n\n // Execute server side validations\n if (Array.isArray(beforeSubmit)) {\n let revalidatedFormState: FormState\n\n await beforeSubmit.reduce(async (priorOnChange, beforeSubmitFn) => {\n await priorOnChange\n\n const result = await beforeSubmitFn({\n formState: fields,\n })\n\n revalidatedFormState = result\n }, Promise.resolve())\n\n const isValid = Object.entries(revalidatedFormState).every(([, field]) => field.valid)\n\n if (!isValid) {\n setProcessing(false)\n setSubmitted(true)\n setDisabled(false)\n return dispatchFields({ type: 'REPLACE_STATE', state: revalidatedFormState })\n }\n }\n\n const isValid =\n skipValidation || disableValidationOnSubmit ? true : await contextRef.current.validateForm()\n\n // If not valid, prevent submission\n if (!isValid) {\n errorToast(t('error:correctInvalidFields'))\n setProcessing(false)\n setSubmitted(true)\n setDisabled(false)\n return\n }\n\n // If submit handler comes through via props, run that\n if (onSubmit) {\n const data = {\n ...reduceFieldsToValues(fields, true),\n ...overrides,\n }\n\n onSubmit(fields, data)\n }\n\n if (!hasFormSubmitAction) {\n // No action provided, so we should return. An example where this happens are lexical link drawers. Upon submitting the drawer, we\n // want to close it without submitting the form. Stuff like validation would be handled by lexical before this, through beforeSubmit\n setProcessing(false)\n setSubmitted(true)\n setDisabled(false)\n return\n }\n\n const formData = contextRef.current.createFormData(overrides)\n\n try {\n let res\n const actionEndpoint =\n actionArg ||\n (typeof action === 'string'\n ? `${action}${QueryString.stringify(formQueryParams, { addQueryPrefix: true })}`\n : null)\n\n if (actionEndpoint) {\n res = await requests[methodToUse.toLowerCase()](actionEndpoint, {\n body: formData,\n headers: {\n 'Accept-Language': i18n.language,\n },\n })\n } else if (typeof action === 'function') {\n res = await action(formData)\n }\n\n setModified(false)\n setDisabled(false)\n\n if (typeof handleResponse === 'function') {\n handleResponse(res, successToast, errorToast)\n return\n }\n\n const contentType = res.headers.get('content-type')\n const isJSON = contentType && contentType.indexOf('application/json') !== -1\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let json: Record<string, any> = {}\n\n if (isJSON) json = await res.json()\n if (res.status < 400) {\n if (typeof onSuccess === 'function') await onSuccess(json)\n setSubmitted(false)\n setProcessing(false)\n\n if (redirect) {\n router.push(redirect)\n } else if (!disableSuccessStatus) {\n successToast(json.message || t('general:submissionSuccessful'))\n }\n } else {\n setProcessing(false)\n setSubmitted(true)\n\n contextRef.current = { ...contextRef.current } // triggers rerender of all components that subscribe to form\n if (json.message) {\n errorToast(json.message)\n\n return\n }\n\n if (Array.isArray(json.errors)) {\n const [fieldErrors, nonFieldErrors] = json.errors.reduce(\n ([fieldErrs, nonFieldErrs], err) => {\n const newFieldErrs = []\n const newNonFieldErrs = []\n\n if (err?.message) {\n newNonFieldErrs.push(err)\n }\n\n if (Array.isArray(err?.data)) {\n err.data.forEach((dataError) => {\n if (dataError?.field) {\n newFieldErrs.push(dataError)\n } else {\n newNonFieldErrs.push(dataError)\n }\n })\n }\n\n return [\n [...fieldErrs, ...newFieldErrs],\n [...nonFieldErrs, ...newNonFieldErrs],\n ]\n },\n [[], []],\n )\n\n dispatchFields({\n type: 'ADD_SERVER_ERRORS',\n errors: fieldErrors,\n })\n\n nonFieldErrors.forEach((err) => {\n errorToast(err.message || t('error:unknown'))\n })\n\n return\n }\n\n const message = errorMessages?.[res.status] || res?.statusText || t('error:unknown')\n\n errorToast(message)\n }\n } catch (err) {\n console.error('Error submitting form', err)\n setProcessing(false)\n setSubmitted(true)\n setDisabled(false)\n\n errorToast(err.message)\n }\n },\n [\n beforeSubmit,\n action,\n disableSuccessStatus,\n disableValidationOnSubmit,\n disabled,\n dispatchFields,\n fields,\n handleResponse,\n method,\n onSubmit,\n onSuccess,\n redirect,\n router,\n t,\n i18n,\n waitForAutocomplete,\n formQueryParams,\n ],\n )\n\n const getFields = useCallback(() => contextRef.current.fields, [])\n\n const getField = useCallback((path: string) => contextRef.current.fields[path], [])\n\n const getData = useCallback(() => reduceFieldsToValues(contextRef.current.fields, true), [])\n\n const getSiblingData = useCallback(\n (path: string) => getSiblingDataFunc(contextRef.current.fields, path),\n [],\n )\n const getDataByPath = useCallback<GetDataByPath>(\n (path: string) => getDataByPathFunc(contextRef.current.fields, path),\n [],\n )\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const createFormData = useCallback((overrides: any = {}) => {\n const data = reduceFieldsToValues(contextRef.current.fields, true)\n\n const file = data?.file\n\n if (file) {\n delete data.file\n }\n\n const dataWithOverrides = {\n ...data,\n ...overrides,\n }\n\n const dataToSerialize = {\n _payload: JSON.stringify(dataWithOverrides),\n file,\n }\n\n // nullAsUndefineds is important to allow uploads and relationship fields to clear themselves\n const formData = serialize(dataToSerialize, { indices: true, nullsAsUndefineds: false })\n\n return formData\n }, [])\n\n const reset = useCallback(\n async (data: unknown) => {\n const newState = await getFormState({\n apiRoute,\n body: {\n id,\n collectionSlug,\n data,\n globalSlug,\n operation,\n schemaPath: collectionSlug || globalSlug,\n },\n serverURL,\n })\n\n contextRef.current = { ...initContextState } as FormContextType\n setModified(false)\n dispatchFields({ type: 'REPLACE_STATE', state: newState })\n },\n [apiRoute, collectionSlug, dispatchFields, globalSlug, id, operation, serverURL],\n )\n\n const replaceState = useCallback(\n (state: FormState) => {\n contextRef.current = { ...initContextState } as FormContextType\n setModified(false)\n dispatchFields({ type: 'REPLACE_STATE', state })\n },\n [dispatchFields],\n )\n\n const getFieldStateBySchemaPath = useCallback(\n async ({ data, schemaPath }) => {\n const fieldSchema = await getFormState({\n apiRoute,\n body: {\n collectionSlug,\n data,\n globalSlug,\n schemaPath,\n },\n serverURL,\n })\n return fieldSchema\n },\n [apiRoute, collectionSlug, globalSlug, serverURL],\n )\n\n const addFieldRow: FormContextType['addFieldRow'] = useCallback(\n async ({ data, path, rowIndex, schemaPath }) => {\n const subFieldState = await getFieldStateBySchemaPath({ data, schemaPath })\n\n dispatchFields({\n type: 'ADD_ROW',\n blockType: data?.blockType,\n path,\n rowIndex,\n subFieldState,\n })\n },\n [getFieldStateBySchemaPath, dispatchFields],\n )\n\n const removeFieldRow: FormContextType['removeFieldRow'] = useCallback(\n ({ path, rowIndex }) => {\n dispatchFields({ type: 'REMOVE_ROW', path, rowIndex })\n },\n [dispatchFields],\n )\n\n const replaceFieldRow: FormContextType['replaceFieldRow'] = useCallback(\n async ({ data, path, rowIndex, schemaPath }) => {\n const subFieldState = await getFieldStateBySchemaPath({ data, schemaPath })\n\n dispatchFields({\n type: 'REPLACE_ROW',\n blockType: data?.blockType,\n path,\n rowIndex,\n subFieldState,\n })\n },\n [getFieldStateBySchemaPath, dispatchFields],\n )\n\n useEffect(() => {\n if (initializingFromProps !== undefined) {\n setInitializing(initializingFromProps)\n }\n }, [initializingFromProps])\n\n contextRef.current.submit = submit\n contextRef.current.getFields = getFields\n contextRef.current.getField = getField\n contextRef.current.getData = getData\n contextRef.current.getSiblingData = getSiblingData\n contextRef.current.getDataByPath = getDataByPath\n contextRef.current.validateForm = validateForm\n contextRef.current.createFormData = createFormData\n contextRef.current.setModified = setModified\n contextRef.current.setProcessing = setProcessing\n contextRef.current.setSubmitted = setSubmitted\n contextRef.current.disabled = disabled\n contextRef.current.setDisabled = setDisabled\n contextRef.current.formRef = formRef\n contextRef.current.reset = reset\n contextRef.current.replaceState = replaceState\n contextRef.current.dispatchFields = dispatchFields\n contextRef.current.addFieldRow = addFieldRow\n contextRef.current.removeFieldRow = removeFieldRow\n contextRef.current.replaceFieldRow = replaceFieldRow\n contextRef.current.uuid = uuid\n contextRef.current.initializing = initializing\n\n useEffect(() => {\n setIsMounted(true)\n }, [])\n\n useEffect(() => {\n if (typeof disabledFromProps === 'boolean') setDisabled(disabledFromProps)\n }, [disabledFromProps])\n\n useEffect(() => {\n if (typeof submittedFromProps === 'boolean') setSubmitted(submittedFromProps)\n }, [submittedFromProps])\n\n useEffect(() => {\n if (initialState) {\n contextRef.current = { ...initContextState } as FormContextType\n dispatchFields({ type: 'REPLACE_STATE', optimize: false, state: initialState })\n }\n }, [initialState, dispatchFields])\n\n useThrottledEffect(\n () => {\n refreshCookie()\n },\n 15000,\n [fields],\n )\n\n useEffect(() => {\n contextRef.current = { ...contextRef.current } // triggers rerender of all components that subscribe to form\n setModified(false)\n }, [locale])\n\n const classes = [className, baseClass].filter(Boolean).join(' ')\n\n useDebouncedEffect(\n () => {\n const executeOnChange = async () => {\n if (Array.isArray(onChange)) {\n let revalidatedFormState: FormState = contextRef.current.fields\n\n for (const onChangeFn of onChange) {\n revalidatedFormState = await onChangeFn({\n formState: revalidatedFormState,\n })\n }\n\n const { changed, newState } = mergeServerFormState(\n contextRef.current.fields || {},\n revalidatedFormState,\n )\n\n if (changed) {\n dispatchFields({\n type: 'REPLACE_STATE',\n optimize: false,\n state: newState,\n })\n }\n }\n }\n\n if (modified) void executeOnChange()\n },\n 150,\n // Make sure we trigger this whenever modified changes (not just when `fields` changes), otherwise we will miss merging server form state for the first form update/onChange. Here's why:\n // `fields` updates before `modified`, because setModified is in a setTimeout. So on the first change, modified is false, so we don't trigger the effect even though we should.\n [contextRef.current.fields, dispatchFields, onChange, modified],\n )\n\n const actionString =\n typeof action === 'string'\n ? `${action}${QueryString.stringify(formQueryParams, { addQueryPrefix: true })}`\n : ''\n\n return (\n <form\n action={method ? actionString : (action as string)}\n className={classes}\n method={method}\n noValidate\n onSubmit={(e) => contextRef.current.submit({}, e)}\n ref={formRef}\n >\n <FormContext.Provider value={contextRef.current}>\n <FormWatchContext.Provider\n value={{\n fields,\n ...contextRef.current,\n }}\n >\n <SubmittedContext.Provider value={submitted}>\n <InitializingContext.Provider value={!isMounted || (isMounted && initializing)}>\n <ProcessingContext.Provider value={processing}>\n <ModifiedContext.Provider value={modified}>\n <FormFieldsContext.Provider value={fieldsReducer}>\n {children}\n </FormFieldsContext.Provider>\n </ModifiedContext.Provider>\n </ProcessingContext.Provider>\n </InitializingContext.Provider>\n </SubmittedContext.Provider>\n </FormWatchContext.Provider>\n </FormContext.Provider>\n </form>\n )\n}\n\nexport {\n FormContext,\n FormFieldsContext,\n FormWatchContext,\n ModifiedContext,\n ProcessingContext,\n SubmittedContext,\n useAllFormFields,\n useForm,\n useFormFields,\n useFormModified,\n useFormProcessing,\n useFormSubmitted,\n useWatchForm,\n} from './context.js'\n\nexport { FormProps }\n"],"names":["isDeepEqual","useRouter","serialize","wait","QueryString","React","useCallback","useEffect","useReducer","useRef","useState","toast","useDebouncedEffect","useThrottledEffect","useAuth","useConfig","useDocumentInfo","useFormQueryParams","useLocale","useOperation","useTranslation","requests","getFormState","reduceFieldsToValues","FormContext","FormFieldsContext","FormWatchContext","InitializingContext","ModifiedContext","ProcessingContext","SubmittedContext","errorMessages","fieldReducer","getDataByPath","getDataByPathFunc","getSiblingData","getSiblingDataFunc","initContextState","mergeServerFormState","baseClass","Form","props","id","collectionSlug","globalSlug","action","beforeSubmit","children","className","disableSuccessStatus","disableValidationOnSubmit","disabled","disabledFromProps","handleResponse","initialState","isInitializing","initializingFromProps","onChange","onSubmit","onSuccess","redirect","submitted","submittedFromProps","uuid","waitForAutocomplete","method","undefined","router","code","locale","i18n","t","refreshCookie","user","operation","formQueryParams","config","routes","api","apiRoute","serverURL","setDisabled","isMounted","setIsMounted","modified","setModified","initializing","setInitializing","processing","setProcessing","setSubmitted","formRef","contextRef","fieldsReducer","fields","dispatchFields","current","validateForm","validatedFieldState","isValid","dataFromContext","getData","data","validationPromises","Object","entries","map","path","field","validatedField","passesCondition","validationResult","valid","validate","valueToValidate","value","rows","Array","isArray","siblingData","errorMessage","Promise","all","type","state","submit","options","e","actionArg","methodToUse","overrides","skipValidation","preventDefault","successToast","errorToast","promise","resolve","reject","hasFormSubmitAction","success","error","loading","stopPropagation","revalidatedFormState","reduce","priorOnChange","beforeSubmitFn","result","formState","every","formData","createFormData","res","actionEndpoint","stringify","addQueryPrefix","toLowerCase","body","headers","language","contentType","get","isJSON","indexOf","json","status","push","message","errors","fieldErrors","nonFieldErrors","fieldErrs","nonFieldErrs","err","newFieldErrs","newNonFieldErrs","forEach","dataError","statusText","console","getFields","getField","file","dataWithOverrides","dataToSerialize","_payload","JSON","indices","nullsAsUndefineds","reset","newState","schemaPath","replaceState","getFieldStateBySchemaPath","fieldSchema","addFieldRow","rowIndex","subFieldState","blockType","removeFieldRow","replaceFieldRow","optimize","classes","filter","Boolean","join","executeOnChange","onChangeFn","changed","actionString","form","noValidate","ref","Provider","useAllFormFields","useForm","useFormFields","useFormModified","useFormProcessing","useFormSubmitted","useWatchForm"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,QAAQoB,SAASgJ,eAAgBpK;QACjCG,WAAW0J;QACXzI,QAAQA;QACRkJ,UAAU;QACVzJ,UAAU,CAACqE,IAAMnC,WAAWI,OAAO,CAAC6B,MAAM,CAAC,CAAC,GAAGE;QAC/CqF,KAAKzH;kBAEL,cAAA,KAACnE,YAAY6L,QAAQ;YAAClG,OAAOvB,WAAWI,OAAO;sBAC7C,cAAA,KAACtE,iBAAiB2L,QAAQ;gBACxBlG,OAAO;oBACLrB;oBACA,GAAGF,WAAWI,OAAO;gBACvB;0BAEA,cAAA,KAAClE,iBAAiBuL,QAAQ;oBAAClG,OAAOtD;8BAChC,cAAA,KAAClC,oBAAoB0L,QAAQ;wBAAClG,OAAO,CAACjC,aAAcA,aAAaI;kCAC/D,cAAA,KAACzD,kBAAkBwL,QAAQ;4BAAClG,OAAO3B;sCACjC,cAAA,KAAC5D,gBAAgByL,QAAQ;gCAAClG,OAAO/B;0CAC/B,cAAA,KAAC3D,kBAAkB4L,QAAQ;oCAAClG,OAAOtB;8CAChC9C;;;;;;;;;AAUrB,EAAC;AAED,SACEvB,WAAW,EACXC,iBAAiB,EACjBC,gBAAgB,EAChBE,eAAe,EACfC,iBAAiB,EACjBC,gBAAgB,EAChBwL,gBAAgB,EAChBC,OAAO,EACPC,aAAa,EACbC,eAAe,EACfC,iBAAiB,EACjBC,gBAAgB,EAChBC,YAAY,QACP,eAAc"}
@@ -1,6 +1,5 @@
1
1
  import type { User } from 'payload/auth';
2
- import type { Field, FormField, FormState } from 'payload/types';
3
- import type { Data } from 'payload/types';
2
+ import type { Data, Field, FormField, FormState } from 'payload/types';
4
3
  import type React from 'react';
5
4
  import type { Dispatch } from 'react';
6
5
  export type Preferences = {
@@ -30,7 +29,7 @@ export type FormProps = ({
30
29
  * feature of the Lexical Rich Text field)
31
30
  */
32
31
  fields?: Field[];
33
- handleResponse?: (res: Response) => void;
32
+ handleResponse?: (res: Response, successToast: (value: string) => void, errorToast: (value: string) => void) => void;
34
33
  initialState?: FormState;
35
34
  isInitializing?: boolean;
36
35
  log?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/forms/Form/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAErC,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,CACpB;IACE,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC9C,GACD;IACE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAA;CAC7C,CACJ,GAAG;IACF,YAAY,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE;QAAE,SAAS,EAAE,SAAS,CAAA;KAAE,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAA;IACzE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;;OAGG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAA;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;IAChB,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAA;IACxC,Y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B,UAAU,EAAE,MAAM,CAAA;KACnB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACnB,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAA;IACxC,KAAK,EAAE,KAAK,CAAA;IACZ,WAAW,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAA;IACxC,WAAW,EAAE,WAAW,CAAA;IACxB,aAAa,EAAE,aAAa,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/forms/Form/types.ts"],"sourcesContent":["import type { User } from 'payload/auth'\nimport type { Field, FormField, FormState } from 'payload/types'\nimport type { Data } from 'payload/types'\nimport type React from 'react'\nimport type { Dispatch } from 'react'\n\nexport type Preferences = {\n [key: string]: unknown\n}\n\nexport type FormProps = (\n | {\n action: (formData: FormData) => Promise<void>\n }\n | {\n action?: string\n method?: 'DELETE' | 'GET' | 'PATCH' | 'POST'\n }\n) & {\n beforeSubmit?: ((args: { formState: FormState }) => Promise<FormState>)[]\n children?: React.ReactNode\n className?: string\n disableSuccessStatus?: boolean\n /**\n * If you would like to solely leverage server-side validation on submit,\n * you can disable checks that the form makes before it submits\n */\n disableValidationOnSubmit?: boolean\n disabled?: boolean\n /**\n * By default, the form will get the field schema (not data) from the current document. If you pass this in, you can override that behavior.\n * This is very useful for sub-forms, where the form's field schema is not necessarily the field schema of the current document (e.g. for the Blocks\n * feature of the Lexical Rich Text field)\n */\n fields?: Field[]\n handleResponse?: (res: Response) => void\n initialState?: FormState\n isInitializing?: boolean\n log?: boolean\n onChange?: ((args: { formState: FormState }) => Promise<FormState>)[]\n onSubmit?: (fields: FormState, data: Data) => void\n onSuccess?: (json: unknown) => Promise<void> | void\n redirect?: string\n submitted?: boolean\n uuid?: string\n validationOperation?: 'create' | 'update'\n waitForAutocomplete?: boolean\n}\n\nexport type SubmitOptions = {\n action?: string\n method?: string\n overrides?: Record<string, unknown>\n skipValidation?: boolean\n}\n\nexport type DispatchFields = React.Dispatch<any>\nexport type Submit = (\n options?: SubmitOptions,\n e?: React.FormEvent<HTMLFormElement>,\n) => Promise<void>\nexport type ValidateForm = () => Promise<boolean>\nexport type CreateFormData = (overrides?: any) => FormData\nexport type GetFields = () => FormState\nexport type GetField = (path: string) => FormField\nexport type GetData = () => Data\nexport type GetSiblingData = (path: string) => Data\nexport type GetDataByPath = <T = unknown>(path: string) => T\nexport type SetModified = (modified: boolean) => void\nexport type SetSubmitted = (submitted: boolean) => void\nexport type SetProcessing = (processing: boolean) => void\n\nexport type Reset = (data: unknown) => Promise<void>\n\nexport type REPLACE_STATE = {\n optimize?: boolean\n state: FormState\n type: 'REPLACE_STATE'\n}\n\nexport type REMOVE = {\n path: string\n type: 'REMOVE'\n}\n\nexport type MODIFY_CONDITION = {\n path: string\n result: boolean\n type: 'MODIFY_CONDITION'\n user: User\n}\n\nexport type UPDATE = {\n path: string\n type: 'UPDATE'\n} & Partial<FormField>\n\nexport type REMOVE_ROW = {\n path: string\n rowIndex: number\n type: 'REMOVE_ROW'\n}\n\nexport type ADD_ROW = {\n blockType?: string\n path: string\n rowIndex?: number\n subFieldState?: FormState\n type: 'ADD_ROW'\n}\n\nexport type REPLACE_ROW = {\n blockType?: string\n path: string\n rowIndex: number\n subFieldState?: FormState\n type: 'REPLACE_ROW'\n}\n\nexport type DUPLICATE_ROW = {\n path: string\n rowIndex: number\n type: 'DUPLICATE_ROW'\n}\n\nexport type MOVE_ROW = {\n moveFromIndex: number\n moveToIndex: number\n path: string\n type: 'MOVE_ROW'\n}\n\nexport type ADD_SERVER_ERRORS = {\n errors: {\n field: string\n message: string\n }[]\n type: 'ADD_SERVER_ERRORS'\n}\n\nexport type SET_ROW_COLLAPSED = {\n collapsed: boolean\n path: string\n rowID: string\n setDocFieldPreferences: (field: string, fieldPreferences: { [key: string]: unknown }) => void\n type: 'SET_ROW_COLLAPSED'\n}\n\nexport type SET_ALL_ROWS_COLLAPSED = {\n collapsed: boolean\n path: string\n setDocFieldPreferences: (field: string, fieldPreferences: { [key: string]: unknown }) => void\n type: 'SET_ALL_ROWS_COLLAPSED'\n}\n\nexport type FieldAction =\n | ADD_ROW\n | ADD_SERVER_ERRORS\n | DUPLICATE_ROW\n | MODIFY_CONDITION\n | MOVE_ROW\n | REMOVE\n | REMOVE_ROW\n | REPLACE_ROW\n | REPLACE_STATE\n | SET_ALL_ROWS_COLLAPSED\n | SET_ROW_COLLAPSED\n | UPDATE\n\nexport type FormFieldsContext = [FormState, Dispatch<FieldAction>]\n\nexport type Context = {\n addFieldRow: ({\n data,\n path,\n rowIndex,\n schemaPath,\n }: {\n data?: Data\n path: string\n /*\n * by default the new row will be added to the end of the list\n */\n rowIndex?: number\n schemaPath: string\n }) => Promise<void>\n buildRowErrors: () => void\n createFormData: CreateFormData\n disabled: boolean\n dispatchFields: Dispatch<FieldAction>\n /**\n * Form context fields may be outdated and should not be relied on. Instead, prefer `useFormFields`.\n */\n fields: FormState\n formRef: React.MutableRefObject<HTMLFormElement>\n getData: GetData\n getDataByPath: GetDataByPath\n getField: GetField\n getFields: GetFields\n getSiblingData: GetSiblingData\n initializing: boolean\n removeFieldRow: ({ path, rowIndex }: { path: string; rowIndex: number }) => void\n replaceFieldRow: ({\n data,\n path,\n rowIndex,\n schemaPath,\n }: {\n data?: Data\n path: string\n rowIndex: number\n schemaPath: string\n }) => Promise<void>\n replaceState: (state: FormState) => void\n reset: Reset\n setDisabled: (disabled: boolean) => void\n setModified: SetModified\n setProcessing: SetProcessing\n setSubmitted: SetSubmitted\n submit: Submit\n uuid?: string\n validateForm: ValidateForm\n}\n"],"names":[],"rangeMappings":"","mappings":"AA2KA,WAmDC"}
1
+ {"version":3,"sources":["../../../src/forms/Form/types.ts"],"sourcesContent":["import type { User } from 'payload/auth'\nimport type { Data, Field, FormField, FormState } from 'payload/types'\nimport type React from 'react'\nimport type { Dispatch } from 'react'\n\nexport type Preferences = {\n [key: string]: unknown\n}\n\nexport type FormProps = (\n | {\n action: (formData: FormData) => Promise<void>\n }\n | {\n action?: string\n method?: 'DELETE' | 'GET' | 'PATCH' | 'POST'\n }\n) & {\n beforeSubmit?: ((args: { formState: FormState }) => Promise<FormState>)[]\n children?: React.ReactNode\n className?: string\n disableSuccessStatus?: boolean\n /**\n * If you would like to solely leverage server-side validation on submit,\n * you can disable checks that the form makes before it submits\n */\n disableValidationOnSubmit?: boolean\n disabled?: boolean\n /**\n * By default, the form will get the field schema (not data) from the current document. If you pass this in, you can override that behavior.\n * This is very useful for sub-forms, where the form's field schema is not necessarily the field schema of the current document (e.g. for the Blocks\n * feature of the Lexical Rich Text field)\n */\n fields?: Field[]\n handleResponse?: (\n res: Response,\n successToast: (value: string) => void,\n errorToast: (value: string) => void,\n ) => void\n initialState?: FormState\n isInitializing?: boolean\n log?: boolean\n onChange?: ((args: { formState: FormState }) => Promise<FormState>)[]\n onSubmit?: (fields: FormState, data: Data) => void\n onSuccess?: (json: unknown) => Promise<void> | void\n redirect?: string\n submitted?: boolean\n uuid?: string\n validationOperation?: 'create' | 'update'\n waitForAutocomplete?: boolean\n}\n\nexport type SubmitOptions = {\n action?: string\n method?: string\n overrides?: Record<string, unknown>\n skipValidation?: boolean\n}\n\nexport type DispatchFields = React.Dispatch<any>\nexport type Submit = (\n options?: SubmitOptions,\n e?: React.FormEvent<HTMLFormElement>,\n) => Promise<void>\nexport type ValidateForm = () => Promise<boolean>\nexport type CreateFormData = (overrides?: any) => FormData\nexport type GetFields = () => FormState\nexport type GetField = (path: string) => FormField\nexport type GetData = () => Data\nexport type GetSiblingData = (path: string) => Data\nexport type GetDataByPath = <T = unknown>(path: string) => T\nexport type SetModified = (modified: boolean) => void\nexport type SetSubmitted = (submitted: boolean) => void\nexport type SetProcessing = (processing: boolean) => void\n\nexport type Reset = (data: unknown) => Promise<void>\n\nexport type REPLACE_STATE = {\n optimize?: boolean\n state: FormState\n type: 'REPLACE_STATE'\n}\n\nexport type REMOVE = {\n path: string\n type: 'REMOVE'\n}\n\nexport type MODIFY_CONDITION = {\n path: string\n result: boolean\n type: 'MODIFY_CONDITION'\n user: User\n}\n\nexport type UPDATE = {\n path: string\n type: 'UPDATE'\n} & Partial<FormField>\n\nexport type REMOVE_ROW = {\n path: string\n rowIndex: number\n type: 'REMOVE_ROW'\n}\n\nexport type ADD_ROW = {\n blockType?: string\n path: string\n rowIndex?: number\n subFieldState?: FormState\n type: 'ADD_ROW'\n}\n\nexport type REPLACE_ROW = {\n blockType?: string\n path: string\n rowIndex: number\n subFieldState?: FormState\n type: 'REPLACE_ROW'\n}\n\nexport type DUPLICATE_ROW = {\n path: string\n rowIndex: number\n type: 'DUPLICATE_ROW'\n}\n\nexport type MOVE_ROW = {\n moveFromIndex: number\n moveToIndex: number\n path: string\n type: 'MOVE_ROW'\n}\n\nexport type ADD_SERVER_ERRORS = {\n errors: {\n field: string\n message: string\n }[]\n type: 'ADD_SERVER_ERRORS'\n}\n\nexport type SET_ROW_COLLAPSED = {\n collapsed: boolean\n path: string\n rowID: string\n setDocFieldPreferences: (field: string, fieldPreferences: { [key: string]: unknown }) => void\n type: 'SET_ROW_COLLAPSED'\n}\n\nexport type SET_ALL_ROWS_COLLAPSED = {\n collapsed: boolean\n path: string\n setDocFieldPreferences: (field: string, fieldPreferences: { [key: string]: unknown }) => void\n type: 'SET_ALL_ROWS_COLLAPSED'\n}\n\nexport type FieldAction =\n | ADD_ROW\n | ADD_SERVER_ERRORS\n | DUPLICATE_ROW\n | MODIFY_CONDITION\n | MOVE_ROW\n | REMOVE\n | REMOVE_ROW\n | REPLACE_ROW\n | REPLACE_STATE\n | SET_ALL_ROWS_COLLAPSED\n | SET_ROW_COLLAPSED\n | UPDATE\n\nexport type FormFieldsContext = [FormState, Dispatch<FieldAction>]\n\nexport type Context = {\n addFieldRow: ({\n data,\n path,\n rowIndex,\n schemaPath,\n }: {\n data?: Data\n path: string\n /*\n * by default the new row will be added to the end of the list\n */\n rowIndex?: number\n schemaPath: string\n }) => Promise<void>\n buildRowErrors: () => void\n createFormData: CreateFormData\n disabled: boolean\n dispatchFields: Dispatch<FieldAction>\n /**\n * Form context fields may be outdated and should not be relied on. Instead, prefer `useFormFields`.\n */\n fields: FormState\n formRef: React.MutableRefObject<HTMLFormElement>\n getData: GetData\n getDataByPath: GetDataByPath\n getField: GetField\n getFields: GetFields\n getSiblingData: GetSiblingData\n initializing: boolean\n removeFieldRow: ({ path, rowIndex }: { path: string; rowIndex: number }) => void\n replaceFieldRow: ({\n data,\n path,\n rowIndex,\n schemaPath,\n }: {\n data?: Data\n path: string\n rowIndex: number\n schemaPath: string\n }) => Promise<void>\n replaceState: (state: FormState) => void\n reset: Reset\n setDisabled: (disabled: boolean) => void\n setModified: SetModified\n setProcessing: SetProcessing\n setSubmitted: SetSubmitted\n submit: Submit\n uuid?: string\n validateForm: ValidateForm\n}\n"],"names":[],"rangeMappings":"","mappings":"AA8KA,WAmDC"}
@@ -7,7 +7,7 @@ export const withCondition = (Field)=>{
7
7
  const CheckForCondition = (props)=>{
8
8
  const { name } = props;
9
9
  const { type, indexPath, path: pathFromContext } = useFieldProps();
10
- const path = pathFromContext || name;
10
+ const path = pathFromContext ?? name;
11
11
  return /*#__PURE__*/ _jsx(WatchCondition, {
12
12
  indexPath: indexPath,
13
13
  name: name,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/forms/withCondition/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useFieldProps } from '../FieldPropsProvider/index.js'\nimport { WatchCondition } from './WatchCondition.js'\n\nexport const withCondition = <P extends Record<string, unknown>>(\n Field: React.ComponentType<P>,\n): React.FC<P> => {\n const CheckForCondition: React.FC<P> = (props) => {\n const { name } = props\n const { type, indexPath, path: pathFromContext } = useFieldProps()\n const path = pathFromContext || name\n\n return (\n <WatchCondition indexPath={indexPath} name={name as string} path={path as string} type={type}>\n <Field {...props} />\n </WatchCondition>\n )\n }\n\n return CheckForCondition\n}\n"],"names":["React","useFieldProps","WatchCondition","withCondition","Field","CheckForCondition","props","name","type","indexPath","path","pathFromContext"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,cAAc,QAAQ,sBAAqB;AAEpD,OAAO,MAAMC,gBAAgB,CAC3BC;IAEA,MAAMC,oBAAiC,CAACC;QACtC,MAAM,EAAEC,IAAI,EAAE,GAAGD;QACjB,MAAM,EAAEE,IAAI,EAAEC,SAAS,EAAEC,MAAMC,eAAe,EAAE,GAAGV;QACnD,MAAMS,OAAOC,mBAAmBJ;QAEhC,qBACE,KAACL;YAAeO,WAAWA;YAAWF,MAAMA;YAAgBG,MAAMA;YAAgBF,MAAMA;sBACtF,cAAA,KAACJ;gBAAO,GAAGE,KAAK;;;IAGtB;IAEA,OAAOD;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/forms/withCondition/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useFieldProps } from '../FieldPropsProvider/index.js'\nimport { WatchCondition } from './WatchCondition.js'\n\nexport const withCondition = <P extends Record<string, unknown>>(\n Field: React.ComponentType<P>,\n): React.FC<P> => {\n const CheckForCondition: React.FC<P> = (props) => {\n const { name } = props\n const { type, indexPath, path: pathFromContext } = useFieldProps()\n const path = pathFromContext ?? name\n\n return (\n <WatchCondition indexPath={indexPath} name={name as string} path={path as string} type={type}>\n <Field {...props} />\n </WatchCondition>\n )\n }\n\n return CheckForCondition\n}\n"],"names":["React","useFieldProps","WatchCondition","withCondition","Field","CheckForCondition","props","name","type","indexPath","path","pathFromContext"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,cAAc,QAAQ,sBAAqB;AAEpD,OAAO,MAAMC,gBAAgB,CAC3BC;IAEA,MAAMC,oBAAiC,CAACC;QACtC,MAAM,EAAEC,IAAI,EAAE,GAAGD;QACjB,MAAM,EAAEE,IAAI,EAAEC,SAAS,EAAEC,MAAMC,eAAe,EAAE,GAAGV;QACnD,MAAMS,OAAOC,mBAAmBJ;QAEhC,qBACE,KAACL;YAAeO,WAAWA;YAAWF,MAAMA;YAAgBG,MAAMA;YAAgBF,MAAMA;sBACtF,cAAA,KAACJ;gBAAO,GAAGE,KAAK;;;IAGtB;IAEA,OAAOD;AACT,EAAC"}
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- export { GravatarAccountIcon } from './Gravatar/index.js';
3
2
  export declare const Account: () => React.JSX.Element;
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/graphics/Account/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEzD,eAAO,MAAM,OAAO,yBAenB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/graphics/Account/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,eAAO,MAAM,OAAO,yBAiBnB,CAAA"}
@@ -5,7 +5,7 @@ import React from 'react';
5
5
  import { useAuth } from '../../providers/Auth/index.js';
6
6
  import { useConfig } from '../../providers/Config/index.js';
7
7
  import { DefaultAccountIcon } from './Default/index.js';
8
- export { GravatarAccountIcon } from './Gravatar/index.js';
8
+ import { GravatarAccountIcon } from './Gravatar/index.js';
9
9
  export const Account = ()=>{
10
10
  const { admin: { avatar: Avatar }, admin: { routes: { account: accountRoute } }, routes: { admin: adminRoute } } = useConfig();
11
11
  const { user } = useAuth();
@@ -14,6 +14,10 @@ export const Account = ()=>{
14
14
  if (!user?.email || Avatar === 'default') return /*#__PURE__*/ _jsx(DefaultAccountIcon, {
15
15
  active: isOnAccountPage
16
16
  });
17
+ if (Avatar === 'gravatar') return /*#__PURE__*/ _jsx(GravatarAccountIcon, {});
18
+ if (Avatar) return /*#__PURE__*/ _jsx(Avatar, {
19
+ active: isOnAccountPage
20
+ });
17
21
  };
18
22
 
19
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/graphics/Account/index.tsx"],"sourcesContent":["'use client'\nimport { usePathname } from 'next/navigation.js'\nimport React from 'react'\n\nimport { useAuth } from '../../providers/Auth/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { DefaultAccountIcon } from './Default/index.js'\nexport { GravatarAccountIcon } from './Gravatar/index.js'\n\nexport const Account = () => {\n const {\n admin: { avatar: Avatar },\n admin: {\n routes: { account: accountRoute },\n },\n routes: { admin: adminRoute },\n } = useConfig()\n\n const { user } = useAuth()\n const pathname = usePathname()\n\n const isOnAccountPage = pathname === `${adminRoute}${accountRoute}`\n\n if (!user?.email || Avatar === 'default') return <DefaultAccountIcon active={isOnAccountPage} />\n}\n"],"names":["usePathname","React","useAuth","useConfig","DefaultAccountIcon","GravatarAccountIcon","Account","admin","avatar","Avatar","routes","account","accountRoute","adminRoute","user","pathname","isOnAccountPage","email","active"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,SAASA,WAAW,QAAQ,qBAAoB;AAChD,OAAOC,WAAW,QAAO;AAEzB,SAASC,OAAO,QAAQ,gCAA+B;AACvD,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,kBAAkB,QAAQ,qBAAoB;AACvD,SAASC,mBAAmB,QAAQ,sBAAqB;AAEzD,OAAO,MAAMC,UAAU;IACrB,MAAM,EACJC,OAAO,EAAEC,QAAQC,MAAM,EAAE,EACzBF,OAAO,EACLG,QAAQ,EAAEC,SAASC,YAAY,EAAE,EAClC,EACDF,QAAQ,EAAEH,OAAOM,UAAU,EAAE,EAC9B,GAAGV;IAEJ,MAAM,EAAEW,IAAI,EAAE,GAAGZ;IACjB,MAAMa,WAAWf;IAEjB,MAAMgB,kBAAkBD,aAAa,CAAC,EAAEF,WAAW,EAAED,aAAa,CAAC;IAEnE,IAAI,CAACE,MAAMG,SAASR,WAAW,WAAW,qBAAO,KAACL;QAAmBc,QAAQF;;AAC/E,EAAC"}
1
+ {"version":3,"sources":["../../../src/graphics/Account/index.tsx"],"sourcesContent":["'use client'\nimport { usePathname } from 'next/navigation.js'\nimport React from 'react'\n\nimport { useAuth } from '../../providers/Auth/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { DefaultAccountIcon } from './Default/index.js'\nimport { GravatarAccountIcon } from './Gravatar/index.js'\n\nexport const Account = () => {\n const {\n admin: { avatar: Avatar },\n admin: {\n routes: { account: accountRoute },\n },\n routes: { admin: adminRoute },\n } = useConfig()\n\n const { user } = useAuth()\n const pathname = usePathname()\n\n const isOnAccountPage = pathname === `${adminRoute}${accountRoute}`\n\n if (!user?.email || Avatar === 'default') return <DefaultAccountIcon active={isOnAccountPage} />\n if (Avatar === 'gravatar') return <GravatarAccountIcon />\n if (Avatar) return <Avatar active={isOnAccountPage} />\n}\n"],"names":["usePathname","React","useAuth","useConfig","DefaultAccountIcon","GravatarAccountIcon","Account","admin","avatar","Avatar","routes","account","accountRoute","adminRoute","user","pathname","isOnAccountPage","email","active"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,SAASA,WAAW,QAAQ,qBAAoB;AAChD,OAAOC,WAAW,QAAO;AAEzB,SAASC,OAAO,QAAQ,gCAA+B;AACvD,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,kBAAkB,QAAQ,qBAAoB;AACvD,SAASC,mBAAmB,QAAQ,sBAAqB;AAEzD,OAAO,MAAMC,UAAU;IACrB,MAAM,EACJC,OAAO,EAAEC,QAAQC,MAAM,EAAE,EACzBF,OAAO,EACLG,QAAQ,EAAEC,SAASC,YAAY,EAAE,EAClC,EACDF,QAAQ,EAAEH,OAAOM,UAAU,EAAE,EAC9B,GAAGV;IAEJ,MAAM,EAAEW,IAAI,EAAE,GAAGZ;IACjB,MAAMa,WAAWf;IAEjB,MAAMgB,kBAAkBD,aAAa,CAAC,EAAEF,WAAW,EAAED,aAAa,CAAC;IAEnE,IAAI,CAACE,MAAMG,SAASR,WAAW,WAAW,qBAAO,KAACL;QAAmBc,QAAQF;;IAC7E,IAAIP,WAAW,YAAY,qBAAO,KAACJ;IACnC,IAAII,QAAQ,qBAAO,KAACA;QAAOS,QAAQF;;AACrC,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/providers/ComponentMap/buildComponentMap/fields.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,KAAK,EAEV,KAAK,EAEL,aAAa,EAGb,eAAe,EAChB,MAAM,eAAe,CAAA;AA2BtB,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAA;AACjE,OAAO,KAAK,EAEV,QAAQ,EAIT,MAAM,YAAY,CAAA;AAgBnB,eAAO,MAAM,SAAS,SAAU;IAC9B,mBAAmB,EAAE,+BAA+B,CAAA;IACpD,MAAM,EAAE,eAAe,CAAA;IACvB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,WAAW,EAAE,aAAa,EAAE,CAAA;IAC5B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAA;IAClC,IAAI,EAAE,UAAU,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,aA6uBA,CAAA"}
1
+ {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/providers/ComponentMap/buildComponentMap/fields.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,KAAK,EAEV,KAAK,EAEL,aAAa,EAGb,eAAe,EAChB,MAAM,eAAe,CAAA;AA2BtB,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAA;AACjE,OAAO,KAAK,EAEV,QAAQ,EAIT,MAAM,YAAY,CAAA;AAgBnB,eAAO,MAAM,SAAS,SAAU;IAC9B,mBAAmB,EAAE,+BAA+B,CAAA;IACpD,MAAM,EAAE,eAAe,CAAA;IACvB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,WAAW,EAAE,aAAa,EAAE,CAAA;IAC5B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAA;IAClC,IAAI,EAAE,UAAU,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,aA8uBA,CAAA"}
@@ -51,7 +51,8 @@ export const mapFields = (args)=>{
51
51
  }
52
52
  const labelProps = {
53
53
  label,
54
- required: 'required' in field ? field.required : undefined
54
+ required: 'required' in field ? field.required : undefined,
55
+ schemaPath: path
55
56
  };
56
57
  const CustomLabelComponent = 'admin' in field && field.admin?.components && 'Label' in field.admin.components && field.admin.components?.Label || undefined;
57
58
  // If we return undefined here (so if no CUSTOM label component is set), the field client component is responsible for falling back to the default label