@payloadcms/ui 3.0.0-canary.7660f90 → 3.0.0-canary.83a688a

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 (305) hide show
  1. package/dist/elements/Banner/index.scss +4 -4
  2. package/dist/elements/CodeEditor/types.d.ts +2 -2
  3. package/dist/elements/CodeEditor/types.d.ts.map +1 -1
  4. package/dist/elements/CodeEditor/types.js.map +1 -1
  5. package/dist/elements/Collapsible/index.scss +13 -47
  6. package/dist/elements/DatePicker/types.d.ts +2 -2
  7. package/dist/elements/DatePicker/types.d.ts.map +1 -1
  8. package/dist/elements/DatePicker/types.js.map +1 -1
  9. package/dist/elements/DocumentDrawer/DrawerContent.js +1 -1
  10. package/dist/elements/DocumentDrawer/DrawerContent.js.map +1 -1
  11. package/dist/elements/DocumentDrawer/types.d.ts +4 -4
  12. package/dist/elements/DocumentDrawer/types.d.ts.map +1 -1
  13. package/dist/elements/DocumentDrawer/types.js.map +1 -1
  14. package/dist/elements/DraggableSortable/DraggableSortableItem/index.d.ts +2 -2
  15. package/dist/elements/DraggableSortable/DraggableSortableItem/index.d.ts.map +1 -1
  16. package/dist/elements/DraggableSortable/DraggableSortableItem/index.js.map +1 -1
  17. package/dist/elements/DraggableSortable/DraggableSortableItem/types.d.ts +4 -4
  18. package/dist/elements/DraggableSortable/DraggableSortableItem/types.d.ts.map +1 -1
  19. package/dist/elements/DraggableSortable/DraggableSortableItem/types.js.map +1 -1
  20. package/dist/elements/Drawer/types.d.ts +2 -2
  21. package/dist/elements/Drawer/types.d.ts.map +1 -1
  22. package/dist/elements/Drawer/types.js.map +1 -1
  23. package/dist/elements/Dropzone/index.d.ts +1 -0
  24. package/dist/elements/Dropzone/index.d.ts.map +1 -1
  25. package/dist/elements/Dropzone/index.js +8 -1
  26. package/dist/elements/Dropzone/index.js.map +1 -1
  27. package/dist/elements/ErrorPill/index.scss +2 -14
  28. package/dist/elements/FileDetails/index.d.ts +2 -2
  29. package/dist/elements/FileDetails/index.d.ts.map +1 -1
  30. package/dist/elements/FileDetails/index.js.map +1 -1
  31. package/dist/elements/GenerateConfirmation/index.scss +1 -0
  32. package/dist/elements/ListDrawer/types.d.ts +2 -2
  33. package/dist/elements/ListDrawer/types.d.ts.map +1 -1
  34. package/dist/elements/ListDrawer/types.js.map +1 -1
  35. package/dist/elements/Pill/index.d.ts +2 -2
  36. package/dist/elements/Pill/index.d.ts.map +1 -1
  37. package/dist/elements/Pill/index.js.map +1 -1
  38. package/dist/elements/Pill/index.scss +9 -21
  39. package/dist/elements/PreviewSizes/index.d.ts +4 -4
  40. package/dist/elements/PreviewSizes/index.d.ts.map +1 -1
  41. package/dist/elements/PreviewSizes/index.js.map +1 -1
  42. package/dist/elements/PublishButton/index.d.ts.map +1 -1
  43. package/dist/elements/PublishButton/index.js +16 -0
  44. package/dist/elements/PublishButton/index.js.map +1 -1
  45. package/dist/elements/ReactSelect/Control/index.js +0 -1
  46. package/dist/elements/ReactSelect/Control/index.js.map +1 -1
  47. package/dist/elements/ReactSelect/DropdownIndicator/index.d.ts +2 -2
  48. package/dist/elements/ReactSelect/DropdownIndicator/index.d.ts.map +1 -1
  49. package/dist/elements/ReactSelect/DropdownIndicator/index.js.map +1 -1
  50. package/dist/elements/ReactSelect/MultiValueRemove/index.d.ts +2 -2
  51. package/dist/elements/ReactSelect/MultiValueRemove/index.d.ts.map +1 -1
  52. package/dist/elements/ReactSelect/MultiValueRemove/index.js.map +1 -1
  53. package/dist/elements/ReactSelect/index.d.ts.map +1 -1
  54. package/dist/elements/ReactSelect/index.js +0 -1
  55. package/dist/elements/ReactSelect/index.js.map +1 -1
  56. package/dist/elements/ReactSelect/index.scss +9 -2
  57. package/dist/elements/ReactSelect/types.d.ts +1 -1
  58. package/dist/elements/ReactSelect/types.d.ts.map +1 -1
  59. package/dist/elements/ReactSelect/types.js.map +1 -1
  60. package/dist/elements/SortComplex/index.js +1 -1
  61. package/dist/elements/SortComplex/index.js.map +1 -1
  62. package/dist/elements/Status/index.scss +1 -0
  63. package/dist/elements/Table/DefaultCell/fields/Relationship/index.d.ts.map +1 -1
  64. package/dist/elements/Table/DefaultCell/fields/Relationship/index.js +0 -1
  65. package/dist/elements/Table/DefaultCell/fields/Relationship/index.js.map +1 -1
  66. package/dist/elements/Table/RelationshipProvider/index.js.map +1 -1
  67. package/dist/elements/TableColumns/buildColumnState.d.ts.map +1 -1
  68. package/dist/elements/TableColumns/buildColumnState.js +0 -1
  69. package/dist/elements/TableColumns/buildColumnState.js.map +1 -1
  70. package/dist/elements/ThumbnailCard/index.d.ts +2 -2
  71. package/dist/elements/ThumbnailCard/index.d.ts.map +1 -1
  72. package/dist/elements/ThumbnailCard/index.js.map +1 -1
  73. package/dist/elements/Upload/index.d.ts.map +1 -1
  74. package/dist/elements/Upload/index.js +95 -9
  75. package/dist/elements/Upload/index.js.map +1 -1
  76. package/dist/elements/Upload/index.scss +6 -3
  77. package/dist/elements/WhereBuilder/Condition/Relationship/index.js +1 -1
  78. package/dist/elements/WhereBuilder/Condition/Relationship/index.js.map +1 -1
  79. package/dist/elements/WhereBuilder/Condition/Relationship/index.scss +2 -2
  80. package/dist/elements/WhereBuilder/index.js +9 -4
  81. package/dist/elements/WhereBuilder/index.js.map +1 -1
  82. package/dist/elements/WhereBuilder/reduceFieldMap.d.ts +12 -1
  83. package/dist/elements/WhereBuilder/reduceFieldMap.d.ts.map +1 -1
  84. package/dist/elements/WhereBuilder/reduceFieldMap.js +52 -6
  85. package/dist/elements/WhereBuilder/reduceFieldMap.js.map +1 -1
  86. package/dist/elements/WhereBuilder/validateWhereQuery.js +0 -1
  87. package/dist/elements/WhereBuilder/validateWhereQuery.js.map +1 -1
  88. package/dist/exports/client/{CodeEditor-UTZFZWZG.js → CodeEditor-OI35YO7H.js} +1 -1
  89. package/dist/exports/client/{CodeEditor-UTZFZWZG.js.map → CodeEditor-OI35YO7H.js.map} +1 -1
  90. package/dist/exports/client/{DatePicker-BN5AOAME.js → DatePicker-5IFHNQHA.js} +2 -2
  91. package/dist/exports/client/chunk-WDFUZ6GL.js +30 -0
  92. package/dist/exports/client/{chunk-3X2D2TP2.js.map → chunk-WDFUZ6GL.js.map} +4 -4
  93. package/dist/exports/client/index.js +19 -33
  94. package/dist/exports/client/index.js.map +4 -4
  95. package/dist/exports/shared/index.d.ts +0 -1
  96. package/dist/exports/shared/index.d.ts.map +1 -1
  97. package/dist/exports/shared/index.js +2 -12
  98. package/dist/exports/shared/index.js.map +4 -4
  99. package/dist/fields/Array/ArrayRow.d.ts +2 -2
  100. package/dist/fields/Array/ArrayRow.d.ts.map +1 -1
  101. package/dist/fields/Array/ArrayRow.js.map +1 -1
  102. package/dist/fields/Array/index.d.ts +2 -2
  103. package/dist/fields/Array/index.d.ts.map +1 -1
  104. package/dist/fields/Array/index.js.map +1 -1
  105. package/dist/fields/Blocks/BlockRow.d.ts +2 -2
  106. package/dist/fields/Blocks/BlockRow.d.ts.map +1 -1
  107. package/dist/fields/Blocks/BlockRow.js.map +1 -1
  108. package/dist/fields/Blocks/index.d.ts +2 -2
  109. package/dist/fields/Blocks/index.d.ts.map +1 -1
  110. package/dist/fields/Blocks/index.js.map +1 -1
  111. package/dist/fields/Checkbox/index.js +2 -1
  112. package/dist/fields/Checkbox/index.js.map +1 -1
  113. package/dist/fields/Checkbox/index.scss +2 -1
  114. package/dist/fields/Checkbox/types.d.ts +2 -2
  115. package/dist/fields/Checkbox/types.d.ts.map +1 -1
  116. package/dist/fields/Checkbox/types.js.map +1 -1
  117. package/dist/fields/Code/index.d.ts +2 -2
  118. package/dist/fields/Code/index.d.ts.map +1 -1
  119. package/dist/fields/Code/index.js +1 -1
  120. package/dist/fields/Code/index.js.map +1 -1
  121. package/dist/fields/Code/index.scss +3 -21
  122. package/dist/fields/Collapsible/index.d.ts +2 -2
  123. package/dist/fields/Collapsible/index.d.ts.map +1 -1
  124. package/dist/fields/Collapsible/index.js.map +1 -1
  125. package/dist/fields/Collapsible/index.scss +0 -4
  126. package/dist/fields/DateTime/index.d.ts +2 -2
  127. package/dist/fields/DateTime/index.d.ts.map +1 -1
  128. package/dist/fields/DateTime/index.js +1 -1
  129. package/dist/fields/DateTime/index.js.map +1 -1
  130. package/dist/fields/Email/index.d.ts +2 -2
  131. package/dist/fields/Email/index.d.ts.map +1 -1
  132. package/dist/fields/Email/index.js.map +1 -1
  133. package/dist/fields/FieldError/index.scss +6 -5
  134. package/dist/fields/Group/index.d.ts +2 -2
  135. package/dist/fields/Group/index.d.ts.map +1 -1
  136. package/dist/fields/Group/index.js.map +1 -1
  137. package/dist/fields/Hidden/index.d.ts +2 -2
  138. package/dist/fields/Hidden/index.d.ts.map +1 -1
  139. package/dist/fields/Hidden/index.js.map +1 -1
  140. package/dist/fields/JSON/index.d.ts +2 -2
  141. package/dist/fields/JSON/index.d.ts.map +1 -1
  142. package/dist/fields/JSON/index.js +0 -5
  143. package/dist/fields/JSON/index.js.map +1 -1
  144. package/dist/fields/JSON/index.scss +6 -25
  145. package/dist/fields/Number/index.d.ts +2 -2
  146. package/dist/fields/Number/index.d.ts.map +1 -1
  147. package/dist/fields/Number/index.js +1 -3
  148. package/dist/fields/Number/index.js.map +1 -1
  149. package/dist/fields/Password/index.d.ts +2 -2
  150. package/dist/fields/Password/index.d.ts.map +1 -1
  151. package/dist/fields/Password/index.js.map +1 -1
  152. package/dist/fields/Point/index.d.ts +2 -2
  153. package/dist/fields/Point/index.d.ts.map +1 -1
  154. package/dist/fields/Point/index.js +6 -6
  155. package/dist/fields/Point/index.js.map +1 -1
  156. package/dist/fields/Point/index.scss +4 -0
  157. package/dist/fields/RadioGroup/index.d.ts +2 -2
  158. package/dist/fields/RadioGroup/index.d.ts.map +1 -1
  159. package/dist/fields/RadioGroup/index.js +7 -6
  160. package/dist/fields/RadioGroup/index.js.map +1 -1
  161. package/dist/fields/RadioGroup/index.scss +7 -0
  162. package/dist/fields/Relationship/index.js +1 -1
  163. package/dist/fields/Relationship/index.js.map +1 -1
  164. package/dist/fields/Relationship/index.scss +2 -2
  165. package/dist/fields/Relationship/types.d.ts +2 -2
  166. package/dist/fields/Relationship/types.d.ts.map +1 -1
  167. package/dist/fields/Relationship/types.js.map +1 -1
  168. package/dist/fields/RichText/index.d.ts +2 -2
  169. package/dist/fields/RichText/index.d.ts.map +1 -1
  170. package/dist/fields/RichText/index.js.map +1 -1
  171. package/dist/fields/Row/types.d.ts +2 -2
  172. package/dist/fields/Row/types.d.ts.map +1 -1
  173. package/dist/fields/Row/types.js.map +1 -1
  174. package/dist/fields/Select/Input.d.ts +2 -2
  175. package/dist/fields/Select/Input.d.ts.map +1 -1
  176. package/dist/fields/Select/Input.js +0 -5
  177. package/dist/fields/Select/Input.js.map +1 -1
  178. package/dist/fields/Select/index.d.ts +2 -2
  179. package/dist/fields/Select/index.d.ts.map +1 -1
  180. package/dist/fields/Select/index.js +1 -1
  181. package/dist/fields/Select/index.js.map +1 -1
  182. package/dist/fields/Tabs/index.d.ts +2 -2
  183. package/dist/fields/Tabs/index.d.ts.map +1 -1
  184. package/dist/fields/Tabs/index.js.map +1 -1
  185. package/dist/fields/Text/types.d.ts +4 -4
  186. package/dist/fields/Text/types.d.ts.map +1 -1
  187. package/dist/fields/Text/types.js.map +1 -1
  188. package/dist/fields/Textarea/index.d.ts.map +1 -1
  189. package/dist/fields/Textarea/index.js +1 -1
  190. package/dist/fields/Textarea/index.js.map +1 -1
  191. package/dist/fields/Textarea/types.d.ts +4 -4
  192. package/dist/fields/Textarea/types.d.ts.map +1 -1
  193. package/dist/fields/Textarea/types.js.map +1 -1
  194. package/dist/fields/Upload/Input.d.ts +2 -2
  195. package/dist/fields/Upload/Input.d.ts.map +1 -1
  196. package/dist/fields/Upload/Input.js.map +1 -1
  197. package/dist/fields/Upload/types.d.ts +2 -2
  198. package/dist/fields/Upload/types.d.ts.map +1 -1
  199. package/dist/fields/Upload/types.js.map +1 -1
  200. package/dist/forms/Form/index.d.ts.map +1 -1
  201. package/dist/forms/Form/index.js +3 -6
  202. package/dist/forms/Form/index.js.map +1 -1
  203. package/dist/forms/Form/types.d.ts +7 -7
  204. package/dist/forms/Form/types.d.ts.map +1 -1
  205. package/dist/forms/Form/types.js.map +1 -1
  206. package/dist/forms/RenderFields/index.scss +7 -4
  207. package/dist/forms/RowLabel/Context/index.d.ts +2 -2
  208. package/dist/forms/RowLabel/Context/index.d.ts.map +1 -1
  209. package/dist/forms/RowLabel/Context/index.js.map +1 -1
  210. package/dist/forms/buildStateFromSchema/addFieldStatePromise.d.ts.map +1 -1
  211. package/dist/forms/buildStateFromSchema/addFieldStatePromise.js +1 -1
  212. package/dist/forms/buildStateFromSchema/addFieldStatePromise.js.map +1 -1
  213. package/dist/forms/buildStateFromSchema/buildStateFromSchema.spec.js +1 -1
  214. package/dist/forms/buildStateFromSchema/buildStateFromSchema.spec.js.map +1 -1
  215. package/dist/forms/buildStateFromSchema/getFilterOptionsQuery.d.ts +2 -2
  216. package/dist/forms/buildStateFromSchema/getFilterOptionsQuery.d.ts.map +1 -1
  217. package/dist/forms/buildStateFromSchema/getFilterOptionsQuery.js.map +1 -1
  218. package/dist/hooks/useHotkey.js +1 -1
  219. package/dist/hooks/useHotkey.js.map +1 -1
  220. package/dist/hooks/useIntersect.js +1 -1
  221. package/dist/hooks/useIntersect.js.map +1 -1
  222. package/dist/hooks/usePayloadAPI.js +1 -1
  223. package/dist/hooks/usePayloadAPI.js.map +1 -1
  224. package/dist/hooks/useThrottledEffect.d.ts.map +1 -1
  225. package/dist/hooks/useThrottledEffect.js +1 -1
  226. package/dist/hooks/useThrottledEffect.js.map +1 -1
  227. package/dist/providers/Auth/index.js +1 -1
  228. package/dist/providers/Auth/index.js.map +1 -1
  229. package/dist/providers/ComponentMap/buildComponentMap/actions.d.ts.map +1 -1
  230. package/dist/providers/ComponentMap/buildComponentMap/actions.js +3 -3
  231. package/dist/providers/ComponentMap/buildComponentMap/actions.js.map +1 -1
  232. package/dist/providers/ComponentMap/buildComponentMap/collections.d.ts.map +1 -1
  233. package/dist/providers/ComponentMap/buildComponentMap/collections.js +8 -8
  234. package/dist/providers/ComponentMap/buildComponentMap/collections.js.map +1 -1
  235. package/dist/providers/ComponentMap/buildComponentMap/fields.d.ts.map +1 -1
  236. package/dist/providers/ComponentMap/buildComponentMap/fields.js +1 -0
  237. package/dist/providers/ComponentMap/buildComponentMap/fields.js.map +1 -1
  238. package/dist/providers/ComponentMap/buildComponentMap/index.js +2 -2
  239. package/dist/providers/ComponentMap/buildComponentMap/index.js.map +1 -1
  240. package/dist/providers/ComponentMap/buildComponentMap/types.d.ts +2 -2
  241. package/dist/providers/ComponentMap/buildComponentMap/types.d.ts.map +1 -1
  242. package/dist/providers/ComponentMap/buildComponentMap/types.js.map +1 -1
  243. package/dist/providers/DocumentInfo/index.d.ts +2 -2
  244. package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
  245. package/dist/providers/DocumentInfo/index.js +2 -2
  246. package/dist/providers/DocumentInfo/index.js.map +1 -1
  247. package/dist/providers/DocumentInfo/types.d.ts +6 -6
  248. package/dist/providers/DocumentInfo/types.d.ts.map +1 -1
  249. package/dist/providers/DocumentInfo/types.js.map +1 -1
  250. package/dist/providers/ListInfo/index.d.ts +2 -2
  251. package/dist/providers/ListInfo/index.d.ts.map +1 -1
  252. package/dist/providers/ListInfo/index.js.map +1 -1
  253. package/dist/providers/ListQuery/index.d.ts +2 -2
  254. package/dist/providers/ListQuery/index.d.ts.map +1 -1
  255. package/dist/providers/ListQuery/index.js +1 -1
  256. package/dist/providers/ListQuery/index.js.map +1 -1
  257. package/dist/providers/SearchParams/index.d.ts +1 -1
  258. package/dist/providers/SearchParams/index.d.ts.map +1 -1
  259. package/dist/providers/SearchParams/index.js +1 -1
  260. package/dist/providers/SearchParams/index.js.map +1 -1
  261. package/dist/providers/Selection/index.js +1 -1
  262. package/dist/providers/Selection/index.js.map +1 -1
  263. package/dist/providers/ToastContainer/icons/Error.js +2 -2
  264. package/dist/providers/ToastContainer/icons/Error.js.map +1 -1
  265. package/dist/providers/ToastContainer/icons/Info.js +2 -2
  266. package/dist/providers/ToastContainer/icons/Info.js.map +1 -1
  267. package/dist/providers/ToastContainer/icons/Success.js +2 -2
  268. package/dist/providers/ToastContainer/icons/Success.js.map +1 -1
  269. package/dist/providers/ToastContainer/icons/Warning.js +2 -2
  270. package/dist/providers/ToastContainer/icons/Warning.js.map +1 -1
  271. package/dist/providers/ToastContainer/index.d.ts.map +1 -1
  272. package/dist/providers/ToastContainer/index.js +3 -1
  273. package/dist/providers/ToastContainer/index.js.map +1 -1
  274. package/dist/scss/app.scss +2 -2
  275. package/dist/scss/colors.scss +76 -76
  276. package/dist/scss/toasts.scss +67 -44
  277. package/dist/styles.css +1 -1
  278. package/dist/utilities/api.d.ts +2 -2
  279. package/dist/utilities/api.d.ts.map +1 -1
  280. package/dist/utilities/api.js +1 -1
  281. package/dist/utilities/api.js.map +1 -1
  282. package/dist/utilities/buildFormState.d.ts.map +1 -1
  283. package/dist/utilities/buildFormState.js +1 -3
  284. package/dist/utilities/buildFormState.js.map +1 -1
  285. package/dist/utilities/reduceFieldsToValuesWithValidation.js +1 -1
  286. package/dist/utilities/reduceFieldsToValuesWithValidation.js.map +1 -1
  287. package/package.json +16 -25
  288. package/dist/exports/client/chunk-3X2D2TP2.js +0 -30
  289. package/dist/forms/Form/getDataByPath.d.ts +0 -3
  290. package/dist/forms/Form/getDataByPath.d.ts.map +0 -1
  291. package/dist/forms/Form/getDataByPath.js +0 -18
  292. package/dist/forms/Form/getDataByPath.js.map +0 -1
  293. package/dist/forms/Form/getSiblingData.d.ts +0 -3
  294. package/dist/forms/Form/getSiblingData.d.ts.map +0 -1
  295. package/dist/forms/Form/getSiblingData.js +0 -33
  296. package/dist/forms/Form/getSiblingData.js.map +0 -1
  297. package/dist/utilities/reduceFieldsToValues.d.ts +0 -10
  298. package/dist/utilities/reduceFieldsToValues.d.ts.map +0 -1
  299. package/dist/utilities/reduceFieldsToValues.js +0 -22
  300. package/dist/utilities/reduceFieldsToValues.js.map +0 -1
  301. package/dist/utilities/unflatten.d.ts +0 -9
  302. package/dist/utilities/unflatten.d.ts.map +0 -1
  303. package/dist/utilities/unflatten.js +0 -58
  304. package/dist/utilities/unflatten.js.map +0 -1
  305. /package/dist/exports/client/{DatePicker-BN5AOAME.js.map → DatePicker-5IFHNQHA.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/Blocks/index.tsx"],"sourcesContent":["'use client'\nimport type { BlockField } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment, useCallback } from 'react'\n\nimport type { ReducedBlock } from '../../providers/ComponentMap/buildComponentMap/types.js'\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { Banner } from '../../elements/Banner/index.js'\nimport { Button } from '../../elements/Button/index.js'\nimport { DraggableSortableItem } from '../../elements/DraggableSortable/DraggableSortableItem/index.js'\nimport { DraggableSortable } from '../../elements/DraggableSortable/index.js'\nimport { DrawerToggler } from '../../elements/Drawer/index.js'\nimport { useDrawerSlug } from '../../elements/Drawer/useDrawerSlug.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useForm, useFormSubmitted } from '../../forms/Form/context.js'\nimport { NullifyLocaleField } from '../../forms/NullifyField/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { scrollToID } from '../../utilities/scrollToID.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { BlockRow } from './BlockRow.js'\nimport { BlocksDrawer } from './BlocksDrawer/index.js'\nimport './index.scss'\n\nconst baseClass = 'blocks-field'\n\nexport type BlocksFieldProps = FormFieldBase & {\n blocks?: ReducedBlock[]\n forceRender?: boolean\n isSortable?: boolean\n labels?: BlockField['labels']\n maxRows?: number\n minRows?: number\n name?: string\n slug?: string\n width?: string\n}\n\nconst _BlocksField: React.FC<BlocksFieldProps> = (props) => {\n const { i18n, t } = useTranslation()\n\n const {\n name,\n CustomDescription,\n CustomError,\n CustomLabel,\n blocks,\n className,\n descriptionProps,\n errorProps,\n forceRender = false,\n isSortable = true,\n label,\n labelProps,\n labels: labelsFromProps,\n localized,\n maxRows,\n minRows: minRowsProp,\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n required,\n validate,\n } = props\n\n const { indexPath, readOnly: readOnlyFromContext } = useFieldProps()\n const minRows = minRowsProp ?? required ? 1 : 0\n\n const { setDocFieldPreferences } = useDocumentInfo()\n const { addFieldRow, dispatchFields, setModified } = useForm()\n const { code: locale } = useLocale()\n const { localization } = useConfig()\n const drawerSlug = useDrawerSlug('blocks-drawer')\n const submitted = useFormSubmitted()\n\n const labels = {\n plural: t('fields:blocks'),\n singular: t('fields:block'),\n ...labelsFromProps,\n }\n\n const editingDefaultLocale = (() => {\n if (localization && localization.fallback) {\n const defaultLocale = localization.defaultLocale || 'en'\n return locale === defaultLocale\n }\n\n return true\n })()\n\n const memoizedValidate = useCallback(\n (value, options) => {\n // alternative locales can be null\n if (!editingDefaultLocale && value === null) {\n return true\n }\n if (typeof validate === 'function') {\n return validate(value, { ...options, maxRows, minRows, required })\n }\n },\n [maxRows, minRows, required, validate, editingDefaultLocale],\n )\n\n const { path: pathFromContext } = useFieldProps()\n\n const {\n errorPaths,\n formInitializing,\n formProcessing,\n path,\n permissions,\n rows = [],\n schemaPath,\n showError,\n valid,\n value,\n } = useField<number>({\n hasRows: true,\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const addRow = useCallback(\n async (rowIndex: number, blockType: string) => {\n await addFieldRow({\n data: { blockType },\n path,\n rowIndex,\n schemaPath: `${schemaPath}.${blockType}`,\n })\n setModified(true)\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [addFieldRow, path, setModified, schemaPath],\n )\n\n const duplicateRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({ type: 'DUPLICATE_ROW', path, rowIndex })\n setModified(true)\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [dispatchFields, path, setModified],\n )\n\n const removeRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({\n type: 'REMOVE_ROW',\n path,\n rowIndex,\n })\n\n setModified(true)\n },\n [path, dispatchFields, setModified],\n )\n\n const moveRow = useCallback(\n (moveFromIndex: number, moveToIndex: number) => {\n dispatchFields({ type: 'MOVE_ROW', moveFromIndex, moveToIndex, path })\n setModified(true)\n },\n [dispatchFields, path, setModified],\n )\n\n const toggleCollapseAll = useCallback(\n (collapsed: boolean) => {\n dispatchFields({ type: 'SET_ALL_ROWS_COLLAPSED', collapsed, path, setDocFieldPreferences })\n },\n [dispatchFields, path, setDocFieldPreferences],\n )\n\n const setCollapse = useCallback(\n (rowID: string, collapsed: boolean) => {\n dispatchFields({ type: 'SET_ROW_COLLAPSED', collapsed, path, rowID, setDocFieldPreferences })\n },\n [dispatchFields, path, setDocFieldPreferences],\n )\n\n const hasMaxRows = maxRows && rows.length >= maxRows\n\n const fieldErrorCount = errorPaths.length\n const fieldHasErrors = submitted && fieldErrorCount + (valid ? 0 : 1) > 0\n\n const showMinRows = rows.length < minRows || (required && rows.length === 0)\n const showRequired = disabled && rows.length === 0\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${path.replace(/\\./g, '__')}`}\n >\n {showError && <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />}\n <header className={`${baseClass}__header`}>\n <div className={`${baseClass}__header-wrap`}>\n <div className={`${baseClass}__heading-with-error`}>\n <h3>\n <FieldLabel\n CustomLabel={CustomLabel}\n as=\"span\"\n label={label}\n required={required}\n unstyled\n {...(labelProps || {})}\n />\n </h3>\n {fieldHasErrors && fieldErrorCount > 0 && (\n <ErrorPill count={fieldErrorCount} i18n={i18n} withMessage />\n )}\n </div>\n {rows.length > 0 && (\n <ul className={`${baseClass}__header-actions`}>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(true)}\n type=\"button\"\n >\n {t('fields:collapseAll')}\n </button>\n </li>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(false)}\n type=\"button\"\n >\n {t('fields:showAll')}\n </button>\n </li>\n </ul>\n )}\n </div>\n <FieldDescription CustomDescription={CustomDescription} {...(descriptionProps || {})} />\n </header>\n <NullifyLocaleField fieldValue={value} localized={localized} path={path} />\n {(rows.length > 0 || (!valid && (showRequired || showMinRows))) && (\n <DraggableSortable\n className={`${baseClass}__rows`}\n ids={rows.map((row) => row.id)}\n onDragEnd={({ moveFromIndex, moveToIndex }) => moveRow(moveFromIndex, moveToIndex)}\n >\n {rows.map((row, i) => {\n const { blockType } = row\n const blockToRender = blocks.find((block) => block.slug === blockType)\n\n if (blockToRender) {\n const rowErrorCount = errorPaths.filter((errorPath) =>\n errorPath.startsWith(`${path}.${i}`),\n ).length\n return (\n <DraggableSortableItem disabled={disabled || !isSortable} id={row.id} key={row.id}>\n {(draggableSortableItemProps) => (\n <BlockRow\n {...draggableSortableItemProps}\n addRow={addRow}\n block={blockToRender}\n blocks={blocks}\n duplicateRow={duplicateRow}\n errorCount={rowErrorCount}\n forceRender={forceRender}\n hasMaxRows={hasMaxRows}\n indexPath={indexPath}\n isSortable={isSortable}\n labels={labels}\n moveRow={moveRow}\n path={path}\n permissions={permissions}\n readOnly={disabled}\n removeRow={removeRow}\n row={row}\n rowCount={rows.length}\n rowIndex={i}\n schemaPath={schemaPath}\n setCollapse={setCollapse}\n />\n )}\n </DraggableSortableItem>\n )\n }\n\n return null\n })}\n {!editingDefaultLocale && (\n <React.Fragment>\n {showMinRows && (\n <Banner type=\"error\">\n {t('validation:requiresAtLeast', {\n count: minRows,\n label:\n getTranslation(minRows > 1 ? labels.plural : labels.singular, i18n) ||\n t(minRows > 1 ? 'general:row' : 'general:rows'),\n })}\n </Banner>\n )}\n {showRequired && (\n <Banner>\n {t('validation:fieldHasNo', { label: getTranslation(labels.plural, i18n) })}\n </Banner>\n )}\n </React.Fragment>\n )}\n </DraggableSortable>\n )}\n {!disabled && !hasMaxRows && (\n <Fragment>\n <DrawerToggler className={`${baseClass}__drawer-toggler`} slug={drawerSlug}>\n <Button\n buttonStyle=\"icon-label\"\n el=\"span\"\n icon=\"plus\"\n iconPosition=\"left\"\n iconStyle=\"with-border\"\n >\n {t('fields:addLabel', { label: getTranslation(labels.singular, i18n) })}\n </Button>\n </DrawerToggler>\n <BlocksDrawer\n addRow={addRow}\n addRowIndex={rows?.length || 0}\n blocks={blocks}\n drawerSlug={drawerSlug}\n labels={labels}\n />\n </Fragment>\n )}\n </div>\n )\n}\n\nexport const BlocksField = withCondition(_BlocksField)\n"],"names":["getTranslation","React","Fragment","useCallback","Banner","Button","DraggableSortableItem","DraggableSortable","DrawerToggler","useDrawerSlug","ErrorPill","useFieldProps","useForm","useFormSubmitted","NullifyLocaleField","useField","withCondition","useConfig","useDocumentInfo","useLocale","useTranslation","scrollToID","FieldDescription","FieldError","FieldLabel","fieldBaseClass","BlockRow","BlocksDrawer","baseClass","_BlocksField","props","i18n","t","name","CustomDescription","CustomError","CustomLabel","blocks","className","descriptionProps","errorProps","forceRender","isSortable","label","labelProps","labels","labelsFromProps","localized","maxRows","minRows","minRowsProp","path","pathFromProps","readOnly","readOnlyFromProps","required","validate","indexPath","readOnlyFromContext","setDocFieldPreferences","addFieldRow","dispatchFields","setModified","code","locale","localization","drawerSlug","submitted","plural","singular","editingDefaultLocale","fallback","defaultLocale","memoizedValidate","value","options","pathFromContext","errorPaths","formInitializing","formProcessing","permissions","rows","schemaPath","showError","valid","hasRows","disabled","addRow","rowIndex","blockType","data","setTimeout","duplicateRow","type","removeRow","moveRow","moveFromIndex","moveToIndex","toggleCollapseAll","collapsed","setCollapse","rowID","hasMaxRows","length","fieldErrorCount","fieldHasErrors","showMinRows","showRequired","div","filter","Boolean","join","id","replace","header","h3","as","unstyled","count","withMessage","ul","li","button","onClick","fieldValue","ids","map","row","onDragEnd","i","blockToRender","find","block","slug","rowErrorCount","errorPath","startsWith","draggableSortableItemProps","errorCount","rowCount","buttonStyle","el","icon","iconPosition","iconStyle","addRowIndex","BlocksField"],"mappings":"AAAA;;AAGA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,SAASC,QAAQ,EAAEC,WAAW,QAAQ,QAAO;AAKpD,SAASC,MAAM,QAAQ,iCAAgC;AACvD,SAASC,MAAM,QAAQ,iCAAgC;AACvD,SAASC,qBAAqB,QAAQ,kEAAiE;AACvG,SAASC,iBAAiB,QAAQ,4CAA2C;AAC7E,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,aAAa,QAAQ,yCAAwC;AACtE,SAASC,SAAS,QAAQ,oCAAmC;AAC7D,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,OAAO,EAAEC,gBAAgB,QAAQ,8BAA6B;AACvE,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,UAAU,QAAQ,gCAA+B;AAC1D,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,UAAU,QAAQ,yBAAwB;AACn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,gBAAgB,CAAC;wBAAEyG,MAAMnE;kCAC9D,cAAA,KAAC7D;4BACCuI,aAAY;4BACZC,IAAG;4BACHC,MAAK;4BACLC,cAAa;4BACbC,WAAU;sCAEThH,EAAE,mBAAmB;gCAAEW,OAAO3C,eAAe6C,OAAOwB,QAAQ,EAAEtC;4BAAM;;;kCAGzE,KAACJ;wBACC4D,QAAQA;wBACR0D,aAAahE,MAAMsB,UAAU;wBAC7BlE,QAAQA;wBACR6B,YAAYA;wBACZrB,QAAQA;;;;;;AAMpB;AAEA,OAAO,MAAMqG,cAAclI,cAAca,cAAa"}
