@payloadcms/ui 3.0.0-beta.30 → 3.0.0-beta.32

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 (249) hide show
  1. package/dist/assets/index.d.ts +3 -1
  2. package/dist/assets/index.d.ts.map +1 -1
  3. package/dist/assets/index.js +3 -1
  4. package/dist/assets/index.js.map +1 -1
  5. package/dist/assets/payload-favicon-dark.png +0 -0
  6. package/dist/assets/payload-favicon-light.png +0 -0
  7. package/dist/elements/AppHeader/index.d.ts.map +1 -1
  8. package/dist/elements/AppHeader/index.js +2 -2
  9. package/dist/elements/AppHeader/index.js.map +1 -1
  10. package/dist/elements/Autosave/index.d.ts.map +1 -1
  11. package/dist/elements/Autosave/index.js +1 -1
  12. package/dist/elements/Autosave/index.js.map +1 -1
  13. package/dist/elements/DocumentControls/index.d.ts.map +1 -1
  14. package/dist/elements/DocumentControls/index.js +3 -2
  15. package/dist/elements/DocumentControls/index.js.map +1 -1
  16. package/dist/elements/DocumentDrawer/types.d.ts +0 -1
  17. package/dist/elements/DocumentDrawer/types.d.ts.map +1 -1
  18. package/dist/elements/DraggableSortable/useDraggableSortable/types.d.ts +0 -1
  19. package/dist/elements/DraggableSortable/useDraggableSortable/types.d.ts.map +1 -1
  20. package/dist/elements/Drawer/types.d.ts +0 -1
  21. package/dist/elements/Drawer/types.d.ts.map +1 -1
  22. package/dist/elements/ErrorPill/index.d.ts +2 -2
  23. package/dist/elements/ErrorPill/index.d.ts.map +1 -1
  24. package/dist/elements/ErrorPill/index.js.map +1 -1
  25. package/dist/elements/ListControls/getTextFieldsToBeSearched.d.ts.map +1 -1
  26. package/dist/elements/ListControls/getTextFieldsToBeSearched.js +1 -1
  27. package/dist/elements/ListControls/getTextFieldsToBeSearched.js.map +1 -1
  28. package/dist/elements/ListControls/index.d.ts.map +1 -1
  29. package/dist/elements/ListControls/index.js +1 -1
  30. package/dist/elements/ListControls/index.js.map +1 -1
  31. package/dist/elements/ListDrawer/types.d.ts +0 -1
  32. package/dist/elements/ListDrawer/types.d.ts.map +1 -1
  33. package/dist/elements/Logout/index.d.ts.map +1 -1
  34. package/dist/elements/Logout/index.js +1 -1
  35. package/dist/elements/Logout/index.js.map +1 -1
  36. package/dist/elements/Nav/index.client.d.ts.map +1 -1
  37. package/dist/elements/Nav/index.client.js +1 -1
  38. package/dist/elements/Nav/index.client.js.map +1 -1
  39. package/dist/elements/Nav/index.d.ts +2 -4
  40. package/dist/elements/Nav/index.d.ts.map +1 -1
  41. package/dist/elements/Nav/index.js +31 -8
  42. package/dist/elements/Nav/index.js.map +1 -1
  43. package/dist/elements/Pill/index.d.ts +0 -1
  44. package/dist/elements/Pill/index.d.ts.map +1 -1
  45. package/dist/elements/ReactSelect/index.d.ts.map +1 -1
  46. package/dist/elements/ReactSelect/index.js +4 -1
  47. package/dist/elements/ReactSelect/index.js.map +1 -1
  48. package/dist/elements/RenderCustomComponent/index.d.ts +5 -0
  49. package/dist/elements/RenderCustomComponent/index.d.ts.map +1 -1
  50. package/dist/elements/RenderCustomComponent/index.js +12 -3
  51. package/dist/elements/RenderCustomComponent/index.js.map +1 -1
  52. package/dist/elements/Status/index.js.map +1 -1
  53. package/dist/elements/StayLoggedIn/index.d.ts.map +1 -1
  54. package/dist/elements/StayLoggedIn/index.js +2 -2
  55. package/dist/elements/StayLoggedIn/index.js.map +1 -1
  56. package/dist/elements/StepNav/index.scss +1 -2
  57. package/dist/elements/Table/DefaultCell/fields/Array/index.d.ts.map +1 -1
  58. package/dist/elements/Table/DefaultCell/fields/Array/index.js +1 -1
  59. package/dist/elements/Table/DefaultCell/fields/Array/index.js.map +1 -1
  60. package/dist/elements/Table/DefaultCell/fields/Blocks/index.d.ts.map +1 -1
  61. package/dist/elements/Table/DefaultCell/fields/Blocks/index.js +1 -1
  62. package/dist/elements/Table/DefaultCell/fields/Blocks/index.js.map +1 -1
  63. package/dist/elements/Table/DefaultCell/fields/Checkbox/index.d.ts.map +1 -1
  64. package/dist/elements/Table/DefaultCell/fields/Checkbox/index.js +1 -1
  65. package/dist/elements/Table/DefaultCell/fields/Checkbox/index.js.map +1 -1
  66. package/dist/elements/Table/DefaultCell/fields/Date/index.d.ts.map +1 -1
  67. package/dist/elements/Table/DefaultCell/fields/Date/index.js +3 -3
  68. package/dist/elements/Table/DefaultCell/fields/Date/index.js.map +1 -1
  69. package/dist/elements/Table/DefaultCell/fields/File/index.d.ts.map +1 -1
  70. package/dist/elements/Table/DefaultCell/fields/File/index.js +1 -1
  71. package/dist/elements/Table/DefaultCell/fields/File/index.js.map +1 -1
  72. package/dist/elements/Table/DefaultCell/fields/Relationship/index.d.ts.map +1 -1
  73. package/dist/elements/Table/DefaultCell/fields/Relationship/index.js +5 -5
  74. package/dist/elements/Table/DefaultCell/fields/Relationship/index.js.map +1 -1
  75. package/dist/elements/Table/DefaultCell/fields/Select/index.d.ts.map +1 -1
  76. package/dist/elements/Table/DefaultCell/fields/Select/index.js +1 -1
  77. package/dist/elements/Table/DefaultCell/fields/Select/index.js.map +1 -1
  78. package/dist/elements/Table/DefaultCell/index.js +3 -3
  79. package/dist/elements/Table/DefaultCell/index.js.map +1 -1
  80. package/dist/elements/Table/RelationshipProvider/index.d.ts.map +1 -1
  81. package/dist/elements/Table/RelationshipProvider/index.js +4 -4
  82. package/dist/elements/Table/RelationshipProvider/index.js.map +1 -1
  83. package/dist/elements/TableColumns/buildColumnState.d.ts.map +1 -1
  84. package/dist/elements/TableColumns/buildColumnState.js +1 -1
  85. package/dist/elements/TableColumns/buildColumnState.js.map +1 -1
  86. package/dist/elements/Translation/index.d.ts +2 -2
  87. package/dist/elements/Translation/index.d.ts.map +1 -1
  88. package/dist/elements/Translation/index.js.map +1 -1
  89. package/dist/elements/Upload/index.d.ts.map +1 -1
  90. package/dist/elements/Upload/index.js +2 -2
  91. package/dist/elements/Upload/index.js.map +1 -1
  92. package/dist/elements/WhereBuilder/Condition/Relationship/types.d.ts +3 -3
  93. package/dist/elements/WhereBuilder/Condition/Relationship/types.d.ts.map +1 -1
  94. package/dist/elements/WhereBuilder/Condition/Relationship/types.js.map +1 -1
  95. package/dist/elements/WhereBuilder/Condition/index.d.ts.map +1 -1
  96. package/dist/elements/WhereBuilder/Condition/index.js.map +1 -1
  97. package/dist/elements/WithServerSideProps/index.d.ts +2 -2
  98. package/dist/elements/WithServerSideProps/index.d.ts.map +1 -1
  99. package/dist/elements/WithServerSideProps/index.js +4 -6
  100. package/dist/elements/WithServerSideProps/index.js.map +1 -1
  101. package/dist/fields/Array/index.d.ts.map +1 -1
  102. package/dist/fields/Array/index.js +5 -5
  103. package/dist/fields/Array/index.js.map +1 -1
  104. package/dist/fields/Blocks/BlocksDrawer/index.js.map +1 -1
  105. package/dist/fields/Blocks/index.d.ts.map +1 -1
  106. package/dist/fields/Blocks/index.js +5 -5
  107. package/dist/fields/Blocks/index.js.map +1 -1
  108. package/dist/fields/Checkbox/Input.d.ts.map +1 -1
  109. package/dist/fields/Checkbox/Input.js +1 -1
  110. package/dist/fields/Checkbox/Input.js.map +1 -1
  111. package/dist/fields/Checkbox/index.d.ts.map +1 -1
  112. package/dist/fields/Checkbox/index.js +4 -4
  113. package/dist/fields/Checkbox/index.js.map +1 -1
  114. package/dist/fields/Code/index.d.ts.map +1 -1
  115. package/dist/fields/Code/index.js +4 -4
  116. package/dist/fields/Code/index.js.map +1 -1
  117. package/dist/fields/Collapsible/index.d.ts.map +1 -1
  118. package/dist/fields/Collapsible/index.js +1 -1
  119. package/dist/fields/Collapsible/index.js.map +1 -1
  120. package/dist/fields/DateTime/index.d.ts.map +1 -1
  121. package/dist/fields/DateTime/index.js +3 -3
  122. package/dist/fields/DateTime/index.js.map +1 -1
  123. package/dist/fields/Email/index.d.ts.map +1 -1
  124. package/dist/fields/Email/index.js +4 -4
  125. package/dist/fields/Email/index.js.map +1 -1
  126. package/dist/fields/Group/index.d.ts.map +1 -1
  127. package/dist/fields/Group/index.js +1 -1
  128. package/dist/fields/Group/index.js.map +1 -1
  129. package/dist/fields/HiddenInput/index.d.ts.map +1 -1
  130. package/dist/fields/HiddenInput/index.js +1 -1
  131. package/dist/fields/HiddenInput/index.js.map +1 -1
  132. package/dist/fields/JSON/index.d.ts.map +1 -1
  133. package/dist/fields/JSON/index.js +3 -3
  134. package/dist/fields/JSON/index.js.map +1 -1
  135. package/dist/fields/Number/index.d.ts.map +1 -1
  136. package/dist/fields/Number/index.js +4 -4
  137. package/dist/fields/Number/index.js.map +1 -1
  138. package/dist/fields/Password/index.d.ts.map +1 -1
  139. package/dist/fields/Password/index.js +2 -2
  140. package/dist/fields/Password/index.js.map +1 -1
  141. package/dist/fields/Point/index.d.ts.map +1 -1
  142. package/dist/fields/Point/index.js +4 -4
  143. package/dist/fields/Point/index.js.map +1 -1
  144. package/dist/fields/RadioGroup/Radio/index.d.ts +1 -0
  145. package/dist/fields/RadioGroup/Radio/index.d.ts.map +1 -1
  146. package/dist/fields/RadioGroup/Radio/index.js +3 -2
  147. package/dist/fields/RadioGroup/Radio/index.js.map +1 -1
  148. package/dist/fields/RadioGroup/Radio/index.scss +0 -28
  149. package/dist/fields/RadioGroup/index.d.ts.map +1 -1
  150. package/dist/fields/RadioGroup/index.js +4 -3
  151. package/dist/fields/RadioGroup/index.js.map +1 -1
  152. package/dist/fields/RadioGroup/index.scss +28 -0
  153. package/dist/fields/Relationship/index.d.ts.map +1 -1
  154. package/dist/fields/Relationship/index.js +4 -4
  155. package/dist/fields/Relationship/index.js.map +1 -1
  156. package/dist/fields/Relationship/types.d.ts +3 -3
  157. package/dist/fields/Relationship/types.d.ts.map +1 -1
  158. package/dist/fields/Relationship/types.js.map +1 -1
  159. package/dist/fields/Select/index.d.ts.map +1 -1
  160. package/dist/fields/Select/index.js +4 -4
  161. package/dist/fields/Select/index.js.map +1 -1
  162. package/dist/fields/Tabs/index.d.ts.map +1 -1
  163. package/dist/fields/Tabs/index.js +1 -1
  164. package/dist/fields/Tabs/index.js.map +1 -1
  165. package/dist/fields/Text/Input.d.ts.map +1 -1
  166. package/dist/fields/Text/Input.js +3 -3
  167. package/dist/fields/Text/Input.js.map +1 -1
  168. package/dist/fields/Text/index.d.ts.map +1 -1
  169. package/dist/fields/Text/index.js +1 -1
  170. package/dist/fields/Text/index.js.map +1 -1
  171. package/dist/fields/Textarea/Input.d.ts.map +1 -1
  172. package/dist/fields/Textarea/Input.js +3 -3
  173. package/dist/fields/Textarea/Input.js.map +1 -1
  174. package/dist/fields/Textarea/index.d.ts.map +1 -1
  175. package/dist/fields/Textarea/index.js +1 -1
  176. package/dist/fields/Textarea/index.js.map +1 -1
  177. package/dist/fields/Upload/Input.d.ts.map +1 -1
  178. package/dist/fields/Upload/Input.js +3 -3
  179. package/dist/fields/Upload/Input.js.map +1 -1
  180. package/dist/fields/Upload/index.d.ts.map +1 -1
  181. package/dist/fields/Upload/index.js +2 -2
  182. package/dist/fields/Upload/index.js.map +1 -1
  183. package/dist/forms/FieldLabel/index.d.ts.map +1 -1
  184. package/dist/forms/FieldLabel/index.js +1 -1
  185. package/dist/forms/FieldLabel/index.js.map +1 -1
  186. package/dist/forms/Form/mergeErrorPaths.js +1 -1
  187. package/dist/forms/Form/mergeErrorPaths.js.map +1 -1
  188. package/dist/forms/RowLabel/types.d.ts +2 -2
  189. package/dist/forms/RowLabel/types.d.ts.map +1 -1
  190. package/dist/forms/RowLabel/types.js.map +1 -1
  191. package/dist/graphics/Account/index.d.ts +0 -1
  192. package/dist/graphics/Account/index.d.ts.map +1 -1
  193. package/dist/graphics/Account/index.js +2 -11
  194. package/dist/graphics/Account/index.js.map +1 -1
  195. package/dist/graphics/Logo/index.d.ts +2 -4
  196. package/dist/graphics/Logo/index.d.ts.map +1 -1
  197. package/dist/graphics/Logo/index.js +12 -3
  198. package/dist/graphics/Logo/index.js.map +1 -1
  199. package/dist/providers/Auth/index.d.ts.map +1 -1
  200. package/dist/providers/Auth/index.js +5 -4
  201. package/dist/providers/Auth/index.js.map +1 -1
  202. package/dist/providers/ComponentMap/buildComponentMap/actions.d.ts +3 -2
  203. package/dist/providers/ComponentMap/buildComponentMap/actions.d.ts.map +1 -1
  204. package/dist/providers/ComponentMap/buildComponentMap/actions.js.map +1 -1
  205. package/dist/providers/ComponentMap/buildComponentMap/collections.d.ts +5 -4
  206. package/dist/providers/ComponentMap/buildComponentMap/collections.d.ts.map +1 -1
  207. package/dist/providers/ComponentMap/buildComponentMap/collections.js +1 -1
  208. package/dist/providers/ComponentMap/buildComponentMap/collections.js.map +1 -1
  209. package/dist/providers/ComponentMap/buildComponentMap/fields.d.ts +5 -4
  210. package/dist/providers/ComponentMap/buildComponentMap/fields.d.ts.map +1 -1
  211. package/dist/providers/ComponentMap/buildComponentMap/fields.js +1 -1
  212. package/dist/providers/ComponentMap/buildComponentMap/fields.js.map +1 -1
  213. package/dist/providers/ComponentMap/buildComponentMap/globals.d.ts +12 -9
  214. package/dist/providers/ComponentMap/buildComponentMap/globals.d.ts.map +1 -1
  215. package/dist/providers/ComponentMap/buildComponentMap/globals.js +2 -2
  216. package/dist/providers/ComponentMap/buildComponentMap/globals.js.map +1 -1
  217. package/dist/providers/ComponentMap/buildComponentMap/index.d.ts +4 -4
  218. package/dist/providers/ComponentMap/buildComponentMap/index.d.ts.map +1 -1
  219. package/dist/providers/ComponentMap/buildComponentMap/index.js +14 -8
  220. package/dist/providers/ComponentMap/buildComponentMap/index.js.map +1 -1
  221. package/dist/providers/ComponentMap/buildComponentMap/types.d.ts +1 -1
  222. package/dist/providers/ComponentMap/buildComponentMap/types.d.ts.map +1 -1
  223. package/dist/providers/ComponentMap/buildComponentMap/types.js.map +1 -1
  224. package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
  225. package/dist/providers/DocumentInfo/index.js +4 -4
  226. package/dist/providers/DocumentInfo/index.js.map +1 -1
  227. package/dist/providers/Root/index.d.ts +2 -2
  228. package/dist/providers/Root/index.d.ts.map +1 -1
  229. package/dist/providers/Root/index.js +1 -1
  230. package/dist/providers/Root/index.js.map +1 -1
  231. package/dist/providers/Translation/index.d.ts +10 -8
  232. package/dist/providers/Translation/index.d.ts.map +1 -1
  233. package/dist/providers/Translation/index.js +2 -1
  234. package/dist/providers/Translation/index.js.map +1 -1
  235. package/dist/templates/Default/index.d.ts +4 -4
  236. package/dist/templates/Default/index.d.ts.map +1 -1
  237. package/dist/templates/Default/index.js +20 -6
  238. package/dist/templates/Default/index.js.map +1 -1
  239. package/dist/utilities/formatDate.d.ts +2 -2
  240. package/dist/utilities/formatDate.d.ts.map +1 -1
  241. package/dist/utilities/formatDate.js.map +1 -1
  242. package/dist/utilities/formatDocTitle.d.ts +1 -1
  243. package/dist/utilities/formatDocTitle.d.ts.map +1 -1
  244. package/dist/utilities/formatDocTitle.js.map +1 -1
  245. package/dist/utilities/groupNavItems.d.ts +2 -2
  246. package/dist/utilities/groupNavItems.d.ts.map +1 -1
  247. package/dist/utilities/groupNavItems.js.map +1 -1
  248. package/package.json +5 -5
  249. /package/dist/assets/{favicon.svg → payload-favicon.svg} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/Text/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientValidate } from 'payload/types'\nimport type {} from 'payload/types'\n\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { Option } from '../../elements/ReactSelect/types.js'\nimport type { TextFieldProps, TextInputProps } from './types.js'\n\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { isFieldRTL } from '../shared/index.js'\nimport { TextInput } from './Input.js'\nimport './index.scss'\n\nexport { TextFieldProps, TextInput, TextInputProps }\n\nconst TextField: React.FC<TextFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n hasMany,\n inputRef,\n label,\n labelProps,\n localized,\n maxLength,\n maxRows,\n minLength,\n minRows,\n path: pathFromProps,\n placeholder,\n readOnly: readOnlyFromProps,\n required,\n rtl,\n style,\n validate,\n width,\n } = props\n\n const locale = useLocale()\n\n const { localization: localizationConfig } = useConfig()\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, minLength, maxLength, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n const readOnly = readOnlyFromProps || readOnlyFromContext\n\n const { formProcessing, path, setValue, showError, value } = useField({\n path: pathFromContext || pathFromProps || name,\n validate: memoizedValidate,\n })\n\n const renderRTL = isFieldRTL({\n fieldLocalized: localized,\n fieldRTL: rtl,\n locale,\n localizationConfig: localizationConfig || undefined,\n })\n\n const [valueToRender, setValueToRender] = useState<\n { id: string; label: string; value: { value: number } }[]\n >([]) // Only for hasMany\n\n const handleHasManyChange = useCallback(\n (selectedOption) => {\n if (!readOnly) {\n let newValue\n if (!selectedOption) {\n newValue = []\n } else if (Array.isArray(selectedOption)) {\n newValue = selectedOption.map((option) => option.value?.value || option.value)\n } else {\n newValue = [selectedOption.value?.value || selectedOption.value]\n }\n\n setValue(newValue)\n }\n },\n [readOnly, setValue],\n )\n\n // useEffect update valueToRender:\n useEffect(() => {\n if (hasMany && Array.isArray(value)) {\n setValueToRender(\n value.map((val, index) => {\n return {\n id: `${val}${index}`, // append index to avoid duplicate keys but allow duplicate numbers\n label: `${val}`,\n value: {\n // React-select automatically uses \"label-value\" as a key, so we will get that react duplicate key warning if we just pass in the value as multiple values can be the same. So we need to append the index to the toString() of the value to avoid that warning, as it uses that as the key.\n toString: () => `${val}${index}`,\n value: val?.value || val,\n },\n }\n }),\n )\n }\n }, [value, hasMany])\n\n return (\n <TextInput\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 hasMany={hasMany}\n inputRef={inputRef}\n label={label}\n labelProps={labelProps}\n maxRows={maxRows}\n minRows={minRows}\n onChange={\n hasMany\n ? handleHasManyChange\n : (e) => {\n setValue(e.target.value)\n }\n }\n path={path}\n placeholder={placeholder}\n readOnly={formProcessing || readOnly}\n required={required}\n rtl={renderRTL}\n showError={showError}\n style={style}\n value={(value as string) || ''}\n valueToRender={valueToRender as Option[]}\n width={width}\n />\n )\n}\n\nexport const Text = withCondition(TextField)\n"],"names":["useFieldProps","React","useCallback","useEffect","useState","useField","withCondition","useConfig","useLocale","isFieldRTL","TextInput","TextField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","hasMany","inputRef","label","labelProps","localized","maxLength","maxRows","minLength","minRows","path","pathFromProps","placeholder","readOnly","readOnlyFromProps","required","rtl","style","validate","width","locale","localization","localizationConfig","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formProcessing","setValue","showError","renderRTL","fieldLocalized","fieldRTL","undefined","valueToRender","setValueToRender","handleHasManyChange","selectedOption","newValue","Array","isArray","map","option","val","index","id","toString","onChange","e","target","Text"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,aAAa,QAAQ,0CAAyC;AACvE,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAK/D,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,UAAU,QAAQ,qBAAoB;AAC/C,SAASC,SAAS,QAAQ,aAAY;AAGtC,SAAyBA,SAAS,GAAkB;AAEpD,MAAMC,YAAsC,C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AO,CAACH,iBAAiB;gBACxCC,WAAWD,eAAeI,GAAG,CAAC,CAACC,SAAWA,OAAOnB,KAAK,EAAEA,SAASmB,OAAOnB,KAAK;YAC/E,OAAO;gBACLe,WAAW;oBAACD,eAAed,KAAK,EAAEA,SAASc,eAAed,KAAK;iBAAC;YAClE;YAEAK,SAASU;QACX;IACF,GACA;QAAC1B;QAAUgB;KAAS;IAGtB,kCAAkC;IAClC/C,UAAU;QACR,IAAImB,WAAWuC,MAAMC,OAAO,CAACjB,QAAQ;YACnCY,iBACEZ,MAAMkB,GAAG,CAAC,CAACE,KAAKC;gBACd,OAAO;oBACLC,IAAI,CAAC,EAAEF,IAAI,EAAEC,MAAM,CAAC;oBACpB1C,OAAO,CAAC,EAAEyC,IAAI,CAAC;oBACfpB,OAAO;wBACL,4RAA4R;wBAC5RuB,UAAU,IAAM,CAAC,EAAEH,IAAI,EAAEC,MAAM,CAAC;wBAChCrB,OAAOoB,KAAKpB,SAASoB;oBACvB;gBACF;YACF;QAEJ;IACF,GAAG;QAACpB;QAAOvB;KAAQ;IAEnB,qBACE,oBAACZ;QACCI,YAAYA;QACZC,aAAaA;QACbC,mBAAmBA;QACnBC,aAAaA;QACbC,aAAaA;QACbC,WAAWA;QACXC,kBAAkBA;QAClBC,YAAYA;QACZC,SAASA;QACTC,UAAUA;QACVC,OAAOA;QACPC,YAAYA;QACZG,SAASA;QACTE,SAASA;QACTuC,UACE/C,UACIoC,sBACA,CAACY;YACCpB,SAASoB,EAAEC,MAAM,CAAC1B,KAAK;QACzB;QAENd,MAAMA;QACNE,aAAaA;QACbC,UAAUe,kBAAkBf;QAC5BE,UAAUA;QACVC,KAAKe;QACLD,WAAWA;QACXb,OAAOA;QACPO,OAAO,AAACA,SAAoB;QAC5BW,eAAeA;QACfhB,OAAOA;;AAGb;AAEA,OAAO,MAAMgC,OAAOlE,cAAcK,WAAU"}