1
+ {"version":3,"sources":["../../../src/fields/Blocks/index.tsx"],"sourcesContent":["'use client'\nimport type { BlockField } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment, useCallback } from 'react'\n\nimport type { ReducedBlock } from '../../providers/ComponentMap/buildComponentMap/types.js'\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { Banner } from '../../elements/Banner/index.js'\nimport { Button } from '../../elements/Button/index.js'\nimport { DraggableSortableItem } from '../../elements/DraggableSortable/DraggableSortableItem/index.js'\nimport { DraggableSortable } from '../../elements/DraggableSortable/index.js'\nimport { DrawerToggler } from '../../elements/Drawer/index.js'\nimport { useDrawerSlug } from '../../elements/Drawer/useDrawerSlug.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useForm, useFormSubmitted } from '../../forms/Form/context.js'\nimport { NullifyLocaleField } from '../../forms/NullifyField/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { scrollToID } from '../../utilities/scrollToID.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { BlockRow } from './BlockRow.js'\nimport { BlocksDrawer } from './BlocksDrawer/index.js'\nimport './index.scss'\n\nconst baseClass = 'blocks-field'\n\nexport type BlocksFieldProps = {\n blocks?: ReducedBlock[]\n forceRender?: boolean\n isSortable?: boolean\n labels?: BlockField['labels']\n maxRows?: number\n minRows?: number\n name?: string\n slug?: string\n width?: string\n} & FormFieldBase\n\nconst _BlocksField: React.FC<BlocksFieldProps> = (props) => {\n const { i18n, t } = useTranslation()\n\n const {\n name,\n CustomDescription,\n CustomError,\n CustomLabel,\n blocks,\n className,\n descriptionProps,\n errorProps,\n forceRender = false,\n isSortable = true,\n label,\n labelProps,\n labels: labelsFromProps,\n localized,\n maxRows,\n minRows: minRowsProp,\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n required,\n validate,\n } = props\n\n const { indexPath, readOnly: readOnlyFromContext } = useFieldProps()\n const minRows = minRowsProp ?? required ? 1 : 0\n\n const { setDocFieldPreferences } = useDocumentInfo()\n const { addFieldRow, dispatchFields, setModified } = useForm()\n const { code: locale } = useLocale()\n const { localization } = useConfig()\n const drawerSlug = useDrawerSlug('blocks-drawer')\n const submitted = useFormSubmitted()\n\n const labels = {\n plural: t('fields:blocks'),\n singular: t('fields:block'),\n ...labelsFromProps,\n }\n\n const editingDefaultLocale = (() => {\n if (localization && localization.fallback) {\n const defaultLocale = localization.defaultLocale || 'en'\n return locale === defaultLocale\n }\n\n return true\n })()\n\n const memoizedValidate = useCallback(\n (value, options) => {\n // alternative locales can be null\n if (!editingDefaultLocale && value === null) {\n return true\n }\n if (typeof validate === 'function') {\n return validate(value, { ...options, maxRows, minRows, required })\n }\n },\n [maxRows, minRows, required, validate, editingDefaultLocale],\n )\n\n const { path: pathFromContext } = useFieldProps()\n\n const {\n errorPaths,\n formInitializing,\n formProcessing,\n path,\n permissions,\n rows = [],\n schemaPath,\n showError,\n valid,\n value,\n } = useField<number>({\n hasRows: true,\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const addRow = useCallback(\n async (rowIndex: number, blockType: string) => {\n await addFieldRow({\n data: { blockType },\n path,\n rowIndex,\n schemaPath: `${schemaPath}.${blockType}`,\n })\n setModified(true)\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [addFieldRow, path, setModified, schemaPath],\n )\n\n const duplicateRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({ type: 'DUPLICATE_ROW', path, rowIndex })\n setModified(true)\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [dispatchFields, path, setModified],\n )\n\n const removeRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({\n type: 'REMOVE_ROW',\n path,\n rowIndex,\n })\n\n setModified(true)\n },\n [path, dispatchFields, setModified],\n )\n\n const moveRow = useCallback(\n (moveFromIndex: number, moveToIndex: number) => {\n dispatchFields({ type: 'MOVE_ROW', moveFromIndex, moveToIndex, path })\n setModified(true)\n },\n [dispatchFields, path, setModified],\n )\n\n const toggleCollapseAll = useCallback(\n (collapsed: boolean) => {\n dispatchFields({ type: 'SET_ALL_ROWS_COLLAPSED', collapsed, path, setDocFieldPreferences })\n },\n [dispatchFields, path, setDocFieldPreferences],\n )\n\n const setCollapse = useCallback(\n (rowID: string, collapsed: boolean) => {\n dispatchFields({ type: 'SET_ROW_COLLAPSED', collapsed, path, rowID, setDocFieldPreferences })\n },\n [dispatchFields, path, setDocFieldPreferences],\n )\n\n const hasMaxRows = maxRows && rows.length >= maxRows\n\n const fieldErrorCount = errorPaths.length\n const fieldHasErrors = submitted && fieldErrorCount + (valid ? 0 : 1) > 0\n\n const showMinRows = rows.length < minRows || (required && rows.length === 0)\n const showRequired = disabled && rows.length === 0\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${path.replace(/\\./g, '__')}`}\n >\n {showError && <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />}\n <header className={`${baseClass}__header`}>\n <div className={`${baseClass}__header-wrap`}>\n <div className={`${baseClass}__heading-with-error`}>\n <h3>\n <FieldLabel\n CustomLabel={CustomLabel}\n as=\"span\"\n label={label}\n required={required}\n unstyled\n {...(labelProps || {})}\n />\n </h3>\n {fieldHasErrors && fieldErrorCount > 0 && (\n <ErrorPill count={fieldErrorCount} i18n={i18n} withMessage />\n )}\n </div>\n {rows.length > 0 && (\n <ul className={`${baseClass}__header-actions`}>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(true)}\n type=\"button\"\n >\n {t('fields:collapseAll')}\n </button>\n </li>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(false)}\n type=\"button\"\n >\n {t('fields:showAll')}\n </button>\n </li>\n </ul>\n )}\n </div>\n <FieldDescription CustomDescription={CustomDescription} {...(descriptionProps || {})} />\n </header>\n <NullifyLocaleField fieldValue={value} localized={localized} path={path} />\n {(rows.length > 0 || (!valid && (showRequired || showMinRows))) && (\n <DraggableSortable\n className={`${baseClass}__rows`}\n ids={rows.map((row) => row.id)}\n onDragEnd={({ moveFromIndex, moveToIndex }) => moveRow(moveFromIndex, moveToIndex)}\n >\n {rows.map((row, i) => {\n const { blockType } = row\n const blockToRender = blocks.find((block) => block.slug === blockType)\n\n if (blockToRender) {\n const rowErrorCount = errorPaths.filter((errorPath) =>\n errorPath.startsWith(`${path}.${i}`),\n ).length\n return (\n <DraggableSortableItem disabled={disabled || !isSortable} id={row.id} key={row.id}>\n {(draggableSortableItemProps) => (\n <BlockRow\n {...draggableSortableItemProps}\n addRow={addRow}\n block={blockToRender}\n blocks={blocks}\n duplicateRow={duplicateRow}\n errorCount={rowErrorCount}\n forceRender={forceRender}\n hasMaxRows={hasMaxRows}\n indexPath={indexPath}\n isSortable={isSortable}\n labels={labels}\n moveRow={moveRow}\n path={path}\n permissions={permissions}\n readOnly={disabled}\n removeRow={removeRow}\n row={row}\n rowCount={rows.length}\n rowIndex={i}\n schemaPath={schemaPath}\n setCollapse={setCollapse}\n />\n )}\n </DraggableSortableItem>\n )\n }\n\n return null\n })}\n {!editingDefaultLocale && (\n <React.Fragment>\n {showMinRows && (\n <Banner type=\"error\">\n {t('validation:requiresAtLeast', {\n count: minRows,\n label:\n getTranslation(minRows > 1 ? labels.plural : labels.singular, i18n) ||\n t(minRows > 1 ? 'general:row' : 'general:rows'),\n })}\n </Banner>\n )}\n {showRequired && (\n <Banner>\n {t('validation:fieldHasNo', { label: getTranslation(labels.plural, i18n) })}\n </Banner>\n )}\n </React.Fragment>\n )}\n </DraggableSortable>\n )}\n {!disabled && !hasMaxRows && (\n <Fragment>\n <DrawerToggler className={`${baseClass}__drawer-toggler`} slug={drawerSlug}>\n <Button\n buttonStyle=\"icon-label\"\n el=\"span\"\n icon=\"plus\"\n iconPosition=\"left\"\n iconStyle=\"with-border\"\n >\n {t('fields:addLabel', { label: getTranslation(labels.singular, i18n) })}\n </Button>\n </DrawerToggler>\n <BlocksDrawer\n addRow={addRow}\n addRowIndex={rows?.length || 0}\n blocks={blocks}\n drawerSlug={drawerSlug}\n labels={labels}\n />\n </Fragment>\n )}\n </div>\n )\n}\n\nexport const BlocksField = withCondition(_BlocksField)\n"],"names":["getTranslation","React","Fragment","useCallback","Banner","Button","DraggableSortableItem","DraggableSortable","DrawerToggler","useDrawerSlug","ErrorPill","useFieldProps","useForm","useFormSubmitted","NullifyLocaleField","useField","withCondition","useConfig","useDocumentInfo","useLocale","useTranslation","scrollToID","FieldDescription","FieldError","FieldLabel","fieldBaseClass","BlockRow","BlocksDrawer","baseClass","_BlocksField","props","i18n","t","name","CustomDescription","CustomError","CustomLabel","blocks","className","descriptionProps","errorProps","forceRender","isSortable","label","labelProps","labels","labelsFromProps","localized","maxRows","minRows","minRowsProp","path","pathFromProps","readOnly","readOnlyFromProps","required","validate","indexPath","readOnlyFromContext","setDocFieldPreferences","addFieldRow","dispatchFields","setModified","code","locale","localization","drawerSlug","submitted","plural","singular","editingDefaultLocale","fallback","defaultLocale","memoizedValidate","value","options","pathFromContext","errorPaths","formInitializing","formProcessing","permissions","rows","schemaPath","showError","valid","hasRows","disabled","addRow","rowIndex","blockType","data","setTimeout","duplicateRow","type","removeRow","moveRow","moveFromIndex","moveToIndex","toggleCollapseAll","collapsed","setCollapse","rowID","hasMaxRows","length","fieldErrorCount","fieldHasErrors","showMinRows","showRequired","div","filter","Boolean","join","id","replace","header","h3","as","unstyled","count","withMessage","ul","li","button","onClick","fieldValue","ids","map","row","onDragEnd","i","blockToRender","find","block","slug","rowErrorCount","errorPath","startsWith","draggableSortableItemProps","errorCount","rowCount","buttonStyle","el","icon","iconPosition","iconStyle","addRowIndex","BlocksField"],"mappings":"AAAA;;AAGA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,SAASC,QAAQ,EAAEC,WAAW,QAAQ,QAAO;AAKpD,SAASC,MAAM,QAAQ,iCAAgC;AACvD,SAASC,MAAM,QAAQ,iCAAgC;AACvD,SAASC,qBAAqB,QAAQ,kEAAiE;AACvG,SAASC,iBAAiB,QAAQ,4CAA2C;AAC7E,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,aAAa,QAAQ,yCAAwC;AACtE,SAASC,SAAS,QAAQ,oCAAmC;AAC7D,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,OAAO,EAAEC,gBAAgB,QAAQ,8BAA6B;AACvE,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,SAAS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AAE,yBAAyB;oCAAEW,OAAO3C,eAAe6C,OAAOuB,MAAM,EAAErC;gCAAM;;;;;;YAOpF,CAACuD,YAAY,CAACgB,4BACb,MAACpG;;kCACC,KAACM;wBAAc8B,WAAW,CAAC,EAAEV,UAAU,gBAAgB,CAAC;wBAAEyG,MAAMnE;kCAC9D,cAAA,KAAC7D;4BACCuI,aAAY;4BACZC,IAAG;4BACHC,MAAK;4BACLC,cAAa;4BACbC,WAAU;sCAEThH,EAAE,mBAAmB;gCAAEW,OAAO3C,eAAe6C,OAAOwB,QAAQ,EAAEtC;4BAAM;;;kCAGzE,KAACJ;wBACC4D,QAAQA;wBACR0D,aAAahE,MAAMsB,UAAU;wBAC7BlE,QAAQA;wBACR6B,YAAYA;wBACZrB,QAAQA;;;;;;AAMpB;AAEA,OAAO,MAAMqG,cAAclI,cAAca,cAAa"}
@@ -66,7 +66,8 @@ const _CheckboxField = (props)=>{
66
66
  /*#__PURE__*/ _jsx(FieldError, {
67
67
  CustomError: CustomError,
68
68
  path: path,
69
- ...errorProps || {}
69
+ ...errorProps || {},
70
+ alignCaret: "left"
70
71
  }),
71
72
  /*#__PURE__*/ _jsx(CheckboxInput, {
72
73
  AfterInput: AfterInput,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/Checkbox/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientValidate } from 'payload'\n\nimport React, { useCallback } from 'react'\n\nimport type { CheckboxInputProps } from './Input.js'\nimport type { CheckboxFieldProps } from './types.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useForm } from '../../forms/Form/context.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useEditDepth } from '../../providers/EditDepth/index.js'\nimport { generateFieldID } from '../../utilities/generateFieldID.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { CheckboxInput } from './Input.js'\nimport './index.scss'\n\nconst baseClass = 'checkbox'\n\nexport { CheckboxFieldProps, CheckboxInput, type CheckboxInputProps }\n\nconst _CheckboxField: React.FC<CheckboxFieldProps> = (props) => {\n const {\n id,\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n checked: checkedFromProps,\n className,\n descriptionProps,\n disableFormData,\n errorProps,\n label,\n labelProps,\n onChange: onChangeFromProps,\n partialChecked,\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n width,\n } = props\n\n const { uuid } = useForm()\n\n const editDepth = useEditDepth()\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, path, setValue, showError, value } = useField({\n disableFormData,\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const onToggle = useCallback(() => {\n if (!disabled) {\n setValue(!value)\n if (typeof onChangeFromProps === 'function') onChangeFromProps(!value)\n }\n }, [onChangeFromProps, disabled, setValue, value])\n\n const checked = checkedFromProps || Boolean(value)\n\n const fieldID = id || generateFieldID(path, editDepth, uuid)\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n showError && 'error',\n className,\n value && `${baseClass}--checked`,\n disabled && `${baseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n <CheckboxInput\n AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n CustomLabel={CustomLabel}\n checked={checked}\n id={fieldID}\n inputRef={null}\n label={label}\n labelProps={labelProps}\n name={path}\n onToggle={onToggle}\n partialChecked={partialChecked}\n readOnly={disabled}\n required={required}\n />\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n )\n}\n\nexport const CheckboxField = withCondition(_CheckboxField)\n"],"names":["React","useCallback","useFieldProps","useForm","useField","withCondition","useEditDepth","generateFieldID","FieldDescription","FieldError","fieldBaseClass","CheckboxInput","baseClass","_CheckboxField","props","id","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","checked","checkedFromProps","className","descriptionProps","disableFormData","errorProps","label","labelProps","onChange","onChangeFromProps","partialChecked","path","pathFromProps","readOnly","readOnlyFromProps","required","style","validate","width","uuid","editDepth","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formInitializing","formProcessing","setValue","showError","disabled","onToggle","Boolean","fieldID","div","filter","join","inputRef","undefined","CheckboxField"],"mappings":"AAAA;;AAGA,OAAOA,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,OAAO,QAAQ,8BAA6B;AACrD,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,YAAY,QAAQ,qCAAoC;AACjE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,aAAa,QAAQ,aAAY;AAC1C,OAAO,eAAc;AAErB,MAAMC,YAAY;AAElB,SAA6BD,aAAa,GAA2B;AAErE,MAAME,iBAA+C,CAACC;IACpD,MAAM,EACJC,EAAE,EACFC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,SAASC,gBAAgB,EACzBC,SAAS,EACTC,gBAAgB,EAChBC,eAAe,EACfC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,UAAUC,iBAAiB,EAC3BC,cAAc,EACdC,MAAMC,aAAa,EAC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KAAChB;gBACCM,YAAYA;gBACZC,aAAaA;gBACbG,aAAaA;gBACbC,SAASA;gBACTP,IAAIwC;gBACJI,UAAU;gBACV/B,OAAOA;gBACPC,YAAYA;gBACZb,MAAMiB;gBACNoB,UAAUA;gBACVrB,gBAAgBA;gBAChBG,UAAUiB;gBACVf,UAAUA;;YAEXlB,sBAAsByC,YACrBzC,kCAEA,KAACX;gBAAkB,GAAIiB,oBAAoB,CAAC,CAAC;;;;AAIrD;AAEA,OAAO,MAAMoC,gBAAgBxD,cAAcQ,gBAAe"}
1
+ {"version":3,"sources":["../../../src/fields/Checkbox/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientValidate } from 'payload'\n\nimport React, { useCallback } from 'react'\n\nimport type { CheckboxInputProps } from './Input.js'\nimport type { CheckboxFieldProps } from './types.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useForm } from '../../forms/Form/context.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useEditDepth } from '../../providers/EditDepth/index.js'\nimport { generateFieldID } from '../../utilities/generateFieldID.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { CheckboxInput } from './Input.js'\nimport './index.scss'\n\nconst baseClass = 'checkbox'\n\nexport { CheckboxFieldProps, CheckboxInput, type CheckboxInputProps }\n\nconst _CheckboxField: React.FC<CheckboxFieldProps> = (props) => {\n const {\n id,\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n checked: checkedFromProps,\n className,\n descriptionProps,\n disableFormData,\n errorProps,\n label,\n labelProps,\n onChange: onChangeFromProps,\n partialChecked,\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n width,\n } = props\n\n const { uuid } = useForm()\n\n const editDepth = useEditDepth()\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, path, setValue, showError, value } = useField({\n disableFormData,\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const onToggle = useCallback(() => {\n if (!disabled) {\n setValue(!value)\n if (typeof onChangeFromProps === 'function') onChangeFromProps(!value)\n }\n }, [onChangeFromProps, disabled, setValue, value])\n\n const checked = checkedFromProps || Boolean(value)\n\n const fieldID = id || generateFieldID(path, editDepth, uuid)\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n showError && 'error',\n className,\n value && `${baseClass}--checked`,\n disabled && `${baseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} alignCaret=\"left\" />\n <CheckboxInput\n AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n CustomLabel={CustomLabel}\n checked={checked}\n id={fieldID}\n inputRef={null}\n label={label}\n labelProps={labelProps}\n name={path}\n onToggle={onToggle}\n partialChecked={partialChecked}\n readOnly={disabled}\n required={required}\n />\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n )\n}\n\nexport const CheckboxField = withCondition(_CheckboxField)\n"],"names":["React","useCallback","useFieldProps","useForm","useField","withCondition","useEditDepth","generateFieldID","FieldDescription","FieldError","fieldBaseClass","CheckboxInput","baseClass","_CheckboxField","props","id","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","checked","checkedFromProps","className","descriptionProps","disableFormData","errorProps","label","labelProps","onChange","onChangeFromProps","partialChecked","path","pathFromProps","readOnly","readOnlyFromProps","required","style","validate","width","uuid","editDepth","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formInitializing","formProcessing","setValue","showError","disabled","onToggle","Boolean","fieldID","div","filter","join","alignCaret","inputRef","undefined","CheckboxField"],"mappings":"AAAA;;AAGA,OAAOA,SAASC,WAAW,QAAQ,QAAO;AAK1C,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,OAAO,QAAQ,8BAA6B;AACrD,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,YAAY,QAAQ,qCAAoC;AACjE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,aAAa,QAAQ,aAAY;AAC1C,OAAO,eAAc;AAErB,MAAMC,YAAY;AAElB,SAA6BD,aAAa,GAA2B;AAErE,MAAME,iBAA+C,CAACC;IACpD,MAAM,EACJC,EAAE,EACFC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,SAASC,gBAAgB,EACzBC,SAAS,EACTC,gBAAgB,EAChBC,eAAe,EACfC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,UAAUC,iBAAiB,EAC3BC,cAAc,EACdC,MAAMC,aAAa,EACnBC,UAAUC,iBAAiB,EAC3BC,QAAQ,EACRC,KAAK,EACLC,QAAQ,EACRC,KAAK,EACN,GAAG1B;IAEJ,MAAM,EAAE2B,IAAI,EAAE,GAAGtC;IAEjB,MAAMuC,YAAYpC;IAElB,MAAMqC,mBAAmC1C,YACvC,CAAC2C,OAAOC;QACN,IAAI,OAAON,aAAa,YAAY;YAClC,OAAOA,SAASK,OAAO;gBAAE,GAAGC,OAAO;gBAAER;YAAS;QAChD;IACF,GACA;QAACE;QAAUF;KAAS;IAGtB,MAAM,EAAEJ,MAAMa,eAAe,EAAEX,UAAUY,mBAAmB,EAAE,GAAG7C;IAEjE,MAA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idden='true']) {
8
8
  right: auto;
9
- position: relative;
9
+ position: static;
10
+ transform: translateY(calc(var(--caret-size) * -1));
10
11
  margin-bottom: 0.2em;
11
12
  max-width: fit-content;
12
13
  }
@@ -1,5 +1,5 @@
1
1
  import type { FormFieldBase } from '../shared/index.js';
2
- export type CheckboxFieldProps = FormFieldBase & {
2
+ export type CheckboxFieldProps = {
3
3
  checked?: boolean;
4
4
  disableFormData?: boolean;
5
5
  id?: string;
@@ -8,5 +8,5 @@ export type CheckboxFieldProps = FormFieldBase & {
8
8
  partialChecked?: boolean;
9
9
  path?: string;
10
10
  width?: string;
11
- };
11
+ } & FormFieldBase;
12
12
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/Checkbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IACjC,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/Checkbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IACjC,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,aAAa,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/Checkbox/types.ts"],"sourcesContent":["import type { FormFieldBase } from '../shared/index.js'\n\nexport type CheckboxFieldProps = FormFieldBase & {\n checked?: boolean\n disableFormData?: boolean\n id?: string\n name?: string\n onChange?: (val: boolean) => void\n partialChecked?: boolean\n path?: string\n width?: string\n}\n"],"names":[],"mappings":"AAEA,WASC"}
1
+ {"version":3,"sources":["../../../src/fields/Checkbox/types.ts"],"sourcesContent":["import type { FormFieldBase } from '../shared/index.js'\n\nexport type CheckboxFieldProps = {\n checked?: boolean\n disableFormData?: boolean\n id?: string\n name?: string\n onChange?: (val: boolean) => void\n partialChecked?: boolean\n path?: string\n width?: string\n} & FormFieldBase\n"],"names":[],"mappings":"AAEA,WASiB"}
@@ -2,12 +2,12 @@ import type { CodeField as CodeFieldType } from 'payload';
2
2
  import React from 'react';
3
3
  import type { FormFieldBase } from '../shared/index.js';
4
4
  import './index.scss';
5
- export type CodeFieldProps = FormFieldBase & {
5
+ export type CodeFieldProps = {
6
6
  editorOptions?: CodeFieldType['admin']['editorOptions'];
7
7
  language?: CodeFieldType['admin']['language'];
8
8
  name?: string;
9
9
  path?: string;
10
10
  width: string;
11
- };
11
+ } & FormFieldBase;
12
12
  export declare const CodeField: React.FC<CodeFieldProps>;
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Code/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,SAAS,CAAA;AAEzD,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAUvD,OAAO,cAAc,CAAA;AAErB,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG;IAC3C,aAAa,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,CAAA;IACvD,QAAQ,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,CAAA;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAyFD,eAAO,MAAM,SAAS,0BAA4B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Code/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,SAAS,CAAA;AAEzD,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAUvD,OAAO,cAAc,CAAA;AAErB,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,CAAA;IACvD,QAAQ,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,CAAA;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd,GAAG,aAAa,CAAA;AAyFjB,eAAO,MAAM,SAAS,0BAA4B,CAAA"}
@@ -1,4 +1,4 @@
1
- /* eslint-disable react/destructuring-assignment */ 'use client';
1
+ 'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import React, { useCallback } from 'react';
4
4
  import { CodeEditor } from '../../elements/CodeEditor/index.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/Code/index.tsx"],"sourcesContent":["/* eslint-disable react/destructuring-assignment */\n'use client'\nimport type { CodeField as CodeFieldType } from 'payload'\n\nimport React, { useCallback } from 'react'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { CodeEditor } from '../../elements/CodeEditor/index.js'\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nexport type CodeFieldProps = FormFieldBase & {\n editorOptions?: CodeFieldType['admin']['editorOptions']\n language?: CodeFieldType['admin']['language']\n name?: string\n path?: string\n width: string\n}\n\nconst prismToMonacoLanguageMap = {\n js: 'javascript',\n ts: 'typescript',\n}\n\nconst baseClass = 'code-field'\n\nconst _CodeField: React.FC<CodeFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n editorOptions = {},\n errorProps,\n label,\n labelProps,\n language = 'javascript',\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n width,\n } = props\n\n const memoizedValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, path, setValue, showError, value } = useField({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && 'error',\n disabled && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n {BeforeInput}\n <CodeEditor\n defaultLanguage={prismToMonacoLanguageMap[language] || language}\n onChange={disabled ? () => null : (val) => setValue(val)}\n options={editorOptions}\n readOnly={disabled}\n value={(value as string) || ''}\n />\n {AfterInput}\n </div>\n {CustomDescription ? CustomDescription : <FieldDescription {...(descriptionProps || {})} />}\n </div>\n )\n}\n\nexport const CodeField = withCondition(_CodeField)\n"],"names":["React","useCallback","CodeEditor","useFieldProps","useField","withCondition","FieldDescription","FieldError","FieldLabel","fieldBaseClass","prismToMonacoLanguageMap","js","ts","baseClass","_CodeField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","descriptionProps","editorOptions","errorProps","label","labelProps","language","path","pathFromProps","readOnly","readOnlyFromProps","required","style","validate","width","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formInitializing","formProcessing","setValue","showError","disabled","div","filter","Boolean","join","defaultLanguage","onChange","val","CodeField"],"mappings":"AAAA,iDAAiD,GACjD;;AAGA,OAAOA,SAASC,WAAW,QAAQ,QAAO;AAI1C,SAASC,UAAU,QAAQ,qCAAoC;AAC/D,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,cAAc,QAAQ,qBAAoB;AACnD,OAAO,eAAc;AAUrB,MAAMC,2BAA2B;IAC/BC,IAAI;IACJC,IAAI;AACN;AAEA,MAAMC,YAAY;AAElB,MAAMC,aAAuC,CAACC;IAC5C,MAAM,EACJC,IAAI,EACJC,UAAU,EACV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AO,CAACO,MAAQT,SAASS;wBACpDd,SAASf;wBACTO,UAAUe;wBACVR,OAAO,AAACA,SAAoB;;oBAE7BrB;;;YAEFE,oBAAoBA,kCAAoB,KAACb;gBAAkB,GAAIiB,oBAAoB,CAAC,CAAC;;;;AAG5F;AAEA,OAAO,MAAM+B,YAAYjD,cAAcS,YAAW"}
1
+ {"version":3,"sources":["../../../src/fields/Code/index.tsx"],"sourcesContent":["'use client'\nimport type { CodeField as CodeFieldType } from 'payload'\n\nimport React, { useCallback } from 'react'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { CodeEditor } from '../../elements/CodeEditor/index.js'\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nexport type CodeFieldProps = {\n editorOptions?: CodeFieldType['admin']['editorOptions']\n language?: CodeFieldType['admin']['language']\n name?: string\n path?: string\n width: string\n} & FormFieldBase\n\nconst prismToMonacoLanguageMap = {\n js: 'javascript',\n ts: 'typescript',\n}\n\nconst baseClass = 'code-field'\n\nconst _CodeField: React.FC<CodeFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n editorOptions = {},\n errorProps,\n label,\n labelProps,\n language = 'javascript',\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n width,\n } = props\n\n const memoizedValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, path, setValue, showError, value } = useField({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && 'error',\n disabled && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n {BeforeInput}\n <CodeEditor\n defaultLanguage={prismToMonacoLanguageMap[language] || language}\n onChange={disabled ? () => null : (val) => setValue(val)}\n options={editorOptions}\n readOnly={disabled}\n value={(value as string) || ''}\n />\n {AfterInput}\n </div>\n {CustomDescription ? CustomDescription : <FieldDescription {...(descriptionProps || {})} />}\n </div>\n )\n}\n\nexport const CodeField = withCondition(_CodeField)\n"],"names":["React","useCallback","CodeEditor","useFieldProps","useField","withCondition","FieldDescription","FieldError","FieldLabel","fieldBaseClass","prismToMonacoLanguageMap","js","ts","baseClass","_CodeField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","descriptionProps","editorOptions","errorProps","label","labelProps","language","path","pathFromProps","readOnly","readOnlyFromProps","required","style","validate","width","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formInitializing","formProcessing","setValue","showError","disabled","div","filter","Boolean","join","defaultLanguage","onChange","val","CodeField"],"mappings":"AAAA;;AAGA,OAAOA,SAASC,WAAW,QAAQ,QAAO;AAI1C,SAASC,UAAU,QAAQ,qCAAoC;AAC/D,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,cAAc,QAAQ,qBAAoB;AACnD,O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wBAAaS,MAAMA;wBAAO,GAAIJ,cAAc,CAAC,CAAC;;oBACtEP;kCACD,KAAChB;wBACCiD,iBAAiBzC,wBAAwB,CAACkB,SAAS,IAAIA;wBACvDwB,UAAUN,WAAW,IAAM,OAAO,CAACO,MAAQT,SAASS;wBACpDd,SAASf;wBACTO,UAAUe;wBACVR,OAAO,AAACA,SAAoB;;oBAE7BrB;;;YAEFE,oBAAoBA,kCAAoB,KAACb;gBAAkB,GAAIiB,oBAAoB,CAAC,CAAC;;;;AAG5F;AAEA,OAAO,MAAM+B,YAAYjD,cAAcS,YAAW"}
@@ -10,27 +10,9 @@
10
10
  .code-editor {
11
11
  border-color: var(--theme-error-500);
12
12
  }
13
- }
14
- }
15
-
16
- html[data-theme='light'] {
17
- .code-field {
18
- &.error {
19
- .monaco-editor-background,
20
- .margin {
21
- background-color: var(--theme-error-50);
22
- }
23
- }
24
- }
25
- }
26
-
27
- html[data-theme='dark'] {
28
- .code-field {
29
- &.error {
30
- .monaco-editor-background,
31
- .margin {
32
- background-color: var(--theme-error-100);
33
- }
13
+ .monaco-editor-background,
14
+ .margin {
15
+ background-color: var(--theme-error-50);
34
16
  }
35
17
  }
36
18
  }
@@ -2,10 +2,10 @@ import React from 'react';
2
2
  import './index.scss';
3
3
  import type { FieldMap } from '../../providers/ComponentMap/buildComponentMap/types.js';
4
4
  import type { FormFieldBase } from '../shared/index.js';
5
- export type CollapsibleFieldProps = FormFieldBase & {
5
+ export type CollapsibleFieldProps = {
6
6
  fieldMap: FieldMap;
7
7
  initCollapsed?: boolean;
8
8
  width?: string;
9
- };
9
+ } & FormFieldBase;
10
10
  export declare const CollapsibleField: React.FC<CollapsibleFieldProps>;
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Collapsible/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAqD,MAAM,OAAO,CAAA;AAazE,OAAO,cAAc,CAAA;AAIrB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yDAAyD,CAAA;AACvF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAKvD,MAAM,MAAM,qBAAqB,GAAG,aAAa,GAAG;IAClD,QAAQ,EAAE,QAAQ,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAwID,eAAO,MAAM,gBAAgB,iCAAmC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Collapsible/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAqD,MAAM,OAAO,CAAA;AAazE,OAAO,cAAc,CAAA;AAIrB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yDAAyD,CAAA;AACvF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAKvD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,QAAQ,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,aAAa,CAAA;AAwIjB,eAAO,MAAM,gBAAgB,iCAAmC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/Collapsible/index.tsx"],"sourcesContent":["'use client'\nimport type { DocumentPreferences, FieldPermissions } from 'payload'\n\nimport React, { Fragment, useCallback, useEffect, useState } from 'react'\n\nimport { Collapsible as CollapsibleElement } from '../../elements/Collapsible/index.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { RenderFields } from '../../forms/RenderFields/index.js'\nimport { RowLabel } from '../../forms/RowLabel/index.js'\nimport { WatchChildErrors } from '../../forms/WatchChildErrors/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { usePreferences } from '../../providers/Preferences/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nconst baseClass = 'collapsible-field'\n\nimport type { FieldMap } from '../../providers/ComponentMap/buildComponentMap/types.js'\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { useFormInitializing, useFormProcessing } from '../../forms/Form/context.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\n\nexport type CollapsibleFieldProps = FormFieldBase & {\n fieldMap: FieldMap\n initCollapsed?: boolean\n width?: string\n}\n\nconst _CollapsibleField: React.FC<CollapsibleFieldProps> = (props) => {\n const {\n CustomDescription,\n CustomLabel,\n className,\n descriptionProps,\n fieldMap,\n initCollapsed = false,\n label,\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n } = props\n\n const {\n indexPath,\n path: pathFromContext,\n readOnly: readOnlyFromContext,\n schemaPath,\n siblingPermissions,\n } = useFieldProps()\n\n const formInitializing = useFormInitializing()\n const formProcessing = useFormProcessing()\n\n const path = pathFromContext ?? pathFromProps\n\n const { i18n } = useTranslation()\n const { getPreference, setPreference } = usePreferences()\n const { preferencesKey } = useDocumentInfo()\n const [collapsedOnMount, setCollapsedOnMount] = useState<boolean>()\n const fieldPreferencesKey = `collapsible-${indexPath.replace(/\\./g, '__')}`\n const [errorCount, setErrorCount] = useState(0)\n const fieldHasErrors = errorCount > 0\n\n const onToggle = useCallback(\n async (newCollapsedState: boolean) => {\n const existingPreferences: DocumentPreferences = await getPreference(preferencesKey)\n\n if (preferencesKey) {\n void setPreference(preferencesKey, {\n ...existingPreferences,\n ...(path\n ? {\n fields: {\n ...(existingPreferences?.fields || {}),\n [path]: {\n ...existingPreferences?.fields?.[path],\n collapsed: newCollapsedState,\n },\n },\n }\n : {\n fields: {\n ...(existingPreferences?.fields || {}),\n [fieldPreferencesKey]: {\n ...existingPreferences?.fields?.[fieldPreferencesKey],\n collapsed: newCollapsedState,\n },\n },\n }),\n })\n }\n },\n [preferencesKey, fieldPreferencesKey, getPreference, setPreference, path],\n )\n\n useEffect(() => {\n const fetchInitialState = async () => {\n if (preferencesKey) {\n const preferences = await getPreference(preferencesKey)\n const specificPreference = path\n ? preferences?.fields?.[path]?.collapsed\n : preferences?.fields?.[fieldPreferencesKey]?.collapsed\n\n if (specificPreference !== undefined) {\n setCollapsedOnMount(Boolean(specificPreference))\n } else {\n setCollapsedOnMount(typeof initCollapsed === 'boolean' ? initCollapsed : false)\n }\n } else {\n setCollapsedOnMount(typeof initCollapsed === 'boolean' ? initCollapsed : false)\n }\n }\n\n void fetchInitialState()\n }, [getPreference, preferencesKey, fieldPreferencesKey, initCollapsed, path])\n\n if (typeof collapsedOnMount !== 'boolean') return null\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n return (\n <Fragment>\n <WatchChildErrors fieldMap={fieldMap} path={path} setErrorCount={setErrorCount} />\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${fieldPreferencesKey}${path ? `-${path.replace(/\\./g, '__')}` : ''}`}\n >\n <CollapsibleElement\n className={`${baseClass}__collapsible`}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n <div className={`${baseClass}__row-label-wrap`}>\n <RowLabel RowLabelComponent={CustomLabel} i18n={i18n} path={path} rowLabel={label} />\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n }\n initCollapsed={collapsedOnMount}\n onToggle={onToggle}\n >\n <RenderFields\n fieldMap={fieldMap}\n forceRender\n indexPath={indexPath}\n margins=\"small\"\n path={path}\n permissions={siblingPermissions}\n readOnly={disabled}\n schemaPath={schemaPath}\n />\n </CollapsibleElement>\n <FieldDescription CustomDescription={CustomDescription} {...(descriptionProps || {})} />\n </div>\n </Fragment>\n )\n}\n\nexport const CollapsibleField = withCondition(_CollapsibleField)\n"],"names":["React","Fragment","useCallback","useEffect","useState","Collapsible","CollapsibleElement","ErrorPill","useFieldProps","RenderFields","RowLabel","WatchChildErrors","withCondition","useDocumentInfo","usePreferences","useTranslation","fieldBaseClass","baseClass","useFormInitializing","useFormProcessing","FieldDescription","_CollapsibleField","props","CustomDescription","CustomLabel","className","descriptionProps","fieldMap","initCollapsed","label","path","pathFromProps","readOnly","readOnlyFromProps","indexPath","pathFromContext","readOnlyFromContext","schemaPath","siblingPermissions","formInitializing","formProcessing","i18n","getPreference","setPreference","preferencesKey","collapsedOnMount","setCollapsedOnMount","fieldPreferencesKey","replace","errorCount","setErrorCount","fieldHasErrors","onToggle","newCollapsedState","existingPreferences","fields","collapsed","fetchInitialState","preferences","specificPreference","undefined","Boolean","disabled","div","filter","join","id","collapsibleStyle","header","RowLabelComponent","rowLabel","count","withMessage","forceRender","margins","permissions","CollapsibleField"],"mappings":"AAAA;;AAGA,OAAOA,SAASC,QAAQ,EAAEC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAEzE,SAASC,eAAeC,kBAAkB,QAAQ,sCAAqC;AACvF,SAASC,SAAS,QAAQ,oCAAmC;AAC7D,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,YAAY,QAAQ,oCAAmC;AAChE,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,gBAAgB,QAAQ,wCAAuC;AACxE,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,qBAAoB;AACnD,OAAO,eAAc;AAErB,MAAMC,YAAY;AAKlB,SAASC,mBAAmB,EAAEC,iBAAiB,QAAQ,8BAA6B;AACpF,SAASC,gBAAgB,QAAQ,+BAA8B;AAQ/D,MAAMC,oBAAqD,CAACC;IAC1D,MAAM,EACJC,iBAAiB,EACjBC,WAAW,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,gCAAkB,KAAC5C;oCAAUgE,OAAOtB;oCAAYR,MAAMA;oCAAM+B,WAAW;;;;wBAG5E5C,eAAeiB;wBACfO,UAAUA;kCAEV,cAAA,KAAC3C;4BACCkB,UAAUA;4BACV8C,WAAW;4BACXvC,WAAWA;4BACXwC,SAAQ;4BACR5C,MAAMA;4BACN6C,aAAarC;4BACbN,UAAU8B;4BACVzB,YAAYA;;;kCAGhB,KAACjB;wBAAiBG,mBAAmBA;wBAAoB,GAAIG,oBAAoB,CAAC,CAAC;;;;;;AAI3F;AAEA,OAAO,MAAMkD,mBAAmBhE,cAAcS,mBAAkB"}
1
+ {"version":3,"sources":["../../../src/fields/Collapsible/index.tsx"],"sourcesContent":["'use client'\nimport type { DocumentPreferences, FieldPermissions } from 'payload'\n\nimport React, { Fragment, useCallback, useEffect, useState } from 'react'\n\nimport { Collapsible as CollapsibleElement } from '../../elements/Collapsible/index.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { RenderFields } from '../../forms/RenderFields/index.js'\nimport { RowLabel } from '../../forms/RowLabel/index.js'\nimport { WatchChildErrors } from '../../forms/WatchChildErrors/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { usePreferences } from '../../providers/Preferences/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nconst baseClass = 'collapsible-field'\n\nimport type { FieldMap } from '../../providers/ComponentMap/buildComponentMap/types.js'\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { useFormInitializing, useFormProcessing } from '../../forms/Form/context.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\n\nexport type CollapsibleFieldProps = {\n fieldMap: FieldMap\n initCollapsed?: boolean\n width?: string\n} & FormFieldBase\n\nconst _CollapsibleField: React.FC<CollapsibleFieldProps> = (props) => {\n const {\n CustomDescription,\n CustomLabel,\n className,\n descriptionProps,\n fieldMap,\n initCollapsed = false,\n label,\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n } = props\n\n const {\n indexPath,\n path: pathFromContext,\n readOnly: readOnlyFromContext,\n schemaPath,\n siblingPermissions,\n } = useFieldProps()\n\n const formInitializing = useFormInitializing()\n const formProcessing = useFormProcessing()\n\n const path = pathFromContext ?? pathFromProps\n\n const { i18n } = useTranslation()\n const { getPreference, setPreference } = usePreferences()\n const { preferencesKey } = useDocumentInfo()\n const [collapsedOnMount, setCollapsedOnMount] = useState<boolean>()\n const fieldPreferencesKey = `collapsible-${indexPath.replace(/\\./g, '__')}`\n const [errorCount, setErrorCount] = useState(0)\n const fieldHasErrors = errorCount > 0\n\n const onToggle = useCallback(\n async (newCollapsedState: boolean) => {\n const existingPreferences: DocumentPreferences = await getPreference(preferencesKey)\n\n if (preferencesKey) {\n void setPreference(preferencesKey, {\n ...existingPreferences,\n ...(path\n ? {\n fields: {\n ...(existingPreferences?.fields || {}),\n [path]: {\n ...existingPreferences?.fields?.[path],\n collapsed: newCollapsedState,\n },\n },\n }\n : {\n fields: {\n ...(existingPreferences?.fields || {}),\n [fieldPreferencesKey]: {\n ...existingPreferences?.fields?.[fieldPreferencesKey],\n collapsed: newCollapsedState,\n },\n },\n }),\n })\n }\n },\n [preferencesKey, fieldPreferencesKey, getPreference, setPreference, path],\n )\n\n useEffect(() => {\n const fetchInitialState = async () => {\n if (preferencesKey) {\n const preferences = await getPreference(preferencesKey)\n const specificPreference = path\n ? preferences?.fields?.[path]?.collapsed\n : preferences?.fields?.[fieldPreferencesKey]?.collapsed\n\n if (specificPreference !== undefined) {\n setCollapsedOnMount(Boolean(specificPreference))\n } else {\n setCollapsedOnMount(typeof initCollapsed === 'boolean' ? initCollapsed : false)\n }\n } else {\n setCollapsedOnMount(typeof initCollapsed === 'boolean' ? initCollapsed : false)\n }\n }\n\n void fetchInitialState()\n }, [getPreference, preferencesKey, fieldPreferencesKey, initCollapsed, path])\n\n if (typeof collapsedOnMount !== 'boolean') return null\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n return (\n <Fragment>\n <WatchChildErrors fieldMap={fieldMap} path={path} setErrorCount={setErrorCount} />\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${fieldPreferencesKey}${path ? `-${path.replace(/\\./g, '__')}` : ''}`}\n >\n <CollapsibleElement\n className={`${baseClass}__collapsible`}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n <div className={`${baseClass}__row-label-wrap`}>\n <RowLabel RowLabelComponent={CustomLabel} i18n={i18n} path={path} rowLabel={label} />\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n }\n initCollapsed={collapsedOnMount}\n onToggle={onToggle}\n >\n <RenderFields\n fieldMap={fieldMap}\n forceRender\n indexPath={indexPath}\n margins=\"small\"\n path={path}\n permissions={siblingPermissions}\n readOnly={disabled}\n schemaPath={schemaPath}\n />\n </CollapsibleElement>\n <FieldDescription CustomDescription={CustomDescription} {...(descriptionProps || {})} />\n </div>\n </Fragment>\n )\n}\n\nexport const CollapsibleField = withCondition(_CollapsibleField)\n"],"names":["React","Fragment","useCallback","useEffect","useState","Collapsible","CollapsibleElement","ErrorPill","useFieldProps","RenderFields","RowLabel","WatchChildErrors","withCondition","useDocumentInfo","usePreferences","useTranslation","fieldBaseClass","baseClass","useFormInitializing","useFormProcessing","FieldDescription","_CollapsibleField","props","CustomDescription","CustomLabel","className","descriptionProps","fieldMap","initCollapsed","label","path","pathFromProps","readOnly","readOnlyFromProps","indexPath","pathFromContext","readOnlyFromContext","schemaPath","siblingPermissions","formInitializing","formProcessing","i18n","getPreference","setPreference","preferencesKey","collapsedOnMount","setCollapsedOnMount","fieldPreferencesKey","replace","errorCount","setErrorCount","fieldHasErrors","onToggle","newCollapsedState","existingPreferences","fields","collapsed","fetchInitialState","preferences","specificPreference","undefined","Boolean","disabled","div","filter","join","id","collapsibleStyle","header","RowLabelComponent","rowLabel","count","withMessage","forceRender","margins","permissions","CollapsibleField"],"mappings":"AAAA;;AAGA,OAAOA,SAASC,QAAQ,EAAEC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAEzE,SAASC,eAAeC,kBAAkB,QAAQ,sCAAqC;AACvF,SAASC,SAAS,QAAQ,oCAAmC;AAC7D,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,YAAY,QAAQ,oCAAmC;AAChE,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,gBAAgB,QAAQ,wCAAuC;AACxE,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,qBAAoB;AACnD,OAAO,eAAc;AAErB,MAAMC,YAAY;AAKlB,SAASC,mBAAmB,EAAEC,iBAAiB,QAAQ,8BAA6B;AACpF,SAASC,gBAAgB,QAAQ,+BAA8B;AAQ/D,MAAMC,oBAAqD,CAACC;IAC1D,MAAM,EACJC,iBAAiB,EACjBC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,QAAQ,EACRC,gBAAgB,KAAK,EACrBC,KAAK,EACLC,MAAMC,aAAa,EACnBC,UAAUC,iBAAiB,EAC5B,GAAGX;IAEJ,MAAM,EACJY,SAAS,EACTJ,MAAMK,eAAe,EACrBH,UAAUI,mBAAmB,EAC7BC,UAAU,EACVC,kBAAkB,EACnB,GAAG9B;IAEJ,MAAM+B,mBAAmBrB;IACzB,MAAMsB,iBAAiBrB;IAEvB,MAAMW,OAAOK,mBAAmBJ;IAEhC,MAAM,EAAEU,IAAI,EAAE,GAAG1B;IACjB,MAAM,EAAE2B,aAAa,EAAEC,aAAa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
7
  align-items: center;
8
8
  gap: base(0.5);
9
9
  }
10
-
11
- &--has-error {
12
- border: 1px solid var(--theme-error-500);
13
- }
14
10
  }
@@ -2,12 +2,12 @@ import type { DateField } from 'payload';
2
2
  import React from 'react';
3
3
  import './index.scss';
4
4
  import type { FormFieldBase } from '../shared/index.js';
5
- export type DateFieldProps = FormFieldBase & {
5
+ export type DateFieldProps = {
6
6
  date?: DateField['admin']['date'];
7
7
  name?: string;
8
8
  path?: string;
9
9
  placeholder?: DateField['admin']['placeholder'] | string;
10
10
  width?: string;
11
- };
11
+ } & FormFieldBase;
12
12
  export declare const DateTimeField: React.FC<DateFieldProps>;
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/DateTime/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAkB,SAAS,EAAE,MAAM,SAAS,CAAA;AAGxD,OAAO,KAAsB,MAAM,OAAO,CAAA;AAO1C,OAAO,cAAc,CAAA;AAIrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAOvD,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG;IAC3C,IAAI,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,GAAG,MAAM,CAAA;IACxD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AA0FD,eAAO,MAAM,aAAa,0BAAgC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/DateTime/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkB,SAAS,EAAE,MAAM,SAAS,CAAA;AAGxD,OAAO,KAAsB,MAAM,OAAO,CAAA;AAO1C,OAAO,cAAc,CAAA;AAIrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAOvD,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,GAAG,MAAM,CAAA;IACxD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,aAAa,CAAA;AA0FjB,eAAO,MAAM,aAAa,0BAAgC,CAAA"}
@@ -1,4 +1,4 @@
1
- /* eslint-disable react/destructuring-assignment */ 'use client';
1
+ 'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { getTranslation } from '@payloadcms/translations';
4
4
  import React, { useCallback } from 'react';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/DateTime/index.tsx"],"sourcesContent":["/* eslint-disable react/destructuring-assignment */\n'use client'\nimport type { ClientValidate, DateField } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback } from 'react'\n\nimport { DatePickerField } from '../../elements/DatePicker/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nconst baseClass = 'date-time-field'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\n\nexport type DateFieldProps = FormFieldBase & {\n date?: DateField['admin']['date']\n name?: string\n path?: string\n placeholder?: DateField['admin']['placeholder'] | string\n width?: string\n}\n\nconst _DateTimeField: React.FC<DateFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n date: datePickerProps,\n descriptionProps,\n errorProps,\n label,\n labelProps,\n path: pathFromProps,\n placeholder,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n width,\n } = props\n\n const { i18n } = useTranslation()\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, path, setValue, showError, value } = useField<Date>({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && `${baseClass}--has-error`,\n disabled && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <div className={`${fieldBaseClass}__wrap`} id={`field-${path.replace(/\\./g, '__')}`}>\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n {BeforeInput}\n <DatePickerField\n {...datePickerProps}\n onChange={(incomingDate) => {\n if (!disabled) setValue(incomingDate?.toISOString() || null)\n }}\n placeholder={getTranslation(placeholder, i18n)}\n readOnly={disabled}\n value={value}\n />\n {AfterInput}\n </div>\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n )\n}\n\nexport const DateTimeField = withCondition(_DateTimeField)\n"],"names":["getTranslation","React","useCallback","DatePickerField","useField","useTranslation","FieldLabel","fieldBaseClass","baseClass","useFieldProps","withCondition","FieldDescription","FieldError","_DateTimeField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","date","datePickerProps","descriptionProps","errorProps","label","labelProps","path","pathFromProps","placeholder","readOnly","readOnlyFromProps","required","style","validate","width","i18n","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formInitializing","formProcessing","setValue","showError","disabled","div","filter","Boolean","join","id","replace","onChange","incomingDate","toISOString","undefined","DateTimeField"],"mappings":"AAAA,iDAAiD,GACjD;;AAGA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAE1C,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,cAAc,QAAQ,qBAAoB;AACnD,OAAO,eAAc;AAErB,MAAMC,YAAY;AAIlB,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,UAAU,QAAQ,yBAAwB;AAUnD,MAAMC,iBAA2C,CAACC;IAChD,MAAM,EACJC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,SAAS,EACTC,MAAMC,eAAe,EACrBC,gBAAgB,EAChBC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,MAAMC,aAAa,EACnBC,WAAW,EACXC,UAAUC,iBAAiB,EAC3BC,QAAQ,EACRC,KAAK,EACLC,QAAQ,EACRC,KAAK,EACN,GAAGtB;IAEJ,MAAM,EAAEuB,IAAI,EAAE,GAAGhC;IAEjB,MAAMiC,mBAAmCpC,YACvC,CAACqC,OAAOC;QACN,IAAI,OAAOL,aAAa,YAAY;YAClC,OAAOA,SAASI,OAAO;gBAAE,GAAGC,OAAO;gBAAEP;YAAS;QAChD;IACF,GACA;QAACE;QAAUF;KAAS;IAGtB,MAAM,EAAEL,MAAMa,eAAe,EAAEV,UAAUW,mBAAmB,EAAE,GAAGjC;IAEjE,MAAM,EAAEkC,gBAAgB,EAAEC,cAAc,EAAEhB,IAAI,EAAEiB,QAAQ,EAAEC,SAAS,EAAEP,KAAK,EAAE,GAAGnC,SAAe;QAC5FwB,MAAMa,mBAAmBZ,iBAAiBd;QAC1CoB,UAAUG;IACZ;IAEA,MAAMS,WAAWf,qBAAqBU,uBAAuBE,kBAAkBD;IAE/E,qBACE,MAACK;QACC3B,WAAW;YACTd;YACAC;YACAa;YACAyB,aAAa,CAAC,EAAEtC,UAAU,WAAW,CAAC;YACtCuC,YAAY;SACb,CACEE,MAAM,CAACC,SACPC,IAAI,CAAC;QACRjB,OAAO;YACL,GAAGA,KAAK;YACRE;QACF;;0BAEA,KAAC9B;gBACCc,aAAaA;gBACbM,OAAOA;gBACPO,UAAUA;gBACT,GAAIN,cAAc,CAAC,CAAC;;0BAEvB,MAACqB;gBAAI3B,WAAW,CAAC,EAAEd,eAAe,MAAM,CAAC;gBAAE6C,IAAI,CAAC,MAAM,EAAExB,KAAKyB,OAAO,CAAC,OAAO,MAAM,CAAC;;kCACjF,KAACzC;wBAAWO,aAAaA;wBAAaS,MAAMA;wBAAO,GAAIH,cAAc,CAAC,CAAC;;oBACtER;kCACD,KAACd;wBACE,GAAGoB,eAAe;wBACnB+B,UAAU,CAACC;4BACT,IAAI,CAACR,UAAUF,SAASU,cAAcC,iBAAiB;wBACzD;wBACA1B,aAAa9B,eAAe8B,aAAaO;wBACzCN,UAAUgB;wBACVR,OAAOA;;oBAERvB;;;YAEFE,sBAAsBuC,YACrBvC,kCAEA,KAACP;gBAAkB,GAAIa,oBAAoB,CAAC,CAAC;;;;AAIrD;AAEA,OAAO,MAAMkC,gBAAgBhD,cAAcG,gBAAe"}