1
+ {"version":3,"sources":["../../../src/fields/Text/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientValidate } from 'payload/types'\n\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { Option } from '../../elements/ReactSelect/types.js'\nimport type { TextFieldProps, TextInputProps } 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 { useLocale } from '../../providers/Locale/index.js'\nimport { isFieldRTL } from '../shared/index.js'\nimport { TextInput } from './Input.js'\nimport './index.scss'\n\nexport { TextFieldProps, TextInput, TextInputProps }\n\nconst TextField: React.FC<TextFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n hasMany,\n inputRef,\n label,\n labelProps,\n localized,\n maxLength,\n maxRows,\n minLength,\n minRows,\n path: pathFromProps,\n placeholder,\n readOnly: readOnlyFromProps,\n required,\n rtl,\n style,\n validate,\n width,\n } = props\n\n const locale = useLocale()\n\n const { localization: localizationConfig } = useConfig()\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, minLength, maxLength, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n const readOnly = readOnlyFromProps || readOnlyFromContext\n\n const { formProcessing, path, setValue, showError, value } = useField({\n path: pathFromContext || pathFromProps || name,\n validate: memoizedValidate,\n })\n\n const renderRTL = isFieldRTL({\n fieldLocalized: localized,\n fieldRTL: rtl,\n locale,\n localizationConfig: localizationConfig || undefined,\n })\n\n const [valueToRender, setValueToRender] = useState<\n { id: string; label: string; value: { value: number } }[]\n >([]) // Only for hasMany\n\n const handleHasManyChange = useCallback(\n (selectedOption) => {\n if (!readOnly) {\n let newValue\n if (!selectedOption) {\n newValue = []\n } else if (Array.isArray(selectedOption)) {\n newValue = selectedOption.map((option) => option.value?.value || option.value)\n } else {\n newValue = [selectedOption.value?.value || selectedOption.value]\n }\n\n setValue(newValue)\n }\n },\n [readOnly, setValue],\n )\n\n // useEffect update valueToRender:\n useEffect(() => {\n if (hasMany && Array.isArray(value)) {\n setValueToRender(\n value.map((val, index) => {\n return {\n id: `${val}${index}`, // append index to avoid duplicate keys but allow duplicate numbers\n label: `${val}`,\n value: {\n // React-select automatically uses \"label-value\" as a key, so we will get that react duplicate key warning if we just pass in the value as multiple values can be the same. So we need to append the index to the toString() of the value to avoid that warning, as it uses that as the key.\n toString: () => `${val}${index}`,\n value: val?.value || val,\n },\n }\n }),\n )\n }\n }, [value, hasMany])\n\n return (\n <TextInput\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 hasMany={hasMany}\n inputRef={inputRef}\n label={label}\n labelProps={labelProps}\n maxRows={maxRows}\n minRows={minRows}\n onChange={\n hasMany\n ? handleHasManyChange\n : (e) => {\n setValue(e.target.value)\n }\n }\n path={path}\n placeholder={placeholder}\n readOnly={formProcessing || readOnly}\n required={required}\n rtl={renderRTL}\n showError={showError}\n style={style}\n value={(value as string) || ''}\n valueToRender={valueToRender as Option[]}\n width={width}\n />\n )\n}\n\nexport const Text = withCondition(TextField)\n"],"names":["React","useCallback","useEffect","useState","useFieldProps","useField","withCondition","useConfig","useLocale","isFieldRTL","TextInput","TextField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","hasMany","inputRef","label","labelProps","localized","maxLength","maxRows","minLength","minRows","path","pathFromProps","placeholder","readOnly","readOnlyFromProps","required","rtl","style","validate","width","locale","localization","localizationConfig","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formProcessing","setValue","showError","renderRTL","fieldLocalized","fieldRTL","undefined","valueToRender","setValueToRender","handleHasManyChange","selectedOption","newValue","Array","isArray","map","option","val","index","id","to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AaA;QACbC,mBAAmBA;QACnBC,aAAaA;QACbC,aAAaA;QACbC,WAAWA;QACXC,kBAAkBA;QAClBC,YAAYA;QACZC,SAASA;QACTC,UAAUA;QACVC,OAAOA;QACPC,YAAYA;QACZG,SAASA;QACTE,SAASA;QACTuC,UACE/C,UACIoC,sBACA,CAACY;YACCpB,SAASoB,EAAEC,MAAM,CAAC1B,KAAK;QACzB;QAENd,MAAMA;QACNE,aAAaA;QACbC,UAAUe,kBAAkBf;QAC5BE,UAAUA;QACVC,KAAKe;QACLD,WAAWA;QACXb,OAAOA;QACPO,OAAO,AAACA,SAAoB;QAC5BW,eAAeA;QACfhB,OAAOA;;AAGb;AAEA,OAAO,MAAMgC,OAAOlE,cAAcK,WAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/fields/Textarea/Input.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAIpD,OAAO,cAAc,CAAA;AAErB,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA2EtD,CAAA"}
1
+ {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/fields/Textarea/Input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAOpD,OAAO,cAAc,CAAA;AAErB,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA2EtD,CAAA"}
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import { getTranslation } from '@payloadcms/translations';
3
- import { FieldDescription } from '@payloadcms/ui/forms/FieldDescription';
4
- import { FieldError } from '@payloadcms/ui/forms/FieldError';
5
- import { FieldLabel } from '@payloadcms/ui/forms/FieldLabel';
6
3
  import React from 'react';
4
+ import { FieldDescription } from '../../forms/FieldDescription/index.js';
5
+ import { FieldError } from '../../forms/FieldError/index.js';
6
+ import { FieldLabel } from '../../forms/FieldLabel/index.js';
7
7
  import { useTranslation } from '../../providers/Translation/index.js';
8
8
  import { fieldBaseClass } from '../shared/index.js';
9
9
  export const TextareaInput = (props)=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/Textarea/Input.tsx"],"sourcesContent":["'use client'\nimport { getTranslation } from '@payloadcms/translations'\nimport { FieldDescription } from '@payloadcms/ui/forms/FieldDescription'\nimport { FieldError } from '@payloadcms/ui/forms/FieldError'\nimport { FieldLabel } from '@payloadcms/ui/forms/FieldLabel'\nimport React from 'react'\n\nimport type { TextAreaInputProps } from './types.js'\n\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nexport const TextareaInput: React.FC<TextAreaInputProps> = (props) => {\n const {\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n label,\n labelProps,\n onChange,\n path,\n placeholder,\n readOnly,\n required,\n rows,\n rtl,\n showError,\n style,\n value,\n width,\n } = props\n\n const { i18n } = useTranslation()\n\n return (\n <div\n className={[\n fieldBaseClass,\n 'textarea',\n className,\n showError && 'error',\n readOnly && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n {BeforeInput}\n <label className=\"textarea-outer\" htmlFor={`field-${path.replace(/\\./g, '__')}`}>\n <div className=\"textarea-inner\">\n <div className=\"textarea-clone\" data-value={value || placeholder || ''} />\n <textarea\n className=\"textarea-element\"\n data-rtl={rtl}\n disabled={readOnly}\n id={`field-${path.replace(/\\./g, '__')}`}\n name={path}\n onChange={onChange}\n placeholder={getTranslation(placeholder, i18n)}\n rows={rows}\n value={value || ''}\n />\n </div>\n </label>\n {AfterInput}\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n )\n}\n"],"names":["getTranslation","FieldDescription","FieldError","FieldLabel","React","useTranslation","fieldBaseClass","TextareaInput","props","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","label","labelProps","onChange","path","placeholder","readOnly","required","rows","rtl","showError","style","value","width","i18n","div","filter","Boolean","join","htmlFor","replace","data-value","textarea","data-rtl","disabled","id","name","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SAASC,gBAAgB,QAAQ,wCAAuC;AACxE,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,OAAOC,WAAW,QAAO;AAIzB,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,qBAAoB;AAGnD,OAAO,MAAMC,gBAA8C,CAACC;IAC1D,MAAM,EACJC,UAAU,EACVC,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,QAAQ,EACRC,IAAI,EACJC,WAAW,EACXC,QAAQ,EACRC,QAAQ,EACRC,IAAI,EACJC,GAAG,EACHC,SAAS,EACTC,KAAK,EACLC,KAAK,EACLC,KAAK,EACN,GAAGrB;IAEJ,MAAM,EAAEsB,IAAI,EAAE,GAAGzB;IAEjB,qBACE,oBAAC0B;QACCjB,WAAW;YACTR;YACA;YACAQ;YACAY,aAAa;YACbJ,YAAY;SACb,CACEU,MAAM,CAACC,SACPC,IAAI,CAAC;QACRP,OAAO;YACL,GAAGA,KAAK;YACRE;QACF;qBAEA,oBAAC3B;QAAWU,aAAaA;QAAaQ,MAAMA;QAAO,GAAIJ,cAAc,CAAC,CAAC;sBACvE,oBAACb;QACCU,aAAaA;QACbI,OAAOA;QACPM,UAAUA;QACT,GAAIL,cAAc,CAAC,CAAC;QAEtBR,2BACD,oBAACO;QAAMH,WAAU;QAAiBqB,SAAS,CAAC,MAAM,EAAEf,KAAKgB,OAAO,CAAC,OAAO,MAAM,CAAC;qBAC7E,oBAACL;QAAIjB,WAAU;qBACb,oBAACiB;QAAIjB,WAAU;QAAiBuB,cAAYT,SAASP,eAAe;sBACpE,oBAACiB;QACCxB,WAAU;QACVyB,YAAUd;QACVe,UAAUlB;QACVmB,IAAI,CAAC,MAAM,EAAErB,KAAKgB,OAAO,CAAC,OAAO,MAAM,CAAC;QACxCM,MAAMtB;QACND,UAAUA;QACVE,aAAarB,eAAeqB,aAAaS;QACzCN,MAAMA;QACNI,OAAOA,SAAS;UAIrBnB,YACAE,sBAAsBgC,YACrBhC,kCAEA,oBAACV,kBAAsBc,oBAAoB,CAAC;AAIpD,EAAC"}
1
+ {"version":3,"sources":["../../../src/fields/Textarea/Input.tsx"],"sourcesContent":["'use client'\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport type { TextAreaInputProps } from './types.js'\n\nimport { FieldDescription } from '../../forms/FieldDescription/index.js'\nimport { FieldError } from '../../forms/FieldError/index.js'\nimport { FieldLabel } from '../../forms/FieldLabel/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nexport const TextareaInput: React.FC<TextAreaInputProps> = (props) => {\n const {\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n label,\n labelProps,\n onChange,\n path,\n placeholder,\n readOnly,\n required,\n rows,\n rtl,\n showError,\n style,\n value,\n width,\n } = props\n\n const { i18n } = useTranslation()\n\n return (\n <div\n className={[\n fieldBaseClass,\n 'textarea',\n className,\n showError && 'error',\n readOnly && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n {BeforeInput}\n <label className=\"textarea-outer\" htmlFor={`field-${path.replace(/\\./g, '__')}`}>\n <div className=\"textarea-inner\">\n <div className=\"textarea-clone\" data-value={value || placeholder || ''} />\n <textarea\n className=\"textarea-element\"\n data-rtl={rtl}\n disabled={readOnly}\n id={`field-${path.replace(/\\./g, '__')}`}\n name={path}\n onChange={onChange}\n placeholder={getTranslation(placeholder, i18n)}\n rows={rows}\n value={value || ''}\n />\n </div>\n </label>\n {AfterInput}\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n )\n}\n"],"names":["getTranslation","React","FieldDescription","FieldError","FieldLabel","useTranslation","fieldBaseClass","TextareaInput","props","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","label","labelProps","onChange","path","placeholder","readOnly","required","rows","rtl","showError","style","value","width","i18n","div","filter","Boolean","join","htmlFor","replace","data-value","textarea","data-rtl","disabled","id","name","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,WAAW,QAAO;AAIzB,SAASC,gBAAgB,QAAQ,wCAAuC;AACxE,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,qBAAoB;AAGnD,OAAO,MAAMC,gBAA8C,CAACC;IAC1D,MAAM,EACJC,UAAU,EACVC,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,QAAQ,EACRC,IAAI,EACJC,WAAW,EACXC,QAAQ,EACRC,QAAQ,EACRC,IAAI,EACJC,GAAG,EACHC,SAAS,EACTC,KAAK,EACLC,KAAK,EACLC,KAAK,EACN,GAAGrB;IAEJ,MAAM,EAAEsB,IAAI,EAAE,GAAGzB;IAEjB,qBACE,oBAAC0B;QACCjB,WAAW;YACTR;YACA;YACAQ;YACAY,aAAa;YACbJ,YAAY;SACb,CACEU,MAAM,CAACC,SACPC,IAAI,CAAC;QACRP,OAAO;YACL,GAAGA,KAAK;YACRE;QACF;qBAEA,oBAAC1B;QAAWS,aAAaA;QAAaQ,MAAMA;QAAO,GAAIJ,cAAc,CAAC,CAAC;sBACvE,oBAACZ;QACCS,aAAaA;QACbI,OAAOA;QACPM,UAAUA;QACT,GAAIL,cAAc,CAAC,CAAC;QAEtBR,2BACD,oBAACO;QAAMH,WAAU;QAAiBqB,SAAS,CAAC,MAAM,EAAEf,KAAKgB,OAAO,CAAC,OAAO,MAAM,CAAC;qBAC7E,oBAACL;QAAIjB,WAAU;qBACb,oBAACiB;QAAIjB,WAAU;QAAiBuB,cAAYT,SAASP,eAAe;sBACpE,oBAACiB;QACCxB,WAAU;QACVyB,YAAUd;QACVe,UAAUlB;QACVmB,IAAI,CAAC,MAAM,EAAErB,KAAKgB,OAAO,CAAC,OAAO,MAAM,CAAC;QACxCM,MAAMtB;QACND,UAAUA;QACVE,aAAarB,eAAeqB,aAAaS;QACzCN,MAAMA;QACNI,OAAOA,SAAS;UAIrBnB,YACAE,sBAAsBgC,YACrBhC,kCAEA,oBAACT,kBAAsBa,oBAAoB,CAAC;AAIpD,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Textarea/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAOxE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,cAAc,CAAA;AAErB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAA;AAsFhE,eAAO,MAAM,QAAQ,8BAA+B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Textarea/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAQxE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,cAAc,CAAA;AAErB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAA;AAsFhE,eAAO,MAAM,QAAQ,8BAA+B,CAAA"}
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable react/destructuring-assignment */ 'use client';
2
2
  import { getTranslation } from '@payloadcms/translations';
3
- import { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider';
4
3
  import React, { useCallback } from 'react';
4
+ import { useFieldProps } from '../../forms/FieldPropsProvider/index.js';
5
5
  import { useField } from '../../forms/useField/index.js';
6
6
  import { withCondition } from '../../forms/withCondition/index.js';
7
7
  import { useConfig } from '../../providers/Config/index.js';
@@ -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 { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport React, { useCallback } from 'react'\n\nimport type { TextAreaInputProps, TextareaFieldProps } from './types.js'\n\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 const readOnly = readOnlyFromProps || readOnlyFromContext\n\n const { path, setValue, showError, value } = useField<string>({\n path: pathFromContext || pathFromProps || name,\n validate: memoizedValidate,\n })\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={readOnly}\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","useFieldProps","React","useCallback","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","setValue","showError","onChange","e","target","Textarea"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,iDAAiD,GACjD;AAGA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SAASC,aAAa,QAAQ,0CAAyC;AACvE,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAI1C,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,UAAU,QAAQ,qBAAoB;AAC/C,SAASC,aAAa,QAAQ,aAAY;AAG1C,SAAiDA,aAAa,GAAE;AAEhE,MAAMC,gBAA8C,CAACC;IACnD,MAAM,EACJC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,SAAS,EACTC,SAAS,EACTC,MAAMC,aAAa,EACnBC,WAAW,EACXC,UAAUC,iBAAiB,EAC3BC,QAAQ,EACRC,IAAI,EACJC,GAAG,EACHC,KAAK,EACLC,QAAQ,EACRC,KAAK,EACN,GAAG1B;IAEJ,MAAM,EAAE2B,IAAI,EAAE,GAAG/B;IAEjB,MAAM,EAAEgC,YAAY,EAAE,GAAGjC;IAEzB,MAAMkC,QAAQhC,WAAW;QACvBiC,gBAAgBjB;QAChBkB,UAAUR;QACVX;QACAoB,oBAAoBJ,gBAAgBK;IACtC;IAEA,MAAMC,mBAAmC1C,YACvC,CAAC2C,OAAOC;QACN,IAAI,OAAOX,aAAa,YACtB,OAAOA,SAASU,OAAO;YAAE,GAAGC,OAAO;YAAEtB;YAAWC;YAAWM;QAAS;IACxE,GACA;QAACI;QAAUJ;QAAUP;QAAWC;KAAU;IAG5C,MAAM,EAAEC,MAAMqB,eAAe,EAAElB,UAAUmB,mBAAmB,EAAE,GAAGhD;IACjE,MAAM6B,WAAWC,qBAAqBkB;IAEtC,MAAM,EAAEtB,IAAI,EAAEuB,QAAQ,EAAEC,SAAS,EAAEL,KAAK,EAAE,GAAG1C,SAAiB;QAC5DuB,MAAMqB,mBAAmBpB,iBAAiBhB;QAC1CwB,UAAUS;IACZ;IAEA,qBACE,oBAACpC;QACCI,YAAYA;QACZC,aAAaA;QACbC,mBAAmBA;QACnBC,aAAaA;QACbC,aAAaA;QACbC,WAAWA;QACXC,kBAAkBA;QAClBC,YAAYA;QACZC,OAAOA;QACPC,YAAYA;QACZ8B,UAAU,CAACC;YACTH,SAASG,EAAEC,MAAM,CAACR,KAAK;QACzB;QACAnB,MAAMA;QACNE,aAAa7B,eAAe6B,aAAaS;QACzCR,UAAUA;QACVE,UAAUA;QACVC,MAAMA;QACNC,KAAKM;QACLW,WAAWA;QACXhB,OAAOA;QACPW,OAAOA;QACPT,OAAOA;;AAGb;AAEA,OAAO,MAAMkB,WAAWlD,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 const readOnly = readOnlyFromProps || readOnlyFromContext\n\n const { path, setValue, showError, value } = useField<string>({\n path: pathFromContext || pathFromProps || name,\n validate: memoizedValidate,\n })\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={readOnly}\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","setValue","showError","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,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,UAAU,QAAQ,qBAAoB;AAC/C,SAASC,aAAa,QAAQ,aAAY;AAG1C,SAAiDA,aAAa,GAAE;AAEhE,MAAMC,gBAA8C,CAACC;IACnD,MAAM,EACJC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,SAAS,EACTC,SAAS,EACTC,MAAMC,aAAa,EACnBC,WAAW,EACXC,UAAUC,iBAAiB,EAC3BC,QAAQ,EACRC,IAAI,EACJC,GAAG,EACHC,KAAK,EACLC,QAAQ,EACRC,KAAK,EACN,GAAG1B;IAEJ,MAAM,EAAE2B,IAAI,EAAE,GAAG/B;IAEjB,MAAM,EAAEgC,YAAY,EAAE,GAAGjC;IAEzB,MAAMkC,QAAQhC,WAAW;QACvBiC,gBAAgBjB;QAChBkB,UAAUR;QACVX;QACAoB,oBAAoBJ,gBAAgBK;IACtC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"}
@@ -1,13 +1,13 @@
1
1
  'use client';
2
2
  import { getTranslation } from '@payloadcms/translations';
3
- import { FieldDescription } from '@payloadcms/ui/forms/FieldDescription';
4
- import { FieldError } from '@payloadcms/ui/forms/FieldError';
5
- import { FieldLabel } from '@payloadcms/ui/forms/FieldLabel';
6
3
  import React, { useCallback, useEffect, useState } from 'react';
7
4
  import { Button } from '../../elements/Button/index.js';
8
5
  import { useDocumentDrawer } from '../../elements/DocumentDrawer/index.js';
9
6
  import { FileDetails } from '../../elements/FileDetails/index.js';
10
7
  import { useListDrawer } from '../../elements/ListDrawer/index.js';
8
+ import { FieldDescription } from '../../forms/FieldDescription/index.js';
9
+ import { FieldError } from '../../forms/FieldError/index.js';
10
+ import { FieldLabel } from '../../forms/FieldLabel/index.js';
11
11
  import { useTranslation } from '../../providers/Translation/index.js';
12
12
  import { fieldBaseClass } from '../shared/index.js';
13
13
  const baseClass = 'upload';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/Upload/Input.tsx"],"sourcesContent":["'use client'\n\nimport type { ClientCollectionConfig, FilterOptionsResult, UploadField } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { FieldDescription } from '@payloadcms/ui/forms/FieldDescription'\nimport { FieldError } from '@payloadcms/ui/forms/FieldError'\nimport { FieldLabel } from '@payloadcms/ui/forms/FieldLabel'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { DocumentDrawerProps } from '../../elements/DocumentDrawer/types.js'\nimport type { ListDrawerProps } from '../../elements/ListDrawer/types.js'\nimport type { UploadFieldProps } from './types.js'\n\nimport { Button } from '../../elements/Button/index.js'\nimport { useDocumentDrawer } from '../../elements/DocumentDrawer/index.js'\nimport { FileDetails } from '../../elements/FileDetails/index.js'\nimport { useListDrawer } from '../../elements/ListDrawer/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nconst baseClass = 'upload'\n\nexport type UploadInputProps = Omit<UploadFieldProps, 'filterOptions'> & {\n api?: string\n collection?: ClientCollectionConfig\n filterOptions?: FilterOptionsResult\n onChange?: (e) => void\n relationTo?: UploadField['relationTo']\n serverURL?: string\n showError?: boolean\n value?: string\n}\n\nexport const UploadInput: React.FC<UploadInputProps> = (props) => {\n const {\n CustomDescription,\n CustomError,\n CustomLabel,\n api = '/api',\n className,\n collection,\n descriptionProps,\n errorProps,\n filterOptions,\n label,\n labelProps,\n onChange,\n readOnly,\n relationTo,\n required,\n serverURL,\n showError,\n style,\n value,\n width,\n } = props\n\n const { i18n, t } = useTranslation()\n\n const [fileDoc, setFileDoc] = useState(undefined)\n const [missingFile, setMissingFile] = useState(false)\n const [collectionSlugs] = useState([collection?.slug])\n\n const [DocumentDrawer, DocumentDrawerToggler, { closeDrawer }] = useDocumentDrawer({\n collectionSlug: collectionSlugs[0],\n })\n\n const [ListDrawer, ListDrawerToggler, { closeDrawer: closeListDrawer }] = useListDrawer({\n collectionSlugs,\n filterOptions,\n })\n\n useEffect(() => {\n if (value !== null && typeof value !== 'undefined' && value !== '') {\n const fetchFile = async () => {\n const response = await fetch(`${serverURL}${api}/${relationTo}/${value}`, {\n credentials: 'include',\n headers: {\n 'Accept-Language': i18n.language,\n },\n })\n if (response.ok) {\n const json = await response.json()\n setFileDoc(json)\n } else {\n setMissingFile(true)\n setFileDoc(undefined)\n }\n }\n\n void fetchFile()\n } else {\n setFileDoc(undefined)\n }\n }, [value, relationTo, api, serverURL, i18n])\n\n const onSave = useCallback<DocumentDrawerProps['onSave']>(\n (args) => {\n setMissingFile(false)\n onChange(args.doc)\n closeDrawer()\n },\n [onChange, closeDrawer],\n )\n\n const onSelect = useCallback<ListDrawerProps['onSelect']>(\n (args) => {\n setMissingFile(false)\n onChange({\n id: args.docID,\n })\n closeListDrawer()\n },\n [onChange, closeListDrawer],\n )\n\n if (collection.upload) {\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && 'error',\n readOnly && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldError CustomError={CustomError} {...(errorProps || {})} />\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n {collection?.upload && (\n <React.Fragment>\n {fileDoc && !missingFile && (\n <FileDetails\n collectionSlug={relationTo}\n doc={fileDoc}\n handleRemove={\n readOnly\n ? undefined\n : () => {\n onChange(null)\n }\n }\n uploadConfig={collection.upload}\n />\n )}\n {(!fileDoc || missingFile) && (\n <div className={`${baseClass}__wrap`}>\n <div className={`${baseClass}__buttons`}>\n <DocumentDrawerToggler className={`${baseClass}__toggler`} disabled={readOnly}>\n <Button buttonStyle=\"secondary\" disabled={readOnly} el=\"div\">\n {t('fields:uploadNewLabel', {\n label: getTranslation(collection.labels.singular, i18n),\n })}\n </Button>\n </DocumentDrawerToggler>\n <ListDrawerToggler className={`${baseClass}__toggler`} disabled={readOnly}>\n <Button buttonStyle=\"secondary\" disabled={readOnly} el=\"div\">\n {t('fields:chooseFromExisting')}\n </Button>\n </ListDrawerToggler>\n </div>\n </div>\n )}\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </React.Fragment>\n )}\n {!readOnly && <DocumentDrawer onSave={onSave} />}\n {!readOnly && <ListDrawer onSelect={onSelect} />}\n </div>\n )\n }\n\n return null\n}\n"],"names":["getTranslation","FieldDescription","FieldError","FieldLabel","React","useCallback","useEffect","useState","Button","useDocumentDrawer","FileDetails","useListDrawer","useTranslation","fieldBaseClass","baseClass","UploadInput","props","CustomDescription","CustomError","CustomLabel","api","className","collection","descriptionProps","errorProps","filterOptions","label","labelProps","onChange","readOnly","relationTo","required","serverURL","showError","style","value","width","i18n","t","fileDoc","setFileDoc","undefined","missingFile","setMissingFile","collectionSlugs","slug","DocumentDrawer","DocumentDrawerToggler","closeDrawer","collectionSlug","ListDrawer","ListDrawerToggler","closeListDrawer","fetchFile","response","fetch","credentials","headers","language","ok","json","onSave","args","doc","onSelect","id","docID","upload","div","filter","Boolean","join","Fragment","handleRemove","uploadConfig","disabled","buttonStyle","el","labels","singular"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SAASC,gBAAgB,QAAQ,wCAAuC;AACxE,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAM/D,SAASC,MAAM,QAAQ,iCAAgC;AACvD,SAASC,iBAAiB,QAAQ,yCAAwC;AAC1E,SAASC,WAAW,QAAQ,sCAAqC;AACjE,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,qBAAoB;AAGnD,MAAMC,YAAY;AAalB,OAAO,MAAMC,cAA0C,CAACC;IACtD,MAAM,EACJC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,MAAM,MAAM,EACZC,SAAS,EACTC,UAAU,EACVC,gBAAgB,EAChBC,UAAU,EACVC,aAAa,EACbC,KAAK,EACLC,UAAU,EACVC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,SAAS,EACTC,KAAK,EACLC,KAAK,EACLC,KAAK,EACN,GAAGpB;IAEJ,MAAM,EAAEqB,IAAI,EAAEC,CAAC,EAAE,GAAG1B;IAEpB,MAAM,CAAC2B,SAASC,WAAW,GAAGjC,SAASkC;IACvC,MAAM,CAACC,aAAaC,eAAe,GAAGpC,SAAS;IAC/C,MAAM,CAACqC,gBAAgB,GAAGrC,SAAS;QA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B,aAAaA;YAAc,GAAIM,cAAc,CAAC,CAAC;0BAC3D,oBAACrB;YACCgB,aAAaA;YACbO,OAAOA;YACPK,UAAUA;YACT,GAAIJ,cAAc,CAAC,CAAC;YAEtBL,YAAY6C,wBACX,oBAAC/D,MAAMoE,QAAQ,QACZjC,WAAW,CAACG,6BACX,oBAAChC;YACCuC,gBAAgBnB;YAChBiC,KAAKxB;YACLkC,cACE5C,WACIY,YACA;gBACEb,SAAS;YACX;YAEN8C,cAAcpD,WAAW6C,MAAM;YAGlC,AAAC,CAAA,CAAC5B,WAAWG,WAAU,mBACtB,oBAAC0B;YAAI/C,WAAW,CAAC,EAAEP,UAAU,MAAM,CAAC;yBAClC,oBAACsD;YAAI/C,WAAW,CAAC,EAAEP,UAAU,SAAS,CAAC;yBACrC,oBAACiC;YAAsB1B,WAAW,CAAC,EAAEP,UAAU,SAAS,CAAC;YAAE6D,UAAU9C;yBACnE,oBAACrB;YAAOoE,aAAY;YAAYD,UAAU9C;YAAUgD,IAAG;WACpDvC,EAAE,yBAAyB;YAC1BZ,OAAO1B,eAAesB,WAAWwD,MAAM,CAACC,QAAQ,EAAE1C;QACpD,oBAGJ,oBAACc;YAAkB9B,WAAW,CAAC,EAAEP,UAAU,SAAS,CAAC;YAAE6D,UAAU9C;yBAC/D,oBAACrB;YAAOoE,aAAY;YAAYD,UAAU9C;YAAUgD,IAAG;WACpDvC,EAAE,kCAMZrB,sBAAsBwB,YACrBxB,kCAEA,oBAAChB,kBAAsBsB,oBAAoB,CAAC,KAIjD,CAACM,0BAAY,oBAACiB;YAAee,QAAQA;YACrC,CAAChC,0BAAY,oBAACqB;YAAWc,UAAUA;;IAG1C;IAEA,OAAO;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/fields/Upload/Input.tsx"],"sourcesContent":["'use client'\n\nimport type { ClientCollectionConfig, FilterOptionsResult, UploadField } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { DocumentDrawerProps } from '../../elements/DocumentDrawer/types.js'\nimport type { ListDrawerProps } from '../../elements/ListDrawer/types.js'\nimport type { UploadFieldProps } from './types.js'\n\nimport { Button } from '../../elements/Button/index.js'\nimport { useDocumentDrawer } from '../../elements/DocumentDrawer/index.js'\nimport { FileDetails } from '../../elements/FileDetails/index.js'\nimport { useListDrawer } from '../../elements/ListDrawer/index.js'\nimport { FieldDescription } from '../../forms/FieldDescription/index.js'\nimport { FieldError } from '../../forms/FieldError/index.js'\nimport { FieldLabel } from '../../forms/FieldLabel/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nconst baseClass = 'upload'\n\nexport type UploadInputProps = Omit<UploadFieldProps, 'filterOptions'> & {\n api?: string\n collection?: ClientCollectionConfig\n filterOptions?: FilterOptionsResult\n onChange?: (e) => void\n relationTo?: UploadField['relationTo']\n serverURL?: string\n showError?: boolean\n value?: string\n}\n\nexport const UploadInput: React.FC<UploadInputProps> = (props) => {\n const {\n CustomDescription,\n CustomError,\n CustomLabel,\n api = '/api',\n className,\n collection,\n descriptionProps,\n errorProps,\n filterOptions,\n label,\n labelProps,\n onChange,\n readOnly,\n relationTo,\n required,\n serverURL,\n showError,\n style,\n value,\n width,\n } = props\n\n const { i18n, t } = useTranslation()\n\n const [fileDoc, setFileDoc] = useState(undefined)\n const [missingFile, setMissingFile] = useState(false)\n const [collectionSlugs] = useState([collection?.slug])\n\n const [DocumentDrawer, DocumentDrawerToggler, { closeDrawer }] = useDocumentDrawer({\n collectionSlug: collectionSlugs[0],\n })\n\n const [ListDrawer, ListDrawerToggler, { closeDrawer: closeListDrawer }] = useListDrawer({\n collectionSlugs,\n filterOptions,\n })\n\n useEffect(() => {\n if (value !== null && typeof value !== 'undefined' && value !== '') {\n const fetchFile = async () => {\n const response = await fetch(`${serverURL}${api}/${relationTo}/${value}`, {\n credentials: 'include',\n headers: {\n 'Accept-Language': i18n.language,\n },\n })\n if (response.ok) {\n const json = await response.json()\n setFileDoc(json)\n } else {\n setMissingFile(true)\n setFileDoc(undefined)\n }\n }\n\n void fetchFile()\n } else {\n setFileDoc(undefined)\n }\n }, [value, relationTo, api, serverURL, i18n])\n\n const onSave = useCallback<DocumentDrawerProps['onSave']>(\n (args) => {\n setMissingFile(false)\n onChange(args.doc)\n closeDrawer()\n },\n [onChange, closeDrawer],\n )\n\n const onSelect = useCallback<ListDrawerProps['onSelect']>(\n (args) => {\n setMissingFile(false)\n onChange({\n id: args.docID,\n })\n closeListDrawer()\n },\n [onChange, closeListDrawer],\n )\n\n if (collection.upload) {\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && 'error',\n readOnly && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldError CustomError={CustomError} {...(errorProps || {})} />\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n {collection?.upload && (\n <React.Fragment>\n {fileDoc && !missingFile && (\n <FileDetails\n collectionSlug={relationTo}\n doc={fileDoc}\n handleRemove={\n readOnly\n ? undefined\n : () => {\n onChange(null)\n }\n }\n uploadConfig={collection.upload}\n />\n )}\n {(!fileDoc || missingFile) && (\n <div className={`${baseClass}__wrap`}>\n <div className={`${baseClass}__buttons`}>\n <DocumentDrawerToggler className={`${baseClass}__toggler`} disabled={readOnly}>\n <Button buttonStyle=\"secondary\" disabled={readOnly} el=\"div\">\n {t('fields:uploadNewLabel', {\n label: getTranslation(collection.labels.singular, i18n),\n })}\n </Button>\n </DocumentDrawerToggler>\n <ListDrawerToggler className={`${baseClass}__toggler`} disabled={readOnly}>\n <Button buttonStyle=\"secondary\" disabled={readOnly} el=\"div\">\n {t('fields:chooseFromExisting')}\n </Button>\n </ListDrawerToggler>\n </div>\n </div>\n )}\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </React.Fragment>\n )}\n {!readOnly && <DocumentDrawer onSave={onSave} />}\n {!readOnly && <ListDrawer onSelect={onSelect} />}\n </div>\n )\n }\n\n return null\n}\n"],"names":["getTranslation","React","useCallback","useEffect","useState","Button","useDocumentDrawer","FileDetails","useListDrawer","FieldDescription","FieldError","FieldLabel","useTranslation","fieldBaseClass","baseClass","UploadInput","props","CustomDescription","CustomError","CustomLabel","api","className","collection","descriptionProps","errorProps","filterOptions","label","labelProps","onChange","readOnly","relationTo","required","serverURL","showError","style","value","width","i18n","t","fileDoc","setFileDoc","undefined","missingFile","setMissingFile","collectionSlugs","slug","DocumentDrawer","DocumentDrawerToggler","closeDrawer","collectionSlug","ListDrawer","ListDrawerToggler","closeListDrawer","fetchFile","response","fetch","credentials","headers","language","ok","json","onSave","args","doc","onSelect","id","docID","upload","div","filter","Boolean","join","Fragment","handleRemove","uploadConfig","disabled","buttonStyle","el","labels","singular"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAM/D,SAASC,MAAM,QAAQ,iCAAgC;AACvD,SAASC,iBAAiB,QAAQ,yCAAwC;AAC1E,SAASC,WAAW,QAAQ,sCAAqC;AACjE,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,gBAAgB,QAAQ,wCAAuC;AACxE,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,qBAAoB;AAGnD,MAAMC,YAAY;AAalB,OAAO,MAAMC,cAA0C,CAACC;IACtD,MAAM,EACJC,i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AS,CAAC;YAAE6D,UAAU9C;yBAC/D,oBAACxB;YAAOuE,aAAY;YAAYD,UAAU9C;YAAUgD,IAAG;WACpDvC,EAAE,kCAMZrB,sBAAsBwB,YACrBxB,kCAEA,oBAACR,kBAAsBc,oBAAoB,CAAC,KAIjD,CAACM,0BAAY,oBAACiB;YAAee,QAAQA;YACrC,CAAChC,0BAAY,oBAACqB;YAAWc,UAAUA;;IAG1C;IAEA,OAAO;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Upload/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAIlD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,cAAc,CAAA;AAErB,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAA;AACxC,YAAY,EAAE,gBAAgB,EAAE,CAAA;AAqFhC,eAAO,MAAM,MAAM,4BAAyB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Upload/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAMlD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,cAAc,CAAA;AAErB,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAA;AACxC,YAAY,EAAE,gBAAgB,EAAE,CAAA;AAqFhC,eAAO,MAAM,MAAM,4BAAyB,CAAA"}
@@ -1,8 +1,8 @@
1
1
  'use client';
2
- import { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider';
3
- import { withCondition } from '@payloadcms/ui/forms/withCondition';
4
2
  import React, { useCallback } from 'react';
3
+ import { useFieldProps } from '../../forms/FieldPropsProvider/index.js';
5
4
  import { useField } from '../../forms/useField/index.js';
5
+ import { withCondition } from '../../forms/withCondition/index.js';
6
6
  import { useConfig } from '../../providers/Config/index.js';
7
7
  import { UploadInput } from './Input.js';
8
8
  export { UploadInput };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/Upload/index.tsx"],"sourcesContent":["'use client'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { withCondition } from '@payloadcms/ui/forms/withCondition'\nimport React, { useCallback } from 'react'\n\nimport type { UploadInputProps } from './Input.js'\nimport type { UploadFieldProps } from './types.js'\n\nimport { useField } from '../../forms/useField/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 const readOnly = readOnlyFromProps || readOnlyFromContext\n\n const { filterOptions, path, setValue, showError, value } = useField<string>({\n path: pathFromContext || pathFromProps,\n validate: memoizedValidate,\n })\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={readOnly}\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":["useFieldProps","withCondition","React","useCallback","useField","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","setValue","showError","onChange","incomingValue","incomingID","id","upload","Upload"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,SAASA,aAAa,QAAQ,0CAAyC;AACvE,SAASC,aAAa,QAAQ,qCAAoC;AAClE,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,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,SAAS,EACTC,gBAAgB,EAChBC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,MAAMC,aAAa,EACnBC,UAAUC,iBAAiB,EAC3BC,UAAU,EACVC,QAAQ,EACRC,KAAK,EACLC,QAAQ,EACRC,KAAK,EACN,GAAGjB;IAEJ,MAAM,EACJkB,WAAW,EACXC,QAAQ,EAAEC,GAAG,EAAE,EACfC,SAAS,EACV,GAAGxB;IAEJ,MAAMyB,aAAaJ,YAAYK,IAAI,CAAC,CAACC,OAASA,KAAKC,IAAI,KAAKZ;IAE5D,MAAMa,mBAAmB/B,YACvB,CAACgC,OAAOC;QACN,IAAI,OAAOZ,aAAa,YAAY;YAClC,OAAOA,SAASW,OAAO;gBAAE,GAAGC,OAAO;gBAAEd;YAAS;QAChD;IACF,GACA;QAACE;QAAUF;KAAS;IAGtB,MAAM,EAAEL,MAAMoB,eAAe,EAAElB,UAAUmB,mBAAmB,EAAE,GAAGtC;IACjE,MAAMmB,WAAWC,qBAAqBkB;IAEtC,MAAM,EAAEC,aAAa,EAAEtB,IAAI,EAAEuB,QAAQ,EAAEC,SAAS,EAAEN,KAAK,EAAE,GAAG/B,SAAiB;QAC3Ea,MAAMoB,mBAAmBnB;QACzBM,UAAUU;IACZ;IAEA,MAAMQ,WAAWvC,YACf,CAACwC;QACC,MAAMC,aAAaD,eAAeE,MAAMF;QACxCH,SAASI;IACX,GACA;QAACJ;KAAS;IAGZ,IAAIV,WAAWgB,MAAM,EAAE;QACrB,qBACE,oBAACxC;YACCG,mBAAmBA;YACnBC,aAAaA;YACbC,aAAaA;YACbiB,KAAKA;YACLhB,WAAWA;YACXkB,YAAYA;YACZjB,kBAAkBA;YAClBC,YAAYA;YACZyB,eAAeA;YACfxB,OAAOA;YACPC,YAAYA;YACZ0B,UAAUA;YACVzB,MAAMA;YACNE,UAAUA;YACVE,YAAYA;YACZC,UAAUA;YACVO,WAAWA;YACXY,WAAWA;YACXlB,OAAOA;YACPY,OAAOA;YACPV,OAAOA;;IAGb;IAEA,OAAO;AACT;AAEA,OAAO,MAAMsB,SAAS9C,cAAcM,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 const readOnly = readOnlyFromProps || readOnlyFromContext\n\n const { filterOptions, path, setValue, showError, value } = useField<string>({\n path: pathFromContext || pathFromProps,\n validate: memoizedValidate,\n })\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={readOnly}\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","setValue","showError","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,SAAS,EACTC,gBAAgB,EAChBC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,MAAMC,aAAa,EACnBC,UAAUC,iBAAiB,EAC3BC,UAAU,EACVC,QAAQ,EACRC,KAAK,EACLC,QAAQ,EACRC,KAAK,EACN,GAAGjB;IAEJ,MAAM,EACJkB,WAAW,EACXC,QAAQ,EAAEC,GAAG,EAAE,EACfC,SAAS,EACV,GAAGxB;IAEJ,MAAMyB,aAAaJ,YAAYK,IAAI,CAAC,CAACC,OAASA,KAAKC,IAAI,KAAKZ;IAE5D,MAAMa,mBAAmBjC,YACvB,CAACkC,OAAOC;QACN,IAAI,OAAOZ,aAAa,YAAY;YAClC,OAAOA,SAASW,OAAO;gBAAE,GAAGC,OAAO;gBAAEd;YAAS;QAChD;IACF,GACA;QAACE;QAAUF;KAAS;IAGtB,MAAM,EAAEL,MAAMoB,eAAe,EAAElB,UAAUmB,mBAAmB,EAAE,GAAGpC;IACjE,MAAMiB,WAAWC,qBAAqBkB;IAEtC,MAAM,EAAEC,aAAa,EAAEtB,IAAI,EAAEuB,QAAQ,EAAEC,SAAS,EAAEN,KAAK,EAAE,GAAGhC,SAAiB;QAC3Ec,MAAMoB,mBAAmBnB;QACzBM,UAAUU;IACZ;IAEA,MAAMQ,WAAWzC,YACf,CAAC0C;QACC,MAAMC,aAAaD,eAAeE,MAAMF;QACxCH,SAASI;IACX,GACA;QAACJ;KAAS;IAGZ,IAAIV,WAAWgB,MAAM,EAAE;QACrB,qBACE,oBAACxC;YACCG,mBAAmBA;YACnBC,aAAaA;YACbC,aAAaA;YACbiB,KAAKA;YACLhB,WAAWA;YACXkB,YAAYA;YACZjB,kBAAkBA;YAClBC,YAAYA;YACZyB,eAAeA;YACfxB,OAAOA;YACPC,YAAYA;YACZ0B,UAAUA;YACVzB,MAAMA;YACNE,UAAUA;YACVE,YAAYA;YACZC,UAAUA;YACVO,WAAWA;YACXY,WAAWA;YACXlB,OAAOA;YACPY,OAAOA;YACPV,OAAOA;;IAGb;IAEA,OAAO;AACT;AAEA,OAAO,MAAMsB,SAAS3C,cAAcG,SAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/forms/FieldLabel/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAI/C,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,cAAc,CAAA;AA8BrB,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAQ3C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/forms/FieldLabel/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAG/C,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,cAAc,CAAA;AA8BrB,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAQ3C,CAAA"}
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { getTranslation } from '@payloadcms/translations';
3
- import { useEditDepth } from '@payloadcms/ui/providers/EditDepth';
4
3
  import React from 'react';
4
+ import { useEditDepth } from '../../providers/EditDepth/index.js';
5
5
  import { useTranslation } from '../../providers/Translation/index.js';
6
6
  import { generateFieldID } from '../../utilities/generateFieldID.js';
7
7
  import { useFieldProps } from '../FieldPropsProvider/index.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/forms/FieldLabel/index.tsx"],"sourcesContent":["'use client'\n\nimport type { LabelProps } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { useEditDepth } from '@payloadcms/ui/providers/EditDepth'\nimport React from 'react'\n\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { generateFieldID } from '../../utilities/generateFieldID.js'\nimport { useFieldProps } from '../FieldPropsProvider/index.js'\nimport { useForm } from '../Form/context.js'\nimport './index.scss'\n\nconst DefaultFieldLabel: React.FC<LabelProps> = (props) => {\n const {\n as: Element = 'label',\n htmlFor: htmlForFromProps,\n label: labelFromProps,\n required = false,\n unstyled = false,\n } = props\n\n const { uuid } = useForm()\n const { path } = useFieldProps()\n const editDepth = useEditDepth()\n const htmlFor = htmlForFromProps || generateFieldID(path, editDepth, uuid)\n\n const { i18n } = useTranslation()\n\n if (labelFromProps) {\n return (\n <Element className={`field-label ${unstyled ? 'unstyled' : ''}`} htmlFor={htmlFor}>\n {getTranslation(labelFromProps, i18n)}\n {required && !unstyled && <span className=\"required\">*</span>}\n </Element>\n )\n }\n\n return null\n}\n\nexport const FieldLabel: React.FC<LabelProps> = (props) => {\n const { CustomLabel } = props\n\n if (CustomLabel !== undefined) {\n return CustomLabel\n }\n\n return <DefaultFieldLabel {...props} />\n}\n"],"names":["getTranslation","useEditDepth","React","useTranslation","generateFieldID","useFieldProps","useForm","DefaultFieldLabel","props","as","Element","htmlFor","htmlForFromProps","label","labelFromProps","required","unstyled","uuid","path","editDepth","i18n","className","span","FieldLabel","CustomLabel","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SAASC,YAAY,QAAQ,qCAAoC;AACjE,OAAOC,WAAW,QAAO;AAEzB,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,OAAO,QAAQ,qBAAoB;AAG5C,MAAMC,oBAA0C,CAACC;IAC/C,MAAM,EACJC,IAAIC,UAAU,OAAO,EACrBC,SAASC,gBAAgB,EACzBC,OAAOC,cAAc,EACrBC,WAAW,KAAK,EAChBC,WAAW,KAAK,EACjB,GAAGR;IAEJ,MAAM,EAAES,IAAI,EAAE,GAAGX;IACjB,MAAM,EAAEY,IAAI,EAAE,GAAGb;IACjB,MAAMc,YAAYlB;IAClB,MAAMU,UAAUC,oBAAoBR,gBAAgBc,MAAMC,WAAWF;IAErE,MAAM,EAAEG,IAAI,EAAE,GAAGjB;IAEjB,IAAIW,gBAAgB;QAClB,qBACE,oBAACJ;YAAQW,WAAW,CAAC,YAAY,EAAEL,WAAW,aAAa,GAAG,CAAC;YAAEL,SAASA;WACvEX,eAAec,gBAAgBM,OAC/BL,YAAY,CAACC,0BAAY,oBAACM;YAAKD,WAAU;WAAW;IAG3D;IAEA,OAAO;AACT;AAEA,OAAO,MAAME,aAAmC,CAACf;IAC/C,MAAM,EAAEgB,WAAW,EAAE,GAAGhB;IAExB,IAAIgB,gBAAgBC,WAAW;QAC7B,OAAOD;IACT;IAEA,qBAAO,oBAACjB,mBAAsBC;AAChC,EAAC"}
1
+ {"version":3,"sources":["../../../src/forms/FieldLabel/index.tsx"],"sourcesContent":["'use client'\n\nimport type { LabelProps } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport { useEditDepth } from '../../providers/EditDepth/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { generateFieldID } from '../../utilities/generateFieldID.js'\nimport { useFieldProps } from '../FieldPropsProvider/index.js'\nimport { useForm } from '../Form/context.js'\nimport './index.scss'\n\nconst DefaultFieldLabel: React.FC<LabelProps> = (props) => {\n const {\n as: Element = 'label',\n htmlFor: htmlForFromProps,\n label: labelFromProps,\n required = false,\n unstyled = false,\n } = props\n\n const { uuid } = useForm()\n const { path } = useFieldProps()\n const editDepth = useEditDepth()\n const htmlFor = htmlForFromProps || generateFieldID(path, editDepth, uuid)\n\n const { i18n } = useTranslation()\n\n if (labelFromProps) {\n return (\n <Element className={`field-label ${unstyled ? 'unstyled' : ''}`} htmlFor={htmlFor}>\n {getTranslation(labelFromProps, i18n)}\n {required && !unstyled && <span className=\"required\">*</span>}\n </Element>\n )\n }\n\n return null\n}\n\nexport const FieldLabel: React.FC<LabelProps> = (props) => {\n const { CustomLabel } = props\n\n if (CustomLabel !== undefined) {\n return CustomLabel\n }\n\n return <DefaultFieldLabel {...props} />\n}\n"],"names":["getTranslation","React","useEditDepth","useTranslation","generateFieldID","useFieldProps","useForm","DefaultFieldLabel","props","as","Element","htmlFor","htmlForFromProps","label","labelFromProps","required","unstyled","uuid","path","editDepth","i18n","className","span","FieldLabel","CustomLabel","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,WAAW,QAAO;AAEzB,SAASC,YAAY,QAAQ,qCAAoC;AACjE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,OAAO,QAAQ,qBAAoB;AAG5C,MAAMC,oBAA0C,CAACC;IAC/C,MAAM,EACJC,IAAIC,UAAU,OAAO,EACrBC,SAASC,gBAAgB,EACzBC,OAAOC,cAAc,EACrBC,WAAW,KAAK,EAChBC,WAAW,KAAK,EACjB,GAAGR;IAEJ,MAAM,EAAES,IAAI,EAAE,GAAGX;IACjB,MAAM,EAAEY,IAAI,EAAE,GAAGb;IACjB,MAAMc,YAAYjB;IAClB,MAAMS,UAAUC,oBAAoBR,gBAAgBc,MAAMC,WAAWF;IAErE,MAAM,EAAEG,IAAI,EAAE,GAAGjB;IAEjB,IAAIW,gBAAgB;QAClB,qBACE,oBAACJ;YAAQW,WAAW,CAAC,YAAY,EAAEL,WAAW,aAAa,GAAG,CAAC;YAAEL,SAASA;WACvEX,eAAec,gBAAgBM,OAC/BL,YAAY,CAACC,0BAAY,oBAACM;YAAKD,WAAU;WAAW;IAG3D;IAEA,OAAO;AACT;AAEA,OAAO,MAAME,aAAmC,CAACf;IAC/C,MAAM,EAAEgB,WAAW,EAAE,GAAGhB;IAExB,IAAIgB,gBAAgBC,WAAW;QAC7B,OAAOD;IACT;IAEA,qBAAO,oBAACjB,mBAAsBC;AAChC,EAAC"}
@@ -1,4 +1,4 @@
1
- import { arraysHaveSameStrings } from '@payloadcms/ui/utilities/arraysHaveSameStrings';
1
+ import { arraysHaveSameStrings } from '../../utilities/arraysHaveSameStrings.js';
2
2
  export const mergeErrorPaths = (existing, incoming)=>{
3
3
  if (!existing) {
4
4
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/forms/Form/mergeErrorPaths.ts"],"sourcesContent":["import { arraysHaveSameStrings } from '@payloadcms/ui/utilities/arraysHaveSameStrings'\n\nexport const mergeErrorPaths = (\n existing?: string[],\n incoming?: string[],\n): {\n changed: boolean\n result?: string[]\n} => {\n if (!existing) {\n return {\n changed: false,\n result: undefined,\n }\n }\n\n const existingErrorPaths: string[] = []\n const incomingErrorPaths: string[] = []\n\n if (Array.isArray(incoming) && incoming?.length) {\n incoming.forEach((path) => incomingErrorPaths.push(path))\n }\n\n if (Array.isArray(existing) && existing?.length) {\n existing.forEach((path) => existingErrorPaths.push(path))\n }\n\n if (!arraysHaveSameStrings(existingErrorPaths, incomingErrorPaths)) {\n return {\n changed: true,\n result: incomingErrorPaths,\n }\n }\n return {\n changed: false,\n result: existing,\n }\n}\n"],"names":["arraysHaveSameStrings","mergeErrorPaths","existing","incoming","changed","result","undefined","existingErrorPaths","incomingErrorPaths","Array","isArray","length","forEach","path","push"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,qBAAqB,QAAQ,iDAAgD;AAEtF,OAAO,MAAMC,kBAAkB,CAC7BC,UACAC;IAKA,IAAI,CAACD,UAAU;QACb,OAAO;YACLE,SAAS;YACTC,QAAQC;QACV;IACF;IAEA,MAAMC,qBAA+B,EAAE;IACvC,MAAMC,qBAA+B,EAAE;IAEvC,IAAIC,MAAMC,OAAO,CAACP,aAAaA,UAAUQ,QAAQ;QAC/CR,SAASS,OAAO,CAAC,CAACC,OAASL,mBAAmBM,IAAI,CAACD;IACrD;IAEA,IAAIJ,MAAMC,OAAO,CAACR,aAAaA,UAAUS,QAAQ;QAC/CT,SAASU,OAAO,CAAC,CAACC,OAASN,mBAAmBO,IAAI,CAACD;IACrD;IAEA,IAAI,CAACb,sBAAsBO,oBAAoBC,qBAAqB;QAClE,OAAO;YACLJ,SAAS;YACTC,QAAQG;QACV;IACF;IACA,OAAO;QACLJ,SAAS;QACTC,QAAQH;IACV;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/forms/Form/mergeErrorPaths.ts"],"sourcesContent":["import { arraysHaveSameStrings } from '../../utilities/arraysHaveSameStrings.js'\n\nexport const mergeErrorPaths = (\n existing?: string[],\n incoming?: string[],\n): {\n changed: boolean\n result?: string[]\n} => {\n if (!existing) {\n return {\n changed: false,\n result: undefined,\n }\n }\n\n const existingErrorPaths: string[] = []\n const incomingErrorPaths: string[] = []\n\n if (Array.isArray(incoming) && incoming?.length) {\n incoming.forEach((path) => incomingErrorPaths.push(path))\n }\n\n if (Array.isArray(existing) && existing?.length) {\n existing.forEach((path) => existingErrorPaths.push(path))\n }\n\n if (!arraysHaveSameStrings(existingErrorPaths, incomingErrorPaths)) {\n return {\n changed: true,\n result: incomingErrorPaths,\n }\n }\n return {\n changed: false,\n result: existing,\n }\n}\n"],"names":["arraysHaveSameStrings","mergeErrorPaths","existing","incoming","changed","result","undefined","existingErrorPaths","incomingErrorPaths","Array","isArray","length","forEach","path","push"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,qBAAqB,QAAQ,2CAA0C;AAEhF,OAAO,MAAMC,kBAAkB,CAC7BC,UACAC;IAKA,IAAI,CAACD,UAAU;QACb,OAAO;YACLE,SAAS;YACTC,QAAQC;QACV;IACF;IAEA,MAAMC,qBAA+B,EAAE;IACvC,MAAMC,qBAA+B,EAAE;IAEvC,IAAIC,MAAMC,OAAO,CAACP,aAAaA,UAAUQ,QAAQ;QAC/CR,SAASS,OAAO,CAAC,CAACC,OAASL,mBAAmBM,IAAI,CAACD;IACrD;IAEA,IAAIJ,MAAMC,OAAO,CAACR,aAAaA,UAAUS,QAAQ;QAC/CT,SAASU,OAAO,CAAC,CAACC,OAASN,mBAAmBO,IAAI,CAACD;IACrD;IAEA,IAAI,CAACb,sBAAsBO,oBAAoBC,qBAAqB;QAClE,OAAO;YACLJ,SAAS;YACTC,QAAQG;QACV;IACF;IACA,OAAO;QACLJ,SAAS;QACTC,QAAQH;IACV;AACF,EAAC"}
@@ -1,10 +1,10 @@
1
- import type { I18n } from '@payloadcms/translations';
1
+ import type { I18nClient } from '@payloadcms/translations';
2
2
  import type { LabelProps } from 'payload/types';
3
3
  import type React from 'react';
4
4
  export type Props = {
5
5
  RowLabelComponent?: React.ReactNode;
6
6
  className?: string;
7
- i18n: I18n;
7
+ i18n: I18nClient;
8
8
  path: string;
9
9
  rowLabel?: LabelProps['label'];
10
10
  rowNumber?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/forms/RowLabel/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,MAAM,KAAK,GAAG;IAClB,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACnC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,IAAI,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/forms/RowLabel/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,MAAM,KAAK,GAAG;IAClB,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACnC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,UAAU,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/forms/RowLabel/types.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { LabelProps } from 'payload/types'\nimport type React from 'react'\n\nexport type Props = {\n RowLabelComponent?: React.ReactNode\n className?: string\n i18n: I18n\n path: string\n rowLabel?: LabelProps['label']\n rowNumber?: number\n}\n"],"names":[],"rangeMappings":"","mappings":"AAIA,WAOC"}
1
+ {"version":3,"sources":["../../../src/forms/RowLabel/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { LabelProps } from 'payload/types'\nimport type React from 'react'\n\nexport type Props = {\n RowLabelComponent?: React.ReactNode\n className?: string\n i18n: I18nClient\n path: string\n rowLabel?: LabelProps['label']\n rowNumber?: number\n}\n"],"names":[],"rangeMappings":"","mappings":"AAIA,WAOC"}
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- export { DefaultAccountIcon } from './Default/index.js';
3
2
  export { GravatarAccountIcon } from './Gravatar/index.js';
4
3
  export declare const Account: () => React.JSX.Element;
5
4
  //# 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,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEzD,eAAO,MAAM,OAAO,yBAcnB,CAAA"}
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"}
@@ -4,24 +4,15 @@ import React from 'react';
4
4
  import { useAuth } from '../../providers/Auth/index.js';
5
5
  import { useConfig } from '../../providers/Config/index.js';
6
6
  import { DefaultAccountIcon } from './Default/index.js';
7
- export { DefaultAccountIcon } from './Default/index.js';
8
- import { GravatarAccountIcon } from './Gravatar/index.js';
9
7
  export { GravatarAccountIcon } from './Gravatar/index.js';
10
8
  export const Account = ()=>{
11
- const { admin: { avatar: Avatar }, routes: { admin: adminRoute } } = useConfig();
9
+ const { admin: { avatar: Avatar }, admin: { routes: { account: accountRoute } }, routes: { admin: adminRoute } } = useConfig();
12
10
  const { user } = useAuth();
13
11
  const pathname = usePathname();
14
- const isOnAccountPage = pathname === `${adminRoute}/account`;
12
+ const isOnAccountPage = pathname === `${adminRoute}${accountRoute}`;
15
13
  if (!user?.email || Avatar === 'default') return /*#__PURE__*/ React.createElement(DefaultAccountIcon, {
16
14
  active: isOnAccountPage
17
15
  });
18
- if (Avatar === 'gravatar') return /*#__PURE__*/ React.createElement(GravatarAccountIcon, null);
19
- if (Avatar) return /*#__PURE__*/ React.createElement(Avatar, {
20
- active: isOnAccountPage
21
- });
22
- return /*#__PURE__*/ React.createElement(DefaultAccountIcon, {
23
- active: isOnAccountPage
24
- });
25
16
  };
26
17
 
27
18
  //# 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 { DefaultAccountIcon } from './Default/index.js'\nimport { GravatarAccountIcon } from './Gravatar/index.js'\nexport { GravatarAccountIcon } from './Gravatar/index.js'\n\nexport const Account = () => {\n const {\n admin: { avatar: Avatar },\n routes: { admin: adminRoute },\n } = useConfig()\n const { user } = useAuth()\n const pathname = usePathname()\n\n const isOnAccountPage = pathname === `${adminRoute}/account`\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 return <DefaultAccountIcon active={isOnAccountPage} />\n}\n"],"names":["usePathname","React","useAuth","useConfig","DefaultAccountIcon","GravatarAccountIcon","Account","admin","avatar","Avatar","routes","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,SAASA,kBAAkB,QAAQ,qBAAoB;AACvD,SAASC,mBAAmB,QAAQ,sBAAqB;AACzD,SAASA,mBAAmB,QAAQ,sBAAqB;AAEzD,OAAO,MAAMC,UAAU;IACrB,MAAM,EACJC,OAAO,EAAEC,QAAQC,MAAM,EAAE,EACzBC,QAAQ,EAAEH,OAAOI,UAAU,EAAE,EAC9B,GAAGR;IACJ,MAAM,EAAES,IAAI,EAAE,GAAGV;IACjB,MAAMW,WAAWb;IAEjB,MAAMc,kBAAkBD,aAAa,CAAC,EAAEF,WAAW,QAAQ,CAAC;IAE5D,IAAI,CAACC,MAAMG,SAASN,WAAW,WAAW,qBAAO,oBAACL;QAAmBY,QAAQF;;IAC7E,IAAIL,WAAW,YAAY,qBAAO,oBAACJ;IACnC,IAAII,QAAQ,qBAAO,oBAACA;QAAOO,QAAQF;;IACnC,qBAAO,oBAACV;QAAmBY,QAAQF;;AACrC,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'\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,oBAACL;QAAmBc,QAAQF;;AAC/E,EAAC"}
@@ -1,6 +1,4 @@
1
- import type { SanitizedConfig } from 'payload/config';
1
+ import type { ServerProps } from 'payload/config';
2
2
  import React from 'react';
3
- export declare const Logo: React.FC<{
4
- config: SanitizedConfig;
5
- }>;
3
+ export declare const Logo: React.FC<ServerProps>;
6
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/graphics/Logo/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAErD,OAAO,KAAK,MAAM,OAAO,CAAA;AAgCzB,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;IAC1B,MAAM,EAAE,eAAe,CAAA;CACxB,CAcA,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/graphics/Logo/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,KAAK,MAAM,OAAO,CAAA;AAgCzB,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA4BtC,CAAA"}
@@ -32,13 +32,22 @@ const PayloadLogo = ()=>/*#__PURE__*/ React.createElement("svg", {
32
32
  d: "M17.4097 48.5454V28.1035L0.132324 38.1301L17.4097 48.5454Z"
33
33
  }));
34
34
  export const Logo = (props)=>{
35
- const { config } = props;
35
+ const { i18n, locale, params, payload, permissions, searchParams, user } = props;
36
36
  const { admin: { components: { graphics: { Logo: CustomLogo } = {
37
37
  Logo: undefined
38
- } } = {} } = {} } = config;
38
+ } } = {} } = {} } = payload.config;
39
39
  return /*#__PURE__*/ React.createElement(RenderCustomComponent, {
40
40
  CustomComponent: CustomLogo,
41
- DefaultComponent: PayloadLogo
41
+ DefaultComponent: PayloadLogo,
42
+ serverOnlyProps: {
43
+ i18n,
44
+ locale,
45
+ params,
46
+ payload,
47
+ permissions,
48
+ searchParams,
49
+ user
50
+ }
42
51
  });
43
52
  };
44
53
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/graphics/Logo/index.tsx"],"sourcesContent":["import type { SanitizedConfig } from 'payload/config'\n\nimport React from 'react'\n\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\n\nconst css = `\n .graphic-logo path {\n fill: var(--theme-elevation-1000);\n }\n`\n\nconst PayloadLogo: React.FC = () => (\n <svg\n className=\"graphic-logo\"\n fill=\"none\"\n height=\"50\"\n viewBox=\"0 0 180 50\"\n width=\"180\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <style>{css}</style>\n <path d=\"M65.922 13.8685C71.1075 13.8685 77.0257 14.6014 77.0257 22.2185C77.0257 28.6587 71.8736 30.2243 66.0664 30.2243H62.2689V39.0961H57.2944V13.8685H65.922ZM62.2689 17.7659V26.3602H66.3773C69.4752 26.3602 71.9069 25.594 71.9069 22.2518C71.9069 18.1101 68.7424 17.7659 66.022 17.7659H62.2689Z\" />\n <path d=\"M84.3209 39.5514C80.7344 39.5514 77.5698 37.4639 77.5698 34.0884C77.5698 29.6358 82.5443 28.3145 89.8949 27.4706V27.1264C89.8949 24.2394 88.3626 23.2623 86.3084 23.2623C84.2542 23.2623 82.7219 24.2394 82.622 26.2936H78.1361C78.4803 22.6072 81.7226 19.8867 86.4861 19.8867C91.1163 19.8867 94.7028 21.7633 94.7028 28.1035C94.7028 28.692 94.6362 31.2014 94.6362 32.9114C94.6362 35.865 94.8472 37.5416 95.1914 39.1073H90.7721C90.6278 38.5188 90.4945 37.6083 90.4279 36.7089C89.0844 38.6853 87.1412 39.5514 84.3209 39.5514ZM90.0282 30.5463C84.6651 31.1015 82.511 31.7344 82.511 33.8219C82.511 35.1766 83.588 36.298 85.7532 36.298C88.7512 36.298 90.0393 34.5547 90.0393 31.4901V30.5463H90.0282Z\" />\n <path d=\"M97.2899 45.1921V41.5057H99.0998C100.699 41.5057 101.432 41.539 102.231 39.5514L102.442 39.0295L95.269 20.3753H100.521L104.763 33.8774L109.115 20.3753H113.99L107.139 38.541C104.951 44.3593 103.974 45.1921 99.3108 45.1921H97.2899Z\" />\n <path d=\"M120.263 39.1073H115.456V13.8685H120.263V39.1073Z\" />\n <path d=\"M122.406 29.7801C122.406 23.2067 126.826 19.9645 131.7 19.9645C136.575 19.9645 140.994 23.2067 140.994 29.7801C140.994 36.3535 136.575 39.5625 131.7 39.5625C126.826 39.5514 122.406 36.3535 122.406 29.7801ZM127.281 29.7801C127.281 33.6775 128.913 35.7984 131.7 35.7984C134.487 35.7984 136.119 33.6775 136.119 29.7801C136.119 25.8494 134.487 23.7286 131.7 23.7286C128.913 23.7286 127.281 25.8383 127.281 29.7801Z\" />\n <path d=\"M149.167 39.5514C145.58 39.5514 142.416 37.4639 142.416 34.0884C142.416 29.6358 147.39 28.3145 154.741 27.4706V27.1264C154.741 24.2394 153.208 23.2623 151.154 23.2623C149.1 23.2623 147.568 24.2394 147.468 26.2936H142.982C143.326 22.6072 146.568 19.8867 151.332 19.8867C155.962 19.8867 159.549 21.7633 159.549 28.1035C159.549 28.692 159.482 31.2014 159.482 32.9114C159.482 35.865 159.693 37.5416 160.037 39.1073H155.618C155.473 38.5188 155.34 37.6083 155.274 36.7089C153.941 38.6853 151.987 39.5514 149.167 39.5514ZM154.874 30.5463C149.511 31.1015 147.357 31.7344 147.357 33.8219C147.357 35.1766 148.434 36.298 150.599 36.298C153.597 36.298 154.885 34.5547 154.885 31.4901V30.5463H154.874Z\" />\n <path d=\"M175.06 39.1073V36.7422C173.872 38.7964 171.618 39.5625 169.664 39.5625C165.067 39.5625 161.625 35.7317 161.625 29.7468C161.625 23.8619 165 19.9645 169.664 19.9645C172.029 19.9645 174.05 21.0415 175.06 22.7848V13.8796H179.868V39.1073H175.06ZM175.238 29.7357C175.238 25.9716 173.494 23.6398 170.852 23.6398C168.242 23.6398 166.677 26.1159 166.677 29.7691C166.677 33.4222 168.242 35.865 170.852 35.865C173.494 35.865 175.238 33.5665 175.238 29.7357Z\" />\n <path d=\"M19.1531 0L42.049 13.8019V39.9956L24.8049 50V23.8064L1.89795 10.0155L19.1531 0Z\" />\n <path d=\"M17.4097 48.5454V28.1035L0.132324 38.1301L17.4097 48.5454Z\" />\n </svg>\n)\n\nexport const Logo: React.FC<{\n config: SanitizedConfig\n}> = (props) => {\n const { config } = props\n\n const {\n admin: {\n components: {\n graphics: { Logo: CustomLogo } = {\n Logo: undefined,\n },\n } = {},\n } = {},\n } = config\n\n return <RenderCustomComponent CustomComponent={CustomLogo} DefaultComponent={PayloadLogo} />\n}\n"],"names":["React","RenderCustomComponent","css","PayloadLogo","svg","className","fill","height","viewBox","width","xmlns","style","path","d","Logo","props","config","admin","components","graphics","CustomLogo","undefined","CustomComponent","DefaultComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAOA,WAAW,QAAO;AAEzB,SAASC,qBAAqB,QAAQ,gDAA+C;AAErF,MAAMC,MAAM,CAAC;;;;AAIb,CAAC;AAED,MAAMC,cAAwB,kBAC5B,oBAACC;QACCC,WAAU;QACVC,MAAK;QACLC,QAAO;QACPC,SAAQ;QACRC,OAAM;QACNC,OAAM;qBAEN,oBAACC,eAAOT,oBACR,oBAACU;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;;AAIZ,OAAO,MAAMC,OAER,CAACC;IACJ,MAAM,EAAEC,MAAM,EAAE,GAAGD;IAEnB,MAAM,EACJE,OAAO,EACLC,YAAY,EACVC,UAAU,EAAEL,MAAMM,UAAU,EAAE,GAAG;QAC/BN,MAAMO;IACR,CAAC,EACF,GAAG,CAAC,CAAC,EACP,GAAG,CAAC,CAAC,EACP,GAAGL;IAEJ,qBAAO,oBAACf;QAAsBqB,iBAAiBF;QAAYG,kBAAkBpB;;AAC/E,EAAC"}
1
+ {"version":3,"sources":["../../../src/graphics/Logo/index.tsx"],"sourcesContent":["import type { ServerProps } from 'payload/config'\n\nimport React from 'react'\n\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\n\nconst css = `\n .graphic-logo path {\n fill: var(--theme-elevation-1000);\n }\n`\n\nconst PayloadLogo: React.FC = () => (\n <svg\n className=\"graphic-logo\"\n fill=\"none\"\n height=\"50\"\n viewBox=\"0 0 180 50\"\n width=\"180\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <style>{css}</style>\n <path d=\"M65.922 13.8685C71.1075 13.8685 77.0257 14.6014 77.0257 22.2185C77.0257 28.6587 71.8736 30.2243 66.0664 30.2243H62.2689V39.0961H57.2944V13.8685H65.922ZM62.2689 17.7659V26.3602H66.3773C69.4752 26.3602 71.9069 25.594 71.9069 22.2518C71.9069 18.1101 68.7424 17.7659 66.022 17.7659H62.2689Z\" />\n <path d=\"M84.3209 39.5514C80.7344 39.5514 77.5698 37.4639 77.5698 34.0884C77.5698 29.6358 82.5443 28.3145 89.8949 27.4706V27.1264C89.8949 24.2394 88.3626 23.2623 86.3084 23.2623C84.2542 23.2623 82.7219 24.2394 82.622 26.2936H78.1361C78.4803 22.6072 81.7226 19.8867 86.4861 19.8867C91.1163 19.8867 94.7028 21.7633 94.7028 28.1035C94.7028 28.692 94.6362 31.2014 94.6362 32.9114C94.6362 35.865 94.8472 37.5416 95.1914 39.1073H90.7721C90.6278 38.5188 90.4945 37.6083 90.4279 36.7089C89.0844 38.6853 87.1412 39.5514 84.3209 39.5514ZM90.0282 30.5463C84.6651 31.1015 82.511 31.7344 82.511 33.8219C82.511 35.1766 83.588 36.298 85.7532 36.298C88.7512 36.298 90.0393 34.5547 90.0393 31.4901V30.5463H90.0282Z\" />\n <path d=\"M97.2899 45.1921V41.5057H99.0998C100.699 41.5057 101.432 41.539 102.231 39.5514L102.442 39.0295L95.269 20.3753H100.521L104.763 33.8774L109.115 20.3753H113.99L107.139 38.541C104.951 44.3593 103.974 45.1921 99.3108 45.1921H97.2899Z\" />\n <path d=\"M120.263 39.1073H115.456V13.8685H120.263V39.1073Z\" />\n <path d=\"M122.406 29.7801C122.406 23.2067 126.826 19.9645 131.7 19.9645C136.575 19.9645 140.994 23.2067 140.994 29.7801C140.994 36.3535 136.575 39.5625 131.7 39.5625C126.826 39.5514 122.406 36.3535 122.406 29.7801ZM127.281 29.7801C127.281 33.6775 128.913 35.7984 131.7 35.7984C134.487 35.7984 136.119 33.6775 136.119 29.7801C136.119 25.8494 134.487 23.7286 131.7 23.7286C128.913 23.7286 127.281 25.8383 127.281 29.7801Z\" />\n <path d=\"M149.167 39.5514C145.58 39.5514 142.416 37.4639 142.416 34.0884C142.416 29.6358 147.39 28.3145 154.741 27.4706V27.1264C154.741 24.2394 153.208 23.2623 151.154 23.2623C149.1 23.2623 147.568 24.2394 147.468 26.2936H142.982C143.326 22.6072 146.568 19.8867 151.332 19.8867C155.962 19.8867 159.549 21.7633 159.549 28.1035C159.549 28.692 159.482 31.2014 159.482 32.9114C159.482 35.865 159.693 37.5416 160.037 39.1073H155.618C155.473 38.5188 155.34 37.6083 155.274 36.7089C153.941 38.6853 151.987 39.5514 149.167 39.5514ZM154.874 30.5463C149.511 31.1015 147.357 31.7344 147.357 33.8219C147.357 35.1766 148.434 36.298 150.599 36.298C153.597 36.298 154.885 34.5547 154.885 31.4901V30.5463H154.874Z\" />\n <path d=\"M175.06 39.1073V36.7422C173.872 38.7964 171.618 39.5625 169.664 39.5625C165.067 39.5625 161.625 35.7317 161.625 29.7468C161.625 23.8619 165 19.9645 169.664 19.9645C172.029 19.9645 174.05 21.0415 175.06 22.7848V13.8796H179.868V39.1073H175.06ZM175.238 29.7357C175.238 25.9716 173.494 23.6398 170.852 23.6398C168.242 23.6398 166.677 26.1159 166.677 29.7691C166.677 33.4222 168.242 35.865 170.852 35.865C173.494 35.865 175.238 33.5665 175.238 29.7357Z\" />\n <path d=\"M19.1531 0L42.049 13.8019V39.9956L24.8049 50V23.8064L1.89795 10.0155L19.1531 0Z\" />\n <path d=\"M17.4097 48.5454V28.1035L0.132324 38.1301L17.4097 48.5454Z\" />\n </svg>\n)\n\nexport const Logo: React.FC<ServerProps> = (props) => {\n const { i18n, locale, params, payload, permissions, searchParams, user } = props\n\n const {\n admin: {\n components: {\n graphics: { Logo: CustomLogo } = {\n Logo: undefined,\n },\n } = {},\n } = {},\n } = payload.config\n\n return (\n <RenderCustomComponent\n CustomComponent={CustomLogo}\n DefaultComponent={PayloadLogo}\n serverOnlyProps={{\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n }}\n />\n )\n}\n"],"names":["React","RenderCustomComponent","css","PayloadLogo","svg","className","fill","height","viewBox","width","xmlns","style","path","d","Logo","props","i18n","locale","params","payload","permissions","searchParams","user","admin","components","graphics","CustomLogo","undefined","config","CustomComponent","DefaultComponent","serverOnlyProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAOA,WAAW,QAAO;AAEzB,SAASC,qBAAqB,QAAQ,gDAA+C;AAErF,MAAMC,MAAM,CAAC;;;;AAIb,CAAC;AAED,MAAMC,cAAwB,kBAC5B,oBAACC;QACCC,WAAU;QACVC,MAAK;QACLC,QAAO;QACPC,SAAQ;QACRC,OAAM;QACNC,OAAM;qBAEN,oBAACC,eAAOT,oBACR,oBAACU;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;;AAIZ,OAAO,MAAMC,OAA8B,CAACC;IAC1C,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAEC,WAAW,EAAEC,YAAY,EAAEC,IAAI,EAAE,GAAGP;IAE3E,MAAM,EACJQ,OAAO,EACLC,YAAY,EACVC,UAAU,EAAEX,MAAMY,UAAU,EAAE,GAAG;QAC/BZ,MAAMa;IACR,CAAC,EACF,GAAG,CAAC,CAAC,EACP,GAAG,CAAC,CAAC,EACP,GAAGR,QAAQS,MAAM;IAElB,qBACE,oBAAC3B;QACC4B,iBAAiBH;QACjBI,kBAAkB3B;QAClB4B,iBAAiB;YACff;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;QACF;;AAGN,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/Auth/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAO3D,OAAO,KAAsE,MAAM,OAAO,CAAA;AAS1F,MAAM,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7C,kBAAkB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACvC,cAAc,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,CAAA;IAClD,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAA;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAA;CAChB,CAAA;AAMD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAkThE,CAAA;AAED,eAAO,MAAM,OAAO,wBAAwB,YAAY,CAAC,CAA0C,CAAA"}
@@ -1,10 +1,10 @@
1
1
  'use client';
2
2
  import * as facelessUIImport from '@faceless-ui/modal';
3
- import { stayLoggedInModalSlug } from '@payloadcms/ui/elements/StayLoggedIn';
4
3
  import { usePathname, useRouter } from 'next/navigation.js';
5
4
  import qs from 'qs';
6
5
  import React, { createContext, useCallback, useContext, useEffect, useState } from 'react';
7
6
  import { toast } from 'react-toastify';
7
+ import { stayLoggedInModalSlug } from '../../elements/StayLoggedIn/index.js';
8
8
  import { useDebounce } from '../../hooks/useDebounce.js';
9
9
  import { useTranslation } from '../../providers/Translation/index.js';
10
10
  import { requests } from '../../utilities/api.js';
@@ -24,7 +24,7 @@ export const AuthProvider = ({ children })=>{
24
24
  const code = 'en' // TODO: re-enable i18n asap
25
25
  ;
26
26
  const config = useConfig();
27
- const { admin: { autoLogin, inactivityRoute: logoutInactivityRoute, user: userSlug }, routes: { admin, api }, serverURL } = config;
27
+ const { admin: { autoLogin, routes: { inactivity: logoutInactivityRoute }, routes: { login: loginRoute }, user: userSlug }, routes: { admin, api }, serverURL } = config;
28
28
  const [permissions, setPermissions] = useState();
29
29
  const { i18n } = useTranslation();
30
30
  const { closeAllModals, openModal } = useModal();
@@ -179,7 +179,7 @@ export const AuthProvider = ({ children })=>{
179
179
  } else if (autoLogin && autoLogin.prefillOnly !== true) {
180
180
  // auto log-in with the provided autoLogin credentials. This is used in dev mode
181
181
  // so you don't have to log in over and over again
182
- const autoLoginResult = await requests.post(`${serverURL}${api}/${userSlug}/login`, {
182
+ const autoLoginResult = await requests.post(`${serverURL}${api}/${userSlug}${loginRoute}`, {
183
183
  body: JSON.stringify({
184
184
  email: autoLogin.email,
185
185
  password: autoLogin.password
@@ -218,7 +218,8 @@ export const AuthProvider = ({ children })=>{
218
218
  router,
219
219
  searchParams,
220
220
  admin,
221
- revokeTokenAndExpire
221
+ revokeTokenAndExpire,
222
+ loginRoute
222
223
  ]);
223
224
  // On mount, get user and set
224
225
  useEffect(()=>{