1
+ {"version":3,"sources":["../../../src/fields/DateTime/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientValidate, DateField } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback } from 'react'\n\nimport { DatePickerField } from '../../elements/DatePicker/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nconst baseClass = 'date-time-field'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\n\nexport type DateFieldProps = {\n date?: DateField['admin']['date']\n name?: string\n path?: string\n placeholder?: DateField['admin']['placeholder'] | string\n width?: string\n} & FormFieldBase\n\nconst _DateTimeField: React.FC<DateFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n date: datePickerProps,\n descriptionProps,\n errorProps,\n label,\n labelProps,\n path: pathFromProps,\n placeholder,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n width,\n } = props\n\n const { i18n } = useTranslation()\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, path, setValue, showError, value } = useField<Date>({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && `${baseClass}--has-error`,\n disabled && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <div className={`${fieldBaseClass}__wrap`} id={`field-${path.replace(/\\./g, '__')}`}>\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n {BeforeInput}\n <DatePickerField\n {...datePickerProps}\n onChange={(incomingDate) => {\n if (!disabled) setValue(incomingDate?.toISOString() || null)\n }}\n placeholder={getTranslation(placeholder, i18n)}\n readOnly={disabled}\n value={value}\n />\n {AfterInput}\n </div>\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n )\n}\n\nexport const DateTimeField = withCondition(_DateTimeField)\n"],"names":["getTranslation","React","useCallback","DatePickerField","useField","useTranslation","FieldLabel","fieldBaseClass","baseClass","useFieldProps","withCondition","FieldDescription","FieldError","_DateTimeField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","className","date","datePickerProps","descriptionProps","errorProps","label","labelProps","path","pathFromProps","placeholder","readOnly","readOnlyFromProps","required","style","validate","width","i18n","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formInitializing","formProcessing","setValue","showError","disabled","div","filter","Boolean","join","id","replace","onChange","incomingDate","toISOString","undefined","DateTimeField"],"mappings":"AAAA;;AAGA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAE1C,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,cAAc,QAAQ,qBAAoB;AACnD,OAAO,eAAc;AAErB,MAAMC,YAAY;AAIlB,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,UAAU,QAAQ,yBAAwB;AAUnD,MAAMC,iBAA2C,CAACC;IAChD,MAAM,EACJC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXC,WA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;kCACD,KAACd;wBACE,GAAGoB,eAAe;wBACnB+B,UAAU,CAACC;4BACT,IAAI,CAACR,UAAUF,SAASU,cAAcC,iBAAiB;wBACzD;wBACA1B,aAAa9B,eAAe8B,aAAaO;wBACzCN,UAAUgB;wBACVR,OAAOA;;oBAERvB;;;YAEFE,sBAAsBuC,YACrBvC,kCAEA,KAACP;gBAAkB,GAAIa,oBAAoB,CAAC,CAAC;;;;AAIrD;AAEA,OAAO,MAAMkC,gBAAgBhD,cAAcG,gBAAe"}
@@ -2,12 +2,12 @@ import type { EmailField as EmailFieldType } from 'payload';
2
2
  import React from 'react';
3
3
  import type { FormFieldBase } from '../shared/index.js';
4
4
  import './index.scss';
5
- export type EmailFieldProps = FormFieldBase & {
5
+ export type EmailFieldProps = {
6
6
  autoComplete?: string;
7
7
  name?: string;
8
8
  path?: string;
9
9
  placeholder?: EmailFieldType['admin']['placeholder'];
10
10
  width?: string;
11
- };
11
+ } & FormFieldBase;
12
12
  export declare const EmailField: React.FC<EmailFieldProps>;
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Email/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkB,UAAU,IAAI,cAAc,EAAE,MAAM,SAAS,CAAA;AAG3E,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAUvD,OAAO,cAAc,CAAA;AAErB,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG;IAC5C,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAA;IACpD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAqFD,eAAO,MAAM,UAAU,2BAA6B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Email/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkB,UAAU,IAAI,cAAc,EAAE,MAAM,SAAS,CAAA;AAG3E,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAUvD,OAAO,cAAc,CAAA;AAErB,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAA;IACpD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,aAAa,CAAA;AAqFjB,eAAO,MAAM,UAAU,2BAA6B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/Email/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientValidate, EmailField as EmailFieldType } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback } from 'react'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nexport type EmailFieldProps = FormFieldBase & {\n autoComplete?: string\n name?: string\n path?: string\n placeholder?: EmailFieldType['admin']['placeholder']\n width?: string\n}\n\nconst _EmailField: React.FC<EmailFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n autoComplete,\n className,\n descriptionProps,\n errorProps,\n label,\n labelProps,\n path: pathFromProps,\n placeholder,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n width,\n } = props\n\n const { i18n } = useTranslation()\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, path, setValue, showError, value } = useField({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n return (\n <div\n className={[fieldBaseClass, 'email', className, showError && 'error', disabled && 'read-only']\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n {BeforeInput}\n <input\n autoComplete={autoComplete}\n disabled={disabled}\n id={`field-${path.replace(/\\./g, '__')}`}\n name={path}\n onChange={setValue}\n placeholder={getTranslation(placeholder, i18n)}\n type=\"email\"\n value={(value as string) || ''}\n />\n {AfterInput}\n </div>\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n )\n}\n\nexport const EmailField = withCondition(_EmailField)\n"],"names":["getTranslation","React","useCallback","useFieldProps","useField","withCondition","useTranslation","FieldDescription","FieldError","FieldLabel","fieldBaseClass","_EmailField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","autoComplete","className","descriptionProps","errorProps","label","labelProps","path","pathFromProps","placeholder","readOnly","readOnlyFromProps","required","style","validate","width","i18n","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formInitializing","formProcessing","setValue","showError","disabled","div","filter","Bo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BAAkBD;IAE/E,qBACE,MAACK;QACCzB,WAAW;YAACV;YAAgB;YAASU;YAAWuB,aAAa;YAASC,YAAY;SAAY,CAC3FE,MAAM,CAACC,SACPC,IAAI,CAAC;QACRjB,OAAO;YACL,GAAGA,KAAK;YACRE;QACF;;0BAEA,KAACxB;gBACCS,aAAaA;gBACbK,OAAOA;gBACPO,UAAUA;gBACT,GAAIN,cAAc,CAAC,CAAC;;0BAEvB,MAACqB;gBAAIzB,WAAW,CAAC,EAAEV,eAAe,MAAM,CAAC;;kCACvC,KAACF;wBAAWS,aAAaA;wBAAaQ,MAAMA;wBAAO,GAAIH,cAAc,CAAC,CAAC;;oBACtEP;kCACD,KAACkC;wBACC9B,cAAcA;wBACdyB,UAAUA;wBACVM,IAAI,CAAC,MAAM,EAAEzB,KAAK0B,OAAO,CAAC,OAAO,MAAM,CAAC;wBACxCtC,MAAMY;wBACN2B,UAAUV;wBACVf,aAAa3B,eAAe2B,aAAaO;wBACzCmB,MAAK;wBACLjB,OAAO,AAACA,SAAoB;;oBAE7BtB;;;YAEFE,sBAAsBsC,YACrBtC,kCAEA,KAACT;gBAAkB,GAAIc,oBAAoB,CAAC,CAAC;;;;AAIrD;AAEA,OAAO,MAAMkC,aAAalD,cAAcM,aAAY"}
1
+ {"version":3,"sources":["../../../src/fields/Email/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientValidate, EmailField as EmailFieldType } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback } from 'react'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nexport type EmailFieldProps = {\n autoComplete?: string\n name?: string\n path?: string\n placeholder?: EmailFieldType['admin']['placeholder']\n width?: string\n} & FormFieldBase\n\nconst _EmailField: React.FC<EmailFieldProps> = (props) => {\n const {\n name,\n AfterInput,\n BeforeInput,\n CustomDescription,\n CustomError,\n CustomLabel,\n autoComplete,\n className,\n descriptionProps,\n errorProps,\n label,\n labelProps,\n path: pathFromProps,\n placeholder,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n width,\n } = props\n\n const { i18n } = useTranslation()\n\n const memoizedValidate: ClientValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const { formInitializing, formProcessing, path, setValue, showError, value } = useField({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n return (\n <div\n className={[fieldBaseClass, 'email', className, showError && 'error', disabled && 'read-only']\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n {BeforeInput}\n <input\n autoComplete={autoComplete}\n disabled={disabled}\n id={`field-${path.replace(/\\./g, '__')}`}\n name={path}\n onChange={setValue}\n placeholder={getTranslation(placeholder, i18n)}\n type=\"email\"\n value={(value as string) || ''}\n />\n {AfterInput}\n </div>\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n )\n}\n\nexport const EmailField = withCondition(_EmailField)\n"],"names":["getTranslation","React","useCallback","useFieldProps","useField","withCondition","useTranslation","FieldDescription","FieldError","FieldLabel","fieldBaseClass","_EmailField","props","name","AfterInput","BeforeInput","CustomDescription","CustomError","CustomLabel","autoComplete","className","descriptionProps","errorProps","label","labelProps","path","pathFromProps","placeholder","readOnly","readOnlyFromProps","required","style","validate","width","i18n","memoizedValidate","value","options","pathFromContext","readOnlyFromContext","formInitializing","formProcessing","setValue","showError","disabled","div","filter","Boolean","join","input","id","replace","onChange","type","undefined","EmailField"],"mappings":"AAAA;;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,cAAc,QAAQ,uCAAsC;AACrE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,cAAc,QAAQ,qBAAoB;AACnD,OAAO,eAAc;AAUrB,MAAMC,cAAyC,CAACC;IAC9C,MAAM,EACJC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,YAAY,EACZC,SAAS,EACTC,gBAAgB,EAChBC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,MAAMC,aAAa,EACnBC,WAAW,EACXC,UAAUC,iBAAiB,EAC3BC,QAAQ,EACRC,KAAK,EACLC,QAAQ,EACRC,KAAK,EACN,GAAGrB;IAEJ,MAAM,EAAEsB,IAAI,EAAE,GAAG5B;IAEjB,MAAM6B,mBAAmCjC,YACvC,CAACkC,OAAOC;QACN,IAAI,OAAOL,aAAa,YAAY;YAClC,OAAOA,SAASI,OAAO;gBAAE,GAAGC,OAAO;gBAAEP;YAAS;QAChD;IACF,GACA;QAACE;QAAUF;KAAS;IAGtB,MAAM,EAAEL,MAAMa,eAAe,EAAEV,UAAUW,mBAAmB,EAAE,GAAGpC;IAEjE,MAAM,EAAEqC,gBAAgB,EAAEC,cAAc,EAAEhB,IAAI,EAAEiB,QAAQ,EAAEC,SAAS,EAAEP,KAAK,EAAE,GAAGhC,SAAS;QACtFqB,MAAMa,mBAAmBZ,iBAAiBb;QAC1CmB,UAAUG;IACZ;IAEA,MAAMS,WAAWf,qBAAqBU,uBAAuBE,kBAAkBD;IAE/E,qBACE,MAACK;QACCzB,WAAW;YAACV;YAAgB;YAASU;YAAWuB,aAAa;YAASC,YAAY;SAAY,CAC3FE,MAAM,CAACC,SACPC,IAAI,CAAC;QACRjB,OAAO;YACL,GAAGA,KAAK;YACRE;QACF;;0BAEA,KAACxB;gBACCS,aAAaA;gBACbK,OAAOA;gBACPO,UAAUA;gBACT,GAAIN,cAAc,CAAC,CAAC;;0BAEvB,MAACqB;gBAAIzB,WAAW,CAAC,EAAEV,eAAe,MAAM,CAAC;;kCACvC,KAACF;wBAAWS,aAAaA;wBAAaQ,MAAMA;wBAAO,GAAIH,cAAc,CAAC,CAAC;;oBACtEP;kCACD,KAACkC;wBACC9B,cAAcA;wBACdyB,UAAUA;wBACVM,IAAI,CAAC,MAAM,EAAEzB,KAAK0B,OAAO,CAAC,OAAO,MAAM,CAAC;wBACxCtC,MAAMY;wBACN2B,UAAUV;wBACVf,aAAa3B,eAAe2B,aAAaO;wBACzCmB,MAAK;wBACLjB,OAAO,AAACA,SAAoB;;oBAE7BtB;;;YAEFE,sBAAsBsC,YACrBtC,kCAEA,KAACT;gBAAkB,GAAIc,oBAAoB,CAAC,CAAC;;;;AAIrD;AAEA,OAAO,MAAMkC,aAAalD,cAAcM,aAAY"}
@@ -4,12 +4,13 @@
4
4
  font-family: var(--font-body);
5
5
  left: auto;
6
6
  max-width: 75%;
7
- right: calc(var(--base) * 0.5);
8
- transform: none;
9
- background-color: var(--theme-error-500);
7
+ right: 0;
8
+ transform: translateY(calc(var(--caret-size) * -1));
9
+ color: var(--theme-error-950);
10
+ background-color: var(--theme-error-300);
10
11
 
11
12
  &::after {
12
- border-top-color: var(--theme-error-500);
13
- border-bottom-color: var(--theme-error-500);
13
+ border-top-color: var(--theme-error-300);
14
+ border-bottom-color: var(--theme-error-300);
14
15
  }
15
16
  }
@@ -3,13 +3,13 @@ import type { FieldMap } from '../../providers/ComponentMap/buildComponentMap/ty
3
3
  import type { FormFieldBase } from '../shared/index.js';
4
4
  import './index.scss';
5
5
  import { GroupProvider, useGroup } from './provider.js';
6
- export type GroupFieldProps = FormFieldBase & {
6
+ export type GroupFieldProps = {
7
7
  fieldMap: FieldMap;
8
8
  forceRender?: boolean;
9
9
  hideGutter?: boolean;
10
10
  name?: string;
11
11
  width?: string;
12
- };
12
+ } & FormFieldBase;
13
13
  export declare const _GroupField: React.FC<GroupFieldProps>;
14
14
  export { GroupProvider, useGroup };
15
15
  export declare const GroupField: React.FC<GroupFieldProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Group/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yDAAyD,CAAA;AACvF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAkBvD,OAAO,cAAc,CAAA;AACrB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAIvD,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG;IAC5C,QAAQ,EAAE,QAAQ,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAqFjD,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAA;AAElC,eAAO,MAAM,UAAU,2BAA6B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Group/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yDAAyD,CAAA;AACvF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAkBvD,OAAO,cAAc,CAAA;AACrB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAIvD,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,QAAQ,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,aAAa,CAAA;AAEjB,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAqFjD,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAA;AAElC,eAAO,MAAM,UAAU,2BAA6B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/Group/index.tsx"],"sourcesContent":["'use client'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment } from 'react'\n\nimport type { FieldMap } from '../../providers/ComponentMap/buildComponentMap/types.js'\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { useCollapsible } from '../../elements/Collapsible/provider.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport {\n useFormInitializing,\n useFormProcessing,\n useFormSubmitted,\n} from '../../forms/Form/context.js'\nimport { RenderFields } from '../../forms/RenderFields/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { useRow } from '../Row/provider.js'\nimport { useTabs } from '../Tabs/provider.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\nimport { GroupProvider, useGroup } from './provider.js'\n\nconst baseClass = 'group-field'\n\nexport type GroupFieldProps = FormFieldBase & {\n fieldMap: FieldMap\n forceRender?: boolean\n hideGutter?: boolean\n name?: string\n width?: string\n}\n\nexport const _GroupField: React.FC<GroupFieldProps> = (props) => {\n const {\n CustomDescription,\n CustomLabel,\n className,\n descriptionProps,\n fieldMap,\n hideGutter,\n label,\n readOnly: readOnlyFromProps,\n style,\n width,\n } = props\n\n const { path, permissions, readOnly: readOnlyFromContext, schemaPath } = useFieldProps()\n const { i18n } = useTranslation()\n const { isWithinCollapsible } = useCollapsible()\n const isWithinGroup = useGroup()\n const isWithinRow = useRow()\n const isWithinTab = useTabs()\n const { errorPaths } = useField({ path })\n const formInitializing = useFormInitializing()\n const formProcessing = useFormProcessing()\n const submitted = useFormSubmitted()\n const errorCount = errorPaths.length\n const fieldHasErrors = submitted && errorCount > 0\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const isTopLevel = !(isWithinCollapsible || isWithinGroup || isWithinRow)\n\n return (\n <Fragment>\n <div\n className={[\n fieldBaseClass,\n baseClass,\n isTopLevel && `${baseClass}--top-level`,\n isWithinCollapsible && `${baseClass}--within-collapsible`,\n isWithinGroup && `${baseClass}--within-group`,\n isWithinRow && `${baseClass}--within-row`,\n isWithinTab && `${baseClass}--within-tab`,\n !hideGutter && isWithinGroup && `${baseClass}--gutter`,\n fieldHasErrors && `${baseClass}--has-error`,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${path?.replace(/\\./g, '__')}`}\n style={{\n ...style,\n width,\n }}\n >\n <GroupProvider>\n <div className={`${baseClass}__wrap`}>\n <div className={`${baseClass}__header`}>\n {(CustomLabel || CustomDescription || label) && (\n <header>\n {CustomLabel !== undefined ? (\n CustomLabel\n ) : label ? (\n <h3 className={`${baseClass}__title`}>{getTranslation(label, i18n)}</h3>\n ) : null}\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </header>\n )}\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n <RenderFields\n fieldMap={fieldMap}\n margins=\"small\"\n path={path}\n permissions={permissions?.fields}\n readOnly={disabled}\n schemaPath={schemaPath}\n />\n </div>\n </GroupProvider>\n </div>\n </Fragment>\n )\n}\n\nexport { GroupProvider, useGroup }\n\nexport const GroupField = withCondition(_GroupField)\n"],"names":["getTranslation","React","Fragment","useCollapsible","ErrorPill","useFieldProps","useFormInitializing","useFormProcessing","useFormSubmitted","RenderFields","useField","withCondition","useTranslation","FieldDescription","useRow","useTabs","fieldBaseClass","GroupProvider","useGroup","baseClass","_GroupField","props","CustomDescription","CustomLabel","className","descriptionProps","fieldMap","hideGutter","label","readOnly","readOnlyFromProps","style","width","path","permissions","readOnlyFromContext","schemaPath","i18n","isWithinCollapsible","isWithinGroup","isWithinRow","isWithinTab","errorPaths","formInitializing","formProcessing","submitted","errorCount","length","fieldHasErrors","disabled","isTopLevel","div","filter","Boolean","join","id","replace","header","undefined","h3","count","withMessage","margins","fields","GroupField"],"mappings":"AAAA;;AAEA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,SAASC,QAAQ,QAAQ,QAAO;AAKvC,SAASC,cAAc,QAAQ,yCAAwC;AACvE,SAASC,SAAS,QAAQ,oCAAmC;AAC7D,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SACEC,mBAAmB,EACnBC,iBAAiB,EACjBC,gBAAgB,QACX,8BAA6B;AACpC,SAASC,YAAY,QAAQ,oCAAmC;AAChE,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,MAAM,QAAQ,qBAAoB;AAC3C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CAACQ,cAAcY,iBAAiB,CAAC,EAAEpB,UAAU,QAAQ,CAAC;gBACtD6B,kBAAkB,CAAC,EAAE7B,UAAU,WAAW,CAAC;gBAC3CK;aACD,CACE4B,MAAM,CAACC,SACPC,IAAI,CAAC;YACRC,IAAI,CAAC,MAAM,EAAEtB,MAAMuB,QAAQ,OAAO,MAAM,CAAC;YACzCzB,OAAO;gBACL,GAAGA,KAAK;gBACRC;YACF;sBAEA,cAAA,KAACf;0BACC,cAAA,MAACkC;oBAAI3B,WAAW,CAAC,EAAEL,UAAU,MAAM,CAAC;;sCAClC,MAACgC;4BAAI3B,WAAW,CAAC,EAAEL,UAAU,QAAQ,CAAC;;gCAClCI,CAAAA,eAAeD,qBAAqBM,KAAI,mBACxC,MAAC6B;;wCACElC,gBAAgBmC,YACfnC,cACEK,sBACF,KAAC+B;4CAAGnC,WAAW,CAAC,EAAEL,UAAU,OAAO,CAAC;sDAAGnB,eAAe4B,OAAOS;6CAC3D;wCACHf,sBAAsBoC,YACrBpC,kCAEA,KAACT;4CAAkB,GAAIY,oBAAoB,CAAC,CAAC;;;;gCAIlDuB,gCAAkB,KAAC5C;oCAAUwD,OAAOd;oCAAYT,MAAMA;oCAAMwB,WAAW;;;;sCAE1E,KAACpD;4BACCiB,UAAUA;4BACVoC,SAAQ;4BACR7B,MAAMA;4BACNC,aAAaA,aAAa6B;4BAC1BlC,UAAUoB;4BACVb,YAAYA;;;;;;;AAO1B,EAAC;AAED,SAASnB,aAAa,EAAEC,QAAQ,GAAE;AAElC,OAAO,MAAM8C,aAAarD,cAAcS,aAAY"}
1
+ {"version":3,"sources":["../../../src/fields/Group/index.tsx"],"sourcesContent":["'use client'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment } from 'react'\n\nimport type { FieldMap } from '../../providers/ComponentMap/buildComponentMap/types.js'\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { useCollapsible } from '../../elements/Collapsible/provider.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport {\n useFormInitializing,\n useFormProcessing,\n useFormSubmitted,\n} from '../../forms/Form/context.js'\nimport { RenderFields } from '../../forms/RenderFields/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { useRow } from '../Row/provider.js'\nimport { useTabs } from '../Tabs/provider.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\nimport { GroupProvider, useGroup } from './provider.js'\n\nconst baseClass = 'group-field'\n\nexport type GroupFieldProps = {\n fieldMap: FieldMap\n forceRender?: boolean\n hideGutter?: boolean\n name?: string\n width?: string\n} & FormFieldBase\n\nexport const _GroupField: React.FC<GroupFieldProps> = (props) => {\n const {\n CustomDescription,\n CustomLabel,\n className,\n descriptionProps,\n fieldMap,\n hideGutter,\n label,\n readOnly: readOnlyFromProps,\n style,\n width,\n } = props\n\n const { path, permissions, readOnly: readOnlyFromContext, schemaPath } = useFieldProps()\n const { i18n } = useTranslation()\n const { isWithinCollapsible } = useCollapsible()\n const isWithinGroup = useGroup()\n const isWithinRow = useRow()\n const isWithinTab = useTabs()\n const { errorPaths } = useField({ path })\n const formInitializing = useFormInitializing()\n const formProcessing = useFormProcessing()\n const submitted = useFormSubmitted()\n const errorCount = errorPaths.length\n const fieldHasErrors = submitted && errorCount > 0\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const isTopLevel = !(isWithinCollapsible || isWithinGroup || isWithinRow)\n\n return (\n <Fragment>\n <div\n className={[\n fieldBaseClass,\n baseClass,\n isTopLevel && `${baseClass}--top-level`,\n isWithinCollapsible && `${baseClass}--within-collapsible`,\n isWithinGroup && `${baseClass}--within-group`,\n isWithinRow && `${baseClass}--within-row`,\n isWithinTab && `${baseClass}--within-tab`,\n !hideGutter && isWithinGroup && `${baseClass}--gutter`,\n fieldHasErrors && `${baseClass}--has-error`,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${path?.replace(/\\./g, '__')}`}\n style={{\n ...style,\n width,\n }}\n >\n <GroupProvider>\n <div className={`${baseClass}__wrap`}>\n <div className={`${baseClass}__header`}>\n {(CustomLabel || CustomDescription || label) && (\n <header>\n {CustomLabel !== undefined ? (\n CustomLabel\n ) : label ? (\n <h3 className={`${baseClass}__title`}>{getTranslation(label, i18n)}</h3>\n ) : null}\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </header>\n )}\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n <RenderFields\n fieldMap={fieldMap}\n margins=\"small\"\n path={path}\n permissions={permissions?.fields}\n readOnly={disabled}\n schemaPath={schemaPath}\n />\n </div>\n </GroupProvider>\n </div>\n </Fragment>\n )\n}\n\nexport { GroupProvider, useGroup }\n\nexport const GroupField = withCondition(_GroupField)\n"],"names":["getTranslation","React","Fragment","useCollapsible","ErrorPill","useFieldProps","useFormInitializing","useFormProcessing","useFormSubmitted","RenderFields","useField","withCondition","useTranslation","FieldDescription","useRow","useTabs","fieldBaseClass","GroupProvider","useGroup","baseClass","_GroupField","props","CustomDescription","CustomLabel","className","descriptionProps","fieldMap","hideGutter","label","readOnly","readOnlyFromProps","style","width","path","permissions","readOnlyFromContext","schemaPath","i18n","isWithinCollapsible","isWithinGroup","isWithinRow","isWithinTab","errorPaths","formInitializing","formProcessing","submitted","errorCount","length","fieldHasErrors","disabled","isTopLevel","div","filter","Boolean","join","id","replace","header","undefined","h3","count","withMessage","margins","fields","GroupField"],"mappings":"AAAA;;AAEA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,SAASC,QAAQ,QAAQ,QAAO;AAKvC,SAASC,cAAc,QAAQ,yCAAwC;AACvE,SAASC,SAAS,QAAQ,oCAAmC;AAC7D,SAASC,aAAa,QAAQ,0C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